From e945ee741665ee35a27284d7ccf91e6c446af3d7 Mon Sep 17 00:00:00 2001 From: Matt Szczerba Date: Thu, 4 Jan 2024 14:12:53 -0500 Subject: [PATCH] Updated editor client and server code for internal deployment --- .env | 3 + package-lock.json | 126 +- package.json | 5 +- public/index-ca-en.html | 2 + public/index-ca-fr.html | 2 + public/index.html | 3 +- public/scripts/ramp4/ramp.css | 1 + public/scripts/ramp4/ramp.esm.js | 316657 +++++++++++++++++++ public/scripts/ramp4/ramp.js | 8490 + server/.env | 5 + server/index.js | 59 +- server/package-lock.json | 3030 + server/package.json | 4 +- server/web.config | 15 + src/app.vue | 9 + src/components/editor/landing.vue | 31 +- src/components/editor/map-editor.vue | 10 +- src/components/editor/metadata-editor.vue | 281 +- src/components/editor/preview.vue | 55 +- src/lang/lang.csv | 5 +- src/main.ts | 6 +- src/stores/userStore.ts | 40 + vue.config.js | 16 + 23 files changed, 328773 insertions(+), 82 deletions(-) create mode 100644 .env create mode 100644 public/scripts/ramp4/ramp.css create mode 100644 public/scripts/ramp4/ramp.esm.js create mode 100644 public/scripts/ramp4/ramp.js create mode 100644 server/.env create mode 100644 server/package-lock.json create mode 100644 server/web.config create mode 100644 src/stores/userStore.ts diff --git a/.env b/.env new file mode 100644 index 00000000..fc254837 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +VUE_APP_API_URL=#{API_URL}# +VUE_APP_CURR_ENV=#{CURR_ENV}# +VUE_APP_NET_API_URL=#{NET_API_URL}# \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f6d02a81..fbcaa3d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ "markdown-it": "^12.0.6", "nouislider": "^15.5.0", "ramp-config-editor_editeur-config-pcar": "^1.1.8", - "ramp-storylines_demo-scenarios-pcar": "^3.1.3", "uuid": "^9.0.0", "vue": "^3.3.4", "vue-class-component": "^8.0.0-rc.1", @@ -54,12 +53,14 @@ "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-vue": "^6.2.2", "html-loader": "^0.5.5", + "pinia": "^2.1.7", "postcss": "^7.0.35", "prettier": "^2.2.1", + "ramp-storylines_demo-scenarios-pcar": "^3.1.5", "sass": "^1.32.11", "sass-loader": "^8.0.2", "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.1.2", - "typescript": "~4.1.5", + "typescript": "^4.4.4", "vue-eslint-parser": "^9.3.1" } }, @@ -14115,7 +14116,8 @@ "node_modules/papaparse": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz", - "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==" + "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==", + "dev": true }, "node_modules/parallel-transform": { "version": "1.2.0", @@ -14357,6 +14359,58 @@ "node": ">=6" } }, + "node_modules/pinia": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz", + "integrity": "sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==", + "dev": true, + "dependencies": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.3.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/vue-demi": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", + "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -15575,9 +15629,10 @@ } }, "node_modules/ramp-storylines_demo-scenarios-pcar": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.1.3.tgz", - "integrity": "sha512-0da9++y4oeuFcxmusi5N1hnrB4K5lQrLjal3XfMZP8OGyY/D3aYL7OGqx+Ez4h1iz2LdqlrGepTf04gDlc6iJA==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.1.5.tgz", + "integrity": "sha512-6OiHl9pv6E3kxaITsLDL/Z0I+5nRcIg4nvuH+Ln9xUWKa+9zzNANMqSBDqlfk9PuJPq8NkjIyk9ALgtuPtQJTQ==", + "dev": true, "dependencies": { "@tailwindcss/typography": "^0.4.0", "@types/highcharts": "^7.0.0", @@ -16384,6 +16439,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz", "integrity": "sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==", + "dev": true, "engines": { "node": ">=0.10.0" }, @@ -16394,7 +16450,8 @@ "node_modules/scrollama": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/scrollama/-/scrollama-3.2.0.tgz", - "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==" + "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==", + "dev": true }, "node_modules/section-matter": { "version": "1.0.0", @@ -18667,9 +18724,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", - "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "devOptional": true, "bin": { "tsc": "bin/tsc", @@ -19348,6 +19405,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/vue-fullscreen/-/vue-fullscreen-3.1.1.tgz", "integrity": "sha512-I59sIO0O22116gwVPo1qM2cNf5binEC5vTswIm8qJsqgatGfFquIJANpoVggSUS2EgUF0Xg4tHliT1ITcwQw8Q==", + "dev": true, "dependencies": { "screenfull": "^5.1.0" }, @@ -19541,6 +19599,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/vue-papa-parse/-/vue-papa-parse-3.1.0.tgz", "integrity": "sha512-5YdF3Dtf49EGfaz3+IgIpUw9yYuvV3HekZkob6jrK/Ffz1aCrWjevtcQByKxrNtK7RAL39B0ca93bogKuiQQKg==", + "dev": true, "dependencies": { "papaparse": "^5.3.0" }, @@ -19634,6 +19693,7 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/vue3-carousel/-/vue3-carousel-0.3.3.tgz", "integrity": "sha512-VsuOBE4LG9lxAiYGR9U7ps4RyJ4oFQGzk79/49ybvoxzNpahPAVWIDHKK3a1lOv0CSplFq6u4FvaFLZ8x3FgWg==", + "dev": true, "peerDependencies": { "vue": "^3.2.0" } @@ -19642,6 +19702,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/vue3-scrollama/-/vue3-scrollama-0.2.2.tgz", "integrity": "sha512-RGjqv7J1H3Ro/o/90K/k2L5rdowE+hG6HlTxA7Pc/oZDazLc7jzGqhh+2fmzmQ//LqMtRJYrAdjXsyXsrc58bA==", + "dev": true, "dependencies": { "scrollama": "^3.2.0" }, @@ -31674,7 +31735,8 @@ "papaparse": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz", - "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==" + "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==", + "dev": true }, "parallel-transform": { "version": "1.2.0", @@ -31866,6 +31928,25 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, + "pinia": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz", + "integrity": "sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==", + "dev": true, + "requires": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": ">=0.14.5" + }, + "dependencies": { + "vue-demi": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", + "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", + "dev": true, + "requires": {} + } + } + }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -32854,9 +32935,10 @@ } }, "ramp-storylines_demo-scenarios-pcar": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.1.3.tgz", - "integrity": "sha512-0da9++y4oeuFcxmusi5N1hnrB4K5lQrLjal3XfMZP8OGyY/D3aYL7OGqx+Ez4h1iz2LdqlrGepTf04gDlc6iJA==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/ramp-storylines_demo-scenarios-pcar/-/ramp-storylines_demo-scenarios-pcar-3.1.5.tgz", + "integrity": "sha512-6OiHl9pv6E3kxaITsLDL/Z0I+5nRcIg4nvuH+Ln9xUWKa+9zzNANMqSBDqlfk9PuJPq8NkjIyk9ALgtuPtQJTQ==", + "dev": true, "requires": { "@tailwindcss/typography": "^0.4.0", "@types/highcharts": "^7.0.0", @@ -33478,12 +33560,14 @@ "screenfull": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz", - "integrity": "sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==" + "integrity": "sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==", + "dev": true }, "scrollama": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/scrollama/-/scrollama-3.2.0.tgz", - "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==" + "integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==", + "dev": true }, "section-matter": { "version": "1.0.0", @@ -35287,9 +35371,9 @@ "dev": true }, "typescript": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.6.tgz", - "integrity": "sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "devOptional": true }, "uc.micro": { @@ -35796,6 +35880,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/vue-fullscreen/-/vue-fullscreen-3.1.1.tgz", "integrity": "sha512-I59sIO0O22116gwVPo1qM2cNf5binEC5vTswIm8qJsqgatGfFquIJANpoVggSUS2EgUF0Xg4tHliT1ITcwQw8Q==", + "dev": true, "requires": { "screenfull": "^5.1.0" } @@ -35935,6 +36020,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/vue-papa-parse/-/vue-papa-parse-3.1.0.tgz", "integrity": "sha512-5YdF3Dtf49EGfaz3+IgIpUw9yYuvV3HekZkob6jrK/Ffz1aCrWjevtcQByKxrNtK7RAL39B0ca93bogKuiQQKg==", + "dev": true, "requires": { "papaparse": "^5.3.0" } @@ -36009,12 +36095,14 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/vue3-carousel/-/vue3-carousel-0.3.3.tgz", "integrity": "sha512-VsuOBE4LG9lxAiYGR9U7ps4RyJ4oFQGzk79/49ybvoxzNpahPAVWIDHKK3a1lOv0CSplFq6u4FvaFLZ8x3FgWg==", + "dev": true, "requires": {} }, "vue3-scrollama": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/vue3-scrollama/-/vue3-scrollama-0.2.2.tgz", "integrity": "sha512-RGjqv7J1H3Ro/o/90K/k2L5rdowE+hG6HlTxA7Pc/oZDazLc7jzGqhh+2fmzmQ//LqMtRJYrAdjXsyXsrc58bA==", + "dev": true, "requires": { "scrollama": "^3.2.0" } diff --git a/package.json b/package.json index 85f3cd21..699bcd8f 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "markdown-it": "^12.0.6", "nouislider": "^15.5.0", "ramp-config-editor_editeur-config-pcar": "^1.1.8", - "ramp-storylines_demo-scenarios-pcar": "^3.1.3", "uuid": "^9.0.0", "vue": "^3.3.4", "vue-class-component": "^8.0.0-rc.1", @@ -54,12 +53,14 @@ "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-vue": "^6.2.2", "html-loader": "^0.5.5", + "pinia": "^2.1.7", "postcss": "^7.0.35", "prettier": "^2.2.1", + "ramp-storylines_demo-scenarios-pcar": "^3.1.5", "sass": "^1.32.11", "sass-loader": "^8.0.2", "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.1.2", - "typescript": "~4.1.5", + "typescript": "^4.4.4", "vue-eslint-parser": "^9.3.1" } } diff --git a/public/index-ca-en.html b/public/index-ca-en.html index 994393bb..881d34a6 100644 --- a/public/index-ca-en.html +++ b/public/index-ca-en.html @@ -20,6 +20,7 @@ src="https://www.canada.ca/etc/designs/canada/cdts/gcweb/rn/cdts/compiled/wet-en.js" > + @@ -104,6 +105,7 @@ + " || e === "script" && this.input.substring(this.index, this.index + 9) !== "<\/script>"; + }, t; + }() +), cIi = ( + /** @class */ + function() { + function t(e, i) { + i === void 0 && (i = {}), this.options = i, this.token = null, this.startLine = 1, this.startColumn = 0, this.tokens = [], this.tokenizer = new uIi(this, e, i.mode), this._currentAttribute = void 0; + } + return t.prototype.tokenize = function(e) { + return this.tokens = [], this.tokenizer.tokenize(e), this.tokens; + }, t.prototype.tokenizePart = function(e) { + return this.tokens = [], this.tokenizer.tokenizePart(e), this.tokens; + }, t.prototype.tokenizeEOF = function() { + return this.tokens = [], this.tokenizer.tokenizeEOF(), this.tokens[0]; + }, t.prototype.reset = function() { + this.token = null, this.startLine = 1, this.startColumn = 0; + }, t.prototype.current = function() { + var e = this.token; + if (e === null) + throw new Error("token was unexpectedly null"); + if (arguments.length === 0) + return e; + for (var i = 0; i < arguments.length; i++) + if (e.type === arguments[i]) + return e; + throw new Error("token type was unexpectedly " + e.type); + }, t.prototype.push = function(e) { + this.token = e, this.tokens.push(e); + }, t.prototype.currentAttribute = function() { + return this._currentAttribute; + }, t.prototype.addLocInfo = function() { + this.options.loc && (this.current().loc = { + start: { + line: this.startLine, + column: this.startColumn + }, + end: { + line: this.tokenizer.line, + column: this.tokenizer.column + } + }), this.startLine = this.tokenizer.line, this.startColumn = this.tokenizer.column; + }, t.prototype.beginDoctype = function() { + this.push({ + type: "Doctype", + name: "" + }); + }, t.prototype.appendToDoctypeName = function(e) { + this.current( + "Doctype" + /* Doctype */ + ).name += e; + }, t.prototype.appendToDoctypePublicIdentifier = function(e) { + var i = this.current( + "Doctype" + /* Doctype */ + ); + i.publicIdentifier === void 0 ? i.publicIdentifier = e : i.publicIdentifier += e; + }, t.prototype.appendToDoctypeSystemIdentifier = function(e) { + var i = this.current( + "Doctype" + /* Doctype */ + ); + i.systemIdentifier === void 0 ? i.systemIdentifier = e : i.systemIdentifier += e; + }, t.prototype.endDoctype = function() { + this.addLocInfo(); + }, t.prototype.beginData = function() { + this.push({ + type: "Chars", + chars: "" + }); + }, t.prototype.appendToData = function(e) { + this.current( + "Chars" + /* Chars */ + ).chars += e; + }, t.prototype.finishData = function() { + this.addLocInfo(); + }, t.prototype.beginComment = function() { + this.push({ + type: "Comment", + chars: "" + }); + }, t.prototype.appendToCommentData = function(e) { + this.current( + "Comment" + /* Comment */ + ).chars += e; + }, t.prototype.finishComment = function() { + this.addLocInfo(); + }, t.prototype.tagOpen = function() { + }, t.prototype.beginStartTag = function() { + this.push({ + type: "StartTag", + tagName: "", + attributes: [], + selfClosing: !1 + }); + }, t.prototype.beginEndTag = function() { + this.push({ + type: "EndTag", + tagName: "" + }); + }, t.prototype.finishTag = function() { + this.addLocInfo(); + }, t.prototype.markTagAsSelfClosing = function() { + this.current( + "StartTag" + /* StartTag */ + ).selfClosing = !0; + }, t.prototype.appendToTagName = function(e) { + this.current( + "StartTag", + "EndTag" + /* EndTag */ + ).tagName += e; + }, t.prototype.beginAttribute = function() { + this._currentAttribute = ["", "", !1]; + }, t.prototype.appendToAttributeName = function(e) { + this.currentAttribute()[0] += e; + }, t.prototype.beginAttributeValue = function(e) { + this.currentAttribute()[2] = e; + }, t.prototype.appendToAttributeValue = function(e) { + this.currentAttribute()[1] += e; + }, t.prototype.finishAttributeValue = function() { + this.current( + "StartTag" + /* StartTag */ + ).attributes.push(this._currentAttribute); + }, t.prototype.reportSyntaxError = function(e) { + this.current().syntaxError = e; + }, t; + }() +); +function hIi(t, e) { + var i = new cIi(new nIi(eIi), e); + return i.tokenize(t); +} +const KSt = "LinkifyResult", Mpe = "StartTag", JSt = "EndTag", _Oe = "Chars", dIi = "Comment", pIi = "Doctype"; +function v0e(t, e) { + e === void 0 && (e = {}); + const i = hIi(t), r = [], n = [], s = new X6e(e, gIi); + for (let o = 0; o < i.length; o++) { + const a = i[o]; + if (a.type === Mpe) { + r.push(a); + const l = a.tagName.toUpperCase(); + if (!(l === "A" || s.ignoreTags.indexOf(l) >= 0)) + continue; + let h = r.length; + mIi(l, i, ++o, r), o += r.length - h - 1; + } else if (a.type !== _Oe) + r.push(a); + else { + const l = fIi(a.chars, s); + r.push.apply(r, l); + } + } + for (let o = 0; o < r.length; o++) { + const a = r[o]; + switch (a.type) { + case KSt: + n.push(a.rendered); + break; + case Mpe: { + let l = "<" + a.tagName; + a.attributes.length > 0 && (l += " " + vIi(a.attributes).join(" ")), a.selfClosing && (l += " /"), l += ">", n.push(l); + break; + } + case JSt: + n.push(``); + break; + case _Oe: + n.push(bOe(a.chars)); + break; + case dIi: + n.push(``); + break; + case pIi: { + let l = `", n.push(l); + break; + } + } + } + return n.join(""); +} +function fIi(t, e) { + const i = QEi(t), r = []; + for (let n = 0; n < i.length; n++) { + const s = i[n]; + s.t === "nl" && e.get("nl2br") ? r.push({ + type: Mpe, + tagName: "br", + attributes: [], + selfClosing: !0 + }) : !s.isLink || !e.check(s) ? r.push({ + type: _Oe, + chars: s.toString() + }) : r.push({ + type: KSt, + rendered: e.render(s) + }); + } + return r; +} +function mIi(t, e, i, r) { + let n = 1; + for (; i < e.length && n > 0; ) { + let s = e[i]; + s.type === Mpe && s.tagName.toUpperCase() === t ? n++ : s.type === JSt && s.tagName.toUpperCase() === t && n--, r.push(s), i++; + } + return r; +} +function gIi(t) { + let { + tagName: e, + attributes: i, + content: r + } = t; + return `<${e} ${yIi(i)}>${bOe(r)}`; +} +function bOe(t) { + return t.replace(/&/g, "&").replace(//g, ">"); +} +function ZSt(t) { + return t.replace(/"/g, """); +} +function yIi(t) { + const e = []; + for (const i in t) { + const r = t[i] + ""; + e.push(`${i}="${ZSt(r)}"`); + } + return e.join(" "); +} +function vIi(t) { + const e = []; + for (let i = 0; i < t.length; i++) { + const r = t[i][0], n = t[i][1] + ""; + e.push(`${r}="${ZSt(n)}"`); + } + return e; +} +const _Ii = "truncate-text", bIi = "truncate-trigger", wIi = { + beforeMount(t) { + t.classList.contains("truncate") || t.classList.add("truncate"), t.toggleAttribute(_Ii, !0); + }, + mounted(t, e) { + let i; + e.value && e.value.externalTrigger && (i = t.closest(`[${bIi}]`)), G6e(t, { + content: MXe(t.textContent), + onShow: xIi, + allowHTML: !0, + placement: "bottom-start", + //flip: false, // can't find a replacement for Vue3 + //boundary: 'window', + triggerTarget: i, + ...e.value?.options || {} + }); + }, + updated(t, e) { + t._tippy && (t._tippy.setContent(MXe(t.textContent)), e.value && e.value.options && t._tippy.setProps(e.value.options)); + }, + unmounted(t) { + t._tippy && t._tippy.destroy(); + } +}; +function xIi(t) { + if (t.reference.clientWidth >= t.reference.scrollWidth) + return !1; +} +function MXe(t) { + return t === null ? "" : v0e(t, { + target: "_blank", + validate: { + url: (e) => /^https?:\/\//.test(e) + // only links that begin with a protocol will be hyperlinked + } + }); +} +const SIi = ["content"], CIi = { + key: 0, + class: "flex flex-shrink-0 items-center border-b border-solid border-gray-600 px-8 h-48 overflow-hidden", + tabindex: "-1" +}, TIi = { class: "flex-grow text-lg py-16 pl-8 min-w-0" }, EIi = { + key: 0, + class: "flex" +}, IIi = { + key: 1, + class: "p-8 flex-grow overflow-y-auto" +}, AIi = { + key: 2, + class: "px-16 py-16 border-t border-gray-400 default-focus-style" +}, PIi = /* @__PURE__ */ Kr({ + __name: "panel-screen", + props: { + // prop indicating if the `header` slot should be rendered + header: { + type: Boolean, + default: !0 + }, + // prop indicating if the `content` slot should be rendered + content: { + type: Boolean, + default: !0 + }, + // prop indicating if the `footer` slot should be rendered + footer: { + type: Boolean, + default: !1 + }, + panel: { + type: Object, + required: !0 + } + }, + setup(t) { + const e = t, { t: i } = Xn(), r = V0(), n = Bg(), s = Ys("iApi"), o = Si(), a = zr( + () => s?.fixture.get("appbar") ? n.temporary : [] + ), l = zr(() => r.mobileView), c = zr(() => r.reorderable), h = () => !l.value && !e.panel.teleport, p = (y) => { + e.panel.move(y), y === "left" && L0(() => { + (o.value?.querySelector(".move-left")).focus(); + }); + }; + return sl(() => { + o.value?.addEventListener("blur", () => { + o.value._tippy.hide(); + }), o.value?.addEventListener("keyup", (y) => { + y.key === "Tab" && o.value?.matches(":focus") && o.value._tippy.show(); + }); + }), gl(() => { + o.value?.removeEventListener("blur", () => { + o.value._tippy.hide(); + }), o.value?.removeEventListener("keyup", (y) => { + y.key === "Tab" && o.value?.matches(":focus") && o.value._tippy.show(); + }); + }), (y, v) => { + const x = Bo("back"), I = Bo("panel-options-menu"), P = Bo("left"), F = Bo("right"), k = Bo("pin"), V = Bo("expand"), j = Bo("minimize"), Y = Bo("close"), X = qn("truncate"), Q = qn("focus-item"), re = qn("tippy"); + return Gr((qt(), li("div", { + class: "h-full flex flex-col items-stretch", + content: gi(i)("panels.access"), + ref_key: "el", + ref: o + }, [ + t.header ? (qt(), li("header", CIi, [ + Dn(x, { + class: Gn( + t.panel.teleport ? "display-none" : "block sm:display-none" + ), + onClick: v[0] || (v[0] = (he) => t.panel.close()) + }, null, 8, ["class"]), + Gr((qt(), li("h2", TIi, [ + _m(y.$slots, "header") + ])), [ + [X] + ]), + y.$slots.controls ? (qt(), In(I, { key: 0 }, { + default: Sn(() => [ + _m(y.$slots, "controls") + ]), + _: 3 + })) : Xr("", !0), + Dt("div", { + class: Gn(t.panel.teleport ? "flex" : "display-none sm:flex") + }, [ + t.panel.teleport ? Xr("", !0) : (qt(), li("div", EIi, [ + c.value ? (qt(), In(P, { + key: 0, + onClick: v[1] || (v[1] = (he) => p("left")), + active: !t.panel.isLeftMostPanel + }, null, 8, ["active"])) : Xr("", !0), + c.value ? (qt(), In(F, { + key: 1, + onClick: v[2] || (v[2] = (he) => p("right")), + active: !t.panel.isRightMostPanel + }, null, 8, ["active"])) : Xr("", !0), + Dn(k, { + onClick: v[3] || (v[3] = (he) => t.panel.pin()), + active: t.panel.isPinned + }, null, 8, ["active"]), + t.panel.controls && t.panel.controls.expand ? (qt(), In(V, { + key: 2, + onClick: v[4] || (v[4] = (he) => t.panel.expand()), + active: t.panel.expanded + }, null, 8, ["active"])) : Xr("", !0) + ])), + t.panel.button && a.value?.includes(t.panel.id) ? (qt(), In(j, { + key: 1, + onClick: v[5] || (v[5] = (he) => t.panel.minimize()) + })) : Xr("", !0), + Dn(Y, { + onClick: v[6] || (v[6] = (he) => t.panel.close()) + }) + ], 2) + ])) : Xr("", !0), + t.content ? (qt(), li("div", IIi, [ + _m(y.$slots, "content") + ])) : Xr("", !0), + t.footer ? Gr((qt(), li("div", AIi, [ + _m(y.$slots, "footer") + ])), [ + [Q] + ]) : Xr("", !0) + ], 8, SIi)), [ + [re, { + trigger: "manual", + onShow: h, + popperOptions: { + placement: "top", + modifiers: [ + { name: "preventOverflow", options: { altAxis: !0 } }, + { name: "flip", options: { fallbackPlacements: ["top"] } } + ] + } + }] + ]); + }; + } +}), OIi = { + class: "relative", + tabindex: "-1" +}, RIi = ["content"], MIi = ["transform"], DIi = /* @__PURE__ */ Dt("path", { d: "M298.028 214.267L285.793 96H328c13.255 0 24-10.745 24-24V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v48c0 13.255 10.745 24 24 24h42.207L85.972 214.267C37.465 236.82 0 277.261 0 328c0 13.255 10.745 24 24 24h136v104.007c0 1.242.289 2.467.845 3.578l24 48c2.941 5.882 11.364 5.893 14.311 0l24-48a8.008 8.008 0 0 0 .845-3.578V352h136c13.255 0 24-10.745 24-24-.001-51.183-37.983-91.42-85.973-113.733z" }, null, -1), FIi = [ + DIi +], LIi = /* @__PURE__ */ Kr({ + __name: "pin", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", OIi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["text-gray-500 hover:text-black focus:text-black p-8", { "text-gray-700": t.active }]), + content: gi(e)(t.active ? "panels.controls.unpin" : "panels.controls.pin") + }, [ + (qt(), li("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 384 512", + transform: `rotate(${t.active ? 30 : 0})` + }, FIi, 8, MIi)) + ], 10, RIi)), [ + [n, { placement: "bottom", hideOnClick: !1 }] + ]) + ]); + }; + } +}), NIi = { + class: "relative", + tabindex: "-1" +}, kIi = ["content", "aria-label"], $Ii = /* @__PURE__ */ Dt("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 352 512" +}, [ + /* @__PURE__ */ Dt("path", { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }) +], -1), BIi = [ + $Ii +], VIi = /* @__PURE__ */ Kr({ + __name: "close", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", NIi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["text-gray-500 hover:text-black focus:text-black p-8", { "text-gray-700": t.active }]), + content: gi(e)("panels.controls.close"), + "aria-label": gi(e)("panels.controls.close") + }, BIi, 10, kIi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale" + }] + ]) + ]); + }; + } +}), jIi = { + class: "relative", + tabindex: "-1" +}, GIi = ["content", "aria-label"], UIi = /* @__PURE__ */ Dt("svg", { + xmlns: "http://www.w3.org/2000/svg", + class: "fill-current w-16 h-16", + viewBox: "0 0 16 16" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M20.485784919653916,7.578491965389372h-14.170000000000005l3.5800000000000054,-3.589999999999997l-1.409999999999993,-1.4099999999999984l-6.000000000000008,6.0000000000000275l6.000000000000008,6l1.409999999999993,-1.4100000000000001l-3.58,-3.59h14.170000000000007Z", + transform: "matrix(0.865803 0 0 0.865803 -1.99071 0.638058)" + }) +], -1), zIi = [ + UIi +], HIi = /* @__PURE__ */ Kr({ + __name: "back", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", jIi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["text-gray-500 hover:text-black focus:text-black p-8", { "text-gray-700": t.active }]), + content: gi(e)("panels.controls.back"), + "aria-label": gi(e)("panels.controls.back") + }, zIi, 10, GIi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale" + }] + ]) + ]); + }; + } +}), WIi = { class: "w-32 h-32" }, qIi = ["content"], YIi = { + key: 0, + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "h-24 w-24 fill-current transform rotate-90" +}, XIi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" +}, null, -1), KIi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0V0z", + fill: "none" +}, null, -1), JIi = /* @__PURE__ */ Dt("path", { d: "M4 20h16v2H4zM4 2h16v2H4zm9 7h3l-4-4-4 4h3v6H8l4 4 4-4h-3z" }, null, -1), ZIi = [ + XIi, + KIi, + JIi +], QIi = { + key: 1, + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "h-24 w-24 fill-current transform rotate-90" +}, eAi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" +}, null, -1), tAi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0V0z", + fill: "none" +}, null, -1), iAi = /* @__PURE__ */ Dt("path", { d: "M8 19h3v3h2v-3h3l-4-4-4 4zm8-15h-3V1h-2v3H8l4 4 4-4zM4 9v2h16V9H4z" }, null, -1), rAi = /* @__PURE__ */ Dt("path", { d: "M4 12h16v2H4z" }, null, -1), nAi = [ + eAi, + tAi, + iAi, + rAi +], sAi = /* @__PURE__ */ Kr({ + __name: "expand", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", WIi, [ + Gr((qt(), li("button", { + type: "button", + class: "text-gray-500 hover:text-black focus:text-black w-full h-full flex justify-center items-center", + content: gi(e)(`panels.controls.${t.active ? "collapse" : "expand"}`) + }, [ + t.active ? (qt(), li("svg", QIi, nAi)) : (qt(), li("svg", YIi, ZIi)) + ], 8, qIi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale", + hideOnClick: !1 + }] + ]) + ]); + }; + } +}), oAi = { + class: "relative", + tabindex: "-1" +}, aAi = ["content"], lAi = /* @__PURE__ */ Dt("svg", { + class: "fill-current w-20 h-20", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0V0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M6 19h12v2H6z" }) +], -1), uAi = [ + lAi +], cAi = /* @__PURE__ */ Kr({ + __name: "minimize", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", oAi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["text-gray-500 hover:text-black focus:text-black p-6", { "text-gray-700": t.active }]), + content: gi(e)("panels.controls.minimize") + }, uAi, 10, aAi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale" + }] + ]) + ]); + }; + } +}), hAi = { + class: "relative", + tabindex: "-1" +}, dAi = ["content"], pAi = ["aria-label"], fAi = /* @__PURE__ */ Dt("path", { d: "M 8.59 16.34 L 13.17 11.75 L 8.59 7.16 L 10 5.75 L 16 11.75 L 10 17.75 Z" }, null, -1), mAi = [ + fAi +], gAi = /* @__PURE__ */ Kr({ + __name: "right", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", hAi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["p-8", { + "text-gray-500 hover:text-black focus:text-black": t.active, + "text-gray-300": !t.active + }]), + content: gi(e)("panels.controls.moveRight") + }, [ + (qt(), li("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "4 4 16 16", + "aria-label": gi(e)("panels.controls.moveRight") + }, mAi, 8, pAi)) + ], 10, dAi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale" + }] + ]) + ]); + }; + } +}), yAi = { + class: "relative", + tabindex: "-1" +}, vAi = ["content"], _Ai = ["aria-label"], bAi = /* @__PURE__ */ Dt("path", { d: "M 15.41 16.09 L 10.83 11.5 L 15.41 6.91 L 14 5.5 L 8 11.5 L 14 17.5 Z" }, null, -1), wAi = [ + bAi +], xAi = /* @__PURE__ */ Kr({ + __name: "left", + props: { + active: Boolean + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => { + const n = qn("tippy"); + return qt(), li("div", yAi, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["p-8 move-left", { + "text-gray-500 hover:text-black focus:text-black": t.active, + "text-gray-300": !t.active + }]), + content: gi(e)("panels.controls.moveLeft") + }, [ + (qt(), li("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "4 4 16 16", + "aria-label": gi(e)("panels.controls.moveLeft") + }, wAi, 8, _Ai)) + ], 10, vAi)), [ + [n, { + placement: "bottom", + theme: "ramp4", + animation: "scale" + }] + ]) + ]); + }; + } +}), SAi = (t) => (Pc("data-v-9e477d20"), t = t(), Oc(), t), CAi = /* @__PURE__ */ SAi(() => /* @__PURE__ */ Dt("div", { class: "p-6" }, [ + /* @__PURE__ */ Dt("svg", { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "fill-current w-20 h-20" + }, [ + /* @__PURE__ */ Dt("path", { d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) + ]) +], -1)), TAi = /* @__PURE__ */ Kr({ + __name: "panel-options-menu", + setup(t) { + const { t: e } = Xn(); + return (i, r) => (qt(), In(D6e, { + class: "flex", + tooltip: gi(e)("panels.controls.optionsMenu"), + popperOptions: { strategy: "fixed" }, + position: "bottom-end" + }, { + header: Sn(() => [ + CAi + ]), + default: Sn(() => [ + _m(i.$slots, "default", {}, void 0, !0) + ]), + _: 3 + }, 8, ["tooltip"])); + } +}); +const EAi = /* @__PURE__ */ ol(TAi, [["__scopeId", "data-v-9e477d20"]]), IAi = { + key: 0, + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "fill-current w-32 h-20" +}, AAi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" +}, null, -1), PAi = /* @__PURE__ */ Dt("path", { d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }, null, -1), OAi = [ + AAi, + PAi +], RAi = { + key: 1, + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "fill-current w-32 h-20" +}, MAi = /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" +}, null, -1), DAi = /* @__PURE__ */ Dt("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }, null, -1), FAi = [ + MAi, + DAi +], LAi = /* @__PURE__ */ Kr({ + __name: "fullscreen-nav", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = () => { + i.toggleFullscreen(); + }; + return (n, s) => { + const o = Bo("mapnav-button"); + return qt(), In(o, { + onClickFunction: r, + tooltip: gi(e)("mapnav.fullscreen") + }, { + default: Sn(() => [ + gi(i).isFullscreen ? (qt(), li("svg", IAi, OAi)) : (qt(), li("svg", RAi, FAi)) + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}), NAi = /* @__PURE__ */ Dt("svg", { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "fill-current w-32 h-20" +}, [ + /* @__PURE__ */ Dt("path", { d: "M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z" }) +], -1), kAi = /* @__PURE__ */ Kr({ + __name: "geolocator-nav", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"); + let r = Dl([]); + const n = async () => { + if (r.length) + s(r); + else { + const a = await o({ + maximumAge: 1 / 0, + timeout: 5e3 + }).catch((l) => { + l.code === GeolocationPositionError.PERMISSION_DENIED ? i.notify.show( + Mv.ERROR, + e("mapnav.geolocator.error.permission") + ) : i.notify.show( + Mv.ERROR, + e("mapnav.geolocator.error.internal") + ); + }); + a && (r = [a.coords.longitude, a.coords.latitude], s(r)); + } + }, s = (a) => { + let l = new Sy( + "geolocation", + a, + pl.latLongSR(), + !0 + ); + i.geo.map.zoomMapTo(l); + }, o = (a) => new Promise( + (l, c) => navigator.geolocation.getCurrentPosition(l, c, a) + ); + return (a, l) => { + const c = Bo("mapnav-button"); + return qt(), In(c, { + onClickFunction: n, + tooltip: gi(e)("mapnav.geolocator") + }, { + default: Sn(() => [ + NAi + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}), $Ai = /* @__PURE__ */ Dt("svg", { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + class: "fill-current w-32 h-20" +}, [ + /* @__PURE__ */ Dt("path", { d: "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" }), + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }) +], -1), BAi = /* @__PURE__ */ Kr({ + __name: "home-nav", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = () => { + const n = i.geo.map.getExtentSet(); + i.geo.map.zoomMapTo(n.fullExtent); + }; + return (n, s) => { + const o = Bo("mapnav-button"); + return qt(), In(o, { + onClickFunction: r, + tooltip: gi(e)("mapnav.home") + }, { + default: Sn(() => [ + $Ai + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}), VAi = { + class: "relative w-32 h-32 text-gray-600 hover:text-black", + tabindex: "-1" +}, jAi = ["content"], GAi = /* @__PURE__ */ Kr({ + __name: "button", + props: { + onClickFunction: { + type: Function, + required: !0 + }, + tooltip: { + type: [String, Boolean], + default: !1 + } + }, + setup(t) { + return (e, i) => { + const r = qn("focus-item"), n = qn("tippy"); + return qt(), li("div", VAi, [ + Gr((qt(), li("button", { + type: "button", + class: "w-full h-full default-focus-style focus:outline-none", + onClick: i[0] || (i[0] = (s) => t.onClickFunction()), + content: t.tooltip + }, [ + _m(e.$slots, "default") + ], 8, jAi)), [ + [r], + [n, { placement: "left" }] + ]) + ]); + }; + } +}), UAi = { + class: "relative", + tabindex: "-1" +}, zAi = ["content", "aria-label"], HAi = /* @__PURE__ */ Kr({ + __name: "button", + props: { + onClickFunction: { + type: Function, + required: !0 + }, + id: { + type: String, + required: !0 + }, + tooltip: { + type: [String, Boolean], + default: !1 + } + }, + setup(t) { + const e = t, i = Ys("iApi"), r = () => i?.event.emit(an.APPBAR_BUTTON_CLICK, e.id); + return (n, s) => { + const o = qn("focus-item"), a = qn("tippy"); + return qt(), li("div", UAi, [ + Gr((qt(), li("button", { + type: "button", + class: "py-6 w-full h-full", + onClick: s[0] || (s[0] = () => { + t.onClickFunction(), r(); + }), + content: t.tooltip, + "aria-label": String(t.tooltip) + }, [ + _m(n.$slots, "default", {}, void 0, !0) + ], 8, zAi)), [ + [o], + [a, { placement: "right" }] + ]) + ]); + }; + } +}); +const WAi = /* @__PURE__ */ ol(HAi, [["__scopeId", "data-v-0af0697e"]]), _0e = hf("areas-of-interest", () => ({ areas: Si([]) })), BU = hf("export", () => { + const t = Si({ + title: !0, + map: !0, + mapElements: !0, + legend: !0, + footnote: !0, + timestamp: !0 + }), e = Si(""); + function i(r) { + if (t.value[r.name] !== void 0) { + const n = t.value[r.name]; + t.value[r.name] = r.selected !== void 0 ? r.selected : !n; + } + } + return { componentSelectedState: t, fileName: e, toggleSelected: i }; +}), dO = function t(e) { + function i(n, s, o) { + var a, l = {}; + if (Array.isArray(n)) + return n.concat(s); + for (a in n) + l[o ? a.toLowerCase() : a] = n[a]; + for (a in s) { + var c = o ? a.toLowerCase() : a, h = s[a]; + l[c] = c in l && typeof h == "object" ? i(l[c], h, c == "headers") : h; + } + return l; + } + function r(n, s, o, a, l) { + var c = typeof n != "string" ? (s = n).url : n, h = { config: s }, p = i(e, s), y = {}; + a = a || p.data, (p.transformRequest || []).map(function(v) { + a = v(a, p.headers) || a; + }), p.auth && (y.authorization = p.auth), a && typeof a == "object" && typeof a.append != "function" && typeof a.text != "function" && (a = JSON.stringify(a), y["content-type"] = "application/json"); + try { + y[p.xsrfHeaderName] = decodeURIComponent(document.cookie.match(RegExp("(^|; )" + p.xsrfCookieName + "=([^;]*)"))[2]); + } catch { + } + return p.baseURL && (c = c.replace(/^(?!.*\/\/)\/?/, p.baseURL + "/")), p.params && (c += (~c.indexOf("?") ? "&" : "?") + (p.paramsSerializer ? p.paramsSerializer(p.params) : new URLSearchParams(p.params))), (p.fetch || fetch)(c, { method: (o || p.method || "get").toUpperCase(), body: a, headers: i(p.headers, y, !0), credentials: p.withCredentials ? "include" : l }).then(function(v) { + for (var x in v) + typeof v[x] != "function" && (h[x] = v[x]); + return p.responseType == "stream" ? (h.data = v.body, h) : v[p.responseType || "text"]().then(function(I) { + h.data = I, h.data = JSON.parse(I); + }).catch(Object).then(function() { + return (p.validateStatus ? p.validateStatus(v.status) : v.ok) ? h : Promise.reject(h); + }); + }); + } + return e = e || {}, r.request = r, r.get = function(n, s) { + return r(n, s, "get"); + }, r.delete = function(n, s) { + return r(n, s, "delete"); + }, r.head = function(n, s) { + return r(n, s, "head"); + }, r.options = function(n, s) { + return r(n, s, "options"); + }, r.post = function(n, s, o) { + return r(n, o, "post", s); + }, r.put = function(n, s, o) { + return r(n, o, "put", s); + }, r.patch = function(n, s, o) { + return r(n, o, "patch", s); + }, r.all = Promise.all.bind(Promise), r.spread = function(n) { + return n.apply.bind(n, n); + }, r.CancelToken = typeof AbortController == "function" ? AbortController : Object, r.defaults = e, r.create = t, r; +}(), qAi = { + A: 10, + B: 12, + C: 11, + E: 13, + G: 24, + H: 24, + J: 24, + K: 35, + L: 35, + M: 35, + N: 35, + P: 35, + R: 46, + S: 47, + T: 48, + V: 59, + X: [62, 61], + Y: 60 +}, xwe = { + en: {}, + fr: {} +}; +class YAi { + list = {}; + listFetched = !1; + constructor(e, i) { + dO.get(i).then((r) => { + r.data.definitions.forEach( + (n) => xwe[e][n.code] = n.description + ), Object.keys(xwe[e]).forEach((n) => { + this.list[n] = xwe[e][n]; + }), this.listFetched = !0; + }); + } + // return list of province codes based on FSA search input query + fsaToProvinces(e) { + const i = {}; + let r = qAi[e.substring(0, 1).toUpperCase()]; + return typeof r == "number" && (r = [r]), r.forEach((n) => { + i[n] = this.list[n]; + }), i; + } +} +function XAi(t, e) { + return new YAi(t, e); +} +const loe = { + en: { + ADDRESS: "Street Address", + FSA: "Forward Sortation Area", + NTS: "National Topographic System", + COORD: "Latitude/Longitude", + SCALE: "Scale" + }, + fr: { + ADDRESS: "Adresse Municipale", + FSA: "Région De Tri D'Acheminement", + NTS: "Système National De Référence Cartographique", + COORD: "Latitude/Longitude", + SCALE: "Échelle" + } +}; +class KAi { + allTypes = {}; + validTypes = {}; + filterComplete = !1; + typesFetched = !1; + constructor(e, i) { + dO.get(i).then((r) => { + r.data.definitions.forEach((n) => { + loe[e][n.code] = n.term.split( + `${n.code}-` + )[1]; + }), Object.keys(loe[e]).forEach((n) => { + this.allTypes[n] = loe[e][n], this.validTypes[n] = loe[e][n]; + }), this.typesFetched = !0; + }); + } + // remove any excluded types indicated by config + filterValidTypes(e) { + if (this.filterComplete) + return this.validTypes; + if (e = typeof e == "string" ? [e] : e, e && e.length > 0) + for (const i of e) + delete this.validTypes[i]; + return this.filterComplete = !0, this.validTypes; + } +} +function JAi(t, e) { + return new KAi(t, e); +} +function ZAi(t, e) { + const i = /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)(\s*[,|;\s]\s*)[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)[*]$/, r = /^\d{2,3}[A-P]/, n = /^[ABCEGHJKLMNPRSTVXY]\d[A-Z]/; + if (i.test(e) && !t.disabledSearchTypes.includes("LAT/LNG")) { + const s = e.slice(0, -1); + return new QAi(t, s); + } else + return n.test(e) && !t.disabledSearchTypes.includes("FSA") ? new ePi(t, e) : r.test(e) && !t.disabledSearchTypes.includes("NTS") ? new tPi(t, e.substring(0, 6).toUpperCase()) : new iPi(t, e); +} +class b0e { + config; + query; + failedServs = []; + results = []; + onComplete; + latLongResult; + featureResults = []; + resultType = "geoname"; + constructor(e, i) { + this.query = i, this.config = e; + } + search() { + return this.jsonRequest(this.getUrl()).then((e) => this.normalizeNameItems(e.items)).catch(() => (console.error("Geoname service failed"), this.failedServs.push("geoname"), this.normalizeNameItems([]))); + } + getUrl(e, i, r, n) { + let s = ""; + return e ? s = this.config.geoLocateUrl + "?q=" + this.query : (r && n ? s = `${this.config.geoNameUrl}?lat=${r}&lon=${n}&num=${this.config.maxResults}` : s = `${this.config.geoNameUrl}?q=${this.query}&num=${this.config.maxResults}`, this.config.categories.length > 0 && (s += `&concise=${this.config.categories.join(",")}`), this.config.officialOnly && (s += "&category=O")), s; + } + normalizeNameItems(e) { + return e.filter((i) => this.config.types.validTypes[i.concise.code]).map((i) => ({ + name: i.name, + location: i.location, + province: this.config.provinces.list[i.province.code], + type: this.config.types.allTypes[i.concise.code], + LatLon: { lat: i.latitude, lon: i.longitude }, + bbox: i.bbox, + order: this.config.sortOrder.indexOf(i.concise.code) >= 0 ? this.config.sortOrder.indexOf(i.concise.code) : this.config.sortOrder.length + })); + } + jsonRequest(e) { + return new Promise((i, r) => { + const n = new XMLHttpRequest(); + n.open("GET", e, !0), n.responseType = "json", n.onload = () => { + if (n.status === 200) { + const s = typeof n.response == "string" ? JSON.parse(n.response) : n.response; + i(s); + } else + r("Could not load results from remote service."); + }, n.send(); + }); + } + locateByQuery() { + return this.jsonRequest(this.getUrl(!0, void 0)); + } + nameByLatLon(e, i, r) { + return this.jsonRequest(this.getUrl(!1, r, e, i)).then((n) => this.normalizeNameItems(n.items)).catch(() => (console.error("LatLon service failed"), this.failedServs.push("geoname"), this.normalizeNameItems([]))); + } +} +class QAi extends b0e { + constructor(e, i) { + super(e, i), this.resultType = "latlong"; + const n = i.split(/[\s|,|;|]/).filter((a) => !isNaN(a) && a !== "").map((a) => parseFloat(a)), s = 0.015, o = [ + n[1] - s, + n[0] - s, + n[1] + s, + n[0] + s + ]; + this.latLongResult = { + name: `${n[0]},${n[1]}`, + location: { + latitude: n[0], + longitude: n[1] + }, + type: "Latitude/Longitude", + position: [n[1], n[0]], + bbox: o + }, this.onComplete = new Promise((a, l) => { + this.nameByLatLon(n[0], n[1]).then((c) => { + c ? (this.results = c, a(this)) : l("Given lat lon coordinates cannot be found"); + }); + }); + } +} +class ePi extends b0e { + constructor(e, i) { + i = i.substring(0, 3).toUpperCase(), super(e, i), this.resultType = "fsa", this.onComplete = new Promise((r) => { + this.formatLocationResult().then((n) => { + n ? (this.featureResults.push(n), this.nameByLatLon( + n.LatLon.lat, + n.LatLon.lon, + Object.keys(n._provinces).map((s) => parseInt(s)) + ).then((s) => { + this.results = s, r(this); + })) : (console.log("FSA code given cannot be found."), r(this)); + }); + }); + } + formatLocationResult() { + return this.locateByQuery().then((e) => { + if (e.length === 1 && this.query) { + const i = this.config.provinces.fsaToProvinces( + this.query + ); + return { + fsa: this.query, + code: "FSA", + desc: this.config.types.allTypes.FSA, + province: Object.keys(i).map((r) => i[r]).join(","), + _provinces: i, + LatLon: { + lat: e[0].geometry.coordinates[1], + lon: e[0].geometry.coordinates[0] + } + }; + } + }).catch(() => { + console.error("FSA service failed"), this.failedServs.push("geolocation"); + }); + } +} +class tPi extends b0e { + unitName; + unit; + mapSheets = []; + constructor(e, i) { + super(e, i), this.resultType = "nts", i = isNaN(parseInt(i[2])) ? "0" + i : i, this.unitName = i, this.onComplete = new Promise((r) => { + this.locateByQuery().then((n) => { + if (n.length > 0 && this.query) { + const s = this.locateToResult(n); + this.unit = s[0], this.mapSheets = s, this.featureResults.push(this.unit), this.nameByLatLon( + this.unit.LatLon.lat, + this.unit.LatLon.lon + ).then((o) => { + this.results = o, r(this); + }); + } else + console.log("Given NTS code not found"), r(this); + }).catch(() => { + console.error("NTS service failed"), this.failedServs.push("geolocation"), r(this); + }); + }); + } + locateToResult(e) { + return e.map((r) => { + const n = r.title.split(" "); + return { + nts: n.shift() || "", + // 064D or 064D06 + location: n.join(" "), + // "NUMABIN BAY" + code: "NTS", + // "NTS" + desc: this.config.types.allTypes.NTS, + // "National Topographic System" + LatLon: { + lat: r.geometry.coordinates[1], + lon: r.geometry.coordinates[0] + }, + bbox: r.bbox + }; + }); + } + equals(e) { + return this.unitName === e.unitName; + } +} +class iPi extends b0e { + constructor(e, i) { + i = encodeURIComponent(i.trim()), super(e, i), this.resultType = "address", this.onComplete = new Promise((r) => { + this.locateByQuery().then((n) => { + this.featureResults = this.locateToResult(n), this.search().then((s) => { + this.results = s, r(this); + }); + }).catch(() => { + this.failedServs.push("geolocation"), console.error("Address service failed"), this.search().then((n) => { + this.results = n, r(this); + }); + }); + }); + } + locateToResult(e) { + return this.config.categories.length > 0 && !this.config.categories.includes("ADDR") ? [] : e.filter((r) => r.type?.includes("Street")).map((r) => { + const [n, s, o] = r.title.split(", "); + return { + name: n, + city: s.split(" Of ").pop(), + // prevents redundant label i.e. 'City Of Kingston' + province: o, + desc: this.config.types.allTypes.ADDRESS, + LatLon: { + lat: r.geometry.coordinates[1], + lon: r.geometry.coordinates[0] + } + }; + }); + } +} +const DXe = "https://geogratis.gc.ca/services/geolocation/@{language}/locate", FXe = "https://geogratis.gc.ca/services/geoname/@{language}/geonames.json", LXe = "https://geogratis.gc.ca/services/geoname/@{language}/codes/province.json", NXe = "https://geogratis.gc.ca/services/geoname/@{language}/codes/concise.json", rPi = { + 10: "NL", + 11: "PE", + 12: "NS", + 13: "NB", + 24: "QC", + 35: "ON", + 46: "MB", + 47: "SK", + 48: "AB", + 59: "BC", + 60: "YU", + 61: "NT", + 62: "NU", + 72: "UF", + 73: "IW" +}; +class kXe { + config; + constructor(e, i) { + let r, n, s, o; + const a = i?.serviceUrls; + a ? (r = a.geoLocation ? a.geoLocation : DXe, n = a.geoNames ? a.geoNames : FXe, s = a.geoProvince ? a.geoProvince : LXe, o = a.geoTypes ? a.geoTypes : NXe) : (r = DXe, n = FXe, s = LXe, o = NXe), r = r.replace("@{language}", e), n = n.replace("@{language}", e), s = s.replace("@{language}", e), o = o.replace("@{language}", e); + const l = i?.settings; + let c, h, p, y, v; + l ? (c = l.categories ? l.categories : [], h = l.sortOrder ? l.sortOrder : [], p = l.disabledSearchTypes ? l.disabledSearchTypes : [], y = l.maxResults > 0 ? l.maxResults : 100, v = !!l.officialOnly) : (c = [], h = [], p = [], y = 100, v = !1), this.config = { + language: e, + geoNameUrl: n, + geoLocateUrl: r, + types: JAi(e, o), + // list of type filters + provinces: XAi(e, s), + // list of province filters + categories: c, + sortOrder: h, + disabledSearchTypes: p, + maxResults: y, + officialOnly: v + }, this.config.types.filterValidTypes(i?.excludeTypes), this._provinceList = [], this._typeList = [], this._excludedTypes = i?.excludeTypes || []; + } + get provinceList() { + return this._provinceList; + } + get typeList() { + return this._typeList; + } + set provinceList(e) { + this._provinceList = e; + } + set typeList(e) { + this._typeList = e; + } + levenshteinDistance(e, i) { + i = i.toLowerCase().trim(); + const r = decodeURI(e.query.toLowerCase().replace("*", "")), n = []; + for (let s = 0; s <= i.length; s++) { + n[s] = [s]; + for (let o = 1; o <= r.length; o++) + n[s][o] = s === 0 ? o : Math.min( + n[s][o - 1] + 1, + // delete + n[s - 1][o] + 0.2, + // insert + n[s - 1][o - 1] + (r[o - 1] === i[s - 1] ? 0 : 1) + // substitute + ); + } + return n[i.length][r.length]; + } + /** + * Find and return the province object in the province list + * + * @param {string} province the target province + * @return {Object} associated province object + */ + findProvinceObj(e) { + return this.provinceList.find((i) => i.name === e); + } + /** + * Given some string query, returns a promise that resolves as a formatted location object + * + * @param {string} q the search string this query is based on + * @return {Promise} + */ + query(e) { + return ZAi(this.config, e.toUpperCase()).onComplete.then( + (i) => { + let r = []; + i.featureResults.length > 0 ? i.resultType === "fsa" ? r = i.featureResults.map((s) => ({ + name: s.fsa, + bbox: [ + s.LatLon.lon + 0.02, + s.LatLon.lat - 0.02, + s.LatLon.lon - 0.02, + s.LatLon.lat + 0.02 + ], + type: s.desc, + position: [s.LatLon.lon, s.LatLon.lat], + location: { + latitude: s.LatLon.lat, + longitude: s.LatLon.lon, + province: this.findProvinceObj(s.province) + }, + order: -1 + })) : i.resultType === "nts" ? r = i.featureResults.map((s) => ({ + name: s.nts, + bbox: s.bbox ?? [ + s.LatLon.lon + 0.02, + s.LatLon.lat - 0.02, + s.LatLon.lon - 0.02, + s.LatLon.lat + 0.02 + ], + type: s.desc, + position: [s.LatLon.lon, s.LatLon.lat], + location: { + city: s.location, + latitude: s.LatLon.lat, + longitude: s.LatLon.lon + }, + order: -1 + })) : i.resultType === "address" && (r = i.featureResults.map( + (s) => ({ + name: s.name, + bbox: [ + s.LatLon.lon + 2e-3, + s.LatLon.lat - 2e-3, + s.LatLon.lon - 2e-3, + s.LatLon.lat + 2e-3 + ], + type: s.desc, + position: [ + s.LatLon.lon, + s.LatLon.lat + ], + location: { + city: s.city, + latitude: s.LatLon.lat, + longitude: s.LatLon.lon, + province: this.findProvinceObj( + s.province + ) + }, + order: this.config.sortOrder.indexOf("ADDR") >= 0 ? this.config.sortOrder.indexOf("ADDR") : this.config.sortOrder.length + }) + ), this.config.sortOrder.length > 0 && (r = r.sort( + (s, o) => this.levenshteinDistance(i, s.name) > this.levenshteinDistance(i, o.name) ? 1 : -1 + ))) : i.resultType === "latlong" && (r = [i.latLongResult], r[0].order = -1); + const n = i.results.map((s) => ({ + name: s.name, + bbox: s.bbox, + type: s.type, + position: [s.LatLon.lon, s.LatLon.lat], + location: { + city: s.location, + latitude: s.LatLon.lat, + longitude: s.LatLon.lon, + province: this.findProvinceObj(s.province) + }, + order: s.order + })); + return { + results: r.concat(n).slice(0, this.config.maxResults).sort((s, o) => this.config.sortOrder.length > 0 ? s.order > o.order ? 1 : -1 : this.levenshteinDistance(i, s.name) > this.levenshteinDistance(i, o.name) ? 1 : -1), + failedServs: i.failedServs + }; + } + ); + } + /** + * Return a promise that resolves to a list of formatted province objects + * + * @return {Promise} a promise that resolves to a list of formatted province objects + */ + fetchProvinces() { + return new Promise((e) => { + const i = setInterval(() => { + if (this.config.provinces.listFetched) { + clearInterval(i); + const r = [], n = { + code: -1, + abbr: "...", + name: "..." + }; + r.push(n); + const s = this.config.provinces.list; + for (const o in s) + r.push({ + code: o, + abbr: rPi[o], + name: s[o] + }); + this.provinceList = r, e(this.provinceList); + } + }); + }); + } + /** + * Return a promise that resolves to a list of formatted type objects + * + * @return {Promise} a promise that resolves to a list of formatted type objects + */ + fetchTypes() { + return new Promise((e) => { + const i = setInterval(() => { + if (this.config.types.typesFetched) { + clearInterval(i); + const r = [], n = { + code: -1, + name: "..." + }; + r.push(n); + const s = this.config.types.allTypes; + for (const o in s) + this._excludedTypes.includes(o) || r.push({ + code: o, + name: s[o] + }); + this.typeList = r, e(this.typeList); + } + }, 250); + }); + } +} +function $Xe(t, e, i) { + return t && e.extent && (i = i.filter( + (r) => r.bbox[0] <= e.extent.xmax && r.bbox[1] <= e.extent.ymax && r.bbox[2] >= e.extent.xmin && r.bbox[3] >= e.extent.ymin + )), e.province && e.province !== "..." && (i = i.filter( + (r) => r.location.province?.name && r.location.province.name === e.province + )), e.type && e.type !== "..." && (i = i.filter((r) => r.type === e.type)), i; +} +const D$ = hf("geosearch", () => { + const t = Si(new kXe("en", void 0)), e = Si({ + type: "", + province: "", + extent: void 0 + }), i = Si(!1), r = Si(""), n = Si(""), s = Si([]), o = Si([]), a = Si(!1), l = Si([]), c = zr( + () => new Promise((F) => { + t.value.fetchProvinces().then((k) => { + k.sort( + (V, j) => V.name > j.name ? 1 : -1 + ), F(k); + }); + }) + ), h = zr( + () => new Promise((F) => { + t.value.fetchTypes().then((k) => { + k.sort( + (V, j) => V.name > j.name ? 1 : -1 + ), F(k); + }); + }) + ); + function p(F, k) { + t.value = new kXe(F, k); + } + function y(F) { + if (a.value = !0, !r.value) + s.value = [], o.value = [], a.value = !1; + else if (r.value && r.value !== n.value || F) { + const k = setInterval(() => { + t.value.config.provinces.listFetched && t.value.config.types.typesFetched && (clearInterval(k), t.value.query(`${r.value}*`).then((V) => { + l.value = V.failedServs, n.value = r.value, o.value = V.results; + const j = $Xe( + i.value, + //@ts-ignore + e.value, + o.value + ); + s.value = j || [], a.value = !1; + })); + }, 250); + } else { + const k = $Xe( + i.value, + //@ts-ignore + e.value, + o.value + ); + s.value = k || [], a.value = !1; + } + } + function v(F) { + e.value.province = typeof F.province > "u" ? "" : F.province, y(F.forceReRun); + } + function x(F) { + e.value.type = typeof F.type > "u" ? "" : F.type, y(F.forceReRun); + } + function I(F) { + n.value = r.value, r.value = F, y(); + } + function P(F) { + if (F.visible !== void 0 && (i.value = F.visible), F.extent.sr.wkid !== 4326) + throw new Error( + "an extent that was not projected to wkid 4326 was passed to the geosearch store" + ); + e.value.extent = F.extent, y(); + } + return { + GSservice: t, + queryParams: e, + resultsVisible: i, + searchVal: r, + lastSearchVal: n, + searchResults: s, + savedResults: o, + loadingResults: a, + failedServices: l, + getProvinces: c, + getTypes: h, + initService: p, + runQuery: y, + setProvince: v, + setType: x, + setSearchTerm: I, + setMapExtent: P + }; +}), w0e = hf("help", () => ({ location: Si("./help/") })); +var VP = /* @__PURE__ */ ((t) => (t.Visibility = "visibilityButton", t.Expand = "expandButton", t))(VP || {}), Yp = /* @__PURE__ */ ((t) => (t.Item = "item", t.Placeholder = "placeholder", t.Error = "error", t))(Yp || {}); +class x0e extends cf { + _uid; + _name; + _type; + _children = []; + // list of child legend items + _parent = void 0; + // parent of legend item + _loadPromise; + // deferred promise that resolves when legend item is loaded + _hidden; + // indicates if item (and its children) should be hidden from the legend + _expanded; + // expanded state of item + _visibility; + // visibility state of item + _exclusive; + // indicates if children should follow 'exclusive set' behavior (à la radio buttons) + _controls; + // will use layer controls if undefined + _disabledControls; + // will use layer's disabled controls if undefined + _lastVisible; + // keeps track of last visible legend item, used for exclusive sets + _visibleChildren; + // keeps track of last visible child items + /** + * Create a new legend item with defaulting for all properties given config snippet, id is required. + * @param {InstanceAPI} iApi instance API for the RAMP that this is associated with + * @param {any} config the config for the given legend item + * @param {LegendItem} parent a legend item that this item is a child of + */ + constructor(e, i, r) { + super(e), this._uid = l7.sharedUtils.generateUUID(), this._name = i.name, this._type = i.type ?? "placeholder", this._parent = r, this._children = [], this._loadPromise = new vm(), this._hidden = i.hidden ?? !1, this._expanded = i.expanded ?? !0, this._visibility = !0, this._exclusive = i.exclusive ?? !1, this._controls = i.controls?.slice() ?? [ + "visibilityButton", + "expandButton" + /* Expand */ + ], this._disabledControls = i.disabledControls?.slice(), this._lastVisible, this._visibleChildren = []; + } + /** Returns the item's uid */ + get uid() { + return this._uid; + } + /** Returns the item's name */ + get name() { + return this._name; + } + /** Sets the item's name + * @param {string} name new item name + */ + set name(e) { + this._name = e; + } + /** Returns the item's type */ + get type() { + return this._type; + } + /** Returns children of the legend item */ + get children() { + return this._children; + } + /** Sets new children for the legend item + * @param {Array} children new child legend items + */ + set children(e) { + this._children = e; + } + /** Returns item's parent - not yet initialized */ + get parent() { + return this._parent; + } + /**Sets new parent for the legend item */ + set parent(e) { + this._parent = e; + } + /** Returns the load promise for this legend item */ + get loadPromise() { + return this._loadPromise.getPromise(); + } + /** Returns if item is hidden */ + get hidden() { + return this._hidden; + } + /** Returns if item is expanded */ + get expanded() { + return this._expanded; + } + /** Returns if item has visibility */ + get visibility() { + return this._visibility; + } + /** Returns if item follows "exclusive set" behaviour */ + get exclusive() { + return this._exclusive; + } + /** + * Check if a control is available for the legend item. + * Returns: + * - true if the control is included in legend item's available controls + * - false if control is not included, or if control is disabled + * - undefined if controls are not defined + * @param {LegendControl} control name of the control + * @return {boolean | undefined} + */ + controlAvailable(e) { + return this._disabledControls?.includes(e) ? !1 : this._controls?.includes(e); + } + /** + * Enable a disabled control, or disable an enabled control. + * @param {LegendControl} control name of the control + * @param {boolean} enable true for enabling, false for disabling + */ + setControl(e, i) { + i && this._disabledControls?.includes(e) ? (this._disabledControls = this._disabledControls.filter( + (r) => r !== e + ), this._controls?.push(e)) : !i && this._controls?.includes(e) && (this._controls = this._controls.filter((r) => r !== e), this._disabledControls?.push(e)); + } + /** + * Toggle hidden state of a legend item. + * @param {boolean} hidden set legend item to hidden/not hidden if given, otherwise toggle + */ + toggleHidden(e) { + this._hidden = e ?? !this.hidden; + } + /** + * Toggle expand state of a legend item. + * @param {boolean} expanded set legend item to expanded/not expanded if given, otherwise toggle + */ + toggleExpanded(e) { + this._expanded = e ?? !this.expanded; + } + /** + * Toggle visibility state of a legend item. Needs to verify parent visibility is updated. + * @param {boolean} visibility set legend item to visible/not visible if given, otherwise toggle + * @param {boolean} updateParent whether or not toggleVisibiliity should 'bubble-up' the legend tree + */ + toggleVisibility(e, i = !0) { + if (this.visibility !== e) { + if (this._visibility = e ?? !this.visibility, !this.exclusive) + this.visibility ? this._visibleChildren.length > 0 ? this._visibleChildren.forEach( + (r) => r.toggleVisibility(!0, !1) + ) : this.children.forEach( + (r) => r.toggleVisibility(!0, !1) + ) : this.children.forEach( + (r) => r.toggleVisibility(!1, !1) + ); + else if (this.visibility) + if (this._lastVisible && (!(this._lastVisible instanceof uu) || this._lastVisible.layerControlAvailable( + oa.Visibility + ))) + this._lastVisible.toggleVisibility(!0); + else { + const r = this.children.find( + (n) => !(n instanceof uu) || n.layerControlAvailable(oa.Visibility) + ); + r && r.toggleVisibility(!0); + } + else + this._lastVisible = this.children.find((r) => r.visibility), this._lastVisible?.toggleVisibility(!1); + this.parent && i && this.parent.checkVisibility(this); + } + } + /** + * Ensures visibility rules are followed if legend item is nested in another item on initialization. + */ + checkVisibilityRules() { + this.parent && !this.parent.visibility ? this.toggleVisibility(!1, !1) : this.parent?.exclusive && this.parent.children.some( + (i) => i.visibility && i !== this && i.type === "item" + /* Item */ + ) && this.toggleVisibility(!1, !1); + } + /** + * Updates parent visibility after a child item's visibility toggles. + * @param {LegendItem} toggledChild given child legend item + */ + checkVisibility(e) { + this instanceof uu && !this.layerControlAvailable(oa.Visibility) || (this.exclusive ? e.visibility ? (this.children.forEach((i) => { + i.uid !== e.uid && i.toggleVisibility(!1, !1); + }), this._lastVisible = e, this._visibility = !0, this instanceof uu && this.layer && this.layer.layerExists && (this.layer.visibility = !0)) : (this._visibility = !1, this instanceof uu && this.layer && this.layer.layerExists && (this.layer.visibility = !1), this._lastVisible = e) : this.children.some((i) => i.visibility) ? (this._visibility = !0, this._visibleChildren = this.children.filter( + (i) => i.visibility + ), this instanceof uu && this.layer && this.layer.layerExists && (this.layer.visibility = !0)) : (this._visibility = !1, this._visibleChildren = [], this instanceof uu && this.layer && this.layer.layerExists && (this.layer.visibility = !1)), this.parent && this.parent.checkVisibility(this)); + } + /** + * Returns a legend config representation of this item. + */ + getConfig() { + const e = { + name: this._name, + hidden: this._hidden, + expanded: this._expanded, + exclusive: this._exclusive, + controls: this._controls, + disabledControls: this._disabledControls + }, i = []; + return this.children.forEach((r) => { + i.push(r.getConfig()); + }), this.exclusive ? e.exclusiveVisibility = i : e.children = i, e; + } + /** + * Runs right after legend item is added + */ + onAdded() { + } + /** + * Runs right before legend item is removed + */ + onRemoved() { + this.toggleVisibility(!1); + } + /** + * Sets legend item to a loaded state. + */ + load() { + this._type = "item", this._loadPromise.resolveMe(), this.checkVisibilityRules(); + } + /** + * Sets legend item back to a loading/placeholder state + */ + reload() { + this._type = "placeholder", this._loadPromise = new vm(); + } + /** + * Sets legend item to an error state + */ + error() { + this._type = "error", this._loadPromise.rejectMe(), this.checkVisibilityRules(); + } +} +class uu extends x0e { + _layerId; + _layerIdx; + _layerUid = ""; + _layer; + _layerInitVis; + _layerRedrawing = !1; + _layerOffscale = !1; + _loadCancelled = !1; + _treeGrown = !1; + _customSymbology = !1; + _coverIcon; + _description; + _symbologyExpanded; + _origLayerControls; + _origLayerDisabledControls; + _layerControls; + _layerDisabledControls; + _symbologyRenderStyle; + _symbologyStack; + handlers = []; + /** + * Creates a new single layer item. + */ + constructor(e, i, r) { + super(e, i, r), this._type = Yp.Placeholder, this._layerId = i.layerId, this._layerIdx = i.sublayerIndex, this._layerControls = i.layerControls ?? [], this._origLayerControls = i.layerControls, this._layerDisabledControls = i.disabledLayerControls ?? [], this._origLayerDisabledControls = i.disabledLayerControls, this._layerRedrawing = !1, this._symbologyExpanded = i.symbologyExpanded || !1, i.coverIcon && (this._coverIcon = i.coverIcon), i.description && (this._description = i.description), this._symbologyRenderStyle = i.symbologyRenderStyle ?? "icons", this._customSymbology = !!i.symbologyStack, this._symbologyStack = i.symbologyStack?.map((n) => ({ + uid: this.$iApi.geo.shared.generateUUID(), + label: n.text, + definitionClause: n.sqlQuery, + imgUrl: n.image ?? "", + drawPromise: Promise.resolve(), + visibility: !0, + // just a placeholder + lastVisibility: !0 + })); + } + /** Returns the id of the parent layer (for MIL) */ + get parentLayerId() { + return this._layerIdx ? this._layerId.slice( + 0, + this._layerId.length - `-${this._layerIdx}`.length + ) : void 0; + } + /** Returns the id of the layer */ + get layerId() { + return this._layerId; + } + get layerIdx() { + return this._layerIdx; + } + get layerUid() { + return this._layerUid; + } + /** Returns BaseLayer associated with legend item. */ + get layer() { + return this._layer; + } + set layer(e) { + this._layer = e, this._layerId = e.id, this._layerIdx = e.layerIdx, this._layerUid = e.uid, this._name = this._name || e.name, this._symbologyStack = this._customSymbology ? this._symbologyStack : e.legend, this.updateLayerControls(); + } + get layerOffscale() { + return this._layerOffscale; + } + set layerOffscale(e) { + this._layerOffscale = e; + } + get layerRedrawing() { + return this._layerRedrawing; + } + set layerRedrawing(e) { + this._layerRedrawing = e; + } + get coverIcon() { + return this._coverIcon; + } + set coverIcon(e) { + this._coverIcon = e; + } + get description() { + return this._description; + } + set description(e) { + this._description = e; + } + /** Returns true if symbology stack is expanded. */ + get symbologyExpanded() { + return this._symbologyExpanded; + } + get treeGrown() { + return this._treeGrown; + } + set treeGrown(e) { + this._treeGrown = e; + } + get loadCancelled() { + return this._loadCancelled; + } + set loadCancelled(e) { + this._loadCancelled = e; + } + get origLayerControls() { + return this._origLayerControls; + } + get origDisabledLayerControls() { + return this._origLayerDisabledControls; + } + set symbologyRenderStyle(e) { + this._symbologyRenderStyle = e; + } + get symbologyRenderStyle() { + return this._symbologyRenderStyle; + } + set symbologyStack(e) { + this._symbologyStack = e; + } + get symbologyStack() { + return this._symbologyStack; + } + /** + * Returns a legend config representation of this item. + */ + getConfig() { + const e = { + layerId: this._layerId, + sublayerIndex: this._layerIdx, + layerControls: this._layerControls, + disabledLayerControls: this._layerDisabledControls, + symbologyExpanded: this._symbologyExpanded, + coverIcon: this._coverIcon, + description: this._description + }; + return { ...super.getConfig(), ...e }; + } + /** + * Toggle visibility state of a layer item. Needs to verify parent visibility is updated. + * @param {boolean} visibility set legend item to visible/not visible if given, otherwise toggle + * @param {boolean} updateParent whether or not toggleVisibility should 'bubble-up' the legend tree + * @param {boolean} forceUpdate ignore control check, used when visibility is changed outside of legend fixture + */ + toggleVisibility(e, i = !0, r = !1) { + if (!((!this.layerControlAvailable(oa.Visibility) || this._loadCancelled) && !r) && (super.toggleVisibility(e, i), this.layer && this.layer.layerExists)) { + this.layer.visibility = this.visibility; + const n = this._symbologyStack.some( + (s) => s.lastVisbility + ); + this._symbologyStack.forEach((s) => { + n || (s.lastVisbility = !0), s.visibility = this.visibility ? s.lastVisbility : !1; + }); + } + } + /** + * Toggles the symbology expand and returns the new value + * + * @param {boolean} expanded optional parameter to toggle expanded to a certain value + */ + toggleSymbology(e) { + return this._symbologyExpanded = e ?? !this._symbologyExpanded, this._symbologyExpanded; + } + /** + * Sets the visibility of the symbology with the given uid + * If the provided UID is undefined, set the visibility of all symbols + * + * @param {uid | undefined} uid the uid of the legend symbology + * @param visible The new visibility value + */ + setSymbologyVisibility(e, i) { + this._symbologyStack.some((r) => ((e === void 0 || r.uid === e) && (r.visibility = i, r.lastVisbility = i), e !== void 0 && r.uid === e)); + } + /** + * Have the item adapt and update to the given layer as it loads. + * Is either called in the constructor, or through the legend api + * + * @param {LayerInstance | undefined} layer the layer to load. If undefined, layer will be fetched via instance API using id/uid. + */ + // TS complaining as usual. Can maybe remove the parameter and expect caller to set the layer first? + // @ts-ignore + load(e) { + if (e) { + if (this._layer = e instanceof QQ ? e : this.$iApi.geo.layer.getLayer( + this._layerId ?? this._layerUid + ), this.layer = e, this._layerRedrawing = e.mapLayer && e.drawState !== G_.UP_TO_DATE, this._loadCancelled) { + this.toggleVisibility(!1, !0, !0); + return; + } + this._layer?.loadPromise().then(() => { + this._layer?.layerType === rn.MAPIMAGE && !this._layerIdx ? (this.error(), console.error( + `MapImageLayer has no sublayerIndex defined for layer: ${this._layerId}.` + )) : (this._layerInitVis = typeof this._layerInitVis < "u" ? this._visibility : e.visibility, super.load(), this.toggleVisibility(this._layerInitVis, !0, !0), e.visibility || this.setSymbologyVisibility(void 0, !1)), this.handlers.push( + this.$iApi.event.on( + an.LAYER_VISIBILITYCHANGE, + (i) => { + i.layer.uid === this.layer.uid && this._type === Yp.Item && this.toggleVisibility( + i.visibility, + !0, + !0 + ); + } + ) + ), this.handlers.push( + this.$iApi.event.on( + an.LAYER_DRAWSTATECHANGE, + (i) => { + this.layer.uid === i.layer.uid && (i.layer.drawState === G_.REFRESH ? this.layerRedrawing = !0 : setTimeout(() => { + this.layerRedrawing = i.layer.drawState === G_.REFRESH; + }, 500)); + } + ) + ), this._layerOffscale = this.$iApi.geo.map.created ? this.layer?.isOffscale() : !1, this.handlers.push( + this.$iApi.event.on( + an.MAP_SCALECHANGE, + () => { + this.$iApi.geo.map.created && (this._layerOffscale = this.layer?.isOffscale()); + } + ) + ); + }).catch(() => { + this.error(); + }); + } + } + error() { + this.updateLayerControls(), super.error(), this.toggleVisibility(!1, !0, !0); + } + /** + * Check if a control is available for the layer item. + * + * @param {LayerControl} control name of the control + * @return {boolean} Indicates if control is enabled on this legend item or layer + */ + layerControlAvailable(e) { + return this._layerDisabledControls?.includes(e) ? !1 : !!this._layerControls?.includes(e); + } + // Update layer controls and disabled controls for this layer item. + updateLayerControls() { + const e = this.$iApi.geo.layer.getLayerControls(this.layerId) ?? this.$iApi.geo.layer.getLayerControls(this.parentLayerId ?? ""); + this._origLayerControls || (this._layerControls = e?.controls ?? []), this._origLayerDisabledControls || (this._layerDisabledControls = e?.disabledControls ?? []); + } +} +var LV = /* @__PURE__ */ ((t) => (t.Title = "title", t.Text = "text", t.Image = "image", t.Markdown = "markdown", t.Template = "template", t))(LV || {}); +class Dpe extends x0e { + _infoType; + // the type of info displayed on this SectionItem + _content; + // the content to be displayed for this SectionItem + /** + * Create a new SectionItem. + * @param {InstanceAPI} iApi instance API for the RAMP that this is associated with + * @param {any} config the config for the given SectionItem + * @param {LegendItem} parent a legend item that this item is a child of + */ + constructor(e, i, r) { + super(e, i, r), this._infoType = i.infoType ?? "title", this._content = i.content ?? "", i.infoType === "template" && this.$element.component(`${this._uid}-info-section`, { + template: this._content + }), (i.infoType || i.content) && (this._controls = i.controls?.slice() ?? [VP.Expand]), super.load(); + } + /** Returns the info type of this SectionItem */ + get infoType() { + return this._infoType; + } + /** Returns the content of this SectionItem */ + get content() { + return this._content; + } + /** Sets new content for this SectionItem + * @param {string} content new content + */ + set content(e) { + this._content = e; + } + /** + * Returns a legend config representation of this item. + */ + getConfig() { + const e = { + infoType: this._infoType, + content: this._content + }; + return { ...super.getConfig(), ...e }; + } +} +const ID = hf("legend", () => { + const t = Si(), e = Si([]), i = Si([]); + function r(o) { + if (o.parent === void 0) + e.value.push(o.item); + else { + if (!(o.item instanceof Dpe) && !(o.item instanceof uu)) { + console.error( + "attempted to add an unsupported legend item type" + ); + return; + } + o.parent.children.push(o.item); + } + } + function n(o) { + const a = (l) => (l = l.filter((c) => (c === o && !c.children.length && c.onRemoved(), c !== o)), l.forEach((c) => { + c.children = a(c.children); + }), l = l.filter( + (c) => !(c instanceof Dpe && !c.children.length && c.content === "") + ), l); + e.value = a(e.value); + } + function s(o) { + if (o.oldItem.parent === void 0) { + const a = e.value, l = a.indexOf(o.oldItem); + l > -1 && (e.value[l] = o.newItem), e.value = a; + } else { + const a = o.oldItem.parent.children, l = a.indexOf(o.oldItem); + l > -1 && (a[l] = o.newItem), o.oldItem.parent.children = a; + } + } + return { + legendConfig: t, + children: e, + headerControls: i, + addItem: r, + removeItem: n, + replaceItem: s + }; +}), $4 = hf("mapnav", () => { + const t = Si({}), e = Si([]); + function i(r) { + r in t.value && delete t.value[r]; + const n = e.value.indexOf(r); + n !== -1 && e.value.splice(n, 1); + } + return { items: t, order: e, removeItem: i }; +}), K6e = hf("metadata", () => { + const t = Si(""), e = Si({ type: "LineString", coordinates: [] }); + return { status: t, response: e }; +}), S0e = hf("northarrow", () => { + const t = Si(""), e = Si(""); + return { arrowIcon: t, poleIcon: e }; +}), Vie = hf("overviewmap", () => { + const t = Si({ + lodSets: [], + extentSets: [], + basemaps: [], + tileSchemas: [], + initialBasemapId: "" + }), e = Si({}), i = Si(!0), r = Si(1.5), n = Si("#FF0000"), s = Si(1), o = Si("#000000"), a = Si(0.25); + function l(c) { + t.value.initialBasemapId = c; + } + return { + mapConfig: t, + basemaps: e, + startMinimized: i, + expandFactor: r, + borderColour: n, + borderWidth: s, + areaColour: o, + areaOpacity: a, + updateInitialBasemap: l + }; +}), ZQ = hf("scrollguard", () => { + const t = Si(!1); + function e(i) { + t.value = i; + } + return { enabled: t, setEnabled: e }; +}); +var vp = /* @__PURE__ */ ((t) => (t[t.UPLOAD = 0] = "UPLOAD", t[t.FORMAT = 1] = "FORMAT", t[t.CONFIGURE = 2] = "CONFIGURE", t))(vp || {}); +const J6e = hf("wizard", () => { + const t = { + id: "Placeholder", + layerType: rn.UNKNOWN, + url: "" + }, e = Si(), i = Si(""), r = Si(""), n = Si(!0), s = Si(null), o = Si({ + config: t, + configOptions: [] + }), a = Si(vp.UPLOAD); + function l(c) { + switch (a.value) { + case vp.UPLOAD: + c === vp.UPLOAD ? i.value = "" : c === vp.FORMAT && (a.value = vp.FORMAT); + break; + case vp.FORMAT: + c === vp.UPLOAD ? (s.value && (i.value = "", s.value = null), r.value = "", a.value = vp.UPLOAD) : c === vp.CONFIGURE && (a.value = vp.CONFIGURE); + break; + case vp.CONFIGURE: + c === vp.UPLOAD ? (i.value = "", r.value = "", s.value = null, n.value = !0, o.value = { + config: t, + configOptions: [] + }, a.value = vp.UPLOAD) : c === vp.FORMAT && (o.value = { + config: t, + configOptions: [] + }, n.value = !0, a.value = vp.FORMAT); + break; + } + } + return { + layerSource: e, + url: i, + typeSelection: r, + nested: n, + fileData: s, + layerInfo: o, + currStep: a, + goToStep: l + }; +}); +class nPi { + fixture; + panel; + event; + geo; + notify; + ui; + startRequired = !1; + /** + * The instance of Vue R4MP application controlled by this InstanceAPI. + * + * @type {VueInstance} + * @memberof InstanceAPI + */ + $vApp; + $element; + $i18n; + _isFullscreen; + constructor(e, i, r) { + this.event = new kbi(this); + const n = sPi(e, this); + this.$vApp = n.app, this.$element = n.element, this.$i18n = n.i18n, this.fixture = new L3i(this), this.panel = new N3i(this), this.geo = new D3i(this), this.ui = { + maptip: this.geo.map.maptip, + exposeOids: !1, + exposeMeasurements: !0, + getZoomIcon: () => "", + formatNumber: () => "", + scrollToInstance: !1, + suppressNumberLocalization: !1 + }, this.notify = new dSi(this), this._isFullscreen = QC.isEnabled && !!this.$vApp.$root && QC.isFullscreen && QC.element === this.$vApp.$root.$el, QC.isEnabled && QC.onchange(() => { + this._isFullscreen = QC.isEnabled && !!this.$vApp.$root && QC.isFullscreen && QC.element === this.$vApp.$root.$el; + }), this.initialize(i, r); + } + /** + * Initializes a Vue R4MP instance with the given config and options + * + * @private + * @param {RampConfigs | undefined} configs language-keyed R4MP config + * @param {RampOptions | undefined} options startup options for this R4MP instance + */ + initialize(e, i) { + const r = fm(this.$vApp.$pinia), n = V0(this.$vApp.$pinia), s = hpe(this.$vApp.$pinia); + if (e?.configs !== void 0) { + const a = e.configs, l = a[this.$i18n.locale.value] ?? a[Object.keys(a)[0]]; + r.newConfig(l), r.registerConfig({ + config: l, + configLangs: Object.keys(a), + // @ts-ignore + allLangs: Object.keys(this.$i18n.messages.value) + }); + for (const v in a) + r.registerConfig({ + config: a[v], + configLangs: [v] + }); + r.activeBasemapConfig = l.map.basemaps.find( + (v) => v.id === l.map.initialBasemapId + ); + const c = setInterval(() => { + const v = this.$vApp.$el.querySelector("#esriMap"); + if (v && (clearInterval(c), this.geo.map.createMap( + l.map, + v + ), v._tippy.hide(0), s.setMaptipInstance(v._tippy), l.layers && l.layers.length > 0)) { + let x = 0; + l.layers.forEach((I) => { + const P = this.geo.layer.createLayer(I); + this.geo.map.addLayer(P, x), P.mapLayer && x++; + }); + } + }, 100); + if (l.panels) { + if (l.panels.open && l.panels.open.length > 0) { + const v = l.panels.open.map((x) => x.id); + this.panel.isRegistered(v).then(() => { + l.panels?.open?.forEach((x) => { + this.panel.open({ + id: x.id, + screen: x.screen + }), x.pin && this.panel.pin(x.id); + }); + }); + } + n.reorderable = l.panels.reorderable ?? !0; + } + !l.system?.animate && this.$element._container && this.$element._container.children[0] && this.$element._container.children[0].classList.remove( + "animation-enabled" + ), l.system?.proxyUrl && (this.geo.proxy = l.system.proxyUrl), l.system?.exposeOid && (this.ui.exposeOids = l.system.exposeOid), l.system?.exposeMeasurements != null && (this.ui.exposeMeasurements = l.system.exposeMeasurements), l.system?.scrollToInstance && (this.ui.scrollToInstance = l.system?.scrollToInstance), l.system?.suppressNumberLocalization && (this.ui.suppressNumberLocalization = l.system?.suppressNumberLocalization); + const h = { + magnify: '', + globe: '' + }, p = l.system?.zoomIcon || "globe", y = h[p] || p; + this.ui.getZoomIcon = () => y, this.ui.formatNumber = (v) => this.ui.suppressNumberLocalization ? v.toString() : this.$i18n.n(v, "number"); + } + i || (i = {}); + const o = DV(this.$vApp.$pinia); + i?.startRequired ? (this.startRequired = !0, o.started = !1) : (this.startRequired = !1, o.started = !0, this.event.emit(an.MAP_START)), (i.loadDefaultFixtures !== !1 || e?.startingFixtures !== void 0) && this.fixture.addDefaultFixtures(e?.startingFixtures), i.loadDefaultEvents !== !1 && this.event.addDefaultEvents(); + } + /** + * Reloads Vue R4MP instance with a new config + * + * @param {RampConfigs} configs language-keyed R4MP config + * @param {RampOptions} options startup options for this R4MP instance + */ + reload(e, i) { + const r = DV(this.$vApp.$pinia), n = mI(this.$vApp.$pinia), s = fm(this.$vApp.$pinia), o = iO(this.$vApp.$pinia), a = i1(this.$vApp.$pinia), l = O$(this.$vApp.$pinia); + Object.keys(o.items).forEach((p) => { + this.fixture.get(p) !== void 0 && this.fixture.remove(p); + }), Object.keys(l.grids).forEach((p) => { + l.removeGrid(p); + }), r.started = !1, this.geo.map.destroyMap(), a.$reset(), this.event.offAll(), e === void 0 && (e = JSON.parse( + JSON.stringify({ + startingFixtures: s.startingFixtures, + configs: s.registeredConfigs + }) + )), n.clearAll(), this.geo.map.maptip.clear(), this.initialize(e, i); + } + component(e, i) { + if (i) { + const r = this.$element.component(e, i); + return this.event.emit(an.COMPONENT, e), r; + } + return this.$element.component(e); + } + /** + * The 'screen' size for the app. Returns the largest screen class on the element; 'lg', 'md', 'sm' or 'xs'. + * + * @readonly + * @type string | null + * @memberof InstanceAPI + */ + get screenSize() { + if (!this.$vApp?.$root || !this.$vApp.$root.$refs["app-size"]) + return null; + const e = this.$vApp.$root.$refs["app-size"].classList; + return e.contains("lg") ? "lg" : e.contains("md") ? "md" : e.contains("sm") ? "sm" : "xs"; + } + /** + * Gets the [cloned] config linked to the current language of the app. + * + * @memberof InstanceAPI + */ + getConfig() { + const e = fm(this.$vApp.$pinia); + return JSON.parse( + JSON.stringify(e.getActiveConfig(this.language)) + ); + } + /** + * Returns the pinia store of the specified id, if it exists, else returns undefined. + * + * @param id the id of the store to return + * @memberof InstanceAPI + */ + useStore(e) { + if (!([ + "appbar", + "areas-of-interest", + "details", + "export", + "geosearch", + "grid", + "help", + "legend", + "mapnav", + "metadata", + "northarrow", + "overviewmap", + "scrollguard", + "wizard" + ].includes(e) && !this.fixture.get(e))) + switch (e) { + case "appbar": + return Bg(this.$vApp.$pinia); + case "areas-of-interest": + return _0e(this.$vApp.$pinia); + case "details": + return D4(this.$vApp.$pinia); + case "export": + return BU(this.$vApp.$pinia); + case "geosearch": + return D$(this.$vApp.$pinia); + case "grid": + return O$(this.$vApp.$pinia); + case "help": + return w0e(this.$vApp.$pinia); + case "legend": + return ID(this.$vApp.$pinia); + case "mapnav": + return $4(this.$vApp.$pinia); + case "metadata": + return K6e(this.$vApp.$pinia); + case "northarrow": + return S0e(this.$vApp.$pinia); + case "overviewmap": + return Vie(this.$vApp.$pinia); + case "scrollguard": + return ZQ(this.$vApp.$pinia); + case "wizard": + return J6e(this.$vApp.$pinia); + case "config": + return fm(this.$vApp.$pinia); + case "fixture": + return iO(this.$vApp.$pinia); + case "instance": + return DV(this.$vApp.$pinia); + case "layer": + return i1(this.$vApp.$pinia); + case "map-caption": + return zD(this.$vApp.$pinia); + case "maptip": + return hpe(this.$vApp.$pinia); + case "notification": + return mI(this.$vApp.$pinia); + case "panel": + return V0(this.$vApp.$pinia); + default: + console.error(`The store ${e} does not exist.`); + return; + } + } + /** + * Sets the language of the app to the specified string (e.g. 'en' or 'fr'). + * + * @param {string} language The locale string to switch to + * @memberof InstanceAPI + */ + setLanguage(e) { + if (this.$i18n.locale.value === e) + return; + const r = fm(this.$vApp.$pinia).registeredLangs; + if (r[e] === r[this.$i18n.locale.value]) { + this.$i18n.locale.value = e; + return; + } + this.$i18n.locale.value = e; + const n = this.getConfig(); + this.event.emit(an.CONFIG_CHANGE, n), this.reload(); + } + /** + * The current locale string for the app. + * + * @readonly + * @type string + * @memberof InstanceAPI + */ + get language() { + return this.$vApp.$i18n.locale; + } + /** + * The current animation status. + * + * @readonly + * @type boolean + * @memberof InstanceAPI + */ + get animate() { + return !!(this.$element._container && this.$element._container.children[0] && this.$element._container.children[0].classList.contains( + "animation-enabled" + )); + } + /** + * Toggles fullscreen for the app. + * + * @memberof InstanceAPI + */ + toggleFullscreen() { + QC.isEnabled && QC.toggle(this.$element._container || void 0); + } + /** + * Whether the app is fullscreen. + * + * @readonly + * @type boolean + * @memberof InstanceAPI + */ + get isFullscreen() { + return this._isFullscreen; + } + /** + * Whether the app has been started. + * + * @readonly + * @type boolean + * @memberof InstanceAPI + */ + get started() { + return DV(this.$vApp.$pinia).started; + } + /** + * Updates the screen reader alert. Use this to inform screen reader users of visual changes in the app (pieces of ui appearing/leaving). + * + * @param alert the alert to make available to screen readers + * @memberof InstanceAPI + */ + updateAlert(e) { + const i = this.$vApp.$el.querySelector( + ".screen-reader-alert" + ); + i.childNodes.length > 0 && (i.innerHTML = ""); + const r = document.createElement("span"); + r.setAttribute("role", "alert"); + const n = document.createTextNode(e); + r.appendChild(n), i.insertBefore(r, null); + } + /** + * If `scrollToInstance` is set to true in the configuration file, scrolls the browser to this RAMP component. + * + * @memberof InstanceAPI + */ + scrollToInstance() { + this.ui.scrollToInstance && this.$element._container?.scrollIntoView({ + behavior: "smooth" + }); + } + start() { + const e = DV(this.$vApp.$pinia); + !e.started && this.startRequired ? (this.event.emit(an.MAP_START), e.started = !0) : e.started && console.warn("start has already been called"); + } +} +function sPi(t, e) { + const i = Obi(); + i.use(({ store: o }) => { + const a = GYe(o.$state); + o.$reset = () => o.$patch(GYe(a)); + }); + const r = _xi(), n = e0e(AEi).use(r).use(SEi, { + directive: "tippy", + // => v-tippy + component: "tippy" + // => + }).use(i); + n.directive("focus-container", NEi), n.directive("focus-list", REi), n.directive("focus-item", DEi), n.directive("truncate", wIi), n.component("panel-screen", PIi), n.component("pin", LIi), n.component("close", VIi), n.component("back", HIi), n.component("expand", sAi), n.component("panel-options-menu", EAi), n.component("dropdown-menu", D6e), n.component("minimize", cAi), n.component("right", gAi), n.component("left", xAi), n.component("fullscreen-nav-button", LAi), n.component("geolocator-nav-button", kAi), n.component("home-nav-button", BAi), n.component("mapnav-button", GAi), n.component("appbar-button", WAi), n.component("transition", M4), n.component("transition-group", Kye), n.config.globalProperties.$iApi = e, n.config.globalProperties.$pinia = i, n.provide("iApi", e); + const s = n.mount(t); + return { element: n, app: s, i18n: r.global }; +} +class QSt { + esriBasemap; + config; + constructor(e) { + this.config = e, this.esriBasemap = new IF({ + // TODO split by type if we have to populate referenceLayers + // TODO we can technically support most layer types. Might want to expand a bit. + // Feature would be easy. + // File based trickier but useful. Would throw asynch wrench into this. + // ESRI Image Server would make sense. + baseLayers: e.layers.map((i) => { + if (i.layerType === rn.TILE) + return new sNe({ + url: i.url, + opacity: i.opacity + }); + if (i.layerType === rn.MAPIMAGE) + return new eNe({ + url: i.url, + opacity: i.opacity + }); + if (i.layerType === rn.OSM) + return new iNe({ + opacity: i.opacity + }); + throw new Error( + `Unsupported layer type provided to basemap config: ${i.layerType}` + ); + }), + title: e.name || "", + id: e.id + }); + } + /** + * Returns the tile schema id from the config + */ + get tileSchemaId() { + return this.config.tileSchemaId; + } + /** + * Returns the basemap id from the config + */ + get id() { + return this.config.id; + } + /** + * Get this basemap's name from the config + */ + get name() { + return this.config.name; + } + /** + * Set this basemap's name + */ + set name(e) { + this.config.name = e || ""; + } + /** + * Get this basemap's description from the config + */ + get description() { + return this.config.description; + } + /** + * Set this basemap's description + */ + set description(e) { + this.config.description = e || ""; + } + /** + * Get this basemap's alt text from the config + */ + get altText() { + return this.config.altText; + } + /** + * Set this basemap's alt text + */ + set altText(e) { + this.config.altText = e || ""; + } + /** + * Get this basemap's attribution config + */ + get attribution() { + return this.config.attribution; + } + /** + * Set this basemap's attribution + */ + set attribution(e) { + this.config.attribution = e; + } + /** + * Get this basemap's background colour + */ + get backgroundColour() { + return this.config.backgroundColour ?? "#FFFFFF"; + } +} +class eCt extends cf { + /** + * The internal esri map. Avoid referencing outside of geoapi. + * @private + */ + esriMap; + /** + * Local storage of Basemap objects + * @private + */ + _basemapStore; + /** + * Indicates if the map has been created + * @public + */ + created = !1; + /** + * Tracks if we are watching for the first basemap to load. + * @private + */ + trackFirstBasemap = !1; + /** + * The internal esri map view. Changes from outside of RAMP may break the instance. Use caution. + */ + esriView; + /** + * Internal deferred managing the view promise + * @private + */ + _viewPromise; + /** + * A promise that resolves when the map view has been created + */ + get viewPromise() { + return this._viewPromise.getPromise(); + } + /** + * The map spatial reference in RAMP API Spatial Reference format. + * Saves us from converting from ESRI format every time it is needed + * @private + */ + _rampSR; + /** + * The active extent set in RAMP API Extent Set format. + * Allows a quick reference to the available extents if needed. + * @private + */ + _rampExtentSet; + /** + * The viewDiv for the ESRI MapView + * The map will be rendered using this div object + * @private + */ + _targetDiv; + /** + * List of ESRI watch handlers + * @private + */ + handlers; + /** + * The default zoom level when zooming to a point feature + * @private + */ + pointZoomScale; + constructor(e) { + super(e), this.esriMap = void 0, this._basemapStore = [], this._viewPromise = new vm(), this.handlers = [], this.pointZoomScale = 5e4; + } + noMapErr() { + console.error( + "Attempted to manipulate the map before calling createMap()" + ); + } + abstractError() { + throw new Error( + "Attempted to call an abstract method in the parent CommonMapAPI" + ); + } + /** + * Will generate the actual Map control objects and construct it on the page + * @param {RampMapConfig} config the config for the map + * @param {string | HTMLDivElement} targetDiv the div to be used for the map view + */ + createMap(e, i) { + this._basemapStore = e.basemaps.map((n) => { + const s = new QSt(n); + return s.esriBasemap.baseLayers.forEach((o) => { + o.watch("loadStatus", () => { + o.loadStatus === "loaded" ? this.trackFirstBasemap = !1 : o.loadStatus === "failed" && (this.$iApi.notify.show( + Mv.ERROR, + this.$iApi.$i18n.t("layer.error", { + id: s.name + }) + ), this.trackFirstBasemap && this.recoverBasemap(s.tileSchemaId)); + }); + }), s; + }); + const r = {}; + this.esriMap = ya(new G0t(r)), this.pointZoomScale = e.pointZoomScale && e.pointZoomScale > 0 ? e.pointZoomScale : 5e4, this._targetDiv = i, this.createMapView(e.initialBasemapId); + } + /** + * Destroys the ESRI map + * + * @protected + */ + destroyMap() { + if (!this.esriMap || !this.esriView) { + this.noMapErr(); + return; + } + this.destroyMapView(), this.esriMap.destroy(), delete this.esriMap, this._basemapStore.forEach((e) => e.esriBasemap.destroy()), this._basemapStore = []; + } + /** + * Reloads the map with the given map config and target div + * + * @param {RampMapConfig} config the config for the map + * @param {string | HTMLDivElement | undefined} targetDiv the div to be used for the map view + */ + reloadMap(e, i) { + if (!this.esriMap || !this.esriView) { + this.noMapErr(); + return; + } + this.destroyMap(), this.createMap(e, i); + } + /** + * Will generate a ESRI map view and add it to the page + * Can optionally provide the basemap or basemap id to be used when creating the map view + * + * This method should be overidden by child map classes + * + * @param {string | Basemap | undefined} basemap the id of the basemap that should be used when creating the map view + * @protected + */ + createMapView(e) { + this.abstractError(); + } + /** + * Destroys the ESRI map view + * + * @protected + */ + destroyMapView() { + if (!this.esriView) { + this.noMapErr(); + return; + } + this._viewPromise = new vm(), this.created = !1, this.handlers.forEach((e) => e.handler.remove()), this.handlers = [], this.esriView.map = null, this.esriView.container = null, this.esriView.spatialReference = null, this.esriView.extent = null, this.esriView.navigation = null, this.esriView.destroy(), delete this.esriView; + } + /** + * Searches the local basemap list for a basemap with the given id + * Throws error if basemap could not be found + * + * @param {string} id basemap id + * @returns {Basemap} the found basemap + * @protected + */ + findBasemap(e) { + const i = this._basemapStore.find( + (r) => r.id === e + ); + if (i) + return i; + throw new Error(`Invalid basemap id requested: ${e}`); + } + /** + * Applies the given basemap (or basemap with given id) to the esri map + * Throws error if basemap could not be found with the given id + * + * @param {string | basemap} basemap the basemap id or object + * @protected + */ + applyBasemap(e) { + if (!this.esriMap) { + this.noMapErr(); + return; + } + const i = typeof e == "string" ? this.findBasemap(e) : e; + this.esriMap.basemap = eo(i.esriBasemap); + } + /** + * Set the map's basemap to the basemap with the given id. + * If the new basemap's tile schema differs from the current one, the map view will be refreshed + * + * The returned boolean indicates if the schema has changed. + * + * This method should be overidden by child map classes + * + * @param {string} basemapId the basemap id + * @returns {boolean} indicates if the schema has changed + * @abstract + */ + setBasemap(e) { + return this.abstractError(), !1; + } + /** + * Will attempt to change to another basemap if the very first basemap failed. + * If nothing is defined, will do nothing but manage our watching state. + * + * This method is overidden as needed + * + * @param {string} basemapSchemaId the basemap schema id (where the fallback is defined) + */ + recoverBasemap(e) { + } + /** + * Get the id of the currently used basemap + * Returns undefined if there is no map + * @returns {string | undefined} current basemap id + */ + getCurrentBasemapId() { + if (this.esriMap) + return this.esriMap.basemap.id; + this.noMapErr(); + } + /** + * Projects a geometry to the map's spatial reference + * + * @private + * @param {BaseGeometry} geom the RAMP API geometry to project + * @returns {Promise} the geometry projected to the map's projection, in RAMP API Geometry format + */ + geomToMapSR(e) { + if (!this._rampSR) + throw new Error( + "call to map.geomToMapSR before the map spatial ref was created" + ); + return this._rampSR.isEqual(e.sr) ? Promise.resolve(e) : this.$iApi.geo.proj.projectGeometry(this._rampSR, e); + } + /** + * Zooms the map to a given geometry. + * + * @param {BaseGeometry} geom A RAMP API geometry to zoom the map to + * @param {number} [scale] An optional scale value of the map. Is ignored for non-Point geometries + * @param {boolean} [animate] An optional animation setting. On by default + * @returns {Promise} A promise that resolves when the map has finished zooming + */ + async zoomMapTo(e, i, r = !0) { + if (this.esriView) { + if (e.invalid()) + throw new Error("attempt to zoom to invalid geometry"); + const n = await this.geomToMapSR(e), s = { + target: this.$iApi.geo.geom.geomRampToEsri(n) + }; + n.type === el.POINT && (s.scale = i || this.pointZoomScale); + const o = { animate: r }; + return this.viewPromise.then(() => this.esriView.goTo(s, o)); + } else + this.noMapErr(); + } + /** + * Provides the zoom level of the map + * + * @returns {number} the map zoom level + */ + getZoomLevel() { + return this.esriView ? this.esriView.zoom : (this.noMapErr(), 1); + } + /** + * Provides the scale of the map (the scale denominator as integer) + * + * @returns {number} the map scale + */ + getScale() { + return this.esriView ? this.esriView.scale : (this.noMapErr(), 1); + } + /** + * Provides the resolution of the map. This means the number of map units that is covered by one pixel. + * + * @returns {number} the map resolution + */ + getResolution() { + return this.esriView ? this.esriView.resolution : (this.noMapErr(), 1); + } + /** + * Provides the extent of the map + * + * @returns {Extent} the map extent in RAMP API Extent format + */ + getExtent() { + return this.esriView ? Rd.fromESRI(this.esriView.extent) : (this.noMapErr(), Rd.fromParams("i_am_error", 0, 1, 0, 1)); + } + /** + * Provides the active extent set of the map + * + * @returns {ExtentSet} the active extent set of the map + */ + getExtentSet() { + return this._rampExtentSet ? this._rampExtentSet : (this.noMapErr(), TQ.fromConfig({ + id: "i_am_error_extent_set", + default: { + xmin: 0, + xmax: 1, + ymin: 0, + ymax: 1, + spatialReference: { + wkid: 4326 + } + } + })); + } + /** + * Provides the spatial reference of the map + * + * @returns {SpatialReference} the map spatial reference in RAMP API format + */ + getSR() { + return this._rampSR ? this._rampSR.clone() : (this.noMapErr(), pl.latLongSR()); + } + /** + * Get the height of the map on the screen in pixels + * + * @returns {Number} pixel height + */ + getPixelHeight() { + return this.esriView ? this.esriView.height : (this.noMapErr(), 1); + } + /** + * Get the width of the map on the screen in pixels + * + * @returns {Number} pixel width + */ + getPixelWidth() { + return this.esriView ? this.esriView.width : (this.noMapErr(), 1); + } + /** + * Set's the map's pointZoomScale value to newScale. + * If newScale is not a positive number, a console error is thrown. + * + * The returned boolean indicates if the value has been successfully set. + * + * @param {number} newScale the new pointZoomScale value, which must be a positive number + * @returns {boolean} indicates if the value was set successfully + */ + setPointZoomScale(e) { + return e > 0 ? (this.pointZoomScale = e, !0) : (console.error( + `Cannot set pointZoomScale to non-positive number: ${e}.` + ), !1); + } +} +class oPi extends cf { + maptipStore; + /** + * @constructor + * @param {InstanceAPI} iApi the RAMP instance + */ + constructor(e) { + super(e), this.maptipStore = hpe(this.$vApp.$pinia); + } + // # makes variables private outside of typescript and lets us hide things on the API + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields + #e = void 0; + #t = void 0; + /** + * Checks for a graphic at the given screen coordinates. + * On a graphic hit the point is put in the maptip store and the `map/graphichit` event is fired. + * + * @param {ScreenPoint} screenPoint The screen coordinates for the hitTest + * @returns {Promise} resolves after the event is fired or no new graphic is hit. + */ + async checkAtCoord(e) { + this.#t = e; + const i = await this.$iApi.geo.map.getGraphicAtCoord(e); + if (this.#t !== e) + return; + if (!i) { + this.clear(); + return; + } + const r = this.$iApi.geo.layer.getLayer(i.layerId); + if (r?.geomType != el.POLYGON && this.#e && this.#e.layerId === i.layerId && this.#e.oid === i.oid && this.#e.layerIdx === i.layerIdx) + return; + if (this.clear(), this.#e = i, !r) { + console.error( + `graphic hit test returned non-existent layer id: ${i.layerId}` + ); + return; + } + if (!r.hovertips) + return; + const n = await r.getIcon(i.oid), s = await r.getGraphic(i.oid, { + getAttribs: !0 + }); + this.setPoint(this.$iApi.geo.map.screenPointToMapPoint(e)), this.$iApi.event.emit(an.MAP_GRAPHICHIT, { + layer: r, + graphicHit: i, + attributes: s.attributes, + icon: n, + screenPoint: e + }); + } + /** + * Generates and sets the "default" maptip. + * + * @param info the tooltip info payload + */ + generateDefaultMaptip(e) { + this.setContent( + `
${e.icon}${e.attributes[e.layer.config.tooltipField || e.layer.nameField]}
` + ); + } + /** + * Clears the maptip from the map + */ + clear() { + this.#e = void 0, this.maptipStore.setMaptipPoint(void 0), this.maptipStore.setMaptipContent(""); + } + /** + * Get the `tippy` maptip instance + * Documentation: https://kabbouchi.github.io/tippyjs-v4-docs/tippy-instance/ + * + * @returns {any} the `tippy` tooltip instance + */ + getInstance() { + return this.maptipStore.maptipInstance; + } + /** + * Get the current point for the maptip + * + * @returns {Point} the current maptip map point + */ + getPoint() { + return this.maptipStore.maptipPoint; + } + /** + * Set the current maptip point. Undefined = maptip wont be shown. + * + * @param {Point | undefined} maptipPoint + */ + setPoint(e) { + this.maptipStore.setMaptipPoint(e); + } + /** + * Set the html string for the maptip + * If empty string is provided, the maptip will use the default content + * + * @param {string} content the new maptip html content + */ + setContent(e) { + this.maptipStore.setMaptipContent(e); + } +} +class aPi extends eCt { + overviewGraphicLayer; + overviewmapStore; + /** + * @constructor + * @param {InstanceAPI} iApi the RAMP instance + */ + constructor(e) { + super(e), this.overviewGraphicLayer = this.$iApi.geo.layer.createLayer({ + id: "RampOverviewGraphic", + layerType: rn.GRAPHIC, + url: "", + cosmetic: !0 + }), this.overviewmapStore = Vie(this.$vApp.$pinia); + } + /** + * Will generate a ESRI map view and add it to the page + * Must provide the basemap or basemap id to be used when creating the map view + * + * @param {string | Basemap} basemap the id of the basemap that should be used when creating the map view + * @protected + */ + createMapView(e) { + if (!e) + throw new Error( + "Attempted to create overview map view without a basemap" + ); + const i = typeof e == "string" ? this.findBasemap(e) : e; + this.applyBasemap(i), this._rampExtentSet = this.$iApi.geo.map.getExtentSet().clone(), this._rampSR = this._rampExtentSet.sr.clone(); + const r = this.overviewmapStore.expandFactor; + this.esriView = ya( + new X1t({ + map: this.esriMap, + container: this._targetDiv, + constraints: { + rotationEnabled: !1 + }, + spatialReference: this._rampSR.toESRI(), + extent: this.$iApi.geo.map.getExtent().toESRI().expand(r) + // use the expanded main map extent + }) + ), this.esriView.ui.components = [], this.handlers.push({ + type: "mouse-wheel", + handler: this.esriView.on("mouse-wheel", (n) => { + n.stopPropagation(); + }) + }), this.handlers.push({ + type: "double-click", + handler: this.esriView.on("double-click", (n) => { + n.stopPropagation(); + }) + }), this.handlers.push({ + type: "key-down", + handler: this.esriView.on("key-down", (n) => { + n.stopPropagation(); + }) + }), this.handlers.push({ + type: "key-up", + handler: this.esriView.on("key-up", (n) => { + n.stopPropagation(); + }) + }), this.handlers.push({ + type: "drag", + handler: this.esriView.on("drag", (n) => { + n.stopPropagation(), this.mapDrag(n); + }) + }), this.esriView.container.addEventListener("touchmove", (n) => { + n.preventDefault(); + }), this.esriView.watch("fatalError", () => { + const n = new IntersectionObserver((s) => { + s.forEach((o) => { + o.isIntersecting && (this.esriView?.tryFatalErrorRecovery(), n.disconnect()); + }); + }); + n.observe(this.esriView.container); + }), this.esriView.when(() => { + this._viewPromise.resolveMe(), this.created = !0; + }); + } + async addMapGraphicLayer() { + if (!this.esriMap) { + this.noMapErr(); + return; + } + const e = new bx( + this.$iApi.geo.map.getExtent(), + "overview-graphic" + ), i = this.overviewmapStore.borderColour ?? "#FF0000", r = this.overviewmapStore.borderWidth ?? 1, n = this.overviewmapStore.areaColour ?? "#000000", s = this.overviewmapStore.areaOpacity ?? 0.25, o = `${n}${Math.round(s * 255).toString( + 16 + )}`; + e.style = new mU({ + fill: { colour: o }, + outline: { + colour: i, + width: r + } + }), await this.overviewGraphicLayer.initiate(), await this.overviewGraphicLayer.addGraphic(e), this.esriMap?.add(this.overviewGraphicLayer.esriLayer); + } + async removeMapGraphicLayer() { + if (!this.esriMap) { + this.noMapErr(); + return; + } + if (!this.overviewGraphicLayer.esriLayer) + throw new Error( + "Attempted to remove layer from the map without an esri layer. Likely layer.initiate() was not called or had not finished." + ); + this.overviewGraphicLayer.removeGraphic(), await this.overviewGraphicLayer.terminate(), this.esriMap.remove(this.overviewGraphicLayer.esriLayer); + } + /** + * Destroys the ESRI map view + * + * @protected + */ + destroyMapView() { + this.esriView?.container.removeEventListener("touchmove", (e) => { + e.preventDefault(); + }), super.destroyMapView(); + } + /** + * Searches the local basemap list and main map basemaps for a basemap with the given id + * Throws error if basemap could not be found + * + * @param {string} id basemap id + * @returns {Basemap} the found basemap + * @protected + */ + findBasemap(e) { + const i = this._basemapStore.find( + (r) => r.id === e + ); + if (i) + return i; + { + const n = fm(this.$vApp.$pinia).config.map; + if (n) { + const s = n.basemaps.find( + (o) => o.id === e + ); + if (s) + return new QSt(s); + } + } + throw new Error(`Invalid basemap id requested: ${e}`); + } + /** + * Sets the overview map's basemap to the basemap with the given id. + * Will refresh the map view if set basemap uses different tile schema. + * + * Should only be called by the overview map component + * + * @param {string} basemapId the basemap id + * @returns {boolean} indicates if the schema has changed + */ + setBasemap(e) { + if (!this.esriView || !this.esriMap) + return this.noMapErr(), !1; + const i = this.findBasemap(e), n = (this.getCurrentBasemapId() ? this.findBasemap(this.getCurrentBasemapId()) : void 0)?.tileSchemaId !== i.tileSchemaId; + return n ? (this.destroyMapView(), this.createMapView(i)) : this.applyBasemap(i), n; + } + /** + * Initial esri extent of graphic during drag + * + * @private + */ + startExtent = null; + /** + * Moves graphic and zooms main map if extent graphic is dragged + * + * @param {__esri.ViewDragEvent} esriDrag + * @private + */ + async mapDrag(e) { + if (e.native.pointerType === "mouse") { + if (e.action === "start") + await this.cursorHitTest(e) && (this.startExtent = ya( + this.overviewGraphicLayer.getEsriGraphic( + "overview-graphic" + ).geometry + )); + else if (this.startExtent) { + const i = this.esriView.toMap(e.origin), r = this.esriView.toMap({ + x: e.x, + y: e.y + }), n = this.startExtent.clone().offset(r.x - i.x, r.y - i.y, 0); + this.overviewGraphicLayer.getEsriGraphic( + "overview-graphic" + ).geometry = n, e.action === "end" && (this.$iApi.geo.map.zoomMapTo( + this.$iApi.geo.geom.geomEsriToRamp(n), + void 0, + !1 + ), this.startExtent = null); + } + } + } + /** + * Updates overviewmap extent and graphic based on main map extent + * + * @param {Extent} newExtent new main map extent + * @returns {Promise} A promise that resolves when the overviewmap has finished updating + */ + updateOverview(e) { + const i = this.overviewmapStore.expandFactor, r = this.zoomMapTo( + e.expand(i), + void 0, + !1 + ), n = this.overviewGraphicLayer.getLocalGraphic("overview-graphic"); + return this.overviewGraphicLayer.removeGraphic(n), n.geometry = e, this.overviewGraphicLayer.addGraphic(n), r; + } + /** + * Checks if mouse event intersects with extent graphic + * + * @param {MouseEvent} e + * @returns {Promise} + */ + async cursorHitTest(e) { + return (await this.esriView.hitTest(e)).results.length > 0; + } +} +class lPi extends cf { + // Default point formatters + DEFAULT_POINT_FORMATTERS = { + LAT_LONG_DMS: this.formatLatLongDMS, + LAT_LONG_DD: this.formatLatLongDD, + LAT_LONG_DDM: this.formatLatLongDDM, + WEB_MERCATOR: this.formatMercator, + CANADA_ATLAS_LAMBERT: this.formatLambert, + UTM: this.formatUTM, + BASEMAP: this.formatBasemap + }; + // The currently selected point-formatting function + pointFormatter; + /** + * @constructor + * @param {InstanceAPI} iApi the RAMP instance + */ + constructor(e) { + super(e), this.pointFormatter = this.DEFAULT_POINT_FORMATTERS.LAT_LONG_DMS; + } + /** + * Configure the map caption using the given config + * + * @param captionConfig The map caption config + */ + createCaption(e) { + if (!e) + return; + const i = zD(this.$vApp.$pinia); + if (e.mapCoords.disabled) + i.coords = { disabled: !0 }; + else { + const r = e.mapCoords.formatter; + r !== void 0 && this.setPointFormatter(r); + } + if (e.scaleBar.disabled) + i.scale = { disabled: !0 }; + else { + const r = e.scaleBar.imperialScale; + r !== void 0 && (i.toggleScale(r), this.$iApi.geo.map.viewPromise.then(() => { + this.updateScale(); + })); + } + i.langtoggle = { + disabled: e?.langToggle?.disabled ?? !1 + }; + } + /** + * Updates the attribution on the map-caption bar + * Applies default ESRI attribution if incoming attribution is disabled or has undefined elements + * + * Updates map-caption store to notify map-caption component observer + * + * @function updateAttribution + * @param {Attribution} newAttribution incoming new attribution + */ + updateAttribution(e) { + const i = { + text: { value: "Powered by ESRI" }, + logo: { + altText: "ESRI logo", + link: "https://www.esri.com/", + value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAAAkCAYAAADWzlesAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADO9JREFUeNq0Wgl0jlca/pfvzyo6qNBSmhLLKE1kKEUtB9NTat+OYnBacwwJY19DZRC7sR41th60lWaizFSqRTOEw0lsrQSJGFIESSxJ/uRfv3nef+7Vt9f3p2E695z3fMt97/3ufe+7PO+9n9n0UzELsjKyiHdUdMZnVHTl2VyFe9nO7Kc/Io+4epUxmpWxeVkbr3hvUebgFf15GL9XUwZHndtAAYI09jGvIghOuoEwLOLeYiBoXrwGfZjYYOWAvWyMGlsk2YebXeV3NUEW1qcT5BBX4jUbCYEmHwwKEfdW1gEXgoWtiIlNRFeezcrkrQaTNSuraRYDdImrR1ylAALZBPnkXIJ0wRskeG2Cj3jsoFI2HhcfDDFWA9UBNdZZyc/PP4Z3HZYsWTLGbrffond0Xb9+/Qy6P3jw4F+HDx8+mu7XrVs3c+7cuX+i+3nz5o3n/Rw4cGAdf/7hhx9SZ8yYEcffHT9+/G/8uaSkJGvDhg3D8P3moNdXrlw5UtYVFxfnXL9+/V8PHz68grr2N2/eTC4tLb2E+9+Cotq1a/dOenr6njt37nxPdOrUqd0dO3bsjromoHBQKBPkEyFUB71MH6SPbNy4cRqfkMvlenzixImtqO/x3XffbXc6nSW5ubnpOTk5J1NTU/cQH91//fXXu3/88ccLy5cvj6d34B8gaBA9JyQk/OWjjz5aIu8Fz2DiWbZs2QLx/A4m0Qf9f/n48eNsPEeDfrdly5Y/U31UVNT7dJ04ceIsGseNGzfS6DkuLq4v8YE6Y/G+93g8XKZ6QUHBRVHfAPQC0xJfCRAv65EkeUP6gFx11JEkfw/qTc8ff/zxKofDUXrv3r08rOIBeU9CWbx48SLej5y4LGlpaf9YuHDhUv5OtqH+6Vty0riPAbWjheH8n3322VYpuG+//Xa5mGB7CGM8hKN7vV5dLfHx8WNI20E1aN4WP97YZyc7d+6MM5vNHRs2bDg3NjY23e12l5w8eZJWzIUJ9IdmlI4bNy4tICAgtHbt2hGdOnXaSe3oftu2bWmBgYFOn3MwmwcQLViwIJOeYVYJGGAZVuW2zWZzCZ6hoIGapnmknUMTQnr16vUeTOKydHqyHrx9t27dunro0KEfzJw5M4Pe3bp166Z0pHXr1g0Fj2EYCw8PD+N+SjNwUuSAKnxexOkswOWxZN63b9/MAQMGzIUwx5WXl99eunTpFLx+hJU/K9o/yM7OPhgZGdk5KSkpp0WLFv+Vrq7/na5nz57dR1dM6t7hw4e3DRkyJG7WrFlxgudzukIw58TzV3SF3Z+ByUzFbTk5O9j8fVH/JV3PnTv3uRijSdSR5/empKRkT5kypQxCC+UTxMKVQXuyWBT5WbiS4VFjIZLHWQsLN1ZFgFbm0U1KSNWUUMlDp9kAh0iNdCkRwiva2FjUsjJeJ5sYRYQwCGIYNGk8tC1UCuDQoUOb+vbtuxuPRUJ4FVwIFhZ7pUD45OXEbUpo9DIz8hgAFk0BORblWypm8BiQzkKnpoRnM+PxsEWhiYfFxMTUHTx4cDOYhg7tzM7IyLhNCiYEUEbCMxsAGYuCGjl4ClKE4GY+xCnIw95zBKqxvmyCOJqT7dws5ntZzLcoaJEjQiPUahMaESzudWEqhBEeiSuZvUvzA1+lxIMEhbD7QGYKUl0rBAgxC9vlq6IzNZZ9BYt+rMw8pBDLmSZZFBPQmBC8imaofo1roa5oKH82aQaaIH0CDTZM0sCBAxvBKbZ+7bXXGr3yyisN4ZjMDx48uAeAkofQdHbt2rUXhIpJKevMJwSLfqq3bt365enTp3eFh365SZMmBGpMFRUVZcAV1wFmzs2ZMyddtCkXk9ESExOjq1Wr9iLCbwAilA9xwrnlwimS4G2ffvppj1atWrWoWbNmbWCKAtj9V5MnT84cMWJEvTfeeKM+wqSFzCEoKMgJ3HEVgO6SkTlKMwgUgImwArn2DpMmTYrDALP0XyjEA9sbjTZtQZGij7qghqBWoK4AWPswkbLK+qHIsWPHjoXgfwvUhsZAAEflg+dfg0kuBlosUuvoO2jXl65qXWZm5g7UNRPIOIQLQqpcmECMJIAuRp1UVmiCACmTxAReFx+LhnPqV1hY+O9n6evIkSObSXCEHI0WASDtMMJ0uVHb7du3E6p9HxpxQK0DjN4r0Gc9kSZYeZiSNkuaUOv06dPTO3fuPNj0DAWgKWTFihVL+vfvT0J8kfohAsobV6tWrYbP0hf460pnLE2AF2jB21DvIKO2gO6FNB+ERJtaB+xjY37NN3+LogmkHi9s2rTp3bZt277LG8NuK5AopXbv3n0O7Gtsjx49ZmNye6GOD1RBwD9MFUKoSQSc30UdzJUrV26uWrVqP7D/lt27d+9/9OhRMas7gjYbhROzkv9R2wcHBwdWshjkYL1G7SBQTXGwTwQQLLIqWsGeGFAhVyFSO6C7Naj7ADRUJENDQGMjIiLmQl0LVLUbNWrUItSPhBNcodYhFyFklwAiYf0RNKZZs2YfFhUVXYcAvhFm0FFc++fl5eX4Mxto7JnRo0cvID4yHWSz70dHRw+khAxZ6yGVH8ndftS9DWokciWNx15fTN2zZ0+f6tWr1+LS279/fwYgcz4LPzJvdyGVLUFidFiVOIRAqx8KlQysZCdKboJUXL58uRAmMLFp06aLRbh1cGhrVEiD3nzzzTXIcU5R6gC6vXfv3kuIGgSIyq1Wq6cqpmdhiNAXFtu0adNeZVq9enUWA0xywyVECC4AicwttQ2SrvpkYnfv3i1X6xo0aPAiJv2H+fPnt27UqFEN4YsCDBCk33Lt2rW8kSNHJuP2LqUc4kq+4KFAgg6LxeKtSl+a4hMC6tSp85QD27VrVy9I1U2SJaKYS/ZG8Rf5uhVXq91ud4aEhATINo0bN46glUQMv4aQV46MMpj3iRVvsGjRohFEENQtygCRmZ5B6DsqNNPFANJT5cyZM5RoPRBE/qREaJYEYm4aZ1WFwDG9ppoClebNm9czPV/xYXOo6J4xY8Z84I8Jgq9HBCDVfsKECR+mpqZ+gSQnRVQHGTm4CxcuXBP9l4qrneUNPtheVSFYKtkF/jUKqWbx2LFjUxBJViA82asSZvv06TPq+PHjE/D4GzI70jiVT+xDyBzDo8DhZyoWNXsD4Cn/FYVQLKgIofCfMIkhgKyr4bhO8pBoVGgvsEuXLq+SEIw0Qayyl5H+vIPUmJf2ZYOwz5twXE05U/369TfBZu+wvMBpkH7L3dwyYZ+l4uoRPL50FzCcQuAJstvIyMjacG5Rw4YN64b7V9XBxcbGdgJq/cZIE4TT0/2ceTyzJsiMj0JSxfnz50+rTECBUUq2aGd2WC7Izib+WFwdLJs0sczT1w+Q3d34+PhTSKQ2w4GeVL9LTtefY1Q2YEz/qxC8LIe3f/LJJ2kqU79+/WIGDRpUj+0L8N0lG7B6N+QGiS1btgxR9ha8gi949uzZ0UiENgBSR4iQyFNiL0zkrh+V/78XfjJDq1aWnJx85dixY8kqRE1KSopNSUkZ0K1btwjhsGpMmzatbVZW1nTy/JQbQHUXA26HMRul/gOQHkcBUK1BBGiJFHgtcMV7YqeXeEM7dOhQB4lXh6dCS1kZaZbDSBjinV6ZhsBkdAMz0o00SO4hhIrUl7K/7vfv37+hP0eBw8tBftFRpNNNExMThyMqlKp8SEXsADy5t1GM+qF6CHwe+hifm5t7Ta1PSEiYj7rWIhsMZaCPEkDyL+2PHj36hdqO3lGd4KkuYbN0jC5h22TPRT179pwCZ5j9rKqF0FWtd+/eL0kBA9Y2kRudvBB4og2al1CM+iFsgQFfJTCkaZrboL2DhUfd4NjAadROvHPyvUsLayxNghxaMWw0D1EhFiguqSrxXWZ/EN7IyZMnX5QHn127dk0Gxo+nnd6q9EHf2rx58zJgC1oxSrQKgR1cKl9YWJhdOFg329TlC1oBM3YYZJ8OubcozVZTJPjkzEEwOBGr1yIr+xz23xX23i48PPxVjiqRQV6GRuetXLkSbiPpCsPuTulzEAYPAh+cnzp1ao+YmJi31D5gevkwo3sZGRmn0M+RzMzMAhFtaGG0ixcvfpmfn39WbpNBC1zILK8KHqdykCsXszQ7O/sE8WMBNKGlbrxLF1HsSeQyV5JQBSrJUghLdDQmKB46ywTJFTKzfqqxftScwM1OjGXY/Vl0UU7IHcq3XMrutkz0QsX3bOwEWo5TfsNj9hMxjP5VCFR2fPl/AS4xMH7u71X6CWR92JQjer5t72AHLrpyKGRRhKbCZrNybhJg8HvBU+385Qv8DMKi/BjBEaKuHJK42YDU/x789cFhu1s5cFH/hTAp3/UqhzMm5cTM6G8br/qnyi8lTWYDoZiUP1TUEyc1Ble1D5OSA+gG7U0GR3b+fhUy+kVIN0Kb/xFgANrk0XIqRaL0AAAAAElFTkSuQmCC" + } + }; + if (e) { + e.logo.disabled || (i.logo.altText = e.logo.altText || i.logo.altText, i.logo.link = e.logo.link || i.logo.link, i.logo.value = e.logo.value || i.logo.value), e.text.disabled || (i.text.value = e.text.value || i.text.value); + const r = zD(this.$vApp.$pinia); + r.attribution = i; + } + if (!e || e.text.disabled) { + if (!this.$iApi.geo.map.esriMap) { + console.warn( + "Attempted to fetch map attribution with undefined map" + ); + return; + } + let r = ""; + const n = 5e3, s = 20, o = this.$iApi.geo.map.esriMap.basemap.baseLayers.map((a) => new Promise((l) => { + let c = 0; + const h = n / s, p = setInterval(function() { + a.loaded && !a.loadError ? (clearInterval(p), l(a)) : c > h && (clearInterval(p), l(null)), c++; + }, s); + })).toArray(); + Promise.all(o).then((a) => { + r = a.filter((c) => c?.copyright).map((c) => c.copyright).join(" | "), i.text.value = r || i.text.value; + const l = zD(this.$vApp.$pinia); + l.attribution = i; + }); + } + } + /** + * Calculates a scale bar for the current resolution + * Updates map-caption store to notify map-caption component observer + * + * @function updateScale + */ + updateScale() { + const e = zD(this.$vApp.$pinia), i = e.scale; + if (i?.disabled) + return; + const r = i?.isImperialScale || !1, n = this.scaleHelper().find( + (s) => s.isImperialScale === r + ) ?? { + isImperialScale: !1, + units: "error", + pixels: 1, + distance: 1 + }; + e.scale = { + width: `${n.pixels}px`, + label: `${this.$iApi.$i18n.n(n.distance, "number")}${n.units}`, + isImperialScale: r + }; + } + /** + * Formats the map point using the selected formatting function + * Returns empty string if point is undefined + * + * @param { Point | undefined } p the cursor map point + * @returns { Promise } the formatted string of the map point + */ + async formatPoint(e) { + return e ? await this.pointFormatter(e) : ""; + } + /** + * Sets the current point formatter + * Will accept the string id of a default formatter, or a new formatter with the correct formatter signature + * + * If given string id is not valid, then the point formatter is not changed + * + * @function setPointFormatter + * @param {string | ((p: Point) => Promise)} value + */ + setPointFormatter(e) { + if (typeof e == "string") { + if (!(e in this.DEFAULT_POINT_FORMATTERS)) { + console.warn( + `Could not find point formatter with id: ${e}` + ); + return; + } + this.pointFormatter = this.DEFAULT_POINT_FORMATTERS[e]; + } else + this.pointFormatter = e; + } + /** + * Generates helpful information to be used when constructing scale bars. + * @returns { Array } two objects with information for metric and imperial + */ + scaleHelper() { + const e = window.innerWidth > 600 ? 70 : 35, i = this.$iApi.geo.map.getResolution(), r = [], n = i * e, s = 1609.34, o = 3.28084, a = n > 1e3 ? ["km", "mi"] : ["m", "ft"]; + for (let l = 0; l < 2; l++) { + const c = l === 1; + if (r.push({ + isImperialScale: c, + units: a[l], + pixels: 0, + distance: 0 + }), n > 1e3) { + const h = i * e / (c ? s : 1e3), p = Math.round(h).toString().length, y = Math.pow(10, p - 1); + r[l].distance = Math.ceil(h / y) * y, r[l].pixels = r[l].distance * (c ? s : 1e3) / i; + } else + r[l].distance = Math.ceil( + c ? n * o : n + ), r[l].pixels = n / i; + } + return r; + } + /** + * Wraps value between the minimum and maximum value + * If value is between bounds, it will be returned as it is + * + * @function wrapValue + * @private + * @param {Number} val value to be wrapped + * @param {Number} min minimum value + * @param {Number} max maximum value + * @return {Number} the wrapped value + */ + wrapValue(e, i, r) { + return ((e - i) % (r - i) + (r - i)) % (r - i) + i; + } + /** + * Formats a lat/long DMS string using mouse map point coordinates + * + * @function formatLatLongDMSString + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatLatLongDMS(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 4326, + e + ), r = this.wrapValue(i.y, -90, 90), n = this.wrapValue(i.x, -180, 180), s = String.fromCharCode(176), o = Math.floor(Math.abs(r)) * (r < 0 ? -1 : 1), a = Math.floor(Math.abs((r - o) * 60)), l = Math.floor((Math.abs(r) - Math.abs(o) - a / 60) * 3600), c = Math.floor(Math.abs(n)) * (n < 0 ? -1 : 1), h = Math.floor(Math.abs((n - c) * 60)), p = Math.floor((Math.abs(n) - Math.abs(c) - h / 60) * 3600); + return `${this.$iApi.$i18n.n( + Math.abs(o), + "number" + )}${s} ${this.$iApi.$i18n.n(a, "number", { + minimumIntegerDigits: 2 + })}' ${this.$iApi.$i18n.n(l, "number", { + minimumIntegerDigits: 2 + })}" ${this.$iApi.$i18n.t( + "map.coordinates." + (r > 0 ? "north" : "south") + )} | ${this.$iApi.$i18n.n( + Math.abs(c), + "number" + )}${s} ${this.$iApi.$i18n.n(h, "number", { + minimumIntegerDigits: 2 + })}' ${this.$iApi.$i18n.n(p, "number", { + minimumIntegerDigits: 2 + })}" ${this.$iApi.$i18n.t( + "map.coordinates." + (0 > n ? "west" : "east") + )}`; + } + /** + * Formats a lat/long DDM string using mouse map point coordinates + * + * @function formatLatLongDDM + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatLatLongDDM(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 4326, + e + ), r = this.wrapValue(i.y, -90, 90), n = this.wrapValue(i.x, -180, 180), s = String.fromCharCode(176), o = Math.floor(Math.abs(r)) * (r < 0 ? -1 : 1), a = Math.abs((r - o) * 60), l = Math.floor(Math.abs(n)) * (n < 0 ? -1 : 1), c = Math.abs((n - l) * 60); + return `${this.$iApi.$i18n.n( + Math.abs(o), + "number" + )}${s} ${this.$iApi.$i18n.n(a, "number", { + minimumIntegerDigits: 2, + minimumFractionDigits: 5, + maximumFractionDigits: 5 + })} ${this.$iApi.$i18n.t( + "map.coordinates." + (r > 0 ? "north" : "south") + )} | ${this.$iApi.$i18n.n( + Math.abs(l), + "number" + )}${s} ${this.$iApi.$i18n.n(c, "number", { + minimumIntegerDigits: 2, + minimumFractionDigits: 5, + maximumFractionDigits: 5 + })} ${this.$iApi.$i18n.t( + "map.coordinates." + (0 > n ? "west" : "east") + )}`; + } + /** + * Formats a lat/long DD string using mouse map point coordinates + * + * @function formatLatLongDD + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatLatLongDD(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 4326, + e + ), r = this.wrapValue(i.y, -90, 90), n = this.wrapValue(i.x, -180, 180), s = String.fromCharCode(176), o = Math.abs(r), a = Math.abs(n); + return `${this.$iApi.$i18n.n(o, "number", { + minimumIntegerDigits: 2, + minimumFractionDigits: 5, + maximumFractionDigits: 5 + })}${s} ${this.$iApi.$i18n.t( + "map.coordinates." + (r > 0 ? "north" : "south") + )} | ${this.$iApi.$i18n.n(a, "number", { + minimumIntegerDigits: 2, + minimumFractionDigits: 5, + maximumFractionDigits: 5 + })}${s} ${this.$iApi.$i18n.t( + "map.coordinates." + (0 > n ? "west" : "east") + )}`; + } + /** + * Formats a mercator point string using mouse map point coordinates + * + * @function formatMercator + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatMercator(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 102100, + e + ); + return `${this.$iApi.$i18n.n( + Math.floor(i.x), + "number" + )} m | ${this.$iApi.$i18n.n(Math.floor(i.y), "number")} m`; + } + /** + * Formats a lambert point string using mouse map point coordinates + * + * @function formatLambert + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatLambert(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 3978, + e + ); + return `${this.$iApi.$i18n.n( + Math.abs(Math.floor(i.x)), + "number" + )} m ${this.$iApi.$i18n.t( + "map.coordinates." + (0 > i.x ? "west" : "east") + )} | ${this.$iApi.$i18n.n( + Math.abs(Math.floor(i.y)), + "number" + )} m ${this.$iApi.$i18n.t( + "map.coordinates." + (i.y > 0 ? "north" : "south") + )}`; + } + /** + * Formats a UTM string using mouse map point coordinates + * + * @function formatUTM + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatUTM(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + 4326, + e + ), r = this.wrapValue(i.y, -90, 90), n = this.wrapValue(i.x, -180, 180), s = Math.ceil((n + 180) / 6), o = await this.$iApi.geo.proj.projectGeometry( + parseInt("326" + s), + e + ); + return `${this.$iApi.$i18n.n(s, "number", { + minimumIntegerDigits: 2 + })} ${this.$iApi.$i18n.t( + "map.coordinates." + (r > 0 ? "north" : "south") + )} ${this.$iApi.$i18n.n( + Math.floor(o.x), + "number" + )} m${this.$iApi.$i18n.t( + "map.coordinates.east" + )} | ${this.$iApi.$i18n.n( + Math.abs(Math.floor(o.y)), + "number" + )} m${this.$iApi.$i18n.t("map.coordinates.north")}`; + } + /** + * Formats a string based on the current basemap projection using mouse map point coordinates + * + * @function formatBasemap + * @param {Point | undefined} p the cursor map point + * @returns {Promise} the formatted string using given cursor map coordinates + */ + async formatBasemap(e) { + const i = await this.$iApi.geo.proj.projectGeometry( + this.$iApi.geo.map.getSR(), + e + ); + return `${this.$iApi.$i18n.n( + i.x, + "number" + )} | ${this.$iApi.$i18n.n(i.y, "number")}`; + } +} +class uPi extends eCt { + // API for managing the maptip + maptip; + // API for managing map caption + caption; + /** + * The throttle level for map mouse move events + * @private + */ + mapMouseThrottle; + /** + * @constructor + * @param {InstanceAPI} iApi the RAMP instance + */ + constructor(e) { + super(e), this.maptip = new oPi(e), this.caption = new lPi(e), this.mapMouseThrottle = 0; + } + /** + * Will generate the actual Map control objects and construct it on the page + * @param {RampMapConfig} config the config for the map + * @param {string | HTMLDivElement} targetDiv the div to be used for the map view + */ + createMap(e, i) { + this.setMapMouseThrottle(e.mapMouseThrottle ?? 0), this.trackFirstBasemap = !0, super.createMap(e, i), this.viewPromise.then(() => { + this.$iApi.event.emit(an.MAP_CREATED); + }); + } + /** + * Destroys the ESRI map. Typically called by internal system, use at your own risk. + */ + destroyMap() { + if (!this.esriMap || !this.esriView) { + this.noMapErr(); + return; + } + this.$iApi.geo.layer.allLayersOnMap(!1).map((e) => e.uid).forEach((e) => this.removeLayer(e)), super.destroyMap(), this.$iApi.event.emit(an.MAP_DESTROYED); + } + /** + * Will generate a ESRI map view and add it to the page + * Can optionally provide the basemap or basemap id to be used when creating the map view + * + * @protected + * @param {string | Basemap | undefined} basemap the id of the basemap that should be used when creating the map view + */ + createMapView(e) { + const r = fm(this.$vApp.$pinia).config.map; + if (!r) + throw new Error( + "Attempted to create map view without a map config" + ); + const n = (typeof e == "string" ? this.findBasemap(e) : e) || this.findBasemap(r.initialBasemapId), s = r.tileSchemas.find((l) => l.id === n.tileSchemaId); + if (!s) + throw new Error( + `Could not find tile schema for the given basemap id: ${n.id}` + ); + const o = r.extentSets.find( + (l) => l.id === s.extentSetId + ); + if (!o) + throw new Error( + `Could not find extent set with the given id: ${s.extentSetId}` + ); + this._rampExtentSet = TQ.fromConfig(o), this._rampSR = this._rampExtentSet.sr.clone(); + const a = r.lodSets.find( + (l) => l.id === s.lodSetId + ); + if (!a) + throw new Error( + `Could not find lod set with the given id: ${s.lodSetId}` + ); + this.esriView = ya( + new X1t({ + map: this.esriMap, + container: this._targetDiv, + constraints: { + lods: a.lods, + rotationEnabled: !1 + }, + spatialReference: this._rampSR.toESRI(), + extent: this._rampExtentSet.defaultExtent.toESRI(), + navigation: { + browserTouchPanEnabled: !1 + }, + background: { color: n.backgroundColour } + }) + ), this.esriView.ui.components = [], this.handlers.push({ + type: "extent", + handler: this.esriView.watch("extent", (l) => { + if (l) { + const c = this.$iApi.geo.geom.geomEsriToRamp( + l, + "map_extent_event" + ); + this.$iApi.event.emit( + an.MAP_EXTENTCHANGE, + c + ), this.$iApi.event.emit(an.FILTER_CHANGE, { + extent: c, + filterKey: cm.EXTENT + }); + } + }) + }), this.handlers.push({ + type: "scale", + handler: this.esriView.watch("scale", (l) => { + this.$iApi.event.emit(an.MAP_SCALECHANGE, l); + }) + }), this.handlers.push({ + type: "resize", + handler: this.esriView.on("resize", (l) => { + this.$iApi.event.emit(an.MAP_RESIZED, { + height: l.height, + width: l.width + }); + }) + }), this.handlers.push({ + type: "click", + handler: this.esriView.on("click", (l) => { + this.$iApi.event.emit( + an.MAP_CLICK, + this.$iApi.geo.geom.esriMapClickToRamp( + l, + "map_click_point" + ) + ); + }) + }), this.handlers.push({ + type: "double-click", + handler: this.esriView.on("double-click", (l) => { + this.$iApi.event.emit( + an.MAP_DOUBLECLICK, + this.$iApi.geo.geom.esriMapClickToRamp( + l, + "map_doubleclick_point" + ) + ); + }) + }), this.handlers.push({ + type: "pointer-move", + handler: this.esriView.on( + "pointer-move", + this.createMouseMoveHandler() + ) + }), this.handlers.push({ + type: "pointer-move-start", + // emulate mouse move start event using debounce + handler: this.esriView.on( + "pointer-move", + ZS(100, !0, (l) => { + this.$iApi.event.emit( + an.MAP_MOUSEMOVE_START, + this.$iApi.geo.geom.esriMapMouseToRamp(l) + ); + }) + ) + }), this.handlers.push({ + type: "pointer-move-end", + // emulate mouse move end event using debounce + handler: this.esriView.on( + "pointer-move", + ZS(100, (l) => { + this.$iApi.event.emit( + an.MAP_MOUSEMOVE_END, + this.$iApi.geo.geom.esriMapMouseToRamp(l) + ); + }) + ) + }), this.handlers.push({ + type: "pointer-leave", + handler: this.esriView.on("pointer-leave", (l) => { + setTimeout(() => { + this.$iApi.event.emit( + an.MAP_MOUSELEAVE, + l.native + ); + }, Math.max(this.mapMouseThrottle, 100) + 1); + }) + }), this.handlers.push({ + type: "pointer-down", + handler: this.esriView.on("pointer-down", (l) => { + this.$iApi.event.emit( + an.MAP_MOUSEDOWN, + l.native + ); + }) + }), this.handlers.push({ + type: "key-down", + handler: this.esriView.on("key-down", (l) => { + this.$iApi.event.emit( + an.MAP_KEYDOWN, + l.native + ), l.stopPropagation(); + }) + }), this.handlers.push({ + type: "key-up", + handler: this.esriView.on("key-up", (l) => { + this.$iApi.event.emit(an.MAP_KEYUP, l.native), l.stopPropagation(); + }) + }), this.handlers.push({ + type: "focus", + handler: this.esriView.on("focus", (l) => { + this.$iApi.event.emit(an.MAP_FOCUS, l.native); + }) + }), this.handlers.push({ + type: "blur", + handler: this.esriView.on("blur", (l) => { + this.$iApi.event.emit(an.MAP_BLUR, l.native); + }) + }), this.esriView.container.addEventListener("touchmove", (l) => { + l.preventDefault(); + }), this.esriView.watch("fatalError", () => { + const l = new IntersectionObserver((c) => { + c.forEach((h) => { + h.isIntersecting && (this.esriView?.tryFatalErrorRecovery(), l.disconnect()); + }); + }); + l.observe(this.esriView.container); + }), this.esriView.when(() => { + if (this._viewPromise.resolveMe(), this.created = !0, this.applyBasemap(n), s.recoveryBasemap?.basemapId) { + const l = s.recoveryBasemap.timeout ?? 8e3; + l > 0 && setTimeout(() => { + this.trackFirstBasemap && this.recoverBasemap(s.id); + }, l); + } + }); + } + /** + * Destroys the ESRI map view + * + * @protected + */ + destroyMapView() { + this.esriView?.container.removeEventListener("touchmove", (e) => { + e.preventDefault(); + }), super.destroyMapView(); + } + /** + * Sets the basemap to the basemap with the given id or the basemap object + * Throws error if basemap could not be found + * + * @param {string | basemap} basemap the basemap id or object + * @protected + */ + applyBasemap(e) { + if (!this.esriMap) { + this.noMapErr(); + return; + } + const i = typeof e == "string" ? this.findBasemap(e) : e; + this.esriMap.basemap = eo(i.esriBasemap); + const r = fm(this.$vApp.$pinia); + r.activeBasemapConfig = i.config; + } + /** + * Set the map's basemap to the basemap with the given id. + * If the new basemap's tile schema differs from the current one, the map view will be refreshed + * + * The returned boolean indicates if the schema has changed. + * + * @param {string} basemapId the basemap id + * @returns {boolean} indicates if the schema has changed + */ + setBasemap(e) { + if (!this.esriView || !this.esriMap) + return this.noMapErr(), !1; + const i = fm(this.$vApp.$pinia), r = this.findBasemap(e), s = i.activeBasemapConfig.tileSchemaId !== r.tileSchemaId; + if (s) { + const o = this.getExtent().center(), a = this.getScale(); + this._viewPromise = new vm(), this.created = !1, this.$iApi.event.emit(an.MAP_REFRESH_START), this.destroyMapView(), this.createMapView(r), this.viewPromise.then(() => { + this.$iApi.event.emit(an.MAP_REFRESH_END); + const l = this.findClosestScale(a); + this.$iApi.geo.proj.projectGeometry(this._rampSR, o).then( + (c) => this.zoomMapTo(c, l, !1) + ); + }); + } else + this.applyBasemap(r), this.esriView.set( + "background.color", + new QO(r.backgroundColour).toESRI() + ); + return this.$iApi.event.emit(an.MAP_BASEMAPCHANGE, { + basemapId: e, + schemaChanged: s + }), s; + } + /** + * Will attempt to change to another basemap if the very first basemap failed. + * If nothing is defined, will do nothing but manage our watching state. + * + * @param {string} basemapSchemaId the basemap schema id (where the fallback is defined) + */ + recoverBasemap(e) { + this.esriMap || this.noMapErr(), this.trackFirstBasemap = !1; + const r = fm(this.$vApp.$pinia).config.map; + if (r) { + const n = r.tileSchemas.find( + (s) => s.id === e + ); + if (n?.recoveryBasemap?.basemapId) { + const s = this.findBasemap( + n.recoveryBasemap.basemapId + ); + this.applyBasemap(s); + } + } + } + /** + * Adds a layer to the map. The layer is considered "registered" with RAMP until it is removed. + * Optionally can specify the layer order index for map layers. + * + * @param {LayerInstance} layer the Ramp layer to add + * @param {number | undefined} index optional order index to add the layer to + * @returns {Promise} a promise that resolves when the layer has been added to the map + */ + addLayer(e, i = void 0) { + return new Promise((r, n) => { + if (this.esriMap || (this.noMapErr(), n()), e.initiationState !== Og.INITIATING && e.initiationState !== Og.INITIATED && e.layerState !== rp.ERROR && e.initiate(), e.mapLayer && i === void 0) { + const l = this.$iApi.geo.layer.layerOrderIds(); + if (e.isCosmetic) + i = l.length; + else { + const c = this.$iApi.geo.layer.allLayers(); + let h = !0; + for (let p = l.length - 1; p >= 0 && h; p--) { + const y = c.find( + (v) => v.id === l[p] + ); + y && !y.isCosmetic && (i = p + 1, h = !1); + } + h && (i = 0); + } + } + i1(this.$vApp.$pinia).addLayer(e, i); + let o = 0; + const a = setInterval(() => { + o += 250, o >= 2e4 || e.layerState === rp.ERROR ? (clearInterval(a), e.onError(), console.error(`Failed to add layer: ${e.id}.`), n()) : e.initiationState === Og.INITIATED && (e.esriLayer || !e.mapLayer) && (clearInterval(a), e.mapLayer ? this.insertToEsriMap(e) : e.onLoad(), this.$iApi.event.emit(an.LAYER_REGISTERED, e), r()); + }, 250); + }); + } + /** + * Utility method to insert a Map Layer into the ESRI map. The position in ESRI map + * is derived from global order and what layers are currently in the map. + * + * @param {LayerInstance} layer the RAMP layer to insert. Must be a Map layer + */ + insertToEsriMap(e) { + let i = 0; + const r = this.$iApi.geo.layer.getLayerPosition(e.id) ?? -1; + if (r > 0) { + const n = this.$iApi.geo.layer.layerOrderIds(), s = this.$iApi.geo.layer.allLayers(); + for (let o = r - 1; o > -1; o--) { + const a = n[o], l = s.find((c) => c.id === a); + if (l && l.esriLayer) { + const c = this.esriMap.layers.indexOf( + l.esriLayer + ); + if (c > -1) { + i = c + 1; + break; + } + } else + l || console.error( + "ESRI Layer insert encountered bad state. Layer likely inserted at bottom of map." + ); + } + } + r > -1 && this.esriMap?.add(e.esriLayer, i); + } + /** + * Reorders a layer on the map. The position is based on the instance layer order state + * maintained by the LayerAPI. + * If ignoreCosmetic is set, the index changes to a different basis. Essentially the + * as if cosmetic layers did not exists in the layer order state. + * + * @param {LayerInstance} layer the RAMP layer to be moved. If a sublayer is passed, the parent will be reordered. + * @param {number} index the RAMP layer index where the layer will be moved to + * @param {boolean} ignoreCosmetic indicates if the index should ignore cosmetic layers + */ + reorder(e, i, r = !1) { + if (i < 0) { + console.error("Negative index passed to map reorder"); + return; + } + if (!this.esriMap) { + this.noMapErr(); + return; + } + if (e.isSublayer && (e = e.parentLayer), !e.mapLayer) { + console.error("Attempted to reorder a data layer"); + return; + } + const n = this.$iApi.geo.layer.allLayers(); + let s = this.$iApi.geo.layer.layerOrderIds(); + if (r) { + if (e.isCosmetic) + return; + if (i > 0) { + const l = s.filter((c) => { + const h = n.find((p) => p.id === c); + return h ? !h.isCosmetic : (console.error("Layer reorder had critical error"), !1); + }); + i >= l.length && (console.error("non-cosmetic reorder index was too high"), i = l.length - 1), i = s.indexOf(l[i]); + } + } else + i >= s.length && (console.error("reorder index was too high"), i = s.length - 1); + const o = s.indexOf(e.id); + if (o === i) + return; + if (i1(this.$vApp.$pinia).reorderLayer(e, i), e.esriLayer && this.esriMap.layers.indexOf(e.esriLayer) > -1) { + let l = 0; + if (i > 0) { + s = this.$iApi.geo.layer.layerOrderIds(); + for (let c = i - 1; c > -1; c--) { + const h = s[c], p = n.find((y) => y.id === h); + if (p && p.esriLayer) { + const y = this.esriMap.layers.indexOf( + p.esriLayer + ); + if (y > -1) { + const v = i < o ? 1 : 0; + l = y + v; + break; + } + } else + p || console.error("Layer reorder had critical error"); + } + } + this.esriMap.reorder(e.esriLayer, l); + } + this.$iApi.event.emit(an.MAP_REORDER, { + layer: e, + newIndex: i + }); + } + /** + * Removes a sublayer from the map + * + * @param {LayerInstance | string} layer the Ramp sublayer or sublayer id/uid to remove + * @returns {Promise} a promise that resolves when the layer has been removed from the map + */ + removeSublayer(e) { + let i, r; + if (typeof e == "string") + i = e, r = this.$iApi.geo.layer.getLayer(i); + else { + if (!e.isSublayer) + throw new Error( + `Attempted to call removeSublayer on a non-sublayer object: ${e}` + ); + i = e.uid, r = e; + } + if (!r) + throw new Error("Sublayer could not be found for removal."); + this.$iApi.event.emit(an.LAYER_REMOVE, e), r.visibility = !1, r.isRemoved = !0, r.parentLayer?.sublayers.every( + (n) => n.isRemoved + ) && this.removeLayer(r.parentLayer); + } + /** + * Removes a layer from the map and fires the layer remove event. + * This will also unregister the layer from the Ramp instance. + * + * @param {LayerInstance | string} layer the Ramp layer or layer id/uid to remove + * @returns {Promise} a promise that resolves when the layer has been removed from the map + */ + removeLayer(e) { + if (!this.esriMap) { + this.noMapErr(); + return; + } + let i; + if (e instanceof QQ ? i = e : i = this.$iApi.geo.layer.getLayer(e), !i) + throw new Error("Layer could not be found for removal."); + if (i.isSublayer) { + this.removeSublayer(i); + return; + } + if (i.mapLayer && !i.esriLayer) + throw new Error( + "Attempted to remove layer from the map without an esri layer. Likely layer.initiate() was not called or had not finished." + ); + i.supportsSublayers && i.sublayers.some((n) => !n.isRemoved) && i.sublayers.forEach((n) => this.removeSublayer(n)), i.terminate(); + const r = i1(this.$vApp.$pinia); + r.removeLayer(i), r.removeLayerConfig(i.id), i.mapLayer && this.esriMap.remove(i.esriLayer), i.isRemoved = !0, this.$iApi.event.emit(an.LAYER_REMOVE, i); + } + /** + * Set's the map's mapMouseThrottle value to newThrottle. + * If newThrottle is not a positive number, a console error is thrown. + * + * The returned boolean indicates if the value has been successfully set. + * + * @param {number} newThrottle the new mapMouseThrottle value, which must be a positive number + * @returns {boolean} indicates if the value was set successfully + */ + setMapMouseThrottle(e) { + if (e < 0) + return console.error( + "Cannot set map mouse throttle to value that is less than 0." + ), !1; + this.mapMouseThrottle = e; + const i = this.handlers.findIndex((r) => r.type === "pointer-move"); + if (i !== -1) { + const r = this.handlers[i]; + this.handlers.splice(i, 1), r.handler.remove(); + } + return i !== -1 && this.esriView && this.handlers.push({ + type: "pointer-move", + handler: this.esriView.on( + "pointer-move", + this.createMouseMoveHandler() + ) + }), !0; + } + /** + * Creates a throttled map mouse move handler. + * Uses mapMouseThrottle for the throttle delay + * + * @returns the throttled handler function + */ + createMouseMoveHandler() { + if (!this.esriView) { + this.noMapErr(); + return; + } + return hO(this.mapMouseThrottle, (e) => { + this.$iApi.event.emit( + an.MAP_MOUSEMOVE, + this.$iApi.geo.geom.esriMapMouseToRamp(e) + ); + }); + } + /** + * Zooms the map to a given zoom level. The center point will not change. + * In the rare case where there is no basemap, this will likely do nothing + * + * @param {number} zoomLevel An integer matching the level of detail / zoom level the map should adjust to + * @returns {Promise} A promise that resolves when the map has finished zooming + */ + async zoomToLevel(e) { + if (this.esriView) + return this.esriView.goTo({ zoom: e }); + this.noMapErr(); + } + /** + * Zooms the map to the next zoom level in towards the earth. The center point will not change. + * In the rare case where there is no basemap, this will likely do nothing + * + * @returns {Promise} A promise that resolves when the map has finished zooming + */ + async zoomIn() { + if (this.esriView) + return this.zoomToLevel(this.esriView.zoom + 1); + this.noMapErr(); + } + /** + * Zooms the map to the next zoom level out away from the earth. The center point will not change. + * In the rare case where there is no basemap, this will likely do nothing + * + * @returns {Promise} A promise that resolves when the map has finished zooming + */ + async zoomOut() { + if (this.esriView) + return this.zoomToLevel(this.esriView.zoom - 1); + this.noMapErr(); + } + /** + * Zooms the map to the closest zoom level that will be visible for a given scale set. + * Does nothing if scale set is already visible for the map. + * + * @returns {Promise} A promise that resolves when the map has finished zooming + */ + async zoomToVisibleScale(e) { + if (!this.esriView) { + this.noMapErr(); + return; + } + const i = e.isOffScale(this.getScale()); + if (!i.offScale) + return; + const r = this.esriView.constraints.lods; + if (!r) + return this.zoomMapTo( + this.getExtent().center(), + (i.zoomIn, e.minScale) + ); + const n = i.zoomIn ? r : [...r].reverse(), s = n.find( + (o) => i.zoomIn ? o.scale < e.minScale : o.scale > e.maxScale + ) || n[n.length - 1]; + return this.zoomToLevel(s.level); + } + /** + * Finds the tile scale (level of detail) closest to the provided scale. + * If using a map with no scale levels, will return the given scale. + * + * @function findClosestScale + * @param {Number} scale scale value to search for in the levels of detail + * @return {Number} the level of detail scale closest to the input + */ + findClosestScale(e) { + const i = this.esriView?.constraints.lods; + if (!i) + return e; + const r = i.map((s) => Math.abs(s.scale - e)), n = r.indexOf(Math.min(...r)); + return i[n].scale; + } + /** + * Create a screenshot of the current view. + * + * Possible ESRI takeScreenshot() options: + * https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#takeScreenshot + * Will default to quality = 1 and format = 'png'. + * + * @param {__esri.MapViewTakeScreenshotOptions} options ESRI takeScreenshot() options + * @returns {Promise} a promise that resolves with a Screenshot + */ + async takeScreenshot(e) { + if (this.esriView) + return e.quality || (e.quality = 1), e.format || (e.format = "png"), this.esriView.takeScreenshot(e); + throw new Error("Export attempted without a map view available"); + } + /** + * Get a point in map co-ordinates corresponding to a pixel in screen co-ordinates. + * + * @param {ScreenPoint} screenPoint pixel screen co-ord of the point on the map + * @returns {Point} the map point analagous to the screen point + */ + screenPointToMapPoint(e) { + return this.esriView ? Sy.fromESRI( + this.esriView.toMap({ + x: e.screenX, + y: e.screenY + }), + "mappoint" + ) : (this.noMapErr(), new Sy("i_am_error", [0, 0], void 0, !0)); + } + /** + * Get a pixel in screen co-ordinates corresponding to a point in map co-ordinates. + * + * @param {Point} mapPoint point on the map + * @returns {ScreenPoint} the screen point analagous to the map point + */ + mapPointToScreenPoint(e) { + if (this.esriView) { + const i = this.esriView.toScreen(e.toESRI()); + return { screenX: i.x, screenY: i.y }; + } else + return this.noMapErr(), { screenX: 1, screenY: 1 }; + } + // pending https://github.com/ramp4-pcar4/ramp4-pcar4/issues/130 + // commenting out to avoid any undecided constants being exposed + /* + _identifyMode: IdentifyMode[] = [ + IdentifyMode.Query, + IdentifyMode.Marker, + IdentifyMode.Highlight, + IdentifyMode.Haze, + IdentifyMode.Details + ]; + */ + // a note about modes and events. + // depending if we choose to implement the old modes are come up with a new scheme, + // there are two event handlers that are running stuff (see events.ts). + // there is a map click event that then triggers the identify routine below + // and there is the identify event, raised by the routine below, that then opens the details panel. + // so the solution may need to either do some on/off'ing of the event handlers, + // or we introduce some global flag variables that get referenced + // (e.g. dont run identify could be a first line in the function below: if api.noIdentify then return ) + // global flags MIGHT be safer, as it doesn't have to assume the default handlers are in play. + // i.e. if someone did some event modding for custom results, and we have core code then swapping + // default event handlers, would be a mess. + /** + * Performs an identify request on all layers that support identify, and combines the results. + * + * @param {MapClick | Point} targetPoint the place on the map to execute the identify + * @memberof MapAPI + * @returns MapIdentifyResult + */ + runIdentify(e) { + const i = this.$iApi.geo.layer.allLayersOnMap(!1).filter((c) => c.canIdentify()); + let r; + if (e instanceof Sy) { + const c = this.mapPointToScreenPoint(e); + r = { + mapPoint: e, + screenX: c.screenX, + screenY: c.screenY, + button: 0, + input: "mouse", + clickTime: Date.now() + }; + } else + r = e; + if (i === void 0) + return { click: r, results: [] }; + let n = Promise.resolve([]); + i.some((c) => c.identifyMode === Xm.HYBRID || c.identifyMode === Xm.SYMBOLIC) && (n = this.esriView.hitTest({ + x: r.screenX, + y: r.screenY + }).then((c) => c.results.map((h) => ({ + layerId: h.layer.id, + layerIdx: 0, + // not required for this process, default rather than expensive lookup + oid: h.graphic.getObjectId() + })))); + const s = { + geometry: r.mapPoint, + hitTest: n + }, o = i.filter((c) => c.supportsIdentify).map((c) => (s.tolerance = r.input == "touch" ? c.touchTolerance : c.mouseTolerance, c.runIdentify(s))).flat(), a = Date.now(); + o.forEach((c) => { + c.requestTime = a; + }); + const l = { + results: o, + click: r + }; + return this.$iApi.event.emit(an.MAP_IDENTIFY, l), l; + } + /** + * Get the top-most graphic at the given screen point + * Returns undefined if there is no point + * + * @param {ScreenPoint} screenPoint The screen coordinates + * @returns {Promise} a promise that resolves when a graphic is hit (undefined if no graphic was hit) + */ + async getGraphicAtCoord(e) { + if (!this.esriView) { + this.noMapErr(); + return; + } + const i = this.$iApi.geo.layer.allLayersOnMap(!0); + if (i === void 0) + return; + i.reverse(); + const r = await this.esriView.hitTest({ + x: e.screenX, + y: e.screenY + }), n = r.results; + if (r.results.length === 0) + return; + let s; + if (i.some((o) => { + const a = n.find((l) => l.graphic.layer.id === o.id); + if (a) { + if (o.isCosmetic || !o.supportsFeatures) + return !0; + s = o; + } + return a !== void 0; + }), s) { + s.sublayers.length > 1 && console.warn("Found layer with sublayers during hitTest"), s.drawOrder.length === 0 && console.warn("Found layer with no draw order during hitTest"); + let o = n.filter( + (p) => p.graphic.layer.id === s.id + ); + const a = (p, y) => p === y ? 0 : p > y ? 1 : -1; + let l = [], c; + if (s.drawOrder.some((p, y) => (l = [o.pop()], c = l[0].graphic.attributes[p.field], o.forEach((v) => { + const x = v.graphic.attributes[p.field], I = a(c, x); + I === 0 ? l.push(v) : (p.ascending && I > 0 || !p.ascending && I < 0) && (l = [v], c = x); + }), l.length === 1 || y === s.drawOrder.length - 1 ? !0 : (o = l, !1))), l.length === 0) { + console.error( + "Hit test failed to find topmost item using draw order" + ); + return; + } + return { + oid: l[0].graphic.getObjectId(), + layerId: s.id, + layerIdx: s.getLayerTree().layerIdx + }; + } + } + // ------- + // Key Handler Fun + // ------- + // list of keys that are currently pressed + _activeKeys = []; + // ID of pan interval + _panInterval; + // true if map is focused using mouse click + _mouseFocus = !1; + /** + * Processes keydown event on map and initiates panning/zooming + * + * @param {KeyboardEvent} payload + * @memberof MapAPI + */ + mapKeyDown(e) { + const i = ["=", "-"]; + [ + "Shift", + "Control", + "ArrowDown", + "ArrowLeft", + "ArrowRight", + "ArrowUp" + ].includes(e.key) && !this._activeKeys.includes(e.key) ? (this._activeKeys.push(e.key), this._activeKeys.some((n) => i.includes(n)) || this.keyPan()) : i.includes(e.key) && !this._activeKeys.includes(e.key) ? (this._activeKeys.push(e.key), this.keyZoom(e)) : e.key === "Enter" ? this.runIdentify(this.getExtent().center()) : e.key === "Tab" && this._activeKeys.push(e.key); + } + /** + * Processes keyup event on map and deactivates key + * + * @param {KeyboardEvent} payload + * @memberof MapAPI + */ + mapKeyUp(e) { + const i = ["=", "-"]; + this._activeKeys.includes(e.key) && !i.includes(e.key) && (this._activeKeys.splice(this._activeKeys.indexOf(e.key), 1), this._activeKeys.some((r) => i.includes(r)) || this.keyPan()); + } + /** + * Sets the map focus source from the mouse + * + * @memberof MapAPI + */ + setMouseFocus() { + this._mouseFocus = !0; + } + /** + * Stops panning and deactivates all keys + * + * @memberof MapAPI + */ + stopKeyPan() { + this._activeKeys.includes("Tab") && (this._mouseFocus = !1), this._activeKeys = [], clearInterval(this._panInterval); + } + /** + * Returns if keys are active on map + * + * @memberof MapAPI + * @returns {boolean} - true if any pan/zoom keys are active + */ + get keysActive() { + return this._activeKeys.filter((e) => !["Control", "Shift"].includes(e)).length !== 0; + } + /** + * Returns if map focus is caused by mouse click + * + * @memberof MapAPI + * @returns {boolean} + */ + get mouseFocus() { + return this._mouseFocus; + } + /** + * Pauses pan interval to process zoom from keyboard + * + * @param {KeyboardEvent} payload + * @memberof MapAPI + * @private + */ + async keyZoom(e) { + clearInterval(this._panInterval), e.key === "=" ? await this.zoomIn() : e.key === "-" && await this.zoomOut(), this._activeKeys.splice(this._activeKeys.indexOf(e.key), 1), this.keyPan(); + } + /** + * Starts/restarts panning with active keys + * + * @memberof MapAPI + * @private + */ + keyPan() { + if (clearInterval(this._panInterval), !this.keysActive) + return; + const e = this.getExtent().center(), i = this.mapPointToScreenPoint(e), r = this.screenPointToMapPoint({ + screenX: i.screenX + 5, + screenY: i.screenY + 5 + }), n = Math.abs(r.x - e.x), s = Math.abs(r.y - e.y); + let o = 0, a = 0, l = 1; + for (let h = 0; h < this._activeKeys.length; ++h) + switch (this._activeKeys[h]) { + case "ArrowLeft": + o -= n; + break; + case "ArrowRight": + o += n; + break; + case "ArrowUp": + a += s; + break; + case "ArrowDown": + a -= s; + break; + case "Shift": + l = 2; + break; + case "Control": + l = 0.25; + break; + } + const c = this.getScale(); + this._panInterval = setInterval(() => { + e.x += l * o, e.y += l * a, this.zoomMapTo(e, c, !1); + }, 25); + } +} +const cPi = { + geometryType: "point", + renderer: { + type: "simple", + symbol: { + type: "esriSMS", + style: "esriSMSCircle", + color: [ + 67, + 100, + 255, + 200 + ], + size: 7, + outline: { + color: [ + 0, + 0, + 0, + 255 + ], + width: 1 + } + } + } +}, hPi = { + geometryType: "polyline", + renderer: { + type: "simple", + symbol: { + type: "esriSLS", + style: "esriSLSSolid", + color: [ + 90, + 90, + 90, + 200 + ], + width: 2 + } + } +}, dPi = { + geometryType: "polygon", + renderer: { + type: "simple", + symbol: { + type: "esriSFS", + style: "esriSFSSolid", + color: [ + 76, + 76, + 125, + 200 + ], + outline: { + type: "esriSLS", + style: "esriSLSSolid", + color: [ + 110, + 110, + 110, + 255 + ], + width: 1 + } + } + } +}, pPi = { + geometryType: "polygon", + renderer: { + type: "simple", + symbol: { + type: "esriSFS", + style: "esriSFSSolid", + color: [ + 255, + 0, + 0, + 64 + ], + outline: { + type: "esriSLS", + style: "esriSLSSolid", + color: [ + 240, + 128, + 128, + 255 + ], + width: 1 + } + } + } +}, fPi = { + circlePoint: cPi, + solidLine: hPi, + outlinedPoly: dPi, + boundingBoxPoly: pPi +}; +var tCt = { exports: {} }; +(function(t, e) { + (function(i, r) { + if (t.exports = r(obt()), typeof i.navigator == "object") { + if (!i.Terraformer) + throw new Error("Terraformer.ArcGIS requires the core Terraformer library. https://github.com/esri/Terraformer"); + i.Terraformer.ArcGIS = r(i.Terraformer); + } + })(td, function(i) { + var r = {}; + function n(P) { + var F = 0, k = 0, V = [], j, Y, X, Q; + X = P.match(/((\+|\-)[^\+\-]+)/g), Q = parseInt(X[0], 32); + for (var re = 1; re < X.length; re += 2) + j = parseInt(X[re], 32) + F, F = j, Y = parseInt(X[re + 1], 32) + k, k = Y, V.push([j / Q, Y / Q]); + return V; + } + function s(P) { + return o(P[0], P[P.length - 1]) || P.push(P[0]), P; + } + function o(P, F) { + for (var k = 0; k < P.length; k++) + if (P[k] !== F[k]) + return !1; + return !0; + } + function a(P) { + var F = {}; + for (var k in P) + P.hasOwnProperty(k) && (F[k] = P[k]); + return F; + } + function l(P) { + var F = 0, k = 0, V = P.length, j = P[k], Y; + for (k; k < V - 1; k++) + Y = P[k + 1], F += (Y[0] - j[0]) * (Y[1] + j[1]), j = Y; + return F >= 0; + } + function c(P) { + var F = [], k = P.slice(0), V = s(k.shift().slice(0)); + if (V.length >= 4) { + l(V) || V.reverse(), F.push(V); + for (var j = 0; j < k.length; j++) { + var Y = s(k[j].slice(0)); + Y.length >= 4 && (l(Y) && Y.reverse(), F.push(Y)); + } + } + return F; + } + function h(P) { + for (var F = [], k = 0; k < P.length; k++) + for (var V = c(P[k]), j = V.length - 1; j >= 0; j--) { + var Y = V[j].slice(0); + F.push(Y); + } + return F; + } + function p(P, F) { + var k = i.Tools.arraysIntersectArrays(P, F), V = i.Tools.coordinatesContainPoint(P, F[0]); + return !!(!k && V); + } + function y(P) { + for (var F = [], k = [], V, j, Y, X = 0; X < P.length; X++) { + var Q = s(P[X].slice(0)); + if (!(Q.length < 4)) + if (l(Q)) { + var re = [Q.slice().reverse()]; + F.push(re); + } else + k.push(Q.slice().reverse()); + } + for (var he = []; k.length; ) { + Y = k.pop(); + var fe = !1; + for (V = F.length - 1; V >= 0; V--) + if (j = F[V][0], p(j, Y)) { + F[V].push(Y), fe = !0; + break; + } + fe || he.push(Y); + } + for (; he.length; ) { + Y = he.pop(); + var be = !1; + for (V = F.length - 1; V >= 0; V--) + if (j = F[V][0], i.Tools.arraysIntersectArrays(j, Y)) { + F[V].push(Y), be = !0; + break; + } + be || F.push([Y.reverse()]); + } + return F.length === 1 ? { + type: "Polygon", + coordinates: F[0] + } : { + type: "MultiPolygon", + coordinates: F + }; + } + function v(P, F) { + var k = {}; + return F = F || {}, F.idAttribute = F.idAttribute || void 0, P.spatialReference && (P.spatialReference.wkid === 3857 || P.spatialReference.wkid === 102100) && (k.crs = i.MercatorCRS), typeof P.x == "number" && typeof P.y == "number" && (k.type = "Point", k.coordinates = [P.x, P.y], (P.z || P.m) && k.coordinates.push(P.z), P.m && k.coordinates.push(P.m)), P.points && (k.type = "MultiPoint", k.coordinates = P.points.slice(0)), P.paths && (P.paths.length === 1 ? (k.type = "LineString", k.coordinates = P.paths[0].slice(0)) : (k.type = "MultiLineString", k.coordinates = P.paths.slice(0))), P.rings && (k = y(P.rings.slice(0))), typeof P.xmin == "number" && typeof P.ymin == "number" && typeof P.xmax == "number" && typeof P.ymax == "number" && (k.type = "Polygon", k.coordinates = [[ + [P.xmax, P.ymax], + [P.xmin, P.ymax], + [P.xmin, P.ymin], + [P.xmax, P.ymin], + [P.xmax, P.ymax] + ]]), (P.compressedGeometry || P.geometry || P.attributes) && (k.type = "Feature", P.compressedGeometry && (P.geometry = { + paths: [ + n(P.compressedGeometry) + ] + }), k.geometry = P.geometry ? v(P.geometry) : null, k.properties = P.attributes ? a(P.attributes) : null, P.attributes && (k.id = P.attributes[F.idAttribute] || P.attributes.OBJECTID || P.attributes.FID)), new i.Primitive(k); + } + function x(P, F) { + var k; + F = F || {}; + var V = F.idAttribute || "OBJECTID"; + F.sr ? k = { wkid: F.sr } : P && P.crs && P.crs.properties.name != "urn:ogc:def:crs:OGC:1.3:CRS84" ? k = null : k = { wkid: 4326 }; + var j = {}, Y; + switch (P.type) { + case "Point": + j.x = P.coordinates[0], j.y = P.coordinates[1], P.coordinates[2] && (j.z = P.coordinates[2]), P.coordinates[3] && (j.m = P.coordinates[3]), j.spatialReference = k; + break; + case "MultiPoint": + j.points = P.coordinates.slice(0), j.spatialReference = k; + break; + case "LineString": + j.paths = [P.coordinates.slice(0)], j.spatialReference = k; + break; + case "MultiLineString": + j.paths = P.coordinates.slice(0), j.spatialReference = k; + break; + case "Polygon": + j.rings = c(P.coordinates.slice(0)), j.spatialReference = k; + break; + case "MultiPolygon": + j.rings = h(P.coordinates.slice(0)), j.spatialReference = k; + break; + case "Feature": + P.geometry && (j.geometry = x(P.geometry, F)), j.attributes = P.properties ? a(P.properties) : {}, P.id && (j.attributes[V] = P.id); + break; + case "FeatureCollection": + for (j = [], Y = 0; Y < P.features.length; Y++) + j.push(x(P.features[Y], F)); + break; + case "GeometryCollection": + for (j = [], Y = 0; Y < P.geometries.length; Y++) + j.push(x(P.geometries[Y], F)); + break; + } + return j; + } + function I(P) { + return new i.LineString(n(P)); + } + return r.parse = v, r.convert = x, r.toGeoJSON = v, r.fromGeoJSON = x, r.parseCompressedGeometry = I, r; + }); +})(tCt); +var mPi = tCt.exports; +const gPi = /* @__PURE__ */ VI(mPi); +function iCt(t) { + return new Function("d", "return {" + t.map(function(e, i) { + return JSON.stringify(e) + ": d[" + i + "]"; + }).join(",") + "}"); +} +function yPi(t, e) { + var i = iCt(t); + return function(r, n) { + return e(i(r), n, t); + }; +} +function vPi(t) { + var e = /* @__PURE__ */ Object.create(null), i = []; + return t.forEach(function(r) { + for (var n in r) + n in e || i.push(e[n] = n); + }), i; +} +function Z6e(t) { + var e = new RegExp('["' + t + ` +]`), i = t.charCodeAt(0); + function r(c, h) { + var p, y, v = n(c, function(x, I) { + if (p) + return p(x, I - 1); + y = x, p = h ? yPi(x, h) : iCt(x); + }); + return v.columns = y, v; + } + function n(c, h) { + var p = {}, y = {}, v = [], x = c.length, I = 0, P = 0, F, k; + function V() { + if (I >= x) + return y; + if (k) + return k = !1, p; + var Y = I, X; + if (c.charCodeAt(Y) === 34) { + for (var Q = Y; Q++ < x; ) + if (c.charCodeAt(Q) === 34) { + if (c.charCodeAt(Q + 1) !== 34) + break; + ++Q; + } + return I = Q + 2, X = c.charCodeAt(Q + 1), X === 13 ? (k = !0, c.charCodeAt(Q + 2) === 10 && ++I) : X === 10 && (k = !0), c.slice(Y + 1, Q).replace(/""/g, '"'); + } + for (; I < x; ) { + var re = 1; + if (X = c.charCodeAt(I++), X === 10) + k = !0; + else if (X === 13) + k = !0, c.charCodeAt(I) === 10 && (++I, ++re); + else if (X !== i) + continue; + return c.slice(Y, I - re); + } + return c.slice(Y); + } + for (; (F = V()) !== y; ) { + for (var j = []; F !== p && F !== y; ) + j.push(F), F = V(); + h && (j = h(j, P++)) == null || v.push(j); + } + return v; + } + function s(c, h) { + return h == null && (h = vPi(c)), [h.map(l).join(t)].concat(c.map(function(p) { + return h.map(function(y) { + return l(p[y]); + }).join(t); + })).join(` +`); + } + function o(c) { + return c.map(a).join(` +`); + } + function a(c) { + return c.map(l).join(t); + } + function l(c) { + return c == null ? "" : e.test(c += "") ? '"' + c.replace(/\"/g, '""') + '"' : c; + } + return { + parse: r, + parseRows: n, + format: s, + formatRows: o + }; +} +var C0e = Z6e(","), _Pi = C0e.parse, bPi = C0e.parseRows, wPi = C0e.format, xPi = C0e.formatRows, T0e = Z6e(" "), SPi = T0e.parse, CPi = T0e.parseRows, TPi = T0e.format, EPi = T0e.formatRows; +const IPi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + csvFormat: wPi, + csvFormatRows: xPi, + csvParse: _Pi, + csvParseRows: bPi, + dsvFormat: Z6e, + tsvFormat: TPi, + tsvFormatRows: EPi, + tsvParse: SPi, + tsvParseRows: CPi +}, Symbol.toStringTag, { value: "Module" })), APi = /* @__PURE__ */ xye(IPi); +var Xz = { exports: {} }; +Xz.exports = PPi; +Xz.exports.pair = RPi; +Xz.exports.format = wOe; +Xz.exports.formatPair = OPi; +Xz.exports.coordToDMS = rCt; +function PPi(t, e) { + var i = xOe(t, e); + return i === null ? null : i.val; +} +function OPi(t) { + return wOe(t.lat, "lat") + " " + wOe(t.lon, "lon"); +} +function wOe(t, e) { + var i = rCt(t, e); + return i.whole + "° " + (i.minutes ? i.minutes + "' " : "") + (i.seconds ? i.seconds + '" ' : "") + i.dir; +} +function rCt(t, e) { + var i = { lat: ["N", "S"], lon: ["E", "W"] }[e] || "", r = i[t >= 0 ? 0 : 1], n = Math.abs(t), s = Math.floor(n), o = n - s, a = o * 60, l = Math.floor(a), c = Math.floor((a - l) * 60); + return { + whole: s, + minutes: l, + seconds: c, + dir: r + }; +} +function xOe(t, e) { + if (e || (e = "NSEW"), typeof t != "string") + return null; + t = t.toUpperCase(); + var i = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/, r = t.match(i); + if (!r) + return null; + var n = r[0], s; + if (r[1] && r[5] ? (s = r[1], n = n.slice(0, -1)) : s = r[1] || r[5], s && e.indexOf(s) === -1) + return null; + var o = r[2] ? parseFloat(r[2]) : 0, a = r[3] ? parseFloat(r[3]) / 60 : 0, l = r[4] ? parseFloat(r[4]) / 3600 : 0, c = o < 0 ? -1 : 1; + return (s === "S" || s === "W") && (c *= -1), { + val: (Math.abs(o) + a + l) * c, + dim: s, + matched: n, + remain: t.slice(n.length) + }; +} +function RPi(t, e) { + t = t.trim(); + var i = xOe(t, e); + if (!i) + return null; + t = i.remain.trim(); + var r = xOe(t, e); + return !r || r.remain ? null : i.dim ? MPi(i.val, r.val, i.dim) : [i.val, r.val]; +} +function MPi(t, e, i) { + if (i === "N" || i === "S") + return [t, e]; + if (i === "W" || i === "E") + return [e, t]; +} +var DPi = Xz.exports, a7 = APi, BXe = DPi, nCt = /(Lat)(itude)?/gi, sCt = /(L)(on|ng)(gitude)?/i; +function oCt(t, e) { + var i, r, n; + for (var s in t) + r = s.match(e), r && (!i || r[0].length / s.length > n) && (n = r[0].length / s.length, i = s); + return i; +} +function aCt(t) { + return oCt(t, nCt); +} +function lCt(t) { + return oCt(t, sCt); +} +function FPi(t) { + return !!t.match(nCt); +} +function LPi(t) { + return !!t.match(sCt); +} +function VXe(t) { + return typeof t == "object" ? Object.keys(t).length : 0; +} +function uCt(t) { + var e = [",", ";", " ", "|"], i = []; + return e.forEach(function(r) { + var n = a7.dsvFormat(r).parse(t); + if (n.length >= 1) { + for (var s = VXe(n[0]), o = 0; o < n.length; o++) + if (VXe(n[o]) !== s) + return; + i.push({ + delimiter: r, + arity: Object.keys(n[0]).length + }); + } + }), i.length ? i.sort(function(r, n) { + return n.arity - r.arity; + })[0].delimiter : null; +} +function NPi(t) { + return delete t.columns, t; +} +function kPi(t) { + var e = uCt(t); + return e ? NPi(a7.dsvFormat(e).parse(t)) : null; +} +function $Pi(t, e, i) { + i || (i = e, e = {}), e.delimiter = e.delimiter || ","; + var r = e.latfield || "", n = e.lonfield || "", s = e.crs || "", o = [], a = { type: "FeatureCollection", features: o }; + if (s !== "" && (a.crs = { type: "name", properties: { name: s } }), e.delimiter === "auto" && typeof t == "string" && (e.delimiter = uCt(t), !e.delimiter)) { + i({ + type: "Error", + message: "Could not autodetect delimiter" + }); + return; + } + var l = e.numericFields ? e.numericFields.split(",") : null, c = typeof t == "string" ? a7.dsvFormat(e.delimiter).parse(t, function(k) { + if (l) + for (var V in k) + l.includes(V) && (k[V] = +k[V]); + return k; + }) : t; + if (!c.length) { + i(null, a); + return; + } + var h = [], p; + r || (r = aCt(c[0])), n || (n = lCt(c[0])); + var y = !r || !n; + if (y) { + for (p = 0; p < c.length; p++) + o.push({ + type: "Feature", + properties: c[p], + geometry: null + }); + i(h.length ? h : null, a); + return; + } + for (p = 0; p < c.length; p++) + if (c[p][n] !== void 0 && c[p][r] !== void 0) { + var v = c[p][n], x = c[p][r], I, P, F; + F = BXe(v, "EW"), F && (v = F), F = BXe(x, "NS"), F && (x = F), I = parseFloat(v), P = parseFloat(x), isNaN(I) || isNaN(P) ? h.push({ + message: "A row contained an invalid value for latitude or longitude", + row: c[p], + index: p + }) : (e.includeLatLon || (delete c[p][n], delete c[p][r]), o.push({ + type: "Feature", + properties: c[p], + geometry: { + type: "Point", + coordinates: [ + parseFloat(I), + parseFloat(P) + ] + } + })); + } + i(h.length ? h : null, a); +} +function BPi(t) { + for (var e = t.features, i = { + type: "Feature", + geometry: { + type: "LineString", + coordinates: [] + } + }, r = 0; r < e.length; r++) + i.geometry.coordinates.push(e[r].geometry.coordinates); + return i.properties = e.reduce(function(n, s) { + for (var o in s.properties) + n[o] || (n[o] = []), n[o].push(s.properties[o]); + return n; + }, {}), { + type: "FeatureCollection", + features: [i] + }; +} +function VPi(t) { + for (var e = t.features, i = { + type: "Feature", + geometry: { + type: "Polygon", + coordinates: [[]] + } + }, r = 0; r < e.length; r++) + i.geometry.coordinates[0].push(e[r].geometry.coordinates); + return i.properties = e.reduce(function(n, s) { + for (var o in s.properties) + n[o] || (n[o] = []), n[o].push(s.properties[o]); + return n; + }, {}), { + type: "FeatureCollection", + features: [i] + }; +} +var Swe = { + isLon: LPi, + isLat: FPi, + guessLatHeader: aCt, + guessLonHeader: lCt, + csv: a7.csvParse, + tsv: a7.tsvParse, + dsv: a7, + auto: kPi, + csv2geojson: $Pi, + toLine: BPi, + toPolygon: VPi +}; +function uoe(t) { + throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +} +var cCt = { exports: {} }; +(function(t, e) { + (function(i) { + t.exports = i(); + })(function() { + var i = Math.floor, r = Math.log, n = Math.abs, s = Math.pow, o = String.fromCharCode, a = Math.min; + return function() { + function l(c, h, p) { + function y(I, P) { + if (!h[I]) { + if (!c[I]) { + var F = typeof uoe == "function" && uoe; + if (!P && F) + return F(I, !0); + if (v) + return v(I, !0); + var k = new Error("Cannot find module '" + I + "'"); + throw k.code = "MODULE_NOT_FOUND", k; + } + var V = h[I] = { exports: {} }; + c[I][0].call(V.exports, function(j) { + var Y = c[I][1][j]; + return y(Y || j); + }, V, V.exports, l, c, h, p); + } + return h[I].exports; + } + for (var v = typeof uoe == "function" && uoe, x = 0; x < p.length; x++) + y(p[x]); + return y; + } + return l; + }()({ 1: [function(l, c) { + const h = l("lie"), p = l("./combine"), y = l("buffer").Buffer; + c.exports = function(v, x) { + return new h(function(I, P) { + const F = p(v, x), k = new XMLHttpRequest(); + k.open("GET", F, !0), x !== "prj" && x !== "cpg" && (k.responseType = "arraybuffer"), k.addEventListener("load", function() { + return 399 < k.status ? x === "prj" || x === "cpg" ? I(!1) : P(new Error(k.status)) : I(x !== "prj" && x !== "cpg" ? y.from(k.response) : k.response); + }, !1), k.send(); + }); + }; + }, { "./combine": 3, buffer: 8, lie: 12 }], 2: [function(l, c) { + (function(h) { + (function() { + const p = l("./binaryajax-browser"), y = l("./combine"), v = l("buffer").Buffer; + c.exports = async function(x, I) { + if (!h.fetch) + return p(x, I); + const P = y(x, I), F = I === "prj" || I === "cpg"; + try { + const k = await fetch(P); + if (399 < k.status) + throw new Error(k.statusText); + if (F) + return k.text(); + const V = await k.arrayBuffer(); + return v.from(V); + } catch (k) { + if (console.log("ERROR", k, I), F || I === "dbf") + return !1; + throw k; + } + }; + }).call(this); + }).call(this, typeof td > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : td); + }, { "./binaryajax-browser": 1, "./combine": 3, buffer: 8 }], 3: [function(l, c) { + (function(h) { + (function() { + const p = h.URL; + c.exports = (y, v) => { + if (!v) + return y; + const x = new p(y); + return x.pathname = `${x.pathname}.${v}`, x.href; + }; + }).call(this); + }).call(this, typeof td > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : td); + }, {}], 4: [function(l, c) { + function h(I) { + let P = 0, F = 1; + const k = I.length; + for (let V, j; F < k; ) + V = j || I[0], j = I[F], P += (j[0] - V[0]) * (j[1] + V[1]), F++; + return 0 < P; + } + function p(I, P) { + return h(P) || !I.length ? I.push([P]) : I[I.length - 1].push(P), I; + } + function y(I) { + return I ? function(P, F) { + const k = [P.readDoubleLE(F), P.readDoubleLE(F + 8)]; + return I.inverse(k); + } : function(P, F) { + return [P.readDoubleLE(F), P.readDoubleLE(F + 8)]; + }; + } + function v(I, P) { + return this instanceof v ? (this.buffer = I, this.headers = this.parseHeader(), this.headers.length < this.buffer.byteLength && (this.buffer = this.buffer.slice(0, this.headers.length)), this.shpFuncs(P), void (this.rows = this.getRows())) : new v(I, P); + } + v.prototype.parsePoint = function(I) { + return { type: "Point", coordinates: this.parseCoord(I, 0) }; + }, v.prototype.parseZPoint = function(I) { + const P = this.parsePoint(I); + return P.coordinates.push(I.readDoubleLE(16)), P; + }, v.prototype.parsePointArray = function(I, P, F) { + const k = []; + for (let V = 0; V < F; ) + k.push(this.parseCoord(I, P)), P += 16, V++; + return k; + }, v.prototype.parseZPointArray = function(I, P, F, k) { + for (let V = 0; V < F; ) + k[V].push(I.readDoubleLE(P)), V++, P += 8; + return k; + }, v.prototype.parseArrayGroup = function(I, P, F, k, V) { + const j = []; + let Y = 0, X = 0, Q, re; + for (; Y < k; ) + Y++, F += 4, Q = X, X = Y === k ? V : I.readInt32LE(F), re = X - Q, re && (j.push(this.parsePointArray(I, P, re)), P += re << 4); + return j; + }, v.prototype.parseZArrayGroup = function(I, P, F, k) { + for (let V = 0; V < F; ) + k[V] = this.parseZPointArray(I, P, k[V].length, k[V]), P += k[V].length << 3, V++; + return k; + }, v.prototype.parseMultiPoint = function(I) { + const P = {}, F = I.readInt32LE(32, !0); + if (!F) + return null; + const k = this.parseCoord(I, 0), V = this.parseCoord(I, 16); + return P.bbox = [k[0], k[1], V[0], V[1]], F === 1 ? (P.type = "Point", P.coordinates = this.parseCoord(I, 36)) : (P.type = "MultiPoint", P.coordinates = this.parsePointArray(I, 36, F)), P; + }, v.prototype.parseZMultiPoint = function(I) { + const P = this.parseMultiPoint(I); + if (!P) + return null; + let F; + if (P.type === "Point") + return P.coordinates.push(I.readDoubleLE(72)), P; + F = P.coordinates.length; + const k = 52 + (F << 4); + return P.coordinates = this.parseZPointArray(I, k, F, P.coordinates), P; + }, v.prototype.parsePolyline = function(I) { + const P = {}, F = I.readInt32LE(32); + if (!F) + return null; + const k = this.parseCoord(I, 0), V = this.parseCoord(I, 16); + P.bbox = [k[0], k[1], V[0], V[1]]; + const j = I.readInt32LE(36); + let Y, X; + return F === 1 ? (P.type = "LineString", Y = 44, P.coordinates = this.parsePointArray(I, Y, j)) : (P.type = "MultiLineString", Y = 40 + (F << 2), X = 40, P.coordinates = this.parseArrayGroup(I, Y, X, F, j)), P; + }, v.prototype.parseZPolyline = function(I) { + const P = this.parsePolyline(I); + if (!P) + return null; + const F = P.coordinates.length; + let k; + return P.type === "LineString" ? (k = 60 + (F << 4), P.coordinates = this.parseZPointArray(I, k, F, P.coordinates), P) : (k = 56 + (P.coordinates.reduce(function(j, Y) { + return j + Y.length; + }, 0) << 4) + (F << 2), P.coordinates = this.parseZArrayGroup(I, k, F, P.coordinates), P); + }, v.prototype.polyFuncs = function(I) { + return I && (I.type === "LineString" ? (I.type = "Polygon", I.coordinates = [I.coordinates], I) : (I.coordinates = I.coordinates.reduce(p, []), I.coordinates.length === 1 ? (I.type = "Polygon", I.coordinates = I.coordinates[0], I) : (I.type = "MultiPolygon", I))); + }, v.prototype.parsePolygon = function(I) { + return this.polyFuncs(this.parsePolyline(I)); + }, v.prototype.parseZPolygon = function(I) { + return this.polyFuncs(this.parseZPolyline(I)); + }; + const x = { 1: "parsePoint", 3: "parsePolyline", 5: "parsePolygon", 8: "parseMultiPoint", 11: "parseZPoint", 13: "parseZPolyline", 15: "parseZPolygon", 18: "parseZMultiPoint" }; + v.prototype.shpFuncs = function(I) { + let P = this.headers.shpCode; + if (20 < P && (P -= 20), !(P in x)) + throw new Error("I don't know that shp type"); + this.parseFunc = this[x[P]], this.parseCoord = y(I); + }, v.prototype.getShpCode = function() { + return this.parseHeader().shpCode; + }, v.prototype.parseHeader = function() { + const I = this.buffer.slice(0, 100); + return { length: I.readInt32BE(24) << 1, version: I.readInt32LE(28), shpCode: I.readInt32LE(32), bbox: [I.readDoubleLE(36), I.readDoubleLE(44), I.readDoubleLE(52), I.readDoubleLE(52)] }; + }, v.prototype.getRows = function() { + let I = 100; + const P = this.buffer.byteLength, F = []; + for (let k; I < P && (k = this.getRow(I), !!k); ) + I += 8, I += k.len, k.type ? F.push(this.parseFunc(k.data)) : F.push(null); + return F; + }, v.prototype.getRow = function(I) { + const P = this.buffer.slice(I, I + 12), F = P.readInt32BE(4) << 1, k = P.readInt32BE(0); + return F === 0 ? { id: k, len: F, type: 0 } : { id: k, len: F, data: this.buffer.slice(I + 12, I + F + 8), type: P.readInt32LE(8) }; + }, c.exports = function(I, P) { + return new v(I, P).rows; + }; + }, {}], 5: [function(l, c) { + const h = l("jszip"); + c.exports = async (p) => { + const y = new h(); + await y.loadAsync(p); + const v = y.file(/.+/), x = {}; + return await Promise.all(v.map(async (I) => { + let P; + P = I.name.slice(-3).toLowerCase() === "shp" || I.name.slice(-3).toLowerCase() === "dbf" ? await I.async("nodebuffer") : await I.async("text"), x[I.name] = P; + })), x; + }; + }, { jszip: 11 }], 6: [function(l, c, h) { + function p(Q) { + var re = Q.length; + if (0 < re % 4) + throw new Error("Invalid string. Length must be a multiple of 4"); + var he = Q.indexOf("="); + he === -1 && (he = re); + var fe = he === re ? 0 : 4 - he % 4; + return [he, fe]; + } + function y(Q, re, he) { + return 3 * (re + he) / 4 - he; + } + function v(Q) { + var re = p(Q), he = re[0], fe = re[1], be = new V(y(Q, he, fe)), Se = 0, Me = 0 < fe ? he - 4 : he, ke, J; + for (J = 0; J < Me; J += 4) + ke = k[Q.charCodeAt(J)] << 18 | k[Q.charCodeAt(J + 1)] << 12 | k[Q.charCodeAt(J + 2)] << 6 | k[Q.charCodeAt(J + 3)], be[Se++] = 255 & ke >> 16, be[Se++] = 255 & ke >> 8, be[Se++] = 255 & ke; + return fe === 2 && (ke = k[Q.charCodeAt(J)] << 2 | k[Q.charCodeAt(J + 1)] >> 4, be[Se++] = 255 & ke), fe === 1 && (ke = k[Q.charCodeAt(J)] << 10 | k[Q.charCodeAt(J + 1)] << 4 | k[Q.charCodeAt(J + 2)] >> 2, be[Se++] = 255 & ke >> 8, be[Se++] = 255 & ke), be; + } + function x(Q) { + return F[63 & Q >> 18] + F[63 & Q >> 12] + F[63 & Q >> 6] + F[63 & Q]; + } + function I(Q, re, he) { + for (var fe = [], be = re, Se; be < he; be += 3) + Se = (16711680 & Q[be] << 16) + (65280 & Q[be + 1] << 8) + (255 & Q[be + 2]), fe.push(x(Se)); + return fe.join(""); + } + function P(Q) { + for (var re = Q.length, he = re % 3, fe = [], be = 16383, Se = 0, Me = re - he, ke; Se < Me; Se += be) + fe.push(I(Q, Se, Se + be > Me ? Me : Se + be)); + return he === 1 ? (ke = Q[re - 1], fe.push(F[ke >> 2] + F[63 & ke << 4] + "==")) : he === 2 && (ke = (Q[re - 2] << 8) + Q[re - 1], fe.push(F[ke >> 10] + F[63 & ke >> 4] + F[63 & ke << 2] + "=")), fe.join(""); + } + h.byteLength = function(Q) { + var re = p(Q), he = re[0], fe = re[1]; + return 3 * (he + fe) / 4 - fe; + }, h.toByteArray = v, h.fromByteArray = P; + for (var F = [], k = [], V = typeof Uint8Array > "u" ? Array : Uint8Array, j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Y = 0, X = j.length; Y < X; ++Y) + F[Y] = j[Y], k[j.charCodeAt(Y)] = Y; + k[45] = 62, k[95] = 63; + }, {}], 7: [function() { + }, {}], 8: [function(l, c, h) { + (function() { + (function() { + function p(Ne) { + if (2147483647 < Ne) + throw new RangeError('The value "' + Ne + '" is invalid for option "size"'); + var pe = new Uint8Array(Ne); + return pe.__proto__ = y.prototype, pe; + } + function y(Ne, pe, Ae) { + if (typeof Ne == "number") { + if (typeof pe == "string") + throw new TypeError('The "string" argument must be of type string. Received type number'); + return P(Ne); + } + return v(Ne, pe, Ae); + } + function v(Ne, pe, Ae) { + if (typeof Ne == "string") + return F(Ne, pe); + if (ArrayBuffer.isView(Ne)) + return k(Ne); + if (Ne == null) + throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof Ne); + if (wt(Ne, ArrayBuffer) || Ne && wt(Ne.buffer, ArrayBuffer)) + return V(Ne, pe, Ae); + if (typeof Ne == "number") + throw new TypeError('The "value" argument must not be of type number. Received type number'); + var it = Ne.valueOf && Ne.valueOf(); + if (it != null && it !== Ne) + return y.from(it, pe, Ae); + var yt = j(Ne); + if (yt) + return yt; + if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof Ne[Symbol.toPrimitive] == "function") + return y.from(Ne[Symbol.toPrimitive]("string"), pe, Ae); + throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof Ne); + } + function x(Ne) { + if (typeof Ne != "number") + throw new TypeError('"size" argument must be of type number'); + if (0 > Ne) + throw new RangeError('The value "' + Ne + '" is invalid for option "size"'); + } + function I(Ne, pe, Ae) { + return x(Ne), 0 >= Ne || pe === void 0 ? p(Ne) : typeof Ae == "string" ? p(Ne).fill(pe, Ae) : p(Ne).fill(pe); + } + function P(Ne) { + return x(Ne), p(0 > Ne ? 0 : 0 | Y(Ne)); + } + function F(Ne, pe) { + if ((typeof pe != "string" || pe === "") && (pe = "utf8"), !y.isEncoding(pe)) + throw new TypeError("Unknown encoding: " + pe); + var Ae = 0 | X(Ne, pe), it = p(Ae), yt = it.write(Ne, pe); + return yt !== Ae && (it = it.slice(0, yt)), it; + } + function k(Ne) { + for (var pe = 0 > Ne.length ? 0 : 0 | Y(Ne.length), Ae = p(pe), it = 0; it < pe; it += 1) + Ae[it] = 255 & Ne[it]; + return Ae; + } + function V(Ne, pe, Ae) { + if (0 > pe || Ne.byteLength < pe) + throw new RangeError('"offset" is outside of buffer bounds'); + if (Ne.byteLength < pe + (Ae || 0)) + throw new RangeError('"length" is outside of buffer bounds'); + var it; + return it = pe === void 0 && Ae === void 0 ? new Uint8Array(Ne) : Ae === void 0 ? new Uint8Array(Ne, pe) : new Uint8Array(Ne, pe, Ae), it.__proto__ = y.prototype, it; + } + function j(Ne) { + if (y.isBuffer(Ne)) { + var pe = 0 | Y(Ne.length), Ae = p(pe); + return Ae.length === 0 || Ne.copy(Ae, 0, 0, pe), Ae; + } + return Ne.length === void 0 ? Ne.type === "Buffer" && Array.isArray(Ne.data) ? k(Ne.data) : void 0 : typeof Ne.length != "number" || st(Ne.length) ? p(0) : k(Ne); + } + function Y(Ne) { + if (Ne >= 2147483647) + throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647 .toString(16) + " bytes"); + return 0 | Ne; + } + function X(Ne, pe) { + if (y.isBuffer(Ne)) + return Ne.length; + if (ArrayBuffer.isView(Ne) || wt(Ne, ArrayBuffer)) + return Ne.byteLength; + if (typeof Ne != "string") + throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof Ne); + var Ae = Ne.length, it = 2 < arguments.length && arguments[2] === !0; + if (!it && Ae === 0) + return 0; + for (var yt = !1; ; ) + switch (pe) { + case "ascii": + case "latin1": + case "binary": + return Ae; + case "utf8": + case "utf-8": + return Nt(Ne).length; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return 2 * Ae; + case "hex": + return Ae >>> 1; + case "base64": + return Be(Ne).length; + default: + if (yt) + return it ? -1 : Nt(Ne).length; + pe = ("" + pe).toLowerCase(), yt = !0; + } + } + function Q(Ne, pe, Ae) { + var it = !1; + if ((pe === void 0 || 0 > pe) && (pe = 0), pe > this.length || ((Ae === void 0 || Ae > this.length) && (Ae = this.length), 0 >= Ae) || (Ae >>>= 0, pe >>>= 0, Ae <= pe)) + return ""; + for (Ne || (Ne = "utf8"); ; ) + switch (Ne) { + case "hex": + return je(this, pe, Ae); + case "utf8": + case "utf-8": + return Pe(this, pe, Ae); + case "ascii": + return Re(this, pe, Ae); + case "latin1": + case "binary": + return Ge(this, pe, Ae); + case "base64": + return xe(this, pe, Ae); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return et(this, pe, Ae); + default: + if (it) + throw new TypeError("Unknown encoding: " + Ne); + Ne = (Ne + "").toLowerCase(), it = !0; + } + } + function re(Ne, pe, Ae) { + var it = Ne[pe]; + Ne[pe] = Ne[Ae], Ne[Ae] = it; + } + function he(Ne, pe, Ae, it, yt) { + if (Ne.length === 0) + return -1; + if (typeof Ae == "string" ? (it = Ae, Ae = 0) : 2147483647 < Ae ? Ae = 2147483647 : -2147483648 > Ae && (Ae = -2147483648), Ae = +Ae, st(Ae) && (Ae = yt ? 0 : Ne.length - 1), 0 > Ae && (Ae = Ne.length + Ae), Ae >= Ne.length) { + if (yt) + return -1; + Ae = Ne.length - 1; + } else if (0 > Ae) + if (yt) + Ae = 0; + else + return -1; + if (typeof pe == "string" && (pe = y.from(pe, it)), y.isBuffer(pe)) + return pe.length === 0 ? -1 : fe(Ne, pe, Ae, it, yt); + if (typeof pe == "number") + return pe &= 255, typeof Uint8Array.prototype.indexOf == "function" ? yt ? Uint8Array.prototype.indexOf.call(Ne, pe, Ae) : Uint8Array.prototype.lastIndexOf.call(Ne, pe, Ae) : fe(Ne, [pe], Ae, it, yt); + throw new TypeError("val must be string, number or Buffer"); + } + function fe(Ne, pe, Ae, it, yt) { + function He(H, T) { + return Ft === 1 ? H[T] : H.readUInt16BE(T * Ft); + } + var Ft = 1, ei = Ne.length, mt = pe.length; + if (it !== void 0 && (it = (it + "").toLowerCase(), it === "ucs2" || it === "ucs-2" || it === "utf16le" || it === "utf-16le")) { + if (2 > Ne.length || 2 > pe.length) + return -1; + Ft = 2, ei /= 2, mt /= 2, Ae /= 2; + } + var Ue; + if (yt) { + var si = -1; + for (Ue = Ae; Ue < ei; Ue++) + if (He(Ne, Ue) !== He(pe, si === -1 ? 0 : Ue - si)) + si !== -1 && (Ue -= Ue - si), si = -1; + else if (si === -1 && (si = Ue), Ue - si + 1 === mt) + return si * Ft; + } else + for (Ae + mt > ei && (Ae = ei - mt), Ue = Ae; 0 <= Ue; Ue--) { + for (var A = !0, ve = 0; ve < mt; ve++) + if (He(Ne, Ue + ve) !== He(pe, ve)) { + A = !1; + break; + } + if (A) + return Ue; + } + return -1; + } + function be(Ne, pe, Ae, it) { + Ae = +Ae || 0; + var yt = Ne.length - Ae; + it ? (it = +it, it > yt && (it = yt)) : it = yt; + var He = pe.length; + it > He / 2 && (it = He / 2); + for (var Ft = 0, ei; Ft < it; ++Ft) { + if (ei = parseInt(pe.substr(2 * Ft, 2), 16), st(ei)) + return Ft; + Ne[Ae + Ft] = ei; + } + return Ft; + } + function Se(Ne, pe, Ae, it) { + return at(Nt(pe, Ne.length - Ae), Ne, Ae, it); + } + function Me(Ne, pe, Ae, it) { + return at(nt(pe), Ne, Ae, it); + } + function ke(Ne, pe, Ae, it) { + return Me(Ne, pe, Ae, it); + } + function J(Ne, pe, Ae, it) { + return at(Be(pe), Ne, Ae, it); + } + function ce(Ne, pe, Ae, it) { + return at(Ee(pe, Ne.length - Ae), Ne, Ae, it); + } + function xe(Ne, pe, Ae) { + return pe === 0 && Ae === Ne.length ? le.fromByteArray(Ne) : le.fromByteArray(Ne.slice(pe, Ae)); + } + function Pe(Ne, pe, Ae) { + Ae = a(Ne.length, Ae); + for (var it = [], yt = pe; yt < Ae; ) { + var He = Ne[yt], Ft = null, ei = 239 < He ? 4 : 223 < He ? 3 : 191 < He ? 2 : 1; + if (yt + ei <= Ae) { + var mt, Ue, si, A; + ei === 1 ? 128 > He && (Ft = He) : ei === 2 ? (mt = Ne[yt + 1], (192 & mt) == 128 && (A = (31 & He) << 6 | 63 & mt, 127 < A && (Ft = A))) : ei === 3 ? (mt = Ne[yt + 1], Ue = Ne[yt + 2], (192 & mt) == 128 && (192 & Ue) == 128 && (A = (15 & He) << 12 | (63 & mt) << 6 | 63 & Ue, 2047 < A && (55296 > A || 57343 < A) && (Ft = A))) : ei === 4 && (mt = Ne[yt + 1], Ue = Ne[yt + 2], si = Ne[yt + 3], (192 & mt) == 128 && (192 & Ue) == 128 && (192 & si) == 128 && (A = (15 & He) << 18 | (63 & mt) << 12 | (63 & Ue) << 6 | 63 & si, 65535 < A && 1114112 > A && (Ft = A))); + } + Ft === null ? (Ft = 65533, ei = 1) : 65535 < Ft && (Ft -= 65536, it.push(55296 | 1023 & Ft >>> 10), Ft = 56320 | 1023 & Ft), it.push(Ft), yt += ei; + } + return Oe(it); + } + function Oe(Ne) { + var pe = Ne.length; + if (pe <= 4096) + return o.apply(String, Ne); + for (var Ae = "", it = 0; it < pe; ) + Ae += o.apply(String, Ne.slice(it, it += 4096)); + return Ae; + } + function Re(Ne, pe, Ae) { + var it = ""; + Ae = a(Ne.length, Ae); + for (var yt = pe; yt < Ae; ++yt) + it += o(127 & Ne[yt]); + return it; + } + function Ge(Ne, pe, Ae) { + var it = ""; + Ae = a(Ne.length, Ae); + for (var yt = pe; yt < Ae; ++yt) + it += o(Ne[yt]); + return it; + } + function je(Ne, pe, Ae) { + var it = Ne.length; + (!pe || 0 > pe) && (pe = 0), (!Ae || 0 > Ae || Ae > it) && (Ae = it); + for (var yt = "", He = pe; He < Ae; ++He) + yt += It(Ne[He]); + return yt; + } + function et(Ne, pe, Ae) { + for (var it = Ne.slice(pe, Ae), yt = "", He = 0; He < it.length; He += 2) + yt += o(it[He] + 256 * it[He + 1]); + return yt; + } + function Qe(Ne, pe, Ae) { + if (Ne % 1 != 0 || 0 > Ne) + throw new RangeError("offset is not uint"); + if (Ne + pe > Ae) + throw new RangeError("Trying to access beyond buffer length"); + } + function tt(Ne, pe, Ae, it, yt, He) { + if (!y.isBuffer(Ne)) + throw new TypeError('"buffer" argument must be a Buffer instance'); + if (pe > yt || pe < He) + throw new RangeError('"value" argument is out of bounds'); + if (Ae + it > Ne.length) + throw new RangeError("Index out of range"); + } + function ft(Ne, pe, Ae, it) { + if (Ae + it > Ne.length) + throw new RangeError("Index out of range"); + if (0 > Ae) + throw new RangeError("Index out of range"); + } + function Mt(Ne, pe, Ae, it, yt) { + return pe = +pe, Ae >>>= 0, yt || ft(Ne, pe, Ae, 4), ct.write(Ne, pe, Ae, it, 23, 4), Ae + 4; + } + function kt(Ne, pe, Ae, it, yt) { + return pe = +pe, Ae >>>= 0, yt || ft(Ne, pe, Ae, 8), ct.write(Ne, pe, Ae, it, 52, 8), Ae + 8; + } + function Tt(Ne) { + if (Ne = Ne.split("=")[0], Ne = Ne.trim().replace(gt, ""), 2 > Ne.length) + return ""; + for (; Ne.length % 4 != 0; ) + Ne += "="; + return Ne; + } + function It(Ne) { + return 16 > Ne ? "0" + Ne.toString(16) : Ne.toString(16); + } + function Nt(Ne, pe) { + pe = pe || 1 / 0; + for (var Ae = Ne.length, it = null, yt = [], He = 0, Ft; He < Ae; ++He) { + if (Ft = Ne.charCodeAt(He), 55295 < Ft && 57344 > Ft) { + if (!it) { + if (56319 < Ft) { + -1 < (pe -= 3) && yt.push(239, 191, 189); + continue; + } else if (He + 1 === Ae) { + -1 < (pe -= 3) && yt.push(239, 191, 189); + continue; + } + it = Ft; + continue; + } + if (56320 > Ft) { + -1 < (pe -= 3) && yt.push(239, 191, 189), it = Ft; + continue; + } + Ft = (it - 55296 << 10 | Ft - 56320) + 65536; + } else + it && -1 < (pe -= 3) && yt.push(239, 191, 189); + if (it = null, 128 > Ft) { + if (0 > (pe -= 1)) + break; + yt.push(Ft); + } else if (2048 > Ft) { + if (0 > (pe -= 2)) + break; + yt.push(192 | Ft >> 6, 128 | 63 & Ft); + } else if (65536 > Ft) { + if (0 > (pe -= 3)) + break; + yt.push(224 | Ft >> 12, 128 | 63 & Ft >> 6, 128 | 63 & Ft); + } else if (1114112 > Ft) { + if (0 > (pe -= 4)) + break; + yt.push(240 | Ft >> 18, 128 | 63 & Ft >> 12, 128 | 63 & Ft >> 6, 128 | 63 & Ft); + } else + throw new Error("Invalid code point"); + } + return yt; + } + function nt(Ne) { + for (var pe = [], Ae = 0; Ae < Ne.length; ++Ae) + pe.push(255 & Ne.charCodeAt(Ae)); + return pe; + } + function Ee(Ne, pe) { + for (var Ae = [], it = 0, yt, He, Ft; it < Ne.length && !(0 > (pe -= 2)); ++it) + yt = Ne.charCodeAt(it), He = yt >> 8, Ft = yt % 256, Ae.push(Ft), Ae.push(He); + return Ae; + } + function Be(Ne) { + return le.toByteArray(Tt(Ne)); + } + function at(Ne, pe, Ae, it) { + for (var yt = 0; yt < it && !(yt + Ae >= pe.length || yt >= Ne.length); ++yt) + pe[yt + Ae] = Ne[yt]; + return yt; + } + function wt(Ne, pe) { + return Ne instanceof pe || Ne != null && Ne.constructor != null && Ne.constructor.name != null && Ne.constructor.name === pe.name; + } + function st(Ne) { + return Ne !== Ne; + } + var le = l("base64-js"), ct = l("ieee754"); + h.Buffer = y, h.SlowBuffer = function(Ne) { + return +Ne != Ne && (Ne = 0), y.alloc(+Ne); + }, h.INSPECT_MAX_BYTES = 50, h.kMaxLength = 2147483647, y.TYPED_ARRAY_SUPPORT = function() { + try { + var Ne = new Uint8Array(1); + return Ne.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { + return 42; + } }, Ne.foo() === 42; + } catch { + return !1; + } + }(), y.TYPED_ARRAY_SUPPORT || typeof console > "u" || typeof console.error != "function" || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(y.prototype, "parent", { enumerable: !0, get: function() { + return y.isBuffer(this) ? this.buffer : void 0; + } }), Object.defineProperty(y.prototype, "offset", { enumerable: !0, get: function() { + return y.isBuffer(this) ? this.byteOffset : void 0; + } }), typeof Symbol < "u" && Symbol.species != null && y[Symbol.species] === y && Object.defineProperty(y, Symbol.species, { value: null, configurable: !0, enumerable: !1, writable: !1 }), y.poolSize = 8192, y.from = function(Ne, pe, Ae) { + return v(Ne, pe, Ae); + }, y.prototype.__proto__ = Uint8Array.prototype, y.__proto__ = Uint8Array, y.alloc = function(Ne, pe, Ae) { + return I(Ne, pe, Ae); + }, y.allocUnsafe = function(Ne) { + return P(Ne); + }, y.allocUnsafeSlow = function(Ne) { + return P(Ne); + }, y.isBuffer = function(Ne) { + return Ne != null && Ne._isBuffer === !0 && Ne !== y.prototype; + }, y.compare = function(Ne, pe) { + if (wt(Ne, Uint8Array) && (Ne = y.from(Ne, Ne.offset, Ne.byteLength)), wt(pe, Uint8Array) && (pe = y.from(pe, pe.offset, pe.byteLength)), !y.isBuffer(Ne) || !y.isBuffer(pe)) + throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (Ne === pe) + return 0; + for (var Ae = Ne.length, it = pe.length, yt = 0, He = a(Ae, it); yt < He; ++yt) + if (Ne[yt] !== pe[yt]) { + Ae = Ne[yt], it = pe[yt]; + break; + } + return Ae < it ? -1 : it < Ae ? 1 : 0; + }, y.isEncoding = function(Ne) { + switch ((Ne + "").toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "latin1": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return !0; + default: + return !1; + } + }, y.concat = function(Ne, pe) { + if (!Array.isArray(Ne)) + throw new TypeError('"list" argument must be an Array of Buffers'); + if (Ne.length === 0) + return y.alloc(0); + var Ae; + if (pe === void 0) + for (pe = 0, Ae = 0; Ae < Ne.length; ++Ae) + pe += Ne[Ae].length; + var it = y.allocUnsafe(pe), yt = 0; + for (Ae = 0; Ae < Ne.length; ++Ae) { + var He = Ne[Ae]; + if (wt(He, Uint8Array) && (He = y.from(He)), !y.isBuffer(He)) + throw new TypeError('"list" argument must be an Array of Buffers'); + He.copy(it, yt), yt += He.length; + } + return it; + }, y.byteLength = X, y.prototype._isBuffer = !0, y.prototype.swap16 = function() { + var Ne = this.length; + if (Ne % 2 != 0) + throw new RangeError("Buffer size must be a multiple of 16-bits"); + for (var pe = 0; pe < Ne; pe += 2) + re(this, pe, pe + 1); + return this; + }, y.prototype.swap32 = function() { + var Ne = this.length; + if (Ne % 4 != 0) + throw new RangeError("Buffer size must be a multiple of 32-bits"); + for (var pe = 0; pe < Ne; pe += 4) + re(this, pe, pe + 3), re(this, pe + 1, pe + 2); + return this; + }, y.prototype.swap64 = function() { + var Ne = this.length; + if (Ne % 8 != 0) + throw new RangeError("Buffer size must be a multiple of 64-bits"); + for (var pe = 0; pe < Ne; pe += 8) + re(this, pe, pe + 7), re(this, pe + 1, pe + 6), re(this, pe + 2, pe + 5), re(this, pe + 3, pe + 4); + return this; + }, y.prototype.toString = function() { + var Ne = this.length; + return Ne === 0 ? "" : arguments.length === 0 ? Pe(this, 0, Ne) : Q.apply(this, arguments); + }, y.prototype.toLocaleString = y.prototype.toString, y.prototype.equals = function(Ne) { + if (!y.isBuffer(Ne)) + throw new TypeError("Argument must be a Buffer"); + return this === Ne || y.compare(this, Ne) === 0; + }, y.prototype.inspect = function() { + var Ne = "", pe = h.INSPECT_MAX_BYTES; + return Ne = this.toString("hex", 0, pe).replace(/(.{2})/g, "$1 ").trim(), this.length > pe && (Ne += " ... "), ""; + }, y.prototype.compare = function(Ne, pe, Ae, it, yt) { + if (wt(Ne, Uint8Array) && (Ne = y.from(Ne, Ne.offset, Ne.byteLength)), !y.isBuffer(Ne)) + throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof Ne); + if (pe === void 0 && (pe = 0), Ae === void 0 && (Ae = Ne ? Ne.length : 0), it === void 0 && (it = 0), yt === void 0 && (yt = this.length), 0 > pe || Ae > Ne.length || 0 > it || yt > this.length) + throw new RangeError("out of range index"); + if (it >= yt && pe >= Ae) + return 0; + if (it >= yt) + return -1; + if (pe >= Ae) + return 1; + if (pe >>>= 0, Ae >>>= 0, it >>>= 0, yt >>>= 0, this === Ne) + return 0; + for (var He = yt - it, Ft = Ae - pe, ei = a(He, Ft), mt = this.slice(it, yt), Ue = Ne.slice(pe, Ae), si = 0; si < ei; ++si) + if (mt[si] !== Ue[si]) { + He = mt[si], Ft = Ue[si]; + break; + } + return He < Ft ? -1 : Ft < He ? 1 : 0; + }, y.prototype.includes = function(Ne, pe, Ae) { + return this.indexOf(Ne, pe, Ae) !== -1; + }, y.prototype.indexOf = function(Ne, pe, Ae) { + return he(this, Ne, pe, Ae, !0); + }, y.prototype.lastIndexOf = function(Ne, pe, Ae) { + return he(this, Ne, pe, Ae, !1); + }, y.prototype.write = function(Ne, pe, Ae, it) { + if (pe === void 0) + it = "utf8", Ae = this.length, pe = 0; + else if (Ae === void 0 && typeof pe == "string") + it = pe, Ae = this.length, pe = 0; + else if (isFinite(pe)) + pe >>>= 0, isFinite(Ae) ? (Ae >>>= 0, it === void 0 && (it = "utf8")) : (it = Ae, Ae = void 0); + else + throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); + var yt = this.length - pe; + if ((Ae === void 0 || Ae > yt) && (Ae = yt), 0 < Ne.length && (0 > Ae || 0 > pe) || pe > this.length) + throw new RangeError("Attempt to write outside buffer bounds"); + it || (it = "utf8"); + for (var He = !1; ; ) + switch (it) { + case "hex": + return be(this, Ne, pe, Ae); + case "utf8": + case "utf-8": + return Se(this, Ne, pe, Ae); + case "ascii": + return Me(this, Ne, pe, Ae); + case "latin1": + case "binary": + return ke(this, Ne, pe, Ae); + case "base64": + return J(this, Ne, pe, Ae); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return ce(this, Ne, pe, Ae); + default: + if (He) + throw new TypeError("Unknown encoding: " + it); + it = ("" + it).toLowerCase(), He = !0; + } + }, y.prototype.toJSON = function() { + return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; + }, y.prototype.slice = function(Ne, pe) { + var Ae = this.length; + Ne = ~~Ne, pe = pe === void 0 ? Ae : ~~pe, 0 > Ne ? (Ne += Ae, 0 > Ne && (Ne = 0)) : Ne > Ae && (Ne = Ae), 0 > pe ? (pe += Ae, 0 > pe && (pe = 0)) : pe > Ae && (pe = Ae), pe < Ne && (pe = Ne); + var it = this.subarray(Ne, pe); + return it.__proto__ = y.prototype, it; + }, y.prototype.readUIntLE = function(Ne, pe, Ae) { + Ne >>>= 0, pe >>>= 0, Ae || Qe(Ne, pe, this.length); + for (var it = this[Ne], yt = 1, He = 0; ++He < pe && (yt *= 256); ) + it += this[Ne + He] * yt; + return it; + }, y.prototype.readUIntBE = function(Ne, pe, Ae) { + Ne >>>= 0, pe >>>= 0, Ae || Qe(Ne, pe, this.length); + for (var it = this[Ne + --pe], yt = 1; 0 < pe && (yt *= 256); ) + it += this[Ne + --pe] * yt; + return it; + }, y.prototype.readUInt8 = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 1, this.length), this[Ne]; + }, y.prototype.readUInt16LE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 2, this.length), this[Ne] | this[Ne + 1] << 8; + }, y.prototype.readUInt16BE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 2, this.length), this[Ne] << 8 | this[Ne + 1]; + }, y.prototype.readUInt32LE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), (this[Ne] | this[Ne + 1] << 8 | this[Ne + 2] << 16) + 16777216 * this[Ne + 3]; + }, y.prototype.readUInt32BE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), 16777216 * this[Ne] + (this[Ne + 1] << 16 | this[Ne + 2] << 8 | this[Ne + 3]); + }, y.prototype.readIntLE = function(Ne, pe, Ae) { + Ne >>>= 0, pe >>>= 0, Ae || Qe(Ne, pe, this.length); + for (var it = this[Ne], yt = 1, He = 0; ++He < pe && (yt *= 256); ) + it += this[Ne + He] * yt; + return yt *= 128, it >= yt && (it -= s(2, 8 * pe)), it; + }, y.prototype.readIntBE = function(Ne, pe, Ae) { + Ne >>>= 0, pe >>>= 0, Ae || Qe(Ne, pe, this.length); + for (var it = pe, yt = 1, He = this[Ne + --it]; 0 < it && (yt *= 256); ) + He += this[Ne + --it] * yt; + return yt *= 128, He >= yt && (He -= s(2, 8 * pe)), He; + }, y.prototype.readInt8 = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 1, this.length), 128 & this[Ne] ? -1 * (255 - this[Ne] + 1) : this[Ne]; + }, y.prototype.readInt16LE = function(Ne, pe) { + Ne >>>= 0, pe || Qe(Ne, 2, this.length); + var Ae = this[Ne] | this[Ne + 1] << 8; + return 32768 & Ae ? 4294901760 | Ae : Ae; + }, y.prototype.readInt16BE = function(Ne, pe) { + Ne >>>= 0, pe || Qe(Ne, 2, this.length); + var Ae = this[Ne + 1] | this[Ne] << 8; + return 32768 & Ae ? 4294901760 | Ae : Ae; + }, y.prototype.readInt32LE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), this[Ne] | this[Ne + 1] << 8 | this[Ne + 2] << 16 | this[Ne + 3] << 24; + }, y.prototype.readInt32BE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), this[Ne] << 24 | this[Ne + 1] << 16 | this[Ne + 2] << 8 | this[Ne + 3]; + }, y.prototype.readFloatLE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), ct.read(this, Ne, !0, 23, 4); + }, y.prototype.readFloatBE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 4, this.length), ct.read(this, Ne, !1, 23, 4); + }, y.prototype.readDoubleLE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 8, this.length), ct.read(this, Ne, !0, 52, 8); + }, y.prototype.readDoubleBE = function(Ne, pe) { + return Ne >>>= 0, pe || Qe(Ne, 8, this.length), ct.read(this, Ne, !1, 52, 8); + }, y.prototype.writeUIntLE = function(Ne, pe, Ae, it) { + if (Ne = +Ne, pe >>>= 0, Ae >>>= 0, !it) { + var yt = s(2, 8 * Ae) - 1; + tt(this, Ne, pe, Ae, yt, 0); + } + var He = 1, Ft = 0; + for (this[pe] = 255 & Ne; ++Ft < Ae && (He *= 256); ) + this[pe + Ft] = 255 & Ne / He; + return pe + Ae; + }, y.prototype.writeUIntBE = function(Ne, pe, Ae, it) { + if (Ne = +Ne, pe >>>= 0, Ae >>>= 0, !it) { + var yt = s(2, 8 * Ae) - 1; + tt(this, Ne, pe, Ae, yt, 0); + } + var He = Ae - 1, Ft = 1; + for (this[pe + He] = 255 & Ne; 0 <= --He && (Ft *= 256); ) + this[pe + He] = 255 & Ne / Ft; + return pe + Ae; + }, y.prototype.writeUInt8 = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 1, 255, 0), this[pe] = 255 & Ne, pe + 1; + }, y.prototype.writeUInt16LE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 2, 65535, 0), this[pe] = 255 & Ne, this[pe + 1] = Ne >>> 8, pe + 2; + }, y.prototype.writeUInt16BE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 2, 65535, 0), this[pe] = Ne >>> 8, this[pe + 1] = 255 & Ne, pe + 2; + }, y.prototype.writeUInt32LE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 4, 4294967295, 0), this[pe + 3] = Ne >>> 24, this[pe + 2] = Ne >>> 16, this[pe + 1] = Ne >>> 8, this[pe] = 255 & Ne, pe + 4; + }, y.prototype.writeUInt32BE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 4, 4294967295, 0), this[pe] = Ne >>> 24, this[pe + 1] = Ne >>> 16, this[pe + 2] = Ne >>> 8, this[pe + 3] = 255 & Ne, pe + 4; + }, y.prototype.writeIntLE = function(Ne, pe, Ae, it) { + if (Ne = +Ne, pe >>>= 0, !it) { + var yt = s(2, 8 * Ae - 1); + tt(this, Ne, pe, Ae, yt - 1, -yt); + } + var He = 0, Ft = 1, ei = 0; + for (this[pe] = 255 & Ne; ++He < Ae && (Ft *= 256); ) + 0 > Ne && ei === 0 && this[pe + He - 1] !== 0 && (ei = 1), this[pe + He] = 255 & (Ne / Ft >> 0) - ei; + return pe + Ae; + }, y.prototype.writeIntBE = function(Ne, pe, Ae, it) { + if (Ne = +Ne, pe >>>= 0, !it) { + var yt = s(2, 8 * Ae - 1); + tt(this, Ne, pe, Ae, yt - 1, -yt); + } + var He = Ae - 1, Ft = 1, ei = 0; + for (this[pe + He] = 255 & Ne; 0 <= --He && (Ft *= 256); ) + 0 > Ne && ei === 0 && this[pe + He + 1] !== 0 && (ei = 1), this[pe + He] = 255 & (Ne / Ft >> 0) - ei; + return pe + Ae; + }, y.prototype.writeInt8 = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 1, 127, -128), 0 > Ne && (Ne = 255 + Ne + 1), this[pe] = 255 & Ne, pe + 1; + }, y.prototype.writeInt16LE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 2, 32767, -32768), this[pe] = 255 & Ne, this[pe + 1] = Ne >>> 8, pe + 2; + }, y.prototype.writeInt16BE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 2, 32767, -32768), this[pe] = Ne >>> 8, this[pe + 1] = 255 & Ne, pe + 2; + }, y.prototype.writeInt32LE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 4, 2147483647, -2147483648), this[pe] = 255 & Ne, this[pe + 1] = Ne >>> 8, this[pe + 2] = Ne >>> 16, this[pe + 3] = Ne >>> 24, pe + 4; + }, y.prototype.writeInt32BE = function(Ne, pe, Ae) { + return Ne = +Ne, pe >>>= 0, Ae || tt(this, Ne, pe, 4, 2147483647, -2147483648), 0 > Ne && (Ne = 4294967295 + Ne + 1), this[pe] = Ne >>> 24, this[pe + 1] = Ne >>> 16, this[pe + 2] = Ne >>> 8, this[pe + 3] = 255 & Ne, pe + 4; + }, y.prototype.writeFloatLE = function(Ne, pe, Ae) { + return Mt(this, Ne, pe, !0, Ae); + }, y.prototype.writeFloatBE = function(Ne, pe, Ae) { + return Mt(this, Ne, pe, !1, Ae); + }, y.prototype.writeDoubleLE = function(Ne, pe, Ae) { + return kt(this, Ne, pe, !0, Ae); + }, y.prototype.writeDoubleBE = function(Ne, pe, Ae) { + return kt(this, Ne, pe, !1, Ae); + }, y.prototype.copy = function(Ne, pe, Ae, it) { + if (!y.isBuffer(Ne)) + throw new TypeError("argument should be a Buffer"); + if (Ae || (Ae = 0), it || it === 0 || (it = this.length), pe >= Ne.length && (pe = Ne.length), pe || (pe = 0), 0 < it && it < Ae && (it = Ae), it === Ae || Ne.length === 0 || this.length === 0) + return 0; + if (0 > pe) + throw new RangeError("targetStart out of bounds"); + if (0 > Ae || Ae >= this.length) + throw new RangeError("Index out of range"); + if (0 > it) + throw new RangeError("sourceEnd out of bounds"); + it > this.length && (it = this.length), Ne.length - pe < it - Ae && (it = Ne.length - pe + Ae); + var yt = it - Ae; + if (this === Ne && typeof Uint8Array.prototype.copyWithin == "function") + this.copyWithin(pe, Ae, it); + else if (this === Ne && Ae < pe && pe < it) + for (var He = yt - 1; 0 <= He; --He) + Ne[He + pe] = this[He + Ae]; + else + Uint8Array.prototype.set.call(Ne, this.subarray(Ae, it), pe); + return yt; + }, y.prototype.fill = function(Ne, pe, Ae, it) { + if (typeof Ne == "string") { + if (typeof pe == "string" ? (it = pe, pe = 0, Ae = this.length) : typeof Ae == "string" && (it = Ae, Ae = this.length), it !== void 0 && typeof it != "string") + throw new TypeError("encoding must be a string"); + if (typeof it == "string" && !y.isEncoding(it)) + throw new TypeError("Unknown encoding: " + it); + if (Ne.length === 1) { + var yt = Ne.charCodeAt(0); + (it === "utf8" && 128 > yt || it === "latin1") && (Ne = yt); + } + } else + typeof Ne == "number" && (Ne &= 255); + if (0 > pe || this.length < pe || this.length < Ae) + throw new RangeError("Out of range index"); + if (Ae <= pe) + return this; + pe >>>= 0, Ae = Ae === void 0 ? this.length : Ae >>> 0, Ne || (Ne = 0); + var He; + if (typeof Ne == "number") + for (He = pe; He < Ae; ++He) + this[He] = Ne; + else { + var Ft = y.isBuffer(Ne) ? Ne : y.from(Ne, it), ei = Ft.length; + if (ei === 0) + throw new TypeError('The value "' + Ne + '" is invalid for argument "value"'); + for (He = 0; He < Ae - pe; ++He) + this[He + pe] = Ft[He % ei]; + } + return this; + }; + var gt = /[^+/0-9A-Za-z-_]/g; + }).call(this); + }).call(this, l("buffer").Buffer); + }, { "base64-js": 6, buffer: 8, ieee754: 9 }], 9: [function(l, c, h) { + /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + h.read = function(p, y, v, x, I) { + var P = 8 * I - x - 1, F = (1 << P) - 1, k = F >> 1, V = -7, j = v ? I - 1 : 0, Y = v ? -1 : 1, X = p[y + j], Q, re; + for (j += Y, Q = X & (1 << -V) - 1, X >>= -V, V += P; 0 < V; Q = 256 * Q + p[y + j], j += Y, V -= 8) + ; + for (re = Q & (1 << -V) - 1, Q >>= -V, V += x; 0 < V; re = 256 * re + p[y + j], j += Y, V -= 8) + ; + if (Q === 0) + Q = 1 - k; + else { + if (Q === F) + return re ? NaN : (X ? -1 : 1) * (1 / 0); + re += s(2, x), Q -= k; + } + return (X ? -1 : 1) * re * s(2, Q - x); + }, h.write = function(p, y, v, x, I, P) { + var F = Math.LN2, k = 8 * P - I - 1, V = (1 << k) - 1, j = V >> 1, Y = I === 23 ? s(2, -24) - s(2, -77) : 0, X = x ? 0 : P - 1, Q = x ? 1 : -1, re = 0 > y || y === 0 && 0 > 1 / y ? 1 : 0, he, fe, be; + for (y = n(y), isNaN(y) || y === 1 / 0 ? (fe = isNaN(y) ? 1 : 0, he = V) : (he = i(r(y) / F), 1 > y * (be = s(2, -he)) && (he--, be *= 2), y += 1 <= he + j ? Y / be : Y * s(2, 1 - j), 2 <= y * be && (he++, be /= 2), he + j >= V ? (fe = 0, he = V) : 1 <= he + j ? (fe = (y * be - 1) * s(2, I), he += j) : (fe = y * s(2, j - 1) * s(2, I), he = 0)); 8 <= I; p[v + X] = 255 & fe, X += Q, fe /= 256, I -= 8) + ; + for (he = he << I | fe, k += I; 0 < k; p[v + X] = 255 & he, X += Q, he /= 256, k -= 8) + ; + p[v + X - Q] |= 128 * re; + }; + }, {}], 10: [function(l, c) { + (function(h) { + (function() { + function p() { + j = !0; + for (var Y = V.length, X, Q; Y; ) { + for (Q = V, V = [], X = -1; ++X < Y; ) + Q[X](); + Y = V.length; + } + j = !1; + } + function y(Y) { + V.push(Y) !== 1 || j || x(); + } + var v = h.MutationObserver || h.WebKitMutationObserver, x; + if (v) { + var I = 0, P = new v(p), F = h.document.createTextNode(""); + P.observe(F, { characterData: !0 }), x = function() { + F.data = I = ++I % 2; + }; + } else if (!h.setImmediate && typeof h.MessageChannel < "u") { + var k = new h.MessageChannel(); + k.port1.onmessage = p, x = function() { + k.port2.postMessage(0); + }; + } else + x = "document" in h && "onreadystatechange" in h.document.createElement("script") ? function() { + var Y = h.document.createElement("script"); + Y.onreadystatechange = function() { + p(), Y.onreadystatechange = null, Y.parentNode.removeChild(Y), Y = null; + }, h.document.documentElement.appendChild(Y); + } : function() { + setTimeout(p, 0); + }; + var V = [], j; + c.exports = y; + }).call(this); + }).call(this, typeof td > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : td); + }, {}], 11: [function(l, c, h) { + (function(p, y, v) { + (function() { + /*! + + JSZip v3.6.0 - A JavaScript class for generating and reading zip files + + + (c) 2009-2016 Stuart Knightley + Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + + JSZip uses the library pako released under the MIT license : + https://github.com/nodeca/pako/blob/master/LICENSE + */ + (function(x) { + typeof h == "object" && typeof c < "u" ? c.exports = x() : (typeof window > "u" ? typeof p > "u" ? typeof self > "u" ? this : self : p : window).JSZip = x(); + })(function() { + return function x(I, P, F) { + function k(Y, X) { + if (!P[Y]) { + if (!I[Y]) { + var Q = typeof l == "function" && l; + if (!X && Q) + return Q(Y, !0); + if (V) + return V(Y, !0); + var re = new Error("Cannot find module '" + Y + "'"); + throw re.code = "MODULE_NOT_FOUND", re; + } + var he = P[Y] = { exports: {} }; + I[Y][0].call(he.exports, function(fe) { + var be = I[Y][1][fe]; + return k(be || fe); + }, he, he.exports, x, I, P, F); + } + return P[Y].exports; + } + for (var V = typeof l == "function" && l, j = 0; j < F.length; j++) + k(F[j]); + return k; + }({ 1: [function(x, I, P) { + (function(F) { + (function(k) { + typeof P == "object" && I !== void 0 ? I.exports = k() : (typeof window > "u" ? F === void 0 ? typeof self > "u" ? this : self : F : window).JSZip = k(); + })(function() { + return function k(V, j, Y) { + function X(he, fe) { + if (!j[he]) { + if (!V[he]) { + var be = typeof x == "function" && x; + if (!fe && be) + return be(he, !0); + if (Q) + return Q(he, !0); + var Se = new Error("Cannot find module '" + he + "'"); + throw Se.code = "MODULE_NOT_FOUND", Se; + } + var Me = j[he] = { exports: {} }; + V[he][0].call(Me.exports, function(ke) { + return X(V[he][1][ke] || ke); + }, Me, Me.exports, k, V, j, Y); + } + return j[he].exports; + } + for (var Q = typeof x == "function" && x, re = 0; re < Y.length; re++) + X(Y[re]); + return X; + }({ 1: [function(k, V, j) { + (function(Y) { + (function(X) { + typeof j == "object" && V !== void 0 ? V.exports = X() : (typeof window > "u" ? Y === void 0 ? typeof self > "u" ? this : self : Y : window).JSZip = X(); + })(function() { + return function X(Q, re, he) { + function fe(Me, ke) { + if (!re[Me]) { + if (!Q[Me]) { + var J = typeof k == "function" && k; + if (!ke && J) + return J(Me, !0); + if (be) + return be(Me, !0); + var ce = new Error("Cannot find module '" + Me + "'"); + throw ce.code = "MODULE_NOT_FOUND", ce; + } + var xe = re[Me] = { exports: {} }; + Q[Me][0].call(xe.exports, function(Pe) { + return fe(Q[Me][1][Pe] || Pe); + }, xe, xe.exports, X, Q, re, he); + } + return re[Me].exports; + } + for (var be = typeof k == "function" && k, Se = 0; Se < he.length; Se++) + fe(he[Se]); + return fe; + }({ 1: [function(X, Q, re) { + (function(he) { + (function(fe) { + typeof re == "object" && Q !== void 0 ? Q.exports = fe() : (typeof window > "u" ? he === void 0 ? typeof self > "u" ? this : self : he : window).JSZip = fe(); + })(function() { + return function fe(be, Se, Me) { + function ke(xe, Pe) { + if (!Se[xe]) { + if (!be[xe]) { + var Oe = typeof X == "function" && X; + if (!Pe && Oe) + return Oe(xe, !0); + if (J) + return J(xe, !0); + var Re = new Error("Cannot find module '" + xe + "'"); + throw Re.code = "MODULE_NOT_FOUND", Re; + } + var Ge = Se[xe] = { exports: {} }; + be[xe][0].call(Ge.exports, function(je) { + return ke(be[xe][1][je] || je); + }, Ge, Ge.exports, fe, be, Se, Me); + } + return Se[xe].exports; + } + for (var J = typeof X == "function" && X, ce = 0; ce < Me.length; ce++) + ke(Me[ce]); + return ke; + }({ 1: [function(fe, be, Se) { + (function(Me) { + (function(ke) { + typeof Se == "object" && be !== void 0 ? be.exports = ke() : (typeof window > "u" ? Me === void 0 ? typeof self > "u" ? this : self : Me : window).JSZip = ke(); + })(function() { + return function ke(J, ce, xe) { + function Pe(Ge, je) { + if (!ce[Ge]) { + if (!J[Ge]) { + var et = typeof fe == "function" && fe; + if (!je && et) + return et(Ge, !0); + if (Oe) + return Oe(Ge, !0); + var Qe = new Error("Cannot find module '" + Ge + "'"); + throw Qe.code = "MODULE_NOT_FOUND", Qe; + } + var tt = ce[Ge] = { exports: {} }; + J[Ge][0].call(tt.exports, function(ft) { + return Pe(J[Ge][1][ft] || ft); + }, tt, tt.exports, ke, J, ce, xe); + } + return ce[Ge].exports; + } + for (var Oe = typeof fe == "function" && fe, Re = 0; Re < xe.length; Re++) + Pe(xe[Re]); + return Pe; + }({ 1: [function(ke, J, ce) { + (function(xe) { + (function(Pe) { + typeof ce == "object" && J !== void 0 ? J.exports = Pe() : (typeof window > "u" ? xe === void 0 ? typeof self > "u" ? this : self : xe : window).JSZip = Pe(); + })(function() { + return function Pe(Oe, Re, Ge) { + function je(tt, ft) { + if (!Re[tt]) { + if (!Oe[tt]) { + var Mt = typeof ke == "function" && ke; + if (!ft && Mt) + return Mt(tt, !0); + if (et) + return et(tt, !0); + var kt = new Error("Cannot find module '" + tt + "'"); + throw kt.code = "MODULE_NOT_FOUND", kt; + } + var Tt = Re[tt] = { exports: {} }; + Oe[tt][0].call(Tt.exports, function(It) { + return je(Oe[tt][1][It] || It); + }, Tt, Tt.exports, Pe, Oe, Re, Ge); + } + return Re[tt].exports; + } + for (var et = typeof ke == "function" && ke, Qe = 0; Qe < Ge.length; Qe++) + je(Ge[Qe]); + return je; + }({ 1: [function(Pe, Oe, Re) { + var Ge = Pe("./utils"), je = Pe("./support"); + Re.encode = function(et) { + for (var Qe = [], tt = 0, ft = et.length, Mt = ft, kt = Ge.getTypeOf(et) !== "string", Tt, It, Nt, nt, Ee, Be, at; tt < et.length; ) + Mt = ft - tt, Nt = kt ? (Tt = et[tt++], It = tt < ft ? et[tt++] : 0, tt < ft ? et[tt++] : 0) : (Tt = et.charCodeAt(tt++), It = tt < ft ? et.charCodeAt(tt++) : 0, tt < ft ? et.charCodeAt(tt++) : 0), nt = Tt >> 2, Ee = (3 & Tt) << 4 | It >> 4, Be = 1 < Mt ? (15 & It) << 2 | Nt >> 6 : 64, at = 2 < Mt ? 63 & Nt : 64, Qe.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(nt) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ee) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Be) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(at)); + return Qe.join(""); + }, Re.decode = function(et) { + var Qe = 0, tt = 0, ft, Mt, kt, Tt, It, Nt; + if (et.substr(0, 5) === "data:") + throw new Error("Invalid base64 input, it looks like a data url."); + var nt = 3 * (et = et.replace(/[^A-Za-z0-9\+\/\=]/g, "")).length / 4, Ee; + if (et.charAt(et.length - 1) === "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(64) && nt--, et.charAt(et.length - 2) === "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(64) && nt--, nt % 1 != 0) + throw new Error("Invalid base64 input, bad content length."); + for (Ee = je.uint8array ? new Uint8Array(0 | nt) : Array(0 | nt); Qe < et.length; ) + ft = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(et.charAt(Qe++)) << 2 | (Tt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(et.charAt(Qe++))) >> 4, Mt = (15 & Tt) << 4 | (It = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(et.charAt(Qe++))) >> 2, kt = (3 & It) << 6 | (Nt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(et.charAt(Qe++))), Ee[tt++] = ft, It !== 64 && (Ee[tt++] = Mt), Nt !== 64 && (Ee[tt++] = kt); + return Ee; + }; + }, { "./support": 30, "./utils": 32 }], 2: [function(Pe, Oe) { + function Re(tt, ft, Mt, kt, Tt) { + this.compressedSize = tt, this.uncompressedSize = ft, this.crc32 = Mt, this.compression = kt, this.compressedContent = Tt; + } + var Ge = Pe("./external"), je = Pe("./stream/DataWorker"), et = Pe("./stream/Crc32Probe"), Qe = Pe("./stream/DataLengthProbe"); + Re.prototype = { getContentWorker: function() { + var tt = new je(Ge.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Qe("data_length")), ft = this; + return tt.on("end", function() { + if (this.streamInfo.data_length !== ft.uncompressedSize) + throw new Error("Bug : uncompressed data size mismatch"); + }), tt; + }, getCompressedWorker: function() { + return new je(Ge.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); + } }, Re.createWorkerFrom = function(tt, ft, Mt) { + return tt.pipe(new et()).pipe(new Qe("uncompressedSize")).pipe(ft.compressWorker(Mt)).pipe(new Qe("compressedSize")).withStreamInfo("compression", ft); + }, Oe.exports = Re; + }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(Pe, Oe, Re) { + var Ge = Pe("./stream/GenericWorker"); + Re.STORE = { magic: "\0\0", compressWorker: function() { + return new Ge("STORE compression"); + }, uncompressWorker: function() { + return new Ge("STORE decompression"); + } }, Re.DEFLATE = Pe("./flate"); + }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(Pe, Oe) { + var Re = Pe("./utils"), Ge = function() { + for (var je = [], et = 0, Qe; 256 > et; et++) { + Qe = et; + for (var tt = 0; 8 > tt; tt++) + Qe = 1 & Qe ? 3988292384 ^ Qe >>> 1 : Qe >>> 1; + je[et] = Qe; + } + return je; + }(); + Oe.exports = function(je, et) { + return je !== void 0 && je.length ? Re.getTypeOf(je) === "string" ? function(Qe, tt, ft) { + Qe ^= -1; + for (var Mt = 0; Mt < 0 + ft; Mt++) + Qe = Qe >>> 8 ^ Ge[255 & (Qe ^ tt.charCodeAt(Mt))]; + return -1 ^ Qe; + }(0 | et, je, je.length) : function(Qe, tt, ft) { + Qe ^= -1; + for (var Mt = 0; Mt < 0 + ft; Mt++) + Qe = Qe >>> 8 ^ Ge[255 & (Qe ^ tt[Mt])]; + return -1 ^ Qe; + }(0 | et, je, je.length) : 0; + }; + }, { "./utils": 32 }], 5: [function(Pe, Oe, Re) { + Re.base64 = !1, Re.binary = !1, Re.dir = !1, Re.createFolders = !0, Re.date = null, Re.compression = null, Re.compressionOptions = null, Re.comment = null, Re.unixPermissions = null, Re.dosPermissions = null; + }, {}], 6: [function(Pe, Oe) { + var Re; + Re = typeof Promise > "u" ? Pe("lie") : Promise, Oe.exports = { Promise: Re }; + }, { lie: 37 }], 7: [function(Pe, Oe, Re) { + function Ge(Mt, kt) { + tt.call(this, "FlateWorker/" + Mt), this._pako = null, this._pakoAction = Mt, this._pakoOptions = kt, this.meta = {}; + } + var je = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", et = Pe("pako"), Qe = Pe("./utils"), tt = Pe("./stream/GenericWorker"), ft = je ? "uint8array" : "array"; + Re.magic = "\b\0", Qe.inherits(Ge, tt), Ge.prototype.processChunk = function(Mt) { + this.meta = Mt.meta, this._pako === null && this._createPako(), this._pako.push(Qe.transformTo(ft, Mt.data), !1); + }, Ge.prototype.flush = function() { + tt.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0); + }, Ge.prototype.cleanUp = function() { + tt.prototype.cleanUp.call(this), this._pako = null; + }, Ge.prototype._createPako = function() { + this._pako = new et[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 }); + var Mt = this; + this._pako.onData = function(kt) { + Mt.push({ data: kt, meta: Mt.meta }); + }; + }, Re.compressWorker = function(Mt) { + return new Ge("Deflate", Mt); + }, Re.uncompressWorker = function() { + return new Ge("Inflate", {}); + }; + }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(Pe, Oe) { + function Re(kt, Tt) { + var It = "", Nt; + for (Nt = 0; Nt < Tt; Nt++) + It += o(255 & kt), kt >>>= 8; + return It; + } + function Ge(kt, Tt, It, Nt, nt, Ee) { + var Be = kt.file, at = kt.compression, wt = Ee !== tt.utf8encode, st = et.transformTo("string", Ee(Be.name)), le = et.transformTo("string", tt.utf8encode(Be.name)), ct = Be.comment, gt = et.transformTo("string", Ee(ct)), Ne = et.transformTo("string", tt.utf8encode(ct)), pe = le.length !== Be.name.length, Ae = Ne.length !== ct.length, it = "", yt = "", He = "", Ft = Be.dir, ei = Be.date, mt = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }, Ue, si; + Tt && !It || (mt.crc32 = kt.crc32, mt.compressedSize = kt.compressedSize, mt.uncompressedSize = kt.uncompressedSize); + var A = 0; + Tt && (A |= 8), !wt && (pe || Ae) && (A |= 2048); + var ve = 0, H = 0, T; + Ft && (ve |= 16), nt === "UNIX" ? (H = 798, ve |= ((T = Be.unixPermissions) || (T = Ft ? 16893 : 33204), (65535 & T) << 16)) : (H = 20, ve |= 63 & (Be.dosPermissions || 0)), Ue = ei.getUTCHours(), Ue <<= 6, Ue |= ei.getUTCMinutes(), Ue <<= 5, Ue |= ei.getUTCSeconds() / 2, si = ei.getUTCFullYear() - 1980, si <<= 4, si |= ei.getUTCMonth() + 1, si <<= 5, si |= ei.getUTCDate(), pe && (it += "up" + Re((yt = Re(1, 1) + Re(ft(st), 4) + le).length, 2) + yt), Ae && (it += "uc" + Re((He = Re(1, 1) + Re(ft(gt), 4) + Ne).length, 2) + He); + var b = ""; + return b += ` +\0`, b += Re(A, 2), b += at.magic, b += Re(Ue, 2), b += Re(si, 2), b += Re(mt.crc32, 4), b += Re(mt.compressedSize, 4), b += Re(mt.uncompressedSize, 4), b += Re(st.length, 2), b += Re(it.length, 2), { fileRecord: Mt.LOCAL_FILE_HEADER + b + st + it, dirRecord: Mt.CENTRAL_FILE_HEADER + Re(H, 2) + b + Re(gt.length, 2) + "\0\0\0\0" + Re(ve, 4) + Re(Nt, 4) + st + it + gt }; + } + function je(kt, Tt, It, Nt) { + Qe.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = Tt, this.zipPlatform = It, this.encodeFileName = Nt, this.streamFiles = kt, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; + } + var et = Pe("../utils"), Qe = Pe("../stream/GenericWorker"), tt = Pe("../utf8"), ft = Pe("../crc32"), Mt = Pe("../signature"); + et.inherits(je, Qe), je.prototype.push = function(kt) { + var Tt = kt.meta.percent || 0, It = this.entriesCount, Nt = this._sources.length; + this.accumulate ? this.contentBuffer.push(kt) : (this.bytesWritten += kt.data.length, Qe.prototype.push.call(this, { data: kt.data, meta: { currentFile: this.currentFile, percent: It ? (Tt + 100 * (It - Nt - 1)) / It : 100 } })); + }, je.prototype.openedSource = function(kt) { + this.currentSourceOffset = this.bytesWritten, this.currentFile = kt.file.name; + var Tt = this.streamFiles && !kt.file.dir; + if (Tt) { + var It = Ge(kt, Tt, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); + this.push({ data: It.fileRecord, meta: { percent: 0 } }); + } else + this.accumulate = !0; + }, je.prototype.closedSource = function(kt) { + this.accumulate = !1; + var Tt = this.streamFiles && !kt.file.dir, It = Ge(kt, Tt, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName), Nt; + if (this.dirRecords.push(It.dirRecord), Tt) + this.push({ data: (Nt = kt, Mt.DATA_DESCRIPTOR + Re(Nt.crc32, 4) + Re(Nt.compressedSize, 4) + Re(Nt.uncompressedSize, 4)), meta: { percent: 100 } }); + else + for (this.push({ data: It.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) + this.push(this.contentBuffer.shift()); + this.currentFile = null; + }, je.prototype.flush = function() { + for (var kt = this.bytesWritten, Tt = 0; Tt < this.dirRecords.length; Tt++) + this.push({ data: this.dirRecords[Tt], meta: { percent: 100 } }); + var It = this.bytesWritten - kt, Nt = (nt = this.dirRecords.length, Ee = It, Be = kt, at = this.zipComment, wt = this.encodeFileName, st = et.transformTo("string", wt(at)), Mt.CENTRAL_DIRECTORY_END + "\0\0\0\0" + Re(nt, 2) + Re(nt, 2) + Re(Ee, 4) + Re(Be, 4) + Re(st.length, 2) + st), nt, Ee, Be, at, wt, st; + this.push({ data: Nt, meta: { percent: 100 } }); + }, je.prototype.prepareNextSource = function() { + this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); + }, je.prototype.registerPrevious = function(kt) { + this._sources.push(kt); + var Tt = this; + return kt.on("data", function(It) { + Tt.processChunk(It); + }), kt.on("end", function() { + Tt.closedSource(Tt.previous.streamInfo), Tt._sources.length ? Tt.prepareNextSource() : Tt.end(); + }), kt.on("error", function(It) { + Tt.error(It); + }), this; + }, je.prototype.resume = function() { + return !!Qe.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0)); + }, je.prototype.error = function(kt) { + var Tt = this._sources; + if (!Qe.prototype.error.call(this, kt)) + return !1; + for (var It = 0; It < Tt.length; It++) + try { + Tt[It].error(kt); + } catch { + } + return !0; + }, je.prototype.lock = function() { + Qe.prototype.lock.call(this); + for (var kt = this._sources, Tt = 0; Tt < kt.length; Tt++) + kt[Tt].lock(); + }, Oe.exports = je; + }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(Pe, Oe, Re) { + var Ge = Pe("../compressions"), je = Pe("./ZipFileWorker"); + Re.generateWorker = function(et, Qe, tt) { + var ft = new je(Qe.streamFiles, tt, Qe.platform, Qe.encodeFileName), Mt = 0; + try { + et.forEach(function(kt, Tt) { + Mt++; + var It = function(Be, at) { + var wt = Be || at, st = Ge[wt]; + if (!st) + throw new Error(wt + " is not a valid compression method !"); + return st; + }(Tt.options.compression, Qe.compression), Nt = Tt.options.compressionOptions || Qe.compressionOptions || {}, nt = Tt.dir, Ee = Tt.date; + Tt._compressWorker(It, Nt).withStreamInfo("file", { name: kt, dir: nt, date: Ee, comment: Tt.comment || "", unixPermissions: Tt.unixPermissions, dosPermissions: Tt.dosPermissions }).pipe(ft); + }), ft.entriesCount = Mt; + } catch (kt) { + ft.error(kt); + } + return ft; + }; + }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(Pe, Oe) { + function Re() { + if (!(this instanceof Re)) + return new Re(); + if (arguments.length) + throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); + this.files = {}, this.comment = null, this.root = "", this.clone = function() { + var Ge = new Re(); + for (var je in this) + typeof this[je] != "function" && (Ge[je] = this[je]); + return Ge; + }; + } + (Re.prototype = Pe("./object")).loadAsync = Pe("./load"), Re.support = Pe("./support"), Re.defaults = Pe("./defaults"), Re.version = "3.5.0", Re.loadAsync = function(Ge, je) { + return new Re().loadAsync(Ge, je); + }, Re.external = Pe("./external"), Oe.exports = Re; + }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(Pe, Oe) { + function Re(Mt) { + return new je.Promise(function(kt, Tt) { + var It = Mt.decompressed.getContentWorker().pipe(new tt()); + It.on("error", function(Nt) { + Tt(Nt); + }).on("end", function() { + It.streamInfo.crc32 === Mt.decompressed.crc32 ? kt() : Tt(new Error("Corrupted zip : CRC32 mismatch")); + }).resume(); + }); + } + var Ge = Pe("./utils"), je = Pe("./external"), et = Pe("./utf8"), Qe = Pe("./zipEntries"), tt = Pe("./stream/Crc32Probe"), ft = Pe("./nodejsUtils"); + Oe.exports = function(Mt, kt) { + var Tt = this; + return kt = Ge.extend(kt || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: et.utf8decode }), ft.isNode && ft.isStream(Mt) ? je.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : Ge.prepareContent("the loaded zip file", Mt, !0, kt.optimizedBinaryString, kt.base64).then(function(It) { + var Nt = new Qe(kt); + return Nt.load(It), Nt; + }).then(function(It) { + var Nt = [je.Promise.resolve(It)], nt = It.files; + if (kt.checkCRC32) + for (var Ee = 0; Ee < nt.length; Ee++) + Nt.push(Re(nt[Ee])); + return je.Promise.all(Nt); + }).then(function(It) { + for (var Nt = It.shift(), nt = Nt.files, Ee = 0, Be; Ee < nt.length; Ee++) + Be = nt[Ee], Tt.file(Be.fileNameStr, Be.decompressed, { binary: !0, optimizedBinaryString: !0, date: Be.date, dir: Be.dir, comment: Be.fileCommentStr.length ? Be.fileCommentStr : null, unixPermissions: Be.unixPermissions, dosPermissions: Be.dosPermissions, createFolders: kt.createFolders }); + return Nt.zipComment.length && (Tt.comment = Nt.zipComment), Tt; + }); + }; + }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(Pe, Oe) { + function Re(et, Qe) { + je.call(this, "Nodejs stream input adapter for " + et), this._upstreamEnded = !1, this._bindStream(Qe); + } + var Ge = Pe("../utils"), je = Pe("../stream/GenericWorker"); + Ge.inherits(Re, je), Re.prototype._bindStream = function(et) { + var Qe = this; + (this._stream = et).pause(), et.on("data", function(tt) { + Qe.push({ data: tt, meta: { percent: 0 } }); + }).on("error", function(tt) { + Qe.isPaused ? this.generatedError = tt : Qe.error(tt); + }).on("end", function() { + Qe.isPaused ? Qe._upstreamEnded = !0 : Qe.end(); + }); + }, Re.prototype.pause = function() { + return !!je.prototype.pause.call(this) && (this._stream.pause(), !0); + }, Re.prototype.resume = function() { + return !!je.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0); + }, Oe.exports = Re; + }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(Pe, Oe) { + function Re(je, et, Qe) { + Ge.call(this, et), this._helper = je; + var tt = this; + je.on("data", function(ft, Mt) { + tt.push(ft) || tt._helper.pause(), Qe && Qe(Mt); + }).on("error", function(ft) { + tt.emit("error", ft); + }).on("end", function() { + tt.push(null); + }); + } + var Ge = Pe("readable-stream").Readable; + Pe("../utils").inherits(Re, Ge), Re.prototype._read = function() { + this._helper.resume(); + }, Oe.exports = Re; + }, { "../utils": 32, "readable-stream": 16 }], 14: [function(Pe, Oe) { + Oe.exports = { isNode: typeof y < "u", newBufferFrom: function(Re, Ge) { + if (y.from && y.from !== Uint8Array.from) + return y.from(Re, Ge); + if (typeof Re == "number") + throw new Error('The "data" argument must not be a number'); + return new y(Re, Ge); + }, allocBuffer: function(Re) { + if (y.alloc) + return y.alloc(Re); + var Ge = new y(Re); + return Ge.fill(0), Ge; + }, isBuffer: function(Re) { + return y.isBuffer(Re); + }, isStream: function(Re) { + return Re && typeof Re.on == "function" && typeof Re.pause == "function" && typeof Re.resume == "function"; + } }; + }, {}], 15: [function(Pe, Oe) { + function Re(Be, at, wt) { + var st = Qe.getTypeOf(at), le = Qe.extend(wt || {}, Mt), ct; + le.date = le.date || /* @__PURE__ */ new Date(), le.compression !== null && (le.compression = le.compression.toUpperCase()), typeof le.unixPermissions == "string" && (le.unixPermissions = parseInt(le.unixPermissions, 8)), le.unixPermissions && 16384 & le.unixPermissions && (le.dir = !0), le.dosPermissions && 16 & le.dosPermissions && (le.dir = !0), le.dir && (Be = Ge(Be)), le.createFolders && (ct = function(Ae) { + Ae.slice(-1) === "/" && (Ae = Ae.substring(0, Ae.length - 1)); + var it = Ae.lastIndexOf("/"); + return 0 < it ? Ae.substring(0, it) : ""; + }(Be)) && Ee.call(this, ct, !0); + var gt = st === "string" && le.binary === !1 && le.base64 === !1, Ne; + wt && wt.binary !== void 0 || (le.binary = !gt), (at instanceof kt && at.uncompressedSize === 0 || le.dir || !at || at.length === 0) && (le.base64 = !1, le.binary = !0, at = "", le.compression = "STORE", st = "string"), Ne = at instanceof kt || at instanceof tt ? at : Nt.isNode && Nt.isStream(at) ? new nt(Be, at) : Qe.prepareContent(Be, at, le.binary, le.optimizedBinaryString, le.base64); + var pe = new Tt(Be, Ne, le); + this.files[Be] = pe; + } + function Ge(Be) { + return Be.slice(-1) !== "/" && (Be += "/"), Be; + } + function je(Be) { + return Object.prototype.toString.call(Be) === "[object RegExp]"; + } + var et = Pe("./utf8"), Qe = Pe("./utils"), tt = Pe("./stream/GenericWorker"), ft = Pe("./stream/StreamHelper"), Mt = Pe("./defaults"), kt = Pe("./compressedObject"), Tt = Pe("./zipObject"), It = Pe("./generate"), Nt = Pe("./nodejsUtils"), nt = Pe("./nodejs/NodejsStreamInputAdapter"), Ee = function(Be, at) { + return at = at === void 0 ? Mt.createFolders : at, Be = Ge(Be), this.files[Be] || Re.call(this, Be, null, { dir: !0, createFolders: at }), this.files[Be]; + }; + Oe.exports = { load: function() { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); + }, forEach: function(Be) { + var at, wt, st; + for (at in this.files) + this.files.hasOwnProperty(at) && (st = this.files[at], (wt = at.slice(this.root.length, at.length)) && at.slice(0, this.root.length) === this.root && Be(wt, st)); + }, filter: function(Be) { + var at = []; + return this.forEach(function(wt, st) { + Be(wt, st) && at.push(st); + }), at; + }, file: function(Be, at, wt) { + if (arguments.length !== 1) + return Be = this.root + Be, Re.call(this, Be, at, wt), this; + if (je(Be)) { + var st = Be; + return this.filter(function(ct, gt) { + return !gt.dir && st.test(ct); + }); + } + var le = this.files[this.root + Be]; + return le && !le.dir ? le : null; + }, folder: function(Be) { + if (!Be) + return this; + if (je(Be)) + return this.filter(function(le, ct) { + return ct.dir && Be.test(le); + }); + var at = this.root + Be, wt = Ee.call(this, at), st = this.clone(); + return st.root = wt.name, st; + }, remove: function(Be) { + Be = this.root + Be; + var at = this.files[Be]; + if (at || (Be.slice(-1) !== "/" && (Be += "/"), at = this.files[Be]), at && !at.dir) + delete this.files[Be]; + else + for (var wt = this.filter(function(le, ct) { + return ct.name.slice(0, Be.length) === Be; + }), st = 0; st < wt.length; st++) + delete this.files[wt[st].name]; + return this; + }, generate: function() { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); + }, generateInternalStream: function(Be) { + var at = {}, wt; + try { + if ((at = Qe.extend(Be || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: et.utf8encode })).type = at.type.toLowerCase(), at.compression = at.compression.toUpperCase(), at.type === "binarystring" && (at.type = "string"), !at.type) + throw new Error("No output type specified."); + Qe.checkSupport(at.type), at.platform !== "darwin" && at.platform !== "freebsd" && at.platform !== "linux" && at.platform !== "sunos" || (at.platform = "UNIX"), at.platform === "win32" && (at.platform = "DOS"); + var st = at.comment || this.comment || ""; + wt = It.generateWorker(this, at, st); + } catch (le) { + (wt = new tt("error")).error(le); + } + return new ft(wt, at.type || "string", at.mimeType); + }, generateAsync: function(Be, at) { + return this.generateInternalStream(Be).accumulate(at); + }, generateNodeStream: function(Be, at) { + return (Be = Be || {}).type || (Be.type = "nodebuffer"), this.generateInternalStream(Be).toNodejsStream(at); + } }; + }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(Pe, Oe) { + Oe.exports = Pe("stream"); + }, { stream: void 0 }], 17: [function(Pe, Oe) { + function Re(je) { + Ge.call(this, je); + for (var et = 0; et < this.data.length; et++) + je[et] = 255 & je[et]; + } + var Ge = Pe("./DataReader"); + Pe("../utils").inherits(Re, Ge), Re.prototype.byteAt = function(je) { + return this.data[this.zero + je]; + }, Re.prototype.lastIndexOfSignature = function(je) { + for (var et = je.charCodeAt(0), Qe = je.charCodeAt(1), tt = je.charCodeAt(2), ft = je.charCodeAt(3), Mt = this.length - 4; 0 <= Mt; --Mt) + if (this.data[Mt] === et && this.data[Mt + 1] === Qe && this.data[Mt + 2] === tt && this.data[Mt + 3] === ft) + return Mt - this.zero; + return -1; + }, Re.prototype.readAndCheckSignature = function(je) { + var et = je.charCodeAt(0), Qe = je.charCodeAt(1), tt = je.charCodeAt(2), ft = je.charCodeAt(3), Mt = this.readData(4); + return et === Mt[0] && Qe === Mt[1] && tt === Mt[2] && ft === Mt[3]; + }, Re.prototype.readData = function(je) { + if (this.checkOffset(je), je === 0) + return []; + var et = this.data.slice(this.zero + this.index, this.zero + this.index + je); + return this.index += je, et; + }, Oe.exports = Re; + }, { "../utils": 32, "./DataReader": 18 }], 18: [function(Pe, Oe) { + function Re(je) { + this.data = je, this.length = je.length, this.index = 0, this.zero = 0; + } + var Ge = Pe("../utils"); + Re.prototype = { checkOffset: function(je) { + this.checkIndex(this.index + je); + }, checkIndex: function(je) { + if (this.length < this.zero + je || 0 > je) + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + je + "). Corrupted zip ?"); + }, setIndex: function(je) { + this.checkIndex(je), this.index = je; + }, skip: function(je) { + this.setIndex(this.index + je); + }, byteAt: function() { + }, readInt: function(je) { + var et = 0, Qe; + for (this.checkOffset(je), Qe = this.index + je - 1; Qe >= this.index; Qe--) + et = (et << 8) + this.byteAt(Qe); + return this.index += je, et; + }, readString: function(je) { + return Ge.transformTo("string", this.readData(je)); + }, readData: function() { + }, lastIndexOfSignature: function() { + }, readAndCheckSignature: function() { + }, readDate: function() { + var je = this.readInt(4); + return new Date(Date.UTC(1980 + (127 & je >> 25), (15 & je >> 21) - 1, 31 & je >> 16, 31 & je >> 11, 63 & je >> 5, (31 & je) << 1)); + } }, Oe.exports = Re; + }, { "../utils": 32 }], 19: [function(Pe, Oe) { + function Re(je) { + Ge.call(this, je); + } + var Ge = Pe("./Uint8ArrayReader"); + Pe("../utils").inherits(Re, Ge), Re.prototype.readData = function(je) { + this.checkOffset(je); + var et = this.data.slice(this.zero + this.index, this.zero + this.index + je); + return this.index += je, et; + }, Oe.exports = Re; + }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(Pe, Oe) { + function Re(je) { + Ge.call(this, je); + } + var Ge = Pe("./DataReader"); + Pe("../utils").inherits(Re, Ge), Re.prototype.byteAt = function(je) { + return this.data.charCodeAt(this.zero + je); + }, Re.prototype.lastIndexOfSignature = function(je) { + return this.data.lastIndexOf(je) - this.zero; + }, Re.prototype.readAndCheckSignature = function(je) { + return je === this.readData(4); + }, Re.prototype.readData = function(je) { + this.checkOffset(je); + var et = this.data.slice(this.zero + this.index, this.zero + this.index + je); + return this.index += je, et; + }, Oe.exports = Re; + }, { "../utils": 32, "./DataReader": 18 }], 21: [function(Pe, Oe) { + function Re(je) { + Ge.call(this, je); + } + var Ge = Pe("./ArrayReader"); + Pe("../utils").inherits(Re, Ge), Re.prototype.readData = function(je) { + if (this.checkOffset(je), je === 0) + return new Uint8Array(0); + var et = this.data.subarray(this.zero + this.index, this.zero + this.index + je); + return this.index += je, et; + }, Oe.exports = Re; + }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(Pe, Oe) { + var Re = Pe("../utils"), Ge = Pe("../support"), je = Pe("./ArrayReader"), et = Pe("./StringReader"), Qe = Pe("./NodeBufferReader"), tt = Pe("./Uint8ArrayReader"); + Oe.exports = function(ft) { + var Mt = Re.getTypeOf(ft); + return Re.checkSupport(Mt), Mt !== "string" || Ge.uint8array ? Mt === "nodebuffer" ? new Qe(ft) : Ge.uint8array ? new tt(Re.transformTo("uint8array", ft)) : new je(Re.transformTo("array", ft)) : new et(ft); + }; + }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(Pe, Oe, Re) { + Re.LOCAL_FILE_HEADER = "PK", Re.CENTRAL_FILE_HEADER = "PK", Re.CENTRAL_DIRECTORY_END = "PK", Re.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", Re.ZIP64_CENTRAL_DIRECTORY_END = "PK", Re.DATA_DESCRIPTOR = "PK\x07\b"; + }, {}], 24: [function(Pe, Oe) { + function Re(et) { + Ge.call(this, "ConvertWorker to " + et), this.destType = et; + } + var Ge = Pe("./GenericWorker"), je = Pe("../utils"); + je.inherits(Re, Ge), Re.prototype.processChunk = function(et) { + this.push({ data: je.transformTo(this.destType, et.data), meta: et.meta }); + }, Oe.exports = Re; + }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(Pe, Oe) { + function Re() { + Ge.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); + } + var Ge = Pe("./GenericWorker"), je = Pe("../crc32"); + Pe("../utils").inherits(Re, Ge), Re.prototype.processChunk = function(et) { + this.streamInfo.crc32 = je(et.data, this.streamInfo.crc32 || 0), this.push(et); + }, Oe.exports = Re; + }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(Pe, Oe) { + function Re(et) { + je.call(this, "DataLengthProbe for " + et), this.propName = et, this.withStreamInfo(et, 0); + } + var Ge = Pe("../utils"), je = Pe("./GenericWorker"); + Ge.inherits(Re, je), Re.prototype.processChunk = function(et) { + if (et) { + var Qe = this.streamInfo[this.propName] || 0; + this.streamInfo[this.propName] = Qe + et.data.length; + } + je.prototype.processChunk.call(this, et); + }, Oe.exports = Re; + }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(Pe, Oe) { + function Re(et) { + je.call(this, "DataWorker"); + var Qe = this; + this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, et.then(function(tt) { + Qe.dataIsReady = !0, Qe.data = tt, Qe.max = tt && tt.length || 0, Qe.type = Ge.getTypeOf(tt), Qe.isPaused || Qe._tickAndRepeat(); + }, function(tt) { + Qe.error(tt); + }); + } + var Ge = Pe("../utils"), je = Pe("./GenericWorker"); + Ge.inherits(Re, je), Re.prototype.cleanUp = function() { + je.prototype.cleanUp.call(this), this.data = null; + }, Re.prototype.resume = function() { + return !!je.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, Ge.delay(this._tickAndRepeat, [], this)), !0); + }, Re.prototype._tickAndRepeat = function() { + this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (Ge.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0)); + }, Re.prototype._tick = function() { + if (this.isPaused || this.isFinished) + return !1; + var et = null, Qe = a(this.max, this.index + 16384); + if (this.index >= this.max) + return this.end(); + switch (this.type) { + case "string": + et = this.data.substring(this.index, Qe); + break; + case "uint8array": + et = this.data.subarray(this.index, Qe); + break; + case "array": + case "nodebuffer": + et = this.data.slice(this.index, Qe); + } + return this.index = Qe, this.push({ data: et, meta: { percent: this.max ? 100 * (this.index / this.max) : 0 } }); + }, Oe.exports = Re; + }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(Pe, Oe) { + function Re(Ge) { + this.name = Ge || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, this._listeners = { data: [], end: [], error: [] }, this.previous = null; + } + Re.prototype = { push: function(Ge) { + this.emit("data", Ge); + }, end: function() { + if (this.isFinished) + return !1; + this.flush(); + try { + this.emit("end"), this.cleanUp(), this.isFinished = !0; + } catch (Ge) { + this.emit("error", Ge); + } + return !0; + }, error: function(Ge) { + return !this.isFinished && (this.isPaused ? this.generatedError = Ge : (this.isFinished = !0, this.emit("error", Ge), this.previous && this.previous.error(Ge), this.cleanUp()), !0); + }, on: function(Ge, je) { + return this._listeners[Ge].push(je), this; + }, cleanUp: function() { + this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; + }, emit: function(Ge, je) { + if (this._listeners[Ge]) + for (var et = 0; et < this._listeners[Ge].length; et++) + this._listeners[Ge][et].call(this, je); + }, pipe: function(Ge) { + return Ge.registerPrevious(this); + }, registerPrevious: function(Ge) { + if (this.isLocked) + throw new Error("The stream '" + this + "' has already been used."); + this.streamInfo = Ge.streamInfo, this.mergeStreamInfo(), this.previous = Ge; + var je = this; + return Ge.on("data", function(et) { + je.processChunk(et); + }), Ge.on("end", function() { + je.end(); + }), Ge.on("error", function(et) { + je.error(et); + }), this; + }, pause: function() { + return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0); + }, resume: function() { + if (!this.isPaused || this.isFinished) + return !1; + var Ge = this.isPaused = !1; + return this.generatedError && (this.error(this.generatedError), Ge = !0), this.previous && this.previous.resume(), !Ge; + }, flush: function() { + }, processChunk: function(Ge) { + this.push(Ge); + }, withStreamInfo: function(Ge, je) { + return this.extraStreamInfo[Ge] = je, this.mergeStreamInfo(), this; + }, mergeStreamInfo: function() { + for (var Ge in this.extraStreamInfo) + this.extraStreamInfo.hasOwnProperty(Ge) && (this.streamInfo[Ge] = this.extraStreamInfo[Ge]); + }, lock: function() { + if (this.isLocked) + throw new Error("The stream '" + this + "' has already been used."); + this.isLocked = !0, this.previous && this.previous.lock(); + }, toString: function() { + var Ge = "Worker " + this.name; + return this.previous ? this.previous + " -> " + Ge : Ge; + } }, Oe.exports = Re; + }, {}], 29: [function(Pe, Oe) { + function Re(kt, Tt, It) { + var Nt = Tt; + Tt === "blob" || Tt === "arraybuffer" ? Nt = "uint8array" : Tt === "base64" && (Nt = "string"); + try { + this._internalType = Nt, this._outputType = Tt, this._mimeType = It, Ge.checkSupport(Nt), this._worker = kt.pipe(new je(Nt)), kt.lock(); + } catch (nt) { + this._worker = new et("error"), this._worker.error(nt); + } + } + var Ge = Pe("../utils"), je = Pe("./ConvertWorker"), et = Pe("./GenericWorker"), Qe = Pe("../base64"), tt = Pe("../support"), ft = Pe("../external"), Mt = null; + if (tt.nodestream) + try { + Mt = Pe("../nodejs/NodejsStreamOutputAdapter"); + } catch { + } + Re.prototype = { accumulate: function(kt) { + return Tt = this, It = kt, new ft.Promise(function(Nt, nt) { + var Ee = [], Be = Tt._internalType, at = Tt._outputType, wt = Tt._mimeType; + Tt.on("data", function(st, le) { + Ee.push(st), It && It(le); + }).on("error", function(st) { + Ee = [], nt(st); + }).on("end", function() { + try { + var st = function(le, ct, gt) { + return le === "blob" ? Ge.newBlob(Ge.transformTo("arraybuffer", ct), gt) : le === "base64" ? Qe.encode(ct) : Ge.transformTo(le, ct); + }(at, function(le, ct) { + var gt = 0, Ne = null, pe = 0, Ae; + for (Ae = 0; Ae < ct.length; Ae++) + pe += ct[Ae].length; + switch (le) { + case "string": + return ct.join(""); + case "array": + return Array.prototype.concat.apply([], ct); + case "uint8array": + for (Ne = new Uint8Array(pe), Ae = 0; Ae < ct.length; Ae++) + Ne.set(ct[Ae], gt), gt += ct[Ae].length; + return Ne; + case "nodebuffer": + return y.concat(ct); + default: + throw new Error("concat : unsupported type '" + le + "'"); + } + }(Be, Ee), wt); + Nt(st); + } catch (le) { + nt(le); + } + Ee = []; + }).resume(); + }); + var Tt, It; + }, on: function(kt, Tt) { + var It = this; + return kt === "data" ? this._worker.on(kt, function(Nt) { + Tt.call(It, Nt.data, Nt.meta); + }) : this._worker.on(kt, function() { + Ge.delay(Tt, arguments, It); + }), this; + }, resume: function() { + return Ge.delay(this._worker.resume, [], this._worker), this; + }, pause: function() { + return this._worker.pause(), this; + }, toNodejsStream: function(kt) { + if (Ge.checkSupport("nodestream"), this._outputType !== "nodebuffer") + throw new Error(this._outputType + " is not supported by this method"); + return new Mt(this, { objectMode: this._outputType !== "nodebuffer" }, kt); + } }, Oe.exports = Re; + }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(Pe, Oe, Re) { + if (Re.base64 = !0, Re.array = !0, Re.string = !0, Re.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", Re.nodebuffer = typeof y < "u", Re.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") + Re.blob = !1; + else { + var Ge = new ArrayBuffer(0); + try { + Re.blob = new Blob([Ge], { type: "application/zip" }).size === 0; + } catch { + try { + var je = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); + je.append(Ge), Re.blob = je.getBlob("application/zip").size === 0; + } catch { + Re.blob = !1; + } + } + } + try { + Re.nodestream = !!Pe("readable-stream").Readable; + } catch { + Re.nodestream = !1; + } + }, { "readable-stream": 16 }], 31: [function(Pe, Oe, Re) { + function Ge() { + ft.call(this, "utf-8 decode"), this.leftOver = null; + } + function je() { + ft.call(this, "utf-8 encode"); + } + for (var et = Pe("./utils"), Qe = Pe("./support"), tt = Pe("./nodejsUtils"), ft = Pe("./stream/GenericWorker"), Mt = Array(256), kt = 0; 256 > kt; kt++) + Mt[kt] = 252 <= kt ? 6 : 248 <= kt ? 5 : 240 <= kt ? 4 : 224 <= kt ? 3 : 192 <= kt ? 2 : 1; + Mt[254] = Mt[254] = 1, Re.utf8encode = function(Tt) { + return Qe.nodebuffer ? tt.newBufferFrom(Tt, "utf-8") : function(It) { + var Nt = It.length, nt = 0, Ee, Be, at, wt, st; + for (wt = 0; wt < Nt; wt++) + (64512 & (Be = It.charCodeAt(wt))) == 55296 && wt + 1 < Nt && (64512 & (at = It.charCodeAt(wt + 1))) == 56320 && (Be = 65536 + (Be - 55296 << 10) + (at - 56320), wt++), nt += 128 > Be ? 1 : 2048 > Be ? 2 : 65536 > Be ? 3 : 4; + for (Ee = Qe.uint8array ? new Uint8Array(nt) : Array(nt), wt = st = 0; st < nt; wt++) + (64512 & (Be = It.charCodeAt(wt))) == 55296 && wt + 1 < Nt && (64512 & (at = It.charCodeAt(wt + 1))) == 56320 && (Be = 65536 + (Be - 55296 << 10) + (at - 56320), wt++), 128 > Be ? Ee[st++] = Be : (2048 > Be ? Ee[st++] = 192 | Be >>> 6 : (65536 > Be ? Ee[st++] = 224 | Be >>> 12 : (Ee[st++] = 240 | Be >>> 18, Ee[st++] = 128 | 63 & Be >>> 12), Ee[st++] = 128 | 63 & Be >>> 6), Ee[st++] = 128 | 63 & Be); + return Ee; + }(Tt); + }, Re.utf8decode = function(Tt) { + return Qe.nodebuffer ? et.transformTo("nodebuffer", Tt).toString("utf-8") : function(It) { + var Nt = It.length, nt = Array(2 * Nt), Ee, Be, at, wt; + for (Ee = Be = 0; Ee < Nt; ) + if (128 > (at = It[Ee++])) + nt[Be++] = at; + else if (4 < (wt = Mt[at])) + nt[Be++] = 65533, Ee += wt - 1; + else { + for (at &= wt === 2 ? 31 : wt === 3 ? 15 : 7; 1 < wt && Ee < Nt; ) + at = at << 6 | 63 & It[Ee++], wt--; + 1 < wt ? nt[Be++] = 65533 : 65536 > at ? nt[Be++] = at : (at -= 65536, nt[Be++] = 55296 | 1023 & at >> 10, nt[Be++] = 56320 | 1023 & at); + } + return nt.length !== Be && (nt.subarray ? nt = nt.subarray(0, Be) : nt.length = Be), et.applyFromCharCode(nt); + }(Tt = et.transformTo(Qe.uint8array ? "uint8array" : "array", Tt)); + }, et.inherits(Ge, ft), Ge.prototype.processChunk = function(Tt) { + var It = et.transformTo(Qe.uint8array ? "uint8array" : "array", Tt.data); + if (this.leftOver && this.leftOver.length) { + if (Qe.uint8array) { + var Nt = It; + (It = new Uint8Array(Nt.length + this.leftOver.length)).set(this.leftOver, 0), It.set(Nt, this.leftOver.length); + } else + It = this.leftOver.concat(It); + this.leftOver = null; + } + var nt = function(Be, at) { + var wt; + for ((at = at || Be.length) > Be.length && (at = Be.length), wt = at - 1; 0 <= wt && (192 & Be[wt]) == 128; ) + wt--; + return 0 > wt || wt === 0 ? at : wt + Mt[Be[wt]] > at ? wt : at; + }(It), Ee = It; + nt !== It.length && (Qe.uint8array ? (Ee = It.subarray(0, nt), this.leftOver = It.subarray(nt, It.length)) : (Ee = It.slice(0, nt), this.leftOver = It.slice(nt, It.length))), this.push({ data: Re.utf8decode(Ee), meta: Tt.meta }); + }, Ge.prototype.flush = function() { + this.leftOver && this.leftOver.length && (this.push({ data: Re.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); + }, Re.Utf8DecodeWorker = Ge, et.inherits(je, ft), je.prototype.processChunk = function(Tt) { + this.push({ data: Re.utf8encode(Tt.data), meta: Tt.meta }); + }, Re.Utf8EncodeWorker = je; + }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(Pe, Oe, Re) { + function Ge(nt) { + return nt; + } + function je(nt, Ee) { + for (var Be = 0; Be < nt.length; ++Be) + Ee[Be] = 255 & nt.charCodeAt(Be); + return Ee; + } + function et(nt) { + var Ee = 65536, Be = Re.getTypeOf(nt), at = !0; + if (Be === "uint8array" ? at = It.applyCanBeUsed.uint8array : Be === "nodebuffer" && (at = It.applyCanBeUsed.nodebuffer), at) + for (; 1 < Ee; ) + try { + return It.stringifyByChunk(nt, Be, Ee); + } catch { + Ee = i(Ee / 2); + } + return It.stringifyByChar(nt); + } + function Qe(nt, Ee) { + for (var Be = 0; Be < nt.length; Be++) + Ee[Be] = nt[Be]; + return Ee; + } + var tt = Pe("./support"), ft = Pe("./base64"), Mt = Pe("./nodejsUtils"), kt = Pe("set-immediate-shim"), Tt = Pe("./external"); + Re.newBlob = function(nt, Ee) { + Re.checkSupport("blob"); + try { + return new Blob([nt], { type: Ee }); + } catch { + try { + var Be = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); + return Be.append(nt), Be.getBlob(Ee); + } catch { + throw new Error("Bug : can't construct the Blob."); + } + } + }; + var It = { stringifyByChunk: function(nt, Ee, Be) { + var at = [], wt = 0, st = nt.length; + if (st <= Be) + return o.apply(null, nt); + for (; wt < st; ) + Ee === "array" || Ee === "nodebuffer" ? at.push(o.apply(null, nt.slice(wt, a(wt + Be, st)))) : at.push(o.apply(null, nt.subarray(wt, a(wt + Be, st)))), wt += Be; + return at.join(""); + }, stringifyByChar: function(nt) { + for (var Ee = "", Be = 0; Be < nt.length; Be++) + Ee += o(nt[Be]); + return Ee; + }, applyCanBeUsed: { uint8array: function() { + try { + return tt.uint8array && o.apply(null, new Uint8Array(1)).length === 1; + } catch { + return !1; + } + }(), nodebuffer: function() { + try { + return tt.nodebuffer && o.apply(null, Mt.allocBuffer(1)).length === 1; + } catch { + return !1; + } + }() } }; + Re.applyFromCharCode = et; + var Nt = {}; + Nt.string = { string: Ge, array: function(nt) { + return je(nt, Array(nt.length)); + }, arraybuffer: function(nt) { + return Nt.string.uint8array(nt).buffer; + }, uint8array: function(nt) { + return je(nt, new Uint8Array(nt.length)); + }, nodebuffer: function(nt) { + return je(nt, Mt.allocBuffer(nt.length)); + } }, Nt.array = { string: et, array: Ge, arraybuffer: function(nt) { + return new Uint8Array(nt).buffer; + }, uint8array: function(nt) { + return new Uint8Array(nt); + }, nodebuffer: function(nt) { + return Mt.newBufferFrom(nt); + } }, Nt.arraybuffer = { string: function(nt) { + return et(new Uint8Array(nt)); + }, array: function(nt) { + return Qe(new Uint8Array(nt), Array(nt.byteLength)); + }, arraybuffer: Ge, uint8array: function(nt) { + return new Uint8Array(nt); + }, nodebuffer: function(nt) { + return Mt.newBufferFrom(new Uint8Array(nt)); + } }, Nt.uint8array = { string: et, array: function(nt) { + return Qe(nt, Array(nt.length)); + }, arraybuffer: function(nt) { + return nt.buffer; + }, uint8array: Ge, nodebuffer: function(nt) { + return Mt.newBufferFrom(nt); + } }, Nt.nodebuffer = { string: et, array: function(nt) { + return Qe(nt, Array(nt.length)); + }, arraybuffer: function(nt) { + return Nt.nodebuffer.uint8array(nt).buffer; + }, uint8array: function(nt) { + return Qe(nt, new Uint8Array(nt.length)); + }, nodebuffer: Ge }, Re.transformTo = function(nt, Ee) { + if (Ee = Ee || "", !nt) + return Ee; + Re.checkSupport(nt); + var Be = Re.getTypeOf(Ee); + return Nt[Be][nt](Ee); + }, Re.getTypeOf = function(nt) { + return typeof nt == "string" ? "string" : Object.prototype.toString.call(nt) === "[object Array]" ? "array" : tt.nodebuffer && Mt.isBuffer(nt) ? "nodebuffer" : tt.uint8array && nt instanceof Uint8Array ? "uint8array" : tt.arraybuffer && nt instanceof ArrayBuffer ? "arraybuffer" : void 0; + }, Re.checkSupport = function(nt) { + if (!tt[nt.toLowerCase()]) + throw new Error(nt + " is not supported by this platform"); + }, Re.MAX_VALUE_16BITS = 65535, Re.MAX_VALUE_32BITS = -1, Re.pretty = function(nt) { + var Ee = "", Be, at; + for (at = 0; at < (nt || "").length; at++) + Ee += "\\x" + (16 > (Be = nt.charCodeAt(at)) ? "0" : "") + Be.toString(16).toUpperCase(); + return Ee; + }, Re.delay = function(nt, Ee, Be) { + kt(function() { + nt.apply(Be || null, Ee || []); + }); + }, Re.inherits = function(nt, Ee) { + function Be() { + } + Be.prototype = Ee.prototype, nt.prototype = new Be(); + }, Re.extend = function() { + var nt = {}, Ee, Be; + for (Ee = 0; Ee < arguments.length; Ee++) + for (Be in arguments[Ee]) + arguments[Ee].hasOwnProperty(Be) && nt[Be] === void 0 && (nt[Be] = arguments[Ee][Be]); + return nt; + }, Re.prepareContent = function(nt, Ee, Be, at, wt) { + return Tt.Promise.resolve(Ee).then(function(st) { + return tt.blob && (st instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(st)) !== -1) && typeof FileReader < "u" ? new Tt.Promise(function(le, ct) { + var gt = new FileReader(); + gt.onload = function(Ne) { + le(Ne.target.result); + }, gt.onerror = function(Ne) { + ct(Ne.target.error); + }, gt.readAsArrayBuffer(st); + }) : st; + }).then(function(st) { + var le = Re.getTypeOf(st), ct; + return le ? (le === "arraybuffer" ? st = Re.transformTo("uint8array", st) : le === "string" && (wt ? st = ft.decode(st) : Be && at !== !0 && (st = je(ct = st, tt.uint8array ? new Uint8Array(ct.length) : Array(ct.length)))), st) : Tt.Promise.reject(new Error("Can't read the data of '" + nt + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); + }); + }; + }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, "set-immediate-shim": 54 }], 33: [function(Pe, Oe) { + function Re(ft) { + this.files = [], this.loadOptions = ft; + } + var Ge = Pe("./reader/readerFor"), je = Pe("./utils"), et = Pe("./signature"), Qe = Pe("./zipEntry"), tt = (Pe("./utf8"), Pe("./support")); + Re.prototype = { checkSignature: function(ft) { + if (!this.reader.readAndCheckSignature(ft)) { + this.reader.index -= 4; + var Mt = this.reader.readString(4); + throw new Error("Corrupted zip or bug: unexpected signature (" + je.pretty(Mt) + ", expected " + je.pretty(ft) + ")"); + } + }, isSignature: function(ft, Mt) { + var kt = this.reader.index; + this.reader.setIndex(ft); + var Tt = this.reader.readString(4) === Mt; + return this.reader.setIndex(kt), Tt; + }, readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); + var ft = this.reader.readData(this.zipCommentLength), Mt = tt.uint8array ? "uint8array" : "array", kt = je.transformTo(Mt, ft); + this.zipComment = this.loadOptions.decodeFileName(kt); + }, readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; + for (var ft = this.zip64EndOfCentralSize - 44, Mt, kt, Tt; 0 < ft; ) + Mt = this.reader.readInt(2), kt = this.reader.readInt(4), Tt = this.reader.readData(kt), this.zip64ExtensibleData[Mt] = { id: Mt, length: kt, value: Tt }; + }, readBlockZip64EndOfCentralLocator: function() { + if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) + throw new Error("Multi-volumes zip are not supported"); + }, readLocalFiles: function() { + var ft, Mt; + for (ft = 0; ft < this.files.length; ft++) + Mt = this.files[ft], this.reader.setIndex(Mt.localHeaderOffset), this.checkSignature(et.LOCAL_FILE_HEADER), Mt.readLocalPart(this.reader), Mt.handleUTF8(), Mt.processAttributes(); + }, readCentralDir: function() { + var ft; + for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(et.CENTRAL_FILE_HEADER); ) + (ft = new Qe({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(ft); + if (this.centralDirRecords !== this.files.length && this.centralDirRecords !== 0 && this.files.length === 0) + throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); + }, readEndOfCentral: function() { + var ft = this.reader.lastIndexOfSignature(et.CENTRAL_DIRECTORY_END); + if (0 > ft) + throw this.isSignature(0, et.LOCAL_FILE_HEADER) ? new Error("Corrupted zip: can't find end of central directory") : new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); + this.reader.setIndex(ft); + var Mt = ft; + if (this.checkSignature(et.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === je.MAX_VALUE_16BITS || this.diskWithCentralDirStart === je.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === je.MAX_VALUE_16BITS || this.centralDirRecords === je.MAX_VALUE_16BITS || this.centralDirSize === je.MAX_VALUE_32BITS || this.centralDirOffset === je.MAX_VALUE_32BITS) { + if (this.zip64 = !0, 0 > (ft = this.reader.lastIndexOfSignature(et.ZIP64_CENTRAL_DIRECTORY_LOCATOR))) + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); + if (this.reader.setIndex(ft), this.checkSignature(et.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, et.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(et.ZIP64_CENTRAL_DIRECTORY_END), 0 > this.relativeOffsetEndOfZip64CentralDir)) + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(et.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); + } + var kt = this.centralDirOffset + this.centralDirSize; + this.zip64 && (kt += 20, kt += 12 + this.zip64EndOfCentralSize); + var Tt = Mt - kt; + if (0 < Tt) + this.isSignature(Mt, et.CENTRAL_FILE_HEADER) || (this.reader.zero = Tt); + else if (0 > Tt) + throw new Error("Corrupted zip: missing " + n(Tt) + " bytes."); + }, prepareReader: function(ft) { + this.reader = Ge(ft); + }, load: function(ft) { + this.prepareReader(ft), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); + } }, Oe.exports = Re; + }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utf8": 31, "./utils": 32, "./zipEntry": 34 }], 34: [function(Pe, Oe) { + function Re(kt, Tt) { + this.options = kt, this.loadOptions = Tt; + } + var Ge = Pe("./reader/readerFor"), je = Pe("./utils"), et = Pe("./compressedObject"), Qe = Pe("./crc32"), tt = Pe("./utf8"), ft = Pe("./compressions"), Mt = Pe("./support"); + Re.prototype = { isEncrypted: function() { + return (1 & this.bitFlag) == 1; + }, useUTF8: function() { + return (2048 & this.bitFlag) == 2048; + }, readLocalPart: function(kt) { + var Tt, It; + if (kt.skip(22), this.fileNameLength = kt.readInt(2), It = kt.readInt(2), this.fileName = kt.readData(this.fileNameLength), kt.skip(It), this.compressedSize === -1 || this.uncompressedSize === -1) + throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); + if ((Tt = function(Nt) { + for (var nt in ft) + if (ft.hasOwnProperty(nt) && ft[nt].magic === Nt) + return ft[nt]; + return null; + }(this.compressionMethod)) === null) + throw new Error("Corrupted zip : compression " + je.pretty(this.compressionMethod) + " unknown (inner file : " + je.transformTo("string", this.fileName) + ")"); + this.decompressed = new et(this.compressedSize, this.uncompressedSize, this.crc32, Tt, kt.readData(this.compressedSize)); + }, readCentralPart: function(kt) { + this.versionMadeBy = kt.readInt(2), kt.skip(2), this.bitFlag = kt.readInt(2), this.compressionMethod = kt.readString(2), this.date = kt.readDate(), this.crc32 = kt.readInt(4), this.compressedSize = kt.readInt(4), this.uncompressedSize = kt.readInt(4); + var Tt = kt.readInt(2); + if (this.extraFieldsLength = kt.readInt(2), this.fileCommentLength = kt.readInt(2), this.diskNumberStart = kt.readInt(2), this.internalFileAttributes = kt.readInt(2), this.externalFileAttributes = kt.readInt(4), this.localHeaderOffset = kt.readInt(4), this.isEncrypted()) + throw new Error("Encrypted zip are not supported"); + kt.skip(Tt), this.readExtraFields(kt), this.parseZIP64ExtraField(kt), this.fileComment = kt.readData(this.fileCommentLength); + }, processAttributes: function() { + this.unixPermissions = null, this.dosPermissions = null; + var kt = this.versionMadeBy >> 8; + this.dir = !!(16 & this.externalFileAttributes), kt == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), kt == 3 && (this.unixPermissions = 65535 & this.externalFileAttributes >> 16), this.dir || this.fileNameStr.slice(-1) !== "/" || (this.dir = !0); + }, parseZIP64ExtraField: function() { + if (this.extraFields[1]) { + var kt = Ge(this.extraFields[1].value); + this.uncompressedSize === je.MAX_VALUE_32BITS && (this.uncompressedSize = kt.readInt(8)), this.compressedSize === je.MAX_VALUE_32BITS && (this.compressedSize = kt.readInt(8)), this.localHeaderOffset === je.MAX_VALUE_32BITS && (this.localHeaderOffset = kt.readInt(8)), this.diskNumberStart === je.MAX_VALUE_32BITS && (this.diskNumberStart = kt.readInt(4)); + } + }, readExtraFields: function(kt) { + var Tt = kt.index + this.extraFieldsLength, It, Nt, nt; + for (this.extraFields || (this.extraFields = {}); kt.index + 4 < Tt; ) + It = kt.readInt(2), Nt = kt.readInt(2), nt = kt.readData(Nt), this.extraFields[It] = { id: It, length: Nt, value: nt }; + kt.setIndex(Tt); + }, handleUTF8: function() { + var kt = Mt.uint8array ? "uint8array" : "array"; + if (this.useUTF8()) + this.fileNameStr = tt.utf8decode(this.fileName), this.fileCommentStr = tt.utf8decode(this.fileComment); + else { + var Tt = this.findExtraFieldUnicodePath(); + if (Tt !== null) + this.fileNameStr = Tt; + else { + var It = je.transformTo(kt, this.fileName); + this.fileNameStr = this.loadOptions.decodeFileName(It); + } + var Nt = this.findExtraFieldUnicodeComment(); + if (Nt !== null) + this.fileCommentStr = Nt; + else { + var nt = je.transformTo(kt, this.fileComment); + this.fileCommentStr = this.loadOptions.decodeFileName(nt); + } + } + }, findExtraFieldUnicodePath: function() { + var kt = this.extraFields[28789]; + if (kt) { + var Tt = Ge(kt.value); + return Tt.readInt(1) === 1 && Qe(this.fileName) === Tt.readInt(4) ? tt.utf8decode(Tt.readData(kt.length - 5)) : null; + } + return null; + }, findExtraFieldUnicodeComment: function() { + var kt = this.extraFields[25461]; + if (kt) { + var Tt = Ge(kt.value); + return Tt.readInt(1) === 1 && Qe(this.fileComment) === Tt.readInt(4) ? tt.utf8decode(Tt.readData(kt.length - 5)) : null; + } + return null; + } }, Oe.exports = Re; + }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(Pe, Oe) { + function Re(Tt, It, Nt) { + this.name = Tt, this.dir = Nt.dir, this.date = Nt.date, this.comment = Nt.comment, this.unixPermissions = Nt.unixPermissions, this.dosPermissions = Nt.dosPermissions, this._data = It, this._dataBinary = Nt.binary, this.options = { compression: Nt.compression, compressionOptions: Nt.compressionOptions }; + } + var Ge = Pe("./stream/StreamHelper"), je = Pe("./stream/DataWorker"), et = Pe("./utf8"), Qe = Pe("./compressedObject"), tt = Pe("./stream/GenericWorker"); + Re.prototype = { internalStream: function(Tt) { + var It = null, Nt = "string"; + try { + if (!Tt) + throw new Error("No output type specified."); + var nt = (Nt = Tt.toLowerCase()) === "string" || Nt === "text"; + Nt !== "binarystring" && Nt !== "text" || (Nt = "string"), It = this._decompressWorker(); + var Ee = !this._dataBinary; + Ee && !nt && (It = It.pipe(new et.Utf8EncodeWorker())), !Ee && nt && (It = It.pipe(new et.Utf8DecodeWorker())); + } catch (Be) { + (It = new tt("error")).error(Be); + } + return new Ge(It, Nt, ""); + }, async: function(Tt, It) { + return this.internalStream(Tt).accumulate(It); + }, nodeStream: function(Tt, It) { + return this.internalStream(Tt || "nodebuffer").toNodejsStream(It); + }, _compressWorker: function(Tt, It) { + if (this._data instanceof Qe && this._data.compression.magic === Tt.magic) + return this._data.getCompressedWorker(); + var Nt = this._decompressWorker(); + return this._dataBinary || (Nt = Nt.pipe(new et.Utf8EncodeWorker())), Qe.createWorkerFrom(Nt, Tt, It); + }, _decompressWorker: function() { + return this._data instanceof Qe ? this._data.getContentWorker() : this._data instanceof tt ? this._data : new je(this._data); + } }; + for (var ft = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], Mt = function() { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); + }, kt = 0; kt < ft.length; kt++) + Re.prototype[ft[kt]] = Mt; + Oe.exports = Re; + }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(Pe, Oe) { + (function(Re) { + function Ge() { + var It, Nt; + Qe = !0; + for (var nt = Tt.length; nt; ) { + for (Nt = Tt, Tt = [], It = -1; ++It < nt; ) + Nt[It](); + nt = Tt.length; + } + Qe = !1; + } + var je = Re.MutationObserver || Re.WebKitMutationObserver, et, Qe; + if (je) { + var tt = 0, ft = new je(Ge), Mt = Re.document.createTextNode(""); + ft.observe(Mt, { characterData: !0 }), et = function() { + Mt.data = tt = ++tt % 2; + }; + } else if (Re.setImmediate || Re.MessageChannel === void 0) + et = "document" in Re && "onreadystatechange" in Re.document.createElement("script") ? function() { + var It = Re.document.createElement("script"); + It.onreadystatechange = function() { + Ge(), It.onreadystatechange = null, It.parentNode.removeChild(It), It = null; + }, Re.document.documentElement.appendChild(It); + } : function() { + setTimeout(Ge, 0); + }; + else { + var kt = new Re.MessageChannel(); + kt.port1.onmessage = Ge, et = function() { + kt.port2.postMessage(0); + }; + } + var Tt = []; + Oe.exports = function(It) { + Tt.push(It) !== 1 || Qe || et(); + }; + }).call(this, xe === void 0 ? typeof self > "u" ? typeof window > "u" ? {} : window : self : xe); + }, {}], 37: [function(Pe, Oe) { + function Re() { + } + function Ge(nt) { + if (typeof nt != "function") + throw new TypeError("resolver must be a function"); + this.state = Nt, this.queue = [], this.outcome = void 0, nt !== Re && tt(this, nt); + } + function je(nt, Ee, Be) { + this.promise = nt, typeof Ee == "function" && (this.onFulfilled = Ee, this.callFulfilled = this.otherCallFulfilled), typeof Be == "function" && (this.onRejected = Be, this.callRejected = this.otherCallRejected); + } + function et(nt, Ee, Be) { + Mt(function() { + var at; + try { + at = Ee(Be); + } catch (wt) { + return kt.reject(nt, wt); + } + at === nt ? kt.reject(nt, new TypeError("Cannot resolve promise with itself")) : kt.resolve(nt, at); + }); + } + function Qe(nt) { + var Ee = nt && nt.then; + if (nt && (typeof nt == "object" || typeof nt == "function") && typeof Ee == "function") + return function() { + Ee.apply(nt, arguments); + }; + } + function tt(nt, Ee) { + function Be(le) { + wt || (wt = !0, kt.reject(nt, le)); + } + function at(le) { + wt || (wt = !0, kt.resolve(nt, le)); + } + var wt = !1, st = ft(function() { + Ee(at, Be); + }); + st.status === "error" && Be(st.value); + } + function ft(nt, Ee) { + var Be = {}; + try { + Be.value = nt(Ee), Be.status = "success"; + } catch (at) { + Be.status = "error", Be.value = at; + } + return Be; + } + var Mt = Pe("immediate"), kt = {}, Tt = ["REJECTED"], It = ["FULFILLED"], Nt = ["PENDING"]; + (Oe.exports = Ge).prototype.finally = function(nt) { + if (typeof nt != "function") + return this; + var Ee = this.constructor; + return this.then(function(Be) { + return Ee.resolve(nt()).then(function() { + return Be; + }); + }, function(Be) { + return Ee.resolve(nt()).then(function() { + throw Be; + }); + }); + }, Ge.prototype.catch = function(nt) { + return this.then(null, nt); + }, Ge.prototype.then = function(nt, Ee) { + if (typeof nt != "function" && this.state === It || typeof Ee != "function" && this.state === Tt) + return this; + var Be = new this.constructor(Re); + return this.state === Nt ? this.queue.push(new je(Be, nt, Ee)) : et(Be, this.state === It ? nt : Ee, this.outcome), Be; + }, je.prototype.callFulfilled = function(nt) { + kt.resolve(this.promise, nt); + }, je.prototype.otherCallFulfilled = function(nt) { + et(this.promise, this.onFulfilled, nt); + }, je.prototype.callRejected = function(nt) { + kt.reject(this.promise, nt); + }, je.prototype.otherCallRejected = function(nt) { + et(this.promise, this.onRejected, nt); + }, kt.resolve = function(nt, Ee) { + var Be = ft(Qe, Ee); + if (Be.status === "error") + return kt.reject(nt, Be.value); + var at = Be.value; + if (at) + tt(nt, at); + else { + nt.state = It, nt.outcome = Ee; + for (var wt = -1, st = nt.queue.length; ++wt < st; ) + nt.queue[wt].callFulfilled(Ee); + } + return nt; + }, kt.reject = function(nt, Ee) { + nt.state = Tt, nt.outcome = Ee; + for (var Be = -1, at = nt.queue.length; ++Be < at; ) + nt.queue[Be].callRejected(Ee); + return nt; + }, Ge.resolve = function(nt) { + return nt instanceof this ? nt : kt.resolve(new this(Re), nt); + }, Ge.reject = function(nt) { + var Ee = new this(Re); + return kt.reject(Ee, nt); + }, Ge.all = function(nt) { + function Ee(Ne, pe) { + Be.resolve(Ne).then(function(Ae) { + st[pe] = Ae, ++le !== at || wt || (wt = !0, kt.resolve(gt, st)); + }, function(Ae) { + wt || (wt = !0, kt.reject(gt, Ae)); + }); + } + var Be = this; + if (Object.prototype.toString.call(nt) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var at = nt.length, wt = !1; + if (!at) + return this.resolve([]); + for (var st = Array(at), le = 0, ct = -1, gt = new this(Re); ++ct < at; ) + Ee(nt[ct], ct); + return gt; + }, Ge.race = function(nt) { + if (Object.prototype.toString.call(nt) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var Ee = nt.length, Be = !1; + if (!Ee) + return this.resolve([]); + for (var at = -1, wt = new this(Re), st; ++at < Ee; ) + st = nt[at], this.resolve(st).then(function(le) { + Be || (Be = !0, kt.resolve(wt, le)); + }, function(le) { + Be || (Be = !0, kt.reject(wt, le)); + }); + return wt; + }; + }, { immediate: 36 }], 38: [function(Pe, Oe) { + var Re = {}; + (0, Pe("./lib/utils/common").assign)(Re, Pe("./lib/deflate"), Pe("./lib/inflate"), Pe("./lib/zlib/constants")), Oe.exports = Re; + }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(Pe, Oe, Re) { + function Ge(Tt) { + if (!(this instanceof Ge)) + return new Ge(Tt); + this.options = Qe.assign({ level: -1, method: 8, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: 0, to: "" }, Tt || {}); + var It = this.options; + It.raw && 0 < It.windowBits ? It.windowBits = -It.windowBits : It.gzip && 0 < It.windowBits && 16 > It.windowBits && (It.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Mt(), this.strm.avail_out = 0; + var Nt = et.deflateInit2(this.strm, It.level, It.method, It.windowBits, It.memLevel, It.strategy); + if (Nt !== 0) + throw new Error(ft[Nt]); + if (It.header && et.deflateSetHeader(this.strm, It.header), It.dictionary) { + var nt; + if (nt = typeof It.dictionary == "string" ? tt.string2buf(It.dictionary) : kt.call(It.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(It.dictionary) : It.dictionary, (Nt = et.deflateSetDictionary(this.strm, nt)) !== 0) + throw new Error(ft[Nt]); + this._dict_set = !0; + } + } + function je(Tt, It) { + var Nt = new Ge(It); + if (Nt.push(Tt, !0), Nt.err) + throw Nt.msg || ft[Nt.err]; + return Nt.result; + } + var et = Pe("./zlib/deflate"), Qe = Pe("./utils/common"), tt = Pe("./utils/strings"), ft = Pe("./zlib/messages"), Mt = Pe("./zlib/zstream"), kt = Object.prototype.toString; + Ge.prototype.push = function(Tt, It) { + var Nt = this.strm, nt = this.options.chunkSize, Ee, Be; + if (this.ended) + return !1; + Be = It === ~~It ? It : It === !0 ? 4 : 0, Nt.input = typeof Tt == "string" ? tt.string2buf(Tt) : kt.call(Tt) === "[object ArrayBuffer]" ? new Uint8Array(Tt) : Tt, Nt.next_in = 0, Nt.avail_in = Nt.input.length; + do { + if (Nt.avail_out === 0 && (Nt.output = new Qe.Buf8(nt), Nt.next_out = 0, Nt.avail_out = nt), (Ee = et.deflate(Nt, Be)) !== 1 && Ee !== 0) + return this.onEnd(Ee), !(this.ended = !0); + Nt.avail_out !== 0 && (Nt.avail_in !== 0 || Be !== 4 && Be !== 2) || (this.options.to === "string" ? this.onData(tt.buf2binstring(Qe.shrinkBuf(Nt.output, Nt.next_out))) : this.onData(Qe.shrinkBuf(Nt.output, Nt.next_out))); + } while ((0 < Nt.avail_in || Nt.avail_out === 0) && Ee !== 1); + return Be === 4 ? (Ee = et.deflateEnd(this.strm), this.onEnd(Ee), this.ended = !0, Ee === 0) : Be != 2 || (this.onEnd(0), !(Nt.avail_out = 0)); + }, Ge.prototype.onData = function(Tt) { + this.chunks.push(Tt); + }, Ge.prototype.onEnd = function(Tt) { + Tt === 0 && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = Qe.flattenChunks(this.chunks)), this.chunks = [], this.err = Tt, this.msg = this.strm.msg; + }, Re.Deflate = Ge, Re.deflate = je, Re.deflateRaw = function(Tt, It) { + return (It = It || {}).raw = !0, je(Tt, It); + }, Re.gzip = function(Tt, It) { + return (It = It || {}).gzip = !0, je(Tt, It); + }; + }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(Pe, Oe, Re) { + function Ge(Nt) { + if (!(this instanceof Ge)) + return new Ge(Nt); + this.options = Qe.assign({ chunkSize: 16384, windowBits: 0, to: "" }, Nt || {}); + var nt = this.options; + nt.raw && 0 <= nt.windowBits && 16 > nt.windowBits && (nt.windowBits = -nt.windowBits, nt.windowBits === 0 && (nt.windowBits = -15)), !(0 <= nt.windowBits && 16 > nt.windowBits) || Nt && Nt.windowBits || (nt.windowBits += 32), 15 < nt.windowBits && 48 > nt.windowBits && !(15 & nt.windowBits) && (nt.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new kt(), this.strm.avail_out = 0; + var Ee = et.inflateInit2(this.strm, nt.windowBits); + if (Ee !== ft.Z_OK) + throw new Error(Mt[Ee]); + this.header = new Tt(), et.inflateGetHeader(this.strm, this.header); + } + function je(Nt, nt) { + var Ee = new Ge(nt); + if (Ee.push(Nt, !0), Ee.err) + throw Ee.msg || Mt[Ee.err]; + return Ee.result; + } + var et = Pe("./zlib/inflate"), Qe = Pe("./utils/common"), tt = Pe("./utils/strings"), ft = Pe("./zlib/constants"), Mt = Pe("./zlib/messages"), kt = Pe("./zlib/zstream"), Tt = Pe("./zlib/gzheader"), It = Object.prototype.toString; + Ge.prototype.push = function(Nt, nt) { + var Ee = this.strm, Be = this.options.chunkSize, at = this.options.dictionary, wt = !1, st, le, ct, gt, Ne, pe; + if (this.ended) + return !1; + le = nt === ~~nt ? nt : nt === !0 ? ft.Z_FINISH : ft.Z_NO_FLUSH, Ee.input = typeof Nt == "string" ? tt.binstring2buf(Nt) : It.call(Nt) === "[object ArrayBuffer]" ? new Uint8Array(Nt) : Nt, Ee.next_in = 0, Ee.avail_in = Ee.input.length; + do { + if (Ee.avail_out === 0 && (Ee.output = new Qe.Buf8(Be), Ee.next_out = 0, Ee.avail_out = Be), (st = et.inflate(Ee, ft.Z_NO_FLUSH)) === ft.Z_NEED_DICT && at && (pe = typeof at == "string" ? tt.string2buf(at) : It.call(at) === "[object ArrayBuffer]" ? new Uint8Array(at) : at, st = et.inflateSetDictionary(this.strm, pe)), st === ft.Z_BUF_ERROR && wt === !0 && (st = ft.Z_OK, wt = !1), st !== ft.Z_STREAM_END && st !== ft.Z_OK) + return this.onEnd(st), !(this.ended = !0); + Ee.next_out && (Ee.avail_out !== 0 && st !== ft.Z_STREAM_END && (Ee.avail_in !== 0 || le !== ft.Z_FINISH && le !== ft.Z_SYNC_FLUSH) || (this.options.to === "string" ? (ct = tt.utf8border(Ee.output, Ee.next_out), gt = Ee.next_out - ct, Ne = tt.buf2string(Ee.output, ct), Ee.next_out = gt, Ee.avail_out = Be - gt, gt && Qe.arraySet(Ee.output, Ee.output, ct, gt, 0), this.onData(Ne)) : this.onData(Qe.shrinkBuf(Ee.output, Ee.next_out)))), Ee.avail_in === 0 && Ee.avail_out === 0 && (wt = !0); + } while ((0 < Ee.avail_in || Ee.avail_out === 0) && st !== ft.Z_STREAM_END); + return st === ft.Z_STREAM_END && (le = ft.Z_FINISH), le === ft.Z_FINISH ? (st = et.inflateEnd(this.strm), this.onEnd(st), this.ended = !0, st === ft.Z_OK) : le !== ft.Z_SYNC_FLUSH || (this.onEnd(ft.Z_OK), !(Ee.avail_out = 0)); + }, Ge.prototype.onData = function(Nt) { + this.chunks.push(Nt); + }, Ge.prototype.onEnd = function(Nt) { + Nt === ft.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = Qe.flattenChunks(this.chunks)), this.chunks = [], this.err = Nt, this.msg = this.strm.msg; + }, Re.Inflate = Ge, Re.inflate = je, Re.inflateRaw = function(Nt, nt) { + return (nt = nt || {}).raw = !0, je(Nt, nt); + }, Re.ungzip = je; + }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(Pe, Oe, Re) { + var Ge = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u"; + Re.assign = function(Qe) { + for (var tt = Array.prototype.slice.call(arguments, 1), ft; tt.length; ) + if (ft = tt.shift(), ft) { + if (typeof ft != "object") + throw new TypeError(ft + "must be non-object"); + for (var Mt in ft) + ft.hasOwnProperty(Mt) && (Qe[Mt] = ft[Mt]); + } + return Qe; + }, Re.shrinkBuf = function(Qe, tt) { + return Qe.length === tt ? Qe : Qe.subarray ? Qe.subarray(0, tt) : (Qe.length = tt, Qe); + }; + var je = { arraySet: function(Qe, tt, ft, Mt, kt) { + if (tt.subarray && Qe.subarray) + Qe.set(tt.subarray(ft, ft + Mt), kt); + else + for (var Tt = 0; Tt < Mt; Tt++) + Qe[kt + Tt] = tt[ft + Tt]; + }, flattenChunks: function(Qe) { + var tt, ft, Mt, kt, Tt, It; + for (tt = Mt = 0, ft = Qe.length; tt < ft; tt++) + Mt += Qe[tt].length; + for (It = new Uint8Array(Mt), tt = kt = 0, ft = Qe.length; tt < ft; tt++) + Tt = Qe[tt], It.set(Tt, kt), kt += Tt.length; + return It; + } }, et = { arraySet: function(Qe, tt, ft, Mt, kt) { + for (var Tt = 0; Tt < Mt; Tt++) + Qe[kt + Tt] = tt[ft + Tt]; + }, flattenChunks: function(Qe) { + return [].concat.apply([], Qe); + } }; + Re.setTyped = function(Qe) { + Qe ? (Re.Buf8 = Uint8Array, Re.Buf16 = Uint16Array, Re.Buf32 = Int32Array, Re.assign(Re, je)) : (Re.Buf8 = Array, Re.Buf16 = Array, Re.Buf32 = Array, Re.assign(Re, et)); + }, Re.setTyped(Ge); + }, {}], 42: [function(Pe, Oe, Re) { + function Ge(Mt, kt) { + if (65537 > kt && (Mt.subarray && Qe || !Mt.subarray && et)) + return o.apply(null, je.shrinkBuf(Mt, kt)); + for (var Tt = "", It = 0; It < kt; It++) + Tt += o(Mt[It]); + return Tt; + } + var je = Pe("./common"), et = !0, Qe = !0; + try { + o.apply(null, [0]); + } catch { + et = !1; + } + try { + o.apply(null, new Uint8Array(1)); + } catch { + Qe = !1; + } + for (var tt = new je.Buf8(256), ft = 0; 256 > ft; ft++) + tt[ft] = 252 <= ft ? 6 : 248 <= ft ? 5 : 240 <= ft ? 4 : 224 <= ft ? 3 : 192 <= ft ? 2 : 1; + tt[254] = tt[254] = 1, Re.string2buf = function(Mt) { + var kt = Mt.length, Tt = 0, It, Nt, nt, Ee, Be; + for (Ee = 0; Ee < kt; Ee++) + (64512 & (Nt = Mt.charCodeAt(Ee))) == 55296 && Ee + 1 < kt && (64512 & (nt = Mt.charCodeAt(Ee + 1))) == 56320 && (Nt = 65536 + (Nt - 55296 << 10) + (nt - 56320), Ee++), Tt += 128 > Nt ? 1 : 2048 > Nt ? 2 : 65536 > Nt ? 3 : 4; + for (It = new je.Buf8(Tt), Ee = Be = 0; Be < Tt; Ee++) + (64512 & (Nt = Mt.charCodeAt(Ee))) == 55296 && Ee + 1 < kt && (64512 & (nt = Mt.charCodeAt(Ee + 1))) == 56320 && (Nt = 65536 + (Nt - 55296 << 10) + (nt - 56320), Ee++), 128 > Nt ? It[Be++] = Nt : (2048 > Nt ? It[Be++] = 192 | Nt >>> 6 : (65536 > Nt ? It[Be++] = 224 | Nt >>> 12 : (It[Be++] = 240 | Nt >>> 18, It[Be++] = 128 | 63 & Nt >>> 12), It[Be++] = 128 | 63 & Nt >>> 6), It[Be++] = 128 | 63 & Nt); + return It; + }, Re.buf2binstring = function(Mt) { + return Ge(Mt, Mt.length); + }, Re.binstring2buf = function(Mt) { + for (var kt = new je.Buf8(Mt.length), Tt = 0, It = kt.length; Tt < It; Tt++) + kt[Tt] = Mt.charCodeAt(Tt); + return kt; + }, Re.buf2string = function(Mt, kt) { + var Tt = kt || Mt.length, It = Array(2 * Tt), Nt, nt, Ee, Be; + for (Nt = nt = 0; Nt < Tt; ) + if (128 > (Ee = Mt[Nt++])) + It[nt++] = Ee; + else if (4 < (Be = tt[Ee])) + It[nt++] = 65533, Nt += Be - 1; + else { + for (Ee &= Be === 2 ? 31 : Be === 3 ? 15 : 7; 1 < Be && Nt < Tt; ) + Ee = Ee << 6 | 63 & Mt[Nt++], Be--; + 1 < Be ? It[nt++] = 65533 : 65536 > Ee ? It[nt++] = Ee : (Ee -= 65536, It[nt++] = 55296 | 1023 & Ee >> 10, It[nt++] = 56320 | 1023 & Ee); + } + return Ge(It, nt); + }, Re.utf8border = function(Mt, kt) { + var Tt; + for ((kt = kt || Mt.length) > Mt.length && (kt = Mt.length), Tt = kt - 1; 0 <= Tt && (192 & Mt[Tt]) == 128; ) + Tt--; + return 0 > Tt || Tt === 0 ? kt : Tt + tt[Mt[Tt]] > kt ? Tt : kt; + }; + }, { "./common": 41 }], 43: [function(Pe, Oe) { + Oe.exports = function(Re, Ge, je, et) { + for (var Qe = 0 | 65535 & Re, tt = 0 | 65535 & Re >>> 16, ft = 0; je !== 0; ) { + for (je -= ft = 2e3 < je ? 2e3 : je; tt = 0 | tt + (Qe = 0 | Qe + Ge[et++]), --ft; ) + ; + Qe %= 65521, tt %= 65521; + } + return 0 | (Qe | tt << 16); + }; + }, {}], 44: [function(Pe, Oe) { + Oe.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; + }, {}], 45: [function(Pe, Oe) { + var Re = function() { + for (var Ge = [], je = 0, et; 256 > je; je++) { + et = je; + for (var Qe = 0; 8 > Qe; Qe++) + et = 1 & et ? 3988292384 ^ et >>> 1 : et >>> 1; + Ge[je] = et; + } + return Ge; + }(); + Oe.exports = function(Ge, je, et, Qe) { + Ge ^= -1; + for (var tt = Qe; tt < Qe + et; tt++) + Ge = Ge >>> 8 ^ Re[255 & (Ge ^ je[tt])]; + return -1 ^ Ge; + }; + }, {}], 46: [function(Pe, Oe, Re) { + function Ge(Ae, it) { + return Ae.msg = Ne[it], it; + } + function je(Ae) { + return (Ae << 1) - (4 < Ae ? 9 : 0); + } + function et(Ae) { + for (var it = Ae.length; 0 <= --it; ) + Ae[it] = 0; + } + function Qe(Ae) { + var it = Ae.state, yt = it.pending; + yt > Ae.avail_out && (yt = Ae.avail_out), yt !== 0 && (st.arraySet(Ae.output, it.pending_buf, it.pending_out, yt, Ae.next_out), Ae.next_out += yt, it.pending_out += yt, Ae.total_out += yt, Ae.avail_out -= yt, it.pending -= yt, it.pending === 0 && (it.pending_out = 0)); + } + function tt(Ae, it) { + le._tr_flush_block(Ae, 0 <= Ae.block_start ? Ae.block_start : -1, Ae.strstart - Ae.block_start, it), Ae.block_start = Ae.strstart, Qe(Ae.strm); + } + function ft(Ae, it) { + Ae.pending_buf[Ae.pending++] = it; + } + function Mt(Ae, it) { + Ae.pending_buf[Ae.pending++] = 255 & it >>> 8, Ae.pending_buf[Ae.pending++] = 255 & it; + } + function kt(Ae, it) { + var yt = Ae.max_chain_length, He = Ae.strstart, Ft = Ae.prev_length, ei = Ae.nice_match, mt = Ae.strstart > Ae.w_size - 262 ? Ae.strstart - (Ae.w_size - 262) : 0, Ue = Ae.window, si = Ae.w_mask, A = Ae.prev, ve = Ae.strstart + 258, H = Ue[He + Ft - 1], T = Ue[He + Ft], b, m; + Ae.prev_length >= Ae.good_match && (yt >>= 2), ei > Ae.lookahead && (ei = Ae.lookahead); + do + if (Ue[(b = it) + Ft] === T && Ue[b + Ft - 1] === H && Ue[b] === Ue[He] && Ue[++b] === Ue[He + 1]) { + He += 2, b++; + do + ; + while (Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && Ue[++He] === Ue[++b] && He < ve); + if (m = 258 - (ve - He), He = ve - 258, Ft < m) { + if (Ae.match_start = it, ei <= (Ft = m)) + break; + H = Ue[He + Ft - 1], T = Ue[He + Ft]; + } + } + while ((it = A[it & si]) > mt && --yt != 0); + return Ft <= Ae.lookahead ? Ft : Ae.lookahead; + } + function Tt(Ae) { + var it = Ae.w_size, yt, He, Ft, ei, mt, Ue, si, A, ve, H; + do { + if (ei = Ae.window_size - Ae.lookahead - Ae.strstart, Ae.strstart >= it + (it - 262)) { + for (st.arraySet(Ae.window, Ae.window, it, it, 0), Ae.match_start -= it, Ae.strstart -= it, Ae.block_start -= it, yt = He = Ae.hash_size; Ft = Ae.head[--yt], Ae.head[yt] = it <= Ft ? Ft - it : 0, --He; ) + ; + for (yt = He = it; Ft = Ae.prev[--yt], Ae.prev[yt] = it <= Ft ? Ft - it : 0, --He; ) + ; + ei += it; + } + if (Ae.strm.avail_in === 0) + break; + if (Ue = Ae.strm, si = Ae.window, A = Ae.strstart + Ae.lookahead, H = void 0, (ve = ei) < (H = Ue.avail_in) && (H = ve), He = H === 0 ? 0 : (Ue.avail_in -= H, st.arraySet(si, Ue.input, Ue.next_in, H, A), Ue.state.wrap === 1 ? Ue.adler = ct(Ue.adler, si, H, A) : Ue.state.wrap === 2 && (Ue.adler = gt(Ue.adler, si, H, A)), Ue.next_in += H, Ue.total_in += H, H), Ae.lookahead += He, 3 <= Ae.lookahead + Ae.insert) + for (mt = Ae.strstart - Ae.insert, Ae.ins_h = Ae.window[mt], Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[mt + 1]) & Ae.hash_mask; Ae.insert && (Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[mt + 3 - 1]) & Ae.hash_mask, Ae.prev[mt & Ae.w_mask] = Ae.head[Ae.ins_h], Ae.head[Ae.ins_h] = mt, mt++, Ae.insert--, !(3 > Ae.lookahead + Ae.insert)); ) + ; + } while (Ae.lookahead < 262 && Ae.strm.avail_in !== 0); + } + function It(Ae, it) { + for (var yt, He; ; ) { + if (Ae.lookahead < 262) { + if (Tt(Ae), Ae.lookahead < 262 && it === 0) + return 1; + if (Ae.lookahead === 0) + break; + } + if (yt = 0, 3 <= Ae.lookahead && (Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[Ae.strstart + 3 - 1]) & Ae.hash_mask, yt = Ae.prev[Ae.strstart & Ae.w_mask] = Ae.head[Ae.ins_h], Ae.head[Ae.ins_h] = Ae.strstart), yt !== 0 && Ae.strstart - yt <= Ae.w_size - 262 && (Ae.match_length = kt(Ae, yt)), !(3 <= Ae.match_length)) + He = le._tr_tally(Ae, 0, Ae.window[Ae.strstart]), Ae.lookahead--, Ae.strstart++; + else if (He = le._tr_tally(Ae, Ae.strstart - Ae.match_start, Ae.match_length - 3), Ae.lookahead -= Ae.match_length, Ae.match_length <= Ae.max_lazy_match && 3 <= Ae.lookahead) { + for (Ae.match_length--; Ae.strstart++, Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[Ae.strstart + 3 - 1]) & Ae.hash_mask, yt = Ae.prev[Ae.strstart & Ae.w_mask] = Ae.head[Ae.ins_h], Ae.head[Ae.ins_h] = Ae.strstart, --Ae.match_length != 0; ) + ; + Ae.strstart++; + } else + Ae.strstart += Ae.match_length, Ae.match_length = 0, Ae.ins_h = Ae.window[Ae.strstart], Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[Ae.strstart + 1]) & Ae.hash_mask; + if (He && (tt(Ae, !1), Ae.strm.avail_out === 0)) + return 1; + } + return Ae.insert = Ae.strstart < 2 ? Ae.strstart : 2, it === 4 ? (tt(Ae, !0), Ae.strm.avail_out === 0 ? 3 : 4) : Ae.last_lit && (tt(Ae, !1), Ae.strm.avail_out === 0) ? 1 : 2; + } + function Nt(Ae, it) { + for (var yt, He, Ft; ; ) { + if (Ae.lookahead < 262) { + if (Tt(Ae), Ae.lookahead < 262 && it === 0) + return 1; + if (Ae.lookahead === 0) + break; + } + if (yt = 0, 3 <= Ae.lookahead && (Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[Ae.strstart + 3 - 1]) & Ae.hash_mask, yt = Ae.prev[Ae.strstart & Ae.w_mask] = Ae.head[Ae.ins_h], Ae.head[Ae.ins_h] = Ae.strstart), Ae.prev_length = Ae.match_length, Ae.prev_match = Ae.match_start, Ae.match_length = 2, yt !== 0 && Ae.prev_length < Ae.max_lazy_match && Ae.strstart - yt <= Ae.w_size - 262 && (Ae.match_length = kt(Ae, yt), 5 >= Ae.match_length && (Ae.strategy === 1 || Ae.match_length === 3 && 4096 < Ae.strstart - Ae.match_start) && (Ae.match_length = 2)), 3 <= Ae.prev_length && Ae.match_length <= Ae.prev_length) { + for (Ft = Ae.strstart + Ae.lookahead - 3, He = le._tr_tally(Ae, Ae.strstart - 1 - Ae.prev_match, Ae.prev_length - 3), Ae.lookahead -= Ae.prev_length - 1, Ae.prev_length -= 2; ++Ae.strstart <= Ft && (Ae.ins_h = (Ae.ins_h << Ae.hash_shift ^ Ae.window[Ae.strstart + 3 - 1]) & Ae.hash_mask, yt = Ae.prev[Ae.strstart & Ae.w_mask] = Ae.head[Ae.ins_h], Ae.head[Ae.ins_h] = Ae.strstart), --Ae.prev_length != 0; ) + ; + if (Ae.match_available = 0, Ae.match_length = 2, Ae.strstart++, He && (tt(Ae, !1), Ae.strm.avail_out === 0)) + return 1; + } else if (!Ae.match_available) + Ae.match_available = 1, Ae.strstart++, Ae.lookahead--; + else if ((He = le._tr_tally(Ae, 0, Ae.window[Ae.strstart - 1])) && tt(Ae, !1), Ae.strstart++, Ae.lookahead--, Ae.strm.avail_out === 0) + return 1; + } + return Ae.match_available && (He = le._tr_tally(Ae, 0, Ae.window[Ae.strstart - 1]), Ae.match_available = 0), Ae.insert = Ae.strstart < 2 ? Ae.strstart : 2, it === 4 ? (tt(Ae, !0), Ae.strm.avail_out === 0 ? 3 : 4) : Ae.last_lit && (tt(Ae, !1), Ae.strm.avail_out === 0) ? 1 : 2; + } + function nt(Ae, it, yt, He, Ft) { + this.good_length = Ae, this.max_lazy = it, this.nice_length = yt, this.max_chain = He, this.func = Ft; + } + function Ee() { + this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = 8, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new st.Buf16(1146), this.dyn_dtree = new st.Buf16(122), this.bl_tree = new st.Buf16(78), et(this.dyn_ltree), et(this.dyn_dtree), et(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new st.Buf16(16), this.heap = new st.Buf16(573), et(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new st.Buf16(573), et(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; + } + function Be(Ae) { + var it; + return Ae && Ae.state ? (Ae.total_in = Ae.total_out = 0, Ae.data_type = 2, (it = Ae.state).pending = 0, it.pending_out = 0, 0 > it.wrap && (it.wrap = -it.wrap), it.status = it.wrap ? 42 : 113, Ae.adler = it.wrap === 2 ? 0 : 1, it.last_flush = 0, le._tr_init(it), 0) : Ge(Ae, -2); + } + function at(Ae) { + var it = Be(Ae), yt; + return it === 0 && ((yt = Ae.state).window_size = 2 * yt.w_size, et(yt.head), yt.max_lazy_match = pe[yt.level].max_lazy, yt.good_match = pe[yt.level].good_length, yt.nice_match = pe[yt.level].nice_length, yt.max_chain_length = pe[yt.level].max_chain, yt.strstart = 0, yt.block_start = 0, yt.lookahead = 0, yt.insert = 0, yt.match_length = yt.prev_length = 2, yt.match_available = 0, yt.ins_h = 0), it; + } + function wt(Ae, it, yt, He, Ft, ei) { + if (!Ae) + return -2; + var mt = 1; + if (it === -1 && (it = 6), 0 > He ? (mt = 0, He = -He) : 15 < He && (mt = 2, He -= 16), 1 > Ft || 9 < Ft || yt !== 8 || 8 > He || 15 < He || 0 > it || 9 < it || 0 > ei || 4 < ei) + return Ge(Ae, -2); + He === 8 && (He = 9); + var Ue = new Ee(); + return (Ae.state = Ue).strm = Ae, Ue.wrap = mt, Ue.gzhead = null, Ue.w_bits = He, Ue.w_size = 1 << Ue.w_bits, Ue.w_mask = Ue.w_size - 1, Ue.hash_bits = Ft + 7, Ue.hash_size = 1 << Ue.hash_bits, Ue.hash_mask = Ue.hash_size - 1, Ue.hash_shift = ~~((Ue.hash_bits + 3 - 1) / 3), Ue.window = new st.Buf8(2 * Ue.w_size), Ue.head = new st.Buf16(Ue.hash_size), Ue.prev = new st.Buf16(Ue.w_size), Ue.lit_bufsize = 1 << Ft + 6, Ue.pending_buf_size = 4 * Ue.lit_bufsize, Ue.pending_buf = new st.Buf8(Ue.pending_buf_size), Ue.d_buf = 1 * Ue.lit_bufsize, Ue.l_buf = 3 * Ue.lit_bufsize, Ue.level = it, Ue.strategy = ei, Ue.method = yt, at(Ae); + } + var st = Pe("../utils/common"), le = Pe("./trees"), ct = Pe("./adler32"), gt = Pe("./crc32"), Ne = Pe("./messages"), pe; + pe = [new nt(0, 0, 0, 0, function(Ae, it) { + var yt = 65535; + for (yt > Ae.pending_buf_size - 5 && (yt = Ae.pending_buf_size - 5); ; ) { + if (1 >= Ae.lookahead) { + if (Tt(Ae), Ae.lookahead === 0 && it === 0) + return 1; + if (Ae.lookahead === 0) + break; + } + Ae.strstart += Ae.lookahead, Ae.lookahead = 0; + var He = Ae.block_start + yt; + if ((Ae.strstart === 0 || Ae.strstart >= He) && (Ae.lookahead = Ae.strstart - He, Ae.strstart = He, tt(Ae, !1), Ae.strm.avail_out === 0) || Ae.strstart - Ae.block_start >= Ae.w_size - 262 && (tt(Ae, !1), Ae.strm.avail_out === 0)) + return 1; + } + return Ae.insert = 0, it === 4 ? (tt(Ae, !0), Ae.strm.avail_out === 0 ? 3 : 4) : (Ae.strstart > Ae.block_start && (tt(Ae, !1), Ae.strm.avail_out), 1); + }), new nt(4, 4, 8, 4, It), new nt(4, 5, 16, 8, It), new nt(4, 6, 32, 32, It), new nt(4, 4, 16, 16, Nt), new nt(8, 16, 32, 32, Nt), new nt(8, 16, 128, 128, Nt), new nt(8, 32, 128, 256, Nt), new nt(32, 128, 258, 1024, Nt), new nt(32, 258, 258, 4096, Nt)], Re.deflateInit = function(Ae, it) { + return wt(Ae, it, 8, 15, 8, 0); + }, Re.deflateInit2 = wt, Re.deflateReset = at, Re.deflateResetKeep = Be, Re.deflateSetHeader = function(Ae, it) { + return Ae && Ae.state && Ae.state.wrap === 2 ? (Ae.state.gzhead = it, 0) : -2; + }, Re.deflate = function(Ae, it) { + var yt, He, Ft, ei; + if (!Ae || !Ae.state || 5 < it || 0 > it) + return Ae ? Ge(Ae, -2) : -2; + if (He = Ae.state, !Ae.output || !Ae.input && Ae.avail_in !== 0 || He.status === 666 && it !== 4) + return Ge(Ae, Ae.avail_out === 0 ? -5 : -2); + if (He.strm = Ae, yt = He.last_flush, He.last_flush = it, He.status === 42) + if (He.wrap === 2) + Ae.adler = 0, ft(He, 31), ft(He, 139), ft(He, 8), He.gzhead ? (ft(He, (He.gzhead.text ? 1 : 0) + (He.gzhead.hcrc ? 2 : 0) + (He.gzhead.extra ? 4 : 0) + (He.gzhead.name ? 8 : 0) + (He.gzhead.comment ? 16 : 0)), ft(He, 255 & He.gzhead.time), ft(He, 255 & He.gzhead.time >> 8), ft(He, 255 & He.gzhead.time >> 16), ft(He, 255 & He.gzhead.time >> 24), ft(He, He.level === 9 ? 2 : 2 <= He.strategy || 2 > He.level ? 4 : 0), ft(He, 255 & He.gzhead.os), He.gzhead.extra && He.gzhead.extra.length && (ft(He, 255 & He.gzhead.extra.length), ft(He, 255 & He.gzhead.extra.length >> 8)), He.gzhead.hcrc && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending, 0)), He.gzindex = 0, He.status = 69) : (ft(He, 0), ft(He, 0), ft(He, 0), ft(He, 0), ft(He, 0), ft(He, He.level === 9 ? 2 : 2 <= He.strategy || 2 > He.level ? 4 : 0), ft(He, 3), He.status = 113); + else { + var mt = 8 + (He.w_bits - 8 << 4) << 8; + mt |= (2 <= He.strategy || 2 > He.level ? 0 : 6 > He.level ? 1 : He.level === 6 ? 2 : 3) << 6, He.strstart !== 0 && (mt |= 32), mt += 31 - mt % 31, He.status = 113, Mt(He, mt), He.strstart !== 0 && (Mt(He, Ae.adler >>> 16), Mt(He, 65535 & Ae.adler)), Ae.adler = 1; + } + if (He.status === 69) + if (He.gzhead.extra) { + for (Ft = He.pending; He.gzindex < (65535 & He.gzhead.extra.length) && (He.pending !== He.pending_buf_size || (He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), Qe(Ae), Ft = He.pending, He.pending !== He.pending_buf_size)); ) + ft(He, 255 & He.gzhead.extra[He.gzindex]), He.gzindex++; + He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), He.gzindex === He.gzhead.extra.length && (He.gzindex = 0, He.status = 73); + } else + He.status = 73; + if (He.status === 73) + if (He.gzhead.name) { + Ft = He.pending; + do { + if (He.pending === He.pending_buf_size && (He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), Qe(Ae), Ft = He.pending, He.pending === He.pending_buf_size)) { + ei = 1; + break; + } + ei = He.gzindex < He.gzhead.name.length ? 255 & He.gzhead.name.charCodeAt(He.gzindex++) : 0, ft(He, ei); + } while (ei !== 0); + He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), ei === 0 && (He.gzindex = 0, He.status = 91); + } else + He.status = 91; + if (He.status === 91) + if (He.gzhead.comment) { + Ft = He.pending; + do { + if (He.pending === He.pending_buf_size && (He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), Qe(Ae), Ft = He.pending, He.pending === He.pending_buf_size)) { + ei = 1; + break; + } + ei = He.gzindex < He.gzhead.comment.length ? 255 & He.gzhead.comment.charCodeAt(He.gzindex++) : 0, ft(He, ei); + } while (ei !== 0); + He.gzhead.hcrc && He.pending > Ft && (Ae.adler = gt(Ae.adler, He.pending_buf, He.pending - Ft, Ft)), ei === 0 && (He.status = 103); + } else + He.status = 103; + if (He.status === 103 && (He.gzhead.hcrc ? (He.pending + 2 > He.pending_buf_size && Qe(Ae), He.pending + 2 <= He.pending_buf_size && (ft(He, 255 & Ae.adler), ft(He, 255 & Ae.adler >> 8), Ae.adler = 0, He.status = 113)) : He.status = 113), He.pending !== 0) { + if (Qe(Ae), Ae.avail_out === 0) + return He.last_flush = -1, 0; + } else if (Ae.avail_in === 0 && je(it) <= je(yt) && it !== 4) + return Ge(Ae, -5); + if (He.status === 666 && Ae.avail_in !== 0) + return Ge(Ae, -5); + if (Ae.avail_in !== 0 || He.lookahead !== 0 || it !== 0 && He.status !== 666) { + var Ue = He.strategy === 2 ? function(si, A) { + for (var ve; ; ) { + if (si.lookahead === 0 && (Tt(si), si.lookahead === 0)) { + if (A === 0) + return 1; + break; + } + if (si.match_length = 0, ve = le._tr_tally(si, 0, si.window[si.strstart]), si.lookahead--, si.strstart++, ve && (tt(si, !1), si.strm.avail_out === 0)) + return 1; + } + return si.insert = 0, A === 4 ? (tt(si, !0), si.strm.avail_out === 0 ? 3 : 4) : si.last_lit && (tt(si, !1), si.strm.avail_out === 0) ? 1 : 2; + }(He, it) : He.strategy === 3 ? function(si, A) { + for (var ve = si.window, H, T, b, m; ; ) { + if (258 >= si.lookahead) { + if (Tt(si), 258 >= si.lookahead && A === 0) + return 1; + if (si.lookahead === 0) + break; + } + if (si.match_length = 0, 3 <= si.lookahead && 0 < si.strstart && (T = ve[b = si.strstart - 1]) === ve[++b] && T === ve[++b] && T === ve[++b]) { + m = si.strstart + 258; + do + ; + while (T === ve[++b] && T === ve[++b] && T === ve[++b] && T === ve[++b] && T === ve[++b] && T === ve[++b] && T === ve[++b] && T === ve[++b] && b < m); + si.match_length = 258 - (m - b), si.match_length > si.lookahead && (si.match_length = si.lookahead); + } + if (3 <= si.match_length ? (H = le._tr_tally(si, 1, si.match_length - 3), si.lookahead -= si.match_length, si.strstart += si.match_length, si.match_length = 0) : (H = le._tr_tally(si, 0, si.window[si.strstart]), si.lookahead--, si.strstart++), H && (tt(si, !1), si.strm.avail_out === 0)) + return 1; + } + return si.insert = 0, A === 4 ? (tt(si, !0), si.strm.avail_out === 0 ? 3 : 4) : si.last_lit && (tt(si, !1), si.strm.avail_out === 0) ? 1 : 2; + }(He, it) : pe[He.level].func(He, it); + if (Ue !== 3 && Ue !== 4 || (He.status = 666), Ue === 1 || Ue === 3) + return Ae.avail_out === 0 && (He.last_flush = -1), 0; + if (Ue === 2 && (it === 1 ? le._tr_align(He) : it != 5 && (le._tr_stored_block(He, 0, 0, !1), it == 3 && (et(He.head), He.lookahead === 0 && (He.strstart = 0, He.block_start = 0, He.insert = 0))), Qe(Ae), Ae.avail_out === 0)) + return He.last_flush = -1, 0; + } + return it === 4 ? 0 >= He.wrap ? 1 : (He.wrap === 2 ? (ft(He, 255 & Ae.adler), ft(He, 255 & Ae.adler >> 8), ft(He, 255 & Ae.adler >> 16), ft(He, 255 & Ae.adler >> 24), ft(He, 255 & Ae.total_in), ft(He, 255 & Ae.total_in >> 8), ft(He, 255 & Ae.total_in >> 16), ft(He, 255 & Ae.total_in >> 24)) : (Mt(He, Ae.adler >>> 16), Mt(He, 65535 & Ae.adler)), Qe(Ae), 0 < He.wrap && (He.wrap = -He.wrap), He.pending === 0 ? 1 : 0) : 0; + }, Re.deflateEnd = function(Ae) { + var it; + return Ae && Ae.state ? (it = Ae.state.status) !== 42 && it !== 69 && it !== 73 && it !== 91 && it !== 103 && it !== 113 && it !== 666 ? Ge(Ae, -2) : (Ae.state = null, it === 113 ? Ge(Ae, -3) : 0) : -2; + }, Re.deflateSetDictionary = function(Ae, it) { + var yt = it.length, He, Ft, ei, mt, Ue, si, A, ve; + if (!Ae || !Ae.state || (mt = (He = Ae.state).wrap) === 2 || mt === 1 && He.status !== 42 || He.lookahead) + return -2; + for (mt === 1 && (Ae.adler = ct(Ae.adler, it, yt, 0)), He.wrap = 0, yt >= He.w_size && (mt === 0 && (et(He.head), He.strstart = 0, He.block_start = 0, He.insert = 0), ve = new st.Buf8(He.w_size), st.arraySet(ve, it, yt - He.w_size, He.w_size, 0), it = ve, yt = He.w_size), Ue = Ae.avail_in, si = Ae.next_in, A = Ae.input, Ae.avail_in = yt, Ae.next_in = 0, Ae.input = it, Tt(He); He.lookahead >= 3; ) { + for (Ft = He.strstart, ei = He.lookahead - 2; He.ins_h = (He.ins_h << He.hash_shift ^ He.window[Ft + 3 - 1]) & He.hash_mask, He.prev[Ft & He.w_mask] = He.head[He.ins_h], He.head[He.ins_h] = Ft, Ft++, --ei; ) + ; + He.strstart = Ft, He.lookahead = 2, Tt(He); + } + return He.strstart += He.lookahead, He.block_start = He.strstart, He.insert = He.lookahead, He.lookahead = 0, He.match_length = He.prev_length = 2, He.match_available = 0, Ae.next_in = si, Ae.input = A, Ae.avail_in = Ue, He.wrap = mt, 0; + }, Re.deflateInfo = "pako deflate (from Nodeca project)"; + }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(Pe, Oe) { + Oe.exports = function() { + this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1; + }; + }, {}], 48: [function(Pe, Oe) { + Oe.exports = function(Re, Ge) { + var je, et, Qe, tt, ft, Mt, kt, Tt, It, Nt, nt, Ee, Be, at, wt, st, le, ct, gt, Ne, pe, Ae, it, yt, He; + je = Re.state, et = Re.next_in, yt = Re.input, Qe = et + (Re.avail_in - 5), tt = Re.next_out, He = Re.output, ft = tt - (Ge - Re.avail_out), Mt = tt + (Re.avail_out - 257), kt = je.dmax, Tt = je.wsize, It = je.whave, Nt = je.wnext, nt = je.window, Ee = je.hold, Be = je.bits, at = je.lencode, wt = je.distcode, st = (1 << je.lenbits) - 1, le = (1 << je.distbits) - 1; + e: + do { + 15 > Be && (Ee += yt[et++] << Be, Be += 8, Ee += yt[et++] << Be, Be += 8), ct = at[Ee & st]; + t: + for (; ; ) { + if (Ee >>>= gt = ct >>> 24, Be -= gt, (gt = 255 & ct >>> 16) == 0) + He[tt++] = 65535 & ct; + else { + if (!(16 & gt)) { + if (!(64 & gt)) { + ct = at[(65535 & ct) + (Ee & (1 << gt) - 1)]; + continue t; + } + if (32 & gt) { + je.mode = 12; + break e; + } + Re.msg = "invalid literal/length code", je.mode = 30; + break e; + } + Ne = 65535 & ct, (gt &= 15) && (Be < gt && (Ee += yt[et++] << Be, Be += 8), Ne += Ee & (1 << gt) - 1, Ee >>>= gt, Be -= gt), 15 > Be && (Ee += yt[et++] << Be, Be += 8, Ee += yt[et++] << Be, Be += 8), ct = wt[Ee & le]; + i: + for (; ; ) { + if (Ee >>>= gt = ct >>> 24, Be -= gt, !(16 & (gt = 255 & ct >>> 16))) { + if (!(64 & gt)) { + ct = wt[(65535 & ct) + (Ee & (1 << gt) - 1)]; + continue i; + } + Re.msg = "invalid distance code", je.mode = 30; + break e; + } + if (pe = 65535 & ct, Be < (gt &= 15) && (Ee += yt[et++] << Be, (Be += 8) < gt && (Ee += yt[et++] << Be, Be += 8)), kt < (pe += Ee & (1 << gt) - 1)) { + Re.msg = "invalid distance too far back", je.mode = 30; + break e; + } + if (Ee >>>= gt, Be -= gt, (gt = tt - ft) < pe) { + if (It < (gt = pe - gt) && je.sane) { + Re.msg = "invalid distance too far back", je.mode = 30; + break e; + } + if (it = nt, (Ae = 0) === Nt) { + if (Ae += Tt - gt, gt < Ne) { + for (Ne -= gt; He[tt++] = nt[Ae++], --gt; ) + ; + Ae = tt - pe, it = He; + } + } else if (Nt < gt) { + if (Ae += Tt + Nt - gt, (gt -= Nt) < Ne) { + for (Ne -= gt; He[tt++] = nt[Ae++], --gt; ) + ; + if (Ae = 0, Nt < Ne) { + for (Ne -= gt = Nt; He[tt++] = nt[Ae++], --gt; ) + ; + Ae = tt - pe, it = He; + } + } + } else if (Ae += Nt - gt, gt < Ne) { + for (Ne -= gt; He[tt++] = nt[Ae++], --gt; ) + ; + Ae = tt - pe, it = He; + } + for (; 2 < Ne; ) + He[tt++] = it[Ae++], He[tt++] = it[Ae++], He[tt++] = it[Ae++], Ne -= 3; + Ne && (He[tt++] = it[Ae++], 1 < Ne && (He[tt++] = it[Ae++])); + } else { + for (Ae = tt - pe; He[tt++] = He[Ae++], He[tt++] = He[Ae++], He[tt++] = He[Ae++], 2 < (Ne -= 3); ) + ; + Ne && (He[tt++] = He[Ae++], 1 < Ne && (He[tt++] = He[Ae++])); + } + break; + } + } + break; + } + } while (et < Qe && tt < Mt); + et -= Ne = Be >> 3, Ee &= (1 << (Be -= Ne << 3)) - 1, Re.next_in = et, Re.next_out = tt, Re.avail_in = et < Qe ? Qe - et + 5 : 5 - (et - Qe), Re.avail_out = tt < Mt ? Mt - tt + 257 : 257 - (tt - Mt), je.hold = Ee, je.bits = Be; + }; + }, {}], 49: [function(Pe, Oe, Re) { + function Ge(st) { + return (255 & st >>> 24) + (65280 & st >>> 8) + ((65280 & st) << 8) + ((255 & st) << 24); + } + function je() { + this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Tt.Buf16(320), this.work = new Tt.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; + } + function et(st) { + var le; + return st && st.state ? (le = st.state, st.total_in = st.total_out = le.total = 0, st.msg = "", le.wrap && (st.adler = 1 & le.wrap), le.mode = 1, le.last = 0, le.havedict = 0, le.dmax = 32768, le.head = null, le.hold = 0, le.bits = 0, le.lencode = le.lendyn = new Tt.Buf32(852), le.distcode = le.distdyn = new Tt.Buf32(592), le.sane = 1, le.back = -1, 0) : -2; + } + function Qe(st) { + var le; + return st && st.state ? ((le = st.state).wsize = 0, le.whave = 0, le.wnext = 0, et(st)) : -2; + } + function tt(st, le) { + var ct, gt; + return st && st.state ? (gt = st.state, 0 > le ? (ct = 0, le = -le) : (ct = 1 + (le >> 4), 48 > le && (le &= 15)), le && (8 > le || 15 < le) ? -2 : (gt.window !== null && gt.wbits !== le && (gt.window = null), gt.wrap = ct, gt.wbits = le, Qe(st))) : -2; + } + function ft(st, le) { + var ct, gt; + return st ? (gt = new je(), (st.state = gt).window = null, (ct = tt(st, le)) !== 0 && (st.state = null), ct) : -2; + } + function Mt(st) { + if (Be) { + var le; + for (at = new Tt.Buf32(512), wt = new Tt.Buf32(32), le = 0; 144 > le; ) + st.lens[le++] = 8; + for (; 256 > le; ) + st.lens[le++] = 9; + for (; 280 > le; ) + st.lens[le++] = 7; + for (; 288 > le; ) + st.lens[le++] = 8; + for (Ee(1, st.lens, 0, 288, at, 0, st.work, { bits: 9 }), le = 0; 32 > le; ) + st.lens[le++] = 5; + Ee(2, st.lens, 0, 32, wt, 0, st.work, { bits: 5 }), Be = !1; + } + st.lencode = at, st.lenbits = 9, st.distcode = wt, st.distbits = 5; + } + function kt(st, le, ct, gt) { + var Ne = st.state, pe; + return Ne.window === null && (Ne.wsize = 1 << Ne.wbits, Ne.wnext = 0, Ne.whave = 0, Ne.window = new Tt.Buf8(Ne.wsize)), gt >= Ne.wsize ? (Tt.arraySet(Ne.window, le, ct - Ne.wsize, Ne.wsize, 0), Ne.wnext = 0, Ne.whave = Ne.wsize) : (gt < (pe = Ne.wsize - Ne.wnext) && (pe = gt), Tt.arraySet(Ne.window, le, ct - gt, pe, Ne.wnext), (gt -= pe) ? (Tt.arraySet(Ne.window, le, ct - gt, gt, 0), Ne.wnext = gt, Ne.whave = Ne.wsize) : (Ne.wnext += pe, Ne.wnext === Ne.wsize && (Ne.wnext = 0), Ne.whave < Ne.wsize && (Ne.whave += pe))), 0; + } + var Tt = Pe("../utils/common"), It = Pe("./adler32"), Nt = Pe("./crc32"), nt = Pe("./inffast"), Ee = Pe("./inftrees"), Be = !0, at, wt; + Re.inflateReset = Qe, Re.inflateReset2 = tt, Re.inflateResetKeep = et, Re.inflateInit = function(st) { + return ft(st, 15); + }, Re.inflateInit2 = ft, Re.inflate = function(st, le) { + var ct = 0, gt = new Tt.Buf8(4), Ne = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], pe, Ae, it, yt, He, Ft, ei, mt, Ue, si, A, ve, H, T, b, m, _, C, D, L, B, q, Z, ie; + if (!st || !st.state || !st.output || !st.input && st.avail_in !== 0) + return -2; + (pe = st.state).mode === 12 && (pe.mode = 13), He = st.next_out, it = st.output, ei = st.avail_out, yt = st.next_in, Ae = st.input, Ft = st.avail_in, mt = pe.hold, Ue = pe.bits, si = Ft, A = ei, q = 0; + e: + for (; ; ) + switch (pe.mode) { + case 1: + if (pe.wrap === 0) { + pe.mode = 13; + break; + } + for (; 16 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (2 & pe.wrap && mt === 35615) { + gt[pe.check = 0] = 255 & mt, gt[1] = 255 & mt >>> 8, pe.check = Nt(pe.check, gt, 2, 0), Ue = mt = 0, pe.mode = 2; + break; + } + if (pe.flags = 0, pe.head && (pe.head.done = !1), !(1 & pe.wrap) || (((255 & mt) << 8) + (mt >> 8)) % 31) { + st.msg = "incorrect header check", pe.mode = 30; + break; + } + if ((15 & mt) != 8) { + st.msg = "unknown compression method", pe.mode = 30; + break; + } + if (Ue -= 4, B = 8 + (15 & (mt >>>= 4)), pe.wbits === 0) + pe.wbits = B; + else if (B > pe.wbits) { + st.msg = "invalid window size", pe.mode = 30; + break; + } + pe.dmax = 1 << B, st.adler = pe.check = 1, pe.mode = 512 & mt ? 10 : 12, Ue = mt = 0; + break; + case 2: + for (; 16 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (pe.flags = mt, (255 & pe.flags) != 8) { + st.msg = "unknown compression method", pe.mode = 30; + break; + } + if (57344 & pe.flags) { + st.msg = "unknown header flags set", pe.mode = 30; + break; + } + pe.head && (pe.head.text = 1 & mt >> 8), 512 & pe.flags && (gt[0] = 255 & mt, gt[1] = 255 & mt >>> 8, pe.check = Nt(pe.check, gt, 2, 0)), Ue = mt = 0, pe.mode = 3; + case 3: + for (; 32 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.head && (pe.head.time = mt), 512 & pe.flags && (gt[0] = 255 & mt, gt[1] = 255 & mt >>> 8, gt[2] = 255 & mt >>> 16, gt[3] = 255 & mt >>> 24, pe.check = Nt(pe.check, gt, 4, 0)), Ue = mt = 0, pe.mode = 4; + case 4: + for (; 16 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.head && (pe.head.xflags = 255 & mt, pe.head.os = mt >> 8), 512 & pe.flags && (gt[0] = 255 & mt, gt[1] = 255 & mt >>> 8, pe.check = Nt(pe.check, gt, 2, 0)), Ue = mt = 0, pe.mode = 5; + case 5: + if (1024 & pe.flags) { + for (; 16 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.length = mt, pe.head && (pe.head.extra_len = mt), 512 & pe.flags && (gt[0] = 255 & mt, gt[1] = 255 & mt >>> 8, pe.check = Nt(pe.check, gt, 2, 0)), Ue = mt = 0; + } else + pe.head && (pe.head.extra = null); + pe.mode = 6; + case 6: + if (1024 & pe.flags && (Ft < (ve = pe.length) && (ve = Ft), ve && (pe.head && (B = pe.head.extra_len - pe.length, pe.head.extra || (pe.head.extra = Array(pe.head.extra_len)), Tt.arraySet(pe.head.extra, Ae, yt, ve, B)), 512 & pe.flags && (pe.check = Nt(pe.check, Ae, ve, yt)), Ft -= ve, yt += ve, pe.length -= ve), pe.length)) + break e; + pe.length = 0, pe.mode = 7; + case 7: + if (2048 & pe.flags) { + if (Ft === 0) + break e; + for (ve = 0; B = Ae[yt + ve++], pe.head && B && 65536 > pe.length && (pe.head.name += o(B)), B && ve < Ft; ) + ; + if (512 & pe.flags && (pe.check = Nt(pe.check, Ae, ve, yt)), Ft -= ve, yt += ve, B) + break e; + } else + pe.head && (pe.head.name = null); + pe.length = 0, pe.mode = 8; + case 8: + if (4096 & pe.flags) { + if (Ft === 0) + break e; + for (ve = 0; B = Ae[yt + ve++], pe.head && B && 65536 > pe.length && (pe.head.comment += o(B)), B && ve < Ft; ) + ; + if (512 & pe.flags && (pe.check = Nt(pe.check, Ae, ve, yt)), Ft -= ve, yt += ve, B) + break e; + } else + pe.head && (pe.head.comment = null); + pe.mode = 9; + case 9: + if (512 & pe.flags) { + for (; 16 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (mt !== (65535 & pe.check)) { + st.msg = "header crc mismatch", pe.mode = 30; + break; + } + Ue = mt = 0; + } + pe.head && (pe.head.hcrc = 1 & pe.flags >> 9, pe.head.done = !0), st.adler = pe.check = 0, pe.mode = 12; + break; + case 10: + for (; 32 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + st.adler = pe.check = Ge(mt), Ue = mt = 0, pe.mode = 11; + case 11: + if (pe.havedict === 0) + return st.next_out = He, st.avail_out = ei, st.next_in = yt, st.avail_in = Ft, pe.hold = mt, pe.bits = Ue, 2; + st.adler = pe.check = 1, pe.mode = 12; + case 12: + if (le === 5 || le === 6) + break e; + case 13: + if (pe.last) { + mt >>>= 7 & Ue, Ue -= 7 & Ue, pe.mode = 27; + break; + } + for (; 3 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + switch (pe.last = 1 & mt, Ue -= 1, 3 & (mt >>>= 1)) { + case 0: + pe.mode = 14; + break; + case 1: + if (Mt(pe), pe.mode = 20, le !== 6) + break; + mt >>>= 2, Ue -= 2; + break e; + case 2: + pe.mode = 17; + break; + case 3: + st.msg = "invalid block type", pe.mode = 30; + } + mt >>>= 2, Ue -= 2; + break; + case 14: + for (mt >>>= 7 & Ue, Ue -= 7 & Ue; 32 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if ((65535 & mt) != (65535 ^ mt >>> 16)) { + st.msg = "invalid stored block lengths", pe.mode = 30; + break; + } + if (pe.length = 65535 & mt, Ue = mt = 0, pe.mode = 15, le === 6) + break e; + case 15: + pe.mode = 16; + case 16: + if (ve = pe.length) { + if (Ft < ve && (ve = Ft), ei < ve && (ve = ei), ve === 0) + break e; + Tt.arraySet(it, Ae, yt, ve, He), Ft -= ve, yt += ve, ei -= ve, He += ve, pe.length -= ve; + break; + } + pe.mode = 12; + break; + case 17: + for (; 14 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (pe.nlen = 257 + (31 & mt), mt >>>= 5, Ue -= 5, pe.ndist = 1 + (31 & mt), mt >>>= 5, Ue -= 5, pe.ncode = 4 + (15 & mt), mt >>>= 4, Ue -= 4, 286 < pe.nlen || 30 < pe.ndist) { + st.msg = "too many length or distance symbols", pe.mode = 30; + break; + } + pe.have = 0, pe.mode = 18; + case 18: + for (; pe.have < pe.ncode; ) { + for (; 3 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.lens[Ne[pe.have++]] = 7 & mt, mt >>>= 3, Ue -= 3; + } + for (; 19 > pe.have; ) + pe.lens[Ne[pe.have++]] = 0; + if (pe.lencode = pe.lendyn, pe.lenbits = 7, Z = { bits: pe.lenbits }, q = Ee(0, pe.lens, 0, 19, pe.lencode, 0, pe.work, Z), pe.lenbits = Z.bits, q) { + st.msg = "invalid code lengths set", pe.mode = 30; + break; + } + pe.have = 0, pe.mode = 19; + case 19: + for (; pe.have < pe.nlen + pe.ndist; ) { + for (; m = 255 & (ct = pe.lencode[mt & (1 << pe.lenbits) - 1]) >>> 16, _ = 65535 & ct, !((b = ct >>> 24) <= Ue); ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (16 > _) + mt >>>= b, Ue -= b, pe.lens[pe.have++] = _; + else { + if (_ === 16) { + for (ie = b + 2; Ue < ie; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (mt >>>= b, Ue -= b, pe.have === 0) { + st.msg = "invalid bit length repeat", pe.mode = 30; + break; + } + B = pe.lens[pe.have - 1], ve = 3 + (3 & mt), mt >>>= 2, Ue -= 2; + } else if (_ === 17) { + for (ie = b + 3; Ue < ie; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + Ue -= b, B = 0, ve = 3 + (7 & (mt >>>= b)), mt >>>= 3, Ue -= 3; + } else { + for (ie = b + 7; Ue < ie; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + Ue -= b, B = 0, ve = 11 + (127 & (mt >>>= b)), mt >>>= 7, Ue -= 7; + } + if (pe.have + ve > pe.nlen + pe.ndist) { + st.msg = "invalid bit length repeat", pe.mode = 30; + break; + } + for (; ve--; ) + pe.lens[pe.have++] = B; + } + } + if (pe.mode === 30) + break; + if (pe.lens[256] === 0) { + st.msg = "invalid code -- missing end-of-block", pe.mode = 30; + break; + } + if (pe.lenbits = 9, Z = { bits: pe.lenbits }, q = Ee(1, pe.lens, 0, pe.nlen, pe.lencode, 0, pe.work, Z), pe.lenbits = Z.bits, q) { + st.msg = "invalid literal/lengths set", pe.mode = 30; + break; + } + if (pe.distbits = 6, pe.distcode = pe.distdyn, Z = { bits: pe.distbits }, q = Ee(2, pe.lens, pe.nlen, pe.ndist, pe.distcode, 0, pe.work, Z), pe.distbits = Z.bits, q) { + st.msg = "invalid distances set", pe.mode = 30; + break; + } + if (pe.mode = 20, le === 6) + break e; + case 20: + pe.mode = 21; + case 21: + if (6 <= Ft && 258 <= ei) { + st.next_out = He, st.avail_out = ei, st.next_in = yt, st.avail_in = Ft, pe.hold = mt, pe.bits = Ue, nt(st, A), He = st.next_out, it = st.output, ei = st.avail_out, yt = st.next_in, Ae = st.input, Ft = st.avail_in, mt = pe.hold, Ue = pe.bits, pe.mode === 12 && (pe.back = -1); + break; + } + for (pe.back = 0; m = 255 & (ct = pe.lencode[mt & (1 << pe.lenbits) - 1]) >>> 16, _ = 65535 & ct, !((b = ct >>> 24) <= Ue); ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (m && !(240 & m)) { + for (C = b, D = m, L = _; m = 255 & (ct = pe.lencode[L + ((mt & (1 << C + D) - 1) >> C)]) >>> 16, _ = 65535 & ct, !(C + (b = ct >>> 24) <= Ue); ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + mt >>>= C, Ue -= C, pe.back += C; + } + if (mt >>>= b, Ue -= b, pe.back += b, pe.length = _, m === 0) { + pe.mode = 26; + break; + } + if (32 & m) { + pe.back = -1, pe.mode = 12; + break; + } + if (64 & m) { + st.msg = "invalid literal/length code", pe.mode = 30; + break; + } + pe.extra = 15 & m, pe.mode = 22; + case 22: + if (pe.extra) { + for (ie = pe.extra; Ue < ie; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.length += mt & (1 << pe.extra) - 1, mt >>>= pe.extra, Ue -= pe.extra, pe.back += pe.extra; + } + pe.was = pe.length, pe.mode = 23; + case 23: + for (; m = 255 & (ct = pe.distcode[mt & (1 << pe.distbits) - 1]) >>> 16, _ = 65535 & ct, !((b = ct >>> 24) <= Ue); ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (!(240 & m)) { + for (C = b, D = m, L = _; m = 255 & (ct = pe.distcode[L + ((mt & (1 << C + D) - 1) >> C)]) >>> 16, _ = 65535 & ct, !(C + (b = ct >>> 24) <= Ue); ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + mt >>>= C, Ue -= C, pe.back += C; + } + if (mt >>>= b, Ue -= b, pe.back += b, 64 & m) { + st.msg = "invalid distance code", pe.mode = 30; + break; + } + pe.offset = _, pe.extra = 15 & m, pe.mode = 24; + case 24: + if (pe.extra) { + for (ie = pe.extra; Ue < ie; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + pe.offset += mt & (1 << pe.extra) - 1, mt >>>= pe.extra, Ue -= pe.extra, pe.back += pe.extra; + } + if (pe.offset > pe.dmax) { + st.msg = "invalid distance too far back", pe.mode = 30; + break; + } + pe.mode = 25; + case 25: + if (ei === 0) + break e; + if (ve = A - ei, pe.offset > ve) { + if ((ve = pe.offset - ve) > pe.whave && pe.sane) { + st.msg = "invalid distance too far back", pe.mode = 30; + break; + } + H = ve > pe.wnext ? (ve -= pe.wnext, pe.wsize - ve) : pe.wnext - ve, ve > pe.length && (ve = pe.length), T = pe.window; + } else + T = it, H = He - pe.offset, ve = pe.length; + for (ei < ve && (ve = ei), ei -= ve, pe.length -= ve; it[He++] = T[H++], --ve; ) + ; + pe.length === 0 && (pe.mode = 21); + break; + case 26: + if (ei === 0) + break e; + it[He++] = pe.length, ei--, pe.mode = 21; + break; + case 27: + if (pe.wrap) { + for (; 32 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt |= Ae[yt++] << Ue, Ue += 8; + } + if (A -= ei, st.total_out += A, pe.total += A, A && (st.adler = pe.check = pe.flags ? Nt(pe.check, it, A, He - A) : It(pe.check, it, A, He - A)), A = ei, (pe.flags ? mt : Ge(mt)) !== pe.check) { + st.msg = "incorrect data check", pe.mode = 30; + break; + } + Ue = mt = 0; + } + pe.mode = 28; + case 28: + if (pe.wrap && pe.flags) { + for (; 32 > Ue; ) { + if (Ft === 0) + break e; + Ft--, mt += Ae[yt++] << Ue, Ue += 8; + } + if (mt !== (4294967295 & pe.total)) { + st.msg = "incorrect length check", pe.mode = 30; + break; + } + Ue = mt = 0; + } + pe.mode = 29; + case 29: + q = 1; + break e; + case 30: + q = -3; + break e; + case 31: + return -4; + case 32: + default: + return -2; + } + return st.next_out = He, st.avail_out = ei, st.next_in = yt, st.avail_in = Ft, pe.hold = mt, pe.bits = Ue, (pe.wsize || A !== st.avail_out && 30 > pe.mode && (27 > pe.mode || le !== 4)) && kt(st, st.output, st.next_out, A - st.avail_out) ? (pe.mode = 31, -4) : (si -= st.avail_in, A -= st.avail_out, st.total_in += si, st.total_out += A, pe.total += A, pe.wrap && A && (st.adler = pe.check = pe.flags ? Nt(pe.check, it, A, st.next_out - A) : It(pe.check, it, A, st.next_out - A)), st.data_type = pe.bits + (pe.last ? 64 : 0) + (pe.mode === 12 ? 128 : 0) + (pe.mode === 20 || pe.mode === 15 ? 256 : 0), (si == 0 && A === 0 || le === 4) && q === 0 && (q = -5), q); + }, Re.inflateEnd = function(st) { + if (!st || !st.state) + return -2; + var le = st.state; + return le.window && (le.window = null), st.state = null, 0; + }, Re.inflateGetHeader = function(st, le) { + var ct; + return st && st.state && 2 & (ct = st.state).wrap ? ((ct.head = le).done = !1, 0) : -2; + }, Re.inflateSetDictionary = function(st, le) { + var ct = le.length, gt; + return st && st.state ? (gt = st.state).wrap !== 0 && gt.mode !== 11 ? -2 : gt.mode === 11 && It(1, le, ct, 0) !== gt.check ? -3 : kt(st, le, ct, ct) ? (gt.mode = 31, -4) : (gt.havedict = 1, 0) : -2; + }, Re.inflateInfo = "pako inflate (from Nodeca project)"; + }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(Pe, Oe) { + var Re = Pe("../utils/common"), Ge = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], je = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], et = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], Qe = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; + Oe.exports = function(tt, ft, Mt, kt, Tt, It, Nt, nt) { + var Ee = nt.bits, Be = 0, at = 0, wt = 0, st = 0, le = 0, ct = 0, gt = 0, Ne = 0, pe = 0, Ae = 0, it = null, yt = 0, He = new Re.Buf16(16), Ft = new Re.Buf16(16), ei = null, mt = 0, Ue, si, A, ve, H, T, b, m, _; + for (Be = 0; 15 >= Be; Be++) + He[Be] = 0; + for (at = 0; at < kt; at++) + He[ft[Mt + at]]++; + for (le = Ee, st = 15; 1 <= st && He[st] === 0; st--) + ; + if (st < le && (le = st), st == 0) + return Tt[It++] = 20971520, Tt[It++] = 20971520, nt.bits = 1, 0; + for (wt = 1; wt < st && He[wt] === 0; wt++) + ; + for (le < wt && (le = wt), Be = Ne = 1; 15 >= Be; Be++) + if (Ne <<= 1, 0 > (Ne -= He[Be])) + return -1; + if (0 < Ne && (tt === 0 || st !== 1)) + return -1; + for (Ft[1] = 0, Be = 1; 15 > Be; Be++) + Ft[Be + 1] = Ft[Be] + He[Be]; + for (at = 0; at < kt; at++) + ft[Mt + at] !== 0 && (Nt[Ft[ft[Mt + at]]++] = at); + if (T = tt === 0 ? (it = ei = Nt, 19) : tt === 1 ? (it = Ge, yt -= 257, ei = je, mt -= 257, 256) : (it = et, ei = Qe, -1), Be = wt, H = It, gt = at = Ae = 0, A = -1, ve = (pe = 1 << (ct = le)) - 1, tt === 1 && 852 < pe || tt === 2 && 592 < pe) + return 1; + for (; ; ) { + for (b = Be - gt, _ = Nt[at] < T ? (m = 0, Nt[at]) : Nt[at] > T ? (m = ei[mt + Nt[at]], it[yt + Nt[at]]) : (m = 96, 0), Ue = 1 << Be - gt, wt = si = 1 << ct; Tt[H + (Ae >> gt) + (si -= Ue)] = 0 | (b << 24 | m << 16 | _), si !== 0; ) + ; + for (Ue = 1 << Be - 1; Ae & Ue; ) + Ue >>= 1; + if (Ue === 0 ? Ae = 0 : (Ae &= Ue - 1, Ae += Ue), at++, --He[Be] == 0) { + if (Be === st) + break; + Be = ft[Mt + Nt[at]]; + } + if (le < Be && (Ae & ve) !== A) { + for (gt === 0 && (gt = le), H += wt, Ne = 1 << (ct = Be - gt); ct + gt < st && !(0 >= (Ne -= He[ct + gt])); ) + ct++, Ne <<= 1; + if (pe += 1 << ct, tt === 1 && 852 < pe || tt === 2 && 592 < pe) + return 1; + Tt[A = Ae & ve] = 0 | (le << 24 | ct << 16 | H - It); + } + } + return Ae != 0 && (Tt[H + Ae] = 0 | (Be - gt << 24 | 4194304)), nt.bits = le, 0; + }; + }, { "../utils/common": 41 }], 51: [function(Pe, Oe) { + Oe.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; + }, {}], 52: [function(Pe, Oe, Re) { + function Ge(T) { + for (var b = T.length; 0 <= --b; ) + T[b] = 0; + } + function je(T, b, m, _, C) { + this.static_tree = T, this.extra_bits = b, this.extra_base = m, this.elems = _, this.max_length = C, this.has_stree = T && T.length; + } + function et(T, b) { + this.dyn_tree = T, this.max_code = 0, this.stat_desc = b; + } + function Qe(T) { + return 256 > T ? Ft[T] : Ft[256 + (T >>> 7)]; + } + function tt(T, b) { + T.pending_buf[T.pending++] = 255 & b, T.pending_buf[T.pending++] = 255 & b >>> 8; + } + function ft(T, b, m) { + T.bi_valid > 16 - m ? (T.bi_buf |= 65535 & b << T.bi_valid, tt(T, T.bi_buf), T.bi_buf = b >> 16 - T.bi_valid, T.bi_valid += m - 16) : (T.bi_buf |= 65535 & b << T.bi_valid, T.bi_valid += m); + } + function Mt(T, b, m) { + ft(T, m[2 * b], m[2 * b + 1]); + } + function kt(T, b) { + for (var m = 0; m |= 1 & T, T >>>= 1, m <<= 1, 0 < --b; ) + ; + return m >>> 1; + } + function Tt(T, b, m) { + var _ = Array(16), C = 0, D, L; + for (D = 1; D <= 15; D++) + _[D] = C = C + m[D - 1] << 1; + for (L = 0; L <= b; L++) { + var B = T[2 * L + 1]; + B !== 0 && (T[2 * L] = kt(_[B]++, B)); + } + } + function It(T) { + var b; + for (b = 0; 286 > b; b++) + T.dyn_ltree[2 * b] = 0; + for (b = 0; 30 > b; b++) + T.dyn_dtree[2 * b] = 0; + for (b = 0; 19 > b; b++) + T.bl_tree[2 * b] = 0; + T.dyn_ltree[512] = 1, T.opt_len = T.static_len = 0, T.last_lit = T.matches = 0; + } + function Nt(T) { + 8 < T.bi_valid ? tt(T, T.bi_buf) : 0 < T.bi_valid && (T.pending_buf[T.pending++] = T.bi_buf), T.bi_buf = 0, T.bi_valid = 0; + } + function nt(T, b, m, _) { + var C = 2 * b, D = 2 * m; + return T[C] < T[D] || T[C] === T[D] && _[b] <= _[m]; + } + function Ee(T, b, m) { + for (var _ = T.heap[m], C = m << 1; C <= T.heap_len && (C < T.heap_len && nt(b, T.heap[C + 1], T.heap[C], T.depth) && C++, !nt(b, _, T.heap[C], T.depth)); ) + T.heap[m] = T.heap[C], m = C, C <<= 1; + T.heap[m] = _; + } + function Be(T, b, m) { + var _ = 0, C, D, L, B; + if (T.last_lit !== 0) + for (; C = T.pending_buf[T.d_buf + 2 * _] << 8 | T.pending_buf[T.d_buf + 2 * _ + 1], D = T.pending_buf[T.l_buf + _], _++, C === 0 ? Mt(T, D, b) : (Mt(T, (L = ei[D]) + 256 + 1, b), (B = Ne[L]) !== 0 && ft(T, D -= mt[L], B), Mt(T, L = Qe(--C), m), (B = pe[L]) !== 0 && ft(T, C -= Ue[L], B)), _ < T.last_lit; ) + ; + Mt(T, 256, b); + } + function at(T, b) { + var m = b.dyn_tree, _ = b.stat_desc.static_tree, C = b.stat_desc.has_stree, D = b.stat_desc.elems, L = -1, B, q, Z; + for (T.heap_len = 0, T.heap_max = 573, B = 0; B < D; B++) + m[2 * B] === 0 ? m[2 * B + 1] = 0 : (T.heap[++T.heap_len] = L = B, T.depth[B] = 0); + for (; 2 > T.heap_len; ) + m[2 * (Z = T.heap[++T.heap_len] = 2 > L ? ++L : 0)] = 1, T.depth[Z] = 0, T.opt_len--, C && (T.static_len -= _[2 * Z + 1]); + for (b.max_code = L, B = T.heap_len >> 1; 1 <= B; B--) + Ee(T, m, B); + for (Z = D; B = T.heap[1], T.heap[1] = T.heap[T.heap_len--], Ee(T, m, 1), q = T.heap[1], T.heap[--T.heap_max] = B, T.heap[--T.heap_max] = q, m[2 * Z] = m[2 * B] + m[2 * q], T.depth[Z] = (T.depth[B] >= T.depth[q] ? T.depth[B] : T.depth[q]) + 1, m[2 * B + 1] = m[2 * q + 1] = Z, T.heap[1] = Z++, Ee(T, m, 1), 2 <= T.heap_len; ) + ; + T.heap[--T.heap_max] = T.heap[1], function(ie, se) { + var de = se.dyn_tree, Ce = se.max_code, Ve = se.stat_desc.static_tree, Je = se.stat_desc.has_stree, Pt = se.stat_desc.extra_bits, $t = se.stat_desc.extra_base, qe = se.stat_desc.max_length, Rt = 0, Zt, Jt, Xt, Qt, bi, Mi; + for (Qt = 0; Qt <= 15; Qt++) + ie.bl_count[Qt] = 0; + for (de[2 * ie.heap[ie.heap_max] + 1] = 0, Zt = ie.heap_max + 1; 573 > Zt; Zt++) + qe < (Qt = de[2 * de[2 * (Jt = ie.heap[Zt]) + 1] + 1] + 1) && (Qt = qe, Rt++), de[2 * Jt + 1] = Qt, Ce < Jt || (ie.bl_count[Qt]++, bi = 0, $t <= Jt && (bi = Pt[Jt - $t]), Mi = de[2 * Jt], ie.opt_len += Mi * (Qt + bi), Je && (ie.static_len += Mi * (Ve[2 * Jt + 1] + bi))); + if (Rt != 0) { + do { + for (Qt = qe - 1; ie.bl_count[Qt] === 0; ) + Qt--; + ie.bl_count[Qt]--, ie.bl_count[Qt + 1] += 2, ie.bl_count[qe]--, Rt -= 2; + } while (0 < Rt); + for (Qt = qe; Qt !== 0; Qt--) + for (Jt = ie.bl_count[Qt]; Jt !== 0; ) + Ce < (Xt = ie.heap[--Zt]) || (de[2 * Xt + 1] !== Qt && (ie.opt_len += (Qt - de[2 * Xt + 1]) * de[2 * Xt], de[2 * Xt + 1] = Qt), Jt--); + } + }(T, b), Tt(m, L, T.bl_count); + } + function wt(T, b, m) { + var _ = -1, C = b[1], D = 0, L = 7, B = 4, q, Z; + for (C === 0 && (L = 138, B = 3), b[2 * (m + 1) + 1] = 65535, q = 0; q <= m; q++) + Z = C, C = b[2 * (q + 1) + 1], ++D < L && Z === C || (D < B ? T.bl_tree[2 * Z] += D : Z === 0 ? 10 >= D ? T.bl_tree[34]++ : T.bl_tree[36]++ : (Z !== _ && T.bl_tree[2 * Z]++, T.bl_tree[32]++), _ = Z, B = (D = 0) === C ? (L = 138, 3) : Z === C ? (L = 6, 3) : (L = 7, 4)); + } + function st(T, b, m) { + var _ = -1, C = b[1], D = 0, L = 7, B = 4, q, Z; + for (C === 0 && (L = 138, B = 3), q = 0; q <= m; q++) + if (Z = C, C = b[2 * (q + 1) + 1], !(++D < L && Z === C)) { + if (D < B) + for (; Mt(T, Z, T.bl_tree), --D != 0; ) + ; + else + Z === 0 ? 10 >= D ? (Mt(T, 17, T.bl_tree), ft(T, D - 3, 3)) : (Mt(T, 18, T.bl_tree), ft(T, D - 11, 7)) : (Z !== _ && (Mt(T, Z, T.bl_tree), D--), Mt(T, 16, T.bl_tree), ft(T, D - 3, 2)); + _ = Z, B = (D = 0) === C ? (L = 138, 3) : Z === C ? (L = 6, 3) : (L = 7, 4); + } + } + function le(T, b, m, _) { + var C, D, L; + ft(T, 0 + (_ ? 1 : 0), 3), D = b, L = m, Nt(C = T), tt(C, L), tt(C, ~L), ct.arraySet(C.pending_buf, C.window, D, L, C.pending), C.pending += L; + } + var ct = Pe("../utils/common"), gt = 15, Ne = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], pe = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], Ae = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], it = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], yt = Array(576); + Ge(yt); + var He = Array(60); + Ge(He); + var Ft = Array(512); + Ge(Ft); + var ei = Array(256); + Ge(ei); + var mt = Array(29); + Ge(mt); + var Ue = Array(30), si, A, ve; + Ge(Ue); + var H = !1; + Re._tr_init = function(T) { + H || (function() { + var b = Array(gt + 1), m, _, C, D, L; + for (D = C = 0; 28 > D; D++) + for (mt[D] = C, m = 0; m < 1 << Ne[D]; m++) + ei[C++] = D; + for (ei[C - 1] = D, D = L = 0; 16 > D; D++) + for (Ue[D] = L, m = 0; m < 1 << pe[D]; m++) + Ft[L++] = D; + for (L >>= 7; 30 > D; D++) + for (Ue[D] = L << 7, m = 0; m < 1 << pe[D] - 7; m++) + Ft[256 + L++] = D; + for (_ = 0; _ <= gt; _++) + b[_] = 0; + for (m = 0; 143 >= m; ) + yt[2 * m + 1] = 8, m++, b[8]++; + for (; 255 >= m; ) + yt[2 * m + 1] = 9, m++, b[9]++; + for (; 279 >= m; ) + yt[2 * m + 1] = 7, m++, b[7]++; + for (; 287 >= m; ) + yt[2 * m + 1] = 8, m++, b[8]++; + for (Tt(yt, 287, b), m = 0; 30 > m; m++) + He[2 * m + 1] = 5, He[2 * m] = kt(m, 5); + si = new je(yt, Ne, 257, 286, gt), A = new je(He, pe, 0, 30, gt), ve = new je([], Ae, 0, 19, 7); + }(), H = !0), T.l_desc = new et(T.dyn_ltree, si), T.d_desc = new et(T.dyn_dtree, A), T.bl_desc = new et(T.bl_tree, ve), T.bi_buf = 0, T.bi_valid = 0, It(T); + }, Re._tr_stored_block = le, Re._tr_flush_block = function(T, b, m, _) { + var C = 0, D, L; + 0 < T.level ? (T.strm.data_type === 2 && (T.strm.data_type = function(B) { + var q = 4093624447, Z; + for (Z = 0; 31 >= Z; Z++, q >>>= 1) + if (1 & q && B.dyn_ltree[2 * Z] !== 0) + return 0; + if (B.dyn_ltree[18] !== 0 || B.dyn_ltree[20] !== 0 || B.dyn_ltree[26] !== 0) + return 1; + for (Z = 32; 256 > Z; Z++) + if (B.dyn_ltree[2 * Z] !== 0) + return 1; + return 0; + }(T)), at(T, T.l_desc), at(T, T.d_desc), C = function(B) { + var q; + for (wt(B, B.dyn_ltree, B.l_desc.max_code), wt(B, B.dyn_dtree, B.d_desc.max_code), at(B, B.bl_desc), q = 18; 3 <= q && B.bl_tree[2 * it[q] + 1] === 0; q--) + ; + return B.opt_len += 3 * (q + 1) + 5 + 5 + 4, q; + }(T), D = T.opt_len + 3 + 7 >>> 3, (L = T.static_len + 3 + 7 >>> 3) <= D && (D = L)) : D = L = m + 5, m + 4 <= D && b !== -1 ? le(T, b, m, _) : T.strategy === 4 || L === D ? (ft(T, 2 + (_ ? 1 : 0), 3), Be(T, yt, He)) : (ft(T, 4 + (_ ? 1 : 0), 3), function(B, q, Z, ie) { + var se; + for (ft(B, q - 257, 5), ft(B, Z - 1, 5), ft(B, ie - 4, 4), se = 0; se < ie; se++) + ft(B, B.bl_tree[2 * it[se] + 1], 3); + st(B, B.dyn_ltree, q - 1), st(B, B.dyn_dtree, Z - 1); + }(T, T.l_desc.max_code + 1, T.d_desc.max_code + 1, C + 1), Be(T, T.dyn_ltree, T.dyn_dtree)), It(T), _ && Nt(T); + }, Re._tr_tally = function(T, b, m) { + return T.pending_buf[T.d_buf + 2 * T.last_lit] = 255 & b >>> 8, T.pending_buf[T.d_buf + 2 * T.last_lit + 1] = 255 & b, T.pending_buf[T.l_buf + T.last_lit] = 255 & m, T.last_lit++, b === 0 ? T.dyn_ltree[2 * m]++ : (T.matches++, b--, T.dyn_ltree[2 * (ei[m] + 256 + 1)]++, T.dyn_dtree[2 * Qe(b)]++), T.last_lit === T.lit_bufsize - 1; + }, Re._tr_align = function(T) { + var b; + ft(T, 2, 3), Mt(T, 256, yt), (b = T).bi_valid === 16 ? (tt(b, b.bi_buf), b.bi_buf = 0, b.bi_valid = 0) : 8 <= b.bi_valid && (b.pending_buf[b.pending++] = 255 & b.bi_buf, b.bi_buf >>= 8, b.bi_valid -= 8); + }; + }, { "../utils/common": 41 }], 53: [function(Pe, Oe) { + Oe.exports = function() { + this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; + }; + }, {}], 54: [function(Pe, Oe) { + Oe.exports = typeof v == "function" ? v : function() { + var Re = [].slice.apply(arguments); + Re.splice(1, 0, 0), setTimeout.apply(null, Re); + }; + }, {}] }, {}, [10])(10); + }); + }).call(this, Me === void 0 ? typeof self > "u" ? typeof window > "u" ? {} : window : self : Me); + }, {}] }, {}, [1])(1); + }); + }).call(this, he === void 0 ? typeof self > "u" ? typeof window > "u" ? {} : window : self : he); + }, {}] }, {}, [1])(1); + }); + }).call(this, Y === void 0 ? typeof self > "u" ? typeof window > "u" ? {} : window : self : Y); + }, {}] }, {}, [1])(1); + }); + }).call(this, F === void 0 ? typeof self > "u" ? typeof window > "u" ? {} : window : self : F); + }, {}] }, {}, [1])(1); + }); + }).call(this, typeof p > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : p); + }, {}] }, {}, [1])(1); + }); + }).call(this); + }).call(this, typeof td > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : td, l("buffer").Buffer, l("timers").setImmediate); + }, { buffer: 8, timers: 22 }], 12: [function(l, c) { + function h() { + } + function p(X) { + if (typeof X != "function") + throw new TypeError("resolver must be a function"); + this.state = Y, this.queue = [], this.outcome = void 0, X !== h && I(this, X); + } + function y(X, Q, re) { + this.promise = X, typeof Q == "function" && (this.onFulfilled = Q, this.callFulfilled = this.otherCallFulfilled), typeof re == "function" && (this.onRejected = re, this.callRejected = this.otherCallRejected); + } + function v(X, Q, re) { + F(function() { + var he; + try { + he = Q(re); + } catch (fe) { + return k.reject(X, fe); + } + he === X ? k.reject(X, new TypeError("Cannot resolve promise with itself")) : k.resolve(X, he); + }); + } + function x(X) { + var Q = X && X.then; + if (X && (typeof X == "object" || typeof X == "function") && typeof Q == "function") + return function() { + Q.apply(X, arguments); + }; + } + function I(X, Q) { + function re(Se) { + fe || (fe = !0, k.reject(X, Se)); + } + function he(Se) { + fe || (fe = !0, k.resolve(X, Se)); + } + var fe = !1, be = P(function() { + Q(he, re); + }); + be.status === "error" && re(be.value); + } + function P(X, Q) { + var re = {}; + try { + re.value = X(Q), re.status = "success"; + } catch (he) { + re.status = "error", re.value = he; + } + return re; + } + var F = l("immediate"), k = {}, V = ["REJECTED"], j = ["FULFILLED"], Y = ["PENDING"]; + c.exports = p, p.prototype.finally = function(X) { + if (typeof X != "function") + return this; + var Q = this.constructor; + return this.then(function(re) { + return Q.resolve(X()).then(function() { + return re; + }); + }, function(re) { + return Q.resolve(X()).then(function() { + throw re; + }); + }); + }, p.prototype.catch = function(X) { + return this.then(null, X); + }, p.prototype.then = function(X, Q) { + if (typeof X != "function" && this.state === j || typeof Q != "function" && this.state === V) + return this; + var re = new this.constructor(h); + if (this.state !== Y) { + var he = this.state === j ? X : Q; + v(re, he, this.outcome); + } else + this.queue.push(new y(re, X, Q)); + return re; + }, y.prototype.callFulfilled = function(X) { + k.resolve(this.promise, X); + }, y.prototype.otherCallFulfilled = function(X) { + v(this.promise, this.onFulfilled, X); + }, y.prototype.callRejected = function(X) { + k.reject(this.promise, X); + }, y.prototype.otherCallRejected = function(X) { + v(this.promise, this.onRejected, X); + }, k.resolve = function(X, Q) { + var re = P(x, Q); + if (re.status === "error") + return k.reject(X, re.value); + var he = re.value; + if (he) + I(X, he); + else { + X.state = j, X.outcome = Q; + for (var fe = -1, be = X.queue.length; ++fe < be; ) + X.queue[fe].callFulfilled(Q); + } + return X; + }, k.reject = function(X, Q) { + X.state = V, X.outcome = Q; + for (var re = -1, he = X.queue.length; ++re < he; ) + X.queue[re].callRejected(Q); + return X; + }, p.resolve = function(X) { + return X instanceof this ? X : k.resolve(new this(h), X); + }, p.reject = function(X) { + var Q = new this(h); + return k.reject(Q, X); + }, p.all = function(X) { + function Q(J, ce) { + function xe(Pe) { + be[ce] = Pe, ++Se !== he || fe || (fe = !0, k.resolve(ke, be)); + } + re.resolve(J).then(xe, function(Pe) { + fe || (fe = !0, k.reject(ke, Pe)); + }); + } + var re = this; + if (Object.prototype.toString.call(X) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var he = X.length, fe = !1; + if (!he) + return this.resolve([]); + for (var be = Array(he), Se = 0, Me = -1, ke = new this(h); ++Me < he; ) + Q(X[Me], Me); + return ke; + }, p.race = function(X) { + function Q(Me) { + re.resolve(Me).then(function(ke) { + fe || (fe = !0, k.resolve(Se, ke)); + }, function(ke) { + fe || (fe = !0, k.reject(Se, ke)); + }); + } + var re = this; + if (Object.prototype.toString.call(X) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var he = X.length, fe = !1; + if (!he) + return this.resolve([]); + for (var be = -1, Se = new this(h); ++be < he; ) + Q(X[be]); + return Se; + }; + }, { immediate: 10 }], 13: [function(l, c) { + (function() { + function h(X, Q) { + return Object.prototype.hasOwnProperty.call(X, Q); + } + function p() { + return 1; + } + function y(X) { + Y || typeof X == "string" || typeof X == "number" || (Y = !0, console.error(new TypeError("LRU: key must be a string or number. Almost certainly a bug! " + typeof X).stack)); + } + function v(X) { + return this instanceof v ? (typeof X == "number" && (X = { max: X }), !X && (X = {}), this._max = X.max, (!this._max || typeof this._max != "number" || 0 >= this._max) && (this._max = 1 / 0), this._lengthCalculator = X.length || p, typeof this._lengthCalculator != "function" && (this._lengthCalculator = p), this._allowStale = X.stale || !1, this._maxAge = X.maxAge || null, this._dispose = X.dispose, void this.reset()) : new v(X); + } + function x(X, Q, re) { + y(Q); + var he = X._cache[Q]; + return he && (I(X, he) ? (V(X, he), !X._allowStale && (he = void 0)) : re && P(X, he), he && (he = he.value)), he; + } + function I(X, Q) { + if (!Q || !Q.maxAge && !X._maxAge) + return !1; + var re = !1, he = Date.now() - Q.now; + return re = Q.maxAge ? he > Q.maxAge : X._maxAge && he > X._maxAge, re; + } + function P(X, Q) { + k(X, Q), Q.lu = X._mru++, X._lruList[Q.lu] = Q; + } + function F(X) { + for (; X._lru < X._mru && X._length > X._max; ) + V(X, X._lruList[X._lru]); + } + function k(X, Q) { + for (delete X._lruList[Q.lu]; X._lru < X._mru && !X._lruList[X._lru]; ) + X._lru++; + } + function V(X, Q) { + Q && (X._dispose && X._dispose(Q.key, Q.value), X._length -= Q.length, X._itemCount--, delete X._cache[Q.key], k(X, Q)); + } + function j(X, Q, re, he, fe, be) { + this.key = X, this.value = Q, this.lu = re, this.length = he, this.now = fe, be && (this.maxAge = be); + } + typeof c == "object" && c.exports ? c.exports = v : this.LRUCache = v; + var Y = !1; + Object.defineProperty(v.prototype, "max", { set: function(X) { + X && typeof X == "number" && !(0 >= X) || (X = 1 / 0), this._max = X, this._length > this._max && F(this); + }, get: function() { + return this._max; + }, enumerable: !0 }), Object.defineProperty(v.prototype, "lengthCalculator", { set: function(X) { + if (typeof X != "function") + for (var Q in this._lengthCalculator = p, this._length = this._itemCount, this._cache) + this._cache[Q].length = 1; + else + for (var Q in this._lengthCalculator = X, this._length = 0, this._cache) + this._cache[Q].length = this._lengthCalculator(this._cache[Q].value), this._length += this._cache[Q].length; + this._length > this._max && F(this); + }, get: function() { + return this._lengthCalculator; + }, enumerable: !0 }), Object.defineProperty(v.prototype, "length", { get: function() { + return this._length; + }, enumerable: !0 }), Object.defineProperty(v.prototype, "itemCount", { get: function() { + return this._itemCount; + }, enumerable: !0 }), v.prototype.forEach = function(X, Q) { + Q = Q || this; + for (var re = 0, he = this._itemCount, fe = this._mru - 1; 0 <= fe && re < he; fe--) + if (this._lruList[fe]) { + re++; + var be = this._lruList[fe]; + I(this, be) && (V(this, be), !this._allowStale && (be = void 0)), be && X.call(Q, be.value, be.key, this); + } + }, v.prototype.keys = function() { + for (var X = Array(this._itemCount), Q = 0, re = this._mru - 1; 0 <= re && Q < this._itemCount; re--) + if (this._lruList[re]) { + var he = this._lruList[re]; + X[Q++] = he.key; + } + return X; + }, v.prototype.values = function() { + for (var X = Array(this._itemCount), Q = 0, re = this._mru - 1; 0 <= re && Q < this._itemCount; re--) + if (this._lruList[re]) { + var he = this._lruList[re]; + X[Q++] = he.value; + } + return X; + }, v.prototype.reset = function() { + if (this._dispose && this._cache) + for (var X in this._cache) + this._dispose(X, this._cache[X].value); + this._cache = /* @__PURE__ */ Object.create(null), this._lruList = /* @__PURE__ */ Object.create(null), this._mru = 0, this._lru = 0, this._length = 0, this._itemCount = 0; + }, v.prototype.dump = function() { + for (var X = [], Q = 0, re = this._mru - 1; 0 <= re && Q < this._itemCount; re--) + if (this._lruList[re]) { + var he = this._lruList[re]; + I(this, he) || (++Q, X.push({ k: he.key, v: he.value, e: he.now + (he.maxAge || 0) })); + } + return X; + }, v.prototype.dumpLru = function() { + return this._lruList; + }, v.prototype.set = function(X, Q, re) { + re = re || this._maxAge, y(X); + var he = re ? Date.now() : 0, fe = this._lengthCalculator(Q); + if (h(this._cache, X)) + return fe > this._max ? (V(this, this._cache[X]), !1) : (this._dispose && this._dispose(X, this._cache[X].value), this._cache[X].now = he, this._cache[X].maxAge = re, this._cache[X].value = Q, this._length += fe - this._cache[X].length, this._cache[X].length = fe, this.get(X), this._length > this._max && F(this), !0); + var be = new j(X, Q, this._mru++, fe, he, re); + return be.length > this._max ? (this._dispose && this._dispose(X, Q), !1) : (this._length += be.length, this._lruList[be.lu] = this._cache[X] = be, this._itemCount++, this._length > this._max && F(this), !0); + }, v.prototype.has = function(X) { + if (y(X), !h(this._cache, X)) + return !1; + var Q = this._cache[X]; + return !I(this, Q); + }, v.prototype.get = function(X) { + return y(X), x(this, X, !0); + }, v.prototype.peek = function(X) { + return y(X), x(this, X, !1); + }, v.prototype.pop = function() { + var X = this._lruList[this._lru]; + return V(this, X), X || null; + }, v.prototype.del = function(X) { + y(X), V(this, this._cache[X]); + }, v.prototype.load = function(X) { + this.reset(); + for (var Q = Date.now(), re = X.length - 1, he; 0 <= re; re--) { + he = X[re], y(he.k); + var fe = he.e || 0; + if (fe === 0) + this.set(he.k, he.v); + else { + var be = fe - Q; + 0 < be && this.set(he.k, he.v, be); + } + } + }; + })(); + }, {}], 14: [function(l, c) { + function h(x) { + var I = new y(), P = I.write(x) + I.end(); + return P.replace(/\0/g, "").trim(); + } + function p(x, I) { + if (!x) + return h; + try { + new TextDecoder(x.trim()); + } catch { + var P = v.exec(x); + return P && !I ? p("windows-" + P[1], !0) : h; + } + return function(F) { + var k = new TextDecoder(x), V = k.decode(F, { stream: !0 }) + k.decode(); + return V.replace(/\0/g, "").trim(); + }; + } + l("text-encoding-polyfill"); + var y = l("string_decoder").StringDecoder; + c.exports = p; + var v = /^(?:ANSI\s)?(\d+)$/m; + }, { string_decoder: 19, "text-encoding-polyfill": 20 }], 15: [function(l, c) { + function h(I) { + var P = { lastUpdated: new Date(I.readUInt8(1) + 1900, I.readUInt8(2), I.readUInt8(3)), records: I.readUInt32LE(4), headerLen: I.readUInt16LE(8), recLen: I.readUInt16LE(10) }; + return P; + } + function p(I, P, F) { + for (var k = [], V = 32; V < P && (k.push({ name: F(I.slice(V, V + 11)), dataType: o(I.readUInt8(V + 11)), len: I.readUInt8(V + 16), decimal: I.readUInt8(V + 17) }), I.readUInt8(V + 32) !== 13); ) + V += 32; + return k; + } + function y(I, P, F, k, V) { + var j = I.slice(P, P + F), Y = V(j); + return k === "N" || k === "F" || k === "O" ? parseFloat(Y, 10) : k === "D" ? new Date(Y.slice(0, 4), parseInt(Y.slice(4, 6), 10) - 1, Y.slice(6, 8)) : k === "L" ? Y.toLowerCase() === "y" || Y.toLowerCase() === "t" : Y; + } + function v(I, P, F, k) { + for (var V = {}, j = 0, Y = F.length, X, Q; j < Y; ) + Q = F[j], X = y(I, P, Q.len, Q.dataType, k), P += Q.len, typeof X < "u" && (V[Q.name] = X), j++; + return V; + } + var x = l("./decoder"); + c.exports = function(I, P) { + for (var F = x(P), k = h(I), V = p(I, k.headerLen - 1, F), j = (V.length + 1 << 5) + 2, Y = k.recLen, X = k.records, Q = []; X; ) + Q.push(v(I, j, V, F)), j += Y, X--; + return Q; + }; + }, { "./decoder": 14 }], 16: [function(l, c) { + function h() { + throw new Error("setTimeout has not been defined"); + } + function p() { + throw new Error("clearTimeout has not been defined"); + } + function y(he) { + if (V === setTimeout) + return setTimeout(he, 0); + if ((V === h || !V) && setTimeout) + return V = setTimeout, setTimeout(he, 0); + try { + return V(he, 0); + } catch { + try { + return V.call(null, he, 0); + } catch { + return V.call(this, he, 0); + } + } + } + function v(he) { + if (j === clearTimeout) + return clearTimeout(he); + if ((j === p || !j) && clearTimeout) + return j = clearTimeout, clearTimeout(he); + try { + return j(he); + } catch { + try { + return j.call(null, he); + } catch { + return j.call(this, he); + } + } + } + function x() { + X && re && (X = !1, re.length ? Y = re.concat(Y) : Q = -1, Y.length && I()); + } + function I() { + if (!X) { + var he = y(x); + X = !0; + for (var fe = Y.length; fe; ) { + for (re = Y, Y = []; ++Q < fe; ) + re && re[Q].run(); + Q = -1, fe = Y.length; + } + re = null, X = !1, v(he); + } + } + function P(he, fe) { + this.fun = he, this.array = fe; + } + function F() { + } + var k = c.exports = {}, V, j; + (function() { + try { + V = typeof setTimeout == "function" ? setTimeout : h; + } catch { + V = h; + } + try { + j = typeof clearTimeout == "function" ? clearTimeout : p; + } catch { + j = p; + } + })(); + var Y = [], X = !1, Q = -1, re; + k.nextTick = function(he) { + var fe = Array(arguments.length - 1); + if (1 < arguments.length) + for (var be = 1; be < arguments.length; be++) + fe[be - 1] = arguments[be]; + Y.push(new P(he, fe)), Y.length !== 1 || X || y(I); + }, P.prototype.run = function() { + this.fun.apply(null, this.array); + }, k.title = "browser", k.browser = !0, k.env = {}, k.argv = [], k.version = "", k.versions = {}, k.on = F, k.addListener = F, k.once = F, k.off = F, k.removeListener = F, k.removeAllListeners = F, k.emit = F, k.prependListener = F, k.prependOnceListener = F, k.listeners = function() { + return []; + }, k.binding = function() { + throw new Error("process.binding is not supported"); + }, k.cwd = function() { + return "/"; + }, k.chdir = function() { + throw new Error("process.chdir is not supported"); + }, k.umask = function() { + return 0; + }; + }, {}], 17: [function(l, c, h) { + (function(p, y) { + typeof h == "object" && typeof c < "u" ? c.exports = y() : p.proj4 = y(); + })(this, function() { + var p = Math.asin, y = Math.acos, v = Number.NaN, x = Math.atan2, I = Math.round, P = Math.PI, F = Math.atan, k = Math.exp, V = Math.tan, j = Math.sin, Y = Math.cos, X = Math.sqrt; + function Q(ge, Le) { + if (ge[Le]) + return ge[Le]; + for (var Ye = Object.keys(ge), xt = Le.toLowerCase().replace(Cn, ""), oe = -1, ee, ae; ++oe < Ye.length; ) + if (ee = Ye[oe], ae = ee.toLowerCase().replace(Cn, ""), ae === xt) + return ge[ee]; + } + function re(ge) { + if (typeof ge != "string") + throw new Error("not a string"); + this.text = ge.trim(), this.level = 0, this.place = 0, this.root = null, this.stack = [], this.currentObject = null, this.state = 1; + } + function he(ge) { + var Le = new re(ge); + return Le.output(); + } + function fe(ge, Le, Ye) { + Array.isArray(Le) && (Ye.unshift(Le), Le = null); + var xt = Le ? {} : ge, oe = Ye.reduce(function(ee, ae) { + return be(ae, ee), ee; + }, xt); + Le && (ge[Le] = oe); + } + function be(ge, Le) { + if (!Array.isArray(ge)) + return void (Le[ge] = !0); + var Ye = ge.shift(); + if (Ye === "PARAMETER" && (Ye = ge.shift()), ge.length === 1) + return Array.isArray(ge[0]) ? (Le[Ye] = {}, void be(ge[0], Le[Ye])) : void (Le[Ye] = ge[0]); + if (!ge.length) + return void (Le[Ye] = !0); + if (Ye === "TOWGS84") + return void (Le[Ye] = ge); + if (Ye === "AXIS") + return Ye in Le || (Le[Ye] = []), void Le[Ye].push(ge); + Array.isArray(Ye) || (Le[Ye] = {}); + var xt; + switch (Ye) { + case "UNIT": + case "PRIMEM": + case "VERT_DATUM": + return Le[Ye] = { name: ge[0].toLowerCase(), convert: ge[1] }, void (ge.length === 3 && be(ge[2], Le[Ye])); + case "SPHEROID": + case "ELLIPSOID": + return Le[Ye] = { name: ge[0], a: ge[1], rf: ge[2] }, void (ge.length === 4 && be(ge[3], Le[Ye])); + case "PROJECTEDCRS": + case "PROJCRS": + case "GEOGCS": + case "GEOCCS": + case "PROJCS": + case "LOCAL_CS": + case "GEODCRS": + case "GEODETICCRS": + case "GEODETICDATUM": + case "EDATUM": + case "ENGINEERINGDATUM": + case "VERT_CS": + case "VERTCRS": + case "VERTICALCRS": + case "COMPD_CS": + case "COMPOUNDCRS": + case "ENGINEERINGCRS": + case "ENGCRS": + case "FITTED_CS": + case "LOCAL_DATUM": + case "DATUM": + return ge[0] = ["name", ge[0]], void fe(Le, Ye, ge); + default: + for (xt = -1; ++xt < ge.length; ) + if (!Array.isArray(ge[xt])) + return be(ge, Le[Ye]); + return fe(Le, Ye, ge); + } + } + function Se(ge, Le) { + var Ye = Le[0], xt = Le[1]; + !(Ye in ge) && xt in ge && (ge[Ye] = ge[xt], Le.length === 3 && (ge[Ye] = Le[2](ge[Ye]))); + } + function Me(ge) { + return ge * _t; + } + function ke(ge) { + function Le(ye) { + var Ie = ge.to_meter || 1; + return ye * Ie; + } + if (ge.type === "GEOGCS" ? ge.projName = "longlat" : ge.type === "LOCAL_CS" ? (ge.projName = "identity", ge.local = !0) : typeof ge.PROJECTION == "object" ? ge.projName = Object.keys(ge.PROJECTION)[0] : ge.projName = ge.PROJECTION, ge.AXIS) { + for (var Ye = "", xt = 0, oe = ge.AXIS.length, ee; xt < oe; ++xt) + ee = [ge.AXIS[xt][0].toLowerCase(), ge.AXIS[xt][1].toLowerCase()], ee[0].indexOf("north") !== -1 || (ee[0] === "y" || ee[0] === "lat") && ee[1] === "north" ? Ye += "n" : ee[0].indexOf("south") !== -1 || (ee[0] === "y" || ee[0] === "lat") && ee[1] === "south" ? Ye += "s" : ee[0].indexOf("east") !== -1 || (ee[0] === "x" || ee[0] === "lon") && ee[1] === "east" ? Ye += "e" : (ee[0].indexOf("west") !== -1 || (ee[0] === "x" || ee[0] === "lon") && ee[1] === "west") && (Ye += "w"); + Ye.length === 2 && (Ye += "u"), Ye.length === 3 && (ge.axis = Ye); + } + ge.UNIT && (ge.units = ge.UNIT.name.toLowerCase(), ge.units === "metre" && (ge.units = "meter"), ge.UNIT.convert && (ge.type === "GEOGCS" ? ge.DATUM && ge.DATUM.SPHEROID && (ge.to_meter = ge.UNIT.convert * ge.DATUM.SPHEROID.a) : ge.to_meter = ge.UNIT.convert)); + var ae = ge.GEOGCS; + ge.type === "GEOGCS" && (ae = ge), ae && (ge.datumCode = ae.DATUM ? ae.DATUM.name.toLowerCase() : ae.name.toLowerCase(), ge.datumCode.slice(0, 2) === "d_" && (ge.datumCode = ge.datumCode.slice(2)), (ge.datumCode === "new_zealand_geodetic_datum_1949" || ge.datumCode === "new_zealand_1949") && (ge.datumCode = "nzgd49"), (ge.datumCode === "wgs_1984" || ge.datumCode === "world_geodetic_system_1984") && (ge.PROJECTION === "Mercator_Auxiliary_Sphere" && (ge.sphere = !0), ge.datumCode = "wgs84"), ge.datumCode.slice(-6) === "_ferro" && (ge.datumCode = ge.datumCode.slice(0, -6)), ge.datumCode.slice(-8) === "_jakarta" && (ge.datumCode = ge.datumCode.slice(0, -8)), ~ge.datumCode.indexOf("belge") && (ge.datumCode = "rnb72"), ae.DATUM && ae.DATUM.SPHEROID && (ge.ellps = ae.DATUM.SPHEROID.name.replace("_19", "").replace(/[Cc]larke\_18/, "clrk"), ge.ellps.toLowerCase().slice(0, 13) === "international" && (ge.ellps = "intl"), ge.a = ae.DATUM.SPHEROID.a, ge.rf = parseFloat(ae.DATUM.SPHEROID.rf, 10)), ae.DATUM && ae.DATUM.TOWGS84 && (ge.datum_params = ae.DATUM.TOWGS84), ~ge.datumCode.indexOf("osgb_1936") && (ge.datumCode = "osgb36"), ~ge.datumCode.indexOf("osni_1952") && (ge.datumCode = "osni52"), (~ge.datumCode.indexOf("tm65") || ~ge.datumCode.indexOf("geodetic_datum_of_1965")) && (ge.datumCode = "ire65"), ge.datumCode === "ch1903+" && (ge.datumCode = "ch1903"), ~ge.datumCode.indexOf("israel") && (ge.datumCode = "isr93")), ge.b && !isFinite(ge.b) && (ge.b = ge.a), [["standard_parallel_1", "Standard_Parallel_1"], ["standard_parallel_1", "Latitude of 1st standard parallel"], ["standard_parallel_2", "Standard_Parallel_2"], ["standard_parallel_2", "Latitude of 2nd standard parallel"], ["false_easting", "False_Easting"], ["false_easting", "False easting"], ["false-easting", "Easting at false origin"], ["false_northing", "False_Northing"], ["false_northing", "False northing"], ["false_northing", "Northing at false origin"], ["central_meridian", "Central_Meridian"], ["central_meridian", "Longitude of natural origin"], ["central_meridian", "Longitude of false origin"], ["latitude_of_origin", "Latitude_Of_Origin"], ["latitude_of_origin", "Central_Parallel"], ["latitude_of_origin", "Latitude of natural origin"], ["latitude_of_origin", "Latitude of false origin"], ["scale_factor", "Scale_Factor"], ["k0", "scale_factor"], ["latitude_of_center", "Latitude_Of_Center"], ["latitude_of_center", "Latitude_of_center"], ["lat0", "latitude_of_center", Me], ["longitude_of_center", "Longitude_Of_Center"], ["longitude_of_center", "Longitude_of_center"], ["longc", "longitude_of_center", Me], ["x0", "false_easting", Le], ["y0", "false_northing", Le], ["long0", "central_meridian", Me], ["lat0", "latitude_of_origin", Me], ["lat0", "standard_parallel_1", Me], ["lat1", "standard_parallel_1", Me], ["lat2", "standard_parallel_2", Me], ["azimuth", "Azimuth"], ["alpha", "azimuth", Me], ["srsCode", "name"]].forEach(function(ye) { + return Se(ge, ye); + }), !ge.long0 && ge.longc && (ge.projName === "Albers_Conic_Equal_Area" || ge.projName === "Lambert_Azimuthal_Equal_Area") && (ge.long0 = ge.longc), !ge.lat_ts && ge.lat1 && (ge.projName === "Stereographic_South_Pole" || ge.projName === "Polar Stereographic (variant B)") && (ge.lat0 = Me(0 < ge.lat1 ? 90 : -90), ge.lat_ts = ge.lat1); + } + function J(ge) { + var Le = this; + if (arguments.length === 2) { + var Ye = arguments[1]; + J[ge] = typeof Ye == "string" ? Ye.charAt(0) === "+" ? Ki(arguments[1]) : Fr(arguments[1]) : Ye; + } else if (arguments.length === 1) { + if (Array.isArray(ge)) + return ge.map(function(xt) { + Array.isArray(xt) ? J.apply(Le, xt) : J(xt); + }); + if (typeof ge != "string") + "EPSG" in ge ? J["EPSG:" + ge.EPSG] = ge : "ESRI" in ge ? J["ESRI:" + ge.ESRI] = ge : "IAU2000" in ge ? J["IAU2000:" + ge.IAU2000] = ge : console.log(ge); + else if (ge in J) + return J[ge]; + } + } + function ce(ge) { + return typeof ge == "string"; + } + function xe(ge) { + return ge in J; + } + function Pe(ge) { + return ln.some(function(Le) { + return -1 < ge.indexOf(Le); + }); + } + function Oe(ge) { + var Le = Q(ge, "authority"); + if (Le) { + var Ye = Q(Le, "epsg"); + return Ye && -1 < kn.indexOf(Ye); + } + } + function Re(ge) { + var Le = Q(ge, "extension"); + return Le ? Q(Le, "proj4") : void 0; + } + function Ge(ge) { + return ge[0] === "+"; + } + function je(ge) { + if (ce(ge)) { + if (xe(ge)) + return J[ge]; + if (Pe(ge)) { + var Le = Fr(ge); + if (Oe(Le)) + return J["EPSG:3857"]; + var Ye = Re(Le); + return Ye ? Ki(Ye) : Le; + } + if (Ge(ge)) + return Ki(ge); + } else + return ge; + } + function et() { + var ge = this.b / this.a; + this.es = 1 - ge * ge, "x0" in this || (this.x0 = 0), "y0" in this || (this.y0 = 0), this.e = X(this.es), this.lat_ts ? this.sphere ? this.k0 = Y(this.lat_ts) : this.k0 = Cs(this.e, j(this.lat_ts), Y(this.lat_ts)) : !this.k0 && (this.k ? this.k0 = this.k : this.k0 = 1); + } + function Qe(ge) { + return ge; + } + function tt(ge, Le) { + var Ye = qu.length; + return ge.names ? (qu[Ye] = ge, ge.names.forEach(function(xt) { + vc[xt.toLowerCase()] = Ye; + }), this) : (console.log(Le), !0); + } + function ft(ge, Le, Ye, xt) { + var oe = ge * ge, ee = Le * Le, ae = (oe - ee) / oe, ye = 0; + xt ? (ge *= 1 - ae * (fn + ae * (jr + ae * no)), oe = ge * ge, ae = 0) : ye = X(ae); + var Ie = (oe - ee) / ee; + return { es: ae, e: ye, ep2: Ie }; + } + function Mt(ge, Le, Ye, xt, oe) { + if (!ge) { + var ee = Q(ss, xt); + ee || (ee = dd), ge = ee.a, Le = ee.b, Ye = ee.rf; + } + return Ye && !Le && (Le = (1 - 1 / Ye) * ge), (Ye === 0 || n(ge - Le) < $r) && (oe = !0, Le = ge), { a: ge, b: Le, rf: Ye, sphere: oe }; + } + function kt(ge, Le, Ye, xt, oe, ee, ae) { + var ye = {}; + return ye.datum_type = ge === void 0 || ge === "none" ? 5 : 4, Le && (ye.datum_params = Le.map(parseFloat), (ye.datum_params[0] !== 0 || ye.datum_params[1] !== 0 || ye.datum_params[2] !== 0) && (ye.datum_type = 1), 3 < ye.datum_params.length && (ye.datum_params[3] !== 0 || ye.datum_params[4] !== 0 || ye.datum_params[5] !== 0 || ye.datum_params[6] !== 0) && (ye.datum_type = 2, ye.datum_params[3] *= rr, ye.datum_params[4] *= rr, ye.datum_params[5] *= rr, ye.datum_params[6] = ye.datum_params[6] / 1e6 + 1)), ae && (ye.datum_type = 3, ye.grids = ae), ye.a = Ye, ye.b = xt, ye.es = oe, ye.ep2 = ee, ye; + } + function Tt(ge, Le) { + var Ye = new DataView(Le), xt = Ee(Ye), oe = Be(Ye, xt); + 1 < oe.nSubgrids && console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored"); + var ee = wt(Ye, oe, xt), ae = { header: oe, subgrids: ee }; + return pd[ge] = ae, ae; + } + function It(ge) { + if (ge === void 0) + return null; + var Le = ge.split(","); + return Le.map(Nt); + } + function Nt(ge) { + if (ge.length === 0) + return null; + var Le = ge[0] === "@"; + return Le && (ge = ge.slice(1)), ge === "null" ? { name: "null", mandatory: !Le, grid: null, isNull: !0 } : { name: ge, mandatory: !Le, grid: pd[ge] || null, isNull: !1 }; + } + function nt(ge) { + return ge / 3600 * P / 180; + } + function Ee(ge) { + var Le = ge.getInt32(8, !1); + return Le !== 11 && (Le = ge.getInt32(8, !0), Le !== 11 && console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"), !0); + } + function Be(ge, Le) { + return { nFields: ge.getInt32(8, Le), nSubgridFields: ge.getInt32(24, Le), nSubgrids: ge.getInt32(40, Le), shiftType: at(ge, 56, 64).trim(), fromSemiMajorAxis: ge.getFloat64(120, Le), fromSemiMinorAxis: ge.getFloat64(136, Le), toSemiMajorAxis: ge.getFloat64(152, Le), toSemiMinorAxis: ge.getFloat64(168, Le) }; + } + function at(ge, Le, Ye) { + return o.apply(null, new Uint8Array(ge.buffer.slice(Le, Ye))); + } + function wt(ge, Le, Ye) { + for (var xt = 176, oe = [], ee = 0; ee < Le.nSubgrids; ee++) { + var ae = le(ge, xt, Ye), ye = ct(ge, xt, ae, Ye), Ie = I(1 + (ae.upperLongitude - ae.lowerLongitude) / ae.longitudeInterval), We = I(1 + (ae.upperLatitude - ae.lowerLatitude) / ae.latitudeInterval); + oe.push({ ll: [nt(ae.lowerLongitude), nt(ae.lowerLatitude)], del: [nt(ae.longitudeInterval), nt(ae.latitudeInterval)], lim: [Ie, We], count: ae.gridNodeCount, cvs: st(ye) }); + } + return oe; + } + function st(ge) { + return ge.map(function(Le) { + return [nt(Le.longitudeShift), nt(Le.latitudeShift)]; + }); + } + function le(ge, Le, Ye) { + return { name: at(ge, Le + 8, Le + 16).trim(), parent: at(ge, Le + 24, Le + 24 + 8).trim(), lowerLatitude: ge.getFloat64(Le + 72, Ye), upperLatitude: ge.getFloat64(Le + 88, Ye), lowerLongitude: ge.getFloat64(Le + 104, Ye), upperLongitude: ge.getFloat64(Le + 120, Ye), latitudeInterval: ge.getFloat64(Le + 136, Ye), longitudeInterval: ge.getFloat64(Le + 152, Ye), gridNodeCount: ge.getInt32(Le + 168, Ye) }; + } + function ct(ge, Le, Ye, xt) { + for (var oe = Le + 176, ee = 16, ae = [], ye = 0, Ie; ye < Ye.gridNodeCount; ye++) + Ie = { latitudeShift: ge.getFloat32(oe + ye * ee, xt), longitudeShift: ge.getFloat32(oe + ye * ee + 4, xt), latitudeAccuracy: ge.getFloat32(oe + ye * ee + 8, xt), longitudeAccuracy: ge.getFloat32(oe + ye * ee + 12, xt) }, ae.push(Ie); + return ae; + } + function gt(ge, Le) { + if (!(this instanceof gt)) + return new gt(ge); + Le = Le || function(We) { + if (We) + throw We; + }; + var Ye = je(ge); + if (typeof Ye != "object") + return void Le(ge); + var xt = gt.projections.get(Ye.projName); + if (!xt) + return void Le(ge); + if (Ye.datumCode && Ye.datumCode !== "none") { + var oe = Q(Vd, Ye.datumCode); + oe && (Ye.datum_params = Ye.datum_params || (oe.towgs84 ? oe.towgs84.split(",") : null), Ye.ellps = oe.ellipse, Ye.datumName = oe.datumName ? oe.datumName : Ye.datumCode); + } + Ye.k0 = Ye.k0 || 1, Ye.axis = Ye.axis || "enu", Ye.ellps = Ye.ellps || "wgs84", Ye.lat1 = Ye.lat1 || Ye.lat0; + var ee = Mt(Ye.a, Ye.b, Ye.rf, Ye.ellps, Ye.sphere), ae = ft(ee.a, ee.b, ee.rf, Ye.R_A), ye = It(Ye.nadgrids), Ie = Ye.datum || kt(Ye.datumCode, Ye.datum_params, ee.a, ee.b, ae.es, ae.ep2, ye); + Un(this, Ye), Un(this, xt), this.a = ee.a, this.b = ee.b, this.rf = ee.rf, this.sphere = ee.sphere, this.es = ae.es, this.e = ae.e, this.ep2 = ae.ep2, this.datum = Ie, this.init(), Le(null, this); + } + function Ne(ge, Le) { + return ge.datum_type === Le.datum_type && !(ge.a !== Le.a || 5e-11 < n(ge.es - Le.es)) && (ge.datum_type === 1 ? ge.datum_params[0] === Le.datum_params[0] && ge.datum_params[1] === Le.datum_params[1] && ge.datum_params[2] === Le.datum_params[2] : ge.datum_type !== 2 || ge.datum_params[0] === Le.datum_params[0] && ge.datum_params[1] === Le.datum_params[1] && ge.datum_params[2] === Le.datum_params[2] && ge.datum_params[3] === Le.datum_params[3] && ge.datum_params[4] === Le.datum_params[4] && ge.datum_params[5] === Le.datum_params[5] && ge.datum_params[6] === Le.datum_params[6]); + } + function pe(ge, Le, Ye) { + var xt = ge.x, oe = ge.y, ee = ge.z ? ge.z : 0, ae, ye, Ie, We; + if (oe < -_i && oe > -1.001 * _i) + oe = -_i; + else if (oe > _i && oe < 1.001 * _i) + oe = _i; + else { + if (oe < -_i) + return { x: -1 / 0, y: -1 / 0, z: ge.z }; + if (oe > _i) + return { x: 1 / 0, y: 1 / 0, z: ge.z }; + } + return xt > P && (xt -= 2 * P), ye = j(oe), We = Y(oe), Ie = ye * ye, ae = Ye / X(1 - Le * Ie), { x: (ae + ee) * We * Y(xt), y: (ae + ee) * We * j(xt), z: (ae * (1 - Le) + ee) * ye }; + } + function Ae(ge, Le, Ye, xt) { + var oe = 1e-12, ee = ge.x, ae = ge.y, ye = ge.z ? ge.z : 0, Ie, We, Xe, lt, Et, Ht, vi, yi, Oi, zi, ar, tr, Ir, ur, Jr, on; + if (Ie = X(ee * ee + ae * ae), We = X(ee * ee + ae * ae + ye * ye), !(Ie / Ye < oe)) + ur = x(ae, ee); + else if (ur = 0, We / Ye < oe) + return Jr = _i, on = -xt, { x: ge.x, y: ge.y, z: ge.z }; + Xe = ye / We, lt = Ie / We, Et = 1 / X(1 - Le * (2 - Le) * lt * lt), yi = lt * (1 - Le) * Et, Oi = Xe * Et, Ir = 0; + do + Ir++, vi = Ye / X(1 - Le * Oi * Oi), on = Ie * yi + ye * Oi - vi * (1 - Le * Oi * Oi), Ht = Le * vi / (vi + on), Et = 1 / X(1 - Ht * (2 - Ht) * lt * lt), zi = lt * (1 - Ht) * Et, ar = Xe * Et, tr = ar * yi - zi * Oi, yi = zi, Oi = ar; + while (tr * tr > oe * oe && Ir < 30); + return Jr = F(ar / n(zi)), { x: ur, y: Jr, z: on }; + } + function it(ge, Le, Ye) { + if (Le === 1) + return { x: ge.x + Ye[0], y: ge.y + Ye[1], z: ge.z + Ye[2] }; + if (Le === 2) { + var xt = Ye[0], oe = Ye[1], ee = Ye[2], ae = Ye[3], ye = Ye[4], Ie = Ye[5], We = Ye[6]; + return { x: We * (ge.x - Ie * ge.y + ye * ge.z) + xt, y: We * (Ie * ge.x + ge.y - ae * ge.z) + oe, z: We * (-ye * ge.x + ae * ge.y + ge.z) + ee }; + } + } + function yt(ge, Le, Ye) { + if (Le === 1) + return { x: ge.x - Ye[0], y: ge.y - Ye[1], z: ge.z - Ye[2] }; + if (Le === 2) { + var xt = Ye[0], oe = Ye[1], ee = Ye[2], ae = Ye[3], ye = Ye[4], Ie = Ye[5], We = Ye[6], Xe = (ge.x - xt) / We, lt = (ge.y - oe) / We, Et = (ge.z - ee) / We; + return { x: Xe + Ie * lt - ye * Et, y: -Ie * Xe + lt + ae * Et, z: ye * Xe - ae * lt + Et }; + } + } + function He(ge) { + return ge === 1 || ge === 2; + } + function Ft(ge, Le, Ye) { + if (ge.grids === null || ge.grids.length === 0) + return console.log("Grid shift grids not found"), -1; + for (var xt = { x: -Ye.x, y: Ye.y }, oe = { x: v, y: v }, ee = [], ae = 0, ye; ae < ge.grids.length; ae++) { + if (ye = ge.grids[ae], ee.push(ye.name), ye.isNull) { + oe = xt; + break; + } + if (ye.grid === null) { + if (ye.mandatory) + return console.log("Unable to find mandatory grid '" + ye.name + "'"), -1; + continue; + } + var Ie = ye.grid.subgrids[0], We = (n(Ie.del[1]) + n(Ie.del[0])) / 1e4, Xe = Ie.ll[0] - We, lt = Ie.ll[1] - We, Et = Ie.ll[0] + (Ie.lim[0] - 1) * Ie.del[0] + We, Ht = Ie.ll[1] + (Ie.lim[1] - 1) * Ie.del[1] + We; + if (!(lt > xt.y || Xe > xt.x || Ht < xt.y || Et < xt.x) && (oe = ei(xt, Le, Ie), !isNaN(oe.x))) + break; + } + return isNaN(oe.x) ? (console.log("Failed to find a grid shift table for location '" + -xt.x * bs + " " + xt.y * bs + " tried: '" + ee + "'"), -1) : (Ye.x = -oe.x, Ye.y = oe.y, 0); + } + function ei(ge, Le, Ye) { + var xt = { x: v, y: v }; + if (isNaN(ge.x)) + return xt; + var oe = { x: ge.x, y: ge.y }; + oe.x -= Ye.ll[0], oe.y -= Ye.ll[1], oe.x = yn(oe.x - P) + P; + var ee = mt(oe, Ye); + if (Le) { + if (isNaN(ee.x)) + return xt; + ee.x = oe.x - ee.x, ee.y = oe.y - ee.y; + var ae = 9, ye = 1e-12, Ie, We; + do { + if (We = mt(ee, Ye), isNaN(We.x)) { + console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation."); + break; + } + Ie = { x: oe.x - (We.x + ee.x), y: oe.y - (We.y + ee.y) }, ee.x += Ie.x, ee.y += Ie.y; + } while (ae-- && n(Ie.x) > ye && n(Ie.y) > ye); + if (0 > ae) + return console.log("Inverse grid shift iterator failed to converge."), xt; + xt.x = yn(ee.x + Ye.ll[0]), xt.y = ee.y + Ye.ll[1]; + } else + isNaN(ee.x) || (xt.x = ge.x + ee.x, xt.y = ge.y + ee.y); + return xt; + } + function mt(ge, Le) { + var Ye = { x: ge.x / Le.del[0], y: ge.y / Le.del[1] }, xt = { x: i(Ye.x), y: i(Ye.y) }, oe = { x: Ye.x - 1 * xt.x, y: Ye.y - 1 * xt.y }, ee = { x: v, y: v }, ae; + if (0 > xt.x || xt.x >= Le.lim[0] || 0 > xt.y || xt.y >= Le.lim[1]) + return ee; + ae = xt.y * Le.lim[0] + xt.x; + var ye = { x: Le.cvs[ae][0], y: Le.cvs[ae][1] }; + ae++; + var Ie = { x: Le.cvs[ae][0], y: Le.cvs[ae][1] }; + ae += Le.lim[0]; + var We = { x: Le.cvs[ae][0], y: Le.cvs[ae][1] }; + ae--; + var Xe = { x: Le.cvs[ae][0], y: Le.cvs[ae][1] }, lt = oe.x * oe.y, Et = oe.x * (1 - oe.y), Ht = (1 - oe.x) * (1 - oe.y), vi = (1 - oe.x) * oe.y; + return ee.x = Ht * ye.x + Et * Ie.x + vi * Xe.x + lt * We.x, ee.y = Ht * ye.y + Et * Ie.y + vi * Xe.y + lt * We.y, ee; + } + function Ue(ge) { + var Le = Number.isFinite; + if (typeof Le == "function") { + if (Le(ge)) + return; + throw new TypeError("coordinates must be finite numbers"); + } + if (typeof ge != "number" || ge !== ge || !isFinite(ge)) + throw new TypeError("coordinates must be finite numbers"); + } + function si(ge, Le) { + return (ge.datum.datum_type === 1 || ge.datum.datum_type === 2) && Le.datumCode !== "WGS84" || (Le.datum.datum_type === 1 || Le.datum.datum_type === 2) && ge.datumCode !== "WGS84"; + } + function A(ge, Le, Ye) { + var xt; + if (Array.isArray(Ye) && (Ye = ii(Ye)), bt(Ye), ge.datum && Le.datum && si(ge, Le) && (xt = new gt("WGS84"), Ye = A(ge, xt, Ye), ge = xt), ge.axis !== "enu" && (Ye = Nl(ge, !1, Ye)), ge.projName === "longlat") + Ye = { x: Ye.x * Zn, y: Ye.y * Zn, z: Ye.z || 0 }; + else if (ge.to_meter && (Ye = { x: Ye.x * ge.to_meter, y: Ye.y * ge.to_meter, z: Ye.z || 0 }), Ye = ge.inverse(Ye), !Ye) + return; + return ge.from_greenwich && (Ye.x += ge.from_greenwich), Ye = cs(ge.datum, Le.datum, Ye), !Ye ? void 0 : (Le.from_greenwich && (Ye = { x: Ye.x - Le.from_greenwich, y: Ye.y, z: Ye.z || 0 }), Le.projName === "longlat" ? Ye = { x: Ye.x * bs, y: Ye.y * bs, z: Ye.z || 0 } : (Ye = Le.forward(Ye), Le.to_meter && (Ye = { x: Ye.x / Le.to_meter, y: Ye.y / Le.to_meter, z: Ye.z || 0 })), Le.axis === "enu" ? Ye : Nl(Le, !0, Ye)); + } + function ve(ge, Le, Ye) { + var xt, oe, ee; + return Array.isArray(Ye) ? (xt = A(ge, Le, Ye) || { x: NaN, y: NaN }, 2 < Ye.length ? typeof ge.name < "u" && ge.name === "geocent" || typeof Le.name < "u" && Le.name === "geocent" ? typeof xt.z == "number" ? [xt.x, xt.y, xt.z].concat(Ye.splice(3)) : [xt.x, xt.y, Ye[2]].concat(Ye.splice(3)) : [xt.x, xt.y].concat(Ye.splice(2)) : [xt.x, xt.y]) : (oe = A(ge, Le, Ye), ee = Object.keys(Ye), ee.length === 2 || ee.forEach(function(ae) { + if (typeof ge.name < "u" && ge.name === "geocent" || typeof Le.name < "u" && Le.name === "geocent") { + if (ae === "x" || ae === "y" || ae === "z") + return; + } else if (ae === "x" || ae === "y") + return; + oe[ae] = Ye[ae]; + }), oe); + } + function H(ge) { + return ge instanceof gt ? ge : ge.oProj ? ge.oProj : gt(ge); + } + function T(ge, Le, Ye) { + ge = H(ge); + var xt = !1, oe; + return typeof Le > "u" ? (Le = ge, ge = Kt, xt = !0) : (typeof Le.x < "u" || Array.isArray(Le)) && (Ye = Le, Le = ge, ge = Kt, xt = !0), Le = H(Le), Ye ? ve(ge, Le, Ye) : (oe = { forward: function(ee) { + return ve(ge, Le, ee); + }, inverse: function(ee) { + return ve(Le, ge, ee); + } }, xt && (oe.oProj = Le), oe); + } + function b(ge, Le) { + return Le = Le || 5, q(D({ lat: ge[1], lon: ge[0] }), Le); + } + function m(ge) { + var Le = L(de(ge.toUpperCase())); + return Le.lat && Le.lon ? [Le.lon, Le.lat] : [(Le.left + Le.right) / 2, (Le.top + Le.bottom) / 2]; + } + function _(ge) { + return ge * (P / 180); + } + function C(ge) { + return 180 * (ge / P); + } + function D(ge) { + var Le = ge.lat, Ye = ge.lon, xt = 6378137, oe = 669438e-8, ee = 0.9996, ae = _(Le), ye, Ie, We, Xe, lt, Et; + Et = i((Ye + 180) / 6) + 1, Ye === 180 && (Et = 60), 56 <= Le && 64 > Le && 3 <= Ye && 12 > Ye && (Et = 32), 72 <= Le && 84 > Le && (0 <= Ye && 9 > Ye ? Et = 31 : 9 <= Ye && 21 > Ye ? Et = 33 : 21 <= Ye && 33 > Ye ? Et = 35 : 33 <= Ye && 42 > Ye && (Et = 37)), ye = oe / (1 - oe), Ie = xt / X(1 - oe * j(ae) * j(ae)), We = V(ae) * V(ae), Xe = ye * Y(ae) * Y(ae), lt = xt * ((1 - oe / 4 - 3 * oe * oe / 64 - 5 * oe * oe * oe / 256) * ae - (3 * oe / 8 + 3 * oe * oe / 32 + 45 * oe * oe * oe / 1024) * j(2 * ae) + (15 * oe * oe / 256 + 45 * oe * oe * oe / 1024) * j(4 * ae) - 35 * oe * oe * oe / 3072 * j(6 * ae)); + var Ht = ee * Ie * (65 + 65 * (65 * (65 * (1 - We + Xe))) / 6 + 65 * (65 * (65 * (65 * (65 * (5 - 18 * We + We * We + 72 * Xe - 58 * ye))))) / 120) + 5e5, vi = ee * (lt + Ie * V(ae) * (4225 / 2 + 65 * (65 * (65 * (65 * (5 - We + 9 * Xe + 4 * Xe * Xe)))) / 24 + 65 * (65 * (65 * (65 * (65 * (65 * (61 - 58 * We + We * We + 600 * Xe - 330 * ye)))))) / 720)); + return 0 > Le && (vi += 1e7), { northing: I(vi), easting: I(Ht), zoneNumber: Et, zoneLetter: B(Le) }; + } + function L(ge) { + var Le = ge.northing, Ye = ge.easting, xt = ge.zoneLetter, oe = ge.zoneNumber; + if (0 > oe || 60 < oe) + return null; + var ee = 0.9996, ae = 6378137, ye = 669438e-8, Ie = (1 - X(1 - ye)) / (1 + X(1 - ye)), We = Le, Xe, lt, Et, Ht, vi, yi, Oi, zi, ar, tr; + "N" > xt && (We -= 1e7), zi = 6 * (oe - 1) - 180 + 3, Xe = ye / (1 - ye), Oi = We / ee, ar = Oi / (ae * (1 - ye / 4 - 3 * ye * ye / 64 - 5 * ye * ye * ye / 256)), tr = ar + (3 * Ie / 2 - 27 * Ie * Ie * Ie / 32) * j(2 * ar) + (21 * Ie * Ie / 16 - 55 * Ie * Ie * Ie * Ie / 32) * j(4 * ar) + 151 * Ie * Ie * Ie / 96 * j(6 * ar), lt = ae / X(1 - ye * j(tr) * j(tr)), Et = V(tr) * V(tr), Ht = Xe * Y(tr) * Y(tr), vi = ae * (1 - ye) / s(1 - ye * j(tr) * j(tr), 1.5), yi = (Ye - 5e5) / (lt * ee); + var Ir = tr - lt * V(tr) / vi * (yi * yi / 2 - (5 + 3 * Et + 10 * Ht - 4 * Ht * Ht - 9 * Xe) * yi * yi * yi * yi / 24 + (61 + 90 * Et + 298 * Ht + 45 * Et * Et - 252 * Xe - 3 * Ht * Ht) * yi * yi * yi * yi * yi * yi / 720); + Ir = C(Ir); + var ur = (yi - (1 + 2 * Et + Ht) * yi * yi * yi / 6 + (5 - 2 * Ht + 28 * Et - 3 * Ht * Ht + 8 * Xe + 24 * Et * Et) * yi * yi * yi * yi * yi / 120) / Y(tr); + ur = zi + C(ur); + var Jr; + if (ge.accuracy) { + var on = L({ northing: ge.northing + ge.accuracy, easting: ge.easting + ge.accuracy, zoneLetter: ge.zoneLetter, zoneNumber: ge.zoneNumber }); + Jr = { top: on.lat, right: on.lon, bottom: Ir, left: ur }; + } else + Jr = { lat: Ir, lon: ur }; + return Jr; + } + function B(ge) { + var Le = "Z"; + return 84 >= ge && 72 <= ge ? Le = "X" : 72 > ge && 64 <= ge ? Le = "W" : 64 > ge && 56 <= ge ? Le = "V" : 56 > ge && 48 <= ge ? Le = "U" : 48 > ge && 40 <= ge ? Le = "T" : 40 > ge && 32 <= ge ? Le = "S" : 32 > ge && 24 <= ge ? Le = "R" : 24 > ge && 16 <= ge ? Le = "Q" : 16 > ge && 8 <= ge ? Le = "P" : 8 > ge && 0 <= ge ? Le = "N" : 0 > ge && -8 <= ge ? Le = "M" : -8 > ge && -16 <= ge ? Le = "L" : -16 > ge && -24 <= ge ? Le = "K" : -24 > ge && -32 <= ge ? Le = "J" : -32 > ge && -40 <= ge ? Le = "H" : -40 > ge && -48 <= ge ? Le = "G" : -48 > ge && -56 <= ge ? Le = "F" : -56 > ge && -64 <= ge ? Le = "E" : -64 > ge && -72 <= ge ? Le = "D" : -72 > ge && -80 <= ge && (Le = "C"), Le; + } + function q(ge, Le) { + var Ye = "00000" + ge.easting, xt = "00000" + ge.northing; + return ge.zoneNumber + ge.zoneLetter + Z(ge.easting, ge.northing, ge.zoneNumber) + Ye.substr(Ye.length - 5, Le) + xt.substr(xt.length - 5, Le); + } + function Z(ge, Le, Ye) { + var xt = ie(Ye), oe = i(ge / 1e5), ee = i(Le / 1e5) % 20; + return se(oe, ee, xt); + } + function ie(ge) { + var Le = ge % 6; + return Le === 0 && (Le = 6), Le; + } + function se(ge, Le, Ye) { + var xt = Ye - 1, oe = "AJSAJS".charCodeAt(xt), ee = "AFAFAF".charCodeAt(xt), ae = oe + ge - 1, ye = ee + Le, Ie = !1; + 90 < ae && (ae = ae - 90 + 65 - 1, Ie = !0), (ae === 73 || 73 > oe && 73 < ae || (73 < ae || 73 > oe) && Ie) && ae++, (ae === 79 || 79 > oe && 79 < ae || (79 < ae || 79 > oe) && Ie) && (ae++, ae === 73 && ae++), 90 < ae && (ae = ae - 90 + 65 - 1), 86 < ye ? (ye = ye - 86 + 65 - 1, Ie = !0) : Ie = !1, (ye === 73 || 73 > ee && 73 < ye || (73 < ye || 73 > ee) && Ie) && ye++, (ye === 79 || 79 > ee && 79 < ye || (79 < ye || 79 > ee) && Ie) && (ye++, ye === 73 && ye++), 86 < ye && (ye = ye - 86 + 65 - 1); + var We = o(ae) + o(ye); + return We; + } + function de(ge) { + if (ge && ge.length === 0) + throw "MGRSPoint coverting from nothing"; + for (var Le = ge.length, Ye = null, xt = "", oe = 0, ee; !/[A-Z]/.test(ee = ge.charAt(oe)); ) { + if (2 <= oe) + throw "MGRSPoint bad conversion from: " + ge; + xt += ee, oe++; + } + var ae = parseInt(xt, 10); + if (oe === 0 || oe + 3 > Le) + throw "MGRSPoint bad conversion from: " + ge; + var ye = ge.charAt(oe++); + if ("A" >= ye || ye === "B" || ye === "Y" || "Z" <= ye || ye === "I" || ye === "O") + throw "MGRSPoint zone letter " + ye + " not handled: " + ge; + Ye = ge.substring(oe, oe += 2); + for (var Ie = ie(ae), We = Ce(Ye.charAt(0), Ie), Xe = Ve(Ye.charAt(1), Ie); Xe < Je(ye); ) + Xe += 2e6; + var lt = Le - oe; + if (lt % 2 != 0) + throw `MGRSPoint has to have an even number +of digits after the zone letter and two 100km letters - front +half for easting meters, second half for +northing meters` + ge; + var Et = lt / 2, Ht = 0, vi = 0, yi, Oi, zi, ar, tr; + return 0 < Et && (yi = 1e5 / s(10, Et), Oi = ge.substring(oe, oe + Et), Ht = parseFloat(Oi) * yi, zi = ge.substring(oe + Et), vi = parseFloat(zi) * yi), ar = Ht + We, tr = vi + Xe, { easting: ar, northing: tr, zoneLetter: ye, zoneNumber: ae, accuracy: yi }; + } + function Ce(ge, Le) { + for (var Ye = "AJSAJS".charCodeAt(Le - 1), xt = 1e5, oe = !1; Ye !== ge.charCodeAt(0); ) { + if (Ye++, Ye === 73 && Ye++, Ye === 79 && Ye++, 90 < Ye) { + if (oe) + throw "Bad character: " + ge; + Ye = 65, oe = !0; + } + xt += 1e5; + } + return xt; + } + function Ve(ge, Le) { + if ("V" < ge) + throw "MGRSPoint given invalid Northing " + ge; + for (var Ye = "AFAFAF".charCodeAt(Le - 1), xt = 0, oe = !1; Ye !== ge.charCodeAt(0); ) { + if (Ye++, Ye === 73 && Ye++, Ye === 79 && Ye++, 86 < Ye) { + if (oe) + throw "Bad character: " + ge; + Ye = 65, oe = !0; + } + xt += 1e5; + } + return xt; + } + function Je(ge) { + var Le; + if (Le = ge === "C" ? 11e5 : ge === "D" ? 2e6 : ge === "E" ? 28e5 : ge === "F" ? 37e5 : ge === "G" ? 46e5 : ge === "H" ? 55e5 : ge === "J" ? 64e5 : ge === "K" ? 73e5 : ge === "L" ? 82e5 : ge === "M" ? 91e5 : ge === "N" ? 0 : ge === "P" ? 8e5 : ge === "Q" ? 17e5 : ge === "R" ? 26e5 : ge === "S" ? 35e5 : ge === "T" ? 44e5 : ge === "U" ? 53e5 : ge === "V" ? 62e5 : ge === "W" ? 7e6 : ge === "X" ? 79e5 : -1, 0 <= Le) + return Le; + throw "Invalid zone letter: " + ge; + } + function Pt(ge, Le, Ye) { + if (!(this instanceof Pt)) + return new Pt(ge, Le, Ye); + if (Array.isArray(ge)) + this.x = ge[0], this.y = ge[1], this.z = ge[2] || 0; + else if (typeof ge == "object") + this.x = ge.x, this.y = ge.y, this.z = ge.z || 0; + else if (typeof ge == "string" && typeof Le > "u") { + var xt = ge.split(","); + this.x = parseFloat(xt[0], 10), this.y = parseFloat(xt[1], 10), this.z = parseFloat(xt[2], 10) || 0; + } else + this.x = ge, this.y = Le, this.z = Ye || 0; + console.warn("proj4.Point will be removed in version 3, use proj4.toPoint"); + } + function $t(ge) { + var Le = typeof ge.PROJECTION == "object" ? Object.keys(ge.PROJECTION)[0] : ge.PROJECTION; + return "no_uoff" in ge || "no_off" in ge || ["Hotine_Oblique_Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(Le) !== -1; + } + function qe() { + var ge = Math.pi, Le = 0, Ye = 0, xt = 0, oe = 0, ee = 0, ae = 0, ye = 0, Ie, We, Xe, lt, Et, Ht, vi, yi, Oi, zi, ar; + this.no_off = $t(this), this.no_rot = "no_rot" in this; + var tr = !1; + "alpha" in this && (tr = !0); + var Ir = !1; + if ("rectified_grid_angle" in this && (Ir = !0), tr && (ye = this.alpha), Ir && (Le = this.rectified_grid_angle * Zn), tr || Ir) + Ye = this.longc; + else if (xt = this.long1, ee = this.lat1, oe = this.long2, ae = this.lat2, n(ee - ae) <= fu || (Ie = n(ee)) <= fu || n(Ie - _i) <= fu || n(n(this.lat0) - _i) <= fu || n(n(ae) - _i) <= fu) + throw new Error(); + var ur = 1 - this.es; + We = X(ur), n(this.lat0) > $r ? (yi = j(this.lat0), Xe = Y(this.lat0), Ie = 1 - this.es * yi * yi, this.B = Xe * Xe, this.B = X(1 + this.es * this.B * this.B / ur), this.A = this.B * this.k0 * We / Ie, lt = this.B * We / (Xe * X(Ie)), Et = lt * lt - 1, 0 >= Et ? Et = 0 : (Et = X(Et), 0 > this.lat0 && (Et = -Et)), this.E = Et += lt, this.E *= s(Io(this.e, this.lat0, yi), this.B)) : (this.B = 1 / We, this.A = this.k0, this.E = lt = Et = 1), tr || Ir ? (tr ? (ar = p(j(ye) / lt), !Ir && (Le = ye)) : (ar = Le, ye = p(lt * j(ar))), this.lam0 = Ye - p(0.5 * (Et - 1 / Et) * V(ar)) / this.B) : (Ht = s(Io(this.e, ee, j(ee)), this.B), vi = s(Io(this.e, ae, j(ae)), this.B), Et = this.E / Ht, Oi = (vi - Ht) / (vi + Ht), zi = this.E * this.E, zi = (zi - vi * Ht) / (zi + vi * Ht), Ie = xt - oe, Ie < -ge ? oe -= Jn : Ie > ge && (oe += Jn), this.lam0 = yn(0.5 * (xt + oe) - F(zi * V(0.5 * this.B * (xt - oe)) / Oi) / this.B), ar = F(2 * j(this.B * yn(xt - this.lam0)) / (Et - 1 / Et)), Le = ye = p(lt * j(ar))), this.singam = j(ar), this.cosgam = Y(ar), this.sinrot = j(Le), this.cosrot = Y(Le), this.rB = 1 / this.B, this.ArB = this.A * this.rB, this.BrA = 1 / this.ArB, this.no_off ? this.u_0 = 0 : (this.u_0 = n(this.ArB * F(X(lt * lt - 1) / Y(ye))), 0 > this.lat0 && (this.u_0 = -this.u_0)), Et = 0.5 * ar, this.v_pole_n = this.ArB * r(V(On - Et)), this.v_pole_s = this.ArB * r(V(On + Et)); + } + function Rt(ge) { + var Le = [], Ye; + return Le[0] = ge * ag, Ye = ge * ge, Le[0] += Ye * lg, Le[1] = Ye * ha, Ye *= ge, Le[0] += Ye * jd, Le[1] += Ye * Nf, Le[2] = Ye * al, Le; + } + function Zt(ge, Le) { + var Ye = ge + ge; + return ge + Le[0] * j(Ye) + Le[1] * j(Ye + Ye) + Le[2] * j(Ye + Ye + Ye); + } + function Jt(ge, Le, Ye, xt) { + var oe; + return ge < $r ? (xt.value = Ba.AREA_0, oe = 0) : (oe = x(Le, Ye), n(oe) <= On ? xt.value = Ba.AREA_0 : oe > On && oe <= _i + On ? (xt.value = Ba.AREA_1, oe -= _i) : oe > _i + On || oe <= -(_i + On) ? (xt.value = Ba.AREA_2, oe = 0 <= oe ? oe - ki : oe + ki) : (xt.value = Ba.AREA_3, oe += _i)), oe; + } + function Xt(ge, Le) { + var Ye = ge + Le; + return Ye < -ki ? Ye += Jn : Ye > +ki && (Ye -= Jn), Ye; + } + function Qt(ge, Le, Ye, xt) { + for (var oe = Le, ee; xt && (ee = ge(oe), oe -= ee, !(n(ee) < Ye)); --xt) + ; + return oe; + } + var bi = 3, Mi = 5, Ri = 6378137, Yi = 0.0066943799901413165, rr = 484813681109536e-20, _i = P / 2, fn = 0.16666666666666666, jr = 0.04722222222222222, no = 0.022156084656084655, $r = 1e-10, Zn = 0.017453292519943295, bs = 57.29577951308232, On = P / 4, Jn = 2 * P, ki = 3.14159265359, Ur = {}; + Ur.greenwich = 0, Ur.lisbon = -9.131906111111, Ur.paris = 2.337229166667, Ur.bogota = -74.080916666667, Ur.madrid = -3.687938888889, Ur.rome = 12.452333333333, Ur.bern = 7.439583333333, Ur.jakarta = 106.807719444444, Ur.ferro = -17.666666666667, Ur.brussels = 4.367975, Ur.stockholm = 18.058277777778, Ur.athens = 23.7163375, Ur.oslo = 10.722916666667; + var So = { ft: { to_meter: 0.3048 }, "us-ft": { to_meter: 1200 / 3937 } }, Cn = /[\s_\-\/\(\)]/g, Ki = function(ge) { + var Le = {}, Ye = ge.split("+").map(function(ye) { + return ye.trim(); + }).filter(function(ye) { + return ye; + }).reduce(function(ye, Ie) { + var We = Ie.split("="); + return We.push(!0), ye[We[0].toLowerCase()] = We[1], ye; + }, {}), xt = { proj: "projName", datum: "datumCode", rf: function(ye) { + Le.rf = parseFloat(ye); + }, lat_0: function(ye) { + Le.lat0 = ye * Zn; + }, lat_1: function(ye) { + Le.lat1 = ye * Zn; + }, lat_2: function(ye) { + Le.lat2 = ye * Zn; + }, lat_ts: function(ye) { + Le.lat_ts = ye * Zn; + }, lon_0: function(ye) { + Le.long0 = ye * Zn; + }, lon_1: function(ye) { + Le.long1 = ye * Zn; + }, lon_2: function(ye) { + Le.long2 = ye * Zn; + }, alpha: function(ye) { + Le.alpha = parseFloat(ye) * Zn; + }, gamma: function(ye) { + Le.rectified_grid_angle = parseFloat(ye); + }, lonc: function(ye) { + Le.longc = ye * Zn; + }, x_0: function(ye) { + Le.x0 = parseFloat(ye); + }, y_0: function(ye) { + Le.y0 = parseFloat(ye); + }, k_0: function(ye) { + Le.k0 = parseFloat(ye); + }, k: function(ye) { + Le.k0 = parseFloat(ye); + }, a: function(ye) { + Le.a = parseFloat(ye); + }, b: function(ye) { + Le.b = parseFloat(ye); + }, r_a: function() { + Le.R_A = !0; + }, zone: function(ye) { + Le.zone = parseInt(ye, 10); + }, south: function() { + Le.utmSouth = !0; + }, towgs84: function(ye) { + Le.datum_params = ye.split(",").map(function(Ie) { + return parseFloat(Ie); + }); + }, to_meter: function(ye) { + Le.to_meter = parseFloat(ye); + }, units: function(ye) { + Le.units = ye; + var Ie = Q(So, ye); + Ie && (Le.to_meter = Ie.to_meter); + }, from_greenwich: function(ye) { + Le.from_greenwich = ye * Zn; + }, pm: function(ye) { + var Ie = Q(Ur, ye); + Le.from_greenwich = (Ie || parseFloat(ye)) * Zn; + }, nadgrids: function(ye) { + ye === "@null" ? Le.datumCode = "none" : Le.nadgrids = ye; + }, axis: function(ye) { + ye.length === 3 && "ewnsud".indexOf(ye.substr(0, 1)) !== -1 && "ewnsud".indexOf(ye.substr(1, 1)) !== -1 && "ewnsud".indexOf(ye.substr(2, 1)) !== -1 && (Le.axis = ye); + }, approx: function() { + Le.approx = !0; + } }, oe, ee, ae; + for (oe in Ye) + ee = Ye[oe], oe in xt ? (ae = xt[oe], typeof ae == "function" ? ae(ee) : Le[ae] = ee) : Le[oe] = ee; + return typeof Le.datumCode == "string" && Le.datumCode !== "WGS84" && (Le.datumCode = Le.datumCode.toLowerCase()), Le; + }, ui = 1, W = 2, Cr = 3, ia = 4, Ho = 5, Ut = -1, Ca = /[,\]]/, xi = /[\d\.E\-\+]/; + re.prototype.readCharicter = function() { + var ge = this.text[this.place++]; + if (this.state !== ia) + for (; /\s/.test(ge); ) { + if (this.place >= this.text.length) + return; + ge = this.text[this.place++]; + } + switch (this.state) { + case ui: + return this.neutral(ge); + case W: + return this.keyword(ge); + case ia: + return this.quoted(ge); + case Ho: + return this.afterquote(ge); + case Cr: + return this.number(ge); + } + }, re.prototype.afterquote = function(ge) { + if (ge === '"') + return this.word += '"', void (this.state = ia); + if (Ca.test(ge)) + return this.word = this.word.trim(), void this.afterItem(ge); + throw new Error(`havn't handled "` + ge + '" in afterquote yet, index ' + this.place); + }, re.prototype.afterItem = function(ge) { + return ge === "," ? (this.word !== null && this.currentObject.push(this.word), this.word = null, void (this.state = ui)) : ge === "]" ? (this.level--, this.word !== null && (this.currentObject.push(this.word), this.word = null), this.state = ui, this.currentObject = this.stack.pop(), void (this.currentObject || (this.state = Ut))) : void 0; + }, re.prototype.number = function(ge) { + if (xi.test(ge)) + return void (this.word += ge); + if (Ca.test(ge)) + return this.word = parseFloat(this.word), void this.afterItem(ge); + throw new Error(`havn't handled "` + ge + '" in number yet, index ' + this.place); + }, re.prototype.quoted = function(ge) { + return ge === '"' ? void (this.state = Ho) : void (this.word += ge); + }, re.prototype.keyword = function(ge) { + if (/[A-Za-z84]/.test(ge)) + return void (this.word += ge); + if (ge === "[") { + var Le = []; + return Le.push(this.word), this.level++, this.root === null ? this.root = Le : this.currentObject.push(Le), this.stack.push(this.currentObject), this.currentObject = Le, void (this.state = ui); + } + if (Ca.test(ge)) + return void this.afterItem(ge); + throw new Error(`havn't handled "` + ge + '" in keyword yet, index ' + this.place); + }, re.prototype.neutral = function(ge) { + if (/[A-Za-z]/.test(ge)) + return this.word = ge, void (this.state = W); + if (ge === '"') + return this.word = "", void (this.state = ia); + if (xi.test(ge)) + return this.word = ge, void (this.state = Cr); + if (Ca.test(ge)) + return void this.afterItem(ge); + throw new Error(`havn't handled "` + ge + '" in neutral yet, index ' + this.place); + }, re.prototype.output = function() { + for (; this.place < this.text.length; ) + this.readCharicter(); + if (this.state === Ut) + return this.root; + throw new Error('unable to parse string "' + this.text + '". State is ' + this.state); + }; + var _t = 0.017453292519943295, Fr = function(ge) { + var Le = he(ge), Ye = Le.shift(), xt = Le.shift(); + Le.unshift(["name", xt]), Le.unshift(["type", Ye]); + var oe = {}; + return be(Le, oe), ke(oe), oe; + }; + (function(ge) { + ge("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), ge("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), ge("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"), ge.WGS84 = ge["EPSG:4326"], ge["EPSG:3785"] = ge["EPSG:3857"], ge.GOOGLE = ge["EPSG:3857"], ge["EPSG:900913"] = ge["EPSG:3857"], ge["EPSG:102113"] = ge["EPSG:3857"]; + })(J); + var ln = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"], kn = ["3857", "900913", "3785", "102113"], Un = function(ge, Le) { + ge = ge || {}; + var Ye, xt; + if (!Le) + return ge; + for (xt in Le) + Ye = Le[xt], Ye !== void 0 && (ge[xt] = Ye); + return ge; + }, Cs = function(ge, Le, Ye) { + var xt = ge * Le; + return Ye / X(1 - xt * xt); + }, ra = function(ge) { + return 0 > ge ? -1 : 1; + }, yn = function(ge) { + return n(ge) <= ki ? ge : ge - ra(ge) * Jn; + }, Io = function(ge, Le, Ye) { + var xt = ge * Ye; + return xt = s((1 - xt) / (1 + xt), 0.5 * ge), V(0.5 * (_i - Le)) / xt; + }, oh = function(ge, Le) { + for (var Ye = _i - 2 * F(Le), xt = 0, oe, ee; 15 >= xt; xt++) + if (oe = ge * j(Ye), ee = _i - 2 * F(Le * s((1 - oe) / (1 + oe), 0.5 * ge)) - Ye, Ye += ee, 1e-10 >= n(ee)) + return Ye; + return -9999; + }, gh = [{ init: et, forward: function(ge) { + var Le = ge.x, Ye = ge.y; + if (90 < Ye * bs && -90 > Ye * bs && 180 < Le * bs && -180 > Le * bs) + return null; + var xt, oe; + if (n(n(Ye) - _i) <= $r) + return null; + if (this.sphere) + xt = this.x0 + this.a * this.k0 * yn(Le - this.long0), oe = this.y0 + this.a * this.k0 * r(V(On + 0.5 * Ye)); + else { + var ee = j(Ye), ae = Io(this.e, Ye, ee); + xt = this.x0 + this.a * this.k0 * yn(Le - this.long0), oe = this.y0 - this.a * this.k0 * r(ae); + } + return ge.x = xt, ge.y = oe, ge; + }, inverse: function(ge) { + var Le = ge.x - this.x0, Ye = ge.y - this.y0, xt, oe; + if (this.sphere) + oe = _i - 2 * F(k(-Ye / (this.a * this.k0))); + else { + var ee = k(-Ye / (this.a * this.k0)); + if (oe = oh(this.e, ee), oe === -9999) + return null; + } + return xt = yn(this.long0 + Le / (this.a * this.k0)), ge.x = xt, ge.y = oe, ge; + }, names: ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"] }, { init: function() { + }, forward: Qe, inverse: Qe, names: ["longlat", "identity"] }], vc = {}, qu = [], ss = {}; + ss.MERIT = { a: 6378137, rf: 298.257, ellipseName: "MERIT 1983" }, ss.SGS85 = { a: 6378136, rf: 298.257, ellipseName: "Soviet Geodetic System 85" }, ss.GRS80 = { a: 6378137, rf: 298.257222101, ellipseName: "GRS 1980(IUGG, 1980)" }, ss.IAU76 = { a: 6378140, rf: 298.257, ellipseName: "IAU 1976" }, ss.airy = { a: 6377563396e-3, b: 635625691e-2, ellipseName: "Airy 1830" }, ss.APL4 = { a: 6378137, rf: 298.25, ellipseName: "Appl. Physics. 1965" }, ss.NWL9D = { a: 6378145, rf: 298.25, ellipseName: "Naval Weapons Lab., 1965" }, ss.mod_airy = { a: 6377340189e-3, b: 6356034446e-3, ellipseName: "Modified Airy" }, ss.andrae = { a: 637710443e-2, rf: 300, ellipseName: "Andrae 1876 (Den., Iclnd.)" }, ss.aust_SA = { a: 6378160, rf: 298.25, ellipseName: "Australian Natl & S. Amer. 1969" }, ss.GRS67 = { a: 6378160, rf: 298.247167427, ellipseName: "GRS 67(IUGG 1967)" }, ss.bessel = { a: 6377397155e-3, rf: 299.1528128, ellipseName: "Bessel 1841" }, ss.bess_nam = { a: 6377483865e-3, rf: 299.1528128, ellipseName: "Bessel 1841 (Namibia)" }, ss.clrk66 = { a: 63782064e-1, b: 63565838e-1, ellipseName: "Clarke 1866" }, ss.clrk80 = { a: 6378249145e-3, rf: 293.4663, ellipseName: "Clarke 1880 mod." }, ss.clrk58 = { a: 6378293645208759e-9, rf: 294.2606763692654, ellipseName: "Clarke 1858" }, ss.CPM = { a: 63757387e-1, rf: 334.29, ellipseName: "Comm. des Poids et Mesures 1799" }, ss.delmbr = { a: 6376428, rf: 311.5, ellipseName: "Delambre 1810 (Belgium)" }, ss.engelis = { a: 637813605e-2, rf: 298.2566, ellipseName: "Engelis 1985" }, ss.evrst30 = { a: 6377276345e-3, rf: 300.8017, ellipseName: "Everest 1830" }, ss.evrst48 = { a: 6377304063e-3, rf: 300.8017, ellipseName: "Everest 1948" }, ss.evrst56 = { a: 6377301243e-3, rf: 300.8017, ellipseName: "Everest 1956" }, ss.evrst69 = { a: 6377295664e-3, rf: 300.8017, ellipseName: "Everest 1969" }, ss.evrstSS = { a: 6377298556e-3, rf: 300.8017, ellipseName: "Everest (Sabah & Sarawak)" }, ss.fschr60 = { a: 6378166, rf: 298.3, ellipseName: "Fischer (Mercury Datum) 1960" }, ss.fschr60m = { a: 6378155, rf: 298.3, ellipseName: "Fischer 1960" }, ss.fschr68 = { a: 6378150, rf: 298.3, ellipseName: "Fischer 1968" }, ss.helmert = { a: 6378200, rf: 298.3, ellipseName: "Helmert 1906" }, ss.hough = { a: 6378270, rf: 297, ellipseName: "Hough" }, ss.intl = { a: 6378388, rf: 297, ellipseName: "International 1909 (Hayford)" }, ss.kaula = { a: 6378163, rf: 298.24, ellipseName: "Kaula 1961" }, ss.lerch = { a: 6378139, rf: 298.257, ellipseName: "Lerch 1979" }, ss.mprts = { a: 6397300, rf: 191, ellipseName: "Maupertius 1738" }, ss.new_intl = { a: 63781575e-1, b: 63567722e-1, ellipseName: "New International 1967" }, ss.plessis = { a: 6376523, rf: 6355863, ellipseName: "Plessis 1817 (France)" }, ss.krass = { a: 6378245, rf: 298.3, ellipseName: "Krassovsky, 1942" }, ss.SEasia = { a: 6378155, b: 63567733205e-4, ellipseName: "Southeast Asia" }, ss.walbeck = { a: 6376896, b: 63558348467e-4, ellipseName: "Walbeck" }, ss.WGS60 = { a: 6378165, rf: 298.3, ellipseName: "WGS 60" }, ss.WGS66 = { a: 6378145, rf: 298.25, ellipseName: "WGS 66" }, ss.WGS7 = { a: 6378135, rf: 298.26, ellipseName: "WGS 72" }; + var dd = ss.WGS84 = { a: 6378137, rf: 298.257223563, ellipseName: "WGS 84" }; + ss.sphere = { a: 6370997, b: 6370997, ellipseName: "Normal Sphere (r=6370997)" }; + var Vd = { wgs84: { towgs84: "0,0,0", ellipse: "WGS84", datumName: "WGS84" }, ch1903: { towgs84: "674.374,15.056,405.346", ellipse: "bessel", datumName: "swiss" }, ggrs87: { towgs84: "-199.87,74.79,246.62", ellipse: "GRS80", datumName: "Greek_Geodetic_Reference_System_1987" }, nad83: { towgs84: "0,0,0", ellipse: "GRS80", datumName: "North_American_Datum_1983" }, nad27: { nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", ellipse: "clrk66", datumName: "North_American_Datum_1927" }, potsdam: { towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7", ellipse: "bessel", datumName: "Potsdam Rauenberg 1950 DHDN" }, carthage: { towgs84: "-263.0,6.0,431.0", ellipse: "clark80", datumName: "Carthage 1934 Tunisia" }, hermannskogel: { towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232", ellipse: "bessel", datumName: "Hermannskogel" }, osni52: { towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", ellipse: "airy", datumName: "Irish National" }, ire65: { towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", ellipse: "mod_airy", datumName: "Ireland 1965" }, rassadiran: { towgs84: "-133.63,-157.5,-158.62", ellipse: "intl", datumName: "Rassadiran" }, nzgd49: { towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", ellipse: "intl", datumName: "New Zealand Geodetic Datum 1949" }, osgb36: { towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", ellipse: "airy", datumName: "Airy 1830" }, s_jtsk: { towgs84: "589,76,480", ellipse: "bessel", datumName: "S-JTSK (Ferro)" }, beduaram: { towgs84: "-106,-87,188", ellipse: "clrk80", datumName: "Beduaram" }, gunung_segara: { towgs84: "-403,684,41", ellipse: "bessel", datumName: "Gunung Segara Jakarta" }, rnb72: { towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1", ellipse: "intl", datumName: "Reseau National Belge 1972" } }, pd = {}; + gt.projections = { start: function() { + gh.forEach(tt); + }, add: tt, get: function(ge) { + if (!ge) + return !1; + var Le = ge.toLowerCase(); + if (typeof vc[Le] < "u" && qu[vc[Le]]) + return qu[vc[Le]]; + } }, gt.projections.start(); + var cs = function(ge, Le, Ye) { + if (Ne(ge, Le) || ge.datum_type === Mi || Le.datum_type === Mi) + return Ye; + var xt = ge.a, oe = ge.es; + if (ge.datum_type === bi) { + var ee = Ft(ge, !1, Ye); + if (ee !== 0) + return; + xt = Ri, oe = Yi; + } + var ae = Le.a, ye = Le.b, Ie = Le.es; + if (Le.datum_type === bi && (ae = Ri, ye = 6356752314e-3, Ie = Yi), oe === Ie && xt === ae && !He(ge.datum_type) && !He(Le.datum_type)) + return Ye; + if (Ye = pe(Ye, oe, xt), He(ge.datum_type) && (Ye = it(Ye, ge.datum_type, ge.datum_params)), He(Le.datum_type) && (Ye = yt(Ye, Le.datum_type, Le.datum_params)), Ye = Ae(Ye, Ie, ae, ye), Le.datum_type === bi) { + var We = Ft(Le, !0, Ye); + if (We !== 0) + return; + } + return Ye; + }, Nl = function(ge, Le, Ye) { + var xt = Ye.x, oe = Ye.y, ee = Ye.z || 0, ae = {}, ye, Ie, We; + for (We = 0; 3 > We; We++) + if (!(Le && We === 2 && Ye.z === void 0)) + switch (We === 0 ? (ye = xt, Ie = "ew".indexOf(ge.axis[We]) === -1 ? "y" : "x") : We === 1 ? (ye = oe, Ie = "ns".indexOf(ge.axis[We]) === -1 ? "x" : "y") : (ye = ee, Ie = "z"), ge.axis[We]) { + case "e": + ae[Ie] = ye; + break; + case "w": + ae[Ie] = -ye; + break; + case "n": + ae[Ie] = ye; + break; + case "s": + ae[Ie] = -ye; + break; + case "u": + Ye[Ie] !== void 0 && (ae.z = ye); + break; + case "d": + Ye[Ie] !== void 0 && (ae.z = -ye); + break; + default: + return null; + } + return ae; + }, ii = function(ge) { + var Le = { x: ge[0], y: ge[1] }; + return 2 < ge.length && (Le.z = ge[2]), 3 < ge.length && (Le.m = ge[3]), Le; + }, bt = function(ge) { + Ue(ge.x), Ue(ge.y); + }, Kt = gt("WGS84"); + Pt.fromMGRS = function(ge) { + return new Pt(m(ge)); + }, Pt.prototype.toMGRS = function(ge) { + return b([this.x, this.y], ge); + }; + var Pi = 0.046875, Sr = 0.01953125, Tr = 0.01068115234375, ri = function(ge) { + var Le = []; + Le[0] = 1 - ge * (0.25 + ge * (Pi + ge * (Sr + ge * Tr))), Le[1] = ge * (0.75 - ge * (Pi + ge * (Sr + ge * Tr))); + var Ye = ge * ge; + return Le[2] = Ye * (0.46875 - ge * (0.013020833333333334 + ge * 0.007120768229166667)), Ye *= ge, Le[3] = Ye * (0.3645833333333333 - ge * 0.005696614583333333), Le[4] = Ye * ge * 0.3076171875, Le; + }, pi = function(ge, Le, Ye, xt) { + return Ye *= Le, Le *= Le, xt[0] * ge - Ye * (xt[1] + Le * (xt[2] + Le * (xt[3] + Le * xt[4]))); + }, mi = function(ge, Le, Ye) { + for (var xt = ge, oe = 20; oe; --oe) { + var ee = j(xt), ae = 1 - Le * ee * ee; + if (ae = (pi(xt, ee, Y(xt), Ye) - ge) * (ae * X(ae)) * (1 / (1 - Le)), xt -= ae, n(ae) < $r) + return xt; + } + return xt; + }, hr = { init: function() { + this.x0 = this.x0 === void 0 ? 0 : this.x0, this.y0 = this.y0 === void 0 ? 0 : this.y0, this.long0 = this.long0 === void 0 ? 0 : this.long0, this.lat0 = this.lat0 === void 0 ? 0 : this.lat0, this.es && (this.en = ri(this.es), this.ml0 = pi(this.lat0, j(this.lat0), Y(this.lat0), this.en)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe = j(Ye), ee = Y(Ye), ae, ye, Ie; + if (this.es) { + var Xe = ee * xt, lt = s(Xe, 2), Et = this.ep2 * s(ee, 2), Ht = s(Et, 2), vi = n(ee) > $r ? V(Ye) : 0, yi = s(vi, 2), Oi = s(yi, 2); + ae = 1 - this.es * s(oe, 2), Xe /= X(ae); + var zi = pi(Ye, oe, ee, this.en); + ye = this.a * (this.k0 * Xe * (1 + lt / 6 * (1 - yi + Et + lt / 20 * (5 - 18 * yi + Oi + 14 * Et - 58 * yi * Et + lt / 42 * (61 + 179 * Oi - Oi * yi - 479 * yi))))) + this.x0, Ie = this.a * (this.k0 * (zi - this.ml0 + oe * xt * Xe / 2 * (1 + lt / 12 * (5 - yi + 9 * Et + 4 * Ht + lt / 30 * (61 + Oi - 58 * yi + 270 * Et - 330 * yi * Et + lt / 56 * (1385 + 543 * Oi - Oi * yi - 3111 * yi)))))) + this.y0; + } else { + var We = ee * j(xt); + if (n(n(We) - 1) < $r) + return 93; + if (ye = 0.5 * this.a * this.k0 * r((1 + We) / (1 - We)) + this.x0, Ie = ee * Y(xt) / X(1 - s(We, 2)), We = n(Ie), 1 <= We) { + if (We - 1 > $r) + return 93; + Ie = 0; + } else + Ie = y(Ie); + 0 > Ye && (Ie = -Ie), Ie = this.a * this.k0 * (Ie - this.lat0) + this.y0; + } + return ge.x = ye, ge.y = Ie, ge; + }, inverse: function(ge) { + var Le = (ge.x - this.x0) * (1 / this.a), Ye = (ge.y - this.y0) * (1 / this.a), xt, oe, ee, ae; + if (this.es) + if (xt = this.ml0 + Ye / this.k0, oe = mi(xt, this.es, this.en), n(oe) < _i) { + var lt = j(oe), Et = Y(oe), Ht = n(Et) > $r ? V(oe) : 0, vi = this.ep2 * s(Et, 2), yi = s(vi, 2), Oi = s(Ht, 2), zi = s(Oi, 2); + xt = 1 - this.es * s(lt, 2); + var ar = Le * X(xt) / this.k0, tr = s(ar, 2); + xt *= Ht, ee = oe - 0.5 * (xt * tr / (1 - this.es)) * (1 - tr / 12 * (5 + 3 * Oi - 9 * vi * Oi + vi - 4 * yi - tr / 30 * (61 + 90 * Oi - 252 * vi * Oi + 45 * zi + 46 * vi - tr / 56 * (1385 + 3633 * Oi + 4095 * zi + 1574 * zi * Oi)))), ae = yn(this.long0 + ar * (1 - tr / 6 * (1 + 2 * Oi + vi - tr / 20 * (5 + 28 * Oi + 24 * zi + 8 * vi * Oi + 6 * vi - tr / 42 * (61 + 662 * Oi + 1320 * zi + 720 * zi * Oi)))) / Et); + } else + ee = _i * ra(Ye), ae = 0; + else { + var ye = k(Le / this.k0), Ie = 0.5 * (ye - 1 / ye), We = this.lat0 + Ye / this.k0, Xe = Y(We); + xt = X((1 - s(Xe, 2)) / (1 + s(Ie, 2))), ee = p(xt), 0 > Ye && (ee = -ee), ae = Ie === 0 && Xe === 0 ? 0 : yn(x(Ie, Xe) + this.long0); + } + return ge.x = ae, ge.y = ee, ge; + }, names: ["Fast_Transverse_Mercator", "Fast Transverse Mercator"] }, Lr = function(ge) { + var Le = k(ge); + return Le = (Le - 1 / Le) / 2, Le; + }, wr = function(ge, Le) { + var Ye = Math.max; + ge = n(ge), Le = n(Le); + var xt = Ye(ge, Le), oe = a(ge, Le) / (xt || 1); + return xt * X(1 + s(oe, 2)); + }, Nr = function(ge) { + var Le = 1 + ge, Ye = Le - 1; + return Ye === 0 ? ge : ge * r(Le) / Ye; + }, _r = function(ge) { + var Le = n(ge); + return Le = Nr(Le * (1 + Le / (wr(1, Le) + 1))), 0 > ge ? -Le : Le; + }, Tn = function(ge, Le) { + for (var Ye = 2 * Y(2 * Le), xt = ge.length - 1, oe = ge[xt], ee = 0, ae; 0 <= --xt; ) + ae = -ee + Ye * oe + ge[xt], ee = oe, oe = ae; + return Le + ae * j(2 * Le); + }, os = function(ge, Le) { + for (var Ye = 2 * Y(Le), xt = ge.length - 1, oe = ge[xt], ee = 0, ae; 0 <= --xt; ) + ae = -ee + Ye * oe + ge[xt], ee = oe, oe = ae; + return j(Le) * ae; + }, fs = function(ge) { + var Le = k(ge); + return Le = (Le + 1 / Le) / 2, Le; + }, di = function(ge, Le, Ye) { + for (var xt = j(Le), oe = Y(Le), ee = Lr(Ye), ae = fs(Ye), ye = 2 * oe * ae, Ie = -2 * xt * ee, We = ge.length - 1, Xe = ge[We], lt = 0, Et = 0, Ht = 0, vi, yi; 0 <= --We; ) + vi = Et, yi = lt, Et = Xe, lt = Ht, Xe = -vi + ye * Et - Ie * lt + ge[We], Ht = -yi + Ie * Et + ye * lt; + return ye = xt * ae, Ie = oe * ee, [ye * Xe - Ie * Ht, ye * Ht + Ie * Xe]; + }, nr = { init: function() { + if (!this.approx && (isNaN(this.es) || 0 >= this.es)) + throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.'); + this.approx && (hr.init.apply(this), this.forward = hr.forward, this.inverse = hr.inverse), this.x0 = this.x0 === void 0 ? 0 : this.x0, this.y0 = this.y0 === void 0 ? 0 : this.y0, this.long0 = this.long0 === void 0 ? 0 : this.long0, this.lat0 = this.lat0 === void 0 ? 0 : this.lat0, this.cgb = [], this.cbg = [], this.utg = [], this.gtu = []; + var ge = this.es / (1 + X(1 - this.es)), Le = ge / (2 - ge), Ye = Le; + this.cgb[0] = Le * (2 + Le * (-2 / 3 + Le * (-2 + Le * (116 / 45 + Le * (26 / 45 + Le * (-2854 / 675)))))), this.cbg[0] = Le * (-2 + Le * (2 / 3 + Le * (4 / 3 + Le * (-82 / 45 + Le * (32 / 45 + Le * (4642 / 4725)))))), Ye *= Le, this.cgb[1] = Ye * (7 / 3 + Le * (-8 / 5 + Le * (-227 / 45 + Le * (2704 / 315 + Le * (2323 / 945))))), this.cbg[1] = Ye * (5 / 3 + Le * (-16 / 15 + Le * (-13 / 9 + Le * (904 / 315 + Le * (-1522 / 945))))), Ye *= Le, this.cgb[2] = Ye * (56 / 15 + Le * (-136 / 35 + Le * (-1262 / 105 + Le * (73814 / 2835)))), this.cbg[2] = Ye * (-26 / 15 + Le * (34 / 21 + Le * (8 / 5 + Le * (-12686 / 2835)))), Ye *= Le, this.cgb[3] = Ye * (4279 / 630 + Le * (-332 / 35 + Le * (-399572 / 14175))), this.cbg[3] = Ye * (1237 / 630 + Le * (-12 / 5 + Le * (-24832 / 14175))), Ye *= Le, this.cgb[4] = Ye * (4174 / 315 + Le * (-144838 / 6237)), this.cbg[4] = Ye * (-734 / 315 + Le * (109598 / 31185)), Ye *= Le, this.cgb[5] = Ye * (601676 / 22275), this.cbg[5] = Ye * (444337 / 155925), Ye = s(Le, 2), this.Qn = this.k0 / (1 + Le) * (1 + Ye * (1 / 4 + Ye * (1 / 64 + Ye / 256))), this.utg[0] = Le * (-0.5 + Le * (2 / 3 + Le * (-37 / 96 + Le * (1 / 360 + Le * (81 / 512 + Le * (-96199 / 604800)))))), this.gtu[0] = Le * (0.5 + Le * (-2 / 3 + Le * (5 / 16 + Le * (41 / 180 + Le * (-127 / 288 + Le * (7891 / 37800)))))), this.utg[1] = Ye * (-1 / 48 + Le * (-1 / 15 + Le * (437 / 1440 + Le * (-46 / 105 + Le * (1118711 / 3870720))))), this.gtu[1] = Ye * (13 / 48 + Le * (-3 / 5 + Le * (557 / 1440 + Le * (281 / 630 + Le * (-1983433 / 1935360))))), Ye *= Le, this.utg[2] = Ye * (-17 / 480 + Le * (37 / 840 + Le * (209 / 4480 + Le * (-5569 / 90720)))), this.gtu[2] = Ye * (61 / 240 + Le * (-103 / 140 + Le * (15061 / 26880 + Le * (167603 / 181440)))), Ye *= Le, this.utg[3] = Ye * (-4397 / 161280 + Le * (11 / 504 + Le * (830251 / 7257600))), this.gtu[3] = Ye * (49561 / 161280 + Le * (-179 / 168 + Le * (6601661 / 7257600))), Ye *= Le, this.utg[4] = Ye * (-4583 / 161280 + Le * (108847 / 3991680)), this.gtu[4] = Ye * (34729 / 80640 + Le * (-3418889 / 1995840)), Ye *= Le, this.utg[5] = Ye * (-20648693 / 638668800), this.gtu[5] = Ye * (212378941 / 319334400); + var xt = Tn(this.cbg, this.lat0); + this.Zb = -this.Qn * (xt + os(this.gtu, 2 * xt)); + }, forward: function(ge) { + var Le = yn(ge.x - this.long0), Ye = ge.y; + Ye = Tn(this.cbg, Ye); + var xt = j(Ye), oe = Y(Ye), ee = j(Le), ae = Y(Le); + Ye = x(xt, ae * oe), Le = x(ee * oe, wr(xt, oe * ae)), Le = _r(V(Le)); + var ye = di(this.gtu, 2 * Ye, 2 * Le); + Ye += ye[0], Le += ye[1]; + var Ie, We; + return 2.623395162778 >= n(Le) ? (Ie = this.a * (this.Qn * Le) + this.x0, We = this.a * (this.Qn * Ye + this.Zb) + this.y0) : (Ie = 1 / 0, We = 1 / 0), ge.x = Ie, ge.y = We, ge; + }, inverse: function(ge) { + var Le = (ge.x - this.x0) * (1 / this.a), Ye = (ge.y - this.y0) * (1 / this.a); + Ye = (Ye - this.Zb) / this.Qn, Le /= this.Qn; + var xt, oe; + if (2.623395162778 >= n(Le)) { + var ee = di(this.utg, 2 * Ye, 2 * Le); + Ye += ee[0], Le += ee[1], Le = F(Lr(Le)); + var ae = j(Ye), ye = Y(Ye), Ie = j(Le), We = Y(Le); + Ye = x(ae * We, wr(Ie, We * ye)), Le = x(Ie, We * ye), xt = yn(Le + this.long0), oe = Tn(this.cgb, Ye); + } else + xt = 1 / 0, oe = 1 / 0; + return ge.x = xt, ge.y = oe, ge; + }, names: ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"] }, fr = function(ge, Le) { + if (ge === void 0) { + if (ge = i(30 * (yn(Le) + P) / P) + 1, 0 > ge) + return 0; + if (60 < ge) + return 60; + } + return ge; + }, Zr = { init: function() { + var ge = fr(this.zone, this.long0); + if (ge === void 0) + throw new Error("unknown utm zone"); + this.lat0 = 0, this.long0 = (6 * n(ge) - 183) * Zn, this.x0 = 5e5, this.y0 = this.utmSouth ? 1e7 : 0, this.k0 = 0.9996, nr.init.apply(this), this.forward = nr.forward, this.inverse = nr.inverse; + }, names: ["Universal Transverse Mercator System", "utm"], dependsOn: "etmerc" }, er = function(ge, Le) { + return s((1 - ge) / (1 + ge), Le); + }, ys = { init: function() { + var ge = j(this.lat0), Le = Y(this.lat0); + Le *= Le, this.rc = X(1 - this.es) / (1 - this.es * ge * ge), this.C = X(1 + this.es * Le * Le / (1 - this.es)), this.phic0 = p(ge / this.C), this.ratexp = 0.5 * this.C * this.e, this.K = V(0.5 * this.phic0 + On) / (s(V(0.5 * this.lat0 + On), this.C) * er(this.e * ge, this.ratexp)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y; + return ge.y = 2 * F(this.K * s(V(0.5 * Ye + On), this.C) * er(this.e * j(Ye), this.ratexp)) - _i, ge.x = this.C * Le, ge; + }, inverse: function(ge) { + for (var Le = ge.x / this.C, Ye = ge.y, xt = s(V(0.5 * Ye + On) / this.K, 1 / this.C), oe = 20; 0 < oe && (Ye = 2 * F(xt * er(this.e * j(ge.y), -0.5 * this.e)) - _i, !(n(Ye - ge.y) < 1e-14)); --oe) + ge.y = Ye; + return oe ? (ge.x = Le, ge.y = Ye, ge) : null; + }, names: ["gauss"] }, Da = { init: function() { + ys.init.apply(this), this.rc && (this.sinc0 = j(this.phic0), this.cosc0 = Y(this.phic0), this.R2 = 2 * this.rc, !this.title && (this.title = "Oblique Stereographic Alternative")); + }, forward: function(ge) { + var Le, Ye, xt, oe; + return ge.x = yn(ge.x - this.long0), ys.forward.apply(this, [ge]), Le = j(ge.y), Ye = Y(ge.y), xt = Y(ge.x), oe = this.k0 * this.R2 / (1 + this.sinc0 * Le + this.cosc0 * Ye * xt), ge.x = oe * Ye * j(ge.x), ge.y = oe * (this.cosc0 * Le - this.sinc0 * Ye * xt), ge.x = this.a * ge.x + this.x0, ge.y = this.a * ge.y + this.y0, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee; + if (ge.x = (ge.x - this.x0) / this.a, ge.y = (ge.y - this.y0) / this.a, ge.x /= this.k0, ge.y /= this.k0, ee = X(ge.x * ge.x + ge.y * ge.y)) { + var ae = 2 * x(ee, this.R2); + Le = j(ae), Ye = Y(ae), oe = p(Ye * this.sinc0 + ge.y * Le * this.cosc0 / ee), xt = x(ge.x * Le, ee * this.cosc0 * Ye - ge.y * this.sinc0 * Le); + } else + oe = this.phic0, xt = 0; + return ge.x = xt, ge.y = oe, ys.inverse.apply(this, [ge]), ge.x = yn(ge.x + this.long0), ge; + }, names: ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea", "Oblique Stereographic Alternative", "Double_Stereographic"] }, Ta = { init: function() { + this.coslat0 = Y(this.lat0), this.sinlat0 = j(this.lat0), this.sphere ? this.k0 === 1 && !isNaN(this.lat_ts) && n(this.coslat0) <= $r && (this.k0 = 0.5 * (1 + ra(this.lat0) * j(this.lat_ts))) : (n(this.coslat0) <= $r && (0 < this.lat0 ? this.con = 1 : this.con = -1), this.cons = X(s(1 + this.e, 1 + this.e) * s(1 - this.e, 1 - this.e)), this.k0 === 1 && !isNaN(this.lat_ts) && n(this.coslat0) <= $r && (this.k0 = 0.5 * this.cons * Cs(this.e, j(this.lat_ts), Y(this.lat_ts)) / Io(this.e, this.con * this.lat_ts, this.con * j(this.lat_ts))), this.ms1 = Cs(this.e, this.sinlat0, this.coslat0), this.X0 = 2 * F(this.ssfn_(this.lat0, this.sinlat0, this.e)) - _i, this.cosX0 = Y(this.X0), this.sinX0 = j(this.X0)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = j(Ye), oe = Y(Ye), ee = yn(Le - this.long0), ae, ye, Ie, We, Xe; + return n(n(Le - this.long0) - P) <= $r && n(Ye + this.lat0) <= $r ? (ge.x = NaN, ge.y = NaN, ge) : this.sphere ? (2 * this.k0 / (1 + this.sinlat0 * xt + this.coslat0 * oe * Y(ee)), ge.x = 65 * this.a * oe * j(ee) + this.x0, ge.y = 65 * this.a * (this.coslat0 * xt - this.sinlat0 * oe * Y(ee)) + this.y0, ge) : (ae = 2 * F(this.ssfn_(Ye, xt, this.e)) - _i, Ie = Y(ae), ye = j(ae), n(this.coslat0) <= $r ? (We = Io(this.e, Ye * this.con, this.con * xt), Xe = 2 * this.a * this.k0 * We / this.cons, ge.x = this.x0 + Xe * j(Le - this.long0), ge.y = this.y0 - this.con * Xe * Y(Le - this.long0), ge) : (n(this.sinlat0) < $r ? (2 * this.a * this.k0 / (1 + Ie * Y(ee)), ge.y = 65 * ye) : (2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * ye + this.cosX0 * Ie * Y(ee))), ge.y = 65 * (this.cosX0 * ye - this.sinX0 * Ie * Y(ee)) + this.y0), ge.x = 65 * Ie * j(ee) + this.x0, ge)); + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le = X(ge.x * ge.x + ge.y * ge.y), Ye, xt, oe, ee, ae; + if (this.sphere) { + var ye = 2 * F(Le / (2 * this.a * this.k0)); + return Ye = this.long0, xt = this.lat0, Le <= $r ? (ge.x = Ye, ge.y = xt, ge) : (xt = p(Y(ye) * this.sinlat0 + ge.y * j(ye) * this.coslat0 / Le), Ye = n(this.coslat0) < $r ? 0 < this.lat0 ? yn(this.long0 + x(ge.x, -1 * ge.y)) : yn(this.long0 + x(ge.x, ge.y)) : yn(this.long0 + x(ge.x * j(ye), Le * this.coslat0 * Y(ye) - ge.y * this.sinlat0 * j(ye))), ge.x = Ye, ge.y = xt, ge); + } + if (n(this.coslat0) <= $r) { + if (Le <= $r) + return xt = this.lat0, Ye = this.long0, ge.x = Ye, ge.y = xt, ge; + ge.x *= this.con, ge.y *= this.con, oe = Le * this.cons / (2 * this.a * this.k0), xt = this.con * oh(this.e, oe), Ye = this.con * yn(this.con * this.long0 + x(ge.x, -1 * ge.y)); + } else + ee = 2 * F(Le * this.cosX0 / (2 * this.a * this.k0 * this.ms1)), Ye = this.long0, Le <= $r ? ae = this.X0 : (ae = p(Y(ee) * this.sinX0 + ge.y * j(ee) * this.cosX0 / Le), Ye = yn(this.long0 + x(ge.x * j(ee), Le * this.cosX0 * Y(ee) - ge.y * this.sinX0 * j(ee)))), xt = -1 * oh(this.e, V(0.5 * (_i + ae))); + return ge.x = Ye, ge.y = xt, ge; + }, names: ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"], ssfn_: function(ge, Le, Ye) { + return Le *= Ye, V(0.5 * (_i + ge)) * s((1 - Le) / (1 + Le), 0.5 * Ye); + } }, Ds = { init: function() { + var ge = this.lat0; + this.lambda0 = this.long0; + var Le = j(ge), Ye = this.a, xt = this.rf, oe = 1 / xt, ee = 2 * oe - s(oe, 2), ae = this.e = X(ee); + this.R = this.k0 * Ye * X(1 - ee) / (1 - ee * s(Le, 2)), this.alpha = X(1 + ee / (1 - ee) * s(Y(ge), 4)), this.b0 = p(Le / this.alpha); + var ye = r(V(P / 4 + this.b0 / 2)), Ie = r(V(P / 4 + ge / 2)), We = r((1 + ae * Le) / (1 - ae * Le)); + this.K = ye - this.alpha * Ie + this.alpha * ae / 2 * We; + }, forward: function(ge) { + var Le = r(V(P / 4 - ge.y / 2)), Ye = this.e / 2 * r((1 + this.e * j(ge.y)) / (1 - this.e * j(ge.y))), xt = -this.alpha * (Le + Ye) + this.K, oe = 2 * (F(k(xt)) - P / 4); + this.alpha * (ge.x - this.lambda0); + var ee = F(j(73) / (j(this.b0) * V(oe) + Y(this.b0) * Y(73))), ae = p(Y(this.b0) * j(oe) - j(this.b0) * Y(oe) * Y(73)); + return ge.y = this.R / 2 * r((1 + j(ae)) / (1 - j(ae))) + this.y0, ge.x = this.R * ee + this.x0, ge; + }, inverse: function(ge) { + for (var Le = ge.x - this.x0, Ye = ge.y - this.y0, xt = Le / this.R, oe = 2 * (F(k(Ye / this.R)) - P / 4), ee = p(Y(this.b0) * j(oe) + j(this.b0) * Y(oe) * Y(xt)), ae = F(j(xt) / (Y(this.b0) * Y(xt) - j(this.b0) * V(oe))), ye = this.lambda0 + 73 / this.alpha, Ie = 0, We = ee, Xe = -1e3, lt = 0; 1e-7 < n(We - Xe); ) { + if (20 < ++lt) + return; + Ie = 1 / this.alpha * (r(V(P / 4 + ee / 2)) - this.K) + this.e * r(V(P / 4 + p(this.e * j(We)) / 2)), Xe = We, We = 2 * F(k(Ie)) - P / 2; + } + return ge.x = ye, ge.y = We, ge; + }, names: ["somerc"] }, fu = 1e-7, mu = { init: qe, forward: function(ge) { + var Le = {}, Ye, xt, oe, ee, ae, ye, Ie; + if (ge.x -= this.lam0, n(n(ge.y) - _i) > $r) { + if (ee = this.E / s(Io(this.e, ge.y, j(ge.y)), this.B), ae = 1 / ee, Ye = 0.5 * (ee - ae), xt = 0.5 * (ee + ae), j(this.B * ge.x), oe = (Ye * this.singam - 86 * this.cosgam) / xt, n(n(oe) - 1) < $r) + throw new Error(); + Ie = 0.5 * this.ArB * r((1 - oe) / (1 + oe)), ae = Y(this.B * ge.x), ye = n(ae) < fu ? this.A * ge.x : this.ArB * x(Ye * this.cosgam + 86 * this.singam, ae); + } else + Ie = 0 < ge.y ? this.v_pole_n : this.v_pole_s, ye = this.ArB * ge.y; + return this.no_rot ? (Le.x = ye, Le.y = Ie) : (ye -= this.u_0, Le.x = Ie * this.cosrot + ye * this.sinrot, Le.y = ye * this.cosrot - Ie * this.sinrot), Le.x = this.a * Le.x + this.x0, Le.y = this.a * Le.y + this.y0, Le; + }, inverse: function(ge) { + var Le = {}, Ye, xt, oe, ee, ae, ye, Ie; + if (ge.x = (ge.x - this.x0) * (1 / this.a), ge.y = (ge.y - this.y0) * (1 / this.a), this.no_rot ? (xt = ge.y, Ye = ge.x) : (xt = ge.x * this.cosrot - ge.y * this.sinrot, Ye = ge.y * this.cosrot + ge.x * this.sinrot + this.u_0), oe = k(-this.BrA * xt), ee = 0.5 * (oe - 1 / oe), ae = 0.5 * (oe + 1 / oe), ye = j(this.BrA * Ye), Ie = (ye * this.cosgam + ee * this.singam) / ae, n(n(Ie) - 1) < $r) + Le.x = 0, Le.y = 0 > Ie ? -_i : _i; + else { + if (Le.y = this.E / X((1 + Ie) / (1 - Ie)), Le.y = oh(this.e, s(Le.y, 1 / this.B)), Le.y === 1 / 0) + throw new Error(); + Le.x = -this.rB * x(ee * this.cosgam - ye * this.singam, Y(this.BrA * Ye)); + } + return Le.x += this.lam0, Le; + }, names: ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"] }, Rc = { init: function() { + if (this.lat2 || (this.lat2 = this.lat1), this.k0 || (this.k0 = 1), this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, !(n(this.lat1 + this.lat2) < $r)) { + var ge = this.b / this.a; + this.e = X(1 - ge * ge); + var Le = j(this.lat1), Ye = Y(this.lat1), xt = Cs(this.e, Le, Ye), oe = Io(this.e, this.lat1, Le), ee = j(this.lat2), ae = Y(this.lat2), ye = Cs(this.e, ee, ae), Ie = Io(this.e, this.lat2, ee), We = Io(this.e, this.lat0, j(this.lat0)); + this.ns = n(this.lat1 - this.lat2) > $r ? r(xt / ye) / r(oe / Ie) : Le, isNaN(this.ns) && (this.ns = Le), this.f0 = xt / (this.ns * s(oe, this.ns)), this.rh = this.a * this.f0 * s(We, this.ns), this.title || (this.title = "Lambert Conformal Conic"); + } + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y; + n(2 * n(Ye) - P) <= $r && (Ye = ra(Ye) * (_i - 2 * $r)); + var xt = n(n(Ye) - _i), oe, ee; + if (xt > $r) + oe = Io(this.e, Ye, j(Ye)), ee = this.a * this.f0 * s(oe, this.ns); + else { + if (xt = Ye * this.ns, 0 >= xt) + return null; + ee = 0; + } + var ae = this.ns * yn(Le - this.long0); + return ge.x = this.k0 * (ee * j(ae)) + this.x0, ge.y = this.k0 * (this.rh - ee * Y(ae)) + this.y0, ge; + }, inverse: function(ge) { + var Le = (ge.x - this.x0) / this.k0, Ye = this.rh - (ge.y - this.y0) / this.k0, xt, oe, ee, ae, ye; + 0 < this.ns ? (xt = X(Le * Le + Ye * Ye), oe = 1) : (xt = -X(Le * Le + Ye * Ye), oe = -1); + var Ie = 0; + if (xt !== 0 && (Ie = x(oe * Le, oe * Ye)), !(xt !== 0 || 0 < this.ns)) + ae = -_i; + else if (oe = 1 / this.ns, ee = s(xt / (this.a * this.f0), oe), ae = oh(this.e, ee), ae === -9999) + return null; + return ye = yn(Ie / this.ns + this.long0), ge.x = ye, ge.y = ae, ge; + }, names: ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_1SP", "Lambert_Conformal_Conic_2SP", "lcc"] }, Mc = { init: function() { + this.a = 6377397155e-3, this.es = 0.006674372230614, this.e = X(this.es), this.lat0 || (this.lat0 = 0.863937979737193), this.long0 || (this.long0 = 0.7417649320975901 - 0.308341501185665), this.k0 || (this.k0 = 0.9999), this.s45 = 0.785398163397448, this.s90 = 2 * this.s45, this.fi0 = this.lat0, this.e2 = this.es, this.e = X(this.e2), this.alfa = X(1 + this.e2 * s(Y(this.fi0), 4) / (1 - this.e2)), this.uq = 1.04216856380474, this.u0 = p(j(this.fi0) / this.alfa), this.g = s((1 + this.e * j(this.fi0)) / (1 - this.e * j(this.fi0)), this.alfa * this.e / 2), this.k = V(this.u0 / 2 + this.s45) / s(V(this.fi0 / 2 + this.s45), this.alfa) * this.g, this.k1 = this.k0, this.n0 = this.a * X(1 - this.e2) / (1 - this.e2 * s(j(this.fi0), 2)), this.s0 = 1.37008346281555, this.n = j(this.s0), this.ro0 = this.k1 * this.n0 / V(this.s0), this.ad = this.s90 - this.uq; + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe, ee, ae, ye, Ie, We, Xe; + return oe = s((1 + this.e * j(Ye)) / (1 - this.e * j(Ye)), this.alfa * this.e / 2), ee = 2 * (F(this.k * s(V(Ye / 2 + this.s45), this.alfa) / oe) - this.s45), ae = -xt * this.alfa, ye = p(Y(this.ad) * j(ee) + j(this.ad) * Y(ee) * Y(ae)), Ie = p(Y(ee) * j(ae) / Y(ye)), We = this.n * Ie, Xe = this.ro0 * s(V(this.s0 / 2 + this.s45), this.n) / s(V(ye / 2 + this.s45), this.n), ge.y = Xe * Y(We) / 1, ge.x = Xe * j(We) / 1, this.czech || (ge.y *= -1, ge.x *= -1), ge; + }, inverse: function(ge) { + var Le = ge.x, Ye, xt, oe, ee, ae, ye, Ie, We; + ge.x = ge.y, ge.y = Le, this.czech || (ge.y *= -1, ge.x *= -1), ye = X(ge.x * ge.x + ge.y * ge.y), ae = x(ge.y, ge.x), ee = ae / j(this.s0), oe = 2 * (F(s(this.ro0 / ye, 1 / this.n) * V(this.s0 / 2 + this.s45)) - this.s45), Ye = p(Y(this.ad) * j(oe) - j(this.ad) * Y(oe) * Y(ee)), xt = p(Y(oe) * j(ee) / Y(Ye)), ge.x = this.long0 - xt / this.alfa, Ie = Ye, We = 0; + var Xe = 0; + do + ge.y = 2 * (F(s(this.k, -1 / this.alfa) * s(V(Ye / 2 + this.s45), 1 / this.alfa) * s((1 + this.e * j(Ie)) / (1 - this.e * j(Ie)), this.e / 2)) - this.s45), 1e-10 > n(Ie - ge.y) && (We = 1), Ie = ge.y, Xe += 1; + while (We === 0 && 15 > Xe); + return 15 <= Xe ? null : ge; + }, names: ["Krovak", "krovak"] }, Tl = function(ge, Le, Ye, xt, oe) { + return ge * oe - Le * j(2 * oe) + Ye * j(4 * oe) - xt * j(6 * oe); + }, ah = function(ge) { + return 1 - 0.25 * ge * (1 + ge / 16 * (3 + 1.25 * ge)); + }, jh = function(ge) { + return 0.375 * ge * (1 + 0.25 * ge * (1 + 0.46875 * ge)); + }, Rp = function(ge) { + return 0.05859375 * ge * ge * (1 + 0.75 * ge); + }, kl = function(ge) { + return ge * ge * ge * (35 / 3072); + }, lh = function(ge, Le, Ye) { + var xt = Le * Ye; + return ge / X(1 - xt * xt); + }, Gh = function(ge) { + return n(ge) < _i ? ge : ge - ra(ge) * P; + }, ou = function(ge, Le, Ye, xt, oe) { + var ee, ae; + ee = ge / Le; + for (var ye = 0; 15 > ye; ye++) + if (ae = (ge - (Le * ee - Ye * j(2 * ee) + xt * j(4 * ee) - oe * j(6 * ee))) / (Le - 2 * Ye * Y(2 * ee) + 4 * xt * Y(4 * ee) - 6 * oe * Y(6 * ee)), ee += ae, 1e-10 >= n(ae)) + return ee; + return NaN; + }, Mp = { init: function() { + this.sphere || (this.e0 = ah(this.es), this.e1 = jh(this.es), this.e2 = Rp(this.es), this.e3 = kl(this.es), this.ml0 = this.a * Tl(this.e0, this.e1, this.e2, this.e3, this.lat0)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt, oe; + if (Le = yn(Le - this.long0), this.sphere) + xt = this.a * p(Y(Ye) * j(Le)), oe = this.a * (x(V(Ye), Y(Le)) - this.lat0); + else { + var ee = j(Ye), ae = Y(Ye), ye = lh(this.a, this.e, ee), Ie = V(Ye) * V(Ye), We = Le * Y(Ye), Xe = We * We, lt = this.es * ae * ae / (1 - this.es), Et = this.a * Tl(this.e0, this.e1, this.e2, this.e3, Ye); + xt = ye * We * (1 - Xe * Ie * (1 / 6 - (8 - Ie + 8 * lt) * Xe / 120)), oe = Et - this.ml0 + ye * ee / ae * Xe * (0.5 + (5 - Ie + 6 * lt) * Xe / 24); + } + return ge.x = xt + this.x0, ge.y = oe + this.y0, ge; + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le = ge.x / this.a, Ye = ge.y / this.a, xt, oe; + if (this.sphere) { + var ee = Ye + this.lat0; + xt = p(j(ee) * Y(Le)), oe = x(V(Le), Y(ee)); + } else { + var ae = this.ml0 / this.a + Ye, ye = ou(ae, this.e0, this.e1, this.e2, this.e3); + if (n(n(ye) - _i) <= $r) + return ge.x = this.long0, ge.y = _i, 0 > Ye && (ge.y *= -1), ge; + var Ie = lh(this.a, this.e, j(ye)), We = Ie * Ie * Ie / this.a / this.a * (1 - this.es), Xe = s(V(ye), 2), lt = Le * this.a / Ie, Et = lt * lt; + xt = ye - Ie * V(ye) / We * lt * lt * (0.5 - (1 + 3 * Xe) * lt * lt / 24), oe = lt * (1 - Et * (Xe / 3 + (1 + 3 * Xe) * Xe * Et / 15)) / Y(ye); + } + return ge.x = yn(oe + this.long0), ge.y = Gh(xt), ge; + }, names: ["Cassini", "Cassini_Soldner", "cass"] }, yh = function(ge, Le) { + var Ye; + return 1e-7 < ge ? (Ye = ge * Le, (1 - ge * ge) * (Le / (1 - Ye * Ye) - 0.5 / ge * r((1 - Ye) / (1 + Ye)))) : 2 * Le; + }, ag = 0.3333333333333333, lg = 0.17222222222222222, jd = 0.10257936507936508, ha = 0.06388888888888888, Nf = 0.0664021164021164, al = 0.016415012942191543, Dp = { init: function() { + var ge = n(this.lat0); + if (this.mode = n(ge - _i) < $r ? 0 > this.lat0 ? this.S_POLE : this.N_POLE : n(ge) < $r ? this.EQUIT : this.OBLIQ, 0 < this.es) { + var Le; + switch (this.qp = yh(this.e, 1), this.mmf = 0.5 / (1 - this.es), this.apa = Rt(this.es), this.mode) { + case this.N_POLE: + this.dd = 1; + break; + case this.S_POLE: + this.dd = 1; + break; + case this.EQUIT: + this.rq = X(0.5 * this.qp), this.dd = 1 / this.rq, this.xmf = 1, this.ymf = 0.5 * this.qp; + break; + case this.OBLIQ: + this.rq = X(0.5 * this.qp), Le = j(this.lat0), this.sinb1 = yh(this.e, Le) / this.qp, this.cosb1 = X(1 - this.sinb1 * this.sinb1), this.dd = Y(this.lat0) / (X(1 - this.es * Le * Le) * this.rq * this.cosb1), this.ymf = (this.xmf = this.rq) / this.dd, this.xmf *= this.dd; + } + } else + this.mode === this.OBLIQ && (this.sinph0 = j(this.lat0), this.cosph0 = Y(this.lat0)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt, oe, ee, ae, ye, Ie, We, Xe, lt, Et; + if (Le = yn(Le - this.long0), !this.sphere) { + switch (We = 0, Xe = 0, lt = 0, ee = Y(Le), ae = j(Le), ye = j(Ye), Ie = yh(this.e, ye), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (We = Ie / this.qp, Xe = X(1 - We * We)), this.mode) { + case this.OBLIQ: + lt = 1 + this.sinb1 * We + this.cosb1 * Xe * ee; + break; + case this.EQUIT: + lt = 1 + Xe * ee; + break; + case this.N_POLE: + lt = _i + Ye, Ie = this.qp - Ie; + break; + case this.S_POLE: + lt = Ye - _i, Ie = this.qp + Ie; + } + if (n(lt) < $r) + return null; + switch (this.mode) { + case this.OBLIQ: + case this.EQUIT: + lt = X(2 / lt), oe = this.mode === this.OBLIQ ? this.ymf * lt * (this.cosb1 * We - this.sinb1 * Xe * ee) : (lt = X(2 / (1 + Xe * ee))) * We * this.ymf, xt = this.xmf * lt * Xe * ae; + break; + case this.N_POLE: + case this.S_POLE: + 0 <= Ie ? (xt = (lt = X(Ie)) * ae, oe = ee * (this.mode === this.S_POLE ? lt : -lt)) : xt = oe = 0; + } + } else if (ye = j(Ye), Et = Y(Ye), ee = Y(Le), this.mode === this.OBLIQ || this.mode === this.EQUIT) { + if (oe = this.mode === this.EQUIT ? 1 + Et * ee : 1 + this.sinph0 * ye + this.cosph0 * Et * ee, oe <= $r) + return null; + oe = X(2 / oe), xt = oe * Et * j(Le), oe *= this.mode === this.EQUIT ? ye : this.cosph0 * ye - this.sinph0 * Et * ee; + } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) { + if (this.mode === this.N_POLE && (ee = -ee), n(Ye + this.lat0) < $r) + return null; + oe = On - 0.5 * Ye, oe = 2 * (this.mode === this.S_POLE ? Y(oe) : j(oe)), xt = oe * j(Le), oe *= ee; + } + return ge.x = this.a * xt + this.x0, ge.y = this.a * oe + this.y0, ge; + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le = ge.x / this.a, Ye = ge.y / this.a, xt, oe, ee, ae, ye, Ie, We; + if (this.sphere) { + var Xe = 0, lt = 0, Et; + if (Et = X(Le * Le + Ye * Ye), oe = 0.5 * Et, 1 < oe) + return null; + switch (oe = 2 * p(oe), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (lt = j(oe), Xe = Y(oe)), this.mode) { + case this.EQUIT: + oe = n(Et) <= $r ? 0 : p(Ye * lt / Et), Le *= lt, Ye = Xe * Et; + break; + case this.OBLIQ: + oe = n(Et) <= $r ? this.lat0 : p(Xe * this.sinph0 + Ye * lt * this.cosph0 / Et), Le *= lt * this.cosph0, Ye = (Xe - j(oe) * this.sinph0) * Et; + break; + case this.N_POLE: + Ye = -Ye, oe = _i - oe; + break; + case this.S_POLE: + oe -= _i; + } + xt = Ye === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : x(Le, Ye); + } else { + if (We = 0, this.mode === this.OBLIQ || this.mode === this.EQUIT) { + if (Le /= this.dd, Ye *= this.dd, Ie = X(Le * Le + Ye * Ye), Ie < $r) + return ge.x = this.long0, ge.y = this.lat0, ge; + ae = 2 * p(0.5 * Ie / this.rq), ee = Y(ae), Le *= ae = j(ae), this.mode === this.OBLIQ ? (We = ee * this.sinb1 + Ye * ae * this.cosb1 / Ie, ye = this.qp * We, Ye = Ie * this.cosb1 * ee - Ye * this.sinb1 * ae) : (We = Ye * ae / Ie, ye = this.qp * We, Ye = Ie * ee); + } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) { + if (this.mode === this.N_POLE && (Ye = -Ye), ye = Le * Le + Ye * Ye, !ye) + return ge.x = this.long0, ge.y = this.lat0, ge; + We = 1 - ye / this.qp, this.mode === this.S_POLE && (We = -We); + } + xt = x(Le, Ye), oe = Zt(p(We), this.apa); + } + return ge.x = yn(this.long0 + xt), ge.y = oe, ge; + }, names: ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"], S_POLE: 1, N_POLE: 2, EQUIT: 3, OBLIQ: 4 }, uh = function(ge) { + return 1 < n(ge) && (ge = 1 < ge ? 1 : -1), p(ge); + }, hi = { init: function() { + n(this.lat1 + this.lat2) < $r || (this.temp = this.b / this.a, this.es = 1 - s(this.temp, 2), this.e3 = X(this.es), this.sin_po = j(this.lat1), this.cos_po = Y(this.lat1), this.t1 = this.sin_po, this.con = this.sin_po, this.ms1 = Cs(this.e3, this.sin_po, this.cos_po), this.qs1 = yh(this.e3, this.sin_po, this.cos_po), this.sin_po = j(this.lat2), this.cos_po = Y(this.lat2), this.t2 = this.sin_po, this.ms2 = Cs(this.e3, this.sin_po, this.cos_po), this.qs2 = yh(this.e3, this.sin_po, this.cos_po), this.sin_po = j(this.lat0), this.cos_po = Y(this.lat0), this.t3 = this.sin_po, this.qs0 = yh(this.e3, this.sin_po, this.cos_po), this.ns0 = n(this.lat1 - this.lat2) > $r ? (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1) : this.con, this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1, this.rh = this.a * X(this.c - this.ns0 * this.qs0) / this.ns0); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y; + this.sin_phi = j(Ye), this.cos_phi = Y(Ye); + var xt = yh(this.e3, this.sin_phi, this.cos_phi), oe = this.a * X(this.c - this.ns0 * xt) / this.ns0, ee = this.ns0 * yn(Le - this.long0), ae = oe * j(ee) + this.x0, ye = this.rh - oe * Y(ee) + this.y0; + return ge.x = ae, ge.y = ye, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee, ae; + return ge.x -= this.x0, ge.y = this.rh - ge.y + this.y0, 0 <= this.ns0 ? (Le = X(ge.x * ge.x + ge.y * ge.y), xt = 1) : (Le = -X(ge.x * ge.x + ge.y * ge.y), xt = -1), oe = 0, Le !== 0 && (oe = x(xt * ge.x, xt * ge.y)), xt = Le * this.ns0 / this.a, this.sphere ? ae = p((this.c - xt * xt) / (2 * this.ns0)) : (Ye = (this.c - xt * xt) / this.ns0, ae = this.phi1z(this.e3, Ye)), ee = yn(oe / this.ns0 + this.long0), ge.x = ee, ge.y = ae, ge; + }, names: ["Albers_Conic_Equal_Area", "Albers", "aea"], phi1z: function(ge, Le) { + var Ye = uh(0.5 * Le), xt, oe, ee, ae, ye; + if (ge < $r) + return Ye; + for (var Ie = 1; 25 >= Ie; Ie++) + if (xt = j(Ye), oe = Y(Ye), ee = ge * xt, ae = 1 - ee * ee, ye = 0.5 * ae * ae / oe * (Le / (1 - ge * ge) - xt / ae + 0.5 / ge * r((1 - ee) / (1 + ee))), Ye += ye, 1e-7 >= n(ye)) + return Ye; + return null; + } }, ll = { init: function() { + this.sin_p14 = j(this.lat0), this.cos_p14 = Y(this.lat0), this.infinity_dist = 1e3 * this.a, this.rc = 1; + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt, oe, ee, ae, ye, Ie, We, Xe; + return ee = yn(Le - this.long0), xt = j(Ye), oe = Y(Ye), ae = Y(ee), Ie = this.sin_p14 * xt + this.cos_p14 * oe * ae, ye = 1, 0 < Ie || n(Ie) <= $r ? (We = this.x0 + this.a * ye * oe * j(ee) / Ie, Xe = this.y0 + this.a * ye * (this.cos_p14 * xt - this.sin_p14 * oe * ae) / Ie) : (We = this.x0 + this.infinity_dist * oe * j(ee), Xe = this.y0 + this.infinity_dist * (this.cos_p14 * xt - this.sin_p14 * oe * ae)), ge.x = We, ge.y = Xe, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee, ae; + return ge.x = (ge.x - this.x0) / this.a, ge.y = (ge.y - this.y0) / this.a, ge.x /= this.k0, ge.y /= this.k0, (Le = X(ge.x * ge.x + ge.y * ge.y)) ? (oe = x(Le, this.rc), Ye = j(oe), xt = Y(oe), ae = uh(xt * this.sin_p14 + ge.y * Ye * this.cos_p14 / Le), ee = x(ge.x * Ye, Le * this.cos_p14 * xt - ge.y * this.sin_p14 * Ye), ee = yn(this.long0 + ee)) : (ae = this.phic0, ee = 0), ge.x = ee, ge.y = ae, ge; + }, names: ["gnom"] }, Fp = function(ge, Le) { + var Ye = 1 - (1 - ge * ge) / (2 * ge) * r((1 - ge) / (1 + ge)); + if (1e-6 > n(n(Le) - Ye)) + return 0 > Le ? -1 * _i : _i; + for (var xt = p(0.5 * Le), oe = 0, ee, ae, ye, Ie; 30 > oe; oe++) + if (ae = j(xt), ye = Y(xt), Ie = ge * ae, ee = s(1 - Ie * Ie, 2) / (2 * ye) * (Le / (1 - ge * ge) - ae / (1 - Ie * Ie) + 0.5 / ge * r((1 - Ie) / (1 + Ie))), xt += ee, 1e-10 >= n(ee)) + return xt; + return NaN; + }, ug = { init: function() { + this.sphere || (this.k0 = Cs(this.e, j(this.lat_ts), Y(this.lat_ts))); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe, ee; + if (this.sphere) + oe = this.x0 + this.a * xt * Y(this.lat_ts), ee = this.y0 + this.a * j(Ye) / Y(this.lat_ts); + else { + var ae = yh(this.e, j(Ye)); + oe = this.x0 + this.a * this.k0 * xt, ee = this.y0 + 0.5 * (this.a * ae) / this.k0; + } + return ge.x = oe, ge.y = ee, ge; + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le, Ye; + return this.sphere ? (Le = yn(this.long0 + ge.x / this.a / Y(this.lat_ts)), Ye = p(ge.y / this.a * Y(this.lat_ts))) : (Ye = Fp(this.e, 2 * ge.y * this.k0 / this.a), Le = yn(this.long0 + ge.x / (this.a * this.k0))), ge.x = Le, ge.y = Ye, ge; + }, names: ["cea"] }, Wo = { init: function() { + this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Equidistant Cylindrical (Plate Carre)", this.rc = Y(this.lat_ts); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe = Gh(Ye - this.lat0); + return ge.x = this.x0 + this.a * xt * this.rc, ge.y = this.y0 + this.a * oe, ge; + }, inverse: function(ge) { + var Le = ge.x, Ye = ge.y; + return ge.x = yn(this.long0 + (Le - this.x0) / (this.a * this.rc)), ge.y = Gh(this.lat0 + (Ye - this.y0) / this.a), ge; + }, names: ["Equirectangular", "Equidistant_Cylindrical", "eqc"] }, lp = { init: function() { + this.temp = this.b / this.a, this.es = 1 - s(this.temp, 2), this.e = X(this.es), this.e0 = ah(this.es), this.e1 = jh(this.es), this.e2 = Rp(this.es), this.e3 = kl(this.es), this.ml0 = this.a * Tl(this.e0, this.e1, this.e2, this.e3, this.lat0); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe, ee, ae; + if (ae = xt * j(Ye), this.sphere) + n(Ye) <= $r ? (oe = this.a * xt, ee = -1 * this.a * this.lat0) : (oe = this.a * j(ae) / V(Ye), ee = this.a * (Gh(Ye - this.lat0) + (1 - Y(ae)) / V(Ye))); + else if (n(Ye) <= $r) + oe = this.a * xt, ee = -1 * this.ml0; + else { + var ye = lh(this.a, this.e, j(Ye)) / V(Ye); + oe = ye * j(ae), ee = this.a * Tl(this.e0, this.e1, this.e2, this.e3, Ye) - this.ml0 + ye * (1 - Y(ae)); + } + return ge.x = oe + this.x0, ge.y = ee + this.y0, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee, ae, ye, Ie, We; + if (xt = ge.x - this.x0, oe = ge.y - this.y0, this.sphere) + if (n(oe + this.a * this.lat0) <= $r) + Le = yn(xt / this.a + this.long0), Ye = 0; + else { + ae = this.lat0 + oe / this.a, ye = xt * xt / this.a / this.a + ae * ae, Ie = ae; + var Xe; + for (ee = 20; ee; --ee) + if (Xe = V(Ie), We = -1 * (ae * (Ie * Xe + 1) - Ie - 0.5 * (Ie * Ie + ye) * Xe) / ((Ie - ae) / Xe - 1), Ie += We, n(We) <= $r) { + Ye = Ie; + break; + } + Le = yn(this.long0 + p(xt * V(Ie) / this.a) / j(Ye)); + } + else if (n(oe + this.ml0) <= $r) + Ye = 0, Le = yn(this.long0 + xt / this.a); + else { + ae = (this.ml0 + oe) / this.a, ye = xt * xt / this.a / this.a + ae * ae, Ie = ae; + var lt, Et, Ht, vi, yi; + for (ee = 20; ee; --ee) + if (yi = this.e * j(Ie), lt = X(1 - yi * yi) * V(Ie), Et = this.a * Tl(this.e0, this.e1, this.e2, this.e3, Ie), Ht = this.e0 - 2 * this.e1 * Y(2 * Ie) + 4 * this.e2 * Y(4 * Ie) - 6 * this.e3 * Y(6 * Ie), vi = Et / this.a, We = (ae * (lt * vi + 1) - vi - 0.5 * lt * (vi * vi + ye)) / (this.es * j(2 * Ie) * (vi * vi + ye - 2 * ae * vi) / (4 * lt) + (ae - vi) * (lt * Ht - 2 / j(2 * Ie)) - Ht), Ie -= We, n(We) <= $r) { + Ye = Ie; + break; + } + lt = X(1 - this.es * s(j(Ye), 2)) * V(Ye), Le = yn(this.long0 + p(xt * lt / this.a) / j(Ye)); + } + return ge.x = Le, ge.y = Ye, ge; + }, names: ["Polyconic", "poly"] }, Hs = { init: function() { + this.A = [], this.A[1] = 0.6399175073, this.A[2] = -0.1358797613, this.A[3] = 0.063294409, this.A[4] = -0.02526853, this.A[5] = 0.0117879, this.A[6] = -55161e-7, this.A[7] = 26906e-7, this.A[8] = -1333e-6, this.A[9] = 67e-5, this.A[10] = -34e-5, this.B_re = [], this.B_im = [], this.B_re[1] = 0.7557853228, this.B_im[1] = 0, this.B_re[2] = 0.249204646, this.B_im[2] = 3371507e-9, this.B_re[3] = -1541739e-9, this.B_im[3] = 0.04105856, this.B_re[4] = -0.10162907, this.B_im[4] = 0.01727609, this.B_re[5] = -0.26623489, this.B_im[5] = -0.36249218, this.B_re[6] = -0.6870983, this.B_im[6] = -1.1651967, this.C_re = [], this.C_im = [], this.C_re[1] = 1.3231270439, this.C_im[1] = 0, this.C_re[2] = -0.577245789, this.C_im[2] = -7809598e-9, this.C_re[3] = 0.508307513, this.C_im[3] = -0.112208952, this.C_re[4] = -0.15094762, this.C_im[4] = 0.18200602, this.C_re[5] = 1.01418179, this.C_im[5] = 1.64497696, this.C_re[6] = 1.9660549, this.C_im[6] = 2.5127645, this.D = [], this.D[1] = 1.5627014243, this.D[2] = 0.5185406398, this.D[3] = -0.03333098, this.D[4] = -0.1052906, this.D[5] = -0.0368594, this.D[6] = 7317e-6, this.D[7] = 0.0122, this.D[8] = 394e-5, this.D[9] = -13e-4; + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = Ye - this.lat0, oe = Le - this.long0, ee = 1, ae = 0, ye; + for (ye = 1; 10 >= ye; ye++) + ee *= 1e-5 * (xt / rr), ae += this.A[ye] * ee; + var Ie = ae, We = oe, Xe = 1, lt = 0, Et = 0, Ht = 0, vi, yi; + for (ye = 1; 6 >= ye; ye++) + vi = Xe * Ie - lt * We, yi = lt * Ie + Xe * We, Xe = vi, lt = yi, Et = Et + this.B_re[ye] * Xe - this.B_im[ye] * lt, Ht = Ht + this.B_im[ye] * Xe + this.B_re[ye] * lt; + return ge.x = Ht * this.a + this.x0, ge.y = Et * this.a + this.y0, ge; + }, inverse: function(ge) { + var Le = ge.x, Ye = ge.y, xt = Le - this.x0, oe = Ye - this.y0, ee = oe / this.a, ae = xt / this.a, ye = 1, Ie = 0, We = 0, Xe = 0, lt, Et, Ht; + for (lt = 1; 6 >= lt; lt++) + Et = ye * ee - Ie * ae, Ht = Ie * ee + ye * ae, ye = Et, Ie = Ht, We = We + this.C_re[lt] * ye - this.C_im[lt] * Ie, Xe = Xe + this.C_im[lt] * ye + this.C_re[lt] * Ie; + for (var vi = 0; vi < this.iterations; vi++) { + var yi = We, Oi = Xe, zi = ee, ar = ae, tr, Ir; + for (lt = 2; 6 >= lt; lt++) + tr = yi * We - Oi * Xe, Ir = Oi * We + yi * Xe, yi = tr, Oi = Ir, zi += (lt - 1) * (this.B_re[lt] * yi - this.B_im[lt] * Oi), ar += (lt - 1) * (this.B_im[lt] * yi + this.B_re[lt] * Oi); + yi = 1, Oi = 0; + var ur = this.B_re[1], Jr = this.B_im[1]; + for (lt = 2; 6 >= lt; lt++) + tr = yi * We - Oi * Xe, Ir = Oi * We + yi * Xe, yi = tr, Oi = Ir, ur += lt * (this.B_re[lt] * yi - this.B_im[lt] * Oi), Jr += lt * (this.B_im[lt] * yi + this.B_re[lt] * Oi); + var on = ur * ur + Jr * Jr; + We = (zi * ur + ar * Jr) / on, Xe = (ar * ur - zi * Jr) / on; + } + var $n = We, Fs = Xe, Ro = 1, Wa = 0; + for (lt = 1; 9 >= lt; lt++) + Ro *= $n, Wa += this.D[lt] * Ro; + var Ks = this.lat0 + 1e5 * (Wa * rr), vs = this.long0 + Fs; + return ge.x = vs, ge.y = Ks, ge; + }, names: ["New_Zealand_Map_Grid", "nzmg"] }, Xs = { init: function() { + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe = this.x0 + this.a * xt, ee = this.y0 + 1.25 * (this.a * r(V(P / 4 + Ye / 2.5))); + return ge.x = oe, ge.y = ee, ge; + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le = yn(this.long0 + ge.x / this.a), Ye = 2.5 * (F(k(0.8 * ge.y / this.a)) - P / 4); + return ge.x = Le, ge.y = Ye, ge; + }, names: ["Miller_Cylindrical", "mill"] }, ql = { init: function() { + this.sphere ? (this.n = 1, this.m = 0, this.es = 0, this.C_y = X((this.m + 1) / this.n), this.C_x = this.C_y / (this.m + 1)) : this.en = ri(this.es); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt, oe; + if (Le = yn(Le - this.long0), this.sphere) { + if (!this.m) + Ye = this.n === 1 ? Ye : p(this.n * j(Ye)); + else + for (var ee = this.n * j(Ye), ae = 20, ye; ae && (ye = (this.m * Ye + j(Ye) - ee) / (this.m + Y(Ye)), Ye -= ye, !(n(ye) < $r)); --ae) + ; + xt = this.a * this.C_x * Le * (this.m + Y(Ye)), oe = this.a * this.C_y * Ye; + } else { + var Ie = j(Ye), We = Y(Ye); + oe = this.a * pi(Ye, Ie, We, this.en), xt = this.a * Le * We / X(1 - this.es * Ie * Ie); + } + return ge.x = xt, ge.y = oe, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe; + return ge.x -= this.x0, xt = ge.x / this.a, ge.y -= this.y0, Le = ge.y / this.a, this.sphere ? (Le /= this.C_y, xt /= this.C_x * (this.m + Y(Le)), this.m ? Le = uh((this.m * Le + j(Le)) / this.n) : this.n !== 1 && (Le = uh(j(Le) / this.n)), xt = yn(xt + this.long0), Le = Gh(Le)) : (Le = mi(ge.y / this.a, this.es, this.en), oe = n(Le), oe < _i ? (oe = j(Le), Ye = this.long0 + ge.x * X(1 - this.es * oe * oe) / (this.a * Y(Le)), xt = yn(Ye)) : oe - $r < _i && (xt = this.long0)), ge.x = xt, ge.y = Le, ge; + }, names: ["Sinusoidal", "sinu"] }, Su = { init: function() { + }, forward: function(ge) { + for (var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe = Ye, ee = P * j(Ye), ae; ae = -(oe + j(oe) - ee) / (1 + Y(oe)), oe += ae, !(n(ae) < $r); ) + ; + oe /= 2, P / 2 - n(Ye) < $r && (xt = 0); + var ye = 0.900316316158 * this.a * xt * Y(oe) + this.x0, Ie = 1.4142135623731 * this.a * j(oe) + this.y0; + return ge.x = ye, ge.y = Ie, ge; + }, inverse: function(ge) { + var Le, Ye; + ge.x -= this.x0, ge.y -= this.y0, Ye = ge.y / (1.4142135623731 * this.a), 0.999999999999 < n(Ye) && (Ye = 0.999999999999), Le = p(Ye); + var xt = yn(this.long0 + ge.x / (0.900316316158 * this.a * Y(Le))); + xt < -P && (xt = -P), xt > P && (xt = P), Ye = (2 * Le + j(2 * Le)) / P, 1 < n(Ye) && (Ye = 1); + var oe = p(Ye); + return ge.x = xt, ge.y = oe, ge; + }, names: ["Mollweide", "moll"] }, Im = { init: function() { + n(this.lat1 + this.lat2) < $r || (this.lat2 = this.lat2 || this.lat1, this.temp = this.b / this.a, this.es = 1 - s(this.temp, 2), this.e = X(this.es), this.e0 = ah(this.es), this.e1 = jh(this.es), this.e2 = Rp(this.es), this.e3 = kl(this.es), this.sinphi = j(this.lat1), this.cosphi = Y(this.lat1), this.ms1 = Cs(this.e, this.sinphi, this.cosphi), this.ml1 = Tl(this.e0, this.e1, this.e2, this.e3, this.lat1), n(this.lat1 - this.lat2) < $r ? this.ns = this.sinphi : (this.sinphi = j(this.lat2), this.cosphi = Y(this.lat2), this.ms2 = Cs(this.e, this.sinphi, this.cosphi), this.ml2 = Tl(this.e0, this.e1, this.e2, this.e3, this.lat2), this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1)), this.g = this.ml1 + this.ms1 / this.ns, this.ml0 = Tl(this.e0, this.e1, this.e2, this.e3, this.lat0), this.rh = this.a * (this.g - this.ml0)); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt; + if (this.sphere) + xt = this.a * (this.g - Ye); + else { + var oe = Tl(this.e0, this.e1, this.e2, this.e3, Ye); + xt = this.a * (this.g - oe); + } + var ee = this.ns * yn(Le - this.long0), ae = this.x0 + xt * j(ee), ye = this.y0 + this.rh - xt * Y(ee); + return ge.x = ae, ge.y = ye, ge; + }, inverse: function(ge) { + ge.x -= this.x0, ge.y = this.rh - ge.y + this.y0; + var Le, Ye, xt, oe; + 0 <= this.ns ? (Ye = X(ge.x * ge.x + ge.y * ge.y), Le = 1) : (Ye = -X(ge.x * ge.x + ge.y * ge.y), Le = -1); + var ee = 0; + if (Ye !== 0 && (ee = x(Le * ge.x, Le * ge.y)), this.sphere) + return oe = yn(this.long0 + ee / this.ns), xt = Gh(this.g - Ye / this.a), ge.x = oe, ge.y = xt, ge; + var ae = this.g - Ye / this.a; + return xt = ou(ae, this.e0, this.e1, this.e2, this.e3), oe = yn(this.long0 + ee / this.ns), ge.x = oe, ge.y = xt, ge; + }, names: ["Equidistant_Conic", "eqdc"] }, Vc = { init: function() { + this.R = this.a; + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = yn(Le - this.long0), oe, ee; + n(Ye) <= $r && (oe = this.x0 + this.R * xt, ee = this.y0); + var ae = uh(2 * n(Ye / P)); + (n(xt) <= $r || n(n(Ye) - _i) <= $r) && (oe = this.x0, ee = 0 <= Ye ? this.y0 + P * this.R * V(0.5 * ae) : this.y0 + P * this.R * -V(0.5 * ae)); + var ye = 0.5 * n(P / xt - xt / P), Ie = ye * ye, We = j(ae), Xe = Y(ae), lt = Xe / (We + Xe - 1), Et = lt * (2 / We - 1), Ht = Et * Et, vi = P * this.R * (ye * (lt - Ht) + X(Ie * (lt - Ht) * (lt - Ht) - (Ht + Ie) * (lt * lt - Ht))) / (Ht + Ie); + 0 > xt && (vi = -vi), oe = this.x0 + vi; + var yi = Ie + lt; + return vi = P * this.R * (Et * yi - ye * X((Ht + Ie) * (Ie + 1) - yi * yi)) / (Ht + Ie), ee = 0 <= Ye ? this.y0 + vi : this.y0 - vi, ge.x = oe, ge.y = ee, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee, ae, ye, Ie, We, Xe, lt, Et, Ht; + return ge.x -= this.x0, ge.y -= this.y0, lt = P * this.R, xt = ge.x / lt, oe = ge.y / lt, ee = xt * xt + oe * oe, ae = -n(oe) * (1 + ee), ye = ae - 2 * oe * oe + xt * xt, Ie = -2 * ae + 1 + 2 * oe * oe + ee * ee, Ht = oe * oe / Ie + (2 * ye * ye * ye / Ie / Ie / Ie - 9 * ae * ye / Ie / Ie) / 27, We = (ae - ye * ye / 3 / Ie) / Ie, Xe = 2 * X(-We / 3), lt = 3 * Ht / We / Xe, 1 < n(lt) && (0 <= lt ? lt = 1 : lt = -1), Et = y(lt) / 3, Ye = 0 <= ge.y ? (-Xe * Y(Et + P / 3) - ye / 3 / Ie) * P : -(-Xe * Y(Et + P / 3) - ye / 3 / Ie) * P, Le = n(xt) < $r ? this.long0 : yn(this.long0 + P * (ee - 1 + X(1 + 2 * (xt * xt - oe * oe) + ee * ee)) / 2 / xt), ge.x = Le, ge.y = Ye, ge; + }, names: ["Van_der_Grinten_I", "VanDerGrinten", "vandg"] }, jc = { init: function() { + this.sin_p12 = j(this.lat0), this.cos_p12 = Y(this.lat0); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt = j(ge.y), oe = Y(ge.y), ee = yn(Le - this.long0), ae, ye, Ie, We, Xe, lt, Et, Ht, vi, yi, Oi, zi, ar, tr, Ir, ur, Jr, on, $n, Fs, Ro, Wa, Ks; + return this.sphere ? n(this.sin_p12 - 1) <= $r ? (ge.x = this.x0 + this.a * (_i - Ye) * j(ee), ge.y = this.y0 - this.a * (_i - Ye) * Y(ee), ge) : n(this.sin_p12 + 1) <= $r ? (ge.x = this.x0 + this.a * (_i + Ye) * j(ee), ge.y = this.y0 + this.a * (_i + Ye) * Y(ee), ge) : (on = this.sin_p12 * xt + this.cos_p12 * oe * Y(ee), ur = y(on), Jr = ur ? ur / j(ur) : 1, ge.x = this.x0 + this.a * Jr * oe * j(ee), ge.y = this.y0 + this.a * Jr * (this.cos_p12 * xt - this.sin_p12 * oe * Y(ee)), ge) : (ae = ah(this.es), ye = jh(this.es), Ie = Rp(this.es), We = kl(this.es), n(this.sin_p12 - 1) <= $r ? (Xe = this.a * Tl(ae, ye, Ie, We, _i), lt = this.a * Tl(ae, ye, Ie, We, Ye), ge.x = this.x0 + (Xe - lt) * j(ee), ge.y = this.y0 - (Xe - lt) * Y(ee), ge) : n(this.sin_p12 + 1) <= $r ? (Xe = this.a * Tl(ae, ye, Ie, We, _i), lt = this.a * Tl(ae, ye, Ie, We, Ye), ge.x = this.x0 + (Xe + lt) * j(ee), ge.y = this.y0 + (Xe + lt) * Y(ee), ge) : (Et = xt / oe, Ht = lh(this.a, this.e, this.sin_p12), vi = lh(this.a, this.e, xt), yi = F((1 - this.es) * Et + this.es * Ht * this.sin_p12 / (vi * oe)), Oi = x(j(ee), this.cos_p12 * V(yi) - this.sin_p12 * Y(ee)), $n = Oi === 0 ? p(this.cos_p12 * j(yi) - this.sin_p12 * Y(yi)) : n(n(Oi) - P) <= $r ? -p(this.cos_p12 * j(yi) - this.sin_p12 * Y(yi)) : p(j(ee) * Y(yi) / j(Oi)), zi = this.e * this.sin_p12 / X(1 - this.es), ar = this.e * this.cos_p12 * Y(Oi) / X(1 - this.es), tr = zi * ar, Ir = ar * ar, Fs = $n * $n, Ro = Fs * $n, Wa = Ro * $n, Ks = Wa * $n, ur = Ht * $n * (1 - Fs * Ir * (1 - Ir) / 6 + Ro / 8 * tr * (1 - 2 * Ir) + Wa / 120 * (Ir * (4 - 7 * Ir) - 3 * zi * zi * (1 - 7 * Ir)) - Ks / 48 * tr), ge.x = this.x0 + ur * j(Oi), ge.y = this.y0 + ur * Y(Oi), ge)); + }, inverse: function(ge) { + ge.x -= this.x0, ge.y -= this.y0; + var Le, Ye, xt, oe, ee, ae, ye, Ie, We, Xe, lt, Et, Ht, vi, yi, Oi, zi, ar, tr, Ir, ur, Jr, on, $n; + return this.sphere ? (Le = X(ge.x * ge.x + ge.y * ge.y), Le > 2 * _i * this.a ? void 0 : (Ye = Le / this.a, xt = j(Ye), oe = Y(Ye), ee = this.long0, n(Le) <= $r ? ae = this.lat0 : (ae = uh(oe * this.sin_p12 + ge.y * xt * this.cos_p12 / Le), ye = n(this.lat0) - _i, ee = n(ye) <= $r ? 0 <= this.lat0 ? yn(this.long0 + x(ge.x, -ge.y)) : yn(this.long0 - x(-ge.x, ge.y)) : yn(this.long0 + x(ge.x * xt, Le * this.cos_p12 * oe - ge.y * this.sin_p12 * xt))), ge.x = ee, ge.y = ae, ge)) : (Ie = ah(this.es), We = jh(this.es), Xe = Rp(this.es), lt = kl(this.es), n(this.sin_p12 - 1) <= $r ? (Et = this.a * Tl(Ie, We, Xe, lt, _i), Le = X(ge.x * ge.x + ge.y * ge.y), Ht = Et - Le, ae = ou(Ht / this.a, Ie, We, Xe, lt), ee = yn(this.long0 + x(ge.x, -1 * ge.y)), ge.x = ee, ge.y = ae, ge) : n(this.sin_p12 + 1) <= $r ? (Et = this.a * Tl(Ie, We, Xe, lt, _i), Le = X(ge.x * ge.x + ge.y * ge.y), Ht = Le - Et, ae = ou(Ht / this.a, Ie, We, Xe, lt), ee = yn(this.long0 + x(ge.x, ge.y)), ge.x = ee, ge.y = ae, ge) : (Le = X(ge.x * ge.x + ge.y * ge.y), Oi = x(ge.x, ge.y), vi = lh(this.a, this.e, this.sin_p12), zi = Y(Oi), ar = this.e * this.cos_p12 * zi, tr = -ar * ar / (1 - this.es), Ir = 3 * this.es * (1 - tr) * this.sin_p12 * this.cos_p12 * zi / (1 - this.es), ur = Le / vi, Jr = ur - tr * (1 + tr) * s(ur, 3) / 6 - Ir * (1 + 3 * tr) * s(ur, 4) / 24, on = 1 - tr * Jr * Jr / 2 - ur * Jr * Jr * Jr / 6, yi = p(this.sin_p12 * Y(Jr) + this.cos_p12 * j(Jr) * zi), ee = yn(this.long0 + p(j(Oi) * j(Jr) / Y(yi))), $n = j(yi), ae = x(($n - this.es * on * this.sin_p12) * V(yi), $n * (1 - this.es)), ge.x = ee, ge.y = ae, ge)); + }, names: ["Azimuthal_Equidistant", "aeqd"] }, gu = { init: function() { + this.sin_p14 = j(this.lat0), this.cos_p14 = Y(this.lat0); + }, forward: function(ge) { + var Le = ge.x, Ye = ge.y, xt, oe, ee, ae, ye, Ie, We, Xe; + return ee = yn(Le - this.long0), xt = j(Ye), oe = Y(Ye), ae = Y(ee), Ie = this.sin_p14 * xt + this.cos_p14 * oe * ae, ye = 1, (0 < Ie || n(Ie) <= $r) && (We = this.a * ye * oe * j(ee), Xe = this.y0 + this.a * ye * (this.cos_p14 * xt - this.sin_p14 * oe * ae)), ge.x = We, ge.y = Xe, ge; + }, inverse: function(ge) { + var Le, Ye, xt, oe, ee, ae, ye; + return ge.x -= this.x0, ge.y -= this.y0, Le = X(ge.x * ge.x + ge.y * ge.y), Ye = uh(Le / this.a), xt = j(Ye), oe = Y(Ye), ae = this.long0, n(Le) <= $r ? (ye = this.lat0, ge.x = ae, ge.y = ye, ge) : (ye = uh(oe * this.sin_p14 + ge.y * xt * this.cos_p14 / Le), ee = n(this.lat0) - _i, n(ee) <= $r ? (ae = 0 <= this.lat0 ? yn(this.long0 + x(ge.x, -ge.y)) : yn(this.long0 - x(-ge.x, ge.y)), ge.x = ae, ge.y = ye, ge) : (ae = yn(this.long0 + x(ge.x * xt, Le * this.cos_p14 * oe - ge.y * this.sin_p14 * xt)), ge.x = ae, ge.y = ye, ge)); + }, names: ["ortho"] }, Yl = { FRONT: 1, RIGHT: 2, BACK: 3, LEFT: 4, TOP: 5, BOTTOM: 6 }, Ba = { AREA_0: 1, AREA_1: 2, AREA_2: 3, AREA_3: 4 }, vh = { init: function() { + this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Quadrilateralized Spherical Cube", this.face = this.lat0 >= _i - On / 2 ? Yl.TOP : this.lat0 <= -(_i - On / 2) ? Yl.BOTTOM : n(this.long0) <= On ? Yl.FRONT : n(this.long0) <= _i + On ? 0 < this.long0 ? Yl.RIGHT : Yl.LEFT : Yl.BACK, this.es !== 0 && (this.one_minus_f = 1 - (this.a - this.b) / this.a, this.one_minus_f_squared = this.one_minus_f * this.one_minus_f); + }, forward: function(ge) { + var Le = { x: 0, y: 0 }, Ye = { value: 0 }, xt, oe, ee, ae, ye, Ie; + if (ge.x -= this.long0, xt = this.es === 0 ? ge.y : F(this.one_minus_f_squared * V(ge.y)), oe = ge.x, this.face === Yl.TOP) + ae = _i - xt, oe >= On && oe <= _i + On ? (Ye.value = Ba.AREA_0, ee = oe - _i) : oe > _i + On || oe <= -(_i + On) ? (Ye.value = Ba.AREA_1, ee = 0 < oe ? oe - ki : oe + ki) : oe > -(_i + On) && oe <= -On ? (Ye.value = Ba.AREA_2, ee = oe + _i) : (Ye.value = Ba.AREA_3, ee = oe); + else if (this.face === Yl.BOTTOM) + ae = _i + xt, oe >= On && oe <= _i + On ? (Ye.value = Ba.AREA_0, ee = -oe + _i) : oe < On && oe >= -On ? (Ye.value = Ba.AREA_1, ee = -oe) : oe < -On && oe >= -(_i + On) ? (Ye.value = Ba.AREA_2, ee = -oe - _i) : (Ye.value = Ba.AREA_3, ee = 0 < oe ? -oe + ki : -oe - ki); + else { + var We, Xe, lt, Et, Ht, vi, yi; + this.face === Yl.RIGHT ? oe = Xt(oe, +_i) : this.face === Yl.BACK ? oe = Xt(oe, +ki) : this.face === Yl.LEFT && (oe = Xt(oe, -_i)), Et = j(xt), Ht = Y(xt), vi = j(oe), yi = Y(oe), We = Ht * yi, Xe = Ht * vi, lt = Et, this.face === Yl.FRONT ? (ae = y(We), ee = Jt(ae, lt, Xe, Ye)) : this.face === Yl.RIGHT ? (ae = y(Xe), ee = Jt(ae, lt, -We, Ye)) : this.face === Yl.BACK ? (ae = y(-We), ee = Jt(ae, lt, -Xe, Ye)) : this.face === Yl.LEFT ? (ae = y(-Xe), ee = Jt(ae, lt, We, Ye)) : (ae = ee = 0, Ye.value = Ba.AREA_0); + } + return Ie = F(12 / ki * (ee + y(j(ee) * Y(On)) - _i)), ye = X((1 - Y(ae)) / (Y(Ie) * Y(Ie)) / (1 - Y(F(1 / Y(ee))))), Ye.value === Ba.AREA_1 ? Ie += _i : Ye.value === Ba.AREA_2 ? Ie += ki : Ye.value === Ba.AREA_3 && (Ie += 1.5 * ki), Le.x = ye * Y(Ie), Le.y = ye * j(Ie), Le.x = Le.x * this.a + this.x0, Le.y = Le.y * this.a + this.y0, ge.x = Le.x, ge.y = Le.y, ge; + }, inverse: function(ge) { + var Le = { lam: 0, phi: 0 }, Ye = { value: 0 }, xt, oe, ee, ae, ye, Ie, We, Xe, lt; + if (ge.x = (ge.x - this.x0) / this.a, ge.y = (ge.y - this.y0) / this.a, oe = F(X(ge.x * ge.x + ge.y * ge.y)), xt = x(ge.y, ge.x), 0 <= ge.x && ge.x >= n(ge.y) ? Ye.value = Ba.AREA_0 : 0 <= ge.y && ge.y >= n(ge.x) ? (Ye.value = Ba.AREA_1, xt -= _i) : 0 > ge.x && -ge.x >= n(ge.y) ? (Ye.value = Ba.AREA_2, xt = 0 > xt ? xt + ki : xt - ki) : (Ye.value = Ba.AREA_3, xt += _i), lt = ki / 12 * V(xt), ye = j(lt) / (Y(lt) - 1 / X(2)), Ie = F(ye), ee = Y(xt), ae = V(oe), We = 1 - ee * ee * ae * ae * (1 - Y(F(1 / Y(Ie)))), -1 > We ? We = -1 : 1 < We && (We = 1), this.face === Yl.TOP) + Xe = y(We), Le.phi = _i - Xe, Le.lam = Ye.value === Ba.AREA_0 ? Ie + _i : Ye.value === Ba.AREA_1 ? 0 > Ie ? Ie + ki : Ie - ki : Ye.value === Ba.AREA_2 ? Ie - _i : Ie; + else if (this.face === Yl.BOTTOM) + Xe = y(We), Le.phi = Xe - _i, Le.lam = Ye.value === Ba.AREA_0 ? -Ie + _i : Ye.value === Ba.AREA_1 ? -Ie : Ye.value === Ba.AREA_2 ? -Ie - _i : 0 > Ie ? -Ie - ki : -Ie + ki; + else { + var Et, Ht, vi; + Et = We, lt = Et * Et, vi = 1 <= lt ? 0 : X(1 - lt) * j(Ie), lt += vi * vi, Ht = 1 <= lt ? 0 : X(1 - lt), Ye.value === Ba.AREA_1 ? (lt = Ht, Ht = -vi, vi = lt) : Ye.value === Ba.AREA_2 ? (Ht = -Ht, vi = -vi) : Ye.value === Ba.AREA_3 && (lt = Ht, Ht = vi, vi = -lt), this.face === Yl.RIGHT ? (lt = Et, Et = -Ht, Ht = lt) : this.face === Yl.BACK ? (Et = -Et, Ht = -Ht) : this.face === Yl.LEFT && (lt = Et, Et = Ht, Ht = -lt), Le.phi = y(-vi) - _i, Le.lam = x(Ht, Et), this.face === Yl.RIGHT ? Le.lam = Xt(Le.lam, -_i) : this.face === Yl.BACK ? Le.lam = Xt(Le.lam, -ki) : this.face === Yl.LEFT && (Le.lam = Xt(Le.lam, +_i)); + } + if (this.es !== 0) { + var yi, Oi, zi; + yi = 0 > Le.phi ? 1 : 0, Oi = V(Le.phi), zi = this.b / X(Oi * Oi + this.one_minus_f_squared), Le.phi = F(X(this.a * this.a - zi * zi) / (this.one_minus_f * zi)), yi && (Le.phi = -Le.phi); + } + return Le.lam += this.long0, ge.x = Le.lam, ge.y = Le.phi, ge; + }, names: ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"] }, Yu = [[1, 22199e-21, -715515e-10, 31103e-10], [0.9986, -482243e-9, -24897e-9, -13309e-10], [0.9954, -83103e-8, -448605e-10, -986701e-12], [0.99, -135364e-8, -59661e-9, 36777e-10], [0.9822, -167442e-8, -449547e-11, -572411e-11], [0.973, -214868e-8, -903571e-10, 18736e-12], [0.96, -305085e-8, -900761e-10, 164917e-11], [0.9427, -382792e-8, -653386e-10, -26154e-10], [0.9216, -467746e-8, -10457e-8, 481243e-11], [0.8962, -536223e-8, -323831e-10, -543432e-11], [0.8679, -609363e-8, -113898e-9, 332484e-11], [0.835, -698325e-8, -640253e-10, 934959e-12], [0.7986, -755338e-8, -500009e-10, 935324e-12], [0.7597, -798324e-8, -35971e-9, -227626e-11], [0.7186, -851367e-8, -701149e-10, -86303e-10], [0.6732, -986209e-8, -199569e-9, 191974e-10], [0.6213, -0.010418, 883923e-10, 624051e-11], [0.5722, -906601e-8, 182e-6, 624051e-11], [0.5322, -677797e-8, 275608e-9, 624051e-11]], $l = [[-520417e-23, 0.0124, 121431e-23, -845284e-16], [0.062, 0.0124, -126793e-14, 422642e-15], [0.124, 0.0124, 507171e-14, -160604e-14], [0.186, 0.0123999, -190189e-13, 600152e-14], [0.248, 0.0124002, 710039e-13, -224e-10], [0.31, 0.0123992, -264997e-12, 835986e-13], [0.372, 0.0124029, 988983e-12, -311994e-12], [0.434, 0.0123893, -369093e-11, -435621e-12], [0.4958, 0.0123198, -102252e-10, -345523e-12], [0.5571, 0.0121916, -154081e-10, -582288e-12], [0.6176, 0.0119938, -241424e-10, -525327e-12], [0.6769, 0.011713, -320223e-10, -516405e-12], [0.7346, 0.0113541, -397684e-10, -609052e-12], [0.7903, 0.0109107, -489042e-10, -104739e-11], [0.8435, 0.0103431, -64615e-9, -140374e-14], [0.8936, 969686e-8, -64636e-9, -8547e-9], [0.9394, 840947e-8, -192841e-9, -42106e-10], [0.9761, 616527e-8, -256e-6, -42106e-10], [1, 328947e-8, -319159e-9, -42106e-10]], _c = 0.8487, Am = 1.3523, Gd = bs / 5, df = function(ge, Le) { + return ge[0] + Le * (ge[1] + Le * (ge[2] + Le * ge[3])); + }, Ug = function(ge, Le) { + return ge[1] + Le * (2 * ge[2] + 3 * Le * ge[3]); + }, cg = { init: function() { + this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.long0 = this.long0 || 0, this.es = 0, this.title = this.title || "Robinson"; + }, forward: function(ge) { + var Le = yn(ge.x - this.long0), Ye = n(ge.y), xt = i(Ye * Gd); + 0 > xt ? xt = 0 : 18 <= xt && (xt = 17), Ye = bs * (Ye - 1 / Gd * xt); + var oe = { x: df(Yu[xt], Ye) * Le, y: df($l[xt], Ye) }; + return 0 > ge.y && (oe.y = -oe.y), oe.x = oe.x * this.a * _c + this.x0, oe.y = oe.y * this.a * Am + this.y0, oe; + }, inverse: function(ge) { + var Le = { x: (ge.x - this.x0) / (this.a * _c), y: n(ge.y - this.y0) / (this.a * Am) }; + if (1 <= Le.y) + Le.x /= Yu[18][0], Le.y = 0 > ge.y ? -_i : _i; + else { + var Ye = i(18 * Le.y); + for (0 > Ye ? Ye = 0 : 18 <= Ye && (Ye = 17); ; ) + if ($l[Ye][0] > Le.y) + --Ye; + else if ($l[Ye + 1][0] <= Le.y) + ++Ye; + else + break; + var xt = $l[Ye], oe = 5 * (Le.y - xt[0]) / ($l[Ye + 1][0] - xt[0]); + oe = Qt(function(ee) { + return (df(xt, ee) - Le.y) / Ug(xt, ee); + }, oe, $r, 100), Le.x /= df(Yu[Ye], oe), Le.y = (5 * Ye + oe) * Zn, 0 > ge.y && (Le.y = -Le.y); + } + return Le.x = yn(Le.x + this.long0), Le; + }, names: ["Robinson", "robin"] }, zt = { init: function() { + this.name = "geocent"; + }, forward: function(ge) { + var Le = pe(ge, this.es, this.a); + return Le; + }, inverse: function(ge) { + var Le = Ae(ge, this.es, this.a, this.b); + return Le; + }, names: ["Geocentric", "geocentric", "geocent", "Geocent"] }, Wt = { N_POLE: 0, S_POLE: 1, EQUIT: 2, OBLIQ: 3 }, Ai = { h: { def: 1e5, num: !0 }, azi: { def: 0, num: !0, degrees: !0 }, tilt: { def: 0, num: !0, degrees: !0 }, long0: { def: 0, num: !0 }, lat0: { def: 0, num: !0 } }, Ui = { init: function() { + if (Object.keys(Ai).forEach(function(Ye) { + if (typeof this[Ye] > "u") + this[Ye] = Ai[Ye].def; + else { + if (Ai[Ye].num && isNaN(this[Ye])) + throw new Error("Invalid parameter value, must be numeric " + Ye + " = " + this[Ye]); + Ai[Ye].num && (this[Ye] = parseFloat(this[Ye])); + } + Ai[Ye].degrees && (this[Ye] *= Zn); + }.bind(this)), n(n(this.lat0) - _i) < $r ? this.mode = 0 > this.lat0 ? Wt.S_POLE : Wt.N_POLE : n(this.lat0) < $r ? this.mode = Wt.EQUIT : (this.mode = Wt.OBLIQ, this.sinph0 = j(this.lat0), this.cosph0 = Y(this.lat0)), this.pn1 = this.h / this.a, 0 >= this.pn1 || 1e10 < this.pn1) + throw new Error("Invalid height"); + this.p = 1 + this.pn1, this.rp = 1 / this.p, this.h1 = 1 / this.pn1, this.pfact = (this.p + 1) * this.h1, this.es = 0; + var ge = this.tilt, Le = this.azi; + this.cg = Y(Le), this.sg = j(Le), this.cw = Y(ge), this.sw = j(ge); + }, forward: function(ge) { + ge.x -= this.long0; + var Le = j(ge.y), Ye = Y(ge.y), xt = Y(ge.x), oe, ee; + switch (this.mode) { + case Wt.OBLIQ: + ee = this.sinph0 * Le + this.cosph0 * Ye * xt; + break; + case Wt.EQUIT: + ee = Ye * xt; + break; + case Wt.S_POLE: + ee = -Le; + break; + case Wt.N_POLE: + ee = Le; + } + switch (ee = this.pn1 / (this.p - ee), oe = ee * Ye * j(ge.x), this.mode) { + case Wt.OBLIQ: + ee *= this.cosph0 * Le - this.sinph0 * Ye * xt; + break; + case Wt.EQUIT: + ee *= Le; + break; + case Wt.N_POLE: + ee *= -(Ye * xt); + break; + case Wt.S_POLE: + ee *= Ye * xt; + } + var ae, ye; + return ae = ee * this.cg + oe * this.sg, ye = 1 / (ae * this.sw * this.h1 + this.cw), oe = (oe * this.cg - ee * this.sg) * this.cw * ye, ee = ae * ye, ge.x = oe * this.a, ge.y = ee * this.a, ge; + }, inverse: function(ge) { + ge.x /= this.a, ge.y /= this.a; + var Le = { x: ge.x, y: ge.y }, Ye, xt, oe; + oe = 1 / (this.pn1 - ge.y * this.sw), Ye = this.pn1 * ge.x * oe, xt = this.pn1 * ge.y * this.cw * oe, ge.x = Ye * this.cg + xt * this.sg, ge.y = xt * this.cg - Ye * this.sg; + var ee = wr(ge.x, ge.y); + if (n(ee) < $r) + Le.x = 0, Le.y = ge.y; + else { + var ae, ye; + switch (ye = 1 - ee * ee * this.pfact, ye = (this.p - X(ye)) / (this.pn1 / ee + ee / this.pn1), ae = X(1 - ye * ye), this.mode) { + case Wt.OBLIQ: + Le.y = p(ae * this.sinph0 + ge.y * ye * this.cosph0 / ee), ge.y = (ae - this.sinph0 * j(Le.y)) * ee, ge.x *= ye * this.cosph0; + break; + case Wt.EQUIT: + Le.y = p(ge.y * ye / ee), ge.y = ae * ee, ge.x *= ye; + break; + case Wt.N_POLE: + Le.y = p(ae), ge.y = -ge.y; + break; + case Wt.S_POLE: + Le.y = -p(ae); + } + Le.x = x(ge.x, ge.y); + } + return ge.x = Le.x + this.long0, ge.y = Le.y, ge; + }, names: ["Tilted_Perspective", "tpers"] }; + return T.defaultDatum = "WGS84", T.Proj = gt, T.WGS84 = new T.Proj("WGS84"), T.Point = Pt, T.toPoint = ii, T.defs = J, T.nadgrid = Tt, T.transform = A, T.mgrs = { forward: b, inverse: function(ge) { + var Le = L(de(ge.toUpperCase())); + return Le.lat && Le.lon ? [Le.lon, Le.lat, Le.lon, Le.lat] : [Le.left, Le.bottom, Le.right, Le.top]; + }, toPoint: m }, T.version = "2.7.4", function(ge) { + ge.Proj.projections.add(hr), ge.Proj.projections.add(nr), ge.Proj.projections.add(Zr), ge.Proj.projections.add(Da), ge.Proj.projections.add(Ta), ge.Proj.projections.add(Ds), ge.Proj.projections.add(mu), ge.Proj.projections.add(Rc), ge.Proj.projections.add(Mc), ge.Proj.projections.add(Mp), ge.Proj.projections.add(Dp), ge.Proj.projections.add(hi), ge.Proj.projections.add(ll), ge.Proj.projections.add(ug), ge.Proj.projections.add(Wo), ge.Proj.projections.add(lp), ge.Proj.projections.add(Hs), ge.Proj.projections.add(Xs), ge.Proj.projections.add(ql), ge.Proj.projections.add(Su), ge.Proj.projections.add(Im), ge.Proj.projections.add(Vc), ge.Proj.projections.add(jc), ge.Proj.projections.add(gu), ge.Proj.projections.add(vh), ge.Proj.projections.add(cg), ge.Proj.projections.add(zt), ge.Proj.projections.add(Ui); + }(T), T; + }); + }, {}], 18: [function(l, c, h) { + function p(I, P) { + for (var F in I) + P[F] = I[F]; + } + function y(I, P, F) { + return x(I, P, F); + } + /*! safe-buffer. MIT License. Feross Aboukhadijeh */ + var v = l("buffer"), x = v.Buffer; + x.from && x.alloc && x.allocUnsafe && x.allocUnsafeSlow ? c.exports = v : (p(v, h), h.Buffer = y), y.prototype = Object.create(x.prototype), p(x, y), y.from = function(I, P, F) { + if (typeof I == "number") + throw new TypeError("Argument must not be a number"); + return x(I, P, F); + }, y.alloc = function(I, P, F) { + if (typeof I != "number") + throw new TypeError("Argument must be a number"); + var k = x(I); + return P === void 0 ? k.fill(0) : typeof F == "string" ? k.fill(P, F) : k.fill(P), k; + }, y.allocUnsafe = function(I) { + if (typeof I != "number") + throw new TypeError("Argument must be a number"); + return x(I); + }, y.allocUnsafeSlow = function(I) { + if (typeof I != "number") + throw new TypeError("Argument must be a number"); + return v.SlowBuffer(I); + }; + }, { buffer: 8 }], 19: [function(l, c, h) { + function p(fe) { + if (!fe) + return "utf8"; + for (var be; ; ) + switch (fe) { + case "utf8": + case "utf-8": + return "utf8"; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return "utf16le"; + case "latin1": + case "binary": + return "latin1"; + case "base64": + case "ascii": + case "hex": + return fe; + default: + if (be) + return; + fe = ("" + fe).toLowerCase(), be = !0; + } + } + function y(fe) { + var be = p(fe); + if (typeof be != "string" && (re.isEncoding === he || !he(fe))) + throw new Error("Unknown encoding: " + fe); + return be || fe; + } + function v(fe) { + this.encoding = y(fe); + var be; + switch (this.encoding) { + case "utf16le": + this.text = k, this.end = V, be = 4; + break; + case "utf8": + this.fillLast = F, be = 4; + break; + case "base64": + this.text = j, this.end = Y, be = 3; + break; + default: + return this.write = X, void (this.end = Q); + } + this.lastNeed = 0, this.lastTotal = 0, this.lastChar = re.allocUnsafe(be); + } + function x(fe) { + return 127 >= fe ? 0 : fe >> 5 == 6 ? 2 : fe >> 4 == 14 ? 3 : fe >> 3 == 30 ? 4 : fe >> 6 == 2 ? -1 : -2; + } + function I(fe, be, Se) { + var Me = be.length - 1; + if (Me < Se) + return 0; + var ke = x(be[Me]); + return 0 <= ke ? (0 < ke && (fe.lastNeed = ke - 1), ke) : --Me < Se || ke === -2 ? 0 : (ke = x(be[Me]), 0 <= ke ? (0 < ke && (fe.lastNeed = ke - 2), ke) : --Me < Se || ke === -2 ? 0 : (ke = x(be[Me]), 0 <= ke ? (0 < ke && (ke === 2 ? ke = 0 : fe.lastNeed = ke - 3), ke) : 0)); + } + function P(fe, be) { + if ((192 & be[0]) != 128) + return fe.lastNeed = 0, "�"; + if (1 < fe.lastNeed && 1 < be.length) { + if ((192 & be[1]) != 128) + return fe.lastNeed = 1, "�"; + if (2 < fe.lastNeed && 2 < be.length && (192 & be[2]) != 128) + return fe.lastNeed = 2, "�"; + } + } + function F(fe) { + var be = this.lastTotal - this.lastNeed, Se = P(this, fe); + return Se === void 0 ? this.lastNeed <= fe.length ? (fe.copy(this.lastChar, be, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (fe.copy(this.lastChar, be, 0, fe.length), void (this.lastNeed -= fe.length)) : Se; + } + function k(fe, be) { + if ((fe.length - be) % 2 == 0) { + var Se = fe.toString("utf16le", be); + if (Se) { + var Me = Se.charCodeAt(Se.length - 1); + if (55296 <= Me && 56319 >= Me) + return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = fe[fe.length - 2], this.lastChar[1] = fe[fe.length - 1], Se.slice(0, -1); + } + return Se; + } + return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = fe[fe.length - 1], fe.toString("utf16le", be, fe.length - 1); + } + function V(fe) { + var be = fe && fe.length ? this.write(fe) : ""; + if (this.lastNeed) { + var Se = this.lastTotal - this.lastNeed; + return be + this.lastChar.toString("utf16le", 0, Se); + } + return be; + } + function j(fe, be) { + var Se = (fe.length - be) % 3; + return Se == 0 ? fe.toString("base64", be) : (this.lastNeed = 3 - Se, this.lastTotal = 3, Se == 1 ? this.lastChar[0] = fe[fe.length - 1] : (this.lastChar[0] = fe[fe.length - 2], this.lastChar[1] = fe[fe.length - 1]), fe.toString("base64", be, fe.length - Se)); + } + function Y(fe) { + var be = fe && fe.length ? this.write(fe) : ""; + return this.lastNeed ? be + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : be; + } + function X(fe) { + return fe.toString(this.encoding); + } + function Q(fe) { + return fe && fe.length ? this.write(fe) : ""; + } + var re = l("safe-buffer").Buffer, he = re.isEncoding || function(fe) { + switch (fe = "" + fe, fe && fe.toLowerCase()) { + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + case "raw": + return !0; + default: + return !1; + } + }; + h.StringDecoder = v, v.prototype.write = function(fe) { + if (fe.length === 0) + return ""; + var be, Se; + if (this.lastNeed) { + if (be = this.fillLast(fe), be === void 0) + return ""; + Se = this.lastNeed, this.lastNeed = 0; + } else + Se = 0; + return Se < fe.length ? be ? be + this.text(fe, Se) : this.text(fe, Se) : be || ""; + }, v.prototype.end = function(fe) { + var be = fe && fe.length ? this.write(fe) : ""; + return this.lastNeed ? be + "�" : be; + }, v.prototype.text = function(fe, be) { + var Se = I(this, fe, be); + if (!this.lastNeed) + return fe.toString("utf8", be); + this.lastTotal = Se; + var Me = fe.length - (Se - this.lastNeed); + return fe.copy(this.lastChar, 0, Me), fe.toString("utf8", be, Me); + }, v.prototype.fillLast = function(fe) { + return this.lastNeed <= fe.length ? (fe.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (fe.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, fe.length), void (this.lastNeed -= fe.length)); + }; + }, { "safe-buffer": 18 }], 20: [function(l, c) { + c.exports = l("./lib/encoding.js"); + }, { "./lib/encoding.js": 21 }], 21: [function(l, c) { + (function(h) { + function p(it, yt, He) { + return yt <= it && it <= He; + } + function y(it, yt) { + return it.indexOf(yt) !== -1; + } + function v(it) { + if (it === void 0) + return {}; + if (it === Object(it)) + return it; + throw TypeError("Could not convert argument to dictionary"); + } + function x(it) { + for (var yt = it + "", He = yt.length, Ft = 0, ei = []; Ft < He; ) { + var mt = yt.charCodeAt(Ft); + if (55296 > mt || 57343 < mt) + ei.push(mt); + else if (56320 <= mt && 57343 >= mt) + ei.push(65533); + else if (55296 <= mt && 56319 >= mt) + if (Ft === He - 1) + ei.push(65533); + else { + var Ue = yt.charCodeAt(Ft + 1); + 56320 <= Ue && 57343 >= Ue ? (ei.push(65536 + ((1023 & mt) << 10) + (1023 & Ue)), Ft += 1) : ei.push(65533); + } + Ft += 1; + } + return ei; + } + function I(it) { + for (var yt = "", He = 0, Ft; He < it.length; ++He) + Ft = it[He], 65535 >= Ft ? yt += o(Ft) : (Ft -= 65536, yt += o((Ft >> 10) + 55296, (1023 & Ft) + 56320)); + return yt; + } + function P(it) { + return 0 <= it && 127 >= it; + } + function F(it) { + this.tokens = [].slice.call(it), this.tokens.reverse(); + } + function k(it, yt) { + if (it) + throw TypeError("Decoder error"); + return yt || 65533; + } + function V(it) { + throw TypeError("The code point " + it + " could not be encoded."); + } + function j(it) { + return it = (it + "").trim().toLowerCase(), Object.prototype.hasOwnProperty.call(ct, it) ? ct[it] : null; + } + function Y(it, yt) { + return yt && yt[it] || null; + } + function X(it, yt) { + var He = yt.indexOf(it); + return He === -1 ? null : He; + } + function Q(it) { + if (!("encoding-indexes" in h)) + throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?"); + return h["encoding-indexes"][it]; + } + function re(it) { + if (39419 < it && 189e3 > it || 1237575 < it) + return null; + if (it === 7457) + return 59335; + var yt = 0, He = 0, Ft = Q("gb18030-ranges"), ei; + for (ei = 0; ei < Ft.length; ++ei) { + var mt = Ft[ei]; + if (mt[0] <= it) + yt = mt[0], He = mt[1]; + else + break; + } + return He + it - yt; + } + function he(it) { + if (it === 59335) + return 7457; + var yt = 0, He = 0, Ft = Q("gb18030-ranges"), ei; + for (ei = 0; ei < Ft.length; ++ei) { + var mt = Ft[ei]; + if (mt[1] <= it) + yt = mt[1], He = mt[0]; + else + break; + } + return He + it - yt; + } + function fe(it) { + pe = pe || Q("jis0208").map(function(He, Ft) { + return p(Ft, 8272, 8835) ? null : He; + }); + var yt = pe; + return yt.indexOf(it); + } + function be(it) { + Ae = Ae || Q("big5").map(function(He, Ft) { + return Ft < 5024 ? null : He; + }); + var yt = Ae; + return it === 9552 || it === 9566 || it === 9569 || it === 9578 || it === 21313 || it === 21317 ? yt.lastIndexOf(it) : X(it, yt); + } + function Se(it, yt) { + if (!(this instanceof Se)) + throw TypeError("Called as a function. Did you forget 'new'?"); + it = it === void 0 ? "utf-8" : it + "", yt = v(yt), this._encoding = null, this._decoder = null, this._ignoreBOM = !1, this._BOMseen = !1, this._error_mode = "replacement", this._do_not_flush = !1; + var He = j(it); + if (He === null || He.name === "replacement") + throw RangeError("Unknown encoding: " + it); + if (!Ne[He.name]) + throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?"); + var Ft = this; + return Ft._encoding = He, yt.fatal && (Ft._error_mode = "fatal"), yt.ignoreBOM && (Ft._ignoreBOM = !0), Object.defineProperty || (this.encoding = Ft._encoding.name.toLowerCase(), this.fatal = Ft._error_mode === "fatal", this.ignoreBOM = Ft._ignoreBOM), Ft; + } + function Me(it, yt) { + if (!(this instanceof Me)) + throw TypeError("Called as a function. Did you forget 'new'?"); + yt = v(yt), this._encoding = null, this._encoder = null, this._do_not_flush = !1, this._fatal = yt.fatal ? "fatal" : "replacement"; + var He = this; + if (yt.NONSTANDARD_allowLegacyEncoding) { + it = it === void 0 ? "utf-8" : it + ""; + var Ft = j(it); + if (Ft === null || Ft.name === "replacement") + throw RangeError("Unknown encoding: " + it); + if (!gt[Ft.name]) + throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?"); + He._encoding = Ft; + } else + He._encoding = j("utf-8"), it !== void 0 && "console" in h && console.warn("TextEncoder constructor called with encoding label, which is ignored."); + return Object.defineProperty || (this.encoding = He._encoding.name.toLowerCase()), He; + } + function ke(it) { + var yt = it.fatal, He = 0, Ft = 0, ei = 0, mt = 128, Ue = 191; + this.handler = function(si, A) { + if (A === -1 && ei !== 0) + return ei = 0, k(yt); + if (A === -1) + return -1; + if (ei === 0) { + if (p(A, 0, 127)) + return A; + if (p(A, 194, 223)) + ei = 1, He = 31 & A; + else if (p(A, 224, 239)) + A === 224 && (mt = 160), A === 237 && (Ue = 159), ei = 2, He = 15 & A; + else if (p(A, 240, 244)) + A === 240 && (mt = 144), A === 244 && (Ue = 143), ei = 3, He = 7 & A; + else + return k(yt); + return null; + } + if (!p(A, mt, Ue)) + return He = ei = Ft = 0, mt = 128, Ue = 191, si.prepend(A), k(yt); + if (mt = 128, Ue = 191, He = He << 6 | 63 & A, Ft += 1, Ft !== ei) + return null; + var ve = He; + return He = ei = Ft = 0, ve; + }; + } + function J(it) { + it.fatal, this.handler = function(yt, He) { + if (He === -1) + return -1; + if (wt(He)) + return He; + var Ft, ei; + p(He, 128, 2047) ? (Ft = 1, ei = 192) : p(He, 2048, 65535) ? (Ft = 2, ei = 224) : p(He, 65536, 1114111) && (Ft = 3, ei = 240); + for (var mt = [(He >> 6 * Ft) + ei]; 0 < Ft; ) { + var Ue = He >> 6 * (Ft - 1); + mt.push(128 | 63 & Ue), Ft -= 1; + } + return mt; + }; + } + function ce(it, yt) { + var He = yt.fatal; + this.handler = function(Ft, ei) { + if (ei === -1) + return -1; + if (P(ei)) + return ei; + var mt = it[ei - 128]; + return mt === null ? k(He) : mt; + }; + } + function xe(it, yt) { + yt.fatal, this.handler = function(He, Ft) { + if (Ft === -1) + return -1; + if (wt(Ft)) + return Ft; + var ei = X(Ft, it); + return ei === null && V(Ft), ei + 128; + }; + } + function Pe(it) { + var yt = it.fatal, He = 0, Ft = 0, ei = 0; + this.handler = function(mt, Ue) { + if (Ue === -1 && He === 0 && Ft === 0 && ei === 0) + return -1; + Ue === -1 && (He !== 0 || Ft !== 0 || ei !== 0) && (He = 0, Ft = 0, ei = 0, k(yt)); + var si; + if (ei !== 0) { + si = null, p(Ue, 48, 57) && (si = re(10 * (126 * (10 * (He - 129) + Ft - 48) + ei - 129) + Ue - 48)); + var A = [Ft, ei, Ue]; + return He = 0, Ft = 0, ei = 0, si === null ? (mt.prepend(A), k(yt)) : si; + } + if (Ft !== 0) + return p(Ue, 129, 254) ? (ei = Ue, null) : (mt.prepend([Ft, Ue]), He = 0, Ft = 0, k(yt)); + if (He !== 0) { + if (p(Ue, 48, 57)) + return Ft = Ue, null; + var ve = He, H = null; + He = 0; + var T = 127 > Ue ? 64 : 65; + return (p(Ue, 64, 126) || p(Ue, 128, 254)) && (H = 190 * (ve - 129) + (Ue - T)), si = H === null ? null : Y(H, Q("gb18030")), si === null && P(Ue) && mt.prepend(Ue), si === null ? k(yt) : si; + } + return P(Ue) ? Ue : Ue === 128 ? 8364 : p(Ue, 129, 254) ? (He = Ue, null) : k(yt); + }; + } + function Oe(it, yt) { + it.fatal, this.handler = function(He, Ft) { + if (Ft === -1) + return -1; + if (wt(Ft)) + return Ft; + if (Ft === 58853) + return V(Ft); + if (yt && Ft === 8364) + return 128; + var ei = X(Ft, Q("gb18030")); + if (ei !== null) { + var mt = at(ei / 190) + 129, Ue = ei % 190, si = 63 > Ue ? 64 : 65; + return [mt, Ue + si]; + } + if (yt) + return V(Ft); + ei = he(Ft); + var A = at(ei / 10 / 126 / 10); + ei -= 10 * (126 * (10 * A)); + var ve = at(ei / 10 / 126); + ei -= 126 * (10 * ve); + var H = at(ei / 10), T = ei - 10 * H; + return [A + 129, ve + 48, H + 129, T + 48]; + }; + } + function Re(it) { + var yt = it.fatal, He = 0; + this.handler = function(Ft, ei) { + if (ei === -1 && He !== 0) + return He = 0, k(yt); + if (ei === -1 && He === 0) + return -1; + if (He !== 0) { + var mt = He, Ue = null; + He = 0; + var si = 127 > ei ? 64 : 98; + switch ((p(ei, 64, 126) || p(ei, 161, 254)) && (Ue = 157 * (mt - 129) + (ei - si)), Ue) { + case 1133: + return [202, 772]; + case 1135: + return [202, 780]; + case 1164: + return [234, 772]; + case 1166: + return [234, 780]; + } + var A = Ue === null ? null : Y(Ue, Q("big5")); + return A === null && P(ei) && Ft.prepend(ei), A === null ? k(yt) : A; + } + return P(ei) ? ei : p(ei, 129, 254) ? (He = ei, null) : k(yt); + }; + } + function Ge(it) { + it.fatal, this.handler = function(yt, He) { + if (He === -1) + return -1; + if (wt(He)) + return He; + var Ft = be(He); + if (Ft === null) + return V(He); + var ei = at(Ft / 157) + 129; + if (161 > ei) + return V(He); + var mt = Ft % 157, Ue = 63 > mt ? 64 : 98; + return [ei, mt + Ue]; + }; + } + function je(it) { + var yt = it.fatal, He = !1, Ft = 0; + this.handler = function(ei, mt) { + if (mt === -1 && Ft !== 0) + return Ft = 0, k(yt); + if (mt === -1 && Ft === 0) + return -1; + if (Ft === 142 && p(mt, 161, 223)) + return Ft = 0, 65216 + mt; + if (Ft === 143 && p(mt, 161, 254)) + return He = !0, Ft = mt, null; + if (Ft !== 0) { + var Ue = Ft; + Ft = 0; + var si = null; + return p(Ue, 161, 254) && p(mt, 161, 254) && (si = Y(94 * (Ue - 161) + (mt - 161), Q(He ? "jis0212" : "jis0208"))), He = !1, p(mt, 161, 254) || ei.prepend(mt), si === null ? k(yt) : si; + } + return P(mt) ? mt : mt === 142 || mt === 143 || p(mt, 161, 254) ? (Ft = mt, null) : k(yt); + }; + } + function et(it) { + it.fatal, this.handler = function(yt, He) { + if (He === -1) + return -1; + if (wt(He)) + return He; + if (He === 165) + return 92; + if (He === 8254) + return 126; + if (p(He, 65377, 65439)) + return [142, He - 65377 + 161]; + He === 8722 && (He = 65293); + var Ft = X(He, Q("jis0208")); + if (Ft === null) + return V(He); + var ei = at(Ft / 94) + 161; + return [ei, Ft % 94 + 161]; + }; + } + function Qe(it) { + var yt = it.fatal, He = { ASCII: 0, Roman: 1, Katakana: 2, LeadByte: 3, TrailByte: 4, EscapeStart: 5, Escape: 6 }, Ft = He.ASCII, ei = He.ASCII, mt = 0, Ue = !1; + this.handler = function(si, A) { + switch (Ft) { + default: + case He.ASCII: + return A === 27 ? (Ft = He.EscapeStart, null) : p(A, 0, 127) && A !== 14 && A !== 15 && A !== 27 ? (Ue = !1, A) : A === -1 ? -1 : (Ue = !1, k(yt)); + case He.Roman: + return A === 27 ? (Ft = He.EscapeStart, null) : A === 92 ? (Ue = !1, 165) : A === 126 ? (Ue = !1, 8254) : p(A, 0, 127) && A !== 14 && A !== 15 && A !== 27 && A !== 92 && A !== 126 ? (Ue = !1, A) : A === -1 ? -1 : (Ue = !1, k(yt)); + case He.Katakana: + return A === 27 ? (Ft = He.EscapeStart, null) : p(A, 33, 95) ? (Ue = !1, 65344 + A) : A === -1 ? -1 : (Ue = !1, k(yt)); + case He.LeadByte: + return A === 27 ? (Ft = He.EscapeStart, null) : p(A, 33, 126) ? (Ue = !1, mt = A, Ft = He.TrailByte, null) : A === -1 ? -1 : (Ue = !1, k(yt)); + case He.TrailByte: + if (A === 27) + return Ft = He.EscapeStart, k(yt); + if (p(A, 33, 126)) { + Ft = He.LeadByte; + var ve = 94 * (mt - 33) + A - 33, H = Y(ve, Q("jis0208")); + return H === null ? k(yt) : H; + } + return A === -1 ? (Ft = He.LeadByte, si.prepend(A), k(yt)) : (Ft = He.LeadByte, k(yt)); + case He.EscapeStart: + return A === 36 || A === 40 ? (mt = A, Ft = He.Escape, null) : (si.prepend(A), Ue = !1, Ft = ei, k(yt)); + case He.Escape: + var T = mt; + mt = 0; + var b = null; + if (T === 40 && A === 66 && (b = He.ASCII), T === 40 && A === 74 && (b = He.Roman), T === 40 && A === 73 && (b = He.Katakana), T === 36 && (A === 64 || A === 66) && (b = He.LeadByte), b !== null) { + Ft = Ft = b; + var m = Ue; + return Ue = !0, m ? k(yt) : null; + } + return si.prepend([T, A]), Ue = !1, Ft = ei, k(yt); + } + }; + } + function tt(it) { + it.fatal; + var yt = { ASCII: 0, Roman: 1, jis0208: 2 }, He = yt.ASCII; + this.handler = function(Ft, ei) { + if (ei === -1 && He !== yt.ASCII) + return Ft.prepend(ei), He = yt.ASCII, [27, 40, 66]; + if (ei === -1 && He === yt.ASCII) + return -1; + if ((He === yt.ASCII || He === yt.Roman) && (ei === 14 || ei === 15 || ei === 27)) + return V(65533); + if (He === yt.ASCII && wt(ei)) + return ei; + if (He === yt.Roman && (wt(ei) && ei !== 92 && ei !== 126 || ei == 165 || ei == 8254)) { + if (wt(ei)) + return ei; + if (ei === 165) + return 92; + if (ei === 8254) + return 126; + } + if (wt(ei) && He !== yt.ASCII) + return Ft.prepend(ei), He = yt.ASCII, [27, 40, 66]; + if ((ei === 165 || ei === 8254) && He !== yt.Roman) + return Ft.prepend(ei), He = yt.Roman, [27, 40, 74]; + ei === 8722 && (ei = 65293); + var mt = X(ei, Q("jis0208")); + if (mt === null) + return V(ei); + if (He !== yt.jis0208) + return Ft.prepend(ei), He = yt.jis0208, [27, 36, 66]; + var Ue = at(mt / 94) + 33; + return [Ue, mt % 94 + 33]; + }; + } + function ft(it) { + var yt = it.fatal, He = 0; + this.handler = function(Ft, ei) { + if (ei === -1 && He !== 0) + return He = 0, k(yt); + if (ei === -1 && He === 0) + return -1; + if (He !== 0) { + var mt = He, Ue = null; + He = 0; + var si = 127 > ei ? 64 : 65, A = 160 > mt ? 129 : 193; + if ((p(ei, 64, 126) || p(ei, 128, 252)) && (Ue = 188 * (mt - A) + ei - si), p(Ue, 8836, 10715)) + return 48508 + Ue; + var ve = Ue === null ? null : Y(Ue, Q("jis0208")); + return ve === null && P(ei) && Ft.prepend(ei), ve === null ? k(yt) : ve; + } + return P(ei) || ei === 128 ? ei : p(ei, 161, 223) ? 65216 + ei : p(ei, 129, 159) || p(ei, 224, 252) ? (He = ei, null) : k(yt); + }; + } + function Mt(it) { + it.fatal, this.handler = function(yt, He) { + if (He === -1) + return -1; + if (wt(He) || He === 128) + return He; + if (He === 165) + return 92; + if (He === 8254) + return 126; + if (p(He, 65377, 65439)) + return He - 65377 + 161; + He === 8722 && (He = 65293); + var Ft = fe(He); + if (Ft === null) + return V(He); + var ei = at(Ft / 188), mt = 31 > ei ? 129 : 193, Ue = Ft % 188, si = 63 > Ue ? 64 : 65; + return [ei + mt, Ue + si]; + }; + } + function kt(it) { + var yt = it.fatal, He = 0; + this.handler = function(Ft, ei) { + if (ei === -1 && He !== 0) + return He = 0, k(yt); + if (ei === -1 && He === 0) + return -1; + if (He !== 0) { + var mt = He, Ue = null; + He = 0, p(ei, 65, 254) && (Ue = 190 * (mt - 129) + (ei - 65)); + var si = Ue === null ? null : Y(Ue, Q("euc-kr")); + return Ue === null && P(ei) && Ft.prepend(ei), si === null ? k(yt) : si; + } + return P(ei) ? ei : p(ei, 129, 254) ? (He = ei, null) : k(yt); + }; + } + function Tt(it) { + it.fatal, this.handler = function(yt, He) { + if (He === -1) + return -1; + if (wt(He)) + return He; + var Ft = X(He, Q("euc-kr")); + if (Ft === null) + return V(He); + var ei = at(Ft / 190) + 129; + return [ei, Ft % 190 + 65]; + }; + } + function It(it, yt) { + var He = it >> 8, Ft = 255 & it; + return yt ? [He, Ft] : [Ft, He]; + } + function Nt(it, yt) { + var He = yt.fatal, Ft = null, ei = null; + this.handler = function(mt, Ue) { + if (Ue === -1 && (Ft !== null || ei !== null)) + return k(He); + if (Ue === -1 && Ft === null && ei === null) + return -1; + if (Ft === null) + return Ft = Ue, null; + var si; + if (si = it ? (Ft << 8) + Ue : (Ue << 8) + Ft, Ft = null, ei !== null) { + var A = ei; + return ei = null, p(si, 56320, 57343) ? 65536 + 1024 * (A - 55296) + (si - 56320) : (mt.prepend(It(si, it)), k(He)); + } + return p(si, 55296, 56319) ? (ei = si, null) : p(si, 56320, 57343) ? k(He) : si; + }; + } + function nt(it, yt) { + yt.fatal, this.handler = function(He, Ft) { + if (Ft === -1) + return -1; + if (p(Ft, 0, 65535)) + return It(Ft, it); + var ei = It((Ft - 65536 >> 10) + 55296, it), mt = It((1023 & Ft - 65536) + 56320, it); + return ei.concat(mt); + }; + } + function Ee(it) { + it.fatal, this.handler = function(yt, He) { + return He === -1 ? -1 : P(He) ? He : 63360 + He - 128; + }; + } + function Be(it) { + it.fatal, this.handler = function(yt, He) { + return He === -1 ? -1 : wt(He) ? He : p(He, 63360, 63487) ? He - 63360 + 128 : V(He); + }; + } + typeof c < "u" && c.exports && !h["encoding-indexes"] && l("./encoding-indexes.js"); + var at = i, wt = P, st = -1; + F.prototype = { endOfStream: function() { + return !this.tokens.length; + }, read: function() { + return this.tokens.length ? this.tokens.pop() : st; + }, prepend: function(it) { + if (Array.isArray(it)) + for (var yt = it; yt.length; ) + this.tokens.push(yt.pop()); + else + this.tokens.push(it); + }, push: function(it) { + if (Array.isArray(it)) + for (var yt = it; yt.length; ) + this.tokens.unshift(yt.shift()); + else + this.tokens.unshift(it); + } }; + var le = [{ encodings: [{ labels: ["unicode-1-1-utf-8", "utf-8", "utf8"], name: "UTF-8" }], heading: "The Encoding" }, { encodings: [{ labels: ["866", "cp866", "csibm866", "ibm866"], name: "IBM866" }, { labels: ["csisolatin2", "iso-8859-2", "iso-ir-101", "iso8859-2", "iso88592", "iso_8859-2", "iso_8859-2:1987", "l2", "latin2"], name: "ISO-8859-2" }, { labels: ["csisolatin3", "iso-8859-3", "iso-ir-109", "iso8859-3", "iso88593", "iso_8859-3", "iso_8859-3:1988", "l3", "latin3"], name: "ISO-8859-3" }, { labels: ["csisolatin4", "iso-8859-4", "iso-ir-110", "iso8859-4", "iso88594", "iso_8859-4", "iso_8859-4:1988", "l4", "latin4"], name: "ISO-8859-4" }, { labels: ["csisolatincyrillic", "cyrillic", "iso-8859-5", "iso-ir-144", "iso8859-5", "iso88595", "iso_8859-5", "iso_8859-5:1988"], name: "ISO-8859-5" }, { labels: ["arabic", "asmo-708", "csiso88596e", "csiso88596i", "csisolatinarabic", "ecma-114", "iso-8859-6", "iso-8859-6-e", "iso-8859-6-i", "iso-ir-127", "iso8859-6", "iso88596", "iso_8859-6", "iso_8859-6:1987"], name: "ISO-8859-6" }, { labels: ["csisolatingreek", "ecma-118", "elot_928", "greek", "greek8", "iso-8859-7", "iso-ir-126", "iso8859-7", "iso88597", "iso_8859-7", "iso_8859-7:1987", "sun_eu_greek"], name: "ISO-8859-7" }, { labels: ["csiso88598e", "csisolatinhebrew", "hebrew", "iso-8859-8", "iso-8859-8-e", "iso-ir-138", "iso8859-8", "iso88598", "iso_8859-8", "iso_8859-8:1988", "visual"], name: "ISO-8859-8" }, { labels: ["csiso88598i", "iso-8859-8-i", "logical"], name: "ISO-8859-8-I" }, { labels: ["csisolatin6", "iso-8859-10", "iso-ir-157", "iso8859-10", "iso885910", "l6", "latin6"], name: "ISO-8859-10" }, { labels: ["iso-8859-13", "iso8859-13", "iso885913"], name: "ISO-8859-13" }, { labels: ["iso-8859-14", "iso8859-14", "iso885914"], name: "ISO-8859-14" }, { labels: ["csisolatin9", "iso-8859-15", "iso8859-15", "iso885915", "iso_8859-15", "l9"], name: "ISO-8859-15" }, { labels: ["iso-8859-16"], name: "ISO-8859-16" }, { labels: ["cskoi8r", "koi", "koi8", "koi8-r", "koi8_r"], name: "KOI8-R" }, { labels: ["koi8-ru", "koi8-u"], name: "KOI8-U" }, { labels: ["csmacintosh", "mac", "macintosh", "x-mac-roman"], name: "macintosh" }, { labels: ["dos-874", "iso-8859-11", "iso8859-11", "iso885911", "tis-620", "windows-874"], name: "windows-874" }, { labels: ["cp1250", "windows-1250", "x-cp1250"], name: "windows-1250" }, { labels: ["cp1251", "windows-1251", "x-cp1251"], name: "windows-1251" }, { labels: ["ansi_x3.4-1968", "ascii", "cp1252", "cp819", "csisolatin1", "ibm819", "iso-8859-1", "iso-ir-100", "iso8859-1", "iso88591", "iso_8859-1", "iso_8859-1:1987", "l1", "latin1", "us-ascii", "windows-1252", "x-cp1252"], name: "windows-1252" }, { labels: ["cp1253", "windows-1253", "x-cp1253"], name: "windows-1253" }, { labels: ["cp1254", "csisolatin5", "iso-8859-9", "iso-ir-148", "iso8859-9", "iso88599", "iso_8859-9", "iso_8859-9:1989", "l5", "latin5", "windows-1254", "x-cp1254"], name: "windows-1254" }, { labels: ["cp1255", "windows-1255", "x-cp1255"], name: "windows-1255" }, { labels: ["cp1256", "windows-1256", "x-cp1256"], name: "windows-1256" }, { labels: ["cp1257", "windows-1257", "x-cp1257"], name: "windows-1257" }, { labels: ["cp1258", "windows-1258", "x-cp1258"], name: "windows-1258" }, { labels: ["x-mac-cyrillic", "x-mac-ukrainian"], name: "x-mac-cyrillic" }], heading: "Legacy single-byte encodings" }, { encodings: [{ labels: ["chinese", "csgb2312", "csiso58gb231280", "gb2312", "gb_2312", "gb_2312-80", "gbk", "iso-ir-58", "x-gbk"], name: "GBK" }, { labels: ["gb18030"], name: "gb18030" }], heading: "Legacy multi-byte Chinese (simplified) encodings" }, { encodings: [{ labels: ["big5", "big5-hkscs", "cn-big5", "csbig5", "x-x-big5"], name: "Big5" }], heading: "Legacy multi-byte Chinese (traditional) encodings" }, { encodings: [{ labels: ["cseucpkdfmtjapanese", "euc-jp", "x-euc-jp"], name: "EUC-JP" }, { labels: ["csiso2022jp", "iso-2022-jp"], name: "ISO-2022-JP" }, { labels: ["csshiftjis", "ms932", "ms_kanji", "shift-jis", "shift_jis", "sjis", "windows-31j", "x-sjis"], name: "Shift_JIS" }], heading: "Legacy multi-byte Japanese encodings" }, { encodings: [{ labels: ["cseuckr", "csksc56011987", "euc-kr", "iso-ir-149", "korean", "ks_c_5601-1987", "ks_c_5601-1989", "ksc5601", "ksc_5601", "windows-949"], name: "EUC-KR" }], heading: "Legacy multi-byte Korean encodings" }, { encodings: [{ labels: ["csiso2022kr", "hz-gb-2312", "iso-2022-cn", "iso-2022-cn-ext", "iso-2022-kr"], name: "replacement" }, { labels: ["utf-16be"], name: "UTF-16BE" }, { labels: ["utf-16", "utf-16le"], name: "UTF-16LE" }, { labels: ["x-user-defined"], name: "x-user-defined" }], heading: "Legacy miscellaneous encodings" }], ct = {}; + le.forEach(function(it) { + it.encodings.forEach(function(yt) { + yt.labels.forEach(function(He) { + ct[He] = yt; + }); + }); + }); + var gt = {}, Ne = {}, pe, Ae; + Object.defineProperty && (Object.defineProperty(Se.prototype, "encoding", { get: function() { + return this._encoding.name.toLowerCase(); + } }), Object.defineProperty(Se.prototype, "fatal", { get: function() { + return this._error_mode === "fatal"; + } }), Object.defineProperty(Se.prototype, "ignoreBOM", { get: function() { + return this._ignoreBOM; + } })), Se.prototype.decode = function(it, yt) { + var He; + He = typeof it == "object" && it instanceof ArrayBuffer ? new Uint8Array(it) : typeof it == "object" && "buffer" in it && it.buffer instanceof ArrayBuffer ? new Uint8Array(it.buffer, it.byteOffset, it.byteLength) : new Uint8Array(0), yt = v(yt), this._do_not_flush || (this._decoder = Ne[this._encoding.name]({ fatal: this._error_mode === "fatal" }), this._BOMseen = !1), this._do_not_flush = !!yt.stream; + for (var Ft = new F(He), ei = [], mt, Ue; Ue = Ft.read(), Ue !== st && (mt = this._decoder.handler(Ft, Ue), mt !== -1); ) + mt !== null && (Array.isArray(mt) ? ei.push.apply(ei, mt) : ei.push(mt)); + if (!this._do_not_flush) { + do { + if (mt = this._decoder.handler(Ft, Ft.read()), mt === -1) + break; + mt !== null && (Array.isArray(mt) ? ei.push.apply(ei, mt) : ei.push(mt)); + } while (!Ft.endOfStream()); + this._decoder = null; + } + return function(si) { + return !y(["UTF-8", "UTF-16LE", "UTF-16BE"], this._encoding.name) || this._ignoreBOM || this._BOMseen || (0 < si.length && si[0] === 65279 ? (this._BOMseen = !0, si.shift()) : 0 < si.length && (this._BOMseen = !0)), I(si); + }.call(this, ei); + }, Object.defineProperty && Object.defineProperty(Me.prototype, "encoding", { get: function() { + return this._encoding.name.toLowerCase(); + } }), Me.prototype.encode = function(it, yt) { + it = it === void 0 ? "" : it + "", yt = v(yt), this._do_not_flush || (this._encoder = gt[this._encoding.name]({ fatal: this._fatal === "fatal" })), this._do_not_flush = !!yt.stream; + for (var He = new F(x(it)), Ft = [], ei, mt; mt = He.read(), mt !== st && (ei = this._encoder.handler(He, mt), ei !== -1); ) + Array.isArray(ei) ? Ft.push.apply(Ft, ei) : Ft.push(ei); + if (!this._do_not_flush) { + for (; ei = this._encoder.handler(He, He.read()), ei !== -1; ) + Array.isArray(ei) ? Ft.push.apply(Ft, ei) : Ft.push(ei); + this._encoder = null; + } + return new Uint8Array(Ft); + }, gt["UTF-8"] = function(it) { + return new J(it); + }, Ne["UTF-8"] = function(it) { + return new ke(it); + }, function() { + "encoding-indexes" in h && le.forEach(function(it) { + it.heading !== "Legacy single-byte encodings" || it.encodings.forEach(function(yt) { + var He = yt.name, Ft = Q(He.toLowerCase()); + Ne[He] = function(ei) { + return new ce(Ft, ei); + }, gt[He] = function(ei) { + return new xe(Ft, ei); + }; + }); + }); + }(), Ne.GBK = function(it) { + return new Pe(it); + }, gt.GBK = function(it) { + return new Oe(it, !0); + }, gt.gb18030 = function(it) { + return new Oe(it); + }, Ne.gb18030 = function(it) { + return new Pe(it); + }, gt.Big5 = function(it) { + return new Ge(it); + }, Ne.Big5 = function(it) { + return new Re(it); + }, gt["EUC-JP"] = function(it) { + return new et(it); + }, Ne["EUC-JP"] = function(it) { + return new je(it); + }, gt["ISO-2022-JP"] = function(it) { + return new tt(it); + }, Ne["ISO-2022-JP"] = function(it) { + return new Qe(it); + }, gt.Shift_JIS = function(it) { + return new Mt(it); + }, Ne.Shift_JIS = function(it) { + return new ft(it); + }, gt["EUC-KR"] = function(it) { + return new Tt(it); + }, Ne["EUC-KR"] = function(it) { + return new kt(it); + }, gt["UTF-16BE"] = function(it) { + return new nt(!0, it); + }, Ne["UTF-16BE"] = function(it) { + return new Nt(!0, it); + }, gt["UTF-16LE"] = function(it) { + return new nt(!1, it); + }, Ne["UTF-16LE"] = function(it) { + return new Nt(!1, it); + }, gt["x-user-defined"] = function(it) { + return new Be(it); + }, Ne["x-user-defined"] = function(it) { + return new Ee(it); + }, h.TextEncoder || (h.TextEncoder = Me), h.TextDecoder || (h.TextDecoder = Se), typeof c < "u" && c.exports && (c.exports = { TextEncoder: h.TextEncoder, TextDecoder: h.TextDecoder, EncodingIndexes: h["encoding-indexes"] }); + })(this || {}); + }, { "./encoding-indexes.js": 7 }], 22: [function(l, c, h) { + (function(p, y) { + (function() { + function v(V, j) { + this._id = V, this._clearFn = j; + } + var x = l("process/browser.js").nextTick, I = Function.prototype.apply, P = Array.prototype.slice, F = {}, k = 0; + h.setTimeout = function() { + return new v(I.call(setTimeout, window, arguments), clearTimeout); + }, h.setInterval = function() { + return new v(I.call(setInterval, window, arguments), clearInterval); + }, h.clearTimeout = h.clearInterval = function(V) { + V.close(); + }, v.prototype.unref = v.prototype.ref = function() { + }, v.prototype.close = function() { + this._clearFn.call(window, this._id); + }, h.enroll = function(V, j) { + clearTimeout(V._idleTimeoutId), V._idleTimeout = j; + }, h.unenroll = function(V) { + clearTimeout(V._idleTimeoutId), V._idleTimeout = -1; + }, h._unrefActive = h.active = function(V) { + clearTimeout(V._idleTimeoutId); + var j = V._idleTimeout; + 0 <= j && (V._idleTimeoutId = setTimeout(function() { + V._onTimeout && V._onTimeout(); + }, j)); + }, h.setImmediate = typeof p == "function" ? p : function(V) { + var j = k++, Y = !(2 > arguments.length) && P.call(arguments, 1); + return F[j] = !0, x(function() { + F[j] && (Y ? V.apply(null, Y) : V.call(null), h.clearImmediate(j)); + }), j; + }, h.clearImmediate = typeof y == "function" ? y : function(V) { + delete F[V]; + }; + }).call(this); + }).call(this, l("timers").setImmediate, l("timers").clearImmediate); + }, { "process/browser.js": 16, timers: 22 }], 23: [function(l, c) { + (function(h) { + (function() { + function p(Se) { + if (!Se) + throw new Error("forgot to pass buffer"); + return X.isBuffer(Se) ? Se : y(Se) ? X.from(Se) : y(Se.buffer) ? Se.BYTES_PER_ELEMENT === 1 ? X.from(Se) : X.from(Se.buffer) : void 0; + } + function y(Se) { + return Se instanceof h.ArrayBuffer || Object.prototype.toString.call(Se) === "[object ArrayBuffer]"; + } + function v(Se, Me) { + return typeof Se == "string" && re.has(Se) ? j.resolve(re.get(Se)) : v.getShapefile(Se, Me).then(function(ke) { + return typeof Se == "string" && re.set(Se, ke), ke; + }); + } + async function x(Se, Me) { + const ke = await F(Se); + return v.parseZip(ke, Me); + } + let I = l("proj4"); + I.default && (I = I.default); + const P = l("./unzip"), F = l("./binaryajax"), k = l("./parseShp"), V = l("parsedbf"), j = l("lie"), Y = l("lru-cache"), X = l("buffer").Buffer, Q = h.URL, re = new Y({ max: 20 }); + v.combine = function([Se, Me]) { + const ke = { type: "FeatureCollection", features: [] }; + let J = 0; + const ce = Se.length; + for (Me || (Me = []); J < ce; ) + ke.features.push({ type: "Feature", geometry: Se[J], properties: Me[J] || {} }), J++; + return ke; + }, v.parseZip = async function(Se, Me) { + Se = p(Se); + const ke = await P(Se), J = []; + for (var ce in Me = Me || [], ke) + ce.indexOf("__MACOSX") === -1 && (ce.slice(-3).toLowerCase() === "shp" ? (J.push(ce.slice(0, -4)), ke[ce.slice(0, -3) + ce.slice(-3).toLowerCase()] = ke[ce]) : ce.slice(-3).toLowerCase() === "prj" ? ke[ce.slice(0, -3) + ce.slice(-3).toLowerCase()] = I(ke[ce]) : ce.slice(-4).toLowerCase() === "json" || -1 < Me.indexOf(ce.split(".").pop()) ? J.push(ce.slice(0, -3) + ce.slice(-3).toLowerCase()) : (ce.slice(-3).toLowerCase() === "dbf" || ce.slice(-3).toLowerCase() === "cpg") && (ke[ce.slice(0, -3) + ce.slice(-3).toLowerCase()] = ke[ce])); + if (!J.length) + throw new Error("no layers founds"); + const xe = J.map(function(Pe) { + let Oe, Re; + const Ge = Pe.lastIndexOf("."); + return -1 < Ge && -1 < Pe.slice(Ge).indexOf("json") ? (Oe = JSON.parse(ke[Pe]), Oe.fileName = Pe.slice(0, Ge)) : -1 < Me.indexOf(Pe.slice(Ge + 1)) ? (Oe = ke[Pe], Oe.fileName = Pe) : (ke[Pe + ".dbf"] && (Re = V(ke[Pe + ".dbf"], ke[Pe + ".cpg"])), Oe = v.combine([k(ke[Pe + ".shp"], ke[Pe + ".prj"]), Re]), Oe.fileName = Pe), Oe; + }); + return xe.length === 1 ? xe[0] : xe; + }; + const he = async (Se) => { + const Me = await j.all([F(Se, "shp"), F(Se, "prj")]); + let ke = !1; + try { + Me[1] && (ke = I(Me[1])); + } catch { + ke = !1; + } + return k(Me[0], ke); + }, fe = async (Se) => { + const [Me, ke] = await j.all([F(Se, "dbf"), F(Se, "cpg")]); + return Me ? V(Me, ke) : void 0; + }, be = (Se, Me) => new Q(Se).pathname.slice(-4).toLowerCase() === Me; + v.getShapefile = async function(Se, Me) { + if (typeof Se != "string") + return v.parseZip(Se); + if (be(Se, ".zip")) + return x(Se, Me); + const ke = await j.all([he(Se), fe(Se)]); + return v.combine(ke); + }, v.parseShp = function(Se, Me) { + if (Se = p(Se), X.isBuffer(Me) && (Me = Me.toString()), typeof Me == "string") + try { + Me = I(Me); + } catch { + Me = !1; + } + return k(Se, Me); + }, v.parseDbf = function(Se, Me) { + return Se = p(Se), V(Se, Me); + }, c.exports = v; + }).call(this); + }).call(this, typeof td > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : td); + }, { "./binaryajax": 2, "./parseShp": 4, "./unzip": 5, buffer: 8, lie: 12, "lru-cache": 13, parsedbf: 15, proj4: 17 }] }, {}, [23])(23); + }); +})(cCt); +var jPi = cCt.exports; +const GPi = /* @__PURE__ */ VI(jPi), UPi = { + Point: "circlePoint", + MultiPoint: "circlePoint", + LineString: "solidLine", + MultiLineString: "solidLine", + Polygon: "outlinedPoly", + MultiPolygon: "outlinedPoly" +}; +function zPi(t) { + if (t.type !== "FeatureCollection") + throw new Error("GeoJSON is not in FeatureCollection format"); + let e = !0, i = !0; + t.features.forEach((r, n) => { + Object.assign(r.properties, { ID_FILE: "", OBJECTID_FILE: "" }), "id" in r && typeof r.id < "u" && (r.properties.ID_FILE = r.id, e = !1), "OBJECTID" in r.properties && (r.properties.OBJECTID_FILE = r.properties.OBJECTID, delete r.properties.OBJECTID, i = !1), r.id = n + 1; + }), e && t.features.forEach(function(r) { + delete r.properties.ID_FILE; + }), i && t.features.forEach(function(r) { + delete r.properties.OBJECTID_FILE; + }); +} +function HPi(t, e) { + const i = (r) => r.indexOf(" ") > -1; + e.fields?.forEach((r) => { + if (r.name && i(r.name)) { + const n = r.name; + let s, o = "_", a; + do + s = n.replace(/ /g, o), a = e.fields?.find( + (l) => l.name === s + ), a && (o += "_"); + while (a); + r.alias = n, r.name = s, t.features.forEach((l) => { + l.properties[s] = l.properties[n], delete l.properties[n]; + }); + } + }); +} +function WPi(t, e) { + const i = t.features[e].geometry.geometries; + if (i.length === 1) + t.features[e].geometry = { + type: i[0].type, + coordinates: i[0].coordinates + }; + else { + const r = i.map((n) => n.coordinates); + t.features[e].geometry = { + type: `Multi${i[0].type}`, + coordinates: r + }; + } +} +class qPi extends cf { + /** + * Fetch file data from remote URL. + * @param url the URL to get the data from + * @param fileType the type of the file layer (csv, shape, or geoJson) + */ + async fetchFileData(e, i) { + const r = await dO.get(e, { + responseType: "arrayBuffer" + }); + switch (i) { + case rn.GEOJSON: + case rn.DATAJSON: + return JSON.parse( + new TextDecoder("utf-8").decode( + new Uint8Array(r.data) + ) + ); + case rn.SHAPEFILE: + return r.data; + case rn.CSV: + case rn.DATACSV: + return new TextDecoder("utf-8").decode( + new Uint8Array(r.data) + ); + default: + console.error( + `Unsupported file type passed to fetchFileData- '${i}'` + ); + } + } + /** + * Extracts fields from the first feature in the feature collection + */ + extractGeoJsonFields(e) { + if (e.features.length < 1) + throw new Error( + "GeoJSON field extraction requires at least one feature" + ); + let i = e.features[0].geometry.type; + if (e.features.forEach((o, a) => { + if (o.geometry.type === "GeometryCollection") { + const c = o.geometry.geometries; + if (c === void 0 || c.length === 0) + return Promise.reject( + new Error( + "GeoJSON file has geometry collection with missing/incomplete geometries" + ) + ); + i = c[0].type, c.forEach((h) => { + if (h.type !== i) + return Promise.reject( + new Error( + "GeoJSON file has geometry collection containing multiple geometry types" + ) + ); + }), WPi(e, a); + } + }), [ + ...new Set( + e.features.map((o) => o.geometry.type === "MultiLineString" ? "LineString" : o.geometry.type === "MultiPolygon" ? "Polygon" : o.geometry.type) + ) + ].length !== 1) + throw new Error("GeoJSON file contains multiple geometry types"); + const r = Object.keys( + e.features[0].properties + ).map((o) => ({ name: o, type: "string" })); + let n = 0; + const s = Object.keys( + e.features[0].properties + ); + for (; n < e.features.length; ) { + const o = e.features[n]; + if (o.properties && Object.keys(o.properties).filter((a) => s.includes(a)).forEach((a) => { + const l = o.properties[a]; + if (l != null) { + const c = r.findIndex( + (h) => h.name === a + ); + r[c] = { + name: a, + type: this.inferType(l) + }, s.splice( + s.indexOf(a), + 1 + ); + } + }), s.length === 0) + break; + n++; + } + return r; + } + /** + * Extracts fields from csv file does no guesswork on property types and calls everything a string. + */ + extractCsvFields(e, i = ",") { + return Swe.dsv.dsvFormat(i).parseRows(e)[0].map((n) => ({ name: n, type: Ev.STRING })); + } + /** + * Returns all the fields from csv file that can be possible lat/long fields + * @param csvData the csv file data + * @param delimiter the delimiter in the data + */ + filterCsvLatLonFields(e, i = ",") { + const r = Swe.dsv.dsvFormat(i).parseRows(e), n = r[0], s = { + lat: JSON.parse(JSON.stringify(n)), + lon: JSON.parse(JSON.stringify(n)) + }; + for (let o = 0; o < n.length; o++) + for (let a = 1; a < r.length; a++) { + const l = Number(r[a][o]), c = s.lat.indexOf(n[o]), h = s.lon.indexOf(n[o]); + if ((isNaN(l) || l < -90 || l > 90) && c !== -1 && s.lat.splice(c, 1), (isNaN(l) || l < -180 || l > 180) && h !== -1 && s.lon.splice(h, 1), c === -1 && h === -1) + break; + } + return s; + } + /** + * Convert GeoJSON to Esri json, a format that can be read by a feature layer constructor + * + * @param geoJson {Object} a GeoJSON object + * @param options {GeoJsonOptions} any options for the transformation + * @returns {Object} feature layer constructor object + */ + async geoJsonToEsriJson(e, i) { + let r, n = "EPSG:4326", s; + const o = { + objectIdField: "OBJECTID", + fields: [ + { + name: "OBJECTID", + type: Ev.OID + } + ] + }; + zPi(e); + const a = e.features[0].geometry.type, l = UPi[a], c = JSON.parse( + // @ts-ignore + JSON.stringify(fPi[l]) + ); + if (e.crs && e.crs.type === "name" && (n = e.crs.properties.name), i) { + if (i.sourceProjection && (n = i.sourceProjection), i.targetSR) + r = i.targetSR; + else + throw new Error( + "geoJsonToEsriJson - missing opts.targetSR arguement" + ); + i.layerId ? s = i.layerId : s = this.$iApi.geo.shared.generateUUID(), i.colour && (c.renderer.symbol.color = new QO( + i.colour + ).toArcServer()); + } else + throw new Error("geoJsonToEsriJson - missing opts arguement"); + o.renderer = Z_.fromJSON( + c.renderer + ), o.fields = (o.fields || []).concat( + i.fieldMetadata?.exclusiveFields ? this.extractGeoJsonFields(e).filter( + (v) => i.fieldMetadata?.fieldInfo?.find( + (x) => x.name === v.name + ) + ) : this.extractGeoJsonFields(e) + ), i.fieldMetadata?.enforceOrder && i.fieldMetadata?.fieldInfo && i.fieldMetadata?.fieldInfo.length > 0 && (o.fields = this.$iApi.geo.attributes.orderFields( + o.fields, + i.fieldMetadata?.fieldInfo + )), HPi(e, o); + const h = this.$iApi.geo.proj.normalizeProj(r); + if (i) { + if (i.latField) { + const v = o.fields.find( + (x) => x.name === i.latField || x.alias === i.latField + ); + v && (v.type = Ev.DOUBLE); + } + if (i.lonField) { + const v = o.fields.find( + (x) => x.name === i.lonField || x.alias === i.lonField + ); + v && (v.type = Ev.DOUBLE); + } + } + await this.$iApi.geo.proj.checkProjBomber([n, r]); + const p = new or(r); + await this.$iApi.geo.proj.projectGeoJson(e, n, h); + const y = gPi.convert(e, { sr: 8888 }); + return o.geometryType = this.$iApi.geo.geom.geoJsonGeomTypeToEsriGeomType(a), y.forEach((v) => { + v.geometry.spatialReference = p, v.geometry.type = o.geometryType, Object.keys(v.attributes).forEach((x) => { + (Array.isArray(v.attributes[x]) || typeof v.attributes[x] == "object") && v.attributes[x] != null && (v.attributes[x] = JSON.stringify( + v.attributes[x] + )); + }); + }), o.source = y, o.spatialReference = p, o.id = s, o; + } + // converts csv file in string format to geojson object + // options + // - latfield: a string identifying the field containing latitude values ('Lat' by default) + // - lonfield: a string identifying the field containing longitude values ('Long' by default) + // - delimiter: a string defining the delimiter character of the file (',' by default) + async csvToGeoJson(e, i) { + const r = { + // default values + latfield: "Lat", + lonfield: "Long", + delimiter: "," + }; + return i && (i.latfield && (r.latfield = i.latfield), i.lonfield && (r.lonfield = i.lonfield), i.delimiter && (r.delimiter = i.delimiter)), new Promise((n, s) => { + Swe.csv2geojson(e, r, (o, a) => { + o ? (console.error("csv conversion error"), console.error(o), s(o)) : (a.features.map((l) => { + l.properties[r.lonfield] = l.geometry.coordinates[0], l.properties[r.latfield] = l.geometry.coordinates[1]; + }), n(a)); + }); + }); + } + /** + * Converts Shapefile data to geojson. + * @param {ArrayBuffer} shapeData an ArrayBuffer of the Shapefile in zip format + * @returns {Promise} a promise resolving with geojson + */ + async shapefileToGeoJson(e) { + return GPi(e); + } + /** + * Attempt to infers the type of a given value + * Will check if the value's type is one of int, double + * Defaults to string type if not + */ + inferType(e) { + return typeof e == "number" ? Ev.DOUBLE : Ev.STRING; + } +} +const YPi = [ + 4326, + 4269, + 4258, + 31467, + 31468, + 31469, + 2166, + 2167, + 2168, + 2036, + 2044, + 2045, + 2065, + 2081, + 2082, + 2083, + 2085, + 2086, + 2091, + 2092, + 2093, + 2096, + 2097, + 2098, + 2105, + 2106, + 2107, + 2108, + 2109, + 2110, + 2111, + 2112, + 2113, + 2114, + 2115, + 2116, + 2117, + 2118, + 2119, + 2120, + 2121, + 2122, + 2123, + 2124, + 2125, + 2126, + 2127, + 2128, + 2129, + 2130, + 2131, + 2132, + 2169, + 2170, + 2171, + 2172, + 2173, + 2174, + 2175, + 2176, + 2177, + 2178, + 2179, + 2180, + 2193, + 2199, + 2200, + 2206, + 2207, + 2208, + 2209, + 2210, + 2211, + 2212, + 2319, + 2320, + 2321, + 2322, + 2323, + 2324, + 2325, + 2326, + 2327, + 2328, + 2329, + 2330, + 2331, + 2332, + 2333, + 2334, + 2335, + 2336, + 2337, + 2338, + 2339, + 2340, + 2341, + 2342, + 2343, + 2344, + 2345, + 2346, + 2347, + 2348, + 2349, + 2350, + 2351, + 2352, + 2353, + 2354, + 2355, + 2356, + 2357, + 2358, + 2359, + 2360, + 2361, + 2362, + 2363, + 2364, + 2365, + 2366, + 2367, + 2368, + 2369, + 2370, + 2371, + 2372, + 2373, + 2374, + 2375, + 2376, + 2377, + 2378, + 2379, + 2380, + 2381, + 2382, + 2383, + 2384, + 2385, + 2386, + 2387, + 2388, + 2389, + 2390, + 2391, + 2392, + 2393, + 2394, + 2395, + 2396, + 2397, + 2398, + 2399, + 2400, + 2401, + 2402, + 2403, + 2404, + 2405, + 2406, + 2407, + 2408, + 2409, + 2410, + 2411, + 2412, + 2413, + 2414, + 2415, + 2416, + 2417, + 2418, + 2419, + 2420, + 2421, + 2422, + 2423, + 2424, + 2425, + 2426, + 2427, + 2428, + 2429, + 2430, + 2431, + 2432, + 2433, + 2434, + 2435, + 2436, + 2437, + 2438, + 2439, + 2440, + 2441, + 2442, + 2443, + 2444, + 2445, + 2446, + 2447, + 2448, + 2449, + 2450, + 2451, + 2452, + 2453, + 2454, + 2455, + 2456, + 2457, + 2458, + 2459, + 2460, + 2461, + 2462, + 2463, + 2464, + 2465, + 2466, + 2467, + 2468, + 2469, + 2470, + 2471, + 2472, + 2473, + 2474, + 2475, + 2476, + 2477, + 2478, + 2479, + 2480, + 2481, + 2482, + 2483, + 2484, + 2485, + 2486, + 2487, + 2488, + 2489, + 2490, + 2491, + 2492, + 2493, + 2494, + 2495, + 2496, + 2497, + 2498, + 2499, + 2500, + 2501, + 2502, + 2503, + 2504, + 2505, + 2506, + 2507, + 2508, + 2509, + 2510, + 2511, + 2512, + 2513, + 2514, + 2515, + 2516, + 2517, + 2518, + 2519, + 2520, + 2521, + 2522, + 2523, + 2524, + 2525, + 2526, + 2527, + 2528, + 2529, + 2530, + 2531, + 2532, + 2533, + 2534, + 2535, + 2536, + 2537, + 2538, + 2539, + 2540, + 2541, + 2542, + 2543, + 2544, + 2545, + 2546, + 2547, + 2548, + 2549, + 2551, + 2552, + 2553, + 2554, + 2555, + 2556, + 2557, + 2558, + 2559, + 2560, + 2561, + 2562, + 2563, + 2564, + 2565, + 2566, + 2567, + 2568, + 2569, + 2570, + 2571, + 2572, + 2573, + 2574, + 2575, + 2576, + 2577, + 2578, + 2579, + 2580, + 2581, + 2582, + 2583, + 2584, + 2585, + 2586, + 2587, + 2588, + 2589, + 2590, + 2591, + 2592, + 2593, + 2594, + 2595, + 2596, + 2597, + 2598, + 2599, + 2600, + 2601, + 2602, + 2603, + 2604, + 2605, + 2606, + 2607, + 2608, + 2609, + 2610, + 2611, + 2612, + 2613, + 2614, + 2615, + 2616, + 2617, + 2618, + 2619, + 2620, + 2621, + 2622, + 2623, + 2624, + 2625, + 2626, + 2627, + 2628, + 2629, + 2630, + 2631, + 2632, + 2633, + 2634, + 2635, + 2636, + 2637, + 2638, + 2639, + 2640, + 2641, + 2642, + 2643, + 2644, + 2645, + 2646, + 2647, + 2648, + 2649, + 2650, + 2651, + 2652, + 2653, + 2654, + 2655, + 2656, + 2657, + 2658, + 2659, + 2660, + 2661, + 2662, + 2663, + 2664, + 2665, + 2666, + 2667, + 2668, + 2669, + 2670, + 2671, + 2672, + 2673, + 2674, + 2675, + 2676, + 2677, + 2678, + 2679, + 2680, + 2681, + 2682, + 2683, + 2684, + 2685, + 2686, + 2687, + 2688, + 2689, + 2690, + 2691, + 2692, + 2693, + 2694, + 2695, + 2696, + 2697, + 2698, + 2699, + 2700, + 2701, + 2702, + 2703, + 2704, + 2705, + 2706, + 2707, + 2708, + 2709, + 2710, + 2711, + 2712, + 2713, + 2714, + 2715, + 2716, + 2717, + 2718, + 2719, + 2720, + 2721, + 2722, + 2723, + 2724, + 2725, + 2726, + 2727, + 2728, + 2729, + 2730, + 2731, + 2732, + 2733, + 2734, + 2735, + 2738, + 2739, + 2740, + 2741, + 2742, + 2743, + 2744, + 2745, + 2746, + 2747, + 2748, + 2749, + 2750, + 2751, + 2752, + 2753, + 2754, + 2755, + 2756, + 2757, + 2758, + 2935, + 2936, + 2937, + 2938, + 2939, + 2940, + 2941, + 2953, + 2963, + 3006, + 3007, + 3008, + 3009, + 3010, + 3011, + 3012, + 3013, + 3014, + 3015, + 3016, + 3017, + 3018, + 3019, + 3020, + 3021, + 3022, + 3023, + 3024, + 3025, + 3026, + 3027, + 3028, + 3029, + 3030, + 3034, + 3035, + 3038, + 3039, + 3040, + 3041, + 3042, + 3043, + 3044, + 3045, + 3046, + 3047, + 3048, + 3049, + 3050, + 3051, + 3058, + 3059, + 3068, + 3114, + 3115, + 3116, + 3117, + 3118, + 3120, + 3126, + 3127, + 3128, + 3129, + 3130, + 3131, + 3132, + 3133, + 3134, + 3135, + 3136, + 3137, + 3138, + 3139, + 3140, + 3146, + 3147, + 3150, + 3151, + 3152, + 3300, + 3301, + 3328, + 3329, + 3330, + 3331, + 3332, + 3333, + 3334, + 3335, + 3346, + 3350, + 3351, + 3352, + 3366, + 3386, + 3387, + 3388, + 3389, + 3390, + 3396, + 3397, + 3398, + 3399, + 3407, + 3414, + 3416, + 3764, + 3788, + 3789, + 3790, + 3791, + 3793, + 3795, + 3796, + 3819, + 3821, + 3823, + 3824, + 3833, + 3834, + 3835, + 3836, + 3837, + 3838, + 3839, + 3840, + 3841, + 3842, + 3843, + 3844, + 3845, + 3846, + 3847, + 3848, + 3849, + 3850, + 3851, + 3852, + 3854, + 3873, + 3874, + 3875, + 3876, + 3877, + 3878, + 3879, + 3880, + 3881, + 3882, + 3883, + 3884, + 3885, + 3888, + 3889, + 3906, + 3907, + 3908, + 3909, + 3910, + 3911, + 4001, + 4002, + 4003, + 4004, + 4005, + 4006, + 4007, + 4008, + 4009, + 4010, + 4011, + 4012, + 4013, + 4014, + 4015, + 4016, + 4017, + 4018, + 4019, + 4020, + 4021, + 4022, + 4023, + 4024, + 4025, + 4026, + 4027, + 4028, + 4029, + 4030, + 4031, + 4032, + 4033, + 4034, + 4035, + 4036, + 4037, + 4038, + 4040, + 4041, + 4042, + 4043, + 4044, + 4045, + 4046, + 4047, + 4052, + 4053, + 4054, + 4055, + 4074, + 4075, + 4080, + 4081, + 4120, + 4121, + 4122, + 4123, + 4124, + 4125, + 4126, + 4127, + 4128, + 4129, + 4130, + 4131, + 4132, + 4133, + 4134, + 4135, + 4136, + 4137, + 4138, + 4139, + 4140, + 4141, + 4142, + 4143, + 4144, + 4145, + 4146, + 4147, + 4148, + 4149, + 4150, + 4151, + 4152, + 4153, + 4154, + 4155, + 4156, + 4157, + 4158, + 4159, + 4160, + 4161, + 4162, + 4163, + 4164, + 4165, + 4166, + 4167, + 4168, + 4169, + 4170, + 4171, + 4172, + 4173, + 4174, + 4175, + 4176, + 4178, + 4179, + 4180, + 4181, + 4182, + 4183, + 4184, + 4185, + 4188, + 4189, + 4190, + 4191, + 4192, + 4193, + 4194, + 4195, + 4196, + 4197, + 4198, + 4199, + 4200, + 4201, + 4202, + 4203, + 4204, + 4205, + 4206, + 4207, + 4208, + 4209, + 4210, + 4211, + 4212, + 4213, + 4214, + 4215, + 4216, + 4218, + 4219, + 4220, + 4221, + 4222, + 4223, + 4224, + 4225, + 4226, + 4227, + 4228, + 4229, + 4230, + 4231, + 4232, + 4233, + 4234, + 4235, + 4236, + 4237, + 4238, + 4239, + 4240, + 4241, + 4242, + 4243, + 4244, + 4245, + 4246, + 4247, + 4248, + 4249, + 4250, + 4251, + 4252, + 4253, + 4254, + 4255, + 4256, + 4257, + 4259, + 4260, + 4261, + 4262, + 4263, + 4264, + 4265, + 4266, + 4267, + 4268, + 4270, + 4271, + 4272, + 4273, + 4274, + 4275, + 4276, + 4277, + 4278, + 4279, + 4280, + 4281, + 4282, + 4283, + 4284, + 4285, + 4286, + 4287, + 4288, + 4289, + 4291, + 4292, + 4293, + 4294, + 4295, + 4296, + 4297, + 4298, + 4299, + 4300, + 4301, + 4302, + 4303, + 4304, + 4306, + 4307, + 4308, + 4309, + 4310, + 4311, + 4312, + 4313, + 4314, + 4315, + 4316, + 4317, + 4318, + 4319, + 4322, + 4324, + 4327, + 4329, + 4339, + 4341, + 4343, + 4345, + 4347, + 4349, + 4351, + 4353, + 4355, + 4357, + 4359, + 4361, + 4363, + 4365, + 4367, + 4369, + 4371, + 4373, + 4375, + 4377, + 4379, + 4381, + 4383, + 4386, + 4388, + 4417, + 4434, + 4463, + 4466, + 4469, + 4470, + 4472, + 4475, + 4480, + 4482, + 4483, + 4490, + 4491, + 4492, + 4493, + 4494, + 4495, + 4496, + 4497, + 4498, + 4499, + 4500, + 4501, + 4502, + 4503, + 4504, + 4505, + 4506, + 4507, + 4508, + 4509, + 4510, + 4511, + 4512, + 4513, + 4514, + 4515, + 4516, + 4517, + 4518, + 4519, + 4520, + 4521, + 4522, + 4523, + 4524, + 4525, + 4526, + 4527, + 4528, + 4529, + 4530, + 4531, + 4532, + 4533, + 4534, + 4535, + 4536, + 4537, + 4538, + 4539, + 4540, + 4541, + 4542, + 4543, + 4544, + 4545, + 4546, + 4547, + 4548, + 4549, + 4550, + 4551, + 4552, + 4553, + 4554, + 4555, + 4557, + 4558, + 4568, + 4569, + 4570, + 4571, + 4572, + 4573, + 4574, + 4575, + 4576, + 4577, + 4578, + 4579, + 4580, + 4581, + 4582, + 4583, + 4584, + 4585, + 4586, + 4587, + 4588, + 4589, + 4600, + 4601, + 4602, + 4603, + 4604, + 4605, + 4606, + 4607, + 4608, + 4609, + 4610, + 4611, + 4612, + 4613, + 4614, + 4615, + 4616, + 4617, + 4618, + 4619, + 4620, + 4621, + 4622, + 4623, + 4624, + 4625, + 4626, + 4627, + 4628, + 4629, + 4630, + 4631, + 4632, + 4633, + 4634, + 4635, + 4636, + 4637, + 4638, + 4639, + 4640, + 4641, + 4642, + 4643, + 4644, + 4645, + 4646, + 4652, + 4653, + 4654, + 4655, + 4656, + 4657, + 4658, + 4659, + 4660, + 4661, + 4662, + 4663, + 4664, + 4665, + 4666, + 4667, + 4668, + 4669, + 4670, + 4671, + 4672, + 4673, + 4674, + 4675, + 4676, + 4677, + 4678, + 4679, + 4680, + 4681, + 4682, + 4683, + 4684, + 4685, + 4686, + 4687, + 4688, + 4689, + 4690, + 4691, + 4692, + 4693, + 4694, + 4695, + 4696, + 4697, + 4698, + 4699, + 4700, + 4701, + 4702, + 4703, + 4704, + 4705, + 4706, + 4707, + 4708, + 4709, + 4710, + 4711, + 4712, + 4713, + 4714, + 4715, + 4716, + 4717, + 4718, + 4719, + 4720, + 4721, + 4722, + 4723, + 4724, + 4725, + 4726, + 4727, + 4728, + 4729, + 4730, + 4731, + 4732, + 4733, + 4734, + 4735, + 4736, + 4737, + 4738, + 4739, + 4740, + 4741, + 4742, + 4743, + 4744, + 4745, + 4746, + 4747, + 4748, + 4749, + 4750, + 4751, + 4752, + 4753, + 4754, + 4755, + 4756, + 4757, + 4758, + 4759, + 4760, + 4761, + 4762, + 4763, + 4764, + 4765, + 4766, + 4767, + 4768, + 4769, + 4770, + 4771, + 4772, + 4773, + 4774, + 4775, + 4776, + 4777, + 4778, + 4779, + 4780, + 4781, + 4782, + 4783, + 4784, + 4785, + 4786, + 4787, + 4788, + 4789, + 4790, + 4791, + 4792, + 4793, + 4794, + 4795, + 4796, + 4797, + 4798, + 4799, + 4800, + 4801, + 4802, + 4803, + 4804, + 4805, + 4806, + 4807, + 4808, + 4809, + 4810, + 4811, + 4812, + 4813, + 4814, + 4815, + 4816, + 4817, + 4818, + 4819, + 4820, + 4821, + 4822, + 4823, + 4824, + 4839, + 4855, + 4856, + 4857, + 4858, + 4859, + 4860, + 4861, + 4862, + 4863, + 4864, + 4865, + 4866, + 4867, + 4868, + 4869, + 4870, + 4871, + 4872, + 4873, + 4874, + 4875, + 4876, + 4877, + 4878, + 4879, + 4880, + 4883, + 4885, + 4887, + 4889, + 4891, + 4893, + 4895, + 4898, + 4900, + 4901, + 4902, + 4903, + 4904, + 4907, + 4909, + 4921, + 4923, + 4925, + 4927, + 4929, + 4931, + 4933, + 4935, + 4937, + 4939, + 4941, + 4943, + 4945, + 4947, + 4949, + 4951, + 4953, + 4955, + 4957, + 4959, + 4961, + 4963, + 4965, + 4967, + 4969, + 4971, + 4973, + 4975, + 4977, + 4979, + 4981, + 4983, + 4985, + 4987, + 4989, + 4991, + 4993, + 4995, + 4997, + 4999, + 5012, + 5013, + 5017, + 5048, + 5105, + 5106, + 5107, + 5108, + 5109, + 5110, + 5111, + 5112, + 5113, + 5114, + 5115, + 5116, + 5117, + 5118, + 5119, + 5120, + 5121, + 5122, + 5123, + 5124, + 5125, + 5126, + 5127, + 5128, + 5129, + 5130, + 5132, + 5167, + 5168, + 5169, + 5170, + 5171, + 5172, + 5173, + 5174, + 5175, + 5176, + 5177, + 5178, + 5179, + 5180, + 5181, + 5182, + 5183, + 5184, + 5185, + 5186, + 5187, + 5188, + 5224, + 5228, + 5229, + 5233, + 5245, + 5246, + 5251, + 5252, + 5253, + 5254, + 5255, + 5256, + 5257, + 5258, + 5259, + 5263, + 5264, + 5269, + 5270, + 5271, + 5272, + 5273, + 5274, + 5275, + 5801, + 5802, + 5803, + 5804, + 5808, + 5809, + 5810, + 5811, + 5812, + 5813, + 5814, + 5815, + 5816, + 20004, + 20005, + 20006, + 20007, + 20008, + 20009, + 20010, + 20011, + 20012, + 20013, + 20014, + 20015, + 20016, + 20017, + 20018, + 20019, + 20020, + 20021, + 20022, + 20023, + 20024, + 20025, + 20026, + 20027, + 20028, + 20029, + 20030, + 20031, + 20032, + 20064, + 20065, + 20066, + 20067, + 20068, + 20069, + 20070, + 20071, + 20072, + 20073, + 20074, + 20075, + 20076, + 20077, + 20078, + 20079, + 20080, + 20081, + 20082, + 20083, + 20084, + 20085, + 20086, + 20087, + 20088, + 20089, + 20090, + 20091, + 20092, + 21413, + 21414, + 21415, + 21416, + 21417, + 21418, + 21419, + 21420, + 21421, + 21422, + 21423, + 21453, + 21454, + 21455, + 21456, + 21457, + 21458, + 21459, + 21460, + 21461, + 21462, + 21463, + 21473, + 21474, + 21475, + 21476, + 21477, + 21478, + 21479, + 21480, + 21481, + 21482, + 21483, + 21896, + 21897, + 21898, + 21899, + 22171, + 22172, + 22173, + 22174, + 22175, + 22176, + 22177, + 22181, + 22182, + 22183, + 22184, + 22185, + 22186, + 22187, + 22191, + 22192, + 22193, + 22194, + 22195, + 22196, + 22197, + 25884, + 27205, + 27206, + 27207, + 27208, + 27209, + 27210, + 27211, + 27212, + 27213, + 27214, + 27215, + 27216, + 27217, + 27218, + 27219, + 27220, + 27221, + 27222, + 27223, + 27224, + 27225, + 27226, + 27227, + 27228, + 27229, + 27230, + 27231, + 27232, + 27391, + 27392, + 27393, + 27394, + 27395, + 27396, + 27397, + 27398, + 27492, + 28402, + 28403, + 28404, + 28405, + 28406, + 28407, + 28408, + 28409, + 28410, + 28411, + 28412, + 28413, + 28414, + 28415, + 28416, + 28417, + 28418, + 28419, + 28420, + 28421, + 28422, + 28423, + 28424, + 28425, + 28426, + 28427, + 28428, + 28429, + 28430, + 28431, + 28432, + 28462, + 28463, + 28464, + 28465, + 28466, + 28467, + 28468, + 28469, + 28470, + 28471, + 28472, + 28473, + 28474, + 28475, + 28476, + 28477, + 28478, + 28479, + 28480, + 28481, + 28482, + 28483, + 28484, + 28485, + 28486, + 28487, + 28488, + 28489, + 28490, + 28491, + 28492, + 29701, + 29702, + 30161, + 30162, + 30163, + 30164, + 30165, + 30166, + 30167, + 30168, + 30169, + 30170, + 30171, + 30172, + 30173, + 30174, + 30175, + 30176, + 30177, + 30178, + 30179, + 30800, + 31251, + 31252, + 31253, + 31254, + 31255, + 31256, + 31257, + 31258, + 31259, + 31275, + 31276, + 31277, + 31278, + 31279, + 31281, + 31282, + 31283, + 31284, + 31285, + 31286, + 31287, + 31288, + 31289, + 31290, + 31466, + 31700 +]; +function ZF(t, e) { + return t.then(function(i) { + return [null, i]; + }).catch(function(i) { + return e && Object.assign(i, e), [i, void 0]; + }); +} +var Q6e = {}, E0e = {}; +(function(t) { + const e = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", i = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", r = "[" + e + "][" + i + "]*", n = new RegExp("^" + r + "$"), s = function(a, l) { + const c = []; + let h = l.exec(a); + for (; h; ) { + const p = []; + p.startIndex = l.lastIndex - h[0].length; + const y = h.length; + for (let v = 0; v < y; v++) + p.push(h[v]); + c.push(p), h = l.exec(a); + } + return c; + }, o = function(a) { + const l = n.exec(a); + return !(l === null || typeof l > "u"); + }; + t.isExist = function(a) { + return typeof a < "u"; + }, t.isEmptyObject = function(a) { + return Object.keys(a).length === 0; + }, t.merge = function(a, l, c) { + if (l) { + const h = Object.keys(l), p = h.length; + for (let y = 0; y < p; y++) + c === "strict" ? a[h[y]] = [l[h[y]]] : a[h[y]] = l[h[y]]; + } + }, t.getValue = function(a) { + return t.isExist(a) ? a : ""; + }, t.isName = o, t.getAllMatches = s, t.nameRegexp = r; +})(E0e); +const e$e = E0e, XPi = { + allowBooleanAttributes: !1, + //A tag can have attributes without any value + unpairedTags: [] +}; +Q6e.validate = function(t, e) { + e = Object.assign({}, XPi, e); + const i = []; + let r = !1, n = !1; + t[0] === "\uFEFF" && (t = t.substr(1)); + for (let s = 0; s < t.length; s++) + if (t[s] === "<" && t[s + 1] === "?") { + if (s += 2, s = GXe(t, s), s.err) + return s; + } else if (t[s] === "<") { + let o = s; + if (s++, t[s] === "!") { + s = UXe(t, s); + continue; + } else { + let a = !1; + t[s] === "/" && (a = !0, s++); + let l = ""; + for (; s < t.length && t[s] !== ">" && t[s] !== " " && t[s] !== " " && t[s] !== ` +` && t[s] !== "\r"; s++) + l += t[s]; + if (l = l.trim(), l[l.length - 1] === "/" && (l = l.substring(0, l.length - 1), s--), !rOi(l)) { + let p; + return l.trim().length === 0 ? p = "Invalid space after '<'." : p = "Tag '" + l + "' is an invalid name.", im("InvalidTag", p, y_(t, s)); + } + const c = ZPi(t, s); + if (c === !1) + return im("InvalidAttr", "Attributes for '" + l + "' have open quote.", y_(t, s)); + let h = c.value; + if (s = c.index, h[h.length - 1] === "/") { + const p = s - h.length; + h = h.substring(0, h.length - 1); + const y = zXe(h, e); + if (y === !0) + r = !0; + else + return im(y.err.code, y.err.msg, y_(t, p + y.err.line)); + } else if (a) + if (c.tagClosed) { + if (h.trim().length > 0) + return im("InvalidTag", "Closing tag '" + l + "' can't have attributes or invalid starting.", y_(t, o)); + { + const p = i.pop(); + if (l !== p.tagName) { + let y = y_(t, p.tagStartPos); + return im( + "InvalidTag", + "Expected closing tag '" + p.tagName + "' (opened in line " + y.line + ", col " + y.col + ") instead of closing tag '" + l + "'.", + y_(t, o) + ); + } + i.length == 0 && (n = !0); + } + } else + return im("InvalidTag", "Closing tag '" + l + "' doesn't have proper closing.", y_(t, s)); + else { + const p = zXe(h, e); + if (p !== !0) + return im(p.err.code, p.err.msg, y_(t, s - h.length + p.err.line)); + if (n === !0) + return im("InvalidXml", "Multiple possible root nodes found.", y_(t, s)); + e.unpairedTags.indexOf(l) !== -1 || i.push({ tagName: l, tagStartPos: o }), r = !0; + } + for (s++; s < t.length; s++) + if (t[s] === "<") + if (t[s + 1] === "!") { + s++, s = UXe(t, s); + continue; + } else if (t[s + 1] === "?") { + if (s = GXe(t, ++s), s.err) + return s; + } else + break; + else if (t[s] === "&") { + const p = tOi(t, s); + if (p == -1) + return im("InvalidChar", "char '&' is not expected.", y_(t, s)); + s = p; + } else if (n === !0 && !jXe(t[s])) + return im("InvalidXml", "Extra text at the end", y_(t, s)); + t[s] === "<" && s--; + } + } else { + if (jXe(t[s])) + continue; + return im("InvalidChar", "char '" + t[s] + "' is not expected.", y_(t, s)); + } + if (r) { + if (i.length == 1) + return im("InvalidTag", "Unclosed tag '" + i[0].tagName + "'.", y_(t, i[0].tagStartPos)); + if (i.length > 0) + return im("InvalidXml", "Invalid '" + JSON.stringify(i.map((s) => s.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); + } else + return im("InvalidXml", "Start tag expected.", 1); + return !0; +}; +function jXe(t) { + return t === " " || t === " " || t === ` +` || t === "\r"; +} +function GXe(t, e) { + const i = e; + for (; e < t.length; e++) + if (t[e] == "?" || t[e] == " ") { + const r = t.substr(i, e - i); + if (e > 5 && r === "xml") + return im("InvalidXml", "XML declaration allowed only at the start of the document.", y_(t, e)); + if (t[e] == "?" && t[e + 1] == ">") { + e++; + break; + } else + continue; + } + return e; +} +function UXe(t, e) { + if (t.length > e + 5 && t[e + 1] === "-" && t[e + 2] === "-") { + for (e += 3; e < t.length; e++) + if (t[e] === "-" && t[e + 1] === "-" && t[e + 2] === ">") { + e += 2; + break; + } + } else if (t.length > e + 8 && t[e + 1] === "D" && t[e + 2] === "O" && t[e + 3] === "C" && t[e + 4] === "T" && t[e + 5] === "Y" && t[e + 6] === "P" && t[e + 7] === "E") { + let i = 1; + for (e += 8; e < t.length; e++) + if (t[e] === "<") + i++; + else if (t[e] === ">" && (i--, i === 0)) + break; + } else if (t.length > e + 9 && t[e + 1] === "[" && t[e + 2] === "C" && t[e + 3] === "D" && t[e + 4] === "A" && t[e + 5] === "T" && t[e + 6] === "A" && t[e + 7] === "[") { + for (e += 8; e < t.length; e++) + if (t[e] === "]" && t[e + 1] === "]" && t[e + 2] === ">") { + e += 2; + break; + } + } + return e; +} +const KPi = '"', JPi = "'"; +function ZPi(t, e) { + let i = "", r = "", n = !1; + for (; e < t.length; e++) { + if (t[e] === KPi || t[e] === JPi) + r === "" ? r = t[e] : r !== t[e] || (r = ""); + else if (t[e] === ">" && r === "") { + n = !0; + break; + } + i += t[e]; + } + return r !== "" ? !1 : { + value: i, + index: e, + tagClosed: n + }; +} +const QPi = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); +function zXe(t, e) { + const i = e$e.getAllMatches(t, QPi), r = {}; + for (let n = 0; n < i.length; n++) { + if (i[n][1].length === 0) + return im("InvalidAttr", "Attribute '" + i[n][2] + "' has no space in starting.", ZW(i[n])); + if (i[n][3] !== void 0 && i[n][4] === void 0) + return im("InvalidAttr", "Attribute '" + i[n][2] + "' is without value.", ZW(i[n])); + if (i[n][3] === void 0 && !e.allowBooleanAttributes) + return im("InvalidAttr", "boolean attribute '" + i[n][2] + "' is not allowed.", ZW(i[n])); + const s = i[n][2]; + if (!iOi(s)) + return im("InvalidAttr", "Attribute '" + s + "' is an invalid name.", ZW(i[n])); + if (!r.hasOwnProperty(s)) + r[s] = 1; + else + return im("InvalidAttr", "Attribute '" + s + "' is repeated.", ZW(i[n])); + } + return !0; +} +function eOi(t, e) { + let i = /\d/; + for (t[e] === "x" && (e++, i = /[\da-fA-F]/); e < t.length; e++) { + if (t[e] === ";") + return e; + if (!t[e].match(i)) + break; + } + return -1; +} +function tOi(t, e) { + if (e++, t[e] === ";") + return -1; + if (t[e] === "#") + return e++, eOi(t, e); + let i = 0; + for (; e < t.length; e++, i++) + if (!(t[e].match(/\w/) && i < 20)) { + if (t[e] === ";") + break; + return -1; + } + return e; +} +function im(t, e, i) { + return { + err: { + code: t, + msg: e, + line: i.line || i, + col: i.col + } + }; +} +function iOi(t) { + return e$e.isName(t); +} +function rOi(t) { + return e$e.isName(t); +} +function y_(t, e) { + const i = t.substring(0, e).split(/\r?\n/); + return { + line: i.length, + // column number is last line's length + 1, because column numbering starts at 1: + col: i[i.length - 1].length + 1 + }; +} +function ZW(t) { + return t.startIndex + t[1].length; +} +var t$e = {}; +const hCt = { + preserveOrder: !1, + attributeNamePrefix: "@_", + attributesGroupName: !1, + textNodeName: "#text", + ignoreAttributes: !0, + removeNSPrefix: !1, + // remove NS from tag name or attribute name if true + allowBooleanAttributes: !1, + //a tag can have attributes without any value + //ignoreRootElement : false, + parseTagValue: !0, + parseAttributeValue: !1, + trimValues: !0, + //Trim string values of tag and attributes + cdataPropName: !1, + numberParseOptions: { + hex: !0, + leadingZeros: !0, + eNotation: !0 + }, + tagValueProcessor: function(t, e) { + return e; + }, + attributeValueProcessor: function(t, e) { + return e; + }, + stopNodes: [], + //nested tags will not be parsed even for errors + alwaysCreateTextNode: !1, + isArray: () => !1, + commentPropName: !1, + unpairedTags: [], + processEntities: !0, + htmlEntities: !1, + ignoreDeclaration: !1, + ignorePiTags: !1, + transformTagName: !1, + transformAttributeName: !1, + updateTag: function(t, e, i) { + return t; + } + // skipEmptyListItem: false +}, nOi = function(t) { + return Object.assign({}, hCt, t); +}; +t$e.buildOptions = nOi; +t$e.defaultOptions = hCt; +class sOi { + constructor(e) { + this.tagname = e, this.child = [], this[":@"] = {}; + } + add(e, i) { + e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: i }); + } + addChild(e) { + e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, [":@"]: e[":@"] }) : this.child.push({ [e.tagname]: e.child }); + } +} +var oOi = sOi; +const aOi = E0e; +function lOi(t, e) { + const i = {}; + if (t[e + 3] === "O" && t[e + 4] === "C" && t[e + 5] === "T" && t[e + 6] === "Y" && t[e + 7] === "P" && t[e + 8] === "E") { + e = e + 9; + let r = 1, n = !1, s = !1, o = ""; + for (; e < t.length; e++) + if (t[e] === "<" && !s) { + if (n && hOi(t, e)) + e += 7, [entityName, val, e] = uOi(t, e + 1), val.indexOf("&") === -1 && (i[mOi(entityName)] = { + regx: RegExp(`&${entityName};`, "g"), + val + }); + else if (n && dOi(t, e)) + e += 8; + else if (n && pOi(t, e)) + e += 8; + else if (n && fOi(t, e)) + e += 9; + else if (cOi) + s = !0; + else + throw new Error("Invalid DOCTYPE"); + r++, o = ""; + } else if (t[e] === ">") { + if (s ? t[e - 1] === "-" && t[e - 2] === "-" && (s = !1, r--) : r--, r === 0) + break; + } else + t[e] === "[" ? n = !0 : o += t[e]; + if (r !== 0) + throw new Error("Unclosed DOCTYPE"); + } else + throw new Error("Invalid Tag instead of DOCTYPE"); + return { entities: i, i: e }; +} +function uOi(t, e) { + let i = ""; + for (; e < t.length && t[e] !== "'" && t[e] !== '"'; e++) + i += t[e]; + if (i = i.trim(), i.indexOf(" ") !== -1) + throw new Error("External entites are not supported"); + const r = t[e++]; + let n = ""; + for (; e < t.length && t[e] !== r; e++) + n += t[e]; + return [i, n, e]; +} +function cOi(t, e) { + return t[e + 1] === "!" && t[e + 2] === "-" && t[e + 3] === "-"; +} +function hOi(t, e) { + return t[e + 1] === "!" && t[e + 2] === "E" && t[e + 3] === "N" && t[e + 4] === "T" && t[e + 5] === "I" && t[e + 6] === "T" && t[e + 7] === "Y"; +} +function dOi(t, e) { + return t[e + 1] === "!" && t[e + 2] === "E" && t[e + 3] === "L" && t[e + 4] === "E" && t[e + 5] === "M" && t[e + 6] === "E" && t[e + 7] === "N" && t[e + 8] === "T"; +} +function pOi(t, e) { + return t[e + 1] === "!" && t[e + 2] === "A" && t[e + 3] === "T" && t[e + 4] === "T" && t[e + 5] === "L" && t[e + 6] === "I" && t[e + 7] === "S" && t[e + 8] === "T"; +} +function fOi(t, e) { + return t[e + 1] === "!" && t[e + 2] === "N" && t[e + 3] === "O" && t[e + 4] === "T" && t[e + 5] === "A" && t[e + 6] === "T" && t[e + 7] === "I" && t[e + 8] === "O" && t[e + 9] === "N"; +} +function mOi(t) { + if (aOi.isName(t)) + return t; + throw new Error(`Invalid entity name ${t}`); +} +var gOi = lOi; +const yOi = /^[-+]?0x[a-fA-F0-9]+$/, vOi = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; +!Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt); +!Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat); +const _Oi = { + hex: !0, + leadingZeros: !0, + decimalPoint: ".", + eNotation: !0 + //skipLike: /regex/ +}; +function bOi(t, e = {}) { + if (e = Object.assign({}, _Oi, e), !t || typeof t != "string") + return t; + let i = t.trim(); + if (e.skipLike !== void 0 && e.skipLike.test(i)) + return t; + if (e.hex && yOi.test(i)) + return Number.parseInt(i, 16); + { + const r = vOi.exec(i); + if (r) { + const n = r[1], s = r[2]; + let o = wOi(r[3]); + const a = r[4] || r[6]; + if (!e.leadingZeros && s.length > 0 && n && i[2] !== ".") + return t; + if (!e.leadingZeros && s.length > 0 && !n && i[1] !== ".") + return t; + { + const l = Number(i), c = "" + l; + return c.search(/[eE]/) !== -1 || a ? e.eNotation ? l : t : i.indexOf(".") !== -1 ? c === "0" && o === "" || c === o || n && c === "-" + o ? l : t : s ? o === c || n + o === c ? l : t : i === c || i === n + c ? l : t; + } + } else + return t; + } +} +function wOi(t) { + return t && t.indexOf(".") !== -1 && (t = t.replace(/0+$/, ""), t === "." ? t = "0" : t[0] === "." ? t = "0" + t : t[t.length - 1] === "." && (t = t.substr(0, t.length - 1))), t; +} +var xOi = bOi; +const i$e = E0e, QW = oOi, SOi = gOi, COi = xOi; +"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, i$e.nameRegexp); +let TOi = class { + constructor(e) { + this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { + apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, + gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, + lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, + quot: { regex: /&(quot|#34|#x22);/g, val: '"' } + }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { + space: { regex: /&(nbsp|#160);/g, val: " " }, + // "lt" : { regex: /&(lt|#60);/g, val: "<" }, + // "gt" : { regex: /&(gt|#62);/g, val: ">" }, + // "amp" : { regex: /&(amp|#38);/g, val: "&" }, + // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, + // "apos" : { regex: /&(apos|#39);/g, val: "'" }, + cent: { regex: /&(cent|#162);/g, val: "¢" }, + pound: { regex: /&(pound|#163);/g, val: "£" }, + yen: { regex: /&(yen|#165);/g, val: "¥" }, + euro: { regex: /&(euro|#8364);/g, val: "€" }, + copyright: { regex: /&(copy|#169);/g, val: "©" }, + reg: { regex: /&(reg|#174);/g, val: "®" }, + inr: { regex: /&(inr|#8377);/g, val: "₹" } + }, this.addExternalEntities = EOi, this.parseXml = ROi, this.parseTextData = IOi, this.resolveNameSpace = AOi, this.buildAttributesMap = OOi, this.isItStopNode = LOi, this.replaceEntitiesValue = DOi, this.readStopNodeData = kOi, this.saveTextToParentTag = FOi, this.addChild = MOi; + } +}; +function EOi(t) { + const e = Object.keys(t); + for (let i = 0; i < e.length; i++) { + const r = e[i]; + this.lastEntities[r] = { + regex: new RegExp("&" + r + ";", "g"), + val: t[r] + }; + } +} +function IOi(t, e, i, r, n, s, o) { + if (t !== void 0 && (this.options.trimValues && !r && (t = t.trim()), t.length > 0)) { + o || (t = this.replaceEntitiesValue(t)); + const a = this.options.tagValueProcessor(e, t, i, n, s); + return a == null ? t : typeof a != typeof t || a !== t ? a : this.options.trimValues ? COe(t, this.options.parseTagValue, this.options.numberParseOptions) : t.trim() === t ? COe(t, this.options.parseTagValue, this.options.numberParseOptions) : t; + } +} +function AOi(t) { + if (this.options.removeNSPrefix) { + const e = t.split(":"), i = t.charAt(0) === "/" ? "/" : ""; + if (e[0] === "xmlns") + return ""; + e.length === 2 && (t = i + e[1]); + } + return t; +} +const POi = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); +function OOi(t, e, i) { + if (!this.options.ignoreAttributes && typeof t == "string") { + const r = i$e.getAllMatches(t, POi), n = r.length, s = {}; + for (let o = 0; o < n; o++) { + const a = this.resolveNameSpace(r[o][1]); + let l = r[o][4], c = this.options.attributeNamePrefix + a; + if (a.length) + if (this.options.transformAttributeName && (c = this.options.transformAttributeName(c)), c === "__proto__" && (c = "#__proto__"), l !== void 0) { + this.options.trimValues && (l = l.trim()), l = this.replaceEntitiesValue(l); + const h = this.options.attributeValueProcessor(a, l, e); + h == null ? s[c] = l : typeof h != typeof l || h !== l ? s[c] = h : s[c] = COe( + l, + this.options.parseAttributeValue, + this.options.numberParseOptions + ); + } else + this.options.allowBooleanAttributes && (s[c] = !0); + } + if (!Object.keys(s).length) + return; + if (this.options.attributesGroupName) { + const o = {}; + return o[this.options.attributesGroupName] = s, o; + } + return s; + } +} +const ROi = function(t) { + t = t.replace(/\r\n?/g, ` +`); + const e = new QW("!xml"); + let i = e, r = "", n = ""; + for (let s = 0; s < t.length; s++) + if (t[s] === "<") + if (t[s + 1] === "/") { + const a = r6(t, ">", s, "Closing Tag is not closed."); + let l = t.substring(s + 2, a).trim(); + if (this.options.removeNSPrefix) { + const p = l.indexOf(":"); + p !== -1 && (l = l.substr(p + 1)); + } + this.options.transformTagName && (l = this.options.transformTagName(l)), i && (r = this.saveTextToParentTag(r, i, n)); + const c = n.substring(n.lastIndexOf(".") + 1); + if (l && this.options.unpairedTags.indexOf(l) !== -1) + throw new Error(`Unpaired tag can not be used as closing tag: `); + let h = 0; + c && this.options.unpairedTags.indexOf(c) !== -1 ? (h = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : h = n.lastIndexOf("."), n = n.substring(0, h), i = this.tagsNodeStack.pop(), r = "", s = a; + } else if (t[s + 1] === "?") { + let a = SOe(t, s, !1, "?>"); + if (!a) + throw new Error("Pi Tag is not closed."); + if (r = this.saveTextToParentTag(r, i, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) { + const l = new QW(a.tagName); + l.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (l[":@"] = this.buildAttributesMap(a.tagExp, n, a.tagName)), this.addChild(i, l, n); + } + s = a.closeIndex + 1; + } else if (t.substr(s + 1, 3) === "!--") { + const a = r6(t, "-->", s + 4, "Comment is not closed."); + if (this.options.commentPropName) { + const l = t.substring(s + 4, a - 2); + r = this.saveTextToParentTag(r, i, n), i.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]); + } + s = a; + } else if (t.substr(s + 1, 2) === "!D") { + const a = SOi(t, s); + this.docTypeEntities = a.entities, s = a.i; + } else if (t.substr(s + 1, 2) === "![") { + const a = r6(t, "]]>", s, "CDATA is not closed.") - 2, l = t.substring(s + 9, a); + if (r = this.saveTextToParentTag(r, i, n), this.options.cdataPropName) + i.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]); + else { + let c = this.parseTextData(l, i.tagname, n, !0, !1, !0); + c == null && (c = ""), i.add(this.options.textNodeName, c); + } + s = a + 2; + } else { + let a = SOe(t, s, this.options.removeNSPrefix), l = a.tagName; + const c = a.rawTagName; + let h = a.tagExp, p = a.attrExpPresent, y = a.closeIndex; + this.options.transformTagName && (l = this.options.transformTagName(l)), i && r && i.tagname !== "!xml" && (r = this.saveTextToParentTag(r, i, n, !1)); + const v = i; + if (v && this.options.unpairedTags.indexOf(v.tagname) !== -1 && (i = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), l !== e.tagname && (n += n ? "." + l : l), this.isItStopNode(this.options.stopNodes, n, l)) { + let x = ""; + if (h.length > 0 && h.lastIndexOf("/") === h.length - 1) + s = a.closeIndex; + else if (this.options.unpairedTags.indexOf(l) !== -1) + s = a.closeIndex; + else { + const P = this.readStopNodeData(t, c, y + 1); + if (!P) + throw new Error(`Unexpected end of ${c}`); + s = P.i, x = P.tagContent; + } + const I = new QW(l); + l !== h && p && (I[":@"] = this.buildAttributesMap(h, n, l)), x && (x = this.parseTextData(x, l, n, !0, p, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), I.add(this.options.textNodeName, x), this.addChild(i, I, n); + } else { + if (h.length > 0 && h.lastIndexOf("/") === h.length - 1) { + l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1), h = l) : h = h.substr(0, h.length - 1), this.options.transformTagName && (l = this.options.transformTagName(l)); + const x = new QW(l); + l !== h && p && (x[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(i, x, n), n = n.substr(0, n.lastIndexOf(".")); + } else { + const x = new QW(l); + this.tagsNodeStack.push(i), l !== h && p && (x[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(i, x, n), i = x; + } + r = "", s = y; + } + } + else + r += t[s]; + return e.child; +}; +function MOi(t, e, i) { + const r = this.options.updateTag(e.tagname, i, e[":@"]); + r === !1 || (typeof r == "string" && (e.tagname = r), t.addChild(e)); +} +const DOi = function(t) { + if (this.options.processEntities) { + for (let e in this.docTypeEntities) { + const i = this.docTypeEntities[e]; + t = t.replace(i.regx, i.val); + } + for (let e in this.lastEntities) { + const i = this.lastEntities[e]; + t = t.replace(i.regex, i.val); + } + if (this.options.htmlEntities) + for (let e in this.htmlEntities) { + const i = this.htmlEntities[e]; + t = t.replace(i.regex, i.val); + } + t = t.replace(this.ampEntity.regex, this.ampEntity.val); + } + return t; +}; +function FOi(t, e, i, r) { + return t && (r === void 0 && (r = Object.keys(e.child).length === 0), t = this.parseTextData( + t, + e.tagname, + i, + !1, + e[":@"] ? Object.keys(e[":@"]).length !== 0 : !1, + r + ), t !== void 0 && t !== "" && e.add(this.options.textNodeName, t), t = ""), t; +} +function LOi(t, e, i) { + const r = "*." + i; + for (const n in t) { + const s = t[n]; + if (r === s || e === s) + return !0; + } + return !1; +} +function NOi(t, e, i = ">") { + let r, n = ""; + for (let s = e; s < t.length; s++) { + let o = t[s]; + if (r) + o === r && (r = ""); + else if (o === '"' || o === "'") + r = o; + else if (o === i[0]) + if (i[1]) { + if (t[s + 1] === i[1]) + return { + data: n, + index: s + }; + } else + return { + data: n, + index: s + }; + else + o === " " && (o = " "); + n += o; + } +} +function r6(t, e, i, r) { + const n = t.indexOf(e, i); + if (n === -1) + throw new Error(r); + return n + e.length - 1; +} +function SOe(t, e, i, r = ">") { + const n = NOi(t, e + 1, r); + if (!n) + return; + let s = n.data; + const o = n.index, a = s.search(/\s/); + let l = s, c = !0; + a !== -1 && (l = s.substr(0, a).replace(/\s\s*$/, ""), s = s.substr(a + 1)); + const h = l; + if (i) { + const p = l.indexOf(":"); + p !== -1 && (l = l.substr(p + 1), c = l !== n.data.substr(p + 1)); + } + return { + tagName: l, + tagExp: s, + closeIndex: o, + attrExpPresent: c, + rawTagName: h + }; +} +function kOi(t, e, i) { + const r = i; + let n = 1; + for (; i < t.length; i++) + if (t[i] === "<") + if (t[i + 1] === "/") { + const s = r6(t, ">", i, `${e} is not closed`); + if (t.substring(i + 2, s).trim() === e && (n--, n === 0)) + return { + tagContent: t.substring(r, i), + i: s + }; + i = s; + } else if (t[i + 1] === "?") + i = r6(t, "?>", i + 1, "StopNode is not closed."); + else if (t.substr(i + 1, 3) === "!--") + i = r6(t, "-->", i + 3, "StopNode is not closed."); + else if (t.substr(i + 1, 2) === "![") + i = r6(t, "]]>", i, "StopNode is not closed.") - 2; + else { + const s = SOe(t, i, ">"); + s && ((s && s.tagName) === e && s.tagExp[s.tagExp.length - 1] !== "/" && n++, i = s.closeIndex); + } +} +function COe(t, e, i) { + if (e && typeof t == "string") { + const r = t.trim(); + return r === "true" ? !0 : r === "false" ? !1 : COi(t, i); + } else + return i$e.isExist(t) ? t : ""; +} +var $Oi = TOi, dCt = {}; +function BOi(t, e) { + return pCt(t, e); +} +function pCt(t, e, i) { + let r; + const n = {}; + for (let s = 0; s < t.length; s++) { + const o = t[s], a = VOi(o); + let l = ""; + if (i === void 0 ? l = a : l = i + "." + a, a === e.textNodeName) + r === void 0 ? r = o[a] : r += "" + o[a]; + else { + if (a === void 0) + continue; + if (o[a]) { + let c = pCt(o[a], e, l); + const h = GOi(c, e); + o[":@"] ? jOi(c, o[":@"], l, e) : Object.keys(c).length === 1 && c[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? c = c[e.textNodeName] : Object.keys(c).length === 0 && (e.alwaysCreateTextNode ? c[e.textNodeName] = "" : c = ""), n[a] !== void 0 && n.hasOwnProperty(a) ? (Array.isArray(n[a]) || (n[a] = [n[a]]), n[a].push(c)) : e.isArray(a, l, h) ? n[a] = [c] : n[a] = c; + } + } + } + return typeof r == "string" ? r.length > 0 && (n[e.textNodeName] = r) : r !== void 0 && (n[e.textNodeName] = r), n; +} +function VOi(t) { + const e = Object.keys(t); + for (let i = 0; i < e.length; i++) { + const r = e[i]; + if (r !== ":@") + return r; + } +} +function jOi(t, e, i, r) { + if (e) { + const n = Object.keys(e), s = n.length; + for (let o = 0; o < s; o++) { + const a = n[o]; + r.isArray(a, i + "." + a, !0, !0) ? t[a] = [e[a]] : t[a] = e[a]; + } + } +} +function GOi(t, e) { + const { textNodeName: i } = e, r = Object.keys(t).length; + return !!(r === 0 || r === 1 && (t[i] || typeof t[i] == "boolean" || t[i] === 0)); +} +dCt.prettify = BOi; +const { buildOptions: UOi } = t$e, zOi = $Oi, { prettify: HOi } = dCt, WOi = Q6e; +let qOi = class { + constructor(e) { + this.externalEntities = {}, this.options = UOi(e); + } + /** + * Parse XML dats to JS object + * @param {string|Buffer} xmlData + * @param {boolean|Object} validationOption + */ + parse(e, i) { + if (typeof e != "string") + if (e.toString) + e = e.toString(); + else + throw new Error("XML data is accepted in String or Bytes[] form."); + if (i) { + i === !0 && (i = {}); + const s = WOi.validate(e, i); + if (s !== !0) + throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`); + } + const r = new zOi(this.options); + r.addExternalEntities(this.externalEntities); + const n = r.parseXml(e); + return this.options.preserveOrder || n === void 0 ? n : HOi(n, this.options); + } + /** + * Add Entity which is not by default supported by this library + * @param {string} key + * @param {string} value + */ + addEntity(e, i) { + if (i.indexOf("&") !== -1) + throw new Error("Entity value can't have '&'"); + if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1) + throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); + if (i === "&") + throw new Error("An entity with value '&' is not permitted"); + this.externalEntities[e] = i; + } +}; +var YOi = qOi; +const XOi = ` +`; +function KOi(t, e) { + let i = ""; + return e.format && e.indentBy.length > 0 && (i = XOi), fCt(t, e, "", i); +} +function fCt(t, e, i, r) { + let n = "", s = !1; + for (let o = 0; o < t.length; o++) { + const a = t[o], l = JOi(a); + if (l === void 0) + continue; + let c = ""; + if (i.length === 0 ? c = l : c = `${i}.${l}`, l === e.textNodeName) { + let x = a[l]; + ZOi(c, e) || (x = e.tagValueProcessor(l, x), x = mCt(x, e)), s && (n += r), n += x, s = !1; + continue; + } else if (l === e.cdataPropName) { + s && (n += r), n += ``, s = !1; + continue; + } else if (l === e.commentPropName) { + n += r + ``, s = !0; + continue; + } else if (l[0] === "?") { + const x = HXe(a[":@"], e), I = l === "?xml" ? "" : r; + let P = a[l][0][e.textNodeName]; + P = P.length !== 0 ? " " + P : "", n += I + `<${l}${P}${x}?>`, s = !0; + continue; + } + let h = r; + h !== "" && (h += e.indentBy); + const p = HXe(a[":@"], e), y = r + `<${l}${p}`, v = fCt(a[l], e, c, h); + e.unpairedTags.indexOf(l) !== -1 ? e.suppressUnpairedNode ? n += y + ">" : n += y + "/>" : (!v || v.length === 0) && e.suppressEmptyNode ? n += y + "/>" : v && v.endsWith(">") ? n += y + `>${v}${r}` : (n += y + ">", v && r !== "" && (v.includes("/>") || v.includes("`), s = !0; + } + return n; +} +function JOi(t) { + const e = Object.keys(t); + for (let i = 0; i < e.length; i++) { + const r = e[i]; + if (t.hasOwnProperty(r) && r !== ":@") + return r; + } +} +function HXe(t, e) { + let i = ""; + if (t && !e.ignoreAttributes) + for (let r in t) { + if (!t.hasOwnProperty(r)) + continue; + let n = e.attributeValueProcessor(r, t[r]); + n = mCt(n, e), n === !0 && e.suppressBooleanAttributes ? i += ` ${r.substr(e.attributeNamePrefix.length)}` : i += ` ${r.substr(e.attributeNamePrefix.length)}="${n}"`; + } + return i; +} +function ZOi(t, e) { + t = t.substr(0, t.length - e.textNodeName.length - 1); + let i = t.substr(t.lastIndexOf(".") + 1); + for (let r in e.stopNodes) + if (e.stopNodes[r] === t || e.stopNodes[r] === "*." + i) + return !0; + return !1; +} +function mCt(t, e) { + if (t && t.length > 0 && e.processEntities) + for (let i = 0; i < e.entities.length; i++) { + const r = e.entities[i]; + t = t.replace(r.regex, r.val); + } + return t; +} +var QOi = KOi; +const e3i = QOi, t3i = { + attributeNamePrefix: "@_", + attributesGroupName: !1, + textNodeName: "#text", + ignoreAttributes: !0, + cdataPropName: !1, + format: !1, + indentBy: " ", + suppressEmptyNode: !1, + suppressUnpairedNode: !0, + suppressBooleanAttributes: !0, + tagValueProcessor: function(t, e) { + return e; + }, + attributeValueProcessor: function(t, e) { + return e; + }, + preserveOrder: !1, + commentPropName: !1, + unpairedTags: [], + entities: [ + { regex: new RegExp("&", "g"), val: "&" }, + //it must be on top + { regex: new RegExp(">", "g"), val: ">" }, + { regex: new RegExp("<", "g"), val: "<" }, + { regex: new RegExp("'", "g"), val: "'" }, + { regex: new RegExp('"', "g"), val: """ } + ], + processEntities: !0, + stopNodes: [], + // transformTagName: false, + // transformAttributeName: false, + oneListGroup: !1 +}; +function B4(t) { + this.options = Object.assign({}, t3i, t), this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + return !1; + } : (this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = n3i), this.processTextOrObjNode = i3i, this.options.format ? (this.indentate = r3i, this.tagEndChar = `> +`, this.newLine = ` +`) : (this.indentate = function() { + return ""; + }, this.tagEndChar = ">", this.newLine = ""); +} +B4.prototype.build = function(t) { + return this.options.preserveOrder ? e3i(t, this.options) : (Array.isArray(t) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t = { + [this.options.arrayNodeName]: t + }), this.j2x(t, 0).val); +}; +B4.prototype.j2x = function(t, e) { + let i = "", r = ""; + for (let n in t) + if (Object.prototype.hasOwnProperty.call(t, n)) + if (typeof t[n] > "u") + this.isAttribute(n) && (r += ""); + else if (t[n] === null) + this.isAttribute(n) ? r += "" : n[0] === "?" ? r += this.indentate(e) + "<" + n + "?" + this.tagEndChar : r += this.indentate(e) + "<" + n + "/" + this.tagEndChar; + else if (t[n] instanceof Date) + r += this.buildTextValNode(t[n], n, "", e); + else if (typeof t[n] != "object") { + const s = this.isAttribute(n); + if (s) + i += this.buildAttrPairStr(s, "" + t[n]); + else if (n === this.options.textNodeName) { + let o = this.options.tagValueProcessor(n, "" + t[n]); + r += this.replaceEntitiesValue(o); + } else + r += this.buildTextValNode(t[n], n, "", e); + } else if (Array.isArray(t[n])) { + const s = t[n].length; + let o = ""; + for (let a = 0; a < s; a++) { + const l = t[n][a]; + typeof l > "u" || (l === null ? n[0] === "?" ? r += this.indentate(e) + "<" + n + "?" + this.tagEndChar : r += this.indentate(e) + "<" + n + "/" + this.tagEndChar : typeof l == "object" ? this.options.oneListGroup ? o += this.j2x(l, e + 1).val : o += this.processTextOrObjNode(l, n, e) : o += this.buildTextValNode(l, n, "", e)); + } + this.options.oneListGroup && (o = this.buildObjectNode(o, n, "", e)), r += o; + } else if (this.options.attributesGroupName && n === this.options.attributesGroupName) { + const s = Object.keys(t[n]), o = s.length; + for (let a = 0; a < o; a++) + i += this.buildAttrPairStr(s[a], "" + t[n][s[a]]); + } else + r += this.processTextOrObjNode(t[n], n, e); + return { attrStr: i, val: r }; +}; +B4.prototype.buildAttrPairStr = function(t, e) { + return e = this.options.attributeValueProcessor(t, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + t : " " + t + '="' + e + '"'; +}; +function i3i(t, e, i) { + const r = this.j2x(t, i + 1); + return t[this.options.textNodeName] !== void 0 && Object.keys(t).length === 1 ? this.buildTextValNode(t[this.options.textNodeName], e, r.attrStr, i) : this.buildObjectNode(r.val, e, r.attrStr, i); +} +B4.prototype.buildObjectNode = function(t, e, i, r) { + if (t === "") + return e[0] === "?" ? this.indentate(r) + "<" + e + i + "?" + this.tagEndChar : this.indentate(r) + "<" + e + i + this.closeTag(e) + this.tagEndChar; + { + let n = "" + t + n : this.options.commentPropName !== !1 && e === this.options.commentPropName && s.length === 0 ? this.indentate(r) + `` + this.newLine : this.indentate(r) + "<" + e + i + s + this.tagEndChar + t + this.indentate(r) + n; + } +}; +B4.prototype.closeTag = function(t) { + let e = ""; + return this.options.unpairedTags.indexOf(t) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `>` + this.newLine; + if (this.options.commentPropName !== !1 && e === this.options.commentPropName) + return this.indentate(r) + `` + this.newLine; + if (e[0] === "?") + return this.indentate(r) + "<" + e + i + "?" + this.tagEndChar; + { + let n = this.options.tagValueProcessor(e, t); + return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(r) + "<" + e + i + this.closeTag(e) + this.tagEndChar : this.indentate(r) + "<" + e + i + ">" + n + " 0 && this.options.processEntities) + for (let e = 0; e < this.options.entities.length; e++) { + const i = this.options.entities[e]; + t = t.replace(i.regex, i.val); + } + return t; +}; +function r3i(t) { + return this.options.indentBy.repeat(t); +} +function n3i(t) { + return t.startsWith(this.options.attributeNamePrefix) && t !== this.options.textNodeName ? t.substr(this.attrPrefixLen) : !1; +} +var s3i = B4; +const o3i = Q6e, a3i = YOi, l3i = s3i; +var u3i = { + XMLParser: a3i, + XMLValidator: o3i, + XMLBuilder: l3i +}; +class c3i extends cf { + /** + * Will load a WFS 3 feature set and return as GeoJSON object. + * Data will be downloaded in batches (based on limit parameter) to + * avoid massive requests that may timeout. + * + * @param {string} url the current url to the wfs service. Should be a /collections/id/items/ endpoint with optional params after the question operator + * @param {number} [totalCount=-1] the total number of features available on that service. If not provided, the service will be interrogated for the count. + * @param {number} [offset=0] the feature index to start the querying from. default 0 + * @param {number} [limit=1000] the limit of how many results we want returned per server request. default 1000 + * @param {WFSData} [wfsData={ + * type: 'FeatureCollection', + * features: [] + * }] the resulting GeoJSON being populated as we receive layer information. Undefined for initial request. + * @param {boolean} [xyInAttribs=false] true if point co-ords should be copied to attribute values + * @returns {Promise} a promise resolving with the layer GeoJSON + * @memberof WFSServiceSource + */ + async loadWfsData(e, i = -1, r = 0, n = 1e3, s = { + type: "FeatureCollection", + features: [] + }, o = !1) { + let a = { + offset: r.toString(), + limit: n.toString() + }; + i === -1 && (a = { + resulttype: "hits" + }); + const c = new IQ(e).updateQuery(a), [h, p] = await ZF(dO.get(c)); + if (!p) + return console.error(`WFS data failed to load for ${e}`, h), Promise.reject(h); + const y = p.data; + if (i === -1) + return i = p.data.numberMatched, this.loadWfsData( + e, + i, + r, + n, + s, + o + ); + if (s.features = s.features.concat(y.features), y.features.length < i - r) { + const v = Math.min( + n, + i - r - y.features.length + ); + return this.loadWfsData( + c, + i, + y.features.length + r, + v, + s, + o + ); + } else + return o && s.features.length > 0 && s.features[0].geometry.type === Zp.POINT && s.features.forEach((v) => { + const x = v.geometry.coordinates; + v.properties.rvInternalCoordX = x[0], v.properties.rvInternalCoordY = x[1]; + }), s; + } + /** + * Provides list of spatial references that are encoded in [y,x] format. + * + * @returns array of wkids that have reversed axis + */ + reversedAxisWKIDs() { + return YPi; + } + // NOTE this function is currently used by the wizard only in RAMP2 + /** + * Fetch layer data from a WMS endpoint. This method will execute a WMS GetCapabilities + * request against the specified URL, it requests WMS 1.3 and it is capable of parsing + * 1.3 or 1.1.1 responses. It returns a promise which will resolve with basic layer + * metadata and querying information. + * + * metadata response format: + * { queryTypes: [mimeType(str)], + * layers: [ + * {name(str), desc(str), queryable(bool), layers:[recursive] } + * ] } + * + * @param {string} wmsEndpoint a URL pointing to a WMS server (it must not include a query string) + * @return {Promise} a promise resolving with a metadata object (as specified above) + */ + parseCapabilities(e) { + const i = () => { + let o = e; + if (e.indexOf("?") === -1) + o += "?service=WMS&request=GetCapabilities"; + else { + const a = new IQ(e.toUpperCase()); + "SERVICE" in a.queryMap || (o += "&service=WMS"), "REQUEST" in a.queryMap || (o += "&request=GetCapabilities"); + } + return ir(o, { + responseType: "xml" + }).then((a) => a.data); + }, r = new Promise((o) => { + i().then((a) => o(a)).catch(() => { + console.error( + "Get capabilities failed; trying the second time;" + ), o(i()); + }); + }), n = (o) => { + let a = o.Layer; + return a ? (Array.isArray(a) || (a = [a]), a.map((l) => { + const c = l.Name, h = l.Title; + let p = l.Style; + const y = [], v = {}; + return p && (Array.isArray(p) || (p = [p]), p.forEach((x) => { + const I = x.Name; + if (y.push(I), x.LegendURL) { + const F = x.LegendURL.OnlineResource["@_xlink:href"]; + v[I] = F.replaceAll( + "&", + "&" + ); + } + })), { + // typecast to string as number IDs need to be stringified in the wms sublayer config + // TODO: What if this ends up being null? Does layer explode? + // If yes, consider adding a warning or notification of some sort. + name: c?.toString() ?? null, + title: h, + queryable: l["@_queryable"] === "1", + layers: n(l), + allStyles: y, + styleToURL: v, + currentStyle: y[0] + }; + })) : []; + }, s = (o) => { + let a = o.Format; + return Array.isArray(a) || (a = [a]), a; + }; + return r.then((o) => { + if (!o) + return []; + const a = new XMLSerializer().serializeToString( + o + ), l = { + ignoreAttributes: !1 + // check for tag attributes + }, c = new u3i.XMLParser(l).parse(a); + if ("ServiceExceptionReport" in c) + return console.error(c.ServiceExceptionReport.ServiceException), []; + const h = c.WMS_Capabilities.Capability; + return { + layers: n(h), + queryTypes: s(h.Request.GetFeatureInfo) + }; + }); + } +} +class h3i extends cf { + files; + ogc; + constructor(e) { + super(e), this.files = new qPi(e), this.ogc = new c3i(e); + } + /** + * Will generate a RAMP Layer based on the supplied config object. + * + * @param {Object} config a valid layer configuration object + * @returns {LayerInstance} Layer in uninitialized load state + */ + createLayer(e) { + let i; + switch (e.layerType) { + case rn.FEATURE: + i = m3i; + break; + case rn.MAPIMAGE: + i = g3i; + break; + case rn.GRAPHIC: + i = vCt; + break; + case rn.TILE: + i = _Ct; + break; + case rn.WFS: + i = w3i; + break; + case rn.DATATABLE: + i = S3i; + break; + case rn.WMS: + i = b3i; + break; + case rn.GEOJSON: + i = d3i; + break; + case rn.CSV: + i = f3i; + break; + case rn.DATAJSON: + i = x3i; + break; + case rn.IMAGERY: + i = _3i; + break; + case rn.SHAPEFILE: + i = p3i; + break; + case rn.OSM: + i = v3i; + break; + default: + throw new Error("Unsupported Layer Type " + e.layerType); + } + return new i(e, this.$iApi); + } + /** + * Access an instantiated layer object. + * + * @param {string} layerId layer id or uid of the layer + * @returns {LayerInstance | undefined} The layer instance with the given id. Returns undefined is layer is not found. + */ + getLayer(e) { + let i; + const r = i1(this.$vApp.$pinia); + return i = r.getLayerByAny(e), i || (i = r.getLayerByUid(e)), i; + } + /** + * Get the current map stack position of a given map layer + * + * @param {string} layerId layer id or uid of the layer + * @returns {number | undefined} The layer position in the map stack. Undefined if a data layer or layer not found + */ + getLayerPosition(e) { + const i = this.getLayer(e); + if (i && i.mapLayer) { + const r = i.isSublayer ? i.parentLayer.id : i.id, n = this.layerOrderIds().findIndex( + (s) => s === r + ); + return n === -1 ? void 0 : n; + } else + return; + } + /** + * Return the Layer IDs of all registered map layers in the order they occupy, + * or will occupy, the map stack. + * @returns {Array} layer ids, from bottom to top + */ + layerOrderIds() { + return i1(this.$vApp.$pinia).mapOrder.slice(0) || []; + } + /** + * Return all registered layers. + * @returns {Array} all registered layers + */ + allLayers() { + return i1(this.$vApp.$pinia).layers || []; + } + /** + * Returns all layers that have initiated successfully and that have not errored. + * @returns {Array} all layers that have initiated and not errored + */ + allActiveLayers() { + return this.allLayers().filter( + (e) => e.layerState !== rp.ERROR && e.initiationState === Og.INITIATED + ); + } + /** + * Returns all map-based layers currently on the map. + * Result can be ordered in map stack order. Unordered is more performant. + * + * @param {boolean} [inMapOrder=true] if result array should be sorted by map order. + * @returns {Array} all layers on the map + */ + allLayersOnMap(e = !0) { + let i = this.allLayers().filter( + (r) => r.mapLayer && r.initiationState === Og.INITIATED + ); + if (e) { + const r = this.layerOrderIds(), n = new Map( + r.map((s, o) => [s, o]) + ); + i.sort((s, o) => n.get(s.id) - n.get(o.id)); + } + return i; + } + /** + * Returns all initialized data-based layers currently registered with the map. + * @returns {Array} all loaded data layers + */ + allDataLayers() { + return this.allLayers().filter( + (e) => !e.mapLayer && e.initiationState === Og.INITIATED + ); + } + /** + * Return all layers in an error state. + * @returns {Array} all errored layers + */ + allErrorLayers() { + return this.allLayers().filter((e) => e.layerState === rp.ERROR); + } + /** + * Returns all layers currently undergoing initiation process. + * @returns {Array} all initiating layers + */ + allInitiatingLayers() { + return this.allLayers().filter( + (e) => e.initiationState === Og.INITIATING + ); + } + /** + * Get controls and disabled controls configuration of the layer with the given id. + * + * @param {string} layerId layer id or uid of the layer + * @returns {Object | undefined} The layer's controls and disabled controls configuration. Returns undefined if layer is not found. + */ + getLayerControls(e) { + const i = this.getLayer(e); + if (!i) + return; + const r = i.config.controls?.slice() ?? [ + oa.BoundaryZoom, + oa.Datatable, + oa.Identify, + oa.Metadata, + oa.Opacity, + oa.Refresh, + oa.Reload, + oa.Remove, + oa.Settings, + oa.Symbology, + oa.Visibility + ], n = []; + return i.supportsFeatures || n.push(oa.Datatable), i.extent === void 0 && n.push(oa.BoundaryZoom), (i.config?.metadata || (i.isSublayer ? i.parentLayer?.config?.metadata : {}) || {}).url || n.push(oa.Metadata), !i.mapLayer && !i.config.controls?.includes(oa.Settings) && n.push(oa.Settings), n.forEach((o) => { + const a = r?.indexOf(o) ?? -1; + a !== -1 && r?.splice(a, 1); + }), { + controls: r, + disabledControls: i.config.disabledControls ?? [] + }; + } + /** + * Will fetch metadata about a layer service endpoint on an ArcGIS server + * + * @param url the server url of the layer + * @returns {Promise} resolves with relevant information about the layer service + */ + async loadLayerMetadata(e) { + if (!e.trim()) + throw new Error("url missing on layer server metadata request."); + const [i, r] = await ZF( + ir(e, { query: { f: "json" } }) + ); + if (!r) + throw console.error(`Service metadata load error: ${e}`, i), new Error(`Service metadata load error: ${e}`); + if (!r.data) + throw console.error(`Service metadata load error: ${e}`), new Error(`Service metadata load error: ${e}`); + const n = r.data, s = { + geometryType: el.NONE, + minScale: 0, + maxScale: 0, + canModifyLayer: !0, + extent: void 0, + defaultVisibility: !0, + fields: [], + displayField: "", + objectIdField: "", + renderer: void 0, + currentVersion: 0, + name: "", + dataFormat: Ey.UNKNOWN, + mapLayer: !0 + }; + if (s.name = n.name || "", s.currentVersion = n.currentVersion || -1, s.minScale = n.effectiveMinScale || n.minScale || 0, s.maxScale = n.effectiveMaxScale || n.maxScale || 0, s.extent = n.extent ? Rd.fromArcServer(n.extent, "layer_extent") : void 0, s.defaultVisibility = n.defaultVisibility ?? !0, s.canModifyLayer = n.canModifyLayer ?? !0, n.type === "Feature Layer" || n.type === "Table") { + if (s.dataFormat = Ey.ESRI_FEATURE, s.displayField = n.displayField || "", Array.isArray(n.fields)) { + const o = n.fields.map( + (l) => Uo.fromJSON(l) + ); + s.fields = o.map((l) => ({ + name: l.name, + alias: l.alias, + type: l.type, + length: l.length + })), o.every((l) => l.type === "oid" ? (s.objectIdField = l.name, !1) : !0) && (s.objectIdField = n.objectIdField || (() => (console.error( + `Encountered service with no OID defined: ${e}` + ), ""))()), n.type === "Feature Layer" ? (s.geometryType = this.$iApi.geo.geom.serverGeomTypeToRampGeomType( + n.geometryType + ), n?.drawingInfo?.renderer && (s.renderer = MF( + n.drawingInfo.renderer + ))) : s.mapLayer = !1; + } + } else + s.dataFormat = Ey.ESRI_RASTER; + return s; + } + /** + * Will fetch the feature count for an ArcGIS Server layer + * + * @param serviceUrl url of the layer to count + * @param permanentFilter optional filter to apply to the count + * @returns {Promise} that resolves with the feature count, -1 if error + */ + async loadFeatureCount(e, i = "") { + if (!e) + return console.error( + "A layer without a url attempted to run the server based feature count routine." + ), 0; + const r = { + query: { + f: "json", + where: i || "1=1", + // apparently the 1=1 is required to make the count call work on entire dataset + returnCountOnly: !0, + returnGeometry: !1 + } + }, [n, s] = await ZF( + ir(`${e}/query`, r) + ); + return s ? s.data ? Number.isInteger(s.data.count) ? s.data.count : (console.error( + `Funny result (${s.data.count}) during feature count: ${e}` + ), 0) : (console.error(`Unable to load feature count: ${e}`), 0) : (console.error( + `Feature count request unsuccessful: ${e}`, + n + ), 0); + } +} +class QQ extends cf { + config = {}; + /** + * ID of this layer. Also known as the layerId. + * + * @type {string} + * @memberof LayerInstance + */ + id; + /** + * Unique identifier for this layer. Randomly generated at runtime. + */ + uid; + /** + * The name of the layer. + */ + name; + /** + * State of the actual layer on the map, such as loading, loaded, error'd. + */ + layerState; + /** + * State of the initiation / termination process of the layer + */ + initiationState; + /** + * State of drawing / refreshing data for a layer + */ + drawState; + /** + * Index of the layer. Aligns to index of arcgis server, or defaults to 0 on other layers + */ + layerIdx; + /** + * Type of layer this is (describes the overall layer) + */ + layerType; + /** + * How the layer is instantiated in the map stack + */ + layerFormat; + /** + * The type of spatial data used to generate layer content + */ + dataFormat; + /** + * If the layer type can support an identify request + */ + supportsIdentify; + /** + * If the layer type can support Feature type requests and operations + */ + supportsFeatures; + /** + * If the layer type can exist on the map + */ + mapLayer; + /** + * Feature count + */ + featureCount; + /** + * Array of field definitions about the given layer's fields. Non-feature layers will have empty arrays. + */ + fields; + /** + * Comma delimited string of field names (or '*' for all). Useful for numerous ESRI api calls. Non-feature layers will return empty string; + */ + fieldList; + /** + * Field name that contains value considered the name of a feature. Not applicable for non-feature layers. + */ + nameField; + /** + * Field name that contains the object ID of a feature. Not applicable for non-feature layers. + */ + oidField; + /** + * Object that contains values for the expected draw/response time. + */ + expectedTime; + /** + * If the layer has Sublayers + */ + supportsSublayers; + /** + * If the layer is a Sublayer + */ + isSublayer; + /** + * Tracks if layer is removed from map. Is false during the period "before" the layer gets added to map. + */ + isRemoved; + /** + * If the layer was sourced from a file or a WFS source (which disconnects after load). + */ + isFile; + /** + * If the layer is non-interactive and only displays content on the map + */ + isCosmetic; + /** + * If the layer was added by user interaction during the session + */ + userAdded; + /** + * If the layer is set to participate in identify requests + */ + identify; + /** + * The type of logic used to identify items on the layer + */ + identifyMode; + /** + * If the layer should show hovertips on the map + */ + hovertips; + /** + * The geometry type of the layer. + */ + geomType; + /** + * Legend symbols of the layer + */ + legend; + /** + * How long layer can load for before error (milliseconds) + */ + maxLoadTime; + /** + * The internal ESRI API layer + */ + esriLayer; + /** + * The internal ESRI API sublayer. Valid only by sublayers + */ + esriSubLayer; + /** + * The internal ESRI API layer view + */ + esriView; + /** + * The extent of the layer on the map + */ + extent; + // layer extent + /** + * Indicates if the layer can be modified with filters. + */ + canModifyLayer; + _parentLayer; + _sublayers; + /** + * Creates an instance of LayerInstance. + * + * @param {string} id + * @param {InstanceAPI} iApi + * @memberof FixtureInstance + */ + constructor(e, i) { + super(i), this.config = e, this.id = "", this.uid = "", this.name = "error", this.layerState = rp.NEW, this.drawState = G_.NOT_LOADED, this.initiationState = Og.NEW, this.layerIdx = -1, this.layerFormat = kb.UNKNOWN, this.layerType = rn.UNKNOWN, this.dataFormat = Ey.UNKNOWN, this.supportsIdentify = !1, this.identifyMode = Xm.NONE, this.supportsFeatures = !1, this.mapLayer = !0, this.featureCount = 0, this.fields = [], this.fieldList = "", this.nameField = "", this.oidField = "", this.supportsSublayers = !1, this.isSublayer = !1, this.isRemoved = !1, this.isFile = !1, this.isCosmetic = !1, this.userAdded = !1, this.identify = !1, this.hovertips = !1, this.geomType = el.UNKNOWN, this.legend = [], this._sublayers = [], this.expectedTime = { draw: 0, load: 0 }, this.maxLoadTime = 0, this.canModifyLayer = !0; + } + /** + * Sets up the internal layer object (ESRI) and initiates the loading process. + * The promise returned resolves when the object exists (i.e. .esriLayer is populated). + * This means the layer can be added to the map. + */ + async initiate() { + return Promise.resolve(); + } + /** + * Resets the layer class to the state it was in "pre-initialize". Implementers can decide if they want + * to retain any state (e.g. UIDs/layerTree would be a good idea). + * Also an appropriate function to remove any event listeners/triggers. + * This would be called in situations like a layer getting deleted, or in a layer reload (initialize would be called again afterwards). + * Note this does not remove any layers from the map stack, that must be done by the caller. + */ + async terminate() { + return Promise.resolve(); + } + /** + * Attempts to reload the internal layer object (ESRI). + * Effectively doing a terminate then initiate, and removing/re-adding layer to the map. + */ + async reload() { + return Promise.resolve(); + } + /** + * Provides a promise that resolves when the layer has finished loading. If accessing layer properties that + * depend on the layer being loaded, wait on this promise before accessing them. + * + * @method loadPromise + * @returns {Promise} resolves when the layer has finished loading + */ + loadPromise() { + return Promise.resolve(); + } + /** + * Indicates if the layer is in a state that is makes sense to interact with. + * I.e. False if layer has not done it's initial load, or is in error state. + * + * @returns {Boolean} true if layer is in an interactive state + */ + get isLoaded() { + return !1; + } + /** + * Indicates if the Esri map layer or data layer equivalent exists. + */ + get layerExists() { + return !1; + } + /** + * Provides a tree structure describing the layer and any sublayers, + * including uid values. Should only be called after loadPromise resolves. + * + * @method getLayerTree + * @returns {TreeNode} the root of the layer tree + */ + getLayerTree() { + return new $de( + 0, + "Fake tree", + "getLayerTree() was not implemented in layer" + ); + } + /** + * Provides the spatial reference of the layer + * + * @returns {SpatialReference} the layer spatial reference in RAMP API format + */ + getSR() { + return pl.latLongSR(); + } + /** + * Returns the visibility of the layer. + * + * @returns {Boolean} visibility of the layer + */ + get visibility() { + return !1; + } + /** + * Applies visibility to layer. + * + * @param {Boolean} value the new visibility setting + */ + set visibility(e) { + } + /** + * Returns the opacity of the layer. + * + * @returns {Boolean} opacity of the layer + */ + get opacity() { + return 0; + } + /** + * Applies opacity to layer. + * + * @param {Boolean} value the new opacity setting + */ + set opacity(e) { + } + /** + * Returns the scale set (min and max visible scale) of the layer. + * + * @returns {ScaleSet} scale set of the layer + */ + get scaleSet() { + return new rbt(); + } + /** + * Set the scale set (min and max visible scale) of the layer. + * + * @param {ScaleSet} scaleSet the new scale set of the layer + */ + set scaleSet(e) { + } + /** + * Indicates if the layer is not in a visible scale range. + * + * @function isOffscale + * @param {Integer} [testScale] optional scale to test against. if not provided, current map scale is used. + * @returns {Boolean} true if the layer is outside of a visible scale range + */ + isOffscale(e = void 0) { + return !1; + } + /** + * Cause the map to zoom to a scale level where the layer is visible. + * + * @returns {Promise} resolves when map has finished zooming + */ + zoomToVisibleScale() { + return Promise.resolve(); + } + /** + * Cause the map to zoom to this layer's boundary extent + * + * @returns {Promise} resolves when map has finished zooming + */ + zoomToLayerBoundary() { + return Promise.resolve(); + } + /** + * Get the click tolerance in pixels for this layer + * + * @returns {number} the mouse tolerance of this layer + */ + get mouseTolerance() { + return 0; + } + /** + * Set the mouse tolerance for this layer in pixels + * + * @param {Integer} tolerance the new mouse tolerance + */ + set mouseTolerance(e) { + } + /** + * Get the touch tolerance in pixels for this layer + * + * @returns {number} the touch tolerance of this layer + */ + get touchTolerance() { + return 0; + } + /** + * Set the touch tolerance in pixels for this layer + * + * @param {Integer} tolerance the new touch tolerance + */ + set touchTolerance(e) { + } + /** + * Return the draw order for the layer, if applicable + */ + get drawOrder() { + return []; + } + /** + * Indicates if layer should participate in an identify request. + */ + canIdentify() { + return !1; + } + /** + * Baseline identify function for layers that do not support identify. + * Will return an empty result. Layers that support identify should override this method. + * Note: implementations that return real data must make that data reactive() + * + * @param options not used, present for nice signature of overrided function + * @returns {Array} an empty result set + */ + runIdentify(e) { + return []; + } + /** + * Invokes the process to get the full set of attribute values for the layer. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of attribute values + */ + getAttributes() { + return Promise.resolve({ + features: [], + oidIndex: {} + }); + } + /** + * Requests that an attribute load request be aborted. Useful when encountering a massive dataset or a runaway process. + * + */ + abortAttributeLoad() { + } + /** + * Requests that any downloaded attribute sets or cached geometry be removed from memory. The next requests will pull from the server again. + * + */ + clearFeatureCache() { + } + /** + * The number of attributes currently downloaded (will update as download progresses) + * @returns current download count + */ + downloadedAttributes() { + return 0; + } + /** + * Indicates if the attribute load has been aborted. + * @returns boolean if the process has been stopped + */ + attribLoadAborted() { + return !1; + } + // formerly known as getFormattedAttributes + /** + * Invokes the process to get the full set of attribute values for the layer, + * formatted in a tabular format. Additional data properties are also included. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of tabular attribute values + */ + getTabularAttributes() { + return Promise.resolve({ + columns: [], + rows: [], + fields: [], + oidField: "error" + }); + } + /** + * Gets information on a graphic in the most efficient way possible. Options object properties: + * - getGeom ; a boolean to indicate if the result should include graphic geometry + * - getAttribs ; a boolean to indicate if the result should include graphic attributes + * + * @param {Integer} objectId the object id of the graphic to find + * @param {Object} options options object for the request, see above + * @returns {Promise} resolves with a Graphic containing the requested information + */ + getGraphic(e, i) { + return Promise.resolve(new bx(new g8())); + } + /** + * Gets the icon for a specific feature, as an SVG string. + * + * @param {Integer} objectId the object id of the feature to find + * @returns {Promise} resolves with an svg string encoding of the icon + */ + getIcon(e) { + return Promise.resolve(""); + } + /** + * Returns the value of a named SQL filter for the layer. + * + * @param {String} filterKey the filter key / named filter to view + * @returns {String} the value of the where clause for the filter. Empty string if not defined. + */ + getSqlFilter(e) { + return ""; + } + /** + * Applies an SQL filter to the layer. Will overwrite any existing filter for the given key. + * Use `1=2` for a "hide all" where clause. + * + * @param {String} filterKey the filter key / named filter to apply the SQL to + * @param {String} whereClause the WHERE clause of the filter + */ + setSqlFilter(e, i) { + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + } + /** + * Gets array of object ids that currently pass any filters for the layer + * + * @param {Array} [exclusions] list of any filters keys to exclude from the result. omission includes all filters + * @param {Extent} [extent] if provided, the result list will only include features intersecting the extent + * @returns {Promise} resolves with array of object ids that pass the filter. if no filters are active, resolves with undefined. + */ + getFilterOIDs(e = [], i = void 0) { + return Promise.resolve(void 0); + } + /** + * Gets the extent where the provided object id is on the map. + * Can only be used on feature layers. Not applicable to point geometry. + * + * @param objectId the object id to query + * @returns {Promise} resolves with the extent where the object id is present + */ + getGraphicExtent(e) { + return Promise.resolve(Rd.fromParams("fake", 0, 0, 0, 0)); + } + /** + * Get the parent layer for this layer + * Only supported for sublayers + * + * @returns {LayerInstance | undefined} the parent layer of this layer + */ + get parentLayer() { + if (this.isSublayer) + return this._parentLayer; + throw new Error( + "Attempted to get parent layer of a non-sublayer object" + ); + } + /** + * Set the parent layer for this layer + * Only supported for sublayers + * + * @param {LayerInstance | undefined} layer the new parent layer for this layer + */ + set parentLayer(e) { + if (!this.isSublayer && e) + throw new Error( + "Attempted to set parent layer for a non-sublayer object" + ); + this._parentLayer = e; + } + /** + * Get the sublayers for this layer + * + * @returns {Array} the sublayers of this layer + */ + get sublayers() { + return this._sublayers; + } + /** + * Initiates actions after layer load. + * Should generally only be called internally by the RAMP core. + */ + onLoad() { + } + /** + * Initiates actions after layer load error. + * Should generally only be called internally by the RAMP core. + */ + onError() { + } + /** + * Updates layer load state and raises events. + * Should generally only be called internally by the RAMP core. + */ + updateLayerState(e) { + } + /** + * Updates layer draw state and raises events. + * Should generally only be called internally by the RAMP core. + */ + updateDrawState(e) { + } + /** + * Updates layer layer state and raises events. + * Should generally only be called internally by the RAMP core. + */ + updateInitiationState(e) { + } + /** + * Finds an sublayer index corresponding to the given uid. + * -1 indicates the uid targets the root layer + * + * @private + * @param {string} uid the uid we want the index for + * @returns {number} the integer index of the uid + */ + uidToIdx(e) { + if (e === this.uid) + return -1; + { + const i = this._sublayers.findIndex( + (r) => r?.uid === e + ); + if (i === -1) + throw new Error( + `Attempt to access non-existing unique id [layerid ${this.id}, uid ${e}]` + ); + return i; + } + } + /** + * Attempts to get an sublayer based on the index or uid provided. + * + * @private + * @param {number | string} layerIdx the uid or numeric index of the item we are interested in + * @returns {LayerInstance | undefined} the matching feature class object, or undefined if the root was requested + */ + getSublayer(e) { + if (!this.supportsSublayers) { + console.warn( + `Attempted to call getSublayer on a layer (layer id: ${this.id}) that does not support FCs` + ); + return; + } + let i; + if (typeof e == "string" ? i = this.uidToIdx(e) : i = e, this._sublayers[i] === void 0) + throw new Error( + `Attempt to access non-existing layer index [layerid ${this.id}, lookup value ${e}]` + ); + return this._sublayers[i]; + } + /** + * Check if layer controls is available on this layer. + * + * @param {LayerControl} control the layer control to check + * @returns {boolean} Indicates if the given control is enabled on this layer + */ + controlAvailable(e) { + const i = this.$iApi.geo.layer.getLayerControls(this.id); + return i?.disabledControls?.includes(e) ? !1 : i?.controls.includes(e) ?? !1; + } +} +class gCt extends QQ { + // common layer properties + timers; + origRampConfig; + loadDefProm; + // a deferred promise that resolves when layer is fully ready and safe to use. for convenience of caller + loadPromFulfilled; + // a boolean to track whether the promise has fulfilled or not + layerTree; + // ----------- LAYER CONSTRUCTION AND INITIALIZAION ----------- + constructor(e, i) { + super(e, i), this.name = e.name || "", this.geomType = el.NONE, this.dataFormat = Ey.UNKNOWN, this.layerType = rn.UNKNOWN, this.layerFormat = kb.UNKNOWN, this.expectedTime.draw = e.expectedDrawTime ?? 1e4, this.expectedTime.load = e.expectedLoadTime ?? 4e3, this.timers = { + draw: void 0, + load: void 0 + }, this.origRampConfig = e, this.id = e.id || "", this.uid = this.$iApi.geo.shared.generateUUID(), this.isCosmetic = !1, this.isRemoved = !1, this.isSublayer = !1, this.supportsIdentify = !1, this.mapLayer = !0, this.identifyMode = Xm.NONE, this.supportsFeatures = !1, this.hovertips = !1, this.supportsSublayers = !1, this.isFile = !1, this.layerState = rp.NEW, this.initiationState = Og.NEW, this.drawState = G_.NOT_LOADED, this.loadDefProm = new vm(), this.loadPromFulfilled = !1, this.layerTree = new $de(0, this.uid, this.name, !0), this.maxLoadTime = e.maxLoadTime ?? 2e4; + } + updateInitiationState(e) { + this.initiationState = e, this.$iApi.event.emit(an.LAYER_INITIATIONSTATECHANGE, { + state: e, + layer: this + }); + } + updateLayerState(e) { + this.layerState = e, this.$iApi.event.emit(an.LAYER_LAYERSTATECHANGE, { + state: e, + layer: this + }); + } + updateDrawState(e) { + this.drawState = e, e === G_.REFRESH ? this.startTimer( + "draw" + /* DRAW */ + ) : e === G_.UP_TO_DATE && this.stopTimer( + "draw" + /* DRAW */ + ), this.$iApi.event.emit(an.LAYER_DRAWSTATECHANGE, { + state: e, + layer: this + }); + } + // need this so initiate encapsulates the entire initiation process regardless of which inherited layer type is being initiated + async initiate() { + this.updateInitiationState(Og.INITIATING), this.startTimer( + "load" + /* LOAD */ + ); + const [e] = await ZF(this.onInitiate()); + this.drawState !== G_.UP_TO_DATE && this.startTimer( + "draw" + /* DRAW */ + ), e && (console.error(e.message), this.onError()), this.updateInitiationState(Og.INITIATED); + } + async onInitiate() { + if (this.isSublayer) + return console.warn("Attempted to initiate a sublayer as a CommonLayer"), Promise.resolve(); + this.initiationState === Og.INITIATED && console.error( + `Encountered layer initialize while already initiated, layer id ${this.id}` + ); + } + async terminate() { + this.updateInitiationState(Og.TERMINATING), await Promise.all(this.sublayers.map((e) => e.terminate())), this.loadDefProm = new vm(), this.loadPromFulfilled = !1, this.updateLayerState(rp.NEW), this.updateDrawState(G_.NOT_LOADED), this.updateInitiationState(Og.TERMINATED); + } + // ----------- LAYER LOAD ----------- + // When esri layer or data layer loads, this will perform any additional layer setup. + // The layer status will be set to loaded once everything has finished. + onLoad() { + let e = !1; + const i = setTimeout(() => { + this.maxLoadTime && (e = !0, this.onError()); + }, this.maxLoadTime); + try { + const r = this.onLoadActions(); + Promise.all(r).then(() => { + clearTimeout(i), e ? this.visibility = !1 : (this.loadPromFulfilled && (this.loadDefProm = new vm()), this.loadDefProm.resolveMe(), this.loadPromFulfilled = !0, this.stopTimer( + "load" + /* LOAD */ + ), this.sublayers.forEach((n) => n.onLoad()), this.updateLayerState(rp.LOADED)); + }).catch(() => { + clearTimeout(i), this.onError(); + }); + } catch (r) { + console.error("Encountered error on layer load: ", r), clearTimeout(i), this.onError(); + } + } + // TODO what happens if the error state is hit after the layer is loaded? + // Probably ok (rejecting a resolved promise that nobody is listening for). + // Putting the layer in error status is what is important. + // when esri layer load errors + onError() { + this.loadPromFulfilled && (this.loadDefProm = new vm()), this.loadDefProm.rejectMe(), this.loadPromFulfilled = !0, this.sublayers.forEach((e) => e.onError()), this.$iApi.notify.show( + Mv.ERROR, + this.$iApi.$i18n.t("layer.error", { + id: this.id + }) + ), this.stopTimer( + "draw" + /* DRAW */ + ), this.stopTimer( + "load" + /* LOAD */ + ), this.updateLayerState(rp.ERROR); + } + // performs setup on the layer that needs to occur after the esri layer + // exists, but before we mark the layer as loaded. Any async tasks must + // include their promise in the return array. + onLoadActions() { + return []; + } + /** + * Provides a promise that resolves when the layer has finished loading. If accessing layer properties that + * depend on the layer being loaded, wait on this promise before accessing them. + * + * @method loadPromise + * @returns {Promise} resolves when the layer has finished loading + */ + loadPromise() { + return this.loadDefProm.getPromise(); + } + /** + * Indicates if the layer is in a state that is makes sense to interact with. + * I.e. False if layer has not done it's initial load, or is in error state. + * Acts as a handy shortcut to inspecting the layerState. + * + * @method isLoaded + * @returns {Boolean} true if layer is loaded + */ + get isLoaded() { + return this.layerState === rp.LOADED; + } + // ----------- LAYER MANAGEMENT ----------- + /** + * Indicates if layer should participate in an identify request. + */ + canIdentify() { + return this.supportsIdentify && this.isLoaded && this.visibility && this.identify && !this.scaleSet.isOffScale(this.$iApi.geo.map.getScale()).offScale; + } + /** + * Provides a tree structure describing the layer and any sublayers, + * including uid values. Should only be called after loadPromise resolves. + * + * @method getLayerTree + * @returns {TreeNode} the root of the layer tree + */ + getLayerTree() { + return this.layerTree; + } + // ----------- STUB METHODS ----------- + // these are here to provide a consistant method interface when calling methods are + // dealing with vars typed as BaseLayer. Layer classes that actually use these + // methods will override the stubs. + stubError() { + throw new Error( + `Attempted to use a method not valid for ${this.layerType}` + ); + } + /** + * Invokes the process to get the full set of attribute values for the layer. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of attribute values + */ + getAttributes() { + return this.stubError(), Promise.resolve({ + features: [], + oidIndex: {} + }); + } + /** + * Requests that an attribute load request be aborted. Useful when encountering a massive dataset or a runaway process. + * + */ + abortAttributeLoad() { + this.stubError(); + } + /** + * Requests that any downloaded attribute sets or cached geometry be removed from memory. The next requests will pull from the server again. + * + */ + clearFeatureCache() { + this.stubError(); + } + // formerly known as getFormattedAttributes + /** + * Invokes the process to get the full set of attribute values for the layer, + * formatted in a tabular format. Additional data properties are also included. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of tabular attribute values + */ + getTabularAttributes() { + return this.stubError(), Promise.resolve({ + columns: [], + rows: [], + fields: [], + oidField: "error" + }); + } + /** + * Gets information on a graphic in the most efficient way possible. Options object properties: + * - getGeom ; a boolean to indicate if the result should include graphic geometry + * - getAttribs ; a boolean to indicate if the result should include graphic attributes + * - getStyle ; a boolean to indicate if the result should include symbol styling information + * + * @param {Integer} objectId the object id of the graphic to find + * @param {Object} options options object for the request, see above + * @returns {Promise} resolves with a Graphic containing the requested information + */ + getGraphic(e, i) { + return this.stubError(), Promise.resolve(new bx(new g8())); + } + /** + * Gets the icon for a specific feature, as an SVG string. + * + * @param {Integer} objectId the object id of the feature to find + * @returns {Promise} resolves with an svg string encoding of the icon + */ + getIcon(e) { + return this.stubError(), Promise.resolve(""); + } + /** + * Returns the value of a named SQL filter on a layer. + * + * @param {String} filterKey the filter key / named filter to view + * @returns {String} the value of the where clause for the filter. Empty string if not defined. + */ + getSqlFilter(e) { + return this.stubError(), ""; + } + /** + * Applies an SQL filter to the layer. Will overwrite any existing filter for the given key. + * Use `1=2` for a "hide all" where clause. + * + * @param {String} filterKey the filter key / named filter to apply the SQL to + * @param {String} whereClause the WHERE clause of the filter + */ + setSqlFilter(e, i) { + this.stubError(); + } + /** + * Gets array of object ids that currently pass any filters for the layer + * + * @param {Array} [exclusions] list of any filters keys to exclude from the result. omission includes all filters + * @param {Extent} [extent] if provided, the result list will only include features intersecting the extent + * @returns {Promise} resolves with array of object ids that pass the filter. if no filters are active, resolves with undefined. + */ + getFilterOIDs(e = [], i = void 0) { + return this.stubError(), Promise.resolve(void 0); + } + /** + * Gets the extent where the provided object id is on the map. + * Can only be used on feature layers with multipoint, polyline, polygon geometry. + * + * @param objectId the object id to query + * @returns {Promise} resolves with the extent where the object id is present + */ + getGraphicExtent(e) { + return this.stubError(), Promise.resolve(Rd.fromParams("fake", 0, 0, 0, 0)); + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + this.stubError(); + } + /** + * Add a WMS layer parameter, maybe even refresh the layer + * + * @function setCustomParameter + * @param {String} key name of the key to be created or updated + * @param {String} value value of the key + * @param {Boolean} forceRefresh show the new fancy version of the layer or not + */ + setCustomParameter(e, i, r = !0) { + this.stubError(); + } + /** + * Start the draw/load timer for the layer, after which is a slow to load/draw notification is shown. + * @param type the type of timer to start (load or draw) + */ + startTimer(e) { + this.stopTimer(e), this.expectedTime[e] > 0 && (this.timers[e] = setTimeout( + () => this.$iApi.notify.show( + Mv.WARNING, + // layer.longload or layer.longdraw + this.$iApi.$i18n.t(`layer.long${e}`, { + id: this.name || this.id + }) + ), + this.expectedTime[e] + )); + } + /** + * Stop the draw/load timer for the layer, if it was started. + * @param type the type of timer to stop (load or draw) + */ + stopTimer(e) { + this.timers[e] && clearTimeout(this.timers[e]); + } +} +class w8 extends gCt { + // common layer properties + _serverVisibility; + _scaleSet; + _mouseTolerance; + _touchTolerance; + _drawOrder; + // used to manage debouncing when applying filter updates against a layer. Private! but needs to be seen by FCs. + _lastFilterUpdate = ""; + viewDefProm; + // a deferred promise that resolves when a layer view has been created on the map. helps bridge the view handler with the layer load handler + esriWatches; + // ----------- LAYER CONSTRUCTION AND INITIALIZAION ----------- + constructor(e, i) { + super(e, i), this._scaleSet = new rbt(), this._mouseTolerance = e.mouseTolerance != null ? e.mouseTolerance : 5, this._touchTolerance = e.touchTolerance != null ? e.touchTolerance : 15, this._drawOrder = [], this._serverVisibility = void 0, this.isCosmetic = e.cosmetic || !1, this.extent = e.extent ? Rd.fromConfig(`${this.id}_extent`, e.extent) : void 0, this.viewDefProm = new vm(), this.esriWatches = []; + } + noLayerErr() { + console.error( + "Attempted to manipulate the layer but no layer found. Likely .initiate() was not finished or failed." + ), console.trace(); + } + async onInitiate() { + if (await super.onInitiate(), !this.esriLayer) { + this.noLayerErr(); + return; + } + this.esriWatches.push( + this.esriLayer.watch("visible", (e) => { + this.$iApi.event.emit(an.LAYER_VISIBILITYCHANGE, { + visibility: e, + layer: this + }); + }) + ), this.esriWatches.push( + this.esriLayer.watch("opacity", (e) => { + this.$iApi.event.emit(an.LAYER_OPACITYCHANGE, { + opacity: e, + layer: this + }); + }) + ), this.esriWatches.push( + this.esriLayer.watch("loadStatus", (e) => { + const i = { + "not-loaded": rp.LOADING, + loading: rp.LOADING, + loaded: rp.LOADED, + failed: rp.ERROR + }; + e === "loaded" ? this.onLoad() : e === "failed" ? this.onError() : this.updateLayerState(i[e]); + }) + ), this.esriLayer.on( + "layerview-create", + (e) => { + this.esriView = e.layerView, this.esriWatches.push( + e.layerView.watch("updating", (i) => { + this.updateDrawState( + i ? G_.REFRESH : G_.UP_TO_DATE + ); + }) + ), this.viewDefProm.resolveMe(); + } + ), this.sublayers.forEach((e) => e.initiate()); + } + async terminate() { + await super.terminate(), this.viewDefProm = new vm(), this.esriWatches.forEach((e) => e.remove()), this.esriWatches = []; + } + async reload() { + if (!this.$iApi.geo.map.esriMap) { + console.error("Attempted layer reload when no map exists"); + return; + } + if (this.initiationState === Og.INITIATED && (this.esriLayer && this.$iApi.geo.map.esriMap.layers.findIndex( + (i) => i.id === this.id + ) > -1 && this.$iApi.geo.map.esriMap.layers.remove(this.esriLayer), this.$iApi.event.emit(an.LAYER_RELOAD_START, this), this.sublayers.forEach( + (e) => this.$iApi.event.emit(an.LAYER_RELOAD_START, e) + ), await this.terminate()), await this.initiate(), !this.esriLayer) { + console.error("ESRI layer failed to re-create during reload."); + return; + } + this.$iApi.geo.map.insertToEsriMap(this), this.$iApi.event.emit(an.LAYER_RELOAD_END, this), this.sublayers.forEach( + (e) => this.$iApi.event.emit(an.LAYER_RELOAD_END, e) + ); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return { + id: e.id, + url: e.url, + opacity: e?.state?.opacity ?? 1, + visible: e?.state?.visibility ?? !0 + }; + } + // ----------- LAYER LOAD ----------- + // performs setup on the layer that needs to occur after the esri layer + // exists, but before we mark the layer as loaded. Any async tasks must + // include their promise in the return array. + onLoadActions() { + const e = super.onLoadActions(); + this.name || (this.name = this.esriLayer?.title || this.id), this.isCosmetic || (this.identify = this.config.state?.identify ?? this.supportsIdentify); + const i = this.$iApi.geo.proj.checkProj(this.getSR()).then((r) => r ? Promise.resolve() : Promise.reject()); + return e.push(i), e; + } + // ----------- LAYER MANAGEMENT ----------- + /** + * Wraps an error test for when someone calls a map dependent function too early + * @private + */ + mapCheck() { + return this.$iApi.geo.map.created ? !0 : (console.error( + "Attempting to use map-dependent logic before the layer has been added to the map" + ), console.trace(), !1); + } + /** + * Returns the scale set (min and max visible scale) of the layer. + * + * @returns {ScaleSet} scale set of the layer + */ + get scaleSet() { + return this._scaleSet; + } + /** + * Set the scale set (min and max visible scale) of the layer. + * + * @param {ScaleSet} scaleSet the new scale set of the layer + */ + set scaleSet(e) { + this._scaleSet = e; + } + /** + * Indicates if the layer is not in a visible scale range. + * + * @function isOffscale + * @param {Integer} [testScale] optional scale to test against. if not provided, current map scale is used. + * @returns {Boolean} true if the layer is outside of a visible scale range + */ + isOffscale(e = void 0) { + let i; + if (typeof e > "u") + if (this.mapCheck()) + i = this.$iApi.geo.map.getScale(); + else + return !1; + else + i = e; + return this.scaleSet.isOffScale(i).offScale; + } + /** + * Cause the map to zoom to a scale level where the layer is visible. + * + * @returns {Promise} resolves when map has finished zooming + */ + zoomToVisibleScale() { + return this.mapCheck() ? this.$iApi.geo.map.zoomToVisibleScale(this.scaleSet) : Promise.resolve(); + } + /** + * Cause the map to zoom to this layer's boundary extent + * + * @returns {Promise} resolves when map has finished zooming + */ + zoomToLayerBoundary() { + return this.extent ? this.mapCheck() ? this.$iApi.geo.map.zoomMapTo(this.extent) : Promise.resolve() : (console.error( + `Attempted to zoom to boundary of a layer with no extent (Layer Id: ${this.id})` + ), Promise.resolve()); + } + /** + * Get the mouse tolerance in pixels for this layer + * + * @returns {number} the mouse tolerance of this layer + */ + get mouseTolerance() { + return this._mouseTolerance; + } + /** + * Set the mouse tolerance for this layer in pixels + * + * @param {number} tolerance the new mouse tolerance + */ + set mouseTolerance(e) { + if (!this.supportsIdentify) { + console.warn( + "Attempted to set click tolerance on a layer that doesn't support identify" + ); + return; + } + if (e < 0) { + console.error("Attempted to set a negative click tolerance"); + return; + } + this._mouseTolerance = e; + } + /** + * Get the touch tolerance in pixels for this layer + * + * @returns {number} the touch tolerance of this layer + */ + get touchTolerance() { + return this._touchTolerance; + } + /** + * Set the touch tolerance in pixels for this layer + * + * @param {number} tolerance the new touch tolerance + */ + set touchTolerance(e) { + if (!this.supportsIdentify) { + console.warn( + "Attempted to set touch tolerance on a layer that doesn't support identify" + ); + return; + } + if (e < 0) { + console.error("Attempted to set a negative touch tolerance"); + return; + } + this._touchTolerance = e; + } + /** + * Indicates if the Esri map layer exists + */ + get layerExists() { + return !!this.esriLayer; + } + /** + * Returns an array describing the draw order of features. Raster layers will have empty arrays + */ + get drawOrder() { + return this._drawOrder; + } + /** + * Returns the visibility of the layer. + * + * @returns {Boolean} visibility of the layer + */ + get visibility() { + return this.esriLayer ? this.esriLayer.visible : (this.noLayerErr(), !1); + } + /** + * Applies visibility to layer. + * + * @param {Boolean} value the new visibility setting + */ + set visibility(e) { + this.esriLayer ? this.esriLayer.visible = e : this.noLayerErr(); + } + /** + * Checks the visibility of the sublayers + * If all sublayers are invisible, then this layer is also set to invisible + * + * @function checkVisibility + */ + checkVisibility() { + this.supportsSublayers && (this.visibility = this.sublayers.some( + (e) => e.visibility + )); + } + /** + * Returns the opacity of the layer. + * + * @returns {number} opacity of the layer (range between 0 and 1) + */ + get opacity() { + return this.esriLayer ? this.esriLayer.opacity : (this.noLayerErr(), 0); + } + /** + * Applies opacity to layer. + * + * @param {number} value the new opacity setting (range between 0 and 1) + */ + set opacity(e) { + this.esriLayer ? this.esriLayer.opacity = e : this.noLayerErr(); + } + /** + * Provides the spatial reference of the layer + * + * @returns {SpatialReference} the layer spatial reference in RAMP API format + */ + getSR() { + return this.esriLayer ? pl.fromESRI( + this.esriLayer.spatialReference + ) : (this.noLayerErr(), pl.latLongSR()); + } +} +class r$e extends w8 { + attribs; + renderer; + serviceUrl; + canModifyLayer; + filter; + constructor(e, i) { + super(e, i), this.supportsIdentify = !0, this.geomType = el.UNKNOWN, this.serviceUrl = "", this.fieldList = "", this.canModifyLayer = !0, this.filter = new nbt( + e.permanentFilteredQuery || "", + e.initialFilteredQuery || "" + ), this.hovertips = e.state?.hovertips ?? !0, this.attribs = new wCt(); + } + notLoadedErr() { + console.error("Attempted to manipulate the layer before it was loaded"), console.trace(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + // NOTE this logic is for ArcGIS Server sourced things. + // other sourced attribute layers should override this function. + /** + * Will load and apply metadata from the ArcGIS Server endpoint to this layer. + * + * @param options loading options. Currently only supports custom renderer override + */ + async loadLayerMetadata(e = {}) { + if (!this.serviceUrl) + return; + const i = await this.$iApi.geo.layer.loadLayerMetadata( + this.serviceUrl + ); + if (this.geomType = i.geometryType, this.attribs.quickCache = new SCt(this.geomType), this.scaleSet.minScale = i.minScale, this.scaleSet.maxScale = i.maxScale, this.dataFormat = i.dataFormat, this.extent = this.extent ?? i.extent, this._serverVisibility = i.defaultVisibility, this.dataFormat === Ey.ESRI_FEATURE) { + this.supportsFeatures = !0, this.canModifyLayer = this.layerType === rn.SUBLAYER ? i.canModifyLayer : !0, this.fields = i.fields, this.nameField = i.displayField, this.oidField = i.objectIdField, this.drawOrder.forEach((s) => { + this.fields.findIndex((o) => o.name === s.field) === -1 && console.error( + `Draw order for layer ${this.id} references invalid field ${s.field}` + ); + }); + const r = e && e.customRenderer && e.customRenderer.type ? e.customRenderer : i.renderer; + this.renderer = this.$iApi.geo.symbology.makeRenderer( + r, + this.fields + ), this.legend = this.$iApi.geo.symbology.rendererToLegend( + this.renderer + ); + const n = { + // version number is only provided on 10.0 SP1 servers and up. + // servers 10.1 and higher support the query limit flag + supportsLimit: (i.currentVersion || 1) >= 10.1, + serviceUrl: this.serviceUrl, + oidField: this.oidField, + batchSize: -1, + attribs: "*", + // NOTE we set to * here for generic case. Some subclasses will later call updateFieldList() after parsing config field settings + permanentFilter: this.getSqlFilter(cm.PERMANENT) + }; + this.attribs.attLoader = new xCt( + this.$iApi, + n + ), this.origRampConfig.name || (this.name = i.name ?? this.id); + } else + this.supportsFeatures = !1; + } + /** + * Invokes the process to get the full set of attribute values for the layer. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of attribute values + */ + getAttributes() { + return this.attribs.attLoader.getAttribs(); + } + /** + * Requests that an attribute load request be aborted. Useful when encountering a massive dataset or a runaway process. + * + */ + abortAttributeLoad() { + this.attribs.attLoader.abortAttribLoad(); + } + /** + * Requests that any downloaded attribute sets or cached geometry be removed from memory. The next requests will pull from the server again. + * + */ + clearFeatureCache() { + this.attribs.clearAll(); + } + /** + * The number of attributes currently downloaded (will update as download progresses) + * @returns current download count + */ + downloadedAttributes() { + return this.isLoaded ? this.attribs.attLoader.loadCount() : 0; + } + /** + * Indicates if the attribute load has been aborted. + * @returns boolean if the process has been stopped + */ + attribLoadAborted() { + return this.isLoaded ? this.attribs.attLoader.isLoadAborted() : !1; + } + /** + * Invokes the process to get the full set of attribute values for the layer, + * formatted in a tabular format. Additional data properties are also included. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of tabular attribute values + */ + getTabularAttributes() { + return this.$iApi.geo.attributes.generateTabularAttributes( + this, + this.attribs + ); + } + /** + * Gets information on a graphic in the most efficient way possible. Options object properties: + * - getGeom ; a boolean to indicate if the result should include graphic geometry + * - getAttribs ; a boolean to indicate if the result should include graphic attributes + * - getStyle ; a boolean to indicate if the result should graphical styling information + * + * @param {Integer} objectId the object id of the graphic to find + * @param {Object} options options object for the request, see above + * @returns {Promise} resolves with a Graphic containing the requested information + */ + async getGraphic(e, i) { + let r = {}, n = new g8(); + const s = this.$iApi.geo.map; + let o = !1, a = !1, l = 0; + if (i.getAttribs || i.getStyle) { + const h = this.attribs.quickCache.getAttribs(e); + if (h) + r = h; + else if (this.attribs.attLoader.isLoaded() || this.isFile) { + const p = await this.attribs.attLoader.getAttribs(); + r = p.features[p.oidIndex[e]]; + } else + o = !0; + } + if (i.getGeom) { + l = s.getScale(); + const h = this.attribs.quickCache.getGeom(e, l); + h ? n = h : a = !0; + } + if (o || a) { + const h = { + oid: e, + serviceUrl: this.serviceUrl, + includeGeometry: a, + attribs: this.fieldList + }; + a && (h.mapSR = s.getSR().wkid?.toString(), this.attribs.quickCache.isPoint || (h.maxOffset = s.esriView?.resolution)); + const p = await this.$iApi.geo.attributes.loadSingleFeature( + h + ); + a && (this.attribs.quickCache.setGeom( + e, + p.geometry, + l + ), n = p.geometry), (o || typeof this.attribs.quickCache.getAttribs(e) > "u") && (this.attribs.quickCache.setAttribs( + e, + p.attributes + ), o && (r = p.attributes)); + } + const c = new bx( + n, + "", + i.getAttribs ? r : void 0 + ); + if (i.getStyle) { + const h = eo( + this.renderer.getGraphicSymbol(r) + ); + c.style = this.$iApi.geo.geom.styleEsriToRamp(h); + } + return c; + } + /** + * Gets the icon for a specific feature, as an SVG string. + * + * @param {Integer} objectId the object id of the feature to find + * @returns {Promise} resolves with an svg string encoding of the icon + */ + async getIcon(e) { + if (!this.renderer) + throw new Error("getIcon called before renderer is defined"); + const i = await this.getGraphic(e, { getAttribs: !0 }); + return this.$iApi.geo.symbology.getGraphicIcon( + i.attributes || {}, + this.renderer + ); + } + /** + * Applies an SQL filter to the layer. Will overwrite any existing filter for the given key. + * Use `1=2` for a "hide all" where clause. + * + * @param {String} filterKey the filter key / named filter to apply the SQL to + * @param {String} whereClause the WHERE clause of the filter + */ + setSqlFilter(e, i) { + const r = this.filter.getSql(e); + if (i === r) + return; + this.filter.setSql(e, i), this.$iApi.event.emit(an.FILTER_CHANGE, { + uid: this.uid, + filterKey: e + }); + const n = `${this.uid}-${e}-${i}`; + this._lastFilterUpdate = n, setTimeout(() => { + this._lastFilterUpdate === n && this.applySqlFilter(); + }, 100); + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + throw new Error( + `attempted to apply sql filter ${e} to a layer not equipped for it. likely a new subclass of AttribLayer did not override applySqlFilter` + ); + } + /** + * Returns the value of a named SQL filter on the layer. + * + * @param {String} filterKey the filter key / named filter to view + * @returns {String} the value of the where clause for the filter. Empty string if not defined. + */ + getSqlFilter(e) { + return this.filter.getSql(e); + } + /** + * Returns a SQL WHERE condition that is combination of active filters. + * + * @method getCombinedSqlFilter + * @param {Array} [exclusions] list of any filter keys to exclude from the result. omission includes all filters + * @returns {String} all non-excluded sql statements connected with AND operators. + */ + getCombinedSqlFilter(e) { + return this.filter.getCombinedSql(e); + } + /** + * Gets array of object ids that currently pass any filters + * + * @function getFilterOIDs + * + * @param {Array} [exclusions] list of any filters keys to exclude from the result. omission includes all filters + * @param {Extent} [extent] if provided, the result list will only include features intersecting the extent + * @returns {Promise} resolves with array of object ids that pass the filter. if no filters are active, resolves with undefined. + */ + async getFilterOIDs(e = [], i = void 0) { + const r = this.filter.getCombinedSql(e), n = !!i; + if (!(r || n)) + return; + i && this.filter.setExtent(i); + const s = this.filter.sqlActiveFilters(e); + let o = this.filter.getCache(s, n); + if (!o) { + const a = { + filterGeometry: i, + filterSql: r, + includeGeometry: !1 + }; + o = this.queryOIDs(a), this.filter.setCache(o, s, n); + } + return o; + } + /** + * Will return an array of object ids for features in the layer that satisfy the conditions of the query options parameter. + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves with an array of numbers (object ids) + */ + queryOIDs(e) { + this.isFile && (console.error("a file layer called a server based query function"), console.trace()); + const i = { + url: this.serviceUrl, + ...e + }; + return this.$iApi.geo.query.arcGisServerQueryIds(i); + } + /** + * Requests a set of features for this layer that match the criteria of the options + * - filterGeometry : a RAMP API geometry to restrict results to + * - filterSql : a where clause to apply against feature attributes + * - includeGeometry : a boolean to indicate if result features should include the geometry + * - sourceSR : a spatial reference indicating what the source layer is encoded in. providing can assist in result geometry being of a proper resolution + * + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves in an array of object ids and promises resolving in each feature + */ + async queryFeaturesDiscrete(e) { + const i = await this.queryOIDs(e), r = { + getGeom: !!e.includeGeometry, + getAttribs: !0 + }; + return i.map((n) => ({ + oid: n, + graphic: this.getGraphic(n, r) + })); + } + /** + * Requests a set of features for this layer that match the criteria of the options + * - filterGeometry : a RAMP API geometry to restrict results to + * - filterSql : a where clause to apply against feature attributes + * - includeGeometry : a boolean to indicate if result features should include the geometry + * - outFields : a string of comma separated field names. will restrict fields included in the output + * - sourceSR : a spatial reference indicating what the source layer is encoded in. providing can assist in result geometry being of a proper resolution + * + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves with an array of features that satisfy the criteria + */ + async queryFeatures(e) { + const i = await this.queryFeaturesDiscrete(e); + return Promise.all(i.map((r) => r.graphic)); + } +} +class yCt extends w8 { + constructor(e, i) { + super(e, i), this.dataFormat = Ey.ESRI_FEATURE, this.layerFormat = kb.GRAPHIC, this.hovertips = !1; + } + _graphics = []; + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + /** + * Get the number of graphics in the layer. + * + * @returns {Integer} number of graphics in the layer + */ + getGraphicCount() { + return this._graphics.length; + } + /** + * Gets a graphic from the layer, if it exists. + * + * @param {string} graphicId id of the graphic to find + * @returns {Graphic} the graphic, undefined if no matching id is found. + */ + getLocalGraphic(e) { + return this._graphics.find((i) => i.id === e); + } + getEsriGraphic(e) { + return this.esriLayer?.graphics.find((i) => i.id === e); + } + notLoadedErr() { + console.error("Attempted to manipulate the layer before it was loaded"), console.trace(); + } + /** Returns a copy of the graphics in the layer. */ + get graphics() { + return this._graphics.slice(); + } + /** + * Adds graphics to the layer. Once added, the Graphic is not tightly bound to the layer. + * Updating the Graphic object will not automatically update what is on the layer. + * + * @param {Graphic | Array} graphics one or more RAMP Graphics to add to the layer + * @returns {Promise} resolves when graphics have been added + */ + async addGraphic(e) { + if (!this.esriLayer) { + this.noLayerErr(); + return; + } + let i; + e instanceof Array ? i = e : i = [e]; + const r = i.filter((l) => this._graphics.findIndex((h) => h.id === l.id) === -1 ? (this._graphics.push(l), !0) : (console.error( + `Attempting to add graphic with id '${l.id}' that has already been added.` + ), !1)), n = this.$iApi.geo.map.getSR(), s = r.map( + (l) => this.$iApi.geo.proj.projectGeometry(n, l.geometry) + ), o = await Promise.all(s), a = r.map((l, c) => { + const h = new bx(o[c], l.id, l.attributes); + return h.style = l.style, this.$iApi.geo.geom.graphicRampToEsri(h); + }); + this.esriLayer.addMany(a); + } + /** + * If geometry specified, removes those items. Else removes all geometry. + * + * @param geometry any strings should reference a particular geometry instance with that ID. If undefined, all geometry is removed. + */ + removeGraphic(e) { + if (!this.esriLayer) { + this.noLayerErr(); + return; + } + if (typeof e > "u") { + this.esriLayer.removeAll(), this._graphics = []; + return; + } + let i; + Array.isArray(e) ? i = e : i = [e]; + const r = i.map((s) => typeof s == "string" ? s : s.id), n = []; + r.forEach((s) => { + const o = this.esriLayer?.graphics.find( + (a) => a.id === s + ); + if (o) { + n.push(o); + const a = this._graphics.findIndex((l) => l.id === s); + a != -1 && this._graphics.splice(a, 1); + } + }), this.esriLayer.removeMany(n), this._graphics = this._graphics.filter((s) => r.includes(s.id)); + } +} +class vCt extends yCt { + constructor(e, i) { + super(e, i), this.layerType = rn.GRAPHIC; + } + async onInitiate() { + this.esriLayer = ya( + new Tgt(this.makeEsriLayerConfig(this.origRampConfig)) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + return this.layerTree.name = this.name, this.updateDrawState(G_.UP_TO_DATE), e; + } + // ----------- LAYER ACTIONS ----------- +} +class I0e extends r$e { + esriJson; + // used as temp var to get around typescript parameter grousing. will be undefined after initLayer() + // temporarily stores GeoJSON. acts as a nice way for subclasses to parse their random sources to GeoJSON, drop it here, + // and have the generic initiation code in this file just grab it. + sourceGeoJson; + tooltipField; + // if we end up having more things that are shared with FeatureLayer, consider making a FeatureBaseLayer class for both to inherit from + constructor(e, i) { + super(e, i), this.supportsIdentify = !0, this.isFile = !0, this.dataFormat = Ey.ESRI_FEATURE, this.layerFormat = kb.FEATURE, this.tooltipField = "", e.identifyMode && e.identifyMode !== Xm.NONE ? this.identifyMode = e.identifyMode : this.identifyMode = Xm.HYBRID; + } + async reload() { + if (this.origRampConfig.caching !== !0 && !this.origRampConfig.url) { + console.error( + "Attempted to reload file layer from non server source without caching enabled." + ); + return; + } + await super.reload(); + } + async onInitiate() { + if (!this.sourceGeoJson) + throw new Error("File Layer is missing raw data."); + const e = typeof this.sourceGeoJson == "string" ? JSON.parse(this.sourceGeoJson) : JSON.parse(JSON.stringify(this.sourceGeoJson)), i = { + layerId: this.origRampConfig.id || "", + targetSR: this.$iApi.geo.map.getSR(), + ...this.origRampConfig.latField && { + latField: this.origRampConfig.latField + }, + ...this.origRampConfig.longField && { + lonField: this.origRampConfig.longField + }, + colour: this.origRampConfig.colour, + fieldMetadata: this.origRampConfig.fieldMetadata + }; + this.esriJson = await this.$iApi.geo.layer.files.geoJsonToEsriJson( + e, + i + ), this.esriLayer = ya( + new Qc(this.makeEsriLayerConfig(this.origRampConfig)) + ), this.esriJson = void 0, this.origRampConfig.caching !== !0 && delete this.origRampConfig.rawData, delete this.sourceGeoJson, await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + const i = super.makeEsriLayerConfig(e), r = "OBJECTID"; + return [ + "source", + "objectIdField", + "id", + "fields", + "renderer", + "spatialReference", + "geometryType" + ].forEach((s) => { + i[s] = this.esriJson[s]; + }), this.origRampConfig.nameField ? i.displayField = this.$iApi.geo.attributes.fieldValidator( + i.fields, + this.origRampConfig.nameField + ) || r : i.displayField = r, i.outFields = ["*"], delete i.url, Array.isArray(e.drawOrder) && e.drawOrder.length > 0 ? (i.orderBy = e.drawOrder.map((s) => ({ + field: s.field, + order: s.ascending ? "ascending" : "descending" + })), this._drawOrder = e.drawOrder.slice()) : (i.orderBy = [{ field: r, order: "descending" }], this._drawOrder = [{ field: r, ascending: !1 }]), i; + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + return this.esriLayer && this.origRampConfig.customRenderer?.type && (this.esriLayer.renderer = MF( + this.config.customRenderer + )), this.layerTree.name = this.name, this.extractLayerMetadata(), this.origRampConfig.tooltipField ? this.tooltipField = this.$iApi.geo.attributes.fieldValidator( + this.fields, + this.origRampConfig.tooltipField + ) || this.nameField : this.tooltipField = this.nameField, this.$iApi.geo.attributes.applyFieldMetadata( + this, + this.origRampConfig.fieldMetadata + ), this.attribs.attLoader.updateFieldList(this.fieldList), this.featureCount = this.esriLayer?.source.length || 0, e.push(this.viewDefProm.getPromise()), this.filter.getCombinedSql() && Promise.all(e).then(() => { + this.applySqlFilter(); + }), e; + } + // ----------- LAYER ACTIONS ----------- + runIdentify(e) { + if (!this.canIdentify()) + return []; + const i = new vm(), r = Dl({ + items: [], + loading: i.getPromise(), + loaded: !1, + errored: !1, + uid: this.uid, + requestTime: Date.now() + }); + let n = Promise.resolve(), s = Promise.resolve(), o = []; + if (this.identifyMode === Xm.HYBRID || this.identifyMode === Xm.GEOMETRIC) { + const a = { + includeGeometry: !1 + }; + this.geomType !== el.POLYGON && e.geometry.type === el.POINT ? a.filterGeometry = this.$iApi.geo.query.makeClickBuffer( + e.geometry, + e.tolerance + ) : a.filterGeometry = e.geometry, a.filterSql = this.getCombinedSqlFilter(), s = this.queryFeatures(a).then((l) => { + o = l; + }); + } + return e.hitTest && (this.identifyMode === Xm.HYBRID || this.identifyMode === Xm.SYMBOLIC) && (n = s.then(async () => { + const a = await e.hitTest, l = await Promise.all( + a.filter( + (c) => c.layerId === this.id && o.findIndex( + (h) => c.oid === h.attributes[this.oidField] + ) === -1 + ).map((c) => this.getGraphic(c.oid, { + getAttribs: !0 + })) + ); + o = o.concat(l); + })), Promise.all([n, s]).then(() => { + o.forEach((a) => { + const l = Dl({ + data: a.attributes, + format: iF.ESRI, + loaded: !0, + loading: Promise.resolve() + }); + r.items.push(l); + }), r.loaded = !0, i.resolveMe(); + }).catch(() => { + r.errored = !0, i.resolveMe(); + }), [r]; + } + extractLayerMetadata() { + const e = this.esriLayer; + if (!e) + throw new Error( + "file layer attempted to extract data from esri layer, esri layer did not exist" + ); + this.supportsFeatures = !0, this.geomType = this.$iApi.geo.geom.clientGeomTypeToRampGeomType( + e.geometryType + ), this.scaleSet.minScale = e.minScale || 0, this.scaleSet.maxScale = e.maxScale || 0, this.extent = this.extent ?? Rd.fromESRI(e.fullExtent, this.id + "_extent"); + const i = ya(e.fields.slice()); + this.fields = i.map((n) => ({ + name: n.name, + alias: n.alias, + type: n.type, + length: n.length + })), this.nameField = e.displayField, this.oidField = e.objectIdField, this.renderer = this.$iApi.geo.symbology.makeRenderer( + e.renderer, + this.fields + ), this.legend = this.$iApi.geo.symbology.rendererToLegend(this.renderer); + const r = { + sourceGraphics: e.source, + oidField: this.oidField, + attribs: "*", + // * as default. layer loader may update after processing config overrides + batchSize: -1 + }; + this.attribs.attLoader = new T3i( + this.$iApi, + r + ); + } + /** + * Fetches a graphic from the given layer. + * This overrides the baseclass method, as we are all local and dont need quick caches or server hits + * + * @function getGraphic + * @param {Integer} objectId ID of object being searched for + * @param {Object} opts object containing option parametrs + * - map map wrapper object of current map. only required if requesting geometry + * - getGeom boolean. indicates if return value should have geometry included. default to false + * - getAttribs boolean. indicates if return value should have attributes included. default to false + * @returns {Promise} resolves with a Graphic + */ + async getGraphic(e, i) { + const r = { + filterSql: `${this.oidField}=${e}`, + includeGeometry: !!i.getGeom + }, n = await this.queryFeatures(r); + if (n.length === 0) + throw new Error(`Could not find object id ${e}`); + n.length !== 1 && console.warn( + "did not get a single result on a query for a specific object id" + ); + const s = n[0]; + if (i.getStyle) { + const o = eo( + this.renderer.getGraphicSymbol(s.attributes) + ); + s.style = this.$iApi.geo.geom.styleEsriToRamp(o); + } + return s; + } + /** + * Requests a set of features for this layer that match the criteria of the options + * - filterGeometry : a RAMP API geometry to restrict results to + * - filterSql : a where clause to apply against feature attributes + * - includeGeometry : a boolean to indicate if result features should include the geometry + * - outFields : a string of comma separated field names. will restrict fields included in the output + * - sourceSR : a spatial reference indicating what the source layer is encoded in. providing can assist in result geometry being of a proper resolution + * + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves with an array of features that satisfy the criteria + */ + async queryFeatures(e) { + const i = { + layer: this, + ...e + }; + return this.$iApi.geo.query.geoJsonQuery(i); + } + /** + * Will return an array of object ids for features in the layer that satisfy the conditions of the query options parameter. + * @param options + * @returns {Promise} resolving with an array of numbers (object ids) + */ + async queryOIDs(e) { + const i = { + layer: this, + ...e + }; + return (await this.$iApi.geo.query.geoJsonQuery(i)).map( + (n) => n.attributes ? n.attributes[this.oidField] : -1 + ); + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + if (!this.esriView) { + this.noLayerErr(); + return; + } + const i = this.filter.getCombinedSql(e); + eo(this.esriView).filter = new eie({ + where: i + }); + } +} +class d3i extends I0e { + constructor(e, i) { + super(e, i), this.layerType = rn.GEOJSON; + } + async onInitiate() { + if (this.origRampConfig.rawData && (typeof this.origRampConfig.rawData == "string" || this.origRampConfig.rawData instanceof Object)) + this.sourceGeoJson = this.origRampConfig.rawData; + else if (this.origRampConfig.url) + this.sourceGeoJson = await this.$iApi.geo.layer.files.fetchFileData( + this.origRampConfig.url, + this.layerType + ); + else + throw new Error("GeoJson layer config contains no raw data or url"); + await super.onInitiate(); + } +} +class p3i extends I0e { + constructor(e, i) { + super(e, i), this.layerType = rn.SHAPEFILE; + } + async onInitiate() { + let e; + if (this.origRampConfig.rawData && typeof this.origRampConfig.rawData == "string") + e = this.origRampConfig.rawData; + else if (this.origRampConfig.url) + e = await this.$iApi.geo.layer.files.fetchFileData( + this.origRampConfig.url, + this.layerType + ); + else + throw new Error( + "shapefile file config contains no raw data or url" + ); + this.sourceGeoJson = await this.$iApi.geo.layer.files.shapefileToGeoJson(e), await super.onInitiate(); + } +} +class f3i extends I0e { + constructor(e, i) { + super(e, i), this.layerType = rn.CSV; + } + async onInitiate() { + if (!this.origRampConfig.latField || !this.origRampConfig.longField) + throw new Error("csv file config missing lat or long field names"); + let e; + if (this.origRampConfig.rawData && typeof this.origRampConfig.rawData == "string") + e = this.origRampConfig.rawData; + else if (this.origRampConfig.url) + e = await this.$iApi.geo.layer.files.fetchFileData( + this.origRampConfig.url, + this.layerType + ); + else + throw new Error("Csv file config contains no raw data or url"); + this.sourceGeoJson = await this.$iApi.geo.layer.files.csvToGeoJson( + e, + { + latfield: this.origRampConfig.latField, + lonfield: this.origRampConfig.longField + } + ), await super.onInitiate(); + } +} +class m3i extends r$e { + tooltipField; + constructor(e, i) { + super(e, i), this.dataFormat = Ey.ESRI_FEATURE, this.tooltipField = "", this.supportsIdentify = !0, this.layerType = rn.FEATURE, this.layerFormat = kb.FEATURE, e.identifyMode && e.identifyMode !== Xm.NONE ? this.identifyMode = e.identifyMode : this.identifyMode = Xm.HYBRID; + } + async onInitiate() { + ya( + this.esriLayer = new Qc( + this.makeEsriLayerConfig(this.origRampConfig) + ) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + const i = super.makeEsriLayerConfig(e); + return (e.initialFilteredQuery || e.permanentFilteredQuery) && (i.definitionExpression = this.filter.getCombinedSql()), Array.isArray(e.drawOrder) && e.drawOrder.length > 0 && (i.orderBy = e.drawOrder.map((r) => ({ + field: r.field, + order: r.ascending ? "ascending" : "descending" + })), this._drawOrder = e.drawOrder.slice()), i; + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(), i = this.esriLayer && this.origRampConfig.customRenderer?.type; + i && (this.esriLayer.renderer = MF( + this.origRampConfig.customRenderer + )); + const r = this.esriLayer.parsedUrl.path, s = this.$iApi.geo.shared.parseUrlIndex(r).index || 0; + this.serviceUrl = r; + const o = this.loadLayerMetadata( + i ? { customRenderer: this.esriLayer?.renderer } : {} + ).then(() => { + this.visibility = this.origRampConfig?.state?.visibility ?? this._serverVisibility ?? !0, this.nameField = this.origRampConfig.nameField || this.nameField || "", this.tooltipField = this.origRampConfig.tooltipField || this.nameField, this.$iApi.geo.attributes.applyFieldMetadata( + this, + this.origRampConfig.fieldMetadata + ), this.attribs.attLoader.updateFieldList(this.fieldList), this.esriLayer?.orderBy || (this.esriLayer.orderBy = [ + { field: this.oidField, order: "descending" } + ], this._drawOrder = [{ field: this.oidField, ascending: !1 }]); + }), a = this.$iApi.geo.layer.loadFeatureCount( + this.serviceUrl, + this.getSqlFilter(cm.PERMANENT) + ).then((l) => { + this.featureCount = l; + }); + return this.layerTree.name = this.name, this.layerTree.layerIdx = s, e.push(o, a), e; + } + // ----------- LAYER ACTIONS ----------- + runIdentify(e) { + if (!this.canIdentify()) + return []; + const i = new vm(), r = Dl({ + items: [], + loading: i.getPromise(), + loaded: !1, + errored: !1, + uid: this.uid, + requestTime: Date.now() + }); + let n = Promise.resolve(), s = Promise.resolve(), o = []; + if (this.identifyMode === Xm.HYBRID || this.identifyMode === Xm.GEOMETRIC) { + const a = { + includeGeometry: !1 + }; + this.geomType !== el.POLYGON && e.geometry.type === el.POINT ? a.filterGeometry = this.$iApi.geo.query.makeClickBuffer( + e.geometry, + e.tolerance + ) : a.filterGeometry = e.geometry, a.filterSql = this.getCombinedSqlFilter(), s = this.queryFeaturesDiscrete(a).then((l) => { + o = l; + }); + } + return e.hitTest && (this.identifyMode === Xm.HYBRID || this.identifyMode === Xm.SYMBOLIC) && (n = s.then(async () => { + (await e.hitTest).filter( + (l) => l.layerId === this.id && o.findIndex((c) => l.oid === c.oid) === -1 + ).forEach((l) => { + o.push({ + oid: l.oid, + graphic: this.getGraphic(l.oid, { + getAttribs: !0 + }) + }); + }); + })), Promise.all([n, s]).then(() => { + o.forEach((a) => { + const l = Dl({ + data: void 0, + format: iF.ESRI, + loaded: !1, + loading: new Promise((c) => { + a.graphic.then((h) => { + l.data = h.attributes, l.loaded = !0, c(); + }); + }) + }); + r.items.push(l); + }), r.loaded = !0, i.resolveMe(); + }).catch(() => { + r.errored = !0, i.resolveMe(); + }), [r]; + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + if (!this.esriLayer) { + this.noLayerErr(); + return; + } + const i = this.filter.getCombinedSql(e); + this.esriLayer.definitionExpression = i; + } + /** + * Gets the extent where the provided object id is on the map. + * Can only be used on feature layers. Not applicable to point geometry. + * + * @param objectId the object id to query + * @returns {Promise} resolves with the extent where the object id is present, rejects if geometry type is invalid or esri layer does not exist + */ + getGraphicExtent(e) { + return new Promise((i, r) => { + if (!this.esriLayer) + this.noLayerErr(), r(); + else if (!["multipoint", "polyline", "polygon"].includes( + this.esriLayer.geometryType + )) + console.error( + `Attempted to query extent for invalid geometry type ${this.esriLayer.geometryType}.` + ), r(); + else { + const n = this.attribs.quickCache.getExtent(e); + n ? i(n) : this.esriLayer.queryExtent({ + objectIds: [e], + outSpatialReference: this.$iApi.geo.map.getSR().toESRI() + }).then((s) => { + const o = Rd.fromESRI(s.extent); + this.attribs.quickCache.setExtent( + e, + o + ), i(o); + }).catch(() => { + console.error( + `Extent querying failed for ${e}.` + ), r(); + }); + } + }); + } +} +class g3i extends w8 { + // indicates if sublayers can have opacity adjusted + isDynamic; + // used to remember state after load + origState; + constructor(e, i) { + super(e, i), this.supportsIdentify = !0, this.supportsSublayers = !0, this.layerType = rn.MAPIMAGE, this.layerFormat = kb.MAPIMAGE, this.isDynamic = !1, this.hovertips = !1, this.layerTree.layerIdx = -1, this.identifyMode = Xm.GEOMETRIC; + } + async onInitiate() { + this.esriLayer = ya( + new eNe(this.makeEsriLayerConfig(this.origRampConfig)) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + const i = super.makeEsriLayerConfig(e); + return this.origState = { + visibility: i.visible, + opacity: i.opacity + }, i.visible = !1, e.imageFormat && (i.imageFormat = e.imageFormat), i; + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + if (!this.esriLayer) + return this.noLayerErr(), e; + if (this.layerTree.name = this.name, !this.esriLayer.capabilities.exportMap) + throw this.$iApi.notify.show( + Mv.WARNING, + this.$iApi.$i18n.t("layer.noexportmap", { + name: this.name || this.id + }) + ), new Error( + "Service does not support Map Image Layer, Map Export is not enabled" + ); + this.isDynamic = this.esriLayer.capabilities.exportMap.supportsDynamicLayers, this.extent = this.extent ?? Rd.fromESRI(this.esriLayer.fullExtent, this.id + "_extent"); + const i = (o) => { + const a = this.esriLayer?.allSublayers.find((l) => l.id === o); + if (!a) + throw new Error("attempt to find map image sublayer failed"); + return a; + }, r = {}; + this.origRampConfig.sublayers.forEach((o) => { + r[o.index || 0] = o; + }); + const n = [], s = (o, a) => { + const l = o.id, c = r[l]; + if (o.sublayers && o.sublayers.length > 0) { + const h = (c ? c.name : "") || o.title || "", p = new $de(l, "", h, !1); + a.findChildByIdx(l) || a.children.push(p), o.sublayers.reverse().forEach((y) => { + s(y, p); + }); + } else { + this._sublayers[l] || (this._sublayers[l] = new y3i( + { + id: `${this.id}-${l}`, + // TODO: Revisit once issue #961 is implemented. + // See https://github.com/ramp4-pcar4/ramp4-pcar4/pull/1045#pullrequestreview-977116071 + // ^ update: issue 961 seems to have nothing to do with this. The PR link implies this + // comment is related to the parent state default line below. Best guess is that + // issue #1394 was the impacted issue. It appears that the code in the leaf initializer + // below is handling things, but leaving this here for now incase someone wants to + // dig deeper (or a problem arises) + layerType: rn.SUBLAYER, + name: r[l]?.name, + // If the state isn't defined, use the same state as the parent. + state: r[l]?.state ?? { + opacity: this.opacity, + visibility: this.visibility, + hovertips: this.hovertips, + identify: this.identify + }, + extent: r[l]?.extent, + controls: r[l]?.controls, + disabledControls: r[l]?.disabledControls, + initialFilteredQuery: r[l]?.initialFilteredQuery, + permanentFilteredQuery: r[l]?.permanentFilteredQuery + }, + this.$iApi, + this, + l + )); + const h = this._sublayers[l]; + if (h.isRemoved) + return; + const p = (c ? c.name : "") || o.title || ""; + if (h.name = p, n.push(h), !a.children.map((y) => y.layerIdx).includes(l)) { + const y = new $de( + l, + h.uid, + h.name, + !1 + ); + a.children.push(y); + } + h.esriWatches.push( + o.watch("visible", () => { + this.$iApi.event.emit( + an.LAYER_VISIBILITYCHANGE, + { + visibility: h.visibility, + layer: h + } + ), h.parentLayer?.checkVisibility(); + }), + o.watch("opacity", (y) => { + this.$iApi.event.emit( + an.LAYER_OPACITYCHANGE, + { + opacity: y, + layer: h + } + ); + }) + ); + } + }; + return this.origRampConfig.sublayers.forEach((o) => { + if (!o.cosmetic) { + const a = i(o.index || 0); + s(a, this.layerTree); + } + }), n.forEach((o) => { + const a = i(o.layerIdx), l = r[o.layerIdx]; + o.serviceUrl = a.url, o.fetchEsriSublayer(this), o.initiate(); + const c = o.esriSubLayer && l?.customRenderer?.type; + c && (o.esriSubLayer.renderer = MF( + l.customRenderer + )); + const h = o.loadLayerMetadata( + c ? { customRenderer: o.esriSubLayer?.renderer } : {} + ).then(() => { + const p = r[o.layerIdx]; + return p ? (o.visibility = o.isRemoved ? !1 : p.state?.visibility ?? (this.origState.visibility ? o._serverVisibility ?? this.origState.visibility : this.origState.visibility ?? o._serverVisibility) ?? !0, o.opacity = p.state?.opacity ?? this.origState.opacity ?? 1, o.nameField = p.nameField || o.nameField || "", this.$iApi.geo.attributes.applyFieldMetadata( + o, + p.fieldMetadata + ), o.canModifyLayer || this.$iApi.notify.show( + Mv.WARNING, + this.$iApi.$i18n.t("layer.filtersdisabled", { + name: o.name || o.id + }) + )) : this.$iApi.geo.attributes.applyFieldMetadata(o), o.supportsFeatures ? (o.updateFieldList(), this.$iApi.geo.layer.loadFeatureCount( + o.serviceUrl, + o.getSqlFilter(cm.PERMANENT) + ).then((y) => { + o.featureCount = y; + })) : Promise.resolve(); + }); + e.push(h); + }), this.esriLayer.allSublayers.forEach((o) => { + !o.sublayers && !n.find( + (a) => a.layerIdx === o.id + ) && (o.visible = !1, o.opacity = 0); + }), this.visibility = this.origState.visibility ?? !0, e; + } + updateLayerState(e) { + super.updateLayerState(e), this.sublayers.forEach((i) => i.updateLayerState(e)); + } + updateDrawState(e) { + super.updateDrawState(e), this.sublayers.forEach((i) => i.updateDrawState(e)); + } + // ----------- LAYER ACTIONS ----------- + runIdentify(e) { + if (!this.canIdentify()) + return []; + e.sublayerIds && (e.sublayerIds = e.sublayerIds.map( + (n) => typeof n == "number" ? this.layerTree?.findChildByIdx(n)?.uid : n + )); + const i = e.sublayerIds ? this._sublayers.filter( + (n) => e.sublayerIds?.includes(n.uid) + ) : this._sublayers.filter( + (n) => n.canIdentify() + ); + if (i.length === 0) + return []; + let r; + return e.geometry.type === el.POINT && (r = this.$iApi.geo.query.makeClickBuffer( + e.geometry, + e.tolerance + )), i.map((n) => { + const s = new vm(), o = {}, a = Dl({ + items: [], + loading: s.getPromise(), + loaded: !1, + errored: !1, + uid: n.uid, + requestTime: Date.now() + }); + return n.geomType !== el.POLYGON && r ? o.filterGeometry = r : o.filterGeometry = e.geometry, o.filterSql = n.getCombinedSqlFilter(), n.queryFeaturesDiscrete(o).then((l) => { + l.forEach((c) => { + const h = Dl({ + data: void 0, + format: iF.ESRI, + loaded: !1, + loading: new Promise((p) => { + c.graphic.then((y) => { + h.data = y.attributes, h.loaded = !0, p(); + }); + }) + }); + a.items.push(h); + }), a.loaded = !0, s.resolveMe(); + }).catch(() => { + a.errored = !0, s.resolveMe(); + }), a; + }); + } +} +class y3i extends r$e { + tooltipField; + constructor(e, i, r, n = 0) { + if (super(e, i), this.layerType = rn.SUBLAYER, this.layerFormat = kb.MAPIMAGE, this.isSublayer = !0, this.layerIdx = n, this.parentLayer = r, this.dataFormat = Ey.ESRI_FEATURE, this.tooltipField = "", this.hovertips = !1, !r.esriLayer) + throw new Error( + "Map Image Layer with no internal esri layer encountered in sublayer creation" + ); + this.fetchEsriSublayer(r), (e.initialFilteredQuery || e.permanentFilteredQuery) && this.applySqlFilter(); + } + /** + * Set the ESRI sublayer using the parent's sublayer list + * + * @param {MapImageLayer} parent: Parent MapImageLayer object + */ + fetchEsriSublayer(e) { + if (!e.esriLayer) { + console.error( + "Attempted to fetch the ESRI sublayer when parent has no ESRI layer" + ); + return; + } + this.esriSubLayer = ya( + e.esriLayer.allSublayers.find((i) => i.id === this.layerIdx) + ); + } + /** + * Load actions for a MapImage sublayer + */ + onLoadActions() { + return this.layerTree = this.parentLayer.getLayerTree().findChildByUid( + this.uid + ), this.layerTree.name = this.name, this.layerTree.layerIdx = this.layerIdx, this.identify = this.config.state.identify != null ? this.config.state.identify : this.supportsIdentify, []; + } + /** + * Initiate this sublayer + * + * This is called after the parent layer is initiated + */ + async onInitiate() { + this.initiationState = Og.INITIATED; + } + async reload() { + if (!this.$iApi.geo.map.esriMap) { + console.error("Attempted layer reload when no map exists"); + return; + } + this.parentLayer?.reload(); + } + /** + * Indicates if the Esri map sublayer and the parent's Esri map layer exist. + */ + get layerExists() { + return !!(this.parentLayer?.esriLayer && this.esriSubLayer); + } + /** + * Returns the visibility of the sublayer. + * + * @function getVisibility + * @returns {Boolean} visibility of the sublayer + */ + get visibility() { + return !this.parentLayer?.esriLayer || !this.esriSubLayer ? (this.noLayerErr(), !1) : this.esriSubLayer.visible; + } + /** + * Applies visibility to sublayer. + * + * @function setVisibility + * @param {Boolean} value the new visibility setting + */ + set visibility(e) { + if (!this.parentLayer?.esriLayer || !this.esriSubLayer) { + this.noLayerErr(); + return; + } + this.esriSubLayer.visible = e; + } + /** + * Returns the opacity of the sublayer. + * + * @function getOpacity + * @returns {Boolean} opacity of the sublayer + */ + get opacity() { + return !this.parentLayer?.esriLayer || !this.esriSubLayer ? (this.noLayerErr(), 0) : this.esriSubLayer.opacity; + } + /** + * Applies opacity to sublayer. + * + * @function setOpacity + * @param {Boolean} value the new opacity setting + */ + set opacity(e) { + if (!this.parentLayer?.esriLayer || !this.esriSubLayer) { + this.noLayerErr(); + return; + } + this.parentLayer.isDynamic || console.warn( + `Opacity of a Map Image Sublayer was set. The service does not support sublayer opacity. LayerId ${this.id}` + ), this.esriSubLayer.opacity = e; + } + /** + * Get the mouse tolerance in pixels for this sublayer's parent layer + * + * @returns {number} the mouse tolerance of the parent layer + */ + get mouseTolerance() { + return !this.parentLayer?.esriLayer || !this.esriSubLayer ? (this.noLayerErr(), 0) : this.parentLayer.mouseTolerance; + } + /** + * Set the mouse tolerance for this sublayer's parent layer in pixels + * + * @param {number} tolerance the new mouse tolerance + */ + set mouseTolerance(e) { + if (!this.parentLayer?.esriLayer || !this.esriSubLayer) { + this.noLayerErr(); + return; + } + this.parentLayer.mouseTolerance = e; + } + /** + * Get the touch tolerance in pixels for this sublayer's parent layer + * + * @returns {number} the touch tolerance of the parent layer + */ + get touchTolerance() { + return !this.parentLayer?.esriLayer || !this.esriSubLayer ? (this.noLayerErr(), 0) : this.parentLayer.touchTolerance; + } + /** + * Set the touch tolerance in pixels for this sublayer's parent layer + * + * @param {number} tolerance the new touch tolerance of the parent layer + */ + set touchTolerance(e) { + if (!this.parentLayer?.esriLayer || !this.esriSubLayer) { + this.noLayerErr(); + return; + } + this.parentLayer.touchTolerance = e; + } + /** + * Applies the current filter settings to the physical map layer. + * + * @function applySqlFilter + * @param {Array} [exclusions] list of any filters to exclude from the result. omission includes all keys + */ + applySqlFilter(e = []) { + if (!this.parentLayer?.esriLayer || !this.esriSubLayer) { + this.noLayerErr(); + return; + } + const i = this.filter.getCombinedSql(e); + this.esriSubLayer.definitionExpression = i; + } + /** + * Provides the spatial reference of the parent MIL. + * + * @returns {SpatialReference} the layer spatial reference in RAMP API format + */ + getSR() { + return this.parentLayer?.esriLayer ? pl.fromESRI( + this._parentLayer?.esriLayer?.spatialReference + ) : (this.noLayerErr(), pl.latLongSR()); + } + /** + * A utility method to allow a parent layer to request this layer to + * update its internal attribute loader after field data has been + * properly processed. + * Generally should only be called internally. + */ + updateFieldList() { + this.attribs.attLoader.updateFieldList(this.fieldList); + } +} +class v3i extends w8 { + constructor(e, i) { + super(e, i), this.supportsIdentify = !1, this.layerType = rn.OSM, this.layerFormat = kb.OSM, this.dataFormat = Ey.OSM_TILE, this.supportsFeatures = !1; + } + async onInitiate() { + this.esriLayer = ya( + new iNe( + this.makeEsriLayerConfig(this.origRampConfig) + ) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + this.layerTree.name = this.name; + const i = this.$iApi.geo.symbology.generatePlaceholderSymbology( + "O", + "#03fc4e" + ), r = { + uid: this.$iApi.geo.shared.generateUUID(), + label: "OpenStreetMap", + // product name, same in Fr + svgcode: i.svgcode, + esriStandard: !0, + drawPromise: Promise.resolve() + }; + return this.legend.push(r), e; + } +} +class _3i extends w8 { + constructor(e, i) { + super(e, i), this.supportsIdentify = !1, this.layerType = rn.IMAGERY, this.layerFormat = kb.IMAGERY, this.dataFormat = Ey.ESRI_RASTER; + } + async onInitiate() { + this.esriLayer = ya( + new y0t(this.makeEsriLayerConfig(this.origRampConfig)) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + this.layerTree.name = this.name; + const i = this.$iApi.geo.symbology.mapServerToLocalLegend(this.origRampConfig.url).then((r) => { + this.legend = r; + }); + return e.push(i), e; + } +} +class _Ct extends w8 { + constructor(e, i) { + super(e, i), this.supportsIdentify = !1, this.layerType = rn.TILE, this.layerFormat = kb.TILE, this.dataFormat = Ey.ESRI_TILE; + } + async onInitiate() { + this.esriLayer = ya( + new sNe(this.makeEsriLayerConfig(this.origRampConfig)) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + return super.makeEsriLayerConfig(e); + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + this.layerTree.name = this.name; + const i = this.$iApi.geo.symbology.mapServerToLocalLegend(this.origRampConfig.url).then((r) => { + this.legend = r; + }); + return e.push(i), e.push(this.checkProj()), e; + } + /** + * Check if the layer's projection matches the current basemap's. + * If they do not match the layer will enter the error state and the user will receive a warning notification + * If the layers do match and the layer was previously in the error state, it will reload. + */ + checkProj() { + const e = this.getSR(), r = this.$iApi.geo.map.getSR().isEqual(e); + if (this.layerState === rp.LOADED && !r) + this.$iApi.notify.show( + Mv.WARNING, + this.$iApi.$i18n.t("layer.mismatch", { + name: this.name || this.id + }) + ), this.onError(); + else if (this.layerState === rp.ERROR && r) + this.reload(); + else if (this.layerState !== rp.ERROR && !r) + return this.$iApi.notify.show( + Mv.WARNING, + this.$iApi.$i18n.t("layer.mismatch", { + name: this.name || this.id + }) + ), Promise.reject(); + return Promise.resolve(); + } +} +class b3i extends w8 { + sublayerNames; + mimeType; + constructor(e, i) { + super(e, i), this.supportsIdentify = !0, this.layerType = rn.WMS, this.layerFormat = kb.WMS, this.mimeType = e.featureInfoMimeType || "", this.sublayerNames = [], this.dataFormat = Ey.OGC_RASTER, this.identifyMode = Xm.GEOMETRIC; + } + async onInitiate() { + this.esriLayer = ya( + new k0t(this.makeEsriLayerConfig(this.origRampConfig)) + ), await super.onInitiate(); + } + /** + * Take a layer config from the RAMP application and derives a configuration for an ESRI layer + * + * @param rampLayerConfig snippet from RAMP for this layer + * @returns configuration object for the ESRI layer representing this layer + */ + makeEsriLayerConfig(e) { + const i = super.makeEsriLayerConfig( + e + ), r = e.sublayers; + this.sublayerNames = r.map( + (s) => s.id || "error_no_wms_id" + ); + const n = r.map((s) => s.currentStyle).join(); + return i.customParameters = { + styles: n + }, e.url.indexOf("/geomet") !== -1 && (i.customParameters.layers = r[0].id), i; + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(); + this.layerTree.name = this.name; + const i = (r) => { + let n = !1; + return r.forEach((s) => { + this.sublayerNames.indexOf(s.name) > -1 || s.sublayers && s.sublayers.length > 0 && i(s.sublayers) ? n = !0 : s.visible = !1; + }), n; + }; + return this.esriLayer ? i(this.esriLayer.sublayers) : this.noLayerErr(), this.loadSymbology(), e; + } + // ----------- LAYER ACTIONS ----------- + canIdentify() { + return super.canIdentify(); + } + /** + * Run a getFeatureInfo on a WMS layer, return the result as a promise. + * Options: specs to be added once finalized + * + * @param {Object} options additional arguemets, see above. + * @returns {Object} an object with identify results array and identify promise resolving when identify is complete; if an empty object is returned, it will be skipped + */ + runIdentify(e) { + if (e.geometry.type !== el.POINT) + throw new Error("a point must be used for WMS Identify"); + if (!this.canIdentify()) + return []; + const i = new vm(), r = Dl({ + items: [], + loading: i.getPromise(), + loaded: !1, + errored: !1, + uid: this.uid, + requestTime: Date.now() + }); + return this.getFeatureInfo( + this.sublayerNames, + e.geometry, + this.mimeType + ).then((n) => { + if (n) { + const s = Dl({ + data: n, + format: iF.UNKNOWN, + loaded: !0, + loading: Promise.resolve() + }); + typeof n != "string" ? (s.format = iF.JSON, r.items.push(s)) : n.indexOf("Search returned no results") === -1 && n !== "" && (s.format = iF.TEXT, r.items.push(s)); + } + r.loaded = !0, i.resolveMe(); + }).catch(() => { + r.errored = !0, i.resolveMe(); + }), [r]; + } + /** + * Add a WMS layer parameter, maybe even refresh the layer + * + * @function setCustomParameter + * @param {String} key name of the key to be created or updated + * @param {String} value value of the key + * @param {Boolean} forceRefresh show the new fancy version of the layer or not + */ + setCustomParameter(e, i, r = !0) { + this.esriLayer ? (this.esriLayer.customLayerParameters[e] = i, r && this.esriLayer.refresh()) : this.noLayerErr(); + } + /** + * Handles click events for WMS layers (makes a WMS GetFeatureInfo call behind the scenes). + * + * @param {Array} layerList a list of strings identifying the WMS sublayers to be queried + * @param {Point} point a RAMP Point indicating where the user clicked + * @param {String} mimeType the format to be requested for the response + * @returns {Promise} a promise which resolves with the GetFeatureInfo response + */ + getFeatureInfo(e, i, r) { + const n = this.$iApi.geo.map, s = this.esriLayer; + if (!n.esriView) + throw new Error( + "WMS get feature, no map view exists. Cannot derive click coords" + ); + if (!s) + throw this.noLayerErr(), new Error("wms get feature failed, no layer"); + let o, a; + const l = n.getExtent(), c = s.spatialReferences, h = e.join(","), p = n.esriView.toScreen(i.toESRI()), y = Math.floor(p.x), v = Math.floor(p.y), I = { + "application/json": "json", + "text/html": "text", + "text/plain": "text" + }[r] || "text", P = n.getSR(); + P.wkid ? o = P.wkid : (o = 4326, console.error( + "Map is likely in a WKT projection. WMS Identify request will likely fail." + )), c && c.length > 1 ? c.indexOf(o) === -1 && (P.latestWkid && c.indexOf(P.latestWkid) > -1 ? o = P.latestWkid : console.error( + "WMS service does not support the maps projection. Identify request will likely fail." + )) : console.error( + "No supported wkid/epsg code found for WMS service. Identify request will likely fail." + ), s.version === "1.3" || s.version === "1.3.0" ? (a = { + CRS: "EPSG:" + o, + I: y, + J: v, + STYLES: "", + FORMAT: s.imageFormat + }, this.$iApi.geo.layer.ogc.reversedAxisWKIDs().indexOf(o) > -1 && (a.BBOX = `${l.ymin},${l.xmin},${l.ymax},${l.xmax}`)) : a = { SRS: "EPSG:" + o, X: y, Y: v }, Object.prototype.hasOwnProperty.call(a, "BBOX") || (a.BBOX = `${l.xmin},${l.ymin},${l.xmax},${l.ymax}`); + const F = { + SERVICE: "WMS", + REQUEST: "GetFeatureInfo", + VERSION: s.version, + WIDTH: n.getPixelWidth(), + HEIGHT: n.getPixelHeight(), + QUERY_LAYERS: h, + LAYERS: h, + INFO_FORMAT: r + }, k = s.customLayerParameters; + return k && Object.keys(k).forEach((V) => { + V.toLowerCase() !== "styles" && (F[V] = k[V]); + }), Object.keys(F).forEach((V) => a[V] = F[V]), ir(s.url.split("?")[0], { + query: a, + responseType: I + }); + } + /** + * Finds the appropriate legend URLs for WMS layers. + * + * @param {Array} layerList a list of objects identifying the WMS layers to be queried + * @returns {Array} a list of strings containing URLs for specified layers (order is preserved) + */ + getLegendUrls(e) { + if (!this.esriLayer) + return this.noLayerErr(), []; + const i = /* @__PURE__ */ new Map(); + this.esriLayer.allSublayers.forEach((n) => { + n.visible && (n.legendUrl && this.origRampConfig.sublayers?.forEach((s) => { + if (s.id && s.currentStyle && s.id === n.name) { + const o = new IQ(n.legendUrl); + "STYLE" in o.queryMap && o.queryMap.STYLE !== s.currentStyle && (n.legendUrl = o.updateQuery({ + STYLE: s.currentStyle + })); + } + }), i.set(n.name, n.legendUrl)); + }); + const r = e.map( + (n) => n.styleLegends && n.currentStyle ? n.styleLegends.find((s) => s.name === n.currentStyle).url : void 0 + ); + return r.forEach((n, s) => { + n || (r[s] = i.get(e[s].id)); + }), r; + } + /** + * Searches for a layer title defined by a wms. + * @function getWMSLayerTitle + * @private + * @param {String} wmsLayerId layer id as defined in the wms (i.e. not wmsLayer.id) + * @return {String} layer title as defined on the service, '' if no title defined + */ + getWMSLayerTitle(e) { + if (!this.esriLayer) + return ""; + let i; + return this.esriLayer.allSublayers.some((r) => { + if (r.name === e) + return i = r.title, !0; + }), i || ""; + } + /** + * Download or refresh the internal symbology for the sublayer. + * + * @function loadSymbology + */ + loadSymbology() { + const e = this.config.sublayers, i = this.getLegendUrls( + e.map((r) => ({ + id: r.id, + styleLegends: r.styleLegends, + currentStyle: r.currentStyle + })) + ).map((r, n) => { + const s = e[n].name || this.getWMSLayerTitle(e[n].id) || e[n].id, o = { + uid: this.$iApi.geo.shared.generateUUID(), + label: s, + svgcode: "", + esriStandard: !1, + // is an image + drawPromise: this.$iApi.geo.symbology.generateWMSSymbology(r).then((a) => { + o.svgcode = a.svgcode, o.imgHeight = a.imgHeight, o.imgWidth = a.imgWidth; + }) + }; + return o; + }); + this.legend = i; + } +} +class w3i extends I0e { + constructor(e, i) { + super(e, i), this.layerType = rn.WFS; + } + async onInitiate() { + const e = new IQ(this.config.url), { offset: i, limit: r } = e.queryMap; + this.sourceGeoJson || (this.sourceGeoJson = await this.$iApi.geo.layer.ogc.loadWfsData( + this.config.url, + -1, + parseInt(i) || 0, + parseInt(r) || 1e3, + void 0, + this.config.xyInAttribs + )), await super.onInitiate(); + } +} +class bCt extends gCt { + /** + * This represents a file content transformed to our common consumption format. + * The implementation classes will handle that transformation, and common routines in this class can process + * it onInitiate. Can be in object or stringified form + */ + sourceJson; + attribs; + // since this is a mapless layer, only applies to visibility of layer in the grid + _visibility; + // ----------- LAYER CONSTRUCTION AND INITIALIZAION ----------- + constructor(e, i) { + super(e, i), this.dataFormat = Ey.ESRI_FEATURE, this.layerFormat = kb.NOLAYER, this.drawState = G_.NOT_VISUAL, this.attribs = new wCt(), this.supportsFeatures = !0, this.mapLayer = !1, this.isFile = !1, this._visibility = e.state?.visibility ?? !0, this.expectedTime.draw = 0; + } + async onInitiate() { + if (this.sourceJson) { + const e = typeof this.sourceJson == "string" ? JSON.parse(this.sourceJson) : this.sourceJson; + if (e.data.length === 0 || e.fields.length === 0) + throw new Error("Data layer with no columns or now rows."); + const i = e.fields.slice(), r = e.data[0].slice(), n = / /gi; + this.fields = i.map((o, a) => { + let l = "", c = o; + o.indexOf(" ") > -1 && (l = o, c = o.trim().replace(n, "-"), e.fields[a] = c); + const h = this.$iApi.geo.layer.files.inferType(r[a]); + return { + name: c, + alias: l, + type: h, + length: h === Ev.STRING ? 256 : void 0 + }; + }), this.oidField = "rampOID", this.fields.push({ name: this.oidField, type: Ev.OID }), e.fields.push(this.oidField), e.data.forEach((o, a) => o.push(a + 1)), this.$iApi.geo.attributes.applyFieldMetadata( + this, + this.origRampConfig.fieldMetadata + ), this.fieldList = "*"; + const s = { + batchSize: -1, + // mandatory to avoid easy bugs in server process; not used here + sourceDataJson: e, + oidField: this.oidField, + attribs: "*" + // even required? + }; + this.attribs.attLoader = new E3i( + this.$iApi, + s + ), await this.attribs.attLoader.getAttribs(), this.featureCount = e.data.length, this.origRampConfig.nameField ? this.nameField = this.$iApi.geo.attributes.fieldValidator( + this.fields, + this.origRampConfig.nameField + ) || this.oidField : this.nameField = this.oidField, this.sourceJson = void 0; + } else + throw new Error( + "Attempted to initiate file based data layer, sourceJson is missing" + ); + } + async terminate() { + await super.terminate(); + } + async reload() { + this.initiationState === Og.INITIATED && (this.$iApi.event.emit(an.LAYER_RELOAD_START, this), await this.terminate()), await this.initiate(), this.layerState !== rp.ERROR && this.onLoad(), setTimeout(() => { + this.$iApi.event.emit(an.LAYER_RELOAD_END, this); + }, 300); + } + // performs setup on the layer that needs to occur after server load but + // before we mark the layer as loaded. Any async tasks must + // include their promise in the return array. + onLoadActions() { + const e = super.onLoadActions(); + return this.legend = [ + { + uid: this.$iApi.geo.shared.generateUUID(), + label: "", + svgcode: "", + esriStandard: !0, + visibility: !0, + lastVisbility: !0, + drawPromise: this.getIcon(0).then((i) => { + this.legend[0].svgcode = i; + }) + } + ], e; + } + // ----------- Attribute Methods ----------- + /** + * Invokes the process to get the full set of attribute values for the layer. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of attribute values + */ + getAttributes() { + return this.attribs.attLoader.getAttribs(); + } + /** + * Invokes the process to get the full set of attribute values for the layer, + * formatted in a tabular format. Additional data properties are also included. + * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. + * + * @returns {Promise} resolves with set of tabular attribute values + */ + getTabularAttributes() { + return this.$iApi.geo.attributes.generateTabularAttributes( + this, + this.attribs + ); + } + /** + * Gets information on a graphic in the most efficient way possible. + * The options parameter is ignored for data layers, since attributes is the only valid item + * to request + * + * @param {Integer} objectId the object id of the graphic to find + * @param {Object} options options object for the request. Ignored for data layers + * @returns {Promise} resolves with a Graphic containing the requested information + */ + async getGraphic(e, i) { + let r = {}; + if (this.attribs.attLoader.isLoaded()) { + const n = await this.attribs.attLoader.getAttribs(); + r = n.features[n.oidIndex[e]]; + } else + throw new Error( + "Non ESRI data layer did not have attributes populated." + ); + return new bx(new g8(), "", r); + } + /** + * Gets the icon for a specific feature, as an SVG string. + * + * @param {Integer} objectId the object id of the feature to find + * @returns {Promise} resolves with an svg string encoding of the icon + */ + async getIcon(e) { + return 'D'; + } + async getFilterOIDs(e = [], i = void 0) { + } + /** + * Since data layers (except table layers) do not have asynch attribute loading, there is nothing to do here. + * However, we have it there just so that calling this method for a giant list is peaceful, and filtering + * by layer type is not required. + */ + abortAttributeLoad() { + } + /** + * Since data layers (except table layers) do not have asynch attribute loading, there is nothing to do here. + * However, we have it there just so that calling this method for a giant list is peaceful, and filtering + * by layer type is not required. + */ + attribLoadAborted() { + return !1; + } + /** + * Since data layers (except table layers) do not have asynch attribute loading, there is nothing to do here. + * However, we have it there just so that calling this method for a giant list is peaceful, and filtering + * by layer type is not required. + */ + clearFeatureCache() { + } + /** + * The number of attributes currently downloaded (will update as download progresses) + * @returns current download count + */ + downloadedAttributes() { + return this.featureCount; + } + /** + * Override for data layers. + * Used to determine if layer is available for use. + */ + get layerExists() { + return this.isLoaded; + } + /** + * Returns the visibility of the layer data + * + * @returns {Boolean} visibility of the layer data + */ + get visibility() { + return this._visibility; + } + /** + * Applies visibility to layer data. + * + * @param {Boolean} value the new visibility setting + */ + set visibility(e) { + this._visibility !== e && (this._visibility = e, this.$iApi.event.emit(an.LAYER_VISIBILITYCHANGE, { + visibility: e, + layer: this + })); + } +} +class x3i extends bCt { + constructor(e, i) { + super(e, i), this.layerType = rn.DATAJSON; + } + async onInitiate() { + if (this.origRampConfig.rawData && (typeof this.origRampConfig.rawData == "string" || this.origRampConfig.rawData instanceof Object)) + this.sourceJson = this.origRampConfig.rawData; + else if (this.origRampConfig.url) + this.sourceJson = await this.$iApi.geo.layer.files.fetchFileData( + this.origRampConfig.url, + this.layerType + ); + else + throw new Error( + "Json Data layer config contains no raw data or url" + ); + await super.onInitiate(); + } +} +class S3i extends bCt { + // TODO if we add AQL filtering to the file based data layers, this prop and the appropriate initializers/methods should migrate to DataLayer + filter; + serviceUrl; + constructor(e, i) { + super(e, i), this.layerType = rn.DATATABLE, this.serviceUrl = e.url, this.filter = new nbt( + e.permanentFilteredQuery || "", + e.initialFilteredQuery || "" + ); + } + async onInitiate() { + } + /** + * Triggers when the layer loads. + * + * @function onLoadActions + */ + onLoadActions() { + const e = super.onLoadActions(), r = this.$iApi.geo.shared.parseUrlIndex(this.serviceUrl).index || 0, n = this.$iApi.geo.layer.loadLayerMetadata(this.serviceUrl).then((o) => { + this.name || (this.name = o.name), this.layerTree.name = this.name, this.oidField = o.objectIdField, this.nameField = this.origRampConfig.nameField || o.displayField || "", this.fields = o.fields, this.$iApi.geo.attributes.applyFieldMetadata( + this, + this.origRampConfig.fieldMetadata + ); + const a = { + // version number is only provided on 10.0 SP1 servers and up. + // servers 10.1 and higher support the query limit flag + supportsLimit: (o.currentVersion || 1) >= 10.1, + serviceUrl: this.serviceUrl, + oidField: this.oidField, + batchSize: -1, + attribs: this.fieldList, + permanentFilter: this.getSqlFilter(cm.PERMANENT) + }; + this.attribs.attLoader = new xCt( + this.$iApi, + a + ), this.attribs.quickCache = new SCt(this.geomType); + }), s = this.$iApi.geo.layer.loadFeatureCount( + this.serviceUrl, + this.getSqlFilter(cm.PERMANENT) + ).then((o) => { + this.featureCount = o; + }); + return this.layerTree.layerIdx = r, e.push(n, s), e; + } + async getGraphic(e, i) { + let r = {}; + const n = this.attribs.quickCache.getAttribs(e); + if (n) + r = n; + else if (this.attribs.attLoader.isLoaded()) { + const o = await this.attribs.attLoader.getAttribs(); + r = o.features[o.oidIndex[e]]; + } else { + const o = { + oid: e, + serviceUrl: this.serviceUrl, + includeGeometry: !1, + attribs: this.fieldList + }, a = await this.$iApi.geo.attributes.loadSingleFeature( + o + ); + this.attribs.quickCache.setAttribs(e, a.attributes), r = a.attributes; + } + return new bx(new g8(), "", r); + } + /** + * Requests that an attribute load request be aborted. Useful when encountering a massive dataset or a runaway process. + */ + abortAttributeLoad() { + this.attribs.attLoader.abortAttribLoad(); + } + /** + * Requests that any downloaded attribute sets or cached geometry be removed from memory. The next requests will pull from the server again. + */ + clearFeatureCache() { + this.attribs.clearAll(); + } + /** + * The number of attributes currently downloaded (will update as download progresses) + * @returns current download count + */ + downloadedAttributes() { + return this.isLoaded ? this.attribs.attLoader.loadCount() : 0; + } + /** + * Indicates if the attribute load has been aborted. + * @returns boolean if the process has been stopped + */ + attribLoadAborted() { + return this.isLoaded ? this.attribs.attLoader.isLoadAborted() : !1; + } + // -- filter stuff -- + // A lot of overlap & duplication with AttribLayer. Currently don't have a good sharing mechansim. + // Most of these methods are small so abstracting to geo.attribs seems equally pointless. + // Making a common class between data and attribute layers adds in other duplications for the non-attribute-layer stuff. + // This set of methods is more streamlined since there are no layer/extent stuff to deal with. + /** + * Applies an SQL filter to the layer. Will overwrite any existing filter for the given key. + * Use `1=2` for a "hide all" where clause. + * + * @param {String} filterKey the filter key / named filter to apply the SQL to + * @param {String} whereClause the WHERE clause of the filter + */ + setSqlFilter(e, i) { + const r = this.filter.getSql(e); + i !== r && (this.filter.setSql(e, i), this.$iApi.event.emit(an.FILTER_CHANGE, { + uid: this.uid, + filterKey: e + })); + } + /** + * Returns the value of a named SQL filter on the layer. + * + * @param {String} filterKey the filter key / named filter to view + * @returns {String} the value of the where clause for the filter. Empty string if not defined. + */ + getSqlFilter(e) { + return this.filter.getSql(e); + } + /** + * Returns a SQL WHERE condition that is combination of active filters. + * + * @method getCombinedSqlFilter + * @param {Array} [exclusions] list of any filter keys to exclude from the result. omission includes all filters + * @returns {String} all non-excluded sql statements connected with AND operators. + */ + getCombinedSqlFilter(e) { + return this.filter.getCombinedSql(e); + } + /** + * Gets array of object ids that currently pass any filters + * + * @function getFilterOIDs + * + * @param {Array} [exclusions] list of any filters keys to exclude from the result. omission includes all filters + * @param {Extent} [extent] ignored for Data Layer. param exists for consistency. + * @returns {Promise} resolves with array of object ids that pass the filter. if no filters are active, resolves with undefined. + */ + async getFilterOIDs(e = [], i = void 0) { + const r = this.filter.getCombinedSql(e); + if (!r) + return; + const n = this.filter.sqlActiveFilters(e); + let s = this.filter.getCache(n, !1); + if (!s) { + const o = { + filterSql: r, + includeGeometry: !1 + }; + s = this.queryOIDs(o), this.filter.setCache(s, n, !1); + } + return s; + } + /** + * Will return an array of object ids for features in the layer that satisfy the conditions of the query options parameter. + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves with an array of numbers (object ids) + */ + queryOIDs(e) { + const i = { + url: this.serviceUrl, + ...e + }; + return this.$iApi.geo.query.arcGisServerQueryIds(i); + } + /** + * Requests a set of features for this layer that match the criteria of the options + * - filterGeometry : a RAMP API geometry to restrict results to + * - filterSql : a where clause to apply against feature attributes + * - includeGeometry : a boolean to indicate if result features should include the geometry + * - sourceSR : a spatial reference indicating what the source layer is encoded in. providing can assist in result geometry being of a proper resolution + * + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves in an array of object ids and promises resolving in each feature + */ + async queryFeaturesDiscrete(e) { + const i = await this.queryOIDs(e), r = { + getAttribs: !0 + }; + return i.map((n) => ({ + oid: n, + graphic: this.getGraphic(n, r) + })); + } + /** + * Requests a set of features for this layer that match the criteria of the options + * - filterSql : a where clause to apply against feature attributes + * - outFields : a string of comma separated field names. will restrict fields included in the output + * + * @param options {Object} options to provide filters and helpful information. + * @returns {Promise} resolves with an array of features that satisfy the criteria + */ + async queryFeatures(e) { + const i = await this.queryFeaturesDiscrete(e); + return Promise.all(i.map((r) => r.graphic)); + } +} +class C3i extends cf { + /** + * Will populate the object id index for an attribute set. + * + * @param attSet attribute set that has features populated + * @param oidField name of the object id field in the attribute set + */ + oidIndexer(e, i) { + e.features.forEach((r, n) => { + e.oidIndex[r[i]] = n; + }); + } + /** + * Will load an attribute set from an ArcGIS Server, recursively batching to work around maximum result limits. + * + * @param details defines the parameters for what to load + * @param controller the controller which provides asyncronous hooks into the load, including loaded count and ability to abort + */ + async arcGisBatchLoad(e, i) { + if (i.loadAbortFlag) + return []; + const r = e.permanentFilter ? ` AND ${e.permanentFilter}` : "", n = { + query: { + where: `${e.oidField}>${e.maxId}${r}`, + outFields: e.attribs, + orderByFields: e.oidField, + returnGeometry: "false", + f: "json" + } + }, [s, o] = await ZF( + ir(e.serviceUrl + "/query", n) + ); + if (!o) + return console.error( + `ArcGIS batch load error: ${e.serviceUrl}`, + s + ), Promise.reject( + new Error(`ArcGIS batch load error: ${e.serviceUrl}`) + ); + if (!o.data || !o.data.features) + return console.error( + `ArcGIS batch load gave no data/features: ${e.serviceUrl}` + ), Promise.reject( + new Error( + `ArcGIS batch load gave no data/features: ${e.serviceUrl}` + ) + ); + const a = o.data.features, l = a.length; + if (l > 0) { + i.loadedCount += l; + let c; + if (e.supportsLimit ? c = o.data.exceededTransferLimit : (e.batchSize === -1 && (e.batchSize = l), c = l >= e.batchSize), c) { + e.maxId = a[l - 1].attributes[e.oidField]; + const h = await this.arcGisBatchLoad( + e, + i + ); + return i.loadAbortFlag ? [] : a.concat(h); + } else + return i.loadAbortFlag ? [] : a; + } else + return []; + } + /** + * Will load an attribute set from an ArcGIS Server layer source. + * + * @param details defines the parameters for what to load + * @param controller the controller which provides asyncronous hooks into the load, including loaded count and ability to abort + */ + async loadArcGisServerAttributes(e, i) { + e.maxId = -1, e.batchSize = -1; + const n = { + features: (await this.arcGisBatchLoad( + e, + i + )).map((s) => s.attributes), + oidIndex: {} + }; + return this.oidIndexer(n, e.oidField), i.loadIsDone = !0, n; + } + /** + * Will generate an attribute set from a feature layer with local data (i.e. a file layer). + * + * @param details defines the parameters for what to load + * @param controller the controller which provides asyncronous hooks into the load, including loaded count and ability to abort + */ + async loadGraphicsAttributes(e, i) { + if (!e.sourceGraphics) + throw new Error( + "No .sourceGraphics provided to file layer attribute loader" + ); + const n = { + features: e.sourceGraphics.map( + (s) => eo(s).attributes + ).toArray(), + oidIndex: {} + }; + return this.oidIndexer(n, e.oidField), i.loadIsDone = !0, i.loadedCount = n.features.length, n; + } + /** + * Will generate an attribute set from a compact json object. This is our base format for + * DataLayer sources that are not hosted on ArcGIS server. Provided sourceDataJson on the details + * parameter has already been cleaned and has object ids inserted. + * + * @param details defines the parameters for what to load + * @param controller the controller which provides asyncronous hooks into the load, including loaded count and ability to abort + */ + async loadCompactJsonAttributes(e, i) { + if (!e.sourceDataJson) + throw new Error( + "No .sourceDataJson provided to file data-layer attribute loader" + ); + const r = e.sourceDataJson.fields, s = { + features: e.sourceDataJson.data.map((o) => { + const a = {}; + return o.forEach((l, c) => { + a[r[c]] = l; + }), a; + }), + oidIndex: {} + }; + return this.oidIndexer(s, e.oidField), i.loadIsDone = !0, i.loadedCount = s.features.length, e.sourceDataJson = void 0, s; + } + async loadSingleFeature(e) { + const i = { + query: { + f: "json", + objectIds: e.oid, + returnGeometry: e.includeGeometry, + outFields: e.attribs + } + }; + typeof e.maxOffset < "u" && (i.query.maxAllowableOffset = e.maxOffset), typeof e.mapSR < "u" && (i.query.outSR = e.mapSR), typeof e.geometryPrecision < "u" && e.geometryPrecision >= 0 && (i.query.geometryPrecision = e.geometryPrecision); + const [r, n] = await ZF( + ir(e.serviceUrl + "/query", i) + ); + if (!n) + return console.error( + `ArcGIS single feature load error: ${e.serviceUrl}`, + r + ), Promise.reject( + new Error( + `ArcGIS single feature load error: ${e.serviceUrl}` + ) + ); + if (!n.data || !n.data.features) + return console.error( + `Could not locate feature ${e.oid} for layer ${e.serviceUrl}` + ), Promise.reject( + new Error( + `Could not locate feature ${e.oid} for layer ${e.serviceUrl}` + ) + ); + const s = n.data.features; + if (s.length > 0) { + const o = s[0]; + let a; + if (e.includeGeometry) { + o.geometry.spatialReference = n.data.spatialReference; + const l = Sl(o.geometry); + a = this.$iApi.geo.geom.geomEsriToRamp(l); + } else + a = new g8(); + return new bx(a, "", o.attributes); + } + return Promise.reject( + new Error( + `Could not locate feature ${e.oid} for layer ${e.serviceUrl}` + ) + ); + } + /** + * Will order the fields of a layer based on its fieldInfo. + * + * @param currentFields the current order of the fields + * @param orderInfo the fieldInfo config that contains the order the fields should be displayed in + */ + orderFields(e, i) { + const r = (s, o) => s.findIndex( + (a) => a.name === o + ), n = (s, o) => { + const a = r(i, s.name), l = r(i, o.name); + return a === -1 && l === -1 ? r(e, s.name) - r(e, o.name) : a === -1 ? 1 : l === -1 ? -1 : a - l; + }; + return e.slice().sort(n); + } + /** + * Will apply any field config metadata to a layer. + * Should be used after loading process has populated .fields property of the layer + * + * @param layer the layer to apply the additional configuration to. Will be modified. + * @param fieldMetadata field settings from the config object. can be undefined + */ + applyFieldMetadata(e, i = void 0) { + if (!i || !i.fieldInfo) { + e.fieldList = "*"; + return; + } + if (i?.enforceOrder && i?.fieldInfo && i?.fieldInfo.length > 0 && (e.fields = this.orderFields( + e.fields, + i.fieldInfo + ), e.fieldList = i.fieldInfo.map((r) => r.name).join(",")), i.exclusiveFields) { + i.fieldInfo.find((n) => n.name === e.oidField) || i.fieldInfo.push({ name: e.oidField }), e.fieldList = i.fieldInfo.map((n) => n.name).join(","); + const r = i.fieldInfo; + e.fields = e.fields.filter((n) => r.find((s) => s.name === n.name)); + } else + e.fieldList = "*"; + i.fieldInfo.forEach((r) => { + if (r.alias) { + const n = e.fields.find((s) => s.name === r.name); + n && (n.alias = r.alias); + } + }); + } + /** + * Util function to manage trickery. Non-Arcgis layer sources can have field names that are bad keys. + * Our loader will have corrected them, but the ramp layer config may still be referencing the original names + * (e.g. nameField, tooltipField). + * This function will attempt to return the valid field name for a given original field name. + * + * @param fields array of valid fields for the layer + * @param originalName field name as defined in the source + * @returns a valid field name to use. Empty string if none found + */ + fieldValidator(e, i) { + if (e.findIndex((r) => r.name === i) === -1) { + const r = e.find((n) => n.alias === i); + return r ? r.name : (console.warn( + `Cannot find name field in layer field list: ${i}` + ), ""); + } else + return i; + } + /** + * Will generate the tabular transformation of an attribute set for a layer. + * The result will also be cached in the attribute source. + * If the result is already cached, it will be returned. + * The layer must be the owner of the attribute source. + * This method is generally called from an internal call within a layer. + * It exists as a public API to allow re-use across diverging layer types. + * + * @param layer the layer owning the attributes and the attribute source + * @param attSource the attribute source for the attributes to transform + */ + async generateTabularAttributes(e, i) { + return i.attLoader.tabularAttributesCache || (i.attLoader.tabularAttributesCache = this.$iApi.geo.attributes.generateTabularAttributesWorker( + e, + i + )), i.attLoader.tabularAttributesCache; + } + /** + * Worker method for the above generateTabularAttributes call. + * Separating allows us to use async syntax for the heavy lifting, + * but provides a promise via method that can easily be assigned to the + * cache. Difficult to save your own async promise within your own method. + * + * @param layer the layer owning the attributes and the attribute source + * @param attSource the attribute source for the attributes to transform + */ + async generateTabularAttributesWorker(e, i) { + if (e.dataFormat === Ey.ESRI_RASTER) + throw new Error("Attempting to get attributes on a raster layer."); + const r = await i.attLoader.getAttribs(); + if (!r.features || r.features.length === 0) + return { + columns: [], + rows: [], + fields: [], + oidField: "" + }; + const n = e.fields.filter( + (o) => ( + // assuming there is at least one attribute - empty attribute bundle promises should be rejected, so it never even gets this far + // filter out fields where there is no corresponding attribute data + Object.prototype.hasOwnProperty.call( + r.features[0], + eo(o).name + ) + ) + ).map((o) => ({ + data: eo(o).name, + // TODO calling this data is really unintuitive. consider global rename to fieldName, name, attribName, etc. + title: eo(o).alias || eo(o).name + })), s = r.features.map((o) => { + const a = Uz({}, o); + return a.rvInteractive = "", a.rvSymbol = e.getIcon(o[e.oidField]), a.rvUid = e.uid, a; + }); + return n.forEach((o) => { + if (o.data.slice(-2) === "()") { + const a = function() { + return this[o.data]; + }, l = o.data.slice(0, -2); + s.forEach((c) => { + c[l] = a; + }); + } + }), { + columns: n, + rows: s, + fields: e.fields, + // keep fields for reference ... + oidField: e.oidField + // ... keep a reference to id field ... + }; + } +} +class wCt { + /** + * Actual attribute loader, if exists + */ + _attribLoader; + /** + * Actual quick cache, if exists + */ + _quickCache; + /** + * Used to access the attribute loader in layer classes + */ + get attLoader() { + if (this._attribLoader) + return this._attribLoader; + throw console.trace(), new Error( + "Attempted to load attributes prior to layer being loaded." + ); + } + set attLoader(e) { + this._attribLoader = e; + } + /** + * Used to access the quick cache in layer classes + */ + get quickCache() { + if (this._quickCache) + return this._quickCache; + throw console.trace(), new Error( + "Attempted to access attribute cache prior to layer being loaded." + ); + } + set quickCache(e) { + this._quickCache = e; + } + /** + * Erase all local data in this object + */ + clearAll() { + this._attribLoader && this._attribLoader.destroyAttribs(), this._quickCache && this._quickCache.clearAll(); + } +} +class WXe { + loadedCount; + loadAbortFlag; + loadIsDone; + constructor() { + this.loadedCount = 0, this.loadAbortFlag = !1, this.loadIsDone = !1; + } +} +class n$e extends cf { + aac; + loadPromise; + details; + tabularAttributesCache; + constructor(e, i) { + super(e), this.aac = new WXe(), this.details = i; + } + /** + * Allows the list of field names to download to be updated. Allows support for divergant loading + * flows between different layers. + * + * @param {string} newList + */ + updateFieldList(e) { + this.details.attribs = e; + } + getAttribs() { + return this.loadPromise || (this.aac = new WXe(), this.loadPromise = this.loadPromiseGenerator()), this.loadPromise; + } + abortAttribLoad() { + this.aac.loadAbortFlag = !0; + } + destroyAttribs() { + this.loadPromise = void 0, this.tabularAttributesCache = void 0, this.aac.loadIsDone = !1, this.aac.loadedCount = 0; + } + loadCount() { + return this.aac.loadedCount; + } + isLoaded() { + return this.aac.loadIsDone; + } + isLoadAborted() { + return this.aac.loadAbortFlag; + } + // this will be overrideable. + // so one function for arcgis server. another for baked featurelayer. another for json file source + loadPromiseGenerator() { + return Promise.reject( + new Error( + "Subclass of AttributeLoaderBase did not implement loadPromiseGenerator" + ) + ); + } +} +class xCt extends n$e { + constructor(e, i) { + super(e, i); + } + loadPromiseGenerator() { + return this.$iApi.geo.attributes.loadArcGisServerAttributes( + this.details, + this.aac + ); + } +} +class T3i extends n$e { + constructor(e, i) { + super(e, i); + } + loadPromiseGenerator() { + return this.$iApi.geo.attributes.loadGraphicsAttributes( + this.details, + this.aac + ); + } +} +class E3i extends n$e { + constructor(e, i) { + super(e, i); + } + loadPromiseGenerator() { + return this.$iApi.geo.attributes.loadCompactJsonAttributes( + this.details, + this.aac + ); + } +} +class SCt { + attribs; + // the "any" type here is funny. for points, its BaseGeometry, for line/poly based, it's an object indexed by scale, + // which then containts an object indexed by key (likely oid) and returns BaseGeometry. + // will keep as any since it's private and the interfaces are casting to BaseGeometry. otherwise would need type shenannigans. + geoms; + // extents for feature layer graphics that do not have a point geometry + extents; + isPoint; + constructor(e) { + this.attribs = {}, this.geoms = {}, this.extents = {}, this.isPoint = e === "point"; + } + getScaleStore(e) { + return this.geoms[e] || (this.geoms[e] = {}), this.geoms[e]; + } + getGeomStore(e = void 0) { + if (this.isPoint) + return this.geoms; + if (typeof e > "u") + throw new Error( + "Attempted to access geometry store for non-point layer without providing a map scale" + ); + return this.getScaleStore(e); + } + getAttribs(e) { + return this.attribs[e]; + } + setAttribs(e, i) { + this.attribs[e] = i; + } + getGeom(e, i = void 0) { + return this.getGeomStore(i)[e]; + } + setGeom(e, i, r = void 0) { + const n = this.getGeomStore(r); + n[e] = i; + } + getExtent(e) { + return this.extents[e]; + } + setExtent(e, i) { + this.extents[e] = i; + } + clearAll() { + this.attribs = {}, this.geoms = {}, this.extents = {}; + } +} +class s$e { + innerRenderer; + symbolUnits; + defaultUnit; + type; + falseRenderer; + // falseRenderer is set to true when we are creating a fake renderer to facilitate generating a legend from + // a non-feature service, like a tile layer or imagery layer. + constructor(e, i, r = !1) { + this.innerRenderer = e, this.symbolUnits = [], this.falseRenderer = r, this.type = Xme.Unknown; + } + // this function takes a set of attributes and extracts a value that can be used to match the owner of the attributes + // to a part of a renderer. Use `any` result as the type can vary between renderers. + makeSearchParams(e) { + return e; + } + searchRenderer(e) { + const i = this.makeSearchParams(e), r = this.symbolUnits.find( + (s) => s.match(i) + ); + if (r) + return r; + if (this.defaultUnit) + return this.defaultUnit; + console.error(`renderer search could not find match for ${i}`); + const n = new A0e(this); + return n.svgCode = "", n; + } + getGraphicIcon(e) { + return this.searchRenderer(e).svgCode; + } + getGraphicSymbol(e) { + return this.searchRenderer(e).symbol; + } + rendererToLegend() { + throw new Error("rendererToLegend not implemented in subclass"); + } + // worker function. determines if a field value should be wrapped in + // any character and returns the character. E.g. string would return ', numbers return empty string. + getFieldDelimiter(e, i) { + let r = "'"; + if (!i || i.length === 0) + return r; + const n = i.find((s) => s.name === e); + return n && n.type && n.type !== "string" && (r = ""), r; + } + // worker function + // corrects for any character-case discrepancy for field names in the renderer vs on the layer + cleanFieldName(e, i) { + if (!e) + return e; + let r = i.find((n) => n.name === e); + if (r) + return e; + { + const n = e.toLowerCase(); + return r = i.find((s) => s.name.toLowerCase() === n), r ? r.name : e; + } + } + makeElseClause() { + return this.falseRenderer ? "" : `(NOT (${this.symbolUnits.map((i) => i.definitionClause).join(" OR ")}))`; + } +} +class A0e { + isDefault = !1; + svgCode = ""; + symbol; + definitionClause = ""; + label = ""; + parent; + constructor(e) { + this.parent = e, this.symbol = new Md(); + } + match(e) { + return !!e; + } +} +class I3i extends s$e { + constructor(e, i) { + super(e, i), this.type = Xme.Simple; + const r = new A0e(this); + r.label = e.label || "", r.symbol = e.symbol, r.definitionClause = "", this.symbolUnits.push(r); + } +} +class A3i extends s$e { + delim; + keyFields; + constructor(e, i, r = !1) { + super(e, i, r), this.type = Xme.Unique, this.delim = e.fieldDelimiter || ", "; + const n = (o) => o.replace(/'/g, "''"); + this.keyFields = [ + e.field, + e.field2, + e.field3 + ].filter((o) => o).map((o) => this.cleanFieldName(o, i)); + const s = this.keyFields.map( + (o) => this.getFieldDelimiter(o, i) + ); + if (e.uniqueValueInfos.forEach((o) => { + const a = new qXe(this, o.value); + if (a.label = o.label || "", a.symbol = o.symbol, !this.falseRenderer) { + const l = a.matchValue.split( + this.delim + ), c = this.keyFields.map( + (h, p) => l[p] === "" ? `${h} IS NULL` : `${h} = ${s[p]}${n( + l[p] + )}${s[p]}` + ).join(" AND "); + a.definitionClause = `(${c})`, a.matchValue = a.matchValue.replace(//g, ""); + } + this.symbolUnits.push(a); + }), e.defaultSymbol) { + const o = new qXe(this, ""); + o.isDefault = !0, o.label = e.defaultLabel || "", o.symbol = e.defaultSymbol, o.definitionClause = this.makeElseClause(), this.defaultUnit = o; + } + } + makeSearchParams(e) { + return this.keyFields.map((i) => { + let r = e[i] === null ? "" : e[i]; + return typeof r != "string" && (r = r.toString()), r; + }).join(this.delim); + } +} +class qXe extends A0e { + matchValue; + constructor(e, i) { + super(e), typeof i == "number" ? this.matchValue = i.toString() : this.matchValue = i; + } + match(e) { + return this.matchValue === e; + } +} +class P3i extends s$e { + valField; + constructor(e, i, r = !1) { + if (super(e, i, r), this.valField = this.cleanFieldName(e.field, i), e.classBreakInfos.forEach((n) => { + const s = new YXe( + this, + n.minValue, + n.maxValue + ); + s.label = n.label || "", s.symbol = n.symbol, this.falseRenderer || (s.definitionClause = `(${this.valField} > ${n.minValue} AND ${this.valField} <= ${n.maxValue})`), this.symbolUnits.push(s); + }), e.defaultSymbol) { + const n = new YXe(this, 0, 0); + n.isDefault = !0, n.label = e.defaultLabel || "", n.symbol = e.defaultSymbol, n.definitionClause = this.makeElseClause(), this.defaultUnit = n; + } + } + makeSearchParams(e) { + return parseFloat(e[this.valField]); + } +} +class YXe extends A0e { + minValue; + // min is exclusive + maxValue; + // max is inclusive + constructor(e, i, r) { + super(e), this.minValue = i, this.maxValue = r; + } + match(e) { + return this.minValue === this.maxValue ? this.maxValue === e : this.minValue < e && this.maxValue >= e; + } +} +var CCt = { exports: {} }; +/*! +* svg.js - A lightweight library for manipulating and animating SVG. +* @version 2.7.1 +* https://svgdotjs.github.io/ +* +* @copyright Wout Fierens +* @license MIT +* +* BUILT: Fri Nov 30 2018 10:01:55 GMT+0100 (GMT+01:00) +*/ +(function(t, e) { + (function(i, r) { + t.exports = i.document ? r(i, i.document) : function(n) { + return r(n, n.document); + }; + })(typeof window < "u" ? window : td, function(i, r) { + var n = typeof this < "u" ? this : i, s = n.SVG = function(J) { + if (s.supported) + return J = new s.Doc(J), s.parser.draw || s.prepare(), J; + }; + if (s.ns = "http://www.w3.org/2000/svg", s.xmlns = "http://www.w3.org/2000/xmlns/", s.xlink = "http://www.w3.org/1999/xlink", s.svgjs = "http://svgjs.com/svgjs", s.supported = function() { + return !!r.createElementNS && !!r.createElementNS(s.ns, "svg").createSVGRect; + }(), !s.supported) + return !1; + s.did = 1e3, s.eid = function(J) { + return "Svgjs" + P(J) + s.did++; + }, s.create = function(J) { + var ce = r.createElementNS(this.ns, J); + return ce.setAttribute("id", this.eid(J)), ce; + }, s.extend = function() { + var J, ce, xe, Pe; + for (J = [].slice.call(arguments), ce = J.pop(), Pe = J.length - 1; Pe >= 0; Pe--) + if (J[Pe]) + for (xe in ce) + J[Pe].prototype[xe] = ce[xe]; + s.Set && s.Set.inherit && s.Set.inherit(); + }, s.invent = function(J) { + var ce = typeof J.create == "function" ? J.create : function() { + this.constructor.call(this, s.create(J.create)); + }; + return J.inherit && (ce.prototype = new J.inherit()), J.extend && s.extend(ce, J.extend), J.construct && s.extend(J.parent || s.Container, J.construct), ce; + }, s.adopt = function(J) { + if (!J) + return null; + if (J.instance) + return J.instance; + var ce; + return J.nodeName == "svg" ? ce = J.parentNode instanceof i.SVGElement ? new s.Nested() : new s.Doc() : J.nodeName == "linearGradient" ? ce = new s.Gradient("linear") : J.nodeName == "radialGradient" ? ce = new s.Gradient("radial") : s[P(J.nodeName)] ? ce = new s[P(J.nodeName)]() : ce = new s.Element(J), ce.type = J.nodeName, ce.node = J, J.instance = ce, ce instanceof s.Doc && ce.namespace().defs(), ce.setData(JSON.parse(J.getAttribute("svgjs:data")) || {}), ce; + }, s.prepare = function() { + var J = r.getElementsByTagName("body")[0], ce = (J ? new s.Doc(J) : s.adopt(r.documentElement).nested()).size(2, 0); + s.parser = { + body: J || r.documentElement, + draw: ce.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").attr("focusable", "false").node, + poly: ce.polyline().node, + path: ce.path().node, + native: s.create("svg") + }; + }, s.parser = { + native: s.create("svg") + }, r.addEventListener("DOMContentLoaded", function() { + s.parser.draw || s.prepare(); + }, !1), s.regex = { + // Parse unit value + numberAndUnit: /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i, + hex: /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, + rgb: /rgb\((\d+),(\d+),(\d+)\)/, + reference: /#([a-z0-9\-_]+)/i, + transforms: /\)\s*,?\s*/, + whitespace: /\s/g, + isHex: /^#[a-f0-9]{3,6}$/i, + isRgb: /^rgb\(/, + isCss: /[^:]+:[^;]+;?/, + isBlank: /^(\s+)?$/, + isNumber: /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, + isPercent: /^-?[\d\.]+%$/, + isImage: /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i, + delimiter: /[\s,]+/, + hyphen: /([^e])\-/gi, + pathLetters: /[MLHVCSQTAZ]/gi, + isPathLetter: /[MLHVCSQTAZ]/i, + numbersWithDots: /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi, + dots: /\./g + }, s.utils = { + // Map function + map: function(J, ce) { + var xe, Pe = J.length, Oe = []; + for (xe = 0; xe < Pe; xe++) + Oe.push(ce(J[xe])); + return Oe; + }, + filter: function(J, ce) { + var xe, Pe = J.length, Oe = []; + for (xe = 0; xe < Pe; xe++) + ce(J[xe]) && Oe.push(J[xe]); + return Oe; + }, + radians: function(J) { + return J % 360 * Math.PI / 180; + }, + degrees: function(J) { + return J * 180 / Math.PI % 360; + }, + filterSVGElements: function(J) { + return this.filter(J, function(ce) { + return ce instanceof i.SVGElement; + }); + } + }, s.defaults = { + // Default attribute values + attrs: { + // fill and stroke + "fill-opacity": 1, + "stroke-opacity": 1, + "stroke-width": 0, + "stroke-linejoin": "miter", + "stroke-linecap": "butt", + fill: "#000000", + stroke: "#000000", + opacity: 1, + x: 0, + y: 0, + cx: 0, + cy: 0, + width: 0, + height: 0, + r: 0, + rx: 0, + ry: 0, + offset: 0, + "stop-opacity": 1, + "stop-color": "#000000", + "font-size": 16, + "font-family": "Helvetica, Arial, sans-serif", + "text-anchor": "start" + } + }, s.Color = function(J) { + var ce; + this.r = 0, this.g = 0, this.b = 0, J && (typeof J == "string" ? s.regex.isRgb.test(J) ? (ce = s.regex.rgb.exec(J.replace(s.regex.whitespace, "")), this.r = parseInt(ce[1]), this.g = parseInt(ce[2]), this.b = parseInt(ce[3])) : s.regex.isHex.test(J) && (ce = s.regex.hex.exec(F(J)), this.r = parseInt(ce[1], 16), this.g = parseInt(ce[2], 16), this.b = parseInt(ce[3], 16)) : typeof J == "object" && (this.r = J.r, this.g = J.g, this.b = J.b)); + }, s.extend(s.Color, { + // Default to hex conversion + toString: function() { + return this.toHex(); + }, + toHex: function() { + return "#" + k(this.r) + k(this.g) + k(this.b); + }, + toRgb: function() { + return "rgb(" + [this.r, this.g, this.b].join() + ")"; + }, + brightness: function() { + return this.r / 255 * 0.3 + this.g / 255 * 0.59 + this.b / 255 * 0.11; + }, + morph: function(J) { + return this.destination = new s.Color(J), this; + }, + at: function(J) { + return this.destination ? (J = J < 0 ? 0 : J > 1 ? 1 : J, new s.Color({ + r: ~~(this.r + (this.destination.r - this.r) * J), + g: ~~(this.g + (this.destination.g - this.g) * J), + b: ~~(this.b + (this.destination.b - this.b) * J) + })) : this; + } + }), s.Color.test = function(J) { + return J += "", s.regex.isHex.test(J) || s.regex.isRgb.test(J); + }, s.Color.isRgb = function(J) { + return J && typeof J.r == "number" && typeof J.g == "number" && typeof J.b == "number"; + }, s.Color.isColor = function(J) { + return s.Color.isRgb(J) || s.Color.test(J); + }, s.Array = function(J, ce) { + J = (J || []).valueOf(), J.length == 0 && ce && (J = ce.valueOf()), this.value = this.parse(J); + }, s.extend(s.Array, { + // Make array morphable + morph: function(J) { + if (this.destination = this.parse(J), this.value.length != this.destination.length) { + for (var ce = this.value[this.value.length - 1], xe = this.destination[this.destination.length - 1]; this.value.length > this.destination.length; ) + this.destination.push(xe); + for (; this.value.length < this.destination.length; ) + this.value.push(ce); + } + return this; + }, + settle: function() { + for (var J = 0, ce = this.value.length, xe = []; J < ce; J++) + xe.indexOf(this.value[J]) == -1 && xe.push(this.value[J]); + return this.value = xe; + }, + at: function(J) { + if (!this.destination) + return this; + for (var ce = 0, xe = this.value.length, Pe = []; ce < xe; ce++) + Pe.push(this.value[ce] + (this.destination[ce] - this.value[ce]) * J); + return new s.Array(Pe); + }, + toString: function() { + return this.value.join(" "); + }, + valueOf: function() { + return this.value; + }, + parse: function(J) { + return J = J.valueOf(), Array.isArray(J) ? J : this.split(J); + }, + split: function(J) { + return J.trim().split(s.regex.delimiter).map(parseFloat); + }, + reverse: function() { + return this.value.reverse(), this; + }, + clone: function() { + var J = new this.constructor(); + return J.value = y(this.value), J; + } + }), s.PointArray = function(J, ce) { + s.Array.call(this, J, ce || [[0, 0]]); + }, s.PointArray.prototype = new s.Array(), s.PointArray.prototype.constructor = s.PointArray, s.extend(s.PointArray, { + // Convert array to string + toString: function() { + for (var J = 0, ce = this.value.length, xe = []; J < ce; J++) + xe.push(this.value[J].join(",")); + return xe.join(" "); + }, + toLine: function() { + return { + x1: this.value[0][0], + y1: this.value[0][1], + x2: this.value[1][0], + y2: this.value[1][1] + }; + }, + at: function(J) { + if (!this.destination) + return this; + for (var ce = 0, xe = this.value.length, Pe = []; ce < xe; ce++) + Pe.push([ + this.value[ce][0] + (this.destination[ce][0] - this.value[ce][0]) * J, + this.value[ce][1] + (this.destination[ce][1] - this.value[ce][1]) * J + ]); + return new s.PointArray(Pe); + }, + parse: function(J) { + var ce = []; + if (J = J.valueOf(), Array.isArray(J)) { + if (Array.isArray(J[0])) + return J.map(function(Oe) { + return Oe.slice(); + }); + if (J[0].x != null) + return J.map(function(Oe) { + return [Oe.x, Oe.y]; + }); + } else + J = J.trim().split(s.regex.delimiter).map(parseFloat); + J.length % 2 !== 0 && J.pop(); + for (var xe = 0, Pe = J.length; xe < Pe; xe = xe + 2) + ce.push([J[xe], J[xe + 1]]); + return ce; + }, + move: function(J, ce) { + var xe = this.bbox(); + if (J -= xe.x, ce -= xe.y, !isNaN(J) && !isNaN(ce)) + for (var Pe = this.value.length - 1; Pe >= 0; Pe--) + this.value[Pe] = [this.value[Pe][0] + J, this.value[Pe][1] + ce]; + return this; + }, + size: function(J, ce) { + var xe, Pe = this.bbox(); + for (xe = this.value.length - 1; xe >= 0; xe--) + Pe.width && (this.value[xe][0] = (this.value[xe][0] - Pe.x) * J / Pe.width + Pe.x), Pe.height && (this.value[xe][1] = (this.value[xe][1] - Pe.y) * ce / Pe.height + Pe.y); + return this; + }, + bbox: function() { + return s.parser.poly.setAttribute("points", this.toString()), s.parser.poly.getBBox(); + } + }); + for (var o = { + M: function(J, ce, xe) { + return ce.x = xe.x = J[0], ce.y = xe.y = J[1], ["M", ce.x, ce.y]; + }, + L: function(J, ce) { + return ce.x = J[0], ce.y = J[1], ["L", J[0], J[1]]; + }, + H: function(J, ce) { + return ce.x = J[0], ["H", J[0]]; + }, + V: function(J, ce) { + return ce.y = J[0], ["V", J[0]]; + }, + C: function(J, ce) { + return ce.x = J[4], ce.y = J[5], ["C", J[0], J[1], J[2], J[3], J[4], J[5]]; + }, + S: function(J, ce) { + return ce.x = J[2], ce.y = J[3], ["S", J[0], J[1], J[2], J[3]]; + }, + Q: function(J, ce) { + return ce.x = J[2], ce.y = J[3], ["Q", J[0], J[1], J[2], J[3]]; + }, + T: function(J, ce) { + return ce.x = J[0], ce.y = J[1], ["T", J[0], J[1]]; + }, + Z: function(J, ce, xe) { + return ce.x = xe.x, ce.y = xe.y, ["Z"]; + }, + A: function(J, ce) { + return ce.x = J[5], ce.y = J[6], ["A", J[0], J[1], J[2], J[3], J[4], J[5], J[6]]; + } + }, a = "mlhvqtcsaz".split(""), l = 0, c = a.length; l < c; ++l) + o[a[l]] = function(J) { + return function(ce, xe, Pe) { + if (J == "H") + ce[0] = ce[0] + xe.x; + else if (J == "V") + ce[0] = ce[0] + xe.y; + else if (J == "A") + ce[5] = ce[5] + xe.x, ce[6] = ce[6] + xe.y; + else + for (var Oe = 0, Re = ce.length; Oe < Re; ++Oe) + ce[Oe] = ce[Oe] + (Oe % 2 ? xe.y : xe.x); + return o[J](ce, xe, Pe); + }; + }(a[l].toUpperCase()); + s.PathArray = function(J, ce) { + s.Array.call(this, J, ce || [["M", 0, 0]]); + }, s.PathArray.prototype = new s.Array(), s.PathArray.prototype.constructor = s.PathArray, s.extend(s.PathArray, { + // Convert array to string + toString: function() { + return re(this.value); + }, + move: function(J, ce) { + var xe = this.bbox(); + if (J -= xe.x, ce -= xe.y, !isNaN(J) && !isNaN(ce)) + for (var Pe, Oe = this.value.length - 1; Oe >= 0; Oe--) + Pe = this.value[Oe][0], Pe == "M" || Pe == "L" || Pe == "T" ? (this.value[Oe][1] += J, this.value[Oe][2] += ce) : Pe == "H" ? this.value[Oe][1] += J : Pe == "V" ? this.value[Oe][1] += ce : Pe == "C" || Pe == "S" || Pe == "Q" ? (this.value[Oe][1] += J, this.value[Oe][2] += ce, this.value[Oe][3] += J, this.value[Oe][4] += ce, Pe == "C" && (this.value[Oe][5] += J, this.value[Oe][6] += ce)) : Pe == "A" && (this.value[Oe][6] += J, this.value[Oe][7] += ce); + return this; + }, + size: function(J, ce) { + var xe, Pe, Oe = this.bbox(); + for (xe = this.value.length - 1; xe >= 0; xe--) + Pe = this.value[xe][0], Pe == "M" || Pe == "L" || Pe == "T" ? (this.value[xe][1] = (this.value[xe][1] - Oe.x) * J / Oe.width + Oe.x, this.value[xe][2] = (this.value[xe][2] - Oe.y) * ce / Oe.height + Oe.y) : Pe == "H" ? this.value[xe][1] = (this.value[xe][1] - Oe.x) * J / Oe.width + Oe.x : Pe == "V" ? this.value[xe][1] = (this.value[xe][1] - Oe.y) * ce / Oe.height + Oe.y : Pe == "C" || Pe == "S" || Pe == "Q" ? (this.value[xe][1] = (this.value[xe][1] - Oe.x) * J / Oe.width + Oe.x, this.value[xe][2] = (this.value[xe][2] - Oe.y) * ce / Oe.height + Oe.y, this.value[xe][3] = (this.value[xe][3] - Oe.x) * J / Oe.width + Oe.x, this.value[xe][4] = (this.value[xe][4] - Oe.y) * ce / Oe.height + Oe.y, Pe == "C" && (this.value[xe][5] = (this.value[xe][5] - Oe.x) * J / Oe.width + Oe.x, this.value[xe][6] = (this.value[xe][6] - Oe.y) * ce / Oe.height + Oe.y)) : Pe == "A" && (this.value[xe][1] = this.value[xe][1] * J / Oe.width, this.value[xe][2] = this.value[xe][2] * ce / Oe.height, this.value[xe][6] = (this.value[xe][6] - Oe.x) * J / Oe.width + Oe.x, this.value[xe][7] = (this.value[xe][7] - Oe.y) * ce / Oe.height + Oe.y); + return this; + }, + equalCommands: function(J) { + var ce, xe, Pe; + for (J = new s.PathArray(J), Pe = this.value.length === J.value.length, ce = 0, xe = this.value.length; Pe && ce < xe; ce++) + Pe = this.value[ce][0] === J.value[ce][0]; + return Pe; + }, + morph: function(J) { + return J = new s.PathArray(J), this.equalCommands(J) ? this.destination = J : this.destination = null, this; + }, + at: function(J) { + if (!this.destination) + return this; + var ce = this.value, xe = this.destination.value, Pe = [], Oe = new s.PathArray(), Re, Ge, je, et; + for (Re = 0, Ge = ce.length; Re < Ge; Re++) { + for (Pe[Re] = [ce[Re][0]], je = 1, et = ce[Re].length; je < et; je++) + Pe[Re][je] = ce[Re][je] + (xe[Re][je] - ce[Re][je]) * J; + Pe[Re][0] === "A" && (Pe[Re][4] = +(Pe[Re][4] != 0), Pe[Re][5] = +(Pe[Re][5] != 0)); + } + return Oe.value = Pe, Oe; + }, + parse: function(J) { + if (J instanceof s.PathArray) + return J.valueOf(); + var ce, Pe, xe = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 }; + typeof J == "string" ? J = J.replace(s.regex.numbersWithDots, p).replace(s.regex.pathLetters, " $& ").replace(s.regex.hyphen, "$1 -").trim().split(s.regex.delimiter) : J = J.reduce(function(et, Qe) { + return [].concat.call(et, Qe); + }, []); + var Pe = [], Oe = new s.Point(), Re = new s.Point(), Ge = 0, je = J.length; + do + s.regex.isPathLetter.test(J[Ge]) ? (ce = J[Ge], ++Ge) : ce == "M" ? ce = "L" : ce == "m" && (ce = "l"), Pe.push( + o[ce].call( + null, + J.slice(Ge, Ge = Ge + xe[ce.toUpperCase()]).map(parseFloat), + Oe, + Re + ) + ); + while (je > Ge); + return Pe; + }, + bbox: function() { + return s.parser.path.setAttribute("d", this.toString()), s.parser.path.getBBox(); + } + }), s.Number = s.invent({ + // Initialize + create: function(J, ce) { + this.value = 0, this.unit = ce || "", typeof J == "number" ? this.value = isNaN(J) ? 0 : isFinite(J) ? J : J < 0 ? -34e37 : 34e37 : typeof J == "string" ? (ce = J.match(s.regex.numberAndUnit), ce && (this.value = parseFloat(ce[1]), ce[5] == "%" ? this.value /= 100 : ce[5] == "s" && (this.value *= 1e3), this.unit = ce[5])) : J instanceof s.Number && (this.value = J.valueOf(), this.unit = J.unit); + }, + extend: { + // Stringalize + toString: function() { + return (this.unit == "%" ? ~~(this.value * 1e8) / 1e6 : this.unit == "s" ? this.value / 1e3 : this.value) + this.unit; + }, + toJSON: function() { + return this.toString(); + }, + // Convert to primitive + valueOf: function() { + return this.value; + }, + plus: function(J) { + return J = new s.Number(J), new s.Number(this + J, this.unit || J.unit); + }, + minus: function(J) { + return J = new s.Number(J), new s.Number(this - J, this.unit || J.unit); + }, + times: function(J) { + return J = new s.Number(J), new s.Number(this * J, this.unit || J.unit); + }, + divide: function(J) { + return J = new s.Number(J), new s.Number(this / J, this.unit || J.unit); + }, + to: function(J) { + var ce = new s.Number(this); + return typeof J == "string" && (ce.unit = J), ce; + }, + morph: function(J) { + return this.destination = new s.Number(J), J.relative && (this.destination.value += this.value), this; + }, + at: function(J) { + return this.destination ? new s.Number(this.destination).minus(this).times(J).plus(this) : this; + } + } + }), s.Element = s.invent({ + // Initialize node + create: function(J) { + this._stroke = s.defaults.attrs.stroke, this._event = null, this._events = {}, this.dom = {}, (this.node = J) && (this.type = J.nodeName, this.node.instance = this, this._events = J._events || {}, this._stroke = J.getAttribute("stroke") || this._stroke); + }, + extend: { + // Move over x-axis + x: function(J) { + return this.attr("x", J); + }, + y: function(J) { + return this.attr("y", J); + }, + cx: function(J) { + return J == null ? this.x() + this.width() / 2 : this.x(J - this.width() / 2); + }, + cy: function(J) { + return J == null ? this.y() + this.height() / 2 : this.y(J - this.height() / 2); + }, + move: function(J, ce) { + return this.x(J).y(ce); + }, + center: function(J, ce) { + return this.cx(J).cy(ce); + }, + width: function(J) { + return this.attr("width", J); + }, + height: function(J) { + return this.attr("height", J); + }, + size: function(J, ce) { + var xe = V(this, J, ce); + return this.width(new s.Number(xe.width)).height(new s.Number(xe.height)); + }, + clone: function(J) { + this.writeDataToDom(); + var ce = he(this.node.cloneNode(!0)); + return J ? J.add(ce) : this.after(ce), ce; + }, + remove: function() { + return this.parent() && this.parent().removeElement(this), this; + }, + replace: function(J) { + return this.after(J).remove(), J; + }, + addTo: function(J) { + return J.put(this); + }, + putIn: function(J) { + return J.add(this); + }, + id: function(J) { + return this.attr("id", J); + }, + inside: function(J, ce) { + var xe = this.bbox(); + return J > xe.x && ce > xe.y && J < xe.x + xe.width && ce < xe.y + xe.height; + }, + show: function() { + return this.style("display", ""); + }, + hide: function() { + return this.style("display", "none"); + }, + visible: function() { + return this.style("display") != "none"; + }, + toString: function() { + return this.attr("id"); + }, + classes: function() { + var J = this.attr("class"); + return J == null ? [] : J.trim().split(s.regex.delimiter); + }, + hasClass: function(J) { + return this.classes().indexOf(J) != -1; + }, + addClass: function(J) { + if (!this.hasClass(J)) { + var ce = this.classes(); + ce.push(J), this.attr("class", ce.join(" ")); + } + return this; + }, + removeClass: function(J) { + return this.hasClass(J) && this.attr("class", this.classes().filter(function(ce) { + return ce != J; + }).join(" ")), this; + }, + toggleClass: function(J) { + return this.hasClass(J) ? this.removeClass(J) : this.addClass(J); + }, + reference: function(J) { + return s.get(this.attr(J)); + }, + parent: function(J) { + var ce = this; + if (!ce.node.parentNode) + return null; + if (ce = s.adopt(ce.node.parentNode), !J) + return ce; + for (; ce && ce.node instanceof i.SVGElement; ) { + if (typeof J == "string" ? ce.matches(J) : ce instanceof J) + return ce; + if (!ce.node.parentNode || ce.node.parentNode.nodeName == "#document" || ce.node.parentNode.nodeName == "#document-fragment") + return null; + ce = s.adopt(ce.node.parentNode); + } + }, + doc: function() { + return this instanceof s.Doc ? this : this.parent(s.Doc); + }, + parents: function(J) { + var ce = [], xe = this; + do { + if (xe = xe.parent(J), !xe || !xe.node) + break; + ce.push(xe); + } while (xe.parent); + return ce; + }, + matches: function(J) { + return x(this.node, J); + }, + native: function() { + return this.node; + }, + svg: function(J) { + var ce = r.createElement("svg"); + if (J && this instanceof s.Parent) { + ce.innerHTML = "" + J.replace(/\n/, "").replace(/<([\w:-]+)([^<]+?)\/>/g, "<$1$2>") + ""; + for (var xe = 0, Pe = ce.firstChild.childNodes.length; xe < Pe; xe++) + this.node.appendChild(ce.firstChild.firstChild); + } else + return ce.appendChild(J = r.createElement("svg")), this.writeDataToDom(), J.appendChild(this.node.cloneNode(!0)), ce.innerHTML.replace(/^/, "").replace(/<\/svg>$/, ""); + return this; + }, + writeDataToDom: function() { + if (this.each || this.lines) { + var J = this.each ? this : this.lines(); + J.each(function() { + this.writeDataToDom(); + }); + } + return this.node.removeAttribute("svgjs:data"), Object.keys(this.dom).length && this.node.setAttribute("svgjs:data", JSON.stringify(this.dom)), this; + }, + setData: function(J) { + return this.dom = J, this; + }, + is: function(J) { + return v(this, J); + } + } + }), s.easing = { + "-": function(J) { + return J; + }, + "<>": function(J) { + return -Math.cos(J * Math.PI) / 2 + 0.5; + }, + ">": function(J) { + return Math.sin(J * Math.PI / 2); + }, + "<": function(J) { + return -Math.cos(J * Math.PI / 2) + 1; + } + }, s.morph = function(J) { + return function(ce, xe) { + return new s.MorphObj(ce, xe).at(J); + }; + }, s.Situation = s.invent({ + create: function(J) { + this.init = !1, this.reversed = !1, this.reversing = !1, this.duration = new s.Number(J.duration).valueOf(), this.delay = new s.Number(J.delay).valueOf(), this.start = +/* @__PURE__ */ new Date() + this.delay, this.finish = this.start + this.duration, this.ease = J.ease, this.loop = 0, this.loops = !1, this.animations = { + // functionToCall: [list of morphable objects] + // e.g. move: [SVG.Number, SVG.Number] + }, this.attrs = { + // holds all attributes which are not represented from a function svg.js provides + // e.g. someAttr: SVG.Number + }, this.styles = { + // holds all styles which should be animated + // e.g. fill-color: SVG.Color + }, this.transforms = [ + // holds all transformations as transformation objects + // e.g. [SVG.Rotate, SVG.Translate, SVG.Matrix] + ], this.once = { + // functions to fire at a specific position + // e.g. "0.5": function foo(){} + }; + } + }), s.FX = s.invent({ + create: function(J) { + this._target = J, this.situations = [], this.active = !1, this.situation = null, this.paused = !1, this.lastPos = 0, this.pos = 0, this.absPos = 0, this._speed = 1; + }, + extend: { + /** + * sets or returns the target of this animation + * @param o object || number In case of Object it holds all parameters. In case of number its the duration of the animation + * @param ease function || string Function which should be used for easing or easing keyword + * @param delay Number indicating the delay before the animation starts + * @return target || this + */ + animate: function(J, ce, xe) { + typeof J == "object" && (ce = J.ease, xe = J.delay, J = J.duration); + var Pe = new s.Situation({ + duration: J || 1e3, + delay: xe || 0, + ease: s.easing[ce || "-"] || ce + }); + return this.queue(Pe), this; + }, + delay: function(J) { + var ce = new s.Situation({ + duration: J, + delay: 0, + ease: s.easing["-"] + }); + return this.queue(ce); + }, + target: function(J) { + return J && J instanceof s.Element ? (this._target = J, this) : this._target; + }, + timeToAbsPos: function(J) { + return (J - this.situation.start) / (this.situation.duration / this._speed); + }, + absPosToTime: function(J) { + return this.situation.duration / this._speed * J + this.situation.start; + }, + startAnimFrame: function() { + this.stopAnimFrame(), this.animationFrame = i.requestAnimationFrame(function() { + this.step(); + }.bind(this)); + }, + stopAnimFrame: function() { + i.cancelAnimationFrame(this.animationFrame); + }, + start: function() { + return !this.active && this.situation && (this.active = !0, this.startCurrent()), this; + }, + startCurrent: function() { + return this.situation.start = +/* @__PURE__ */ new Date() + this.situation.delay / this._speed, this.situation.finish = this.situation.start + this.situation.duration / this._speed, this.initAnimations().step(); + }, + queue: function(J) { + return (typeof J == "function" || J instanceof s.Situation) && this.situations.push(J), this.situation || (this.situation = this.situations.shift()), this; + }, + dequeue: function() { + return this.stop(), this.situation = this.situations.shift(), this.situation && (this.situation instanceof s.Situation ? this.start() : this.situation.call(this)), this; + }, + initAnimations: function() { + var J, ce, xe, Pe = this.situation; + if (Pe.init) + return this; + for (J in Pe.animations) + for (xe = this.target()[J](), Array.isArray(xe) || (xe = [xe]), Array.isArray(Pe.animations[J]) || (Pe.animations[J] = [Pe.animations[J]]), ce = xe.length; ce--; ) + Pe.animations[J][ce] instanceof s.Number && (xe[ce] = new s.Number(xe[ce])), Pe.animations[J][ce] = xe[ce].morph(Pe.animations[J][ce]); + for (J in Pe.attrs) + Pe.attrs[J] = new s.MorphObj(this.target().attr(J), Pe.attrs[J]); + for (J in Pe.styles) + Pe.styles[J] = new s.MorphObj(this.target().style(J), Pe.styles[J]); + return Pe.initialTransformation = this.target().matrixify(), Pe.init = !0, this; + }, + clearQueue: function() { + return this.situations = [], this; + }, + clearCurrent: function() { + return this.situation = null, this; + }, + stop: function(J, ce) { + var xe = this.active; + return this.active = !1, ce && this.clearQueue(), J && this.situation && (!xe && this.startCurrent(), this.atEnd()), this.stopAnimFrame(), this.clearCurrent(); + }, + reset: function() { + if (this.situation) { + var J = this.situation; + this.stop(), this.situation = J, this.atStart(); + } + return this; + }, + finish: function() { + for (this.stop(!0, !1); this.dequeue().situation && this.stop(!0, !1); ) + ; + return this.clearQueue().clearCurrent(), this; + }, + atStart: function() { + return this.at(0, !0); + }, + atEnd: function() { + return this.situation.loops === !0 && (this.situation.loops = this.situation.loop + 1), typeof this.situation.loops == "number" ? this.at(this.situation.loops, !0) : this.at(1, !0); + }, + at: function(J, ce) { + var xe = this.situation.duration / this._speed; + return this.absPos = J, ce || (this.situation.reversed && (this.absPos = 1 - this.absPos), this.absPos += this.situation.loop), this.situation.start = +/* @__PURE__ */ new Date() - this.absPos * xe, this.situation.finish = this.situation.start + xe, this.step(!0); + }, + speed: function(J) { + return J === 0 ? this.pause() : J ? (this._speed = J, this.at(this.absPos, !0)) : this._speed; + }, + loop: function(J, ce) { + var xe = this.last(); + return xe.loops = J ?? !0, xe.loop = 0, ce && (xe.reversing = !0), this; + }, + pause: function() { + return this.paused = !0, this.stopAnimFrame(), this; + }, + play: function() { + return this.paused ? (this.paused = !1, this.at(this.absPos, !0)) : this; + }, + reverse: function(J) { + var ce = this.last(); + return typeof J > "u" ? ce.reversed = !ce.reversed : ce.reversed = J, this; + }, + progress: function(J) { + return J ? this.situation.ease(this.pos) : this.pos; + }, + after: function(J) { + var ce = this.last(), xe = function Pe(Oe) { + Oe.detail.situation == ce && (J.call(this, ce), this.off("finished.fx", Pe)); + }; + return this.target().on("finished.fx", xe), this._callStart(); + }, + during: function(J) { + var ce = this.last(), xe = function(Pe) { + Pe.detail.situation == ce && J.call(this, Pe.detail.pos, s.morph(Pe.detail.pos), Pe.detail.eased, ce); + }; + return this.target().off("during.fx", xe).on("during.fx", xe), this.after(function() { + this.off("during.fx", xe); + }), this._callStart(); + }, + afterAll: function(J) { + var ce = function xe(Pe) { + J.call(this), this.off("allfinished.fx", xe); + }; + return this.target().off("allfinished.fx", ce).on("allfinished.fx", ce), this._callStart(); + }, + duringAll: function(J) { + var ce = function(xe) { + J.call(this, xe.detail.pos, s.morph(xe.detail.pos), xe.detail.eased, xe.detail.situation); + }; + return this.target().off("during.fx", ce).on("during.fx", ce), this.afterAll(function() { + this.off("during.fx", ce); + }), this._callStart(); + }, + last: function() { + return this.situations.length ? this.situations[this.situations.length - 1] : this.situation; + }, + add: function(J, ce, xe) { + return this.last()[xe || "animations"][J] = ce, this._callStart(); + }, + step: function(J) { + if (J || (this.absPos = this.timeToAbsPos(+/* @__PURE__ */ new Date())), this.situation.loops !== !1) { + var ce, xe, Pe; + ce = Math.max(this.absPos, 0), xe = Math.floor(ce), this.situation.loops === !0 || xe < this.situation.loops ? (this.pos = ce - xe, Pe = this.situation.loop, this.situation.loop = xe) : (this.absPos = this.situation.loops, this.pos = 1, Pe = this.situation.loop - 1, this.situation.loop = this.situation.loops), this.situation.reversing && (this.situation.reversed = this.situation.reversed != !!((this.situation.loop - Pe) % 2)); + } else + this.absPos = Math.min(this.absPos, 1), this.pos = this.absPos; + this.pos < 0 && (this.pos = 0), this.situation.reversed && (this.pos = 1 - this.pos); + var Oe = this.situation.ease(this.pos); + for (var Re in this.situation.once) + Re > this.lastPos && Re <= Oe && (this.situation.once[Re].call(this.target(), this.pos, Oe), delete this.situation.once[Re]); + return this.active && this.target().fire("during", { pos: this.pos, eased: Oe, fx: this, situation: this.situation }), this.situation ? (this.eachAt(), this.pos == 1 && !this.situation.reversed || this.situation.reversed && this.pos == 0 ? (this.stopAnimFrame(), this.target().fire("finished", { fx: this, situation: this.situation }), this.situations.length || (this.target().fire("allfinished"), this.situations.length || (this.target().off(".fx"), this.active = !1)), this.active ? this.dequeue() : this.clearCurrent()) : !this.paused && this.active && this.startAnimFrame(), this.lastPos = Oe, this) : this; + }, + eachAt: function() { + var J, ce, xe, Pe = this, Oe = this.target(), Re = this.situation; + for (J in Re.animations) + xe = [].concat(Re.animations[J]).map(function(je) { + return typeof je != "string" && je.at ? je.at(Re.ease(Pe.pos), Pe.pos) : je; + }), Oe[J].apply(Oe, xe); + for (J in Re.attrs) + xe = [J].concat(Re.attrs[J]).map(function(je) { + return typeof je != "string" && je.at ? je.at(Re.ease(Pe.pos), Pe.pos) : je; + }), Oe.attr.apply(Oe, xe); + for (J in Re.styles) + xe = [J].concat(Re.styles[J]).map(function(je) { + return typeof je != "string" && je.at ? je.at(Re.ease(Pe.pos), Pe.pos) : je; + }), Oe.style.apply(Oe, xe); + if (Re.transforms.length) { + for (xe = Re.initialTransformation, J = 0, ce = Re.transforms.length; J < ce; J++) { + var Ge = Re.transforms[J]; + if (Ge instanceof s.Matrix) { + Ge.relative ? xe = xe.multiply(new s.Matrix().morph(Ge).at(Re.ease(this.pos))) : xe = xe.morph(Ge).at(Re.ease(this.pos)); + continue; + } + Ge.relative || Ge.undo(xe.extract()), xe = xe.multiply(Ge.at(Re.ease(this.pos))); + } + Oe.matrix(xe); + } + return this; + }, + once: function(J, ce, xe) { + var Pe = this.last(); + return xe || (J = Pe.ease(J)), Pe.once[J] = ce, this; + }, + _callStart: function() { + return setTimeout(function() { + this.start(); + }.bind(this), 0), this; + } + }, + parent: s.Element, + construct: { + // Get fx module or create a new one, then animate with given duration and ease + animate: function(J, ce, xe) { + return (this.fx || (this.fx = new s.FX(this))).animate(J, ce, xe); + }, + delay: function(J) { + return (this.fx || (this.fx = new s.FX(this))).delay(J); + }, + stop: function(J, ce) { + return this.fx && this.fx.stop(J, ce), this; + }, + finish: function() { + return this.fx && this.fx.finish(), this; + }, + pause: function() { + return this.fx && this.fx.pause(), this; + }, + play: function() { + return this.fx && this.fx.play(), this; + }, + speed: function(J) { + if (this.fx) { + if (J == null) + return this.fx.speed(); + this.fx.speed(J); + } + return this; + } + } + }), s.MorphObj = s.invent({ + create: function(J, ce) { + if (s.Color.isColor(ce)) + return new s.Color(J).morph(ce); + if (s.regex.delimiter.test(J)) + return s.regex.pathLetters.test(J) ? new s.PathArray(J).morph(ce) : new s.Array(J).morph(ce); + if (s.regex.numberAndUnit.test(ce)) + return new s.Number(J).morph(ce); + this.value = J, this.destination = ce; + }, + extend: { + at: function(J, ce) { + return ce < 1 ? this.value : this.destination; + }, + valueOf: function() { + return this.value; + } + } + }), s.extend(s.FX, { + // Add animatable attributes + attr: function(J, ce, xe) { + if (typeof J == "object") + for (var Pe in J) + this.attr(Pe, J[Pe]); + else + this.add(J, ce, "attrs"); + return this; + }, + style: function(J, ce) { + if (typeof J == "object") + for (var xe in J) + this.style(xe, J[xe]); + else + this.add(J, ce, "styles"); + return this; + }, + x: function(J, ce) { + if (this.target() instanceof s.G) + return this.transform({ x: J }, ce), this; + var xe = new s.Number(J); + return xe.relative = ce, this.add("x", xe); + }, + y: function(J, ce) { + if (this.target() instanceof s.G) + return this.transform({ y: J }, ce), this; + var xe = new s.Number(J); + return xe.relative = ce, this.add("y", xe); + }, + cx: function(J) { + return this.add("cx", new s.Number(J)); + }, + cy: function(J) { + return this.add("cy", new s.Number(J)); + }, + move: function(J, ce) { + return this.x(J).y(ce); + }, + center: function(J, ce) { + return this.cx(J).cy(ce); + }, + size: function(J, ce) { + if (this.target() instanceof s.Text) + this.attr("font-size", J); + else { + var xe; + (!J || !ce) && (xe = this.target().bbox()), J || (J = xe.width / xe.height * ce), ce || (ce = xe.height / xe.width * J), this.add("width", new s.Number(J)).add("height", new s.Number(ce)); + } + return this; + }, + width: function(J) { + return this.add("width", new s.Number(J)); + }, + height: function(J) { + return this.add("height", new s.Number(J)); + }, + plot: function(J, ce, xe, Pe) { + return arguments.length == 4 ? this.plot([J, ce, xe, Pe]) : this.add("plot", new (this.target()).morphArray(J)); + }, + leading: function(J) { + return this.target().leading ? this.add("leading", new s.Number(J)) : this; + }, + viewbox: function(J, ce, xe, Pe) { + return this.target() instanceof s.Container && this.add("viewbox", new s.ViewBox(J, ce, xe, Pe)), this; + }, + update: function(J) { + if (this.target() instanceof s.Stop) { + if (typeof J == "number" || J instanceof s.Number) + return this.update({ + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }); + J.opacity != null && this.attr("stop-opacity", J.opacity), J.color != null && this.attr("stop-color", J.color), J.offset != null && this.attr("offset", J.offset); + } + return this; + } + }), s.Box = s.invent({ + create: function(J, ce, xe, Pe) { + if (typeof J == "object" && !(J instanceof s.Element)) + return s.Box.call(this, J.left != null ? J.left : J.x, J.top != null ? J.top : J.y, J.width, J.height); + arguments.length == 4 && (this.x = J, this.y = ce, this.width = xe, this.height = Pe), fe(this); + }, + extend: { + // Merge rect box with another, return a new instance + merge: function(J) { + var ce = new this.constructor(); + return ce.x = Math.min(this.x, J.x), ce.y = Math.min(this.y, J.y), ce.width = Math.max(this.x + this.width, J.x + J.width) - ce.x, ce.height = Math.max(this.y + this.height, J.y + J.height) - ce.y, fe(ce); + }, + transform: function(J) { + var ce = 1 / 0, xe = -1 / 0, Pe = 1 / 0, Oe = -1 / 0, Re, Ge = [ + new s.Point(this.x, this.y), + new s.Point(this.x2, this.y), + new s.Point(this.x, this.y2), + new s.Point(this.x2, this.y2) + ]; + return Ge.forEach(function(je) { + je = je.transform(J), ce = Math.min(ce, je.x), xe = Math.max(xe, je.x), Pe = Math.min(Pe, je.y), Oe = Math.max(Oe, je.y); + }), Re = new this.constructor(), Re.x = ce, Re.width = xe - ce, Re.y = Pe, Re.height = Oe - Pe, fe(Re), Re; + } + } + }), s.BBox = s.invent({ + // Initialize + create: function(J) { + if (s.Box.apply(this, [].slice.call(arguments)), J instanceof s.Element) { + var ce; + try { + if (r.documentElement.contains) { + if (!r.documentElement.contains(J.node)) + throw new Exception("Element not in the dom"); + } else { + for (var xe = J.node; xe.parentNode; ) + xe = xe.parentNode; + if (xe != r) + throw new Exception("Element not in the dom"); + } + ce = J.node.getBBox(); + } catch { + if (J instanceof s.Shape) { + var Pe = J.clone(s.parser.draw.instance).show(); + ce = Pe.node.getBBox(), Pe.remove(); + } else + ce = { + x: J.node.clientLeft, + y: J.node.clientTop, + width: J.node.clientWidth, + height: J.node.clientHeight + }; + } + s.Box.call(this, ce); + } + }, + inherit: s.Box, + parent: s.Element, + construct: { + // Get bounding box + bbox: function() { + return new s.BBox(this); + } + } + }), s.BBox.prototype.constructor = s.BBox, s.extend(s.Element, { + tbox: function() { + return console.warn("Use of TBox is deprecated and mapped to RBox. Use .rbox() instead."), this.rbox(this.doc()); + } + }), s.RBox = s.invent({ + // Initialize + create: function(J) { + s.Box.apply(this, [].slice.call(arguments)), J instanceof s.Element && s.Box.call(this, J.node.getBoundingClientRect()); + }, + inherit: s.Box, + parent: s.Element, + extend: { + addOffset: function() { + return this.x += i.pageXOffset, this.y += i.pageYOffset, this; + } + }, + construct: { + // Get rect box + rbox: function(J) { + return J ? new s.RBox(this).transform(J.screenCTM().inverse()) : new s.RBox(this).addOffset(); + } + } + }), s.RBox.prototype.constructor = s.RBox, s.Matrix = s.invent({ + // Initialize + create: function(J) { + var ce, xe = Y([1, 0, 0, 1, 0, 0]); + for (J = J instanceof s.Element ? J.matrixify() : typeof J == "string" ? Y(J.split(s.regex.delimiter).map(parseFloat)) : arguments.length == 6 ? Y([].slice.call(arguments)) : Array.isArray(J) ? Y(J) : typeof J == "object" ? J : xe, ce = Me.length - 1; ce >= 0; --ce) + this[Me[ce]] = J[Me[ce]] != null ? J[Me[ce]] : xe[Me[ce]]; + }, + extend: { + // Extract individual transformations + extract: function() { + var J = j(this, 0, 1), ce = j(this, 1, 0), xe = 180 / Math.PI * Math.atan2(J.y, J.x) - 90; + return { + // translation + x: this.e, + y: this.f, + transformedX: (this.e * Math.cos(xe * Math.PI / 180) + this.f * Math.sin(xe * Math.PI / 180)) / Math.sqrt(this.a * this.a + this.b * this.b), + transformedY: (this.f * Math.cos(xe * Math.PI / 180) + this.e * Math.sin(-xe * Math.PI / 180)) / Math.sqrt(this.c * this.c + this.d * this.d), + skewX: -xe, + skewY: 180 / Math.PI * Math.atan2(ce.y, ce.x), + scaleX: Math.sqrt(this.a * this.a + this.b * this.b), + scaleY: Math.sqrt(this.c * this.c + this.d * this.d), + rotation: xe, + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f, + matrix: new s.Matrix(this) + }; + }, + clone: function() { + return new s.Matrix(this); + }, + morph: function(J) { + return this.destination = new s.Matrix(J), this; + }, + at: function(J) { + if (!this.destination) + return this; + var ce = new s.Matrix({ + a: this.a + (this.destination.a - this.a) * J, + b: this.b + (this.destination.b - this.b) * J, + c: this.c + (this.destination.c - this.c) * J, + d: this.d + (this.destination.d - this.d) * J, + e: this.e + (this.destination.e - this.e) * J, + f: this.f + (this.destination.f - this.f) * J + }); + return ce; + }, + multiply: function(J) { + return new s.Matrix(this.native().multiply(X(J).native())); + }, + inverse: function() { + return new s.Matrix(this.native().inverse()); + }, + translate: function(J, ce) { + return new s.Matrix(this.native().translate(J || 0, ce || 0)); + }, + scale: function(J, ce, xe, Pe) { + return arguments.length == 1 ? ce = J : arguments.length == 3 && (Pe = xe, xe = ce, ce = J), this.around(xe, Pe, new s.Matrix(J, 0, 0, ce, 0, 0)); + }, + rotate: function(J, ce, xe) { + return J = s.utils.radians(J), this.around(ce, xe, new s.Matrix(Math.cos(J), Math.sin(J), -Math.sin(J), Math.cos(J), 0, 0)); + }, + flip: function(J, ce) { + return J == "x" ? this.scale(-1, 1, ce, 0) : J == "y" ? this.scale(1, -1, 0, ce) : this.scale(-1, -1, J, ce ?? J); + }, + skew: function(J, ce, xe, Pe) { + return arguments.length == 1 ? ce = J : arguments.length == 3 && (Pe = xe, xe = ce, ce = J), J = s.utils.radians(J), ce = s.utils.radians(ce), this.around(xe, Pe, new s.Matrix(1, Math.tan(ce), Math.tan(J), 1, 0, 0)); + }, + skewX: function(J, ce, xe) { + return this.skew(J, 0, ce, xe); + }, + skewY: function(J, ce, xe) { + return this.skew(0, J, ce, xe); + }, + around: function(J, ce, xe) { + return this.multiply(new s.Matrix(1, 0, 0, 1, J || 0, ce || 0)).multiply(xe).multiply(new s.Matrix(1, 0, 0, 1, -J || 0, -ce || 0)); + }, + native: function() { + for (var J = s.parser.native.createSVGMatrix(), ce = Me.length - 1; ce >= 0; ce--) + J[Me[ce]] = this[Me[ce]]; + return J; + }, + toString: function() { + return "matrix(" + Se(this.a) + "," + Se(this.b) + "," + Se(this.c) + "," + Se(this.d) + "," + Se(this.e) + "," + Se(this.f) + ")"; + } + }, + parent: s.Element, + construct: { + // Get current matrix + ctm: function() { + return new s.Matrix(this.node.getCTM()); + }, + // Get current screen matrix + screenCTM: function() { + if (this instanceof s.Nested) { + var J = this.rect(1, 1), ce = J.node.getScreenCTM(); + return J.remove(), new s.Matrix(ce); + } + return new s.Matrix(this.node.getScreenCTM()); + } + } + }), s.Point = s.invent({ + // Initialize + create: function(J, ce) { + var xe, Pe = { x: 0, y: 0 }; + xe = Array.isArray(J) ? { x: J[0], y: J[1] } : typeof J == "object" ? { x: J.x, y: J.y } : J != null ? { x: J, y: ce ?? J } : Pe, this.x = xe.x, this.y = xe.y; + }, + extend: { + // Clone point + clone: function() { + return new s.Point(this); + }, + morph: function(J, ce) { + return this.destination = new s.Point(J, ce), this; + }, + at: function(J) { + if (!this.destination) + return this; + var ce = new s.Point({ + x: this.x + (this.destination.x - this.x) * J, + y: this.y + (this.destination.y - this.y) * J + }); + return ce; + }, + native: function() { + var J = s.parser.native.createSVGPoint(); + return J.x = this.x, J.y = this.y, J; + }, + transform: function(J) { + return new s.Point(this.native().matrixTransform(J.native())); + } + } + }), s.extend(s.Element, { + // Get point + point: function(J, ce) { + return new s.Point(J, ce).transform(this.screenCTM().inverse()); + } + }), s.extend(s.Element, { + // Set svg element attribute + attr: function(J, ce, xe) { + if (J == null) { + for (J = {}, ce = this.node.attributes, xe = ce.length - 1; xe >= 0; xe--) + J[ce[xe].nodeName] = s.regex.isNumber.test(ce[xe].nodeValue) ? parseFloat(ce[xe].nodeValue) : ce[xe].nodeValue; + return J; + } else if (typeof J == "object") + for (ce in J) + this.attr(ce, J[ce]); + else if (ce === null) + this.node.removeAttribute(J); + else { + if (ce == null) + return ce = this.node.getAttribute(J), ce == null ? s.defaults.attrs[J] : s.regex.isNumber.test(ce) ? parseFloat(ce) : ce; + J == "stroke-width" ? this.attr("stroke", parseFloat(ce) > 0 ? this._stroke : null) : J == "stroke" && (this._stroke = ce), (J == "fill" || J == "stroke") && (s.regex.isImage.test(ce) && (ce = this.doc().defs().image(ce, 0, 0)), ce instanceof s.Image && (ce = this.doc().defs().pattern(0, 0, function() { + this.add(ce); + }))), typeof ce == "number" ? ce = new s.Number(ce) : s.Color.isColor(ce) ? ce = new s.Color(ce) : Array.isArray(ce) && (ce = new s.Array(ce)), J == "leading" ? this.leading && this.leading(ce) : typeof xe == "string" ? this.node.setAttributeNS(xe, J, ce.toString()) : this.node.setAttribute(J, ce.toString()), this.rebuild && (J == "font-size" || J == "x") && this.rebuild(J, ce); + } + return this; + } + }), s.extend(s.Element, { + // Add transformations + transform: function(J, ce) { + var xe = this, Pe, Oe; + if (typeof J != "object") + return Pe = new s.Matrix(xe).extract(), typeof J == "string" ? Pe[J] : Pe; + if (Pe = new s.Matrix(xe), ce = !!ce || !!J.relative, J.a != null) + Pe = ce ? ( + // relative + Pe.multiply(new s.Matrix(J)) + ) : ( + // absolute + new s.Matrix(J) + ); + else if (J.rotation != null) + Q(J, xe), Pe = ce ? ( + // relative + Pe.rotate(J.rotation, J.cx, J.cy) + ) : ( + // absolute + Pe.rotate(J.rotation - Pe.extract().rotation, J.cx, J.cy) + ); + else if (J.scale != null || J.scaleX != null || J.scaleY != null) { + if (Q(J, xe), J.scaleX = J.scale != null ? J.scale : J.scaleX != null ? J.scaleX : 1, J.scaleY = J.scale != null ? J.scale : J.scaleY != null ? J.scaleY : 1, !ce) { + var Re = Pe.extract(); + J.scaleX = J.scaleX * 1 / Re.scaleX, J.scaleY = J.scaleY * 1 / Re.scaleY; + } + Pe = Pe.scale(J.scaleX, J.scaleY, J.cx, J.cy); + } else if (J.skew != null || J.skewX != null || J.skewY != null) { + if (Q(J, xe), J.skewX = J.skew != null ? J.skew : J.skewX != null ? J.skewX : 0, J.skewY = J.skew != null ? J.skew : J.skewY != null ? J.skewY : 0, !ce) { + var Re = Pe.extract(); + Pe = Pe.multiply(new s.Matrix().skew(Re.skewX, Re.skewY, J.cx, J.cy).inverse()); + } + Pe = Pe.skew(J.skewX, J.skewY, J.cx, J.cy); + } else + J.flip ? (J.flip == "x" || J.flip == "y" ? J.offset = J.offset == null ? xe.bbox()["c" + J.flip] : J.offset : J.offset == null ? (Oe = xe.bbox(), J.flip = Oe.cx, J.offset = Oe.cy) : J.flip = J.offset, Pe = new s.Matrix().flip(J.flip, J.offset)) : (J.x != null || J.y != null) && (ce ? Pe = Pe.translate(J.x, J.y) : (J.x != null && (Pe.e = J.x), J.y != null && (Pe.f = J.y))); + return this.attr("transform", Pe); + } + }), s.extend(s.FX, { + transform: function(J, ce) { + var xe = this.target(), Pe, Oe; + return typeof J != "object" ? (Pe = new s.Matrix(xe).extract(), typeof J == "string" ? Pe[J] : Pe) : (ce = !!ce || !!J.relative, J.a != null ? Pe = new s.Matrix(J) : J.rotation != null ? (Q(J, xe), Pe = new s.Rotate(J.rotation, J.cx, J.cy)) : J.scale != null || J.scaleX != null || J.scaleY != null ? (Q(J, xe), J.scaleX = J.scale != null ? J.scale : J.scaleX != null ? J.scaleX : 1, J.scaleY = J.scale != null ? J.scale : J.scaleY != null ? J.scaleY : 1, Pe = new s.Scale(J.scaleX, J.scaleY, J.cx, J.cy)) : J.skewX != null || J.skewY != null ? (Q(J, xe), J.skewX = J.skewX != null ? J.skewX : 0, J.skewY = J.skewY != null ? J.skewY : 0, Pe = new s.Skew(J.skewX, J.skewY, J.cx, J.cy)) : J.flip ? (J.flip == "x" || J.flip == "y" ? J.offset = J.offset == null ? xe.bbox()["c" + J.flip] : J.offset : J.offset == null ? (Oe = xe.bbox(), J.flip = Oe.cx, J.offset = Oe.cy) : J.flip = J.offset, Pe = new s.Matrix().flip(J.flip, J.offset)) : (J.x != null || J.y != null) && (Pe = new s.Translate(J.x, J.y)), Pe ? (Pe.relative = ce, this.last().transforms.push(Pe), this._callStart()) : this); + } + }), s.extend(s.Element, { + // Reset all transformations + untransform: function() { + return this.attr("transform", null); + }, + // merge the whole transformation chain into one matrix and returns it + matrixify: function() { + var J = (this.attr("transform") || "").split(s.regex.transforms).slice(0, -1).map(function(ce) { + var xe = ce.trim().split("("); + return [xe[0], xe[1].split(s.regex.delimiter).map(function(Pe) { + return parseFloat(Pe); + })]; + }).reduce(function(ce, xe) { + return xe[0] == "matrix" ? ce.multiply(Y(xe[1])) : ce[xe[0]].apply(ce, xe[1]); + }, new s.Matrix()); + return J; + }, + // add an element to another parent without changing the visual representation on the screen + toParent: function(J) { + if (this == J) + return this; + var ce = this.screenCTM(), xe = J.screenCTM().inverse(); + return this.addTo(J).untransform().transform(xe.multiply(ce)), this; + }, + // same as above with parent equals root-svg + toDoc: function() { + return this.toParent(this.doc()); + } + }), s.Transformation = s.invent({ + create: function(J, ce) { + if (arguments.length > 1 && typeof ce != "boolean") + return this.constructor.call(this, [].slice.call(arguments)); + if (Array.isArray(J)) + for (var xe = 0, Pe = this.arguments.length; xe < Pe; ++xe) + this[this.arguments[xe]] = J[xe]; + else if (typeof J == "object") + for (var xe = 0, Pe = this.arguments.length; xe < Pe; ++xe) + this[this.arguments[xe]] = J[this.arguments[xe]]; + this.inversed = !1, ce === !0 && (this.inversed = !0); + }, + extend: { + arguments: [], + method: "", + at: function(J) { + for (var ce = [], xe = 0, Pe = this.arguments.length; xe < Pe; ++xe) + ce.push(this[this.arguments[xe]]); + var Oe = this._undo || new s.Matrix(); + return Oe = new s.Matrix().morph(s.Matrix.prototype[this.method].apply(Oe, ce)).at(J), this.inversed ? Oe.inverse() : Oe; + }, + undo: function(J) { + for (var ce = 0, xe = this.arguments.length; ce < xe; ++ce) + J[this.arguments[ce]] = typeof this[this.arguments[ce]] > "u" ? 0 : J[this.arguments[ce]]; + return J.cx = this.cx, J.cy = this.cy, this._undo = new s[P(this.method)](J, !0).at(1), this; + } + } + }), s.Translate = s.invent({ + parent: s.Matrix, + inherit: s.Transformation, + create: function(J, ce) { + this.constructor.apply(this, [].slice.call(arguments)); + }, + extend: { + arguments: ["transformedX", "transformedY"], + method: "translate" + } + }), s.Rotate = s.invent({ + parent: s.Matrix, + inherit: s.Transformation, + create: function(J, ce) { + this.constructor.apply(this, [].slice.call(arguments)); + }, + extend: { + arguments: ["rotation", "cx", "cy"], + method: "rotate", + at: function(J) { + var ce = new s.Matrix().rotate(new s.Number().morph(this.rotation - (this._undo ? this._undo.rotation : 0)).at(J), this.cx, this.cy); + return this.inversed ? ce.inverse() : ce; + }, + undo: function(J) { + return this._undo = J, this; + } + } + }), s.Scale = s.invent({ + parent: s.Matrix, + inherit: s.Transformation, + create: function(J, ce) { + this.constructor.apply(this, [].slice.call(arguments)); + }, + extend: { + arguments: ["scaleX", "scaleY", "cx", "cy"], + method: "scale" + } + }), s.Skew = s.invent({ + parent: s.Matrix, + inherit: s.Transformation, + create: function(J, ce) { + this.constructor.apply(this, [].slice.call(arguments)); + }, + extend: { + arguments: ["skewX", "skewY", "cx", "cy"], + method: "skew" + } + }), s.extend(s.Element, { + // Dynamic style generator + style: function(J, ce) { + if (arguments.length == 0) + return this.node.style.cssText || ""; + if (arguments.length < 2) + if (typeof J == "object") + for (ce in J) + this.style(ce, J[ce]); + else if (s.regex.isCss.test(J)) + for (J = J.split(/\s*;\s*/).filter(function(xe) { + return !!xe; + }).map(function(xe) { + return xe.split(/\s*:\s*/); + }); ce = J.pop(); ) + this.style(ce[0], ce[1]); + else + return this.node.style[I(J)]; + else + this.node.style[I(J)] = ce === null || s.regex.isBlank.test(ce) ? "" : ce; + return this; + } + }), s.Parent = s.invent({ + // Initialize node + create: function(J) { + this.constructor.call(this, J); + }, + inherit: s.Element, + extend: { + // Returns all child elements + children: function() { + return s.utils.map(s.utils.filterSVGElements(this.node.childNodes), function(J) { + return s.adopt(J); + }); + }, + add: function(J, ce) { + return ce == null ? this.node.appendChild(J.node) : J.node != this.node.childNodes[ce] && this.node.insertBefore(J.node, this.node.childNodes[ce]), this; + }, + put: function(J, ce) { + return this.add(J, ce), J; + }, + has: function(J) { + return this.index(J) >= 0; + }, + index: function(J) { + return [].slice.call(this.node.childNodes).indexOf(J.node); + }, + get: function(J) { + return s.adopt(this.node.childNodes[J]); + }, + first: function() { + return this.get(0); + }, + last: function() { + return this.get(this.node.childNodes.length - 1); + }, + each: function(J, ce) { + var xe, Pe, Oe = this.children(); + for (xe = 0, Pe = Oe.length; xe < Pe; xe++) + Oe[xe] instanceof s.Element && J.apply(Oe[xe], [xe, Oe]), ce && Oe[xe] instanceof s.Container && Oe[xe].each(J, ce); + return this; + }, + removeElement: function(J) { + return this.node.removeChild(J.node), this; + }, + clear: function() { + for (; this.node.hasChildNodes(); ) + this.node.removeChild(this.node.lastChild); + return delete this._defs, this; + }, + // Get defs + defs: function() { + return this.doc().defs(); + } + } + }), s.extend(s.Parent, { + ungroup: function(J, ce) { + return ce === 0 || this instanceof s.Defs || this.node == s.parser.draw ? this : (J = J || (this instanceof s.Doc ? this : this.parent(s.Parent)), ce = ce || 1 / 0, this.each(function() { + return this instanceof s.Defs ? this : this instanceof s.Parent ? this.ungroup(J, ce - 1) : this.toParent(J); + }), this.node.firstChild || this.remove(), this); + }, + flatten: function(J, ce) { + return this.ungroup(J, ce); + } + }), s.Container = s.invent({ + // Initialize node + create: function(J) { + this.constructor.call(this, J); + }, + inherit: s.Parent + }), s.ViewBox = s.invent({ + create: function(J) { + var ce = [0, 0, 0, 0], xe, Pe, Oe, Re, Ge, je, et, Qe = 1, tt = 1, ft = /[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/gi; + if (J instanceof s.Element) { + for (je = J, et = J, Ge = (J.attr("viewBox") || "").match(ft), J.bbox, Oe = new s.Number(J.width()), Re = new s.Number(J.height()); Oe.unit == "%"; ) + Qe *= Oe.value, Oe = new s.Number(je instanceof s.Doc ? je.parent().offsetWidth : je.parent().width()), je = je.parent(); + for (; Re.unit == "%"; ) + tt *= Re.value, Re = new s.Number(et instanceof s.Doc ? et.parent().offsetHeight : et.parent().height()), et = et.parent(); + this.x = 0, this.y = 0, this.width = Oe * Qe, this.height = Re * tt, this.zoom = 1, Ge && (xe = parseFloat(Ge[0]), Pe = parseFloat(Ge[1]), Oe = parseFloat(Ge[2]), Re = parseFloat(Ge[3]), this.zoom = this.width / this.height > Oe / Re ? this.height / Re : this.width / Oe, this.x = xe, this.y = Pe, this.width = Oe, this.height = Re); + } else + J = typeof J == "string" ? J.match(ft).map(function(Mt) { + return parseFloat(Mt); + }) : Array.isArray(J) ? J : typeof J == "object" ? [J.x, J.y, J.width, J.height] : arguments.length == 4 ? [].slice.call(arguments) : ce, this.x = J[0], this.y = J[1], this.width = J[2], this.height = J[3]; + }, + extend: { + toString: function() { + return this.x + " " + this.y + " " + this.width + " " + this.height; + }, + morph: function(J, ce, xe, Pe) { + return this.destination = new s.ViewBox(J, ce, xe, Pe), this; + }, + at: function(J) { + return this.destination ? new s.ViewBox([ + this.x + (this.destination.x - this.x) * J, + this.y + (this.destination.y - this.y) * J, + this.width + (this.destination.width - this.width) * J, + this.height + (this.destination.height - this.height) * J + ]) : this; + } + }, + parent: s.Container, + construct: { + // get/set viewbox + viewbox: function(J, ce, xe, Pe) { + return arguments.length == 0 ? new s.ViewBox(this) : this.attr("viewBox", new s.ViewBox(J, ce, xe, Pe)); + } + } + }), [ + "click", + "dblclick", + "mousedown", + "mouseup", + "mouseover", + "mouseout", + "mousemove", + "mouseenter", + "mouseleave", + "touchstart", + "touchmove", + "touchleave", + "touchend", + "touchcancel" + ].forEach(function(J) { + s.Element.prototype[J] = function(ce) { + return ce == null ? s.off(this, J) : s.on(this, J, ce), this; + }; + }), s.listenerId = 0, s.on = function(J, ce, xe, Pe, Oe) { + var Re = xe.bind(Pe || J), Ge = J instanceof s.Element ? J.node : J; + Ge.instance = Ge.instance || { _events: {} }; + var je = Ge.instance._events; + xe._svgjsListenerId || (xe._svgjsListenerId = ++s.listenerId), ce.split(s.regex.delimiter).forEach(function(et) { + var Qe = et.split(".")[0], tt = et.split(".")[1] || "*"; + je[Qe] = je[Qe] || {}, je[Qe][tt] = je[Qe][tt] || {}, je[Qe][tt][xe._svgjsListenerId] = Re, Ge.addEventListener(Qe, Re, Oe || !1); + }); + }, s.off = function(J, ce, xe, Pe) { + var Oe = J instanceof s.Element ? J.node : J; + if (Oe.instance && !(typeof xe == "function" && (xe = xe._svgjsListenerId, !xe))) { + var Re = Oe.instance._events; + (ce || "").split(s.regex.delimiter).forEach(function(Ge) { + var je = Ge && Ge.split(".")[0], et = Ge && Ge.split(".")[1], Qe, tt; + if (xe) + Re[je] && Re[je][et || "*"] && (Oe.removeEventListener(je, Re[je][et || "*"][xe], Pe || !1), delete Re[je][et || "*"][xe]); + else if (je && et) { + if (Re[je] && Re[je][et]) { + for (tt in Re[je][et]) + s.off(Oe, [je, et].join("."), tt); + delete Re[je][et]; + } + } else if (et) + for (Ge in Re) + for (Qe in Re[Ge]) + et === Qe && s.off(Oe, [Ge, et].join(".")); + else if (je) { + if (Re[je]) { + for (Qe in Re[je]) + s.off(Oe, [je, Qe].join(".")); + delete Re[je]; + } + } else { + for (Ge in Re) + s.off(Oe, Ge); + Oe.instance._events = {}; + } + }); + } + }, s.extend(s.Element, { + // Bind given event to listener + on: function(J, ce, xe, Pe) { + return s.on(this, J, ce, xe, Pe), this; + }, + // Unbind event from listener + off: function(J, ce) { + return s.off(this.node, J, ce), this; + }, + fire: function(J, ce) { + return J instanceof i.Event ? this.node.dispatchEvent(J) : this.node.dispatchEvent(J = new s.CustomEvent(J, { detail: ce, cancelable: !0 })), this._event = J, this; + }, + event: function() { + return this._event; + } + }), s.Defs = s.invent({ + // Initialize node + create: "defs", + inherit: s.Container + }), s.G = s.invent({ + // Initialize node + create: "g", + inherit: s.Container, + extend: { + // Move over x-axis + x: function(J) { + return J == null ? this.transform("x") : this.transform({ x: J - this.x() }, !0); + }, + y: function(J) { + return J == null ? this.transform("y") : this.transform({ y: J - this.y() }, !0); + }, + cx: function(J) { + return J == null ? this.gbox().cx : this.x(J - this.gbox().width / 2); + }, + cy: function(J) { + return J == null ? this.gbox().cy : this.y(J - this.gbox().height / 2); + }, + gbox: function() { + var J = this.bbox(), ce = this.transform(); + return J.x += ce.x, J.x2 += ce.x, J.cx += ce.x, J.y += ce.y, J.y2 += ce.y, J.cy += ce.y, J; + } + }, + construct: { + // Create a group element + group: function() { + return this.put(new s.G()); + } + } + }), s.Doc = s.invent({ + // Initialize node + create: function(J) { + J && (J = typeof J == "string" ? r.getElementById(J) : J, J.nodeName == "svg" ? this.constructor.call(this, J) : (this.constructor.call(this, s.create("svg")), J.appendChild(this.node), this.size("100%", "100%")), this.namespace().defs()); + }, + inherit: s.Container, + extend: { + // Add namespaces + namespace: function() { + return this.attr({ xmlns: s.ns, version: "1.1" }).attr("xmlns:xlink", s.xlink, s.xmlns).attr("xmlns:svgjs", s.svgjs, s.xmlns); + }, + defs: function() { + if (!this._defs) { + var J; + (J = this.node.getElementsByTagName("defs")[0]) ? this._defs = s.adopt(J) : this._defs = new s.Defs(), this.node.appendChild(this._defs.node); + } + return this._defs; + }, + parent: function() { + return !this.node.parentNode || this.node.parentNode.nodeName == "#document" || this.node.parentNode.nodeName == "#document-fragment" ? null : this.node.parentNode; + }, + spof: function() { + var J = this.node.getScreenCTM(); + return J && this.style("left", -J.e % 1 + "px").style("top", -J.f % 1 + "px"), this; + }, + remove: function() { + return this.parent() && this.parent().removeChild(this.node), this; + }, + clear: function() { + for (; this.node.hasChildNodes(); ) + this.node.removeChild(this.node.lastChild); + return delete this._defs, s.parser.draw.parentNode || this.node.appendChild(s.parser.draw), this; + }, + clone: function(J) { + this.writeDataToDom(); + var ce = this.node, xe = he(ce.cloneNode(!0)); + return J ? (J.node || J).appendChild(xe.node) : ce.parentNode.insertBefore(xe.node, ce.nextSibling), xe; + } + } + }), s.extend(s.Element, { + // Get all siblings, including myself + siblings: function() { + return this.parent().children(); + }, + position: function() { + return this.parent().index(this); + }, + next: function() { + return this.siblings()[this.position() + 1]; + }, + previous: function() { + return this.siblings()[this.position() - 1]; + }, + forward: function() { + var J = this.position() + 1, ce = this.parent(); + return ce.removeElement(this).add(this, J), ce instanceof s.Doc && ce.node.appendChild(ce.defs().node), this; + }, + backward: function() { + var J = this.position(); + return J > 0 && this.parent().removeElement(this).add(this, J - 1), this; + }, + front: function() { + var J = this.parent(); + return J.node.appendChild(this.node), J instanceof s.Doc && J.node.appendChild(J.defs().node), this; + }, + back: function() { + return this.position() > 0 && this.parent().removeElement(this).add(this, 0), this; + }, + before: function(J) { + J.remove(); + var ce = this.position(); + return this.parent().add(J, ce), this; + }, + after: function(J) { + J.remove(); + var ce = this.position(); + return this.parent().add(J, ce + 1), this; + } + }), s.Mask = s.invent({ + // Initialize node + create: function() { + this.constructor.call(this, s.create("mask")), this.targets = []; + }, + inherit: s.Container, + extend: { + // Unmask all masked elements and remove itself + remove: function() { + for (var J = this.targets.length - 1; J >= 0; J--) + this.targets[J] && this.targets[J].unmask(); + return this.targets = [], s.Element.prototype.remove.call(this), this; + } + }, + construct: { + // Create masking element + mask: function() { + return this.defs().put(new s.Mask()); + } + } + }), s.extend(s.Element, { + // Distribute mask to svg element + maskWith: function(J) { + return this.masker = J instanceof s.Mask ? J : this.parent().mask().add(J), this.masker.targets.push(this), this.attr("mask", 'url("#' + this.masker.attr("id") + '")'); + }, + unmask: function() { + return delete this.masker, this.attr("mask", null); + } + }), s.ClipPath = s.invent({ + // Initialize node + create: function() { + this.constructor.call(this, s.create("clipPath")), this.targets = []; + }, + inherit: s.Container, + extend: { + // Unclip all clipped elements and remove itself + remove: function() { + for (var J = this.targets.length - 1; J >= 0; J--) + this.targets[J] && this.targets[J].unclip(); + return this.targets = [], this.parent().removeElement(this), this; + } + }, + construct: { + // Create clipping element + clip: function() { + return this.defs().put(new s.ClipPath()); + } + } + }), s.extend(s.Element, { + // Distribute clipPath to svg element + clipWith: function(J) { + return this.clipper = J instanceof s.ClipPath ? J : this.parent().clip().add(J), this.clipper.targets.push(this), this.attr("clip-path", 'url("#' + this.clipper.attr("id") + '")'); + }, + unclip: function() { + return delete this.clipper, this.attr("clip-path", null); + } + }), s.Gradient = s.invent({ + // Initialize node + create: function(J) { + this.constructor.call(this, s.create(J + "Gradient")), this.type = J; + }, + inherit: s.Container, + extend: { + // Add a color stop + at: function(J, ce, xe) { + return this.put(new s.Stop()).update(J, ce, xe); + }, + update: function(J) { + return this.clear(), typeof J == "function" && J.call(this, this), this; + }, + fill: function() { + return "url(#" + this.id() + ")"; + }, + toString: function() { + return this.fill(); + }, + attr: function(J, ce, xe) { + return J == "transform" && (J = "gradientTransform"), s.Container.prototype.attr.call(this, J, ce, xe); + } + }, + construct: { + // Create gradient element in defs + gradient: function(J, ce) { + return this.defs().gradient(J, ce); + } + } + }), s.extend(s.Gradient, s.FX, { + // From position + from: function(J, ce) { + return (this._target || this).type == "radial" ? this.attr({ fx: new s.Number(J), fy: new s.Number(ce) }) : this.attr({ x1: new s.Number(J), y1: new s.Number(ce) }); + }, + to: function(J, ce) { + return (this._target || this).type == "radial" ? this.attr({ cx: new s.Number(J), cy: new s.Number(ce) }) : this.attr({ x2: new s.Number(J), y2: new s.Number(ce) }); + } + }), s.extend(s.Defs, { + // define gradient + gradient: function(J, ce) { + return this.put(new s.Gradient(J)).update(ce); + } + }), s.Stop = s.invent({ + // Initialize node + create: "stop", + inherit: s.Element, + extend: { + // add color stops + update: function(J) { + return (typeof J == "number" || J instanceof s.Number) && (J = { + offset: arguments[0], + color: arguments[1], + opacity: arguments[2] + }), J.opacity != null && this.attr("stop-opacity", J.opacity), J.color != null && this.attr("stop-color", J.color), J.offset != null && this.attr("offset", new s.Number(J.offset)), this; + } + } + }), s.Pattern = s.invent({ + // Initialize node + create: "pattern", + inherit: s.Container, + extend: { + // Return the fill id + fill: function() { + return "url(#" + this.id() + ")"; + }, + update: function(J) { + return this.clear(), typeof J == "function" && J.call(this, this), this; + }, + toString: function() { + return this.fill(); + }, + attr: function(J, ce, xe) { + return J == "transform" && (J = "patternTransform"), s.Container.prototype.attr.call(this, J, ce, xe); + } + }, + construct: { + // Create pattern element in defs + pattern: function(J, ce, xe) { + return this.defs().pattern(J, ce, xe); + } + } + }), s.extend(s.Defs, { + // Define gradient + pattern: function(J, ce, xe) { + return this.put(new s.Pattern()).update(xe).attr({ + x: 0, + y: 0, + width: J, + height: ce, + patternUnits: "userSpaceOnUse" + }); + } + }), s.Shape = s.invent({ + // Initialize node + create: function(J) { + this.constructor.call(this, J); + }, + inherit: s.Element + }), s.Bare = s.invent({ + // Initialize + create: function(J, ce) { + if (this.constructor.call(this, s.create(J)), ce) + for (var xe in ce.prototype) + typeof ce.prototype[xe] == "function" && (this[xe] = ce.prototype[xe]); + }, + inherit: s.Element, + extend: { + // Insert some plain text + words: function(J) { + for (; this.node.hasChildNodes(); ) + this.node.removeChild(this.node.lastChild); + return this.node.appendChild(r.createTextNode(J)), this; + } + } + }), s.extend(s.Parent, { + // Create an element that is not described by SVG.js + element: function(J, ce) { + return this.put(new s.Bare(J, ce)); + } + }), s.Symbol = s.invent({ + // Initialize node + create: "symbol", + inherit: s.Container, + construct: { + // create symbol + symbol: function() { + return this.put(new s.Symbol()); + } + } + }), s.Use = s.invent({ + // Initialize node + create: "use", + inherit: s.Shape, + extend: { + // Use element as a reference + element: function(J, ce) { + return this.attr("href", (ce || "") + "#" + J, s.xlink); + } + }, + construct: { + // Create a use element + use: function(J, ce) { + return this.put(new s.Use()).element(J, ce); + } + } + }), s.Rect = s.invent({ + // Initialize node + create: "rect", + inherit: s.Shape, + construct: { + // Create a rect element + rect: function(J, ce) { + return this.put(new s.Rect()).size(J, ce); + } + } + }), s.Circle = s.invent({ + // Initialize node + create: "circle", + inherit: s.Shape, + construct: { + // Create circle element, based on ellipse + circle: function(J) { + return this.put(new s.Circle()).rx(new s.Number(J).divide(2)).move(0, 0); + } + } + }), s.extend(s.Circle, s.FX, { + // Radius x value + rx: function(J) { + return this.attr("r", J); + }, + ry: function(J) { + return this.rx(J); + } + }), s.Ellipse = s.invent({ + // Initialize node + create: "ellipse", + inherit: s.Shape, + construct: { + // Create an ellipse + ellipse: function(J, ce) { + return this.put(new s.Ellipse()).size(J, ce).move(0, 0); + } + } + }), s.extend(s.Ellipse, s.Rect, s.FX, { + // Radius x value + rx: function(J) { + return this.attr("rx", J); + }, + ry: function(J) { + return this.attr("ry", J); + } + }), s.extend(s.Circle, s.Ellipse, { + // Move over x-axis + x: function(J) { + return J == null ? this.cx() - this.rx() : this.cx(J + this.rx()); + }, + y: function(J) { + return J == null ? this.cy() - this.ry() : this.cy(J + this.ry()); + }, + cx: function(J) { + return J == null ? this.attr("cx") : this.attr("cx", J); + }, + cy: function(J) { + return J == null ? this.attr("cy") : this.attr("cy", J); + }, + width: function(J) { + return J == null ? this.rx() * 2 : this.rx(new s.Number(J).divide(2)); + }, + height: function(J) { + return J == null ? this.ry() * 2 : this.ry(new s.Number(J).divide(2)); + }, + size: function(J, ce) { + var xe = V(this, J, ce); + return this.rx(new s.Number(xe.width).divide(2)).ry(new s.Number(xe.height).divide(2)); + } + }), s.Line = s.invent({ + // Initialize node + create: "line", + inherit: s.Shape, + extend: { + // Get array + array: function() { + return new s.PointArray([ + [this.attr("x1"), this.attr("y1")], + [this.attr("x2"), this.attr("y2")] + ]); + }, + plot: function(J, ce, xe, Pe) { + return J == null ? this.array() : (typeof ce < "u" ? J = { x1: J, y1: ce, x2: xe, y2: Pe } : J = new s.PointArray(J).toLine(), this.attr(J)); + }, + move: function(J, ce) { + return this.attr(this.array().move(J, ce).toLine()); + }, + size: function(J, ce) { + var xe = V(this, J, ce); + return this.attr(this.array().size(xe.width, xe.height).toLine()); + } + }, + construct: { + // Create a line element + line: function(J, ce, xe, Pe) { + return s.Line.prototype.plot.apply( + this.put(new s.Line()), + J != null ? [J, ce, xe, Pe] : [0, 0, 0, 0] + ); + } + } + }), s.Polyline = s.invent({ + // Initialize node + create: "polyline", + inherit: s.Shape, + construct: { + // Create a wrapped polyline element + polyline: function(J) { + return this.put(new s.Polyline()).plot(J || new s.PointArray()); + } + } + }), s.Polygon = s.invent({ + // Initialize node + create: "polygon", + inherit: s.Shape, + construct: { + // Create a wrapped polygon element + polygon: function(J) { + return this.put(new s.Polygon()).plot(J || new s.PointArray()); + } + } + }), s.extend(s.Polyline, s.Polygon, { + // Get array + array: function() { + return this._array || (this._array = new s.PointArray(this.attr("points"))); + }, + plot: function(J) { + return J == null ? this.array() : this.clear().attr("points", typeof J == "string" ? J : this._array = new s.PointArray(J)); + }, + clear: function() { + return delete this._array, this; + }, + move: function(J, ce) { + return this.attr("points", this.array().move(J, ce)); + }, + size: function(J, ce) { + var xe = V(this, J, ce); + return this.attr("points", this.array().size(xe.width, xe.height)); + } + }), s.extend(s.Line, s.Polyline, s.Polygon, { + // Define morphable array + morphArray: s.PointArray, + x: function(J) { + return J == null ? this.bbox().x : this.move(J, this.bbox().y); + }, + y: function(J) { + return J == null ? this.bbox().y : this.move(this.bbox().x, J); + }, + width: function(J) { + var ce = this.bbox(); + return J == null ? ce.width : this.size(J, ce.height); + }, + height: function(J) { + var ce = this.bbox(); + return J == null ? ce.height : this.size(ce.width, J); + } + }), s.Path = s.invent({ + // Initialize node + create: "path", + inherit: s.Shape, + extend: { + // Define morphable array + morphArray: s.PathArray, + array: function() { + return this._array || (this._array = new s.PathArray(this.attr("d"))); + }, + plot: function(J) { + return J == null ? this.array() : this.clear().attr("d", typeof J == "string" ? J : this._array = new s.PathArray(J)); + }, + clear: function() { + return delete this._array, this; + }, + move: function(J, ce) { + return this.attr("d", this.array().move(J, ce)); + }, + x: function(J) { + return J == null ? this.bbox().x : this.move(J, this.bbox().y); + }, + y: function(J) { + return J == null ? this.bbox().y : this.move(this.bbox().x, J); + }, + size: function(J, ce) { + var xe = V(this, J, ce); + return this.attr("d", this.array().size(xe.width, xe.height)); + }, + width: function(J) { + return J == null ? this.bbox().width : this.size(J, this.bbox().height); + }, + height: function(J) { + return J == null ? this.bbox().height : this.size(this.bbox().width, J); + } + }, + construct: { + // Create a wrapped path element + path: function(J) { + return this.put(new s.Path()).plot(J || new s.PathArray()); + } + } + }), s.Image = s.invent({ + // Initialize node + create: "image", + inherit: s.Shape, + extend: { + // (re)load image + load: function(J) { + if (!J) + return this; + var ce = this, xe = new i.Image(); + return s.on(xe, "load", function() { + s.off(xe); + var Pe = ce.parent(s.Pattern); + Pe !== null && (ce.width() == 0 && ce.height() == 0 && ce.size(xe.width, xe.height), Pe && Pe.width() == 0 && Pe.height() == 0 && Pe.size(ce.width(), ce.height()), typeof ce._loaded == "function" && ce._loaded.call(ce, { + width: xe.width, + height: xe.height, + ratio: xe.width / xe.height, + url: J + })); + }), s.on(xe, "error", function(Pe) { + s.off(xe), typeof ce._error == "function" && ce._error.call(ce, Pe); + }), this.attr("href", xe.src = this.src = J, s.xlink); + }, + loaded: function(J) { + return this._loaded = J, this; + }, + error: function(J) { + return this._error = J, this; + } + }, + construct: { + // create image element, load image and set its size + image: function(J, ce, xe) { + return this.put(new s.Image()).load(J).size(ce || 0, xe || ce || 0); + } + } + }), s.Text = s.invent({ + // Initialize node + create: function() { + this.constructor.call(this, s.create("text")), this.dom.leading = new s.Number(1.3), this._rebuild = !0, this._build = !1, this.attr("font-family", s.defaults.attrs["font-family"]); + }, + inherit: s.Shape, + extend: { + // Move over x-axis + x: function(J) { + return J == null ? this.attr("x") : this.attr("x", J); + }, + y: function(J) { + var ce = this.attr("y"), xe = typeof ce == "number" ? ce - this.bbox().y : 0; + return J == null ? typeof ce == "number" ? ce - xe : ce : this.attr("y", typeof J.valueOf() == "number" ? J + xe : J); + }, + cx: function(J) { + return J == null ? this.bbox().cx : this.x(J - this.bbox().width / 2); + }, + cy: function(J) { + return J == null ? this.bbox().cy : this.y(J - this.bbox().height / 2); + }, + text: function(J) { + if (typeof J > "u") { + for (var J = "", ce = this.node.childNodes, xe = 0, Pe = ce.length; xe < Pe; ++xe) + xe != 0 && ce[xe].nodeType != 3 && s.adopt(ce[xe]).dom.newLined == !0 && (J += ` +`), J += ce[xe].textContent; + return J; + } + if (this.clear().build(!0), typeof J == "function") + J.call(this, this); + else { + J = J.split(` +`); + for (var xe = 0, Oe = J.length; xe < Oe; xe++) + this.tspan(J[xe]).newLine(); + } + return this.build(!1).rebuild(); + }, + size: function(J) { + return this.attr("font-size", J).rebuild(); + }, + leading: function(J) { + return J == null ? this.dom.leading : (this.dom.leading = new s.Number(J), this.rebuild()); + }, + lines: function() { + var J = (this.textPath && this.textPath() || this).node, ce = s.utils.map(s.utils.filterSVGElements(J.childNodes), function(xe) { + return s.adopt(xe); + }); + return new s.Set(ce); + }, + rebuild: function(J) { + if (typeof J == "boolean" && (this._rebuild = J), this._rebuild) { + var ce = this, xe = 0, Pe = this.dom.leading * new s.Number(this.attr("font-size")); + this.lines().each(function() { + this.dom.newLined && (ce.textPath() || this.attr("x", ce.attr("x")), this.text() == ` +` ? xe += Pe : (this.attr("dy", Pe + xe), xe = 0)); + }), this.fire("rebuild"); + } + return this; + }, + build: function(J) { + return this._build = !!J, this; + }, + setData: function(J) { + return this.dom = J, this.dom.leading = new s.Number(J.leading || 1.3), this; + } + }, + construct: { + // Create text element + text: function(J) { + return this.put(new s.Text()).text(J); + }, + plain: function(J) { + return this.put(new s.Text()).plain(J); + } + } + }), s.Tspan = s.invent({ + // Initialize node + create: "tspan", + inherit: s.Shape, + extend: { + // Set text content + text: function(J) { + return J == null ? this.node.textContent + (this.dom.newLined ? ` +` : "") : (typeof J == "function" ? J.call(this, this) : this.plain(J), this); + }, + dx: function(J) { + return this.attr("dx", J); + }, + dy: function(J) { + return this.attr("dy", J); + }, + newLine: function() { + var J = this.parent(s.Text); + return this.dom.newLined = !0, this.dy(J.dom.leading * J.attr("font-size")).attr("x", J.x()); + } + } + }), s.extend(s.Text, s.Tspan, { + // Create plain text node + plain: function(J) { + return this._build === !1 && this.clear(), this.node.appendChild(r.createTextNode(J)), this; + }, + tspan: function(J) { + var ce = (this.textPath && this.textPath() || this).node, xe = new s.Tspan(); + return this._build === !1 && this.clear(), ce.appendChild(xe.node), xe.text(J); + }, + clear: function() { + for (var J = (this.textPath && this.textPath() || this).node; J.hasChildNodes(); ) + J.removeChild(J.lastChild); + return this; + }, + length: function() { + return this.node.getComputedTextLength(); + } + }), s.TextPath = s.invent({ + // Initialize node + create: "textPath", + inherit: s.Parent, + parent: s.Text, + construct: { + morphArray: s.PathArray, + path: function(J) { + for (var ce = new s.TextPath(), xe = this.doc().defs().path(J); this.node.hasChildNodes(); ) + ce.node.appendChild(this.node.firstChild); + return this.node.appendChild(ce.node), ce.attr("href", "#" + xe, s.xlink), this; + }, + array: function() { + var J = this.track(); + return J ? J.array() : null; + }, + plot: function(J) { + var ce = this.track(), xe = null; + return ce && (xe = ce.plot(J)), J == null ? xe : this; + }, + track: function() { + var J = this.textPath(); + if (J) + return J.reference("href"); + }, + textPath: function() { + if (this.node.firstChild && this.node.firstChild.nodeName == "textPath") + return s.adopt(this.node.firstChild); + } + } + }), s.Nested = s.invent({ + // Initialize node + create: function() { + this.constructor.call(this, s.create("svg")), this.style("overflow", "visible"); + }, + inherit: s.Container, + construct: { + // Create nested svg document + nested: function() { + return this.put(new s.Nested()); + } + } + }), s.A = s.invent({ + // Initialize node + create: "a", + inherit: s.Container, + extend: { + // Link url + to: function(J) { + return this.attr("href", J, s.xlink); + }, + show: function(J) { + return this.attr("show", J, s.xlink); + }, + target: function(J) { + return this.attr("target", J); + } + }, + construct: { + // Create a hyperlink element + link: function(J) { + return this.put(new s.A()).to(J); + } + } + }), s.extend(s.Element, { + // Create a hyperlink element + linkTo: function(J) { + var ce = new s.A(); + return typeof J == "function" ? J.call(ce, ce) : ce.to(J), this.parent().put(ce).put(this); + } + }), s.Marker = s.invent({ + // Initialize node + create: "marker", + inherit: s.Container, + extend: { + // Set width of element + width: function(J) { + return this.attr("markerWidth", J); + }, + height: function(J) { + return this.attr("markerHeight", J); + }, + ref: function(J, ce) { + return this.attr("refX", J).attr("refY", ce); + }, + update: function(J) { + return this.clear(), typeof J == "function" && J.call(this, this), this; + }, + toString: function() { + return "url(#" + this.id() + ")"; + } + }, + construct: { + marker: function(J, ce, xe) { + return this.defs().marker(J, ce, xe); + } + } + }), s.extend(s.Defs, { + // Create marker + marker: function(J, ce, xe) { + return this.put(new s.Marker()).size(J, ce).ref(J / 2, ce / 2).viewbox(0, 0, J, ce).attr("orient", "auto").update(xe); + } + }), s.extend(s.Line, s.Polyline, s.Polygon, s.Path, { + // Create and attach markers + marker: function(J, ce, xe, Pe) { + var Oe = ["marker"]; + return J != "all" && Oe.push(J), Oe = Oe.join("-"), J = arguments[1] instanceof s.Marker ? arguments[1] : this.doc().marker(ce, xe, Pe), this.attr(Oe, J); + } + }); + var h = { + stroke: ["color", "width", "opacity", "linecap", "linejoin", "miterlimit", "dasharray", "dashoffset"], + fill: ["color", "opacity", "rule"], + prefix: function(J, ce) { + return ce == "color" ? J : J + "-" + ce; + } + }; + ["fill", "stroke"].forEach(function(J) { + var ce, xe = {}; + xe[J] = function(Pe) { + if (typeof Pe > "u") + return this; + if (typeof Pe == "string" || s.Color.isRgb(Pe) || Pe && typeof Pe.fill == "function") + this.attr(J, Pe); + else + for (ce = h[J].length - 1; ce >= 0; ce--) + Pe[h[J][ce]] != null && this.attr(h.prefix(J, h[J][ce]), Pe[h[J][ce]]); + return this; + }, s.extend(s.Element, s.FX, xe); + }), s.extend(s.Element, s.FX, { + // Map rotation to transform + rotate: function(J, ce, xe) { + return this.transform({ rotation: J, cx: ce, cy: xe }); + }, + skew: function(J, ce, xe, Pe) { + return arguments.length == 1 || arguments.length == 3 ? this.transform({ skew: J, cx: ce, cy: xe }) : this.transform({ skewX: J, skewY: ce, cx: xe, cy: Pe }); + }, + scale: function(J, ce, xe, Pe) { + return arguments.length == 1 || arguments.length == 3 ? this.transform({ scale: J, cx: ce, cy: xe }) : this.transform({ scaleX: J, scaleY: ce, cx: xe, cy: Pe }); + }, + translate: function(J, ce) { + return this.transform({ x: J, y: ce }); + }, + flip: function(J, ce) { + return ce = typeof J == "number" ? J : ce, this.transform({ flip: J || "both", offset: ce }); + }, + matrix: function(J) { + return this.attr("transform", new s.Matrix(arguments.length == 6 ? [].slice.call(arguments) : J)); + }, + opacity: function(J) { + return this.attr("opacity", J); + }, + dx: function(J) { + return this.x(new s.Number(J).plus(this instanceof s.FX ? 0 : this.x()), !0); + }, + dy: function(J) { + return this.y(new s.Number(J).plus(this instanceof s.FX ? 0 : this.y()), !0); + }, + dmove: function(J, ce) { + return this.dx(J).dy(ce); + } + }), s.extend(s.Rect, s.Ellipse, s.Circle, s.Gradient, s.FX, { + // Add x and y radius + radius: function(J, ce) { + var xe = (this._target || this).type; + return xe == "radial" || xe == "circle" ? this.attr("r", new s.Number(J)) : this.rx(J).ry(ce ?? J); + } + }), s.extend(s.Path, { + // Get path length + length: function() { + return this.node.getTotalLength(); + }, + pointAt: function(J) { + return this.node.getPointAtLength(J); + } + }), s.extend(s.Parent, s.Text, s.Tspan, s.FX, { + // Set font + font: function(J, ce) { + if (typeof J == "object") + for (ce in J) + this.font(ce, J[ce]); + return J == "leading" ? this.leading(ce) : J == "anchor" ? this.attr("text-anchor", ce) : J == "size" || J == "family" || J == "weight" || J == "stretch" || J == "variant" || J == "style" ? this.attr("font-" + J, ce) : this.attr(J, ce); + } + }), s.Set = s.invent({ + // Initialize + create: function(J) { + J instanceof s.Set ? this.members = J.members.slice() : Array.isArray(J) ? this.members = J : this.clear(); + }, + extend: { + // Add element to set + add: function() { + var J, ce, xe = [].slice.call(arguments); + for (J = 0, ce = xe.length; J < ce; J++) + this.members.push(xe[J]); + return this; + }, + remove: function(J) { + var ce = this.index(J); + return ce > -1 && this.members.splice(ce, 1), this; + }, + each: function(J) { + for (var ce = 0, xe = this.members.length; ce < xe; ce++) + J.apply(this.members[ce], [ce, this.members]); + return this; + }, + clear: function() { + return this.members = [], this; + }, + length: function() { + return this.members.length; + }, + has: function(J) { + return this.index(J) >= 0; + }, + index: function(J) { + return this.members.indexOf(J); + }, + get: function(J) { + return this.members[J]; + }, + first: function() { + return this.get(0); + }, + last: function() { + return this.get(this.members.length - 1); + }, + valueOf: function() { + return this.members; + }, + bbox: function() { + if (this.members.length == 0) + return new s.RBox(); + var J = this.members[0].rbox(this.members[0].doc()); + return this.each(function() { + J = J.merge(this.rbox(this.doc())); + }), J; + } + }, + construct: { + // Create a new set + set: function(J) { + return new s.Set(J); + } + } + }), s.FX.Set = s.invent({ + // Initialize node + create: function(J) { + this.set = J; + } + }), s.Set.inherit = function() { + var J, ce = []; + for (var J in s.Shape.prototype) + typeof s.Shape.prototype[J] == "function" && typeof s.Set.prototype[J] != "function" && ce.push(J); + ce.forEach(function(xe) { + s.Set.prototype[xe] = function() { + for (var Pe = 0, Oe = this.members.length; Pe < Oe; Pe++) + this.members[Pe] && typeof this.members[Pe][xe] == "function" && this.members[Pe][xe].apply(this.members[Pe], arguments); + return xe == "animate" ? this.fx || (this.fx = new s.FX.Set(this)) : this; + }; + }), ce = []; + for (var J in s.FX.prototype) + typeof s.FX.prototype[J] == "function" && typeof s.FX.Set.prototype[J] != "function" && ce.push(J); + ce.forEach(function(xe) { + s.FX.Set.prototype[xe] = function() { + for (var Pe = 0, Oe = this.set.members.length; Pe < Oe; Pe++) + this.set.members[Pe].fx[xe].apply(this.set.members[Pe].fx, arguments); + return this; + }; + }); + }, s.extend(s.Element, { + // Store data values on svg nodes + data: function(J, ce, xe) { + if (typeof J == "object") + for (ce in J) + this.data(ce, J[ce]); + else if (arguments.length < 2) + try { + return JSON.parse(this.attr("data-" + J)); + } catch { + return this.attr("data-" + J); + } + else + this.attr( + "data-" + J, + ce === null ? null : xe === !0 || typeof ce == "string" || typeof ce == "number" ? ce : JSON.stringify(ce) + ); + return this; + } + }), s.extend(s.Element, { + // Remember arbitrary data + remember: function(J, ce) { + if (typeof arguments[0] == "object") + for (var ce in J) + this.remember(ce, J[ce]); + else { + if (arguments.length == 1) + return this.memory()[J]; + this.memory()[J] = ce; + } + return this; + }, + forget: function() { + if (arguments.length == 0) + this._memory = {}; + else + for (var J = arguments.length - 1; J >= 0; J--) + delete this.memory()[arguments[J]]; + return this; + }, + memory: function() { + return this._memory || (this._memory = {}); + } + }), s.get = function(J) { + var ce = r.getElementById(be(J) || J); + return s.adopt(ce); + }, s.select = function(J, ce) { + return new s.Set( + s.utils.map((ce || r).querySelectorAll(J), function(xe) { + return s.adopt(xe); + }) + ); + }, s.extend(s.Parent, { + // Scoped select method + select: function(J) { + return s.select(J, this.node); + } + }); + function p(J, ce, xe, Pe) { + return xe + Pe.replace(s.regex.dots, " ."); + } + function y(J) { + for (var ce = J.slice(0), xe = ce.length; xe--; ) + Array.isArray(ce[xe]) && (ce[xe] = y(ce[xe])); + return ce; + } + function v(J, ce) { + return J instanceof ce; + } + function x(J, ce) { + return (J.matches || J.matchesSelector || J.msMatchesSelector || J.mozMatchesSelector || J.webkitMatchesSelector || J.oMatchesSelector).call(J, ce); + } + function I(J) { + return J.toLowerCase().replace(/-(.)/g, function(ce, xe) { + return xe.toUpperCase(); + }); + } + function P(J) { + return J.charAt(0).toUpperCase() + J.slice(1); + } + function F(J) { + return J.length == 4 ? [ + "#", + J.substring(1, 2), + J.substring(1, 2), + J.substring(2, 3), + J.substring(2, 3), + J.substring(3, 4), + J.substring(3, 4) + ].join("") : J; + } + function k(J) { + var ce = J.toString(16); + return ce.length == 1 ? "0" + ce : ce; + } + function V(J, ce, xe) { + if (ce == null || xe == null) { + var Pe = J.bbox(); + ce == null ? ce = Pe.width / Pe.height * xe : xe == null && (xe = Pe.height / Pe.width * ce); + } + return { + width: ce, + height: xe + }; + } + function j(J, ce, xe) { + return { + x: ce * J.a + xe * J.c + 0, + y: ce * J.b + xe * J.d + 0 + }; + } + function Y(J) { + return { a: J[0], b: J[1], c: J[2], d: J[3], e: J[4], f: J[5] }; + } + function X(J) { + return J instanceof s.Matrix || (J = new s.Matrix(J)), J; + } + function Q(J, ce) { + J.cx = J.cx == null ? ce.bbox().cx : J.cx, J.cy = J.cy == null ? ce.bbox().cy : J.cy; + } + function re(J) { + for (var ce = 0, xe = J.length, Pe = ""; ce < xe; ce++) + Pe += J[ce][0], J[ce][1] != null && (Pe += J[ce][1], J[ce][2] != null && (Pe += " ", Pe += J[ce][2], J[ce][3] != null && (Pe += " ", Pe += J[ce][3], Pe += " ", Pe += J[ce][4], J[ce][5] != null && (Pe += " ", Pe += J[ce][5], Pe += " ", Pe += J[ce][6], J[ce][7] != null && (Pe += " ", Pe += J[ce][7]))))); + return Pe + " "; + } + function he(J) { + for (var ce = J.childNodes.length - 1; ce >= 0; ce--) + J.childNodes[ce] instanceof i.SVGElement && he(J.childNodes[ce]); + return s.adopt(J).id(s.eid(J.nodeName)); + } + function fe(J) { + return J.x == null && (J.x = 0, J.y = 0, J.width = 0, J.height = 0), J.w = J.width, J.h = J.height, J.x2 = J.x + J.width, J.y2 = J.y + J.height, J.cx = J.x + J.width / 2, J.cy = J.y + J.height / 2, J; + } + function be(J) { + var ce = (J || "").toString().match(s.regex.reference); + if (ce) + return ce[1]; + } + function Se(J) { + return Math.abs(J) > 1e-37 ? J : 0; + } + var Me = "abcdef".split(""); + if (typeof i.CustomEvent != "function") { + var ke = function(J, ce) { + ce = ce || { bubbles: !1, cancelable: !1, detail: void 0 }; + var xe = r.createEvent("CustomEvent"); + return xe.initCustomEvent(J, ce.bubbles, ce.cancelable, ce.detail), xe; + }; + ke.prototype = i.Event.prototype, s.CustomEvent = ke; + } else + s.CustomEvent = i.CustomEvent; + return function(J) { + for (var ce = 0, xe = ["moz", "webkit"], Pe = 0; Pe < xe.length && !i.requestAnimationFrame; ++Pe) + J.requestAnimationFrame = J[xe[Pe] + "RequestAnimationFrame"], J.cancelAnimationFrame = J[xe[Pe] + "CancelAnimationFrame"] || J[xe[Pe] + "CancelRequestAnimationFrame"]; + J.requestAnimationFrame = J.requestAnimationFrame || function(Oe) { + var Re = (/* @__PURE__ */ new Date()).getTime(), Ge = Math.max(0, 16 - (Re - ce)), je = J.setTimeout(function() { + Oe(Re + Ge); + }, Ge); + return ce = Re + Ge, je; + }, J.cancelAnimationFrame = J.cancelAnimationFrame || J.clearTimeout; + }(i), s; + }); +})(CCt); +var O3i = CCt.exports; +const rB = /* @__PURE__ */ VI(O3i); +class R3i extends cf { + constructor(e) { + super(e); + } + // layer renderer types + SIMPLE = "simple"; + UNIQUE_VALUE = "unique-value"; + CLASS_BREAKS = "class-breaks"; + NONE = "none"; + CONTAINER_SIZE = 32; + // size of the symbology item container + CONTENT_SIZE = 24; + // size of the symbology graphic + CONTENT_IMAGE_SIZE = 28; + // size of the symbology graphic if it's an image (images tend to already have a white boarder around them) + CONTAINER_CENTER = this.CONTAINER_SIZE / 2; + CONTENT_PADDING = (this.CONTAINER_SIZE - this.CONTENT_SIZE) / 2; + /** + * Given feature attributes, return the image URL for that feature/graphic object. + * + * @method getGraphicIcon + * @param {Object} attributes object of feature attribute key value pairs + * @param {Object} renderer an enhanced renderer (see function enhanceRenderer) + * @return {String} svgcode Url to the features symbology image + */ + getGraphicIcon(e, i) { + return i.getGraphicIcon(e); + } + /** + * Given feature attributes, return the symbol for that feature/graphic object. + * + * @method getGraphicSymbol + * @param {Object} attributes object of feature attribute key value pairs + * @param {Object} renderer an enhanced renderer (see function enhanceRenderer) + * @return {Object} an ESRI Symbol object in server format + */ + getGraphicSymbol(e, i) { + return i.getGraphicSymbol(e); + } + makeRenderer(e, i, r = !1) { + switch (e.type) { + case this.SIMPLE: + return new I3i( + e, + i + ); + case this.CLASS_BREAKS: + return new P3i( + e, + i, + r + ); + case this.UNIQUE_VALUE: + return new A3i( + e, + i, + r + ); + default: + throw new Error( + `Unknown renderer type encountered - ${e.type}` + ); + } + } + /** + * Generates svg symbology for WMS layers. + * @function generateWMSSymbology + * @param {String} name label for the symbology item (it's not used right now, but is required to be consistent with other symbology generating functions) + * @param {String} imageUri url or dataUrl of the legend image + * @return {Promise} a promise resolving with symbology svg code and its label + */ + async generateWMSSymbology(e) { + const i = rB(window.document.createElement("div")).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).viewbox(0, 0, 0, 0), r = { + svgcode: "", + imgHeight: "", + imgWidth: "" + }; + if (e) { + const n = await this.renderSymbologyImage(e); + if (n) { + r.svgcode = n; + const s = document.createElement("span"); + s.innerHTML = n; + const o = s.firstElementChild?.lastElementChild; + r.imgHeight = o?.getAttribute("height") || "", r.imgWidth = o?.getAttribute("width") || ""; + } else + r.svgcode = i.svg(); + } else + r.svgcode = i.svg(); + return r; + } + /** + * Converts a config-supplied list of symbology to the format used by layer records. + * + * @private + * @function _listToSymbology + * @param {Function} conversionFunction a conversion function to wrap the supplied image into an image or an icon style symbology container + * @param {Array} list a list of config-supplied symbology items in the form of [ { text: , image: }, ... ] wher `image` can be dataURL or an actual url + * @return {Array} an array of converted symbology symbols in the form of [ { name: , image: , svgcode: }, ... ]; items will be populated async as conversions are done + */ + listToSymbology(e, i) { + return i.map(({ text: n, image: s }) => { + const o = { + name: n, + image: s, + // url + svgcode: "" + }; + return e(s).then((a) => { + o.svgcode = a; + }), o; + }); + } + // these two functions called by legend ui to make symbol stacks. + // may need to adjust stuff with new UI + listToIconSymbology(e) { + return this.listToSymbology(this.renderSymbologyIcon, e); + } + listToImageSymbology(e) { + return this.listToSymbology(this.renderSymbologyImage, e); + } + /** + * Renders a supplied image as an image-style symbology item (preserving the true image dimensions). + * + * @function renderSymbologyImage + * @param {String} imageUri a image dataUrl or a regular url + * @param {Object} draw [optional=null] an svg container to draw the image on; if not supplied, a new one is created + */ + async renderSymbologyImage(e, i = null) { + i === null && (i = rB(window.document.createElement("div")).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).viewbox(0, 0, 0, 0)); + const r = await this.$iApi.geo.shared.convertImagetoDataURL( + e + ); + if (r === e) + return ""; + const { loader: n } = await this.svgDrawImage(i, r); + return i.viewbox(0, 0, n.width, n.height), i.svg(); + } + /** + * Renders a supplied image as an icon-style symbology item (fitting an image inside an icon container, usually 32x32 pixels). + * + * @function renderSymbologyIcon + * @param {String} imageUri a image dataUrl or a regular url + * @param {Object} draw [optional=null] an svg container to draw the image on; if not supplied, a new one is created + */ + async renderSymbologyIcon(e, i = null) { + if (i === null) { + const s = window.document.createElement("div"); + s.setAttribute( + "style", + "opacity:0;position:fixed;left:100%;top:100%;overflow:hidden" + ), window.document.body.appendChild(s), i = rB(s).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).viewbox(0, 0, this.CONTAINER_SIZE, this.CONTAINER_SIZE); + } + const r = await this.$iApi.geo.shared.convertImagetoDataURL( + e + ), { image: n } = await this.svgDrawImage(i, r); + return n.center(this.CONTAINER_CENTER, this.CONTAINER_CENTER), this.fitInto(n, this.CONTENT_IMAGE_SIZE), i.svg(); + } + /** + * Generates a placeholder symbology graphic. + * @function generatePlaceholderSymbology + * @private + * @param {String} name label symbology label + * @param {String} colour colour to use in the graphic + * @return {Object} symbology svg code and its label + */ + generatePlaceholderSymbology(e, i = "#000") { + const r = rB(window.document.createElement("div")).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).viewbox(0, 0, this.CONTAINER_SIZE, this.CONTAINER_SIZE); + return r.rect(this.CONTENT_IMAGE_SIZE, this.CONTENT_IMAGE_SIZE).center(this.CONTAINER_CENTER, this.CONTAINER_CENTER).fill(i), r.text(e[0].toUpperCase()).size(23).fill("#fff").attr({ + "font-weight": "bold", + "font-family": "Roboto" + }).center(this.CONTAINER_CENTER, this.CONTAINER_CENTER), { + name: e, + svgcode: r.svg() + }; + } + async generateBlankSymbology() { + return rB(window.document.createElement("div")).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).svg(); + } + /** + * Generate an SVG string for an ESRI symbol. + * @private + * @param {Object} symbol an ESRI symbol object in JS API format + * @return {Promise} resolves to an SVG string representing the symbol + */ + async symbolToSvg(e) { + const i = this, r = 1.33333, n = window.document.createElement("div"); + n.setAttribute( + "style", + "opacity:0;position:fixed;left:100%;top:100%;overflow:hidden" + ), window.document.body.appendChild(n); + const s = rB(n).size(this.CONTAINER_SIZE, this.CONTAINER_SIZE).viewbox(0, 0, this.CONTAINER_SIZE, this.CONTAINER_SIZE), o = { + // @ts-ignore + path({ size: x, path: I }) { + return s.path(I).size(x * r); + }, + // @ts-ignore + circle({ size: x }) { + return s.circle(x * r); + }, + // @ts-ignore + cross({ size: x }) { + return s.path("M 0,10 L 20,10 M 10,0 L 10,20").size(x * r); + }, + // @ts-ignore + x({ size: x }) { + return s.path("M 0,0 L 20,20 M 20,0 L 0,20").size(x * r); + }, + // @ts-ignore + triangle({ size: x }) { + return s.path("M 20,20 L 10,0 0,20 Z").size(x * r); + }, + // @ts-ignore + diamond({ size: x }) { + return s.path("M 20,10 L 10,0 0,10 10,20 Z").size(x * r); + }, + // @ts-ignore + square({ size: x }) { + return s.path("M 0,0 20,0 20,20 0,20 Z").size(x * r); + } + }, a = { + [I_.SOLID]: "none", + // esriSLSSolid + [I_.NONE]: "none", + // esriSLSNull + [I_.DASH]: "5.333,4", + // esriSLSDash + [I_.DOT]: "1.333,4", + // esriSLSDot + [I_.DASHDOT]: "5.333,4,1.333,4", + // esriSLSDashDot + [I_.LONGDASH]: "10.666,4", + // esriSLSLongDash + [I_.LONGDASHDOT]: "10.666,4,1.333,4", + // esriSLSLongDashDot + [I_.LONGDASHDOTDOT]: "10.666,4,1.333,4,1.333,4", + // esriSLSLongDashDotDot + [I_.SHORTDOT]: "1.333,1.333", + // esriSLSShortDot + [I_.SHORTDASH]: "5.333,1.333", + // esriSLSShortDash + [I_.SHORTDASHDOT]: "5.333,1.333,1.333,1.333", + // esriSLSShortDashDot + [I_.SHORTDASHDOTDOT]: "5.333,1.333,1.333,1.333,1.333,1.333" + // esriSLSShortDashDotDot + }, l = { + color: "#000", + opacity: 1, + width: 1, + linecap: "square", + linejoin: "miter", + miterlimit: 4 + }, c = { + color: [0, 0, 0, 0], + width: 0, + style: a.none + }, h = { + solid: (x) => ({ + color: x.colour, + opacity: x.opacity + }), + none: () => "transparent", + // esriSFSNull + horizontal: (x, I) => s.pattern( + 5, + 5, + (F) => F.line(0, 5 / 2, 5, 5 / 2) + ).stroke(I), + vertical: (x, I) => s.pattern( + 5, + 5, + (F) => F.line(5 / 2, 0, 5 / 2, 5) + ).stroke(I), + "forward-diagonal": (x, I) => s.pattern(5, 5, (F) => { + F.line(0, 0, 5, 5).stroke(I), F.line(0, 0, 5, 5).move(0, 5).stroke(I), F.line(0, 0, 5, 5).move(5, 0).stroke(I); + }), + "backward-diagonal": (x, I) => s.pattern(5, 5, (F) => { + F.line(5, 0, 0, 5).stroke(I), F.line(5, 0, 0, 5).move(5 / 2, 5 / 2).stroke(I), F.line(5, 0, 0, 5).move(-5 / 2, -5 / 2).stroke(I); + }), + cross: (x, I) => s.pattern(5, 5, (F) => { + F.line(5 / 2, 0, 5 / 2, 5).stroke( + I + ), F.line(0, 5 / 2, 5, 5 / 2).stroke( + I + ); + }), + "diagonal-cross": (x, I) => s.pattern(7, 7, (F) => { + F.line(0, 0, 7, 7).stroke(I), F.line(7, 0, 0, 7).stroke(I); + }) + }, p = { + "simple-marker"() { + const x = v(e.color); + e.outline = e.outline || c; + const I = v( + e.outline.color + ), P = y({ + color: I.colour, + opacity: I.opacity, + width: e.outline.width, + // @ts-ignore + dasharray: a[e.outline.style] + }), F = o[e.style](e).fill({ + color: x.colour, + opacity: x.opacity + }).stroke(P).center(i.CONTAINER_CENTER, i.CONTAINER_CENTER).rotate(e.angle || 0); + i.fitInto(F, i.CONTENT_SIZE); + }, + "simple-line"() { + const x = v(e.color), I = y({ + color: x.colour, + opacity: x.opacity, + width: e.width, + linecap: "butt", + // @ts-ignore + dasharray: a[e.style] + }), P = i.CONTENT_PADDING, F = i.CONTAINER_SIZE - i.CONTENT_PADDING; + s.line(P, P, F, F).stroke(I); + }, + // cartographic line style. internet is hinting that it is not supported on JS API + esriCLS() { + this["simple-line"](); + }, + "simple-fill"() { + const x = v(e.color), I = y({ + color: x.colour, + opacity: x.opacity + }), P = h[e.style]( + x, + I + ); + e.outline = e.outline || c; + const F = v( + e.outline.color + ), k = y({ + color: F.colour, + opacity: F.opacity, + width: e.outline.width, + linecap: "butt", + // @ts-ignore + dasharray: a[e.outline.style] + }); + s.rect(i.CONTENT_SIZE, i.CONTENT_SIZE).center(i.CONTAINER_CENTER, i.CONTAINER_CENTER).fill(P).stroke(k); + }, + text() { + console.error( + "no support for feature service legend of text symbols" + ); + }, + "picture-fill"() { + const x = e.imageData ? `data:${e.contentType};base64,${e.imageData}` : e.url, I = e.width * e.xscale, P = e.height * e.yscale; + e.outline = e.outline || c; + const F = v( + e.outline.color + ), k = y({ + color: F.colour, + opacity: F.opacity, + width: e.outline.width, + // @ts-ignore + dasharray: a[e.outline.style] + }); + return i.$iApi.geo.shared.convertImagetoDataURL(x).then((j) => { + const Y = s.pattern( + I, + P, + (X) => ( + // there was a 4th argument 'true' here before, but maximum 3 are accepted. may need to look into this + X.image(j, I, P) + ) + ); + s.rect(i.CONTENT_SIZE, i.CONTENT_SIZE).center( + i.CONTAINER_CENTER, + i.CONTAINER_CENTER + ).fill(Y).stroke(k); + }); + }, + "picture-marker"() { + const x = e.source, I = x && x.imageData ? `data:${x.contentType};base64,${x.imageData}` : e.url; + return i.$iApi.geo.shared.convertImagetoDataURL(I).then( + (F) => i.svgDrawImage(s, F) + ).then(({ image: F }) => { + F.center( + i.CONTAINER_CENTER, + i.CONTAINER_CENTER + ).rotate(e.angle || 0), i.fitInto(F, i.CONTENT_IMAGE_SIZE); + }); + } + }; + try { + return await Promise.resolve(p[e.type]()), window.document.body.removeChild(n), s.svg(); + } catch (x) { + return console.error(x), this.generateBlankSymbology(); + } + function y(x) { + return Object.assign({}, l, x); + } + function v(x) { + return x ? { + colour: `rgb(${x.r},${x.g},${x.b})`, + opacity: x.a + } : { + colour: "rgb(0, 0, 0)", + opacity: 0 + }; + } + } + /** + * Renders a specified image on an svg element. This is a helper function that wraps around async `draw.image` call in the svg library. + * + * @function svgDrawImage + * @private + * @param {Object} draw svg element to render the image onto + * @param {String} imageUri image url or dataURL of the image to render + * @param {Number} width [optional = 0] width of the image + * @param {Number} height [optional = 0] height of the image + * @param {Boolean} crossOrigin [optional = true] specifies if the image should be loaded as crossOrigin + * @return {Promise} promise resolving with the loaded image and its loader object (see svg.js http://documentup.com/wout/svg.js#image for details) + */ + async svgDrawImage(e, i, r = 0, n = 0, s = !0) { + return new Promise((o, a) => { + const l = e.image(i, r, n, s).loaded((c) => o({ image: l, loader: c })).error((c) => { + a(c), console.error(c); + }); + }); + } + /** + * Fits svg element in the size specified + * @param {Object} element svg element to fit + * @param {Number} CONTAINER_SIZE width/height of a container to fit the element into + */ + fitInto(e, i) { + const r = e.node.getBoundingClientRect(), n = i / Math.max(r.width, r.height); + n < 1 && e.scale(n); + } + /** + * Generate a legend object based on an ESRI renderer. + * + * @param {Object} renderer an ESRI renderer object in server JSON form + * @return {Array} list of legend symbologies + */ + rendererToLegend(e) { + let i; + const r = e.symbolUnits.slice(0); + if (e.defaultUnit && r.push(e.defaultUnit), e.falseRenderer) + i = r.map((n) => [n]); + else { + const n = /* @__PURE__ */ new Map(); + r.forEach((s) => { + const o = n.get(s.label); + o ? o.push(s) : n.set(s.label, [s]); + }), i = [], n.forEach((s) => i.push(s)); + } + return i.map((n) => { + const s = n[0], o = { + uid: this.$iApi.geo.shared.generateUUID(), + label: s.label || "", + definitionClause: n.length === 1 ? s.definitionClause : `(${n.map((a) => a.definitionClause).join(" OR ")})`, + svgcode: "", + // TODO is '' ok? maybe we need white square svg? or some loading icon? + esriStandard: !0, + // is ESRI standard symbology + visibility: !0, + lastVisbility: !0, + drawPromise: this.symbolToSvg(s.symbol).then((a) => { + o.svgcode = a, n.forEach((l) => { + l.svgCode = a; + }); + }) + }; + return o; + }); + } + /** + * Returns the legend information of an ESRI map service. + * + * @function getMapServerLegend + * @private + * @param {String} layerUrl service url (root service, not indexed endpoint) + * @returns {Promise} resolves in an array of legend data in arcgis server json format + * + */ + async getMapServerLegend(e) { + if (!e) + throw new Error( + "Legend server request is missing the required url." + ); + const i = { + query: { f: "json" } + }, r = { layers: [] }, [n, s] = await ZF( + ir(`${e}/legend`, i) + ); + return s ? s.data ? s.data : (console.error(`Error loading legend data for ${e}`), r) : (console.error(`Error loading legend for ${e}`, n), r); + } + /** + * Our symbology engine works off of renderers. When dealing with layers with no renderers, + * we need to take server-side legend and convert it to a fake renderer, which lets us + * leverage all the existing symbology code. + * + * @function mapServerLegendToRenderer + * @private + * @param {Object} serverLegend legend json from an esri map server + * @param {Integer} layerIndex the index of the layer in the legend we are interested in + * @returns {Object} a fake unique value renderer based off the legend + * + */ + mapServerLegendToRenderer(e, i) { + const r = e.layers.find((s) => s.layerId === i); + let n; + if (typeof r < "u") + return n = { + type: "uniqueValue", + field: "fakefield", + uniqueValueInfos: r.legend.map((s) => ({ + label: s.label, + value: s.label, + symbol: { + type: "esriPMS", + imageData: s.imageData, + contentType: s.contentType + } + })) + }, this.makeRenderer(MF(n), [], !0); + throw new Error( + "attempted to make renderer from non-existing legend data" + ); + } + /** + * Our symbology engine works off of renderers. When dealing with layers with no renderers, + * we need to take server-side legend and convert it to a fake renderer, which lets us + * leverage all the existing symbology code. + * + * Same as mapServerLegendToRenderer function but combines all layer renderers. + * + * @function mapServerLegendToRendererAll + * @private + * @param {Object} serverLegend legend json from an esri map server + * @returns {Object} a fake unique value renderer based off the legend + */ + mapServerLegendToRendererAll(e) { + const i = e.layers.map( + (n) => n.legend.map((s) => ({ + label: s.label, + value: s.label, + symbol: { + type: "esriPMS", + imageData: s.imageData, + contentType: s.contentType + } + })) + ), r = { + type: "uniqueValue", + field1: "fakefield", + uniqueValueInfos: [].concat(...i) + }; + return this.makeRenderer(MF(r), [], !0); + } + /** + * Orchestrator function that will: + * - Fetch a legend from an esri map server + * - Extract legend for a specific sub layer + * - Convert server legend to a temporary renderer + * - Convert temporary renderer to a viewer-formatted legend (return value) + * + * @function mapServerToLocalLegend + * @param {String} mapServerUrl service url (root service, not indexed endpoint) + * @param {Integer} [layerIndex] the index of the layer in the legend we are interested in. If not provided, all layers will be collapsed into a single legend + * @returns {Promise} resolves in a viewer-compatible legend for the given server and layer index + * + */ + async mapServerToLocalLegend(e, i = void 0) { + const r = await this.getMapServerLegend(e); + let n, s; + return typeof i > "u" ? (s = 0, n = this.mapServerLegendToRendererAll(r)) : (s = parseInt(i), n = this.mapServerLegendToRenderer( + r, + s + )), this.rendererToLegend(n); + } +} +class M3i extends cf { + constructor(e) { + super(e); + } + /** + * Gets an array of OIDs from an arcgis server feature source that satisfy a query + * + * @param options contains properties that define the query and specificy request particulars. + * @returns resolves with array of object ids. + */ + async arcGisServerQueryIds(e) { + const i = new Os(); + i.returnGeometry = !1, e.filterSql && (i.where = e.filterSql), e.filterGeometry && (i.geometry = this.queryGeometryHelper( + e.filterGeometry, + !1, + this.$iApi.geo.map.getScale(), + e.sourceSR + ), i.spatialRelationship = "intersects"); + const r = await lye(e.url, i); + return Array.isArray(r) ? r : []; + } + /** + * Gets an array of graphics from a locally stored feature layer (file, geojson) that satisfy a query + * + * @param options contains properties that define the query and specificy request particulars. + * @returns resolves with array of graphic result objects. + */ + async geoJsonQuery(e) { + const i = new Os(); + if (i.returnGeometry = !!e.includeGeometry, i.outFields = ["*"], e.filterGeometry && (i.geometry = this.queryGeometryHelper( + e.filterGeometry, + !0 + ), i.spatialRelationship = "intersects"), e.filterSql && (i.where = e.filterSql), await e.layer.loadPromise(), !e.layer.esriLayer) + throw new Error("file layer being queried contains no ESRI layer"); + return (await e.layer.esriLayer.queryFeatures(i)).features.map((n, s) => { + let o; + return i.returnGeometry ? o = this.$iApi.geo.geom.geomEsriToRamp( + n.geometry, + `queryResult${s}` + ) : o = new g8(), new bx(o, "", n.attributes); + }); + } + /** + * Helper function to modify input geometries for queries. Will attempt to avoid various pitfalls, + * usually around projections + * + * @private + * @param {BaseGeometry} geometry the geometry to be used in a query as a filter + * @param {Boolean} isFileLayer true if layer is not tied to an arcgis server + * @param {Integer} [mapScale] optional scale value of the map to help detect problem situations + * @param {SpatialReference} [sourceSR] optional spatial reference of the layer being queried to help detect problem situations + * @return {Geometry} returns the input geometry in the most appropriate form based on the inputs + */ + queryGeometryHelper(e, i, r, n) { + let s; + return !i && e.type === el.EXTENT ? r && n && r > 2e7 && e.sr.wkid === 3978 && n.wkid === 4326 ? s = e.toESRI() : s = e.toPolygon().toESRI() : s = e.toESRI(), s; + } + /** + * Create an extent centered around a point, that is appropriate for the current map scale. + * + * @function makeClickBuffer + * @param {Point} point point on the map for extent center + * @param {Integer} tolerance optional. distance in pixels from mouse point that qualifies as a hit. default is 5 + * @return {Extent} an extent of desired size and location + */ + makeClickBuffer(e, i = 5) { + const r = this.$iApi.geo.map, n = r.getExtent(), s = i * (n.xmax - n.xmin) / r.getPixelWidth(); + return new Rd( + "ze_buffer", + [e.x - s, e.y - s], + [e.x + s, e.y + s], + e.sr + ); + } +} +class D3i extends cf { + attributes; + geom; + layer; + map; + proj; + query; + shared; + symbology; + /** + * @constructor + * @param {InstanceAPI} iApi the RAMP instance + */ + constructor(e) { + super(e), this.geom = l7.geom, this.proj = l7.proj, this.shared = l7.sharedUtils, this.map = new uPi(e), this.layer = new h3i(e), this.attributes = new C3i(e), this.query = new M3i(e), this.symbology = new R3i(e); + } + /** + * Set a proxy service to allow consumption of cross-domain non-CORS resources. + * + * @param {string} proxyUrl Url to proxy or empty string to clear. Must be relative url on host domain, or full url to CORS supported server + */ + set proxy(e) { + ua.request.proxyUrl = e; + } + /** + * Read the current proxy setting, returns url string, empty string if no proxy + */ + get proxy() { + return ua.request.proxyUrl || ""; + } +} +const F3i = /* @__PURE__ */ Object.assign({ + "../fixtures/appbar/index.ts": () => Promise.resolve().then(() => mgr), + "../fixtures/areas-of-interest/index.ts": () => Promise.resolve().then(() => Ngr), + "../fixtures/basemap/index.ts": () => Promise.resolve().then(() => ayr), + "../fixtures/crosshairs/index.ts": () => Promise.resolve().then(() => fyr), + "../fixtures/details/index.ts": () => Promise.resolve().then(() => X0r), + "../fixtures/export-footnote/index.ts": () => Promise.resolve().then(() => Q0r), + "../fixtures/export-legend/index.ts": () => Promise.resolve().then(() => lvr), + "../fixtures/export-map/index.ts": () => Promise.resolve().then(() => cvr), + "../fixtures/export-northarrow/index.ts": () => Promise.resolve().then(() => dvr), + "../fixtures/export-scalebar/index.ts": () => Promise.resolve().then(() => fvr), + "../fixtures/export-timestamp/index.ts": () => Promise.resolve().then(() => gvr), + "../fixtures/export-title/index.ts": () => Promise.resolve().then(() => vvr), + "../fixtures/export/index.ts": () => Promise.resolve().then(() => Lvr), + "../fixtures/gazebo/index.ts": () => Promise.resolve().then(() => u_r), + "../fixtures/geosearch/index.ts": () => Promise.resolve().then(() => Q_r), + "../fixtures/grid/index.ts": () => Promise.resolve().then(() => Uwr), + "../fixtures/help/index.ts": () => Promise.resolve().then(() => Txr), + "../fixtures/hilight/index.ts": () => Promise.resolve().then(() => Pxr), + "../fixtures/layer-reorder/index.ts": () => Promise.resolve().then(() => W2r), + "../fixtures/legend/index.ts": () => Promise.resolve().then(() => Q2r), + "../fixtures/mapnav/index.ts": () => Promise.resolve().then(() => gSr), + "../fixtures/metadata/index.ts": () => Promise.resolve().then(() => MSr), + "../fixtures/northarrow/index.ts": () => Promise.resolve().then(() => zSr), + "../fixtures/overviewmap/index.ts": () => Promise.resolve().then(() => iCr), + "../fixtures/panguard/index.ts": () => Promise.resolve().then(() => lCr), + "../fixtures/scrollguard/index.ts": () => Promise.resolve().then(() => mCr), + "../fixtures/settings/index.ts": () => Promise.resolve().then(() => qCr), + "../fixtures/snowman/index.ts": () => Promise.resolve().then(() => QCr), + "../fixtures/wizard/index.ts": () => Promise.resolve().then(() => DEr) +}); +class L3i extends cf { + /** + * Creates an instance of FixtureAPI. + * + * @param {InstanceAPI} iApi + * @memberof FixtureAPI + */ + constructor(e) { + super(e); + } + /** + * Loads a (built-in) fixture or adds supplied fixture into the R4MP Vue instance. + * + * @param {string} id + * @param {IFixtureBase} [constructor] + * @returns {Promise} + * @memberof FixtureAPI + */ + // TODO: implement overload to add a list of features + async add(e, i) { + let r; + if (e in iO(this.$vApp.$pinia).items) + return this.get(e); + if (i) { + if (typeof i != "function") + throw new Error("malformed fixture constructor"); + r = oc.updateBaseToInstance( + new i(), + e, + this.$iApi + ); + } else { + const n = (await F3i[`../fixtures/${e}/index.ts`]()).default; + r = new n(e, this.$iApi); + } + return iO(this.$vApp.$pinia).addFixture(r), this.$iApi.event.emit(an.FIXTURE_ADDED, r), this.$iApi.geo.map.created && r.initialized?.(), r; + } + /** + * Removes the specified fixture from R4MP instance. + * + * @template T + * @param {(FixtureBase | string)} fixtureOrId + * @returns {T} + * @memberof FixtureAPI + */ + remove(e) { + const i = this.get(e); + if (!i) + throw new Error( + `Could not find fixture ${e} for removal` + ); + return iO(this.$vApp.$pinia).removeFixture(i), this.$iApi.event.emit(an.FIXTURE_REMOVED, i), i; + } + get(e) { + const i = []; + typeof e == "string" ? i.push(e) : Array.isArray(e) ? i.push(...e) : i.push(e.id); + const r = i.map((n) => { + const s = iO(this.$vApp.$pinia).items[n]; + if (s) + return s; + }); + return r.length === 1 ? r[0] : r; + } + /** + * Provides a promise that resolves when the fixture(s) have finished loading. + * + * @param {(string | string[])} fixtureId the fixture ID(s) for which the promise is requested + * @memberof FixtureAPI + */ + isLoaded(e) { + const i = iO(this.$vApp.$pinia), r = Array.isArray(e) ? e : [e]; + return r.forEach((n) => { + i.loadPromises[n] === void 0 && i.addLoadPromise(n); + }), Promise.all(i.getLoadPromises(r)); + } + /** + * Loads the set of standard, built-in fixtures to the R4MP Vue instance. + * This will quickly set up the vanilla version of RAMP. + * Note this function is automatically run by the instance startup unless the loadDefaultFixtures option is + * set to false. The function is exposed to allow custom pages the ability to call it at a different point + * in the startup. Also, a subset of standard fixtures can be provided on the optional parameter if one + * wishes to omit some of the standard fixtures. + * + * @param {Array} [fixtureNames] list of built-in fixtures names to add. omission means all built-in fixtures will be added + * @returns {Promise>} resolves with array of default fixtures + * @memberof FixtureAPI + */ + addDefaultFixtures(e) { + (!Array.isArray(e) || e.length === 0) && (e = [ + "appbar", + "basemap", + "crosshairs", + "details", + "geosearch", + "grid", + "help", + "hilight", + "layer-reorder", + "legend", + "mapnav", + "northarrow", + "overviewmap", + "scrollguard", + "panguard", + "settings", + "wizard" + ]); + const i = fm(this.$vApp.$pinia); + return i.startingFixtures = e, Promise.all(e.map((r) => this.add(r))); + } +} +class oc extends cf { + /** + * Adds missing functions and properties to the object implementing FixtureBase interface. + * This is only needed for external fixtures as they can't inherit from FixtureInstance. + * + * TODO: If you know a better way to deep-mixin props/getters/functions from a class into another class instance, please tell me. I honestly don't know 🤷‍♂️. + * + * @static + * @param {FixtureBase} value + * @param {string} id + * @param {InstanceAPI} $iApi + * @returns {FixtureInstance} + * @memberof FixtureInstance + */ + static updateBaseToInstance(e, i, r) { + const n = new oc(i, r); + return Object.defineProperties(e, { + id: { value: i }, + $iApi: { value: r }, + $vApp: { + get() { + return n.$vApp; + } + }, + remove: { value: n.remove }, + extend: { value: n.extend }, + config: { + get() { + return n.config; + } + }, + mount: { value: n.mount } + }), e; + } + /** + * ID of this fixture. + * + * @type {string} + * @memberof FixtureInstance + */ + id; + /** + * Creates an instance of FixtureInstance. + * + * @param {string} id + * @param {InstanceAPI} iApi + * @memberof FixtureInstance + */ + constructor(e, i) { + super(i), this.id = e; + } + /** + * Removes the specified fixture from R4MP instance. + * This is a proxy to `rInstance.fixture.remove(...)`. + * + * @returns {this} + * @memberof FixtureInstance + */ + remove() { + return this.$iApi.fixture.remove(this), this; + } + /** + * A helper function to create a "subclass" of the base Vue constructor + * + * @param {VueConstructor} vueComponent + * @param {ComponentOptions} [options={}] + * @returns {Vue} + * @memberof FixtureInstance + */ + extend(e, i = {}) { + const r = Kr({ + extends: e, + iApi: this.$iApi, + data() { + return { + ...i + }; + } + }), n = e0e(r), { el: s } = this.mount(r, { + props: { ...i.propsData }, + app: n + }); + return s; + } + /** + * Helper with programatically creating a component in Vue 3 (replaces the deprecated Vue.extend) + * + * @param {Component} component + * @param {object} props + * @param {any} children + * @param {HTMLElement} element + * @param {App} app + * @returns {VNode, function, HTMLElement} + * @memberof FixtureInstance + */ + mount(e, { props: i, children: r, element: n, app: s } = {}) { + let o = n, a = JS(e, i, r); + return s && s._context && (a.appContext = s._context), o ? OS(a, o) : OS(a, o = document.createElement("div")), { vNode: a, destroy: () => { + o && OS(null, o), o = null, a = null; + }, el: o }; + } + /** + * Returns the fixture config section (JSON) taken from the global config. + * + * @readonly + * @type {*} + * @memberof FixtureInstance + */ + get config() { + return fm(this.$vApp.$pinia).config.fixtures[this.id]; + } + /** + * Get this fixture's config from the layer config with the given layer id + * Will return `undefined` if layer config did not specify a config for this fixture + * + * @param {string} layerId The layer's id + * @returns {any} This fixture's config for the given layer + */ + getLayerFixtureConfig(e) { + return this.getLayerFixtureConfigs()[e]; + } + /** + * Combines this fixtures configs from layer configs into an indexed-dictionary + * + * @returns {{ [layerId: string]: any }} Dictionary where key is the layer id and the value is this fixture's config for that layer + */ + getLayerFixtureConfigs() { + const e = {}, i = (r, n = void 0) => { + if (r.fixtures && r.fixtures[this.id] !== void 0) { + let s = r.id; + n !== void 0 && (s = `${n.id}-${r.index}`), e[s] = r.fixtures[this.id]; + } + r.sublayers && r.sublayers.forEach( + (s) => i(s, r) + ); + }; + return this.$iApi.geo.layer.allLayers().forEach((r) => i(r.config)), e; + } + /** + * If the `panelWidth` property is provided, handle default and specified panel widths for the given fixture. + * + * @param {Array} panels list of panel names for the calling fixture + */ + handlePanelWidths(e) { + if (this.config?.panelWidth) { + const i = {}; + typeof this.config?.panelWidth == "number" && (this.config.panelWidth = { + default: this.config?.panelWidth + }), this.config.panelWidth.default && e.forEach((r) => { + i[r] = this.config.panelWidth.default; + }); + for (const r in this.config.panelWidth) + r != "default" && (i[r] = this.config.panelWidth[r]); + for (const r in i) { + const n = this.$iApi.panel.get(r); + this.$iApi.panel.setStyle(n, { + "flex-basis": `${i[r]}px` + }); + } + } + } + /** + * If the `panelTeleport` property is provided, handle specified panelTeleport for the given fixture. + * + * @param {Array} panels list of panel names for the calling fixture + */ + handlePanelTeleports(e) { + if (this.config?.panelTeleport) { + const i = V0(this.$vApp.$pinia), r = !!this.config.panelTeleport.target; + e.forEach((n) => { + i.items[n].teleport = r ? this.config.panelTeleport : this.config.panelTeleport[n], i.items[n].style.width = "100%"; + }); + } + } +} +class N3i extends cf { + panelStore = V0(this.$vApp.$pinia); + register(e, i) { + const r = k3i(e) ? { [e.id]: e.config } : e; + if (i) { + const s = i.i18n || {}, o = this.$iApi.$i18n; + Object.entries(s.messages || {}).forEach( + (a) => o.mergeLocaleMessage(...a) + ), Object.entries(s.dateTimeFormats || {}).forEach( + (a) => o.mergeDateTimeFormat(...a) + ), Object.entries(s.numberFormats || {}).forEach( + (a) => o.mergeNumberFormat(...a) + ); + } + const n = Object.entries(r).reduce((s, [o, a]) => (s.push(new lG(this.$iApi, o, a)), s), []); + return n.forEach((s) => this.panelStore.registerPanel(s)), n.length === 1 ? n[0] : n.reduce((s, o) => (s[o.id] = o, s), {}); + } + /** + * Provides a promise that resolves when the panel(s) have finished registration. + * + * @param {(string | string[])} panelId the panel ID(s) for which the promise is requested + * @memberof PanelAPI + */ + isRegistered(e) { + const i = Array.isArray(e) ? e : [e]; + return i.forEach((r) => { + this.panelStore.regPromises[r] === void 0 && this.panelStore.addRegPromise(r); + }), Promise.all( + this.panelStore.getRegPromises(i) + // not sure how to get typescript to stop yelling + ); + } + /** + * Removes a panel instance + * + * @param {(string | PanelInstance)} value + * @memberof PanelAPI + */ + remove(e) { + const i = this.get(e); + i && (i.isOpen && this.close(i), this.panelStore.removePanel(i)); + } + /** + * Finds and returns a panel with the id specified. + * + * @param {(string | PanelInstance)} value + * @returns {PanelInstance} + * @memberof PanelAPI + */ + // TODO: implement overload to get a list of panels, similar to `feature.get([...])` + get(e) { + const i = typeof e == "string" ? e : e.id; + return this.panelStore.items[i]; + } + /** + * Opens a registered panel in the panel stack. + * + * - `rInstance.panel.open('panel-id')` -- opens the 'panel-id' panel on the first screen in the set + * - `rInstance.panel.open()` -- opens the provided `PanelInstance` object on the first screen in the set + * - `rInstance.panel.open({ id: 'panel-id', screen: 'screen-id' })` -- opens the 'panel-id' panel on the 'screen-id' screen + * - `rInstance.panel.open({ id: 'panel-id', screen: 'screen-id', props: {... } })` -- opens the 'panel-id' panel on the 'screen-id' screen passing supplied `props` to it + * + * @param {(string | PanelInstance | PanelInstancePath)} value a panel id, a `PanelInstance` object or an object of the form `{ id: , screen: , props: }`. + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + open(e) { + let i, r, n; + if (typeof e == "string" || e instanceof lG ? i = this.get(e) : (i = this.get(e.id), { screen: r, props: n } = e), !i) + return i; + if (i.isOpen && !i.isVisible) + i.minimize(); + else if (i.isOpen) + return i; + return r || (i.route && !n ? { screen: r, props: n } = i.route : r = Object.keys(i.screens).pop()), this.show(i, { screen: r, props: n }) ? (this.panelStore.openPanel(i), this.$iApi.updateAlert( + this.$iApi.$i18n.t("panels.alert.open", { + name: i.alertName ? this.$iApi.$i18n.t(i.alertName) : i.id + }) + ), this.$iApi.event.emit(an.PANEL_OPENED, i)) : console.error(`Failed to open ${i.id} panel.`), i; + } + /** + * Returns an array of open `PanelInstance` objects. + * + * @readonly + * @type {PanelInstance[]} + * @memberof PanelAPI + */ + get opened() { + return this.panelStore.orderedItems.concat(this.panelStore.teleported); + } + /** + * Returns an array of visible `PanelInstance` object. + * This is not every *open* panel, only the ones currently visible to the user. + * + * @readonly + * @type {PanelInstance[]} + * @memberof PanelAPI + */ + get visible() { + return this.panelStore.visible.concat(this.panelStore.teleported); + } + /** + * Closes the panel specified. + * + * @param {(string | PanelInstance)} value + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + close(e) { + const i = this.get(e); + return i && (i.isPinned && i.pin(!1), this.panelStore.closePanel(i), this.$iApi.updateAlert( + this.$iApi.$i18n.t("panels.alert.close", { + name: i.alertName ? this.$iApi.$i18n.t(i.alertName) : i.id + }) + ), this.$iApi.event.emit(an.PANEL_CLOSED, i), i); + } + /** + * Minimizes the panel specified, mechanically the same as closing however it does not emit the close event so that temporary appbar buttons stay. + * + * @param {(string | PanelInstance)} value + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + minimize(e) { + const i = this.get(e); + return i && (i.isPinned && i.pin(!1), this.panelStore.closePanel(i), this.$iApi.updateAlert( + this.$iApi.$i18n.t("panels.alert.minimize", { + name: i.alertName ? this.$iApi.$i18n.t(i.alertName) : i.id + }) + ), this.$iApi.event.emit(an.PANEL_MINIMIZED, i), i); + } + /** + * Moves the specifed visible panel to the left or right. + * + * @param {(string | PanelInstance)} value + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + move(e, i) { + const r = this.get(e); + return r && (this.panelStore.movePanel(r, i), r); + } + /** + * Toggle panel. + * + * @param {string | PanelInstance | PanelInstancePath} [value] + * @param {boolean} toggle Optional param. True forces a panel open, false forces the panel to close. + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + toggle(e, i) { + let r; + return typeof e == "string" || e instanceof lG ? r = this.get(e) : r = this.get(e.id), r && (i = typeof i < "u" ? i : !r.isVisible, i !== r.isVisible && (i ? this.open(e) : this.close(r)), r); + } + /** + * Toggle panel's minimized state + * + * @param {string | PanelInstance | PanelInstancePath} [value] + * @param {boolean} toggle Optional param. True forces a panel open, false forces the panel to minimize. + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + toggleMinimize(e, i) { + let r; + return typeof e == "string" || e instanceof lG ? r = this.get(e) : r = this.get(e.id), r && (i = typeof i < "u" ? i : !r.isVisible, i !== r.isVisible && (i ? this.open(r) : this.minimize(r)), r); + } + /** + * Pin/unpin/toggle (if no value provided) pin status of the provided panel. When pinning, automatically unpins any previous pinned panel if exists. + * + * @param {(string | PanelInstance)} value + * @param {boolean} [pin] + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + pin(e, i) { + const r = this.get(e); + return !r || (i = typeof i < "u" ? i : !r.isPinned, !r.isPinned && !i) || (this.panelStore.pinned = i ? r : void 0), r; + } + /** + * Returns the currently pinned panel instance, if exists. + * + * @readonly + * @type {(PanelInstance | undefined)} + * @memberof PanelAPI + */ + get pinned() { + return this.panelStore.pinned || void 0; + } + /** + * Sets route to the specified screen id and pass props to the panel screen components. + * + * @param {(string | PanelInstance)} value + * @param {PanelConfigRoute} route + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered and the specified screen exists, undefined otherwise. + * @memberof PanelAPI + */ + // TODO: implement panel route history + show(e, i) { + const r = this.get(e); + if (!r) + return r; + if (r.screens[i.screen]) { + if (r.screens[i.screen]?.props) { + const n = Object.keys( + r.screens[i.screen]?.props + ).filter((o) => o !== "panel"), s = i.props ? Object.keys(i.props) : []; + for (let o = 0; o < n.length; o++) + if (!s.includes(n[o]) && r.screens[i.screen].props[n[o]].required) + return; + } + return i.screen in this.$element._context.components || r.registerScreen(i.screen), r.teleport && (i.props = { + header: !!r.teleport?.showHeader, + ...i.props + }), this.panelStore.items[r.id].route = i, r; + } + } + /** + * Sets the styles of the specified panel by using a provided CSS styles object. + * + * @param {(string | PanelInstance)} value + * @param {object} style + * @param {boolean} [replace=false] merge with existing styles if `false`; replace if `true` + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + setStyle(e, i, r = !1) { + const n = this.get(e); + return n && (this.panelStore.items[n.id].style = r ? i : { ...n.style, ...i }, n); + } + /** + * Expands/collapses the expand state of the panel. Toggles whether the panel expands if no expand value is given. + * + * @param {(string | PanelInstance)} value + * @param {boolean} expand Optional. Whether the panel should expand, toggles the value if not set + * @returns {PanelInstance | undefined} the panel instance if the panel is currently registered, undefined otherwise. + * @memberof PanelAPI + */ + expand(e, i) { + const r = this.get(e); + return r && (this.panelStore.items[r.id].expanded = i !== void 0 ? i : !r.expanded, r); + } +} +function k3i(t) { + return t.id !== void 0 && typeof t.id == "string" && t.config !== void 0; +} +const $3i = {}, B3i = (t) => (Pc("data-v-a3c61802"), t = t(), Oc(), t), V3i = /* @__PURE__ */ B3i(() => /* @__PURE__ */ Dt("div", { class: "loader" }, null, -1)); +function j3i(t, e) { + const i = Bo("panel-screen"); + return qt(), In(i, { + header: !1, + class: "screen-spinner" + }, { + content: Sn(() => [ + V3i + ]), + _: 1 + }); +} +const G3i = /* @__PURE__ */ ol($3i, [["render", j3i], ["__scopeId", "data-v-a3c61802"]]), U3i = /* @__PURE__ */ Object.assign({ "../fixtures/areas-of-interest/screen.vue": () => Promise.resolve().then(() => Mgr), "../fixtures/basemap/screen.vue": () => Promise.resolve().then(() => iyr), "../fixtures/export/screen.vue": () => Promise.resolve().then(() => Mvr), "../fixtures/geosearch/screen.vue": () => Promise.resolve().then(() => q_r), "../fixtures/grid/screen.vue": () => Promise.resolve().then(() => Vwr), "../fixtures/help/screen.vue": () => Promise.resolve().then(() => bxr), "../fixtures/layer-reorder/screen.vue": () => Promise.resolve().then(() => G2r), "../fixtures/legend/screen.vue": () => Promise.resolve().then(() => K2r), "../fixtures/metadata/screen.vue": () => Promise.resolve().then(() => PSr), "../fixtures/settings/screen.vue": () => Promise.resolve().then(() => zCr), "../fixtures/wizard/screen.vue": () => Promise.resolve().then(() => PEr) }); +class lG extends cf { + /** + * ID of this panel. + * + * @type {string} + * @memberof PanelInstance + */ + id; + /** + * A collection of panel screens to be displayed inside the panel. + * + * @type {PanelConfigScreens} + * @memberof PanelInstance + */ + screens; + /** + * A list of screen component ids which are loaded and ready to be rendered. + * + * @private + * @type {string[]} + * @memberof PanelInstance + */ + loadedScreens = []; + alertName; + /** + * The config for the element to render the panel screen in (instead of its usual spot in the panel stack). + */ + teleport; + controls; + button; + /** + * Checks if a given screen component id is already loaded and ready to render. + * + * @param {string} id + * @returns {boolean} + * @memberof PanelInstance + */ + isScreenLoaded(e) { + return this.loadedScreens.indexOf(e) !== -1; + } + /** + * Loads and register panel screen components. + * This function should be called just before the screen is to be shown; this will avoid needlessly loading components upfront + * (sometimes certain screens might not get used at all). + * + * @param {string} id + * @memberof PanelInstance + */ + registerScreen(e) { + const i = this.screens[e]; + let r; + if (u0i(i) || l0i(i)) + r = i, this.loadedScreens.push(e); + else { + let n; + typeof i == "string" ? n = U3i[`../fixtures/${i}`]() : n = i(); + const s = new Promise((o, a) => { + n.then((l) => { + this.loadedScreens.push(e), o(c0i(l) ? l.default : l); + }), n.catch((l) => a(l)); + }); + r = NQ({ + // The component to load (should be a Promise) + loader: () => s, + // A component to use while the async component is loading + loadingComponent: G3i, + // A component to use if the load fails + // TODO: add error component + // error: ErrorComponent, + // Delay before showing the loading component. Default: 200ms. + delay: 200 + // The error component will be displayed if a timeout is + // provided and exceeded. Default: Infinity. + // TODO: restore the error timeout + // timeout: 3000, + }); + } + this.$iApi.$element.component(e, r); + } + /** + * The style object applied to the panel. + * + * @type {PanelConfigStyle} + * @memberof PanelInstance + */ + style; + /** + * Whether the panel expands to fill empty space. + * + * @type {boolean} + * @memberof PanelInstance + */ + expanded; + /** + * Returns the width of the panel in pixels or undefined if not set. + * + * @readonly + * @type {(number | undefined)} + * @memberof PanelInstance + */ + get width() { + if (!(!this.style.width || this.style.width.slice(-2) !== "px")) + return parseInt(this.style.width); + } + /** + * Specifies which panel screen to display and optional props to be passed to the screen panel component. + * + * @type {PanelConfigRoute} + * @memberof PanelConfig + */ + route; + /** + * Creates an instance of PanelInstance. + * + * @param {InstanceAPI} iApi + * @param {string} id + * @param {PanelConfig} config + * @param {PanelRegistrationOptions} [options={}] + * @memberof PanelInstance + */ + constructor(e, i, r) { + if (super(e), { + id: this.id, + screens: this.screens, + style: this.style, + expanded: this.expanded, + alertName: this.alertName, + button: this.button, + controls: this.controls + } = { + id: i, + style: {}, + expanded: !1, + controls: { + expand: !1, + ...r.controls + }, + ...r + }, Object.keys(this.screens).length === 0) + throw new Error("panel must have at least a single screen"); + this.route = { screen: Object.keys(this.screens).pop() }, this.style["flex-basis"] || (this.style["flex-basis"] = this.style.width || "350px"), this.style.width = "80%"; + } + /** + * Opens a registered panel in the panel stack. + * This is a proxy to `InstanceAPI.panel.open(...)`. + * + * - `somePanel.open()` -- opens the panel on the first screen in the set + * - `somePanel.open('screen-id')` -- opens the panel on the 'screen-id' screen + * - `somePanel.open({ screen: 'screen-id', props: {... } })` -- opens the panel on the 'screen-id' screen passing supplied `props` to it + * + * @param {(string | { screen: string; props?: object })} value a screen id, or an object of the form `{ screen: , props: }`. + * @returns {this} + * @memberof PanelInstance + */ + open(e) { + return typeof e > "u" ? this.$iApi.panel.open(this) : this.$iApi.panel.open({ + id: this.id, + ...typeof e == "string" ? { screen: e } : e + }), this; + } + /** + * Checks if the panel is open or not. + * + * @readonly + * @type {boolean} + * @memberof PanelInstance + */ + get isOpen() { + return this.$iApi.panel.opened.indexOf(this) !== -1; + } + /** + * true iff the panel is currently visible + * + * @readonly + * @type {boolean} + * @memberof PanelInstance + */ + get isVisible() { + return this.$iApi.panel.visible.indexOf(this) !== -1; + } + /** + * Close this panel. + * This is a proxy to `InstanceAPI.panel.close(...)`. + * + * @returns {this} + * @memberof PanelInstance + */ + close() { + return this.$iApi.panel.close(this), this; + } + /** + * Minimize this panel. + * This is a proxy to `InstanceAPI.panel.minimize(...)`. + * + * @returns {this} + * @memberof PanelInstance + */ + minimize() { + return this.$iApi.panel.minimize(this), this; + } + /** + * Move this panel left or right in the stack. + * This is a proxy to `InstanceAPI.panel.move(...)`. + * + * @returns {this} + * @memberof PanelInstance + */ + move(e) { + return this.$iApi.panel.move(this, e), this; + } + /** + * Checks if this panel is the leftmost visible and not-teleported panel. + * + * @readonly + * @type {boolean} + * @memberof PanelInstance + */ + get isLeftMostPanel() { + if (this.$iApi.panel.visible.length > 0) { + for (const e of this.$iApi.panel.visible) + if (!e.teleport) + return this.id === e.id; + } + return !1; + } + /** + * Checks if this panel is the rightmost visible and non-teleported panel. + * Note that a traditional for each loop is used due to reverse traversal of the array. + * + * @readonly + * @type {boolean} + * @memberof PanelInstance + */ + get isRightMostPanel() { + if (this.$iApi.panel.visible.length > 0) { + for (let e = this.$iApi.panel.visible.length - 1; e >= 0; e--) + if (!this.$iApi.panel.visible[e].teleport) + return this.id === this.$iApi.panel.visible[e].id; + } + return !1; + } + /** + * Remove this panel. + * This is a proxy to `InstanceAPI.panel.remove(...)`. + * + * @returns {this} + * @memberof PanelInstance + */ + remove() { + return this.$iApi.panel.remove(this), this; + } + /** + * Toggle panel. + * This is a proxy to `InstanceAPI.panel.toggle(...)`. + * + * @param {(boolean | { screen: string; props?: object; toggle?: boolean })} [value] + * @returns {this} + * @memberof PanelInstance + */ + toggle(e) { + return typeof e > "u" ? this.$iApi.panel.toggle(this, !this.isOpen) : typeof e == "boolean" ? e !== this.isOpen && this.$iApi.panel.toggle(this, e) : this.$iApi.panel.toggle( + { id: this.id, screen: e.screen, props: e.props }, + typeof e.toggle < "u" ? e.toggle : !this.isOpen + ), this; + } + /** + * Toggle panel's minimize state. + * This is a proxy to `InstanceAPI.panel.toggleMinimize(...)`. + * + * @param {(boolean | { screen: string; props?: object; toggle?: boolean })} [value] + * @returns {this} + * @memberof PanelInstance + */ + toggleMinimize(e) { + return typeof e > "u" || typeof e == "boolean" ? this.$iApi.panel.toggleMinimize(this, e) : this.$iApi.panel.toggleMinimize( + { id: this.id, screen: e.screen, props: e.props }, + typeof e.toggle < "u" ? e.toggle : !this.isOpen + ), this; + } + /** + * Pin/unpin/toggle (if no value provided) pin status of this panel. When pinning, automatically unpins any previous pinned panel if exists. + * This is a proxy to `InstanceAPI.panel.pin(...)`. + * + * + * @param {boolean} [value] + * @returns {this} + * @memberof PanelInstance + */ + pin(e) { + return e = typeof e < "u" ? e : !this.isPinned, this.$iApi.panel.pin(this, e), this; + } + /** + * Checks if this panel is pinned or not. + * + * @readonly + * @type {boolean} + * @memberof PanelInstance + */ + get isPinned() { + return !!this.$iApi.panel.pinned && this.$iApi.panel.pinned.id === this.id; + } + /** + * Sets route to the specified screen id and pass props to the panel screen components. + * This is a proxy to `InstanceAPI.panel.route(...)`. + * + * @param {(string | PanelConfigRoute)} value + * @returns {this} + * @memberof PanelInstance + */ + show(e) { + const i = typeof e == "string" ? { screen: e } : e; + return this.route = i, this.$iApi.panel.show(this, i), this; + } + /** + * Sets the styles of the specified panel by using a provided CSS styles object. + * This is a proxy to `InstanceAPI.panel.setStyles(...)`. + * + * @param {object} style + * @param {boolean} [replace=false] + * @returns {this} + * @memberof PanelInstance + */ + setStyles(e, i = !1) { + return this.$iApi.panel.setStyle(this, e, i), this; + } + /** + * Expands/collapses/toggles the expand state of the panel. Panels set to expand fill empty space. + * This is a proxy to `InstanceAPI.panel.expand(...)`. + * + * @param {boolean} expand Optional. Whether the panel should expand. Toggles if no value is given. + * @returns {this} + * @memberof PanelInstance + */ + expand(e) { + return this.$iApi.panel.expand(this, e), this; + } +} +function z3i(t) { + const e = {}; + (Array.isArray(t) ? t : [t]).forEach((o) => { + o.language || (console.warn( + "RAMP2 config with no language supplied. Defaulting to English" + ), o.language = "en"); + const a = H3i(o); + e[o.language] = a; + }); + const r = Object.entries(e).map( + (o) => { + const a = o[1].fixturesEnabled; + return delete o[1].fixturesEnabled, a; + } + ); + let n = !1; + const s = r.reduce( + (o, a) => o.filter((l) => { + const c = a.includes(l); + return n = n || !c, c; + }) + ); + return n && console.warn( + "Configs attempted to load different sets of fixtures. Only common fixtures will be loaded (all configs must load the same fixtures)." + ), s.push( + "grid", + "crosshairs", + "scrollguard", + "panguard", + "wizard", + "layer-reorder", + "details" + ), { + startingFixtures: s, + configs: e + }; +} +function H3i(t) { + const e = { + // TODO is there a current version variable anywhere? I can see us forgetting to update this. + // on the other hand, any updates to the target version will need to edit this file. + version: "4.0", + fixtures: {}, + layers: [], + map: {}, + panels: { open: [] }, + system: { animate: !0, exposeOid: !1, exposeMeasurements: !0 }, + fixturesEnabled: [] + // this will be removed in the final step of configUpgrade2to4 + }; + return q3i(t.services, e), W3i(t.map, e), Y3i(t.ui, e), t.plugins && X3i(t.plugins, e), e; +} +function W3i(t, e) { + if (t.layers && t.layers.forEach((i) => { + e.layers.unshift(TCt(i)); + }), t.initialBasemapId && (e.map.initialBasemapId = t.initialBasemapId), t.components) { + if (t.components.geoSearch && (t.components.geoSearch.enabled && e.fixturesEnabled.push("geosearch"), typeof t.components.geoSearch.showGraphic < "u" && console.warn( + "showGraphic property provided in geoSearch map component cannot be mapped and will be skipped." + ), typeof t.components.geoSearch.showInfo < "u" && console.warn( + "showInfo property provided in geoSearch map component cannot be mapped and will be skipped." + )), t.components.overviewMap && t.components.overviewMap.enabled && (e.fixtures.overviewmap || (e.fixtures.overviewmap = { + basemaps: {} + }, e.fixturesEnabled.push("overviewmap")), e.fixtures.overviewmap.startMinimized = !t.components.overviewMap.initiallyExpanded, e.fixtures.overviewmap.expandFactor = t.components.overviewMap.expandFactor ?? 1.5), t.components.northArrow && t.components.northArrow.enabled) { + const i = {}; + t.components.northArrow.arrowIcon && (i.arrowIcon = t.components.northArrow.arrowIcon), t.components.northArrow.poleIcon && (i.poleIcon = t.components.northArrow.poleIcon), i && (e.fixtures.northarrow = i, e.fixturesEnabled.push("northarrow")); + } + if (t.components.scaleBar && t.components.scaleBar.enabled) { + switch (e.map.caption = { + mapCoords: { + disabled: !1 + }, + scaleBar: { + disabled: !1, + imperialScale: t?.components?.scaleBar?.scalebarUnit === "english" || t?.components?.scaleBar?.scalebarUnit === "dual" && Math.floor(Math.random() * 2) === 0 + } + }, t.components?.mouseInfo?.spatialReference?.wkid) { + case 4326: + e.map.caption.mapCoords.formatter = "LAT_LONG_DMS"; + break; + case 3978: + e.map.caption.mapCoords.formatter = "CANADA_ATLAS_LAMBERT"; + break; + case 102100: + e.map.caption.mapCoords.formatter = "WEB_MERCATOR"; + break; + default: + e.map.caption.mapCoords.formatter = "LAT_LONG_DMS"; + break; + } + t.components.scaleBar.attachTo && console.warn( + "attachTo property provided in scaleBar map component cannot be mapped and will be skipped." + ); + } + t.components.basemap && t.components.basemap.enabled && e.fixturesEnabled.push("basemap"); + } + t.extentSets && (e.map.extentSets = [], t.extentSets.forEach((i) => { + const r = { + id: i.id, + default: { + xmin: i.default.xmin, + xmax: i.default.xmax, + ymin: i.default.ymin, + ymax: i.default.ymax, + spatialReference: i.spatialReference + } + }; + i.full && (r.full = { + xmin: i.full.xmin, + xmax: i.full.xmax, + ymin: i.full.ymin, + ymax: i.full.ymax, + spatialReference: i.spatialReference + }), i.maximum && (r.maximum = { + xmin: i.maximum.xmin, + xmax: i.maximum.xmax, + ymin: i.maximum.ymin, + ymax: i.maximum.ymax, + spatialReference: i.spatialReference + }), e.map.extentSets.push(r); + })), t.lodSets && (e.map.lodSets = t.lodSets), t.tileSchemas && (e.map.tileSchemas = [], t.tileSchemas.forEach((i) => { + const r = { + id: i.id, + name: i.name, + extentSetId: i.extentSetId, + lodSetId: i.lodSetId, + thumbnailTileUrls: [], + // TODO: use some defaulting here? + hasNorthPole: i.hasNorthPole || !1 + }; + i.overviewUrl && (e.fixtures.overviewmap || (e.fixtures.overviewmap = { + basemaps: {} + }, e.fixturesEnabled.push("overviewmap")), e.fixtures.overviewmap.basemaps[i.id] = { + id: i.overviewUrl.id || `overviewmap-basemap-${i.id}`, + tileSchemaId: i.id, + layers: [ + { + id: i.overviewUrl.id || `overviewmap-basemap-${i.id}-0`, + layerType: i.overviewUrl.layerType === "esriDynamic" ? rn.MAPIMAGE : rn.TILE, + url: i.overviewUrl.url, + opacity: i.overviewUrl.opacity ?? 1 + } + ] + }), e.map.tileSchemas.push(r); + })), t.baseMaps && (e.map.basemaps = [], t.baseMaps.forEach((i) => { + const r = { + id: i.id, + tileSchemaId: i.tileSchemaId, + name: i.name, + description: i.description, + altText: i.altText, + thumbnailUrl: i.thumbnailUrl, + layers: [] + // populated later + }; + i.attribution && (r.attribution = { + text: {}, + logo: {} + }, i.attribution.text && (r.attribution.text.disabled = !i.attribution.text.enabled, r.attribution.text.value = i.attribution.text.value), i.attribution.logo && (r.attribution.logo.disabled = !i.attribution.logo.enabled, r.attribution.logo.altText = i.attribution.logo.altText, r.attribution.logo.value = i.attribution.logo.value, r.attribution.logo.link = i.attribution.logo.link)), i.layers.forEach((n, s) => { + const o = { + id: n.id || `${i.id}-${s}`, + layerType: n.layerType === "esriDynamic" ? rn.MAPIMAGE : rn.TILE, + url: n.url, + opacity: n.opacity ?? 1 + }; + r.layers.push(o); + }), e.map.basemaps.push(r); + })), t.legend && (e.fixturesEnabled.push("legend"), t.legend.type === "autopopulate" ? (e.fixtures.legend = { + root: { + name: "I'm root", + children: [] + } + }, e.layers && e.layers.toReversed().forEach((i) => { + if (i.type === "esri-map-image" || i.type === "ogc-wms") { + const r = { + name: i.name ?? `${i.id} Group`, + children: [] + }; + i.sublayers.forEach((n) => { + const s = { + layerId: i.id + }; + n.name && (s.name = n.name), n.controls && (s.controls = n.controls), n.disabledControls && (s.disabledControls = n.disabledControls), i.type === "esri-map-image" ? s.sublayerIndex = n.index : (s.sublayerId = n.id, console.warn( + `sublayerId property defined in legend entry ${s.layerId} is currently not supported.` + )), r.children.push(s); + }), e.fixtures.legend.root.children.push(r); + } else { + const r = { + layerId: i.id + }; + i.controls && (r.controls = i.controls), i.disabledControls && (r.disabledControls = i.disabledControls), e.fixtures.legend.root.children.push(r); + } + })) : e.fixtures.legend = { + root: TOe(t.legend.root) + }); +} +function TOe(t) { + const e = { name: t.name, children: [] }; + typeof t.hidden < "u" && (e.hidden = t.hidden), typeof t.expanded < "u" && (e.expanded = t.expanded); + const i = [ + "identify", + "opacity", + "reload", + "remove", + "settings", + "symbology", + "visibility" + ]; + return t.controls && t.controls.length > 0 && (e.controls = VU( + t.controls, + i + ), t.controls.includes("visibility") && e.controls.push("visibilityButton"), (t.controls.length !== 1 || t.controls[0] !== "visibility") && console.warn( + "Legend entry groups currently support only the visibility control. All other controls are currently not supported." + ), e.controls.push("expandButton")), t.disabledControls && t.disabledControls.length > 0 && (e.disabledControls = VU( + t.disabledControls, + i + ), t.disabledControls.includes("visibility") && e.disabledControls.push("visibilityButton"), (t.disabledControls.length !== 1 || t.disabledControls[0] !== "visibility") && console.warn( + "Legend entry groups currently support only the visibility control. All other controls are currently not supported." + )), t.children.forEach((r) => { + if (r.layerId) + e.children.push(XXe(r)); + else if (r.infoType) + r.infoType === "unboundLayer" ? console.warn( + `unboundLayer infoType in infoSection in children list of legend entry group ${e.name} cannot be mapped and will be skipped.` + ) : (e.children.push({ + infoType: r.infoType, + content: r.content + }), typeof r.export < "u" && console.warn( + `export property in infoSection in children list of legend entry group ${e.name} cannot be mapped and will be skipped.` + )); + else if (r.exclusiveVisibility) { + const n = { + name: "Visibility Set", + children: [], + exclusive: !0 + }; + typeof r.collapse < "u" && console.warn( + `collapse property in visibilitySet in children list of legend entry group ${e.name} cannot be mapped and will be skipped.` + ), r.exclusiveVisibility.forEach((s) => { + s.layerId ? n.children.push(XXe(s)) : n.children.push(TOe(s)); + }), e.children.push(n); + } else + e.children.push(TOe(r)); + }), e; +} +function XXe(t) { + const e = t, i = [ + "boundaryZoom", + "datatable", + "identify", + "metadata", + "opacity", + "refresh", + "reload", + "remove", + "settings", + "symbology", + "visibility" + ]; + return t.controls && t.controls.length > 0 && (e.layerControls = VU( + t.controls, + i + ), e.layerControls.push("symbology")), t.disabledControls && t.disabledControls.length > 0 && (e.disabledLayerControls = VU( + t.disabledControls, + i + )), t.controlledIds && (console.warn( + `controlledIds property defined in legend entry ${t.layerId} cannot be mapped and will be skipped.` + ), delete e.controlledIds), t.entryIndex && (e.sublayerIndex = t.entryIndex, delete t.entryIndex), t.entryId && console.warn( + `entryId property defined in legend entry ${t.layerId} cannot be mapped and will be skipped.` + ), e; +} +function TCt(t) { + const e = Cwe(t); + switch (e.id = t.id, e.url = t.url, t.refreshInterval && (e.refreshInterval = t.refreshInterval, console.warn( + "Property refreshInterval in layer is currently not supported." + )), t.expectedResponseTime && (e.expectedLoadTime = t.expectedResponseTime), t.metadataUrl && (e.metadata = { + url: t.metadataUrl + }), t.catalogueUrl && (e.catalogueUrl = t.catalogueUrl), typeof t.enableStructuredDelete < "u" && console.warn( + `enableStructuredDelete property provided in layer ${t.id} cannot be mapped and will be skipped.` + ), t.tooltipField && (e.tooltipField = t.tooltipField), t.tolerance && (e.mouseTolerance = t.tolerance, t.layerType === "esriDynamic" && (e.touchTolerance = t.tolerance + 10)), t.customRenderer && (e.customRenderer = t.customRenderer), t.layerType) { + case "esriDynamic": + e.layerType = "esri-map-image", typeof t.singleEntryCollapse < "u" && (e.singleEntryCollapse = t.singleEntryCollapse), t.imageFormat && (e.imageFormat = t.imageFormat), t.layerEntries && (e.sublayers = [], t.layerEntries.forEach((i) => { + const r = Cwe(i); + r.index = i.index, e.sublayers.push(r); + })); + break; + case "esriFeature": + e.layerType = "esri-feature", t.fileType && (e.layerType = t.fileType === "shapefile" ? "file-shape" : `file-${t.fileType}`, t.colour && (e.colour = t.colour), t.latField && (e.latField = t.latField), t.longField && (e.longField = t.longField)); + break; + case "ogcWfs": + e.layerType = "ogc-wfs", t.colour && (e.colour = t.colour), typeof t.xyInAttribs < "u" && (e.xyInAttribs = t.xyInAttribs); + break; + case "ogcWms": + e.layerType = "ogc-wms", t.suppressGetCapabilities && console.warn( + `suppressGetCapabilities property provided in layer ${t.id} cannot be mapped and will be skipped.` + ), t.featureInfoMimeType && (t.featureInfoMimeType === "text/html;fgpv=summary" ? e.featureInfoMimeType = "text/html" : e.featureInfoMimeType = t.featureInfoMimeType), t.legendMimeType && console.warn( + `legendMimeType property provided in layer ${t.id} cannot be mapped and will be skipped.` + ), t.layerEntries && (e.sublayers = [], t.layerEntries.forEach((i) => { + const r = Cwe(i); + r.id = i.id, i.currentStyle && (r.currentStyle = i.currentStyle, console.warn( + `currentStyle property provided in layer entry ${i.id} of layer ${t.id} is currently not supported.` + )), i.allStyles && console.warn( + `allStyles property provided in layer entry ${i.id} of layer ${t.id} cannot be mapped and will be skipped.` + ), e.sublayers.push(r); + })); + break; + case "esriImage": + e.layerType = "esri-imagery"; + break; + case "esriTile": + e.layerType = "esri-tile"; + break; + default: + console.warn( + `Unhandled layer type in ramp 2 config ${t.layerType}` + ); + } + return t.details && console.warn( + `Details config provided in layer ${t.id} cannot be mapped and will be skipped.` + ), e; +} +function Cwe(t) { + const e = {}; + t.name && (e.name = t.name), t.nameField && (e.nameField = t.nameField), t.extent && (e.extent = t.extent); + const i = [ + "boundaryZoom", + "datatable", + "identify", + "metadata", + "opacity", + "refresh", + "reload", + "remove", + "settings", + "symbology", + "visibility" + ]; + return t.controls && t.controls.length > 0 && (e.controls = VU(t.controls, i), e.controls.push("symbology")), t.disabledControls && t.disabledControls.length > 0 && (e.disabledControls = VU( + t.disabledControls, + i + )), t.state && (e.state = { + opacity: t.state.opacity ?? 1, + visibility: t.state.visibility ?? !0, + identify: t.state.query ?? !0, + hovertips: t.state.hovertips ?? !0 + }, typeof t.state.snapshot < "u" && console.warn( + `snapshot property provided in initialLayer settings in layer ${t.id} cannot be mapped and will be skipped.` + ), typeof t.state.boundingBox < "u" && console.warn( + `boundingBox property provided in initialLayer settings in layer ${t.id} cannot be mapped and will be skipped.` + )), typeof t.stateOnly < "u" && (e.cosmetic = t.stateOnly), t.initialFilteredQuery && (e.initialFilteredQuery = t.initialFilteredQuery), K3i(t, e), (typeof t.toggleSymbology < "u" || t.table) && (e.fixtures = {}, typeof t.toggleSymbology < "u" && (e.fixtures.legend = { + toggleSymbology: t.toggleSymbology + }), t.table && (e.fixtures.grid = {}, t.table.title && (e.fixtures.grid.title = t.table.title), t.table.description && console.warn( + `description property provided in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), typeof t.table.maximize < "u" && console.warn( + `maximize property provided in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), t.table.search && (t.table.search.enabled && (e.fixtures.grid.search = t.table.search.enabled), t.table.search.value && (e.fixtures.grid.searchFilter = t.table.search.value)), typeof t.table.lazyFilter < "u" && console.warn( + `lazyFilter property provided in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), typeof t.table.applyMap < "u" && (e.fixtures.grid.applyMap = t.table.applyMap), typeof t.table.showFilter < "u" && (e.fixtures.grid.showFilter = t.table.showFilter), typeof t.table.filterByExtent < "u" && (e.fixtures.grid.filterByExtent = t.table.filterByExtent), typeof t.table.searchStrictMatch < "u" && console.warn( + `searchStrictMatch property provided in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), typeof t.table.printEnabled < "u" && console.warn( + `printEnabled property provided in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), t.table.columns && (e.fixtures.grid.columns = [], t.table.columns.forEach((r) => { + const n = { + name: r.data + }; + r.title && (n.title = r.title), r.description && console.warn( + `description property provided in column property in table property in layer ${t.id} cannot be mapped and will be skipped.` + ), typeof r.visible < "u" && (n.visible = r.visible), r.width && (n.width = r.width), r.sort && (n.sort = r.sort), typeof r.searchable < "u" && (n.searchable = r.searchable), r.filter && (n.filter = r.filter), e.fixtures.grid.columns.push(n); + })))), e; +} +function VU(t, e) { + const i = []; + return t.forEach((r) => { + e.includes("identify") && r === "query" ? i.push("identify") : e.includes("datatable") && r === "data" ? i.push("datatable") : e.includes(r) ? i.push(r) : console.warn(`Ignored invalid control: ${r}`); + }), i; +} +function q3i(t, e) { + if (!t) + return; + t.search && (e.fixtures.geosearch = {}, e.fixtures.geosearch.serviceUrls = { + geoNames: t.search.serviceUrls.geoNames, + geoLocation: t.search.serviceUrls.geoLocation, + geoProvince: t.search.serviceUrls.provinces, + geoTypes: t.search.serviceUrls.types + }, t.search.serviceUrls.geoSuggest && console.warn( + "geoSuggest property provided in serviceUrls of search service cannot be mapped and will be skipped." + ), t.search.settings && (e.fixtures.geosearch.settings = t.search.settings), t.search.disabledSearches && (e.fixtures.geosearch.settings.disabledSearchTypes = t.search.disabledSearches.filter( + (r) => r !== "SCALE" + ))), t.export && (e.fixtures.export || (e.fixtures.export = {}, e.fixturesEnabled.push("export")), t.export.title && (e.fixtures.export.title = { + selected: t.export.title.isSelected ?? !0, + selectable: t.export.title.isSelectable ?? !0, + value: t.export.title.value ?? "RAMP-Map / PCAR-Carte" + }), t.export.map && (e.fixtures.export.map = { + selected: t.export.map.isSelected ?? !0, + selectable: t.export.map.isSelectable ?? !0 + }, t.export.map.value && console.warn( + "value property provided in map export component cannot be mapped and will be skipped." + )), t.export.mapElements && (e.fixtures.export.mapElements = { + selected: t.export.mapElements.isSelected ?? !0, + selectable: t.export.mapElements.isSelectable ?? !0 + }, t.export.mapElements.value && console.warn( + "value property provided in mapElements export component cannot be mapped and will be skipped." + )), t.export.legend && (e.fixtures.export.legend = { + selected: t.export.legend.isSelected ?? !0, + selectable: t.export.legend.isSelectable ?? !0 + }, t.export.legend.columnWidth && (e.fixtures.export.legend.columnWidth = t.export.legend.columnWidth), t.export.legend.value && console.warn( + "value property provided in legend export component cannot be mapped and will be skipped." + ), typeof t.export.legend.showInfoSymbology < "u" && console.warn( + "showInfoSymbology property provided in legend export component cannot be mapped and will be skipped." + ), typeof t.export.legend.showControlledSymbology < "u" && console.warn( + "showControlledSymbology property provided in legend export component cannot be mapped and will be skipped." + )), t.export.footnote && (e.fixtures.export.footnote = { + selected: t.export.footnote.isSelected ?? !0, + selectable: t.export.footnote.isSelectable ?? !0, + value: t.export.footnote.value ?? "" + }), t.export.timestamp && (e.fixtures.export.timestamp = { + selected: t.export.timestamp.isSelected ?? !0, + selectable: t.export.timestamp.isSelectable ?? !0 + }, t.export.timestamp.value && console.warn( + "value property provided in timestamp export component cannot be mapped and will be skipped." + )), t.export.timeout && console.warn( + "timeout property provided in export property of services config cannot be mapped and will be skipped." + ), typeof t.cleanCanvas < "u" && console.warn( + "cleanCanvas property provided in export property of services config cannot be mapped and will be skipped." + )), t.proxyUrl && (e.system.proxyUrl = t.proxyUrl), [ + "corsEverywhere", + "exportMapUrl", + "geometryUrl", + "googleAPIKey", + "esriLibUrl", + "geolocation", + "coordInfo", + "print" + ].forEach((r) => { + typeof t[r] < "u" && console.warn( + `${r} property provided in services config cannot be mapped and will be skipped.` + ); + }); +} +function Y3i(t, e) { + if (t.navBar) { + e.fixtures.mapnav = { + zoomOption: t.navBar.zoom || "buttons", + items: [] + }; + const n = [ + "geolocator", + "zoom", + "home", + "basemap", + "help", + "fullscreen", + "geosearch", + "legend" + ]; + t.navBar.extra.forEach((s) => { + const o = s.toLowerCase(); + n.includes(o) ? e.fixtures.mapnav.items.push(o) : console.warn(`Ignored invalid mapnav item: ${s}`); + }), e.fixturesEnabled.push("mapnav"); + } + if (t.help && (e.fixtures.help = { + location: t.help.folderName && t.help.folderName !== "default" ? `./${t.help.folderName}` : "./help", + panelWidth: 350 + }, e.fixturesEnabled.push("help")), t.legend) { + const n = ["groupToggle", "visibilityToggle"]; + t.legend.reorderable && n.push("layerReorder"), t.legend.allowImport && n.push("wizard"), e.fixtures.legend ? e.fixtures.legend.headerControls = n : (e.fixturesEnabled.push("legend"), e.fixtures.legend = { + headerControls: n, + root: {} + }), t.legend.isOpen && t.legend.isOpen.large && e.panels.open.push({ id: "legend" }); + } + e.fixtures.appbar = { items: [] }, e.fixturesEnabled.push("appbar"); + const i = ["layers", "basemap", "export", "help", "geoSearch"]; + t.appBar ? (t.appBar.layers !== !1 && (e.fixtures.appbar.items.push("legend"), e.fixturesEnabled.includes("legend") || e.fixturesEnabled.push("legend")), t.appBar.geoSearch !== !1 && e.fixturesEnabled.includes("geosearch") && e.fixtures.appbar.items.push("geosearch"), t.appBar.basemap !== !1 && e.fixtures.appbar.items.push("basemap")) : (e.fixtures.appbar.items.push("legend"), e.fixturesEnabled.includes("legend") || e.fixturesEnabled.push("legend"), e.fixtures.appbar.items.push("geosearch"), e.fixtures.appbar.items.push("basemap")), t.sideMenu && t.sideMenu.items && t.sideMenu.items.length > 0 && t.sideMenu.items.forEach((n) => { + n.forEach((s) => { + s === "layers" && !e.fixtures.appbar.items.includes("legend") ? (e.fixtures.appbar.items.push("legend"), e.fixturesEnabled.includes("legend") || e.fixturesEnabled.push("legend")) : s !== "layers" && i.includes(s) && !e.fixtures.appbar.items.includes(s.toLowerCase()) && (e.fixtures.appbar.items.push(s.toLowerCase()), (s.toLowerCase() === "help" || s.toLowerCase() === "export" && !e.fixturesEnabled.includes(s.toLowerCase())) && e.fixturesEnabled.push(s.toLowerCase())); + }); + }), t.tableIsOpen && // r2ui.tableIsOpen.id && + t.tableIsOpen.large, [ + "fullscreen", + "theme", + "logoUrl", + "failureFeedback", + "title", + "restrictNavigation", + "about" + ].forEach((n) => { + typeof t[n] < "u" && console.warn( + `${n} property provided in services config cannot be mapped and will be skipped.` + ); + }); +} +function X3i(t, e) { + t.areasOfInterest.enable && (e.fixturesEnabled.includes("areas-of-interest") || e.fixturesEnabled.push("areas-of-interest"), t.areasOfInterest.areas && (e.fixtures["areas-of-interest"] = { + areas: t.areasOfInterest.areas.map((i) => ({ + title: `${i["title-en-CA"]} / ${i["title-fr-CA"]}`, + thumbnail: i.thumbnailUrl, + altText: i.altText ?? "", + description: i.description ?? "", + extent: { + xmin: i.xmin, + xmax: i.xmax, + ymin: i.ymin, + ymax: i.ymax, + spatialReference: { + wkid: i.wkid + } + } + })) + })); +} +function K3i(t, e) { + const i = t.outfields && t.outfields !== "*"; + if (!i && !t.fieldMetadata) + return; + const r = { + fieldInfo: [], + exclusiveFields: !1, + enforceOrder: !1 + }; + t.fieldMetadata ? (r.fieldInfo = t.fieldMetadata.map((n) => { + const s = { + name: n.data + }; + return n.alias && (s.alias = n.alias), s; + }), i && (t.outfields.split(",").map((s) => s.trim()).forEach((s) => { + r.fieldInfo.findIndex((o) => o.name === s) === -1 && r.fieldInfo.push({ name: s }); + }), r.exclusiveFields = !0)) : i && (r.fieldInfo = t.outfields.split(",").map((n) => ({ name: n.trim() })), r.exclusiveFields = !0), e.fieldMetadata = r; +} +console.info( + `RAMP v4.5.0 [${"13dcfda9396ad5a742ba6d8b4c099ba08708084a".slice(0, 9)}] (Built on ${new Date( + "Tue Mar 26 14:39:48 2024 -0400".toString() + ).toLocaleString()})` +); +const eq = { major: "4", minor: "5", patch: "0", timestamp: "Tue Mar 26 14:39:48 2024 -0400", hash: "13dcfda9396ad5a742ba6d8b4c099ba08708084a" }; +function uBr(t) { + return z3i(t); +} +function cBr(t) { + return TCt(t); +} +const hBr = (t, e, i) => new nPi(t, e, i), l7 = new a0i(); +let Twe; +function J3i(t, e) { + let i = e.responseType; + i ? i !== "array-buffer" && i !== "blob" && i !== "json" && i !== "native" && i !== "native-request-init" && i !== "text" && (i = "text") : i = "json", e.responseType = i; + const r = e.signal; + return delete e.signal, globalThis.invokeStaticMessage("request", { url: t, options: e }, { signal: r }).then(async (n) => { + let s, o, a, l, c; + if (n.data) + if (n.data instanceof ArrayBuffer) { + if (!(i !== "json" && i !== "text" && i !== "blob" || (s = new Blob([n.data]), i !== "json" && i !== "text" || (Twe || (Twe = new FileReaderSync()), l = Twe.readAsText(s), i !== "json")))) { + try { + o = JSON.parse(l || null); + } catch (h) { + const p = { ...h, url: t, requestOptions: e }; + throw new ot("request:server", h.message, p); + } + if (o.error) { + const h = { ...o.error, url: t, requestOptions: e }; + throw new ot("request:server", o.error.message, h); + } + } + } else + i === "native" && (n.data.signal = r, a = await fetch(n.data.url, n.data), n.httpStatus = a.status); + switch (i) { + case "blob": + c = s; + break; + case "json": + c = o; + break; + case "native": + c = a; + break; + case "text": + c = l; + break; + default: + c = n.data; + } + return { data: c, httpStatus: n.httpStatus, requestOptions: e, ssl: n.ssl, url: t }; + }); +} +const Z3i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + execute: J3i +}, Symbol.toStringTag, { value: "Module" })), coe = "esri-identity-form", G1 = { base: coe, group: `${coe}__group`, label: `${coe}__label`, footer: `${coe}__footer`, esriInput: "esri-input", esriButton: "esri-button", esriButtonSecondary: "esri-button--secondary" }, Q3i = "ArcGIS Online"; +let lP = class extends Em { + constructor(e, i) { + super(e, i), this._usernameInputNode = null, this._passwordInputNode = null, this.signingIn = !1, this.server = null, this.resource = null, this.error = null, this.oAuthPrompt = !1; + } + render() { + const { error: e, server: i, resource: r, signingIn: n, oAuthPrompt: s, messages: o } = this, a = Ni("div", { class: G1.group }, eS(s ? o.oAuthInfo : o.info, { server: i && /\.arcgis\.com/i.test(i) ? Q3i : i, resource: `(${r || o.lblItem})` })), l = s ? null : Ni("div", { class: G1.group, key: "username" }, Ni("label", { class: G1.label }, o.lblUser, Ni("input", { value: "", required: !0, autocomplete: "off", spellcheck: !1, type: "text", bind: this, afterCreate: hU, "data-node-ref": "_usernameInputNode", class: G1.esriInput }))), c = s ? null : Ni("div", { class: G1.group, key: "password" }, Ni("label", { class: G1.label }, o.lblPwd, Ni("input", { value: "", required: !0, type: "password", bind: this, afterCreate: hU, "data-node-ref": "_passwordInputNode", class: G1.esriInput }))), h = Ni("div", { class: this.classes(G1.group, G1.footer) }, Ni("input", { type: "submit", disabled: !!n, value: n ? o.lblSigning : o.lblOk, class: G1.esriButton }), Ni("input", { type: "button", value: o.lblCancel, bind: this, onclick: this._cancel, class: this.classes(G1.esriButton, G1.esriButtonSecondary) })), p = e ? Ni("div", null, e.details && e.details.httpStatus ? o.invalidUser : o.noAuthService) : null; + return Ni("form", { class: G1.base, bind: this, onsubmit: this._submit }, a, p, l, c, h); + } + _cancel() { + this._set("signingIn", !1), this._usernameInputNode && (this._usernameInputNode.value = ""), this._passwordInputNode && (this._passwordInputNode.value = ""), this.emit("cancel"); + } + _submit(e) { + e.preventDefault(), this._set("signingIn", !0); + const i = this.oAuthPrompt ? {} : { username: this._usernameInputNode && this._usernameInputNode.value, password: this._passwordInputNode && this._passwordInputNode.value }; + this.emit("submit", i); + } +}; +E([N(), bm("esri/identity/t9n/identity")], lP.prototype, "messages", void 0), E([N()], lP.prototype, "signingIn", void 0), E([N()], lP.prototype, "server", void 0), E([N()], lP.prototype, "resource", void 0), E([N()], lP.prototype, "error", void 0), E([N()], lP.prototype, "oAuthPrompt", void 0), lP = E([dt("esri.identity.IdentityForm")], lP); +const eRi = lP; +/*! +* tabbable 6.1.2 +* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE +*/ +var ECt = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Fpe = /* @__PURE__ */ ECt.join(","), ICt = typeof Element > "u", F$ = ICt ? function() { +} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Lpe = !ICt && Element.prototype.getRootNode ? function(t) { + var e; + return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t); +} : function(t) { + return t?.ownerDocument; +}, Npe = function t(e, i) { + var r; + i === void 0 && (i = !0); + var n = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), s = n === "" || n === "true", o = s || i && e && t(e.parentNode); + return o; +}, tRi = function(e) { + var i, r = e == null || (i = e.getAttribute) === null || i === void 0 ? void 0 : i.call(e, "contenteditable"); + return r === "" || r === "true"; +}, ACt = function(e, i, r) { + if (Npe(e)) + return []; + var n = Array.prototype.slice.apply(e.querySelectorAll(Fpe)); + return i && F$.call(e, Fpe) && n.unshift(e), n = n.filter(r), n; +}, PCt = function t(e, i, r) { + for (var n = [], s = Array.from(e); s.length; ) { + var o = s.shift(); + if (!Npe(o, !1)) + if (o.tagName === "SLOT") { + var a = o.assignedElements(), l = a.length ? a : o.children, c = t(l, !0, r); + r.flatten ? n.push.apply(n, c) : n.push({ + scopeParent: o, + candidates: c + }); + } else { + var h = F$.call(o, Fpe); + h && r.filter(o) && (i || !e.includes(o)) && n.push(o); + var p = o.shadowRoot || // check for an undisclosed shadow + typeof r.getShadowRoot == "function" && r.getShadowRoot(o), y = !Npe(p, !1) && (!r.shadowRootFilter || r.shadowRootFilter(o)); + if (p && y) { + var v = t(p === !0 ? o.children : p.children, !0, r); + r.flatten ? n.push.apply(n, v) : n.push({ + scopeParent: o, + candidates: v + }); + } else + s.unshift.apply(s, o.children); + } + } + return n; +}, OCt = function(e, i) { + return e.tabIndex < 0 && (i || /^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || tRi(e)) && isNaN(parseInt(e.getAttribute("tabindex"), 10)) ? 0 : e.tabIndex; +}, iRi = function(e, i) { + return e.tabIndex === i.tabIndex ? e.documentOrder - i.documentOrder : e.tabIndex - i.tabIndex; +}, RCt = function(e) { + return e.tagName === "INPUT"; +}, rRi = function(e) { + return RCt(e) && e.type === "hidden"; +}, nRi = function(e) { + var i = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) { + return r.tagName === "SUMMARY"; + }); + return i; +}, sRi = function(e, i) { + for (var r = 0; r < e.length; r++) + if (e[r].checked && e[r].form === i) + return e[r]; +}, oRi = function(e) { + if (!e.name) + return !0; + var i = e.form || Lpe(e), r = function(a) { + return i.querySelectorAll('input[type="radio"][name="' + a + '"]'); + }, n; + if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function") + n = r(window.CSS.escape(e.name)); + else + try { + n = r(e.name); + } catch (o) { + return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", o.message), !1; + } + var s = sRi(n, e.form); + return !s || s === e; +}, aRi = function(e) { + return RCt(e) && e.type === "radio"; +}, lRi = function(e) { + return aRi(e) && !oRi(e); +}, uRi = function(e) { + var i, r = e && Lpe(e), n = (i = r) === null || i === void 0 ? void 0 : i.host, s = !1; + if (r && r !== e) { + var o, a, l; + for (s = !!((o = n) !== null && o !== void 0 && (a = o.ownerDocument) !== null && a !== void 0 && a.contains(n) || e != null && (l = e.ownerDocument) !== null && l !== void 0 && l.contains(e)); !s && n; ) { + var c, h, p; + r = Lpe(n), n = (c = r) === null || c === void 0 ? void 0 : c.host, s = !!((h = n) !== null && h !== void 0 && (p = h.ownerDocument) !== null && p !== void 0 && p.contains(n)); + } + } + return s; +}, KXe = function(e) { + var i = e.getBoundingClientRect(), r = i.width, n = i.height; + return r === 0 && n === 0; +}, cRi = function(e, i) { + var r = i.displayCheck, n = i.getShadowRoot; + if (getComputedStyle(e).visibility === "hidden") + return !0; + var s = F$.call(e, "details>summary:first-of-type"), o = s ? e.parentElement : e; + if (F$.call(o, "details:not([open]) *")) + return !0; + if (!r || r === "full" || r === "legacy-full") { + if (typeof n == "function") { + for (var a = e; e; ) { + var l = e.parentElement, c = Lpe(e); + if (l && !l.shadowRoot && n(l) === !0) + return KXe(e); + e.assignedSlot ? e = e.assignedSlot : !l && c !== e.ownerDocument ? e = c.host : e = l; + } + e = a; + } + if (uRi(e)) + return !e.getClientRects().length; + if (r !== "legacy-full") + return !0; + } else if (r === "non-zero-area") + return KXe(e); + return !1; +}, hRi = function(e) { + if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName)) + for (var i = e.parentElement; i; ) { + if (i.tagName === "FIELDSET" && i.disabled) { + for (var r = 0; r < i.children.length; r++) { + var n = i.children.item(r); + if (n.tagName === "LEGEND") + return F$.call(i, "fieldset[disabled] *") ? !0 : !n.contains(e); + } + return !0; + } + i = i.parentElement; + } + return !1; +}, kpe = function(e, i) { + return !(i.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor + // because we're limited in the type of selectors we can use in JSDom (see related + // note related to `candidateSelectors`) + Npe(i) || rRi(i) || cRi(i, e) || // For a details element with a summary, the summary element gets the focus + nRi(i) || hRi(i)); +}, EOe = function(e, i) { + return !(lRi(i) || OCt(i) < 0 || !kpe(e, i)); +}, dRi = function(e) { + var i = parseInt(e.getAttribute("tabindex"), 10); + return !!(isNaN(i) || i >= 0); +}, pRi = function t(e) { + var i = [], r = []; + return e.forEach(function(n, s) { + var o = !!n.scopeParent, a = o ? n.scopeParent : n, l = OCt(a, o), c = o ? t(n.candidates) : a; + l === 0 ? o ? i.push.apply(i, c) : i.push(a) : r.push({ + documentOrder: s, + tabIndex: l, + item: n, + isScope: o, + content: c + }); + }), r.sort(iRi).reduce(function(n, s) { + return s.isScope ? n.push.apply(n, s.content) : n.push(s.content), n; + }, []).concat(i); +}, fRi = function(e, i) { + i = i || {}; + var r; + return i.getShadowRoot ? r = PCt([e], i.includeContainer, { + filter: EOe.bind(null, i), + flatten: !1, + getShadowRoot: i.getShadowRoot, + shadowRootFilter: dRi + }) : r = ACt(e, i.includeContainer, EOe.bind(null, i)), pRi(r); +}, mRi = function(e, i) { + i = i || {}; + var r; + return i.getShadowRoot ? r = PCt([e], i.includeContainer, { + filter: kpe.bind(null, i), + flatten: !0, + getShadowRoot: i.getShadowRoot + }) : r = ACt(e, i.includeContainer, kpe.bind(null, i)), r; +}, hoe = function(e, i) { + if (i = i || {}, !e) + throw new Error("No node provided"); + return F$.call(e, Fpe) === !1 ? !1 : EOe(i, e); +}, gRi = /* @__PURE__ */ ECt.concat("iframe").join(","), Ewe = function(e, i) { + if (i = i || {}, !e) + throw new Error("No node provided"); + return F$.call(e, gRi) === !1 ? !1 : kpe(i, e); +}; +/*! +* focus-trap 7.2.0 +* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE +*/ +function JXe(t, e) { + var i = Object.keys(t); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(t); + e && (r = r.filter(function(n) { + return Object.getOwnPropertyDescriptor(t, n).enumerable; + })), i.push.apply(i, r); + } + return i; +} +function ZXe(t) { + for (var e = 1; e < arguments.length; e++) { + var i = arguments[e] != null ? arguments[e] : {}; + e % 2 ? JXe(Object(i), !0).forEach(function(r) { + yRi(t, r, i[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : JXe(Object(i)).forEach(function(r) { + Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(i, r)); + }); + } + return t; +} +function yRi(t, e, i) { + return e = _Ri(e), e in t ? Object.defineProperty(t, e, { + value: i, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[e] = i, t; +} +function vRi(t, e) { + if (typeof t != "object" || t === null) + return t; + var i = t[Symbol.toPrimitive]; + if (i !== void 0) { + var r = i.call(t, e || "default"); + if (typeof r != "object") + return r; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (e === "string" ? String : Number)(t); +} +function _Ri(t) { + var e = vRi(t, "string"); + return typeof e == "symbol" ? e : String(e); +} +var QXe = { + activateTrap: function(e, i) { + if (e.length > 0) { + var r = e[e.length - 1]; + r !== i && r.pause(); + } + var n = e.indexOf(i); + n === -1 || e.splice(n, 1), e.push(i); + }, + deactivateTrap: function(e, i) { + var r = e.indexOf(i); + r !== -1 && e.splice(r, 1), e.length > 0 && e[e.length - 1].unpause(); + } +}, bRi = function(e) { + return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function"; +}, wRi = function(e) { + return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27; +}, VJ = function(e) { + return e.key === "Tab" || e.keyCode === 9; +}, xRi = function(e) { + return VJ(e) && !e.shiftKey; +}, SRi = function(e) { + return VJ(e) && e.shiftKey; +}, eKe = function(e) { + return setTimeout(e, 0); +}, tKe = function(e, i) { + var r = -1; + return e.every(function(n, s) { + return i(n) ? (r = s, !1) : !0; + }), r; +}, tq = function(e) { + for (var i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), n = 1; n < i; n++) + r[n - 1] = arguments[n]; + return typeof e == "function" ? e.apply(void 0, r) : e; +}, doe = function(e) { + return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target; +}, CRi = [], TRi = function(e, i) { + var r = i?.document || document, n = i?.trapStack || CRi, s = ZXe({ + returnFocusOnDeactivate: !0, + escapeDeactivates: !0, + delayInitialFocus: !0, + isKeyForward: xRi, + isKeyBackward: SRi + }, i), o = { + // containers given to createFocusTrap() + // @type {Array} + containers: [], + // list of objects identifying tabbable nodes in `containers` in the trap + // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap + // is active, but the trap should never get to a state where there isn't at least one group + // with at least one tabbable node in it (that would lead to an error condition that would + // result in an error being thrown) + // @type {Array<{ + // container: HTMLElement, + // tabbableNodes: Array, // empty if none + // focusableNodes: Array, // empty if none + // firstTabbableNode: HTMLElement|null, + // lastTabbableNode: HTMLElement|null, + // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined + // }>} + containerGroups: [], + // same order/length as `containers` list + // references to objects in `containerGroups`, but only those that actually have + // tabbable nodes in them + // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__ + // the same length + tabbableGroups: [], + nodeFocusedBeforeActivation: null, + mostRecentlyFocusedNode: null, + active: !1, + paused: !1, + // timer ID for when delayInitialFocus is true and initial focus in this trap + // has been delayed during activation + delayInitialFocusTimer: void 0 + }, a, l = function(Q, re, he) { + return Q && Q[re] !== void 0 ? Q[re] : s[he || re]; + }, c = function(Q) { + return o.containerGroups.findIndex(function(re) { + var he = re.container, fe = re.tabbableNodes; + return he.contains(Q) || // fall back to explicit tabbable search which will take into consideration any + // web components if the `tabbableOptions.getShadowRoot` option was used for + // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't + // look inside web components even if open) + fe.find(function(be) { + return be === Q; + }); + }); + }, h = function(Q) { + var re = s[Q]; + if (typeof re == "function") { + for (var he = arguments.length, fe = new Array(he > 1 ? he - 1 : 0), be = 1; be < he; be++) + fe[be - 1] = arguments[be]; + re = re.apply(void 0, fe); + } + if (re === !0 && (re = void 0), !re) { + if (re === void 0 || re === !1) + return re; + throw new Error("`".concat(Q, "` was specified but was not a node, or did not return a node")); + } + var Se = re; + if (typeof re == "string" && (Se = r.querySelector(re), !Se)) + throw new Error("`".concat(Q, "` as selector refers to no known node")); + return Se; + }, p = function() { + var Q = h("initialFocus"); + if (Q === !1) + return !1; + if (Q === void 0) + if (c(r.activeElement) >= 0) + Q = r.activeElement; + else { + var re = o.tabbableGroups[0], he = re && re.firstTabbableNode; + Q = he || h("fallbackFocus"); + } + if (!Q) + throw new Error("Your focus-trap needs to have at least one focusable element"); + return Q; + }, y = function() { + if (o.containerGroups = o.containers.map(function(Q) { + var re = fRi(Q, s.tabbableOptions), he = mRi(Q, s.tabbableOptions); + return { + container: Q, + tabbableNodes: re, + focusableNodes: he, + firstTabbableNode: re.length > 0 ? re[0] : null, + lastTabbableNode: re.length > 0 ? re[re.length - 1] : null, + /** + * Finds the __tabbable__ node that follows the given node in the specified direction, + * in this container, if any. + * @param {HTMLElement} node + * @param {boolean} [forward] True if going in forward tab order; false if going + * in reverse. + * @returns {HTMLElement|undefined} The next tabbable node, if any. + */ + nextTabbableNode: function(be) { + var Se = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, Me = he.findIndex(function(ke) { + return ke === be; + }); + if (!(Me < 0)) + return Se ? he.slice(Me + 1).find(function(ke) { + return hoe(ke, s.tabbableOptions); + }) : he.slice(0, Me).reverse().find(function(ke) { + return hoe(ke, s.tabbableOptions); + }); + } + }; + }), o.tabbableGroups = o.containerGroups.filter(function(Q) { + return Q.tabbableNodes.length > 0; + }), o.tabbableGroups.length <= 0 && !h("fallbackFocus")) + throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times"); + }, v = function X(Q) { + if (Q !== !1 && Q !== r.activeElement) { + if (!Q || !Q.focus) { + X(p()); + return; + } + Q.focus({ + preventScroll: !!s.preventScroll + }), o.mostRecentlyFocusedNode = Q, bRi(Q) && Q.select(); + } + }, x = function(Q) { + var re = h("setReturnFocus", Q); + return re || (re === !1 ? !1 : Q); + }, I = function(Q) { + var re = doe(Q); + if (!(c(re) >= 0)) { + if (tq(s.clickOutsideDeactivates, Q)) { + a.deactivate({ + // if, on deactivation, we should return focus to the node originally-focused + // when the trap was activated (or the configured `setReturnFocus` node), + // then assume it's also OK to return focus to the outside node that was + // just clicked, causing deactivation, as long as that node is focusable; + // if it isn't focusable, then return focus to the original node focused + // on activation (or the configured `setReturnFocus` node) + // NOTE: by setting `returnFocus: false`, deactivate() will do nothing, + // which will result in the outside click setting focus to the node + // that was clicked, whether it's focusable or not; by setting + // `returnFocus: true`, we'll attempt to re-focus the node originally-focused + // on activation (or the configured `setReturnFocus` node) + returnFocus: s.returnFocusOnDeactivate && !Ewe(re, s.tabbableOptions) + }); + return; + } + tq(s.allowOutsideClick, Q) || Q.preventDefault(); + } + }, P = function(Q) { + var re = doe(Q), he = c(re) >= 0; + he || re instanceof Document ? he && (o.mostRecentlyFocusedNode = re) : (Q.stopImmediatePropagation(), v(o.mostRecentlyFocusedNode || p())); + }, F = function(Q) { + var re = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, he = doe(Q); + y(); + var fe = null; + if (o.tabbableGroups.length > 0) { + var be = c(he), Se = be >= 0 ? o.containerGroups[be] : void 0; + if (be < 0) + re ? fe = o.tabbableGroups[o.tabbableGroups.length - 1].lastTabbableNode : fe = o.tabbableGroups[0].firstTabbableNode; + else if (re) { + var Me = tKe(o.tabbableGroups, function(Oe) { + var Re = Oe.firstTabbableNode; + return he === Re; + }); + if (Me < 0 && (Se.container === he || Ewe(he, s.tabbableOptions) && !hoe(he, s.tabbableOptions) && !Se.nextTabbableNode(he, !1)) && (Me = be), Me >= 0) { + var ke = Me === 0 ? o.tabbableGroups.length - 1 : Me - 1, J = o.tabbableGroups[ke]; + fe = J.lastTabbableNode; + } else + VJ(Q) || (fe = Se.nextTabbableNode(he, !1)); + } else { + var ce = tKe(o.tabbableGroups, function(Oe) { + var Re = Oe.lastTabbableNode; + return he === Re; + }); + if (ce < 0 && (Se.container === he || Ewe(he, s.tabbableOptions) && !hoe(he, s.tabbableOptions) && !Se.nextTabbableNode(he)) && (ce = be), ce >= 0) { + var xe = ce === o.tabbableGroups.length - 1 ? 0 : ce + 1, Pe = o.tabbableGroups[xe]; + fe = Pe.firstTabbableNode; + } else + VJ(Q) || (fe = Se.nextTabbableNode(he)); + } + } else + fe = h("fallbackFocus"); + fe && (VJ(Q) && Q.preventDefault(), v(fe)); + }, k = function(Q) { + if (wRi(Q) && tq(s.escapeDeactivates, Q) !== !1) { + Q.preventDefault(), a.deactivate(); + return; + } + (s.isKeyForward(Q) || s.isKeyBackward(Q)) && F(Q, s.isKeyBackward(Q)); + }, V = function(Q) { + var re = doe(Q); + c(re) >= 0 || tq(s.clickOutsideDeactivates, Q) || tq(s.allowOutsideClick, Q) || (Q.preventDefault(), Q.stopImmediatePropagation()); + }, j = function() { + if (o.active) + return QXe.activateTrap(n, a), o.delayInitialFocusTimer = s.delayInitialFocus ? eKe(function() { + v(p()); + }) : v(p()), r.addEventListener("focusin", P, !0), r.addEventListener("mousedown", I, { + capture: !0, + passive: !1 + }), r.addEventListener("touchstart", I, { + capture: !0, + passive: !1 + }), r.addEventListener("click", V, { + capture: !0, + passive: !1 + }), r.addEventListener("keydown", k, { + capture: !0, + passive: !1 + }), a; + }, Y = function() { + if (o.active) + return r.removeEventListener("focusin", P, !0), r.removeEventListener("mousedown", I, !0), r.removeEventListener("touchstart", I, !0), r.removeEventListener("click", V, !0), r.removeEventListener("keydown", k, !0), a; + }; + return a = { + get active() { + return o.active; + }, + get paused() { + return o.paused; + }, + activate: function(Q) { + if (o.active) + return this; + var re = l(Q, "onActivate"), he = l(Q, "onPostActivate"), fe = l(Q, "checkCanFocusTrap"); + fe || y(), o.active = !0, o.paused = !1, o.nodeFocusedBeforeActivation = r.activeElement, re && re(); + var be = function() { + fe && y(), j(), he && he(); + }; + return fe ? (fe(o.containers.concat()).then(be, be), this) : (be(), this); + }, + deactivate: function(Q) { + if (!o.active) + return this; + var re = ZXe({ + onDeactivate: s.onDeactivate, + onPostDeactivate: s.onPostDeactivate, + checkCanReturnFocus: s.checkCanReturnFocus + }, Q); + clearTimeout(o.delayInitialFocusTimer), o.delayInitialFocusTimer = void 0, Y(), o.active = !1, o.paused = !1, QXe.deactivateTrap(n, a); + var he = l(re, "onDeactivate"), fe = l(re, "onPostDeactivate"), be = l(re, "checkCanReturnFocus"), Se = l(re, "returnFocus", "returnFocusOnDeactivate"); + he && he(); + var Me = function() { + eKe(function() { + Se && v(x(o.nodeFocusedBeforeActivation)), fe && fe(); + }); + }; + return Se && be ? (be(x(o.nodeFocusedBeforeActivation)).then(Me, Me), this) : (Me(), this); + }, + pause: function() { + return o.paused || !o.active ? this : (o.paused = !0, Y(), this); + }, + unpause: function() { + return !o.paused || !o.active ? this : (o.paused = !1, y(), j(), this); + }, + updateContainerElements: function(Q) { + var re = [].concat(Q).filter(Boolean); + return o.containers = re.map(function(he) { + return typeof he == "string" ? r.querySelector(he) : he; + }), o.active && y(), this; + } + }, a.updateContainerElements(e), a; +}; +const h5 = "esri-identity-modal", eT = { base: h5, open: `${h5}--open`, closed: `${h5}--closed`, title: `${h5}__title`, dialog: `${h5}__dialog`, content: `${h5}__content`, closeButton: `${h5}__close-button`, iconClose: "esri-icon-close" }; +let AM = class extends Em { + constructor(e, i) { + super(e, i), this.container = document.createElement("div"), this.content = null, this.open = !1, this._focusTrap = null, this._close = () => { + this.open = !1; + }, document.body.appendChild(this.container), this.addHandles(Qi(() => this.open, () => this._toggleFocusTrap())); + } + destroy() { + this._destroyFocusTrap(); + } + get title() { + return this.messages?.auth.signIn; + } + render() { + const e = this.id, { open: i, content: r, title: n, messages: s } = this, o = i && !!r, a = { [eT.open]: o, [eT.closed]: !o }, l = Ni("button", { class: eT.closeButton, "aria-label": s.close, title: s.close, bind: this, onclick: this._close, type: "button" }, Ni("span", { "aria-hidden": "true", class: eT.iconClose })), c = `${e}_title`, h = `${e}_content`, p = n ? Ni("h1", { id: c, class: eT.title }, n) : null, y = o ? Ni("div", { bind: this, class: eT.dialog, role: "dialog", "aria-labelledby": c, "aria-describedby": h, afterCreate: this._createFocusTrap }, l, p, this._renderContent(h)) : null; + return Ni("div", { tabIndex: -1, class: this.classes(eT.base, a) }, y); + } + _destroyFocusTrap() { + this._focusTrap?.deactivate({ onDeactivate: () => { + } }), this._focusTrap = null; + } + _toggleFocusTrap() { + const { _focusTrap: e, open: i } = this; + e && (i ? e.activate() : e.deactivate()); + } + _createFocusTrap(e) { + this._destroyFocusTrap(); + const i = requestAnimationFrame(() => { + this._focusTrap = TRi(e, { initialFocus: "input", onDeactivate: this._close }), this._toggleFocusTrap(); + }); + this.addHandles(c3(() => cancelAnimationFrame(i))); + } + _renderContent(e) { + const i = this.content; + return typeof i == "string" ? Ni("div", { class: eT.content, id: e, innerHTML: i }) : TNe(i) ? Ni("div", { class: eT.content, id: e }, i.render()) : i instanceof HTMLElement ? Ni("div", { class: eT.content, id: e, bind: i, afterCreate: this._attachToNode }) : null; + } + _attachToNode(e) { + const i = this; + e.appendChild(i); + } +}; +E([N({ readOnly: !0 })], AM.prototype, "container", void 0), E([N()], AM.prototype, "content", void 0), E([N()], AM.prototype, "open", void 0), E([N(), bm("esri/t9n/common")], AM.prototype, "messages", void 0), E([N()], AM.prototype, "title", null), AM = E([dt("esri.identity.IdentityModal")], AM); +const iKe = AM, Iwe = "esriJSAPIOAuth"; +let IOe = class { + constructor(e, i) { + this.oAuthInfo = null, this.storage = null, this.appId = null, this.codeVerifier = null, this.expires = null, this.refreshToken = null, this.ssl = null, this.stateUID = null, this.token = null, this.userId = null, this.oAuthInfo = e, this.storage = i, this._init(); + } + isValid() { + let e = !1; + if (this.oAuthInfo && this.userId && (this.refreshToken || this.token)) { + if (this.expires == null && this.refreshToken) + e = !0; + else if (this.expires) { + const i = Date.now(); + this.expires > i && (this.expires - i) / 1e3 > 60 * this.oAuthInfo.minTimeUntilExpiration && (e = !0); + } + } + return e; + } + save() { + if (!this.storage) + return !1; + const e = this._load(), i = this.oAuthInfo; + if (i && i.authNamespace && i.portalUrl) { + let r = e[i.authNamespace]; + r || (r = e[i.authNamespace] = {}), this.appId || (this.appId = i.appId), r[i.portalUrl] = { appId: this.appId, codeVerifier: this.codeVerifier, expires: this.expires, refreshToken: this.refreshToken, ssl: this.ssl, stateUID: this.stateUID, token: this.token, userId: this.userId }; + try { + this.storage.setItem(Iwe, JSON.stringify(e)); + } catch (n) { + return console.warn(n), !1; + } + return !0; + } + return !1; + } + destroy() { + const e = this._load(), i = this.oAuthInfo; + if (i && i.appId && i.portalUrl && (this.expires == null || this.expires > Date.now()) && (this.refreshToken || this.token)) { + const r = i.portalUrl.replace(/^http:/i, "https:") + "/sharing/rest/oauth2/revokeToken", n = new FormData(); + if (n.append("f", "json"), n.append("auth_token", this.refreshToken || this.token), n.append("client_id", i.appId), n.append("token_type_hint", this.refreshToken ? "refresh_token" : "access_token"), typeof navigator.sendBeacon == "function") + navigator.sendBeacon(r, n); + else { + const s = new XMLHttpRequest(); + s.open("POST", r), s.send(n); + } + } + if (i && i.authNamespace && i.portalUrl && this.storage) { + const r = e[i.authNamespace]; + if (r) { + delete r[i.portalUrl]; + try { + this.storage.setItem(Iwe, JSON.stringify(e)); + } catch (n) { + console.log(n); + } + } + } + i && (i._oAuthCred = null, this.oAuthInfo = null); + } + _init() { + const e = this._load(), i = this.oAuthInfo; + if (i && i.authNamespace && i.portalUrl) { + let r = e[i.authNamespace]; + r && (r = r[i.portalUrl], r && (this.appId = r.appId, this.codeVerifier = r.codeVerifier, this.expires = r.expires, this.refreshToken = r.refreshToken, this.ssl = r.ssl, this.stateUID = r.stateUID, this.token = r.token, this.userId = r.userId)); + } + } + _load() { + let e = {}; + if (this.storage) { + const i = this.storage.getItem(Iwe); + if (i) + try { + e = JSON.parse(i); + } catch (r) { + console.warn(r); + } + } + return e; + } +}; +IOe.prototype.declaredClass = "esri.identity.OAuthCredential"; +var AOe; +let ey = AOe = class extends $i { + constructor(t) { + super(t), this._oAuthCred = null, this.appId = null, this.authNamespace = "/", this.expiration = 20160, this.flowType = "auto", this.forceLogin = !1, this.forceUserId = !1, this.locale = null, this.minTimeUntilExpiration = 30, this.popup = !1, this.popupCallbackUrl = "oauth-callback.html", this.popupWindowFeatures = "height=490,width=800,resizable,scrollbars,status", this.portalUrl = "https://www.arcgis.com", this.preserveUrlHash = !1, this.userId = null; + } + clone() { + return AOe.fromJSON(this.toJSON()); + } +}; +E([N({ json: { write: !0 } })], ey.prototype, "appId", void 0), E([N({ json: { write: !0 } })], ey.prototype, "authNamespace", void 0), E([N({ json: { write: !0 } })], ey.prototype, "expiration", void 0), E([N({ json: { write: !0 } })], ey.prototype, "flowType", void 0), E([N({ json: { write: !0 } })], ey.prototype, "forceLogin", void 0), E([N({ json: { write: !0 } })], ey.prototype, "forceUserId", void 0), E([N({ json: { write: !0 } })], ey.prototype, "locale", void 0), E([N({ json: { write: !0 } })], ey.prototype, "minTimeUntilExpiration", void 0), E([N({ json: { write: !0 } })], ey.prototype, "popup", void 0), E([N({ json: { write: !0 } })], ey.prototype, "popupCallbackUrl", void 0), E([N({ json: { write: !0 } })], ey.prototype, "popupWindowFeatures", void 0), E([N({ json: { write: !0 } })], ey.prototype, "portalUrl", void 0), E([N({ json: { write: !0 } })], ey.prototype, "preserveUrlHash", void 0), E([N({ json: { write: !0 } })], ey.prototype, "userId", void 0), ey = AOe = E([dt("esri.identity.OAuthInfo")], ey); +const rKe = ey; +let X1 = class extends $i { + constructor(e) { + super(e), this.adminTokenServiceUrl = null, this.currentVersion = null, this.hasPortal = null, this.hasServer = null, this.owningSystemUrl = null, this.owningTenant = null, this.server = null, this.shortLivedTokenValidity = null, this.tokenServiceUrl = null, this.webTierAuth = null; + } +}; +E([N({ json: { write: !0 } })], X1.prototype, "adminTokenServiceUrl", void 0), E([N({ json: { write: !0 } })], X1.prototype, "currentVersion", void 0), E([N({ json: { write: !0 } })], X1.prototype, "hasPortal", void 0), E([N({ json: { write: !0 } })], X1.prototype, "hasServer", void 0), E([N({ json: { write: !0 } })], X1.prototype, "owningSystemUrl", void 0), E([N({ json: { write: !0 } })], X1.prototype, "owningTenant", void 0), E([N({ json: { write: !0 } })], X1.prototype, "server", void 0), E([N({ json: { write: !0 } })], X1.prototype, "shortLivedTokenValidity", void 0), E([N({ json: { write: !0 } })], X1.prototype, "tokenServiceUrl", void 0), E([N({ json: { write: !0 } })], X1.prototype, "webTierAuth", void 0), X1 = E([dt("esri.identity.ServerInfo")], X1); +const Awe = X1, Vue = {}, MCt = (t) => { + const e = new yy(t.owningSystemUrl).host, i = new yy(t.server).host, r = /.+\.arcgis\.com$/i; + return r.test(e) && r.test(i); +}, POe = (t, e) => !!(MCt(t) && e && e.some((i) => i.test(t.server))); +let jue = null, Gue = null; +try { + jue = window.localStorage, Gue = window.sessionStorage; +} catch { +} +let DCt = class extends Bd { + constructor() { + super(), this._portalConfig = globalThis.esriGeowConfig, this.serverInfos = [], this.oAuthInfos = [], this.credentials = [], this._soReqs = [], this._xoReqs = [], this._portals = [], this._defaultOAuthInfo = null, this._defaultTokenValidity = 60, this.dialog = null, this.formConstructor = eRi, this.tokenValidity = null, this.normalizeWebTierAuth = !1, this._appOrigin = window.origin !== "null" ? window.origin : window.location.origin, this._appUrlObj = ca(window.location.href), this._busy = null, this._rejectOnPersistedPageShow = !1, this._oAuthLocationParams = null, this._gwTokenUrl = "/sharing/rest/generateToken", this._agsRest = "/rest/services", this._agsPortal = /\/sharing(\/|$)/i, this._agsAdmin = /(https?:\/\/[^\/]+\/[^\/]+)\/admin\/?(\/.*)?$/i, this._adminSvcs = /\/rest\/admin\/services(\/|$)/i, this._gwDomains = [{ regex: /^https?:\/\/www\.arcgis\.com/i, customBaseUrl: "maps.arcgis.com", tokenServiceUrl: "https://www.arcgis.com/sharing/rest/generateToken" }, { regex: /^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i, customBaseUrl: "mapsdev.arcgis.com", tokenServiceUrl: "https://dev.arcgis.com/sharing/rest/generateToken" }, { regex: /^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i, customBaseUrl: "mapsdevext.arcgis.com", tokenServiceUrl: "https://devext.arcgis.com/sharing/rest/generateToken" }, { regex: /^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i, customBaseUrl: "mapsqa.arcgis.com", tokenServiceUrl: "https://qaext.arcgis.com/sharing/rest/generateToken" }, { regex: /^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i, customBaseUrl: "maps.arcgis.com", tokenServiceUrl: "https://www.arcgis.com/sharing/rest/generateToken" }], this._legacyFed = [], this._regexSDirUrl = /http.+\/rest\/services\/?/gi, this._regexServerType = /(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|KnowledgeGraphServer|MapServer|MissionServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer|VideoServer)).*/gi, this._gwUser = /http.+\/users\/([^\/]+)\/?.*/i, this._gwItem = /http.+\/items\/([^\/]+)\/?.*/i, this._gwGroup = /http.+\/groups\/([^\/]+)\/?.*/i, this._rePortalTokenSvc = /\/sharing(\/rest)?\/generatetoken/i, this._createDefaultOAuthInfo = !0, this._hasTestedIfAppIsOnPortal = !1, this._getOAuthLocationParams(), window.addEventListener("pageshow", (e) => { + this._pageShowHandler(e); + }); + } + registerServers(e) { + const i = this.serverInfos; + i ? (e = e.filter((r) => !this.findServerInfo(r.server)), this.serverInfos = i.concat(e)) : this.serverInfos = e, e.forEach((r) => { + r.owningSystemUrl && this._portals.push(r.owningSystemUrl), r.hasPortal && this._portals.push(r.server); + }); + } + registerOAuthInfos(e) { + const i = this.oAuthInfos; + if (i) { + for (const r of e) { + const n = this.findOAuthInfo(r.portalUrl); + n && i.splice(i.indexOf(n), 1); + } + this.oAuthInfos = i.concat(e); + } else + this.oAuthInfos = e; + } + registerToken(e) { + e = { ...e }; + const i = this._sanitizeUrl(e.server), r = this._isServerRsrc(i); + let n, s = this.findServerInfo(i), o = !0; + s || (s = new Awe(), s.server = this._getServerInstanceRoot(i), r ? s.hasServer = !0 : (s.tokenServiceUrl = this._getTokenSvcUrl(i), s.hasPortal = !0), this.registerServers([s])), n = this._findCredential(i), n ? (delete e.server, Object.assign(n, e), o = !1) : (n = new Cd({ userId: e.userId, server: s.server, token: e.token, expires: e.expires, ssl: e.ssl, scope: r ? "server" : "portal" }), n.resources = [i], this.credentials.push(n)), n.emitTokenChange(!1), o || n.refreshServerTokens(); + } + toJSON() { + return Jme({ serverInfos: this.serverInfos.map((e) => e.toJSON()), oAuthInfos: this.oAuthInfos.map((e) => e.toJSON()), credentials: this.credentials.map((e) => e.toJSON()) }); + } + initialize(e) { + if (!e) + return; + typeof e == "string" && (e = JSON.parse(e)); + const i = e.serverInfos, r = e.oAuthInfos, n = e.credentials; + if (i) { + const s = []; + i.forEach((o) => { + o.server && o.tokenServiceUrl && s.push(o.declaredClass ? o : new Awe(o)); + }), s.length && this.registerServers(s); + } + if (r) { + const s = []; + r.forEach((o) => { + o.appId && s.push(o.declaredClass ? o : new rKe(o)); + }), s.length && this.registerOAuthInfos(s); + } + n && n.forEach((s) => { + s.server && s.token && s.expires && s.expires > Date.now() && ((s = s.declaredClass ? s : new Cd(s)).emitTokenChange(), this.credentials.push(s)); + }); + } + findServerInfo(e) { + let i; + e = this._sanitizeUrl(e); + for (const r of this.serverInfos) + if (this._hasSameServerInstance(r.server, e)) { + i = r; + break; + } + return i; + } + findOAuthInfo(e) { + let i; + e = this._sanitizeUrl(e); + for (const r of this.oAuthInfos) + if (this._hasSameServerInstance(r.portalUrl, e)) { + i = r; + break; + } + return i; + } + findCredential(e, i) { + if (!e) + return; + let r; + e = this._sanitizeUrl(e); + const n = this._isServerRsrc(e) ? "server" : "portal"; + if (i) { + for (const s of this.credentials) + if (this._hasSameServerInstance(s.server, e) && i === s.userId && s.scope === n) { + r = s; + break; + } + } else + for (const s of this.credentials) + if (this._hasSameServerInstance(s.server, e) && this._getIdenticalSvcIdx(e, s) !== -1 && s.scope === n) { + r = s; + break; + } + return r; + } + getCredential(e, i) { + let r, n, s = !0; + i && (r = !!i.token, n = i.error, s = i.prompt !== !1), i = { ...i }, e = this._sanitizeUrl(e); + const o = new AbortController(), a = mm(); + if (i.signal && Sp(i.signal, () => { + o.abort(); + }), Sp(o, () => { + a.reject(new ot("identity-manager:user-aborted", "ABORTED")); + }), rg(o)) + return a.promise; + i.signal = o.signal; + const l = this._isAdminResource(e), c = r ? this.findCredential(e) : null; + let h; + if (c && n && n.details && n.details.httpStatus === 498) + c.destroy(); + else if (c) + return h = new ot("identity-manager:not-authorized", "You are currently signed in as: '" + c.userId + "'. You do not have access to this resource: " + e, { error: n }), a.reject(h), a.promise; + const p = this._findCredential(e, i); + if (p) + return a.resolve(p), a.promise; + let y = this.findServerInfo(e); + if (y) + !y.hasServer && this._isServerRsrc(e) && (y._restInfoPms = this._getTokenSvcUrl(e), y.hasServer = !0); + else { + const v = this._getTokenSvcUrl(e); + if (!v) + return h = new ot("identity-manager:unknown-resource", "Unknown resource - could not find token service endpoint."), a.reject(h), a.promise; + y = new Awe(), y.server = this._getServerInstanceRoot(e), typeof v == "string" ? (y.tokenServiceUrl = v, y.hasPortal = !0) : (y._restInfoPms = v, y.hasServer = !0), this.registerServers([y]); + } + return y.hasPortal && y._selfReq === void 0 && (s || v0(y.tokenServiceUrl, this._appOrigin) || this._gwDomains.some((v) => v.tokenServiceUrl === y.tokenServiceUrl)) && (y._selfReq = { owningTenant: i && i.owningTenant, selfDfd: this._getPortalSelf(y.tokenServiceUrl.replace(this._rePortalTokenSvc, "/sharing/rest/portals/self"), e) }), this._enqueue(e, y, i, a, l); + } + getResourceName(e) { + return this._isRESTService(e) ? e.replace(this._regexSDirUrl, "").replace(this._regexServerType, "") || "" : this._gwUser.test(e) && e.replace(this._gwUser, "$1") || this._gwItem.test(e) && e.replace(this._gwItem, "$1") || this._gwGroup.test(e) && e.replace(this._gwGroup, "$1") || ""; + } + generateToken(e, i, r) { + const n = this._rePortalTokenSvc.test(e.tokenServiceUrl), s = new yy(this._appOrigin), o = e.shortLivedTokenValidity; + let a, l, c, h, p, y, v, x; + i && (x = this.tokenValidity || o || this._defaultTokenValidity, x > o && o > 0 && (x = o)), r && (a = r.isAdmin, l = r.serverUrl, c = r.token, y = r.signal, v = r.ssl, e.customParameters = r.customParameters), a ? h = e.adminTokenServiceUrl : (h = e.tokenServiceUrl, p = new yy(h.toLowerCase()), e.webTierAuth && r?.serverUrl && !v && s.scheme === "http" && (v0(s.uri, h, !0) || p.scheme === "https" && s.host === p.host && s.port === "7080" && p.port === "7443") && (h = h.replace(/^https:/i, "http:").replace(/:7443/i, ":7080"))); + const I = { query: { request: "getToken", username: i?.username, password: i?.password, serverUrl: l, token: c, expiration: x, referer: a || n ? this._appOrigin : null, client: a ? "referer" : null, f: "json", ...e.customParameters }, method: "post", authMode: "anonymous", useProxy: this._useProxy(e, r), signal: y, ...r?.ioArgs }; + return n || (I.withCredentials = !1), ir(h, I).then((P) => { + const F = P.data; + if (!F || !F.token) + return new ot("identity-manager:authentication-failed", "Unable to generate token"); + const k = e.server; + return Vue[k] || (Vue[k] = {}), i && (Vue[k][i.username] = i.password), F.validity = x, F; + }); + } + isBusy() { + return !!this._busy; + } + checkSignInStatus(e) { + return this.checkAppAccess(e, "").then((i) => i.credential); + } + checkAppAccess(e, i, r) { + let n = !1; + return this.getCredential(e, { prompt: !1 }).then((s) => { + let o; + const a = { f: "json" }; + if (s.scope === "portal") + if (i && (this._doPortalSignIn(e) || r && r.force)) + o = s.server + "/sharing/rest/oauth2/validateAppAccess", a.client_id = i; + else { + if (!s.token) + return { credential: s }; + o = s.server + "/sharing/rest"; + } + else { + if (!s.token) + return { credential: s }; + o = s.server + "/rest/services"; + } + return s.token && (a.token = s.token), ir(o, { query: a, authMode: "anonymous" }).then((l) => { + if (l.data.valid === !1) + throw new ot("identity-manager:not-authorized", `You are currently signed in as: '${s.userId}'.`, l.data); + return n = !!l.data.viewOnlyUserTypeApp, { credential: s }; + }).catch((l) => { + if (l.name === "identity-manager:not-authorized") + throw l; + const c = l.details && l.details.httpStatus; + if (c === 498) + throw s.destroy(), new ot("identity-manager:not-authenticated", "User is not signed in."); + if (c === 400) + throw new ot("identity-manager:invalid-request"); + return { credential: s }; + }); + }).then((s) => ({ credential: s.credential, viewOnly: n })); + } + setOAuthResponseHash(e) { + e && (e.charAt(0) === "#" && (e = e.substring(1)), this._processOAuthPopupParams(LD(e))); + } + setOAuthRedirectionHandler(e) { + this._oAuthRedirectFunc = e; + } + setProtocolErrorHandler(e) { + this._protocolFunc = e; + } + signIn(e, i, r = {}) { + const n = mm(), s = () => { + l?.remove(), c?.remove(), h?.remove(), a?.destroy(), this.dialog?.destroy(), this.dialog = a = l = c = h = null; + }, o = () => { + s(), this._oAuthDfd = null, n.reject(new ot("identity-manager:user-aborted", "ABORTED")); + }; + r.signal && Sp(r.signal, () => { + o(); + }); + let a = new this.formConstructor(); + a.resource = this.getResourceName(e), a.server = i.server, this.dialog = new iKe(), this.dialog.content = a, this.dialog.open = !0, this.emit("dialog-create"); + let l = a.on("cancel", o), c = Qi(() => this.dialog.open, o), h = a.on("submit", (p) => { + this.generateToken(i, p, { isAdmin: r.isAdmin, signal: r.signal }).then((y) => { + s(); + const v = new Cd({ userId: p.username, server: i.server, token: y.token, expires: y.expires != null ? Number(y.expires) : null, ssl: !!y.ssl, isAdmin: r.isAdmin, validity: y.validity }); + n.resolve(v); + }).catch((y) => { + a.error = y, a.signingIn = !1; + }); + }); + return n.promise; + } + oAuthSignIn(e, i, r, n) { + this._oAuthDfd = mm(); + const s = this._oAuthDfd; + let o; + n?.signal && Sp(n.signal, () => { + const x = this._oAuthDfd && this._oAuthDfd.oAuthWin_; + x && !x.closed ? x.close() : this.dialog && y(); + }), s.resUrl_ = e, s.sinfo_ = i, s.oinfo_ = r; + const a = r._oAuthCred; + if (a.storage && (r.flowType === "authorization-code" || r.flowType === "auto" && !r.popup && i.currentVersion >= 8.4)) { + let x = crypto.getRandomValues(new Uint8Array(32)); + o = Q_e(x), a.codeVerifier = o, x = crypto.getRandomValues(new Uint8Array(32)), a.stateUID = Q_e(x), a.save() || (a.codeVerifier = o = null); + } else + a.codeVerifier = null; + let l, c, h, p; + this._getCodeChallenge(o).then((x) => { + const I = !n || n.oAuthPopupConfirmation !== !1; + r.popup && I ? (l = new this.formConstructor(), l.oAuthPrompt = !0, l.server = i.server, this.dialog = new iKe(), this.dialog.content = l, this.dialog.open = !0, this.emit("dialog-create"), c = l.on("cancel", y), h = Qi(() => this.dialog.open, y), p = l.on("submit", () => { + v(), this._doOAuthSignIn(e, i, r, x); + })) : this._doOAuthSignIn(e, i, r, x); + }); + const y = () => { + v(), this._oAuthDfd = null, s.reject(new ot("identity-manager:user-aborted", "ABORTED")); + }, v = () => { + c?.remove(), h?.remove(), p?.remove(), l?.destroy(), this.dialog?.destroy(), this.dialog = null; + }; + return s.promise; + } + destroyCredentials() { + this.credentials && this.credentials.slice().forEach((e) => { + e.destroy(); + }), this.emit("credentials-destroy"); + } + enablePostMessageAuth(e = "https://www.arcgis.com/sharing/rest") { + this._postMessageAuthHandle && this._postMessageAuthHandle.remove(), this._postMessageAuthHandle = CO(window, "message", (i) => { + if ((i.origin === this._appOrigin || i.origin.endsWith(".arcgis.com")) && i.data?.type === "arcgis:auth:requestCredential") { + const r = i.source; + this.getCredential(e).then((n) => { + r.postMessage({ type: "arcgis:auth:credential", credential: { expires: n.expires, server: n.server, ssl: n.ssl, token: n.token, userId: n.userId } }, i.origin); + }).catch((n) => { + r.postMessage({ type: "arcgis:auth:error", error: { name: n.name, message: n.message } }, i.origin); + }); + } + }); + } + disablePostMessageAuth() { + this._postMessageAuthHandle && (this._postMessageAuthHandle.remove(), this._postMessageAuthHandle = null); + } + _getOAuthLocationParams() { + let e = window.location.hash; + if (e) { + e.charAt(0) === "#" && (e = e.substring(1)); + const r = LD(e); + let n = !1; + if (r.access_token && r.expires_in && r.state && r.hasOwnProperty("username")) + try { + r.state = JSON.parse(r.state), r.state.portalUrl && (this._oAuthLocationParams = r, n = !0); + } catch { + } + else if (r.error && r.error_description && (console.log("IdentityManager OAuth Error: ", r.error, " - ", r.error_description), r.error === "access_denied" && (n = !0, r.state))) + try { + r.state = JSON.parse(r.state); + } catch { + } + n && (window.location.hash = r.state?.hash || ""); + } + let i = window.location.search; + if (i) { + i.charAt(0) === "?" && (i = i.substring(1)); + const r = LD(i); + let n = !1; + if (r.code && r.state) + try { + r.state = JSON.parse(r.state), r.state.portalUrl && r.state.uid && (this._oAuthLocationParams = r, n = !0); + } catch { + } + else if (r.error && r.error_description && (console.log("IdentityManager OAuth Error: ", r.error, " - ", r.error_description), r.error === "access_denied" && (n = !0, r.state))) + try { + r.state = JSON.parse(r.state); + } catch { + } + if (n) { + const s = { ...r }; + ["code", "error", "error_description", "message_code", "persist", "state"].forEach((l) => { + delete s[l]; + }); + const o = c1(s), a = window.location.pathname + (o ? `?${o}` : "") + (r.state?.hash || ""); + window.history.replaceState(window.history.state, "", a); + } + } + } + _getOAuthToken(e, i, r, n, s) { + return e = e.replace(/^http:/i, "https:"), ir(`${e}/sharing/rest/oauth2/token`, { authMode: "anonymous", method: "post", query: n && s ? { grant_type: "authorization_code", code: i, redirect_uri: n, client_id: r, code_verifier: s } : { grant_type: "refresh_token", refresh_token: i, client_id: r } }).then((o) => o.data); + } + _getCodeChallenge(e) { + if (e && globalThis.isSecureContext) { + const i = new TextEncoder().encode(e); + return crypto.subtle.digest("SHA-256", i).then((r) => Q_e(new Uint8Array(r))); + } + return Promise.resolve(null); + } + _pageShowHandler(e) { + if (e.persisted && this.isBusy() && this._rejectOnPersistedPageShow) { + const i = new ot("identity-manager:user-aborted", "ABORTED"); + this._errbackFunc(i); + } + } + _findCredential(e, i) { + let r, n, s, o, a = -1; + const l = i && i.token, c = i && i.resource, h = this._isServerRsrc(e) ? "server" : "portal", p = this.credentials.filter((y) => this._hasSameServerInstance(y.server, e) && y.scope === h); + if (e = c || e, p.length) + if (p.length === 1) { + if (r = p[0], s = this.findServerInfo(r.server), n = s && s.owningSystemUrl, o = n ? this.findCredential(n, r.userId) : void 0, a = this._getIdenticalSvcIdx(e, r), !l) + return a === -1 && r.resources.push(e), this._addResource(e, o), r; + a !== -1 && (r.resources.splice(a, 1), this._removeResource(e, o)); + } else { + let y, v; + if (p.some((x) => (v = this._getIdenticalSvcIdx(e, x), v !== -1 && (y = x, s = this.findServerInfo(y.server), n = s && s.owningSystemUrl, o = n ? this.findCredential(n, y.userId) : void 0, a = v, !0))), l) + y && (y.resources.splice(a, 1), this._removeResource(e, o)); + else if (y) + return this._addResource(e, o), y; + } + } + _findOAuthInfo(e) { + let i = this.findOAuthInfo(e); + if (!i) { + for (const r of this.oAuthInfos) + if (this._isIdProvider(r.portalUrl, e)) { + i = r; + break; + } + } + return i; + } + _addResource(e, i) { + i && this._getIdenticalSvcIdx(e, i) === -1 && i.resources.push(e); + } + _removeResource(e, i) { + let r = -1; + i && (r = this._getIdenticalSvcIdx(e, i), r > -1 && i.resources.splice(r, 1)); + } + _useProxy(e, i) { + return i && i.isAdmin && !v0(e.adminTokenServiceUrl, this._appOrigin) || !this._isPortalDomain(e.tokenServiceUrl) && String(e.currentVersion) === "10.1" && !v0(e.tokenServiceUrl, this._appOrigin); + } + _getOrigin(e) { + const i = new yy(e); + return i.scheme + "://" + i.host + (i.port != null ? ":" + i.port : ""); + } + _getServerInstanceRoot(e) { + const i = e.toLowerCase(); + let r = i.indexOf(this._agsRest); + return r === -1 && this._isAdminResource(e) && (r = this._agsAdmin.test(e) ? e.replace(this._agsAdmin, "$1").length : e.search(this._adminSvcs)), r !== -1 || cct(i) || (r = i.indexOf("/sharing")), r === -1 && i.substr(-1) === "/" && (r = i.length - 1), r > -1 ? e.substring(0, r) : e; + } + _hasSameServerInstance(e, i) { + return e.substr(-1) === "/" && (e = e.slice(0, -1)), e = e.toLowerCase(), i = this._getServerInstanceRoot(i).toLowerCase(), e = this._normalizeAGOLorgDomain(e), i = this._normalizeAGOLorgDomain(i), (e = e.substr(e.indexOf(":"))) === (i = i.substr(i.indexOf(":"))); + } + _normalizeAGOLorgDomain(e) { + const i = /^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i, r = /^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i, n = /^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i; + return i.test(e) ? e = e.replace(i, "https://www.arcgis.com") : r.test(e) ? e = e.replace(r, "https://devext.arcgis.com") : n.test(e) && (e = e.replace(n, "https://qaext.arcgis.com")), e; + } + _sanitizeUrl(e) { + const i = (ua.request.proxyUrl || "").toLowerCase(), r = i ? e.toLowerCase().indexOf(i + "?") : -1; + return r !== -1 && (e = e.substring(r + i.length + 1)), e = R0(e), ca(e).path; + } + _isRESTService(e) { + return e.includes(this._agsRest); + } + _isAdminResource(e) { + return this._agsAdmin.test(e) || this._adminSvcs.test(e); + } + _isServerRsrc(e) { + return this._isRESTService(e) || this._isAdminResource(e); + } + _isIdenticalService(e, i) { + let r = !1; + if (this._isRESTService(e) && this._isRESTService(i)) { + const n = this._getSuffix(e).toLowerCase(), s = this._getSuffix(i).toLowerCase(); + if (r = n === s, !r) { + const o = /(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi; + r = n.replace(o, "$1") === s.replace(o, "$1"); + } + } else + this._isAdminResource(e) && this._isAdminResource(i) ? r = !0 : this._isServerRsrc(e) || this._isServerRsrc(i) || !this._isPortalDomain(e) || (r = !0); + return r; + } + _isPortalDomain(e) { + const i = new yy(e.toLowerCase()), r = this._portalConfig; + let n = this._gwDomains.some((s) => s.regex.test(i.uri)); + return !n && r && (n = this._hasSameServerInstance(this._getServerInstanceRoot(r.restBaseUrl), i.uri)), n || ua.portalUrl && (n = v0(i, ua.portalUrl, !0)), n || (n = this._portals.some((s) => this._hasSameServerInstance(s, i.uri))), n = n || this._agsPortal.test(i.path), n; + } + _isIdProvider(e, i) { + let r = -1, n = -1; + this._gwDomains.forEach((o, a) => { + r === -1 && o.regex.test(e) && (r = a), n === -1 && o.regex.test(i) && (n = a); + }); + let s = !1; + if (r > -1 && n > -1 && (r === 0 || r === 4 ? n !== 0 && n !== 4 || (s = !0) : r === 1 ? n !== 1 && n !== 2 || (s = !0) : r === 2 ? n === 2 && (s = !0) : r === 3 && n === 3 && (s = !0)), !s) { + const o = this.findServerInfo(i), a = o && o.owningSystemUrl; + a && MCt(o) && this._isPortalDomain(a) && this._isIdProvider(e, a) && (s = !0); + } + return s; + } + _getIdenticalSvcIdx(e, i) { + let r = -1; + for (let n = 0; n < i.resources.length; n++) { + const s = i.resources[n]; + if (this._isIdenticalService(e, s)) { + r = n; + break; + } + } + return r; + } + _getSuffix(e) { + return e.replace(this._regexSDirUrl, "").replace(this._regexServerType, "$1"); + } + _getTokenSvcUrl(e) { + let i, r, n; + if (this._isRESTService(e) || this._isAdminResource(e)) { + const s = this._getServerInstanceRoot(e); + return i = s + "/admin/generateToken", r = ir(e = s + "/rest/info", { query: { f: "json" } }).then((o) => o.data), { adminUrl: i, promise: r }; + } + if (this._isPortalDomain(e)) { + let s = ""; + if (this._gwDomains.some((o) => (o.regex.test(e) && (s = o.tokenServiceUrl), !!s)), s || this._portals.some((o) => (this._hasSameServerInstance(o, e) && (s = o + this._gwTokenUrl), !!s)), s || (n = e.toLowerCase().indexOf("/sharing"), n !== -1 && (s = e.substring(0, n) + this._gwTokenUrl)), s || (s = this._getOrigin(e) + this._gwTokenUrl), s) { + const o = new yy(e).port; + /^http:\/\//i.test(e) && o === "7080" && (s = s.replace(/:7080/i, ":7443")), s = s.replace(/http:/i, "https:"); + } + return s; + } + if (e.toLowerCase().includes("premium.arcgisonline.com")) + return "https://premium.arcgisonline.com/server/tokens"; + } + _processOAuthResponseParams(e, i, r) { + const n = i._oAuthCred; + if (e.code) { + const o = n.codeVerifier; + return n.codeVerifier = null, n.stateUID = null, n.save(), this._getOAuthToken(r.server, e.code, i.appId, this._getRedirectURI(i, !0), o).then((a) => { + const l = new Cd({ userId: a.username, server: r.server, token: a.access_token, expires: Date.now() + 1e3 * a.expires_in, ssl: a.ssl, oAuthState: e.state, _oAuthCred: n }); + return i.userId = l.userId, n.storage = a.persist ? jue : Gue, n.refreshToken = a.refresh_token, n.token = null, n.expires = a.refresh_token_expires_in ? Date.now() + 1e3 * a.refresh_token_expires_in : null, n.userId = l.userId, n.ssl = l.ssl, n.save(), l; + }); + } + const s = new Cd({ userId: e.username, server: r.server, token: e.access_token, expires: Date.now() + 1e3 * Number(e.expires_in), ssl: e.ssl === "true", oAuthState: e.state, _oAuthCred: n }); + return i.userId = s.userId, n.storage = e.persist ? jue : Gue, n.refreshToken = null, n.token = s.token, n.expires = s.expires, n.userId = s.userId, n.ssl = s.ssl, n.save(), Promise.resolve(s); + } + _processOAuthPopupParams(e) { + const i = this._oAuthDfd; + if (this._oAuthDfd = null, i) + if (clearInterval(this._oAuthIntervalId), this._oAuthOnPopupHandle?.remove(), e.error) { + const r = e.error === "access_denied", n = new ot(r ? "identity-manager:user-aborted" : "identity-manager:authentication-failed", r ? "ABORTED" : "OAuth: " + e.error + " - " + e.error_description); + i.reject(n); + } else + this._processOAuthResponseParams(e, i.oinfo_, i.sinfo_).then((r) => { + i.resolve(r); + }).catch((r) => { + i.reject(r); + }); + } + _setOAuthResponseQueryString(e) { + e && (e.charAt(0) === "?" && (e = e.substring(1)), this._processOAuthPopupParams(LD(e))); + } + _exchangeToken(e, i, r) { + return ir(`${e}/sharing/rest/oauth2/exchangeToken`, { authMode: "anonymous", method: "post", query: { f: "json", client_id: i, token: r } }).then((n) => n.data.token); + } + _getPlatformSelf(e, i) { + return e = e.replace(/^http:/i, "https:"), ir(`${e}/sharing/rest/oauth2/platformSelf`, { authMode: "anonymous", headers: { "X-Esri-Auth-Client-Id": i, "X-Esri-Auth-Redirect-Uri": window.location.href.replace(/#.*$/, "") }, method: "post", query: { f: "json", expiration: 30 }, withCredentials: !0 }).then((r) => r.data); + } + _getPortalSelf(e, i) { + let r; + return this._gwDomains.some((n) => (n.regex.test(e) && (r = n.customBaseUrl), !!r)), r ? Promise.resolve({ allSSL: !0, currentVersion: "8.4", customBaseUrl: r, portalMode: "multitenant", supportsOAuth: !0 }) : (this._appOrigin.startsWith("https:") ? e = e.replace(/^http:/i, "https:").replace(/:7080/i, ":7443") : /^http:/i.test(i) && (e = e.replace(/^https:/i, "http:").replace(/:7443/i, ":7080")), ir(e, { query: { f: "json" }, authMode: "anonymous", withCredentials: !0 }).then((n) => n.data)); + } + _doPortalSignIn(e) { + const i = this._portalConfig, r = window.location.href, n = this.findServerInfo(e); + return !(!i && !this._isPortalDomain(r) || !(n ? n.hasPortal || n.owningSystemUrl && this._isPortalDomain(n.owningSystemUrl) : this._isPortalDomain(e)) || !(this._isIdProvider(r, e) || i && (this._hasSameServerInstance(this._getServerInstanceRoot(i.restBaseUrl), e) || this._isIdProvider(i.restBaseUrl, e)) || v0(r, e, !0))); + } + _checkProtocol(e, i, r, n) { + let s = !0; + const o = n ? i.adminTokenServiceUrl : i.tokenServiceUrl; + return o.trim().toLowerCase().startsWith("https:") && !this._appOrigin.startsWith("https:") && Mte(o) && (s = !!this._protocolFunc && !!this._protocolFunc({ resourceUrl: e, serverInfo: i }), !s) && r(new ot("identity-manager:aborted", "Aborted the Sign-In process to avoid sending password over insecure connection.")), s; + } + _enqueue(e, i, r, n, s, o) { + return n || (n = mm()), n.resUrl_ = e, n.sinfo_ = i, n.options_ = r, n.admin_ = s, n.refresh_ = o, this._busy ? this._hasSameServerInstance(this._getServerInstanceRoot(e), this._busy.resUrl_) ? (this._oAuthDfd && this._oAuthDfd.oAuthWin_ && this._oAuthDfd.oAuthWin_.focus(), this._soReqs.push(n)) : this._xoReqs.push(n) : this._doSignIn(n), n.promise; + } + _doSignIn(e) { + this._busy = e, this._rejectOnPersistedPageShow = !1; + const i = (c) => { + const h = e.options_ && e.options_.resource, p = e.resUrl_, y = e.refresh_; + let v = !1; + this.credentials.includes(c) || (y && this.credentials.includes(y) ? (y.userId = c.userId, y.token = c.token, y.expires = c.expires, y.validity = c.validity, y.ssl = c.ssl, y.creationTime = c.creationTime, v = !0, c = y) : this.credentials.push(c)), c.resources || (c.resources = []), c.resources.includes(h || p) || c.resources.push(h || p), c.scope = this._isServerRsrc(p) ? "server" : "portal", c.emitTokenChange(); + const x = this._soReqs, I = {}; + this._soReqs = [], x.forEach((P) => { + if (!this._isIdenticalService(p, P.resUrl_)) { + const F = this._getSuffix(P.resUrl_); + I[F] || (I[F] = !0, c.resources.push(P.resUrl_)); + } + }), e.resolve(c), x.forEach((P) => { + this._hasSameServerInstance(this._getServerInstanceRoot(p), P.resUrl_) ? P.resolve(c) : this._soReqs.push(P); + }), this._busy = e.resUrl_ = e.sinfo_ = e.refresh_ = null, v || this.emit("credential-create", { credential: c }), this._soReqs.length ? this._doSignIn(this._soReqs.shift()) : this._xoReqs.length && this._doSignIn(this._xoReqs.shift()); + }, r = (c) => { + e.reject(c), this._busy = e.resUrl_ = e.sinfo_ = e.refresh_ = null, this._soReqs.length ? this._doSignIn(this._soReqs.shift()) : this._xoReqs.length && this._doSignIn(this._xoReqs.shift()); + }, n = (c, h, p, y) => { + const v = e.sinfo_, x = !e.options_ || e.options_.prompt !== !1, I = v.hasPortal && this._findOAuthInfo(e.resUrl_); + let P, F; + if (c) + i(new Cd({ userId: c, server: v.server, token: p || null, expires: y != null ? Number(y) : null, ssl: !!h })); + else if (window !== window.parent && this._appUrlObj.query?.["arcgis-auth-origin"] && this._appUrlObj.query?.["arcgis-auth-portal"] && this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]), e.resUrl_)) { + window.parent.postMessage({ type: "arcgis:auth:requestCredential" }, this._appUrlObj.query["arcgis-auth-origin"]); + const k = CO(window, "message", (V) => { + V.source === window.parent && V.data && (V.data.type === "arcgis:auth:credential" ? (k.remove(), V.data.credential.expires < Date.now() ? r(new ot("identity-manager:credential-request-failed", "Parent application's token has expired.")) : i(new Cd(V.data.credential))) : V.data.type === "arcgis:auth:error" && (k.remove(), V.data.error.name === "tokenExpiredError" ? r(new ot("identity-manager:credential-request-failed", "Parent application's token has expired.")) : r(ot.fromJSON(V.data.error)))); + }); + Sp(e.options_?.signal, () => { + k.remove(); + }); + } else if (I) { + let k = I._oAuthCred; + if (!k) { + const V = new IOe(I, jue), j = new IOe(I, Gue); + V.isValid() && j.isValid() ? V.expires > j.expires ? (k = V, j.destroy()) : (k = j, V.destroy()) : k = V.isValid() ? V : j, I._oAuthCred = k; + } + if (k.isValid()) { + P = new Cd({ userId: k.userId, server: v.server, token: k.token, expires: k.expires, ssl: k.ssl, _oAuthCred: k }); + const V = I.appId !== k.appId && this._doPortalSignIn(e.resUrl_); + V || k.refreshToken ? (e._pendingDfd = k.refreshToken ? this._getOAuthToken(v.server, k.refreshToken, k.appId).then((j) => (P.expires = Date.now() + 1e3 * j.expires_in, P.token = j.access_token, P)) : Promise.resolve(P), e._pendingDfd.then((j) => V ? this._exchangeToken(j.server, I.appId, j.token).then((Y) => (j.token = Y, j)).catch(() => j) : j).then((j) => { + i(j); + }).catch(() => { + k?.destroy(), n(); + })) : i(P); + } else if (this._oAuthLocationParams && this._hasSameServerInstance(I.portalUrl, this._oAuthLocationParams.state.portalUrl) && (this._oAuthLocationParams.access_token || this._oAuthLocationParams.code && this._oAuthLocationParams.state.uid === k.stateUID && k.codeVerifier)) { + const V = this._oAuthLocationParams; + this._oAuthLocationParams = null, e._pendingDfd = this._processOAuthResponseParams(V, I, v).then((j) => { + i(j); + }).catch(r); + } else { + const V = () => { + x ? e._pendingDfd = this.oAuthSignIn(e.resUrl_, v, I, e.options_).then(i, r) : (F = new ot("identity-manager:not-authenticated", "User is not signed in."), r(F)); + }; + this._doPortalSignIn(e.resUrl_) ? e._pendingDfd = this._getPlatformSelf(v.server, I.appId).then((j) => { + v0(j.portalUrl, this._appOrigin, !0) ? (P = new Cd({ userId: j.username, server: v.server, expires: Date.now() + 1e3 * j.expires_in, token: j.token }), i(P)) : V(); + }).catch(V) : V(); + } + } else if (x) { + if (this._checkProtocol(e.resUrl_, v, r, e.admin_)) { + let k = e.options_; + e.admin_ && (k = k || {}, k.isAdmin = !0), e._pendingDfd = this.signIn(e.resUrl_, v, k).then(i, r); + } + } else + F = new ot("identity-manager:not-authenticated", "User is not signed in."), r(F); + }, s = () => { + const c = e.sinfo_, h = c.owningSystemUrl, p = e.options_; + let y, v, x, I; + if (p && (y = p.token, v = p.error, x = p.prompt), I = this._findCredential(h, { token: y, resource: e.resUrl_ }), !I) { + for (const P of this.credentials) + if (this._isIdProvider(h, P.server)) { + I = P; + break; + } + } + if (I) { + const P = this.findCredential(e.resUrl_, I.userId); + if (P) + i(P); + else if (POe(c, this._legacyFed)) { + const F = I.toJSON(); + F.server = c.server, F.resources = null, i(new Cd(F)); + } else + (e._pendingDfd = this.generateToken(this.findServerInfo(I.server), null, { serverUrl: e.resUrl_, token: I.token, signal: e.options_.signal, ssl: I.ssl })).then((F) => { + i(new Cd({ userId: I?.userId, server: c.server, token: F.token, expires: F.expires != null ? Number(F.expires) : null, ssl: !!F.ssl, isAdmin: e.admin_, validity: F.validity })); + }, r); + } else + this._busy = null, y && (e.options_.token = null), (e._pendingDfd = this.getCredential(h.replace(/\/?$/, "/sharing"), { resource: e.resUrl_, owningTenant: c.owningTenant, signal: e.options_.signal, token: y, error: v, prompt: x })).then(() => { + this._enqueue(e.resUrl_, e.sinfo_, e.options_, e, e.admin_); + }, (P) => { + e.resUrl_ = e.sinfo_ = e.refresh_ = null, e.reject(P); + }); + }; + this._errbackFunc = r; + const o = e.sinfo_.owningSystemUrl, a = this._isServerRsrc(e.resUrl_), l = e.sinfo_._restInfoPms; + l ? l.promise.then((c) => { + const h = e.sinfo_; + if (h._restInfoPms) { + h.adminTokenServiceUrl = h._restInfoPms.adminUrl, h._restInfoPms = null, h.tokenServiceUrl = (bS("authInfo.tokenServicesUrl", c) || bS("authInfo.tokenServiceUrl", c) || bS("tokenServiceUrl", c)) ?? null, h.shortLivedTokenValidity = bS("authInfo.shortLivedTokenValidity", c) ?? null, h.currentVersion = c.currentVersion, h.owningTenant = c.owningTenant; + const p = h.owningSystemUrl = c.owningSystemUrl; + p && this._portals.push(p); + } + a && h.owningSystemUrl ? s() : n(); + }, () => { + e.sinfo_._restInfoPms = null; + const c = new ot("identity-manager:server-identification-failed", "Unknown resource - could not find token service endpoint."); + r(c); + }) : a && o ? s() : e.sinfo_._selfReq ? e.sinfo_._selfReq.selfDfd.then((c) => { + const h = {}; + let p, y, v, x; + return c && (p = c.user && c.user.username, h.username = p, h.allSSL = c.allSSL, y = c.supportsOAuth, x = parseFloat(c.currentVersion), c.portalMode === "multitenant" && (v = c.customBaseUrl), e.sinfo_.currentVersion = x), e.sinfo_.webTierAuth = !!p, p && this.normalizeWebTierAuth ? this.generateToken(e.sinfo_, null, { ssl: h.allSSL }).catch(() => null).then((I) => (h.portalToken = I && I.token, h.tokenExpiration = I && I.expires, h)) : !p && y && x >= 4.4 && !this._findOAuthInfo(e.resUrl_) ? this._generateOAuthInfo({ portalUrl: e.sinfo_.server, customBaseUrl: v, owningTenant: e.sinfo_._selfReq.owningTenant }).catch(() => null).then(() => h) : h; + }).catch(() => null).then((c) => { + e.sinfo_._selfReq = null, c ? n(c.username, c.allSSL, c.portalToken, c.tokenExpiration) : n(); + }) : n(); + } + _generateOAuthInfo(e) { + let i, r = null, n = e.portalUrl; + const s = e.customBaseUrl, o = e.owningTenant, a = !this._defaultOAuthInfo && this._createDefaultOAuthInfo && !this._hasTestedIfAppIsOnPortal; + if (a) { + r = window.location.href; + let l = r.indexOf("?"); + l > -1 && (r = r.slice(0, l)), l = r.search(/\/(apps|home)\//), r = l > -1 ? r.slice(0, l) : null; + } + return a && r ? (this._hasTestedIfAppIsOnPortal = !0, i = ir(r + "/sharing/rest", { query: { f: "json" } }).then(() => { + this._defaultOAuthInfo = new rKe({ appId: "arcgisonline", popupCallbackUrl: r + "/home/oauth-callback.html" }); + })) : i = Promise.resolve(), i.then(() => { + if (this._defaultOAuthInfo) + return n = n.replace(/^http:/i, "https:"), ir(n + "/sharing/rest/oauth2/validateRedirectUri", { query: { accountId: o, client_id: this._defaultOAuthInfo.appId, redirect_uri: C0(this._defaultOAuthInfo.popupCallbackUrl), f: "json" } }).then((l) => { + if (l.data.valid) { + const c = this._defaultOAuthInfo.clone(); + l.data.urlKey && s ? c.portalUrl = "https://" + l.data.urlKey.toLowerCase() + "." + s : c.portalUrl = n, c.popup = window !== window.top || !(v0(n, this._appOrigin) || this._gwDomains.some((h) => h.regex.test(n) && h.regex.test(this._appOrigin))), this.oAuthInfos.push(c); + } + }); + }); + } + _doOAuthSignIn(e, i, r, n) { + const s = r._oAuthCred, o = { portalUrl: r.portalUrl }; + !r.popup && r.preserveUrlHash && window.location.hash && (o.hash = window.location.hash), s.stateUID && (o.uid = s.stateUID); + const a = { client_id: r.appId, response_type: s.codeVerifier ? "code" : "token", state: JSON.stringify(o), expiration: r.expiration, locale: r.locale, redirect_uri: this._getRedirectURI(r, !!s.codeVerifier) }; + r.forceLogin && (a.force_login = !0), r.forceUserId && r.userId && (a.prepopulatedusername = r.userId), !r.popup && this._doPortalSignIn(e) && (a.redirectToUserOrgUrl = !0), s.codeVerifier && (a.code_challenge = n || s.codeVerifier, a.code_challenge_method = n ? "S256" : "plain"); + const l = r.portalUrl.replace(/^http:/i, "https:") + "/sharing/oauth2/authorize", c = l + "?" + c1(a); + if (r.popup) { + const h = window.open(c, "esriJSAPIOAuth", r.popupWindowFeatures); + if (h) + h.focus(), this._oAuthDfd.oAuthWin_ = h, this._oAuthIntervalId = setInterval(() => { + if (h.closed) { + clearInterval(this._oAuthIntervalId), this._oAuthOnPopupHandle.remove(); + const p = this._oAuthDfd; + if (p) { + const y = new ot("identity-manager:user-aborted", "ABORTED"); + p.reject(y); + } + } + }, 500), this._oAuthOnPopupHandle = CO(window, ["arcgis:auth:hash", "arcgis:auth:location:search"], (p) => { + p.type === "arcgis:auth:hash" ? this.setOAuthResponseHash(p.detail) : this._setOAuthResponseQueryString(p.detail); + }); + else { + const p = new ot("identity-manager:popup-blocked", "ABORTED"); + this._oAuthDfd.reject(p); + } + } else + this._rejectOnPersistedPageShow = !0, this._oAuthRedirectFunc ? this._oAuthRedirectFunc({ authorizeParams: a, authorizeUrl: l, resourceUrl: e, serverInfo: i, oAuthInfo: r }) : window.location.href = c; + } + _getRedirectURI(e, i) { + const r = window.location.href.replace(/#.*$/, ""); + if (e.popup) + return C0(e.popupCallbackUrl); + if (i) { + const n = ca(r); + return n.query && ["code", "error", "error_description", "message_code", "persist", "state"].forEach((s) => { + delete n.query[s]; + }), M0(n.path, n.query); + } + return r; + } +}; +DCt.prototype.declaredClass = "esri.identity.IdentityManagerBase"; +let Cd = class extends Bd.EventedAccessor { + constructor(e) { + super(e), this._oAuthCred = null, this.tokenRefreshBuffer = 2, e && e._oAuthCred && (this._oAuthCred = e._oAuthCred); + } + initialize() { + this.resources = this.resources || [], this.creationTime == null && (this.creationTime = Date.now()); + } + refreshToken() { + const e = $o.findServerInfo(this.server), i = e && e.owningSystemUrl, r = !!i && this.scope === "server", n = r && POe(e, $o._legacyFed), s = e.webTierAuth, o = s && $o.normalizeWebTierAuth, a = Vue[this.server], l = a && a[this.userId]; + let c, h = this.resources && this.resources[0], p = r ? $o.findServerInfo(i) : null, y = { username: this.userId, password: l }; + if (s && !o) + return; + r && !p && $o.serverInfos.some((x) => ($o._isIdProvider(i, x.server) && (p = x), !!p)); + const v = p ? $o.findCredential(p.server, this.userId) : null; + if (!r || v) { + if (!n) { + if (r) + c = { serverUrl: h, token: v && v.token, ssl: v && v.ssl }; + else if (o) + y = null, c = { ssl: this.ssl }; + else { + if (!l) { + let x; + return h && (h = $o._sanitizeUrl(h), this._enqueued = 1, x = $o._enqueue(h, e, null, null, this.isAdmin, this), x.then(() => { + this._enqueued = 0, this.refreshServerTokens(); + }).catch(() => { + this._enqueued = 0; + })), x; + } + this.isAdmin && (c = { isAdmin: !0 }); + } + return $o.generateToken(r ? p : e, r ? null : y, c).then((x) => { + this.token = x.token, this.expires = x.expires != null ? Number(x.expires) : null, this.creationTime = Date.now(), this.validity = x.validity, this.emitTokenChange(), this.refreshServerTokens(); + }).catch(() => { + }); + } + v?.refreshToken(); + } + } + refreshServerTokens() { + this.scope === "portal" && $o.credentials.forEach((e) => { + const i = $o.findServerInfo(e.server), r = i && i.owningSystemUrl; + e !== this && e.userId === this.userId && r && e.scope === "server" && ($o._hasSameServerInstance(this.server, r) || $o._isIdProvider(r, this.server)) && (POe(i, $o._legacyFed) ? (e.token = this.token, e.expires = this.expires, e.creationTime = this.creationTime, e.validity = this.validity, e.emitTokenChange()) : e.refreshToken()); + }); + } + emitTokenChange(e) { + clearTimeout(this._refreshTimer); + const i = this.server && $o.findServerInfo(this.server), r = i && i.owningSystemUrl, n = r && $o.findServerInfo(r); + e === !1 || r && this.scope !== "portal" && (!n || !n.webTierAuth || $o.normalizeWebTierAuth) || this.expires == null && this.validity == null || this._startRefreshTimer(), this.emit("token-change"); + } + destroy() { + this.userId = this.server = this.token = this.expires = this.validity = this.resources = this.creationTime = null, this._oAuthCred && (this._oAuthCred.destroy(), this._oAuthCred = null); + const e = $o.credentials.indexOf(this); + e > -1 && $o.credentials.splice(e, 1), this.emitTokenChange(), this.emit("destroy"); + } + toJSON() { + const e = Jme({ userId: this.userId, server: this.server, token: this.token, expires: this.expires, validity: this.validity, ssl: this.ssl, isAdmin: this.isAdmin, creationTime: this.creationTime, scope: this.scope }), i = this.resources; + return i && i.length > 0 && (e.resources = i.slice()), e; + } + _startRefreshTimer() { + clearTimeout(this._refreshTimer); + const e = 6e4 * this.tokenRefreshBuffer, i = 2 ** 31 - 1; + let r = (this.validity ? this.creationTime + 6e4 * this.validity : this.expires) - Date.now(); + r < 0 ? r = 0 : r > i && (r = i), this._refreshTimer = setTimeout(this.refreshToken.bind(this), r > e ? r - e : r); + } +}; +E([N()], Cd.prototype, "creationTime", void 0), E([N()], Cd.prototype, "expires", void 0), E([N()], Cd.prototype, "isAdmin", void 0), E([N()], Cd.prototype, "oAuthState", void 0), E([N()], Cd.prototype, "resources", void 0), E([N()], Cd.prototype, "scope", void 0), E([N()], Cd.prototype, "server", void 0), E([N()], Cd.prototype, "ssl", void 0), E([N()], Cd.prototype, "token", void 0), E([N()], Cd.prototype, "tokenRefreshBuffer", void 0), E([N()], Cd.prototype, "userId", void 0), E([N()], Cd.prototype, "validity", void 0), Cd = E([dt("esri.identity.Credential")], Cd); +let FCt = class extends DCt { +}; +FCt.prototype.declaredClass = "esri.identity.IdentityManager"; +const LCt = new FCt(); +xBt(LCt); +const ERi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: LCt +}, Symbol.toStringTag, { value: "Module" })); +let IRi = class { + constructor(e, i, r, n) { + this._hasNoDataValues = null, this._minValue = null, this._maxValue = null, "pixelData" in e ? (this.values = e.pixelData, this.width = e.width, this.height = e.height, this.noDataValue = e.noDataValue) : (this.values = e, this.width = i, this.height = r, this.noDataValue = n); + } + get hasNoDataValues() { + if (ut(this._hasNoDataValues)) { + const e = this.noDataValue; + this._hasNoDataValues = this.values.includes(e); + } + return this._hasNoDataValues; + } + get minValue() { + return this._ensureBounds(), this._minValue; + } + get maxValue() { + return this._ensureBounds(), this._maxValue; + } + _ensureBounds() { + if (_e(this._minValue)) + return; + const { noDataValue: e, values: i } = this; + let r = 1 / 0, n = -1 / 0, s = !0; + for (const o of i) + o === e ? this._hasNoDataValues = !0 : (r = o < r ? o : r, n = o > n ? o : n, s = !1); + s ? (this._minValue = 0, this._maxValue = 0) : (this._minValue = r, this._maxValue = n > -3e38 ? n : 0); + } +}, ARi = class { + constructor(e, i, r, n, s = {}) { + this._mainMethod = i, this._transferLists = r, this._listeners = [], this._promise = p3(e, { ...s, schedule: n }).then((o) => { + if (this._thread === void 0) { + this._thread = o, this._promise = null, s.hasInitialize && this.broadcast({}, "initialize"); + for (const a of this._listeners) + this._connectListener(a); + } else + o.close(); + }), this._promise.catch((o) => Ei.getLogger("esri.core.workers.WorkerHandle").error(`Failed to initialize ${e} worker: ${o}`)); + } + on(e, i) { + const r = { removed: !1, eventName: e, callback: i, threadHandle: null }; + return this._listeners.push(r), this._connectListener(r), c3(() => { + r.removed = !0, u4e(this._listeners, r), this._thread && _e(r.threadHandle) && r.threadHandle.remove(); + }); + } + destroy() { + this._thread && (this._thread.close(), this._thread = null), this._promise = null; + } + invoke(e, i) { + return this.invokeMethod(this._mainMethod, e, i); + } + invokeMethod(e, i, r) { + if (this._thread) { + const n = this._transferLists[e], s = n ? n(i) : []; + return this._thread.invoke(e, i, { transferList: s, signal: r }); + } + return this._promise ? this._promise.then(() => (hn(r), this.invokeMethod(e, i, r))) : Promise.reject(null); + } + broadcast(e, i) { + return this._thread ? Promise.all(this._thread.broadcast(i, e)).then(() => { + }) : this._promise ? this._promise.then(() => this.broadcast(e, i)) : Promise.reject(); + } + get promise() { + return this._promise; + } + _connectListener(e) { + this._thread && this._thread.on(e.eventName, e.callback).then((i) => { + e.removed || (e.threadHandle = i); + }); + } +}, nKe = class extends ARi { + constructor(e = null) { + super("LercWorker", "_decode", { _decode: (i) => [i.buffer] }, e, { strategy: "dedicated" }), this.schedule = e, this.ref = 0; + } + decode(e, i, r) { + return e && e.byteLength !== 0 ? this.invoke({ buffer: e, options: i }, r) : Promise.resolve(null); + } + release() { + --this.ref <= 0 && (jJ.forEach((e, i) => { + e === this && jJ.delete(i); + }), this.destroy()); + } +}; +const jJ = /* @__PURE__ */ new Map(); +function PRi(t = null) { + let e = jJ.get(t); + return e || (_e(t) ? (e = new nKe((i) => t.immediate.schedule(i)), jJ.set(t, e)) : (e = new nKe(), jJ.set(null, e))), ++e.ref, e; +} +let ty = class extends nNe(S1(nh(Bh(Hu(pu))))) { + constructor(...e) { + super(...e), this.copyright = null, this.heightModelInfo = null, this.path = null, this.minScale = void 0, this.maxScale = void 0, this.opacity = 1, this.operationalLayerType = "ArcGISTiledElevationServiceLayer", this.sourceJSON = null, this.type = "elevation", this.url = null, this.version = null, this._lercDecoder = PRi(); + } + normalizeCtorArgs(e, i) { + return typeof e == "string" ? { url: e, ...i } : e; + } + destroy() { + this._lercDecoder = QR(this._lercDecoder); + } + readVersion(e, i) { + let r = i.currentVersion; + return r || (r = 9.3), r; + } + load(e) { + const i = _e(e) ? e.signal : null; + return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Image Service"], supportsData: !1, validateItem: (r) => { + for (let n = 0; n < r.typeKeywords.length; n++) + if (r.typeKeywords[n].toLowerCase() === "elevation 3d layer") + return !0; + throw new ot("portal:invalid-layer-item-type", "Invalid layer item type '${type}', expected '${expectedType}' ", { type: "Image Service", expectedType: "Image Service Elevation 3D Layer" }); + } }, e).catch(ja).then(() => this._fetchImageService(i))), Promise.resolve(this); + } + fetchTile(e, i, r, n) { + const s = _e((n = n || { signal: null }).signal) ? n.signal : n.signal = new AbortController().signal, o = { responseType: "array-buffer", signal: s }, a = { noDataValue: n.noDataValue, returnFileInfo: !0 }; + return this.load().then(() => this._fetchTileAvailability(e, i, r, n)).then(() => ir(this.getTileUrl(e, i, r), o)).then((l) => this._lercDecoder.decode(l.data, a, s)).then((l) => new IRi(l)); + } + getTileUrl(e, i, r) { + const n = !this.tilemapCache && this.supportsBlankTile, s = c1({ ...this.parsedUrl.query, blankTile: !n && null }); + return `${this.parsedUrl.path}/tile/${e}/${i}/${r}${s ? "?" + s : ""}`; + } + async queryElevation(e, i) { + const { ElevationQuery: r } = await Promise.resolve().then(() => Bfe); + return hn(i), new r().query(this, e, i); + } + async createElevationSampler(e, i) { + const { ElevationQuery: r } = await Promise.resolve().then(() => Bfe); + return hn(i), new r().createSampler(this, e, i); + } + _fetchTileAvailability(e, i, r, n) { + return this.tilemapCache ? this.tilemapCache.fetchAvailability(e, i, r, n) : Promise.resolve("unknown"); + } + async _fetchImageService(e) { + if (this.sourceJSON) + return this.sourceJSON; + const i = { query: { f: "json", ...this.parsedUrl.query }, responseType: "json", signal: e }, r = await ir(this.parsedUrl.path, i); + r.ssl && (this.url = this.url?.replace(/^http:/i, "https:")), this.sourceJSON = r.data, this.read(r.data, { origin: "service", url: this.parsedUrl }); + } + get hasOverriddenFetchTile() { + return !this.fetchTile.__isDefault__; + } +}; +E([N({ json: { read: { source: "copyrightText" } } })], ty.prototype, "copyright", void 0), E([N({ readOnly: !0, type: Iz })], ty.prototype, "heightModelInfo", void 0), E([N({ type: String, json: { origins: { "web-scene": { read: !0, write: !0 } }, read: !1 } })], ty.prototype, "path", void 0), E([N({ type: ["show", "hide"] })], ty.prototype, "listMode", void 0), E([N({ json: { read: !1, write: !1, origins: { service: { read: !1, write: !1 }, "portal-item": { read: !1, write: !1 }, "web-document": { read: !1, write: !1 } } }, readOnly: !0 })], ty.prototype, "minScale", void 0), E([N({ json: { read: !1, write: !1, origins: { service: { read: !1, write: !1 }, "portal-item": { read: !1, write: !1 }, "web-document": { read: !1, write: !1 } } }, readOnly: !0 })], ty.prototype, "maxScale", void 0), E([N({ json: { read: !1, write: !1, origins: { "web-document": { read: !1, write: !1 } } } })], ty.prototype, "opacity", void 0), E([N({ type: ["ArcGISTiledElevationServiceLayer"] })], ty.prototype, "operationalLayerType", void 0), E([N()], ty.prototype, "sourceJSON", void 0), E([N({ json: { read: !1 }, value: "elevation", readOnly: !0 })], ty.prototype, "type", void 0), E([N(j0)], ty.prototype, "url", void 0), E([N()], ty.prototype, "version", void 0), E([Li("version", ["currentVersion"])], ty.prototype, "readVersion", null), ty = E([dt("esri.layers.ElevationLayer")], ty), ty.prototype.fetchTile.__isDefault__ = !0; +const ORi = ty, NCt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: ORi +}, Symbol.toStringTag, { value: "Module" })); +async function RRi(t, e = {}, i) { + await t.load(i); + const r = $d(t.itemUrl, "resources"), { start: n = 1, num: s = 10, sortOrder: o = "asc", sortField: a = "created" } = e, l = { query: { start: n, num: s, sortOrder: o, sortField: a, token: t.apiKey }, signal: sC(i, "signal") }, c = await t.portal.request(r, l); + return { total: c.total, nextStart: c.nextStart, resources: c.resources.map(({ created: h, size: p, resource: y }) => ({ created: new Date(h), size: p, resource: t.resourceFromPath(y) })) }; +} +async function MRi(t, e, i, r) { + if (!t.hasPath()) + throw new ot(`portal-item-resource-${e}:invalid-path`, "Resource does not have a valid path"); + const n = t.portalItem; + await n.load(r); + const s = $d(n.userItemUrl, e === "add" ? "addResources" : "updateResources"), [o, a] = kCt(t.path), l = await $Ct(i), c = new FormData(); + return o && o !== "." && c.append("resourcesPrefix", o), _e(r) && r.compress && c.append("compress", "true"), c.append("fileName", a), c.append("file", l, a), c.append("f", "json"), _e(r) && r.access && c.append("access", r.access), await n.portal.request(s, { method: "post", body: c, signal: sC(r, "signal") }), t; +} +async function DRi(t, e, i) { + if (!e.hasPath()) + throw new ot("portal-item-resources-remove:invalid-path", "Resource does not have a valid path"); + await t.load(i); + const r = $d(t.userItemUrl, "removeResources"); + await t.portal.request(r, { method: "post", query: { resource: e.path }, signal: sC(i, "signal") }), e.portalItem = null; +} +async function FRi(t, e) { + await t.load(e); + const i = $d(t.userItemUrl, "removeResources"); + return t.portal.request(i, { method: "post", query: { deleteAll: !0 }, signal: sC(e, "signal") }); +} +function kCt(t) { + const e = t.lastIndexOf("/"); + return e === -1 ? [".", t] : [t.slice(0, e), t.slice(e + 1)]; +} +function o$e(t) { + const [e, i] = LRi(t), [r, n] = kCt(e); + return [r, n, i]; +} +function LRi(t) { + const e = P4e(t); + return ut(e) ? [t, ""] : [t.slice(0, t.length - e.length - 1), `.${e}`]; +} +async function $Ct(t) { + return t instanceof Blob ? t : (await ir(t.url, { responseType: "blob" })).data; +} +function NRi(t, e) { + if (!t.hasPath()) + return null; + const [i, , r] = o$e(t.path); + return t.portalItem.resourceFromPath($d(i, e + r)); +} +function BCt(t, e) { + if (!t.hasPath()) + return null; + const [i, , r] = o$e(t.path); + return t.portalItem.resourceFromPath($d(i, e + r)); +} +const nX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addOrUpdateResource: MRi, + contentToBlob: $Ct, + fetchResources: RRi, + getSiblingOfSameType: NRi, + getSiblingOfSameTypeI: BCt, + removeAllResources: FRi, + removeResource: DRi, + splitPrefixFileNameAndExtension: o$e +}, Symbol.toStringTag, { value: "Module" })), Ww = { BingMapsLayer: async () => (await Promise.resolve().then(() => kEr)).default, BuildingSceneLayer: async () => (await Promise.resolve().then(() => nIr)).default, CSVLayer: async () => (await Promise.resolve().then(() => oIr)).default, DimensionLayer: async () => (await Promise.resolve().then(() => cIr)).default, ElevationLayer: async () => (await Promise.resolve().then(() => NCt)).default, FeatureLayer: async () => (await Promise.resolve().then(() => f5e)).default, GeoJSONLayer: async () => (await Promise.resolve().then(() => pIr)).default, GeoRSSLayer: async () => (await Promise.resolve().then(() => _Ir)).default, GroupLayer: async () => (await Promise.resolve().then(() => G4t)).default, ImageryLayer: async () => (await Promise.resolve().then(() => Gti)).default, ImageryTileLayer: async () => (await Promise.resolve().then(() => FIr)).default, IntegratedMeshLayer: async () => (await Promise.resolve().then(() => WIr)).default, KMLLayer: async () => (await Promise.resolve().then(() => XIr)).default, LineOfSightLayer: async () => (await Promise.resolve().then(() => sAr)).default, MapImageLayer: async () => (await Promise.resolve().then(() => iii)).default, MapNotesLayer: async () => (await Promise.resolve().then(() => lAr)).default, MediaLayer: async () => (await Promise.resolve().then(() => wAr)).default, OGCFeatureLayer: async () => (await Promise.resolve().then(() => CAr)).default, OpenStreetMapLayer: async () => (await Promise.resolve().then(() => nii)).default, OrientedImageryLayer: async () => (await Promise.resolve().then(() => EAr)).default, PointCloudLayer: async () => (await Promise.resolve().then(() => DAr)).default, RouteLayer: async () => (await Promise.resolve().then(() => mPr)).default, SceneLayer: async () => (await Promise.resolve().then(() => bPr)).default, StreamLayer: async () => (await Promise.resolve().then(() => xPr)).default, SubtypeGroupLayer: async () => (await Promise.resolve().then(() => MPr)).default, TileLayer: async () => (await Promise.resolve().then(() => uii)).default, UnknownLayer: async () => (await Promise.resolve().then(() => FPr)).default, UnsupportedLayer: async () => (await Promise.resolve().then(() => NPr)).default, VectorTileLayer: async () => (await Promise.resolve().then(() => JPr)).default, VoxelLayer: async () => (await Promise.resolve().then(() => lOr)).default, WFSLayer: async () => (await Promise.resolve().then(() => cOr)).default, WMSLayer: async () => (await Promise.resolve().then(() => Sii)).default, WMTSLayer: async () => (await Promise.resolve().then(() => MOr)).default, WebTileLayer: async () => (await Promise.resolve().then(() => rii)).default }; +function kRi(t) { + return a$e(t, "notes"); +} +function $Ri(t) { + return a$e(t, "markup"); +} +function BRi(t) { + return a$e(t, "route"); +} +function a$e(t, e) { + return !(!t.layerType || t.layerType !== "ArcGISFeatureLayer") && t.featureCollectionType === e; +} +async function v1(t, e) { + const { data: i } = await ir(t, { responseType: "json", query: { f: "json", ...e?.customParameters, token: e?.apiKey } }); + return i; +} +async function l$e(t, e) { + const i = await v1(t, e); + i.layers = i.layers.filter(sKe); + const r = { serviceJSON: i }; + if ((i.currentVersion ?? 0) < 10.5) + return r; + const n = await v1(t + "/layers", e); + return r.layersJSON = { layers: n.layers.filter(sKe), tables: n.tables }, r; +} +function sKe(t) { + return !t.type || t.type === "Feature Layer"; +} +function VCt(t) { + return { origin: "portal-item", url: ca(t.itemUrl), portal: t.portal || Ic.getDefault(), portalItem: t, readResourcePaths: [] }; +} +function jCt(t) { + return { origin: "portal-item", messages: [], writtenProperties: [], url: t.itemUrl ? ca(t.itemUrl) : null, portal: t.portal || Ic.getDefault(), portalItem: t }; +} +async function VRi(t, e) { + const i = t.instance.portalItem; + if (i && i.id) + return await i.load(e), jRi(t), GRi(t, e); +} +function jRi(t) { + const e = t.instance.portalItem; + if (!e?.type || !t.supportedTypes.includes(e.type)) + throw new ot("portal:invalid-layer-item-type", "Invalid layer item type '${type}', expected '${expectedType}'", { type: e?.type, expectedType: t.supportedTypes.join(", ") }); +} +async function GRi(t, e) { + const i = t.instance, r = i.portalItem; + if (!r) + return; + const { url: n, title: s } = r, o = VCt(r); + if (i.type === "group") + return i.read({ title: s }, o), URi(i, t); + n && i.read({ url: n }, o); + const a = await GCt(t, e); + return a && i.read(a, o), i.resourceReferences = { portalItem: r, paths: o.readResourcePaths ?? [] }, i.type !== "subtype-group" && i.read({ title: s }, o), aie(i, o); +} +async function URi(t, e) { + let i; + const { portalItem: r } = t; + if (!r) + return; + const n = r.type, s = e.layerModuleTypeMap, o = WG(r, "Oriented Imagery Layer") ?? !1; + switch (n) { + case "Feature Service": + i = o ? s.OrientedImageryLayer : s.FeatureLayer; + break; + case "Stream Service": + i = s.StreamLayer; + break; + case "Scene Service": + i = s.SceneLayer; + break; + case "Feature Collection": + i = s.FeatureLayer; + break; + default: + throw new ot("portal:unsupported-item-type-as-group", `The item type '${n}' is not supported as a 'IGroupLayer'`); + } + let [a, l] = await Promise.all([i(), GCt(e)]), c = () => a; + if (n === "Feature Service") { + if (l = r.url ? await u$e(l, r.url) : {}, P0e(l).length) { + const h = s.SubtypeGroupLayer, p = await h(); + c = (y) => y.layerType === "SubtypeGroupLayer" ? p : a; + } + return OOe(t, c, l, await XRi(r.url)); + } + return L$(l) > 0 ? OOe(t, c, l) : zRi(t, c); +} +async function zRi(t, e) { + const { portalItem: i } = t; + if (!i?.url) + return; + const r = await v1(i.url); + r && OOe(t, e, { layers: r.layers?.map(oKe), tables: r.tables?.map(oKe) }); +} +function oKe(t) { + return { id: t.id, name: t.name }; +} +function OOe(t, e, i, r) { + let n = i.layers || []; + const s = i.tables || []; + if (t.portalItem?.type === "Feature Collection" && (n.forEach((o) => { + o?.layerDefinition?.type === "Table" && s.push(o); + }), n = n.filter((o) => o?.layerDefinition?.type !== "Table")), "coverage" in i) { + const o = qRi(i); + o && t.add(o); + } + n.reverse().forEach((o) => { + const a = aKe(t, e(o), i, o, r?.(o)); + t.add(a); + }), s.reverse().forEach((o) => { + const a = aKe(t, e(o), i, o, r?.(o)); + t.tables.add(a); + }); +} +function aKe(t, e, i, r, n) { + const s = t.portalItem, o = new e({ portalItem: s.clone(), layerId: r.id }); + if ("sourceJSON" in o && (o.sourceJSON = n), o.type !== "subtype-group" && (o.sublayerTitleMode = "service-name"), s.type === "Feature Collection") { + const a = { origin: "portal-item", portal: s.portal || Ic.getDefault() }; + o.read(r, a); + const l = i.showLegend; + l != null && o.read({ showLegend: l }, a); + } + return o; +} +async function GCt(t, e) { + if (t.supportsData === !1) + return; + const i = t.instance, r = i.portalItem; + if (!r) + return; + let n = null; + try { + n = await r.fetchData("json", e); + } catch { + } + if (WRi(i)) { + let s = null, o = !0; + if (n && L$(n) > 0) { + if (i.layerId == null) { + const a = P0e(n); + i.layerId = i.type === "subtype-group" ? a?.[0] : c$e(n); + } + s = HRi(n, i), s && (L$(n) === 1 && (o = !1), n.showLegend != null && (s.showLegend = n.showLegend)); + } + return o && i.sublayerTitleMode !== "service-name" && (i.sublayerTitleMode = "item-title-and-service-name"), s; + } + return n; +} +async function u$e(t, e) { + if (t?.layers == null || t?.tables == null) { + const i = await v1(e); + (t = t || {}).layers = t.layers || i?.layers, t.tables = t.tables || i?.tables; + } + return t; +} +function c$e(t) { + const e = t.layers; + if (e && e.length) + return e[0].id; + const i = t.tables; + return i && i.length ? i[0].id : null; +} +function HRi(t, e) { + const { layerId: i } = e, r = t.layers?.find((n) => n.id === i) || t.tables?.find((n) => n.id === i); + return r && YRi(r, e) ? r : null; +} +function L$(t) { + return (t?.layers?.length ?? 0) + (t?.tables?.length ?? 0); +} +function WRi(t) { + return t.type !== "stream" && t.type !== "oriented-imagery" && "layerId" in t; +} +function qRi(t) { + const { coverage: e } = t; + if (!e) + return null; + const i = new URL(e); + if (e.toLowerCase().includes("item.html")) { + const r = i.searchParams.get("id"), n = i.origin; + return pu.fromPortalItem({ portalItem: new Ov({ id: r, url: n }) }); + } + if (Xpt(e)) + return pu.fromArcGISServerUrl({ url: e }); + throw new ot("portal:oriented-imagery-layer-coverage", "the provided coverage url couldn't be loaded as a layer"); +} +function P0e(t) { + const e = []; + return t?.layers?.forEach((i) => { + i.layerType === "SubtypeGroupLayer" && e.push(i.id); + }), e; +} +function YRi(t, e) { + return !(e.type === "feature" && "layerType" in t && t.layerType === "SubtypeGroupLayer" || e.type === "subtype-group" && !("layerType" in t)); +} +async function XRi(t) { + const { layersJSON: e } = await l$e(t); + if (!e) + return null; + const i = [...e.layers, ...e.tables]; + return (r) => i.find((n) => n.id === r.id); +} +const KRi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + getFirstLayerOrTableId: c$e, + getNumLayersAndTables: L$, + getSubtypeGroupLayerIds: P0e, + load: VRi, + preprocessFSItemData: u$e +}, Symbol.toStringTag, { value: "Module" })); +async function JRi(t) { + !t.portalItem || t.portalItem instanceof Ov || (t = { ...t, portalItem: new Ov(t.portalItem) }); + const e = await ZRi(t.portalItem); + return new e.constructor({ portalItem: t.portalItem, ...e.properties }); +} +async function ZRi(t) { + return await t.load(), QRi(await h$e(t)); +} +async function h$e(t) { + switch (t.type) { + case "Map Service": + return eMi(t); + case "Feature Service": + return tMi(t); + case "Feature Collection": + return rMi(t); + case "Scene Service": + return iMi(t); + case "Image Service": + return nMi(t); + case "Stream Service": + return sMi(); + case "Vector Tile Service": + return oMi(); + case "GeoJson": + return aMi(); + case "CSV": + return lMi(); + case "KML": + return uMi(); + case "WFS": + return cMi(); + case "WMTS": + return dMi(); + case "WMS": + return hMi(); + case "Feed": + return pMi(); + default: + throw new ot("portal:unknown-item-type", "Unknown item type '${type}'", { type: t.type }); + } +} +async function QRi(t) { + const e = Ww[t.className]; + return { constructor: await e(), properties: t.properties }; +} +async function eMi(t) { + return await mMi(t) ? { className: "TileLayer" } : { className: "MapImageLayer" }; +} +async function tMi(t) { + if (WG(t, "Oriented Imagery Layer")) + return fMi(t); + const e = await UCt(t); + if (typeof e == "object") { + const i = {}; + return e.id != null && (i.layerId = e.id), { className: e.className || "FeatureLayer", properties: i }; + } + return { className: "GroupLayer" }; +} +async function iMi(t) { + const e = await UCt(t); + if (typeof e == "object") { + const i = {}; + let r; + if (e.id != null ? (i.layerId = e.id, r = `${t.url}/layers/${e.id}`) : r = t.url, t.typeKeywords?.length) { + for (const s of Object.keys(KK)) + if (t.typeKeywords.includes(s)) + return { className: KK[s] }; + } + const n = await v1(r); + return { className: KK[n?.layerType] || "SceneLayer", properties: i }; + } + return e === !1 ? (await v1(t.url))?.layerType === "Voxel" ? { className: "VoxelLayer" } : { className: "GroupLayer" } : { className: "GroupLayer" }; +} +async function rMi(t) { + await t.load(); + const e = WG(t, "Map Notes"), i = WG(t, "Markup"); + if (e || i) + return { className: "MapNotesLayer" }; + if (WG(t, "Route Layer")) + return { className: "RouteLayer" }; + const r = await t.fetchData(); + return L$(r) === 1 ? { className: "FeatureLayer" } : { className: "GroupLayer" }; +} +async function nMi(t) { + await t.load(); + const e = t.typeKeywords?.map((o) => o.toLowerCase()) ?? []; + if (e.includes("elevation 3d layer")) + return { className: "ElevationLayer" }; + if (e.includes("tiled imagery")) + return { className: "ImageryTileLayer" }; + const i = (await t.fetchData())?.layerType; + if (i === "ArcGISTiledImageServiceLayer") + return { className: "ImageryTileLayer" }; + if (i === "ArcGISImageServiceLayer") + return { className: "ImageryLayer" }; + const r = await v1(t.url), n = r.cacheType?.toLowerCase(), s = r.capabilities?.toLowerCase().includes("tilesonly"); + return n === "map" || s ? { className: "ImageryTileLayer" } : { className: "ImageryLayer" }; +} +function sMi() { + return { className: "StreamLayer" }; +} +function oMi() { + return { className: "VectorTileLayer" }; +} +function aMi() { + return { className: "GeoJSONLayer" }; +} +function lMi() { + return { className: "CSVLayer" }; +} +function uMi() { + return { className: "KMLLayer" }; +} +function cMi() { + return { className: "WFSLayer" }; +} +function hMi() { + return { className: "WMSLayer" }; +} +function dMi() { + return { className: "WMTSLayer" }; +} +function pMi() { + return { className: "StreamLayer" }; +} +async function fMi(t) { + await t.load(); + const e = await t.fetchData(); + return e.coverage ? { className: "GroupLayer" } : { className: "OrientedImageryLayer", properties: e }; +} +async function mMi(t) { + return (await v1(t.url)).tileInfo; +} +async function UCt(t) { + const e = t.url; + if (!e || e.match(/\/\d+$/)) + return {}; + await t.load(); + const i = await t.fetchData(); + if (t.type === "Feature Service") { + const r = Pwe(await u$e(i, e)); + if (typeof r == "object") { + const n = P0e(i); + r.className = r.id != null && n.includes(r.id) ? "SubtypeGroupLayer" : "FeatureLayer"; + } + return r; + } + return L$(i) > 0 ? Pwe(i) : Pwe(await v1(e)); +} +function Pwe(t) { + return L$(t) === 1 && { id: c$e(t) }; +} +const gMi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + fromItem: JRi, + selectLayerClassPath: h$e +}, Symbol.toStringTag, { value: "Module" })); +async function zCt(t, e, i) { + if (!e) + return; + const r = []; + for (const s of e) { + const o = SMi(s, i); + s.layerType === "GroupLayer" ? r.push(IMi(o, s, i)) : r.push(o); + } + const n = await Nu(r); + for (const s of n) + s.value && t.add(s.value); +} +const yMi = { ArcGISDimensionLayer: "DimensionLayer", ArcGISFeatureLayer: "FeatureLayer", ArcGISImageServiceLayer: "ImageryLayer", ArcGISMapServiceLayer: "MapImageLayer", PointCloudLayer: "PointCloudLayer", ArcGISSceneServiceLayer: "SceneLayer", IntegratedMeshLayer: "IntegratedMeshLayer", OGCFeatureLayer: "OGCFeatureLayer", BuildingSceneLayer: "BuildingSceneLayer", ArcGISTiledElevationServiceLayer: "ElevationLayer", ArcGISTiledImageServiceLayer: "ImageryTileLayer", ArcGISTiledMapServiceLayer: "TileLayer", GroupLayer: "GroupLayer", GeoJSON: "GeoJSONLayer", WebTiledLayer: "WebTileLayer", CSV: "CSVLayer", VectorTileLayer: "VectorTileLayer", WFS: "WFSLayer", WMS: "WMSLayer", DefaultTileLayer: "TileLayer", KML: "KMLLayer", RasterDataLayer: "UnsupportedLayer", Voxel: "VoxelLayer", LineOfSightLayer: "LineOfSightLayer" }, vMi = { ArcGISTiledElevationServiceLayer: "ElevationLayer", DefaultTileLayer: "ElevationLayer", RasterDataElevationLayer: "UnsupportedLayer" }, _Mi = { ArcGISTiledMapServiceLayer: "TileLayer", ArcGISTiledImageServiceLayer: "ImageryTileLayer", OpenStreetMap: "OpenStreetMapLayer", WebTiledLayer: "WebTileLayer", VectorTileLayer: "VectorTileLayer", ArcGISImageServiceLayer: "UnsupportedLayer", WMS: "UnsupportedLayer", ArcGISMapServiceLayer: "UnsupportedLayer", ArcGISSceneServiceLayer: "SceneLayer", DefaultTileLayer: "TileLayer" }, bMi = { ArcGISAnnotationLayer: "UnsupportedLayer", ArcGISDimensionLayer: "UnsupportedLayer", ArcGISFeatureLayer: "FeatureLayer", ArcGISImageServiceLayer: "ImageryLayer", ArcGISImageServiceVectorLayer: "ImageryLayer", ArcGISMapServiceLayer: "MapImageLayer", ArcGISStreamLayer: "StreamLayer", ArcGISTiledImageServiceLayer: "ImageryTileLayer", ArcGISTiledMapServiceLayer: "TileLayer", BingMapsAerial: "BingMapsLayer", BingMapsRoad: "BingMapsLayer", BingMapsHybrid: "BingMapsLayer", CSV: "CSVLayer", DefaultTileLayer: "TileLayer", GeoRSS: "GeoRSSLayer", GeoJSON: "GeoJSONLayer", GroupLayer: "GroupLayer", KML: "KMLLayer", MediaLayer: "MediaLayer", OGCFeatureLayer: "OGCFeatureLayer", OrientedImageryLayer: "OrientedImageryLayer", SubtypeGroupLayer: "SubtypeGroupLayer", VectorTileLayer: "VectorTileLayer", WFS: "WFSLayer", WMS: "WMSLayer", WebTiledLayer: "WebTileLayer" }, wMi = { ArcGISFeatureLayer: "FeatureLayer" }, xMi = { ArcGISImageServiceLayer: "ImageryLayer", ArcGISImageServiceVectorLayer: "ImageryLayer", ArcGISMapServiceLayer: "MapImageLayer", ArcGISTiledImageServiceLayer: "ImageryTileLayer", ArcGISTiledMapServiceLayer: "TileLayer", OpenStreetMap: "OpenStreetMapLayer", VectorTileLayer: "VectorTileLayer", WebTiledLayer: "WebTileLayer", BingMapsAerial: "BingMapsLayer", BingMapsRoad: "BingMapsLayer", BingMapsHybrid: "BingMapsLayer", WMS: "WMSLayer", DefaultTileLayer: "TileLayer" }; +async function SMi(t, e) { + return CMi(await TMi(t, e), t, e); +} +async function CMi(t, e, i) { + const r = new t(); + return r.read(e, i.context), r.type === "group" && HCt(e) && await AMi(r, e, i.context), await aie(r, i.context), r; +} +async function TMi(t, e) { + const i = e.context, r = EMi(i); + let n = t.layerType || t.type; + !n && e && e.defaultLayerType && (n = e.defaultLayerType); + const s = r[n]; + let o = s ? Ww[s] : Ww.UnknownLayer; + if (WCt(t)) { + const a = i?.portal; + if (t.itemId) { + const l = new Ov({ id: t.itemId, portal: a }); + await l.load(); + const c = (await h$e(l)).className || "UnknownLayer"; + o = Ww[c]; + } + } else + n === "ArcGISFeatureLayer" ? kRi(t) || $Ri(t) ? o = Ww.MapNotesLayer : BRi(t) ? o = Ww.RouteLayer : HCt(t) && (o = Ww.GroupLayer) : t.wmtsInfo && t.wmtsInfo.url && t.wmtsInfo.layerIdentifier ? o = Ww.WMTSLayer : n === "WFS" && t.wfsInfo?.version !== "2.0.0" && (o = Ww.UnsupportedLayer); + return o(); +} +function HCt(t) { + return t.layerType !== "ArcGISFeatureLayer" || WCt(t) ? !1 : (t.featureCollection?.layers?.length ?? 0) > 1; +} +function WCt(t) { + return t.type === "Feature Collection"; +} +function EMi(t) { + let e; + if (t.origin === "web-scene") + switch (t.layerContainerType) { + case "basemap": + e = _Mi; + break; + case "ground": + e = vMi; + break; + default: + e = yMi; + } + else + switch (t.layerContainerType) { + case "basemap": + e = xMi; + break; + case "tables": + e = wMi; + break; + default: + e = bMi; + } + return e; +} +async function IMi(t, e, i) { + const r = new gr(), n = zCt(r, Array.isArray(e.layers) ? e.layers : [], i), s = await t; + if (await n, s.type === "group") + return s.layers.addMany(r), s; +} +async function AMi(t, e, i) { + const r = Ww.FeatureLayer, n = await r(), s = e.featureCollection, o = s?.showLegend, a = s?.layers?.map((l, c) => { + const h = new n(); + h.read(l, i); + const p = { ...i, ignoreDefaults: !0 }; + return h.read({ id: `${t.id}-sublayer-${c}`, visibility: e.visibleLayers?.includes(c) ?? !0 }, p), o != null && h.read({ showLegend: o }, p), h; + }); + t.layers.addMany(a ?? []); +} +const qCt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + populateOperationalLayers: zCt +}, Symbol.toStringTag, { value: "Module" })); +var At; +(function(t) { + t.AsyncNotEnabled = "AsyncNotEnabled", t.ModulesNotSupported = "ModulesNotSupported", t.CircularModules = "CircularModules", t.NeverReach = "NeverReach", t.UnsupportedHashType = "UnsupportedHashType", t.InvalidParameter = "InvalidParameter", t.UnexpectedToken = "UnexpectedToken", t.Unrecognised = "Unrecognised", t.UnrecognisedType = "UnrecognisedType", t.MaximumCallDepth = "MaximumCallDepth", t.BooleanConditionRequired = "BooleanConditionRequired", t.TypeNotAllowedInFeature = "TypeNotAllowedInFeature", t.KeyMustBeString = "KeyMustBeString", t.WrongNumberOfParameters = "WrongNumberOfParameters", t.CallNonFunction = "CallNonFunction", t.NoFunctionInTemplateLiteral = "NoFunctionInTemplateLiteral", t.NoFunctionInDictionary = "NoFunctionInDictionary", t.NoFunctionInArray = "NoFunctionInArray", t.AssignModuleFunction = "AssignModuleFunction", t.LogicExpressionOrAnd = "LogicExpressionOrAnd", t.LogicalExpressionOnlyBoolean = "LogicalExpressionOnlyBoolean", t.FuncionNotFound = "FunctionNotFound", t.InvalidMemberAccessKey = "InvalidMemberAccessKey", t.UnsupportedUnaryOperator = "UnsupportUnaryOperator", t.InvalidIdentifier = "InvalidIdentifier", t.MemberOfNull = "MemberOfNull", t.UnsupportedOperator = "UnsupportedOperator", t.Cancelled = "Cancelled", t.ModuleAccessorMustBeString = "ModuleAccessorMustBeString", t.ModuleExportNotFound = "ModuleExportNotFound", t.Immutable = "Immutable", t.OutOfBounds = "OutOfBounds", t.IllegalResult = "IllegalResult", t.FieldNotFound = "FieldNotFound", t.PortalRequired = "PortalRequired", t.LogicError = "LogicError", t.ArrayAccessorMustBeNumber = "ArrayAccessMustBeNumber", t.KeyAccessorMustBeString = "KeyAccessorMustBeString", t.WrongSpatialReference = "WrongSpatialReference"; +})(At || (At = {})); +const YCt = { [At.TypeNotAllowedInFeature]: "Feature attributes only support dates, numbers, strings, guids.", [At.LogicError]: "Logic error - {reason}", [At.NeverReach]: "Encountered unreachable logic", [At.AsyncNotEnabled]: "Async Arcade must be enabled for this script", [At.ModuleAccessorMustBeString]: "Module accessor must be a string", [At.ModuleExportNotFound]: "Module has no export with provided identifier", [At.ModulesNotSupported]: "Current profile does not support modules", [At.ArrayAccessorMustBeNumber]: "Array accessor must be a number", [At.FuncionNotFound]: "Function not found", [At.FieldNotFound]: "Key not found - {key}", [At.CircularModules]: "Circular module dependencies are not allowed", [At.Cancelled]: "Execution cancelled", [At.UnsupportedHashType]: "Type not supported in hash function", [At.IllegalResult]: "Value is not a supported return type", [At.PortalRequired]: "Portal is required", [At.InvalidParameter]: "Invalid parameter", [At.WrongNumberOfParameters]: "Call with wrong number of parameters", [At.Unrecognised]: "Unrecognised code structure", [At.UnrecognisedType]: "Unrecognised type", [At.WrongSpatialReference]: "Cannot work with geometry in this spatial reference. It is different to the execution spatial reference", [At.BooleanConditionRequired]: "Conditions must use booleans", [At.NoFunctionInDictionary]: "Dictionaries cannot contain functions.", [At.NoFunctionInArray]: "Arrays cannot contain functions.", [At.NoFunctionInTemplateLiteral]: "Template Literals do not expect functions by value.", [At.KeyAccessorMustBeString]: "Accessor must be a string", [At.KeyMustBeString]: "Object keys must be a string", [At.Immutable]: "Object is immutable", [At.InvalidParameter]: "Invalid parameter", [At.UnexpectedToken]: "Unexpected token", [At.MemberOfNull]: "Cannot access property of null object", [At.MaximumCallDepth]: "Exceeded maximum function depth", [At.OutOfBounds]: "Out of bounds", [At.InvalidIdentifier]: "Identifier not recognised", [At.FuncionNotFound]: "Function not found", [At.CallNonFunction]: "Expression is not a function", [At.InvalidMemberAccessKey]: "Cannot access value using a key of this type", [At.AssignModuleFunction]: "Cannot assign function to module variable", [At.UnsupportedUnaryOperator]: "Unsupported unary operator", [At.UnsupportedOperator]: "Unsupported operator", [At.LogicalExpressionOnlyBoolean]: "Logical expressions must be boolean", [At.LogicExpressionOrAnd]: "Logical expression can only be combined with || or &&" }; +let PMi = class extends Error { + constructor(...e) { + super(...e); + } +}, lKe = class XCt extends PMi { + constructor(e, i) { + super(d$e(i) + e.message, { cause: e }), this.loc = null, Error.captureStackTrace && Error.captureStackTrace(this, XCt), i && i.loc && (this.loc = i.loc); + } +}, Bt = class KCt extends Error { + constructor(e, i, r, n) { + super("Execution error - " + d$e(r) + Kz(YCt[i], n)), this.loc = null, this.declaredRootClass = "esri.arcade.arcadeexecutionerror", Error.captureStackTrace && Error.captureStackTrace(this, KCt), r && r.loc && (this.loc = r.loc); + } +}; +function d$e(t) { + return t && t.loc ? `Line : ${t.loc.start?.line}, ${t.loc.start?.column}: ` : ""; +} +let k0 = class JCt extends Error { + constructor(e, i, r, n) { + super("Compilation error - " + d$e(r) + Kz(YCt[i], n)), this.loc = null, this.declaredRootClass = "esri.arcade.arcadecompilationerror", Error.captureStackTrace && Error.captureStackTrace(this, JCt), r && r.loc && (this.loc = r.loc); + } +}, Owe = class ZCt extends Error { + constructor() { + super("Uncompilable code structures"), this.declaredRootClass = "esri.arcade.arcadeuncompilableerror", Error.captureStackTrace && Error.captureStackTrace(this, ZCt); + } +}; +function Kz(t, e) { + try { + if (!e) + return t; + for (const i in e) { + let r = e[i]; + r || (r = ""), t = t.replace("{" + i + "}", e[i]); + } + } catch { + } + return t; +} +function QCt(t, e, i) { + return i.declaredRootClass === "esri.arcade.arcadeexecutionerror" || i.declaredRootClass === "esri.arcade.arcadecompilationerror" ? i.loc === null && e && e.loc ? new lKe(i, { cause: i }) : i : (i.declaredRootClass === "esri.arcade.featureset.support.featureseterror" || i.declaredRootClass === "esri.arcade.featureset.support.sqlerror" || i.declaredRootClass, e && e.loc ? new lKe(i, { cause: i }) : i); +} +var L6; +(function(t) { + t.UnrecognisedUri = "UnrecognisedUri", t.UnsupportedUriProtocol = "UnsupportedUriProtocol"; +})(L6 || (L6 = {})); +const OMi = { [L6.UnrecognisedUri]: "Unrecognised uri - {uri}", [L6.UnsupportedUriProtocol]: "Unrecognised uri protocol" }; +let Rwe = class eTt extends Error { + constructor(e, i) { + super(Kz(OMi[e], i)), this.declaredRootClass = "esri.arcade.arcademoduleerror", Error.captureStackTrace && Error.captureStackTrace(this, eTt); + } +}, cD = class { +}; +var $pe; +cD.instance = new WS("Etc/UTC"), function(t) { + t.TimeZoneNotRecognised = "TimeZoneNotRecognised"; +}($pe || ($pe = {})); +const RMi = { [$pe.TimeZoneNotRecognised]: "Timezone identifier has not been recognised." }; +let MMi = class tTt extends Error { + constructor(e, i) { + super(Kz(RMi[e], i)), this.declaredRootClass = "esri.arcade.arcadedate.dateerror", Error.captureStackTrace && Error.captureStackTrace(this, tTt); + } +}, wl = class zm { + constructor(e) { + this._date = e, this.declaredRootClass = "esri.arcade.arcadedate"; + } + static fromParts(e = 0, i = 1, r = 1, n = 0, s = 0, o = 0, a = 0, l) { + if (isNaN(e) || isNaN(i) || isNaN(r) || isNaN(n) || isNaN(s) || isNaN(o) || isNaN(a)) + return null; + let c = 0; + const h = Qs.local(e, i).daysInMonth; + r < 1 && (c = r - 1, r = 1), r > h && (c = r - h, r = h); + let p = 0; + i > 12 ? (p = i - 12, i = 12) : i < 1 && (p = i - 1, i = 1); + let y = 0; + s > 59 ? (y = s - 59, s = 59) : s < 0 && (y = s, s = 0); + let v = 0; + o > 59 ? (v = o - 59, o = 59) : o < 0 && (v = o, o = 0); + let x = 0; + a > 999 ? (x = a - 999, a = 999) : a < 0 && (x = a, a = 0); + let I = Qs.fromObject({ day: r, year: e, month: i, hour: n, minute: s, second: o, millisecond: a }, { zone: sX(l) }); + return p !== 0 && (I = I.plus({ months: p })), c !== 0 && (I = I.plus({ days: c })), y !== 0 && (I = I.plus({ minutes: y })), v !== 0 && (I = I.plus({ seconds: v })), x !== 0 && (I = I.plus({ milliseconds: x })), new zm(I); + } + static get systemTimeZoneCanonicalName() { + return Intl.DateTimeFormat().resolvedOptions().timeZone ?? "system"; + } + static arcadeDateAndZoneToArcadeDate(e, i) { + const r = sX(i); + return e.isUnknownTimeZone || r === cD.instance ? zm.fromParts(e.year, e.monthJS + 1, e.day, e.hour, e.minute, e.second, e.millisecond, r) : new zm(e._date.setZone(i)); + } + static dateJSToArcadeDate(e) { + return new zm(Qs.fromJSDate(e, { zone: "system" })); + } + static dateJSAndZoneToArcadeDate(e, i = "system") { + return new zm(Qs.fromJSDate(e, { zone: i })); + } + static unknownEpochToArcadeDate(e) { + return new zm(Qs.fromMillis(e, { zone: cD.instance })); + } + static unknownDateJSToArcadeDate(e) { + return new zm(Qs.fromMillis(e.getTime(), { zone: cD.instance })); + } + static epochToArcadeDate(e, i = "system") { + return new zm(Qs.fromMillis(e, { zone: i })); + } + static dateTimeToArcadeDate(e) { + return new zm(e); + } + changeTimeZone(e) { + const i = sX(e); + return zm.dateTimeToArcadeDate(this._date.setZone(i)); + } + static dateTimeAndZoneToArcadeDate(e, i) { + const r = sX(i); + return e.zone === cD.instance || r === cD.instance ? zm.fromParts(e.year, e.month, e.day, e.hour, e.minute, e.second, e.millisecond, r) : new zm(e.setZone(r)); + } + static nowToArcadeDate(e) { + return new zm(Qs.fromJSDate(/* @__PURE__ */ new Date(), { zone: e })); + } + static nowUTCToArcadeDate() { + return new zm(Qs.utc()); + } + get isSystem() { + return this.timeZone === "system" || this.timeZone === zm.systemTimeZoneCanonicalName; + } + equals(e) { + return this.isSystem && e.isSystem ? this.toNumber() === e.toNumber() : this.isUnknownTimeZone === e.isUnknownTimeZone && this._date.equals(e._date); + } + get isUnknownTimeZone() { + return this._date.zone === cD.instance; + } + get isValid() { + return this._date.isValid; + } + get hour() { + return this._date.hour; + } + get second() { + return this._date.second; + } + get day() { + return this._date.day; + } + get dayOfWeekISO() { + return this._date.weekday; + } + get dayOfWeekJS() { + let e = this._date.weekday; + return e > 6 && (e = 0), e; + } + get millisecond() { + return this._date.millisecond; + } + get monthISO() { + return this._date.month; + } + get weekISO() { + return this._date.weekNumber; + } + get yearISO() { + return this._date.weekYear; + } + get monthJS() { + return this._date.month - 1; + } + get year() { + return this._date.year; + } + get minute() { + return this._date.minute; + } + get zone() { + return this._date.zone; + } + get timeZoneOffset() { + return this.isUnknownTimeZone ? 0 : this._date.offset; + } + get timeZone() { + if (this.isUnknownTimeZone) + return "unknown"; + if (this._date.zone.type === "system") + return "system"; + const e = this.zone; + return e.type === "fixed" ? e.fixed === 0 ? "utc" : e.formatOffset(0, "short") : e.name; + } + stringify() { + return JSON.stringify(this.toJSDate()); + } + plus(e) { + return new zm(this._date.plus(e)); + } + diff(e, i = "milliseconds") { + return this._date.diff(e._date, i)[i]; + } + toISOString(e) { + return e ? this._date.toISO({ suppressMilliseconds: !0, includeOffset: !this.isUnknownTimeZone }) : this._date.toISO({ includeOffset: !this.isUnknownTimeZone }); + } + toFormat(e, i) { + return this._date.toFormat(e, i); + } + toJSDate() { + return this._date.toJSDate(); + } + toSQLString() { + return "timestamp '" + this._date.toFormat("yyyy-LL-dd HH:mm:ss") + "'"; + } + toDateTime() { + return this._date; + } + toNumber() { + return this._date.toMillis(); + } + getTime() { + return this._date.toMillis(); + } + toUTC() { + return new zm(this._date.toUTC()); + } + toLocal() { + return new zm(this._date.toLocal()); + } + toString() { + return this.toISOString(!0); + } +}; +function sX(t) { + if (t instanceof Rz) + return t; + if (t.toLowerCase() === "system") + return "system"; + if (t.toLowerCase() === "utc") + return "utc"; + if (t.toLowerCase() === "unknown") + return cD.instance; + if (/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(t)) { + const i = xy.parseSpecifier("UTC" + (t.startsWith("+") || t.startsWith("-") ? "" : "+") + t); + if (i) + return i; + } + const e = WS.create(t); + if (!e.isValid) + throw new MMi($pe.TimeZoneNotRecognised); + return e; +} +let Mg = class { + constructor(e = []) { + this._elements = e; + } + length() { + return this._elements.length; + } + get(e) { + return this._elements[e]; + } + toArray() { + const e = []; + for (let i = 0; i < this.length(); i++) + e.push(this.get(i)); + return e; + } +}, QF = class { + constructor() { + } +}; +function e4(t, e, i) { + if (t instanceof QF && !(t instanceof Fx)) { + const r = new Fx(); + return r.fn = t, r.parameterEvaluator = i, r.context = e, r; + } + return t; +} +let vI = class extends QF { + constructor(e) { + super(), this.fn = e; + } + createFunction(e) { + return (...i) => this.fn(e, { preparsed: !0, arguments: i }); + } + call(e, i) { + return this.fn(e, i); + } + marshalledCall(e, i, r, n) { + return n(e, i, (s, o, a) => { + a = a.map((c) => c instanceof QF && !(c instanceof Fx) ? e4(c, e, n) : c); + const l = this.call(r, { args: a }); + return sf(l) ? l.then((c) => e4(c, r, n)) : l; + }); + } +}, Fx = class extends QF { + constructor() { + super(...arguments), this.fn = null, this.context = null; + } + createFunction(e) { + return this.fn.createFunction(this.context); + } + call(e, i) { + return this.fn.marshalledCall(e, i, this.context, this.parameterEvaluator); + } + marshalledCall(e, i, r) { + return this.fn.marshalledCall(e, i, this.context, this.parameterEvaluator); + } +}, x8 = class iTt extends Mg { + constructor(e, i, r, n, s, o) { + super(e), this._lazyPt = [], this._hasZ = !1, this._hasM = !1, this._spRef = i, this._hasZ = r, this._hasM = n, this._cacheId = s, this._partId = o; + } + get(e) { + if (this._lazyPt[e] === void 0) { + const i = this._elements[e]; + if (i === void 0) + return; + const r = this._hasZ, n = this._hasM; + let s = null; + s = r && !n ? new Xi(i[0], i[1], i[2], void 0, this._spRef) : n && !r ? new Xi(i[0], i[1], void 0, i[2], this._spRef) : r && n ? new Xi(i[0], i[1], i[2], i[3], this._spRef) : new Xi(i[0], i[1], this._spRef), s.cache._arcadeCacheId = this._cacheId.toString() + "-" + this._partId.toString() + "-" + e.toString(), this._lazyPt[e] = s; + } + return this._lazyPt[e]; + } + equalityTest(e) { + return e === this || e !== null && e instanceof iTt && e.getUniqueHash() === this.getUniqueHash(); + } + getUniqueHash() { + return this._cacheId.toString() + "-" + this._partId.toString(); + } +}, ROe = class rTt extends Mg { + constructor(e, i, r, n, s) { + super(e), this._lazyPath = [], this._hasZ = !1, this._hasM = !1, this._hasZ = r, this._hasM = n, this._spRef = i, this._cacheId = s; + } + get(e) { + if (this._lazyPath[e] === void 0) { + const i = this._elements[e]; + if (i === void 0) + return; + this._lazyPath[e] = new x8(i, this._spRef, this._hasZ, this._hasM, this._cacheId, e); + } + return this._lazyPath[e]; + } + equalityTest(e) { + return e === this || e !== null && e instanceof rTt && e.getUniqueHash() === this.getUniqueHash(); + } + getUniqueHash() { + return this._cacheId.toString(); + } +}; +const Mwe = { ar: [".", ","], bg: [",", " "], bs: [",", "."], ca: [",", "."], cs: [",", " "], da: [",", "."], de: [",", "."], "de-ch": [".", "’"], el: [",", "."], en: [".", ","], "en-au": [".", ","], es: [",", "."], "es-mx": [".", ","], et: [",", " "], fi: [",", " "], fr: [",", " "], "fr-ch": [",", " "], he: [".", ","], hi: [".", ",", "#,##,##0.###"], hr: [",", "."], hu: [",", " "], id: [",", "."], it: [",", "."], "it-ch": [".", "’"], ja: [".", ","], ko: [".", ","], lt: [",", " "], lv: [",", " "], mk: [",", "."], nb: [",", " "], nl: [",", "."], pl: [",", " "], pt: [",", "."], "pt-pt": [",", " "], ro: [",", "."], ru: [",", " "], sk: [",", " "], sl: [",", "."], sr: [",", "."], sv: [",", " "], th: [".", ","], tr: [",", "."], uk: [",", " "], vi: [",", "."], zh: [".", ","] }; +function nTt(t = Pv()) { + let e = (t = t.toLowerCase()) in Mwe; + if (!e) { + const s = t.split("-"); + s.length > 1 && s[0] in Mwe && (t = s[0], e = !0), e || (t = "en"); + } + const [i, r, n = "#,##0.###"] = Mwe[t]; + return { decimal: i, group: r, pattern: n }; +} +function DMi(t, e) { + const i = nTt((e = { ...e }).locale); + e.customs = i; + const r = e.pattern || i.pattern; + return isNaN(t) || Math.abs(t) === 1 / 0 ? null : FMi(t, r, e); +} +const sTt = /[#0,]*[#0](?:\.0*#*)?/; +function FMi(t, e, i) { + const r = (i = i || {}).customs.group, n = i.customs.decimal, s = e.split(";"), o = s[0]; + if ((e = s[t < 0 ? 1 : 0] || "-" + o).includes("%")) + t *= 100; + else if (e.includes("‰")) + t *= 1e3; + else { + if (e.includes("¤")) + throw new Error("currency notation not supported"); + if (e.includes("E")) + throw new Error("exponential notation not supported"); + } + const a = sTt, l = o.match(a); + if (!l) + throw new Error("unable to find a number expression in pattern: " + e); + return i.fractional === !1 && (i.places = 0), e.replace(a, LMi(t, l[0], { decimal: n, group: r, places: i.places, round: i.round })); +} +function LMi(t, e, i) { + (i = i || {}).places === !0 && (i.places = 0), i.places === 1 / 0 && (i.places = 6); + const r = e.split("."), n = typeof i.places == "string" && i.places.indexOf(","); + let s = i.places; + n ? s = i.places.substring(n + 1) : s >= 0 || (s = (r[1] || []).length), i.round < 0 || (t = Number(t.toFixed(Number(s)))); + const o = String(Math.abs(t)).split("."), a = o[1] || ""; + if (r[1] || i.places) { + n && (i.places = i.places.substring(0, n)); + const x = i.places !== void 0 ? i.places : r[1] && r[1].lastIndexOf("0") + 1; + x > a.length && (o[1] = a.padEnd(Number(x), "0")), s < a.length && (o[1] = a.substr(0, Number(s))); + } else + o[1] && o.pop(); + const l = r[0].replace(",", ""); + let c = l.indexOf("0"); + c !== -1 && (c = l.length - c, c > o[0].length && (o[0] = o[0].padStart(c, "0")), l.includes("#") || (o[0] = o[0].substr(o[0].length - c))); + let h, p, y = r[0].lastIndexOf(","); + if (y !== -1) { + h = r[0].length - y - 1; + const x = r[0].substr(0, y); + y = x.lastIndexOf(","), y !== -1 && (p = x.length - y - 1); + } + const v = []; + for (let x = o[0]; x; ) { + const I = x.length - h; + v.push(I > 0 ? x.substr(I) : x), x = I > 0 ? x.slice(0, I) : "", p && (h = p, p = void 0); + } + return o[0] = v.reverse().join(i.group || ","), o.join(i.decimal || "."); +} +function oTt(t) { + const e = nTt((t = t || {}).locale), i = t.pattern || e.pattern, r = e.group, n = e.decimal; + let s = 1; + if (i.includes("%")) + s /= 100; + else if (i.includes("‰")) + s /= 1e3; + else if (i.includes("¤")) + throw new Error("currency notation not supported"); + const o = i.split(";"); + return o.length === 1 && o.push("-" + o[0]), { regexp: eee(o, (l) => (l = "(?:" + d4e(l, ".") + ")").replace(sTt, (c) => { + const h = { signed: !1, separator: t.strict ? r : [r, ""], fractional: t.fractional, decimal: n, exponent: !1 }, p = c.split("."); + let y = t.places; + p.length === 1 && s !== 1 && (p[1] = "###"), p.length === 1 || y === 0 ? h.fractional = !1 : (y === void 0 && (y = t.pattern ? p[1].lastIndexOf("0") + 1 : 1 / 0), y && t.fractional == null && (h.fractional = !0), !t.places && y < p[1].length && (y += "," + p[1].length), h.places = y); + const v = p[0].split(","); + return v.length > 1 && (h.groupSize = v.pop().length, v.length > 1 && (h.groupSize2 = v.pop().length)), "(" + NMi(h) + ")"; + }), !0).replace(/[\xa0 ]/g, "[\\s\\xa0]"), group: r, decimal: n, factor: s }; +} +function aTt(t, e) { + const i = oTt(e), r = new RegExp("^" + i.regexp + "$").exec(t); + if (!r) + return NaN; + let n = r[1]; + if (!r[1]) { + if (!r[2]) + return NaN; + n = r[2], i.factor *= -1; + } + return n = n.replace(new RegExp("[" + i.group + "\\s\\xa0]", "g"), "").replace(i.decimal, "."), Number(n) * i.factor; +} +function NMi(t) { + "places" in (t = t || {}) || (t.places = 1 / 0), typeof t.decimal != "string" && (t.decimal = "."), "fractional" in t && !/^0/.test(String(t.places)) || (t.fractional = [!0, !1]), "exponent" in t || (t.exponent = [!0, !1]), "eSigned" in t || (t.eSigned = [!0, !1]); + const e = uKe(t), i = eee(t.fractional, (n) => { + let s = ""; + return n && t.places !== 0 && (s = "\\" + t.decimal, t.places === 1 / 0 ? s = "(?:" + s + "\\d+)?" : s += "\\d{" + t.places + "}"), s; + }, !0); + let r = e + i; + return i && (r = "(?:(?:" + r + ")|(?:" + i + "))"), r + eee(t.exponent, (n) => n ? "([eE]" + uKe({ signed: t.eSigned }) + ")" : ""); +} +function uKe(t) { + return "signed" in (t = t || {}) || (t.signed = [!0, !1]), "separator" in t ? "groupSize" in t || (t.groupSize = 3) : t.separator = "", eee(t.signed, (e) => e ? "[-+]" : "", !0) + eee(t.separator, (e) => { + if (!e) + return "(?:\\d+)"; + (e = d4e(e)) === " " ? e = "\\s" : e === " " && (e = "\\s\\xa0"); + const i = t.groupSize, r = t.groupSize2; + if (r) { + const n = "(?:0|[1-9]\\d{0," + (r - 1) + "}(?:[" + e + "]\\d{" + r + "})*[" + e + "]\\d{" + i + "})"; + return i - r > 0 ? "(?:" + n + "|(?:0|[1-9]\\d{0," + (i - 1) + "}))" : n; + } + return "(?:0|[1-9]\\d{0," + (i - 1) + "}(?:[" + e + "]\\d{" + i + "})*)"; + }, !0); +} +const eee = (t, e, i) => { + if (!(t instanceof Array)) + return e(t); + const r = []; + for (let n = 0; n < t.length; n++) + r.push(e(t[n])); + return kMi(r.join("|"), !!i); +}, kMi = (t, e) => "(" + (e ? "?:" : "") + t + ")"; +var wo, rc; +function Uue(t) { + return Uo.fromJSON(t.toJSON()); +} +function MOe(t) { + return t.toJSON ? t.toJSON() : t; +} +function $Mi(t) { + return typeof t == "string" || t instanceof String; +} +function BMi(t) { + return typeof t == "number"; +} +function jU(t) { + return t instanceof Date; +} +function tee(t) { + return t instanceof wl; +} +function VMi(t, e) { + return t === e || !(!jU(t) && !tee(t) || !jU(e) && !tee(e)) && t.getTime() === e.getTime(); +} +function jMi(t) { + if (t == null) + return null; + if (typeof t == "number") + return t; + switch (t.toLowerCase()) { + case "meters": + case "meter": + return 109404; + case "miles": + case "mile": + return 109439; + case "kilometers": + case "kilometer": + case "km": + return 109414; + } + return null; +} +function cKe(t) { + if (t == null) + return null; + switch (t.type) { + case "polygon": + case "multipoint": + case "polyline": + return t.extent; + case "point": + return new br({ xmin: t.x, ymin: t.y, xmax: t.x, ymax: t.y, spatialReference: t.spatialReference }); + case "extent": + return t; + } + return null; +} +function GMi(t) { + if (t == null) + return null; + if (typeof t == "number" || typeof t == "number") + return t; + switch (t.toLowerCase()) { + case "meters": + case "meter": + return 9001; + case "miles": + case "mile": + return 9093; + case "kilometers": + case "kilometer": + case "km": + return 9036; + } + return null; +} +(function(t) { + t[t.Standardised = 0] = "Standardised", t[t.StandardisedNoInterval = 1] = "StandardisedNoInterval", t[t.SqlServer = 2] = "SqlServer", t[t.Oracle = 3] = "Oracle", t[t.Postgres = 4] = "Postgres", t[t.PGDB = 5] = "PGDB", t[t.FILEGDB = 6] = "FILEGDB", t[t.NotEvaluated = 7] = "NotEvaluated"; +})(wo || (wo = {})), function(t) { + t[t.InFeatureSet = 0] = "InFeatureSet", t[t.NotInFeatureSet = 1] = "NotInFeatureSet", t[t.Unknown = 2] = "Unknown"; +}(rc || (rc = {})); +const p$e = 1e3, O0e = { point: "point", polygon: "polygon", polyline: "polyline", multipoint: "multipoint", extent: "extent", esriGeometryPoint: "point", esriGeometryPolygon: "polygon", esriGeometryPolyline: "polyline", esriGeometryMultipoint: "multipoint", esriGeometryEnvelope: "extent", envelope: "extent" }, Bpe = { point: "esriGeometryPoint", polygon: "esriGeometryPolygon", polyline: "esriGeometryPolyline", multipoint: "esriGeometryMultipoint", extent: "esriGeometryEnvelope", esriGeometryPoint: "esriGeometryPoint", esriGeometryPolygon: "esriGeometryPolygon", esriGeometryPolyline: "esriGeometryPolyline", esriGeometryMultipoint: "esriGeometryMultipoint", esriGeometryEnvelope: "esriGeometryEnvelope", envelope: "esriGeometryEnvelope" }, Vpe = { "small-integer": "esriFieldTypeSmallInteger", integer: "esriFieldTypeInteger", long: "esriFieldTypeLong", single: "esriFieldTypeSingle", double: "esriFieldTypeDouble", string: "esriFieldTypeString", date: "esriFieldTypeDate", oid: "esriFieldTypeOID", geometry: "esriFieldTypeGeometry", blob: "esriFieldTypeBlob", raster: "esriFieldTypeRaster", guid: "esriFieldTypeGUID", "global-id": "esriFieldTypeGlobalID", xml: "eesriFieldTypeXML", esriFieldTypeSmallInteger: "esriFieldTypeSmallInteger", esriFieldTypeInteger: "esriFieldTypeInteger", esriFieldTypeLong: "esriFieldTypeLong", esriFieldTypeSingle: "esriFieldTypeSingle", esriFieldTypeDouble: "esriFieldTypeDouble", esriFieldTypeString: "esriFieldTypeString", esriFieldTypeDate: "esriFieldTypeDate", esriFieldTypeOID: "esriFieldTypeOID", esriFieldTypeGeometry: "esriFieldTypeGeometry", esriFieldTypeBlob: "esriFieldTypeBlob", esriFieldTypeRaster: "esriFieldTypeRaster", esriFieldTypeGUID: "esriFieldTypeGUID", esriFieldTypeGlobalID: "esriFieldTypeGlobalID", esriFieldTypeXML: "eesriFieldTypeXML" }; +function DOe(t) { + return t === void 0 ? "" : t = (t = (t = t.replace(/\/featureserver\/[0-9]*/i, "/FeatureServer")).replace(/\/mapserver\/[0-9]*/i, "/MapServer")).split("?")[0]; +} +function UMi(t, e) { + e || (e = {}), typeof e == "function" && (e = { cmp: e }); + const i = typeof e.cycles == "boolean" && e.cycles, r = e.cmp && (n = e.cmp, function(o) { + return function(a, l) { + const c = { key: a, value: o[a] }, h = { key: l, value: o[l] }; + return n(c, h); + }; + }); + var n; + const s = []; + return function o(a) { + if (a && a.toJSON && typeof a.toJSON == "function" && (a = a.toJSON()), a === void 0) + return; + if (typeof a == "number") + return isFinite(a) ? "" + a : "null"; + if (typeof a != "object") + return JSON.stringify(a); + let l, c; + if (Array.isArray(a)) { + for (c = "[", l = 0; l < a.length; l++) + l && (c += ","), c += o(a[l]) || "null"; + return c + "]"; + } + if (a === null) + return "null"; + if (s.includes(a)) { + if (i) + return JSON.stringify("__cycle__"); + throw new TypeError("Converting circular structure to JSON"); + } + const h = s.push(a) - 1, p = Object.keys(a).sort(r && r(a)); + for (c = "", l = 0; l < p.length; l++) { + const y = p[l], v = o(a[y]); + v && (c && (c += ","), c += JSON.stringify(y) + ":" + v); + } + return s.splice(h, 1), "{" + c + "}"; + }(t); +} +let jie = class { + constructor(e) { + this.source = e; + } +}, lTt = class { + constructor(e) { + this.value = e; + } +}, uTt = class { + constructor(e) { + this.value = e; + } +}; +const _I = uTt, hd = lTt, en = { type: "VOID" }, xm = { type: "BREAK" }, jI = { type: "CONTINUE" }; +function ox(t, e, i) { + return e === "" || e == null || e === i || e === i ? t : t = t.split(e).join(i); +} +function du(t) { + return t instanceof QF; +} +function f$e(t) { + return t instanceof jie; +} +function t4(t) { + return !!wn(t) || !!il(t) || !!Mu(t) || !!ka(t) || t === null || t === en || typeof t == "number"; +} +function mn(t, e) { + return t === void 0 ? e : t; +} +function m$e(t) { + return t == null ? "" : Mn(t) || Es(t) ? "Array" : Mu(t) ? "Date" : wn(t) ? "String" : ka(t) ? "Boolean" : il(t) ? "Number" : t?.declaredClass === "esri.arcade.Attachment" ? "Attachment" : t?.declaredClass === "esri.arcade.Portal" ? "Portal" : t?.declaredClass === "esri.arcade.Dictionary" ? "Dictionary" : t instanceof jie ? "Module" : bu(t) ? "Feature" : t instanceof Xi ? "Point" : t instanceof xo ? "Polygon" : t instanceof xa ? "Polyline" : t instanceof Dd ? "Multipoint" : t instanceof br ? "Extent" : du(t) ? "Function" : tu(t) ? "FeatureSet" : R0e(t) ? "FeatureSetCollection" : t === en ? "" : typeof t == "number" && isNaN(t) ? "Number" : "Unrecognised Type"; +} +function wn(t) { + return typeof t == "string" || t instanceof String; +} +function ka(t) { + return typeof t == "boolean"; +} +function il(t) { + return typeof t == "number"; +} +function uP(t) { + return typeof t == "number" && isFinite(t) && Math.floor(t) === t; +} +function Mn(t) { + return t instanceof Array; +} +function bu(t) { + return t?.arcadeDeclaredClass === "esri.arcade.Feature"; +} +function tu(t) { + return t?.declaredRootClass === "esri.arcade.featureset.support.FeatureSet"; +} +function R0e(t) { + return t?.declaredRootClass === "esri.arcade.featureSetCollection"; +} +function Es(t) { + return t instanceof Mg; +} +function Mu(t) { + return t instanceof wl; +} +function FOe(t) { + return t != null && typeof t == "object"; +} +function jpe(t) { + return t instanceof Date; +} +function Zi(t, e, i, r, n) { + if (t.length < e || t.length > i) + throw new Bt(r, At.WrongNumberOfParameters, n); +} +function LOe(t) { + return t < 0 ? -Math.round(-t) : Math.round(t); +} +function NV() { + let t = Date.now(); + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { + const i = (t + 16 * Math.random()) % 16 | 0; + return t = Math.floor(t / 16), (e === "x" ? i : 3 & i | 8).toString(16); + }); +} +function g$e(t, e) { + return isNaN(t) || e == null || e === "" ? t.toString() : (e = ox(e, "‰", ""), e = ox(e, "¤", ""), DMi(t, { pattern: e })); +} +function M0e(t, e) { + return e == null || e === "" ? t.toISOString(!0) : t.toFormat(y$e(e), { locale: Pv(), numberingSystem: "latn" }); +} +function y$e(t) { + t = t.replace(/LTS|LT|LL?L?L?|l{1,4}/g, "[$&]"); + let e = ""; + const i = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + for (const r of t.match(i) || []) + switch (r) { + case "D": + e += "d"; + break; + case "DD": + e += "dd"; + break; + case "DDD": + e += "o"; + break; + case "d": + e += "c"; + break; + case "ddd": + e += "ccc"; + break; + case "dddd": + e += "cccc"; + break; + case "M": + e += "L"; + break; + case "MM": + e += "LL"; + break; + case "MMM": + e += "LLL"; + break; + case "MMMM": + e += "LLLL"; + break; + case "YY": + e += "yy"; + break; + case "Y": + case "YYYY": + e += "yyyy"; + break; + case "Q": + e += "q"; + break; + case "Z": + e += "ZZ"; + break; + case "ZZ": + e += "ZZZ"; + break; + case "S": + e += "'S'"; + break; + case "SS": + e += "'SS'"; + break; + case "SSS": + e += "u"; + break; + case "A": + case "a": + e += "a"; + break; + case "m": + case "mm": + case "h": + case "hh": + case "H": + case "HH": + case "s": + case "ss": + case "X": + case "x": + e += r; + break; + default: + r.length >= 2 && r.slice(0, 1) === "[" && r.slice(-1) === "]" ? e += `'${r.slice(1, -1)}'` : e += `'${r}'`; + } + return e; +} +function Fc(t, e, i) { + switch (i) { + case ">": + return t > e; + case "<": + return t < e; + case ">=": + return t >= e; + case "<=": + return t <= e; + } + return !1; +} +function D0e(t, e, i) { + if (t === null) { + if (e === null || e === en) + return Fc(null, null, i); + if (il(e)) + return Fc(0, e, i); + if (wn(e) || ka(e)) + return Fc(0, Di(e), i); + if (Mu(e)) + return Fc(0, e.toNumber(), i); + } + if (t === en) { + if (e === null || e === en) + return Fc(null, null, i); + if (il(e)) + return Fc(0, e, i); + if (wn(e) || ka(e)) + return Fc(0, Di(e), i); + if (Mu(e)) + return Fc(0, e.toNumber(), i); + } else if (il(t)) { + if (il(e)) + return Fc(t, e, i); + if (ka(e)) + return Fc(t, Di(e), i); + if (e === null || e === en) + return Fc(t, 0, i); + if (wn(e)) + return Fc(t, Di(e), i); + if (Mu(e)) + return Fc(t, e.toNumber(), i); + } else if (wn(t)) { + if (wn(e)) + return Fc(un(t), un(e), i); + if (Mu(e)) + return Fc(Di(t), e.toNumber(), i); + if (il(e)) + return Fc(Di(t), e, i); + if (e === null || e === en) + return Fc(Di(t), 0, i); + if (ka(e)) + return Fc(Di(t), Di(e), i); + } else if (Mu(t)) { + if (Mu(e)) + return Fc(t.toNumber(), e.toNumber(), i); + if (e === null || e === en) + return Fc(t.toNumber(), 0, i); + if (il(e)) + return Fc(t.toNumber(), e, i); + if (ka(e) || wn(e)) + return Fc(t.toNumber(), Di(e), i); + } else if (ka(t)) { + if (ka(e)) + return Fc(t, e, i); + if (il(e)) + return Fc(Di(t), Di(e), i); + if (Mu(e)) + return Fc(Di(t), e.toNumber(), i); + if (e === null || e === en) + return Fc(Di(t), 0, i); + if (wn(e)) + return Fc(Di(t), Di(e), i); + } + return !!Bv(t, e) && (i === "<=" || i === ">="); +} +function Bv(t, e) { + if (t === e || t === null && e === en || e === null && t === en) + return !0; + if (Mu(t) && Mu(e)) + return t.equals(e); + if (t instanceof ROe || t instanceof x8) + return t.equalityTest(e); + if (t instanceof Xi && e instanceof Xi) { + const i = t.cache._arcadeCacheId, r = e.cache._arcadeCacheId; + if (i != null) + return i === r; + } + return !!(FOe(t) && FOe(e) && (t._arcadeCacheId === e._arcadeCacheId && t._arcadeCacheId !== void 0 && t._arcadeCacheId !== null || t._underlyingGraphic === e._underlyingGraphic && t._underlyingGraphic !== void 0 && t._underlyingGraphic !== null)); +} +function un(t, e) { + if (wn(t)) + return t; + if (t === null) + return ""; + if (il(t)) + return g$e(t, e); + if (ka(t)) + return t.toString(); + if (Mu(t)) + return M0e(t, e); + if (t instanceof tn) + return JSON.stringify(t.toJSON()); + if (Mn(t)) { + const i = []; + for (let r = 0; r < t.length; r++) + i[r] = Gpe(t[r]); + return "[" + i.join(",") + "]"; + } + if (t instanceof Mg) { + const i = []; + for (let r = 0; r < t.length(); r++) + i[r] = Gpe(t.get(r)); + return "[" + i.join(",") + "]"; + } + return t !== null && typeof t == "object" && t.castToText !== void 0 ? t.castToText() : du(t) ? "object, Function" : t === en ? "" : f$e(t) ? "object, Module" : ""; +} +function CN(t) { + const e = []; + if (!Mn(t)) + return null; + if (t instanceof Mg) { + for (let i = 0; i < t.length(); i++) + e[i] = Di(t.get(i)); + return e; + } + for (let i = 0; i < t.length; i++) + e[i] = Di(t[i]); + return e; +} +function q_(t, e, i = !1) { + if (wn(t)) + return t; + if (t === null) + return ""; + if (il(t)) + return g$e(t, e); + if (ka(t)) + return t.toString(); + if (Mu(t)) + return M0e(t, e); + if (t instanceof tn) + return t instanceof br ? '{"xmin":' + t.xmin.toString() + ',"ymin":' + t.ymin.toString() + "," + (t.hasZ ? '"zmin":' + t.zmin.toString() + "," : "") + (t.hasM ? '"mmin":' + t.mmin.toString() + "," : "") + '"xmax":' + t.xmax.toString() + ',"ymax":' + t.ymax.toString() + "," + (t.hasZ ? '"zmax":' + t.zmax.toString() + "," : "") + (t.hasM ? '"mmax":' + t.mmax.toString() + "," : "") + '"spatialReference":' + NOe(t.spatialReference) + "}" : NOe(t.toJSON(), (r, n) => r.key === n.key ? 0 : r.key === "spatialReference" ? 1 : n.key === "spatialReference" || r.key < n.key ? -1 : r.key > n.key ? 1 : 0); + if (Mn(t)) { + const r = []; + for (let n = 0; n < t.length; n++) + r[n] = Gpe(t[n], i); + return "[" + r.join(",") + "]"; + } + if (t instanceof Mg) { + const r = []; + for (let n = 0; n < t.length(); n++) + r[n] = Gpe(t.get(n), i); + return "[" + r.join(",") + "]"; + } + return t !== null && typeof t == "object" && t.castToText !== void 0 ? t.castToText(i) : du(t) ? "object, Function" : t === en ? "" : f$e(t) ? "object, Module" : ""; +} +function Gpe(t, e = !1) { + if (t === null) + return "null"; + if (ka(t) || il(t) || wn(t)) + return JSON.stringify(t); + if (t instanceof tn || t instanceof Mg || t instanceof Array) + return q_(t, null, e); + if (Mu(t)) + return JSON.stringify(e ? t.getTime() : M0e(t, "")); + if (t !== null && typeof t == "object") { + if (t.castToText !== void 0) + return t.castToText(e); + } else if (t === en) + return "null"; + return "null"; +} +function Di(t, e) { + return il(t) ? t : t === null || t === "" ? 0 : Mu(t) ? NaN : ka(t) ? t ? 1 : 0 : Mn(t) || t === "" || t === void 0 ? NaN : e !== void 0 && wn(t) ? (e = ox(e, "‰", ""), e = ox(e, "¤", ""), aTt(t, { pattern: e })) : t === en ? 0 : Number(t); +} +function Zh(t, e) { + if (Mu(t)) + return t; + if (wn(t)) { + const i = zMi(t, e); + if (i) + return wl.dateTimeToArcadeDate(i); + } + return null; +} +function zMi(t, e) { + const i = / (\d\d)/, r = sX(e); + let n = Qs.fromISO(t, { zone: r }); + return n.isValid || i.test(t) && (t = t.replace(i, "T$1"), n = Qs.fromISO(t, { zone: e }), n.isValid) ? n : null; +} +function _b(t) { + return ka(t) ? t : wn(t) ? (t = t.toLowerCase()) === "true" : !!il(t) && t !== 0 && !isNaN(t); +} +function Qh(t, e) { + return ut(t) ? null : (t.spatialReference !== null && t.spatialReference !== void 0 || (t.spatialReference = e), t); +} +function TN(t) { + if (t === null) + return null; + if (t instanceof Xi) + return t.x === "NaN" || t.x === null || isNaN(t.x) ? null : t; + if (t instanceof xo) { + if (t.rings.length === 0) + return null; + for (const e of t.rings) + if (e.length > 0) + return t; + return null; + } + if (t instanceof xa) { + if (t.paths.length === 0) + return null; + for (const e of t.paths) + if (e.length > 0) + return t; + return null; + } + return t instanceof Dd ? t.points.length === 0 ? null : t : t instanceof br ? t.xmin === "NaN" || t.xmin === null || isNaN(t.xmin) ? null : t : null; +} +function v$e(t, e) { + if (!t || !t.domain) + return e; + let i = null; + if (t.field.type === "string" || t.field.type === "esriFieldTypeString") + e = un(e); + else { + if (e == null) + return null; + if (e === "") + return e; + e = Di(e); + } + for (let r = 0; r < t.domain.codedValues.length; r++) { + const n = t.domain.codedValues[r]; + n.code === e && (i = n); + } + return i === null ? e : i.name; +} +function _$e(t, e) { + if (!t || !t.domain) + return e; + let i = null; + e = un(e); + for (let r = 0; r < t.domain.codedValues.length; r++) { + const n = t.domain.codedValues[r]; + n.name === e && (i = n); + } + return i === null ? e : i.code; +} +function N6(t, e, i = null, r = null) { + if (!e || !e.fields) + return null; + let n, s, o = null; + for (let a = 0; a < e.fields.length; a++) { + const l = e.fields[a]; + l.name.toLowerCase() === t.toString().toLowerCase() && (o = l); + } + if (o === null) + throw new Bt(null, At.FieldNotFound, null, { key: t }); + return r === null && i && e.typeIdField && (r = i.hasField(e.typeIdField) ? i.field(e.typeIdField) : null), r != null && e.types.some((a) => a.id === r && (n = a.domains && a.domains[o.name], n && n.type === "inherited" && (n = hKe(o.name, e), s = !0), !0)), s || n || (n = hKe(t, e)), { field: o, domain: n }; +} +function hKe(t, e) { + let i; + return e.fields.some((r) => (r.name.toLowerCase() === t.toLowerCase() && (i = r.domain), !!i)), i; +} +function NOe(t, e) { + e || (e = {}), typeof e == "function" && (e = { cmp: e }); + const i = typeof e.cycles == "boolean" && e.cycles, r = e.cmp && (n = e.cmp, function(o) { + return function(a, l) { + const c = { key: a, value: o[a] }, h = { key: l, value: o[l] }; + return n(c, h); + }; + }); + var n; + const s = []; + return function o(a) { + if (a && a.toJSON && typeof a.toJSON == "function" && (a = a.toJSON()), a === void 0) + return; + if (typeof a == "number") + return isFinite(a) ? "" + a : "null"; + if (typeof a != "object") + return JSON.stringify(a); + let l, c; + if (Array.isArray(a)) { + for (c = "[", l = 0; l < a.length; l++) + l && (c += ","), c += o(a[l]) || "null"; + return c + "]"; + } + if (a === null) + return "null"; + if (s.includes(a)) { + if (i) + return JSON.stringify("__cycle__"); + throw new TypeError("Converting circular structure to JSON"); + } + const h = s.push(a) - 1, p = Object.keys(a).sort(r && r(a)); + for (c = "", l = 0; l < p.length; l++) { + const y = p[l], v = o(a[y]); + v && (c && (c += ","), c += JSON.stringify(y) + ":" + v); + } + return s.splice(h, 1), "{" + c + "}"; + }(t); +} +function ts(t) { + if (t === null) + return null; + const e = []; + for (const i of t) + i && i.arcadeDeclaredClass && i.arcadeDeclaredClass === "esri.arcade.Feature" ? e.push(i.geometry()) : e.push(i); + return e; +} +function GU(t, e) { + if (!(e instanceof Xi)) + throw new Bt(null, At.InvalidParameter, null); + t.push(e.hasZ ? e.hasM ? [e.x, e.y, e.z, e.m] : [e.x, e.y, e.z] : [e.x, e.y]); +} +function iee(t, e) { + if (Mn(t) || Es(t)) { + let i = !1, r = !1, n = [], s = e; + if (Mn(t)) { + for (const o of t) + GU(n, o); + n.length > 0 && (s = t[0].spatialReference, i = t[0].hasZ, r = t[0].hasM); + } else if (t instanceof x8) + n = t._elements, n.length > 0 && (i = t._hasZ, r = t._hasM, s = t.get(0).spatialReference); + else { + if (!Es(t)) + throw new Bt(null, At.InvalidParameter, null); + for (const o of t.toArray()) + GU(n, o); + n.length > 0 && (s = t.get(0).spatialReference, i = t.get(0).hasZ === !0, r = t.get(0).hasM === !0); + } + return n.length === 0 ? null : (kte(n, r, i) || (n = n.slice(0).reverse()), new xo({ rings: [n], spatialReference: s, hasZ: i, hasM: r })); + } + return t; +} +function gF(t, e) { + if (Mn(t) || Es(t)) { + let i = !1, r = !1, n = [], s = e; + if (Mn(t)) { + for (const o of t) + GU(n, o); + n.length > 0 && (s = t[0].spatialReference, i = t[0].hasZ === !0, r = t[0].hasM === !0); + } else if (t instanceof x8) + n = t._elements, n.length > 0 && (i = t._hasZ, r = t._hasM, s = t.get(0).spatialReference); + else if (Es(t)) { + for (const o of t.toArray()) + GU(n, o); + n.length > 0 && (s = t.get(0).spatialReference, i = t.get(0).hasZ === !0, r = t.get(0).hasM === !0); + } + return n.length === 0 ? null : new xa({ paths: [n], spatialReference: s, hasZ: i, hasM: r }); + } + return t; +} +function k6(t, e) { + if (Mn(t) || Es(t)) { + let i = !1, r = !1, n = [], s = e; + if (Mn(t)) { + for (const o of t) + GU(n, o); + n.length > 0 && (s = t[0].spatialReference, i = t[0].hasZ === !0, r = t[0].hasM === !0); + } else if (t instanceof x8) + n = t._elements, n.length > 0 && (i = t._hasZ, r = t._hasM, s = t.get(0).spatialReference); + else if (Es(t)) { + for (const o of t.toArray()) + GU(n, o); + n.length > 0 && (s = t.get(0).spatialReference, i = t.get(0).hasZ === !0, r = t.get(0).hasM === !0); + } + return n.length === 0 ? null : new Dd({ points: n, spatialReference: s, hasZ: i, hasM: r }); + } + return t; +} +function cTt(t, e = !1) { + const i = []; + if (t === null) + return i; + if (Mn(t) === !0) { + for (let r = 0; r < t.length; r++) { + const n = un(t[r]); + n === "" && e !== !0 || i.push(n); + } + return i; + } + if (t instanceof Mg) { + for (let r = 0; r < t.length(); r++) { + const n = un(t.get(r)); + n === "" && e !== !0 || i.push(n); + } + return i; + } + if (t4(t)) { + const r = un(t); + return r === "" && e !== !0 || i.push(r), i; + } + return []; +} +let Dwe = 0; +function GJ(t) { + return Dwe++, Dwe % 100 == 0 ? (Dwe = 0, new Promise((e) => { + setTimeout(() => { + e(t); + }, 0); + })) : t; +} +function F0e(t, e, i) { + switch (i) { + case "&": + return t & e; + case "|": + return t | e; + case "^": + return t ^ e; + case "<<": + return t << e; + case ">>": + return t >> e; + case ">>>": + return t >>> e; + } +} +function i4(t, e = null) { + return t == null ? null : ka(t) || il(t) || wn(t) ? t : t instanceof tn ? e?.keepGeometryType === !0 ? t : t.toJSON() : t instanceof Mg ? t.toArray().map((i) => i4(i, e)) : t instanceof Array ? t.map((i) => i4(i, e)) : jpe(t) ? t : Mu(t) ? t.toJSDate() : t !== null && typeof t == "object" && t.castAsJson !== void 0 ? t.castAsJson(e) : null; +} +async function HMi(t, e, i, r, n) { + const s = await b$e(t, e, i); + n[r] = s; +} +async function b$e(t, e = null, i = null) { + if (t instanceof Mg && (t = t.toArray()), t == null) + return null; + if (t4(t) || t instanceof tn || jpe(t) || Mu(t)) + return i4(t, i); + if (t instanceof Array) { + const r = [], n = []; + for (const s of t) + s === null || t4(s) || s instanceof tn || jpe(s) || Mu(s) ? n.push(i4(s, i)) : (n.push(null), r.push(HMi(s, e, i, n.length - 1, n))); + return r.length > 0 && await Promise.all(r), n; + } + return t !== null && typeof t == "object" && t.castAsJsonAsync !== void 0 ? t.castAsJsonAsync(e, i) : null; +} +function w$e(t, e, i) { + const r = t.fullSchema(); + return r === null || !r.fields ? null : N6(e, r, t, i); +} +function UJ(t) { + const e = t.fullSchema(); + return e === null ? null : e.fields && e.typeIdField ? { subtypeField: e.typeIdField, subtypes: e.types ? e.types.map((i) => ({ name: i.name, code: i.id })) : [] } : null; +} +function x$e(t, e, i, r) { + const n = t.fullSchema(); + if (n === null || !n.fields) + return null; + const s = N6(e, n, t, r); + if (i === void 0) + try { + i = t.field(e); + } catch { + return null; + } + return v$e(s, i); +} +function S$e(t, e, i, r) { + const n = t.fullSchema(); + if (n === null || !n.fields) + return null; + if (i === void 0) { + try { + i = t.field(e); + } catch { + return null; + } + return i; + } + return _$e(N6(e, n, t, r), i); +} +function Xo(t) { + return t?.timeReference?.timeZone ? t?.timeReference?.timeZone : "system"; +} +function C$e(t) { + const e = t.fullSchema(); + if (e === null || !e.fields) + return null; + const i = []; + for (const r of e.fields) + i.push(MOe(r)); + return { objectIdField: e.objectIdField, globalIdField: e.globalIdField, geometryType: Bpe[e.geometryType] === void 0 ? "" : Bpe[e.geometryType], fields: i, datesInUnknownTimezone: e.datesInUnknownTimezone === !0, preferredTimeReference: e.preferredTimeReference || null, editFieldsInfo: e.editFieldsInfo || null, timeInfo: e.timeInfo || null, dateFieldsTimeReference: e.dateFieldsTimeReference || null }; +} +const hTt = Object.freeze(Object.defineProperty({ __proto__: null, ImplicitResult: _I, ImplicitResultE: uTt, ReturnResult: hd, ReturnResultE: lTt, absRound: LOe, autoCastArrayOfPointsToMultiPoint: k6, autoCastArrayOfPointsToPolygon: iee, autoCastArrayOfPointsToPolyline: gF, autoCastFeatureToGeometry: ts, binaryOperator: F0e, breakResult: xm, castAsJson: i4, castAsJsonAsync: b$e, continueResult: jI, defaultTimeZone: Xo, defaultUndefined: mn, equalityTest: Bv, featureDomainCodeLookup: S$e, featureDomainValueLookup: x$e, featureFullDomain: w$e, featureSchema: C$e, featureSubtypes: UJ, fixNullGeometry: TN, fixSpatialReference: Qh, formatDate: M0e, formatNumber: g$e, generateUUID: NV, getDomain: N6, getDomainCode: _$e, getDomainValue: v$e, getType: m$e, greaterThanLessThan: D0e, isArray: Mn, isBoolean: ka, isDate: Mu, isFeature: bu, isFeatureSet: tu, isFeatureSetCollection: R0e, isFunctionParameter: du, isImmutableArray: Es, isInteger: uP, isJsDate: jpe, isModule: f$e, isNumber: il, isObject: FOe, isSimpleType: t4, isString: wn, multiReplace: ox, pcCheck: Zi, stableStringify: NOe, standardiseDateFormat: y$e, tick: GJ, toBoolean: _b, toDate: Zh, toNumber: Di, toNumberArray: CN, toString: un, toStringArray: cTt, toStringExplicit: q_, voidOperation: en }, Symbol.toStringTag, { value: "Module" })); +function Upe(t, e, i = !1) { + if (t == null) + return null; + if (il(t)) + return Di(t); + if (ka(t)) + return _b(t); + if (wn(t)) + return un(t); + if (Mu(t)) + return Zh(t, e); + if (Mn(t)) { + const n = []; + for (const s of t) + n.push(Upe(s, e, i)); + return n; + } + const r = new is(); + r.immutable = !1; + for (const n of Object.keys(t)) { + const s = t[n]; + s !== void 0 && r.setField(n, Upe(s, e, i)); + } + return r.immutable = i, r; +} +let is = class kOe { + constructor(e) { + this.declaredClass = "esri.arcade.Dictionary", this.attributes = null, this.plain = !1, this.immutable = !0, this.attributes = e instanceof kOe ? e.attributes : e ?? {}; + } + field(e) { + const i = e.toLowerCase(), r = this.attributes[e]; + if (r !== void 0) + return r; + for (const n in this.attributes) + if (n.toLowerCase() === i) + return this.attributes[n]; + throw new Bt(null, At.FieldNotFound, null, { key: e }); + } + setField(e, i) { + if (this.immutable) + throw new Bt(null, At.Immutable, null); + if (du(i)) + throw new Bt(null, At.NoFunctionInDictionary, null); + const r = e.toLowerCase(); + if (i instanceof Date && (i = wl.dateJSToArcadeDate(i)), this.attributes[e] === void 0) { + for (const n in this.attributes) + if (n.toLowerCase() === r) + return void (this.attributes[n] = i); + this.attributes[e] = i; + } else + this.attributes[e] = i; + } + hasField(e) { + const i = e.toLowerCase(); + if (this.attributes[e] !== void 0) + return !0; + for (const r in this.attributes) + if (r.toLowerCase() === i) + return !0; + return !1; + } + keys() { + let e = []; + for (const i in this.attributes) + e.push(i); + return e = e.sort(), e; + } + castToText(e = !1) { + let i = ""; + for (const r in this.attributes) { + i !== "" && (i += ","); + const n = this.attributes[r]; + n == null ? i += JSON.stringify(r) + ":null" : ka(n) || il(n) || wn(n) ? i += JSON.stringify(r) + ":" + JSON.stringify(n) : n instanceof tn ? i += JSON.stringify(r) + ":" + q_(n) : n instanceof Mg || n instanceof Array ? i += JSON.stringify(r) + ":" + q_(n, null, e) : n instanceof wl ? i += e ? JSON.stringify(r) + ":" + JSON.stringify(n.getTime()) : JSON.stringify(r) + ":" + n.stringify() : n !== null && typeof n == "object" && n.castToText !== void 0 && (i += JSON.stringify(r) + ":" + n.castToText(e)); + } + return "{" + i + "}"; + } + static convertObjectToArcadeDictionary(e, i, r = !0) { + const n = new kOe(); + n.immutable = !1; + for (const s in e) { + const o = e[s]; + o !== void 0 && n.setField(s.toString(), Upe(o, i)); + } + return n.immutable = r, n; + } + static convertJsonToArcade(e, i, r = !1) { + return Upe(e, i, r); + } + castAsJson(e = null) { + const i = {}; + for (let r in this.attributes) { + const n = this.attributes[r]; + n !== void 0 && (e?.keyTranslate && (r = e.keyTranslate(r)), i[r] = i4(n, e)); + } + return i; + } + async castDictionaryValueAsJsonAsync(e, i, r, n = null, s) { + const o = await b$e(r, n, s); + return e[i] = o, o; + } + async castAsJsonAsync(e = null, i = null) { + const r = {}, n = []; + for (let s in this.attributes) { + const o = this.attributes[s]; + i?.keyTranslate && (s = i.keyTranslate(s)), o !== void 0 && (t4(o) || o instanceof tn || o instanceof wl ? r[s] = i4(o, i) : n.push(this.castDictionaryValueAsJsonAsync(r, s, o, e, i))); + } + return n.length > 0 && await Promise.all(n), r; + } +}; +function WMi(t) { + return t?.timeZoneIANA ? t?.timeZoneIANA : t?.timeZone ? Pmt(t, "") : ""; +} +let zpe = class zue { + constructor() { + this.dateTimeReferenceMetaData = null, this._fieldTimeZoneIndex = {}, this._fieldIndex = null, this._ianaPreferred = null, this._ianaTimeInfo = null, this._ianaEditFields = null, this._ianaLayerDateFields = null; + } + static create(e, i) { + const r = new zue(); + return r.dateTimeReferenceMetaData = i, r._fieldIndex = e instanceof sg ? e : new sg(e), r; + } + static createFromLayer(e) { + if (!e) + return null; + if (!e.fieldsIndex) + return !e.declaredClass && e.fields ? zue.create(e.fields, e) : null; + const i = new zue(); + return i._fieldIndex = e.fieldsIndex, i.dateTimeReferenceMetaData = { timeInfo: e?.timeInfo?.toJSON() ?? null, editFieldsInfo: e?.editFieldsInfo?.toJSON() ?? null, dateFieldsTimeReference: e?.dateFieldsTimeReference?.toJSON() ?? null, preferredTimeReference: e?.preferredTimeReference?.toJSON() ?? null, datesInUnknownTimezone: e?.datesInUnknownTimezone === !0 }, i; + } + fieldTimeZone(e) { + const i = this._fieldIndex?.get(e); + if (!i || i.type !== "date" && i.type !== "esriFieldTypeDate") + return null; + const r = this._fieldTimeZoneIndex[i.name]; + if (r !== void 0) + return r; + const n = [{ field: this.dateTimeReferenceMetaData?.editFieldsInfo?.creationDateField, timeReference: this.dateTimeReferenceMetaData?.editFieldsInfo?.dateFieldsTimeReference, isunknown: this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0 }, { field: this.dateTimeReferenceMetaData?.editFieldsInfo?.editDateField, timeReference: this.dateTimeReferenceMetaData?.editFieldsInfo?.dateFieldsTimeReference, isunknown: this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0 }, { field: this.dateTimeReferenceMetaData?.timeInfo?.startTimeField, timeReference: this.dateTimeReferenceMetaData?.timeInfo?.timeReference, isunknown: this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0 }, { field: this.dateTimeReferenceMetaData?.timeInfo?.endTimeField, timeReference: this.dateTimeReferenceMetaData?.timeInfo?.timeReference, isunknown: this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0 }]; + for (const o of n) + if (o.field === i.name) { + const a = this.convertToIANA(o.timeReference, o.isunknown); + return this._fieldTimeZoneIndex[i.name] = a, a; + } + const s = this.convertToIANA(this.dateTimeReferenceMetaData?.dateFieldsTimeReference, this.dateTimeReferenceMetaData?.datesInUnknownTimezone); + return this._fieldTimeZoneIndex[i.name] = s, s; + } + convertToIANA(e, i) { + return i ? "unknown" : WMi(e); + } + get layerPreferredTimeZone() { + if (this._ianaPreferred !== null) + return this._ianaPreferred; + this._ianaPreferred = ""; + const e = this.dateTimeReferenceMetaData?.preferredTimeReference; + return this._ianaPreferred = this.convertToIANA(e, this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0), this._ianaPreferred; + } + get layerTimeInfoTimeZone() { + if (this._ianaTimeInfo !== null) + return this._ianaTimeInfo; + this._ianaTimeInfo = ""; + const e = this.dateTimeReferenceMetaData?.timeInfo?.timeReference; + return this._ianaTimeInfo = this.convertToIANA(e, !1), this._ianaTimeInfo; + } + get layerEditFieldsTimeZone() { + if (this._ianaEditFields !== null) + return this._ianaEditFields; + this._ianaEditFields = ""; + const e = this.dateTimeReferenceMetaData?.editFieldsInfo?.dateFieldsTimeReference; + return this._ianaEditFields = this.convertToIANA(e, this.dateTimeReferenceMetaData?.datesInUnknownTimezone), this._ianaEditFields; + } + get layerDateFieldsTimeZone() { + if (this._ianaLayerDateFields !== null) + return this._ianaLayerDateFields; + this._ianaLayerDateFields = ""; + const e = this.dateTimeReferenceMetaData?.dateFieldsTimeReference; + return this._ianaLayerDateFields = this.convertToIANA(e, this.dateTimeReferenceMetaData?.datesInUnknownTimezone === !0), this._ianaLayerDateFields; + } +}, ph = class $T { + constructor() { + this.arcadeDeclaredClass = "esri.arcade.Feature", this._optimizedGeomDefinition = null, this._geometry = null, this.attributes = null, this._layer = null, this._datesfixed = !0, this.dateTimeReferenceFieldIndex = null, this.contextTimeReference = null, this.immutable = !0, this._datefields = null, this.immutable = !0; + } + static createFromGraphic(e, i) { + const r = new $T(); + return r.contextTimeReference = i ?? null, r._geometry = _e(e.geometry) ? e.geometry : null, e.attributes === void 0 || e.attributes === null ? r.attributes = {} : r.attributes = e.attributes, e._sourceLayer ? (r._layer = e._sourceLayer, r._datesfixed = !1) : e._layer ? (r._layer = e._layer, r._datesfixed = !1) : e.layer && "fields" in e.layer ? (r._layer = e.layer, r._datesfixed = !1) : e.sourceLayer && "fields" in e.sourceLayer && (r._layer = e.sourceLayer, r._datesfixed = !1), r._layer && r._datesfixed === !1 && (r._layer.dateTimeReferenceFieldIndex !== void 0 ? r.dateTimeReferenceFieldIndex = r._layer.dateTimeReferenceFieldIndex : r.dateTimeReferenceFieldIndex = zpe.createFromLayer(r._layer)), r; + } + static createFromArcadeFeature(e) { + const i = new $T(); + return i._datesfixed = e._datesfixed, i.attributes = e.attributes, i._geometry = e._geometry, i._optimizedGeomDefinition = e._optimizedGeomDefinition, e._layer && (i._layer = e._layer), i.dateTimeReferenceFieldIndex = e.dateTimeReferenceFieldIndex, i.contextTimeReference = e.contextTimeReference, i; + } + static createFromOptimisedFeature(e, i, r) { + const n = new $T(); + return n._geometry = e.geometry ? { geometry: e.geometry } : null, n._optimizedGeomDefinition = r, n.attributes = e.attributes || {}, n._layer = i, n._datesfixed = !1, n; + } + static createFromArcadeDictionary(e) { + const i = new $T(); + return i.attributes = e.field("attributes"), i.attributes !== null && i.attributes instanceof is ? (i.attributes = i.attributes.attributes, i.attributes === null && (i.attributes = {})) : i.attributes = {}, i._geometry = e.field("geometry"), i._geometry !== null && (i._geometry instanceof is ? i._geometry = $T.parseGeometryFromDictionary(i._geometry) : i._geometry instanceof tn || (i._geometry = null)), i; + } + static createFromGraphicLikeObject(e, i, r = null, n) { + const s = new $T(); + return s.contextTimeReference = n ?? null, i === null && (i = {}), s.attributes = i, s._geometry = _e(e) ? e : null, s._layer = r, s._layer && (s._datesfixed = !1, s._layer.dateTimeReferenceFieldIndex !== void 0 ? s.dateTimeReferenceFieldIndex = s._layer.dateTimeReferenceFieldIndex : s.dateTimeReferenceFieldIndex = zpe.createFromLayer(s._layer)), s; + } + repurposeFromGraphicLikeObject(e, i, r = null) { + i === null && (i = {}), this.attributes = i, this._geometry = e || null, this._layer = r, this._layer ? this._datesfixed = !1 : this._datesfixed = !0; + } + get layerPreferredTimeZone() { + return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone ?? ""; + } + fieldSourceTimeZone(e) { + return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e) ?? ""; + } + castToText(e = !1) { + let i = ""; + this._datesfixed === !1 && this._fixDates(); + for (const r in this.attributes) { + i !== "" && (i += ","); + const n = this.attributes[r]; + n == null ? i += JSON.stringify(r) + ":null" : ka(n) || il(n) || wn(n) ? i += JSON.stringify(r) + ":" + JSON.stringify(n) : n instanceof tn ? i += JSON.stringify(r) + ":" + q_(n) : n instanceof Mg || n instanceof Array ? i += JSON.stringify(r) + ":" + q_(n, null, e) : n instanceof wl ? i += e ? JSON.stringify(r) + ":" + JSON.stringify(n.getTime()) : JSON.stringify(r) + ":" + n.stringify() : n !== null && typeof n == "object" && n.castToText !== void 0 && (i += JSON.stringify(r) + ":" + n.castToText(e)); + } + return '{"geometry":' + (this.geometry() === null ? "null" : q_(this.geometry())) + ',"attributes":{' + i + "}}"; + } + _fixDates() { + if (this._datefields !== null) + return this._datefields.length > 0 && this._fixDateFields(this._datefields), void (this._datesfixed = !0); + const e = [], i = this._layer.fields; + for (let r = 0; r < i.length; r++) { + const n = i[r], s = n.type; + s !== "date" && s !== "esriFieldTypeDate" || e.push(n.name); + } + this._datefields = e, e.length > 0 && this._fixDateFields(e), this._datesfixed = !0; + } + isUnknownDateTimeField(e) { + return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e) === "unknown"; + } + _fixDateFields(e) { + this.attributes = { ...this.attributes }; + const i = this.contextTimeReference?.timeZone ?? "system"; + for (let r = 0; r < e.length; r++) { + let n = this.attributes[e[r]]; + if (n !== null) + if (n === void 0) { + for (const s in this.attributes) + if (s.toLowerCase() === e[r].toLowerCase()) { + if (n = this.attributes[s], n !== null) { + const o = this.isUnknownDateTimeField(s); + Mu(n) ? this.attributes[s] = n : n instanceof Date ? this.attributes[s] = o ? wl.unknownDateJSToArcadeDate(n) : wl.dateJSAndZoneToArcadeDate(n, i) : this.attributes[s] = o ? wl.unknownEpochToArcadeDate(n) : wl.epochToArcadeDate(n, i); + } + break; + } + } else { + const s = this.isUnknownDateTimeField(e[r]); + Mu(n) ? this.attributes[e[r]] = n : n instanceof Date ? this.attributes[e[r]] = s ? wl.unknownDateJSToArcadeDate(n) : wl.dateJSAndZoneToArcadeDate(n, i) : this.attributes[e[r]] = s ? wl.unknownEpochToArcadeDate(n) : wl.epochToArcadeDate(n, i); + } + } + } + geometry() { + return this._geometry === null || this._geometry instanceof tn || (this._optimizedGeomDefinition ? (this._geometry = Sl(zx(this._geometry, this._optimizedGeomDefinition.geometryType, this._optimizedGeomDefinition.hasZ, this._optimizedGeomDefinition.hasM)), this._geometry.spatialReference = this._optimizedGeomDefinition.spatialReference) : this._geometry = Sl(this._geometry)), this._geometry; + } + field(e) { + this._datesfixed === !1 && this._fixDates(); + const i = this.attributes[e]; + if (i !== void 0) + return i; + const r = e.toLowerCase(); + for (const n in this.attributes) + if (n.toLowerCase() === r) + return this.attributes[n]; + if (this._hasFieldDefinition(r)) + return null; + throw new Bt(null, At.FieldNotFound, null, { key: e }); + } + _hasFieldDefinition(e) { + if (this._layer === null) + return !1; + for (let i = 0; i < this._layer.fields.length; i++) + if (this._layer.fields[i].name.toLowerCase() === e) + return !0; + return !1; + } + setField(e, i) { + if (this.immutable) + throw new Bt(null, At.Immutable, null); + if (i instanceof Date && (i = this.isUnknownDateTimeField(e) ? wl.unknownDateJSToArcadeDate(i) : wl.dateJSToArcadeDate(i)), t4(i) === !1) + throw new Bt(null, At.TypeNotAllowedInFeature, null); + const r = e.toLowerCase(); + if (this.attributes[e] === void 0) { + for (const n in this.attributes) + if (n.toLowerCase() === r) + return void (this.attributes[n] = i); + this.attributes[e] = i; + } else + this.attributes[e] = i; + } + hasField(e) { + const i = e.toLowerCase(); + if (this.attributes[e] !== void 0) + return !0; + for (const r in this.attributes) + if (r.toLowerCase() === i) + return !0; + return !!this._hasFieldDefinition(i); + } + keys() { + let e = []; + const i = {}; + for (const r in this.attributes) + e.push(r), i[r.toLowerCase()] = 1; + if (this._layer !== null) + for (let r = 0; r < this._layer.fields.length; r++) { + const n = this._layer.fields[r]; + i[n.name.toLowerCase()] !== 1 && e.push(n.name); + } + return e = e.sort(), e; + } + static parseGeometryFromDictionary(e) { + const i = $T._convertDictionaryToJson(e, !0); + return i.hasm !== void 0 && (i.hasM = i.hasm, delete i.hasm), i.hasz !== void 0 && (i.hasZ = i.hasz, delete i.hasz), i.spatialreference !== void 0 && (i.spatialReference = i.spatialreference, delete i.spatialreference), i.rings !== void 0 && (i.rings = this._fixPathArrays(i.rings, i.hasZ === !0, i.hasZ === !0)), i.paths !== void 0 && (i.paths = this._fixPathArrays(i.paths, i.hasZ === !0, i.hasM === !0)), i.points !== void 0 && (i.points = this._fixPointArrays(i.points, i.hasZ === !0, i.hasM === !0)), Sl(i); + } + static _fixPathArrays(e, i, r) { + const n = []; + if (e instanceof Array) + for (let s = 0; s < e.length; s++) + n.push(this._fixPointArrays(e[s], i, r)); + else if (e instanceof Mg) + for (let s = 0; s < e.length(); s++) + n.push(this._fixPointArrays(e.get(s), i, r)); + return n; + } + static _fixPointArrays(e, i, r) { + const n = []; + if (e instanceof Array) + for (let s = 0; s < e.length; s++) { + const o = e[s]; + o instanceof Xi ? i && r ? n.push([o.x, o.y, o.z, o.m]) : i ? n.push([o.x, o.y, o.z]) : r ? n.push([o.x, o.y, o.m]) : n.push([o.x, o.y]) : o instanceof Mg ? n.push(o.toArray()) : n.push(o); + } + else if (e instanceof Mg) + for (let s = 0; s < e.length(); s++) { + const o = e.get(s); + o instanceof Xi ? i && r ? n.push([o.x, o.y, o.z, o.m]) : i ? n.push([o.x, o.y, o.z]) : r ? n.push([o.x, o.y, o.m]) : n.push([o.x, o.y]) : o instanceof Mg ? n.push(o.toArray()) : n.push(o); + } + return n; + } + static _convertDictionaryToJson(e, i = !1) { + const r = {}; + for (const n in e.attributes) { + let s = e.attributes[n]; + s instanceof is && (s = $T._convertDictionaryToJson(s)), i ? r[n.toLowerCase()] = s : r[n] = s; + } + return r; + } + static parseAttributesFromDictionary(e) { + const i = {}; + for (const r in e.attributes) { + const n = e.attributes[r]; + if (!t4(n)) + throw new Bt(null, At.InvalidParameter, null); + i[r] = n; + } + return i; + } + static fromJson(e, i) { + let r = null; + e.geometry !== null && e.geometry !== void 0 && (r = Sl(e.geometry)); + const n = {}; + if (e.attributes !== null && e.attributes !== void 0) + for (const s in e.attributes) { + const o = e.attributes[s]; + if (o === null) + n[s] = o; + else { + if (!(wn(o) || il(o) || ka(o) || Mu(o))) + throw new Bt(null, At.InvalidParameter, null); + n[s] = o; + } + } + return $T.createFromGraphicLikeObject(r, n, null, i ?? null); + } + fullSchema() { + return this._layer; + } + gdbVersion() { + if (this._layer === null) + return ""; + const e = this._layer.gdbVersion; + return e === void 0 ? "" : e === "" && this._layer.capabilities && this._layer.capabilities.isVersioned ? "SDE.DEFAULT" : e; + } + castAsJson(e) { + const i = { attributes: {}, geometry: e?.keepGeometryType === !0 ? this.geometry() : this.geometry()?.toJSON() ?? null }; + for (const r in this.attributes) { + const n = this.attributes[r]; + n !== void 0 && (i.attributes[r] = i4(n, e)); + } + return i; + } + async castAsJsonAsync(e = null, i) { + return this.castAsJson(i); + } +}; +const dKe = { all: { min: 2, max: 2 }, none: { min: 2, max: 2 }, any: { min: 2, max: 2 }, reduce: { min: 2, max: 3 }, map: { min: 2, max: 2 }, filter: { min: 2, max: 2 }, fromcodepoint: { min: 1, max: -1 }, fromcharcode: { min: 1, max: -1 }, tocodepoint: { min: 1, max: 2 }, tocharcode: { min: 1, max: 2 }, concatenate: { min: 0, max: -1 }, expects: { min: 1, max: -1 }, getfeatureset: { min: 1, max: 2 }, week: { min: 1, max: 2 }, fromjson: { min: 1, max: 1 }, length3d: { min: 1, max: 2 }, tohex: { min: 1, max: 1 }, hash: { min: 1, max: 1 }, timezone: { min: 1, max: 1 }, timezoneoffset: { min: 1, max: 1 }, changetimezone: { min: 2, max: 2 }, isoweek: { min: 1, max: 1 }, isoweekday: { min: 1, max: 1 }, hasvalue: { min: 2, max: 2 }, isomonth: { min: 1, max: 1 }, isoyear: { min: 1, max: 1 }, resize: { min: 2, max: 3 }, slice: { min: 0, max: -1 }, splice: { min: 0, max: -1 }, push: { min: 2, max: 2 }, pop: { min: 1, max: 1 }, includes: { min: 2, max: 2 }, array: { min: 1, max: 2 }, front: { min: 1, max: 1 }, back: { min: 1, max: 1 }, insert: { min: 3, max: 3 }, erase: { min: 2, max: 2 }, split: { min: 2, max: 4 }, guid: { min: 0, max: 1 }, standardizeguid: { min: 2, max: 2 }, today: { min: 0, max: 0 }, angle: { min: 2, max: 3 }, bearing: { min: 2, max: 3 }, urlencode: { min: 1, max: 1 }, now: { min: 0, max: 0 }, timestamp: { min: 0, max: 0 }, day: { min: 1, max: 1 }, month: { min: 1, max: 1 }, year: { min: 1, max: 1 }, hour: { min: 1, max: 1 }, second: { min: 1, max: 1 }, millisecond: { min: 1, max: 1 }, minute: { min: 1, max: 1 }, weekday: { min: 1, max: 1 }, toutc: { min: 1, max: 1 }, tolocal: { min: 1, max: 1 }, date: { min: 0, max: 8 }, datediff: { min: 2, max: 4 }, dateadd: { min: 2, max: 3 }, trim: { min: 1, max: 1 }, text: { min: 1, max: 2 }, left: { min: 2, max: 2 }, right: { min: 2, max: 2 }, mid: { min: 2, max: 3 }, upper: { min: 1, max: 1 }, proper: { min: 1, max: 2 }, lower: { min: 1, max: 1 }, find: { min: 2, max: 3 }, iif: { min: 3, max: 3 }, decode: { min: 2, max: -1 }, when: { min: 2, max: -1 }, defaultvalue: { min: 2, max: 2 }, isempty: { min: 1, max: 1 }, domaincode: { min: 2, max: 4 }, domainname: { min: 2, max: 4 }, polygon: { min: 1, max: 1 }, point: { min: 1, max: 1 }, polyline: { min: 1, max: 1 }, extent: { min: 1, max: 1 }, multipoint: { min: 1, max: 1 }, ringisclockwise: { min: 1, max: 1 }, geometry: { min: 1, max: 1 }, count: { min: 0, max: -1 }, number: { min: 1, max: 2 }, acos: { min: 1, max: 1 }, asin: { min: 1, max: 1 }, atan: { min: 1, max: 1 }, atan2: { min: 2, max: 2 }, ceil: { min: 1, max: 2 }, floor: { min: 1, max: 2 }, round: { min: 1, max: 2 }, cos: { min: 1, max: 1 }, exp: { min: 1, max: 1 }, log: { min: 1, max: 1 }, min: { min: 0, max: -1 }, constrain: { min: 3, max: 3 }, console: { min: 0, max: -1 }, max: { min: 0, max: -1 }, pow: { min: 2, max: 2 }, random: { min: 0, max: 0 }, sqrt: { min: 1, max: 1 }, sin: { min: 1, max: 1 }, tan: { min: 1, max: 1 }, abs: { min: 1, max: 1 }, isnan: { min: 1, max: 1 }, stdev: { min: 0, max: -1 }, average: { min: 0, max: -1 }, mean: { min: 0, max: -1 }, sum: { min: 0, max: -1 }, variance: { min: 0, max: -1 }, distinct: { min: 0, max: -1 }, first: { min: 1, max: 1 }, top: { min: 2, max: 2 }, boolean: { min: 1, max: 1 }, dictionary: { min: 0, max: -1 }, typeof: { min: 1, max: 1 }, reverse: { min: 1, max: 1 }, replace: { min: 3, max: 4 }, sort: { min: 1, max: 2 }, feature: { min: 1, max: -1 }, haskey: { min: 2, max: 2 }, indexof: { min: 2, max: 2 }, disjoint: { min: 2, max: 2 }, intersects: { min: 2, max: 2 }, touches: { min: 2, max: 2 }, crosses: { min: 2, max: 2 }, within: { min: 2, max: 2 }, contains: { min: 2, max: 2 }, overlaps: { min: 2, max: 2 }, equals: { min: 2, max: 2 }, relate: { min: 3, max: 3 }, intersection: { min: 2, max: 2 }, union: { min: 1, max: 2 }, difference: { min: 2, max: 2 }, symmetricdifference: { min: 2, max: 2 }, clip: { min: 2, max: 2 }, cut: { min: 2, max: 2 }, area: { min: 1, max: 2 }, areageodetic: { min: 1, max: 2 }, length: { min: 1, max: 2 }, lengthgeodetic: { min: 1, max: 2 }, distancegeodetic: { min: 2, max: 3 }, distance: { min: 2, max: 3 }, densify: { min: 2, max: 3 }, densifygeodetic: { min: 2, max: 3 }, generalize: { min: 2, max: 4 }, buffer: { min: 2, max: 3 }, buffergeodetic: { min: 2, max: 3 }, offset: { min: 2, max: 6 }, rotate: { min: 2, max: 3 }, issimple: { min: 1, max: 1 }, simplify: { min: 1, max: 1 }, convexhull: { min: 1, max: 1 }, centroid: { min: 1, max: 1 }, isselfintersecting: { min: 1, max: 1 }, multiparttosinglepart: { min: 1, max: 1 }, setgeometry: { min: 2, max: 2 }, portal: { min: 1, max: 1 }, getuser: { min: 0, max: 2 }, subtypes: { min: 1, max: 1 }, subtypecode: { min: 1, max: 1 }, subtypename: { min: 1, max: 1 }, domain: { min: 2, max: 3 }, convertdirection: { min: 3, max: 3 }, sqltimestamp: { min: 1, max: 3 }, schema: { min: 1, max: 1 } }, L0e = { functionDefinitions: /* @__PURE__ */ new Map(), constantDefinitions: /* @__PURE__ */ new Map() }, N0e = { functionDefinitions: /* @__PURE__ */ new Map(), constantDefinitions: /* @__PURE__ */ new Map() }; +for (const t of ["pi", "infinity"]) + N0e.constantDefinitions.set(t, { type: "constant" }), L0e.constantDefinitions.set(t, { type: "constant" }); +N0e.constantDefinitions.set("textformatting", { type: "namespace", key: "textformatting", members: [{ key: "backwardslash", type: "constant" }, { key: "doublequote", type: "constant" }, { key: "forwardslash", type: "constant" }, { key: "tab", type: "constant" }, { key: "singlequote", type: "constant" }, { key: "newline", type: "constant" }] }), L0e.constantDefinitions.set("textformatting", { type: "namespace", key: "textformatting", members: [{ key: "backwardslash", type: "constant" }, { key: "tab", type: "constant" }, { key: "singlequote", type: "constant" }, { key: "doublequote", type: "constant" }, { key: "forwardslash", type: "constant" }, { key: "newline", type: "constant" }] }); +for (const t in dKe) { + const e = dKe[t]; + N0e.functionDefinitions.set(t, { overloads: [{ type: "function", parametersInfo: { min: e.min, max: e.max } }] }), L0e.functionDefinitions.set(t, { overloads: [{ type: "function", parametersInfo: { min: e.min, max: e.max } }] }); +} +const qMi = ["featureset", "featuresetbyid", "featuresetbyname", "featuresetbyassociation", "featuresetbyrelationshipname", "featuresetbyurl", "getfeatureset", "getuser", "attachments", "featuresetbyportalitem"], YMi = ["disjoint", "intersects", "touches", "crosses", "within", "contains", "overlaps", "equals", "relate", "intersection", "union", "difference", "symmetricdifference", "clip", "cut", "area", "areageodetic", "length", "length3d", "lengthgeodetic", "distance", "distancegeodetic", "densify", "densifygeodetic", "generalize", "buffer", "buffergeodetic", "offset", "rotate", "issimple", "convexhull", "simplify", "multiparttosinglepart"]; +function pKe(t) { + return typeof t == "string" || t instanceof String; +} +function Hpe(t, e) { + const i = e === "sync" ? L0e : N0e; + i.functionDefinitions.has(t.name.toLowerCase()) ? i.functionDefinitions.get(t.name.toLowerCase())?.overloads.push({ type: "function", parametersInfo: { min: t.min, max: t.max } }) : i.functionDefinitions.set(t.name.toLowerCase(), { overloads: [{ type: "function", parametersInfo: { min: t.min, max: t.max } }] }); +} +function EA(t, e) { + if (t) + for (const i of t) + Bu(i, e); +} +function Bu(t, e) { + if (t && e(t) !== !1) + switch (t.type) { + case "ImportDeclaration": + EA(t.specifiers, e), Bu(t.source, e); + break; + case "ExportNamedDeclaration": + Bu(t.declaration, e); + break; + case "ArrayExpression": + EA(t.elements, e); + break; + case "AssignmentExpression": + case "BinaryExpression": + case "LogicalExpression": + Bu(t.left, e), Bu(t.right, e); + break; + case "BlockStatement": + case "Program": + EA(t.body, e); + break; + case "BreakStatement": + case "ContinueStatement": + case "EmptyStatement": + case "Identifier": + case "Literal": + break; + case "CallExpression": + Bu(t.callee, e), EA(t.arguments, e); + break; + case "ExpressionStatement": + Bu(t.expression, e); + break; + case "ForInStatement": + Bu(t.left, e), Bu(t.right, e), Bu(t.body, e); + break; + case "ForStatement": + Bu(t.init, e), Bu(t.test, e), Bu(t.update, e), Bu(t.body, e); + break; + case "WhileStatement": + Bu(t.test, e), Bu(t.body, e); + break; + case "FunctionDeclaration": + Bu(t.id, e), EA(t.params, e), Bu(t.body, e); + break; + case "IfStatement": + Bu(t.test, e), Bu(t.consequent, e), Bu(t.alternate, e); + break; + case "MemberExpression": + Bu(t.object, e), Bu(t.property, e); + break; + case "ObjectExpression": + EA(t.properties, e); + break; + case "Property": + Bu(t.key, e), Bu(t.value, e); + break; + case "ReturnStatement": + case "UnaryExpression": + case "UpdateExpression": + Bu(t.argument, e); + break; + case "VariableDeclaration": + EA(t.declarations, e); + break; + case "VariableDeclarator": + Bu(t.id, e), Bu(t.init, e); + break; + case "TemplateLiteral": + EA(t.expressions, e), EA(t.quasis, e); + } +} +function dTt(t, e) { + let i = !1; + const r = e.toLowerCase(); + return Bu(t, (n) => !i && (n.type === "Identifier" && n.name && n.name.toLowerCase() === r && (i = !0), !0)), i; +} +function pTt(t) { + const e = []; + return Bu(t, (i) => (i.type === "ImportDeclaration" && i.source && i.source.value && e.push({ libname: i.specifiers[0].local.name.toLowerCase(), source: i.source.value }), !0)), e; +} +function XMi(t, e) { + let i = !1; + const r = e.toLowerCase(); + return Bu(t, (n) => !i && (n.type !== "CallExpression" || n.callee.type !== "Identifier" || !n.callee.name || n.callee.name.toLowerCase() !== r || (i = !0, !1))), i; +} +function KMi(t) { + const e = []; + return Bu(t, (i) => i.type !== "MemberExpression" || i.object.type !== "Identifier" || (i.computed === !1 && i.object && i.object.name && i.property && i.property.type === "Identifier" && i.property.name ? e.push(i.object.name.toLowerCase() + "." + i.property.name.toLowerCase()) : i.object && i.object.name && i.property && i.property.type === "Literal" && typeof i.property.value == "string" && e.push(i.object.name.toLowerCase() + "." + i.property.value?.toString().toLowerCase()), !1)), e; +} +function JMi(t) { + const e = []; + return Bu(t, (i) => { + if (i.type === "CallExpression") { + if (i.callee.type === "Identifier" && i.callee.name.toLowerCase() === "expects") { + let r = ""; + for (let n = 0; n < (i.arguments || []).length; n++) + n === 0 ? i.arguments[n].type === "Identifier" && (r = i.arguments[n].name.toLowerCase()) : r && i.arguments[n].type === "Literal" && pKe(i.arguments[n].value) && e.push(r + "." + i.arguments[n].value.toLowerCase()); + return !1; + } + if (i.callee.type === "Identifier" && ["domainname", "domaincode", "domain", "haskey"].includes(i.callee.name.toLowerCase()) && i.arguments.length >= 2) { + let r = ""; + return i.arguments[0].type === "Identifier" && (r = i.arguments[0].name.toLowerCase()), r && i.arguments[1].type === "Literal" && pKe(i.arguments[1].value) && e.push(r + "." + i.arguments[1].value.toLowerCase()), !1; + } + } + return i.type !== "MemberExpression" || i.object.type !== "Identifier" || (i.computed === !1 && i.object && i.object.name && i.property && i.property.type === "Identifier" && i.property.name ? e.push(i.object.name.toLowerCase() + "." + i.property.name.toLowerCase()) : i.object && i.object.name && i.property && i.property.type === "Literal" && typeof i.property.value == "string" && e.push(i.object.name.toLowerCase() + "." + i.property.value?.toString().toLowerCase()), !1); + }), e; +} +function $Oe(t) { + const e = []; + return Bu(t, (i) => (i.type === "CallExpression" && i.callee.type === "Identifier" && e.push(i.callee.name.toLowerCase()), !0)), e; +} +function Gie(t, e = []) { + let i = null; + if (t.usesFeatureSet === void 0) { + i === null && (i = $Oe(t)), t.usesFeatureSet = !1; + for (let r = 0; r < i.length; r++) + qMi.includes(i[r]) && (t.usesFeatureSet = !0, t.isAsync = !0); + if (t.usesFeatureSet === !1 && e && e.length > 0) { + for (const r of e) + if (dTt(t, r)) { + t.usesFeatureSet = !0, t.isAsync = !0; + break; + } + } + } + if (t.usesModules === void 0 && (t.usesModules = !1, pTt(t).length > 0 && (t.usesModules = !0)), t.usesGeometry === void 0) { + t.usesGeometry = !1, i === null && (i = $Oe(t)); + for (let r = 0; r < i.length; r++) + YMi.includes(i[r]) && (t.usesGeometry = !0); + } +} +function ZMi(t) { + function e(a, l, c) { + if (a instanceof Mg) + return a.toArray(); + if (Mn(a)) + return a; + throw new Bt(l, At.InvalidParameter, c); + } + function i(a, l) { + const c = a.length, h = Math.floor(c / 2); + return c === 0 ? [] : c === 1 ? [a[0]] : r(i(a.slice(0, h), l), i(a.slice(h, c), l), l); + } + function r(a, l, c) { + const h = []; + for (; a.length > 0 || l.length > 0; ) + if (a.length > 0 && l.length > 0) { + let p = c(a[0], l[0]); + isNaN(p) && (p = 0), p <= 0 ? (h.push(a[0]), a = a.slice(1)) : (h.push(l[0]), l = l.slice(1)); + } else + a.length > 0 ? (h.push(a[0]), a = a.slice(1)) : l.length > 0 && (h.push(l[0]), l = l.slice(1)); + return h; + } + async function n(a, l) { + const c = a.length, h = Math.floor(c / 2); + if (c === 0) + return []; + if (c === 1) + return [a[0]]; + const p = [await n(a.slice(0, h), l), await n(a.slice(h, c), l)]; + return s(p[0], p[1], l, []); + } + async function s(a, l, c, h) { + const p = h; + if (!(a.length > 0 || l.length > 0)) + return h; + if (a.length > 0 && l.length > 0) { + let y = await c(a[0], l[0]); + return isNaN(y) && (y = 1), y <= 0 ? (p.push(a[0]), a = a.slice(1)) : (p.push(l[0]), l = l.slice(1)), s(a, l, c, h); + } + return a.length > 0 ? (p.push(a[0]), s(a = a.slice(1), l, c, h)) : l.length > 0 ? (p.push(l[0]), s(a, l = l.slice(1), c, h)) : void 0; + } + function o(a, l, c, h) { + Zi(c, 1, 2, a, l); + let p = c[0]; + if (Es(p) && (p = p.toArray()), Mn(p) === !1) + throw new Bt(a, At.InvalidParameter, l); + if (c.length > 1) { + if (du(c[1]) === !1) + throw new Bt(a, At.InvalidParameter, l); + let P = p; + const F = c[1].createFunction(a); + return h ? n(P, F) : (P = i(P, (k, V) => F(k, V)), P); + } + let y = p; + if (y.length === 0) + return []; + const v = {}; + for (let P = 0; P < y.length; P++) { + const F = m$e(y[P]); + F !== "" && (v[F] = !0); + } + if (v.Array === !0 || v.Dictionary === !0 || v.Feature === !0 || v.Point === !0 || v.Polygon === !0 || v.Polyline === !0 || v.Multipoint === !0 || v.Extent === !0 || v.Function === !0) + return y.slice(0); + let x = 0, I = ""; + for (const P in v) + x++, I = P; + return y = x > 1 || I === "String" ? i(y, (P, F) => { + if (P == null || P === en) + return F == null || F === en ? 0 : 1; + if (F == null || F === en) + return -1; + const k = un(P), V = un(F); + return k < V ? -1 : k === V ? 0 : 1; + }) : I === "Number" ? i(y, (P, F) => P - F) : I === "Boolean" ? i(y, (P, F) => P === F ? 0 : F ? -1 : 1) : I === "Date" ? i(y, (P, F) => F - P) : y.slice(0), y; + } + t.functions.array = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 1, 2, a, l); + const y = Di(p[0]); + if (isNaN(y) || uP(y) === !1) + throw new Bt(a, At.InvalidParameter, l); + const v = mn(p[1], null), x = new Array(y); + return x.fill(v), x; + }); + }, t.functions.front = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 1, 1, a, l), Es(p[0])) { + if (p[0].length() <= 0) + throw new Bt(a, At.OutOfBounds, l); + return p[0].get(0); + } + if (Mn(p[0])) { + if (p[0].length <= 0) + throw new Bt(a, At.OutOfBounds, l); + return p[0][0]; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.back = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 1, 1, a, l), Es(p[0])) { + if (p[0].length() <= 0) + throw new Bt(a, At.OutOfBounds, l); + return p[0].get(p[0].length() - 1); + } + if (Mn(p[0])) { + if (p[0].length <= 0) + throw new Bt(a, At.OutOfBounds, l); + return p[0][p[0].length - 1]; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.push = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 1, 2, a, l), Mn(p[0])) + return p[0][p[0].length] = p[1], p[0].length; + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.pop = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 1, 1, a, l), Mn(p[0])) { + if (p[0].length <= 0) + throw new Bt(a, At.OutOfBounds, l); + const y = p[0][p[0].length - 1]; + return p[0].length = p[0].length - 1, y; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.erase = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 2, 2, a, l), Mn(p[0])) { + let y = Di(p[1]); + if (isNaN(y) || uP(y) === !1) + throw new Bt(a, At.InvalidParameter, l); + const v = p[0]; + if (v.length <= 0) + throw new Bt(a, At.OutOfBounds, l); + if (y < 0 && (y = v.length + y), y < 0) + throw new Bt(a, At.OutOfBounds, l); + if (y >= v.length) + throw new Bt(a, At.OutOfBounds, l); + return v.splice(y, 1), en; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.insert = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 3, 3, a, l), Mn(p[0])) { + const y = Di(p[1]); + if (isNaN(y) || uP(y) === !1) + throw new Bt(a, At.InvalidParameter, l); + const v = p[2], x = p[0]; + if (y > x.length) + throw new Bt(a, At.OutOfBounds, l); + if (y < 0 && y < -1 * x.length) + throw new Bt(a, At.OutOfBounds, l); + return y === x.length ? (x[y] = v, en) : (x.splice(y, 0, v), en); + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.resize = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 2, 3, a, l), Mn(p[0])) { + const y = Di(p[1]); + if (isNaN(y) || uP(y) === !1) + throw new Bt(a, At.InvalidParameter, l); + if (y < 0) + throw new Bt(a, At.InvalidParameter, l); + const v = mn(p[2], null), x = p[0]; + if (x.length >= y) + return x.length = y, en; + const I = x.length; + x.length = y; + for (let P = I; P < x.length; P++) + x[P] = v; + return en; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.includes = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 2, 2, a, l), Mn(p[0])) { + const y = p[1]; + return p[0].findIndex((v) => Bv(v, y)) > -1; + } + if (Es(p[0])) { + const y = p[1]; + return p[0].toArray().findIndex((v) => Bv(v, y)) > -1; + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.slice = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 1, 3, a, l), Mn(p[0])) { + const y = Di(mn(p[1], 0)), v = Di(mn(p[2], p[0].length)); + if (isNaN(y) || uP(y) === !1) + throw new Bt(a, At.InvalidParameter, l); + if (isNaN(v) || uP(v) === !1) + throw new Bt(a, At.InvalidParameter, l); + return p[0].slice(y, v); + } + if (Es(p[0])) { + const y = p[0], v = Di(mn(p[1], 0)), x = Di(mn(p[2], y.length())); + if (isNaN(v) || uP(v) === !1) + throw new Bt(a, At.InvalidParameter, l); + if (isNaN(x) || uP(x) === !1) + throw new Bt(a, At.InvalidParameter, l); + return y.toArray().slice(v, x); + } + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.splice = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + const y = []; + for (let v = 0; v < p.length; v++) + Mn(p[v]) ? y.push(...p[v]) : Es(p[v]) ? y.push(...p[v].toArray()) : y.push(p[v]); + return y; + }); + }, t.functions.top = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + if (Zi(p, 2, 2, a, l), Mn(p[0])) + return Di(p[1]) >= p[0].length ? p[0].slice(0) : p[0].slice(0, Di(p[1])); + if (Es(p[0])) + return Di(p[1]) >= p[0].length() ? p[0].slice(0) : p[0].slice(0, Di(p[1])); + throw new Bt(a, At.InvalidParameter, l); + }); + }, t.functions.first = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => (Zi(p, 1, 1, a, l), Mn(p[0]) ? p[0].length === 0 ? null : p[0][0] : Es(p[0]) ? p[0].length() === 0 ? null : p[0].get(0) : null)); + }, t.mode === "sync" && (t.functions.sort = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => o(a, l, p, !1)); + }, t.functions.any = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) { + const I = y(x); + if (ka(I) && I === !0) + return !0; + } + return !1; + }); + }, t.functions.all = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) + if (y(x) !== !0) + return !1; + return !0; + }); + }, t.functions.none = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) + if (y(x) === !0) + return !1; + return !0; + }); + }, t.functions.reduce = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 3, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + return p.length === 2 ? v.length === 0 ? null : v.reduce((x, I) => { + const P = y(x, I); + return x = P !== void 0 && P !== en ? P : null; + }) : v.reduce((x, I) => { + const P = y(x, I); + return x = P !== void 0 && P !== en ? P : null; + }, p[2]); + }); + }, t.functions.map = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l), x = []; + for (const I of v) { + const P = y(I); + P !== void 0 && P !== en ? x.push(P) : x.push(null); + } + return x; + }); + }, t.functions.filter = function(a, l) { + return t.standardFunction(a, l, (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l), x = []; + for (const I of v) + y(I) === !0 && x.push(I); + return x; + }); + }), t.mode === "async" && (t.functions.sort = function(a, l) { + return t.standardFunctionAsync(a, l, (c, h, p) => o(a, l, p, !0)); + }, t.functions.any = function(a, l) { + return t.standardFunctionAsync(a, l, async (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) { + const I = await y(x); + let P = null; + if (P = sf(P) ? await I : I, ka(P) && P === !0) + return !0; + } + return !1; + }); + }, t.functions.all = function(a, l) { + return t.standardFunctionAsync(a, l, async (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) { + const I = await y(x); + let P = null; + if (P = sf(P) ? await I : I, P !== !0) + return !1; + } + return !0; + }); + }, t.functions.none = function(a, l) { + return t.standardFunctionAsync(a, l, async (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + for (const x of v) { + const I = await y(x); + let P = null; + if (P = sf(P) ? await I : I, P === !0) + return !1; + } + return !0; + }); + }, t.functions.filter = function(a, l) { + return t.standardFunctionAsync(a, l, async (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l), x = []; + for (const I of v) { + const P = await y(I); + let F = null; + F = sf(F) ? await P : P, F === !0 && x.push(I); + } + return x; + }); + }, t.functions.reduce = function(a, l) { + return t.standardFunctionAsync(a, l, (c, h, p) => { + Zi(p, 2, 3, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l); + let x = null; + if (p.length > 2) { + const I = mn(p[2], null); + x = v.reduce(async (P, F) => { + let k = await P; + return k !== void 0 && k !== en || (k = null), y(k, F); + }, Promise.resolve(I)); + } else { + if (v.length === 0) + return null; + x = v.reduce(async (I, P, F) => { + if (F <= 1) + return y(I, P); + let k = await I; + return k !== void 0 && k !== en || (k = null), y(k, P); + }); + } + return x.then((I) => I !== void 0 && I !== en ? I : null); + }); + }, t.functions.map = function(a, l) { + return t.standardFunctionAsync(a, l, async (c, h, p) => { + Zi(p, 2, 2, a, l); + const y = p[1].createFunction(a), v = e(p[0], a, l), x = []; + for (const I of v) { + const P = await y(I); + let F = null; + F = sf(F) ? await P : P, F !== void 0 && F !== en ? x.push(F) : x.push(null); + } + return x; + }); + }); +} +const Wpe = Object.freeze(Object.defineProperty({ __proto__: null, registerFunctions: ZMi }, Symbol.toStringTag, { value: "Module" })); +function QMi(t, e, i) { + return t + (eDi(i) ? iDi : tDi)[e]; +} +function eDi(t) { + return t % 4 == 0 && (t % 100 != 0 || t % 400 == 0); +} +const tDi = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], iDi = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; +function nB(t) { + return t === null ? t : t.isValid === !1 ? null : t; +} +function fKe(t, e) { + return t === "" || t.toLowerCase().trim() === "default" ? Xo(e) : t; +} +function T$e(t, e) { + t.today = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 0, 0, i, r); + const a = /* @__PURE__ */ new Date(); + return a.setHours(0, 0, 0, 0), wl.dateJSAndZoneToArcadeDate(a, Xo(i)); + }); + }, t.changetimezone = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + const a = Zh(o[0], Xo(i)); + if (a === null) + return null; + const l = wl.arcadeDateAndZoneToArcadeDate(a, fKe(un(o[1]), i)); + return l.isValid === !1 ? null : l; + }); + }, t.timezone = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 2, i, r); + const a = Zh(o[0], Xo(i)); + if (a === null) + return null; + const l = a.timeZone; + return l === "system" ? wl.systemTimeZoneCanonicalName : l; + }); + }, t.timezoneoffset = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? null : a.timeZoneOffset; + }); + }, t.now = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 0, 0, i, r); + const a = wl.nowToArcadeDate(Xo(i)); + return a.isValid === !1 ? null : a; + }); + }, t.timestamp = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 0, 0, i, r); + const a = wl.nowUTCToArcadeDate(); + return a.isValid === !1 ? null : a; + }); + }, t.toutc = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? null : a.toUTC(); + }); + }, t.tolocal = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? null : a.toLocal(); + }); + }, t.day = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.day; + }); + }, t.month = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.monthJS; + }); + }, t.year = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.year; + }); + }, t.hour = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.hour; + }); + }, t.second = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.second; + }); + }, t.millisecond = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.millisecond; + }); + }, t.minute = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.minute; + }); + }, t.week = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 2, i, r); + const a = Zh(o[0], Xo(i)); + if (a === null) + return NaN; + const l = Di(mn(o[1], 0)); + if (l < 0 || l > 6) + throw new Bt(i, At.InvalidParameter, r); + const c = a.day, h = a.monthJS, p = a.year, y = a.dayOfWeekJS, v = QMi(c, h, p) - 1, x = Math.floor(v / 7); + return y - l + (y - l < 0 ? 7 : 0) < v - 7 * x ? x + 1 : x; + }); + }, t.weekday = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.dayOfWeekJS; + }); + }, t.isoweekday = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.dayOfWeekISO; + }); + }, t.isomonth = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.monthISO; + }); + }, t.isoweek = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.weekISO; + }); + }, t.isoyear = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Zh(o[0], Xo(i)); + return a === null ? NaN : a.yearISO; + }); + }, t.date = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 0, 8, i, r), o.length === 3) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), 0, 0, 0, 0, Xo(i))); + if (o.length === 4) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), Di(o[3]), 0, 0, 0, Xo(i))); + if (o.length === 5) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), Di(o[3]), Di(o[4]), 0, 0, Xo(i))); + if (o.length === 6) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), Di(o[3]), Di(o[4]), Di(o[5]), 0, Xo(i))); + if (o.length === 7) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), Di(o[3]), Di(o[4]), Di(o[5]), Di(o[6]), Xo(i))); + if (o.length === 8) + return nB(wl.fromParts(Di(o[0]), Di(o[1]) + 1, Di(o[2]), Di(o[3]), Di(o[4]), Di(o[5]), Di(o[6]), fKe(un(o[7]), i))); + if (o.length === 2) { + let a, l = un(o[1]); + return l === "" ? null : (l = y$e(l), a = l === "X" ? Qs.fromSeconds(Di(o[0])) : l === "x" ? Qs.fromMillis(Di(o[0])) : Qs.fromFormat(un(o[0]), l, { locale: Pv(), numberingSystem: "latn" }), a.isValid ? wl.dateTimeToArcadeDate(a) : null); + } + if (o.length === 1) { + if (wn(o[0])) { + if (o[0].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "") === "") + return null; + if (/^[0-9][0-9][0-9][0-9]$/.test(o[0]) === !0) + return Zh(o[0] + "-01-01", Xo(i)); + } + const a = Di(o[0]); + if (isNaN(a) === !1) { + const l = Qs.fromMillis(a); + return l.isValid ? wl.dateTimeAndZoneToArcadeDate(l, Xo(i)) : null; + } + return Zh(o[0], Xo(i)); + } + return o.length === 0 ? wl.nowToArcadeDate(Xo(i)) : null; + }); + }, t.datediff = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 4, i, r); + let a = Zh(o[0], Xo(i)), l = Zh(o[1], Xo(i)); + if (a === null || l === null) + return NaN; + let c = mn(o[3], ""); + switch (c !== "" && c !== null ? (c = un(c), a = wl.arcadeDateAndZoneToArcadeDate(a, c), l = wl.arcadeDateAndZoneToArcadeDate(l, c)) : a.timeZone !== l.timeZone && (a.isUnknownTimeZone ? a = wl.arcadeDateAndZoneToArcadeDate(a, l.timeZone) : l = (l.isUnknownTimeZone, wl.arcadeDateAndZoneToArcadeDate(l, a.timeZone))), un(o[2]).toLowerCase()) { + case "days": + case "day": + case "d": + return a.diff(l, "days"); + case "months": + case "month": + return a.diff(l, "months"); + case "minutes": + case "minute": + case "m": + return o[2] === "M" ? a.diff(l, "months") : a.diff(l, "minutes"); + case "seconds": + case "second": + case "s": + return a.diff(l, "seconds"); + case "milliseconds": + case "millisecond": + case "ms": + default: + return a.diff(l); + case "hours": + case "hour": + case "h": + return a.diff(l, "hours"); + case "years": + case "year": + case "y": + return a.diff(l, "years"); + } + }); + }, t.dateadd = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 3, i, r); + const a = Zh(o[0], Xo(i)); + if (a === null) + return null; + let l = Di(o[1]); + if (isNaN(l)) + return a; + let c = "milliseconds"; + switch (un(o[2]).toLowerCase()) { + case "days": + case "day": + case "d": + c = "days", l = LOe(l); + break; + case "months": + case "month": + c = "months", l = LOe(l); + break; + case "minutes": + case "minute": + case "m": + c = o[2] === "M" ? "months" : "minutes"; + break; + case "seconds": + case "second": + case "s": + c = "seconds"; + break; + case "milliseconds": + case "millisecond": + case "ms": + c = "milliseconds"; + break; + case "hours": + case "hour": + case "h": + c = "hours"; + break; + case "years": + case "year": + case "y": + c = "years"; + } + return a.plus({ [c]: l }); + }); + }; +} +function gE(t, e, i) { + return Math.sqrt((t[0] - e[0]) ** 2 + (t[1] - e[1]) ** 2 + (t[2] !== void 0 && e[2] !== void 0 ? (t[2] * i - e[2] * i) ** 2 : 0)); +} +const oX = []; +for (const t of [[9002, 56146130, 6131, 6132, 8050, 8051, 8228], [9003, 5702, 6358, 6359, 6360, 8052, 8053], [9095, 5754]]) { + const e = t[0]; + for (let i = 1; i < t.length; i++) + oX[t[i]] = e; +} +const zJ = []; +function fTt(t) { + return t.vcsWkid && oX[t.vcsWkid] !== void 0 ? zJ[oX[t.vcsWkid]] : t.latestVcsWkid && oX[t.latestVcsWkid] !== void 0 ? zJ[oX[t.latestVcsWkid]] : 1; +} +function mKe(t, e, i) { + const r = { x: 0, y: 0 }; + e && (r.z = 0), i && (r.m = 0); + let n = 0, s = t[0]; + for (let o = 0; o < t.length; o++) { + const a = t[o]; + if (sDi(a, s) === !1) { + const l = mTt(s, a, e), c = rDi(s, a, e, i); + c.x *= l, c.y *= l, r.x += c.x, r.y += c.y, e && (c.z *= l, r.z += c.z), i && (c.m *= l, r.m += c.m), n += l, s = a; + } + } + return n > 0 ? (r.x /= n, r.y /= n, e && (r.z /= n), i && (r.m /= n)) : (r.x = t[0][0], r.y = t[0][1], e && (r.z = t[0][2]), i && e ? r.m = t[0][3] : i && (r.m = t[0][2])), r; +} +function rDi(t, e, i, r) { + const n = { x: (t[0] + e[0]) / 2, y: (t[1] + e[1]) / 2 }; + return i && (n.z = (t[2] + e[2]) / 2), i && r ? n.m = (t[3] + e[3]) / 2 : r && (n.m = (t[2] + e[2]) / 2), n; +} +function nDi(t, e) { + if (t.length <= 1) + return 0; + let i = 0; + for (let r = 1; r < t.length; r++) + i += mTt(t[r - 1], t[r], e); + return i; +} +function mTt(t, e, i) { + const r = e[0] - t[0], n = e[1] - t[1]; + if (i) { + const s = e[2] - e[2]; + return Math.sqrt(r * r + n * n + s * s); + } + return Math.sqrt(r * r + n * n); +} +function sDi(t, e) { + if (t.length !== e.length) + return !1; + for (let i = 0; i < t.length; i++) + if (t[i] !== e[i]) + return !1; + return !0; +} +function gTt(t) { + const e = { x: 0, y: 0, spatialReference: t.spatialReference.toJSON() }, i = { x: 0, y: 0, spatialReference: t.spatialReference.toJSON() }; + let r = 0, n = 0; + for (let s = 0; s < t.paths.length; s++) { + if (t.paths[s].length === 0) + continue; + const o = nDi(t.paths[s], t.hasZ === !0); + if (o === 0) { + const a = mKe(t.paths[s], t.hasZ === !0, t.hasM === !0); + e.x += a.x, e.y += a.y, t.hasZ === !0 && (e.z += a.z), t.hasM === !0 && (e.m += a.m), ++r; + } else { + const a = mKe(t.paths[s], t.hasZ === !0, t.hasM === !0); + i.x += a.x * o, i.y += a.y * o, t.hasZ === !0 && (i.z += a.z * o), t.hasM === !0 && (i.m += a.m * o), n += o; + } + } + return n > 0 ? (i.x /= n, i.y /= n, t.hasZ === !0 && (i.z /= n), t.hasM === !0 && (i.m /= n), new Xi(i)) : r > 0 ? (e.x /= r, e.y /= r, t.hasZ === !0 && (i.z /= r), t.hasM === !0 && (e.m /= r), new Xi(e)) : null; +} +function yTt(t) { + if (t.points.length === 0) + return null; + let e = 0, i = 0, r = 0, n = 0; + for (let o = 0; o < t.points.length; o++) { + const a = t.getPoint(o); + a.hasZ === !0 && (r += a.z), a.hasM === !0 && (n += a.m), e += a.x, i += a.y, n += a.m; + } + const s = { x: e / t.points.length, y: i / t.points.length, spatialReference: null }; + return s.spatialReference = t.spatialReference.toJSON(), t.hasZ === !0 && (s.z = r / t.points.length), t.hasM === !0 && (s.m = n / t.points.length), new Xi(s); +} +function oDi(t, e) { + return t.x * e.x + t.y * e.y; +} +function aDi(t, e) { + return t.x * e.y - e.x * t.y; +} +function k0e(t, e, i = 0) { + for (; t < i; ) + t += e; + const r = i + e; + for (; t >= r; ) + t -= e; + return t; +} +function vTt(t, e) { + return Math.atan2(e.y - t.y, e.x - t.x); +} +function lDi(t, e) { + return k0e(vTt(t, e), 2 * Math.PI) * (180 / Math.PI); +} +function uDi(t, e) { + return k0e(Math.PI / 2 - vTt(t, e), 2 * Math.PI) * (180 / Math.PI); +} +function _Tt(t, e, i) { + const r = { x: t.x - e.x, y: t.y - e.y }, n = { x: i.x - e.x, y: i.y - e.y }; + return Math.atan2(aDi(r, n), oDi(r, n)); +} +function cDi(t, e, i) { + return k0e(_Tt(t, e, i), 2 * Math.PI) * (180 / Math.PI); +} +function hDi(t, e, i) { + return k0e(-1 * _Tt(t, e, i), 2 * Math.PI) * (180 / Math.PI); +} +zJ[9002] = 0.3048, zJ[9003] = 0.3048006096012192, zJ[9095] = 0.3048007491; +const _g = [0, 0]; +function gKe(t) { + for (let e = 0; e < t.length; e++) { + const i = t[e]; + for (let n = 0; n < i.length - 1; n++) { + const s = i[n], o = i[n + 1]; + for (let a = e + 1; a < t.length; a++) + for (let l = 0; l < t[a].length - 1; l++) { + const c = t[a][l], h = t[a][l + 1]; + if (V7(s, o, c, h, _g) && !(_g[0] === s[0] && _g[1] === s[1] || _g[0] === c[0] && _g[1] === c[1] || _g[0] === o[0] && _g[1] === o[1] || _g[0] === h[0] && _g[1] === h[1])) + return !0; + } + } + const r = i.length; + if (!(r < 3)) + for (let n = 0; n <= r - 2; n++) { + const s = i[n], o = i[n + 1]; + for (let a = n + 2; a <= r - 2; a++) { + const l = i[a], c = i[a + 1]; + if (V7(s, o, l, c, _g) && !(_g[0] === s[0] && _g[1] === s[1] || _g[0] === l[0] && _g[1] === l[1] || _g[0] === o[0] && _g[1] === o[1] || _g[0] === c[0] && _g[1] === c[1])) + return !0; + } + } + } + return !1; +} +function poe(t) { + return t && t.arcadeDeclaredClass === "esri.arcade.Feature"; +} +function E$e(t, e) { + t.ringisclockwise = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = [], l = !1, c = !1; + if (o[0] === null) + return !1; + if (Mn(o[0])) { + for (const h of o[0]) { + if (!(h instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + a.push(h.hasZ ? h.hasM ? [h.x, h.y, h.z, h.m] : [h.x, h.y, h.z] : [h.x, h.y]); + } + a.length > 0 && (l = o[0][0].hasZ, c = o[0][0].hasM); + } else if (o[0] instanceof x8) + a = o[0]._elements, a.length > 0 && (l = o[0]._hasZ, c = o[0]._hasM); + else { + if (!Es(o[0])) + throw new Bt(i, At.InvalidParameter, r); + for (const h of o[0].toArray()) { + if (!(h instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + a.push(h.hasZ ? h.hasM ? [h.x, h.y, h.z, h.m] : [h.x, h.y, h.z] : [h.x, h.y]); + } + a.length > 0 && (l = o[0].get(0).hasZ, c = o[0].get(0).hasM); + } + return !(a.length < 3) && kte(a, c, l); + }); + }, t.polygon = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = null; + if (o[0] instanceof is) { + if (a = Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference), !(a instanceof xo)) + throw new Bt(i, At.InvalidParameter, r); + } else + a = o[0] instanceof xo ? Sl(o[0].toJSON()) : Qh(new xo(JSON.parse(o[0])), i.spatialReference); + if (a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.polyline = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = null; + if (o[0] instanceof is) { + if (a = Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference), !(a instanceof xa)) + throw new Bt(i, At.InvalidParameter, r); + } else + a = o[0] instanceof xa ? Sl(o[0].toJSON()) : Qh(new xa(JSON.parse(o[0])), i.spatialReference); + if (a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.point = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = null; + if (o[0] instanceof is) { + if (a = Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference), !(a instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + } else + a = o[0] instanceof Xi ? Sl(o[0].toJSON()) : Qh(new Xi(JSON.parse(o[0])), i.spatialReference); + if (a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.multipoint = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = null; + if (o[0] instanceof is) { + if (a = Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference), !(a instanceof Dd)) + throw new Bt(i, At.InvalidParameter, r); + } else + a = o[0] instanceof Dd ? Sl(o[0].toJSON()) : Qh(new Dd(JSON.parse(o[0])), i.spatialReference); + if (a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.extent = function(i, r) { + return e(i, r, (n, s, o) => { + o = ts(o), Zi(o, 1, 1, i, r); + let a = null; + if (o[0] instanceof is) + a = Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference); + else if (o[0] instanceof Xi) { + const l = { xmin: o[0].x, ymin: o[0].y, xmax: o[0].x, ymax: o[0].y, spatialReference: o[0].spatialReference.toJSON() }, c = o[0]; + c.hasZ ? (l.zmin = c.z, l.zmax = c.z) : c.hasM && (l.mmin = c.m, l.mmax = c.m), a = Sl(l); + } else + a = o[0] instanceof xo || o[0] instanceof xa || o[0] instanceof Dd ? Sl(o[0].extent?.toJSON()) : o[0] instanceof br ? Sl(o[0].toJSON()) : Qh(new br(JSON.parse(o[0])), i.spatialReference); + if (a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.geometry = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + let a = null; + if (o[0] === null) + return null; + if (a = poe(o[0]) ? Qh(o[0].geometry(), i.spatialReference) : o[0] instanceof is ? Qh(ph.parseGeometryFromDictionary(o[0]), i.spatialReference) : Qh(Sl(JSON.parse(o[0])), i.spatialReference), a !== null && a.spatialReference.equals(i.spatialReference) === !1) + throw new Bt(i, At.WrongSpatialReference, r); + return TN(a); + }); + }, t.setgeometry = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 2, 2, i, r), !poe(o[0])) + throw new Bt(i, At.InvalidParameter, r); + if (o[0].immutable === !0) + throw new Bt(i, At.Immutable, r); + if (!(o[1] instanceof tn || o[1] === null)) + throw new Bt(i, At.InvalidParameter, r); + return o[0]._geometry = o[1], en; + }); + }, t.feature = function(i, r) { + return e(i, r, (n, s, o) => { + if (o.length === 0) + throw new Bt(i, At.WrongNumberOfParameters, r); + let a = null; + if (o.length === 1) + if (wn(o[0])) + a = ph.fromJson(JSON.parse(o[0]), i.timeReference); + else if (poe(o[0])) + a = ph.createFromArcadeFeature(o[0]); + else if (o[0] instanceof tn) + a = ph.createFromGraphicLikeObject(o[0], null, null, i.timeReference); + else { + if (!(o[0] instanceof is)) + throw new Bt(i, At.InvalidParameter, r); + { + let l = o[0].hasField("geometry") ? o[0].field("geometry") : null, c = o[0].hasField("attributes") ? o[0].field("attributes") : null; + l !== null && l instanceof is && (l = ph.parseGeometryFromDictionary(l)), c !== null && (c = ph.parseAttributesFromDictionary(c)), a = ph.createFromGraphicLikeObject(l, c, null, i.timeReference); + } + } + else if (o.length === 2) { + let l = null, c = null; + if (o[0] !== null) + if (o[0] instanceof tn) + l = o[0]; + else { + if (!(l instanceof is)) + throw new Bt(i, At.InvalidParameter, r); + l = ph.parseGeometryFromDictionary(o[0]); + } + if (o[1] !== null) { + if (!(o[1] instanceof is)) + throw new Bt(i, At.InvalidParameter, r); + c = ph.parseAttributesFromDictionary(o[1]); + } + a = ph.createFromGraphicLikeObject(l, c, null, i.timeReference); + } else { + let l = null; + const c = {}; + if (o[0] !== null) + if (o[0] instanceof tn) + l = o[0]; + else { + if (!(l instanceof is)) + throw new Bt(i, At.InvalidParameter, r); + l = ph.parseGeometryFromDictionary(o[0]); + } + for (let h = 1; h < o.length; h += 2) { + const p = un(o[h]), y = o[h + 1]; + if (!(y == null || wn(y) || isNaN(y) || Mu(y) || il(y) || ka(y))) + throw new Bt(i, At.InvalidParameter, r); + if (du(y) || t4(y) === !1) + throw new Bt(i, At.InvalidParameter, r); + c[p] = y === en ? null : y; + } + a = ph.createFromGraphicLikeObject(l, c, null, i.timeReference); + } + return a._geometry = Qh(a.geometry(), i.spatialReference), a.immutable = !1, a; + }); + }, t.dictionary = function(i, r) { + return e(i, r, (n, s, o) => { + if (o.length === 0) { + const c = new is(); + return c.immutable = !1, c; + } + if (o.length === 1 && wn(o[0])) + try { + const c = JSON.parse(o[0]), h = is.convertObjectToArcadeDictionary(c, Xo(i), !1); + return h.immutable = !1, h; + } catch { + throw new Bt(i, At.InvalidParameter, r); + } + if (o.length % 2 != 0) + throw new Bt(i, At.WrongNumberOfParameters, r); + const a = {}; + for (let c = 0; c < o.length; c += 2) { + const h = un(o[c]), p = o[c + 1]; + if (!(p == null || wn(p) || isNaN(p) || Mu(p) || il(p) || ka(p) || Mn(p) || Es(p))) + throw new Bt(i, At.InvalidParameter, r); + if (du(p)) + throw new Bt(i, At.InvalidParameter, r); + a[h] = p === en ? null : p; + } + const l = new is(a); + return l.immutable = !1, l; + }); + }, t.haskey = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + const a = un(o[1]); + if (poe(o[0]) || o[0] instanceof is) + return o[0].hasField(a); + if (o[0] instanceof tn) { + const l = N$(o[0], a, null, null, 2); + return !l || l.keystate !== "notfound"; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.hasvalue = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 2, 2, i, r), o[0] === null || o[1] === null) + return !1; + const a = un(o[1]); + return bu(o[0]) || o[0] instanceof is ? !!o[0].hasField(a) && o[0].field(a) !== null : o[0] instanceof tn ? N$(o[0], a, null, null, 0) !== null : !1; + }); + }, t.indexof = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + const a = o[1]; + if (Mn(o[0])) { + for (let l = 0; l < o[0].length; l++) + if (Bv(a, o[0][l])) + return l; + return -1; + } + if (Es(o[0])) { + const l = o[0].length(); + for (let c = 0; c < l; c++) + if (Bv(a, o[0].get(c))) + return c; + return -1; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.angle = function(i, r) { + return e(i, r, (n, s, o) => { + if (o = ts(o), Zi(o, 2, 3, i, r), !(o[0] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + if (!(o[1] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + if (o.length > 2 && !(o[2] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + return o.length === 2 ? lDi(o[0], o[1]) : cDi(o[0], o[1], o[2]); + }); + }, t.bearing = function(i, r) { + return e(i, r, (n, s, o) => { + if (o = ts(o), Zi(o, 2, 3, i, r), !(o[0] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + if (!(o[1] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + if (o.length > 2 && !(o[2] instanceof Xi)) + throw new Bt(i, At.InvalidParameter, r); + return o.length === 2 ? uDi(o[0], o[1]) : hDi(o[0], o[1], o[2]); + }); + }, t.isselfintersecting = function(i, r) { + return e(i, r, (n, s, o) => { + o = ts(o), Zi(o, 1, 1, i, r); + let a = o[0]; + if (a instanceof xo) + return a.isSelfIntersecting; + if (a instanceof xa) + return a = a.paths, gKe(a); + if (a instanceof Dd) { + const l = a.points; + for (let c = 0; c < l.length; c++) + for (let h = 0; h < l.length; h++) + if (h !== c) { + let p = !0; + for (let y = 0; y < l[c].length; y++) + if (l[c][y] !== l[h][y]) { + p = !1; + break; + } + if (p === !0) + return !0; + } + } + return !(!Mn(a) && !Es(a)) && (a = gF(a, i.spatialReference), a !== null && (a = a.paths), gKe(a)); + }); + }; +} +let IA = 0; +function N$(t, e, i, r, n = 1) { + let s; + switch (e = e.toLowerCase()) { + case "hasz": { + const o = t.hasZ; + return o !== void 0 && o; + } + case "hasm": { + const o = t.hasM; + return o !== void 0 && o; + } + case "spatialreference": { + let o = t.spatialReference._arcadeCacheId; + if (o === void 0) { + let l = !0; + Object.freeze && Object.isFrozen(t.spatialReference) && (l = !1), l && (IA++, t.spatialReference._arcadeCacheId = IA, o = IA); + } + const a = new is({ wkt: t.spatialReference.wkt, wkid: t.spatialReference.wkid }); + return o !== void 0 && (a._arcadeCacheId = "SPREF" + o.toString()), a; + } + } + switch (t.type) { + case "extent": + switch (e) { + case "xmin": + case "xmax": + case "ymin": + case "ymax": + case "zmin": + case "zmax": + case "mmin": + case "mmax": { + const o = t[e]; + return o !== void 0 ? o : null; + } + case "type": + return "Extent"; + } + break; + case "polygon": + switch (e) { + case "rings": + return s = t.cache._arcadeCacheId, s === void 0 && (IA++, s = IA, t.cache._arcadeCacheId = s), new ROe(t.rings, t.spatialReference, t.hasZ === !0, t.hasM === !0, s); + case "type": + return "Polygon"; + } + break; + case "point": + switch (e) { + case "x": + case "y": + case "z": + case "m": + return t[e] !== void 0 ? t[e] : null; + case "type": + return "Point"; + } + break; + case "polyline": + switch (e) { + case "paths": + return s = t.cache._arcadeCacheId, s === void 0 && (IA++, s = IA, t.cache._arcadeCacheId = s), new ROe(t.paths, t.spatialReference, t.hasZ === !0, t.hasM === !0, s); + case "type": + return "Polyline"; + } + break; + case "multipoint": + switch (e) { + case "points": + return s = t.cache._arcadeCacheId, s === void 0 && (IA++, s = IA, t.cache._arcadeCacheId = s), new x8(t.points, t.spatialReference, t.hasZ === !0, t.hasM === !0, s, 1); + case "type": + return "Multipoint"; + } + } + if (n === 1) + throw new Bt(i, At.InvalidIdentifier, r); + return n === 2 ? { keystate: "notfound" } : null; +} +function fE(t) { + if (t == null) + return null; + if (typeof t == "number") + return t; + let e = t.toLowerCase(); + switch (e = e.replace(/\s/g, ""), e = e.replace(/-/g, ""), e) { + case "meters": + case "meter": + case "m": + case "squaremeters": + case "squaremeter": + return 109404; + case "miles": + case "mile": + case "squaremile": + case "squaremiles": + return 109439; + case "kilometers": + case "kilometer": + case "squarekilometers": + case "squarekilometer": + case "km": + return 109414; + case "acres": + case "acre": + case "ac": + return 109402; + case "hectares": + case "hectare": + case "ha": + return 109401; + case "yard": + case "yd": + case "yards": + case "squareyards": + case "squareyard": + return 109442; + case "feet": + case "ft": + case "foot": + case "squarefeet": + case "squarefoot": + return 109405; + case "nmi": + case "nauticalmile": + case "nauticalmiles": + case "squarenauticalmile": + case "squarenauticalmiles": + return 109409; + } + return null; +} +function yKe(t) { + if (t == null) + return null; + switch (t.type) { + case "polygon": + case "multipoint": + case "polyline": + return t.extent; + case "point": + return new br({ xmin: t.x, ymin: t.y, xmax: t.x, ymax: t.y, spatialReference: t.spatialReference }); + case "extent": + return t; + } + return null; +} +function eu(t) { + if (t == null) + return null; + if (typeof t == "number") + return t; + let e = t.toLowerCase(); + switch (e = e.replace(/\s/g, ""), e = e.replace(/-/g, ""), e) { + case "meters": + case "meter": + case "m": + case "squaremeters": + case "squaremeter": + return 9001; + case "miles": + case "mile": + case "squaremile": + case "squaremiles": + return 9093; + case "kilometers": + case "kilometer": + case "squarekilometers": + case "squarekilometer": + case "km": + return 9036; + case "yard": + case "yd": + case "yards": + case "squareyards": + case "squareyard": + return 9096; + case "feet": + case "ft": + case "foot": + case "squarefeet": + case "squarefoot": + return 9002; + case "nmi": + case "nauticalmile": + case "nauticalmiles": + case "squarenauticalmile": + case "squarenauticalmiles": + return 9030; + } + return null; +} +function wp(t) { + if (t == null) + return null; + const e = t.clone(); + return t.cache._geVersion !== void 0 && (e.cache._geVersion = t.cache._geVersion), e; +} +let Ja = null; +function vKe(t) { + return Fte.indexOf("4.") === 0 ? xo.fromExtent(t) : new xo({ spatialReference: t.spatialReference, rings: [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] }); +} +function dDi(t) { + Ja = t; +} +function _Ke(t, e) { + if (t.type !== "polygon" && t.type !== "polyline" && t.type !== "extent") + return 0; + let i = 1; + (t.spatialReference.vcsWkid || t.spatialReference.latestVcsWkid) && (i = fTt(t.spatialReference) / th(t.spatialReference)); + let r = 0; + if (t.type === "polyline") + for (const s of t.paths) + for (let o = 1; o < s.length; o++) + r += gE(s[o], s[o - 1], i); + else if (t.type === "polygon") + for (const s of t.rings) { + for (let o = 1; o < s.length; o++) + r += gE(s[o], s[o - 1], i); + (s[0][0] !== s[s.length - 1][0] || s[0][1] !== s[s.length - 1][1] || s[0][2] !== void 0 && s[0][2] !== s[s.length - 1][2]) && (r += gE(s[0], s[s.length - 1], i)); + } + else + t.type === "extent" && (r += 2 * gE([t.xmin, t.ymin, 0], [t.xmax, t.ymin, 0], i), r += 2 * gE([t.xmin, t.ymin, 0], [t.xmin, t.ymax, 0], i), r *= 2, r += 4 * Math.abs(mn(t.zmax, 0) * i - mn(t.zmin, 0) * i)); + const n = new xa({ hasZ: !1, hasM: !1, spatialReference: t.spatialReference, paths: [[0, 0], [0, r]] }); + return Ja.planarLength(n, e); +} +function I$e(t, e) { + function i(r, n, s) { + if (Zi(s, 2, 2, r, n), !(s[0] instanceof tn && s[1] instanceof tn)) { + if (!(s[0] instanceof tn && s[1] === null)) { + if (!(s[1] instanceof tn && s[0] === null)) { + if (s[0] !== null || s[1] !== null) + throw new Bt(r, At.InvalidParameter, n); + } + } + } + } + t.disjoint = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] === null || a[1] === null || Ja.disjoint(a[0], a[1]))); + }, t.intersects = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.intersects(a[0], a[1]))); + }, t.touches = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.touches(a[0], a[1]))); + }, t.crosses = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.crosses(a[0], a[1]))); + }, t.within = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.within(a[0], a[1]))); + }, t.contains = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.contains(a[0], a[1]))); + }, t.overlaps = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] !== null && Ja.overlaps(a[0], a[1]))); + }, t.equals = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 2, 2, r, n), a[0] === a[1] || (a[0] instanceof tn && a[1] instanceof tn ? Ja.equals(a[0], a[1]) : !(!Mu(a[0]) || !Mu(a[1])) && a[0].equals(a[1])))); + }, t.relate = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 3, 3, r, n), a[0] instanceof tn && a[1] instanceof tn) + return Ja.relate(a[0], a[1], un(a[2])); + if (a[0] instanceof tn && a[1] === null || a[1] instanceof tn && a[0] === null || a[0] === null && a[1] === null) + return !1; + throw new Bt(r, At.InvalidParameter, n); + }); + }, t.intersection = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] === null || a[1] === null ? null : Ja.intersect(a[0], a[1]))); + }, t.union = function(r, n) { + return e(r, n, (s, o, a) => { + const l = []; + if ((a = ts(a)).length === 0) + throw new Bt(r, At.WrongNumberOfParameters, n); + if (a.length === 1) + if (Mn(a[0])) { + const c = ts(a[0]); + for (let h = 0; h < c.length; h++) + if (c[h] !== null) { + if (!(c[h] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + l.push(c[h]); + } + } else { + if (!Es(a[0])) { + if (a[0] instanceof tn) + return Qh(wp(a[0]), r.spatialReference); + if (a[0] === null) + return null; + throw new Bt(r, At.InvalidParameter, n); + } + { + const c = ts(a[0].toArray()); + for (let h = 0; h < c.length; h++) + if (c[h] !== null) { + if (!(c[h] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + l.push(c[h]); + } + } + } + else + for (let c = 0; c < a.length; c++) + if (a[c] !== null) { + if (!(a[c] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + l.push(a[c]); + } + return l.length === 0 ? null : Ja.union(l); + }); + }, t.difference = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] !== null && a[1] === null ? wp(a[0]) : a[0] === null ? null : Ja.difference(a[0], a[1]))); + }, t.symmetricdifference = function(r, n) { + return e(r, n, (s, o, a) => (a = ts(a), i(r, n, a), a[0] === null && a[1] === null ? null : a[0] === null ? wp(a[1]) : a[1] === null ? wp(a[0]) : Ja.symmetricDifference(a[0], a[1]))); + }, t.clip = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 2, r, n), !(a[1] instanceof br) && a[1] !== null) + throw new Bt(r, At.InvalidParameter, n); + if (a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return a[1] === null ? null : Ja.clip(a[0], a[1]); + }); + }, t.cut = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 2, r, n), !(a[1] instanceof xa) && a[1] !== null) + throw new Bt(r, At.InvalidParameter, n); + if (a[0] === null) + return []; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return a[1] === null ? [wp(a[0])] : Ja.cut(a[0], a[1]); + }); + }, t.area = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), (a = ts(a))[0] === null) + return 0; + if (Mn(a[0]) || Es(a[0])) { + const l = iee(a[0], r.spatialReference); + return l === null ? 0 : Ja.planarArea(l, fE(mn(a[1], -1))); + } + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.planarArea(a[0], fE(mn(a[1], -1))); + }); + }, t.areageodetic = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), (a = ts(a))[0] === null) + return 0; + if (Mn(a[0]) || Es(a[0])) { + const l = iee(a[0], r.spatialReference); + return l === null ? 0 : Ja.geodesicArea(l, fE(mn(a[1], -1))); + } + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.geodesicArea(a[0], fE(mn(a[1], -1))); + }); + }, t.length = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), (a = ts(a))[0] === null) + return 0; + if (Mn(a[0]) || Es(a[0])) { + const l = gF(a[0], r.spatialReference); + return l === null ? 0 : Ja.planarLength(l, eu(mn(a[1], -1))); + } + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.planarLength(a[0], eu(mn(a[1], -1))); + }); + }, t.length3d = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), (a = ts(a))[0] === null) + return 0; + if (Mn(a[0]) || Es(a[0])) { + const l = gF(a[0], r.spatialReference); + return l === null ? 0 : l.hasZ === !0 ? _Ke(l, eu(mn(a[1], -1))) : Ja.planarLength(l, eu(mn(a[1], -1))); + } + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return a[0].hasZ === !0 ? _Ke(a[0], eu(mn(a[1], -1))) : Ja.planarLength(a[0], eu(mn(a[1], -1))); + }); + }, t.lengthgeodetic = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), (a = ts(a))[0] === null) + return 0; + if (Mn(a[0]) || Es(a[0])) { + const l = gF(a[0], r.spatialReference); + return l === null ? 0 : Ja.geodesicLength(l, eu(mn(a[1], -1))); + } + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.geodesicLength(a[0], eu(mn(a[1], -1))); + }); + }, t.distance = function(r, n) { + return e(r, n, (s, o, a) => { + a = ts(a), Zi(a, 2, 3, r, n); + let l = a[0]; + (Mn(a[0]) || Es(a[0])) && (l = k6(a[0], r.spatialReference)); + let c = a[1]; + if ((Mn(a[1]) || Es(a[1])) && (c = k6(a[1], r.spatialReference)), !(l instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + if (!(c instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.distance(l, c, eu(mn(a[2], -1))); + }); + }, t.distancegeodetic = function(r, n) { + return e(r, n, (s, o, a) => { + a = ts(a), Zi(a, 2, 3, r, n); + const l = a[0], c = a[1]; + if (!(l instanceof Xi)) + throw new Bt(r, At.InvalidParameter, n); + if (!(c instanceof Xi)) + throw new Bt(r, At.InvalidParameter, n); + const h = new xa({ paths: [], spatialReference: l.spatialReference }); + return h.addPath([l, c]), Ja.geodesicLength(h, eu(mn(a[2], -1))); + }); + }, t.densify = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 3, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + if (l <= 0) + throw new Bt(r, At.InvalidParameter, n); + return a[0] instanceof xo || a[0] instanceof xa ? Ja.densify(a[0], l, eu(mn(a[2], -1))) : a[0] instanceof br ? Ja.densify(vKe(a[0]), l, eu(mn(a[2], -1))) : a[0]; + }); + }, t.densifygeodetic = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 3, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + if (l <= 0) + throw new Bt(r, At.InvalidParameter, n); + return a[0] instanceof xo || a[0] instanceof xa ? Ja.geodesicDensify(a[0], l, eu(mn(a[2], -1))) : a[0] instanceof br ? Ja.geodesicDensify(vKe(a[0]), l, eu(mn(a[2], -1))) : a[0]; + }); + }, t.generalize = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 4, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.generalize(a[0], l, _b(mn(a[2], !0)), eu(mn(a[3], -1))); + }); + }, t.buffer = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 3, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + return l === 0 ? wp(a[0]) : Ja.buffer(a[0], l, eu(mn(a[2], -1))); + }); + }, t.buffergeodetic = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 3, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + return l === 0 ? wp(a[0]) : Ja.geodesicBuffer(a[0], l, eu(mn(a[2], -1))); + }); + }, t.offset = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 2, 6, r, n), a[0] === null) + return null; + if (!(a[0] instanceof xo || a[0] instanceof xa)) + throw new Bt(r, At.InvalidParameter, n); + const l = Di(a[1]); + if (isNaN(l)) + throw new Bt(r, At.InvalidParameter, n); + const c = Di(mn(a[4], 10)); + if (isNaN(c)) + throw new Bt(r, At.InvalidParameter, n); + const h = Di(mn(a[5], 0)); + if (isNaN(h)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.offset(a[0], l, eu(mn(a[2], -1)), un(mn(a[3], "round")).toLowerCase(), c, h); + }); + }, t.rotate = function(r, n) { + return e(r, n, (s, o, a) => { + a = ts(a), Zi(a, 2, 3, r, n); + let l = a[0]; + if (l === null) + return null; + if (!(l instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + l instanceof br && (l = xo.fromExtent(l)); + const c = Di(a[1]); + if (isNaN(c)) + throw new Bt(r, At.InvalidParameter, n); + const h = mn(a[2], null); + if (h === null) + return Ja.rotate(l, c); + if (h instanceof Xi) + return Ja.rotate(l, c, h); + throw new Bt(r, At.InvalidParameter, n); + }); + }, t.centroid = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 1, 1, r, n), a[0] === null) + return null; + let l = a[0]; + if ((Mn(a[0]) || Es(a[0])) && (l = k6(a[0], r.spatialReference)), l === null) + return null; + if (!(l instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return l instanceof Xi ? Qh(wp(a[0]), r.spatialReference) : l instanceof xo ? l.centroid : l instanceof xa ? gTt(l) : l instanceof Dd ? yTt(l) : l instanceof br ? l.center : null; + }); + }, t.multiparttosinglepart = function(r, n) { + return e(r, n, (s, o, a) => { + a = ts(a), Zi(a, 1, 1, r, n); + const l = []; + if (a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + if (a[0] instanceof Xi) + return [Qh(wp(a[0]), r.spatialReference)]; + if (a[0] instanceof br) + return [Qh(wp(a[0]), r.spatialReference)]; + const c = Ja.simplify(a[0]); + if (c instanceof xo) { + const h = [], p = []; + for (let y = 0; y < c.rings.length; y++) + if (c.isClockwise(c.rings[y])) { + const v = Sl({ rings: [c.rings[y]], hasZ: c.hasZ === !0, hasM: c.hasM === !0, spatialReference: c.spatialReference.toJSON() }); + h.push(v); + } else + p.push({ ring: c.rings[y], pt: c.getPoint(y, 0) }); + for (let y = 0; y < p.length; y++) + for (let v = 0; v < h.length; v++) + if (h[v].contains(p[y].pt)) { + h[v].addRing(p[y].ring); + break; + } + return h; + } + if (c instanceof xa) { + const h = []; + for (let p = 0; p < c.paths.length; p++) { + const y = Sl({ paths: [c.paths[p]], hasZ: c.hasZ === !0, hasM: c.hasM === !0, spatialReference: c.spatialReference.toJSON() }); + h.push(y); + } + return h; + } + if (a[0] instanceof Dd) { + const h = Qh(wp(a[0]), r.spatialReference); + for (let p = 0; p < h.points.length; p++) + l.push(h.getPoint(p)); + return l; + } + return null; + }); + }, t.issimple = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 1, 1, r, n), a[0] === null) + return !0; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.isSimple(a[0]); + }); + }, t.simplify = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 1, 1, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.simplify(a[0]); + }); + }, t.convexhull = function(r, n) { + return e(r, n, (s, o, a) => { + if (a = ts(a), Zi(a, 1, 1, r, n), a[0] === null) + return null; + if (!(a[0] instanceof tn)) + throw new Bt(r, At.InvalidParameter, n); + return Ja.convexHull(a[0]); + }); + }; +} +const pDi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + registerFunctions: I$e, + setGeometryEngine: dDi +}, Symbol.toStringTag, { value: "Module" })); +function Fwe(t, e, i) { + return i === void 0 || +i == 0 ? Math[t](e) : (e = +e, i = +i, isNaN(e) || typeof i != "number" || i % 1 != 0 ? NaN : (e = e.toString().split("e"), +((e = (e = Math[t](+(e[0] + "e" + (e[1] ? +e[1] - i : -i)))).toString().split("e"))[0] + "e" + (e[1] ? +e[1] + i : i)))); +} +function A$e(t, e) { + function i(r, n, s) { + const o = Di(r); + return isNaN(o) ? o : isNaN(n) || isNaN(s) || n > s ? NaN : o < n ? n : o > s ? s : o; + } + t.number = function(r, n) { + return e(r, n, (s, o, a) => { + Zi(a, 1, 2, r, n); + const l = a[0]; + if (il(l)) + return l; + if (l === null) + return 0; + if (Mu(l)) + return l.toNumber(); + if (ka(l)) + return Number(l); + if (Mn(l)) + return NaN; + if (l === "" || l === void 0) + return Number(l); + if (wn(l)) { + if (a[1] !== void 0) { + let c = ox(a[1], "‰", ""); + return c = ox(c, "¤", ""), aTt(l, { pattern: c }); + } + return Number(l.trim()); + } + return Number(l); + }); + }, t.abs = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.abs(Di(a[0])))); + }, t.acos = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.acos(Di(a[0])))); + }, t.asin = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.asin(Di(a[0])))); + }, t.atan = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.atan(Di(a[0])))); + }, t.atan2 = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 2, 2, r, n), Math.atan2(Di(a[0]), Di(a[1])))); + }, t.ceil = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), a.length === 2) { + let l = Di(a[1]); + return isNaN(l) && (l = 0), Fwe("ceil", Di(a[0]), -1 * l); + } + return Math.ceil(Di(a[0])); + }); + }, t.round = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), a.length === 2) { + let l = Di(a[1]); + return isNaN(l) && (l = 0), Fwe("round", Di(a[0]), -1 * l); + } + return Math.round(Di(a[0])); + }); + }, t.floor = function(r, n) { + return e(r, n, (s, o, a) => { + if (Zi(a, 1, 2, r, n), a.length === 2) { + let l = Di(a[1]); + return isNaN(l) && (l = 0), Fwe("floor", Di(a[0]), -1 * l); + } + return Math.floor(Di(a[0])); + }); + }, t.cos = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.cos(Di(a[0])))); + }, t.isnan = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), typeof a[0] == "number" && isNaN(a[0]))); + }, t.exp = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.exp(Di(a[0])))); + }, t.log = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.log(Di(a[0])))); + }, t.pow = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 2, 2, r, n), Di(a[0]) ** Di(a[1]))); + }, t.random = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 0, 0, r, n), Math.random())); + }, t.sin = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.sin(Di(a[0])))); + }, t.sqrt = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.sqrt(Di(a[0])))); + }, t.tan = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), Math.tan(Di(a[0])))); + }, t.defaultvalue = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 2, 2, r, n), a[0] === null || a[0] === "" || a[0] === void 0 ? a[1] : a[0])); + }, t.isempty = function(r, n) { + return e(r, n, (s, o, a) => (Zi(a, 1, 1, r, n), a[0] === null || a[0] === "" || a[0] === void 0)); + }, t.boolean = function(r, n) { + return e(r, n, (s, o, a) => { + Zi(a, 1, 1, r, n); + const l = a[0]; + return _b(l); + }); + }, t.constrain = function(r, n) { + return e(r, n, (s, o, a) => { + Zi(a, 3, 3, r, n); + const l = Di(a[1]), c = Di(a[2]); + if (Mn(a[0])) { + const h = []; + for (const p of a[0]) + h.push(i(p, l, c)); + return h; + } + if (Es(a[0])) { + const h = []; + for (let p = 0; p < a[0].length(); p++) + h.push(i(a[0].get(p), l, c)); + return h; + } + return i(a[0], l, c); + }); + }; +} +function bTt(t) { + let e = 0; + for (let i = 0; i < t.length; i++) + e += t[i]; + return e / t.length; +} +function bKe(t) { + const e = bTt(t); + let i = 0; + for (let r = 0; r < t.length; r++) + i += (e - t[r]) ** 2; + return i / t.length; +} +function fDi(t) { + let e = 0; + for (let i = 0; i < t.length; i++) + e += t[i]; + return e; +} +function mDi(t, e) { + const i = [], r = {}, n = []; + for (let s = 0; s < t.length; s++) { + if (t[s] !== void 0 && t[s] !== null && t[s] !== en) { + const o = t[s]; + if (il(o) || wn(o)) + r[o] === void 0 && (i.push(o), r[o] = 1); + else { + let a = !1; + for (let l = 0; l < n.length; l++) + Bv(n[l], o) === !0 && (a = !0); + a === !1 && (n.push(o), i.push(o)); + } + } + if (i.length >= e && e !== -1) + return i; + } + return i; +} +function mS(t, e, i = 1e3) { + switch (t.toLowerCase()) { + case "distinct": + return mDi(e, i); + case "avg": + case "mean": + return bTt(CN(e)); + case "min": + return Math.min.apply(Math, CN(e)); + case "sum": + return fDi(CN(e)); + case "max": + return Math.max.apply(Math, CN(e)); + case "stdev": + case "stddev": + return Math.sqrt(bKe(CN(e))); + case "var": + case "variance": + return bKe(CN(e)); + case "count": + return e.length; + } + return 0; +} +function VR(t, e, i, r) { + if (r.length === 1) { + if (Mn(r[0])) + return mS(t, r[0], -1); + if (Es(r[0])) + return mS(t, r[0].toArray(), -1); + } + return mS(t, r, -1); +} +function P$e(t, e) { + t.stdev = function(i, r) { + return e(i, r, (n, s, o) => VR("stdev", n, s, o)); + }, t.variance = function(i, r) { + return e(i, r, (n, s, o) => VR("variance", n, s, o)); + }, t.average = function(i, r) { + return e(i, r, (n, s, o) => VR("mean", n, s, o)); + }, t.mean = function(i, r) { + return e(i, r, (n, s, o) => VR("mean", n, s, o)); + }, t.sum = function(i, r) { + return e(i, r, (n, s, o) => VR("sum", n, s, o)); + }, t.min = function(i, r) { + return e(i, r, (n, s, o) => VR("min", n, s, o)); + }, t.max = function(i, r) { + return e(i, r, (n, s, o) => VR("max", n, s, o)); + }, t.distinct = function(i, r) { + return e(i, r, (n, s, o) => VR("distinct", n, s, o)); + }, t.count = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), Mn(o[0]) || wn(o[0])) + return o[0].length; + if (Es(o[0])) + return o[0].length(); + throw new Bt(i, At.InvalidParameter, r); + }); + }; +} +let UU = class extends is { + constructor(e) { + super(), this.declaredClass = "esri.arcade.Portal", this.immutable = !1, this.setField("url", e), this.immutable = !0; + } +}, wTt = class extends is { + constructor(e, i, r, n, s, o) { + super(), this.attachmentUrl = s, this.declaredClass = "esri.arcade.Attachment", this.immutable = !1, this.setField("id", e), this.setField("name", i), this.setField("contenttype", r), this.setField("size", n), this.setField("exifinfo", o), this.immutable = !0; + } +}; +const O$e = (t) => (e, i, r) => (r = r || 14, +t(e, i).toFixed(r)), gDi = (t, e) => t + e, yDi = (t, e) => t * e, vDi = (t, e) => t / e, wKe = (t, e, i) => O$e(gDi)(t, e, i), u7 = (t, e, i) => O$e(yDi)(t, e, i), qpe = (t, e, i) => O$e(vDi)(t, e, i), Ype = 360, _Di = 400, bDi = 2 * Math.PI, CS = 3600, xKe = 3240, HJ = 60, AD = 60, SKe = 180 * CS / Math.PI, aX = Ype * HJ * AD, Lwe = 90 * CS, sB = 180 * CS, wDi = 270 * CS, xTt = String.fromCharCode(7501), lX = "°"; +function iq(t) { + if (wn(t) === !1) + throw new Bt(null, At.InvalidParameter, null); + return t; +} +function BOe(t, e) { + const i = 10 ** e; + return Math.round(t * i) / i; +} +function xDi(t, e) { + return t % e; +} +function oB(t) { + const e = parseFloat(t.toString().replace(Math.trunc(t).toString(), "0")) * Math.sign(t); + return t < 0 ? { fraction: e, integer: Math.ceil(t) } : { fraction: e, integer: Math.floor(t) }; +} +var pc, Nn, vu, VOe; +function uG(t, e) { + switch (t) { + case pc.north: + return e === "SHORT" ? "N" : "North"; + case pc.east: + return e === "SHORT" ? "E" : "East"; + case pc.south: + return e === "SHORT" ? "S" : "South"; + case pc.west: + return e === "SHORT" ? "W" : "West"; + } +} +function Nwe(t, e, i) { + for (; t.length < i; ) + t = e + t; + return t; +} +function kwe(t, e) { + return t - Math.floor(t / e) * e; +} +function $we(t) { + switch (t) { + case Nn.truncated_degrees: + case Nn.decimal_degrees: + return Ype; + case Nn.radians: + return bDi; + case Nn.gradians: + return _Di; + case Nn.seconds: + return aX; + case Nn.fractional_degree_minutes: + return HJ; + case Nn.fractional_minute_seconds: + return AD; + default: + throw new Bt(null, At.LogicError, null, { reason: "unsupported evaluations" }); + } +} +function CKe(t) { + switch (t.toUpperCase().trim()) { + case "NORTH": + case "NORTHAZIMUTH": + case "NORTH AZIMUTH": + return vu.north_azimuth; + case "POLAR": + return vu.polar; + case "QUADRANT": + return vu.quadrant; + case "SOUTH": + case "SOUTHAZIMUTH": + case "SOUTH AZIMUTH": + return vu.south_azimuth; + } + throw new Bt(null, At.LogicError, null, { reason: "unsupported directionType" }); +} +function TKe(t) { + switch (t.toUpperCase().trim()) { + case "D": + case "DD": + case "DECIMALDEGREE": + case "DECIMAL DEGREE": + case "DEGREE": + case "DECIMALDEGREES": + case "DECIMAL DEGREES": + case "DEGREES": + return Nn.decimal_degrees; + case "DMS": + case "DEGREESMINUTESSECONDS": + case "DEGREES MINUTES SECONDS": + return Nn.degrees_minutes_seconds; + case "R": + case "RAD": + case "RADS": + case "RADIAN": + case "RADIANS": + return Nn.radians; + case "G": + case "GON": + case "GONS": + case "GRAD": + case "GRADS": + case "GRADIAN": + case "GRADIANS": + return Nn.gradians; + } + throw new Bt(null, At.LogicError, null, { reason: "unsupported units" }); +} +(function(t) { + t[t.north = 0] = "north", t[t.east = 1] = "east", t[t.south = 2] = "south", t[t.west = 3] = "west"; +})(pc || (pc = {})), function(t) { + t[t.decimal_degrees = 1] = "decimal_degrees", t[t.seconds = 2] = "seconds", t[t.degrees_minutes_seconds = 3] = "degrees_minutes_seconds", t[t.radians = 4] = "radians", t[t.gradians = 5] = "gradians", t[t.truncated_degrees = 6] = "truncated_degrees", t[t.fractional_degree_minutes = 7] = "fractional_degree_minutes", t[t.fractional_minute_seconds = 8] = "fractional_minute_seconds"; +}(Nn || (Nn = {})), function(t) { + t[t.north_azimuth = 1] = "north_azimuth", t[t.polar = 2] = "polar", t[t.quadrant = 3] = "quadrant", t[t.south_azimuth = 4] = "south_azimuth"; +}(vu || (vu = {})), function(t) { + t[t.meridian = 0] = "meridian", t[t.direction = 1] = "direction"; +}(VOe || (VOe = {})); +let zU = class Hue { + constructor(e, i, r) { + this.m_degrees = e, this.m_minutes = i, this.m_seconds = r; + } + getField(e) { + switch (e) { + case Nn.decimal_degrees: + case Nn.truncated_degrees: + return this.m_degrees; + case Nn.fractional_degree_minutes: + return this.m_minutes; + case Nn.seconds: + case Nn.fractional_minute_seconds: + return this.m_seconds; + default: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + } + } + static secondsToDMS(e) { + const i = oB(e).fraction; + let r = oB(e).integer; + const n = Math.floor(r / CS); + r -= n * CS; + const s = Math.floor(r / AD); + return r -= s * AD, new Hue(n, s, r + i); + } + static numberToDms(e) { + const i = oB(e).fraction, r = oB(e).integer, n = u7(oB(100 * i).fraction, 100), s = oB(100 * i).integer; + return new Hue(r, s, n); + } + format(e, i) { + let r = BOe(this.m_seconds, i), n = this.m_minutes, s = this.m_degrees; + if (e === Nn.seconds || e === Nn.fractional_minute_seconds) + AD <= r && (r -= AD, ++n), HJ <= n && (n = 0, ++s), Ype <= s && (s = 0); + else if (e === Nn.fractional_degree_minutes) + r = 0, n = 30 <= this.m_seconds ? this.m_minutes + 1 : this.m_minutes, s = this.m_degrees, HJ <= n && (n = 0, ++s), Ype <= s && (s = 0); + else if (e === Nn.decimal_degrees || e === Nn.truncated_degrees) { + const o = qpe(this.m_seconds, CS), a = qpe(this.m_minutes, HJ); + s = Math.round(this.m_degrees + a + o), n = 0, r = 0; + } + return new Hue(s, n, r); + } + static dmsToSeconds(e, i, r) { + return e * CS + i * AD + r; + } +}, SDi = class { + constructor(e, i, r) { + this.meridian = e, this.angle = i, this.direction = r; + } + fetchAzimuth(e) { + return e === VOe.meridian ? this.meridian : this.direction; + } +}, hD = class cP { + constructor(e) { + this._angle = e; + } + static createFromAngleAndDirection(e, i) { + return new cP(new LE(cP._convertDirectionFormat(e.extractAngularUnits(Nn.seconds), i, vu.north_azimuth))); + } + getAngle(e) { + const i = this._angle.extractAngularUnits(Nn.seconds); + switch (e) { + case vu.north_azimuth: + case vu.south_azimuth: + case vu.polar: + return new LE(cP._convertDirectionFormat(i, vu.north_azimuth, e)); + case vu.quadrant: { + const r = cP.secondsNorthAzimuthToQuadrant(i); + return new LE(r.angle); + } + } + } + getMeridian(e) { + const i = this._angle.extractAngularUnits(Nn.seconds); + switch (e) { + case vu.north_azimuth: + return pc.north; + case vu.south_azimuth: + return pc.south; + case vu.polar: + return pc.east; + case vu.quadrant: + return cP.secondsNorthAzimuthToQuadrant(i).meridian; + } + } + getDirection(e) { + const i = this._angle.extractAngularUnits(Nn.seconds); + switch (e) { + case vu.north_azimuth: + return pc.east; + case vu.south_azimuth: + return pc.west; + case vu.polar: + return pc.north; + case vu.quadrant: + return cP.secondsNorthAzimuthToQuadrant(i).direction; + } + } + static secondsNorthAzimuthToQuadrant(e) { + const i = e <= Lwe || e >= wDi ? pc.north : pc.south, r = i === pc.north ? Math.min(aX - e, e) : Math.abs(e - sB), n = e > sB ? pc.west : pc.east; + return new SDi(i, r, n); + } + static createFromAngleMeridianAndDirection(e, i, r) { + return new cP(new LE(cP.secondsQuadrantToNorthAzimuth(e.extractAngularUnits(Nn.seconds), i, r))); + } + static secondsQuadrantToNorthAzimuth(e, i, r) { + return i === pc.north ? r === pc.east ? e : aX - e : r === pc.east ? sB - e : sB + e; + } + static _convertDirectionFormat(e, i, r) { + let n = 0; + switch (i) { + case vu.north_azimuth: + n = e; + break; + case vu.polar: + n = Lwe - e; + break; + case vu.quadrant: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + case vu.south_azimuth: + n = e + sB; + } + let s = 0; + switch (r) { + case vu.north_azimuth: + s = n; + break; + case vu.polar: + s = Lwe - n; + break; + case vu.quadrant: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + case vu.south_azimuth: + s = n - sB; + } + return s = xDi(s, aX), s < 0 ? aX + s : s; + } +}; +function EKe(t, e, i) { + let r = null; + switch (e) { + case Nn.decimal_degrees: + r = u7(t, CS); + break; + case Nn.seconds: + r = t; + break; + case Nn.gradians: + r = u7(t, xKe); + break; + case Nn.radians: + r = u7(t, SKe); + break; + default: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + } + switch (i) { + case Nn.decimal_degrees: + return qpe(r, CS); + case Nn.seconds: + return r; + case Nn.gradians: + return qpe(r, xKe); + case Nn.radians: + return r / SKe; + default: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + } +} +let LE = class jOe { + constructor(e) { + this._seconds = e; + } + static createFromAngleAndUnits(e, i) { + return new jOe(EKe(e, i, Nn.seconds)); + } + extractAngularUnits(e) { + return EKe(this._seconds, Nn.seconds, ree(e)); + } + static createFromDegreesMinutesSeconds(e, i, r) { + return new jOe(wKe(wKe(u7(e, CS), u7(i, AD)), r)); + } +}; +function ree(t) { + switch (Fg(t), t) { + case Nn.decimal_degrees: + case Nn.truncated_degrees: + case Nn.degrees_minutes_seconds: + return Nn.decimal_degrees; + case Nn.gradians: + return Nn.gradians; + case Nn.fractional_degree_minutes: + return Nn.fractional_degree_minutes; + case Nn.radians: + return Nn.radians; + case Nn.seconds: + case Nn.fractional_minute_seconds: + return Nn.seconds; + } +} +let CDi = class STt { + constructor(e, i, r, n) { + this.view = e, this.angle = i, this.merdian = r, this.direction = n, this._dms = null, this._formattedDms = null; + } + static createFromStringAndBearing(e, i, r) { + return new STt(e, i.getAngle(r), i.getMeridian(r), i.getDirection(r)); + } + fetchAngle() { + return this.angle; + } + fetchMeridian() { + return this.merdian; + } + fetchDirection() { + return this.direction; + } + fetchView() { + return this.view; + } + fetchDms() { + return this._dms === null && this._calculateDms(), this._dms; + } + fetchFormattedDms() { + return this._formattedDms === null && this._calculateDms(), this._formattedDms; + } + _calculateDms() { + let e = null, i = Nn.truncated_degrees, r = 0; + for (let n = 0; n < this.view.length; n++) { + const s = this.view[n]; + switch (s) { + case "m": + e = GOe(this.view, n, s), i = i === Nn.truncated_degrees ? Nn.fractional_degree_minutes : i, n = e.newpos; + continue; + case "s": + e = GOe(this.view, n, s), i = Nn.fractional_minute_seconds, r = r < e.rounding ? e.rounding : r, n = e.newpos; + continue; + default: + continue; + } + } + this._dms = zU.secondsToDMS(this.angle.extractAngularUnits(Nn.seconds)), this._formattedDms = zU.secondsToDMS(this.angle.extractAngularUnits(Nn.seconds)).format(i, r); + } +}; +function TDi(t, e, i, r, n) { + let s = null; + switch (e) { + case Nn.decimal_degrees: + case Nn.radians: + case Nn.gradians: + return s = kwe(BOe(t.extractAngularUnits(e), r), $we(e)), Nwe(s.toFixed(r), "0", i + r + (r > 0 ? 1 : 0)); + case Nn.truncated_degrees: + case Nn.fractional_degree_minutes: + return s = kwe(n.fetchFormattedDms().getField(e), $we(e)), Nwe(s.toFixed(r), "0", i + r + (r > 0 ? 1 : 0)); + case Nn.fractional_minute_seconds: + return s = kwe(BOe(n.fetchDms().getField(e), r), $we(e)), Nwe(s.toFixed(r), "0", i + r + (r > 0 ? 1 : 0)); + default: + throw new Bt(null, At.LogicError, null, { reason: "unexpected evaluation" }); + } +} +function EDi(t, e, i) { + if (i === vu.quadrant) + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); + if (e === Nn.degrees_minutes_seconds) { + const r = zU.numberToDms(t); + return hD.createFromAngleAndDirection(LE.createFromDegreesMinutesSeconds(r.m_degrees, r.m_minutes, r.m_seconds), i); + } + return hD.createFromAngleAndDirection(LE.createFromAngleAndUnits(t, ree(e)), i); +} +function IDi(t) { + switch (Di(t)) { + case 1: + return { first: pc.north, second: pc.east }; + case 2: + return { first: pc.south, second: pc.east }; + case 3: + return { first: pc.south, second: pc.west }; + case 4: + return { first: pc.north, second: pc.west }; + } + return null; +} +function IKe(t) { + switch (t.toUpperCase().trim()) { + case "N": + case "NORTH": + return pc.north; + case "E": + case "EAST": + return pc.east; + case "S": + case "SOUTH": + return pc.south; + case "W": + case "WEST": + return pc.west; + } + return null; +} +function aB(t) { + const e = parseFloat(t); + if (il(e)) { + if (isNaN(e)) + throw new Bt(null, At.LogicError, null, { reason: "invalid conversion" }); + return e; + } + throw new Bt(null, At.LogicError, null, { reason: "invalid conversion" }); +} +function Bwe(t, e, i) { + const r = i === vu.quadrant; + let n = null, s = null, o = 0, a = 0, l = 0; + if (r) { + if (t.length < 2) + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); + l = 1; + const c = IDi(un(t[t.length - 1])); + if (c ? (n = c.first, s = c.second) : (o = 1, n = IKe(un(t[0])), s = IKe(un(t[t.length - 1]))), n === null || s === null) + throw new Bt(null, At.LogicError, null, { reason: "invalid conversion" }); + } + switch (e) { + case Nn.decimal_degrees: + case Nn.radians: + case Nn.gradians: + if (t.length === 0) + throw new Bt(null, At.LogicError, null, { reason: "invalid conversion" }); + return r ? hD.createFromAngleMeridianAndDirection(LE.createFromAngleAndUnits(aB(t[o]), ree(e)), n, s) : hD.createFromAngleAndDirection(LE.createFromAngleAndUnits(aB(t[o]), ree(e)), i); + case Nn.degrees_minutes_seconds: + if (a = t.length - l - o, a === 3) { + const c = LE.createFromDegreesMinutesSeconds(aB(t[o]), aB(t[o + 1]), aB(t[o + 2])); + return r ? hD.createFromAngleMeridianAndDirection(c, n, s) : hD.createFromAngleAndDirection(c, i); + } + if (a === 1) { + const c = aB(t[o]), h = zU.numberToDms(c), p = LE.createFromDegreesMinutesSeconds(h.m_degrees, h.m_minutes, h.m_seconds); + return r ? hD.createFromAngleMeridianAndDirection(p, n, s) : hD.createFromAngleAndDirection(p, i); + } + } + throw new Bt(null, At.LogicError, null, { reason: "invalid conversion" }); +} +function ADi(t) { + const e = [" ", "-", "/", "'", '"', "\\", "^", lX, xTt, " ", "\r", ` +`, "*"]; + let i = ""; + for (let r = 0; r < t.length; r++) { + const n = t.charAt(r); + e.includes(n) ? i += "RRSPLITRRSPLITRR" : i += n; + } + return i.split("RRSPLITRRSPLITRR").filter((r) => r !== ""); +} +function PDi(t, e, i) { + if (il(t)) + return EDi(Di(t), e, i); + if (wn(t)) + return Bwe(ADi(t), e, i); + if (Mn(t)) + return Bwe(t, e, i); + if (Es(t)) + return Bwe(t.toArray(), e, i); + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); +} +function ODi(t, e, i) { + const r = ree(i); + if (r && i !== Nn.degrees_minutes_seconds) + return t.getAngle(e).extractAngularUnits(r); + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); +} +function RDi(t, e, i) { + const r = t.getAngle(e); + if (e === vu.quadrant && i === Nn.degrees_minutes_seconds) { + const n = zU.secondsToDMS(r.extractAngularUnits(Nn.seconds)); + return [uG(t.getMeridian(e), "SHORT"), n.m_degrees, n.m_minutes, n.m_seconds, uG(t.getDirection(e), "SHORT")]; + } + if (i === Nn.degrees_minutes_seconds) { + const n = zU.secondsToDMS(r.extractAngularUnits(Nn.seconds)); + return [n.m_degrees, n.m_minutes, n.m_seconds]; + } + return e === vu.quadrant ? [uG(t.getMeridian(e), "SHORT"), r.extractAngularUnits(i), uG(t.getDirection(e), "SHORT")] : [r.extractAngularUnits(i)]; +} +function MDi(t, e) { + let i = ""; + switch (t) { + case Nn.decimal_degrees: + i = e === vu.quadrant ? "DD.DD" + lX : "DDD.DD" + lX; + break; + case Nn.degrees_minutes_seconds: + i = e === vu.quadrant ? "dd" + lX + ` mm' ss"` : "ddd" + lX + ` mm' ss.ss"`; + break; + case Nn.radians: + i = "R.RR"; + break; + case Nn.gradians: + i = "GGG.GG" + xTt; + break; + default: + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); + } + return e === vu.quadrant && (i = "p " + i + " b"), i; +} +function GOe(t, e, i) { + const r = { padding: 0, rounding: 0, newpos: e }; + let n = !1; + for (; e < t.length; ) { + const s = t[e]; + if (s === i) + n ? r.rounding++ : r.padding++, e++; + else { + if (s !== ".") + break; + n = !0, e++; + } + } + return r.newpos = e - 1, r; +} +function DDi(t, e, i) { + const r = { escaped: "", newpos: e }; + for (e++; e < t.length; ) { + const n = t[e]; + if (e++, n === "]") + break; + r.escaped += n; + } + return r.newpos = e - 1, r; +} +function FDi(t, e, i) { + let r = "", n = null, s = null; + const o = CDi.createFromStringAndBearing(e, t, i), a = { D: Nn.decimal_degrees, d: Nn.truncated_degrees, m: Nn.fractional_degree_minutes, s: Nn.fractional_minute_seconds, R: Nn.radians, G: Nn.gradians }; + for (let l = 0; l < e.length; l++) { + const c = e[l]; + switch (c) { + case "[": + n = DDi(e, l), r += n.escaped, l = n.newpos; + continue; + case "D": + case "d": + case "m": + case "s": + case "R": + case "G": + n = GOe(e, l, c), s = t.getAngle(i), r += TDi(s, a[c], n.padding, n.rounding, o), l = n.newpos; + continue; + case "P": + case "p": + r += uG(o.fetchMeridian(), c === "p" ? "SHORT" : "LONG"); + continue; + case "B": + case "b": + r += uG(o.fetchDirection(), c === "b" ? "SHORT" : "LONG"); + continue; + default: + r += c; + } + } + return r; +} +function LDi(t, e, i) { + if (!(e instanceof is)) + throw new Bt(null, At.InvalidParameter, null); + if (e.hasField("directionType") === !1) + throw new Bt(null, At.LogicError, null, { reason: "missing directionType" }); + if (e.hasField("angleType") === !1) + throw new Bt(null, At.LogicError, null, { reason: "missing angleType" }); + const r = CKe(iq(e.field("directiontype"))), n = PDi(t, TKe(iq(e.field("angletype"))), r); + if (!(i instanceof is)) + throw new Bt(null, At.InvalidParameter, null); + if (i.hasField("directionType") === !1) + throw new Bt(null, At.LogicError, null, { reason: "missing directionType" }); + if (i.hasField("outputType") === !1) + throw new Bt(null, At.LogicError, null, { reason: "missing angleType" }); + const s = CKe(iq(i.field("directiontype"))), o = i.hasField("angleType") ? TKe(iq(i.field("angletype"))) : null, a = iq(i.field("outputType")).toUpperCase().trim(); + if (!s || !a) + throw new Bt(null, At.LogicError, null, { reason: "conversion error" }); + if (!(o || a === "TEXT" && i.hasField("format"))) + throw new Bt(null, At.LogicError, null, { reason: "invalid unit" }); + switch (a) { + case "VALUE": + return s === vu.quadrant || o === Nn.degrees_minutes_seconds ? RDi(n, s, o) : ODi(n, s, o); + case "TEXT": { + let l = ""; + return i.hasField("format") && (l = un(i.field("format"))), l !== null && l !== "" || (l = MDi(o, s)), FDi(n, l, s); + } + default: + throw new Bt(null, At.InvalidParameter, null); + } +} +const lB = 2654435761, uB = 2246822519, foe = 3266489917, AKe = 668265263, PKe = 374761393; +function OKe(t) { + const e = []; + for (let i = 0, r = t.length; i < r; i++) { + let n = t.charCodeAt(i); + n < 128 ? e.push(n) : n < 2048 ? e.push(192 | n >> 6, 128 | 63 & n) : n < 55296 || n >= 57344 ? e.push(224 | n >> 12, 128 | n >> 6 & 63, 128 | 63 & n) : (i++, n = 65536 + ((1023 & n) << 10 | 1023 & t.charCodeAt(i)), e.push(240 | n >> 18, 128 | n >> 12 & 63, 128 | n >> 6 & 63, 128 | 63 & n)); + } + return new Uint8Array(e); +} +let NDi = class { + constructor(e) { + this._seed = e, this._totallen = 0, this._bufs = [], this.init(); + } + init() { + return this._bufs = [], this._totallen = 0, this; + } + updateFloatArray(e) { + const i = []; + for (const r of e) + isNaN(r) ? i.push("NaN") : r === 1 / 0 ? i.push("Infinity") : r === -1 / 0 ? i.push("-Infinity") : r === 0 ? i.push("0") : i.push(r.toString(16)); + this.update(OKe(i.join(""))); + } + updateIntArray(e) { + const i = Int32Array.from(e); + this.update(new Uint8Array(i.buffer)); + } + updateUint8Array(e) { + this.update(Uint8Array.from(e)); + } + updateWithString(e) { + return this.update(OKe(e)); + } + update(e) { + return this._bufs.push(e), this._totallen += e.length, this; + } + digest() { + const e = new Uint8Array(this._totallen); + let i = 0; + for (const r of this._bufs) + e.set(r, i), i += r.length; + return this.init(), this._xxHash32(e, this._seed); + } + _xxHash32(e, i = 0) { + const r = e; + let n = i + PKe & 4294967295, s = 0; + if (r.length >= 16) { + const a = [i + lB + uB & 4294967295, i + uB & 4294967295, i + 0 & 4294967295, i - lB & 4294967295], l = e, c = l.length - 16; + let h = 0; + for (s = 0; (4294967280 & s) <= c; s += 4) { + const p = s, y = l[p + 0] + (l[p + 1] << 8), v = l[p + 2] + (l[p + 3] << 8), x = y * uB + (v * uB << 16); + let I = a[h] + x & 4294967295; + I = I << 13 | I >>> 19; + const P = 65535 & I, F = I >>> 16; + a[h] = P * lB + (F * lB << 16) & 4294967295, h = h + 1 & 3; + } + n = (a[0] << 1 | a[0] >>> 31) + (a[1] << 7 | a[1] >>> 25) + (a[2] << 12 | a[2] >>> 20) + (a[3] << 18 | a[3] >>> 14) & 4294967295; + } + n = n + e.length & 4294967295; + const o = e.length - 4; + for (; s <= o; s += 4) { + const a = s, l = r[a + 0] + (r[a + 1] << 8), c = r[a + 2] + (r[a + 3] << 8); + n = n + (l * foe + (c * foe << 16)) & 4294967295, n = n << 17 | n >>> 15, n = (65535 & n) * AKe + ((n >>> 16) * AKe << 16) & 4294967295; + } + for (; s < r.length; ++s) + n += r[s] * PKe, n = n << 11 | n >>> 21, n = (65535 & n) * lB + ((n >>> 16) * lB << 16) & 4294967295; + return n ^= n >>> 15, n = ((65535 & n) * uB & 4294967295) + ((n >>> 16) * uB << 16), n ^= n >>> 13, n = ((65535 & n) * foe & 4294967295) + ((n >>> 16) * foe << 16), n ^= n >>> 16, n < 0 ? n + 4294967296 : n; + } +}; +function kDi(t) { + return t.loadStatus === "loaded" && t.user && t.user.sourceJSON ? t.user.sourceJSON : null; +} +function $Di(t, e) { + return !!t && T4e(t, e?.restUrl || ""); +} +function RKe(t, e) { + if (!t || !e) + return t === e; + if (t.x === e.x && t.y === e.y) { + if (t.hasZ) { + if (t.z !== e.z) + return !1; + } else if (e.hasZ) + return !1; + if (t.hasM) { + if (t.m !== e.m) + return !1; + } else if (e.hasM) + return !1; + return !0; + } + return !1; +} +function Pw(t, e, i) { + if (t !== null) + if (Mn(t)) { + if (e.updateUint8Array([61]), i.map.has(t)) { + const r = i.map.get(t); + e.updateIntArray([61237541 ^ r]); + } else { + i.map.set(t, i.currentLength++); + for (const r of t) + Pw(r, e, i); + i.map.delete(t), i.currentLength--; + } + e.updateUint8Array([199]); + } else if (Es(t)) { + if (e.updateUint8Array([61]), i.map.has(t)) { + const r = i.map.get(t); + e.updateIntArray([61237541 ^ r]); + } else { + i.map.set(t, i.currentLength++); + for (const r of t.toArray()) + Pw(r, e, i); + i.map.delete(t), i.currentLength--; + } + e.updateUint8Array([199]); + } else { + if (Mu(t)) + return e.updateIntArray([t.toNumber()]), void e.updateUint8Array([241]); + if (wn(t)) + return e.updateIntArray([t.length]), e.updateWithString(t), void e.updateUint8Array([41]); + if (ka(t)) + e.updateUint8Array([t === !0 ? 1 : 0, 113]); + else { + if (il(t)) + return e.updateFloatArray([t]), void e.updateUint8Array([173]); + if (t instanceof wTt) + throw new Bt(i.context, At.UnsupportedHashType, i.node); + if (t instanceof UU) + throw new Bt(i.context, At.UnsupportedHashType, i.node); + if (!(t instanceof is)) { + if (bu(t)) + throw new Bt(i.context, At.UnsupportedHashType, i.node); + if (t instanceof Xi) + return e.updateIntArray([3833836621]), e.updateIntArray([0]), e.updateFloatArray([t.x]), e.updateIntArray([1]), e.updateFloatArray([t.y]), t.hasZ && (e.updateIntArray([2]), e.updateFloatArray([t.z])), t.hasM && (e.updateIntArray([3]), e.updateFloatArray([t.m])), e.updateIntArray([3765347959]), void Pw(t.spatialReference.wkid, e, i); + if (t instanceof xo) { + e.updateIntArray([1266616829]); + for (let r = 0; r < t.rings.length; r++) { + const n = t.rings[r], s = []; + let o = null, a = null; + for (let l = 0; l < n.length; l++) { + const c = t.getPoint(r, l); + if (l === 0) + o = c; + else if (RKe(a, c)) + continue; + a = c, l === n.length - 1 && RKe(o, c) || s.push(c); + } + e.updateIntArray([1397116793, s.length]); + for (let l = 0; l < s.length; l++) { + const c = s[l]; + e.updateIntArray([3962308117, l]), Pw(c, e, i), e.updateIntArray([2716288009]); + } + e.updateIntArray([2278822459]); + } + return e.updateIntArray([3878477243]), void Pw(t.spatialReference.wkid, e, i); + } + if (t instanceof xa) { + e.updateIntArray([4106883559]); + for (let r = 0; r < t.paths.length; r++) { + const n = t.paths[r]; + e.updateIntArray([1397116793, n.length]); + for (let s = 0; s < n.length; s++) + e.updateIntArray([3962308117, s]), Pw(t.getPoint(r, s), e, i), e.updateIntArray([2716288009]); + e.updateIntArray([2278822459]); + } + return e.updateIntArray([2568784753]), void Pw(t.spatialReference.wkid, e, i); + } + if (t instanceof Dd) { + e.updateIntArray([588535921, t.points.length]); + for (let r = 0; r < t.points.length; r++) { + const n = t.getPoint(r); + e.updateIntArray([r]), Pw(n, e, i); + } + return e.updateIntArray([1700171621]), void Pw(t.spatialReference.wkid, e, i); + } + if (t instanceof br) + return e.updateIntArray([3483648373]), e.updateIntArray([0]), e.updateFloatArray([t.xmax]), e.updateIntArray([1]), e.updateFloatArray([t.xmin]), e.updateIntArray([2]), e.updateFloatArray([t.ymax]), e.updateIntArray([3]), e.updateFloatArray([t.ymin]), t.hasZ && (e.updateIntArray([4]), e.updateFloatArray([t.zmax]), e.updateIntArray([5]), e.updateFloatArray([t.zmin])), t.hasM && (e.updateIntArray([6]), e.updateFloatArray([t.mmax]), e.updateIntArray([7]), e.updateFloatArray([t.mmin])), e.updateIntArray([3622027469]), void Pw(t.spatialReference.wkid, e, i); + if (t instanceof or) + return e.updateIntArray([14]), t.wkid !== void 0 && t.wkid !== null && e.updateIntArray([t.wkid]), void (t.wkt && e.updateWithString(t.wkt)); + throw du(t) ? new Bt(i.context, At.UnsupportedHashType, i.node) : tu(t) ? new Bt(i.context, At.UnsupportedHashType, i.node) : R0e(t) ? new Bt(i.context, At.UnsupportedHashType, i.node) : t === en ? new Bt(i.context, At.UnsupportedHashType, i.node) : new Bt(i.context, At.UnsupportedHashType, i.node); + } + if (e.updateUint8Array([223]), i.map.has(t)) { + const r = i.map.get(t); + e.updateIntArray([61237541 ^ r]); + } else { + i.map.set(t, i.currentLength++); + for (const r of t.keys()) + e.updateIntArray([r.length]), e.updateWithString(r), e.updateUint8Array([251]), Pw(t.field(r), e, i), e.updateUint8Array([239]); + i.map.delete(t), i.currentLength--; + } + e.updateUint8Array([73]); + } + } + else + e.updateUint8Array([0, 139]); +} +function R$e(t, e) { + t.portal = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 1, 1, i, r), new UU(un(o[0])))); + }, t.typeof = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = m$e(o[0]); + if (a === "Unrecognised Type") + throw new Bt(i, At.UnrecognisedType, r); + return a; + }); + }, t.trim = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 1, 1, i, r), un(o[0]).trim())); + }, t.tohex = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = Di(o[0]); + return isNaN(a) ? a : a.toString(16); + }); + }, t.upper = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 1, 1, i, r), un(o[0]).toUpperCase())); + }, t.proper = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 2, i, r); + let a = 1; + o.length === 2 && un(o[1]).toLowerCase() === "firstword" && (a = 2); + const l = /\s/, c = un(o[0]); + let h = "", p = !0; + for (let y = 0; y < c.length; y++) { + let v = c[y]; + l.test(v) ? a === 1 && (p = !0) : v.toUpperCase() !== v.toLowerCase() && (p ? (v = v.toUpperCase(), p = !1) : v = v.toLowerCase()), h += v; + } + return h; + }); + }, t.lower = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 1, 1, i, r), un(o[0]).toLowerCase())); + }, t.guid = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 0, 1, i, r), o.length > 0) + switch (un(o[0]).toLowerCase()) { + case "digits": + return NV().replace("-", "").replace("-", "").replace("-", "").replace("-", ""); + case "digits-hyphen": + return NV(); + case "digits-hyphen-braces": + return "{" + NV() + "}"; + case "digits-hyphen-parentheses": + return "(" + NV() + ")"; + } + return "{" + NV() + "}"; + }); + }, t.standardizeguid = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + let a = un(o[0]); + if (a === "" || a === null) + return ""; + const l = /^(\{|\()?(?[0-9a-z]{8})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{12})(\}|\))?$/gim.exec(a); + if (!l) + return ""; + const c = l.groups; + switch (a = c.partA + "-" + c.partB + "-" + c.partC + "-" + c.partD + "-" + c.partE, un(o[1]).toLowerCase()) { + case "digits": + return a.replace("-", "").replace("-", "").replace("-", "").replace("-", ""); + case "digits-hyphen": + return a; + case "digits-hyphen-braces": + return "{" + a + "}"; + case "digits-hyphen-parentheses": + return "(" + a + ")"; + } + return "{" + a + "}"; + }); + }, t.console = function(i, r) { + return e(i, r, (n, s, o) => (o.length === 0 || (o.length === 1 ? i.console(un(o[0])) : i.console(un(o))), en)); + }, t.mid = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 3, i, r); + let a = Di(o[1]); + if (isNaN(a)) + return ""; + if (a < 0 && (a = 0), o.length === 2) + return un(o[0]).substr(a); + let l = Di(o[2]); + return isNaN(l) ? "" : (l < 0 && (l = 0), un(o[0]).substr(a, l)); + }); + }, t.find = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 3, i, r); + let a = 0; + if (o.length > 2) { + if (a = Di(mn(o[2], 0)), isNaN(a)) + return -1; + a < 0 && (a = 0); + } + return un(o[1]).indexOf(un(o[0]), a); + }); + }, t.left = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + let a = Di(o[1]); + return isNaN(a) ? "" : (a < 0 && (a = 0), un(o[0]).substr(0, a)); + }); + }, t.right = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 2, 2, i, r); + let a = Di(o[1]); + return isNaN(a) ? "" : (a < 0 && (a = 0), un(o[0]).substr(-1 * a, a)); + }); + }, t.split = function(i, r) { + return e(i, r, (n, s, o) => { + let a; + Zi(o, 2, 4, i, r); + let l = Di(mn(o[2], -1)); + const c = _b(mn(o[3], !1)); + if (l === -1 || l === null || c === !0 ? a = un(o[0]).split(un(o[1])) : (isNaN(l) && (l = -1), l < -1 && (l = -1), a = un(o[0]).split(un(o[1]), l)), c === !1) + return a; + const h = []; + for (let p = 0; p < a.length && !(l !== -1 && h.length >= l); p++) + a[p] !== "" && a[p] !== void 0 && h.push(a[p]); + return h; + }); + }, t.text = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 1, 2, i, r), q_(o[0], o[1]))); + }, t.concatenate = function(i, r) { + return e(i, r, (n, s, o) => { + const a = []; + if (o.length < 1) + return ""; + if (Mn(o[0])) { + const l = mn(o[2], ""); + for (let c = 0; c < o[0].length; c++) + a[c] = q_(o[0][c], l); + return o.length > 1 ? a.join(o[1]) : a.join(""); + } + if (Es(o[0])) { + const l = mn(o[2], ""); + for (let c = 0; c < o[0].length(); c++) + a[c] = q_(o[0].get(c), l); + return o.length > 1 ? a.join(o[1]) : a.join(""); + } + for (let l = 0; l < o.length; l++) + a[l] = q_(o[l]); + return a.join(""); + }); + }, t.reverse = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), Mn(o[0])) { + const a = o[0].slice(0); + return a.reverse(), a; + } + if (Es(o[0])) { + const a = o[0].toArray().slice(0); + return a.reverse(), a; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.replace = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 3, 4, i, r); + const a = un(o[0]), l = un(o[1]), c = un(o[2]); + return o.length !== 4 || _b(o[3]) ? ox(a, l, c) : a.replace(l, c); + }); + }, t.schema = function(i, r) { + return e(i, r, (n, s, o) => { + if (bu(o[0])) { + const a = C$e(o[0]); + return a ? is.convertObjectToArcadeDictionary(a, Xo(i)) : null; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.subtypes = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), bu(o[0])) { + const a = UJ(o[0]); + return a ? is.convertObjectToArcadeDictionary(a, Xo(i)) : null; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.subtypecode = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), bu(o[0])) { + const a = UJ(o[0]); + if (!a) + return null; + if (a.subtypeField && o[0].hasField(a.subtypeField)) { + const l = o[0].field(a.subtypeField); + for (const c of a.subtypes) + if (c.code === l) + return c.code; + return null; + } + return null; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.subtypename = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), bu(o[0])) { + const a = UJ(o[0]); + if (!a) + return ""; + if (a.subtypeField && o[0].hasField(a.subtypeField)) { + const l = o[0].field(a.subtypeField); + for (const c of a.subtypes) + if (c.code === l) + return c.name; + return ""; + } + return ""; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.gdbversion = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), bu(o[0])) + return o[0].gdbVersion(); + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.domain = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 2, 3, i, r), bu(o[0])) { + const a = w$e(o[0], un(o[1]), o[2] === void 0 ? void 0 : Di(o[2])); + return a && a.domain ? a.domain.type === "coded-value" || a.domain.type === "codedValue" ? is.convertObjectToArcadeDictionary({ type: "codedValue", name: a.domain.name, dataType: Vpe[a.field.type], codedValues: a.domain.codedValues.map((l) => ({ name: l.name, code: l.code })) }, Xo(i)) : is.convertObjectToArcadeDictionary({ type: "range", name: a.domain.name, dataType: Vpe[a.field.type], min: a.domain.min, max: a.domain.max }, Xo(i)) : null; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.domainname = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 2, 4, i, r), bu(o[0])) + return x$e(o[0], un(o[1]), o[2], o[3] === void 0 ? void 0 : Di(o[3])); + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.domaincode = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 2, 4, i, r), bu(o[0])) + return S$e(o[0], un(o[1]), o[2], o[3] === void 0 ? void 0 : Di(o[3])); + throw new Bt(i, At.InvalidParameter, r); + }); + }, t.urlencode = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), o[0] === null) + return ""; + if (o[0] instanceof is) { + let a = ""; + for (const l of o[0].keys()) { + const c = o[0].field(l); + a !== "" && (a += "&"), a += c === null ? encodeURIComponent(l) + "=" : encodeURIComponent(l) + "=" + encodeURIComponent(c); + } + return a; + } + return encodeURIComponent(un(o[0])); + }); + }, t.hash = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 1, i, r); + const a = new NDi(0); + return Pw(o[0], a, { context: i, node: r, map: /* @__PURE__ */ new Map(), currentLength: 0 }), a.digest(); + }); + }, t.convertdirection = function(i, r) { + return e(i, r, (n, s, o) => (Zi(o, 3, 3, i, r), LDi(o[0], o[1], o[2]))); + }, t.fromjson = function(i, r) { + return e(i, r, (n, s, o) => { + if (Zi(o, 1, 1, i, r), wn(o[0]) === !1) + throw new Bt(i, At.InvalidParameter, r); + return is.convertJsonToArcade(JSON.parse(un(o[0])), Xo(i)); + }); + }, t.expects = function(i, r) { + return e(i, r, (n, s, o) => { + if (o.length < 1) + throw new Bt(i, At.WrongNumberOfParameters, r); + return en; + }); + }, t.tocharcode = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 2, i, r); + const a = Di(mn(o[1], 0)), l = un(o[0]); + if (l.length === 0 && o.length === 1) + return null; + if (l.length <= a || a < 0) + throw new Bt(i, At.OutOfBounds, r); + return l.charCodeAt(a); + }); + }, t.tocodepoint = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 1, 2, i, r); + const a = Di(mn(o[1], 0)), l = un(o[0]); + if (l.length === 0 && o.length === 1) + return null; + if (l.length <= a || a < 0) + throw new Bt(i, At.OutOfBounds, r); + return l.codePointAt(a); + }); + }, t.fromcharcode = function(i, r) { + return e(i, r, (n, s, o) => { + if (o.length < 1) + throw new Bt(i, At.WrongNumberOfParameters, r); + const a = o.map((l) => Math.trunc(Di(l))).filter((l) => l >= 0 && l <= 65535); + return a.length === 0 ? null : String.fromCharCode.apply(null, a); + }); + }, t.fromcodepoint = function(i, r) { + return e(i, r, (n, s, o) => { + if (o.length < 1) + throw new Bt(i, At.WrongNumberOfParameters, r); + let a; + try { + a = o.map((l) => Math.trunc(Di(l))).filter((l) => l <= 1114111 && l >>> 0 === l); + } catch { + return null; + } + return a.length === 0 ? null : String.fromCodePoint.apply(null, a); + }); + }, t.getuser = function(i, r) { + return e(i, r, (n, s, o) => { + Zi(o, 0, 2, i, r); + let a = mn(o[1], ""); + if (a = a === !0 || a === !1 ? "" : un(a), a !== null && a !== "") + return null; + if (o.length === 0 || o[0] instanceof UU) { + let l = null; + if (i.services && i.services.portal && (l = i.services.portal), o.length > 0 && !$Di(o[0].field("url"), l) || !l) + return null; + if (a === "") { + const c = kDi(l); + if (c) { + const h = JSON.parse(JSON.stringify(c)); + for (const p of ["lastLogin", "created", "modified"]) + h[p] !== void 0 && h[p] !== null && (h[p] = new Date(h[p])); + return is.convertObjectToArcadeDictionary(h, Xo(i)); + } + } + return null; + } + throw new Bt(i, At.InvalidParameter, r); + }); + }; +} +let Jz = class { + constructor(e, i) { + this._moduleSingletons = e, this._syntaxModules = i; + } + loadLibrary(e) { + if (this._syntaxModules == null) + return null; + const i = this._syntaxModules[e.toLowerCase()]; + return i ? { syntax: i.script, uri: i.uri } : null; + } +}, BDi = class extends QF { + constructor(e, i) { + super(), this.paramCount = i, this.fn = e; + } + createFunction(e) { + return (...i) => { + if (i.length !== this.paramCount) + throw new Bt(e, At.WrongNumberOfParameters, null); + return this.fn(...i); + }; + } + call(e, i) { + return this.fn(...i.arguments); + } + marshalledCall(e, i, r, n) { + return n(e, i, (s, o, a) => { + a = a.map((c) => !du(c) || c instanceof Fx ? c : e4(c, e, n)); + const l = this.call(r, { arguments: a }); + return sf(l) ? l.then((c) => e4(c, r, n)) : l; + }); + } +}; +function qw(t, e, i) { + try { + return i(t, null, e.arguments); + } catch (r) { + throw r; + } +} +function js(t, e) { + try { + switch (e.type) { + case "EmptyStatement": + return "lc.voidOperation"; + case "VariableDeclarator": + return QDi(t, e); + case "VariableDeclaration": + return ZDi(t, e); + case "BlockStatement": + case "Program": + return UOe(t, e); + case "FunctionDeclaration": + return JDi(t, e); + case "ImportDeclaration": + return XDi(t, e); + case "ExportNamedDeclaration": + return KDi(t, e); + case "ReturnStatement": + return YDi(t, e); + case "IfStatement": + return CTt(t, e); + case "ExpressionStatement": + return qDi(t, e); + case "AssignmentExpression": + return WDi(t, e); + case "UpdateExpression": + return zDi(t, e); + case "BreakStatement": + return "break"; + case "ContinueStatement": + return "continue"; + case "TemplateLiteral": + return rFi(t, e); + case "TemplateElement": + return JSON.stringify(e.value ? e.value.cooked : ""); + case "ForStatement": + return UDi(t, e); + case "ForInStatement": + return GDi(t, e); + case "WhileStatement": + return HDi(t, e); + case "Identifier": + return oFi(t, e); + case "MemberExpression": + return eFi(t, e); + case "Literal": + return e.value === null || e.value === void 0 ? "null" : JSON.stringify(e.value); + case "CallExpression": + return aFi(t, e); + case "UnaryExpression": + return tFi(t, e); + case "BinaryExpression": + return nFi(t, e); + case "LogicalExpression": + return sFi(t, e); + case "ArrayExpression": + return iFi(t, e); + case "ObjectExpression": + return VDi(t, e); + case "Property": + return jDi(t, e); + case "Array": + throw new k0(t, At.NeverReach, e); + default: + throw new k0(t, At.Unrecognised, e); + } + } catch (i) { + throw i; + } +} +function VDi(t, e) { + let i = "lang.dictionary(["; + for (let r = 0; r < e.properties.length; r++) { + const n = e.properties[r]; + Lb(n.key.name), r > 0 && (i += ","), i += "lang.strCheck(" + (n.key.type === "Identifier" ? "'" + n.key.name + "'" : js(t, n.key)) + ",'ObjectExpression'),lang.aCheck(" + js(t, n.value) + ", 'ObjectExpression')"; + } + return i += "])", i; +} +function jDi(t, e) { + throw new k0(t, At.NeverReach, e); +} +function GDi(t, e) { + const i = XE(t), r = XE(t), n = XE(t); + let s = "var " + i + " = " + js(t, e.right) + `; +`; + e.left.type === "VariableDeclaration" && (s += js(t, e.left)); + let o = e.left.type === "VariableDeclaration" ? e.left.declarations[0].id.name : e.left.name; + o = o.toLowerCase(), Lb(o); + let a = ""; + t.localScope !== null && (t.localScope[o] !== void 0 ? a = "lscope['" + o + "']" : t.localScope._SymbolsMap[o] !== void 0 && (a = "lscope['" + t.localScope._SymbolsMap[o] + "']")); + let l = ""; + if (a === "") { + if (t.globalScope[o] !== void 0) + a = "gscope['" + o + "']"; + else if (t.globalScope._SymbolsMap[o] !== void 0) + a = "gscope['" + t.globalScope._SymbolsMap[o] + "']"; + else if (t.localScope !== null) + if (t.undeclaredGlobalsInFunctions.has(o)) + a = "gscope['" + t.undeclaredGlobalsInFunctions.get(o).manglename + "']", l = t.undeclaredGlobalsInFunctions.get(o).manglename; + else { + const c = { manglename: QS(t), node: e.left }; + t.undeclaredGlobalsInFunctions.set(o, c), a = "gscope['" + c.manglename + "']", l = c.manglename; + } + } + return l && (s += "lang.chkAssig('" + l + `',runtimeCtx); +`), s += "if (" + i + `===null) { lastStatement = lc.voidOperation; } + `, s += "else if (lc.isArray(" + i + ") || lc.isString(" + i + ")) {", s += "var " + r + "=" + i + `.length; +`, s += "for(var " + n + "=0; " + n + "<" + r + "; " + n + `++) { +`, s += a + "=" + n + `; +`, s += js(t, e.body), s += ` +} +`, s += ` lastStatement = lc.voidOperation; +`, s += ` +} +`, s += "else if (lc.isImmutableArray(" + i + ")) {", s += "var " + r + "=" + i + `.length(); +`, s += "for(var " + n + "=0; " + n + "<" + r + "; " + n + `++) { +`, s += a + "=" + n + `; +`, s += js(t, e.body), s += ` +} +`, s += ` lastStatement = lc.voidOperation; +`, s += ` +} +`, s += "else if (( " + i + " instanceof lang.Dictionary) || ( " + i + " instanceof lang.Feature)) {", s += "var " + r + "=" + i + `.keys(); +`, s += "for(var " + n + "=0; " + n + "<" + r + ".length; " + n + `++) { +`, s += a + "=" + r + "[" + n + `]; +`, s += js(t, e.body), s += ` +} +`, s += ` lastStatement = lc.voidOperation; +`, s += ` +} +`, t.isAsync && (s += "else if (lc.isFeatureSet(" + i + ")) {", s += "var " + r + "=" + i + `.iterator(runtimeCtx.abortSignal); +`, s += "for(var " + n + "=lang. graphicToFeature( yield " + r + ".next()," + i + ", runtimeCtx); " + n + "!=null; " + n + "=lang. graphicToFeature( yield " + r + ".next()," + i + `, runtimeCtx)) { +`, s += a + "=" + n + `; +`, s += js(t, e.body), s += ` +} +`, s += ` lastStatement = lc.voidOperation; +`, s += ` +} +`), s += `else { lastStatement = lc.voidOperation; } +`, s; +} +function UDi(t, e) { + let i = `lastStatement = lc.voidOperation; +`; + e.init !== null && (i += js(t, e.init) + "; "); + const r = XE(t), n = XE(t); + return i += "var " + r + " = true; ", i += ` + do { `, e.update !== null && (i += " if (" + r + `===false) { + ` + js(t, e.update) + ` +} + ` + r + `=false; +`), e.test !== null && (i += "var " + n + " = " + js(t, e.test) + "; ", i += "if (" + n + "===false) { break; } else if (" + n + "!==true) { lang.error('" + At.BooleanConditionRequired + `'); } +`), i += js(t, e.body), e.update !== null && (i += ` + ` + js(t, e.update)), i += ` +` + r + ` = true; +} while(true); lastStatement = lc.voidOperation; `, i; +} +function zDi(t, e) { + let i = null, r = ""; + if (e.argument.type === "MemberExpression") + return i = js(t, e.argument.object), e.argument.computed === !0 ? r = js(t, e.argument.property) : (r = "'" + e.argument.property.name + "'", Lb(e.argument.property.name)), "lang.memberupdate(" + i + "," + r + ",'" + e.operator + "'," + e.prefix + ")"; + if (i = e.argument.name.toLowerCase(), Lb(i), t.localScope !== null) { + if (t.localScope[i] !== void 0) + return "lang.update(lscope, '" + i + "','" + e.operator + "'," + e.prefix + ")"; + if (t.localScope._SymbolsMap[i] !== void 0) + return "lang.update(lscope, '" + t.localScope._SymbolsMap[i] + "','" + e.operator + "'," + e.prefix + ")"; + } + if (t.globalScope[i] !== void 0) + return "lang.update(gscope, '" + i + "','" + e.operator + "'," + e.prefix + ")"; + if (t.globalScope._SymbolsMap[i] !== void 0) + return "lang.update(gscope, '" + t.globalScope._SymbolsMap[i] + "','" + e.operator + "'," + e.prefix + ")"; + if (t.localScope !== null) { + if (t.undeclaredGlobalsInFunctions.has(i)) + return "lang.update(gscope,lang.chkAssig( '" + t.undeclaredGlobalsInFunctions.get(i).manglename + "',runtimeCtx),'" + e.operator + "'," + e.prefix + ")"; + const n = { manglename: QS(t), node: e.argument }; + return t.undeclaredGlobalsInFunctions.set(i, n), "lang.update(gscope, lang.chkAssig('" + n.manglename + "',runtimeCtx),'" + e.operator + "'," + e.prefix + ")"; + } + throw new Bt(t, At.InvalidIdentifier, e); +} +function HDi(t, e) { + let i = `lastStatement = lc.voidOperation; +`; + const r = XE(t); + return i += ` + var ${r} = true; + do { + ${r} = ${js(t, e.test)}; + if (${r}==false) { + break; + } + if (${r}!==true) { + lang.error('${At.BooleanConditionRequired}'); + } + ${js(t, e.body)} + } + while (${r} !== false); + lastStatement = lc.voidOperation; + `, i; +} +function WDi(t, e) { + const i = js(t, e.right); + let r = null, n = ""; + if (e.left.type === "MemberExpression") + return r = js(t, e.left.object), e.left.computed === !0 ? n = js(t, e.left.property) : (n = "'" + e.left.property.name + "'", Lb(e.left.property.name)), "lang.assignmember(" + r + "," + n + ",'" + e.operator + "'," + i + ")"; + if (r = e.left.name.toLowerCase(), Lb(r), t.localScope !== null) { + if (t.localScope[r] !== void 0) + return "lscope['" + r + "']=lang.assign(" + i + ",'" + e.operator + "', lscope['" + r + "'])"; + if (t.localScope._SymbolsMap[r] !== void 0) + return "lscope['" + t.localScope._SymbolsMap[r] + "']=lang.assign(" + i + ",'" + e.operator + "', lscope['" + t.localScope._SymbolsMap[r] + "'])"; + } + if (t.globalScope[r] !== void 0) + return "gscope['" + r + "']=lang.assign(" + i + ",'" + e.operator + "', gscope['" + r + "'])"; + if (t.globalScope._SymbolsMap[r] !== void 0) + return "gscope['" + t.globalScope._SymbolsMap[r] + "']=lang.assign(" + i + ",'" + e.operator + "', gscope['" + t.globalScope._SymbolsMap[r] + "'])"; + if (t.localScope !== null) { + if (t.undeclaredGlobalsInFunctions.has(r)) + return "gscope[lang.chkAssig('" + t.undeclaredGlobalsInFunctions.get(r).manglename + "',runtimeCtx)]=lang.assign(" + i + ",'" + e.operator + "', gscope['" + t.undeclaredGlobalsInFunctions.get(r).manglename + "'])"; + const s = { manglename: QS(t), node: e.argument }; + return t.undeclaredGlobalsInFunctions.set(r, s), "gscope[lang.chkAssig('" + s.manglename + "',runtimeCtx)]=lang.assign(" + i + ",'" + e.operator + "', gscope['" + s.manglename + "'])"; + } + throw new Bt(t, At.InvalidIdentifier, e); +} +function qDi(t, e) { + return e.expression.type === "AssignmentExpression" ? "lastStatement = lc.voidOperation; " + js(t, e.expression) + `; + ` : (e.expression.type, "lastStatement = " + js(t, e.expression) + "; "); +} +function MKe(t, e) { + return e.type === "BlockStatement" ? js(t, e) : e.type === "ReturnStatement" || e.type === "BreakStatement" || e.type === "ContinueStatement" ? js(t, e) + "; " : e.type === "UpdateExpression" ? "lastStatement = " + js(t, e) + "; " : e.type === "ExpressionStatement" ? js(t, e) : e.type === "ObjectExpression" ? "lastStatement = " + js(t, e) + "; " : js(t, e) + "; "; +} +function CTt(t, e) { + if (e.test.type === "AssignmentExpression" || e.test.type === "UpdateExpression") + throw new k0(t, At.BooleanConditionRequired, e); + return `if (lang.mustBoolean(${js(t, e.test)}, runtimeCtx) === true) { + ${MKe(t, e.consequent)} + } ` + (e.alternate !== null ? e.alternate.type === "IfStatement" ? " else " + CTt(t, e.alternate) : ` else { + ${MKe(t, e.alternate)} + } +` : ` else { + lastStatement = lc.voidOperation; + } +`); +} +function UOe(t, e) { + let i = ""; + for (let r = 0; r < e.body.length; r++) + e.body[r].type !== "EmptyStatement" && (e.body[r].type === "ReturnStatement" || e.body[r].type === "BreakStatement" || e.body[r].type === "ContinueStatement" ? i += js(t, e.body[r]) + `; +` : e.body[r].type === "UpdateExpression" || e.body[r].type === "ObjectExpression" ? i += "lastStatement = " + js(t, e.body[r]) + `; +` : i += js(t, e.body[r]) + ` +`); + return i; +} +function YDi(t, e) { + return e.argument === null ? "return lc.voidOperation" : "return " + js(t, e.argument); +} +function XDi(t, e) { + const i = e.specifiers[0].local.name.toLowerCase(); + Lb(i); + const r = t.libraryResolver?.loadLibrary(i), n = QS(t); + t.moduleFactory[r.uri] === void 0 && (t.moduleFactory[r.uri] = pFi(r.syntax, { interceptor: t.interceptor, services: t.services, moduleFactory: t.moduleFactory, lrucache: t.lrucache, timeReference: t.timeReference ?? null, libraryResolver: t.libraryResolver, customfunctions: t.customfunctions, vars: {} }, t.isAsync)), t.moduleFactoryMap[n] = r.uri; + let s = ""; + if (s = t.isAsync ? "(yield lang.loadModule('" + n + "', runtimeCtx) ); " : "lang.loadModule('" + n + "', runtimeCtx); ", t.globalScope[i] !== void 0) + return "gscope['" + i + "']=" + s; + if (t.globalScope._SymbolsMap[i] !== void 0) + return "gscope['" + t.globalScope._SymbolsMap[i] + "']=" + s; + let o = ""; + return t.undeclaredGlobalsInFunctions.has(i) ? (o = t.undeclaredGlobalsInFunctions.get(i).manglename, t.undeclaredGlobalsInFunctions.delete(i)) : o = QS(t), t.globalScope._SymbolsMap[i] = o, t.mangleMap[i] = o, "gscope[lang.setAssig('" + o + "', runtimeCtx)]=" + s; +} +function KDi(t, e) { + const i = js(t, e.declaration); + if (e.declaration.type === "FunctionDeclaration") + t.exports[e.declaration.id.name.toLowerCase()] = "function"; + else if (e.declaration.type === "VariableDeclaration") + for (const r of e.declaration.declarations) + t.exports[r.id.name.toLowerCase()] = "variable"; + return i; +} +function Lb(t) { + if (t === "iif") + throw new Owe(); + if (t === "decode") + throw new Owe(); + if (t === "when") + throw new Owe(); +} +function JDi(t, e) { + const i = e.id.name.toLowerCase(); + Lb(i); + let r = "", n = !1; + t.globalScope[i] !== void 0 ? r = i : t.globalScope._SymbolsMap[i] !== void 0 ? r = t.globalScope._SymbolsMap[i] : t.undeclaredGlobalsInFunctions.has(i) ? (r = t.undeclaredGlobalsInFunctions.get(i).manglename, t.globalScope._SymbolsMap[i] = r, t.mangleMap[i] = r, t.undeclaredGlobalsInFunctions.delete(i), n = !0) : (r = QS(t), t.globalScope._SymbolsMap[i] = r, t.mangleMap[i] = r); + const s = { isAsync: t.isAsync, console: t.console, exports: t.exports, undeclaredGlobalsInFunctions: t.undeclaredGlobalsInFunctions, customfunctions: t.customfunctions, moduleFactory: t.moduleFactory, moduleFactoryMap: t.moduleFactoryMap, libraryResolver: t.libraryResolver, lrucache: t.lrucache, interceptor: t.interceptor, services: t.services, symbols: t.symbols, mangleMap: t.mangleMap, localScope: { _SymbolsMap: {} }, depthCounter: t.depthCounter, globalScope: t.globalScope }; + let o = `new lang.UserDefinedCompiledFunction( lang.functionDepthchecker(function() { var lastStatement = lc.voidOperation; + var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1]; +`; + for (let a = 0; a < e.params.length; a++) { + const l = e.params[a].name.toLowerCase(); + Lb(l); + const c = QS(t); + s.localScope._SymbolsMap[l] = c, s.mangleMap[l] = c, o += "lscope['" + c + "']=arguments[" + a.toString() + `]; +`; + } + return t.isAsync === !0 ? (o += `return lang.__awaiter(this, void 0, void 0, function* () { +`, o += UOe(s, e.body) + ` + return lastStatement; `, o += "}); }", o += ", runtimeCtx)," + e.params.length + ")", o += ` + lastStatement = lc.voidOperation; +`) : (o += UOe(s, e.body) + ` + return lastStatement; }, runtimeCtx),` + e.params.length + ")", o += ` + lastStatement = lc.voidOperation; +`), n ? "gscope[lang.setAssig('" + r + "', runtimeCtx)]=" + o : "gscope['" + r + "']=" + o; +} +function ZDi(t, e) { + const i = []; + for (let r = 0; r < e.declarations.length; r++) + i.push(js(t, e.declarations[r])); + return i.join(` +`) + ` + lastStatement= lc.voidOperation; +`; +} +function QDi(t, e) { + let i = e.init === null ? null : js(t, e.init); + i === en && (i = null); + const r = e.id.name.toLowerCase(); + if (Lb(r), t.localScope !== null) { + if (t.localScope[r] !== void 0) + return "lscope['" + r + "']=" + i + "; "; + if (t.localScope._SymbolsMap[r] !== void 0) + return "lscope['" + t.localScope._SymbolsMap[r] + "']=" + i + "; "; + { + const s = QS(t); + return t.localScope._SymbolsMap[r] = s, t.mangleMap[r] = s, "lscope['" + s + "']=" + i + "; "; + } + } + if (t.globalScope[r] !== void 0) + return "gscope['" + r + "']=" + i + "; "; + if (t.globalScope._SymbolsMap[r] !== void 0) + return "gscope['" + t.globalScope._SymbolsMap[r] + "']=" + i + "; "; + if (t.undeclaredGlobalsInFunctions.has(r)) { + const s = t.undeclaredGlobalsInFunctions.get(r).manglename; + return t.globalScope._SymbolsMap[r] = s, t.mangleMap[r] = s, t.undeclaredGlobalsInFunctions.delete(r), "gscope[lang.setAssig('" + s + "', runtimeCtx)]=" + i + "; "; + } + const n = QS(t); + return t.globalScope._SymbolsMap[r] = n, t.mangleMap[r] = n, "gscope['" + n + "']=" + i + "; "; +} +function eFi(t, e) { + try { + let i; + return e.computed === !0 ? i = js(t, e.property) : (i = "'" + e.property.name + "'", Lb(e.property.name)), "lang.member(" + js(t, e.object) + "," + i + ")"; + } catch (i) { + throw i; + } +} +function tFi(t, e) { + try { + return "lang.unary(" + js(t, e.argument) + ",'" + e.operator + "')"; + } catch (i) { + throw i; + } +} +function iFi(t, e) { + try { + const i = []; + for (let r = 0; r < e.elements.length; r++) + e.elements[r].type === "Literal" ? i.push(js(t, e.elements[r])) : i.push("lang.aCheck(" + js(t, e.elements[r]) + ",'ArrayExpression')"); + return "[" + i.join(",") + "]"; + } catch (i) { + throw i; + } +} +function rFi(t, e) { + try { + const i = []; + let r = 0; + for (const n of e.quasis) + i.push(n.value ? JSON.stringify(n.value.cooked) : JSON.stringify("")), n.tail === !1 && (i.push(e.expressions[r] ? "lang.castString(lang.aCheck(" + js(t, e.expressions[r]) + ", 'TemplateLiteral'))" : ""), r++); + return "([" + i.join(",") + "]).join('')"; + } catch (i) { + throw i; + } +} +function nFi(t, e) { + try { + return "lang.binary(" + js(t, e.left) + "," + js(t, e.right) + ",'" + e.operator + "')"; + } catch (i) { + throw i; + } +} +function sFi(t, e) { + try { + if (e.left.type === "AssignmentExpression" || e.left.type === "UpdateExpression") + throw new k0(t, At.LogicalExpressionOnlyBoolean, e); + if (e.right.type === "AssignmentExpression" || e.right.type === "UpdateExpression") + throw new k0(t, At.LogicalExpressionOnlyBoolean, e); + if (e.operator === "&&" || e.operator === "||") + return "(lang.logicalCheck(" + js(t, e.left) + ") " + e.operator + " lang.logicalCheck(" + js(t, e.right) + "))"; + throw new k0(null, At.LogicExpressionOrAnd, null); + } catch (i) { + throw i; + } +} +function oFi(t, e) { + try { + const i = e.name.toLowerCase(); + if (Lb(i), t.localScope !== null) { + if (t.localScope[i] !== void 0) + return "lscope['" + i + "']"; + if (t.localScope._SymbolsMap[i] !== void 0) + return "lscope['" + t.localScope._SymbolsMap[i] + "']"; + } + if (t.globalScope[i] !== void 0) + return "gscope['" + i + "']"; + if (t.globalScope._SymbolsMap[i] !== void 0) + return "gscope['" + t.globalScope._SymbolsMap[i] + "']"; + if (t.localScope !== null) { + if (t.undeclaredGlobalsInFunctions.has(i)) + return "gscope[lang.chkAssig('" + t.undeclaredGlobalsInFunctions.get(i).manglename + "',runtimeCtx)]"; + const r = { manglename: QS(t), node: e.argument }; + return t.undeclaredGlobalsInFunctions.set(i, r), "gscope[lang.chkAssig('" + r.manglename + "',runtimeCtx)]"; + } + throw new k0(t, At.InvalidIdentifier, e); + } catch (i) { + throw i; + } +} +function aFi(t, e) { + try { + if (e.callee.type === "MemberExpression") { + let n; + e.callee.computed === !0 ? n = js(t, e.callee.property) : (n = "'" + e.callee.property.name + "'", Lb(e.callee.property.name)); + let s = "["; + for (let o = 0; o < e.arguments.length; o++) + o > 0 && (s += ", "), s += js(t, e.arguments[o]); + return s += "]", t.isAsync ? "(yield lang.callModuleFunction(" + js(t, e.callee.object) + "," + s + "," + n + ",runtimeCtx))" : "lang.callModuleFunction(" + js(t, e.callee.object) + "," + s + "," + n + ",runtimeCtx)"; + } + if (e.callee.type !== "Identifier") + throw new k0(t, At.FuncionNotFound, e); + const i = e.callee.name.toLowerCase(); + if (i === "iif") + return lFi(t, e); + if (i === "when") + return uFi(t, e); + if (i === "decode") + return cFi(t, e); + let r = ""; + if (t.localScope !== null && (t.localScope[i] !== void 0 ? r = "lscope['" + i + "']" : t.localScope._SymbolsMap[i] !== void 0 && (r = "lscope['" + t.localScope._SymbolsMap[i] + "']")), r === "") { + if (t.globalScope[i] !== void 0) + r = "gscope['" + i + "']"; + else if (t.globalScope._SymbolsMap[i] !== void 0) + r = "gscope['" + t.globalScope._SymbolsMap[i] + "']"; + else if (t.localScope !== null) + if (t.undeclaredGlobalsInFunctions.has(i)) + r = "gscope[lang.chkAssig('" + t.undeclaredGlobalsInFunctions.get(i).manglename + "',runtimeCtx)]"; + else { + const n = { manglename: QS(t), node: e.argument }; + t.undeclaredGlobalsInFunctions.set(i, n), r = "gscope[lang.chkAssig('" + n.manglename + "',runtimeCtx)]"; + } + } + if (r !== "") { + let n = "["; + for (let s = 0; s < e.arguments.length; s++) + s > 0 && (n += ", "), n += js(t, e.arguments[s]); + return n += "]", t.isAsync ? "(yield lang.callfunc(" + r + "," + n + ",runtimeCtx) )" : "lang.callfunc(" + r + "," + n + ",runtimeCtx)"; + } + throw new k0(t, At.FuncionNotFound, e); + } catch (i) { + throw i; + } +} +function lFi(t, e) { + try { + if (e.arguments.length !== 3) + throw new k0(t, At.WrongNumberOfParameters, e); + const i = XE(t); + return `${t.isAsync ? `(yield (function() { + return lang.__awaiter(this, void 0, void 0, function* () {` : "function() {"} + var ${i} = ${js(t, e.arguments[0])}; + + if (${i} === true) { + return ${js(t, e.arguments[1])}; + } + else if (${i} === false) { + return ${js(t, e.arguments[2])}; + } + else { + lang.error('ExecutionErrorCodes.BooleanConditionRequired'); + } + ${t.isAsync ? "})}()))" : "}()"}`; + } catch (i) { + throw i; + } +} +function uFi(t, e) { + try { + if (e.arguments.length < 3) + throw new k0(t, At.WrongNumberOfParameters, e); + if (e.arguments.length % 2 == 0) + throw new k0(t, At.WrongNumberOfParameters, e); + const i = XE(t); + let r = "var "; + for (let n = 0; n < e.arguments.length - 1; n += 2) + r += `${i} = lang.mustBoolean(${js(t, e.arguments[n])}, runtimeCtx); + if (${i} === true ) { + return ${js(t, e.arguments[n + 1])} + } +`; + return `${t.isAsync ? `(yield (function() { + return lang.__awaiter(this, void 0, void 0, function* () {` : "function() {"} + ${r} + return ${js(t, e.arguments[e.arguments.length - 1])} + ${t.isAsync ? "})}()))" : "}()"}`; + } catch (i) { + throw i; + } +} +function cFi(t, e) { + try { + if (e.arguments.length < 2) + throw new k0(t, At.WrongNumberOfParameters, e); + if (e.arguments.length === 2) + return `(${js(t, e.arguments[1])})`; + if ((e.arguments.length - 1) % 2 == 0) + throw new k0(t, At.WrongNumberOfParameters, e); + const i = XE(t), r = XE(t); + let n = "var "; + for (let s = 1; s < e.arguments.length - 1; s += 2) + n += `${r} = ${js(t, e.arguments[s])}; + if (lang.binary(${r}, ${i}, "==") === true ) { + return ${js(t, e.arguments[s + 1])} + } +`; + return `${t.isAsync ? `(yield (function() { + return lang.__awaiter(this, void 0, void 0, function* () {` : "function() {"} + var ${i} = ${js(t, e.arguments[0])}; + ${n} + return ${js(t, e.arguments[e.arguments.length - 1])} + ${t.isAsync ? "})}()))" : "}()"}`; + } catch (i) { + throw i; + } +} +const Ym = {}; +function QS(t) { + return t.symbols.symbolCounter++, "_T" + t.symbols.symbolCounter.toString(); +} +function XE(t) { + return t.symbols.symbolCounter++, "_Tvar" + t.symbols.symbolCounter.toString(); +} +T$e(Ym, qw), R$e(Ym, qw), A$e(Ym, qw), E$e(Ym, qw), P$e(Ym, qw), Ym.iif = function(t, e) { + try { + return qw(t, e, (i, r, n) => { + throw new Bt(t, At.Unrecognised, e); + }); + } catch (i) { + throw i; + } +}, Ym.decode = function(t, e) { + try { + return qw(t, e, (i, r, n) => { + throw new Bt(t, At.Unrecognised, e); + }); + } catch (i) { + throw i; + } +}, Ym.when = function(t, e) { + try { + return qw(t, e, (i, r, n) => { + throw new Bt(t, At.Unrecognised, e); + }); + } catch (i) { + throw i; + } +}; +const HU = {}; +for (const t in Ym) + HU[t] = new vI(Ym[t]); +I$e(Ym, qw); +for (const t in Ym) + Ym[t] = new vI(Ym[t]); +const M$e = function() { +}; +M$e.prototype = Ym; +const D$e = function() { +}; +function TTt(t, e, i) { + const r = {}; + t || (t = {}), i || (i = {}), r._SymbolsMap = {}, r.textformatting = 1, r.infinity = 1, r.pi = 1; + for (const n in e) + r[n] = 1; + for (const n in i) + r[n] = 1; + for (const n in t) + r[n] = 1; + return r; +} +function ETt(t, e, i, r) { + const n = i ? new D$e() : new M$e(); + t || (t = {}), e || (e = {}); + const s = new is({ newline: ` +`, tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" }); + s.immutable = !1, n._SymbolsMap = { textformatting: 1, infinity: 1, pi: 1 }, n.textformatting = s, n.infinity = Number.POSITIVE_INFINITY, n.pi = Math.PI; + for (const o in e) + n[o] = e[o], n._SymbolsMap[o] = 1; + for (const o in t) + n._SymbolsMap[o] = 1, t[o] && t[o].declaredClass === "esri.Graphic" ? n[o] = ph.createFromGraphic(t[o], r ?? null) : n[o] = t[o]; + return n; +} +D$e.prototype = HU; +function k$(t, e) { + const i = { mode: e, compiled: !0, functions: {}, signatures: [], standardFunction: qw, standardFunctionAsync: qw, evaluateIdentifier: hFi }; + for (let r = 0; r < t.length; r++) + t[r].registerFunctions(i); + if (e === "sync") { + for (const r in i.functions) + Ym[r] = new vI(i.functions[r]), M$e.prototype[r] = Ym[r]; + for (let r = 0; r < i.signatures.length; r++) + Hpe(i.signatures[r], "sync"); + } else { + for (const r in i.functions) + HU[r] = new vI(i.functions[r]), D$e.prototype[r] = HU[r]; + for (let r = 0; r < i.signatures.length; r++) + Hpe(i.signatures[r], "async"); + } +} +function hFi(t, e) { + const i = e.name; + if (i === "_SymbolsMap") + throw new Bt(t, At.InvalidIdentifier, null); + if (t.localStack.length > 0) { + if (i.substr(0, 2).toLowerCase() !== "_t" && t.localStack[t.localStack.length - 1][i] !== void 0) + return t.localStack[t.localStack.length - 1][i]; + const n = t.mangleMap[i]; + if (n !== void 0 && t.localStack[t.localStack.length - 1][n] !== void 0) + return t.localStack[t.localStack.length - 1][n]; + } + if (i.substr(0, 2).toLowerCase() !== "_t" && t.globalScope[i] !== void 0 || t.globalScope._SymbolsMap[i] === 1) + return t.globalScope[i]; + const r = t.mangleMap[i]; + return r !== void 0 ? t.globalScope[r] : void 0; +} +k$([Wpe], "sync"), k$([Wpe], "async"); +let Vwe = 0; +const ITt = { error(t) { + throw new Bt(null, t, null); +}, __awaiter: (t, e, i, r) => new Promise((n, s) => { + function o(c) { + try { + l(r.next(c)); + } catch (h) { + s(h); + } + } + function a(c) { + try { + l(r.throw(c)); + } catch (h) { + s(h); + } + } + function l(c) { + c.done ? n(c.value) : c.value && c.value.then ? c.value.then(o, a) : (Vwe++, Vwe % 100 == 0 ? setTimeout(() => { + Vwe = 0, o(c.value); + }, 0) : o(c.value)); + } + l((r = r.apply(t, e || [])).next()); +}), functionDepthchecker: (t, e) => function() { + if (e.depthCounter.depth++, e.localStack.push([]), e.depthCounter.depth > 64) + throw new Bt(null, At.MaximumCallDepth, null); + const i = t.apply(this, arguments); + return sf(i) ? i.then((r) => (e.depthCounter.depth--, e.localStack.length = e.localStack.length - 1, r)) : (e.depthCounter.depth--, e.localStack.length = e.localStack.length - 1, i); +}, chkAssig(t, e) { + if (e.gdefs[t] === void 0) + throw new Bt(e, At.InvalidIdentifier, null); + return t; +}, mustBoolean(t, e) { + if (t === !0 || t === !1) + return t; + throw new Bt(e, At.BooleanConditionRequired, null); +}, setAssig: (t, e) => (e.gdefs[t] = 1, t), castString: (t) => un(t), aCheck(t, e) { + if (du(t)) + throw e === "ArrayExpression" ? new Bt(null, At.NoFunctionInArray, null) : e === "ObjectExpression" ? new Bt(null, At.NoFunctionInDictionary, null) : new Bt(null, At.NoFunctionInTemplateLiteral, null); + return t === en ? null : t; +}, Dictionary: is, Feature: ph, UserDefinedCompiledFunction: BDi, dictionary(t) { + const e = {}, i = /* @__PURE__ */ new Map(); + for (let n = 0; n < t.length; n += 2) { + if (du(t[n + 1])) + throw new Bt(null, At.NoFunctionInDictionary, null); + if (wn(t[n]) === !1) + throw new Bt(null, At.KeyMustBeString, null); + let s = t[n].toString(); + const o = s.toLowerCase(); + i.has(o) ? s = i.get(o) : i.set(o, s), t[n + 1] === en ? e[s] = null : e[s] = t[n + 1]; + } + const r = new is(e); + return r.immutable = !1, r; +}, strCheck(t) { + if (wn(t) === !1) + throw new Bt(null, At.KeyMustBeString, null); + return t; +}, unary(t, e) { + if (ka(t)) { + if (e === "!") + return !t; + if (e === "-") + return -1 * Di(t); + if (e === "+") + return 1 * Di(t); + if (e === "~") + return ~Di(t); + throw new Bt(null, At.UnsupportedUnaryOperator, null); + } + if (e === "-") + return -1 * Di(t); + if (e === "+") + return 1 * Di(t); + if (e === "~") + return ~Di(t); + throw new Bt(null, At.UnsupportedUnaryOperator, null); +}, logicalCheck(t) { + if (ka(t) === !1) + throw new Bt(null, At.LogicExpressionOrAnd, null); + return t; +}, logical(t, e, i) { + if (ka(t) && ka(e)) + switch (i) { + case "||": + return t || e; + case "&&": + return t && e; + default: + throw new Bt(null, At.LogicExpressionOrAnd, null); + } + throw new Bt(null, At.LogicExpressionOrAnd, null); +}, binary(t, e, i) { + switch (i) { + case "|": + case "<<": + case ">>": + case ">>>": + case "^": + case "&": + return F0e(Di(t), Di(e), i); + case "==": + case "=": + return Bv(t, e); + case "!=": + return !Bv(t, e); + case "<": + case ">": + case "<=": + case ">=": + return D0e(t, e, i); + case "+": + return wn(t) || wn(e) ? un(t) + un(e) : Di(t) + Di(e); + case "-": + return Di(t) - Di(e); + case "*": + return Di(t) * Di(e); + case "/": + return Di(t) / Di(e); + case "%": + return Di(t) % Di(e); + default: + throw new Bt(null, At.UnsupportedOperator, null); + } +}, assign(t, e, i) { + switch (e) { + case "=": + return t === en ? null : t; + case "/=": + return Di(i) / Di(t); + case "*=": + return Di(i) * Di(t); + case "-=": + return Di(i) - Di(t); + case "+=": + return wn(i) || wn(t) ? un(i) + un(t) : Di(i) + Di(t); + case "%=": + return Di(i) % Di(t); + default: + throw new Bt(null, At.UnsupportedOperator, null); + } +}, update(t, e, i, r) { + const n = Di(t[e]); + return t[e] = i === "++" ? n + 1 : n - 1, r === !1 ? n : i === "++" ? n + 1 : n - 1; +}, graphicToFeature: (t, e, i) => t === null ? null : ph.createFromGraphicLikeObject(t.geometry, t.attributes, e, i.timeReference), memberupdate(t, e, i, r) { + let n; + if (Mn(t)) { + if (!il(e)) + throw new Bt(null, At.ArrayAccessorMustBeNumber, null); + if (e < 0 && (e = t.length + e), e < 0 || e >= t.length) + throw new Bt(null, At.OutOfBounds, null); + n = Di(t[e]), t[e] = i === "++" ? n + 1 : n - 1; + } else if (t instanceof is) { + if (wn(e) === !1) + throw new Bt(null, At.KeyAccessorMustBeString, null); + if (t.hasField(e) !== !0) + throw new Bt(null, At.FieldNotFound, null, { key: e }); + n = Di(t.field(e)), t.setField(e, i === "++" ? n + 1 : n - 1); + } else if (bu(t)) { + if (wn(e) === !1) + throw new Bt(null, At.KeyAccessorMustBeString, null); + if (t.hasField(e) !== !0) + throw new Bt(null, At.FieldNotFound, null); + n = Di(t.field(e)), t.setField(e, i === "++" ? n + 1 : n - 1); + } else { + if (Es(t)) + throw new Bt(null, At.Immutable, null); + if (!(t instanceof uX)) + throw new Bt(null, At.InvalidIdentifier, null); + if (wn(e) === !1) + throw new Bt(null, At.ModuleAccessorMustBeString, null); + if (t.hasGlobal(e) !== !0) + throw new Bt(null, At.ModuleExportNotFound, null); + n = Di(t.global(e)), t.setGlobal(e, i === "++" ? n + 1 : n - 1); + } + return r === !1 ? n : i === "++" ? n + 1 : n - 1; +}, assignmember(t, e, i, r) { + if (Mn(t)) { + if (!il(e)) + throw new Bt(null, At.ArrayAccessorMustBeNumber, null); + if (e < 0 && (e = t.length + e), e < 0 || e > t.length) + throw new Bt(null, At.OutOfBounds, null); + if (e === t.length) { + if (i !== "=") + throw new Bt(null, At.OutOfBounds, null); + t[e] = this.assign(r, i, t[e]); + } else + t[e] = this.assign(r, i, t[e]); + } else if (t instanceof is) { + if (wn(e) === !1) + throw new Bt(null, At.KeyAccessorMustBeString, null); + if (t.hasField(e) === !0) + t.setField(e, this.assign(r, i, t.field(e))); + else { + if (i !== "=") + throw new Bt(null, At.FieldNotFound, null); + t.setField(e, this.assign(r, i, null)); + } + } else if (bu(t)) { + if (wn(e) === !1) + throw new Bt(null, At.KeyAccessorMustBeString, null); + if (t.hasField(e) === !0) + t.setField(e, this.assign(r, i, t.field(e))); + else { + if (i !== "=") + throw new Bt(null, At.FieldNotFound, null); + t.setField(e, this.assign(r, i, null)); + } + } else { + if (Es(t)) + throw new Bt(null, At.Immutable, null); + if (!(t instanceof uX)) + throw new Bt(null, At.InvalidIdentifier, null); + if (wn(e) === !1) + throw new Bt(null, At.ModuleAccessorMustBeString, null); + if (!t.hasGlobal(e)) + throw new Bt(null, At.ModuleExportNotFound, null); + t.setGlobal(e, this.assign(r, i, t.global(e))); + } +}, member(t, e) { + if (t === null) + throw new Bt(null, At.MemberOfNull, null); + if (t instanceof is || bu(t)) { + if (wn(e)) + return t.field(e); + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + if (t instanceof tn) { + if (wn(e)) + return N$(t, e, null, null); + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + if (Mn(t)) { + if (il(e) && isFinite(e) && Math.floor(e) === e) { + if (e < 0 && (e = t.length + e), e >= t.length || e < 0) + throw new Bt(null, At.OutOfBounds, null); + return t[e]; + } + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + if (wn(t)) { + if (il(e) && isFinite(e) && Math.floor(e) === e) { + if (e < 0 && (e = t.length + e), e >= t.length || e < 0) + throw new Bt(null, At.OutOfBounds, null); + return t[e]; + } + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + if (Es(t)) { + if (il(e) && isFinite(e) && Math.floor(e) === e) { + if (e < 0 && (e = t.length() + e), e >= t.length() || e < 0) + throw new Bt(null, At.OutOfBounds, null); + return t.get(e); + } + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + if (t instanceof uX) { + if (wn(e)) + return t.global(e); + throw new Bt(null, At.InvalidMemberAccessKey, null); + } + throw new Bt(null, At.InvalidMemberAccessKey, null); +}, callfunc: (t, e, i) => t.call(i, { arguments: e, preparsed: !0 }), loadModule(t, e) { + const i = e.moduleFactoryMap[t]; + if (e.moduleSingletons[i]) + return e.moduleSingletons[i]; + const r = e.moduleFactory[i]({ vars: {}, moduleSingletons: e.moduleSingletons, depthCounter: e.depthCounter, console: e.console, abortSignal: e.abortSignal, isAsync: e.isAsync, services: e.services, lrucache: e.lrucache, timeReference: e.timeReference ? e.timeReference : null, interceptor: e.interceptor }, e.spatialReference); + return e.moduleSingletons[i] = r, r; +}, callModuleFunction(t, e, i, r) { + if (!(t instanceof uX)) + throw new Bt(null, At.FuncionNotFound, null); + const n = t.global(i); + if (du(n) === !1) + throw new Bt(null, At.CallNonFunction, null); + return n.call(r, { preparsed: !0, arguments: e }); +} }; +function Xpe(t) { + console.log(t); +} +function ATt(t, e, i = !1) { + e === null && (e = { vars: {}, customfunctions: {} }); + let r = null; + t.usesModules && (r = new Jz(null, t.loadedModules)); + const n = { isAsync: i, globalScope: TTt(e.vars, i ? HU : Ym, e.customfunctions), moduleFactory: {}, moduleFactoryMap: {}, undeclaredGlobalsInFunctions: /* @__PURE__ */ new Map(), customfunctions: e.customfunctions, libraryResolver: r, localScope: null, mangleMap: {}, depthCounter: { depth: 1 }, exports: {}, console: Xpe, lrucache: e.lrucache, timeReference: e.timeReference ?? null, interceptor: e.interceptor, services: e.services, symbols: { symbolCounter: 0 } }; + let s = js(n, t); + s === "" && (s = "lc.voidOperation; "), n.undeclaredGlobalsInFunctions.size > 0 && n.undeclaredGlobalsInFunctions.forEach((y) => { + throw new k0(e, At.InvalidIdentifier, y.node); + }); + let o = ""; + o = i ? `var runtimeCtx=this.prepare(context, true); + var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; +return lang.__awaiter(this, void 0, void 0, function* () { + + function mainBody() { + var lastStatement=lc.voidOperation; + return lang.__awaiter(this, void 0, void 0, function* () { +` + s + ` + return lastStatement; }); } + return this.postProcess(yield mainBody()); }); ` : `var runtimeCtx=this.prepare(context, false); + var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; + function mainBody() { + var lastStatement=lc.voidOperation; + ` + s + ` + return lastStatement; } + return this.postProcess(mainBody()); `; + const a = n.moduleFactory, l = n.moduleFactoryMap, c = n.exports, h = {}; + for (const y in c) + h[y] = n.mangleMap[y] !== void 0 ? n.mangleMap[y] : y; + const p = { lc: hTt, lang: ITt, mangles: n.mangleMap, postProcess(y) { + if (y instanceof hd && (y = y.value), y instanceof _I && (y = y.value), y === en && (y = null), y === xm) + throw new Bt(null, At.IllegalResult, null); + if (y === jI) + throw new Bt(null, At.IllegalResult, null); + if (du(y)) + throw new Bt(null, At.IllegalResult, null); + return y; + }, prepare(y, v) { + let x = y.spatialReference; + x == null && (x = or.WebMercator); + const I = ETt(y.vars, y.customfunctions, v, y.timeReference); + return { localStack: [], isAsync: v, moduleFactory: a, moduleFactoryMap: l, mangleMap: this.mangles, moduleSingletons: {}, exports: c, gdefs: {}, exportmangle: h, spatialReference: x, globalScope: I, abortSignal: y.abortSignal === void 0 || y.abortSignal === null ? { aborted: !1 } : y.abortSignal, localScope: null, services: y.services, console: y.console ? y.console : Xpe, lrucache: y.lrucache, timeReference: y.timeReference ?? null, interceptor: y.interceptor, symbols: { symbolCounter: 0 }, depthCounter: { depth: 1 } }; + } }; + return new Function("context", "spatialReference", o).bind(p); +} +async function dFi() { + return k$([await Promise.resolve().then(() => KOr)], "async"), !0; +} +let uX = class extends jie { + constructor(e) { + super(null), this.moduleContext = e; + } + hasGlobal(e) { + return this.moduleContext.exports[e] === void 0 && (e = e.toLowerCase()), this.moduleContext.exports[e] !== void 0; + } + setGlobal(e, i) { + const r = this.moduleContext.globalScope, n = e.toLowerCase(); + if (du(i)) + throw new Bt(null, At.AssignModuleFunction, null); + r[this.moduleContext.exportmangle[n]] = i; + } + global(e) { + const i = this.moduleContext.globalScope; + e = e.toLowerCase(); + const r = i[this.moduleContext.exportmangle[e]]; + if (r === void 0) + throw new Bt(null, At.InvalidIdentifier, null); + if (du(r) && !(r instanceof Fx)) { + const n = new Fx(); + return n.fn = r, n.parameterEvaluator = qw, n.context = this.moduleContext, i[this.moduleContext.exportmangle[e]] = n, n; + } + return r; + } +}; +function pFi(t, e, i = !1) { + const r = { isAsync: i, moduleFactory: e.moduleFactory, moduleFactoryMap: {}, libraryResolver: new Jz(null, t.loadedModules), globalScope: TTt(e.vars, i ? HU : Ym, e.customfunctions), customfunctions: e.customfunctions, localScope: null, mangleMap: {}, undeclaredGlobalsInFunctions: /* @__PURE__ */ new Map(), depthCounter: { depth: 1 }, exports: {}, console: Xpe, lrucache: e.lrucache, timeReference: e.timeReference ?? null, interceptor: e.interceptor, services: e.services, symbols: { symbolCounter: 0 } }; + let n = js(r, t); + n === "" && (n = "lc.voidOperation; "); + let s = ""; + s = i ? `var runtimeCtx=this.prepare(context, true); + var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; +return lang.__awaiter(this, void 0, void 0, function* () { + + function mainBody() { + var lastStatement=lc.voidOperation; + return lang.__awaiter(this, void 0, void 0, function* () { +` + n + ` + return lastStatement; }); } + yield mainBody(); + return this.prepareModule(runtimeCtx); }); ` : `var runtimeCtx=this.prepare(context, false); + var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; + function mainBody() { + var lastStatement=lc.voidOperation; + ` + n + ` + return lastStatement; } + mainBody(); + return this.prepareModule(runtimeCtx); `; + const o = r.moduleFactory, a = r.moduleFactoryMap, l = r.exports, c = {}; + for (const p in l) + c[p] = r.mangleMap[p] !== void 0 ? r.mangleMap[p] : p; + const h = { lc: hTt, lang: ITt, mangles: r.mangleMap, prepareModule: (p) => new uX(p), prepare(p, y) { + let v = p.spatialReference; + v == null && (v = new or({ wkid: 102100 })); + const x = ETt(p.vars, p.customfunctions, y, p.timeReference); + return { localStack: [], isAsync: y, exports: l, exportmangle: c, gdefs: {}, moduleFactory: o, moduleFactoryMap: a, moduleSingletons: p.moduleSingletons, mangleMap: this.mangles, spatialReference: v, globalScope: x, abortSignal: p.abortSignal === void 0 || p.abortSignal === null ? { aborted: !1 } : p.abortSignal, localScope: null, services: p.services, console: p.console ? p.console : Xpe, lrucache: p.lrucache, timeReference: p.timeReference ?? null, interceptor: p.interceptor, symbols: { symbolCounter: 0 }, depthCounter: p.depthCounter }; + } }; + return new Function("context", "spatialReference", s).bind(h); +} +var Ra, hs; +(function(t) { + t.Break = "break", t.Continue = "continue", t.Else = "else", t.False = "false", t.For = "for", t.From = "from", t.Function = "function", t.If = "if", t.Import = "import", t.Export = "export", t.In = "in", t.Null = "null", t.Return = "return", t.True = "true", t.Var = "var", t.While = "while"; +})(Ra || (Ra = {})), function(t) { + t.AssignmentExpression = "AssignmentExpression", t.ArrayExpression = "ArrayExpression", t.BlockComment = "BlockComment", t.BlockStatement = "BlockStatement", t.BinaryExpression = "BinaryExpression", t.BreakStatement = "BreakStatement", t.CallExpression = "CallExpression", t.ContinueStatement = "ContinueStatement", t.EmptyStatement = "EmptyStatement", t.ExpressionStatement = "ExpressionStatement", t.ExportNamedDeclaration = "ExportNamedDeclaration", t.ExportSpecifier = "ExportSpecifier", t.ForStatement = "ForStatement", t.ForInStatement = "ForInStatement", t.FunctionDeclaration = "FunctionDeclaration", t.Identifier = "Identifier", t.IfStatement = "IfStatement", t.ImportDeclaration = "ImportDeclaration", t.ImportDefaultSpecifier = "ImportDefaultSpecifier", t.LineComment = "LineComment", t.Literal = "Literal", t.LogicalExpression = "LogicalExpression", t.MemberExpression = "MemberExpression", t.ObjectExpression = "ObjectExpression", t.Program = "Program", t.Property = "Property", t.ReturnStatement = "ReturnStatement", t.TemplateElement = "TemplateElement", t.TemplateLiteral = "TemplateLiteral", t.UnaryExpression = "UnaryExpression", t.UpdateExpression = "UpdateExpression", t.VariableDeclaration = "VariableDeclaration", t.VariableDeclarator = "VariableDeclarator", t.WhileStatement = "WhileStatement"; +}(hs || (hs = {})); +const zOe = ["++", "--"], PTt = ["-", "+", "!", "~"], OTt = ["=", "/=", "*=", "%=", "+=", "-="], RTt = ["||", "&&"], fFi = ["|", "&", ">>", "<<", ">>>", "^", "==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "%"], mFi = { "||": 1, "&&": 2, "|": 3, "^": 4, "&": 5, "==": 6, "!=": 6, "<": 7, ">": 7, "<=": 7, ">=": 7, "<<": 8, ">>": 8, ">>>": 8, "+": 9, "-": 9, "*": 10, "/": 10, "%": 10 }; +var ws; +(function(t) { + t[t.Unknown = 0] = "Unknown", t[t.BooleanLiteral = 1] = "BooleanLiteral", t[t.EOF = 2] = "EOF", t[t.Identifier = 3] = "Identifier", t[t.Keyword = 4] = "Keyword", t[t.NullLiteral = 5] = "NullLiteral", t[t.NumericLiteral = 6] = "NumericLiteral", t[t.Punctuator = 7] = "Punctuator", t[t.StringLiteral = 8] = "StringLiteral", t[t.Template = 10] = "Template"; +})(ws || (ws = {})); +const gFi = ["Unknown", "Boolean", "", "Identifier", "Keyword", "Null", "Numeric", "Punctuator", "String", "RegularExpression", "Template"]; +var es; +(function(t) { + t.InvalidModuleUri = "InvalidModuleUri", t.ForInOfLoopInitializer = "ForInOfLoopInitializer", t.IdentiferExpected = "IdentiferExpected", t.InvalidEscapedReservedWord = "InvalidEscapedReservedWord", t.InvalidExpression = "InvalidExpression", t.InvalidFunctionIdentifier = "InvalidFunctionIdentifier", t.InvalidHexEscapeSequence = "InvalidHexEscapeSequence", t.InvalidLeftHandSideInAssignment = "InvalidLeftHandSideInAssignment", t.InvalidLeftHandSideInForIn = "InvalidLeftHandSideInForIn", t.InvalidTemplateHead = "InvalidTemplateHead", t.InvalidVariableAssignment = "InvalidVariableAssignment", t.KeyMustBeString = "KeyMustBeString", t.NoFunctionInsideBlock = "NoFunctionInsideBlock", t.NoFunctionInsideFunction = "NoFunctionInsideFunction", t.ModuleExportRootOnly = "ModuleExportRootOnly", t.ModuleImportRootOnly = "ModuleImportRootOnly", t.PunctuatorExpected = "PunctuatorExpected", t.TemplateOctalLiteral = "TemplateOctalLiteral", t.UnexpectedBoolean = "UnexpectedBoolean", t.UnexpectedEndOfScript = "UnexpectedEndOfScript", t.UnexpectedIdentifier = "UnexpectedIdentifier", t.UnexpectedKeyword = "UnexpectedKeyword", t.UnexpectedNull = "UnexpectedNull", t.UnexpectedNumber = "UnexpectedNumber", t.UnexpectedPunctuator = "UnexpectedPunctuator", t.UnexpectedString = "UnexpectedString", t.UnexpectedTemplate = "UnexpectedTemplate", t.UnexpectedToken = "UnexpectedToken"; +})(es || (es = {})); +const yFi = { [es.InvalidModuleUri]: "Module uri must be a text literal.", [es.ForInOfLoopInitializer]: "for-in loop variable declaration may not have an initializer.", [es.IdentiferExpected]: "'${value}' is an invalid identifier.", [es.InvalidEscapedReservedWord]: "Keyword cannot contain escaped characters.", [es.InvalidExpression]: "Invalid expression.", [es.InvalidFunctionIdentifier]: "'${value}' is an invalid function identifier.", [es.InvalidHexEscapeSequence]: "Invalid hexadecimal escape sequence.", [es.InvalidLeftHandSideInAssignment]: "Invalid left-hand side in assignment.", [es.InvalidLeftHandSideInForIn]: "Invalid left-hand side in for-in.", [es.InvalidTemplateHead]: "Invalid template structure.", [es.InvalidVariableAssignment]: "Invalid variable assignment.", [es.KeyMustBeString]: "Object property keys must be a word starting with a letter.", [es.NoFunctionInsideBlock]: "Functions cannot be declared inside of code blocks.", [es.NoFunctionInsideFunction]: "Functions cannot be declared inside another function.", [es.ModuleExportRootOnly]: "Module exports cannot be declared inside of code blocks.", [es.ModuleImportRootOnly]: "Module import cannot be declared inside of code blocks.", [es.PunctuatorExpected]: "'${value}' expected.", [es.TemplateOctalLiteral]: "Octal literals are not allowed in template literals.", [es.UnexpectedBoolean]: "Unexpected boolean literal.", [es.UnexpectedEndOfScript]: "Unexpected end of Arcade expression.", [es.UnexpectedIdentifier]: "Unexpected identifier.", [es.UnexpectedKeyword]: "Unexpected keyword.", [es.UnexpectedNull]: "Unexpected null literal.", [es.UnexpectedNumber]: "Unexpected number.", [es.UnexpectedPunctuator]: "Unexpected ponctuator.", [es.UnexpectedString]: "Unexpected text literal.", [es.UnexpectedTemplate]: "Unexpected quasi '${value}'.", [es.UnexpectedToken]: "Unexpected token '${value}'." }; +let $6 = class MTt extends Error { + constructor({ code: e, index: i, line: r, column: n, len: s = 0, description: o, data: a }) { + super(`${o ?? e}`), this.declaredRootClass = "esri.arcade.lib.parsingerror", this.name = "ParsingError", this.code = e, this.index = i, this.line = r, this.column = n, this.len = s, this.data = a, this.description = o, this.range = { start: { line: r, column: n - 1 }, end: { line: r, column: n + s } }, Error.captureStackTrace?.(this, MTt); + } +}; +function vFi(t) { + return t?.type === hs.Program; +} +function DKe(t) { + return t?.type === hs.BlockStatement; +} +function _Fi(t) { + return t?.type === hs.BlockComment; +} +function bFi(t) { + return t?.type === hs.EmptyStatement; +} +function wFi(t) { + return t?.type === hs.VariableDeclarator; +} +function jwe(t, e) { + return !!e && e.loc.end.line === t.loc.start.line && e.loc.end.column <= t.loc.start.column; +} +function FKe(t, e) { + return t.range[0] >= e.range[0] && t.range[1] <= e.range[1]; +} +let xFi = class { + constructor() { + this.comments = [], this._nodeStack = [], this._newComments = []; + } + insertInnerComments(e) { + if (!DKe(e) || e.body.length !== 0) + return; + const i = []; + for (let r = this._newComments.length - 1; r >= 0; --r) { + const n = this._newComments[r]; + e.range[1] >= n.range[0] && (i.unshift(n), this._newComments.splice(r, 1)); + } + i.length && (e.innerComments = i); + } + attachTrailingComments(e) { + if (!e) + return; + const i = this._nodeStack[this._nodeStack.length - 1]; + if (DKe(e) && FKe(i, e)) + for (let n = this._newComments.length - 1; n >= 0; --n) { + const s = this._newComments[n]; + FKe(s, e) && (i.trailingComments = [...i.trailingComments ?? [], s], this._newComments.splice(n, 1)); + } + let r = []; + if (this._newComments.length > 0) + for (let n = this._newComments.length - 1; n >= 0; --n) { + const s = this._newComments[n]; + jwe(s, i) ? (i.trailingComments = [...i.trailingComments ?? [], s], this._newComments.splice(n, 1)) : jwe(s, e) && (r.unshift(s), this._newComments.splice(n, 1)); + } + i?.trailingComments && jwe(i.trailingComments[0], e) && (r = [...r, ...i.trailingComments], delete i.trailingComments), r.length > 0 && (e.trailingComments = r); + } + attachLeadingComments(e) { + if (!e) + return; + let i; + for (; this._nodeStack.length > 0; ) { + const s = this._nodeStack[this._nodeStack.length - 1]; + if (!(e.range[0] <= s.range[0])) + break; + i = s, this._nodeStack.pop(); + } + const r = [], n = []; + if (i) { + for (let s = (i.leadingComments?.length ?? 0) - 1; s >= 0; --s) { + const o = i.leadingComments[s]; + e.range[0] >= o.range[1] ? (r.unshift(o), i.leadingComments.splice(s, 1)) : wFi(e) && !_Fi(o) && (n.unshift(o), i.leadingComments.splice(s, 1)); + } + return i.leadingComments?.length === 0 && delete i.leadingComments, r.length && (e.leadingComments = r), void (n.length && (e.trailingComments = [...n, ...e.trailingComments ?? []])); + } + for (let s = this._newComments.length - 1; s >= 0; --s) { + const o = this._newComments[s]; + e.range[0] >= o.range[0] && (r.unshift(o), this._newComments.splice(s, 1)); + } + r.length && (e.leadingComments = r); + } + attachComments(e) { + if (vFi(e) && e.body.length > 0) { + const i = this._nodeStack[this._nodeStack.length - 1]; + return i ? (i.trailingComments = [...i.trailingComments ?? [], ...this._newComments], this._newComments.length = 0, void this._nodeStack.pop()) : (e.trailingComments = [...this._newComments], void (this._newComments.length = 0)); + } + this.attachTrailingComments(e), this.attachLeadingComments(e), this.insertInnerComments(e), this._nodeStack.push(e); + } + collectComment(e) { + this.comments.push(e), this._newComments.push(e); + } +}; +function HOe(t, e) { + const i = yFi[t]; + return e ? i.replace(/\${(.*?)}/g, (r, n) => e[n]?.toString() ?? "") : i; +} +let SFi = class { + constructor(e = !1) { + this.tolerant = e, this.errors = []; + } + recordError(e) { + this.errors.push(e); + } + tolerate(e) { + if (!this.tolerant) + throw e; + this.recordError(e); + } + throwError(e) { + throw e.description = e.description ?? HOe(e.code, e.data), new $6(e); + } + tolerateError(e) { + e.description = e.description ?? HOe(e.code, e.data); + const i = new $6(e); + if (!this.tolerant) + throw i; + this.recordError(i); + } +}; +function LKe(t, e) { + if (!t) + throw new Error("ASSERT: " + e); +} +const NKe = { NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/, NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ }, ul = { fromCodePoint: (t) => t < 65536 ? String.fromCharCode(t) : String.fromCharCode(55296 + (t - 65536 >> 10)) + String.fromCharCode(56320 + (t - 65536 & 1023)), isWhiteSpace: (t) => t === 32 || t === 9 || t === 11 || t === 12 || t === 160 || t >= 5760 && [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(t), isLineTerminator: (t) => t === 10 || t === 13 || t === 8232 || t === 8233, isIdentifierStart: (t) => t === 36 || t === 95 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 92 || t >= 128 && NKe.NonAsciiIdentifierStart.test(ul.fromCodePoint(t)), isIdentifierPart: (t) => t === 36 || t === 95 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 48 && t <= 57 || t === 92 || t >= 128 && NKe.NonAsciiIdentifierPart.test(ul.fromCodePoint(t)), isDecimalDigit: (t) => t >= 48 && t <= 57, isHexDigit: (t) => t >= 48 && t <= 57 || t >= 65 && t <= 70 || t >= 97 && t <= 102, isOctalDigit: (t) => t >= 48 && t <= 55 }; +function kKe(t) { + return "0123456789abcdef".indexOf(t.toLowerCase()); +} +function Gwe(t) { + return "01234567".indexOf(t); +} +const Ok = [[], [], []]; +zOe.forEach((t) => Ok[t.length - 1].push(t)), PTt.forEach((t) => Ok[t.length - 1].push(t)), RTt.forEach((t) => Ok[t.length - 1].push(t)), OTt.forEach((t) => Ok[t.length - 1].push(t)), fFi.forEach((t) => Ok[t.length - 1].push(t)); +let CFi = class { + constructor(e, i) { + this.source = e, this.errorHandler = i, this._length = e.length, this.index = 0, this.lineNumber = 1, this.lineStart = 0, this.curlyStack = []; + } + saveState() { + return { index: this.index, lineNumber: this.lineNumber, lineStart: this.lineStart, curlyStack: this.curlyStack.slice() }; + } + restoreState(e) { + this.index = e.index, this.lineNumber = e.lineNumber, this.lineStart = e.lineStart, this.curlyStack = e.curlyStack; + } + eof() { + return this.index >= this._length; + } + throwUnexpectedToken(e = es.UnexpectedToken) { + this.errorHandler.throwError({ code: e, index: this.index, line: this.lineNumber, column: this.index - this.lineStart + 1 }); + } + tolerateUnexpectedToken(e = es.UnexpectedToken) { + this.errorHandler.tolerateError({ code: e, index: this.index, line: this.lineNumber, column: this.index - this.lineStart + 1 }); + } + skipSingleLineComment(e) { + const i = [], r = this.index - e, n = { start: { line: this.lineNumber, column: this.index - this.lineStart - e }, end: { line: 0, column: 0 } }; + for (; !this.eof(); ) { + const s = this.source.charCodeAt(this.index); + if (++this.index, ul.isLineTerminator(s)) { + if (n) { + n.end = { line: this.lineNumber, column: this.index - this.lineStart - 1 }; + const o = { multiLine: !1, start: r + e, end: this.index - 1, range: [r, this.index - 1], loc: n }; + i.push(o); + } + return s === 13 && this.source.charCodeAt(this.index) === 10 && ++this.index, ++this.lineNumber, this.lineStart = this.index, i; + } + } + if (n) { + n.end = { line: this.lineNumber, column: this.index - this.lineStart }; + const s = { multiLine: !1, start: r + e, end: this.index, range: [r, this.index], loc: n }; + i.push(s); + } + return i; + } + skipMultiLineComment() { + const e = [], i = this.index - 2, r = { start: { line: this.lineNumber, column: this.index - this.lineStart - 2 }, end: { line: 0, column: 0 } }; + for (; !this.eof(); ) { + const n = this.source.charCodeAt(this.index); + if (ul.isLineTerminator(n)) + n === 13 && this.source.charCodeAt(this.index + 1) === 10 && ++this.index, ++this.lineNumber, ++this.index, this.lineStart = this.index; + else if (n === 42) { + if (this.source.charCodeAt(this.index + 1) === 47) { + if (this.index += 2, r) { + r.end = { line: this.lineNumber, column: this.index - this.lineStart }; + const s = { multiLine: !0, start: i + 2, end: this.index - 2, range: [i, this.index], loc: r }; + e.push(s); + } + return e; + } + ++this.index; + } else + ++this.index; + } + if (r) { + r.end = { line: this.lineNumber, column: this.index - this.lineStart }; + const n = { multiLine: !0, start: i + 2, end: this.index, range: [i, this.index], loc: r }; + e.push(n); + } + return this.tolerateUnexpectedToken(), e; + } + scanComments() { + let e = []; + for (; !this.eof(); ) { + let i = this.source.charCodeAt(this.index); + if (ul.isWhiteSpace(i)) + ++this.index; + else if (ul.isLineTerminator(i)) + ++this.index, i === 13 && this.source.charCodeAt(this.index) === 10 && ++this.index, ++this.lineNumber, this.lineStart = this.index; + else { + if (i !== 47) + break; + if (i = this.source.charCodeAt(this.index + 1), i === 47) { + this.index += 2; + const r = this.skipSingleLineComment(2); + e = [...e, ...r]; + } else { + if (i !== 42) + break; + { + this.index += 2; + const r = this.skipMultiLineComment(); + e = [...e, ...r]; + } + } + } + } + return e; + } + isKeyword(e) { + switch ((e = e.toLowerCase()).length) { + case 2: + return e === Ra.If || e === Ra.In; + case 3: + return e === Ra.Var || e === Ra.For; + case 4: + return e === Ra.Else; + case 5: + return e === Ra.Break || e === Ra.While; + case 6: + return e === Ra.Return || e === Ra.Import || e === Ra.Export; + case 8: + return e === Ra.Function || e === Ra.Continue; + default: + return !1; + } + } + codePointAt(e) { + let i = this.source.charCodeAt(e); + if (i >= 55296 && i <= 56319) { + const r = this.source.charCodeAt(e + 1); + r >= 56320 && r <= 57343 && (i = 1024 * (i - 55296) + r - 56320 + 65536); + } + return i; + } + scanHexEscape(e) { + const i = e === "u" ? 4 : 2; + let r = 0; + for (let n = 0; n < i; ++n) { + if (this.eof() || !ul.isHexDigit(this.source.charCodeAt(this.index))) + return null; + r = 16 * r + kKe(this.source[this.index++]); + } + return String.fromCharCode(r); + } + scanUnicodeCodePointEscape() { + let e = this.source[this.index], i = 0; + for (e === "}" && this.throwUnexpectedToken(); !this.eof() && (e = this.source[this.index++], ul.isHexDigit(e.charCodeAt(0))); ) + i = 16 * i + kKe(e); + return (i > 1114111 || e !== "}") && this.throwUnexpectedToken(), ul.fromCodePoint(i); + } + getIdentifier() { + const e = this.index++; + for (; !this.eof(); ) { + const i = this.source.charCodeAt(this.index); + if (i === 92) + return this.index = e, this.getComplexIdentifier(); + if (i >= 55296 && i < 57343) + return this.index = e, this.getComplexIdentifier(); + if (!ul.isIdentifierPart(i)) + break; + ++this.index; + } + return this.source.slice(e, this.index); + } + getComplexIdentifier() { + let e, i = this.codePointAt(this.index), r = ul.fromCodePoint(i); + for (this.index += r.length, i === 92 && (this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), ++this.index, this.source[this.index] === "{" ? (++this.index, e = this.scanUnicodeCodePointEscape()) : (e = this.scanHexEscape("u"), e !== null && e !== "\\" && ul.isIdentifierStart(e.charCodeAt(0)) || this.throwUnexpectedToken()), r = e); !this.eof() && (i = this.codePointAt(this.index), ul.isIdentifierPart(i)); ) + e = ul.fromCodePoint(i), r += e, this.index += e.length, i === 92 && (r = r.substring(0, r.length - 1), this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), ++this.index, this.source[this.index] === "{" ? (++this.index, e = this.scanUnicodeCodePointEscape()) : (e = this.scanHexEscape("u"), e !== null && e !== "\\" && ul.isIdentifierPart(e.charCodeAt(0)) || this.throwUnexpectedToken()), r += e); + return r; + } + octalToDecimal(e) { + let i = e !== "0", r = Gwe(e); + return !this.eof() && ul.isOctalDigit(this.source.charCodeAt(this.index)) && (i = !0, r = 8 * r + Gwe(this.source[this.index++]), "0123".includes(e) && !this.eof() && ul.isOctalDigit(this.source.charCodeAt(this.index)) && (r = 8 * r + Gwe(this.source[this.index++]))), { code: r, octal: i }; + } + scanIdentifier() { + let e; + const i = this.index, r = this.source.charCodeAt(i) === 92 ? this.getComplexIdentifier() : this.getIdentifier(); + if (e = r.length === 1 ? ws.Identifier : this.isKeyword(r) ? ws.Keyword : r.toLowerCase() === Ra.Null ? ws.NullLiteral : r.toLowerCase() === Ra.True || r.toLowerCase() === Ra.False ? ws.BooleanLiteral : ws.Identifier, e !== ws.Identifier && i + r.length !== this.index) { + const n = this.index; + this.index = i, this.tolerateUnexpectedToken(es.InvalidEscapedReservedWord), this.index = n; + } + return { type: e, value: r, lineNumber: this.lineNumber, lineStart: this.lineStart, start: i, end: this.index }; + } + scanPunctuator() { + const e = this.index; + let i = this.source[this.index]; + switch (i) { + case "(": + case "{": + i === "{" && this.curlyStack.push("{"), ++this.index; + break; + case ".": + case ")": + case ";": + case ",": + case "[": + case "]": + case ":": + case "?": + case "~": + ++this.index; + break; + case "}": + ++this.index, this.curlyStack.pop(); + break; + default: + for (let r = Ok.length; r > 0; r--) + if (i = this.source.substring(this.index, this.index + r), Ok[r - 1].includes(i)) { + this.index += r; + break; + } + } + return this.index === e && this.throwUnexpectedToken(), { type: ws.Punctuator, value: i, lineNumber: this.lineNumber, lineStart: this.lineStart, start: e, end: this.index }; + } + scanHexLiteral(e) { + let i = ""; + for (; !this.eof() && ul.isHexDigit(this.source.charCodeAt(this.index)); ) + i += this.source[this.index++]; + return i.length === 0 && this.throwUnexpectedToken(), ul.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: ws.NumericLiteral, value: parseInt("0x" + i, 16), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e, end: this.index }; + } + scanBinaryLiteral(e) { + let i = ""; + for (; !this.eof(); ) { + const r = this.source[this.index]; + if (r !== "0" && r !== "1") + break; + i += this.source[this.index++]; + } + if (i.length === 0 && this.throwUnexpectedToken(), !this.eof()) { + const r = this.source.charCodeAt(this.index); + (ul.isIdentifierStart(r) || ul.isDecimalDigit(r)) && this.throwUnexpectedToken(); + } + return { type: ws.NumericLiteral, value: parseInt(i, 2), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e, end: this.index }; + } + scanOctalLiteral(e, i) { + let r = "", n = !1; + for (ul.isOctalDigit(e.charCodeAt(0)) ? (n = !0, r = "0" + this.source[this.index++]) : ++this.index; !this.eof() && ul.isOctalDigit(this.source.charCodeAt(this.index)); ) + r += this.source[this.index++]; + return n || r.length !== 0 || this.throwUnexpectedToken(), (ul.isIdentifierStart(this.source.charCodeAt(this.index)) || ul.isDecimalDigit(this.source.charCodeAt(this.index))) && this.throwUnexpectedToken(), { type: ws.NumericLiteral, value: parseInt(r, 8), lineNumber: this.lineNumber, lineStart: this.lineStart, start: i, end: this.index }; + } + scanNumericLiteral() { + const e = this.index; + let i = this.source[e]; + LKe(ul.isDecimalDigit(i.charCodeAt(0)) || i === ".", "Numeric literal must start with a decimal digit or a decimal point"); + let r = ""; + if (i !== ".") { + if (r = this.source[this.index++], i = this.source[this.index], r === "0") { + if (i === "x" || i === "X") + return ++this.index, this.scanHexLiteral(e); + if (i === "b" || i === "B") + return ++this.index, this.scanBinaryLiteral(e); + if (i === "o" || i === "O") + return this.scanOctalLiteral(i, e); + } + for (; ul.isDecimalDigit(this.source.charCodeAt(this.index)); ) + r += this.source[this.index++]; + i = this.source[this.index]; + } + if (i === ".") { + for (r += this.source[this.index++]; ul.isDecimalDigit(this.source.charCodeAt(this.index)); ) + r += this.source[this.index++]; + i = this.source[this.index]; + } + if (i === "e" || i === "E") + if (r += this.source[this.index++], i = this.source[this.index], i !== "+" && i !== "-" || (r += this.source[this.index++]), ul.isDecimalDigit(this.source.charCodeAt(this.index))) + for (; ul.isDecimalDigit(this.source.charCodeAt(this.index)); ) + r += this.source[this.index++]; + else + this.throwUnexpectedToken(); + return ul.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: ws.NumericLiteral, value: parseFloat(r), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e, end: this.index }; + } + scanStringLiteral() { + const e = this.index; + let i = this.source[e]; + LKe(i === "'" || i === '"', "String literal must starts with a quote"), ++this.index; + let r = !1, n = ""; + for (; !this.eof(); ) { + let s = this.source[this.index++]; + if (s === i) { + i = ""; + break; + } + if (s === "\\") + if (s = this.source[this.index++], s && ul.isLineTerminator(s.charCodeAt(0))) + ++this.lineNumber, s === "\r" && this.source[this.index] === ` +` && ++this.index, this.lineStart = this.index; + else + switch (s) { + case "u": + if (this.source[this.index] === "{") + ++this.index, n += this.scanUnicodeCodePointEscape(); + else { + const o = this.scanHexEscape(s); + o === null && this.throwUnexpectedToken(), n += o; + } + break; + case "x": { + const o = this.scanHexEscape(s); + o === null && this.throwUnexpectedToken(es.InvalidHexEscapeSequence), n += o; + break; + } + case "n": + n += ` +`; + break; + case "r": + n += "\r"; + break; + case "t": + n += " "; + break; + case "b": + n += "\b"; + break; + case "f": + n += "\f"; + break; + case "v": + n += "\v"; + break; + case "8": + case "9": + n += s, this.tolerateUnexpectedToken(); + break; + default: + if (s && ul.isOctalDigit(s.charCodeAt(0))) { + const o = this.octalToDecimal(s); + r = o.octal || r, n += String.fromCharCode(o.code); + } else + n += s; + } + else { + if (ul.isLineTerminator(s.charCodeAt(0))) + break; + n += s; + } + } + return i !== "" && (this.index = e, this.throwUnexpectedToken()), { type: ws.StringLiteral, value: n, lineNumber: this.lineNumber, lineStart: this.lineStart, start: e, end: this.index }; + } + scanTemplate() { + let e = "", i = !1; + const r = this.index, n = this.source[r] === "`"; + let s = !1, o = 2; + for (++this.index; !this.eof(); ) { + let a = this.source[this.index++]; + if (a === "`") { + o = 1, s = !0, i = !0; + break; + } + if (a !== "$") + if (a !== "\\") + ul.isLineTerminator(a.charCodeAt(0)) ? (++this.lineNumber, a === "\r" && this.source[this.index] === ` +` && ++this.index, this.lineStart = this.index, e += ` +`) : e += a; + else if (a = this.source[this.index++], ul.isLineTerminator(a.charCodeAt(0))) + ++this.lineNumber, a === "\r" && this.source[this.index] === ` +` && ++this.index, this.lineStart = this.index; + else + switch (a) { + case "n": + e += ` +`; + break; + case "r": + e += "\r"; + break; + case "t": + e += " "; + break; + case "u": + if (this.source[this.index] === "{") + ++this.index, e += this.scanUnicodeCodePointEscape(); + else { + const l = this.index, c = this.scanHexEscape(a); + c !== null ? e += c : (this.index = l, e += a); + } + break; + case "x": { + const l = this.scanHexEscape(a); + l === null && this.throwUnexpectedToken(es.InvalidHexEscapeSequence), e += l; + break; + } + case "b": + e += "\b"; + break; + case "f": + e += "\f"; + break; + case "v": + e += "\v"; + break; + default: + a === "0" ? (ul.isDecimalDigit(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(es.TemplateOctalLiteral), e += "\0") : ul.isOctalDigit(a.charCodeAt(0)) ? this.throwUnexpectedToken(es.TemplateOctalLiteral) : e += a; + } + else { + if (this.source[this.index] === "{") { + this.curlyStack.push("${"), ++this.index, i = !0; + break; + } + e += a; + } + } + return i || this.throwUnexpectedToken(), n || this.curlyStack.pop(), { type: ws.Template, value: this.source.slice(r + 1, this.index - o), cooked: e, head: n, tail: s, lineNumber: this.lineNumber, lineStart: this.lineStart, start: r, end: this.index }; + } + lex() { + if (this.eof()) + return { type: ws.EOF, value: "", lineNumber: this.lineNumber, lineStart: this.lineStart, start: this.index, end: this.index }; + const e = this.source.charCodeAt(this.index); + return ul.isIdentifierStart(e) ? this.scanIdentifier() : e === 40 || e === 41 || e === 59 ? this.scanPunctuator() : e === 39 || e === 34 ? this.scanStringLiteral() : e === 46 ? ul.isDecimalDigit(this.source.charCodeAt(this.index + 1)) ? this.scanNumericLiteral() : this.scanPunctuator() : ul.isDecimalDigit(e) ? this.scanNumericLiteral() : e === 96 || e === 125 && this.curlyStack[this.curlyStack.length - 1] === "${" ? this.scanTemplate() : e >= 55296 && e < 57343 && ul.isIdentifierStart(this.codePointAt(this.index)) ? this.scanIdentifier() : this.scanPunctuator(); + } +}; +var pv, WJ; +function $Ke(t, e = 0) { + let i = t.start - t.lineStart, r = t.lineNumber; + return i < 0 && (i += e, r--), { index: t.start, line: r, column: i }; +} +function BKe(t) { + return [{ index: t.range[0], ...t.loc.start }, { index: t.range[1], ...t.loc.end }]; +} +function VKe(t) { + return mFi[t] ?? 0; +} +(function(t) { + t[t.None = 0] = "None", t[t.Function = 1] = "Function", t[t.IfClause = 2] = "IfClause", t[t.ForLoop = 4] = "ForLoop", t[t.WhileLoop = 8] = "WhileLoop"; +})(pv || (pv = {})), function(t) { + t[t.AsObject = 0] = "AsObject", t[t.Automatic = 1] = "Automatic"; +}(WJ || (WJ = {})); +let TFi = class { + constructor(e, i = {}, r) { + this.delegate = r, this.hasLineTerminator = !1, this.options = { tokens: typeof i.tokens == "boolean" && i.tokens, comments: typeof i.comments == "boolean" && i.comments, tolerant: typeof i.tolerant == "boolean" && i.tolerant }, this.options.comments && (this.commentHandler = new xFi()), this.errorHandler = new SFi(this.options.tolerant), this.scanner = new CFi(e, this.errorHandler), this.context = { isAssignmentTarget: !1, blockContext: pv.None, curlyParsingType: WJ.AsObject }, this.rawToken = { type: ws.EOF, value: "", lineNumber: this.scanner.lineNumber, lineStart: 0, start: 0, end: 0 }, this.tokens = [], this.startMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.endMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.readNextRawToken(), this.endMarker = { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart }; + } + throwIfInvalidType(e, i, { validTypes: r, invalidTypes: n }) { + r?.some((s) => e.type === s) || n?.some((s) => e.type === s) && this.throwError(es.InvalidExpression, i); + } + throwError(e, i, r = this.endMarker) { + const { index: n, line: s, column: o } = i, a = r.index - n - 1; + this.errorHandler.throwError({ code: e, index: n, line: s, column: o + 1, len: a }); + } + tolerateError(e, i) { + throw new Error("######################################### !!!"); + } + unexpectedTokenError(e = {}) { + const { rawToken: i } = e; + let r, { code: n, data: s } = e; + if (i) { + if (!n) + switch (i.type) { + case ws.EOF: + n = es.UnexpectedEndOfScript; + break; + case ws.Identifier: + n = es.UnexpectedIdentifier; + break; + case ws.NumericLiteral: + n = es.UnexpectedNumber; + break; + case ws.StringLiteral: + n = es.UnexpectedString; + break; + case ws.Template: + n = es.UnexpectedTemplate; + } + r = i.value.toString(); + } else + r = "ILLEGAL"; + n = n ?? es.UnexpectedToken, s || (s = { value: r }); + const o = HOe(n, s); + if (i) { + const c = i.start, h = i.lineNumber, p = i.start - i.lineStart + 1; + return new $6({ code: n, index: c, line: h, column: p, len: i.end - i.start - 1, data: s, description: o }); + } + const { index: a, line: l } = this.endMarker; + return new $6({ code: n, index: a, line: l, column: this.endMarker.column + 1, data: s, description: o }); + } + throwUnexpectedToken(e = {}) { + throw e.rawToken = e.rawToken ?? this.rawToken, this.unexpectedTokenError(e); + } + collectComments(e) { + const { commentHandler: i } = this; + i && e.length && e.forEach((r) => { + const n = { type: r.multiLine ? hs.BlockComment : hs.LineComment, value: this.getSourceValue(r), range: r.range, loc: r.loc }; + i.collectComment(n); + }); + } + peekAhead(e) { + const i = () => (this.scanner.scanComments(), this.scanner.lex()), r = this.scanner.saveState(), n = e.call(this, i); + return this.scanner.restoreState(r), n; + } + getSourceValue(e) { + return this.scanner.source.slice(e.start, e.end); + } + convertToToken(e) { + return { type: gFi[e.type], value: this.getSourceValue(e), range: [e.start, e.end], loc: { start: { line: this.startMarker.line, column: this.startMarker.column }, end: { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart } } }; + } + readNextRawToken() { + this.endMarker.index = this.scanner.index, this.endMarker.line = this.scanner.lineNumber, this.endMarker.column = this.scanner.index - this.scanner.lineStart; + const e = this.rawToken; + this.collectComments(this.scanner.scanComments()), this.scanner.index !== this.startMarker.index && (this.startMarker.index = this.scanner.index, this.startMarker.line = this.scanner.lineNumber, this.startMarker.column = this.scanner.index - this.scanner.lineStart), this.rawToken = this.scanner.lex(), this.hasLineTerminator = e.lineNumber !== this.rawToken.lineNumber, this.options.tokens && this.rawToken.type !== ws.EOF && this.tokens.push(this.convertToToken(this.rawToken)); + } + captureStartMarker() { + return { index: this.startMarker.index, line: this.startMarker.line, column: this.startMarker.column }; + } + getItemLocation(e) { + return { range: [e.index, this.endMarker.index], loc: { start: { line: e.line, column: e.column }, end: { line: this.endMarker.line, column: this.endMarker.column } } }; + } + finalize(e) { + return (this.delegate || this.commentHandler) && (this.commentHandler?.attachComments(e), this.delegate?.(e)), e; + } + expectPunctuator(e) { + const i = this.rawToken; + this.matchPunctuator(e) ? this.readNextRawToken() : this.throwUnexpectedToken({ rawToken: i, code: es.PunctuatorExpected, data: { value: e } }); + } + expectKeyword(e) { + this.rawToken.type !== ws.Keyword || this.rawToken.value.toLowerCase() !== e ? this.throwUnexpectedToken({ rawToken: this.rawToken }) : this.readNextRawToken(); + } + expectContextualKeyword(e) { + this.rawToken.type !== ws.Identifier || this.rawToken.value.toLowerCase() !== e ? this.throwUnexpectedToken({ rawToken: this.rawToken }) : this.readNextRawToken(); + } + matchKeyword(e) { + return this.rawToken.type === ws.Keyword && this.rawToken.value.toLowerCase() === e; + } + matchContextualKeyword(e) { + return this.rawToken.type === ws.Identifier && this.rawToken.value === e; + } + matchPunctuator(e) { + return this.rawToken.type === ws.Punctuator && this.rawToken.value === e; + } + getMatchingPunctuator(e) { + if (typeof e == "string" && (e = e.split("")), this.rawToken.type === ws.Punctuator && e?.length) + return e.find(this.matchPunctuator, this); + } + isolateCoverGrammar(e) { + const i = this.context.isAssignmentTarget; + this.context.isAssignmentTarget = !0; + const r = e.call(this); + return this.context.isAssignmentTarget = i, r; + } + inheritCoverGrammar(e) { + const i = this.context.isAssignmentTarget; + this.context.isAssignmentTarget = !0; + const r = e.call(this); + return this.context.isAssignmentTarget = this.context.isAssignmentTarget && i, r; + } + withBlockContext(e, i) { + const r = this.context.blockContext; + this.context.blockContext = this.context.blockContext | e; + const n = this.context.curlyParsingType; + this.context.curlyParsingType = WJ.Automatic; + const s = i.call(this); + return this.context.blockContext = r, this.context.curlyParsingType = n, s; + } + consumeSemicolon() { + if (this.matchPunctuator(";")) + this.readNextRawToken(); + else if (!this.hasLineTerminator) + return this.rawToken.type === ws.EOF || this.matchPunctuator("}") ? (this.endMarker.index = this.startMarker.index, this.endMarker.line = this.startMarker.line, void (this.endMarker.column = this.startMarker.column)) : void this.throwUnexpectedToken({ rawToken: this.rawToken }); + } + parsePrimaryExpression() { + const e = this.captureStartMarker(), i = this.rawToken; + switch (i.type) { + case ws.Identifier: + return this.readNextRawToken(), this.finalize({ type: hs.Identifier, name: i.value, ...this.getItemLocation(e) }); + case ws.NumericLiteral: + case ws.StringLiteral: + return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({ type: hs.Literal, value: i.value, raw: this.getSourceValue(i), isString: typeof i.value == "string", ...this.getItemLocation(e) }); + case ws.BooleanLiteral: + return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({ type: hs.Literal, value: i.value.toLowerCase() === Ra.True, raw: this.getSourceValue(i), isString: !1, ...this.getItemLocation(e) }); + case ws.NullLiteral: + return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({ type: hs.Literal, value: null, raw: this.getSourceValue(i), isString: !1, ...this.getItemLocation(e) }); + case ws.Template: + return this.parseTemplateLiteral(); + case ws.Punctuator: + switch (i.value) { + case "(": + return this.inheritCoverGrammar(this.parseGroupExpression); + case "[": + return this.inheritCoverGrammar(this.parseArrayInitializer); + case "{": + return this.inheritCoverGrammar(this.parseObjectExpression); + default: + return this.throwUnexpectedToken({ rawToken: this.rawToken }); + } + case ws.Keyword: + return this.context.isAssignmentTarget = !1, this.throwUnexpectedToken({ rawToken: this.rawToken }); + default: + return this.throwUnexpectedToken({ rawToken: this.rawToken }); + } + } + parseArrayInitializer() { + const e = this.captureStartMarker(); + this.expectPunctuator("["); + const i = []; + for (; !this.matchPunctuator("]"); ) { + const r = this.captureStartMarker(); + this.matchPunctuator(",") ? (this.readNextRawToken(), this.throwError(es.InvalidExpression, r)) : (i.push(this.inheritCoverGrammar(this.parseAssignmentExpression)), this.matchPunctuator("]") || this.expectPunctuator(",")); + } + return this.expectPunctuator("]"), this.finalize({ type: hs.ArrayExpression, elements: i, ...this.getItemLocation(e) }); + } + parseObjectPropertyKey() { + const e = this.captureStartMarker(), i = this.rawToken; + switch (i.type) { + case ws.StringLiteral: + return this.readNextRawToken(), this.finalize({ type: hs.Literal, value: i.value, raw: this.getSourceValue(i), isString: !0, ...this.getItemLocation(e) }); + case ws.Identifier: + case ws.BooleanLiteral: + case ws.NullLiteral: + case ws.Keyword: + return this.readNextRawToken(), this.finalize({ type: hs.Identifier, name: i.value, ...this.getItemLocation(e) }); + default: + this.throwError(es.KeyMustBeString, e); + } + } + parseObjectProperty() { + const e = this.rawToken, i = this.captureStartMarker(), r = this.parseObjectPropertyKey(); + let n = !1, s = null; + return this.matchPunctuator(":") ? (this.readNextRawToken(), s = this.inheritCoverGrammar(this.parseAssignmentExpression)) : e.type === ws.Identifier ? (n = !0, s = this.finalize({ type: hs.Identifier, name: e.value, ...this.getItemLocation(i) })) : this.throwUnexpectedToken({ rawToken: this.rawToken }), this.finalize({ type: hs.Property, kind: "init", key: r, value: s, shorthand: n, ...this.getItemLocation(i) }); + } + parseObjectExpression() { + const e = this.captureStartMarker(); + this.expectPunctuator("{"); + const i = []; + for (; !this.matchPunctuator("}"); ) + i.push(this.parseObjectProperty()), this.matchPunctuator("}") || this.expectPunctuator(","); + return this.expectPunctuator("}"), this.finalize({ type: hs.ObjectExpression, properties: i, ...this.getItemLocation(e) }); + } + parseTemplateElement(e = !1) { + const i = this.rawToken; + i.type !== ws.Template && this.throwUnexpectedToken({ rawToken: i }), e && !i.head && this.throwUnexpectedToken({ code: es.InvalidTemplateHead, rawToken: i }); + const r = this.captureStartMarker(); + this.readNextRawToken(); + const { value: n, cooked: s, tail: o } = i, a = this.finalize({ type: hs.TemplateElement, value: { raw: n, cooked: s }, tail: o, ...this.getItemLocation(r) }); + return a.loc.start.column++, a.loc.end.column = a.loc.end.column - (o ? 1 : 2), a; + } + parseTemplateLiteral() { + const e = this.captureStartMarker(), i = [], r = []; + let n = this.parseTemplateElement(!0); + for (r.push(n); !n.tail; ) + i.push(this.parseExpression()), n = this.parseTemplateElement(), r.push(n); + return this.finalize({ type: hs.TemplateLiteral, quasis: r, expressions: i, ...this.getItemLocation(e) }); + } + parseGroupExpression() { + this.expectPunctuator("("); + const e = this.inheritCoverGrammar(this.parseAssignmentExpression); + return this.expectPunctuator(")"), e; + } + parseArguments() { + this.expectPunctuator("("); + const e = []; + if (!this.matchPunctuator(")")) + for (; ; ) { + const i = this.isolateCoverGrammar(this.parseAssignmentExpression); + if (e.push(i), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")"))) + break; + } + return this.expectPunctuator(")"), e; + } + parseMemberName() { + const e = this.rawToken, i = this.captureStartMarker(); + return this.readNextRawToken(), e.type !== ws.NullLiteral && e.type !== ws.Identifier && e.type !== ws.Keyword && e.type !== ws.BooleanLiteral && this.throwUnexpectedToken({ rawToken: e }), this.finalize({ type: hs.Identifier, name: e.value, ...this.getItemLocation(i) }); + } + parseLeftHandSideExpression() { + const e = this.captureStartMarker(); + let i = this.inheritCoverGrammar(this.parsePrimaryExpression); + const r = this.captureStartMarker(); + let n; + for (; n = this.getMatchingPunctuator("([."); ) + switch (n) { + case "(": { + this.context.isAssignmentTarget = !1, i.type !== hs.Identifier && i.type !== hs.MemberExpression && this.throwError(es.IdentiferExpected, e, r); + const s = this.parseArguments(); + i = this.finalize({ type: hs.CallExpression, callee: i, arguments: s, ...this.getItemLocation(e) }); + continue; + } + case "[": { + this.context.isAssignmentTarget = !0, this.expectPunctuator("["); + const s = this.isolateCoverGrammar(this.parseExpression); + this.expectPunctuator("]"), i = this.finalize({ type: hs.MemberExpression, computed: !0, object: i, property: s, ...this.getItemLocation(e) }); + continue; + } + case ".": { + this.context.isAssignmentTarget = !0, this.expectPunctuator("."); + const s = this.parseMemberName(); + i = this.finalize({ type: hs.MemberExpression, computed: !1, object: i, property: s, ...this.getItemLocation(e) }); + continue; + } + } + return i; + } + parseUpdateExpression() { + const e = this.captureStartMarker(); + let i = this.getMatchingPunctuator(zOe); + if (i) { + this.readNextRawToken(); + const o = this.captureStartMarker(), a = this.inheritCoverGrammar(this.parseUnaryExpression); + return a.type !== hs.Identifier && a.type !== hs.MemberExpression && a.type !== hs.CallExpression && this.throwError(es.InvalidExpression, o), this.context.isAssignmentTarget || this.tolerateError(es.InvalidLeftHandSideInAssignment, e), this.context.isAssignmentTarget = !1, this.finalize({ type: hs.UpdateExpression, operator: i, argument: a, prefix: !0, ...this.getItemLocation(e) }); + } + const r = this.captureStartMarker(), n = this.inheritCoverGrammar(this.parseLeftHandSideExpression), s = this.captureStartMarker(); + return this.hasLineTerminator ? n : (i = this.getMatchingPunctuator(zOe), i ? (n.type !== hs.Identifier && n.type !== hs.MemberExpression && this.throwError(es.InvalidExpression, r, s), this.context.isAssignmentTarget || this.tolerateError(es.InvalidLeftHandSideInAssignment, e), this.readNextRawToken(), this.context.isAssignmentTarget = !1, this.finalize({ type: hs.UpdateExpression, operator: i, argument: n, prefix: !1, ...this.getItemLocation(e) })) : n); + } + parseUnaryExpression() { + const e = this.getMatchingPunctuator(PTt); + if (e) { + const i = this.captureStartMarker(); + this.readNextRawToken(); + const r = this.inheritCoverGrammar(this.parseUnaryExpression); + return this.context.isAssignmentTarget = !1, this.finalize({ type: hs.UnaryExpression, operator: e, argument: r, prefix: !0, ...this.getItemLocation(i) }); + } + return this.parseUpdateExpression(); + } + parseBinaryExpression() { + const e = this.rawToken; + let i = this.inheritCoverGrammar(this.parseUnaryExpression); + if (this.rawToken.type !== ws.Punctuator) + return i; + const r = this.rawToken.value; + let n = VKe(r); + if (n === 0) + return i; + this.readNextRawToken(), this.context.isAssignmentTarget = !1; + const s = [e, this.rawToken]; + let o = i, a = this.inheritCoverGrammar(this.parseUnaryExpression); + const l = [o, r, a], c = [n]; + for (; this.rawToken.type === ws.Punctuator && (n = VKe(this.rawToken.value)) > 0; ) { + for (; l.length > 2 && n <= c[c.length - 1]; ) { + a = l.pop(); + const y = l.pop(); + c.pop(), o = l.pop(), s.pop(); + const v = s[s.length - 1], x = $Ke(v, v.lineStart); + l.push(this.finalize(this.createBinaryOrLogicalExpression(x, y, o, a))); + } + l.push(this.rawToken.value), c.push(n), s.push(this.rawToken), this.readNextRawToken(), l.push(this.inheritCoverGrammar(this.parseUnaryExpression)); + } + let h = l.length - 1; + i = l[h]; + let p = s.pop(); + for (; h > 1; ) { + const y = s.pop(); + if (!y) + break; + const v = p?.lineStart, x = $Ke(y, v), I = l[h - 1]; + i = this.finalize(this.createBinaryOrLogicalExpression(x, I, l[h - 2], i)), h -= 2, p = y; + } + return i; + } + createBinaryOrLogicalExpression(e, i, r, n) { + const s = RTt.includes(i) ? hs.LogicalExpression : hs.BinaryExpression; + return s === hs.BinaryExpression || (r.type !== hs.AssignmentExpression && r.type !== hs.UpdateExpression || this.throwError(es.InvalidExpression, ...BKe(r)), n.type !== hs.AssignmentExpression && n.type !== hs.UpdateExpression || this.throwError(es.InvalidExpression, ...BKe(r))), { type: s, operator: i, left: r, right: n, ...this.getItemLocation(e) }; + } + parseAssignmentExpression() { + const e = this.captureStartMarker(), i = this.inheritCoverGrammar(this.parseBinaryExpression), r = this.captureStartMarker(), n = this.getMatchingPunctuator(OTt); + if (!n) + return i; + i.type !== hs.Identifier && i.type !== hs.MemberExpression && this.throwError(es.InvalidExpression, e, r), this.context.isAssignmentTarget || this.tolerateError(es.InvalidLeftHandSideInAssignment, e), this.matchPunctuator("=") || (this.context.isAssignmentTarget = !1), this.readNextRawToken(); + const s = this.isolateCoverGrammar(this.parseAssignmentExpression); + return this.finalize({ type: hs.AssignmentExpression, left: i, operator: n, right: s, ...this.getItemLocation(e) }); + } + parseExpression() { + return this.isolateCoverGrammar(this.parseAssignmentExpression); + } + parseStatements(e) { + const i = []; + for (; this.rawToken.type !== ws.EOF && !this.matchPunctuator(e); ) { + const r = this.parseStatementListItem(); + bFi(r) || i.push(r); + } + return i; + } + parseStatementListItem() { + return this.context.isAssignmentTarget = !0, this.matchKeyword(Ra.Function) ? this.parseFunctionDeclaration() : this.matchKeyword(Ra.Export) ? this.parseExportDeclaration() : this.matchKeyword(Ra.Import) ? this.parseImportDeclaration() : this.parseStatement(); + } + parseBlock() { + const e = this.captureStartMarker(); + this.expectPunctuator("{"); + const i = this.parseStatements("}"); + return this.expectPunctuator("}"), this.finalize({ type: hs.BlockStatement, body: i, ...this.getItemLocation(e) }); + } + parseObjectStatement() { + const e = this.captureStartMarker(), i = this.parseObjectExpression(); + return this.finalize({ type: hs.ExpressionStatement, expression: i, ...this.getItemLocation(e) }); + } + parseBlockOrObjectStatement() { + return this.context.curlyParsingType === WJ.AsObject ? this.parseObjectStatement() : this.peekAhead((e) => { + let i = e(); + return (i.type === ws.Identifier || i.type === ws.StringLiteral) && (i = e(), i.type === ws.Punctuator && i.value === ":"); + }) ? this.parseObjectStatement() : this.parseBlock(); + } + parseIdentifier() { + const e = this.rawToken; + if (e.type !== ws.Identifier) + return null; + const i = this.captureStartMarker(); + return this.readNextRawToken(), this.finalize({ type: hs.Identifier, name: e.value, ...this.getItemLocation(i) }); + } + parseVariableDeclarator() { + const e = this.captureStartMarker(), i = this.parseIdentifier(); + i || this.throwUnexpectedToken({ code: es.IdentiferExpected }); + let r = null; + if (this.matchPunctuator("=")) { + this.readNextRawToken(); + const n = this.rawToken; + try { + r = this.isolateCoverGrammar(this.parseAssignmentExpression); + } catch { + this.throwUnexpectedToken({ rawToken: n, code: es.InvalidVariableAssignment }); + } + } + return this.finalize({ type: hs.VariableDeclarator, id: i, init: r, ...this.getItemLocation(e) }); + } + parseVariableDeclarationList() { + const e = [this.parseVariableDeclarator()]; + for (; this.matchPunctuator(","); ) + this.readNextRawToken(), e.push(this.parseVariableDeclarator()); + return e; + } + parseVariableDeclaration() { + const e = this.captureStartMarker(); + this.expectKeyword(Ra.Var); + const i = this.parseVariableDeclarationList(); + return this.consumeSemicolon(), this.finalize({ type: hs.VariableDeclaration, declarations: i, kind: "var", ...this.getItemLocation(e) }); + } + parseEmptyStatement() { + const e = this.captureStartMarker(); + return this.expectPunctuator(";"), this.finalize({ type: hs.EmptyStatement, ...this.getItemLocation(e) }); + } + parseExpressionStatement() { + const e = this.captureStartMarker(), i = this.parseExpression(); + return this.consumeSemicolon(), this.finalize({ type: hs.ExpressionStatement, expression: i, ...this.getItemLocation(e) }); + } + parseIfClause() { + return this.withBlockContext(pv.IfClause, this.parseStatement); + } + parseIfStatement() { + const e = this.captureStartMarker(); + this.expectKeyword(Ra.If), this.expectPunctuator("("); + const i = this.captureStartMarker(), r = this.parseExpression(), n = this.captureStartMarker(); + this.expectPunctuator(")"), r.type !== hs.AssignmentExpression && r.type !== hs.UpdateExpression || this.throwError(es.InvalidExpression, i, n); + const s = this.parseIfClause(); + let o = null; + return this.matchKeyword(Ra.Else) && (this.readNextRawToken(), o = this.parseIfClause()), this.finalize({ type: hs.IfStatement, test: r, consequent: s, alternate: o, ...this.getItemLocation(e) }); + } + parseWhileStatement() { + const e = this.captureStartMarker(); + this.expectKeyword(Ra.While), this.expectPunctuator("("); + const i = this.captureStartMarker(), r = this.parseExpression(), n = this.captureStartMarker(); + this.expectPunctuator(")"), r.type !== hs.AssignmentExpression && r.type !== hs.UpdateExpression || this.throwError(es.InvalidExpression, i, n); + const s = this.withBlockContext(pv.WhileLoop, this.parseStatement); + return this.finalize({ type: hs.WhileStatement, test: r, body: s, ...this.getItemLocation(e) }); + } + parseForStatement() { + let e = null, i = null, r = null, n = null, s = null; + const o = this.captureStartMarker(); + if (this.expectKeyword(Ra.For), this.expectPunctuator("("), this.matchPunctuator(";")) + this.readNextRawToken(); + else if (this.matchKeyword(Ra.Var)) { + const l = this.captureStartMarker(); + this.readNextRawToken(); + const c = this.parseVariableDeclarationList(); + c.length === 1 && this.matchKeyword(Ra.In) ? (c[0].init && this.throwError(es.ForInOfLoopInitializer, l), n = this.finalize({ type: hs.VariableDeclaration, declarations: c, kind: "var", ...this.getItemLocation(l) }), this.readNextRawToken(), s = this.parseExpression()) : (this.matchKeyword(Ra.In) && this.throwError(es.InvalidLeftHandSideInForIn, l), e = this.finalize({ type: hs.VariableDeclaration, declarations: c, kind: "var", ...this.getItemLocation(l) }), this.expectPunctuator(";")); + } else { + const l = this.context.isAssignmentTarget, c = this.captureStartMarker(); + e = this.inheritCoverGrammar(this.parseAssignmentExpression), this.matchKeyword(Ra.In) ? (this.context.isAssignmentTarget || this.tolerateError(es.InvalidLeftHandSideInForIn, c), e.type !== hs.Identifier && this.throwError(es.InvalidLeftHandSideInForIn, c), this.readNextRawToken(), n = e, s = this.parseExpression(), e = null) : (this.context.isAssignmentTarget = l, this.expectPunctuator(";")); + } + n || (this.matchPunctuator(";") || (i = this.isolateCoverGrammar(this.parseExpression)), this.expectPunctuator(";"), this.matchPunctuator(")") || (r = this.isolateCoverGrammar(this.parseExpression))), this.expectPunctuator(")"); + const a = this.withBlockContext(pv.ForLoop, () => this.isolateCoverGrammar(this.parseStatement)); + return n && s ? this.finalize({ type: hs.ForInStatement, left: n, right: s, body: a, ...this.getItemLocation(o) }) : this.finalize({ type: hs.ForStatement, init: e, test: i, update: r, body: a, ...this.getItemLocation(o) }); + } + parseContinueStatement() { + const e = this.captureStartMarker(); + return this.expectKeyword(Ra.Continue), this.consumeSemicolon(), this.finalize({ type: hs.ContinueStatement, ...this.getItemLocation(e) }); + } + parseBreakStatement() { + const e = this.captureStartMarker(); + return this.expectKeyword(Ra.Break), this.consumeSemicolon(), this.finalize({ type: hs.BreakStatement, ...this.getItemLocation(e) }); + } + parseReturnStatement() { + const e = this.captureStartMarker(); + this.expectKeyword(Ra.Return); + const i = !this.matchPunctuator(";") && !this.matchPunctuator("}") && !this.hasLineTerminator && this.rawToken.type !== ws.EOF || this.rawToken.type === ws.StringLiteral || this.rawToken.type === ws.Template ? this.parseExpression() : null; + return this.consumeSemicolon(), this.finalize({ type: hs.ReturnStatement, argument: i, ...this.getItemLocation(e) }); + } + parseStatement() { + switch (this.rawToken.type) { + case ws.BooleanLiteral: + case ws.NullLiteral: + case ws.NumericLiteral: + case ws.StringLiteral: + case ws.Template: + case ws.Identifier: + return this.parseExpressionStatement(); + case ws.Punctuator: + return this.rawToken.value === "{" ? this.parseBlockOrObjectStatement() : this.rawToken.value === "(" ? this.parseExpressionStatement() : this.rawToken.value === ";" ? this.parseEmptyStatement() : this.parseExpressionStatement(); + case ws.Keyword: + switch (this.rawToken.value.toLowerCase()) { + case Ra.Break: + return this.parseBreakStatement(); + case Ra.Continue: + return this.parseContinueStatement(); + case Ra.For: + return this.parseForStatement(); + case Ra.Function: + return this.parseFunctionDeclaration(); + case Ra.If: + return this.parseIfStatement(); + case Ra.Return: + return this.parseReturnStatement(); + case Ra.Var: + return this.parseVariableDeclaration(); + case Ra.While: + return this.parseWhileStatement(); + default: + return this.parseExpressionStatement(); + } + default: + return this.throwUnexpectedToken({ rawToken: this.rawToken }); + } + } + parseFormalParameters() { + const e = []; + if (this.expectPunctuator("("), !this.matchPunctuator(")")) + for (; this.rawToken.type !== ws.EOF; ) { + const i = this.parseIdentifier(); + if (i || this.throwUnexpectedToken({ rawToken: this.rawToken, code: es.IdentiferExpected }), e.push(i), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")"))) + break; + } + return this.expectPunctuator(")"), e; + } + parseFunctionDeclaration() { + (this.context.blockContext & pv.Function) === pv.Function && this.throwUnexpectedToken({ code: es.NoFunctionInsideFunction }), (this.context.blockContext & pv.WhileLoop) !== pv.WhileLoop && (this.context.blockContext & pv.IfClause) !== pv.IfClause || this.throwUnexpectedToken({ code: es.NoFunctionInsideBlock }); + const e = this.captureStartMarker(); + this.expectKeyword(Ra.Function); + const i = this.parseIdentifier(); + i || this.throwUnexpectedToken({ code: es.InvalidFunctionIdentifier }); + const r = this.parseFormalParameters(), n = this.context.blockContext; + this.context.blockContext = this.context.blockContext | pv.Function; + const s = this.parseBlock(); + return this.context.blockContext = n, this.finalize({ type: hs.FunctionDeclaration, id: i, params: r, body: s, ...this.getItemLocation(e) }); + } + parseScript() { + const e = this.captureStartMarker(), i = this.parseStatements(), r = this.finalize({ type: hs.Program, body: i, ...this.getItemLocation(e) }); + return this.options.tokens && (r.tokens = this.tokens), this.options.tolerant && (r.errors = this.errorHandler.errors), r; + } + parseExportDeclaration() { + this.context.blockContext !== pv.None && this.throwUnexpectedToken({ code: es.ModuleExportRootOnly }); + let e = null; + const i = this.captureStartMarker(); + return this.expectKeyword(Ra.Export), this.matchKeyword(Ra.Var) ? e = this.parseVariableDeclaration() : this.matchKeyword("function") ? e = this.parseFunctionDeclaration() : this.throwUnexpectedToken({ code: es.InvalidExpression }), this.finalize({ type: hs.ExportNamedDeclaration, declaration: e, specifiers: [], source: null, ...this.getItemLocation(i) }); + } + parseModuleSpecifier() { + const e = this.captureStartMarker(), i = this.rawToken; + if (i.type === ws.StringLiteral) + return this.readNextRawToken(), this.finalize({ type: hs.Literal, value: i.value, raw: this.getSourceValue(i), isString: !0, ...this.getItemLocation(e) }); + this.throwError(es.InvalidModuleUri, e); + } + parseDefaultSpecifier() { + const e = this.captureStartMarker(), i = this.parseIdentifier(); + return i || this.throwUnexpectedToken({ code: es.IdentiferExpected }), this.finalize({ type: hs.ImportDefaultSpecifier, local: i, ...this.getItemLocation(e) }); + } + parseImportDeclaration() { + this.context.blockContext !== pv.None && this.throwUnexpectedToken({ code: es.ModuleImportRootOnly }); + const e = this.captureStartMarker(); + this.expectKeyword(Ra.Import); + const i = this.parseDefaultSpecifier(); + this.expectContextualKeyword(Ra.From); + const r = this.parseModuleSpecifier(); + return this.finalize({ type: hs.ImportDeclaration, specifiers: [i], source: r, ...this.getItemLocation(e) }); + } +}; +function EFi(t, e, i) { + return new TFi(t, e, i).parseScript(); +} +function Kpe(t, e = []) { + const i = EFi(t); + if (i.body === null || i.body === void 0) + throw new $6({ index: 0, line: 0, column: 0, data: null, description: "", code: es.InvalidExpression }); + if (i.body.length === 0) + throw new $6({ index: 0, line: 0, column: 0, data: null, description: "", code: es.InvalidExpression }); + if (i.body.length === 0) + throw new $6({ index: 0, line: 0, column: 0, data: null, description: "", code: es.InvalidExpression }); + return i.loadedModules = {}, Gie(i, e), i; +} +let IFi = class WOe { + constructor(e) { + const i = this; + i._keys = [], i._values = [], i.length = 0, e && e.forEach((r) => { + i.set(r[0], r[1]); + }); + } + entries() { + return [].slice.call(this.keys().map((e, i) => [e, this._values[i]])); + } + keys() { + return [].slice.call(this._keys); + } + values() { + return [].slice.call(this._values); + } + has(e) { + return this._keys.includes(e); + } + get(e) { + const i = this._keys.indexOf(e); + return i > -1 ? this._values[i] : null; + } + deepGet(e) { + if (!e || !e.length) + return null; + const i = (r, n) => r == null ? null : n.length ? i(r instanceof WOe ? r.get(n[0]) : r[n[0]], n.slice(1)) : r; + return i(this.get(e[0]), e.slice(1)); + } + set(e, i) { + const r = this, n = this._keys.indexOf(e); + return n > -1 ? r._values[n] = i : (r._keys.push(e), r._values.push(i), r.length = r._values.length), this; + } + sortedSet(e, i, r, n) { + const s = this, o = this._keys.length, a = r || 0, l = n !== void 0 ? n : o - 1; + if (o === 0) + return s._keys.push(e), s._values.push(i), s; + if (e === this._keys[a]) + return this._values.splice(a, 0, i), this; + if (e === this._keys[l]) + return this._values.splice(l, 0, i), this; + if (e > this._keys[l]) + return this._keys.splice(l + 1, 0, e), this._values.splice(l + 1, 0, i), this; + if (e < this._keys[a]) + return this._values.splice(a, 0, i), this._keys.splice(a, 0, e), this; + if (a >= l) + return this; + const c = a + Math.floor((l - a) / 2); + return e < this._keys[c] ? this.sortedSet(e, i, a, c - 1) : e > this._keys[c] ? this.sortedSet(e, i, c + 1, l) : this; + } + size() { + return this.length; + } + clear() { + const e = this; + return e._keys.length = e.length = e._values.length = 0, this; + } + delete(e) { + const i = this, r = i._keys.indexOf(e); + return r > -1 && (i._keys.splice(r, 1), i._values.splice(r, 1), i.length = i._keys.length, !0); + } + forEach(e) { + this._keys.forEach((i, r) => { + e(this._values[r], i, r); + }); + } + map(e) { + return this.keys().map((i, r) => e(this._values[r], i, r)); + } + filter(e) { + const i = this; + return i._keys.forEach((r, n) => { + e(i._values[n], r, n) === !1 && i.delete(r); + }), this; + } + clone() { + return new WOe(this.entries()); + } +}, jKe = class { + constructor(e = 20) { + this._maxEntries = e, this._values = new IFi(); + } + delete(e) { + this._values.has(e) && this._values.delete(e); + } + get(e) { + let i = null; + return this._values.has(e) && (i = this._values.get(e), this._values.delete(e), this._values.set(e, i)), i; + } + put(e, i) { + if (this._values.size() >= this._maxEntries) { + const r = this._values.keys()[0]; + this._values.delete(r); + } + this._values.set(e, i); + } +}, AFi = class { + constructor(e = 20) { + this._maxEntries = e, this._cache = new jKe(this._maxEntries); + } + clear() { + this._cache = new jKe(this._maxEntries); + } + addToCache(e, i) { + this._cache.put(e, i); + } + removeFromCache(e) { + this._cache.delete(e); + } + getFromCache(e) { + return this._cache.get(e); + } +}, kV = class hP { + constructor(e) { + this.portalUri = e; + } + normalizeModuleUri(e) { + const i = /^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([\?|\/].*)?$/gi, r = /(?.+)\/home\/item\.html\?id\=(?.+)$/gi, n = /(?.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?.+)$/gi, s = /(?.+)\/sharing\/rest\/content\/items\/(?.+)$/gi, o = /(?.*)@(?[0-9]+\.[0-9]+\.[0-9]+)([\?|\/].*)?$/gi; + if (e.startsWith("portal+")) { + let a = e.substring(7), l = "", c = a, h = !1; + for (const v of [r, s, n]) { + const x = v.exec(a); + if (x !== null) { + const I = x.groups; + c = I.itemid, l = I.portalurl, h = !0; + break; + } + } + if (h === !1) { + if (!i.test(a)) + throw new Rwe(L6.UnsupportedUriProtocol, { uri: e }); + c = a, l = this.portalUri; + } + c.includes("/") && (c = c.split("/")[0]), c.includes("?") && (c = c.split("?")[0]); + let p = "current"; + const y = o.exec(c); + if (y !== null) { + const v = y.groups; + c = v.itemid, p = v.versionstring; + } + return a = new Ic({ url: l }).restUrl + "/content/items/" + c + "/resources/" + p + ".arc", { url: a, scheme: "portal", uri: "PO:" + a }; + } + if (e.startsWith("mock")) { + if (e === "mock") + return { url: "", scheme: "mock", data: ` + export var hello = 1; + export function helloWorld() { + return "Hello World " + hello; + } + `, uri: "mock" }; + const a = e.replace("mock:", ""); + if (hP.mocks[a] !== void 0) + return { url: "", scheme: "mock", data: hP.mocks[a], uri: e }; + } + throw new Rwe(L6.UnrecognisedUri, { uri: e }); + } + async fetchModule(e) { + const i = hP.cachedModules.getFromCache(e.uri); + if (i) + return i; + const r = this.fetchSource(e); + hP.cachedModules.addToCache(e.uri, r); + let n = null; + try { + n = await r; + } catch (s) { + throw hP.cachedModules.removeFromCache(e.uri), s; + } + return n; + } + async fetchSource(e) { + if (e.scheme === "portal") { + const i = await ir(e.url, { responseType: "text", query: {} }); + if (i.data) + return Kpe(i.data, []); + } + if (e.scheme === "mock") + return Kpe(e.data ?? "", []); + throw new Rwe(L6.UnsupportedUriProtocol); + } + static create(e) { + return new hP(e); + } + static getDefault() { + return this._default ?? (hP._default = hP._moduleResolverFactory()); + } + static set moduleResolverClass(e) { + this._moduleResolverFactory = e, this._default = null; + } +}; +kV.mocks = {}, kV.cachedModules = new AFi(30), kV._default = null, kV._moduleResolverFactory = () => { + const t = Ic.getDefault(); + return new kV(t.url); +}; +let PFi = class extends QF { + constructor(e, i) { + super(), this.definition = null, this.context = null, this.definition = e, this.context = i; + } + createFunction(e) { + return (...i) => { + const r = { spatialReference: this.context.spatialReference, console: this.context.console, timeReference: this.context.timeReference ? this.context.timeReference : null, lrucache: this.context.lrucache, exports: this.context.exports, libraryResolver: this.context.libraryResolver, interceptor: this.context.interceptor, localScope: {}, depthCounter: { depth: e.depthCounter.depth + 1 }, globalScope: this.context.globalScope }; + if (r.depthCounter.depth > 64) + throw new Bt(e, At.MaximumCallDepth, null); + return Uwe(this.definition, r, i, null); + }; + } + call(e, i) { + return qP(e, i, (r, n, s) => { + const o = { spatialReference: e.spatialReference, globalScope: e.globalScope, depthCounter: { depth: e.depthCounter.depth + 1 }, libraryResolver: e.libraryResolver, exports: e.exports, timeReference: e.timeReference ?? null, console: e.console, lrucache: e.lrucache, interceptor: e.interceptor, localScope: {} }; + if (o.depthCounter.depth > 64) + throw new Bt(e, At.MaximumCallDepth, i); + return Uwe(this.definition, o, s, i); + }); + } + marshalledCall(e, i, r, n) { + return n(e, i, (s, o, a) => { + const l = { spatialReference: e.spatialReference, globalScope: r.globalScope, depthCounter: { depth: e.depthCounter.depth + 1 }, libraryResolver: e.libraryResolver, exports: e.exports, console: e.console, timeReference: e.timeReference ?? null, lrucache: e.lrucache, interceptor: e.interceptor, localScope: {} }; + return a = a.map((c) => !du(c) || c instanceof Fx ? c : e4(c, e, n)), e4(Uwe(this.definition, l, a, i), r, n); + }); + } +}, WU = class extends jie { + constructor(e) { + super(e); + } + global(e) { + const i = this.executingContext.globalScope[e.toLowerCase()]; + if (i.valueset || (i.value = Us(this.executingContext, i.node), i.valueset = !0), du(i.value) && !(i.value instanceof Fx)) { + const r = new Fx(); + r.fn = i.value, r.parameterEvaluator = qP, r.context = this.executingContext, i.value = r; + } + return i.value; + } + setGlobal(e, i) { + if (du(i)) + throw new Bt(null, At.AssignModuleFunction, null); + this.executingContext.globalScope[e.toLowerCase()] = { value: i, valueset: !0, node: null }; + } + hasGlobal(e) { + return this.executingContext.exports[e] === void 0 && (e = e.toLowerCase()), this.executingContext.exports[e] !== void 0; + } + loadModule(e) { + let i = e.spatialReference; + i == null && (i = new or({ wkid: 102100 })), this.moduleScope = NTt({}, e.customfunctions, e.timeReference), this.executingContext = { spatialReference: i, globalScope: this.moduleScope, localScope: null, libraryResolver: new Jz(e.libraryResolver._moduleSingletons, this.source.syntax.loadedModules), exports: {}, console: e.console ? e.console : kTt, timeReference: e.timeReference ?? null, lrucache: e.lrucache, interceptor: e.interceptor, depthCounter: { depth: 1 } }, Us(this.executingContext, this.source.syntax); + } +}; +function OFi(t, e) { + const i = []; + for (let r = 0; r < e.arguments.length; r++) + i.push(Us(t, e.arguments[r])); + return i; +} +function qP(t, e, i) { + try { + return e.preparsed === !0 ? i(t, null, e.arguments) : i(t, e, OFi(t, e)); + } catch (r) { + throw r; + } +} +function Us(t, e) { + try { + switch (e?.type) { + case "EmptyStatement": + return en; + case "VariableDeclarator": + return qFi(t, e); + case "VariableDeclaration": + return WFi(t, e); + case "ImportDeclaration": + return zFi(t, e); + case "ExportNamedDeclaration": + return HFi(t, e); + case "BlockStatement": + case "Program": + return jFi(t, e); + case "FunctionDeclaration": + return UFi(t, e); + case "ReturnStatement": + return GFi(t, e); + case "IfStatement": + return VFi(t, e); + case "ExpressionStatement": + return BFi(t, e); + case "AssignmentExpression": + return $Fi(t, e); + case "UpdateExpression": + return kFi(t, e); + case "BreakStatement": + return xm; + case "ContinueStatement": + return jI; + case "TemplateElement": + return QFi(t, e); + case "TemplateLiteral": + return t4i(t, e); + case "ForStatement": + return FFi(t, e); + case "ForInStatement": + return DFi(t, e); + case "WhileStatement": + return LFi(t, e); + case "Identifier": + return DTt(t, e); + case "MemberExpression": + return YFi(t, e); + case "Literal": + return e.value; + case "CallExpression": + return i4i(t, e); + case "UnaryExpression": + return XFi(t, e); + case "BinaryExpression": + return JFi(t, e); + case "LogicalExpression": + return ZFi(t, e); + case "ArrayExpression": + return KFi(t, e); + case "ObjectExpression": + return RFi(t, e); + case "Property": + return MFi(t, e); + default: + throw new Bt(t, At.Unrecognised, e); + } + } catch (i) { + throw QCt(t, e, i); + } +} +function RFi(t, e) { + const i = {}, r = /* @__PURE__ */ new Map(); + for (let s = 0; s < e.properties.length; s++) { + const o = Us(t, e.properties[s]); + if (du(o.value)) + throw new Bt(t, At.NoFunctionInDictionary, e); + if (wn(o.key) === !1) + throw new Bt(t, At.KeyMustBeString, e); + let a = o.key.toString(); + const l = a.toLowerCase(); + r.has(l) ? a = r.get(l) : r.set(l, a), o.value === en ? i[a] = null : i[a] = o.value; + } + const n = new is(i); + return n.immutable = !1, n; +} +function MFi(t, e) { + return { key: e.key.type === "Identifier" ? e.key.name : Us(t, e.key), value: Us(t, e.value) }; +} +function DFi(t, e) { + const i = Us(t, e.right); + e.left.type === "VariableDeclaration" && Us(t, e.left); + let r = null, n = ""; + if (e.left.type === "VariableDeclaration") { + const s = e.left.declarations[0].id; + s.type === "Identifier" && (n = s.name); + } else + e.left.type === "Identifier" && (n = e.left.name); + if (!n) + throw new Bt(t, At.InvalidIdentifier, e); + if (n = n.toLowerCase(), t.localScope != null && t.localScope[n] !== void 0 && (r = t.localScope[n]), r === null && t.globalScope[n] !== void 0 && (r = t.globalScope[n]), r === null) + throw new Bt(t, At.InvalidIdentifier, e); + if (Mn(i) || wn(i)) { + const s = i.length; + for (let o = 0; o < s; o++) { + r.value = o; + const a = Us(t, e.body); + if (a === xm) + break; + if (a instanceof hd) + return a; + } + return en; + } + if (Es(i)) { + for (let s = 0; s < i.length(); s++) { + r.value = s; + const o = Us(t, e.body); + if (o === xm) + break; + if (o instanceof hd) + return o; + } + return en; + } + if (!(i instanceof is || bu(i))) + return en; + { + const s = i.keys(); + for (let o = 0; o < s.length; o++) { + r.value = s[o]; + const a = Us(t, e.body); + if (a === xm) + break; + if (a instanceof hd) + return a; + } + } +} +function FFi(t, e) { + e.init !== null && Us(t, e.init); + const i = { testResult: !0, lastAction: en }; + do + NFi(t, e, i); + while (i.testResult === !0); + return i.lastAction instanceof hd ? i.lastAction : en; +} +function LFi(t, e) { + const i = { testResult: !0, lastAction: en }; + if (i.testResult = Us(t, e.test), i.testResult === !1) + return en; + if (i.testResult !== !0) + throw new Bt(t, At.BooleanConditionRequired, e); + for (; i.testResult === !0 && (i.lastAction = Us(t, e.body), i.lastAction !== xm) && !(i.lastAction instanceof hd); ) + if (i.testResult = Us(t, e.test), i.testResult !== !0 && i.testResult !== !1) + throw new Bt(t, At.BooleanConditionRequired, e); + return i.lastAction instanceof hd ? i.lastAction : en; +} +function NFi(t, e, i) { + if (e.test !== null) { + if (i.testResult = Us(t, e.test), i.testResult === !1) + return; + if (i.testResult !== !0) + throw new Bt(t, At.BooleanConditionRequired, e); + } + i.lastAction = Us(t, e.body), i.lastAction !== xm ? i.lastAction instanceof hd ? i.testResult = !1 : e.update !== null && Us(t, e.update) : i.testResult = !1; +} +function kFi(t, e) { + let i, r = null, n = ""; + if (e.argument.type === "MemberExpression") { + if (r = Us(t, e.argument.object), e.argument.computed === !0 ? n = Us(t, e.argument.property) : e.argument.property.type === "Identifier" && (n = e.argument.property.name), Mn(r)) { + if (!il(n)) + throw new Bt(t, At.ArrayAccessorMustBeNumber, e); + if (n < 0 && (n = r.length + n), n < 0 || n >= r.length) + throw new Bt(t, At.OutOfBounds, e); + i = Di(r[n]), r[n] = e.operator === "++" ? i + 1 : i - 1; + } else if (r instanceof is) { + if (wn(n) === !1) + throw new Bt(t, At.KeyAccessorMustBeString, e); + if (r.hasField(n) !== !0) + throw new Bt(t, At.FieldNotFound, e); + i = Di(r.field(n)), r.setField(n, e.operator === "++" ? i + 1 : i - 1); + } else if (bu(r)) { + if (wn(n) === !1) + throw new Bt(t, At.KeyAccessorMustBeString, e); + if (r.hasField(n) !== !0) + throw new Bt(t, At.FieldNotFound, e); + i = Di(r.field(n)), r.setField(n, e.operator === "++" ? i + 1 : i - 1); + } else { + if (Es(r)) + throw new Bt(t, At.Immutable, e); + if (!(r instanceof WU)) + throw new Bt(t, At.InvalidParameter, e); + if (wn(n) === !1) + throw new Bt(t, At.ModuleAccessorMustBeString, e); + if (r.hasGlobal(n) !== !0) + throw new Bt(t, At.ModuleExportNotFound, e); + i = Di(r.global(n)), r.setGlobal(n, e.operator === "++" ? i + 1 : i - 1); + } + return e.prefix === !1 ? i : e.operator === "++" ? i + 1 : i - 1; + } + if (r = e.argument.type === "Identifier" ? e.argument.name.toLowerCase() : "", !r) + throw new Bt(t, At.InvalidIdentifier, e); + if (t.localScope != null && t.localScope[r] !== void 0) + return i = Di(t.localScope[r].value), t.localScope[r] = { value: e.operator === "++" ? i + 1 : i - 1, valueset: !0, node: e }, e.prefix === !1 ? i : e.operator === "++" ? i + 1 : i - 1; + if (t.globalScope[r] !== void 0) + return i = Di(t.globalScope[r].value), t.globalScope[r] = { value: e.operator === "++" ? i + 1 : i - 1, valueset: !0, node: e }, e.prefix === !1 ? i : e.operator === "++" ? i + 1 : i - 1; + throw new Bt(t, At.InvalidIdentifier, e); +} +function AA(t, e, i, r, n) { + switch (e) { + case "=": + return t === en ? null : t; + case "/=": + return Di(i) / Di(t); + case "*=": + return Di(i) * Di(t); + case "-=": + return Di(i) - Di(t); + case "+=": + return wn(i) || wn(t) ? un(i) + un(t) : Di(i) + Di(t); + case "%=": + return Di(i) % Di(t); + default: + throw new Bt(n, At.UnsupportedOperator, r); + } +} +function $Fi(t, e) { + let i = null, r = ""; + if (e.left.type === "MemberExpression") { + if (i = Us(t, e.left.object), e.left.computed === !0) + r = Us(t, e.left.property); + else { + if (e.left.property.type !== "Identifier") + throw new Bt(t, At.InvalidIdentifier, e); + r = e.left.property.name; + } + const s = Us(t, e.right); + if (Mn(i)) { + if (!il(r)) + throw new Bt(t, At.ArrayAccessorMustBeNumber, e); + if (r < 0 && (r = i.length + r), r < 0 || r > i.length) + throw new Bt(t, At.OutOfBounds, e); + if (r === i.length) { + if (e.operator !== "=") + throw new Bt(t, At.OutOfBounds, e); + i[r] = AA(s, e.operator, i[r], e, t); + } else + i[r] = AA(s, e.operator, i[r], e, t); + } else if (i instanceof is) { + if (wn(r) === !1) + throw new Bt(t, At.KeyAccessorMustBeString, e); + if (i.hasField(r) === !0) + i.setField(r, AA(s, e.operator, i.field(r), e, t)); + else { + if (e.operator !== "=") + throw new Bt(t, At.FieldNotFound, e, { key: r }); + i.setField(r, AA(s, e.operator, null, e, t)); + } + } else if (bu(i)) { + if (wn(r) === !1) + throw new Bt(t, At.KeyAccessorMustBeString, e); + if (i.hasField(r) === !0) + i.setField(r, AA(s, e.operator, i.field(r), e, t)); + else { + if (e.operator !== "=") + throw new Bt(t, At.FieldNotFound, e, { key: r }); + i.setField(r, AA(s, e.operator, null, e, t)); + } + } else { + if (Es(i)) + throw new Bt(t, At.Immutable, e); + if (!(i instanceof WU)) + throw new Bt(t, At.InvalidIdentifier, e); + if (wn(r) === !1) + throw new Bt(t, At.ModuleAccessorMustBeString, e); + if (i.hasGlobal(r) !== !0) + throw new Bt(t, At.ModuleExportNotFound, e); + i.setGlobal(r, AA(s, e.operator, i.global(r), e, t)); + } + return en; + } + i = e.left.name.toLowerCase(); + const n = Us(t, e.right); + if (t.localScope != null && t.localScope[i] !== void 0) + return t.localScope[i] = { value: AA(n, e.operator, t.localScope[i].value, e, t), valueset: !0, node: e.right }, en; + if (t.globalScope[i] !== void 0) + return t.globalScope[i] = { value: AA(n, e.operator, t.globalScope[i].value, e, t), valueset: !0, node: e.right }, en; + throw new Bt(t, At.InvalidIdentifier, e); +} +function BFi(t, e) { + if (e.expression.type === "AssignmentExpression" || e.expression.type === "UpdateExpression") + return Us(t, e.expression); + if (e.expression.type === "CallExpression") { + const i = Us(t, e.expression); + return i === en ? en : new _I(i); + } + { + const i = Us(t, e.expression); + return i === en ? en : new _I(i); + } +} +function VFi(t, e) { + const i = Us(t, e.test); + if (i === !0) + return Us(t, e.consequent); + if (i === !1) + return e.alternate !== null ? Us(t, e.alternate) : en; + throw new Bt(t, At.BooleanConditionRequired, e); +} +function jFi(t, e) { + let i = en; + for (let r = 0; r < e.body.length; r++) + if (i = Us(t, e.body[r]), i instanceof hd || i === xm || i === jI) + return i; + return i; +} +function GFi(t, e) { + if (e.argument === null) + return new hd(en); + const i = Us(t, e.argument); + return new hd(i); +} +function UFi(t, e) { + const i = e.id.name.toLowerCase(); + return t.globalScope[i] = { valueset: !0, node: null, value: new PFi(e, t) }, en; +} +function zFi(t, e) { + const i = e.specifiers[0].local.name.toLowerCase(), r = t.libraryResolver.loadLibrary(i); + let n = null; + return t.libraryResolver._moduleSingletons?.has(r.uri) ? n = t.libraryResolver._moduleSingletons.get(r.uri) : (n = new WU(r), n.loadModule(t), t.libraryResolver._moduleSingletons?.set(r.uri, n)), t.globalScope[i] = { value: n, valueset: !0, node: e }, en; +} +function HFi(t, e) { + if (Us(t, e.declaration), e.declaration.type === "FunctionDeclaration") + t.exports[e.declaration.id.name.toLowerCase()] = "function"; + else if (e.declaration.type === "VariableDeclaration") + for (const i of e.declaration.declarations) + t.exports[i.id.name.toLowerCase()] = "variable"; + return en; +} +function WFi(t, e) { + for (let i = 0; i < e.declarations.length; i++) + Us(t, e.declarations[i]); + return en; +} +function qFi(t, e) { + let i = e.init === null ? null : Us(t, e.init); + if (i === en && (i = null), e.id.type !== "Identifier") + throw new Bt(t, At.InvalidIdentifier, e); + const r = e.id.name.toLowerCase(); + return t.localScope != null ? t.localScope[r] = { value: i, valueset: !0, node: e.init } : t.globalScope[r] = { value: i, valueset: !0, node: e.init }, en; +} +function YFi(t, e) { + try { + const i = Us(t, e.object); + if (i === null) + throw new Bt(t, At.MemberOfNull, e); + if (e.computed === !1) { + if (e.property.type === "Identifier") { + if (i instanceof is || bu(i)) + return i.field(e.property.name); + if (i instanceof tn) + return N$(i, e.property.name, e, t); + if (i instanceof WU) { + if (!i.hasGlobal(e.property.name)) + throw new Bt(t, At.InvalidIdentifier, e); + return i.global(e.property.name); + } + } + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + { + let r = Us(t, e.property); + if (i instanceof is || bu(i)) { + if (wn(r)) + return i.field(r); + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + if (i instanceof WU) { + if (wn(r)) + return i.global(r); + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + if (i instanceof tn) { + if (wn(r)) + return N$(i, r, e, t); + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + if (Mn(i)) { + if (il(r) && isFinite(r) && Math.floor(r) === r) { + if (r < 0 && (r = i.length + r), r >= i.length || r < 0) + throw new Bt(t, At.OutOfBounds, e); + return i[r]; + } + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + if (wn(i)) { + if (il(r) && isFinite(r) && Math.floor(r) === r) { + if (r < 0 && (r = i.length + r), r >= i.length || r < 0) + throw new Bt(t, At.OutOfBounds, e); + return i[r]; + } + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + if (Es(i)) { + if (il(r) && isFinite(r) && Math.floor(r) === r) { + if (r < 0 && (r = i.length() + r), r >= i.length() || r < 0) + throw new Bt(t, At.OutOfBounds, e); + return i.get(r); + } + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + throw new Bt(t, At.InvalidMemberAccessKey, e); + } + } catch (i) { + throw i; + } +} +function XFi(t, e) { + try { + const i = Us(t, e.argument); + if (ka(i)) { + if (e.operator === "!") + return !i; + if (e.operator === "-") + return -1 * Di(i); + if (e.operator === "+") + return 1 * Di(i); + if (e.operator === "~") + return ~Di(i); + throw new Bt(t, At.UnsupportedUnaryOperator, e); + } + if (e.operator === "~") + return ~Di(i); + if (e.operator === "-") + return -1 * Di(i); + if (e.operator === "+") + return 1 * Di(i); + throw new Bt(t, At.UnsupportedUnaryOperator, e); + } catch (i) { + throw i; + } +} +function KFi(t, e) { + try { + const i = []; + for (let r = 0; r < e.elements.length; r++) { + const n = Us(t, e.elements[r]); + if (du(n)) + throw new Bt(t, At.NoFunctionInArray, e); + n === en ? i.push(null) : i.push(n); + } + return i; + } catch (i) { + throw i; + } +} +function JFi(t, e) { + try { + const i = [Us(t, e.left), Us(t, e.right)], r = i[0], n = i[1]; + switch (e.operator) { + case "|": + case "<<": + case ">>": + case ">>>": + case "^": + case "&": + return F0e(Di(r), Di(n), e.operator); + case "==": + return Bv(r, n); + case "!=": + return !Bv(r, n); + case "<": + case ">": + case "<=": + case ">=": + return D0e(r, n, e.operator); + case "+": + return wn(r) || wn(n) ? un(r) + un(n) : Di(r) + Di(n); + case "-": + return Di(r) - Di(n); + case "*": + return Di(r) * Di(n); + case "/": + return Di(r) / Di(n); + case "%": + return Di(r) % Di(n); + default: + throw new Bt(t, At.UnsupportedOperator, e); + } + } catch (i) { + throw i; + } +} +function ZFi(t, e) { + try { + const i = Us(t, e.left); + if (ka(i)) + switch (e.operator) { + case "||": + if (i === !0) + return i; + { + const r = Us(t, e.right); + if (ka(r)) + return r; + throw new Bt(t, At.LogicExpressionOrAnd, e); + } + case "&&": + if (i === !1) + return i; + { + const r = Us(t, e.right); + if (ka(r)) + return r; + throw new Bt(t, At.LogicExpressionOrAnd, e); + } + default: + throw new Bt(t, At.LogicExpressionOrAnd, e); + } + throw new Bt(t, At.LogicalExpressionOnlyBoolean, e); + } catch (i) { + throw i; + } +} +function QFi(t, e) { + return e.value ? e.value.cooked : ""; +} +function e4i(t, e, i) { + if (du(t)) + throw new Bt(e, At.NoFunctionInTemplateLiteral, i); + return t; +} +function t4i(t, e) { + let i = "", r = 0; + for (const n of e.quasis) + i += n.value ? n.value.cooked : "", n.tail === !1 && (i += e.expressions[r] ? un(e4i(Us(t, e.expressions[r]), t, e)) : "", r++); + return i; +} +function DTt(t, e) { + let i; + try { + const r = e.name.toLowerCase(); + if (t.localScope != null && t.localScope[r] !== void 0) + return i = t.localScope[r], i.valueset === !0 || (i.value = Us(t, i.node), i.valueset = !0), i.value; + if (t.globalScope[r] !== void 0) + return i = t.globalScope[r], i.valueset === !0 || (i.value = Us(t, i.node), i.valueset = !0), i.value; + throw new Bt(t, At.InvalidIdentifier, e); + } catch (r) { + throw r; + } +} +function i4i(t, e) { + try { + if (e.callee.type === "MemberExpression") { + const i = Us(t, e.callee.object); + if (!(i instanceof WU)) + throw new Bt(t, At.FuncionNotFound, e); + const r = e.callee.computed === !1 ? e.callee.property.name : Us(t, e.callee.property); + if (!i.hasGlobal(r)) + throw new Bt(t, At.FuncionNotFound, e); + const n = i.global(r); + if (!du(n)) + throw new Bt(t, At.CallNonFunction, e); + return n.call(t, e); + } + if (e.callee.type !== "Identifier") + throw new Bt(t, At.FuncionNotFound, e); + if (t.localScope != null && t.localScope[e.callee.name.toLowerCase()] !== void 0) { + const i = t.localScope[e.callee.name.toLowerCase()]; + if (du(i.value)) + return i.value.call(t, e); + throw new Bt(t, At.CallNonFunction, e); + } + if (t.globalScope[e.callee.name.toLowerCase()] !== void 0) { + const i = t.globalScope[e.callee.name.toLowerCase()]; + if (du(i.value)) + return i.value.call(t, e); + throw new Bt(t, At.CallNonFunction, e); + } + throw new Bt(t, At.FuncionNotFound, e); + } catch (i) { + throw i; + } +} +const Sv = {}; +function FTt(t, e, i, r) { + try { + const n = Us(t, e.arguments[i]); + if (Bv(n, r)) + return Us(t, e.arguments[i + 1]); + { + const s = e.arguments.length - i; + return s === 1 ? Us(t, e.arguments[i]) : s === 2 ? null : s === 3 ? Us(t, e.arguments[i + 2]) : FTt(t, e, i + 2, r); + } + } catch (n) { + throw n; + } +} +function LTt(t, e, i, r) { + try { + if (r === !0) + return Us(t, e.arguments[i + 1]); + if (e.arguments.length - i === 3) + return Us(t, e.arguments[i + 2]); + { + const n = Us(t, e.arguments[i + 2]); + if (ka(n) === !1) + throw new Bt(t, At.BooleanConditionRequired, e.arguments[i + 2]); + return LTt(t, e, i + 2, n); + } + } catch (n) { + throw n; + } +} +function Uwe(t, e, i, r) { + try { + const n = t.body; + if (i.length !== t.params.length) + throw new Bt(e, At.WrongNumberOfParameters, r); + if (e.localScope != null) + for (let o = 0; o < i.length; o++) + e.localScope[t.params[o].name.toLowerCase()] = { value: i[o], valueset: !0, node: null }; + const s = Us(e, n); + if (s instanceof hd) + return s.value; + if (s === xm) + throw new Bt(e, At.UnexpectedToken, r); + if (s === jI) + throw new Bt(e, At.UnexpectedToken, r); + return s instanceof _I ? s.value : s; + } catch (n) { + throw n; + } +} +T$e(Sv, qP), R$e(Sv, qP), A$e(Sv, qP), E$e(Sv, qP), P$e(Sv, qP), I$e(Sv, qP), Sv.iif = function(t, e) { + try { + Zi(e.arguments === null ? [] : e.arguments, 3, 3, t, e); + const i = Us(t, e.arguments[0]); + if (ka(i) === !1) + throw new Bt(t, At.BooleanConditionRequired, e); + return Us(t, i === !0 ? e.arguments[1] : e.arguments[2]); + } catch (i) { + throw i; + } +}, Sv.decode = function(t, e) { + try { + if (e.arguments.length < 2) + throw new Bt(t, At.WrongNumberOfParameters, e); + if (e.arguments.length === 2) + return Us(t, e.arguments[1]); + { + if ((e.arguments.length - 1) % 2 == 0) + throw new Bt(t, At.WrongNumberOfParameters, e); + const i = Us(t, e.arguments[0]); + return FTt(t, e, 1, i); + } + } catch (i) { + throw i; + } +}, Sv.when = function(t, e) { + try { + if (e.arguments.length < 3) + throw new Bt(t, At.WrongNumberOfParameters, e); + if (e.arguments.length % 2 == 0) + throw new Bt(t, At.WrongNumberOfParameters, e); + const i = Us(t, e.arguments[0]); + if (ka(i) === !1) + throw new Bt(t, At.BooleanConditionRequired, e.arguments[0]); + return LTt(t, e, 0, i); + } catch (i) { + throw i; + } +}; +for (const t in Sv) + Sv[t] = { value: new vI(Sv[t]), valueset: !0, node: null }; +const qJ = function() { +}; +function NTt(t, e, i) { + const r = new qJ(); + t || (t = {}), e || (e = {}); + const n = new is({ newline: ` +`, tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" }); + n.immutable = !1, r.textformatting = { value: n, valueset: !0, node: null }; + for (const s in e) + r[s] = { value: new vI(e[s]), native: !0, valueset: !0, node: null }; + for (const s in t) + t[s] && t[s].declaredClass === "esri.Graphic" ? r[s] = { value: ph.createFromGraphic(t[s], i), valueset: !0, node: null } : r[s] = { value: t[s], valueset: !0, node: null }; + return r; +} +qJ.prototype = Sv, qJ.prototype.infinity = { value: Number.POSITIVE_INFINITY, valueset: !0, node: null }, qJ.prototype.pi = { value: Math.PI, valueset: !0, node: null }; +function kTt(t) { + console.log(t); +} +function $Tt(t) { + const e = { mode: "sync", compiled: !1, functions: {}, signatures: [], standardFunction: qP, evaluateIdentifier: DTt }; + for (let i = 0; i < t.length; i++) + t[i].registerFunctions(e); + for (const i in e.functions) + Sv[i] = { value: new vI(e.functions[i]), valueset: !0, node: null }, qJ.prototype[i] = Sv[i]; + for (let i = 0; i < e.signatures.length; i++) + Hpe(e.signatures[i], "sync"); +} +function qOe(t, e) { + let i = e.spatialReference; + i == null && (i = new or({ wkid: 102100 })); + let r = null; + t.usesModules && (r = new Jz(/* @__PURE__ */ new Map(), t.loadedModules)); + const n = { spatialReference: i, globalScope: NTt(e.vars, e.customfunctions, e.timeReference), localScope: null, exports: {}, libraryResolver: r, console: e.console ? e.console : kTt, timeReference: e.timeReference ?? null, lrucache: e.lrucache, interceptor: e.interceptor, depthCounter: { depth: 1 } }; + let s = Us(n, t); + if (s instanceof hd && (s = s.value), s instanceof _I && (s = s.value), s === en && (s = null), s === xm) + throw new Bt(n, At.IllegalResult, null); + if (s === jI) + throw new Bt(n, At.IllegalResult, null); + if (du(s)) + throw new Bt(n, At.IllegalResult, null); + return s; +} +$Tt([Wpe]); +const r4i = ["feature", "angle", "bearing", "centroid", "envelopeintersects", "extent", "geometry", "isselfintersecting", "ringisclockwise"]; +function n4i() { + return !0; +} +const s4i = n4i(); +let BTt = !1, VTt = !1, MS = null, YOe = []; +function jTt(t, e) { + if (e.useAsync === !0 || t.isAsync === !0) + return o4i(t, e); + if (Vi("esri-csp-restrictions")) + return function(i) { + return qOe(t, i); + }; + try { + return ATt(t, e); + } catch (i) { + if (i.declaredRootClass === "esri.arcade.arcadeuncompilableerror") + return function(r) { + return qOe(t, r); + }; + throw i; + } +} +function o4i(t, e) { + if (MS === null) + throw new Bt(null, At.AsyncNotEnabled, null); + if (Vi("esri-csp-restrictions") || s4i === !1) + return function(i) { + return MS.executeScript(t, i); + }; + try { + return ATt(t, e, !0); + } catch (i) { + if (i.declaredRootClass === "esri.arcade.arcadeuncompilableerror") + return function(r) { + return MS.executeScript(t, r); + }; + throw i; + } +} +function a4i(t) { + $Tt(t), k$(t, "sync"), MS === null ? YOe.push(t) : (k$(t, "async"), MS.extend(t)); +} +function F$e(t, e = []) { + return Kpe(t, e); +} +function l4i(t, e, i = []) { + return L$e(Kpe(t, i), e); +} +function L$e(t, e) { + if (e.useAsync === !0 || t.isAsync === !0) { + if (MS === null) + throw new Bt(null, At.AsyncNotEnabled, null); + return MS.executeScript(t, e); + } + return qOe(t, e); +} +function $0e(t, e) { + return dTt(t, e); +} +function u4i(t, e) { + return XMi(t, e); +} +function c4i(t, e = !1) { + return e === void 0 && (e = !1), KMi(t); +} +function GTt(t) { + return JMi(t); +} +function B0e(t, e = []) { + return t.usesGeometry === void 0 && Gie(t, e), t.usesGeometry === !0; +} +let zwe = null; +function N$e() { + return zwe || (zwe = UTt(), zwe); +} +async function UTt() { + const [t, e] = await Promise.all([Promise.resolve().then(() => N3r), Promise.resolve().then(() => pDi)]); + return VTt = !0, e.setGeometryEngine(t), !0; +} +let Hwe = null; +function k$e() { + return Hwe !== null || (Hwe = zTt()), Hwe; +} +async function zTt() { + await dFi(), MS = await Promise.resolve().then(() => fRr); + for (const t of YOe) + MS.extend(t), k$(t, "async"); + return YOe = null, !0; +} +function HTt() { + return BTt; +} +function WTt() { + return !!MS; +} +function qTt() { + return VTt; +} +let Wwe = null; +function $$e() { + return Wwe || (Wwe = YTt(), Wwe); +} +async function YTt() { + await k$e(); + const [t, e, i, r, n] = await Promise.all([Promise.resolve().then(() => VRr), Promise.resolve().then(() => HRr), Promise.resolve().then(() => qRr), Promise.resolve().then(() => XRr), Promise.resolve().then(() => JRr)]); + return QTt = t, MS.extend([e, i, r, n]), k$([e, i, r, n], "async"), BTt = !0, !0; +} +function XTt(t, e = []) { + return t.usesFeatureSet === void 0 && Gie(t, e), t.usesFeatureSet === !0; +} +function h4i(t, e = []) { + return t.isAsync === void 0 && Gie(t, e), t.isAsync === !0; +} +function d4i(t, e) { + if (e) { + for (const i of e) + if ($0e(t, i)) + return !0; + return !1; + } + return !1; +} +async function KTt(t, e, i = [], r = !1, n = null) { + return B$e(/* @__PURE__ */ new Set(), t, e, i, r, n); +} +async function B$e(t, e, i, r = [], n = !1, s = null) { + const o = typeof e == "string" ? F$e(e) : e, a = []; + return o && (qTt() === !1 && (B0e(o) || n) && a.push(N$e()), WTt() === !1 && (o.isAsync === !0 || i) && a.push(k$e()), HTt() === !1 && (XTt(o) || d4i(o, r)) && a.push($$e())), a.length && await Promise.all(a), await JTt(t, o, s, i, n), !0; +} +function p4i(t, e = []) { + return t.usesModules === void 0 && Gie(t, e), t.usesModules === !0; +} +async function JTt(t, e, i = null, r = !1, n = !1) { + const s = pTt(e); + i === null && s.length > 0 && (i = kV.getDefault()), e.loadedModules = {}; + for (const o of s) { + Fg(i); + const a = i.normalizeModuleUri(o.source); + if (t.has(a.uri)) + throw new Bt(null, At.CircularModules, null); + t.add(a.uri); + const l = await i.fetchModule(a); + await B$e(t, l, r, [], n, i), t.delete(a.uri), l.isAsync && (e.isAsync = !0), l.usesFeatureSet && (e.usesFeatureSet = !0), l.usesGeometry && (e.usesGeometry = !0), e.loadedModules[o.libname] = { uri: a.uri, script: l }; + } +} +function ZTt(t) { + if (B0e(t)) + return !0; + const e = $Oe(t); + let i = !1; + for (let r = 0; r < e.length; r++) + if (r4i.includes(e[r])) { + i = !0; + break; + } + return i; +} +let QTt = null; +function V0e() { + return QTt; +} +const f4i = Object.freeze(Object.defineProperty({ __proto__: null, _loadScriptDependenciesImpl: B$e, compileScript: jTt, enableAsyncSupport: k$e, enableAsyncSupportImpl: zTt, enableFeatureSetSupport: $$e, enableFeatureSetSupportImpl: YTt, enableGeometrySupport: N$e, enableGeometrySupportImpl: UTt, executeScript: L$e, extend: a4i, extractExpectedFieldLiterals: GTt, extractFieldLiterals: c4i, featureSetUtils: V0e, isAsyncEnabled: WTt, isFeatureSetSupportEnabled: HTt, isGeometryEnabled: qTt, loadDependentModules: JTt, loadScriptDependencies: KTt, parseAndExecuteScript: l4i, parseScript: F$e, referencesFunction: u4i, referencesMember: $0e, scriptIsAsync: h4i, scriptTouchesGeometry: ZTt, scriptUsesFeatureSet: XTt, scriptUsesGeometryEngine: B0e, scriptUsesModules: p4i }, Symbol.toStringTag, { value: "Module" })), GKe = /^\$(feature|aggregatedFeatures)\./i, m4i = { vars: { $feature: "any", $view: "any" }, spatialReference: null }; +function g4i(t) { + return t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); +} +function y4i(t) { + return t == null ? null : Mn(t) || Es(t) ? "array" : Mu(t) ? "date" : wn(t) ? "text" : ka(t) ? "boolean" : il(t) ? "number" : t instanceof is ? "dictionary" : bu(t) ? "feature" : t instanceof Xi ? "point" : t instanceof xo ? "polygon" : t instanceof xa ? "polyline" : t instanceof Dd ? "multipoint" : t instanceof br ? "extent" : tu(t) ? "featureSet" : R0e(t) ? "featureSetCollection" : null; +} +function Uie(t) { + if (!t) + return null; + try { + return F$e(t); + } catch { + } + return null; +} +function v4i(t, e) { + const i = typeof t == "string" ? Uie(t) : t; + if (!i) + return null; + try { + return e = e || fi(m4i), jTt(i, e); + } catch { + } + return null; +} +function _4i(t, e) { + return { vars: { $feature: t == null ? new ph() : ph.createFromGraphic(t, null), $view: e && e.view }, spatialReference: e && e.sr }; +} +function b4i(t, e, i) { + return ph.createFromGraphicLikeObject(e, t, i, null); +} +function w4i(t, e) { + t.vars != null && (t.vars.$feature = e); +} +function x4i(t, e) { + let i; + try { + i = L$e(t, e); + } catch { + i = null; + } + return i; +} +function S4i(t, e) { + let i; + try { + i = t ? t(e) : null; + } catch { + i = null; + } + return i; +} +function C4i(t, e) { + try { + return t ? t(e) : Promise.resolve(null); + } catch { + return Promise.resolve(null); + } +} +function T4i(t, e) { + if (!t) + return []; + const i = typeof t == "string" ? Uie(t) : t; + if (!i) + return []; + const r = GTt(i); + let n = new Array(); + r.forEach((o) => { + GKe.test(o) && (o = o.replace(GKe, ""), n.push(o)); + }); + const s = n.filter((o) => o.includes("*")); + return n = n.filter((o) => !s.includes(o)), e && s.forEach((o) => { + const a = new RegExp(`^${o.split(/\*+/).map(g4i).join(".*")}$`, "i"); + e.forEach((l) => a.test(l) ? n.push(l) : null); + }), [...new Set(n.sort())]; +} +function E4i(t) { + return $0e(t, "$view"); +} +function I4i(t, e) { + return !!t && $0e(t, e); +} +function A4i(t) { + if (!(!t || t.spatialReference == null && (t.scale == null || t.viewingMode == null))) + return { view: t.viewingMode && t.scale != null ? new is({ viewingMode: t.viewingMode, scale: t.scale }) : null, sr: t.spatialReference }; +} +function P4i({ url: t, spatialReference: e, lrucache: i, interceptor: r }) { + const n = V0e(); + return n ? n.createFeatureSetCollectionFromService(t, e, i, r) : null; +} +function O4i({ layer: t, spatialReference: e, outFields: i, returnGeometry: r, lrucache: n, interceptor: s }) { + if (t === null) + return null; + const o = V0e(); + return o ? o.constructFeatureSet(t, e, i, r ?? !0, n, s) : null; +} +function R4i(t) { + if (t?.map === null) + return null; + const e = V0e(); + return e ? e.createFeatureSetCollectionFromMap(t.map, t.spatialReference, t.lrucache, t.interceptor) : null; +} +function M4i(t, e) { + return is.convertJsonToArcade(t, e); +} +function D4i(t, e, i = []) { + return KTt(t, e, i); +} +function F4i() { + return N$e(); +} +function L4i() { + return $$e(); +} +function N4i(t) { + return t.type === "simple" || t.type === "class-breaks" || t.type === "unique-value" || t.type === "dot-density" || t.type === "dictionary" || t.type === "pie-chart"; +} +function k4i(t) { + return t.declaredClass === "esri.layers.support.LabelClass"; +} +function $4i(t) { + return t.declaredClass === "esri.PopupTemplate"; +} +function eEt(t, e) { + if (!t) + return !1; + if (typeof t == "string") + return e(t); + const i = t; + if (N4i(i)) { + if (i.type === "dot-density") { + const s = i.attributes?.some((o) => e(o.valueExpression)); + if (s) + return s; + } + const r = i.visualVariables, n = !!r && r.some((s) => { + let o = e(s.valueExpression); + return s.type === "size" && (EE(s.minSize) && (o = o || e(s.minSize.valueExpression)), EE(s.maxSize) && (o = o || e(s.maxSize.valueExpression))), o; + }); + return !(!("valueExpression" in i) || !e(i.valueExpression)) || n; + } + if (k4i(i)) { + const r = i.labelExpressionInfo && i.labelExpressionInfo.expression; + return !(!r || !e(r)) || !1; + } + return !!$4i(i) && (!!i.expressionInfos && i.expressionInfos.some((r) => e(r.expression)) || Array.isArray(i.content) && i.content.some((r) => r.type === "expression" && e(r.expressionInfo?.expression))); +} +function B4i(t) { + const e = Uie(t); + return !!e && ZTt(e); +} +function V4i(t) { + return eEt(t, B4i); +} +function j4i(t) { + const e = Uie(t); + return !!e && B0e(e); +} +function G4i(t) { + return eEt(t, j4i); +} +const tEt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Dictionary: is, + arcade: f4i, + arcadeFeature: ph, + convertFeatureLayerToFeatureSet: O4i, + convertJsonToArcade: M4i, + convertMapToFeatureSetCollection: R4i, + convertServiceUrlToWorkspace: P4i, + createExecContext: _4i, + createFeature: b4i, + createFunction: v4i, + createSyntaxTree: Uie, + dependsOnView: E4i, + enableFeatureSetOperations: L4i, + enableGeometryOperations: F4i, + evalSyntaxTree: x4i, + executeAsyncFunction: C4i, + executeFunction: S4i, + extractFieldNames: T4i, + getArcadeType: y4i, + getViewInfo: A4i, + hasGeometryFunctions: V4i, + hasGeometryOperations: G4i, + hasVariable: I4i, + loadScriptDependencies: D4i, + updateExecContext: w4i +}, Symbol.toStringTag, { value: "Module" })); +function U4i(t, e) { + const i = iEt[t.toLowerCase()]; + if (i == null) + throw new Error("Function Not Recognised"); + if (e.length < i.minParams || e.length > i.maxParams) + throw new Error(`Invalid Parameter count for call to ${t.toUpperCase()}`); + return i.evaluate(e); +} +function z4i(t, e) { + const i = iEt[t.toLowerCase()]; + return i != null && e >= i.minParams && e <= i.maxParams; +} +const iEt = { min: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.min.apply(Math, t[0]) }, max: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.max.apply(Math, t[0]) }, avg: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : rEt(t[0]) }, sum: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : H4i(t[0]) }, stddev: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.sqrt(UKe(t[0])) }, count: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : t[0].length }, var: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : UKe(t[0]) } }; +function rEt(t) { + let e = 0; + for (let i = 0; i < t.length; i++) + e += t[i]; + return e / t.length; +} +function H4i(t) { + let e = 0; + for (let i = 0; i < t.length; i++) + e += t[i]; + return e; +} +function UKe(t) { + const e = rEt(t), i = t.length; + let r = 0; + for (const n of t) + r += (n - e) ** 2; + return i > 1 ? r / (i - 1) : 0; +} +var wa; +(function(t) { + t.InvalidFunctionParameters = "InvalidFunctionParameters", t.UnsupportedSqlFunction = "UnsupportedSqlFunction", t.UnsupportedOperator = "UnsupportedOperator", t.UnsupportedSyntax = "UnsupportedSyntax", t.UnsupportedIsRhs = "UnsupportedIsRhs", t.UnsupportedIsLhs = "UnsupportedIsLhs", t.InvalidDataType = "InvalidDataType", t.CannotCastValue = "CannotCastValue", t.MissingStatisticParameters = "MissingStatisticParameters"; +})(wa || (wa = {})); +const W4i = { [wa.MissingStatisticParameters]: "Statistic does not have 1 or 0 Parameters", [wa.InvalidFunctionParameters]: "Invalid parameters for call to {function}", [wa.UnsupportedIsLhs]: "Unsupported left hand expression in is statement", [wa.UnsupportedIsRhs]: "Unsupported right hand expression in is statement", [wa.UnsupportedOperator]: "Unsupported operator - {operator}", [wa.UnsupportedSyntax]: "Unsupported syntax - {node}", [wa.UnsupportedSqlFunction]: "Sql function not found = {function}", [wa.InvalidDataType]: "Invalid sql data type", [wa.CannotCastValue]: "Cannot cast value to the required data type" }; +let cu = class nEt extends Error { + constructor(e, i) { + super(Kz(W4i[e], i)), this.declaredRootClass = "esri.arcade.featureset.support.sqlerror", Error.captureStackTrace && Error.captureStackTrace(this, nEt); + } +}; +var tl; +(function(t) { + t.NeverReach = "NeverReach", t.NotImplemented = "NotImplemented", t.Cancelled = "Cancelled", t.InvalidStatResponse = "InvalidStatResponse", t.InvalidRequest = "InvalidRequest", t.RequestFailed = "RequestFailed", t.MissingFeatures = "MissingFeatures", t.AggregationFieldNotFound = "AggregationFieldNotFound", t.DataElementsNotFound = "DataElementsNotFound"; +})(tl || (tl = {})); +const q4i = { [tl.Cancelled]: "Cancelled", [tl.InvalidStatResponse]: "Invalid statistics response from service", [tl.InvalidRequest]: "Invalid request", [tl.RequestFailed]: "Request failed - {reason}", [tl.MissingFeatures]: "Missing features", [tl.AggregationFieldNotFound]: "Aggregation field not found", [tl.DataElementsNotFound]: "Data elements not found on service", [tl.NeverReach]: "Encountered unreachable logic", [tl.NotImplemented]: "Not implemented" }; +let fc = class sEt extends Error { + constructor(e, i) { + super(Kz(q4i[e], i)), this.declaredRootClass = "esri.arcade.featureset.support.featureseterror", Error.captureStackTrace && Error.captureStackTrace(this, sEt); + } +}, rO = class BT { + constructor() { + this.op = "+", this.day = 0, this.second = 0, this.hour = 0, this.month = 0, this.year = 0, this.minute = 0, this.millis = 0; + } + static _fixDefaults(e) { + if (e.precision !== null || e.secondary !== null) + throw new Error("Primary and Secondary SqlInterval qualifiers not supported"); + } + static _parseSecondsComponent(e, i) { + if (i.includes(".")) { + const r = i.split("."); + e.second = parseFloat(r[0]), e.millis = parseInt(r[1], 10); + } else + e.second = parseFloat(i); + } + static createFromMilliseconds(e) { + const i = new BT(); + return i.second = e / 1e3, i; + } + static createFromValueAndQualifer(e, i, r) { + let n = null; + const s = new BT(); + if (s.op = r === "-" ? "-" : "+", i.type === "interval-period") { + BT._fixDefaults(i); + const o = new RegExp("^[0-9]{1,}$"); + if (i.period === "year" || i.period === "month") + throw new Error("Year-Month Intervals not supported"); + if (i.period === "second") { + if (!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(e)) + throw new Error("Illegal Interval"); + BT._parseSecondsComponent(s, e); + } else { + if (!o.test(e)) + throw new Error("Illegal Interval"); + s[i.period] = parseFloat(e); + } + } else { + if (BT._fixDefaults(i.start), BT._fixDefaults(i.end), i.start.period === "year" || i.start.period === "month") + throw new Error("Year-Month Intervals not supported"); + if (i.end.period === "year" || i.end.period === "month") + throw new Error("Year-Month Intervals not supported"); + switch (i.start.period) { + case "day": + switch (i.end.period) { + case "hour": + if (n = new RegExp("^[0-9]{1,} [0-9]{1,}$"), !n.test(e)) + throw new Error("Illegal Interval"); + s[i.start.period] = parseFloat(e.split(" ")[0]), s[i.end.period] = parseFloat(e.split(" ")[1]); + break; + case "minute": + if (n = new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"), !n.test(e)) + throw new Error("Illegal Interval"); + { + s[i.start.period] = parseFloat(e.split(" ")[0]); + const o = e.split(" ")[1].split(":"); + s.hour = parseFloat(o[0]), s.minute = parseFloat(o[1]); + } + break; + case "second": + if (n = new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"), !n.test(e)) + throw new Error("Illegal Interval"); + { + s[i.start.period] = parseFloat(e.split(" ")[0]); + const o = e.split(" ")[1].split(":"); + s.hour = parseFloat(o[0]), s.minute = parseFloat(o[1]), BT._parseSecondsComponent(s, o[2]); + } + break; + default: + throw new Error("Invalid Interval."); + } + break; + case "hour": + switch (i.end.period) { + case "minute": + if (n = new RegExp("^[0-9]{1,}:[0-9]{1,}$"), !n.test(e)) + throw new Error("Illegal Interval"); + s.hour = parseFloat(e.split(":")[0]), s.minute = parseFloat(e.split(":")[1]); + break; + case "second": + if (n = new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"), !n.test(e)) + throw new Error("Illegal Interval"); + { + const o = e.split(":"); + s.hour = parseFloat(o[0]), s.minute = parseFloat(o[1]), BT._parseSecondsComponent(s, o[2]); + } + break; + default: + throw new Error("Invalid Interval."); + } + break; + case "minute": + if (i.end.period !== "second") + throw new Error("Invalid Interval."); + if (n = new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"), !n.test(e)) + throw new Error("Illegal Interval"); + { + const o = e.split(":"); + s.minute = parseFloat(o[0]), BT._parseSecondsComponent(s, o[1]); + } + break; + default: + throw new Error("Invalid Interval."); + } + } + return s; + } + valueInMilliseconds() { + return (this.op === "-" ? -1 : 1) * (this.millis + 1e3 * this.second + 60 * this.minute * 1e3 + 60 * this.hour * 60 * 1e3 + 24 * this.day * 60 * 60 * 1e3 + this.month * (365 / 12) * 24 * 60 * 60 * 1e3 + 365 * this.year * 24 * 60 * 60 * 1e3); + } +}; +function V$e(t, e) { + const i = oEt[t.toLowerCase()]; + if (i == null) + throw new Error("Function Not Recognised"); + if (e.length < i.minParams || e.length > i.maxParams) + throw new Error(`Invalid Parameter count for call to ${t.toUpperCase()}`); + return i.evaluate(e); +} +function Y4i(t, e) { + const i = oEt[t.toLowerCase()]; + return i != null && e >= i.minParams && e <= i.maxParams; +} +function X4i(t) { + return typeof t == "string" || t instanceof String; +} +function K4i(t) { + return t instanceof Date; +} +function zKe(t) { + const e = new Date(t.getTime()); + return e.setHours(0, 0, 0, 0), e; +} +function HKe(t, e) { + if (K4i(t)) + return e ? zKe(t) : t; + if (X4i(t)) { + const i = Qs.fromSQL(t); + if (i.isValid) + return e ? zKe(i.toJSDate()) : i.toJSDate(); + } + throw new cu(wa.CannotCastValue); +} +const oEt = { extract: { minParams: 2, maxParams: 2, evaluate: ([t, e]) => { + if (e == null) + return null; + if (e instanceof Date) + switch (t.toUpperCase()) { + case "SECOND": + return e.getSeconds(); + case "MINUTE": + return e.getMinutes(); + case "HOUR": + return e.getHours(); + case "DAY": + return e.getDate(); + case "MONTH": + return e.getMonth() + 1; + case "YEAR": + return e.getFullYear(); + } + throw new Error("Invalid Parameter for call to EXTRACT"); +} }, substring: { minParams: 2, maxParams: 3, evaluate: (t) => { + if (t.length === 2) { + const [e, i] = t; + return e == null || i == null ? null : e.toString().substring(i - 1); + } + if (t.length === 3) { + const [e, i, r] = t; + return e == null || i == null || r == null ? null : r <= 0 ? "" : e.toString().substring(i - 1, i + r - 1); + } +} }, position: { minParams: 2, maxParams: 2, evaluate: ([t, e]) => t == null || e == null ? null : e.indexOf(t) + 1 }, trim: { minParams: 2, maxParams: 3, evaluate: (t) => { + const e = t.length === 3, i = e ? t[1] : " ", r = e ? t[2] : t[1]; + if (i == null || r == null) + return null; + const n = `(${d4e(i)})`; + switch (t[0]) { + case "BOTH": + return r.replace(new RegExp(`^${n}*|${n}*$`, "g"), ""); + case "LEADING": + return r.replace(new RegExp(`^${n}*`, "g"), ""); + case "TRAILING": + return r.replace(new RegExp(`${n}*$`, "g"), ""); + } + throw new Error("Invalid Parameter for call to TRIM"); +} }, abs: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.abs(t[0]) }, ceiling: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.ceil(t[0]) }, floor: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.floor(t[0]) }, log: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.log(t[0]) }, log10: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.log(t[0]) * Math.LOG10E }, sin: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.sin(t[0]) }, cos: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.cos(t[0]) }, tan: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.tan(t[0]) }, asin: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.asin(t[0]) }, acos: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.acos(t[0]) }, atan: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.atan(t[0]) }, sign: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : t[0] > 0 ? 1 : t[1] < 0 ? -1 : 0 }, power: { minParams: 2, maxParams: 2, evaluate: (t) => t[0] == null || t[1] == null ? null : t[0] ** t[1] }, mod: { minParams: 2, maxParams: 2, evaluate: (t) => t[0] == null || t[1] == null ? null : t[0] % t[1] }, round: { minParams: 1, maxParams: 2, evaluate: (t) => { + const e = t[0], i = t.length === 2 ? 10 ** t[1] : 1; + return e == null ? null : Math.round(e * i) / i; +} }, truncate: { minParams: 1, maxParams: 2, evaluate: (t) => t[0] == null ? null : t.length === 1 ? parseInt(t[0].toFixed(0), 10) : parseFloat(t[0].toFixed(t[1])) }, char_length: { minParams: 1, maxParams: 1, evaluate: (t) => typeof t[0] == "string" || t[0] instanceof String ? t[0].length : 0 }, concat: { minParams: 1, maxParams: 1 / 0, evaluate: (t) => { + let e = ""; + for (let i = 0; i < t.length; i++) { + if (t[i] == null) + return null; + e += t[i].toString(); + } + return e; +} }, lower: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : t[0].toString().toLowerCase() }, upper: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : t[0].toString().toUpperCase() }, coalesce: { minParams: 1, maxParams: 1 / 0, evaluate: (t) => { + for (const e of t) + if (e !== null) + return e; + return null; +} }, cosh: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.cosh(t[0]) }, sinh: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.sinh(t[0]) }, tanh: { minParams: 1, maxParams: 1, evaluate: (t) => t[0] == null ? null : Math.tanh(t[0]) }, nullif: { minParams: 2, maxParams: 2, evaluate: (t) => { + const e = t[0], i = t[1]; + return (e instanceof Date ? e.valueOf() : e) === (i instanceof Date ? i.valueOf() : i) ? null : e; +} }, cast: { minParams: 2, maxParams: 2, evaluate: (t) => { + const e = t[0], i = t[1]; + if (e === null) + return null; + switch (i.type) { + case "integer": { + const r = parseInt(e, 10); + if (isNaN(r)) + throw new cu(wa.CannotCastValue); + return r; + } + case "smallint": { + const r = parseInt(e, 10); + if (isNaN(r)) + throw new cu(wa.CannotCastValue); + if (r > 32767 || r < -32767) + throw new cu(wa.CannotCastValue); + return r; + } + case "float": + case "real": { + const r = parseFloat(e); + if (isNaN(r)) + throw new cu(wa.CannotCastValue); + return r; + } + case "date": + return HKe(e, !0); + case "timestamp": + return HKe(e, !1); + case "varchar": { + const r = e.toString(); + if (r.length > i.size) + throw new cu(wa.CannotCastValue); + return r; + } + default: + throw new cu(wa.InvalidDataType); + } +} } }; +var WKe, qKe, XOe = {}; +qKe = function() { + function t(n, s) { + function o() { + this.constructor = n; + } + o.prototype = s.prototype, n.prototype = new o(); + } + function e(n, s, o, a) { + var l = Error.call(this, n); + return Object.setPrototypeOf && Object.setPrototypeOf(l, e.prototype), l.expected = s, l.found = o, l.location = a, l.name = "SyntaxError", l; + } + function i(n, s, o) { + return o = o || " ", n.length > s ? n : (s -= n.length, n + (o += o.repeat(s)).slice(0, s)); + } + function r(n, s) { + var o, a = {}, l = (s = s !== void 0 ? s : {}).grammarSource, c = { start: XI }, h = XI, p = "!", y = "=", v = ">=", x = ">", I = "<=", P = "<>", F = "<", k = "!=", V = "+", j = "-", Y = "||", X = "*", Q = "/", re = "@", he = "'", fe = "N'", be = "''", Se = ".", Me = "null", ke = "true", J = "false", ce = "in", xe = "is", Pe = "like", Oe = "escape", Re = "not", Ge = "and", je = "or", et = "between", Qe = "from", tt = "for", ft = "substring", Mt = "extract", kt = "trim", Tt = "position", It = "timestamp", Nt = "date", nt = "leading", Ee = "trailing", Be = "both", at = "cast", wt = "as", st = "integer", le = "smallint", ct = "float", gt = "real", Ne = "varchar", pe = "to", Ae = "interval", it = "year", yt = "month", He = "day", Ft = "hour", ei = "minute", mt = "second", Ue = "case", si = "end", A = "when", ve = "then", H = "else", T = ",", b = "(", m = ")", _ = "`", C = /^[A-Za-z_\x80-\uFFFF]/, D = /^[A-Za-z0-9_]/, L = /^[A-Za-z0-9_.\x80-\uFFFF]/, B = /^[^']/, q = /^[0-9]/, Z = /^[eE]/, ie = /^[+\-]/, se = /^[ \t\n\r]/, de = /^[^`]/, Ce = _s("!", !1), Ve = _s("=", !1), Je = _s(">=", !1), Pt = _s(">", !1), $t = _s("<=", !1), qe = _s("<>", !1), Rt = _s("<", !1), Zt = _s("!=", !1), Jt = _s("+", !1), Xt = _s("-", !1), Qt = _s("||", !1), bi = _s("*", !1), Mi = _s("/", !1), Ri = Hg([["A", "Z"], ["a", "z"], "_", ["€", "￿"]], !1, !1), Yi = Hg([["A", "Z"], ["a", "z"], ["0", "9"], "_"], !1, !1), rr = Hg([["A", "Z"], ["a", "z"], ["0", "9"], "_", ".", ["€", "￿"]], !1, !1), _i = _s("@", !1), fn = _s("'", !1), jr = _s("N'", !1), no = _s("''", !1), $r = Hg(["'"], !0, !1), Zn = _s(".", !1), bs = Hg([["0", "9"]], !1, !1), On = Hg(["e", "E"], !1, !1), Jn = Hg(["+", "-"], !1, !1), ki = _s("NULL", !0), Ur = _s("TRUE", !0), So = _s("FALSE", !0), Cn = _s("IN", !0), Ki = _s("IS", !0), ui = _s("LIKE", !0), W = _s("ESCAPE", !0), Cr = _s("NOT", !0), ia = _s("AND", !0), Ho = _s("OR", !0), Ut = _s("BETWEEN", !0), Ca = _s("FROM", !0), xi = _s("FOR", !0), _t = _s("SUBSTRING", !0), Fr = _s("EXTRACT", !0), ln = _s("TRIM", !0), kn = _s("POSITION", !0), Un = _s("TIMESTAMP", !0), Cs = _s("DATE", !0), ra = _s("LEADING", !0), yn = _s("TRAILING", !0), Io = _s("BOTH", !0), oh = _s("CAST", !0), gh = _s("AS", !0), vc = _s("INTEGER", !0), qu = _s("SMALLINT", !0), ss = _s("FLOAT", !0), dd = _s("REAL", !0), Vd = _s("VARCHAR", !0), pd = _s("TO", !0), cs = _s("INTERVAL", !0), Nl = _s("YEAR", !0), ii = _s("MONTH", !0), bt = _s("DAY", !0), Kt = _s("HOUR", !0), Pi = _s("MINUTE", !0), Sr = _s("SECOND", !0), Tr = _s("CASE", !0), ri = _s("END", !0), pi = _s("WHEN", !0), mi = _s("THEN", !0), hr = _s("ELSE", !0), Lr = _s(",", !1), wr = _s("(", !1), Nr = _s(")", !1), _r = Hg([" ", " ", ` +`, "\r"], !1, !1), Tn = _s("`", !1), os = Hg(["`"], !0, !1), fs = function(Te) { + return Te; + }, di = function(Te, Ct) { + var Gt = { type: "expression-list" }, oi = J3(Te, Ct); + return Gt.value = oi, Gt; + }, nr = function(Te, Ct) { + return Xb(Te, Ct); + }, fr = function(Te, Ct) { + return Xb(Te, Ct); + }, Zr = function(Te) { + return Xv("NOT", Te); + }, er = function(Te, Ct) { + return Ct == "" || Ct == null || Ct == null ? Te : Ct.type == "arithmetic" ? Xb(Te, Ct.tail) : sA(Ct.op, Te, Ct.right, Ct.escape); + }, ys = function(Te) { + return { type: "arithmetic", tail: Te }; + }, Da = function(Te, Ct) { + return { op: Te + "NOT", right: Ct }; + }, Ta = function(Te, Ct) { + return { op: Te, right: Ct }; + }, Ds = function(Te, Ct, Gt) { + return { op: "NOT" + Te, right: { type: "expression-list", value: [Ct, Gt] } }; + }, fu = function(Te, Ct, Gt) { + return { op: Te, right: { type: "expression-list", value: [Ct, Gt] } }; + }, mu = function(Te) { + return Te[0] + " " + Te[2]; + }, Rc = function(Te) { + return Te[0] + " " + Te[2]; + }, Mc = function(Te, Ct, Gt) { + return { op: Te, right: Ct, escape: Gt.value }; + }, Tl = function(Te, Ct) { + return { op: Te, right: Ct, escape: "" }; + }, ah = function(Te, Ct) { + return { op: Te, right: Ct }; + }, jh = function(Te) { + return { op: Te, right: { type: "expression-list", value: [] } }; + }, Rp = function(Te, Ct) { + return { op: Te, right: Ct }; + }, kl = function(Te, Ct) { + return Xb(Te, Ct); + }, lh = function(Te, Ct) { + return Xb(Te, Ct); + }, Gh = function(Te) { + return Te.paren = !0, Te; + }, ou = function(Te) { + return /^CURRENT_DATE$/i.test(Te) ? { type: "current-time", mode: "date" } : /^CURRENT_TIMESTAMP$/i.test(Te) ? { type: "current-time", mode: "timestamp" } : { type: "column-reference", table: "", column: Te }; + }, Mp = function(Te) { + return Te; + }, yh = function(Te, Ct) { + return Te + Ct.join(""); + }, ag = function(Te, Ct) { + return Te + Ct.join(""); + }, lg = function(Te) { + return { type: "parameter", value: Te[1] }; + }, jd = function(Te, Ct) { + return { type: "function", name: "extract", args: { type: "expression-list", value: [{ type: "string", value: Te }, Ct] } }; + }, ha = function(Te, Ct, Gt) { + return { type: "function", name: "substring", args: { type: "expression-list", value: Gt ? [Te, Ct, Gt[2]] : [Te, Ct] } }; + }, Nf = function(Te, Ct) { + return { type: "function", name: "cast", args: { type: "expression-list", value: [Te, Ct] } }; + }, al = function() { + return { type: "data-type", value: { type: "integer" } }; + }, Dp = function() { + return { type: "data-type", value: { type: "smallint" } }; + }, uh = function() { + return { type: "data-type", value: { type: "float" } }; + }, hi = function() { + return { type: "data-type", value: { type: "real" } }; + }, ll = function() { + return { type: "data-type", value: { type: "date" } }; + }, Fp = function() { + return { type: "data-type", value: { type: "timestamp" } }; + }, ug = function(Te) { + return { type: "data-type", value: { type: "varchar", size: parseInt(Te) } }; + }, Wo = function(Te, Ct, Gt) { + return { type: "function", name: "trim", args: { type: "expression-list", value: [{ type: "string", value: Te ?? "BOTH" }, Ct, Gt] } }; + }, lp = function(Te, Ct) { + return { type: "function", name: "trim", args: { type: "expression-list", value: [{ type: "string", value: Te ?? "BOTH" }, Ct] } }; + }, Hs = function(Te, Ct) { + return { type: "function", name: "position", args: { type: "expression-list", value: [Te, Ct] } }; + }, Xs = function(Te, Ct) { + return { type: "function", name: Te, args: Ct || { type: "expression-list", value: [] } }; + }, ql = function(Te) { + return { type: "timestamp", value: Te.value }; + }, Su = function(Te, Ct, Gt) { + return { type: "interval", value: Ct, qualifier: Gt, op: Te }; + }, Im = function(Te, Ct) { + return { type: "interval", value: Te, qualifier: Ct, op: "" }; + }, Vc = function(Te, Ct) { + return { type: "interval-qualifier", start: Te, end: Ct }; + }, jc = function(Te, Ct) { + return { type: "interval-period", period: Te.value, precision: Ct, secondary: null }; + }, gu = function(Te) { + return { type: "interval-period", period: Te.value, precision: null, secondary: null }; + }, Yl = function(Te) { + return { type: "interval-period", period: Te.value, precision: null, secondary: null }; + }, Ba = function(Te, Ct) { + return { type: "interval-period", period: "second", precision: Te, secondary: Ct }; + }, vh = function(Te) { + return { type: "interval-period", period: "second", precision: Te, secondary: null }; + }, Yu = function() { + return { type: "interval-period", period: "second", precision: null, secondary: null }; + }, $l = function(Te, Ct) { + return { type: "interval-period", period: Te.value, precision: Ct, secondary: null }; + }, _c = function(Te) { + return { type: "interval-period", period: Te.value, precision: null, secondary: null }; + }, Am = function(Te, Ct) { + return { type: "interval-period", period: "second", precision: Te, secondary: Ct }; + }, Gd = function(Te) { + return { type: "interval-period", period: "second", precision: Te, secondary: null }; + }, df = function() { + return { type: "interval-period", period: "second", precision: null, secondary: null }; + }, Ug = function() { + return { type: "string", value: "day" }; + }, cg = function() { + return { type: "string", value: "hour" }; + }, zt = function() { + return { type: "string", value: "minute" }; + }, Wt = function() { + return { type: "string", value: "month" }; + }, Ai = function() { + return { type: "string", value: "year" }; + }, Ui = function(Te) { + return parseFloat(Te); + }, ge = function(Te) { + return parseFloat(Te); + }, Le = function(Te) { + return { type: "date", value: Te.value }; + }, Ye = function() { + return { type: "null", value: null }; + }, xt = function() { + return { type: "boolean", value: !0 }; + }, oe = function() { + return { type: "boolean", value: !1 }; + }, ee = function() { + return "'"; + }, ae = function(Te) { + return { type: "string", value: Te.join("") }; + }, ye = function(Te, Ct) { + return { type: "case-expression", format: "simple", operand: Te, clauses: Ct, else: null }; + }, Ie = function(Te, Ct, Gt) { + return { type: "case-expression", format: "simple", operand: Te, clauses: Ct, else: Gt.value }; + }, We = function(Te) { + return { type: "case-expression", format: "searched", clauses: Te, else: null }; + }, Xe = function(Te, Ct) { + return { type: "case-expression", format: "searched", clauses: Te, else: Ct.value }; + }, lt = function(Te, Ct) { + return { type: "when-clause", operand: Te, value: Ct }; + }, Et = function(Te, Ct) { + return { type: "when-clause", operand: Te, value: Ct }; + }, Ht = function(Te) { + return { type: "else-clause", value: Te }; + }, vi = function(Te) { + return { type: "number", value: Te }; + }, yi = function(Te, Ct, Gt) { + return parseFloat(Te + Ct + Gt); + }, Oi = function(Te, Ct) { + return parseFloat(Te + Ct); + }, zi = function(Te, Ct) { + return parseFloat(Te + Ct); + }, ar = function(Te) { + return parseFloat(Te); + }, tr = function(Te, Ct) { + return Te[0] + Ct; + }, Ir = function(Te) { + return "." + (Te ?? ""); + }, ur = function(Te, Ct) { + return Te + Ct; + }, Jr = function(Te) { + return Te.join(""); + }, on = function(Te, Ct) { + return "e" + (Ct === null ? "" : Ct); + }, $n = function() { + return "IN"; + }, Fs = function() { + return "IS"; + }, Ro = function() { + return "LIKE"; + }, Wa = function() { + return "ESCAPE"; + }, Ks = function() { + return "NOT"; + }, vs = function() { + return "AND"; + }, yo = function() { + return "OR"; + }, Gc = function() { + return "BETWEEN"; + }, Pr = function() { + return "FROM"; + }, _h = function() { + return "FOR"; + }, Xu = function() { + return "SUBSTRING"; + }, Cu = function() { + return "EXTRACT"; + }, Bl = function() { + return "TRIM"; + }, bh = function() { + return "POSITION"; + }, fd = function() { + return "TIMESTAMP"; + }, pf = function() { + return "DATE"; + }, wh = function() { + return "LEADING"; + }, md = function() { + return "TRAILING"; + }, yl = function() { + return "BOTH"; + }, Dc = function() { + return "CAST"; + }, Vl = function() { + return "AS"; + }, co = function() { + return "INTEGER"; + }, xh = function() { + return "SMALLINT"; + }, yu = function() { + return "FLOAT"; + }, Sh = function() { + return "REAL"; + }, Ud = function() { + return "VARCHAR"; + }, zg = function() { + return "TO"; + }, Ot = function() { + return "INTERVAL"; + }, Bi = function() { + return "YEAR"; + }, Mr = function() { + return "MONTH"; + }, zn = function() { + return "DAY"; + }, xs = function() { + return "HOUR"; + }, Ss = function() { + return "MINUTE"; + }, da = function() { + return "SECOND"; + }, qa = function() { + return "CASE"; + }, hg = function() { + return "END"; + }, By = function() { + return "WHEN"; + }, ff = function() { + return "THEN"; + }, kf = function() { + return "ELSE"; + }, up = function(Te) { + return Te; + }, YI = function(Te) { + return Te.join(""); + }, rt = 0, Xl = [{ line: 1, column: 1 }], Vy = 0, O1 = [], cr = 0; + if ("startRule" in s) { + if (!(s.startRule in c)) + throw new Error(`Can't start parsing from rule "` + s.startRule + '".'); + h = c[s.startRule]; + } + function _s(Te, Ct) { + return { type: "literal", text: Te, ignoreCase: Ct }; + } + function Hg(Te, Ct, Gt) { + return { type: "class", parts: Te, inverted: Ct, ignoreCase: Gt }; + } + function nL() { + return { type: "end" }; + } + function A8(Te) { + var Ct, Gt = Xl[Te]; + if (Gt) + return Gt; + for (Ct = Te - 1; !Xl[Ct]; ) + Ct--; + for (Gt = { line: (Gt = Xl[Ct]).line, column: Gt.column }; Ct < Te; ) + n.charCodeAt(Ct) === 10 ? (Gt.line++, Gt.column = 1) : Gt.column++, Ct++; + return Xl[Te] = Gt, Gt; + } + function D3(Te, Ct) { + var Gt = A8(Te), oi = A8(Ct); + return { source: l, start: { offset: Te, line: Gt.line, column: Gt.column }, end: { offset: Ct, line: oi.line, column: oi.column } }; + } + function xn(Te) { + rt < Vy || (rt > Vy && (Vy = rt, O1 = []), O1.push(Te)); + } + function P8(Te, Ct, Gt) { + return new e(e.buildMessage(Te, Ct), Te, Ct, Gt); + } + function XI() { + var Te, Ct; + return Te = rt, Er(), (Ct = ch()) !== a ? (Er(), Te = fs(Ct)) : (rt = Te, Te = a), Te; + } + function Yx() { + var Te, Ct, Gt, oi, Hn, _l, Ku, zc; + if (Te = rt, (Ct = ch()) !== a) { + for (Gt = [], oi = rt, Hn = Er(), (_l = Yg()) !== a ? (Ku = Er(), (zc = ch()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); oi !== a; ) + Gt.push(oi), oi = rt, Hn = Er(), (_l = Yg()) !== a ? (Ku = Er(), (zc = ch()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); + Te = di(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function ch() { + var Te, Ct, Gt, oi, Hn, _l, Ku, zc; + if (Te = rt, (Ct = mC()) !== a) { + for (Gt = [], oi = rt, Hn = Er(), (_l = pL()) !== a ? (Ku = Er(), (zc = mC()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); oi !== a; ) + Gt.push(oi), oi = rt, Hn = Er(), (_l = pL()) !== a ? (Ku = Er(), (zc = mC()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); + Te = nr(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function mC() { + var Te, Ct, Gt, oi, Hn, _l, Ku, zc; + if (Te = rt, (Ct = KI()) !== a) { + for (Gt = [], oi = rt, Hn = Er(), (_l = rA()) !== a ? (Ku = Er(), (zc = KI()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); oi !== a; ) + Gt.push(oi), oi = rt, Hn = Er(), (_l = rA()) !== a ? (Ku = Er(), (zc = KI()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); + Te = fr(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function KI() { + var Te, Ct, Gt, oi, Hn; + return Te = rt, (Ct = qb()) === a && (Ct = rt, n.charCodeAt(rt) === 33 ? (Gt = p, rt++) : (Gt = a, cr === 0 && xn(Ce)), Gt !== a ? (oi = rt, cr++, n.charCodeAt(rt) === 61 ? (Hn = y, rt++) : (Hn = a, cr === 0 && xn(Ve)), cr--, Hn === a ? oi = void 0 : (rt = oi, oi = a), oi !== a ? Ct = Gt = [Gt, oi] : (rt = Ct, Ct = a)) : (rt = Ct, Ct = a)), Ct !== a ? (Gt = Er(), (oi = KI()) !== a ? Te = Zr(oi) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = Ch()), Te; + } + function Ch() { + var Te, Ct, Gt; + return Te = rt, (Ct = Wg()) !== a ? (Er(), (Gt = sL()) === a && (Gt = null), Te = er(Ct, Gt)) : (rt = Te, Te = a), Te; + } + function sL() { + var Te; + return (Te = ho()) === a && (Te = jy()) === a && (Te = F3()) === a && (Te = Pm()) === a && (Te = yC()), Te; + } + function ho() { + var Te, Ct, Gt, oi, Hn, _l; + if (Te = [], Ct = rt, Gt = Er(), (oi = Hv()) !== a ? (Hn = Er(), (_l = Wg()) !== a ? Ct = Gt = [Gt, oi, Hn, _l] : (rt = Ct, Ct = a)) : (rt = Ct, Ct = a), Ct !== a) + for (; Ct !== a; ) + Te.push(Ct), Ct = rt, Gt = Er(), (oi = Hv()) !== a ? (Hn = Er(), (_l = Wg()) !== a ? Ct = Gt = [Gt, oi, Hn, _l] : (rt = Ct, Ct = a)) : (rt = Ct, Ct = a); + else + Te = a; + return Te !== a && (Te = ys(Te)), Te; + } + function Hv() { + var Te; + return n.substr(rt, 2) === v ? (Te = v, rt += 2) : (Te = a, cr === 0 && xn(Je)), Te === a && (n.charCodeAt(rt) === 62 ? (Te = x, rt++) : (Te = a, cr === 0 && xn(Pt)), Te === a && (n.substr(rt, 2) === I ? (Te = I, rt += 2) : (Te = a, cr === 0 && xn($t)), Te === a && (n.substr(rt, 2) === P ? (Te = P, rt += 2) : (Te = a, cr === 0 && xn(qe)), Te === a && (n.charCodeAt(rt) === 60 ? (Te = F, rt++) : (Te = a, cr === 0 && xn(Rt)), Te === a && (n.charCodeAt(rt) === 61 ? (Te = y, rt++) : (Te = a, cr === 0 && xn(Ve)), Te === a && (n.substr(rt, 2) === k ? (Te = k, rt += 2) : (Te = a, cr === 0 && xn(Zt)))))))), Te; + } + function Pm() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = EC()) !== a ? (Er(), (Gt = qb()) !== a ? (Er(), (oi = Wg()) !== a ? Te = Da(Ct, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = EC()) !== a ? (Er(), (Gt = Wg()) !== a ? Te = Ta(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function F3() { + var Te, Ct, Gt, oi, Hn, _l; + return Te = rt, (Ct = qb()) !== a ? (Er(), (Gt = fL()) !== a ? (Er(), (oi = Wg()) !== a ? (Er(), (Hn = rA()) !== a ? (Er(), (_l = Wg()) !== a ? Te = Ds(Gt, oi, _l) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = fL()) !== a ? (Er(), (Gt = Wg()) !== a ? (Er(), (oi = rA()) !== a ? (Er(), (Hn = Wg()) !== a ? Te = fu(Ct, Gt, Hn) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function oL() { + var Te, Ct, Gt, oi, Hn; + return Te = rt, Ct = rt, (Gt = qb()) !== a ? (oi = Er(), (Hn = G3()) !== a ? Ct = Gt = [Gt, oi, Hn] : (rt = Ct, Ct = a)) : (rt = Ct, Ct = a), Ct !== a && (Ct = mu(Ct)), (Te = Ct) === a && (Te = G3()), Te; + } + function gC() { + var Te, Ct, Gt, oi, Hn; + return Te = rt, Ct = rt, (Gt = qb()) !== a ? (oi = Er(), (Hn = TC()) !== a ? Ct = Gt = [Gt, oi, Hn] : (rt = Ct, Ct = a)) : (rt = Ct, Ct = a), Ct !== a && (Ct = Rc(Ct)), (Te = Ct) === a && (Te = TC()), Te; + } + function yC() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = oL()) !== a ? (Er(), (Gt = M1()) !== a ? (Er(), Fa() !== a ? (Er(), (oi = Xx()) !== a ? Te = Mc(Ct, Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = oL()) !== a ? (Er(), (Gt = M1()) !== a ? Te = Tl(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function jy() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = gC()) !== a ? (Er(), (Gt = vl()) !== a ? (Er(), (oi = Yx()) !== a ? (Er(), Lp() !== a ? Te = ah(Ct, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = gC()) !== a ? (Er(), (Gt = vl()) !== a ? (Er(), (oi = Lp()) !== a ? Te = jh(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = gC()) !== a ? (Er(), (Gt = JI()) !== a ? Te = Rp(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a))), Te; + } + function Wg() { + var Te, Ct, Gt, oi, Hn, _l, Ku, zc; + if (Te = rt, (Ct = vC()) !== a) { + for (Gt = [], oi = rt, Hn = Er(), (_l = L3()) !== a ? (Ku = Er(), (zc = vC()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); oi !== a; ) + Gt.push(oi), oi = rt, Hn = Er(), (_l = L3()) !== a ? (Ku = Er(), (zc = vC()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); + Te = kl(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function L3() { + var Te; + return n.charCodeAt(rt) === 43 ? (Te = V, rt++) : (Te = a, cr === 0 && xn(Jt)), Te === a && (n.charCodeAt(rt) === 45 ? (Te = j, rt++) : (Te = a, cr === 0 && xn(Xt)), Te === a && (n.substr(rt, 2) === Y ? (Te = Y, rt += 2) : (Te = a, cr === 0 && xn(Qt)))), Te; + } + function vC() { + var Te, Ct, Gt, oi, Hn, _l, Ku, zc; + if (Te = rt, (Ct = W0()) !== a) { + for (Gt = [], oi = rt, Hn = Er(), (_l = N3()) !== a ? (Ku = Er(), (zc = W0()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); oi !== a; ) + Gt.push(oi), oi = rt, Hn = Er(), (_l = N3()) !== a ? (Ku = Er(), (zc = W0()) !== a ? oi = Hn = [Hn, _l, Ku, zc] : (rt = oi, oi = a)) : (rt = oi, oi = a); + Te = lh(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function N3() { + var Te; + return n.charCodeAt(rt) === 42 ? (Te = X, rt++) : (Te = a, cr === 0 && xn(bi)), Te === a && (n.charCodeAt(rt) === 47 ? (Te = Q, rt++) : (Te = a, cr === 0 && xn(Mi))), Te; + } + function W0() { + var Te, Ct; + return (Te = R1()) === a && (Te = ZI()) === a && (Te = QI()) === a && (Te = R8()) === a && (Te = M8()) === a && (Te = $3()) === a && (Te = B3()) === a && (Te = L8()) === a && (Te = ba()) === a && (Te = JI()) === a && (Te = rt, vl() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), Lp() !== a ? Te = Gh(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function ba() { + var Te; + return (Te = O8()) !== a && (Te = ou(Te)), Te; + } + function O8() { + var Te; + return (Te = qr()) !== a && (Te = Mp(Te)), Te; + } + function qr() { + var Te, Ct, Gt, oi; + if (Te = rt, (Ct = _C()) !== a) { + for (Gt = [], oi = bC(); oi !== a; ) + Gt.push(oi), oi = bC(); + Te = yh(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function k3() { + var Te, Ct, Gt, oi; + if (Te = rt, (Ct = _C()) !== a) { + for (Gt = [], oi = pa(); oi !== a; ) + Gt.push(oi), oi = pa(); + Te = ag(Ct, Gt); + } else + rt = Te, Te = a; + return Te; + } + function _C() { + var Te; + return C.test(n.charAt(rt)) ? (Te = n.charAt(rt), rt++) : (Te = a, cr === 0 && xn(Ri)), Te; + } + function pa() { + var Te; + return D.test(n.charAt(rt)) ? (Te = n.charAt(rt), rt++) : (Te = a, cr === 0 && xn(Yi)), Te; + } + function bC() { + var Te; + return L.test(n.charAt(rt)) ? (Te = n.charAt(rt), rt++) : (Te = a, cr === 0 && xn(rr)), Te; + } + function JI() { + var Te, Ct, Gt; + return Te = rt, n.charCodeAt(rt) === 64 ? (Ct = re, rt++) : (Ct = a, cr === 0 && xn(_i)), Ct !== a && (Gt = k3()) !== a ? Te = Ct = [Ct, Gt] : (rt = Te, Te = a), Te !== a && (Te = lg(Te)), Te; + } + function ZI() { + var Te, Ct, Gt; + return Te = rt, z3() !== a ? (Er(), vl() !== a ? (Er(), (Ct = zd()) !== a ? (Er(), U3() !== a ? (Er(), (Gt = ch()) !== a ? (Er(), Lp() !== a ? Te = jd(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function QI() { + var Te, Ct, Gt, oi, Hn, _l, Ku; + return Te = rt, dg() !== a ? (Er(), vl() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), U3() !== a ? (Er(), (Gt = ch()) !== a ? (Er(), oi = rt, (Hn = $8()) !== a ? (_l = Er(), (Ku = ch()) !== a ? oi = Hn = [Hn, _l, Ku, Er()] : (rt = oi, oi = a)) : (rt = oi, oi = a), oi === a && (oi = null), (Hn = Lp()) !== a ? Te = ha(Ct, Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function $3() { + var Te, Ct, Gt; + return Te = rt, Uh() !== a ? (Er(), vl() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), nA() !== a ? (Er(), (Gt = aL()) !== a ? (Er(), Lp() !== a ? Te = Nf(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function aL() { + var Te, Ct, Gt; + return Te = rt, (Ct = B8()) !== a && (Ct = al()), (Te = Ct) === a && (Te = rt, (Ct = mL()) !== a && (Ct = Dp()), (Te = Ct) === a && (Te = rt, (Ct = pg()) !== a && (Ct = uh()), (Te = Ct) === a && (Te = rt, (Ct = Gs()) !== a && (Ct = hi()), (Te = Ct) === a && (Te = rt, (Ct = Om()) !== a && (Ct = ll()), (Te = Ct) === a && (Te = rt, (Ct = IC()) !== a && (Ct = Fp()), (Te = Ct) === a && (Te = rt, (Ct = Gy()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = $s()) !== a ? (Er(), Lp() !== a ? Te = ug(Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a))))))), Te; + } + function R8() { + var Te, Ct, Gt, oi; + return Te = rt, H3() !== a ? (Er(), vl() !== a ? (Er(), (Ct = Hr()) === a && (Ct = null), Er(), (Gt = ch()) !== a ? (Er(), U3() !== a ? (Er(), (oi = ch()) !== a ? (Er(), Lp() !== a ? Te = Wo(Ct, Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, H3() !== a ? (Er(), vl() !== a ? (Er(), (Ct = Hr()) === a && (Ct = null), Er(), (Gt = ch()) !== a ? (Er(), Lp() !== a ? Te = lp(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function Hr() { + var Te; + return (Te = Jx()) === a && (Te = AC()) === a && (Te = cp()), Te; + } + function M8() { + var Te, Ct, Gt; + return Te = rt, Tu() !== a ? (Er(), vl() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), TC() !== a ? (Er(), (Gt = ch()) !== a ? (Er(), Lp() !== a ? Te = Hs(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function B3() { + var Te, Ct, Gt; + return Te = rt, (Ct = K3()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = Yx()) === a && (Gt = null), Er(), Lp() !== a ? Te = Xs(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function zd() { + var Te; + return (Te = q3()) === a && (Te = V8()) === a && (Te = Y3()) === a && (Te = Zx()) === a && (Te = X3()) === a && (Te = F1()), Te; + } + function R1() { + var Te; + return (Te = Xx()) === a && (Te = N8()) === a && (Te = cL()) === a && (Te = Uc()) === a && (Te = xC()) === a && (Te = D8()) === a && (Te = lL()), Te; + } + function D8() { + var Te, Ct; + return Te = rt, IC() !== a ? (Er(), (Ct = M1()) !== a ? Te = ql(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function lL() { + var Te, Ct, Gt, oi; + return Te = rt, W3() !== a ? (Er(), n.charCodeAt(rt) === 45 ? (Ct = j, rt++) : (Ct = a, cr === 0 && xn(Xt)), Ct === a && (n.charCodeAt(rt) === 43 ? (Ct = V, rt++) : (Ct = a, cr === 0 && xn(Jt))), Ct !== a ? (Er(), (Gt = M1()) !== a ? (Er(), (oi = wC()) !== a ? Te = Su(Ct, Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, W3() !== a ? (Er(), (Ct = M1()) !== a ? (Er(), (Gt = wC()) !== a ? Te = Im(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)), Te; + } + function wC() { + var Te, Ct, Gt; + return Te = rt, (Ct = F8()) !== a ? (Er(), gL() !== a ? (Er(), (Gt = uL()) !== a ? Te = Vc(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = Wb()), Te; + } + function F8() { + var Te, Ct, Gt; + return Te = rt, (Ct = $f()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = eA()) !== a ? (Er(), Lp() !== a ? Te = jc(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = $f()) !== a && (Ct = gu(Ct)), Te = Ct), Te; + } + function uL() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = $f()) !== a && (Ct = Yl(Ct)), (Te = Ct) === a && (Te = rt, (Ct = F1()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = eA()) !== a ? (Er(), Yg() !== a ? (Er(), (oi = mf()) !== a ? (Er(), Lp() !== a ? Te = Ba(Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = F1()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = eA()) !== a ? (Er(), Lp() !== a ? Te = vh(Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = F1()) !== a && (Ct = Yu()), Te = Ct))), Te; + } + function Wb() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = $f()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = mf()) !== a ? (Er(), Lp() !== a ? Te = $l(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = $f()) !== a && (Ct = _c(Ct)), (Te = Ct) === a && (Te = rt, (Ct = F1()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = eA()) !== a ? (Er(), Yg() !== a ? (Er(), (oi = mf()) !== a ? (Er(), Lp() !== a ? Te = Am(Gt, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = F1()) !== a ? (Er(), vl() !== a ? (Er(), (Gt = mf()) !== a ? (Er(), Lp() !== a ? Te = Gd(Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = F1()) !== a && (Ct = df()), Te = Ct)))), Te; + } + function $f() { + var Te, Ct; + return Te = rt, (Ct = Y3()) !== a && (Ct = Ug()), (Te = Ct) === a && (Te = rt, (Ct = Zx()) !== a && (Ct = cg()), (Te = Ct) === a && (Te = rt, (Ct = X3()) !== a && (Ct = zt()), (Te = Ct) === a && (Te = rt, (Ct = V8()) !== a && (Ct = Wt()), (Te = Ct) === a && (Te = rt, (Ct = q3()) !== a && (Ct = Ai()), Te = Ct)))), Te; + } + function mf() { + var Te; + return (Te = $s()) !== a && (Te = Ui(Te)), Te; + } + function eA() { + var Te; + return (Te = $s()) !== a && (Te = ge(Te)), Te; + } + function xC() { + var Te, Ct; + return Te = rt, Om() !== a ? (Er(), (Ct = M1()) !== a ? Te = Le(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Uc() { + var Te; + return (Te = CC()) !== a && (Te = Ye()), Te; + } + function cL() { + var Te, Ct; + return Te = rt, (Ct = tA()) !== a && (Ct = xt()), (Te = Ct) === a && (Te = rt, (Ct = iA()) !== a && (Ct = oe()), Te = Ct), Te; + } + function M1() { + var Te; + return (Te = Xx()) === a && (Te = JI()), Te; + } + function Xx() { + var Te, Ct, Gt, oi, Hn; + if (Te = rt, n.charCodeAt(rt) === 39 ? (Ct = he, rt++) : (Ct = a, cr === 0 && xn(fn)), Ct === a && (n.substr(rt, 2) === fe ? (Ct = fe, rt += 2) : (Ct = a, cr === 0 && xn(jr))), Ct !== a) { + for (Gt = [], oi = rt, n.substr(rt, 2) === be ? (Hn = be, rt += 2) : (Hn = a, cr === 0 && xn(no)), Hn !== a && (Hn = ee()), (oi = Hn) === a && (B.test(n.charAt(rt)) ? (oi = n.charAt(rt), rt++) : (oi = a, cr === 0 && xn($r))); oi !== a; ) + Gt.push(oi), oi = rt, n.substr(rt, 2) === be ? (Hn = be, rt += 2) : (Hn = a, cr === 0 && xn(no)), Hn !== a && (Hn = ee()), (oi = Hn) === a && (B.test(n.charAt(rt)) ? (oi = n.charAt(rt), rt++) : (oi = a, cr === 0 && xn($r))); + n.charCodeAt(rt) === 39 ? (oi = he, rt++) : (oi = a, cr === 0 && xn(fn)), oi !== a ? Te = ae(Gt) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + return Te; + } + function L8() { + var Te; + return (Te = V3()) === a && (Te = Kx()), Te; + } + function V3() { + var Te, Ct, Gt, oi, Hn; + if (Te = rt, Qx() !== a) + if (Er(), (Ct = ch()) !== a) { + for (Er(), Gt = [], oi = SC(); oi !== a; ) + Gt.push(oi), oi = SC(); + oi = Er(), (Hn = PC()) !== a ? Te = ye(Ct, Gt) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + else + rt = Te, Te = a; + if (Te === a) + if (Te = rt, Qx() !== a) + if (Er(), (Ct = ch()) !== a) { + for (Er(), Gt = [], oi = SC(); oi !== a; ) + Gt.push(oi), oi = SC(); + oi = Er(), (Hn = Wv()) !== a ? (Er(), PC() !== a ? Te = Ie(Ct, Gt, Hn) : (rt = Te, Te = a)) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + else + rt = Te, Te = a; + return Te; + } + function Kx() { + var Te, Ct, Gt, oi; + if (Te = rt, Qx() !== a) { + for (Er(), Ct = [], Gt = j3(); Gt !== a; ) + Ct.push(Gt), Gt = j3(); + Gt = Er(), (oi = PC()) !== a ? Te = We(Ct) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + if (Te === a) + if (Te = rt, Qx() !== a) { + for (Er(), Ct = [], Gt = j3(); Gt !== a; ) + Ct.push(Gt), Gt = j3(); + Gt = Er(), (oi = Wv()) !== a ? (Er(), PC() !== a ? Te = Xe(Ct, oi) : (rt = Te, Te = a)) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + return Te; + } + function j3() { + var Te, Ct, Gt; + return Te = rt, Yb() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), qv() !== a ? (Er(), (Gt = ch()) !== a ? Te = lt(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function SC() { + var Te, Ct, Gt; + return Te = rt, Yb() !== a ? (Er(), (Ct = ch()) !== a ? (Er(), qv() !== a ? (Er(), (Gt = ch()) !== a ? Te = Et(Ct, Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Wv() { + var Te, Ct; + return Te = rt, qg() !== a ? (Er(), (Ct = ch()) !== a ? Te = Ht(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function N8() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = D1()) !== a ? (Gt = rt, cr++, oi = _C(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = vi(Ct) : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function D1() { + var Te, Ct, Gt, oi; + return Te = rt, (Ct = Hd()) !== a && (Gt = Th()) !== a && (oi = hL()) !== a ? Te = yi(Ct, Gt, oi) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = Hd()) !== a && (Gt = Th()) !== a ? Te = Oi(Ct, Gt) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = Hd()) !== a && (Gt = hL()) !== a ? Te = zi(Ct, Gt) : (rt = Te, Te = a), Te === a && (Te = rt, (Ct = Hd()) !== a && (Ct = ar(Ct)), Te = Ct))), Te; + } + function Hd() { + var Te, Ct, Gt; + return (Te = $s()) === a && (Te = rt, n.charCodeAt(rt) === 45 ? (Ct = j, rt++) : (Ct = a, cr === 0 && xn(Xt)), Ct === a && (n.charCodeAt(rt) === 43 ? (Ct = V, rt++) : (Ct = a, cr === 0 && xn(Jt))), Ct !== a && (Gt = $s()) !== a ? Te = tr(Ct, Gt) : (rt = Te, Te = a)), Te; + } + function Th() { + var Te, Ct, Gt; + return Te = rt, n.charCodeAt(rt) === 46 ? (Ct = Se, rt++) : (Ct = a, cr === 0 && xn(Zn)), Ct !== a ? ((Gt = $s()) === a && (Gt = null), Te = Ir(Gt)) : (rt = Te, Te = a), Te; + } + function hL() { + var Te, Ct, Gt; + return Te = rt, (Ct = dL()) !== a && (Gt = $s()) !== a ? Te = ur(Ct, Gt) : (rt = Te, Te = a), Te; + } + function $s() { + var Te, Ct; + if (Te = [], (Ct = k8()) !== a) + for (; Ct !== a; ) + Te.push(Ct), Ct = k8(); + else + Te = a; + return Te !== a && (Te = Jr(Te)), Te; + } + function k8() { + var Te; + return q.test(n.charAt(rt)) ? (Te = n.charAt(rt), rt++) : (Te = a, cr === 0 && xn(bs)), Te; + } + function dL() { + var Te, Ct, Gt; + return Te = rt, Z.test(n.charAt(rt)) ? (Ct = n.charAt(rt), rt++) : (Ct = a, cr === 0 && xn(On)), Ct !== a ? (ie.test(n.charAt(rt)) ? (Gt = n.charAt(rt), rt++) : (Gt = a, cr === 0 && xn(Jn)), Gt === a && (Gt = null), Te = on(Ct, Gt)) : (rt = Te, Te = a), Te; + } + function CC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Me ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(ki)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ct = [Ct, Gt] : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function tA() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === ke ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Ur)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ct = [Ct, Gt] : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function iA() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 5).toLowerCase() === J ? (Ct = n.substr(rt, 5), rt += 5) : (Ct = a, cr === 0 && xn(So)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ct = [Ct, Gt] : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function TC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 2).toLowerCase() === ce ? (Ct = n.substr(rt, 2), rt += 2) : (Ct = a, cr === 0 && xn(Cn)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = $n() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function EC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 2).toLowerCase() === xe ? (Ct = n.substr(rt, 2), rt += 2) : (Ct = a, cr === 0 && xn(Ki)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Fs() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function G3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Pe ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(ui)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ro() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Fa() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 6).toLowerCase() === Oe ? (Ct = n.substr(rt, 6), rt += 6) : (Ct = a, cr === 0 && xn(W)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Wa() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function qb() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 3).toLowerCase() === Re ? (Ct = n.substr(rt, 3), rt += 3) : (Ct = a, cr === 0 && xn(Cr)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ks() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function rA() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 3).toLowerCase() === Ge ? (Ct = n.substr(rt, 3), rt += 3) : (Ct = a, cr === 0 && xn(ia)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = vs() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function pL() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 2).toLowerCase() === je ? (Ct = n.substr(rt, 2), rt += 2) : (Ct = a, cr === 0 && xn(Ho)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = yo() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function fL() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 7).toLowerCase() === et ? (Ct = n.substr(rt, 7), rt += 7) : (Ct = a, cr === 0 && xn(Ut)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Gc() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function U3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Qe ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Ca)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Pr() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function $8() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 3).toLowerCase() === tt ? (Ct = n.substr(rt, 3), rt += 3) : (Ct = a, cr === 0 && xn(xi)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = _h() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function dg() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 9).toLowerCase() === ft ? (Ct = n.substr(rt, 9), rt += 9) : (Ct = a, cr === 0 && xn(_t)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Xu() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function z3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 7).toLowerCase() === Mt ? (Ct = n.substr(rt, 7), rt += 7) : (Ct = a, cr === 0 && xn(Fr)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Cu() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function H3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === kt ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(ln)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Bl() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Tu() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 8).toLowerCase() === Tt ? (Ct = n.substr(rt, 8), rt += 8) : (Ct = a, cr === 0 && xn(kn)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = bh() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function IC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 9).toLowerCase() === It ? (Ct = n.substr(rt, 9), rt += 9) : (Ct = a, cr === 0 && xn(Un)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = fd() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Om() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Nt ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Cs)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = pf() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Jx() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 7).toLowerCase() === nt ? (Ct = n.substr(rt, 7), rt += 7) : (Ct = a, cr === 0 && xn(ra)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = wh() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function AC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 8).toLowerCase() === Ee ? (Ct = n.substr(rt, 8), rt += 8) : (Ct = a, cr === 0 && xn(yn)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = md() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function cp() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Be ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Io)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = yl() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Uh() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === at ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(oh)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Dc() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function nA() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 2).toLowerCase() === wt ? (Ct = n.substr(rt, 2), rt += 2) : (Ct = a, cr === 0 && xn(gh)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Vl() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function B8() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 7).toLowerCase() === st ? (Ct = n.substr(rt, 7), rt += 7) : (Ct = a, cr === 0 && xn(vc)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = co() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function mL() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 8).toLowerCase() === le ? (Ct = n.substr(rt, 8), rt += 8) : (Ct = a, cr === 0 && xn(qu)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = xh() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function pg() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 5).toLowerCase() === ct ? (Ct = n.substr(rt, 5), rt += 5) : (Ct = a, cr === 0 && xn(ss)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = yu() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Gs() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === gt ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(dd)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Sh() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Gy() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 7).toLowerCase() === Ne ? (Ct = n.substr(rt, 7), rt += 7) : (Ct = a, cr === 0 && xn(Vd)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ud() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function gL() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 2).toLowerCase() === pe ? (Ct = n.substr(rt, 2), rt += 2) : (Ct = a, cr === 0 && xn(pd)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = zg() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function W3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 8).toLowerCase() === Ae ? (Ct = n.substr(rt, 8), rt += 8) : (Ct = a, cr === 0 && xn(cs)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ot() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function q3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === it ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Nl)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Bi() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function V8() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 5).toLowerCase() === yt ? (Ct = n.substr(rt, 5), rt += 5) : (Ct = a, cr === 0 && xn(ii)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Mr() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Y3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 3).toLowerCase() === He ? (Ct = n.substr(rt, 3), rt += 3) : (Ct = a, cr === 0 && xn(bt)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = zn() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Zx() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Ft ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Kt)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = xs() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function X3() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 6).toLowerCase() === ei ? (Ct = n.substr(rt, 6), rt += 6) : (Ct = a, cr === 0 && xn(Pi)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = Ss() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function F1() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 6).toLowerCase() === mt ? (Ct = n.substr(rt, 6), rt += 6) : (Ct = a, cr === 0 && xn(Sr)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = da() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Qx() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === Ue ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(Tr)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = qa() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function PC() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 3).toLowerCase() === si ? (Ct = n.substr(rt, 3), rt += 3) : (Ct = a, cr === 0 && xn(ri)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = hg() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Yb() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === A ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(pi)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = By() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function qv() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === ve ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(mi)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = ff() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function qg() { + var Te, Ct, Gt, oi; + return Te = rt, n.substr(rt, 4).toLowerCase() === H ? (Ct = n.substr(rt, 4), rt += 4) : (Ct = a, cr === 0 && xn(hr)), Ct !== a ? (Gt = rt, cr++, oi = pa(), cr--, oi === a ? Gt = void 0 : (rt = Gt, Gt = a), Gt !== a ? Te = kf() : (rt = Te, Te = a)) : (rt = Te, Te = a), Te; + } + function Yg() { + var Te; + return n.charCodeAt(rt) === 44 ? (Te = T, rt++) : (Te = a, cr === 0 && xn(Lr)), Te; + } + function vl() { + var Te; + return n.charCodeAt(rt) === 40 ? (Te = b, rt++) : (Te = a, cr === 0 && xn(wr)), Te; + } + function Lp() { + var Te; + return n.charCodeAt(rt) === 41 ? (Te = m, rt++) : (Te = a, cr === 0 && xn(Nr)), Te; + } + function Er() { + var Te, Ct; + for (Te = [], Ct = Yv(); Ct !== a; ) + Te.push(Ct), Ct = Yv(); + return Te; + } + function Yv() { + var Te; + return se.test(n.charAt(rt)) ? (Te = n.charAt(rt), rt++) : (Te = a, cr === 0 && xn(_r)), Te; + } + function K3() { + var Te, Ct, Gt, oi; + if (Te = rt, (Ct = k3()) !== a && (Ct = up(Ct)), (Te = Ct) === a) + if (Te = rt, n.charCodeAt(rt) === 96 ? (Ct = _, rt++) : (Ct = a, cr === 0 && xn(Tn)), Ct !== a) { + if (Gt = [], de.test(n.charAt(rt)) ? (oi = n.charAt(rt), rt++) : (oi = a, cr === 0 && xn(os)), oi !== a) + for (; oi !== a; ) + Gt.push(oi), de.test(n.charAt(rt)) ? (oi = n.charAt(rt), rt++) : (oi = a, cr === 0 && xn(os)); + else + Gt = a; + Gt !== a ? (n.charCodeAt(rt) === 96 ? (oi = _, rt++) : (oi = a, cr === 0 && xn(Tn)), oi !== a ? Te = YI(Gt) : (rt = Te, Te = a)) : (rt = Te, Te = a); + } else + rt = Te, Te = a; + return Te; + } + function Xv(Te, Ct) { + return { type: "unary-expression", operator: Te, expr: Ct }; + } + function sA(Te, Ct, Gt, oi) { + var Hn = { type: "binary-expression", operator: Te, left: Ct, right: Gt }; + return oi !== void 0 && (Hn.escape = oi), Hn; + } + function OC(Te, Ct) { + for (var Gt = [Te], oi = 0; oi < Ct.length; oi++) + Gt.push(Ct[oi][3]); + return Gt; + } + function J3(Te, Ct, Gt) { + return OC(Te, Ct); + } + function Xb(Te, Ct) { + for (var Gt = Te, oi = 0; oi < Ct.length; oi++) + Gt = sA(Ct[oi][1], Gt, Ct[oi][3]); + return Gt; + } + if ((o = h()) !== a && rt === n.length) + return o; + throw o !== a && rt < n.length && xn(nL()), P8(O1, Vy < n.length ? n.charAt(Vy) : null, Vy < n.length ? D3(Vy, Vy + 1) : D3(Vy, Vy)); + } + return t(e, Error), e.prototype.format = function(n) { + var s = "Error: " + this.message; + if (this.location) { + var o, a = null; + for (o = 0; o < n.length; o++) + if (n[o].source === this.location.source) { + a = n[o].text.split(/\r\n|\n|\r/g); + break; + } + var l = this.location.start, c = this.location.source + ":" + l.line + ":" + l.column; + if (a) { + var h = this.location.end, p = i("", l.line.toString().length, " "), y = a[l.line - 1], v = (l.line === h.line ? h.column : y.length + 1) - l.column || 1; + s += ` + --> ` + c + ` +` + p + ` | +` + l.line + " | " + y + ` +` + p + " | " + i("", l.column - 1, " ") + i("", v, "^"); + } else + s += ` + at ` + c; + } + return s; + }, e.buildMessage = function(n, s) { + var o = { literal: function(v) { + return '"' + l(v.text) + '"'; + }, class: function(v) { + var x = v.parts.map(function(I) { + return Array.isArray(I) ? c(I[0]) + "-" + c(I[1]) : c(I); + }); + return "[" + (v.inverted ? "^" : "") + x.join("") + "]"; + }, any: function() { + return "any character"; + }, end: function() { + return "end of input"; + }, other: function(v) { + return v.description; + } }; + function a(v) { + return v.charCodeAt(0).toString(16).toUpperCase(); + } + function l(v) { + return v.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(x) { + return "\\x0" + a(x); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(x) { + return "\\x" + a(x); + }); + } + function c(v) { + return v.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(x) { + return "\\x0" + a(x); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(x) { + return "\\x" + a(x); + }); + } + function h(v) { + return o[v.type](v); + } + function p(v) { + var x, I, P = v.map(h); + if (P.sort(), P.length > 0) { + for (x = 1, I = 1; x < P.length; x++) + P[x - 1] !== P[x] && (P[I] = P[x], I++); + P.length = I; + } + switch (P.length) { + case 1: + return P[0]; + case 2: + return P[0] + " or " + P[1]; + default: + return P.slice(0, -1).join(", ") + ", or " + P[P.length - 1]; + } + } + function y(v) { + return v ? '"' + l(v) + '"' : "end of input"; + } + return "Expected " + p(n) + " but " + y(s) + " found."; + }, { SyntaxError: e, parse: r }; +}, (WKe = { get exports() { + return XOe; +}, set exports(t) { + XOe = t; +} }).exports && (WKe.exports = qKe()); +let J4i = class { + static parse(e) { + return XOe.parse(e); + } +}; +const aEt = /^(\d{4})-(\d{1,2})-(\d{1,2})$/, Z4i = /^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2}(\.[0-9]+)?)$/, Q4i = /^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2}(\.[0-9]+)?)(\+|\-)(\d{1,2}):(\d{1,2})$/, eLi = /^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})(\+|\-)(\d{1,2}):(\d{1,2})$/, tLi = /^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/, iLi = /* @__PURE__ */ new Set(["current_timestamp", "current_date", "current_time"]); +function d5(t, e) { + return (t += "").length >= e ? t : new Array(e - t.length + 1).join("0") + t; +} +function rq(t, e, i = "0", r = "0", n = "0", s = "0", o = "", a = "0", l = "0") { + if (o === "+" || o === "-") { + const c = `${d5(parseInt(t, 10), 4)}-${d5(parseInt(e, 10), 2)}-${d5(parseInt(i, 10), 2)}`; + let h = ""; + parseFloat(s) < 10 && (h = "0"); + const p = `${d5(parseInt(r, 10), 2)}:${d5(parseInt(n, 10), 2)}:${h + parseFloat(s).toString()}`, y = `${o}${d5(parseInt(a, 10), 2)}:${d5(parseInt(l, 10), 2)}`; + return /* @__PURE__ */ new Date(c + "T" + p + y); + } + return new Date(parseInt(t, 10), parseInt(e, 10) - 1, parseInt(i, 10), parseInt(r, 10), parseInt(n, 10), parseFloat(s)); +} +let rLi = class { + static makeBool(e) { + return uEt(e); + } + static featureValue(e, i, r, n) { + return fEt(e, i, r, n); + } + static equalsNull(e) { + return e === null; + } + static applyLike(e, i, r) { + return QOe(e, i, r); + } + static ensureArray(e) { + return JOe(e); + } + static applyIn(e, i) { + return ZOe(e, i); + } + static currentDate() { + const e = /* @__PURE__ */ new Date(); + return e.setHours(0, 0, 0, 0), e; + } + static makeSqlInterval(e, i, r) { + return rO.createFromValueAndQualifer(e, i, r); + } + static convertInterval(e) { + return e instanceof rO ? e.valueInMilliseconds() : e; + } + static currentTimestamp() { + return /* @__PURE__ */ new Date(); + } + static compare(e, i, r) { + return dEt(e, i, r); + } + static calculate(e, i, r) { + return pEt(e, i, r); + } + static makeComparable(e) { + return YP(e); + } + static evaluateFunction(e, i) { + return V$e(e, i); + } + static lookup(e, i) { + const r = i[e]; + return r === void 0 ? null : r; + } + static between(e, i) { + return e == null || i[0] == null || i[1] == null ? null : e >= i[0] && e <= i[1]; + } + static notbetween(e, i) { + return e == null || i[0] == null || i[1] == null ? null : e < i[0] || e > i[1]; + } + static ternaryNot(e) { + return Wue(e); + } + static ternaryAnd(e, i) { + return cEt(e, i); + } + static ternaryOr(e, i) { + return hEt(e, i); + } +}, Ma = class lEt { + constructor(e, i) { + this.fieldsIndex = i, this._datefields = {}, this.parameters = {}, this._hasDateFunctions = void 0, this.parseTree = J4i.parse(e); + const { isStandardized: r, isAggregate: n, referencedFieldNames: s } = this._extractExpressionInfo(i); + this._referencedFieldNames = s, this.isStandardized = r, this.isAggregate = n; + } + static create(e, i) { + return new lEt(e, i); + } + get fieldNames() { + return this._referencedFieldNames; + } + testSet(e, i = EN) { + const r = {}; + for (const n of this.fieldNames) + r[n] = e.map((s) => i.getAttribute(s, n)); + return !!this._evaluateNode(this.parseTree, { attributes: r }, EN); + } + calculateValue(e, i = EN) { + const r = this._evaluateNode(this.parseTree, e, i); + return r instanceof rO ? r.valueInMilliseconds() / 864e5 : r; + } + calculateValueCompiled(e, i = EN) { + return this.parseTree._compiledVersion != null ? this.parseTree._compiledVersion(e, this.parameters, i, this._datefields) : Vi("esri-csp-restrictions") ? this.calculateValue(e, i) : (this._compileMe(), this.parseTree._compiledVersion(e, this.parameters, i, this._datefields)); + } + testFeature(e, i = EN) { + return !!this._evaluateNode(this.parseTree, e, i); + } + testFeatureCompiled(e, i = EN) { + return this.parseTree._compiledVersion != null ? !!this.parseTree._compiledVersion(e, this.parameters, i, this._datefields) : Vi("esri-csp-restrictions") ? this.testFeature(e, i) : (this._compileMe(), !!this.parseTree._compiledVersion(e, this.parameters, i, this._datefields)); + } + get hasDateFunctions() { + return this._hasDateFunctions != null || (this._hasDateFunctions = !1, this._visitAll(this.parseTree, (e) => { + e.type === "current-time" ? this._hasDateFunctions = !0 : e.type === "function" && (this._hasDateFunctions = this._hasDateFunctions || iLi.has(e.name.toLowerCase())); + })), this._hasDateFunctions; + } + getFunctions() { + const e = /* @__PURE__ */ new Set(); + return this._visitAll(this.parseTree, (i) => { + i.type === "function" && e.add(i.name.toLowerCase()); + }), Array.from(e); + } + getExpressions() { + const e = /* @__PURE__ */ new Map(); + return this._visitAll(this.parseTree, (i) => { + if (i.type === "function") { + const r = i.name.toLowerCase(), n = i.args.value[0]; + if (n.type === "column-reference") { + const s = n.column, o = `${r}-${s}`; + e.has(o) || e.set(o, { aggregateType: r, field: s }); + } + } + }), [...e.values()]; + } + getVariables() { + const e = /* @__PURE__ */ new Set(); + return this._visitAll(this.parseTree, (i) => { + i.type === "parameter" && e.add(i.value.toLowerCase()); + }), Array.from(e); + } + _compileMe() { + const e = "return this.convertInterval(" + this.evaluateNodeToJavaScript(this.parseTree) + ")"; + this.parseTree._compiledVersion = new Function("feature", "lookups", "attributeAdapter", "datefields", e).bind(rLi); + } + _extractExpressionInfo(e) { + const i = [], r = /* @__PURE__ */ new Set(); + let n = !0, s = !0; + return this._visitAll(this.parseTree, (o) => { + switch (o.type) { + case "column-reference": { + const a = e?.get(o.column); + let l, c; + a ? l = c = a.name ?? "" : (c = o.column, l = c.toLowerCase()), a && a.name && (a.type === "date" || a.type === "esriFieldTypeDate") && (this._datefields[a.name] = 1), r.has(l) || (r.add(l), i.push(c)), o.column = c; + break; + } + case "function": { + const { name: a, args: l } = o, c = l.value.length; + n && (n = Y4i(a, c)), s && (s = z4i(a, c)); + break; + } + } + }), { referencedFieldNames: Array.from(i), isStandardized: n, isAggregate: s }; + } + _visitAll(e, i) { + if (e != null) + switch (i(e), e.type) { + case "when-clause": + this._visitAll(e.operand, i), this._visitAll(e.value, i); + break; + case "case-expression": + for (const r of e.clauses) + this._visitAll(r, i); + e.format === "simple" && this._visitAll(e.operand, i), e.else !== null && this._visitAll(e.else, i); + break; + case "expression-list": + for (const r of e.value) + this._visitAll(r, i); + break; + case "unary-expression": + this._visitAll(e.expr, i); + break; + case "binary-expression": + this._visitAll(e.left, i), this._visitAll(e.right, i); + break; + case "function": + this._visitAll(e.args, i); + } + } + evaluateNodeToJavaScript(e) { + switch (e.type) { + case "interval": + return "this.makeSqlInterval(" + this.evaluateNodeToJavaScript(e.value) + ", " + JSON.stringify(e.qualifier) + "," + JSON.stringify(e.op) + ")"; + case "case-expression": { + let i = ""; + if (e.format === "simple") { + const r = "this.makeComparable(" + this.evaluateNodeToJavaScript(e.operand) + ")"; + i = "( "; + for (let n = 0; n < e.clauses.length; n++) + i += " (" + r + " === this.makeComparable(" + this.evaluateNodeToJavaScript(e.clauses[n].operand) + ")) ? (" + this.evaluateNodeToJavaScript(e.clauses[n].value) + ") : "; + e.else !== null ? i += this.evaluateNodeToJavaScript(e.else) : i += "null", i += " )"; + } else { + i = "( "; + for (let r = 0; r < e.clauses.length; r++) + i += " this.makeBool(" + this.evaluateNodeToJavaScript(e.clauses[r].operand) + ")===true ? (" + this.evaluateNodeToJavaScript(e.clauses[r].value) + ") : "; + e.else !== null ? i += this.evaluateNodeToJavaScript(e.else) : i += "null", i += " )"; + } + return i; + } + case "parameter": + return "this.lookup(" + JSON.stringify(e.value.toLowerCase()) + ",lookups)"; + case "expression-list": { + let i = "["; + for (const r of e.value) + i !== "[" && (i += ","), i += this.evaluateNodeToJavaScript(r); + return i += "]", i; + } + case "unary-expression": + return "this.ternaryNot(" + this.evaluateNodeToJavaScript(e.expr) + ")"; + case "binary-expression": + switch (e.operator) { + case "AND": + return "this.ternaryAnd(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + " )"; + case "OR": + return "this.ternaryOr(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + " )"; + case "IS": + if (e.right.type !== "null") + throw new Error("Unsupported RHS for IS"); + return "this.equalsNull(" + this.evaluateNodeToJavaScript(e.left) + ")"; + case "ISNOT": + if (e.right.type !== "null") + throw new Error("Unsupported RHS for IS"); + return "(!(this.equalsNull(" + this.evaluateNodeToJavaScript(e.left) + ")))"; + case "IN": + return "this.applyIn(" + this.evaluateNodeToJavaScript(e.left) + ",this.ensureArray(" + this.evaluateNodeToJavaScript(e.right) + "))"; + case "NOT IN": + return "this.ternaryNot(this.applyIn(" + this.evaluateNodeToJavaScript(e.left) + ",this.ensureArray(" + this.evaluateNodeToJavaScript(e.right) + ")))"; + case "BETWEEN": + return "this.between(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + ")"; + case "NOTBETWEEN": + return "this.notbetween(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + ")"; + case "LIKE": + return "this.applyLike(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + "," + JSON.stringify(e.escape) + ")"; + case "NOT LIKE": + return "this.ternaryNot(this.applyLike(" + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + "," + JSON.stringify(e.escape) + "))"; + case "<>": + case "<": + case ">": + case ">=": + case "<=": + case "=": + return "this.compare(" + JSON.stringify(e.operator) + "," + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + ")"; + case "*": + case "-": + case "+": + case "/": + case "||": + return "this.calculate(" + JSON.stringify(e.operator) + "," + this.evaluateNodeToJavaScript(e.left) + "," + this.evaluateNodeToJavaScript(e.right) + ")"; + } + throw new Error("Not Supported Operator " + e.operator); + case "null": + case "boolean": + case "string": + case "number": + return JSON.stringify(e.value); + case "date": + return "(new Date(" + YKe(e.value).getTime().toString() + "))"; + case "timestamp": + return "(new Date(" + KOe(e.value).getTime().toString() + "))"; + case "current-time": + return e.mode === "date" ? "this.currentDate()" : "this.currentTimestamp()"; + case "column-reference": + return "this.featureValue(feature," + JSON.stringify(e.column) + ",datefields,attributeAdapter)"; + case "function": + return "this.evaluateFunction(" + JSON.stringify(e.name) + "," + this.evaluateNodeToJavaScript(e.args) + ")"; + } + throw new Error("Unsupported sql syntax " + e.type); + } + _evaluateNode(e, i, r) { + switch (e.type) { + case "interval": { + const n = this._evaluateNode(e.value, i, r); + return rO.createFromValueAndQualifer(n, e.qualifier, e.op); + } + case "case-expression": + if (e.format === "simple") { + const n = YP(this._evaluateNode(e.operand, i, r)); + for (let s = 0; s < e.clauses.length; s++) + if (n === YP(this._evaluateNode(e.clauses[s].operand, i, r))) + return this._evaluateNode(e.clauses[s].value, i, r); + if (e.else !== null) + return this._evaluateNode(e.else, i, r); + } else { + for (let n = 0; n < e.clauses.length; n++) + if (uEt(this._evaluateNode(e.clauses[n].operand, i, r))) + return this._evaluateNode(e.clauses[n].value, i, r); + if (e.else !== null) + return this._evaluateNode(e.else, i, r); + } + return null; + case "parameter": + return this.parameters[e.value.toLowerCase()]; + case "expression-list": { + const n = []; + for (const s of e.value) + n.push(this._evaluateNode(s, i, r)); + return n; + } + case "unary-expression": + return Wue(this._evaluateNode(e.expr, i, r)); + case "binary-expression": + switch (e.operator) { + case "AND": + return cEt(this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r)); + case "OR": + return hEt(this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r)); + case "IS": + if (e.right.type !== "null") + throw new Error("Unsupported RHS for IS"); + return this._evaluateNode(e.left, i, r) === null; + case "ISNOT": + if (e.right.type !== "null") + throw new Error("Unsupported RHS for IS"); + return this._evaluateNode(e.left, i, r) !== null; + case "IN": { + const n = JOe(this._evaluateNode(e.right, i, r)); + return ZOe(this._evaluateNode(e.left, i, r), n); + } + case "NOT IN": { + const n = JOe(this._evaluateNode(e.right, i, r)); + return Wue(ZOe(this._evaluateNode(e.left, i, r), n)); + } + case "BETWEEN": { + const n = this._evaluateNode(e.left, i, r), s = this._evaluateNode(e.right, i, r); + return n == null || s[0] == null || s[1] == null ? null : n >= YP(s[0]) && n <= YP(s[1]); + } + case "NOTBETWEEN": { + const n = this._evaluateNode(e.left, i, r), s = this._evaluateNode(e.right, i, r); + return n == null || s[0] == null || s[1] == null ? null : n < YP(s[0]) || n > YP(s[1]); + } + case "LIKE": + return QOe(this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r), e.escape); + case "NOT LIKE": + return Wue(QOe(this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r), e.escape)); + case "<>": + case "<": + case ">": + case ">=": + case "<=": + case "=": + return dEt(e.operator, this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r)); + case "-": + case "+": + case "*": + case "/": + case "||": + return pEt(e.operator, this._evaluateNode(e.left, i, r), this._evaluateNode(e.right, i, r)); + } + case "null": + case "boolean": + case "string": + case "number": + return e.value; + case "date": + return YKe(e.value); + case "timestamp": + return KOe(e.value); + case "current-time": { + const n = /* @__PURE__ */ new Date(); + return e.mode === "date" && n.setHours(0, 0, 0, 0), n; + } + case "column-reference": + return fEt(i, e.column, this._datefields, r); + case "data-type": + return e.value; + case "function": { + const n = this._evaluateNode(e.args, i, r); + return this.isAggregate ? U4i(e.name, n) : V$e(e.name, n); + } + } + throw new Error("Unsupported sql syntax " + e.type); + } +}; +function KOe(t) { + let e = Z4i.exec(t); + if (e !== null) { + const [, i, r, n, s, o, a] = e; + return rq(i, r, n, s, o, a); + } + if (e = Q4i.exec(t), e !== null) { + const [, i, r, n, s, o, a, l, c, h] = e; + return rq(i, r, n, s, o, a, l, c, h); + } + if (e = eLi.exec(t), e !== null) { + const [, i, r, n, s, o, a, l, c] = e; + return rq(i, r, n, s, o, "0", a, l, c); + } + if (e = tLi.exec(t), e !== null) { + const [, i, r, n, s, o] = e; + return rq(i, r, n, s, o); + } + if (e = aEt.exec(t), e !== null) { + const [, i, r, n] = e; + return rq(i, r, n); + } + throw new Error("SQL Invalid Timestamp"); +} +function YKe(t) { + const e = aEt.exec(t); + if (e === null) + try { + return KOe(t); + } catch { + throw new Error("SQL Invalid Date"); + } + const [, i, r, n] = e; + return new Date(parseInt(i, 10), parseInt(r, 10) - 1, parseInt(n, 10)); +} +function uEt(t) { + return t === !0; +} +function JOe(t) { + return Array.isArray(t) ? t : [t]; +} +function Wue(t) { + return t !== null ? t !== !0 : null; +} +function cEt(t, e) { + return t != null && e != null ? t === !0 && e === !0 : t !== !1 && e !== !1 && null; +} +function hEt(t, e) { + return t != null && e != null ? t === !0 || e === !0 : t === !0 || e === !0 || null; +} +function ZOe(t, e) { + if (t == null) + return null; + let i = !1; + for (const r of e) + if (r == null) + i = null; + else if (t === r) { + i = !0; + break; + } + return i; +} +const XKe = "-[]/{}()*+?.\\^$|"; +var Rk; +function nLi(t, e) { + const i = e; + let r = "", n = Rk.Normal; + for (let s = 0; s < t.length; s++) { + const o = t.charAt(s); + switch (n) { + case Rk.Normal: + o === i ? n = Rk.Escaped : XKe.includes(o) ? r += "\\" + o : r += o === "%" ? ".*" : o === "_" ? "." : o; + break; + case Rk.Escaped: + XKe.includes(o) ? r += "\\" + o : r += o, n = Rk.Normal; + } + } + return new RegExp("^" + r + "$", "m"); +} +function QOe(t, e, i) { + return t == null ? null : nLi(e, i).test(t); +} +function YP(t) { + return t instanceof Date ? t.valueOf() : t; +} +function dEt(t, e, i) { + if (e == null || i == null) + return null; + const r = YP(e), n = YP(i); + switch (t) { + case "<>": + return r !== n; + case "=": + return r === n; + case ">": + return r > n; + case "<": + return r < n; + case ">=": + return r >= n; + case "<=": + return r <= n; + } +} +function pEt(t, e, i) { + if (t === "||") + return V$e("concat", [e, i]); + if (e instanceof rO) + if (i instanceof Date) + switch (t) { + case "+": + return new Date(e.valueInMilliseconds() + i.getTime()); + case "-": + return e.valueInMilliseconds() - i.getTime(); + case "*": + return e.valueInMilliseconds() * i.getTime(); + case "/": + return e.valueInMilliseconds() / i.getTime(); + } + else if (i instanceof rO) + switch (t) { + case "+": + return rO.createFromMilliseconds(e.valueInMilliseconds() + i.valueInMilliseconds()); + case "-": + return rO.createFromMilliseconds(e.valueInMilliseconds() - i.valueInMilliseconds()); + case "*": + return e.valueInMilliseconds() * i.valueInMilliseconds(); + case "/": + return e.valueInMilliseconds() / i.valueInMilliseconds(); + } + else + e = e.valueInMilliseconds(); + else if (i instanceof rO) + if (e instanceof Date) + switch (t) { + case "+": + return new Date(i.valueInMilliseconds() + e.getTime()); + case "-": + return new Date(e.getTime() - i.valueInMilliseconds()); + case "*": + return e.getTime() * i.valueInMilliseconds(); + case "/": + return e.getTime() / i.valueInMilliseconds(); + } + else + i = i.valueInMilliseconds(); + else if (e instanceof Date && typeof i == "number") + switch (i = 24 * i * 60 * 60 * 1e3, e = e.getTime(), t) { + case "+": + return new Date(e + i); + case "-": + return new Date(e - i); + case "*": + return new Date(e * i); + case "/": + return new Date(e / i); + } + else if (i instanceof Date && typeof e == "number") + switch (e = 24 * e * 60 * 60 * 1e3, i = i.getTime(), t) { + case "+": + return new Date(e + i); + case "-": + return new Date(e - i); + case "*": + return new Date(e * i); + case "/": + return new Date(e / i); + } + switch (t) { + case "+": + return e + i; + case "-": + return e - i; + case "*": + return e * i; + case "/": + return e / i; + } +} +function sLi(t) { + return t && typeof t.attributes == "object"; +} +function fEt(t, e, i, r) { + const n = r.getAttribute(t, e); + return n != null && i[e] === 1 ? new Date(n) : n; +} +(function(t) { + t[t.Normal = 0] = "Normal", t[t.Escaped = 1] = "Escaped"; +})(Rk || (Rk = {})); +const EN = { getAttribute: (t, e) => (sLi(t) ? t.attributes : t)[e] }, j0e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + WhereClause: Ma, + defaultAttributeAdapter: EN +}, Symbol.toStringTag, { value: "Module" })), oLi = { FeatureLayer: !0, SceneLayer: !0 }; +async function aLi(t) { + const e = t.properties?.customParameters, i = await uLi(t.url, e), r = { ...t.properties, url: t.url }; + if (!i.sublayerIds) + return i.layerOrTableId != null && (r.layerId = i.layerOrTableId, r.sourceJSON = i.sourceJSON), new i.Constructor(r); + const n = new (await Promise.resolve().then(() => G4t)).default({ title: i.parsedUrl.title }); + return lLi(n, i, r), n; +} +function KKe(t, e) { + return t ? t.find((i) => i.id === e) : null; +} +function lLi(t, e, i) { + function r(n, s) { + const o = { ...i, layerId: n, sublayerTitleMode: "service-name" }; + return _e(s) && (o.sourceJSON = s), new e.Constructor(o); + } + e.sublayerIds.forEach((n) => { + const s = r(n, KKe(e.sublayerInfos, n)); + t.add(s); + }), e.tableIds.forEach((n) => { + const s = r(n, KKe(e.tableInfos, n)); + t.tables.add(s); + }); +} +async function uLi(t, e) { + let i = FI(t); + if (ut(i) && (i = await cLi(t, e)), ut(i)) + throw new ot("arcgis-layers:url-mismatch", "The url '${url}' is not a valid arcgis resource", { url: t }); + const { serverType: r, sublayer: n } = i; + let s; + const o = { FeatureServer: "FeatureLayer", StreamServer: "StreamLayer", VectorTileServer: "VectorTileLayer" }; + switch (r) { + case "MapServer": + n != null ? s = "FeatureLayer" : s = await pLi(t, e) ? "TileLayer" : "MapImageLayer"; + break; + case "ImageServer": { + const c = await v1(t, { customParameters: e }), { tileInfo: h, cacheType: p } = c; + s = h ? h?.format?.toUpperCase() !== "LERC" || p && p.toLowerCase() !== "elevation" ? "ImageryTileLayer" : "ElevationLayer" : "ImageryLayer"; + break; + } + case "SceneServer": { + const c = await v1(i.url.path, { customParameters: e }); + if (s = "SceneLayer", c) { + const h = c?.layers; + if (c?.layerType === "Voxel") + s = "VoxelLayer"; + else if (h?.length) { + const p = h[0]?.layerType; + p != null && KK[p] != null && (s = KK[p]); + } + } + break; + } + default: + s = o[r]; + } + const a = r === "FeatureServer", l = { parsedUrl: i, Constructor: null, layerOrTableId: a ? n : void 0, sublayerIds: null, tableIds: null }; + if (oLi[s] && n == null) { + const c = await hLi(t, r, e); + a && (l.sublayerInfos = c.layerInfos, l.tableInfos = c.tableInfos), c.layerIds.length + c.tableIds.length !== 1 ? (l.sublayerIds = c.layerIds, l.tableIds = c.tableIds) : a && (l.layerOrTableId = c.layerIds[0] ?? c.tableIds[0], l.sourceJSON = c.layerInfos?.[0] ?? c.tableInfos?.[0]); + } + return l.Constructor = await dLi(s), l; +} +async function cLi(t, e) { + const i = await v1(t, { customParameters: e }); + let r = null, n = null; + const s = i.type; + if (s === "Feature Layer" || s === "Table" ? (r = "FeatureServer", n = i.id ?? null) : s === "indexedVector" ? r = "VectorTileServer" : i.hasOwnProperty("mapName") ? r = "MapServer" : i.hasOwnProperty("bandCount") && i.hasOwnProperty("pixelSizeX") ? r = "ImageServer" : i.hasOwnProperty("maxRecordCount") && i.hasOwnProperty("allowGeometryUpdates") ? r = "FeatureServer" : i.hasOwnProperty("streamUrls") ? r = "StreamServer" : JKe(i) ? (r = "SceneServer", n = i.id) : i.hasOwnProperty("layers") && JKe(i.layers?.[0]) && (r = "SceneServer"), !r) + return null; + const o = n != null ? Kpt(t) : null; + return { title: _e(o) && i.name || sge(t), serverType: r, sublayer: n, url: { path: _e(o) ? o.serviceUrl : ca(t).path } }; +} +function JKe(t) { + return t != null && t.hasOwnProperty("store") && t.hasOwnProperty("id") && typeof t.id == "number"; +} +async function hLi(t, e, i) { + let r, n = !1; + if (e === "FeatureServer") { + const a = await l$e(t, { customParameters: i }); + n = !!a.layersJSON, r = a.layersJSON || a.serviceJSON; + } else + r = await v1(t, { customParameters: i }); + const s = r?.layers, o = r?.tables; + return { layerIds: s?.map((a) => a.id).reverse() || [], tableIds: o?.map((a) => a.id).reverse() || [], layerInfos: n ? s : [], tableInfos: n ? o : [] }; +} +async function dLi(t) { + return (0, Ww[t])(); +} +async function pLi(t, e) { + return (await v1(t, { customParameters: e })).tileInfo; +} +const fLi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + fromUrl: aLi +}, Symbol.toStringTag, { value: "Module" })), Zz = (t, e, i) => [e, i], Lx = (t, e, i) => [e, i, t[2]], Qz = (t, e, i) => [e, i, t[2], t[3]]; +function Jpe(t) { + return t ? { originPosition: t.originPosition === "upper-left" ? "upperLeft" : t.originPosition === "lower-left" ? "lowerLeft" : t.originPosition, scale: t.tolerance ? [t.tolerance, t.tolerance] : [1, 1], translate: _e(t.extent) ? [t.extent.xmin, t.extent.ymax] : [0, 0] } : null; +} +function nee({ scale: t, translate: e }, i) { + return Math.round((i - e[0]) / t[0]); +} +function see({ scale: t, translate: e }, i) { + return Math.round((e[1] - i) / t[1]); +} +function j$e(t, e, i) { + const r = []; + let n, s, o, a; + for (let l = 0; l < i.length; l++) { + const c = i[l]; + l > 0 ? (o = nee(t, c[0]), a = see(t, c[1]), o === n && a === s || (r.push(e(c, o - n, a - s)), n = o, s = a)) : (n = nee(t, c[0]), s = see(t, c[1]), r.push(e(c, n, s))); + } + return r.length > 0 ? r : null; +} +function mLi(t, e, i, r) { + return j$e(t, i ? r ? Qz : Lx : r ? Lx : Zz, e); +} +function gLi(t, e, i, r) { + const n = [], s = i ? r ? Qz : Lx : r ? Lx : Zz; + for (let o = 0; o < e.length; o++) { + const a = j$e(t, s, e[o]); + a && a.length >= 3 && n.push(a); + } + return n.length ? n : null; +} +function yLi(t, e, i, r) { + const n = [], s = i ? r ? Qz : Lx : r ? Lx : Zz; + for (let o = 0; o < e.length; o++) { + const a = j$e(t, s, e[o]); + a && a.length >= 2 && n.push(a); + } + return n.length ? n : null; +} +function mEt({ scale: t, translate: e }, i) { + return i * t[0] + e[0]; +} +function gEt({ scale: t, translate: e }, i) { + return e[1] - i * t[1]; +} +function yEt(t, e, i) { + const r = new Array(i.length); + if (!i.length) + return r; + const [n, s] = t.scale; + let o = mEt(t, i[0][0]), a = gEt(t, i[0][1]); + r[0] = e(i[0], o, a); + for (let l = 1; l < i.length; l++) { + const c = i[l]; + o += c[0] * n, a -= c[1] * s, r[l] = e(c, o, a); + } + return r; +} +function vEt(t, e, i) { + const r = new Array(i.length); + for (let n = 0; n < i.length; n++) + r[n] = yEt(t, e, i[n]); + return r; +} +function vLi(t, e, i, r) { + return yEt(t, i ? r ? Qz : Lx : r ? Lx : Zz, e); +} +function _Li(t, e, i, r) { + return vEt(t, i ? r ? Qz : Lx : r ? Lx : Zz, e); +} +function bLi(t, e, i, r) { + return vEt(t, i ? r ? Qz : Lx : r ? Lx : Zz, e); +} +function wLi(t, e, i, r, n) { + return e.xmin = nee(t, i.xmin), e.ymin = see(t, i.ymin), e.xmax = nee(t, i.xmax), e.ymax = see(t, i.ymax), e !== i && (r && (e.zmin = i.zmin, e.zmax = i.zmax), n && (e.mmin = i.mmin, e.mmax = i.mmax)), e; +} +function xLi(t, e, i, r, n) { + return e.points = mLi(t, i.points, r, n) ?? [], e; +} +function G$e(t, e, i, r, n) { + return e.x = nee(t, i.x), e.y = see(t, i.y), e !== i && (r && (e.z = i.z), n && (e.m = i.m)), e; +} +function SLi(t, e, i, r, n) { + const s = gLi(t, i.rings, r, n); + return s ? (e.rings = s, e) : null; +} +function CLi(t, e, i, r, n) { + const s = yLi(t, i.paths, r, n); + return s ? (e.paths = s, e) : null; +} +function nq(t, e) { + return t && e ? B0(e) ? G$e(t, {}, e, !1, !1) : ju(e) ? CLi(t, {}, e, !1, !1) : za(e) ? SLi(t, {}, e, !1, !1) : Lg(e) ? xLi(t, {}, e, !1, !1) : gc(e) ? wLi(t, {}, e, !1, !1) : null : null; +} +function TLi(t, e, i, r, n) { + return _e(i) && (e.points = vLi(t, i.points, r, n)), e; +} +function ELi(t, e, i, r, n) { + return ut(i) || (e.x = mEt(t, i.x), e.y = gEt(t, i.y), e !== i && (r && (e.z = i.z), n && (e.m = i.m))), e; +} +function ILi(t, e, i, r, n) { + return _e(i) && (e.rings = bLi(t, i.rings, r, n)), e; +} +function ALi(t, e, i, r, n) { + return _e(i) && (e.paths = _Li(t, i.paths, r, n)), e; +} +const PLi = "", OLi = "equal-interval", RLi = 1, MLi = 5, DLi = 10, FLi = /\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi, ZKe = /* @__PURE__ */ new Set(["esriFieldTypeInteger", "esriFieldTypeSmallInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"]), LLi = ["min", "max", "avg", "stddev", "count", "sum", "variance", "nullcount", "median"]; +function gS(t) { + return t == null || typeof t == "string" && !t ? PLi : t; +} +function U$e(t) { + const e = t.normalizationField != null || t.normalizationType != null, i = t.minValue != null || t.maxValue != null, r = !!t.sqlExpression && t.supportsSQLExpression; + return !e && !i && !r; +} +function e3e(t) { + const e = t.returnDistinct ? [...new Set(t.values)] : t.values, i = e.filter((n) => n != null).length, r = { count: i }; + return t.supportsNullCount && (r.nullcount = e.length - i), t.percentileParams && (r.median = z$e(e, t.percentileParams)), r; +} +function Zpe(t) { + const { values: e, useSampleStdDev: i, supportsNullCount: r } = t; + let n = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY, o = null, a = null, l = null, c = null, h = 0; + const p = t.minValue == null ? -1 / 0 : t.minValue, y = t.maxValue == null ? 1 / 0 : t.maxValue; + for (const x of e) + Number.isFinite(x) ? x >= p && x <= y && (o = o === null ? x : o + x, n = Math.min(n, x), s = Math.max(s, x), h++) : typeof x == "string" && h++; + if (h && o != null) { + a = o / h; + let x = 0; + for (const I of e) + Number.isFinite(I) && I >= p && I <= y && (x += (I - a) ** 2); + c = i ? h > 1 ? x / (h - 1) : 0 : h > 0 ? x / h : 0, l = Math.sqrt(c); + } else + n = null, s = null; + const v = { avg: a, count: h, max: s, min: n, stddev: l, sum: o, variance: c }; + return r && (v.nullcount = e.length - h), t.percentileParams && (v.median = z$e(e, t.percentileParams)), v; +} +function z$e(t, e) { + const { fieldType: i, value: r, orderBy: n, isDiscrete: s } = e, o = _Et(i, n === "desc"); + if ((t = [...t].filter((v) => v != null).sort((v, x) => o(v, x))).length === 0) + return null; + if (r <= 0) + return t[0]; + if (r >= 1) + return t[t.length - 1]; + const a = (t.length - 1) * r, l = Math.floor(a), c = l + 1, h = a % 1, p = t[l], y = t[c]; + return c >= t.length || s || typeof p == "string" || typeof y == "string" ? p : p * (1 - h) + y * h; +} +function _Et(t, e) { + const i = e ? 1 : -1, r = NLi(e), n = QKe(e); + if (!(t && ["esriFieldTypeDate", "esriFieldTypeString", "esriFieldTypeGUID", "esriFieldTypeGlobalID", ...ZKe].includes(t))) + return (s, o) => typeof s == "number" && typeof o == "number" ? r(s, o) : typeof s == "string" && typeof o == "string" ? n(s, o) : i; + if (t === "esriFieldTypeDate") + return (s, o) => { + const a = new Date(s).getTime(), l = new Date(o).getTime(); + return isNaN(a) || isNaN(l) ? i : r(a, l); + }; + if (ZKe.has(t)) + return (s, o) => r(s, o); + if (t === "esriFieldTypeString") + return (s, o) => n(s, o); + if (t === "esriFieldTypeGUID" || t === "esriFieldTypeGlobalID") { + const s = QKe(e); + return (o, a) => s(eJe(o), eJe(a)); + } + return e ? (s, o) => 1 : (s, o) => -1; +} +function Qpe(t, e, i) { + if (i) { + if (t == null) + return e == null ? 0 : 1; + if (e == null) + return -1; + } else { + if (t == null) + return e == null ? 0 : -1; + if (e == null) + return 1; + } + return null; +} +function QKe(t) { + return t ? (e, i) => { + const r = Qpe(e, i, !0); + return r ?? ((e = e.toUpperCase()) > (i = i.toUpperCase()) ? -1 : e < i ? 1 : 0); + } : (e, i) => { + const r = Qpe(e, i, !1); + return r ?? ((e = e.toUpperCase()) < (i = i.toUpperCase()) ? -1 : e > i ? 1 : 0); + }; +} +function NLi(t) { + return t ? (e, i) => { + const r = Qpe(e, i, !0); + return r ?? i - e; + } : (e, i) => { + const r = Qpe(e, i, !1); + return r ?? e - i; + }; +} +function eJe(t) { + return t.substr(24, 12) + t.substr(19, 4) + t.substr(16, 2) + t.substr(14, 2) + t.substr(11, 2) + t.substr(9, 2) + t.substr(6, 2) + t.substr(4, 2) + t.substr(2, 2) + t.substr(0, 2); +} +function bEt(t, e) { + let i; + for (i in t) + LLi.includes(i) && (Number.isFinite(t[i]) || (t[i] = null)); + return e && ["avg", "stddev", "variance"].forEach((r) => { + t[r] != null && (t[r] = Math.ceil(t[r])); + }), t; +} +function wEt(t) { + const e = {}; + for (let i of t) + (i == null || typeof i == "string" && i.trim() === "") && (i = null), e[i] == null ? e[i] = { count: 1, data: i } : e[i].count++; + return { count: e }; +} +function qwe(t) { + return t?.type !== "coded-value" ? [] : t.codedValues.map((e) => e.code); +} +function xEt(t, e, i, r) { + const n = t.count, s = []; + if (i && e) { + const o = [], a = qwe(e[0]); + for (const l of a) + if (e[1]) { + const c = qwe(e[1]); + for (const h of c) + if (e[2]) { + const p = qwe(e[2]); + for (const y of p) + o.push(`${gS(l)}${r}${gS(h)}${r}${gS(y)}`); + } else + o.push(`${gS(l)}${r}${gS(h)}`); + } else + o.push(l); + for (const l of o) + n.hasOwnProperty(l) || (n[l] = { data: l, count: 0 }); + } + for (const o in n) { + const a = n[o]; + s.push({ value: a.data, count: a.count, label: a.label }); + } + return { uniqueValueInfos: s }; +} +function SEt(t, e, i, r) { + let n = null; + switch (e) { + case "log": + t !== 0 && (n = Math.log(t) * Math.LOG10E); + break; + case "percent-of-total": + Number.isFinite(r) && r !== 0 && (n = t / r * 100); + break; + case "field": + Number.isFinite(i) && i !== 0 && (n = t / i); + break; + case "natural-log": + t > 0 && (n = Math.log(t)); + break; + case "square-root": + t > 0 && (n = t ** 0.5); + } + return n; +} +function H$e(t, e) { + const i = $Li({ field: e.field, normalizationType: e.normalizationType, normalizationField: e.normalizationField, classificationMethod: e.classificationMethod, standardDeviationInterval: e.standardDeviationInterval, breakCount: e.numClasses || MLi }); + return t = kLi(t, e.minValue, e.maxValue), RQt({ definition: i, values: t, normalizationTotal: e.normalizationTotal }); +} +function kLi(t, e, i) { + const r = e ?? -1 / 0, n = i ?? 1 / 0; + return t.filter((s) => Number.isFinite(s) && s >= r && s <= n); +} +function $Li(t) { + const { breakCount: e, field: i, normalizationField: r, normalizationType: n } = t, s = t.classificationMethod || OLi, o = s === "standard-deviation" ? t.standardDeviationInterval || RLi : void 0; + return new PQt({ breakCount: e, classificationField: i, classificationMethod: s, normalizationField: n === "field" ? r : void 0, normalizationType: n, standardDeviationInterval: o }); +} +function CEt(t, e) { + let i = t.classBreaks; + const r = i.length, n = i[0].minValue, s = i[r - 1].maxValue, o = e === "standard-deviation", a = FLi; + return i = i.map((l) => { + const c = l.label, h = { minValue: l.minValue, maxValue: l.maxValue, label: c }; + if (o && c) { + const p = c.match(a)?.map((y) => +y.trim()) ?? []; + p.length === 2 ? (h.minStdDev = p[0], h.maxStdDev = p[1], p[0] < 0 && p[1] > 0 && (h.hasAvg = !0)) : p.length === 1 && (c.includes("<") ? (h.minStdDev = null, h.maxStdDev = p[0]) : c.includes(">") && (h.minStdDev = p[0], h.maxStdDev = null)); + } + return h; + }), { minValue: n, maxValue: s, classBreakInfos: i, normalizationTotal: t.normalizationTotal }; +} +function TEt(t, e) { + const i = BLi(t, e), r = i.intervals, n = i.min ?? 0, s = i.max ?? 0, o = r.map((a, l) => ({ minValue: r[l][0], maxValue: r[l][1], count: 0 })); + for (const a of t) + if (a != null && a >= n && a <= s) { + const l = VLi(r, a); + l > -1 && o[l].count++; + } + return { bins: o, minValue: n, maxValue: s, normalizationTotal: e.normalizationTotal }; +} +function BLi(t, e) { + const { field: i, classificationMethod: r, standardDeviationInterval: n, normalizationType: s, normalizationField: o, normalizationTotal: a, minValue: l, maxValue: c } = e, h = e.numBins || DLi; + let p = null, y = null, v = null; + if ((!r || r === "equal-interval") && !s) { + if (l != null && c != null) + p = l, y = c; + else { + const x = Zpe({ values: t, minValue: l, maxValue: c, useSampleStdDev: !s, supportsNullCount: U$e({ normalizationType: s, normalizationField: o, minValue: l, maxValue: c }) }); + p = x.min ?? null, y = x.max ?? null; + } + v = jLi(p ?? 0, y ?? 0, h); + } else { + const { classBreaks: x } = H$e(t, { field: i, normalizationType: s, normalizationField: o, normalizationTotal: a, classificationMethod: r, standardDeviationInterval: n, minValue: l, maxValue: c, numClasses: h }); + p = x[0].minValue, y = x[x.length - 1].maxValue, v = x.map((I) => [I.minValue, I.maxValue]); + } + return { min: p, max: y, intervals: v }; +} +function VLi(t, e) { + let i = -1; + for (let r = t.length - 1; r >= 0; r--) + if (e >= t[r][0]) { + i = r; + break; + } + return i; +} +function jLi(t, e, i) { + const r = (e - t) / i, n = []; + let s, o = t; + for (let a = 1; a <= i; a++) + s = o + r, s = Number(s.toFixed(16)), n.push([o, a === i ? e : s]), o = s; + return n; +} +let cB = null; +function GLi(t, e, i) { + return t.x < 0 ? t.x += e : t.x > i && (t.x -= e), t; +} +function ULi(t, e, i, r) { + const n = Sct(i) ? Ld(i) : null, s = n ? Math.round((n.valid[1] - n.valid[0]) / e.scale[0]) : null; + return t.map((o) => { + const a = new Xi(o.geometry); + return G$e(e, a, a, a.hasZ, a.hasM), o.geometry = n ? GLi(a, s, r[0]) : a, o; + }); +} +function zLi(t, e = 18, i, r, n, s) { + const o = new Float64Array(n * s); + e = Math.round(dn(e)); + let a = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY, c = 0, h = 0, p = 0, y = 0; + const v = rzt(r, i); + for (const { geometry: I, attributes: P } of t) { + const { x: F, y: k } = I, V = Math.max(0, F - e), j = Math.max(0, k - e), Y = Math.min(s, k + e), X = Math.min(n, F + e), Q = +v(P); + for (let re = j; re < Y; re++) + for (let he = V; he < X; he++) { + const fe = re * n + he, be = ypt(he - F, re - k, e), Se = o[fe]; + c = o[fe] += be * Q; + const Me = c - Se; + h += Me, p += Me * Me, c < a && (a = c), c > l && (l = c), y++; + } + } + if (!y) + return { mean: 0, stddev: 0, min: 0, max: 0, mid: 0, count: 0 }; + const x = (l - a) / 2; + return { mean: h / y, stdDev: Math.sqrt((p - h * h / y) / y), min: a, max: l, mid: x, count: y }; +} +async function G0e(t, e) { + if (!e) + return []; + const { field: i, field2: r, field3: n, fieldDelimiter: s } = t, o = t.valueExpression, a = t.normalizationType, l = t.normalizationField, c = t.normalizationTotal, h = [], p = t.viewInfoParams; + let y = null, v = null; + if (o) { + if (!cB) { + const { arcadeUtils: P } = await p1(); + cB = P; + } + y = cB.createFunction(o), v = p && cB.getViewInfo({ viewingMode: p.viewingMode, scale: p.scale, spatialReference: new or(p.spatialReference) }); + } + const x = t.fieldInfos, I = !(e[0] && "declaredClass" in e[0] && e[0].declaredClass === "esri.Graphic") && x ? { fields: x } : null; + return e.forEach((P) => { + const F = P.attributes; + let k; + if (o) { + const V = I ? { ...P, layer: I } : P, j = cB.createExecContext(V, v); + k = cB.executeFunction(y, j); + } else + F && (k = F[i], r && (k = `${gS(k)}${s}${gS(F[r])}`, n && (k = `${k}${s}${gS(F[n])}`))); + if (a && typeof k == "number" && isFinite(k)) { + const V = F && parseFloat(F[l]); + k = SEt(k, a, V, c); + } + h.push(k); + }), h; +} +async function HLi(t) { + const { attribute: e, features: i } = t, { normalizationType: r, normalizationField: n, minValue: s, maxValue: o, fieldType: a } = e, l = await G0e({ field: e.field, valueExpression: e.valueExpression, normalizationType: r, normalizationField: n, normalizationTotal: e.normalizationTotal, viewInfoParams: e.viewInfoParams, fieldInfos: e.fieldInfos }, i), c = U$e({ normalizationType: r, normalizationField: n, minValue: s, maxValue: o }), h = { value: 0.5, fieldType: a }, p = a === "esriFieldTypeString" ? e3e({ values: l, supportsNullCount: c, percentileParams: h }) : Zpe({ values: l, minValue: s, maxValue: o, useSampleStdDev: !r, supportsNullCount: c, percentileParams: h }); + return bEt(p, a === "esriFieldTypeDate"); +} +async function WLi(t) { + const { attribute: e, features: i } = t, r = await G0e({ field: e.field, field2: e.field2, field3: e.field3, fieldDelimiter: e.fieldDelimiter, valueExpression: e.valueExpression, viewInfoParams: e.viewInfoParams, fieldInfos: e.fieldInfos }, i), n = wEt(r); + return xEt(n, e.domains, e.returnAllCodedValues, e.fieldDelimiter); +} +async function qLi(t) { + const { attribute: e, features: i } = t, { field: r, normalizationType: n, normalizationField: s, normalizationTotal: o, classificationMethod: a } = e, l = await G0e({ field: r, valueExpression: e.valueExpression, normalizationType: n, normalizationField: s, normalizationTotal: o, viewInfoParams: e.viewInfoParams, fieldInfos: e.fieldInfos }, i), c = H$e(l, { field: r, normalizationType: n, normalizationField: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: e.standardDeviationInterval, numClasses: e.numClasses, minValue: e.minValue, maxValue: e.maxValue }); + return CEt(c, a); +} +async function YLi(t) { + const { attribute: e, features: i } = t, { field: r, normalizationType: n, normalizationField: s, normalizationTotal: o, classificationMethod: a } = e, l = await G0e({ field: r, valueExpression: e.valueExpression, normalizationType: n, normalizationField: s, normalizationTotal: o, viewInfoParams: e.viewInfoParams, fieldInfos: e.fieldInfos }, i); + return TEt(l, { field: r, normalizationType: n, normalizationField: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: e.standardDeviationInterval, numBins: e.numBins, minValue: e.minValue, maxValue: e.maxValue }); +} +async function XLi(t) { + const { attribute: e, features: i } = t, { field: r, radius: n, fieldOffset: s, transform: o, spatialReference: a, size: l } = e, c = ULi(i, o, a, l), { count: h, min: p, max: y, mean: v, stdDev: x } = zLi(c, n, s, r, l[0], l[1]); + return { count: h, min: p, max: y, avg: v, stddev: x }; +} +const KLi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + classBreaks: qLi, + heatmapStatistics: XLi, + histogram: YLi, + summaryStatistics: HLi, + uniqueValues: WLi +}, Symbol.toStringTag, { value: "Module" })); +function JLi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var efe = {}; +(function(t, e) { + function i() { + function n(A) { + if (typeof A == "number") + return le.Uc.ah(A); + if (A == null) + return null; + if (Ft[A] != null) + return le.Uc.ah(Ft[A]); + throw Error("Unrecognised Unit Type"); + } + function s(A) { + if (typeof A == "number") + return le.Uc.ah(A); + if (A == null) + return null; + if (ei[A] != null) + return le.Uc.ah(ei[A]); + throw Error("Unrecognised Unit Type"); + } + function o(A) { + if (A) + switch (A) { + case "loxodrome": + return 1; + case "great-elliptic": + return 2; + case "normal-section": + return 3; + case "shape-preserving": + return 4; + } + return 0; + } + function a(A, ve, H, T) { + if (H == null || H.B()) + return null; + switch (H.K()) { + case le.sn.Point: + return A.exportPoint(ve, H, T); + case le.sn.Polygon: + return A.exportPolygon(ve, H, T); + case le.sn.Polyline: + return A.exportPolyline(ve, H, T); + case le.sn.MultiPoint: + return A.exportMultipoint(ve, H, T); + case le.sn.Envelope: + return A.exportExtent(ve, H, T); + } + return null; + } + function l(A, ve, H, T) { + if (H.K() !== le.sn.Point) + throw Error("Geometry not Point"); + return A.exportPoint(ve, H, T); + } + function c(A, ve, H) { + return A.convertToGEGeometry(ve, H); + } + function h(A) { + var ve = A.wkid; + A = A.wkt; + var H = mt.get(ve || A); + return H == null && (ve !== -1 && ve != null ? (H = le.Gg.create(ve), mt.set(ve, H)) : A && (H = le.Gg.lP(A), mt.set(A, H)), si.has(ve || A) && H.QW(si.get(ve || A))), H; + } + function p(A) { + var ve; + if (A == null) + return null; + var H = h(A); + return A = H.Id(), H = H.Mn(), (ve = {}).tolerance = H, ve.unitType = A == null ? -1 : A.pd, ve.unitID = A == null ? -1 : A.Fc(), ve.unitBaseFactor = A == null ? 0 : A.ci, ve.unitSquareDerivative = A == null ? 0 : le.Uc.WF(A).Fc(), ve; + } + function y(A, ve, H, T) { + return H == null ? null : (H = le.ac.clip(c(A, Ue, H), c(A, Ue, T), h(ve)), a(A, Ue, H, ve)); + } + function v(A, ve, H, T) { + H = le.ac.fl(c(A, Ue, H), c(A, Ue, T), h(ve)), T = []; + for (var b = 0; b < H.length; b++) + T.push(a(A, Ue, H[b], ve)); + return T; + } + function x(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.contains(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function I(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.wP(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function P(A, ve, H, T, b) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.ub(c(A, Ue, H), c(A, Ue, T), h(ve), n(b)); + } + function F(A, ve, H, T) { + return !(H == null && T != null || T == null && H != null) && le.ac.Nb(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function k(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.OS(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function V(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.touches(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function j(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.mY(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function Y(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.OP(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function X(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.yU(c(A, Ue, H), c(A, Ue, T), h(ve)); + } + function Q(A, ve, H, T, b) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + return le.ac.tB(c(A, Ue, H), c(A, Ue, T), h(ve), b); + } + function re(A, ve, H) { + if (H == null) + throw Error("Illegal Argument Exception"); + return le.ac.ZS(c(A, Ue, H), h(ve)); + } + function he(A, ve, H) { + if (H == null) + throw Error("Illegal Argument Exception"); + return H = le.ac.$B(c(A, Ue, H), h(ve)), a(A, Ue, H, ve); + } + function fe(A, ve, H, T) { + if (T === void 0 && (T = !1), H == null) + throw Error("Illegal Argument Exception"); + if (Array.isArray(H)) { + var b = T, m = []; + for (T = 0; T < H.length; T++) + m.push(c(A, Ue, H[T])); + for (H = le.ac.eP(m, b), b = Array(H.length), T = 0; T < H.length; T++) + b[T] = a(A, Ue, H[T], ve); + return b; + } + return T = le.ac.dP(c(A, Ue, H), h(ve)), a(A, Ue, T, ve); + } + function be(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + if (Array.isArray(H)) { + for (var b = [], m = 0; m < H.length; m++) + b.push(c(A, Ue, H[m])); + for (H = le.ac.LP(b, c(A, Ue, T), h(ve)), T = Array(H.length), m = 0; m < H.length; m++) + T[m] = a(A, Ue, H[m], ve); + return T; + } + return m = le.ac.km(c(A, Ue, H), c(A, Ue, T), h(ve)), a(A, Ue, m, ve); + } + function Se(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + if (Array.isArray(H)) { + for (var b = [], m = 0; m < H.length; m++) + b.push(c(A, Ue, H[m])); + for (H = le.ac.RX(b, c(A, Ue, T), h(ve)), T = Array(H.length), m = 0; m < H.length; m++) + T[m] = a(A, Ue, H[m], ve); + return T; + } + return m = le.ac.gp(c(A, Ue, H), c(A, Ue, T), h(ve)), a(A, Ue, m, ve); + } + function Me(A, ve, H, T) { + if (H == null || T == null) + throw Error("Illegal Argument Exception"); + if (Array.isArray(H)) { + for (var b = [], m = 0; m < H.length; m++) + b.push(c(A, Ue, H[m])); + for (H = le.ac.MS(b, c(A, Ue, T), h(ve)), T = Array(H.length), m = 0; m < H.length; m++) + T[m] = a(A, Ue, H[m], ve); + return T; + } + return m = le.ac.Fa(c(A, Ue, H), c(A, Ue, T), h(ve)), a(A, Ue, m, ve); + } + function ke(A, ve, H, T) { + if (H == null) + return null; + var b = []; + if (Array.isArray(H)) { + if (H.length === 0) + return null; + for (T = 0; T < H.length; T++) + b.push(c(A, Ue, H[T])); + } else + b.push(c(A, Ue, H)), T != null && b.push(c(A, Ue, T)); + return a(A, Ue, le.ac.fY(b, h(ve)), ve); + } + function J(A, ve, H, T, b, m, _, C) { + var D = 0; + if (m != null) + switch (m) { + case "round": + D = 0; + break; + case "bevel": + D = 1; + break; + case "miter": + D = 2; + break; + case "square": + D = 3; + } + if (Array.isArray(H)) { + if (H == null) + A = null; + else if (H.length === 0) + A = []; + else { + var L = []; + for (m = 0; m < H.length; m++) + L.push(c(A, Ue, H[m])); + for (H = le.ac.wU(L, h(ve), T, D, _, C, n(b)), T = Array(H.length), m = 0; m < H.length; m++) + T[m] = a(A, Ue, H[m], ve); + A = T; + } + return A; + } + return H = le.ac.offset(c(A, Ue, H), h(ve), T, D, _, C, n(b)), a(A, Ue, H, ve); + } + function ce(A, ve, H, T, b, m) { + if (m === void 0 && (m = !1), Array.isArray(H)) { + if (!Array.isArray(T)) { + for (var _ = [], C = 0; C < H.length; C++) + _.push(T); + T = _; + } + if (T.length != H.length) { + if (T.length == 0) + throw Error("Illegal Argument Exception"); + _ = []; + var D = 0; + for (C = 0; C < H.length; C++) + T[C] === void 0 ? _.push(D) : (_.push(T[C]), D = T[C]); + T = _; + } + return Pe(A, ve, H, T, b, !1, m, "geodesic", NaN); + } + return H = le.ac.buffer(c(A, Ue, H), h(ve), T, n(b), !1, 0, NaN), a(A, Ue, H, ve); + } + function xe(A, ve, H, T, b, m, _, C) { + if (Array.isArray(H)) { + if (!Array.isArray(T)) { + for (var D = [], L = 0; L < H.length; L++) + D.push(T); + T = D; + } + if (T.length !== H.length) { + if (T.length === 0) + throw Error("Illegal Argument Exception"); + D = []; + var B = 0; + for (L = 0; L < H.length; L++) + T[L] === void 0 ? D.push(B) : (D.push(T[L]), B = T[L]); + T = D; + } + return Pe(A, ve, H, T, b, !0, m, _, C); + } + return _ === void 0 && (_ = NaN), H = le.ac.buffer(c(A, Ue, H), h(ve), T, n(b), !0, o(m), _), a(A, Ue, H, ve); + } + function Pe(A, ve, H, T, b, m, _, C, D) { + if (D === void 0 && (D = NaN), H == null) + return null; + if (H.length === 0) + return []; + for (var L = [], B = 0; B < H.length; B++) + L.push(c(A, Ue, H[B])); + for (H = le.ac.HN(L, h(ve), T, n(b), m, _, o(C), D), T = Array(H.length), B = 0; B < H.length; B++) + T[B] = a(A, Ue, H[B], ve); + return T; + } + function Oe(A, ve, H, T, b) { + var m; + return b === void 0 && (b = !0), H = le.ac.iz(c(A, Ue, H), c(A, Ue, T), b), (m = {}).coordinate = l(A, Ue, H.az(), ve), m.distance = H.cz(), m.isRightSide = H.Nz(), m.vertexIndex = H.Va(), m.isEmpty = H.B(), m; + } + function Re(A, ve, H, T) { + var b; + return H = le.ac.jz(c(A, Ue, H), c(A, Ue, T)), (b = {}).coordinate = l(A, Ue, H.az(), ve), b.distance = H.cz(), b.isRightSide = H.Nz(), b.vertexIndex = H.Va(), b.isEmpty = H.B(), b; + } + function Ge(A, ve, H, T, b, m) { + var _; + for (H = le.ac.kz(c(A, Ue, H), c(A, Ue, T), b, m), T = [], b = 0; b < H.length; b++) + H[b].B() === !1 && T.push(((_ = {}).coordinate = l(A, Ue, H[b].az(), ve), _.distance = H[b].cz(), _.isRightSide = H[b].Nz(), _.vertexIndex = H[b].Va(), _.isEmpty = H[b].B(), _)); + return T; + } + function je(A, ve, H, T, b, m) { + return H = le.ac.LQ(c(A, Ue, H), h(ve), T, b, n(m)), a(A, Ue, H, ve); + } + function et(A, ve, H, T, b) { + return H = le.ac.Sr(c(A, Ue, H), h(ve), T, n(b)), a(A, Ue, H, ve); + } + function Qe(A, ve, H, T, b, m) { + return m === void 0 && (m = 0), H = le.ac.Ry(c(A, Ue, H), h(ve), T, n(b), m), a(A, Ue, H, ve); + } + function tt(A, ve, H, T) { + if (H == null) + throw Error("Illegal Argument Exception"); + return le.ac.EU(c(A, Ue, H), h(ve), s(T)); + } + function ft(A, ve, H, T) { + if (H == null) + throw Error("Illegal Argument Exception"); + return le.ac.FU(c(A, Ue, H), h(ve), n(T)); + } + function Mt(A, ve, H, T, b) { + if (H == null) + throw Error("Illegal Argument Exception"); + return le.ac.RQ(c(A, Ue, H), h(ve), s(T), o(b)); + } + function kt(A, ve, H, T, b) { + if (H == null) + throw Error("Illegal Argument Exception"); + return le.ac.UQ(c(A, Ue, H), h(ve), n(T), o(b)); + } + function Tt(A) { + le.IL.bind(A); + } + function It(A, ve, H, T, b) { + var m = null, _ = null; + if (T) { + if (!b) + throw le.i.O("AOI missing Spatial Reference"); + m = c(A, Ue, T), _ = h(b).hh(); + } + return (A = le.iu.SR(h(ve).hh(), h(H).hh(), m, _)) !== null ? A : null; + } + function Nt(A, ve, H, T, b) { + var m = null, _ = null; + if (T) { + if (!b) + throw le.i.O("AOI missing Spatial Reference"); + m = c(A, Ue, T), _ = h(b).hh(); + } + return le.iu.TR(h(ve).hh(), h(H).hh(), m, _); + } + function nt(A, ve, H, T, b, m) { + if (b === void 0 && (b = null), m === void 0 && (m = null), m) { + var _ = new le.tC(); + _.Xu = m.densificationStep, _.Lr = m.centralMeridianOfOutputGCS, m.clipWithInputHorizon && _.KW(m.clipWithInputHorizon), m.clipWithOutputHorizon && _.LW(m.clipWithOutputHorizon); + } + if (this.GY === !1) + throw Error("Projection Engine must be enabled using enableProjection"); + if (ve.length === 0) + return []; + if (b) { + if (!(m = b.getCachedGeTransformation(H, T))) + e: { + if (m = b, b = null, m) { + var C = m.getGTListEntry(); + if (C !== null) { + b = new le.rC(null); + for (var D = 0, L = C.steps; D < L.length; D++) { + C = L[D]; + var B = new le.Cx(C.geogtran); + C.isInverse && B.Lz(), b.add(B); + } + _ = le.xr.Pr(h(H).hh(), h(T).hh(), b, _), m.assignCachedGe(H, T, _), m = _; + break e; + } + } + if (b === null && m && m.steps && 0 < m.steps.length) { + for (b = new le.rC(null), D = 0, L = m.steps; D < L.length; D++) + (C = L[D]).wkid != -1 && C.wkid != null ? b.add(le.Cx.create(C.wkid, C.isInverse)) : b.add(le.Cx.pP(C.wkt, C.isInverse)); + _ = le.xr.Pr(h(H).hh(), h(T).hh(), b, _), m.assignCachedGe(H, T, _), m = _; + } else + m = le.xr.Pr(h(H).hh(), h(T).hh(), b, _); + } + for (H = [], b = 0; b < ve.length; b++) + _ = ve[b], H.push(Ee(A, _, T, m)); + } else + for (m = le.xr.Pr(h(H).hh(), h(T).hh(), null), H = [], b = 0; b < ve.length; b++) + _ = ve[b], H.push(Ee(A, _, T, m)); + return H; + } + function Ee(A, ve, H, T) { + return ve = le.ac.Bh(c(A, Ue, ve), T), a(A, Ue, ve, H); + } + function Be(A, ve) { + A != null && (A = A.wkid || A.wkt, si.has(A), si.set(A, ve), mt.has(A) && mt.delete(A)); + } + function at(A) { + A != null && (A = A.wkid || A.wkt, si.has(A) && (si.delete(A), mt.has(A) && mt.delete(A))); + } + function wt(A, ve, H, T) { + if (H == null || T == null) + return []; + var b = [], m = 0; + for (H = le.ac.LS(c(A, Ue, H), c(A, Ue, T), h(ve)) || []; m < H.length; m++) + b.push(a(A, Ue, H[m], ve)); + return b; + } + var st, le, ct, gt, Ne = this && this.__extends || function() { + function A(ve, H) { + return (A = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(T, b) { + T.__proto__ = b; + } || function(T, b) { + for (var m in b) + b.hasOwnProperty(m) && (T[m] = b[m]); + })(ve, H); + } + return function(ve, H) { + function T() { + this.constructor = ve; + } + A(ve, H), ve.prototype = H === null ? Object.create(H) : (T.prototype = H.prototype, new T()); + }; + }(); + (function(A) { + var ve; + (ve = A.sn || (A.sn = {}))[ve.Unknown = 0] = "Unknown", ve[ve.Point = 33] = "Point", ve[ve.Line = 322] = "Line", ve[ve.Envelope = 197] = "Envelope", ve[ve.MultiPoint = 550] = "MultiPoint", ve[ve.Polyline = 1607] = "Polyline", ve[ve.Polygon = 1736] = "Polygon", function(T) { + T[T.enumMild = 0] = "enumMild", T[T.enumMedium = 1] = "enumMedium", T[T.enumHot = 2] = "enumHot"; + }(A.TK || (A.TK = {})); + var H = function() { + function T() { + this.description = null, this.QA = 0; + } + return T.prototype.K = function() { + return 0; + }, T.prototype.Eb = function() { + return -1; + }, T.prototype.Pf = function(b) { + this.wc(), b != this.description && this.un(b); + }, T.prototype.un = function() { + }, T.prototype.Ll = function(b) { + this.wc(), b != this.description && (b = A.fe.xR(this.description, b)) != this.description && this.un(b); + }, T.prototype.hasAttribute = function(b) { + return this.description.hasAttribute(b); + }, T.prototype.se = function(b) { + this.wc(), this.description.hasAttribute(b) || (b = A.fe.wR(this.description, b), this.un(b)); + }, T.prototype.Vg = function() { + return null; + }, T.prototype.dn = function() { + }, T.prototype.A = function() { + }, T.prototype.So = function() { + }, T.prototype.yc = function(b) { + this.A(b); + }, T.prototype.B = function() { + return !0; + }, T.prototype.Pa = function() { + }, T.prototype.Pc = function() { + }, T.prototype.Ja = function() { + return null; + }, T.prototype.copyTo = function() { + }, T.prototype.He = function() { + return 0; + }, T.prototype.Rb = function() { + return 0; + }, T.prototype.dG = function() { + return this.hasAttribute(1); + }, T.uf = function(b) { + return 1 + ((192 & b) >> 6) >> 1; + }, T.Tn = function(b) { + return (32 & b) != 0; + }, T.PS = function(b) { + return (128 & b) != 0; + }, T.zd = function(b) { + return (256 & b) != 0; + }, T.zj = function(b) { + return (512 & b) != 0; + }, T.Ic = function(b) { + return (1024 & b) != 0; + }, T.prototype.Qf = function() { + var b = this.Ja(); + return this.copyTo(b), b; + }, T.prototype.ng = function() { + return null; + }, T.kg = function(b) { + var m = b.Ja(); + return b.copyTo(m), m; + }, T.prototype.wc = function() { + 0 <= this.QA && (this.QA += 2147483649); + }, T.zx = function(b) { + var m = b.K(); + if (T.zj(m)) + return b.I(); + if (b.B()) + return 0; + if (m == 197) + return 4; + if (m == 33) + return 1; + if (T.zd(m)) + return 2; + throw A.i.ga("missing type"); + }, T; + }(); + A.ba = H; + })(le || (le = {})), ct = le || (le = {}), gt = function() { + function A() { + this.y = this.x = 0; + } + return A.construct = function(ve, H) { + var T = new A(); + return T.x = ve, T.y = H, T; + }, A.cl = function(ve) { + var H = new A(); + return H.x = ve.x, H.y = ve.y, H; + }, A.prototype.na = function(ve, H) { + this.x = ve, this.y = H; + }, A.prototype.N = function(ve) { + this.x = ve.x, this.y = ve.y; + }, A.prototype.hq = function(ve, H) { + return this.x === ve && this.y === H; + }, A.prototype.Mz = function(ve) { + return 2220446049250313e-31 >= Math.abs(this.x - ve.x) && 2220446049250313e-31 >= Math.abs(this.y - ve.y); + }, A.prototype.rb = function(ve) { + return this.x === ve.x && this.y === ve.y; + }, A.prototype.Nb = function(ve) { + return ve == this || ve instanceof A && this.x == ve.x && this.y == ve.y; + }, A.prototype.sub = function(ve) { + this.x -= ve.x, this.y -= ve.y; + }, A.prototype.vc = function(ve, H) { + this.x = ve.x - H.x, this.y = ve.y - H.y; + }, A.prototype.add = function(ve, H) { + H !== void 0 ? (this.x = ve.x + H.x, this.y = ve.y + H.y) : (this.x += ve.x, this.y += ve.y); + }, A.prototype.Uq = function() { + this.x = -this.x, this.y = -this.y; + }, A.prototype.nt = function(ve) { + this.x = -ve.x, this.y = -ve.y; + }, A.prototype.IS = function(ve, H, T) { + this.x = ve.x * (1 - T) + H.x * T, this.y = ve.y * (1 - T) + H.y * T; + }, A.prototype.Dt = function(ve, H) { + this.x = this.x * ve + H.x, this.y = this.y * ve + H.y; + }, A.prototype.BW = function(ve, H, T) { + this.x = H.x * ve + T.x, this.y = H.y * ve + T.y; + }, A.prototype.scale = function(ve) { + this.x *= ve, this.y *= ve; + }, A.prototype.compare = function(ve) { + return this.y < ve.y ? -1 : this.y > ve.y ? 1 : this.x < ve.x ? -1 : this.x > ve.x ? 1 : 0; + }, A.prototype.normalize = function() { + var ve = this.length(); + ve == 0 && (this.x = 1, this.y = 0), this.x /= ve, this.y /= ve; + }, A.prototype.length = function() { + return Math.sqrt(this.x * this.x + this.y * this.y); + }, A.prototype.Uk = function() { + return this.x * this.x + this.y * this.y; + }, A.ub = function(ve, H) { + return Math.sqrt(this.zc(ve, H)); + }, A.Jy = function(ve, H, T, b) { + return ve -= T, H -= b, Math.sqrt(ve * ve + H * H); + }, A.prototype.Sh = function(ve) { + return this.x * ve.x + this.y * ve.y; + }, A.prototype.aD = function(ve) { + return Math.abs(this.x * ve.x) + Math.abs(this.y * ve.y); + }, A.prototype.yi = function(ve) { + return this.x * ve.y - this.y * ve.x; + }, A.prototype.Ct = function(ve, H) { + var T = -this.x * H + this.y * ve; + this.x = this.x * ve + this.y * H, this.y = T; + }, A.prototype.Jv = function() { + var ve = this.x; + this.x = -this.y, this.y = ve; + }, A.prototype.HG = function(ve) { + this.x = -ve.y, this.y = ve.x; + }, A.prototype.cr = function() { + var ve = this.x; + this.x = this.y, this.y = -ve; + }, A.prototype.su = function() { + return 0 < this.x ? 0 <= this.y ? 1 : 4 : 0 < this.y ? 2 : this.x == 0 ? 4 : 3; + }, A.pu = function(ve, H) { + var T = ve.su(), b = H.su(); + return b == T ? 0 > (ve = ve.yi(H)) ? 1 : 0 < ve ? -1 : 0 : T < b ? -1 : 1; + }, A.zc = function(ve, H) { + var T = ve.x - H.x; + return T * T + (ve = ve.y - H.y) * ve; + }, A.prototype.toString = function() { + return "(" + this.x + " , " + this.y + ")"; + }, A.prototype.Sc = function() { + this.y = this.x = NaN; + }, A.prototype.isNaN = function() { + return isNaN(this.x) || isNaN(this.y); + }, A.prototype.offset = function(ve, H) { + var T = A.ub(ve, H), b = A.construct(this.x, this.y); + if (T == 0) + return A.ub(b, ve); + var m = new A(); + return m.N(H), m.sub(ve), b.sub(ve), b.yi(m) / T; + }, A.Wq = function(ve, H, T) { + var b = new ct.Xb(); + b.set(H.x), b.sub(ve.x); + var m = new ct.Xb(); + m.set(T.y), m.sub(ve.y); + var _ = new ct.Xb(); + _.set(H.y), _.sub(ve.y); + var C = new ct.Xb(); + return C.set(T.x), C.sub(ve.x), b.Bg(m), _.Bg(C), b.sub(_), b.rs() ? (b = new ct.jp(H.x), m = new ct.jp(ve.x), _ = new ct.jp(ve.y), b = b.kt(m), ve = (ve = new ct.jp(T.y)).kt(_), H = (H = new ct.jp(H.y)).kt(_), T = (T = new ct.jp(T.x)).kt(m), b = b.nr(ve), H = H.nr(T), (b = b.nr(H)).iT() ? -1 : b.aS() ? 1 : 0) : 0 > (T = b.value()) ? -1 : 0 < T ? 1 : 0; + }, A.prototype.dc = function() { + return ct.P.wj(ct.P.wj()); + }, A; + }(), ct.h = gt, function(A) { + var ve = function() { + function H(T) { + this.Ay = this.Ot = 0, this.KX = T; + } + return H.prototype.reset = function() { + this.Ay = this.Ot = 0; + }, H.prototype.add = function(T) { + T -= this.Ay; + var b = this.Ot + T; + this.Ay = b - this.Ot - T, this.Ot = b; + }, H.prototype.sub = function(T) { + this.add(-T); + }, H.prototype.tm = function() { + return this.KX + this.Ot; + }, H; + }(); + A.Ex = ve, A.mc = function() { + function H() { + } + return H.En = function(T, b) { + return 0 <= b ? Math.abs(T) : -Math.abs(T); + }, H.sign = function(T) { + return 0 > T ? -1 : 0 < T ? 1 : 0; + }, H.MK = function(T) { + return T - 360 * Math.floor(T / 360); + }, H.round = function(T) { + return Math.floor(T + 0.5); + }, H.ox = function(T) { + return T * T; + }, H.jq = function(T, b, m) { + return 0.5 >= m ? T + (b - T) * m : b - (b - T) * (1 - m); + }, H.JG = function(T, b, m, _) { + 0.5 >= m ? (_.x = T.x + (b.x - T.x) * m, _.y = T.y + (b.y - T.y) * m) : (_.x = b.x - (b.x - T.x) * (1 - m), _.y = b.y - (b.y - T.y) * (1 - m)); + }, H.gT = function(T, b, m, _, C, D) { + 0.5 >= C ? (D.x = T + (m - T) * C, D.y = b + (_ - b) * C) : (D.x = m - (m - T) * (1 - C), D.y = _ - (_ - b) * (1 - C)); + }, H; + }(); + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + var b = H.call(this) || this; + return b.ta = 0, b.oa = 0, b.qa = 0, b.ma = 0, b.la = null, b; + } + return Ne(T, H), T.prototype.bc = function() { + return A.h.construct(this.ta, this.oa); + }, T.prototype.$p = function(b) { + b.x = this.ta, b.y = this.oa; + }, T.prototype.Ec = function(b) { + this.gm(0, b); + }, T.prototype.UB = function(b, m) { + this.gm(0, A.h.construct(b, m)); + }, T.prototype.Vo = function(b) { + this.cD(0, b); + }, T.prototype.setStart = function(b) { + this.pD(0, b); + }, T.prototype.yv = function(b, m) { + return this.Pd(0, b, m); + }, T.prototype.TB = function(b, m, _) { + this.vn(0, b, m, _); + }, T.prototype.xc = function() { + return A.h.construct(this.qa, this.ma); + }, T.prototype.Vr = function(b) { + b.x = this.qa, b.y = this.ma; + }, T.prototype.Rc = function(b) { + this.gm(1, b); + }, T.prototype.Sl = function(b, m) { + this.gm(1, A.h.construct(b, m)); + }, T.prototype.Ro = function(b) { + this.cD(1, b); + }, T.prototype.setEnd = function(b) { + this.pD(1, b); + }, T.prototype.jv = function(b, m) { + return this.Pd(1, b, m); + }, T.prototype.JB = function(b, m, _) { + this.vn(1, b, m, _); + }, T.prototype.Eb = function() { + return 1; + }, T.prototype.B = function() { + return this.Bc(); + }, T.prototype.Pa = function() { + }, T.prototype.He = function() { + return 0; + }, T.prototype.Fa = function(b, m, _, C, D) { + return this.FM(b, m, _, C, D); + }, T.prototype.isIntersecting = function(b, m) { + return this.Br(b, m, !1) != 0; + }, T.prototype.ss = function(b, m) { + return this.tu(b, m, !1); + }, T.prototype.tu = function() { + return null; + }, T.prototype.Bc = function() { + return !1; + }, T.prototype.$x = function(b) { + if (this.wc(), this.la == null && 0 < b) + this.la = A.P.mg(2 * b); + else if (this.la != null && this.la.length < 2 * b) { + for (var m = this.la.slice(0), _ = this.la.length; _ < 2 * b; _++) + m[_] = 0; + this.la = m; + } + }, T.bM = function(b, m, _) { + if (0 < _) + var C = 0; + for (var D = 0; D < _; D++) + m[0 + C] = b[0], C++; + }, T.prototype.gm = function(b, m) { + b != 0 ? (this.qa = m.x, this.ma = m.y) : (this.ta = m.x, this.oa = m.y); + }, T.prototype.un = function(b) { + if (this.la != null) { + for (var m = A.fe.Kw(b, this.description), _ = [], C = T.Ig(this.description, 0), D = T.Ig(this.description, 1), L = T.Ig(b, 0), B = T.Ig(b, 1), q = 0, Z = 1, ie = b.Ba; Z < ie; Z++) { + var se = b.ld(Z), de = A.sa.Wa(se); + if (m[Z] == -1) { + var Ce = A.sa.te(se); + for (se = 0; se < de; se++) + _[L + q] = Ce, _[B + q] = Ce, q++; + } else + for (Ce = this.description.bk(m[Z]) - 2, se = 0; se < de; se++) + _[L + q] = this.la[C + Ce], _[B + q] = this.la[D + Ce], q++, Ce++; + } + this.la = _; + } + this.description = b; + }, T.prototype.cD = function(b, m) { + if (this.Bc()) + throw A.i.ga("empty geometry"); + m.Pf(this.description), m.Bc() && m.wn(); + for (var _ = 0; _ < this.description.Ba; _++) + for (var C = this.description.Fd(_), D = 0, L = A.sa.Wa(C); D < L; D++) { + var B = this.Pd(b, C, D); + m.setAttribute(C, D, B); + } + }, T.prototype.pD = function(b, m) { + if (this.wc(), m.Bc()) + throw A.i.ga("empty geometry"); + for (var _ = m.description, C = 0, D = _.Ba; C < D; C++) + for (var L = _.Fd(C), B = A.sa.Wa(L), q = 0; q < B; q++) { + var Z = m.Vc(L, q); + this.vn(b, L, q, Z); + } + }, T.prototype.Pd = function(b, m, _) { + if (this.Bc()) + throw A.i.ga("This operation was performed on an Empty Geometry."); + if (m == 0) + return b != 0 ? _ != 0 ? this.ma : this.qa : _ != 0 ? this.oa : this.ta; + if (_ >= A.sa.Wa(m)) + throw A.i.de(); + var C = this.description.Rf(m); + return 0 <= C ? (this.la != null && this.$x(this.description.Be.length - 2), this.la[T.Ig(this.description, b) + this.description.bk(C) - 2 + _]) : A.sa.te(m); + }, T.prototype.vn = function(b, m, _, C) { + if (this.wc(), _ >= A.sa.Wa(m)) + throw A.i.de(); + var D = this.description.Rf(m); + 0 > D && (this.se(m), D = this.description.Rf(m)), m == 0 ? b != 0 ? _ != 0 ? this.ma = C : this.qa = C : _ != 0 ? this.oa = C : this.ta = C : (this.la == null && this.$x(this.description.Be.length - 2), this.la[T.Ig(this.description, b) + this.description.bk(D) - 2 + _] = C); + }, T.prototype.copyTo = function(b) { + if (b.K() != this.K()) + throw A.i.O(); + b.description = this.description, b.$x(this.description.Be.length - 2), T.bM(this.la, b.la, 2 * (this.description.Be.length - 2)), b.ta = this.ta, b.oa = this.oa, b.qa = this.qa, b.ma = this.ma, b.wc(), this.qp(b); + }, T.prototype.Vg = function(b, m) { + var _ = new A.Oc(); + return this.Bc() ? (_.Pa(), _) : (_.pa = this.Pd(0, b, m), _.wa = _.pa, _.Nk(this.Pd(1, b, m)), _); + }, T.prototype.UI = function(b) { + this.Bc() ? b.Pa() : (b.pa = this.Pd(0, 0, 0), b.wa = b.pa, b.Nk(this.Pd(1, 0, 0))); + }, T.prototype.Vw = function(b, m) { + m.Pf(this.description), m.Db(this.ic(b)); + for (var _ = 1, C = this.description.Ba; _ < C; _++) + for (var D = this.description.Fd(_), L = A.sa.Wa(D), B = 0; B < L; B++) { + var q = this.Vc(b, D, B); + m.setAttribute(D, B, q); + } + }, T.prototype.AM = function(b) { + if (this.description != b.description || this.ta != b.ta || this.qa != b.qa || this.oa != b.oa || this.ma != b.ma) + return !1; + for (var m = 0; m < 2 * (this.description.Be.length - 2); m++) + if (this.la[m] != b.la[m]) + return !1; + return !0; + }, T.prototype.wG = function() { + return this.ta == this.qa && this.oa == this.ma; + }, T.prototype.reverse = function() { + var b = this.ta; + this.ta = this.qa, this.qa = b, b = this.oa, this.oa = this.ma, this.ma = b, b = 1; + for (var m = this.description.Ba; b < m; b++) + for (var _ = this.description.ld(b), C = 0, D = A.sa.Wa(_); C < D; C++) { + var L = this.Pd(0, _, C), B = this.Pd(1, _, C); + this.vn(0, _, C, B), this.vn(1, _, C, L); + } + }, T.prototype.Br = function(b, m, _) { + var C = b.K(); + if (this.K() === 322) { + if (C == 322) + return A.zb.JM(this, b, m, _); + throw A.i.Ra(); + } + throw A.i.Ra(); + }, T.prototype.FM = function(b, m, _, C, D) { + var L = b.K(); + if (this.K() === 322) { + if (L == 322) + return A.zb.Yx(this, b, m, _, C, D); + throw A.i.Ra(); + } + throw A.i.Ra(); + }, T.prototype.Sx = function() { + return null; + }, T.Ig = function(b, m) { + return m * (b.Be.length - 2); + }, T.prototype.ic = function(b, m) { + if (m === void 0) + return m = new A.h(), this.ic(b, m), m; + A.mc.gT(this.ta, this.oa, this.qa, this.ma, b, m); + }, T.prototype.ge = function() { + return null; + }, T.prototype.$F = function() { + return null; + }, T.prototype.fq = function() { + return null; + }, T.prototype.Di = function() { + return null; + }, T.prototype.Rn = function() { + return null; + }, T.prototype.lg = function() { + return null; + }, T.prototype.Tx = function(b, m) { + return m !== void 0 ? this.ux(m) - this.ux(b) : this.ux(b); + }, T.prototype.qp = function() { + }, T.prototype.fl = function() { + return null; + }, T.prototype.dh = function() { + }, T.prototype.Vc = function() { + return null; + }, T.prototype.Me = function() { + return null; + }, T.prototype.ux = function() { + return null; + }, T.prototype.IG = function() { + return null; + }, T.prototype.ub = function(b, m) { + if (!m && this.Br(b, 0, !1) != 0) + return 0; + m = 17976931348623157e292; + var _ = this.bc(), C = b.ge(_, !1); + return _.sub(b.ic(C)), (_ = _.length()) < m && (m = _), _ = this.xc(), C = b.ge(_, !1), _.sub(b.ic(C)), (_ = _.length()) < m && (m = _), _ = b.bc(), C = this.ge(_, !1), _.sub(this.ic(C)), (_ = _.length()) < m && (m = _), _ = b.xc(), C = this.ge(_, !1), _.sub(this.ic(C)), (_ = _.length()) < m && (m = _), m; + }, T.prototype.ng = function() { + return A.si.im(this, null); + }, T; + }(A.ba); + A.NC = ve; + }(le || (le = {})), new le.h(), function(A) { + var ve; + (ve = A.VK || (A.VK = {}))[ve.Unknown = -1] = "Unknown", ve[ve.Not = 0] = "Not", ve[ve.Weak = 1] = "Weak", ve[ve.Strong = 2] = "Strong", function(T) { + T[T.DirtyIsKnownSimple = 1] = "DirtyIsKnownSimple", T[T.IsWeakSimple = 2] = "IsWeakSimple", T[T.IsStrongSimple = 4] = "IsStrongSimple", T[T.DirtyOGCFlags = 8] = "DirtyOGCFlags", T[T.DirtyVerifiedStreams = 32] = "DirtyVerifiedStreams", T[T.DirtyExactIntervals = 64] = "DirtyExactIntervals", T[T.DirtyLooseIntervals = 128] = "DirtyLooseIntervals", T[T.DirtyIntervals = 192] = "DirtyIntervals", T[T.DirtyIsEnvelope = 256] = "DirtyIsEnvelope", T[T.DirtyLength2D = 512] = "DirtyLength2D", T[T.DirtyRingAreas2D = 1024] = "DirtyRingAreas2D", T[T.DirtyCoordinates = 1993] = "DirtyCoordinates", T[T.DirtyAllInternal = 65535] = "DirtyAllInternal", T[T.DirtyAll = 16777215] = "DirtyAll"; + }(A.HK || (A.HK = {})); + var H = function(T) { + function b() { + var m = T.call(this) || this; + return m.Jm = 65535, m.xa = 0, m.Rg = -1, m.Cb = null, m; + } + return Ne(b, T), b.prototype.qp = function() { + }, b.prototype.Zx = function() { + }, b.prototype.ey = function() { + }, b.prototype.I = function() { + return this.xa; + }, b.prototype.B = function() { + return this.Bc(); + }, b.prototype.Bc = function() { + return this.xa == 0; + }, b.prototype.ck = function(m) { + return (this.Jm & m) != 0; + }, b.prototype.Nf = function(m, _) { + this.Jm = _ ? this.Jm | m : this.Jm & ~m; + }, b.prototype.oc = function() { + this.ck(32) && this.XM(); + }, b.prototype.vx = function() { + if (this.Bc()) + throw A.i.ga("This operation was performed on an Empty Geometry."); + }, b.prototype.we = function(m, _) { + if (0 > m || m >= this.xa) + throw A.i.ga("index out of bounds"); + this.oc(), _.Pf(this.description), _.B() && _.wn(); + for (var C = 0; C < this.description.Ba; C++) + for (var D = this.description.Fd(C), L = 0, B = A.sa.Wa(D); L < B; L++) { + var q = this.Aa[C].gg(B * m + L); + _.setAttribute(D, L, q); + } + }, b.prototype.It = function(m, _) { + this.oc(); + for (var C = _.description, D = 0; D < C.Ba; D++) + for (var L = C.Fd(D), B = A.sa.Wa(L), q = 0; q < B; q++) { + var Z = _.Vc(L, q); + this.setAttribute(L, m, q, Z); + } + }, b.prototype.D = function(m, _) { + if (0 > m || m >= this.I()) + throw A.i.de(); + this.oc(), this.Aa[0].uc(2 * m, _); + }, b.prototype.Oa = function(m) { + var _ = new A.h(); + return this.D(m, _), _; + }, b.prototype.Hc = function(m, _) { + this.Aa[0].uc(2 * m, _); + }, b.prototype.Db = function(m, _, C) { + if (0 > m || m >= this.xa) + throw A.i.de(); + this.oc(); + var D = this.Aa[0]; + C !== void 0 ? (D.write(2 * m, _), D.write(2 * m + 1, C)) : D.Vt(2 * m, _), this.Qc(1993); + }, b.prototype.xz = function() { + if (void 0 >= this.I()) + throw A.i.de(); + this.oc(); + var m = this.Aa[0], _ = new A.Od(); + return _.x = m.read(NaN), _.y = m.read(NaN), _.z = this.hasAttribute(1) ? this.Aa[1].gg(void 0) : A.sa.te(1), _; + }, b.prototype.ZB = function(m) { + if (0 > m || m >= this.I()) + throw A.i.de(); + this.se(1), this.oc(), this.Qc(1993); + var _ = this.Aa[0]; + _.write(2 * m, (void 0).x), _.write(2 * m + 1, (void 0).y), this.Aa[1].rr(m, (void 0).z); + }, b.prototype.Vc = function(m, _, C) { + if (0 > _ || _ >= this.xa) + throw A.i.de(); + var D = A.sa.Wa(m); + if (C >= D) + throw A.i.de(); + this.oc(); + var L = this.description.Rf(m); + return 0 <= L ? this.Aa[L].gg(_ * D + C) : A.sa.te(m); + }, b.prototype.tF = function(m, _) { + return this.Vc(m, _, void 0); + }, b.prototype.setAttribute = function(m, _, C, D) { + if (0 > _ || _ >= this.xa) + throw A.i.de(); + var L = A.sa.Wa(m); + if (C >= L) + throw A.i.de(); + this.se(m), this.oc(), m = this.description.Rf(m), this.Qc(1993), this.Aa[m].rr(_ * L + C, D); + }, b.prototype.vb = function(m) { + return this.vx(), this.se(m), this.oc(), this.Aa[this.description.Rf(m)]; + }, b.prototype.kn = function(m, _) { + if (_ != null && A.sa.Vp(m) != _.Vp()) + throw A.i.O(); + this.se(m), m = this.description.Rf(m), this.Aa == null && (this.Aa = A.Zc.lI(this.description.Ba)), this.Aa[m] = _, this.Qc(16777215); + }, b.prototype.un = function(m) { + var _ = null; + if (this.Aa != null) { + var C = A.fe.Kw(m, this.description); + _ = []; + for (var D = 0, L = m.Ba; D < L; D++) + C[D] != -1 && (_[D] = this.Aa[C[D]]); + } + this.description = m, this.Aa = _, this.Rg = -1, this.Qc(16777215); + }, b.prototype.vD = function(m) { + this.yu(!0), m instanceof A.l ? this.aa.A(m) : this.aa.So(m); + }, b.prototype.WM = function(m) { + this.yu(!1), m instanceof A.l ? this.aa.A(m) : this.aa.So(m); + }, b.prototype.dn = function(m) { + this.yu(!0), this.aa.copyTo(m); + }, b.prototype.A = function(m) { + this.vD(m); + }, b.prototype.So = function(m) { + this.vD(m); + }, b.prototype.yc = function(m) { + this.WM(m); + }, b.prototype.Vg = function(m, _) { + var C = new A.Oc(); + return this.Bc() ? (C.Pa(), C) : (this.yu(!0), this.aa.Vg(m, _)); + }, b.prototype.dc = function() { + var m = this.description.dc(); + if (!this.Bc()) + for (var _ = this.I(), C = 0, D = this.description.Ba; C < D; C++) + m = this.Aa[C].Cn(m, 0, _ * A.sa.Wa(this.description.Fd(C))); + return m; + }, b.prototype.Nb = function(m) { + if (m == this) + return !0; + if (!(m instanceof b && this.description.Nb(m.description)) || this.Bc() != m.Bc()) + return !1; + if (this.Bc()) + return !0; + var _ = this.I(); + if (_ != m.I()) + return !1; + for (var C = 0; C < this.description.Ba; C++) { + var D = this.description.ld(C), L = this.vb(D), B = m.vb(D); + if (!L.Nb(B, 0, _ * A.sa.Wa(D))) + return !1; + } + return !0; + }, b.prototype.copyTo = function(m) { + if (m.K() != this.K()) + throw A.i.O(); + this.ZC(m); + }, b.prototype.ZC = function(m) { + this.oc(), m.description = this.description, m.Aa = null; + var _ = this.description.Ba, C = null; + if (this.Aa != null) { + C = []; + for (var D = 0; D < _; D++) + this.Aa[D] != null && (C[D] = this.Aa[D].BB(this.I() * A.sa.Wa(this.description.Fd(D)))); + } + this.aa != null ? (m.aa = this.aa.Ja(), this.aa.copyTo(m.aa)) : m.aa = null, m.xa = this.xa, m.Jm = this.Jm, m.Aa = C; + try { + this.qp(m); + } catch { + throw m.Pa(), A.i.hu(); + } + }, b.prototype.rD = function() { + this.xa = 0, this.Rg = -1, this.Aa = null, this.Qc(16777215); + }, b.prototype.Qc = function(m) { + m == 16777215 && (this.Rg = -1, this.Zx()), this.Jm |= m, this.gM(), this.wc(); + }, b.prototype.yu = function(m) { + if (this.oc(), this.ck(192)) + if (this.aa == null ? this.aa = new A.Hh(this.description) : this.aa.Pf(this.description), this.B()) + this.aa.Pa(); + else { + this.dy(m); + for (var _ = 1; _ < this.description.Ba; _++) + for (var C = this.description.Fd(_), D = A.sa.Wa(C), L = this.Aa[_], B = 0; B < D; B++) { + var q = new A.Oc(); + q.Pa(); + for (var Z = 0; Z < this.xa; Z++) { + var ie = L.gg(Z * D + B); + q.$b(ie); + } + this.aa.setInterval(C, B, q); + } + m && this.Nf(192, !1); + } + }, b.prototype.dy = function() { + this.aa.Pa(); + for (var m = this.Aa[0], _ = new A.h(), C = 0; C < this.xa; C++) + m.uc(2 * C, _), this.aa.$b(_); + }, b.prototype.Ap = function(m) { + m.Pa(); + for (var _ = this.Aa[0], C = new A.h(), D = 0; D < this.xa; D++) + _.uc(2 * D, C), m.$b(C); + }, b.prototype.XM = function() { + if (this.Rg < this.xa) { + this.Aa == null && (this.Aa = A.Zc.lI(this.description.Ba)), this.Rg = 2147483647; + for (var m = 0; m < this.description.Ba; m++) { + var _ = this.description.Fd(m); + if (this.Aa[m] != null) { + var C = A.sa.Wa(_), D = A.P.truncate(this.Aa[m].size / C); + D < this.xa && (D = A.P.truncate(this.Rg > this.xa + 5 ? (5 * this.xa + 3) / 4 : this.xa), this.Aa[m].resize(D * C, A.sa.te(_))), D < this.Rg && (this.Rg = D); + } else + this.Aa[m] = A.Zc.TE(_, this.xa), this.Rg = this.xa; + } + } + this.ey(), this.Nf(32, !1); + }, b.prototype.fm = function(m) { + if (0 > m) + throw A.i.O(); + m != this.xa && (this.xa = m, this.Qc(65535)); + }, b.prototype.qm = function(m) { + if (!this.ck(1)) { + if (!this.ck(2)) + return 0; + if (this.LT >= m) + return this.ck(8) ? 1 : 2; + } + return -1; + }, b.prototype.Eh = function(m, _) { + if (this.LT = _, m == -1) + this.Nf(1, !0), this.Nf(8, !0); + else if (this.Nf(1, !1), this.Nf(8, !0), m == 0) + this.Nf(2, !1), this.Nf(4, !1); + else if (m == 1) + this.Nf(2, !0), this.Nf(4, !1); + else { + if (m != 2) + throw A.i.ga("internal error."); + this.Nf(2, !0), this.Nf(4, !0); + } + }, b.prototype.gM = function() { + this.Cb != null && (this.Cb = null); + }, b.prototype.fD = function(m, _, C, D) { + if (0 > m || m >= this.xa || 0 > _ || _ >= this.xa) + throw A.i.ga("index out of bounds"); + this.oc(), D.Pf(this.description), D.B() && D.wn(); + for (var L = 0; L < this.description.Ba; L++) + for (var B = this.description.Fd(L), q = 0, Z = A.sa.Wa(B); q < Z; q++) { + var ie = this.Aa[L].gg(Z * m + q), se = this.Aa[L].gg(Z * _ + q); + D.setAttribute(B, q, A.mc.jq(ie, se, C)); + } + }, b.prototype.Ar = function(m, _) { + var C = this.Aa[0].o, D = C[2 * m] - C[2 * _]; + return m = C[2 * m + 1] - C[2 * _ + 1], Math.sqrt(D * D + m * m); + }, b.prototype.FR = function(m) { + if (0 > m || m >= this.xa) + throw A.i.de(); + this.oc(); + var _ = new A.Ta(); + _.Pf(this.description), _.B() && _.wn(); + for (var C = 0; C < this.description.Ba; C++) + for (var D = this.description.ld(C), L = 0, B = A.sa.Wa(D); L < B; L++) { + var q = this.Aa[C].gg(B * m + L); + _.setAttribute(D, L, q); + } + return _; + }, b.prototype.Fh = function(m, _) { + if (0 > m || m >= this.xa) + throw A.i.de(); + if (_.B()) + throw A.i.O(); + this.oc(); + for (var C = _.description, D = 0; D < C.Ba; D++) + for (var L = C.ld(D), B = A.sa.Wa(L), q = 0; q < B; q++) { + var Z = _.Vc(L, q); + this.setAttribute(L, m, q, Z); + } + }, b.prototype.nu = function() { + return null; + }, b.prototype.hj = function() { + return null; + }, b; + }(A.ba); + A.Fx = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.ob = this.ao = null, this.Vm = 124234251, this.Tv = !0, this.Ne = -1, this.ob = new A.ad(7), this.ao = null; + } + return H.prototype.Xo = function(T) { + this.ao = T; + }, H.prototype.MP = function() { + this.Tv = !1; + }, H.prototype.Ee = function(T) { + this.ob.Ee(T); + }, H.prototype.Rr = function(T) { + var b = this.ob.De(); + return this.nX(b), this.qX(T, b), b; + }, H.prototype.HP = function(T) { + this.ob.kd(T); + }, H.prototype.addElement = function(T, b) { + return b == -1 && (this.Ne == -1 && (this.Ne = this.Rr(-1)), b = this.Ne), this.AD(T, 0, b); + }, H.prototype.ED = function(T) { + return this.Ne == -1 && (this.Ne = this.Rr(-1)), this.AD(T, 1, this.Ne); + }, H.prototype.zn = function(T) { + this.Ne == -1 && (this.Ne = this.Rr(-1)); + var b = this.Ne, m = this.ob.o; + if (b == -1 || m[7 * b] == -1) + return T = this.ob.Nl([-1, -1, -1, T, this.il(), -1, -1]), (m = this.ob.o)[7 * b] = T, this.xp(-1, T, b, m), T; + var _ = b == -1 ? -1 : m[7 * b + 2]; + return T = this.ob.Nl([-1, -1, _, T, this.il(), -1, -1]), (m = this.ob.o)[7 * _ + 1] = T, this.ky(T, m), m[7 * T + 2] === -1 && (m[7 * b] = T), this.xp(-1, T, b, m), T; + }, H.prototype.Bu = function(T, b, m, _) { + var C = -1; + C == -1 && (this.Ne == -1 && (this.Ne = this.Rr(-1)), C = this.Ne); + var D = this.ob.o; + if (C == -1 || D[7 * C] == -1) + return m = this.ob.Nl([-1, -1, -1, m, this.il(), -1, -1]), (D = this.ob.o)[7 * C] = m, this.xp(-1, m, C, D), m; + if (_) { + _ = b != -1 ? this.ao.compare(this, m, b) : -1; + var L = T != -1 ? this.ao.compare(this, m, T) : 1; + } else + _ = -1, L = 1; + if (_ == 0 || L == 0) + return D[7 * C + 3] = _ == 0 ? b : T, -1; + for ((b != -1 && T != -1 ? this.Vm > A.P.XA(this.Vm) >> 1 : b != -1) ? T = b : _ = L, b = !0; ; ) { + if (0 > _) { + if ((L = D[7 * T]) == -1) { + _ = T, m = this.ob.Nl([-1, -1, T, m, this.il(), -1, -1]), (D = this.ob.o)[7 * T] = m; + break; + } + T = L; + } else { + if ((L = D[7 * T + 1]) == -1) { + _ = D[7 * T + 6], m = this.ob.Nl([-1, -1, T, m, this.il(), -1, -1]), (D = this.ob.o)[7 * T + 1] = m; + break; + } + T = L; + } + b && (_ *= -1, b = !1); + } + return this.ky(m, D), D[7 * m + 2] === -1 && (D[7 * C] = m), this.xp(_, m, C, D), m; + }, H.prototype.AF = function() { + return this.dR(this.Ne); + }, H.prototype.wd = function(T, b) { + b = b == -1 ? this.Ne : b, this.Tv ? this.GP(T, b) : this.eY(T, b); + }, H.prototype.search = function(T, b) { + for (b = this.uv(b); b != -1; ) { + var m = this.ao.compare(this, T, b); + if (m == 0) + return b; + b = 0 > m ? this.nl(b) : this.Zp(b); + } + return -1; + }, H.prototype.DW = function(T) { + for (var b = this.uv(-1), m = -1; b != -1; ) { + var _ = T.compare(this, b); + if (_ == 0) + return b; + 0 > _ ? b = this.nl(b) : (m = b, b = this.Zp(b)); + } + return m; + }, H.prototype.pJ = function(T) { + for (var b = this.uv(-1), m = -1; b != -1; ) { + var _ = T.compare(this, b); + if (_ == 0) + return b; + 0 > _ ? (m = b, b = this.nl(b)) : b = this.Zp(b); + } + return m; + }, H.prototype.ka = function(T) { + return this.ob.U(T, 3); + }, H.prototype.nl = function(T) { + return this.ob.U(T, 0); + }, H.prototype.Zp = function(T) { + return this.ob.U(T, 1); + }, H.prototype.getParent = function(T) { + return this.ob.U(T, 2); + }, H.prototype.lb = function(T) { + return this.ob.U(T, 6); + }, H.prototype.xe = function(T) { + return this.ob.U(T, 5); + }, H.prototype.sc = function(T) { + return T == -1 ? this.ml(this.Ne) : this.ml(T); + }, H.prototype.Gc = function(T) { + return T == -1 ? this.bs(this.Ne) : this.bs(T); + }, H.prototype.UR = function(T) { + return T == -1 ? this.XF(this.Ne) : this.XF(T); + }, H.prototype.Uj = function(T, b) { + this.IB(T, b); + }, H.prototype.uv = function(T) { + return T == -1 ? this.TF(this.Ne) : this.TF(T); + }, H.prototype.clear = function() { + this.ob.oj(!1), this.Ne = -1; + }, H.prototype.size = function(T) { + return T == -1 ? this.VF(this.Ne) : this.VF(T); + }, H.prototype.FN = function(T, b) { + for (var m = b[7 * T], _ = b[7 * T + 1], C = b[7 * T + 4]; m != -1 || _ != -1; ) { + var D = m != -1 ? b[7 * m + 4] : 2147483647; + if (_ = _ != -1 ? b[7 * _ + 4] : 2147483647, C <= Math.min(D, _)) + break; + D <= _ ? this.nJ(m, b) : this.mJ(T, b), m = b[7 * T], _ = b[7 * T + 1]; + } + }, H.prototype.ky = function(T, b) { + if (this.Tv) + for (var m = b[7 * T + 4], _ = b[7 * T + 2]; _ != -1 && b[7 * _ + 4] > m; ) + b[7 * _] == T ? this.nJ(T, b) : this.mJ(_, b), _ = b[7 * T + 2]; + }, H.prototype.mJ = function(T, b) { + var m = b[7 * T + 1]; + b[7 * m + 2] = b[7 * T + 2], b[7 * T + 2] = m; + var _ = b[7 * m]; + b[7 * T + 1] = _, _ != -1 && (b[7 * _ + 2] = T), b[7 * m] = T, (_ = b[7 * m + 2]) != -1 && (b[7 * _] == T ? b[7 * _] = m : b[7 * _ + 1] = m); + }, H.prototype.nJ = function(T, b) { + var m = b[7 * T + 2]; + b[7 * T + 2] = b[7 * m + 2], b[7 * m + 2] = T; + var _ = b[7 * T + 1]; + b[7 * m] = _, _ != -1 && (b[7 * _ + 2] = m), b[7 * T + 1] = m, (_ = b[7 * T + 2]) != -1 && (b[7 * _] === m ? b[7 * _] = T : b[7 * _ + 1] = T); + }, H.prototype.Rk = function(T, b) { + this.ob.T(T, 2, b); + }, H.prototype.OB = function(T, b) { + this.ob.T(T, 0, b); + }, H.prototype.SB = function(T, b) { + this.ob.T(T, 1, b); + }, H.prototype.RB = function(T, b) { + this.ob.T(T, 5, b); + }, H.prototype.fx = function(T, b) { + this.ob.T(T, 6, b); + }, H.prototype.SJ = function(T, b) { + this.ob.T(b, 0, T); + }, H.prototype.nX = function(T) { + this.ob.T(T, 4, 0); + }, H.prototype.qX = function(T, b) { + this.ob.T(b, 5, T); + }, H.prototype.TF = function(T) { + return T == -1 ? -1 : this.ob.U(T, 0); + }, H.prototype.ml = function(T) { + return T == -1 ? -1 : this.ob.U(T, 1); + }, H.prototype.bs = function(T) { + return T == -1 ? -1 : this.ob.U(T, 2); + }, H.prototype.dR = function(T) { + return T == -1 ? -1 : this.ob.U(T, 3); + }, H.prototype.VF = function(T) { + return T == -1 ? 0 : this.ob.U(T, 4); + }, H.prototype.XF = function(T) { + return this.ob.U(T, 5); + }, H.prototype.Rw = function() { + return this.ob.Nl([-1, -1, -1, void 0, this.il(), -1, -1]); + }, H.prototype.hl = function(T) { + T != -1 && this.ob.kd(T); + }, H.prototype.il = function() { + return this.Vm = A.P.XA(this.Vm), 1073741823 & this.Vm; + }, H.prototype.AD = function(T, b, m) { + var _ = this.ob.o; + if (m == -1 || _[7 * m] == -1) + return T = this.ob.Nl([-1, -1, -1, T, this.il(), -1, -1]), (_ = this.ob.o)[7 * m] = T, this.xp(-1, T, m, _), T; + for (var C = m == -1 ? -1 : _[7 * m]; ; ) { + var D = b == -1 ? 1 : this.ao.compare(this, T, C); + if (0 > D) { + if ((D = this.nl(C)) == -1) { + b = C, T = this.ob.Nl([-1, -1, C, T, this.il(), -1, -1]), (_ = this.ob.o)[7 * C] = T; + break; + } + C = D; + } else { + if (b == 1 && D == 0) + return _[7 * m + 3] = C, -1; + if ((D = _[7 * C + 1]) == -1) { + b = _[7 * C + 6], T = this.ob.Nl([-1, -1, C, T, this.il(), -1, -1]), (_ = this.ob.o)[7 * C + 1] = T; + break; + } + C = D; + } + } + return this.ky(T, _), _[7 * T + 2] === -1 && (_[7 * m] = T), this.xp(b, T, m, _), T; + }, H.prototype.xp = function(T, b, m, _) { + if (T != -1) { + var C = _[7 * T + 5]; + _[7 * T + 5] = b; + } else + C = m == -1 ? -1 : _[7 * m + 2]; + _[7 * b + 5] = C, C != -1 && (_[7 * C + 6] = b), _[7 * b + 6] = T, T == (m == -1 ? -1 : _[7 * m + 1]) && (_[7 * m + 1] = b), T == -1 && (_[7 * m + 2] = b), _[7 * m + 4] = (m == -1 ? 0 : _[7 * m + 4]) + 1; + }, H.prototype.vB = function(T, b) { + var m = this.ob.o, _ = m[7 * T + 5]; + T = m[7 * T + 6], _ != -1 ? m[7 * _ + 6] = T : m[7 * b + 1] = T, T != -1 ? m[7 * T + 5] = _ : m[7 * b + 2] = _, m[7 * b + 4] = b === -1 ? -1 : m[7 * b + 4] - 1; + }, H.prototype.eY = function(T, b) { + this.vB(T, b); + var m = this.nl(T), _ = this.Zp(T), C = this.getParent(T), D = T; + if (m != -1 && _ != -1) { + this.Vm = A.P.XA(this.Vm); + var L = 1073741823 < this.Vm ? this.lb(T) : this.xe(T), B = this.getParent(L) == T; + this.ob.bC(T, L, 0), this.ob.bC(T, L, 1), this.ob.bC(T, L, 2), C != -1 ? this.nl(C) == T ? this.OB(C, L) : this.SB(C, L) : this.SJ(L, b), B ? (m == L ? (this.OB(L, T), this.Rk(_, L)) : _ == L && (this.SB(L, T), this.Rk(m, L)), this.Rk(T, L), C = L) : (this.Rk(m, L), this.Rk(_, L), C = this.getParent(T), D = L), m = this.nl(T), _ = this.Zp(T), m != -1 && this.Rk(m, T), _ != -1 && this.Rk(_, T); + } + m = m != -1 ? m : _, C == -1 ? this.SJ(m, b) : this.nl(C) == D ? this.OB(C, m) : this.SB(C, m), m != -1 && this.Rk(m, C), this.hl(T); + }, H.prototype.GP = function(T, b) { + var m = this.ob.o; + m[7 * T + 4] = 2147483647; + var _ = -1, C = -1, D = b === -1 ? -1 : m[7 * b], L = D == T; + if (L && (_ = m[7 * D], C = m[7 * D + 1], _ == -1 && C == -1)) + return this.vB(D, b), this.hl(D), void (m[7 * b] = -1); + this.FN(T, m), (D = m[7 * T + 2]) != -1 && (m[7 * D] == T ? m[7 * D] = -1 : m[7 * D + 1] = -1), this.vB(T, b), this.hl(T), L && (m[7 * b] = _ == -1 || m[7 * _ + 2] != -1 ? C : _); + }, H.prototype.IB = function(T, b) { + this.ob.T(T, 3, b); + }, H; + }(); + A.$j = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b) { + T !== void 0 && this.L(T, b); + } + return H.prototype.L = function(T, b) { + this.pa = T, this.wa = b, this.normalize(); + }, H.prototype.isIntersecting = function(T) { + return this.pa <= T.pa ? this.wa >= T.pa : T.wa >= this.pa; + }, H.prototype.move = function(T) { + this.B() || (this.pa += T, this.wa += T); + }, H.prototype.normalize = function() { + if (!isNaN(this.pa)) { + if (this.pa > this.wa) { + var T = this.pa; + this.pa = this.wa, this.wa = T; + } + isNaN(this.wa) && this.Pa(); + } + }, H.prototype.Pa = function() { + this.wa = this.pa = NaN; + }, H.prototype.B = function() { + return isNaN(this.pa); + }, H.prototype.$b = function(T) { + typeof T == "number" ? this.B() ? this.wa = this.pa = T : this.Nk(T) : T.B() || (this.B() ? (this.pa = T.pa, this.wa = T.wa) : (this.pa > T.pa && (this.pa = T.pa), this.wa < T.wa && (this.wa = T.wa), this.pa > this.wa && this.Pa())); + }, H.prototype.Nk = function(T) { + T < this.pa ? this.pa = T : T > this.wa && (this.wa = T); + }, H.prototype.contains = function(T) { + return typeof T == "number" ? T >= this.pa && T <= this.wa : T.pa >= this.pa && T.wa <= this.wa; + }, H.prototype.Fa = function(T) { + this.B() || T.B() ? this.Pa() : (this.pa < T.pa && (this.pa = T.pa), this.wa > T.wa && (this.wa = T.wa), this.pa > this.wa && this.Pa()); + }, H.prototype.X = function(T) { + this.B() || (this.pa -= T, this.wa += T, this.wa < this.pa && this.Pa()); + }, H.prototype.zr = function() { + return this.B() ? 2220446049250313e-29 : 2220446049250313e-29 * (Math.abs(this.pa) + Math.abs(this.wa) + 1); + }, H.prototype.FB = function(T, b) { + T > b ? (this.pa = b, this.wa = T) : (this.pa = T, this.wa = b); + }, H.prototype.Kt = function(T) { + return A.P.Tk(T, this.pa, this.wa); + }, H.prototype.S = function() { + return this.wa - this.pa; + }, H.prototype.tf = function() { + return 0.5 * (this.pa + this.wa); + }, H.prototype.Nb = function(T) { + return T == this || T instanceof H && (!(!this.B() || !T.B()) || this.pa == T.pa && this.wa == T.wa); + }, H.prototype.dc = function() { + return A.P.wj(A.P.wj()); + }, H; + }(); + A.Oc = ve; + }(le || (le = {})), function(A) { + var ve = new A.Oc(), H = new A.Oc(), T = function() { + this.oe = null, this.pb = -1, this.tb = new A.zb(), this.lA = 55555555, this.Vv = this.Xv = !1, this.Wf = new A.Oc(), this.Wf.FB(0, 0); + }; + A.EY = T; + var b = function() { + function m(_, C, D) { + this.g = _, this.Jk = NaN, this.IH = this.Mq = 0, this.JH = NaN, this.ra = C, this.Pq = 10 * C, this.KH = this.LH = NaN, this.sg = !1, this.Fm = this.ht = this.No = this.Zs = this.Ys = -1, this.bA = D, this.OA = new T(), this.TH = new T(), A.P.truncate(3 * _.gd / 2); + } + return m.prototype.hG = function(_, C, D, L) { + _.oe = L === null ? null : L[D[5 * C]], _.Vv = _.oe != null, _.Vv || ((L = D[5 * C + 2]) !== -1 && this.g.hW(D[5 * C], D[5 * L], _.tb), _.oe = _.tb, _.Wf.FB(_.tb.ta, _.tb.qa), _.Wf.wa += this.ra, _.tb.mI(), _.Xv = _.tb.ma == _.tb.oa, _.Xv || (_.lA = (_.tb.qa - _.tb.ta) / (_.tb.ma - _.tb.oa))); + }, m.prototype.JO = function(_, C) { + var D = _.Br(C, this.ra, !0); + return D != 0 ? D == 2 ? this.Ly() : this.zi() : (_.$p(Ae), _.Vr(it), C.$p(yt), C.Vr(He), pe.na(this.Mq, this.Jk), Ae.rb(yt) && this.Jk == Ae.y ? 0 > it.compare(He) ? pe.N(it) : pe.N(He) : Ae.rb(He) && this.Jk == Ae.y ? 0 > it.compare(yt) ? pe.N(it) : pe.N(yt) : yt.rb(it) && this.Jk == yt.y ? 0 > Ae.compare(He) ? pe.N(Ae) : pe.N(He) : it.rb(He) && this.Jk == it.y && (0 > Ae.compare(yt) ? pe.N(Ae) : pe.N(yt)), _.Me(pe.y, pe.x) < C.Me(pe.y, pe.x) ? -1 : 1); + }, m.prototype.HO = function(_, C) { + if (_.tb.oa == C.tb.oa && _.tb.ta == C.tb.ta) + return _.tb.ma == C.tb.ma && _.tb.qa == C.tb.qa ? this.bA ? this.Ly() : 0 : this.KE(_, C); + if (_.tb.ma == C.tb.ma && _.tb.qa == C.tb.qa) + return this.JE(_, C); + var D = this.JE(_, C); + return _ = this.KE(_, C), 0 > D && 0 > _ ? -1 : 0 < D && 0 < _ ? 1 : this.zi(); + }, m.prototype.DO = function(_, C) { + if (_.qa > C.qa) { + if (C.qa > C.ta && C.ma - C.oa < 2 * this.ra && _.xi(C.qa, C.ma, this.ra)) + return this.zi(); + } else if ((C.ma - C.oa) / (C.qa - C.ta) * (_.qa - _.ta) < this.Pq && C.xi(_.qa, _.ma, this.ra)) + return this.zi(); + return 1; + }, m.prototype.EO = function(_, C) { + if (_.ta < C.ta) { + if (C.qa > C.ta && C.ma - C.oa < 2 * this.ra && _.xi(C.qa, C.ma, this.ra)) + return this.zi(); + } else if ((C.ma - C.oa) / (C.qa - C.ta) * (_.ta - _.qa) < this.Pq && C.xi(_.ta, _.oa, this.ra)) + return this.zi(); + return -1; + }, m.prototype.FO = function(_, C) { + var D = new A.h(); + D.vc(C.xc(), C.bc()), D.cr(), D.normalize(); + var L = new A.h(); + L.vc(_.bc(), C.bc()); + var B = new A.h(); + B.vc(_.xc(), C.bc()), L = L.Sh(D), D = B.Sh(D), B = Math.abs(L); + var q = Math.abs(D); + if (B < q) { + if (B < this.Pq && C.xi(_.ta, _.oa, this.ra)) + return this.zi(); + } else if (q < this.Pq && C.xi(_.qa, _.ma, this.ra)) + return this.zi(); + return 0 > L && 0 > D ? -1 : 0 < L && 0 < D ? 1 : this.zi(); + }, m.prototype.IE = function(_, C) { + return _.oa == C.oa && _.ta == C.ta ? this.DO(_, C) : _.ma == C.ma && _.qa == C.qa ? this.EO(_, C) : this.FO(_, C); + }, m.prototype.GO = function(_, C) { + return _.ma == C.ma && _.qa == C.qa && _.oa == C.oa && _.ta == C.ta ? this.bA ? this.Ly() : 0 : this.zi(); + }, m.prototype.JE = function(_, C) { + var D = 1; + if (_.tb.oa < C.tb.oa) { + D = -1; + var L = _; + _ = C, C = L; + } + _ = _.tb, L = C.tb; + var B = _.ta - L.ta; + C = C.lA * (_.oa - L.oa); + var q = this.Pq; + return B < C - q ? -D : B > C + q ? D : L.xi(_.ta, _.oa, this.ra) ? this.zi() : B < C ? -D : D; + }, m.prototype.KE = function(_, C) { + var D = 1; + if (C.tb.ma < _.tb.ma) { + D = -1; + var L = _; + _ = C, C = L; + } + _ = _.tb, L = C.tb; + var B = _.qa - L.ta; + C = C.lA * (_.ma - L.oa); + var q = this.Pq; + return B < C - q ? -D : B > C + q ? D : L.xi(_.qa, _.ma, this.ra) ? this.zi() : B < C ? -D : D; + }, m.prototype.Ly = function() { + return this.sg = !0, this.Pi = new A.Nd(5, this.No, this.ht), -1; + }, m.prototype.zi = function() { + return this.sg = !0, this.bA ? this.Pi = new A.Nd(4, this.No, this.ht) : this.ht = this.No = this.Zs = this.Ys = -1, -1; + }, m.prototype.IO = function(_, C, D, L) { + if (this.sg) + return -1; + var B = this.JH == this.Jk && this.IH == this.Mq; + if (B && _ == this.Ys) + var q = this.KH; + else + q = NaN, this.Ys = -1; + return B && C == this.Zs ? B = this.LH : (B = NaN, this.Zs = -1), D.oe.UI(ve), L.oe.UI(H), ve.wa < H.pa ? -1 : H.wa < ve.pa ? 1 : (this.JH = this.Jk, this.IH = this.Mq, isNaN(q) && (this.Ys = _, this.KH = q = _ = D.oe.Me(this.Jk, this.Mq)), isNaN(B) && (this.Zs = C, this.LH = B = _ = L.oe.Me(this.Jk, this.Mq)), Math.abs(q - B) <= this.ra ? this.JO(D.oe, L.oe) : q < B ? -1 : q > B ? 1 : 0); + }, m.prototype.Mr = function() { + this.sg = !1; + }, m.prototype.tm = function() { + return this.Pi; + }, m.prototype.VJ = function(_, C) { + this.Jk = _, this.Mq = C, this.ht = this.No = this.Zs = this.Ys = -1; + }, m.prototype.compare = function(_, C, D) { + return this.sg ? -1 : (_ = _.ka(D), this.Fm = D, this.ME(C, C, _, _)); + }, m.prototype.ME = function(_, C, D, L) { + if (this.No == C) + var B = this.OA; + else + this.No = C, B = this.OA, this.OA.pb = _, this.hG(B, C, this.g.ud.o, this.g.Te); + if (q == null) { + this.ht = L; + var q = this.TH; + this.TH.pb = D, this.hG(q, L, this.g.ud.o, this.g.Te); + } + return B.Vv || q.Vv ? this.IO(C, L, B, q) : B.Wf.wa < q.Wf.pa ? -1 : q.Wf.wa < B.Wf.pa ? 1 : (_ = B.Xv ? 1 : 0, (_ |= q.Xv ? 2 : 0) == 0 ? this.HO(B, q) : _ == 1 ? this.IE(B.tb, q.tb) : _ == 2 ? -1 * this.IE(q.tb, B.tb) : this.GO(B.tb, q.tb)); + }, m; + }(); + A.PC = b; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b) { + this.g = T, this.ra = b, this.sg = !1, this.No = -1, this.Wf = new A.Oc(), this.Iq = new A.h(), this.Iq.Sc(), this.je = new A.zb(), this.Fm = -1, this.wA = 17976931348623157e292; + } + return H.prototype.Mr = function() { + this.sg = !1, this.wA = 17976931348623157e292; + }, H.prototype.Fh = function(T) { + this.Iq.N(T); + }, H.prototype.compare = function(T, b) { + return this.NE(b, T.ka(b)); + }, H.prototype.NE = function(T, b) { + var m = this.g.cc(b) != null; + if (m || (this.g.fd(b, this.je), this.Wf.FB(this.je.ta, this.je.qa)), m) + throw A.i.ga("not implemented"); + if (this.Iq.x + this.ra < this.Wf.pa) + return -1; + if (this.Iq.x - this.ra > this.Wf.wa) + return 1; + if (this.je.oa == this.je.ma) + return this.Fm = T, this.sg = !0, 0; + this.je.mI(), m = this.je.bc(), (b = new A.h()).vc(this.je.xc(), m), b.cr(); + var _ = new A.h(); + return _.vc(this.Iq, m), m = b.Sh(_), (m /= b.length()) < 10 * -this.ra ? -1 : m > 10 * this.ra ? 1 : this.je.ss(this.Iq, this.ra) && ((b = Math.abs(m)) < this.wA && (this.Fm = T, this.wA = b), this.sg = !0, b < 0.25 * this.ra) ? 0 : 0 > m ? -1 : 1; + }, H; + }(); + A.WL = ve; + }(le || (le = {})), function(A) { + function ve(T, b, m, _) { + m = new Float64Array(T.subarray(m, _)), T.set(m, b); + } + var H = function() { + function T(b) { + this.Pb = this.rk = !1, this.o = null; + var m = b; + 2 > m && (m = 2), this.o = new Float64Array(m), this.size = b; + } + return T.prototype.rotate = function(b, m, _) { + if (this.Pb) + throw A.i.ga("invalid_call"); + if (m < b || m > _ || b > _) + throw A.i.O(); + b != m && _ != m && (this.pi(b, m - b, 1), this.pi(m, _ - m, 1), this.pi(b, _ - b, 1)); + }, T.rf = function(b, m) { + var _ = new T(b), C = _.o; + if (2 > b && (b = 2), m !== 0) + for (var D = 0; D < b; D++) + C[D] = m; + return _; + }, T.Dn = function(b) { + var m = new T(0); + return m.o = new Float64Array(b.o), m.size = b.size, m; + }, T.Nr = function(b, m) { + var _ = new T(0); + return _.size = b.size, _.size > m && (_.size = m), 2 > (m = _.size) && (m = 2), _.o = new Float64Array(m), _.o.set(b.o.length <= m ? b.o : b.o.subarray(0, m), 0), _; + }, T.prototype.Jb = function(b) { + 0 >= b || (this.o == null ? this.o = new Float64Array(b) : b <= this.o.length || (0 < this.o.length ? ((b = new Float64Array(b)).set(this.o), this.o = b) : this.o = new Float64Array(b))); + }, T.prototype.read = function(b) { + return this.o[b]; + }, T.prototype.uc = function(b, m) { + m.x = this.o[b], m.y = this.o[b + 1]; + }, T.prototype.get = function(b) { + return this.o[b]; + }, T.prototype.write = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.set = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.Vt = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.add = function(b) { + this.resize(this.size + 1), this.o[this.size - 1] = b; + }, T.prototype.BB = function(b) { + return T.Nr(this, b); + }, T.prototype.gg = function(b) { + return this.read(b); + }, T.prototype.resize = function(b, m) { + if (m === void 0 && (m = 0), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + if (b <= this.size) { + if (30 < this.o.length && 5 * b / 4 < this.o.length) { + var _ = new Float64Array(this.o, 0, b); + this.o = _; + } + } else { + b > this.o.length && (_ = A.P.truncate(64 > b ? Math.max(2 * b, 4) : 5 * b / 4), (_ = new Float64Array(_)).set(this.o), this.o = _), _ = this.o; + for (var C = this.size; C < b; C++) + _[C] = m; + } + this.size = b; + }, T.prototype.Dh = function(b) { + if ((this.o == null || b > this.o.length) && this.resize(b), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + this.size = b; + }, T.prototype.rr = function(b, m) { + this.write(b, m); + }, T.prototype.Cn = function(b, m, _) { + for (var C = this.size; m < C && m < _; m++) + b = A.P.wj(this.read(m)); + return b; + }, T.prototype.Nb = function(b, m, _) { + if (b == null || !(b instanceof T)) + return !1; + var C = this.size, D = b.size; + if (_ > C || _ > D && C != D) + return !1; + for (_ > C && (_ = C); m < _; m++) + if (this.read(m) != b.read(m)) + return !1; + return !0; + }, T.prototype.addRange = function(b, m, _, C, D) { + if (this.Pb) + throw A.i.Hb(); + if (!C && (1 > D || _ % D != 0)) + throw A.i.O(); + var L = this.size; + if (this.resize(L + _), C) + this.o.set(b.o.subarray(m, m + _), L); + else { + C = _; + for (var B = 0; B < _; B += D) { + C -= D; + for (var q = 0; q < D; q++) + this.o[L + B + q] = b.o[m + C + q]; + } + } + }, T.prototype.On = function(b, m, _, C, D, L, B) { + if (this.Pb) + throw A.i.Hb(); + if (!D && (1 > L || C % L != 0)) + throw A.i.O(); + var q = this.size - B; + if (q < C && this.resize(this.size + C - q), ve(this.o, b + C, b, b + (B - b)), this.o == m.o && b < _ && (_ += C), D) + this.o.set(m.o.subarray(_, _ + C), b); + else + for (D = C, B = 0; B < C; B += L) + for (D -= L, q = 0; q < L; q++) + this.o[b + B + q] = m.o[_ + D + q]; + }, T.prototype.Dz = function(b, m, _, C, D, L) { + if (this.Pb) + throw A.i.Hb(); + if (0 > L && (L = this.size), this.size + 2 * C > this.o.length ? this.resize(this.size + 2 * C) : this.size += 2 * C, ve(this.o, b + 2 * C, b, b + (L - b)), D) + for (D = 0; D < C; D++) + L = m[_++], this.o[b++] = L.x, this.o[b++] = L.y; + else { + D = 0; + for (var B = C - 1; D < C; ++D) + L = m[_ + B], this.o[b++] = L.x, this.o[b++] = L.y, B--; + } + }, T.prototype.Nn = function(b, m, _, C) { + if (this.Pb) + throw A.i.Hb(); + for (C -= b, ve(this.o, b + C, b, b + C), C = 0; C < _; C++) + this.o[b + C] = m; + }, T.prototype.xj = function(b, m, _) { + if (this.Pb) + throw A.i.Hb(); + ve(this.o, b + 2, b, b + (_ - b)), this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.Wt = function(b, m, _, C, D, L) { + if (0 > b || 0 > m || 0 > C || !D && (0 >= L || m % L != 0) || _.size < C + m) + throw A.i.O(); + if (m != 0) + if (this.size < m + b && this.resize(m + b), _ == this) + this.Cr(b, m, C, D, L); + else if (D) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C++; + else if (C = C + m - L, L == 1) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C--; + else + for (D = 0, m = A.P.truncate(m / L); D < m; D++) { + for (var B = 0; B < L; B++) + this.o[b + B] = _.o[C + B]; + b += L, C -= L; + } + }, T.prototype.Gn = function(b, m, _) { + if (this.Pb || b + m > this.size) + throw A.i.Hb(); + 0 < _ - (b + m) && ve(this.o, b, b + m, b + (_ - (b + m)) + m), this.size -= m; + }, T.prototype.pi = function(b, m, _) { + if (this.Pb || 1 > _ || m % _ != 0) + throw A.i.Hb(); + for (var C = m >> 1, D = 0; D < C; D += _) { + m -= _; + for (var L = 0; L < _; L++) { + var B = this.o[b + D + L]; + this.o[b + D + L] = this.o[b + m + L], this.o[b + m + L] = B; + } + } + }, T.prototype.Yj = function(b, m, _) { + if (0 > m || 0 > _ || 0 > m || _ + m > this.size) + throw A.i.O(); + for (var C = m; C < m + _; C++) + this.o[C] = b; + }, T.prototype.Cr = function(b, m, _, C, D) { + if (!(C && b == _ || (this.o.set(this.o.subarray(_, _ + m), b), C))) + for (_ = b, b = b + m - D, C = 0, m = A.P.truncate(m / 2); C < m; C++) { + for (var L = 0; L < D; L++) { + var B = this.o[_ + L]; + this.o[_ + L] = this.o[b + L], this.o[b + L] = B; + } + _ += D, b -= D; + } + }, T.prototype.qC = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C) + throw A.i.O(); + if (m != 0) + for (this.size < (m << 1) + b && this.resize((m << 1) + b), D || (b += m - 1 << 1), D = D ? 2 : -2, m += C; C < m; C++) + this.o[b] = _[C].x, this.o[b + 1] = _[C].y, b += D; + }, T.prototype.pC = function(b, m, _) { + if (0 > b || 0 > m) + throw A.i.O(); + if (m != 0) { + this.size < (m << 1) + b && this.resize((m << 1) + b), m += 0; + for (var C = 0; C < m; C++) + this.o[b] = _[C][0], this.o[b + 1] = _[C][1], b += 2; + } + }, T.prototype.Xw = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C || this.size < m + b) + throw A.i.O(); + if (D) + for (D = 0; D < m; D++) + _[C + D] = this.o[b + D]; + else + for (C = C + m - 1; b < m; b++) + _[C] = this.o[b], C--; + }, T.prototype.pB = function(b, m, _) { + if (0 > b || 0 > m || this.size < (m >> 1) + b) + throw A.i.O(); + if (m != 0) { + m = 0 + m; + for (var C = 0; C < m; C++) + _[C][0] = this.o[b], _[C][1] = this.o[b + 1], b += 2; + } + }, T.prototype.clear = function(b) { + b ? this.resize(0) : this.Dh(0); + }, T.prototype.ix = function() { + this.rk = this.Pb = !0; + }, T.prototype.Wd = function(b, m, _) { + Array.prototype.sort.call(this.o.subarray(b, m), _); + }, T.prototype.Vp = function() { + return 1; + }, T; + }(); + A.ce = H; + }(le || (le = {})), function(A) { + function ve(T, b, m, _) { + m = new Int32Array(T.subarray(m, _)), T.set(m, b); + } + A.nY = function() { + this.random = 1973; + }; + var H = function() { + function T(b) { + this.Pb = this.rk = !1, this.o = null; + var m = b; + 2 > m && (m = 2), this.o = new Int32Array(m), this.size = b; + } + return T.prototype.rotate = function(b, m, _) { + if (this.Pb) + throw A.i.ga("invalid_call"); + if (m < b || m > _ || b > _) + throw A.i.O(); + b != m && _ != m && (this.pi(b, m - b, 1), this.pi(m, _ - m, 1), this.pi(b, _ - b, 1)); + }, T.rf = function(b, m) { + var _ = new T(b), C = _.o; + if (2 > b && (b = 2), m !== 0) + for (var D = 0; D < b; D++) + C[D] = m; + return _; + }, T.Dn = function(b) { + var m = new T(0); + return m.o = new Int32Array(b.o), m.size = b.size, m; + }, T.Nr = function(b, m) { + var _ = new T(0); + return _.size = b.size, _.size > m && (_.size = m), 2 > (m = _.size) && (m = 2), _.o = new Int32Array(m), _.o.set(b.o.length <= m ? b.o : b.o.subarray(0, m), 0), _; + }, T.prototype.Jb = function(b) { + 0 >= b || (this.o == null ? this.o = new Int32Array(b) : b <= this.o.length || (0 < this.o.length ? ((b = new Int32Array(b)).set(this.o), this.o = b) : this.o = new Int32Array(b))); + }, T.prototype.read = function(b) { + return this.o[b]; + }, T.prototype.uc = function(b, m) { + m.x = this.o[b], m.y = this.o[b + 1]; + }, T.prototype.get = function(b) { + return this.o[b]; + }, T.prototype.write = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.set = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.Vt = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.add = function(b) { + this.resize(this.size + 1), this.o[this.size - 1] = b; + }, T.prototype.BB = function(b) { + return T.Nr(this, b); + }, T.prototype.gg = function(b) { + return this.read(b); + }, T.prototype.resize = function(b, m) { + if (m === void 0 && (m = 0), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + if (b <= this.size) { + if (30 < this.o.length && 5 * b / 4 < this.o.length) { + var _ = new Int32Array(this.o, 0, b); + this.o = _; + } + } else { + b > this.o.length && (_ = A.P.truncate(64 > b ? Math.max(2 * b, 4) : 5 * b / 4), (_ = new Int32Array(_)).set(this.o), this.o = _), _ = this.o; + for (var C = this.size; C < b; C++) + _[C] = m; + } + this.size = b; + }, T.prototype.Dh = function(b) { + if ((this.o == null || b > this.o.length) && this.resize(b), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + this.size = b; + }, T.prototype.rr = function(b, m) { + this.write(b, m); + }, T.prototype.Cn = function(b, m, _) { + for (var C = this.size; m < C && m < _; m++) + b = A.P.Vh(this.read(m), b); + return b; + }, T.prototype.Nb = function(b, m, _) { + if (b == null || !(b instanceof T)) + return !1; + var C = this.size, D = b.size; + if (_ > C || _ > D && C != D) + return !1; + for (_ > C && (_ = C); m < _; m++) + if (this.read(m) != b.read(m)) + return !1; + return !0; + }, T.prototype.addRange = function(b, m, _, C, D) { + if (this.Pb) + throw A.i.Hb(); + if (!C && (1 > D || _ % D != 0)) + throw A.i.O(); + var L = this.size; + if (this.resize(L + _), C) + this.o.set(b.o.subarray(m, m + _), L); + else { + C = _; + for (var B = 0; B < _; B += D) { + C -= D; + for (var q = 0; q < D; q++) + this.o[L + B + q] = b.o[m + C + q]; + } + } + }, T.prototype.On = function(b, m, _, C, D, L, B) { + if (this.Pb) + throw A.i.Hb(); + if (!D && (1 > L || C % L != 0)) + throw A.i.O(); + if (ve(this.o, b + C, b, b + (B - b)), this.o == m.o && b < _ && (_ += C), D) + this.o.set(m.o.subarray(_, _ + C), b); + else + for (D = C, B = 0; B < C; B += L) { + D -= L; + for (var q = 0; q < L; q++) + this.o[b + B + q] = m.o[_ + D + q]; + } + }, T.prototype.Dz = function(b, m, _, C, D, L) { + if (this.Pb) + throw A.i.Hb(); + if (0 > L && (L = this.size), this.size + 2 * C > this.o.length ? this.resize(this.size + 2 * C) : this.size += 2 * C, ve(this.o, b + 2 * C, b, b + (L - b)), D) + for (D = 0; D < C; D++) + L = m[_++], this.o[b++] = L.x, this.o[b++] = L.y; + else { + D = 0; + for (var B = C - 1; D < C; ++D) + L = m[_ + B], this.o[b++] = L.x, this.o[b++] = L.y, B--; + } + }, T.prototype.Nn = function(b, m, _, C) { + if (this.Pb) + throw A.i.Hb(); + for (C -= b, ve(this.o, b + C, b, b + C), C = 0; C < _; C++) + this.o[b + C] = m; + }, T.prototype.xj = function(b, m, _) { + if (this.Pb) + throw A.i.Hb(); + ve(this.o, b + 2, b, b + (_ - b)), this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.Wt = function(b, m, _, C, D, L) { + if (0 > b || 0 > m || 0 > C || !D && (0 >= L || m % L != 0) || _.size < C + m) + throw A.i.O(); + if (m != 0) + if (this.size < m + b && this.resize(m + b), _ == this) + this.Cr(b, m, C, D, L); + else if (D) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C++; + else if (C = C + m - L, L == 1) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C--; + else + for (D = 0, m = A.P.truncate(m / L); D < m; D++) { + for (var B = 0; B < L; B++) + this.o[b + B] = _.o[C + B]; + b += L, C -= L; + } + }, T.prototype.Gn = function(b, m, _) { + if (this.Pb || b + m > this.size) + throw A.i.Hb(); + 0 < _ - (b + m) && ve(this.o, b, b + m, b + (_ - (b + m)) + m), this.size -= m; + }, T.prototype.pi = function(b, m, _) { + if (this.Pb || 1 > _ || m % _ != 0) + throw A.i.Hb(); + for (var C = m >> 1, D = 0; D < C; D += _) { + m -= _; + for (var L = 0; L < _; L++) { + var B = this.o[b + D + L]; + this.o[b + D + L] = this.o[b + m + L], this.o[b + m + L] = B; + } + } + }, T.prototype.Yj = function(b, m, _) { + if (0 > m || 0 > _ || 0 > m || _ + m > this.size) + throw A.i.O(); + for (var C = m; C < m + _; C++) + this.o[C] = b; + }, T.prototype.Cr = function(b, m, _, C, D) { + if (!(C && b == _ || (this.o.set(this.o.subarray(_, _ + m), b), C))) + for (_ = b, b = b + m - D, C = 0, m = A.P.truncate(m / 2); C < m; C++) { + for (var L = 0; L < D; L++) { + var B = this.o[_ + L]; + this.o[_ + L] = this.o[b + L], this.o[b + L] = B; + } + _ += D, b -= D; + } + }, T.prototype.qC = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C) + throw A.i.O(); + if (m != 0) + for (this.size < (m << 1) + b && this.resize((m << 1) + b), D || (b += m - 1 << 1), D = D ? 2 : -2, m += C; C < m; C++) + this.o[b] = _[C].x, this.o[b + 1] = _[C].y, b += D; + }, T.prototype.Xw = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C || this.size < m + b) + throw A.i.O(); + if (D) + for (D = 0; D < m; D++) + _[C + D] = this.o[b + D]; + else + for (C = C + m - 1; b < m; b++) + _[C] = this.o[b], C--; + }, T.prototype.clear = function(b) { + b ? this.resize(0) : this.Dh(0); + }, T.prototype.ix = function() { + this.rk = this.Pb = !0; + }, T.prototype.Wd = function(b, m, _) { + 10 > m - b ? T.mG(this.o, b, m, _) : T.lB(this.o, b, m - 1, _); + }, T.prototype.Vp = function() { + return 2; + }, T.prototype.Gc = function() { + return this.o[this.size - 1]; + }, T.prototype.Jf = function() { + this.resize(this.size - 1); + }, T.prototype.XW = function(b) { + this.o[this.size - 1] = b; + }, T.prototype.NV = function(b) { + b < this.size - 1 && (this.o[b] = this.o[this.size - 1]), this.resize(this.size - 1); + }, T.prototype.gF = function(b) { + for (var m = 0, _ = this.size; m < _; m++) + if (this.o[m] == b) + return m; + return -1; + }, T.prototype.cG = function(b) { + return 0 <= this.gF(b); + }, T.mG = function(b, m, _, C) { + for (var D = m; D < _; D++) { + for (var L = b[D], B = D - 1; B >= m && 0 < C(b[B], L); ) + b[B + 1] = b[B], B--; + b[B + 1] = L; + } + }, T.sx = function(b, m, _) { + var C = b[_]; + b[_] = b[m], b[m] = C; + }, T.lB = function(b, m, _, C) { + if (!(m >= _)) + for (; ; ) { + if (9 > _ - m) { + T.mG(b, m, _ + 1, C); + break; + } + var D = b[m]; + T.sx(b, m, _); + for (var L = m, B = m; B < _; B++) + 0 >= C(b[B], D) && (T.sx(b, L, B), L += 1); + T.sx(b, L, _), L - m < _ - L ? (T.lB(b, m, L - 1, C), m = L + 1) : (T.lB(b, L + 1, _, C), _ = L - 1); + } + }, T; + }(); + A.ja = H; + }(le || (le = {})), function(A) { + function ve(T, b, m, _) { + m = new Int8Array(T.subarray(m, _)), T.set(m, b); + } + var H = function() { + function T(b) { + this.o = null; + var m = b; + 2 > m && (m = 2), this.o = new Int8Array(m), this.size = b; + } + return T.prototype.rotate = function(b, m, _) { + if (this.Pb) + throw A.i.ga("invalid_call"); + if (m < b || m > _ || b > _) + throw A.i.O(); + b != m && _ != m && (this.pi(b, m - b, 1), this.pi(m, _ - m, 1), this.pi(b, _ - b, 1)); + }, T.rf = function(b, m) { + var _ = new T(b), C = _.o; + if (2 > b && (b = 2), m !== 0) + for (var D = 0; D < b; D++) + C[D] = m; + return _; + }, T.Dn = function(b) { + var m = new T(0); + return m.o = new Int8Array(b.o), m.size = b.size, m; + }, T.Nr = function(b, m) { + var _ = new T(0); + return _.size = b.size, _.size > m && (_.size = m), 2 > (m = _.size) && (m = 2), _.o = new Int8Array(m), _.o.set(b.o.length <= m ? b.o : b.o.subarray(0, m), 0), _; + }, T.prototype.Jb = function(b) { + 0 >= b || (this.o == null ? this.o = new Int8Array(b) : b <= this.o.length || (0 < this.o.length ? ((b = new Int8Array(b)).set(this.o), this.o = b) : this.o = new Int8Array(b))); + }, T.prototype.read = function(b) { + return this.o[b]; + }, T.prototype.uc = function(b, m) { + m.x = this.o[b], m.y = this.o[b + 1]; + }, T.prototype.get = function(b) { + return this.o[b]; + }, T.prototype.write = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.set = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m; + }, T.prototype.Vt = function(b, m) { + if (this.Pb) + throw A.i.Hb(); + this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.add = function(b) { + this.resize(this.size + 1), this.o[this.size - 1] = b; + }, T.prototype.BB = function(b) { + return T.Nr(this, b); + }, T.prototype.gg = function(b) { + return this.read(b); + }, T.prototype.resize = function(b, m) { + if (m === void 0 && (m = 0), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + if (b <= this.size) { + if (30 < this.o.length && 5 * b / 4 < this.o.length) { + var _ = new Int8Array(this.o, 0, b); + this.o = _; + } + } else { + b > this.o.length && (_ = A.P.truncate(64 > b ? Math.max(2 * b, 4) : 5 * b / 4), (_ = new Int8Array(_)).set(this.o), this.o = _), _ = this.o; + for (var C = this.size; C < b; C++) + _[C] = m; + } + this.size = b; + }, T.prototype.Dh = function(b) { + if ((this.o == null || b > this.o.length) && this.resize(b), this.rk) + throw A.i.ga("invalid call. Attribute Stream is locked and cannot be resized."); + this.size = b; + }, T.prototype.rr = function(b, m) { + this.write(b, m); + }, T.prototype.Cn = function(b, m, _) { + for (var C = this.size; m < C && m < _; m++) + b = A.P.Vh(this.read(m), b); + return b; + }, T.prototype.Nb = function(b, m, _) { + if (b == null || !(b instanceof T)) + return !1; + var C = this.size, D = b.size; + if (_ > C || _ > D && C != D) + return !1; + for (_ > C && (_ = C); m < _; m++) + if (this.read(m) != b.read(m)) + return !1; + return !0; + }, T.prototype.addRange = function(b, m, _, C, D) { + if (this.Pb) + throw A.i.Hb(); + if (!C && (1 > D || _ % D != 0)) + throw A.i.O(); + var L = this.size; + if (this.resize(L + _), C) + this.o.set(b.o.subarray(m, m + _), L); + else { + C = _; + for (var B = 0; B < _; B += D) { + C -= D; + for (var q = 0; q < D; q++) + this.o[L + B + q] = b.o[m + C + q]; + } + } + }, T.prototype.On = function(b, m, _, C, D, L, B) { + if (this.Pb) + throw A.i.Hb(); + if (!D && (1 > L || C % L != 0)) + throw A.i.O(); + if (ve(this.o, b + C, b, b + (B - b)), this.o == m.o && b < _ && (_ += C), D) + this.o.set(m.o.subarray(_, _ + C), b); + else + for (D = C, B = 0; B < C; B += L) { + D -= L; + for (var q = 0; q < L; q++) + this.o[b + B + q] = m.o[_ + D + q]; + } + }, T.prototype.Nn = function(b, m, _, C) { + if (this.Pb) + throw A.i.Hb(); + for (C -= b, ve(this.o, b + C, b, b + C), C = 0; C < _; C++) + this.o[b + C] = m; + }, T.prototype.Dz = function(b, m, _, C, D, L) { + if (this.Pb) + throw A.i.Hb(); + if (0 > L && (L = this.size), this.size + 2 * C > this.o.length ? this.resize(this.size + 2 * C) : this.size += 2 * C, ve(this.o, b + 2 * C, b, b + (L - b)), D) + for (D = 0; D < C; D++) + L = m[_++], this.o[b++] = L.x, this.o[b++] = L.y; + else { + D = 0; + for (var B = C - 1; D < C; ++D) + L = m[_ + B], this.o[b++] = L.x, this.o[b++] = L.y, B--; + } + }, T.prototype.xj = function(b, m, _) { + if (this.Pb) + throw A.i.Hb(); + ve(this.o, b + 2, b, b + (_ - b)), this.o[b] = m.x, this.o[b + 1] = m.y; + }, T.prototype.Wt = function(b, m, _, C, D, L) { + if (0 > b || 0 > m || 0 > C || !D && (0 >= L || m % L != 0) || _.size < C + m) + throw A.i.O(); + if (m != 0) + if (this.size < m + b && this.resize(m + b), _ == this) + this.Cr(b, m, C, D, L); + else if (D) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C++; + else if (C = C + m - L, L == 1) + for (D = 0; D < m; D++) + this.o[b] = _.o[C], b++, C--; + else + for (D = 0, m = A.P.truncate(m / L); D < m; D++) { + for (var B = 0; B < L; B++) + this.o[b + B] = _.o[C + B]; + b += L, C -= L; + } + }, T.prototype.Gn = function(b, m, _) { + if (this.Pb || b + m > this.size) + throw A.i.Hb(); + 0 < _ - (b + m) && ve(this.o, b, b + m, b + (_ - (b + m)) + m), this.size -= m; + }, T.prototype.pi = function(b, m, _) { + if (this.Pb || 1 > _ || m % _ != 0) + throw A.i.Hb(); + for (var C = m >> 1, D = 0; D < C; D += _) { + m -= _; + for (var L = 0; L < _; L++) { + var B = this.o[b + D + L]; + this.o[b + D + L] = this.o[b + m + L], this.o[b + m + L] = B; + } + } + }, T.prototype.Yj = function(b, m, _) { + if (0 > m || 0 > _ || 0 > m || _ + m > this.size) + throw A.i.O(); + for (var C = m; C < m + _; C++) + this.o[C] = b; + }, T.prototype.Cr = function(b, m, _, C, D) { + if (!(C && b == _ || (this.o.set(this.o.subarray(_, _ + m), b), C))) + for (_ = b, b = b + m - D, C = 0, m = A.P.truncate(m / 2); C < m; C++) { + for (var L = 0; L < D; L++) { + var B = this.o[_ + L]; + this.o[_ + L] = this.o[b + L], this.o[b + L] = B; + } + _ += D, b -= D; + } + }, T.prototype.qC = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C) + throw A.i.O(); + if (m != 0) + for (this.size < (m << 1) + b && this.resize((m << 1) + b), D || (b += m - 1 << 1), D = D ? 2 : -2, m += C; C < m; C++) + this.o[b] = _[C].x, this.o[b + 1] = _[C].y, b += D; + }, T.prototype.Xw = function(b, m, _, C, D) { + if (0 > b || 0 > m || 0 > C || this.size < m + b) + throw A.i.O(); + if (D) + for (D = 0; D < m; D++) + _[C + D] = this.o[b + D]; + else + for (C = C + m - 1; b < m; b++) + _[C] = this.o[b], C--; + }, T.prototype.clear = function(b) { + b ? this.resize(0) : this.Dh(0); + }, T.prototype.ix = function() { + this.rk = this.Pb = !0; + }, T.prototype.Wd = function(b, m, _) { + m = this.o.subarray(b, m), Array.prototype.sort.call(m, _), this.o.set(m, b); + }, T.prototype.uJ = function(b, m) { + if (this.Pb) + throw A.i.ga("invalid call. Attribute Stream is read only."); + this.o[b] |= m; + }, T.prototype.FE = function(b, m) { + if (this.Pb) + throw A.i.ga("invalid call. Attribute Stream is read only."); + this.o[b] &= ~m; + }, T.prototype.Vp = function() { + return 1; + }, T; + }(); + A.rn = H; + }(le || (le = {})), function(A) { + A.Zc = function() { + function ve() { + } + return ve.Or = function(H, T) { + return A.rn.rf(H, T); + }, ve.Fn = function(H, T) { + return A.ce.rf(H, T); + }, ve.kP = function(H, T, b) { + switch (H) { + case 1: + H = A.ce.rf(T, b); + break; + case 2: + H = A.ja.rf(T, b); + break; + case 4: + H = A.rn.rf(T, b); + break; + default: + throw A.i.Ra(); + } + return H; + }, ve.TE = function(H, T) { + return ve.kP(A.sa.Vp(H), T * A.sa.Wa(H), A.sa.te(H)); + }, ve.Qh = function(H, T) { + return A.ja.rf(H, T); + }, ve.lI = function(H) { + var T, b = []; + for (T = 0; T < H; T++) + b.push(null); + return b; + }, ve; + }(); + }(le || (le = {})), function(A) { + A.ha = function(ve) { + ve === void 0 && (ve = 0), this.u = ve; + }; + }(le || (le = {})), function(A) { + A.IL = function() { + function ve() { + } + return ve.bind = function(H) { + A.Tc = H.PeDefs, A.qf = H.PeFactory, A.IC = H.PeVertcs, A.gj = H.PeCSTransformations, A.HC = H.PeGTTransformations, A.GL = H.PeGeogtran, A.FL = H.PeFactoryCodechange, A.GC = H.PeGCSExtent, A.Eg = H.PePCSInfo, A.HL = H.PeHorizon, A.EL = H.PeCoordsys, A.np = H.PeGTlistExtended, A.np.PE_GTLIST_OPTS_USE_DEFAULT = 128, A.qf.initialize(null), A.Lx = H.PeGTlistExtendedEntry, A.qf.fromString(A.Tc.PE_TYPE_UNIT, 'UNIT["Meter",1.0]'); + }, ve; + }(), A.qf = null, A.IC = null, A.EL = null, A.HL = null, A.Eg = null, A.np = null, A.Lx = null, A.GC = null, A.FL = null, A.GL = null, A.Tc = null, A.HC = null, A.gj = null; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.Mb = function(T, b) { + return 0 <= b ? H.R(T) : -H.R(T); + }, H.R = function(T) { + return 0 > T ? -T : T; + }, H.vi = function(T) { + return 3552713678800501e-30 > T; + }, H.FC = function(T, b, m) { + return H.R(T - b) <= m * (1 + (H.R(T) + H.R(b)) / 2); + }, H.$ = function(T, b) { + return H.FC(T, b, 3552713678800501e-30); + }, H.AL = function(T) { + return 3552713678800501e-30 >= H.R(T); + }, H.Dd = function(T) { + return H.AL(T); + }, H; + }(); + A.s = ve, A.F = function() { + function H() { + } + return H.ip = function(T, b) { + var m = 0; + return (T = ve.R(T)) + (b = ve.R(b)) != 0 && (T > b ? (m = b / T, m = T * Math.sqrt(1 + m * m)) : (m = T / b, m = b * Math.sqrt(1 + m * m))), m; + }, H.Yq = function(T, b, m, _, C) { + for (var D = [0, 0, 0], L = [0, 0, 0], B = 0; 2 >= B; B++) + b[B] -= T[B], m[B] -= b[B]; + m = D[1] * L[2] - D[2] * L[1], b = D[2] * L[0] - D[0] * L[2], D = D[0] * L[1] - D[1] * L[0], T = -1 * (m * T[0] + b * T[1] + D * T[2]), _[0] = m, _[1] = b, _[2] = D, _[3] = T, L = H.qn(_), _[0] /= L, _[1] /= L, _[2] /= L, _[3] /= L, C != 0 && (L = ve.Dd(D) ? ve.Dd(T) ? ve.Mb(1, b) : -ve.Mb(1, T) : ve.Mb(1, D), L *= ve.Mb(1, C), _[0] *= L, _[1] *= L, _[2] *= L, _[3] *= L); + }, H.yx = function(T, b, m) { + m[0] = T[1] * b[2] - b[1] * T[2], m[1] = T[2] * b[0] - b[2] * T[0], m[2] = T[0] * b[1] - b[0] * T[1]; + }, H.Ut = function(T, b) { + return T[0] * b[0] + T[1] * b[1] + T[2] * b[2]; + }, H.qn = function(T) { + return H.ip(H.ip(T[0], T[1]), T[2]); + }, H.el = function(T, b, m, _, C, D, L, B) { + T = H.n(T, b, m); + var q = Math.cos(m); + D.u = (T + C) * q * Math.cos(_), L.u = (T + C) * q * Math.sin(_), B.u = (T * (1 - b) + C) * Math.sin(m); + }, H.eO = function(T, b, m, _, C, D, L) { + var B = H.ip(b, m), q = 1 * Math.sqrt(1 - T), Z = q / 1; + if (ve.$(B, 0)) + D.u = 0, C.u = ve.Mb(1.570796326794897, _), L.u = ve.R(_) - q; + else { + D.u = Math.atan2(m, b), m = Math.atan2(1 * _, q * B), D = Math.cos(m); + var ie = Math.sin(m); + b = q * T / (1 - T), T *= 1, m = Math.atan2(_ + b * ie * ie * ie, B - T * D * D * D), 3.141592653589793 < ve.R(m) && (m = ve.Mb(3.141592653589793, m) - m), m = Math.atan(Z * Math.tan(m)), ie = Math.sin(m), D = Math.cos(m), C.u = Math.atan2(_ + b * ie * ie * ie, B - T * D * D * D), 1.570796326794897 < ve.R(C.u) && (C.u = ve.Mb(3.141592653589793, C.u) - C.u), m = Math.atan(Z * Math.tan(C.u)), ie = Math.sin(m), D = Math.cos(m), L.u = (_ - q * ie) * Math.sin(C.u) + (B - 1 * D) * Math.cos(C.u); + } + }, H.n = function(T, b, m) { + return m = Math.sin(m), T / Math.sqrt(1 - b * m * m); + }, H.pt = function(T, b) { + return Math.atan2(Math.sin(b) * (1 - T), Math.cos(b)); + }, H.Sj = function(T, b) { + return Math.atan2(Math.sin(b), Math.cos(b) * (1 - T)); + }, H.Tq = function(T, b) { + if (ve.vi(T) || b == 0 || ve.$(ve.R(b), 1.570796326794897)) + return b; + if (0.006884661117170036 > T) { + var m = Math.sqrt(1 - T), _ = (1 - m) / (1 + m), C = _ * _, D = _ * C, L = _ * D, B = _ * L, q = _ * B, Z = _ * q, ie = 1.572916666666667 * D - 3.2578125 * B + 4.295068359375 * Z; + T = 2.142578125 * L - 6.071484375 * q, m = 3.129296875 * B - 11.249837239583334 * Z; + var se = 4.775276692708333 * q, de = 7.958636765252976 * Z, Ce = Math.cos(2 * b); + return b + Math.sin(2 * b) * (1.5 * _ - 0.84375 * D + 0.525390625 * B - 0.2688395182291667 * Z - ie + m - de + Ce * (2 * (1.3125 * C - 1.71875 * L + 1.650146484375 * q) - 4 * T + 6 * se + Ce * (4 * ie - 12 * m + 24 * de + Ce * (8 * T - 32 * se + Ce * (16 * m - 80 * de + Ce * (32 * se + 64 * Ce * de)))))); + } + for (m = 1 - T, _ = T / 2, D = (C = ve.R(b)) * H.av(T) / (1.570796326794897 * m), L = 9999, q = C, C = 0; 1e-16 < L && 50 > C; C++) + Z = H.w(T, q), B = q - (ie = (B = (H.fG(q, T) - _ * Math.sin(2 * q) / Z) / m - D) / (Z = 1 / (Z * Z * Z))), L = ve.R(ie), q = B; + return 0 <= b ? q : -q; + }, H.lW = function(T, b) { + return ve.vi(b) ? T : T * H.av(b) / 1.570796326794897; + }, H.ca = function(T) { + return 0 > (T = H.kF(T, 6.283185307179586)) ? T + 6.283185307179586 : 3.141592653589793 > ve.R(T) || ve.$(ve.R(T), 3.141592653589793) ? T : T - 6.283185307179586; + }, H.kF = function(T, b) { + return T - Math.floor(T / b) * b; + }, H.Ch = function(T, b) { + if (0.006884661117170036 > b) { + var m = (b = (1 - (b = Math.sqrt(1 - b))) / (1 + b)) * b, _ = m * m; + return T / (1 + b) * (1 + 0.25 * m + 0.015625 * _ + 390625e-8 * m * _) * 1.570796326794897; + } + return T * H.av(b); + }, H.Xq = function(T, b) { + var m = ve.Mb(1, Math.sin(b)); + return b = 1.570796326794897 >= (b = ve.R(H.kF(b, 3.141592653589793))) ? b : 3.141592653589793 - b, (ve.$(b, 1.570796326794897) ? b : Math.atan(Math.sqrt(1 - T) * Math.tan(b))) * m; + }, H.q = function(T, b, m) { + if (0.006884661117170036 > b) { + var _ = (b = (1 - (b = Math.sqrt(1 - b))) / (1 + b)) * b, C = b * _, D = b * C, L = b * D, B = b * L, q = b * B, Z = -0.7291666666666666 * C + 0.2278645833333333 * L + 0.03987630208333334 * q, ie = 0.615234375 * D - 0.21533203125 * B, se = -0.54140625 * L + 0.20302734375 * q, de = 0.48876953125 * B, Ce = -0.4488699776785715 * q, Ve = Math.cos(2 * m); + return T / (1 + b) * ((1 + 0.25 * _ + 0.015625 * D + 390625e-8 * B) * m + Math.sin(2 * m) * (-1.5 * b + 0.1875 * C + 0.0234375 * L + 0.00732421875 * q - Z + se - Ce + Ve * (2 * (0.9375 * _ - 0.234375 * D - 0.03662109375 * B) - 4 * ie + 6 * de + Ve * (4 * Z - 12 * se + 24 * Ce + Ve * (8 * ie - 32 * de + Ve * (16 * se - 80 * Ce + Ve * (32 * de + 64 * Ve * Ce))))))); + } + return T * (H.fG(m, b) - 0.5 * b * Math.sin(2 * m) / H.w(b, m)); + }, H.w = function(T, b) { + return b = Math.sin(b), Math.sqrt(1 - T * b * b); + }, H.av = function(T) { + return ve.FC(T, 1, 2220446049250313e-31) ? 1 : 1 > T ? H.Zw(0, 1 - T) - T / 3 * H.Ww(0, 1 - T) : NaN; + }, H.fG = function(T, b) { + var m = ve.Mb(1, T); + T = ve.R(T); + var _ = Math.floor(T / 1.570796326794897); + if (1 < b) + b = T == 0 ? 0 : NaN; + else if (ve.Dd(_)) + b = (T = H.sin(T)) * H.Zw(1 - T * T, 1 - b * T * T) - b / 3 * T * T * T * H.Ww(1 - T * T, 1 - b * T * T); + else { + var C = A.P.truncate(_ % 2), D = H.av(b); + 0 < C ? b = D * (_ + 1) - (b = (T = Math.sin(1.570796326794897 * (_ + 1) - T)) * H.Zw(1 - T * T, 1 - b * T * T) - b / 3 * T * T * T * H.Ww(1 - T * T, 1 - b * T * T)) : b = D * _ + (b = (T = Math.sin(T - 1.570796326794897 * _)) * H.Zw(1 - T * T, 1 - b * T * T) - b / 3 * T * T * T * H.Ww(1 - T * T, 1 - b * T * T)); + } + return b * m; + }, H.sin = function(T) { + T = H.ca(T); + var b = ve.Mb(1, T); + return T = ve.R(T), ve.$(T, 3.141592653589793) ? 0 : ve.$(T, 1.570796326794897) ? 1 * b : Math.sin(T) * b; + }, H.Ww = function(T, b) { + var m, _, C, D, L = T, B = b, q = 1; + for (b = 0, T = 1; _ = ((m = 0.2 * (L + B + 3 * q)) - L) / m, C = (m - B) / m, D = (m - q) / m, !(1e-4 > ve.R(_) && 1e-4 > ve.R(C) && 1e-4 > ve.R(D)); ) + D = Math.sqrt(B), b += T / ((m = Math.sqrt(q)) * (q + (D = Math.sqrt(L) * (D + m) + D * m))), T *= 0.25, L = 0.25 * (L + D), B = 0.25 * (B + D), q = 0.25 * (q + D); + return B = (L = _ * C) - (q = D * D), 3 * b + T * (1 + (q = L - 6 * q) * (0.10227272727272728 * q - 0.2142857142857143 - 0.1730769230769231 * D * (_ = q + B + B)) + D * (0.1666666666666667 * _ + D * (-0.4090909090909091 * B + 0.1153846153846154 * D * L))) / (m * Math.sqrt(m)); + }, H.Zw = function(T, b) { + for (var m, _, C, D, L = 1; _ = 2 - ((m = (T + b + L) / 3) + T) / m, C = 2 - (m + b) / m, D = 2 - (m + L) / m, !(1e-4 > ve.R(_) && 1e-4 > ve.R(C) && 1e-4 > ve.R(D)); L = 0.25 * (L + m)) + m = Math.sqrt(b), _ = Math.sqrt(L), T = 0.25 * (T + (m = Math.sqrt(T) * (m + _) + m * _)), b = 0.25 * (b + m); + return (1 + (0.04166666666666666 * (T = _ * C - D * D) - 0.1 - 0.06818181818181818 * (b = _ * C * D)) * T + 0.07142857142857142 * b) / Math.sqrt(m); + }, H.Sw = function(T, b) { + if (ve.vi(T) || b == 0 || ve.$(ve.R(b), 1.570796326794897)) + return b; + if (0.006884661117170036 > T) { + var m = T * T, _ = T * m, C = T * _, D = T * C, L = T * D, B = T * L, q = -(0.02708333333333333 * _ + 0.03430059523809524 * C + 0.03149181547619048 * D + 0.02634359154541446 * L + 0.02156896735835538 * B), Z = 0.007669890873015873 * C + 0.01299603174603175 * D + 0.0148051353064374 * L + 0.01454454953803912 * B, ie = -(0.002275545634920635 * D + 0.004830845032667949 * L + 0.006558395368616723 * B), se = 6957236677288761e-19 * L + 0.001775193002406544 * B, de = -217324089394402e-18 * B, Ce = Math.cos(2 * b); + return b + Math.sin(2 * b) * (-(0.5 * T + 0.2083333333333333 * m + 0.09375 * _ + 0.04878472222222222 * C + 0.02916666666666667 * D + 0.01938905423280423 * L + 0.01388255931712963 * B) - q + ie - de + Ce * (2 * (0.1041666666666667 * m + 0.0875 * _ + 0.06050347222222222 * C + 0.04151785714285714 * D + 0.02958958540013228 * L + 0.02203667534722222 * B) - 4 * Z + 6 * se + Ce * (4 * q - 12 * ie + 24 * de + Ce * (8 * Z - 32 * se + Ce * (16 * ie - 80 * de + Ce * (32 * se + 64 * Ce * de)))))); + } + return b == 0 || ve.$(ve.R(b), 1.570796326794897) ? m = b : (C = (_ = Math.sqrt(T)) * Math.sin(b), m = Math.tan(0.7853981633974483 + b / 2) * Math.pow((1 - C) / (1 + C), _ / 2), m = 2 * Math.atan(m) - 1.570796326794897), m; + }, H.tO = function(T, b) { + if (ve.vi(T) || b == 0 || ve.$(ve.R(b), 1.570796326794897)) + return b; + if (0.006884661117170036 > T) { + var m = T * (se = T * (ie = T * (Ce = T * T))), _ = T * (de = T * m), C = 0.05833333333333333 * ie + 0.07232142857142858 * se + 0.05634300595238095 * m + 0.0355325796406526 * de + 0.020235546186067 * _, D = 0.02653149801587302 * se + 0.04379960317460317 * m + 0.0429211791776896 * de + 0.03255384637546096 * _, L = 0.01294022817460318 * m + 0.02668104344536636 * de + 0.03155651254609588 * _, B = 0.00659454790965208 * de + 0.0163075268674227 * _, q = 0.003463473736911237 * _, Z = Math.cos(2 * b); + return b + Math.sin(2 * b) * (0.5 * T + 0.2083333333333333 * Ce + 0.08333333333333333 * ie + 0.03611111111111111 * se + 0.01875 * m + 0.01195601851851852 * de + 0.008863673941798942 * _ - C + L - q + Z * (2 * (0.1458333333333333 * Ce + 0.1208333333333333 * ie + 0.07039930555555556 * se + 0.03616071428571429 * m + 0.01839451058201058 * de + 0.01017113095238095 * _) - 4 * D + 6 * B + Z * (4 * C - 12 * L + 24 * q + Z * (8 * D - 32 * B + Z * (16 * L - 80 * q + Z * (32 * B + 64 * Z * q)))))); + } + var ie = Math.sqrt(T), se = ie / 2, de = Math.tan(0.7853981633974483 + b / 2); + T = 0, C = 1; + for (var Ce = b; C != 0; Ce = _) + m = ie * Math.sin(Ce), _ = de * Math.pow((1 + m) / (1 - m), se), _ = 2 * Math.atan(_) - 1.570796326794897, T++, (ve.$(_, Ce) || 3e4 < T) && (C = 0); + return Ce; + }, H; + }(); + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.wl = this.Ws = null, this.Kv = !1, this.BA = this.CA = 0, this.CH = new A.h(), this.SH = new A.h(), this.FA = !1, this.xq = new A.l(), this.rH = this.uw = 0, this.vw = null, this.Bl = !1, this.Go = null, this.Xz = 0, this.Re = T, this.Cs = A.Ab.zv(this.Re, 0, !0), this.CH.Sc(), this.SH.Sc(), this.MH = NaN; + var b = T.getCode(); + 0 < b ? (this.Mk = b, A.qf.getCode(T)) : this.Mk = A.qf.getCode(T), 0 > this.Mk && (this.Mk = 0); + var m = this.Re.getType(); + if (this.eH = m == A.Tc.PE_TYPE_PROJCS ? 2 : 1, m == A.Tc.PE_TYPE_PROJCS && !T.loadConstants()) + throw A.i.O("PeProjcs.loadConstants failed"); + b = m == A.Tc.PE_TYPE_GEOGCS ? this.Re : this.Re.getGeogcs(), m != A.Tc.PE_TYPE_GEOGCS && A.qf.getCode(b), this.Go = T.getUnit(), this.MH = b.getPrimem().getLongitude(), this.rH = T = b.getUnit().getUnitFactor(), T = Math.PI / (180 * T), 1e-10 > Math.abs(T - 1) && (T = 1), this.BA = T, m & A.Tc.PE_TYPE_PROJCS ? (b = this.Re, this.CA = 1 / b.getUnit().getUnitFactor(), this.uw = 1e-3 / this.Re.getUnit().getUnitFactor(), this.vw = A.Eg.generate(b, A.Eg.PE_PCSINFO_OPTION_NONE), this.Bl = this.vw.isPannableRectangle(), this.Xz = A.Ab.lN(this.vw.getCentralMeridian(), this.BA)) : (this.FA = this.Bl = !0, this.CA = 0, m = 1 / b.getUnit().getUnitFactor(), this.uw = 1e-3 / b.getDatum().getSpheroid().getAxis() * m, this.Xz = 0), this.Bl && (this.wx(), this.yK(), this.jY(), this.xK(), this.hY(), this.iY()); + } + return H.prototype.cs = function() { + return this.Mk; + }, H.prototype.mk = function() { + return this.vw; + }, H.Ky = function(T, b) { + return T == b || T != null && b != null && T.Mk == 0 && b.Mk == 0 && T.Cs === b.Cs; + }, H.prototype.Xc = function() { + return this.Bl; + }, H.prototype.ih = function(T) { + T.L(this.uo); + }, H.prototype.rv = function() { + return this.uo.v; + }, H.prototype.qv = function() { + return this.uo.C; + }, H.prototype.BR = function(T) { + T.L(this.ww); + }, H.prototype.hY = function() { + var T = this.Re.getType(); + if (T == A.Tc.PE_TYPE_PROJCS) { + T = this.Re; + var b = this.mk().getCentralMeridian(), m = T.getGeogcs(); + if (m == null) + throw A.i.ga("internal error"); + b = [[b + (m = 1 / m.getUnit().getUnitFactor() * Math.PI), 0]], A.gj.geogToProj(T, 1, b), b = b[0][0], m = T.getParameters()[A.Tc.PE_PARM_X0].getValue(); + var _ = this.ol(); + T = new A.l(), _.A(T), b = (_ = Math.abs(b - m)) + m, m = -1 * _ + m, _ = T.H, T = T.G; + var C = new A.l(); + C.L(m, T, b, _), this.uo == null && (this.uo = C); + } else { + if (T != A.Tc.PE_TYPE_GEOGCS) + throw A.i.ga("internal error"); + m = 1 / this.Re.getUnit().getUnitFactor() * Math.PI, (T = new A.l()).L(-m, -m / 2, m, m / 2), this.uo == null && (this.uo = T); + } + }, H.prototype.iY = function() { + var T = this.Re.getType(); + if (T == A.Tc.PE_TYPE_PROJCS) { + var b = this.Re; + if (T = this.mk().getCentralMeridian(), (b = b.getGeogcs()) == null) + throw A.i.ga("internal error"); + b = 1 / b.getUnit().getUnitFactor() * Math.PI; + var m = this.Xr(), _ = new A.l(); + m.A(_), (m = new A.l()).L(T - b, _.G, T + b, _.H), this.ww == null && (this.ww = m); + } else { + if (T != A.Tc.PE_TYPE_GEOGCS) + throw A.i.ga("internal error"); + b = 1 / this.Re.getUnit().getUnitFactor() * Math.PI, (T = new A.l()).L(-b, -b / 2, b, b / 2), this.ww == null && (this.ww = T); + } + }, H.prototype.bf = function() { + return this.BA; + }, H.prototype.rm = function() { + return this.CA; + }, H.prototype.Xr = function() { + if (this.Bl) + return this.wl; + var T = this.wl; + return T ?? (this.wx(), this.wl); + }, H.prototype.Yr = function() { + return this.Bl ? null : (this.wl != null || this.wx(), this.TG); + }, H.prototype.wx = function() { + if (this.Re.getType() == A.Tc.PE_TYPE_PROJCS) { + var T = this.Re, b = T.getGeogcs(), m = T.horizonGcsGenerate(); + if (m != null) { + var _ = m[0].getNump(), C = m[0].getKind(); + T = 0 < m[0].getInclusive(); + var D = this.bf(), L = 90 * D, B = 360 * D, q = 370 * D, Z = 180 * D * A.Tc.PE_HORIZON_DELTA / Math.PI, ie = new A.l(), se = null; + if (1 < _) { + for (var de = 1; de < _; de++) + if (m[de].getKind() == A.Tc.PE_HORIZON_LINE) { + se == null && (se = new A.Ua()); + var Ce = m[de].getCoord(); + se.rx(Ce[0][0], Ce[0][1]), se.Aj(Ce[1][0], Ce[1][1]); + } + } + if (C == A.Tc.PE_HORIZON_RECT) + m = m[0].getCoord(), ie.L(m[0][0], m[0][1]), ie.$b(m[1][0], m[1][1]), Math.abs(ie.H - L) < 1e-7 * Z && (ie.H = L), Math.abs(ie.G + L) < 1e-7 * Z && (ie.G = -L), ie.S() > q && (m = -400 * D, ie.L(m, ie.G, m + 5 * B, ie.H)), m = new A.Hh(ie), this.wl == null && (this.wl = m, this.Kv = T); + else { + if (q = new A.Ea(), B = this.mk().isGcsHorizonMultiOverlap(), ie = A.iu.XE(b, A.ju.Integer64), B) { + for (q = new A.bL(), Z = A.Ih.local().W(q, ie, null), de = 0; de < _; de++) + if (m[de].getKind() == A.Tc.PE_HORIZON_POLY) { + for (b = m[de].getSize(), D = m[de].getCoord(), C = [], L = 0; L < b; L++) + C[L] = A.h.construct(D[L][0], D[L][1]); + m[de].getInclusive(), B && ((D = new A.Ea()).$k(C, b - 1), q.VX(D), Z.re()); + } + q = Z.next(); + } else + for (de = 0; de < _; de++) + if (m[de].getKind() == A.Tc.PE_HORIZON_POLY) { + for (b = m[de].getSize(), D = m[de].getCoord(), B = [], L = 0; L < b; L++) + B[L] = A.h.construct(D[L][0], D[L][1]); + m[de].getInclusive(), q.$k(B, b - 1); + } + T ? A.Zj.local().yn(q, ie, 1) : A.mp.local().yn(q, ie, 1), A.fj.local().yn(q, ie, 1), this.wl == null && (this.wl = q, this.Kv = T, this.TG = se); + } + } + } + }, H.prototype.kv = function() { + return this.Bl || this.wl == null && this.wx(), this.Kv; + }, H.prototype.yK = function() { + if (this.eH == 2) { + var T = this.Re.horizonPcsGenerate(); + if (T != null) { + var b = T[0].getKind(); + T[0].getInclusive(); + var m = T[0].getNump(), _ = !1; + if (b == A.Tc.PE_HORIZON_RECT) + T = T[0].getCoord(), (m = new A.l()).L(T[0][0], T[0][1]), m.$b(T[1][0], T[1][1]), T = new A.Hh(m); + else { + for (b = -1, _ = 0; _ < m; _++) + T[_].getKind() == A.Tc.PE_HORIZON_POLY && (b = _); + for (_ = T[b].getSize() - 1, T = T[b].getCoord(), m = [], b = 0; b < _; b++) + m[b] = A.h.construct(T[b][0], T[b][1]); + T = b = new A.Ea(), b.$k(m, _), _ = !0; + } + this.mk().isDensificationNeeded() && (m = 1e5 * this.rm(), T = A.Zl.local().W(T, m, null)), _ && (_ = new A.Hh(), T.dn(_), T.He(), T.Rb(), T.kR(), A.Zj.local().yn(T, null, 1)), this.Ws == null && (this.Ws = T); + } + } + }, H.prototype.ol = function() { + if (this.Bl) + return this.Ws; + var T = this.Ws; + return T ?? (this.yK(), this.Ws); + }, H.prototype.jY = function() { + if (this.Re.getType() == A.Tc.PE_TYPE_PROJCS) { + var T = 90 * this.bf(); + T = [[0, T], [0, -T]], A.gj.geogToProj(this.Re, 2, T); + var b = this.mk(), m = b.getNorthPoleLocation() != A.Eg.PE_POLE_OUTSIDE_BOUNDARY; + b = b.getSouthPoleLocation() != A.Eg.PE_POLE_OUTSIDE_BOUNDARY, this.FA || (m && this.CH.na(T[0][0], T[0][1]), b && this.SH.na(T[1][0], T[1][1])); + } + this.FA = !0; + }, H.prototype.xK = function() { + if (this.eH == 1) { + var T = 400 * this.bf(); + this.xq.L(-T, -T, T, T); + } else + T = A.Eg.generate(this.Re, A.Eg.PE_PCSINFO_OPTION_DOMAIN), T = A.l.construct(T.getDomainMinx(), T.getDomainMiny(), T.getDomainMaxx(), T.getDomainMaxy()), this.xq.B() && this.xq.L(T); + }, H.prototype.cR = function(T) { + this.Bl && T.L(this.xq), this.xq.B() && this.xK(), T.L(this.xq); + }, H.prototype.Wp = function() { + return this.MH; + }, H.prototype.Bi = function() { + return this.Xz; + }, H.prototype.Id = function() { + return this.Go; + }, H.prototype.Zr = function() { + return this.rH; + }, H; + }(); + A.JC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.FT = T, this.Cs = A.Ab.zv(T, 0, !0); + var b = T.getCode(); + this.us = 0 < b ? b : A.qf.getCode(T), 0 > this.us && (this.us = 0), this.Go = b = this.FT.getUnit(), this.DH = 1 / b.getUnitFactor(), A.qf.getCode(T); + } + return H.Ky = function(T, b) { + return T == b || T != null && b != null && T.us == 0 && b.us == 0 && T.Cs === b.Cs; + }, H.prototype.cs = function() { + return this.us; + }, H; + }(); + A.KL = ve; + }(le || (le = {})), function(A) { + A.$g = function() { + function ve() { + } + return ve.ub = function(H, T, b, m, _, C, D, L) { + if (C != null || D != null || L != null) { + m = A.F.ca(m), T = A.F.ca(T), b = A.F.ca(b), _ = A.F.ca(_), 1.570796326794897 < A.s.R(b) && (b = A.s.Mb(3.141592653589793, b) - b, T = A.F.ca(T + 3.141592653589793)), 1.570796326794897 < A.s.R(_) && (_ = A.s.Mb(3.141592653589793, _) - _, m = A.F.ca(m + 3.141592653589793)); + var B = A.F.ca(m - T); + if (A.s.$(b, _) && (A.s.$(T, m) || A.s.$(A.s.R(b), 1.570796326794897))) + C != null && (C.u = 0), D != null && (D.u = 0), L != null && (L.u = 0); + else { + if (A.s.$(b, -_)) { + if (A.s.$(A.s.R(b), 1.570796326794897)) + return C != null && (C.u = 3.141592653589793 * H), D != null && (D.u = 0 < b ? A.F.ca(3.141592653589793 - A.F.ca(m)) : A.F.ca(m)), void (L != null && (L.u = 0 < b ? A.F.ca(m) : A.F.ca(3.141592653589793 - A.F.ca(m)))); + if (A.s.$(A.s.R(B), 3.141592653589793)) + return C != null && (C.u = 3.141592653589793 * H), D != null && (D.u = 0), void (L != null && (L.u = 0)); + } + var q = A.s.R(b) == 1.570796326794897 ? 0 : Math.cos(b), Z = Math.sin(b), ie = A.s.R(_) == 1.570796326794897 ? 0 : Math.cos(_), se = Math.sin(_), de = A.s.R(B) == 1.570796326794897 ? 0 : Math.cos(B), Ce = A.s.R(B) == 3.141592653589793 ? 0 : Math.sin(B); + if (C != null) { + var Ve = Math.sin((_ - b) / 2); + B = Math.sin(B / 2), C.u = 2 * Math.asin(Math.sqrt(Ve * Ve + q * ie * B * B)) * H; + } + D != null && (D.u = A.s.$(A.s.R(b), 1.570796326794897) ? 0 > b ? m : A.F.ca(3.141592653589793 - m) : Math.atan2(ie * Ce, q * se - Z * ie * de)), L != null && (A.s.$(A.s.R(_), 1.570796326794897) ? L.u = 0 > _ ? T : A.F.ca(3.141592653589793 - T) : (L.u = Math.atan2(q * Ce, se * q * de - ie * Z), L.u = A.F.ca(L.u + 3.141592653589793))); + } + } + }, ve.sf = function(H, T, b, m, _, C, D) { + if (C != null || D != null) { + T = A.F.ca(T), b = A.F.ca(b), 1.570796326794897 < A.s.R(b) && (b = A.s.Mb(3.141592653589793, b) - b, T = A.F.ca(T + 3.141592653589793)), A.s.$(A.s.R(b), 1.570796326794897) && (T = 0), _ = A.F.ca(_); + var L = A.s.$(A.s.R(_), 1.570796326794897) ? 0 : Math.cos(_), B = A.s.$(A.s.R(_), 3.141592653589793) ? 0 : Math.sin(_), q = A.s.$(A.s.R(b), 1.570796326794897) ? 0 : Math.cos(b), Z = Math.sin(b); + H = m / H, m = A.s.$(A.s.R(H), 1.570796326794897) ? 0 : Math.cos(H); + var ie = A.s.$(A.s.R(H), 3.141592653589793) ? 0 : Math.sin(H), se = Math.asin(Z * m + q * ie * L); + D != null && (D.u = se), C != null && (C.u = A.s.$(A.s.R(se), 1.570796326794897) ? A.s.$(b, -se) ? 0 > se ? _ : A.F.ca(3.141592653589793 - _) : T : A.s.$(A.s.R(b), 1.570796326794897) && A.s.$(H, 3.141592653589793) ? 0 > b ? _ : A.F.ca(3.141592653589793 - _) : A.F.ca(T + Math.atan2(ie * B, q * m - Z * ie * L))); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + A.Yk = function() { + function ve() { + } + return ve.ub = function(H, T, b, m, _, C, D, L, B) { + var q = new A.ha(0), Z = new A.ha(0), ie = [0, 0, 0], se = [0, 0, 0], de = [0, 0, 0], Ce = new A.ha(0), Ve = new A.ha(0), Je = new A.ha(0), Pt = new A.ha(0), $t = new A.ha(0); + if (D != null || L != null || B != null) + if (A.s.vi(T)) + A.$g.ub(H, b, m, _, C, D, L, B); + else { + _ = A.F.ca(_), b = A.F.ca(b); + var qe = A.F.ca(_ - b); + if (A.s.$(m, C) && (A.s.$(b, _) || A.s.$(A.s.R(m), 1.570796326794897))) + D != null && (D.u = 0), L != null && (L.u = 0), B != null && (B.u = 0); + else { + if (A.s.$(m, -C)) { + if (A.s.$(A.s.R(m), 1.570796326794897)) + return D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0 < m ? A.F.ca(3.141592653589793 - A.F.ca(_)) : A.F.ca(_)), void (B != null && (B.u = 0 < m ? A.F.ca(_) : A.F.ca(3.141592653589793 - A.F.ca(_)))); + A.s.$(A.s.R(qe), 3.141592653589793) && (D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0), B != null && (B.u = 0)); + } else + (A.s.$(A.s.R(m), 1.570796326794897) || A.s.$(A.s.R(C), 1.570796326794897)) && (A.s.$(A.s.R(m), 1.570796326794897) ? b = _ : _ = b); + var Rt = 0; + if (0 > qe) { + Rt = 1; + var Zt = b; + b = _, _ = Zt, Zt = m, m = C, C = Zt; + } + qe = A.F.pt(T, m); + var Jt = A.F.pt(T, C); + L == null && B == null || (A.$g.ub(H, b, qe, _, Jt, null, q, Z), q = Math.atan2(Math.sin(q.u) * Math.cos(m - qe), Math.cos(q.u)), Z = Math.atan2(Math.sin(Z.u) * Math.cos(C - Jt), Math.cos(Z.u)), Rt != 0 && (Zt = q, q = Z, Z = Zt), L != null && (L.u = q), B != null && (B.u = Z)), D != null && (A.F.el(1, T, m, b, 0, Je, Pt, $t), ie[0] = Je.u, ie[1] = Pt.u, ie[2] = $t.u, A.F.el(1, T, C, _, 0, Je, Pt, $t), se[0] = Je.u, se[1] = Pt.u, se[2] = $t.u, de[0] = ie[1] * se[2] - se[1] * ie[2], de[1] = -(ie[0] * se[2] - se[0] * ie[2]), de[2] = ie[0] * se[1] - se[0] * ie[1], T = 1 - A.F.w(T, A.F.Xq(T, A.F.Sj(T, Math.acos(de[2] / Math.sqrt(de[0] * de[0] + de[1] * de[1] + de[2] * de[2]))))), T *= 2 - T, L = Math.atan2(-de[1], -de[0]), de = A.F.ca(L - 1.570796326794897), L = A.F.ca(L + 1.570796326794897), de = A.s.R(A.F.ca(b - de)) <= A.s.R(A.F.ca(b - L)) ? de : L, A.$g.ub(1, de, 0, b, qe, Ce, null, null), A.$g.ub(1, de, 0, _, Jt, Ve, null, null), 3.141592653589793 < Ce.u + Ve.u && (de = A.F.ca(de + 3.141592653589793), A.$g.ub(1, de, 0, b, qe, Ce, null, null), A.$g.ub(1, de, 0, _, Jt, Ve, null, null)), Ce.u *= A.s.Mb(1, m), Ve.u *= A.s.Mb(1, C), Ce.u = A.F.Sj(T, Ce.u), Ve.u = A.F.Sj(T, Ve.u), b = A.F.q(H, T, Ce.u), H = A.F.q(H, T, Ve.u), D.u = A.s.R(H - b)); + } + } + }, ve.sf = function(H, T, b, m, _, C, D, L) { + var B = 0, q = new A.ha(0), Z = new A.ha(0), ie = [0, 0, 0], se = [0, 0, 0], de = new A.ha(0), Ce = new A.ha(0), Ve = new A.ha(0); + if (D != null || L != null) + if (A.s.vi(T)) + A.$g.sf(H, b, m, _, C, D, L); + else if (A.s.Dd(_)) + D != null && (D.u = b), L != null && (L.u = m); + else if (C = A.F.ca(C), 0 > _ && (_ = A.s.R(_), C = A.F.ca(C + 3.141592653589793)), b = A.F.ca(b), m = A.F.ca(m), 1.570796326794897 < A.s.R(m) && (b = A.F.ca(b + 3.141592653589793), m = A.s.Mb(3.141592653589793, m) - m), A.s.$(A.s.R(m), 1.570796326794897) && (b = 0), A.s.Dd(m)) { + var Je = A.s.R(1.570796326794897 - A.s.R(C)); + Je = A.F.Sj(T, Je), Je = 1 - A.F.w(T, A.F.Xq(T, Je)), Je *= 2 - Je, H = _ / A.F.Ch(H, Je) * 1.570796326794897, H = A.F.Tq(Je, H), H = A.F.pt(Je, H), A.$g.sf(1, b, m, H, C, D, q), L != null && (B = q.u), L != null && (L.u = A.F.Sj(T, B)); + } else if (A.s.$(A.s.R(m), 1.570796326794897)) + q = 2 * (B = A.F.Ch(H, T)), C = 0 < (H = A.s.Mb(1.570796326794897, m)) ? A.F.ca(3.141592653589793 - C) : C, m = B - _, A.s.R(m) <= B ? D != null && (D.u = C) : (m = Math.floor(_ / q), A.P.truncate(m % 2) == 0 ? (D != null && (D.u = C), _ -= m * q) : (D != null && (D.u = A.F.ca(C + 3.141592653589793)), _ = (m + 1) * q - _), m = B - _), L != null && (L.u = A.F.Tq(T, m / B * H)); + else { + Je = A.F.pt(T, m), C = Math.atan2(Math.sin(C), Math.cos(C) * Math.cos(m - Je)); + var Pt = A.P.truncate(A.s.Mb(1, Je)) * (1.570796326794897 >= A.s.R(C) ? 1 : -1); + C = A.F.ca(b + Math.atan(Math.tan(C) * -Math.sin(Je))), A.$g.ub(H, C, 0, b, Je, null, Z, null), Je = A.s.R(1.570796326794897 - A.s.R(Z.u)), Je = A.F.Sj(T, Je), Je = 1 - A.F.w(T, A.F.Xq(T, Je)), Je *= 2 - Je, A.F.el(1, T, 0, C, 0, de, Ce, Ve), ie[0] = de.u, ie[1] = Ce.u, ie[2] = Ve.u, A.F.el(1, T, m, b, 0, de, Ce, Ve), se[0] = de.u, se[1] = Ce.u, se[2] = Ve.u, m = Math.acos((ie[0] * se[0] + ie[1] * se[1] + ie[2] * se[2]) / Math.sqrt(se[0] * se[0] + se[1] * se[1] + se[2] * se[2])), m = A.F.Sj(Je, m), _ = 0 < (m = A.F.q(H, Je, m) + _ * Pt) ? Z.u : A.F.ca(Z.u + 3.141592653589793), H = A.s.R(m) / A.F.Ch(H, Je) * 1.570796326794897, H = A.F.Tq(Je, H), H = A.F.pt(Je, H), A.$g.sf(1, C, 0, H, _, D, q), L != null && (B = q.u), L != null && (L.u = A.F.Sj(T, B)); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + A.eu = function() { + function ve() { + } + return ve.ub = function(H, T, b, m, _, C, D, L, B) { + var q = 0, Z = 0, ie = 0; + if (D != null || L != null || B != null) + if (A.s.vi(T)) + A.$g.ub(H, b, m, _, C, D, L, B); + else { + var se = A.F.ca(_ - b); + if (A.s.$(m, C) && (A.s.Dd(se) || A.s.$(A.s.R(m), 1.570796326794897))) + D != null && (D.u = 0), L != null && (L.u = 0), B != null && (B.u = 0); + else { + if (A.s.$(m, -C)) { + if (A.s.$(A.s.R(m), 1.570796326794897)) + return D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0 < m ? A.F.ca(3.141592653589793 - A.F.ca(_)) : A.F.ca(_)), void (B != null && (B.u = 0 < m ? A.F.ca(_) : A.F.ca(3.141592653589793 - A.F.ca(_)))); + A.s.$(A.s.R(se), 3.141592653589793) && (D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0), B != null && (B.u = 0)); + } else if (A.s.$(A.s.R(m), 1.570796326794897) || A.s.$(A.s.R(C), 1.570796326794897) || A.s.Dd(se) || A.s.$(A.s.R(se), 3.141592653589793)) + return void A.Yk.ub(H, T, b, m, _, C, D, L, B); + var de = 1 - Math.sqrt(1 - T), Ce = T / (1 - T), Ve = H * (1 - de); + H = A.F.Xq(T, m); + var Je = A.F.Xq(T, C); + T = A.s.R(H) == 1.570796326794897 ? 0 : Math.cos(H); + var Pt = Math.sin(H), $t = A.s.R(Je) == 1.570796326794897 ? 0 : Math.cos(Je), qe = Math.sin(Je), Rt = se, Zt = Math.cos(Rt), Jt = Math.sin(Rt), Xt = 1, Qt = 0; + do { + var bi = Rt, Mi = Math.sqrt(Math.pow($t * Jt, 2) + Math.pow(T * qe - Pt * $t * Zt, 2)), Ri = Pt * qe + T * $t * Zt, Yi = Math.atan2(Mi, Ri); + if (Mi == 0) { + Xt = 0; + break; + } + var rr = T * $t * Jt / Mi; + if (q = Math.cos(Math.asin(rr)), Z = Ri - 2 * Pt * qe / (q *= q), 1 < A.s.R(Z) && (Z = A.s.Mb(1, Z)), Rt = se + (1 - (Rt = de / 16 * q * (4 + de * (4 - 3 * q)))) * de * rr * (Yi + Rt * Mi * (Z + Rt * Ri * (2 * (ie = Z * Z) - 1))), Zt = Math.cos(Rt), Jt = Math.sin(Rt), Qt++, 3.141592653589793 < A.s.R(Rt) && 30 < Qt) { + Xt = 0; + break; + } + } while (5e3 >= Qt && !A.s.$(bi, Rt)); + if (Xt != 0) + de = (Ce *= q) * (256 + Ce * (Ce * (74 - 47 * Ce) - 128)) / 1024, D != null && (D.u = Ve * (1 + Ce * (4096 + Ce * (Ce * (320 - 175 * Ce) - 768)) / 16384) * (Yi - de * Mi * (Z + de / 4 * (Ri * (2 * ie - 1) - de / 6 * Z * (4 * Mi * Mi - 3) * (4 * ie - 3))))), L != null && (L.u = A.s.$(A.s.R(m), 1.570796326794897) ? 0 > m ? _ : A.F.ca(3.141592653589793 - _) : Math.atan2($t * Jt, T * qe - Pt * $t * Zt)), B != null && (A.s.$(A.s.R(C), 1.570796326794897) ? B.u = 0 > C ? b : A.F.ca(3.141592653589793 - b) : (B.u = Math.atan2(T * Jt, T * qe * Zt - Pt * $t), B.u = A.F.ca(B.u + 3.141592653589793))); + else { + Rt = A.s.Mb(3.141592653589793, se), Ri = Pt * qe - T * $t, Yi = Math.acos(Ri), Mi = Math.sin(Yi), q = 1, Qt = rr = 0; + do + ie = rr, Zt = 1 - 0.25 * (rr = de * (q *= q) * (1 + de + de * de)) + 0.1875 * (Z = de * de * (Zt = q * q) * (1 + 2.25 * de)) - 0.1953125 * (Xt = de * de * de * Zt * q), rr = 0.25 * rr - 0.25 * Z + 0.29296875 * Xt, Jt = 0.03125 * Z - 0.05859375 * Xt, Xt *= 0.00651041666666667, Z = Ri - 2 * Pt * qe / q, 1 < A.s.R(Z) && (Z = A.s.Mb(1, Z)), q = Math.acos(Z), Ri = Math.cos(2 * q), bi = Math.cos(3 * q), Jt = (rr = A.s.$(m, -C) ? A.F.ca(3.141592653589793 - se) / (3.141592653589793 * de * Zt) : A.F.ca(Rt - se) / (de * (Zt * Yi + rr * Mi * Z + Jt * Math.sin(2 * Yi) * Ri + Xt * Math.sin(3 * Yi) * bi))) * Mi / (T * $t), Rt = 1.570796326794897 < A.s.R(se) ? A.s.Mb(3.141592653589793, Jt) - Math.asin(Jt) : Math.asin(Jt), Zt = Math.cos(Rt), Mi = Math.sqrt(Math.pow($t * Jt, 2) + Math.pow(T * qe - Pt * $t * Zt, 2)), Yi = 3.141592653589793 - Math.asin(A.s.R(Mi)), Ri = Math.cos(Yi), q = Math.cos(Math.asin(rr)), Qt++; + while (70 >= Qt && !A.s.$(ie, rr)); + D != null && (Zt = 1 + (Ce *= q *= q) * (4096 + Ce * (Ce * (320 - 175 * Ce) - 768)) / 16384, A.s.$(m, -C) ? D.u = 3.141592653589793 * Ve * Zt : (Z = Ri - 2 * Pt * qe / q, q = Math.acos(Z), Ri = Math.cos(2 * q), bi = Math.cos(3 * q), D.u = Ve * (Zt * Yi + Ce * (Ce * (128 + Ce * (35 * Ce - 60)) - 512) / 2048 * Mi * Z + Ce * (5 * Ce - 4) / 6144 * Ce * Ce * Math.sin(2 * Yi) * Ri + Xt * Math.sin(3 * Yi) * bi + -762939453125e-16 * Ce * Ce * Ce * Ce * Math.sin(4 * Yi) * Math.cos(4 * q)))), L != null && (A.s.Dd(m) && A.s.Dd(C) ? (q = Math.sqrt(1 - rr * rr), L.u = Math.acos(q), 0 > se && (L.u *= -1)) : A.s.$(A.s.R(m), 1.570796326794897) ? L.u = 0 > m ? _ : A.F.ca(3.141592653589793 - _) : (D = rr / T, Ve = Math.sqrt(1 - D * D), 0 > T * qe - Pt * $t * Math.cos(Rt) && (Ve *= -1), L.u = Math.atan2(D, Ve), A.s.$(m, -C) && A.s.R(A.F.ca(b - _)) > 3.141592653589793 * (1 - de * Math.cos(m)) && (0 < m && 1.570796326794897 > A.s.R(L.u) || 0 > m && 1.570796326794897 < A.s.R(L.u)) && (L.u = A.s.Mb(3.141592653589793, L.u) - L.u))), B != null && (A.s.Dd(m) && A.s.Dd(C) ? (q = Math.sqrt(1 - rr * rr), B.u = Math.acos(q), 0 <= se && (B.u *= -1)) : A.s.$(A.s.R(C), 1.570796326794897) ? B.u = 0 > C ? b : A.F.ca(3.141592653589793 - b) : (se = rr / $t, D = Math.sqrt(1 - se * se), Ve = Math.sin(Rt / 2), 0 > Math.sin(Je - H) - 2 * T * qe * Ve * Ve && (D *= -1), B.u = Math.atan2(se, D), B.u = A.F.ca(B.u + 3.141592653589793), A.s.$(m, -C) && !A.s.Dd(m) && !A.s.$(A.s.R(m), 1.570796326794897) && A.s.R(A.F.ca(b - _)) > 3.141592653589793 * (1 - de * Math.cos(m)) && (L != null ? Ve = L.u : (D = rr / T, Ve = Math.sqrt(1 - D * D), 0 > T * qe - Pt * $t * Math.cos(Rt) && (Ve *= -1), Ve = Math.atan2(D, Ve), A.s.$(m, -C) && A.s.R(A.F.ca(b - _)) > 3.141592653589793 * (1 - de * Math.cos(m)) && (0 < m && 1.570796326794897 > A.s.R(Ve) || 0 > m && 1.570796326794897 < A.s.R(Ve)) && (Ve = A.s.Mb(3.141592653589793, Ve) - Ve)), 1.570796326794897 >= A.s.R(Ve) && 1.570796326794897 < A.s.R(B.u) || 1.570796326794897 <= A.s.R(Ve) && 1.570796326794897 > A.s.R(B.u)) && (B.u = -1 * A.F.ca(B.u + 3.141592653589793)))); + } + } + } + }, ve.sf = function(H, T, b, m, _, C, D, L) { + if (D != null || L != null) + if (A.s.vi(T)) + A.$g.sf(H, b, m, _, C, D, L); + else if (C = A.F.ca(C), A.s.$(A.s.R(m), 1.570796326794897) || A.s.Dd(C) || A.s.$(A.s.R(C), 3.141592653589793)) + A.Yk.sf(H, T, b, m, _, C, D, L); + else { + var B = A.s.R(C) == 1.570796326794897 ? 0 : Math.cos(C), q = A.s.R(C) == 3.141592653589793 ? 0 : Math.sin(C); + A.s.$(A.s.R(m), 1.570796326794897) && (b = 0), C = 1 - Math.sqrt(1 - T); + var Z = A.F.Xq(T, m); + m = A.s.R(Z) == 1.570796326794897 ? 0 : Math.cos(Z); + var ie = Math.sin(Z); + Z = Math.atan2(Math.tan(Z), B); + var se = m * q, de = se * se, Ce = 1 - de, Ve = T / (1 - T) * Ce, Je = (T = Ve * (256 + Ve * (Ve * (74 - 47 * Ve) - 128)) / 1024) / 4, Pt = T / 6, $t = _ / (H * (1 - C) * (1 + Ve * (4096 + Ve * (Ve * (320 - 175 * Ve) - 768)) / 16384)), qe = $t; + do { + var Rt = qe; + _ = A.s.R(qe) == 1.570796326794897 ? 0 : Math.cos(qe); + var Zt = (Ve = A.s.R(qe) == 3.141592653589793 ? 0 : Math.sin(qe)) * Ve; + qe = T * Ve * ((H = Math.cos(2 * Z + qe)) + Je * (_ * (2 * (qe = H * H) - 1) - Pt * H * (4 * Zt - 3) * (4 * qe - 3))) + $t; + } while (!A.s.$(Rt, qe)); + _ = A.s.R(qe) == 1.570796326794897 ? 0 : Math.cos(qe), Ve = A.s.R(qe) == 3.141592653589793 ? 0 : Math.sin(qe), D != null && (q = Math.atan2(Ve * q, m * _ - ie * Ve * B), Ce = C / 16 * Ce * (4 + C * (4 - 3 * Ce)), H = Math.cos(2 * Z + qe), D.u = A.F.ca(b + (q - (1 - Ce) * C * se * (qe + Ce * Ve * (H + Ce * _ * (2 * H * H - 1)))))), L != null && (Ce = ie * Ve - m * _ * B, Ce = (1 - C) * Math.sqrt(de + Ce * Ce), L.u = Math.atan2(ie * _ + m * Ve * B, Ce)); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + A.KC = function() { + function ve() { + } + return ve.ub = function(H, T, b, m, _, C, D, L, B) { + var q = A.F.ca(_ - b), Z = A.s.$(A.s.R(m), 1.570796326794897), ie = A.s.$(A.s.R(C), 1.570796326794897); + if (A.s.$(m, C) && (A.s.Dd(q) || Z)) + D != null && (D.u = 0), L != null && (L.u = 0), B != null && (B.u = 0); + else { + if (A.s.vi(T)) { + var se = Math.sin(m), de = Math.sin(C); + se = Math.sqrt((1 + se) / (1 - se)), de = Math.sqrt((1 + de) / (1 - de)), se = Math.log(de) - Math.log(se), se = Math.atan2(q, se), D != null && (D.u = A.s.$(m, C) ? A.s.R(H * Math.cos(m) * q) : A.s.R((H * C - H * m) / Math.cos(se))); + } else + de = A.F.Sw(T, C), se = Math.sin(A.F.Sw(T, m)), de = Math.sin(de), se = Math.sqrt((1 + se) / (1 - se)), de = Math.sqrt((1 + de) / (1 - de)), se = Math.log(de) - Math.log(se), se = Math.atan2(q, se), D != null && (A.s.$(m, C) ? D.u = A.s.R(H * q * Math.cos(m) / A.F.w(T, m)) : (q = A.F.q(H, T, m), H = A.F.q(H, T, C), D.u = A.s.R((H - q) / Math.cos(se)))); + L == null && B == null || (D = A.F.ca(se + 3.141592653589793), Z && ie || !Z && !ie || (Z ? se = 0 > m ? _ : A.F.ca(3.141592653589793 - _) : ie && (D = 0 > C ? b : A.F.ca(3.141592653589793 - b))), L != null && (L.u = se), B != null && (B.u = D)); + } + }, ve.sf = function(H, T, b, m, _, C, D, L) { + C = A.F.ca(C), 0 > _ && (_ = A.s.R(_), C = A.F.ca(C + 3.141592653589793)), A.s.vi(T) ? A.s.$(A.s.R(m), 1.570796326794897) ? (b = 0 > m ? C : A.F.ca(3.141592653589793 - C), 3.141592653589793 >= (C = _ / H % 6.283185307179586) ? H = m - A.s.Mb(C, m) : (b = A.F.ca(b + 3.141592653589793), H = -m + A.s.Mb(C - 3.141592653589793, m))) : A.s.$(A.s.R(C), 1.570796326794897) ? (b = A.F.ca(b + A.s.Mb(_, C) / (H * Math.cos(m))), H = m) : (H = m + _ * Math.cos(C) / H, 1.570796326794897 < A.s.R(H) && (H = 1.570796326794897), A.s.$(A.s.R(H), 1.570796326794897) && (A.s.Dd(C) || A.s.$(A.s.R(C), 3.141592653589793)) || (1.570796316258184 < A.s.R(H) && (H = A.s.Mb(1.570796316258184, H)), T = Math.sin(m), m = Math.sin(H), T = Math.sqrt((1 + T) / (1 - T)), m = Math.sqrt((1 + m) / (1 - m)), T = Math.log(m) - Math.log(T), b = A.F.ca(b + Math.tan(C) * T))) : A.s.$(A.s.R(m), 1.570796326794897) ? (b = 0 > m ? C : A.F.ca(3.141592653589793 - C), C = _ / A.F.lW(H, T), 3.141592653589793 >= (C %= 6.283185307179586) ? H = m - A.s.Mb(C, m) : (b = A.F.ca(b + 3.141592653589793), H = -m + A.s.Mb(C - 3.141592653589793, m)), H = A.F.Tq(T, H)) : A.s.$(A.s.R(C), 1.570796326794897) ? (b = A.F.ca(b + A.s.Mb(_, C) * A.F.w(T, m) / (H * Math.cos(m))), H = m) : (H = 1.570796326794897 * (_ * Math.cos(C) + A.F.q(H, T, m)) / A.F.Ch(H, T), 1.570796326794897 < A.s.R(H) && (H = A.s.Mb(1.570796326794897, H)), H = A.F.Tq(T, H), A.s.$(A.s.R(H), 1.570796326794897) && (A.s.Dd(C) || A.s.$(A.s.R(C), 3.141592653589793)) || (_ = A.F.Sw(T, m), m = A.F.Sw(T, H), 1.570796316258184 < A.s.R(m) && (m = A.s.Mb(1.570796316258184, H), H = A.F.tO(T, m)), T = Math.sin(_), m = Math.sin(m), T = Math.sqrt((1 + T) / (1 - T)), m = Math.sqrt((1 + m) / (1 - m)), T = Math.log(m) - Math.log(T), b = A.F.ca(b + Math.tan(C) * T))), D != null && (D.u = b), L != null && (L.u = H); + }, ve; + }(); + }(le || (le = {})), function(A) { + A.kb = function() { + function ve() { + } + return ve.Sy = function(H, T, b, m, _, C, D) { + A.eu.ub(H, T, b, m, _, C, null, D, null); + }, ve.Ai = function(H, T, b, m, _, C, D, L) { + A.eu.sf(H, T, b, m, _, C, D, L); + }, ve.xd = function(H, T, b, m, _, C, D, L, B, q) { + switch (q) { + case 2: + A.Yk.ub(H, T, b, m, _, C, D, L, B); + break; + case 3: + A.LC.ub(H, T, b, m, _, C, D, L, B); + break; + case 1: + A.KC.ub(H, T, b, m, _, C, D, L, B); + break; + default: + A.eu.ub(H, T, b, m, _, C, D, L, B); + } + }, ve.qj = function(H, T, b, m, _, C, D, L, B) { + switch (B) { + case 2: + A.Yk.sf(H, T, b, m, _, C, D, L); + break; + case 3: + A.LC.sf(H, T, b, m, _, C, D, L); + break; + case 1: + A.KC.sf(H, T, b, m, _, C, D, L); + break; + default: + A.eu.sf(H, T, b, m, _, C, D, L); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function() { + function T() { + this.y = this.x = null; + } + return T.construct = function(b) { + var m = new T(); + return m.x = new A.Xb(), m.x.set(b.x), m.y = new A.Xb(), m.y.set(b.y), m; + }, T.QE = function(b, m) { + var _ = new T(); + return _.x = new A.Xb(), _.x.set(b), _.y = new A.Xb(), _.y.set(m), _; + }, T.prototype.rg = function() { + return this.x.rg() && this.y.rg(); + }, T.prototype.value = function() { + return A.h.construct(this.x.value(), this.y.value()); + }, T; + }(); + A.rY = ve; + var H = function() { + function T() { + this.z = this.y = this.x = null; + } + return T.construct = function(b) { + var m = new T(); + return m.x = new A.Xb(), m.x.set(b.x), m.y = new A.Xb(), m.y.set(b.y), m.z = new A.Xb(), m.z.set(b.z), m; + }, T.QE = function(b, m, _) { + var C = new T(); + return C.x = new A.Xb(), C.x.set(b), C.y = new A.Xb(), C.y.set(m), C.z = new A.Xb(), C.z.set(_), C; + }, T.prototype.rg = function() { + return this.x.rg() && this.y.rg() && this.z.rg(); + }, T.prototype.value = function() { + return new A.Od(this.x.value(), this.y.value(), this.z.value()); + }, T.prototype.Sh = function(b) { + var m = new A.Xb(), _ = new A.Xb(), C = new A.Xb(); + return m.Ml(this.x, b.x), _.Ml(this.y, b.y), C.Ml(this.z, b.z), (b = new A.Xb()).ZM(m, _), b.add(C), b; + }, T.prototype.YE = function(b) { + var m = new T(); + m.x.Ml(this.y, b.z), m.y.Ml(this.z, b.x), m.z.Ml(this.x, b.y); + var _ = new A.Xb(), C = new A.Xb(), D = new A.Xb(); + return _.Ml(this.z, b.y), C.Ml(this.x, b.z), D.Ml(this.y, b.x), m.x.sub(_), m.y.sub(C), m.z.sub(D), m; + }, T; + }(); + A.sY = H, A.Nx = function() { + function T() { + } + return T.zP = function(b, m, _) { + var C = m.x; + m = m.y, T.el(1, b, Math.cos(C), Math.sin(C), Math.cos(m), Math.sin(m), _); + }, T.yP = function(b, m) { + var _ = new A.Od(); + return T.zP(b, m, _), _; + }, T.el = function(b, m, _, C, D, L, B) { + b /= Math.sqrt(1 - m * L * L), B.L(b * D * _, b * D * C, b * (1 - m) * L); + }, T.$u = function(b, m) { + var _ = new A.Xb(), C = new A.Xb(), D = new A.Xb(), L = new A.Xb(); + _.cos(m.x), C.sin(m.x), D.cos(m.y), L.sin(m.y); + var B = new A.Xb(); + return B.set(L), B.Bg(L), B.Po(b), B.Po(-1), B.fN(), B.sqrt(), (m = new A.Xb()).set(1), m.lm(B), (B = new A.Xb()).set(m), B.Bg(D), B.Bg(_), (_ = new A.Xb()).set(m), _.Bg(D), _.Bg(C), (C = new A.Xb()).set(m), C.Po(1 - b), C.Bg(L), H.QE(B, _, C); + }, T.NS = function(b, m, _, C) { + if (Math.abs(m.x - _.x) > Math.PI || Math.abs(m.y) > 0.5 * Math.PI || Math.abs(_.y) > 0.5 * Math.PI || (Math.abs(m.y) == 0.5 * Math.PI || Math.abs(_.y) == 0.5 * Math.PI) && m.x != _.x) + return NaN; + if (C = T.YA(C, Math.min(m.x, _.x), Math.max(m.x, _.x)), !new A.Oc(m.x, _.x).contains(C)) + return NaN; + var D = ve.construct(m); + if (_ = ve.construct(_), D = T.$u(b, D), _ = T.$u(b, _), (_ = D.YE(_)).z.rg()) + return m.y; + var L = new A.Xb(); + L.set(_.x), L.lm(_.z), L.Po(-1); + var B = new A.Xb(); + B.set(_.y), B.lm(_.z), B.Po(-1); + var q = new A.Xb(); + return q.set(B), q.Bg(B), (D = new A.Xb()).set(L), D.Bg(L), D.add(q), D.sqrt(), D.rg() || L.rg() && B.rg() ? m.y : (m = Math.atan2(B.value(), L.value()), m = Math.atan2(D.value() * Math.cos(m - C), 1 - b), C = T.yP(b, A.h.construct(C, m)), b = new A.Od(C.x, C.y, -C.z), C = _.value().Sh(C), b = _.value().Sh(b), Math.abs(b) < Math.abs(C) && (m = -m), m); + }, T.Jz = function(b, m, _, C, D) { + if (D[0] = NaN, D[1] = NaN, Math.abs(m.x - _.x) > Math.PI || Math.abs(m.y) > 0.5 * Math.PI || Math.abs(_.y) > 0.5 * Math.PI || (Math.abs(m.y) == 0.5 * Math.PI || Math.abs(_.y) == 0.5 * Math.PI) && m.x != _.x || Math.abs(C) >= 0.5 * Math.PI || 0 < m.y && 0 < _.y && m.y > C && _.y > C || 0 > m.y && 0 > _.y && m.y < C && _.y < C) + return 0; + var L = ve.construct(m), B = ve.construct(_); + L = T.$u(b, L), B = T.$u(b, B); + var q = L.YE(B); + if (q.z.rg()) + return new A.Oc(m.y, _.y).contains(C) ? (D[0] = m.x, 1) : 0; + (B = new A.Xb()).set(q.x), B.lm(q.z), B.Po(-1), (L = new A.Xb()).set(q.y), L.lm(q.z), L.Po(-1), (q = new A.Xb()).set(L), q.Bg(L); + var Z = new A.Xb(); + return Z.set(B), Z.Bg(B), Z.add(q), Z.sqrt(), Z.rg() || B.rg() && L.rg() ? C == 0 ? (D[0] = m.x, D[1] = _.x, 2) : 0 : (b = (1 - b) * Math.tan(C) / Z.value(), 1 < Math.abs(b) ? 0 : (b = Math.acos(b), q = Math.atan2(L.value(), B.value()), B = Math.min(m.x, _.x), L = Math.max(m.x, _.x), _ = T.YA(q - b, B, L), b = C != 0 ? T.YA(q + b, B, L) : _, C = 0, B <= _ && _ <= L && (D[C] = _, C++), b != _ && B <= b && b <= L && (D[C] = b, ++C == 2 && Math.abs(D[0] - m.x) > Math.abs(D[1] - m.x) && (m = D[0], D[0] = D[1], D[1] = m)), C)); + }, T.YA = function(b, m, _) { + return b > _ ? b -= 2 * (m = Math.ceil((b - _) / (2 * Math.PI))) * Math.PI : b < m && (b += 2 * (m = Math.ceil((m - b) / (2 * Math.PI))) * Math.PI), b; + }, T; + }(); + }(le || (le = {})), function(A) { + A.SK = function() { + function ve() { + } + return ve.WX = function(H, T) { + var b = 8, m = [0, 0, 0, 0], _ = new A.h(); + _.N(T), _.scale(A.cb.tc(H).Id().Fc() == 9102 ? 1 : A.cb.tc(H).Id().ci / 3.141592653589793 * 180), -180 > _.x ? (_.x -= _.x % 360, -180 > _.x && (_.x += 360)) : 180 < _.x && (_.x -= _.x % 360, 180 < _.x && (_.x -= 360)), 90 < _.y && (_.y = 90), -90 > _.y && (_.y = -90); + for (var C = -180, D = 180, L = (H = 5 * b) - 1, B = (T = (H + 31) / 32) - 1; 0 <= B; B--) + for (var q = L - 32 * B, Z = Math.min(32, H - 32 * B), ie = 1; ie < Z; ie += 2) { + var se = 0.5 * (D + C); + _.x >= se ? (m[B] |= 1 << q, C = se) : D = se, q -= 2, L -= 2; + } + for (C = -90, D = 90, L = H - 2, B = T - 1; 0 <= B; B--) + for (q = L - 32 * B, Z = Math.min(32, H - 32 * B), ie = 0; ie < Z; ie += 2) + se = 0.5 * (D + C), _.y >= se ? (m[B] |= 1 << q, C = se) : D = se, q -= 2, L -= 2; + return ve.VP(m, b, b); + }, ve.VP = function(H, T, b) { + for (var m = [], _ = 0; _ < T; _++) + m[_] = ""; + for (var C = _ = 0, D = 0; D < T; D++) { + var L = H[_] >> C & 31; + if (31 < (C += 5)) { + var B = 37 - C; + L &= (1 << B) - 1, C -= 32, L |= (H[++_] & (1 << C) - 1) << B; + } + m[T - 1 - D] = "0123456789bcdefghjkmnpqrstuvwxyz".split("")[L]; + } + if (b > T) + for (D = 0; D < b - T; D++) + m.push("0"); + else + b < T && (m.length = b); + return m.join(""); + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = { gcstol: [0, 2e-9, 1, 2241706620489156e-24, 2, 2313672246530541e-24, 3, 898240164660333e-23, 4, 8982433838020134e-24, 5, 8982439417325895e-24, 6, 8982466029667677e-24, 7, 8982476760268133e-24, 8, 8982492642167149e-24, 9, 898251968292634e-23, 10, 898253685210448e-23, 11, 8982546725256576e-24, 12, 8982557456049832e-24, 13, 898257333682596e-23, 14, 8982575482995276e-24, 15, 8982578488197342e-24, 16, 8982579775336987e-24, 17, 89825840676828e-22, 18, 8982599090925448e-24, 19, 8982605529473397e-24, 20, 8982609220517402e-24, 21, 8982611968030573e-24, 22, 8982616260407152e-24, 23, 8982620552787834e-24, 24, 8982633429954492e-24, 25, 8982637722351582e-24, 26, 898264416095491e-23, 27, 8982646307158072e-24, 28, 8982654891980968e-24, 29, 8982667769246082e-24, 30, 8982674207892485e-24, 31, 8982680646548117e-24, 32, 8982682792768713e-24, 33, 8982685798042582e-24, 34, 8982689231436652e-24, 35, 898269137766135e-23, 36, 898269266624163e-23, 37, 8982705114087017e-24, 38, 8982706830791106e-24, 39, 8982711958374661e-24, 40, 8982712839964735e-24, 41, 8982717991496125e-24, 42, 8982721424914803e-24, 43, 8982723571154887e-24, 44, 8982727863638127e-24, 45, 8982730868942154e-24, 46, 8982734302370678e-24, 47, 8982745033612112e-24, 48, 8982751472369276e-24, 49, 8982755764879183e-24, 50, 8982762203651733e-24, 51, 8982764776628385e-24, 52, 8982766496171896e-24, 53, 898277722749025e-23, 54, 898278152002477e-23, 55, 898279933943848e-23, 56, 89829143024805e-22, 57, 8982922161948598e-24, 58, 898292327314211e-23, 59, 8982925667349601e-24, 60, 8982932222965576e-24, 61, 8982961298941316e-24, 62, 8982965524049989e-24, 63, 8982994818246099e-24, 64, 8982994895706967e-24, 65, 898299489597736e-23, 66, 8983000733443498e-24, 67, 8983055097289157e-24, 68, 8983064111047368e-24, 69, 8983111996941178e-24, 70, 8983120447446023e-24, 71, 898312748954554e-23, 72, 8983134531656096e-24, 73, 8983141573777694e-24, 74, 8983148615910332e-24, 75, 8983152841195215e-24, 76, 8983153545409748e-24, 77, 8983153827095593e-24, 78, 898315396793852e-23, 79, 8983154249624393e-24, 80, 8983155658054012e-24, 81, 8983960794340072e-24, 82, 8984061344391998e-24, 83, 8984072829255685e-24, 84, 8984194981201908e-24, 85, 8984275233099427e-24, 86, 8984326127007554e-24, 87, 8984330099816539e-24, 88, 898433275258421e-23, 89, 8984333047023206e-24, 90, 8984333885258723e-24, 91, 8984337959508212e-24, 92, 8984365176209457e-24, 93, 8984727360418079e-24, 94, 8984901041679577e-24, 95, 898542662091587e-23, 96, 898610024130669e-23, 97, 8992894229037531e-24, 98, 8993203677616635e-24, 99, 8993206178094346e-24, 100, 8993216059187305e-24, 101, 899322029394808e-23, 102, 8994627867045891e-24, 103, 9467559984315793e-24, 104, 946881168618118e-23, 105, 9980888154931644e-24, 106, 9981105353606775e-24, 107, 9983807356573187e-24, 108, 1687060485811522e-23, 109, 1688447560354875e-23, 110, 2176606011487185e-23, 111, 2225078816042032e-23, 112, 2348476432064694e-23, 113, 2348765250187846e-23, 114, 2378108974103778e-23, 115, 314559636297708e-22, 116, 3297788621680806e-23, 117, 3667892343788279e-23, 118, 4235973644320739e-23, 119, 4794625900676345e-23, 120, 7262742998235812e-23, 121, 7499447580246377e-23, 122, 7525056410964318e-23, 123, 7979913581209237e-23, 124, 9662020153976783e-23, 125, 9799175562353741e-23, 126, 9897353517547472e-23, 127, 102313891987647e-21, 128, 1081460541960784e-22, 129, 121905913857622e-21, 130, 2246893314238523e-22, 131, 2297344808062643e-22, 132, 242984645941825e-21, 133, 2754604784282804e-22, 134, 2884548130346993e-22, 135, 3370339971357784e-22, 136, 4307953346848296e-22, 137, 5208707228462029e-22, 138, 5509209568565608e-22, 139, 6452227422644406e-22, 140, 6740679942715567e-22, 141, 6861770001566745e-22, 142, 7252630318111686e-22, 143, 7441010326374328e-22, 144, 7742672907173287e-22, 145, 9629542775307953e-22, 146, 1061032953945969e-21, 147, 1143628333594458e-21, 148, 1162186197019925e-21, 149, 136418522650196e-20, 150, 1367441038498385e-21, 151, 1432394487827058e-21, 152, 1736235742820677e-21, 153, 1848250952034914e-21, 154, 1909859317102744e-21, 155, 1975716534933873e-21, 156, 2122065907891938e-21, 157, 272837045300392e-20, 158, 3183098861837907e-21, 159, 3580986219567645e-21, 160, 3819718634205488e-21, 161, 409255567950588e-20, 162, 4407367654852486e-21, 163, 4774648292756861e-21, 164, 5161781938115525e-21, 165, 520870722846203e-20, 166, 5729577951308232e-21, 167, 6031134685587613e-21, 168, 6987290184522236e-21, 169, 9241254760174569e-21, 170, 1145915590261646e-20], pcstol: [0, 6666666666666667e-24, 1, 2e-8, 2, 4970973863636364e-20, 3, 4970978156565657e-20, 4, 4970980410559237e-20, 5, 1e-3, 6, 0.001093615055555556, 7, 0.001093615194444445, 8, 0.001093619003239988, 9, 0.001093623110088878, 10, 0.003280833333333333, 11, 0.003280839895013123, 12, 0.003280843014596366, 13, 0.003280845583333334, 14, 0.003280869330266636, 15, 0.00497101413676763], newtoold: [2154, 102110, 2195, 102200, 2204, 32036, 2205, 26979, 2225, 102641, 2226, 102642, 2227, 102643, 2228, 102644, 2229, 102645, 2230, 102646, 2231, 102653, 2232, 102654, 2233, 102655, 2234, 102656, 2235, 102657, 2236, 102658, 2237, 102659, 2238, 102660, 2239, 102666, 2240, 102667, 2241, 102668, 2242, 102669, 2243, 102670, 2246, 102679, 2247, 102680, 2248, 102685, 2249, 102686, 2250, 102687, 2254, 102694, 2255, 102695, 2257, 102712, 2258, 102713, 2259, 102714, 2260, 102715, 2261, 102716, 2262, 102717, 2263, 102718, 2264, 102719, 2267, 102724, 2268, 102725, 2271, 102728, 2272, 102729, 2274, 102736, 2275, 102737, 2276, 102738, 2277, 102739, 2278, 102740, 2279, 102741, 2283, 102746, 2284, 102747, 2285, 102748, 2286, 102749, 2287, 102752, 2288, 102753, 2289, 102754, 2312, 23433, 2326, 102140, 2395, 2091, 2396, 2092, 2397, 2166, 2398, 2167, 2399, 2168, 2759, 102229, 2760, 102230, 2761, 102248, 2762, 102249, 2763, 102250, 2764, 102251, 2765, 102252, 2766, 102241, 2767, 102242, 2768, 102243, 2769, 102244, 2770, 102245, 2771, 102246, 2772, 102253, 2773, 102254, 2774, 102255, 2775, 102256, 2776, 102257, 2777, 102258, 2778, 102259, 2779, 102260, 2780, 102266, 2781, 102267, 2782, 102261, 2783, 102262, 2784, 102263, 2785, 102264, 2786, 102265, 2787, 102268, 2788, 102269, 2789, 102270, 2790, 102271, 2791, 102272, 2792, 102273, 2793, 102274, 2794, 102275, 2795, 102276, 2796, 102277, 2797, 102278, 2798, 102279, 2799, 102280, 2800, 102281, 2801, 102282, 2802, 102283, 2803, 102284, 2804, 102285, 2805, 102286, 2806, 102287, 2807, 102288, 2808, 102289, 2809, 102290, 2810, 102291, 2811, 102292, 2812, 102293, 2813, 102294, 2814, 102295, 2815, 102296, 2816, 102297, 2817, 102298, 2818, 102300, 2819, 102304, 2820, 102307, 2821, 102308, 2822, 102309, 2823, 102310, 2824, 102311, 2825, 102312, 2826, 102313, 2827, 102314, 2828, 102315, 2829, 102316, 2830, 102317, 2831, 102318, 2832, 102320, 2833, 102321, 2834, 102322, 2835, 102323, 2836, 102324, 2837, 102325, 2838, 102326, 2839, 102327, 2840, 102330, 2841, 102334, 2842, 102335, 2843, 102336, 2844, 102337, 2845, 102338, 2846, 102339, 2847, 102340, 2848, 102341, 2849, 102342, 2850, 102343, 2851, 102344, 2852, 102345, 2853, 102346, 2854, 102347, 2855, 102348, 2856, 102349, 2857, 102350, 2858, 102351, 2859, 102352, 2860, 102353, 2861, 102354, 2862, 102355, 2863, 102356, 2864, 102357, 2865, 102358, 2866, 102361, 2942, 102167, 2943, 102169, 2944, 2139, 2945, 2140, 2946, 2141, 2947, 2142, 2948, 2143, 2949, 2144, 2950, 2145, 2951, 2146, 2952, 2147, 2953, 2036, 2954, 2291, 2955, 2153, 2956, 2152, 2957, 2151, 2958, 2150, 2959, 2149, 2960, 2037, 2961, 2038, 2962, 2148, 2965, 2244, 2966, 2245, 3003, 102091, 3004, 102092, 3005, 102190, 3060, 2982, 3067, 102139, 3072, 102606, 3074, 102608, 3075, 102208, 3077, 102210, 3078, 102123, 3080, 102119, 3081, 102603, 3082, 102602, 3083, 102601, 3088, 65163, 3089, 102763, 3090, 102363, 3092, 102151, 3093, 102152, 3094, 102153, 3095, 102154, 3096, 102155, 3097, 102145, 3098, 102146, 3099, 102147, 3100, 102148, 3101, 102149, 3102, 2155, 3107, 102172, 3110, 102170, 3111, 102171, 3119, 2214, 3158, 102234, 3159, 102235, 3160, 102236, 3336, 2979, 3338, 102006, 3346, 2600, 3370, 102126, 3371, 102127, 3372, 102130, 3373, 102131, 3389, 2577, 3390, 2694, 3400, 102184, 3401, 102185, 3404, 3359, 3407, 3366, 3417, 102675, 3418, 102676, 3419, 102677, 3420, 102678, 3421, 102707, 3422, 102708, 3423, 102709, 3424, 102711, 3433, 102651, 3434, 102652, 3435, 102671, 3436, 102672, 3437, 102710, 3438, 102730, 3448, 102095, 3451, 102681, 3452, 102682, 3455, 102735, 3461, 2063, 3462, 2064, 3463, 3073, 3464, 3076, 3560, 102742, 3566, 102743, 3567, 102744, 3734, 102722, 3735, 102723, 3736, 102755, 3737, 102756, 3738, 102757, 3739, 102758, 3741, 102205, 3742, 102206, 3743, 102207, 3748, 102211, 3750, 102202, 3751, 102203, 3759, 102663, 3760, 102463, 3764, 102112, 3770, 102090, 3771, 102180, 3772, 102181, 3773, 102182, 3775, 102186, 3776, 102187, 3777, 102188, 3800, 102183, 3801, 102189, 3812, 102199, 3814, 102609, 3815, 102469, 3819, 104990, 3821, 104136, 3824, 104137, 3825, 102444, 3826, 102443, 3827, 102442, 3828, 102441, 3857, 102100, 3889, 104991, 3906, 104992, 4048, 103201, 4049, 103202, 4050, 103203, 4051, 103204, 4056, 103205, 4057, 103206, 4058, 103207, 4059, 103208, 4060, 103209, 4061, 103210, 4062, 103211, 4063, 103212, 4071, 103213, 4082, 103214, 4083, 103215, 4093, 103216, 4094, 103217, 4095, 103218, 4096, 103219, 4167, 104108, 4169, 37252, 4171, 104107, 4189, 104110, 4197, 4234, 4223, 37223, 4304, 104304, 4414, 102201, 4415, 102762, 4417, 102764, 4434, 102765, 4437, 102647, 4455, 32029, 4456, 32018, 4457, 3454, 4462, 102439, 4463, 4466, 4470, 4469, 4484, 103794, 4485, 103795, 4486, 103796, 4487, 103797, 4488, 103798, 4489, 103799, 4611, 104104, 4612, 104111, 4613, 37255, 4615, 37247, 4616, 37250, 4617, 4140, 4618, 4291, 4620, 37211, 4626, 37235, 4647, 102362, 4658, 37204, 4668, 37201, 4669, 4126, 4672, 37217, 4673, 104125, 4675, 37220, 4684, 37232, 4698, 4631, 4707, 37213, 4708, 37231, 4709, 37212, 4710, 37238, 4711, 37214, 4712, 37237, 4713, 37208, 4714, 37215, 4715, 37253, 4716, 37216, 4717, 37239, 4719, 37219, 4722, 37242, 4724, 37233, 4725, 37222, 4727, 37224, 4728, 37246, 4729, 37226, 4730, 37227, 4731, 37228, 4732, 37229, 4733, 37230, 4734, 37251, 4735, 37259, 4736, 37254, 4739, 37205, 4758, 104133, 4760, 37001, 4762, 104114, 4826, 102214, 5013, 104142, 5014, 102331, 5015, 102332, 5016, 102333, 5173, 102085, 5174, 102086, 5175, 102087, 5176, 102088, 5177, 102089, 5178, 102040, 5179, 102080, 5185, 102081, 5186, 102082, 5187, 102083, 5188, 102084, 5221, 102066, 5246, 104100, 5247, 102490, 5324, 104144, 5325, 102420, 5329, 2934, 5365, 104143, 5367, 102305, 5451, 104132, 5513, 102065, 5514, 102067, 5519, 102111, 5520, 31461, 5646, 102745, 5839, 5388, 5858, 5532, 5879, 4474, 6207, 104256, 6244, 102769, 6245, 102790, 6246, 102770, 6247, 102771, 6248, 102793, 6249, 102796, 6250, 102772, 6251, 102788, 6252, 102775, 6253, 102795, 6254, 102781, 6255, 102767, 6256, 102774, 6257, 102768, 6258, 102797, 6259, 102789, 6260, 102780, 6261, 102783, 6262, 102787, 6263, 102791, 6264, 102777, 6265, 102798, 6266, 102779, 6267, 102784, 6268, 102792, 6269, 102782, 6270, 102785, 6271, 102794, 6272, 102773, 6273, 102778, 6274, 102786, 6275, 102776, 6311, 104141, 6318, 104145, 6322, 104287, 6325, 104286, 6328, 102046, 6329, 102047, 6330, 102048, 6331, 102049, 6332, 102050, 6333, 102051, 6334, 102052, 6335, 102053, 6336, 102054, 6337, 102055, 6338, 102056, 6339, 102057, 6340, 102058, 6341, 102059, 6342, 102382, 6343, 102383, 6344, 102384, 6345, 102385, 6346, 102386, 6347, 102387, 6348, 102388, 6350, 102965, 6355, 102975, 6356, 102976, 6391, 6141, 6393, 102966, 6394, 102977, 6395, 102978, 6396, 102979, 6397, 102980, 6398, 102981, 6399, 102982, 6400, 102983, 6401, 102984, 6402, 102985, 6403, 102986, 6404, 102988, 6405, 102991, 6406, 102987, 6407, 102990, 6408, 102989, 6409, 102992, 6410, 102993, 6411, 102995, 6412, 102994, 6413, 102996, 6414, 102962, 6415, 102997, 6416, 103003, 6417, 102998, 6418, 103004, 6419, 102999, 6420, 103005, 6421, 103e3, 6422, 103006, 6423, 103001, 6424, 103007, 6425, 103002, 6426, 103008, 6427, 103010, 6428, 103013, 6429, 103009, 6430, 103012, 6431, 103011, 6432, 103014, 6433, 103015, 6434, 103016, 6435, 103017, 6436, 103018, 6437, 103019, 6438, 103022, 6439, 102967, 6440, 103021, 6441, 103024, 6442, 103020, 6443, 103023, 6444, 103025, 6445, 103027, 6446, 103026, 6447, 103028, 6448, 103030, 6449, 103033, 6450, 103029, 6451, 103032, 6452, 103031, 6453, 103034, 6454, 103035, 6455, 103037, 6456, 103036, 6457, 103038, 6458, 103039, 6459, 103041, 6460, 103040, 6461, 103042, 6462, 103043, 6463, 103045, 6464, 103044, 6465, 103046, 6466, 103047, 6467, 103049, 6468, 103048, 6469, 103050, 6470, 103051, 6471, 103052, 6472, 103053, 6473, 103054, 6474, 103055, 6475, 103056, 6476, 103057, 6477, 103059, 6478, 103058, 6479, 103060, 6480, 103066, 6481, 103065, 6482, 103067, 6483, 103061, 6484, 103063, 6485, 103062, 6486, 103064, 6487, 103068, 6488, 103069, 6489, 103071, 6490, 103073, 6491, 103070, 6492, 103072, 6493, 103075, 6494, 103078, 6495, 103074, 6496, 103077, 6497, 102968, 6498, 103076, 6499, 103079, 6500, 103081, 6501, 103084, 6502, 103080, 6503, 103083, 6504, 103082, 6505, 103085, 6506, 103086, 6507, 103088, 6508, 102963, 6509, 103087, 6510, 103089, 6511, 103091, 6512, 103090, 6513, 103092, 6514, 103093, 6515, 103094, 6516, 103095, 6518, 103098, 6519, 103101, 6520, 103097, 6521, 103100, 6522, 103099, 6523, 103102, 6524, 103103, 6525, 103104, 6526, 103105, 6527, 103106, 6528, 103108, 6529, 103111, 6530, 103107, 6531, 103110, 6532, 103109, 6533, 103112, 6534, 103114, 6535, 103118, 6536, 103113, 6537, 103117, 6538, 103116, 6539, 103120, 6540, 103115, 6541, 103119, 6542, 103121, 6543, 103122, 6544, 103123, 6545, 103125, 6546, 103124, 6547, 103126, 6548, 103127, 6549, 103129, 6550, 103128, 6551, 103130, 6552, 103131, 6553, 103133, 6554, 103132, 6555, 103134, 6556, 102969, 6557, 102970, 6558, 103135, 6559, 103137, 6560, 103136, 6561, 103138, 6562, 103139, 6563, 103140, 6564, 103141, 6565, 103142, 6566, 103200, 6567, 103143, 6568, 103144, 6569, 103145, 6570, 103146, 6571, 103147, 6572, 103149, 6573, 103148, 6574, 103150, 6575, 103151, 6576, 103152, 6577, 103155, 6578, 103160, 6579, 102971, 6580, 102972, 6581, 103153, 6582, 103158, 6583, 103154, 6584, 103159, 6585, 103157, 6586, 103162, 6587, 103156, 6588, 103161, 6589, 103172, 6590, 103173, 6592, 103174, 6593, 103176, 6594, 103175, 6595, 103177, 6596, 103178, 6597, 103180, 6598, 103179, 6599, 103181, 6600, 103182, 6601, 103184, 6602, 103183, 6603, 103185, 6605, 103190, 6606, 103186, 6607, 103189, 6608, 103188, 6609, 103191, 6610, 102973, 6611, 103192, 6612, 103196, 6613, 103193, 6614, 103197, 6615, 103195, 6616, 103199, 6617, 103194, 6618, 103198, 6619, 103164, 6620, 103163, 6621, 103165, 6625, 103170, 6626, 103169, 6627, 103171, 6628, 102520, 6629, 102521, 6630, 102522, 6631, 102523, 6632, 102524, 6633, 102527, 6634, 102493, 6635, 102494, 6636, 102496, 6637, 102495, 6668, 104020, 6669, 102610, 6670, 102611, 6671, 102612, 6672, 102613, 6673, 102614, 6674, 102615, 6675, 102616, 6676, 102617, 6677, 102618, 6678, 102619, 6679, 102620, 6680, 102621, 6681, 102622, 6682, 102623, 6683, 102624, 6684, 102625, 6685, 102626, 6686, 102627, 6687, 102628, 6688, 102593, 6689, 102594, 6690, 102595, 6691, 102596, 6692, 102597, 6783, 104223, 6784, 102530, 6785, 102500, 6788, 102532, 6789, 102502, 6792, 102533, 6793, 102503, 6796, 102531, 6797, 102501, 6800, 102534, 6801, 102504, 6804, 102535, 6805, 102505, 6808, 102536, 6809, 102506, 6812, 102537, 6813, 102507, 6816, 102538, 6817, 102508, 6820, 102539, 6821, 102509, 6824, 102540, 6825, 102510, 6828, 102541, 6829, 102511, 6832, 102542, 6833, 102512, 6836, 102543, 6837, 102513, 6840, 102544, 6841, 102514, 6844, 102546, 6845, 102516, 6848, 102545, 6849, 102515, 6852, 102547, 6853, 102517, 6856, 102548, 6857, 102518, 6860, 102549, 6861, 102519, 6867, 102380, 6868, 102381, 6879, 103187, 6880, 103096, 6884, 102376, 6885, 102378, 6886, 102377, 6887, 102379, 7136, 6980, 7139, 6987, 7142, 102706, 7692, 102557, 7693, 102558, 7694, 102559, 7695, 102560, 7696, 102561, 8090, 103318, 8091, 103418, 8092, 103317, 8093, 103417, 8095, 103371, 8096, 103471, 8097, 103369, 8098, 103469, 8099, 103368, 8100, 103468, 8101, 103367, 8102, 103467, 8103, 103366, 8104, 103466, 8105, 103365, 8106, 103465, 8107, 103364, 8108, 103464, 8109, 103363, 8110, 103463, 8111, 103362, 8112, 103462, 8113, 103361, 8114, 103461, 8115, 103360, 8116, 103460, 8117, 103359, 8118, 103459, 8119, 103357, 8120, 103457, 8121, 103356, 8122, 103456, 8123, 103355, 8124, 103455, 8125, 103354, 8126, 103454, 8127, 103353, 8128, 103453, 8129, 103352, 8130, 103452, 8131, 103350, 8132, 103450, 8133, 103349, 8134, 103449, 8135, 103348, 8136, 103448, 8139, 103343, 8140, 103443, 8141, 103342, 8142, 103442, 8143, 103341, 8144, 103441, 8145, 103339, 8146, 103439, 8147, 103337, 8148, 103437, 8149, 103336, 8150, 103436, 8151, 103334, 8152, 103434, 8153, 103333, 8154, 103433, 8155, 103331, 8156, 103431, 8161, 103326, 8162, 103426, 8163, 103325, 8164, 103425, 8165, 103324, 8166, 103424, 8171, 103321, 8172, 103421, 8173, 103320, 8177, 103420, 8179, 103316, 8180, 103416, 8181, 103315, 8182, 103415, 8184, 103314, 8185, 103414, 8191, 103312, 8193, 103412, 8196, 103311, 8197, 103411, 8198, 103310, 8200, 103410, 8201, 103309, 8202, 103409, 8203, 103308, 8204, 103408, 8207, 103306, 8208, 103406, 8209, 103305, 8210, 103405, 8212, 103304, 8213, 103404, 8214, 103303, 8216, 103403, 8218, 103302, 8220, 103402, 8222, 103301, 8224, 103401, 8431, 104248, 8441, 102590, 8693, 102449, 8826, 102605, 8857, 54035, 8858, 54036, 8859, 54037, 8860, 8449, 8988, 104115, 8989, 104116, 8990, 104117, 8991, 104118, 8992, 104119, 8993, 104120, 8994, 104121, 8995, 104122, 8996, 104123, 8997, 104124, 8998, 104896, 8999, 104257, 9e3, 104019, 9014, 104010, 9019, 104021, 9053, 104011, 9054, 104012, 9055, 104013, 9056, 104014, 9057, 104015, 9059, 104258, 9060, 104179, 9061, 104180, 9062, 104181, 9063, 104182, 9064, 104183, 9065, 104184, 9066, 104185, 9067, 104186, 21896, 21891, 21897, 21892, 21898, 21893, 21899, 21894, 26701, 102124, 26702, 102125, 26799, 26747, 26847, 102683, 26848, 102684, 26849, 102691, 26850, 102692, 26851, 102693, 26852, 102704, 26853, 102750, 26854, 102751, 26857, 102466, 26858, 102467, 26859, 102468, 26901, 102128, 26902, 102129, 27493, 27492, 29101, 29100, 29168, 29118, 29169, 29119, 29170, 29120, 29171, 29121, 29172, 29122, 29187, 29177, 29188, 29178, 29189, 29179, 29190, 29180, 29191, 29181, 29192, 29182, 29193, 29183, 29194, 29184, 29195, 29185, 29902, 29900, 31279, 31278, 31281, 31291, 31282, 31292, 31283, 31293, 31284, 31294, 31285, 31295, 31286, 31296, 31287, 31297, 31466, 31462, 31467, 31463, 31468, 31464, 31469, 31465, 31986, 31917, 31987, 31918, 31988, 31919, 31989, 31920, 31990, 31921, 31991, 31922, 32064, 32074, 32065, 32075, 32066, 32076, 32067, 32077, 102550, 2181, 102551, 2182, 102552, 2183, 102553, 2184, 102554, 2185, 102555, 2186, 102556, 2187], pcsid: [2066, 15, 2136, 12, 2155, 10, 2157, 5, 2158, 5, 2159, 12, 2160, 12, 2219, 5, 2220, 5, 2244, 10, 2245, 10, 2256, 11, 2265, 11, 2266, 11, 2269, 11, 2270, 11, 2273, 11, 2290, 5, 2291, 5, 2294, 5, 2295, 5, 2313, 5, 2314, 14, 2899, 10, 2900, 10, 2901, 11, 2909, 11, 2910, 11, 2911, 10, 2912, 10, 2913, 11, 2914, 11, 2964, 10, 2967, 10, 2968, 10, 2991, 5, 2992, 11, 2993, 5, 2994, 11, 3073, 5, 3076, 5, 3079, 5, 3091, 10, 3106, 5, 3108, 5, 3109, 5, 3141, 5, 3142, 5, 3167, 4, 3337, 5, 3347, 5, 3348, 5, 3359, 10, 3360, 5, 3361, 11, 3362, 5, 3363, 10, 3364, 5, 3365, 10, 3366, 14, 3402, 5, 3403, 5, 3405, 5, 3406, 5, 3439, 5, 3440, 5, 3447, 5, 3449, 5, 3450, 5, 3453, 10, 3454, 10, 3460, 5, 3479, 11, 3480, 5, 3481, 11, 3482, 5, 3483, 11, 3484, 5, 3485, 10, 3486, 5, 3487, 10, 3488, 5, 3489, 5, 3490, 10, 3491, 5, 3492, 10, 3493, 5, 3494, 10, 3495, 5, 3496, 10, 3497, 5, 3498, 10, 3499, 5, 3500, 10, 3501, 5, 3502, 10, 3503, 5, 3504, 10, 3505, 5, 3506, 10, 3507, 5, 3508, 10, 3509, 5, 3510, 10, 3511, 5, 3512, 10, 3513, 5, 3514, 5, 3515, 10, 3516, 5, 3517, 10, 3518, 5, 3519, 10, 3520, 5, 3521, 10, 3522, 5, 3523, 10, 3524, 5, 3525, 10, 3526, 5, 3527, 10, 3528, 5, 3529, 10, 3530, 5, 3531, 10, 3532, 5, 3533, 10, 3534, 5, 3535, 10, 3536, 5, 3537, 10, 3538, 5, 3539, 10, 3540, 5, 3541, 10, 3542, 5, 3543, 10, 3544, 5, 3545, 10, 3546, 5, 3547, 10, 3548, 5, 3549, 10, 3550, 5, 3551, 10, 3552, 5, 3553, 10, 3582, 10, 3583, 5, 3584, 10, 3585, 5, 3586, 10, 3587, 5, 3588, 11, 3589, 5, 3590, 11, 3591, 5, 3592, 5, 3593, 11, 3598, 10, 3599, 5, 3600, 10, 3605, 11, 3606, 5, 3607, 5, 3608, 10, 3609, 5, 3610, 10, 3611, 5, 3612, 10, 3613, 5, 3614, 10, 3615, 5, 3616, 10, 3617, 5, 3618, 10, 3619, 5, 3620, 10, 3621, 5, 3622, 10, 3623, 5, 3624, 10, 3625, 5, 3626, 10, 3627, 5, 3628, 10, 3629, 5, 3630, 10, 3631, 5, 3632, 10, 3633, 5, 3634, 11, 3635, 5, 3636, 11, 3640, 10, 3641, 5, 3642, 10, 3643, 5, 3644, 11, 3645, 5, 3646, 11, 3647, 5, 3648, 11, 3649, 5, 3650, 10, 3651, 5, 3652, 10, 3653, 5, 3654, 10, 3655, 5, 3656, 11, 3657, 5, 3658, 10, 3659, 5, 3660, 10, 3661, 5, 3662, 10, 3663, 5, 3664, 10, 3668, 10, 3669, 5, 3670, 10, 3671, 5, 3672, 10, 3673, 5, 3674, 10, 3675, 5, 3676, 11, 3677, 10, 3678, 5, 3679, 11, 3680, 10, 3681, 5, 3682, 11, 3683, 10, 3684, 5, 3685, 5, 3686, 10, 3687, 5, 3688, 10, 3689, 5, 3690, 10, 3691, 5, 3692, 10, 3696, 10, 3697, 5, 3698, 10, 3699, 5, 3700, 10, 3740, 5, 3749, 5, 3783, 5, 3784, 5, 3793, 5, 3794, 5, 3802, 5, 3816, 5, 3829, 5, 3854, 5, 3911, 5, 3912, 5, 3920, 5, 3978, 5, 3979, 5, 3991, 10, 3992, 10, 4026, 5, 4037, 5, 4038, 5, 4087, 5, 4088, 5, 4217, 10, 4438, 10, 4439, 10, 4467, 5, 4471, 5, 4474, 5, 4559, 5, 4822, 5, 4839, 5, 5018, 5, 5048, 5, 5167, 5, 5168, 5, 5223, 5, 5234, 5, 5235, 5, 5243, 5, 5266, 5, 5316, 5, 5320, 5, 5321, 5, 5330, 5, 5331, 5, 5337, 5, 5361, 5, 5362, 5, 5382, 5, 5383, 5, 5396, 5, 5456, 5, 5457, 5, 5469, 5, 5472, 9, 5490, 5, 5518, 5, 5523, 5, 5559, 5, 5588, 11, 5589, 14, 5596, 5, 5627, 5, 5629, 5, 5641, 5, 5643, 5, 5644, 5, 5654, 10, 5655, 10, 5659, 5, 5700, 5, 5825, 5, 5836, 5, 5837, 5, 5842, 5, 5844, 5, 5880, 5, 5887, 5, 5890, 5, 6128, 11, 6129, 11, 6141, 11, 6204, 5, 6210, 5, 6211, 5, 6307, 5, 6312, 5, 6316, 5, 6362, 5, 6591, 5, 6646, 5, 6703, 5, 6786, 5, 6787, 11, 6790, 5, 6791, 11, 6794, 5, 6795, 11, 6798, 5, 6799, 11, 6802, 5, 6803, 11, 6806, 5, 6807, 11, 6810, 5, 6811, 11, 6814, 5, 6815, 11, 6818, 5, 6819, 11, 6822, 5, 6823, 11, 6826, 5, 6827, 11, 6830, 5, 6831, 11, 6834, 5, 6835, 11, 6838, 5, 6839, 11, 6842, 5, 6843, 11, 6846, 5, 6847, 11, 6850, 5, 6851, 11, 6854, 5, 6855, 11, 6858, 5, 6859, 11, 6862, 5, 6863, 11, 6870, 5, 6875, 5, 6876, 5, 6915, 5, 6922, 5, 6923, 10, 6924, 5, 6925, 10, 6962, 5, 6984, 5, 6991, 5, 7128, 10, 7131, 5, 7132, 10, 7257, 5, 7258, 10, 7259, 5, 7260, 10, 7261, 5, 7262, 10, 7263, 5, 7264, 10, 7265, 5, 7266, 10, 7267, 5, 7268, 10, 7269, 5, 7270, 10, 7271, 5, 7272, 10, 7273, 5, 7274, 10, 7275, 5, 7276, 10, 7277, 5, 7278, 10, 7279, 5, 7280, 10, 7281, 5, 7282, 10, 7283, 5, 7284, 10, 7285, 5, 7286, 10, 7287, 5, 7288, 10, 7289, 5, 7290, 10, 7291, 5, 7292, 10, 7293, 5, 7294, 10, 7295, 5, 7296, 10, 7297, 5, 7298, 10, 7299, 5, 7300, 10, 7301, 5, 7302, 10, 7303, 5, 7304, 10, 7305, 5, 7306, 10, 7307, 5, 7308, 10, 7309, 5, 7310, 10, 7311, 5, 7312, 10, 7313, 5, 7314, 10, 7315, 5, 7316, 10, 7317, 5, 7318, 10, 7319, 5, 7320, 10, 7321, 5, 7322, 10, 7323, 5, 7324, 10, 7325, 5, 7326, 10, 7327, 5, 7328, 10, 7329, 5, 7330, 10, 7331, 5, 7332, 10, 7333, 5, 7334, 10, 7335, 5, 7336, 10, 7337, 5, 7338, 10, 7339, 5, 7340, 10, 7341, 5, 7342, 10, 7343, 5, 7344, 10, 7345, 5, 7346, 10, 7347, 5, 7348, 10, 7349, 5, 7350, 10, 7351, 5, 7352, 10, 7353, 5, 7354, 10, 7355, 5, 7356, 10, 7357, 5, 7358, 10, 7359, 5, 7360, 10, 7361, 5, 7362, 10, 7363, 5, 7364, 10, 7365, 5, 7366, 10, 7367, 5, 7368, 10, 7369, 5, 7370, 10, 7877, 5, 7878, 5, 7882, 5, 7883, 5, 7887, 5, 7899, 5, 7991, 5, 7992, 5, 8035, 10, 8036, 10, 8058, 5, 8059, 5, 8082, 5, 8083, 5, 8088, 5, 8137, 5, 8138, 10, 8157, 5, 8158, 10, 8159, 5, 8160, 10, 8167, 5, 8168, 10, 8169, 5, 8170, 10, 8187, 5, 8189, 10, 8205, 5, 8206, 10, 8225, 5, 8226, 10, 8311, 5, 8312, 11, 8313, 5, 8314, 11, 8315, 5, 8316, 11, 8317, 5, 8318, 11, 8319, 5, 8320, 11, 8321, 5, 8322, 11, 8323, 5, 8324, 11, 8325, 5, 8326, 11, 8327, 5, 8328, 11, 8329, 5, 8330, 11, 8331, 5, 8332, 11, 8333, 5, 8334, 11, 8335, 5, 8336, 11, 8337, 5, 8338, 11, 8339, 5, 8340, 11, 8341, 5, 8342, 11, 8343, 5, 8344, 11, 8345, 5, 8346, 11, 8347, 5, 8348, 11, 8352, 5, 8353, 5, 8379, 5, 8380, 10, 8381, 5, 8382, 10, 8383, 5, 8384, 10, 8385, 5, 8387, 10, 8391, 5, 8395, 5, 8433, 5, 8455, 5, 8456, 5, 8531, 10, 8682, 5, 8687, 5, 8692, 5, 8903, 5, 8950, 5, 8951, 5, 9039, 5, 9040, 5, 9141, 5, 9149, 5, 9150, 5, 9191, 5, 9221, 5, 9222, 5, 20499, 5, 20538, 5, 20539, 5, 20790, 5, 20791, 5, 21291, 5, 21292, 5, 21500, 5, 21817, 5, 21818, 5, 22032, 5, 22033, 5, 22091, 5, 22092, 5, 22332, 5, 22391, 5, 22392, 5, 22700, 5, 22770, 5, 22780, 5, 22832, 5, 23090, 5, 23095, 5, 23239, 5, 23240, 5, 23433, 5, 23700, 5, 24047, 5, 24048, 5, 24100, 14, 24200, 5, 24305, 5, 24306, 5, 24382, 6, 24383, 5, 24500, 5, 24547, 5, 24548, 5, 24571, 2, 24600, 5, 25e3, 5, 25231, 5, 25884, 5, 25932, 5, 26237, 5, 26331, 5, 26332, 5, 26591, 5, 26592, 5, 26632, 5, 26692, 5, 26855, 10, 26856, 10, 27120, 5, 27200, 5, 27291, 7, 27292, 7, 27429, 5, 27492, 5, 27500, 5, 27700, 5, 28232, 5, 28600, 5, 28991, 5, 28992, 5, 29100, 5, 29220, 5, 29221, 5, 29333, 5, 29635, 5, 29636, 5, 29701, 5, 29738, 5, 29739, 5, 29849, 5, 29850, 5, 29871, 3, 29872, 13, 29873, 5, 29900, 5, 29901, 5, 29903, 5, 30200, 15, 30339, 5, 30340, 5, 30791, 5, 30792, 5, 31028, 5, 31121, 5, 31154, 5, 31170, 5, 31171, 5, 31370, 5, 31528, 5, 31529, 5, 31600, 5, 31700, 5, 31838, 5, 31839, 5, 31901, 5, 32061, 5, 32062, 5, 32098, 5, 32099, 10, 32100, 5, 32104, 5, 32161, 5, 32766, 5, 53048, 5, 53049, 5, 54090, 5, 54091, 5, 65061, 10, 65062, 10, 65161, 5, 65163, 5, 102041, 10, 102064, 8, 102068, 1, 102069, 0, 102118, 10, 102119, 11, 102120, 10, 102121, 10, 102217, 10, 102218, 5, 102219, 10, 102220, 10, 102378, 11, 102379, 11, 102380, 5, 102381, 11, 102498, 5, 102499, 5, 102589, 10, 102590, 5, 102599, 10, 102600, 10, 102604, 10, 102605, 5, 102606, 5, 102647, 5, 102704, 10, 102705, 10, 102706, 5, 102733, 10, 102761, 10, 102762, 5, 102763, 10, 102764, 5, 102765, 5, 102766, 10, 102962, 5, 102963, 5, 102970, 11, 102974, 10, 102993, 5, 102994, 5, 102995, 10, 102996, 10, 103015, 5, 103016, 10, 103017, 5, 103018, 10, 103025, 5, 103026, 5, 103027, 10, 103028, 10, 103035, 5, 103036, 5, 103037, 10, 103038, 10, 103039, 5, 103040, 5, 103041, 10, 103042, 10, 103043, 5, 103044, 5, 103045, 10, 103046, 10, 103047, 5, 103048, 5, 103049, 10, 103050, 10, 103051, 5, 103052, 10, 103053, 5, 103054, 10, 103055, 5, 103056, 10, 103057, 5, 103058, 5, 103059, 10, 103060, 10, 103061, 5, 103062, 5, 103063, 10, 103064, 10, 103069, 10, 103070, 5, 103071, 5, 103072, 10, 103073, 10, 103086, 5, 103087, 5, 103088, 10, 103089, 10, 103094, 11, 103095, 5, 103096, 10, 103103, 5, 103104, 10, 103105, 5, 103106, 10, 103121, 5, 103122, 10, 103123, 5, 103124, 5, 103125, 11, 103126, 11, 103127, 5, 103128, 5, 103129, 10, 103130, 10, 103131, 5, 103132, 5, 103133, 10, 103134, 10, 103135, 5, 103136, 5, 103137, 11, 103138, 11, 103139, 5, 103140, 10, 103141, 5, 103142, 10, 103143, 5, 103144, 10, 103145, 5, 103146, 11, 103147, 5, 103148, 5, 103149, 10, 103150, 10, 103151, 5, 103152, 10, 103172, 5, 103173, 10, 103174, 5, 103175, 5, 103176, 10, 103177, 10, 103178, 5, 103179, 5, 103180, 10, 103181, 10, 103182, 5, 103183, 5, 103184, 10, 103185, 10, 103228, 5, 103229, 5, 103230, 10, 103231, 10, 103250, 5, 103251, 10, 103252, 5, 103253, 10, 103260, 5, 103261, 5, 103262, 10, 103263, 10, 103270, 5, 103271, 5, 103272, 10, 103273, 10, 103274, 5, 103275, 5, 103276, 10, 103277, 10, 103278, 5, 103279, 5, 103280, 10, 103281, 10, 103282, 5, 103283, 5, 103284, 10, 103285, 10, 103286, 5, 103287, 10, 103288, 5, 103289, 10, 103290, 5, 103291, 10, 103292, 5, 103293, 5, 103294, 10, 103295, 10, 103296, 5, 103297, 5, 103298, 10, 103299, 10, 103376, 10, 103377, 5, 103378, 5, 103379, 10, 103380, 10, 103393, 5, 103394, 5, 103395, 10, 103396, 10, 103472, 5, 103473, 11, 103474, 5, 103475, 10, 103482, 5, 103483, 10, 103484, 5, 103485, 10, 103500, 5, 103501, 10, 103502, 5, 103503, 5, 103504, 11, 103505, 11, 103506, 5, 103507, 5, 103508, 10, 103509, 10, 103510, 5, 103511, 5, 103512, 10, 103513, 10, 103514, 5, 103515, 10, 103516, 5, 103517, 10, 103518, 5, 103519, 10, 103520, 5, 103521, 11, 103522, 5, 103523, 5, 103524, 10, 103525, 10, 103526, 5, 103527, 10, 103561, 10, 103562, 10, 103563, 5, 103564, 5, 103565, 10, 103566, 10, 103567, 5, 103568, 5, 103569, 10, 103570, 10, 103585, 10, 103586, 5, 103587, 10, 103588, 11, 103589, 5, 103590, 10, 103591, 11, 103592, 5, 103593, 10, 103594, 11, 103695, 10, 103846, 5, 103946, 10], pcsidc: [[2e3, 2045, 5], [2056, 2065, 5], [2067, 2135, 5], [2137, 2153, 5], [2161, 2170, 5], [2172, 2193, 5], [2196, 2198, 5], [2200, 2203, 5], [2206, 2217, 5], [2222, 2224, 11], [2251, 2253, 11], [2280, 2282, 11], [2308, 2311, 5], [2315, 2325, 5], [2327, 2394, 5], [2400, 2491, 5], [2494, 2758, 5], [2867, 2869, 11], [2870, 2888, 10], [2891, 2895, 10], [2896, 2898, 11], [2902, 2908, 10], [2915, 2920, 10], [2921, 2923, 11], [2924, 2930, 10], [2931, 2941, 5], [2969, 2973, 5], [2975, 2982, 5], [2984, 2988, 5], [2995, 3002, 5], [3006, 3051, 5], [3054, 3059, 5], [3061, 3066, 5], [3068, 3071, 5], [3084, 3087, 5], [3112, 3118, 5], [3120, 3138, 5], [3146, 3151, 5], [3153, 3157, 5], [3161, 3166, 5], [3168, 3172, 5], [3174, 3203, 5], [3294, 3313, 5], [3315, 3335, 5], [3339, 3345, 5], [3350, 3358, 5], [3367, 3369, 5], [3374, 3388, 5], [3391, 3399, 5], [3408, 3416, 5], [3425, 3432, 10], [3441, 3446, 10], [3456, 3459, 10], [3465, 3478, 5], [3554, 3559, 5], [3561, 3565, 10], [3568, 3570, 10], [3571, 3581, 5], [3594, 3597, 5], [3601, 3604, 5], [3637, 3639, 5], [3665, 3667, 5], [3693, 3695, 5], [3701, 3727, 5], [3728, 3733, 10], [3744, 3747, 5], [3753, 3758, 10], [3761, 3763, 5], [3765, 3769, 5], [3779, 3781, 5], [3788, 3791, 5], [3797, 3799, 5], [3832, 3841, 5], [3844, 3852, 5], [3873, 3885, 5], [3890, 3893, 5], [3942, 3950, 5], [3968, 3970, 5], [3973, 3976, 5], [3986, 3989, 5], [3994, 3997, 5], [4390, 4398, 5], [4399, 4413, 10], [4418, 4433, 10], [4491, 4554, 5], [4568, 4589, 5], [4652, 4656, 5], [4766, 4800, 5], [5069, 5072, 5], [5105, 5130, 5], [5180, 5184, 5], [5253, 5259, 5], [5269, 5275, 5], [5292, 5311, 5], [5343, 5349, 5], [5355, 5357, 5], [5387, 5389, 5], [5459, 5463, 5], [5479, 5482, 5], [5530, 5539, 5], [5550, 5552, 5], [5562, 5583, 5], [5623, 5625, 10], [5631, 5639, 5], [5649, 5653, 5], [5663, 5680, 5], [5682, 5685, 5], [5875, 5877, 5], [5896, 5899, 5], [5921, 5940, 5], [6050, 6125, 5], [6351, 6354, 5], [6366, 6372, 5], [6381, 6387, 5], [6622, 6624, 5], [6707, 6709, 5], [6720, 6723, 5], [6732, 6738, 5], [6931, 6933, 5], [7005, 7007, 5], [7057, 7070, 10], [7074, 7082, 5], [7109, 7118, 5], [7119, 7127, 11], [7374, 7376, 5], [7528, 7586, 5], [7587, 7645, 10], [7755, 7787, 5], [7791, 7795, 5], [7799, 7801, 5], [7803, 7805, 5], [7825, 7831, 5], [7845, 7859, 5], [8013, 8032, 5], [8065, 8068, 11], [8518, 8529, 10], [8533, 8536, 10], [8538, 8540, 10], [8677, 8679, 5], [8836, 8840, 5], [8908, 8910, 5], [9154, 9159, 5], [9205, 9218, 5], [20002, 20032, 5], [20062, 20092, 5], [20135, 20138, 5], [20248, 20258, 5], [20348, 20358, 5], [20436, 20440, 5], [20822, 20824, 5], [20934, 20936, 5], [21035, 21037, 5], [21095, 21097, 5], [21148, 21150, 5], [21413, 21423, 5], [21473, 21483, 5], [21780, 21782, 5], [21891, 21894, 5], [22171, 22177, 5], [22181, 22187, 5], [22191, 22197, 5], [22234, 22236, 5], [22521, 22525, 5], [22991, 22994, 5], [23028, 23038, 5], [23830, 23853, 5], [23866, 23872, 5], [23877, 23884, 5], [23886, 23894, 5], [23946, 23948, 5], [24311, 24313, 5], [24342, 24347, 5], [24370, 24374, 6], [24375, 24381, 5], [24718, 24721, 5], [24817, 24821, 5], [24877, 24882, 5], [24891, 24893, 5], [25391, 25395, 5], [25828, 25838, 5], [26191, 26195, 5], [26391, 26393, 5], [26703, 26722, 5], [26729, 26760, 10], [26766, 26798, 10], [26860, 26870, 10], [26891, 26899, 5], [26903, 26923, 5], [26929, 26946, 5], [26948, 26998, 5], [27037, 27040, 5], [27205, 27232, 5], [27258, 27260, 5], [27391, 27398, 5], [27561, 27564, 5], [27571, 27574, 5], [27581, 27584, 5], [27591, 27594, 5], [28191, 28193, 5], [28348, 28358, 5], [28402, 28432, 5], [28462, 28492, 5], [29118, 29122, 5], [29177, 29185, 5], [30161, 30179, 5], [30491, 30494, 5], [30729, 30732, 5], [31251, 31259, 5], [31265, 31268, 5], [31275, 31278, 5], [31288, 31297, 5], [31461, 31465, 5], [31491, 31495, 5], [31917, 31922, 5], [31965, 31985, 5], [31992, 32e3, 5], [32001, 32003, 10], [32005, 32031, 10], [32033, 32060, 10], [32074, 32077, 10], [32081, 32086, 5], [32107, 32130, 5], [32133, 32158, 5], [32164, 32167, 10], [32180, 32199, 5], [32201, 32260, 5], [32301, 32360, 5], [32601, 32662, 5], [32664, 32667, 10], [32701, 32761, 5], [53001, 53004, 5], [53008, 53019, 5], [53021, 53032, 5], [53034, 53037, 5], [53042, 53046, 5], [53074, 53080, 5], [54001, 54004, 5], [54008, 54019, 5], [54021, 54032, 5], [54034, 54037, 5], [54042, 54046, 5], [54048, 54053, 5], [54074, 54080, 5], [54098, 54101, 5], [102001, 102040, 5], [102042, 102063, 5], [102065, 102067, 5], [102070, 102112, 5], [102114, 102117, 5], [102122, 102208, 5], [102210, 102216, 5], [102221, 102300, 5], [102304, 102377, 5], [102382, 102388, 5], [102389, 102398, 10], [102399, 102444, 5], [102445, 102447, 10], [102448, 102458, 5], [102459, 102468, 10], [102469, 102496, 5], [102500, 102519, 11], [102520, 102524, 5], [102525, 102529, 10], [102530, 102549, 5], [102557, 102588, 5], [102593, 102598, 5], [102601, 102603, 5], [102608, 102628, 5], [102629, 102646, 10], [102648, 102672, 10], [102675, 102700, 10], [102701, 102703, 5], [102707, 102730, 10], [102735, 102758, 10], [102767, 102900, 5], [102965, 102969, 5], [102971, 102973, 5], [102975, 102989, 5], [102990, 102992, 11], [102997, 103002, 5], [103003, 103008, 10], [103009, 103011, 5], [103012, 103014, 10], [103019, 103021, 5], [103022, 103024, 10], [103029, 103031, 5], [103032, 103034, 10], [103065, 103068, 5], [103074, 103076, 5], [103077, 103079, 11], [103080, 103082, 5], [103083, 103085, 10], [103090, 103093, 5], [103097, 103099, 5], [103100, 103102, 10], [103107, 103109, 5], [103110, 103112, 10], [103113, 103116, 5], [103117, 103120, 10], [103153, 103157, 5], [103158, 103162, 10], [103163, 103165, 5], [103166, 103168, 11], [103169, 103171, 10], [103186, 103188, 5], [103189, 103191, 10], [103192, 103195, 5], [103196, 103199, 10], [103200, 103224, 5], [103225, 103227, 11], [103232, 103237, 5], [103238, 103243, 10], [103244, 103246, 5], [103247, 103249, 10], [103254, 103256, 5], [103257, 103259, 10], [103264, 103266, 5], [103267, 103269, 10], [103300, 103375, 5], [103381, 103383, 5], [103384, 103386, 11], [103387, 103389, 5], [103390, 103392, 10], [103397, 103399, 5], [103400, 103471, 10], [103476, 103478, 5], [103479, 103481, 10], [103486, 103488, 5], [103489, 103491, 10], [103492, 103495, 5], [103496, 103499, 10], [103539, 103543, 5], [103544, 103548, 10], [103549, 103551, 5], [103552, 103554, 11], [103555, 103557, 10], [103558, 103560, 5], [103571, 103573, 5], [103574, 103576, 10], [103577, 103580, 5], [103581, 103583, 10], [103595, 103597, 5], [103600, 103694, 5], [103696, 103698, 5], [103700, 103793, 10], [103794, 103799, 5]], gcsid: [4001, 81, 4002, 85, 4003, 70, 4004, 84, 4005, 82, 4006, 83, 4007, 60, 4008, 67, 4009, 39, 4010, 57, 4011, 63, 4012, 64, 4013, 64, 4014, 63, 4015, 92, 4016, 90, 4018, 86, 4019, 75, 4020, 68, 4021, 70, 4022, 55, 4023, 75, 4024, 66, 4025, 73, 4027, 95, 4028, 59, 4029, 58, 4031, 75, 4032, 78, 4033, 77, 4034, 65, 4035, 100, 4036, 70, 4042, 88, 4044, 87, 4045, 89, 4046, 75, 4047, 99, 4052, 101, 4053, 97, 4054, 61, 4075, 75, 4081, 75, 4120, 84, 4121, 75, 4122, 80, 4123, 55, 4124, 84, 4126, 75, 4130, 75, 4131, 92, 4132, 64, 4133, 75, 4134, 64, 4140, 75, 4141, 75, 4142, 64, 4143, 64, 4144, 92, 4145, 87, 4146, 89, 4147, 66, 4148, 75, 4149, 84, 4150, 84, 4151, 75, 4152, 75, 4153, 55, 4154, 55, 4155, 63, 4156, 84, 4157, 60, 4162, 84, 4163, 75, 4164, 66, 4165, 55, 4166, 75, 4168, 58, 4170, 75, 4172, 75, 4173, 75, 4174, 58, 4175, 64, 4176, 75, 4178, 66, 4179, 66, 4180, 75, 4188, 81, 4190, 75, 4191, 66, 4192, 55, 4193, 63, 4198, 64, 4199, 55, 4200, 66, 4201, 64, 4202, 70, 4203, 70, 4204, 55, 4205, 66, 4206, 63, 4207, 55, 4208, 55, 4209, 64, 4210, 64, 4211, 84, 4212, 64, 4213, 63, 4214, 66, 4215, 55, 4216, 67, 4218, 55, 4219, 84, 4220, 64, 4221, 55, 4222, 64, 4224, 55, 4225, 55, 4229, 68, 4230, 55, 4231, 55, 4232, 64, 4234, 64, 4235, 55, 4236, 55, 4237, 70, 4238, 70, 4239, 92, 4240, 92, 4241, 65, 4242, 67, 4243, 88, 4244, 92, 4245, 86, 4246, 64, 4250, 64, 4251, 64, 4252, 63, 4253, 67, 4254, 55, 4255, 55, 4256, 64, 4257, 84, 4258, 75, 4259, 55, 4260, 64, 4261, 106, 4262, 84, 4263, 64, 4265, 55, 4266, 63, 4267, 67, 4269, 75, 4270, 64, 4271, 55, 4272, 55, 4273, 82, 4274, 55, 4275, 63, 4276, 73, 4280, 84, 4281, 57, 4282, 63, 4283, 75, 4284, 66, 4285, 55, 4286, 68, 4288, 55, 4289, 84, 4291, 70, 4292, 55, 4293, 83, 4294, 84, 4295, 84, 4296, 63, 4297, 55, 4298, 90, 4299, 85, 4300, 85, 4301, 84, 4302, 60, 4303, 68, 4306, 84, 4307, 64, 4308, 84, 4309, 55, 4310, 63, 4311, 55, 4312, 84, 4313, 55, 4314, 84, 4315, 63, 4316, 55, 4317, 66, 4318, 75, 4319, 75, 4322, 80, 4324, 80, 4326, 75, 4466, 75, 4469, 75, 4475, 55, 4483, 75, 4490, 75, 4555, 66, 4558, 75, 4608, 67, 4609, 67, 4610, 74, 4614, 55, 4619, 75, 4624, 75, 4625, 55, 4627, 75, 4636, 55, 4637, 55, 4638, 67, 4639, 55, 4657, 93, 4659, 75, 4660, 55, 4661, 75, 4666, 84, 4667, 75, 4670, 75, 4671, 63, 4674, 75, 4679, 64, 4680, 64, 4682, 92, 4683, 67, 4686, 75, 4687, 75, 4693, 75, 4694, 75, 4695, 67, 4696, 64, 4697, 64, 4702, 75, 4703, 64, 4704, 55, 4705, 55, 4706, 68, 4718, 55, 4720, 80, 4721, 55, 4723, 67, 4726, 67, 4737, 75, 4738, 60, 4740, 79, 4741, 55, 4742, 75, 4743, 64, 4744, 64, 4745, 84, 4746, 84, 4747, 75, 4748, 56, 4749, 75, 4750, 75, 4751, 91, 4752, 56, 4753, 55, 4754, 55, 4759, 75, 4761, 75, 4801, 84, 4802, 55, 4803, 55, 4804, 84, 4805, 84, 4806, 55, 4807, 106, 4808, 84, 4809, 55, 4810, 105, 4811, 106, 4816, 106, 4817, 82, 4818, 84, 4820, 84, 4821, 106, 4823, 55, 4824, 55, 4901, 107, 4902, 107, 4903, 59, 4904, 84, 5228, 84, 5229, 84, 5233, 92, 5252, 75, 5264, 75, 5340, 75, 5354, 75, 5360, 75, 5371, 75, 5373, 75, 5381, 75, 5393, 75, 5464, 60, 5467, 67, 5489, 75, 5524, 55, 5527, 70, 5546, 75, 5561, 66, 5593, 75, 5681, 84, 5886, 75, 6135, 75, 6365, 75, 6706, 75, 6881, 64, 6882, 64, 6883, 55, 6892, 64, 6894, 64, 6980, 75, 6983, 75, 6987, 75, 6990, 75, 7035, 75, 7037, 75, 7039, 75, 7041, 75, 7073, 75, 7084, 75, 7086, 75, 7133, 75, 7373, 75, 7683, 76, 7798, 75, 7844, 75, 7881, 75, 7886, 75, 8042, 96, 8043, 96, 8086, 75, 8232, 75, 8237, 75, 8240, 75, 8246, 75, 8249, 75, 8252, 75, 8255, 75, 8351, 84, 8427, 75, 8428, 55, 8449, 75, 8545, 75, 8685, 75, 8694, 64, 8699, 75, 8818, 75, 8888, 75, 8900, 75, 8902, 75, 8907, 75, 8949, 75, 9003, 75, 9006, 75, 9009, 75, 9012, 75, 9017, 75, 9068, 75, 9069, 75, 9140, 75, 9148, 75, 9153, 75, 37001, 73, 37002, 69, 37003, 72, 37004, 71, 37005, 62, 37006, 91, 37007, 94, 37008, 101, 37201, 55, 37202, 92, 37203, 87, 37204, 55, 37205, 55, 37206, 64, 37207, 71, 37208, 64, 37211, 64, 37220, 67, 37221, 55, 37222, 55, 37223, 63, 37224, 55, 37225, 106, 37226, 55, 37227, 55, 37228, 64, 37229, 62, 37230, 55, 37231, 70, 37232, 55, 37233, 55, 37235, 55, 37237, 55, 37238, 55, 37239, 67, 37240, 64, 37241, 55, 37242, 55, 37243, 67, 37252, 67, 37253, 55, 37254, 64, 37255, 84, 37257, 66, 37259, 55, 37260, 67, 104017, 79, 104018, 79, 104024, 75, 104027, 75, 104047, 98, 104050, 75, 104100, 75, 104101, 84, 104102, 84, 104103, 64, 104104, 55, 104105, 84, 104106, 55, 104107, 75, 104108, 75, 104109, 67, 104110, 75, 104111, 75, 104112, 67, 104113, 67, 104128, 102, 104129, 75, 104130, 55, 104131, 84, 104132, 67, 104133, 75, 104134, 75, 104135, 66, 104136, 70, 104137, 75, 104138, 55, 104139, 106, 104140, 106, 104223, 75, 104248, 55, 104256, 92, 104261, 63, 104286, 75, 104287, 75, 104304, 63, 104700, 49, 104701, 9, 104702, 24, 104703, 15, 104704, 28, 104705, 32, 104706, 53, 104707, 46, 104708, 37, 104709, 54, 104710, 11, 104711, 14, 104712, 30, 104713, 52, 104714, 4, 104715, 4, 104716, 23, 104717, 14, 104718, 48, 104719, 29, 104720, 22, 104721, 21, 104722, 35, 104723, 21, 104724, 46, 104725, 22, 104726, 49, 104727, 45, 104728, 52, 104729, 10, 104730, 10, 104731, 21, 104732, 31, 104733, 26, 104734, 40, 104735, 19, 104736, 30, 104737, 34, 104738, 27, 104739, 46, 104740, 5, 104741, 12, 104742, 50, 104743, 9, 104744, 43, 104745, 21, 104746, 26, 104747, 25, 104748, 21, 104749, 7, 104750, 53, 104751, 6, 104752, 33, 104753, 29, 104754, 19, 104755, 41, 104756, 31, 104757, 3, 104758, 41, 104759, 25, 104760, 49, 104761, 41, 104762, 44, 104763, 50, 104764, 46, 104765, 6, 104766, 40, 104767, 16, 104768, 8, 104769, 17, 104770, 48, 104771, 42, 104772, 50, 104773, 25, 104774, 29, 104775, 25, 104776, 32, 104777, 13, 104778, 36, 104779, 47, 104780, 14, 104781, 29, 104782, 23, 104783, 38, 104784, 42, 104785, 18, 104786, 20, 104808, 51, 104896, 75, 104900, 112, 104901, 104, 104902, 103, 104903, 116, 104904, 109, 104905, 108, 104906, 169, 104907, 164, 104908, 0, 104909, 168, 104910, 141, 104911, 166, 104912, 114, 104913, 160, 104914, 151, 104915, 117, 104916, 110, 104917, 140, 104918, 115, 104919, 170, 104920, 163, 104921, 154, 104922, 158, 104923, 161, 104924, 148, 104925, 0, 104926, 159, 104927, 167, 104928, 127, 104929, 131, 104930, 145, 104931, 159, 104932, 136, 104933, 123, 104934, 139, 104935, 134, 104936, 166, 104937, 150, 104938, 137, 104939, 147, 104940, 121, 104941, 165, 104942, 128, 104943, 111, 104944, 1, 104945, 126, 104946, 152, 104947, 157, 104948, 162, 104949, 153, 104950, 156, 104951, 149, 104952, 132, 104953, 122, 104954, 160, 104955, 146, 104956, 143, 104957, 156, 104958, 120, 104959, 125, 104960, 2, 104961, 144, 104962, 142, 104963, 138, 104964, 155, 104965, 135, 104966, 133, 104967, 151, 104968, 118, 104969, 119, 104970, 124, 104971, 108, 104972, 129, 104973, 130, 104974, 113, 104975, 0, 104990, 84, 104991, 75, 104992, 84], gcsidc: [[4127, 4129, 67], [4135, 4139, 67], [4158, 4161, 55], [4181, 4185, 55], [4194, 4196, 55], [4226, 4228, 63], [4247, 4249, 55], [4277, 4279, 81], [4600, 4607, 64], [4621, 4623, 55], [4628, 4633, 55], [4641, 4646, 55], [4662, 4665, 55], [4676, 4678, 66], [4688, 4692, 55], [4699, 4701, 64], [4755, 4757, 75], [4763, 4765, 75], [4813, 4815, 84], [8972, 8987, 75], [37212, 37219, 55], [37245, 37247, 55], [37249, 37251, 55], [104009, 104015, 75], [104019, 104022, 75], [104114, 104124, 75], [104125, 104127, 55], [104141, 104145, 75], [104179, 104186, 75], [104257, 104260, 75]] }, H = { c: [[2e3, 2035, 9001], [2039, 2045, 9001], [2056, 2062, 9001], [2067, 2090, 9001], [2093, 2135, 9001], [2161, 2165, 9001], [2172, 2180, 9001], [2188, 2193, 9001], [2195, 2198, 9001], [2200, 2203, 9001], [2205, 2213, 9001], [2215, 2217, 9001], [2222, 2224, 9002], [2225, 2243, 9003], [2246, 2250, 9003], [2251, 2253, 9002], [2257, 2264, 9003], [2274, 2279, 9003], [2280, 2282, 9002], [2283, 2289, 9003], [2308, 2313, 9001], [2315, 2491, 9001], [2494, 2576, 9001], [2578, 2599, 9001], [2601, 2693, 9001], [2695, 2866, 9001], [2867, 2869, 9002], [2870, 2888, 9003], [2891, 2895, 9003], [2896, 2898, 9002], [2902, 2908, 9003], [2915, 2920, 9003], [2921, 2923, 9002], [2924, 2930, 9003], [2931, 2933, 9001], [2935, 2962, 9001], [2964, 2968, 9003], [2969, 2973, 9001], [2975, 2978, 9001], [2984, 2988, 9001], [2995, 3051, 9001], [3054, 3072, 9001], [3077, 3079, 9001], [3081, 3088, 9001], [3092, 3101, 9001], [3106, 3138, 9001], [3146, 3151, 9001], [3153, 3166, 9001], [3168, 3172, 9001], [3174, 3203, 9001], [3294, 3313, 9001], [3315, 3348, 9001], [3350, 3358, 9001], [3367, 3403, 9001], [3408, 3416, 9001], [3417, 3438, 9003], [3441, 3446, 9003], [3447, 3450, 9001], [3451, 3453, 9003], [3455, 3459, 9003], [3460, 3478, 9001], [3554, 3559, 9001], [3560, 3570, 9003], [3571, 3581, 9001], [3594, 3597, 9001], [3601, 3604, 9001], [3637, 3639, 9001], [3665, 3667, 9001], [3693, 3695, 9001], [3701, 3727, 9001], [3728, 3739, 9003], [3740, 3751, 9001], [3753, 3760, 9003], [3761, 3773, 9001], [3775, 3777, 9001], [3779, 3781, 9001], [3788, 3791, 9001], [3797, 3802, 9001], [3814, 3816, 9001], [3825, 3829, 9001], [3832, 3841, 9001], [3844, 3852, 9001], [3873, 3885, 9001], [3890, 3893, 9001], [3942, 3950, 9001], [3968, 3970, 9001], [3973, 3976, 9001], [3986, 3989, 9001], [3994, 3997, 9001], [4001, 4016, 9102], [4018, 4025, 9102], [4027, 4029, 9102], [4031, 4036, 9102], [4044, 4047, 9102], [4048, 4051, 9001], [4052, 4054, 9102], [4056, 4063, 9001], [4093, 4096, 9001], [4120, 4124, 9102], [4127, 4139, 9102], [4141, 4176, 9102], [4178, 4185, 9102], [4188, 4216, 9102], [4218, 4232, 9102], [4235, 4260, 9102], [4265, 4267, 9102], [4269, 4286, 9102], [4292, 4304, 9102], [4306, 4319, 9102], [4390, 4398, 9001], [4399, 4413, 9003], [4418, 4433, 9003], [4455, 4457, 9003], [4484, 4489, 9001], [4491, 4554, 9001], [4568, 4589, 9001], [4600, 4630, 9102], [4636, 4639, 9102], [4641, 4646, 9102], [4652, 4656, 9001], [4657, 4680, 9102], [4682, 4684, 9102], [4686, 4765, 9102], [4766, 4800, 9001], [4801, 4806, 9102], [4813, 4815, 9102], [5014, 5016, 9001], [5069, 5072, 9001], [5105, 5130, 9001], [5173, 5188, 9001], [5253, 5259, 9001], [5269, 5275, 9001], [5292, 5311, 9001], [5329, 5331, 9001], [5343, 5349, 9001], [5355, 5357, 9001], [5459, 5463, 9001], [5479, 5482, 9001], [5518, 5520, 9001], [5533, 5539, 9001], [5550, 5552, 9001], [5562, 5583, 9001], [5623, 5625, 9003], [5631, 5639, 9001], [5649, 5653, 9001], [5663, 5680, 9001], [5682, 5685, 9001], [5875, 5877, 9001], [5896, 5899, 9001], [5921, 5940, 9001], [6050, 6125, 9001], [6244, 6275, 9001], [6328, 6348, 9001], [6350, 6356, 9001], [6366, 6372, 9001], [6381, 6387, 9001], [6393, 6404, 9001], [6480, 6483, 9001], [6511, 6514, 9001], [6579, 6581, 9001], [6619, 6624, 9001], [6625, 6627, 9003], [6628, 6632, 9001], [6634, 6637, 9001], [6669, 6692, 9001], [6707, 6709, 9001], [6720, 6723, 9001], [6732, 6738, 9001], [6881, 6883, 9102], [6931, 6933, 9001], [7005, 7007, 9001], [7057, 7070, 9003], [7074, 7082, 9001], [7109, 7118, 9001], [7119, 7127, 9002], [7374, 7376, 9001], [7528, 7586, 9001], [7587, 7645, 9003], [7692, 7696, 9001], [7755, 7787, 9001], [7791, 7795, 9001], [7799, 7801, 9001], [7803, 7805, 9001], [7825, 7831, 9001], [7845, 7859, 9001], [8013, 8032, 9001], [8065, 8068, 9002], [8518, 8529, 9003], [8533, 8536, 9003], [8538, 8540, 9003], [8677, 8679, 9001], [8836, 8840, 9001], [8857, 8859, 9001], [8908, 8910, 9001], [8972, 9e3, 9102], [9053, 9057, 9102], [9059, 9069, 9102], [9154, 9159, 9001], [9205, 9218, 9001], [20002, 20032, 9001], [20062, 20092, 9001], [20135, 20138, 9001], [20248, 20258, 9001], [20348, 20358, 9001], [20436, 20440, 9001], [20822, 20824, 9001], [20934, 20936, 9001], [21035, 21037, 9001], [21095, 21097, 9001], [21148, 21150, 9001], [21413, 21423, 9001], [21473, 21483, 9001], [21780, 21782, 9001], [21896, 21899, 9001], [22171, 22177, 9001], [22181, 22187, 9001], [22191, 22197, 9001], [22234, 22236, 9001], [22521, 22525, 9001], [22991, 22994, 9001], [23028, 23038, 9001], [23830, 23853, 9001], [23866, 23872, 9001], [23877, 23884, 9001], [23886, 23894, 9001], [23946, 23948, 9001], [24311, 24313, 9001], [24342, 24347, 9001], [24370, 24374, 9084], [24375, 24381, 9001], [24718, 24721, 9001], [24817, 24821, 9001], [24877, 24882, 9001], [24891, 24893, 9001], [25391, 25395, 9001], [25828, 25838, 9001], [26191, 26195, 9001], [26391, 26393, 9001], [26701, 26722, 9001], [26729, 26746, 9003], [26748, 26760, 9003], [26766, 26799, 9003], [26847, 26870, 9003], [26891, 26899, 9001], [26901, 26923, 9001], [26929, 26946, 9001], [26948, 26978, 9001], [26980, 26998, 9001], [27037, 27040, 9001], [27205, 27232, 9001], [27258, 27260, 9001], [27391, 27398, 9001], [27561, 27564, 9001], [27571, 27574, 9001], [27581, 27584, 9001], [27591, 27594, 9001], [28191, 28193, 9001], [28348, 28358, 9001], [28402, 28432, 9001], [28462, 28492, 9001], [29168, 29172, 9001], [29187, 29195, 9001], [29901, 29903, 9001], [30161, 30179, 9001], [30491, 30494, 9001], [30729, 30732, 9001], [31251, 31259, 9001], [31265, 31268, 9001], [31275, 31277, 9001], [31281, 31290, 9001], [31466, 31469, 9001], [31491, 31495, 9001], [31965, 32e3, 9001], [32001, 32003, 9003], [32005, 32017, 9003], [32019, 32028, 9003], [32033, 32035, 9003], [32037, 32060, 9003], [32064, 32067, 9003], [32081, 32086, 9001], [32107, 32130, 9001], [32133, 32158, 9001], [32164, 32167, 9003], [32180, 32199, 9001], [32201, 32260, 9001], [32301, 32360, 9001], [32601, 32662, 9001], [32664, 32667, 9003], [32701, 32761, 9001], [37002, 37008, 9102], [53001, 53004, 9001], [53008, 53019, 9001], [53021, 53032, 9001], [53034, 53037, 9001], [53042, 53046, 9001], [53074, 53080, 9001], [54001, 54004, 9001], [54008, 54019, 9001], [54021, 54032, 9001], [54042, 54046, 9001], [54048, 54053, 9001], [54074, 54080, 9001], [54098, 54101, 9001], [102001, 102005, 9001], [102007, 102039, 9001], [102042, 102045, 9001], [102060, 102063, 9001], [102070, 102079, 9001], [102096, 102099, 9001], [102101, 102109, 9001], [102114, 102117, 9001], [102132, 102138, 9001], [102141, 102144, 9001], [102156, 102166, 9001], [102173, 102179, 9001], [102191, 102198, 9001], [102221, 102228, 9001], [102231, 102233, 9001], [102237, 102240, 9001], [102364, 102375, 9001], [102389, 102398, 9003], [102399, 102419, 9001], [102421, 102438, 9001], [102445, 102447, 9003], [102450, 102458, 9001], [102459, 102462, 9003], [102470, 102489, 9001], [102550, 102556, 9001], [102562, 102588, 9001], [102629, 102640, 9003], [102648, 102650, 9003], [102688, 102690, 9003], [102696, 102700, 9003], [102701, 102703, 9001], [102799, 102900, 9001], [103166, 103168, 9002], [103220, 103224, 9001], [103225, 103227, 9002], [103232, 103237, 9001], [103238, 103243, 9003], [103244, 103246, 9001], [103247, 103249, 9003], [103254, 103256, 9001], [103257, 103259, 9003], [103264, 103266, 9001], [103267, 103269, 9003], [103327, 103330, 9001], [103344, 103347, 9001], [103372, 103375, 9001], [103381, 103383, 9001], [103384, 103386, 9002], [103387, 103389, 9001], [103390, 103392, 9003], [103397, 103399, 9001], [103427, 103430, 9003], [103444, 103447, 9003], [103476, 103478, 9001], [103479, 103481, 9003], [103486, 103488, 9001], [103489, 103491, 9003], [103492, 103495, 9001], [103496, 103499, 9003], [103539, 103543, 9001], [103544, 103548, 9003], [103549, 103551, 9001], [103552, 103554, 9002], [103555, 103557, 9003], [103558, 103560, 9001], [103571, 103573, 9001], [103574, 103576, 9003], [103577, 103580, 9001], [103581, 103583, 9003], [103595, 103597, 9001], [103600, 103694, 9001], [103696, 103698, 9001], [103700, 103793, 9003], [104101, 104103, 9102], [104126, 104131, 9102], [104259, 104261, 9102], [104700, 104786, 9102], [104900, 104975, 9102]], nc: [2065, 9001, 2066, 9039, 2136, 9094, 2137, 9001, 2138, 9001, 2154, 9001, 2157, 9001, 2158, 9001, 2159, 9094, 2160, 9094, 2169, 9001, 2170, 9001, 2204, 9003, 2219, 9001, 2220, 9001, 2254, 9003, 2255, 9003, 2256, 9002, 2265, 9002, 2266, 9002, 2267, 9003, 2268, 9003, 2269, 9002, 2270, 9002, 2271, 9003, 2272, 9003, 2273, 9002, 2290, 9001, 2294, 9001, 2295, 9001, 2314, 9005, 2899, 9003, 2900, 9003, 2901, 9002, 2909, 9002, 2910, 9002, 2911, 9003, 2912, 9003, 2913, 9002, 2914, 9002, 2980, 9001, 2981, 9001, 2991, 9001, 2992, 9002, 2993, 9001, 2994, 9002, 3074, 9001, 3075, 9001, 3080, 9002, 3089, 9003, 3090, 9001, 3091, 9003, 3102, 9003, 3141, 9001, 3142, 9001, 3167, 9301, 3360, 9001, 3361, 9002, 3362, 9001, 3363, 9003, 3364, 9001, 3365, 9003, 3404, 9003, 3405, 9001, 3406, 9001, 3407, 9005, 3439, 9001, 3440, 9001, 3479, 9002, 3480, 9001, 3481, 9002, 3482, 9001, 3483, 9002, 3484, 9001, 3485, 9003, 3486, 9001, 3487, 9003, 3488, 9001, 3489, 9001, 3490, 9003, 3491, 9001, 3492, 9003, 3493, 9001, 3494, 9003, 3495, 9001, 3496, 9003, 3497, 9001, 3498, 9003, 3499, 9001, 3500, 9003, 3501, 9001, 3502, 9003, 3503, 9001, 3504, 9003, 3505, 9001, 3506, 9003, 3507, 9001, 3508, 9003, 3509, 9001, 3510, 9003, 3511, 9001, 3512, 9003, 3513, 9001, 3514, 9001, 3515, 9003, 3516, 9001, 3517, 9003, 3518, 9001, 3519, 9003, 3520, 9001, 3521, 9003, 3522, 9001, 3523, 9003, 3524, 9001, 3525, 9003, 3526, 9001, 3527, 9003, 3528, 9001, 3529, 9003, 3530, 9001, 3531, 9003, 3532, 9001, 3533, 9003, 3534, 9001, 3535, 9003, 3536, 9001, 3537, 9003, 3538, 9001, 3539, 9003, 3540, 9001, 3541, 9003, 3542, 9001, 3543, 9003, 3544, 9001, 3545, 9003, 3546, 9001, 3547, 9003, 3548, 9001, 3549, 9003, 3550, 9001, 3551, 9003, 3552, 9001, 3553, 9003, 3582, 9003, 3583, 9001, 3584, 9003, 3585, 9001, 3586, 9003, 3587, 9001, 3588, 9002, 3589, 9001, 3590, 9002, 3591, 9001, 3592, 9001, 3593, 9002, 3598, 9003, 3599, 9001, 3600, 9003, 3605, 9002, 3606, 9001, 3607, 9001, 3608, 9003, 3609, 9001, 3610, 9003, 3611, 9001, 3612, 9003, 3613, 9001, 3614, 9003, 3615, 9001, 3616, 9003, 3617, 9001, 3618, 9003, 3619, 9001, 3620, 9003, 3621, 9001, 3622, 9003, 3623, 9001, 3624, 9003, 3625, 9001, 3626, 9003, 3627, 9001, 3628, 9003, 3629, 9001, 3630, 9003, 3631, 9001, 3632, 9003, 3633, 9001, 3634, 9002, 3635, 9001, 3636, 9002, 3640, 9003, 3641, 9001, 3642, 9003, 3643, 9001, 3644, 9002, 3645, 9001, 3646, 9002, 3647, 9001, 3648, 9002, 3649, 9001, 3650, 9003, 3651, 9001, 3652, 9003, 3653, 9001, 3654, 9003, 3655, 9001, 3656, 9002, 3657, 9001, 3658, 9003, 3659, 9001, 3660, 9003, 3661, 9001, 3662, 9003, 3663, 9001, 3664, 9003, 3668, 9003, 3669, 9001, 3670, 9003, 3671, 9001, 3672, 9003, 3673, 9001, 3674, 9003, 3675, 9001, 3676, 9002, 3677, 9003, 3678, 9001, 3679, 9002, 3680, 9003, 3681, 9001, 3682, 9002, 3683, 9003, 3684, 9001, 3685, 9001, 3686, 9003, 3687, 9001, 3688, 9003, 3689, 9001, 3690, 9003, 3691, 9001, 3692, 9003, 3696, 9003, 3697, 9001, 3698, 9003, 3699, 9001, 3700, 9003, 3783, 9001, 3784, 9001, 3793, 9001, 3794, 9001, 3812, 9001, 3819, 9102, 3821, 9102, 3824, 9102, 3854, 9001, 3857, 9001, 3889, 9102, 3906, 9102, 3911, 9001, 3912, 9001, 3920, 9001, 3978, 9001, 3979, 9001, 3991, 9003, 3992, 9003, 4026, 9001, 4037, 9001, 4038, 9001, 4042, 9102, 4071, 9001, 4075, 9102, 4081, 9102, 4082, 9001, 4083, 9001, 4087, 9001, 4088, 9001, 4217, 9003, 4261, 9105, 4262, 9102, 4263, 9102, 4288, 9102, 4289, 9102, 4322, 9102, 4324, 9102, 4326, 9102, 4414, 9001, 4415, 9001, 4417, 9001, 4434, 9001, 4437, 9001, 4438, 9003, 4439, 9003, 4462, 9001, 4463, 9102, 4467, 9001, 4470, 9102, 4471, 9001, 4475, 9102, 4483, 9102, 4490, 9102, 4555, 9102, 4558, 9102, 4559, 9001, 4632, 9102, 4633, 9102, 4647, 9001, 4807, 9105, 4808, 9102, 4809, 9102, 4810, 9105, 4811, 9105, 4816, 9105, 4817, 9102, 4818, 9102, 4820, 9102, 4821, 9105, 4822, 9001, 4823, 9102, 4824, 9102, 4826, 9001, 4839, 9001, 4901, 9105, 4902, 9105, 4903, 9102, 4904, 9102, 5013, 9102, 5018, 9001, 5048, 9001, 5167, 9001, 5168, 9001, 5221, 9001, 5223, 9001, 5228, 9102, 5229, 9102, 5233, 9102, 5234, 9001, 5235, 9001, 5243, 9001, 5246, 9102, 5247, 9001, 5252, 9102, 5264, 9102, 5266, 9001, 5316, 9001, 5320, 9001, 5321, 9001, 5324, 9102, 5325, 9001, 5337, 9001, 5340, 9102, 5354, 9102, 5360, 9102, 5361, 9001, 5362, 9001, 5365, 9102, 5367, 9001, 5371, 9102, 5373, 9102, 5381, 9102, 5382, 9001, 5383, 9001, 5387, 9001, 5389, 9001, 5393, 9102, 5396, 9001, 5451, 9102, 5456, 9001, 5457, 9001, 5464, 9102, 5467, 9102, 5469, 9001, 5472, 9037, 5489, 9102, 5490, 9001, 5513, 9001, 5514, 9001, 5523, 9001, 5524, 9102, 5527, 9102, 5530, 9001, 5531, 9001, 5546, 9102, 5559, 9001, 5561, 9102, 5588, 9002, 5589, 9005, 5593, 9102, 5596, 9001, 5627, 9001, 5629, 9001, 5641, 9001, 5643, 9001, 5644, 9001, 5646, 9003, 5654, 9003, 5655, 9003, 5659, 9001, 5681, 9102, 5700, 9001, 5825, 9001, 5836, 9001, 5837, 9001, 5839, 9001, 5842, 9001, 5844, 9001, 5858, 9001, 5879, 9001, 5880, 9001, 5886, 9102, 5887, 9001, 5890, 9001, 6128, 9002, 6129, 9002, 6135, 9102, 6204, 9001, 6207, 9102, 6210, 9001, 6211, 9001, 6307, 9001, 6311, 9102, 6312, 9001, 6316, 9001, 6318, 9102, 6322, 9102, 6325, 9102, 6362, 9001, 6365, 9102, 6391, 9002, 6405, 9002, 6406, 9001, 6407, 9002, 6408, 9001, 6409, 9002, 6410, 9001, 6411, 9003, 6412, 9001, 6413, 9003, 6414, 9001, 6415, 9001, 6416, 9003, 6417, 9001, 6418, 9003, 6419, 9001, 6420, 9003, 6421, 9001, 6422, 9003, 6423, 9001, 6424, 9003, 6425, 9001, 6426, 9003, 6427, 9001, 6428, 9003, 6429, 9001, 6430, 9003, 6431, 9001, 6432, 9003, 6433, 9001, 6434, 9003, 6435, 9001, 6436, 9003, 6437, 9001, 6438, 9003, 6439, 9001, 6440, 9001, 6441, 9003, 6442, 9001, 6443, 9003, 6444, 9001, 6445, 9003, 6446, 9001, 6447, 9003, 6448, 9001, 6449, 9003, 6450, 9001, 6451, 9003, 6452, 9001, 6453, 9003, 6454, 9001, 6455, 9003, 6456, 9001, 6457, 9003, 6458, 9001, 6459, 9003, 6460, 9001, 6461, 9003, 6462, 9001, 6463, 9003, 6464, 9001, 6465, 9003, 6466, 9001, 6467, 9003, 6468, 9001, 6469, 9003, 6470, 9001, 6471, 9003, 6472, 9001, 6473, 9003, 6474, 9001, 6475, 9003, 6476, 9001, 6477, 9003, 6478, 9001, 6479, 9003, 6484, 9003, 6485, 9001, 6486, 9003, 6487, 9001, 6488, 9003, 6489, 9001, 6490, 9003, 6491, 9001, 6492, 9003, 6493, 9001, 6494, 9002, 6495, 9001, 6496, 9002, 6497, 9001, 6498, 9001, 6499, 9002, 6500, 9001, 6501, 9003, 6502, 9001, 6503, 9003, 6504, 9001, 6505, 9003, 6506, 9001, 6507, 9003, 6508, 9001, 6509, 9001, 6510, 9003, 6515, 9002, 6516, 9001, 6518, 9001, 6519, 9003, 6520, 9001, 6521, 9003, 6522, 9001, 6523, 9003, 6524, 9001, 6525, 9003, 6526, 9001, 6527, 9003, 6528, 9001, 6529, 9003, 6530, 9001, 6531, 9003, 6532, 9001, 6533, 9003, 6534, 9001, 6535, 9003, 6536, 9001, 6537, 9003, 6538, 9001, 6539, 9003, 6540, 9001, 6541, 9003, 6542, 9001, 6543, 9003, 6544, 9001, 6545, 9002, 6546, 9001, 6547, 9002, 6548, 9001, 6549, 9003, 6550, 9001, 6551, 9003, 6552, 9001, 6553, 9003, 6554, 9001, 6555, 9003, 6556, 9001, 6557, 9002, 6558, 9001, 6559, 9002, 6560, 9001, 6561, 9002, 6562, 9001, 6563, 9003, 6564, 9001, 6565, 9003, 6566, 9001, 6567, 9001, 6568, 9003, 6569, 9001, 6570, 9002, 6571, 9001, 6572, 9003, 6573, 9001, 6574, 9003, 6575, 9001, 6576, 9003, 6577, 9001, 6578, 9003, 6582, 9003, 6583, 9001, 6584, 9003, 6585, 9001, 6586, 9003, 6587, 9001, 6588, 9003, 6589, 9001, 6590, 9003, 6591, 9001, 6592, 9001, 6593, 9003, 6594, 9001, 6595, 9003, 6596, 9001, 6597, 9003, 6598, 9001, 6599, 9003, 6600, 9001, 6601, 9003, 6602, 9001, 6603, 9003, 6605, 9003, 6606, 9001, 6607, 9003, 6608, 9001, 6609, 9003, 6610, 9001, 6611, 9001, 6612, 9003, 6613, 9001, 6614, 9003, 6615, 9001, 6616, 9003, 6617, 9001, 6618, 9003, 6633, 9003, 6646, 9001, 6668, 9102, 6703, 9001, 6706, 9102, 6783, 9102, 6784, 9001, 6785, 9002, 6786, 9001, 6787, 9002, 6788, 9001, 6789, 9002, 6790, 9001, 6791, 9002, 6792, 9001, 6793, 9002, 6794, 9001, 6795, 9002, 6796, 9001, 6797, 9002, 6798, 9001, 6799, 9002, 6800, 9001, 6801, 9002, 6802, 9001, 6803, 9002, 6804, 9001, 6805, 9002, 6806, 9001, 6807, 9002, 6808, 9001, 6809, 9002, 6810, 9001, 6811, 9002, 6812, 9001, 6813, 9002, 6814, 9001, 6815, 9002, 6816, 9001, 6817, 9002, 6818, 9001, 6819, 9002, 6820, 9001, 6821, 9002, 6822, 9001, 6823, 9002, 6824, 9001, 6825, 9002, 6826, 9001, 6827, 9002, 6828, 9001, 6829, 9002, 6830, 9001, 6831, 9002, 6832, 9001, 6833, 9002, 6834, 9001, 6835, 9002, 6836, 9001, 6837, 9002, 6838, 9001, 6839, 9002, 6840, 9001, 6841, 9002, 6842, 9001, 6843, 9002, 6844, 9001, 6845, 9002, 6846, 9001, 6847, 9002, 6848, 9001, 6849, 9002, 6850, 9001, 6851, 9002, 6852, 9001, 6853, 9002, 6854, 9001, 6855, 9002, 6856, 9001, 6857, 9002, 6858, 9001, 6859, 9002, 6860, 9001, 6861, 9002, 6862, 9001, 6863, 9002, 6867, 9001, 6868, 9002, 6870, 9001, 6875, 9001, 6876, 9001, 6879, 9001, 6880, 9003, 6884, 9001, 6885, 9002, 6886, 9001, 6887, 9002, 6892, 9102, 6894, 9102, 6915, 9001, 6922, 9001, 6923, 9003, 6924, 9001, 6925, 9003, 6962, 9001, 6983, 9102, 6984, 9001, 6990, 9102, 6991, 9001, 7035, 9102, 7037, 9102, 7039, 9102, 7041, 9102, 7073, 9102, 7084, 9102, 7086, 9102, 7128, 9003, 7131, 9001, 7132, 9003, 7133, 9102, 7136, 9102, 7139, 9102, 7142, 9001, 7257, 9001, 7258, 9003, 7259, 9001, 7260, 9003, 7261, 9001, 7262, 9003, 7263, 9001, 7264, 9003, 7265, 9001, 7266, 9003, 7267, 9001, 7268, 9003, 7269, 9001, 7270, 9003, 7271, 9001, 7272, 9003, 7273, 9001, 7274, 9003, 7275, 9001, 7276, 9003, 7277, 9001, 7278, 9003, 7279, 9001, 7280, 9003, 7281, 9001, 7282, 9003, 7283, 9001, 7284, 9003, 7285, 9001, 7286, 9003, 7287, 9001, 7288, 9003, 7289, 9001, 7290, 9003, 7291, 9001, 7292, 9003, 7293, 9001, 7294, 9003, 7295, 9001, 7296, 9003, 7297, 9001, 7298, 9003, 7299, 9001, 7300, 9003, 7301, 9001, 7302, 9003, 7303, 9001, 7304, 9003, 7305, 9001, 7306, 9003, 7307, 9001, 7308, 9003, 7309, 9001, 7310, 9003, 7311, 9001, 7312, 9003, 7313, 9001, 7314, 9003, 7315, 9001, 7316, 9003, 7317, 9001, 7318, 9003, 7319, 9001, 7320, 9003, 7321, 9001, 7322, 9003, 7323, 9001, 7324, 9003, 7325, 9001, 7326, 9003, 7327, 9001, 7328, 9003, 7329, 9001, 7330, 9003, 7331, 9001, 7332, 9003, 7333, 9001, 7334, 9003, 7335, 9001, 7336, 9003, 7337, 9001, 7338, 9003, 7339, 9001, 7340, 9003, 7341, 9001, 7342, 9003, 7343, 9001, 7344, 9003, 7345, 9001, 7346, 9003, 7347, 9001, 7348, 9003, 7349, 9001, 7350, 9003, 7351, 9001, 7352, 9003, 7353, 9001, 7354, 9003, 7355, 9001, 7356, 9003, 7357, 9001, 7358, 9003, 7359, 9001, 7360, 9003, 7361, 9001, 7362, 9003, 7363, 9001, 7364, 9003, 7365, 9001, 7366, 9003, 7367, 9001, 7368, 9003, 7369, 9001, 7370, 9003, 7373, 9102, 7683, 9102, 7798, 9102, 7844, 9102, 7877, 9001, 7878, 9001, 7881, 9102, 7882, 9001, 7883, 9001, 7886, 9102, 7887, 9001, 7899, 9001, 7991, 9001, 7992, 9001, 8035, 9003, 8036, 9003, 8042, 9102, 8043, 9102, 8058, 9001, 8059, 9001, 8082, 9001, 8083, 9001, 8086, 9102, 8088, 9001, 8090, 9001, 8091, 9003, 8092, 9001, 8093, 9003, 8095, 9001, 8096, 9003, 8097, 9001, 8098, 9003, 8099, 9001, 8100, 9003, 8101, 9001, 8102, 9003, 8103, 9001, 8104, 9003, 8105, 9001, 8106, 9003, 8107, 9001, 8108, 9003, 8109, 9001, 8110, 9003, 8111, 9001, 8112, 9003, 8113, 9001, 8114, 9003, 8115, 9001, 8116, 9003, 8117, 9001, 8118, 9003, 8119, 9001, 8120, 9003, 8121, 9001, 8122, 9003, 8123, 9001, 8124, 9003, 8125, 9001, 8126, 9003, 8127, 9001, 8128, 9003, 8129, 9001, 8130, 9003, 8131, 9001, 8132, 9003, 8133, 9001, 8134, 9003, 8135, 9001, 8136, 9003, 8137, 9001, 8138, 9003, 8139, 9001, 8140, 9003, 8141, 9001, 8142, 9003, 8143, 9001, 8144, 9003, 8145, 9001, 8146, 9003, 8147, 9001, 8148, 9003, 8149, 9001, 8150, 9003, 8151, 9001, 8152, 9003, 8153, 9001, 8154, 9003, 8155, 9001, 8156, 9003, 8157, 9001, 8158, 9003, 8159, 9001, 8160, 9003, 8161, 9001, 8162, 9003, 8163, 9001, 8164, 9003, 8165, 9001, 8166, 9003, 8167, 9001, 8168, 9003, 8169, 9001, 8170, 9003, 8171, 9001, 8172, 9003, 8173, 9001, 8177, 9003, 8179, 9001, 8180, 9003, 8181, 9001, 8182, 9003, 8184, 9001, 8185, 9003, 8187, 9001, 8189, 9003, 8191, 9001, 8193, 9003, 8196, 9001, 8197, 9003, 8198, 9001, 8200, 9003, 8201, 9001, 8202, 9003, 8203, 9001, 8204, 9003, 8205, 9001, 8206, 9003, 8207, 9001, 8208, 9003, 8209, 9001, 8210, 9003, 8212, 9001, 8213, 9003, 8214, 9001, 8216, 9003, 8218, 9001, 8220, 9003, 8222, 9001, 8224, 9003, 8225, 9001, 8226, 9003, 8232, 9102, 8237, 9102, 8240, 9102, 8246, 9102, 8249, 9102, 8252, 9102, 8255, 9102, 8311, 9001, 8312, 9002, 8313, 9001, 8314, 9002, 8315, 9001, 8316, 9002, 8317, 9001, 8318, 9002, 8319, 9001, 8320, 9002, 8321, 9001, 8322, 9002, 8323, 9001, 8324, 9002, 8325, 9001, 8326, 9002, 8327, 9001, 8328, 9002, 8329, 9001, 8330, 9002, 8331, 9001, 8332, 9002, 8333, 9001, 8334, 9002, 8335, 9001, 8336, 9002, 8337, 9001, 8338, 9002, 8339, 9001, 8340, 9002, 8341, 9001, 8342, 9002, 8343, 9001, 8344, 9002, 8345, 9001, 8346, 9002, 8347, 9001, 8348, 9002, 8351, 9102, 8352, 9001, 8353, 9001, 8379, 9001, 8380, 9003, 8381, 9001, 8382, 9003, 8383, 9001, 8384, 9003, 8385, 9001, 8387, 9003, 8391, 9001, 8395, 9001, 8427, 9102, 8428, 9102, 8431, 9102, 8433, 9001, 8441, 9001, 8455, 9001, 8456, 9001, 8531, 9003, 8545, 9102, 8682, 9001, 8685, 9102, 8687, 9001, 8692, 9001, 8693, 9001, 8694, 9102, 8699, 9102, 8818, 9102, 8826, 9001, 8860, 9102, 8888, 9102, 8900, 9102, 8902, 9102, 8903, 9001, 8907, 9102, 8949, 9102, 8950, 9001, 8951, 9001, 9003, 9102, 9006, 9102, 9009, 9102, 9012, 9102, 9014, 9102, 9017, 9102, 9019, 9102, 9039, 9001, 9040, 9001, 9140, 9102, 9141, 9001, 9148, 9102, 9149, 9001, 9150, 9001, 9153, 9102, 9191, 9001, 9221, 9001, 9222, 9001, 20499, 9001, 20538, 9001, 20539, 9001, 20790, 9001, 20791, 9001, 21291, 9001, 21292, 9001, 21500, 9001, 21817, 9001, 21818, 9001, 22032, 9001, 22033, 9001, 22091, 9001, 22092, 9001, 22332, 9001, 22391, 9001, 22392, 9001, 22700, 9001, 22770, 9001, 22780, 9001, 22832, 9001, 23090, 9001, 23095, 9001, 23239, 9001, 23240, 9001, 23700, 9001, 24047, 9001, 24048, 9001, 24100, 9005, 24200, 9001, 24305, 9001, 24306, 9001, 24382, 9084, 24383, 9001, 24500, 9001, 24547, 9001, 24548, 9001, 24571, 9062, 24600, 9001, 25e3, 9001, 25231, 9001, 25884, 9001, 25932, 9001, 26237, 9001, 26331, 9001, 26332, 9001, 26591, 9001, 26592, 9001, 26632, 9001, 26692, 9001, 27120, 9001, 27200, 9001, 27291, 9040, 27292, 9040, 27429, 9001, 27493, 9001, 27500, 9001, 27700, 9001, 28232, 9001, 28600, 9001, 28991, 9001, 28992, 9001, 29101, 9001, 29220, 9001, 29221, 9001, 29333, 9001, 29635, 9001, 29636, 9001, 29701, 9001, 29738, 9001, 29739, 9001, 29849, 9001, 29850, 9001, 29871, 9042, 29872, 9041, 29873, 9001, 30200, 9039, 30339, 9001, 30340, 9001, 30791, 9001, 30792, 9001, 31028, 9001, 31121, 9001, 31154, 9001, 31170, 9001, 31171, 9001, 31279, 9001, 31370, 9001, 31528, 9001, 31529, 9001, 31600, 9001, 31700, 9001, 31838, 9001, 31839, 9001, 31901, 9001, 32030, 9003, 32031, 9003, 32061, 9001, 32062, 9001, 32098, 9001, 32099, 9003, 32100, 9001, 32104, 9001, 32161, 9001, 32766, 9001, 37202, 9102, 37203, 9102, 37206, 9102, 37207, 9102, 37218, 9102, 37221, 9102, 37225, 9105, 37240, 9102, 37241, 9102, 37243, 9102, 37245, 9102, 37249, 9102, 37257, 9102, 37260, 9102, 53048, 9001, 53049, 9001, 54034, 9001, 54090, 9001, 54091, 9001, 65061, 9003, 65062, 9003, 65161, 9001, 102041, 9003, 102064, 9085, 102068, 109030, 102069, 109031, 102093, 9001, 102094, 9001, 102118, 9003, 102120, 9003, 102121, 9003, 102122, 9001, 102150, 9001, 102168, 9001, 102204, 9001, 102212, 9001, 102213, 9001, 102215, 9001, 102216, 9001, 102217, 9003, 102218, 9001, 102219, 9003, 102220, 9003, 102247, 9001, 102299, 9001, 102306, 9001, 102319, 9001, 102328, 9001, 102329, 9001, 102359, 9001, 102360, 9001, 102440, 9001, 102448, 9001, 102464, 9003, 102465, 9003, 102491, 9001, 102492, 9001, 102498, 9001, 102499, 9001, 102525, 9003, 102526, 9003, 102528, 9003, 102529, 9003, 102589, 9003, 102598, 9001, 102599, 9003, 102600, 9003, 102604, 9003, 102661, 9003, 102662, 9003, 102664, 9003, 102665, 9003, 102705, 9003, 102720, 9003, 102721, 9003, 102726, 9003, 102727, 9003, 102733, 9003, 102761, 9003, 102766, 9003, 102974, 9003, 103228, 9001, 103229, 9001, 103230, 9003, 103231, 9003, 103250, 9001, 103251, 9003, 103252, 9001, 103253, 9003, 103260, 9001, 103261, 9001, 103262, 9003, 103263, 9003, 103270, 9001, 103271, 9001, 103272, 9003, 103273, 9003, 103274, 9001, 103275, 9001, 103276, 9003, 103277, 9003, 103278, 9001, 103279, 9001, 103280, 9003, 103281, 9003, 103282, 9001, 103283, 9001, 103284, 9003, 103285, 9003, 103286, 9001, 103287, 9003, 103288, 9001, 103289, 9003, 103290, 9001, 103291, 9003, 103292, 9001, 103293, 9001, 103294, 9003, 103295, 9003, 103296, 9001, 103297, 9001, 103298, 9003, 103299, 9003, 103300, 9001, 103307, 9001, 103313, 9001, 103319, 9001, 103322, 9001, 103323, 9001, 103332, 9001, 103335, 9001, 103338, 9001, 103340, 9001, 103351, 9001, 103358, 9001, 103370, 9001, 103376, 9003, 103377, 9001, 103378, 9001, 103379, 9003, 103380, 9003, 103393, 9001, 103394, 9001, 103395, 9003, 103396, 9003, 103400, 9003, 103407, 9003, 103413, 9003, 103419, 9003, 103422, 9003, 103423, 9003, 103432, 9003, 103435, 9003, 103438, 9003, 103440, 9003, 103451, 9003, 103458, 9003, 103470, 9003, 103472, 9001, 103473, 9002, 103474, 9001, 103475, 9003, 103482, 9001, 103483, 9003, 103484, 9001, 103485, 9003, 103500, 9001, 103501, 9003, 103502, 9001, 103503, 9001, 103504, 9002, 103505, 9002, 103506, 9001, 103507, 9001, 103508, 9003, 103509, 9003, 103510, 9001, 103511, 9001, 103512, 9003, 103513, 9003, 103514, 9001, 103515, 9003, 103516, 9001, 103517, 9003, 103518, 9001, 103519, 9003, 103520, 9001, 103521, 9002, 103522, 9001, 103523, 9001, 103524, 9003, 103525, 9003, 103526, 9001, 103527, 9003, 103561, 9003, 103562, 9003, 103563, 9001, 103564, 9001, 103565, 9003, 103566, 9003, 103567, 9001, 103568, 9001, 103569, 9003, 103570, 9003, 103585, 9003, 103586, 9001, 103587, 9003, 103588, 9002, 103589, 9001, 103590, 9003, 103591, 9002, 103592, 9001, 103593, 9003, 103594, 9002, 103695, 9003, 103846, 9001, 103946, 9003, 104009, 9102, 104017, 9102, 104018, 9102, 104022, 9102, 104024, 9102, 104027, 9102, 104047, 9102, 104050, 9102, 104105, 9102, 104106, 9102, 104109, 9102, 104112, 9102, 104113, 9102, 104134, 9102, 104135, 9102, 104138, 9102, 104139, 9105, 104140, 9105, 104808, 9102] }; + A.yr = function() { + function T() { + } + return T.Ny = function(b) { + T.zp === !1 && T.zt(); + var m = T.AQ(b); + if (m == -1) { + var _ = T.Ax(b); + _ != b && (m = T.Ny(_)); + } + return m == -1 && (_ = T.AK(b)) != b && (m = T.Ny(_)), m; + }, T.AQ = function(b) { + return T.Hw[b] !== void 0 ? T.Hw[b] : -1; + }, T.xQ = function(b) { + T.zp === !1 && T.zt(); + var m = T.iF(b); + if (m == 1e38) { + var _ = T.Ax(b); + if (_ != b && (m = T.iF(_)), m == 1e38) + return 1e-10; + } + return m; + }, T.US = function(b) { + if (T.Ks[b] !== void 0) + return !0; + var m = T.Ax(b); + return m != b && T.Ks[m] !== void 0; + }, T.WS = function(b) { + if (T.zo[b] !== void 0) + return !0; + var m = T.Ax(b); + return m != b && T.zo[m] !== void 0; + }, T.iF = function(b) { + return T.zp === !1 && T.zt(), T.Ks[b] !== void 0 ? T.Ks[b] : T.zo[b] !== void 0 ? T.zo[b] : 1e38; + }, T.AK = function(b) { + return T.zp === !1 && T.zt(), T.RA[b] !== void 0 ? T.RA[b] : b; + }, T.Ax = function(b) { + return T.zp === !1 && T.zt(), T.SA[b] !== void 0 ? T.SA[b] : b; + }, T.zt = function() { + for (var b, m = ve, _ = 0; _ < m.pcsid.length; _ += 2) + T.zo[m.pcsid[_]] = m.pcstol[2 * m.pcsid[_ + 1] + 1]; + for (_ = 0; _ < m.pcsidc.length; _ += 1) + for (var C = (b = m.pcsidc[_])[0]; C <= b[1]; C++) + T.zo[C] = m.pcstol[2 * b[2] + 1]; + for (_ = 0; _ < m.gcsid.length; _ += 2) + T.Ks[m.gcsid[_]] = m.gcstol[2 * m.gcsid[_ + 1] + 1]; + for (_ = 0; _ < m.gcsidc.length; _ += 1) + for (C = (b = m.gcsidc[_])[0]; C <= b[1]; C++) + T.zo[C] = m.gcstol[2 * b[2] + 1]; + for (_ = 0; _ < H.c.length; _ += 1) + for (C = (b = H.c[_])[0]; C <= b[1]; C++) + T.Hw[C] = b[2]; + for (_ = 0; _ < H.nc.length; _ += 2) + T.Hw[H.nc[_]] = H.nc[_ + 1]; + for (H = null, _ = 0; _ < m.newtoold.length; _ += 2) + T.RA[m.newtoold[_ + 1]] = m.newtoold[_], T.SA[m.newtoold[_]] = m.newtoold[_ + 1]; + ve = null, T.zp = !0; + }, T.zp = !1, T.Ks = [], T.zo = [], T.RA = [], T.SA = [], T.Hw = [], T; + }(); + }(le || (le = {})), function(A) { + function ve(T) { + return T.length === 0 ? '""' : T[0] == '"' || T[0] == "." || "0" <= T[0] && "9" >= T[0] ? T : '"' + T.trim() + '"'; + } + var H = []; + A.SC = function() { + function T() { + } + return T.zQ = function(b) { + try { + for (var m = 0; m < H.length; m++) + if (H[m].wkttext === b) + return H[m].unit; + for (var _, C = m = "", D = !1, L = 0; L < b.length; L++) { + var B = b[L]; + D === !0 ? B == '"' ? b[L + 1] == '"' ? m += B : D = D = !1 : m += B : /[\s]/.test(B) || (B == "," ? (C = m !== "" ? C + (ve(m) + ",") : C + ",", m = "") : B == ")" || B == "]" ? (C = m !== "" ? C + (ve(m) + "]}") : C + "]}", m = "") : B == "(" || B == "[" ? (C += '{ "entity": "' + m.toUpperCase().trim() + '", "values":[', m = "") : B == '"' ? (D = !0, m = "") : m += B); + } + _ = JSON.parse(C); + var q = T.hF(_); + if (q === null) + return null; + for (_ = null, B = 0; B < q.values.length; B++) + if (typeof q.values[B] == "object" && q.values[B].entity === "UNIT") { + _ = q.values[B]; + break; + } + if (_ === null) + return null; + var Z = A.Uc.UO(q.entity === "GEOGCS" ? 1 : 0, _.values[1], _.values[2]); + return H.push({ wkttext: b, unit: Z }), 10 < H.length && H.shift(), Z; + } catch { + return null; + } + }, T.hF = function(b) { + if (b === null) + return null; + if (b.entity === "GEOGCS" || b.entity === "PROJCS") + return b; + for (var m = [], _ = 0; _ < b.values.length; _++) + if (typeof b.values[_] == "object" && b.values[_].entity !== void 0) { + if (b.values[_].entity === "GEOGCS" || b.values[_].entity == "PROJCS") + return b.values[_]; + m.push(b.values[_]); + } + for (b = 0; b < m.length; b++) + if ((_ = T.hF(m[b])) !== null) + return _; + return null; + }, T.yQ = function(b) { + var m = -1; + if (b != null && 0 < b.length) { + var _ = b.indexOf("PROJCS"); + if (0 <= _) { + var C = 0; + if (0 <= (_ = b.lastIndexOf("UNIT")) && 0 < (_ = b.indexOf(",", _ + 4))) { + _++; + var D = b.indexOf("]", _ + 1); + if (0 < D) + try { + C = parseFloat(b.substring(_, D)); + } catch { + C = 0; + } + } + 0 < C && (m = 1e-3 / C); + } else if (0 <= (_ = b.indexOf("GEOGCS"))) { + var L = 0; + if (C = 0, 0 < (_ = b.indexOf("SPHEROID", _ + 6)) && 0 < (_ = b.indexOf(",", _ + 8))) { + if (_++, 0 < (D = b.indexOf(",", _ + 1))) + try { + L = parseFloat(b.substring(_, D)); + } catch { + L = 0; + } + if (0 < L && 0 <= (_ = b.indexOf("UNIT", D + 1)) && 0 < (_ = b.indexOf(",", _ + 4)) && (_++, 0 < (D = b.indexOf("]", _ + 1)))) + try { + C = parseFloat(b.substring(_, D)); + } catch { + C = 0; + } + } + 0 < L && 0 < C && (m = 1e-3 / (L * C)); + } + } + return m; + }, T; + }(); + }(le || (le = {})), function(A) { + var ve; + (ve = A.$K || (A.$K = {}))[ve.NONE = 0] = "NONE", ve[ve.LINEAR = 1] = "LINEAR", ve[ve.ANGULAR = 2] = "ANGULAR", function(T) { + T[T.enumFloat = 0] = "enumFloat", T[T.enumDouble = 1] = "enumDouble", T[T.enumInt32 = 2] = "enumInt32", T[T.enumInt64 = 3] = "enumInt64", T[T.enumInt8 = 4] = "enumInt8", T[T.enumInt16 = 5] = "enumInt16"; + }(A.LL || (A.LL = {})), function(T) { + T[T.POSITION = 0] = "POSITION", T[T.Z = 1] = "Z", T[T.M = 2] = "M", T[T.ID = 3] = "ID", T[T.NORMAL = 4] = "NORMAL", T[T.TEXTURE1D = 5] = "TEXTURE1D", T[T.TEXTURE2D = 6] = "TEXTURE2D", T[T.TEXTURE3D = 7] = "TEXTURE3D", T[T.ID2 = 8] = "ID2", T[T.MAXSEMANTICS = 10] = "MAXSEMANTICS"; + }(A.Kh || (A.Kh = {})); + var H = function() { + function T(b, m) { + if (this.Xs = this.Be = null, this.Qq = this.Ba = 0, this.wh = this.dg = null, this.yl = 0, m !== void 0) { + for (this.Ba = m.Ba, this.Qq = m.Qq, this.dg = m.dg.slice(0), this.wh = m.wh.slice(0), this.yl = m.yl, this.Xs = [], b = m = 0; b < this.Ba; b++) + this.Xs[b] = m, m += T.Wa(this.dg[b]); + for (this.Qq = m, this.Be = [], b = 0; b < this.Ba; b++) { + m = T.Wa(this.ld(b)); + for (var _ = T.te(this.ld(b)), C = 0; C < m; C++) + this.Be[this.Xs[b] + C] = _; + } + } else + this.Qq = this.Ba = 0; + } + return T.prototype.ld = function(b) { + if (0 > b || b > this.Ba) + throw A.i.O(); + return this.dg[b]; + }, T.prototype.Rf = function(b) { + return this.wh[b]; + }, T.gz = function(b) { + return T.EM[b]; + }, T.Vp = function(b) { + return T.NM[b]; + }, T.Wa = function(b) { + return T.mM[b]; + }, T.prototype.hasAttribute = function(b) { + return 0 <= this.wh[b]; + }, T.prototype.dG = function() { + return this.hasAttribute(1); + }, T.te = function(b) { + return T.$C[b]; + }, T.prototype.GR = function(b) { + return this.Xs[b]; + }, T.yG = function(b, m) { + return T.$C[b] === m; + }, T.prototype.Nb = function(b) { + return this === b; + }, T.prototype.Cn = function() { + for (var b = A.P.Vh(this.dg[0]), m = 1; m < this.Ba; m++) + b = A.P.Vh(this.dg[m], b); + return b; + }, T.prototype.bk = function(b) { + return this.Xs[b]; + }, T.prototype.dc = function() { + return this.yl; + }, T.prototype.Fd = function(b) { + return this.dg[b]; + }, T.$C = [0, 0, NaN, 0, 0, 0, 0, 0, 0], T.EM = [1, 1, 1, 0, 2, 1, 1, 1, 0], T.NM = [1, 1, 1, 2, 0, 0, 0, 0, 2], T.mM = [2, 1, 1, 1, 3, 1, 2, 3, 2], T; + }(); + A.sa = H; + }(le || (le = {})), function(A) { + function ve(D, L, B) { + var q = L - (D = new C(D)).e, Z = D.c; + for (Z.length > ++L && H(D, q, C.gu), Z[0] ? B ? q = L : (Z = D.c, q = D.e + q + 1) : ++q; Z.length < q; Z.push(0)) + ; + return q = D.e, B === 1 || B && (L <= q || q <= b) ? (0 > D.Cd && Z[0] ? "-" : "") + (1 < Z.length ? Z[0] + "." + Z.join("").slice(1) : Z[0]) + (0 > q ? "e" : "e+") + q : D.toString(); + } + function H(D, L, B, q) { + var Z = D.c, ie = D.e + L + 1; + if (B === 1 ? q = 5 <= Z[ie] : B === 2 ? q = 5 < Z[ie] || Z[ie] == 5 && (q || 0 > ie || Z[ie + 1] !== void 0 || 1 & Z[ie - 1]) : B === 3 ? q = q || Z[ie] !== void 0 || 0 > ie : (q = !1, B !== 0 && T("!Big.RM!")), 1 > ie || !Z[0]) + q ? (D.e = -L, D.c = [1]) : D.c = [D.e = 0]; + else { + if (Z.length = ie--, q) + for (; 9 < ++Z[ie]; ) + Z[ie] = 0, ie-- || (++D.e, Z.unshift(1)); + for (ie = Z.length; !Z[--ie]; Z.pop()) + ; + } + return D; + } + function T(D) { + throw (D = Error(D)).name = "BigError", D; + } + var b = -7, m = 21, _ = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, C = function() { + function D(L) { + if (L instanceof D) + this.Cd = L.Cd, this.e = L.e, this.c = L.c.slice(); + else { + var B, q, Z; + for (L === 0 && 0 > 1 / L ? L = "-0" : _.test(L += "") || T(NaN), this.Cd = L.charAt(0) == "-" ? (L = L.slice(1), -1) : 1, -1 < (B = L.indexOf(".")) && (L = L.replace(".", "")), 0 < (q = L.search(/e/i)) ? (0 > B && (B = q), B += +L.slice(q + 1), L = L.substring(0, q)) : 0 > B && (B = L.length), q = 0; L.charAt(q) == "0"; q++) + ; + if (q == (Z = L.length)) + this.c = [this.e = 0]; + else { + for (; L.charAt(--Z) == "0"; ) + ; + for (this.e = B - q - 1, this.c = [], B = 0; q <= Z; this.c[B++] = +L.charAt(q++)) + ; + } + } + } + return D.prototype.abs = function() { + var L = new D(this); + return L.Cd = 1, L; + }, D.prototype.cmp = function(L) { + var B = this.c, q = (L = new D(L)).c, Z = this.Cd, ie = L.Cd, se = this.e, de = L.e; + if (!B[0] || !q[0]) + return B[0] ? Z : q[0] ? -ie : 0; + if (Z != ie) + return Z; + if (L = 0 > Z, se != de) + return se > (de ^ L) ? 1 : -1; + for (Z = -1, ie = (se = B.length) < (de = q.length) ? se : de; ++Z < ie; ) + if (B[Z] != q[Z]) + return B[Z] > (q[Z] ^ L) ? 1 : -1; + return se == de ? 0 : se > (de ^ L) ? 1 : -1; + }, D.prototype.lm = function(L) { + var B = this.c, q = (L = new D(L)).c, Z = this.Cd == L.Cd ? 1 : -1, ie = D.tr; + if ((ie !== ~~ie || 0 > ie || 1e6 < ie) && T("!Big.DP!"), !B[0] || !q[0]) + return B[0] == q[0] && T(NaN), q[0] || T(Z / 0), new D(0 * Z); + var se, de, Ce = q.slice(), Ve = se = q.length, Je = B.length, Pt = B.slice(0, se), $t = Pt.length, qe = L, Rt = qe.c = [], Zt = 0, Jt = ie + (qe.e = this.e - L.e) + 1; + for (qe.Cd = Z, Z = 0 > Jt ? 0 : Jt, Ce.unshift(0); $t++ < se; Pt.push(0)) + ; + do { + for (de = 0; 10 > de; de++) { + if (se != ($t = Pt.length)) + var Xt = se > $t ? 1 : -1; + else { + var Qt = -1; + for (Xt = 0; ++Qt < se; ) + if (q[Qt] != Pt[Qt]) { + Xt = q[Qt] > Pt[Qt] ? 1 : -1; + break; + } + } + if (!(0 > Xt)) + break; + for (L = $t == se ? q : Ce; $t; ) { + if (Pt[--$t] < L[$t]) { + for (Qt = $t; Qt && !Pt[--Qt]; Pt[Qt] = 9) + ; + --Pt[Qt], Pt[$t] += 10; + } + Pt[$t] -= L[$t]; + } + for (; !Pt[0]; Pt.shift()) + ; + } + Rt[Zt++] = Xt ? de : ++de, Pt[0] && Xt ? Pt[$t] = B[Ve] || 0 : Pt = [B[Ve]]; + } while ((Ve++ < Je || Pt[0] !== void 0) && Z--); + return Rt[0] || Zt == 1 || (Rt.shift(), qe.e--), Zt > Jt && H(qe, ie, D.gu, Pt[0] !== void 0), qe; + }, D.prototype.aS = function() { + return 0 < this.cmp(0); + }, D.prototype.iT = function() { + return 0 > this.cmp(0); + }, D.prototype.kt = function(L) { + var B, q = this.Cd, Z = (L = new D(L)).Cd; + if (q != Z) + return L.Cd = -Z, this.oI(L); + var ie = this.c.slice(), se = this.e, de = L.c, Ce = L.e; + if (!ie[0] || !de[0]) + return de[0] ? (L.Cd = -Z, L) : new D(ie[0] ? this : 0); + if (q = se - Ce) { + for ((B = 0 > q) ? (q = -q, se = ie) : (Ce = se, se = de), se.reverse(), Z = q; Z--; se.push(0)) + ; + se.reverse(); + } else + for (se = ((B = ie.length < de.length) ? ie : de).length, q = Z = 0; Z < se; Z++) + if (ie[Z] != de[Z]) { + B = ie[Z] < de[Z]; + break; + } + if (B && (se = ie, ie = de, de = se, L.Cd = -L.Cd), 0 < (Z = (se = de.length) - (B = ie.length))) + for (; Z--; ie[B++] = 0) + ; + for (Z = B; se > q; ) { + if (ie[--se] < de[se]) { + for (B = se; B && !ie[--B]; ie[B] = 9) + ; + --ie[B], ie[se] += 10; + } + ie[se] -= de[se]; + } + for (; ie[--Z] == 0; ie.pop()) + ; + for (; ie[0] == 0; ) + ie.shift(), --Ce; + return ie[0] || (L.Cd = 1, ie = [Ce = 0]), L.c = ie, L.e = Ce, L; + }, D.prototype.oI = function(L) { + var B = this.Cd, q = (L = new D(L)).Cd; + if (B != q) + return L.Cd = -q, this.kt(L); + q = this.e; + var Z = this.c, ie = L.e, se = L.c; + if (!Z[0] || !se[0]) + return se[0] ? L : new D(Z[0] ? this : 0 * B); + if (Z = Z.slice(), B = q - ie) { + for (0 < B ? (ie = q, q = se) : (B = -B, q = Z), q.reverse(); B--; q.push(0)) + ; + q.reverse(); + } + for (0 > Z.length - se.length && (q = se, se = Z, Z = q), B = se.length, q = 0; B; ) + q = (Z[--B] = Z[B] + se[B] + q) / 10 | 0, Z[B] %= 10; + for (q && (Z.unshift(q), ++ie), B = Z.length; Z[--B] == 0; Z.pop()) + ; + return L.c = Z, L.e = ie, L; + }, D.prototype.pow = function(L) { + var B = this, q = new D(1), Z = q, ie = 0 > L; + for ((L !== ~~L || -1e6 > L || 1e6 < L) && T("!pow!"), L = ie ? -L : L; 1 & L && (Z = Z.nr(B)), L >>= 1; ) + B = B.nr(B); + return ie ? q.lm(Z) : Z; + }, D.prototype.round = function(L, B) { + var q = this; + return L == null ? L = 0 : (L !== ~~L || 0 > L || 1e6 < L) && T("!round!"), H(q = new D(q), L, B ?? D.gu), q; + }, D.prototype.sqrt = function() { + var L = this.c, B = this.Cd, q = this.e, Z = new D("0.5"); + if (!L[0]) + return new D(this); + 0 > B && T(NaN), (B = Math.sqrt(this.toString())) == 0 || B == 1 / 0 ? ((B = L.join("")).length + q & 1 || (B += "0"), (L = new D(Math.sqrt(B).toString())).e = ((q + 1) / 2 | 0) - (0 > q || 1 & q)) : L = new D(B.toString()), B = L.e + (D.tr += 4); + do + q = L, L = Z.nr(q.oI(this.lm(q))); + while (q.c.slice(0, B).join("") !== L.c.slice(0, B).join("")); + return H(L, D.tr -= 4, D.gu), L; + }, D.prototype.nr = function(L) { + var B = this.c, q = (L = new D(L)).c, Z = B.length, ie = q.length, se = this.e, de = L.e; + if (L.Cd = this.Cd == L.Cd ? 1 : -1, !B[0] || !q[0]) + return new D(0 * L.Cd); + if (L.e = se + de, Z < ie) { + var Ce = B; + B = q, q = Ce, de = Z, Z = ie, ie = de; + } + for (Ce = Array(de = Z + ie); de--; Ce[de] = 0) + ; + for (se = ie; se--; ) { + for (ie = 0, de = Z + se; de > se; ) + ie = Ce[de] + q[se] * B[de - se - 1] + ie, Ce[de--] = ie % 10, ie = ie / 10 | 0; + Ce[de] = (Ce[de] + ie) % 10; + } + for (ie && ++L.e, Ce[0] || Ce.shift(), se = Ce.length; !Ce[--se]; Ce.pop()) + ; + return L.c = Ce, L; + }, D.prototype.toString = function() { + var L = this.e, B = this.c.join(""), q = B.length; + if (L <= b || L >= m) + B = B.charAt(0) + (1 < q ? "." + B.slice(1) : "") + (0 > L ? "e" : "e+") + L; + else if (0 > L) { + for (; ++L; B = "0" + B) + ; + B = "0." + B; + } else if (0 < L) + if (++L > q) + for (L -= q; L--; B += "0") + ; + else + L < q && (B = B.slice(0, L) + "." + B.slice(L)); + else + 1 < q && (B = B.charAt(0) + "." + B.slice(1)); + return 0 > this.Cd && this.c[0] ? "-" + B : B; + }, D.prototype.toExponential = function(L) { + return L == null ? L = this.c.length - 1 : (L !== ~~L || 0 > L || 1e6 < L) && T("!toExp!"), ve(this, L, 1); + }, D.prototype.toFixed = function(L) { + var B = b, q = m; + if (b = -(m = 1 / 0), L == null) + var Z = this.toString(); + else + L === ~~L && 0 <= L && 1e6 >= L && (Z = ve(this, this.e + L), 0 > this.Cd && this.c[0] && 0 > Z.indexOf("-") && (Z = "-" + Z)); + return b = B, m = q, Z || T("!toFix!"), Z; + }, D.prototype.toPrecision = function(L) { + return L == null ? this.toString() : ((L !== ~~L || 1 > L || 1e6 < L) && T("!toPre!"), ve(this, L - 1, 2)); + }, D.tr = 20, D.gu = 1, D; + }(); + A.jp = C; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.lf = T; + } + return H.prototype.qr = function(T, b, m) { + var _ = new A.h(), C = new A.h(), D = this.lf; + m.Wd(T, b, function(L, B) { + return D.uc(2 * L, _), D.uc(2 * B, C), _.compare(C); + }); + }, H.prototype.bq = function(T) { + return this.lf.read(2 * T + 1); + }, H; + }(); + A.si = function() { + function H() { + } + return H.cq = function(T) { + if (T.B()) + return !1; + var b = T.K(); + return b == 1736 ? T.He() != 0 : b == 1607 ? (b = [!1], H.nE(T, !0, b), b[0]) : !(b != 197 && (!A.ba.zd(b) || T.wG())); + }, H.im = function(T) { + var b = T.K(); + if (b == 1736) + return b = new A.Ua(T.description), T.B() || T.ZC(b), b; + if (b == 1607) + return H.nE(T, !1, null); + if (b == 197) + return b = new A.Ua(T.description), T.B() || b.bd(T, !1), b; + if (A.ba.zd(b)) { + if (b = new A.ee(T.description), !T.B() && !T.wG()) { + var m = new A.Ta(); + T.Vo(m), b.add(m), T.Ro(m), b.add(m); + } + return b; + } + if (A.ba.Tn(b)) + return null; + throw A.i.O(); + }, H.nE = function(T, b, m) { + m != null && (m[0] = !1); + var _ = null; + if (b || (_ = new A.ee(T.description)), !T.B()) { + var C = new A.ja(0); + C.Jb(2 * T.ea()); + for (var D = 0, L = T.ea(); D < L; D++) + if (0 < T.Ka(D) && !T.Pn(D)) { + var B = T.Ca(D); + C.add(B), B = T.Wc(D) - 1, C.add(B); + } + if (0 < C.size) { + L = new A.Zt(), D = T.vb(0), L.sort(C, 0, C.size, new ve(D)), L = new A.h(), D.uc(2 * C.get(0), L), B = 0; + for (var q = 1, Z = new A.Ta(), ie = new A.h(), se = 1, de = C.size; se < de; se++) + if (D.uc(2 * C.get(se), ie), ie.rb(L)) + C.get(B) > C.get(se) ? (C.set(B, 2147483647), B = se) : C.set(se, 2147483647), q++; + else { + if (!(1 & q)) + C.set(B, 2147483647); + else if (b) + return m != null && (m[0] = !0), null; + L.N(ie), B = se, q = 1; + } + if (!(1 & q)) + C.set(B, 2147483647); + else if (b) + return m != null && (m[0] = !0), null; + if (!b) + for (C.Wd(0, C.size, function(Ce, Ve) { + return Ce - Ve; + }), se = 0, de = C.size; se < de && C.get(se) != 2147483647; se++) + T.we(C.get(se), Z), _.add(Z); + } + } + return b ? null : _; + }, H; + }(); + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.zf = new A.ja(0), this.As = new A.ja(0), this.zH = 1, this.Gs = NaN; + } + return H.prototype.sort = function(T, b, m, _) { + if (32 > m - b) + _.qr(b, m, T); + else { + var C = !0; + try { + for (var D = 1 / 0, L = -1 / 0, B = b; B < m; B++) { + var q = _.bq(T.get(B)); + q < D && (D = q), q > L && (L = q); + } + if (this.reset(m - b, D, L, m - b)) { + for (B = b; B < m; B++) { + var Z = T.get(B); + q = _.bq(Z); + var ie = this.uF(q); + this.zf.set(ie, this.zf.get(ie) + 1), this.As.write(B - b, Z); + } + var se = this.zf.get(0); + this.zf.set(0, 0), B = 1; + for (var de = this.zf.size; B < de; B++) { + var Ce = this.zf.get(B); + this.zf.set(B, se), se += Ce; + } + for (B = b; B < m; B++) { + Z = this.As.read(B - b), q = _.bq(Z), ie = this.uF(q); + var Ve = this.zf.get(ie); + T.set(Ve + b, Z), this.zf.set(ie, Ve + 1); + } + C = !1; + } + } catch { + this.zf.resize(0), this.As.resize(0); + } + if (C) + _.qr(b, m, T); + else { + for (B = m = 0, de = this.zf.size; B < de; B++) + C = m, (m = this.zf.get(B)) > C && _.qr(b + C, b + m, T); + 100 < this.zf.size && (this.zf.resize(0), this.As.resize(0)); + } + } + }, H.prototype.reset = function(T, b, m, _) { + return !(2 > T || m == b) && (T = Math.min(H.cL, T), this.zf.Jb(T), this.zf.resize(T), this.zf.Yj(0, 0, this.zf.size), this.zH = b, this.As.resize(_), this.Gs = (m - b) / (T - 1), !0); + }, H.prototype.uF = function(T) { + return A.P.truncate((T - this.zH) / this.Gs); + }, H.cL = 65536, H; + }(); + A.Zt = ve; + }(le || (le = {})), function(A) { + var ve, H; + (H = ve || (ve = {}))[H.enum_line = 1] = "enum_line", H[H.enum_arc = 2] = "enum_arc", H[H.enum_dummy = 4] = "enum_dummy", H[H.enum_concave_dip = 8] = "enum_concave_dip", H[H.enum_connection = 3] = "enum_connection"; + var T = function() { + function D() { + } + return D.Su = function(L, B, q, Z, ie, se) { + var de = new D(); + return de.Km = new A.h(), de.Xm = new A.h(), de.cw = new A.h(), de.Km.N(L), de.Xm.N(B), de.cw.N(q), de.Eo = Z, de.sh = ie, de.uh = se, de; + }, D.construct = function(L, B, q, Z) { + var ie = new D(); + return ie.Km = new A.h(), ie.Xm = new A.h(), ie.cw = new A.h(), ie.Km.N(L), ie.Xm.N(B), ie.cw.Sc(), ie.Eo = 4, ie.sh = q, ie.uh = Z, ie; + }, D; + }(), b = function() { + function D(L, B, q, Z, ie, se) { + this.$v = null, this.za = 0, this.zA = L, this.XH = this.VH = 0, this.La = B, this.Oj = q, this.xk = Z, this.Fq = ie, this.Vb = se; + } + return D.prototype.next = function() { + for (var L = new A.Ta(); ; ) { + if (this.za == this.zA.I()) + return null; + if (this.zA.we(this.za, L), this.za++, !L.B()) + break; + } + var B = !1; + if (this.$v == null && (this.VH = L.Ng(), this.XH = L.kh(), this.$v = C.buffer(L, this.La, this.Oj, this.xk, this.Fq, this.Vb), B = !0), this.za < this.zA.I()) { + var q = new A.Ea(); + this.$v.copyTo(q); + } else + q = this.$v; + if (!B) { + B = new A.Ed(); + var Z = L.Ng() - this.VH; + L = L.kh() - this.XH, B.ig(Z, L), q.Pc(B); + } + return q; + }, D.prototype.Ma = function() { + return 0; + }, D.prototype.re = function() { + }, D; + }(), m = function() { + function D(L, B) { + this.Xa = L, this.za = 0, this.qq = B; + } + return D.prototype.next = function() { + var L = this.Xa.Y; + if (this.za < L.ea()) { + var B = this.za; + if (this.za++, !L.Pn(B)) + for (var q = L.Oa(L.Wc(B) - 1); this.za < L.ea(); ) { + var Z = L.Oa(L.Ca(this.za)); + if (L.Pn(this.za) || Z != q) + break; + q = L.Oa(L.Wc(this.za) - 1), this.za++; + } + if (this.za - B == 1) + return this.Xa.fE(this.Xa.Y, B, this.qq); + for ((q = new A.Ua(this.Xa.Y.description)).addPath(this.Xa.Y, B, !0), B += 1; B < this.za; B++) + q.Fr(this.Xa.Y, B, 0, L.tv(B), !1); + return this.Xa.fE(q, 0, this.qq); + } + return null; + }, D.prototype.Ma = function() { + return 0; + }, D.prototype.re = function() { + }, D; + }(), _ = function() { + function D(L) { + this.Xa = L, this.za = 0; + } + return D.prototype.next = function() { + var L = this.Xa.Y; + if (this.za < L.ea()) { + var B = this.za; + for (L.Kr(this.za), this.za++; this.za < L.ea() && !(0 < L.Kr(this.za)); ) + this.za++; + return B == 0 && this.za == L.ea() ? this.Xa.ly(L, 0, L.ea()) : this.Xa.ly(L, B, this.za); + } + return null; + }, D.prototype.Ma = function() { + return 0; + }, D.prototype.re = function() { + }, D; + }(), C = function() { + function D(L) { + this.Ms = this.nw = this.Ns = this.Jd = null, this.$d = [], this.Vb = L, this.sb = this.Mv = this.ET = this.La = this.oA = this.dt = this.ra = 0, this.jA = this.xk = -1, this.qq = !0; + } + return D.buffer = function(L, B, q, Z, ie, se) { + if (L == null || 0 > Z) + throw A.i.O(); + if (L.B()) + return new A.Ea(L.description); + var de = new A.l(); + return L.yc(de), 0 < B && de.X(B, B), (se = new D(se)).Oj = q, se.Y = L, se.ra = A.ua.Xd(q, de, !0), se.dt = A.ua.Xd(null, de, !0), se.La = B, se.ET = L.K(), 0 >= ie && (ie = 96), se.sb = Math.abs(se.La), se.Mv = se.sb != 0 ? 1 / se.sb : 0, isNaN(Z) || Z == 0 ? Z = 1e-5 * se.sb : Z > 0.5 * se.sb && (Z = 0.5 * se.sb), 12 > ie && (ie = 12), (L = Math.abs(B) * (1 - Math.cos(Math.PI / ie))) > Z ? Z = L : (L = Math.PI / Math.acos(1 - Z / Math.abs(B))) < ie - 1 && 12 > (ie = A.P.truncate(L)) && (ie = 12, Z = Math.abs(B) * (1 - Math.cos(Math.PI / ie))), se.xk = Z, se.Fq = ie, se.oA = Math.min(se.dt, 0.25 * Z), se.gE(); + }, D.prototype.ev = function() { + if (this.Jd == null) + this.Jd = []; + else if (this.Jd.length !== 0) + return; + var L = this.lE(); + L = A.P.truncate((L + 3) / 4); + var B = 0.5 * Math.PI / L; + this.jA = B; + for (var q = 0; q < 4 * L; q++) + this.Jd.push(null); + var Z = Math.cos(B); + B = Math.sin(B); + var ie = A.h.construct(0, 1); + for (q = 0; q < L; q++) + this.Jd[q + 0 * L] = A.h.construct(ie.y, -ie.x), this.Jd[q + 1 * L] = A.h.construct(-ie.x, -ie.y), this.Jd[q + 2 * L] = A.h.construct(-ie.y, ie.x), this.Jd[q + 3 * L] = ie, (ie = A.h.construct(ie.x, ie.y)).Ct(Z, B); + }, D.prototype.gE = function() { + var L = this.Y.K(); + if (A.ba.zd(L)) + return (L = new A.Ua(this.Y.description)).pc(this.Y, !0), this.Y = L, this.gE(); + if (this.La <= this.ra) { + if (!A.ba.PS(L)) + return new A.Ea(this.Y.description); + if (0 >= this.La && (L = new A.l(), this.Y.A(L), L.S() <= 2 * -this.La || L.da() <= 2 * this.La)) + return new A.Ea(this.Y.description); + } + switch (this.Y.K()) { + case 33: + return this.KN(); + case 550: + return this.JN(); + case 1607: + return this.MN(); + case 1736: + return this.LN(); + case 197: + return this.GN(); + default: + throw A.i.Ra(); + } + }, D.prototype.MN = function() { + if (this.zG(this.Y)) { + var L = new A.Ta(); + this.Y.we(0, L); + var B = new A.l(); + return this.Y.A(B), L.Db(B.tf()), this.Iu(L); + } + return this.Y = this.RV(this.Y), L = new m(this, this.qq), A.Ih.local().W(L, this.Oj, this.Vb).next(); + }, D.prototype.LN = function() { + if (this.La == 0) + return this.Y; + var L = A.$l.local(); + if (this.ev(), this.Y = L.W(this.Y, null, !1, this.Vb), 0 > this.La) { + var B = this.Y; + return B = this.ly(B, 0, B.ea()), L.W(B, this.Oj, !1, this.Vb); + } + return this.zG(this.Y) ? (L = new A.Ta(), this.Y.we(0, L), B = new A.l(), this.Y.A(B), L.Db(B.tf()), this.Iu(L)) : (L = new _(this), A.Ih.local().W(L, this.Oj, this.Vb).next()); + }, D.prototype.ly = function(L, B, q) { + for (var Z = new A.Ea(L.description); B < q; B++) + if (!(1 > L.Ka(B))) { + var ie = L.Kr(B), se = new A.l(); + if (L.Tj(B, se), 0 < this.La) { + if (0 < ie) + if (this.AG(L, B)) + ie = new A.Ta(), L.we(L.Ca(B), ie), ie.Db(se.tf()), this.Au(Z, ie); + else { + var de = ie = new A.Ua(L.description); + de = A.au.EG(this.Y, B) || this.Bn(this.Y, B, de, !0, 1) == 2 ? this.eE(L, B) : this.An(ie), Z.add(de, !1); + } + else if (!(se.S() + this.ra <= 2 * this.sb || se.da() + this.ra <= 2 * this.sb || (de = ie = new A.Ua(L.description), this.Bn(this.Y, B, de, !0, 1), ie.B()))) { + var Ce = new A.l(); + for (Ce.L(se), Ce.X(this.sb, this.sb), de.vp(Ce), se = 1, ie = (de = this.An(ie)).ea(); se < ie; se++) + Z.addPath(de, se, !0); + } + } else if (0 < ie) { + if (!(se.S() + this.ra <= 2 * this.sb || se.da() + this.ra <= 2 * this.sb || (de = ie = new A.Ua(L.description), this.Bn(this.Y, B, de, !0, -1), ie.B()))) + for (Ce = new A.l(), de.yc(Ce), Ce.X(this.sb, this.sb), de.vp(Ce), se = 1, ie = (de = this.An(ie)).ea(); se < ie; se++) + Z.addPath(de, se, !0); + } else + for (de = ie = new A.Ua(L.description), this.Bn(this.Y, B, de, !0, -1), se = 0, ie = (de = this.An(ie)).ea(); se < ie; se++) + Z.addPath(de, se, !0); + } + if (0 < this.La) + return 1 < Z.ea() ? Z = this.An(Z) : D.kx(Z); + if (L = new A.l(), Z.yc(L), Z.B()) + return D.kx(Z); + for (L.X(this.sb, this.sb), Z.vp(L), Z = this.An(Z), L = new A.Ea(Z.description), se = 1, ie = Z.ea(); se < ie; se++) + L.addPath(Z, se, !1); + return D.kx(L); + }, D.prototype.KN = function() { + return this.Iu(this.Y); + }, D.prototype.Iu = function(L) { + var B = new A.Ea(this.Y.description); + return this.Au(B, L), this.oX(B); + }, D.prototype.JN = function() { + var L = new b(this.Y, this.La, this.Oj, this.xk, this.Fq, this.Vb); + return A.Ih.local().W(L, this.Oj, this.Vb).next(); + }, D.prototype.GN = function() { + var L = new A.Ea(this.Y.description); + if (0 >= this.La) { + if (this.La == 0) + L.bd(this.Y, !1); + else { + var B = new A.Hh(); + this.Y.dn(B), B.X(this.La, this.La), L.bd(B, !1); + } + return L; + } + return L.bd(this.Y, !1), this.Y = L, this.eE(L, 0); + }, D.prototype.eE = function(L, B) { + this.ev(); + var q = new A.Ea(L.description), Z = new A.h(), ie = new A.h(), se = new A.h(), de = new A.h(), Ce = new A.h(), Ve = new A.h(), Je = new A.h(), Pt = new A.h(), $t = L.Ka(B), qe = L.Ca(B), Rt = 0; + for (B = L.Ka(B); Rt < B; Rt++) { + if (L.D(qe + Rt, ie), L.D(qe + (Rt + 1) % $t, de), L.D(qe + (Rt + 2) % $t, Ve), Je.vc(de, ie), Je.length() == 0 || (Je.Jv(), Je.normalize(), Je.scale(this.sb), Z.add(Je, ie), se.add(Je, de), Rt == 0 ? q.Nt(Z) : q.Ei(Z), q.Ei(se), Pt.vc(Ve, de), Pt.length() == 0)) + throw A.i.Ra(); + Pt.Jv(), Pt.normalize(), Pt.scale(this.sb), Ce.add(Pt, de), this.BD(q, de, se, Ce, !1); + } + return D.kx(q); + }, D.prototype.fE = function(L, B, q) { + if (this.ev(), 1 > L.Ka(B)) + return null; + if (this.AG(L, B) && 0 < this.La) { + q = new A.Ta(), L.we(L.Ca(B), q); + var Z = new A.l(); + return L.Tj(B, Z), q.Db(Z.tf()), this.Iu(q); + } + if (Z = new A.Ua(L.description), L.Pn(B)) + this.Bn(L, B, Z, q, 1), this.Bn(L, B, Z, q, -1); + else { + var ie = new A.Ua(L.description); + ie.addPath(L, B, !1), ie.Fr(L, B, 0, L.tv(B), !1), this.Bn(ie, 0, Z, q, 1); + } + return this.An(Z); + }, D.prototype.Zq = function() { + if (this.$s++, this.$s % 1024 == 0 && this.Vb != null && !this.Vb.progress(-1, -1)) + throw A.i.hu("user_canceled"); + }, D.prototype.An = function(L) { + return A.Hg.Ok(L, this.dt, !0, !0, this.Vb); + }, D.prototype.lE = function() { + if (this.xk == 0) + return this.Fq; + var L = 1 - this.xk * Math.abs(this.Mv); + return 4 > (L = -1 > L ? 4 : 2 * Math.PI / Math.acos(L) + 0.5) ? L = 4 : L > this.Fq && (L = this.Fq), A.P.truncate(L); + }, D.prototype.BD = function(L, B, q, Z, ie) { + this.ev(); + var se = new A.h(); + se.vc(q, B), se.scale(this.Mv); + var de = new A.h(); + de.vc(Z, B), de.scale(this.Mv), 0 > (se = Math.atan2(se.y, se.x) / this.jA) && (se = this.Jd.length + se), se = this.Jd.length - se, 0 > (de = Math.atan2(de.y, de.x) / this.jA) && (de = this.Jd.length + de), (de = this.Jd.length - de) < se && (de += this.Jd.length); + var Ce = A.P.truncate(de); + de = A.P.truncate(Math.ceil(se)), (se = new A.h()).N(this.Jd[de % this.Jd.length]), se.Dt(this.sb, B); + var Ve = 10 * this.ra; + for (se.sub(q), se.length() < Ve && (de += 1), se.N(this.Jd[Ce % this.Jd.length]), se.Dt(this.sb, B), se.sub(Z), se.length() < Ve && --Ce, q = Ce - de, q++, Ce = 0, de %= this.Jd.length; Ce < q; Ce++, de = (de + 1) % this.Jd.length) + se.N(this.Jd[de]), se.Dt(this.sb, B), L.Ei(se), this.Zq(); + ie && L.Ei(Z); + }, D.prototype.Bn = function(L, B, q, Z, ie) { + var se = new A.hd(), de = se.hN(L, B); + if (se.Ip(this.oA, !1, !1), 2 > se.I(de)) + return 0 > ie || (ie = L, se = new A.Ta(), ie.we(ie.Ca(B), se), this.Au(q, se)), 1; + var Ce = se.Oa(se.Ya(se.Ob(de))), Ve = new A.Ed(); + if (Ve.ig(-Ce.x, -Ce.y), se.Pc(Ve), Z && (this.oQ(se, de, ie), 2 > se.I(de))) + return 0 > ie || (ie = L, se = new A.Ta(), ie.we(ie.Ca(B), se), this.Au(q, se)), 1; + this.$d.length = 0; + var Je = se.Ob(de); + B = se.Ya(Je); + var Pt = ie == 1 ? se.Na(B) : se.V(B); + L = ie == 1 ? se.V(B) : se.Na(B); + var $t = !0; + Z = new A.h(), de = new A.h(); + var qe = new A.h(), Rt = new A.h(), Zt = new A.h(), Jt = new A.h(), Xt = new A.h(), Qt = new A.h(), bi = new A.h(), Mi = new A.h(), Ri = this.sb; + Je = se.Ka(Je); + for (var Yi = 0; Yi < Je; Yi++) + se.D(L, de), $t && (se.D(B, Z), se.D(Pt, qe), Qt.vc(Z, qe), Qt.normalize(), Mi.HG(Qt), Mi.scale(Ri), Rt.add(Mi, Z)), Xt.vc(de, Z), Xt.normalize(), bi.HG(Xt), bi.scale(Ri), Zt.add(Z, bi), Pt = Qt.yi(Xt), $t = Qt.Sh(Xt), 0 > Pt || 0 > $t && Pt == 0 ? this.$d.push(T.Su(Rt, Zt, Z, 2, this.$d.length + 1, this.$d.length - 1)) : Rt.rb(Zt) || (this.$d.push(T.construct(Rt, Z, this.$d.length + 1, this.$d.length - 1, "dummy")), this.$d.push(T.construct(Z, Zt, this.$d.length + 1, this.$d.length - 1, "dummy"))), Jt.add(de, bi), this.$d.push(T.Su(Zt, Jt, Z, 1, this.$d.length + 1, this.$d.length - 1)), Rt.N(Jt), Mi.N(bi), qe.N(Z), Z.N(de), Qt.N(Xt), Pt = B, B = L, $t = !1, L = ie == 1 ? se.V(B) : se.Na(B); + return this.$d[this.$d.length - 1].sh = 0, this.$d[0].uh = this.$d.length - 1, this.TV(q), Ve.ig(Ce.x, Ce.y), q.TD(Ve, q.ea() - 1), 1; + }, D.prototype.TV = function(L) { + for (var B = this.uO(), q = !0, Z = B + 1, ie = B; Z != B; ie = Z) { + var se = this.$d[ie]; + Z = se.sh != -1 ? se.sh : (ie + 1) % this.$d.length, se.Eo != 0 && (q && L.Nt(se.Km), se.Eo == 2 ? this.BD(L, se.cw, se.Km, se.Xm, !0) : L.Ei(se.Xm), q = !1); + } + }, D.prototype.uO = function() { + this.Ms == null && (this.Ms = [null, null, null, null, null, null, null, null, null]); + for (var L = 0, B = 0, q = this.$d.length; B < q; ) { + var Z = this.$d[B]; + if (3 & Z.Eo) { + L = B; + break; + } + B = Z.sh; + } + for (q = L + 1, B = L; q != L; B = q) { + q = (Z = this.$d[B]).sh; + for (var ie = 1, se = null; q != B && !(3 & (se = this.$d[q]).Eo); ) + q = se.sh, ie++; + ie != 1 && (Z.Eo & se.Eo) == 1 && (this.Ns == null && (this.Ns = new A.zb(), this.nw = new A.zb()), this.Ns.Ec(Z.Km), this.Ns.Rc(Z.Xm), this.nw.Ec(se.Km), this.nw.Rc(se.Xm), this.Ns.Fa(this.nw, this.Ms, null, null, this.dt) == 1 && (Z.Xm.N(this.Ms[0]), se.Km.N(this.Ms[0]), Z.sh = q, se.uh = B)); + } + return L; + }, D.prototype.Hv = function(L, B, q) { + var Z = new A.h(); + if (Z.vc(q, L), q = Z.length(), 0 < (q = this.sb * this.sb - q * q * 0.25)) { + q = Math.sqrt(q), Z.normalize(), Z.cr(); + var ie = new A.h(); + if (ie.vc(B, L), ie.Sh(Z) + q >= this.sb) + return !0; + } + return !1; + }, D.prototype.oQ = function(L, B, q) { + for (var Z = 0; 1 > Z; Z++) { + var ie = !1, se = L.Ob(B), de = L.Ka(se); + if (de == 0) + break; + var Ce = de; + if (3 > de) + break; + !L.ec(se) && (Ce = de - 1), se = L.Ya(se), de = 0 < q ? L.Na(se) : L.V(se); + for (var Ve = 0 < q ? L.V(se) : L.Na(se), Je = de, Pt = !0, $t = new A.h(), qe = new A.h(), Rt = new A.h(), Zt = new A.h(), Jt = new A.h(), Xt = A.h.construct(0, 0), Qt = new A.h(), bi = new A.h(), Mi = new A.h(), Ri = new A.h(), Yi = this.sb, rr = 0, _i = 0; _i < Ce && (L.D(Ve, qe), Pt && (L.D(se, $t), L.D(de, Rt), Je = de), bi.vc($t, Rt), bi.normalize(), Qt.vc(qe, $t), Qt.normalize(), Je != Ve); ) { + var fn = bi.yi(Qt), jr = bi.Sh(Qt), no = !0; + if (0 > fn || 0 > jr && fn == 0 || !this.Hv(Rt, $t, qe) || (Xt.N(qe), no = !1, ++rr, ie = !0), no) { + if (0 < rr) + for (; (fn = 0 < q ? L.Na(Je) : L.V(Je)) != se; ) { + if (L.D(fn, Zt), !this.Hv(Zt, Rt, Xt)) { + fn != Ve && this.Hv(Zt, Rt, qe) && this.Hv(Zt, $t, qe) && (Rt.N(Zt), Je = fn, no = !1, ++rr); + break; + } + Rt.N(Zt), Je = fn, no = !1, ++rr; + } + if (!no) + continue; + if (0 < rr) { + for (Je = 0 < q ? L.Na(de) : L.V(de), Pt = 1; Pt < rr; Pt++) + no = 0 < q ? L.Na(Je) : L.V(Je), L.qd(Je, !0), Je = no; + Mi.vc($t, Rt), rr = Yi * Yi - (rr = Mi.length()) * rr * 0.25, Yi - (rr = Math.sqrt(rr)) > 0.5 * this.xk ? (Jt.add(Rt, $t), Jt.scale(0.5), Mi.normalize(), Mi.cr(), Ri.N(Mi), Ri.scale(Yi - rr), Jt.add(Ri), L.mf(de, Jt)) : L.qd(de, !0), rr = 0; + } + Rt.N($t), Je = se; + } + $t.N(qe), de = se, se = Ve, Ve = 0 < q ? L.V(se) : L.Na(se), _i++, Pt = !1; + } + if (0 < rr) { + for (Je = 0 < q ? L.Na(de) : L.V(de), Pt = 1; Pt < rr; Pt++) + no = 0 < q ? L.Na(Je) : L.V(Je), L.qd(Je, !0), Je = no; + Jt.add(Rt, $t), Jt.scale(0.5), Mi.vc($t, Rt), rr = Yi * Yi - (rr = Mi.length()) * rr * 0.25, rr = Math.sqrt(rr), Mi.normalize(), Mi.cr(), Ri.N(Mi), Ri.scale(Yi - rr), Jt.add(Ri), L.mf(de, Jt); + } + if (L.Ip(this.oA, !1, !1), !ie) + break; + } + }, D.prototype.AG = function(L, B) { + if (L.Ka(B) == 1) + return !0; + var q = new A.l(); + return L.Tj(B, q), Math.max(q.S(), q.da()) < 0.5 * this.xk; + }, D.prototype.zG = function(L) { + var B = new A.l(); + return L.A(B), Math.max(B.S(), B.da()) < 0.5 * this.xk; + }, D.prototype.RV = function(L) { + for (var B = 0, q = 0, Z = (L = A.zC.local().W(L, 0.25 * this.xk, !1, this.Vb)).ea(); q < Z; q++) + B = Math.max(L.Ka(q), B); + return 32 > B ? (this.qq = !1, L) : (this.qq = !0, A.Hg.Ok(L, this.dt, !1, !0, this.Vb)); + }, D.prototype.Au = function(L, B) { + if (B = B.D(), this.Jd != null && this.Jd.length !== 0) { + var q = new A.h(); + q.N(this.Jd[0]), q.Dt(this.sb, B), L.Nt(q); + for (var Z = 1, ie = this.Jd.length; Z < ie; Z++) + q.N(this.Jd[Z]), q.Dt(this.sb, B), L.Ei(q); + } else { + Z = this.lE(), q = A.P.truncate((Z + 3) / 4), Z = 0.5 * Math.PI / q, ie = Math.cos(Z); + for (var se = Math.sin(Z), de = new A.h(), Ce = 3; 0 <= Ce; Ce--) { + switch (de.na(0, this.sb), Ce) { + case 0: + for (Z = 0; Z < q; Z++) + L.Aj(de.x + B.x, de.y + B.y), de.Ct(ie, se); + break; + case 1: + for (Z = 0; Z < q; Z++) + L.Aj(-de.y + B.x, de.x + B.y), de.Ct(ie, se); + break; + case 2: + for (Z = 0; Z < q; Z++) + L.Aj(-de.x + B.x, -de.y + B.y), de.Ct(ie, se); + break; + default: + for (L.rx(de.y + B.x, -de.x + B.y), Z = 1; Z < q; Z++) + de.Ct(ie, se), L.Aj(de.y + B.x, -de.x + B.y); + } + this.Zq(); + } + } + }, D.kx = function(L) { + return L.Eh(1, 0), L; + }, D.prototype.oX = function(L) { + return L.Eh(2, this.ra), L.hm(), L; + }, D; + }(); + A.CK = C; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.Da = T, this.g = new A.hd(), this.ed = new A.ja(0); + } + return H.prototype.Nh = function(T, b, m) { + switch (b) { + case 0: + if (T.v < m && T.C <= m) + break; + return T.v >= m ? 1 : -1; + case 1: + if (T.G < m && T.H <= m) + break; + return T.G >= m ? 1 : -1; + case 2: + if (T.v >= m && T.C > m) + break; + return T.C <= m ? 1 : -1; + case 3: + if (!(T.G >= m && T.H > m)) + return T.H <= m ? 1 : -1; + } + return 0; + }, H.prototype.vy = function(T, b) { + return T.K() == 1736 ? this.xy(T, b) : this.yy(T); + }, H.prototype.xy = function(T, b) { + if (this.Da.S() == 0 || this.Da.da() == 0) + return T.Ja(); + var m = new A.l(); + T.yc(m), this.Y = this.g.Ib(T); + var _ = new A.l(), C = new A.l(), D = new A.h(), L = new A.h(), B = [0, 0, 0, 0, 0, 0, 0, 0, 0], q = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + new A.jg(); + var Z = new A.zb(), ie = new A.ja(0); + ie.Jb(Math.min(100, T.I())); + for (var se = !1, de = 0; !se && 4 > de; de++) { + var Ce = !1, Ve = (1 & de) != 0, Je = 0; + switch (de) { + case 0: + Je = this.Da.v, Ce = m.v <= Je && m.C >= Je; + break; + case 1: + Je = this.Da.G, Ce = m.G <= Je && m.H >= Je; + break; + case 2: + Je = this.Da.C, Ce = m.v <= Je && m.C >= Je; + break; + case 3: + Je = this.Da.H, Ce = m.G <= Je && m.H >= Je; + } + if (Ce) + for (se = !0, Ce = this.g.Ob(this.Y); Ce != -1; ) { + var Pt = -1, $t = -1, qe = this.g.Ya(Ce), Rt = qe; + do { + var Zt = this.g.cc(Rt); + Zt == null && (Zt = Z, this.g.D(Rt, D), Zt.Ec(D), this.g.D(this.g.V(Rt), L), Zt.Rc(L)), Zt.A(_); + var Jt = this.Nh(_, de, Je), Xt = 0, Qt = -1; + if (Jt == -1) { + Xt = 0 < (Zt = Zt.fq(Ve, Je, B, q)) ? this.g.Wl(Rt, q, Zt) : 0, Xt += 1; + var bi = Rt, Mi = this.g.V(bi); + for (Zt = 0; Zt < Xt; Zt++) { + if (this.g.D(bi, D), this.g.D(Mi, L), (Qt = this.g.cc(bi)) == null && ((Qt = Z).Ec(D), Qt.Rc(L)), Qt.A(C), (Qt = this.Nh(C, de, Je)) == -1) { + if (Ve) + (Qt = Math.abs(D.y - Je)) < (Ri = Math.abs(L.y - Je)) ? (D.y = Je, this.g.mf(bi, D)) : (L.y = Je, this.g.mf(Mi, L)); + else { + Qt = Math.abs(D.x - Je); + var Ri = Math.abs(L.x - Je); + Qt < Ri ? (D.x = Je, this.g.mf(bi, D)) : (L.x = Je, this.g.mf(Mi, L)); + } + (Qt = this.g.cc(bi)) == null && ((Qt = Z).Ec(D), Qt.Rc(L)), Qt.A(C), Qt = this.Nh(C, de, Je); + } + Ri = Pt, Pt = Qt, $t == -1 && ($t = Pt), Ri == 0 && Pt == 1 || Ri == 1 && Pt == 0 || Ri != 0 || Pt != 0 || ie.add(bi), Pt == 1 && (se = !1), Qt = bi = Mi, Mi = this.g.V(Mi); + } + } + Xt == 0 && (Ri = Pt, Pt = Jt, $t == -1 && ($t = Pt), Ri == 0 && Pt == 1 || Ri == 1 && Pt == 0 || Ri != 0 || Pt != 0 || ie.add(Rt), Pt == 1 && (se = !1), Qt = this.g.V(Rt)), Rt = Qt; + } while (Rt != qe); + for ($t == 0 && Pt == 0 && ie.add(qe), Zt = 0, Pt = ie.size; Zt < Pt; Zt++) + $t = ie.get(Zt), this.g.qd($t, !1); + ie.clear(!1), Ce = 3 > this.g.Ka(Ce) ? this.g.ar(Ce) : this.g.Sb(Ce); + } + } + return se ? T.Ja() : (this.AB(), 0 < b && this.Hy(b), this.g.Ke(this.Y)); + }, H.prototype.yy = function(T) { + var b = new A.l(), m = new A.l(), _ = [0, 0, 0, 0, 0, 0, 0, 0, 0], C = [0, 0, 0, 0, 0, 0, 0, 0, 0], D = new A.jg(), L = T, B = new A.l(); + T.yc(B); + for (var q = 0; 4 > q; q++) { + var Z = !1, ie = (1 & q) != 0, se = 0; + switch (q) { + case 0: + se = this.Da.v, Z = B.v <= se && B.C >= se; + break; + case 1: + se = this.Da.G, Z = B.G <= se && B.H >= se; + break; + case 2: + se = this.Da.C, Z = B.v <= se && B.C >= se; + break; + case 3: + se = this.Da.H, Z = B.G <= se && B.H >= se; + } + if (Z) { + Z = L, L = T.Ja(), (Z = Z.Ha()).aj(); + for (var de, Ce = new A.h(); Z.ab(); ) + for (var Ve, Je = !0; Z.Ia(); ) { + var Pt = Z.ia(); + Pt.A(b); + var $t = this.Nh(b, q, se); + if ($t == -1) { + if (0 < ($t = Pt.fq(ie, se, _, C))) { + var qe = 0; + de = Pt.bc(); + for (var Rt = 0; Rt <= $t; Rt++) + if (qe != (Ve = Rt < $t ? C[Rt] : 1)) { + Pt.dh(qe, Ve, D); + var Zt = D.get(); + Zt.Ec(de), Rt < $t && (ie ? (Ce.x = _[Rt], Ce.y = se) : (Ce.x = se, Ce.y = _[Rt]), Zt.Rc(Ce)), Zt.A(m); + var Jt = this.Nh(m, q, se); + if (Jt == -1) { + if (de = Zt.bc(), qe = Zt.xc(), ie) + (Jt = Math.abs(de.y - se)) < (Xt = Math.abs(qe.y - se)) ? (de.y = se, Zt.Ec(de)) : (qe.y = se, Zt.Rc(qe)); + else { + Jt = Math.abs(de.x - se); + var Xt = Math.abs(qe.x - se); + Jt < Xt ? (de.x = se, Zt.Ec(de)) : (qe.x = se, Zt.Rc(qe)); + } + Zt.A(m), Jt = this.Nh(m, q, se); + } + de = Zt.xc(), qe = Ve, (Ve = Jt) == 1 ? (L.pc(Zt, Je), Je = !1) : Je = !0; + } + } + } else + (Ve = $t) == 1 ? (L.pc(Pt, Je), Je = !1) : Je = !0; + } + } + } + return L; + }, H.prototype.AB = function() { + this.li = -1, this.Xl(!1, this.Da.v), this.Xl(!1, this.Da.C), this.Xl(!0, this.Da.G), this.Xl(!0, this.Da.H), this.ed.resize(0), this.ed.Jb(100), this.li = this.g.Hd(); + for (var T = new A.h(), b = this.g.Ob(this.Y); b != -1; b = this.g.Sb(b)) + for (var m = this.g.Ya(b), _ = 0, C = this.g.Ka(b); _ < C; _++, m = this.g.V(m)) + this.g.D(m, T), (this.Da.v == T.x || this.Da.C == T.x || this.Da.G == T.y || this.Da.H == T.y) && (this.g.Sa(m, this.li, this.ed.size), this.ed.add(m)); + this.Pl(!1, this.Da.v), this.Pl(!1, this.Da.C), this.Pl(!0, this.Da.G), this.Pl(!0, this.Da.H), this.Oy(); + }, H.prototype.Hy = function(T) { + for (var b = new A.h(), m = new A.h(), _ = A.P.mg(2048, 0), C = this.g.Ob(this.Y); C != -1; C = this.g.Sb(C)) { + var D = this.g.Ya(C), L = D; + do { + var B = this.g.V(L); + this.g.D(L, b); + var q = -1; + if (b.x == this.Da.v ? (this.g.D(B, m), m.x == this.Da.v && (q = 1)) : b.x == this.Da.C && (this.g.D(B, m), m.x == this.Da.C && (q = 1)), b.y == this.Da.G ? (this.g.D(B, m), m.y == this.Da.G && (q = 0)) : b.y == this.Da.H && (this.g.D(B, m), m.y == this.Da.H && (q = 0)), q != -1 && (q = A.h.ub(b, m), !(1 >= (q = A.P.truncate(Math.min(Math.ceil(q / T), 2048)))))) { + for (var Z = 1; Z < q; Z++) + _[Z - 1] = 1 * Z / q; + this.g.Wl(L, _, q - 1); + } + L = B; + } while (L != D); + } + }, H.prototype.Xl = function(T, b) { + var m = this.g.Hd(), _ = new A.h(), C = new A.ja(0); + C.Jb(100); + for (var D = this.g.Ob(this.Y); D != -1; D = this.g.Sb(D)) + for (var L = this.g.Ya(D), B = 0, q = this.g.Ka(D); B < q; B++) { + var Z = this.g.V(L); + this.g.D(L, _), (T ? _.y == b : _.x == b) && (this.g.D(Z, _), (T ? _.y == b : _.x == b) && (this.g.Qa(L, m) != 1 && (C.add(L), this.g.Sa(L, m, 1)), this.g.Qa(Z, m) != 1 && (C.add(Z), this.g.Sa(Z, m, 1)))), L = Z; + } + if (this.g.Ud(m), !(3 > C.size)) { + var ie = this; + C.Wd(0, C.size, function(Jt, Xt) { + return ie.Oh(Jt, Xt); + }), m = new A.h(), D = new A.h(), L = new A.h(), D.Sc(); + var se = -1; + B = new A.ja(0), q = new A.ja(0), Z = this.g.Hd(); + for (var de = this.g.Hd(), Ce = 0, Ve = C.size; Ce < Ve; Ce++) { + var Je = C.get(Ce); + if (this.g.D(Je, _), !_.rb(D)) { + if (se != -1) { + for (var Pt = se; Pt < Ce; Pt++) { + se = C.get(Pt); + var $t = this.g.V(se); + Je = this.g.Na(se); + var qe = !1; + 0 > this.Oh(se, $t) && (this.g.D($t, m), T ? m.y == b : m.x == b) && (B.add(se), qe = !0, this.g.Sa(se, de, 1)), 0 > this.Oh(se, Je) && (this.g.D(Je, m), T ? m.y == b : m.x == b) && (qe || B.add(se), this.g.Sa(se, Z, 1)); + } + for (Pt = 0, qe = B.size; Pt < qe; Pt++) { + if (se = B.get(Pt), Je = this.g.Qa(se, Z), $t = this.g.Qa(se, de), Je == 1) { + Je = this.g.Na(se), this.g.D(Je, L); + var Rt = [0]; + if (Rt[0] = 0, !L.rb(_)) { + var Zt = A.h.ub(D, L); + Rt[0] = A.h.ub(L, _) / Zt, Rt[0] == 0 ? Rt[0] = 2220446049250313e-31 : Rt[0] == 1 && (Rt[0] = 0.9999999999999998), this.g.Wl(Je, Rt, 1), Je = this.g.Na(se), this.g.mf(Je, _), q.add(Je), this.g.Sa(Je, Z, 1), this.g.Sa(Je, de, -1); + } + } + $t == 1 && ($t = this.g.V(se), this.g.D($t, L), (Rt = [0])[0] = 0, L.rb(_) || (Zt = A.h.ub(D, L), Rt[0] = A.h.ub(D, _) / Zt, Rt[0] == 0 ? Rt[0] = 2220446049250313e-31 : Rt[0] == 1 && (Rt[0] = 0.9999999999999998), this.g.Wl(se, Rt, 1), Je = this.g.V(se), this.g.mf(Je, _), q.add(Je), this.g.Sa(Je, Z, -1), this.g.Sa(Je, de, 1))); + } + se = B, B = q, (q = se).clear(!1); + } + se = Ce, D.N(_); + } + } + this.g.Ud(Z), this.g.Ud(de); + } + }, H.prototype.Pl = function(T, b) { + var m = new A.h(), _ = new A.ja(0); + _.Jb(100); + for (var C = this.g.Hd(), D = 0, L = this.ed.size; D < L; D++) { + var B = this.ed.get(D); + if (B != -1) { + var q = this.g.V(B); + this.g.D(B, m), (T ? m.y == b : m.x == b) && (this.g.D(q, m), (T ? m.y == b : m.x == b) && (this.g.Qa(B, C) != -2 && (_.add(B), this.g.Sa(B, C, -2)), this.g.Qa(q, C) != -2 && (_.add(q), this.g.Sa(q, C, -2)))); + } + } + if (_.size != 0) { + var Z = this; + for (_.Wd(0, _.size, function(Xt, Qt) { + return Z.Oh(Xt, Qt); + }), D = 0, L = _.size; D < L; D++) { + var ie = _.get(D); + this.g.Sa(ie, C, D); + } + B = new A.h(), (q = new A.h()).Sc(); + var se = -1; + for (D = 0, L = _.size; D < L; D++) + if ((ie = _.get(D)) != -1 && (this.g.D(ie, m), !m.rb(q))) { + if (se != -1) + for (; ; ) { + ie = !1; + for (var de = 1 < D - se ? D - 1 : D, Ce = se; Ce < de; Ce++) { + var Ve = _.get(Ce); + if (Ve != -1) { + var Je = -1, Pt = this.g.V(Ve); + 0 > this.Oh(Ve, Pt) && (this.g.D(Pt, B), T ? B.y == b : B.x == b) && (Je = Pt), Pt = -1; + var $t = this.g.Na(Ve); + if (0 > this.Oh(Ve, $t) && (this.g.D($t, B), T ? B.y == b : B.x == b) && (Pt = $t), Je != -1 && Pt != -1) + this.Mh(Ve, _, C), this.g.qd(Ve, !1), this.Mh(Je, _, C), this.g.qd(Je, !1), ie = !0; + else if (Je != -1 || Pt != -1) { + for ($t = Ce + 1; $t < D; $t++) { + var qe = _.get($t); + if (qe != -1) { + var Rt = this.g.V(qe), Zt = -1; + 0 > this.Oh(qe, Rt) && (this.g.D(Rt, B), T ? B.y == b : B.x == b) && (Zt = Rt), Rt = this.g.Na(qe); + var Jt = -1; + if (0 > this.Oh(qe, Rt) && (this.g.D(Rt, B), T ? B.y == b : B.x == b) && (Jt = Rt), Zt != -1 && Jt != -1) { + this.Mh(qe, _, C), this.g.qd(qe, !1), this.Mh(Zt, _, C), this.g.qd(Zt, !1), ie = !0; + break; + } + if (Je != -1 && Jt != -1) { + this.At(_, Ve, Je, qe, Jt, C), ie = !0; + break; + } + if (Pt != -1 && Zt != -1) { + this.At(_, qe, Zt, Ve, Pt, C), ie = !0; + break; + } + } + } + if (ie) + break; + } + } + } + if (!ie) + break; + } + se = D, q.N(m); + } + } + this.g.Ud(C); + }, H.prototype.Mh = function(T, b, m) { + m = this.g.Qa(T, m), b.set(m, -1), m = this.g.Qa(T, this.li), this.ed.set(m, -1), (b = this.g.cd(T)) != -1 && this.g.Ya(b) == T && (this.g.Kf(b, -1), this.g.Yg(b, -1)); + }, H.prototype.At = function(T, b, m, _, C, D) { + this.g.Cc(b, _), this.g.Dc(_, b), this.g.Dc(m, C), this.g.Cc(C, m), this.Mh(_, T, D), this.g.oi(_, !1), this.Mh(C, T, D), this.g.oi(C, !0); + }, H.prototype.Oy = function() { + for (var T = 0, b = this.ed.size; T < b; T++) { + var m = this.ed.get(T); + m != -1 && this.g.cj(m, -1); + } + for (var _ = 0, C = 0, D = this.g.Ob(this.Y); D != -1; ) { + var L = this.g.Ya(D); + if (L == -1 || D != this.g.cd(L)) { + var B = D; + D = this.g.Sb(D), this.g.Kf(B, -1), this.g.br(B); + } else { + m = L, B = 0; + do + this.g.cj(m, D), B++, m = this.g.V(m); + while (m != L); + 2 >= B ? (m = this.g.Qa(L, this.li), this.ed.set(m, -1), L = this.g.qd(L, !1), B == 2 && (m = this.g.Qa(L, this.li), this.ed.set(m, -1), this.g.qd(L, !1)), B = D, D = this.g.Sb(D), this.g.Kf(B, -1), this.g.br(B)) : (this.g.fp(D, !1), this.g.Yg(D, this.g.Na(L)), this.g.Xj(D, B), C += B, _++, D = this.g.Sb(D)); + } + } + for (T = 0, b = this.ed.size; T < b; T++) + if ((m = this.ed.get(T)) != -1 && (D = this.g.cd(m)) == -1) { + D = this.g.wf(this.Y, -1), B = 0, L = m; + do + this.g.cj(m, D), B++, m = this.g.V(m); + while (m != L); + 2 >= B ? (m = this.g.Qa(L, this.li), this.ed.set(m, -1), L = this.g.qd(L, !1), B == 2 && (0 <= (m = this.g.Qa(L, this.li)) && this.ed.set(m, -1), this.g.qd(L, !1)), B = D, this.g.Kf(B, -1), this.g.br(B)) : (this.g.mn(D, !0), this.g.Xj(D, B), this.g.Kf(D, L), this.g.Yg(D, this.g.Na(L)), this.g.fp(D, !1), C += B, _++); + } + for (this.g.Tl(this.Y, _), this.g.Vj(this.Y, C), T = 0, b = this.g.md; b != -1; b = this.g.ve(b)) + T += this.g.I(b); + this.g.XB(T); + }, H.wy = function(T, b, m) { + return new H(b).vy(T, m); + }, H.clip = function(T, b, m, _) { + if (T.B()) + return T; + if (b.B()) + return T.Ja(); + if ((m = T.K()) == 33) + return _ = T.D(), b.contains(_) ? T : T.Ja(); + if (m == 197) + return _ = new A.l(), T.A(_), _.Fa(b) ? (b = new A.Hh(), T.copyTo(b), b.Zo(_), b) : T.Ja(); + var C = new A.l(); + if (T.yc(C), b.contains(C)) + return T; + if (!b.isIntersecting(C)) + return T.Ja(); + if ((C = T.Cb) != null && (C = C.Hk) != null) { + if ((C = C.To(b)) == 1) { + if (m != 1736) + throw A.i.Ra(); + return (T = new A.Ea(T.description)).vp(b), T; + } + if (C == 0) + return T.Ja(); + } + switch (m) { + case 550: + m = null, C = T.I(); + for (var D = T.vb(0), L = 0, B = 0; B < C; B++) + _ = new A.h(), D.uc(2 * B, _), b.contains(_) || (L == 0 && (m = T.Ja()), L < B && m.Gd(T, L, B), L = B + 1); + return 0 < L && m.Gd(T, L, C), L == 0 ? T : m; + case 1736: + case 1607: + return H.wy(T, b, _); + default: + throw A.i.Ra(); + } + }, H.prototype.Oh = function(T, b) { + var m = new A.h(); + return this.g.D(T, m), T = new A.h(), this.g.D(b, T), m.compare(T); + }, H; + }(); + A.Vd = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b) { + this.Da = T, this.g = new A.hd(), this.ed = new A.ja(0), this.od = b; + } + return H.prototype.Nh = function(T, b, m) { + switch (b) { + case 0: + if (T.v < m && T.C <= m) + break; + return T.v >= m ? 1 : -1; + case 1: + if (T.G < m && T.H <= m) + break; + return T.G >= m ? 1 : -1; + case 2: + if (T.v >= m && T.C > m) + break; + return T.C <= m ? 1 : -1; + case 3: + if (!(T.G >= m && T.H > m)) + return T.H <= m ? 1 : -1; + } + return 0; + }, H.prototype.vy = function(T, b) { + return T.K() == 1736 ? this.xy(T, b) : this.yy(T); + }, H.prototype.xy = function(T, b) { + if (this.Da.S() == 0 || this.Da.da() == 0) + return T.Ja(); + var m = new A.l(); + T.yc(m), this.Y = this.g.Ib(T); + var _ = new A.l(), C = new A.l(), D = new A.h(), L = new A.h(), B = [0, 0, 0, 0, 0, 0, 0, 0, 0], q = [0, 0, 0, 0, 0, 0, 0, 0, 0], Z = new A.zb(), ie = new A.ja(0); + ie.Jb(256); + for (var se = !1, de = 0; !se && 4 > de; de++) { + var Ce = !1, Ve = (1 & de) != 0, Je = 0; + switch (de) { + case 0: + Je = this.Da.v, Ce = m.v <= Je && m.C >= Je; + break; + case 1: + Je = this.Da.G, Ce = m.G <= Je && m.H >= Je; + break; + case 2: + Je = this.Da.C, Ce = m.v <= Je && m.C >= Je; + break; + case 3: + Je = this.Da.H, Ce = m.G <= Je && m.H >= Je; + } + if (Ce) + for (se = !0, Ce = this.g.Ob(this.Y); Ce != -1; ) { + var Pt = !0, $t = -1, qe = -1, Rt = this.g.Ya(Ce), Zt = Rt; + do { + var Jt = this.g.cc(Zt); + Jt == null && (Jt = Z, this.g.D(Zt, D), Jt.Ec(D), this.g.D(this.g.V(Zt), L), Jt.Rc(L)), Jt.A(_); + var Xt = this.Nh(_, de, Je), Qt = 0, bi = -1; + if (Xt == -1) { + Qt = 0 < (Jt = Jt.fq(Ve, Je, B, q)) ? this.g.HX(Zt, q, Jt) : 0, Qt += 1; + var Mi = Zt, Ri = this.g.V(Mi); + for (Jt = 0; Jt < Qt; Jt++) { + if (this.g.D(Mi, D), this.g.D(Ri, L), (bi = this.g.cc(Mi)) == null && ((bi = Z).Ec(D), bi.Rc(L)), bi.A(C), (bi = this.Nh(C, de, Je)) == -1) { + if (Ve) + (bi = Math.abs(D.y - Je)) < (Yi = Math.abs(L.y - Je)) ? (D.y = Je, this.g.mf(Mi, D)) : (L.y = Je, this.g.mf(Ri, L)); + else { + bi = Math.abs(D.x - Je); + var Yi = Math.abs(L.x - Je); + bi < Yi ? (D.x = Je, this.g.mf(Mi, D)) : (L.x = Je, this.g.mf(Ri, L)); + } + (bi = this.g.cc(Mi)) == null && ((bi = Z).Ec(D), bi.Rc(L)), bi.A(C), bi = this.Nh(C, de, Je); + } + Yi = $t, $t = bi, qe == -1 && (qe = $t), Yi == 0 && $t == 1 || Yi == 1 && $t == 0 || Yi != 0 || $t != 0 || ie.add(Mi), $t == 1 && (Pt = se = !1), bi = Mi = Ri, Ri = this.g.V(Ri); + } + } + if (Qt == 0 && (Yi = $t, $t = Xt, qe == -1 && (qe = $t), Yi == 0 && $t == 1 || Yi == 1 && $t == 0 || Yi != 0 || $t != 0 || ie.add(Zt), $t == 1 && (Pt = se = !1), bi = this.g.V(Zt)), Zt = bi, 256 <= ie.size) { + for (Jt = 1, Xt = ie.size - 1; Jt < Xt; Jt++) + Qt = ie.get(Jt), this.g.qd(Qt, !1); + ie.set(1, ie.Gc()), ie.Dh(2); + } + } while (Zt != Rt); + if (!Pt) + for (qe == 0 && $t == 0 && ie.add(Rt), Jt = 0, Xt = ie.size; Jt < Xt; Jt++) + Qt = ie.get(Jt), this.g.qd(Qt, !1); + ie.clear(!1), Ce = Pt || this.g.Ka(Ce) == 0 ? this.g.ar(Ce) : this.g.Sb(Ce); + } + } + return se ? T.Ja() : (this.AB(), 0 < b && this.Hy(b), this.g.Ke(this.Y)); + }, H.prototype.yy = function(T) { + var b = new A.l(), m = new A.l(), _ = [0, 0, 0, 0, 0, 0, 0, 0, 0], C = [0, 0, 0, 0, 0, 0, 0, 0, 0], D = new A.jg(), L = T, B = new A.l(); + T.yc(B); + for (var q = new A.h(), Z = new A.h(), ie = null, se = null, de = 0; 4 > de; de++) { + var Ce = !1, Ve = (1 & de) != 0, Je = 0; + switch (de) { + case 0: + Je = this.Da.v, Ce = B.v <= Je && B.C >= Je; + break; + case 1: + Je = this.Da.G, Ce = B.G <= Je && B.H >= Je; + break; + case 2: + Je = this.Da.C, Ce = B.v <= Je && B.C >= Je; + break; + case 3: + Je = this.Da.H, Ce = B.G <= Je && B.H >= Je; + } + if (Ce) + for (Ce = L, L = T.Ja(), (Ce = Ce.Ha()).aj(); Ce.ab(); ) + for (var Pt, $t = !0; Ce.Ia(); ) { + var qe = Ce.ia(); + qe.A(b); + var Rt = this.Nh(b, de, Je); + if (Rt == -1) { + if (0 < (Rt = qe.fq(Ve, Je, _, C))) { + var Zt = 0; + qe.$p(q); + for (var Jt = 0; Jt <= Rt; Jt++) + if (Zt != (Pt = Jt < Rt ? C[Jt] : 1)) { + qe.dh(Zt, Pt, D); + var Xt = D.get(); + Xt.Ec(q), Jt < Rt && (Ve ? (Z.x = _[Jt], Z.y = Je) : (Z.x = Je, Z.y = _[Jt]), Xt.Rc(Z)), Xt.A(m); + var Qt = this.Nh(m, de, Je); + Qt == -1 && (ie == null && (ie = new A.h()), se == null && (se = new A.h()), Xt.$p(ie), Xt.Vr(se), Ve ? (Zt = Math.abs(ie.y - Je)) < (Qt = Math.abs(se.y - Je)) ? (ie.y = Je, Xt.Ec(ie)) : (se.y = Je, Xt.Rc(se)) : (Zt = Math.abs(ie.x - Je)) < (Qt = Math.abs(se.x - Je)) ? (ie.x = Je, Xt.Ec(ie)) : (se.x = Je, Xt.Rc(se)), Xt.A(m), Qt = this.Nh(m, de, Je)), Xt.Vr(q), Zt = Pt, (Pt = Qt) == 1 ? (L.pc(Xt, $t), $t = !1) : $t = !0; + } + } + } else + (Pt = Rt) == 1 ? (L.pc(qe, $t), $t = !1) : $t = !0; + } + } + return L; + }, H.prototype.AB = function() { + this.li = -1, this.Xl(!1, this.Da.v), this.Xl(!1, this.Da.C), this.Xl(!0, this.Da.G), this.Xl(!0, this.Da.H), this.ed.resize(0), this.ed.Jb(100), this.li = this.g.Hd(); + for (var T = new A.h(), b = this.g.Ob(this.Y); b != -1; b = this.g.Sb(b)) + for (var m = this.g.Ya(b), _ = 0, C = this.g.Ka(b); _ < C; _++, m = this.g.V(m)) + this.g.D(m, T), (this.Da.v == T.x || this.Da.C == T.x || this.Da.G == T.y || this.Da.H == T.y) && (this.g.Sa(m, this.li, this.ed.size), this.ed.add(m)); + this.Pl(!1, this.Da.v), this.Pl(!1, this.Da.C), this.Pl(!0, this.Da.G), this.Pl(!0, this.Da.H), this.Oy(); + }, H.prototype.Hy = function(T) { + for (var b = new A.h(), m = new A.h(), _ = null, C = null, D = A.P.mg(2048, 0), L = this.g.Ob(this.Y); L != -1; L = this.g.Sb(L)) { + var B = this.g.Ya(L), q = B; + do { + var Z = this.g.V(q); + this.g.D(q, b); + var ie = -1; + if (b.x == this.Da.v ? (this.g.D(Z, m), m.x == this.Da.v && (ie = 1)) : b.x == this.Da.C && (this.g.D(Z, m), m.x == this.Da.C && (ie = 1)), b.y == this.Da.G ? (this.g.D(Z, m), m.y == this.Da.G && (ie = 0)) : b.y == this.Da.H && (this.g.D(Z, m), m.y == this.Da.H && (ie = 0)), ie != -1) { + if (_ == null && (_ = new A.h()), C == null && (C = new A.h()), _.N(b), C.na(0, 0), ie == 0) { + var se = b.x - this.Da.v; + C.x = A.mc.sign(m.x - b.x), _.x = T * A.mc.En(Math.floor(Math.abs(se / T)), se) + this.Da.v, 0 > _.x && (_.x += T); + } else + se = b.y - this.Da.G, C.y = A.mc.sign(m.y - b.y), _.y = T * A.mc.En(Math.floor(Math.abs(se / T)), se) + this.Da.G, 0 > _.y && (_.y += T); + se = ie != 0 ? m.y - b.y : m.x - b.x; + var de = Math.abs(se); + if (65536 < de / T) + throw A.i.ga("internal error"); + if (0 < de) { + de = A.P.truncate(de / T) + 2, D.length < de && (D = A.P.mg(de)); + for (var Ce = de = 0; ; Ce++) { + var Ve = new A.h(); + if (Ve.x = _.x + C.x * Ce * T, Ve.y = _.y + C.y * Ce * T, 1 <= (Ve = (ie != 0 ? Ve.y - b.y : Ve.x - b.x) / se)) + break; + 0 >= Ve || (D[de] = Ve, de++); + } + de != 0 && this.g.Wl(q, D, de); + } + } + q = Z; + } while (q != B); + } + }, H.prototype.Xl = function(T, b) { + for (var m = -1, _ = new A.h(), C = null, D = this.g.Ob(this.Y); D != -1; D = this.g.Sb(D)) + for (var L = this.g.Ya(D), B = 0, q = this.g.Ka(D); B < q; B++) { + var Z = this.g.V(L); + this.g.D(L, _), (T ? _.y == b : _.x == b) && (this.g.D(Z, _), (T ? _.y == b : _.x == b) && (m == -1 && (m = this.g.Hd()), C == null && (C = new A.ja(0)).Jb(100), this.g.Qa(L, m) != 1 && (C.add(L), this.g.Sa(L, m, 1)), this.g.Qa(Z, m) != 1 && (C.add(Z), this.g.Sa(Z, m, 1)))), L = Z; + } + if (m != -1 && this.g.Ud(m), !(C == null || 3 > C.size)) { + var ie = this; + C.Wd(0, C.size, function(Jt, Xt) { + return ie.Oh(Jt, Xt); + }), m = new A.h(), D = new A.h(), L = new A.h(), D.Sc(); + var se = -1; + B = new A.ja(0), q = new A.ja(0), Z = null; + for (var de = this.g.Hd(), Ce = this.g.Hd(), Ve = 0, Je = C.size; Ve < Je; Ve++) { + var Pt = C.get(Ve); + if (this.g.D(Pt, _), !_.rb(D)) { + if (se != -1) { + for (var $t = se; $t < Ve; $t++) { + se = C.get($t); + var qe = this.g.V(se); + Pt = this.g.Na(se); + var Rt = !1; + this.g.D(qe, m), 0 > D.compare(m) && (T ? m.y == b : m.x == b) && (B.add(se), Rt = !0, this.g.Sa(se, Ce, 1)), this.g.D(Pt, m), 0 > D.compare(m) && (T ? m.y == b : m.x == b) && (Rt || B.add(se), this.g.Sa(se, de, 1)); + } + for ($t = 0, Rt = B.size; $t < Rt; $t++) { + if (se = B.get($t), Pt = this.g.Qa(se, de), qe = this.g.Qa(se, Ce), Pt == 1 && (Pt = this.g.Na(se), this.g.D(Pt, L), !L.rb(_))) { + Z == null && (Z = []); + var Zt = A.h.ub(D, L); + Z[0] = A.h.ub(L, _) / Zt, Z[0] == 0 ? Z[0] = 2220446049250313e-31 : Z[0] == 1 && (Z[0] = 0.9999999999999998), this.g.Wl(Pt, Z, 1), Pt = this.g.Na(se), this.g.mf(Pt, _), q.add(Pt), this.g.Sa(Pt, de, 1), this.g.Sa(Pt, Ce, -1); + } + qe == 1 && (qe = this.g.V(se), this.g.D(qe, L), L.rb(_) || (Z == null && (Z = []), Zt = A.h.ub(D, L), Z[0] = A.h.ub(D, _) / Zt, Z[0] == 0 ? Z[0] = 2220446049250313e-31 : Z[0] == 1 && (Z[0] = 0.9999999999999998), this.g.Wl(se, Z, 1), Pt = this.g.V(se), this.g.mf(Pt, _), q.add(Pt), this.g.Sa(Pt, de, -1), this.g.Sa(Pt, Ce, 1))); + } + se = B, B = q, (q = se).clear(!1); + } + se = Ve, D.N(_); + } + } + this.g.Ud(de), this.g.Ud(Ce); + } + }, H.prototype.Pl = function(T, b) { + for (var m = new A.h(), _ = null, C = -1, D = 0, L = this.ed.size; D < L; D++) { + var B = this.ed.get(D); + if (B != -1) { + var q = this.g.V(B); + this.g.D(B, m), (T ? m.y == b : m.x == b) && (this.g.D(q, m), (T ? m.y == b : m.x == b) && (C == -1 && (C = this.g.Hd()), _ == null && (_ = new A.ja(0)).Jb(100), this.g.Qa(B, C) != -2 && (_.add(B), this.g.Sa(B, C, -2)), this.g.Qa(q, C) != -2 && (_.add(q), this.g.Sa(q, C, -2)))); + } + } + if (_ == null) + C != -1 && this.g.Ud(C); + else { + var Z = this; + for (_.Wd(0, _.size, function(Xt, Qt) { + return Z.Oh(Xt, Qt); + }), D = 0, L = _.size; D < L; D++) { + var ie = _.get(D); + this.g.Sa(ie, C, D); + } + B = new A.h(), (q = new A.h()).Sc(); + var se = -1; + for (D = 0, L = _.size; D < L; D++) + if ((ie = _.get(D)) != -1 && (this.g.D(ie, m), !m.rb(q))) { + if (se != -1) + for (; ; ) { + ie = !1; + for (var de = 1 < D - se ? D - 1 : D, Ce = se; Ce < de; Ce++) { + var Ve = _.get(Ce); + if (Ve != -1) { + var Je = -1, Pt = this.g.V(Ve); + this.g.D(Pt, B), 0 > q.compare(B) && (T ? B.y == b : B.x == b) && (Je = Pt), Pt = -1; + var $t = this.g.Na(Ve); + if (this.g.D($t, B), 0 > q.compare(B) && (T ? B.y == b : B.x == b) && (Pt = $t), Je != -1 && Pt != -1) + this.Mh(Ve, _, C), this.g.qd(Ve, !1), this.Mh(Je, _, C), this.g.qd(Je, !1), ie = !0; + else if (Je != -1 || Pt != -1) { + for ($t = Ce + 1; $t < D; $t++) { + var qe = _.get($t); + if (qe != -1) { + var Rt = this.g.V(qe), Zt = -1; + this.g.D(Rt, B), 0 > q.compare(B) && (T ? B.y == b : B.x == b) && (Zt = Rt), Rt = this.g.Na(qe); + var Jt = -1; + if (this.g.D(Rt, B), 0 > q.compare(B) && (T ? B.y == b : B.x == b) && (Jt = Rt), Zt != -1 && Jt != -1) { + this.Mh(qe, _, C), this.g.qd(qe, !1), this.Mh(Zt, _, C), this.g.qd(Zt, !1), ie = !0; + break; + } + if (Je != -1 && Jt != -1) { + this.At(_, Ve, Je, qe, Jt, C), ie = !0; + break; + } + if (Pt != -1 && Zt != -1) { + this.At(_, qe, Zt, Ve, Pt, C), ie = !0; + break; + } + } + } + if (ie) + break; + } + } + } + if (!ie) + break; + } + se = D, q.N(m); + } + this.g.Ud(C); + } + }, H.prototype.Mh = function(T, b, m) { + m = this.g.Qa(T, m), b.set(m, -1), m = this.g.Qa(T, this.li), this.ed.set(m, -1), (b = this.g.cd(T)) != -1 && this.g.Ya(b) == T && (this.g.Kf(b, -1), this.g.Yg(b, -1)); + }, H.prototype.At = function(T, b, m, _, C, D) { + this.g.Cc(b, _), this.g.Dc(_, b), this.g.Dc(m, C), this.g.Cc(C, m), this.Mh(_, T, D), this.g.oi(_, !1), this.Mh(C, T, D), this.g.oi(C, !0); + }, H.prototype.Oy = function() { + for (var T = 0, b = this.ed.size; T < b; T++) { + var m = this.ed.get(T); + m != -1 && this.g.cj(m, -1); + } + for (var _ = 0, C = 0, D = this.g.Ob(this.Y); D != -1; ) { + var L = this.g.Ya(D); + if (L == -1 || D != this.g.cd(L)) { + var B = D; + D = this.g.Sb(D), this.g.Kf(B, -1), this.g.br(B); + } else { + m = L, B = 0; + do + this.g.cj(m, D), B++, m = this.g.V(m); + while (m != L); + this.g.fp(D, !1), this.g.Yg(D, this.g.Na(L)), this.g.Xj(D, B), C += B, _++, D = this.g.Sb(D); + } + } + for (T = 0, b = this.ed.size; T < b; T++) + if ((m = this.ed.get(T)) != -1 && (D = this.g.cd(m)) == -1) { + D = this.g.wf(this.Y, -1), B = 0, L = m; + do + this.g.cj(m, D), B++, m = this.g.V(m); + while (m != L); + 2 >= B ? (m = this.g.Qa(L, this.li), this.ed.set(m, -1), L = this.g.qd(L, !1), B == 2 && (0 <= (m = this.g.Qa(L, this.li)) && this.ed.set(m, -1), this.g.qd(L, !1)), B = D, this.g.Kf(B, -1), this.g.br(B)) : (this.g.mn(D, !0), this.g.Xj(D, B), this.g.Kf(D, L), this.g.Yg(D, this.g.Na(L)), this.g.fp(D, !1), C += B, _++); + } + for (this.g.Tl(this.Y, _), this.g.Vj(this.Y, C), T = 0, b = this.g.md; b != -1; b = this.g.ve(b)) + T += this.g.I(b); + this.g.XB(T); + }, H.wy = function(T, b, m, _) { + return new H(b, _).vy(T, m); + }, H.clip = function(T, b, m, _, C) { + return H.Pu(T, b, null, m, _, C); + }, H.Pu = function(T, b, m, _, C, D) { + var L = T.K(); + if (L == 33) + return C = T.D(), b.contains(C) ? T : T.Ja(); + if (L == 197) + return C = new A.l(), T.A(C), C.Fa(b) ? (b = new A.Hh(), T.copyTo(b), b.Zo(C), b) : T.Ja(); + if (T.B()) + return T; + if (b.B()) + return T.Ja(); + var B = new A.l(); + if (T.yc(B), b.contains(B)) + return T; + if (!b.isIntersecting(B)) + return T.Ja(); + if ((m != null || isNaN(_)) && A.ua.oy(m, b, !1), !A.ba.zj(L)) + throw A.i.O(); + if ((m = T.Cb) != null && (m = m.Hk) != null) { + if ((m = m.To(b)) == 1) { + if (L != 1736) + throw A.i.ga("internal error"); + return (T = new A.Ea(T.description)).vp(b), T; + } + if (m == 0) + return T.Ja(); + } + switch (L) { + case 550: + for (D = null, L = T.I(), m = T.vb(0), _ = 0, C = new A.h(), B = 0; B < L; B++) + m.uc(2 * B, C), b.contains(C) || (_ == 0 && (D = T.Ja()), _ < B && D.Gd(T, _, B), _ = B + 1); + return 0 < _ && D.Gd(T, _, L), _ == 0 ? T : D; + case 1736: + case 1607: + return H.wy(T, b, C, D); + default: + throw A.i.ga("internal error"); + } + }, H.prototype.Oh = function(T, b) { + var m = new A.h(); + return this.g.D(T, m), T = new A.h(), this.g.D(b, T), m.compare(T); + }, H; + }(); + A.ti = ve; + }(le || (le = {})), function(A) { + var ve = new A.h(), H = function() { + function b(m, _, C, D, L) { + this.Rm = new A.h(), this.Fk = new A.h(), this.Ri = new A.h(), this.g = m, this.Cw = C, this.po = D, this.Rm = _, this.Al = L, this.Fk.Sc(), this.Ri.Sc(); + } + return b.prototype.sE = function(m) { + this.g.D(m, this.Fk), m = A.P.truncate((this.Fk.x - this.Rm.x) * this.po + 0.5); + var _ = A.P.truncate((this.Fk.y - this.Rm.y) * this.po + 0.5); + return T.eG(m, _); + }, b.prototype.ez = function(m) { + return this.g.Qa(m, this.Al); + }, b.prototype.Ky = function(m, _) { + return this.g.D(m, this.Fk), this.g.D(_, this.Ri), T.Ev(this.Fk.x, this.Fk.y, this.Ri.x, this.Ri.y, this.Cw); + }, b; + }(); + A.oY = function() { + }; + var T = function() { + function b() { + this.Rm = new A.h(), this.rq = [0, 0, 0, 0], this.zs = [0, 0, 0, 0], this.so = this.Al = -1; + } + return b.dQ = function(m, _) { + var C = new b(); + return C.g = m, C.ra = _, C.Cw = _ * _, C.bw = 2 * _, C.po = 1 / C.bw, C.wO(); + }, b.Ev = function(m, _, C, D, L) { + return (m -= C) * m + (_ -= D) * _ <= L; + }, b.eG = function(m, _) { + return A.P.Vh(_, A.P.Vh(m)); + }, b.prototype.yO = function(m, _) { + this.g.Hc(m, ve); + for (var C = (ve.y - this.Rm.y) * this.po, D = A.P.truncate((ve.x - this.Rm.x) * this.po), L = A.P.truncate(C), B = C = 0; 1 >= B; B += 1) + for (var q = 0; 1 >= q; q += 1) { + var Z = b.eG(D + B, L + q), ie = this.zl.lR(Z); + ie != -1 && (this.rq[C] = ie, this.zs[C] = Z, C++); + } + for (D = C - 1; 1 <= D; D--) + for (ie = this.rq[D], L = D - 1; 0 <= L; L--) + if (ie == this.rq[L]) { + this.zs[L] = -1, D != --C && (this.zs[D] = this.zs[C], this.rq[D] = this.rq[C]); + break; + } + for (L = 0; L < C; L++) + this.zO(m, this.zs[L], ve, this.rq[L], _); + }, b.prototype.zO = function(m, _, C, D, L) { + for (var B = new A.h(); D != -1; D = this.zl.zR(D)) { + var q = this.zl.ka(D); + m == q || _ != -1 && this.g.Qa(q, this.Al) != _ || (this.g.Hc(q, B), b.Ev(C.x, C.y, B.x, B.y, this.Cw) && L.add(D)); + } + }, b.prototype.Zm = function(m, _, C) { + var D = this.g.Qa(m, this.so), L = this.g.Qa(_, this.so); + return D == -1 && (D = this.Ad.Rh(), this.Ad.addElement(D, m), this.g.Sa(m, this.so, D)), L == -1 ? this.Ad.addElement(D, _) : this.Ad.Cy(D, L), this.g.Sa(_, this.so, -2), _ = this.TT(m, _), C && (C = this.mw.sE(m), this.g.Sa(m, this.Al, C)), _; + }, b.RT = function(m, _, C) { + m.Nb(_), C = m; + var D = new A.h(); + b.ST(m.D(), _.D(), D), C.Db(D); + }, b.ST = function(m, _, C) { + var D = m.x; + m.x != _.x && (D = (1 * m.x + 1 * _.x) / 2); + var L = m.y; + m.y != _.y && (L = (1 * m.y + 1 * _.y) / 2), C.na(D, L); + }, b.prototype.TT = function(m, _) { + var C = new A.h(); + this.g.D(m, C); + var D = new A.h(); + this.g.D(_, D); + var L = this.g.YF(m), B = L + (_ = this.g.YF(_)), q = 0, Z = C.x; + C.x != D.x && (Z = (C.x * L + D.x * _) / B, q++); + var ie = C.y; + return C.y != D.y && (ie = (C.y * L + D.y * _) / B, q++), 0 < q && this.g.Db(m, Z, ie), this.g.rX(m, B), q != 0; + }, b.prototype.wO = function() { + var m = this.g.gd, _ = this.g.DF(); + for (this.Rm = _.hz(), _ = Math.max(_.da(), _.S()) / 2147483646, this.bw < _ && (this.bw = _, this.po = 1 / this.bw), this.Ad = new A.cu(), this.Ad.Bt(A.P.truncate(this.g.gd / 3 + 1)), this.Ad.hn(A.P.truncate(this.g.gd / 3 + 1)), this.Al = this.g.Hd(), this.so = this.g.Hd(), this.mw = new H(this.g, this.Rm, this.Cw, this.po, this.Al), this.zl = new A.ZK(A.P.truncate(4 * m / 3), this.mw), this.zl.vW(this.g.gd), m = !1, _ = this.g.md; _ != -1; _ = this.g.ve(_)) + for (var C = this.g.Ob(_); C != -1; C = this.g.Sb(C)) + for (var D = this.g.Ya(C), L = 0, B = this.g.Ka(C); L < B; L++) { + var q = this.mw.sE(D); + this.g.Sa(D, this.Al, q), this.zl.addElement(D, q), D = this.g.V(D); + } + var Z = new A.ja(0); + for (Z.Jb(10), _ = this.g.md; _ != -1; _ = this.g.ve(_)) + for (C = this.g.Ob(_); C != -1; C = this.g.Sb(C)) + for (D = this.g.Ya(C), L = 0, B = this.g.Ka(C); L < B; L++) { + if (this.g.Qa(D, this.so) != -2) + for (q = this.g.Qa(D, this.Al), this.zl.kd(D, q); this.yO(D, Z), Z.size != 0; ) { + q = !1; + for (var ie = 0, se = Z.size; ie < se; ie++) { + var de = Z.get(ie), Ce = this.zl.ka(de); + this.zl.wd(de), q = this.Zm(D, Ce, ie + 1 == se) || q; + } + if (m = m || q, Z.clear(!1), !q) + break; + } + D = this.g.V(D); + } + return m && this.qN(), this.mw = this.zl = null, this.g.Ud(this.Al), this.g.Ud(this.so), m; + }, b.prototype.qN = function() { + for (var m = new A.h(), _ = this.Ad.ke; _ != -1; _ = this.Ad.lz(_)) { + var C = this.Ad.sc(_); + for (this.g.D(this.Ad.ka(C), m), C = this.Ad.lb(C); C != -1; C = this.Ad.lb(C)) + this.g.mf(this.Ad.ka(C), m); + } + }, b; + }(); + A.$t = T; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + T === void 0 && (T = null), this.zg = null, this.Pb = !1, this.zg = T === null ? [] : T; + } + return H.prototype.copyTo = function(T) { + if (T.Pb) + throw A.i.ga("CompositeGeographicTransformation is read-only"); + for (var b = 0; b < this.zg.length; b++) + T.zg.push(this.zg[b].Qf()); + }, H.prototype.count = function() { + return this.zg.length; + }, H.prototype.add = function(T) { + if (this.Pb) + throw A.i.ga("CompositeGeographicTransformation is read-only"); + this.zg.push(T.Qf()); + }, H.prototype.clear = function() { + if (this.Pb) + throw A.i.ga("CompositeGeographicTransformation is read-only"); + this.zg.length = 0; + }, H.prototype.remove = function(T) { + if (this.Pb) + throw A.i.ga("CompositeGeographicTransformation is read-only"); + this.zg.splice(T, 1); + }, H.prototype.kg = function() { + var T = new H(); + return this.copyTo(T), T; + }, H.prototype.Qf = function() { + return this.kg(); + }, H.prototype.transform = function(T, b, m, _) { + if (T.length < b) + throw A.i.ga("invalid Argument"); + var C = m; + for (m = 0; m < this.zg.length; m++) { + var D = this.zg[m]; + if (D.sm() != null) { + var L = D.Wn, B = L ? 1 : 0, q = L ? D.sm().getGeogcs2() : D.sm().getGeogcs1(); + if (q = C / (q = q.getUnit().getUnitFactor()), 3552713678800501e-30 < Math.abs(q - 1)) + for (C = 0; C < b; C++) + T[C][0] *= q, T[C][1] *= q; + A.HC.geogToGeog(D.sm(), b, T, null, B), C = (L ? D.sm().getGeogcs1() : D.sm().getGeogcs2()).getUnit().getUnitFactor(); + } + } + if (q = C / _, 3552713678800501e-30 < Math.abs(q - 1)) + for (C = 0; C < b; C++) + T[C][0] *= q, T[C][1] *= q; + return b; + }, H.prototype.Nb = function(T) { + if (T == this) + return !0; + if (!(T instanceof H) || this.zg.length != T.zg.length) + return !1; + for (var b = 0; b < this.zg.length; b++) + if (!this.zg[b].Nb(T.zg[b])) + return !1; + return !0; + }, H.prototype.ix = function() { + this.Pb = !0; + }, H.prototype.toString = function() { + for (var T = "CGT (" + this.count() + ") ", b = 0, m = this.count(); b < m; ++b) + T += this.zg[b].toString() + ", "; + return 200 < T.length ? T.substring(0, 197) + "... (" + T.length.toString() + " characters)" : T; + }, H.create = function() { + return new H(); + }, H; + }(); + A.rC = ve; + }(le || (le = {})), function(A) { + var ve, H = Math.PI, T = 2 * Math.PI, b = Math.PI / 2, m = function() { + function D() { + } + return D.OO = function(L, B) { + var q = new D(); + return q.x = L, q.y = B, q.type = 0, q.Wh = 0, q; + }, D.cl = function(L) { + var B = new D(); + return B.x = L.x, B.y = L.y, B.type = 0, B.Wh = 0, B; + }, D.NO = function(L) { + var B = new D(); + return B.x = L.x, B.y = L.y, B.type = L.type, B.Wh = L.Wh, B; + }, D.Qd = function(L, B, q) { + var Z = new D(); + return Z.x = L.x + B * Math.cos(q), Z.y = L.y + B * Math.sin(q), Z.type = L.type, Z.Wh = L.Wh, Z; + }, D.Ru = function(L, B) { + var q = new D(); + return q.x = 0.5 * (L.x + B.x), q.y = 0.5 * (L.y + B.y), q.type = L.type, q.Wh = L.Wh, q; + }, D.OE = function(L, B) { + var q = new D(); + return q.x = L.x + 1e-3 * (B.x - L.x), q.y = L.y + 1e-3 * (B.y - L.y), q.type = L.type, q.Wh = L.Wh, q; + }, D; + }(), _ = function() { + }; + (ve = A.aL || (A.aL = {}))[ve.Round = 0] = "Round", ve[ve.Bevel = 1] = "Bevel", ve[ve.Miter = 2] = "Miter", ve[ve.Square = 3] = "Square"; + var C = function() { + function D(L) { + this.IA = this.Zb = this.xg = null, this.od = L; + } + return D.W = function(L, B, q, Z, ie, se) { + if (L == null || 1 > L.Eb()) + throw A.i.O(); + return B == 0 || L.B() ? L : ((se = new D(se)).mo = L, se.La = B, se.ra = ie, se.Mi = q, se.xA = Z, se.Qx()); + }, D.prototype.$L = function() { + var L = this.mo, B = L.bc(), q = L.xc(), Z = new A.h(); + return Z.vc(q, B), Z.normalize(), Z.Jv(), Z.scale(this.La), B.add(Z), q.add(Z), Z = L.Ja(), L.Ec(B), L.Rc(q), Z; + }, D.prototype.ZL = function() { + var L = this.mo; + if (0 < this.La && this.Mi != 2) { + var B = new A.Ea(); + return B.bd(L, !1), this.mo = B, this.Qx(); + } + return (L = new A.Hh(L.aa)).X(this.La, this.La), L; + }, D.prototype.oJ = function(L, B, q, Z) { + return (B.x - L.x) * (Z.x - q.x) + (B.y - L.y) * (Z.y - q.y); + }, D.prototype.hc = function(L, B) { + if (B === void 0) + this.Zb.push(L), this.gf++; + else if (this.gf == 0) + this.hc(L); + else { + var q = this.Dw, Z = this.xg[B == 0 ? q - 1 : B - 1], ie = this.xg[B], se = this.oJ(Z, ie, this.Zb[this.gf - 1], L); + 0 < se ? this.hc(L) : 0 > se && (0 < this.oJ(Z, ie, ie, this.Zb[this.gf - 1]) ? (ie = this.xg[B == 0 ? q - 2 : B == 1 ? q - 1 : B - 2], q = m.Qd(Z, this.La, Math.atan2(Z.y - ie.y, Z.x - ie.x) - b), this.Zb[this.gf - 1] = q, this.Mi == 1 || this.Mi == 2 ? (q = m.Ru(q, Z), this.hc(q), q = m.Qd(Z, this.La, this.Lv + b), (Z = m.Ru(q, Z)).type |= 256, this.hc(Z)) : (q = m.Qd(Z, this.La, this.Lv + b)).type |= 256, this.hc(q), this.hc(L, B)) : (q = m.Qd(ie, this.La, this.Lv + b), this.hc(q), this.Mi == 1 || this.Mi == 2 ? (q = m.Ru(q, ie), this.hc(q), q = m.Qd(ie, this.La, this.Wz - b), (Z = m.Ru(q, ie)).type |= 256, this.hc(Z)) : (q = m.Qd(ie, this.La, this.Wz - b)).type |= 256, this.hc(q))); + } + }, D.prototype.hE = function() { + var L, B = this.Dw; + this.gf = 0; + var q = 0.5 * this.ra, Z = 0, ie = 0; + for (L = 0; L < B; L++) { + var se = this.xg[L], de = L == 0 ? this.xg[B - 1] : this.xg[L - 1], Ce = L == B - 1 ? this.xg[0] : this.xg[L + 1], Ve = de.x - se.x, Je = de.y - se.y, Pt = Ce.x - se.x, $t = Ce.y - se.y, qe = Math.atan2(Je, Ve), Rt = Math.atan2($t, Pt); + if (this.Lv = qe, this.Wz = Rt, L == 0 && (Z = qe, ie = Rt), Ve = Ve * $t - Pt * Je, Je = Rt, Rt < qe && (Rt += T), 0 < Ve * this.La) + this.Mi == 1 || this.Mi == 2 ? (qe = m.Qd(se, this.La, qe + b), this.hc(qe), qe = m.OE(se, qe), this.hc(qe), qe = m.Qd(se, this.La, Rt - b), (se = m.OE(se, qe)).type |= 256, this.hc(se), this.hc(qe)) : (Ve = 0.5 * (Rt - qe), Ve = this.La / Math.abs(Math.sin(Ve)), qe = m.Qd(se, Ve, 0.5 * (qe + Rt)), this.hc(qe, L)); + else if (512 & se.type) { + for (Ve = 1 - q / Math.abs(this.La), de = 1, Ce = 0 > this.La ? -H : H, -1 < Ve && 1 > Ve && (0.017453292519943295 > (Je = 2 * Math.acos(Ve)) && (Je = 0.017453292519943295), 1 < (de = A.P.truncate(H / Je + 1.5)) && (Ce /= de)), Je = qe + b, qe = m.Qd(se, this.La, Je), L == 0 && (qe.type |= 1024), this.hc(qe, L), Ve = this.La / Math.cos(Ce / 2), Je += Ce / 2, (qe = m.Qd(se, Ve, Je)).type |= 1024, this.hc(qe); 0 < --de; ) + Je += Ce, (qe = m.Qd(se, Ve, Je)).type |= 1024, this.hc(qe); + (qe = m.Qd(se, this.La, Rt - b)).type |= 1024, this.hc(qe); + } else if (this.Mi == 1) + qe = m.Qd(se, this.La, qe + b), this.hc(qe, L), qe = m.Qd(se, this.La, Rt - b), this.hc(qe); + else if (this.Mi == 0) + for (Ve = 1 - q / Math.abs(this.La), de = 1, Ce = Rt - b - (qe + b), -1 < Ve && 1 > Ve && (0.017453292519943295 > (Je = 2 * Math.acos(Ve)) && (Je = 0.017453292519943295), 1 < (de = A.P.truncate(Math.abs(Ce) / Je + 1.5)) && (Ce /= de)), Ve = this.La / Math.cos(0.5 * Ce), Je = qe + b + 0.5 * Ce, qe = m.Qd(se, Ve, Je), this.hc(qe, L); 0 < --de; ) + Je += Ce, qe = m.Qd(se, Ve, Je), this.hc(qe); + else + this.Mi == 2 ? (Ve = de.x - se.x, Je = de.y - se.y, 0.99999999 < (de = (Ve * (Pt = Ce.x - se.x) + Je * ($t = Ce.y - se.y)) / Math.sqrt(Ve * Ve + Je * Je) / Math.sqrt(Pt * Pt + $t * $t)) ? (qe = m.Qd(se, 1.4142135623730951 * this.La, Rt - 0.25 * H), this.hc(qe, L), qe = m.Qd(se, 1.4142135623730951 * this.La, Rt + 0.25 * H), this.hc(qe)) : (de = Math.abs(this.La / Math.sin(0.5 * Math.acos(de)))) > (Ce = Math.abs(this.xA * this.La)) ? (Ve = 0.5 * (Rt - qe), Ve = this.La / Math.abs(Math.sin(Ve)), qe = m.Qd(se, Ve, 0.5 * (qe + Rt)), Rt = A.h.construct(qe.x, qe.y), qe = A.h.construct(se.x, se.y), (se = new A.h()).vc(Rt, qe), (Rt = new A.h()).BW(Ce / se.length(), se, qe), qe = (de - Ce) * Math.abs(this.La) / Math.sqrt(de * de - this.La * this.La), 0 < this.La ? se.Jv() : se.cr(), se.scale(qe / se.length()), (qe = new A.h()).add(Rt, se), (de = new A.h()).vc(Rt, se), qe = m.cl(qe), this.hc(qe, L), qe = m.cl(de), this.hc(qe)) : (Ve = 0.5 * (Rt - qe), Ve = this.La / Math.abs(Math.sin(Ve)), qe = m.Qd(se, Ve, 0.5 * (qe + Rt)), this.hc(qe, L))) : (Rt = Je, 0 < this.La ? (Rt > qe && (Rt -= T), de = qe - Rt < b) : (Rt < qe && (Rt += T), de = Rt - qe < b), de ? (Je = 0 > (Ve = 1.4142135623730951 * this.La) ? qe + 0.25 * H : qe + 0.75 * H, qe = m.Qd(se, Ve, Je), this.hc(qe, L), Je = 0 > Ve ? Rt - 0.25 * H : Rt - 0.75 * H, qe = m.Qd(se, Ve, Je), this.hc(qe)) : (Ve = 0.5 * (Rt - qe), Ve = this.La / Math.abs(Math.sin(Ve)), Rt < qe && (Rt += T), qe = m.Qd(se, Ve, (qe + Rt) / 2), this.hc(qe, L))); + } + return this.Lv = Z, this.Wz = ie, this.hc(this.Zb[0], 0), se = m.NO(this.Zb[this.gf - 1]), this.Zb[0] = se, this.rW(); + }, D.prototype.Cu = function(L, B) { + if (!(2 > B)) + for (var q = 0; q < B; q++) { + var Z = this.Zb[L + q]; + q != 0 ? this.IA.Ei(A.h.construct(Z.x, Z.y)) : this.IA.Nt(A.h.construct(Z.x, Z.y)); + } + }, D.prototype.aM = function(L, B, q) { + var Z = L.Ca(B), ie = L.Wc(B); + if (this.Zb = [], this.IA = q, L.ec(B)) { + for (B = L.Oa(Z); L.Oa(ie - 1).rb(B); ) + ie--; + if (2 <= ie - Z) { + for (this.Dw = ie - Z, this.xg = [], B = Z; B < ie; B++) + this.xg.push(m.cl(L.Oa(B))); + this.hE() && this.Cu(0, this.gf - 1); + } + } else { + for (B = L.Oa(Z); Z < ie && L.Oa(Z + 1).rb(B); ) + Z++; + for (B = L.Oa(ie - 1); Z < ie && L.Oa(ie - 2).rb(B); ) + ie--; + if (2 <= ie - Z) { + for (this.Dw = 2 * (ie - Z) - 2, this.xg = [], (q = m.cl(L.Oa(Z))).type |= 1536, this.xg.push(q), B = Z + 1; B < ie - 1; B++) + q = m.cl(L.Oa(B)), this.xg.push(q); + for ((q = m.cl(L.Oa(ie - 1))).type |= 512, this.xg.push(q), B = ie - 2; B >= Z + 1; B--) + (q = m.cl(L.Oa(B))).type |= 1024, this.xg.push(q); + if (this.hE()) + if (2 <= this.Zb.length) { + for (L = -1, (ie = (1024 & this.Zb[this.gf - 1].type) != 0) || (L = 0), B = 1; B < this.gf; B++) + (Z = (1024 & this.Zb[B].type) != 0) ? ie || 1 < (ie = B - 1) - L + 1 && this.Cu(L, ie - L + 1) : ie && (L = B - 1), ie = Z; + ie || 1 < (ie = this.gf - 1) - L + 1 && this.Cu(L, ie - L + 1); + } else + L = 0, ie = this.gf - 1, 0 <= L && 1 <= ie - L && this.Cu(L, ie - L + 1); + } + } + this.xg = null, this.Dw = 0, this.Zb = null, this.gf = 0; + }, D.prototype.rW = function() { + for (var L = !1, B = 0; B < this.gf; B++) { + var q = this.Zb[B]; + q.sh = B + 1, q.uh = B - 1, this.Zb[B] = q; + } + for ((q = this.Zb[0]).uh = this.gf - 2, this.Zb[0] = q, (q = this.Zb[this.gf - 2]).sh = 0, this.Zb[this.gf - 2] = q, B = q = 0; B < this.gf; B++) + if (256 & this.Zb[q].type) { + var Z = this.BP(q); + if (Z == -1) { + L = !0; + break; + } + q = Z; + } else + q = this.Zb[q].sh; + return !L && (this.LO(q), !0); + }, D.prototype.BP = function(L) { + for (var B, q, Z = this.gf - 1, ie = L, se = 1; se <= Z - 2; se++) { + B = ie = this.Zb[ie].sh, q = L; + for (var de = 1; de <= se; de++) { + if (q = this.Zb[q].uh, (256 & this.Zb[q].type) == 0 && (256 & this.Zb[B].type) == 0) { + var Ce = this.bS(q, B); + if (Ce != -1) + return Ce; + } + B = this.Zb[B].uh; + } + } + return -1; + }, D.prototype.bS = function(L, B) { + var q = this.Zb[this.Zb[L].uh], Z = this.Zb[L], ie = this.Zb[this.Zb[B].uh], se = this.Zb[B]; + if (!this.EW(q, Z, ie, se)) + return -1; + var de = new _(); + return this.sQ(q, Z, ie, se, de) && !de.XD && A.P.XJ((Z.x - q.x) * (se.y - ie.y) - (Z.y - q.y) * (se.x - ie.x)) != A.P.XJ(this.La) ? (q = this.Zb[L].uh, de.cn.type = Z.type, de.cn.sh = B, de.cn.uh = q, this.Zb[L] = de.cn, de.cn = this.Zb[B], de.cn.uh = L, this.Zb[B] = de.cn, B) : -1; + }, D.prototype.EW = function(L, B, q, Z) { + return Math.max(L.x, B.x) >= Math.min(q.x, Z.x) && Math.max(q.x, Z.x) >= Math.min(L.x, B.x) && Math.max(L.y, B.y) >= Math.min(q.y, Z.y) && Math.max(q.y, Z.y) >= Math.min(L.y, B.y); + }, D.prototype.sQ = function(L, B, q, Z, ie) { + ie.XD = !1; + var se = (B.y - L.y) * (Z.x - q.x) - (B.x - L.x) * (Z.y - q.y), de = (q.y - L.y) * (B.x - L.x) - (q.x - L.x) * (B.y - L.y); + if (0 <= (se = se == 0 ? 2 : de / se) && 1 >= se) { + var Ce = se; + if (se = (Z.y - q.y) * (B.x - L.x) - (Z.x - q.x) * (B.y - L.y), de = (L.y - q.y) * (Z.x - q.x) - (L.x - q.x) * (Z.y - q.y), 0 <= (se = se == 0 ? 2 : de / se) && 1 >= se) + return ie.cn = m.OO(L.x + se * (B.x - L.x), L.y + se * (B.y - L.y)), ie.cn.Wh = q.Wh + Ce * (Z.Wh - q.Wh), Ce != 0 && Ce != 1 || se != 0 && se != 1 || (ie.XD = !0), ie.RY = se, ie.SY = Ce, !((Ce == 0 || Ce == 1) && 0 < se && 1 > se || (se == 0 || se == 1) && 0 < Ce && 1 > Ce); + } + return !1; + }, D.prototype.LO = function(L) { + for (; this.Zb[L].uh < L; ) + L = this.Zb[L].uh; + var B = 0, q = L; + do + q = this.Zb[q], this.Zb[B] = q, q = q.sh, B++; + while (q != L); + this.Zb[B] = this.Zb[0], this.gf = B + 1; + }, D.prototype.VC = function(L) { + var B = this.mo, q = B.Ha(); + if (q != null) { + q.aj(); + for (var Z = -1; q.ab(); ) + Z++, this.aM(B, Z, L); + } + }, D.prototype.Qx = function() { + var L = this.mo.K(); + return L == 322 ? this.$L() : L == 197 ? this.ZL() : A.ba.zd(L) ? ((L = new A.Ua()).pc(this.mo, !0), this.mo = L, this.Qx()) : L == 1607 ? (L = new A.Ua(), this.VC(L), L) : L == 1736 ? (L = new A.Ea(), this.VC(L), L) : null; + }, D; + }(); + A.DK = C; + }(le || (le = {})), function(A) { + var ve = function() { + function m(_) { + this.sk = _; + } + return m.prototype.D = function(_, C) { + this.sk.g.D(_, C); + }, m.prototype.wd = function(_) { + var C = this.sk.Ga.ka(_); + this.sk.Ga.wd(_, -1), this.sk.g.qd(C, !1); + }, m; + }(), H = function() { + function m(_) { + this.sk = _; + } + return m.prototype.D = function(_, C) { + this.sk.DT.D(_, C); + }, m.prototype.wd = function(_) { + this.sk.Ga.wd(_, -1); + }, m; + }(), T = function() { + function m(_) { + this.sk = _; + } + return m.prototype.D = function(_, C) { + C.N(this.sk.GT[_]); + }, m.prototype.wd = function(_) { + this.sk.Ga.wd(_, -1); + }, m; + }(), b = function() { + function m(_) { + _ === void 0 ? (this.Ga = new A.$j(), this.Ga.Ee(20), this.g = new A.hd(), this.sT = this.g.Kg(550), this.Us = this.g.wf(this.sT, -1), this.Zh = new ve(this)) : _ instanceof Array ? (this.Ga = new A.$j(), this.Ga.Ee(20), this.GT = _, this.Zh = new T(this)) : (this.Ga = new A.$j(), this.Ga.Ee(20), this.DT = _, this.Zh = new H(this)); + } + return m.prototype.Ib = function(_) { + var C = _.K(); + if (A.Fx.zj(C)) + this.eN(_); + else if (A.Xk.zd(C)) + this.jN(_); + else if (C == 197) + this.bN(_); + else { + if (C != 33) + throw A.i.O("invalid shape type"); + this.iN(_); + } + }, m.prototype.YQ = function() { + var _ = new A.Ta(), C = this.Ga.sc(-1), D = new A.Ea(this.g.it); + for (this.g.Xi(this.Ga.ka(C), _), D.nf(_), C = this.Ga.lb(C); C != -1; C = this.Ga.lb(C)) + this.g.Xi(this.Ga.ka(C), _), D.lineTo(_); + return D; + }, m.MO = function(_) { + var C = new m(_), D = _.I(), L = 1, B = new A.h(), q = new A.h(), Z = new A.h(); + for (_.D(0, B); _.D(L, q), q.Mz(B) && L < D - 1; ) + L++; + for (C.Ga.addElement(0, -1), C.Ga.zn(L), D = L + 1; D < _.I(); D++) + _.D(D, Z), (L = C.kC(Z)) != -1 && C.Ga.Uj(L, D); + for (Z = new A.Ta(), L = C.Ga.sc(-1), D = new A.Ea(_.description), _.we(C.Ga.ka(L), Z), D.nf(Z), L = C.Ga.lb(L); L != -1; L = C.Ga.lb(L)) + _.we(C.Ga.ka(L), Z), D.lineTo(Z); + return D; + }, m.construct = function(_, C, D) { + for (var L = new m(_), B = 1, q = _[0]; _[B].Mz(q) && B < C - 1; ) + B++; + for (L.Ga.addElement(0, -1), L.Ga.zn(B), B += 1; B < C; B++) + (q = L.kC(_[B])) != -1 && L.Ga.Uj(q, B); + for (_ = 0, C = L.Ga.sc(-1); C != -1; C = L.Ga.lb(C)) + D[_++] = L.Ga.ka(C); + return _; + }, m.EG = function(_, C) { + var D = _.Ca(C), L = _.Wc(C); + if (C = !_.ec(C) && _.Pn(C), _ = _.vb(0), L *= 2, C && (L -= 2), 6 > L - (D *= 2)) + return !0; + C = new A.h(); + var B = new A.h(), q = new A.h(); + _.uc(D, C), _.uc(D + 2, B), _.uc(D + 4, q); + var Z = m.Yu(B, q, C); + if (Z.rs() || !m.wm(Z.value())) + return !1; + var ie = A.h.construct(B.x, B.y), se = new A.h(); + for (D += 6; D < L; D += 2) + if (se.N(B), B.N(q), _.uc(D, q), (Z = m.Yu(B, q, C)).rs() || !m.wm(Z.value()) || (Z = m.Yu(ie, q, C)).rs() || !m.wm(Z.value()) || (Z = m.Yu(B, q, se)).rs() || !m.wm(Z.value())) + return !1; + return !0; + }, m.prototype.eN = function(_) { + for (var C = new A.Ta(), D = new A.h(), L = 0; L < _.I(); L++) { + _.D(L, D); + var B = this.Er(D); + if (B != -1) { + _.we(L, C); + var q = this.g.hc(this.Us, C); + this.Ga.Uj(B, q); + } + } + }, m.prototype.bN = function(_) { + for (var C = new A.Ta(), D = new A.h(), L = 0; 4 > L; L++) { + _.hB(L, D); + var B = this.Er(D); + if (B != -1) { + _.If(L, C); + var q = this.g.hc(this.Us, C); + this.Ga.Uj(B, q); + } + } + }, m.prototype.jN = function(_) { + var C = new A.Ta(), D = _.bc(); + if ((D = this.Er(D)) != -1) { + _.Vo(C); + var L = this.g.hc(this.Us, C); + this.Ga.Uj(D, L); + } + D = _.xc(), (D = this.Er(D)) != -1 && (_.Ro(C), _ = this.g.hc(this.Us, C), this.Ga.Uj(D, _)); + }, m.prototype.iN = function(_) { + var C = _.D(); + (C = this.Er(C)) != -1 && (_ = this.g.hc(this.Us, _), this.Ga.Uj(C, _)); + }, m.prototype.Er = function(_) { + var C = -1; + if (this.Ga.size(-1) == 0) + return this.Ga.addElement(-4, -1); + if (this.Ga.size(-1) == 1) { + var D = this.g.Oa(this.Ga.ka(this.Ga.sc(-1))); + return _.Mz(D) || (C = this.Ga.zn(-5)), C; + } + return this.kC(_); + }, m.prototype.kC = function(_) { + var C = -1; + do { + var D = this.Ga.sc(-1), L = this.Ga.Gc(-1), B = this.Ga.ka(D), q = this.Ga.ka(L), Z = new A.h(), ie = new A.h(); + if (this.Zh.D(B, Z), this.Zh.D(q, ie), B = A.h.Wq(ie, _, Z), m.wm(B)) + C = this.Ga.zn(-1), (Z = this.iC(_, L, D)) != D && this.jC(_, D, this.Ga.xe(Z)); + else if (m.xG(B)) { + ie = this.Ga.uv(-1); + var se = this.Ga.sc(-1), de = this.Ga.Gc(-1); + for (B = new A.h(), q = new A.h(); se != this.Ga.xe(de); ) { + var Ce = this.Ga.ka(ie); + this.Zh.D(Ce, B), Ce = A.h.Wq(B, _, Z), m.xG(Ce) ? (de = ie, ie = this.Ga.nl(ie)) : (se = ie, ie = this.Ga.Zp(ie)); + } + if (ie = de, Z = se, Ce = this.Ga.ka(ie), se = this.Ga.ka(Z), this.Zh.D(Ce, B), this.Zh.D(se, q), Z != D && (B = A.h.Wq(q, _, B), !m.wm(B))) + continue; + C = this.Ga.Bu(Z, ie, -2, !1), this.jC(_, ie, L), this.iC(_, Z, D); + } else + this.tb == null && (this.tb = new A.zb()), this.tb.Ec(ie), this.tb.Rc(Z), 0 > (Z = this.tb.ge(_, !0)) ? (Z = this.Ga.xe(L), this.Ga.wd(L, -1), C = this.Ga.zn(-3), this.iC(_, Z, D)) : 1 < Z && (Z = this.Ga.lb(D), this.Ga.wd(D, -1), C = this.Ga.Bu(-1, Z, -3, !1), this.jC(_, Z, L)); + } while (0); + return C; + }, m.prototype.jC = function(_, C, D) { + if (C != D) { + var L = this.Ga.ka(C), B = this.Ga.lb(C), q = new A.h(), Z = new A.h(); + for (this.Zh.D(L, q); C != D && 2 < this.Ga.size(-1) && (this.Zh.D(this.Ga.ka(B), Z), L = A.h.Wq(Z, _, q), !m.wm(L)); ) + L = C, C = B, q.N(Z), B = this.Ga.lb(C), this.Zh.wd(L); + } + }, m.prototype.iC = function(_, C, D) { + if (C == D) + return D; + var L = this.Ga.ka(C), B = this.Ga.xe(C), q = new A.h(), Z = new A.h(); + for (this.Zh.D(L, q); C != D && 2 < this.Ga.size(-1) && (this.Zh.D(this.Ga.ka(B), Z), L = A.h.Wq(q, _, Z), !m.wm(L)); ) + L = C, C = B, q.N(Z), B = this.Ga.xe(C), this.Zh.wd(L); + return C; + }, m.Yu = function(_, C, D) { + var L = new A.Xb(); + L.set(C.x), L.sub(_.x); + var B = new A.Xb(); + B.set(D.y), B.sub(_.y); + var q = new A.Xb(); + return q.set(C.y), q.sub(_.y), (C = new A.Xb()).set(D.x), C.sub(_.x), L.Bg(B), q.Bg(C), L.sub(q), L; + }, m.wm = function(_) { + return 0 > _; + }, m.xG = function(_) { + return 0 < _; + }, m; + }(); + A.au = b; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.g = null, this.oH = !0, this.od = T; + } + return H.uU = function(T, b, m) { + return T = A.ua.Gr(T), A.$t.Ev(b.Ng(), b.kh(), m.Ng(), m.kh(), A.mc.ox(T)); + }, H.xO = function(T, b) { + var m = new A.Ta(); + return A.$t.RT(T, b, m), m; + }, H.W = function(T, b, m, _) { + return (m = new H(m)).g = T, m.ra = b, m.oH = _, m.zM(); + }, H.prototype.iM = function(T) { + return A.$t.dQ(this.g, T); + }, H.prototype.nM = function(T) { + return A.bu.W(this.g, T, this.od); + }, H.prototype.zM = function() { + var T = this.ra, b = A.ua.Gr(T), m = 1.00001 * (T = A.ua.mN(T)); + T *= 1.000001; + for (var _ = !1, C = 30 < this.g.gd + 10 ? 1e3 : (this.g.gd + 10) * (this.g.gd + 10), D = 0, L = this.g.eS(); ; D++) { + if (D > C) + throw A.i.ga("Internal Error: max number of iterations exceeded"); + var B = this.iM(b); + if (_ = _ || B, this.oH && (B = this.g.Ip(b, !0, !1) != 0, _ = _ || B), B = !1, (D == 0 || L || A.bu.fI(!0, this.g, T, null, this.od)) && (B = this.nM(m), _ = _ || B), !B) + break; + A.op.Bp(this.od); + } + return _; + }, H; + }(); + A.Vk = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function T(b) { + this.ae = this.Nc = null, this.$s = 0, this.Vb = b, this.Yz = !0; + } + return T.prototype.wv = function(b, m) { + var _ = this.g.cc(b); + if (_ == null) { + if (!this.g.fd(b, m)) + return null; + _ = m; + } + return _; + }, T.prototype.Zq = function() { + var b; + b === void 0 && (b = !1), this.$s++, (b || !(4095 & this.$s)) && (this.$s = 0, A.op.Bp(this.Vb)); + }, T.prototype.iP = function() { + var b = this.g.$q(!1), m = !1, _ = new A.zb(), C = new A.zb(), D = new A.l(); + D.Pa(); + var L = new A.l(); + L.Pa(); + for (var B = new A.Ta(), q = new A.OC(), Z = b.next(); Z != -1; Z = b.next()) { + A.op.Bp(this.Vb); + var ie = null, se = !1; + if (!A.ba.Tn(this.g.jc(b.ek))) { + if ((ie = this.wv(Z, _)) == null) + continue; + if (ie.A(D), D.X(this.ra, this.ra), ie.Di(this.ra)) { + if (!ie.Di(0)) + continue; + se = !0, ie = null; + } + } + var de = this.g.$q(b), Ce = de.next(); + for (Ce != -1 && (Ce = de.next()); Ce != -1; Ce = de.next()) { + var Ve = null, Je = !1; + if (!A.ba.Tn(this.g.jc(de.ek))) { + if ((Ve = this.wv(Ce, C)) == null) + continue; + if (Ve.A(L), Ve.Di(this.ra)) { + if (!Ve.Di(0)) + continue; + Je = !0, Ve = null; + } + } + var Pt = 0, $t = 0; + if (ie != null && Ve != null) + D.CG(L) && (q.Qo(ie), q.Qo(Ve), q.Fa(this.ra, !1), 0 < (Pt = q.ql(0)) + ($t = q.ql(1)) && (this.g.lr(Z, q, 0, !0), this.g.lr(Ce, q, 1, !0)), q.clear()); + else if (ie != null) { + var qe = new A.h(); + if (this.g.D(Ce, qe), D.contains(qe)) { + if (q.Qo(ie), this.g.Xi(Ce, B), q.Fz(this.ra, B, !1), 0 < (Pt = q.ql(0))) + if (this.g.lr(Z, q, 0, !0), Je) { + for (Je = -1, qe = this.g.V(Ce); qe != -1 && qe != Ce && (Je = qe, (Ve = this.wv(qe, C)) != null && Ve.Di(0)); qe = this.g.V(qe)) + ; + for (qe = Ce; qe != -1 && (this.g.Fh(qe, q.Cf), qe != Je); qe = this.g.V(qe)) + ; + } else + this.g.Fh(Ce, q.Cf); + q.clear(); + } + } else { + if (Ve == null) + continue; + if (qe = new A.h(), this.g.D(Z, qe), L.X(this.ra, this.ra), L.contains(qe)) { + if (q.Qo(Ve), this.g.Xi(Z, B), q.Fz(this.ra, B, !1), 0 < ($t = q.ql(0))) + if (this.g.lr(Ce, q, 0, !0), se) { + for (Je = -1, qe = this.g.V(Z); qe != -1 && qe != Z && (Je = qe, (Ve = this.wv(qe, C)) != null && Ve.Di(0)); qe = this.g.V(qe)) + ; + for (qe = Z; qe != -1 && (this.g.Fh(qe, q.Cf), qe != Je); qe = this.g.V(qe)) + ; + } else + this.g.Fh(Z, q.Cf); + q.clear(); + } + } + if (Pt + $t != 0) { + if (Pt != 0) { + if ((ie = this.g.cc(Z)) == null) { + if (!this.g.fd(Z, _)) + continue; + ie = _, _.A(D); + } else + ie.A(D); + if (ie.Di(this.ra)) + break; + } + m = !0; + } + } + } + return m; + }, T.prototype.jP = function() { + return this.LU(); + }, T.prototype.LU = function() { + return new A.MC().LX(this.g, this.ra); + }, T.prototype.gI = function() { + var b = !1; + this.Nc == null && (this.Nc = new A.$j()); + var m = new A.ja(0); + m.Jb(this.g.gd + 1); + for (var _ = this.g.$q(), C = _.next(); C != -1; C = _.next()) + m.add(C); + this.g.nx(m, m.size), m.add(-1), _ = this.g.Hd(), C = this.g.Hd(), this.ae = new A.PC(this.g, this.ra, !this.Yz), this.Nc.Xo(this.ae); + var D = new A.ja(0), L = new A.ja(0), B = 0; + new A.h(); + var q = this.g.ud; + this.g.wb.oc(); + for (var Z, ie, se = this.g.wb.Aa[0].o, de = m.get(B++); de != -1; ) { + var Ce = Z = se[2 * (ie = q.U(de, 0))], Ve = ie = se[2 * ie + 1]; + do { + var Je = q.U(de, 2), Pt = q.U(de, 1); + if (Je != -1) { + var $t = q.U(Je, 0), qe = se[2 * $t]; + 0 > (Ve < ($t = se[2 * $t + 1]) ? -1 : Ve > $t ? 1 : Ce < qe ? -1 : Ce > qe ? 1 : 0) && (L.add(de), L.add(Je)); + } + Pt != -1 && (qe = se[2 * ($t = q.U(Pt, 0))], 0 > (Ve < ($t = se[2 * $t + 1]) ? -1 : Ve > $t ? 1 : Ce < qe ? -1 : Ce > qe ? 1 : 0) && (L.add(Pt), L.add(Pt))), (qe = this.g.Qa(de, _)) != -1 && (D.add(qe), this.g.Sa(de, _, -1)), (qe = this.g.Qa(de, C)) != -1 && (D.add(qe), this.g.Sa(de, C, -1)), (de = m.get(B++)) !== -1 && (Ce = se[2 * (Ve = q.U(de, 0))], Ve = se[2 * Ve + 1]); + } while (de != -1 && Ce === Z && Ve === ie); + for (Ce = D.size == 1 && L.size == 2, qe = Ve = -1, Je = 0, Pt = D.size; Je < Pt; Je++) { + $t = D.get(Je); + var Rt = this.Nc.xe($t); + if (Rt == -1 || D.cG(Rt) || (Ve = Rt), ($t = this.Nc.lb($t)) == -1 || D.cG($t) || (qe = $t), Ve != -1 && qe != -1) + break; + } + for (this.ae.VJ(ie, Z), Je = 0, Pt = D.size; Je < Pt; Je++) + $t = D.get(Je), this.Nc.wd($t, -1); + if (D.clear(!1), !Ce && Ve != -1 && qe != -1 && this.lO(Ve, qe)) { + b = !0, this.Pi = this.ae.tm(); + break; + } + for (Je = 0, Pt = L.size; Je < Pt; Je += 2) { + if (ie = L.get(Je), Z = L.get(Je + 1), Ce ? (ie = this.Nc.Bu(Ve, qe, ie, !0), Ce = !1) : ie = this.Nc.addElement(ie, -1), this.ae.sg) { + this.Pi = this.ae.tm(), b = !0; + break; + } + this.g.Qa(Z, _) == -1 ? this.g.Sa(Z, _, ie) : this.g.Sa(Z, C, ie); + } + if (b) + break; + L.Dh(0); + } + return this.g.Ud(_), this.g.Ud(C), b; + }, T.prototype.lO = function(b, m) { + return this.ae.compare(this.Nc, this.Nc.ka(b), m), b = this.ae.sg, this.ae.Mr(), b; + }, T.tE = function(b) { + for (var m = b.md; m != -1; m = b.ve(m)) + if (A.ba.Ic(b.jc(m))) + return !0; + return !1; + }, T.aQ = function(b, m, _, C) { + return !!T.tE(b) && ((m = new T(C)).g = b, m.ra = _, 15 > b.gd ? b = m.iP() : m.jP()); + }, T.W = function(b, m, _) { + return T.aQ(b, b.DF(), m, _); + }, T.fI = function(b, m, _, C, D) { + if (!T.tE(m)) + return !1; + var L = new T(D); + if (L.g = m, L.ra = _, L.Yz = b, L.gI()) + return C?.Yt(L.Pi), !0; + var B = new A.Ed(); + return B.VB(), m.Pc(B), (L = new T(D)).g = m, L.ra = _, L.Yz = b, b = L.gI(), B.VB(), m.Pc(B), !!b && (C?.Yt(L.Pi), !0); + }, T.Ol = function(b, m) { + return !(16 > (b = b.I())) && 2 * b + Math.log(b) * Math.LOG10E / Math.log(2) * m < 1 * b * m; + }, T.gP = function(b, m, _, C) { + if (A.ba.Ic(m.K())) + return new T(C).hP(b, m, _); + throw A.i.ga("crack_A_with_B"); + }, T.prototype.hP = function(b, m, _) { + var C = new A.l(); + b.yc(C); + var D = new A.l(); + if (m.yc(D), D.X(_, _), !D.isIntersecting(C)) + return b; + var L = b.Cb, B = null; + L != null && (B = L.Gb), T.Ol(b, b.I()) && (B = A.ua.lj(b, D)); + var q = B != null ? B.getIterator() : null, Z = m.Ha(); + m = b.Ha(); + var ie = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (D = []; Z.ab(); ) + for (; Z.Ia(); ) { + var se = Z.ia(); + if (B != null) { + for (q.Wo(se, _), L = q.next(); L != -1; L = q.next()) + if (this.Zq(), m.Wb(B.ka(L), -1), m.Ia()) { + var de = (L = m.ia()).Fa(se, null, ie, null, _); + for (L = 0; L < de; ++L) { + var Ce = ie[L]; + if (Ce != 0 && Ce != 1) { + var Ve = m.xb(), Je = new H(); + Je.t = Ce, Je.index = Ve, D.push(Je); + } + } + } + } else { + var Pt = new A.l(); + if (se.yc(Pt), Pt.X(_, _), C.isIntersecting(Pt)) { + for (m.aj(); m.ab(); ) + for (; m.Ia(); ) + if (this.Zq(), L = m.ia(), Ce = new A.l(), L.yc(Ce), Ce.isIntersecting(Pt)) + for (de = L.Fa(se, null, ie, null, _), L = 0; L < de; ++L) + (Ce = ie[L]) != 0 && Ce != 1 && (Ve = m.xb(), (Je = new H()).t = Ce, Je.index = Ve, D.push(Je)); + } + } + } + if (D.length == 0) + return b; + for (D = D.sort(H.zy), b = b.Ja(), m.aj(); m.ab() && !m.Ia(); ) + ; + for (_ = m.ia(), C = new A.jg(), B = -1, L = 0, q = D.length; L < q; ) { + for (ie = D[L].index, Z = L + 1; Z < q && D[Z].index == ie; ) + ++Z; + for (; m.xb() < ie; ) { + if (this.Zq(), se = m.Ia(), Ce = m.gb, (Pt = se || !m.Qn() || m.Rn()) && b.pc(_, B != Ce), B = Ce, !se) + for (; m.ab() && !m.Ia(); ) + ; + _ = m.ia(); + } + for (ie = 0; L < Z; L++) + (Ce = D[L].t) != ie && (_.dh(ie, Ce, C), ie = Ce, Ce = m.gb, b.pc(C.get(), B != Ce), B = Ce); + if ((Pt = (se = m.Ia()) || !m.Qn() || m.Rn()) && (_.dh(ie, 1, C), b.pc(C.get(), !1)), se) + _ = m.ia(); + else { + for (; m.ab() && !m.Ia(); ) + ; + _ = m.Ia() ? m.ia() : null; + } + L = Z; + } + for (_ != null && (Ce = m.gb, (Pt = (se = m.Ia()) || !m.Qn() || m.Rn()) && b.pc(_, B != Ce), B = Ce), se = m.Ia(); ; ) { + if (!se) { + for (; m.ab() && !(se = m.Ia()); ) + ; + if (!se) + break; + } + _ = m.ia(), Ce = m.gb, (Pt = (se = m.Ia()) || !m.Qn() || m.Rn()) && b.pc(_, B != Ce), B = Ce; + } + return b; + }, T; + }(); + A.bu = ve; + var H = function() { + function T() { + } + return T.zy = function(b, m) { + return b.index == m.index ? b.t > m.t ? 1 : b.t < m.t ? -1 : 0 : b.index > m.index ? 1 : -1; + }, T; + }(); + }(le || (le = {})), function(A) { + var ve; + (ve = A.FK || (A.FK = {}))[ve.Left = 0] = "Left", ve[ve.Right = 1] = "Right", ve[ve.Coincident = 2] = "Coincident", ve[ve.Undefined = 3] = "Undefined", ve[ve.Uncut = 4] = "Uncut"; + var H = function(m, _, C, D, L, B, q, Z, ie, se, de) { + this.Y = m, this.ct = _, this.Ps = C, this.ug = D, this.Nm = se, this.Cl = de; + }; + A.qY = H; + var T = function() { + function m(_, C) { + this.EH = _, this.Ji = C; + } + return m.prototype.lM = function(_, C) { + var D = new A.h(); + this.Ji.D(_, D); + var L = new A.h(); + return this.Ji.D(C, L), (D = D.compare(L)) != 0 ? D : (_ = this.Ji.Qa(_, this.EH)) < (C = this.Ji.Qa(C, this.EH)) ? -1 : _ == C ? 0 : 1; + }, m; + }(), b = function(m, _, C, D, L, B, q, Z, ie) { + this.ug = m, this.Ps = _, this.JA = C, this.PH = D, this.Gi = L, this.Cl = B, this.Nm = q, this.QH = Z, this.JT = ie; + }; + A.pY = b, A.GK = function() { + function m() { + } + return m.EK = function(_, C, D, L, B, q) { + if (C.B()) + _ = new H(C, 4, -1, -1, NaN, 4, -1, -1, NaN, -1, -1), B.push(_); + else if (D.B()) + _ = new H(C, 4, -1, -1, NaN, 4, -1, -1, NaN, -1, -1), B.push(_); + else { + var Z = new A.hd(); + if (Z.Ib(C), Z.Ib(D), A.Vk.W(Z, L, q, !0), Z.gd == 0) + _ = new H(C.Ja(), 4, -1, -1, NaN, 4, -1, -1, NaN, -1, -1), B.push(_); + else { + for (C = 0, D = Z.Hd(), L = Z.md; L != -1; L = Z.ve(L)) + for (q = Z.Ob(L); q != -1; q = Z.Sb(q)) + for (var ie = Z.Ya(q), se = 0, de = Z.Ka(q); se < de; ie = Z.V(ie), se++) + Z.Sa(ie, D, C++); + C = m.CM(D, Z), m.YL(_, C, Z, B); + } + } + }, m.CM = function(_, C) { + for (var D = C.gd, L = new A.ja(0), B = C.md; B != -1; B = C.ve(B)) + for (var q = C.Ob(B); q != -1; q = C.Sb(q)) + for (var Z = C.Ya(q), ie = 0, se = C.Ka(q); ie < se; Z = C.V(Z), ie++) + L.add(Z); + var de = new T(_, C); + L.Wd(0, D, function(Mi, Ri) { + return de.lM(Mi, Ri); + }), _ = []; + var Ce = [], Ve = C.Hd(), Je = C.Hd(); + B = C.md, q = C.ve(B), se = new A.h(); + var Pt = new A.h(), $t = L.get(0), qe = C.cd($t), Rt = C.Sf(qe); + C.D($t, se); + var Zt = 1; + for (Z = 0; Zt < D - 1; ) { + var Jt = !1; + for (ie = Zt; ie < D; ie++) + if (ie != Z) { + var Xt = L.get(ie), Qt = C.cd(Xt), bi = C.Sf(Qt); + if (C.D(Xt, Pt), !se.rb(Pt)) + break; + Rt == B && bi == q && (Jt = m.pM(Ve, Je, C, _, Ce, qe, $t, Qt, Xt)); + } + if (Jt || Z == Zt - 1) { + if (Jt && Z == Zt - 1 && Zt--, ++Z == D) + break; + $t = L.get(Z), qe = C.cd($t), Rt = C.Sf(qe), C.D($t, se); + } + Jt || (Zt = Z + 1); + } + for (D = [], B = C.md; B != -1; B = C.ve(B)) + for (q = C.Ob(B); q != -1; q = C.Sb(q)) + for (L = C.Ya(q), ie = 0, se = C.Ka(q); ie < se; L = C.V(L), ie++) { + if (0 <= (Z = C.Qa(L, Je))) + for (; Z < Ce.length && Ce[Z].ug == L; ) + D.push(Ce[Z++]); + if (0 <= (Z = C.Qa(L, Ve))) + for (; Z < _.length && _[Z].ug == L; ) + D.push(_[Z++]); + } + return C.Ud(Ve), C.Ud(Je), D; + }, m.pM = function(_, C, D, L, B, q, Z, ie, se) { + var de = D.tj(q), Ce = D.tj(ie), Ve = D.Ya(q), Je = D.Ya(ie), Pt = D.Na(Z), $t = D.Na(se), qe = !1, Rt = !1, Zt = !1, Jt = !1; + return Z != Ve && (se != Je && (qe = m.qM(_, D, L, q, Pt, ie, $t)), se != Ce && (Rt = m.rM(_, D, L, q, Pt, ie, se))), Z != de && (se != Je && (Zt = m.sM(C, D, B, q, Z, ie, $t, Ve)), se != Ce && (Jt = m.tM(C, D, B, q, Z, ie, se, Ve))), qe && Rt && Zt ? (_ = L.length - 1, B[Jt ? B.length - 2 : B.length - 1].Gi == 2 && (L[_ - 1] = L[_], --L.length)) : qe && Rt && Jt && B[B.length - 1].Gi == 2 && (B = L[L.length - 1], --L.length, D.Qa(B.ug, _) == L.length && D.Sa(B.ug, _, -1)), qe || Rt || Zt || Jt; + }, m.qM = function(_, C, D, L, B, q, Z) { + var ie = new A.zb(), se = new A.zb(), de = [0, 0], Ce = [0, 0], Ve = C.cc(B); + return Ve == null && (C.fd(B, ie), Ve = ie), (ie = C.cc(Z)) == null && (C.fd(Z, se), ie = se), 2 > (Ve = Ve.Fa(ie, null, de, Ce, 0)) && (L = new b(B, L, de[0], NaN, Ve, Z, q, Ce[0], NaN), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1)), !0; + }, m.rM = function(_, C, D, L, B, q, Z) { + var ie = new A.zb(), se = new A.zb(), de = [0, 0], Ce = [0, 0], Ve = C.cc(B); + return Ve == null && (C.fd(B, ie), Ve = ie), (ie = C.cc(Z)) == null && (C.fd(Z, se), ie = se), 2 > (Ve = Ve.Fa(ie, null, de, Ce, 0)) && (L = new b(B, L, de[0], NaN, Ve, Z, q, Ce[0], NaN), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1), !0); + }, m.sM = function(_, C, D, L, B, q, Z, ie) { + var se = new A.zb(), de = new A.zb(), Ce = [0, 0], Ve = [0, 0], Je = C.cc(B); + return Je == null && (C.fd(B, se), Je = se), (se = C.cc(Z)) == null && (C.fd(Z, de), se = de), (Je = Je.Fa(se, null, Ce, Ve, 0)) == 2 ? (L = new b(B, L, Ce[0], Ce[1], Je, Z, q, Ve[0], Ve[1]), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1), !0) : (de = !1, B == ie && (L = new b(B, L, Ce[0], NaN, Je, Z, q, Ve[0], NaN), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1), de = !0), de); + }, m.tM = function(_, C, D, L, B, q, Z, ie) { + var se = new A.zb(), de = new A.zb(), Ce = [0, 0], Ve = [0, 0], Je = C.cc(B); + return Je == null && (C.fd(B, se), Je = se), (se = C.cc(Z)) == null && (C.fd(Z, de), se = de), (Je = Je.Fa(se, null, Ce, Ve, 0)) == 2 ? (L = new b(B, L, Ce[0], Ce[1], Je, Z, q, Ve[0], Ve[1]), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1), !0) : (de = !1, B == ie && (L = new b(B, L, Ce[0], NaN, Je, Z, q, Ve[0], NaN), D.push(L), 0 > (L = C.Qa(B, _)) && C.Sa(B, _, D.length - 1), de = !0), de); + }, m.YL = function(_, C, D, L) { + var B = []; + B[0] = new A.h(), B[1] = new A.h(), B[2] = new A.h(), B[3] = new A.h(); + var q = new A.h(), Z = new A.h(), ie = new A.h(), se = new A.h(), de = null; + L != null && (de = new A.jg()).Qr(); + var Ce = 0, Ve = null, Je = new A.zb(); + new A.zb(); + for (var Pt = D.Ob(D.md); Pt != -1; Pt = D.Sb(Pt)) { + for (var $t = 4, qe = -1, Rt = -1, Zt = -1, Jt = -1, Xt = NaN, Qt = !0, bi = !1, Mi = !0, Ri = !0, Yi = !0, rr = 0, _i = Pt, fn = 0, jr = D.Ya(Pt), no = D.Ka(Pt), $r = 0; $r < no; jr = D.V(jr), $r++) { + var Zn = D.cc(jr); + if (Zn == null) { + if (!D.fd(jr, Je)) + continue; + Zn = Je; + } + Rt == -1 && (Rt = jr); + for (var bs = 0; Ce < C.length && jr == C[Ce].ug; ) { + qe = C[Ce].Ps; + var On = C[Ce].ug, Jn = C[Ce].JA, ki = C[Ce].Nm, Ur = C[Ce].Cl, So = C[Ce].QH; + if (C[Ce].Gi == 2) { + if (bi || (_i = qe, Rt = On, fn = Jn, Zt = ki, Jt = Ur, Xt = So, $t = 2, L != null ? Ve = new A.Ua() : rr = 0, Yi = !1, Ri = !0), Jn = C[Ce].PH, So = C[Ce].JT, L != null ? (Zn.dh(bs, C[Ce].PH, de), Ve.pc(de.get(), Ri)) : rr++, bs = Jn, bi = !0, Ri = Qt = !1, Ce + 1 == C.length || C[Ce + 1].Gi != 2 || C[Ce + 1].ug == On && C[Ce + 1].JA != bs) { + if (L != null) { + var Cn = new H(Ve, 2, qe, On, Jn, $t, _i, Rt, fn, ki, Ur); + L.push(Cn); + } else + null.add(rr); + _i = qe, Rt = On, fn = Jn, Zt = ki, Jt = Ur, Xt = So, $t = 2, bi = Qt = !1, Ri = Yi = !0; + } + } else { + var Ki = D.V(On); + if (Ce < C.length - 1 && C[Ce + 1].ug == Ki && C[Ce + 1].Cl == Ur && C[Ce + 1].Gi == 2) + Jn != bs && (Yi && (L != null ? Ve = new A.Ua() : rr = 0), Qt = 0 < Ce && C[Ce - 1].Ps == qe ? $t == 1 ? 0 : $t == 0 ? 1 : 3 : 3, L != null ? (Zn.dh(bs, Jn, de), Ve.pc(de.get(), Ri), Cn = new H(Ve, Qt, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : (rr++, null.add(rr)), bs = Jn, _i = qe, Rt = On, fn = Jn, Zt = ki, Jt = Ur, Xt = So, $t = Qt, Qt = Mi = !1, Ri = Yi = !0); + else if (!m.xM(_, D, C, Ce, q, Z)) { + m.uM(D, C, Ce, Pt, jr, ie, se); + var ui = !1; + if (Ki = !1, Cn = !0, !(q.rb(ie) || Z.rb(ie) || q.rb(se) || Z.rb(se))) { + B[0].N(q), B[1].N(Z), B[2].N(ie), B[3].N(se), B.sort(A.h.pu); + var W = B[0], Cr = B[1], ia = B[2], Ho = B[3]; + W.rb(q) ? Cr.rb(Z) ? _ ? (Ki = ui = !0, Cn = !1) : ui = !1 : Ho.rb(Z) ? _ ? Cn = Ki = ui = !0 : ui = !1 : (ui = !0, Cn = Cr.rb(ie)) : Cr.rb(q) ? ia.rb(Z) ? _ ? (Ki = ui = !0, Cn = !1) : ui = !1 : W.rb(Z) ? _ ? Cn = Ki = ui = !0 : ui = !1 : (ui = !0, Cn = ia.rb(ie)) : ia.rb(q) ? Ho.rb(Z) ? _ ? (Ki = ui = !0, Cn = !1) : ui = !1 : Cr.rb(Z) ? _ ? Cn = Ki = ui = !0 : ui = !1 : (ui = !0, Cn = Ho.rb(ie)) : W.rb(Z) ? _ ? (Ki = ui = !0, Cn = !1) : ui = !1 : ia.rb(Z) ? _ ? Cn = Ki = ui = !0 : ui = !1 : (ui = !0, Cn = W.rb(ie)); + } + ui && (ui = jr == On, (Jn != bs || ui && bs == 0) && (Yi && (L != null ? Ve = new A.Ua() : rr = 0), L != null ? (Zn.dh(bs, Jn, de), Ve.pc(de.get(), Ri)) : rr++), Cn ? $t != 1 ? ((Jn != bs || ui && bs == 0) && (L != null ? (Cn = new H(Ve, 1, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr)), Ki ? (Ce >= C.length - 2 || C[Ce + 2].Ps != qe) && ($t = 0) : $t = 1) : ((Jn != bs || ui && bs == 0) && (L != null ? (Cn = new H(Ve, 3, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr)), $t = 1) : $t != 0 ? ((Jn != bs || ui && bs == 0) && (L != null ? (Cn = new H(Ve, 0, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr)), Ki ? (Ce >= C.length - 2 || C[Ce + 2].Ps != qe) && ($t = 1) : $t = 0) : ((Jn != bs || ui && bs == 0) && (L != null ? (Cn = new H(Ve, 3, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr)), $t = 0), (Jn != bs || ui && bs == 0) && (bs = Jn, _i = qe, Rt = On, fn = Jn, Zt = ki, Jt = Ur, Xt = So, Qt = Mi = !1, Ri = Yi = !0)); + } + } + Ce++; + } + bs != 1 && (Yi && (L != null ? Ve = new A.Ua() : rr = 0), L != null ? (Zn.dh(bs, 1, de), Ve.pc(de.get(), Ri)) : rr++, Ri = Yi = !1, Mi = !0); + } + Mi && (Jn = 1, On = D.tj(Pt), On = D.Na(On), Ur = ki = -1, So = NaN, Qt ? L != null ? (Cn = new H(Ve, 4, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr) : (Qt = $t == 1 ? 0 : $t == 0 ? 1 : 3, L != null ? (Cn = new H(Ve, Qt, qe, On, Jn, $t, _i, Rt, fn, ki, Ur), L.push(Cn)) : null.add(rr))); + } + }, m.xM = function(_, C, D, L, B, q) { + var Z = D[L].QH; + if (Z == 1) + return m.vM(_, C, D, L, B, q); + if (Z == 0) + return m.wM(_, C, D, L, B, q); + throw A.i.Ra(); + }, m.vM = function(_, C, D, L, B, q) { + var Z = new A.zb(), ie = D[L].ug, se = D[L].Nm, de = D[L].Cl, Ce = -1, Ve = -1, Je = -1, Pt = -1; + if (!_ && 0 < L) { + var $t = D[L - 1]; + Ce = $t.ug, Ve = $t.Nm, Je = $t.Cl, Pt = $t.Gi; + } + var qe = -1, Rt = -1, Zt = -1, Jt = -1; + L < D.length - 1 && (qe = ($t = D[L + 1]).ug, Rt = $t.Nm, Zt = $t.Cl, Jt = $t.Gi); + var Xt = C.V(ie); + return $t = C.V(de), _ ? L == D.length - 1 || qe != ie || Rt != se || Zt != $t || Jt == 2 ? ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), q.N(_.lg()), B.nt(q), q.normalize(), B.normalize(), !1) : ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), B.N(_.lg()), (_ = C.cc($t)) == null && (C.fd($t, Z), _ = Z), q.N(_.lg()), B.Uq(), q.normalize(), B.normalize(), !1) : 0 < L && Ce == ie && Ve == se && Je == $t && Pt == 2 || L < D.length - 1 && qe == Xt && Rt == se && Zt == $t && Jt == 2 ? ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), q.N(_.lg()), B.nt(q), q.normalize(), B.normalize(), !1) : !(L < D.length - 1 && qe == ie && Rt == se && Zt == $t) || ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), B.N(_.lg()), (_ = C.cc($t)) == null && (C.fd($t, Z), _ = Z), q.N(_.lg()), B.Uq(), q.normalize(), B.normalize(), !1); + }, m.wM = function(_, C, D, L, B, q) { + var Z = new A.zb(), ie = D[L].ug, se = D[L].Nm, de = D[L].Cl, Ce = -1, Ve = -1, Je = -1, Pt = -1; + if (!_ && L < D.length - 1) { + var $t = D[L + 1]; + Ce = $t.ug, Ve = $t.Nm, Je = $t.Cl, Pt = $t.Gi; + } + var qe = -1, Rt = -1, Zt = -1; + $t = -1, 0 < L && (qe = ($t = D[L - 1]).ug, Rt = $t.Nm, Zt = $t.Cl, $t = $t.Gi); + var Jt = C.V(ie), Xt = C.Na(de); + return _ ? L != 0 && qe == ie && Rt == se && Zt == Xt && $t != 2 || ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), q.N(_.lg()), B.nt(q), q.normalize(), B.normalize(), !1) : !(0 < L && qe == ie && Rt == se && Zt == Xt && $t == 2 || L < D.length - 1 && Ce == Jt && Ve == se && Je == Xt && Pt == 2) || ((_ = C.cc(de)) == null && (C.fd(de, Z), _ = Z), q.N(_.lg()), B.nt(q), q.normalize(), B.normalize(), !1); + }, m.uM = function(_, C, D, L, B, q, Z) { + var ie = new A.zb(), se = _.cc(B); + if (se == null && (_.fd(B, ie), se = ie), C = (D = C[D]).ug, D = D.JA, B = _.V(C), D == 1) + q.N(se.lg()), B != -1 && B != _.tj(L) ? ((se = _.cc(B)) == null && (_.fd(B, ie), se = ie), Z.N(se.lg()), (se = _.cc(C)) == null && _.fd(C, ie)) : Z.N(q), q.Uq(), Z.normalize(), q.normalize(); + else { + if (D != 0) + throw A.i.Ra(); + Z.N(se.lg()), q.nt(Z), Z.normalize(), q.normalize(); + } + }, m; + }(); + }(le || (le = {})), function(A) { + var ve; + (ve = A.XL || (A.XL = {}))[ve.Linear = 0] = "Linear", ve[ve.Angular = 1] = "Angular", ve[ve.Area = 2] = "Area"; + var H = function() { + function L(B, q, Z) { + this.pd = q, this.ci = Z, this.qA = B; + } + return L.prototype.Nb = function(B) { + return B instanceof L && this.ci === B.ci; + }, L.WF = function(B) { + return B.pd !== 0 ? null : B.qA === -1 ? new L(-1, 2, B.ci * B.ci) : L.ah(C[B.qA]); + }, L.ah = function(B) { + return (B = _[B]) === void 0 ? null : B; + }, L.UO = function(B, q, Z) { + var ie = null; + if (Z != null) + try { + Z.values[0] === "EPSG" && (ie = L.ah(parseInt(Z.values[1]))); + } catch { + } + return ie === null && (ie = new L(-1, B, q)), ie; + }, L.prototype.Fc = function() { + return this.qA; + }, L.prototype.xF = function(B) { + if (B.pd != this.pd) + throw A.i.Hb(); + return this.ci / B.ci; + }, L.Ph = function(B, q, Z) { + return q.xF(Z) * B; + }, L.SE = function(B, q, Z, ie, se) { + for (Z = Z.xF(ie), ie = 0; ie < q; ie++) + se[ie] = B[ie] * Z; + }, L; + }(); + A.Uc = H; + for (var T = [109401, 1e4, 109402, 4046.8564224, 109403, 4046.87260987425, 109404, 1, 109405, 0.09290304, 109406, 0.09290341161327487, 109407, 0.09290137299531805, 109408, 3.34450944, 109409, 3429904, 109410, 1.000027193184865, 109411, 404.6872609874253, 109412, 0.04046872609874253, 109413, 2.5899984703195216e6, 109414, 1e6, 109415, 0.8361123569578626, 109416, 404.67838076760535, 109417, 0.04046783807676053, 109418, 0.8361244606523066, 109419, 0.09290271785025629, 109420, 404.68423895571647, 109421, 0.04046842389557164, 109422, 0.83612589696064, 109423, 0.0929028774400711, 109424, 404.6849341289498, 109425, 0.04046849341289498, 109426, 0.836125904805842, 109427, 0.09290287831176021, 109428, 404.68493792602754, 109429, 0.04046849379260275, 109430, 0.09290354800069446, 109431, 0.09290274144751023, 109432, 0.09290207073852812, 109433, 0.09290279616016, 109434, 0.09290273520025, 109435, 0.836124673027592, 109436, 0.836118636646753, 109437, 0.8361251654414399, 109438, 0.83612461680225, 109439, 2589988110336e-6, 109440, 0.09290286332673177, 109441, 0.09290349665192114, 109442, 0.83612736, 109443, 0.8361307045194736, 109444, 404.68564224000005, 109445, 0.04046856422400001, 109446, 0.8361237024040001, 109447, 0.0929026336004445, 109448, 404.683871963536, 109449, 0.0404683871963536, 109450, 0.01, 109451, 1e-4, 109452, 1e-6, 109453, 64516e-8, 109454, 6451625806477421e-19, 109455, 25.292852640000003, 109456, 25.29295381171408, 109457, 3.4345281495040003e6, 109458, 3434290937856e-6, 109459, 2.89612324, 109460, 25e8, 109461, 225e8, 109462, 0.7168473118308245, 109463, 100, 109464, 1244521604938272e-22, 109465, 1e-12, 109466, 1e-18], b = [1031, 484813681109536e-23, 9101, 1, 9102, 0.0174532925199433, 9103, 2908882086657216e-19, 9104, 484813681109536e-20, 9105, 0.01570796326794897, 9106, 0.01570796326794897, 9109, 1e-6, 9112, 1570796326794897e-19, 9113, 1570796326794897e-21, 9114, 9817477042468104e-19], m = [1025, 1e-3, 109452, 1033, 0.01, 109451, 9001, 1, 109404, 9002, 0.3048, 109405, 9003, 0.3048006096012192, 109406, 9005, 0.3047972654, 109407, 9014, 1.8288, 109408, 9030, 1852, 109409, 9031, 1.0000135965, 109410, 9033, 20.11684023368047, 109411, 9034, 0.2011684023368047, 109412, 9035, 1609.3472186944375, 109413, 9036, 1e3, 109414, 9037, 0.9143917962000001, 109415, 9038, 20.1166195164, 109416, 9039, 0.201166195164, 109417, 9040, 0.9143984146160287, 109418, 9041, 0.304799471538676, 109419, 9042, 20.116765121552632, 109420, 9043, 0.2011676512155263, 109421, 9050, 0.9143992, 109422, 9051, 0.3047997333333333, 109423, 9052, 20.1167824, 109424, 9053, 0.201167824, 109425, 9060, 0.9143992042898124, 109426, 9061, 0.3047997347632708, 109427, 9062, 20.116782494375872, 109428, 9063, 0.2011678249437587, 109429, 9070, 0.3048008333333334, 109430, 9080, 0.3047995102481469, 109431, 9081, 0.30479841, 109432, 9082, 0.3047996, 109433, 9083, 0.3047995, 109434, 9084, 0.9143985307444408, 109435, 9085, 0.91439523, 109436, 9086, 0.9143988, 109437, 9087, 0.9143985, 109438, 9093, 1609.344, 109439, 9094, 0.3047997101815088, 109440, 9095, 0.3048007491, 109441, 9096, 0.9144, 109442, 9097, 20.1168, 109444, 9098, 0.201168, 109445, 9099, 0.914398, 109446, 9300, 0.3047993333333334, 109447, 9301, 20.116756, 109448, 9302, 0.20116756, 109449, 109001, 0.9144, 109442, 109002, 0.9144018288036576, 109443, 109003, 20.1168, 109444, 109004, 0.201168, 109445, 109005, 0.1, 109450, 109006, 0.01, 109451, 109007, 1e-3, 109452, 109008, 0.0254, 109453, 109009, 0.0254000508001016, 109454, 109010, 5.0292, 109455, 109011, 5.029210058420118, 109456, 109012, 1853.248, 109457, 109013, 1853.184, 109458, 109014, 1.7018, 109459, 109015, 0.8466683600033867, 109462, 109016, 3527777777777778e-19, 109464, 109017, 1e-6, 109465, 109018, 1e-9, 109466, 109030, 5e4, 109460, 109031, 15e4, 109461], _ = [], C = [], D = 0; D < T.length; D += 2) + _[T[D]] = new H(T[D], 2, T[D + 1]); + for (T = null, D = 0; D < b.length; D += 2) + _[b[D]] = new H(b[D], 1, b[D + 1]); + for (b = null, D = 0; D < m.length; D += 3) + _[m[D]] = new H(m[D], 0, m[D + 1]), C[m[D]] = m[D + 2]; + m = null; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.yb = this.pb = 0; + } + return H.prototype.set = function(T, b) { + b !== void 0 ? (this.pb = T, this.yb = b) : typeof T == "number" ? (this.pb = T, this.yb = 0) : (this.pb = T.pb, this.yb = T.yb); + }, H.prototype.value = function() { + return this.pb; + }, H.prototype.add = function(T) { + var b = this.pb + T.pb; + T = this.yb + T.yb + 2220446049250313e-31 * Math.abs(b), this.pb = b, this.yb = T; + }, H.prototype.fN = function() { + var T = this.pb + 1, b = this.yb + 2220446049250313e-31 * Math.abs(T); + this.pb = T, this.yb = b; + }, H.prototype.ZM = function(T, b) { + this.pb = T.pb + b.pb, this.yb = T.yb + b.yb + 2220446049250313e-31 * Math.abs(this.pb); + }, H.prototype.sub = function(T) { + if (typeof T == "number") { + var b = this.pb - T; + T = this.yb + 2220446049250313e-31 * Math.abs(b); + } else + b = this.pb - T.pb, T = this.yb + T.yb + 2220446049250313e-31 * Math.abs(b); + this.pb = b, this.yb = T; + }, H.prototype.Bg = function(T) { + var b = this.pb * T.pb; + this.yb = this.yb * Math.abs(T.pb) + T.yb * Math.abs(this.pb) + this.yb * T.yb + 2220446049250313e-31 * Math.abs(b), this.pb = b; + }, H.prototype.Po = function(T) { + var b = this.pb * T; + this.yb = this.yb * Math.abs(T) + 2220446049250313e-31 * Math.abs(b), this.pb = b; + }, H.prototype.Ml = function(T, b) { + var m = Math.abs(T.pb) * Math.abs(b.pb); + this.yb = T.yb * Math.abs(b.pb) + b.yb * Math.abs(T.pb) + T.yb * b.yb + 2220446049250313e-31 * Math.abs(m), this.pb = m; + }, H.prototype.lm = function(T) { + var b = Math.abs(T.pb), m = this.pb / T.pb, _ = (this.yb + Math.abs(m) * T.yb) / b; + T.yb > 0.01 * b && (_ *= 1 + (1 + (T = T.yb / b)) * T), this.pb = m, this.yb = _ + 2220446049250313e-31 * Math.abs(m); + }, H.prototype.sqrt = function() { + if (0 <= this.pb) { + var T = Math.sqrt(this.pb), b = this.pb > 10 * this.yb ? 0.5 * this.yb / T : this.pb > this.yb ? T - Math.sqrt(this.pb - this.yb) : Math.max(T, Math.sqrt(this.pb + this.yb) - T); + b += 2220446049250313e-31 * Math.abs(T); + } else + this.pb < -1 * this.yb ? b = T = NaN : (T = 0, b = Math.sqrt(this.yb)); + this.pb = T, this.yb = b; + }, H.prototype.sin = function(T) { + var b = Math.sin(T.pb), m = Math.cos(T.pb); + this.pb = b, b = Math.abs(b), this.yb = (Math.abs(m) + 0.5 * b * T.yb) * T.yb + 2220446049250313e-31 * b; + }, H.prototype.cos = function(T) { + var b = Math.sin(T.pb), m = Math.cos(T.pb); + this.pb = m, m = Math.abs(m), this.yb = (Math.abs(b) + 0.5 * m * T.yb) * T.yb + 2220446049250313e-31 * m; + }, H.prototype.rg = function() { + return Math.abs(this.pb) <= this.yb; + }, H.prototype.rs = function() { + return this.rg() && this.yb != 0; + }, H; + }(); + A.Xb = ve; + }(le || (le = {})); + var pe = new le.h(), Ae = new le.h(), it = new le.h(), yt = new le.h(), He = new le.h(); + (function(A) { + var ve, H; + (H = ve || (ve = {}))[H.closedPath = 1] = "closedPath", H[H.exteriorPath = 2] = "exteriorPath", H[H.ringAreaValid = 4] = "ringAreaValid"; + var T = function() { + function b(m, _, C, D, L, B, q) { + _ !== void 0 ? (this.ib = m, this.ek = _, this.dl = C, this.ki = D, this.za = B, this.cA = q, this.gw = L) : (this.ib = m.ib, this.ek = m.ek, this.dl = m.dl, this.ki = m.ki, this.za = m.za, this.cA = m.cA, this.gw = m.gw), this.XG = !0; + } + return b.prototype.next = function() { + return this.XG ? (this.XG = !1, this.ki) : this.ki != -1 ? (this.ki = this.ib.V(this.ki), this.za++, this.ki != -1 && this.ki != this.gw ? this.ki : this.VT()) : -1; + }, b.prototype.VT = function() { + for (this.dl = this.ib.Sb(this.dl), this.za = 0; this.ek != -1; ) { + for (; this.dl != -1; this.dl = this.ib.Sb(this.dl)) + if (this.gw = this.ki = this.ib.Ya(this.dl), this.ki != -1) + return this.ki; + if (this.ek = this.ib.ve(this.ek), this.ek == -1) + break; + this.cA && !A.ba.Ic(this.ib.jc(this.ek)) || (this.dl = this.ib.Ob(this.ek)); + } + return -1; + }, b.vP = function(m, _, C, D, L, B, q) { + return new b(m, _, C, D, L, B, q); + }, b; + }(); + A.vY = T, ve = function() { + function b() { + this.lo = this.Cm = this.yk = this.dd = this.Ek = this.xo = this.Qi = this.nd = this.di = this.Ug = this.Te = this.Kl = null, this.sw = this.md = -1, this.gd = 0, this.aA = !1, this.it = this.jt = this.wb = null; + } + return b.prototype.Uh = function(m) { + return this.Te != null ? this.Te[m] : null; + }, b.prototype.Zg = function(m, _) { + if (this.Te == null) { + if (_ == null) + return; + this.Te = []; + for (var C = 0, D = this.wb.I(); C < D; C++) + this.Te.push(null); + } + this.Te[m] = _; + }, b.prototype.ep = function(m, _) { + this.nd.T(m, 1, _); + }, b.prototype.cp = function(m, _) { + this.nd.T(m, 2, _); + }, b.prototype.QB = function(m, _) { + this.nd.T(m, 6, _); + }, b.prototype.Up = function(m) { + return this.nd.U(m, 6); + }, b.prototype.gx = function(m, _) { + this.nd.T(m, 7, _); + }, b.prototype.sv = function(m) { + return this.nd.U(m, 0); + }, b.prototype.JJ = function(m, _) { + this.dd.T(m, 1, _); + }, b.prototype.NJ = function(m, _) { + this.dd.T(m, 0, _); + }, b.prototype.EF = function(m) { + return this.dd.U(m, 7); + }, b.prototype.ap = function(m, _) { + this.dd.T(m, 3, _); + }, b.prototype.bp = function(m, _) { + this.dd.T(m, 4, _); + }, b.prototype.pU = function(m) { + this.dd == null && (this.dd = new A.ad(8)); + var _ = this.dd.De(); + return this.dd.T(_, 2, m), this.dd.T(_, 5, 0), this.dd.T(_, 6, 0), this.dd.T(_, 7, _), _; + }, b.prototype.JQ = function(m) { + this.dd.kd(m); + }, b.prototype.rU = function(m) { + this.nd == null && (this.nd = new A.ad(8), this.ud = new A.ad(5), this.Qi = new A.ce(0), this.xo = new A.ce(0)); + var _ = this.nd.De(); + return this.nd.T(_, 0, _), this.nd.T(_, 3, 0), this.nd.T(_, 6, 0), this.gx(_, m), _ >= this.Qi.size && (m = 16 > _ ? 16 : A.P.truncate(3 * _ / 2), this.Qi.resize(m), this.xo.resize(m)), this.Qi.set(_, 0), this.xo.set(_, 0), _; + }, b.prototype.nF = function(m) { + this.nd.kd(m); + }, b.prototype.Qy = function(m) { + this.ud.kd(m), this.gd--; + }, b.prototype.jI = function(m) { + this.nd == null && (this.nd = new A.ad(8), this.ud = new A.ad(5), this.Qi = new A.ce(0), this.xo = new A.ce(0)); + var _ = this.ud.De(), C = 0 <= m ? m : _; + if (this.ud.T(_, 0, C), 0 > m) { + if (C >= this.wb.I()) { + if (m = 16 > C ? 16 : A.P.truncate(3 * C / 2), this.wb.resize(m), this.Te != null) + for (var D = 0; D < m; D++) + this.Te.push(null); + this.Ug != null && this.Ug.resize(m), this.jt = this.wb.vb(0); + } + this.wb.Db(C, -1e38, -1e38), this.Te != null && (this.Te[C] = null), this.Ug != null && this.Ug.write(C, 1); + } + return this.ud.T(_, 4, 2 * C), this.gd++, _; + }, b.prototype.yj = function(m, _, C) { + var D = _ != -1 ? this.Na(_) : this.tj(m), L = D != -1 ? this.V(D) : -1, B = this.jI(C == null ? this.gd : -1), q = this.Va(B); + return C != null && this.wb.It(q, C), this.cj(B, m), this.Cc(B, L), this.Dc(B, D), L != -1 && this.Dc(L, B), D != -1 && this.Cc(D, B), C = this.ec(m), D = this.Ya(m), _ == -1 && this.Yg(m, B), _ == D && this.Kf(m, B), C && L == -1 && (this.Cc(B, B), this.Dc(B, B)), this.Xj(m, this.Ka(m) + 1), m = this.Sf(m), this.Vj(m, this.I(m) + 1), B; + }, b.prototype.pm = function() { + return this.lo == null && (this.lo = new A.Ta(this.wb.description)), this.lo; + }, b.prototype.$o = function(m, _) { + this.dd.T(m, 2, -134217729 & this.dd.U(m, 2) || (_ == 1 ? 134217728 : 0)); + }, b.prototype.Kn = function(m) { + return 134217728 & this.dd.U(m, 2) ? 1 : 0; + }, b.prototype.cN = function(m) { + var _ = this.Kg(m.K(), m.description); + return m.K() == 1736 && this.$o(_, m.Kn()), this.PD(_, m), _; + }, b.prototype.dN = function(m) { + var _ = this.Kg(m.K(), m.description); + return this.QD(_, m), _; + }, b.prototype.SV = function(m, _) { + this.nd == null && (this.nd = new A.ad(8), this.ud = new A.ad(5), this.Qi = new A.ce(0), this.xo = new A.ce(0)), this.nd.Ee(this.nd.Jg + m), this.ud.Ee(this.ud.Jg + _), this.Qi.Jb(this.Qi.size + m), this.xo.Jb(this.xo.size + m); + }, b.prototype.PD = function(m, _) { + this.SV(_.ea(), _.I()), this.Kl.Gd(_, 0, _.I()), this.jt = this.wb.vb(0); + for (var C = this.Te != null && _.Se != null, D = 0, L = _.ea(); D < L; D++) + if (!(2 > _.Ka(D))) { + var B = this.wf(m, -1); + this.mn(B, _.ec(D)); + for (var q = _.Ca(D), Z = _.Wc(D); q < Z; q++) { + var ie = this.yj(B, -1, null); + if (C) + if (ie = this.Va(ie), (1 & _.UF(q)) != 0) + this.Zg(ie, null); + else { + var se = new A.jg(); + _.cc(q, se, !0), this.Zg(ie, se.get()); + } + } + } + }, b.prototype.QD = function(m, _) { + this.Kl.Gd(_, 0, _.I()), this.jt = this.wb.vb(0), m = this.wf(m, -1); + var C = 0; + for (_ = _.I(); C < _; C++) + this.yj(m, -1, null); + }, b.prototype.JX = function(m, _, C) { + var D = this.V(m); + if (D == -1) + throw A.i.Ra(); + for (var L = this.pm(), B = this.cd(m), q = 0, Z = _.ql(C); q < Z; q++) { + var ie = this.Va(m), se = this.V(m), de = _.Xp(C, q); + q == 0 && (de.Vo(L), this.Fh(m, L)), de.K() == 322 ? this.Zg(ie, null) : this.Zg(ie, A.ba.kg(de)), de.Ro(L), q < Z - 1 ? m = this.yj(B, se, L) : this.Fh(D, L); + } + }, b.prototype.IX = function(m, _, C) { + var D = this.V(m); + if (D == -1) + throw A.i.Ra(); + for (var L = this.pm(), B = this.cd(m), q = 0, Z = _.ql(C); q < Z; q++) { + var ie = this.Va(m), se = this.V(m), de = _.Xp(C, Z - q - 1); + q == 0 && (de.Ro(L), this.Fh(m, L)), de.K() == 322 ? this.Zg(ie, null) : this.Zg(ie, A.ba.kg(de)), de.Vo(L), q < Z - 1 ? m = this.yj(B, se, L) : this.Fh(D, L); + } + }, b.prototype.DF = function() { + var m = new A.l(); + m.Pa(); + for (var _ = this.$q(), C = new A.h(), D = !0, L = _.next(); L != -1; L = _.next()) + this.D(L, C), D ? m.$b(C.x, C.y) : m.Nk(C.x, C.y), D = !1; + return m; + }, b.prototype.Ib = function(m) { + var _ = m.K(); + if (A.ba.Ic(_)) + return this.cN(m); + if (_ == 550) + return this.dN(m); + throw A.i.Ra(); + }, b.prototype.pN = function(m, _) { + var C = _.K(); + if (A.ba.Ic(C)) + this.PD(m, _); + else { + if (C != 550) + throw A.i.Ra(); + this.QD(m, _); + } + }, b.prototype.hN = function(m, _) { + var C = this.Kg(1736, m.description); + if (2 > m.Ka(_)) + return C; + this.Kl.Gd(m, m.Ca(_), m.Wc(_)), this.jt = this.wb.vb(0); + var D = this.wf(C, -1); + this.mn(D, m.ec(_) || !0); + var L = this.Te != null && m.Se != null, B = m.Ca(_); + for (_ = m.Wc(_); B < _; B++) { + var q = this.yj(D, -1, null); + if (L) + if (q = this.Va(q), (1 & m.UF(B)) != 0) + this.Zg(q, null); + else { + var Z = new A.jg(); + m.cc(B, Z, !0), this.Zg(q, Z.get()); + } + } + return C; + }, b.prototype.Ke = function(m) { + var _ = this.jc(m), C = A.UK.Kg(_, this.Kl.description), D = this.I(m); + if (D == 0) + return C; + if (A.ba.Ic(_)) { + _ = this.ea(m); + for (var L = A.Zc.Qh(_ + 1), B = A.Zc.Or(_ + 1, 0), q = C.description, Z = 0, ie = q.Ba; Z < ie; Z++) { + for (var se = q.ld(Z), de = A.sa.Wa(se), Ce = A.Zc.TE(se, D), Ve = this.wb.vb(se), Je = 0, Pt = 0, $t = 0, qe = this.Ob(m); qe != -1; qe = this.Sb(qe)) { + var Rt = 0; + this.ec(qe) && (Rt |= 1), this.TS(qe) && (Rt |= 4), Rt != 0 && B.uJ(Pt, Rt); + var Zt = this.Ka(qe); + if (L.write(Pt++, $t), $t += Zt, se == 0) { + Zt = Ve; + var Jt = Ce, Xt = new A.h(); + for (Rt = this.Ya(qe); Je < $t; Rt = this.V(Rt), Je++) { + var Qt = this.Va(Rt); + Zt.uc(2 * Qt, Xt), Jt.Vt(2 * Je, Xt); + } + } else + for (Rt = this.Ya(qe); Je < $t; Rt = this.V(Rt), Je++) + for (Qt = this.Va(Rt), Jt = 0; Jt < de; Jt++) + Xt = Ve.gg(Qt * de + Jt), Ce.rr(Je * de + Jt, Xt); + } + C.kn(se, Ce), L.write(_, D); + } + C.KJ(B), C.LJ(L), C.Qc(16777215); + } else if (_ == 550) { + for (q = C.description, C.resize(D), Z = 0, ie = q.Ba; Z < ie; Z++) { + for (se = q.ld(Z), de = A.sa.Wa(se), Ce = C.vb(se), Ve = this.wb.vb(se), Je = 0, qe = this.Ob(m), Zt = this.Ka(qe), Rt = this.Ya(qe); Je < Zt; Rt = this.V(Rt), Je++) + for (Qt = this.Va(Rt), Jt = 0; Jt < de; Jt++) + Xt = Ve.gg(Qt * de + Jt), Ce.rr(Je * de + Jt, Xt); + C.kn(se, Ce); + } + C.Qc(16777215); + } + return C; + }, b.prototype.wB = function(m) { + for (var _ = this.Ob(m); _ != -1; _ = this.ar(_)) + ; + _ = this.KR(m); + var C = this.ve(m); + _ != -1 ? this.JJ(_, C) : this.md = C, C != -1 ? this.NJ(C, _) : this.sw = _, this.JQ(m); + }, b.prototype.Kg = function(m, _) { + return _ === void 0 ? this.VE(m, A.fe.pg()) : this.VE(m, _); + }, b.prototype.VE = function(m, _) { + return m = this.pU(m), this.wb == null ? this.wb = this.Kl = new A.ee(_) : this.Kl.Ll(_), this.it = this.Kl.description, this.aA = 1 < this.it.Ba, this.md == -1 ? this.md = m : (this.NJ(m, this.sw), this.JJ(this.sw, m)), this.sw = m; + }, b.prototype.ve = function(m) { + return this.dd.U(m, 1); + }, b.prototype.KR = function(m) { + return this.dd.U(m, 0); + }, b.prototype.jc = function(m) { + return 2147483647 & this.dd.U(m, 2); + }, b.prototype.CJ = function(m, _, C) { + _ = this.yk[_], (m = this.EF(m)) >= _.size && _.resize(Math.max(A.P.truncate(1.25 * m), 16), -1), _.write(m, C); + }, b.prototype.FF = function(m, _) { + return (m = this.EF(m)) < (_ = this.yk[_]).size ? _.read(m) : -1; + }, b.prototype.WE = function() { + this.yk == null && (this.yk = []); + for (var m = 0; m < this.yk.length; m++) + if (this.yk[m] == null) + return this.yk[m] = A.Zc.Qh(0), m; + return this.yk.push(A.Zc.Qh(0)), this.yk.length - 1; + }, b.prototype.sW = function(m) { + this.yk[m] = null; + }, b.prototype.Ob = function(m) { + return this.dd.U(m, 3); + }, b.prototype.mv = function(m) { + return this.dd.U(m, 4); + }, b.prototype.I = function(m) { + return this.dd.U(m, 5); + }, b.prototype.ea = function(m) { + return this.dd.U(m, 6); + }, b.prototype.Ip = function(m, _, C) { + for (var D = 0, L = this.md; L != -1; L = this.ve(L)) { + var B = this.jc(L); + if (A.ba.Ic(B) && (!C || B == 1736)) { + B = this.jc(L) == 1736; + for (var q = this.Ob(L); q != -1; ) { + for (var Z = 0, ie = this.Ya(q); Z < A.P.truncate(this.Ka(q) / 2); ) { + var se = this.V(ie); + if (se == -1) + break; + var de = this.Va(ie), Ce = this.Uh(de); + Ce != null ? de = Ce.Rb() : (Ce = this.Va(se), de = this.wb.Ar(de, Ce)), de <= m ? (de == 0 ? D == 0 && (D = -1) : D = 1, se != this.tj(q) && (this.gC(se, ie), this.qd(se, !0))) : ie = this.V(ie), Z++; + } + for (Z = this.Ya(q), ie = this.ec(q) ? Z : this.tj(q); 0 < this.Ka(q); ) { + if ((se = this.Na(ie)) == -1) { + this.qd(ie, !0), D == 0 && (D = -1); + break; + } + var Ve = this.Va(se); + if ((Ce = this.Uh(Ve)) != null ? de = Ce.Rb() : (de = this.Va(ie), de = this.wb.Ar(de, Ve)), de <= m) + de == 0 ? D == 0 && (D = -1) : D = 1, this.gC(se, ie), this.qd(se, !1), Z == se && (Z = this.Ya(q)); + else if ((ie = this.Na(ie)) == Z) + break; + } + ie = this.Ka(q), _ && (B ? 3 > ie : 2 > ie) ? (q = this.ar(q), D = 0 < ie ? 1 : D == 0 ? -1 : D) : q = this.Sb(q); + } + } + } + return D; + }, b.prototype.gC = function(m, _) { + var C = this.Va(m), D = this.Va(_); + if (this.Ug != null && (C = this.Ug.read(C), this.Ug.write(D, C)), this.di != null) { + for (D = 0, C = this.di.length; D < C; D++) + if (this.di[D] != null) { + var L = this.Qa(m, D); + L != -1 && this.Sa(_, D, L); + } + } + }, b.prototype.Wl = function(m, _, C) { + var D = 0, L = this.V(m); + if (L == -1) + throw A.i.Ra(); + for (var B = this.Va(m), q = this.Va(L), Z = this.Uh(B), ie = Z == null ? this.wb.Ar(B, q) : Z.Rb(), se = 0; se < C; se++) { + var de = _[se]; + if (0 < de && 1 > de) { + var Ce = de; + Z != null && (Ce = 0 < ie ? Z.Tx(de) / ie : 0), this.wb.fD(B, q, Ce, this.pm()); + var Ve = this.yj(this.cd(m), L, this.pm()); + if (D++, Z != null) { + var Je = Z.fl(0, de); + Ce = this.Va(this.Na(Ve)), this.Zg(Ce, Je), this.mf(Ve, Je.xc()), se != C - 1 && _[se + 1] != 1 || (de = Z.fl(de, 1), this.Zg(Ce, de)); + } + } + } + return D; + }, b.prototype.HX = function(m, _, C) { + var D = 0, L = this.V(m); + if (L == -1) + throw A.i.ga("internal error"); + var B = this.Va(m), q = this.Va(L), Z = this.Uh(B), ie = Z == null ? this.wb.Ar(B, q) : Z.Rb(), se = 0; + m = this.cd(m); + for (var de = 0; de < C; de++) { + var Ce = _[de]; + if (se < Ce && 1 > Ce) { + var Ve = Ce; + if (Z != null && (Ve = 0 < ie ? Z.Tx(Ce) / ie : 0), this.wb.fD(B, q, Ve, this.pm()), Ve = this.tS(m, L, this.pm()), D++, Z != null) { + se = Z.fl(se, Ce); + var Je = this.Va(this.Na(Ve)); + this.Zg(Je, se), this.Db(Ve, se.qa, se.ma), de != C - 1 && _[de + 1] != 1 || (se = Z.fl(Ce, 1), Ve = this.Va(Ve), this.Zg(Ve, se)); + } + } + se = Ce; + } + return D; + }, b.prototype.tS = function(m, _, C) { + var D = _ != -1 ? this.Na(_) : this.tj(m), L = D != -1 ? this.V(D) : -1, B = this.jI(C == null ? this.gd : -1), q = this.Va(B); + return C != null && this.wb.It(q, C), this.cj(B, m), this.Cc(B, L), this.Dc(B, D), L != -1 && this.Dc(L, B), D != -1 && this.Cc(D, B), C = this.ec(m), D = this.Ya(m), _ == -1 && this.Yg(m, B), _ == D && (C && D != -1 || this.Kf(m, B)), C && L == -1 && (this.Cc(B, B), this.Dc(B, B)), this.Xj(m, this.Ka(m) + 1), m = this.Sf(m), this.Vj(m, this.I(m) + 1), B; + }, b.prototype.pE = function(m, _, C) { + var D = this.Va(_), L = this.Va(C); + if (0 > D || L > this.gd - 1) + throw A.i.O("invalid call"); + if (D > L && !this.ec(m)) + throw A.i.O("cannot iterate across an open path"); + for (m = 0; _ != C; _ = this.V(_)) + D = this.Va(_), (L = this.Uh(D)) != null ? m += L.Rb() : (L = this.Va(this.V(_)), m += this.wb.Ar(D, L)); + return m; + }, b.prototype.Fh = function(m, _) { + var C = this.Va(m); + this.wb.It(C, _), (C = this.Uh(C)) != null && C.setStart(_), (m = this.Na(m)) != -1 && (m = this.Va(m), this.Uh(m) != null && C.setEnd(_)); + }, b.prototype.Xi = function(m, _) { + m = this.Va(m), this.wb.we(m, _); + }, b.prototype.mf = function(m, _) { + this.Db(m, _.x, _.y); + }, b.prototype.Db = function(m, _, C) { + var D = this.Va(m); + this.wb.Db(D, _, C), (D = this.Uh(D)) != null && D.UB(_, C), (m = this.Na(m)) != -1 && (m = this.Va(m), this.Uh(m) != null && D.Sl(_, C)); + }, b.prototype.D = function(m, _) { + this.wb.D(this.ud.U(m, 0), _); + }, b.prototype.Hc = function(m, _) { + this.wb.Aa[0].uc(2 * this.ud.U(m, 0), _); + }, b.prototype.Oa = function(m) { + var _ = new A.h(); + return this.wb.D(this.ud.U(m, 0), _), _; + }, b.prototype.ZF = function(m, _) { + this.jt.uc(2 * m, _); + }, b.prototype.Vc = function(m, _, C) { + return this.wb.Vc(m, this.Va(_), C); + }, b.prototype.setAttribute = function(m, _, C, D) { + this.wb.setAttribute(m, this.Va(_), C, D); + }, b.prototype.Va = function(m) { + return this.ud.U(m, 0); + }, b.prototype.kh = function() { + var m = new A.h(); + return this.D(void 0, m), m.y; + }, b.prototype.hq = function(m, _) { + m = this.Va(m), _ = this.Va(_); + var C = this.wb.Aa[0].o; + return C[2 * m] === C[2 * _] && C[2 * m + 1] === C[2 * _ + 1]; + }, b.prototype.Fv = function(m, _) { + m = this.Va(m); + var C = this.wb.Aa[0].o; + return C[2 * m] === _.x && C[2 * m + 1] === _.y; + }, b.prototype.rX = function(m, _) { + if (1 > _ && (_ = 1), this.Ug == null) { + if (_ == 1) + return; + this.Ug = A.Zc.Fn(this.wb.I(), 1); + } + (m = this.Va(m)) >= this.Ug.size && this.Ug.resize(m + 1, 1), this.Ug.write(m, _); + }, b.prototype.YF = function(m) { + return m = this.Va(m), this.Ug == null || m >= this.Ug.size ? 1 : this.Ug.read(m); + }, b.prototype.Sa = function(m, _, C) { + _ = this.di[_], m = this.Va(m), _.size < this.wb.I() && _.resize(this.wb.I(), -1), _.write(m, C); + }, b.prototype.Qa = function(m, _) { + return (m = this.Va(m)) < (_ = this.di[_]).size ? _.read(m) : -1; + }, b.prototype.Hd = function() { + this.di == null && (this.di = []); + for (var m = 0; m < this.di.length; m++) + if (this.di[m] == null) + return this.di[m] = A.Zc.Qh(0, -1), m; + return this.di.push(A.Zc.Qh(0, -1)), this.di.length - 1; + }, b.prototype.Ud = function(m) { + this.di[m] = null; + }, b.prototype.cc = function(m) { + return this.Te != null ? (m = this.Va(m), this.Te[m]) : null; + }, b.prototype.fd = function(m, _) { + var C = this.ud.U(m, 2); + if (C == -1) + return !1; + if (this.aA) { + var D = new A.Ta(); + this.Xi(m, D), _.setStart(D), this.Xi(C, D), _.setEnd(D); + } else + this.wb.Hc(this.ud.U(m, 0), pe), _.gm(0, pe), this.wb.Hc(this.ud.U(C, 0), pe), _.gm(1, pe); + return !0; + }, b.prototype.hW = function(m, _, C) { + if (this.aA) { + var D = new A.Ta(); + this.Xi(m, D), C.setStart(D), this.Xi(_, D), C.setEnd(D); + } else + this.wb.Hc(m, pe), C.gm(0, pe), this.wb.Hc(_, pe), C.gm(1, pe); + }, b.prototype.wf = function(m, _) { + if (_ != -1) { + if (m != this.Sf(_)) + throw A.i.Ra(); + var C = this.es(_); + } else + C = this.mv(m); + var D = this.rU(m); + return _ != -1 && this.ep(_, D), this.cp(D, _), this.ep(D, C), C != -1 ? this.cp(C, D) : this.ap(m, D), _ == -1 && this.bp(m, D), this.Tl(m, this.ea(m) + 1), D; + }, b.prototype.iG = function(m, _, C, D) { + m = this.wf(m, -1); + for (var L = 0, B = _, q = !1; B == C && (q = !0), this.cj(B, m), L++, (B = this.V(B)) != _; ) + ; + return this.mn(m, !0), this.Xj(m, L), q && (_ = C), this.Kf(m, _), this.Yg(m, this.Na(_)), this.fp(m, !1), D != null && (D[0] = q), m; + }, b.prototype.ar = function(m) { + var _ = this.es(m), C = this.Sb(m), D = this.Sf(m); + return _ != -1 ? this.cp(_, C) : this.ap(D, C), C != -1 ? this.ep(C, _) : this.bp(D, _), this.vO(m), this.Tl(D, this.ea(D) - 1), this.nF(m), C; + }, b.prototype.vO = function(m) { + var _ = this.Ya(m); + if (_ != -1) { + for (var C = 0, D = this.Ka(m); C < D; C++) { + var L = _; + _ = this.V(_), this.Qy(L); + } + _ = this.Sf(m), this.Vj(_, this.I(_) - this.Ka(m)); + } + this.Xj(m, 0); + }, b.prototype.Sb = function(m) { + return this.nd.U(m, 2); + }, b.prototype.es = function(m) { + return this.nd.U(m, 1); + }, b.prototype.Ka = function(m) { + return this.nd.U(m, 3); + }, b.prototype.ec = function(m) { + return (1 & this.Up(m)) != 0; + }, b.prototype.mn = function(m, _) { + if (this.ec(m) != _) { + if (0 < this.Ka(m)) { + var C = this.Ya(m), D = this.tj(m); + _ ? (this.Cc(D, C), this.Dc(C, D), C = this.Va(D)) : (this.Cc(D, -1), this.Dc(C, -1), C = this.Va(D)), this.Zg(C, null); + } + this.QB(m, (1 | this.Up(m)) - 1 | (_ ? 1 : 0)); + } + }, b.prototype.Sf = function(m) { + return this.nd.U(m, 7); + }, b.prototype.TS = function(m) { + return (2 & this.Up(m)) != 0; + }, b.prototype.KB = function(m, _) { + this.QB(m, (2 | this.Up(m)) - 2 | (_ ? 2 : 0)); + }, b.prototype.qz = function(m) { + if (this.YS(m)) + return this.Qi.get(this.sv(m)); + var _ = new A.zb(), C = this.Ya(m); + if (C == -1) + return 0; + var D = new A.h(); + this.D(C, D); + for (var L = 0, B = 0, q = this.Ka(m); B < q; B++, C = this.V(C)) { + var Z = this.cc(C); + if (Z == null) { + if (!this.fd(C, _)) + continue; + Z = _; + } + L += Z.Sx(D.x, D.y); + } + return this.fp(m, !0), this.Qi.set(this.sv(m), L), L; + }, b.prototype.ir = function(m, _, C) { + _ = this.Ek[_], m = this.sv(m), _.size < this.Qi.size && _.resize(this.Qi.size, -1), _.write(m, C); + }, b.prototype.uj = function(m, _) { + return (m = this.sv(m)) < (_ = this.Ek[_]).size ? _.read(m) : -1; + }, b.prototype.Fy = function() { + this.Ek == null && (this.Ek = []); + for (var m = 0; m < this.Ek.length; m++) + if (this.Ek[m] == null) + return this.Ek[m] = A.Zc.Qh(0), m; + return this.Ek.push(A.Zc.Qh(0)), this.Ek.length - 1; + }, b.prototype.xB = function(m) { + this.Ek[m] = null; + }, b.prototype.UT = function(m, _, C) { + if (C == -1) + throw A.i.O(); + if (_ != C) { + var D = this.Sb(C), L = this.es(C), B = this.Sf(C); + L == -1 ? this.ap(B, D) : this.cp(L, D), D == -1 ? this.bp(B, L) : this.ep(D, L), this.Vj(B, this.I(B) - this.Ka(C)), this.Tl(B, this.ea(B) - 1), L = _ == -1 ? this.mv(m) : this.es(_), this.ep(C, L), this.cp(C, _), _ == -1 ? this.bp(m, C) : this.ep(_, C), L == -1 ? this.ap(m, C) : this.cp(L, C), this.Vj(m, this.I(m) + this.Ka(C)), this.Tl(m, this.ea(m) + 1), this.gx(C, m); + } + }, b.prototype.kj = function(m, _) { + this.wb.we(this.Va(_), this.pm()), this.yj(m, -1, this.pm()); + }, b.prototype.qd = function(m, _) { + var C = this.cd(m), D = this.Na(m), L = this.V(m); + D != -1 && this.Cc(D, L); + var B = this.Ka(C); + if (m == this.Ya(C) && this.Kf(C, 1 < B ? L : -1), L != -1 && this.Dc(L, D), m == this.tj(C) && this.Yg(C, 1 < B ? D : -1), D != -1 && L != -1) { + D = this.Va(D); + var q = this.Va(L); + _ ? (_ = this.Uh(D)) != null && (D = new A.h(), this.wb.D(q, D), _.Rc(D)) : (q = this.Va(m), _ = this.Uh(q), this.Zg(D, _), _ != null && (D = this.wb.Oa(D), _.Ec(D))); + } + return this.Xj(C, B - 1), C = this.Sf(C), this.Vj(C, this.I(C) - 1), this.Qy(m), L; + }, b.prototype.Ya = function(m) { + return this.nd.U(m, 4); + }, b.prototype.tj = function(m) { + return this.nd.U(m, 5); + }, b.prototype.V = function(m) { + return this.ud.U(m, 2); + }, b.prototype.Na = function(m) { + return this.ud.U(m, 1); + }, b.prototype.cd = function(m) { + return this.ud.U(m, 3); + }, b.prototype.hc = function(m, _) { + return this.yj(m, -1, _); + }, b.prototype.$q = function(m) { + if (m === void 0) + return this.$q(!1); + if (m instanceof T) + return new T(m); + var _, C = -1, D = -1, L = -1, B = 0, q = !1; + for (_ = this.md; _ != -1; _ = this.ve(_)) + if (!m || A.ba.Ic(this.jc(_))) { + for (C = this.Ob(_); C != -1; C = this.Sb(C)) + if (L = D = this.Ya(C), B = 0, D != -1) { + q = !0; + break; + } + if (q) + break; + } + return T.vP(this, _, C, D, L, B, m); + }, b.prototype.Pc = function(m) { + if (this.Kl.Pc(m), this.Te != null) + for (var _ = 0, C = this.Te.length; _ < C; _++) + this.Te[_] != null && this.Te[_].Pc(m); + }, b.prototype.lr = function(m, _, C, D) { + D ? this.JX(m, _, C) : this.IX(m, _, C); + }, b.prototype.Dc = function(m, _) { + this.ud.T(m, 1, _); + }, b.prototype.Cc = function(m, _) { + this.ud.T(m, 2, _); + }, b.prototype.cj = function(m, _) { + this.ud.T(m, 3, _); + }, b.prototype.Xj = function(m, _) { + this.nd.T(m, 3, _); + }, b.prototype.Kf = function(m, _) { + this.nd.T(m, 4, _); + }, b.prototype.Yg = function(m, _) { + this.nd.T(m, 5, _); + }, b.prototype.Tl = function(m, _) { + this.dd.T(m, 6, _); + }, b.prototype.Vj = function(m, _) { + this.dd.T(m, 5, _); + }, b.prototype.kJ = function(m) { + var _ = m; + do { + var C = this.V(_); + this.Cc(_, this.Na(_)), this.Dc(_, C), _ = C; + } while (_ != m); + }, b.prototype.XB = function(m) { + this.gd = m; + }, b.prototype.br = function(m) { + var _ = this.es(m), C = this.Sb(m), D = this.Sf(m); + _ != -1 ? this.cp(_, C) : this.ap(D, C), C != -1 ? this.ep(C, _) : this.bp(D, _), this.Kf(m, -1), this.Yg(m, -1), this.nF(m); + }, b.prototype.oi = function(m, _) { + var C = this.Na(m), D = this.V(m); + if (C != -1 && this.Cc(C, D), D != -1 && this.Dc(D, C), C != -1 && D != -1) + if (C = this.Va(C), D = this.Va(D), _) { + if ((_ = this.Uh(C)) != null) { + var L = new A.h(); + this.wb.D(D, L), _.Rc(L); + } + } else + _ = this.Va(m), _ = this.Uh(_), this.Zg(C, _), _ != null && (L = new A.h(), this.wb.D(C, L), _.Ec(L)); + this.Qy(m); + }, b.prototype.YS = function(m) { + return (4 & this.Up(m)) != 0; + }, b.prototype.fp = function(m, _) { + this.QB(m, (4 | this.Up(m)) - 4 | (_ ? 4 : 0)); + }, b.prototype.nx = function(m, _) { + var C = this.ud.o; + this.wb.oc(); + var D = this.wb.Aa[0].o; + m.Wd(0, _, function(L, B) { + var q = C[5 * L]; + L = C[5 * B], B = D[2 * q], q = D[2 * q + 1]; + var Z = D[2 * L]; + return q < (L = D[2 * L + 1]) ? -1 : q > L ? 1 : B < Z ? -1 : B > Z ? 1 : 0; + }); + }, b.prototype.eS = function() { + for (var m = this.md; m != -1; m = this.ve(m)) + if (!A.ba.Ic(this.jc(m))) + return !0; + return !1; + }, b.prototype.cC = function(m, _) { + for (var C = this.Ob(m), D = this.Ob(_), L = this.mv(m), B = this.mv(_), q = this.Ob(m); q != -1; q = this.Sb(q)) + this.gx(q, _); + for (q = this.Ob(_); q != -1; q = this.Sb(q)) + this.gx(q, m); + this.ap(m, D), this.ap(_, C), this.bp(m, B), this.bp(_, L), C = this.I(m), D = this.ea(m), L = this.ea(_), this.Vj(m, this.I(_)), this.Vj(_, C), this.Tl(m, L), this.Tl(_, D), C = this.dd.U(m, 2), this.dd.T(m, 2, this.dd.U(_, 2)), this.dd.T(_, 2, C); + }, b; + }(), A.hd = ve; + })(le || (le = {})), function(A) { + var ve = function(H) { + function T(b, m, _, C) { + var D = H.call(this) || this; + return D.aa = new A.l(), b === void 0 ? D.PE() : typeof b == "number" ? D.QO(b, m, _, C) : b instanceof A.Ta ? m !== void 0 ? D.Su(b, m, _) : D.RO(b) : b instanceof A.sa ? m !== void 0 ? D.TO(b, m) : D.SO(b) : b instanceof A.l ? D.PO(b) : D.PE(), D; + } + return Ne(T, H), T.prototype.Su = function(b, m, _) { + this.description = A.fe.pg(), this.aa.Pa(), b.B() || this.vu(b, m, _); + }, T.prototype.PO = function(b) { + this.description = A.fe.pg(), this.aa.L(b), this.aa.normalize(); + }, T.prototype.SO = function(b) { + if (b == null) + throw A.i.O(); + this.description = b, this.aa.Pa(); + }, T.prototype.TO = function(b, m) { + if (b == null) + throw A.i.O(); + this.description = b, this.aa.L(m), this.aa.normalize(); + }, T.prototype.PE = function() { + this.description = A.fe.pg(), this.aa.Pa(); + }, T.prototype.RO = function(b) { + this.description = A.fe.pg(), this.aa.Pa(), b.B() || this.vu(b); + }, T.prototype.QO = function(b, m, _, C) { + this.description = A.fe.pg(), this.L(b, m, _, C); + }, T.prototype.L = function(b, m, _, C) { + if (this.wc(), typeof b == "number") + this.aa.L(b, m, _, C); + else + for (this.Pa(), m = 0, _ = b.length; m < _; m++) + this.$b(b[m]); + }, T.prototype.Zo = function(b) { + if (this.wc(), !b.aT()) + throw A.i.O(); + this.aa.L(b); + }, T.prototype.Pa = function() { + this.wc(), this.aa.Pa(); + }, T.prototype.B = function() { + return this.aa.B(); + }, T.prototype.S = function() { + return this.aa.S(); + }, T.prototype.da = function() { + return this.aa.da(); + }, T.prototype.ik = function() { + return this.aa.ik(); + }, T.prototype.Lp = function() { + return this.aa.Lp(); + }, T.prototype.Kp = function() { + return this.aa.tf(); + }, T.prototype.$b = function(b) { + if (b instanceof A.h) + this.wc(), this.aa.$b(b); + else if (b instanceof A.l) + this.wc(), this.aa.$b(b); + else if (b instanceof A.Ta) { + if (this.wc(), !b.Bc()) { + var m = b.description; + if (this.description != m && this.Ll(m), this.B()) + this.vu(b); + else { + this.aa.$b(b.D()); + for (var _ = 1, C = m.Ba; _ < C; _++) + for (var D = m.Fd(_), L = A.sa.Wa(D), B = 0; B < L; B++) { + var q = b.Vc(D, B), Z = this.Vg(D, B); + Z.$b(q), this.setInterval(D, B, Z); + } + } + } + } else if (b instanceof T && !b.B()) + for ((m = b.description) != this.description && this.Ll(m), this.aa.$b(b.aa), _ = 1, C = m.Ba; _ < C; _++) + for (D = m.ld(_), L = A.sa.Wa(D), B = 0; B < L; B++) + q = b.Vg(D, B), (Z = this.Vg(D, B)).$b(q), this.setInterval(D, B, Z); + }, T.prototype.vu = function(b, m, _) { + if (m !== void 0) { + this.aa.L(b.D(), m, _), _ = 1; + for (var C = (m = b.description).Ba; _ < C; _++) + for (var D = m.Fd(_), L = A.sa.Wa(D), B = 0; B < L; B++) { + var q = b.Vc(D, B); + this.setInterval(D, B, q, q); + } + } else + for (this.aa.L(b.la[0], b.la[1]), _ = 1, C = (m = b.description).Ba; _ < C; _++) + for (D = m.Fd(_), L = A.sa.Wa(D), B = 0; B < L; B++) + q = b.Vc(D, B), this.setInterval(D, B, q, q); + }, T.prototype.setInterval = function(b, m, _, C) { + if (_ = typeof _ == "number" ? new A.Oc(_, C) : _, this.wc(), b == 0) + if (m == 0) + this.aa.v = _.pa, this.aa.C = _.wa; + else { + if (m != 1) + throw A.i.de(); + this.aa.G = _.pa, this.aa.H = _.wa; + } + else + this.qD(0, b, m, _.pa), this.qD(1, b, m, _.wa); + }, T.prototype.X = function(b, m) { + this.wc(), this.aa.X(b, m); + }, T.prototype.Pc = function(b) { + if (b instanceof A.Ed) + this.wc(), b.hC(this.aa); + else if (this.wc(), !this.aa.B()) { + var m = new A.JK(); + this.So(m), m.SS() ? m.Pa() : b.hC(m); + } + }, T.prototype.copyTo = function(b) { + if (b.K() != this.K()) + throw A.i.O(); + if (b.wc(), b.description = this.description, b.aa.L(this.aa), b.la = null, this.la != null) { + b.qu(); + for (var m = 0; m < 2 * (this.description.Be.length - 2); m++) + b.la[m] = this.la[m]; + } + }, T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.He = function() { + return this.aa.rF(); + }, T.prototype.Rb = function() { + return this.aa.tR(); + }, T.prototype.K = function() { + return 197; + }, T.prototype.Eb = function() { + return 2; + }, T.prototype.dn = function(b) { + this.copyTo(b); + }, T.prototype.A = function(b) { + b.v = this.aa.v, b.G = this.aa.G, b.C = this.aa.C, b.H = this.aa.H; + }, T.prototype.So = function(b) { + b.v = this.aa.v, b.G = this.aa.G, b.C = this.aa.C, b.H = this.aa.H, b.L(this.aa.v, this.aa.G, this.Pd(0, 1, 0), this.aa.C, this.aa.H, this.Pd(1, 1, 0)); + }, T.prototype.Vg = function(b, m) { + var _ = new A.Oc(); + return _.L(this.Pd(0, b, m), this.Pd(1, b, m)), _; + }, T.prototype.If = function(b, m) { + m.Pf(this.description); + var _ = this.description.Ba - 1; + switch (b) { + case 0: + for (b = 0; b < _; b++) + for (var C = this.description.ld(b), D = A.sa.Wa(C), L = 0; L < D; L++) + m.setAttribute(C, L, this.Pd(0, C, L)); + m.Db(this.aa.v, this.aa.G); + break; + case 1: + for (b = 0; b < _; b++) + for (C = this.description.ld(b), D = A.sa.Wa(C), L = 0; L < D; L++) + m.setAttribute(C, L, this.Pd(1, C, L)); + m.Db(this.aa.v, this.aa.H); + break; + case 2: + for (b = 0; b < _; b++) + for (C = this.description.ld(b), D = A.sa.Wa(C), L = 0; L < D; L++) + m.setAttribute(C, L, this.Pd(0, C, L)); + m.Db(this.aa.C, this.aa.H); + break; + case 3: + for (b = 0; b < _; b++) + for (C = this.description.ld(b), D = A.sa.Wa(C), L = 0; L < D; L++) + m.setAttribute(C, L, this.Pd(1, C, L)); + m.Db(this.aa.C, this.aa.G); + break; + default: + throw A.i.de(); + } + }, T.prototype.hB = function(b, m) { + b = this.aa.hB(b), m.na(b.x, b.y); + }, T.prototype.fR = function(b, m) { + return m * (b.Qq - 2); + }, T.prototype.sF = function(b, m, _) { + if (this.aa.B()) + throw A.i.ga("empty geometry"); + if (m == 0) + return b != 0 ? _ != 0 ? this.aa.H : this.aa.C : _ != 0 ? this.aa.G : this.aa.v; + if (_ >= A.sa.Wa(m)) + throw A.i.O(); + var C = this.description.Rf(m); + return this.qu(), 0 <= C ? this.la[this.fR(this.description, b) + this.description.GR(C) - 2 + _] : A.sa.te(m); + }, T.prototype.qu = function() { + if (this.wc(), this.la == null && 2 < this.description.Be.length) { + this.la = []; + for (var b = T.Ig(this.description, 0), m = T.Ig(this.description, 1), _ = 0, C = 1, D = this.description.Ba; C < D; C++) { + var L = this.description.ld(C), B = A.sa.Wa(L); + L = A.sa.te(L); + for (var q = 0; q < B; q++) + this.la[b + _] = L, this.la[m + _] = L, _++; + } + } + }, T.prototype.un = function(b) { + if (this.la != null) + if (2 < b.Be.length) { + for (var m = A.fe.Kw(b, this.description), _ = [], C = T.Ig(this.description, 0), D = T.Ig(this.description, 1), L = T.Ig(b, 0), B = T.Ig(b, 1), q = 0, Z = 1, ie = b.Ba; Z < ie; Z++) { + var se = b.ld(Z), de = A.sa.Wa(se); + if (m[Z] == -1) { + var Ce = A.sa.te(se); + for (se = 0; se < de; se++) + _[L + q] = Ce, _[B + q] = Ce, q++; + } else + for (Ce = this.description.bk(m[Z]) - 2, se = 0; se < de; se++) + _[L + q] = this.la[C + Ce], _[B + q] = this.la[D + Ce], q++, Ce++; + } + this.la = _; + } else + this.la = null; + this.description = b; + }, T.prototype.Pd = function(b, m, _) { + if (this.aa.B()) + throw A.i.ga("This operation was performed on an Empty Geometry."); + if (m == 0) + return b != 0 ? _ != 0 ? this.aa.H : this.aa.C : _ != 0 ? this.aa.G : this.aa.v; + if (_ >= A.sa.Wa(m)) + throw A.i.de(); + var C = this.description.Rf(m); + return 0 <= C ? (this.qu(), this.la[T.Ig(this.description, b) + this.description.bk(C) - 2 + _]) : A.sa.te(m); + }, T.prototype.qD = function(b, m, _, C) { + if (this.wc(), m == 0) + b != 0 ? _ != 0 ? this.aa.H = C : this.aa.C = C : _ != 0 ? this.aa.G = C : this.aa.v = C; + else { + if (_ >= A.sa.Wa(m)) + throw A.i.de(); + if (!this.hasAttribute(m)) { + if (A.sa.yG(m, C)) + return; + this.se(m); + } + m = this.description.Rf(m), this.qu(), this.la[T.Ig(this.description, b) + this.description.bk(m) - 2 + _] = C; + } + }, T.Ig = function(b, m) { + return m * (b.Be.length - 2); + }, T.prototype.Fa = function(b) { + this.wc(); + var m = new A.l(); + return b.A(m), this.aa.Fa(m); + }, T.prototype.isIntersecting = function(b) { + return b instanceof A.l ? this.aa.isIntersecting(b) : this.aa.isIntersecting(b.aa); + }, T.prototype.Lu = function(b, m) { + this.wc(), b.B() ? this.Pa() : m !== void 0 ? this.vu(b, m, void 0) : this.aa.Lu(b.Ng(), b.kh()); + }, T.prototype.offset = function(b, m) { + this.wc(), this.aa.offset(b, m); + }, T.prototype.normalize = function() { + this.wc(), this.aa.normalize(); + }, T.prototype.tf = function(b) { + if (b === void 0) { + if (b = new A.Ta(this.description), this.B()) + return b; + for (m = this.description.Ba, _ = 1; _ < m; _++) + for (C = this.description.Fd(_), D = A.sa.Wa(C), L = 0; L < D; L++) + B = 0.5 * (this.Pd(0, C, L) + this.Pd(1, C, L)), b.setAttribute(C, L, B); + return b.Db(this.aa.ik(), this.aa.Lp()), b; + } + if (b.Pf(this.description), this.B()) + b.Pa(); + else { + for (var m = this.description.Ba, _ = 1; _ < m; _++) + for (var C = this.description.ld(_), D = A.sa.Wa(C), L = 0; L < D; L++) { + var B = 0.5 * (this.sF(0, C, L) + this.sF(1, C, L)); + b.setAttribute(C, L, B); + } + b.Db(this.aa.tf()); + } + }, T.prototype.hz = function() { + return new A.Ta(this.aa.hz()); + }, T.prototype.contains = function(b) { + return b instanceof A.Ta ? !b.B() && this.aa.contains(b.Ng(), b.kh()) : this.aa.contains(b.aa); + }, T.prototype.ZO = function(b) { + return this.aa.contains(b); + }, T.prototype.Nb = function(b) { + if (b == this) + return !0; + if (!(b instanceof T) || this.description != b.description) + return !1; + if (this.B()) + return !!b.B(); + if (!this.aa.Nb(b.aa)) + return !1; + for (var m = 0, _ = 2 * (this.description.Be.length - 2); m < _; m++) + if (this.la[m] != b.la[m]) + return !1; + return !0; + }, T.prototype.dc = function() { + var b = this.description.dc(); + if (b = A.P.Vh(b, this.aa.dc()), !this.B() && this.la != null) + for (var m = 0, _ = 2 * (this.description.Be.length - 2); m < _; m++) + b = A.P.Vh(b, this.la[m]); + return b; + }, T.prototype.gs = function() { + return this.aa.v; + }, T.prototype.js = function() { + return this.aa.G; + }, T.prototype.fs = function() { + return this.aa.C; + }, T.prototype.hs = function() { + return this.aa.H; + }, T.prototype.ng = function() { + return A.si.im(this, null); + }, T.prototype.toString = function() { + return this.B() ? "Envelope: []" : "Envelope: [" + this.aa.v + ", " + this.aa.G + ", " + this.aa.C + ", " + this.aa.H + "]"; + }, T; + }(A.ba); + A.Hh = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _) { + T === void 0 ? this.Pa() : (this.v = T, this.G = b, this.C = m, this.H = _); + } + return H.construct = function(T, b, m, _) { + var C = new H(); + return C.v = T, C.G = b, C.C = m, C.H = _, C; + }, H.prototype.L = function(T, b, m, _) { + typeof T == "number" ? m !== void 0 ? (this.v = T, this.G = b, this.C = m, this.H = _, this.normalize()) : (this.v = T, this.G = b, this.C = T, this.H = b) : T instanceof A.h ? b !== void 0 ? (this.v = T.x - 0.5 * b, this.C = this.v + b, this.G = T.y - 0.5 * m, this.H = this.G + m, this.normalize()) : (this.v = T.x, this.G = T.y, this.C = T.x, this.H = T.y) : T instanceof H ? this.L(T.v, T.G, T.C, T.H) : T instanceof A.Oc && (T.B() || b.B() ? this.Pa() : (this.v = T.pa, this.C = T.wa, this.G = b.pa, this.H = b.wa)); + }, H.prototype.bx = function(T, b) { + if (b !== void 0) + if (b == 0) + this.Pa(); + else { + this.v = T[0].x, this.G = T[0].y, this.C = this.v, this.H = this.G; + for (var m = 1; m < b; m++) { + var _ = T[m]; + _.x < this.v ? this.v = _.x : _.x > this.C && (this.C = _.x), _.y < this.G ? this.G = _.y : _.y > this.H && (this.H = _.y); + } + } + else if (T == null || T.length == 0) + this.Pa(); + else + for (_ = T[0], this.L(_.x, _.y), m = 1; m < T.length; m++) + b = T[m], this.Nk(b.x, b.y); + }, H.prototype.Pa = function() { + this.H = this.C = this.G = this.v = NaN; + }, H.prototype.B = function() { + return isNaN(this.v); + }, H.prototype.$b = function(T, b) { + typeof T == "number" ? this.B() ? (this.v = T, this.G = b, this.C = T, this.H = b) : (this.v > T ? this.v = T : this.C < T && (this.C = T), this.G > b ? this.G = b : this.H < b && (this.H = b)) : T instanceof A.h || T instanceof A.Od ? this.$b(T.x, T.y) : T instanceof H && !T.B() && (this.$b(T.v, T.G), this.$b(T.C, T.H)); + }, H.prototype.Nk = function(T, b) { + this.v > T ? this.v = T : this.C < T && (this.C = T), this.G > b ? this.G = b : this.H < b && (this.H = b); + }, H.prototype.X = function(T, b) { + this.B() || (this.v -= T, this.C += T, this.G -= b, this.H += b, (this.v > this.C || this.G > this.H) && this.Pa()); + }, H.prototype.scale = function(T) { + 0 > T && this.Pa(), this.B() || (this.v *= T, this.C *= T, this.G *= T, this.H *= T); + }, H.prototype.zoom = function(T, b) { + this.B() || this.L(this.tf(), T * this.S(), b * this.da()); + }, H.prototype.isIntersecting = function(T) { + return !this.B() && !T.B() && (this.v <= T.v ? this.C >= T.v : T.C >= this.v) && (this.G <= T.G ? this.H >= T.G : T.H >= this.G); + }, H.prototype.CG = function(T) { + return (this.v <= T.v ? this.C >= T.v : T.C >= this.v) && (this.G <= T.G ? this.H >= T.G : T.H >= this.G); + }, H.prototype.Fa = function(T) { + return !this.B() && !T.B() && (T.v > this.v && (this.v = T.v), T.C < this.C && (this.C = T.C), T.G > this.G && (this.G = T.G), T.H < this.H && (this.H = T.H), (T = this.v <= this.C && this.G <= this.H) || this.Pa(), T); + }, H.prototype.hB = function(T) { + switch (T) { + case 0: + return A.h.construct(this.v, this.G); + case 1: + return A.h.construct(this.v, this.H); + case 2: + return A.h.construct(this.C, this.H); + case 3: + return A.h.construct(this.C, this.G); + default: + throw A.i.de(); + } + }, H.prototype.iB = function(T) { + if (T == null || 4 > T.length) + throw A.i.O(); + T[0] != null ? T[0].na(this.v, this.G) : T[0] = A.h.construct(this.v, this.G), T[1] != null ? T[1].na(this.v, this.H) : T[1] = A.h.construct(this.v, this.H), T[2] != null ? T[2].na(this.C, this.H) : T[2] = A.h.construct(this.C, this.H), T[3] != null ? T[3].na(this.C, this.G) : T[3] = A.h.construct(this.C, this.G); + }, H.prototype.rF = function() { + return this.B() ? 0 : this.S() * this.da(); + }, H.prototype.tR = function() { + return this.B() ? 0 : 2 * (this.S() + this.da()); + }, H.prototype.ik = function() { + return (this.C + this.v) / 2; + }, H.prototype.Lp = function() { + return (this.H + this.G) / 2; + }, H.prototype.S = function() { + return this.C - this.v; + }, H.prototype.da = function() { + return this.H - this.G; + }, H.prototype.move = function(T, b) { + this.B() || (this.v += T, this.G += b, this.C += T, this.H += b); + }, H.prototype.Lu = function(T, b) { + if (b !== void 0) + this.move(T - this.ik(), b - this.Lp()); + else if (T instanceof A.h) + this.Lu(T.x, T.y); + else { + if (!(T instanceof A.Ta)) + throw A.i.O(); + b = (this.C - this.v) / 2; + var m = (this.H - this.G) / 2; + this.v = T.Ng() - b, this.C = T.Ng() + b, this.G = T.kh() - m, this.H = T.kh() + m; + } + }, H.prototype.offset = function(T, b) { + this.v += T, this.C += T, this.G += b, this.H += b; + }, H.prototype.normalize = function() { + if (!this.B()) { + var T = Math.min(this.v, this.C), b = Math.max(this.v, this.C); + this.v = T, this.C = b, T = Math.min(this.G, this.H), b = Math.max(this.G, this.H), this.G = T, this.H = b; + } + }, H.prototype.fn = function(T) { + T.na(this.v, this.G); + }, H.prototype.VI = function(T) { + T.na(this.C, this.G); + }, H.prototype.YI = function(T) { + T.na(this.v, this.H); + }, H.prototype.gn = function(T) { + T.na(this.C, this.H); + }, H.prototype.aT = function() { + return this.B() || this.v <= this.C && this.G <= this.H; + }, H.prototype.tf = function() { + return A.h.construct((this.C + this.v) / 2, (this.H + this.G) / 2); + }, H.prototype.hz = function() { + return A.h.construct(this.v, this.G); + }, H.prototype.contains = function(T, b) { + if (b !== void 0) + return T >= this.v && T <= this.C && b >= this.G && b <= this.H; + if (T instanceof A.Ta) + return this.contains(T.Ng(), T.kh()); + if (T instanceof A.h) + return this.contains(T.x, T.y); + if (T instanceof H) + return T.v >= this.v && T.C <= this.C && T.G >= this.G && T.H <= this.H; + throw A.i.O(); + }, H.prototype.jm = function(T, b) { + if (b !== void 0) + return T > this.v && T < this.C && b > this.G && b < this.H; + if (T instanceof A.h) + return this.jm(T.x, T.y); + if (T instanceof H) + return T.v > this.v && T.C < this.C && T.G > this.G && T.H < this.H; + throw A.i.O(); + }, H.prototype.Nb = function(T) { + return T == this || T instanceof H && (!(!this.B() || !T.B()) || this.v == T.v && this.G == T.G && this.C == T.C && this.H == T.H); + }, H.prototype.dc = function() { + var T = this.v; + T = A.P.truncate(T ^ T >>> 32); + var b = A.P.Vh(T); + return T = this.C, T = A.P.truncate(T ^ T >>> 32), b = A.P.Vh(T, b), T = this.G, T = A.P.truncate(T ^ T >>> 32), b = A.P.Vh(T, b), T = this.H, T = A.P.truncate(T ^ T >>> 32), A.P.Vh(T, b); + }, H.prototype.zr = function() { + return this.B() ? 2220446049250313e-29 : 2220446049250313e-29 * (Math.abs(this.v) + Math.abs(this.C) + Math.abs(this.G) + Math.abs(this.H) + 1); + }, H.prototype.uy = function(T, b) { + var m = this.ak(T), _ = this.ak(b); + if (m & _) + return 0; + if (!(m | _)) + return 4; + var C = (m != 0 ? 1 : 0) | (_ != 0 ? 2 : 0); + do { + var D = b.x - T.x, L = b.y - T.y; + if (D > L ? m & H.TC ? (m & H.lu ? (T.y += L * (this.v - T.x) / D, T.x = this.v) : (T.y += L * (this.C - T.x) / D, T.x = this.C), m = this.ak(T)) : _ & H.TC ? (_ & H.lu ? (b.y += L * (this.v - b.x) / D, b.x = this.v) : (b.y += L * (this.C - b.x) / D, b.x = this.C), _ = this.ak(b)) : m != 0 ? (m & H.mu ? (T.x += D * (this.G - T.y) / L, T.y = this.G) : (T.x += D * (this.H - T.y) / L, T.y = this.H), m = this.ak(T)) : (_ & H.mu ? (b.x += D * (this.G - b.y) / L, b.y = this.G) : (b.x += D * (this.H - b.y) / L, b.y = this.H), _ = this.ak(b)) : m & H.UC ? (m & H.mu ? (T.x += D * (this.G - T.y) / L, T.y = this.G) : (T.x += D * (this.H - T.y) / L, T.y = this.H), m = this.ak(T)) : _ & H.UC ? (_ & H.mu ? (b.x += D * (this.G - b.y) / L, b.y = this.G) : (b.x += D * (this.H - b.y) / L, b.y = this.H), _ = this.ak(b)) : m != 0 ? (m & H.lu ? (T.y += L * (this.v - T.x) / D, T.x = this.v) : (T.y += L * (this.C - T.x) / D, T.x = this.C), m = this.ak(T)) : (_ & H.lu ? (b.y += L * (this.v - b.x) / D, b.x = this.v) : (b.y += L * (this.C - b.x) / D, b.x = this.C), _ = this.ak(b)), (m & _) != 0) + return 0; + } while (m | _); + return C; + }, H.prototype.ak = function(T) { + return (T.x < this.v ? 1 : 0) | (T.x > this.C ? 1 : 0) << 1 | (T.y < this.G ? 1 : 0) << 2 | (T.y > this.H ? 1 : 0) << 3; + }, H.prototype.Di = function(T) { + return !this.B() && (this.S() <= T || this.da() <= T); + }, H.prototype.ub = function(T) { + return T instanceof A.h ? Math.sqrt(this.dK(T)) : Math.sqrt(this.px(T)); + }, H.prototype.px = function(T) { + var b = 0, m = 0, _ = this.v - T.C; + return _ > b && (b = _), (_ = this.G - T.H) > m && (m = _), (_ = T.v - this.C) > b && (b = _), (_ = T.G - this.H) > m && (m = _), b * b + m * m; + }, H.prototype.dK = function(T) { + var b = 0, m = 0, _ = this.v - T.x; + return _ > b && (b = _), (_ = this.G - T.y) > m && (m = _), (_ = T.x - this.C) > b && (b = _), (_ = T.y - this.H) > m && (m = _), b * b + m * m; + }, H.prototype.en = function(T) { + this.B() ? T.Pa() : T.L(this.v, this.C); + }, H.lu = 1, H.mu = 4, H.TC = 3, H.UC = 12, H; + }(); + A.l = ve; + }(le || (le = {})), function(A) { + var ve, H; + (H = ve || (ve = {}))[H.initialize = 0] = "initialize", H[H.initializeRed = 1] = "initializeRed", H[H.initializeBlue = 2] = "initializeBlue", H[H.initializeRedBlue = 3] = "initializeRedBlue", H[H.sweep = 4] = "sweep", H[H.sweepBruteForce = 5] = "sweepBruteForce", H[H.sweepRedBlueBruteForce = 6] = "sweepRedBlueBruteForce", H[H.sweepRedBlue = 7] = "sweepRedBlue", H[H.sweepRed = 8] = "sweepRed", H[H.sweepBlue = 9] = "sweepBlue", H[H.iterate = 10] = "iterate", H[H.iterateRed = 11] = "iterateRed", H[H.iterateBlue = 12] = "iterateBlue", H[H.iterateBruteForce = 13] = "iterateBruteForce", H[H.iterateRedBlueBruteForce = 14] = "iterateRedBlueBruteForce", H[H.resetRed = 15] = "resetRed", H[H.resetBlue = 16] = "resetBlue"; + var T = function() { + function b(m, _) { + this.ei = m, this.ZG = _; + } + return b.prototype.qr = function(m, _, C) { + this.ei.FX(C, m, _, this.ZG); + }, b.prototype.bq = function(m) { + return this.ei.Tr(m, this.ZG); + }, b; + }(); + ve = function() { + function b() { + this.qw = this.qo = this.ff = this.sd = null, this.yq = new A.l(), this.Cm = this.Jj = this.Kj = this.Bd = this.Ff = this.Md = this.ew = this.io = this.rd = this.Fb = null, this.Yb = -1, this.ra = 0, this.Pk(); + } + return b.prototype.mr = function() { + this.Pk(), this.Rv = !0, this.Fb == null ? (this.io = new A.ja(0), this.Fb = []) : (this.io.Dh(0), this.Fb.length = 0); + }, b.prototype.bd = function(m, _) { + if (!this.Rv) + throw A.i.Hb(); + var C = new A.l(); + C.L(_), this.io.add(m), this.Fb.push(C); + }, b.prototype.Hp = function() { + if (!this.Rv) + throw A.i.Hb(); + this.Rv = !1, this.Fb != null && 0 < this.Fb.length && (this.Yb = 0, this.Jc = !1); + }, b.prototype.kK = function() { + this.Pk(), this.Qv = !0, this.Fb == null ? (this.io = new A.ja(0), this.Fb = []) : (this.io.Dh(0), this.Fb.length = 0); + }, b.prototype.DD = function(m, _) { + if (!this.Qv) + throw A.i.Hb(); + var C = new A.l(); + C.L(_), this.io.add(m), this.Fb.push(C); + }, b.prototype.dF = function() { + if (!this.Qv) + throw A.i.Hb(); + this.Qv = !1, this.Fb != null && 0 < this.Fb.length && this.rd != null && 0 < this.rd.length && (this.Yb == -1 || this.Yb == 2 ? this.Yb = 3 : this.Yb != 3 && (this.Yb = 1), this.Jc = !1); + }, b.prototype.jK = function() { + this.Pk(), this.Pv = !0, this.rd == null ? (this.ew = new A.ja(0), this.rd = []) : (this.ew.Dh(0), this.rd.length = 0); + }, b.prototype.zD = function(m, _) { + if (!this.Pv) + throw A.i.Hb(); + var C = new A.l(); + C.L(_), this.ew.add(m), this.rd.push(C); + }, b.prototype.cF = function() { + if (!this.Pv) + throw A.i.Hb(); + this.Pv = !1, this.Fb != null && 0 < this.Fb.length && this.rd != null && 0 < this.rd.length && (this.Yb == -1 || this.Yb == 1 ? this.Yb = 3 : this.Yb != 3 && (this.Yb = 2), this.Jc = !1); + }, b.prototype.next = function() { + if (this.Jc) + return !1; + for (var m = !0; m; ) + switch (this.Yb) { + case 0: + m = this.Bz(); + break; + case 1: + m = this.mS(); + break; + case 2: + m = this.jS(); + break; + case 3: + m = this.lS(); + break; + case 4: + m = this.QX(); + break; + case 5: + m = this.MX(); + break; + case 6: + m = this.NX(); + break; + case 7: + m = this.OX(); + break; + case 8: + m = this.tx(); + break; + case 9: + m = this.dC(); + break; + case 10: + m = this.Pz(); + break; + case 11: + m = this.eT(); + break; + case 12: + m = this.bT(); + break; + case 13: + m = this.cT(); + break; + case 14: + m = this.dT(); + break; + case 15: + m = this.fJ(); + break; + case 16: + m = this.eJ(); + break; + default: + throw A.i.Ra(); + } + return !this.Jc; + }, b.prototype.WB = function(m) { + this.ra = m; + }, b.prototype.oz = function(m) { + return this.Fb[m]; + }, b.prototype.Wy = function(m) { + return this.rd[m]; + }, b.prototype.pl = function(m) { + return this.io.read(m); + }, b.prototype.jl = function(m) { + return this.ew.read(m); + }, b.Oz = function(m) { + return (1 & m) == 1; + }, b.gq = function(m) { + return (1 & m) == 0; + }, b.prototype.Pk = function() { + this.Rv = this.Pv = this.Qv = !1, this.Df = this.Ef = this.Tg = this.qe = -1, this.Jc = !0; + }, b.prototype.Bz = function() { + if (this.Bf = this.Xf = -1, 10 > this.Fb.length) + return this.qe = this.Fb.length, this.Yb = 5, !0; + this.sd == null && (this.sd = new A.ur(!0), this.qo = this.sd.getIterator(), this.Md = new A.ja(0)), this.sd.mr(); + for (var m = 0; m < this.Fb.length; m++) { + var _ = this.Fb[m]; + this.sd.Dr(_.v, _.C); + } + for (this.sd.Hp(), this.Md.Jb(2 * this.Fb.length), this.Md.resize(0), m = 0; m < 2 * this.Fb.length; m++) + this.Md.add(m); + return this.Mt(this.Md, 2 * this.Fb.length, !0), this.qe = 2 * this.Fb.length, this.Yb = 4, !0; + }, b.prototype.mS = function() { + if (this.Bf = this.Xf = -1, 10 > this.Fb.length || 10 > this.rd.length) + return this.qe = this.Fb.length, this.Yb = 6, !0; + this.sd == null && (this.sd = new A.ur(!0), this.qo = this.sd.getIterator(), this.Md = new A.ja(0)), this.sd.mr(); + for (var m = 0; m < this.Fb.length; m++) { + var _ = this.Fb[m]; + this.sd.Dr(_.v, _.C); + } + for (this.sd.Hp(), this.Md.Jb(2 * this.Fb.length), this.Md.resize(0), m = 0; m < 2 * this.Fb.length; m++) + this.Md.add(m); + return this.Mt(this.Md, this.Md.size, !0), this.qe = this.Md.size, this.Ef != -1 && (this.Bd.eh(this.Ef), this.Kj.resize(0), this.Ef = -1), this.Yb = 7, this.eJ(); + }, b.prototype.jS = function() { + if (this.Bf = this.Xf = -1, 10 > this.Fb.length || 10 > this.rd.length) + return this.qe = this.Fb.length, this.Yb = 6, !0; + this.ff == null && (this.ff = new A.ur(!0), this.qw = this.ff.getIterator(), this.Ff = new A.ja(0)), this.ff.mr(); + for (var m = 0; m < this.rd.length; m++) { + var _ = this.rd[m]; + this.ff.Dr(_.v, _.C); + } + for (this.ff.Hp(), this.Ff.Jb(2 * this.rd.length), this.Ff.resize(0), m = 0; m < 2 * this.rd.length; m++) + this.Ff.add(m); + return this.Mt(this.Ff, this.Ff.size, !1), this.Tg = this.Ff.size, this.Df != -1 && (this.Bd.eh(this.Df), this.Jj.resize(0), this.Df = -1), this.Yb = 7, this.fJ(); + }, b.prototype.lS = function() { + if (this.Bf = this.Xf = -1, 10 > this.Fb.length || 10 > this.rd.length) + return this.qe = this.Fb.length, this.Yb = 6, !0; + this.sd == null && (this.sd = new A.ur(!0), this.qo = this.sd.getIterator(), this.Md = new A.ja(0)), this.ff == null && (this.ff = new A.ur(!0), this.qw = this.ff.getIterator(), this.Ff = new A.ja(0)), this.sd.mr(); + for (var m = 0; m < this.Fb.length; m++) { + var _ = this.Fb[m]; + this.sd.Dr(_.v, _.C); + } + for (this.sd.Hp(), this.ff.mr(), m = 0; m < this.rd.length; m++) + _ = this.rd[m], this.ff.Dr(_.v, _.C); + for (this.ff.Hp(), this.Md.Jb(2 * this.Fb.length), this.Ff.Jb(2 * this.rd.length), this.Md.resize(0), this.Ff.resize(0), m = 0; m < 2 * this.Fb.length; m++) + this.Md.add(m); + for (m = 0; m < 2 * this.rd.length; m++) + this.Ff.add(m); + return this.Mt(this.Md, this.Md.size, !0), this.Mt(this.Ff, this.Ff.size, !1), this.qe = this.Md.size, this.Tg = this.Ff.size, this.Ef != -1 && (this.Bd.eh(this.Ef), this.Kj.resize(0), this.Ef = -1), this.Df != -1 && (this.Bd.eh(this.Df), this.Jj.resize(0), this.Df = -1), this.Yb = 7, !0; + }, b.prototype.QX = function() { + var m = this.Md.get(--this.qe), _ = m >> 1; + return b.gq(m) ? (this.sd.remove(_), this.qe != 0 || (this.Bf = this.Xf = -1, this.Jc = !0, !1)) : (this.qo.zB(this.Fb[_].v, this.Fb[_].C, this.ra), this.Xf = _, this.Yb = 10, !0); + }, b.prototype.MX = function() { + return --this.qe == -1 ? (this.Bf = this.Xf = -1, this.Jc = !0, !1) : (this.Tg = this.Xf = this.qe, this.Yb = 13, !0); + }, b.prototype.NX = function() { + return --this.qe == -1 ? (this.Bf = this.Xf = -1, this.Jc = !0, !1) : (this.Xf = this.qe, this.Tg = this.rd.length, this.Yb = 14, !0); + }, b.prototype.OX = function() { + var m = this.Md.get(this.qe - 1), _ = this.Ff.get(this.Tg - 1), C = this.Tr(m, !0), D = this.Tr(_, !1); + return C > D ? this.tx() : C < D ? this.dC() : b.Oz(m) ? this.tx() : b.Oz(_) ? this.dC() : this.tx(); + }, b.prototype.tx = function() { + var m = this.Md.get(--this.qe), _ = m >> 1; + if (b.gq(m)) + return this.Ef != -1 && this.Kj.get(_) != -1 ? (this.Bd.kd(this.Ef, this.Kj.get(_)), this.Kj.set(_, -1)) : this.sd.remove(_), this.qe != 0 || (this.Bf = this.Xf = -1, this.Jc = !0, !1); + if (this.Df != -1 && 0 < this.Bd.ds(this.Df)) + for (m = this.Bd.sc(this.Df); m != -1; ) { + var C = this.Bd.getData(m); + this.ff.xj(C), this.Jj.set(C, -1), C = this.Bd.lb(m), this.Bd.kd(this.Df, m), m = C; + } + return 0 < this.ff.size() ? (this.qw.zB(this.Fb[_].v, this.Fb[_].C, this.ra), this.Xf = _, this.Yb = 12) : (this.Ef == -1 && (this.Bd == null && (this.Bd = new A.lp()), this.Kj = new A.ja(0), this.Kj.resize(this.Fb.length, -1), this.Kj.Yj(-1, 0, this.Fb.length), this.Ef = this.Bd.Rh(1)), this.Kj.set(_, this.Bd.addElement(this.Ef, _)), this.Yb = 7), !0; + }, b.prototype.dC = function() { + var m = this.Ff.get(--this.Tg), _ = m >> 1; + if (b.gq(m)) + return this.Df != -1 && this.Jj.get(_) != -1 ? (this.Bd.kd(this.Df, this.Jj.get(_)), this.Jj.set(_, -1)) : this.ff.remove(_), this.Tg != 0 || (this.Bf = this.Xf = -1, this.Jc = !0, !1); + if (this.Ef != -1 && 0 < this.Bd.ds(this.Ef)) + for (m = this.Bd.sc(this.Ef); m != -1; ) { + var C = this.Bd.getData(m); + this.sd.xj(C), this.Kj.set(C, -1), C = this.Bd.lb(m), this.Bd.kd(this.Ef, m), m = C; + } + return 0 < this.sd.size() ? (this.qo.zB(this.rd[_].v, this.rd[_].C, this.ra), this.Bf = _, this.Yb = 11) : (this.Df == -1 && (this.Bd == null && (this.Bd = new A.lp()), this.Jj = new A.ja(0), this.Jj.resize(this.rd.length, -1), this.Jj.Yj(-1, 0, this.rd.length), this.Df = this.Bd.Rh(0)), this.Jj.set(_, this.Bd.addElement(this.Df, _)), this.Yb = 7), !0; + }, b.prototype.Pz = function() { + if (this.Bf = this.qo.next(), this.Bf != -1) + return !1; + var m = this.Md.get(this.qe) >> 1; + return this.sd.xj(m), this.Yb = 4, !0; + }, b.prototype.eT = function() { + if (this.Xf = this.qo.next(), this.Xf != -1) + return !1; + this.Bf = this.Xf = -1; + var m = this.Ff.get(this.Tg) >> 1; + return this.ff.xj(m), this.Yb = 7, !0; + }, b.prototype.bT = function() { + if (this.Bf = this.qw.next(), this.Bf != -1) + return !1; + var m = this.Md.get(this.qe) >> 1; + return this.sd.xj(m), this.Yb = 7, !0; + }, b.prototype.cT = function() { + if (--this.Tg == -1) + return this.Yb = 5, !0; + this.yq.L(this.Fb[this.qe]); + var m = this.Fb[this.Tg]; + return this.yq.X(this.ra, this.ra), !this.yq.isIntersecting(m) || (this.Bf = this.Tg, !1); + }, b.prototype.dT = function() { + if (--this.Tg == -1) + return this.Yb = 6, !0; + this.yq.L(this.Fb[this.qe]); + var m = this.rd[this.Tg]; + return this.yq.X(this.ra, this.ra), !this.yq.isIntersecting(m) || (this.Bf = this.Tg, !1); + }, b.prototype.fJ = function() { + return this.sd == null ? (this.Jc = !0, !1) : (this.qe = this.Md.size, 0 < this.sd.size() && this.sd.reset(), this.Ef != -1 && (this.Bd.eh(this.Ef), this.Kj.resize(0), this.Ef = -1), this.Jc = !1, !0); + }, b.prototype.eJ = function() { + return this.ff == null ? (this.Jc = !0, !1) : (this.Tg = this.Ff.size, 0 < this.ff.size() && this.ff.reset(), this.Df != -1 && (this.Bd.eh(this.Df), this.Jj.resize(0), this.Df = -1), this.Jc = !1, !0); + }, b.prototype.Mt = function(m, _, C) { + this.Cm == null && (this.Cm = new A.Zt()), C = new T(this, C), this.Cm.sort(m, 0, _, C); + }, b.prototype.FX = function(m, _, C, D) { + var L = this; + m.Wd(_, C, function(B, q) { + var Z = L.Tr(B, D), ie = L.Tr(q, D); + return Z < ie || Z == ie && b.gq(B) && b.Oz(q) ? -1 : 1; + }); + }, b.prototype.Tr = function(m, _) { + var C = 0.5 * this.ra; + return _ ? (_ = this.Fb[m >> 1], b.gq(m) ? _.G - C : _.H + C) : (_ = this.rd[m >> 1], b.gq(m) ? _.G - C : _.H + C); + }, b; + }(), A.sC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.construct = function(T, b, m, _, C, D) { + var L = new H(); + return L.v = T, L.G = b, L.Xe = m, L.C = _, L.H = C, L.Dg = D, L; + }, H.prototype.Pa = function() { + this.Xe = this.v = NaN; + }, H.prototype.B = function() { + return isNaN(this.v); + }, H.prototype.SS = function() { + return isNaN(this.Xe); + }, H.prototype.L = function(T, b, m, _, C, D) { + _ !== void 0 ? typeof T == "number" ? (this.v = T, this.G = b, this.Xe = m, this.C = _, this.H = C, this.Dg = D) : (this.v = T.x - 0.5 * b, this.C = this.v + b, this.G = T.y - 0.5 * m, this.H = this.G + m, this.Xe = T.z - 0.5 * _, this.Dg = this.Xe + _) : (this.v = T, this.G = b, this.Xe = m, this.C = T, this.H = b, this.Dg = m); + }, H.prototype.move = function(T) { + this.v += T.x, this.G += T.y, this.Xe += T.z, this.C += T.x, this.H += T.y, this.Dg += T.z; + }, H.prototype.copyTo = function(T) { + T.v = this.v, T.G = this.G, T.C = this.C, T.H = this.H; + }, H.prototype.Nk = function(T, b, m) { + this.v > T ? this.v = T : this.C < T && (this.C = T), this.G > b ? this.G = b : this.H < b && (this.H = b), isNaN(this.Xe) == 0 ? this.Xe > m ? this.Xe = m : this.Dg < m && (this.Dg = m) : this.Dg = this.Xe = m; + }, H.prototype.$b = function(T, b, m) { + if (typeof T == "number") + this.B() ? (this.v = T, this.G = b, this.Xe = m, this.C = T, this.H = b, this.Dg = m) : this.Nk(T, b, m); + else if (T instanceof A.Od) + this.$b(T.x, T.y, T.z); + else { + if (!(T instanceof H)) + throw A.i.O(); + T.B() || (this.$b(T.v, T.G, T.Xe), this.$b(T.C, T.H, T.Dg)); + } + }, H.prototype.construct = function(T, b, m) { + T.B() || b.B() ? this.Pa() : (this.v = T.pa, this.C = T.wa, this.G = b.pa, this.H = b.wa, this.Xe = m.pa, this.Dg = m.wa); + }, H.prototype.iB = function(T) { + if (T == null || 8 > T.length) + throw A.i.O(); + T[0] = new A.Od(this.v, this.G, this.Xe), T[1] = new A.Od(this.v, this.H, this.Xe), T[2] = new A.Od(this.C, this.H, this.Xe), T[3] = new A.Od(this.C, this.G, this.Xe), T[4] = new A.Od(this.v, this.G, this.Dg), T[5] = new A.Od(this.v, this.H, this.Dg), T[6] = new A.Od(this.C, this.H, this.Dg), T[7] = new A.Od(this.C, this.G, this.Dg); + }, H.prototype.bx = function(T) { + if (T == null || T.length == 0) + this.Pa(); + else { + var b = T[0]; + for (this.L(b.x, b.y, b.z), b = 1; b < T.length; b++) { + var m = T[b]; + this.Nk(m.x, m.y, m.z); + } + } + }, H; + }(); + A.JK = ve; + }(le || (le = {})), function(A) { + (function(ve) { + ve.Ra = function() { + var H = Error(); + return H.message = "Internal Error", H; + }, ve.Fe = function() { + var H = Error(); + return H.message = "Not Implemented", H; + }, ve.Zk = function() { + var H = Error(); + return H.message = "The input unit and the spatial reference unit are not of the same unit type.ie Linear vs.Angular", H; + }, ve.Hb = function() { + var H = Error(); + return H.message = "Invalid Call", H; + }, ve.O = function(H) { + var T = Error(); + return T.message = "Illegal Argument Exception", H !== void 0 && (T.message += ": " + H), T; + }, ve.hu = function(H) { + var T = Error(); + return T.message = H !== void 0 ? "Runtime Exception: " + H : "Runtime Exception.", T; + }, ve.ga = function(H) { + var T = Error(); + return T.message = "Geometry Exception: " + H, T; + }, ve.BK = function() { + var H = Error(); + return H.message = "Assert Failed Exception", H; + }, ve.de = function() { + var H = Error(); + return H.message = "IndexOutOfBoundsException", H; + }, ve.RC = function() { + var H = Error(); + return H.message = "UserCancelException", H; + }; + })(A.i || (A.i = {})); + }(le || (le = {})), function(A) { + (A = A.dm || (A.dm = {}))[A.forward = 0] = "forward", A[A.reverse = 1] = "reverse"; + }(le || (le = {})), function(A) { + var ve = function() { + function b(m, _) { + this.Xa = m, this.AH = _, this.GH = -1, this.ul = !1; + } + return b.prototype.re = function() { + }, b.prototype.next = function() { + if (++this.GH == this.AH.I()) + return null; + var m = this.AH.Oa(this.GH); + m.scale(this.Xa.fc); + var _ = new A.Ea(); + return this.Xa.ny(m, this.ul, _), _; + }, b.prototype.Ma = function() { + return 0; + }, b; + }(), H = function() { + function b(m, _, C) { + this.Xa = m, this.tw = _, this.Zn = !1, this.fo = C, this.dw = [0], this.uk = [0], this.Pj = [0], this.Is = [0], this.ul = !1, this.sq = new A.Ea(), this.wk = []; + } + return b.prototype.re = function() { + }, b.prototype.next = function() { + if (this.Zn) { + this.Zn = !1, this.td.ia(); + var m = A.ba.kg(this.sq); + return A.Hg.Ok(m, this.Xa.Cq, !0, !0, this.Xa.Vb); + } + if (this.td == null && (this.td = this.tw.Ha(), this.td.ab(), this.fo != null && this.fo.$k(null, 0)), !this.td.Ia()) { + if (!this.td.ab()) + return null; + this.fo != null && this.fo.$k(null, 0); + } + m = null, this.uk[0] = 0, this.AA = this.dw[0] = 0, this.fi = NaN, this.Zn = !1; + for (var _ = this.wk.length = 0, C = new A.h(), D = new A.h(), L = [0]; this.td.Ia() && 8 > this.AA; ) { + var B = this.td.ia(); + if (C.N(B.bc()), D.N(B.xc()), C.scale(this.Xa.fc), D.scale(this.Xa.fc), A.ej.Ou(C, D) ? C.x = D.x : A.ej.Mu(C, D) && (D.x = C.x), this.wk.length = 0, A.ej.oF(this.Xa.Ub, this.Xa.lc, this.Xa.Ae, C, D, this.Xa.LA, this.Xa.at, L, this.Pj, this.Is, this.wk, this.dw), this.fo != null && (B = this.wk.slice(0), this.fo.lG(this.fo.ea() - 1, B, B.length - 1)), A.ej.Nu(C, D) ? (this.sq.Pa(), this.Xa.ny(C, this.ul, this.sq), this.Zn = !0) : (this.sq.Pa(), this.Zn = this.sy(L[0], this.sq)), this.Zn) { + if (this.td.ni(), this.td.zz()) { + this.td.ni(), this.td.ia(); + break; + } + this.td.xW(); + break; + } + m == null && (m = new A.Ea()).$k(null, 0), this.JD(m), _++; + } + if (this.dw[0] = 0, 0 < _) { + for (L = this.td.xb(); 0 < _; ) + this.td.ni(), C.N(this.tw.Oa(this.td.xb())), D.N(this.tw.Oa(this.td.kk())), C.scale(this.Xa.fc), D.scale(this.Xa.fc), this.ul && (A.ej.Ou(C, D) ? C.x = D.x : A.ej.Mu(C, D) && (D.x = C.x)), this.wk.length = 0, A.ej.oF(this.Xa.Ub, this.Xa.lc, this.Xa.Ae, D, C, this.Xa.LA, this.Xa.at, null, this.Pj, this.Is, this.wk, this.dw), this.JD(m), _--; + return C.N(this.tw.Oa(this.td.xb())), C.scale(this.Xa.fc), T.Jr(this.Xa.Ub, this.Xa.lc, this.Xa.fc, this.Xa.sb, C, this.fi + 1.570796326794897, this.fi + 4.71238898038469, this.Xa.co, this.ul, this.uk, m, NaN, NaN), this.td.Wb(L), this.td.ia(), _ = A.ua.mj(null, m, !0), A.Hg.Ok(m, _, !0, !0, this.Xa.Vb); + } + return this.Zn = !1, this.td.ia(), m = A.ba.kg(this.sq), A.Hg.Ok(m, this.Xa.Cq, !0, !0, this.Xa.Vb); + }, b.prototype.JD = function(m) { + var _ = this.wk[0], C = this.Pj[0] - 1.570796326794897, D = this.Is[0] + 1.570796326794897; + if (!isNaN(this.fi)) { + if (this.fi >= this.Pj[0]) { + var L = this.fi + 1.570796326794897; + C = L + 3.141592653589793 - (this.fi - this.Pj[0]); + } else + C = (L = this.fi + 1.570796326794897) + 3.141592653589793 - (6.283185307179586 - (this.Pj[0] - this.fi)); + var B = !(this.fi >= this.Pj[0] && 3.141592653589793 >= this.fi - this.Pj[0]) && !(this.fi < this.Pj[0] && 3.141592653589793 <= this.Pj[0] - this.fi), q = !1; + if (Math.abs(C - L) <= 0.5 * this.Xa.co) + if (B) { + var Z = m.Oa(m.I() - 2); + Z.scale(this.Xa.fc); + var ie = new A.ha(0); + for (A.kb.Sy(this.Xa.Ub, this.Xa.lc, _.x, _.y, Z.x, Z.y, ie), Z = ie.u; Z <= L; ) + Z += 6.283185307179586; + for (; Z > L; ) + Z -= 6.283185307179586; + Z < C && (q = !0); + } else + q = !0; + q ? (m.yB(0, m.I() - 1), this.ul || ((_ = new A.h()).N(m.Oa(m.I() - 1)), _.scale(this.Xa.fc), -3.141592653589793 > _.x - this.uk[0] ? this.uk[0] -= 6.283185307179586 : 3.141592653589793 < _.x - this.uk[0] && (this.uk[0] += 6.283185307179586)), B || (C = 0.5 * (C + L))) : (B ? ((L = new A.h()).N(_), L.scale(1 / this.Xa.fc), m.xf(0, -1, L)) : T.Jr(this.Xa.Ub, this.Xa.lc, this.Xa.fc, this.Xa.sb, this.wk[0], L, C, this.Xa.co, this.ul, this.uk, m, NaN, NaN), this.AA += 1); + } + T.my(this.Xa.Ub, this.Xa.lc, this.Xa.fc, this.Xa.sb, this.Xa.Ae, this.wk, C, D, this.ul, this.uk, m), this.fi = this.Is[0]; + }, b.prototype.sy = function(m, _) { + return this.Xa.sy(this.wk, m, this.Pj[0], this.Is[0], this.ul, _); + }, b.prototype.Ma = function() { + return 0; + }, b; + }(), T = function() { + function b() { + } + return b.buffer = function(m, _, C, D, L, B) { + if (m == null) + throw A.i.O("Geometry::Geodesic_bufferer::buffer"); + if (m.B()) + return new A.Ea(m.description); + var q = new b(); + q.Sg = _, q.Kc = A.cb.tc(_); + var Z = A.cb.xv(q.Kc); + if (q.Vb = B, q.Ub = A.cb.gv(q.Kc), q.lc = Z * (2 - Z), q.fc = q.Kc.Id().ci, q.ra = q.Sg.Mn(), q.Cq = q.Kc.Mn(), q.at = q.Cq * q.fc, q.Bq = 1.570796326794897 / q.fc, q.KY = 3.141592653589793 / q.fc, q.Ls = 6.283185307179586 / q.fc, q.LY = q.Ls / 6, q.GA = 0, q.JY = 1.5707963267948966 * q.Ub / q.GA, C == 4 ? (q.Ae = 2, q.Yv = !0) : (q.Ae = C, q.Yv = !1), q.La = D, q.sb = Math.abs(D), isNaN(L) || 1e-3 > L ? q.tX() : q.bo = L, C = m.K(), A.ba.zd(C) ? ((C = new A.Ua(m.description)).pc(m, !0), m = C, C = 1607) : C == 197 && (C = new A.l(), m.A(C), C.S() <= q.ra || C.da() <= q.ra ? ((C = new A.Ua(m.description)).bd(m, !1), m = C, C = 1607) : ((C = new A.Ea(m.description)).bd(m, !1), m = C, C = 1736)), q.uX(), A.ba.Tn(C) || q.vX(), q.sb <= 0.5 * q.bo) + return C != 1736 ? new A.Ea(m.description) : q.Yv ? m : A.ej.Sr(m, q.Sg, q.Ae, q.LA, -1, B); + if (0 > q.La && C != 1736) + return new A.Ea(m.description); + if (q.Yv && A.ba.Ic(C) ? (_ = A.ej.Sr(m, _, 4, NaN, q.bo, B), m = A.cb.Bh(_, q.Sg, q.Kc)) : m = A.cb.Bh(m, q.Sg, q.Kc), (m = A.Jh.nj(m, q.Kc)).B()) + return new A.Ea(m.description); + switch (!q.Yv && A.ba.Ic(C) && (m = A.ej.kI(q.fc, m)), m = b.GX(m, q.Kc), C) { + case 1736: + _ = q.PN(m); + break; + case 1607: + _ = q.QN(m); + break; + case 550: + _ = q.NN(m); + break; + case 33: + _ = q.ON(m); + break; + default: + throw A.i.ga("corrupted_geometry"); + } + return (q = A.cb.Bh(_, q.Kc, q.Sg)).Ll(m.description), q; + }, b.prototype.PN = function(m) { + var _ = new A.Ea(); + m = new H(this, m, _), m = A.Ih.local().W(m, this.Kc, this.Vb).next(), m = A.kp.pj(m, this.Kc, 2); + var C = new A.Ed(); + return C.scale(1 / this.fc, 1 / this.fc), _.Pc(C), _ = A.kp.pj(_, this.Kc, 2), 0 <= this.La ? A.Ih.local().W(_, m, this.Kc, this.Vb) : A.mp.local().W(_, m, this.Kc, this.Vb); + }, b.prototype.QN = function(m) { + return m = new H(this, m, null), m = A.Ih.local().W(m, this.Kc, this.Vb).next(), A.kp.pj(m, this.Kc, 2); + }, b.prototype.NN = function(m) { + return m = new ve(this, m), m = A.Ih.local().W(m, this.Kc, this.Vb).next(), A.kp.pj(m, this.Kc, 2); + }, b.prototype.ON = function(m) { + (m = m.D()).scale(this.fc); + var _ = new A.Ea(); + return this.ny(m, !1, _), A.kp.pj(_, this.Kc, 2); + }, b.prototype.sy = function(m, _, C, D, L, B) { + var q = m[0], Z = m[m.length - 1], ie = q.y > Z.y ? q.y : Z.y, se = A.F.q(this.Ub, this.lc, q.y < Z.y ? q.y : Z.y); + if (ie = A.F.q(this.Ub, this.lc, ie), 1e-3 < this.GA - (se + _ + this.sb) && 1e-3 < this.GA + (ie - _ - this.sb)) + return !1; + se = (_ = C - 1.570796326794897) - 3.141592653589793, ie = _ + 3.141592653589793; + var de = (C = D + 1.570796326794897) + 3.141592653589793, Ce = [NaN], Ve = [NaN], Je = [NaN], Pt = [NaN]; + if (D = !1, b.ZI(this.Ub, this.lc, this.sb, q, _, se, Z, C, Ce, Ve), b.ZI(this.Ub, this.lc, this.sb, Z, de, C, q, se, Je, Pt), (C < Ce[0] && Ce[0] < de || C < Ve[0] && Ve[0] < de) && (D = !0), D || (se < Je[0] && Je[0] < _ || se < Pt[0] && Pt[0] < _) && (D = !0), !D && L) + return !1; + for (var $t = [], qe = m.length - 1; 0 <= qe; qe--) + $t.push(m[qe]); + return B.Pa(), B.$k(null, 0), qe = [0], b.my(this.Ub, this.lc, this.fc, this.sb, this.Ae, m, _, C, L, qe, B), b.Jr(this.Ub, this.lc, this.fc, this.sb, Z, C, de, this.co, L, qe, B, Ce[0], Ve[0]), b.my(this.Ub, this.lc, this.fc, this.sb, this.Ae, $t, de, ie, L, qe, B), b.Jr(this.Ub, this.lc, this.fc, this.sb, q, se, _, this.co, L, qe, B, Je[0], Pt[0]), m = !1, L || (m = this.DE(this.fc, B)), D || m; + }, b.prototype.ny = function(m, _, C) { + C.Pa(), C.$k(null, 0), b.Jr(this.Ub, this.lc, this.fc, this.sb, m, -this.co, 6.283185307179586, this.co, _, [0], C, NaN, NaN), _ || this.DE(this.fc, C); + }, b.prototype.DE = function(m, _) { + var C = this.qO(m, _); + return m = this.rO(m, _), C || m; + }, b.prototype.qO = function(m, _) { + var C = _.I(), D = !1, L = new A.l(); + if (_.A(L), !A.s.$(L.H * m, 1.570796326794897) && !A.s.$(L.G * m, -1.570796326794897)) + return !1; + var B = new A.h(); + for (--C; 0 <= C; C--) + _.D(C, B), (B.y == L.H && A.s.$(B.y * m, 1.570796326794897) || B.y == L.G && A.s.$(B.y * m, -1.570796326794897)) && (D = !0, this.JI(B, C, _)); + return D; + }, b.prototype.rO = function(m, _) { + var C = _.Oa(0), D = _.Oa(_.I() - 1); + return 3.141592653589793 < Math.abs(C.x - D.x) * m ? (this.QV(_), !0) : this.pO(_); + }, b.prototype.pO = function(m) { + return 0 > m.He() && (this.PV(m), !0); + }, b.prototype.JI = function(m, _, C) { + var D = C.I(), L = 0 < _ ? _ - 1 : D - 1; + if (D = C.Oa(_ < D - 1 ? _ + 1 : 0), L = C.Oa(L), !A.s.$(D.y, m.y) && !A.s.$(D.x, m.x)) { + var B = new A.h(); + B.na(D.x, m.y), C.Db(_, B); + } + A.s.$(L.y, m.y) || A.s.$(L.x, m.x) || ((D = new A.h()).na(L.x, m.y), C.xf(0, _, D)); + }, b.prototype.QV = function(m) { + var _ = new A.Ea(), C = new A.Ea(), D = new A.Ed(), L = m.Oa(0), B = m.Oa(m.I() - 1), q = new A.h(); + L.x > B.x ? (B = this.Bq, D.ig(-this.Ls, 0)) : (B = -this.Bq, D.ig(this.Ls, 0)), _.add(m, !1), m.Pa(), C.add(_, !1), C.Pc(D), L = new A.l(), C.A(L), L.X((this.Ls - L.S()) / 2, 0), L.G = -this.Bq, L.H = this.Bq; + for (var Z = 0; Z < C.I(); Z++) + C.D(Z, q), _.xf(0, -1, q); + for (C.Pc(D), Z = 0; Z < C.I(); Z++) + C.D(Z, q), _.xf(0, -1, q); + C = _.Oa(0), D = _.Oa(_.I() - 1), q.na(D.x, B), _.xf(0, -1, q), q.na(0.5 * (D.x + C.x), B), _.xf(0, -1, q), q.na(C.x, B), _.xf(0, -1, q), _ = A.Jh.ms(_, this.Kc, 2, !0, L.v), _ = A.Jh.ms(_, this.Kc, 2, !0, L.C), _ = A.Vd.clip(_, L, this.Cq, NaN), m.add(_, !1); + }, b.prototype.PV = function(m) { + var _ = new A.l(); + m.A(_), _.X((this.Ls - _.S()) / 2, 0), _.G = -this.Bq, _.H = this.Bq, m.$k(null, 0); + var C = new A.h(); + C.na(_.v, _.G), m.xf(1, -1, C), C.na(_.v, _.H), m.xf(1, -1, C), C.na(0.5 * (_.v + _.C), _.H), m.xf(1, -1, C), C.na(_.C, _.H), m.xf(1, -1, C), C.na(_.C, _.G), m.xf(1, -1, C), C.na(0.5 * (_.v + _.C), _.G), m.xf(1, -1, C); + }, b.my = function(m, _, C, D, L, B, q, Z, ie, se, de) { + var Ce = null; + ie || ((Ce = new A.h()).Sc(), 0 < de.I() && (Ce.N(de.Oa(de.I() - 1)), Ce.scale(C))); + var Ve = new A.ha(0), Je = new A.ha(0), Pt = new A.ha(0), $t = new A.h(), qe = new A.h(), Rt = B[B.length - 1]; + C = 1 / C; + for (var Zt = 0; Zt < B.length; Zt++) { + var Jt = B[Zt]; + if (Zt == 0) + var Xt = q; + else + Zt == B.length - 1 ? Xt = Z : (A.kb.xd(m, _, Rt.x, Rt.y, Jt.x, Jt.y, null, null, Ve, L), Xt = Ve.u - 1.570796326794897); + A.kb.Ai(m, _, Jt.x, Jt.y, D, Xt, Je, Pt), ie ? qe.na(Je.u, Pt.u) : ($t.na(Je.u, Pt.u), b.bJ(Jt.x, $t.x, Ce.x, se), qe.na(se[0] + $t.x, $t.y), Ce.N(qe)), qe.scale(C), de.xf(0, -1, qe); + } + }, b.Jr = function(m, _, C, D, L, B, q, Z, ie, se, de, Ce, Ve) { + if (!(q - B < Z)) { + var Je = new A.ha(0), Pt = new A.ha(0), $t = new A.h(), qe = new A.h(), Rt = null; + ie || ((Rt = new A.h()).Sc(), 0 < de.I() && (Rt.N(de.Oa(de.I() - 1)), Rt.scale(C))); + var Zt = A.P.truncate(Math.ceil(B / Z)), Jt = Zt++ * Z; + for (Jt == B && (Jt = Zt++ * Z), C = 1 / C; Jt < q + Z && (B < Ce && Ce < Jt ? (Jt = Ce, Zt--) : B < Ve && Ve < Jt && (Jt = Ve, Zt--), !(Jt >= q)); ) + A.kb.Ai(m, _, L.x, L.y, D, Jt, Je, Pt), ie ? qe.na(Je.u, Pt.u) : ($t.na(Je.u, Pt.u), b.bJ(L.x, $t.x, Rt.x, se), qe.na(se[0] + $t.x, $t.y), Rt.N(qe)), qe.scale(C), de.xf(0, -1, qe), B = Jt, Jt = Zt++ * Z; + } + }, b.ZI = function(m, _, C, D, L, B, q, Z, ie, se) { + var de = new A.h(), Ce = new A.h(), Ve = new A.ha(0), Je = new A.ha(0); + for (A.kb.Ai(m, _, D.x, D.y, C, L, Ve, Je), de.na(Ve.u, Je.u), A.kb.Ai(m, _, D.x, D.y, C, B, Ve, Je), Ce.na(Ve.u, Je.u), C = new A.ha(0), A.kb.Sy(m, _, q.x, q.y, de.x, de.y, C), ie[0] = C.u, A.kb.Sy(m, _, q.x, q.y, Ce.x, Ce.y, C), se[0] = C.u; ie[0] <= se[0]; ) + ie[0] += 6.283185307179586; + for (; ie[0] > se[0]; ) + ie[0] -= 6.283185307179586; + for (; ie[0] >= Z; ) + ie[0] -= 6.283185307179586, se[0] -= 6.283185307179586; + for (; ie[0] < Z; ) + ie[0] += 6.283185307179586, se[0] += 6.283185307179586; + }, b.bJ = function(m, _, C, D) { + if (isNaN(C)) { + for (; 3.141592653589793 < D[0] + _ - m; ) + D[0] -= 6.283185307179586; + for (; 3.141592653589793 < m - (D[0] + _); ) + D[0] += 6.283185307179586; + } else + 3.141592653589793 < D[0] + _ - C ? D[0] -= 6.283185307179586 : 3.141592653589793 < C - (D[0] + _) && (D[0] += 6.283185307179586); + }, b.GX = function(m, _) { + var C = m.K(), D = A.ba.Ic(C) ? m.ea() : C == 550 ? m.I() : 1; + if (D == 1) + return m; + var L = new A.ja(0); + L.resize(D); + for (var B = [], q = new A.l(), Z = 0; Z < D; Z++) { + if (L.write(Z, Z), A.ba.Ic(C)) { + m.Tj(Z, q); + var ie = q.tf(); + } else + ie = m.Oa(Z); + ie = A.SK.WX(_, ie), B[Z] = ie; + } + for (L.Wd(0, L.size, function(se, de) { + return B[se] < B[de] ? -1 : B[se] > B[de] ? 1 : 0; + }), _ = m.Ja(), Z = 0; Z < D; Z++) + q = L.read(Z), A.ba.Ic(C) ? _.addPath(m, q, !0) : _.Gd(m, q, q + 1); + return _; + }, b.prototype.uX = function() { + var m = Math.min(3.141592653589793 * this.Ub - this.sb, this.sb); + m = Math.min(m, 0.39269908169872414 * this.Ub); + var _ = new A.h(); + _.na(0, 10 * this.fc); + var C = 45 * this.fc, D = new A.ha(0), L = new A.ha(0), B = new A.ha(0), q = new A.ha(0), Z = new A.ha(0), ie = new A.ha(0), se = new A.ha(0), de = new A.ha(0), Ce = new A.h(), Ve = new A.h(), Je = new A.h(), Pt = new A.h(); + A.kb.Ai(this.Ub, this.lc, _.x, _.y, m, 0, D, L), Ce.na(D.u, L.u), A.kb.Ai(this.Ub, this.lc, _.x, _.y, m, C, B, q), Ve.na(B.u, q.u), D = new A.ha(0), L = new A.ha(0); + for (var $t = new A.ha(0); A.kb.Ai(this.Ub, this.lc, _.x, _.y, m, 0.5 * (0 + C), Z, ie), Je.na(Z.u, ie.u), A.kb.xd(this.Ub, this.lc, Ce.x, Ce.y, Ve.x, Ve.y, D, L, null, 2), A.kb.qj(this.Ub, this.lc, Ce.x, Ce.y, 0.5 * D.u, L.u, se, de, 2), Pt.na(se.u, de.u), A.kb.xd(this.Ub, this.lc, Je.x, Je.y, Pt.x, Pt.y, $t, null, null, 2), !($t.u <= this.bo); ) + C *= 0.9, A.kb.Ai(this.Ub, this.lc, _.x, _.y, m, C, B, q), Ve.na(B.u, q.u); + this.co = 6.283185307179586 / Math.ceil(6.283185307179586 / (C - 0)); + }, b.prototype.vX = function() { + var m = Math.min(3.141592653589793 * this.Ub - this.sb, this.sb); + m = Math.min(m, 0.39269908169872414 * this.Ub); + var _ = new A.h(), C = new A.h(); + _.na(0, 10 * this.fc), C.na(10 * this.fc, 10 * this.fc); + var D = new A.ha(0), L = new A.ha(0), B = new A.ha(0); + A.kb.xd(this.Ub, this.lc, _.x, _.y, C.x, C.y, B, D, L, this.Ae); + var q = new A.ha(0), Z = new A.ha(0), ie = new A.ha(0), se = new A.ha(0), de = new A.h(), Ce = new A.ha(0), Ve = new A.ha(0), Je = new A.ha(0), Pt = new A.ha(0), $t = new A.ha(0), qe = new A.ha(0), Rt = new A.ha(0), Zt = new A.ha(0), Jt = new A.ha(0), Xt = new A.h(), Qt = new A.h(), bi = new A.h(), Mi = new A.h(), Ri = 1; + D = D.u, L = L.u + 1.570796326794897, B = B.u, A.kb.Ai(this.Ub, this.lc, _.x, _.y, m, D - 1.570796326794897, Ve, Je), Xt.na(Ve.u, Je.u), A.kb.Ai(this.Ub, this.lc, C.x, C.y, m, L, Pt, $t), Qt.na(Pt.u, $t.u), Ve = new A.ha(0), Je = new A.ha(0), L = new A.ha(0); + for (var Yi = new A.ha(0); A.kb.qj(this.Ub, this.lc, _.x, _.y, 0.5 * (0 + Ri) * B, D, q, Z, this.Ae), de.na(q.u, Z.u), A.kb.xd(this.Ub, this.lc, _.x, _.y, de.x, de.y, null, null, Ce, this.Ae), A.kb.Ai(this.Ub, this.lc, de.x, de.y, m, Ce.u + 1.570796326794897, qe, Rt), bi.na(qe.u, Rt.u), A.kb.xd(this.Ub, this.lc, Xt.x, Xt.y, Qt.x, Qt.y, Ve, Je, null, 2), A.kb.qj(this.Ub, this.lc, Xt.x, Xt.y, 0.5 * Ve.u, Je.u, Zt, Jt, 2), Mi.na(Zt.u, Jt.u), A.kb.xd(this.Ub, this.lc, bi.x, bi.y, Mi.x, Mi.y, L, null, null, 2), !(L.u <= this.bo); ) + Ri *= 0.9, A.kb.qj(this.Ub, this.lc, _.x, _.y, Ri * B, D, ie, se, this.Ae), C.na(ie.u, se.u), A.kb.xd(this.Ub, this.lc, _.x, _.y, C.x, C.y, null, null, Yi, this.Ae), A.kb.Ai(this.Ub, this.lc, C.x, C.y, m, Yi.u + 1.570796326794897, Pt, $t), Qt.na(Pt.u, $t.u); + 1e5 < (m = Ri * B) && (m = 1e5), this.LA = m; + }, b.prototype.tX = function() { + var m = 5e4 < this.sb ? 100 : 1e4 < this.sb ? 10 : 1; + 500 > this.sb / m && (m = this.sb / 500), 0.01 > m && (m = 0.01), this.bo = m; + }, b; + }(); + A.QK = T; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.Of = function(T, b) { + var m = new A.h(); + m.N(b), T.push(m); + }, H.wp = function(T, b) { + T.add(b.x), T.add(b.y); + }, H.cB = function(T) { + T.Dh(T.size - 2); + }, H.jB = function(T, b) { + b.na(T.get(T.size - 2), T.get(T.size - 1)); + }, H.Sr = function(T, b, m, _, C, D) { + if (T == null) + throw A.i.O(); + var L = T.K(); + if (T.B() || A.ba.Tn(L)) + return T; + var B = new H(); + B.Sg = b, B.Kc = A.cb.tc(b); + var q = A.cb.xv(B.Kc); + if (B.Vb = D, B.Ub = A.cb.gv(B.Kc), B.lc = q * (2 - q), B.fc = B.Kc.Id().ci, B.Cq = B.Kc.Mn(), B.at = B.Cq * B.fc, B.vA = _, B.uA = C, B.Ae = m, L == 197 ? (m = new A.Ea(T.description)).bd(T, !1) : A.ba.zd(L) ? (m = new A.Ua(T.description)).pc(T, !0) : m = T, B.Ae != 4) { + if ((b = B.Sg.Nb(B.Kc) == 0 ? A.cb.Bh(m, B.Sg, B.Kc) : A.Jh.nj(m, B.Kc)).B()) + return b; + b = H.kI(B.fc, b), b = B.Uy(b), b = A.kp.pj(b, B.Kc, B.Ae), B = A.cb.Bh(b, B.Kc, B.Sg); + } else { + if (A.Gg.Tb(b) == 2 ? (T = A.cb.ol(), (b = A.Zj.local().W(m, T, b, D)) == T && (b = new A.Ea(), T.copyTo(b))) : b = A.Jh.nj(m, B.Kc), b.B()) + return b; + B = B.yX(b); + } + return B; + }, H.kI = function(T, b) { + var m = new A.l(); + if (b.yc(m), 3.141592653589793 > m.S() * T) + return b; + var _ = !1; + m = b.Ha(); + for (var C = new A.h(), D = new A.h(); m.ab(); ) + for (; m.Ia(); ) { + var L = m.ia(); + if (C.N(L.bc()), D.N(L.xc()), C.scale(T), D.scale(T), 3.141592653589793 < Math.abs(C.x - D.x)) { + var B = H.Nu(C, D); + if (!B) { + _ = !0; + break; + } + if (6.283185307179586 < Math.abs(C.x - D.x)) { + _ = !0; + break; + } + } + } + if (!_) + return b; + _ = b.Ja(); + var q = 1 < b.description.Ba, Z = new A.h(), ie = new A.h(), se = new A.h(), de = new A.h(), Ce = new A.Ta(); + for (m.aj(); m.ab(); ) + for (var Ve = NaN, Je = [0]; m.Ia(); ) { + if (L = m.ia(), C.N(L.bc()), D.N(L.xc()), C.scale(T), D.scale(T), isNaN(Ve) ? (H.Yi(C.x, NaN, Je), ie.N(C)) : ie.N(se), Ve = ie.x, B = H.Nu(C, D)) { + if (6.283185307179586 < D.x - C.x) + for (; 6.283185307179586 < D.x - C.x; ) + D.x -= 6.283185307179586; + if (-6.283185307179586 > D.x - C.x) + for (; -6.283185307179586 > D.x - C.x; ) + D.x += 6.283185307179586; + H.Yi(D.x, NaN, Je), se.N(D); + } else + Z.N(D), H.vU(Z), H.Yi(Z.x, Ve, Je), se.na(Je[0] + Z.x, Z.y); + 0.5 > Math.abs(se.x - D.x) && se.N(D), q ? (L.Vw(0, Ce), de.N(ie), de.scale(1 / T), Ce.Db(de), (B = m.xm()) ? _.nf(Ce) : _.lineTo(Ce), m.Sn() && !b.ec(m.gb) && (L.Vw(1, Ce), de.N(se), de.scale(1 / T), Ce.Db(de), _.lineTo(Ce))) : ((B = m.xm()) && _.Cz(null, 0), L = _.ea() - 1, de.N(ie), de.scale(1 / T), _.xf(L, -1, de), m.Sn() && !b.ec(m.gb) && (de.N(se), de.scale(1 / T), _.xf(L, -1, de))); + } + return _; + }, H.oF = function(T, b, m, _, C, D, L, B, q, Z, ie, se) { + var de = new A.h(), Ce = new A.h(), Ve = 0 < _.compare(C); + H.aJ(Ve, _, C, de, Ce), H.pF(T, b, m, de, Ce, D, NaN, L, B, q, Z, null, ie, se), Ve && H.aC(q, Z, null, ie); + }, H.prototype.Uy = function(T) { + var b = T.Ja(), m = T.Ha(), _ = [], C = null, D = null, L = 1 < T.description.Ba; + L && (C = new A.ce(0), D = new A.jg()); + for (var B = [0], q = new A.h(), Z = new A.h(), ie = new A.h(), se = new A.h(); m.ab(); ) + for (B[0] = 0; m.Ia(); ) { + var de = m.ia(); + q.N(de.bc()), Z.N(de.xc()), q.scale(this.fc), Z.scale(this.fc); + var Ce = 0 < q.compare(Z); + H.aJ(Ce, q, Z, ie, se), _.length = 0, C?.Dh(0), 0 < this.vA ? H.pF(this.Ub, this.lc, this.Ae, ie, se, this.vA, this.uA, this.at, null, null, null, L ? C : null, _, B) : H.WQ(this.Ub, this.lc, this.Ae, ie, se, this.uA, this.at, L ? C : null, _, B), Ce && H.aC(null, null, L ? C : null, _), _[0].N(de.bc()), _[_.length - 1].N(de.xc()); + for (var Ve = 1; Ve < _.length - 1; Ve++) + _[Ve].scale(1 / this.fc); + L ? (Ce = H.$I(Ce, de, D), H.OD(m.xm(), m.Sn() && !T.ec(m.gb), de, Ce, C, _, b)) : H.ND(m.xm(), m.Sn() && !T.ec(m.gb), _, b); + } + return b; + }, H.prototype.yX = function(T) { + var b = T.Ja(), m = T.Ha(), _ = [], C = null, D = new A.jg(), L = 1 < T.description.Ba; + for (L && (C = new A.ce(0)); m.ab(); ) + for (; m.Ia(); ) { + var B = m.ia(), q = B.bc(), Z = B.xc(); + q = 0 < q.compare(Z), Z = H.$I(q, B, D), _.length = 0, C?.Dh(0), H.xX(this.Ub, this.lc, this.fc, Z, this.Sg, this.vA, this.uA, L ? C : null, _), q && H.aC(null, null, L ? C : null, _), L ? H.OD(m.xm(), m.Sn() && !T.ec(m.gb), B, Z, C, _, b) : H.ND(m.xm(), m.Sn() && !T.ec(m.gb), _, b); + } + return b; + }, H.ND = function(T, b, m, _) { + T && _.Cz(null, 0), T = _.ea() - 1; + var C = m.slice(0); + _.lG(T, C, C.length - 1), b && _.xf(T, -1, m[m.length - 1]); + }, H.OD = function(T, b, m, _, C, D, L) { + var B = new A.Ta(); + if (m.Vo(B), T ? L.nf(B) : L.lineTo(B), 2 < D.length) { + T = _.Rb(); + for (var q = 1; q < D.length - 1; q++) { + var Z = _.IG(C.get(q) * T); + _.Vw(Z, B), B.Db(D[q]), L.lineTo(B); + } + } + b && (m.Ro(B), L.lineTo(B)); + }, H.pF = function(T, b, m, _, C, D, L, B, q, Z, ie, se, de, Ce) { + var Ve = new A.ha(0), Je = new A.ha(0), Pt = new A.ha(0); + A.kb.xd(T, b, _.x, _.y, C.x, C.y, Pt, Ve, Je, m), Pt = Pt.u; + var $t = Ve = Ve.u; + 0 > $t && ($t += 6.283185307179586), 0 > (Je = Je.u) && (Je += 6.283185307179586), q != null && (q[0] = Pt), Z != null && (Z[0] = $t), ie != null && (ie[0] = Je), Z = q = NaN, se != null && (q = ((Z = A.F.Ch(T, b)) - (ie = A.F.q(T, b, _.y))) / Pt, Z = (Z + ie) / Pt), ie = H.Ou(_, C), Je = H.Mu(_, C), $t = ie || Je; + var qe = H.AE(_, C, B), Rt = new A.ha(0), Zt = new A.ha(0), Jt = new A.h(), Xt = new A.h(), Qt = new A.h(); + H.Yi(_.x, NaN, Ce); + var bi = [Ce[0]]; + if (Pt <= D) + H.Of(de, _), H.Yi(C.x, NaN, Ce), se?.add(0), $t ? (ie && H.fB(_, C, se, de), Je && H.dB(_, C, se, de)) : qe ? H.eB(_, C, Ve, q, Z, se, de) : 0 < L && (Xt.na(_.x - bi[0], _.y), Jt.na(C.x - Ce[0], C.y), H.Ty(T, b, m, _, Pt, Ve, Xt, Jt, 0, 1, L, se, de, bi)), H.Of(de, C); + else { + var Mi = Pt / ((D = 1 + A.P.truncate(Math.ceil(Pt / D))) - 1), Ri = new A.h(), Yi = 0; + H.Of(de, _), Ri.N(_), Xt.na(_.x - Ce[0], _.y), se?.add(0); + for (var rr = 1; rr < D; rr++) { + if (rr < D - 1) { + A.kb.qj(T, b, _.x, _.y, rr * Mi, Ve, Rt, Zt, m), Jt.na(Rt.u, Zt.u), H.Yi(Jt.x, Ri.x, Ce), Qt.na(Ce[0] + Jt.x, Jt.y); + var _i = rr / (D - 1); + } else + H.Yi(C.x, NaN, Ce), Jt.na(C.x - Ce[0], C.y), Qt.N(C), _i = 1; + $t ? (rr == 1 && ie && H.fB(_, Qt, se, de), rr == D - 1 && Je && H.dB(Ri, C, se, de)) : qe ? H.zE(Ri, Qt, B) && (_.x < C.x ? Ri.x > Qt.x && (Ce[0] += 6.283185307179586, Qt.na(Ce[0] + Jt.x, Jt.y)) : Ri.x < Qt.x && (Ce[0] -= 6.283185307179586, Qt.na(Ce[0] + Jt.x, Jt.y)), H.eB(Ri, Qt, Ve, q, Z, se, de)) : 0 < L && H.Ty(T, b, m, _, Pt, Ve, Xt, Jt, Yi, _i, L, se, de, bi), H.Of(de, Qt), se?.add(_i), Ri.N(Qt), Xt.N(Jt), bi[0] = Ce[0], Yi = _i; + } + } + }, H.WQ = function(T, b, m, _, C, D, L, B, q, Z) { + var ie = new A.ha(0), se = new A.ha(0), de = new A.ha(0); + A.kb.xd(T, b, _.x, _.y, C.x, C.y, de, ie, se, m), se = de.u, ie = ie.u; + var Ce = de = NaN; + if (B != null) { + Ce = A.F.Ch(T, b); + var Ve = A.F.q(T, b, _.y); + de = (Ce - Ve) / se, Ce = (Ce + Ve) / se; + } + Ve = H.Ou(_, C); + var Je = H.Mu(_, C), Pt = Ve || Je; + L = H.AE(_, C, L); + var $t = H.Nu(_, C); + $t = Pt || L || $t, H.Yi(_.x, NaN, Z); + var qe = new A.h(); + H.Of(q, _), qe.N(_), B?.add(0), $t ? (Pt ? (Ve && H.fB(_, C, B, q), Je && H.dB(_, C, B, q)) : L && H.eB(_, C, ie, de, Ce, B, q), H.Yi(C.x, NaN, Z), H.Of(q, C)) : se <= D ? (H.Yi(C.x, NaN, Z), H.Of(q, C)) : (de = new A.h(), L = new A.h(), de.N(_), L.N(C), de.x -= Z[0], L.x -= Z[0], -3.141592653589793 > L.x ? L.x += 6.283185307179586 : 3.141592653589793 < L.x && (L.x -= 6.283185307179586), H.Ty(T, b, m, _, se, ie, de, L, 0, 1, D, B, q, Z), H.Of(q, C), H.Yi(C.x, NaN, Z)), B?.add(1); + }, H.Ty = function(T, b, m, _, C, D, L, B, q, Z, ie, se, de, Ce) { + var Ve = new A.h(), Je = new A.h(); + Ve.na(L.x + Ce[0], L.y), new A.ha(0), new A.ha(0), new A.ha(0), new A.ha(0); + var Pt = new A.ha(0), $t = new A.ha(0), qe = new A.ha(0), Rt = new A.h(), Zt = new A.h(), Jt = new A.h(), Xt = new A.h(); + Rt.N(L), Zt.N(B), L = new A.ce(0), B = new A.ce(0), H.wp(L, Zt), B.add(Z); + var Qt = new A.h(), bi = new A.zb(), Mi = []; + for (H.TJ(4, Mi); 0 < L.size; ) { + for (var Ri, Yi = !1, rr = NaN, _i = 0; 3 > _i; _i++) + if (Ri = Mi[_i] * Z + (1 - Mi[_i]) * q, A.kb.qj(T, b, _.x, _.y, Ri * C, D, Pt, $t, m), Jt.na(Pt.u, $t.u), _i == 0 && (rr = Ri, Xt.N(Jt)), H.RW(Rt, Jt, Zt, bi), bi.ic(bi.ge(Jt, !0), Qt), A.kb.xd(T, b, Jt.x, Jt.y, Qt.x, Qt.y, qe, null, null, 2), qe.u > ie) { + Yi = !0; + break; + } + Yi ? (Zt.N(Xt), Z = rr, H.wp(L, Zt), B.add(Z)) : (H.cB(L), B.Gn(B.size - 1, 1, B.size - 1), 0 < L.size && (H.Yi(Zt.x, Ve.x, Ce), Je.na(Ce[0] + Zt.x, Zt.y), H.Of(de, Je), Ve.N(Je), se?.add(Z), Rt.N(Zt), q = Z, H.jB(L, Zt), Z = B.get(B.size - 1))); + } + }, H.xX = function(T, b, m, _, C, D, L, B, q) { + var Z = new A.h(), ie = new A.h(), se = new A.h(), de = new A.h(), Ce = new A.h(), Ve = new A.h(), Je = new A.h(), Pt = new A.h(), $t = new A.h(), qe = new A.h(), Rt = new A.ha(0), Zt = new A.ha(0), Jt = new A.h(), Xt = [[], []], Qt = A.Gg.Tb(C) == 1; + C = C.Yd(0); + var bi = _.bc(), Mi = _.xc(); + Qt ? (Ve.na(bi.x * m, bi.y * m), Je.na(Mi.x * m, Mi.y * m)) : (Xt[0][0] = bi.x, Xt[0][1] = bi.y, Xt[1][0] = Mi.x, Xt[1][1] = Mi.y, A.cb.wt(), Ve.x = Xt[0][0] * m, Ve.y = Xt[0][1] * m, Je.x = Xt[1][0] * m, Je.y = Xt[1][1] * m); + var Ri = 0, Yi = 0, rr = 1, _i = _.Rn(); + Z.N(bi), ie.N(Mi), Mi = new A.ce(0); + var fn = new A.ce(0), jr = new A.ce(0); + H.wp(Mi, ie), H.wp(fn, Je), jr.add(rr), H.Of(q, Z), B?.add(Yi); + var no = [], $r = 0 < L ? _i ? 5 : 3 : _i ? 5 : 1; + H.TJ($r, no); + for (var Zn = new A.ha(0), bs = new A.ha(0), On = new A.ha(0), Jn = new A.ha(0), ki = new A.ha(0), Ur = new A.ha(0), So = new A.ha(0); 0 < fn.size; ) { + var Cn = !1, Ki = NaN; + for (A.kb.xd(T, b, Ve.x, Ve.y, Je.x, Je.y, Zn, bs, null, 2), bi = 0; bi < $r && !(bi == 0 && (!_i && 0 >= L && Zn.u <= D && 3.141592653589793 > Math.abs(Ve.x - Je.x) || _.Tx(Yi, rr) <= C)); bi++) { + var ui = no[bi] * rr + (1 - no[bi]) * Yi; + if (_.ic(ui, se), Qt ? Pt.na(se.x * m, se.y * m) : (Xt[0][0] = se.x, Xt[0][1] = se.y, A.cb.wt(), Pt.x = Xt[0][0] * m, Pt.y = Xt[0][1] * m), bi == 0 && (Ki = ui, Ce.N(se), qe.N(Pt), 0 < D && (Zn.u > D || 3.141592653589793 <= Math.abs(Ve.x - Je.x)))) { + Cn = !0; + break; + } + if (_i && 0 < D) { + if (A.kb.xd(T, b, Ve.x, Ve.y, Pt.x, Pt.y, On, null, null, 2), On.u > D || 3.141592653589793 <= Math.abs(Ve.x - Pt.x)) { + Cn = !0; + break; + } + } else if (0 < L) { + if (_i ? (de.IS(Z, ie, no[bi]), Qt ? $t.na(de.x * m, de.y * m) : (Xt[0][0] = de.x, Xt[0][1] = de.y, A.cb.wt(), $t.x = Xt[0][0] * m, $t.y = Xt[0][1] * m)) : (de.N(se), $t.N(Pt)), A.kb.xd(T, b, Ve.x, Ve.y, $t.x, $t.y, Jn, null, null, 2), !(Jn.u <= Zn.u)) { + Cn = !0; + break; + } + if (A.kb.qj(T, b, Ve.x, Ve.y, Jn.u, bs.u, Rt, Zt, 2), Jt.na(Rt.u, Zt.u), A.kb.xd(T, b, Jt.x, Jt.y, Pt.x, Pt.y, ki, null, null, 2), ki.u > L) { + Cn = !0; + break; + } + if (_i) { + if (A.kb.xd(T, b, Jt.x, Jt.y, $t.x, $t.y, Ur, null, null, 2), Ur.u > L) { + Cn = !0; + break; + } + if (A.kb.xd(T, b, $t.x, $t.y, Pt.x, Pt.y, So, null, null, 2), So.u > L) { + Cn = !0; + break; + } + } + } + } + Cn ? (ie.N(Ce), Je.N(qe), rr = Ki, H.wp(Mi, ie), H.wp(fn, Je), jr.add(rr)) : (H.cB(Mi), H.cB(fn), jr.Gn(jr.size - 1, 1, jr.size - 1), H.Of(q, ie), Ri += Zn.u, B?.add(Ri), 0 < fn.size && (Z.N(ie), Ve.N(Je), Yi = rr, H.jB(Mi, ie), H.jB(fn, Je), rr = jr.get(jr.size - 1))); + } + if (B != null) + for (T = 1 / Ri, bi = 0; bi < B.size; bi++) + B.write(bi, B.read(bi) * T); + }, H.aC = function(T, b, m, _) { + _.reverse(), m?.pi(0, m.size, 1), m = T != null ? T[0] : NaN, _ = b != null ? b[0] : NaN, T != null && (T[0] = _), b != null && (b[0] = m); + }, H.aJ = function(T, b, m, _, C) { + T ? (_.N(m), C.N(b)) : (_.N(b), C.N(m)); + }, H.$I = function(T, b, m) { + return T ? (m.create(b.K()), b.copyTo(m.get()), m.get().reverse(), m.get()) : b; + }, H.Yi = function(T, b, m) { + if (isNaN(b)) { + for (; 3.141592653589793 < m[0] - T; ) + m[0] -= 6.283185307179586; + for (; 3.141592653589793 < T - m[0]; ) + m[0] += 6.283185307179586; + } else + 3.141592653589793 < m[0] + T - b ? m[0] -= 6.283185307179586 : 3.141592653589793 < b - (m[0] + T) && (m[0] += 6.283185307179586); + }, H.RW = function(T, b, m, _) { + 3.141592653589793 > Math.abs(b.x - T.x) ? (_.Ec(T), 3.141592653589793 <= m.x - T.x ? _.Sl(m.x - 6.283185307179586, m.y) : 3.141592653589793 <= T.x - m.x ? _.Sl(m.x + 6.283185307179586, m.y) : _.Sl(m.x, m.y)) : (_.Ec(m), 3.141592653589793 <= T.x - m.x ? _.Sl(T.x - 6.283185307179586, T.y) : 3.141592653589793 <= m.x - T.x ? _.Sl(T.x + 6.283185307179586, T.y) : _.Sl(T.x, T.y)); + }, H.TJ = function(T, b) { + for (var m = 0; m < T; m++) { + var _ = Math.ceil(m / 2) / (T + 1); + m % 2 != 0 && (_ = -_), b[m] = 0.5 + _; + } + }, H.Ou = function(T, b) { + return !!(A.s.$(T.y, 1.570796326794897) && !A.s.$(b.y, 1.570796326794897) || A.s.$(T.y, -1.570796326794897) && !A.s.$(b.y, -1.570796326794897)); + }, H.Mu = function(T, b) { + return !!(A.s.$(b.y, 1.570796326794897) && !A.s.$(T.y, 1.570796326794897) || A.s.$(b.y, -1.570796326794897) && !A.s.$(T.y, -1.570796326794897)); + }, H.AE = function(T, b, m) { + return !(!H.zE(T, b, m) || A.s.$(T.y, 1.570796326794897) || A.s.$(T.y, -1.570796326794897) || A.s.$(b.y, 1.570796326794897) || A.s.$(b.y, -1.570796326794897)); + }, H.zE = function(T, b, m) { + return Math.abs(Math.abs(T.x - b.x) - 3.141592653589793) <= m; + }, H.Nu = function(T, b) { + return !!(A.s.$(T.y, 1.570796326794897) && A.s.$(b.y, 1.570796326794897) || A.s.$(T.y, -1.570796326794897) && A.s.$(b.y, -1.570796326794897)); + }, H.fB = function(T, b, m, _) { + if (0 < T.y) { + var C = new A.h(); + C.na(b.x, 1.570796326794897); + } else + (C = new A.h()).na(b.x, -1.570796326794897); + A.s.$(T.x, C.x) || A.s.$(b.y, C.y) || (H.Of(_, C), m?.add(0)); + }, H.dB = function(T, b, m, _) { + if (0 < b.y) { + var C = new A.h(); + C.na(T.x, 1.570796326794897); + } else + (C = new A.h()).na(T.x, -1.570796326794897); + A.s.$(b.x, C.x) || A.s.$(T.y, C.y) || (H.Of(_, C), m?.add(1)); + }, H.eB = function(T, b, m, _, C, D, L) { + A.s.Dd(m) ? (0 < 1.570796326794897 - T.y && ((m = new A.h()).na(T.x, 1.570796326794897), H.Of(L, m), D?.add(_)), 0 < 1.570796326794897 - b.y && ((m = new A.h()).na(b.x, 1.570796326794897), H.Of(L, m), D?.add(_))) : (0 < 1.570796326794897 + T.y && ((m = new A.h()).na(T.x, -1.570796326794897), H.Of(L, m), D?.add(C)), 0 < 1.570796326794897 + b.y && ((m = new A.h()).na(b.x, -1.570796326794897), H.Of(L, m), D?.add(C))); + }, H.vU = function(T) { + if (-3.141592653589793 > T.x) + for (; -3.141592653589793 > T.x; ) + T.x += 6.283185307179586; + if (3.141592653589793 < T.x) + for (; 3.141592653589793 < T.x; ) + T.x -= 6.283185307179586; + }, H; + }(); + A.ej = ve; + }(le || (le = {})), function(A) { + A.kp = function() { + function ve() { + } + return ve.pj = function(H, T, b) { + if (H == null || T == null || !A.cb.Xc(T)) + throw A.i.O(); + if (H.B()) + return H; + var m = H, _ = m.K(); + if (A.ba.Ic(_)) { + m = A.Jh.nj(H, T), H = new A.l(), m.A(H), _ = A.ua.Xd(T, H, !1); + for (var C = A.cb.ih(T), D = Math.floor((H.v - C.v) / C.S()) * C.S() + C.v; D < H.C; ) + D > H.v + _ && D < H.C - _ && (m = A.Jh.ms(m, T, b, !0, D)), D += C.S(); + } else { + if (_ == 197) + return (H = new A.Ea(m.description)).bd(m, !1), ve.pj(H, T, b); + if (A.ba.zd(_)) + return (H = new A.Ua(m.description)).pc(m, !0), ve.pj(H, T, b); + } + return ve.Py(m, T); + }, ve.Py = function(H, T) { + if (H == null || T == null || !A.cb.Xc(T)) + throw A.i.O(); + if (H.B()) + return H; + var b = H.K(); + return b == 197 ? (b = new A.Ea(H.description)).bd(H, !1) : A.ba.zd(b) ? (b = new A.Ua(H.description)).pc(H, !0) : b = H, (b = A.Jh.nj(b, T)).B() ? b : A.Gg.Tb(T) == 1 ? A.Jh.Hn(b, T, 0, b != H, 0) : ve.IQ(b, T, b != H); + }, ve.IQ = function(H, T, b) { + if (!A.cb.Xc(T)) + throw A.i.O(); + if (H.B()) + return H; + var m = A.cb.bf(T), _ = -180 * m; + return m *= 360, A.Gg.Tb(T) == 2 && (m = (_ = A.cb.ih(T)).C, m -= _ = _.v), A.Jh.Jp(H, _, m, T, b, 0, !0); + }, ve; + }(); + }(le || (le = {})), function(A) { + A.xY = function() { + function ve() { + } + return ve.R = function(H) { + return 0 > H ? -H : H; + }, ve.Mb = function(H, T) { + return 0 <= T ? ve.R(H) : -ve.R(H); + }, ve.$ = function(H, T) { + return H == T || ve.R(H - T) <= ve.EC * (1 + (ve.R(H) + ve.R(T)) / 2); + }, ve.Dd = function(H) { + return H == 0 || ve.R(H) <= ve.EC; + }, ve.Ch = function(H, T) { + var b = (T = (1 - (T = Math.sqrt(1 - T))) / (1 + T)) * T; + return H / (1 + T) * (1 + b * (0.25 + b * (0.015625 + 1 / 256 * b))) * ve.zL; + }, ve.zL = 1.5707963267948966, ve.EC = 3552713678800501e-30, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function(T) { + this.Yf = T, this.Mk = this.Yf.getCode(), 0 > this.Mk && (this.Mk = 0); + }; + A.zY = ve; + var H = function() { + function T(b) { + b === void 0 && (b = null), this.Ej = null, this.Wn = !1, b !== null && (this.Ej = new ve(b)); + } + return T.prototype.Fc = function() { + return this.Ej != null ? this.Ej.Mk : 0; + }, T.prototype.Qf = function() { + var b = new T(); + return this.copyTo(b), b; + }, T.prototype.copyTo = function(b) { + b.Ej = this.Ej, b.Wn = this.Wn; + }, T.prototype.Lz = function() { + this.Wn = !this.Wn; + }, T.prototype.sm = function() { + return this.Ej != null ? this.Ej.Yf : null; + }, T.prototype.GJ = function(b) { + if (0 >= b) + throw A.i.O(); + if (b != this.Fc()) { + if ((b = A.qf.geogtran(b)) == null) + throw A.i.O("Geogtran not found."); + this.Ej = new ve(b); + } + }, T.prototype.wz = function() { + return this.Ej == null ? null : this.Ej.Yf.toString(); + }, T.prototype.pX = function(b) { + if (b == null) + throw A.i.O(); + var m = null; + try { + m = A.qf.fromString(A.Tc.PE_TYPE_GEOGTRAN, b); + } catch { + throw A.i.O(); + } + this.Ej = new ve(m); + }, T.prototype.Nb = function(b) { + return b == this || !(!(b instanceof T) || (0 >= this.Fc() || this.Fc() != b.Fc()) && !this.sm().isEqual(b.sm())) && this.Wn == b.Wn; + }, T.prototype.toString = function() { + var b = "GeographicTransformation: " + this.wz(); + return 200 < b.length ? b.substring(0, 197) + "... (" + b.length.toString() + " characters)" : b; + }, T.create = function(b, m) { + var _ = new T(); + return _.GJ(b), m && _.Lz(), _; + }, T.pP = function(b, m) { + var _ = new T(); + return _.pX(b), m && _.Lz(), _; + }, T; + }(); + A.Cx = H; + }(le || (le = {})), function(A) { + var ve = function() { + function T() { + } + return T.construct = function(b, m, _, C) { + var D = new T(); + return D.jw = b, D.kw = m, D.MY = _, D.NY = C, D; + }, T.zy = function(b, m) { + return b.jw == m.jw ? b.kw == m.kw ? 0 : b.kw < m.kw ? -1 : 1 : b.jw < m.jw ? -1 : 1; + }, T; + }(), H = function() { + function T() { + this.tT = [], this.uT = [], this.sp(); + } + return T.fz = function() { + return T.eK == null && (T.eK = new T()), T.eK; + }, T.prototype.sp = function() { + this.dD(this.tT), this.dD(this.uT); + }, T.prototype.dD = function(b) { + try { + var m = []; + m = m.sort(ve.zy); + for (var _ = 0; _ < m.length; _++) + b.push(m[_]); + } catch { + } + }, T; + }(); + A.yY = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.prototype.tD = function(T) { + this.Hk = T; + }, H.prototype.RM = function(T) { + this.Gb = T; + }, H.prototype.sD = function(T) { + this.Bo = T; + }, H.xE = function(T) { + return !(T.B() || T.K() != 1607 && T.K() != 1736); + }, H.vE = function(T) { + return !(T.B() || T.K() != 1607 && T.K() != 1736 || 20 > T.I()); + }, H.wE = function(T) { + return !(T.B() || T.K() != 1607 && T.K() != 1736 || 20 > T.I()); + }, H; + }(); + A.Wk = ve; + }(le || (le = {})), function(A) { + A.ac = function() { + function ve() { + } + return ve.OT = function(H) { + var T = new A.Ea(); + return T.rx(H.gs(), H.js()), T.Aj(H.gs(), H.hs()), T.Aj(H.fs(), H.hs()), T.Aj(H.fs(), H.js()), T; + }, ve.Bh = function(H, T) { + return H === null ? null : A.Gx.local().W(H, T, null); + }, ve.fY = function(H, T) { + var b = A.Ih.local(); + return H = new A.$c(H), b.W(H, T, null).next(); + }, ve.km = function(H, T, b) { + return A.mp.local().W(H, T, b, null); + }, ve.gp = function(H, T, b) { + return A.Jx.local().W(H, T, b, null); + }, ve.RX = function(H, T, b) { + var m = A.Jx.local(); + for (H = new A.$c(H), T = new A.$c(T), b = m.W(H, T, b, null), m = []; (T = b.next()) != null; ) + m.push(T); + return m; + }, ve.Nb = function(H, T, b) { + return A.fj.local().W(3, H, T, b, null); + }, ve.OP = function(H, T, b) { + return A.fj.local().W(4, H, T, b, null); + }, ve.MS = function(H, T, b) { + var m = A.Zj.local(); + for (H = new A.$c(H), T = new A.$c(T), b = m.W(H, T, b, null), m = []; (T = b.next()) != null; ) + m.push(T); + return m; + }, ve.LP = function(H, T, b) { + var m = A.mp.local(); + for (H = new A.$c(H), T = new A.$c(T), b = m.W(H, T, b, null), m = []; (T = b.next()) != null; ) + m.push(T); + return m; + }, ve.Fa = function(H, T, b) { + return A.Zj.local().W(H, T, b, null); + }, ve.LS = function(H, T, b) { + if ((H = A.Zj.local().W(H, T, b, null, 1)) === null) + return []; + if (H.K() === 550) { + for (T = [], b = 0; b < H.xa; b++) + T.push(H.FR(b)); + return T; + } + return H.K() === 33 ? [H] : []; + }, ve.mY = function(H, T, b) { + return A.fj.local().W(2, H, T, b, null); + }, ve.contains = function(H, T, b) { + return A.fj.local().W(1, H, T, b, null); + }, ve.wP = function(H, T, b) { + return A.fj.local().W(16, H, T, b, null); + }, ve.touches = function(H, T, b) { + return A.fj.local().W(8, H, T, b, null); + }, ve.yU = function(H, T, b) { + return A.fj.local().W(32, H, T, b, null); + }, ve.OS = function(H, T, b) { + return A.fj.local().W(1073741824, H, T, b, null); + }, ve.tB = function(H, T, b, m) { + return A.uL.local().W(H, T, b, m, null); + }, ve.ub = function(H, T, b, m) { + var _ = null; + if (b != null) { + if (_ = b.Id(), m != null && _.Fc() != m.Fc() && _.pd != m.pd) + throw A.i.Zk(); + } else if (m != null) + throw A.i.O(); + return H = A.lL.local().W(H, T, null), _ !== null && m !== null && (H = A.Uc.Ph(H, _, m)), H; + }, ve.clip = function(H, T, b) { + return A.fL.local().W(H, A.l.construct(T.gs(), T.js(), T.fs(), T.hs()), b, null); + }, ve.fl = function(H, T, b) { + if (H == null || T == null) + return null; + for (H = A.hL.local().W(!0, H, T, b, null), T = []; (b = H.next()) != null; ) + b.B() || T.push(b); + return T.slice(0); + }, ve.HN = function(H, T, b, m, _, C, D, L) { + if (_ === !0) + return ve.IN(H, T, b, m, C, D, L); + if (_ = b, T != null) { + if (D = T.Id(), m != null && D.Fc() != m.Fc()) { + if (D.pd != m.pd) + throw A.i.Zk(); + _ = [], A.Uc.SE(b, b.length, m, D, _); + } + } else if (m != null) + throw A.i.O(); + if (b = A.vC.local(), C) { + for (H = new A.$c(H), T = b.W(H, T, _, C, null), H = []; (C = T.next()) != null; ) + H.push(C); + C = H.slice(0); + } else + for (C = [], m = 0; m < H.length; m++) + C[m] = b.W(H[m], T, _[m], null); + return C; + }, ve.IN = function(H, T, b, m, _, C, D) { + if (T === null || (m == null && (m = T.Fc() !== 4326 ? T.Id() : A.Uc.ah(9001)), m.pd !== 0)) + throw A.i.O(); + if (A.Uc.SE(b, b.length, m, A.Uc.ah(9001), b), m = A.AC.local(), _) { + for (H = new A.$c(H), T = m.W(H, T, C, b, D, !1, _, null), b = []; (C = T.next()) != null; ) + b.push(C); + _ = b.slice(0); + } else { + _ = []; + for (var L = 0; L < H.length; L++) + _[L] = m.W(H[L], T, C, b[L], D, !1, null); + } + return _; + }, ve.buffer = function(H, T, b, m, _, C, D) { + var L = b; + if (_ === !1) { + if (T != null) { + if (_ = T.Id(), m != null && _.Fc() != m.Fc()) { + if (_.pd != m.pd) + throw A.i.Zk(); + L = A.Uc.Ph(b, m, _); + } + } else if (m != null) + throw A.i.O(); + H = A.vC.local().W(H, T, L, null); + } else { + if (T === null || (m == null && (m = T.Fc() !== 4326 ? T.Id() : A.Uc.ah(9001)), m.pd !== 0)) + throw A.i.O(); + L = A.Uc.Ph(b, m, A.Uc.ah(9001)), H = A.AC.local().W(H, T, C, L, D, !1, null); + } + return H; + }, ve.wU = function(H, T, b, m, _, C, D) { + if (T != null) { + var L = T.Id(); + if (D != null && L.Fc() != D.Fc()) { + if (L.pd != D.pd) + throw A.i.Zk(); + b = A.Uc.Ph(b, D, L); + } + } else if (D != null) + throw A.i.O(); + for (H = new A.$c(H), T = A.DC.local().W(H, T, b, m, _, C, null), b = []; (m = T.next()) != null; ) + b.push(m); + return b.slice(0); + }, ve.offset = function(H, T, b, m, _, C, D) { + if (T != null) { + var L = T.Id(); + if (D != null && L.Fc() != D.Fc()) { + if (L.pd != D.pd) + throw A.i.Zk(); + b = A.Uc.Ph(b, D, L); + } + } else if (D != null) + throw A.i.O(); + return A.DC.local().W(H, T, b, m, _, C, null); + }, ve.dP = function(H) { + return A.xC.local().W(H, null); + }, ve.eP = function(H, T) { + var b = A.xC.local(); + for (H = new A.$c(H), T = b.W(H, T, null), b = []; (H = T.next()) != null; ) + b.push(H); + return b; + }, ve.iz = function(H, T, b) { + return A.Hx.local().iz(H, T, b); + }, ve.jz = function(H, T) { + return A.Hx.local().jz(H, T); + }, ve.kz = function(H, T, b, m) { + return A.Hx.local().kz(H, T, b, m); + }, ve.$B = function(H, T) { + return A.$l.local().W(H, T, !1, null); + }, ve.ZS = function(H, T) { + return A.$l.local().ts(H, T, null); + }, ve.LQ = function(H, T, b, m, _) { + var C = A.zC.local(); + if (T != null) { + if (T = T.Id(), _ != null && T.Fc() != _.Fc()) { + if (T.pd != _.pd) + throw A.i.Zk(); + b = A.Uc.Ph(b, _, T); + } + } else if (_ != null) + throw A.i.O(); + return C.W(H, b, m, null); + }, ve.Sr = function(H, T, b, m) { + var _ = A.Zl.local(); + if (T != null) { + if (T = T.Id(), m != null && T.Fc() != m.Fc()) { + if (T.pd != m.pd) + throw A.i.Zk(); + b = A.Uc.Ph(b, m, T); + } + } else if (m != null) + throw A.i.O(); + return _.W(H, b, null); + }, ve.Ry = function(H, T, b, m, _) { + _ === void 0 && (_ = 0); + var C = A.nL.local(); + if (_ == 4 || _ !== 0) + throw A.i.Fe(); + if (m !== null) { + if (m.pd !== 0) + throw A.i.O("Unit must be a linear unit type"); + b = A.Uc.Ph(b, m, A.Uc.ah(9001)); + } + return C.W(H, b, T, _, null); + }, ve.RQ = function(H, T, b, m) { + if (H === null) + return 0; + if (m == 4 || m !== 0) + throw A.i.Fe(); + if (H.K() == 197) + H = ve.OT(H); + else if (H.K() != 1736) + return 0; + if (m = A.cb.tc(T), H = A.cb.Bh(H, T, m), H = A.PK.SQ([H])[0], b !== null) { + if (b.pd !== 2) + throw A.i.O("Unit must be a area unit type"); + H = A.Uc.Ph(H, A.Uc.ah(109404), b); + } + return H; + }, ve.UQ = function(H, T, b, m) { + if (H = A.qL.local().W(H, T, m, null), b !== null) { + if (b.pd !== 0) + throw A.i.O("Unit must be a linear unit type"); + H = A.Uc.Ph(H, A.Uc.ah(9001), b); + } + return H; + }, ve.EU = function(H, T, b) { + if (H === null) + return 0; + var m = null; + if (T != null) { + if ((m = T.Id()).pd == 0 && (m = A.Uc.WF(m)) == null && b !== null) + throw A.i.O(); + if (b != null && m.Fc() != b.Fc() && m.pd != b.pd) + throw A.i.Zk(); + } else if (b != null) + throw A.i.O(); + return H.K() == 1736 || H.K() == 197 ? (H = H.He(), b !== null ? A.Uc.Ph(H, m, b) : H) : 0; + }, ve.FU = function(H, T, b) { + if (H === null || H.B() || 1 > H.Eb()) + return 0; + var m = null; + if (T != null) { + if (m = T.Id(), b != null && m.Fc() != b.Fc() && m.pd != b.pd) + throw A.i.Zk(); + } else if (b != null) + throw A.i.O(); + H.K() == 1736 || H.K() == 197 ? T = H.ng() : A.ba.zd(H.K()) ? (T = new A.Ua(H.description)).pc(H, !0) : T = H, H = 0, T = T.Ha(); + for (var _ = new A.h(), C = new A.h(); T.ab(); ) + for (; T.Ia(); ) { + var D = T.ia(); + D.$p(_), D.Vr(C), H += A.h.ub(_, C); + } + return m !== null && b !== null && (H = A.Uc.Ph(H, m, b)), H; + }, ve.aP = function(H) { + return H.points !== void 0 ? ve.hS(H, H.hasZ !== void 0 && H.hasZ, H.hasM !== void 0 && H.hasM) : H.rings !== void 0 ? ve.gG(H.rings, H.hasZ !== void 0 && H.hasZ, H.hasM !== void 0 && H.hasM, "P") : H.paths !== void 0 ? ve.gG(H.paths, H.hasZ !== void 0 && H.hasZ, H.hasM !== void 0 && H.hasM, "L") : H.x !== void 0 ? ve.iS(H) : H.xmin !== void 0 ? ve.gS(H) : null; + }, ve.iS = function(H) { + if (H.x == null || H.x == "NaN") + return new A.Ta(); + var T = new A.Ta(H.x, H.y); + return H.z !== void 0 && H.z !== null && T.sX(H.z), H.m !== void 0 && H.m !== null && T.cX(H.m), T; + }, ve.gS = function(H) { + if (H.xmin == null || H.xmin == "NaN") + return new A.Hh(); + var T = new A.Hh(H.xmin, H.ymin, H.xmax, H.ymax); + return H.zmin !== void 0 && H.zmin !== null && T.setInterval(1, 0, H.zmin, H.zmax), H.mmin !== void 0 && H.mmin !== null && T.setInterval(2, 0, H.mmin, H.mmax), T; + }, ve.hS = function(H, T, b) { + var m = 0, _ = new A.ee(), C = 3 * H.points.length; + C % 2 != 0 && C++, 2 > C && (C = 2); + var D = A.P.truncate(3 * H.points.length / 2); + 4 > D ? D = 4 : 16 > D && (D = 16), C = A.Zc.Fn(C, 0); + var L = A.Zc.Fn(D); + D = A.Zc.Fn(D); + for (var B = 0; B < H.points.length; B++) + C.write(2 * B, H.points[B][0]), C.write(2 * B + 1, H.points[B][1]), L.write(B, T || b ? H.points[B][2] : NaN), D.write(B, b && T ? H.points[B][3] : NaN), m++; + return m != 0 && (_.resize(m), _.kn(0, C)), T && (_.se(1), _.kn(1, L)), b && (_.se(2), _.kn(2, T == 0 ? L : D)), _.Qc(16777215), _; + }, ve.gG = function(H, T, b, m) { + var _ = 0, C = 2; + if (m == "P") { + var D = new A.Ea(); + _ = 1, C = 3; + } else + D = new A.Ua(); + for (var L = A.Zc.Qh(0), B = A.Zc.Or(0), q = 0, Z = 0, ie = [], se = [], de = 0; de < H.length; de++) { + var Ce = H[de].length; + if (ie[de] = !1, m === "P" && H[de][0][0] === H[de][H[de].length - 1][0] && H[de][0][1] === H[de][H[de].length - 1][1]) { + var Ve = b == 0 || H[de][0][3] === H[de][H[de].length - 1][3] || H[de][0][3] === void 0 && H[de][H[de].length - 1][3] === void 0; + (T == 0 || H[de][0][2] === H[de][H[de].length - 1][2] || H[de][0][2] === void 0 && H[de][H[de].length - 1][2] === void 0) && Ve && (ie[de] = !0, --Ce); + } + Ce >= C ? (se[de] = !1, Z += 1, L.add(q), B.add(_), q += Ce) : se[de] = !0; + } + for ((m = 3 * q) % 2 != 0 && m++, 2 > m && (m = 2), 4 > (de = A.P.truncate(3 * q / 2)) ? de = 4 : 16 > de && (de = 16), m = A.Zc.Fn(m, 0), _ = A.Zc.Fn(de), C = A.Zc.Fn(de), de = Ce = 0; de < H.length; de++) + if (se[de] === !1) + for (Ve = 0; Ve < H[de].length; Ve++) { + var Je = !1; + Ve === H[de].length - 1 && ie[de] === !0 && (Je = !0), Je || (m.write(2 * Ce, H[de][Ve][0]), m.write(2 * Ce + 1, H[de][Ve][1]), _.write(Ce, T || b ? H[de][Ve][2] : NaN), C.write(Ce, b && T ? H[de][Ve][3] : NaN), Ce++); + } + return q != 0 && (H = D, L.resize(Z), B.resize(Z), 0 < q && (L.add(q), B.add(0)), H.kn(0, m), H.KJ(B), H.LJ(L)), T && (D.se(1), D.kn(1, _)), b && (D.se(2), D.kn(2, T == 0 ? _ : C)), D.Qc(16777215), D; + }, ve; + }(); + }(le || (le = {})), function(A) { + A.Dx = function() { + function ve() { + } + return ve.dr = function(H) { + var T, b = 0, m = H.length, _ = H[0]; + for (T = 0; T < m - 1; T++) { + var C = H[T + 1]; + b += (C[0] - _[0]) * (C[1] + _[1]), _ = C; + } + return 0 <= b; + }, ve.rotate = function(H, T, b) { + T = T * Math.PI / 180; + var m = Math.cos(T), _ = Math.sin(T); + if (H.paths !== void 0) { + T = { paths: [] }; + for (var C = 0; C < H.paths.length; C++) { + for (var D = H.paths[C], L = [], B = 0; B < D.length; B++) { + var q = D[B].slice(0); + L.push(q); + var Z = m * (D[B][0] - b.x) - _ * (D[B][1] - b.y) + b.x, ie = _ * (D[B][0] - b.x) + m * (D[B][1] - b.y) + b.y; + q[0] = Z, q[1] = ie; + } + T.paths.push(L), H.hasZ !== void 0 && (T.hasZ = H.hasZ), H.hasM !== void 0 && (T.hasM = H.hasM); + } + return T; + } + if (H.rings !== void 0) { + for (T = { rings: [] }, C = 0; C < H.rings.length; C++) { + D = H.rings[C], L = []; + var se = ve.dr(D); + for (B = 0; B < D.length; B++) + q = D[B].slice(0), L.push(q), Z = m * (D[B][0] - b.x) - _ * (D[B][1] - b.y) + b.x, ie = _ * (D[B][0] - b.x) + m * (D[B][1] - b.y) + b.y, q[0] = Z, q[1] = ie; + ve.dr(L) !== se && L.reverse(), T.rings.push(L), H.hasZ !== void 0 && (T.hasZ = H.hasZ), H.hasM !== void 0 && (T.hasM = H.hasM); + } + return T; + } + if (H.x !== void 0) + return T = { x: m * (H.x - b.x) - _ * (H.y - b.y) + b.x, y: _ * (H.x - b.x) + m * (H.y - b.y) + b.y }, H.z !== void 0 && (T.z = H.z), H.m !== void 0 && (T.m = H.m), H.hasZ !== void 0 && (T.hasZ = H.hasZ), H.hasM !== void 0 && (T.hasM = H.hasM), T; + if (H.points !== void 0) { + for (T = { points: [] }, C = H.points, B = 0; B < C.length; B++) + (D = C[B].slice(0))[0] = m * (C[B][0] - b.x) - _ * (C[B][1] - b.y) + b.x, D[1] = _ * (C[B][0] - b.x) + m * (C[B][1] - b.y) + b.y, T.points.push(D); + return H.hasZ !== void 0 && (T.hasZ = H.hasZ), H.hasM !== void 0 && (T.hasM = H.hasM), T; + } + return null; + }, ve.EQ = function(H, T) { + if (H.paths !== void 0) { + for (var b = { paths: [] }, m = 0; m < H.paths.length; m++) { + for (var _ = H.paths[m], C = [], D = 0; D < _.length; D++) { + var L = _[D].slice(0); + C.push(L); + var B = T.x - _[D][0]; + L[0] = _[D][0] + 2 * B; + } + b.paths.push(C); + } + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + if (H.rings !== void 0) { + for (b = { rings: [] }, m = 0; m < H.rings.length; m++) { + _ = H.rings[m]; + var q = ve.dr(_); + for (C = [], D = 0; D < _.length; D++) + L = _[D].slice(0), C.push(L), B = T.x - _[D][0], L[0] = _[D][0] + 2 * B; + ve.dr(C) !== q && C.reverse(), b.rings.push(C); + } + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + if (H.x !== void 0) + return B = T.x - H.x, b = { x: H.x + 2 * B, y: H.y }, H.z !== void 0 && (b.z = H.z), H.m !== void 0 && (b.m = H.m), H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + if (H.points !== void 0) { + for (b = { points: [] }, m = H.points, D = 0; D < m.length; D++) + _ = m[D].slice(0), B = T.x - _[0], _[0] += 2 * B, b.points.push(_); + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + return H.xmin !== void 0 ? (b = { v: H.xmin, G: H.ymin, C: H.xmax, H: H.ymax }, H.zmin !== void 0 && (b.zmin = H.zmin, b.zmax = H.zmax), H.mmin !== void 0 && (b.mmin = H.mmin, b.mmax = H.mmax), B = T.x - H.xmin, b.xmax = H.xmin + 2 * B, B = T.x - H.xmax, b.xmin = H.xmax + 2 * B, H.zmin !== void 0 && (b.zmin = H.zmin), H.zmax !== void 0 && (b.zmax = H.zmax), H.mmin !== void 0 && (b.mmin = H.mmin), H.mmax !== void 0 && (b.mmax = H.mmax), H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b) : null; + }, ve.FQ = function(H, T) { + if (H.paths !== void 0) { + for (var b = { paths: [] }, m = 0; m < H.paths.length; m++) { + for (var _ = H.paths[m], C = [], D = 0; D < _.length; D++) { + var L = _[D].slice(0); + C.push(L); + var B = T.y - _[D][1]; + L[1] = _[D][1] + 2 * B; + } + b.paths.push(C); + } + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + if (H.rings !== void 0) { + for (b = { rings: [] }, m = 0; m < H.rings.length; m++) { + _ = H.rings[m]; + var q = ve.dr(_); + for (C = [], D = 0; D < _.length; D++) + L = _[D].slice(0), C.push(L), B = T.y - _[D][1], L[1] = _[D][1] + 2 * B; + ve.dr(C) !== q && C.reverse(), b.rings.push(C); + } + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + if (H.x !== void 0) + return B = T.y - H.y, b = { y: H.y + 2 * B, x: H.x }, H.z !== void 0 && (b.z = H.z), H.m !== void 0 && (b.m = H.m), H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + if (H.points !== void 0) { + for (b = { points: [] }, m = H.points, D = 0; D < m.length; D++) + _ = m[D].slice(0), B = T.y - _[1], _[1] += 2 * B, b.points.push(_); + return H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b; + } + return H.xmin !== void 0 ? (b = { v: H.xmin, G: H.ymin, C: H.xmax, H: H.ymax }, H.zmin !== void 0 && (b.zmin = H.zmin, b.zmax = H.zmax), H.mmin !== void 0 && (b.mmin = H.mmin, b.mmax = H.mmax), B = T.y - H.ymin, b.ymax = H.ymin + 2 * B, B = T.y - H.ymax, b.ymin = H.ymax + 2 * B, H.zmin !== void 0 && (b.zmin = H.zmin), H.zmax !== void 0 && (b.zmax = H.zmax), H.mmin !== void 0 && (b.mmin = H.mmin), H.mmax !== void 0 && (b.mmax = H.mmax), H.hasZ !== void 0 && (b.hasZ = H.hasZ), H.hasM !== void 0 && (b.hasM = H.hasM), b) : null; + }, ve; + }(); + }(le || (le = {})), function(A) { + A.UK = function() { + function ve() { + } + return ve.Kg = function(H, T) { + switch (T == null && (T = A.fe.pg()), H) { + case 33: + return new A.Ta(T); + case 322: + return new A.zb(T); + case 197: + return new A.Hh(T); + case 550: + return new A.ee(T); + case 1607: + return new A.Ua(T); + case 1736: + return new A.Ea(T); + default: + throw A.i.ga("invalid argument."); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b) { + this.Qe = A.ja.rf(T, -1), this.va = new A.cu(), this.yl = b; + } + return H.prototype.vW = function(T) { + this.va.Bt(Math.min(this.Qe.size, T)), this.va.hn(T); + }, H.prototype.addElement = function(T, b) { + if (b === void 0) + return this.$M(T); + b = A.P.truncate(b % this.Qe.size); + var m = this.Qe.get(b); + return m == -1 && (m = this.va.Rh(), this.Qe.set(b, m)), this.va.addElement(m, T); + }, H.prototype.$M = function(T) { + var b = this.yl.ez(T); + b = A.P.truncate(b % this.Qe.size); + var m = this.Qe.get(b); + return m == -1 && (m = this.va.Rh(), this.Qe.set(b, m)), this.va.addElement(m, T); + }, H.prototype.kd = function(T, b) { + if (b === void 0) + this.FP(T); + else { + b = A.P.truncate(b % this.Qe.size); + var m = this.Qe.get(b); + if (m == -1) + throw A.i.O(); + for (var _ = this.va.sc(m), C = -1; _ != -1; ) { + var D = this.va.lb(_); + this.va.ka(_) == T ? (this.va.kd(m, C, _), this.va.sc(m) == -1 && (this.va.eh(m), this.Qe.set(b, -1))) : C = _, _ = D; + } + } + }, H.prototype.FP = function(T) { + var b = this.yl.ez(T); + b = A.P.truncate(b % this.Qe.size); + var m = this.Qe.get(b); + if (m == -1) + throw A.i.O(); + for (var _ = this.va.sc(m), C = -1; _ != -1; ) { + var D = this.va.lb(_); + this.va.ka(_) == T ? (this.va.kd(m, C, _), this.va.sc(m) == -1 && (this.va.eh(m), this.Qe.set(b, -1))) : C = _, _ = D; + } + }, H.prototype.lR = function(T) { + return T = A.P.truncate(T % this.Qe.size), (T = this.Qe.get(T)) == -1 ? -1 : this.va.sc(T); + }, H.prototype.zR = function(T) { + return this.va.lb(T); + }, H.prototype.wd = function(T) { + var b = this.yl.ez(this.ka(T)); + b = A.P.truncate(b % this.Qe.size); + var m = this.Qe.get(b); + if (m == -1) + throw A.i.O(); + for (var _ = this.va.sc(m), C = -1; _ != -1; ) { + if (_ == T) + return this.va.kd(m, C, _), void (this.va.sc(m) == -1 && (this.va.eh(m), this.Qe.set(b, -1))); + C = _, _ = this.va.lb(_); + } + throw A.i.O(); + }, H.prototype.ka = function(T) { + return this.va.ka(T); + }, H.prototype.clear = function() { + this.Qe = A.ja.rf(this.Qe.size, -1), this.va.clear(); + }, H.prototype.size = function() { + return this.va.OF(); + }, H; + }(); + A.ZK = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.Ni = new A.ad(3), this.va = new A.ad(6), this.mT = !1, this.ke = -1; + } + return H.prototype.hl = function(T) { + this.Ni.kd(T); + }, H.prototype.Rw = function() { + return this.Ni.De(); + }, H.prototype.dv = function(T) { + this.va.kd(T); + }, H.prototype.VA = function() { + return this.va.De(); + }, H.prototype.RB = function(T, b) { + this.Ni.T(T, 1, b); + }, H.prototype.fx = function(T, b) { + this.Ni.T(T, 2, b); + }, H.prototype.bX = function(T, b) { + this.Ni.T(T, 3, b); + }, H.prototype.PB = function(T, b) { + this.va.T(T, 4, b); + }, H.prototype.eX = function(T, b) { + this.va.T(T, 3, b); + }, H.prototype.OJ = function(T, b) { + this.va.T(T, 2, b); + }, H.prototype.Rh = function(T) { + var b = this.VA(); + return this.va.T(b, 3, this.ke), this.va.T(b, 4, 0), this.va.T(b, 5, T), this.ke != -1 && this.OJ(this.ke, b), this.ke = b; + }, H.prototype.eh = function(T) { + this.GE(T); + var b = this.va.U(T, 2), m = this.va.U(T, 3); + return b != -1 ? this.eX(b, m) : this.ke = m, m != -1 && this.OJ(m, b), this.dv(T), m; + }, H.prototype.Bt = function(T) { + this.va.Ee(T); + }, H.prototype.KF = function(T) { + return this.va.U(T, 5); + }, H.prototype.aX = function(T, b) { + this.va.T(T, 5, b); + }, H.prototype.addElement = function(T, b) { + return this.oS(T, b); + }, H.prototype.oS = function(T, b) { + var m = this.Rw(); + this.fx(m, -1), this.va.U(T, 0) == -1 && this.va.T(T, 0, m); + var _ = this.va.U(T, 1); + return this.RB(m, _), _ != -1 && this.fx(_, m), this.va.T(T, 1, m), this.setData(m, b), this.PB(T, this.ds(T) + 1), this.mT && this.bX(m, T), m; + }, H.prototype.kd = function(T, b) { + var m = this.xe(b), _ = this.lb(b); + return m != -1 ? this.fx(m, _) : this.va.T(T, 0, _), _ != -1 ? this.RB(_, m) : this.va.T(T, 1, m), this.hl(b), this.PB(T, this.ds(T) - 1), _; + }, H.prototype.hn = function(T) { + this.Ni.Ee(T); + }, H.prototype.getData = function(T) { + return this.Ni.U(T, 0); + }, H.prototype.setData = function(T, b) { + this.Ni.T(T, 0, b); + }, H.prototype.lb = function(T) { + return this.Ni.U(T, 2); + }, H.prototype.xe = function(T) { + return this.Ni.U(T, 1); + }, H.prototype.sc = function(T) { + return this.va.U(T, 0); + }, H.prototype.Gc = function(T) { + return this.va.U(T, 1); + }, H.prototype.clear = function() { + for (var T = this.ke; T != -1; ) + T = this.eh(T); + }, H.prototype.GE = function(T) { + for (var b = this.Gc(T); b != -1; ) { + var m = b; + b = this.xe(m), this.hl(m); + } + this.va.T(T, 0, -1), this.va.T(T, 1, -1), this.PB(T, 0); + }, H.prototype.B = function() { + return this.Ni.size == 0; + }, H.prototype.OF = function() { + return this.Ni.size; + }, H.prototype.ds = function(T) { + return this.va.U(T, 4); + }, H.prototype.lz = function(T) { + return this.va.U(T, 3); + }, H; + }(); + A.lp = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + T === void 0 ? (this.vg = new A.ad(2), this.va = new A.ad(4), this.ke = -1, this.Sv = !0) : (this.vg = new A.ad(2), this.va = new A.ad(T ? 4 : 2), this.ke = -1, this.Sv = T); + } + return H.prototype.hl = function(T) { + this.vg.kd(T); + }, H.prototype.Rw = function() { + return this.vg.De(); + }, H.prototype.dv = function(T) { + this.va.kd(T); + }, H.prototype.VA = function() { + return this.va.De(); + }, H.prototype.Rh = function() { + var T = this.VA(); + return this.Sv && (this.va.T(T, 3, this.ke), this.ke != -1 && this.va.T(this.ke, 2, T), this.ke = T), T; + }, H.prototype.eh = function(T) { + for (var b = this.sc(T); b != -1; ) { + var m = b; + b = this.lb(b), this.hl(m); + } + this.Sv && (b = this.va.U(T, 2), m = this.va.U(T, 3), b != -1 ? this.va.T(b, 3, m) : this.ke = m, m != -1 && this.va.T(m, 2, b)), this.dv(T); + }, H.prototype.Bt = function(T) { + this.va.Ee(T); + }, H.prototype.addElement = function(T, b) { + var m = this.va.U(T, 1), _ = this.Rw(); + return m != -1 ? this.vg.T(m, 1, _) : this.va.T(T, 0, _), this.va.T(T, 1, _), this.vg.T(_, 0, b), _; + }, H.prototype.hn = function(T) { + this.vg.Ee(T); + }, H.prototype.kd = function(T, b, m) { + b != -1 ? (this.vg.T(b, 1, this.vg.U(m, 1)), this.va.U(T, 1) == m && this.va.T(T, 1, b)) : (this.va.T(T, 0, this.vg.U(m, 1)), this.va.U(T, 1) == m && this.va.T(T, 1, -1)), this.hl(m); + }, H.prototype.Cy = function(T, b) { + var m = this.va.U(T, 1), _ = this.va.U(b, 0); + _ != -1 && (m != -1 ? this.vg.T(m, 1, _) : this.va.T(T, 0, _), this.va.T(T, 1, this.va.U(b, 1))), this.Sv && (T = this.va.U(b, 2), m = this.va.U(b, 3), T != -1 ? this.va.T(T, 3, m) : this.ke = m, m != -1 && this.va.T(m, 2, T)), this.dv(b); + }, H.prototype.ka = function(T) { + return this.vg.U(T, 0); + }, H.prototype.Uj = function(T, b) { + this.vg.T(T, 0, b); + }, H.prototype.lb = function(T) { + return this.vg.U(T, 1); + }, H.prototype.sc = function(T) { + return this.va.U(T, 0); + }, H.prototype.Ln = function(T) { + return this.ka(this.sc(T)); + }, H.prototype.clear = function() { + this.vg.oj(!0), this.va.oj(!0), this.ke = -1; + }, H.prototype.B = function() { + return this.vg.size == 0; + }, H.prototype.OF = function() { + return this.vg.size; + }, H.prototype.lz = function(T) { + return this.va.U(T, 3); + }, H; + }(); + A.cu = ve; + }(le || (le = {})), function(A) { + A.ua = function() { + function ve() { + } + return ve.Xd = function(H, T, b) { + return T = T.zr(), H = H != null && H.Yd !== void 0 ? H.Yd(0) : 0, b && (T *= 4, H *= 1.1), Math.max(H, T); + }, ve.Gr = function(H) { + return 2 * Math.sqrt(2) * H; + }, ve.mN = function(H) { + return Math.sqrt(2) * H; + }, ve.mj = function(H, T, b) { + var m = new A.l(); + return T.A(m), ve.Xd(H, m, b); + }, ve.rE = function(H, T, b) { + return T = T.Vg(1, 0).zr(), H = H != null ? H.Yd(1) : 0, b && (T *= 4, H *= 1.1), Math.max(H, T); + }, ve.ov = function(H, T) { + var b = new A.l(); + return H.yc(b), H = new A.l(), T.yc(H), b.$b(H), b; + }, ve.TN = function(H) { + var T = new A.l(); + if (H.yc(T), T.B()) + return null; + var b = new A.fu(T, 8), m = -1, _ = new A.l(), C = !1; + do + for (var D = 0, L = H.ea(); D < L; D++) { + if (H.Tj(D, _), (m = b.Ez(D, _, m)) == -1) { + if (C) + throw A.i.ga("internal error"); + H.Ap(T, !1), C = !0, b.reset(T, 8); + break; + } + C = !1; + } + while (C); + return b; + }, ve.iE = function(H) { + var T = new A.l(); + H.yc(T); + for (var b = new A.fu(T, 8), m = -1, _ = H.Ha(), C = new A.l(), D = !1; _.ab(); ) + for (; _.Ia(); ) { + var L = _.ia(), B = _.xb(); + if (L.A(C), (m = b.Ez(B, C, m)) == -1) { + if (D) + throw A.i.Ra(); + H.Ap(T, !1), D = !0, b.reset(T, 8), _.aj(); + break; + } + } + return b; + }, ve.lj = function(H, T) { + var b = new A.l(); + H.yc(b); + for (var m = new A.fu(b, 8), _ = -1, C = new A.l(), D = H.Ha(), L = !1; D.ab(); ) + for (; D.Ia(); ) { + var B = D.ia(), q = D.xb(); + if (B.A(C), C.isIntersecting(T) && (_ = m.Ez(q, C, _)) == -1) { + if (L) + throw A.i.ga("internal error."); + H.Ap(b, !1), L = !0, m.reset(b, 8), D.aj(); + break; + } + } + return m; + }, ve.jE = function(H, T) { + for (var b = new A.fu(T, 8), m = new A.h(), _ = !1, C = new A.l(), D = 0; D < H.I(); D++) + if (H.D(D, m), T.contains(m) && (C.L(m), b.xj(D, C) == -1)) { + if (_) + throw A.i.Ra(); + _ = !0, D = new A.l(), H.Ap(D, !1), b.reset(D, 8), D = -1; + } + return b; + }, ve.gR = function(H, T, b) { + var m = new A.l(), _ = new A.l(); + H.yc(m), T.yc(_), m.X(b, b), _.X(b, b); + var C = new A.l(); + C.L(m), C.Fa(_), H = H.Ha(), T = T.Ha(); + var D = new A.sC(); + D.WB(b); + var L = !1; + for (D.kK(); H.ab(); ) + for (; H.Ia(); ) + H.ia().A(m), m.isIntersecting(C) && (L = !0, (b = new A.l()).L(m), D.DD(H.xb(), b)); + if (D.dF(), !L) + return null; + for (m = !1, D.jK(); T.ab(); ) + for (; T.Ia(); ) + T.ia().A(_), _.isIntersecting(C) && (m = !0, (b = new A.l()).L(_), D.zD(T.xb(), b)); + return D.cF(), m ? D : null; + }, ve.hR = function(H, T, b, m, _) { + var C = H.K(), D = T.K(), L = new A.l(), B = new A.l(); + H.yc(L), T.yc(B), L.X(b, b), B.X(b, b); + var q = new A.l(); + q.L(L), q.Fa(B); + var Z = new A.sC(); + Z.WB(b); + var ie = !1; + Z.kK(); + var se = 0; + for (b = H.ea(); se < b; se++) + m && C == 1736 && !H.Gv(se) || (H.Tj(se, L), L.isIntersecting(q) && (ie = !0, Z.DD(se, L))); + if (Z.dF(), !ie) + return null; + for (H = !1, Z.jK(), m = 0, b = T.ea(); m < b; m++) + _ && D == 1736 && !T.Gv(m) || (T.Tj(m, B), B.isIntersecting(q) && (H = !0, Z.zD(m, B))); + return Z.cF(), H ? Z : null; + }, ve.Tu = function(H, T, b) { + if (H != T) + for (var m = 0; m < b; m++) + H[m] == null ? H[m] = A.h.cl(T[m]) : H[m].N(T[m]); + }, ve.Ey = function(H, T, b, m) { + var _ = 0; + for (m += 0; _ < m; b++, _++) + H[_] == null && (H[_] = [0, 0]), H[_][0] = T[b].x, H[_][1] = T[b].y; + }, ve.Dy = function(H, T, b, m) { + var _ = T, C = 0; + for (T = m + T; _ < T; C++, _++) + H[_] == null ? H[_] = A.h.construct(b[C][0], b[C][1]) : H[_].na(b[C][0], b[C][1]); + }, ve.fP = function(H, T, b) { + if (H != T) + for (var m = 0; m < b; m++) + H[m] == null ? H[m] = new A.Ta(T[m]) : T[m].copyTo(H[m]); + }, ve.qE = function(H, T, b, m) { + var _ = 0; + return H != null && (_ = H.Yd(0), m && !b || H == null || (_ += 1.01 * H.pz(0))), b && (T *= 4, _ *= 1.01), Math.max(_, T); + }, ve.oy = function(H, T, b) { + return ve.qE(H, T.zr(), b, !1); + }, ve.bO = function(H, T) { + var b = new A.l(); + return T.A(b), ve.oy(H, b, !0); + }, ve.py = function(H, T) { + return ve.qE(H, T.zr(), !1, !0); + }, ve.Ju = function(H, T) { + var b = new A.l(); + return T.A(b), ve.py(H, b); + }, ve.vG = function(H, T, b, m) { + m *= m; + var _ = new A.h(); + if (_.vc(H, T), (H = new A.h()).vc(b, T), T = _.Uk(), b = H.Uk(), T <= m && b <= m) + return !0; + var C = A.mc.ox(_.yi(H)); + return (C <= m * T || C <= m * b) && 0 <= _.Sh(H); + }, ve.ZJ = function(H, T, b, m) { + for (var _ = 0; _ < T; _++) { + var C = H[_].y, D = A.P.Tk(C, b, m); + D != C && (H[_].y = D); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve, H, T = function() { + function C(D) { + this.Za = D; + } + return C.prototype.compare = function(D, L, B) { + D = D.ka(B), B = this.Za.qk(L); + var q = this.Za.qk(D); + return B < q ? -1 : B == q ? _.iq(L) && _.Iv(D) ? -1 : _.iq(D) && _.Iv(L) ? 1 : 0 : 1; + }, C; + }(), b = function() { + function C(D) { + this.Za = D; + } + return C.prototype.qr = function(D, L, B) { + this.Za.CX(B, D, L); + }, C.prototype.bq = function(D) { + return this.Za.qk(D); + }, C; + }(); + (H = ve || (ve = {}))[H.initialize = 0] = "initialize", H[H.pIn = 1] = "pIn", H[H.pL = 2] = "pL", H[H.pR = 3] = "pR", H[H.pT = 4] = "pT", H[H.right = 5] = "right", H[H.left = 6] = "left", H[H.all = 7] = "all"; + var m = function() { + function C() { + this.Za = null, this.Si = new A.Oc(), this.ji = new A.ja(0), this.tg = [0, 0]; + } + return C.prototype.Zi = function(D, L) { + this.Si.pa = D.pa - L, this.Si.wa = D.wa + L, this.ji.resize(0), this.ie = 0, this.tg[0] = 0; + }, C.prototype.zB = function(D, L, B) { + if (D > L) + throw A.i.O(); + this.Si.pa = D - B, this.Si.wa = L + B, this.ji.resize(0), this.ie = 0, this.tg[0] = 0; + }, C.prototype.Wo = function(D, L) { + this.Si.pa = D - L, this.Si.wa = D + L, this.ji.resize(0), this.ie = 0, this.tg[0] = 0; + }, C.prototype.next = function() { + if (!this.Za.nq) + throw A.i.Hb(); + if (0 > this.ie) + return -1; + for (var D = !0; D; ) + switch (this.tg[this.ie]) { + case 1: + D = this.AU(); + break; + case 2: + D = this.BU(); + break; + case 3: + D = this.CU(); + break; + case 4: + D = this.DU(); + break; + case 5: + D = this.AW(); + break; + case 6: + D = this.fT(); + break; + case 7: + D = this.oN(); + break; + case 0: + D = this.Bz(); + break; + default: + throw A.i.Ra(); + } + return this.Qg != -1 ? this.Op() >> 1 : -1; + }, C.construct = function(D) { + var L = new C(); + return L.Za = D, L.ji.Jb(20), L.ie = -1, L; + }, C.prototype.Bz = function() { + return this.Qg = this.qH = this.Oi = this.Mc = -1, this.Za.ne != null && 0 < this.Za.ne.size ? (this.tg[0] = 1, this.Oi = this.Za.kf, !0) : (this.ie = -1, !1); + }, C.prototype.AU = function() { + if (this.Mc = this.Oi, this.Mc == -1) + return this.Qg = this.ie = -1, !1; + var D = this.Za.Pp(this.Mc); + return this.Si.wa < D ? (D = this.Za.pk(this.Mc), this.Oi = this.Za.sj(this.Mc), D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 6), !0) : D < this.Si.pa ? (D = this.Za.pk(this.Mc), this.Oi = this.Za.nk(this.Mc), D != -1 && (this.gi = this.Za.bs(D), this.tg[++this.ie] = 5), !0) : (this.tg[this.ie] = 2, this.qH = this.Mc, D = this.Za.pk(this.Mc), this.Oi = this.Za.sj(this.Mc), D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 7), !0); + }, C.prototype.BU = function() { + if (this.Mc = this.Oi, this.Mc == -1) + return this.tg[this.ie] = 3, this.Oi = this.Za.nk(this.qH), !0; + if (this.Za.Pp(this.Mc) < this.Si.pa) { + var D = this.Za.pk(this.Mc); + return this.Oi = this.Za.nk(this.Mc), D != -1 && (this.gi = this.Za.bs(D), this.tg[++this.ie] = 5), !0; + } + return D = this.Za.pk(this.Mc), this.Oi = this.Za.sj(this.Mc), D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 7), (D = this.Za.nk(this.Mc)) != -1 && this.ji.add(D), !0; + }, C.prototype.CU = function() { + if (this.Mc = this.Oi, this.Mc == -1) + return this.tg[this.ie] = 4, !0; + if (this.Si.wa < this.Za.Pp(this.Mc)) { + var D = this.Za.pk(this.Mc); + return this.Oi = this.Za.sj(this.Mc), D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 6), !0; + } + return D = this.Za.pk(this.Mc), this.Oi = this.Za.nk(this.Mc), D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 7), (D = this.Za.sj(this.Mc)) != -1 && this.ji.add(D), !0; + }, C.prototype.DU = function() { + if (this.ji.size == 0) + return this.Qg = this.ie = -1, !1; + this.Mc = this.ji.get(this.ji.size - 1), this.ji.resize(this.ji.size - 1); + var D = this.Za.pk(this.Mc); + return D != -1 && (this.gi = this.Za.ml(D), this.tg[++this.ie] = 7), this.Za.sj(this.Mc) != -1 && this.ji.add(this.Za.sj(this.Mc)), this.Za.nk(this.Mc) != -1 && this.ji.add(this.Za.nk(this.Mc)), !0; + }, C.prototype.fT = function() { + return this.Qg = this.gi, this.Qg != -1 && _.iq(this.Op()) && this.Za.qk(this.Op()) <= this.Si.wa ? (this.gi = this.NF(), !1) : (this.ie--, !0); + }, C.prototype.AW = function() { + return this.Qg = this.gi, this.Qg != -1 && _.Iv(this.Op()) && this.Za.qk(this.Op()) >= this.Si.pa ? (this.gi = this.LR(), !1) : (this.ie--, !0); + }, C.prototype.oN = function() { + return this.Qg = this.gi, this.Qg != -1 && _.iq(this.Op()) ? (this.gi = this.NF(), !1) : (this.ie--, !0); + }, C.prototype.NF = function() { + return this.Za.Uf ? this.Za.bg.lb(this.Qg) : this.Za.Vi.lb(this.Qg); + }, C.prototype.LR = function() { + return this.Za.Uf ? this.Za.bg.xe(this.Qg) : this.Za.Vi.xe(this.Qg); + }, C.prototype.Op = function() { + return this.Za.Uf ? this.Za.bg.ka(this.Qg) : this.Za.Vi.getData(this.Qg); + }, C; + }(); + A.AY = m; + var _ = function() { + function C(D) { + this.Cm = this.bi = this.bg = this.Vi = this.Mm = this.Gj = this.ne = this.Hj = null, this.Uf = D, this.nq = this.Uv = !1; + } + return C.prototype.mr = function() { + this.Pk(!0); + }, C.prototype.Dr = function(D, L) { + if (!this.Uv) + throw A.i.Hb(); + this.Hj.push(new A.Oc(D, L)); + }, C.prototype.Hp = function() { + if (!this.Uv) + throw A.i.ga("invalid call"); + this.Uv = !1, this.nq = !0, this.Uf || (this.qS(), this.aw = this.Hj.length); + }, C.prototype.xj = function(D) { + if (!this.Uf || !this.nq) + throw A.i.O("invalid call"); + if (this.kf == -1) { + var L = this.Hj.length; + if (this.dA) { + var B = new A.ja(0); + B.Jb(2 * L), this.XI(B), this.bi.Jb(2 * L), this.bi.resize(0), this.WI(B), this.Mm.resize(L, -1), this.Mm.Yj(-1, 0, L), this.dA = !1; + } else + this.Mm.Yj(-1, 0, L); + this.kf = this.Vu(); + } + L = this.kG(D << 1, this.kf), B = this.bg.addElement(1 + (D << 1), this.rz(L)), this.QJ(L, B), this.Mm.set(D, L), this.aw++; + }, C.prototype.remove = function(D) { + if (!this.Uf || !this.nq) + throw A.i.ga("invalid call"); + var L = this.Mm.get(D); + if (L == -1) + throw A.i.O("the interval does not exist in the interval tree"); + this.Mm.set(D, -1), this.aw--; + var B = this.rz(L), q = this.bg.UR(B); + this.bg.wd(this.rR(L), B), this.bg.wd(this.OR(L), B), (D = this.bg.size(B)) == 0 && (this.bg.HP(B), this.UJ(q, -1)), this.Gj.kd(L), B = this.PF(q); + var Z = this.sj(q), ie = this.nk(q); + for (L = 0; !(0 < D || q == this.kf || Z != -1 && ie != -1); ) + q == this.sj(B) ? Z != -1 ? (this.Qk(B, Z), this.Wj(Z, B), this.Qk(q, -1)) : ie != -1 ? (this.Qk(B, ie), this.Wj(ie, B), this.Sk(q, -1)) : this.Qk(B, -1) : Z != -1 ? (this.Sk(B, Z), this.Wj(Z, B), this.Qk(q, -1)) : ie != -1 ? (this.Sk(B, ie), this.Wj(ie, B), this.Sk(q, -1)) : this.Sk(B, -1), this.Wj(q, -1), L++, q = B, D = (B = this.pk(q)) != -1 ? this.bg.size(B) : 0, Z = this.sj(q), ie = this.nk(q), B = this.PF(q); + }, C.prototype.reset = function() { + if (!this.Uf || !this.nq) + throw A.i.O("invalid call"); + this.Pk(!1); + }, C.prototype.size = function() { + return this.aw; + }, C.prototype.getIterator = function() { + return m.construct(this); + }, C.prototype.XI = function(D) { + for (var L = this.Hj.length, B = 0; B < 2 * L; B++) + D.add(B); + this.DX(D, 2 * L); + }, C.prototype.WI = function(D) { + for (var L = NaN, B = 0; B < D.size; B++) { + var q = D.get(B), Z = this.qk(q); + Z != L && (this.bi.add(q), L = Z); + } + }, C.prototype.qS = function() { + var D = this.Hj.length, L = new A.ja(0); + L.Jb(2 * D), this.XI(L), this.bi.Jb(2 * D), this.bi.resize(0), this.WI(L), this.Gj.Ee(D), this.Vi.hn(2 * D); + var B = A.Zc.Qh(D); + for (B.Yj(-1, 0, D), this.kf = this.Vu(), D = 0; D < L.size; D++) { + var q = L.get(D), Z = B.get(q >> 1); + Z != -1 ? this.QJ(Z, this.Vi.addElement(this.rz(Z), q)) : (Z = this.kG(q, this.kf), B.set(q >> 1, Z)); + } + }, C.prototype.kG = function(D, L) { + var B = L, q = L, Z = -1, ie = 0, se = this.bi.size - 1, de = 0, Ce = D >> 1, Ve = NaN, Je = NaN, Pt = !0, $t = this.yR(Ce); + for (Ce = this.vR(Ce); Pt; ) { + ie < se ? (de = ie + A.P.truncate((se - ie) / 2), this.bz(B) == -1 && this.AJ(B, this.bi.get(de), this.bi.get(de + 1))) : this.bz(B) == -1 && this.AJ(B, this.bi.get(ie), this.bi.get(ie)); + var qe = this.Pp(B); + if (Ce < qe) + L != -1 && (L == B ? (q = B, Ve = qe, Je = (L = this.sj(B)) != -1 ? this.Pp(L) : NaN) : Je > qe && (qe < Ve ? this.Qk(q, B) : this.Sk(q, B), this.Sk(B, L), this.Uf && (this.Wj(B, q), this.Wj(L, B)), q = B, Ve = qe, L = -1, Je = NaN)), (se = this.sR(B)) == -1 && (se = this.Vu(), this.ZW(B, se)), B = se, se = de; + else if ($t > qe) + L != -1 && (L == B ? (q = B, Ve = qe, Je = (L = this.nk(B)) != -1 ? this.Pp(L) : NaN) : Je < qe && (qe < Ve ? this.Qk(q, B) : this.Sk(q, B), this.Qk(B, L), this.Uf && (this.Wj(B, q), this.Wj(L, B)), q = B, Ve = qe, L = -1, Je = NaN)), (ie = this.PR(B)) == -1 && (ie = this.Vu(), this.jX(B, ie)), B = ie, ie = de + 1; + else { + (Pt = this.pk(B)) == -1 && (Pt = this.uP(B), this.UJ(B, Pt)); + var Rt = this.aN(Pt, D); + Z = this.sP(), this.mX(Z, Pt), this.YW(Z, Rt), B != L && (qe < Ve ? this.Qk(q, B) : this.Sk(q, B), this.Uf && this.Wj(B, q), L != -1 && (Je < qe ? this.Qk(B, L) : this.Sk(B, L), this.Uf && this.Wj(L, B))), Pt = !1; + } + } + return Z; + }, C.prototype.Vu = function() { + return this.ne.De(); + }, C.prototype.uP = function(D) { + return this.Uf ? this.bg.Rr(D) : this.Vi.Rh(D); + }, C.prototype.sP = function() { + return this.Gj.De(); + }, C.prototype.Pk = function(D) { + D ? (this.Uv = this.dA = !0, this.nq = !1, this.bi == null ? this.bi = A.Zc.Qh(0) : this.bi.resize(0), this.Hj == null ? this.Hj = [] : this.Hj.length = 0) : this.dA = !1, this.Uf ? this.Mm == null ? (this.Mm = A.Zc.Qh(0), this.bg = new A.$j(), this.bg.Xo(new T(this))) : this.bg.clear() : this.Vi == null ? this.Vi = new A.lp() : this.Vi.clear(), this.ne == null ? (this.Gj = new A.ad(3), this.ne = new A.ad(this.Uf ? 8 : 7)) : (this.Gj.oj(!1), this.ne.oj(!1)), this.kf = -1, this.aw = 0; + }, C.prototype.AJ = function(D, L, B) { + this.SW(D, L), this.TW(D, B); + }, C.prototype.Pp = function(D) { + var L = this.bz(D); + return L == -1 ? NaN : (L = this.qk(L)) == (D = this.qk(this.bR(D))) ? L : 0.5 * (L + D); + }, C.prototype.SW = function(D, L) { + this.ne.T(D, 0, L); + }, C.prototype.TW = function(D, L) { + this.ne.T(D, 1, L); + }, C.prototype.ZW = function(D, L) { + this.ne.T(D, 3, L); + }, C.prototype.jX = function(D, L) { + this.ne.T(D, 4, L); + }, C.prototype.UJ = function(D, L) { + this.ne.T(D, 2, L); + }, C.prototype.Qk = function(D, L) { + this.ne.T(D, 5, L); + }, C.prototype.Sk = function(D, L) { + this.ne.T(D, 6, L); + }, C.prototype.Wj = function(D, L) { + this.ne.T(D, 7, L); + }, C.prototype.mX = function(D, L) { + this.Gj.T(D, 0, L); + }, C.prototype.aN = function(D, L) { + return this.Uf ? this.bg.addElement(L, D) : this.Vi.addElement(D, L); + }, C.prototype.YW = function(D, L) { + this.Gj.T(D, 1, L); + }, C.prototype.QJ = function(D, L) { + this.Gj.T(D, 2, L); + }, C.prototype.ml = function(D) { + return this.Uf ? this.bg.sc(D) : this.Vi.sc(D); + }, C.prototype.bs = function(D) { + return this.Uf ? this.bg.Gc(D) : this.Vi.Gc(D); + }, C.iq = function(D) { + return (1 & D) == 0; + }, C.Iv = function(D) { + return (1 & D) == 1; + }, C.prototype.bz = function(D) { + return this.ne.U(D, 0); + }, C.prototype.bR = function(D) { + return this.ne.U(D, 1); + }, C.prototype.pk = function(D) { + return this.ne.U(D, 2); + }, C.prototype.sR = function(D) { + return this.ne.U(D, 3); + }, C.prototype.PR = function(D) { + return this.ne.U(D, 4); + }, C.prototype.sj = function(D) { + return this.ne.U(D, 5); + }, C.prototype.nk = function(D) { + return this.ne.U(D, 6); + }, C.prototype.PF = function(D) { + return this.ne.U(D, 7); + }, C.prototype.rz = function(D) { + return this.Gj.U(D, 0); + }, C.prototype.rR = function(D) { + return this.Gj.U(D, 1); + }, C.prototype.OR = function(D) { + return this.Gj.U(D, 2); + }, C.prototype.yR = function(D) { + return this.Hj[D].pa; + }, C.prototype.vR = function(D) { + return this.Hj[D].wa; + }, C.prototype.DX = function(D, L) { + this.Cm == null && (this.Cm = new A.Zt()); + var B = new b(this); + this.Cm.sort(D, 0, L, B); + }, C.prototype.CX = function(D, L, B) { + var q = this; + D.Wd(L, B, function(Z, ie) { + var se = q.qk(Z), de = q.qk(ie); + return se < de || se == de && C.iq(Z) && C.Iv(ie) ? -1 : 1; + }); + }, C.prototype.qk = function(D) { + var L = this.Hj[D >> 1]; + return C.iq(D) ? L.pa : L.wa; + }, C; + }(); + A.ur = _; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + if (T == null) + throw A.i.ga("Invalid arguement"); + this.hf = T; + var b = T.iR(); + b.cS() ? T.ef.DG() ? this.no = A.ui.PannableFold : this.no = A.ui.Clip : this.no = A.ui.DontClip, b.dS() ? T.$f.DG() ? this.Sm = A.ui.PannableFold : this.Sm = A.ui.Clip : this.Sm = A.ui.DontClip, this.Dm = b.Lr, this.hH = b.Xu, T = this.hf.nH, this.WG = T.ks(2147483648), this.Wv = T.ks(1073741824); + } + return H.Bh = function(T, b, m) { + return b.yw.Bh(T, m); + }, H.Tt = function(T, b, m, _) { + return T.yw.Tt(b, m, _); + }, H.St = function(T, b, m, _) { + if (m = 0 > m ? b.length : m, (T = T.yw.Tt(b, m, _)) == m) + return T; + for (var C = b = 0; C < m; C++) { + var D = _[C]; + D.isNaN() || (b < C && _[b].N(D), b++); + } + for (; b < m; b++) + _[b].Sc(); + return T; + }, H.transform = function(T, b, m, _, C) { + if (T.isIdentity()) + return A.ua.fP(_, b, m), m; + for (var D = [], L = 0, B = 0; B < m; ) { + for (var q = Math.min(D.length, m - B), Z = B, ie = 0; Z < q; Z++, ie++) + D[ie] == null ? D[ie] = b[Z].D() : b[Z].D(D[ie]); + var se = C ? H.St(T, D, q, D) : H.Tt(T, D, q, D); + for (ie = Z = 0; Z < se; Z++, ie++) + _[B] == null && (_[B] = new A.Ta(b[B])), _[B].Db(D[ie]); + B += q, L += se; + } + return L; + }, H.prototype.Tt = function(T, b, m) { + if (this.hf.isIdentity()) + return T != m && A.ua.Tu(m, T, b), b; + var _ = this.hf.ef, C = this.hf.$f, D = _.Tb(), L = C.Tb(); + if (D == 0 && D === L) { + var B = _.Sp(); + return C = B / (C = C.Sp()), (B = new A.Ed()).Jt(C, C), B.aY(T, b, m), b; + } + if (B = A.P.Hu(Math.min(b, 64)), D == 3) { + var q = _.Li; + D = (_ = q.hk()).Tb(), m != T && A.ua.Tu(m, T, b), A.Ab.bl(q, m, b, !0), q.St(A.dm.forward, m, b), A.Ab.al(q, m, b, !0); + } + if (D == 3 || L === 3) + throw A.i.ga("image: transform_in_place_"); + if (D == 2) + this.no == A.ui.Clip ? (m != T && A.ua.Tu(m, T, b), T = _.ol(), A.Ab.JS(T, _, m, b)) : (m != T && A.ua.Tu(m, T, b), _.Xc() && (D = _.Yd(0), q = _.Le(), A.Ab.AX(m, b, q, D), A.Ab.lF(m, b, _, 0))), A.Ab.DL(_, m, b, B); + else + for (D = _.Yd(0), q = _.Le(), _ = 0; _ < b; _++) + A.Ab.BX(T[_], q, D, m[_]); + for (A.Ab.BL(this.hf, m, b, B), T = 0, (L = L == 2) ? T = C.Bi() : isNaN(this.Dm) || (T = this.Dm), L && this.Sm != A.ui.Clip || A.Ab.lF(m, b, C.tc(), T), L && (A.Ab.tG(m, b, C, this.Sm), A.Ab.CL(C, m, b, B)), T = b, _ = 0; _ < b; ++_) + m[_].isNaN() && T--; + return T; + }, H.prototype.Bh = function(T, b) { + if (this.hf.isIdentity() || T.B()) + return T; + if (T.K() == 33) + return this.SI(T); + var m = this.hf.ef, _ = this.hf.$f, C = m.Tb(), D = _.Tb(); + if (C == 0 && C == D) + return b = m.Sp(), b /= _ = _.Sp(), (_ = new A.Ed()).Jt(b, b), (T = A.ba.kg(T)).Pc(_), T; + switch (T.K()) { + case 1607: + case 1736: + T = this.QI(T, b); + break; + case 550: + T = this.aW(T, b); + break; + case 197: + T = this.$V(T, b); + break; + default: + throw A.i.ga(""); + } + return T; + }, H.prototype.SI = function(T) { + var b = T.D(), m = []; + return m[0] = b, this.Tt(m, 1, m), (T = new A.Ta(T)).Db(m[0]), T; + }, H.prototype.QI = function(T, b) { + if (T.vm()) + throw A.i.ga("curves not supported"); + var m = T.K(); + if (m == 1736) + return this.bW(T, b); + if (m == 1607) + return this.cW(T, b); + throw A.i.ga("projectMultiPath"); + }, H.prototype.bW = function(T, b) { + var m = this.hf.ef, _ = this.hf.$f, C = m.Tb(), D = _.Tb(), L = A.P.Hu(Math.min(T.I(), 64)), B = A.Ea.kg(T); + C == 3 && (C = (m = (T = m.Li).hk()).Tb(), B = T.bl(B, !0), this.yp(T, A.dm.forward, B), B = T.al(B, !0)), T = null, D == 3 && (D = (_ = (T = _.Li).hk()).Tb()); + var q = C == 2, Z = D == 2, ie = Z ? _.tc() : _, se = !Z && !this.Wv; + D = !1; + var de = B; + if (q) { + if ((de = A.Ab.OI(de, m, this.no, b)).B()) + return de; + } else { + if (B = new A.l(), de.yc(B), C = m.Le(), B.G < C.G || B.H > C.H) { + var Ce = A.l.construct(B.v - 1, C.G, B.C + 1, C.H); + if ((de = A.ti.Pu(de, Ce, m, NaN, 0, b)).B()) + return de; + } + B.S() > 2 * C.S() && (de = A.Ab.Jp(de, -2 * C.S(), 2 * C.S(), m, !0, 0, !0, b)); + } + B = this.hH, (C = !isNaN(B)) && (de = A.Zl.local().W(de, B, b)), Ce = Z ? _.mk() : null; + var Ve = NaN; + q && (Ve = m.Bi()); + var Je = _.Yr() != null; + if (this.WG) + q && (A.Ab.wr(m, Ve, de, L), C && (q = m.jh(), B *= (Ve = m.tc().jh()) / q)), A.Ab.vr(this.hf, de, se, L), C && (q = m.tc().jh(), B *= (Ve = _.tc().jh()) / q), m = de; + else { + var Pt = new A.Ua(de.description); + Pt.yD(de), q && (A.Ab.wr(m, Ve, Pt, L), C && (q = m.jh(), B *= (Ve = m.tc().jh()) / q)), A.Ab.vr(this.hf, Pt, se, L), C && (q = m.tc().rm(), B *= (Ve = _.tc().rm()) / q), se = NaN, Z ? (Ce = _.mk(), se = _.Bi()) : isNaN(this.Dm) || (se = this.Dm), q = H.vv(m) | H.vv(_), Ve = 10 * ie.Yd(0), this.Wv && (q = 3, Ve = 0), m = A.Ab.PQ(de, m, Pt, ie, se, b, q, Ve); + } + return Je && (m = A.Ab.SD(m, _, b)), Z && (D || (Z = ie.Le().S(), m.Vg(0, 0).S() >= Z - ie.Yd(0) && (ie = Ce.getNorthPoleLocation(), Z = Ce.getSouthPoleLocation(), de = Ce.getNorthPoleGeometry(), Ce = Ce.getSouthPoleGeometry(), se = 0, de == A.Eg.PE_POLE_POINT && ie != A.Eg.PE_POLE_OUTSIDE_BOUNDARY && (se = 1), Ce == A.Eg.PE_POLE_POINT && Z != A.Eg.PE_POLE_OUTSIDE_BOUNDARY && (se |= 2), se !== 0 && (D = !0))), m = A.Ab.Hz(m, _, this.Sm, b), C && (m = A.Zl.local().W(m, B, b)), A.Ab.Kx(_, m, L)), m.B() || (D && (m = A.$l.local().W(m, _, !1, b)), T != null && (m = T.al(m, !1), this.yp(T, A.dm.reverse, m), m = T.bl(m, !1))), m; + }, H.vv = function(T) { + if (T.Tb() != 2) + return 0; + var b = 0, m = T.mk(); + T = m.getNorthPoleLocation(); + var _ = m.getSouthPoleLocation(), C = m.getNorthPoleGeometry(); + return m = m.getSouthPoleGeometry(), C == A.Eg.PE_POLE_POINT && T != A.Eg.PE_POLE_OUTSIDE_BOUNDARY && (b = 1), m == A.Eg.PE_POLE_POINT && _ != A.Eg.PE_POLE_OUTSIDE_BOUNDARY && (b |= 2), b; + }, H.prototype.cW = function(T, b) { + var m = this.hf.ef, _ = this.hf.$f, C = m.Tb(), D = _.Tb(), L = A.P.Hu(Math.min(T.I(), 64)), B = A.Ua.kg(T); + C == 3 && (C = (m = (T = m.Li).hk()).Tb(), B = T.bl(B, !0), this.yp(T, A.dm.forward, B), B = T.al(B, !0)), T = null, D == 3 && (D = (_ = (T = _.Li).hk()).Tb()); + var q = C == 2; + C = (D = D == 2) ? _.tc() : _; + var Z = !D && !this.Wv; + if (q) { + if ((B = A.Ab.OI(B, m, this.no, b)).B()) + return B; + } else { + var ie = new A.l(); + B.yc(ie); + var se = m.Le(); + if ((ie.G < se.G || ie.H > se.H) && (ie = A.l.construct(ie.v - 1, se.G, ie.C + 1, se.H), (B = A.ti.Pu(B, ie, m, NaN, 0, b)).B())) + return B; + } + var de = NaN; + q && (de = m.Bi()), ie = _.Yr() != null, se = this.hH; + var Ce = !isNaN(se); + if (Ce && (B = A.Zl.local().W(B, se, b)), this.WG) + q && A.Ab.wr(m, de, B, L), Ce && (q = m.jh(), se *= (de = m.tc().jh()) / q), A.Ab.vr(this.hf, B, Z, L), Ce && (q = m.tc().jh(), se *= (de = _.tc().jh()) / q), m = B; + else { + var Ve = new A.Ua(B.description); + Ve.yD(B), q && (A.Ab.wr(m, de, Ve, L), Ce && (q = m.jh(), se *= (de = m.tc().jh()) / q)), A.Ab.vr(this.hf, Ve, Z, L), Ce && (q = m.tc().jh(), se *= (de = _.tc().jh()) / q), Z = NaN, D ? Z = _.Bi() : isNaN(this.Dm) || (Z = this.Dm), q = H.vv(m) | H.vv(_), de = 10 * C.Yd(0), this.Wv && (q = 3, de = 0), m = A.Ab.QQ(B, m, Ve, C, Z, b, q, de); + } + return ie && (m = A.Ab.SD(m, _, b)), D && (m = A.Ab.Hz(m, _, this.Sm, b), Ce && (m = A.Zl.local().W(m, se, b)), A.Ab.Kx(_, m, L)), m.B() || T != null && (m = T.al(m, !1), this.yp(T, A.dm.reverse, m), m = T.bl(m, !1)), m; + }, H.prototype.$V = function(T, b) { + var m = (T.da() + T.S()) / 400; + return m != 0 ? (m = A.Zl.local().W(T, m, b), m = this.QI(m, b), b = T.Ja(), m.dn(b)) : (b = new A.Ta(T.Kp()), m = this.SI(b), b = T.Ja(), m.B() ? b.Pa() : (T.copyTo(b), T = m.D(), b.L(T.x, T.y, T.x, T.y))), b; + }, H.prototype.aW = function(T, b) { + T = A.ba.kg(T); + var m = this.hf.ef, _ = this.hf.$f, C = m.Tb(), D = _.Tb(), L = A.P.Hu(Math.min(T.I(), 64)); + if (C == 3) { + var B = m.Li; + C = (m = B.hk()).Tb(), T = B.al(T, !0), this.yp(B, A.dm.forward, T), T = B.bl(T, !0); + } + if (C == 2) { + if (this.no == A.ui.Clip ? T = A.Zj.local().W(T, m.ol(), m, b) : m.Xc() && (C = new A.l(), T.yc(C), m.Le().contains(C) || (this.no == A.ui.PannableFold && (T = A.Ab.nj(T, m)), A.Ab.Lt(T, m.Le(), m.Yd(0), !0), T = A.Ab.Hn(T, m, 0, !0, 0, b))), T.B()) + return T; + A.Ab.wr(m, 0, T, L); + } else + A.Ab.Lt(T, m.Le(), m.Yd(0), !0); + return A.Ab.vr(this.hf, T, !1, L), m = 0, C = !1, B = null, D == 3 && (C = !0, D = (_ = (B = _.Li).hk()).Tb()), (D = D == 2) ? m = _.Bi() : isNaN(this.Dm) || (m = this.Dm), D && this.Sm != A.ui.Clip || (T = A.Ab.Hn(T, _.tc(), m, !1, 0, b)), D && (T = A.Ab.Hz(T, _, this.Sm, b), A.Ab.Kx(_, T, L), T.B()) || C && (T = B.al(T, !0), this.yp(B, A.dm.reverse, T), T = B.bl(T, !0)), T; + }, H.prototype.yp = function(T, b, m) { + var _ = m.I(); + if (_ != 0) { + for (var C = m.vb(0), D = A.P.mg(200, 0), L = [], B = 0; B < _; ) { + var q = Math.min(100, _ - B); + C.Xw(2 * B, 2 * q, D, 2, !0); + for (var Z = 0; Z < q; ++Z) + L[Z] = A.h.construct(D[2 * B], D[2 * B + 1]); + T.St(b, L, q), B += q; + } + m.Qc(1993); + } + }, H.Py = function(T, b, m) { + if (T == null || b == null || !b.Xc()) + throw A.i.ga("Invalid Arguement"); + if (T.B()) + return T; + var _ = T.K(); + return _ == 197 ? (_ = new A.Ea(T.description)).bd(T, !1) : A.ba.zd(_) ? (_ = new A.Ua(T.description)).pc(T, !0) : _ = T, (_ = A.Ab.nj(_, b)).B() ? _ : A.Ab.Hn(_, b, 0, _ != T, 0, m); + }, H.pj = function(T, b, m, _) { + if (T == null || b == null || !b.Xc()) + throw A.i.ga("Invalid Arguement"); + if (T.B()) + return T; + var C = T.K(); + if (A.ba.Ic(C)) { + T = A.Ab.nj(T, b), C = new A.l(), T.A(C); + for (var D = A.ua.oy(b, C, !1), L = b.ih(), B = Math.floor((C.v - L.v) / L.S()) * L.S() + L.v; B < C.C; ) + B > C.v + D && B < C.C - D && (T = A.Ab.pS(T, b, m, B)), B += L.S(); + } else { + if (C == 197) + return (C = new A.Ea(T.description)).bd(T, !1), H.pj(C, b, m, _); + if (A.ba.zd(C)) + return (C = new A.Ua(T.description)).pc(T, !0), H.pj(C, b, m, _); + } + return H.Py(T, b, _); + }, H; + }(); + A.du = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T(b, m, _, C) { + var D = H.call(this) || this; + return b === void 0 ? D.description = A.fe.pg() : _ === void 0 ? D.description = b : (D.description = A.fe.pg(), D.UB(b, m), D.Sl(_, C)), D; + } + return Ne(T, H), T.prototype.K = function() { + return 322; + }, T.prototype.Rb = function() { + var b = this.ta - this.qa, m = this.oa - this.ma; + return Math.sqrt(b * b + m * m); + }, T.prototype.Di = function(b) { + var m = this.ta - this.qa, _ = this.oa - this.ma; + return Math.sqrt(m * m + _ * _) <= b; + }, T.prototype.Rn = function() { + return !1; + }, T.prototype.lg = function() { + var b = new A.h(); + return b.vc(this.xc(), this.bc()), b; + }, T.YO = function(b, m) { + return new T(b.x, b.y, m.x, m.y); + }, T.prototype.dn = function(b) { + b.Pa(), b.Pf(this.description); + var m = new A.l(); + this.A(m), b.Zo(m), m = 1; + for (var _ = this.description.Ba; m < _; m++) + for (var C = this.description.ld(m), D = A.sa.Wa(C); m < D; m++) { + var L = this.Vg(C, 0); + b.setInterval(C, 0, L); + } + }, T.prototype.A = function(b) { + b.L(this.ta, this.oa, this.qa, this.ma), b.normalize(); + }, T.prototype.So = function(b) { + b.Pa(), b.$b(this.ta, this.oa, this.Pd(0, 1, 0)), b.$b(this.qa, this.ma, this.Pd(1, 1, 0)); + }, T.prototype.Pc = function(b) { + if (b instanceof A.Ed) { + this.wc(); + var m = new A.h(); + m.x = this.ta, m.y = this.oa, b.Gh(m, m), this.ta = m.x, this.oa = m.y, m.x = this.qa, m.y = this.ma, b.Gh(m, m), this.qa = m.x, this.ma = m.y; + } else + this.wc(), (m = new A.Od()).x = this.ta, m.y = this.oa, m.z = this.Pd(0, 1, 0), m = b.hp(m), this.ta = m.x, this.oa = m.y, this.vn(0, 1, 0, m.z), m.x = this.qa, m.y = this.ma, m.z = this.Pd(1, 1, 0), m = b.hp(m), this.qa = m.x, this.ma = m.y, this.vn(1, 1, 0, m.z); + }, T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.Sx = function(b, m) { + return (this.qa - b - (this.ta - b)) * (this.ma - m + (this.oa - m)) * 0.5; + }, T.prototype.ux = function(b) { + return b * this.Rb(); + }, T.prototype.IG = function(b) { + return b / this.Rb(); + }, T.prototype.yF = function(b) { + return A.mc.jq(this.ta, this.qa, b); + }, T.prototype.aR = function(b) { + return A.mc.jq(this.oa, this.ma, b); + }, T.prototype.fl = function(b, m) { + var _ = new A.jg(); + return this.dh(b, m, _), _.get(); + }, T.prototype.dh = function(b, m, _) { + if (_ == null) + throw A.i.O(); + _.Qr(), (_ = _.get()).Pf(this.description); + var C = new A.h(); + this.ic(b, C), _.UB(C.x, C.y), this.ic(m, C), _.Sl(C.x, C.y), C = 1; + for (var D = this.description.Ba; C < D; C++) + for (var L = this.description.Fd(C), B = A.sa.Wa(L), q = 0; q < B; q++) { + var Z = this.Vc(b, L, q); + _.TB(L, q, Z), Z = this.Vc(m, L, q), _.JB(L, q, Z); + } + }, T.prototype.Vc = function(b, m, _) { + if (m == 0) + return _ == 0 ? this.ic(b).x : this.ic(b).y; + switch (A.sa.gz(m)) { + case 0: + return 0.5 > b ? this.yv(m, _) : this.jv(m, _); + case 1: + var C = this.yv(m, _); + return m = this.jv(m, _), A.mc.jq(C, m, b); + case 2: + throw A.i.ga("not implemented"); + } + throw A.i.Ra(); + }, T.prototype.ge = function(b, m) { + var _ = this.qa - this.ta, C = this.ma - this.oa, D = _ * _ + C * C; + return D == 0 ? 0.5 : (b = ((b.x - this.ta) * _ + (b.y - this.oa) * C) / D, m || (0 > b ? b = 0 : 1 < b && (b = 1)), b); + }, T.prototype.fq = function(b, m, _, C) { + if (b) { + if ((b = this.ma - this.oa) == 0) + return m == this.ma ? -1 : 0; + if (0 > (m = (m - this.oa) / b) || 1 < m) + return 0; + _ != null && (_[0] = this.yF(m)); + } else { + if ((b = this.qa - this.ta) == 0) + return m == this.qa ? -1 : 0; + if (0 > (m = (m - this.ta) / b) || 1 < m) + return 0; + _ != null && (_[0] = this.aR(m)); + } + return C != null && (C[0] = m), 1; + }, T.prototype.Me = function(b, m) { + var _ = this.ma - this.oa; + return _ == 0 ? b == this.ma ? m : NaN : (b = (b - this.oa) / _, m = this.yF(b), b == 1 && (m = this.qa), m); + }, T.prototype.tu = function(b, m, _) { + return 0 <= this.tp(b.x, b.y, m, _); + }, T.prototype.xi = function(b, m, _) { + return 0 <= this.tp(b, m, _, !0); + }, T.prototype.ss = function(b, m) { + return this.tu(b, m, !1); + }, T.prototype.mI = function() { + if (this.ma < this.oa || this.ma == this.oa && this.qa < this.ta) { + var b = this.ta; + this.ta = this.qa, this.qa = b, b = this.oa, this.oa = this.ma, this.ma = b, b = 0; + for (var m = this.description.Qq - 2; b < m; b++) { + var _ = this.la[b]; + this.la[b] = this.la[b + m], this.la[b + m] = _; + } + } + }, T.prototype.wu = function(b, m) { + (m = A.h.construct(b, m)).sub(this.bc()); + var _ = new A.h(); + return _.vc(this.xc(), this.bc()), (b = _.yi(m)) > (m = 8881784197001252e-31 * (Math.abs(_.x * m.y) + Math.abs(_.y * m.x))) ? -1 : b < -m ? 1 : 0; + }, T.prototype.tp = function(b, m, _, C) { + var D = this.ta, L = this.oa, B = b - D, q = m - L; + if ((B = Math.sqrt(B * B + q * q)) <= Math.max(_, 6661338147750939e-31 * B)) + return C && B == 0 ? NaN : 0; + if (B = b - this.qa, q = m - this.ma, (B = Math.sqrt(B * B + q * q)) <= Math.max(_, 6661338147750939e-31 * B)) + return C && B == 0 ? NaN : 1; + if (B = this.qa - this.ta, q = this.ma - this.oa, 0 < (C = Math.sqrt(B * B + q * q))) { + var Z = 1 / C, ie = b - D, se = m - L, de = ie * (B *= Z) + se * (q *= Z), Ce = 17763568394002505e-31 * (Math.abs(ie * B) + Math.abs(se * q)), Ve = B; + if (B = -q, q = Ve, de < -(Ce = Math.max(_, Ce)) || de > C + Ce) + return NaN; + if (Math.abs(ie * B + se * q) <= Math.max(_, 17763568394002505e-31 * (Math.abs(ie * B) + Math.abs(se * q))) && (0.5 >= (B = A.P.Tk(de * Z, 0, 1)) ? (q = this.ta + (this.qa - this.ta) * B, C = this.oa + (this.ma - this.oa) * B) : (q = this.qa - (this.qa - this.ta) * (1 - B), C = this.ma - (this.ma - this.oa) * (1 - B)), A.h.Jy(q, C, b, m) <= _)) { + if (0.5 > B) { + if (A.h.Jy(q, C, D, L) <= _) + return 0; + } else if (A.h.Jy(q, C, this.qa, this.ma) <= _) + return 1; + return B; + } + } + return NaN; + }, T.prototype.Nb = function(b) { + return b != null && (b == this || b.constructor === this.constructor && this.AM(b)); + }, T.prototype.mD = function(b, m, _) { + var C = _ ? this.ta : this.qa; + _ = _ ? this.oa : this.ma; + var D = new A.h(); + return D.x = b.qa - C, D.y = b.ma - _, !(m.Sh(D) > 6661338147750939e-31 * m.aD(D)) || (D.x = b.ta - C, D.y = b.oa - _, m.Sh(D) <= 6661338147750939e-31 * m.aD(D)); + }, T.prototype.lD = function(b) { + var m = new A.h(); + return m.x = this.qa - this.ta, m.y = this.ma - this.oa, !!this.mD(b, m, !1) && (m.Uq(), !!this.mD(b, m, !0)); + }, T.IM = function(b, m) { + var _ = b.wu(m.ta, m.oa), C = b.wu(m.qa, m.ma); + return !(0 > _ && 0 > C || 0 < _ && 0 < C) && (_ = m.wu(b.ta, b.oa), C = m.wu(b.qa, b.ma), !(0 > _ && 0 > C || 0 < _ && 0 < C) && ((_ = b.Rb()) > (C = m.Rb()) ? b.lD(m) : m.lD(b))); + }, T.GM = function(b, m, _) { + var C = A.h.construct(NaN, NaN), D = b.qa - b.ta, L = b.ma - b.oa, B = m.qa - m.ta, q = m.ma - m.oa, Z = B * L - D * q; + if (Z == 0) + return C; + var ie = 8881784197001252e-31 * (Math.abs(B * L) + Math.abs(D * q)), se = m.ta - b.ta, de = m.oa - b.oa, Ce = B * de - se * q, Ve = Ce / Z, Je = Math.abs(Z); + return Ve < -(B = (8881784197001252e-31 * (Math.abs(B * de) + Math.abs(se * q)) * Je + ie * Math.abs(Ce)) / (Z * Z) + 2220446049250313e-31 * Math.abs(Ve)) || Ve > 1 + B || (B = (q = D * de - se * L) / Z) < -(D = (8881784197001252e-31 * (Math.abs(D * de) + Math.abs(se * L)) * Je + ie * Math.abs(q)) / (Z * Z) + 2220446049250313e-31 * Math.abs(B)) || B > 1 + D || (Ve = A.P.Tk(Ve, 0, 1), D = A.P.Tk(B, 0, 1), L = b.ic(Ve), Z = m.ic(D), (ie = new A.h()).vc(L, Z), ie.length() > _ && (ie.add(L, Z), ie.scale(0.5), Ve = b.ge(ie, !1), D = m.ge(ie, !1), b = b.ic(Ve), m = m.ic(D), b.sub(m), b.length() > _) || C.na(Ve, D)), C; + }, T.JM = function(b, m, _, C) { + var D = 0; + if ((b.ta == m.ta && b.oa == m.oa || b.ta == m.qa && b.oa == m.ma) && (D++, !C)) + return 1; + if (b.qa == m.ta && b.ma == m.oa || b.qa == m.qa && b.ma == m.ma) { + if (++D == 2) + return 2; + if (!C) + return 1; + } + return m.xi(b.ta, b.oa, _) || m.xi(b.qa, b.ma, _) || b.xi(m.ta, m.oa, _) || b.xi(m.qa, m.ma, _) ? 1 : C && D != 0 || T.IM(b, m) == 0 ? 0 : 1; + }, T.Yx = function(b, m, _, C, D, L) { + var B = 0, q = b.tp(m.ta, m.oa, L, !1), Z = b.tp(m.qa, m.ma, L, !1), ie = m.tp(b.ta, b.oa, L, !1), se = m.tp(b.qa, b.ma, L, !1); + return isNaN(q) || (C != null && (C[B] = q), D != null && (D[B] = 0), _ != null && (_[B] = A.h.construct(m.ta, m.oa)), B++), isNaN(Z) || (C != null && (C[B] = Z), D != null && (D[B] = 1), _ != null && (_[B] = A.h.construct(m.qa, m.ma)), B++), B == 2 || isNaN(ie) || q == 0 && ie == 0 || Z == 0 && ie == 1 || (C != null && (C[B] = 0), D != null && (D[B] = ie), _ != null && (_[B] = A.h.construct(b.ta, b.oa)), B++), B == 2 || isNaN(se) || q == 1 && se == 0 || Z == 1 && se == 1 || (C != null && (C[B] = 1), D != null && (D[B] = se), _ != null && (_[B] = A.h.construct(m.qa, m.ma)), B++), 0 < B ? (B == 2 && C != null && C[0] > C[1] && (b = C[0], C[0] = C[1], C[1] = b, D != null && (C = D[0], D[0] = D[1], D[1] = C), _ != null && (D = A.h.construct(_[0].x, _[0].y), _[0] = _[1], _[1] = D)), B) : (B = T.GM(b, m, L), isNaN(B.x) ? 0 : (_ != null && (_[0] = b.ic(B.x)), C != null && (C[0] = B.x), D != null && (D[0] = B.y), 1)); + }, T.prototype.$F = function() { + return 0; + }, T.prototype.qp = function() { + }, T.prototype.toString = function() { + return "Line: [" + this.ta.toString() + ", " + this.oa.toString() + ", " + this.qa.toString() + ", " + this.ma.toString() + "]"; + }, T; + }(A.NC); + A.zb = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.Lm = [], this.za = -1; + } + return H.prototype.Ma = function() { + return this.za; + }, H.prototype.next = function() { + if (this.Lm != null && this.Lm.length != 0) { + this.za++; + var T = this.Lm[0]; + return this.Lm = 1 >= this.Lm.length ? [] : this.Lm.slice(1), T; + } + return this.Lm = null; + }, H.prototype.VX = function(T) { + this.Lm.push(T); + }, H.prototype.re = function() { + }, H; + }(); + A.bL = ve; + }(le || (le = {})), function(A) { + var ve; + (ve = A.NL || (A.NL = {}))[ve.enumFillRuleOddEven = 0] = "enumFillRuleOddEven", ve[ve.enumFillRuleWinding = 1] = "enumFillRuleWinding"; + var H = function(T) { + function b(m, _) { + var C = T.call(this) || this; + if (C.yf = !1, C.Gq = null, C.uq = 0, C.tq = 0, C.Cj = null, C.Og = !1, C.nb = null, C.mb = null, C.Se = null, C.Nj = null, C.Td = null, C.vq = 0, C.gb = 0, C.zq = 0, _ === void 0) + C.yf = m, C.Og = !1, C.vq = 0, C.uq = 0, C.tq = 0, C.xa = 0, C.description = A.fe.pg(); + else { + if (_ == null) + throw A.i.O(); + C.yf = m, C.Og = !1, C.vq = 0, C.uq = 0, C.tq = 0, C.xa = 0, C.description = _; + } + return C.Cj = null, C.gb = 0, C; + } + return Ne(b, T), b.prototype.vm = function() { + return 0 < this.vq; + }, b.prototype.Xx = function() { + this.wc(), this.Gq == null ? this.Gq = new A.Ta(this.description) : this.Gq.Pf(this.description); + }, b.prototype.rx = function(m, _) { + var C = new A.h(); + C.x = m, C.y = _, this.Nt(C); + }, b.prototype.Nt = function(m) { + this.Xx(), this.Gq.Db(m), this.Og = !0; + }, b.prototype.nf = function(m) { + if (m.B()) + throw A.i.O(); + this.Ll(m.description), this.Xx(), m.copyTo(this.Gq), this.Og = !0; + }, b.prototype.Rx = function() { + var m = 1; + this.Og && (this.Xx(), this.nb == null ? (this.nb = A.Zc.Qh(2), this.nb.write(0, 0), this.mb = A.Zc.Or(2, 0)) : (this.nb.resize(this.nb.size + 1, 0), this.mb.resize(this.mb.size + 1, 0)), this.yf && this.mb.write(this.mb.size - 2, 1), m++); + var _ = this.xa; + this.nb.write(this.nb.size - 1, this.xa + m), this.fm(_ + m), this.mb.write(this.nb.size - 1, 0), this.Og && (this.It(_, this.Gq), this.Og = !1); + }, b.prototype.Aj = function(m, _) { + this.Rx(), this.Db(this.xa - 1, m, _); + }, b.prototype.Ei = function(m) { + this.Rx(), this.Db(this.xa - 1, m); + }, b.prototype.lineTo = function(m) { + this.Rx(), this.It(this.xa - 1, m); + }, b.prototype.xU = function(m) { + if (this.wc(), this.yf) + throw A.i.Ra(); + var _ = this.ea(); + if (m > _) + throw A.i.Ra(); + if (this.ec(m)) { + if (this.mb == null) + throw A.i.Ra(); + var C = this.xa, D = this.Ca(m), L = this.Wc(m); + this.fm(this.xa + 1), this.oc(); + for (var B = 0, q = this.description.Ba; B < q; B++) + if (this.Aa[B] != null) { + var Z = A.sa.Wa(this.description.Fd(B)); + this.Aa[B].On(Z * L, this.Aa[B], Z * D, Z, !0, 1, Z * C); + } + for (; _ > m; _--) + C = this.nb.read(_), this.nb.write(_, C + 1); + this.mb.FE(m, 1); + } + }, b.prototype.Cp = function() { + if (this.vx(), m === void 0) { + this.Og = !1; + var m = this.ea() - 1; + } + var _ = this.mb.read(m); + this.mb.write(m, 1 | _), this.Se != null && (m = this.Wc(m) - 1, this.Se.write(m, 1), this.Nj.write(m, -1)); + }, b.prototype.ec = function(m) { + return (1 & this.mb.read(m)) != 0; + }, b.prototype.Pn = function(m) { + if (this.ec(m)) + return !0; + var _ = this.Ca(m); + return !(_ > (m = this.Wc(m) - 1)) && (_ = this.Oa(_), m = this.Oa(m), _.rb(m)); + }, b.prototype.Av = function(m) { + return (2 & this.mb.read(m)) != 0; + }, b.prototype.pc = function(m, _) { + if (this.Ll(m.description), m.K() != 322) + throw A.i.Ra(); + var C = new A.Ta(); + (_ || this.B()) && (m.Vo(C), this.nf(C)), m.Ro(C), this.lineTo(C); + }, b.prototype.vp = function(m) { + var _ = this.xa == 0; + this.rx(m.v, m.G), this.Aj(m.v, m.H), this.Aj(m.C, m.H), this.Aj(m.C, m.G), this.Cp(), this.Og = !1, _ && this.Nf(256, !1); + }, b.prototype.bd = function(m, _) { + if (!m.B()) { + for (var C = this.xa == 0, D = new A.Ta(this.description), L = 0; 4 > L; L++) + m.If(_ ? 4 - L - 1 : L, D), L == 0 ? this.nf(D) : this.lineTo(D); + this.Cp(), this.Og = !1, C && !_ && this.Nf(256, !1); + } + }, b.prototype.add = function(m, _) { + for (var C = 0; C < m.ea(); C++) + this.addPath(m, C, !_); + }, b.prototype.addPath = function(m, _, C) { + this.wf(-1, m, _, C); + }, b.prototype.$k = function(m, _) { + this.Cz(m, _); + }, b.prototype.Fr = function(m, _, C, D, L) { + if (L || this.ea() != 0 || (L = !0), 0 > _ && (_ = m.ea() - 1), _ >= m.ea() || 0 > C || 0 > D || D > m.tv(_)) + throw A.i.ga("index out of bounds"); + if (D != 0) { + var B = m.ec(_) && C + D == m.tv(_); + if (!B || D != 1) { + if (this.Og = !1, this.Ll(m.description), C = m.Ca(_) + C + 1, L && (D++, C--), B && D--, B = this.xa, this.fm(this.xa + D), this.oc(), L) { + if (D == 0) + return; + this.nb.add(this.xa), L = m.mb.read(_), L &= -5, this.yf && (L |= 1), this.mb.write(this.mb.size - 1, L), this.mb.add(0); + } else + this.nb.write(this.mb.size - 1, this.xa); + L = 0; + for (var q = this.description.Ba; L < q; L++) { + var Z = this.description.ld(L), ie = A.sa.Wa(Z), se = m.description.Rf(Z); + 0 > se || m.Aa[se] == null ? this.Aa[L].Nn(ie * B, A.sa.te(Z), D * ie, ie * B) : this.Aa[L].On(ie * B, m.Aa[se], ie * C, D * ie, !0, ie, ie * B); + } + if (this.vm() || m.Av(_)) + throw A.i.Ra(); + this.Qc(1993); + } + } + }, b.prototype.jJ = function() { + for (var m = 0, _ = this.ea(); m < _; m++) + this.zW(m); + }, b.prototype.zW = function(m) { + if (this.oc(), m >= this.ea()) + throw A.i.O(); + var _ = this.Ca(m), C = this.Ka(m); + m = this.ec(m) ? 1 : 0; + for (var D = 0, L = this.description.Ba; D < L; D++) + if (this.Aa[D] != null) { + var B = A.sa.Wa(this.description.Fd(D)); + this.Aa[D].pi(B * (_ + m), B * (C - m), B); + } + this.Qc(1993); + }, b.prototype.ar = function(m) { + this.oc(); + var _ = this.ea(); + if (0 > m && (m = _ - 1), m >= _) + throw A.i.O(); + for (var C = this.Ca(m), D = this.Ka(m), L = 0, B = this.description.Ba; L < B; L++) + if (this.Aa[L] != null) { + var q = A.sa.Wa(this.description.Fd(L)); + this.Aa[L].Gn(q * C, q * D, q * this.xa); + } + for (C = m + 1; C <= _; C++) + L = this.nb.read(C), this.nb.write(C - 1, L - D); + if (this.mb == null) + for (C = m + 1; C <= _; C++) + m = this.mb.read(C), this.mb.write(C - 1, m); + this.nb.resize(_), this.mb.resize(_), this.xa -= D, this.Rg -= D, this.Qc(1993); + }, b.prototype.wf = function(m, _, C, D) { + if (_ == this || C >= _.ea()) + throw A.i.O(); + var L = this.ea(); + if (m > L) + throw A.i.O(); + 0 > m && (m = L), 0 > C && (C = _.ea() - 1), this.Og = !1, this.Ll(_.description), _.oc(); + var B = _.Ca(C), q = _.Ka(C), Z = this.xa, ie = _.ec(C) && !D ? 1 : 0; + this.fm(this.xa + q), this.oc(); + for (var se = m < L ? this.Ca(m) : Z, de = 0, Ce = this.description.Ba; de < Ce; de++) { + var Ve = this.description.Fd(de), Je = _.description.Rf(Ve), Pt = A.sa.Wa(Ve); + 0 <= Je && _.Aa[Je] != null ? (ie != 0 && this.Aa[de].On(se * Pt, _.Aa[Je], Pt * B, Pt, !0, Pt, Pt * Z), this.Aa[de].On((se + ie) * Pt, _.Aa[Je], Pt * (B + ie), Pt * (q - ie), D, Pt, Pt * (Z + ie))) : this.Aa[de].Nn(se * Pt, A.sa.te(Ve), Pt * q, Pt * Z); + } + for (this.nb.add(Z + q), D = L; D >= m + 1; D--) + B = this.nb.read(D - 1), this.nb.write(D, B + q); + for (_.Av(C), this.mb.add(0), D = L - 1; D >= m + 1; D--) + L = this.mb.read(D), L &= -5, this.mb.write(D + 1, L); + L = _.ER().read(C), L &= -5, this.yf && (L |= 1), this.mb.write(m, L); + }, b.prototype.Cz = function(m, _) { + var C = -1, D = this.ea(); + if (C > D) + throw A.i.O(); + 0 > C && (C = D), this.Og = !1; + var L = this.xa; + this.fm(this.xa + _), this.oc(); + var B = C < D ? this.Ca(C) : L; + if (m != null) + this.Aa[0].Dz(2 * B, m, 0, _, !0, 2 * L); + else { + var q = A.sa.te(0); + this.Aa[0].Nn(2 * B, q, 2 * _, 2 * L); + } + m = 1; + for (var Z = this.description.Ba; m < Z; m++) { + q = this.description.ld(m); + var ie = A.sa.Wa(q); + q = A.sa.te(q), this.Aa[m].Nn(B * ie, q, ie * _, ie * L); + } + for (this.nb.add(this.xa), L = D; L >= C + 1; L--) + B = this.nb.read(L - 1), this.nb.write(L, B + _); + for (this.mb.add(0), L = D - 1; L >= C + 1; L--) + _ = this.mb.read(L), _ &= -5, this.mb.write(L + 1, _); + this.yf && this.mb.write(C, 1); + }, b.prototype.lG = function(m, _, C) { + var D = -1; + if (0 > m && (m = this.ea()), m > this.ea() || D > this.Ka(m) || C > _.length) + throw A.i.ga("index out of bounds"); + if (C != 0) { + m == this.ea() && (this.nb.add(this.xa), this.yf ? this.mb.add(1) : this.mb.add(0)), 0 > D && (D = this.Ka(m)), this.oc(); + var L = this.xa; + this.fm(this.xa + C), this.oc(); + for (var B = 0, q = this.description.Ba; B < q; B++) { + var Z = this.description.Fd(B), ie = A.sa.Wa(Z); + this.Aa[B].Wt(ie * (this.Ca(m) + D + C), (L - this.Ca(m) - D) * ie, this.Aa[B], ie * (this.Ca(m) + D), !0, ie), B == 0 ? this.Aa[B].qC(ie * (this.Ca(m) + D), C, _, 0, !0) : this.Aa[B].Yj(A.sa.te(Z), (this.Ca(m) + D) * ie, C * ie); + } + for (this.vm() && (this.Se.Wt(this.Ca(m) + D + C, L - this.Ca(m) - D, this.Se, this.Ca(m) + D, !0, 1), this.Nj.Wt(this.Ca(m) + D + C, L - this.Ca(m) - D, this.Nj, this.Ca(m) + D, !0, 1), this.Se.Yj(1, this.Ca(m) + D, C), this.Nj.Yj(-1, this.Ca(m) + D, C)), m += 1, _ = this.ea(); m <= _; m++) + this.nb.write(m, this.nb.read(m) + C); + } + }, b.prototype.xf = function(m, _, C) { + var D = this.ea(); + if (0 > m && (m = this.ea()), m >= D || _ > this.Ka(m)) + throw A.i.ga("index out of bounds"); + m == this.ea() && (this.nb.add(this.xa), this.yf ? this.mb.add(1) : this.mb.add(0)), 0 > _ && (_ = this.Ka(m)); + var L = this.xa; + this.fm(this.xa + 1), this.oc(); + var B = this.Ca(m); + this.Aa[0].xj(2 * (B + _), C, 2 * L), C = 1; + for (var q = this.description.Ba; C < q; C++) { + var Z = this.description.Fd(C), ie = A.sa.Wa(Z); + this.Aa[C].Nn(ie * (B + _), A.sa.te(Z), ie, ie * L); + } + for (m += 1; m <= D; m++) + this.nb.write(m, this.nb.read(m) + 1); + }, b.prototype.yB = function(m, _) { + var C = this.ea(); + if (0 > m && (m = C - 1), m >= C || _ >= this.Ka(m)) + throw A.i.ga("index out of bounds"); + this.oc(); + var D = this.Ca(m); + 0 > _ && (_ = this.Ka(m) - 1), _ = D + _, D = 0; + for (var L = this.description.Ba; D < L; D++) + if (this.Aa[D] != null) { + var B = A.sa.Wa(this.description.Fd(D)); + this.Aa[D].Gn(B * _, B, B * this.xa); + } + for (; C >= m + 1; C--) + _ = this.nb.read(C), this.nb.write(C, _ - 1); + this.xa--, this.Rg--, this.Qc(1993); + }, b.prototype.pE = function(m, _, C, D) { + if (m = this.Ca(m) + _, (C = this.Ca(C) + D) < m || 0 > m || C > this.I() - 1) + throw A.i.O(); + _ = 0, (D = this.Ha()).Wb(m); + do { + for (; D.Ia() && (m = D.ia(), D.xb() != C); ) + _ += m = m.Rb(); + if (D.xb() == C) + break; + } while (D.ab()); + return _; + }, b.prototype.aO = function(m, _, C) { + if (_ = this.Ca(m) + _, C = this.Ca(m) + C, 0 > _ || C > this.I() - 1) + throw A.i.O(); + var D = this.Ha(); + if (_ > C) { + if (!this.ec(m)) + throw A.i.O("cannot iterate across an open path"); + D.EB(); + } + var L = m = 0; + D.Wb(_); + do + L += m, m = D.ia().Rb(); + while (D.xb() != C); + return L; + }, b.prototype.ng = function() { + return A.si.im(this, null); + }, b.prototype.FS = function(m, _, C) { + for (var D = m; D < C - 1; D++) + if (this.ec(D)) + throw A.i.O("cannot interpolate across closed paths"); + if ((D = this.description.Ba) != 1) { + var L = this.pE(m, _, C, void 0); + if (L != 0) + for (var B = 1; B < D; B++) { + var q = this.description.ld(B); + if (A.sa.gz(q) != 2) + for (var Z = A.sa.Wa(q), ie = 0; ie < Z; ie++) + this.HS(q, m, _, C, L, ie); + } + } + }, b.prototype.ES = function(m, _, C) { + var D = this.description.Ba; + if (D != 1) { + var L = this.aO(m, _, C); + if (L != 0) + for (var B = 1; B < D; B++) { + var q = this.description.ld(B); + if (A.sa.gz(q) != 2) + for (var Z = A.sa.Wa(q), ie = 0; ie < Z; ie++) + this.GS(q, m, _, C, L, ie); + } + } + }, b.prototype.HS = function(m, _, C, D, L, B) { + var q = this.Ha(), Z = this.Ca(_) + C; + D = this.Ca(D) + void 0, _ = this.Vc(m, Z, B), C = this.Vc(m, D, B); + var ie = _, se = 0; + q.Wb(Z); + do + if (q.Ia()) { + if (q.ia(), q.xb() == D) + break; + this.setAttribute(m, q.xb(), B, ie), q.ni(); + do { + if (Z = q.ia(), q.kk() == D) + return; + se += Z = Z.Rb(), ie = A.mc.jq(_, C, se / L), q.Qn() || this.setAttribute(m, q.kk(), B, ie); + } while (q.Ia()); + } + while (q.ab()); + }, b.prototype.GS = function(m, _, C, D, L, B) { + var q = this.Ha(), Z = this.Ca(_) + C; + if ((_ = this.Ca(_) + D) != Z) { + D = this.Vc(m, Z, B), C = this.Vc(m, _, B); + var ie = 0; + q.Wb(Z), q.EB(), Z = D; + do { + var se = q.ia(); + this.setAttribute(m, q.xb(), B, Z), ie += Z = se.Rb(), Z = A.mc.jq(D, C, ie / L); + } while (q.kk() != _); + } + }, b.prototype.Pa = function() { + this.vq = 0, this.Og = !1, this.Td = this.Se = this.Nj = this.mb = this.nb = null, this.rD(); + }, b.prototype.Pc = function(m) { + m instanceof A.Ed ? this.TD(m, -1) : this.rN(m); + }, b.prototype.TD = function(m, _) { + if (!this.B() && !m.isIdentity()) { + this.oc(); + var C = this.Aa[0], D = new A.h(), L = new A.h(); + if (0 > _) { + var B = this.vm(), q = 0; + _ = this.xa; + } else + B = this.Av(_), q = this.Ca(_), _ = this.Wc(_); + for (; q < _; q++) { + if (D.x = C.read(2 * q), D.y = C.read(2 * q + 1), B) { + var Z = this.Nj.read(q); + if (0 <= Z) + switch (7 & this.Se.read(q)) { + case 2: + L.x = this.Td.read(Z), L.y = this.Td.read(Z + 1), m.Gh(L, L), this.Td.write(Z, L.x), this.Td.write(Z + 1, L.y), L.x = this.Td.read(Z + 3), L.y = this.Td.read(Z + 4), m.Gh(L, L), this.Td.write(Z + 3, L.x), this.Td.write(Z + 4, L.y); + break; + case 4: + throw A.i.Ra(); + } + } + m.Gh(D, D), C.write(2 * q, D.x), C.write(2 * q + 1, D.y); + } + this.Qc(1993); + } + }, b.prototype.rN = function(m) { + if (!this.B()) { + this.se(1), this.oc(); + for (var _ = this.Aa[0], C = this.Aa[1], D = new A.Od(), L = new A.Od(), B = this.vm(), q = 0; q < this.xa; q++) { + if (D.x = _.read(2 * q), D.y = _.read(2 * q + 1), D.z = C.read(q), B) { + var Z = this.Nj.read(q); + if (0 <= Z) + switch (7 & this.Se.read(q)) { + case 2: + L.x = this.Td.read(Z), L.y = this.Td.read(Z + 1), L.z = this.Td.read(Z + 2), L = m.hp(L), this.Td.write(Z, L.x), this.Td.write(Z + 1, L.y), this.Td.write(Z + 1, L.z), L.x = this.Td.read(Z + 3), L.y = this.Td.read(Z + 4), L.z = this.Td.read(Z + 5), L = m.hp(L), this.Td.write(Z + 3, L.x), this.Td.write(Z + 4, L.y), this.Td.write(Z + 5, L.z); + break; + case 4: + throw A.i.Ra(); + } + } + D = m.hp(D), _.write(2 * q, D.x), _.write(2 * q + 1, D.y), C.write(q, D.z); + } + this.Qc(1993); + } + }, b.prototype.ey = function() { + this.nb == null && (this.nb = A.Zc.Qh(1, 0), this.mb = A.Zc.Or(1, 0)), this.Se != null && (this.Se.resize(this.Rg, 1), this.Nj.resize(this.Rg, -1)); + }, b.prototype.qp = function(m) { + m.Og = !1, m.vq = this.vq, m.zq = this.zq, m.nb = this.nb != null ? A.ja.Dn(this.nb) : null, m.mb = this.mb != null ? A.rn.Dn(this.mb) : null, m.Nj = this.Nj != null ? A.ja.Dn(this.Nj) : null, m.Se = this.Se != null ? A.rn.Dn(this.Se) : null, m.Td = this.Td != null ? A.ce.Dn(this.Td) : null, m.uq = this.uq, m.tq = this.tq, m.Cj = this.ck(1024) ? null : this.Cj; + }, b.prototype.Rb = function() { + if (!this.ck(512)) + return this.uq; + for (var m = this.Ha(), _ = new A.Ex(0); m.ab(); ) + for (; m.Ia(); ) + _.add(m.ia().Rb()); + return this.uq = _.tm(), this.Nf(512, !1), _.tm(); + }, b.prototype.Nb = function(m) { + if (m == this) + return !0; + if (!(m instanceof b && T.prototype.Nb.call(this, m))) + return !1; + var _ = this.ea(); + return !(_ != m.ea() || this.nb != null && !this.nb.Nb(m.nb, 0, _ + 1) || this.zq != m.zq || this.mb != null && !this.mb.Nb(m.mb, 0, _)) && T.prototype.Nb.call(this, m); + }, b.prototype.Ha = function() { + return new A.TL(this); + }, b.prototype.dy = function(m) { + if (T.prototype.dy.call(this, m), this.vm()) + for (m = this.Ha(); m.ab(); ) + m.Ia(); + }, b.prototype.Ap = function(m, _) { + if (T.prototype.Ap.call(this, m, _), this.vm()) + for (m = this.Ha(); m.ab(); ) + m.Ia(); + }, b.prototype.Zx = function() { + this.xa = this.nb == null || this.nb.size == 0 ? 0 : this.nb.read(this.nb.size - 1); + }, b.prototype.He = function() { + return this.yf ? (this.zu(), this.tq) : 0; + }, b.prototype.Gv = function(m) { + return !!this.yf && (this.ck(8) ? (this.zu(), 0 < this.Cj.read(m)) : (4 & this.mb.read(m)) != 0); + }, b.prototype.Kr = function(m) { + return this.yf ? (this.zu(), this.Cj.read(m)) : 0; + }, b.prototype.zu = function() { + if (this.ck(1024)) { + var m = this.ea(); + this.Cj == null ? this.Cj = new A.ce(m) : this.Cj.size != m && this.Cj.resize(m), m = new A.Ex(0); + for (var _ = new A.Ex(0), C = new A.h(), D = 0, L = this.Ha(); L.ab(); ) { + for (_.reset(), this.D(this.Ca(L.gb), C); L.Ia(); ) + _.add(L.ia().Sx(C.x, C.y)); + m.add(_.tm()); + var B = D++; + this.Cj.write(B, _.tm()); + } + this.tq = m.tm(), this.Nf(1024, !1); + } + }, b.prototype.AR = function() { + if (this.yf) { + this.hm(); + for (var m = this.ea(), _ = 0; _ < m; _++) + 4 & this.mb.read(_); + } + }, b.prototype.hm = function() { + if (this.ck(8)) { + this.zu(); + var m = this.ea(); + (this.mb == null || this.mb.size < m) && (this.mb = A.Zc.Or(m + 1)); + for (var _ = 1, C = 0; C < m; C++) { + var D = this.Cj.read(C); + C == 0 && (_ = 0 < D ? 1 : -1), 0 < D * _ ? this.mb.uJ(C, 4) : this.mb.FE(C, 4); + } + this.Nf(8, !1); + } + }, b.prototype.nz = function(m) { + var _ = this.gb, C = this.ea(); + if (0 <= _ && _ < C) { + if (m < this.Wc(_)) { + if (m >= this.Ca(_)) + return _; + _--; + } else + _++; + if (0 <= _ && _ < C && m >= this.Ca(_) && m < this.Wc(_)) + return this.gb = _; + } + if (5 > C) { + for (_ = 0; _ < C; _++) + if (m < this.Wc(_)) + return this.gb = _; + throw A.i.ga("corrupted geometry"); + } + for (_ = 0, --C; C > _; ) { + var D = _ + (C - _ >> 1); + if (m < this.Ca(D)) + C = D - 1; + else { + if (!(m >= (_ = this.Wc(D)))) + return this.gb = D; + _ = D + 1; + } + } + return this.gb = _; + }, b.prototype.sz = function() { + var m = this.I(); + if (!this.yf) { + m -= this.ea(); + for (var _ = 0, C = this.ea(); _ < C; _++) + this.ec(_) && m++; + } + return m; + }, b.prototype.tv = function(m) { + var _ = this.Ka(m); + return this.ec(m) || _--, _; + }, b.prototype.Ja = function() { + return new b(this.yf, this.description); + }, b.prototype.Eb = function() { + return this.yf ? 2 : 1; + }, b.prototype.K = function() { + return this.yf ? 1736 : 1607; + }, b.prototype.LJ = function(m) { + this.nb = m, this.Qc(16777215); + }, b.prototype.QR = function() { + return this.vx(), this.Se; + }, b.prototype.ER = function() { + return this.vx(), this.mb; + }, b.prototype.KJ = function(m) { + this.mb = m, this.Qc(16777215); + }, b.prototype.ea = function() { + return this.nb != null ? this.nb.size - 1 : 0; + }, b.prototype.Wc = function(m) { + return this.nb.read(m + 1); + }, b.prototype.Ka = function(m) { + return this.nb.read(m + 1) - this.nb.read(m); + }, b.prototype.Ca = function(m) { + return this.nb.read(m); + }, b.prototype.nu = function(m, _) { + this.Cb == null && (this.Cb = new A.Wk()), _ = A.Mx.kW(_); + var C = this.Cb.Hk; + if (C != null) { + if (!(C.Kk < m || _ > C.MR())) + return !0; + this.Cb.tD(null); + } + return C = A.Mx.create(this, m, _), this.Cb.tD(C), !0; + }, b.prototype.dc = function() { + var m = T.prototype.dc.call(this); + if (!this.Bc()) { + var _ = this.ea(); + this.nb != null && this.nb.Cn(m, 0, _ + 1), this.mb != null && this.mb.Cn(m, 0, _); + } + return m; + }, b.prototype.UF = function(m) { + return this.Se != null ? this.Se.read(m) : 1; + }, b.prototype.cc = function(m, _, C) { + var D = this.nz(m); + if (m == this.Wc(D) - 1 && !this.ec(D)) + throw A.i.ga("index out of bounds"); + this.oc(); + var L = this.Se, B = 1; + if (L != null && (B = 7 & L.read(m)), B !== 1) + throw A.i.Ra(); + if (_.Qr(), _ = _.get(), C ? _.Pf(A.fe.pg()) : _.Pf(this.description), D = m == this.Wc(D) - 1 && this.ec(D) ? this.Ca(D) : m + 1, L = new A.h(), this.D(m, L), _.Ec(L), this.D(D, L), _.Rc(L), !C) + for (C = 1, L = this.description.Ba; C < L; C++) { + B = this.description.Fd(C); + for (var q = A.sa.Wa(B), Z = 0; Z < q; Z++) { + var ie = this.Vc(B, m, Z); + _.TB(B, Z, ie), ie = this.Vc(B, D, Z), _.JB(B, Z, ie); + } + } + }, b.prototype.Tj = function(m, _) { + if (m >= this.ea()) + throw A.i.O(); + if (this.B()) + _.Pa(); + else { + if (this.Av(m)) + throw A.i.ga("not implemented"); + var C = this.vb(0), D = new A.h(), L = new A.l(); + L.Pa(); + var B = this.Ca(m); + for (m = this.Wc(m); B < m; B++) + C.uc(2 * B, D), L.$b(D); + _.L(L); + } + }, b.prototype.hj = function(m) { + return this.Cb == null && (this.Cb = new A.Wk()), !(m == 0 || 16 > this.I()) && (m = A.ua.iE(this), this.Cb.RM(m), !0); + }, b.prototype.cM = function() { + if (this.Cb == null && (this.Cb = new A.Wk()), this.Cb.Bo == null) { + this.Cb.sD(null); + var m = A.ua.TN(this); + this.Cb.sD(m); + } + }, b.prototype.$o = function(m) { + this.zq = m; + }, b.prototype.Kn = function() { + return this.zq; + }, b.prototype.yD = function(m) { + if (this == m) + throw A.i.ga("MultiPathImpl.add"); + for (var _ = this.ea(), C = 0; C < m.ea(); C++) + this.addPath(m, C, !0), this.xU(_), _++; + }, b.prototype.fO = function(m) { + var _ = this.nz(m), C = this.Ca(_); + if (C != m) { + if (m >= (_ = this.Wc(_)) || m < C) + throw A.i.ga("change_ring_start_point"); + for (var D = 0, L = this.description.Ba; D < L; D++) { + var B = this.description.ld(D); + B = A.sa.Wa(B), this.Aa[D].rotate(C * B, m * B, _ * B); + } + } + }, b; + }(A.Fx); + A.Xk = H; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T(b) { + var m = H.call(this) || this; + if (b !== void 0) { + if (b == null) + throw A.i.O(); + m.description = b; + } else + m.description = A.fe.pg(); + return m.xa = 0, m; + } + return Ne(T, H), T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.add = function(b) { + this.resize(this.xa + 1), this.Fh(this.xa - 1, b); + }, T.prototype.Du = function(b, m) { + this.resize(this.xa + 1); + var _ = new A.h(); + _.na(b, m), this.Db(this.xa - 1, _); + }, T.prototype.Gd = function(b, m, _) { + if (_ = 0 > _ ? b.I() : _, 0 > m || m > b.I() || _ < m) + throw A.i.O(); + if (m != _) { + this.Ll(b.description), _ -= m; + var C = this.xa; + this.resize(this.xa + _), this.oc(); + for (var D = 0, L = b.description.Ba; D < L; D++) { + var B = b.description.Fd(D), q = A.sa.Wa(B), Z = this.vb(B); + B = b.vb(B), Z.On(C * q, B, m * q, _ * q, !0, 1, C * q); + } + } + }, T.prototype.CD = function(b, m) { + var _ = b.length; + if (m = 0 > m ? _ : m, 0 > _ || 0 > m) + throw A.i.O(); + if (m != 0) { + _ = m - 0, m = this.xa, this.resize(this.xa + _); + for (var C = 0; C < _; C++) + this.Db(m + C, b[0 + C]); + } + }, T.prototype.yB = function(b) { + if (0 > b || b >= this.I()) + throw A.i.ga("index out of bounds"); + this.oc(); + for (var m = 0, _ = this.description.Ba; m < _; m++) + if (this.Aa[m] != null) { + var C = A.sa.Wa(this.description.Fd(m)); + this.Aa[m].Gn(C * b, C, C * this.xa); + } + this.xa--, this.Rg--, this.Qc(1993); + }, T.prototype.resize = function(b) { + this.fm(b); + }, T.prototype.qp = function() { + }, T.prototype.Pa = function() { + H.prototype.rD.call(this); + }, T.prototype.Pc = function(b) { + if (b instanceof A.Ed) { + if (this.B()) + return; + this.oc(); + for (var m = this.Aa[0], _ = new A.h(), C = 0; C < this.xa; C++) + _.x = m.read(2 * C), _.y = m.read(2 * C + 1), b.Gh(_, _), m.write(2 * C, _.x), m.write(2 * C + 1, _.y); + } else { + if (this.B()) + return; + this.oc(), this.se(1), this.oc(), m = this.Aa[0], _ = this.Aa[1]; + var D = new A.Od(); + for (C = 0; C < this.xa; C++) { + D.x = m.read(2 * C), D.y = m.read(2 * C + 1), D.z = _.read(C); + var L = b.hp(D); + m.write(2 * C, L.x), m.write(2 * C + 1, L.y), _.write(C, L.z); + } + } + this.Qc(1993); + }, T.prototype.Eb = function() { + return 0; + }, T.prototype.K = function() { + return 550; + }, T.prototype.He = function() { + return 0; + }, T.prototype.Rb = function() { + return 0; + }, T.prototype.Nb = function(b) { + return b == this || b instanceof T && H.prototype.Nb.call(this, b); + }, T.prototype.gW = function(b, m) { + var _ = this.xa; + if (_ = Math.min(_, m + 1e3), 0 > m || m >= this.xa || _ < m || b.length != 1e3) + throw A.i.O(); + var C = _ - m, D = []; + for (this.vb(0).Xw(2 * m, 2 * C, D, 0, !0), m = 0; m < C; m++) + b[m] = A.h.construct(D[2 * m], D[2 * m + 1]); + return _; + }, T.prototype.Zx = function() { + }, T.prototype.ey = function() { + }, T.prototype.nu = function() { + return !1; + }, T.prototype.hj = function() { + return !1; + }, T.prototype.ng = function() { + return null; + }, T; + }(A.Fx); + A.ee = ve; + }(le || (le = {})), function(A) { + var ve; + (ve = A.dL || (A.dL = {}))[ve.NotDetermined = 0] = "NotDetermined", ve[ve.Structure = 1] = "Structure", ve[ve.DegenerateSegments = 2] = "DegenerateSegments", ve[ve.Clustering = 3] = "Clustering", ve[ve.Cracking = 4] = "Cracking", ve[ve.CrossOver = 5] = "CrossOver", ve[ve.RingOrientation = 6] = "RingOrientation", ve[ve.RingOrder = 7] = "RingOrder", ve[ve.OGCPolylineSelfTangency = 8] = "OGCPolylineSelfTangency", ve[ve.OGCPolygonSelfTangency = 9] = "OGCPolygonSelfTangency", ve[ve.OGCDisconnectedInterior = 10] = "OGCDisconnectedInterior"; + var H = function() { + function T(b, m, _) { + b === void 0 ? (this.Lj = 0, this.Mo = this.Lo = -1) : (this.Lj = b, this.Lo = m, this.Mo = _); + } + return T.prototype.Yt = function(b) { + this.Lj = b.Lj, this.Lo = b.Lo, this.Mo = b.Mo; + }, T; + }(); + A.Nd = H; + }(le || (le = {})), function(A) { + A.P = function() { + function ve() { + } + return ve.assert = function(H) { + if (H === !1) + throw A.i.BK(); + }, ve.XJ = function(H) { + return isNaN(H) ? NaN : H === 0 ? H : 0 < H ? 1 : -1; + }, ve.Hu = function(H) { + var T; + T === void 0 && (T = 0); + for (var b = [], m = 0; m < H; m++) + b[m] = ve.mg(2, T); + return b; + }, ve.mg = function(H, T) { + T === void 0 && (T = 0); + for (var b = [], m = 0; m < H; m++) + b[m] = T; + return b; + }, ve.bv = function(H, T) { + var b, m; + for (b === void 0 && (b = 0), m === void 0 && (m = H.length - 1); b <= m; b++) + H[b] = T; + }, ve.Tk = function(H, T, b) { + return H < T ? T : H > b ? b : H; + }, ve.Vh = function(H, T) { + var b = 5381; + return ((b = ((b = ((b = T !== void 0 ? (T << 5) + T + (255 & H) : (b << 5) + b + (255 & H)) << 5) + b + (H >> 8 & 255)) << 5) + b + (H >> 16 & 255)) << 5) + b + (H >> 24 & 255) & 2147483647; + }, ve.wj = function() { + throw Error("Not Implemented"); + }, ve.XA = function(H) { + return ve.WT(H) + 12345 & 2147483647; + }, ve.SG = function(H) { + var T = 32, b = H % ve.Px | 0, m = H / ve.Px | 0; + return (T &= 63) == 0 ? H : (32 > T ? (H = b >>> T | m << 32 - T, T = m >> T) : (H = m >> T - 32, T = 0 <= m ? 0 : -1), T * ve.Px + (H >>> 0)); + }, ve.WT = function(H) { + var T = 1103515245, b = 65535 & T; + return ((T - b) * (H |= 0) | 0) + (b * H | 0) | 0; + }, ve.truncate = function(H) { + return 0 > H ? -1 * Math.floor(Math.abs(H)) : Math.floor(H); + }, ve.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1, ve.MIN_SAFE_INTEGER = -ve.MAX_SAFE_INTEGER, ve.QC = 65536, ve.Px = ve.QC * ve.QC, ve; + }(); + }(le || (le = {})), function(A) { + var ve; + (ve = A.xL || (A.xL = {}))[ve.Project = 0] = "Project", ve[ve.Union = 1] = "Union", ve[ve.Difference = 2] = "Difference", ve[ve.Proximity2D = 3] = "Proximity2D", ve[ve.Relate = 4] = "Relate", ve[ve.Equals = 5] = "Equals", ve[ve.Disjoint = 6] = "Disjoint", ve[ve.Intersects = 7] = "Intersects", ve[ve.Within = 8] = "Within", ve[ve.Contains = 9] = "Contains", ve[ve.Crosses = 10] = "Crosses", ve[ve.Touches = 11] = "Touches", ve[ve.Overlaps = 12] = "Overlaps", ve[ve.Buffer = 13] = "Buffer", ve[ve.Distance = 14] = "Distance", ve[ve.Intersection = 15] = "Intersection", ve[ve.Clip = 16] = "Clip", ve[ve.Cut = 17] = "Cut", ve[ve.DensifyByLength = 18] = "DensifyByLength", ve[ve.DensifyByAngle = 19] = "DensifyByAngle", ve[ve.LabelPoint = 20] = "LabelPoint", ve[ve.GeodesicBuffer = 21] = "GeodesicBuffer", ve[ve.GeodeticDensifyByLength = 22] = "GeodeticDensifyByLength", ve[ve.ShapePreservingDensify = 23] = "ShapePreservingDensify", ve[ve.GeodeticLength = 24] = "GeodeticLength", ve[ve.GeodeticArea = 25] = "GeodeticArea", ve[ve.Simplify = 26] = "Simplify", ve[ve.SimplifyOGC = 27] = "SimplifyOGC", ve[ve.Offset = 28] = "Offset", ve[ve.Generalize = 29] = "Generalize", ve[ve.SymmetricDifference = 30] = "SymmetricDifference", ve[ve.ConvexHull = 31] = "ConvexHull", ve[ve.Boundary = 32] = "Boundary", ve[ve.SimpleRelation = 33] = "SimpleRelation"; + var H = function() { + function T() { + } + return T.prototype.K = function() { + return null; + }, T.prototype.yn = function() { + }, T.prototype.Ku = function() { + return !1; + }, T; + }(); + A.Ge = H; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 13; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C, D) { + return b instanceof A.ba ? (D = new A.$c(b), this.W(D, m, [_], !1, C).next()) : C === !0 ? (_ = new A.wC(b, m, _, !1, D), A.Ih.local().W(_, m, D)) : new A.wC(b, m, _, !1, D); + }, T.instance = null, T; + }(A.Ge); + A.vC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C) { + this.za = -1, this.Sd = T, this.Vz = b, this.Es = m, this.nT = new A.l(), this.nT.Pa(), this.ho = -1, this.Vb = C; + } + return H.prototype.next = function() { + for (var T; (T = this.Sd.next()) != null; ) + return this.za = this.Sd.Ma(), this.ho + 1 < this.Es.length && this.ho++, this.buffer(T, this.Es[this.ho]); + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.buffer = function(T, b) { + return A.CK.buffer(T, b, this.Vz, NaN, 96, this.Vb); + }, H.prototype.re = function() { + }, H; + }(); + A.wC = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 16; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C) { + return b instanceof A.ba ? (b = new A.$c(b), this.W(b, m, _, C).next()) : new A.gL(b, m, _, C); + }, T.instance = null, T; + }(A.Ge); + A.fL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m) { + if (this.za = -1, T == null) + throw A.i.O(); + this.aa = b, this.Ak = T, this.ra = A.ua.Xd(m, b, !1); + } + return H.prototype.next = function() { + var T; + return (T = this.Ak.next()) != null ? (this.za = this.Ak.Ma(), A.Vd.clip(T, this.aa, this.ra, 0)) : null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.re = function() { + }, H; + }(); + A.gL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 31; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _) { + return b instanceof A.ba ? A.yC.mE(b) : new A.yC(m, b, _); + }, T.instance = null, T; + }(A.Ge); + A.xC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m) { + if (this.pA = new A.au(), this.za = -1, b == null) + throw A.i.O(); + this.YG = T, this.Jc = !1, this.Ak = b, this.Vb = m; + } + return H.prototype.next = function() { + if (this.YG) { + if (!this.Jc) { + var T = this.ZN(this.Ak); + return this.Jc = !0, T; + } + return null; + } + if (!this.Jc) { + if ((T = this.Ak.next()) != null) + return this.za = this.Ak.Ma(), H.mE(T); + this.Jc = !0; + } + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.ZN = function(T) { + for (var b; (b = T.next()) != null; ) + this.pA.Ib(b); + return this.pA.YQ(); + }, H.prototype.re = function() { + if (!this.Jc) { + if (!this.YG) + throw A.i.ga("Invalid call for non merging convex hull."); + var T = this.Ak.next(); + if (T == null) + throw A.i.ga("Expects a non-null geometry."); + this.pA.Ib(T); + } + }, H.mE = function(T) { + if (H.QS(T)) + return T; + var b = T.K(); + if (A.Xk.zd(b)) + return (b = new A.Ua(T.description)).pc(T, !0), b; + if (b == 550 && T.I() == 2) { + var m = new A.Ta(); + return b = new A.Ua(T.description), T.we(0, m), b.nf(m), T.we(1, m), b.lineTo(m), b; + } + return A.au.MO(T); + }, H.QS = function(T) { + if (T.B()) + return !0; + var b = T.K(); + return b == 33 || b == 197 || !A.Xk.zd(b) && (b == 550 ? T.I() == 1 : b == 1607 ? T.ea() == 1 && 2 >= T.I() : T.ea() == 1 && (2 >= T.I() || A.au.EG(T, 0))); + }, H; + }(); + A.yC = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 17; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C, D) { + return new A.iL(b, m, _, C, D); + }, T.instance = null, T; + }(A.Ge); + A.hL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C) { + if (this.Vf = null, b == null || m == null) + throw A.i.ga("invalid argument"); + this.kT = T, this.iA = b, this.gH = m, T = A.ua.ov(b, m), this.ra = A.ua.Xd(_, T, !0), this.fH = -1, this.od = C; + } + return H.prototype.Ma = function() { + return 0; + }, H.prototype.next = function() { + return this.MQ(), ++this.fH < this.Vf.length ? this.Vf[this.fH] : null; + }, H.prototype.MQ = function() { + if (this.Vf == null) + switch (this.Vf = [], this.iA.K()) { + case 1607: + this.OQ(); + break; + case 1736: + this.NQ(); + } + }, H.prototype.OQ = function() { + var T = new A.Ua(), b = new A.Ua(), m = new A.Ua(); + this.Vf.push(T), this.Vf.push(b); + var _ = []; + A.GK.EK(this.kT, this.iA, this.gH, this.ra, _, this.od); + for (var C = 0; C < _.length; C++) { + var D = _[C]; + if (D.ct == 0) + T.add(D.Y, !1); + else if (D.ct == 1 || D.ct == 2) + b.add(D.Y, !1); + else if (D.ct == 3) + this.Vf.push(D.Y); + else { + if (D.ct != 4) + throw A.i.ga("internal"); + m.add(D.Y, !1); + } + } + m.B() || T.B() && b.B() && !(3 <= this.Vf.length) || this.Vf.push(m), T.B() && b.B() && 3 > this.Vf.length && (this.Vf.length = 0); + }, H.prototype.NQ = function() { + var T = new A.ja(0), b = new A.hd(), m = b.WE(), _ = b.Ib(this.iA), C = b.Ib(this.gH), D = new A.Hg(); + try { + D.Gt(b, this.ra, this.od), D.fl(m, _, C, T); + var L = b.Ke(_), B = new A.Ea(), q = new A.Ea(); + for (this.Vf.length = 0, this.Vf.push(B), this.Vf.push(q), _ = 0; _ < T.size; _++) { + var Z = new A.hd(), ie = Z.Ib(L), se = Z.Ib(b.Ke(T.get(_))); + D.fr(Z, this.od); + var de = D.Cv(ie, se), Ce = Z.Ke(de); + if (!Ce.B()) { + var Ve = b.FF(T.get(_), m); + Ve == 2 ? B.add(Ce, !1) : Ve == 1 ? q.add(Ce, !1) : this.Vf.push(Ce); + var Je = new A.hd(); + ie = Je.Ib(L), se = Je.Ib(b.Ke(T.get(_))), D.fr(Je, this.od), L = Je.Ke(D.km(ie, se)); + } + } + !L.B() && 0 < T.size && this.Vf.push(L), B.B() && q.B() && (this.Vf.length = 0); + } finally { + D.Wg(); + } + }, H.prototype.re = function() { + }, H; + }(); + A.iL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 18; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _) { + if (b instanceof A.ba) + return b = new A.$c(b), this.W(b, m, _).next(); + if (0 >= m) + throw A.i.O(); + return new A.jL(b, m, _); + }, T.instance = null, T; + }(A.Ge); + A.Zl = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b) { + this.za = -1, this.Sd = T, this.Rs = b; + } + return H.prototype.Ma = function() { + return this.za; + }, H.prototype.next = function() { + var T; + return (T = this.Sd.next()) != null ? (this.za = this.Sd.Ma(), this.IP(T)) : null; + }, H.prototype.IP = function(T) { + if (T.B() || 1 > T.Eb()) + return T; + var b = T.K(); + if (b == 1736 || b == 1607) + return this.Iy(T); + if (A.ba.zd(b)) + return this.KP(T); + if (b == 197) + return this.JP(T); + throw A.i.Ra(); + }, H.prototype.KP = function(T) { + if (T.Rb() <= this.Rs) + return T; + var b = new A.Ua(T.description); + return b.pc(T, !0), this.Iy(b); + }, H.prototype.JP = function(T) { + var b = new A.Ea(T.description); + b.bd(T, !1); + var m = new A.l(); + return T.A(m), T = m.da(), m.S() <= this.Rs && T <= this.Rs ? b : this.Iy(b); + }, H.prototype.Iy = function(T) { + for (var b = T.Ja(), m = T.Ha(); m.ab(); ) + for (var _ = !0; m.Ia(); ) { + var C = m.ia(); + if (C.K() != 322) + throw A.i.ga("not implemented"); + var D = m.Qn(), L = C.Rb(); + if (L > this.Rs) { + var B = Math.ceil(L / this.Rs); + L = new A.Ta(T.description), _ && (C.Vo(L), b.nf(L)); + var q = _ = 1 / B, Z = 0; + for (--B; Z < B; Z++) + C.Vw(q, L), b.lineTo(L), q += _; + D ? b.Cp() : (C.Ro(L), b.lineTo(L)); + } else + D ? b.Cp() : b.pc(C, _); + _ = !1; + } + return b; + }, H.prototype.re = function() { + }, H; + }(); + A.jL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.K = function() { + return 2; + }, T.prototype.W = function(b, m, _, C) { + return b instanceof A.ba ? (b = new A.$c(b), m = new A.$c(m), this.W(b, m, _, C).next()) : new A.kL(b, m, _, C); + }, T.km = function(b, m, _, C) { + if (b.B() || m.B()) + return b; + var D = b.Eb(), L = m.Eb(); + if (D > L) + return b; + var B = b.K(), q = m.K(), Z = new A.l(), ie = new A.l(), se = new A.l(); + b.A(Z), m.A(ie), se.L(Z), se.$b(ie); + var de = (se = A.ua.Xd(_, se, !0)) * Math.sqrt(2) * 1.00001, Ce = new A.l(); + if (Ce.L(Z), Ce.X(de, de), !Ce.isIntersecting(ie)) + return b; + if (D == 1 && L == 2) + return T.FV(b, m, q, _, C); + if (B == 33) + switch (A.Xk.zd(q) ? (_ = new A.Ua(m.description), _.pc(m, !0)) : _ = m, q) { + case 1736: + return T.SU(b, _, se); + case 1607: + return T.TU(b, _, se); + case 550: + return T.QU(b, _, se); + case 197: + return T.PU(b, _, se); + case 33: + return T.RU(b, _, se); + default: + throw A.i.O(); + } + else if (B == 550) + switch (q) { + case 1736: + return T.iU(b, m, se); + case 197: + return T.gU(b, m, se); + case 33: + return T.hU(b, m, se); + } + return A.Hg.km(b, m, _, C); + }, T.SU = function(b, m, _) { + return A.jd.FG(m, b, _) == 0 ? b : b.Ja(); + }, T.TU = function(b, m, _) { + var C = b.D(); + m = m.Ha(); + for (var D = _ * Math.sqrt(2) * 1.00001, L = D * D, B = new A.l(); m.ab(); ) + for (; m.Ia(); ) { + var q = m.ia(); + if (q.A(B), B.X(D, D), B.contains(C)) { + if (q.ss(C, _)) + return b.Ja(); + var Z = q.bc(); + if (A.h.zc(C, Z) <= L || (Z = q.xc(), A.h.zc(C, Z) <= L)) + return b.Ja(); + } + } + return b; + }, T.QU = function(b, m, _) { + var C = m.vb(0); + m = m.I(); + var D = b.D(), L = new A.h(); + _ = _ * Math.sqrt(2) * 1.00001, _ *= _; + for (var B = 0; B < m; B++) + if (C.uc(2 * B, L), A.h.zc(L, D) <= _) + return b.Ja(); + return b; + }, T.PU = function(b, m, _) { + var C = new A.l(); + return m.A(C), C.X(_, _), m = b.D(), C.contains(m) ? b.Ja() : b; + }, T.RU = function(b, m, _) { + _ = _ * Math.sqrt(2) * 1.00001, _ *= _; + var C = b.D(); + return m = m.D(), A.h.zc(C, m) <= _ ? b.Ja() : b; + }, T.iU = function(b, m, _) { + var C = new A.l(); + m.A(C), C.X(_, _); + for (var D = b.I(), L = !1, B = [], q = 0; q < D; q++) + B[q] = !1; + var Z = new A.h(); + for (q = 0; q < D; q++) + b.D(q, Z), C.contains(Z) && A.jd.Zd(m, Z, _) != 0 && (L = !0, B[q] = !0); + if (!L) + return b; + for (m = b.Ja(), q = 0; q < D; q++) + B[q] || m.Gd(b, q, q + 1); + return m; + }, T.gU = function(b, m, _) { + var C = new A.l(); + m.A(C), C.X(_, _), m = b.I(); + var D = !1; + _ = []; + for (var L = 0; L < m; L++) + _[L] = !1; + var B = new A.h(); + for (L = 0; L < m; L++) + b.D(L, B), C.contains(B) && (D = !0, _[L] = !0); + if (!D) + return b; + for (C = b.Ja(), L = 0; L < m; L++) + _[L] || C.Gd(b, L, L + 1); + return C; + }, T.hU = function(b, m, _) { + var C = b.vb(0), D = b.I(), L = m.D(), B = new A.h(), q = !1; + m = []; + for (var Z = 0; Z < D; Z++) + m[Z] = !1; + for (_ = (Z = _ * Math.sqrt(2) * 1.00001) * Z, Z = 0; Z < D; Z++) + C.uc(2 * Z, B), A.h.zc(B, L) <= _ && (q = !0, m[Z] = !0); + if (!q) + return b; + for (C = b.Ja(), Z = 0; Z < D; Z++) + m[Z] || C.Gd(b, Z, Z + 1); + return C; + }, T.FV = function(b, m, _, C, D) { + var L = new A.Hh(); + b.dn(L); + var B = new A.l(); + return m.A(B), L.$b(B), L.X(0.1 * L.S(), 0.1 * L.da()), (B = new A.Ea()).bd(L, !1), _ == 1736 ? B.add(m, !0) : B.bd(m, !0), A.Zj.local().W(b, B, C, D); + }, T.instance = null, T; + }(A.Ge); + A.mp = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _) { + this.vs = b == null, this.za = -1, this.Sd = T, this.Vz = m, this.rT = b.next(), this.Vb = _; + } + return H.prototype.next = function() { + return this.vs ? null : (T = this.Sd.next()) != null ? (this.za = this.Sd.Ma(), A.mp.km(T, this.rT, this.Vz, this.Vb)) : null; + var T; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.re = function() { + }, H; + }(); + A.kL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function T(b) { + this.od = b, this.Dj = new A.l(), this.Dj.Pa(), this.qh = new A.l(), this.qh.Pa(); + } + return T.prototype.Pt = function() { + var b = this.Dj.v; + this.Dj.v = this.qh.v, this.qh.v = b, b = this.Dj.C, this.Dj.C = this.qh.C, this.qh.C = b, b = this.Dj.G, this.Dj.G = this.qh.G, this.qh.G = b, b = this.Dj.H, this.Dj.H = this.qh.H, this.qh.H = b; + }, T.prototype.$P = function(b, m) { + if (this.od != null && !this.od.progress(-1, -1)) + throw A.i.hu("user_canceled"); + var _ = !this.Dj.isIntersecting(this.qh); + return A.ba.Ic(b.K()) && A.ba.Ic(m.K()) ? b.I() > m.I() ? this.bE(b, m, _) : (this.Pt(), b = this.bE(m, b, _), this.Pt(), b) : b.K() == 550 && A.ba.Ic(m.K()) ? (b = this.cE(m, b, _), this.Pt(), b) : m.K() == 550 && A.ba.Ic(b.K()) ? this.cE(b, m, _) : b.K() == 550 && m.K() == 550 ? b.I() > m.I() ? this.dE(b, m) : (this.Pt(), b = this.dE(m, b), this.Pt(), b) : 0; + }, T.prototype.bE = function(b, m, _) { + var C = b.Ha(), D = m.Ha(), L = new A.l(), B = new A.l(), q = 17976931348623157e292; + if (!_ && this.lY(b, m, C, D)) + return 0; + for (; C.ab(); ) + for (; C.Ia(); ) + if ((b = C.ia()).A(L), !(L.px(this.qh) > q)) { + for (; D.ab(); ) + for (; D.Ia(); ) + if ((m = D.ia()).A(B), L.px(B) < q && (m = b.ub(m, _), (m *= m) < q)) { + if (m == 0) + return 0; + q = m; + } + D.aj(); + } + return Math.sqrt(q); + }, T.prototype.cE = function(b, m, _) { + var C = b.Ha(), D = new A.l(), L = 17976931348623157e292, B = new A.h(), q = m.I(); + for (_ = !_ && b.K() == 1736; C.ab(); ) + for (; C.Ia(); ) { + var Z = C.ia(); + if (Z.A(D), !(1 < q && D.px(this.qh) > L)) { + for (var ie = 0; ie < q; ie++) { + if (m.D(ie, B), _ && A.jd.Zd(b, B, 0) != 0) + return 0; + var se = Z.ge(B, !1); + if (B.sub(Z.ic(se)), (se = B.Uk()) < L) { + if (se == 0) + return 0; + L = se; + } + } + _ = !1; + } + } + return Math.sqrt(L); + }, T.prototype.dE = function(b, m) { + for (var _, C = 17976931348623157e292, D = new A.h(), L = new A.h(), B = b.I(), q = m.I(), Z = 0; Z < B; Z++) + if (b.D(Z, D), !(1 < q && this.qh.dK(D) > C)) { + for (var ie = 0; ie < q; ie++) + if (m.D(ie, L), (_ = A.h.zc(D, L)) < C) { + if (_ == 0) + return 0; + C = _; + } + } + return Math.sqrt(C); + }, T.prototype.lY = function(b, m, _, C) { + if (b.K() == 1736) { + for (; C.ab(); ) + if (C.Ia()) { + var D = C.ia(); + if (A.jd.Zd(b, D.xc(), 0) != 0) + return !0; + } + C.aj(); + } + if (m.K() == 1736) { + for (; _.ab(); ) + if (_.Ia() && (b = _.ia(), A.jd.Zd(m, b.xc(), 0) != 0)) + return !0; + _.aj(); + } + return !1; + }, T.prototype.im = function(b, m) { + return b.B() || m.B() ? NaN : (b.A(this.Dj), m.A(this.qh), this.$P(b, m)); + }, T; + }(), H = function(T) { + function b() { + return T !== null && T.apply(this, arguments) || this; + } + return Ne(b, T), b.prototype.W = function(m, _, C) { + if (m == null || _ == null) + throw A.i.O(); + if (m.B() || _.B()) + return NaN; + var D = m.K(), L = _.K(); + if (D == 33) { + if (L == 33) + return A.h.ub(m.D(), _.D()); + if (L == 197) + return C = new A.l(), _.A(C), C.ub(m.D()); + (D = new A.ee()).add(m), m = D; + } else if (D == 197) { + if (L == 197) + return L = new A.l(), m.A(L), C = new A.l(), _.A(C), C.ub(L); + (D = new A.Ea()).bd(m, !1), m = D; + } + return L == 33 ? ((L = new A.ee()).add(_), _ = L) : L == 197 && ((L = new A.Ea()).bd(_, !1), _ = L), new ve(C).im(m, _); + }, b.local = function() { + return b.instance === null && (b.instance = new b()), b.instance; + }, b.prototype.K = function() { + return 14; + }, b.instance = null, b; + }(A.Ge); + A.lL = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _) { + this.uH = T, this.yH = b, this.od = _, this.VG = m; + } + return H.prototype.next = function() { + var T = this.uH.next(); + return T == null ? null : this.uC(T); + }, H.prototype.Ma = function() { + return this.uH.Ma(); + }, H.prototype.uC = function(T) { + var b = T.K(); + if (A.ba.Tn(b)) + return T; + if (b == 197) + return (b = new A.Ea(T.description)).bd(T, !1), this.uC(b); + if (T.B()) + return T; + if (T == null) + throw A.i.Ra(); + b = T.Ja(); + for (var m = new A.zb(), _ = 0, C = T.ea(); _ < C; _++) + this.OK(T, _, b, m); + return b; + }, H.prototype.OK = function(T, b, m, _) { + if (!(2 > T.Ka(b))) { + var C = T.Ca(b), D = T.Wc(b) - 1, L = T.vb(0), B = T.ec(b), q = new A.ja(0); + q.Jb(T.Ka(b) + 1); + var Z = new A.ja(0); + for (Z.Jb(T.Ka(b) + 1), q.add(B ? C : D), q.add(C), C = new A.h(); 1 < q.size; ) { + var ie = q.Gc(); + q.Jf(); + var se = q.Gc(); + T.D(ie, C), _.Ec(C), T.D(se, C), _.Rc(C), 0 <= (se = this.NK(_, C, L, ie, se, D)) ? (q.add(se), q.add(ie)) : Z.add(ie); + } + if (B || Z.add(q.get(0)), Z.size == q.size) + m.addPath(T, b, !0); + else if (2 <= Z.size && (!this.VG || Z.size != 2 || !(B || A.h.ub(T.Oa(Z.get(0)), T.Oa(Z.get(1))) <= this.yH))) { + for (b = new A.Ta(), _ = 0, D = Z.size; _ < D; _++) + T.we(Z.get(_), b), _ == 0 ? m.nf(b) : m.lineTo(b); + B && (this.VG || Z.size != 2 || m.lineTo(b), m.Cp()); + } + } + }, H.prototype.NK = function(T, b, m, _, C, D) { + var L = C - 1; + for (C <= _ && (L = D), D = C = -1, _ += 1; _ <= L; _++) { + m.uc(2 * _, b); + var B = b.x, q = b.y; + T.ic(T.ge(b, !1), b), b.x -= B, b.y -= q, (B = b.length()) > this.yH && B > D && (C = _, D = B); + } + return C; + }, H.prototype.re = function() { + }, H; + }(); + A.mL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 29; + }, T.prototype.W = function(b, m, _, C) { + return b instanceof A.ba ? (b = new A.$c(b), this.W(b, m, _, C).next()) : new A.mL(b, m, _, C); + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.instance = null, T; + }(A.Ge); + A.zC = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 21; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C, D, L, B, q) { + return b instanceof A.ba ? (q = new A.$c(b), this.W(q, m, _, [C], D, L, !1, B).next()) : B === !0 ? (_ = new A.BC(b, m, _, C, D, !1, !1, q), A.Ih.local().W(_, m, q)) : new A.BC(b, m, _, C, D, !1, !1, q); + }, T.instance = null, T; + }(A.Ge); + A.AC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C, D, L, B) { + if (D) + throw A.i.Fe(); + if (b == null) + throw A.i.O(); + this.za = -1, this.Os = T, this.wg = b, this.Ae = m, this.Es = _, this.bo = C, this.ho = -1, this.Vb = B, this.oT = new A.l(), this.oT.Pa(); + } + return H.prototype.next = function() { + for (var T; (T = this.Os.next()) != null; ) + return this.za = this.Os.Ma(), this.ho + 1 < this.Es.length && this.ho++, this.VQ(T, this.Es[this.ho]); + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.VQ = function(T, b) { + return A.QK.buffer(T, this.wg, this.Ae, b, this.bo, this.Vb); + }, H.prototype.re = function() { + }, H; + }(); + A.BC = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 24; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _) { + if (m == null) + throw A.i.O(); + if (b.B() || 1 > b.Eb()) + return 0; + if (_ == 4) + throw A.i.Fe(); + var C = A.cb.tc(m), D = A.cb.xv(C), L = A.cb.gv(C); + D *= 2 - D; + var B = C.Id().ci, q = b.K(); + if (q == 1736 || q == 197) + var Z = b.ng(); + else + A.ba.zd(q) ? (Z = new A.Ua(b.description)).pc(b, !0) : Z = b; + if (C.Nb(m) == 0) { + if (A.cb.Xc(m)) { + Z = A.Jh.nj(Z, m), q == 1607 && Z == b && (Z = A.ba.kg(b)), b = new A.Oc(), A.cb.ih(m).en(b), q = 0; + for (var ie = Z.I(); q < ie; q++) { + var se = Z.Oa(q); + se.x = A.Jh.an(se.x, b), Z.Db(q, se); + } + } + b = Z.Ja(), Z = A.Jh.RI(m, C, Z, b) ? b : A.cb.Bh(Z, m, C); + } + return this.cQ(Z, _, L, D, B); + }, T.prototype.cQ = function(b, m, _, C, D) { + var L = new A.ha(0), B = 0; + for (b = b.Ha(); b.ab(); ) + for (; b.Ia(); ) { + var q = b.ia(), Z = q.bc(); + q = q.xc(), Z.scale(D), q.scale(D), A.kb.xd(_, C, Z.x, Z.y, q.x, q.y, L, null, null, m), B += L.u; + } + return B; + }, T.instance = null, T; + }(A.Ge); + A.qL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 18; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C, D) { + return b instanceof A.ba ? (b = new A.$c(b), this.W(b, m, _, C, D).next()) : new A.oL(b, _, C, m, -1, -1, D); + }, T.instance = null, T; + }(A.Ge); + A.nL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C, D) { + if (0 < D || m != 4 && 0 < C) + throw A.i.Fe(); + if (b == null) + throw A.i.O(); + this.za = -1, this.Os = T, this.wg = b, this.Ae = m, this.yT = _, this.xT = C; + } + return H.prototype.next = function() { + for (var T; (T = this.Os.next()) != null; ) + return this.za = this.Os.Ma(), this.Uy(T); + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.Uy = function(T) { + return A.ej.Sr(T, this.wg, this.Ae, this.yT, this.xT, this.Vb); + }, H.prototype.re = function() { + }, H; + }(); + A.oL = ve; + }(le || (le = {})), function(A) { + (function(ve) { + ve[ve.Unknown = 0] = "Unknown", ve[ve.Contains = 1] = "Contains", ve[ve.Within = 2] = "Within", ve[ve.Equals = 3] = "Equals", ve[ve.Disjoint = 4] = "Disjoint", ve[ve.Touches = 8] = "Touches", ve[ve.Crosses = 16] = "Crosses", ve[ve.Overlaps = 32] = "Overlaps", ve[ve.NoThisRelation = 64] = "NoThisRelation", ve[ve.Intersects = 1073741824] = "Intersects", ve[ve.IntersectsOrDisjoint = 1073741828] = "IntersectsOrDisjoint"; + })(A.YK || (A.YK = {})), A.rL = function() { + function ve() { + } + return ve.iW = function(H, T) { + var b = H.K(), m = T.K(); + if (A.ba.zj(b)) { + var _ = H.Cb; + if (_ != null && (_ = _.Hk) != null) { + if (m == 33) { + var C = T.D(); + _ = _.Uo(C.x, C.y); + } else + C = new A.l(), T.A(C), _ = _.To(C); + if (_ == 1) + return 1; + if (_ == 0) + return 4; + } + } + if (A.ba.zj(m) && (_ = T.Cb) != null && (_ = _.Hk) != null) { + if (b == 33 ? (H = H.D(), _ = _.Uo(H.x, H.y)) : (T = new A.l(), H.A(T), _ = _.To(T)), _ == 1) + return 2; + if (_ == 0) + return 4; + } + return 0; + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.K = function() { + return 15; + }, T.prototype.W = function(b, m, _, C, D) { + return b instanceof A.ba ? (b = new A.$c(b), m = new A.$c(m), this.W(b, m, _, C, D === void 0 ? -1 : D).next()) : D === void 0 ? new A.CC(b, m, _, C, -1) : new A.CC(b, m, _, C, D); + }, T.prototype.yn = function(b, m, _) { + this.Ku(b) && (m = A.ua.mj(m, b, !1), b.hj(_) || b.nu(m, _)); + }, T.prototype.Ku = function(b) { + return A.Mx.uE(b); + }, T.instance = null, T; + }(A.Ge); + A.Zj = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C) { + if (this.vs = b == null, this.za = -1, this.Sd = T, this.wg = m, this.Pe = b.next(), this.Fj = this.Pe.K(), this.Vb = _, this.Hi = C, this.Hi != -1 && (0 >= this.Hi || 7 < this.Hi)) + throw A.i.O("bad dimension mask"); + } + return H.prototype.next = function() { + if (this.vs) + return null; + if (this.Bw != null) { + var T = this.Bw.next(); + if (T != null) + return T; + this.Bw = null; + } + for (; (T = this.Sd.next()) != null; ) + return this.za = this.Sd.Ma(), this.Hi == -1 ? T = this.Fa(T) : (this.Bw = this.KS(T), T = this.Bw.next()), T; + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.Fa = function(T) { + var b = this.uK(T); + if (b != null) + return b; + b = A.ua.ov(this.Pe, T); + var m = A.ua.Xd(this.wg, b, !0); + b = new A.l(), this.Pe.A(b); + var _ = new A.l(); + return T.A(_), b.X(2 * m, 2 * m), b.Fa(_), b.X(100 * m, 100 * m), m = A.Vd.clip(this.Pe, b, 0, 0), T = A.Vd.clip(T, b, 0, 0), A.Hg.Cv(T, m, this.wg, this.Vb); + }, H.prototype.KI = function(T, b, m) { + var _ = 0; + if (1 & b) + m[0] == null && (m[0] = new A.ee(T)), _++; + else + for (var C = 0; C < m.length - 1; C++) + m[C] = m[C + 1]; + if (2 & b) + m[_] == null && (m[_] = new A.Ua(T)), _++; + else + for (C = _; C < m.length - 1; C++) + m[C] = m[C + 1]; + if (4 & b) + m[_] == null && (m[_] = new A.Ea(T)), _++; + else + for (C = _; C < m.length - 1; C++) + m[C] = m[C + 1]; + if (_ != 3) { + for (T = [], C = 0; C < _; C++) + T[C] = m[C]; + return new A.$c(T); + } + return new A.$c(m); + }, H.prototype.KS = function(T) { + var b = this.uK(T); + if (b != null) { + var m = [null, null, null]; + return m[b.Eb()] = b, this.KI(T.description, this.Hi, m); + } + b = A.ua.ov(this.Pe, T), m = A.ua.Xd(this.wg, b, !0), b = new A.l(), this.Pe.A(b), b.X(2 * m, 2 * m); + var _ = new A.l(); + return T.A(_), b.Fa(_), b.X(100 * m, 100 * m), m = A.Vd.clip(this.Pe, b, 0, 0), b = A.Vd.clip(T, b, 0, 0), m = A.Hg.Kz(b, m, this.wg, this.Vb), this.KI(T.description, this.Hi, m); + }, H.prototype.uK = function(T) { + var b = A.ua.ov(T, this.Pe), m = A.ua.Xd(this.wg, b, !0); + b = T.K(); + var _ = T.B(), C = this.Pe.B(); + if (!(C = _ || C)) { + C = new A.l(), T.A(C); + var D = new A.l(); + this.Pe.A(D), D.X(2 * m, 2 * m), C = !C.isIntersecting(D); + } + if (!C) + if ((D = A.rL.iW(this.Pe, T)) == 4) + C = !0; + else { + if (2 & D) + return this.Pe; + if (1 & D) + return T; + } + if (C) + return (m = A.ba.uf(b)) < (C = A.ba.uf(this.Fj)) ? H.CB(T, _) : m > C || m == 0 && b == 550 && this.Fj == 33 ? this.iJ() : H.CB(T, _); + if ((this.Hi == -1 || this.Hi == 4) && b == 197 && this.Fj == 197) + return m = this.Pe, b = new A.l(), T.A(b), _ = new A.l(), m.A(_), b.Fa(_), m = new A.Hh(), T.copyTo(m), m.Zo(b), m; + if (b == 197 && A.ba.uf(this.Fj) == 0 || this.Fj == 197 && A.ba.uf(b) == 0) + return _ = b == 197 ? T : this.Pe, T = b == 197 ? this.Pe : T, b = new A.l(), _.A(b), A.Vd.clip(T, b, m, 0); + if (A.ba.uf(b) == 0 && 0 < A.ba.uf(this.Fj) || 0 < A.ba.uf(b) && A.ba.uf(this.Fj) == 0) { + if (m = A.ua.mj(this.wg, T, !1), b == 550 || b == 33) + return A.Hg.uG(T, this.Pe, m); + if (this.Fj == 550 || this.Fj == 33) + return A.Hg.uG(this.Pe, T, m); + throw A.i.Ra(); + } + return this.Hi != -1 && this.Hi != 2 || b != 1607 || this.Fj != 1736 ? this.Hi != -1 && this.Hi != 2 || b != 1736 || this.Fj != 1607 ? null : this.rK(this.Pe, T) : this.rK(T, this.Pe); + }, H.prototype.rK = function(T, b) { + var m = T, _ = b, C = A.ua.mj(this.wg, b, !1), D = new A.l(); + _.A(D); + var L = new A.l(); + m.A(L), L.X(2 * C, 2 * C), D.Fa(L), D.X(10 * C, 10 * C), m = T = A.Vd.clip(T, D, 0, 0), L = new A.ja(0); + var B = -1, q = _.Cb; + if (q != null) { + var Z = q.Hk; + if (Z != null) { + B = 0, L.Jb(m.I() + m.ea()); + for (var ie = new A.l(), se = m.Ha(); se.ab(); ) + for (; se.Ia(); ) { + se.ia().A(ie); + var de = Z.To(ie); + de == 1 ? L.add(1) : de == 0 ? L.add(0) : (L.add(-1), B++); + } + } + } + if (5 < b.I() && (q = (_ = b = A.Vd.clip(b, D, 0, 0)).Cb), 0 > B && (B = m.sz()), D = m.I() + _.I(), B * _.I() > Math.log(D) * D * 4) + return null; + D = null, B = _.Ha(), q != null && q.Gb != null && (D = q.Gb), D == null && 20 < _.I() && (D = A.ua.iE(_)), T = T.Ja(), _ = null, q = m.Ha(), Z = [0, 0, 0, 0, 0, 0, 0, 0, 0], ie = new A.ce(0), se = new A.jg(), de = -1; + for (var Ce = 0, Ve = 0, Je = 0 < L.size, Pt = -1; q.ab(); ) { + Pt = q.gb; + var $t = 0; + for (de = -1, Ce = 0; q.Ia(); ) { + var qe = Je ? A.P.truncate(L.get(Ve)) : -1; + Ve++; + var Rt = q.ia(); + if (0 > qe) { + if (D != null) + for (_ == null ? _ = D.qR(Rt, C) : _.Wo(Rt, C), qe = _.next(); qe != -1; qe = _.next()) { + B.Wb(D.ka(qe)), qe = B.ia(); + var Zt = Rt.Fa(qe, null, Z, null, C); + for (qe = 0; qe < Zt; qe++) + ie.add(Z[qe]); + } + else + for (B.aj(); B.ab(); ) + for (; B.Ia(); ) + for (qe = B.ia(), Zt = Rt.Fa(qe, null, Z, null, C), qe = 0; qe < Zt; qe++) + ie.add(Z[qe]); + if (0 < ie.size) { + ie.Wd(0, ie.size, function(Mi, Ri) { + return Mi - Ri; + }); + var Jt = 0; + ie.add(1), Zt = -1, qe = 0; + for (var Xt = ie.size; qe < Xt; qe++) { + var Qt = ie.get(qe); + if (Qt != Jt) { + var bi = !1; + if (Jt != 0 || Qt != 1 ? (Rt.dh(Jt, Qt, se), Jt = se.get()) : (Jt = Rt, bi = !0), 2 <= $t) { + if (T.Fr(m, Pt, de, Ce, $t == 3), this.LD(b, Jt.bc(), C) != 1 && this.MD(b, Jt, C) != 1) + return null; + T.pc(Jt, !1), $t = 1, Ce = 0; + } else + switch (Zt = this.MD(b, Jt, C), Zt) { + case 1: + bi ? 2 > $t ? (de = q.xb() - m.Ca(Pt), Ce = 1, $t = $t == 0 ? 3 : 2) : Ce++ : (T.pc(Jt, $t == 0), $t = 1); + break; + case 0: + $t = 0, de = -1, Ce = 0; + break; + default: + return null; + } + Jt = Qt; + } + } + } else { + if (0 > (qe = this.LD(b, Rt.bc(), C))) + return null; + qe == 1 ? (2 > $t && (de = q.xb() - m.Ca(Pt), $t = $t == 0 ? 3 : 2), Ce++) : (de = -1, Ce = 0); + } + ie.clear(!1); + } else + qe != 0 && qe == 1 && ($t == 0 ? ($t = 3, de = q.xb() - m.Ca(Pt)) : $t == 1 ? ($t = 2, de = q.xb() - m.Ca(Pt)) : Ce++); + } + 2 <= $t && (T.Fr(m, Pt, de, Ce, $t == 3), de = -1); + } + return T; + }, H.prototype.LD = function(T, b, m) { + return A.Fg.ym(T, b, m); + }, H.prototype.MD = function(T, b, m) { + var _ = b.bc(); + b = b.xc(); + var C = A.Fg.ym(T, _, m), D = A.Fg.ym(T, b, m); + return C == 1 && D == 0 || C == 0 && D == 1 ? -1 : C == 0 || D == 0 ? 0 : C == 1 || D == 1 ? 1 : ((C = new A.h()).add(_, b), C.scale(0.5), (T = A.Fg.ym(T, C, m)) == 0 ? 0 : T == 1 ? 1 : -1); + }, H.CB = function(T, b) { + return b ? T : T.Ja(); + }, H.prototype.iJ = function() { + return this.tH == null && (this.tH = this.Pe.Ja()), this.tH; + }, H.prototype.re = function() { + }, H; + }(); + A.CC = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 28; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C, D, L, B) { + return b instanceof A.ba ? (b = new A.$c(b), this.W(b, m, _, C, D, L, B).next()) : new A.sL(b, m, _, C, D, L, B); + }, T.instance = null, T; + }(A.Ge); + A.DC = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _, C, D, L) { + this.za = -1, this.Sd = T, this.Oj = b, this.La = m, this.Mi = _, this.xA = C, this.pH = D, this.od = L; + } + return H.prototype.next = function() { + var T = this.Sd.next(); + return T != null ? (this.za = this.Sd.Ma(), this.eL(T)) : null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.eL = function(T) { + var b = 0 >= this.pH ? A.ua.mj(this.Oj, T, !1) : this.pH; + return A.DK.W(T, this.La, this.Mi, this.xA, b, this.od); + }, H.prototype.re = function() { + }, H; + }(); + A.sL = ve; + }(le || (le = {})), function(A) { + var ve; + (ve = A.IK || (A.IK = {}))[ve.clipToDomainOnly = 1] = "clipToDomainOnly", ve[ve.clipWithHorizon = 2] = "clipWithHorizon", ve[ve.foldAndClipWithHorizon = 3] = "foldAndClipWithHorizon"; + var H = function(T) { + function b() { + return T !== null && T.apply(this, arguments) || this; + } + return Ne(b, T), b.prototype.K = function() { + return 0; + }, b.local = function() { + return b.instance === null && (b.instance = new b()), b.instance; + }, b.prototype.W = function(m, _, C) { + return m instanceof A.ba ? (m = new A.$c(m), this.W(m, _, C).next()) : new A.tL(m, _, C); + }, b.prototype.transform = function(m, _, C, D) { + return A.du.transform(m, _, C, D, !0); + }, b.prototype.St = function(m, _, C, D) { + return A.du.St(m, _, C, D); + }, b.instance = null, b; + }(A.Ge); + A.Gx = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m) { + this.za = -1, this.Sd = T, this.HT = b, this.od = m; + } + return H.prototype.next = function() { + var T = this.Sd.next(); + return T != null ? (this.za = this.Sd.Ma(), A.du.Bh(T, this.HT, this.od)) : null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.re = function() { + }, H; + }(); + A.tL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function T() { + } + return T.prototype.reset = function() { + this.rh = this.zk = -1, this.ws = this.mq = !1; + }, T.prototype.vQ = function(b, m, _) { + for (b.Wb(m, _); b.Ia(); ) { + var C = b.ia(); + if ((C = C.Rb()) != 0) + return b.xb(); + } + for (b.Wb(m, _); b.zz(); ) + if ((C = (C = b.ni()).Rb()) != 0) + return b.xb(); + return -1; + }, T.prototype.wQ = function(b, m) { + for (b.Wb(m, -1); b.zz(); ) + if (b.ni().Rb() != 0) + return b.xb(); + return -1; + }, T.prototype.uQ = function(b, m) { + for (b.Wb(m, -1), b.ia(); b.Ia(); ) + if (b.ia().Rb() != 0) + return b.xb(); + return -1; + }, T.prototype.tQ = function(b, m, _, C) { + if (this.zk = this.vQ(m, _, C), this.zk != -1) { + m.Wb(this.zk, -1); + var D = m.ia(), L = D.ic(D.ge(b, !1)); + if (_ = A.h.zc(L, b), (C = new A.h()).N(L), C.sub(D.bc()), (L = new A.h()).N(b), L.sub(D.bc()), this.mq = 0 > C.yi(L), this.rh = this.uQ(m, this.zk), this.rh != -1) { + m.Wb(this.rh, -1); + var B = (D = m.ia()).ge(b, !1); + B = D.ic(B); + var q = A.h.zc(B, b); + q > _ ? this.rh = -1 : (C.N(B), C.sub(D.bc()), L.N(b), L.sub(D.bc()), this.ws = 0 > C.yi(L)); + } + this.rh == -1 && (this.rh = this.wQ(m, this.zk), this.rh != -1 && (m.Wb(this.rh, -1), B = (D = m.ia()).ge(b, !1), B = D.ic(B), (q = A.h.zc(B, b)) > _ ? this.rh = -1 : (C.N(B), C.sub(D.bc()), L.N(b), L.sub(D.bc()), this.ws = 0 > C.yi(L), b = this.zk, this.zk = this.rh, this.rh = b, b = this.mq, this.mq = this.ws, this.ws = b))); + } + }, T.prototype.YN = function(b, m, _, C, D) { + return _ = _.Ha(), this.tQ(b, _, C, D), this.zk != -1 && this.rh == -1 ? this.mq : this.zk != -1 && this.rh != -1 ? this.mq == this.ws ? this.mq : (_.Wb(this.zk, -1), b = _.ia().lg(), _.Wb(this.rh, -1), m = _.ia().lg(), 0 <= b.yi(m)) : m; + }, T; + }(), H = function(T) { + function b() { + return T !== null && T.apply(this, arguments) || this; + } + return Ne(b, T), b.local = function() { + return b.instance === null && (b.instance = new b()), b.instance; + }, b.prototype.K = function() { + return 3; + }, b.prototype.iz = function(m, _, C) { + var D; + if (D === void 0 && (D = !1), m.B()) + return new A.bm(); + _ = _.D(); + var L = m, B = m.K(); + switch (B == 197 && ((L = new A.Ea()).bd(m, !1), B = 1736), B) { + case 33: + return this.sI(L, _); + case 550: + return this.eI(L, _); + case 1607: + case 1736: + return this.XT(L, _, C, D); + default: + throw A.i.ga("not implemented"); + } + }, b.prototype.jz = function(m, _) { + if (m.B()) + return new A.bm(); + _ = _.D(); + var C = m, D = m.K(); + switch (D == 197 && ((C = new A.Ea()).bd(m, !1), D = 1736), D) { + case 33: + return this.sI(C, _); + case 550: + case 1607: + case 1736: + return this.eI(C, _); + default: + throw A.i.ga("not implemented"); + } + }, b.prototype.kz = function(m, _, C, D) { + if (0 > D) + throw A.i.O(); + if (m.B()) + return []; + _ = _.D(); + var L = m, B = m.K(); + switch (B == 197 && ((L = new A.Ea()).bd(m, !1), B = 1736), B) { + case 33: + return this.OU(L, _, C, D); + case 550: + case 1607: + case 1736: + return this.oU(L, _, C, D); + default: + throw A.i.ga("not implemented"); + } + }, b.prototype.XT = function(m, _, C, D) { + if (m.K() == 1736 && C && (C = new A.l(), m.A(C), C = A.ua.Xd(null, C, !1), (D ? A.jd.Zd(m, _, 0) : A.jd.Zd(m, _, C)) != 0)) { + var L = new A.bm(_, 0, 0); + return D && L.RJ(!0), L; + } + var B = m.Ha(); + L = new A.h(); + for (var q = C = -1, Z = 17976931348623157e292, ie = 0; B.ab(); ) + for (; B.Ia(); ) { + var se = B.ia(); + se = se.ic(se.ge(_, !1)); + var de = A.h.zc(se, _); + de < Z ? (ie = 1, L = se, C = B.xb(), q = B.gb, Z = de) : de == Z && ie++; + } + return L = new A.bm(L, C, Math.sqrt(Z)), D && (B.Wb(C, q), se = B.ia(), D = 0 > A.h.Wq(_, se.bc(), se.xc()), 1 < ie && ((ie = new ve()).reset(), D = ie.YN(_, D, m, C, q)), L.RJ(D)), L; + }, b.prototype.sI = function(m, _) { + return m = m.D(), _ = A.h.ub(m, _), new A.bm(m, 0, _); + }, b.prototype.eI = function(m, _) { + for (var C = m.vb(0), D = m.I(), L = m = 0, B = 0, q = 17976931348623157e292, Z = 0; Z < D; Z++) { + var ie = new A.h(); + C.uc(2 * Z, ie); + var se = A.h.zc(ie, _); + se < q && (L = ie.x, B = ie.y, m = Z, q = se); + } + return (_ = new A.bm()).by(L, B, m, Math.sqrt(q)), _; + }, b.prototype.OU = function(m, _, C, D) { + return D == 0 ? [] : (C *= C, m = m.D(), (_ = A.h.zc(m, _)) <= C ? (C = [], (D = new A.bm()).by(m.x, m.y, 0, Math.sqrt(_)), C[0] = D) : C = [], C); + }, b.prototype.oU = function(m, _, C, D) { + if (D == 0) + return []; + var L = m.vb(0), B = m.I(); + m = [], C *= C; + for (var q = 0; q < B; q++) { + var Z = L.read(2 * q), ie = L.read(2 * q + 1), se = _.x - Z, de = _.y - ie; + (se = se * se + de * de) <= C && ((de = new A.bm()).by(Z, ie, q, Math.sqrt(se)), m.push(de)); + } + return _ = m.length, m.sort(function(Ce, Ve) { + return Ce.La < Ve.La ? -1 : Ce.La == Ve.La ? 0 : 1; + }), D >= _ || (m.length = D), m.slice(0); + }, b.instance = null, b; + }(A.Ge); + A.Hx = H; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 4; + }, T.prototype.W = function(b, m, _, C, D) { + return A.cm.tB(b, m, _, C, D); + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.Ku = function(b) { + return A.Xt.ry(b); + }, T.prototype.yn = function(b, m, _) { + A.Xt.xD(b, m, _); + }, T.instance = null, T; + }(A.Ge); + A.uL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 33; + }, T.prototype.W = function(b, m, _, C, D) { + return b === 1073741824 ? !A.vd.uB(m, _, C, 4, D) : A.vd.uB(m, _, C, b, D); + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.Ku = function(b) { + return A.Xt.ry(b); + }, T.prototype.yn = function(b, m, _) { + A.Xt.xD(b, m, _); + }, T.instance = null, T; + }(A.Ge); + A.fj = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _) { + if (this.od = _, this.lT = m, this.za = -1, T == null) + throw A.i.O(); + this.Ak = T, this.Oj = b; + } + return H.prototype.next = function() { + var T; + if ((T = this.Ak.next()) != null) { + if (this.za = this.Ak.Ma(), this.od != null && !this.od.progress(-1, -1)) + throw A.i.hu("user_canceled"); + return this.$B(T); + } + return null; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.$B = function(T) { + if (T == null) + throw A.i.O(); + return A.Ix.YJ(T, this.Oj, this.lT, this.od); + }, H.prototype.re = function() { + }, H; + }(); + A.vL = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 26; + }, T.prototype.W = function(b, m, _, C) { + return b instanceof A.ba ? (b = new A.$c(b), this.W(b, m, _, C).next()) : new A.vL(b, m, _, C); + }, T.prototype.ts = function(b, m, _, C, D) { + return 0 < (C !== void 0 ? A.Ix.ts(b, m, _, C, D) : A.Ix.ts(b, m, !1, null, _)); + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.instance = null, T; + }(A.Ge); + A.$l = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function D() { + this.Aq = 0; + } + return D.prototype.iX = function(L) { + this.Aq &= -2, this.Aq |= L ? 1 : 0; + }, D.prototype.Yp = function() { + return (1 & this.Aq) != 0; + }, D.prototype.SF = function() { + return this.Yp() ? 0 : 1; + }, D; + }(); + A.tY = ve; + var H = function() { + }, T = function(D, L, B, q) { + this.x = D, this.y = L, this.Ci = B, this.zm = q; + }, b = function() { + function D(L) { + this.Ce = L; + } + return D.prototype.compare = function(L, B, q) { + return L = L.ka(q), B = this.Ce.lf.read(2 * B), 0 > (B -= L = this.Ce.lf.read(2 * L)) ? -1 : 0 < B ? 1 : 0; + }, D; + }(), m = function() { + function D(L) { + this.Ce = L; + } + return D.prototype.compare = function(L, B, q) { + B = this.Ce.hb[B], L = this.Ce.hb[L.ka(q)]; + var Z = B.Yp(), ie = L.Yp(); + q = B.oe.Me(this.Ce.Oo, 0); + var se = L.oe.Me(this.Ce.Oo, 0); + return q == se && ((Z = 0.5 * ((q = Math.min(Z ? B.oe.oa : B.oe.ma, ie ? L.oe.oa : L.oe.ma)) - this.Ce.Oo) + this.Ce.Oo) == this.Ce.Oo && (Z = q), q = B.oe.Me(Z, 0), se = L.oe.Me(Z, 0)), q < se ? -1 : q > se ? 1 : 0; + }, D; + }(), _ = function() { + function D(L, B) { + this.TI = new A.h(), this.parent = L, this.ZR = B; + } + return D.prototype.qr = function(L, B, q) { + var Z = this.parent, ie = this.ZR; + q.Wd(L, B, function(se, de) { + return Z.Oh(se, de, ie); + }); + }, D.prototype.bq = function(L) { + return L = this.parent.ii.get(L), this.parent.lf.uc(2 * (L >> 1), this.TI), this.TI.y + (1 & L ? this.parent.Qj : -this.parent.Qj); + }, D; + }(), C = function() { + function D(L, B, q, Z, ie) { + this.iH = L.description, this.Y = L, this.Sg = B, this.Qj = A.ua.mj(this.Sg, L, !1), this.Do = A.ua.mj(this.Sg, L, !0), this.sA = q, this.jT = this.iH.Ba, this.hb = [], this.ro = [], this.oh = new A.lp(), this.fb = new A.$j(), this.le = new A.Nd(), this.UG = this.sl = ie; + } + return D.prototype.$S = function() { + return this.UG = !0, (!A.ba.Ic(this.Y.K()) || this.BE() && this.yE(!1)) && this.hO() ? A.ba.Ic(this.Y.K()) ? this.kO() ? this.Y.K() == 1607 ? this.mO() ? 2 : 0 : this.nO() ? this.oO() : 0 : 0 : 2 : 0; + }, D.prototype.fC = function(L, B) { + var q = this.lf.read(2 * L); + L = this.lf.read(2 * L + 1); + var Z = this.lf.read(2 * B); + B = this.lf.read(2 * B + 1); + var ie = !A.$t.Ev(q, L, Z, B, this.Qj * this.Qj); + return ie || this.Y.Eb() != 0 && q == Z && L == B; + }, D.prototype.BE = function() { + for (var L = this.Y, B = L.yf ? 3 : 2, q = 0, Z = L.ea(); q < Z; q++) + if (L.Ka(q) < B) + return this.le = new A.Nd(1, q, 0), !1; + return !0; + }, D.prototype.yE = function(L) { + var B = this.Y, q = B.Ha(), Z = B.hasAttribute(1); + for (B = Z ? A.ua.rE(this.Sg, B, !1) : 0; q.ab(); ) + for (; q.Ia(); ) { + var ie = q.ia(); + if (!(ie.Rb() > this.Qj)) { + if (L && Z) { + var se = ie.yv(1, 0); + if (ie = ie.yv(1, 0), Math.abs(ie - se) > B) + continue; + } + return this.le = new A.Nd(2, q.xb(), -1), !1; + } + } + return !0; + }, D.prototype.hO = function() { + var L = this.Y, B = null; + A.ba.Ic(this.Y.K()) && (B = this.Y); + var q = (this.UG || this.sl) && B != null, Z = L.I(); + this.lf = L.vb(0), this.ii = new A.ja(0), this.ii.Jb(2 * Z), this.hi = new A.ja(0), this.hi.Jb(2 * Z), q && (this.Hl == null && (this.Hl = new A.ja(0)), this.Hl.Jb(Z)); + for (var ie = L = 0; ie < Z; ie++) + if (this.ii.add(2 * ie), this.ii.add(2 * ie + 1), this.hi.add(2 * ie), this.hi.add(2 * ie + 1), q) { + for (; ie >= B.Wc(L); ) + L++; + this.Hl.add(L); + } + for (new A.Zt().sort(this.hi, 0, 2 * Z, new _(this, q)), this.fb.clear(), this.fb.Xo(new b(this)), this.fb.Ee(Z), B = 0, Z *= 2; B < Z; B++) + if (q = this.hi.get(B), q = (L = this.ii.get(q)) >> 1, (1 & L) == 0) { + if (L = this.fb.addElement(q, -1), (ie = this.fb.xe(L)) != -1 && !this.fC(this.fb.ka(ie), q)) + return this.le = new A.Nd(3, q, this.fb.ka(ie)), !1; + var se = this.fb.lb(L); + if (se != -1 && !this.fC(this.fb.ka(se), q)) + return this.le = new A.Nd(3, q, this.fb.ka(se)), !1; + } else if (L = this.fb.search(q, -1), ie = this.fb.xe(L), se = this.fb.lb(L), this.fb.wd(L, -1), ie != -1 && se != -1 && !this.fC(this.fb.ka(ie), this.fb.ka(se))) + return this.le = new A.Nd(3, this.fb.ka(ie), this.fb.ka(se)), !1; + return !0; + }, D.prototype.kO = function() { + return 10 > this.Y.I() ? this.iO() : this.jO(); + }, D.prototype.jO = function() { + var L = new A.hd(); + L.Ib(this.Y); + var B = new A.Nd(); + return !A.bu.fI(!1, L, this.Qj, B, this.od) || (B.Lo = L.Va(B.Lo), B.Mo = L.Va(B.Mo), this.le.Yt(B), !1); + }, D.prototype.iO = function() { + var L = this.Y, B = L.Ha(); + for (L = L.Ha(); B.ab(); ) + for (; B.Ia(); ) { + var q = B.ia(); + if (!B.Sn() || !B.VS()) { + L.wW(B); + do + for (; L.Ia(); ) { + var Z = L.ia(); + if ((Z = q.Br(Z, this.Qj, !0)) != 0) + return this.le = new A.Nd(Z == 2 ? 5 : 4, B.xb(), L.xb()), !1; + } + while (L.ab()); + } + } + return !0; + }, D.prototype.nO = function() { + var L = this.Y; + this.hb.length = 0, this.ro.length = 0, this.ag = L.Ha(), this.ag.EB(); + var B = new A.ja(0); + B.Jb(10); + var q = NaN, Z = 0, ie = 0; + for (L = 2 * L.I(); ie < L; ie++) { + var se = this.hi.get(ie); + if (!(1 & (se = this.ii.get(se)))) { + se >>= 1; + var de = this.lf.read(2 * se), Ce = this.lf.read(2 * se + 1); + if (B.size != 0 && (de != q || Ce != Z)) { + if (!this.LI(B)) + return !1; + B?.clear(!1); + } + B.add(se), q = de, Z = Ce; + } + } + return !!this.LI(B); + }, D.prototype.mO = function() { + for (var L = this.Y, B = Array(L.ea()), q = 0, Z = L.ea(); q < Z; q++) + B[q] = L.Pn(q); + Z = new H(); + var ie = new A.h(); + q = this.hi.get(0); + var se = (q = this.ii.get(q)) >> 1; + this.lf.uc(2 * se, ie); + var de = B[q = this.Hl.get(se)], Ce = L.Ca(q), Ve = L.Wc(q) - 1; + Z.gl = se == Ce || se == Ve, Z.jy = this.sl ? !de && Z.gl : Z.gl, Z.Ci = q, Z.x = ie.x, Z.y = ie.y, Z.zm = se; + for (var Je = new H(), Pt = 1, $t = this.hi.size; Pt < $t; Pt++) + if (q = this.hi.get(Pt), (1 & (q = this.ii.get(q))) == 0) { + se = q >> 1, this.lf.uc(2 * se, ie), (q = this.Hl.get(se)) != Z.Ci && (de = B[q], Ce = L.Ca(q), Ve = L.Wc(q) - 1); + var qe = se == Ce || se == Ve, Rt = this.sl ? !de && Z.gl : Z.gl; + if (Je.x = ie.x, Je.y = ie.y, Je.Ci = q, Je.zm = se, Je.jy = Rt, Je.gl = qe, Je.x == Z.x && Je.y == Z.y) { + if (this.sl) { + if (!(Je.jy && Z.jy || Je.Ci == Z.Ci && (Je.gl || Z.gl))) + return this.le = new A.Nd(8, Je.zm, Z.zm), !1; + } else if (!Je.gl || !Z.gl) + return this.le = new A.Nd(5, Je.zm, Z.zm), !1; + } + q = Z, Z = Je, Je = q; + } + return !0; + }, D.prototype.EE = function() { + for (var L = this.Y, B = [], q = -1, Z = !1, ie = 0, se = L.ea(); ie < se; ie++) + L.Gv(ie) && (Z = !1, q++, ie < se - 1 && (L.Gv(ie + 1) || (Z = !0))), B[ie] = Z ? q : -1; + Z = new A.h(), ie = this.hi.get(0); + var de = (ie = this.ii.get(ie)) >> 1; + this.lf.uc(2 * de, Z), ie = this.Hl.get(de), q = new T(Z.x, Z.y, ie, de, B[ie]), L = []; + var Ce = 1; + for (se = this.hi.size; Ce < se; Ce++) + if (ie = this.hi.get(Ce), (1 & (ie = this.ii.get(ie))) == 0) { + if (de = ie >> 1, this.lf.uc(2 * de, Z), ie = this.Hl.get(de), (ie = new T(Z.x, Z.y, ie, de, B[ie])).x == q.x && ie.y == q.y) { + if (ie.Ci == q.Ci) + return this.le = new A.Nd(9, ie.zm, q.zm), !1; + 0 <= B[ie.Ci] && B[ie.Ci] == B[q.Ci] && (L.length != 0 && L[L.length - 1] == q || L.push(q), L.push(ie)); + } + q = ie; + } + if (L.length == 0) + return !0; + for (ie = new A.lp(!0), A.P.bv(B, -1), Z = -1, (Ce = new A.h()).Sc(), q = 0, se = L.length; q < se; q++) { + (de = L[q]).x == Ce.x && de.y == Ce.y || (Z = ie.Rh(0), Ce.x = de.x, Ce.y = de.y); + var Ve = B[de.Ci]; + Ve == -1 && (Ve = ie.Rh(2), B[de.Ci] = Ve), ie.addElement(Ve, Z), ie.addElement(Z, Ve); + } + for ((se = new A.ja(0)).Jb(10), q = ie.ke; q != -1; q = ie.lz(q)) + if (!(1 & (L = ie.KF(q))) && 2 & L) { + for (L = -1, se.add(q), se.add(-1); 0 < se.size; ) { + if (Z = se.Gc(), se.Jf(), Ce = se.Gc(), se.Jf(), (1 & (de = ie.KF(Ce))) != 0) { + L = 2 & de ? Ce : Z; + break; + } + for (ie.aX(Ce, 1 | de), de = ie.sc(Ce); de != -1; de = ie.lb(de)) + (Ve = ie.getData(de)) != Z && (se.add(Ve), se.add(Ce)); + } + if (L != -1) { + for (ie = -1, q = 0, se = B.length; q < se; q++) + if (B[q] == L) { + ie = q; + break; + } + return this.le = new A.Nd(10, ie, -1), !1; + } + } + return !0; + }, D.prototype.oO = function() { + var L = this.Y; + if (0 >= L.He()) + return this.le = new A.Nd(6, L.ea() == 1 ? 1 : -1, -1), 0; + if (L.ea() == 1) + return this.sl && !this.EE() ? 0 : 2; + this.vo = A.ja.rf(L.ea(), 0), this.EA = A.ja.rf(L.ea(), -1); + for (var B = -1, q = 0, Z = 0, ie = L.ea(); Z < ie; Z++) { + var se = L.Kr(Z); + if (this.vo.write(Z, 0 > se ? 0 : 256), 0 < se) + B = Z, q = se; + else { + if (se == 0) + return this.le = new A.Nd(6, Z, -1), 0; + if ((0 > B || q < Math.abs(se)) && (this.le = new A.Nd(7, Z, -1), this.sl)) + return 0; + this.EA.write(Z, B); + } + } + for (this.et = L.ea(), this.Qm = new A.ja(0), this.Qm.Jb(10), ie = L.I(), this.Oo = NaN, (L = new A.ja(0)).Jb(10), this.Sq = A.ja.rf(ie, -1), this.Jw = A.ja.rf(ie, -1), this.Bj != null ? this.Bj.clear(!1) : this.Bj = new A.ja(0), this.Bj.Jb(10), this.fb.clear(), this.fb.Xo(new m(this)), B = 0, ie *= 2; 0 < this.et && B < ie; B++) + if (q = this.hi.get(B), (1 & (q = this.ii.get(q))) == 0) { + if (q >>= 1, (Z = this.lf.read(2 * q + 1)) != this.Oo && L.size != 0) { + if (!this.vt(L)) + return 0; + L?.clear(!1); + } + L.add(q), this.Oo = Z; + } + return 0 < this.et && !this.vt(L) ? 0 : this.sl ? this.le.Lj == 0 && this.EE() ? 2 : 0 : this.le.Lj == 0 ? 2 : 1; + }, D.prototype.LI = function(L) { + if (L.size == 1) + return !0; + for (var B = 0, q = L.size; B < q; B++) { + var Z = L.get(B); + this.ag.Wb(Z); + var ie = this.ag.ni(); + this.hb.push(this.Uu(ie, Z, this.ag.gb, !0)), this.ag.ia(), ie = this.ag.ia(), this.hb.push(this.Uu(ie, Z, this.ag.gb, !1)); + } + var se = this; + for (this.hb.sort(function(Ve, Je) { + return se.SP(Ve, Je); + }), (Z = this.oh.ke) == -1 && (Z = this.oh.Rh(0)), this.oh.hn(this.hb.length), B = 0, q = this.hb.length; B < q; B++) + this.oh.addElement(Z, B); + B = !0; + for (var de = q = -1; B && (B = !1, (ie = this.oh.sc(Z)) != -1); ) + for (var Ce = this.oh.lb(ie); Ce != -1; ) + if (q = this.oh.getData(ie), de = this.oh.getData(Ce), (q = this.hb[q].Ko) != (de = this.hb[de].Ko)) + ie = Ce, Ce = this.oh.lb(ie); + else if (B = !0, this.oh.kd(Z, ie), ie = this.oh.xe(Ce), (Ce = this.oh.kd(Z, Ce)) == -1 || ie == -1) + break; + if (B = this.oh.ds(Z), this.oh.GE(Z), 0 < B) + return this.le = new A.Nd(5, q, de), !1; + for (B = 0, q = L.size; B < q; B++) + this.qB(this.hb[B]); + return this.hb.length = 0, !0; + }, D.prototype.vt = function(L) { + for (var B = 0, q = L.size; B < q; B++) { + var Z = L.get(B), ie = this.Sq.read(Z); + if (ie != -1) { + var se = this.fb.ka(ie); + this.Bj.add(se), this.fb.wd(ie, -1), this.qB(this.hb[se]), this.hb[se] = null, this.Sq.write(Z, -1); + } + (ie = this.Jw.read(Z)) != -1 && (se = this.fb.ka(ie), this.Bj.add(se), this.fb.wd(ie, -1), this.qB(this.hb[se]), this.hb[se] = null, this.Jw.write(Z, -1)); + } + for (B = 0, q = L.size; B < q; B++) { + if (Z = L.get(B), this.ag.Wb(Z), (ie = this.ag.ni()).oa > ie.ma) { + var de = this.ag.xb(), Ce = this.Uu(ie, Z, this.ag.gb, !0); + 0 < this.Bj.size ? (se = this.Bj.Gc(), this.Bj.Jf(), this.hb[se] = Ce) : (se = this.hb.length, this.hb.push(Ce)), ie = this.fb.addElement(se, -1), this.Sq.read(de) == -1 ? this.Sq.write(de, ie) : this.Jw.write(de, ie), !(3 & this.vo.read(this.ag.gb)) && this.Qm.add(ie); + } + this.ag.ia(), (ie = this.ag.ia()).oa < ie.ma && (de = this.ag.kk(), Ce = this.Uu(ie, Z, this.ag.gb, !1), 0 < this.Bj.size ? (se = this.Bj.Gc(), this.Bj.Jf(), this.hb[se] = Ce) : (se = this.hb.length, this.hb.push(Ce)), ie = this.fb.addElement(se, -1), this.Sq.read(de) == -1 ? this.Sq.write(de, ie) : this.Jw.write(de, ie), !(3 & this.vo.read(this.ag.gb)) && this.Qm.add(ie)); + } + for (B = 0, q = this.Qm.size; B < q && 0 < this.et; B++) + if (ie = this.Qm.get(B), (3 & this.vo.read(this.hb[this.fb.ka(ie)].DA)) == 0) { + L = -1, Z = this.fb.xe(ie); + var Ve = ie; + Ce = null, se = -1; + for (var Je = 0; Z != -1 && (se = this.fb.ka(Z), se = (Ce = this.hb[se]).DA, (3 & (Je = this.vo.read(se))) == 0); ) + Ve = Z, Z = this.fb.xe(Z); + Z == -1 ? (de = 1, Z = Ve) : (L = (3 & Je) == 1 ? se : this.EA.read(se), de = Ce.SF() != 0 ? 0 : 1, Z = this.fb.lb(Z)); + do { + if (se = this.fb.ka(Z), se = (Ce = this.hb[se]).DA, (3 & (Ve = this.vo.read(se))) == 0) { + if (de != Ce.SF()) + return this.le = new A.Nd(6, se, -1), !1; + if (Ve = 252 & Ve | (Je = de == 0 || Ce.Yp() ? 2 : 1), this.vo.write(se, Je), Je == 2 && this.le.Lj == 0 && this.EA.read(se) != L && (this.le = new A.Nd(7, se, -1), this.sl)) + return !1; + if (this.et--, this.et == 0) + return !0; + } + (3 & Ve) == 1 && (L = se), Ve = Z, Z = this.fb.lb(Z), de = de != 0 ? 0 : 1; + } while (Ve != ie); + } + return this.Qm != null ? this.Qm.clear(!1) : this.Qm = new A.ja(0), !0; + }, D.prototype.Uu = function(L, B, q, Z) { + if (L.K() != 322) + throw A.i.Ra(); + return (L = this.nP(L)).Ko = B, L.DA = q, L.Aq = 0, L.iX(Z), L; + }, D.prototype.nP = function(L) { + if (0 < this.ro.length) { + var B = this.ro[this.ro.length - 1]; + --this.ro.length, L.copyTo(B.oe); + } else + (B = new ve()).oe = A.NC.kg(L); + return B; + }, D.prototype.qB = function(L) { + L.oe.K() == 322 && this.ro.push(L); + }, D.prototype.fU = function() { + for (var L = this.Y.I(), B = new A.ja(0), q = 0; q < L; q++) + B.add(q); + var Z = this; + for (B.Wd(0, L, function(ie, se) { + return Z.Qu(ie, se); + }), q = 1; q < L; q++) + if (this.Qu(B.get(q - 1), B.get(q)) == 0) + return this.le = new A.Nd(3, B.get(q - 1), B.get(q)), 0; + return 2; + }, D.prototype.EV = function() { + return this.BE() && this.yE(!0) ? 2 : 0; + }, D.prototype.jV = function() { + return this.$S(); + }, D.prototype.kU = function() { + for (var L = this.Y.I(), B = new A.ja(0), q = 0; q < L; q++) + B.add(q); + var Z = this; + B.Wd(0, L, function(Ve, Je) { + return Z.KO(Ve, Je); + }); + var ie = Array(L); + for (A.P.bv(ie, !1), ie[B.get(0)] = !0, q = 1; q < L; q++) { + var se = B.get(q - 1), de = B.get(q); + this.Qu(se, de) == 0 ? ie[de] = !1 : ie[de] = !0; + } + B = this.Y.Ja(), se = this.Y, de = 0; + var Ce = 1; + for (q = 0; q < L; q++) + ie[q] ? Ce = q + 1 : (de < Ce && B.Gd(se, de, Ce), de = q + 1); + return de < Ce && B.Gd(se, de, Ce), B.Eh(2, this.Do), B; + }, D.prototype.IV = function() { + var L = this.Y, B = L.Ha(), q = L.Ha(), Z = this.Y.Ja(), ie = this.Y, se = L.hasAttribute(1), de = se ? A.ua.rE(this.Sg, L, !0) : 0, Ce = new A.ja(0), Ve = new A.ja(0); + for (Ce.Jb(A.P.truncate(L.I() / 2 + 1)), Ve.Jb(A.P.truncate(L.I() / 2 + 1)); B.ab(); ) + if (q.ab(), !(2 > L.Ka(B.gb))) { + q.yW(); + for (var Je, Pt, $t = !0; B.Ia(); ) { + var qe = B.ia(), Rt = q.ni(); + if (B.xb() > q.xb()) + break; + $t && (Ce.add(B.xb()), Ve.add(q.kk()), $t = !1), Pt = Ce.Gc(); + var Zt = B.kk(); + if (1 < Zt - Pt) { + var Jt = new A.h(); + Jt.vc(L.Oa(Pt), L.Oa(Zt)), Je = Jt.length(); + } else + Je = qe.Rb(); + Pt = Ve.Gc(), 1 < (Zt = q.xb()) - Pt ? ((Jt = new A.h()).vc(L.Oa(Pt), L.Oa(Zt)), Pt = Jt.length()) : Pt = Rt.Rb(), Je > this.Do ? Ce.add(B.kk()) : se && (Je = L.Vc(1, Ce.Gc(), 0), qe = qe.jv(1, 0), Math.abs(qe - Je) > de && Ce.add(B.kk())), Pt > this.Do ? Ve.add(q.xb()) : se && (Je = L.Vc(1, Ve.Gc(), 0), qe = Rt.jv(1, 0), Math.abs(qe - Je) > de && Ve.add(q.xb())); + } + if (Ce.Gc() < Ve.Gc() ? Ce.size > Ve.size ? Ce.Jf() : Ve.Jf() : (Ce.Gc() != Ve.Gc() && Ve.Jf(), Ve.Jf()), 2 <= Ve.size + Ce.size) { + for ($t = new A.Ta(), Rt = 0, qe = Ce.size; Rt < qe; Rt++) + ie.we(Ce.get(Rt), $t), Rt == 0 ? Z.nf($t) : Z.lineTo($t); + for (Rt = Ve.size - 1; 0 < Rt; Rt--) + ie.we(Ve.get(Rt), $t), Z.lineTo($t); + ie.ec(B.gb) ? Z.Cp() : 0 < Ve.size && (ie.we(Ve.get(0), $t), Z.lineTo($t)); + } + Ce?.clear(!1), Ve?.clear(!1); + } + return Z.Eh(2, this.Do), Z; + }, D.prototype.mV = function() { + return this.zX(); + }, D.prototype.zX = function() { + return this.Y.K() == 1736 && this.Y.Kn() == 1 ? A.Hg.Ok(this.Y, this.Do, !0, !1, this.od) : (this.Ji = new A.hd(), this.Ji.Ib(this.Y), this.Ji.gd != 0 && (this.sA != 1 && A.Vk.W(this.Ji, this.Do, this.od, !0), this.Y.K() == 1736 && A.tn.W(this.Ji, this.Ji.md, this.sA, !1, this.od)), this.Y = this.Ji.Ke(this.Ji.md), this.Y.K() == 1736 && (this.Y.hm(), this.Y.$o(0)), this.Y.Eh(2, this.Do), this.Y); + }, D.ts = function(L, B, q, Z, ie) { + if (Z != null && (Z.Lj = 0, Z.Lo = -1, Z.Mo = -1), L.B()) + return 1; + var se = L.K(); + if (se == 33) + return 1; + var de = A.ua.mj(B, L, !1); + if (se == 197) + return B = new A.l(), L.A(B), B.Di(de) ? (Z != null && (Z.Lj = 2, Z.Lo = -1, Z.Mo = -1), 0) : 1; + if (A.ba.zd(se)) + return (de = new A.Ua(L.description)).pc(L, !0), D.ts(de, B, q, Z, ie); + var Ce = L.qm(de); + if ((q = q ? -1 : Ce) != -1) + return q; + if (B = new D(L, B, q, ie, !1), se == 550) + q = B.fU(); + else if (se == 1607) + q = B.EV(); + else { + if (se != 1736) + throw A.i.Ra(); + q = B.jV(); + } + return L.Eh(q, de), Z != null && q == 0 && Z.Yt(B.le), q; + }, D.YJ = function(L, B, q, Z) { + if (L.B()) + return L; + var ie = L.K(); + if (ie == 33) + return L; + var se = A.ua.mj(B, L, !1); + if (ie == 197) + return B = new A.l(), L.A(B), B.Di(se) ? L.Ja() : L; + if (A.ba.zd(ie)) + return (ie = new A.Ua(L.description)).pc(L, !0), D.YJ(ie, B, q, Z); + if (se = L.qm(se), (q = q ? -1 : se) == 2) + return L; + if (L = new D(L, B, q, Z, !1), ie == 550) + L = L.kU(); + else if (ie == 1607) + L = L.IV(); + else { + if (ie != 1736) + throw A.i.Ra(); + L = L.mV(); + } + return L; + }, D.prototype.Oh = function(L, B, q) { + if (L == B) + return 0; + L = this.ii.get(L); + var Z = this.ii.get(B); + B = L >> 1; + var ie = Z >> 1, se = new A.h(), de = new A.h(); + return this.lf.uc(2 * B, se), se.y += 1 & L ? this.Qj : -this.Qj, this.lf.uc(2 * ie, de), de.y += 1 & Z ? this.Qj : -this.Qj, (L = se.compare(de)) == 0 && q ? 0 > (q = this.Hl.get(B) - this.Hl.get(ie)) ? -1 : 0 < q ? 1 : 0 : L; + }, D.prototype.Qu = function(L, B) { + if (L == B) + return 0; + var q = this.Y, Z = q.Oa(L), ie = q.Oa(B); + if (Z.x < ie.x) + return -1; + if (Z.x > ie.x) + return 1; + if (Z.y < ie.y) + return -1; + if (Z.y > ie.y) + return 1; + for (Z = 1; Z < this.jT; Z++) { + ie = this.iH.ld(Z); + for (var se = A.sa.Wa(ie), de = 0; de < se; de++) { + var Ce = q.Vc(ie, L, de), Ve = q.Vc(ie, B, de); + if (Ce < Ve) + return -1; + if (Ce > Ve) + return 1; + } + } + return 0; + }, D.prototype.KO = function(L, B) { + var q = this.Qu(L, B); + return q == 0 ? L < B ? -1 : 1 : q; + }, D.prototype.SP = function(L, B) { + if (L === B) + return 0; + var q = L.oe.lg(); + L.Yp() && q.Uq(), L = B.oe.lg(), B.Yp() && L.Uq(), B = q.su(); + var Z = L.su(); + return Z == B ? (B = q.yi(L), Math.abs(B) <= 8881784197001252e-31 * (Math.abs(L.x * q.y) + Math.abs(L.y * q.x)) && (B--, B++), 0 > B ? 1 : 0 < B ? -1 : 0) : B < Z ? -1 : 1; + }, D; + }(); + A.Ix = C; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 30; + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.prototype.W = function(b, m, _, C) { + return b instanceof A.ba ? (b = new A.$c(b), m = new A.$c(m), this.W(b, m, _, C).next()) : new A.wL(b, m, _, C); + }, T.gp = function(b, m, _, C) { + var D = b.Eb(), L = m.Eb(); + if (b.B() && m.B()) + return D > L ? b : m; + if (b.B()) + return m; + if (m.B()) + return b; + var B = new A.l(), q = new A.l(), Z = new A.l(); + return b.A(B), m.A(q), Z.L(B), Z.$b(q), B = A.ua.Xd(_, Z, !0), q = b.K(), Z = m.K(), q == 33 && Z == 33 ? T.WU(b, m, B) : q != Z ? 0 < D || 0 < L ? D > L ? b : m : q == 550 ? T.dI(b, m, B) : T.dI(m, b, B) : A.Hg.gp(b, m, _, C); + }, T.WU = function(b, m, _) { + _ = _ * Math.sqrt(2) * 1.00001, _ *= _; + var C = b.D(), D = m.D(), L = new A.ee(b.description); + return A.h.zc(C, D) > _ && (L.add(b), L.add(m)), L; + }, T.dI = function(b, m, _) { + var C = b.vb(0), D = b.I(), L = m.D(), B = b.Ja(); + _ = _ * Math.sqrt(2) * 1.00001; + var q = new A.l(); + if (b.A(q), q.X(_, _), q.contains(L)) { + _ *= _, q = !1; + for (var Z = [], ie = 0; ie < D; ie++) + Z[ie] = !1; + for (ie = 0; ie < D; ie++) { + var se = C.read(2 * ie), de = C.read(2 * ie + 1); + (se -= L.x) * se + (de -= L.y) * de <= _ && (q = !0, Z[ie] = !0); + } + if (q) + for (ie = 0; ie < D; ie++) + Z[ie] || B.Gd(b, ie, ie + 1); + else + B.Gd(b, 0, D), B.add(m); + } else + B.Gd(b, 0, D), B.add(m); + return B; + }, T.instance = null, T; + }(A.Ge); + A.Jx = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m, _) { + this.vs = b == null, this.za = -1, this.Sd = T, this.wg = m, this.IT = b.next(), this.Vb = _; + } + return H.prototype.next = function() { + return this.vs ? null : (T = this.Sd.next()) != null ? (this.za = this.Sd.Ma(), A.Jx.gp(T, this.IT, this.wg, this.Vb)) : null; + var T; + }, H.prototype.Ma = function() { + return this.za; + }, H.prototype.re = function() { + }, H; + }(); + A.wL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function b() { + } + return b.prototype.Az = function() { + this.Vy = null, this.zx = -1, this.vK = !1; + }, b; + }(), H = function() { + function b() { + this.Ir = 0, this.rj = []; + } + return b.prototype.kN = function(m) { + this.Ir += m.zx, this.rj.push(m); + }, b.prototype.OV = function() { + this.Ir -= this.rj[this.rj.length - 1].zx, --this.rj.length; + }, b.prototype.iy = function() { + return this.rj[this.rj.length - 1]; + }, b.prototype.Nb = function(m) { + return m === this; + }, b; + }(), T = function() { + function b(m, _, C) { + this.za = -1, this.Jc = !1, this.vH = [!1, !1, !1, !1], this.wq = [0, 0, 0, 0], this.eA = !1, this.Bk = -1, this.kq = 0, this.eo = -1, this.Fo = [], this.Sd = m, this.wg = _, this.Vb = C; + } + return b.ZD = function(m) { + var _ = [], C = 0; + for (m = Object.keys(m); C < m.length; C++) + _.push(Number(m[C])); + return _.sort(function(D, L) { + return D - L; + }), _; + }, b.prototype.aG = function(m) { + var _ = this.Fo[m], C = b.ZD(_)[0], D = _[C], L = D.iy().Vy; + return D = D.iy().vK, delete _[C], D && (L = A.$l.local().W(L, this.wg, !1, this.Vb), m == 0 && L.K() == 33 && (m = new A.ee(L.description), L.B() || m.add(L), L = m)), L; + }, b.prototype.next = function() { + if (this.Jc && this.eo == this.Bk) + return null; + for (; !this.lK(); ) + ; + if (this.Bk == -1) + return null; + if (this.eA) { + for (this.eo++; ; ) { + if (this.eo > this.Bk || 0 > this.eo) + throw A.i.Ra(); + if (this.vH[this.eo]) + break; + } + return this.za++, this.aG(this.eo); + } + return this.za = 0, this.eo = this.Bk, this.aG(this.Bk); + }, b.prototype.Ma = function() { + return this.za; + }, b.prototype.lK = function() { + if (this.Jc) + return !0; + var m = null; + if (this.Sd != null && (m = this.Sd.next()) == null && (this.Jc = !0, this.Sd = null), A.op.Bp(this.Vb), m != null) { + var _ = m.Eb(); + this.vH[_] = !0, _ >= this.Bk && !this.eA && (this.HD(_, !1, m), _ > this.Bk && !this.eA && this.uW(_)); + } + if (0 < this.kq) + for (_ = 0; _ <= this.Bk; _++) + for (; 1 < this.wq[_] && (m = this.AO(_)).length != 0; ) + m = A.Hg.QP(m, this.wg, this.Vb), this.HD(_, !0, m); + return this.Jc; + }, b.prototype.AO = function(m) { + for (var _ = [], C = [], D = this.Fo[m], L = b.ZD(D), B = 0; B < L.length; B++) { + var q = L[B], Z = D[q]; + if (this.Jc || 1e4 < Z.Ir && 1 < Z.rj.length) { + for (this.wq[m] -= Z.rj.length, this.kq -= Z.rj.length; 0 < Z.rj.length; ) + _.push(Z.iy().Vy), Z.OV(); + C.push(q); + } + } + for (B = 0; B < C.length; B++) + delete D[C[B]]; + return _; + }, b.prototype.uW = function(m) { + for (var _ = 0; _ < m; _++) + this.Fo[_] = [], this.kq -= this.wq[_], this.wq[_] = 0; + }, b.prototype.HD = function(m, _, C) { + var D = new ve(); + if (D.Az(), D.Vy = C, C = b.$R(C), D.zx = C, C = b.YR(C), m + 1 > this.Fo.length) + for (var L = 0, B = Math.max(2, m + 1); L < B; L++) + this.Fo.push([]); + (L = this.Fo[m][C]) === void 0 && (L = new H(), this.Fo[m][C] = L), D.vK = _, L.kN(D), this.wq[m]++, this.kq++, this.Bk = Math.max(this.Bk, m); + }, b.YR = function(m) { + return 0 < m ? A.P.truncate(Math.log(m) / Math.log(4) + 0.5) : 0; + }, b.$R = function(m) { + var _ = m.K(); + if (A.ba.zj(_)) + return m.I(); + if (_ == 33) + return 1; + if (_ == 197) + return 4; + if (A.ba.zd(_)) + return 2; + throw A.i.Ra(); + }, b.prototype.re = function() { + this.lK(); + }, b; + }(); + A.yL = T; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + return H !== null && H.apply(this, arguments) || this; + } + return Ne(T, H), T.prototype.K = function() { + return 1; + }, T.prototype.W = function(b, m, _, C) { + return C === void 0 ? new A.yL(b, m, _) : this.bQ(b, m, _, C); + }, T.prototype.bQ = function(b, m, _, C) { + return b = new A.$c([b, m]), this.W(b, _, C).next(); + }, T.local = function() { + return T.instance === null && (T.instance = new T()), T.instance; + }, T.instance = null, T; + }(A.Ge); + A.Ih = ve; + }(le || (le = {})), function(A) { + var ve, H; + (H = ve || (ve = {}))[H.nextPath = 0] = "nextPath", H[H.nextSegment = 1] = "nextSegment", H[H.iterate = 2] = "iterate", ve = function() { + function T(b, m, _, C) { + this.Vs = new A.l(), this.BT = b, this.CT = m, this.oq = C, this.wo = -1, this.tl = !1; + var D = b.Cb; + D != null && (D = C ? D.Bo : D.Gb) != null && (this.Jc = !1, this.ra = _, this.Gb = D, this.zw = this.Gb.getIterator(), this.pq = this.tl = !0, this.Yb = 0, C ? this.wo = m.ea() : this.td = m.Ha()), this.tl || (D = m.Cb) != null && (D = C ? D.Bo : D.Gb) != null && (this.Jc = !1, this.ra = _, this.Gb = D, this.zw = this.Gb.getIterator(), this.tl = !0, this.pq = !1, this.Yb = 0, C ? this.wo = b.ea() : this.td = b.Ha()), this.tl || (this.ei = C ? A.ua.hR(b, m, _, 1 <= b.qm(0), 1 <= m.qm(0)) : A.ua.gR(b, m, _)); + } + return T.prototype.next = function() { + if (this.tl) { + if (this.Jc) + return !1; + for (var b = !0; b; ) + switch (this.Yb) { + case 0: + b = this.sU(); + break; + case 1: + b = this.tU(); + break; + case 2: + b = this.Pz(); + break; + default: + throw A.i.ga("internal error"); + } + return !this.Jc; + } + return this.ei != null && this.ei.next(); + }, T.prototype.pl = function() { + return this.tl ? this.pq ? this.Gb.ka(this.Hs) : this.oq ? this.wo : this.td.xb() : this.ei.pl(this.ei.Xf); + }, T.prototype.jl = function() { + return this.tl ? this.pq ? this.oq ? this.wo : this.td.xb() : this.Gb.ka(this.Hs) : this.ei.jl(this.ei.Bf); + }, T.prototype.oz = function() { + if (!this.oq) + throw A.i.ga("internal error"); + return this.tl ? this.pq ? this.Gb.BF(this.Hs) : this.Vs : this.ei.oz(this.ei.Xf); + }, T.prototype.Wy = function() { + if (!this.oq) + throw A.i.ga("internal error"); + return this.tl ? this.pq ? this.Vs : this.Gb.BF(this.Hs) : this.ei.Wy(this.ei.Bf); + }, T.prototype.sU = function() { + return this.oq ? --this.wo == -1 ? (this.Jc = !0, !1) : (this.pq ? this.CT.Tj(this.wo, this.Vs) : this.BT.Tj(this.wo, this.Vs), this.zw.Zi(this.Vs, this.ra), this.Yb = 2, !0) : this.td.ab() ? (this.Yb = 1, !0) : (this.Jc = !0, !1); + }, T.prototype.tU = function() { + if (!this.td.Ia()) + return this.Yb = 0, !0; + var b = this.td.ia(); + return this.zw.Wo(b, this.ra), this.Yb = 2, !0; + }, T.prototype.Pz = function() { + return this.Hs = this.zw.next(), this.Hs == -1 && (this.Yb = this.oq ? 0 : 1, !0); + }, T; + }(), A.am = ve; + }(le || (le = {})), function(A) { + (A = A.JL || (A.JL = {}))[A.enumClosed = 1] = "enumClosed", A[A.enumHasNonlinearSegments = 2] = "enumHasNonlinearSegments", A[A.enumOGCStartPolygon = 4] = "enumOGCStartPolygon", A[A.enumCalcMask = 4] = "enumCalcMask"; + }(le || (le = {})), function(A) { + A.LC = function() { + function ve() { + } + return ve.ub = function(H, T, b, m, _, C, D, L, B) { + var q = [0, 0, 0], Z = [0, 0, 0], ie = [0, 0, 0], se = [0, 0, 0, 0], de = new A.ha(0), Ce = new A.ha(0), Ve = new A.ha(0); + if (D != null || L != null || B != null) + if (A.s.vi(T)) + A.$g.ub(H, b, m, _, C, D, L, B); + else { + _ = A.F.ca(_), b = A.F.ca(b); + var Je = A.F.ca(_ - b); + if (A.s.$(m, C) && (A.s.$(b, _) || A.s.$(A.s.R(m), 1.570796326794897))) + D != null && (D.u = 0), L != null && (L.u = 0), B != null && (B.u = 0); + else { + if (A.s.$(m, -C)) { + if (A.s.$(A.s.R(m), 1.570796326794897)) + return D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0 < m ? A.F.ca(3.141592653589793 - A.F.ca(_)) : A.F.ca(_)), void (B != null && (B.u = 0 < m ? A.F.ca(_) : A.F.ca(3.141592653589793 - A.F.ca(_)))); + A.s.$(A.s.R(Je), 3.141592653589793) && (D != null && (D.u = 2 * A.F.Ch(H, T)), L != null && (L.u = 0), B != null && (B.u = 0)); + } else if (A.s.$(A.s.R(m), 1.570796326794897) || A.s.$(A.s.R(C), 1.570796326794897) || A.s.$(b, _) || A.s.$(A.s.R(Je), 3.141592653589793) || A.s.Dd(m)) + return void A.Yk.ub(H, T, b, m, _, C, D, L, B); + var Pt = Math.sqrt(1 - T); + _ = A.F.ca(_ - b), b = 0, A.F.el(1, T, m, b, 0, de, Ce, Ve), q[0] = de.u, q[1] = Ce.u, q[2] = Ve.u, A.F.el(1, T, C, _, 0, de, Ce, Ve), Z[0] = de.u, Z[1] = Ce.u, Z[2] = Ve.u, ie[0] = 0, ie[1] = 0, ie[2] = -1 * T * A.F.n(1, T, m) * Math.sin(m), 0 > _ ? A.F.Yq(ie, Z, q, se, 0) : A.F.Yq(ie, q, Z, se, 0), Ce = [0, 0, 0], Ve = [0, 0, 0]; + var $t = [0, 0, 0]; + q = [0, 0, 0], de = [0, 0, 0]; + var qe = Math.acos(se[2] / 1), Rt = 1 - T, Zt = Math.tan(qe), Jt = 1 + Zt * Zt / Rt, Xt = 2 * ie[2] * Zt / Rt; + for (Rt = (-Xt + (Zt = Math.sqrt(Xt * Xt - 4 * Jt * (ie[2] * ie[2] / Rt - 1)))) / (Jt *= 2), Xt = (-Xt - Zt) / Jt, Zt = Math.tan(qe), qe = (Rt + Xt) / 2, ie = ((Jt = Zt * Rt + ie[2]) + (Zt * Xt + ie[2])) / 2, Zt = A.F.ip(Rt - qe, Jt - ie), Rt = ie / Pt * 1.570796326794897, Xt = 0; 100 > Xt && (Jt = (Jt = A.F.w(T, Rt)) * Jt / Math.cos(Rt) * (Math.sin(Rt) - ie * Jt / (1 - T)), !A.s.Dd(Jt)); Xt++) + Rt -= Jt; + ie = A.F.n(1, T, Rt) * Math.cos(Rt), Zt = 1 - Zt / (ie = Math.sqrt((ie - qe) * (ie + qe))), Zt *= 2 - Zt, Jt = A.F.qn(Ce), qe = A.F.qn(Ve), Rt = A.F.qn($t); + var Qt = A.F.Ut($t, Ce); + Xt = A.F.Ut($t, Ve), A.F.yx($t, Ce, q), A.F.yx($t, Ve, de), Ce = Math.acos(Qt / (Rt * Jt)), Ve = Math.acos(Xt / (Rt * qe)), Ve *= A.s.Mb(1, A.F.Ut(q, de)), (1.570796326794897 <= A.s.R(Ce) && 1.570796326794897 <= A.s.R(Ve) || 3.141592653589793 < A.s.R(Ce - Ve)) && (Ce = (3.141592653589793 - A.s.R(Ce)) * A.s.Mb(1, Ce), Ve = (3.141592653589793 - A.s.R(Ve)) * A.s.Mb(1, Ve)), q = A.F.Sj(Zt, Ve), de = A.F.q(ie, Zt, A.F.Sj(Zt, Ce)), q = A.F.q(ie, Zt, q), q = A.s.R(q - de) * H, Ce = new A.ha(0), Ve = new A.ha(0), $t = se[1] / 1, $t *= -A.s.Mb(1, Je), de = Math.acos($t) * A.s.Mb(1, Je), ve.sf(H, T, b, m, q, de, Ce, Ve), A.s.$(_, Ce.u) && A.s.$(C, Ve.u) || (Zt = A.F.ip(A.F.ca(_ - Ce.u), C - Ve.u), ve.sf(H, T, b, m, q, A.F.ca(de + 3.141592653589793), Ce, Ve), (Jt = A.F.ip(A.F.ca(_ - Ce.u), C - Ve.u)) < Zt && (de = A.F.ca(de + 3.141592653589793))), Ce = [0, 0, 0, 0], Ve = [0, 0, 0, 0], Zt = [0, 0, 0], H = [0, 0, 0], b = [0, 0, 0], m = [0, 0, 0], $t = [0, 0, 0], (ie = [0, 0, 0])[0] = 0, ie[1] = 0, ie[2] = Pt, Zt[0] = 0, Zt[1] = 0, Zt[2] = 0, A.F.Yq(Zt, ie, Z, Ce, 0), A.s.Dd(C) ? (H[0] = Z[0], H[1] = Z[1], H[2] = 1, b[0] = 1 * Math.cos(_) - 1 * Math.sin(_), b[1] = 1 * Math.sin(_) + 1 * Math.cos(_)) : (T = A.F.n(1, T, C) * Math.cos(C), H[0] = 0, H[1] = 0, Z[2] += Math.tan(1.570796326794897 - A.s.R(C)) * T * A.s.Mb(1, C), b[0] = T * Math.cos(_) - T * Math.sin(_), b[1] = T * Math.sin(_) + T * Math.cos(_)), b[2] = Z[2], A.F.Yq(Z, b, H, Ve, 1), A.F.yx(Ve, Ce, m), A.F.yx(Ve, se, $t), $t = A.F.Ut(m, $t) / (A.F.qn(m) * A.F.qn($t)), $t *= A.s.Mb(1, Je), _ = Math.acos($t) * -A.s.Mb(1, Je), (0 < de && 0 < _ || 0 > de && 0 > _) && (_ = A.F.ca(_ + 3.141592653589793)), D != null && (D.u = q), L != null && (L.u = de), B != null && (B.u = _); + } + } + }, ve.sf = function(H, T, b, m, _, C, D, L) { + var B = [0, 0, 0], q = [0, 0, 0], Z = [0, 0, 0], ie = [0, 0, 0], se = [0, 0, 0], de = [0, 0, 0], Ce = [0, 0, 0], Ve = [0, 0, 0, 0], Je = new A.ha(0), Pt = new A.ha(0), $t = new A.ha(0), qe = new A.ha(0), Rt = new A.ha(0), Zt = new A.ha(0); + if (D != null && L != null) + if (A.s.vi(T)) + A.$g.sf(H, b, m, _, C, D, L); + else if (A.s.Dd(_)) + D != null && (D.u = b), L != null && (L.u = m); + else if (C = A.F.ca(C), 0 > _ && (_ = A.s.R(_), C = A.F.ca(C + 3.141592653589793)), b = A.F.ca(b), m = A.F.ca(m), 1.570796326794897 < A.s.R(m) && (b = A.F.ca(b + 3.141592653589793), m = A.s.Mb(3.141592653589793, m) - m), A.s.$(A.s.R(m), 1.570796326794897) || A.s.Dd(m) || A.s.Dd(C) || A.s.$(A.s.R(C), 3.141592653589793)) + A.Yk.sf(H, T, b, m, _, C, D, L); + else { + var Jt = Math.sqrt(1 - T); + for (H = _ / H, A.F.el(1, T, m, 0, 0, qe, Rt, Zt), B[0] = qe.u, B[1] = Rt.u, B[2] = Rt.u, Ce[0] = 0, Ce[1] = 0, Ce[2] = -1 * T * A.F.n(1, T, m) * Math.sin(m), qe = A.F.n(1, T, m), Rt = A.F.ca(1.570796326794897 - C), Zt = Math.sin(Rt), _ = Math.cos(m), m = Math.sin(m), se[0] = qe * _ - m * Zt, se[1] = Math.cos(Rt), se[2] = (1 - T) * qe * m + _ * Zt, 0 > C ? A.F.Yq(Ce, se, B, Ve, 0) : A.F.Yq(Ce, B, se, Ve, 0), B = Math.acos(Ve[2] / 1), Ve = Math.atan2(-Ve[1], -Ve[0]), m = 1 - T, Rt = 1 + (se = Math.tan(B)) * se / m, m = (-(qe = 2 * Ce[2] * se / m) + (se = Math.sqrt(qe * qe - 4 * Rt * (Ce[2] * Ce[2] / m - 1)))) / (Rt *= 2), qe = (-qe - se) / Rt, se = Math.tan(B), B = (m + qe) / 2, Ce = ((Rt = se * m + Ce[2]) + (se * qe + Ce[2])) / 2, se = A.F.ip(m - B, Rt - Ce), Jt = Ce / Jt * 1.570796326794897, m = 0; 100 > m && (qe = (qe = A.F.w(T, Jt)) * qe / Math.cos(Jt) * (Math.sin(Jt) - Ce * qe / (1 - T)), !A.s.Dd(qe)); m++) + Jt -= qe; + Jt = A.F.n(1, T, Jt) * Math.cos(Jt), Ce = 1 - se / (Jt = Math.sqrt((Jt - B) * (Jt + B))), Ce *= 2 - Ce, de = Math.acos(A.F.Ut(de, q) / (A.F.qn(de) * A.F.qn(q))), de *= A.s.Mb(1, q[0]), C = (A.F.q(Jt, Ce, A.F.Sj(Ce, de)) + H * A.s.Mb(1, C)) / A.F.Ch(Jt, Ce), C = A.F.ca(1.570796326794897 * C), C = A.F.Tq(Ce, C), A.F.n(Jt, Ce, C), se = A.F.ca(Ve + b), b = Math.cos(se), C = Math.sin(se), Z[0] = ie[0] * b + ie[1] * -C, Z[1] = ie[0] * C + ie[1] * b, Z[2] = ie[2], A.F.eO(T, Z[0], Z[1], Z[2], $t, Pt, Je), D != null && (D.u = Pt.u), L != null && (L.u = $t.u); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function() { + function _(C) { + this.Za = null, this.xt = new A.h(), this.yt = new A.h(), this.g = C; + } + return _.prototype.compare = function(C, D, L) { + return this.g.Hc(D, this.xt), this.g.Hc(C.ka(L), this.yt), this.xt.compare(this.yt); + }, _; + }(), H = function() { + function _(C) { + this.Cf = new A.h(), this.Fk = new A.h(), this.g = C; + } + return _.prototype.Fh = function(C) { + this.Cf.N(C); + }, _.prototype.compare = function(C, D) { + return this.g.Hc(C.ka(D), this.Fk), this.Cf.compare(this.Fk); + }, _; + }(), T = function(_) { + function C(D) { + var L = _.call(this, D.g, D.ra, !1) || this; + return L.ib = D, L; + } + return Ne(C, _), C.prototype.compare = function(D, L, B) { + if (this.sg) + return -1; + var q = this.ib.Rd.Ln(this.ib.Th(L)); + D = D.ka(B); + var Z = this.ib.Rd.Ln(this.ib.Th(D)); + return this.Fm = B, this.ME(L, q, D, Z); + }, C; + }(A.PC), b = function(_) { + function C(D) { + var L = _.call(this, D.g, D.ra) || this; + return L.ib = D, L; + } + return Ne(C, _), C.prototype.compare = function(D, L) { + return this.sg ? -1 : (D = this.ib.Rd.Ln(this.ib.Th(D.ka(L))), this.Fm = L, this.NE(L, D)); + }, C; + }(A.WL), m = function() { + function _() { + this.Nc = this.df = this.lo = this.Rd = this.nh = this.Ad = this.hb = this.g = null, this.Pg = !1, this.xh = this.Pm = this.je = this.Ik = this.ph = this.Ck = this.Gf = this.ae = null, this.zh = this.Lq = this.PA = this.ra = 0, this.Zv = this.Yn = !1, this.Ao = new A.h(), this.Ri = new A.h(), this.hb = new A.ad(8), this.Ad = new A.ad(5), this.nh = new A.cu(), this.Rd = new A.cu(), this.Pg = !1, this.xh = new A.h(), this.xh.na(0, 0), this.ra = 0, this.zh = -1, this.Yn = !1, this.g = null, this.df = new A.$j(), this.Nc = new A.$j(), this.ph = new A.ja(0), this.Ik = new A.OC(), this.Gf = new A.ja(0), this.Ck = new A.ja(0), this.lo = new A.Ta(); + } + return _.prototype.LX = function(C, D) { + var L = new A.Ed(); + return L.VB(), C.Pc(L), this.gr(C), this.Yn = !1, this.ra = D, this.PA = D * D, D = this.eC(), C.Pc(L), D || (this.lQ(), D || this.eC()), this.zh != -1 && (this.g.Ud(this.zh), this.zh = -1), this.g = null, this.Yn; + }, _.prototype.PX = function(C, D) { + this.gr(C), this.Yn = !1, this.ra = D, this.PA = D * D, this.Pg = !1, this.eC(), this.Pg || (this.Pg = C.Ip(D, !0, !1) == 1), this.zh != -1 && (this.g.Ud(this.zh), this.zh = -1), this.g = null; + }, _.prototype.qg = function(C, D) { + return this.hb.U(C, 0 + D); + }, _.prototype.GB = function(C, D, L) { + this.hb.T(C, 0 + D, L); + }, _.prototype.Th = function(C) { + return this.hb.U(C, 2); + }, _.prototype.UW = function(C, D) { + this.hb.T(C, 2, D); + }, _.prototype.MF = function(C, D) { + return this.hb.U(C, 3 + D); + }, _.prototype.Rp = function(C) { + return this.hb.U(C, 7); + }, _.prototype.Rl = function(C, D) { + this.hb.T(C, 7, D); + }, _.prototype.Tp = function(C, D) { + return this.hb.U(C, 3 + this.Qp(C, D)); + }, _.prototype.hr = function(C, D, L) { + this.hb.T(C, 3 + this.Qp(C, D), L); + }, _.prototype.IR = function(C, D) { + return this.hb.U(C, 5 + this.Qp(C, D)); + }, _.prototype.jr = function(C, D, L) { + this.hb.T(C, 5 + this.Qp(C, D), L); + }, _.prototype.Ur = function(C) { + return this.Ad.U(C, 0); + }, _.prototype.PW = function(C, D) { + this.Ad.T(C, 0, D); + }, _.prototype.$y = function(C) { + return this.Ad.U(C, 4); + }, _.prototype.er = function(C, D) { + this.Ad.T(C, 4, D); + }, _.prototype.kl = function(C) { + return this.Ad.U(C, 1); + }, _.prototype.nn = function(C, D) { + this.Ad.T(C, 1, D); + }, _.prototype.Zy = function(C) { + return this.Ad.U(C, 3); + }, _.prototype.Ft = function(C, D) { + this.Ad.T(C, 3, D); + }, _.prototype.$m = function(C) { + var D = this.Ad.De(), L = this.nh.Rh(); + return this.PW(D, L), C != -1 ? (this.nh.addElement(L, C), this.g.Sa(C, this.zh, D), this.er(D, this.g.Va(C))) : this.er(D, -1), D; + }, _.prototype.CP = function(C) { + this.Ad.kd(C); + }, _.prototype.FD = function(C, D) { + this.nh.addElement(this.Ur(C), D), this.g.Sa(D, this.zh, C); + }, _.prototype.ot = function(C) { + var D = this.hb.De(), L = this.Rd.Rh(); + return this.UW(D, L), C != -1 && this.Rd.addElement(L, C), D; + }, _.prototype.GD = function(C, D) { + this.Rd.addElement(this.Th(C), D); + }, _.prototype.Wu = function(C) { + this.hb.kd(C), 0 <= (C = this.ph.gF(C)) && this.ph.NV(C); + }, _.prototype.jj = function(C, D) { + if (this.qg(C, 0) == -1) + this.GB(C, 0, D); + else { + if (this.qg(C, 1) != -1) + throw A.i.Ra(); + this.GB(C, 1, D); + } + this.gy(C, D); + }, _.prototype.gy = function(C, D) { + var L = this.kl(D); + if (L != -1) { + var B = this.Tp(L, D); + this.jr(B, D, C), this.hr(C, D, B), this.hr(L, D, C), this.jr(C, D, L); + } else + this.jr(C, D, C), this.hr(C, D, C), this.nn(D, C); + }, _.prototype.Qp = function(C, D) { + return this.qg(C, 0) == D ? 0 : 1; + }, _.prototype.Zm = function(C, D) { + var L, B = this.Zy(D); + if (B != -1 && (this.df.wd(B, -1), this.Ft(D, -1)), (B = this.kl(D)) != -1) { + var q = L = B; + do { + var Z = !1, ie = this.Qp(L, D), se = this.MF(L, ie); + if (this.qg(L, ie + 1 & 1) == C) { + if (this.Zu(L), this.Rd.eh(this.Th(L)), this.Wu(L), L == se) { + B = -1; + break; + } + B == L && (B = this.kl(D), q = se, Z = !0); + } + L = se; + } while (L != q || Z); + if (B != -1) { + do + ie = this.Qp(L, D), se = this.MF(L, ie), this.GB(L, ie, C), L = se; + while (L != q); + (L = this.kl(C)) != -1 ? (q = this.Tp(L, C), Z = this.Tp(B, C), q == L ? (this.nn(C, B), this.gy(L, C), this.nn(C, L)) : Z == B && this.gy(B, C), this.hr(B, C, q), this.jr(q, C, B), this.hr(L, C, Z), this.jr(Z, C, L)) : this.nn(C, B); + } + } + for (B = this.Ur(C), L = this.Ur(D), q = this.nh.sc(L); q != -1; q = this.nh.lb(q)) + this.g.Sa(this.nh.ka(q), this.zh, C); + this.nh.Cy(B, L), this.CP(D); + }, _.prototype.PT = function(C, D) { + var L = this.qg(C, 0), B = this.qg(C, 1), q = this.qg(D, 0), Z = this.qg(D, 1); + this.Rd.Cy(this.Th(C), this.Th(D)), D == this.kl(L) && this.nn(L, C), D == this.kl(B) && this.nn(B, C), this.Zu(D), this.Wu(D), L == q && B == Z || B == q && L == Z || (this.Jn(L, this.Ao), this.Jn(q, this.Ri), this.Ao.rb(this.Ri) ? (L != q && this.Zm(L, q), B != Z && this.Zm(B, Z)) : (B != q && this.Zm(B, q), L != Z && this.Zm(L, Z))); + }, _.prototype.Zu = function(C) { + var D = this.qg(C, 1); + this.ZE(C, this.qg(C, 0)), this.ZE(C, D); + }, _.prototype.ZE = function(C, D) { + var L = this.Tp(C, D), B = this.IR(C, D), q = this.kl(D); + L != C ? (this.hr(B, D, L), this.jr(L, D, B), q == C && this.nn(D, L)) : this.nn(D, -1); + }, _.prototype.RD = function(C, D, L) { + var B = this.Rd.sc(C), q = this.Rd.ka(B); + C = this.Ie(q); + var Z = this.Ie(this.g.V(q)); + for (this.g.lr(q, D, L, !0), B = this.Rd.lb(B); B != -1; B = this.Rd.lb(B)) { + q = this.Rd.ka(B); + var ie = this.Ie(q) == C; + this.g.lr(q, D, L, ie); + } + B = D.Xp(L, 0).bc(), D = D.Xp(L, D.ql(L) - 1).xc(), this.wK(C, B), this.wK(Z, D); + }, _.prototype.UE = function(C, D, L) { + var B = this.Th(C), q = this.qg(C, 0), Z = this.qg(C, 1), ie = this.ot(-1); + for (this.ph.add(ie), this.Rl(ie, -3), this.Gf.add(ie), this.jj(ie, q), C = 1, D = D.ql(L); C < D; C++) + L = this.$m(-1), this.Ck.add(L), this.Gf.add(L), this.jj(ie, L), ie = this.ot(-1), this.ph.add(ie), this.Rl(ie, -3), this.Gf.add(ie), this.jj(ie, L); + for (this.jj(ie, Z), B = this.Rd.sc(B); B != -1; B = this.Rd.lb(B)) + if (Z = this.Rd.ka(B), this.Ie(Z) == q) { + C = 0; + do + 0 < C && (ie = this.Gf.get(C - 1), this.FD(ie, Z), this.$y(ie) == -1 && this.er(ie, this.g.Va(Z))), ie = this.Gf.get(C), C += 2, this.GD(ie, Z), Z = this.g.V(Z); + while (C < this.Gf.size); + } else { + C = this.Gf.size - 1; + do + C < this.Gf.size - 2 && (ie = this.Gf.get(C + 1), this.FD(ie, Z), 0 > this.$y(ie) && this.er(ie, this.g.Va(Z))), ie = this.Gf.get(C), C -= 2, this.GD(ie, Z), Z = this.g.V(Z); + while (0 <= C); + } + this.Gf.clear(!1); + }, _.prototype.Ie = function(C) { + return this.g.Qa(C, this.zh); + }, _.prototype.NI = function(C, D, L) { + var B = this.qg(D, 0), q = new A.h(); + this.Jn(B, q); + var Z = new A.h(), ie = this.qg(D, 1); + this.Jn(ie, Z); + var se = L.ql(C), de = L.Xp(C, 0), Ce = new A.h(); + if (de.$p(Ce), !q.rb(Ce)) { + if (!this.Pg) { + var Ve = q.compare(this.xh); + 0 > Ve * (Ce = Ce.compare(this.xh)) && (this.Pg = !0); + } + this.qF(B, this.Gf), this.Ck.add(B); + } + for (!this.Pg && 1 < se && (Ve = q.compare(Z), de = de.xc(), (q.compare(de) != Ve || de.compare(Z) != Ve || 0 > de.compare(this.xh)) && (this.Pg = !0)), C = (de = L.Xp(C, se - 1)).xc(), Z.rb(C) || (this.Pg || 0 > (Ve = Z.compare(this.xh)) * (Ce = C.compare(this.xh)) && (this.Pg = !0), this.qF(ie, this.Gf), this.Ck.add(ie)), this.Gf.add(D), Z = 0, ie = this.Gf.size; Z < ie; Z++) + C = this.Gf.get(Z), L = this.Rp(C), A.ad.GG(L) && (this.Nc.wd(L, -1), this.Rl(C, -1)), C != D && this.Rp(C) != -3 && (this.ph.add(C), this.Rl(C, -3)); + this.Gf.clear(!1); + }, _.prototype.gO = function(C, D) { + this.ae.compare(this.Nc, this.Nc.ka(C), D), this.ae.sg && (this.ae.Mr(), this.jF(C, D)); + }, _.prototype.jF = function(C, D) { + this.Yn = !0, C = this.Nc.ka(C), D = this.Nc.ka(D); + var L = this.Rd.Ln(this.Th(C)), B = this.Rd.Ln(this.Th(D)), q = this.g.cc(L); + q == null && (this.je == null && (this.je = new A.zb()), this.g.fd(L, this.je), q = this.je), (L = this.g.cc(B)) == null && (this.Pm == null && (this.Pm = new A.zb()), this.g.fd(B, this.Pm), L = this.Pm), this.Ik.Qo(q), this.Ik.Qo(L), this.Ik.Fa(this.ra, !0) && (this.Pg = !0), this.cK(C, D, -1, this.Ik), this.Ik.clear(); + }, _.prototype.BQ = function(C, D) { + this.Yn = !0, D = this.Nc.ka(D); + var L = this.Rd.Ln(this.Th(D)), B = this.g.cc(L); + B == null && (this.je == null && (this.je = new A.zb()), this.g.fd(L, this.je), B = this.je), L = this.wF(C), this.Ik.Qo(B), this.g.Xi(L, this.lo), this.Ik.Fz(this.ra, this.lo, !0), this.cK(D, -1, C, this.Ik), this.Ik.clear(); + }, _.prototype.sS = function() { + if (this.ph.size != 0) + for (; this.ph.size != 0; ) { + if (this.ph.size > Math.max(100, this.g.gd)) { + this.ph.clear(!1), this.Pg = !0; + break; + } + var C = this.ph.Gc(); + this.ph.Jf(), this.Rl(C, -1), this.RS(C) != -1 && this.rS(C), this.Xn = !1; + } + }, _.prototype.rS = function(C) { + if (this.Xn) { + var D = this.Nc.Bu(this.HH, this.BH, C, !0); + this.Xn = !1; + } else + D = this.Nc.ED(C); + D == -1 ? this.PT(this.Nc.ka(this.Nc.AF()), C) : (this.Rl(C, D), this.ae.sg && (this.ae.Mr(), this.jF(this.ae.Fm, D))); + }, _.prototype.RS = function(C) { + var D = this.qg(C, 0); + if (C = this.qg(C, 1), this.Jn(D, this.Ao), this.Jn(C, this.Ri), A.h.zc(this.Ao, this.Ri) <= this.PA) + return this.Pg = !0, -1; + var L = this.Ao.compare(this.xh), B = this.Ri.compare(this.xh); + return 0 >= L && 0 < B ? C : 0 >= B && 0 < L ? D : -1; + }, _.prototype.jQ = function() { + var C = new A.ja(0); + C.Jb(this.g.gd); + for (var D = this.g.$q(), L = D.next(); L != -1; L = D.next()) + this.g.Qa(L, this.zh) != -1 && C.add(L); + this.g.nx(C, C.size), this.kQ(C); + }, _.prototype.kQ = function(C) { + this.df.clear(), this.df.Ee(C.size), this.df.Xo(new ve(this.g)); + var D = new A.h(); + D.Sc(); + for (var L = -1, B = new A.h(), q = 0, Z = C.size; q < Z; q++) { + var ie = C.get(q); + this.g.Hc(ie, B), B.rb(D) ? (ie = this.g.Qa(ie, this.zh), this.Zm(L, ie)) : (L = this.Ie(ie), this.g.Hc(ie, D), ie = this.df.zn(ie), this.Ft(L, ie)); + } + }, _.prototype.lQ = function() { + var C = new A.ja(0); + C.Jb(this.g.gd); + for (var D = this.df.sc(-1); D != -1; D = this.df.lb(D)) + C.add(this.df.ka(D)); + this.df.clear(), this.g.nx(C, C.size), D = 0; + for (var L = C.size; D < L; D++) { + var B = C.get(D), q = this.Ie(B); + B = this.df.zn(B), this.Ft(q, B); + } + }, _.prototype.qF = function(C, D) { + var L = this.kl(C); + if (L != -1) { + var B = L; + do + A.ad.GG(this.Rp(B)) && D.add(B), B = this.Tp(B, C); + while (B != L); + } + }, _.prototype.wK = function(C, D) { + for (C = this.nh.sc(this.Ur(C)); C != -1; C = this.nh.lb(C)) + this.g.mf(this.nh.ka(C), D); + }, _.prototype.cK = function(C, D, L, B) { + this.Zu(C), D != -1 && this.Zu(D), this.NI(0, C, B), D != -1 && this.NI(1, D, B), L != -1 && (B.Cf.D(this.Ao), this.Jn(L, this.Ri), this.Ri.rb(this.Ao) || this.Ck.add(L)), L = 0; + for (var q = this.Ck.size; L < q; L++) { + var Z = this.Ck.get(L), ie = this.Zy(Z); + ie != -1 && (this.df.wd(ie, -1), this.Ft(Z, -1)); + } + for (L = this.Th(C), q = D != -1 ? this.Th(D) : -1, this.RD(L, B, 0), D != -1 && this.RD(q, B, 1), this.UE(C, B, 0), D != -1 && this.UE(D, B, 1), this.Rd.eh(L), this.Wu(C), D != -1 && (this.Rd.eh(q), this.Wu(D)), L = 0, q = this.Ck.size; L < q; L++) + (Z = this.Ck.get(L)) == this.Lq && (this.Zv = !0), (ie = this.Zy(Z)) == -1 && ((ie = this.df.ED(this.wF(Z))) == -1 ? (C = this.Ie(this.df.ka(this.df.AF())), this.Zm(C, Z)) : this.Ft(Z, ie)); + this.Ck.clear(!1); + }, _.prototype.Jn = function(C, D) { + this.g.ZF(this.$y(C), D); + }, _.prototype.wF = function(C) { + return this.nh.Ln(this.Ur(C)); + }, _.prototype.eC = function() { + this.Zv = !1, this.Lq = -1, this.ae == null && (this.Nc.Tv = !1, this.ae = new T(this), this.Nc.ao = this.ae); + var C = new A.ja(0), D = null, L = null; + this.BH = this.HH = -1, this.Xn = !1; + for (var B = this.df.sc(-1); B != -1; ) { + this.Xn = !1; + var q = this.df.ka(B); + this.Lq = this.Ie(q), this.g.Hc(q, this.xh), this.ae.VJ(this.xh.y, this.xh.x); + var Z = this.kl(this.Lq), ie = Z == -1; + if (!ie) { + q = Z; + do { + var se = this.Rp(q); + se == -1 ? (this.ph.add(q), this.Rl(q, -3)) : se != -3 && C.add(se), q = this.Tp(q, this.Lq); + } while (q != Z); + } + if (0 < C.size) { + for (this.Xn = C.size == 1 && this.ph.size == 1, ie = 0, Z = C.size; ie < Z; ie++) + q = this.Nc.ka(C.get(ie)), this.Rl(q, -2); + var de = -2, Ce = -2; + for (ie = 0, Z = C.size; ie < Z; ie++) { + if (se = C.get(ie), de == -2) { + var Ve = this.Nc.xe(se); + Ve != -1 ? (q = this.Nc.ka(Ve), (q = this.Rp(q)) != -2 && (de = Ve)) : de = -1; + } + if (Ce == -2 && ((se = this.Nc.lb(se)) != -1 ? (q = this.Nc.ka(se), (q = this.Rp(q)) != -2 && (Ce = se)) : Ce = -1), de != -2 && Ce != -2) + break; + } + for (ie = 0, Z = C.size; ie < Z; ie++) + se = C.get(ie), q = this.Nc.ka(se), this.Nc.wd(se, -1), this.Rl(q, -1); + C.clear(!1), this.HH = de != -1 ? de : -1, this.BH = Ce != -1 ? Ce : -1, de != -1 && Ce != -1 ? this.Xn || this.gO(de, Ce) : de == -1 && Ce == -1 && (this.Xn = !1); + } else + ie && (D == null && (D = new b(this)), D.Fh(this.xh), this.Nc.pJ(D), D.sg && (D.Mr(), this.BQ(this.Lq, D.Fm))); + this.sS(), this.Zv ? (this.Zv = !1, L == null && (L = new H(this.g)), L.Fh(this.xh), B = this.df.pJ(L)) : B = this.df.lb(B); + } + return this.Yn; + }, _.prototype.gr = function(C) { + for (this.g = C, this.zh = this.g.Hd(), this.hb.Ee(C.gd + 32), this.Ad.Ee(C.gd), this.nh.Bt(C.gd), this.nh.hn(C.gd), this.Rd.Bt(C.gd + 32), this.Rd.hn(C.gd + 32), C = this.g.md; C != -1; C = this.g.ve(C)) + if (A.ba.Ic(this.g.jc(C))) + for (se = this.g.Ob(C); se != -1; se = this.g.Sb(se)) { + var D = this.g.Ka(se), L = this.g.Ya(se), B = this.$m(L), q = this.ot(L); + for (this.jj(q, B), de = this.g.V(L), L = 0, D -= 2; L < D; L++) { + var Z = this.g.V(de), ie = this.$m(de); + this.jj(q, ie), q = this.ot(de), this.jj(q, ie), de = Z; + } + this.g.ec(se) ? (ie = this.$m(de), this.jj(q, ie), q = this.ot(de), this.jj(q, ie), this.jj(q, B)) : (ie = this.$m(de), this.jj(q, ie)); + } + else + for (var se = this.g.Ob(C); se != -1; se = this.g.Sb(se)) { + var de = this.g.Ya(se); + for (B = 0, D = this.g.Ka(se); B < D; B++) + this.$m(de), de = this.g.V(de); + } + this.jQ(); + }, _; + }(); + A.MC = m; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T(b, m, _) { + var C = H.call(this) || this; + if (b !== void 0) + if (_ !== void 0) { + C.description = A.fe.pg(); + var D = new A.Od(); + D.L(b, m, _), C.ZB(D); + } else if (m !== void 0) + C.description = A.fe.pg(), C.Db(b, m); + else if (b instanceof A.sa) + C.description = b; + else if (b instanceof A.h) + C.description = A.fe.pg(), C.Db(b); + else { + if (!(b instanceof T)) + throw A.i.O(); + C.description = b.description, C.Db(b.Ng(), b.kh()), b.la !== null && (C.la = b.la.slice(0)); + } + else + C.description = A.fe.pg(); + return C; + } + return Ne(T, H), T.prototype.D = function(b) { + if (b === void 0) { + if (this.Bc()) + throw A.i.ga("This operation should not be performed on an empty geometry."); + return (b = new A.h()).na(this.la[0], this.la[1]), b; + } + if (this.Bc()) + throw A.i.ga("This operation should not be performed on an empty geometry."); + b.na(this.la[0], this.la[1]); + }, T.prototype.Db = function(b, m) { + typeof b == "number" ? (this.wc(), this.la == null && this.wn(), this.la[0] = b, this.la[1] = m) : (this.wc(), this.Db(b.x, b.y)); + }, T.prototype.xz = function() { + if (this.Bc()) + throw A.i.ga("This operation should not be performed on an empty geometry."); + var b = new A.Od(); + return b.x = this.la[0], b.y = this.la[1], b.z = this.description.dG() ? this.la[2] : A.sa.te(1), b; + }, T.prototype.ZB = function(b) { + this.wc(); + var m = this.hasAttribute(1); + m || A.sa.yG(1, b.z) || (this.se(1), m = !0), this.la == null && this.wn(), this.la[0] = b.x, this.la[1] = b.y, m && (this.la[2] = b.z); + }, T.prototype.Ng = function() { + if (this.Bc()) + throw A.i.ga("This operation should not be performed on an empty geometry."); + return this.la[0]; + }, T.prototype.YB = function(b) { + this.setAttribute(0, 0, b); + }, T.prototype.kh = function() { + if (this.Bc()) + throw A.i.ga("This operation should not be performed on an empty geometry."); + return this.la[1]; + }, T.prototype.WJ = function(b) { + this.setAttribute(0, 1, b); + }, T.prototype.XR = function() { + return this.Vc(1, 0); + }, T.prototype.sX = function(b) { + this.setAttribute(1, 0, b); + }, T.prototype.uR = function() { + return this.Vc(2, 0); + }, T.prototype.cX = function(b) { + this.setAttribute(2, 0, b); + }, T.prototype.Fc = function() { + return this.tF(3, 0); + }, T.prototype.GJ = function(b) { + this.setAttribute(3, 0, b); + }, T.prototype.Vc = function(b, m) { + var _ = this.description.Rf(b); + return 0 <= _ ? this.la[this.description.bk(_) + m] : A.sa.te(b); + }, T.prototype.tF = function(b, m) { + var _ = this.description.Rf(b); + return 0 <= _ ? this.la[this.description.bk(_) + m] : A.sa.te(b); + }, T.prototype.setAttribute = function(b, m, _) { + this.wc(); + var C = this.description.Rf(b); + 0 > C && (this.se(b), C = this.description.Rf(b)), this.la == null && this.wn(), this.la[this.description.bk(C) + m] = _; + }, T.prototype.K = function() { + return 33; + }, T.prototype.Eb = function() { + return 0; + }, T.prototype.Pa = function() { + this.wc(), this.la != null && (this.la[0] = NaN, this.la[1] = NaN); + }, T.prototype.un = function(b) { + if (this.la != null) { + for (var m = A.fe.Kw(b, this.description), _ = [], C = 0, D = 0, L = b.Ba; D < L; D++) { + var B = b.ld(D), q = A.sa.Wa(B); + if (m[D] == -1) { + var Z = A.sa.te(B); + for (B = 0; B < q; B++) + _[C] = Z, C++; + } else + for (Z = this.description.bk(m[D]), B = 0; B < q; B++) + _[C] = this.la[Z], C++, Z++; + } + this.la = _; + } + this.description = b; + }, T.prototype.wn = function() { + this.gJ(this.description.Be.length), T.YD(this.description.Be, this.la, this.description.Be.length), this.la[0] = NaN, this.la[1] = NaN; + }, T.prototype.Pc = function(b) { + if (b instanceof A.Ed) { + if (!this.Bc()) { + var m = this.D(); + b.Gh(m, m), this.Db(m); + } + } else + this.Bc() || (this.se(1), m = this.xz(), this.ZB(b.hp(m))); + }, T.prototype.copyTo = function(b) { + if (b.K() != 33) + throw A.i.O(); + b.wc(), this.la == null ? (b.Pa(), b.la = null, b.Pf(this.description)) : (b.Pf(this.description), b.gJ(this.description.Be.length), T.YD(this.la, b.la, this.description.Be.length)); + }, T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.B = function() { + return this.Bc(); + }, T.prototype.Bc = function() { + return this.la == null || isNaN(this.la[0]) || isNaN(this.la[1]); + }, T.prototype.dn = function(b) { + b.Pa(), this.description != b.description && b.Pf(this.description), b.$b(this); + }, T.prototype.A = function(b) { + this.Bc() ? b.Pa() : (b.v = this.la[0], b.G = this.la[1], b.C = this.la[0], b.H = this.la[1]); + }, T.prototype.So = function(b) { + if (this.Bc()) + b.Pa(); + else { + var m = this.xz(); + b.v = m.x, b.G = m.y, b.Xe = m.z, b.C = m.x, b.H = m.y, b.Dg = m.z; + } + }, T.prototype.Vg = function(b, m) { + var _ = new A.Oc(); + return this.Bc() ? (_.Pa(), _) : (b = this.Vc(b, m), _.pa = b, _.wa = b, _); + }, T.prototype.gJ = function(b) { + if (this.la == null) + this.la = A.P.mg(b); + else if (this.la.length < b) { + for (var m = this.la.slice(0), _ = this.la.length; _ < b; _++) + m[_] = 0; + this.la = m; + } + }, T.YD = function(b, m, _) { + if (0 < _) + for (_ = 0; _ < b.length; _++) + m[_] = b[_]; + }, T.prototype.Nb = function(b) { + if (b == this) + return !0; + if (!(b instanceof T) || this.description != b.description) + return !1; + if (this.Bc()) + return !!b.Bc(); + for (var m = 0, _ = this.description.Be.length; m < _; m++) + if (this.la[m] != b.la[m]) + return !1; + return !0; + }, T.prototype.dc = function() { + var b = this.description.dc(); + if (!this.Bc()) + for (var m = 0, _ = this.description.Be.length; m < _; m++) { + var C = this.la[m]; + C = A.P.truncate(C ^ C >>> 32), b = A.P.Vh(C, b); + } + return b; + }, T.prototype.ng = function() { + return null; + }, T; + }(A.ba); + A.Ta = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m) { + T !== void 0 && (this.x = T, this.y = b, this.z = m); + } + return H.construct = function(T, b, m) { + var _ = new H(); + return _.x = T, _.y = b, _.z = m, _; + }, H.prototype.L = function(T, b, m) { + this.x = T, this.y = b, this.z = m; + }, H.prototype.lx = function() { + this.z = this.y = this.x = 0; + }, H.prototype.normalize = function() { + var T = this.length(); + T == 0 && (this.x /= T, this.y /= T, this.z /= T); + }, H.prototype.length = function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + }, H.prototype.sub = function(T) { + return new H(this.x - T.x, this.y - T.y, this.z - T.z); + }, H.prototype.Bg = function(T) { + new H(this.x * T, this.y * T, this.z * T); + }, H.prototype.Sh = function(T) { + return this.x * T.x + this.y * T.y + this.z * T.z; + }, H; + }(); + A.Od = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T, b, m) { + this.Iw = this.yA = null, this.Zf = b, this.AT = b.y - m, this.zT = b.y + m, this.Gw = 0, this.Zz = T, this.ra = m, this.MT = m * m, this.$z = m != 0, this.Nv = !1; + } + return H.prototype.result = function() { + return this.Gw != 0 ? 1 : 0; + }, H.prototype.UM = function(T) { + return T = T.ic(T.ge(this.Zf, !1)), A.h.zc(T, this.Zf) <= this.MT; + }, H.prototype.aF = function(T) { + if (!this.$z && (this.Zz && this.Zf.rb(T.bc()) || this.Zf.rb(T.xc()))) + this.Nv = !0; + else if (T.oa == this.Zf.y && T.oa == T.ma) { + if (this.Zz && !this.$z) { + var b = Math.max(T.ta, T.qa); + this.Zf.x > Math.min(T.ta, T.qa) && this.Zf.x < b && (this.Nv = !0); + } + } else { + var m = !1; + if (b = Math.max(T.ta, T.qa), this.Zf.x > b ? m = !0 : this.Zf.x >= Math.min(T.ta, T.qa) && (m = 0 < T.fq(!0, this.Zf.y, this.Iw, null) && this.Iw[0] <= this.Zf.x), m) { + if (this.Zf.y == T.bc().y) { + if (this.Zf.y < T.xc().y) + return; + } else if (this.Zf.y == T.xc().y && this.Zf.y < T.bc().y) + return; + this.Gw = this.Zz ? 1 ^ this.Gw : this.Gw + (T.bc().y > T.xc().y ? 1 : -1); + } + } + }, H.prototype.MI = function(T) { + var b = T.Vg(0, 1); + if (b.pa > this.zT || b.wa < this.AT) + return !1; + if (this.$z && this.UM(T)) + return !0; + if (b.pa > this.Zf.y || b.wa < this.Zf.y) + return !1; + if (this.yA == null && (this.yA = [null, null, null, null, null]), this.Iw == null && (this.Iw = [0, 0, 0]), 0 < (b = T.$F())) + for (T = 0; T < b; T++) { + var m = this.yA[T].get(); + if (this.aF(m), this.Nv) + return !0; + } + else if (this.aF(T), this.Nv) + return !0; + return !1; + }, H.KM = function(T, b, m) { + for (b = new H(T.Kn() == 0, b, m), T = T.Ha(); T.ab(); ) + for (; T.Ia(); ) + if (m = T.ia(), b.MI(m)) + return -1; + return b.result(); + }, H.LM = function(T, b, m, _) { + var C = new A.l(); + T.yc(C), C.X(_, _); + var D = new H(T.Kn() == 0, m, _); + T = T.Ha(); + var L = new A.l(); + for (L.L(C), L.C = m.x + _, L.G = m.y - _, L.H = m.y + _, _ = (m = b.HF(L, _)).next(); _ != -1; _ = m.next()) + if (T.Wb(b.ka(_)), T.Ia() && (_ = T.ia(), D.MI(_))) + return -1; + return D.result(); + }, H.ym = function(T, b, m) { + if (T.B()) + return 0; + var _ = new A.l(); + if (T.yc(_), _.X(m, m), !_.contains(b)) + return 0; + if ((_ = T.Cb) != null) { + var C = _.Hk; + if (C != null) { + if ((C = C.Uo(b.x, b.y)) == 1) + return 1; + if (C == 0) + return 0; + } + if ((_ = _.Gb) != null) + return H.LM(T, _, b, m); + } + return H.KM(T, b, m); + }, H.XS = function(T, b, m) { + return b.B() ? 0 : H.ym(T, b.D(), m); + }, H.Ol = function(T, b) { + return !(16 > (T = T.I())) && 2 * T + Math.log(T) / Math.log(2) * b < 1 * T * b; + }, H; + }(); + A.Fg = ve; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T(b) { + return H.call(this, !0, b) || this; + } + return Ne(T, H), T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.Eb = function() { + return 2; + }, T.prototype.K = function() { + return 1736; + }, T.prototype.sG = function(b, m, _) { + this.ES(b, m, _); + }, T.prototype.kR = function() { + this.AR(); + }, T; + }(A.Xk); + A.Ea = ve; + }(le || (le = {})), function(A) { + (function(ve) { + ve[ve.PiPOutside = 0] = "PiPOutside", ve[ve.PiPInside = 1] = "PiPInside", ve[ve.PiPBoundary = 2] = "PiPBoundary"; + })(A.ML || (A.ML = {})), A.jd = function() { + function ve() { + } + return ve.FG = function(H, T, b) { + return (H = A.Fg.XS(H, T, b)) == 0 ? 0 : H == 1 ? 1 : 2; + }, ve.Zd = function(H, T, b) { + return (H = A.Fg.ym(H, T, b)) == 0 ? 0 : H == 1 ? 1 : 2; + }, ve.SX = function(H, T, b, m, _) { + if (T.length < b || _.length < b) + throw A.i.O(); + for (var C = 0; C < b; C++) + _[C] = ve.Zd(H, T[C], m); + }, ve.nK = function(H, T, b, m, _) { + if (H.K() == 1736) + ve.SX(H, T, b, m, _); + else { + if (H.K() != 197) + throw A.i.ga("invalid_call"); + var C = new A.l(); + H.A(C), ve.VM(C, T, b, m, _); + } + }, ve.VM = function(H, T, b, m, _) { + if (T.length < b || _.length < b) + throw A.i.O(); + if (H.B()) + for (m = 0; m < b; m++) + _[m] = 0; + else + for (H.X(0.5 * -m, 0.5 * -m), H.X(0.5 * m, 0.5 * m), m = 0; m < b; m++) + H.contains(T[m]) ? _[m] = 1 : H.contains(T[m]) ? _[m] = 2 : _[m] = 0; + }, ve.UX = function(H, T, b, m, _) { + for (var C = 0; C < b; C++) + _[C] = H.ss(T[C], m) ? 2 : 0; + }, ve.TX = function(H, T, b, m, _) { + var C = H.Cb, D = null; + C != null && (D = C.Hk), C = b; + for (var L = 0; L < b; L++) + if (_[L] = 1, D != null) { + var B = T[L]; + D.Uo(B.x, B.y) == 0 && (_[L] = 0, C--); + } + if (C != 0) + for (H = H.Ha(); H.ab() && C != 0; ) + for (; H.Ia() && C != 0; ) + for (D = H.ia(), L = 0; L < b && C != 0; L++) + _[L] == 1 && D.ss(T[L], m) && (_[L] = 2, C--); + for (L = 0; L < b; L++) + _[L] == 1 && (_[L] = 0); + }, ve.oK = function(H, T, b, m, _) { + var C = H.K(); + if (C == 1607) + ve.TX(H, T, b, m, _); + else { + if (!A.ba.zd(C)) + throw A.i.ga("Invalid call."); + ve.UX(H, T, b, m, _); + } + }, ve; + }(); + }(le || (le = {})), function(A) { + var ve = function(H) { + function T(b, m) { + if (arguments.length == 2) { + var _ = H.call(this, !1, b.description) || this; + _.nf(b), _.lineTo(m); + } else + _ = H.call(this, !1, b) || this; + return _; + } + return Ne(T, H), T.prototype.Ja = function() { + return new T(this.description); + }, T.prototype.Eb = function() { + return 1; + }, T.prototype.K = function() { + return 1607; + }, T.prototype.sG = function(b, m, _) { + this.FS(b, m, _); + }, T; + }(A.Xk); + A.Ua = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.prototype.progress = function() { + return !0; + }, H.Bp = function(T) { + if (T != null && !T.progress(-1, -1)) + throw A.i.RC(); + }, H; + }(); + A.op = ve; + }(le || (le = {})), function(A) { + var ve; + (ve = A.KK || (A.KK = {}))[ve.clipWithInputHorizon = 1] = "clipWithInputHorizon", ve[ve.clipWithOutputHorizon = 2] = "clipWithOutputHorizon"; + var H = function() { + function m() { + this.Mg = 3, this.Xu = this.Lr = NaN; + } + return m.prototype.KW = function(_) { + this.LB(1, _); + }, m.prototype.LW = function(_) { + this.LB(2, _); + }, m.prototype.cS = function() { + return this.ks(1); + }, m.prototype.dS = function() { + return this.ks(2); + }, m.prototype.LB = function(_, C) { + this.Mg = C ? this.Mg | _ : this.Mg & ~_; + }, m.prototype.ks = function(_) { + return (this.Mg & _) != 0; + }, m.prototype.Qf = function() { + var _ = new m(); + return _.Lr = this.Lr, _.Xu = this.Xu, _.Mg = this.Mg, _; + }, m; + }(); + A.tC = H, function(m) { + m[m.Dont_Geonomalize_Polygon = 2147483648] = "Dont_Geonomalize_Polygon", m[m.Dont_Adjust_At_Poles = 1073741824] = "Dont_Adjust_At_Poles"; + }(A.LK || (A.LK = {})); + var T = function() { + function m() { + this.Mg = 0; + } + return m.prototype.LB = function(_, C) { + this.Mg = C ? this.Mg | _ : this.Mg & ~_; + }, m.prototype.ks = function(_) { + return (this.Mg & _) != 0; + }, m.kg = function(_) { + var C = new m(); + return C.Mg = _.Mg, C; + }, m.prototype.hM = function(_) { + this.Mg = _.Mg; + }, m; + }(); + A.wY = T; + var b = function() { + function m(_, C, D) { + this.ef = _, this.$f = C, this.Wf = new A.l(), this.Wf.L(D), this.vT = _.dc() + C.dc() + this.Wf.dc().toString(); + } + return m.prototype.dc = function() { + return this.vT; + }, m.prototype.Nb = function(_) { + return this == _ || this.ef.Nb(_.ef) && this.$f.Nb(_.$f) && this.Wf.Nb(_.Wf); + }, m; + }(); + A.BY = b, b = function() { + function m() { + this.$f = this.ef = null, this.mH = new H(), this.nH = new T(), this.yw = this.Yf = null, this.ow = this.Vn = !0; + } + return m.Pr = function(_, C, D, L) { + var B; + L === void 0 && (L = null), B === void 0 && (B = null); + var q = new m(); + return q.sp(_, C, D, L, B), q; + }, m.prototype.sp = function(_, C, D, L, B) { + if (_ == null || C == null) + throw A.i.ga("invalidArgument"); + if (this.ef = _, this.$f = C, this.ow = this.Vn = !1, L != null && (this.mH = L.Qf()), B != null && this.nH.hM(B), B = !1, C.Tb() == 1 && L != null && (L = L.Lr, isNaN(L) || L == 0 || (B = !0)), _ == C) + this.Vn = !B, this.ow = !0; + else { + L = _.Tb(); + var q = C.Tb(); + if (L == 0 || q == 0) { + if (D != null) + throw A.i.O(); + _.Id() != null && C.Id() != null && (this.Vn = _.Id().Nb(C.Id())); + } else + L == 3 || q == 3 ? this.Vn = _.Nb(C) : this.ef.fS(this.$f) ? this.Vn = !B : this.Vn = !1, this.Yf = D, this.Yf != null && this.Yf.ix(), this.ow = (this.Yf == null || this.Yf.count() == 0) && this.ef.tc().Nb(this.$f.tc()); + } + this.kY(); + }, m.prototype.isIdentity = function() { + return this.Vn; + }, m.prototype.iR = function() { + return this.mH.Qf(); + }, m.prototype.Nb = function(_) { + return _ == this || !!(_ instanceof m && this.ef.Nb(_.ef) && this.$f.Nb(_.$f)) && (this.Yf == _.Yf || !(this.Yf == null || _.Yf == null || !this.Yf.Nb(_.Yf))); + }, m.prototype.kY = function() { + this.yw = new A.du(this); + }, m; + }(), A.xr = b; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.Ep = function(T) { + return T * H.jW; + }, H.mx = function(T, b) { + return H.bP(b - T); + }, H.cP = function(T) { + return -360 <= T && 720 > T ? (0 > T ? T += 360 : 360 <= T && (T -= 360), T) : (0 > (T = A.mc.MK(T)) && (T += 360), T); + }, H.bP = function(T) { + return 180 < (T = H.cP(T)) && (T -= 360), T; + }, H.jW = 57.29577951308232, H; + }(); + A.sr = ve, A.Jh = function() { + function H() { + } + return H.nj = function(T, b) { + var m = new A.l(); + T.A(m); + var _ = A.cb.ih(b), C = new A.l(); + return C.L(_), C.v = m.v, C.C = m.C, C.X(0.01 * C.da(), 0), b = A.ua.Xd(b, m, !1), C.contains(m) ? T : A.Vd.clip(T, C, b, 0); + }, H.ms = function(T, b, m, _, C) { + if (!A.cb.Xc(b)) + throw A.i.O(); + var D = A.ua.mj(b, T, !1), L = A.cb.ih(b), B = A.cb.tc(b), q = B.Id().ci, Z = A.cb.xv(B); + B = A.cb.gv(B), Z *= 2 - Z; + var ie = new A.Oc(); + L.en(ie); + var se = [[0, 0], [0, 0]]; + if (A.Gg.Tb(b) == 2 ? _ ? (se[0][0] = H.an(C, ie), se[0][1] = L.Lp(), A.cb.wt(), L = se[0][0] * q) : (se[0][0] = L.ik(), se[0][1] = C, A.cb.wt(), L = se[0][1] * q) : L = C * q, !_ && L != 0) + throw A.i.O(); + var de = new A.ha(), Ce = new A.hd(); + T = Ce.Ib(T); + for (var Ve = [0], Je = new A.h(), Pt = new A.h(), $t = new A.h(), qe = new A.h(), Rt = new A.h(), Zt = new A.h(), Jt = Ce.Ob(T); Jt != -1; Jt = Ce.Sb(Jt)) { + var Xt = Ce.Ya(Jt); + Ce.D(Xt, $t); + for (var Qt = !1, bi = Xt = Ce.V(Xt); bi != -1; bi = Ce.V(bi)) { + if (bi == Xt) { + if (Qt) + break; + Qt = !0; + } + if (Ce.D(bi, qe), _ && D < C - $t.x && qe.x - C > D || D < C - qe.x && $t.x - C > D || !_ && D < -$t.y && qe.y > D || D < -qe.y && $t.y > D) + do + if (!(Math.abs($t.x - qe.x) >= 0.5 * ie.S())) { + if (A.Gg.Tb(b) == 2 ? (se[0][0] = H.an($t.x, ie), se[0][1] = $t.y, se[1][0] = H.an(qe.x, ie), se[1][1] = qe.y, A.cb.ZV(), Rt.x = se[0][0] * q, Rt.y = se[0][1] * q, Zt.x = se[1][0] * q, Zt.y = se[1][1] * q) : (Rt.x = $t.x * q, Rt.y = $t.y * q, Zt.x = qe.x * q, Zt.y = qe.y * q), Zt.x = 6.283185307179586 * (qe.x - $t.x) / ie.S() + Rt.x, _) { + if (Pt.x = L, Pt.y = H.Iz(B, Z, Rt, Zt, L, m), isNaN(Pt.y)) + break; + } else { + if (Pt.x = H.Gz(B, Z, Rt, Zt, m), isNaN(Pt.x)) + break; + Pt.y = 0; + } + A.kb.xd(B, Z, Rt.x, Rt.y, Zt.x, Zt.y, de, null, null, m); + var Mi = de.u; + A.kb.xd(B, Z, Rt.x, Rt.y, Pt.x, Pt.y, de, null, null, m); + var Ri = de.u; + A.Gg.Tb(b) == 2 ? (se[0][0] = Pt.x / q, se[0][1] = Pt.y / q, A.cb.XQ(), _ ? (Je.y = se[0][1], Je.x = C) : (Je.x = H.qs(se[0][0], $t.x, qe.x, ie), Je.y = C)) : _ ? (Je.x = C, Je.y = Pt.y / q) : (Je.x = H.qs(Pt.x / q, $t.x, qe.x, ie), Je.y = C), Ve[0] = 0 < Mi ? A.P.Tk(Ri / Mi, 0, 1) : 0.5, Ve[0] != 0 && Ve[0] != 1 && (Mi = Ce.Na(bi), Ce.Wl(Mi, Ve, 1), Ce.Db(Ce.V(Mi), Je.x, Je.y)); + } + while (0); + $t.N(qe); + } + } + return Ce.Ke(T); + }, H.Hn = function(T, b, m, _, C) { + if (T.B()) + return T; + var D = A.cb.bf(b); + return H.Jp(T, m - 180 * D, 360 * D, b, _, C, !0); + }, H.Iz = function(T, b, m, _, C, D) { + if (3.141592653589793 <= Math.abs(m.x - _.x) || !H.Un(m.x, _.x, C)) + return NaN; + if (m.x > _.x) + var L = _; + else + L = m, m = _; + _ = new A.ha(0); + var B = new A.ha(0), q = new A.ha(0); + A.kb.xd(T, b, L.x, L.y, m.x, m.y, B, _, null, D); + var Z = B.u, ie = 0, se = 1, de = new A.h(); + for (de.N(L); Z * (se - ie) > 1e-12 * T; ) { + var Ce = 0.5 * (ie + se); + if (A.kb.qj(T, b, L.x, L.y, Z * Ce, _.u, B, q, D), de.x = B.u, de.y = q.u, de.x == C) + break; + if (H.Un(L.x, de.x, C)) + se = Ce; + else { + if (!H.Un(m.x, de.x, C)) + return NaN; + ie = Ce; + } + } + return de.y; + }, H.Un = function(T, b, m) { + return T = ve.Ep(T), b = ve.mx(T, ve.Ep(b)), (m = ve.mx(T, ve.Ep(m))) == 0 || 0 < b && 0 < m && m <= b || 0 > b && 0 > m && m >= b; + }, H.an = function(T, b) { + var m = b.wa - b.pa; + return b.Kt(T - Math.floor((T - b.pa) / m) * m); + }, H.qs = function(T, b, m, _) { + var C = new A.Oc(); + for (C.L(b, m), m = _.S(), T = Math.floor((T - b) / m) * m + T, C = C.tf(); Math.abs(T - C) > Math.abs(T + m - C); ) + T += m; + return T; + }, H.Gz = function(T, b, m, _, C) { + if (m.y > _.y) + var D = _; + else + D = m, m = _; + if ((_ = new A.Oc()).L(D.y, m.y), !_.contains(0) || 3.141592653589793 <= Math.abs(D.x - m.x)) + return NaN; + if (D.x == m.x) + return D.x; + var L = new A.ha(0), B = new A.ha(0), q = new A.ha(0); + A.kb.xd(T, b, D.x, D.y, m.x, m.y, B, L, null, C); + var Z = B.u, ie = 0, se = 1, de = new A.h(); + for (de.N(D); Z * (se - ie) > 1e-12 * T; ) { + var Ce = 0.5 * (ie + se); + if (A.kb.qj(T, b, D.x, D.y, Z * Ce, L.u, B, q, C), de.x = B.u, de.y = q.u, _.L(D.y, de.y), de.y == 0) + break; + if (_.contains(0)) + se = Ce; + else { + if (_.L(m.y, de.y), !_.contains(0)) + return NaN; + ie = Ce; + } + } + return de.x; + }, H.Jp = function(T, b, m, _, C, D, L) { + var B = new A.l(); + if (T.A(B), B.B()) + return T; + var q = new A.Oc(); + B.en(q); + var Z = new A.Oc(); + if (Z.L(b, b + m), Z.contains(q) && Z.wa != q.wa) + return T; + var ie = new A.l(); + ie.L(B); + var se = T.K(); + if (se == 33) + return ((B = (ie = C ? T : T.Qf()).Ng()) < Z.pa || B >= Z.wa || L && B == Z.wa) && (B += Math.ceil((Z.pa - B) / m) * m, B = Z.Kt(B), ie.YB(B)), ie; + if (se == 550) { + for (_ = (ie = C ? T : T.Qf()).vb(0), se = 2 * ie.I(), T = !1, C = 0; C < se; C += 2) + ((B = _.read(C)) < Z.pa || B >= Z.wa || L && B == Z.wa) && (T = !0, B += Math.ceil((Z.pa - B) / m) * m, B = Z.Kt(B), _.write(C, B)); + return T && ie.Qc(1993), ie; + } + if (Z.contains(q)) + return T; + if (se == 197) + return m = C ? T : T.Qf(), B.Fa(ie), m.Zo(B), m; + var de = 0.1 * Math.max(B.da(), B.S()); + for (ie.X(0, de), L = T, Z = _.Yd(0), T = A.Ih.local(), C = new A.Ed(); ; ) { + var Ce = Math.floor((q.pa - b) / m), Ve = Math.ceil((q.wa - b) / m); + if (!(3 < Ve - Ce)) + break; + Ce = Math.floor(0.5 * (Ve + Ce)), ie.v = B.v - de, ie.C = b + m * Ce; + var Je = A.Vd.clip(L, ie, Z, D); + ie.v = ie.C, ie.C = B.C + de; + var Pt = A.Vd.clip(L, ie, Z, D); + C.ig((Ce - Ve) * m, 0), Pt.Pc(C), se == 1736 ? L = T.W(Je, Pt, _, null) : (L = Je).add(Pt, !1), L.A(B), B.en(q); + } + for (ie.v = b, ie.C = b + m, (b = new A.l()).L(ie), b.X(Z, 0), (b = Math.floor((B.v - ie.v) / m) * m) != 0 ? (ie.move(b, 0), C.ig(-b, 0)) : C.MB(), b = se == 1607 ? new A.Ua(L.description) : new A.Ea(L.description), D = new A.l(), q = new A.l(); B.C > ie.v; ) + (de = A.Vd.clip(L, ie, Z, 0)).A(q), (se == 1607 ? !de.B() && (q.S() > Z || q.da() > Z) : !de.B() && (se != 1736 || q.S() > Z)) && (de.Pc(C), de.A(q), b.A(D), D.X(Z, Z), D.isIntersecting(q) && se == 1736 ? b = T.W(b, de, _, null) : b.add(de, !1)), ie.move(m, 0), C.shift(-m, 0); + return b; + }, H.RI = function(T, b, m, _) { + var C = new A.ee(m.description); + C.Gd(m, 0, -1), C = A.cb.Bh(C, T, b); + var D = m.I(); + if (_.Pa(), !A.cb.Xc(T) || D != C.I()) + return !1; + var L = new A.l(); + m.A(L); + var B = new A.l(); + if (C.A(B), L = L.S(), B = B.S(), L != 0 && B != 0) { + if (B /= L, T = A.cb.ih(b).S() / A.cb.ih(T).S(), 1e-10 < Math.abs(B / T - 1)) + return !1; + } else if (L != 0 || B != 0) + return !1; + for (_.add(m, !1), m = 0; m < D; m++) + T = C.Oa(m), _.Db(m, T); + return !0; + }, H.Jz = function() { + throw A.i.Fe(); + }, H; + }(); + }(le || (le = {})), function(A) { + var ve, H, T; + (H = ve = A.ui || (A.ui = {}))[H.Clip = 0] = "Clip", H[H.DontClip = 1] = "DontClip", H[H.PannableFold = 2] = "PannableFold", function(b) { + b[b.Geodesic = 0] = "Geodesic", b[b.Loxodrome = 1] = "Loxodrome", b[b.GreatElliptic = 2] = "GreatElliptic", b[b.NormalSection = 3] = "NormalSection", b[b.ShapePreserving = 4] = "ShapePreserving"; + }(T = A.RK || (A.RK = {})), A.Ab = function() { + function b() { + } + return b.zv = function(m, _, C) { + if (C || 0 < _) { + for (m = m.toString(A.Tc.PE_STR_NAME_CANON | A.Tc.PE_STR_AUTH_NONE), _ = [], C = 0; C < m.length; C++) + _[C] = "a" <= m[C] && "z" >= m[C] ? _[C] = m[C].toUpperCase() : m[C]; + return _.join(); + } + return m.toString(A.Tc.PE_STR_AUTH_TOP); + }, b.wr = function(m, _, C, D) { + var L = D.length, B = C.I(); + if (B != 0) { + var q = C.vb(0), Z = Math.min(B, L), ie = 0, se = m.gh(); + isNaN(_) && (_ = 0); + for (var de = m.Xc(), Ce = 179 * (m = de ? m.tc().Le().S() : 0) / 360; 0 < B; ) { + if (q.pB(ie << 1, Z, D), A.gj.projToGeogCenter(se, Z, D, _), de) + for (var Ve = 0; Ve < Z; Ve++) { + var Je = D[Ve][0] - _, Pt = A.mc.sign(Je), $t = q.read(2 * (ie + Ve)); + 0 > Pt * A.mc.sign($t) && Math.abs(Je) > Ce && (D[Ve][0] += -Pt * m); + } + q.pC(ie << 1, Z, D), ie += Z, B -= Z, Z = Math.min(B, L); + } + C.Qc(1993); + } + }, b.DL = function(m, _, C, D) { + var L = 0, B = m.gh(); + isNaN(L) && (L = 0); + var q = m.Xc(), Z = m.bf(); + m = 360 * Z, Z *= 179; + for (var ie = D.length, se = 0; se < C; ) { + for (var de = se; de < C && _[de].isNaN(); ++de) + se++; + var Ce = Math.min(ie, C - se); + if (0 < Ce) { + de = 1; + for (var Ve = se + 1; de < Ce; ++de, ++Ve) + if (_[Ve].isNaN()) { + Ce = de; + break; + } + if (A.ua.Ey(D, _, se, Ce), A.gj.projToGeogCenter(B, Ce, D, L), q) + for (de = 0, Ve = se; de < Ce; ++de, ++Ve) { + var Je = _[Ve].x, Pt = D[de][0] - L, $t = A.mc.sign(Pt); + 0 > $t * A.mc.sign(Je) && Math.abs(Pt) > Z && (D[de][0] -= $t * m); + } + A.ua.Dy(_, se, D, Ce), se += Ce; + } + } + }, b.Kx = function(m, _, C) { + var D = C.length, L = _.I(); + if (!(1 > L)) { + var B = _.vb(0), q = Math.min(L, D), Z = 0, ie = m.gh(), se = m.Xc(), de = se ? m.Le().S() : 0, Ce = 179 * de / 360, Ve = 0; + for (se && (Ve = m.Bi()); 0 < L; ) { + if (B.pB(Z << 1, q, C), A.gj.geogToProj(ie, q, C), se) + for (m = 0; m < q; m++) { + var Je = C[m][0], Pt = A.mc.sign(Je), $t = B.read(2 * (Z + m)) - Ve; + 0 > Pt * A.mc.sign($t) && Math.abs(Je) > Ce && (C[m][0] += -Pt * de); + } + B.pC(Z << 1, q, C), Z += q, L -= q, q = Math.min(L, D); + } + _.Qc(1993); + } + }, b.CL = function(m, _, C, D) { + if (C != 0) { + var L = m.gh(), B = m.Xc(), q = B ? m.Le().S() : 0, Z = 179 * q / 360, ie = 0; + for (B && (ie = m.Bi()), m = 0; m < C; ) { + for (var se = m; se < C && _[se].isNaN(); ++se) + m++; + var de = Math.min(D.length, C - m); + if (0 < de) { + se = 1; + for (var Ce = m + 1; se < de; ++se, ++Ce) + if (_[Ce].isNaN()) { + de = se; + break; + } + if (A.ua.Ey(D, _, m, de), A.gj.geogToProj(L, de, D), B) + for (se = 0, Ce = m; se < de; se++) { + var Ve = D[se][0], Je = A.mc.sign(Ve); + 0 > Je * A.mc.sign(_[Ce].x - ie) && Math.abs(Ve) > Z && (D[se][0] -= Je * q); + } + A.ua.Dy(_, m, D, de), m += de; + } + } + } + }, b.vr = function(m, _, C, D) { + var L = _.I(); + if (L != 0) { + var B = _.vb(0), q = m.ef, Z = m.$f, ie = q.tc().Sp(), se = Z.tc().Sp(), de = q.bf(), Ce = Z.bf(); + if ((m = m.Yf) == null || m.count() == 0) { + for (C = ie / se, D = (q.Wp() - Z.Wp()) * Ce, se = -90 * de, m = 90 * de, ie = !1, Ce = 1, q = 2 * L; Ce < q; ) + de = B.get(Ce), (Z = A.P.Tk(de, se, m)) != de && (B.set(Ce, Z), ie = !0), Ce += 2; + if (D != 0 || C != 1) + for (ie = !0, se = new A.h(), Ce = 0; Ce < L; Ce++) + B.uc(2 * Ce, se), se.x *= C, se.x += D, se.y *= C, B.Vt(2 * Ce, se); + ie && _.Qc(1993); + } else { + q = D.length, Z = Math.min(L, q); + var Ve = A.P.mg(Z), Je = null, Pt = 0, $t = NaN, qe = NaN, Rt = 360 * Ce, Zt = Ce / de; + C && (qe = 90 * Ce, $t = 89.9 * de, Je = A.P.mg(Z)); + for (var Jt = !0, Xt = 0; L != 0; ) { + for (de = !1, B.pB(Pt << 1, Z, D), Ce = 0; Ce < Z; Ce++) + Ve[Ce] = D[Ce][0]; + if (C) + for (Ce = 0; Ce < Z; Ce++) { + var Qt = Math.abs(D[Ce][1]) - $t; + 0 < Qt && (de = D[Ce][1], D[Ce][1] = A.mc.En($t, de), Je[Ce] = A.mc.En(Qt, de), de = !0); + } + for (Ce = D[0][0], m.transform(D, Z, ie, se), Jt && (Xt = D[0][0] - Zt * Ce, Jt = !1), Ce = 0; Ce < Z; Ce++) + Qt = D[Ce][0] - Ve[Ce] * Zt - Xt, 200 < Math.abs(Qt) && (D[Ce][0] = 0 < Qt ? D[Ce][0] - Rt : D[Ce][0] + Rt); + if (de) { + for (Ce = 0; Ce < Z; Ce++) + Je[Ce] != 0 && (D[Ce][1] += Zt * Je[Ce], D[Ce][1] > qe ? D[Ce][1] = qe : D[Ce][1] < -qe && (D[Ce][1] = -qe)); + for (de = 0; de < Z; de++) + Je[de] = 0; + } + B.pC(Pt << 1, Z, D), Pt += Z, L -= Z, Z = Math.min(L, q); + } + _.Qc(1993); + } + } + }, b.BL = function(m, _, C, D) { + if (m.ow) + D = 90 * m.ef.bf(), A.ua.ZJ(_, C, -D, D); + else { + var L = m.Yf, B = m.ef, q = m.$f; + m = B.Zr(); + var Z = q.Zr(), ie = B.bf(), se = 90 * ie, de = q.bf(); + if (L == null || L.count() == 0) { + if (D = m / Z, L = (B.Wp() - q.Wp()) * de, A.ua.ZJ(_, C, -se, se), L != 0 || D != 1) + for (de = 0; de < C; de++) + _[de].x *= D, _[de].x += L, _[de].y *= D; + } else { + B = Math.min(C, D.length), se = A.P.mg(B), q = 360 * de, ie = de / ie; + for (var Ce = !0, Ve = 0, Je = 0; C != 0; ) { + for (de = 0; de < B; de++) + se[de] = _[de + Je].x; + for (de = _[0].x, A.ua.Ey(D, _, Je, B), L.transform(D, B, m, Z), A.ua.Dy(_, Je, D, B), Ce && (Ve = _[0].x - ie * de, Ce = !1), de = 0; de < B; de++) { + var Pt = _[Je + de].x - se[de] * ie - Ve; + 200 < Math.abs(Pt) && (_[Je + de].x = 0 < Pt ? _[Je + de].x - q : _[Je + de].x + q); + } + Je += B, C -= B, B = Math.min(C, D.length); + } + } + } + }, b.fv = function(m, _) { + return m = m.ih(), isNaN(_) || m.Lu(_, 0), m; + }, b.PQ = function(m, _, C, D, L, B, q, Z) { + for (var ie = b.fv(D, L), se = ie.S(), de = se / 360, Ce = b.kE * de, Ve = m.vb(0), Je = _.Xc(), Pt = Je ? se / _.Le().S() : 0, $t = !1, qe = new A.Ea(C.description), Rt = 0, Zt = C.ea(); Rt < Zt; ++Rt) { + var Jt = Je, Xt = new A.Ua(C.description); + if (Xt.addPath(C, Rt, !0), q != 0) { + var Qt = b.KD(!0, Xt, ie.H - Z, ie.H, q); + ($t = $t || Qt) && (Jt = !1); + } + var bi = -1; + Jt && (bi = m.Ca(Rt)); + var Mi = Xt.vb(0), Ri = Xt.I(), Yi = 0, rr = Mi.read(0), _i = 0; + Qt = 3 * D.Yd(0); + var fn = !1, jr = new A.h(); + jr.Sc(); + var no = new A.h(); + no.Sc(); + for (var $r = !1, Zn = 1; Zn < Ri; ++Zn) { + var bs = A.h.construct(Mi.gg(2 * Zn), Mi.gg(2 * Zn + 1)), On = bs.x, Jn = On + Yi, ki = Jn - rr; + if (bs.x = Jn, Math.abs(ki) > Ce) { + if (Jt) { + var Ur = bi + (Zn + 1 < Ri ? Zn : 0), So = Ve.read(2 * (bi + Zn - 1)); + Ur = (Ve.read(2 * Ur) - So) * Pt, Math.abs(ki - Ur) > 1 * de && (Jt = !1); + } + Jt || (Jn = On + (Yi -= A.mc.En(se, Jn - rr)), ++_i, $r = Yi != 0, bs.x = Jn); + } else + fn || A.ua.vG(no, jr, bs, Qt) && (fn = !0); + $r && Mi.write(2 * Zn, Jn), rr = Jn, no.N(jr), jr.N(bs); + } + 0 < _i && Xt.Qc(1993), Jt = Xt.Oa(0), Ri = Xt.Oa(Ri - 1), Xt = A.h.ub(Jt, Ri) < Qt ? b.pQ(Xt, D, L, B, fn) : b.qQ(m, Rt, Xt, D, L), qe.add(Xt, !1); + } + return L = D.Yd(0), C = ie.S() / 180, b.Lt(qe, ie, 0.1 * L, !1), qe = qe != (L = A.ti.clip(qe, ie, L, C, B)), m = m.He(), q = 0, 0 < (Z = L.He()) && 0 > m ? q = 1 : 0 >= Z && 0 < m && (Z == 0 ? (Z = NaN, _.Tb() == 2 ? Z = _.ol().He() : _.Tb() == 1 && (Z = _.Le().rF()), m > 0.99 * Z && (q = -1)) : q = -1), q != 0 && ((_ = new A.Ea(L.description)).vp(ie), (_ = A.Zl.local().W(_, C, B)).add(L, !1), qe = !0, L = _), qe && (L = A.$l.local().W(L, D, !1, B)), L; + }, b.qQ = function(m, _, C, D, L) { + var B = C.I(), q = C.Oa(0), Z = C.Oa(B - 1); + L = (D = b.fv(D, L)).S(), q = A.mc.sign(Z.x - q.x); + var ie = new A.l(); + C.yc(ie); + var se = D.ik(); + if (Z = se - L, se += L, 0 <= q) { + var de = Math.ceil((Z - ie.v) / L); + for (de *= L; Z > ie.v + de; ) + de += L; + for (; Z < ie.C + de; ) + de -= L; + var Ce = de; + 720 < ie.S() && (se = Z + 360 * Math.ceil(ie.S() / 360)); + } else { + for (de = Math.ceil((se - ie.C) / L), de *= L; se < ie.C + de; ) + de -= L; + for (; se > ie.v + de; ) + de += L; + Ce = de, 720 < ie.S() && (Z = se - 360 * Math.ceil(ie.S() / 360)); + } + de = q * L; + var Ve = A.l.construct(ie.v, ie.G, ie.C, ie.H); + Ve.move(Ce, 0); + var Je = new A.Ed(); + Je.ig(Ce, 0), C.Pc(Je), (ie = new A.Ua(C.description)).add(C, !1), Ce = C.Oa(B - 1), L = 0; + for (var Pt = ie.Oa(0).x, $t = 0; 0 < q ? Ve.C < se : Ve.v > Z; ) + 1024 <= $t && ($t = 0), Ve.move(de, 0), Je.Lb = de, C.Pc(Je), Pt += de, D.v <= Pt && D.C >= Pt && (L = ie.I() - 1), C.Db(0, Ce), Ce = C.Oa(B - 1), ie.Fr(C, 0, 0, B - 1, !1); + return C = new A.Ea(ie.description), B = 0 < m.Kr(_), C.add(ie, !1), m = ie.Oa(0), Z = ie.Oa(ie.I() - 1), _ = C.ea() - 1, (0 > q ? B : !B) ? (q = A.h.construct(Z.x, D.H), C.Ei(q), q = A.h.construct(D.ik(), D.H), C.Ei(q), D = A.h.construct(m.x, D.H)) : (q = A.h.construct(Z.x, D.G), C.Ei(q), q = A.h.construct(D.ik(), D.G), C.Ei(q), D = A.h.construct(m.x, D.G)), C.Ei(D), C.sG(0, _, 0), C.fO(L), C; + }, b.pQ = function(m, _, C, D, L) { + var B = new A.Ea(m.description); + B.add(m, !1), B.yB(0, B.I() - 1); + var q = new A.l(); + B.yc(q); + var Z = (C = b.fv(_, C)).S(), ie = Math.ceil((C.v - q.v) / Z); + for (ie *= Z; C.v > q.v + ie; ) + ie += Z; + for (; C.v < q.C + ie; ) + ie -= Z; + if ((ie += Z) != 0) { + q.move(ie, 0); + var se = new A.Ed(); + se.ig(ie, 0), B.Pc(se); + } + if (C.v <= q.v && C.C > q.C) + return L && (L = B.He(), _ = (B = A.$l.local().W(B, _, !0, D)).He(), (_ = A.mc.sign(L) != A.mc.sign(_)) && B.jJ()), B; + for ((m = new A.Ea(m.description)).add(B, !1), L = L || q.S() > Z - _.Yd(0); q.v < C.C; ) + q.move(Z, 0), (se = new A.Ed()).ig(Z, 0), B.Pc(se), m.add(B, !1); + return L && (L = m.He(), m.$o(1), _ = (m = A.$l.local().W(m, _, !0, D)).He(), (_ = A.mc.sign(L) != A.mc.sign(_)) && m.jJ()), m; + }, b.KD = function(m, _, C, D, L) { + for (var B = _.vb(0), q = _.I(), Z = !1, ie = 0; ie < q; ie++) { + var se = A.h.construct(B.gg(2 * ie), B.gg(2 * ie + 1)); + if (1 & L && se.y >= C) { + Z = !0; + break; + } + if (2 & L && se.y <= -C) { + Z = !0; + break; + } + } + if (!Z) + return !1; + B = !1, m && (B = _.Pn(0)), q = (m = new A.hd()).Ib(_), Z = m.Ob(q); + var de = -1, Ce = !0, Ve = new A.h(); + Ve.Sc(), ie = new A.Ta(); + for (var Je = -1, Pt = m.Ya(Z); Pt != -1; Pt = m.V(Pt)) { + se = m.Oa(Pt); + var $t = 1 & L && 90 <= se.y ? 1 : 0; + if ($t |= 2 & L && se.y <= -C ? 2 : 0, 0 < de && de != $t) { + if (Ve.x != se.x) { + Ve.x = se.x, m.Xi(m.Na(Pt), ie); + var qe = m.yj(Z, Pt, ie); + m.mf(qe, Ve); + } + if (B) + for (Je = Je != -1 ? m.V(Je) : m.Ya(Z), qe = m.Na(Pt); Je != qe; ) + Je = m.qd(Je, !1); + Je = -1; + } + 0 < $t && (se.y = A.mc.En(D, se.y), m.mf(Pt, se), Ce || de == $t || (se.x != Ve.x ? (m.Xi(Pt, ie), qe = m.yj(Z, Pt, ie), m.Db(qe, Ve.x, se.y), Je = qe) : Je = Pt)), de = $t, Ve = se, Ce = !1; + } + if (B) { + if (Je != -1) + for (Je = m.V(Je); Je != -1; ) + Je = m.qd(Je, !1); + C = m.Ya(Z), m.hq(C, m.tj(Z)) || (m.Xi(C, ie), m.yj(Z, -1, ie)); + } + return m.Ke(q).copyTo(_), !0; + }, b.Hz = function(m, _, C, D) { + var L = m; + if (L.B() || C == ve.DontClip) + return L; + var B = L.K(); + if (B == 33) + return L = [(D = L).D()], b.tG(L, 1, _, C), L[0].isNaN() ? D.Pa() : D.Db(L[0]), m; + var q = (m = _.tc()).bf(), Z = 90 * q, ie = 180 * q, se = 360 * q, de = _.Bi(), Ce = 0.5 * q, Ve = new A.l(); + L.A(Ve); + var Je = _.Xr(), Pt = _.KQ(), $t = Je.K() == 197; + if (_ = new A.l(), Je.A(_), C == ve.PannableFold && (C = m.Le().S(), _.v = de - 0.5 * C, _.C = _.v + C), Ve.G < -Z || Ve.H > Z) { + if (new A.l().L(Ve.v - q, -Z, Ve.C + q, Z), (L = A.ti.Pu(L, _, m, NaN, 0, D)).B()) + return L; + L.A(Ve); + } + if (Pt && (_.H < Ve.G || _.G > Ve.H)) + return L.Ja(); + if (Ve.S() > se && (L = b.Jp(L, de - ie, se, m, !0, 0, !0, D)).A(Ve), (Z = b.$N(Ve.v, Ve.C, _.v, _.C, se)) != 0 && Ve.move(Z, 0), Ve.C > _.C || Ve.v < _.v) { + if (Ve.C > _.C) + for (; Ve.v >= _.C; ) + Ve.move(-se, 0), Z -= se; + for (; Ve.v < _.C - se; ) + Ve.move(se, 0), Z += se; + } + if (C = A.ua.Ju(m, Je), Z != 0 && ((q = new A.Ed()).ig(Z, 0), L.Pc(q)), Pt) { + if ($t && _.contains(Ve)) + return L; + for (Pt = [null, null], Z = 0; 2 > Z; Z++) { + if ($t ? q = A.ba.Ic(B) ? A.ti.clip(L, _, C, Ce, D) : A.ti.clip(L, _, C, 0, D) : (q = A.Zj.local().W(L, Je, m, D)) == Je && (q = A.ba.kg(q)), _.v <= Ve.v && _.C >= Ve.C || _.v >= Ve.v && _.C <= Ve.C) + return q; + Pt[Z] = q, Z == 0 && (Ve.move(-se, 0), (q = new A.Ed()).ig(-se, 0), L.Pc(q)); + } + if (B == 550) + Pt[0].Gd(Pt[1], 0, -1); + else if (A.ba.Ic(B)) + Pt[0].add(Pt[1], !1); + else { + if (B != 33) + throw A.i.ga("intersect_with_GCS_horizon: unexpected geometry type"); + Pt[0].B() && (Pt[0] = Pt[1]); + } + return Pt[0]; + } + if (_.H < Ve.G || _.G > Ve.H) + return L; + for (B = 0; !L.B() && Ve.C > _.v; ) + B != 0 && ((q = new A.Ed()).ig(B, 0), L.Pc(q)), A.fj.local().W(4, L, Je, m, D) || Je == (L = A.mp.local().W(L, Je, m, D)) && (L = A.ba.kg(L)), B != 0 && ((Ce = new A.Ed()).ig(-B, 0), L.Pc(Ce)), B -= se, Ve.move(-se, 0); + return L; + }, b.tG = function(m, _, C, D) { + if (_ != 0 && D != ve.DontClip) + if (D == ve.PannableFold) { + D = C.CR(); + for (var L = _, B = 0; B < _; B++) + (m[B].y > D.H || m[B].y < D.G) && (m[B].Sc(), L--); + L != 0 && b.cv(m, _, D.v, D.S()); + } else { + var q = 90 * (D = C.bf()), Z = 180 * D; + for (D *= 360, L = _, B = 0; B < _; B++) + (m[B].y > q || m[B].y < -q) && (m[B].Sc(), L--); + if (L != 0) { + (L = new A.l()).bx(m, _), q = C.Xr(); + var ie = C.kv(); + B = q.K() == 197; + var se = new A.l(); + if (q.A(se), !ie || !(se.H < L.G || se.G > L.H)) + if (ie) + if (b.cv(m, _, se.ik() - Z, D), L = _, B) + for (B = 0; B < _; B++) + se.contains(m[B]) || (m[B].Sc(), L--); + else + for (C = A.ua.Ju(C.tc(), q), B = 0; B < _; B++) + (Z = A.jd.Zd(q, m[B], C) != 0) || (m[B].Sc(), L--); + else + for (b.cv(m, _, -Z, D), L = _, C = A.ua.Ju(C.tc(), q), B = 0; B < _; B++) + (Z = m[B]).isNaN() && L--, ie = b.oE(Z.x, se.v, se.C, D), Z.x += ie, (Z = A.jd.Zd(q, Z, C) != 0) && (m[B].Sc(), L--); + } + } + }, b.Jp = function(m, _, C, D, L, B, q, Z) { + var ie = m.K(), se = _ + C; + if (ie === 33) { + var de = (D = L ? m : m.Qf()).Ng(); + return (de < _ || de >= se || q && de == se) && (de += Math.ceil((_ - de) / C) * C, de = A.P.Tk(de, _, se), D.YB(de)), D; + } + if (m.B() || (de = new A.l(), m.A(de), de.B())) + return m; + var Ce = new A.Oc(); + de.en(Ce); + var Ve = new A.Oc(); + if (Ve.L(_, se), Ve.contains(Ce)) + return m; + if ((se = new A.l()).L(de), ie === 550) { + for (Z = (D = L ? m : m.Qf()).vb(0), ie = 2 * D.I(), se = !1, _ = 0; _ < ie; _ += 2) + ((de = Z.read(_)) < Ve.pa || de >= Ve.wa || q && de == Ve.wa) && (se = !0, de += Math.ceil((Ve.pa - de) / C) * C, de = Ve.Kt(de), Z.write(_, de)); + return se && D.Qc(1993), D; + } + if (ie == 197) + return C = L ? m : m.Qf(), de.Fa(se), C.Zo(de), C; + var Je = 0.1 * Math.max(de.da(), de.S()); + for (se.X(0, Je), q = m, Ve = D.Yd(0), m = A.Ih.local(), L = new A.Ed(); ; ) { + var Pt = Math.floor((Ce.pa - _) / C), $t = Math.ceil((Ce.wa - _) / C); + if (!(3 < $t - Pt)) + break; + Pt = Math.floor(0.5 * ($t + Pt)), se.v = de.v - Je, se.C = _ + C * Pt; + var qe = A.ti.clip(q, se, Ve, B, Z); + se.v = se.C, se.C = de.C + Je; + var Rt = A.ti.clip(q, se, Ve, B, Z); + L.ig((Pt - $t) * C, 0), Rt.Pc(L), ie == 1736 ? q = m.W(qe, Rt, D, null) : (q = qe).add(Rt, !1), q.A(de), de.en(Ce); + } + for (se.v = _, se.C = _ + C, (_ = new A.l()).L(se), _.X(Ve, 0), (_ = Math.floor((de.v - se.v) / C) * C) != 0 ? (se.move(_, 0), L.ig(-_, 0)) : L.MB(), _ = ie == 1607 ? new A.Ua(q.description) : new A.Ea(q.description), B = new A.l(), Ce = new A.l(); de.C > se.v; ) + (Je = A.ti.clip(q, se, Ve, 0, Z)).A(Ce), (ie == 1607 ? !Je.B() && (Ce.S() > Ve || Ce.da() > Ve) : !Je.B() && (ie != 1736 || Ce.S() > Ve)) && (Je.Pc(L), Je.A(Ce), _.A(B), B.X(Ve, Ve), B.isIntersecting(Ce) && ie == 1736 ? _ = m.W(_, Je, D, null) : _.add(Je, !1)), se.move(C, 0), L.shift(-C, 0); + return _; + }, b.cv = function(m, _, C, D) { + for (var L = C + D, B = 0; B < _; B++) { + var q = m[B].x; + C <= q && q < L || !(q < C || q > L || q == L) || (q += Math.ceil((C - q) / D) * D, q = A.P.Tk(q, C, L), m[B].x = q); + } + }, b.Hn = function(m, _, C, D, L, B) { + if (!_.Xc()) + throw A.i.ga("fold_into_360_degree_range"); + if (m.B()) + return m; + if (_.Tb() == 2) { + C = _.rv(); + var q = _.qv() - C; + } else { + var Z = _.bf(); + q = 360 * Z, C -= 180 * Z; + } + return b.Jp(m, C, q, _, D, L, !0, B); + }, b.lF = function(m, _, C, D) { + if (C.Tb() == 2) + D = C.rv(), C = C.qv() - D; + else { + var L = C.bf(); + C = 360 * L, D -= 180 * L; + } + b.cv(m, _, D, C); + }, b.nj = function(m, _) { + var C = _.Le(); + if (m.K() == 33) { + var D = m.kh(); + return C.G <= D && D <= C.H ? m : m.Ja(); + } + D = new A.l(), m.A(D); + var L = new A.l(); + return L.L(C), L.v = D.v, L.C = D.C, L.X(0.01 * L.da(), 0), C = A.ua.py(_, D), L.contains(D) ? m : A.ti.clip(m, L, C, 0, null); + }, b.kr = function(m, _, C) { + return m > _.C && m - _.C < C ? _.C : m < _.v && _.v - m < C ? _.v : m; + }, b.BX = function(m, _, C, D) { + D.x = b.kr(m.x, _, C), D.y = m.y; + }, b.AX = function(m, _, C, D) { + for (var L = 0; L < _; L++) + m[L].y < C.G || m[L].y > C.H ? m[L].Sc() : m[L].x = b.kr(m[L].x, C, D); + }, b.Lt = function(m, _, C, D) { + if (!m.B()) { + var L = m.K(); + if (!D || L != 1736) + if (A.ba.zj(L)) { + D = m.vb(0), L = 0; + for (var B = m.I(); L < B; L++) { + var q = D.read(2 * L), Z = b.kr(q, _, C); + Z != q && D.write(2 * L, Z); + } + m.Qc(1993); + } else if (L == 197) + D = new A.l(), m.A(D), D.v = b.kr(D.v, _, C), D.C = b.kr(D.C, _, C), m.Zo(D); + else { + if (L != 33) + throw A.i.ga("internal error"); + m.YB(b.kr(m.Ng(), _, C)); + } + } + }, b.pS = function(m, _, C, D) { + var L = new A.hd(), B = L.Ib(m); + return m = A.ua.Ju(_, m), b.ms(L, B, _, m, C, !0, D), L.Ke(B); + }, b.ms = function(m, _, C, D, L, B, q) { + if (!C.Xc()) + throw A.i.O("invalid call"); + var Z = C.Le(), ie = C.tc(), se = ie.gh().getDatum().getSpheroid(); + ie = ie.Id().ci; + var de = se.getFlattening(); + se = se.getAxis(), de *= 2 - de; + var Ce = new A.Oc(); + Z.en(Ce); + var Ve = null, Je = [[0, 0], [0, 0]]; + if (C.Tb() == 2 ? (Ve = C.gh(), B ? (Je[0][0] = b.an(q, Ce), Je[0][1] = Z.Lp(), A.gj.projToGeog(Ve, 1, Je), Z = Je[0][0] * ie) : (Je[0][0] = Z.ik(), Je[0][1] = q, A.gj.projToGeog(Ve, 1, Je), Z = Je[0][1] * ie)) : Z = q * ie, !B && Z != 0 && L != T.GreatElliptic) + throw A.i.ga("invalid argument"); + var Pt = new A.ha(), $t = [0], qe = new A.h(), Rt = new A.h(), Zt = new A.h(), Jt = [null, null], Xt = new A.h(), Qt = new A.h(), bi = new A.h(), Mi = new A.h(); + for (_ = m.Ob(_); _ != -1; _ = m.Sb(_)) { + var Ri = m.Ya(_); + m.D(Ri, Xt); + for (var Yi = !1, rr = Ri = m.V(Ri); rr != -1; rr = m.V(rr)) { + if (rr == Ri) { + if (Yi) + break; + Yi = !0; + } + if (m.D(rr, Qt), B && (D < q - Xt.x && Qt.x - q > D || D < q - Qt.x && Xt.x - q > D) || !B && (q != 0 || D < -Xt.y && Qt.y > D || D < -Qt.y && Xt.y > D)) + do + if (!(Math.abs(Xt.x - Qt.x) >= 0.5 * Ce.S())) { + if (C.Tb() == 2 ? (Je[0][0] = b.an(Xt.x, Ce), Je[0][1] = Xt.y, Je[1][0] = b.an(Qt.x, Ce), Je[1][1] = Qt.y, A.gj.projToGeogCenter(Ve, 2, Je, 0), bi.x = Je[0][0] * ie, bi.y = Je[0][1] * ie, Mi.y = Je[1][1] * ie) : (bi.x = Xt.x * ie, bi.y = Xt.y * ie, Mi.y = Qt.y * ie), Mi.x = 2 * (Qt.x - Xt.x) * Math.PI / Ce.S() + bi.x, B) { + if (Rt.x = Z, Rt.y = b.Iz(se, de, bi, Mi, Z, L), isNaN(Rt.y)) + break; + Jt[0] = Rt; + var _i = 1; + } else if (L == T.GreatElliptic) { + var fn = [0, 0]; + if ((_i = A.Nx.Jz(de, bi, Mi, Z, fn)) == 0) + break; + Rt.x = fn[0], Rt.y = Z, Jt[0] = Rt, _i == 2 && (Zt.x = fn[1], Zt.y = Z, Jt[1] = Zt); + } else { + if (Rt.x = b.Gz(se, de, bi, Mi, L), isNaN(Rt.x)) + break; + Rt.y = 0, Jt[0] = Rt, _i = 1; + } + var jr = -1; + for (fn = 0; fn < _i; fn++) { + A.kb.xd(se, de, bi.x, bi.y, Mi.x, Mi.y, Pt, null, null, L); + var no = Pt.u; + A.kb.xd(se, de, bi.x, bi.y, Jt[fn].x, Jt[fn].y, Pt, null, null, L); + var $r = Pt.u; + if (C.Tb() == 2 ? (Je[0][0] = Jt[fn].x / ie, Je[0][1] = Jt[fn].y / ie, A.gj.geogToProj(Ve, 1, Je), B ? (qe.y = Je[0][1], qe.x = q) : (qe.x = b.qs(Je[0][0], Xt.x, Qt.x, Ce), qe.y = q)) : B ? (qe.x = q, qe.y = Jt[fn].y / ie) : (qe.x = b.qs(Jt[fn].x / ie, Xt.x, Qt.x, Ce), qe.y = q), $t[0] = 0 < no ? A.P.Tk($r / no, 0, 1) : 0.5, $t[0] == 0 || $t[0] == 1) + break; + jr > $t[0] || (jr = m.Na(rr), m.Wl(jr, $t, 1), m.Db(m.V(jr), qe.x, qe.y), jr = $t[0]); + } + } + while (0); + Xt.N(Qt); + } + } + }, b.an = function(m, _) { + var C = _.wa - _.pa; + return _.Kt(m - Math.floor((m - _.pa) / C) * C); + }, b.qs = function(m, _, C, D) { + var L = new A.Oc(); + for (L.L(_, C), C = D.S(), m = Math.floor((m - _) / C) * C + m, L = L.tf(); Math.abs(m - L) > Math.abs(m + C - L); ) + m += C; + return m; + }, b.Un = function(m, _, C) { + return m = A.sr.Ep(m), _ = A.sr.mx(m, A.sr.Ep(_)), (C = A.sr.mx(m, A.sr.Ep(C))) == 0 || 0 < _ && 0 < C && C <= _ || 0 > _ && 0 > C && C >= _; + }, b.Iz = function(m, _, C, D, L, B) { + if (B == T.GreatElliptic) + return A.Nx.NS(_, C, D, L); + if (Math.abs(C.x - D.x) >= Math.PI || !b.Un(C.x, D.x, L)) + return NaN; + if (C.x > D.x) + var q = D; + else + q = C, C = D; + D = new A.ha(); + var Z = new A.ha(), ie = new A.ha(); + A.kb.xd(m, _, q.x, q.y, C.x, C.y, Z, D, null, B); + var se = Z.u, de = 0, Ce = 1, Ve = new A.h(); + for (Ve.N(q); se * (Ce - de) > 1e-12 * m; ) { + var Je = 0.5 * (de + Ce); + if (A.kb.qj(m, _, q.x, q.y, se * Je, D.u, Z, ie, B), Ve.x = Z.u, Ve.y = ie.u, Ve.x == L) + break; + if (b.Un(q.x, Ve.x, L)) + Ce = Je; + else { + if (!b.Un(C.x, Ve.x, L)) + return NaN; + de = Je; + } + } + return Ve.y; + }, b.Gz = function(m, _, C, D, L) { + if (L == T.GreatElliptic) + return m = [0, 0], A.Nx.Jz(_, C, D, 0, m), m[0]; + if (C.y > D.y) + var B = D; + else + B = C, C = D; + if ((D = new A.Oc()).L(B.y, C.y), !D.contains(0) || Math.abs(B.x - C.x) >= Math.PI) + return NaN; + if (B.x == C.x) + return B.x; + var q = new A.ha(), Z = new A.ha(), ie = new A.ha(); + A.kb.xd(m, _, B.x, B.y, C.x, C.y, Z, q, null, L); + var se = Z.u, de = 0, Ce = 1, Ve = new A.h(); + for (Ve.N(B); se * (Ce - de) > 1e-12 * m; ) { + var Je = 0.5 * (de + Ce); + if (A.kb.qj(m, _, B.x, B.y, se * Je, q.u, Z, ie, L), Ve.x = Z.u, Ve.y = ie.u, D.L(B.y, Ve.y), Ve.y == 0) + break; + if (D.contains(0)) + Ce = Je; + else { + if (D.L(C.y, Ve.y), !D.contains(0)) + return NaN; + de = Je; + } + } + return Ve.x; + }, b.RI = function(m, _, C, D) { + if (!m.ef.Xc()) + return !1; + var L = new A.ee(_.description); + if (L.Gd(_, 0, -1), D = A.Gx.local().W(L, m, D), L = _.I(), C.Pa(), L != D.I()) + return !1; + var B = new A.l(); + _.A(B); + var q = new A.l(); + if (D.A(q), B = B.S(), q = q.S(), B != 0 && q != 0) { + if (q /= B, m = m.$f.ih().S() / m.ef.ih().S(), 1e-10 < Math.abs(q / m - 1)) + return !1; + } else if (B != 0 || q != 0) + return !1; + for (C.add(_, !1), _ = new A.h(), m = 0; m < L; m++) + D.D(m, _), C.Db(m, _); + return !0; + }, b.lN = function(m, _) { + return (m %= 360 * _) >= 180 * _ && (m -= 360 * _), m; + }, b.OI = function(m, _, C, D) { + if (C == ve.Clip) { + var L = _.ol(); + L.K() == 197 ? (C = new A.l(), L.A(C), L = A.ua.py(_, C), m = A.ti.clip(m, C, L, 5e4 * _.rm(), D)) : A.fj.local().W(1, L, m, _, D) || (m = A.Zj.local().W(m, L, _, D)) == L && (m = A.Xk.kg(m)); + } else + _.Xc() && (D = new A.l(), m.yc(D), _.Le().contains(D) || (b.Lt(m, _.Le(), _.Yd(0), !0), C == ve.PannableFold && (m = b.nj(m, _)), m = b.Hn(m, _, 0, !0, 1e5 * _.rm(), null))); + return m; + }, b.SD = function(m, _, C) { + var D = _.Yr(); + if (D == null) + return m; + var L = (_ = _.tc()).Le().S(), B = new A.l(); + m.yc(B); + var q = new A.Oc(); + B.en(q), B = D.Ha(), D = null; + for (var Z = new A.Ed(); B.ab(); ) + for (; B.Ia(); ) { + var ie = B.ia(), se = ie.Vg(0, 0), de = new A.Oc(); + for (de.L(se.pa, se.wa), se = 0; de.wa > q.pa; ) + de.move(-L), --se; + for (; de.pa <= q.wa; ) { + if (de.isIntersecting(q)) { + D == null && (D = new A.Ua()); + var Ce = A.zb.YO(ie.bc(), ie.xc()); + se != 0 && (Z.ig(se * L, 0), Ce.Pc(Z)), D.pc(Ce, !0); + } + de.move(L), ++se; + } + } + return D != null ? (_ = A.ua.bO(_, D), _ = A.ua.Gr(_), A.bu.gP(m, D, _, C)) : m; + }, b.$N = function(m, _, C, D, L) { + return m >= C && _ <= D ? 0 : b.oE(0.5 * (_ + m), C, D, L); + }, b.oE = function(m, _, C, D) { + return A.mc.round((0.5 * (C + _) - m) / D) * D; + }, b.QQ = function(m, _, C, D, L, B, q, Z) { + var ie = b.fv(D, L), se = ie.S(), de = se / 360, Ce = b.kE * de, Ve = m.vb(0), Je = _.Xc(), Pt = Je ? se / _.Le().S() : 0; + _ = m.Ja(); + for (var $t = 0, qe = C.ea(); $t < qe; ++$t) { + var Rt = Je, Zt = new A.Ua(C.description); + Zt.addPath(C, $t, !0); + var Jt = C.ec($t); + q != 0 && (Jt = b.KD(Jt, Zt, ie.H - Z, ie.H, q)) && (Rt = !1); + var Xt = -1; + Jt = Zt.I(); + var Qt = !1; + Rt && (Xt = m.Ca($t), Qt = m.ec($t)); + var bi = Zt.vb(0), Mi = 0, Ri = bi.read(0), Yi = 0, rr = 3 * D.Yd(0), _i = !1, fn = new A.h(); + fn.Sc(); + var jr = new A.h(); + jr.Sc(); + for (var no = !1, $r = 1; $r < Jt; ++$r) { + var Zn = A.h.construct(bi.gg(2 * $r), bi.gg(2 * $r + 1)), bs = Zn.x, On = bs + Mi, Jn = On - Ri; + if (Zn.x = On, Math.abs(Jn) > Ce) { + if (Rt) { + var ki = Xt + $r - 1, Ur = Xt; + (!Qt || $r + 1 < Jt) && (Ur += $r), ki = Ve.read(2 * ki), Ur = (Ve.read(2 * Ur) - ki) * Pt, Math.abs(Jn - Ur) > 1 * de && (Je = !1); + } + Rt || (On = bs + (Mi -= A.mc.En(se, On - Ri)), ++Yi, no = Mi != 0, Zn.x = On); + } else + _i || A.ua.vG(fn, jr, Zn, rr) && (_i = !0); + no && bi.write(2 * $r, On), Ri = On, fn.N(jr), jr.N(Zn); + } + Yi != 0 && Zt.Qc(1993), Rt = Zt.Oa(0), Jt = Zt.Oa(Jt - 1), A.h.ub(Rt, Jt), Zt = b.rQ(Zt, D, isNaN(L) ? 0 : L, B), _.add(Zt, !1); + } + return m = D.Yd(0), C = ie.S() / 180, b.Lt(_, ie, 0.1 * m, !1), A.ti.clip(_, ie, m, C, B); + }, b.rQ = function(m, _, C, D) { + return b.Hn(m, _, C, !0, 0, D); + }, b.JS = function(m, _, C, D) { + var L = m.K(); + if (L == 1736) + for (_ = _ != null ? _.Yd(0) : 0, L = 0; L < D; L++) + A.jd.Zd(m, C[L], _) != 1 && C[L].Sc(); + else { + if (L != 197) + throw A.i.O(); + for (L = 0; L < D; L++) + m.ZO(C[L]) || C[L].Sc(); + } + }, b.bl = function(m, _, C, D) { + if (32 > C) + for (var L = new A.Ta(), B = 0; B < C; B++) + L.Db(_[B]), m.bl(L, D).D(_[B]); + else { + var q = new A.ee(); + for (q.se(3), q.CD(_, C), L = q.vb(3), B = 0; B < C; B++) + L.write(B, B); + for (B = m.bl(q, D), m = B.vb(0), L = B.vb(3), D = A.h.construct(NaN, NaN), q = 0; q < C; q++) + _[q] = D; + for (C = B.I(), B = 0; B < C; B++) + D = L.read(B), m.uc(2 * B, _[D]); + } + }, b.al = function(m, _, C, D) { + if (32 > C) + for (var L = new A.Ta(), B = 0; B < C; B++) + L.Db(_[B]), m.al(L, D).D(_[B]); + else { + var q = new A.ee(); + for (q.se(3), q.CD(_, C), L = q.vb(3), B = 0; B < C; B++) + L.write(B, B); + for (B = m.al(q, D), m = B.vb(0), L = B.vb(3), D = A.h.construct(NaN, NaN), q = 0; q < C; q++) + _[q] = D; + for (C = B.I(), B = 0; B < C; B++) + D = L.read(B), m.uc(2 * B, _[D]); + } + }, b.kE = 210, b; + }(); + }(le || (le = {})), function(A) { + var ve; + (ve = A.PL || (A.PL = {}))[ve.rightSide = 1] = "rightSide"; + var H = function() { + function T(b, m, _) { + this.Ds = new A.h(), b === void 0 ? this.Ko = -1 : (this.Ds.N(b), this.Ko = m, this.La = _, this.pw = 0); + } + return T.prototype.RJ = function(b) { + this.pw = b ? 1 | this.pw : -2 & this.pw; + }, T.prototype.B = function() { + return 0 > this.Ko; + }, T.prototype.az = function() { + if (this.B()) + throw A.i.ga("invalid call"); + return new A.Ta(this.Ds.x, this.Ds.y); + }, T.prototype.Va = function() { + if (this.B()) + throw A.i.ga("invalid call"); + return this.Ko; + }, T.prototype.cz = function() { + if (this.B()) + throw A.i.ga("invalid call"); + return this.La; + }, T.prototype.Nz = function() { + return (1 & this.pw) != 0; + }, T.prototype.by = function(b, m, _, C) { + this.Ds.x = b, this.Ds.y = m, this.Ko = _, this.La = C; + }, T; + }(); + A.bm = H; + }(le || (le = {})), function(A) { + var ve = function() { + function T() { + } + return T.prototype.Wo = function(b, m) { + this.vh.resize(0), this.Ki.length = 0, this.vk = -1, b.yc(this.Gk), this.Gk.X(m, m), this.Gk.isIntersecting(this.Gb.Da) ? ((this.xs = A.ba.zd(b.K())) ? (this.OH = b.bc(), this.NH = b.xc(), this.ra = m) : this.ra = NaN, this.vh.add(this.Gb.kf), this.Ki.push(this.Gb.Da), this.Ss = this.Gb.Wr(this.Gb.kf)) : this.Ss = -1; + }, T.prototype.Zi = function(b, m) { + this.vh.resize(0), this.Ki.length = 0, this.vk = -1, this.Gk.L(b), this.Gk.X(m, m), this.ra = NaN, this.Gk.isIntersecting(this.Gb.Da) ? (this.vh.add(this.Gb.kf), this.Ki.push(this.Gb.Da), this.Ss = this.Gb.Wr(this.Gb.kf), this.xs = !1) : this.Ss = -1; + }, T.prototype.next = function() { + if (this.vh.size == 0) + return -1; + this.vk = this.Ss; + var b = null, m = null, _ = null, C = null; + this.xs && (b = new A.h(), m = new A.h(), _ = new A.l()); + for (var D = !1; !D; ) { + for (; this.vk != -1; ) { + var L = this.Gb.Xy(this.Gb.hv(this.vk)); + if (L.isIntersecting(this.Gk)) { + if (!this.xs) { + D = !0; + break; + } + if (b.N(this.OH), m.N(this.NH), _.L(L), _.X(this.ra, this.ra), 0 < _.uy(b, m)) { + D = !0; + break; + } + } + this.vk = this.Gb.pv(this.vk); + } + if (this.vk == -1) { + L = this.vh.Gc(); + var B = this.Ki[this.Ki.length - 1]; + for (C == null && ((C = [])[0] = new A.l(), C[1] = new A.l(), C[2] = new A.l(), C[3] = new A.l()), H.zJ(B, C), this.vh.Jf(), --this.Ki.length, B = 0; 4 > B; B++) { + var q = this.Gb.Np(L, B); + if (q != -1 && 0 < this.Gb.RR(q) && C[B].isIntersecting(this.Gk)) + if (this.xs) { + if (b.N(this.OH), m.N(this.NH), _.L(C[B]), _.X(this.ra, this.ra), 0 < _.uy(b, m)) { + var Z = new A.l(); + Z.L(C[B]), this.vh.add(q), this.Ki.push(Z); + } + } else + (Z = new A.l()).L(C[B]), this.vh.add(q), this.Ki.push(Z); + } + if (this.vh.size == 0) + return -1; + this.vk = this.Gb.Wr(this.vh.get(this.vh.size - 1)); + } + } + return this.Ss = this.Gb.pv(this.vk), this.vk; + }, T.XO = function(b, m, _) { + var C = new T(); + return C.Gb = b, C.Gk = new A.l(), C.vh = new A.ja(0), C.Ki = [], C.Wo(m, _), C; + }, T.WO = function(b, m, _) { + var C = new T(); + return C.Gb = b, C.Gk = new A.l(), C.vh = new A.ja(0), C.Ki = [], C.Zi(m, _), C; + }, T.VO = function(b) { + var m = new T(); + return m.Gb = b, m.Gk = new A.l(), m.vh = new A.ja(0), m.Ki = [], m; + }, T; + }(); + A.CY = ve; + var H = function() { + function T(b, m) { + this.jf = new A.ad(11), this.ai = new A.ad(5), this.ys = [], this.iw = new A.ja(0), this.Da = new A.l(), this.Pk(b, m); + } + return T.prototype.reset = function(b, m) { + this.jf.oj(!1), this.ai.oj(!1), this.ys.length = 0, this.iw.clear(!1), this.Pk(b, m); + }, T.prototype.xj = function(b, m) { + return this.Bv(b, m, 0, this.Da, this.kf, !1, -1); + }, T.prototype.Ez = function(b, m, _) { + _ = _ == -1 ? this.kf : this.RF(_); + var C = this.da(_), D = this.jR(_); + return this.Bv(b, m, C, D, _, !1, -1); + }, T.prototype.ka = function(b) { + return this.eR(b); + }, T.prototype.BF = function(b) { + return this.Xy(this.hv(b)); + }, T.prototype.da = function(b) { + return this.lv(b); + }, T.prototype.jR = function(b) { + var m = new A.l(); + m.L(this.Da); + var _ = this.lv(b); + b = this.LF(b); + for (var C = 0; C < 2 * _; C += 2) { + var D = A.P.truncate(3 & b >> C); + D == 0 ? (m.v = 0.5 * (m.v + m.C), m.G = 0.5 * (m.G + m.H)) : D == 1 ? (m.C = 0.5 * (m.v + m.C), m.G = 0.5 * (m.G + m.H)) : (D == 2 ? m.C = 0.5 * (m.v + m.C) : m.v = 0.5 * (m.v + m.C), m.H = 0.5 * (m.G + m.H)); + } + return m; + }, T.prototype.RR = function(b) { + return this.vz(b); + }, T.prototype.qR = function(b, m) { + return ve.XO(this, b, m); + }, T.prototype.HF = function(b, m) { + return ve.WO(this, b, m); + }, T.prototype.getIterator = function() { + return ve.VO(this); + }, T.prototype.Pk = function(b, m) { + if (0 > m || 32 < 2 * m) + throw A.i.O("invalid height"); + this.wT = m, this.Da.L(b), this.kf = this.jf.De(), this.jx(this.kf, 0), this.dx(this.kf, 0), this.IJ(this.kf, 0), this.FJ(this.kf, 0); + }, T.prototype.Bv = function(b, m, _, C, D, L, B) { + if (!C.contains(m)) + return _ == 0 ? -1 : this.Bv(b, m, 0, this.Da, this.kf, L, B); + if (!L) + for (var q = D; q != -1; q = this.DR(q)) + this.jx(q, this.vz(q) + 1); + (q = new A.l()).L(C), C = D; + var Z = []; + for (Z[0] = new A.l(), Z[1] = new A.l(), Z[2] = new A.l(), Z[3] = new A.l(); _ < this.wT && this.dO(C); _++) { + T.zJ(q, Z); + for (var ie = !1, se = 0; 4 > se; se++) + if (Z[se].contains(m)) { + ie = !0; + var de = this.Np(C, se); + de == -1 && (de = this.mP(C, se)), this.jx(de, this.vz(de) + 1), C = de, q.L(Z[se]); + break; + } + if (!ie) + break; + } + return this.nS(b, m, _, q, C, L, D, B); + }, T.prototype.nS = function(b, m, _, C, D, L, B, q) { + var Z = this.IF(D); + if (L) { + if (D == B) + return q; + this.NP(q), L = q; + } else + L = this.oP(), this.IB(L, b), this.FW(this.hv(L), m); + return this.hX(L, D), Z != -1 ? (this.hx(L, Z), this.ex(Z, L)) : this.BJ(D, L), this.NB(D, L), this.dx(D, this.nv(D) + 1), this.cO(D) && this.HQ(_, C, D), L; + }, T.prototype.NP = function(b) { + var m = this.RF(b), _ = this.IF(m), C = this.JR(b), D = this.pv(b); + this.Wr(m) == b ? (D != -1 ? this.hx(D, -1) : this.NB(m, -1), this.BJ(m, D)) : _ == b ? (this.ex(C, -1), this.NB(m, C)) : (this.hx(D, C), this.ex(C, D)), this.hx(b, -1), this.ex(b, -1), this.dx(m, this.nv(m) - 1); + }, T.zJ = function(b, m) { + var _ = 0.5 * (b.v + b.C), C = 0.5 * (b.G + b.H); + m[0].L(_, C, b.C, b.H), m[1].L(b.v, C, _, b.H), m[2].L(b.v, b.G, _, C), m[3].L(_, b.G, b.C, C); + }, T.prototype.cO = function(b) { + return this.nv(b) == 8 && !this.bG(b); + }, T.prototype.HQ = function(b, m, _) { + var C = this.Wr(_); + do { + var D = this.hv(C), L = this.ai.U(C, 0); + D = this.Xy(D), this.Bv(L, D, b, m, _, !0, C), C = L = this.pv(C); + } while (C != -1); + }, T.prototype.dO = function(b) { + return 8 <= this.nv(b) || this.bG(b); + }, T.prototype.bG = function(b) { + return this.Np(b, 0) != -1 || this.Np(b, 1) != -1 || this.Np(b, 2) != -1 || this.Np(b, 3) != -1; + }, T.prototype.mP = function(b, m) { + var _ = this.jf.De(); + return this.JW(b, m, _), this.jx(_, 0), this.dx(_, 0), this.Rk(_, b), this.FJ(_, this.lv(b) + 1), this.IJ(_, m << 2 * this.lv(b) | this.LF(b)), _; + }, T.prototype.oP = function() { + var b = this.ai.De(); + if (0 < this.iw.size) { + var m = this.iw.Gc(); + this.iw.Jf(); + } else + m = this.ys.length, this.ys.push(new A.l()); + return this.GW(b, m), b; + }, T.prototype.Np = function(b, m) { + return this.jf.U(b, m); + }, T.prototype.JW = function(b, m, _) { + this.jf.T(b, m, _); + }, T.prototype.Wr = function(b) { + return this.jf.U(b, 4); + }, T.prototype.BJ = function(b, m) { + this.jf.T(b, 4, m); + }, T.prototype.IF = function(b) { + return this.jf.U(b, 5); + }, T.prototype.NB = function(b, m) { + this.jf.T(b, 5, m); + }, T.prototype.LF = function(b) { + return this.jf.U(b, 6); + }, T.prototype.IJ = function(b, m) { + this.jf.T(b, 6, m); + }, T.prototype.nv = function(b) { + return this.jf.U(b, 7); + }, T.prototype.vz = function(b) { + return this.jf.U(b, 8); + }, T.prototype.dx = function(b, m) { + this.jf.T(b, 7, m); + }, T.prototype.jx = function(b, m) { + this.jf.T(b, 8, m); + }, T.prototype.DR = function(b) { + return this.jf.U(b, 9); + }, T.prototype.Rk = function(b, m) { + this.jf.T(b, 9, m); + }, T.prototype.lv = function(b) { + return this.jf.U(b, 10); + }, T.prototype.FJ = function(b, m) { + this.jf.T(b, 10, m); + }, T.prototype.eR = function(b) { + return this.ai.U(b, 0); + }, T.prototype.IB = function(b, m) { + this.ai.T(b, 0, m); + }, T.prototype.JR = function(b) { + return this.ai.U(b, 1); + }, T.prototype.pv = function(b) { + return this.ai.U(b, 2); + }, T.prototype.hx = function(b, m) { + this.ai.T(b, 1, m); + }, T.prototype.ex = function(b, m) { + this.ai.T(b, 2, m); + }, T.prototype.RF = function(b) { + return this.ai.U(b, 3); + }, T.prototype.hX = function(b, m) { + this.ai.T(b, 3, m); + }, T.prototype.hv = function(b) { + return this.ai.U(b, 4); + }, T.prototype.GW = function(b, m) { + this.ai.T(b, 4, m); + }, T.prototype.Xy = function(b) { + return this.ys[b]; + }, T.prototype.FW = function(b, m) { + this.ys[b].L(m); + }, T; + }(); + A.fu = H; + }(le || (le = {})), function(A) { + var ve; + (ve = A.WK || (A.WK = {}))[ve.Outside = 0] = "Outside", ve[ve.Inside = 1] = "Inside", ve[ve.Border = 2] = "Border"; + var H = function() { + function b(m, _) { + this.KT = _, this.Xh = m; + } + return b.prototype.ax = function(m, _) { + this.dH != _ && m.flush(), this.dH = _; + }, b.prototype.bF = function(m, _) { + for (var C = 0; C < _; ) + for (var D = m[C++], L = m[C++], B = m[C++] * this.KT; D < L; D++) + this.Xh[B + (D >> 4)] |= this.dH << 2 * (15 & D); + }, b; + }(); + A.DY = H; + var T = function() { + function b(m, _, C) { + this.Xh = null, this.NA = this.Kk = this.YH = this.WH = this.Gs = this.lH = this.Hf = this.Wm = 0, this.Ti = this.Lk = this.xl = null, this.Az(m, _, C); + } + return b.create = function(m, _, C) { + if (!b.uE(m)) + throw A.i.O(); + return b.rP(m, _, C); + }, b.kW = function(m) { + switch (m) { + case 0: + m = 1024; + break; + case 1: + m = 16384; + break; + case 2: + m = 262144; + break; + default: + throw A.i.ga("Internal Error"); + } + return m; + }, b.uE = function(m) { + return !(m.B() || m.K() != 1607 && m.K() != 1736); + }, b.prototype.mQ = function(m, _) { + _ = _.Ha(); + for (var C = new A.h(), D = new A.h(); _.ab(); ) + for (; _.Ia(); ) { + var L = _.ia(); + if (L.K() != 322) + throw A.i.ga("Internal Error"); + m.Gh(L.bc(), C), m.Gh(L.xc(), D), this.Ti.fy(C.x, C.y, D.x, D.y); + } + this.Ti.dJ(A.Ox.Bx); + }, b.prototype.nQ = function() { + throw A.i.ga("Internal Error"); + }, b.prototype.My = function(m, _) { + for (var C = 1; 4 > C; C++) + m.fy(_[C - 1].x, _[C - 1].y, _[C].x, _[C].y); + m.fy(_[3].x, _[3].y, _[0].x, _[0].y), this.Ti.dJ(A.Ox.Bx); + }, b.prototype.mK = function(m, _, C) { + for (var D = [null, null, null, null], L = 0; L < D.length; L++) + D[L] = new A.h(); + _ = _.Ha(), C = this.Lk.$X(C) + 1.5, L = new A.h(); + for (var B = new A.h(), q = new A.h(), Z = new A.h(), ie = new A.h(), se = new A.l(), de = new A.h(); _.ab(); ) { + var Ce = !1, Ve = !0; + for (de.na(0, 0); _.Ia(); ) { + var Je = _.ia(); + if (Z.x = Je.ta, Z.y = Je.oa, ie.x = Je.qa, ie.y = Je.ma, se.Pa(), se.$b(Z.x, Z.y), se.Nk(ie.x, ie.y), this.xl.CG(se)) { + this.Lk.Gh(ie, ie), Ve ? (this.Lk.Gh(Z, Z), de.N(Z), Ve = !1) : Z.N(de), L.vc(ie, Z); + var Pt = 0.5 > (Je = L.length()); + Je == 0 ? L.na(1, 0) : (Pt || de.N(ie), L.scale(C / Je), B.na(-L.y, L.x), q.na(L.y, -L.x), Z.sub(L), ie.add(L), D[0].add(Z, B), D[1].add(Z, q), D[2].add(ie, q), D[3].add(ie, B), Pt ? Ce = !0 : this.My(m, D)); + } else + Ce && (this.My(m, D), Ce = !1), Ve = !0; + } + Ce && this.My(m, D); + } + }, b.prototype.nC = function(m) { + return A.P.truncate(m * this.lH + this.WH); + }, b.prototype.oC = function(m) { + return A.P.truncate(m * this.Gs + this.YH); + }, b.rP = function(m, _, C) { + return new b(m, _, C); + }, b.prototype.Az = function(m, _, C) { + this.Hf = Math.max(A.P.truncate(2 * Math.sqrt(C) + 0.5), 64), this.Wm = A.P.truncate((2 * this.Hf + 31) / 32), this.xl = new A.l(), this.Kk = _, C = 0; + for (var D = this.Hf, L = this.Wm; 8 <= D; ) + C += D * L, D = A.P.truncate(D / 2), L = A.P.truncate((2 * D + 31) / 32); + this.Xh = A.P.mg(C, 0), this.Ti = new A.Ox(), C = new H(this.Xh, this.Wm, this), this.Ti.wX(this.Hf, this.Hf, C), m.A(this.xl), this.xl.X(_, _), D = new A.l(); + var B = _ * (L = A.l.construct(1, 1, this.Hf - 2, this.Hf - 2)).S(); + switch (_ *= L.da(), D.L(this.xl.tf(), Math.max(B, this.xl.S()), Math.max(_, this.xl.da())), this.NA = this.Kk, this.Lk = new A.Ed(), this.Lk.kS(D, L), new A.Ed(), m.K()) { + case 550: + C.ax(this.Ti, 2), this.nQ(); + break; + case 1607: + C.ax(this.Ti, 2), this.mK(this.Ti, m, this.NA); + break; + case 1736: + C.ax(this.Ti, 1), this.mQ(this.Lk, m), C.ax(this.Ti, 2), this.mK(this.Ti, m, this.NA); + } + this.lH = this.Lk.eb, this.Gs = this.Lk.bb, this.WH = this.Lk.Lb, this.YH = this.Lk.Qb, this.SN(); + }, b.prototype.SN = function() { + this.Ti.flush(); + for (var m = 0, _ = this.Hf * this.Wm, C = this.Hf, D = A.P.truncate(this.Hf / 2), L = this.Wm, B = A.P.truncate((2 * D + 31) / 32); 8 < C; ) { + for (C = 0; C < D; C++) + for (var q = 2 * C, Z = 2 * C + 1, ie = 0; ie < D; ie++) { + var se = 2 * ie, de = 2 * ie + 1, Ce = se >> 4; + se = 2 * (15 & se); + var Ve = de >> 4; + de = 2 * (15 & de); + var Je = this.Xh[m + L * q + Ce] >> se & 3; + Je |= this.Xh[m + L * q + Ve] >> de & 3, Je |= this.Xh[m + L * Z + Ce] >> se & 3, Je |= this.Xh[m + L * Z + Ve] >> de & 3, this.Xh[_ + B * C + (ie >> 4)] |= Je << 2 * (15 & ie); + } + C = D, L = B, m = _, D = A.P.truncate(C / 2), B = A.P.truncate((2 * D + 31) / 32), _ = m + L * C; + } + }, b.prototype.Uo = function(m, _) { + return this.xl.contains(m, _) ? (m = this.nC(m), _ = this.oC(_), 0 > m || m >= this.Hf || 0 > _ || _ >= this.Hf || (_ = this.Xh[this.Wm * _ + (m >> 4)] >> 2 * (15 & m) & 3) == 0 ? 0 : _ == 1 ? 1 : 2) : 0; + }, b.prototype.To = function(m) { + if (!m.Fa(this.xl)) + return 0; + var _ = this.nC(m.v), C = this.nC(m.C), D = this.oC(m.G); + if (m = this.oC(m.H), 0 > _ && (_ = 0), 0 > D && (D = 0), C >= this.Hf && (C = this.Hf - 1), m >= this.Hf && (m = this.Hf - 1), _ > C || D > m) + return 0; + for (var L = Math.max(C - _, 1) * Math.max(m - D, 1), B = 0, q = this.Wm, Z = this.Hf, ie = 0; ; ) { + if (32 > L || 16 > Z) { + for (L = D; L <= m; L++) + for (var se = _; se <= C; se++) + if (1 < (ie = this.Xh[B + q * L + (se >> 4)] >> 2 * (15 & se) & 3)) + return 2; + if (ie == 0) + return 0; + if (ie == 1) + return 1; + } + B += q * Z, Z = A.P.truncate(Z / 2), q = A.P.truncate((2 * Z + 31) / 32), _ = A.P.truncate(_ / 2), D = A.P.truncate(D / 2), C = A.P.truncate(C / 2), m = A.P.truncate(m / 2), L = Math.max(C - _, 1) * Math.max(m - D, 1); + } + }, b.prototype.MR = function() { + return this.Hf * this.Wm; + }, b; + }(); + A.Mx = T; + }(le || (le = {})), function(A) { + var ve; + (ve = A.QL || (A.QL = {}))[ve.contains = 1] = "contains", ve[ve.within = 2] = "within", ve[ve.equals = 3] = "equals", ve[ve.disjoint = 4] = "disjoint", ve[ve.touches = 8] = "touches", ve[ve.crosses = 16] = "crosses", ve[ve.overlaps = 32] = "overlaps", ve[ve.unknown = 0] = "unknown", ve[ve.intersects = 1073741824] = "intersects"; + var H = function() { + function b() { + } + return b.construct = function(m, _, C, D, L, B, q, Z) { + var ie = new b(); + return ie.rw = m, ie.Om = _, ie.Mj = C, ie.Ui = D, ie.wH = L, ie.OY = B, ie.PY = q, ie.QY = Z, ie; + }, b; + }(); + A.Xt = function() { + function b() { + } + return b.xD = function(m, _, C) { + if (b.ry(m)) { + var D = A.ua.mj(_, m, !1); + _ = !1, A.Wk.xE(m) && (_ = _ || m.nu(D, C)), (D = m.K()) != 1736 && D != 1607 || !A.Wk.vE(m) || C == 0 || (_ = _ || m.hj(C)), D != 1736 && D != 1607 || !A.Wk.wE(m) || C == 0 || _ || m.cM(); + } + }, b.ry = function(m) { + return A.Wk.xE(m) || A.Wk.vE(m) || A.Wk.wE(m); + }, b; + }(); + var T = function() { + function b() { + this.th = []; + } + return b.uB = function(m, _, C, D, L) { + var B = m.K(), q = _.K(); + if (B == 197) { + if (q == 197) + return b.oW(m, _, C, D); + if (q == 33) + return D == 2 ? D = 1 : D == 1 && (D = 2), b.cJ(_, m, C, D); + } else if (B == 33) { + if (q == 197) + return b.cJ(m, _, C, D); + if (q == 33) + return b.qW(m, _, C, D); + } + if (m.B() || _.B()) + return D == 4; + var Z = new A.l(); + m.A(Z); + var ie = new A.l(); + _.A(ie); + var se = new A.l(); + if (se.L(Z), se.$b(ie), C = A.ua.Xd(C, se, !1), b.fk(Z, ie, C)) + return D == 4; + switch (Z = !1, A.Xk.zd(B) && ((B = new A.Ua(m.description)).pc(m, !0), m = B, B = 1607), A.Xk.zd(q) && ((q = new A.Ua(_.description)).pc(_, !0), _ = q, q = 1607), B != 197 && q != 197 ? (m.Eb() < _.Eb() || B == 33 && q == 550) && (D == 2 ? D = 1 : D == 1 && (D = 2)) : B != 1736 && q != 197 && (D == 2 ? D = 1 : D == 1 && (D = 2)), B) { + case 1736: + switch (q) { + case 1736: + Z = b.st(m, _, C, D, L); + break; + case 1607: + Z = b.bn(m, _, C, D, L); + break; + case 33: + Z = b.rt(m, _, C, D); + break; + case 550: + Z = b.qt(m, _, C, D, L); + break; + case 197: + Z = b.BI(m, _, C, D, L); + } + break; + case 1607: + switch (q) { + case 1736: + Z = b.bn(_, m, C, D, L); + break; + case 1607: + Z = b.bB(m, _, C, D, L); + break; + case 33: + Z = b.ut(m, _, C, D, L); + break; + case 550: + Z = b.tt(m, _, C, D, L); + break; + case 197: + Z = b.HI(m, _, C, D); + } + break; + case 33: + switch (q) { + case 1736: + Z = b.rt(_, m, C, D); + break; + case 1607: + Z = b.ut(_, m, C, D, L); + break; + case 550: + Z = b.mt(_, m, C, D); + } + break; + case 550: + switch (q) { + case 1736: + Z = b.qt(_, m, C, D, L); + break; + case 1607: + Z = b.tt(_, m, C, D, L); + break; + case 550: + Z = b.UA(m, _, C, D, L); + break; + case 33: + Z = b.mt(m, _, C, D); + break; + case 197: + Z = b.cI(m, _, C, D); + } + break; + case 197: + switch (q) { + case 1736: + Z = b.BI(_, m, C, D, L); + break; + case 1607: + Z = b.HI(_, m, C, D); + break; + case 550: + Z = b.cI(_, m, C, D); + } + } + return Z; + }, b.oW = function(m, _, C, D) { + if (m.B() || _.B()) + return D == 4; + var L = new A.l(), B = new A.l(), q = new A.l(); + switch (m.A(L), _.A(B), q.L(L), q.$b(B), m = A.ua.Xd(C, q, !1), D) { + case 4: + return b.fk(L, B, m); + case 2: + return b.eF(B, L, m); + case 1: + return b.eF(L, B, m); + case 3: + return b.gk(L, B, m); + case 8: + return b.YP(L, B, m); + case 32: + return b.XP(L, B, m); + case 16: + return b.WP(L, B, m); + } + return !1; + }, b.cJ = function(m, _, C, D) { + if (m.B() || _.B()) + return D == 4; + m = m.D(); + var L = new A.l(), B = new A.l(); + switch (_.A(L), B.L(m), B.$b(L), _ = A.ua.Xd(C, B, !1), D) { + case 4: + return b.Tw(m, L, _); + case 2: + return b.$A(m, L, _); + case 1: + return b.MU(m, L, _); + case 3: + return b.qI(m, L, _); + case 8: + return b.ZA(m, L, _); + } + return !1; + }, b.qW = function(m, _, C, D) { + if (m.B() || _.B()) + return D == 4; + m = m.D(), _ = _.D(); + var L = new A.l(); + switch (L.L(m), L.$b(_), C = A.ua.Xd(C, L, !1), D) { + case 4: + return b.NU(m, _, C); + case 2: + return b.pI(_, m, C); + case 1: + return b.pI(m, _, C); + case 3: + return b.rI(m, _, C); + } + return !1; + }, b.st = function(m, _, C, D, L) { + switch (D) { + case 4: + return b.fV(m, _, C); + case 2: + return b.Uw(_, m, C, L); + case 1: + return b.Uw(m, _, C, L); + case 3: + return b.iV(m, _, C); + case 8: + return b.qV(m, _, C); + case 32: + return b.lV(m, _, C, L); + } + return !1; + }, b.bn = function(m, _, C, D, L) { + switch (D) { + case 4: + return b.gV(m, _, C); + case 1: + return b.aB(m, _, C, L); + case 8: + return b.rV(m, _, C, L); + case 16: + return b.bV(m, _, C); + } + return !1; + }, b.rt = function(m, _, C, D) { + switch (D) { + case 4: + return b.eV(m, _, C); + case 1: + return b.ZU(m, _, C); + case 8: + return b.pV(m, _, C); + } + return !1; + }, b.qt = function(m, _, C, D) { + switch (D) { + case 4: + return b.dV(m, _, C); + case 1: + return b.YU(m, _, C); + case 8: + return b.oV(m, _, C); + case 16: + return b.aV(m, _, C); + } + return !1; + }, b.BI = function(m, _, C, D, L) { + if (b.cV(m, _, C)) + return D == 4; + if (D == 4) + return !1; + switch (D) { + case 2: + return b.sV(m, _, C); + case 1: + return b.XU(m, _, C); + case 3: + return b.hV(m, _, C); + case 8: + return b.nV(m, _, C, L); + case 32: + return b.kV(m, _, C, L); + case 16: + return b.$U(m, _, C, L); + } + return !1; + }, b.bB = function(m, _, C, D) { + switch (D) { + case 4: + return b.BV(m, _, C); + case 2: + return b.FI(_, m, C); + case 1: + return b.FI(m, _, C); + case 3: + return b.DV(m, _, C); + case 8: + return b.II(m, _, C); + case 32: + return b.HV(m, _, C); + case 16: + return b.GI(m, _, C); + } + return !1; + }, b.ut = function(m, _, C, D) { + switch (D) { + case 4: + return b.AV(m, _, C); + case 1: + return b.vV(m, _, C); + case 8: + return b.LV(m, _, C); + } + return !1; + }, b.tt = function(m, _, C, D) { + switch (D) { + case 4: + return b.zV(m, _, C); + case 1: + return b.uV(m, _, C); + case 8: + return b.KV(m, _, C); + case 16: + return b.xV(m, _, C); + } + return !1; + }, b.HI = function(m, _, C, D) { + if (b.yV(m, _, C)) + return D == 4; + if (D == 4) + return !1; + switch (D) { + case 2: + return b.MV(m, _, C); + case 1: + return b.tV(m, _, C); + case 3: + return b.CV(m, _, C); + case 8: + return b.JV(m, _, C); + case 32: + return b.GV(m, _, C); + case 16: + return b.wV(m, _, C); + } + return !1; + }, b.UA = function(m, _, C, D) { + switch (D) { + case 4: + return b.bU(m, _, C); + case 2: + return b.$H(_, m, C); + case 1: + return b.$H(m, _, C); + case 3: + return b.dU(m, _, C); + case 32: + return b.jU(m, _, C); + } + return !1; + }, b.mt = function(m, _, C, D) { + switch (D) { + case 4: + return b.aI(m, _, C); + case 2: + return b.nU(m, _, C); + case 1: + return b.ZT(m, _, C); + case 3: + return b.Pw(m, _, C); + } + return !1; + }, b.cI = function(m, _, C, D) { + switch (D) { + case 4: + return b.aU(m, _, C); + case 2: + return b.mU(m, _, C); + case 1: + return b.YT(m, _, C); + case 3: + return b.cU(m, _, C); + case 8: + return b.lU(m, _, C); + case 16: + return b.$T(m, _, C); + } + return !1; + }, b.iV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !!b.gk(D, L, C) && (D = b.rc(m, _, !1)) != 4 && D != 1 && D != 2 && (!!b.ZH(m, _, C) || (D = m.Rb(), L = _.Rb(), !(Math.abs(D - L) > 4 * Math.max(m.I(), _.I()) * C) && b.Rz(m, _, C, !0))); + }, b.fV = function(m, _, C) { + var D = b.rc(m, _, !0); + return D == 4 || D != 1 && D != 2 && D != 1073741824 && b.zI(m, _, C); + }, b.qV = function(m, _, C) { + var D = b.rc(m, _, !1); + return D != 4 && D != 1 && D != 2 && b.DI(m, _, C, null); + }, b.lV = function(m, _, C, D) { + var L = b.rc(m, _, !1); + return L != 4 && L != 1 && L != 2 && b.AI(m, _, C, D); + }, b.Uw = function(m, _, C, D) { + var L = new A.l(), B = new A.l(); + return m.A(L), _.A(B), !!b.Ac(L, B, C) && (L = b.rc(m, _, !1)) != 4 && L != 2 && (L == 1 || b.wI(m, _, C, D)); + }, b.gV = function(m, _, C) { + var D = b.rc(m, _, !0); + return D == 4 || D != 1 && D != 1073741824 && b.zI(m, _, C); + }, b.rV = function(m, _, C, D) { + var L = b.rc(m, _, !1); + return L != 4 && L != 1 && b.EI(m, _, C, D); + }, b.bV = function(m, _, C) { + var D = b.rc(m, _, !1); + return D != 4 && D != 1 && b.yI(m, _, C, null); + }, b.aB = function(m, _, C, D) { + var L = new A.l(), B = new A.l(); + return m.A(L), _.A(B), !!b.Ac(L, B, C) && (L = b.rc(m, _, !1)) != 4 && (L == 1 || b.xI(m, _, C, D)); + }, b.eV = function(m, _, C) { + return A.jd.FG(m, _, C) == 0; + }, b.pV = function(m, _, C) { + return _ = _.D(), b.CI(m, _, C); + }, b.ZU = function(m, _, C) { + return _ = _.D(), b.vI(m, _, C); + }, b.dV = function(m, _, C) { + var D = b.rc(m, _, !1); + if (D == 4) + return !0; + if (D == 1) + return !1; + D = new A.l(), m.A(D), D.X(C, C); + for (var L = new A.h(), B = 0; B < _.I(); B++) + if (_.D(B, L), D.contains(L)) { + var q = A.jd.Zd(m, L, C); + if (q == 1 || q == 2) + return !1; + } + return !0; + }, b.oV = function(m, _, C) { + var D = this.rc(m, _, !1); + if (D == 4 || D == 1) + return !1; + D = new A.l(), m.A(D), D.X(C, C); + for (var L = !1, B = m, q = !1, Z = 0; Z < _.I(); Z++) { + var ie = _.Oa(Z); + if (D.contains(ie)) { + if ((ie = A.jd.Zd(B, ie, C)) == 2) + L = !0; + else if (ie == 1) + return !1; + } + q || (!A.Fg.Ol(m, _.I() - 1) || m.Cb != null && m.Cb.Gb != null ? B = m : (B = new A.Ea(), m.copyTo(B), B.hj(1)), q = !0); + } + return !!L; + }, b.aV = function(m, _, C) { + var D = this.rc(m, _, !1); + if (D == 4 || D == 1) + return !1; + var L = new A.l(); + D = new A.l(); + var B = new A.l(); + m.A(L), _.A(B), D.L(L), D.X(C, C), B = L = !1; + for (var q = m, Z = !1, ie = 0; ie < _.I(); ie++) { + var se = _.Oa(ie); + if (D.contains(se) ? (se = A.jd.Zd(q, se, C)) == 0 ? B = !0 : se == 1 && (L = !0) : B = !0, L && B) + return !0; + Z || (!A.Fg.Ol(m, _.I() - 1) || m.Cb != null && m.Cb.Gb != null ? q = m : (q = new A.Ea(), m.copyTo(q), q.hj(1)), Z = !0); + } + return !1; + }, b.YU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), !this.Ac(D, L, C) || (L = this.rc(m, _, !1)) == 4) + return !1; + if (L == 1) + return !0; + L = !1; + for (var B = m, q = !1, Z = 0; Z < _.I(); Z++) { + var ie = _.Oa(Z); + if (!D.contains(ie)) + return !1; + if ((ie = A.jd.Zd(B, ie, C)) == 1) + L = !0; + else if (ie == 0) + return !1; + q || (!A.Fg.Ol(m, _.I() - 1) || m.Cb != null && m.Cb.Gb != null ? B = m : (B = new A.Ea(), m.copyTo(B), B.hj(1)), q = !0); + } + return L; + }, b.hV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !!b.gk(D, L, C) && ((D = new A.Ea()).bd(_, !1), b.Rz(m, D, C, !0)); + }, b.cV = function(m, _, C) { + var D = b.rc(m, _, !1); + if (D == 4) + return !0; + if (D == 1 || D == 2) + return !1; + var L = new A.l(); + if (D = new A.l(), m.A(L), _.A(D), b.Ac(D, L, C) || (L = new A.h(), D.fn(L), (_ = A.jd.Zd(m, L, C)) != 0) || (D.VI(L), (_ = A.jd.Zd(m, L, C)) != 0) || (D.gn(L), (_ = A.jd.Zd(m, L, C)) != 0) || (D.YI(L), (_ = A.jd.Zd(m, L, C)) != 0)) + return !1; + _ = m.vb(0), (L = new A.l()).L(D), L.X(C, C); + for (var B = 0, q = m.I(); B < q; B++) { + var Z = _.read(2 * B), ie = _.read(2 * B + 1); + if (L.contains(Z, ie)) + return !1; + } + return !b.NG(m, D, C); + }, b.nV = function(m, _, C, D) { + var L = b.rc(m, _, !1); + if (L == 4 || L == 1 || L == 2) + return !1; + L = new A.l(); + var B = new A.l(); + return m.A(L), _.A(B), !b.Ac(B, L, C) && (B.S() <= C && B.da() <= C ? (_ = _.Kp(), b.CI(m, _, C)) : B.S() <= C || B.da() <= C ? (L = new A.Ua(), B = new A.Ta(), _.If(0, B), L.nf(B), _.If(2, B), L.lineTo(B), b.EI(m, L, C, D)) : ((L = new A.Ea()).bd(_, !1), b.DI(m, L, C, D))); + }, b.kV = function(m, _, C, D) { + var L = b.rc(m, _, !1); + if (L == 4 || L == 1 || L == 2) + return !1; + L = new A.l(); + var B = new A.l(); + return m.A(L), _.A(B), !(b.Ac(B, L, C) || B.S() <= C || B.da() <= C) && ((L = new A.Ea()).bd(_, !1), b.AI(m, L, C, D)); + }, b.sV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), b.Ac(L, D, C); + }, b.XU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !!b.Ac(D, L, C) && (D = b.rc(m, _, !1)) != 4 && D != 2 && (D == 1 || (L.S() <= C && L.da() <= C ? (_ = _.Kp(), b.vI(m, _, C)) : L.S() <= C || L.da() <= C ? (L = new A.Ua(), D = new A.Ta(), _.If(0, D), L.nf(D), _.If(2, D), L.lineTo(D), b.xI(m, L, C, null)) : ((L = new A.Ea()).bd(_, !1), b.wI(m, L, C, null)))); + }, b.$U = function(m, _, C, D) { + var L = new A.l(), B = new A.l(); + return m.A(L), _.A(B), !(b.Ac(B, L, C) || B.da() > C && B.S() > C || B.da() <= C && B.S() <= C) && (L = new A.Ua(), B = new A.Ta(), _.If(0, B), L.nf(B), _.If(2, B), L.lineTo(B), b.yI(m, L, C, D)); + }, b.DV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(!b.gk(D, L, C) || b.rc(m, _, !1) == 4) && (!!b.ZH(m, _, C) || b.Rz(m, _, C, !1)); + }, b.BV = function(m, _, C) { + return this.rc(m, _, !1) == 4 || !!new A.am(m, _, C, !0).next() && !this.OG(m, _, C); + }, b.II = function(m, _, C) { + if (b.rc(m, _, !1) == 4) + return !1; + var D = new A.ce(0); + if (b.Sz(m, _, C, D) != 0) + return !1; + for (var L = new A.ee(), B = 0; B < D.size; B += 2) { + var q = D.read(B), Z = D.read(B + 1); + L.Du(q, Z); + } + return m = m.ng(), _ = _.ng(), m.Gd(_, 0, _.I()), b.Ow(m, L, C); + }, b.GI = function(m, _, C) { + if (b.rc(m, _, !1) == 4) + return !1; + var D = new A.ce(0); + if (b.Sz(m, _, C, D) != 0) + return !1; + for (var L = new A.ee(), B = 0; B < D.size; B += 2) { + var q = D.read(B), Z = D.read(B + 1); + L.Du(q, Z); + } + return m = m.ng(), _ = _.ng(), m.Gd(_, 0, _.I()), !b.Ow(m, L, C); + }, b.HV = function(m, _, C) { + return b.rc(m, _, !1) != 4 && b.QG(m, _, C); + }, b.FI = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(!b.Ac(D, L, C) || b.rc(m, _, !1) == 4) && b.Am(_, m, C, !1); + }, b.AV = function(m, _, C) { + return b.rc(m, _, !1) == 4 || (_ = _.D(), !b.Tz(m, _, C)); + }, b.LV = function(m, _, C) { + return b.rc(m, _, !1) != 4 && (_ = _.D(), b.Uz(m, _, C)); + }, b.vV = function(m, _, C) { + return b.rc(m, _, !1) != 4 && (_ = _.D(), b.MG(m, _, C)); + }, b.zV = function(m, _, C) { + return b.rc(m, _, !1) == 4 || !b.PG(m, _, C, !1); + }, b.KV = function(m, _, C) { + if (this.rc(m, _, !1) == 4) + return !1; + var D = m.Ha(), L = new A.l(), B = new A.l(), q = new A.l(); + m.A(L), _.A(B), L.X(C, C), B.X(C, C), q.L(L), q.Fa(B), L = null; + var Z = m.Cb; + if (Z != null) { + var ie = Z.Gb; + L = Z.Bo, ie == null && (ie = Z = A.ua.lj(m, q)); + } else + ie = Z = A.ua.lj(m, q); + var se = ie.getIterator(), de = null; + L != null && (de = L.getIterator()); + var Ce = new A.h(), Ve = new A.h(), Je = !1, Pt = C * C; + for (L = new A.rn(_.I()), Z = 0; Z < _.I(); Z++) + L.write(Z, 0); + for (Z = 0; Z < _.I(); Z++) + if (_.D(Z, Ce), q.contains(Ce)) { + if (B.L(Ce.x, Ce.y, Ce.x, Ce.y), de != null && (de.Zi(B, C), de.next() == -1)) + continue; + se.Zi(B, C); + for (var $t = se.next(); $t != -1; $t = se.next()) + if (D.Wb(ie.ka($t)), ($t = D.ia()).ic($t.ge(Ce, !1), Ve), A.h.zc(Ce, Ve) <= Pt) { + L.write(Z, 1), Je = !0; + break; + } + } + if (!Je) + return !1; + for (m = m.ng(), D = new A.ee(), B = new A.h(), Z = 0; Z < _.I(); Z++) + L.read(Z) != 0 && (_.D(Z, B), D.Du(B.x, B.y)); + return this.Ow(m, D, C); + }, b.xV = function(m, _, C) { + if (this.rc(m, _, !1) == 4) + return !1; + var D = m.Ha(), L = new A.l(), B = new A.l(), q = new A.l(); + m.A(L), _.A(B), L.X(C, C), B.X(C, C), q.L(L), q.Fa(B), L = null; + var Z = m.Cb; + if (Z != null) { + var ie = Z.Gb; + L = Z.Bo, ie == null && (ie = Z = A.ua.lj(m, q)); + } else + ie = Z = A.ua.lj(m, q); + var se = ie.getIterator(), de = null; + L != null && (de = L.getIterator()); + var Ce = new A.h(), Ve = new A.h(), Je = !1, Pt = !1, $t = C * C; + for (L = new A.rn(_.I()), Z = 0; Z < _.I(); Z++) + L.write(Z, 0); + for (Z = 0; Z < _.I(); Z++) + if (_.D(Z, Ce), q.contains(Ce)) { + if (B.L(Ce.x, Ce.y, Ce.x, Ce.y), de != null && (de.Zi(B, C), de.next() == -1)) { + Pt = !0; + continue; + } + se.Zi(B, C); + for (var qe = !1, Rt = se.next(); Rt != -1; Rt = se.next()) + if (D.Wb(ie.ka(Rt)), (Rt = D.ia()).ic(Rt.ge(Ce, !1), Ve), A.h.zc(Ce, Ve) <= $t) { + L.write(Z, 1), qe = Je = !0; + break; + } + qe || (Pt = !0); + } else + Pt = !0; + if (!Je || !Pt) + return !1; + for (m = m.ng(), D = new A.ee(), B = new A.h(), Z = 0; Z < _.I(); Z++) + L.read(Z) != 0 && (_.D(Z, B), D.Du(B.x, B.y)); + return !this.Ow(m, D, C); + }, b.uV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(!b.Ac(D, L, C) || b.rc(m, _, !1) == 4 || !b.PG(m, _, C, !0)) && (m = m.ng(), !b.bI(m, _, C)); + }, b.CV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(L.da() > C && L.S() > C) && b.gk(D, L, C); + }, b.yV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !b.Ac(L, D, C) && !b.NG(m, L, C); + }, b.JV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), L.da() <= C && L.S() <= C) + return L = _.Kp(), b.Uz(m, L, C); + if (L.da() <= C || L.S() <= C) + return L = new A.Ua(), D = new A.Ta(), _.If(0, D), L.nf(D), _.If(2, D), L.lineTo(D), b.II(m, L, C); + m = m.Ha(), _ = new A.l(), D = new A.l(), _.L(L), D.L(L), _.X(-C, -C), D.X(C, C), L = !1; + for (var B = new A.l(), q = new A.l(); m.ab(); ) + for (; m.Ia(); ) { + if (m.ia().A(B), q.L(_), q.Fa(B), !q.B() && (q.da() > C || q.S() > C)) + return !1; + q.L(D), q.Fa(B), q.B() || (L = !0); + } + return L; + }, b.GV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(b.Ac(D, L, C) || b.Ac(L, D, C) || b.Ac(L, D, C) || L.da() > C && L.S() > C || L.da() <= C && L.S() <= C) && (D = new A.Ua(), L = new A.Ta(), _.If(0, L), D.nf(L), _.If(2, L), D.lineTo(L), b.QG(m, D, C)); + }, b.MV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), !b.Ac(L, D, C) || L.da() <= C && L.S() <= C) + return !1; + if (L.da() <= C || L.S() <= C) + return b.Ac(L, D, C); + m = m.Ha(), (_ = new A.l()).L(L), _.X(-C, -C), L = !1, D = new A.l(); + for (var B = new A.l(); m.ab(); ) + for (; m.Ia(); ) + m.ia().A(D), _.jm(D) ? L = !0 : (B.L(_), B.Fa(D), !B.B() && (B.da() > C || B.S() > C) && (L = !0)); + return L; + }, b.tV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return _.A(L), m.A(D), !(!b.Ac(D, L, C) || L.da() > C && L.S() > C) && (L.da() <= C && L.S() <= C ? (_ = _.Kp(), b.MG(m, _, C)) : (D = new A.Ua(), L = new A.Ta(), _.If(0, L), D.nf(L), _.If(2, L), D.lineTo(L), b.Am(D, m, C, !1))); + }, b.wV = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), b.Ac(L, D, C) || L.da() <= C && L.S() <= C) + return !1; + if (L.da() <= C || L.S() <= C) + return D = new A.Ua(), L = new A.Ta(), _.If(0, L), D.nf(L), _.If(2, L), D.lineTo(L), b.GI(m, D, C); + m = m.Ha(), _ = new A.l(), (D = new A.l()).L(L), _.L(L), D.X(-C, -C), _.X(C, C); + for (var B = L = !1, q = new A.l(), Z = new A.l(); m.ab(); ) + for (; m.Ia(); ) + if (m.ia().A(q), B || _.contains(q) || (B = !0), L || (Z.L(D), Z.Fa(q), !Z.B() && (Z.da() > C || Z.S() > C) && (L = !0)), L && B) + return !0; + return !1; + }, b.dU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !!b.gk(D, L, C) && (!!b.eU(m, _, C) || b.TA(m, _, C, !1, !0, !1)); + }, b.bU = function(m, _, C) { + return !b.bI(m, _, C); + }, b.jU = function(m, _, C) { + return b.TA(m, _, C, !1, !1, !0); + }, b.$H = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !!b.Ac(D, L, C) && b.TA(_, m, C, !0, !1, !1); + }, b.Ow = function(m, _, C) { + C *= C; + for (var D = new A.h(), L = new A.h(), B = 0; B < _.I(); B++) { + _.D(B, L); + for (var q = !1, Z = 0; Z < m.I(); Z++) + if (m.D(Z, D), A.h.zc(D, L) <= C) { + q = !0; + break; + } + if (!q) + return !1; + } + return !0; + }, b.Pw = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), b.gk(D, L, C); + }, b.aI = function(m, _, C) { + return _ = _.D(), b.lt(m, _, C); + }, b.nU = function(m, _, C) { + return b.Pw(m, _, C); + }, b.ZT = function(m, _, C) { + return !b.aI(m, _, C); + }, b.cU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(L.da() > C || L.S() > C) && b.gk(D, L, C); + }, b.aU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), b.Ac(L, D, C)) + return !1; + for ((_ = new A.l()).L(L), _.X(C, C), C = new A.h(), L = 0; L < m.I(); L++) + if (m.D(L, C), _.contains(C)) + return !1; + return !0; + }, b.lU = function(m, _, C) { + var D = new A.l(), L = new A.l(), B = new A.l(); + if (_.A(D), D.da() <= C && D.S() <= C) + return !1; + if (D.da() <= C || D.S() <= C) { + _ = new A.h(); + var q = !1; + L.L(D), B.L(D), L.X(C, C), D.da() > C ? B.X(0, -C) : B.X(-C, 0); + for (var Z = 0; Z < m.I(); Z++) + if (m.D(Z, _), L.contains(_)) { + if (D.da() > C) { + if (_.y > B.G && _.y < B.H) + return !1; + } else if (_.x > B.v && _.x < B.C) + return !1; + q = !0; + } + return q; + } + for (L.L(D), B.L(D), L.X(C, C), B.X(-C, -C), _ = new A.h(), q = !1, Z = 0; Z < m.I(); Z++) + if (m.D(Z, _), L.contains(_)) { + if (B.jm(_)) + return !1; + q = !0; + } + return q; + }, b.mU = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), !b.Ac(L, D, C)) + return !1; + if (L.da() <= C && L.S() <= C) + return b.gk(D, L, C); + if (L.da() <= C || L.S() <= C) { + _ = !1, D = new A.l(); + var B = new A.l(); + D.L(L), B.L(L), L.da() > C ? D.X(0, -C) : D.X(-C, 0), B.X(C, C); + for (var q = new A.h(), Z = 0; Z < m.I(); Z++) { + if (m.D(Z, q), !B.contains(q)) + return !1; + L.da() > C ? q.y > D.G && q.y < D.H && (_ = !0) : q.x > D.v && q.x < D.C && (_ = !0); + } + return _; + } + for (_ = !1, D = new A.l(), B = new A.l(), D.L(L), B.L(L), D.X(-C, -C), B.X(C, C), q = new A.h(), Z = 0; Z < m.I(); Z++) { + if (m.D(Z, q), !B.contains(q)) + return !1; + D.jm(q) && (_ = !0); + } + return _; + }, b.YT = function(m, _, C) { + var D = new A.l(), L = new A.l(); + return m.A(D), _.A(L), !(!b.Ac(D, L, C) || L.da() > C || L.S() > C) && (_ = _.Kp(), !b.lt(m, _, C)); + }, b.$T = function(m, _, C) { + var D = new A.l(), L = new A.l(); + if (m.A(D), _.A(L), b.Ac(L, D, C) || L.da() <= C && L.S() <= C) + return !1; + if (L.da() <= C || L.S() <= C) { + _ = new A.l(), D = new A.l(), _.L(L), L.da() > C ? _.X(0, -C) : _.X(-C, 0), D.L(L), D.X(C, C); + for (var B = new A.h(), q = !1, Z = !1, ie = 0; ie < m.I(); ie++) + if (m.D(ie, B), q || (L.da() > C ? B.y > _.G && B.y < _.H && (q = !0) : B.x > _.v && B.x < _.C && (q = !0)), Z || D.contains(B) || (Z = !0), q && Z) + return !0; + return !1; + } + for (_ = new A.l(), D = new A.l(), _.L(L), _.X(-C, -C), D.L(L), D.X(C, C), B = new A.h(), Z = q = !1, ie = 0; ie < m.I(); ie++) + if (m.D(ie, B), !q && _.jm(B) && (q = !0), Z || D.contains(B) || (Z = !0), q && Z) + return !0; + return !1; + }, b.rI = function(m, _, C) { + return A.h.zc(m, _) <= C * C; + }, b.NU = function(m, _, C) { + return A.h.zc(m, _) > C * C; + }, b.pI = function(m, _, C) { + return b.rI(m, _, C); + }, b.qI = function(m, _, C) { + var D = new A.l(); + return D.L(m), b.gk(D, _, C); + }, b.Tw = function(m, _, C) { + var D = new A.l(); + return D.L(_), D.X(C, C), !D.contains(m); + }, b.ZA = function(m, _, C) { + if (_.da() <= C && _.S() <= C) + return !1; + var D = new A.l(), L = new A.l(); + if (D.L(_), D.X(C, C), !D.contains(m)) + return !1; + if (_.da() <= C || _.S() <= C) { + if (L.L(_), _.da() > C ? L.X(0, -C) : L.X(-C, 0), _.da() > C) { + if (m.y > L.G && m.y < L.H) + return !1; + } else if (m.x > L.v && m.x < L.C) + return !1; + return !0; + } + return L.L(_), L.X(-C, -C), !L.jm(m); + }, b.$A = function(m, _, C) { + if (_.da() <= C && _.S() <= C) + return !0; + if (_.da() <= C || _.S() <= C) { + var D = new A.l(); + D.L(_), _.da() > C ? D.X(0, -C) : D.X(-C, 0); + var L = !1; + return _.da() > C ? m.y > D.G && m.y < D.H && (L = !0) : m.x > D.v && m.x < D.C && (L = !0), L; + } + return (D = new A.l()).L(_), D.X(-C, -C), D.jm(m); + }, b.MU = function(m, _, C) { + return b.qI(m, _, C); + }, b.gk = function(m, _, C) { + return b.Ac(m, _, C) && b.Ac(_, m, C); + }, b.fk = function(m, _, C) { + var D = new A.l(); + return D.L(_), D.X(C, C), !m.isIntersecting(D); + }, b.YP = function(m, _, C) { + if (m.da() <= C && m.S() <= C) { + var D = m.tf(); + return b.ZA(D, _, C); + } + if (_.da() <= C && _.S() <= C) + return D = _.tf(), b.ZA(D, m, C); + if (m.da() > C && m.S() > C && (_.da() <= C || _.S() <= C) ? D = _ : (D = m, m = _), D.da() <= C || D.S() <= C) { + if (m.da() <= C || m.S() <= C) { + _ = new A.zb(); + var L = new A.zb(), B = [0, 0], q = [0, 0], Z = new A.h(); + return D.fn(Z), _.Ec(Z), D.gn(Z), _.Rc(Z), m.fn(Z), L.Ec(Z), m.gn(Z), L.Rc(Z), _.Fa(L, null, B, q, C), _.Fa(L, null, null, null, C) == 1 && (B[0] == 0 || B[1] == 1 || q[0] == 0 || q[1] == 1); + } + return _ = new A.l(), L = new A.l(), _.L(m), _.X(-C, -C), L.L(_), L.Fa(D), !(!L.B() && (L.da() > C || L.S() > C)); + } + return m.X(C, C), (L = new A.l()).L(D), L.Fa(m), !(L.B() || !L.B() && L.da() > C && L.S() > C); + }, b.XP = function(m, _, C) { + if (b.Ac(m, _, C) || b.Ac(_, m, C) || m.da() <= C && m.S() <= C || _.da() <= C && _.S() <= C) + return !1; + if (m.da() <= C || m.S() <= C) { + if (_.da() > C && _.S() > C) + return !1; + var D = new A.zb(), L = new A.zb(), B = [0, 0], q = [0, 0], Z = new A.h(); + return m.fn(Z), D.Ec(Z), m.gn(Z), D.Rc(Z), _.fn(Z), L.Ec(Z), _.gn(Z), L.Rc(Z), D.Fa(L, null, B, q, C), D.Fa(L, null, null, null, C) == 2 && (0 < B[0] || 1 > B[1]) && (0 < q[0] || 1 > q[1]); + } + return !(_.da() <= C || _.S() <= C) && ((D = new A.l()).L(m), D.Fa(_), !(D.B() || D.da() <= C || D.S() <= C)); + }, b.eF = function(m, _, C) { + if (!b.Ac(m, _, C)) + return !1; + if (m.da() <= C && m.S() <= C) + return m = m.tf(), b.$A(m, _, C); + if (_.da() <= C && _.S() <= C) + return _ = _.tf(), b.$A(_, m, C); + if (m.da() <= C || m.S() <= C) + return b.Ac(m, _, C); + if (_.da() <= C || _.S() <= C) { + var D = new A.l(); + return D.L(m), D.X(-C, -C), D.jm(_) ? !0 : ((m = new A.l()).L(D), m.Fa(_), !(m.B() || m.da() <= C && m.S() <= C)); + } + return b.Ac(m, _, C); + }, b.WP = function(m, _, C) { + if (b.Ac(m, _, C) || b.Ac(_, m, C) || m.da() <= C && m.S() <= C || _.da() <= C && _.S() <= C || _.da() > C && _.S() > C && m.da() > C && m.S() > C) + return !1; + if (m.da() > C && m.S() > C) + var D = _; + else + D = m, m = _; + if (m.da() > C && m.S() > C) { + _ = new A.l(); + var L = new A.l(); + return L.L(m), L.X(-C, -C), _.L(L), _.Fa(D), !(_.B() || _.da() <= C && _.S() <= C); + } + _ = new A.zb(), L = new A.zb(); + var B = [0, 0], q = [0, 0], Z = new A.h(); + return D.fn(Z), _.Ec(Z), D.gn(Z), _.Rc(Z), m.fn(Z), L.Ec(Z), m.gn(Z), L.Rc(Z), _.Fa(L, null, B, q, C), _.Fa(L, null, null, null, C) == 1 && 0 < B[0] && 1 > B[1] && 0 < q[0] && 1 > q[1]; + }, b.zI = function(m, _, C) { + var D = new A.l(), L = new A.l(), B = new A.am(m, _, C, !0); + if (!B.next()) + return !0; + if (this.OG(m, _, C)) + return !1; + var q = m, Z = null; + _.K() == 1736 && (Z = _); + var ie = !1, se = !1; + do { + var de = B.pl(), Ce = B.jl(); + if (Ce = _.Oa(_.Ca(Ce)), D.L(B.oz()), D.X(C, C), D.contains(Ce) && (Ce = A.jd.Zd(q, Ce, 0)) != 0 || _.K() == 1736 && (de = m.Oa(m.Ca(de)), L.L(B.Wy()), L.X(C, C), L.contains(de) && (Ce = A.jd.Zd(Z, de, 0)) != 0)) + return !1; + ie || (!A.Fg.Ol(m, _.ea() - 1) || m.Cb != null && m.Cb.Gb != null ? q = m : (q = new A.Ea(), m.copyTo(q), q.hj(1)), ie = !0), _.K() != 1736 || se || (se = _, !A.Fg.Ol(se, m.ea() - 1) || _.Cb != null && _.Cb.Gb != null ? Z = _ : (Z = new A.Ea(), se.copyTo(Z), Z.hj(1)), se = !0); + } while (B.next()); + return !0; + }, b.Ac = function(m, _, C) { + var D = new A.l(); + return D.L(m), D.X(C, C), D.contains(_); + }, b.ns = function(m, _, C) { + var D = new A.l(); + return D.L(_), D.X(C, C), _ = new A.h(), m.fn(_), !D.contains(_) || (m.VI(_), !D.contains(_) || (m.YI(_), !D.contains(_) || (m.gn(_), !D.contains(_)))); + }, b.ZH = function(m, _, C) { + if (m.ea() != _.ea() || m.I() != _.I()) + return !1; + var D = new A.h(), L = new A.h(), B = !0; + C *= C; + for (var q = 0; q < m.ea(); q++) { + if (m.Wc(q) != _.Wc(q)) { + B = !1; + break; + } + for (var Z = m.Ca(q); Z < _.Wc(q); Z++) + if (m.D(Z, D), _.D(Z, L), A.h.zc(D, L) > C) { + B = !1; + break; + } + if (!B) + break; + } + return !!B; + }, b.eU = function(m, _, C) { + if (m.I() != _.I()) + return !1; + var D = new A.h(), L = new A.h(), B = !0; + C *= C; + for (var q = 0; q < m.I(); q++) + if (m.D(q, D), _.D(q, L), A.h.zc(D, L) > C) { + B = !1; + break; + } + return !!B; + }, b.TA = function(m, _, C, D, L, B) { + var q = !1; + if (m.I() > _.I()) { + D && (D = !1, q = !0); + var Z = _; + } else + Z = m, m = _; + if (_ = null, L || B || q) { + _ = new A.rn(m.I()); + for (var ie = 0; ie < m.I(); ie++) + _.write(ie, 0); + } + ie = new A.l(); + var se = new A.l(), de = new A.l(); + Z.A(ie), m.A(se), ie.X(C, C), se.X(C, C), de.L(ie), de.Fa(se), se = new A.h(); + for (var Ce = new A.h(), Ve = !0, Je = A.ua.jE(m, de), Pt = Je.getIterator(), $t = C * C, qe = 0; qe < Z.I(); qe++) + if (Z.D(qe, se), de.contains(se)) { + var Rt = !1; + ie.L(se.x, se.y, se.x, se.y), Pt.Zi(ie, C); + for (var Zt = Pt.next(); Zt != -1 && (Zt = Je.ka(Zt), m.D(Zt, Ce), !(A.h.zc(se, Ce) <= $t && ((L || B || q) && _.write(Zt, 1), Rt = !0, D))); Zt = Pt.next()) + ; + if (!Rt && (Ve = !1, L || D)) + return !1; + } else { + if (L || D) + return !1; + Ve = !1; + } + if (B && Ve) + return !1; + if (D) + return !0; + for (ie = 0; ie < m.I(); ie++) + if (_.read(ie) == 1) { + if (B) + return !0; + } else if (L || q) + return !1; + return !B; + }, b.bI = function(m, _, C) { + if (m.I() > _.I()) + var D = _; + else + D = m, m = _; + _ = new A.l(); + var L = new A.l(), B = new A.l(); + D.A(_), m.A(L), _.X(C, C), L.X(C, C), B.L(_), B.Fa(L), L = new A.h(); + for (var q = new A.h(), Z = C * C, ie = A.ua.jE(m, B), se = ie.getIterator(), de = 0; de < D.I(); de++) + if (D.D(de, L), B.contains(L)) { + _.L(L.x, L.y, L.x, L.y), se.Zi(_, C); + for (var Ce = se.next(); Ce != -1; Ce = se.next()) + if (m.D(ie.ka(Ce), q), A.h.zc(L, q) <= Z) + return !0; + } + return !1; + }, b.Rz = function(m, _, C, D) { + return b.Am(m, _, C, D) && b.Am(_, m, C, D); + }, b.Am = function(m, _, C, D) { + function L(Yi, rr) { + return Ce.LE(Yi, rr); + } + var B, q = !0, Z = [0, 0], ie = [0, 0], se = 0, de = new A.ja(0), Ce = new b(), Ve = new A.l(), Je = new A.l(), Pt = new A.l(); + m.A(Ve), _.A(Je), Ve.X(C, C), Je.X(C, C), Pt.L(Ve), Pt.Fa(Je), m = m.Ha(), Je = _.Ha(); + var $t = null, qe = $t = null, Rt = _.Cb; + for (Rt != null ? ($t = Rt.Gb, qe = Rt.Bo, $t == null && ($t = A.ua.lj(_, Pt))) : $t = A.ua.lj(_, Pt), _ = $t.getIterator(), Rt = null, qe != null && (Rt = qe.getIterator()); m.ab(); ) + for (; m.Ia(); ) { + var Zt = !1, Jt = m.ia(); + if (Jt.A(Ve), !Ve.isIntersecting(Pt) || Rt != null && (Rt.Zi(Ve, C), Rt.next() == -1)) + return !1; + for (qe = Jt.Rb(), _.Wo(Jt, C), B = _.next(); B != -1; B = _.next()) { + Je.Wb($t.ka(B)), B = Je.ia(); + var Xt = Jt.Fa(B, null, Z, ie, C); + if (Xt == 2 && (!D || ie[0] <= ie[1])) { + Xt = Z[0]; + var Qt = Z[1], bi = ie[0], Mi = ie[1]; + if (Xt * qe <= C && (1 - Qt) * qe <= C) { + Zt = !0, se = 0, de.resize(0), Ce.th.length = 0; + var Ri = m.xb(); + for (bi = !0; bi; ) { + if (m.Ia()) { + if (qe = (Jt = m.ia()).Rb(), (Xt = Jt.Fa(B, null, Z, ie, C)) == 2 && (!D || ie[0] <= ie[1]) && (Xt = Z[0], Qt = Z[1], Xt * qe <= C && (1 - Qt) * qe <= C)) { + Ri = m.xb(); + continue; + } + if (Je.Ia() && (B = Je.ia(), (Xt = Jt.Fa(B, null, Z, ie, C)) == 2 && (!D || ie[0] <= ie[1]) && (Xt = Z[0], Qt = Z[1], Xt * qe <= C && (1 - Qt) * qe <= C))) { + Ri = m.xb(); + continue; + } + } + bi = !1; + } + Ri != m.xb() && (m.Wb(Ri), m.ia()); + break; + } + Ri = m.xb(), B = H.construct(Ri, m.gb, Xt, Qt, Je.xb(), Je.gb, bi, Mi), Ce.th.push(B), de.add(de.size); + } + } + if (!Zt) { + if (se == Ce.th.length) + return !1; + for (1 < de.size - se && de.Wd(se, de.size, L), Zt = 0; se < Ce.th.length; se++) + if (!((B = Ce.th[de.get(se)]).Mj < Zt && B.Ui < Zt)) { + if (qe * (B.Mj - Zt) > C) + return !1; + if (qe * (1 - (Zt = B.Ui)) <= C || Zt == 1) + break; + } + if (qe * (1 - Zt) > C) + return !1; + se = 0, de.resize(0), Ce.th.length = 0; + } + } + return q; + }, b.QG = function(m, _, C) { + if (1 > b.Sz(m, _, C, null)) + return !1; + var D = new A.l(), L = new A.l(); + m.A(D), _.A(L); + var B = b.ns(D, L, C); + return D = b.ns(L, D, C), !(!B || !D) || (B && !D ? !b.Am(_, m, C, !1) : D && !B ? !b.Am(m, _, C, !1) : !b.Am(m, _, C, !1) && !b.Am(_, m, C, !1)); + }, b.Sz = function(m, _, C, D) { + function L(jr, no) { + return Ve.LE(jr, no); + } + if (m.sz() > _.sz()) + var B = _, q = m; + else + B = m, q = _; + m = B.Ha(), _ = q.Ha(); + var Z = [0, 0], ie = [0, 0], se = -1, de = 0, Ce = new A.ja(0), Ve = new b(), Je = new A.l(), Pt = new A.l(), $t = new A.l(); + B.A(Je), q.A(Pt), Je.X(C, C), Pt.X(C, C), $t.L(Je), $t.Fa(Pt), B = null, D != null && (B = new A.h()); + var qe = Pt = Pt = null, Rt = q.Cb; + for (Rt != null ? (Pt = Rt.Gb, qe = Rt.Bo, Pt == null && (Pt = A.ua.lj(q, $t))) : Pt = A.ua.lj(q, $t), q = Pt.getIterator(), Rt = null, qe != null && (Rt = qe.getIterator()); m.ab(); ) + for (qe = 0; m.Ia(); ) { + var Zt = m.ia(); + if (Zt.A(Je), Je.isIntersecting($t)) { + if (Rt != null && (Rt.Zi(Je, C), Rt.next() == -1)) + continue; + var Jt = Zt.Rb(); + q.Wo(Zt, C); + for (var Xt = q.next(); Xt != -1; Xt = q.next()) { + var Qt = Pt.ka(Xt); + _.Wb(Qt); + var bi = _.ia(), Mi = bi.Rb(), Ri = Zt.Fa(bi, null, Z, ie, C); + if (0 < Ri) { + Xt = Z[0], se = ie[0]; + var Yi = Ri == 2 ? Z[1] : NaN, rr = Ri == 2 ? ie[1] : NaN; + if (Ri == 2) { + if (Jt * (Yi - Xt) > C) + return 1; + var _i = Jt * (Yi - Xt); + if (_.Ia()) { + if (bi = _.ia(), (Ri = Zt.Fa(bi, null, Z, null, C)) == 2) { + Ri = Z[0]; + var fn = Z[1]; + if (_i + (Ri = Jt * (fn - Ri)) > C) + return 1; + } + _.Wb(Qt), _.ia(); + } + if (!_.xm()) { + if (_.ni(), bi = _.ni(), (Ri = Zt.Fa(bi, null, Z, null, C)) == 2 && (Ri = Z[0], _i + (Ri = Jt * ((fn = Z[1]) - Ri)) > C)) + return 1; + _.Wb(Qt), _.ia(); + } + if (m.Ia()) { + if (Qt = m.xb(), (Ri = (Zt = m.ia()).Fa(bi, null, Z, null, C)) == 2 && (Ri = Z[0], _i + (Ri = Jt * ((fn = Z[1]) - Ri)) > C)) + return 1; + m.Wb(Qt), m.ia(); + } + if (!m.xm()) { + if (Qt = m.xb(), m.ni(), (Ri = (Zt = m.ni()).Fa(bi, null, Z, null, C)) == 2 && (Ri = Z[0], _i + (Ri = Mi * ((fn = Z[1]) - Ri)) > C)) + return 1; + m.Wb(Qt), m.ia(); + } + bi = H.construct(m.xb(), m.gb, Xt, Yi, _.xb(), _.gb, se, rr), Ve.th.push(bi), Ce.add(Ce.size); + } + se = 0, D != null && (Zt.ic(Xt, B), D.add(B.x), D.add(B.y)); + } + } + if (de < Ve.th.length) { + for (Ce.Wd(de, Ce.size, L), Zt = 0, Xt = Ve.th[Ce.get(de)].Om; de < Ve.th.length; de++) + if (!((bi = Ve.th[Ce.get(de)]).Mj < Zt && bi.Ui < Zt)) + if (Jt * (bi.Mj - Zt) > C) + qe = Jt * (bi.Ui - bi.Mj), Zt = bi.Ui, Xt = bi.Om; + else { + if (bi.Om != Xt ? (qe = Jt * (bi.Ui - bi.Mj), Xt = bi.Om) : qe += Jt * (bi.Ui - bi.Mj), qe > C) + return 1; + if ((Zt = bi.Ui) == 1) + break; + } + Jt * (1 - Zt) > C && (qe = 0), de = 0, Ce.resize(0), Ve.th.length = 0; + } + } + } + return se; + }, b.OG = function(m, _, C) { + var D = m.Ha(), L = _.Ha(); + for (m = new A.am(m, _, C, !1); m.next(); ) { + _ = m.pl(); + var B = m.jl(); + if (D.Wb(_), L.Wb(B), _ = D.ia(), 0 < L.ia().Fa(_, null, null, null, C)) + return !0; + } + return !1; + }, b.PG = function(m, _, C, D) { + var L = m.Ha(), B = new A.l(), q = new A.l(), Z = new A.l(); + m.A(B), _.A(q), B.X(C, C), B.contains(q), q.X(C, C), Z.L(B), Z.Fa(q), (B = m.Cb) != null ? (B = B.Gb) == null && (B = A.ua.lj(m, Z)) : B = A.ua.lj(m, Z), m = B.getIterator(); + for (var ie = new A.h(), se = new A.h(), de = C * C, Ce = 0; Ce < _.I(); Ce++) + if (_.D(Ce, ie), Z.contains(ie)) { + q.L(ie.x, ie.y, ie.x, ie.y), m.Zi(q, C); + for (var Ve = !1, Je = m.next(); Je != -1; Je = m.next()) + if (L.Wb(B.ka(Je)), (Je = L.ia()).ic(Je.ge(ie, !1), se), A.h.zc(se, ie) <= de) { + Ve = !0; + break; + } + if (D) { + if (!Ve) + return !1; + } else if (Ve) + return !0; + } + return !!D; + }, b.Tz = function(m, _, C) { + var D = new A.h(), L = C * C, B = m.Ha(); + if ((m = m.Cb) != null && (m = m.Gb) != null) { + var q = new A.l(); + for (q.L(_), q = (C = m.HF(q, C)).next(); q != -1; q = C.next()) + if (B.Wb(m.ka(q)), B.Ia()) { + var Z = (q = B.ia()).ge(_, !1); + if (q.ic(Z, D), A.h.zc(_, D) <= L) + return !0; + } + return !1; + } + for (m = new A.l(); B.ab(); ) + for (; B.Ia(); ) + if ((q = B.ia()).A(m), m.X(C, C), m.contains(_) && (Z = q.ge(_, !1), q.ic(Z, D), A.h.zc(_, D) <= L)) + return !0; + return !1; + }, b.MG = function(m, _, C) { + return b.Tz(m, _, C) && !b.Uz(m, _, C); + }, b.Uz = function(m, _, C) { + return m = m.ng(), !b.lt(m, _, C); + }, b.NG = function(m, _, C) { + if (m.vm()) { + var D = new A.zb(_.v, _.G, _.v, _.H), L = new A.zb(_.v, _.H, _.C, _.H), B = new A.zb(_.C, _.H, _.C, _.G); + for (_ = new A.zb(_.C, _.G, _.v, _.G), m = m.Ha(); m.ab(); ) + for (; m.Ia(); ) { + var q = m.ia(); + if (q.isIntersecting(D, C) || q.isIntersecting(L, C) || q.isIntersecting(B, C) || q.isIntersecting(_, C)) + return !0; + } + } else { + (D = new A.l()).L(_), D.X(C, C), C = m.vb(0), L = new A.h(), B = new A.h(), _ = new A.h(), q = new A.h(); + for (var Z = 0, ie = m.ea(); Z < ie; Z++) + for (var se = !0, de = m.Ca(Z), Ce = m.Wc(Z); de < Ce; de++) + if (se) + C.uc(2 * de, B), se = !1; + else { + if (C.uc(2 * de, L), _.N(B), q.N(L), D.uy(_, q) != 0) + return !0; + B.N(L); + } + } + return !1; + }, b.rc = function(m, _, C) { + var D = m.K(), L = _.K(); + if (A.ba.zj(D)) { + var B = m.Cb; + if (B != null && (B = B.Hk) != null) + if (L == 33) { + var q = _.D(); + if ((q = B.Uo(q.x, q.y)) == 1) + return 1; + if (q == 0) + return 4; + } else { + if (q = new A.l(), _.A(q), (q = B.To(q)) == 1) + return 1; + if (q == 0) + return 4; + if (C && A.ba.zj(L) && b.CE(_, B)) + return 1073741824; + } + } + if (A.ba.zj(L) && (B = _.Cb) != null && (B = B.Hk) != null) + if (D == 33) { + if (m = m.D(), (q = B.Uo(m.x, m.y)) == 1) + return 2; + if (q == 0) + return 4; + } else { + if (_ = new A.l(), m.A(_), (q = B.To(_)) == 1) + return 2; + if (q == 0) + return 4; + if (C && A.ba.zj(D) && b.CE(m, B)) + return 1073741824; + } + return 0; + }, b.CE = function(m, _) { + for (var C = m.I(), D = new A.h(), L = 0; L < C; L++) + if (m.D(L, D), _.Uo(D.x, D.y) == 1) + return !0; + return !1; + }, b.DI = function(m, _, C, D) { + for (var L = 1 <= m.qm(0) && 1 <= _.qm(0), B = m.Ha(), q = _.Ha(), Z = [0, 0], ie = [0, 0], se = new A.am(m, _, C, !1), de = !1; se.next(); ) { + var Ce = se.pl(), Ve = se.jl(); + if (B.Wb(Ce), q.Wb(Ve), Ce = B.ia(), (Ve = q.ia().Fa(Ce, null, ie, Z, C)) == 2) { + if (de = Z[0], Ve = Z[1], Ce = Ce.Rb(), L && (Ve - de) * Ce > C) + return !1; + de = !0; + } else if (Ve != 0) { + if (de = Z[0], Ce = ie[0], 0 < de && 1 > de && 0 < Ce && 1 > Ce) + return !1; + de = !0; + } + } + return !!de && (B = new A.l(), q = new A.l(), L = new A.l(), m.A(B), _.A(q), B.X(1e3 * C, 1e3 * C), q.X(1e3 * C, 1e3 * C), L.L(B), L.Fa(q), !(10 < m.I() && (m = A.Vd.clip(m, L, C, 0), m.B()) || 10 < _.I() && (_ = A.Vd.clip(_, L, C, 0), _.B())) && A.cm.st(m, _, C, "F********", D)); + }, b.AI = function(m, _, C, D) { + var L = 1 <= m.qm(0) && 1 <= _.qm(0), B = new A.l(), q = new A.l(), Z = new A.l(); + m.A(B), _.A(q); + for (var ie = !1, se = b.ns(B, q, C), de = b.ns(q, B, C), Ce = m.Ha(), Ve = _.Ha(), Je = [0, 0], Pt = [0, 0], $t = new A.am(m, _, C, !1); $t.next(); ) { + var qe = $t.pl(), Rt = $t.jl(); + if (Ce.Wb(qe), Ve.Wb(Rt), Rt = Ce.ia(), (qe = Ve.ia().Fa(Rt, null, Pt, Je, C)) == 2) { + qe = Je[0]; + var Zt = Je[1]; + if (Rt = Rt.Rb(), L && (Zt - qe) * Rt > C && (ie = !0, se && de)) + return !0; + } else if (qe != 0 && (qe = Je[0], Rt = Pt[0], 0 < qe && 1 > qe && 0 < Rt && 1 > Rt)) + return !0; + } + if (L = new A.l(), Ce = new A.l(), L.L(B), L.X(1e3 * C, 1e3 * C), Ce.L(q), Ce.X(1e3 * C, 1e3 * C), Z.L(L), Z.Fa(Ce), B = "", B = ie ? B + "**" : B + "T*", se) { + if (10 < _.I() && (_ = A.Vd.clip(_, Z, C, 0)).B()) + return !1; + B += "****"; + } else + B += "T***"; + if (de) { + if (10 < m.I() && (m = A.Vd.clip(m, Z, C, 0)).B()) + return !1; + B += "***"; + } else + B += "T**"; + return A.cm.st(m, _, C, B.toString(), D); + }, b.wI = function(m, _, C, D) { + var L = [!1], B = b.uI(m, _, C, L); + return L[0] ? B : (L = new A.l(), _.A(L), L.X(1e3 * C, 1e3 * C), !(10 < m.I() && (m = A.Vd.clip(m, L, C, 0), m.B())) && A.cm.Uw(m, _, C, D)); + }, b.uI = function(m, _, C, D) { + D[0] = !1; + for (var L = m.Ha(), B = _.Ha(), q = [0, 0], Z = [0, 0], ie = new A.am(m, _, C, !1), se = !1; ie.next(); ) { + var de = ie.pl(), Ce = ie.jl(); + if (L.Wb(de, -1), B.Wb(Ce, -1), de = L.ia(), (de = B.ia().Fa(de, null, Z, q, C)) != 0 && (se = !0, de == 1 && (de = q[0], Ce = Z[0], 0 < de && 1 > de && 0 < Ce && 1 > Ce))) + return D[0] = !0, !1; + } + if (!se) { + for (D[0] = !0, q = new A.l(), m.A(q), q.X(C, C), ie = m, se = !1, Z = new A.l(), D = 0, L = _.ea(); D < L; D++) + if (0 < _.Ka(D)) { + if (_.Tj(D, Z), !q.isIntersecting(Z) || (B = _.Oa(_.Ca(D)), (B = A.Fg.ym(ie, B, 0)) == 0)) + return !1; + se || (!A.Fg.Ol(m, _.ea() - 1) || m.Cb != null && m.Cb.Gb != null ? ie = m : (B = new A.Ea(), m.copyTo(B), B.hj(1), ie = B), se = !0); + } + if (m.ea() == 1 || _.K() == 1607) + return !0; + for (q = new A.l(), _.A(q), q.X(C, C), Z = _, ie = !1, C = new A.l(), D = 0, L = m.ea(); D < L; D++) + if (0 < m.Ka(D)) { + if (m.Tj(D, C), q.isIntersecting(C) && (B = m.Oa(m.Ca(D)), (B = A.Fg.ym(Z, B, 0)) == 1)) + return !1; + ie || (!A.Fg.Ol(_, m.ea() - 1) || _.Cb != null && _.Cb.Gb != null ? Z = _ : (B = new A.Ea(), _.copyTo(B), B.hj(1), Z = B), ie = !0); + } + return !0; + } + return !1; + }, b.EI = function(m, _, C, D) { + for (var L = m.Ha(), B = _.Ha(), q = [0, 0], Z = [0, 0], ie = new A.am(m, _, C, !1), se = !1; ie.next(); ) { + var de = ie.pl(), Ce = ie.jl(); + if (L.Wb(de), B.Wb(Ce), de = L.ia(), (de = B.ia().Fa(de, null, Z, q, C)) == 2) + se = !0; + else if (de != 0) { + if (se = q[0], de = Z[0], 0 < se && 1 > se && 0 < de && 1 > de) + return !1; + se = !0; + } + } + return !!se && (B = new A.l(), q = new A.l(), L = new A.l(), m.A(B), _.A(q), B.X(1e3 * C, 1e3 * C), q.X(1e3 * C, 1e3 * C), L.L(B), L.Fa(q), !(10 < m.I() && (m = A.Vd.clip(m, L, C, 0), m.B()) || 10 < _.I() && (_ = A.Vd.clip(_, L, C, 0), _.B())) && A.cm.bn(m, _, C, "F********", D)); + }, b.yI = function(m, _, C, D) { + for (var L = m.Ha(), B = _.Ha(), q = [0, 0], Z = [0, 0], ie = new A.am(m, _, C, !1), se = !1; ie.next(); ) { + var de = ie.pl(), Ce = ie.jl(); + if (L.Wb(de), B.Wb(Ce), de = L.ia(), (de = B.ia().Fa(de, null, Z, q, C)) == 2) + se = !0; + else if (de != 0) { + if (se = q[0], de = Z[0], 0 < se && 1 > se && 0 < de && 1 > de) + return !0; + se = !0; + } + } + return !!se && (B = new A.l(), q = new A.l(), Z = new A.l(), ie = new A.l(), L = new A.l(), m.A(B), _.A(q), b.ns(q, B, C) ? (Z.L(B), Z.X(1e3 * C, 1e3 * C), ie.L(q), ie.X(1e3 * C, 1e3 * C), L.L(Z), L.Fa(ie), !(10 < m.I() && (m = A.Vd.clip(m, L, C, 0), m.B()) || 10 < _.I() && (_ = A.Vd.clip(_, L, C, 0), _.B())) && (C = A.cm.bn(m, _, C, "T********", D))) : C = A.cm.bn(m, _, C, "T*****T**", D)); + }, b.xI = function(m, _, C, D) { + var L = [!1], B = b.uI(m, _, C, L); + return L[0] ? B : (L = new A.l(), _.A(L), L.X(1e3 * C, 1e3 * C), !(10 < m.I() && (m = A.Vd.clip(m, L, C, 0), m.B())) && A.cm.aB(m, _, C, D)); + }, b.vI = function(m, _, C) { + return A.jd.Zd(m, _, C) == 1; + }, b.CI = function(m, _, C) { + return A.jd.Zd(m, _, C) == 2; + }, b.lt = function(m, _, C) { + var D = new A.h(); + C *= C; + for (var L = 0; L < m.I(); L++) + if (m.D(L, D), A.h.zc(D, _) <= C) + return !1; + return !0; + }, b.prototype.LE = function(m, _) { + return m = this.th[m], _ = this.th[_], m.Om < _.Om || m.Om == _.Om && (m.rw < _.rw || m.rw == _.rw && (m.Mj < _.Mj || m.Mj == _.Mj && (m.Ui < _.Ui || m.Ui == _.Ui && m.wH < _.wH))) ? -1 : 1; + }, b; + }(); + A.vd = T; + }(le || (le = {})), function(A) { + var ve, H, T; + (H = ve || (ve = {}))[H.InteriorInterior = 0] = "InteriorInterior", H[H.InteriorBoundary = 1] = "InteriorBoundary", H[H.InteriorExterior = 2] = "InteriorExterior", H[H.BoundaryInterior = 3] = "BoundaryInterior", H[H.BoundaryBoundary = 4] = "BoundaryBoundary", H[H.BoundaryExterior = 5] = "BoundaryExterior", H[H.ExteriorInterior = 6] = "ExteriorInterior", H[H.ExteriorBoundary = 7] = "ExteriorBoundary", H[H.ExteriorExterior = 8] = "ExteriorExterior", function(b) { + b[b.AreaAreaPredicates = 0] = "AreaAreaPredicates", b[b.AreaLinePredicates = 1] = "AreaLinePredicates", b[b.LineLinePredicates = 2] = "LineLinePredicates", b[b.AreaPointPredicates = 3] = "AreaPointPredicates", b[b.LinePointPredicates = 4] = "LinePointPredicates", b[b.PointPointPredicates = 5] = "PointPointPredicates"; + }(T || (T = {})), ve = function() { + function b() { + this.me = 0, this.j = new A.ku(), this.J = [0, 0, 0, 0, 0, 0, 0, 0, 0], this.$a = [0, 0, 0, 0, 0, 0, 0, 0, 0], this.fa = [!1, !1, !1, !1, !1, !1, !1, !1, !1], this.Um = this.xw = -1; + } + return b.tB = function(m, _, C, D, L) { + if (D.length != 9) + throw A.i.ga("relation string length has to be 9 characters"); + for (var B = 0; 9 > B; B++) { + var q = D.charAt(B); + if (q != "*" && q != "T" && q != "F" && q != "0" && q != "1" && q != "2") + throw A.i.ga("relation string"); + } + if ((B = this.HR(D, m.Eb(), _.Eb())) != 0) + return A.vd.uB(m, _, C, B, L); + B = new A.l(), m.A(B), q = new A.l(), _.A(q); + var Z = new A.l(); + if (Z.L(B), Z.$b(q), C = A.ua.Xd(C, Z, !1), m = this.RE(m, C), _ = this.RE(_, C), m.B() || _.B()) + return this.pW(m, _, D); + switch (B = _.K(), q = !1, m.K()) { + case 1736: + switch (B) { + case 1736: + q = this.st(m, _, C, D, L); + break; + case 1607: + q = this.bn(m, _, C, D, L); + break; + case 33: + q = this.rt(m, _, C, D); + break; + case 550: + q = this.qt(m, _, C, D, L); + } + break; + case 1607: + switch (B) { + case 1736: + q = this.bn(_, m, C, this.aq(D), L); + break; + case 1607: + q = this.bB(m, _, C, D, L); + break; + case 33: + q = this.ut(m, _, C, D, L); + break; + case 550: + q = this.tt(m, _, C, D, L); + } + break; + case 33: + switch (B) { + case 1736: + q = this.rt(_, m, C, this.aq(D)); + break; + case 1607: + q = this.ut(_, m, C, this.aq(D), L); + break; + case 33: + q = this.VU(m, _, C, D); + break; + case 550: + q = this.mt(_, m, C, this.aq(D)); + } + break; + case 550: + switch (B) { + case 1736: + q = this.qt(_, m, C, this.aq(D), L); + break; + case 1607: + q = this.tt(_, m, C, this.aq(D), L); + break; + case 550: + q = this.UA(m, _, C, D, L); + break; + case 33: + q = this.mt(m, _, C, D); + } + break; + default: + q = !1; + } + return q; + }, b.st = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.sJ(); + var q = new A.l(), Z = new A.l(); + return m.A(q), _.A(Z), D = !1, A.vd.fk(q, Z, C) && (B.Eu(m, _), D = !0), D || ((q = A.vd.rc(m, _, !1)) == 4 ? (B.Eu(m, _), D = !0) : q == 1 ? (B.hy(_), D = !0) : q == 2 && (B.UD(m), D = !0)), D || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.Dp(m, _), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.Uw = function(m, _, C, D) { + var L = new b(); + L.$i(), L.dj("T*****F**"), L.sJ(); + var B = new A.l(), q = new A.l(); + m.A(B), _.A(q); + var Z = !1; + return A.vd.fk(B, q, C) && (L.Eu(m, _), Z = !0), Z || ((B = A.vd.rc(m, _, !1)) == 4 ? (L.Eu(m, _), Z = !0) : B == 1 ? (L.hy(_), Z = !0) : B == 2 && (L.UD(m), Z = !0)), Z ? this.hg(L.J, L.Yc) : (m = (Z = new A.hd()).Ib(m), B = Z.Ib(_), A.Vk.W(Z, C, D, !1), C = Z.Ke(B).ng(), Z.Ip(0, !0, !0), A.tn.W(Z, m, -1, !1, D), Z.I(m) != 0 && (A.tn.W(Z, B, -1, !1, D), L.gr(Z, D), (_ = Z.I(B) == 0) || (L.Dp(m, B), L.j.Wg(), B = this.hg(L.J, L.Yc)) ? (m = Z.Ke(m), m = (Z = new A.hd()).Ib(m), B = Z.Ib(C), L.gr(Z, D), L.me = 0, L.$i(), L.dj(_ ? "T*****F**" : "******F**"), L.DB(), L.Dp(m, B), L.j.Wg(), this.hg(L.J, L.Yc)) : B)); + }, b.bn = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.DB(); + var q = new A.l(), Z = new A.l(); + return m.A(q), _.A(Z), D = !1, A.vd.fk(q, Z, C) && (B.Fu(m, _), D = !0), D || ((q = A.vd.rc(m, _, !1)) == 4 ? (B.Fu(m, _), D = !0) : q == 1 && (B.VD(_), D = !0)), D || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.mh = B.j.Fp(), b.Lw(_, B.j, B.mh), B.Dp(m, _), B.j.Gp(B.mh), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.aB = function(m, _, C, D) { + var L = new b(); + L.$i(), L.dj("T*****F**"), L.DB(); + var B = new A.l(), q = new A.l(); + m.A(B), _.A(q); + var Z = !1; + return A.vd.fk(B, q, C) && (L.Fu(m, _), Z = !0), Z || ((B = A.vd.rc(m, _, !1)) == 4 ? (L.Fu(m, _), Z = !0) : B == 1 && (L.VD(_), Z = !0)), Z ? this.hg(L.J, L.Yc) : (m = (Z = new A.hd()).Ib(m), _ = Z.Ib(_), L.Yo(Z, C, D), Z.I(m) != 0 && (L.Dp(m, _), L.j.Wg(), this.hg(L.J, L.Yc))); + }, b.qt = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.tJ(); + var q = new A.l(), Z = new A.l(); + return m.A(q), _.A(Z), D = !1, A.vd.fk(q, Z, C) && (B.Gu(m), D = !0), D || ((q = A.vd.rc(m, _, !1)) == 4 ? (B.Gu(m), D = !0) : q == 1 && (B.uN(), D = !0)), D || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.By(m, _), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.bB = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.$W(), D = new A.l(); + var q = new A.l(); + m.A(D), _.A(q); + var Z = !1; + return A.vd.fk(D, q, C) && (B.KG(m, _), Z = !0), Z || A.vd.rc(m, _, !1) != 4 || (B.KG(m, _), Z = !0), Z || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.$h = B.j.Fp(), B.mh = B.j.Fp(), b.Lw(m, B.j, B.$h), b.Lw(_, B.j, B.mh), B.Dp(m, _), B.j.Gp(B.$h), B.j.Gp(B.mh), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.tt = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.HJ(), D = new A.l(); + var q = new A.l(); + m.A(D), _.A(q); + var Z = !1; + return A.vd.fk(D, q, C) && (B.Qz(m), Z = !0), Z || A.vd.rc(m, _, !1) != 4 || (B.Qz(m), Z = !0), Z || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.$h = B.j.Fp(), b.Lw(m, B.j, B.$h), B.By(m, _), B.j.Gp(B.$h), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.UA = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.MJ(), D = new A.l(); + var q = new A.l(); + m.A(D), _.A(q); + var Z = !1; + return A.vd.fk(D, q, C) && (B.tI(), Z = !0), Z || (m = (D = new A.hd()).Ib(m), _ = D.Ib(_), B.Yo(D, C, L), B.By(m, _), B.j.Wg()), b.hg(B.J, B.Yc); + }, b.rt = function(m, _, C, D) { + var L = new b(); + L.$i(), L.dj(D), L.tJ(); + var B = new A.l(); + m.A(B), _ = _.D(); + var q = !1; + return A.vd.Tw(_, B, C) && (L.Gu(m), q = !0), q || ((C = A.jd.Zd(m, _, C)) == 1 ? (L.J[0] = 0, L.J[2] = 2, L.J[3] = -1, L.J[5] = 1, L.J[6] = -1) : C == 2 ? (L.J[6] = -1, m.He() != 0 ? (L.J[0] = -1, L.J[3] = 0, L.J[2] = 2, L.J[5] = 1) : (L.J[0] = 0, L.J[3] = -1, L.J[5] = -1, C = new A.l(), m.A(C), L.J[2] = C.da() == 0 && C.S() == 0 ? -1 : 1)) : L.Gu(m)), this.hg(L.J, D); + }, b.ut = function(m, _, C, D, L) { + var B = new b(); + B.$i(), B.dj(D), B.HJ(); + var q = new A.l(); + m.A(q), D = _.D(); + var Z = !1; + if (A.vd.Tw(D, q, C) && (B.Qz(m), Z = !0), !Z) { + q = null; + var ie = Z = !1; + (B.fa[0] || B.fa[6]) && (A.vd.Tz(m, D, C) ? (B.fa[0] && (q = A.si.im(m, L), ie = !A.vd.lt(q, D, C), Z = !0, B.J[0] = ie ? -1 : 0), B.J[6] = -1) : (B.J[0] = -1, B.J[6] = 0)), B.fa[3] && (q != null && q.B() ? B.J[3] = -1 : (Z || (q == null && (q = A.si.im(m, L)), ie = !A.vd.lt(q, D, C), Z = !0), B.J[3] = ie ? 0 : -1)), B.fa[5] && (q != null && q.B() ? B.J[5] = -1 : Z && !ie ? B.J[5] = 0 : (q == null && (q = A.si.im(m, L)), L = A.vd.Pw(q, _, C), B.J[5] = L ? -1 : 0)), B.fa[2] && (m.Rb() != 0 ? B.J[2] = 1 : ((L = new A.ee(m.description)).Gd(m, 0, m.I()), m = A.vd.Pw(L, _, C), B.J[2] = m ? -1 : 0)); + } + return this.hg(B.J, B.Yc); + }, b.mt = function(m, _, C, D) { + var L = new b(); + L.$i(), L.dj(D), L.MJ(); + var B = new A.l(); + m.A(B), _ = _.D(); + var q = !1; + if (A.vd.Tw(_, B, C) && (L.tI(), q = !0), !q) { + B = !1, q = !0, C *= C; + for (var Z = 0; Z < m.I(); Z++) { + var ie = m.Oa(Z); + if (A.h.zc(ie, _) <= C ? B = !0 : q = !1, B && !q) + break; + } + B ? (L.J[0] = 0, L.J[2] = q ? -1 : 0, L.J[6] = -1) : (L.J[0] = -1, L.J[2] = 0, L.J[6] = 0); + } + return b.hg(L.J, D); + }, b.VU = function(m, _, C, D) { + m = m.D(), _ = _.D(); + for (var L = [], B = 0; 9 > B; B++) + L[B] = -1; + return A.h.zc(m, _) <= C * C ? L[0] = 0 : (L[2] = 0, L[6] = 0), L[8] = 2, b.hg(L, D); + }, b.hg = function(m, _) { + for (var C = 0; 9 > C; C++) + switch (_.charAt(C)) { + case "T": + if (m[C] == -1) + return !1; + break; + case "F": + if (m[C] != -1) + return !1; + break; + case "0": + if (m[C] != 0) + return !1; + break; + case "1": + if (m[C] != 1) + return !1; + break; + case "2": + if (m[C] != 2) + return !1; + } + return !0; + }, b.pW = function(m, _, C) { + var D = [-1, -1, -1, -1, -1, -1, -1, -1, -1]; + if (m.B() && _.B()) { + for (var L = 0; 9 > L; L++) + D[L] = -1; + return this.hg(D, C); + } + return L = !1, m.B() && (m = _, L = !0), D[0] = -1, D[1] = -1, D[3] = -1, D[4] = -1, D[6] = -1, D[7] = -1, D[8] = 2, _ = m.K(), A.ba.Ic(_) ? _ == 1736 ? m.He() != 0 ? (D[2] = 2, D[5] = 1) : (D[5] = -1, _ = new A.l(), m.A(_), D[2] = _.da() == 0 && _.S() == 0 ? 0 : 1) : (_ = m.Rb() != 0, D[2] = _ ? 1 : 0, D[5] = A.si.cq(m) ? 0 : -1) : (D[2] = 0, D[5] = -1), L && this.qK(D), this.hg(D, C); + }, b.HR = function(m, _, C) { + return b.ZP(m) ? 3 : b.PP(m) ? 4 : b.ZX(m, _, C) ? 8 : b.xP(m, _, C) ? 16 : b.$O(m) ? 1 : b.zU(m, _, C) ? 32 : 0; + }, b.ZP = function(m) { + return m.charAt(0) == "T" && m.charAt(1) == "*" && m.charAt(2) == "F" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "F" && m.charAt(6) == "F" && m.charAt(7) == "F" && m.charAt(8) == "*"; + }, b.PP = function(m) { + return m.charAt(0) == "F" && m.charAt(1) == "F" && m.charAt(2) == "*" && m.charAt(3) == "F" && m.charAt(4) == "F" && m.charAt(5) == "*" && m.charAt(6) == "*" && m.charAt(7) == "*" && m.charAt(8) == "*"; + }, b.ZX = function(m, _, C) { + return (_ != 0 || C != 0) && ((_ != 2 || C != 2) && (m.charAt(0) == "F" && m.charAt(1) == "*" && m.charAt(2) == "*" && m.charAt(3) == "T" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "*" && m.charAt(7) == "*" && m.charAt(8) == "*" || _ == 1 && C == 1 && m.charAt(0) == "F" && m.charAt(1) == "T" && m.charAt(2) == "*" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "*" && m.charAt(7) == "*" && m.charAt(8) == "*") || C != 0 && m.charAt(0) == "F" && m.charAt(1) == "*" && m.charAt(2) == "*" && m.charAt(3) == "*" && m.charAt(4) == "T" && m.charAt(5) == "*" && m.charAt(6) == "*" && m.charAt(7) == "*" && m.charAt(8) == "*"); + }, b.xP = function(m, _, C) { + return _ > C ? m.charAt(0) == "T" && m.charAt(1) == "*" && m.charAt(2) == "*" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "T" && m.charAt(7) == "*" && m.charAt(8) == "*" : _ == 1 && C == 1 && m.charAt(0) == "0" && m.charAt(1) == "*" && m.charAt(2) == "*" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "*" && m.charAt(7) == "*" && m.charAt(8) == "*"; + }, b.$O = function(m) { + return m.charAt(0) == "T" && m.charAt(1) == "*" && m.charAt(2) == "*" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "F" && m.charAt(7) == "F" && m.charAt(8) == "*"; + }, b.zU = function(m, _, C) { + if (_ == C) { + if (_ != 1) + return m.charAt(0) == "T" && m.charAt(1) == "*" && m.charAt(2) == "T" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "T" && m.charAt(7) == "*" && m.charAt(8) == "*"; + if (m.charAt(0) == "1" && m.charAt(1) == "*" && m.charAt(2) == "T" && m.charAt(3) == "*" && m.charAt(4) == "*" && m.charAt(5) == "*" && m.charAt(6) == "T" && m.charAt(7) == "*" && m.charAt(8) == "*") + return !0; + } + return !1; + }, b.Lw = function(m, _, C) { + m = _.Ma(m); + for (var D = _.Oe; D != -1; D = _.Tf(D)) + if (_.yd(D) & m) { + var L = _.Je(D); + if (L == -1) + _.pn(D, C, 0); + else { + var B = L, q = 0; + do + _.fh(B) & m && q++, B = _.kc(_.ya(B)); + while (B != L); + _.pn(D, C, q); + } + } + }, b.aq = function(m) { + var _ = "" + m.charAt(0); + return _ += m.charAt(3), _ += m.charAt(6), _ += m.charAt(1), _ += m.charAt(4), _ += m.charAt(7), _ += m.charAt(2), (_ += m.charAt(5)) + m.charAt(8); + }, b.prototype.$i = function() { + for (var m = 0; 9 > m; m++) + this.J[m] = -2, this.$a[m] = -2; + }, b.qK = function(m) { + var _ = m[1], C = m[2], D = m[5]; + m[1] = m[3], m[2] = m[6], m[5] = m[7], m[3] = _, m[6] = C, m[7] = D; + }, b.prototype.dj = function(m) { + for (this.Yc = m, m = 0; 9 > m; m++) + this.Yc.charAt(m) != "*" ? (this.fa[m] = !0, this.me++) : this.fa[m] = !1; + }, b.prototype.PJ = function() { + for (var m = 0; 9 > m; m++) + this.fa[m] && this.J[m] == -2 && (this.J[m] = -1, this.fa[m] = !1); + }, b.prototype.qc = function(m) { + return this.J[m] != -2 && (this.J[m] == -1 ? (this.fa[m] = !1, this.me--, !0) : this.Yc.charAt(m) != "T" && this.Yc.charAt(m) != "F" ? !(this.J[m] < this.$a[m]) && (this.fa[m] = !1, this.me--, !0) : (this.fa[m] = !1, this.me--, !0)); + }, b.prototype.sJ = function() { + this.xw = 0, this.$a[0] = 2, this.$a[1] = 1, this.$a[2] = 2, this.$a[3] = 1, this.$a[4] = 1, this.$a[5] = 1, this.$a[6] = 2, this.$a[7] = 1, this.$a[8] = 2, this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.DB = function() { + this.xw = 1, this.Um = 3, this.$a[0] = 1, this.$a[1] = 0, this.$a[2] = 2, this.$a[3] = 1, this.$a[4] = 0, this.$a[5] = 1, this.$a[6] = 1, this.$a[7] = 0, this.$a[8] = 2, this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.$W = function() { + this.xw = 2, this.Um = 4, this.$a[0] = 1, this.$a[1] = 0, this.$a[2] = 1, this.$a[3] = 0, this.$a[4] = 0, this.$a[5] = 0, this.$a[6] = 1, this.$a[7] = 0, this.$a[8] = 2, this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.tJ = function() { + this.Um = 3, this.$a[0] = 0, this.$a[1] = -1, this.$a[2] = 2, this.$a[3] = 0, this.$a[4] = -1, this.$a[5] = 1, this.$a[6] = 0, this.$a[7] = -1, this.$a[8] = 2, this.fa[1] && (this.J[1] = -1, this.fa[1] = !1, this.me--), this.fa[4] && (this.J[4] = -1, this.fa[4] = !1, this.me--), this.fa[7] && (this.J[7] = -1, this.fa[7] = !1, this.me--), this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.HJ = function() { + this.Um = 4, this.$a[0] = 0, this.$a[1] = -1, this.$a[2] = 1, this.$a[3] = 0, this.$a[4] = -1, this.$a[5] = 0, this.$a[6] = 0, this.$a[7] = -1, this.$a[8] = 2, this.fa[1] && (this.J[1] = -1, this.fa[1] = !1, this.me--), this.fa[4] && (this.J[4] = -1, this.fa[4] = !1, this.me--), this.fa[7] && (this.J[7] = -1, this.fa[7] = !1, this.me--), this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.MJ = function() { + this.Um = 5, this.$a[0] = 0, this.$a[1] = -1, this.$a[2] = 0, this.$a[3] = -1, this.$a[4] = -1, this.$a[5] = -1, this.$a[6] = 0, this.$a[7] = -1, this.$a[8] = 2, this.fa[1] && (this.J[1] = -1, this.fa[1] = !1, this.me--), this.fa[3] && (this.J[3] = -1, this.fa[3] = !1, this.me--), this.fa[4] && (this.J[4] = -1, this.fa[4] = !1, this.me--), this.fa[5] && (this.J[5] = -1, this.fa[5] = !1, this.me--), this.fa[7] && (this.J[7] = -1, this.fa[7] = !1, this.me--), this.fa[8] && (this.J[8] = 2, this.fa[8] = !1, this.me--); + }, b.prototype.sN = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.xS(m, _, C), D = D && this.qc(0)), this.fa[1] && (this.nG(m, _, 1), D = D && this.qc(1)), this.fa[2] && (this.oG(m, _, C, 2), D = D && this.qc(2)), this.fa[3] && (this.nG(m, C, 3), D = D && this.qc(3)), this.fa[4] && (this.wN(m, _, C), D = D && this.qc(4)), this.fa[5] && (this.$D(m, C, 5), D = D && this.qc(5)), this.fa[6] && (this.oG(m, C, _, 6), D = D && this.qc(6)), this.fa[7] && (this.$D(m, _, 7), D = D && this.qc(7)), D; + }, b.prototype.Eu = function(m, _) { + this.J[0] = -1, this.J[1] = -1, this.J[3] = -1, this.J[4] = -1, this.Hr(m, this.fa[2] ? 2 : -1, this.Yc.charAt(2), this.fa[5] ? 5 : -1, this.Yc.charAt(5)), this.Hr(_, this.fa[6] ? 6 : -1, this.Yc.charAt(6), this.fa[7] ? 7 : -1, this.Yc.charAt(7)); + }, b.prototype.Hr = function(m, _, C, D, L) { + _ == -1 && D == -1 || ((C != "T" && C != "F" && _ != -1 || L != "T" && L != "F" && D != -1) && m.He() == 0 ? (D != -1 && (this.J[D] = -1), _ != -1 && (C = new A.l(), m.A(C), this.J[_] = C.da() == 0 && C.S() == 0 ? 0 : 1)) : (_ != -1 && (this.J[_] = 2), D != -1 && (this.J[D] = 1))); + }, b.prototype.hy = function(m) { + this.J[2] = 2, this.J[3] = -1, this.J[4] = -1, this.J[5] = 1, this.J[6] = -1, this.J[7] = -1, this.Hr(m, this.fa[0] ? 0 : -1, this.Yc.charAt(0), this.fa[1] ? 1 : -1, this.Yc.charAt(1)); + }, b.prototype.UD = function(m) { + this.hy(m), b.qK(this.J); + }, b.prototype.Fu = function(m, _) { + if (this.J[0] = -1, this.J[1] = -1, this.J[3] = -1, this.J[4] = -1, this.fa[6]) { + var C = this.Yc.charAt(6); + C = C == "T" || C == "F" || _.Rb() != 0, this.J[6] = C ? 1 : 0; + } + this.fa[7] && (_ = A.si.cq(_), this.J[7] = _ ? 0 : -1), this.Hr(m, this.fa[2] ? 2 : -1, this.Yc.charAt(2), this.fa[5] ? 5 : -1, this.Yc.charAt(5)); + }, b.prototype.VD = function(m) { + if (this.fa[0]) { + var _ = this.Yc.charAt(0); + _ = _ == "T" || _ == "F" || m.Rb() != 0, this.J[0] = _ ? 1 : 0; + } + this.fa[1] && (m = A.si.cq(m), this.J[1] = m ? 0 : -1), this.J[2] = 2, this.J[3] = -1, this.J[4] = -1, this.J[5] = 1, this.J[6] = -1, this.J[7] = -1; + }, b.prototype.Gu = function(m) { + this.J[0] = -1, this.J[3] = -1, this.J[6] = 0, this.Hr(m, this.fa[2] ? 2 : -1, this.Yc.charAt(2), this.fa[5] ? 5 : -1, this.Yc.charAt(5)); + }, b.prototype.uN = function() { + this.J[0] = 0, this.J[2] = 2, this.J[3] = -1, this.J[5] = 1, this.J[6] = -1; + }, b.prototype.KG = function(m, _) { + if (this.J[0] = -1, this.J[1] = -1, this.J[3] = -1, this.J[4] = -1, this.fa[2]) { + var C = this.Yc.charAt(2); + C = C == "T" || C == "F" || m.Rb() != 0, this.J[2] = C ? 1 : 0; + } + this.fa[5] && (m = A.si.cq(m), this.J[5] = m ? 0 : -1), this.fa[6] && (C = (C = this.Yc.charAt(6)) == "T" || C == "F" || _.Rb() != 0, this.J[6] = C ? 1 : 0), this.fa[7] && (_ = A.si.cq(_), this.J[7] = _ ? 0 : -1); + }, b.prototype.Qz = function(m) { + if (this.J[0] = -1, this.J[3] = -1, this.fa[2]) { + var _ = this.Yc.charAt(2); + _ = _ == "T" || _ == "F" || m.Rb() != 0, this.J[2] = _ ? 1 : 0; + } + this.fa[5] && (m = A.si.cq(m), this.J[5] = m ? 0 : -1), this.J[6] = 0; + }, b.prototype.tI = function() { + this.J[0] = -1, this.J[2] = 0, this.J[6] = 0; + }, b.prototype.tN = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.yS(m, _), D = D && this.qc(0)), this.fa[1] && (this.uS(m, _, C, this.mh), D = D && this.qc(1)), this.fa[2] && (this.vS(m, _), D = D && this.qc(2)), this.fa[3] && (this.AN(m, _, C, this.mh), D = D && this.qc(3)), this.fa[4] && (this.xN(m, _, C, this.mh), D = D && this.qc(4)), this.fa[5] && (this.yN(m, _, C), D = D && this.qc(5)), this.fa[6] && (this.gQ(m, _), D = D && this.qc(6)), this.fa[7] && (this.fQ(m, _, C, this.mh), D = D && this.qc(7)), D; + }, b.prototype.hT = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.BS(m, _, C, this.$h, this.mh), D = D && this.qc(0)), this.fa[1] && (this.pG(m, _, C, this.$h, this.mh, 1), D = D && this.qc(1)), this.fa[2] && (this.qG(m, _, C, 2), D = D && this.qc(2)), this.fa[3] && (this.pG(m, C, _, this.mh, this.$h, 3), D = D && this.qc(3)), this.fa[4] && (this.CN(m, _, C, this.$h, this.mh), D = D && this.qc(4)), this.fa[5] && (this.aE(m, C, this.$h, 5), D = D && this.qc(5)), this.fa[6] && (this.qG(m, C, _, 6), D = D && this.qc(6)), this.fa[7] && (this.aE(m, _, this.mh, 7), D = D && this.qc(7)), D; + }, b.prototype.WD = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.zS(m, _), D = D && this.qc(0)), this.fa[2] && (this.wS(m, _), D = D && this.qc(2)), this.fa[3] && (this.BN(m, _, C), D = D && this.qc(3)), this.fa[5] && (this.zN(m, _), D = D && this.qc(5)), this.fa[6] && (this.hQ(m, _), D = D && this.qc(6)), D; + }, b.prototype.LG = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.CS(m, _, C, this.$h), D = D && this.qc(0)), this.fa[2] && (this.AS(m, C), D = D && this.qc(2)), this.fa[3] && (this.EN(m, _, C, this.$h), D = D && this.qc(3)), this.fa[5] && (this.DN(m, _, C, this.$h), D = D && this.qc(5)), this.fa[6] && (this.iQ(m, _, C), D = D && this.qc(6)), D; + }, b.prototype.UU = function(m, _, C) { + var D = !0; + return this.fa[0] && (this.DS(m, _, C), D = D && this.qc(0)), this.fa[2] && (this.rG(m, _, C, 2), D = D && this.qc(2)), this.fa[6] && (this.rG(m, C, _, 6), D = D && this.qc(6)), D; + }, b.prototype.xS = function(m, _, C) { + this.J[0] != 2 && (m = this.j.af(m)) & _ && m & C && (this.J[0] = 2); + }, b.prototype.nG = function(m, _, C) { + if (this.J[C] != 1) { + var D = this.j.af(this.j.ya(m)); + this.j.af(m) & _ && D & _ && (this.J[C] = 1); + } + }, b.prototype.oG = function(m, _, C, D) { + this.J[D] != 2 && (m = this.j.af(m)) & _ && !(m & C) && (this.J[D] = 2); + }, b.prototype.wN = function(m, _, C) { + if (this.J[4] != 1) { + var D = this.j.fh(m); + D & _ && D & C ? this.J[4] = 1 : this.J[4] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1 && (m = this.j.yd(this.j.vf(m))) & _ && m & C && (this.J[4] = 0); + } + }, b.prototype.$D = function(m, _, C) { + if (this.J[C] != 1) { + var D = this.j.af(this.j.ya(m)); + !(this.j.af(m) & _) && !(D & _) && (this.J[C] = 1); + } + }, b.prototype.yS = function(m, _) { + if (this.J[0] != 1) { + var C = this.j.af(this.j.ya(m)); + this.j.af(m) & _ && C & _ && (this.J[0] = 1); + } + }, b.prototype.uS = function(m, _, C, D) { + if (this.J[1] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1) { + var L = this.j.vf(m), B = this.j.yd(L); + !(B & _) && this.j.af(m) & _ && (m = this.j.og(L, D), B & C && m % 2 != 0 && (this.J[1] = 0)); + } + }, b.prototype.vS = function(m, _) { + this.J[2] != 2 && this.j.fh(m) & _ && (this.J[2] = 2); + }, b.prototype.AN = function(m, _, C, D) { + if (this.J[3] != 1) { + var L = this.j.fh(m); + L & _ && L & C ? this.J[3] = 1 : this.J[3] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1 && (L = this.j.vf(m), (m = this.j.yd(L)) & _ && (_ = this.j.og(L, D), m & C && _ % 2 == 0 && (this.J[3] = 0))); + } + }, b.prototype.xN = function(m, _, C, D) { + if (this.J[4] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1) { + var L = this.j.vf(m); + (m = this.j.yd(L)) & _ && (_ = this.j.og(L, D), m & C && _ % 2 != 0 && (this.J[4] = 0)); + } + }, b.prototype.yN = function(m, _, C) { + this.J[5] != 1 && (m = this.j.fh(m)) & _ && !(m & C) && (this.J[5] = 1); + }, b.prototype.gQ = function(m, _) { + if (this.J[6] != 1) { + var C = this.j.af(this.j.ya(m)); + !(this.j.af(m) & _) && !(C & _) && (this.J[6] = 1); + } + }, b.prototype.fQ = function(m, _, C, D) { + if (this.J[7] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1) { + var L = this.j.vf(m), B = this.j.yd(L); + !(B & _) && !(this.j.af(m) & _) && (m = this.j.og(L, D), B & C && m % 2 != 0 && (this.J[7] = 0)); + } + }, b.prototype.BS = function(m, _, C, D, L) { + if (this.J[0] != 1) { + var B = this.j.fh(m); + B & _ && B & C ? this.J[0] = 1 : this.J[0] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1 && (m = this.j.vf(m), (B = this.j.yd(m)) & _ && B & C && (_ = this.j.og(m, D), L = this.j.og(m, L), _ % 2 == 0 && L % 2 == 0 && (this.J[0] = 0))); + } + }, b.prototype.pG = function(m, _, C, D, L, B) { + if (this.J[B] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1) { + m = this.j.vf(m); + var q = this.j.yd(m); + q & _ && q & C && (_ = this.j.og(m, D), L = this.j.og(m, L), _ % 2 == 0 && L % 2 != 0 && (this.J[B] = 0)); + } + }, b.prototype.qG = function(m, _, C, D) { + this.J[D] != 1 && (m = this.j.fh(m)) & _ && !(m & C) && (this.J[D] = 1); + }, b.prototype.CN = function(m, _, C, D, L) { + if (this.J[4] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1) { + m = this.j.vf(m); + var B = this.j.yd(m); + B & _ && B & C && (_ = this.j.og(m, D), L = this.j.og(m, L), _ % 2 != 0 && L % 2 != 0 && (this.J[4] = 0)); + } + }, b.prototype.aE = function(m, _, C, D) { + this.J[D] != 0 && this.j.Bb(this.j.ue(this.j.ya(m)), this.Wi) != 1 && (m = this.j.vf(m), !(this.j.yd(m) & _) && this.j.og(m, C) % 2 != 0 && (this.J[D] = 0)); + }, b.prototype.zS = function(m, _) { + this.J[0] != 0 && !(this.j.yd(m) & _) && this.j.jk(this.j.Yy(m)) & _ && (this.J[0] = 0); + }, b.prototype.wS = function(m, _) { + this.J[2] != 2 && this.j.yd(m) & _ && (this.J[2] = 2); + }, b.prototype.BN = function(m, _, C) { + this.J[3] != 0 && (m = this.j.yd(m)) & _ && m & C && (this.J[3] = 0); + }, b.prototype.zN = function(m, _) { + this.J[5] != 1 && this.j.yd(m) & _ && (this.J[5] = 1); + }, b.prototype.hQ = function(m, _) { + this.J[6] != 0 && !(this.j.yd(m) & _) && !(this.j.jk(this.j.Yy(m)) & _) && (this.J[6] = 0); + }, b.prototype.CS = function(m, _, C, D) { + if (this.J[0] != 0) { + var L = this.j.yd(m); + L & _ && L & C && this.j.og(m, D) % 2 == 0 && (this.J[0] = 0); + } + }, b.prototype.AS = function(m, _) { + this.J[2] != 1 && (this.j.Je(m) != -1 ? this.J[2] = 1 : this.J[2] != 0 && !(this.j.yd(m) & _) && (this.J[2] = 0)); + }, b.prototype.EN = function(m, _, C, D) { + if (this.J[3] != 0) { + var L = this.j.yd(m); + L & _ && L & C && this.j.og(m, D) % 2 != 0 && (this.J[3] = 0); + } + }, b.prototype.DN = function(m, _, C, D) { + if (this.J[5] != 0) { + var L = this.j.yd(m); + L & _ && !(L & C) && this.j.og(m, D) % 2 != 0 && (this.J[5] = 0); + } + }, b.prototype.iQ = function(m, _, C) { + this.J[6] != 0 && !((m = this.j.yd(m)) & _) && m & C && (this.J[6] = 0); + }, b.prototype.DS = function(m, _, C) { + this.J[0] != 0 && (m = this.j.yd(m)) & _ && m & C && (this.J[0] = 0); + }, b.prototype.rG = function(m, _, C, D) { + this.J[D] != 0 && (m = this.j.yd(m)) & _ && !(m & C) && (this.J[D] = 0); + }, b.prototype.Dp = function(m, _) { + var C = !1; + m = this.j.Ma(m), _ = this.j.Ma(_), this.Wi = this.j.bh(); + for (var D = this.j.Oe; D != -1; D = this.j.Tf(D)) { + var L = this.j.Je(D); + if (L == -1) { + if (this.Um != -1) + switch (this.Um) { + case 3: + C = this.WD(D, m, _); + break; + case 4: + C = this.LG(D, m, _); + break; + default: + throw A.i.ga("internal error"); + } + } else { + var B = L; + do { + var q = B; + if (this.j.Bb(q, this.Wi) != 1) + do { + switch (this.xw) { + case 0: + C = this.sN(q, m, _); + break; + case 1: + C = this.tN(q, m, _); + break; + case 2: + C = this.hT(q, m, _); + break; + default: + throw A.i.ga("internal error"); + } + if (C) + break; + this.j.Kb(q, this.Wi, 1), q = this.j.kc(q); + } while (q != B && !C); + if (C) + break; + B = this.j.kc(this.j.ya(q)); + } while (B != L); + if (C) + break; + } + } + C || this.PJ(), this.j.Lg(this.Wi); + }, b.prototype.By = function(m, _) { + var C = !1; + m = this.j.Ma(m), _ = this.j.Ma(_); + for (var D = this.j.Oe; D != -1; D = this.j.Tf(D)) { + switch (this.Um) { + case 3: + C = this.WD(D, m, _); + break; + case 4: + C = this.LG(D, m, _); + break; + case 5: + C = this.UU(D, m, _); + break; + default: + throw A.i.Ra(); + } + if (C) + break; + } + C || this.PJ(); + }, b.prototype.gr = function(m, _) { + this.j.fr(m, _); + }, b.prototype.Yo = function(m, _, C) { + this.TP(m, _, C), this.gr(m, C); + }, b.prototype.TP = function(m, _, C) { + for (A.Vk.W(m, _, C, !1), m.Ip(0, !0, !0), _ = m.md; _ != -1; _ = m.ve(_)) + m.jc(_) == 1736 && A.tn.W(m, _, -1, !1, C); + }, b.RE = function(m, _) { + var C = m.K(); + return A.ba.zd(C) ? ((_ = new A.Ua(m.description)).pc(m, !0), _) : C == 197 ? (C = new A.l(), m.A(C), C.da() <= _ && C.S() <= _ ? (_ = new A.Ta(m.description), m.tf(_), _) : C.da() <= _ || C.S() <= _ ? (_ = new A.Ua(m.description), C = new A.Ta(), m.If(0, C), _.nf(C), m.If(2, C), _.lineTo(C), _) : ((_ = new A.Ea(m.description)).bd(m, !1), _)) : m; + }, b; + }(), A.cm = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function b(m) { + this.Gm = new A.ja(0), this.fw = new A.ja(0), this.xt = new A.h(), this.yt = new A.h(), this.g = m, this.Js = -1; + } + return b.prototype.cc = function(m) { + return this.g.cc(this.uz(m)); + }, b.prototype.Dv = function(m) { + var _ = this.dz(m); + if (m = this.CF(m), this.g.Na(_) == m) { + var C = _; + _ = m, m = C; + } + return this.g.Hc(_, this.xt), this.g.Hc(m, this.yt), this.xt.y < this.yt.y; + }, b.prototype.uz = function(m) { + var _ = this.dz(m); + return m = this.CF(m), this.g.V(_) == m ? _ : m; + }, b.prototype.dz = function(m) { + return this.Gm.get(m); + }, b.prototype.CF = function(m) { + return this.fw.get(m); + }, b.prototype.mF = function(m) { + this.Gm.set(m, this.Js), this.Js = m; + }, b.prototype.iI = function(m) { + if (this.Js != -1) { + var _ = this.Js; + return this.Js = this.Gm.get(_), this.Gm.set(_, m), this.fw.set(_, this.g.V(m)), _; + } + return this.Gm == null && (this.Gm = new A.ja(0), this.fw = new A.ja(0)), _ = this.Gm.size, this.Gm.add(m), this.fw.add(this.g.V(m)), _; + }, b.prototype.mz = function(m) { + return this.g.cd(this.dz(m)); + }, b; + }(); + A.uY = ve; + var H = function() { + function b(m) { + this.Ce = m, this.je = new A.zb(), this.Pm = new A.zb(), this.xH = 0, this.Co = null, this.tA = -1; + } + return b.prototype.compare = function(m, _, C) { + C = m.ka(C); + var D = this.Ce.hb; + if (this.tA == _) + var L = this.xH; + else + this.Co = D.cc(_), this.Co == null ? ((m = D.g).fd(D.uz(_), this.je), this.Co = this.je, L = this.je.Me(this.Ce.Ah, 0)) : L = this.Co.Me(this.Ce.Ah, 0), this.xH = L, this.tA = _; + if ((m = D.cc(C)) == null) { + (m = D.g).fd(D.uz(C), this.Pm), m = this.Pm; + var B = this.Pm.Me(this.Ce.Ah, 0); + } else + B = m.Me(this.Ce.Ah, 0); + return L == B && (_ = D.Dv(_), C = D.Dv(C), (_ = 0.5 * ((C = Math.min(_ ? this.Co.ma : this.Co.oa, C ? m.ma : m.oa)) + this.Ce.Ah)) == this.Ce.Ah && (_ = C), L = this.Co.Me(_, 0), B = m.Me(_, 0)), L < B ? -1 : L > B ? 1 : 0; + }, b.prototype.reset = function() { + this.tA = -1; + }, b; + }(), T = function() { + function b() { + this.Ym = this.Il = null, this.fb = new A.$j(), this.fb.MP(), this.ae = new H(this), this.fb.Xo(this.ae); + } + return b.prototype.CQ = function() { + var m = !1; + if (this.hw && (m = this.DQ()), this.g.ea(this.Y) == 1) { + var _ = this.g.Ob(this.Y); + return m = this.g.qz(_), this.g.KB(_, !0), 0 > m && (m = this.g.Ya(_), this.g.kJ(m), this.g.Yg(_, this.g.Na(m)), !0); + } + for (this.Gl = this.g.Fy(), this.yo = this.g.Fy(), _ = this.g.Ob(this.Y); _ != -1; _ = this.g.Sb(_)) + this.g.ir(_, this.Gl, 0), this.g.ir(_, this.yo, -1); + _ = new A.ja(0), this.Ah = NaN; + var C = new A.h(); + this.ft = this.g.ea(this.Y), this.to = this.g.Hd(), this.Ts = this.g.Hd(); + for (var D = this.Il.sc(this.Il.ke); D != -1; D = this.Il.lb(D)) { + var L = this.Il.getData(D); + if (this.g.Hc(L, C), C.y != this.Ah && _.size != 0 && (m = this.vt(_) || m, this.ae.reset(), _.clear(!1)), _.add(L), this.Ah = C.y, this.ft == 0) + break; + } + for (0 < this.ft && (m = this.vt(_) || m, _.clear(!1)), this.g.Ud(this.to), this.g.Ud(this.Ts), _ = this.g.Ob(this.Y); _ != -1; ) + if (this.g.uj(_, this.Gl) == 3) { + for (this.g.KB(_, !0), C = _, _ = this.g.uj(_, this.yo); _ != -1; ) + D = this.g.uj(_, this.yo), this.g.UT(this.Y, this.g.Sb(C), _), C = _, _ = D; + _ = this.g.Sb(C); + } else + this.g.KB(_, !1), _ = this.g.Sb(_); + return this.g.xB(this.Gl), this.g.xB(this.yo), m; + }, b.prototype.vt = function(m) { + return this.VV(m); + }, b.prototype.VV = function(m) { + var _ = !1; + this.hb == null && (this.hb = new ve(this.g)), this.Ym == null ? (this.Ym = new A.ja(0), this.Ym.Jb(16)) : this.Ym.clear(!1), this.UV(m); + for (var C = 0, D = m.size; C < D; C++) { + var L = m.get(C); + L != -1 && this.jG(L, -1); + } + for (C = 0; C < this.Ym.size && 0 < this.ft; C++) + if (m = this.Ym.get(C), L = this.hb.mz(this.fb.ka(m)), D = -1, this.g.uj(L, this.Gl) == 0) { + L = this.fb.xe(m); + for (var B, q = m; L != -1; ) { + var Z = this.fb.ka(L), ie = this.hb.mz(Z), se = this.g.uj(ie, this.Gl); + if (se != 0) { + D = ie; + break; + } + q = L, L = this.fb.xe(L); + } + L == -1 ? (B = !0, L = q) : (Z = this.fb.ka(L), B = this.hb.Dv(Z), L = this.fb.lb(L), B = !B); + do { + if (Z = this.fb.ka(L), ie = this.hb.mz(Z), (se = this.g.uj(ie, this.Gl)) == 0 && (B != this.hb.Dv(Z) && (_ = this.g.Ya(ie), this.g.kJ(_), this.g.Yg(ie, this.g.Na(_)), _ = !0), this.g.ir(ie, this.Gl, B ? 3 : 2), B || (q = this.g.uj(D, this.yo), this.g.ir(D, this.yo, ie), this.g.ir(ie, this.yo, q)), this.ft--, this.ft == 0)) + return _; + D = ie, q = L, L = this.fb.lb(L), B = !B; + } while (q != m); + } + return _; + }, b.prototype.UV = function(m) { + for (var _ = 0, C = m.size; _ < C; _++) { + var D = m.get(_), L = this.g.Qa(D, this.to), B = this.g.Qa(D, this.Ts); + if (L != -1) { + var q = this.fb.ka(L); + this.hb.mF(q), this.g.Sa(D, this.to, -1); + } + B != -1 && (q = this.fb.ka(B), this.hb.mF(q), this.g.Sa(D, this.Ts, -1)), q = -1, L != -1 && B != -1 ? (this.fb.wd(L, -1), this.fb.wd(B, -1), m.set(_, -1)) : q = L != -1 ? L : B, q != -1 && (this.jG(D, q) || this.fb.wd(q, -1), m.set(_, -1)); + } + }, b.prototype.jG = function(m, _) { + var C = new A.h(), D = new A.h(); + this.g.Hc(m, C); + var L = this.g.V(m); + this.g.Hc(L, D); + var B = !1; + if (C.y < D.y) { + B = !0; + var q = this.hb.iI(m); + if (_ == -1) + var Z = this.fb.addElement(q, -1); + else + Z = _, this.fb.Uj(Z, q); + (q = this.g.Qa(L, this.to)) == -1 ? this.g.Sa(L, this.to, Z) : this.g.Sa(L, this.Ts, Z), L = this.g.cd(m), this.g.uj(L, this.Gl) == 0 && this.Ym.add(Z); + } + return L = this.g.Na(m), this.g.Hc(L, D), C.y < D.y && (B = !0, q = this.hb.iI(L), _ == -1 ? Z = this.fb.addElement(q, -1) : (Z = _, this.fb.Uj(Z, q)), (q = this.g.Qa(L, this.to)) == -1 ? this.g.Sa(L, this.to, Z) : this.g.Sa(L, this.Ts, Z), L = this.g.cd(m), this.g.uj(L, this.Gl) == 0 && this.Ym.add(Z)), B; + }, b.W = function(m, _, C, D) { + var L = new b(); + return L.g = m, L.Y = _, L.Il = C, L.hw = D, L.CQ(); + }, b.prototype.DQ = function() { + var m = new A.ja(0), _ = new A.ja(0), C = -1, D = -1, L = new A.h(); + L.Sc(); + for (var B = -1, q = -1, Z = -1, ie = new A.h(), se = this.Il.sc(this.Il.ke); se != -1; se = this.Il.lb(se)) { + var de = this.Il.getData(se); + this.g.Hc(de, ie); + var Ce = this.g.cd(de); + L.rb(ie) && q == Ce ? (D == -1 && (C = this.g.Fy(), D = this.g.Hd()), Z == -1 && (Z = _.size, this.g.Sa(B, D, Z), _.add(1), this.g.uj(Ce, C) == -1 && (this.g.ir(Ce, C, B), m.add(Ce))), this.g.Sa(de, D, Z), _.XW(_.Gc() + 1)) : (Z = -1, L.N(ie)), B = de, q = Ce; + } + if (m.size == 0) + return !1; + for (L = new A.ja(0), B = new A.ja(0), q = 0, Z = m.size; q < Z; q++) { + Ce = m.get(q); + var Ve = this.g.uj(Ce, C); + for (de = this.g.Qa(Ve, D), L.clear(!1), B.clear(!1), L.add(Ve), B.add(de), de = this.g.V(Ve); de != Ve; de = this.g.V(de)) { + var Je = de; + if ((ie = this.g.Qa(Je, D)) != -1) + if (B.size == 0) + B.add(ie), L.add(Je); + else if (B.Gc() == ie) { + se = L.Gc(); + var Pt = this.g.V(se); + Ve = this.g.V(Je), this.g.Cc(se, Ve), this.g.Dc(Ve, se), this.g.Cc(Je, Pt), this.g.Dc(Pt, Je), Je = [!1], Pt = this.g.iG(this.Y, Pt, this.g.Ya(Ce), Je), this.g.Sa(de, D, -1), Je[0] && this.g.Kf(Ce, Ve), de = this.g.Ka(Ce), de -= Ve = this.g.Ka(Pt), this.g.Xj(Ce, de), _.set(ie, _.get(ie) - 1), _.get(ie) == 1 && (_.set(ie, 0), B.Jf(), L.Jf()), de = Ve = se; + } else + L.add(de), B.add(ie); + } + } + return this.g.xB(C), this.g.Ud(D), !0; + }, b; + }(); + A.RL = T; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.prototype.jg = function() { + this.KA = this.tb = null; + }, H.prototype.get = function() { + return this.KA; + }, H.prototype.set = function(T) { + if (this.KA = T, T != null) + throw T.K() == 322 && (this.tb = T), A.i.Ra(); + }, H.prototype.create = function(T) { + if (T != 322) + throw A.i.ga("Not Implemented"); + this.Qr(); + }, H.prototype.Qr = function() { + this.tb == null && (this.tb = new A.zb()), this.KA = this.tb; + }, H; + }(); + A.jg = ve; + }(le || (le = {})), function(A) { + (A = A.SL || (A.SL = {}))[A.enumLineSeg = 1] = "enumLineSeg", A[A.enumBezierSeg = 2] = "enumBezierSeg", A[A.enumArcSeg = 4] = "enumArcSeg", A[A.enumNonlinearSegmentMask = 6] = "enumNonlinearSegmentMask", A[A.enumSegmentMask = 7] = "enumSegmentMask", A[A.enumDensified = 8] = "enumDensified"; + }(le || (le = {})), function(A) { + var ve = function(T) { + this.bj = T, this.lC = this.mC = 1, this.nB = this.mB = this.oB = 0; + }, H = function() { + function T() { + this.Hq = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], this.Dk = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], this.Cf = new A.Ta(), this.ra = this.Ew = 0, this.oo = [], this.bt = [], this.Aw = [], this.Kq = [], this.HA = []; + } + return T.prototype.rB = function(b) { + if (b != null) { + for (var m = 0, _ = b.length; m < _; m++) + this.mW(b[m]); + b.length = 0; + } + }, T.prototype.mW = function(b) { + b.bj = null, this.Kq.push(b); + }, T.prototype.Qw = function(b) { + if (this.Kq.length === 0) + var m = new ve(b); + else + (m = this.Kq[this.Kq.length - 1]).bj = b, --this.Kq.length; + return m; + }, T.prototype.NR = function(b, m) { + return b == 0 ? this.bt[m] : this.Aw[m]; + }, T.prototype.WA = function() { + this.Ew >= this.HA.length && this.HA.push(new A.jg()); + var b = this.HA[this.Ew]; + return this.Ew++, b; + }, T.prototype.clear = function() { + this.rB(this.oo), this.rB(this.bt), this.rB(this.Aw), this.Ew = 0; + }, T.prototype.Qo = function(b) { + this.oo.push(this.Qw(b)); + }, T.prototype.ql = function(b) { + return b == 0 ? this.bt.length : this.Aw.length; + }, T.prototype.Xp = function(b, m) { + return this.NR(b, m).bj; + }, T.prototype.Fa = function(b, m) { + if (this.oo.length != 2) + throw A.i.Ra(); + this.ra = b; + var _ = A.mc.ox(0.01 * b), C = !1, D = this.oo[0], L = this.oo[1]; + if (m || 5 & D.bj.Br(L.bj, b, !0)) { + if (D.bj.K() == 322) { + var B = D.bj; + if (L.bj.K() == 322) { + m = L.bj; + var q = A.zb.Yx(B, m, null, this.Hq, this.Dk, b); + if (q == 0) + throw A.zb.Yx(B, m, null, this.Hq, this.Dk, b), A.i.Ra(); + b = Array(9), A.P.bv(b, null); + for (var Z = 0; Z < q; Z++) { + var ie = this.Hq[Z], se = this.Dk[Z], de = D.nB, Ce = 1; + ie == 0 ? (de = D.oB, Ce = D.mC) : ie == 1 && (de = D.mB, Ce = D.lC); + var Ve = L.nB, Je = 1; + se == 0 ? (Ve = L.oB, Je = L.mC) : se == 1 && (Ve = L.mB, Je = L.lC); + var Pt = new A.h(); + de == Ve ? (de = new A.h(), B.ic(ie, de), ie = new A.h(), m.ic(se, ie), Je /= se = Ce + Je, A.mc.JG(de, ie, Je, Pt), A.h.zc(Pt, de) + A.h.zc(Pt, ie) > _ && (C = !0)) : de > Ve ? (B.ic(ie, Pt), ie = new A.h(), m.ic(se, ie), A.h.zc(Pt, ie) > _ && (C = !0)) : (m.ic(se, Pt), de = new A.h(), B.ic(ie, de), A.h.zc(Pt, de) > _ && (C = !0)), b[Z] = Pt; + } + for (D = 0, L = -1, Z = 0; Z <= q; Z++) + (Je = Z < q ? this.Hq[Z] : 1) != D && (_ = this.WA(), B.dh(D, Je, _), L != -1 && _.get().Ec(b[L]), Z != q && _.get().Rc(b[Z]), D = Je, this.bt.push(this.Qw(_.get()))), L = Z; + for (B = [0, 0, 0, 0, 0, 0, 0, 0, 0], Z = 0; Z < q; Z++) + B[Z] = Z; + for (1 < q && this.Dk[0] > this.Dk[1] && (Je = this.Dk[0], this.Dk[0] = this.Dk[1], this.Dk[1] = Je, Z = B[0], B[0] = B[1], B[1] = Z), D = 0, L = -1, Z = 0; Z <= q; Z++) + (Je = Z < q ? this.Dk[Z] : 1) != D && (_ = this.WA(), m.dh(D, Je, _), L != -1 && (D = B[L], _.get().Ec(b[D])), Z != q && (D = B[Z], _.get().Rc(b[D])), D = Je, this.Aw.push(this.Qw(_.get()))), L = Z; + return C; + } + } + throw A.i.Ra(); + } + return !1; + }, T.prototype.Fz = function(b, m, _) { + if (m.copyTo(this.Cf), this.oo.length != 1) + throw A.i.Ra(); + this.ra = b; + var C = this.oo[0]; + if (_ || C.bj.tu(m.D(), b, !0)) { + if (C.bj.K() != 322) + throw A.i.Ra(); + var D = (b = C.bj).ge(m.D(), !1); + this.Hq[0] = D; + var L = C.nB; + for (_ = 1, D == 0 ? (L = C.oB, _ = C.mC) : D == 1 && (L = C.mB, _ = C.lC), C = new A.h(), L == 0 ? (L = new A.h(), b.ic(D, L), m = m.D(), A.mc.JG(L, m, 1 / (_ + 1), C)) : 0 < L ? (C = new A.h(), b.ic(D, C)) : C = m.D(), _ = 0, D = -1, L = 0; 1 >= L; L++) { + if ((m = 1 > L ? this.Hq[L] : 1) != _) { + var B = this.WA(); + b.dh(_, m, B), D != -1 && B.get().Ec(C), L != 1 && B.get().Rc(C), _ = m, this.bt.push(this.Qw(B.get())); + } + D = L; + } + this.Cf.Db(C); + } + }, T; + }(); + A.OC = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + this.Fs = this.tk = this.tb = null, this.cg = 0, this.Bm = !1, this.Af = -1, this.El = this.Kd = 0, this.gb = -1, this.ib = T, this.cg = this.Vx(this.El), this.Bm = !1, this.tk = null, this.Fs = new A.h(); + } + return H.prototype.wW = function(T) { + if (this.ib != T.ib) + throw A.i.Hb(); + this.Af = T.Af, this.Kd = T.Kd, this.gb = T.gb, this.El = T.El, this.cg = T.cg, this.Bm = T.Bm, this.tk = null; + }, H.prototype.ia = function() { + if (this.Af != this.Kd && this.wD(), this.Bm) + this.Kd = (this.Kd + 1) % this.cg; + else { + if (this.Kd == this.cg) + throw A.i.de(); + this.Kd++; + } + return this.tk; + }, H.prototype.ni = function() { + if (this.Bm) + this.Kd = (this.cg + this.Kd - 1) % this.cg; + else { + if (this.Kd == 0) + throw A.i.de(); + this.Kd--; + } + return this.Kd != this.Af && this.wD(), this.tk; + }, H.prototype.xW = function() { + this.Af = -1, this.Kd = 0; + }, H.prototype.yW = function() { + this.Kd = this.cg, this.Af = -1; + }, H.prototype.Wb = function(T, b) { + if (b === void 0 && (b = -1), 0 <= this.gb && this.gb < this.ib.ea()) { + var m = this.DM(); + if (T >= m && T < this.ib.Wc(this.gb)) + return this.Af = -1, void (this.Kd = T - m); + } + b = 0 <= b && b < this.ib.ea() && T >= this.ib.Ca(b) && T < this.ib.Wc(b) ? b : this.ib.nz(T), this.El = b + 1, this.gb = b, this.Af = -1, this.Kd = T - this.ib.Ca(b), this.cg = this.Vx(b), this.ib.Ca(this.gb), this.ib.ec(this.gb); + }, H.prototype.ab = function() { + return this.gb = this.El, !(this.gb >= this.ib.ea()) && (this.Af = -1, this.Kd = 0, this.cg = this.Vx(this.gb), this.ib.Ca(this.gb), this.ib.ec(this.gb), this.El++, !0); + }, H.prototype.aj = function() { + this.cg = this.Kd = this.Af = -1, this.El = 0, this.gb = -1; + }, H.prototype.Vx = function(T) { + if (this.ib.Bc()) + return 0; + var b = 1; + return this.ib.ec(T) && (b = 0), this.ib.Ka(T) - b; + }, H.prototype.Qn = function() { + return this.Af == this.cg - 1 && this.ib.ec(this.gb); + }, H.prototype.EB = function() { + this.Bm = !0; + }, H.prototype.xb = function() { + return this.ib.nb.o[this.gb] + this.Af; + }, H.prototype.DM = function() { + return this.ib.Ca(this.gb); + }, H.prototype.kk = function() { + return this.Qn() ? this.ib.Ca(this.gb) : this.xb() + 1; + }, H.prototype.xm = function() { + return this.Af == 0; + }, H.prototype.Sn = function() { + return this.Af == this.cg - 1; + }, H.prototype.Ia = function() { + return this.Kd < this.cg; + }, H.prototype.zz = function() { + return 0 < this.Kd; + }, H.prototype.Qf = function() { + var T = new H(this.ib); + return T.Af = this.Af, T.Kd = this.Kd, T.cg = this.cg, T.gb = this.gb, T.El = this.El, T.ib = this.ib, T.Bm = this.Bm, T; + }, H.prototype.wD = function() { + if (0 > this.Kd || this.Kd >= this.cg) + throw A.i.de(); + this.Af = this.Kd; + var T = this.xb(); + this.ib.oc(); + var b = this.ib.Se, m = 1; + switch (b != null && (m = 7 & b.read(T)), b = this.ib.description, m) { + case 1: + this.tb == null && (this.tb = new A.zb()), this.tk = this.tb; + break; + case 2: + throw A.i.ga("internal error"); + default: + throw A.i.Ra(); + } + this.tk.Pf(b), m = this.kk(), this.ib.Hc(T, this.Fs), this.tk.Ec(this.Fs), this.ib.Hc(m, this.Fs), this.tk.Rc(this.Fs); + for (var _ = 1, C = b.Ba; _ < C; _++) + for (var D = b.ld(_), L = A.sa.Wa(D), B = 0; B < L; B++) { + var q = this.ib.Vc(D, T, B); + this.tk.TB(D, B, q), q = this.ib.Vc(D, m, B), this.tk.JB(D, B, q); + } + }, H.prototype.VS = function() { + return this.gb == this.ib.ea() - 1; + }, H.prototype.Rn = function() { + var T = this.ib.QR(); + return T != null && (7 & T.read(this.Af)) != 1; + }, H; + }(); + A.TL = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + T instanceof A.ba ? (this.sH = T, this.za = -1, this.Gi = 1) : (this.qT = T.slice(0), this.za = -1, this.Gi = T.length); + } + return H.prototype.Ma = function() { + return this.za; + }, H.prototype.next = function() { + return this.za < this.Gi - 1 ? (this.za++, this.sH != null ? this.sH : this.qT[this.za]) : null; + }, H.prototype.re = function() { + }, H; + }(); + A.$c = ve; + }(le || (le = {})), function(A) { + var ve = function() { + this.next = null; + }, H = function() { + function T() { + this.Vq = this.Mw = this.Nw = 0, this.fF = !1, this.bK = 0, this.jn = this.Lf = this.Yl = this.Lh = null, this.Ql = 0, this.qy = null, this.rl = this.ri = -1; + } + return T.prototype.wX = function(b, m, _) { + this.ri = b, this.rl = m, this.Lh = this.Yl = null, this.Vq = 0, this.qy = _, this.jn == null && (this.jn = A.P.mg(384, 0)), this.iK(); + }, T.prototype.S = function() { + return this.ri; + }, T.prototype.da = function() { + return this.rl; + }, T.prototype.flush = function() { + 0 < this.Ql && (this.qy.bF(this.jn, this.Ql), this.Ql = 0); + }, T.prototype.iK = function() { + if (0 < this.Vq) { + for (var b = 0; b < this.rl; b++) { + for (var m = this.Yl[b]; m != null; ) { + var _ = m; + m = m.next, _.next = null; + } + this.Yl[b] = null; + } + this.Lh = null; + } + this.Nw = this.rl, this.Mw = -1, this.Vq = 0; + }, T.prototype.dJ = function(b) { + for (this.fF = b == T.Bx, b = this.Nw; b <= this.Mw; b++) + this.nN(), this.gN(b), this.UP(); + this.iK(); + }, T.prototype.fy = function(b, m, _, C) { + if (m != C) { + var D = 1; + if (m > C && (D = b, b = _, _ = D, D = m, m = C, C = D, D = -1), !(0 > C || m >= this.rl)) { + 0 > b && 0 > _ ? _ = b = -1 : b >= this.ri && _ >= this.ri && (_ = b = this.ri); + var L = (_ - b) / (C - m); + C > this.rl && (_ = L * ((C = this.rl) - m) + b), 0 > m && (b = L * (0 - m) + b, m = 0); + var B = Math.max(this.ri + 1, 8388607); + -8388607 > b ? (m = (0 - b) / L + m, b = 0) : b > B && (m = (this.ri - b) / L + m, b = this.ri), -8388607 > _ ? C = (0 - b) / L + m : _ > B && (C = (this.ri - b) / L + m), (m = A.P.truncate(m)) != (C = A.P.truncate(C)) && ((_ = new ve()).x = A.P.truncate(4294967296 * b), _.y = m, _.H = C, _.RP = A.P.truncate(4294967296 * L), _.dir = D, this.Yl == null && (this.Yl = A.P.mg(this.rl, null)), _.next = this.Yl[_.y], this.Yl[_.y] = _, _.y < this.Nw && (this.Nw = _.y), _.H > this.Mw && (this.Mw = _.H), this.Vq++); + } + } + }, T.prototype.nN = function() { + if (this.Lh != null) { + for (var b = !1, m = null, _ = this.Lh; _ != null; ) + if (_.y++, _.y == _.H) { + var C = _; + _ = _.next, m != null ? m.next = _ : this.Lh = _, C.next = null; + } else + _.x += _.RP, m != null && m.x > _.x && (b = !0), m = _, _ = _.next; + b && (this.Lh = this.aK(this.Lh)); + } + }, T.prototype.gN = function(b) { + if (!(b >= this.rl)) { + var m = this.Yl[b]; + if (m != null) { + this.Yl[b] = null, m = this.aK(m), this.Vq -= this.bK, b = this.Lh; + for (var _ = !0, C = m, D = null; b != null && C != null; ) + b.x > C.x ? (_ && (this.Lh = C), _ = C.next, C.next = b, D != null && (D.next = C), D = C, C = _) : (_ = b.next, b.next = C, D != null && (D.next = b), D = b, b = _), _ = !1; + this.Lh == null && (this.Lh = m); + } + } + }, T.$J = function(b, m) { + return 0 > b ? 0 : b > m ? m : b; + }, T.prototype.UP = function() { + if (this.Lh != null) { + for (var b = 0, m = this.Lh, _ = A.P.truncate(A.P.SG(m.x)), C = m.next; C != null; C = C.next) + if (b = this.fF ? 1 ^ b : b + C.dir, C.x > m.x) { + var D = A.P.truncate(A.P.SG(C.x)); + b != 0 && (m = T.$J(_, this.ri), (_ = T.$J(D, this.ri)) > m && m < this.ri && (this.jn[this.Ql++] = m, this.jn[this.Ql++] = _, this.jn[this.Ql++] = C.y, this.Ql == this.jn.length && (this.qy.bF(this.jn, this.Ql), this.Ql = 0))), m = C, _ = D; + } + } + }, T.prototype.aK = function(b) { + for (var m = 0, _ = b; _ != null; _ = _.next) + m++; + if (this.bK = m, m == 1) + return b; + this.Lf == null ? this.Lf = A.P.mg(Math.max(m, 16), null) : this.Lf.length < m && (this.Lf = A.P.mg(Math.max(m, 2 * this.Lf.length), null)); + var C = 0; + for (_ = b; _ != null; _ = _.next) + this.Lf[C++] = _; + for (m == 2 ? this.Lf[0].x > this.Lf[1].x && (b = this.Lf[0], this.Lf[0] = this.Lf[1], this.Lf[1] = b) : T.vN(this.Lf, m, function(D, L) { + return D == L ? 0 : D.x < L.x ? -1 : D.x > L.x ? 1 : 0; + }), b = this.Lf[0], this.Lf[0] = null, _ = b, C = 1; C < m; C++) + _.next = this.Lf[C], _ = this.Lf[C], this.Lf[C] = null; + return _.next = null, b; + }, T.vN = function(b, m, _) { + if (m == b.length) + b.sort(_); + else { + var C = b.slice(0, 0), D = b.slice(m); + m = b.slice(0, m).sort(_), b.length = 0, b.push.apply(b, C.concat(m).concat(D)); + } + }, T.Bx = 0, T; + }(); + A.Ox = H; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.prototype.wi = function(T, b) { + var m = this.g.Qa(T, this.Rq); + if (this.Fl == m && (this.Fl = this.pe.lb(this.Fl)), this.jo == m && (this.jo = this.pe.lb(this.jo)), this.pe.kd(this.MA, m), this.dk(T), b && (b = this.g.cd(T)) != -1 && this.g.Ya(b) == T) { + var _ = this.g.V(T); + if (_ != T) { + if ((m = this.g.cd(_)) == b) + return void this.g.Kf(b, _); + if ((_ = this.g.Na(T)) != T && (m = this.g.cd(_)) == b) + return void this.g.Kf(b, _); + } + this.g.Kf(b, -1), this.g.Yg(b, -1); + } + }, H.prototype.kD = function() { + for (var T = !1, b = new A.h(); ; ) { + this.Yh == null ? (this.Yh = new A.ja(0), this.Bs = new A.ja(0), this.ye = new A.ja(0)) : (this.Yh.clear(!1), this.Bs.clear(!1), this.ye.clear(!1)); + for (var m = this.jo, _ = 0, C = !0; m != this.Fl; ) { + var D = this.pe.getData(m), L = new A.h(); + this.g.Hc(D, L), C && (this.g.Hc(D, b), C = !1), L = this.g.Na(D); + var B = this.g.V(D); + this.g.Qa(L, this.Ag) != -559038737 && (this.Yh.add(L), this.g.Sa(L, this.Ag, -559038737), this.Bs.add(D), this.ye.add(_++)), this.g.Qa(B, this.Ag) != -559038737 && (this.Yh.add(B), this.g.Sa(B, this.Ag, -559038737), this.Bs.add(D), this.ye.add(_++)), m = this.pe.lb(m); + } + if (2 > this.Yh.size) + break; + var q = this; + for (this.ye.Wd(0, this.ye.size, function(Z, ie) { + return q.kM(Z, ie); + }), m = 0, _ = this.ye.size; m < _; m++) + C = this.ye.get(m), C = this.Yh.get(C), this.g.Sa(C, this.Ag, m), L = new A.h(), this.g.Hc(C, L); + for (L = this.OM(b), m = 0, _ = this.ye.size; m < _; m++) + (C = this.ye.get(m)) != -1 && (C = this.Yh.get(C), this.g.Sa(C, this.Ag, -1)); + if (!L) + break; + T = !0; + } + return T; + }, H.prototype.OM = function(T) { + for (var b = !1, m = !0; m; ) { + m = !1; + var _ = 0; + this.ye.get(_) == -1 && (_ = this.em(_)); + for (var C = this.em(_), D = 0, L = this.ye.size; D < L && _ != -1 && C != -1 && _ != C; D++) { + var B = this.ye.get(_); + C = this.ye.get(C), B = this.Yh.get(B), C = this.Yh.get(C); + var q = this.g.V(B); + this.g.Fv(q, T) || (q = this.g.Na(B)); + var Z = this.g.V(C); + this.g.Fv(Z, T) || (Z = this.g.Na(C)); + var ie = this.ru(q, B), se = this.ru(Z, C), de = ie ? this.g.Na(q) : this.g.V(q), Ce = se ? this.g.Na(Z) : this.g.V(Z), Ve = !1; + (this.up(q) || this.up(Z) || this.up(B) || this.up(C) || this.up(de) || this.up(Ce)) && (Ve = !0), !Ve && this.g.hq(B, C) && (Ve = !0, this.oD(ie, se, q, B, Z, C)), !Ve && this.g.hq(de, Ce) && (Ve = !0, this.oD(!ie, !se, q, de, Z, Ce)), Ve && (b = !0), m = m || Ve, _ = this.em(_), C = this.em(_); + } + } + if (!b) + for (_ = 0, this.ye.get(_) == -1 && (_ = this.em(_)), C = this.em(_), D = 0, L = this.ye.size; D < L && _ != -1 && C != -1 && _ != C; D++) + B = this.ye.get(_), C = this.ye.get(C), B = this.Yh.get(B), C = this.Yh.get(C), q = this.g.V(B), this.g.Fv(q, T) || (q = this.g.Na(B)), Z = this.g.V(C), this.g.Fv(Z, T) || (Z = this.g.Na(C)), ie = this.ru(q, B), se = this.ru(Z, C), de = ie ? this.g.Na(q) : this.g.V(q), Ce = se ? this.g.Na(Z) : this.g.V(Z), this.yM(ie, se, B, q, de, C, Z, Ce) && (b = !0), _ = this.em(_), C = this.em(_); + return b; + }, H.prototype.SM = function() { + this.g.jc(this.Y) == 1736 && this.g.Kn(this.Y) == 1 && new A.Hg().HU(this.hw, this.g, this.Y, this.od); + var T = !1, b = !0; + this.Ag = this.Rq = -1; + var m = this.g.I(this.Y), _ = new A.ja(0); + _.Jb(m); + for (var C = this.g.Ob(this.Y); C != -1; C = this.g.Sb(C)) + for (var D = this.g.Ya(C), L = 0, B = this.g.Ka(C); L < B; L++) + _.add(D), D = this.g.V(D); + var q = this.g.ud.o, Z = this.g.ud.Mf; + this.g.wb.oc(); + var ie = this.g.wb.Aa[0].o; + for (_.Wd(0, m, function(de, Ce) { + var Ve = q[Z * de], Je = q[Z * Ce], Pt = ie[2 * Ve]; + Ve = ie[2 * Ve + 1]; + var $t = ie[2 * Je]; + return (Pt = Ve < (Je = ie[2 * Je + 1]) ? -1 : Ve > Je ? 1 : Pt < $t ? -1 : Pt > $t ? 1 : 0) == 0 && (Pt = (de = q[Z * de + 3]) < (Ce = q[Z * Ce + 3]) ? -1 : de == Ce ? 0 : 1), Pt; + }), this.Rq = this.g.Hd(), this.pe = new A.lp(), this.MA = this.pe.Rh(0), this.pe.hn(m), C = 0; C < m; C++) + D = _.get(C), L = this.pe.addElement(this.MA, D), this.g.Sa(D, this.Rq, L); + for (this.Ag = this.g.Hd(), this.Fl = -1, this.YC() && (T = !0); b; ) { + b = !1, m = 0, _ = !1; + do { + _ = !1, this.jo = -1, B = 0, C = new A.h(), L = new A.h(); + for (var se = this.pe.sc(this.MA); se != -1; ) + D = this.pe.getData(se), this.jo != -1 ? (this.g.Hc(D, L), C.rb(L) ? B++ : (C.N(L), this.Fl = se, 0 < B && (D = this.kD()) && (_ = !0, this.Fl != -1 && (D = this.pe.getData(this.Fl), this.g.Hc(D, C))), this.jo = se = this.Fl, B = 0)) : (this.jo = se, this.g.Hc(this.pe.getData(se), C), B = 0), se != -1 && (se = this.pe.lb(se)); + if (this.Fl = -1, 0 < B && (D = this.kD()) && (_ = !0), 10 < m++) + throw A.i.Ra(); + _ && this.BM(), this.YC() && (_ = !0), b = b || _ && !1, T = T || _; + } while (_); + } + return this.g.Ud(this.Rq), this.g.Ud(this.Ag), A.RL.W(this.g, this.Y, this.pe, this.hw) || T; + }, H.prototype.ru = function(T, b) { + return this.g.V(b) != T; + }, H.prototype.yM = function(T, b, m, _, C, D, L, B) { + if (_ == L) + return this.dk(m), this.dk(D), !1; + var q = this.g.Qa(m, this.Ag), Z = this.g.Qa(C, this.Ag), ie = this.g.Qa(D, this.Ag), se = this.g.Qa(B, this.Ag), de = [0, 0, 0, 0]; + for ((m = [0, 0, 0, 0, 0, 0, 0, 0])[0] = 0, de[0] = q, m[1] = 0, de[1] = Z, m[2] = 1, de[2] = ie, m[3] = 1, de[3] = se, q = 1; 4 > q; q++) { + for (Z = de[q], ie = m[q], se = q - 1; 0 <= se && de[se] > Z; ) + de[se + 1] = de[se], m[se + 1] = m[se], se--; + de[se + 1] = Z, m[se + 1] = ie; + } + return de = 0, m[0] != 0 && (de |= 1), m[1] != 0 && (de |= 2), m[2] != 0 && (de |= 4), m[3] != 0 && (de |= 8), (de == 5 || de == 10) && (T == b ? T ? (this.g.Cc(B, _), this.g.Dc(_, B), this.g.Cc(C, L), this.g.Dc(L, C)) : (this.g.Dc(B, _), this.g.Cc(_, B), this.g.Dc(C, L), this.g.Cc(L, C)) : T ? (this.g.Dc(_, D), this.g.Cc(D, _), this.g.Dc(L, C), this.g.Cc(C, L)) : (this.g.Cc(_, D), this.g.Dc(D, _), this.g.Cc(L, C), this.g.Dc(C, L)), !0); + }, H.prototype.oD = function(T, b, m, _, C, D) { + this.IY ? this.QM() : this.PM(T, b, m, _, C, D); + }, H.prototype.QM = function() { + throw A.i.ga("not implemented."); + }, H.prototype.PM = function(T, b, m, _, C, D) { + if (T != b) + T ? (this.g.Cc(m, C), this.g.Dc(C, m), this.g.Cc(D, _), this.g.Dc(_, D), this.xn(C, m), this.wi(C, !0), this.g.oi(C, !0), this.dk(m), this.xn(D, _), this.wi(D, !0), this.g.oi(D, !1)) : (this.g.Cc(C, m), this.g.Dc(m, C), this.g.Cc(_, D), this.g.Dc(D, _), this.xn(C, m), this.wi(C, !0), this.g.oi(C, !1), this.dk(m), this.xn(D, _), this.wi(D, !0), this.g.oi(D, !0)), this.dk(_); + else { + var L = T ? m : _, B = b ? C : D; + for (T = T ? _ : m, b = b ? D : C, C = !1, this.g.Cc(L, B), this.g.Cc(B, L), this.g.Dc(T, b), this.g.Dc(b, T), D = b; D != B; ) + m = this.g.Na(D), _ = this.g.V(D), this.g.Dc(D, _), this.g.Cc(D, m), C = C || D == L, D = _; + C || (m = this.g.Na(B), _ = this.g.V(B), this.g.Dc(B, _), this.g.Cc(B, m)), this.xn(B, L), this.wi(B, !0), this.g.oi(B, !1), this.dk(L), this.xn(b, T), this.wi(b, !0), this.g.oi(b, !1), this.dk(T); + } + }, H.prototype.YC = function() { + for (var T = !1, b = this.g.Ob(this.Y); b != -1; ) { + for (var m = this.g.Ya(b), _ = 0, C = this.g.Ka(b); _ < C && 1 < C; ) { + var D = this.g.Na(m), L = this.g.V(m); + this.g.hq(D, L) ? (T = !0, this.wi(m, !1), this.g.qd(m, !0), this.wi(L, !1), this.g.qd(L, !0), m = D, _ = 0, C = this.g.Ka(b)) : (m = L, _++); + } + if (2 > this.g.Ka(b)) { + for (T = this.g.Ya(b), _ = 0, C = this.g.Ka(b); _ < C; _++) + this.wi(T, !1), T = this.g.V(T); + b = this.g.ar(b), T = !0; + } else + b = this.g.Sb(b); + } + return T; + }, H.prototype.up = function(T) { + for (var b = !1; ; ) { + var m = this.g.V(T), _ = this.g.Na(T); + if (m == T) + return this.wi(T, !0), this.g.oi(T, !1), !0; + if (!this.g.hq(m, _) || (b = !0, this.dk(_), this.dk(m), this.wi(T, !0), this.g.oi(T, !1), this.xn(m, _), this.wi(m, !0), this.g.oi(m, !0), m == _)) + break; + T = _; + } + return b; + }, H.prototype.BM = function() { + for (var T = 0, b = this.pe.sc(this.pe.ke); b != -1; b = this.pe.lb(b)) { + var m = this.pe.getData(b); + this.g.cj(m, -1); + } + for (var _ = 0, C = this.g.Ob(this.Y); C != -1; ) + if ((b = this.g.Ya(C)) == -1 || this.g.cd(b) != -1) + m = C, C = this.g.Sb(C), this.g.br(m); + else { + this.g.cj(b, C); + var D = 1; + for (m = this.g.V(b); m != b; m = this.g.V(m)) + this.g.cj(m, C), D++; + this.g.fp(C, !1), this.g.Xj(C, D), this.g.Yg(C, this.g.Na(b)), _ += D, T++, C = this.g.Sb(C); + } + for (b = this.pe.sc(this.pe.ke); b != -1; b = this.pe.lb(b)) + m = this.pe.getData(b), this.g.cd(m) == -1 && (C = this.g.iG(this.Y, m, m, null), _ += this.g.Ka(C), T++); + for (this.g.Tl(this.Y, T), this.g.Vj(this.Y, _), T = 0, _ = this.g.md; _ != -1; _ = this.g.ve(_)) + T += this.g.I(_); + this.g.XB(T); + }, H.prototype.em = function(T) { + for (var b = 0, m = this.ye.size - 1; b < m; b++) + if (T = (T + 1) % this.ye.size, this.ye.get(T) != -1) + return T; + return -1; + }, H.prototype.xn = function(T, b) { + var m = this.g.Qa(b, this.Rq), _ = this.g.Qa(b, this.Ag); + this.g.gC(T, b), this.g.Sa(b, this.Rq, m), this.g.Sa(b, this.Ag, _); + }, H.prototype.dk = function(T) { + var b = this.g.Qa(T, this.Ag); + b != -1 && (this.ye.set(b, -1), this.g.Sa(T, this.Ag, -1)); + }, H.W = function(T, b, m, _, C) { + var D = new H(); + return D.g = T, D.Y = b, D.sA = m, D.hw = _, D.od = C, D.SM(); + }, H.prototype.kM = function(T, b) { + var m = this.Yh.get(T), _ = new A.h(); + this.g.Hc(m, _), m = new A.h(); + var C = this.Yh.get(b); + return this.g.Hc(C, m), _.rb(m) ? 0 : (C = this.Bs.get(T), T = new A.h(), this.g.Hc(C, T), C = this.Bs.get(b), b = new A.h(), this.g.Hc(C, b), (C = new A.h()).vc(_, T), (_ = new A.h()).vc(m, b), A.h.pu(C, _)); + }, H; + }(); + A.tn = ve; + }(le || (le = {})), function(A) { + var ve; + (ve = A.VL || (A.VL = {}))[ve.Local = 0] = "Local", ve[ve.Geographic = 1] = "Geographic", ve[ve.Projected = 2] = "Projected", ve[ve.Image = 3] = "Image", ve[ve.Unknown = 4] = "Unknown", function(T) { + T[T.Integer32 = 0] = "Integer32", T[T.Integer64 = 1] = "Integer64", T[T.FloatingPoint = 2] = "FloatingPoint"; + }(A.OL || (A.OL = {})); + var H = function() { + function T() { + this.hA = null, this.rp = "", this.uu = null, this.fg = 0, this.UH = this.Jo = -1, this.yh = null; + } + return T.prototype.Fc = function() { + return this.fg; + }, T.prototype.QF = function() { + return 1; + }, T.prototype.QW = function(b) { + this.hA = b; + }, T.prototype.Yd = function() { + if (this.hA !== null) + return this.hA; + var b = 1e-3; + return this.fg != 0 ? b = A.yr.xQ(this.fg) : this.yh != null && (b = A.SC.yQ(this.yh)), b; + }, T.prototype.wz = function() { + return this.yh; + }, T.prototype.Id = function() { + return this.fg != 0 ? A.Uc.ah(A.yr.Ny(this.fg)) : this.yh != null ? A.SC.zQ(this.yh) : void 0; + }, T.Tb = function(b) { + if (b.fg != 0) { + if (A.yr.US(b.fg) === !0) + return 1; + if (A.yr.WS(b.fg) === !0) + return 2; + } + return 4; + }, T.prototype.cs = function() { + var b = this.Fc(); + return this.Jo != -1 ? this.Jo : (this.Jo = A.yr.AK(b), this.Jo != -1 ? this.Jo : b); + }, T.create = function(b) { + if (0 >= b) + throw A.i.O("Invalid or unsupported wkid: " + b); + var m = new T(); + return m.fg = b, m; + }, T.lP = function(b) { + if (b == null || b.length == 0) + throw A.i.O("Cannot create SpatialReference from null or empty text."); + var m = new T(); + return m.yh = b, m; + }, T.prototype.Nb = function(b) { + return this == b || b != null && this.constructor == b.constructor && this.fg == b.fg && (this.fg != 0 || this.yh === b.yh); + }, T.prototype.toString = function() { + return "[ tol: " + this.Mn() + "; wkid: " + this.Fc() + "; wkt: " + this.wz() + "]"; + }, T.prototype.dc = function() { + if (this.rp !== "") + return this.rp; + var b = this.toString(); + if (Array.prototype.reduce) + return this.rp = "S" + b.split("").reduce(function(C, D) { + return (C = (C << 5) - C + D.charCodeAt(0)) & C; + }, 0); + var m = 0; + if (b.length === 0) + return ""; + for (var _ = 0; _ < b.length; _++) + m = (m << 5) - m + b.charCodeAt(_), m &= m; + return this.rp = "S" + m; + }, T.prototype.Mn = function() { + return this.Yd(0); + }, T.prototype.hh = function() { + return this.uu !== null ? this.uu : this.uu = A.iu.tP(this); + }, T.UN = 2147483645, T.VN = 9007199254740990, T; + }(); + A.Gg = H; + }(le || (le = {})), function(A) { + var ve = function(H) { + function T() { + var b = H !== null && H.apply(this, arguments) || this; + return b.Li = null, b.NT = null, b.Jq = new A.UL(), b.Go = null, b.lw = null, b; + } + return Ne(T, H), T.tP = function(b) { + var m = new T(); + if (m.fg = b.fg, m.Jo = b.Jo, m.UH = b.UH, m.yh = b.yh, m.yh !== "" && m.yh !== null) { + b = T.fM(m.yh); + var _ = T.dM(m.yh); + m.Jq.Wx(b, _, A.ju.Integer64), m.ay(b), m.cy(_), m.fg = b.cs(); + } else + b = T.eM(m.fg), m.ay(b), m.cy(null), m.Jq.Wx(b, null, A.ju.Integer64); + return m; + }, T.prototype.Yd = function(b) { + return this.Jq.Mn(b); + }, T.dM = function(b) { + if (0 >= b.length) + throw A.i.O(); + var m = null; + try { + m = A.IC.fromString(b); + } catch { + m = null; + } + return m == null ? null : T.XC(m, !0); + }, T.prototype.ay = function(b) { + this.Ld = b, this.Go = this.Ld.Id(); + }, T.prototype.cy = function(b) { + this.FH = b, this.NT = this.FH != null ? this.FH.Go : null; + }, T.prototype.Xc = function() { + return this.Tb() != 0 && this.Tb() != 3 && this.Ld.Xc(); + }, T.prototype.DG = function() { + return this.Tb() != 0 && (this.Tb() == 3 ? this.Li.hk().Xc() : this.Ld.Xc()); + }, T.prototype.gh = function() { + return this.Ld != null ? this.Ld.Re : null; + }, T.prototype.rm = function() { + return this.Ld.rm(); + }, T.prototype.bf = function() { + return this.Ld.bf(); + }, T.prototype.jh = function() { + return this.Ld != null ? this.Ld.uw : NaN; + }, T.prototype.Wp = function() { + return this.Ld.Wp(); + }, T.prototype.Yr = function() { + return this.Ld.Yr(); + }, T.prototype.mk = function() { + return this.Ld.mk(); + }, T.prototype.fS = function(b) { + return A.JC.Ky(this.Ld, b.Ld); + }, T.prototype.ol = function() { + return this.Ld.ol(); + }, T.prototype.Xr = function() { + return this.Ld.Xr(); + }, T.prototype.Bi = function() { + return this.Tb() == 3 ? this.Li.hk().Bi() : this.Ld.Bi(); + }, T.prototype.ih = function() { + if (!this.Xc()) + throw A.i.O("!isPannable()"); + var b = new A.l(); + return this.Ld.ih(b), b; + }, T.prototype.Le = function() { + if (!this.Xc()) + throw A.i.O("!isPannable()"); + return this.Ld.uo; + }, T.prototype.CR = function() { + if (!this.Xc()) + throw A.i.O("!isPannable()"); + var b = new A.l(); + return this.Ld.BR(b), b; + }, T.prototype.rv = function() { + if (!this.Xc()) + throw A.i.O("!isPannable()"); + return this.Ld.rv(); + }, T.prototype.qv = function() { + if (!this.Xc()) + throw A.i.O("!isPannable()"); + return this.Ld.qv(); + }, T.prototype.Zr = function() { + return this.Li != null ? this.Li.hk().Zr() : this.Ld.Zr(); + }, T.prototype.KQ = function() { + return this.Ld.kv(); + }, T.prototype.Sp = function() { + return this.Go.getUnitFactor(); + }, T.prototype.pz = function(b) { + return this.Jq.pz(b); + }, T.prototype.tc = function() { + var b = this.Tb(); + if (b == 1) + return this; + if (b == 3) + return this.Li.hk().tc(); + if (b == 0 || b === 4) + throw A.i.ga("invalid call"); + if (this.lw !== null) + return this.lw; + if ((b = this.gh().getGeogcs()) == null) + throw A.i.Ra(); + return this.lw = T.XE(b, this.Jq.QF()); + }, T.XE = function(b, m) { + if (b == null) + throw A.i.O("null pointer."); + var _ = new T(); + return b = T.ou(b, !0), _.Jq.Wx(b, null, m), _.ay(b), _.cy(null), _.fg = b.cs(), _; + }, T.prototype.Tb = function() { + var b = this.gh(); + if (b != null) + switch (b.getType()) { + case A.Tc.PE_TYPE_GEOGCS: + return 1; + case A.Tc.PE_TYPE_PROJCS: + return 2; + } + return 4; + }, T.prototype.kv = function() { + return this.Ld.kv(); + }, T.ou = function(b, m) { + var _ = b.getCode(); + if (0 >= _ && 0 < (_ = A.qf.getCode(b))) { + if ((b = A.qf.coordsys(_)) == null) + throw A.i.O("Text to wkid mapping had failed: " + _); + return T.ou(b, m); + } + if (m && 0 < _ && (m = T.qx[_])) + return m; + m = A.Ab.zv(b, _, !1); + var C = T.gK[m]; + return C || (b = 0 >= _ ? b : A.qf.coordsys(_), b = new A.JC(b), T.gK[m] = b, 0 < _ && (T.qx[_] = b), b); + }, T.eM = function(b) { + if (0 >= b) + throw A.i.O("Invalid or unsupported wkid: " + b); + var m = T.qx[b]; + if (m != null) + return m; + if ((m = A.qf.coordsys(b)) == null) + throw A.i.O("Invalid or unsupported wkid: " + b); + return (m = T.ou(m, !1)).cs() != b && (T.qx[b] = m), m; + }, T.fM = function(b) { + if (b == null || b === void 0 || b.length == 0) + throw A.i.O("Cannot create SpatialReference from null or empty text."); + var m = null; + try { + m = A.qf.fromString(A.Tc.PE_TYPE_COORDSYS, b); + } catch (_) { + throw A.i.O("Cannot create SpatialReference from text. " + _.message); + } + if (m === null) + throw A.i.O("Cannot create SpatialReference from text. "); + return T.ou(m, !0); + }, T.XC = function(b, m) { + var _, C = b.getCode(); + if (0 >= C && 0 < (C = A.qf.getCode(b))) { + if ((C = A.qf.vertcs(C)) === null) + throw A.i.O(); + return T.XC(C, m); + } + if (m && 0 < C && (m = T.fK[C]) || (b = A.Ab.zv(b, C, !1), m = T.hK[b])) + return m; + if (0 >= C || (_ = A.qf.vertcs(C)), _ === null) + throw A.i.O(); + return _ = new A.KL(_), T.hK[b] = _, 0 < C && (T.fK[C] = _), _; + }, T.nI = function(b, m) { + if (m === null || m.B()) + return null; + var _ = new A.l(); + if (m !== null && b.Tb() != 1) { + var C = b.tc(), D = C.gh(); + b = A.xr.Pr(b, C, null, null), (m = A.Gx.local().W(m, b, null)).A(_); + } else + D = b.gh(), m.A(_); + return m = D.getPrimem().getLongitude(), D = D.getUnit().getUnitFactor(), new A.GC(_.v, _.G, _.C, _.H, m, D); + }, T.gD = function(b) { + var m = { name: "", steps: [], _pt: null, _entry: null }, _ = 0; + for (b = b.getEntries(); _ < b.length; _++) { + var C = b[_], D = { HY: !1, VY: "", UY: -1, geogtran: null }; + C.getDirection() === 0 ? D.isInverse = !1 : D.isInverse = !0; + var L = C.getGeogtran().getCode(); + -1 < L ? D.wkid = L : D.wkt = C.getGeogtran().toString(), m.steps.push(D); + } + return m; + }, T.SR = function(b, m, _, C) { + return _ === void 0 && (_ = null), _ = T.nI(C, _), b = A.np.getGTlist(b.gh(), m.gh(), 2, A.np.PE_GTLIST_OPTS_COMMON, _, 1), m = null, b && 0 < b.length && (m = this.gD(b[0]), A.Lx.destroy(b)), _ !== null && _.destroy(), m; + }, T.TR = function(b, m, _, C) { + var D; + if (_ === void 0 && (_ = null), C === void 0 && (C = null), D === void 0 && (D = 30), _ = T.nI(C, _), b = A.np.getGTlist(b.gh(), m.gh(), 2, A.np.PE_GTLIST_OPTS_COMMON, _, D), m = [], b && 0 < b.length) { + for (D = 0; D < b.length; D++) + m.push(this.gD(b[D])); + A.Lx.destroy(b); + } + return _ !== null && _.destroy(), m; + }, T.qx = {}, T.gK = {}, T.fK = {}, T.hK = {}, T; + }(A.Gg); + A.iu = ve; + }(le || (le = {})), function(A) { + var ve, H; + (H = ve = A.ju || (A.ju = {}))[H.Integer32 = 0] = "Integer32", H[H.Integer64 = 1] = "Integer64", H[H.FloatingPoint = 2] = "FloatingPoint"; + var T = function() { + function b() { + this.sp(); + } + return b.prototype.assign = function(m) { + this.Hm = m.Hm, this.Im = m.Im, this.Rj = m.Rj, this.nA = m.nA, this.Ho = m.Ho, this.mA = m.mA, this.Kk = m.Kk, this.Oq = m.Oq, this.Nq = m.Nq, this.Tm = m.Tm; + }, b.prototype.QF = function() { + return this.Tm; + }, b.prototype.sp = function() { + this.Im = this.Hm = 0, this.Rj = 1, this.nA = 0, this.Ho = 1, this.mA = 0, this.Nq = this.Oq = this.Kk = 2220446049250313e-29, this.Tm = ve.FloatingPoint; + }, b.prototype.Wx = function(m, _, C) { + if (this.sp(), this.Tm = C, C != ve.FloatingPoint) { + var D = new A.l(); + m.cR(D), this.Hm = D.v, this.Im = D.G; + } else + this.Im = this.Hm = -17976931348623157e292; + (D = m.Re.getType()) == A.Tc.PE_TYPE_GEOGCS ? (D = (C == ve.Integer64 ? 1e-9 : 1 / 18e5) * m.bf(), this.Rj = 1 / D) : D == A.Tc.PE_TYPE_PROJCS && (D = (C == ve.Integer64 ? 1e-4 : 1e-3) * m.rm(), this.Rj = 1 / D), _ != null ? (D = (C == ve.Integer32 ? 1e-3 : 1e-4) * _.DH, this.Ho = 1 / D) : this.Ho = 1e4, this.TM(), this.Kk = m.uw, this.Oq = _ != null ? 1e-3 * _.DH : 1e-3, this.Nq = 2220446049250313e-29; + }, b.prototype.TM = function() { + if (this.Tm != ve.FloatingPoint) { + var m = this.Tm == ve.Integer64 ? A.Gg.VN : A.Gg.UN, _ = m / this.Rj, C = this.Hm + _, D = A.P.truncate((C - this.Hm) * this.Rj); + D > m && (this.Rj = m / (C - this.Hm)), _ = this.Im + _, (D = A.P.truncate((_ - this.Im) * this.Rj)) > m && (this.Rj = m / (_ - this.Im)); + } + }, b.prototype.WB = function(m) { + switch (m) { + case 0: + this.Kk = void 0; + case 1: + this.Oq = void 0; + case 2: + this.Nq = void 0; + } + }, b.prototype.Mn = function(m) { + switch (m) { + case 0: + return this.Kk; + case 1: + return this.Oq; + case 2: + return this.Nq; + } + return 0; + }, b.prototype.pz = function(m) { + if (this.Tm == ve.FloatingPoint) + return 0; + switch (m) { + case 0: + return 1 / this.Rj; + case 1: + case 2: + return 1 / this.Ho; + default: + return 0; + } + }, b.prototype.toString = function() { + var m = "SRPD [m_toleranceXY: " + this.Kk.toString(); + return (m = (m = (m = (m = (m = (m = (m = (m = (m = m + ";m_falseX: " + this.Hm.toString()) + ";m_falseY: " + this.Im.toString()) + ";m_unitsXY: " + this.Rj.toString()) + ";m_falseZ: " + this.nA.toString()) + ";m_unitsZ: " + this.Ho.toString()) + ";m_falseM: " + this.mA.toString()) + ";m_toleranceZ: " + this.Oq.toString()) + ";m_toleranceM: " + this.Nq.toString()) + ";m_precision: " + this.Tm.toString()) + "] "; + }, b; + }(); + A.UL = T; + }(le || (le = {})), function(A) { + function ve(C, D) { + return 89.99999 < D ? D = 89.99999 : -89.99999 > D && (D = -89.99999), D *= 0.017453292519943, [111319.49079327169 * C, 31890685e-1 * Math.log((1 + Math.sin(D)) / (1 - Math.sin(D)))]; + } + function H(C, D, L) { + return C = C / 6378137 * 57.29577951308232, L ? [C, 57.29577951308232 * (1.5707963267948966 - 2 * Math.atan(Math.exp(-1 * D / 6378137)))] : [C - 360 * Math.floor((C + 180) / 360), 57.29577951308232 * (1.5707963267948966 - 2 * Math.atan(Math.exp(-1 * D / 6378137)))]; + } + function T(C, D, L) { + var B = C.Qf(); + if (C.K() === 33) + D = D(B.Ng(), B.kh()), B.Db(D[0], D[1]); + else if (C.K() === 197) { + var q = D(C.gs(), C.js(), L); + D = D(C.fs(), C.hs(), L), B.L(q[0], q[1], D[0], D[1]); + } else + for (q = new A.h(), C = 0; C < B.I(); C++) { + B.D(C, q); + var Z = D(q.x, q.y, L); + q.na(Z[0], Z[1]), B.Db(C, q); + } + return B; + } + function b(C) { + return T(C, H, !0); + } + function m(C) { + return T(C, ve, !0); + } + var _ = Math.PI / 180; + A.PK = function() { + function C() { + } + return C.xu = function(D) { + var L = Math.sqrt(0.006694379990197414), B = Math.sin(D.y * _); + return A.h.construct(6378137 * D.x * _, 3.1677196636462314e6 * (B / (1 - 0.006694379990197414 * B * B) - 1 / (2 * L) * Math.log((1 - L * B) / (1 + L * B)))); + }, C.Ux = function(D, L, B, q) { + var Z = 0.0033528106647474805, ie = Math.sin(B); + B = Math.cos(B); + var se = (1 - Z) * Math.tan(D), de = se * (D = 1 / Math.sqrt(1 + se * se)), Ce = Math.atan2(se, B), Ve = (se = D * ie) * se, Je = 1 - Ve, Pt = 27233160610754688e-5 * Je / 4040829998466145e-2, $t = 1 + Pt / 16384 * (4096 + Pt * (Pt * (320 - 175 * Pt) - 768)), qe = Pt / 1024 * (256 + Pt * (Pt * (74 - 47 * Pt) - 128)); + Pt = q / (635675231424518e-8 * $t); + for (var Rt, Zt, Jt, Xt = 2 * Math.PI; 1e-12 < Math.abs(Pt - Xt); ) + Jt = Math.cos(2 * Ce + Pt), Xt = Pt, Pt = q / (635675231424518e-8 * $t) + qe * (Rt = Math.sin(Pt)) * (Jt + qe / 4 * ((Zt = Math.cos(Pt)) * (2 * Jt * Jt - 1) - qe / 6 * Jt * (4 * Rt * Rt - 3) * (4 * Jt * Jt - 3))); + return q = de * Rt - D * Zt * B, Je = Z / 16 * Je * (4 + Z * (4 - 3 * Je)), A.h.construct((L + (Math.atan2(Rt * ie, D * Zt - de * Rt * B) - (1 - Je) * Z * se * (Pt + Je * Rt * (Jt + Je * Zt * (2 * Jt * Jt - 1))))) / _, Math.atan2(de * Zt + D * Rt * B, (1 - Z) * Math.sqrt(Ve + q * q)) / _); + }, C.HM = function(D, L, B, q) { + var Z = 0.0033528106647474805, ie = q - L, se = Math.atan((1 - Z) * Math.tan(D)), de = Math.atan((1 - Z) * Math.tan(B)), Ce = Math.sin(se); + se = Math.cos(se); + var Ve = Math.sin(de); + de = Math.cos(de); + var Je = ie, Pt = 1e3; + do { + var $t = Math.sin(Je), qe = Math.cos(Je), Rt = Math.sqrt(de * $t * de * $t + (se * Ve - Ce * de * qe) * (se * Ve - Ce * de * qe)); + if (Rt === 0) + return 0; + qe = Ce * Ve + se * de * qe; + var Zt = Math.atan2(Rt, qe), Jt = se * de * $t / Rt, Xt = 1 - Jt * Jt; + $t = qe - 2 * Ce * Ve / Xt, isNaN($t) && ($t = 0); + var Qt = Z / 16 * Xt * (4 + Z * (4 - 3 * Xt)), bi = Je; + Je = ie + (1 - Qt) * Z * Jt * (Zt + Qt * Rt * ($t + Qt * qe * (2 * $t * $t - 1))); + } while (1e-12 < Math.abs(Je - bi) && 0 < --Pt); + return Pt === 0 ? (Ce = q - L, { azimuth: Math.atan2(Math.sin(Ce) * Math.cos(B), Math.cos(D) * Math.sin(B) - Math.sin(D) * Math.cos(B) * Math.cos(Ce)), geodesicDistance: 6371008771415059e-9 * Math.acos(Math.sin(D) * Math.sin(B) + Math.cos(D) * Math.cos(B) * Math.cos(q - L)) }) : (L = (D = 27233160610754688e-5 * Xt / 4040829998466145e-2) / 1024 * (256 + D * (D * (74 - 47 * D) - 128)), { azimuth: Math.atan2(de * Math.sin(Je), se * Ve - Ce * de * Math.cos(Je)), TQ: 635675231424518e-8 * (1 + D / 16384 * (4096 + D * (D * (320 - 175 * D) - 768))) * (Zt - L * Rt * ($t + L / 4 * (qe * (2 * $t * $t - 1) - L / 6 * $t * (4 * Rt * Rt - 3) * (4 * $t * $t - 3)))), TY: Math.atan2(se * Math.sin(Je), se * Ve * Math.cos(Je) - Ce * de) }); + }, C.eQ = function(D) { + var L = D.hasAttribute(1), B = D.hasAttribute(2), q = [], Z = D.ea(), ie = null, se = null; + L && (ie = D.vb(1)), B && (se = D.vb(2)); + for (var de = new A.h(), Ce = 0; Ce < Z; Ce++) { + for (var Ve = D.Ca(Ce), Je = D.Ka(Ce), Pt = 0, $t = 0, qe = NaN, Rt = NaN, Zt = NaN, Jt = NaN, Xt = D.ec(Ce), Qt = [], bi = Ve; bi < Ve + Je; bi++) { + D.D(bi, de), Jt = Zt = NaN; + var Mi = [de.x, de.y]; + L && (Zt = ie.get(bi), Mi.push(Zt)), B && (Z = se.get(bi), Mi.push(Jt)), bi == Ve && Xt && (Pt = de.x, $t = de.y, qe = Zt, Rt = Jt), Qt.push(Mi); + } + !Xt || Pt == de.x && $t == de.y && (!L || isNaN(qe) && isNaN(Zt) || qe == Zt) && (!B || isNaN(Rt) && isNaN(Jt) || Rt == Jt) || Qt.push(Qt[0].slice(0)), q.push(Qt); + } + return q; + }, C.Ry = function(D, L) { + D = C.eQ(D), 637.100877141506 > L && (L = 637.100877141506); + for (var B, q = [], Z = 0; Z < D.length; Z++) { + var ie, se, de = D[Z]; + q.push(B = []), B.push([de[0][0], de[0][1]]); + var Ce = de[0][0] * _, Ve = de[0][1] * _; + for (ie = 0; ie < de.length - 1; ie++) { + var Je = de[ie + 1][0] * _, Pt = de[ie + 1][1] * _; + if (Ce !== Je || Ve !== Pt) { + Je = (Pt = C.HM(Ve, Ce, Pt, Je)).azimuth; + var $t = (Pt = Pt.TQ) / L; + if (1 < $t) { + for (se = 1; se <= $t - 1; se++) { + var qe = C.Ux(Ve, Ce, Je, se * L); + B.push([qe.x, qe.y]); + } + se = C.Ux(Ve, Ce, Je, (Pt + Math.floor($t - 1) * L) / 2), B.push([se.x, se.y]); + } + Ve = C.Ux(Ve, Ce, Je, Pt), B.push([Ve.x, Ve.y]), Ce = Ve.x * _, Ve = Ve.y * _; + } + } + } + return { lJ: q }; + }, C.SQ = function(D) { + for (var L = [], B = 0; B < D.length; B++) { + var q = D[B]; + q = C.Ry(q, 1e4), L.push(q); + } + D = []; + for (var Z = 0; Z < L.length; Z++) { + q = L[Z]; + var ie = 0; + for (B = 0; B < q.lJ.length; B++) { + var se, de = q.lJ[B], Ce = C.xu(A.h.construct(de[0][0], de[0][1])), Ve = C.xu(A.h.construct(de[de.length - 1][0], de[de.length - 1][1])), Je = Ve.x * Ce.y - Ce.x * Ve.y; + for (se = 0; se < de.length - 1; se++) + Ce = C.xu(A.h.construct(de[se + 1][0], de[se + 1][1])), Je += (Ve = C.xu(A.h.construct(de[se][0], de[se][1]))).x * Ce.y - Ce.x * Ve.y; + ie += Je; + } + ie /= 1, D.push(ie / -2); + } + return D; + }, C; + }(), A.cb = function() { + function C() { + } + return C.sB = function(D, L, B, q, Z, ie, se) { + C.bD[D.dc()] = L, isNaN(B) == 0 && (C.hD[D.dc()] = B), isNaN(q) == 0 && (C.uD[D.dc()] = q), isNaN(Z) == 0 && (C.WC[D.dc()] = Z), C.iD[D.dc()] = ie, se !== null && (C.jD[D.dc()] = se); + }, C.Yw = function(D, L, B) { + C.nD[D.dc() + "-" + L.dc()] = B; + }, C.tc = function(D) { + if ((D = C.bD[D.dc()]) == null) + throw A.i.Fe(); + return D; + }, C.bf = function(D) { + if ((D = C.hD[D.dc()]) == null) + throw A.i.Fe(); + return D; + }, C.xv = function(D) { + if ((D = C.uD[D.dc()]) == null) + throw A.i.Fe(); + return D; + }, C.gv = function(D) { + if ((D = C.WC[D.dc()]) == null) + throw A.i.Fe(); + return D; + }, C.ih = function(D) { + if ((D = C.jD[D.dc()]) == null) + throw A.i.Fe(); + return A.l.construct(D[0], D[1], D[2], D[3]); + }, C.Xc = function(D) { + if ((D = C.iD[D.dc()]) == null) + throw A.i.Fe(); + return D; + }, C.Bh = function(D, L, B) { + if (L.Nb(B)) + return D; + var q = C.nD[L.dc() + "-" + B.dc()]; + if (q !== void 0) + return q(D, L, B); + throw A.i.Fe(); + }, C.wt = function() { + throw A.i.Fe(); + }, C.XQ = function() { + throw A.i.Fe(); + }, C.ZV = function() { + throw A.i.Fe(); + }, C.ol = function() { + throw A.i.Fe(); + }, C.nW = function() { + var D = A.Gg.create(102100), L = A.Gg.create(3857), B = A.Gg.create(4326); + A.cb.sB(D, B, NaN, NaN, NaN, !1, null), A.cb.sB(B, B, 1, 0.0033528106647474805, 6378137, !0, [-180, -90, 180, 90]), A.cb.sB(L, B, NaN, NaN, NaN, !1, null), A.cb.Yw(D, B, b), A.cb.Yw(B, D, m), A.cb.Yw(L, B, b), A.cb.Yw(B, L, m); + }, C.bD = [], C.hD = [], C.uD = [], C.WC = [], C.iD = [], C.jD = [], C.nD = [], C; + }(); + }(le || (le = {})), le.cb.nW(), function(A) { + var ve = function() { + function H(T) { + this.o = new Int32Array(0), this.ko = -1, this.Jg = this.size = this.Dl = 0, this.Mf = T; + } + return H.prototype.kd = function(T) { + T < this.Dl ? (this.o[T * this.Mf] = this.ko, this.ko = T) : this.Dl--, this.size--; + }, H.prototype.U = function(T, b) { + return this.o[T * this.Mf + b]; + }, H.prototype.T = function(T, b, m) { + this.o[T * this.Mf + b] = m; + }, H.prototype.De = function() { + var T = this.ko; + if (T == -1) { + if (this.Dl == this.Jg) { + if (2147483647 < (T = this.Jg != 0 ? A.P.truncate(3 * (this.Jg + 1) / 2) : 1) && (T = 2147483647), T == this.Jg) + throw A.i.de(); + this.yz(T); + } + T = this.Dl, this.Dl++; + } else + this.ko = this.o[T * this.Mf]; + this.size++; + for (var b = T * this.Mf; b < T * this.Mf + this.Mf; b++) + this.o[b] = -1; + return T; + }, H.prototype.Nl = function(T) { + var b = this.ko; + if (b == -1) { + if (this.Dl == this.Jg) { + if (2147483647 < (b = this.Jg != 0 ? A.P.truncate(3 * (this.Jg + 1) / 2) : 1) && (b = 2147483647), b == this.Jg) + throw A.i.de(); + this.yz(b); + } + b = this.Dl, this.Dl++; + } else + this.ko = this.o[b * this.Mf]; + this.size++; + for (var m = b * this.Mf, _ = 0; _ < T.length; _++) + this.o[m + _] = T[_]; + return b; + }, H.prototype.oj = function(T) { + this.ko = -1, this.size = this.Dl = 0, T && (this.o = null, this.Jg = 0); + }, H.prototype.Ee = function(T) { + T > this.Jg && this.yz(T); + }, H.prototype.sx = function(T, b) { + T *= this.Mf, b *= this.Mf; + for (var m = 0; m < this.Mf; m++) { + var _ = this.o[b + m]; + this.o[b + m] = this.o[T + m], this.o[T + m] = _; + } + }, H.prototype.bC = function(T, b, m) { + var _ = this.o[this.Mf * b + m]; + this.o[this.Mf * b + m] = this.o[this.Mf * T + m], this.o[this.Mf * T + m] = _; + }, H.GG = function(T) { + return 0 <= T; + }, H.prototype.yz = function(T) { + this.o == null && (this.o = new Int32Array(0)); + var b = new Int32Array(this.Mf * T); + b.set(this.o, 0), this.o = b, this.Jg = T; + }, H; + }(); + A.ad = ve; + }(le || (le = {})), function(A) { + var ve, H; + (H = ve || (ve = {}))[H.enumInputModeBuildGraph = 0] = "enumInputModeBuildGraph", H[H.enumInputModeSimplifyAlternate = 4] = "enumInputModeSimplifyAlternate", H[H.enumInputModeSimplifyWinding = 5] = "enumInputModeSimplifyWinding", H[H.enumInputModeIsSimplePolygon = 7] = "enumInputModeIsSimplePolygon"; + var T = function() { + function m(_) { + this.Ce = _, this.Ah = NaN, this.$G = new A.jg(), this.aH = new A.jg(), this.os = new A.Oc(), this.ps = new A.Oc(); + } + return m.prototype.compare = function(_, C, D) { + if (_ = _.ka(D), this.Ce.kB(C, this.$G), this.Ce.kB(_, this.aH), C = this.$G.get(), _ = this.aH.get(), this.os.L(C.ta, C.qa), this.ps.L(_.ta, _.qa), this.os.wa < this.ps.pa) + return -1; + if (this.os.pa > this.ps.wa) + return 1; + D = C.oa == C.ma; + var L = _.oa == _.ma; + if (D || L) { + if (D && L) + return 0; + if (C.oa == _.oa && C.ta == _.ta) + return D ? 1 : -1; + if (C.ma == _.ma && C.qa == _.qa) + return D ? -1 : 1; + } + return (D = C.Me(this.Ah, this.os.pa)) == (L = _.Me(this.Ah, this.ps.pa)) && ((L = 0.5 * ((D = Math.min(C.ma, _.ma)) + this.Ah)) == this.Ah && (L = D), D = C.Me(L, this.os.pa), L = _.Me(L, this.ps.pa)), D < L ? -1 : D > L ? 1 : 0; + }, m.prototype.WJ = function(_) { + this.Ah = _; + }, m; + }(), b = function() { + function m(_) { + this.ib = _, this.RH = new A.jg(), this.Cf = new A.h(), this.rA = new A.Oc(); + } + return m.prototype.fX = function(_) { + this.Cf.N(_); + }, m.prototype.compare = function(_, C) { + return this.ib.kB(_.ka(C), this.RH), _ = this.RH.get(), this.rA.L(_.ta, _.qa), this.Cf.x < this.rA.pa ? -1 : this.Cf.x > this.rA.wa ? 1 : (_ = _.Me(this.Cf.y, this.Cf.x), this.Cf.x < _ ? -1 : this.Cf.x > _ ? 1 : 0); + }, m; + }(); + ve = function() { + function m() { + this.cH = this.Fi = this.Ii = this.fA = this.$n = this.ze = this.Lc = this.lh = this.he = null, this.Io = this.yg = -1, this.bH = !0, this.kA = !1, this.gA = NaN, this.Pi = new A.Nd(), this.XN = 2147483647, this.WN = A.P.truncate(-2147483648), this.eg = this.be = this.Jl = this.Eq = this.Em = this.Dq = this.Qs = this.Oe = -1, this.xa = 0; + } + return m.prototype.ty = function(_) { + this.gA = _; + }, m.prototype.$m = function() { + this.he == null && (this.he = new A.ad(8)); + var _ = this.he.De(); + return this.he.T(_, 1, 0), _; + }, m.prototype.qU = function() { + this.Lc == null && (this.Lc = new A.ad(8)); + var _ = this.Lc.De(); + this.Lc.T(_, 2, 0), this.Lc.T(_, 3, 0); + var C = this.Lc.De(); + return this.Lc.T(C, 2, 0), this.Lc.T(C, 3, 0), this.EJ(_, C), this.EJ(C, _), _; + }, m.prototype.hI = function() { + this.ze == null && (this.ze = new A.ad(8)); + var _ = this.ze.De(); + return this.ze.T(_, 2, 0), _; + }, m.prototype.OW = function(_, C) { + this.he.T(_, 7, C); + }, m.prototype.on = function(_, C) { + this.he.T(_, 2, C); + }, m.prototype.NW = function(_, C) { + this.he.T(_, 1, C); + }, m.prototype.gX = function(_, C) { + this.he.T(_, 3, C); + }, m.prototype.dX = function(_, C) { + this.he.T(_, 4, C); + }, m.prototype.er = function(_, C) { + this.he.T(_, 5, C); + }, m.prototype.$Q = function(_) { + return this.he.U(_, 5); + }, m.prototype.MW = function(_, C) { + this.he.T(_, 6, C); + }, m.prototype.YM = function(_, C) { + this.MW(C, _); + }, m.prototype.DJ = function(_, C) { + this.Lc.T(_, 1, C); + }, m.prototype.EJ = function(_, C) { + this.Lc.T(_, 4, C); + }, m.prototype.Vl = function(_, C) { + this.Lc.T(_, 5, C); + }, m.prototype.Ul = function(_, C) { + this.Lc.T(_, 6, C); + }, m.prototype.VW = function(_, C) { + this.Lc.T(_, 2, C); + }, m.prototype.cx = function(_, C) { + this.Lc.T(_, 3, C); + }, m.prototype.GF = function(_) { + return this.Lc.U(_, 3); + }, m.prototype.Ht = function(_, C) { + this.Lc.T(_, 7, C); + }, m.prototype.zK = function(_, C) { + if (this.om(_) != -1) + for (C = C ? -1 : _, _ = this.om(_); _ != -1; _ = this.ls(_)) + this.g.Sa(this.vj(_), this.Eq, C); + }, m.prototype.xx = function(_, C) { + _ != -1 && (this.zK(_, C), this.zK(this.ya(_), C)); + }, m.prototype.Et = function(_, C) { + this.ze.T(_, 1, C); + }, m.prototype.Xg = function(_, C) { + this.ze.T(_, 2, C); + }, m.prototype.ln = function(_, C) { + this.ze.T(_, 3, C), this.IW(_, this.ZQ(C)), this.HW(C, _); + }, m.prototype.HW = function(_, C) { + this.ze.T(_, 4, C); + }, m.prototype.IW = function(_, C) { + this.ze.T(_, 5, C); + }, m.prototype.yJ = function(_, C) { + this.ze.T(_, 6, C); + }, m.prototype.wJ = function(_, C) { + this.ze.T(_, 7, C); + }, m.prototype.vJ = function(_, C) { + this.$n.write(_, C); + }, m.prototype.xJ = function(_, C) { + this.fA.write(_, C); + }, m.prototype.gY = function(_) { + var C = 0, D = 0, L = this.vF(_), B = new A.h(), q = new A.h(), Z = new A.h(); + this.$r(L, B), q.N(B); + var ie = L; + do + this.nm(ie, Z), D += A.h.ub(q, Z), this.$e(this.ya(ie)) != _ && (C += (Z.x - B.x - (q.x - B.x)) * (Z.y - B.y + (q.y - B.y)) * 0.5), q.N(Z), ie = this.kc(ie); + while (ie != L); + this.$n.write(_, C), this.fA.write(_, D); + }, m.prototype.KU = function(_, C) { + var D = new T(this), L = new A.$j(); + L.Ee(A.P.truncate(this.xa / 2)), L.Xo(D); + for (var B = new A.ja(0), q = this.bh(), Z = null, ie = 0, se = new A.h(), de = this.Oe; de != -1; de = this.Tf(de)) { + if (!(255 & ++ie) && C != null && !C.progress(-1, -1)) + throw A.i.RC(); + var Ce = this.Je(de); + if (Ce != -1) { + if (B.Dh(0), !this.cY(L, q, B, Ce)) { + this.D(de, se), D.WJ(se.y); + var Ve = Ce; + do { + var Je = this.Bb(Ve, q); + Je != -1 && (L.wd(Je, -1), this.Kb(Ve, q, -2)), Ve = this.kc(this.ya(Ve)); + } while (Ce != Ve); + Ve = Ce; + do + (Je = this.Bb(Ve, q)) == -1 && (Je = L.addElement(Ve, -1), B.add(Je)), Ve = this.kc(this.ya(Ve)); + while (Ce != Ve); + } + for (Ce = B.size - 1; 0 <= Ce; Ce--) + Je = B.get(Ce), Ve = L.ka(Je), this.Kb(this.ya(Ve), q, Je), this.JU(L, Je, _); + } else + this.Yy(de) == -1 && (Z == null && (Z = new b(this)), this.D(de, se), Z.fX(se), Ve = L.DW(Z), Ce = this.Jl, Ve != -1 && (Je = L.ka(Ve), this.$e(Je) == this.$e(this.ya(Je)) && (Je = this.JF(L, Ve)), Je != -1 && (Ce = this.$e(Je))), this.YM(Ce, de)); + } + this.Lg(q); + }, m.prototype.JU = function(_, C, D) { + var L = _.ka(C), B = this.$e(L); + if (this.In(B) == -1) { + var q = this.JF(_, C), Z = this.ya(L), ie = this.$e(Z); + this.Mp(B), this.Mp(ie); + var se = this.In(B), de = this.In(ie); + if (q == -1 && se == -1 && (ie == B ? (this.ln(ie, this.Jl), se = de = this.Jl) : (de == -1 && (this.ln(ie, this.Jl), de = this.Jl), this.ln(B, ie), se = ie)), q != -1) { + var Ce = this.$e(q); + de == -1 && (0 >= this.Mp(Ce) ? (de = this.In(Ce), this.ln(ie, de)) : (this.ln(ie, Ce), de = Ce), ie == B && (se = de)); + } + se == -1 && this.dY(B, ie), D == 0 ? this.eW(_, C, L, q, B, ie) : D == 5 ? this.fW(_, C, L, Z, B, ie) : D == 4 && this.dW(L, q, B, ie); + } + }, m.prototype.eW = function(_, C, D, L, B, q) { + var Z = this.jk(B); + if (L != -1) { + var ie = this.jk(q), se = this.jk(this.$e(L)); + L = Z & ie & se, se ^= se & this.fh(D), (se |= L) != 0 && (this.Xg(q, ie | se), this.Xg(B, se | Z), Z = Z || se); + } + for (C = _.lb(C); C != -1 && (L = _.ka(C), D = this.$e(this.ya(L)), B = this.jk(D), q = this.fh(L), ie = this.$e(L), L = B & (se = this.jk(ie)) & Z, Z ^= Z & q, (Z |= L) != 0); C = _.lb(C)) + this.Xg(D, B | Z), this.Xg(ie, se | Z); + }, m.prototype.fW = function(_, C, D, L, B, q) { + if (B != q) { + D = this.Bb(D, this.eg), D += this.Bb(L, this.eg), L = 0; + var Z = new A.ja(0), ie = new A.ja(0); + ie.add(0); + for (var se = _.sc(-1); se != C; se = _.lb(se)) { + var de = _.ka(se), Ce = this.ya(de), Ve = this.$e(de), Je = this.$e(Ce); + if (Ve != Je) { + if (de = this.Bb(de, this.eg), L += de += this.Bb(Ce, this.eg), Ce = !1, Z.size != 0 && Z.Gc() == Je && (ie.Jf(), Z.Jf(), Ce = !0), this.In(Je) == -1) + throw A.i.Ra(); + Ce && this.In(Je) == Ve || (ie.add(L), Z.add(Ve)); + } + } + L += D, Z.size != 0 && Z.Gc() == q && (ie.Jf(), Z.Jf()), L != 0 ? ie.Gc() == 0 && (_ = this.g.md, _ = this.Ma(_), this.Xg(B, _)) : ie.Gc() != 0 && (_ = this.g.md, _ = this.Ma(_), this.Xg(B, _)); + } + }, m.prototype.dW = function(_, C, D, L) { + var B = this.Ma(this.g.md); + if (C == -1) + this.Xg(L, this.Io), 1 & (_ = this.Bb(_, this.yg)) ? this.Xg(D, B) : this.Xg(D, this.Io); + else { + var q = this.jk(L); + q == 0 ? (q = this.jk(this.$e(C)), this.Xg(L, q), 1 & (_ = this.Bb(_, this.yg)) ? this.Xg(D, q == B ? this.Io : B) : this.Xg(D, q)) : 1 & (_ = this.Bb(_, this.yg)) ? this.Xg(D, q == B ? this.Io : B) : this.Xg(D, q); + } + }, m.prototype.cY = function(_, C, D, L) { + var B = L, q = -1, Z = -1, ie = 0; + do { + if (ie == 2) + return !1; + var se = this.Bb(B, C); + if (se != -1) { + if (q != -1) + return !1; + q = se; + } else { + if (Z != -1) + return !1; + Z = B; + } + ie++, B = this.kc(this.ya(B)); + } while (L != B); + return Z != -1 && q != -1 && (this.Kb(_.ka(q), C, -2), _.Uj(q, Z), D.add(q), !0); + }, m.prototype.dY = function(_, C) { + var D = this.Mp(_); + if (D != 0) { + var L = this.Mp(C); + 0 < D && 0 > L || 0 > D && 0 < L ? this.ln(_, C) : (C = this.In(C)) != -1 && this.ln(_, C); + } + }, m.prototype.qP = function(_, C) { + this.Eq = this.g.Hd(); + for (var D = 0, L = C.size; D < L; D++) { + var B = C.get(D), q = this.g.Qa(B, this.Em), Z = this.g.Sf(this.g.cd(B)), ie = this.g.jc(Z); + if (A.ba.Ic(ie)) { + var se = this.g.V(B); + if (se != -1) { + var de = this.g.Qa(se, this.Em); + if (q != de) { + var Ce = this.qU(), Ve = this.ya(Ce), Je = this.lh.De(); + this.lh.T(Je, 0, B), this.lh.T(Je, 1, -1), this.Ht(Ce, Je), this.DJ(Ce, q), (Je = this.Je(q)) == -1 ? (this.on(q, Ce), this.Vl(Ce, Ve), this.Ul(Ve, Ce)) : (q = this.ue(Je), this.Vl(Je, Ve), this.Ul(Ve, Je), this.Ul(q, Ce), this.Vl(Ce, q)), this.DJ(Ve, de), (q = this.Je(de)) == -1 ? (this.on(de, Ve), this.Ul(Ce, Ve), this.Vl(Ve, Ce)) : (de = this.ue(q), this.Vl(q, Ce), this.Ul(Ce, q), this.Ul(de, Ve), this.Vl(Ve, de)), Z = this.Ma(Z), _ == 0 ? (this.Kb(Ve, this.be, 0), this.Kb(Ce, this.be, ie == 1736 ? Z : 0)) : _ == 5 ? (de = new A.h(), this.g.D(B, de), B = new A.h(), this.g.D(se, B), q = se = 0, 0 > de.compare(B) ? se = 1 : q = -1, this.Kb(Ve, this.be, 0), this.Kb(Ce, this.be, 0), this.Kb(Ce, this.eg, se), this.Kb(Ve, this.eg, q)) : _ == 7 ? (this.Kb(Ve, this.be, this.Io), this.Kb(Ce, this.be, ie == 1736 ? Z : 0)) : _ == 4 && (this.Kb(Ve, this.be, 0), this.Kb(Ce, this.be, 0), this.Kb(Ce, this.yg, 1), this.Kb(Ve, this.yg, 1)), ie = ie == 1736 ? this.WN : 0, this.cx(Ce, Z | ie), this.cx(Ve, Z | ie); + } + } + } + } + }, m.prototype.QT = function(_, C) { + var D = this.om(C); + if (D != -1) { + var L = this.om(_); + this.lh.T(D, 1, L), this.Ht(_, D), this.Ht(C, -1); + } + _ = this.ya(_), C = this.ya(C), (D = this.om(C)) != -1 && (L = this.om(_), this.lh.T(D, 1, L), this.Ht(_, D), this.Ht(C, -1)); + }, m.prototype.EX = function(_) { + function C(Zt, Jt) { + return L.CO(Zt, Jt); + } + var D = new A.ja(0); + D.Jb(10); + for (var L = this, B = this.Oe; B != -1; B = this.Tf(B)) { + D.clear(!1); + var q = this.Je(B); + if (q != -1) { + var Z = q; + do + D.add(Z), Z = this.kc(this.ya(Z)); + while (Z != q); + if (1 < D.size) { + if (Z = !0, 2 < D.size) + D.Wd(0, D.size, C), D.add(D.get(0)); + else if (0 < this.BO(D.get(0), D.get(1))) { + var ie = D.get(0); + D.set(0, D.get(1)), D.set(1, ie); + } else + Z = !1; + for (var se = ie = D.get(0), de = this.vf(se), Ce = this.ya(se), Ve = -1, Je = 1, Pt = D.size; Je < Pt; Je++) { + var $t = D.get(Je), qe = this.ya($t), Rt = this.lk(qe); + if (Rt == de && $t != se) { + if (_ == 0) + Ve = this.GF(se) | this.GF($t), this.cx(se, Ve), this.cx(Ce, Ve), this.Kb(se, this.be, this.Bb(se, this.be) | this.Bb($t, this.be)), this.Kb(Ce, this.be, this.Bb(Ce, this.be) | this.Bb(qe, this.be)); + else if (this.eg != -1) + Ve = this.Bb(se, this.eg) + this.Bb($t, this.eg), qe = this.Bb(Ce, this.eg) + this.Bb(qe, this.eg), this.Kb(se, this.eg, Ve), this.Kb(Ce, this.eg, qe); + else { + if (_ == 7) + return void (this.Pi = new A.Nd(5, B, -1)); + this.yg != -1 && (Ve = this.Bb(se, this.yg) + this.Bb($t, this.yg), qe = this.Bb(Ce, this.yg) + this.Bb(qe, this.yg), this.Kb(se, this.yg, Ve), this.Kb(Ce, this.yg, qe)); + } + this.QT(se, $t), this.Gy($t), Ve = se, D.set(Je, -1), $t == ie && (D.set(0, -1), ie = -1); + } else + this.xx(Ve, !1), Ve = -1, se = $t, de = Rt, Ce = qe; + } + if (this.xx(Ve, !1), Ve = -1, Z) { + for (ie = -1, Je = 0, Pt = D.size; Je < Pt; Je++) + if (($t = D.get(Je)) != -1) { + if (ie == -1) + se = ie = $t, de = this.vf(se), Ce = this.ya(se); + else if ($t != se && (qe = this.ya($t), Rt = this.lk(qe), this.Ul(Ce, $t), this.Vl($t, Ce), se = $t, de = Rt, Ce = qe, _ == 7 && (this.Bb($t, this.be) | this.Bb(this.ue($t), this.be)) == (1 | this.Io))) + return void (this.Pi = new A.Nd(5, B, -1)); + } + this.on(B, ie); + } else { + for (ie = -1, Je = 0, Pt = D.size; Je < Pt; Je++) + if (($t = D.get(Je)) != -1) { + ie = $t; + break; + } + q != ie && this.on(B, ie); + } + } + } + } + }, m.prototype.RN = function() { + for (var _ = -1, C = this.bh(), D = this.Oe; D != -1; D = this.Tf(D)) { + var L = this.Je(D); + if (L != -1) { + var B = L; + do { + if (this.Bb(B, C) != 1) { + var q = this.hI(); + this.Et(q, B), this.wJ(q, _), _ != -1 && this.yJ(_, q), _ = q; + var Z = 0, ie = B; + do + Z |= this.Bb(ie, this.be), this.VW(ie, q), this.Kb(ie, C, 1), ie = this.kc(ie); + while (ie != B); + this.Xg(q, Z); + } + B = this.kc(this.ya(B)); + } while (B != L); + } + } + q = this.hI(), this.Et(q, -1), this.wJ(q, _), _ != -1 && this.yJ(_, q), this.Jl = q, this.$n = A.ce.rf(this.ze.size, NaN), this.fA = A.ce.rf(this.ze.size, NaN), this.vJ(this.Jl, 1 / 0), this.xJ(this.Jl, 1 / 0), this.Lg(C); + }, m.prototype.mR = function(_, C, D) { + if ((C = C != -1 ? C : this.Je(_)) == -1) + return -1; + for (_ = C; ; ) { + if (this.Bb(C, D) != 1) + return C; + if ((C = this.kc(this.ya(C))) == _) + return -1; + } + }, m.prototype.tW = function() { + for (var _ = this.bh(), C = this.Oe; C != -1; C = this.Tf(C)) + for (var D = -1; ; ) { + var L = this.mR(C, D, _); + if (L == -1) + break; + D = this.kc(this.ya(L)); + for (var B = L; ; ) { + var q = this.kc(B), Z = this.ue(B), ie = this.ya(B); + if (Z == ie) { + if (this.DP(B), D != B && D != ie || (D = -1), B == L || Z == L) { + if (B == (L = q) || Z == L) + break; + B = q; + continue; + } + } else + this.Kb(B, _, 1); + if ((B = q) == L) + break; + } + } + this.Lg(_); + }, m.prototype.HB = function(_, C, D, L, B) { + this.Wg(), this.bH = B, this.g = _, this.Dq = this.g.WE(), (_ = new A.ja(0)).Jb(D != null ? this.g.I(D.get(0)) : this.g.gd); + var q = 0, Z = 1, ie = D != null ? D.get(0) : this.g.md; + for (B = 1; ie != -1; ) { + this.g.CJ(ie, this.Dq, Z), Z <<= 1; + for (var se = this.g.Ob(ie); se != -1; se = this.g.Sb(se)) + for (var de = this.g.Ya(se), Ce = 0, Ve = this.g.Ka(se); Ce < Ve; Ce++) + _.add(de), de = this.g.V(de); + A.ba.Tn(this.g.jc(ie)) || (q += this.g.ea(ie)), D != null ? (ie = B < D.size ? D.get(B) : -1, B++) : ie = this.g.ve(ie); + } + for (this.Io = Z, this.xa = _.size, this.g.nx(_, this.xa), this.lh == null && (this.lh = new A.ad(2), this.he = new A.ad(8), this.Lc = new A.ad(8), this.ze = new A.ad(8)), this.lh.Ee(this.xa), A.op.Bp(L), this.he.Ee(this.xa + 10), this.Lc.Ee(2 * this.xa + 32), this.ze.Ee(Math.max(32, q)), this.Em = this.g.Hd(), D = new A.h(), B = 0, q = new A.h(), D.Sc(), Z = 0; Z <= this.xa; Z++) + if (Z < this.xa ? (de = _.get(Z), this.g.D(de, q)) : q.Sc(), !D.rb(q)) { + if (B < Z) { + for (de = this.$m(), Ve = Ce = -1; B < Z; B++) + Ve = _.get(B), this.g.Sa(Ve, this.Em, de), ie = this.lh.De(), this.lh.T(ie, 0, Ve), this.lh.T(ie, 1, Ce), Ce = ie, se = this.g.cd(Ve), ie = this.g.Sf(se), ie = this.Ma(ie), this.NW(de, this.yd(de) | ie); + this.OW(de, Ce), this.er(de, this.g.Va(Ve)), this.Qs != -1 && this.dX(this.Qs, de), this.gX(de, this.Qs), this.Qs = de, this.Oe == -1 && (this.Oe = de); + } + B = Z, D.N(q); + } + A.op.Bp(L), this.be = this.bh(), C == 5 && (this.eg = this.bh()), C == 4 && (this.yg = this.bh()), this.qP(C, _), this.Pi.Lj == 0 && (this.EX(C), this.Pi.Lj == 0 && (isNaN(this.gA) || this.sO() ? (this.RN(), this.Pi.Lj == 0 && (this.Lg(this.be), this.be = -1, this.bH && this.KU(C, L))) : this.kA = !0)); + }, m.prototype.Gy = function(_) { + var C = this.kc(_), D = this.ue(_), L = this.ya(_), B = this.kc(L), q = this.ue(L); + C != L && (this.Ul(q, C), this.Vl(C, q)), D != L && (this.Ul(D, B), this.Vl(B, D)), D = this.lk(_), this.Je(D) == _ && (B != _ ? this.on(D, B) : this.on(D, -1)), B = this.lk(L), this.Je(B) == L && (C != L ? this.on(B, C) : this.on(B, -1)), this.Lc.kd(_), this.Lc.kd(L); + }, m.prototype.JF = function(_, C) { + for (; ; ) { + if ((C = _.xe(C)) == -1) + return -1; + var D = _.ka(C); + if (this.$e(D) != this.$e(this.ya(D))) + return D; + } + }, m.prototype.fr = function(_, C) { + var D; + D === void 0 && (D = !0), this.HB(_, 0, null, C, D); + }, m.prototype.qJ = function(_, C, D) { + var L = new A.ja(0); + L.add(C), this.HB(_, 4, L, D, _.jc(C) == 1736); + }, m.prototype.rJ = function(_, C, D) { + var L = new A.ja(0); + L.add(C), this.HB(_, 5, L, D, !0); + }, m.prototype.Wg = function() { + this.g != null && (this.Dq != -1 && (this.g.sW(this.Dq), this.Dq = -1), this.Em != -1 && (this.g.Ud(this.Em), this.Em = -1), this.Eq != -1 && (this.g.Ud(this.Eq), this.Eq = -1), this.be != -1 && (this.Lg(this.be), this.be = -1), this.eg != -1 && (this.Lg(this.eg), this.eg = -1), this.yg != -1 && (this.Lg(this.yg), this.yg = -1), this.g = null, this.he.oj(!0), this.lh.oj(!0), this.Qs = this.Oe = -1, this.Lc != null && this.Lc.oj(!0), this.Ii != null && (this.Ii.length = 0), this.Fi != null && (this.Fi.length = 0), this.cH != null && (this.cH.length = 0), this.ze != null && this.ze.oj(!0), this.Jl = -1, this.$n = null); + }, m.prototype.Je = function(_) { + return this.he.U(_, 2); + }, m.prototype.D = function(_, C) { + this.g.ZF(this.$Q(_), C); + }, m.prototype.yd = function(_) { + return this.he.U(_, 1); + }, m.prototype.Tf = function(_) { + return this.he.U(_, 4); + }, m.prototype.Yy = function(_) { + return this.he.U(_, 6); + }, m.prototype.mm = function(_) { + return this.he.U(_, 7); + }, m.prototype.ls = function(_) { + return this.lh.U(_, 1); + }, m.prototype.vj = function(_) { + return this.lh.U(_, 0); + }, m.prototype.og = function(_, C) { + return (C = this.Fi[C]).size <= _ ? -1 : C.read(_); + }, m.prototype.pn = function(_, C, D) { + (C = this.Fi[C]).size <= _ && C.resize(this.he.size, -1), C.write(_, D); + }, m.prototype.Fp = function() { + this.Fi == null && (this.Fi = []); + for (var _ = A.ja.rf(this.he.Jg, -1), C = 0, D = this.Fi.length; C < D; C++) + if (this.Fi[C] == null) + return this.Fi[C] = _, C; + return this.Fi.push(_), this.Fi.length - 1; + }, m.prototype.Gp = function(_) { + this.Fi[_] = null; + }, m.prototype.lk = function(_) { + return this.Lc.U(_, 1); + }, m.prototype.vf = function(_) { + return this.lk(this.ya(_)); + }, m.prototype.ya = function(_) { + return this.Lc.U(_, 4); + }, m.prototype.ue = function(_) { + return this.Lc.U(_, 5); + }, m.prototype.kc = function(_) { + return this.Lc.U(_, 6); + }, m.prototype.$e = function(_) { + return this.Lc.U(_, 2); + }, m.prototype.af = function(_) { + return this.jk(this.Lc.U(_, 2)); + }, m.prototype.om = function(_) { + return this.Lc.U(_, 7); + }, m.prototype.$r = function(_, C) { + this.D(this.lk(_), C); + }, m.prototype.nm = function(_, C) { + this.D(this.vf(_), C); + }, m.prototype.fh = function(_) { + return this.Lc.U(_, 3) & this.XN; + }, m.prototype.Bb = function(_, C) { + return (C = this.Ii[C]).size <= _ ? -1 : C.read(_); + }, m.prototype.Kb = function(_, C, D) { + (C = this.Ii[C]).size <= _ && C.resize(this.Lc.size, -1), C.write(_, D); + }, m.prototype.bh = function() { + this.Ii == null && (this.Ii = []); + for (var _ = A.ja.rf(this.Lc.Jg, -1), C = 0, D = this.Ii.length; C < D; C++) + if (this.Ii[C] == null) + return this.Ii[C] = _, C; + return this.Ii.push(_), this.Ii.length - 1; + }, m.prototype.Lg = function(_) { + this.Ii[_] = null; + }, m.prototype.DP = function(_) { + var C = this.$e(_), D = this.ya(_), L = this.kc(_); + L == D && (L = this.kc(L)) == _ && (L = -1); + var B = this.vF(C); + B !== _ && B != D || this.Et(C, L), D = this.$n.read(C), isNaN(D) || (this.vJ(C, NaN), this.xJ(C, NaN)), this.xx(_, !0), this.Gy(_); + }, m.prototype.EP = function(_) { + for (var C = 0, D = _.size; C < D; C++) { + var L = _.get(C), B = this.$e(this.ya(L)); + this.Et(this.$e(L), -1), this.Et(B, -1), this.xx(L, !0), this.Gy(L); + } + }, m.prototype.vF = function(_) { + return this.ze.U(_, 1); + }, m.prototype.jk = function(_) { + return this.ze.U(_, 2); + }, m.prototype.In = function(_) { + return this.ze.U(_, 3); + }, m.prototype.ZQ = function(_) { + return this.ze.U(_, 4); + }, m.prototype.Mp = function(_) { + var C = this.$n.read(_); + return isNaN(C) && (this.gY(_), C = this.$n.read(_)), C; + }, m.prototype.Ma = function(_) { + return this.g.FF(_, this.Dq); + }, m.prototype.Ie = function(_) { + return this.g.Qa(_, this.Em); + }, m.prototype.oR = function(_) { + return this.g.Qa(_, this.Eq); + }, m.prototype.nR = function(_, C) { + var D = this.Je(_); + if (D == -1) + return -1; + var L = D, B = -1, q = -1; + do { + if (this.vf(L) == C) + return L; + if (B == -1) { + if ((B = this.Je(C)) == -1) + break; + q = B; + } + if (this.vf(q) == _) + return this.ya(q); + L = this.kc(this.ya(L)), q = this.kc(this.ya(q)); + } while (L != D && q != B); + return -1; + }, m.prototype.kB = function(_, C) { + C.Qr(), C = C.get(); + var D = new A.h(); + this.$r(_, D), C.Ec(D), this.nm(_, D), C.Rc(D); + }, m.prototype.CO = function(_, C) { + if (_ == C) + return 0; + var D = new A.h(); + this.nm(_, D); + var L = new A.h(); + return this.nm(C, L), D.rb(L) ? 0 : (C = new A.h(), this.$r(_, C), (_ = new A.h()).vc(D, C), (D = new A.h()).vc(L, C), A.h.pu(_, D)); + }, m.prototype.BO = function(_, C) { + if (_ == C) + return 0; + var D = new A.h(); + this.nm(_, D); + var L = new A.h(); + return this.nm(C, L), D.rb(L) ? 0 : (C = new A.h(), this.$r(_, C), (_ = new A.h()).vc(D, C), (D = new A.h()).vc(L, C), 0 <= D.y && 0 < _.y ? A.h.pu(_, D) : 0); + }, m.prototype.sO = function() { + for (var _ = A.mc.ox(this.gA), C = new A.h(), D = new A.h(), L = new A.h(), B = new A.h(), q = new A.h(), Z = this.Oe; Z != -1; Z = this.Tf(Z)) { + var ie = this.Je(Z); + if (ie != -1) { + var se = ie; + this.$r(se, C), this.nm(se, D), q.vc(D, C); + var de = q.Uk(); + do { + var Ce = se; + if ((se = this.kc(this.ya(se))) != Ce) { + this.nm(se, L), B.vc(L, C), Ce = B.Uk(); + var Ve = B.yi(q); + if (Ve * Ve / (Ce * de) * Math.min(Ce, de) <= _) + return !1; + q.N(B), de = Ce, D.N(L); + } + } while (se != ie); + } + } + return !0; + }, m; + }(), A.ku = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + this.j = null, this.jH = new A.h(), this.kH = new A.h(), this.Ij = null, this.Ov = !1, this.vl = -1; + } + return H.prototype.cf = function(T) { + return T < this.Ij.length && this.Ij[T]; + }, H.prototype.fl = function(T, b, m, _) { + var C = A.ba.uf(this.j.g.jc(m)); + if (A.ba.uf(this.j.g.jc(b)) != 2 || C != 1) + throw A.i.Ra(); + this.AP(T, b, m, _); + }, H.prototype.fr = function(T, b) { + this.j == null && (this.j = new A.ku()), this.j.fr(T, b); + }, H.prototype.Gt = function(T, b, m) { + for (A.Vk.W(T, b, m, !0), b = T.md; b != -1; b = T.ve(b)) + T.jc(b) == 1736 && A.tn.W(T, b, -1, this.Ov, m); + this.fr(T, m); + }, H.prototype.HE = function(T, b, m, _, C) { + var D = this.j.g; + if (D.jc(T) == 1736) + for (T = D.Ob(T); T != -1; T = D.Sb(T)) { + var L = D.Ya(T); + this.j.Ie(L), this.j.Ie(D.V(L)); + var B = this.j.oR(L); + if (B != -1) { + var q = this.j.Bb(B, m); + if (q != 1 && q != 2) + if (this.cf(this.j.af(B))) { + this.j.Kb(B, m, 1), q = D.wf(b, -1); + var Z = B, ie = this.j.Ie(L), se = 1; + do { + var de = this.um(L, C); + D.kj(q, de), _ != -1 && this.j.pn(ie, _, 1), this.j.Kb(Z, m, 1), Z = this.j.kc(Z); + do + var Ce = (de = se == 1 ? D.V(L) : D.Na(L)) != -1 ? this.j.Ie(de) : -1; + while (Ce == ie); + var Ve = this.j.lk(Z); + if (Ve != Ce) { + do + Ce = (de = se == 1 ? D.Na(L) : D.V(L)) != -1 ? this.j.Ie(de) : -1; + while (Ce == ie); + Ve != Ce ? (Ce = Ve, de = this.j.vj(this.j.mm(Ce))) : se = -se; + } + ie = Ce, L = de; + } while (Z != B); + D.mn(q, !0); + } else + this.j.Kb(B, m, 2); + } + } + }, H.prototype.$E = function() { + for (var T = this.j.bh(), b = new A.ja(0), m = this.j.Oe; m != -1; m = this.j.Tf(m)) { + var _ = this.j.Je(m), C = _; + if (_ != -1) + do { + if (this.j.Bb(C, T) != 1) { + var D = this.j.ya(C); + this.j.Kb(D, T, 1), this.j.Kb(C, T, 1), this.cf(this.j.af(C)) && this.cf(this.j.af(D)) && b.add(C); + } + C = this.j.kc(this.j.ya(C)); + } while (C != _); + } + this.j.Lg(T), this.j.EP(b); + }, H.prototype.um = function(T, b) { + return b == -1 ? T : this.WR(T, b); + }, H.prototype.WR = function(T, b) { + var m = this.j.g, _ = this.j.mm(this.j.Ie(T)); + do { + var C = this.j.vj(_); + if (m.Sf(m.cd(C)) == b) + return C; + _ = this.j.ls(_); + } while (_ != -1); + return T; + }, H.prototype.Qt = function(T, b, m) { + this.$E(); + var _ = this.j.g, C = _.Kg(1736), D = this.j.bh(); + return this.pK(T, b, C, m, D, -1), this.j.Lg(D), A.tn.W(_, C, 1, this.Ov, null), C; + }, H.prototype.pK = function(T, b, m, _, C, D) { + for (this.HE(T, m, C, D, _), b != -1 && this.HE(b, m, C, D, _), T = this.j.g, b = this.j.Oe; b != -1; b = this.j.Tf(b)) { + var L = this.j.Je(b); + if (L != -1) { + var B = L; + do { + var q = this.j.Bb(B, C); + if (q != 1 && q != 2) + if (this.cf(this.j.af(B))) { + q = T.wf(m, -1); + var Z = B; + do { + var ie = this.j.om(Z); + ie != -1 ? ie = this.j.vj(ie) : (ie = this.j.vj(this.j.om(this.j.ya(Z))), ie = this.j.g.V(ie)), ie = this.um(ie, _), T.kj(q, ie), this.j.Kb(Z, C, 1), D != -1 && (ie = this.j.Ie(ie), this.j.pn(ie, D, 1)), Z = this.j.kc(Z); + } while (Z != B); + T.mn(q, !0); + } else + this.j.Kb(B, C, 2); + B = this.j.kc(this.j.ya(B)); + } while (B != L); + } + } + }, H.prototype.XX = function(T, b, m) { + var _ = this.j.g, C = _.Kg(1736), D = _.Kg(1607), L = _.Kg(550); + this.$E(); + var B = -1, q = this.j.bh(), Z = this.j.Fp(); + for (this.pK(T, b, C, m, q, Z), T = this.j.Oe; T != -1; T = this.j.Tf(T)) + if ((b = this.j.Je(T)) != -1) { + var ie = b; + do { + var se = this.j.Bb(ie, q), de = this.j.Bb(this.j.ya(ie), q); + if ((se |= de) == 2) + if (se = this.j.fh(ie), this.cf(se)) { + var Ce = _.wf(D, -1), Ve = ie; + se = this.$w(T, _), se = this.um(se, m), _.kj(Ce, se), this.j.pn(T, Z, 1); + do { + if (se = this.j.vf(Ve), de = this.$w(se, _), de = this.um(de, m), _.kj(Ce, de), this.j.Kb(Ve, q, 1), this.j.Kb(this.j.ya(Ve), q, 1), this.j.pn(se, Z, 1), Ve = this.j.kc(Ve), se = this.j.Bb(Ve, q), (se |= de = this.j.Bb(this.j.ya(Ve), q)) != 2) + break; + if (se = this.j.fh(Ve), !this.cf(se)) { + this.j.Kb(Ve, q, 1), this.j.Kb(this.j.ya(Ve), q, 1); + break; + } + } while (Ve != ie); + } else + this.j.Kb(ie, q, 1), this.j.Kb(this.j.ya(ie), q, 1); + ie = this.j.kc(this.j.ya(ie)); + } while (ie != b); + } + for (T = this.j.Oe; T != -1; T = this.j.Tf(T)) + (se = this.j.og(T, Z)) != 1 && (se = this.j.yd(T), this.cf(se) && (B == -1 && (B = _.wf(L, -1)), (b = this.j.mm(T)) != -1 && (b = this.j.vj(b), se = this.um(b, m), _.kj(B, se)))); + return this.j.Gp(Z), this.j.Lg(q), A.tn.W(_, C, 1, this.Ov, null), (m = [])[0] = L, m[1] = D, m[2] = C, m; + }, H.prototype.$w = function(T, b) { + var m = -1; + for (T = this.j.mm(T); T != -1; T = this.j.ls(T)) { + var _ = this.j.vj(T); + m == -1 && (m = _); + var C = this.j.Ma(b.Sf(b.cd(_))); + if (this.cf(C)) { + m = _; + break; + } + } + return m; + }, H.prototype.gB = function(T, b) { + for (var m = this.ll(b), _ = this.j.lk(b), C = this.j.vf(b), D = 0, L = 0, B = this.j.mm(_); B != -1; B = this.j.ls(B)) { + var q = this.j.vj(B), Z = T.cd(q), ie = this.j.Ma(T.Sf(Z)); + Z = T.Ya(Z), (ie = (ie & m) != 0) && Z == q && (this.vl = b); + var se = T.V(q); + se != -1 && this.j.Ie(se) == C ? (D++, ie && (this.vl === -1 && Z == se && (q = this.j.kc(b), this.cf(this.ll(q)) && (this.vl = q)), L++)) : (q = T.Na(q)) != -1 && this.j.Ie(q) == C && (D--, ie && (this.vl === -1 && Z === q && (q = this.j.kc(b), this.cf(this.ll(q)) && (this.vl = q)), L--)); + } + return this.j.D(_, this.jH), this.j.D(C, this.kH), (L != 0 ? L : D) * (T = A.h.ub(this.jH, this.kH)); + }, H.prototype.ll = function(T) { + return this.j.fh(T) | this.j.af(T) | this.j.af(this.j.ya(T)); + }, H.prototype.sK = function(T) { + for (var b = this.j.ya(this.j.ue(T)), m = -1; b != T; ) { + if (this.cf(this.ll(b))) { + if (m != -1) + return -1; + m = b; + } + b = this.j.ya(this.j.ue(b)); + } + return m != -1 ? this.j.ya(m) : -1; + }, H.prototype.tK = function(T) { + for (var b = this.j.ya(this.j.kc(T)), m = -1; b != T; ) { + if (this.cf(this.ll(b))) { + if (m != -1) + return -1; + m = b; + } + b = this.j.ya(this.j.kc(b)); + } + return m != -1 ? this.j.ya(m) : -1; + }, H.prototype.hJ = function(T, b, m, _, C) { + var D = this.j.g, L = T, B = this.j.ya(L); + this.j.Kb(L, m, 1), this.j.Kb(B, m, 1), this.vl = -1; + for (var q = this.gB(D, L), Z = L, ie = -1, se = !1, de = 1; ; ) { + var Ce = this.j.ue(L); + if (Ce == B) + break; + if (B = this.j.kc(B), this.j.ya(Ce) != B) { + if ((L = this.sK(L)) == -1) { + se = !0; + break; + } + B = this.j.ya(L); + } else + L = Ce; + if (L == T) { + ie = T; + break; + } + if (Ce = this.ll(L), !this.cf(Ce)) + break; + this.j.Kb(L, m, 1), this.j.Kb(B, m, 1), Z = L, q += this.gB(D, L), de++; + } + if (ie == -1) + for (L = T, B = this.j.ya(L), ie = L; (T = this.j.kc(L)) != B; ) { + if (B = this.j.ue(B), this.j.ya(T) != B) { + if ((L = this.tK(L)) == -1) { + se = !0; + break; + } + B = this.j.ya(L); + } else + L = T; + if (Ce = this.ll(L), !this.cf(Ce)) + break; + this.j.Kb(L, m, 1), this.j.Kb(B, m, 1), ie = L, q += this.gB(D, L), de++; + } + else if (this.vl != -1 && (Z = this.vl, ie = this.j.ue(this.vl), this.j.ya(ie) != this.j.kc(this.j.ya(Z)) && (ie = this.sK(Z)) == -1)) + throw A.i.Ra(); + for (0 <= q || (L = ie, ie = this.j.ya(Z), Z = this.j.ya(L)), m = D.wf(b, -1), L = Z, Z = this.j.lk(Z), se = this.j.vf(ie) == Z && se, q = this.$w(Z, D), q = this.um(q, C), D.kj(m, q), _ != -1 && this.j.pn(Z, _, 1), Z = 0, de = se ? A.P.truncate((de + 1) / 2) : -1; T = this.j.vf(L), q = this.$w(T, D), q = this.um(q, C), D.kj(m, q), Z++, _ != -1 && this.j.pn(T, _, 1), se && Z == de && (m = D.wf(b, -1), D.kj(m, q)), L != ie; ) + if (T = this.j.kc(L), this.j.ue(this.j.ya(L)) != this.j.ya(T)) { + if ((L = this.tK(L)) == -1) + throw A.i.Ra(); + } else + L = T; + }, H.prototype.Rt = function(T) { + for (var b = this.j.g.Kg(1607), m = this.j.bh(), _ = this.j.Oe; _ != -1; _ = this.j.Tf(_)) { + var C = this.j.Je(_), D = C; + do + this.j.Bb(D, m) != 1 && this.cf(this.ll(D)) && this.hJ(D, b, m, -1, T), D = this.j.kc(this.j.ya(D)); + while (D != C); + } + return this.j.Lg(m), b; + }, H.prototype.YX = function(T) { + for (var b = this.j.g, m = b.Kg(1607), _ = b.Kg(550), C = this.j.bh(), D = this.j.Fp(), L = -1, B = this.j.Oe; B != -1; B = this.j.Tf(B)) { + var q = this.j.Je(B), Z = q; + do { + var ie = this.j.Bb(Z, C); + ie != 1 && (ie = this.ll(Z), this.cf(ie) && this.hJ(Z, m, C, D, T)), Z = this.j.kc(this.j.ya(Z)); + } while (Z != q); + } + for (B = this.j.Oe; B != -1; B = this.j.Tf(B)) + (ie = this.j.og(B, D)) != 1 && (ie = this.j.yd(B), this.cf(ie) && (L == -1 && (L = b.wf(_, -1)), (q = this.j.mm(B)) != -1 && (q = this.j.vj(q), q = this.um(q, T), b.kj(L, q)))); + return this.j.Lg(C), this.j.Gp(D), (T = [])[0] = _, T[1] = m, T; + }, H.prototype.pr = function() { + for (var T = this.j.g, b = T.Kg(550), m = T.wf(b, -1), _ = this.j.Oe; _ != -1; _ = this.j.Tf(_)) + if (this.cf(this.j.yd(_))) { + for (var C = -1, D = this.j.mm(_); D != -1; D = this.j.ls(D)) { + var L = this.j.vj(D); + C == -1 && (C = L); + var B = this.j.Ma(T.Sf(T.cd(L))); + if (this.cf(B)) { + C = L; + break; + } + } + T.kj(m, C); + } + return b; + }, H.prototype.eq = function(T) { + this.Ij = []; + for (var b = 0; b < T; b++) + this.Ij[b] = !1; + }, H.WV = function(T, b, m) { + var _ = T.Ja(), C = Array(1e3); + A.P.bv(C, null); + var D = A.P.mg(1e3, 0), L = T.I(), B = !0, q = b.Eb() == 2; + if (b.Eb() != 1 && b.Eb() != 2) + throw A.i.Ra(); + for (var Z = 0; Z < L; ) { + var ie = A.P.truncate(T.gW(C, Z) - Z); + q ? A.jd.nK(b, C, ie, m, D) : A.jd.oK(b, C, ie, m, D); + for (var se = 0, de = 0; de < ie; de++) + D[de] == 0 && (B && (B = !1, _.Gd(T, 0, Z)), se != de && _.Gd(T, Z + se, Z + de), se = de + 1); + B || se == ie || _.Gd(T, Z + se, Z + ie), Z += ie; + } + return B ? T : _; + }, H.uG = function(T, b, m) { + return T instanceof A.ee ? H.WV(T, b, m) : b instanceof A.Ta ? T.B() || b.B() ? T.Ja() : A.Vk.uU(m, T, b) ? A.Vk.xO(T, b) : T.Ja() : H.XV(T, b, m); + }, H.Cv = function(T, b, m, _) { + var C = new A.l(); + T.A(C); + var D = new A.l(); + b.A(D); + var L = new A.l(); + if (L.L(C), L.$b(D), m = A.ua.Xd(m, L, !0), (L = new A.l()).L(D), D = A.ua.Gr(m), L.X(D, D), !C.isIntersecting(L)) { + if (T.Eb() <= b.Eb()) + return H.mi(H.Ue(T.Ja()), T, "&"); + if (T.Eb() > b.Eb()) + return H.mi(H.Ue(b.Ja()), T, "&"); + } + return D = new H(), L = (C = new A.hd()).Ib(H.Ue(T)), b = C.Ib(H.Ue(b)), D.Gt(C, m, _), _ = D.Cv(L, b), T = H.mi(C.Ke(_), T, "&"), A.ba.Ic(T.K()) && (T.Eh(2, m), T.K() == 1736 && T.hm()), T; + }, H.XV = function(T, b, m) { + if (T.B() || b.B()) + return T.Ja(); + var _ = [null], C = [0], D = b.Eb() == 2; + if (b.Eb() != 1 && b.Eb() != 2) + throw A.i.Ra(); + return _[0] = T.D(), D ? A.jd.nK(b, _, 1, m, C) : A.jd.oK(b, _, 1, m, C), C[0] == 0 ? T.Ja() : T; + }, H.prototype.GU = function(T, b, m, _, C) { + if (T.B()) + return T; + var D = new A.hd(); + return T = D.Ib(T), this.Ok(D, T, b, m, _, C); + }, H.prototype.IU = function(T, b, m, _, C, D) { + if (C && T.jc(b) != 550) { + var L = new A.MC(); + L.PX(T, m), L.Pg ? (A.Vk.W(T, m, D, !0), C = !1) : this.j.ty(m); + } else + A.Vk.W(T, m, D, !0), C = !1; + if (_ && T.jc(b) != 550 ? this.j.rJ(T, b, D) : this.j.qJ(T, b, D), this.j.kA) + return this.j.Wg(), this.j = null, this.Ok(T, b, m, _, !1, D); + if (this.j.ty(NaN), D = this.j.Ma(b), this.eq(D + 1), this.Ij[D] = !0, T.jc(b) == 1736 || _ && T.jc(b) != 550) + return T.$o(b, 0), b = this.Qt(b, -1, -1), (T = T.Ke(b)).$o(0), C ? T.Eh(1, 0) : (T.Eh(2, m), T.hm()), T; + if (T.jc(b) == 1607) + return b = this.Rt(-1), T = T.Ke(b), C || T.Eh(2, m), T; + if (T.jc(b) == 550) + return b = this.pr(), T = T.Ke(b), C || T.Eh(2, m), T; + throw A.i.Ra(); + }, H.prototype.Ok = function(T, b, m, _, C, D) { + this.j = new A.ku(); + try { + return this.IU(T, b, m, _, C, D); + } finally { + this.j.Wg(); + } + }, H.Ok = function(T, b, m, _, C) { + return new H().GU(T, b, m, _, C); + }, H.prototype.HU = function(T, b, m, _) { + this.Ov = T, this.j = new A.ku(), T = b.Kn(m); + var C = b.jc(m); + if (T != 1 || C == 550 ? this.j.qJ(b, m, _) : this.j.rJ(b, m, _), !this.j.kA) + if (this.j.ty(NaN), _ = this.j.Ma(m), this.eq(_ + 1), this.Ij[_] = !0, b.jc(m) == 1736 || T == 1 && b.jc(m) != 550) + b.$o(m, 0), _ = this.Qt(m, -1, -1), b.cC(_, m), b.wB(_); + else if (b.jc(m) == 1607) + _ = this.Rt(-1), b.cC(_, m), b.wB(_); + else { + if (b.jc(m) != 550) + throw A.i.ga("internal error"); + _ = this.pr(), b.cC(_, m), b.wB(_); + } + }, H.prototype.km = function(T, b) { + var m = A.ba.uf(this.j.g.jc(T)), _ = A.ba.uf(this.j.g.jc(b)); + if (m > _) + return T; + var C = this.j.Ma(T), D = this.j.Ma(b); + if (this.eq(1 + (C | D)), this.Ij[this.j.Ma(T)] = !0, m == 2 && _ == 2) + return this.Qt(T, b, -1); + if (m == 1 && _ == 2 || m == 1 && _ == 1) + return this.Rt(-1); + if (m == 0) + return this.pr(); + throw A.i.Ra(); + }, H.prototype.Cv = function(T, b) { + var m = A.ba.uf(this.j.g.jc(T)), _ = A.ba.uf(this.j.g.jc(b)), C = this.j.Ma(T), D = this.j.Ma(b); + if (this.eq(1 + (C | D)), this.Ij[this.j.Ma(T) | this.j.Ma(b)] = !0, C = -1, 1 < this.j.g.it.Ba && (C = T), m == 2 && _ == 2) + return this.Qt(T, b, C); + if (m == 1 && 0 < _ || _ == 1 && 0 < m) + return this.Rt(C); + if (m == 0 || _ == 0) + return this.pr(); + throw A.i.Ra(); + }, H.prototype.Kz = function(T, b) { + var m = A.ba.uf(this.j.g.jc(T)), _ = A.ba.uf(this.j.g.jc(b)), C = this.j.Ma(T), D = this.j.Ma(b); + if (this.eq(1 + (C | D)), this.Ij[this.j.Ma(T) | this.j.Ma(b)] = !0, C = -1, 1 < this.j.g.it.Ba && (C = T), m == 2 && _ == 2) + return this.XX(T, b, C); + if (m == 1 && 0 < _ || _ == 1 && 0 < m) + return this.YX(C); + if (m == 0 || _ == 0) + return (T = [])[0] = this.pr(), T; + throw A.i.Ra(); + }, H.prototype.gp = function(T, b) { + var m = A.ba.uf(this.j.g.jc(T)), _ = A.ba.uf(this.j.g.jc(b)), C = this.j.Ma(T), D = this.j.Ma(b); + if (this.eq(1 + (C | D)), this.Ij[this.j.Ma(T)] = !0, this.Ij[this.j.Ma(b)] = !0, m == 2 && _ == 2) + return this.Qt(T, b, -1); + if (m == 1 && _ == 1) + return this.Rt(-1); + if (m == 0 && _ == 0) + return this.pr(); + throw A.i.Ra(); + }, H.Ue = function(T) { + var b = T.K(); + return b == 197 ? (b = new A.Ea(T.description), T.B() || b.bd(T, !1), b) : b == 33 ? (b = new A.ee(T.description), T.B() || b.add(T), b) : b == 322 ? (b = new A.Ua(T.description), T.B() || b.pc(T, !0), b) : T; + }, H.mi = function(T, b, m) { + var _ = T.K(); + return _ == 197 ? (b = new A.Ea(T.description), T.B() || b.bd(T, !1), b) : _ != 33 || m != "|" && m != "^" ? _ == 322 ? (b = new A.Ua(T.description), T.B() || b.pc(T, !0), b) : _ == 33 && m == "-" && b.K() == 33 || _ == 550 && m == "&" && b.K() == 33 ? (b = new A.Ta(T.description), T.B() || T.we(0, b), b) : T : (b = new A.ee(T.description), T.B() || b.add(T), b); + }, H.km = function(T, b, m, _) { + if (T.B() || b.B() || T.Eb() > b.Eb()) + return H.mi(H.Ue(T), T, "-"); + var C = new A.l(); + T.A(C); + var D = new A.l(); + if (b.A(D), !C.isIntersecting(D)) + return H.mi(H.Ue(T), T, "-"); + var L = new A.l(); + return L.L(C), L.$b(D), m = A.ua.Xd(m, L, !0), D = new H(), L = (C = new A.hd()).Ib(H.Ue(T)), b = C.Ib(H.Ue(b)), D.Gt(C, m, _), _ = D.km(L, b), _ = C.Ke(_), T = H.mi(_, T, "-"), A.ba.Ic(T.K()) && (T.Eh(2, m), T.K() == 1736 && T.hm()), T; + }, H.QP = function(T, b, m) { + if (2 > T.length) + throw A.i.O("not enough geometries to dissolve"); + for (var _ = 0, C = 0, D = T.length; C < D; C++) + _ = Math.max(T[C].Eb(), _); + var L = new A.l(); + L.Pa(); + var B = new A.hd(), q = -1, Z = 0, ie = -1; + for (C = 0, D = T.length; C < D; C++) + if (T[C].Eb() == _) + if (T[C].B()) + ie == -1 && (ie = C); + else { + ie = C, q == -1 ? q = B.Ib(H.Ue(T[C])) : B.pN(q, H.Ue(T[C])); + var se = new A.l(); + T[C].yc(se), L.$b(se), Z++; + } + return 2 > Z ? H.Ue(T[ie]) : (T = _ == 2, b = A.ua.Xd(_ == 0 ? b : null, L, !0), new H().Ok(B, q, b, T, !0, m)); + }, H.Kz = function(T, b, m, _) { + var C = [null, null, null], D = new A.l(); + T.A(D); + var L = new A.l(); + b.A(L); + var B = new A.l(); + if (B.L(D), B.$b(L), m = A.ua.Xd(m, B, !0), (B = new A.l()).L(L), L = A.ua.Gr(m), B.X(L, L), !D.isIntersecting(B)) { + if (T.Eb() <= b.Eb()) + return C[(T = H.mi(H.Ue(T.Ja()), T, "&")).Eb()] = T, C; + if (T.Eb() > b.Eb()) + return C[(T = H.mi(H.Ue(b.Ja()), T, "&")).Eb()] = T, C; + } + for (L = new H(), B = (D = new A.hd()).Ib(H.Ue(T)), b = D.Ib(H.Ue(b)), L.Gt(D, m, _), _ = L.Kz(B, b), b = 0; b < _.length; b++) + L = H.mi(D.Ke(_[b]), T, "&"), A.ba.Ic(L.K()) && (L.Eh(2, m), L.K() == 1736 && L.hm()), C[L.Eb()] = L; + return C; + }, H.gp = function(T, b, m, _) { + if (T.Eb() > b.Eb()) + return H.mi(H.Ue(T), T, "^"); + if (T.Eb() < b.Eb() || T.B()) + return H.mi(H.Ue(b), T, "^"); + if (b.B()) + return H.mi(H.Ue(T), T, "^"); + var C = new A.l(); + T.A(C); + var D = new A.l(); + b.A(D); + var L = new A.l(); + return L.L(C), L.$b(D), m = A.ua.Xd(m, L, !0), D = new H(), L = (C = new A.hd()).Ib(H.Ue(T)), b = C.Ib(H.Ue(b)), D.Gt(C, m, _), _ = D.gp(L, b), T = H.mi(C.Ke(_), T, "^"), A.ba.Ic(T.K()) && (T.Eh(2, m), T.K() == 1736 && T.hm()), T; + }, H.prototype.GQ = function(T, b) { + var m = this.j.g; + T = m.wf(T, -1); + for (var _ = b.size, C = 0; C < _; C++) { + var D = b.get(C); + m.kj(T, D); + } + m.mn(T, !0); + }, H.prototype.WW = function(T, b) { + for (var m = this.j.g, _ = m.md; _ != -1; _ = m.ve(_)) + if (_ == b) + for (var C = m.Ob(_); C != -1; C = m.Sb(C)) { + var D = m.Ya(C); + if (D != -1) + for (var L = m.V(D); L != -1; ) { + D = this.j.Ie(D); + var B = this.j.Ie(L); + (D = this.j.nR(D, B)) != -1 && (B = this.j.ya(D), this.j.Kb(D, T, 1), this.j.Kb(B, T, 2)), D = L, L = m.V(D); + } + } + }, H.prototype.YV = function(T, b, m, _) { + m = this.j.Ma(m), _ = this.j.Ma(_); + var C = new A.ja(0); + C.Jb(256); + for (var D = this.j.g, L = this.j.bh(), B = this.j.Oe; B != -1; B = this.j.Tf(B)) { + var q = this.j.Je(B); + if (q != -1) { + var Z = q; + do { + if (this.j.Bb(Z, L) != 1) { + var ie = Z, se = Z, de = !1, Ce = 0; + do { + if (this.j.Kb(ie, L, 1), !de) { + var Ve = this.j.fh(ie); + Ve & _ && this.j.af(ie) & m && (se = ie, de = !0); + } + de && (C.add(this.j.vj(this.j.mm(this.j.lk(ie)))), T != -1 && (Ve = this.j.fh(ie)) & _ && (Ce |= Ve = this.j.Bb(ie, T))), ie = this.j.kc(ie); + } while (ie != se); + de && 0 < this.j.Mp(this.j.$e(se)) && (ie = D.Kg(1736), this.GQ(ie, C), b != -1 && D.CJ(ie, b, Ce)), C.clear(!1); + } + Z = this.j.kc(this.j.ya(Z)); + } while (Z != q); + } + } + this.j.Lg(L); + }, H.prototype.AP = function(T, b, m, _) { + this.j.tW(); + var C = -1; + T != -1 && (C = this.j.bh(), this.WW(C, m)), this.YV(C, T, b, m), C != -1 && (this.j.Lg(C), C = -1); + var D = this.j.g; + for (T = 0, C = D.md; C != -1; C = D.ve(C)) + C != b && C != m && (_.add(C), T++); + _.Wd(0, T, function(L, B) { + return (L = D.qz(D.Ob(L))) < (B = D.qz(D.Ob(B))) ? -1 : L == B ? 0 : 1; + }); + }, H.prototype.Wg = function() { + this.j != null && (this.j.Wg(), this.j = null); + }, H; + }(); + A.Hg = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H(T) { + T !== void 0 ? this.Jt(T) : this.MB(); + } + return H.prototype.lx = function() { + this.Qb = this.Lb = this.qb = this.jb = this.bb = this.eb = 0; + }, H.prototype.Nb = function(T) { + return this == T || T instanceof H && this.eb == T.eb && this.jb == T.jb && this.Lb == T.Lb && this.qb == T.qb && this.bb == T.bb && this.Qb == T.Qb; + }, H.prototype.dc = function() { + return A.P.wj(), A.P.wj(), A.P.wj(), A.P.wj(), A.P.wj(), A.P.wj(); + }, H.prototype.Gh = function(T, b) { + var m = this.qb * T.x + this.bb * T.y + this.Qb; + b.x = this.eb * T.x + this.jb * T.y + this.Lb, b.y = m; + }, H.prototype.aY = function(T, b, m) { + for (var _ = 0; _ < b; _++) { + var C = T[_].x, D = T[_].y, L = this.eb * C + this.jb * D + this.Lb; + C = this.qb * C + this.bb * D + this.Qb, m[_] != null ? m[_].na(L, C) : m[_] = A.h.construct(L, C); + } + }, H.prototype.multiply = function(T) { + H.multiply(this, T, this); + }, H.multiply = function(T, b, m) { + var _ = T.eb * b.eb + T.qb * b.jb, C = T.jb * b.eb + T.bb * b.jb, D = T.Lb * b.eb + T.Qb * b.jb + b.Lb, L = T.eb * b.qb + T.qb * b.bb, B = T.jb * b.qb + T.bb * b.bb; + T = T.Lb * b.qb + T.Qb * b.bb + b.Qb, m.eb = _, m.jb = C, m.Lb = D, m.qb = L, m.bb = B, m.Qb = T; + }, H.prototype.Qf = function() { + var T = new H(); + return T.eb = this.eb, T.jb = this.jb, T.Lb = this.Lb, T.qb = this.qb, T.bb = this.bb, T.Qb = this.Qb, T; + }, H.prototype.hC = function(T) { + if (!T.B()) { + for (var b = [], m = 0; 4 > m; m++) + b[m] = new A.h(); + T.iB(b), this.bY(b, b), T.bx(b, 4); + } + }, H.prototype.bY = function(T, b) { + for (var m = 0; m < T.length; m++) { + var _ = new A.h(), C = T[m]; + _.x = this.eb * C.x + this.jb * C.y + this.Lb, _.y = this.qb * C.x + this.bb * C.y + this.Qb, b[m] = _; + } + }, H.prototype.kS = function(T, b) { + T.B() || b.B() || T.S() == 0 || T.da() == 0 ? this.lx() : (this.jb = this.qb = 0, this.eb = b.S() / T.S(), this.bb = b.da() / T.da(), this.Lb = b.v - T.v * this.eb, this.Qb = b.G - T.G * this.bb); + }, H.prototype.$X = function(T) { + var b = new A.h(), m = new A.h(); + b.na(this.eb, this.qb), m.na(this.jb, this.bb), b.sub(b); + var _ = 0.5 * b.Uk(); + return b.na(this.eb, this.qb), m.na(this.jb, this.bb), b.add(m), T * (_ > (b = 0.5 * b.Uk()) ? Math.sqrt(_) : Math.sqrt(b)); + }, H.prototype.MB = function() { + this.eb = 1, this.qb = this.Lb = this.jb = 0, this.bb = 1, this.Qb = 0; + }, H.prototype.isIdentity = function(T) { + if (T !== void 0) { + var b = A.h.construct(0, 1); + return this.Gh(b, b), b.sub(A.h.construct(0, 1)), b.Uk() > T * T ? !1 : (b.na(0, 0), this.Gh(b, b), !(b.Uk() > T * T) && (b.na(1, 0), this.Gh(b, b), b.sub(A.h.construct(1, 0)), b.Uk() <= T * T)); + } + return this.eb == 1 && this.bb == 1 && this.jb == 0 && this.Lb == 0 && this.qb == 0 && this.Qb == 0; + }, H.prototype.Di = function(T) { + return Math.abs(this.eb * this.bb - this.qb * this.jb) <= 2 * T * (Math.abs(this.eb * this.bb) + Math.abs(this.qb * this.jb)); + }, H.prototype.ig = function(T, b) { + this.eb = 1, this.jb = 0, this.Lb = T, this.qb = 0, this.bb = 1, this.Qb = b; + }, H.prototype.Jt = function(T, b) { + b !== void 0 ? (this.eb = T, this.qb = this.Lb = this.jb = 0, this.bb = b, this.Qb = 0) : this.Jt(T, T); + }, H.prototype.VB = function() { + this.eb = 0, this.jb = 1, this.Lb = 0, this.qb = 1, this.Qb = this.bb = 0; + }, H.prototype.kX = function(T) { + this.lX(Math.cos(T), Math.sin(T)); + }, H.prototype.lX = function(T, b) { + this.eb = T, this.jb = -b, this.Lb = 0, this.qb = b, this.bb = T, this.Qb = 0; + }, H.prototype.shift = function(T, b) { + this.Lb += T, this.Qb += b; + }, H.prototype.scale = function(T, b) { + this.eb *= T, this.jb *= T, this.Lb *= T, this.qb *= b, this.bb *= b, this.Qb *= b; + }, H.prototype.flipX = function(T, b) { + this.eb = -this.eb, this.jb = -this.jb, this.Lb = T + b - this.Lb; + }, H.prototype.flipY = function(T, b) { + this.qb = -this.qb, this.bb = -this.bb, this.Qb = T + b - this.Qb; + }, H.prototype.rotate = function(T) { + var b = new H(); + b.kX(T), this.multiply(b); + }, H.prototype.inverse = function(T) { + if (T !== void 0) { + var b = this.eb * this.bb - this.jb * this.qb; + b == 0 ? T.lx() : (b = 1 / b, T.Lb = (this.jb * this.Qb - this.Lb * this.bb) * b, T.Qb = (this.Lb * this.qb - this.eb * this.Qb) * b, T.eb = this.bb * b, T.jb = -this.jb * b, T.qb = -this.qb * b, T.bb = this.eb * b); + } else + this.inverse(this); + }, H; + }(); + A.Ed = ve; + }(le || (le = {})), function(A) { + var ve = function() { + function H() { + } + return H.prototype.lx = function() { + this.Cg = this.Qb = this.Lb = this.Ze = this.We = this.Ve = this.Ye = this.bb = this.jb = this.pf = this.qb = this.eb = 0; + }, H.prototype.Jt = function(T, b) { + this.eb = T, this.jb = this.pf = this.qb = 0, this.bb = b, this.We = this.Ve = this.Ye = 0, this.Ze = void 0, this.Cg = this.Qb = this.Lb = 0; + }, H.prototype.translate = function(T, b, m) { + this.Lb += T, this.Qb += b, this.Cg += m; + }, H.prototype.hC = function(T) { + if (!T.B()) { + for (var b = new A.Od[8](), m = 0; 8 > m; m++) + b[m] = new A.Od(); + T.iB(b), this.transform(b, 8, b), T.bx(b); + } + }, H.prototype.transform = function(T, b, m) { + for (var _ = 0; _ < b; _++) { + var C = new A.Od(), D = T[_]; + C.x = this.eb * D.x + this.jb * D.y + this.Ve * D.z + this.Lb, C.y = this.qb * D.x + this.bb * D.y + this.We * D.z + this.Qb, C.z = this.pf * D.x + this.Ye * D.y + this.Ze * D.z + this.Cg, m[_] = C; + } + }, H.prototype.hp = function(T) { + var b = new A.Od(); + return b.x = this.eb * T.x + this.jb * T.y + this.Ve * T.z + this.Lb, b.y = this.qb * T.x + this.bb * T.y + this.We * T.z + this.Qb, b.z = this.pf * T.x + this.Ye * T.y + this.Ze * T.z + this.Cg, b; + }, H.prototype.Bg = function(T) { + H.multiply(this, T, this); + }, H.multiply = function(T, b, m) { + var _ = T.eb * b.eb + T.qb * b.jb + T.pf * b.Ve, C = T.eb * b.qb + T.qb * b.bb + T.pf * b.We, D = T.eb * b.pf + T.qb * b.Ye + T.pf * b.Ze, L = T.jb * b.eb + T.bb * b.jb + T.Ye * b.Ve, B = T.jb * b.qb + T.bb * b.bb + T.Ye * b.We, q = T.jb * b.pf + T.bb * b.Ye + T.Ye * b.Ze, Z = T.Ve * b.eb + T.We * b.jb + T.Ze * b.Ve, ie = T.Ve * b.qb + T.We * b.bb + T.Ze * b.We, se = T.Ve * b.pf + T.We * b.Ye + T.Ze * b.Ze, de = T.Lb * b.eb + T.Qb * b.jb + T.Cg * b.Ve + b.Lb, Ce = T.Lb * b.qb + T.Qb * b.bb + T.Cg * b.We + b.Qb; + T = T.Lb * b.pf + T.Qb * b.Ye + T.Cg * b.Ze + b.Cg, m.eb = _, m.qb = C, m.pf = D, m.jb = L, m.bb = B, m.Ye = q, m.Ve = Z, m.We = ie, m.Ze = se, m.Lb = de, m.Qb = Ce, m.Cg = T; + }, H.inverse = function(T, b) { + var m = T.eb * (T.bb * T.Ze - T.Ye * T.We) - T.qb * (T.jb * T.Ze - T.Ye * T.Ve) + T.pf * (T.jb * T.We - T.bb * T.Ve); + if (m == 0) + throw A.i.ga("math singularity"); + var _ = 1 / m; + m = (T.bb * T.Ze - T.Ye * T.We) * _; + var C = -(T.jb * T.Ze - T.Ye * T.Ve) * _, D = (T.jb * T.We - T.bb * T.Ve) * _, L = -(T.qb * T.Ze - T.We * T.pf) * _, B = (T.eb * T.Ze - T.pf * T.Ve) * _, q = -(T.eb * T.We - T.qb * T.Ve) * _, Z = (T.qb * T.Ye - T.pf * T.bb) * _, ie = -(T.eb * T.Ye - T.pf * T.jb) * _; + _ *= T.eb * T.bb - T.qb * T.jb; + var se = -(T.Lb * m + T.Qb * C + T.Cg * D), de = -(T.Lb * L + T.Qb * B + T.Cg * q); + T = -(T.Lb * Z + T.Qb * ie + T.Cg * _), b.eb = m, b.qb = L, b.pf = Z, b.jb = C, b.bb = B, b.Ye = ie, b.Ve = D, b.We = q, b.Ze = _, b.Lb = se, b.Qb = de, b.Cg = T; + }, H.prototype.Qf = function() { + var T = new H(); + return T.eb = this.eb, T.qb = this.qb, T.pf = this.pf, T.jb = this.jb, T.bb = this.bb, T.Ye = this.Ye, T.Ve = this.Ve, T.We = this.We, T.Ze = this.Ze, T.Lb = this.Lb, T.Qb = this.Qb, T.Cg = this.Cg, T; + }, H; + }(); + A.FY = ve; + }(le || (le = {})), function(A) { + var ve = function(T) { + function b(m) { + if (m !== void 0) + m = T.call(this, m.dc(), m) || this; + else { + (m = T.call(this) || this).dg = [], m.dg[0] = 0, m.Ba = 1, m.wh = []; + for (var _ = 0; 10 > _; _++) + m.wh[_] = -1; + m.wh[m.dg[0]] = 0; + } + return m.lq = !0, m; + } + return Ne(b, T), b.prototype.se = function(m) { + this.hasAttribute(m) || (this.wh[m] = 0, this.eD()); + }, b.prototype.removeAttribute = function(m) { + if (m == 0) + throw A.i.O("Position attribue cannot be removed"); + this.hasAttribute(m) && (this.wh[m] = -1, this.eD()); + }, b.prototype.reset = function() { + this.dg[0] = 0, this.Ba = 1; + for (var m = 0; m < this.wh.length; m++) + this.wh[m] = -1; + this.wh[this.dg[0]] = 0, this.lq = !0; + }, b.prototype.zF = function() { + return H.fz().add(this); + }, b.pg = function() { + return H.fz().VR(); + }, b.prototype.oM = function() { + var m = this.dc(); + return new A.sa(m, this); + }, b.prototype.eD = function() { + for (var m = this.Ba = 0, _ = 0; 10 > m; m++) + 0 <= this.wh[m] && (this.dg[_] = m, this.wh[m] = _, _++, this.Ba++); + this.lq = !0; + }, b.prototype.dc = function() { + return this.lq && (this.yl = this.Cn(), this.lq = !1), this.yl; + }, b.prototype.Nb = function(m) { + if (m == null) + return !1; + if (m == this) + return !0; + if (!(m instanceof b) || m.Ba != this.Ba) + return !1; + for (var _ = 0; _ < this.Ba; _++) + if (this.dg[_] != m.dg[_]) + return !1; + return this.lq == m.lq; + }, b.prototype.BG = function(m) { + if (m.Ba != this.Ba) + return !1; + for (var _ = 0; _ < this.Ba; _++) + if (this.dg[_] != m.dg[_]) + return !1; + return !0; + }, b.Kw = function(m, _) { + for (var C = [], D = 0; D < m.Ba; D++) + C[D] = -1; + D = 0; + for (var L = m.Ba; D < L; D++) + C[D] = _.Rf(m.ld(D)); + return C; + }, b.wR = function(m, _) { + return (m = new b(m)).se(_), m.zF(); + }, b.xR = function(m, _) { + for (var C = null, D = 0; 10 > D; D++) + !m.hasAttribute(D) && _.hasAttribute(D) && (C == null && (C = new b(m)), C.se(D)); + return C != null ? C.zF() : m; + }, b; + }(A.sa); + A.fe = ve; + var H = function() { + function T() { + this.map = []; + var b = new ve(); + this.add(b), (b = new ve()).se(1), this.add(b); + } + return T.fz = function() { + return T.XK; + }, T.prototype.VR = function() { + return T.gt; + }, T.prototype.add = function(b) { + var m = b.dc(); + if (T.gt != null && T.gt.dc() == m && b.BG(T.gt)) + return T.gt; + if (T.Fw != null && T.Fw.dc() == m && b.BG(T.Fw)) + return T.Fw; + var _ = null; + return this.map[m] !== void 0 && (_ = this.map[m]), _ == null && ((_ = b.oM()).Ba == 1 ? T.gt = _ : _.Ba == 2 && _.ld(1) == 1 ? T.Fw = _ : this.map[m] = _), _; + }, T.XK = new T(), T; + }(); + }(le || (le = {})); + var Ft = { feet: 9002, kilometers: 9036, meters: 9001, miles: 9093, "nautical-miles": 9030, yards: 9096 }, ei = { acres: 109402, ares: 109463, hectares: 109401, "square-feet": 109405, "square-kilometers": 109414, "square-meters": 109404, "square-miles": 109439, "square-yards": 109442 }, mt = new (function() { + function A() { + this.MM = 50, this.pp = /* @__PURE__ */ new Map(), this.ij = []; + } + return A.prototype.clear = function() { + this.ij.length = 0, this.pp.clear(); + }, A.prototype.delete = function(ve) { + return !!this.pp.delete(ve) && (this.ij.splice(this.ij.indexOf(ve), 1), !0); + }, A.prototype.get = function(ve) { + var H = this.pp.get(ve); + if (H !== void 0) + return this.ij[0] !== ve && (this.ij.splice(this.ij.indexOf(ve), 1), this.ij.unshift(ve)), H; + }, A.prototype.has = function(ve) { + return this.pp.has(ve); + }, A.prototype.set = function(ve, H) { + return this.get(ve) !== void 0 && this.delete(ve), this.ij.unshift(ve), this.pp.set(ve, H), this.jM(), this; + }, A.prototype.jM = function() { + for (; this.ij.length && this.ij.length > this.MM; ) { + var ve = this.ij.pop(); + this.pp.delete(ve); + } + }, A; + }())(), Ue = ((st = {}).convertJSONToGeometry = function(A) { + return le.ac.aP(A); + }, st.hasM = function(A) { + return A.hasAttribute(le.Kh.M); + }, st.hasZ = function(A) { + return A.hasAttribute(le.Kh.Z); + }, st.getPointX = function(A) { + return A.Ng(); + }, st.getPointY = function(A) { + return A.kh(); + }, st.getPointZ = function(A) { + return A.XR(); + }, st.getPointM = function(A) { + return A.uR(); + }, st.getXMin = function(A) { + return A.gs(); + }, st.getYMin = function(A) { + return A.js(); + }, st.getXMax = function(A) { + return A.fs(); + }, st.getYMax = function(A) { + return A.hs(); + }, st.getZExtent = function(A) { + return A.Vg(le.Kh.Z, 0); + }, st.getMExtent = function(A) { + return A.Vg(le.Kh.M, 0); + }, st.exportPaths = function(A) { + var ve = [], H = A.ea(), T = null, b = null, m = A.hasAttribute(le.Kh.Z), _ = A.hasAttribute(le.Kh.M); + m && (T = A.vb(le.Kh.Z)), _ && (b = A.vb(le.Kh.M)); + for (var C = new le.h(), D = 0; D < H; D++) { + for (var L = A.Ca(D), B = A.Ka(D), q = 0, Z = 0, ie = NaN, se = NaN, de = NaN, Ce = NaN, Ve = A.ec(D), Je = [], Pt = L; Pt < L + B; Pt++) { + A.D(Pt, C), Ce = de = NaN; + var $t = [C.x, C.y]; + m && (de = T.get(Pt), $t.push(de)), _ && (Ce = b.get(Pt), $t.push(Ce)), Pt == L && Ve && (q = C.x, Z = C.y, ie = de, se = Ce), Je.push($t); + } + !Ve || q == C.x && Z == C.y && (!m || isNaN(ie) && isNaN(de) || ie == de) && (!_ || isNaN(se) && isNaN(Ce) || se == Ce) || Je.push(Je[0].slice(0)), ve.push(Je); + } + return ve; + }, st.exportPathsFlat = function() { + }, st.exportPoints = function(A) { + var ve = A.hasAttribute(le.Kh.Z), H = A.hasAttribute(le.Kh.M), T = null, b = null; + ve && (T = A.vb(le.Kh.Z)), H && (b = A.vb(le.Kh.M)); + for (var m = new le.h(), _ = A.I(), C = [], D = 0; D < _; D++) { + A.D(D, m); + var L = [m.x, m.y]; + ve && L.push(T.get(D)), H && L.push(b.get(D)), C.push(L); + } + return C; + }, st.exportPointsFlat = function() { + }, st), si = /* @__PURE__ */ new Map(); + return function() { + function A() { + } + return A.buffer = ce, A.clip = y, A.contains = x, A.convexHull = fe, A.crosses = I, A.cut = v, A.densify = et, A.difference = be, A.disjoint = Y, A.distance = P, A.equals = F, A.extendedSpatialReferenceInfo = p, A.generalize = je, A.geodesicArea = Mt, A.geodesicBuffer = xe, A.geodesicDensify = Qe, A.geodesicLength = kt, A.intersect = Me, A.intersects = k, A.isSimple = re, A.nearestCoordinate = Oe, A.nearestVertex = Re, A.nearestVertices = Ge, A.offset = J, A.overlaps = X, A.planarArea = tt, A.planarLength = ft, A.relate = Q, A.simplify = he, A.symmetricDifference = Se, A.touches = V, A.union = ke, A.within = j, A.rotate = le.Dx.rotate, A.flipHorizontal = le.Dx.EQ, A.flipVertical = le.Dx.FQ, A.intersectLinesToPoints = wt, A.ExtendedParams = le.tC, A.clearDefaultSpatialReferenceTolerance = at, A.changeDefaultSpatialReferenceTolerance = Be, A._enableProjection = Tt, A._project = nt, A._getTransformation = It, A._getTransformationBySuitability = Nt, A; + }(); + } + var r = i(); + r !== void 0 && (t.exports = r); +})({ get exports() { + return efe; +}, set exports(t) { + efe = t; +} }); +const Kn = efe, ZLi = JLi({ __proto__: null, default: Kn }, [efe]), QLi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + G: Kn, + g: ZLi +}, Symbol.toStringTag, { value: "Module" })), xu = { convertToGEGeometry: e5i, exportPoint: i5i, exportPolygon: n5i, exportPolyline: o5i, exportMultipoint: l5i, exportExtent: c5i }; +function e5i(t, e) { + return e == null ? null : t.convertJSONToGeometry(e); +} +let t5i = class { + constructor(e, i, r) { + this.x = e, this.y = i, this.spatialReference = r, this.z = void 0, this.m = void 0; + } +}; +function i5i(t, e, i) { + const r = new t5i(t.getPointX(e), t.getPointY(e), i), n = t.hasZ(e), s = t.hasM(e); + return n && (r.z = t.getPointZ(e)), s && (r.m = t.getPointM(e)), r; +} +let r5i = class { + constructor(e, i, r, n) { + this.rings = e, this.spatialReference = i, this.hasZ = void 0, this.hasM = void 0, r && (this.hasZ = r), n && (this.hasM = n); + } +}; +function n5i(t, e, i) { + return new r5i(t.exportPaths(e), i, t.hasZ(e), t.hasM(e)); +} +let s5i = class { + constructor(e, i, r, n) { + this.paths = e, this.spatialReference = i, this.hasZ = void 0, this.hasM = void 0, r && (this.hasZ = r), n && (this.hasM = n); + } +}; +function o5i(t, e, i) { + return new s5i(t.exportPaths(e), i, t.hasZ(e), t.hasM(e)); +} +let a5i = class { + constructor(e, i, r, n) { + this.points = e, this.spatialReference = i, this.hasZ = void 0, this.hasM = void 0, r && (this.hasZ = r), n && (this.hasM = n); + } +}; +function l5i(t, e, i) { + return new a5i(t.exportPoints(e), i, t.hasZ(e), t.hasM(e)); +} +let u5i = class { + constructor(e, i, r, n, s) { + this.xmin = e, this.ymin = i, this.xmax = r, this.ymax = n, this.spatialReference = s, this.zmin = void 0, this.zmax = void 0, this.mmin = void 0, this.mmax = void 0; + } +}; +function c5i(t, e, i) { + const r = t.hasZ(e), n = t.hasM(e), s = new u5i(t.getXMin(e), t.getYMin(e), t.getXMax(e), t.getYMax(e), i); + if (r) { + const o = t.getZExtent(e); + s.zmin = o.vmin, s.zmax = o.vmax; + } + if (n) { + const o = t.getMExtent(e); + s.mmin = o.vmin, s.mmax = o.vmax; + } + return s; +} +function EEt(t) { + return Kn.extendedSpatialReferenceInfo(t); +} +function IEt(t, e, i) { + return Kn.clip(xu, t, e, i); +} +function AEt(t, e, i) { + return Kn.cut(xu, t, e, i); +} +function PEt(t, e, i) { + return Kn.contains(xu, t, e, i); +} +function OEt(t, e, i) { + return Kn.crosses(xu, t, e, i); +} +function REt(t, e, i, r) { + return Kn.distance(xu, t, e, i, r); +} +function MEt(t, e, i) { + return Kn.equals(xu, t, e, i); +} +function DEt(t, e, i) { + return Kn.intersects(xu, t, e, i); +} +function FEt(t, e, i) { + return Kn.touches(xu, t, e, i); +} +function LEt(t, e, i) { + return Kn.within(xu, t, e, i); +} +function NEt(t, e, i) { + return Kn.disjoint(xu, t, e, i); +} +function kEt(t, e, i) { + return Kn.overlaps(xu, t, e, i); +} +function $Et(t, e, i, r) { + return Kn.relate(xu, t, e, i, r); +} +function BEt(t, e) { + return Kn.isSimple(xu, t, e); +} +function VEt(t, e) { + return Kn.simplify(xu, t, e); +} +function jEt(t, e, i = !1) { + return Kn.convexHull(xu, t, e, i); +} +function GEt(t, e, i) { + return Kn.difference(xu, t, e, i); +} +function UEt(t, e, i) { + return Kn.symmetricDifference(xu, t, e, i); +} +function zEt(t, e, i) { + return Kn.intersect(xu, t, e, i); +} +function HEt(t, e, i = null) { + return Kn.union(xu, t, e, i); +} +function WEt(t, e, i, r, n, s, o) { + return Kn.offset(xu, t, e, i, r, n, s, o); +} +function qEt(t, e, i, r, n = !1) { + return Kn.buffer(xu, t, e, i, r, n); +} +function YEt(t, e, i, r, n, s, o) { + return Kn.geodesicBuffer(xu, t, e, i, r, n, s, o); +} +function XEt(t, e, i, r = !0) { + return Kn.nearestCoordinate(xu, t, e, i, r); +} +function KEt(t, e, i) { + return Kn.nearestVertex(xu, t, e, i); +} +function JEt(t, e, i, r, n) { + return Kn.nearestVertices(xu, t, e, i, r, n); +} +function ZEt(t, e, i, r) { + if (e == null || r == null) + throw new Error("Illegal Argument Exception"); + const n = Kn.rotate(e, i, r); + return n.spatialReference = t, n; +} +function QEt(t, e, i) { + if (e == null || i == null) + throw new Error("Illegal Argument Exception"); + const r = Kn.flipHorizontal(e, i); + return r.spatialReference = t, r; +} +function eIt(t, e, i) { + if (e == null || i == null) + throw new Error("Illegal Argument Exception"); + const r = Kn.flipVertical(e, i); + return r.spatialReference = t, r; +} +function tIt(t, e, i, r, n) { + return Kn.generalize(xu, t, e, i, r, n); +} +function iIt(t, e, i, r) { + return Kn.densify(xu, t, e, i, r); +} +function rIt(t, e, i, r, n = 0) { + return Kn.geodesicDensify(xu, t, e, i, r, n); +} +function nIt(t, e, i) { + return Kn.planarArea(xu, t, e, i); +} +function sIt(t, e, i) { + return Kn.planarLength(xu, t, e, i); +} +function oIt(t, e, i, r) { + return Kn.geodesicArea(xu, t, e, i, r); +} +function aIt(t, e, i, r) { + return Kn.geodesicLength(xu, t, e, i, r); +} +function lIt(t, e, i) { + return e == null || i == null ? [] : Kn.intersectLinesToPoints(xu, t, e, i); +} +function uIt(t, e) { + Kn.changeDefaultSpatialReferenceTolerance(t, e); +} +function cIt(t) { + Kn.clearDefaultSpatialReferenceTolerance(t); +} +const h5i = Object.freeze(Object.defineProperty({ __proto__: null, buffer: qEt, changeDefaultSpatialReferenceTolerance: uIt, clearDefaultSpatialReferenceTolerance: cIt, clip: IEt, contains: PEt, convexHull: jEt, crosses: OEt, cut: AEt, densify: iIt, difference: GEt, disjoint: NEt, distance: REt, equals: MEt, extendedSpatialReferenceInfo: EEt, flipHorizontal: QEt, flipVertical: eIt, generalize: tIt, geodesicArea: oIt, geodesicBuffer: YEt, geodesicDensify: rIt, geodesicLength: aIt, intersect: zEt, intersectLinesToPoints: lIt, intersects: DEt, isSimple: BEt, nearestCoordinate: XEt, nearestVertex: KEt, nearestVertices: JEt, offset: WEt, overlaps: kEt, planarArea: nIt, planarLength: sIt, relate: $Et, rotate: ZEt, simplify: VEt, symmetricDifference: UEt, touches: FEt, union: HEt, within: LEt }, Symbol.toStringTag, { value: "Module" })); +function d5i(t) { + return (0, h5i[t.operation])(...t.parameters); +} +const p5i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + executeGEOperation: d5i +}, Symbol.toStringTag, { value: "Module" })); +let t3e = class { + constructor(e = 9, i) { + this._compareMinX = tJe, this._compareMinY = iJe, this._toBBox = (r) => r, this._maxEntries = Math.max(4, e || 9), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), i && (typeof i == "function" ? this._toBBox = i : this._initFormat(i)), this.clear(); + } + destroy() { + this.clear(), p5.prune(), yoe.prune(), i_.prune(), voe.prune(); + } + all(e) { + this._all(this._data, e); + } + search(e, i) { + let r = this._data; + const n = this._toBBox; + if (goe(e, r)) + for (p5.clear(); r; ) { + for (let s = 0, o = r.children.length; s < o; s++) { + const a = r.children[s], l = r.leaf ? n(a) : a; + goe(e, l) && (r.leaf ? i(a) : Xwe(e, l) ? this._all(a, i) : p5.push(a)); + } + r = p5.pop(); + } + } + collides(e) { + let i = this._data; + const r = this._toBBox; + if (!goe(e, i)) + return !1; + for (p5.clear(); i; ) { + for (let n = 0, s = i.children.length; n < s; n++) { + const o = i.children[n], a = i.leaf ? r(o) : o; + if (goe(e, a)) { + if (i.leaf || Xwe(e, a)) + return !0; + p5.push(o); + } + } + i = p5.pop(); + } + return !1; + } + load(e) { + if (!e.length) + return this; + if (e.length < this._minEntries) { + for (let r = 0, n = e.length; r < n; r++) + this.insert(e[r]); + return this; + } + let i = this._build(e.slice(0, e.length), 0, e.length - 1, 0); + if (this._data.children.length) + if (this._data.height === i.height) + this._splitRoot(this._data, i); + else { + if (this._data.height < i.height) { + const r = this._data; + this._data = i, i = r; + } + this._insert(i, this._data.height - i.height - 1, !0); + } + else + this._data = i; + return this; + } + insert(e) { + return e && this._insert(e, this._data.height - 1), this; + } + clear() { + return this._data = new que([]), this; + } + remove(e) { + if (!e) + return this; + let i, r = this._data, n = null, s = 0, o = !1; + const a = this._toBBox(e); + for (i_.clear(), voe.clear(); r || i_.length > 0; ) { + if (r || (r = i_.pop(), n = i_.data[i_.length - 1], s = voe.pop() ?? 0, o = !0), r.leaf && (i = L7(r.children, e, r.children.length, r.indexHint), i !== -1)) + return r.children.splice(i, 1), i_.push(r), this._condense(i_), this; + o || r.leaf || !Xwe(r, a) ? n ? (s++, r = n.children[s], o = !1) : r = null : (i_.push(r), voe.push(s), s = 0, n = r, r = r.children[0]); + } + return this; + } + toJSON() { + return this._data; + } + fromJSON(e) { + return this._data = e, this; + } + _all(e, i) { + let r = e; + for (yoe.clear(); r; ) { + if (r.leaf === !0) + for (const n of r.children) + i(n); + else + yoe.pushArray(r.children); + r = yoe.pop() ?? null; + } + } + _build(e, i, r, n) { + const s = r - i + 1; + let o = this._maxEntries; + if (s <= o) { + const h = new que(e.slice(i, r + 1)); + return hB(h, this._toBBox), h; + } + n || (n = Math.ceil(Math.log(s) / Math.log(o)), o = Math.ceil(s / o ** (n - 1))); + const a = new Kwe([]); + a.height = n; + const l = Math.ceil(s / o), c = l * Math.ceil(Math.sqrt(o)); + rJe(e, i, r, c, this._compareMinX); + for (let h = i; h <= r; h += c) { + const p = Math.min(h + c - 1, r); + rJe(e, h, p, l, this._compareMinY); + for (let y = h; y <= p; y += l) { + const v = Math.min(y + l - 1, p); + a.children.push(this._build(e, y, v, n - 1)); + } + } + return hB(a, this._toBBox), a; + } + _chooseSubtree(e, i, r, n) { + for (; n.push(i), i.leaf !== !0 && n.length - 1 !== r; ) { + let s, o = 1 / 0, a = 1 / 0; + for (let l = 0, c = i.children.length; l < c; l++) { + const h = i.children[l], p = Ywe(h), y = f5i(e, h) - p; + y < a ? (a = y, o = p < o ? p : o, s = h) : y === a && p < o && (o = p, s = h); + } + i = s || i.children[0]; + } + return i; + } + _insert(e, i, r) { + const n = this._toBBox, s = r ? e : n(e); + i_.clear(); + const o = this._chooseSubtree(s, this._data, i, i_); + for (o.children.push(e), hX(o, s); i >= 0 && i_.data[i].children.length > this._maxEntries; ) + this._split(i_, i), i--; + this._adjustParentBBoxes(s, i_, i); + } + _split(e, i) { + const r = e.data[i], n = r.children.length, s = this._minEntries; + this._chooseSplitAxis(r, s, n); + const o = this._chooseSplitIndex(r, s, n); + if (!o) + return void console.log(" Error: assertion failed at PooledRBush._split: no valid split index"); + const a = r.children.splice(o, r.children.length - o), l = r.leaf ? new que(a) : new Kwe(a); + l.height = r.height, hB(r, this._toBBox), hB(l, this._toBBox), i ? e.data[i - 1].children.push(l) : this._splitRoot(r, l); + } + _splitRoot(e, i) { + this._data = new Kwe([e, i]), this._data.height = e.height + 1, hB(this._data, this._toBBox); + } + _chooseSplitIndex(e, i, r) { + let n, s, o; + n = s = 1 / 0; + for (let a = i; a <= r - i; a++) { + const l = cX(e, 0, a, this._toBBox), c = cX(e, a, r, this._toBBox), h = m5i(l, c), p = Ywe(l) + Ywe(c); + h < n ? (n = h, o = a, s = p < s ? p : s) : h === n && p < s && (s = p, o = a); + } + return o; + } + _chooseSplitAxis(e, i, r) { + const n = e.leaf ? this._compareMinX : tJe, s = e.leaf ? this._compareMinY : iJe; + this._allDistMargin(e, i, r, n) < this._allDistMargin(e, i, r, s) && e.children.sort(n); + } + _allDistMargin(e, i, r, n) { + e.children.sort(n); + const s = this._toBBox, o = cX(e, 0, i, s), a = cX(e, r - i, r, s); + let l = moe(o) + moe(a); + for (let c = i; c < r - i; c++) { + const h = e.children[c]; + hX(o, e.leaf ? s(h) : h), l += moe(o); + } + for (let c = r - i - 1; c >= i; c--) { + const h = e.children[c]; + hX(a, e.leaf ? s(h) : h), l += moe(a); + } + return l; + } + _adjustParentBBoxes(e, i, r) { + for (let n = r; n >= 0; n--) + hX(i.data[n], e); + } + _condense(e) { + for (let i = e.length - 1; i >= 0; i--) { + const r = e.data[i]; + if (r.children.length === 0) + if (i > 0) { + const n = e.data[i - 1], s = n.children; + s.splice(L7(s, r, s.length, n.indexHint), 1); + } else + this.clear(); + else + hB(r, this._toBBox); + } + } + _initFormat(e) { + const i = ["return a", " - b", ";"]; + this._compareMinX = new Function("a", "b", i.join(e[0])), this._compareMinY = new Function("a", "b", i.join(e[1])), this._toBBox = new Function("a", "return {minX: a" + e[0] + ", minY: a" + e[1] + ", maxX: a" + e[2] + ", maxY: a" + e[3] + "};"); + } +}; +function hB(t, e) { + cX(t, 0, t.children.length, e, t); +} +function cX(t, e, i, r, n) { + n || (n = new que([])), n.minX = 1 / 0, n.minY = 1 / 0, n.maxX = -1 / 0, n.maxY = -1 / 0; + for (let s, o = e; o < i; o++) + s = t.children[o], hX(n, t.leaf ? r(s) : s); + return n; +} +function hX(t, e) { + t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY); +} +function tJe(t, e) { + return t.minX - e.minX; +} +function iJe(t, e) { + return t.minY - e.minY; +} +function Ywe(t) { + return (t.maxX - t.minX) * (t.maxY - t.minY); +} +function moe(t) { + return t.maxX - t.minX + (t.maxY - t.minY); +} +function f5i(t, e) { + return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY)); +} +function m5i(t, e) { + const i = Math.max(t.minX, e.minX), r = Math.max(t.minY, e.minY), n = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY); + return Math.max(0, n - i) * Math.max(0, s - r); +} +function Xwe(t, e) { + return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY; +} +function goe(t, e) { + return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY; +} +function rJe(t, e, i, r, n) { + const s = [e, i]; + for (; s.length; ) { + const o = s.pop(), a = s.pop(); + if (o - a <= r) + continue; + const l = a + Math.ceil((o - a) / r / 2) * r; + I1t(t, l, a, o, n), s.push(a, l, l, o); + } +} +const p5 = new Qm(), yoe = new Qm(), i_ = new Qm(), voe = new Qm({ deallocator: void 0 }); +let g5i = class { + constructor() { + this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0; + } +}, hIt = class extends g5i { + constructor() { + super(...arguments), this.height = 1, this.indexHint = new Kme(); + } +}, que = class extends hIt { + constructor(e) { + super(), this.children = e, this.leaf = !0; + } +}, Kwe = class extends hIt { + constructor(e) { + super(), this.children = e, this.leaf = !1; + } +}; +const y5i = 5e4, dX = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; +function v5i(t) { + dX.minX = t[0], dX.minY = t[1], dX.maxX = t[2], dX.maxY = t[3]; +} +function _5i(t, e, i) { + v5i(e), t.search(dX, i); +} +let W$e = class { + constructor() { + this._indexInvalid = !1, this._boundsToLoad = [], this._boundsById = /* @__PURE__ */ new Map(), this._idByBounds = /* @__PURE__ */ new Map(), this._index = new t3e(9, Vi("esri-csp-restrictions") ? (e) => ({ minX: e[0], minY: e[1], maxX: e[2], maxY: e[3] }) : ["[0]", "[1]", "[2]", "[3]"]), this._loadIndex = () => { + if (this._indexInvalid) { + const e = new Array(this._idByBounds.size); + let i = 0; + this._idByBounds.forEach((r, n) => { + e[i++] = n; + }), this._indexInvalid = !1, this._index.clear(), this._index.load(e); + } else + this._boundsToLoad.length && (this._index.load(Array.from(new Set(this._boundsToLoad.filter((e) => this._idByBounds.has(e))))), this._boundsToLoad.length = 0); + }; + } + get fullBounds() { + if (!this._boundsById.size) + return null; + const e = cLe(); + for (const i of this._boundsById.values()) + i && (e[0] = Math.min(i[0], e[0]), e[1] = Math.min(i[1], e[1]), e[2] = Math.max(i[2], e[2]), e[3] = Math.max(i[3], e[3])); + return e; + } + get valid() { + return !this._indexInvalid; + } + clear() { + this._indexInvalid = !1, this._boundsToLoad.length = 0, this._boundsById.clear(), this._idByBounds.clear(), this._index.clear(); + } + delete(e) { + const i = this._boundsById.get(e); + this._boundsById.delete(e), i && (this._idByBounds.delete(i), this._indexInvalid || this._index.remove(i)); + } + forEachInBounds(e, i) { + this._loadIndex(), _5i(this._index, e, (r) => i(this._idByBounds.get(r))); + } + get(e) { + return this._boundsById.get(e); + } + has(e) { + return this._boundsById.has(e); + } + invalidateIndex() { + this._indexInvalid || (this._indexInvalid = !0, this._boundsToLoad.length = 0); + } + set(e, i) { + if (!this._indexInvalid) { + const r = this._boundsById.get(e); + r && (this._index.remove(r), this._idByBounds.delete(r)); + } + this._boundsById.set(e, i), i && (this._idByBounds.set(i, e), this._indexInvalid || (this._boundsToLoad.push(i), this._boundsToLoad.length > y5i && this._loadIndex())); + } +}; +function q$e(t, e) { + return t ? e ? 4 : 3 : e ? 3 : 2; +} +function dIt(t, e, i, r, n) { + if (ut(e) || !e.lengths.length) + return null; + const s = n?.originPosition === "upperLeft" ? -1 : 1; + t.lengths.length && (t.lengths.length = 0), t.coords.length && (t.coords.length = 0); + const o = t.coords, a = [], l = i ? [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY] : [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY], { lengths: c, coords: h } = e, p = q$e(i, r); + let y = 0; + for (const v of c) { + const x = b5i(l, h, y, v, i, r, s); + x && a.push(x), y += v * p; + } + if (a.sort((v, x) => { + let I = s * v[2] - s * x[2]; + return I === 0 && i && (I = v[4] - x[4]), I; + }), a.length) { + let v = 6 * a[0][2]; + o[0] = a[0][0] / v, o[1] = a[0][1] / v, i && (v = 6 * a[0][4], o[2] = v !== 0 ? a[0][3] / v : 0), (o[0] < l[0] || o[0] > l[1] || o[1] < l[2] || o[1] > l[3] || i && (o[2] < l[4] || o[2] > l[5])) && (o.length = 0); + } + if (!o.length) { + const v = e.lengths[0] ? w5i(h, 0, c[0], i, r) : null; + if (!v) + return null; + o[0] = v[0], o[1] = v[1], i && v.length > 2 && (o[2] = v[2]); + } + return t; +} +function b5i(t, e, i, r, n, s, o = 1) { + const a = q$e(n, s); + let l = i, c = i + a, h = 0, p = 0, y = 0, v = 0, x = 0; + for (let P = 0, F = r - 1; P < F; P++, l += a, c += a) { + const k = e[l], V = e[l + 1], j = e[l + 2], Y = e[c], X = e[c + 1], Q = e[c + 2]; + let re = k * X - Y * V; + v += re, h += (k + Y) * re, p += (V + X) * re, n && (re = k * Q - Y * j, y += (j + Q) * re, x += re), k < t[0] && (t[0] = k), k > t[1] && (t[1] = k), V < t[2] && (t[2] = V), V > t[3] && (t[3] = V), n && (j < t[4] && (t[4] = j), j > t[5] && (t[5] = j)); + } + if (v * o > 0 && (v *= -1), x * o > 0 && (x *= -1), !v) + return null; + const I = [h, p, 0.5 * v]; + return n && (I[3] = y, I[4] = 0.5 * x), I; +} +function w5i(t, e, i, r, n) { + const s = q$e(r, n); + let o = e, a = e + s, l = 0, c = 0, h = 0, p = 0; + for (let y = 0, v = i - 1; y < v; y++, o += s, a += s) { + const x = t[o], I = t[o + 1], P = t[o + 2], F = t[a], k = t[a + 1], V = t[a + 2], j = r ? S5i(x, I, P, F, k, V) : x5i(x, I, F, k); + if (j) + if (l += j, r) { + const Y = T5i(x, I, P, F, k, V); + c += j * Y[0], h += j * Y[1], p += j * Y[2]; + } else { + const Y = C5i(x, I, F, k); + c += j * Y[0], h += j * Y[1]; + } + } + return l > 0 ? r ? [c / l, h / l, p / l] : [c / l, h / l] : i > 0 ? r ? [t[e], t[e + 1], t[e + 2]] : [t[e], t[e + 1]] : null; +} +function x5i(t, e, i, r) { + const n = i - t, s = r - e; + return Math.sqrt(n * n + s * s); +} +function S5i(t, e, i, r, n, s) { + const o = r - t, a = n - e, l = s - i; + return Math.sqrt(o * o + a * a + l * l); +} +function C5i(t, e, i, r) { + return [t + 0.5 * (i - t), e + 0.5 * (r - e)]; +} +function T5i(t, e, i, r, n, s) { + return [t + 0.5 * (r - t), e + 0.5 * (n - e), i + 0.5 * (s - i)]; +} +const E5i = { getObjectId: (t) => t.objectId, getAttributes: (t) => t.attributes, getAttribute: (t, e) => t.attributes[e], cloneWithGeometry: (t, e) => new g1(e, t.attributes, null, t.objectId), getGeometry: (t) => t.geometry, getCentroid: (t, e) => (ut(t.centroid) && (t.centroid = dIt(new Rl(), t.geometry, e.hasZ, e.hasM)), t.centroid) }, Jwe = [0, 0]; +function pIt(t, e) { + if (!e) + return null; + if ("x" in e) { + const i = { x: 0, y: 0 }; + return [i.x, i.y] = t(e.x, e.y, Jwe), e.z != null && (i.z = e.z), e.m != null && (i.m = e.m), i; + } + if ("xmin" in e) { + const i = { xmin: 0, ymin: 0, xmax: 0, ymax: 0 }; + return [i.xmin, i.ymin] = t(e.xmin, e.ymin, Jwe), [i.xmax, i.ymax] = t(e.xmax, e.ymax, Jwe), e.hasZ && (i.zmin = e.zmin, i.zmax = e.zmax, i.hasZ = !0), e.hasM && (i.mmin = e.mmin, i.mmax = e.mmax, i.hasM = !0), i; + } + return "rings" in e ? { rings: nJe(e.rings, t), hasM: e.hasM, hasZ: e.hasZ } : "paths" in e ? { paths: nJe(e.paths, t), hasM: e.hasM, hasZ: e.hasZ } : "points" in e ? { points: fIt(e.points, t), hasM: e.hasM, hasZ: e.hasZ } : null; +} +function nJe(t, e) { + const i = []; + for (const r of t) + i.push(fIt(r, e)); + return i; +} +function fIt(t, e) { + const i = []; + for (const r of t) { + const n = e(r[0], r[1], [0, 0]); + i.push(n), r.length > 2 && n.push(r[2]), r.length > 3 && n.push(r[3]); + } + return i; +} +async function Py(t, e) { + if (!t || !e) + return; + const i = Array.isArray(t) ? t.map((r) => _e(r.geometry) ? r.geometry.spatialReference : null).filter(_e) : [t]; + await LF(i.map((r) => ({ source: r, dest: e }))); +} +const mIt = pIt.bind(null, ND), gIt = pIt.bind(null, kG); +function Cp(t, e, i, r) { + if (!t || (i || (i = e, e = t.spatialReference), !Mh(e) || !Mh(i) || Ea(e, i))) + return t; + if (NG(e, i)) { + const n = wx(i) ? mIt(t) : gIt(t); + return n.spatialReference = i, n; + } + return sQ(xu, [t], e, i, null, r)[0]; +} +let I5i = class { + constructor() { + this._jobs = [], this._timer = null, this._process = this._process.bind(this); + } + async push(e, i, r) { + if (!e || !e.length || !i || !r || Ea(i, r)) + return e; + const n = { geometries: e, inSpatialReference: i, outSpatialReference: r, resolve: null }; + return this._jobs.push(n), new Promise((s) => { + n.resolve = s, this._timer === null && (this._timer = setTimeout(this._process, 10)); + }); + } + _process() { + this._timer = null; + const e = this._jobs.shift(); + if (!e) + return; + const { geometries: i, inSpatialReference: r, outSpatialReference: n, resolve: s } = e; + NG(r, n) ? wx(n) ? s(i.map(mIt)) : s(i.map(gIt)) : s(sQ(xu, i, r, n, null, null)), this._jobs.length > 0 && (this._timer = setTimeout(this._process, 10)); + } +}; +const A5i = new I5i(); +function P5i(t, e, i) { + return A5i.push(t, e, i); +} +const O5i = new zs({ esriSRUnit_Meter: "meters", esriSRUnit_Kilometer: "kilometers", esriSRUnit_Foot: "feet", esriSRUnit_StatuteMile: "miles", esriSRUnit_NauticalMile: "nautical-miles", esriSRUnit_USNauticalMile: "us-nautical-miles" }), dD = Object.freeze({}), sJe = new Rl(), R5i = new Rl(), i3e = new Rl(), Zwe = { esriGeometryPoint: yAe, esriGeometryPolyline: oye, esriGeometryPolygon: W5e, esriGeometryMultipoint: z5e }; +function oJe(t, e, i, r = t.hasZ, n = t.hasM) { + if (ut(e)) + return null; + const s = t.hasZ && r, o = t.hasM && n; + if (i) { + const a = YO(i3e, e, t.hasZ, t.hasM, "esriGeometryPoint", i, r, n); + return yAe(a, s, o); + } + return yAe(e, s, o); +} +function HD(t, e, i, r, n, s, o = e, a = i) { + const l = e && o, c = i && a, h = _e(r) ? "coords" in r ? r : r.geometry : null; + if (ut(h)) + return null; + if (n) { + let p = p0t(R5i, h, e, i, t, n, o, a); + return s && (p = YO(i3e, p, l, c, t, s)), Zwe[t]?.(p, l, c) ?? null; + } + if (s) { + const p = YO(i3e, h, e, i, t, s, o, a); + return Zwe[t]?.(p, l, c) ?? null; + } + return fti(sJe, h, e, i, o, a), Zwe[t]?.(sJe, l, c) ?? null; +} +async function aJe(t, e, i) { + const { outFields: r, orderByFields: n, groupByFieldsForStatistics: s, outStatistics: o } = t; + if (r) + for (let a = 0; a < r.length; a++) + r[a] = r[a].trim(); + if (n) + for (let a = 0; a < n.length; a++) + n[a] = n[a].trim(); + if (s) + for (let a = 0; a < s.length; a++) + s[a] = s[a].trim(); + if (o) + for (let a = 0; a < o.length; a++) + o[a].onStatisticField && (o[a].onStatisticField = o[a].onStatisticField.trim()); + return t.geometry && !t.outSR && (t.outSR = t.geometry.spatialReference), yIt(t, e, i); +} +async function yIt(t, e, i) { + if (!t) + return null; + let { where: r } = t; + if (t.where = r = r && r.trim(), (!r || /^1 *= *1$/.test(r) || e && e === r) && (t.where = null), !t.geometry) + return t; + let n = await D5i(t); + if (t.distance = 0, t.units = null, t.spatialRel === "esriSpatialRelEnvelopeIntersects") { + const { spatialReference: s } = t.geometry; + n = BCe(n), n.spatialReference = s; + } + if (n) { + await Py(n.spatialReference, i), n = M5i(n, i); + const s = (await Nv(Sl(n)))[0]; + if (ut(s)) + throw dD; + const o = "quantizationParameters" in t && t.quantizationParameters?.tolerance || "maxAllowableOffset" in t && t.maxAllowableOffset || 0, a = o && vIt(n, i) ? { densificationStep: 8 * o } : void 0, l = s.toJSON(), c = await Cp(l, l.spatialReference, i, a); + if (!c) + throw dD; + c.spatialReference = i, t.geometry = c; + } + return t; +} +function vIt(t, e) { + if (!t) + return !1; + const i = t.spatialReference; + return (gc(t) || za(t) || ju(t)) && !Ea(i, e) && !f1(i, e); +} +function M5i(t, e) { + const i = t.spatialReference; + return vIt(t, e) && gc(t) ? { spatialReference: i, rings: [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] } : t; +} +async function D5i(t) { + const { distance: e, units: i } = t, r = t.geometry; + if (e == null || "vertexAttributes" in r) + return r; + const n = r.spatialReference, s = i ? O5i.fromJSON(i) : N4e(n), o = n && (oge(n) || wx(n)) ? r : await Py(n, gm).then(() => Cp(r, gm)); + return (await F5i())(o.spatialReference, o, e, s); +} +async function F5i() { + return (await Promise.resolve().then(() => Zie)).geodesicBuffer; +} +function c7(t) { + return t && _It in t ? JSON.parse(JSON.stringify(t, L5i)) : t; +} +const _It = "_geVersion", L5i = (t, e) => t !== _It ? e : void 0, N5i = Sx(); +let zie = class { + constructor(e) { + this.geometryInfo = e, this._boundsStore = new W$e(), this._featuresById = /* @__PURE__ */ new Map(), this._markedIds = /* @__PURE__ */ new Set(), this.events = new Bd(), this.featureAdapter = E5i; + } + get geometryType() { + return this.geometryInfo.geometryType; + } + get hasM() { + return this.geometryInfo.hasM; + } + get hasZ() { + return this.geometryInfo.hasZ; + } + get numFeatures() { + return this._featuresById.size; + } + get fullBounds() { + return this._boundsStore.fullBounds; + } + get storeStatistics() { + let e = 0; + return this._featuresById.forEach((i) => { + _e(i.geometry) && i.geometry.coords && (e += i.geometry.coords.length); + }), { featureCount: this._featuresById.size, vertexCount: e / (this.hasZ ? this.hasM ? 4 : 3 : this.hasM ? 3 : 2) }; + } + getFullExtent(e) { + if (ut(this.fullBounds)) + return null; + const [i, r, n, s] = this.fullBounds; + return { xmin: i, ymin: r, xmax: n, ymax: s, spatialReference: c7(e) }; + } + add(e) { + this._add(e), this._emitChanged(); + } + addMany(e) { + for (const i of e) + this._add(i); + this._emitChanged(); + } + clear() { + this._featuresById.clear(), this._boundsStore.clear(), this._emitChanged(); + } + removeById(e) { + const i = this._featuresById.get(e); + return i ? (this._remove(i), this._emitChanged(), i) : null; + } + removeManyById(e) { + this._boundsStore.invalidateIndex(); + for (const i of e) { + const r = this._featuresById.get(i); + r && this._remove(r); + } + this._emitChanged(); + } + forEachBounds(e, i) { + for (const r of e) { + const n = this._boundsStore.get(r.objectId); + n && i(A7t(N5i, n)); + } + } + getFeature(e) { + return this._featuresById.get(e); + } + has(e) { + return this._featuresById.has(e); + } + forEach(e) { + this._featuresById.forEach((i) => e(i)); + } + forEachInBounds(e, i) { + this._boundsStore.forEachInBounds(e, (r) => { + i(this._featuresById.get(r)); + }); + } + startMarkingUsedFeatures() { + this._boundsStore.invalidateIndex(), this._markedIds.clear(); + } + sweep() { + let e = !1; + this._featuresById.forEach((i, r) => { + this._markedIds.has(r) || (e = !0, this._remove(i)); + }), this._markedIds.clear(), e && this._emitChanged(); + } + _emitChanged() { + this.events.emit("changed", void 0); + } + _add(e) { + if (!e) + return; + const i = e.objectId; + if (i == null) + return void Ei.getLogger("esri.layers.graphics.data.FeatureStore").error(new ot("featurestore:invalid-feature", "feature id is missing", { feature: e })); + const r = this._featuresById.get(i); + let n; + if (this._markedIds.add(i), r ? (e.displayId = r.displayId, n = this._boundsStore.get(i), this._boundsStore.delete(i)) : _e(this.onFeatureAdd) && this.onFeatureAdd(e), ut(e.geometry) || !e.geometry.coords || !e.geometry.coords.length) + return this._boundsStore.set(i, null), void this._featuresById.set(i, e); + n = aye(_e(n) ? n : Eo(), e.geometry, this.geometryInfo.hasZ, this.geometryInfo.hasM), _e(n) && this._boundsStore.set(i, n), this._featuresById.set(i, e); + } + _remove(e) { + _e(this.onFeatureRemove) && this.onFeatureRemove(e); + const i = e.objectId; + return this._markedIds.delete(i), this._boundsStore.delete(i), this._featuresById.delete(i), e; + } +}, k5i = class { + constructor(e, i) { + this._cache = new ade(e), this._invalidCache = new ade(i); + } + get(e, i) { + const r = `${i.uid}:${e}`, n = this._cache.get(r); + if (n) + return n; + if (this._invalidCache.get(r) !== void 0) + return null; + try { + const s = Ma.create(e, i); + return this._cache.put(r, s), s; + } catch { + return this._invalidCache.put(r, null), null; + } + } +}; +const Y$e = new k5i(50, 500), yF = "feature-store:unsupported-query", bIt = " as ", $5i = /* @__PURE__ */ new Set(["esriFieldTypeOID", "esriFieldTypeSmallInteger", "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble", "esriFieldTypeLong", "esriFieldTypeDate"]); +function B5i(t, e) { + if (!e) + return !0; + const i = Y$e.get(e, t); + if (!i) + throw new ot(yF, "invalid SQL expression", { where: e }); + if (!i.isStandardized) + throw new ot(yF, "where clause is not standard", { where: e }); + return PD(t, i.fieldNames, "where clause contains missing fields"), !0; +} +function V5i(t, e, i) { + if (!e) + return !0; + const r = Y$e.get(e, t); + if (!r) + throw new ot(yF, "invalid SQL expression", { having: e }); + if (!r.isAggregate) + throw new ot(yF, "having does not contain a valid aggregate function", { having: e }); + const n = r.fieldNames; + if (PD(t, n, "having contains missing fields"), !r.getExpressions().every((s) => { + const { aggregateType: o, field: a } = s, l = t.get(a)?.name; + return i.some((c) => { + const { onStatisticField: h, statisticType: p } = c; + return t.get(h)?.name === l && p.toLowerCase().trim() === o; + }); + })) + throw new ot(yF, "expressions in having should also exist in outStatistics", { having: e }); + return !0; +} +function cG(t, e) { + return t ? Y$e.get(t, e) : null; +} +function PD(t, e, i, r = !0) { + const n = []; + for (const s of e) + if (s !== "*" && !t.has(s)) + if (r) { + const o = wIt(s); + try { + const a = cG(o, t); + if (!a) + throw new ot(yF, "invalid SQL expression", { where: o }); + if (!a.isStandardized) + throw new ot(yF, "expression is not standard", { clause: a }); + PD(t, a.fieldNames, "expression contains missing fields"); + } catch (a) { + const l = a && a.details; + if (l && (l.clause || l.where)) + throw a; + l && l.missingFields ? n.push(...l.missingFields) : n.push(s); + } + } else + n.push(s); + if (n.length) + throw new ot(yF, i, { missingFields: n }); +} +function wIt(t) { + return t.split(bIt)[0]; +} +function j5i(t) { + return t.split(bIt)[1]; +} +function G5i(t, e) { + const i = e.get(t); + return !!i && !$5i.has(i.type); +} +const xIt = { supportsStatistics: !0, supportsPercentileStatistics: !0, supportsSpatialAggregationStatistics: !1, supportedSpatialAggregationStatistics: { envelope: !1, centroid: !1, convexHull: !1 }, supportsCentroid: !0, supportsCacheHint: !1, supportsDistance: !0, supportsDistinct: !0, supportsExtent: !0, supportsGeometryProperties: !1, supportsHavingClause: !0, supportsOrderBy: !0, supportsPagination: !0, supportsQuantization: !0, supportsQuantizationEditMode: !1, supportsQueryGeometry: !0, supportsResultType: !1, supportsSqlExpression: !0, supportsMaxRecordCountFactor: !1, supportsStandardizedQueriesOnly: !0, supportsTopFeaturesQuery: !1, supportsQueryByOthers: !0, supportsHistoricMoment: !1, supportsFormatPBF: !1, supportsDisjointSpatialRelationship: !0, supportsDefaultSpatialReference: !1, supportsFullTextSearch: !1, supportsCompactGeometry: !1, maxRecordCountFactor: void 0, maxRecordCount: void 0, standardMaxRecordCount: void 0, tileMaxRecordCount: void 0 }; +let _oe = class { + constructor(e, i, r) { + this._fieldDataCache = /* @__PURE__ */ new Map(), this._returnDistinctMap = /* @__PURE__ */ new Map(), this.returnDistinctValues = e.returnDistinctValues ?? !1, this.fieldsIndex = r, this.featureAdapter = i; + const n = e.outFields; + if (n && !n.includes("*")) { + this.outFields = n; + let s = 0; + for (const o of n) { + const a = wIt(o), l = this.fieldsIndex.get(a), c = l ? null : cG(a, r), h = l ? l.name : j5i(o) || "FIELD_EXP_" + s++; + this._fieldDataCache.set(o, { alias: h, clause: c }); + } + } + } + countDistinctValues(e) { + return this.returnDistinctValues ? (e.forEach((i) => this.getAttributes(i)), this._returnDistinctMap.size) : e.length; + } + getAttributes(e) { + const i = this._processAttributesForOutFields(e); + return this._processAttributesForDistinctValues(i); + } + getFieldValue(e, i, r) { + const n = r ? r.name : i; + let s = null; + return this._fieldDataCache.has(n) ? s = this._fieldDataCache.get(n)?.clause : r || (s = cG(i, this.fieldsIndex), this._fieldDataCache.set(n, { alias: n, clause: s })), r ? this.featureAdapter.getAttribute(e, n) : s?.calculateValue(e, this.featureAdapter); + } + getDataValue(e, i) { + const r = i.normalizationType, n = i.normalizationTotal; + let s = i.field && this.getFieldValue(e, i.field, this.fieldsIndex.get(i.field)); + if (i.field2 && (s = `${gS(s)}${i.fieldDelimiter}${gS(this.getFieldValue(e, i.field2, this.fieldsIndex.get(i.field2)))}`, i.field3 && (s = `${s}${i.fieldDelimiter}${gS(this.getFieldValue(e, i.field3, this.fieldsIndex.get(i.field3)))}`)), r && Number.isFinite(s)) { + const o = r === "field" && i.normalizationField ? this.getFieldValue(e, i.normalizationField, this.fieldsIndex.get(i.normalizationField)) : null; + s = SEt(s, r, o, n); + } + return s; + } + getExpressionValue(e, i, r, n) { + const s = { attributes: this.featureAdapter.getAttributes(e), layer: { fields: this.fieldsIndex.fields } }, o = n.createExecContext(s, r); + return n.executeFunction(i, o); + } + getExpressionValues(e, i, r, n) { + const s = { fields: this.fieldsIndex.fields }; + return e.map((o) => { + const a = { attributes: this.featureAdapter.getAttributes(o), layer: s }, l = n.createExecContext(a, r); + return n.executeFunction(i, l); + }); + } + validateItem(e, i) { + return this._fieldDataCache.has(i) || this._fieldDataCache.set(i, { alias: i, clause: cG(i, this.fieldsIndex) }), this._fieldDataCache.get(i)?.clause?.testFeature(e, this.featureAdapter) ?? !1; + } + validateItems(e, i) { + return this._fieldDataCache.has(i) || this._fieldDataCache.set(i, { alias: i, clause: cG(i, this.fieldsIndex) }), this._fieldDataCache.get(i)?.clause?.testSet(e, this.featureAdapter) ?? !1; + } + _processAttributesForOutFields(e) { + const i = this.outFields; + if (!i || !i.length) + return this.featureAdapter.getAttributes(e); + const r = {}; + for (const n of i) { + const { alias: s, clause: o } = this._fieldDataCache.get(n); + r[s] = o ? o.calculateValue(e, this.featureAdapter) : this.featureAdapter.getAttribute(e, s); + } + return r; + } + _processAttributesForDistinctValues(e) { + if (ut(e) || !this.returnDistinctValues) + return e; + const i = this.outFields, r = []; + if (i) + for (const o of i) { + const { alias: a } = this._fieldDataCache.get(o); + r.push(e[a]); + } + else + for (const o in e) + r.push(e[o]); + const n = `${(i || ["*"]).join(",")}=${r.join(",")}`; + let s = this._returnDistinctMap.get(n) || 0; + return this._returnDistinctMap.set(n, ++s), s > 1 ? null : e; + } +}; +function U5i(t, e, i) { + return { objectId: t, target: e, distance: i, type: "vertex" }; +} +function z5i(t, e, i, r, n, s = !1) { + return { objectId: t, target: e, distance: i, type: "edge", start: r, end: n, draped: s }; +} +let r_ = class { + constructor(e, i, r) { + this.items = e, this.query = i, this.geometryType = r.geometryType, this.hasM = r.hasM, this.hasZ = r.hasZ, this.fieldsIndex = r.fieldsIndex, this.objectIdField = r.objectIdField, this.spatialReference = r.spatialReference, this.featureAdapter = r.featureAdapter; + } + get size() { + return this.items.length; + } + createQueryResponseForCount() { + const e = new _oe(this.query, this.featureAdapter, this.fieldsIndex); + if (!this.query.outStatistics) + return e.countDistinctValues(this.items); + const { groupByFieldsForStatistics: i, having: r, outStatistics: n } = this.query; + if (!i?.length) + return 1; + const o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(); + for (const c of n) { + const { statisticType: h } = c, p = h !== "exceedslimit" ? c.onStatisticField : void 0; + if (!a.has(p)) { + const v = []; + for (const x of i) { + const I = this._getAttributeValues(e, x, o); + v.push(I); + } + a.set(p, this._calculateUniqueValues(v, e.returnDistinctValues)); + } + const y = a.get(p); + for (const v in y) { + const { data: x, items: I } = y[v], P = x.join(","); + r && !e.validateItems(I, r) || l.add(P); + } + } + return l.size; + } + async createQueryResponse() { + let e; + if (this.query.outStatistics ? e = this.query.outStatistics.some((i) => i.statisticType === "exceedslimit") ? this._createExceedsLimitQueryResponse(this.query) : await this._createStatisticsQueryResponse(this.query) : e = this._createFeatureQueryResponse(this.query), this.query.returnQueryGeometry) { + const i = this.query.geometry; + Mh(this.query.outSR) && !Ea(i.spatialReference, this.query.outSR) ? e.queryGeometry = c7({ spatialReference: this.query.outSR, ...Cp(i, i.spatialReference, this.query.outSR) }) : e.queryGeometry = c7({ spatialReference: this.query.outSR, ...i }); + } + return e; + } + createSnappingResponse(e, i) { + const r = this.featureAdapter, n = lJe(this.hasZ, this.hasM), { point: s, mode: o } = e, a = typeof e.distance == "number" ? e.distance : e.distance.x, l = typeof e.distance == "number" ? e.distance : e.distance.y, c = { candidates: [] }, h = this.geometryType === "esriGeometryPolygon", p = this._getPointCreator(o, this.spatialReference, i), y = new uJe(null, 0), v = new uJe(null, 0), x = { x: 0, y: 0, z: 0 }; + for (const I of this.items) { + const P = r.getGeometry(I); + if (ut(P)) + continue; + const { coords: F, lengths: k } = P; + if (y.coords = F, v.coords = F, e.types & $$.EDGE) { + let V = 0; + for (let j = 0; j < k.length; j++) { + const Y = k[j]; + for (let X = 0; X < Y; X++, V += n) { + const Q = y; + if (Q.coordsIndex = V, X !== Y - 1) { + const re = v; + re.coordsIndex = V + n; + const he = x; + H5i(x, s, Q, re); + const fe = (s.x - he.x) / a, be = (s.y - he.y) / l, Se = fe * fe + be * be; + Se <= 1 && c.candidates.push(z5i(r.getObjectId(I), p(he), Math.sqrt(Se), p(Q), p(re))); + } + } + } + } + if (e.types & $$.VERTEX) { + const V = h ? F.length - n : F.length; + for (let j = 0; j < V; j += n) { + const Y = y; + Y.coordsIndex = j; + const X = (s.x - Y.x) / a, Q = (s.y - Y.y) / l, re = X * X + Q * Q; + re <= 1 && c.candidates.push(U5i(r.getObjectId(I), p(Y), Math.sqrt(re))); + } + } + } + return c.candidates.sort((I, P) => I.distance - P.distance), c; + } + _getPointCreator(e, i, r) { + const n = _e(r) && !Ea(i, r) ? (a) => Cp(a, i, r) : (a) => a, { hasZ: s } = this, o = 0; + return e === "3d" ? s ? ({ x: a, y: l, z: c }) => n({ x: a, y: l, z: c }) : ({ x: a, y: l }) => n({ x: a, y: l, z: o }) : ({ x: a, y: l }) => n({ x: a, y: l }); + } + async createSummaryStatisticsResponse(e) { + const { field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, minValue: a, maxValue: l, scale: c } = e, h = this.fieldsIndex.isDateField(i), p = await this._getDataValues({ field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, scale: c }), y = U$e({ normalizationType: s, normalizationField: n, minValue: a, maxValue: l }), v = this.fieldsIndex.get(i), x = { value: 0.5, fieldType: v?.type }, I = jCe(v) ? e3e({ values: p, supportsNullCount: y, percentileParams: x }) : Zpe({ values: p, minValue: a, maxValue: l, useSampleStdDev: !s, supportsNullCount: y, percentileParams: x }); + return bEt(I, h); + } + async createUniqueValuesResponse(e) { + const { field: i, valueExpression: r, domains: n, returnAllCodedValues: s, scale: o } = e, a = await this._getDataValues({ field: i, field2: e.field2, field3: e.field3, fieldDelimiter: e.fieldDelimiter, valueExpression: r, scale: o }), l = wEt(a); + return xEt(l, n, s, e.fieldDelimiter); + } + async createClassBreaksResponse(e) { + const { field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: l, minValue: c, maxValue: h, numClasses: p, scale: y } = e, v = await this._getDataValues({ field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, scale: y }), x = H$e(v, { field: i, normalizationField: n, normalizationType: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: l, minValue: c, maxValue: h, numClasses: p }); + return CEt(x, a); + } + async createHistogramResponse(e) { + const { field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: l, minValue: c, maxValue: h, numBins: p, scale: y } = e, v = await this._getDataValues({ field: i, valueExpression: r, normalizationField: n, normalizationType: s, normalizationTotal: o, scale: y }); + return TEt(v, { field: i, normalizationField: n, normalizationType: s, normalizationTotal: o, classificationMethod: a, standardDeviationInterval: l, minValue: c, maxValue: h, numBins: p }); + } + _sortFeatures(e, i, r) { + if (e.length > 1 && i && i.length) + for (const n of i.reverse()) { + const s = n.split(" "), o = s[0], a = this.fieldsIndex.get(o), l = !!s[1] && s[1].toLowerCase() === "desc", c = _Et(a?.type, l); + e.sort((h, p) => { + const y = r(h, o, a), v = r(p, o, a); + return c(y, v); + }); + } + } + _createFeatureQueryResponse(e) { + const i = this.items, { geometryType: r, hasM: n, hasZ: s, objectIdField: o, spatialReference: a } = this, { outFields: l, outSR: c, quantizationParameters: h, resultRecordCount: p, resultOffset: y, returnZ: v, returnM: x } = e, I = p != null && i.length > (y || 0) + p, P = l && (l.includes("*") ? [...this.fieldsIndex.fields] : l.map((F) => this.fieldsIndex.get(F))); + return { exceededTransferLimit: I, features: this._createFeatures(e, i), fields: P, geometryType: r, hasM: n && x, hasZ: s && v, objectIdFieldName: o, spatialReference: c7(c || a), transform: h && Jpe(h) || null }; + } + _createFeatures(e, i) { + const r = new _oe(e, this.featureAdapter, this.fieldsIndex), { hasM: n, hasZ: s } = this, { orderByFields: o, quantizationParameters: a, returnGeometry: l, returnCentroid: c, maxAllowableOffset: h, resultOffset: p, resultRecordCount: y, returnZ: v = !1, returnM: x = !1 } = e, I = s && v, P = n && x; + let F = [], k = 0; + const V = [...i]; + if (this._sortFeatures(V, o, (Y, X, Q) => r.getFieldValue(Y, X, Q)), l || c) { + const Y = Jpe(a) ?? void 0; + if (l && !c) + for (const X of V) + F[k++] = { attributes: r.getAttributes(X), geometry: HD(this.geometryType, this.hasZ, this.hasM, this.featureAdapter.getGeometry(X), h, Y, I, P) }; + else if (!l && c) + for (const X of V) + F[k++] = { attributes: r.getAttributes(X), centroid: oJe(this, this.featureAdapter.getCentroid(X, this), Y) }; + else + for (const X of V) + F[k++] = { attributes: r.getAttributes(X), centroid: oJe(this, this.featureAdapter.getCentroid(X, this), Y), geometry: HD(this.geometryType, this.hasZ, this.hasM, this.featureAdapter.getGeometry(X), h, Y, I, P) }; + } else + for (const Y of V) { + const X = r.getAttributes(Y); + X && (F[k++] = { attributes: X }); + } + const j = p || 0; + if (y != null) { + const Y = j + y; + F = F.slice(j, Math.min(F.length, Y)); + } + return F; + } + _createExceedsLimitQueryResponse(e) { + let i = !1, r = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY, s = Number.POSITIVE_INFINITY; + for (const o of e.outStatistics ?? []) + if (o.statisticType === "exceedslimit") { + r = o.maxPointCount != null ? o.maxPointCount : Number.POSITIVE_INFINITY, n = o.maxRecordCount != null ? o.maxRecordCount : Number.POSITIVE_INFINITY, s = o.maxVertexCount != null ? o.maxVertexCount : Number.POSITIVE_INFINITY; + break; + } + if (this.geometryType === "esriGeometryPoint") + i = this.items.length > r; + else if (this.items.length > n) + i = !0; + else { + const o = lJe(this.hasZ, this.hasM), a = this.featureAdapter; + i = this.items.reduce((l, c) => { + const h = a.getGeometry(c); + return l + (_e(h) && h.coords.length || 0); + }, 0) / o > s; + } + return { fields: [{ name: "exceedslimit", type: "esriFieldTypeInteger", alias: "exceedslimit", sqlType: "sqlTypeInteger", domain: null, defaultValue: null }], features: [{ attributes: { exceedslimit: Number(i) } }] }; + } + async _createStatisticsQueryResponse(e) { + const i = { attributes: {} }, r = [], n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = new _oe(e, this.featureAdapter, this.fieldsIndex), c = e.outStatistics, { groupByFieldsForStatistics: h, having: p, orderByFields: y } = e, v = h && h.length, x = !!v, I = x ? h[0] : null, P = x && !this.fieldsIndex.get(I); + for (const k of c ?? []) { + const { outStatisticFieldName: V, statisticType: j } = k, Y = k, X = j !== "exceedslimit" ? k.onStatisticField : void 0, Q = j === "percentile_disc" || j === "percentile_cont", re = j === "EnvelopeAggregate" || j === "CentroidAggregate" || j === "ConvexHullAggregate", he = x && v === 1 && (X === I || P) && j === "count"; + if (x) { + if (!o.has(X)) { + const be = []; + for (const Se of h) { + const Me = this._getAttributeValues(l, Se, n); + be.push(Me); + } + o.set(X, this._calculateUniqueValues(be, !re && l.returnDistinctValues)); + } + const fe = o.get(X); + for (const be in fe) { + const { count: Se, data: Me, items: ke, itemPositions: J } = fe[be], ce = Me.join(","); + if (!p || l.validateItems(ke, p)) { + const xe = a.get(ce) || { attributes: {} }; + if (re) { + xe.aggregateGeometries || (xe.aggregateGeometries = {}); + const { aggregateGeometries: Oe, outStatisticFieldName: Re } = await this._getAggregateGeometry(Y, ke); + xe.aggregateGeometries[Re] = Oe; + } else { + let Oe = null; + if (he) + Oe = Se; + else { + const Re = this._getAttributeValues(l, X, n), Ge = J.map((je) => Re[je]); + Oe = Q && "statisticParameters" in Y ? this._getPercentileValue(Y, Ge) : this._getStatisticValue(Y, Ge, null, l.returnDistinctValues); + } + xe.attributes[V] = Oe; + } + let Pe = 0; + h.forEach((Oe, Re) => xe.attributes[this.fieldsIndex.get(Oe) ? Oe : "EXPR_" + ++Pe] = Me[Re]), a.set(ce, xe); + } + } + } else if (re) { + i.aggregateGeometries || (i.aggregateGeometries = {}); + const { aggregateGeometries: fe, outStatisticFieldName: be } = await this._getAggregateGeometry(Y, this.items); + i.aggregateGeometries[be] = fe; + } else { + const fe = this._getAttributeValues(l, X, n); + i.attributes[V] = Q && "statisticParameters" in Y ? this._getPercentileValue(Y, fe) : this._getStatisticValue(Y, fe, s, l.returnDistinctValues); + } + r.push({ name: V, alias: V, type: "esriFieldTypeDouble" }); + } + const F = x ? Array.from(a.values()) : [i]; + return this._sortFeatures(F, y, (k, V) => k.attributes[V]), { fields: r, features: F }; + } + async _getAggregateGeometry(e, i) { + const r = await Promise.resolve().then(() => Zie), { statisticType: n, outStatisticFieldName: s } = e, { featureAdapter: o, spatialReference: a, geometryType: l, hasZ: c, hasM: h } = this, p = i.map((x) => HD(l, c, h, o.getGeometry(x))), y = r.convexHull(a, p, !0)[0], v = { aggregateGeometries: null, outStatisticFieldName: null }; + if (n === "EnvelopeAggregate") { + const x = y ? tLe(y) : BCe(r.union(a, p)); + v.aggregateGeometries = { ...x, spatialReference: a }, v.outStatisticFieldName = s || "extent"; + } else if (n === "CentroidAggregate") { + const x = y ? hge(y) : Gjt(BCe(r.union(a, p))); + v.aggregateGeometries = { x: x[0], y: x[1], spatialReference: a }, v.outStatisticFieldName = s || "centroid"; + } else + n === "ConvexHullAggregate" && (v.aggregateGeometries = y, v.outStatisticFieldName = s || "convexHull"); + return v; + } + _getStatisticValue(e, i, r, n) { + const { onStatisticField: s, statisticType: o } = e; + let a = null; + return a = r?.has(s) ? r.get(s) : jCe(this.fieldsIndex.get(s)) ? e3e({ values: i, returnDistinct: n }) : Zpe({ values: n ? [...new Set(i)] : i, minValue: null, maxValue: null, useSampleStdDev: !0 }), r && r.set(s, a), a[o === "var" ? "variance" : o]; + } + _getPercentileValue(e, i) { + const { onStatisticField: r, statisticParameters: n, statisticType: s } = e, { value: o, orderBy: a } = n, l = this.fieldsIndex.get(r); + return z$e(i, { value: o, orderBy: a, fieldType: l?.type, isDiscrete: s === "percentile_disc" }); + } + _getAttributeValues(e, i, r) { + if (r.has(i)) + return r.get(i); + const n = this.fieldsIndex.get(i), s = this.items.map((o) => e.getFieldValue(o, i, n)); + return r.set(i, s), s; + } + _getAttributeDataValues(e, i) { + return this.items.map((r) => e.getDataValue(r, { field: i.field, field2: i.field2, field3: i.field3, fieldDelimiter: i.fieldDelimiter, normalizationField: i.normalizationField, normalizationType: i.normalizationType, normalizationTotal: i.normalizationTotal })); + } + async _getAttributeExpressionValues(e, i, r) { + const { arcadeUtils: n } = await p1(), s = n.createFunction(i), o = r && n.getViewInfo(r); + return e.getExpressionValues(this.items, s, o, n); + } + _calculateUniqueValues(e, i) { + const r = {}, n = this.items, s = n.length; + for (let o = 0; o < s; o++) { + const a = n[o], l = []; + for (const h of e) + l.push(h[o]); + const c = l.join(","); + r[c] == null ? r[c] = { count: 1, data: l, items: [a], itemPositions: [o] } : (i || r[c].count++, r[c].items.push(a), r[c].itemPositions.push(o)); + } + return r; + } + async _getDataValues(e) { + const i = new _oe(this.query, this.featureAdapter, this.fieldsIndex), { valueExpression: r, field: n, normalizationField: s, normalizationType: o, normalizationTotal: a, scale: l } = e, c = r ? { viewingMode: "map", scale: l, spatialReference: this.query.outSR || this.spatialReference } : null; + return r ? this._getAttributeExpressionValues(i, r, c) : this._getAttributeDataValues(i, { field: n, field2: e.field2, field3: e.field3, fieldDelimiter: e.fieldDelimiter, normalizationField: s, normalizationType: o, normalizationTotal: a }); + } +}; +function H5i(t, e, i, r) { + const n = r.x - i.x, s = r.y - i.y, o = n * n + s * s, a = (e.x - i.x) * n + (e.y - i.y) * s, l = Math.min(1, Math.max(0, a / o)); + t.x = i.x + n * l, t.y = i.y + s * l; +} +function lJe(t, e) { + return t ? e ? 4 : 3 : e ? 3 : 2; +} +var $$; +(function(t) { + t[t.NONE = 0] = "NONE", t[t.EDGE = 1] = "EDGE", t[t.VERTEX = 2] = "VERTEX"; +})($$ || ($$ = {})); +let uJe = class { + constructor(e, i) { + this.coords = e, this.coordsIndex = i; + } + get x() { + return this.coords[this.coordsIndex]; + } + get y() { + return this.coords[this.coordsIndex + 1]; + } + get z() { + return this.coords[this.coordsIndex + 2]; + } +}; +function W5i(t) { + return t === "mesh" ? Vct : Uct(t); +} +function SIt(t, e) { + return t ? e ? 4 : 3 : e ? 3 : 2; +} +function q5i(t, e, i, r) { + return CIt(t, e, i, r.coords[0], r.coords[1]); +} +function Y5i(t, e, i, r, n, s) { + const o = SIt(n, s), { coords: a, lengths: l } = r; + if (!l) + return !1; + for (let c = 0, h = 0; c < l.length; c++, h += o) + if (!CIt(t, e, i, a[h], a[h + 1])) + return !1; + return !0; +} +function CIt(t, e, i, r, n) { + if (!t) + return !1; + const s = SIt(e, i), { coords: o, lengths: a } = t; + let l = !1, c = 0; + for (const h of a) + l = X5i(l, o, s, c, h, r, n), c += h * s; + return l; +} +function X5i(t, e, i, r, n, s, o) { + let a = t, l = r; + for (let c = r, h = r + n * i; c < h; c += i) { + l = c + i, l === h && (l = r); + const p = e[c], y = e[c + 1], v = e[l], x = e[l + 1]; + (y < o && x >= o || x < o && y >= o) && p + (o - y) / (x - y) * (v - p) < s && (a = !a); + } + return a; +} +const Qwe = "feature-store:unsupported-query", K5i = { esriSpatialRelIntersects: "intersects", esriSpatialRelContains: "contains", esriSpatialRelCrosses: "crosses", esriSpatialRelDisjoint: "disjoint", esriSpatialRelEnvelopeIntersects: "intersects", esriSpatialRelIndexIntersects: null, esriSpatialRelOverlaps: "overlaps", esriSpatialRelTouches: "touches", esriSpatialRelWithin: "within", esriSpatialRelRelation: null }, X$e = { spatialRelationship: { esriSpatialRelIntersects: !0, esriSpatialRelContains: !0, esriSpatialRelWithin: !0, esriSpatialRelCrosses: !0, esriSpatialRelDisjoint: !0, esriSpatialRelTouches: !0, esriSpatialRelOverlaps: !0, esriSpatialRelEnvelopeIntersects: !0, esriSpatialRelIndexIntersects: !1, esriSpatialRelRelation: !1 }, queryGeometry: { esriGeometryPoint: !0, esriGeometryMultipoint: !0, esriGeometryPolyline: !0, esriGeometryPolygon: !0, esriGeometryEnvelope: !0 }, layerGeometry: { esriGeometryPoint: !0, esriGeometryMultipoint: !0, esriGeometryPolyline: !0, esriGeometryPolygon: !0, esriGeometryEnvelope: !1 } }; +function J5i(t) { + return t != null && X$e.spatialRelationship[t] === !0; +} +function Z5i(t) { + return t != null && X$e.queryGeometry[Fd(t)] === !0; +} +function Q5i(t) { + return t != null && X$e.layerGeometry[t] === !0; +} +function eNi() { + return Promise.resolve().then(() => Zie); +} +function pX(t, e, i, r, n) { + if (za(e) && i === "esriGeometryPoint" && (t === "esriSpatialRelIntersects" || t === "esriSpatialRelContains")) { + const s = VF(new Rl(), e, !1, !1); + return Promise.resolve((o) => q5i(s, !1, !1, o)); + } + if (za(e) && i === "esriGeometryMultipoint") { + const s = VF(new Rl(), e, !1, !1); + if (t === "esriSpatialRelContains") + return Promise.resolve((o) => Y5i(s, !1, !1, o, r, n)); + } + if (gc(e) && i === "esriGeometryPoint" && (t === "esriSpatialRelIntersects" || t === "esriSpatialRelContains")) + return Promise.resolve((s) => Lte(e, HD(i, r, n, s))); + if (gc(e) && i === "esriGeometryMultipoint" && t === "esriSpatialRelContains") + return Promise.resolve((s) => WBt(e, HD(i, r, n, s))); + if (gc(e) && t === "esriSpatialRelIntersects") { + const s = W5i(i); + return Promise.resolve((o) => s(e, HD(i, r, n, o))); + } + return eNi().then((s) => { + const o = s[K5i[t]].bind(null, e.spatialReference, e); + return (a) => o(HD(i, r, n, a)); + }); +} +async function cJe(t, e, i) { + const { spatialRel: r, geometry: n } = t; + if (n) { + if (!J5i(r)) + throw new ot(Qwe, "Unsupported query spatial relationship", { query: t }); + if (Mh(n.spatialReference) && Mh(i)) { + if (!Z5i(n)) + throw new ot(Qwe, "Unsupported query geometry type", { query: t }); + if (!Q5i(e)) + throw new ot(Qwe, "Unsupported layer geometry type", { query: t }); + if (t.outSR) + return Py(t.geometry && t.geometry.spatialReference, t.outSR); + } + } +} +function hJe(t) { + if (gc(t)) + return !0; + if (za(t)) { + for (const e of t.rings) + if (e.length !== 5 || e[0][0] !== e[1][0] || e[0][0] !== e[4][0] || e[2][0] !== e[3][0] || e[0][1] !== e[3][1] || e[0][1] !== e[4][1] || e[1][1] !== e[2][1]) + return !1; + return !0; + } + return !1; +} +async function tNi(t, e) { + if (!t) + return null; + const i = e.featureAdapter, { startTimeField: r, endTimeField: n } = t; + let s = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY; + if (r && n) + await e.forEach((a) => { + const l = i.getAttribute(a, r), c = i.getAttribute(a, n); + l == null || isNaN(l) || (s = Math.min(s, l)), c == null || isNaN(c) || (o = Math.max(o, c)); + }); + else { + const a = r || n; + await e.forEach((l) => { + const c = i.getAttribute(l, a); + c == null || isNaN(c) || (s = Math.min(s, c), o = Math.max(o, c)); + }); + } + return { start: s, end: o }; +} +function TIt(t, e, i) { + if (!e || !t) + return null; + const { startTimeField: r, endTimeField: n } = t; + if (!r && !n) + return null; + const { start: s, end: o } = e; + return s === null && o === null ? null : s === void 0 && o === void 0 ? nNi() : r && n ? iNi(i, r, n, s, o) : rNi(i, r || n, s, o); +} +function iNi(t, e, i, r, n) { + return r != null && n != null ? (s) => { + const o = t.getAttribute(s, e), a = t.getAttribute(s, i); + return (o == null || o <= n) && (a == null || a >= r); + } : r != null ? (s) => { + const o = t.getAttribute(s, i); + return o == null || o >= r; + } : n != null ? (s) => { + const o = t.getAttribute(s, e); + return o == null || o <= n; + } : void 0; +} +function rNi(t, e, i, r) { + return i != null && r != null && i === r ? (n) => t.getAttribute(n, e) === i : i != null && r != null ? (n) => { + const s = t.getAttribute(n, e); + return s >= i && s <= r; + } : i != null ? (n) => t.getAttribute(n, e) >= i : r != null ? (n) => t.getAttribute(n, e) <= r : void 0; +} +function nNi() { + return () => !1; +} +function sNi(t) { + return t != null && t.every((e) => e.statisticType !== "exceedslimit"); +} +const jR = "feature-store:unsupported-query", oNi = new wLe(2e6); +let aNi = 0, B$ = class { + constructor(e) { + this._geometryQueryCache = null, this._changeHandle = null, this.capabilities = { query: xIt }, this.geometryType = e.geometryType, this.hasM = !!e.hasM, this.hasZ = !!e.hasZ, this.objectIdField = e.objectIdField, this.spatialReference = e.spatialReference, this.definitionExpression = e.definitionExpression, this.featureStore = e.featureStore, this.aggregateAdapter = e.aggregateAdapter, this._changeHandle = this.featureStore.events.on("changed", () => this.clearCache()), this.timeInfo = e.timeInfo, e.cacheSpatialQueries && (this._geometryQueryCache = new NUt(aNi++ + "$$", oNi)), this.fieldsIndex = new sg(e.fields), e.scheduler && e.priority && (this._frameTask = e.scheduler.registerTask(e.priority)); + } + destroy() { + this._frameTask = eh(this._frameTask), this.clearCache(), la(this._geometryQueryCache), this._changeHandle = eh(this._changeHandle), la(this.fieldsIndex); + } + get featureAdapter() { + return this.featureStore.featureAdapter; + } + clearCache() { + this._geometryQueryCache?.clear(), this._allFeaturesPromise = null, this._timeExtentPromise = null; + } + async executeQuery(e, i) { + try { + return (await this._executeQuery(e, {}, i)).createQueryResponse(); + } catch (r) { + if (r !== dD) + throw r; + return new r_([], e, this).createQueryResponse(); + } + } + async executeQueryForCount(e = {}, i) { + try { + return (await this._executeQuery(e, { returnGeometry: !1, returnCentroid: !1, outSR: null }, i)).createQueryResponseForCount(); + } catch (r) { + if (r !== dD) + throw r; + return 0; + } + } + async executeQueryForExtent(e, i) { + const r = e.outSR; + try { + const n = await this._executeQuery(e, { returnGeometry: !0, returnCentroid: !1, outSR: null }, i), s = n.size; + return s ? { count: s, extent: await this._getBounds(n.items, n.spatialReference, r || this.spatialReference) } : { count: 0, extent: null }; + } catch (n) { + if (n === dD) + return { count: 0, extent: null }; + throw n; + } + } + async executeQueryForIds(e, i) { + return this.executeQueryForIdSet(e, i).then((r) => Array.from(r)); + } + async executeQueryForIdSet(e, i) { + try { + const r = await this._executeQuery(e, { returnGeometry: !0, returnCentroid: !1, outSR: null }, i), n = r.items, s = /* @__PURE__ */ new Set(); + return await this._reschedule(() => { + for (const o of n) + s.add(r.featureAdapter.getObjectId(o)); + }, i), s; + } catch (r) { + if (r === dD) + return /* @__PURE__ */ new Set(); + throw r; + } + } + async executeQueryForSnapping(e, i) { + const { point: r, distance: n, types: s } = e; + if (s === $$.NONE) + return { candidates: [] }; + const o = await this._reschedule(() => this._checkQuerySupport(e.query), i), a = !Ea(r.spatialReference, this.spatialReference); + a && await Py(r.spatialReference, this.spatialReference); + const l = typeof n == "number" ? n : n.x, c = typeof n == "number" ? n : n.y, h = { xmin: r.x - l, xmax: r.x + l, ymin: r.y - c, ymax: r.y + c, spatialReference: r.spatialReference }, p = a ? Cp(h, this.spatialReference) : h; + if (!p) + return { candidates: [] }; + const y = (await Nv(Sl(r), null, { signal: i }))[0], v = (await Nv(Sl(p), null, { signal: i }))[0]; + if (ut(y) || ut(v)) + return { candidates: [] }; + const x = new r_(await this._reschedule(() => this._searchFeatures(this._getQueryBBoxes(v.toJSON())), i), o, this); + await this._reschedule(() => this._executeObjectIdsQuery(x), i), await this._reschedule(() => this._executeTimeQuery(x), i), await this._reschedule(() => this._executeAttributesQuery(x), i); + const I = y.toJSON(), P = a ? Cp(I, this.spatialReference) : I, F = a ? Math.max(p.xmax - p.xmin, p.ymax - p.ymin) / 2 : n; + return x.createSnappingResponse({ ...e, point: P, distance: F }, r.spatialReference); + } + async executeQueryForLatestObservations(e, i) { + if (!this.timeInfo || !this.timeInfo.trackIdField) + throw new ot(jR, "Missing timeInfo or timeInfo.trackIdField", { query: e, timeInfo: this.timeInfo }); + try { + const r = await this._executeQuery(e, {}, i); + return await this._reschedule(() => this._filterLatest(r), i), r.createQueryResponse(); + } catch (r) { + if (r !== dD) + throw r; + return new r_([], e, this).createQueryResponse(); + } + } + async executeQueryForSummaryStatistics(e = {}, i, r) { + const { field: n, normalizationField: s, valueExpression: o } = i; + return (await this._getQueryEngineResultForStats(e, { field: n, normalizationField: s, valueExpression: o }, r)).createSummaryStatisticsResponse(i); + } + async executeQueryForUniqueValues(e = {}, i, r) { + const { field: n, field2: s, field3: o, valueExpression: a } = i; + return (await this._getQueryEngineResultForStats(e, { field: n, field2: s, field3: o, valueExpression: a }, r)).createUniqueValuesResponse(i); + } + async executeQueryForClassBreaks(e = {}, i, r) { + const { field: n, normalizationField: s, valueExpression: o } = i; + return (await this._getQueryEngineResultForStats(e, { field: n, normalizationField: s, valueExpression: o }, r)).createClassBreaksResponse(i); + } + async executeQueryForHistogram(e = {}, i, r) { + const { field: n, normalizationField: s, valueExpression: o } = i; + return (await this._getQueryEngineResultForStats(e, { field: n, normalizationField: s, valueExpression: o }, r)).createHistogramResponse(i); + } + async fetchRecomputedExtents(e) { + const [i, r] = await Promise.all(["getFullExtent" in this.featureStore && this.featureStore.getFullExtent ? Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)) : this._getBounds(await this._getAllFeatures(), this.spatialReference, this.spatialReference), _e(this._timeExtentPromise) ? this._timeExtentPromise : this._timeExtentPromise = tNi(this.timeInfo, this.featureStore)]); + return hn(e), { fullExtent: i, timeExtent: r }; + } + async _getBounds(e, i, r) { + const n = _dt(Sx(), VG); + await this.featureStore.forEachBounds(e, (a) => cY(n, a)); + const s = { xmin: n[0], ymin: n[1], xmax: n[3], ymax: n[4], spatialReference: c7(this.spatialReference) }; + this.hasZ && isFinite(n[2]) && isFinite(n[5]) && (s.zmin = n[2], s.zmax = n[5]); + const o = Cp(s, i, r); + if (o.spatialReference = c7(r), o.xmax - o.xmin == 0) { + const a = th(o.spatialReference); + o.xmin -= a, o.xmax += a; + } + if (o.ymax - o.ymin == 0) { + const a = th(o.spatialReference); + o.ymin -= a, o.ymax += a; + } + if (this.hasZ && o.zmin != null && o.zmax != null && o.zmax - o.zmin == 0) { + const a = th(o.spatialReference); + o.zmin -= a, o.zmax += a; + } + return o; + } + async _schedule(e, i) { + return _e(this._frameTask) ? this._frameTask.schedule(e, i) : e(Dde); + } + async _reschedule(e, i) { + return _e(this._frameTask) ? this._frameTask.reschedule(e, i) : e(Dde); + } + async _getAllFeaturesQueryEngineResult(e) { + return new r_(await this._getAllFeatures(), e, this); + } + async _getAllFeatures() { + if (ut(this._allFeaturesPromise)) { + const r = []; + this._allFeaturesPromise = (async () => { + await this.featureStore.forEach((n) => r.push(n)); + })().then(() => r); + } + const e = this._allFeaturesPromise, i = await e; + return e === this._allFeaturesPromise ? i.slice() : this._getAllFeatures(); + } + async _executeQuery(e, i, r) { + e = fi(e), e = await this._schedule(() => aJe(e, this.definitionExpression, this.spatialReference), r), e = await this._reschedule(() => this._checkQuerySupport(e), r), e = { ...e, ...i }; + const n = await this._reschedule(() => this._executeSceneFilterQuery(e, r), r), s = await this._reschedule(() => this._executeGeometryQuery(e, n, r), r); + return await this._reschedule(() => this._executeAggregateIdsQuery(s), r), await this._reschedule(() => this._executeObjectIdsQuery(s), r), await this._reschedule(() => this._executeTimeQuery(s), r), await this._reschedule(() => this._executeAttributesQuery(s), r), s; + } + async _executeSceneFilterQuery(e, i) { + if (ut(e.sceneFilter)) + return null; + const { outSR: r, returnGeometry: n, returnCentroid: s } = e, o = this.featureStore.featureSpatialReference, a = e.sceneFilter.geometry, l = ut(o) || Ea(o, a.spatialReference) ? a : Cp(a, o); + if (!l) + return null; + const c = n || s, h = Mh(r) && !Ea(this.spatialReference, r) && c ? async (I) => this._project(I, r) : (I) => I, p = this.featureAdapter, y = await this._reschedule(() => this._searchFeatures(this._getQueryBBoxes(l)), i); + if (e.sceneFilter.spatialRelationship === "disjoint") { + if (!y.length) + return null; + const I = /* @__PURE__ */ new Set(); + for (const k of y) + I.add(p.getObjectId(k)); + const P = await this._reschedule(() => this._getAllFeatures(), i), F = await this._reschedule(async () => { + const k = await pX("esriSpatialRelDisjoint", l, this.geometryType, this.hasZ, this.hasM), V = (Y) => !I.has(p.getObjectId(Y)) || k(p.getGeometry(Y)), j = await this._runSpatialFilter(P, V, i); + return new r_(j, e, this); + }, i); + return h(F); + } + if (!y.length) + return new r_([], e, this); + if (this._canExecuteSinglePass(l, e)) + return h(new r_(y, e, this)); + const v = await pX("esriSpatialRelContains", l, this.geometryType, this.hasZ, this.hasM), x = await this._runSpatialFilter(y, (I) => v(p.getGeometry(I)), i); + return h(new r_(x, e, this)); + } + async _executeGeometryQuery(e, i, r) { + if (_e(i) && i.items.length === 0) + return i; + e = _e(i) ? i.query : e; + const { geometry: n, outSR: s, spatialRel: o, returnGeometry: a, returnCentroid: l } = e, c = this.featureStore.featureSpatialReference, h = !n || ut(c) || Ea(c, n.spatialReference) ? n : Cp(n, c), p = a || l, y = Mh(s) && !Ea(this.spatialReference, s), v = this._geometryQueryCache && ut(i) ? JSON.stringify(y && p ? { originalFilterGeometry: n, spatialRelationship: o, outSpatialReference: s } : { originalFilterGeometry: n, spatialRelationship: o }) : null, x = v ? this._geometryQueryCache.get(v) : null; + if (_e(x)) + return new r_(x, e, this); + const I = async (j) => (y && p && await this._project(j, s), v && this._geometryQueryCache.put(v, j.items, j.items.length + 1), j); + if (!h) + return I(_e(i) ? i : await this._getAllFeaturesQueryEngineResult(e)); + const P = this.featureAdapter; + let F = await this._reschedule(() => this._searchFeatures(this._getQueryBBoxes(n)), r); + if (o === "esriSpatialRelDisjoint") { + if (!F.length) + return I(_e(i) ? i : await this._getAllFeaturesQueryEngineResult(e)); + const j = /* @__PURE__ */ new Set(); + for (const Q of F) + j.add(P.getObjectId(Q)); + const Y = _e(i) ? i.items : await this._reschedule(() => this._getAllFeatures(), r), X = await this._reschedule(async () => { + const Q = await pX(o, h, this.geometryType, this.hasZ, this.hasM), re = (fe) => !j.has(P.getObjectId(fe)) || Q(P.getGeometry(fe)), he = await this._runSpatialFilter(Y, re, r); + return new r_(he, e, this); + }, r); + return I(X); + } + if (_e(i)) { + const j = new Kme(); + F = F.filter((Y) => L7(i.items, Y, i.items.length, j) >= 0); + } + if (!F.length) { + const j = new r_([], e, this); + return v && this._geometryQueryCache.put(v, j.items, 1), j; + } + if (this._canExecuteSinglePass(h, e)) + return I(new r_(F, e, this)); + const k = await pX(o, h, this.geometryType, this.hasZ, this.hasM), V = await this._runSpatialFilter(F, (j) => k(P.getGeometry(j)), r); + return I(new r_(V, e, this)); + } + _executeAggregateIdsQuery(e) { + if (e.items.length === 0 || !e.query.aggregateIds || !e.query.aggregateIds.length || ut(this.aggregateAdapter)) + return; + const i = /* @__PURE__ */ new Set(); + for (const n of e.query.aggregateIds) + this.aggregateAdapter.getFeatureObjectIds(n).forEach((s) => i.add(s)); + const r = this.featureAdapter.getObjectId; + e.items = e.items.filter((n) => i.has(r(n))); + } + _executeObjectIdsQuery(e) { + if (e.items.length === 0 || !e.query.objectIds || !e.query.objectIds.length) + return; + const i = new Set(e.query.objectIds), r = this.featureAdapter.getObjectId; + e.items = e.items.filter((n) => i.has(r(n))); + } + _executeTimeQuery(e) { + if (e.items.length === 0) + return; + const i = TIt(this.timeInfo, e.query.timeExtent, this.featureAdapter); + ut(i) || (e.items = e.items.filter(i)); + } + _executeAttributesQuery(e) { + if (e.items.length === 0) + return; + const i = cG(e.query.where, this.fieldsIndex); + if (i) { + if (!i.isStandardized) + throw new TypeError("Where clause is not standardized"); + e.items = e.items.filter((r) => i.testFeature(r, this.featureAdapter)); + } + } + async _runSpatialFilter(e, i, r) { + if (!i) + return e; + if (ut(this._frameTask)) + return e.filter((a) => i(a)); + let n = 0; + const s = new Array(), o = async (a) => { + for (; n < e.length; ) { + const l = e[n++]; + i(l) && (s.push(l), a.madeProgress()), a.done && await this._reschedule((c) => o(c), r); + } + }; + return this._reschedule((a) => o(a), r).then(() => s); + } + _filterLatest(e) { + const { trackIdField: i, startTimeField: r, endTimeField: n } = this.timeInfo, s = n || r, o = /* @__PURE__ */ new Map(), a = this.featureAdapter.getAttribute; + for (const l of e.items) { + const c = a(l, i), h = a(l, s), p = o.get(c); + (!p || h > a(p, s)) && o.set(c, l); + } + e.items = Array.from(o.values()); + } + _canExecuteSinglePass(e, i) { + const { spatialRel: r } = i; + return hJe(e) && (r === "esriSpatialRelEnvelopeIntersects" || this.geometryType === "esriGeometryPoint" && (r === "esriSpatialRelIntersects" || r === "esriSpatialRelContains" || r === "esriSpatialRelWithin")); + } + async _project(e, i) { + if (!i || Ea(this.spatialReference, i)) + return e; + const r = this.featureAdapter, n = await P5i(e.items.map((s) => HD(this.geometryType, this.hasZ, this.hasM, r.getGeometry(s))), this.spatialReference, i); + return e.items = n.map((s, o) => r.cloneWithGeometry(e.items[o], d8(s, this.hasZ, this.hasM))), e; + } + _getQueryBBoxes(e) { + if (hJe(e)) { + if (gc(e)) + return [Lhe(e.xmin, e.ymin, e.xmax, e.ymax)]; + if (za(e)) + return e.rings.map((i) => Lhe(Math.min(i[0][0], i[2][0]), Math.min(i[0][1], i[2][1]), Math.max(i[0][0], i[2][0]), Math.max(i[0][1], i[2][1]))); + } + return [OI(Eo(), e)]; + } + async _searchFeatures(e) { + const i = /* @__PURE__ */ new Set(); + await Promise.all(e.map((n) => this.featureStore.forEachInBounds(n, (s) => i.add(s)))); + const r = Array.from(i.values()); + return i.clear(), r; + } + async _checkStatisticsSupport(e, i) { + if ((e.distance ?? 0) < 0 || e.geometryPrecision != null || e.multipatchOption || e.pixelSize || e.relationParam || e.text || e.outStatistics || e.groupByFieldsForStatistics || e.having || e.orderByFields) + throw new ot(jR, "Unsupported query options", { query: e }); + return this._checkAttributesQuerySupport(e), Promise.all([this._checkStatisticsParamsSupport(i), cJe(e, this.geometryType, this.spatialReference), Py(this.spatialReference, e.outSR)]).then(() => e); + } + async _checkStatisticsParamsSupport(e) { + let i = []; + if (e.valueExpression) { + const { arcadeUtils: r } = await p1(); + i = r.extractFieldNames(e.valueExpression); + } + if (e.field && i.push(e.field), e.field2 && i.push(e.field2), e.field3 && i.push(e.field3), e.normalizationField && i.push(e.normalizationField), !i.length) + throw new ot(jR, "params should have at least a field or valueExpression", { params: e }); + PD(this.fieldsIndex, i, "params contains missing fields"); + } + async _checkQuerySupport(e) { + if ((e.distance ?? 0) < 0 || e.geometryPrecision != null || e.multipatchOption || e.pixelSize || e.relationParam || e.text) + throw new ot(jR, "Unsupported query options", { query: e }); + return this._checkAttributesQuerySupport(e), this._checkStatisticsQuerySupport(e), Promise.all([cJe(e, this.geometryType, this.spatialReference), Py(this.spatialReference, e.outSR)]).then(() => e); + } + _checkAttributesQuerySupport(e) { + const { outFields: i, orderByFields: r, returnDistinctValues: n, outStatistics: s } = e, o = s ? s.map((a) => a.outStatisticFieldName && a.outStatisticFieldName.toLowerCase()).filter(Boolean) : []; + if (r && r.length > 0) { + const a = " asc", l = " desc", c = r.map((h) => { + const p = h.toLowerCase(); + return p.includes(a) ? p.split(a)[0] : p.includes(l) ? p.split(l)[0] : h; + }).filter((h) => !o.includes(h)); + PD(this.fieldsIndex, c, "orderByFields contains missing fields"); + } + if (i && i.length > 0) + PD(this.fieldsIndex, i, "outFields contains missing fields"); + else if (n) + throw new ot(jR, "outFields should be specified for returnDistinctValues", { query: e }); + B5i(this.fieldsIndex, e.where); + } + _checkStatisticsQuerySupport(e) { + const { outStatistics: i, groupByFieldsForStatistics: r, having: n } = e, s = r && r.length, o = i && i.length; + if (n) { + if (!s || !o) + throw new ot(jR, "outStatistics and groupByFieldsForStatistics should be specified with having", { query: e }); + V5i(this.fieldsIndex, n, i); + } + if (o) { + if (!sNi(i)) + return; + const a = i.map((l) => l.onStatisticField).filter(Boolean); + PD(this.fieldsIndex, a, "onStatisticFields contains missing fields"), s && PD(this.fieldsIndex, r, "groupByFieldsForStatistics contains missing fields"); + for (const l of i) { + const { onStatisticField: c, statisticType: h } = l; + if ((h === "percentile_disc" || h === "percentile_cont") && "statisticParameters" in l) { + const { statisticParameters: p } = l; + if (!p) + throw new ot(jR, "statisticParamters should be set for percentile type", { definition: l, query: e }); + } else if (h !== "count" && c && G5i(c, this.fieldsIndex)) + throw new ot(jR, "outStatistics contains non-numeric fields", { definition: l, query: e }); + } + } + } + async _getQueryEngineResultForStats(e, i, r) { + e = fi(e); + try { + e = await this._schedule(() => aJe(e, this.definitionExpression, this.spatialReference), r), e = await this._reschedule(() => this._checkStatisticsSupport(e, i), r); + const n = await this._reschedule(() => this._executeSceneFilterQuery(e, r), r), s = await this._reschedule(() => this._executeGeometryQuery(e, n, r), r); + return await this._reschedule(() => this._executeAggregateIdsQuery(s), r), await this._reschedule(() => this._executeObjectIdsQuery(s), r), await this._reschedule(() => this._executeTimeQuery(s), r), await this._reschedule(() => this._executeAttributesQuery(s), r), s; + } catch (n) { + if (n !== dD) + throw n; + return new r_([], e, this); + } + } +}; +const EIt = /^\s*"([\S\s]*)"\s*$/, IIt = /""/g, AIt = ` +`, lNi = [",", " ", ";", "|", " "]; +function* PIt(t, e, i) { + let r = 0; + for (; r <= t.length; ) { + const n = t.indexOf(e, r), s = t.substring(r, n > -1 ? n : void 0); + r += s.length + e.length, i && !s.trim() || (yield s); + } +} +function OIt(t) { + const e = t.includes(`\r +`) ? `\r +` : AIt; + return PIt(t, e, !0); +} +function RIt(t, e) { + return PIt(t, e, !1); +} +function uNi(t, e, i) { + t = t.trim(), e = e?.trim(); + const r = [], n = Array.from(/* @__PURE__ */ new Set([i?.delimiter, ...lNi])).filter((o) => o != null); + for (const o of n) { + const a = r3e(t, o).length, l = r3e(e, o).length ?? a; + a > 1 && r.push({ weight: Math.min(a, l), delimiter: o }); + } + const s = r.sort(({ weight: o }, { weight: a }) => a - o).map(({ delimiter: o }) => o); + for (const o of s) { + const a = cNi(DIt(t, o).names, i?.longitudeField, i?.latitudeField); + if (a.longitudeFieldName && a.latitudeFieldName) + return { delimiter: o, locationInfo: a }; + } + return { delimiter: s[0], locationInfo: null }; +} +function* MIt(t, e, i, r = () => /* @__PURE__ */ Object.create(null)) { + const n = OIt(t); + n.next(); + let s = "", o = "", a = 0, l = r(), c = 0; + e: + for (const h of n) { + const p = RIt(h, i); + for (const y of p) + if (s += o + y, o = "", a += FIt(y), a % 2 == 0) { + if (a > 0) { + const v = EIt.exec(s); + if (!v) { + l = r(), c = 0, s = "", a = 0; + continue e; + } + l[e[c]] = v[1].replace(IIt, '"'), c++; + } else + l[e[c]] = s, c++; + s = "", a = 0; + } else + o = i; + a === 0 ? (yield l, l = r(), c = 0) : o = AIt; + } +} +function DIt(t, e) { + const i = r3e(t, e).filter((n) => n != null), r = i.map((n) => X7(n)); + for (let n = r.length - 1; n >= 0; n--) + r[n] || (r.splice(n, 1), i.splice(n, 1)); + return { names: r, aliases: i }; +} +function r3e(t, e) { + if (!t?.length) + return []; + const i = []; + let r = "", n = "", s = 0; + const o = RIt(t, e); + for (const a of o) + if (r += n + a, n = "", s += FIt(a), s % 2 == 0) { + if (s > 0) { + const l = EIt.exec(r); + l && i.push(l[1].replace(IIt, '"')); + } else + i.push(r); + r = "", s = 0; + } else + n = e; + return i; +} +function FIt(t) { + let e = 0, i = 0; + for (i = t.indexOf('"', i); i >= 0; ) + e++, i = t.indexOf('"', i + 1); + return e; +} +function cNi(t, e, i) { + e = X7(e)?.toLowerCase(), i = X7(i)?.toLowerCase(); + const r = t.map((o) => o.toLowerCase()), n = e ? t[r.indexOf(e)] : null, s = i ? t[r.indexOf(i)] : null; + return { longitudeFieldName: n || t[r.indexOf(gNi.find((o) => r.includes(o)))], latitudeFieldName: s || t[r.indexOf(mNi.find((o) => r.includes(o)))] }; +} +function hNi(t, e, i, r, n) { + const s = [], o = MIt(t, i, e), a = []; + for (const l of o) { + if (a.length === 10) + break; + a.push(l); + } + for (let l = 0; l < i.length; l++) { + const c = i[l], h = r[l]; + if (c === n.longitudeFieldName || c === n.latitudeFieldName) + s.push({ name: c, type: "esriFieldTypeDouble", alias: h }); + else { + let p, y; + switch (dNi(a.map((v) => v[c]))) { + case "integer": + p = "esriFieldTypeInteger"; + break; + case "double": + p = "esriFieldTypeDouble"; + break; + case "date": + p = "esriFieldTypeDate", y = 36; + break; + default: + p = "esriFieldTypeString", y = 255; + } + s.push({ name: c, type: p, alias: h, length: y }); + } + } + return s; +} +function dNi(t) { + if (!t.length) + return "string"; + const e = /[^+-.,0-9]/; + return t.map((i) => { + let r = !1; + if (i !== "") { + if (e.test(i)) + r = !0; + else { + let n = n3e(i); + if (!isNaN(n)) + return /[.,]/.test(i) || !Number.isInteger(n) || n > 214783647 || n < -214783648 ? "double" : "integer"; + if (i.includes("E")) { + if (n = Number(i), !isNaN(n)) + return "double"; + if (i.includes(",")) { + if (i = i.replace(",", "."), n = Number(i), !isNaN(n)) + return "double"; + r = !0; + } else + r = !0; + } else + r = !0; + } + return r ? /^[-]?\d*[.,]?\d*$/.test(i) ? "string" : LIt(new Date(i), i) ? "date" : "string" : "string"; + } + }).reduce((i, r) => i === void 0 ? r : r === void 0 ? i : i === r ? r : i === "string" || r === "string" ? "string" : i === "double" || r === "double" ? "double" : void 0); +} +function LIt(t, e) { + if (!t || Object.prototype.toString.call(t) !== "[object Date]" || isNaN(t.getTime())) + return !1; + let i = !0; + if (!fNi && /\d+\W*$/.test(e)) { + const r = e.match(/[a-zA-Z]{2,}/); + if (r) { + let n = !1, s = 0; + for (; !n && s <= r.length; ) + n = !pNi.test(r[s]), s++; + i = !n; + } + } + return i; +} +const n3e = function() { + const t = oTt(), e = new RegExp("^" + t.regexp + "$"), i = new RegExp("[" + t.group + "\\s\\xa0]", "g"), r = t.factor; + return (n) => { + const s = e.exec(n); + if (t.factor = r, !s) + return NaN; + let o = s[1]; + if (!s[1]) { + if (!s[2]) + return NaN; + o = s[2], t.factor *= -1; + } + return o = o.replace(i, "").replace(t.decimal, "."), +o * t.factor; + }; +}(), pNi = /^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i, fNi = Number.isNaN((/* @__PURE__ */ new Date("technology 10")).getTime()), mNi = ["lat", "latitude", "latitude83", "latdecdeg", "lat_dd", "y", "ycenter", "point_y"], gNi = ["lon", "lng", "long", "longitude", "longitude83", "longdecdeg", "long_dd", "x", "xcenter", "point_x"]; +function eH(t) { + return { renderer: { type: "simple", symbol: t === "esriGeometryPoint" || t === "esriGeometryMultipoint" ? Xmt : t === "esriGeometryPolyline" ? Kmt : Jmt } }; +} +const yNi = /^[_$a-zA-Z][_$a-zA-Z0-9]*$/; +let vNi = 1; +function K$e(t, e) { + if (Vi("esri-csp-restrictions")) + return () => ({ [e]: null, ...t }); + try { + let i = `this.${e} = null;`; + for (const n in t) + i += `this${yNi.test(n) ? `.${n}` : `["${n}"]`} = ${JSON.stringify(t[n])};`; + const r = new Function(` + return class AttributesClass$${vNi++} { + constructor() { + ${i}; + } + } + `)(); + return () => new r(); + } catch { + return () => ({ [e]: null, ...t }); + } +} +function NIt(t = {}) { + return [{ name: "New Feature", description: "", prototype: { attributes: fi(t) } }]; +} +function J$e(t, e) { + return { analytics: { supportsCacheHint: !1 }, attachment: null, data: { isVersioned: !1, supportsAttachment: !1, supportsM: !1, supportsZ: t }, metadata: { supportsAdvancedFieldProperties: !1 }, operations: { supportsCalculate: !1, supportsTruncate: !1, supportsValidateSql: !1, supportsAdd: e, supportsDelete: e, supportsEditing: e, supportsChangeTracking: !1, supportsQuery: !0, supportsQueryAnalytics: !1, supportsQueryAttachments: !1, supportsQueryTopFeatures: !1, supportsResizeAttachments: !1, supportsSync: !1, supportsUpdate: e, supportsExceedsLimitStatistics: !0 }, query: xIt, queryRelated: { supportsCount: !0, supportsOrderBy: !0, supportsPagination: !0, supportsCacheHint: !1 }, queryTopFeatures: { supportsCacheHint: !1 }, editing: { supportsGeometryUpdate: e, supportsGlobalId: !1, supportsReturnServiceEditsInSourceSpatialReference: !1, supportsRollbackOnFailure: !1, supportsUpdateWithoutM: !1, supportsUploadWithItemId: !1, supportsDeleteByAnonymous: !1, supportsDeleteByOthers: !1, supportsUpdateByAnonymous: !1, supportsUpdateByOthers: !1 } }; +} +const _Ni = eH("esriGeometryPoint"), bNi = ["csv"], wNi = [0, 0]; +let xNi = class { + constructor(e, i) { + this.x = e, this.y = i; + } +}, SNi = class { + constructor() { + this._queryEngine = null, this._snapshotFeatures = async (e) => { + const i = await this._fetch(e); + return this._createFeatures(i); + }; + } + destroy() { + this._queryEngine?.destroy(), this._queryEngine = null; + } + async load(e, i = {}) { + this._loadOptions = e; + const [r] = await Promise.all([this._fetch(i.signal), this._checkProjection(e?.parsingOptions?.spatialReference)]), n = CNi(r, e); + this._locationInfo = n.locationInfo, this._delimiter = n.delimiter, this._queryEngine = this._createQueryEngine(n); + const s = await this._createFeatures(r); + this._queryEngine.featureStore.addMany(s); + const { fullExtent: o, timeExtent: a } = await this._queryEngine.fetchRecomputedExtents(); + if (n.layerDefinition.extent = o, a) { + const { start: l, end: c } = a; + n.layerDefinition.timeInfo.timeExtent = [l, c]; + } + return n; + } + async applyEdits() { + throw new ot("csv-layer:editing-not-supported", "applyEdits() is not supported on CSVLayer"); + } + async queryFeatures(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQuery(e, i.signal); + } + async queryFeatureCount(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForCount(e, i.signal); + } + async queryObjectIds(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForIds(e, i.signal); + } + async queryExtent(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForExtent(e, i.signal); + } + async querySnapping(e, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForSnapping(e, i.signal); + } + async refresh(e) { + this._loadOptions.customParameters = e, this._snapshotTask?.abort(), this._snapshotTask = iI(this._snapshotFeatures), this._snapshotTask.promise.then((n) => { + this._queryEngine.featureStore.clear(), n && this._queryEngine.featureStore.addMany(n); + }, (n) => { + this._queryEngine.featureStore.clear(), us(n) || Ei.getLogger("esri.layers.CSVLayer").error(new ot("csv-layer:refresh", "An error occurred during refresh", { error: n })); + }), await this._waitSnapshotComplete(); + const { fullExtent: i, timeExtent: r } = await this._queryEngine.fetchRecomputedExtents(); + return { extent: i, timeExtent: r }; + } + async _waitSnapshotComplete() { + if (this._snapshotTask && !this._snapshotTask.finished) { + try { + await this._snapshotTask.promise; + } catch { + } + return this._waitSnapshotComplete(); + } + } + async _fetch(e) { + const { url: i, customParameters: r } = this._loadOptions; + if (!i) + throw new ot("csv-layer:invalid-source", "url not defined"); + const n = ca(i); + return (await ir(n.path, { query: { ...n.query, ...r }, responseType: "text", signal: e })).data; + } + _createQueryEngine(e) { + const { objectIdField: i, fields: r, extent: n, timeInfo: s } = e.layerDefinition, o = new zie({ geometryType: "esriGeometryPoint", hasM: !1, hasZ: !1 }); + return new B$({ fields: r, geometryType: "esriGeometryPoint", hasM: !1, hasZ: !1, timeInfo: s, objectIdField: i, spatialReference: n.spatialReference || { wkid: 4326 }, cacheSpatialQueries: !0, featureStore: o }); + } + async _createFeatures(e) { + const { latitudeFieldName: i, longitudeFieldName: r } = this._locationInfo, { objectIdField: n, fieldsIndex: s, spatialReference: o } = this._queryEngine; + let a = []; + const l = [], c = s.fields.filter((x) => x.name !== n).map((x) => x.name); + let h = 0; + const p = {}; + for (const x of s.fields) + if (x.type !== "esriFieldTypeOID" && x.type !== "esriFieldTypeGlobalID") { + const I = pge(x); + I !== void 0 && (p[x.name] = I); + } + const y = MIt(e, c, this._delimiter, K$e(p, n)); + for (const x of y) { + const I = this._parseCoordinateValue(x[i]), P = this._parseCoordinateValue(x[r]); + if (P != null && I != null && !isNaN(I) && !isNaN(P)) { + x[i] = I, x[r] = P; + for (const F in x) + if (F !== i && F !== r) { + if (s.isDateField(F)) { + const k = new Date(x[F]); + x[F] = LIt(k, x[F]) ? k.getTime() : null; + } else if (s.isNumericField(F)) { + const k = n3e(x[F]); + isNaN(k) ? x[F] = null : x[F] = k; + } + } + x[n] = h, h++, a.push(new xNi(P, I)), l.push(x); + } + } + if (!Ea({ wkid: 4326 }, o)) + if (wx(o)) + for (const x of a) + [x.x, x.y] = ND(x.x, x.y, wNi); + else + a = sQ(xu, a, or.WGS84, o, null, null); + const v = []; + for (let x = 0; x < a.length; x++) { + const { x: I, y: P } = a[x], F = l[x]; + F[n] = x + 1, v.push(new g1(new Rl([], [I, P]), F, null, F[n])); + } + return v; + } + _parseCoordinateValue(e) { + if (e == null || e === "") + return null; + let i = n3e(e); + return (isNaN(i) || Math.abs(i) > 181) && (i = parseFloat(e)), i; + } + async _checkProjection(e) { + try { + await Py(gm, e); + } catch { + throw new ot("csv-layer:projection-not-supported", "Projection not supported"); + } + } +}; +function CNi(t, e) { + const i = e.parsingOptions || {}, r = { delimiter: i.delimiter, layerDefinition: null, locationInfo: { latitudeFieldName: i.latitudeField, longitudeFieldName: i.longitudeField } }, n = r.layerDefinition = { name: sge(e.url, bNi) || "csv", drawingInfo: _Ni, geometryType: "esriGeometryPoint", objectIdField: null, fields: [], timeInfo: i.timeInfo, extent: { xmin: Number.POSITIVE_INFINITY, ymin: Number.POSITIVE_INFINITY, xmax: Number.NEGATIVE_INFINITY, ymax: Number.NEGATIVE_INFINITY, spatialReference: i.spatialReference || { wkid: 4326 } } }, s = OIt(t), o = s.next().value?.trim(), a = s.next().value?.trim(); + if (!o) + throw new ot("csv-layer:empty-csv", "CSV is empty", { csv: t }); + const { delimiter: l, locationInfo: c } = uNi(o, a, i); + if (!l) + throw new ot("csv-layer:invalid-delimiter", "Unable to detect the delimiter from CSV", { firstLine: o, secondLine: a, parsingOptions: i }); + if (!c) + throw new ot("csv-layer:location-fields-not-found", "Unable to identify latitude and longitude fields from the CSV file", { firstLine: o, secondLine: a, parsingOptions: i }); + r.locationInfo = c, r.delimiter = l; + const { names: h, aliases: p } = DIt(o, l), y = hNi(t, r.delimiter, h, p, r.locationInfo); + if (i.fields?.length) { + const x = new sg(i.fields); + for (const I of y) { + const P = x.get(I.name); + P && Object.assign(I, P); + } + } + if (!y.some((x) => x.type === "esriFieldTypeOID" && (n.objectIdField = x.name, !0))) { + const x = { name: "__OBJECTID", alias: "__OBJECTID", type: "esriFieldTypeOID", editable: !1, nullable: !1 }; + n.objectIdField = x.name, y.unshift(x); + } + n.fields = y; + const v = new sg(n.fields); + if (r.locationInfo && (r.locationInfo.latitudeFieldName = v.get(r.locationInfo.latitudeFieldName).name, r.locationInfo.longitudeFieldName = v.get(r.locationInfo.longitudeFieldName).name), n.timeInfo) { + const x = n.timeInfo; + if (x.startTimeField) { + const I = v.get(x.startTimeField); + I ? (x.startTimeField = I.name, I.type = "esriFieldTypeDate") : x.startTimeField = null; + } + if (x.endTimeField) { + const I = v.get(x.endTimeField); + I ? (x.endTimeField = I.name, I.type = "esriFieldTypeDate") : x.endTimeField = null; + } + if (x.trackIdField) { + const I = v.get(x.trackIdField); + x.trackIdField = I ? I.name : null; + } + x.startTimeField || x.endTimeField || (n.timeInfo = null); + } + return r; +} +const TNi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: SNi +}, Symbol.toStringTag, { value: "Module" })); +let Z$e = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.elementCount = 9; + const o = this.TypedArrayConstructor; + n === void 0 && (n = 9 * o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride), this.stride = this.typedBufferStride * this.TypedArrayConstructor.BYTES_PER_ELEMENT; + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + getMat(e, i) { + let r = e * this.typedBufferStride; + for (let n = 0; n < 9; n++) + i[n] = this.typedBuffer[r++]; + return i; + } + setMat(e, i) { + let r = e * this.typedBufferStride; + for (let n = 0; n < 9; n++) + this.typedBuffer[r++] = i[n]; + } + get(e, i) { + return this.typedBuffer[e * this.typedBufferStride + i]; + } + set(e, i, r) { + this.typedBuffer[e * this.typedBufferStride + i] = r; + } + copyFrom(e, i, r) { + const n = this.typedBuffer, s = i.typedBuffer; + let o = e * this.typedBufferStride, a = r * i.typedBufferStride; + for (let l = 0; l < 9; ++l) + n[o++] = s[a++]; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +Z$e.ElementCount = 9; +let Q$e = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.elementCount = 16; + const o = this.TypedArrayConstructor; + n === void 0 && (n = 16 * o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride), this.stride = this.typedBufferStride * this.TypedArrayConstructor.BYTES_PER_ELEMENT; + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + getMat(e, i) { + let r = e * this.typedBufferStride; + for (let n = 0; n < 16; n++) + i[n] = this.typedBuffer[r++]; + return i; + } + setMat(e, i) { + let r = e * this.typedBufferStride; + for (let n = 0; n < 16; n++) + this.typedBuffer[r++] = i[n]; + } + get(e, i) { + return this.typedBuffer[e * this.typedBufferStride + i]; + } + set(e, i, r) { + this.typedBuffer[e * this.typedBufferStride + i] = r; + } + copyFrom(e, i, r) { + const n = this.typedBuffer, s = i.typedBuffer; + let o = e * this.typedBufferStride, a = r * i.typedBufferStride; + for (let l = 0; l < 16; ++l) + n[o++] = s[a++]; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +Q$e.ElementCount = 16; +let w3 = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.elementCount = 1; + const o = this.TypedArrayConstructor; + n === void 0 && (n = o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.stride = n, this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride); + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + get(e) { + return this.typedBuffer[e * this.typedBufferStride]; + } + set(e, i) { + this.typedBuffer[e * this.typedBufferStride] = i; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +w3.ElementCount = 1; +let x3 = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.elementCount = 2; + const o = this.TypedArrayConstructor; + n === void 0 && (n = 2 * o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride), this.stride = this.typedBufferStride * this.TypedArrayConstructor.BYTES_PER_ELEMENT; + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + getVec(e, i) { + return e *= this.typedBufferStride, aa(i, this.typedBuffer[e], this.typedBuffer[e + 1]); + } + setVec(e, i) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i[0], this.typedBuffer[e] = i[1]; + } + get(e, i) { + return this.typedBuffer[e * this.typedBufferStride + i]; + } + set(e, i, r) { + this.typedBuffer[e * this.typedBufferStride + i] = r; + } + setValues(e, i, r) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i, this.typedBuffer[e] = r; + } + copyFrom(e, i, r) { + const n = this.typedBuffer, s = i.typedBuffer; + let o = e * this.typedBufferStride, a = r * i.typedBufferStride; + n[o++] = s[a++], n[o] = s[a]; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +x3.ElementCount = 2; +let S3 = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.elementCount = 3; + const o = this.TypedArrayConstructor; + n === void 0 && (n = 3 * o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride), this.stride = this.typedBufferStride * this.TypedArrayConstructor.BYTES_PER_ELEMENT; + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + getVec(e, i) { + return e *= this.typedBufferStride, Ol(i, this.typedBuffer[e], this.typedBuffer[e + 1], this.typedBuffer[e + 2]); + } + setVec(e, i) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i[0], this.typedBuffer[e++] = i[1], this.typedBuffer[e] = i[2]; + } + get(e, i) { + return this.typedBuffer[e * this.typedBufferStride + i]; + } + set(e, i, r) { + this.typedBuffer[e * this.typedBufferStride + i] = r; + } + setValues(e, i, r, n) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i, this.typedBuffer[e++] = r, this.typedBuffer[e] = n; + } + copyFrom(e, i, r) { + const n = this.typedBuffer, s = i.typedBuffer; + let o = e * this.typedBufferStride, a = r * i.typedBufferStride; + n[o++] = s[a++], n[o++] = s[a++], n[o] = s[a]; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +S3.ElementCount = 3; +let C3 = class { + constructor(e, i, r = 0, n, s) { + this.TypedArrayConstructor = e, this.start = r, this.elementCount = 4; + const o = this.TypedArrayConstructor; + n === void 0 && (n = 4 * o.BYTES_PER_ELEMENT); + const a = i.byteLength === 0 ? 0 : r; + this.typedBuffer = s == null ? new o(i, a) : new o(i, a, (s - r) / o.BYTES_PER_ELEMENT), this.typedBufferStride = n / o.BYTES_PER_ELEMENT, this.count = Math.ceil(this.typedBuffer.length / this.typedBufferStride), this.stride = this.typedBufferStride * this.TypedArrayConstructor.BYTES_PER_ELEMENT; + } + sliceBuffer(e, i, r = this.count - i) { + const n = this.typedBuffer.byteOffset + i * this.stride; + return new e(this.buffer, n, this.stride, n + r * this.stride); + } + getVec(e, i) { + return e *= this.typedBufferStride, g0(i, this.typedBuffer[e++], this.typedBuffer[e++], this.typedBuffer[e++], this.typedBuffer[e]); + } + setVec(e, i) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i[0], this.typedBuffer[e++] = i[1], this.typedBuffer[e++] = i[2], this.typedBuffer[e] = i[3]; + } + get(e, i) { + return this.typedBuffer[e * this.typedBufferStride + i]; + } + set(e, i, r) { + this.typedBuffer[e * this.typedBufferStride + i] = r; + } + setValues(e, i, r, n, s) { + e *= this.typedBufferStride, this.typedBuffer[e++] = i, this.typedBuffer[e++] = r, this.typedBuffer[e++] = n, this.typedBuffer[e] = s; + } + copyFrom(e, i, r) { + const n = this.typedBuffer, s = i.typedBuffer; + let o = e * this.typedBufferStride, a = r * i.typedBufferStride; + n[o++] = s[a++], n[o++] = s[a++], n[o++] = s[a++], n[o] = s[a]; + } + get buffer() { + return this.typedBuffer.buffer; + } +}; +C3.ElementCount = 4; +let e8e = class kIt extends w3 { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + static fromTypedArray(e, i) { + return new kIt(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +e8e.ElementType = "f32"; +let V4 = class s3e extends x3 { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + slice(e, i) { + return this.sliceBuffer(s3e, e, i); + } + static fromTypedArray(e, i) { + return new s3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +V4.ElementType = "f32"; +let yc = class o3e extends S3 { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + slice(e, i) { + return this.sliceBuffer(o3e, e, i); + } + static fromTypedArray(e, i) { + return new o3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +yc.ElementType = "f32"; +let eC = class a3e extends C3 { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + slice(e, i) { + return this.sliceBuffer(a3e, e, i); + } + static fromTypedArray(e, i) { + return new a3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +eC.ElementType = "f32"; +let t8e = class l3e extends Z$e { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + slice(e, i) { + return this.sliceBuffer(l3e, e, i); + } + static fromTypedArray(e, i) { + return new l3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +t8e.ElementType = "f32"; +let i8e = class u3e extends Z$e { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(u3e, e, i); + } + static fromTypedArray(e, i) { + return new u3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +i8e.ElementType = "f64"; +let r8e = class c3e extends Q$e { + constructor(e, i = 0, r, n) { + super(Float32Array, e, i, r, n), this.elementType = "f32"; + } + slice(e, i) { + return this.sliceBuffer(c3e, e, i); + } + static fromTypedArray(e, i) { + return new c3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +r8e.ElementType = "f32"; +let n8e = class h3e extends Q$e { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(h3e, e, i); + } + static fromTypedArray(e, i) { + return new h3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +n8e.ElementType = "f64"; +let s8e = class d3e extends w3 { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(d3e, e, i); + } + static fromTypedArray(e, i) { + return new d3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +s8e.ElementType = "f64"; +let o8e = class p3e extends x3 { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(p3e, e, i); + } + static fromTypedArray(e, i) { + return new p3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +o8e.ElementType = "f64"; +let Cm = class f3e extends S3 { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(f3e, e, i); + } + static fromTypedArray(e, i) { + return new f3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +Cm.ElementType = "f64"; +let a8e = class m3e extends C3 { + constructor(e, i = 0, r, n) { + super(Float64Array, e, i, r, n), this.elementType = "f64"; + } + slice(e, i) { + return this.sliceBuffer(m3e, e, i); + } + static fromTypedArray(e, i) { + return new m3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +a8e.ElementType = "f64"; +let U0e = class g3e extends w3 { + constructor(e, i = 0, r, n) { + super(Uint8Array, e, i, r, n), this.elementType = "u8"; + } + slice(e, i) { + return this.sliceBuffer(g3e, e, i); + } + static fromTypedArray(e, i) { + return new g3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +U0e.ElementType = "u8"; +let z0e = class y3e extends x3 { + constructor(e, i = 0, r, n) { + super(Uint8Array, e, i, r, n), this.elementType = "u8"; + } + slice(e, i) { + return this.sliceBuffer(y3e, e, i); + } + static fromTypedArray(e, i) { + return new y3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +z0e.ElementType = "u8"; +let V$ = class v3e extends S3 { + constructor(e, i = 0, r, n) { + super(Uint8Array, e, i, r, n), this.elementType = "u8"; + } + slice(e, i) { + return this.sliceBuffer(v3e, e, i); + } + static fromTypedArray(e, i) { + return new v3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +V$.ElementType = "u8"; +let tC = class _3e extends C3 { + constructor(e, i = 0, r, n) { + super(Uint8Array, e, i, r, n), this.elementType = "u8"; + } + slice(e, i) { + return this.sliceBuffer(_3e, e, i); + } + static fromTypedArray(e, i) { + return new _3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +tC.ElementType = "u8"; +let H0e = class b3e extends w3 { + constructor(e, i = 0, r, n) { + super(Uint16Array, e, i, r, n), this.elementType = "u16"; + } + slice(e, i) { + return this.sliceBuffer(b3e, e, i); + } + static fromTypedArray(e, i) { + return new b3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +H0e.ElementType = "u16"; +let l8e = class w3e extends x3 { + constructor(e, i = 0, r, n) { + super(Uint16Array, e, i, r, n), this.elementType = "u16"; + } + slice(e, i) { + return this.sliceBuffer(w3e, e, i); + } + static fromTypedArray(e, i) { + return new w3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +l8e.ElementType = "u16"; +let Hie = class x3e extends S3 { + constructor(e, i = 0, r, n) { + super(Uint16Array, e, i, r, n), this.elementType = "u16"; + } + slice(e, i) { + return this.sliceBuffer(x3e, e, i); + } + static fromTypedArray(e, i) { + return new x3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +Hie.ElementType = "u16"; +let tH = class S3e extends C3 { + constructor(e, i = 0, r, n) { + super(Uint16Array, e, i, r, n), this.elementType = "u16"; + } + slice(e, i) { + return this.sliceBuffer(S3e, e, i); + } + static fromTypedArray(e, i) { + return new S3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +tH.ElementType = "u16"; +let W0e = class C3e extends w3 { + constructor(e, i = 0, r, n) { + super(Uint32Array, e, i, r, n), this.elementType = "u32"; + } + slice(e, i) { + return this.sliceBuffer(C3e, e, i); + } + static fromTypedArray(e, i) { + return new C3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +W0e.ElementType = "u32"; +let u8e = class T3e extends x3 { + constructor(e, i = 0, r, n) { + super(Uint32Array, e, i, r, n), this.elementType = "u32"; + } + slice(e, i) { + return this.sliceBuffer(T3e, e, i); + } + static fromTypedArray(e, i) { + return new T3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +u8e.ElementType = "u32"; +let $It = class E3e extends S3 { + constructor(e, i = 0, r, n) { + super(Uint32Array, e, i, r, n), this.elementType = "u32"; + } + slice(e, i) { + return this.sliceBuffer(E3e, e, i); + } + static fromTypedArray(e, i) { + return new E3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +$It.ElementType = "u32"; +let BIt = class I3e extends C3 { + constructor(e, i = 0, r, n) { + super(Uint32Array, e, i, r, n), this.elementType = "u32"; + } + slice(e, i) { + return this.sliceBuffer(I3e, e, i); + } + static fromTypedArray(e, i) { + return new I3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +BIt.ElementType = "u32"; +let c8e = class A3e extends w3 { + constructor(e, i = 0, r, n) { + super(Int8Array, e, i, r, n), this.elementType = "i8"; + } + slice(e, i) { + return this.sliceBuffer(A3e, e, i); + } + static fromTypedArray(e, i) { + return new A3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +c8e.ElementType = "i8"; +let q0e = class P3e extends x3 { + constructor(e, i = 0, r, n) { + super(Int8Array, e, i, r, n), this.elementType = "i8"; + } + slice(e, i) { + return this.sliceBuffer(P3e, e, i); + } + static fromTypedArray(e, i) { + return new P3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +q0e.ElementType = "i8"; +let VIt = class O3e extends S3 { + constructor(e, i = 0, r, n) { + super(Int8Array, e, i, r, n), this.elementType = "i8"; + } + slice(e, i) { + return this.sliceBuffer(O3e, e, i); + } + static fromTypedArray(e, i) { + return new O3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +VIt.ElementType = "i8"; +let jIt = class R3e extends C3 { + constructor(e, i = 0, r, n) { + super(Int8Array, e, i, r, n), this.elementType = "i8"; + } + slice(e, i) { + return this.sliceBuffer(R3e, e, i); + } + static fromTypedArray(e, i) { + return new R3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +jIt.ElementType = "i8"; +let GIt = class M3e extends w3 { + constructor(e, i = 0, r, n) { + super(Int16Array, e, i, r, n), this.elementType = "i16"; + } + slice(e, i) { + return this.sliceBuffer(M3e, e, i); + } + static fromTypedArray(e, i) { + return new M3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +GIt.ElementType = "i16"; +let Y0e = class D3e extends x3 { + constructor(e, i = 0, r, n) { + super(Int16Array, e, i, r, n), this.elementType = "i16"; + } + slice(e, i) { + return this.sliceBuffer(D3e, e, i); + } + static fromTypedArray(e, i) { + return new D3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +Y0e.ElementType = "i16"; +let UIt = class F3e extends S3 { + constructor(e, i = 0, r, n) { + super(Int16Array, e, i, r, n), this.elementType = "i16"; + } + slice(e, i) { + return this.sliceBuffer(F3e, e, i); + } + static fromTypedArray(e, i) { + return new F3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +UIt.ElementType = "i16"; +let zIt = class L3e extends C3 { + constructor(e, i = 0, r, n) { + super(Int16Array, e, i, r, n), this.elementType = "i16"; + } + slice(e, i) { + return this.sliceBuffer(L3e, e, i); + } + static fromTypedArray(e, i) { + return new L3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +zIt.ElementType = "i16"; +let HIt = class N3e extends w3 { + constructor(e, i = 0, r, n) { + super(Int32Array, e, i, r, n), this.elementType = "i32"; + } + slice(e, i) { + return this.sliceBuffer(N3e, e, i); + } + static fromTypedArray(e, i) { + return new N3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +HIt.ElementType = "i32"; +let WIt = class k3e extends x3 { + constructor(e, i = 0, r, n) { + super(Int32Array, e, i, r, n), this.elementType = "i32"; + } + slice(e, i) { + return this.sliceBuffer(k3e, e, i); + } + static fromTypedArray(e, i) { + return new k3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +WIt.ElementType = "i32"; +let qIt = class $3e extends S3 { + constructor(e, i = 0, r, n) { + super(Int32Array, e, i, r, n), this.elementType = "i32"; + } + slice(e, i) { + return this.sliceBuffer($3e, e, i); + } + static fromTypedArray(e, i) { + return new $3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +qIt.ElementType = "i32"; +let YIt = class B3e extends C3 { + constructor(e, i = 0, r, n) { + super(Int32Array, e, i, r, n), this.elementType = "i32"; + } + slice(e, i) { + return this.sliceBuffer(B3e, e, i); + } + static fromTypedArray(e, i) { + return new B3e(e.buffer, e.byteOffset, i, e.byteOffset + e.byteLength); + } +}; +YIt.ElementType = "i32"; +function XIt(t) { + switch (t) { + case "u8": + case "i8": + return 1; + case "u16": + case "i16": + return 2; + case "u32": + case "i32": + case "f32": + return 4; + case "f64": + return 8; + } +} +function ENi(t) { + switch (t) { + case "u8": + case "u16": + case "u32": + return !1; + case "i8": + case "i16": + case "i32": + case "f32": + case "f64": + return !0; + } +} +function INi(t) { + switch (t) { + case "u8": + case "u16": + case "u32": + case "i8": + case "i16": + case "i32": + return !0; + case "f32": + case "f64": + return !1; + } +} +function ANi(t) { + switch (t) { + case "u8": + return 255; + case "u16": + return 65535; + case "u32": + return 4294967295; + case "i8": + return 127; + case "i16": + return 32767; + case "i32": + return 2147483647; + case "f32": + return 3402823e32; + case "f64": + return 179769e303; + } +} +let dJe = class KIt { + constructor(e, i) { + this.layout = e, this.buffer = typeof i == "number" ? new ArrayBuffer(i * e.stride) : i; + for (const r of e.fieldNames) { + const n = e.fields.get(r); + this[r] = new n.constructor(this.buffer, n.offset, this.stride); + } + } + get stride() { + return this.layout.stride; + } + get count() { + return this.buffer.byteLength / this.stride; + } + get byteLength() { + return this.buffer.byteLength; + } + getField(e, i) { + const r = this[e]; + return r && r.elementCount === i.ElementCount && r.elementType === i.ElementType ? r : null; + } + slice(e, i) { + return new KIt(this.layout, this.buffer.slice(e * this.stride, i * this.stride)); + } + copyFrom(e, i, r, n) { + const s = this.stride; + if (s % 4 == 0) { + const o = new Uint32Array(e.buffer, i * s, n * s / 4); + new Uint32Array(this.buffer, r * s, n * s / 4).set(o); + } else { + const o = new Uint8Array(e.buffer, i * s, n * s); + new Uint8Array(this.buffer, r * s, n * s).set(o); + } + } +}, PNi = class JIt { + constructor() { + this.stride = 0, this.fields = /* @__PURE__ */ new Map(), this.fieldNames = []; + } + vec2f(e, i) { + return this._appendField(e, V4, i), this; + } + vec2f64(e, i) { + return this._appendField(e, o8e, i), this; + } + vec3f(e, i) { + return this._appendField(e, yc, i), this; + } + vec3f64(e, i) { + return this._appendField(e, Cm, i), this; + } + vec4f(e, i) { + return this._appendField(e, eC, i), this; + } + vec4f64(e, i) { + return this._appendField(e, a8e, i), this; + } + mat3f(e, i) { + return this._appendField(e, t8e, i), this; + } + mat3f64(e, i) { + return this._appendField(e, i8e, i), this; + } + mat4f(e, i) { + return this._appendField(e, r8e, i), this; + } + mat4f64(e, i) { + return this._appendField(e, n8e, i), this; + } + vec4u8(e, i) { + return this._appendField(e, tC, i), this; + } + f32(e, i) { + return this._appendField(e, e8e, i), this; + } + f64(e, i) { + return this._appendField(e, s8e, i), this; + } + u8(e, i) { + return this._appendField(e, U0e, i), this; + } + u16(e, i) { + return this._appendField(e, H0e, i), this; + } + i8(e, i) { + return this._appendField(e, c8e, i), this; + } + vec2i8(e, i) { + return this._appendField(e, q0e, i), this; + } + vec2i16(e, i) { + return this._appendField(e, Y0e, i), this; + } + vec2u8(e, i) { + return this._appendField(e, z0e, i), this; + } + vec4u16(e, i) { + return this._appendField(e, tH, i), this; + } + u32(e, i) { + return this._appendField(e, W0e, i), this; + } + _appendField(e, i, r) { + const n = i.ElementCount * XIt(i.ElementType), s = this.stride; + this.fields.set(e, { size: n, constructor: i, offset: s, optional: r }), this.stride += n, this.fieldNames.push(e); + } + alignTo(e) { + return this.stride = Math.floor((this.stride + e - 1) / e) * e, this; + } + hasField(e) { + return this.fieldNames.includes(e); + } + createBuffer(e) { + return new dJe(this, e); + } + createView(e) { + return new dJe(this, e); + } + clone() { + const e = new JIt(); + return e.stride = this.stride, e.fields = /* @__PURE__ */ new Map(), this.fields.forEach((i, r) => e.fields.set(r, i)), e.fieldNames = this.fieldNames.slice(), e.BufferType = this.BufferType, e; + } +}; +function iH() { + return new PNi(); +} +function tfe(t, e) { + return e.push(t.buffer), { buffer: t.buffer, layout: ONi(t.layout) }; +} +function ONi(t) { + const e = new Array(); + return t.fields.forEach((i, r) => { + const n = { ...i, constructor: ZIt(i.constructor) }; + e.push([r, n]); + }), { stride: t.stride, fields: e, fieldNames: t.fieldNames }; +} +const RNi = [e8e, V4, yc, eC, t8e, r8e, s8e, o8e, Cm, a8e, i8e, n8e, U0e, z0e, V$, tC, H0e, l8e, Hie, tH, W0e, u8e, $It, BIt, c8e, q0e, VIt, jIt, GIt, Y0e, UIt, zIt, HIt, WIt, qIt, YIt]; +function ZIt(t) { + return `${t.ElementType}_${t.ElementCount}`; +} +const MNi = /* @__PURE__ */ new Map(); +RNi.forEach((t) => MNi.set(ZIt(t), t)); +var NE, ps, gn, r4, ao, ax, qU, Fi, Ll, su, _n, ds, io, cn, Vs, rs, Ag, Vo, bb, nm, Fh, xl; +(function(t) { + t[t.DEPTH_BUFFER_BIT = 256] = "DEPTH_BUFFER_BIT", t[t.STENCIL_BUFFER_BIT = 1024] = "STENCIL_BUFFER_BIT", t[t.COLOR_BUFFER_BIT = 16384] = "COLOR_BUFFER_BIT"; +})(NE || (NE = {})), function(t) { + t[t.POINTS = 0] = "POINTS", t[t.LINES = 1] = "LINES", t[t.LINE_LOOP = 2] = "LINE_LOOP", t[t.LINE_STRIP = 3] = "LINE_STRIP", t[t.TRIANGLES = 4] = "TRIANGLES", t[t.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP", t[t.TRIANGLE_FAN = 6] = "TRIANGLE_FAN"; +}(ps || (ps = {})), function(t) { + t[t.ZERO = 0] = "ZERO", t[t.ONE = 1] = "ONE", t[t.SRC_COLOR = 768] = "SRC_COLOR", t[t.ONE_MINUS_SRC_COLOR = 769] = "ONE_MINUS_SRC_COLOR", t[t.SRC_ALPHA = 770] = "SRC_ALPHA", t[t.ONE_MINUS_SRC_ALPHA = 771] = "ONE_MINUS_SRC_ALPHA", t[t.DST_ALPHA = 772] = "DST_ALPHA", t[t.ONE_MINUS_DST_ALPHA = 773] = "ONE_MINUS_DST_ALPHA", t[t.DST_COLOR = 774] = "DST_COLOR", t[t.ONE_MINUS_DST_COLOR = 775] = "ONE_MINUS_DST_COLOR", t[t.SRC_ALPHA_SATURATE = 776] = "SRC_ALPHA_SATURATE", t[t.CONSTANT_COLOR = 32769] = "CONSTANT_COLOR", t[t.ONE_MINUS_CONSTANT_COLOR = 32770] = "ONE_MINUS_CONSTANT_COLOR", t[t.CONSTANT_ALPHA = 32771] = "CONSTANT_ALPHA", t[t.ONE_MINUS_CONSTANT_ALPHA = 32772] = "ONE_MINUS_CONSTANT_ALPHA"; +}(gn || (gn = {})), function(t) { + t[t.ADD = 32774] = "ADD", t[t.SUBTRACT = 32778] = "SUBTRACT", t[t.REVERSE_SUBTRACT = 32779] = "REVERSE_SUBTRACT"; +}(r4 || (r4 = {})), function(t) { + t[t.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", t[t.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER", t[t.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER", t[t.PIXEL_PACK_BUFFER = 35051] = "PIXEL_PACK_BUFFER", t[t.PIXEL_UNPACK_BUFFER = 35052] = "PIXEL_UNPACK_BUFFER", t[t.COPY_READ_BUFFER = 36662] = "COPY_READ_BUFFER", t[t.COPY_WRITE_BUFFER = 36663] = "COPY_WRITE_BUFFER"; +}(ao || (ao = {})), function(t) { + t[t.FRONT = 1028] = "FRONT", t[t.BACK = 1029] = "BACK", t[t.FRONT_AND_BACK = 1032] = "FRONT_AND_BACK"; +}(ax || (ax = {})), function(t) { + t[t.CW = 2304] = "CW", t[t.CCW = 2305] = "CCW"; +}(qU || (qU = {})), function(t) { + t[t.BYTE = 5120] = "BYTE", t[t.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", t[t.SHORT = 5122] = "SHORT", t[t.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", t[t.INT = 5124] = "INT", t[t.UNSIGNED_INT = 5125] = "UNSIGNED_INT", t[t.FLOAT = 5126] = "FLOAT"; +}(Fi || (Fi = {})), function(t) { + t[t.NEVER = 512] = "NEVER", t[t.LESS = 513] = "LESS", t[t.EQUAL = 514] = "EQUAL", t[t.LEQUAL = 515] = "LEQUAL", t[t.GREATER = 516] = "GREATER", t[t.NOTEQUAL = 517] = "NOTEQUAL", t[t.GEQUAL = 518] = "GEQUAL", t[t.ALWAYS = 519] = "ALWAYS"; +}(Ll || (Ll = {})), function(t) { + t[t.ZERO = 0] = "ZERO", t[t.KEEP = 7680] = "KEEP", t[t.REPLACE = 7681] = "REPLACE", t[t.INCR = 7682] = "INCR", t[t.DECR = 7683] = "DECR", t[t.INVERT = 5386] = "INVERT", t[t.INCR_WRAP = 34055] = "INCR_WRAP", t[t.DECR_WRAP = 34056] = "DECR_WRAP"; +}(su || (su = {})), function(t) { + t[t.NEAREST = 9728] = "NEAREST", t[t.LINEAR = 9729] = "LINEAR", t[t.NEAREST_MIPMAP_NEAREST = 9984] = "NEAREST_MIPMAP_NEAREST", t[t.LINEAR_MIPMAP_NEAREST = 9985] = "LINEAR_MIPMAP_NEAREST", t[t.NEAREST_MIPMAP_LINEAR = 9986] = "NEAREST_MIPMAP_LINEAR", t[t.LINEAR_MIPMAP_LINEAR = 9987] = "LINEAR_MIPMAP_LINEAR"; +}(_n || (_n = {})), function(t) { + t[t.CLAMP_TO_EDGE = 33071] = "CLAMP_TO_EDGE", t[t.REPEAT = 10497] = "REPEAT", t[t.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT"; +}(ds || (ds = {})), function(t) { + t[t.TEXTURE_2D = 3553] = "TEXTURE_2D", t[t.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", t[t.TEXTURE_3D = 32879] = "TEXTURE_3D", t[t.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", t[t.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", t[t.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", t[t.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", t[t.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY"; +}(io || (io = {})), function(t) { + t[t.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", t[t.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", t[t.ALPHA = 6406] = "ALPHA", t[t.RGB = 6407] = "RGB", t[t.RGBA = 6408] = "RGBA", t[t.LUMINANCE = 6409] = "LUMINANCE", t[t.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", t[t.RED = 6403] = "RED", t[t.RG = 33319] = "RG", t[t.RED_INTEGER = 36244] = "RED_INTEGER", t[t.RG_INTEGER = 33320] = "RG_INTEGER", t[t.RGB_INTEGER = 36248] = "RGB_INTEGER", t[t.RGBA_INTEGER = 36249] = "RGBA_INTEGER"; +}(cn || (cn = {})), function(t) { + t[t.RGBA4 = 32854] = "RGBA4", t[t.R16F = 33325] = "R16F", t[t.RG16F = 33327] = "RG16F", t[t.RGB32F = 34837] = "RGB32F", t[t.RGBA16F = 34842] = "RGBA16F", t[t.R32F = 33326] = "R32F", t[t.RG32F = 33328] = "RG32F", t[t.RGBA32F = 34836] = "RGBA32F", t[t.R11F_G11F_B10F = 35898] = "R11F_G11F_B10F", t[t.RGB8 = 32849] = "RGB8", t[t.RGBA8 = 32856] = "RGBA8", t[t.RGB5_A1 = 32855] = "RGB5_A1", t[t.R8 = 33321] = "R8", t[t.RG8 = 33323] = "RG8", t[t.R8I = 33329] = "R8I", t[t.R8UI = 33330] = "R8UI", t[t.R16I = 33331] = "R16I", t[t.R16UI = 33332] = "R16UI", t[t.R32I = 33333] = "R32I", t[t.R32UI = 33334] = "R32UI", t[t.RG8I = 33335] = "RG8I", t[t.RG8UI = 33336] = "RG8UI", t[t.RG16I = 33337] = "RG16I", t[t.RG16UI = 33338] = "RG16UI", t[t.RG32I = 33339] = "RG32I", t[t.RG32UI = 33340] = "RG32UI", t[t.RGB16F = 34843] = "RGB16F", t[t.RGB9_E5 = 35901] = "RGB9_E5", t[t.SRGB8 = 35905] = "SRGB8", t[t.SRGB8_ALPHA8 = 35907] = "SRGB8_ALPHA8", t[t.RGB565 = 36194] = "RGB565", t[t.RGBA32UI = 36208] = "RGBA32UI", t[t.RGB32UI = 36209] = "RGB32UI", t[t.RGBA16UI = 36214] = "RGBA16UI", t[t.RGB16UI = 36215] = "RGB16UI", t[t.RGBA8UI = 36220] = "RGBA8UI", t[t.RGB8UI = 36221] = "RGB8UI", t[t.RGBA32I = 36226] = "RGBA32I", t[t.RGB32I = 36227] = "RGB32I", t[t.RGBA16I = 36232] = "RGBA16I", t[t.RGB16I = 36233] = "RGB16I", t[t.RGBA8I = 36238] = "RGBA8I", t[t.RGB8I = 36239] = "RGB8I", t[t.R8_SNORM = 36756] = "R8_SNORM", t[t.RG8_SNORM = 36757] = "RG8_SNORM", t[t.RGB8_SNORM = 36758] = "RGB8_SNORM", t[t.RGBA8_SNORM = 36759] = "RGBA8_SNORM", t[t.RGB10_A2 = 32857] = "RGB10_A2", t[t.RGB10_A2UI = 36975] = "RGB10_A2UI"; +}(Vs || (Vs = {})), function(t) { + t[t.FLOAT = 5126] = "FLOAT", t[t.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", t[t.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", t[t.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", t[t.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", t[t.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", t[t.BYTE = 5120] = "BYTE", t[t.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", t[t.SHORT = 5122] = "SHORT", t[t.UNSIGNED_INT = 5125] = "UNSIGNED_INT", t[t.INT = 5124] = "INT", t[t.HALF_FLOAT = 5131] = "HALF_FLOAT", t[t.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", t[t.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", t[t.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", t[t.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; +}(rs || (rs = {})), function(t) { + t[t.DEPTH_COMPONENT16 = 33189] = "DEPTH_COMPONENT16", t[t.STENCIL_INDEX8 = 36168] = "STENCIL_INDEX8", t[t.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", t[t.DEPTH_COMPONENT24 = 33190] = "DEPTH_COMPONENT24", t[t.DEPTH_COMPONENT32F = 36012] = "DEPTH_COMPONENT32F", t[t.DEPTH24_STENCIL8 = 35056] = "DEPTH24_STENCIL8", t[t.DEPTH32F_STENCIL8 = 36013] = "DEPTH32F_STENCIL8"; +}(Ag || (Ag = {})), function(t) { + t[t.STATIC_DRAW = 35044] = "STATIC_DRAW", t[t.DYNAMIC_DRAW = 35048] = "DYNAMIC_DRAW", t[t.STREAM_DRAW = 35040] = "STREAM_DRAW", t[t.STATIC_READ = 35045] = "STATIC_READ", t[t.DYNAMIC_READ = 35049] = "DYNAMIC_READ", t[t.STREAM_READ = 35041] = "STREAM_READ", t[t.STATIC_COPY = 35046] = "STATIC_COPY", t[t.DYNAMIC_COPY = 35050] = "DYNAMIC_COPY", t[t.STREAM_COPY = 35042] = "STREAM_COPY"; +}(Vo || (Vo = {})), function(t) { + t[t.FRAGMENT_SHADER = 35632] = "FRAGMENT_SHADER", t[t.VERTEX_SHADER = 35633] = "VERTEX_SHADER"; +}(bb || (bb = {})), function(t) { + t[t.FRAMEBUFFER = 36160] = "FRAMEBUFFER", t[t.READ_FRAMEBUFFER = 36008] = "READ_FRAMEBUFFER", t[t.DRAW_FRAMEBUFFER = 36009] = "DRAW_FRAMEBUFFER"; +}(nm || (nm = {})), function(t) { + t[t.TEXTURE = 0] = "TEXTURE", t[t.RENDER_BUFFER = 1] = "RENDER_BUFFER", t[t.CUBEMAP = 2] = "CUBEMAP"; +}(Fh || (Fh = {})), function(t) { + t[t.NONE = 0] = "NONE", t[t.DEPTH_RENDER_BUFFER = 1] = "DEPTH_RENDER_BUFFER", t[t.STENCIL_RENDER_BUFFER = 2] = "STENCIL_RENDER_BUFFER", t[t.DEPTH_STENCIL_RENDER_BUFFER = 3] = "DEPTH_STENCIL_RENDER_BUFFER", t[t.DEPTH_STENCIL_TEXTURE = 4] = "DEPTH_STENCIL_TEXTURE"; +}(xl || (xl = {})); +const exe = 33984; +var Df, xv; +(function(t) { + t[t.Texture = 0] = "Texture", t[t.BufferObject = 1] = "BufferObject", t[t.VertexArrayObject = 2] = "VertexArrayObject", t[t.Shader = 3] = "Shader", t[t.Program = 4] = "Program", t[t.FramebufferObject = 5] = "FramebufferObject", t[t.Renderbuffer = 6] = "Renderbuffer", t[t.Sync = 7] = "Sync", t[t.COUNT = 8] = "COUNT"; +})(Df || (Df = {})), function(t) { + t[t.COLOR_ATTACHMENT0 = 36064] = "COLOR_ATTACHMENT0", t[t.COLOR_ATTACHMENT1 = 36065] = "COLOR_ATTACHMENT1", t[t.COLOR_ATTACHMENT2 = 36066] = "COLOR_ATTACHMENT2", t[t.COLOR_ATTACHMENT3 = 36067] = "COLOR_ATTACHMENT3", t[t.COLOR_ATTACHMENT4 = 36068] = "COLOR_ATTACHMENT4", t[t.COLOR_ATTACHMENT5 = 36069] = "COLOR_ATTACHMENT5", t[t.COLOR_ATTACHMENT6 = 36070] = "COLOR_ATTACHMENT6", t[t.COLOR_ATTACHMENT7 = 36071] = "COLOR_ATTACHMENT7", t[t.COLOR_ATTACHMENT8 = 36072] = "COLOR_ATTACHMENT8", t[t.COLOR_ATTACHMENT9 = 36073] = "COLOR_ATTACHMENT9", t[t.COLOR_ATTACHMENT10 = 36074] = "COLOR_ATTACHMENT10", t[t.COLOR_ATTACHMENT11 = 36075] = "COLOR_ATTACHMENT11", t[t.COLOR_ATTACHMENT12 = 36076] = "COLOR_ATTACHMENT12", t[t.COLOR_ATTACHMENT13 = 36077] = "COLOR_ATTACHMENT13", t[t.COLOR_ATTACHMENT14 = 36078] = "COLOR_ATTACHMENT14", t[t.COLOR_ATTACHMENT15 = 36079] = "COLOR_ATTACHMENT15"; +}(xv || (xv = {})); +const pJe = 33306; +var ed, f0, fJe, mJe, ife, V3e, gJe; +(function(t) { + t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", t[t.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", t[t.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", t[t.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", t[t.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", t[t.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", t[t.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2", t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", t[t.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC", t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"; +})(ed || (ed = {})), function(t) { + t[t.FLOAT = 5126] = "FLOAT", t[t.FLOAT_VEC2 = 35664] = "FLOAT_VEC2", t[t.FLOAT_VEC3 = 35665] = "FLOAT_VEC3", t[t.FLOAT_VEC4 = 35666] = "FLOAT_VEC4", t[t.INT = 5124] = "INT", t[t.INT_VEC2 = 35667] = "INT_VEC2", t[t.INT_VEC3 = 35668] = "INT_VEC3", t[t.INT_VEC4 = 35669] = "INT_VEC4", t[t.BOOL = 35670] = "BOOL", t[t.BOOL_VEC2 = 35671] = "BOOL_VEC2", t[t.BOOL_VEC3 = 35672] = "BOOL_VEC3", t[t.BOOL_VEC4 = 35673] = "BOOL_VEC4", t[t.FLOAT_MAT2 = 35674] = "FLOAT_MAT2", t[t.FLOAT_MAT3 = 35675] = "FLOAT_MAT3", t[t.FLOAT_MAT4 = 35676] = "FLOAT_MAT4", t[t.SAMPLER_2D = 35678] = "SAMPLER_2D", t[t.SAMPLER_CUBE = 35680] = "SAMPLER_CUBE", t[t.UNSIGNED_INT = 5125] = "UNSIGNED_INT", t[t.UNSIGNED_INT_VEC2 = 36294] = "UNSIGNED_INT_VEC2", t[t.UNSIGNED_INT_VEC3 = 36295] = "UNSIGNED_INT_VEC3", t[t.UNSIGNED_INT_VEC4 = 36296] = "UNSIGNED_INT_VEC4", t[t.FLOAT_MAT2x3 = 35685] = "FLOAT_MAT2x3", t[t.FLOAT_MAT2x4 = 35686] = "FLOAT_MAT2x4", t[t.FLOAT_MAT3x2 = 35687] = "FLOAT_MAT3x2", t[t.FLOAT_MAT3x4 = 35688] = "FLOAT_MAT3x4", t[t.FLOAT_MAT4x2 = 35689] = "FLOAT_MAT4x2", t[t.FLOAT_MAT4x3 = 35690] = "FLOAT_MAT4x3", t[t.SAMPLER_3D = 35679] = "SAMPLER_3D", t[t.SAMPLER_2D_SHADOW = 35682] = "SAMPLER_2D_SHADOW", t[t.SAMPLER_2D_ARRAY = 36289] = "SAMPLER_2D_ARRAY", t[t.SAMPLER_2D_ARRAY_SHADOW = 36292] = "SAMPLER_2D_ARRAY_SHADOW", t[t.SAMPLER_CUBE_SHADOW = 36293] = "SAMPLER_CUBE_SHADOW", t[t.INT_SAMPLER_2D = 36298] = "INT_SAMPLER_2D", t[t.INT_SAMPLER_3D = 36299] = "INT_SAMPLER_3D", t[t.INT_SAMPLER_CUBE = 36300] = "INT_SAMPLER_CUBE", t[t.INT_SAMPLER_2D_ARRAY = 36303] = "INT_SAMPLER_2D_ARRAY", t[t.UNSIGNED_INT_SAMPLER_2D = 36306] = "UNSIGNED_INT_SAMPLER_2D", t[t.UNSIGNED_INT_SAMPLER_3D = 36307] = "UNSIGNED_INT_SAMPLER_3D", t[t.UNSIGNED_INT_SAMPLER_CUBE = 36308] = "UNSIGNED_INT_SAMPLER_CUBE", t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311] = "UNSIGNED_INT_SAMPLER_2D_ARRAY"; +}(f0 || (f0 = {})), function(t) { + t[t.OBJECT_TYPE = 37138] = "OBJECT_TYPE", t[t.SYNC_CONDITION = 37139] = "SYNC_CONDITION", t[t.SYNC_STATUS = 37140] = "SYNC_STATUS", t[t.SYNC_FLAGS = 37141] = "SYNC_FLAGS"; +}(fJe || (fJe = {})), function(t) { + t[t.UNSIGNALED = 37144] = "UNSIGNALED", t[t.SIGNALED = 37145] = "SIGNALED"; +}(mJe || (mJe = {})), function(t) { + t[t.ALREADY_SIGNALED = 37146] = "ALREADY_SIGNALED", t[t.TIMEOUT_EXPIRED = 37147] = "TIMEOUT_EXPIRED", t[t.CONDITION_SATISFIED = 37148] = "CONDITION_SATISFIED", t[t.WAIT_FAILED = 37149] = "WAIT_FAILED"; +}(ife || (ife = {})), function(t) { + t[t.SYNC_GPU_COMMANDS_COMPLETE = 37143] = "SYNC_GPU_COMMANDS_COMPLETE"; +}(V3e || (V3e = {})), function(t) { + t[t.SYNC_FLUSH_COMMANDS_BIT = 1] = "SYNC_FLUSH_COMMANDS_BIT"; +}(gJe || (gJe = {})); +let ea = class { + constructor(e, i, r, n, s, o = !1, a = 0) { + this.name = e, this.count = i, this.type = r, this.offset = n, this.stride = s, this.normalized = o, this.divisor = a; + } +}; +function h8e(t, e = 0) { + const i = t.stride; + return t.fieldNames.filter((r) => { + const n = t.fields.get(r).optional; + return !(n && n.glPadding); + }).map((r) => { + const n = t.fields.get(r), s = n.constructor.ElementCount, o = DNi(n.constructor.ElementType), a = n.offset, l = !(!n.optional || !n.optional.glNormalized); + return new ea(r, s, o, a, i, l, e); + }); +} +function DNi(t) { + const e = FNi[t]; + if (e) + return e; + throw new Error("BufferType not supported in WebGL"); +} +const FNi = { u8: Fi.UNSIGNED_BYTE, u16: Fi.UNSIGNED_SHORT, u32: Fi.UNSIGNED_INT, i8: Fi.BYTE, i16: Fi.SHORT, i32: Fi.INT, f32: Fi.FLOAT }; +var Br; +(function(t) { + t.POSITION = "position", t.NORMAL = "normal", t.UV0 = "uv0", t.AUXPOS1 = "auxpos1", t.AUXPOS2 = "auxpos2", t.COLOR = "color", t.SYMBOLCOLOR = "symbolColor", t.SIZE = "size", t.TANGENT = "tangent", t.OFFSET = "offset", t.SUBDIVISIONFACTOR = "subdivisionFactor", t.COLORFEATUREATTRIBUTE = "colorFeatureAttribute", t.SIZEFEATUREATTRIBUTE = "sizeFeatureAttribute", t.OPACITYFEATUREATTRIBUTE = "opacityFeatureAttribute", t.DISTANCETOSTART = "distanceToStart", t.UVMAPSPACE = "uvMapSpace", t.BOUNDINGRECT = "boundingRect", t.UVREGION = "uvRegion", t.NORMALCOMPRESSED = "normalCompressed", t.PROFILERIGHT = "profileRight", t.PROFILEUP = "profileUp", t.PROFILEVERTEXANDNORMAL = "profileVertexAndNormal", t.FEATUREVALUE = "featureValue", t.MODELORIGINHI = "modelOriginHi", t.MODELORIGINLO = "modelOriginLo", t.MODEL = "model", t.MODELNORMAL = "modelNormal", t.INSTANCECOLOR = "instanceColor", t.INSTANCEFEATUREATTRIBUTE = "instanceFeatureAttribute", t.LOCALTRANSFORM = "localTransform", t.GLOBALTRANSFORM = "globalTransform", t.BOUNDINGSPHERE = "boundingSphere", t.MODELORIGIN = "modelOrigin", t.MODELSCALEFACTORS = "modelScaleFactors", t.FEATUREATTRIBUTE = "featureAttribute", t.STATE = "state", t.LODLEVEL = "lodLevel", t.POSITION0 = "position0", t.POSITION1 = "position1", t.NORMALA = "normalA", t.NORMALB = "normalB", t.COMPONENTINDEX = "componentIndex", t.VARIANTOFFSET = "variantOffset", t.VARIANTSTROKE = "variantStroke", t.VARIANTEXTENSION = "variantExtension", t.U8PADDING = "u8padding", t.U16PADDING = "u16padding", t.SIDENESS = "sideness", t.START = "start", t.END = "end", t.UP = "up", t.EXTRUDE = "extrude", t.OBJECTANDLAYERIDCOLOR = "objectAndLayerIdColor", t.OBJECTANDLAYERIDCOLOR_INSTANCED = "objectAndLayerIdColor_instanced"; +})(Br || (Br = {})); +const QIt = iH().vec3f(Br.POSITION).u16(Br.COMPONENTINDEX).u16(Br.U16PADDING), LNi = iH().vec2u8(Br.SIDENESS); +h8e(LNi); +const eAt = iH().vec3f(Br.POSITION0).vec3f(Br.POSITION1).u16(Br.COMPONENTINDEX).u8(Br.VARIANTOFFSET, { glNormalized: !0 }).u8(Br.VARIANTSTROKE).u8(Br.VARIANTEXTENSION, { glNormalized: !0 }).u8(Br.U8PADDING, { glPadding: !0 }).u16(Br.U16PADDING, { glPadding: !0 }), j3e = eAt.clone().vec3f(Br.NORMAL), G3e = eAt.clone().vec3f(Br.NORMALA).vec3f(Br.NORMALB); +Br.POSITION0, Br.POSITION1, Br.COMPONENTINDEX, Br.VARIANTOFFSET, Br.VARIANTSTROKE, Br.VARIANTEXTENSION, Br.NORMAL, Br.NORMALA, Br.NORMALB, Br.SIDENESS; +const IN = -1; +var yJe; +function U3e(t, e, i, r = jNi) { + const n = t.vertices.position, s = t.vertices.componentIndex, o = ex(r.anglePlanar), a = ex(r.angleSignificantEdge), l = Math.cos(a), c = Math.cos(o), h = z3e.edge, p = h.position0, y = h.position1, v = h.faceNormal0, x = h.faceNormal1, I = VNi(t), P = BNi(t), F = P.length / 4, k = e.allocate(F); + let V = 0; + const j = F, Y = i.allocate(j); + let X = 0, Q = 0, re = 0; + const he = _$t(0, F), fe = new Float32Array(F); + fe.forEach((J, ce, xe) => { + n.getVec(P[4 * ce + 0], p), n.getVec(P[4 * ce + 1], y), xe[ce] = AF(p, y); + }), he.sort((J, ce) => fe[ce] - fe[J]); + const be = new Array(), Se = new Array(); + for (let J = 0; J < F; J++) { + const ce = he[J], xe = fe[ce], Pe = P[4 * ce + 0], Oe = P[4 * ce + 1], Re = P[4 * ce + 2], Ge = P[4 * ce + 3], je = Ge === IN; + if (n.getVec(Pe, p), n.getVec(Oe, y), je) + Ol(v, I[3 * Re + 0], I[3 * Re + 1], I[3 * Re + 2]), d1(x, v), h.componentIndex = s.get(Pe), h.cosAngle = xx(v, x); + else { + if (Ol(v, I[3 * Re + 0], I[3 * Re + 1], I[3 * Re + 2]), Ol(x, I[3 * Ge + 0], I[3 * Ge + 1], I[3 * Ge + 2]), h.componentIndex = s.get(Pe), h.cosAngle = xx(v, x), kNi(h, c)) + continue; + h.cosAngle < -0.9999 && d1(x, v); + } + Q += xe, re++, je || NNi(h, l) ? (e.write(k, V++, h), be.push(xe)) : $Ni(h, o) && (i.write(Y, X++, h), Se.push(xe)); + } + const Me = new Float32Array(be.reverse()), ke = new Float32Array(Se.reverse()); + return { regular: { instancesData: e.trim(k, V), lodInfo: { lengths: Me } }, silhouette: { instancesData: i.trim(Y, X), lodInfo: { lengths: ke } }, averageEdgeLength: Q / re }; +} +function NNi(t, e) { + return t.cosAngle < e; +} +function kNi(t, e) { + return t.cosAngle > e; +} +function $Ni(t, e) { + const i = K4e(t.cosAngle), r = z3e.fwd, n = z3e.ortho; + return aht(r, t.position1, t.position0), i * (xx(AS(n, t.faceNormal0, t.faceNormal1), r) > 0 ? -1 : 1) > e; +} +function BNi(t) { + const e = t.faces.length / 3, i = t.faces, r = t.neighbors; + let n = 0; + for (let a = 0; a < e; a++) { + const l = r[3 * a + 0], c = r[3 * a + 1], h = r[3 * a + 2], p = i[3 * a + 0], y = i[3 * a + 1], v = i[3 * a + 2]; + n += l === IN || p < y ? 1 : 0, n += c === IN || y < v ? 1 : 0, n += h === IN || v < p ? 1 : 0; + } + const s = new Int32Array(4 * n); + let o = 0; + for (let a = 0; a < e; a++) { + const l = r[3 * a + 0], c = r[3 * a + 1], h = r[3 * a + 2], p = i[3 * a + 0], y = i[3 * a + 1], v = i[3 * a + 2]; + (l === IN || p < y) && (s[o++] = p, s[o++] = y, s[o++] = a, s[o++] = l), (c === IN || y < v) && (s[o++] = y, s[o++] = v, s[o++] = a, s[o++] = c), (h === IN || v < p) && (s[o++] = v, s[o++] = p, s[o++] = a, s[o++] = h); + } + return s; +} +function VNi(t) { + const e = t.faces.length / 3, i = t.vertices.position, r = t.faces, n = txe.v0, s = txe.v1, o = txe.v2, a = new Float32Array(3 * e); + for (let l = 0; l < e; l++) { + const c = r[3 * l + 0], h = r[3 * l + 1], p = r[3 * l + 2]; + i.getVec(c, n), i.getVec(h, s), i.getVec(p, o), Ec(s, s, n), Ec(o, o, n), AS(n, s, o), $0(n, n), a[3 * l + 0] = n[0], a[3 * l + 1] = n[1], a[3 * l + 2] = n[2]; + } + return a; +} +(function(t) { + t[t.SOLID = 0] = "SOLID", t[t.SKETCH = 1] = "SKETCH"; +})(yJe || (yJe = {})); +const z3e = { edge: { position0: sn(), position1: sn(), faceNormal0: sn(), faceNormal1: sn(), componentIndex: 0, cosAngle: 0 }, ortho: sn(), fwd: sn() }, txe = { v0: sn(), v1: sn(), v2: sn() }, jNi = { anglePlanar: 4, angleSignificantEdge: 35 }; +function H3e(t) { + if (Array.isArray(t)) { + if (t.length < Z6) + return t; + for (const e of t) + if (e >= 65536) + return new Uint32Array(t); + return new Uint16Array(t); + } + if (t.length < Z6) + return Array.from(t); + if (t.BYTES_PER_ELEMENT === Uint16Array.BYTES_PER_ELEMENT) + return t; + for (const e of t) + if (e >= 65536) + return t; + return new Uint16Array(t); +} +function tAt(t) { + const e = 3 * t; + return e <= Z6 ? new Array(e) : e <= 65536 ? new Uint16Array(e) : new Uint32Array(e); +} +let pD = (() => { + const t = new Uint32Array(131072); + for (let e = 0; e < t.length; ++e) + t[e] = e; + return t; +})(); +const iAt = [0], h7 = (() => { + const t = new Uint16Array(65536); + for (let e = 0; e < t.length; ++e) + t[e] = e; + return t; +})(); +function W3e(t) { + if (t === 1) + return iAt; + if (t < Z6) + return Array.from(new Uint16Array(h7.buffer, 0, t)); + if (t < h7.length) + return new Uint16Array(h7.buffer, 0, t); + if (t > pD.length) { + const e = Math.max(2 * pD.length, t); + pD = new Uint32Array(e); + for (let i = 0; i < pD.length; i++) + pD[i] = i; + } + return new Uint32Array(pD.buffer, 0, t); +} +function GNi(t) { + if (t === 1) + return iAt; + if (t < Z6) + return Array.from(new Uint16Array(h7.buffer, 0, t)); + if (t < h7.length) + return new Uint16Array(h7.slice(0, t)); + if (t > pD.length) { + const e = new Uint32Array(t); + for (let i = 0; i < e.length; i++) + e[i] = i; + return e; + } + return new Uint32Array(pD.slice(0, t)); +} +function q3e(t, e, i) { + const r = Array.isArray(t), n = r ? t.length / e : t.byteLength / (4 * e), s = r ? t : new Uint32Array(t, 0, n * e), o = i?.minReduction ?? 0, a = i?.originalIndices || null, l = a ? a.length : 0, c = i?.componentOffsets || null; + let h = 0; + if (c) + for (let X = 0; X < c.length - 1; X++) { + const Q = c[X + 1] - c[X]; + Q > h && (h = Q); + } + else + h = n; + const p = Math.floor(1.1 * h) + 1; + (tT == null || tT.length < 2 * p) && (tT = new Uint32Array(NCe(2 * p))); + for (let X = 0; X < 2 * p; X++) + tT[X] = 0; + let y = 0; + const v = !!c && !!a, x = v ? l : n; + let I = tAt(n / 3); + const P = new Uint32Array(l), F = 1.96; + let k = o !== 0 ? Math.ceil(4 * F * F / (o * o) * o * (1 - o)) : x, V = 1, j = c ? c[1] : x; + for (let X = 0; X < x; X++) { + if (X === k) { + const Se = 1 - y / X; + if (Se + F * Math.sqrt(Se * (1 - Se) / X) < o) + return null; + k *= 2; + } + if (X === j) { + for (let Se = 0; Se < 2 * p; Se++) + tT[Se] = 0; + if (a) + for (let Se = c[V - 1]; Se < c[V]; Se++) + P[Se] = I[a[Se]]; + j = c[++V]; + } + const Q = v ? a[X] : X, re = Q * e, he = HNi(s, re, e); + let fe = he % p, be = y; + for (; tT[2 * fe + 1] !== 0; ) { + if (tT[2 * fe] === he) { + const Se = tT[2 * fe + 1] - 1; + if (UNi(s, re, Se * e, e)) { + be = I[Se]; + break; + } + } + fe++, fe >= p && (fe -= p); + } + be === y && (tT[2 * fe] = he, tT[2 * fe + 1] = Q + 1, y++), I[Q] = be; + } + if (o !== 0 && 1 - y / n < o) + return null; + if (v) { + for (let X = c[V - 1]; X < P.length; X++) + P[X] = I[a[X]]; + I = H3e(P); + } + const Y = r ? new Array(y) : new Uint32Array(y * e); + y = 0; + for (let X = 0; X < x; X++) + I[X] === y && (zNi(s, (v ? a[X] : X) * e, Y, y * e, e), y++); + if (a && !v) { + const X = new Uint32Array(l); + for (let Q = 0; Q < X.length; Q++) + X[Q] = I[a[Q]]; + I = H3e(X); + } + return { buffer: Array.isArray(Y) ? Y : Y.buffer, indices: I, uniqueCount: y }; +} +function UNi(t, e, i, r) { + for (let n = 0; n < r; n++) + if (t[e + n] !== t[i + n]) + return !1; + return !0; +} +function zNi(t, e, i, r, n) { + for (let s = 0; s < n; s++) + i[r + s] = t[e + s]; +} +function HNi(t, e, i) { + let r = 0; + for (let n = 0; n < i; n++) + r = t[e + n] + r | 0, r = r + (r << 11) + (r >>> 2) | 0; + return r >>> 0; +} +let tT = null; +function vJe(t, e, i) { + const r = e / 3, n = new Uint32Array(i + 1), s = new Uint32Array(i + 1), o = (F, k) => { + F < k ? n[F + 1]++ : s[k + 1]++; + }; + for (let F = 0; F < r; F++) { + const k = t[3 * F], V = t[3 * F + 1], j = t[3 * F + 2]; + o(k, V), o(V, j), o(j, k); + } + let a = 0, l = 0; + for (let F = 0; F < i; F++) { + const k = n[F + 1], V = s[F + 1]; + n[F + 1] = a, s[F + 1] = l, a += k, l += V; + } + const c = new Uint32Array(6 * r), h = n[i], p = (F, k, V) => { + if (F < k) { + const j = n[F + 1]++; + c[2 * j] = k, c[2 * j + 1] = V; + } else { + const j = s[k + 1]++; + c[2 * h + 2 * j] = F, c[2 * h + 2 * j + 1] = V; + } + }; + for (let F = 0; F < r; F++) { + const k = t[3 * F], V = t[3 * F + 1], j = t[3 * F + 2]; + p(k, V, F), p(V, j, F), p(j, k, F); + } + const y = (F, k) => { + const V = 2 * F, j = k - F; + for (let Y = 1; Y < j; Y++) { + const X = c[V + 2 * Y], Q = c[V + 2 * Y + 1]; + let re = Y - 1; + for (; re >= 0 && c[V + 2 * re] > X; re--) + c[V + 2 * re + 2] = c[V + 2 * re], c[V + 2 * re + 3] = c[V + 2 * re + 1]; + c[V + 2 * re + 2] = X, c[V + 2 * re + 3] = Q; + } + }; + for (let F = 0; F < i; F++) + y(n[F], n[F + 1]), y(h + s[F], h + s[F + 1]); + const v = new Int32Array(3 * r), x = (F, k) => F === t[3 * k] ? 0 : F === t[3 * k + 1] ? 1 : F === t[3 * k + 2] ? 2 : -1, I = (F, k) => { + const V = x(F, k); + v[3 * k + V] = -1; + }, P = (F, k, V, j) => { + const Y = x(F, k); + v[3 * k + Y] = j; + const X = x(V, j); + v[3 * j + X] = k; + }; + for (let F = 0; F < i; F++) { + let k = n[F]; + const V = n[F + 1]; + let j = s[F]; + const Y = s[F + 1]; + for (; k < V && j < Y; ) { + const X = c[2 * k], Q = c[2 * h + 2 * j]; + X === Q ? (P(F, c[2 * k + 1], Q, c[2 * h + 2 * j + 1]), k++, j++) : X < Q ? (I(F, c[2 * k + 1]), k++) : (I(Q, c[2 * h + 2 * j + 1]), j++); + } + for (; k < V; ) + I(F, c[2 * k + 1]), k++; + for (; j < Y; ) + I(c[2 * h + 2 * j], c[2 * h + 2 * j + 1]), j++; + } + return v; +} +let rAt = class { + updateSettings(e) { + this.settings = e, this._edgeHashFunction = e.reducedPrecision ? qNi : WNi; + } + write(e, i, r) { + const n = this._edgeHashFunction(r); + woe.seed = n; + const s = woe.getIntRange(0, 255), o = woe.getIntRange(0, this.settings.variants - 1), a = 0.7, l = woe.getFloat(), c = 255 * (0.5 * YNi(-(1 - Math.min(l / a, 1)) + Math.max(0, l - a) / (1 - a), 1.2) + 0.5); + e.position0.setVec(i, r.position0), e.position1.setVec(i, r.position1), e.componentIndex.set(i, r.componentIndex), e.variantOffset.set(i, s), e.variantStroke.set(i, o), e.variantExtension.set(i, c); + } + trim(e, i) { + return e.slice(0, i); + } +}; +const d8e = new Float32Array(6), rfe = new Uint32Array(d8e.buffer), WD = new Uint32Array(1); +function WNi(t) { + const e = d8e; + e[0] = t.position0[0], e[1] = t.position0[1], e[2] = t.position0[2], e[3] = t.position1[0], e[4] = t.position1[1], e[5] = t.position1[2], WD[0] = 5381; + for (let i = 0; i < rfe.length; i++) + WD[0] = 31 * WD[0] + rfe[i]; + return WD[0]; +} +function qNi(t) { + const e = d8e; + e[0] = dB(t.position0[0]), e[1] = dB(t.position0[1]), e[2] = dB(t.position0[2]), e[3] = dB(t.position1[0]), e[4] = dB(t.position1[1]), e[5] = dB(t.position1[2]), WD[0] = 5381; + for (let i = 0; i < rfe.length; i++) + WD[0] = 31 * WD[0] + rfe[i]; + return WD[0]; +} +const _Je = 1e4; +function dB(t) { + return Math.round(t * _Je) / _Je; +} +function YNi(t, e) { + const i = t < 0 ? -1 : 1; + return Math.abs(t) ** e * i; +} +let Y3e = class { + constructor() { + this._commonWriter = new rAt(); + } + updateSettings(e) { + this._commonWriter.updateSettings(e); + } + allocate(e) { + return j3e.createBuffer(e); + } + write(e, i, r) { + this._commonWriter.write(e, i, r), Zc(boe, r.faceNormal0, r.faceNormal1), $0(boe, boe), e.normal.setVec(i, boe); + } + trim(e, i) { + return this._commonWriter.trim(e, i); + } +}; +Y3e.Layout = j3e, Y3e.glLayout = h8e(j3e, 1); +let X3e = class { + constructor() { + this._commonWriter = new rAt(); + } + updateSettings(e) { + this._commonWriter.updateSettings(e); + } + allocate(e) { + return G3e.createBuffer(e); + } + write(e, i, r) { + this._commonWriter.write(e, i, r), e.normalA.setVec(i, r.faceNormal0), e.normalB.setVec(i, r.faceNormal1); + } + trim(e, i) { + return this._commonWriter.trim(e, i); + } +}; +X3e.Layout = G3e, X3e.glLayout = h8e(G3e, 1); +const boe = sn(), woe = new VE(); +function XNi(t) { + const e = K3e(t.data, t.skipDeduplicate, t.indices, t.indicesLength); + return bJe.updateSettings(t.writerSettings), wJe.updateSettings(t.writerSettings), U3e(e, bJe, wJe); +} +function K3e(t, e, i, r) { + if (e) { + const o = vJe(i, r, t.count); + return new KNi(i, r, o, t); + } + const n = q3e(t.buffer, t.stride / 4, { originalIndices: i, originalIndicesLength: r }), s = vJe(n.indices, r, n.uniqueCount); + return { faces: n.indices, facesLength: n.indices.length, neighbors: s, vertices: QIt.createView(n.buffer) }; +} +let KNi = class { + constructor(e, i, r, n) { + this.faces = e, this.facesLength = i, this.neighbors = r, this.vertices = n; + } +}; +const bJe = new Y3e(), wJe = new X3e(), JNi = iH().vec3f(Br.POSITION0).vec3f(Br.POSITION1), nAt = iH().vec3f(Br.POSITION0).vec3f(Br.POSITION1).u16(Br.COMPONENTINDEX).u16(Br.U16PADDING, { glPadding: !0 }); +let ZNi = class { + async extract(e) { + const i = ixe(e), r = XNi(i), n = [i.data.buffer]; + return { result: QNi(r, n), transferList: n }; + } + async extractComponentsEdgeLocations(e) { + const i = ixe(e), r = K3e(i.data, i.skipDeduplicate, i.indices, i.indicesLength), n = U3e(r, rki, xJe), s = []; + return { result: tfe(n.regular.instancesData, s), transferList: s }; + } + async extractEdgeLocations(e) { + const i = ixe(e), r = K3e(i.data, i.skipDeduplicate, i.indices, i.indicesLength), n = U3e(r, iki, xJe), s = []; + return { result: tfe(n.regular.instancesData, s), transferList: s }; + } +}; +function ixe(t) { + return { data: QIt.createView(t.dataBuffer), indices: t.indicesType === "Uint32Array" ? new Uint32Array(t.indices) : t.indicesType === "Uint16Array" ? new Uint16Array(t.indices) : t.indices, indicesLength: t.indicesLength, writerSettings: t.writerSettings, skipDeduplicate: t.skipDeduplicate }; +} +function QNi(t, e) { + return e.push(t.regular.lodInfo.lengths.buffer), e.push(t.silhouette.lodInfo.lengths.buffer), { regular: { instancesData: tfe(t.regular.instancesData, e), lodInfo: { lengths: t.regular.lodInfo.lengths.buffer } }, silhouette: { instancesData: tfe(t.silhouette.instancesData, e), lodInfo: { lengths: t.silhouette.lodInfo.lengths.buffer } }, averageEdgeLength: t.averageEdgeLength }; +} +let eki = class { + allocate(e) { + return JNi.createBuffer(e); + } + trim(e, i) { + return e.slice(0, i); + } + write(e, i, r) { + e.position0.setVec(i, r.position0), e.position1.setVec(i, r.position1); + } +}, tki = class { + allocate(e) { + return nAt.createBuffer(e); + } + trim(e, i) { + return e.slice(0, i); + } + write(e, i, r) { + e.position0.setVec(i, r.position0), e.position1.setVec(i, r.position1), e.componentIndex.set(i, r.componentIndex); + } +}; +const iki = new eki(), rki = new tki(), xJe = { allocate: () => null, write: () => { +}, trim: () => null }, nki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: ZNi +}, Symbol.toStringTag, { value: "Module" })); +function Tm() { + return [1, 0, 0, 0, 1, 0, 0, 0, 1]; +} +function ski(t) { + return [t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8]]; +} +function sAt(t, e, i, r, n, s, o, a, l) { + return [t, e, i, r, n, s, o, a, l]; +} +function oAt(t, e) { + return new Float64Array(t, e, 9); +} +Object.freeze(Object.defineProperty({ __proto__: null, clone: ski, create: Tm, createView: oAt, fromValues: sAt }, Symbol.toStringTag, { value: "Module" })); +function Dv() { + return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; +} +function oee(t) { + return [t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]]; +} +function oki(t, e, i, r, n, s, o, a, l, c, h, p, y, v, x, I) { + return [t, e, i, r, n, s, o, a, l, c, h, p, y, v, x, I]; +} +function aAt(t, e) { + return new Float64Array(t, e, 16); +} +const YU = Dv(); +Object.freeze(Object.defineProperty({ __proto__: null, IDENTITY: YU, clone: oee, create: Dv, createView: aAt, fromValues: oki }, Symbol.toStringTag, { value: "Module" })); +const aki = new or(Cct), SJe = new or(F4e), CJe = new or(L4e); +new or(Tct); +function j4(t) { + return t && (e8(t) || Ea(t, SJe)) ? SJe : t && (t8(t) || Ea(t, CJe)) ? CJe : aki; +} +function Uv() { + return [0, 0, 0, 1]; +} +function lAt(t) { + return [t[0], t[1], t[2], t[3]]; +} +function lki(t, e, i, r) { + return [t, e, i, r]; +} +function uAt(t, e) { + return new Float64Array(t, e, 4); +} +const cAt = Uv(); +Object.freeze(Object.defineProperty({ __proto__: null, IDENTITY: cAt, clone: lAt, create: Uv, createView: uAt, fromValues: lki }, Symbol.toStringTag, { value: "Module" })); +function uki(t) { + return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t; +} +function n4(t, e, i) { + i *= 0.5; + const r = Math.sin(i); + return t[0] = r * e[0], t[1] = r * e[1], t[2] = r * e[2], t[3] = Math.cos(i), t; +} +function p8e(t, e) { + const i = 2 * Math.acos(e[3]), r = Math.sin(i / 2); + return r > x1() ? (t[0] = e[0] / r, t[1] = e[1] / r, t[2] = e[2] / r) : (t[0] = 1, t[1] = 0, t[2] = 0), i; +} +function X0e(t, e, i) { + const r = e[0], n = e[1], s = e[2], o = e[3], a = i[0], l = i[1], c = i[2], h = i[3]; + return t[0] = r * h + o * a + n * c - s * l, t[1] = n * h + o * l + s * a - r * c, t[2] = s * h + o * c + r * l - n * a, t[3] = o * h - r * a - n * l - s * c, t; +} +function cki(t, e, i) { + i *= 0.5; + const r = e[0], n = e[1], s = e[2], o = e[3], a = Math.sin(i), l = Math.cos(i); + return t[0] = r * l + o * a, t[1] = n * l + s * a, t[2] = s * l - n * a, t[3] = o * l - r * a, t; +} +function hki(t, e, i) { + i *= 0.5; + const r = e[0], n = e[1], s = e[2], o = e[3], a = Math.sin(i), l = Math.cos(i); + return t[0] = r * l - s * a, t[1] = n * l + o * a, t[2] = s * l + r * a, t[3] = o * l - n * a, t; +} +function dki(t, e, i) { + i *= 0.5; + const r = e[0], n = e[1], s = e[2], o = e[3], a = Math.sin(i), l = Math.cos(i); + return t[0] = r * l + n * a, t[1] = n * l - r * a, t[2] = s * l + o * a, t[3] = o * l - s * a, t; +} +function pki(t, e) { + const i = e[0], r = e[1], n = e[2]; + return t[0] = i, t[1] = r, t[2] = n, t[3] = Math.sqrt(Math.abs(1 - i * i - r * r - n * n)), t; +} +function Yue(t, e, i, r) { + const n = e[0], s = e[1], o = e[2], a = e[3]; + let l, c, h, p, y, v = i[0], x = i[1], I = i[2], P = i[3]; + return c = n * v + s * x + o * I + a * P, c < 0 && (c = -c, v = -v, x = -x, I = -I, P = -P), 1 - c > x1() ? (l = Math.acos(c), h = Math.sin(l), p = Math.sin((1 - r) * l) / h, y = Math.sin(r * l) / h) : (p = 1 - r, y = r), t[0] = p * n + y * v, t[1] = p * s + y * x, t[2] = p * o + y * I, t[3] = p * a + y * P, t; +} +function fki(t) { + const e = Nte, i = e(), r = e(), n = e(), s = Math.sqrt(1 - i), o = Math.sqrt(i); + return t[0] = s * Math.sin(2 * Math.PI * r), t[1] = s * Math.cos(2 * Math.PI * r), t[2] = o * Math.sin(2 * Math.PI * n), t[3] = o * Math.cos(2 * Math.PI * n), t; +} +function mki(t, e) { + const i = e[0], r = e[1], n = e[2], s = e[3], o = i * i + r * r + n * n + s * s, a = o ? 1 / o : 0; + return t[0] = -i * a, t[1] = -r * a, t[2] = -n * a, t[3] = s * a, t; +} +function f8e(t, e) { + return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = e[3], t; +} +function hAt(t, e) { + const i = e[0] + e[4] + e[8]; + let r; + if (i > 0) + r = Math.sqrt(i + 1), t[3] = 0.5 * r, r = 0.5 / r, t[0] = (e[5] - e[7]) * r, t[1] = (e[6] - e[2]) * r, t[2] = (e[1] - e[3]) * r; + else { + let n = 0; + e[4] > e[0] && (n = 1), e[8] > e[3 * n + n] && (n = 2); + const s = (n + 1) % 3, o = (n + 2) % 3; + r = Math.sqrt(e[3 * n + n] - e[3 * s + s] - e[3 * o + o] + 1), t[n] = 0.5 * r, r = 0.5 / r, t[3] = (e[3 * s + o] - e[3 * o + s]) * r, t[s] = (e[3 * s + n] + e[3 * n + s]) * r, t[o] = (e[3 * o + n] + e[3 * n + o]) * r; + } + return t; +} +function dAt(t, e, i, r) { + const n = 0.5 * Math.PI / 180; + e *= n, i *= n, r *= n; + const s = Math.sin(e), o = Math.cos(e), a = Math.sin(i), l = Math.cos(i), c = Math.sin(r), h = Math.cos(r); + return t[0] = s * l * h - o * a * c, t[1] = o * a * h + s * l * c, t[2] = o * l * c - s * a * h, t[3] = o * l * h + s * a * c, t; +} +function gki(t) { + return "quat(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")"; +} +const yki = W4e, vki = g0, _ki = cht, bki = X0e, wki = fht, xki = vht, Ski = X4e, pAt = q4e, Cki = pAt, fAt = Y4e, Tki = fAt, m8e = yht, mAt = _ht, Eki = bht; +function Iki(t, e, i) { + const r = xx(e, i); + return r < -0.999999 ? (AS(iT, Aki, e), uht(iT) < 1e-6 && AS(iT, Pki, e), $0(iT, iT), n4(t, iT, Math.PI), t) : r > 0.999999 ? (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t) : (AS(iT, e, i), t[0] = iT[0], t[1] = iT[1], t[2] = iT[2], t[3] = 1 + r, m8e(t, t)); +} +const iT = sn(), Aki = Na(1, 0, 0), Pki = Na(0, 1, 0); +function Oki(t, e, i, r, n, s) { + return Yue(TJe, e, n, s), Yue(EJe, i, r, s), Yue(t, TJe, EJe, 2 * s * (1 - s)), t; +} +const TJe = Uv(), EJe = Uv(); +function Rki(t, e, i, r) { + const n = Mki; + return n[0] = i[0], n[3] = i[1], n[6] = i[2], n[1] = r[0], n[4] = r[1], n[7] = r[2], n[2] = -e[0], n[5] = -e[1], n[8] = -e[2], m8e(t, hAt(t, n)); +} +const Mki = Tm(); +Object.freeze(Object.defineProperty({ __proto__: null, add: _ki, calculateW: pki, conjugate: f8e, copy: yki, dot: xki, equals: Eki, exactEquals: mAt, fromEuler: dAt, fromMat3: hAt, getAxisAngle: p8e, identity: uki, invert: mki, len: Cki, length: pAt, lerp: Ski, mul: bki, multiply: X0e, normalize: m8e, random: fki, rotateX: cki, rotateY: hki, rotateZ: dki, rotationTo: Iki, scale: wki, set: vki, setAxes: Rki, setAxisAngle: n4, slerp: Yue, sqlerp: Oki, sqrLen: Tki, squaredLength: fAt, str: gki }, Symbol.toStringTag, { value: "Module" })); +function bI(t = Fki) { + return [t[0], t[1], t[2], t[3]]; +} +function Xue(t, e, i = bI()) { + return d1(i, t), i[3] = e, i; +} +function J3e(t, e, i = bI()) { + return n4(xoe, t, nfe(t)), n4(IJe, e, nfe(e)), X0e(xoe, IJe, xoe), Dki(i, cge(p8e(i, xoe))); +} +function nfe(t) { + return ex(t[3]); +} +function Dki(t, e) { + return t[3] = e, t; +} +const Fki = [0, 0, 1, 0], xoe = Uv(), IJe = Uv(); +bI(); +const K0e = Ei.getLogger("esri.views.3d.support.buffer.math"); +function s4(t, e, i) { + if (t.count !== e.count) + return void K0e.error("source and destination buffers need to have the same number of elements"); + const r = t.count, n = i[0], s = i[1], o = i[2], a = i[4], l = i[5], c = i[6], h = i[8], p = i[9], y = i[10], v = i[12], x = i[13], I = i[14], P = t.typedBuffer, F = t.typedBufferStride, k = e.typedBuffer, V = e.typedBufferStride; + for (let j = 0; j < r; j++) { + const Y = j * F, X = j * V, Q = k[X], re = k[X + 1], he = k[X + 2]; + P[Y] = n * Q + a * re + h * he + v, P[Y + 1] = s * Q + l * re + p * he + x, P[Y + 2] = o * Q + c * re + y * he + I; + } +} +function T3(t, e, i) { + if (t.count !== e.count) + return void K0e.error("source and destination buffers need to have the same number of elements"); + const r = t.count, n = i[0], s = i[1], o = i[2], a = i[3], l = i[4], c = i[5], h = i[6], p = i[7], y = i[8], v = t.typedBuffer, x = t.typedBufferStride, I = e.typedBuffer, P = e.typedBufferStride; + for (let F = 0; F < r; F++) { + const k = F * x, V = F * P, j = I[V], Y = I[V + 1], X = I[V + 2]; + v[k] = n * j + a * Y + h * X, v[k + 1] = s * j + l * Y + p * X, v[k + 2] = o * j + c * Y + y * X; + } +} +function sfe(t, e, i) { + const r = Math.min(t.count, e.count), n = t.typedBuffer, s = t.typedBufferStride, o = e.typedBuffer, a = e.typedBufferStride; + for (let l = 0; l < r; l++) { + const c = l * s, h = l * a; + n[c] = i * o[h], n[c + 1] = i * o[h + 1], n[c + 2] = i * o[h + 2]; + } +} +function J0e(t, e) { + const i = Math.min(t.count, e.count), r = t.typedBuffer, n = t.typedBufferStride, s = e.typedBuffer, o = e.typedBufferStride; + for (let a = 0; a < i; a++) { + const l = a * n, c = a * o, h = s[c], p = s[c + 1], y = s[c + 2], v = h * h + p * p + y * y; + if (v > 0) { + const x = 1 / Math.sqrt(v); + r[l] = x * h, r[l + 1] = x * p, r[l + 2] = x * y; + } + } +} +function gAt(t, e, i) { + const r = Math.min(t.count, e.count), n = t.typedBuffer, s = t.typedBufferStride, o = e.typedBuffer, a = e.typedBufferStride; + for (let l = 0; l < r; l++) { + const c = l * s, h = l * a; + n[c] = o[h] >> i, n[c + 1] = o[h + 1] >> i, n[c + 2] = o[h + 2] >> i; + } +} +Object.freeze(Object.defineProperty({ __proto__: null, normalize: J0e, scale: sfe, shiftRight: gAt, transformMat3: T3, transformMat4: s4 }, Symbol.toStringTag, { value: "Module" })); +function Z0e(t, e, i) { + const r = t.typedBuffer, n = t.typedBufferStride, s = e.typedBuffer, o = e.typedBufferStride, a = i ? i.count : e.count; + let l = (i && i.dstIndex ? i.dstIndex : 0) * n, c = (i && i.srcIndex ? i.srcIndex : 0) * o; + for (let h = 0; h < a; ++h) + r[l] = s[c], r[l + 1] = s[c + 1], r[l + 2] = s[c + 2], l += n, c += o; +} +function yAt(t, e, i, r, n) { + const s = t.typedBuffer, o = t.typedBufferStride, a = n?.count ?? t.count; + let l = (n?.dstIndex ?? 0) * o; + for (let c = 0; c < a; ++c) + s[l] = e, s[l + 1] = i, s[l + 2] = r, l += o; +} +Object.freeze(Object.defineProperty({ __proto__: null, copy: Z0e, fill: yAt }, Symbol.toStringTag, { value: "Module" })); +var Z3e; +let VT = Z3e = class extends $i { + constructor(t) { + super(t), this.origin = sn(), this.translation = sn(), this.rotation = bI(), this.scale = Na(1, 1, 1), this.geographic = !0; + } + get localMatrix() { + const t = Dv(); + return n4(AJe, this.rotation, nfe(this.rotation)), rft(t, AJe, this.translation, this.scale), t; + } + get localMatrixInverse() { + return Zte(Dv(), this.localMatrix); + } + applyLocal(t, e) { + return GS(e, t, this.localMatrix); + } + applyLocalInverse(t, e) { + return GS(e, t, this.localMatrixInverse); + } + project(t, e) { + const i = new Float64Array(t.length), r = Cm.fromTypedArray(i), n = Cm.fromTypedArray(t); + if (this.geographic) { + const a = j4(e), l = Dv(); + return iU(e, this.origin, l, a), $ge(l, l, this.localMatrix), s4(r, n, l), g3(i, a, 0, i, e, 0, i.length / 3), i; + } + const { localMatrix: s, origin: o } = this; + oft(s, YU) ? Z0e(r, n) : s4(r, n, s); + for (let a = 0; a < i.length; a += 3) + i[a + 0] += o[0], i[a + 1] += o[1], i[a + 2] += o[2]; + return i; + } + getOriginPoint(t) { + const [e, i, r] = this.origin; + return new Xi({ x: e, y: i, z: r, spatialReference: t }); + } + equals(t) { + return _e(t) && this.geographic === t.geographic && Ihe(this.origin, t.origin) && sft(this.localMatrix, t.localMatrix); + } + clone() { + const t = { origin: ym(this.origin), translation: ym(this.translation), rotation: bI(this.rotation), scale: ym(this.scale), geographic: this.geographic }; + return new Z3e(t); + } +}; +E([N({ type: [Number], nonNullable: !0, json: { write: !0 } })], VT.prototype, "origin", void 0), E([N({ type: [Number], nonNullable: !0, json: { write: !0 } })], VT.prototype, "translation", void 0), E([N({ type: [Number], nonNullable: !0, json: { write: !0 } })], VT.prototype, "rotation", void 0), E([N({ type: [Number], nonNullable: !0, json: { write: !0 } })], VT.prototype, "scale", void 0), E([N({ type: Boolean, nonNullable: !0, json: { write: !0 } })], VT.prototype, "geographic", void 0), E([N()], VT.prototype, "localMatrix", null), E([N()], VT.prototype, "localMatrixInverse", null), VT = Z3e = E([dt("esri.geometry.support.MeshTransform")], VT); +const AJe = Uv(), XU = VT; +function S8(t, e) { + return t.isGeographic || t.isWebMercator && (e?.geographic ?? !0); +} +const Q0e = Ei.getLogger("esri.geometry.support.meshUtils.normalProjection"); +function eve(t, e, i, r, n) { + return ave(r) ? (ove(LO.TO_PCPF, yc.fromTypedArray(t), Cm.fromTypedArray(e), Cm.fromTypedArray(i), r, yc.fromTypedArray(n)), n) : (Q0e.error("Cannot convert spatial reference to PCPF"), n); +} +function tve(t, e, i, r, n) { + return ave(r) ? (ove(LO.FROM_PCPF, yc.fromTypedArray(t), Cm.fromTypedArray(e), Cm.fromTypedArray(i), r, yc.fromTypedArray(n)), n) : (Q0e.error("Cannot convert to spatial reference from PCPF"), n); +} +function ive(t, e, i) { + return g3(t, e, 0, i, j4(e), 0, t.length / 3), i; +} +function rve(t, e, i) { + return g3(t, j4(i), 0, e, i, 0, t.length / 3), e; +} +function Lki(t, e, i) { + if (ut(t)) + return e; + const r = Cm.fromTypedArray(t), n = Cm.fromTypedArray(e); + return s4(n, r, i), e; +} +function Nki(t, e, i) { + if (ut(t)) + return e; + JO(rm, i); + const r = yc.fromTypedArray(t), n = yc.fromTypedArray(e); + return T3(n, r, rm), HNe(rm) || J0e(n, n), e; +} +function kki(t, e, i) { + if (ut(t)) + return e; + JO(rm, i); + const r = yc.fromTypedArray(t, 4 * Float32Array.BYTES_PER_ELEMENT), n = yc.fromTypedArray(e, 4 * Float32Array.BYTES_PER_ELEMENT); + if (T3(n, r, rm), HNe(rm) || J0e(n, n), t !== e) + for (let s = 3; s < t.length; s += 4) + e[s] = t[s]; + return e; +} +function nve(t, e, i, r, n) { + if (!ave(r)) + return Q0e.error("Cannot convert spatial reference to PCPF"), n; + ove(LO.TO_PCPF, yc.fromTypedArray(t, 4 * Float32Array.BYTES_PER_ELEMENT), Cm.fromTypedArray(e), Cm.fromTypedArray(i), r, yc.fromTypedArray(n, 4 * Float32Array.BYTES_PER_ELEMENT)); + for (let s = 3; s < t.length; s += 4) + n[s] = t[s]; + return n; +} +function sve(t, e, i, r, n) { + if (!ave(r)) + return Q0e.error("Cannot convert to spatial reference from PCPF"), n; + ove(LO.FROM_PCPF, yc.fromTypedArray(t, 16), Cm.fromTypedArray(e), Cm.fromTypedArray(i), r, yc.fromTypedArray(n, 16)); + for (let s = 3; s < t.length; s += 4) + n[s] = t[s]; + return n; +} +function ove(t, e, i, r, n, s) { + if (!e) + return; + const o = i.count, a = j4(n); + if (vAt(n)) + for (let l = 0; l < o; l++) + r.getVec(l, Soe), e.getVec(l, rT), iU(a, Soe, Coe, a), xQ(rm, Coe), t === LO.FROM_PCPF && SQ(rm, rm), nI(rT, rT, rm), s.setVec(l, rT); + else + for (let l = 0; l < o; l++) { + r.getVec(l, Soe), e.getVec(l, rT), iU(a, Soe, Coe, a), xQ(rm, Coe); + const c = ECe(i.get(l, 1)); + let h = Math.cos(c); + t === LO.TO_PCPF && (h = 1 / h), rm[0] *= h, rm[1] *= h, rm[2] *= h, rm[3] *= h, rm[4] *= h, rm[5] *= h, t === LO.FROM_PCPF && SQ(rm, rm), nI(rT, rT, rm), $0(rT, rT), s.setVec(l, rT); + } + return s; +} +function ave(t) { + return vAt(t) || $ki(t); +} +function vAt(t) { + return t.isWGS84 || tBt(t) || e8(t) || t8(t); +} +function $ki(t) { + return t.isWebMercator; +} +var LO; +(function(t) { + t[t.TO_PCPF = 0] = "TO_PCPF", t[t.FROM_PCPF = 1] = "FROM_PCPF"; +})(LO || (LO = {})); +const Soe = sn(), rT = sn(), Coe = Dv(), rm = Tm(); +function g8e(t, e, i) { + return S8(e.spatialReference, i) ? jki(t, e, i) : Vki(t, e, i); +} +function _At(t, e, i) { + const { position: r, normal: n, tangent: s } = t; + if (ut(e)) + return { position: r, normal: n, tangent: s }; + const o = e.localMatrix; + return g8e({ position: Lki(r, new Float64Array(r.length), o), normal: _e(n) ? Nki(n, new Float32Array(n.length), o) : null, tangent: _e(s) ? kki(s, new Float32Array(s.length), o) : null }, e.getOriginPoint(i), { geographic: e.geographic }); +} +function bAt(t, e, i) { + if (i?.useTransform) { + const { position: r, normal: n, tangent: s } = t; + return { vertexAttributes: { position: r, normal: n, tangent: s }, transform: new XU({ origin: [e.x, e.y, e.z ?? 0], geographic: S8(e.spatialReference, i) }) }; + } + return { vertexAttributes: g8e(t, e, i), transform: null }; +} +function Q3e(t, e, i) { + return S8(e.spatialReference, i) ? Hki(t, e, i) : wAt(t, e, i); +} +function Bki(t, e, i, r) { + if (ut(e)) + return Q3e(t, i, r); + const n = _At(t, e, i.spatialReference); + return i.equals(e.getOriginPoint(i.spatialReference)) ? wAt(n, i, r) : Q3e(n, i, r); +} +function Vki(t, e, i) { + const r = new Float64Array(t.position.length), n = t.position, s = e.x, o = e.y, a = e.z || 0, { horizontal: l, vertical: c } = y8e(i ? i.unit : null, e.spatialReference); + for (let h = 0; h < n.length; h += 3) + r[h + 0] = n[h + 0] * l + s, r[h + 1] = n[h + 1] * l + o, r[h + 2] = n[h + 2] * c + a; + return { position: r, normal: t.normal, tangent: t.tangent }; +} +function jki(t, e, i) { + const r = e.spatialReference, n = xAt(e, i, eRe), s = new Float64Array(t.position.length), o = Gki(t.position, n, r, s), a = JO(SAt, n); + return { position: o, normal: Uki(o, s, t.normal, a, r), tangent: zki(o, s, t.tangent, a, r) }; +} +function Gki(t, e, i, r) { + s4(Cm.fromTypedArray(r), Cm.fromTypedArray(t), e); + const n = new Float64Array(t.length); + return rve(r, n, i); +} +function Uki(t, e, i, r, n) { + if (ut(i)) + return null; + const s = new Float32Array(i.length); + return T3(yc.fromTypedArray(s), yc.fromTypedArray(i), r), tve(s, t, e, n, s), s; +} +function zki(t, e, i, r, n) { + if (ut(i)) + return null; + const s = new Float32Array(i.length); + T3(yc.fromTypedArray(s, 4 * Float32Array.BYTES_PER_ELEMENT), yc.fromTypedArray(i, 4 * Float32Array.BYTES_PER_ELEMENT), r); + for (let o = 3; o < s.length; o += 4) + s[o] = i[o]; + return sve(s, t, e, n, s), s; +} +function wAt(t, e, i) { + const r = new Float64Array(t.position.length), n = t.position, s = e.x, o = e.y, a = e.z || 0, { horizontal: l, vertical: c } = y8e(i ? i.unit : null, e.spatialReference); + for (let h = 0; h < n.length; h += 3) + r[h + 0] = (n[h + 0] - s) / l, r[h + 1] = (n[h + 1] - o) / l, r[h + 2] = (n[h + 2] - a) / c; + return { position: r, normal: t.normal, tangent: t.tangent }; +} +function Hki(t, e, i) { + const r = e.spatialReference; + xAt(e, i, eRe); + const n = Zte(Xki, eRe), s = new Float64Array(t.position.length), o = Wki(t.position, r, n, s), a = JO(SAt, n); + return { position: o, normal: qki(t.normal, t.position, s, r, a), tangent: Yki(t.tangent, t.position, s, r, a) }; +} +function xAt(t, e, i) { + iU(t.spatialReference, [t.x, t.y, t.z || 0], i, j4(t.spatialReference)); + const { horizontal: r, vertical: n } = y8e(e ? e.unit : null, t.spatialReference); + return OLe(i, i, [r, r, n]), i; +} +function Wki(t, e, i, r) { + const n = ive(t, e, r), s = Cm.fromTypedArray(n), o = new Float64Array(n.length), a = Cm.fromTypedArray(o); + return s4(a, s, i), o; +} +function qki(t, e, i, r, n) { + if (ut(t)) + return null; + const s = eve(t, e, i, r, new Float32Array(t.length)), o = yc.fromTypedArray(s); + return T3(o, o, n), s; +} +function Yki(t, e, i, r, n) { + if (ut(t)) + return null; + const s = nve(t, e, i, r, new Float32Array(t.length)), o = yc.fromTypedArray(s, 4 * Float32Array.BYTES_PER_ELEMENT); + return T3(o, o, n), s; +} +function y8e(t, e) { + if (ut(t)) + return Kki; + const i = e.isGeographic ? 1 : th(e), r = e.isGeographic ? 1 : EF(e), n = bv(1, t, "meters"); + return { horizontal: n * i, vertical: n * r }; +} +const eRe = Dv(), Xki = Dv(), SAt = Tm(), Kki = { horizontal: 1, vertical: 1 }; +let Jki = class { + async createIndex(e, i) { + const r = new Array(); + if (!e.vertexAttributes || !e.vertexAttributes.position) + return new t3e(); + const n = this._createMeshData(e), s = _e(i) ? await i.invoke("createIndexThread", n, { transferList: r }) : this.createIndexThread(n).result; + return this._createPooledRBush().fromJSON(s); + } + createIndexThread(e) { + const i = new Float64Array(e.position), r = this._createPooledRBush(); + return e.components ? this._createIndexComponentsThread(r, i, e.components.map((n) => new Uint32Array(n))) : this._createIndexAllThread(r, i); + } + _createIndexAllThread(e, i) { + const r = new Array(i.length / 9); + let n = 0; + for (let s = 0; s < i.length; s += 9) + r[n++] = PJe(i, s + 0, s + 3, s + 6); + return e.load(r), { result: e.toJSON() }; + } + _createIndexComponentsThread(e, i, r) { + let n = 0; + for (const a of r) + n += a.length / 3; + const s = new Array(n); + let o = 0; + for (const a of r) + for (let l = 0; l < a.length; l += 3) + s[o++] = PJe(i, 3 * a[l + 0], 3 * a[l + 1], 3 * a[l + 2]); + return e.load(s), { result: e.toJSON() }; + } + _createMeshData(e) { + const i = (e.transform ? _At({ position: e.vertexAttributes.position, normal: null, tangent: null }, e.transform, e.spatialReference).position : e.vertexAttributes.position).buffer; + return !e.components || e.components.some((r) => !r.faces) ? { position: i } : { position: i, components: e.components.map((r) => r.faces) }; + } + _createPooledRBush() { + return new t3e(9, Vi("esri-csp-restrictions") ? (e) => e : [".minX", ".minY", ".maxX", ".maxY"]); + } +}; +function PJe(t, e, i, r) { + return { minX: Math.min(t[e + 0], t[i + 0], t[r + 0]), maxX: Math.max(t[e + 0], t[i + 0], t[r + 0]), minY: Math.min(t[e + 1], t[i + 1], t[r + 1]), maxY: Math.max(t[e + 1], t[i + 1], t[r + 1]), p0: [t[e + 0], t[e + 1], t[e + 2]], p1: [t[i + 0], t[i + 1], t[i + 2]], p2: [t[r + 0], t[r + 1], t[r + 2]] }; +} +const Zki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Jki +}, Symbol.toStringTag, { value: "Module" })); +function OJe(t = !1, e) { + if (t) { + const { elevationInfo: i, alignPointsInFeatures: r, spatialReference: n } = e; + return new t6i(i, r, n); + } + return new Qki(); +} +let Qki = class { + async alignCandidates(e, i) { + return e; + } + notifyElevationSourceChange() { + } +}; +const e6i = 1024; +let t6i = class { + constructor(e, i, r) { + this._elevationInfo = e, this._alignPointsInFeatures = i, this.spatialReference = r, this._alignmentsCache = new xz(e6i), this._cacheVersion = 0, this._metersPerVerticalUnit = EF(r); + } + async alignCandidates(e, i) { + const r = this._elevationInfo; + return _e(r) && r.mode === "absolute-height" && !r.featureExpressionInfo ? (this._alignAbsoluteElevationCandidates(e, r), e) : this._alignComputedElevationCandidates(e, i); + } + notifyElevationSourceChange() { + this._alignmentsCache.clear(), this._cacheVersion++; + } + _alignAbsoluteElevationCandidates(e, i) { + const { offset: r, unit: n } = i; + if (ut(r)) + return; + const s = r * (zWt(n ?? "meters") / this._metersPerVerticalUnit); + for (const o of e) + switch (o.type) { + case "edge": + o.start.z += s, o.end.z += s; + continue; + case "vertex": + o.target.z += s; + continue; + } + } + async _alignComputedElevationCandidates(e, i) { + const r = /* @__PURE__ */ new Map(); + for (const p of e) + II(r, p.objectId, r6i).push(p); + const [n, s, o] = this._prepareQuery(r), a = await this._alignPointsInFeatures(n, i); + if (hn(i), o !== this._cacheVersion) + return this._alignComputedElevationCandidates(e, i); + this._applyCacheAndResponse(n, a, s); + const { drapedObjectIds: l, failedObjectIds: c } = a, h = []; + for (const p of e) { + const { objectId: y } = p; + l.has(y) && p.type === "edge" && (p.draped = !0), c.has(y) || h.push(p); + } + return h; + } + _prepareQuery(e) { + const i = [], r = []; + for (const [n, s] of e) { + const o = []; + for (const a of s) + this._addToQueriesOrCachedResult(n, a.target, o, r), a.type === "edge" && (this._addToQueriesOrCachedResult(n, a.start, o, r), this._addToQueriesOrCachedResult(n, a.end, o, r)); + o.length !== 0 && i.push({ objectId: n, points: o }); + } + return [i, r, this._cacheVersion]; + } + _addToQueriesOrCachedResult(e, i, r, n) { + const s = RJe(e, i), o = this._alignmentsCache.get(s); + _e(o) ? n.push(new i6i(i, o)) : r.push(i); + } + _applyCacheAndResponse(e, { elevations: i, drapedObjectIds: r, failedObjectIds: n }, s) { + for (const l of s) + l.apply(); + let o = 0; + const a = this._alignmentsCache; + for (const { objectId: l, points: c } of e) { + if (n.has(l)) { + o += c.length; + continue; + } + const h = !r.has(l); + for (const p of c) { + const y = RJe(l, p), v = i[o++]; + p.z = v, h && a.put(y, v, 1); + } + } + } +}, i6i = class { + constructor(e, i) { + this.point = e, this.z = i; + } + apply() { + this.point.z = this.z; + } +}; +function RJe(t, { x: e, y: i, z: r }) { + return `${t}-${e}-${i}-${r ?? 0}}`; +} +function r6i() { + return []; +} +let n6i = class { + filter(e, i) { + return i; + } + notifyElevationSourceChange() { + } +}, s6i = class { + filter(e, i) { + const { point: r, distance: n } = e, { z: s } = r; + if (s == null || i.length === 0) + return i; + const o = c6i(n), a = this._updateCandidatesTo3D(i, r, o).filter(o6i); + return a.sort(h6i), a; + } + _updateCandidatesTo3D(e, i, r) { + for (const n of e) + switch (n.type) { + case "edge": + a6i(n, i, r); + continue; + case "vertex": + u6i(n, i, r); + continue; + } + return e; + } +}; +function o6i(t) { + return t.distance <= 1; +} +function MJe(t = !1) { + return t ? new s6i() : new n6i(); +} +function a6i(t, e, { x: i, y: r, z: n }) { + const { start: s, end: o, target: a } = t; + t.draped || l6i(a, e, s, o); + const l = (e.x - a.x) / i, c = (e.y - a.y) / r, h = (e.z - a.z) / n; + t.distance = Math.sqrt(l * l + c * c + h * h); +} +function l6i(t, e, i, r) { + const n = r.x - i.x, s = r.y - i.y, o = r.z - i.z, a = n * n + s * s + o * o, l = (e.x - i.x) * n + (e.y - i.y) * s + o * (e.z - i.z), c = Math.min(1, Math.max(0, l / a)), h = i.x + n * c, p = i.y + s * c, y = i.z + o * c; + t.x = h, t.y = p, t.z = y; +} +function u6i(t, e, { x: i, y: r, z: n }) { + const { target: s } = t, o = (e.x - s.x) / i, a = (e.y - s.y) / r, l = (e.z - s.z) / n, c = Math.sqrt(o * o + a * a + l * l); + t.distance = c; +} +function c6i(t) { + return typeof t == "number" ? { x: t, y: t, z: t } : t; +} +function h6i(t, e) { + return t.distance - e.distance; +} +function DJe(t = !1, e) { + return t ? new f6i(e) : new d6i(); +} +let d6i = class { + async fetch() { + return []; + } + notifySymbologyChange() { + } +}; +const p6i = 1024; +let f6i = class { + constructor(e) { + this._getSymbologyCandidates = e, this._candidatesCache = new xz(p6i), this._cacheVersion = 0; + } + async fetch(e, i) { + if (e.length === 0) + return []; + const r = [], n = [], s = this._candidatesCache; + for (const p of e) { + const y = FJe(p), v = s.get(y); + if (v) + for (const x of v) + n.push(fi(x)); + else + r.push(p), s.put(y, [], 1); + } + if (r.length === 0) + return n; + const o = this._cacheVersion, { candidates: a, sourceCandidateIndices: l } = await this._getSymbologyCandidates(r, i); + if (hn(i), o !== this._cacheVersion) + return this.fetch(e, i); + const c = [], { length: h } = a; + for (let p = 0; p < h; ++p) { + const y = a[p], v = FJe(r[l[p]]), x = s.get(v); + x.push(y), s.put(v, x, x.length), c.push(fi(y)); + } + return n.concat(c); + } + notifySymbologyChange() { + this._candidatesCache.clear(), this._cacheVersion++; + } +}; +function FJe(t) { + switch (t.type) { + case "vertex": { + const { objectId: e, target: i } = t, r = `${e}-vertex-${i.x}-${i.y}-${i.z ?? 0}`; + return ih(r).toString(); + } + case "edge": { + const { objectId: e, start: i, end: r } = t, n = `${e}-edge-${i.x}-${i.y}-${i.z ?? 0}-to-${r.x}-${r.y}-${r.z ?? 0}`; + return ih(n).toString(); + } + default: + return ""; + } +} +let Kue = class extends vn { + constructor() { + super(...arguments), this.updating = !1, this._pending = []; + } + push(e, i) { + this._pending.push({ promise: e, callback: i }), this._pending.length === 1 && this._process(); + } + _process() { + if (!this._pending.length) + return void (this.updating = !1); + this.updating = !0; + const e = this._pending[0]; + e.promise.then((i) => e.callback(i)).catch(() => { + }).then(() => { + this._pending.shift(), this._process(); + }); + } +}; +E([N()], Kue.prototype, "updating", void 0), Kue = E([dt("esri.core.AsyncSequence")], Kue); +let m6i = class { + constructor(e, i) { + this.data = e, this.resolution = i, this.state = { type: lu.CREATED }, this.alive = !0; + } + process(e) { + switch (this.state.type) { + case lu.CREATED: + return this.state = this._gotoFetchCount(this.state, e), this.state.task.promise.then(e.resume, e.resume); + case lu.FETCH_COUNT: + break; + case lu.FETCHED_COUNT: + return this.state = this._gotoFetchFeatures(this.state, e), this.state.task.promise.then(e.resume, e.resume); + case lu.FETCH_FEATURES: + break; + case lu.FETCHED_FEATURES: + this.state = this._goToDone(this.state, e); + case lu.DONE: + } + return null; + } + get debugInfo() { + return { data: this.data, featureCount: this._featureCount, state: this._stateToString }; + } + get _featureCount() { + switch (this.state.type) { + case lu.CREATED: + case lu.FETCH_COUNT: + return 0; + case lu.FETCHED_COUNT: + return this.state.featureCount; + case lu.FETCH_FEATURES: + return this.state.previous.featureCount; + case lu.FETCHED_FEATURES: + return this.state.features.length; + case lu.DONE: + return this.state.previous.features.length; + } + } + get _stateToString() { + switch (this.state.type) { + case lu.CREATED: + return "created"; + case lu.FETCH_COUNT: + return "fetch-count"; + case lu.FETCHED_COUNT: + return "fetched-count"; + case lu.FETCH_FEATURES: + return "fetch-features"; + case lu.FETCHED_FEATURES: + return "fetched-features"; + case lu.DONE: + return "done"; + } + } + _gotoFetchCount(e, i) { + return { type: lu.FETCH_COUNT, previous: e, task: iI(async (r) => { + const n = await Eje(i.fetchCount(this, r)); + this.state.type === lu.FETCH_COUNT && (this.state = this._gotoFetchedCount(this.state, n.ok ? n.value : 1 / 0)); + }) }; + } + _gotoFetchedCount(e, i) { + return { type: lu.FETCHED_COUNT, featureCount: i, previous: e }; + } + _gotoFetchFeatures(e, i) { + return { type: lu.FETCH_FEATURES, previous: e, task: iI(async (r) => { + const n = await Eje(i.fetchFeatures(this, e.featureCount, r)); + this.state.type === lu.FETCH_FEATURES && (this.state = this._gotoFetchedFeatures(this.state, n.ok ? n.value : [])); + }) }; + } + _gotoFetchedFeatures(e, i) { + return { type: lu.FETCHED_FEATURES, previous: e, features: i }; + } + _goToDone(e, i) { + return i.finish(this, e.features), { type: lu.DONE, previous: e }; + } + reset() { + const e = this.state; + switch (this.state = { type: lu.CREATED }, e.type) { + case lu.CREATED: + case lu.FETCHED_COUNT: + case lu.FETCHED_FEATURES: + case lu.DONE: + break; + case lu.FETCH_COUNT: + case lu.FETCH_FEATURES: + e.task.abort(); + } + } + intersects(e) { + return !(!ut(e) && this.data.extent) || (PF(e, LJe), bge(this.data.extent, LJe)); + } +}; +var lu; +(function(t) { + t[t.CREATED = 0] = "CREATED", t[t.FETCH_COUNT = 1] = "FETCH_COUNT", t[t.FETCHED_COUNT = 2] = "FETCHED_COUNT", t[t.FETCH_FEATURES = 3] = "FETCH_FEATURES", t[t.FETCHED_FEATURES = 4] = "FETCHED_FEATURES", t[t.DONE = 5] = "DONE"; +})(lu || (lu = {})); +const LJe = Eo(); +let wf = class extends aI { + get _minimumVerticesPerFeature() { + switch (this.store?.featureStore.geometryType) { + case "esriGeometryPoint": + case "esriGeometryMultipoint": + return 1; + case "esriGeometryPolygon": + return 4; + case "esriGeometryPolyline": + return 2; + } + } + set filter(e) { + const i = this._get("filter"), r = this._filterProperties(e); + JSON.stringify(i) !== JSON.stringify(r) && this._set("filter", r); + } + set customParameters(e) { + const i = this._get("customParameters"); + JSON.stringify(i) !== JSON.stringify(e) && this._set("customParameters", e); + } + get _configuration() { + return { filter: this.filter, customParameters: this.customParameters, tileInfo: this.tileInfo, tileSize: this.tileSize }; + } + set tileInfo(e) { + const i = this._get("tileInfo"); + i !== e && (_e(e) && _e(i) && JSON.stringify(e) === JSON.stringify(i) || (this._set("tileInfo", e), this.store.tileInfo = e)); + } + set tileSize(e) { + this._get("tileSize") !== e && this._set("tileSize", e); + } + get updating() { + return this.updatingExcludingEdits || this._pendingEdits.updating; + } + get updatingExcludingEdits() { + return this.updatingHandles.updating; + } + get hasZ() { + return this.store.featureStore.hasZ; + } + constructor(e) { + super(e), this.tilesOfInterest = [], this.availability = 0, this._pendingTiles = /* @__PURE__ */ new Map(), this._pendingEdits = new Kue(), this._pendingEditsAbortController = new AbortController(); + } + initialize() { + this._initializeFetchExtent(), this.updatingHandles.add(() => this._configuration, () => this.refresh()), this.updatingHandles.add(() => this.tilesOfInterest, (e, i) => { + Ete(e, i, ({ id: r }, { id: n }) => r === n) || this._process(); + }, Uu); + } + destroy() { + this._pendingTiles.forEach((e) => this._deletePendingTile(e)), this._pendingTiles.clear(), this.store.destroy(), this.tilesOfInterest.length = 0, this._pendingEditsAbortController.abort(), this._pendingEditsAbortController = null; + } + refresh() { + this.store.refresh(), this._pendingTiles.forEach((e) => this._deletePendingTile(e)), this._process(); + } + applyEdits(e) { + this._pendingEdits.push(e, async (i) => { + if (i.addedFeatures.length === 0 && i.updatedFeatures.length === 0 && i.deletedFeatures.length === 0) + return; + for (const [, n] of this._pendingTiles) + n.reset(); + const r = { ...i, deletedFeatures: i.deletedFeatures.map(({ objectId: n, globalId: s }) => n && n !== -1 ? n : this._lookupObjectIdByGlobalId(s)) }; + await this.updatingHandles.addPromise(this.store.processEdits(r, (n, s) => this._queryFeaturesById(n, s), this._pendingEditsAbortController.signal)), this._processPendingTiles(); + }); + } + _initializeFetchExtent() { + if (!this.capabilities.query.supportsExtent || !Tz(this.url)) + return; + const e = iI(async (i) => { + try { + const r = await e0t(this.url, new Os({ where: "1=1", outSpatialReference: this.spatialReference, cacheHint: !!this.capabilities.query.supportsCacheHint || void 0 }), { query: this._configuration.customParameters, signal: i }); + this.store.extent = br.fromJSON(r.data?.extent); + } catch (r) { + ja(r), Ei.getLogger(this.declaredClass).warn("Failed to fetch data extent", r); + } + }); + this.updatingHandles.addPromise(e.promise.then(() => this._process())), this.handles.add(c3(() => e.abort())); + } + get debugInfo() { + return { numberOfFeatures: this.store.featureStore.numFeatures, tilesOfInterest: this.tilesOfInterest, pendingTiles: Array.from(this._pendingTiles.values()).map((e) => e.debugInfo), storedTiles: this.store.debugInfo }; + } + _process() { + this._markTilesNotAlive(), this._createPendingTiles(), this._deletePendingTiles(), this._processPendingTiles(); + } + _markTilesNotAlive() { + for (const [, e] of this._pendingTiles) + e.alive = !1; + } + _createPendingTiles() { + const e = this._collectMissingTilesInfo(); + if (this._setAvailability(ut(e) ? 1 : e.coveredArea / e.fullArea), !ut(e)) + for (const { data: i, resolution: r } of e.missingTiles) { + const n = this._pendingTiles.get(i.id); + n ? (n.resolution = r, n.alive = !0) : this._createPendingTile(i, r); + } + } + _collectMissingTilesInfo() { + let e = null; + for (let i = this.tilesOfInterest.length - 1; i >= 0; i--) { + const r = this.tilesOfInterest[i], n = this.store.process(r, (s, o) => this._verifyTileComplexity(s, o)); + ut(e) ? e = n : e.prepend(n); + } + return e; + } + _deletePendingTiles() { + for (const [, e] of this._pendingTiles) + e.alive || this._deletePendingTile(e); + } + _processPendingTiles() { + const e = { fetchCount: (i, r) => this._fetchCount(i, r), fetchFeatures: (i, r, n) => this._fetchFeatures(i, r, n), finish: (i, r) => this._finishPendingTile(i, r), resume: () => this._processPendingTiles() }; + if (this._ensureFetchAllCounts(e)) + for (const [, i] of this._pendingTiles) + this._verifyTileComplexity(this.store.getFeatureCount(i.data), i.resolution) && this.updatingHandles.addPromise(i.process(e)); + } + _verifyTileComplexity(e, i) { + return this._verifyVertexComplexity(e) && this._verifyFeatureDensity(e, i); + } + _verifyVertexComplexity(e) { + return e * this._minimumVerticesPerFeature < y6i; + } + _verifyFeatureDensity(e, i) { + if (ut(this.tileInfo)) + return !1; + const r = this.tileSize * i; + return e * (v6i / (r * r)) < _6i; + } + _ensureFetchAllCounts(e) { + let i = !0; + for (const [, r] of this._pendingTiles) + r.state.type < lu.FETCHED_COUNT && this.updatingHandles.addPromise(r.process(e)), r.state.type <= lu.FETCH_COUNT && (i = !1); + return i; + } + _finishPendingTile(e, i) { + this.store.add(e.data, i), this._deletePendingTile(e), this._updateAvailability(); + } + _updateAvailability() { + const e = this._collectMissingTilesInfo(); + this._setAvailability(ut(e) ? 1 : e.coveredArea / e.fullArea); + } + _setAvailability(e) { + this._set("availability", e); + } + _createPendingTile(e, i) { + const r = new m6i(e, i); + return this._pendingTiles.set(e.id, r), r; + } + _deletePendingTile(e) { + e.reset(), this._pendingTiles.delete(e.data.id); + } + async _fetchCount(e, i) { + return this.store.fetchCount(e.data, this.url, this._createCountQuery(e), { query: this.customParameters, timeout: rxe, signal: i }); + } + async _fetchFeatures(e, i, r) { + let n = 0; + const s = []; + let o = 0, a = i; + for (; ; ) { + const l = this._createFeaturesQuery(e), c = this._setPagingParameters(l, n, a), { features: h, exceededTransferLimit: p } = await this._queryFeatures(l, r); + c && (n += l.num), o += h.length; + for (const y of h) + s.push(y); + if (a = i - o, !c || !p || a <= 0) + return s; + } + } + _filterProperties(e) { + return ut(e) ? { where: "1=1", gdbVersion: void 0, timeExtent: void 0 } : { where: e.where || "1=1", timeExtent: e.timeExtent, gdbVersion: e.gdbVersion }; + } + _lookupObjectIdByGlobalId(e) { + const i = this.globalIdField, r = this.objectIdField; + if (ut(i)) + throw new Error("Expected globalIdField to be defined"); + let n = null; + if (this.store.featureStore.forEach((s) => { + e === s.attributes[i] && (n = s.objectId ?? s.attributes[r]); + }), ut(n)) + throw new Error(`Expected to find a feature with globalId ${e}`); + return n; + } + _queryFeaturesById(e, i) { + const r = this._createFeaturesQuery(); + return r.objectIds = e, this._queryFeatures(r, i); + } + _queryFeatures(e, i) { + return this.capabilities.query.supportsFormatPBF ? this._queryFeaturesPBF(e, i) : this._queryFeaturesJSON(e, i); + } + async _queryFeaturesPBF(e, i) { + const { sourceSpatialReference: r } = this, { data: n } = await $5e(this.url, e, new Xyt({ sourceSpatialReference: r }), { query: this._configuration.customParameters, timeout: rxe, signal: i }); + return dti(n); + } + async _queryFeaturesJSON(e, i) { + const { sourceSpatialReference: r } = this, { data: n } = await oU(this.url, e, r, { query: this._configuration.customParameters, timeout: rxe, signal: i }); + return X5e(n, this.objectIdField); + } + _createCountQuery(e) { + const i = this._createBaseQuery(e); + return this.capabilities.query.supportsCacheHint && (i.cacheHint = !0), i; + } + _createFeaturesQuery(e = null) { + const i = this._createBaseQuery(e); + return i.outFields = this.globalIdField ? [this.globalIdField, this.objectIdField] : [this.objectIdField], i.returnGeometry = !0, _e(e) && (this.capabilities.query.supportsResultType ? i.resultType = "tile" : this.capabilities.query.supportsCacheHint && (i.cacheHint = !0)), i; + } + _createBaseQuery(e) { + const i = new Os({ returnZ: this.hasZ, returnM: !1, geometry: _e(this.tileInfo) && _e(e) ? a$(e.data.extent, this.tileInfo.spatialReference) : void 0 }), r = this._configuration.filter; + return _e(r) && (i.where = r.where, i.gdbVersion = r.gdbVersion, i.timeExtent = r.timeExtent), i.outSpatialReference = this.spatialReference, i; + } + _setPagingParameters(e, i, r) { + if (!this.capabilities.query.supportsPagination) + return !1; + const { supportsMaxRecordCountFactor: n, supportsCacheHint: s, tileMaxRecordCount: o, maxRecordCount: a, supportsResultType: l } = this.capabilities.query, c = n ? Os.MAX_MAX_RECORD_COUNT_FACTOR : 1, h = c * ((l || s) && o ? o : a || g6i); + return e.start = i, n ? (e.maxRecordCountFactor = Math.min(c, Math.ceil(r / h)), e.num = Math.min(r, e.maxRecordCountFactor * h)) : e.num = Math.min(r, h), !0; + } +}; +E([N({ constructOnly: !0 })], wf.prototype, "url", void 0), E([N({ constructOnly: !0 })], wf.prototype, "objectIdField", void 0), E([N({ constructOnly: !0 })], wf.prototype, "globalIdField", void 0), E([N({ constructOnly: !0 })], wf.prototype, "capabilities", void 0), E([N({ constructOnly: !0 })], wf.prototype, "sourceSpatialReference", void 0), E([N({ constructOnly: !0 })], wf.prototype, "spatialReference", void 0), E([N({ constructOnly: !0 })], wf.prototype, "store", void 0), E([N({ readOnly: !0 })], wf.prototype, "_minimumVerticesPerFeature", null), E([N()], wf.prototype, "filter", null), E([N()], wf.prototype, "customParameters", null), E([N({ readOnly: !0 })], wf.prototype, "_configuration", null), E([N()], wf.prototype, "tileInfo", null), E([N()], wf.prototype, "tileSize", null), E([N()], wf.prototype, "tilesOfInterest", void 0), E([N({ readOnly: !0 })], wf.prototype, "updating", null), E([N({ readOnly: !0 })], wf.prototype, "updatingExcludingEdits", null), E([N({ readOnly: !0 })], wf.prototype, "availability", void 0), E([N()], wf.prototype, "hasZ", null), wf = E([dt("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")], wf); +const g6i = 2e3, rxe = 6e5, y6i = 1e6, v6i = 25, _6i = 1; +let b6i = class { + constructor() { + this._store = /* @__PURE__ */ new Map(), this._byteSize = 0; + } + set(e, i) { + this.delete(e), this._store.set(e, i), this._byteSize += i.byteSize; + } + delete(e) { + const i = this._store.get(e); + return !!this._store.delete(e) && (i != null && (this._byteSize -= i.byteSize), !0); + } + get(e) { + return this._used(e), this._store.get(e); + } + has(e) { + return this._used(e), this._store.has(e); + } + clear() { + this._store.clear(); + } + applyByteSizeLimit(e, i) { + for (const [r, n] of this._store) { + if (this._byteSize <= e) + break; + this.delete(r), i(n); + } + } + values() { + return this._store.values(); + } + [Symbol.iterator]() { + return this._store[Symbol.iterator](); + } + _used(e) { + const i = this._store.get(e); + i && (this._store.delete(e), this._store.set(e, i)); + } +}, AN = class extends vn { + constructor(e) { + super(e), this.tileInfo = null, this.extent = null, this.maximumByteSize = 10 * g$.MEGABYTES, this._tileBounds = new W$e(), this._tiles = new b6i(), this._refCounts = /* @__PURE__ */ new Map(), this._tileFeatureCounts = /* @__PURE__ */ new Map(), this._tmpBoundingRect = Eo(); + } + add(e, i) { + const r = []; + for (const n of i) + this._referenceFeature(n.objectId) === fD.ADDED && r.push(n); + this._addTileStorage(e, new Set(i.map((n) => n.objectId)), w6i(i)), this.featureStore.addMany(r), this._tiles.applyByteSizeLimit(this.maximumByteSize, (n) => this._removeTileStorage(n)); + } + destroy() { + this.clear(), this._tileFeatureCounts.clear(); + } + clear() { + this.featureStore.clear(), this._tileBounds.clear(), this._tiles.clear(), this._refCounts.clear(); + } + refresh() { + this.clear(), this._tileFeatureCounts.clear(); + } + processEdits(e, i, r) { + return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)), this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures), i, r); + } + _addTileStorage(e, i, r) { + const n = e.id; + this._tiles.set(n, new C6i(e, i, r)), this._tileBounds.set(n, e.extent), this._tileFeatureCounts.set(n, i.size); + } + _remove({ id: e }) { + const i = this._tiles.get(e); + i && this._removeTileStorage(i); + } + _removeTileStorage(e) { + const i = []; + for (const n of e.objectIds) + this._unreferenceFeature(n) === fD.REMOVED && i.push(n); + this.featureStore.removeManyById(i); + const r = e.data.id; + this._tiles.delete(r), this._tileBounds.delete(r); + } + _processEditsDelete(e) { + this.featureStore.removeManyById(e); + for (const [, i] of this._tiles) { + for (const r of e) + i.objectIds.delete(r); + this._tileFeatureCounts.set(i.data.id, i.objectIds.size); + } + for (const i of e) + this._refCounts.delete(i); + } + async _processEditsRefetch(e, i, r) { + const n = (await i(e, r)).features, { hasZ: s, hasM: o } = this.featureStore; + for (const a of n) { + const l = aye(this._tmpBoundingRect, a.geometry, s, o); + ut(l) || this._tileBounds.forEachInBounds(l, (c) => { + const h = this._tiles.get(c); + this.featureStore.add(a); + const p = a.objectId; + h.objectIds.has(p) || (h.objectIds.add(p), this._referenceFeature(p), this._tileFeatureCounts.set(h.data.id, h.objectIds.size)); + }); + } + } + process(e, i = () => !0) { + if (ut(this.tileInfo) || !e.extent || _e(this.extent) && !bge(PF(this.extent, this._tmpBoundingRect), e.extent)) + return new tRe(e); + if (this._tiles.has(e.id)) + return new tRe(e); + const r = this._createTileTree(e, this.tileInfo); + return this._simplify(r, i, null, 0, 1), this._collectMissingTiles(e, r, this.tileInfo); + } + get debugInfo() { + return Array.from(this._tiles.values()).map(({ data: e }) => ({ data: e, featureCount: this._tileFeatureCounts.get(e.id) || 0 })); + } + getFeatureCount(e) { + return this._tileFeatureCounts.get(e.id) ?? 0; + } + async fetchCount(e, i, r, n) { + const s = this._tileFeatureCounts.get(e.id); + if (s != null) + return s; + const o = await Qyt(i, r, n); + return this._tileFeatureCounts.set(e.id, o.data.count), o.data.count; + } + _createTileTree(e, i) { + const r = new NJe(e.level, e.row, e.col); + return i.updateTileInfo(r, Wl.ExtrapolateOptions.POWER_OF_TWO), this._tileBounds.forEachInBounds(e.extent, (n) => { + const s = this._tiles.get(n)?.data; + s && this._tilesAreRelated(e, s) && this._populateChildren(r, s, i, this._tileFeatureCounts.get(s.id) || 0); + }), r; + } + _tilesAreRelated(e, i) { + if (!e || !i) + return !1; + if (e.level === i.level) + return e.row === i.row && e.col === i.col; + const r = e.level < i.level, n = r ? e : i, s = r ? i : e, o = 1 << s.level - n.level; + return Math.floor(s.row / o) === n.row && Math.floor(s.col / o) === n.col; + } + _populateChildren(e, i, r, n) { + const s = i.level - e.level - 1; + if (s < 0) + return void (e.isLeaf = !0); + const o = i.row >> s, a = i.col >> s, l = e.row << 1, c = a - (e.col << 1) + (o - l << 1), h = e.children[c]; + if (_e(h)) + this._populateChildren(h, i, r, n); + else { + const p = new NJe(e.level + 1, o, a); + r.updateTileInfo(p, Wl.ExtrapolateOptions.POWER_OF_TWO), e.children[c] = p, this._populateChildren(p, i, r, n); + } + } + _simplify(e, i, r, n, s) { + const o = s * s; + if (e.isLeaf) + return i(this.getFeatureCount(e), s) ? 0 : (this._remove(e), _e(r) && (r.children[n] = null), o); + const a = s / 2, l = a * a; + let c = 0; + for (let h = 0; h < e.children.length; h++) { + const p = e.children[h]; + c += _e(p) ? this._simplify(p, i, e, h, a) : l; + } + return c === 0 ? this._mergeChildren(e) : 1 - c / o < E6i && (this._purge(e), _e(r) && (r.children[n] = null), c = o), c; + } + _mergeChildren(e) { + const i = /* @__PURE__ */ new Set(); + let r = 0; + this._forEachLeaf(e, (n) => { + const s = this._tiles.get(n.id); + if (s) { + r += s.byteSize; + for (const o of s.objectIds) + i.has(o) || (i.add(o), this._referenceFeature(o)); + this._remove(n); + } + }), this._addTileStorage(e, i, r), e.isLeaf = !0, e.children[0] = e.children[1] = e.children[2] = e.children[3] = null, this._tileFeatureCounts.set(e.id, i.size); + } + _forEachLeaf(e, i) { + for (const r of e.children) + ut(r) || (r.isLeaf ? i(r) : this._forEachLeaf(r, i)); + } + _purge(e) { + if (!ut(e)) + if (e.isLeaf) + this._remove(e); + else + for (let i = 0; i < e.children.length; i++) { + const r = e.children[i]; + this._purge(r), e.children[i] = null; + } + } + _collectMissingTiles(e, i, r) { + const n = new T6i(r, e, this.extent); + return this._collectMissingTilesRecurse(i, n, 1), n.info; + } + _collectMissingTilesRecurse(e, i, r) { + if (e.isLeaf) + return; + if (!e.hasChildren) + return void i.addMissing(e.level, e.row, e.col, r); + const n = r / 2; + for (let s = 0; s < e.children.length; s++) { + const o = e.children[s]; + ut(o) ? i.addMissing(e.level + 1, (e.row << 1) + ((2 & s) >> 1), (e.col << 1) + (1 & s), n) : this._collectMissingTilesRecurse(o, i, n); + } + } + _referenceFeature(e) { + const i = (this._refCounts.get(e) || 0) + 1; + return this._refCounts.set(e, i), i === 1 ? fD.ADDED : fD.UNCHANGED; + } + _unreferenceFeature(e) { + const i = (this._refCounts.get(e) || 0) - 1; + return i === 0 ? (this._refCounts.delete(e), fD.REMOVED) : (i > 0 && this._refCounts.set(e, i), fD.UNCHANGED); + } + get test() { + return { tiles: Array.from(this._tiles.values()).map((e) => `${e.data.id}:[${Array.from(e.objectIds)}]`), featureReferences: Array.from(this._refCounts.keys()).map((e) => `${e}:${this._refCounts.get(e)}`) }; + } +}; +function w6i(t) { + return t.reduce((e, i) => e + x6i(i), 0); +} +function x6i(t) { + return 32 + S6i(t.geometry) + oii(t.attributes); +} +function S6i(t) { + if (ut(t)) + return 0; + const e = rze(t.lengths, 4); + return 32 + rze(t.coords, 8) + e; +} +E([N({ constructOnly: !0 })], AN.prototype, "featureStore", void 0), E([N()], AN.prototype, "tileInfo", void 0), E([N()], AN.prototype, "extent", void 0), E([N()], AN.prototype, "maximumByteSize", void 0), AN = E([dt("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")], AN); +let C6i = class { + constructor(e, i, r) { + this.data = e, this.objectIds = i, this.byteSize = r; + } +}, NJe = class { + constructor(e, i, r) { + this.level = e, this.row = i, this.col = r, this.isLeaf = !1, this.extent = null, this.children = [null, null, null, null]; + } + get hasChildren() { + return !this.isLeaf && (_e(this.children[0]) || _e(this.children[1]) || _e(this.children[2]) || _e(this.children[3])); + } +}, tRe = class { + constructor(e, i = []) { + this.missingTiles = i, this.fullArea = 0, this.coveredArea = 0, this.fullArea = gdt(e.extent), this.coveredArea = this.fullArea; + } + prepend(e) { + this.missingTiles = e.missingTiles.concat(this.missingTiles), this.coveredArea += e.coveredArea, this.fullArea += e.fullArea; + } +}, T6i = class { + constructor(e, i, r) { + this._tileInfo = e, this._extent = null, this.info = new tRe(i), _e(r) && (this._extent = PF(r)); + } + addMissing(e, i, r, n) { + const s = new Bz(null, e, i, r); + this._tileInfo.updateTileInfo(s, Wl.ExtrapolateOptions.POWER_OF_TWO), ut(s.extent) || _e(this._extent) && !bge(this._extent, s.extent) || (this.info.missingTiles.push({ data: s, resolution: n }), this.info.coveredArea -= gdt(s.extent)); + } +}; +const E6i = 0.18751; +var fD; +(function(t) { + t[t.ADDED = 0] = "ADDED", t[t.REMOVED = 1] = "REMOVED", t[t.UNCHANGED = 2] = "UNCHANGED"; +})(fD || (fD = {})); +let $V = class extends Bd.EventedAccessor { + constructor() { + super(...arguments), this._isInitializing = !0, this.remoteClient = null, this._whenSetup = jS(), this._elevationAligner = OJe(), this._elevationFilter = MJe(), this._symbologyCandidatesFetcher = DJe(), this._handles = new Lf(), this._updatingHandles = new oF(), this._editsUpdatingHandles = new oF(), this._pendingApplyEdits = /* @__PURE__ */ new Map(), this._alignPointsInFeatures = async (e, i) => { + const r = { points: e }, n = await this.remoteClient.invoke("alignElevation", r, { signal: i }); + return hn(i), n; + }, this._getSymbologyCandidates = async (e, i) => { + const r = { candidates: e, spatialReference: this._spatialReference.toJSON() }, n = await this.remoteClient.invoke("getSymbologyCandidates", r, { signal: i }); + return hn(i), n; + }; + } + get updating() { + return this.updatingExcludingEdits || this._editsUpdatingHandles.updating || this._featureFetcher.updating; + } + get updatingExcludingEdits() { + return this._featureFetcher.updatingExcludingEdits || this._isInitializing || this._updatingHandles.updating; + } + destroy() { + this._featureFetcher?.destroy(), this._queryEngine?.destroy(), this._featureStore?.clear(), this._handles?.destroy(); + } + async setup(e) { + if (this.destroyed) + return { result: {} }; + const { geometryType: i, objectIdField: r, timeInfo: n, fields: s } = e.serviceInfo, { hasZ: o } = e, a = or.fromJSON(e.spatialReference); + this._spatialReference = a, this._featureStore = new zie({ ...e.serviceInfo, hasZ: o, hasM: !1 }), this._queryEngine = new B$({ spatialReference: e.spatialReference, featureStore: this._featureStore, geometryType: i, fields: s, hasZ: o, hasM: !1, objectIdField: r, timeInfo: n }), this._featureFetcher = new wf({ store: new AN({ featureStore: this._featureStore }), url: e.serviceInfo.url, objectIdField: e.serviceInfo.objectIdField, globalIdField: e.serviceInfo.globalIdField, capabilities: e.serviceInfo.capabilities, spatialReference: a, sourceSpatialReference: or.fromJSON(e.serviceInfo.spatialReference) }); + const l = e.configuration.viewType === "3d"; + return this._elevationAligner = OJe(l, { elevationInfo: _e(e.elevationInfo) ? u8.fromJSON(e.elevationInfo) : null, alignPointsInFeatures: this._alignPointsInFeatures, spatialReference: a }), this._elevationFilter = MJe(l), this._handles.add([Qi(() => this._featureFetcher.availability, (c) => this.emit("notify-availability", { availability: c }), Uu), Qi(() => this.updating, () => this._notifyUpdating())]), this._whenSetup.resolve(), this._isInitializing = !1, this.configure(e.configuration); + } + async configure(e) { + return await this._updatingHandles.addPromise(this._whenSetup.promise), this._updateFeatureFetcherConfiguration(e), { result: {} }; + } + async fetchCandidates(e, i) { + await this._whenSetup.promise, hn(i); + const r = A6i(e), n = _e(i) ? i.signal : null, s = await this._queryEngine.executeQueryForSnapping(r, n); + hn(n); + const o = await this._elevationAligner.alignCandidates(s.candidates, n); + hn(n); + const a = await this._symbologyCandidatesFetcher.fetch(o, n); + hn(n); + const l = a.length === 0 ? o : o.concat(a); + return { result: { candidates: this._elevationFilter.filter(r, l) } }; + } + async updateTiles(e, i) { + return await this._updatingHandles.addPromise(this._whenSetup.promise), hn(i), this._featureFetcher.tileSize = e.tileSize, this._featureFetcher.tilesOfInterest = e.tiles, this._featureFetcher.tileInfo = _e(e.tileInfo) ? Wl.fromJSON(e.tileInfo) : null, GR; + } + async refresh(e, i) { + return await this._updatingHandles.addPromise(this._whenSetup.promise), hn(i), this._featureFetcher.refresh(), GR; + } + async whenNotUpdating(e, i) { + return await this._updatingHandles.addPromise(this._whenSetup.promise), hn(i), await Tb(() => !this.updatingExcludingEdits, i), hn(i), GR; + } + async getDebugInfo(e, i) { + return hn(i), { result: this._featureFetcher.debugInfo }; + } + async beginApplyEdits(e, i) { + this._updatingHandles.addPromise(this._whenSetup.promise), hn(i); + const r = jS(); + return this._pendingApplyEdits.set(e.id, r), this._featureFetcher.applyEdits(r.promise), this._editsUpdatingHandles.addPromise(r.promise), GR; + } + async endApplyEdits(e, i) { + const r = this._pendingApplyEdits.get(e.id); + return r && r.resolve(e.edits), hn(i), GR; + } + async notifyElevationSourceChange(e, i) { + return this._elevationAligner.notifyElevationSourceChange(), GR; + } + async notifySymbologyChange(e, i) { + return this._symbologyCandidatesFetcher.notifySymbologyChange(), GR; + } + async setSymbologySnappingSupported(e) { + return this._symbologyCandidatesFetcher = DJe(e, this._getSymbologyCandidates), GR; + } + _updateFeatureFetcherConfiguration(e) { + this._featureFetcher.filter = _e(e.filter) ? Os.fromJSON(e.filter) : null, this._featureFetcher.customParameters = e.customParameters; + } + _notifyUpdating() { + this.emit("notify-updating", { updating: this.updating }); + } +}; +E([N({ readOnly: !0 })], $V.prototype, "updating", null), E([N({ readOnly: !0 })], $V.prototype, "updatingExcludingEdits", null), E([N()], $V.prototype, "_isInitializing", void 0), $V = E([dt("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")], $V); +const I6i = $V; +function A6i(t) { + return { point: t.point, mode: t.mode, distance: t.distance, types: t.types, query: _e(t.filter) ? t.filter : { where: "1=1" } }; +} +const GR = { result: {} }, P6i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: I6i +}, Symbol.toStringTag, { value: "Module" })), O6i = { LineString: "esriGeometryPolyline", MultiLineString: "esriGeometryPolyline", MultiPoint: "esriGeometryMultipoint", Point: "esriGeometryPoint", Polygon: "esriGeometryPolygon", MultiPolygon: "esriGeometryPolygon" }; +function ofe(t) { + return O6i[t]; +} +function* CAt(t) { + switch (t.type) { + case "Feature": + yield t; + break; + case "FeatureCollection": + for (const e of t.features) + e && (yield e); + } +} +function* R6i(t) { + if (t) + switch (t.type) { + case "Point": + yield t.coordinates; + break; + case "LineString": + case "MultiPoint": + yield* t.coordinates; + break; + case "MultiLineString": + case "Polygon": + for (const e of t.coordinates) + yield* e; + break; + case "MultiPolygon": + for (const e of t.coordinates) + for (const i of e) + yield* i; + } +} +function* M6i(t, e = {}) { + const { geometryType: i, objectIdField: r } = e; + for (const n of t) { + const { geometry: s, properties: o, id: a } = n; + if (s && ofe(s.type) !== i) + continue; + const l = o || {}; + let c; + r && (c = l[r], a == null || c || (l[r] = c = a)), yield new g1(s ? N6i(new Rl(), s, e) : null, l, null, c ?? void 0); + } +} +function D6i(t) { + for (const e of t) + if (e.length > 2) + return !0; + return !1; +} +function F6i(t) { + return !TAt(t); +} +function L6i(t) { + return TAt(t); +} +function TAt(t) { + let e = 0; + for (let i = 0; i < t.length; i++) { + const r = t[i], n = t[(i + 1) % t.length]; + e += r[0] * n[1] - n[0] * r[1]; + } + return e <= 0; +} +function EAt(t) { + const e = t[0], i = t[t.length - 1]; + return e[0] === i[0] && e[1] === i[1] && e[2] === i[2] || t.push(e), t; +} +function N6i(t, e, i) { + switch (e.type) { + case "LineString": + return k6i(t, e, i); + case "MultiLineString": + return $6i(t, e, i); + case "MultiPoint": + return B6i(t, e, i); + case "MultiPolygon": + return V6i(t, e, i); + case "Point": + return j6i(t, e, i); + case "Polygon": + return G6i(t, e, i); + } +} +function k6i(t, e, i) { + return Wie(t, e.coordinates, i), t; +} +function $6i(t, e, i) { + for (const r of e.coordinates) + Wie(t, r, i); + return t; +} +function B6i(t, e, i) { + return Wie(t, e.coordinates, i), t; +} +function V6i(t, e, i) { + for (const r of e.coordinates) { + IAt(t, r[0], i); + for (let n = 1; n < r.length; n++) + AAt(t, r[n], i); + } + return t; +} +function j6i(t, e, i) { + return v8e(t, e.coordinates, i), t; +} +function G6i(t, e, i) { + const r = e.coordinates; + IAt(t, r[0], i); + for (let n = 1; n < r.length; n++) + AAt(t, r[n], i); + return t; +} +function IAt(t, e, i) { + const r = EAt(e); + F6i(r) ? PAt(t, r, i) : Wie(t, r, i); +} +function AAt(t, e, i) { + const r = EAt(e); + L6i(r) ? PAt(t, r, i) : Wie(t, r, i); +} +function Wie(t, e, i) { + for (const r of e) + v8e(t, r, i); + t.lengths.push(e.length); +} +function PAt(t, e, i) { + for (let r = e.length - 1; r >= 0; r--) + v8e(t, e[r], i); + t.lengths.push(e.length); +} +function v8e(t, e, i) { + const [r, n, s] = e; + t.coords.push(r, n), i.hasZ && t.coords.push(s || 0); +} +function U6i(t) { + switch (typeof t) { + case "string": + return "esriFieldTypeString"; + case "number": + return "esriFieldTypeDouble"; + default: + return "unknown"; + } +} +function _8e(t) { + if (!t) + throw new ot("geojson-layer:empty", "GeoJSON data is empty"); + if (t.type !== "Feature" && t.type !== "FeatureCollection") + throw new ot("geojson-layer:unsupported-geojson-object", "missing or not supported GeoJSON object type", { data: t }); + const { crs: e } = t; + if (!e) + return; + const i = typeof e == "string" ? e : e.type === "name" ? e.properties.name : e.type === "EPSG" ? e.properties.code : null, r = new RegExp(".*(CRS84H?|4326)$", "i"); + if (!i || !r.test(i)) + throw new ot("geojson-layer:unsupported-crs", "unsupported GeoJSON 'crs' member", { crs: e }); +} +function OAt(t, e = {}) { + const i = [], r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(); + let s, o = !1, a = null, l = !1, { geometryType: c = null } = e, h = !1; + for (const y of CAt(t)) { + const { geometry: v, properties: x, id: I } = y; + if ((!v || (c || (c = ofe(v.type)), ofe(v.type) === c)) && (o || (o = D6i(R6i(v))), l || (l = I != null, l && (s = typeof I, x && (a = Object.keys(x).filter((P) => x[P] === I)))), x && a && l && I != null && (a.length > 1 ? a = a.filter((P) => x[P] === I) : a.length === 1 && (a = x[a[0]] === I ? a : [])), !h && x)) { + let P = !0; + for (const F in x) { + if (r.has(F)) + continue; + const k = x[F]; + if (k == null) { + P = !1, n.add(F); + continue; + } + const V = U6i(k); + if (V === "unknown") { + n.add(F); + continue; + } + n.delete(F), r.add(F); + const j = X7(F); + j && i.push({ name: j, alias: F, type: V }); + } + h = P; + } + } + const p = X7(a?.length === 1 && a[0] || null) ?? void 0; + if (p) { + for (const y of i) + if (y.name === p && gz(y)) { + y.type = "esriFieldTypeOID"; + break; + } + } + return { fields: i, geometryType: c, hasZ: o, objectIdFieldName: p, objectIdFieldType: s, unknownFields: Array.from(n) }; +} +function b8e(t, e) { + return Array.from(M6i(CAt(t), e)); +} +let z6i = class { + constructor() { + this.code = null, this.description = null; + } +}, H6i = class { + constructor(e) { + this.error = new z6i(), this.globalId = null, this.objectId = null, this.success = !1, this.uniqueId = null, this.error.description = e; + } +}; +function yS(t) { + return new H6i(t); +} +let W6i = class { + constructor(e) { + this.globalId = null, this.success = !0, this.objectId = this.uniqueId = e; + } +}; +function d7(t) { + return new W6i(t); +} +const nxe = /* @__PURE__ */ new Set(); +function B6(t, e, i, r = !1, n) { + nxe.clear(); + for (const s in i) { + const o = t.get(s); + if (!o) + continue; + const a = i[s], l = q6i(o, a); + if (l !== a && n && n.push({ name: "invalid-value-type", message: "attribute value was converted to match the field type", details: { field: o, originalValue: a, sanitizedValue: l } }), nxe.add(o.name), o && (r || o.editable)) { + const c = MGt(o, l); + if (c) + return yS($Gt(c, o, l)); + e[o.name] = l; + } + } + for (const s of t?.requiredFields ?? []) + if (!nxe.has(s.name)) + return yS(`missing required field "${s.name}"`); + return null; +} +function q6i(t, e) { + let i = e; + return typeof e == "string" && gz(t) ? i = parseFloat(e) : e != null && jCe(t) && typeof e != "string" && (i = String(e)), RGt(i); +} +let YJ; +function afe(t, e) { + if (!t || !Mh(e)) + return t; + if ("rings" in t || "paths" in t) { + if (ut(YJ)) + throw new TypeError("geometry engine not loaded"); + return YJ.simplify(e, t); + } + return t; +} +async function Y6i() { + return ut(YJ) && (YJ = await Promise.resolve().then(() => Zie)), YJ; +} +async function RAt(t, e) { + !Mh(t) || e !== "esriGeometryPolygon" && e !== "esriGeometryPolyline" || await Y6i(); +} +const X6i = { hasAttachments: !1, capabilities: "query, editing, create, delete, update", useStandardizedQueries: !0, supportsCoordinatesQuantization: !0, supportsReturningQueryGeometry: !0, advancedQueryCapabilities: { supportsQueryAttachments: !1, supportsStatistics: !0, supportsPercentileStatistics: !0, supportsReturningGeometryCentroid: !0, supportsQueryWithDistance: !0, supportsDistinct: !0, supportsReturningQueryExtent: !0, supportsReturningGeometryProperties: !1, supportsHavingClause: !0, supportsOrderBy: !0, supportsPagination: !0, supportsQueryWithResultType: !1, supportsSqlExpression: !0, supportsDisjointSpatialRel: !0 } }; +let K6i = class { + constructor() { + this._queryEngine = null, this._snapshotFeatures = async (e) => { + const i = await this._fetch(e); + return this._createFeatures(i); + }; + } + destroy() { + this._queryEngine?.destroy(), this._queryEngine = this._fieldsIndex = this._createDefaultAttributes = null; + } + async load(e, i = {}) { + this._loadOptions = { url: e.url, customParameters: e.customParameters }; + const r = []; + await this._checkProjection(e.spatialReference); + let n = null; + e.url && (n = await this._fetch(i?.signal)); + const s = OAt(n, { geometryType: e.geometryType }), o = e.fields || s.fields || [], a = e.hasZ != null ? e.hasZ : s.hasZ, l = s.geometryType; + let c = e.objectIdField || s.objectIdFieldName || "__OBJECTID"; + const h = e.spatialReference || gm; + let p = e.timeInfo; + o === s.fields && s.unknownFields.length > 0 && r.push({ name: "geojson-layer:unknown-field-types", message: "Some fields types couldn't be inferred from the features and were dropped", details: { unknownFields: s.unknownFields } }); + let y = new sg(o).get(c); + y ? (y.type !== "esriFieldTypeString" && (y.type = "esriFieldTypeOID"), y.editable = !1, y.nullable = !1, c = y.name) : (y = { alias: c, name: c, type: s.objectIdFieldType === "string" ? "esriFieldTypeString" : "esriFieldTypeOID", editable: !1, nullable: !1 }, o.unshift(y)); + const v = {}; + for (const Y of o) { + if (Y.name == null && (Y.name = Y.alias), Y.alias == null && (Y.alias = Y.name), !Y.name) + throw new ot("geojson-layer:invalid-field-name", "field name is missing", { field: Y }); + if (!Nge.jsonValues.includes(Y.type)) + throw new ot("geojson-layer:invalid-field-type", `invalid type for field "${Y.name}"`, { field: Y }); + if (Y.name !== y.name) { + const X = pge(Y); + X !== void 0 && (v[Y.name] = X); + } + } + this._fieldsIndex = new sg(o); + const x = this._fieldsIndex.requiredFields.indexOf(y); + if (x > -1 && this._fieldsIndex.requiredFields.splice(x, 1), p) { + if (p.startTimeField) { + const Y = this._fieldsIndex.get(p.startTimeField); + Y ? (p.startTimeField = Y.name, Y.type = "esriFieldTypeDate") : p.startTimeField = null; + } + if (p.endTimeField) { + const Y = this._fieldsIndex.get(p.endTimeField); + Y ? (p.endTimeField = Y.name, Y.type = "esriFieldTypeDate") : p.endTimeField = null; + } + if (p.trackIdField) { + const Y = this._fieldsIndex.get(p.trackIdField); + Y ? p.trackIdField = Y.name : (p.trackIdField = null, r.push({ name: "geojson-layer:invalid-timeInfo-trackIdField", message: "trackIdField is missing", details: { timeInfo: p } })); + } + p.startTimeField || p.endTimeField || (r.push({ name: "geojson-layer:invalid-timeInfo", message: "startTimeField and endTimeField are missing", details: { timeInfo: p } }), p = null); + } + const I = l ? eH(l) : void 0, P = { warnings: r, featureErrors: [], layerDefinition: { ...X6i, drawingInfo: I ?? void 0, templates: NIt(v), extent: void 0, geometryType: l, objectIdField: c, fields: o, hasZ: !!a, timeInfo: p } }; + this._queryEngine = new B$({ fields: o, geometryType: l, hasM: !1, hasZ: a, objectIdField: c, spatialReference: h, timeInfo: p, featureStore: new zie({ geometryType: l, hasM: !1, hasZ: a }), cacheSpatialQueries: !0 }), this._createDefaultAttributes = K$e(v, c); + const F = await this._createFeatures(n); + this._objectIdGenerator = this._createObjectIdGenerator(this._queryEngine, F); + const k = this._normalizeFeatures(F, P.warnings, P.featureErrors); + this._queryEngine.featureStore.addMany(k); + const { fullExtent: V, timeExtent: j } = await this._queryEngine.fetchRecomputedExtents(); + if (P.layerDefinition.extent = V, j) { + const { start: Y, end: X } = j; + P.layerDefinition.timeInfo.timeExtent = [Y, X]; + } + return P; + } + async applyEdits(e) { + const { spatialReference: i, geometryType: r } = this._queryEngine; + return await Promise.all([RAt(i, r), Py(e.adds, i), Py(e.updates, i)]), await this._waitSnapshotComplete(), this._applyEdits(e); + } + async queryFeatures(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQuery(e, i.signal); + } + async queryFeatureCount(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForCount(e, i.signal); + } + async queryObjectIds(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForIds(e, i.signal); + } + async queryExtent(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForExtent(e, i.signal); + } + async querySnapping(e, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForSnapping(e, i.signal); + } + async refresh(e) { + this._loadOptions.customParameters = e, this._snapshotTask?.abort(), this._snapshotTask = iI(this._snapshotFeatures), this._snapshotTask.promise.then((n) => { + this._queryEngine.featureStore.clear(), this._objectIdGenerator = this._createObjectIdGenerator(this._queryEngine, n); + const s = this._normalizeFeatures(n); + s && this._queryEngine.featureStore.addMany(s); + }, (n) => { + this._queryEngine.featureStore.clear(), us(n) || Ei.getLogger("esri.layers.GeoJSONLayer").error(new ot("geojson-layer:refresh", "An error occurred during refresh", { error: n })); + }), await this._waitSnapshotComplete(); + const { fullExtent: i, timeExtent: r } = await this._queryEngine.fetchRecomputedExtents(); + return { extent: i, timeExtent: r }; + } + async _createFeatures(e) { + if (e == null) + return []; + const { geometryType: i, hasZ: r, objectIdField: n } = this._queryEngine, s = b8e(e, { geometryType: i, hasZ: r, objectIdField: n }); + if (!Ea(this._queryEngine.spatialReference, gm)) + for (const o of s) + _e(o.geometry) && (o.geometry = d8(Cp(zx(o.geometry, this._queryEngine.geometryType, this._queryEngine.hasZ, !1), gm, this._queryEngine.spatialReference))); + return s; + } + async _waitSnapshotComplete() { + if (this._snapshotTask && !this._snapshotTask.finished) { + try { + await this._snapshotTask.promise; + } catch { + } + return this._waitSnapshotComplete(); + } + } + async _fetch(e) { + const { url: i, customParameters: r } = this._loadOptions, n = (await ir(i, { responseType: "json", query: { ...r }, signal: e })).data; + return await _8e(n), n; + } + _normalizeFeatures(e, i, r) { + const { objectIdField: n } = this._queryEngine, s = []; + for (const o of e) { + const a = this._createDefaultAttributes(), l = B6(this._fieldsIndex, a, o.attributes, !0, i); + l ? r?.push(l) : (this._assignObjectId(a, o.attributes, !0), o.attributes = a, o.objectId = a[n], s.push(o)); + } + return s; + } + async _applyEdits(e) { + const { adds: i, updates: r, deletes: n } = e, s = { addResults: [], deleteResults: [], updateResults: [], uidToObjectId: {} }; + if (i && i.length && this._applyAddEdits(s, i), r && r.length && this._applyUpdateEdits(s, r), n && n.length) { + for (const l of n) + s.deleteResults.push(d7(l)); + this._queryEngine.featureStore.removeManyById(n); + } + const { fullExtent: o, timeExtent: a } = await this._queryEngine.fetchRecomputedExtents(); + return { extent: o, timeExtent: a, featureEditResults: s }; + } + _applyAddEdits(e, i) { + const { addResults: r } = e, { geometryType: n, hasM: s, hasZ: o, objectIdField: a, spatialReference: l, featureStore: c } = this._queryEngine, h = []; + for (const p of i) { + if (p.geometry && n !== Fd(p.geometry)) { + r.push(yS("Incorrect geometry type.")); + continue; + } + const y = this._createDefaultAttributes(), v = B6(this._fieldsIndex, y, p.attributes); + if (v) + r.push(v); + else { + if (this._assignObjectId(y, p.attributes), p.attributes = y, p.uid != null) { + const x = p.attributes[a]; + e.uidToObjectId[p.uid] = x; + } + if (_e(p.geometry)) { + const x = p.geometry.spatialReference ?? l; + p.geometry = Cp(afe(p.geometry, x), x, l); + } + h.push(p), r.push(d7(p.attributes[a])); + } + } + c.addMany(aU([], h, n, o, s, a)); + } + _applyUpdateEdits({ updateResults: e }, i) { + const { geometryType: r, hasM: n, hasZ: s, objectIdField: o, spatialReference: a, featureStore: l } = this._queryEngine; + for (const c of i) { + const { attributes: h, geometry: p } = c, y = h && h[o]; + if (y == null) { + e.push(yS(`Identifier field ${o} missing`)); + continue; + } + if (!l.has(y)) { + e.push(yS(`Feature with object id ${y} missing`)); + continue; + } + const v = Y5e(l.getFeature(y), r, s, n); + if (_e(p)) { + if (r !== Fd(p)) { + e.push(yS("Incorrect geometry type.")); + continue; + } + const x = p.spatialReference ?? a; + v.geometry = Cp(afe(p, x), x, a); + } + if (h) { + const x = B6(this._fieldsIndex, v.attributes, h); + if (x) { + e.push(x); + continue; + } + } + l.add(q5e(v, r, s, n, o)), e.push(d7(y)); + } + } + _createObjectIdGenerator(e, i) { + const r = e.fieldsIndex.get(e.objectIdField); + if (r.type === "esriFieldTypeString") + return () => r.name + "-" + Date.now().toString(16); + let n = Number.NEGATIVE_INFINITY; + for (const s of i) + s.objectId && (n = Math.max(n, s.objectId)); + return n = Math.max(0, n) + 1, () => n++; + } + _assignObjectId(e, i, r = !1) { + const n = this._queryEngine.objectIdField; + e[n] = r && n in i ? i[n] : this._objectIdGenerator(); + } + async _checkProjection(e) { + try { + await Py(gm, e); + } catch { + throw new ot("geojson-layer", "Projection not supported"); + } + } +}; +const J6i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: K6i +}, Symbol.toStringTag, { value: "Module" })); +var Jue = {}; +Jue.defaultNoDataValue = kCe(-1 / 0), Jue.decode = function(t, e) { + var i = (e = e || {}).encodedMaskData || e.encodedMaskData === null, r = t$i(t, e.inputOffset || 0, i), n = e.noDataValue != null ? kCe(e.noDataValue) : Jue.defaultNoDataValue, s = Z6i(r, e.pixelType || Float32Array, e.encodedMaskData, n, e.returnMask), o = { width: r.width, height: r.height, pixelData: s.resultPixels, minValue: r.pixels.minValue, maxValue: r.pixels.maxValue, noDataValue: n }; + return s.resultMask && (o.maskData = s.resultMask), e.returnEncodedMask && r.mask && (o.encodedMaskData = r.mask.bitset ? r.mask.bitset : null), e.returnFileInfo && (o.fileInfo = Q6i(r, n), e.computeUsedBitDepths && (o.fileInfo.bitDepths = e$i(r))), o; +}; +var Z6i = function(t, e, i, r, n) { + var s, o, a = 0, l = t.pixels.numBlocksX, c = t.pixels.numBlocksY, h = Math.floor(t.width / l), p = Math.floor(t.height / c), y = 2 * t.maxZError; + i = i || (t.mask ? t.mask.bitset : null), s = new e(t.width * t.height), n && i && (o = new Uint8Array(t.width * t.height)); + for (var v, x, I = new Float32Array(h * p), P = 0; P <= c; P++) { + var F = P !== c ? p : t.height % c; + if (F !== 0) + for (var k = 0; k <= l; k++) { + var V = k !== l ? h : t.width % l; + if (V !== 0) { + var j, Y, X, Q, re = P * t.width * p + k * h, he = t.width - V, fe = t.pixels.blocks[a]; + if (fe.encoding < 2 ? (fe.encoding === 0 ? j = fe.rawData : (i$i(fe.stuffedData, fe.bitsPerPixel, fe.numValidPixels, fe.offset, y, I, t.pixels.maxValue), j = I), Y = 0) : X = fe.encoding === 2 ? 0 : fe.offset, i) + for (x = 0; x < F; x++) { + for (7 & re && (Q = i[re >> 3], Q <<= 7 & re), v = 0; v < V; v++) + 7 & re || (Q = i[re >> 3]), 128 & Q ? (o && (o[re] = 1), s[re++] = fe.encoding < 2 ? j[Y++] : X) : (o && (o[re] = 0), s[re++] = r), Q <<= 1; + re += he; + } + else if (fe.encoding < 2) + for (x = 0; x < F; x++) { + for (v = 0; v < V; v++) + s[re++] = j[Y++]; + re += he; + } + else + for (x = 0; x < F; x++) + if (s.fill) + s.fill(X, re, re + V), re += V + he; + else { + for (v = 0; v < V; v++) + s[re++] = X; + re += he; + } + if (fe.encoding === 1 && Y !== fe.numValidPixels) + throw "Block and Mask do not match"; + a++; + } + } + } + return { resultPixels: s, resultMask: o }; +}, Q6i = function(t, e) { + return { fileIdentifierString: t.fileIdentifierString, fileVersion: t.fileVersion, imageType: t.imageType, height: t.height, width: t.width, maxZError: t.maxZError, eofOffset: t.eofOffset, mask: t.mask ? { numBlocksX: t.mask.numBlocksX, numBlocksY: t.mask.numBlocksY, numBytes: t.mask.numBytes, maxValue: t.mask.maxValue } : null, pixels: { numBlocksX: t.pixels.numBlocksX, numBlocksY: t.pixels.numBlocksY, numBytes: t.pixels.numBytes, maxValue: t.pixels.maxValue, minValue: t.pixels.minValue, noDataValue: e } }; +}, e$i = function(t) { + for (var e = t.pixels.numBlocksX * t.pixels.numBlocksY, i = {}, r = 0; r < e; r++) { + var n = t.pixels.blocks[r]; + n.encoding === 0 ? i.float32 = !0 : n.encoding === 1 ? i[n.bitsPerPixel] = !0 : i[0] = !0; + } + return Object.keys(i); +}, t$i = function(t, e, i) { + var r = {}, n = new Uint8Array(t, e, 10); + if (r.fileIdentifierString = String.fromCharCode.apply(null, n), r.fileIdentifierString.trim() != "CntZImage") + throw "Unexpected file identifier string: " + r.fileIdentifierString; + e += 10; + var s = new DataView(t, e, 24); + if (r.fileVersion = s.getInt32(0, !0), r.imageType = s.getInt32(4, !0), r.height = s.getUint32(8, !0), r.width = s.getUint32(12, !0), r.maxZError = s.getFloat64(16, !0), e += 24, !i) + if (s = new DataView(t, e, 16), r.mask = {}, r.mask.numBlocksY = s.getUint32(0, !0), r.mask.numBlocksX = s.getUint32(4, !0), r.mask.numBytes = s.getUint32(8, !0), r.mask.maxValue = s.getFloat32(12, !0), e += 16, r.mask.numBytes > 0) { + var o = new Uint8Array(Math.ceil(r.width * r.height / 8)), a = (s = new DataView(t, e, r.mask.numBytes)).getInt16(0, !0), l = 2, c = 0; + do { + if (a > 0) + for (; a--; ) + o[c++] = s.getUint8(l++); + else { + var h = s.getUint8(l++); + for (a = -a; a--; ) + o[c++] = h; + } + a = s.getInt16(l, !0), l += 2; + } while (l < r.mask.numBytes); + if (a !== -32768 || c < o.length) + throw "Unexpected end of mask RLE encoding"; + r.mask.bitset = o, e += r.mask.numBytes; + } else + r.mask.numBytes | r.mask.numBlocksY | r.mask.maxValue || (o = new Uint8Array(Math.ceil(r.width * r.height / 8)), r.mask.bitset = o); + s = new DataView(t, e, 16), r.pixels = {}, r.pixels.numBlocksY = s.getUint32(0, !0), r.pixels.numBlocksX = s.getUint32(4, !0), r.pixels.numBytes = s.getUint32(8, !0), r.pixels.maxValue = s.getFloat32(12, !0), e += 16; + var p = r.pixels.numBlocksX, y = r.pixels.numBlocksY, v = p + (r.width % p > 0 ? 1 : 0), x = y + (r.height % y > 0 ? 1 : 0); + r.pixels.blocks = new Array(v * x); + for (var I = 1e9, P = 0, F = 0; F < x; F++) + for (var k = 0; k < v; k++) { + var V = 0, j = t.byteLength - e; + s = new DataView(t, e, Math.min(10, j)); + var Y = {}; + r.pixels.blocks[P++] = Y; + var X = s.getUint8(0); + if (V++, Y.encoding = 63 & X, Y.encoding > 3) + throw "Invalid block encoding (" + Y.encoding + ")"; + if (Y.encoding !== 2) { + if (X !== 0 && X !== 2) { + if (X >>= 6, Y.offsetType = X, X === 2) + Y.offset = s.getInt8(1), V++; + else if (X === 1) + Y.offset = s.getInt16(1, !0), V += 2; + else { + if (X !== 0) + throw "Invalid block offset type"; + Y.offset = s.getFloat32(1, !0), V += 4; + } + if (I = Math.min(Y.offset, I), Y.encoding === 1) + if (X = s.getUint8(V), V++, Y.bitsPerPixel = 63 & X, X >>= 6, Y.numValidPixelsType = X, X === 2) + Y.numValidPixels = s.getUint8(V), V++; + else if (X === 1) + Y.numValidPixels = s.getUint16(V, !0), V += 2; + else { + if (X !== 0) + throw "Invalid valid pixel count type"; + Y.numValidPixels = s.getUint32(V, !0), V += 4; + } + } + var Q; + if (e += V, Y.encoding != 3) { + if (Y.encoding === 0) { + var re = (r.pixels.numBytes - 1) / 4; + if (re !== Math.floor(re)) + throw "uncompressed block has invalid length"; + Q = new ArrayBuffer(4 * re), new Uint8Array(Q).set(new Uint8Array(t, e, 4 * re)); + for (var he = new Float32Array(Q), fe = 0; fe < he.length; fe++) + I = Math.min(I, he[fe]); + Y.rawData = he, e += 4 * re; + } else if (Y.encoding === 1) { + var be = Math.ceil(Y.numValidPixels * Y.bitsPerPixel / 8), Se = Math.ceil(be / 4); + Q = new ArrayBuffer(4 * Se), new Uint8Array(Q).set(new Uint8Array(t, e, be)), Y.stuffedData = new Uint32Array(Q), e += be; + } + } + } else + e++, I = Math.min(I, 0); + } + return r.pixels.minValue = I, r.eofOffset = e, r; +}, i$i = function(t, e, i, r, n, s, o) { + var a, l, c, h = (1 << e) - 1, p = 0, y = 0, v = Math.ceil((o - r) / n), x = 4 * t.length - Math.ceil(e * i / 8); + for (t[t.length - 1] <<= 8 * x, a = 0; a < i; a++) { + if (y === 0 && (c = t[p++], y = 32), y >= e) + l = c >>> y - e & h, y -= e; + else { + var I = e - y; + l = (c & h) << I & h, l += (c = t[p++]) >>> (y = 32 - I); + } + s[a] = l < v ? r + l * n : o; + } + return s; +}; +const r$i = Jue.decode; +let n$i = class { + _decode(e) { + const i = r$i(e.buffer, e.options); + return Promise.resolve({ result: i, transferList: [i.pixelData.buffer] }); + } +}; +function s$i() { + return new n$i(); +} +const o$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: s$i +}, Symbol.toStringTag, { value: "Module" })), a$i = 1; +function MAt(t, e) { + let i = 0; + for (const r of e) { + const n = r.attributes?.[t]; + typeof n == "number" && isFinite(n) && (i = Math.max(i, n)); + } + return i; +} +const l$i = gm, u$i = { xmin: -180, ymin: -90, xmax: 180, ymax: 90, spatialReference: gm }, c$i = { hasAttachments: !1, capabilities: "query, editing, create, delete, update", useStandardizedQueries: !0, supportsCoordinatesQuantization: !0, supportsReturningQueryGeometry: !0, advancedQueryCapabilities: { supportsQueryAttachments: !1, supportsStatistics: !0, supportsPercentileStatistics: !0, supportsReturningGeometryCentroid: !0, supportsQueryWithDistance: !0, supportsDistinct: !0, supportsReturningQueryExtent: !0, supportsReturningGeometryProperties: !1, supportsHavingClause: !0, supportsOrderBy: !0, supportsPagination: !0, supportsQueryWithResultType: !1, supportsSqlExpression: !0, supportsDisjointSpatialRel: !0 } }; +function h$i(t) { + return B0(t) ? t.z != null : !!t.hasZ; +} +function d$i(t) { + return B0(t) ? t.m != null : !!t.hasM; +} +let p$i = class { + constructor() { + this._queryEngine = null, this._nextObjectId = null; + } + destroy() { + this._queryEngine && this._queryEngine && this._queryEngine.destroy(), this._queryEngine = this._fieldsIndex = this._createDefaultAttributes = null; + } + async load(e) { + const i = [], { features: r } = e, n = this._inferLayerProperties(r, e.fields), s = e.fields || [], o = e.hasM != null ? e.hasM : !!n.hasM, a = e.hasZ != null ? e.hasZ : !!n.hasZ, l = !e.spatialReference && !n.spatialReference, c = l ? l$i : e.spatialReference || n.spatialReference, h = l ? u$i : null, p = e.geometryType || n.geometryType, y = !p; + let v = e.objectIdField || n.objectIdField, x = e.timeInfo; + if (!y && (l && i.push({ name: "feature-layer:spatial-reference-not-found", message: "Spatial reference not provided or found in features. Defaults to WGS84" }), !p)) + throw new ot("feature-layer:missing-property", "geometryType not set and couldn't be inferred from the provided features"); + if (!v) + throw new ot("feature-layer:missing-property", "objectIdField not set and couldn't be found in the provided fields"); + if (n.objectIdField && v !== n.objectIdField && (i.push({ name: "feature-layer:duplicated-oid-field", message: `Provided objectIdField "${v}" doesn't match the field name "${n.objectIdField}", found in the provided fields` }), v = n.objectIdField), v && !n.objectIdField) { + let k = null; + s.some((V) => V.name === v && (k = V, !0)) ? (k.type = "esriFieldTypeOID", k.editable = !1, k.nullable = !1) : s.unshift({ alias: v, name: v, type: "esriFieldTypeOID", editable: !1, nullable: !1 }); + } + for (const k of s) { + if (k.name == null && (k.name = k.alias), k.alias == null && (k.alias = k.name), !k.name) + throw new ot("feature-layer:invalid-field-name", "field name is missing", { field: k }); + if (k.name === v && (k.type = "esriFieldTypeOID"), !Nge.jsonValues.includes(k.type)) + throw new ot("feature-layer:invalid-field-type", `invalid type for field "${k.name}"`, { field: k }); + } + const I = {}; + for (const k of s) + if (k.type !== "esriFieldTypeOID" && k.type !== "esriFieldTypeGlobalID") { + const V = pge(k); + V !== void 0 && (I[k.name] = V); + } + if (this._fieldsIndex = new sg(s), this._createDefaultAttributes = K$e(I, v), x) { + if (x.startTimeField) { + const k = this._fieldsIndex.get(x.startTimeField); + k ? (x.startTimeField = k.name, k.type = "esriFieldTypeDate") : x.startTimeField = null; + } + if (x.endTimeField) { + const k = this._fieldsIndex.get(x.endTimeField); + k ? (x.endTimeField = k.name, k.type = "esriFieldTypeDate") : x.endTimeField = null; + } + if (x.trackIdField) { + const k = this._fieldsIndex.get(x.trackIdField); + k ? x.trackIdField = k.name : (x.trackIdField = null, i.push({ name: "feature-layer:invalid-timeInfo-trackIdField", message: "trackIdField is missing", details: { timeInfo: x } })); + } + x.startTimeField || x.endTimeField || (i.push({ name: "feature-layer:invalid-timeInfo", message: "startTimeField and endTimeField are missing or invalid", details: { timeInfo: x } }), x = null); + } + const P = { warnings: i, featureErrors: [], layerDefinition: { ...c$i, drawingInfo: eH(p), templates: NIt(I), extent: h, geometryType: p, objectIdField: v, fields: s, hasZ: a, hasM: o, timeInfo: x }, assignedObjectIds: {} }; + if (this._queryEngine = new B$({ fields: s, geometryType: p, hasM: o, hasZ: a, objectIdField: v, spatialReference: c, featureStore: new zie({ geometryType: p, hasM: o, hasZ: a }), timeInfo: x, cacheSpatialQueries: !0 }), !r || !r.length) + return this._nextObjectId = a$i, P; + const F = MAt(v, r); + return this._nextObjectId = F + 1, await Py(r, c), this._loadInitialFeatures(P, r); + } + async applyEdits(e) { + const { spatialReference: i, geometryType: r } = this._queryEngine; + return await Promise.all([RAt(i, r), Py(e.adds, i), Py(e.updates, i)]), this._applyEdits(e); + } + queryFeatures(e, i = {}) { + return this._queryEngine.executeQuery(e, i.signal); + } + queryFeatureCount(e, i = {}) { + return this._queryEngine.executeQueryForCount(e, i.signal); + } + queryObjectIds(e, i = {}) { + return this._queryEngine.executeQueryForIds(e, i.signal); + } + queryExtent(e, i = {}) { + return this._queryEngine.executeQueryForExtent(e, i.signal); + } + querySnapping(e, i = {}) { + return this._queryEngine.executeQueryForSnapping(e, i.signal); + } + _inferLayerProperties(e, i) { + let r, n, s = null, o = null, a = null; + for (const l of e) { + const c = l.geometry; + if (!ut(c) && (s || (s = Fd(c)), o || (o = c.spatialReference), r == null && (r = h$i(c)), n == null && (n = d$i(c)), s && o && r != null && n != null)) + break; + } + if (i && i.length) { + let l = null; + i.some((c) => { + const h = c.type === "esriFieldTypeOID", p = !c.type && c.name && c.name.toLowerCase() === "objectid"; + return l = c, h || p; + }) && (a = l.name); + } + return { geometryType: s, spatialReference: o, objectIdField: a, hasM: n, hasZ: r }; + } + async _loadInitialFeatures(e, i) { + const { geometryType: r, hasM: n, hasZ: s, objectIdField: o, spatialReference: a, featureStore: l } = this._queryEngine, c = []; + for (const y of i) { + if (y.uid != null && (e.assignedObjectIds[y.uid] = -1), y.geometry && r !== Fd(y.geometry)) { + e.featureErrors.push(yS("Incorrect geometry type.")); + continue; + } + const v = this._createDefaultAttributes(), x = B6(this._fieldsIndex, v, y.attributes, !0, e.warnings); + x ? e.featureErrors.push(x) : (this._assignObjectId(v, y.attributes, !0), y.attributes = v, y.uid != null && (e.assignedObjectIds[y.uid] = y.attributes[o]), _e(y.geometry) && (y.geometry = Cp(y.geometry, y.geometry.spatialReference, a)), c.push(y)); + } + l.addMany(aU([], c, r, s, n, o)); + const { fullExtent: h, timeExtent: p } = await this._queryEngine.fetchRecomputedExtents(); + if (e.layerDefinition.extent = h, p) { + const { start: y, end: v } = p; + e.layerDefinition.timeInfo.timeExtent = [y, v]; + } + return e; + } + async _applyEdits(e) { + const { adds: i, updates: r, deletes: n } = e, s = { addResults: [], deleteResults: [], updateResults: [], uidToObjectId: {} }; + if (i && i.length && this._applyAddEdits(s, i), r && r.length && this._applyUpdateEdits(s, r), n && n.length) { + for (const l of n) + s.deleteResults.push(d7(l)); + this._queryEngine.featureStore.removeManyById(n); + } + const { fullExtent: o, timeExtent: a } = await this._queryEngine.fetchRecomputedExtents(); + return { extent: o, timeExtent: a, featureEditResults: s }; + } + _applyAddEdits(e, i) { + const { addResults: r } = e, { geometryType: n, hasM: s, hasZ: o, objectIdField: a, spatialReference: l, featureStore: c } = this._queryEngine, h = []; + for (const p of i) { + if (p.geometry && n !== Fd(p.geometry)) { + r.push(yS("Incorrect geometry type.")); + continue; + } + const y = this._createDefaultAttributes(), v = B6(this._fieldsIndex, y, p.attributes); + if (v) + r.push(v); + else { + if (this._assignObjectId(y, p.attributes), p.attributes = y, p.uid != null) { + const x = p.attributes[a]; + e.uidToObjectId[p.uid] = x; + } + if (_e(p.geometry)) { + const x = p.geometry.spatialReference ?? l; + p.geometry = Cp(afe(p.geometry, x), x, l); + } + h.push(p), r.push(d7(p.attributes[a])); + } + } + c.addMany(aU([], h, n, o, s, a)); + } + _applyUpdateEdits({ updateResults: e }, i) { + const { geometryType: r, hasM: n, hasZ: s, objectIdField: o, spatialReference: a, featureStore: l } = this._queryEngine; + for (const c of i) { + const { attributes: h, geometry: p } = c, y = h && h[o]; + if (y == null) { + e.push(yS(`Identifier field ${o} missing`)); + continue; + } + if (!l.has(y)) { + e.push(yS(`Feature with object id ${y} missing`)); + continue; + } + const v = Y5e(l.getFeature(y), r, s, n); + if (_e(p)) { + if (r !== Fd(p)) { + e.push(yS("Incorrect geometry type.")); + continue; + } + const x = p.spatialReference ?? a; + v.geometry = Cp(afe(p, x), x, a); + } + if (h) { + const x = B6(this._fieldsIndex, v.attributes, h); + if (x) { + e.push(x); + continue; + } + } + l.add(q5e(v, r, s, n, o)), e.push(d7(y)); + } + } + _assignObjectId(e, i, r = !1) { + const n = this._queryEngine.objectIdField; + r && i && isFinite(i[n]) ? e[n] = i[n] : e[n] = this._nextObjectId++; + } +}; +const f$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: p$i +}, Symbol.toStringTag, { value: "Module" })); +let m$i = class { + constructor(e, i, r) { + this.uid = e, this.geometry = i, this.attributes = r, this.visible = !0, this.objectId = null, this.centroid = null; + } +}, g$i = class { + constructor() { + this.exceededTransferLimit = !1, this.features = [], this.fields = [], this.hasM = !1, this.hasZ = !1, this.geometryType = null, this.objectIdFieldName = null, this.globalIdFieldName = null, this.geometryProperties = null, this.geohashFieldName = null, this.spatialReference = null, this.transform = null; + } +}; +function y$i(t, e) { + return e; +} +function w8e(t, e, i, r) { + switch (i) { + case 0: + return aee(t, e + r, 0); + case 1: + return t.originPosition === "lowerLeft" ? aee(t, e + r, 1) : b$i(t, e + r, 1); + } +} +function DAt(t, e, i, r) { + return i === 2 ? aee(t, e, 2) : w8e(t, e, i, r); +} +function v$i(t, e, i, r) { + return i === 2 ? aee(t, e, 3) : w8e(t, e, i, r); +} +function _$i(t, e, i, r) { + return i === 3 ? aee(t, e, 3) : DAt(t, e, i, r); +} +function aee({ translate: t, scale: e }, i, r) { + return t[r] + i * e[r]; +} +function b$i({ translate: t, scale: e }, i, r) { + return t[r] - i * e[r]; +} +let w$i = class { + constructor(e) { + this._options = e, this.geometryTypes = ["point", "multipoint", "polyline", "polygon"], this._previousCoordinate = [0, 0], this._transform = null, this._applyTransform = y$i, this._lengths = [], this._currentLengthIndex = 0, this._toAddInCurrentPath = 0, this._vertexDimension = 0, this._coordinateBuffer = null, this._coordinateBufferPtr = 0, this._attributesConstructor = class { + }; + } + createFeatureResult() { + return new g$i(); + } + finishFeatureResult(e) { + if (this._options.applyTransform && (e.transform = null), this._attributesConstructor = class { + }, this._coordinateBuffer = null, this._lengths.length = 0, !e.hasZ) + return; + const i = Cz(e.geometryType, this._options.sourceSpatialReference, e.spatialReference); + if (!ut(i)) + for (const r of e.features) + i(r.geometry); + } + createSpatialReference() { + return new or(); + } + addField(e, i) { + e.fields.push(Uo.fromJSON(i)); + const r = e.fields.map((n) => n.name); + this._attributesConstructor = function() { + for (const n of r) + this[n] = null; + }; + } + addFeature(e, i) { + const r = this._options.maxStringAttributeLength ? this._options.maxStringAttributeLength : 0; + if (r > 0) + for (const n in i.attributes) { + const s = i.attributes[n]; + typeof s == "string" && s.length > r && (i.attributes[n] = ""); + } + e.features.push(i); + } + addQueryGeometry(e, i) { + const { queryGeometry: r, queryGeometryType: n } = i, s = lU(r.clone(), r, !1, !1, this._transform), o = zx(s, n, !1, !1); + let a = null; + switch (n) { + case "esriGeometryPoint": + a = "point"; + break; + case "esriGeometryPolygon": + a = "polygon"; + break; + case "esriGeometryPolyline": + a = "polyline"; + break; + case "esriGeometryMultipoint": + a = "multipoint"; + } + o.type = a, e.queryGeometryType = n, e.queryGeometry = o; + } + prepareFeatures(e) { + switch (this._transform = e.transform ?? null, this._options.applyTransform && e.transform && (this._applyTransform = this._deriveApplyTransform(e)), this._vertexDimension = 2, e.hasZ && this._vertexDimension++, e.hasM && this._vertexDimension++, e.geometryType) { + case "point": + this.addCoordinate = (i, r, n) => this.addCoordinatePoint(i, r, n), this.createGeometry = (i) => this.createPointGeometry(i); + break; + case "polygon": + this.addCoordinate = (i, r, n) => this._addCoordinatePolygon(i, r, n), this.createGeometry = (i) => this._createPolygonGeometry(i); + break; + case "polyline": + this.addCoordinate = (i, r, n) => this._addCoordinatePolyline(i, r, n), this.createGeometry = (i) => this._createPolylineGeometry(i); + break; + case "multipoint": + this.addCoordinate = (i, r, n) => this._addCoordinateMultipoint(i, r, n), this.createGeometry = (i) => this._createMultipointGeometry(i); + break; + case "mesh": + case "extent": + break; + default: + e.geometryType; + } + } + createFeature() { + return this._lengths.length = 0, this._currentLengthIndex = 0, this._previousCoordinate[0] = 0, this._previousCoordinate[1] = 0, new m$i(rF(), null, new this._attributesConstructor()); + } + allocateCoordinates() { + const e = this._lengths.reduce((i, r) => i + r, 0); + this._coordinateBuffer = new Float64Array(e * this._vertexDimension), this._coordinateBufferPtr = 0; + } + addLength(e, i) { + this._lengths.length === 0 && (this._toAddInCurrentPath = i), this._lengths.push(i); + } + createPointGeometry(e) { + const i = { type: "point", x: 0, y: 0, spatialReference: e.spatialReference, hasZ: !!e.hasZ, hasM: !!e.hasM }; + return i.hasZ && (i.z = 0), i.hasM && (i.m = 0), i; + } + addCoordinatePoint(e, i, r) { + const n = this._transform ? this._applyTransform(this._transform, i, r, 0) : i; + if (n != null) + switch (r) { + case 0: + e.x = n; + break; + case 1: + e.y = n; + break; + case 2: + e.hasZ ? e.z = n : e.m = n; + break; + case 3: + e.m = n; + } + } + _transformPathLikeValue(e, i) { + let r = 0; + return i <= 1 && (r = this._previousCoordinate[i], this._previousCoordinate[i] += e), this._transform ? this._applyTransform(this._transform, e, i, r) : e; + } + _addCoordinatePolyline(e, i, r) { + this._dehydratedAddPointsCoordinate(e.paths, i, r); + } + _addCoordinatePolygon(e, i, r) { + this._dehydratedAddPointsCoordinate(e.rings, i, r); + } + _addCoordinateMultipoint(e, i, r) { + r === 0 && e.points.push([]); + const n = this._transformPathLikeValue(i, r); + e.points[e.points.length - 1].push(n); + } + _createPolygonGeometry(e) { + return { type: "polygon", rings: [[]], spatialReference: e.spatialReference, hasZ: !!e.hasZ, hasM: !!e.hasM }; + } + _createPolylineGeometry(e) { + return { type: "polyline", paths: [[]], spatialReference: e.spatialReference, hasZ: !!e.hasZ, hasM: !!e.hasM }; + } + _createMultipointGeometry(e) { + return { type: "multipoint", points: [], spatialReference: e.spatialReference, hasZ: !!e.hasZ, hasM: !!e.hasM }; + } + _dehydratedAddPointsCoordinate(e, i, r) { + r === 0 && this._toAddInCurrentPath-- == 0 && (e.push([]), this._toAddInCurrentPath = this._lengths[++this._currentLengthIndex] - 1, this._previousCoordinate[0] = 0, this._previousCoordinate[1] = 0); + const n = this._transformPathLikeValue(i, r), s = e[e.length - 1], o = this._coordinateBuffer; + if (o) { + if (r === 0) { + const a = this._coordinateBufferPtr * Float64Array.BYTES_PER_ELEMENT; + s.push(new Float64Array(o.buffer, a, this._vertexDimension)); + } + o[this._coordinateBufferPtr++] = n; + } + } + _deriveApplyTransform(e) { + const { hasZ: i, hasM: r } = e; + return i && r ? _$i : i ? DAt : r ? v$i : w8e; + } +}, x$i = class { + _parseFeatureQuery(e) { + const i = Jyt(e.buffer, new w$i(e.options)), r = { ...i, spatialReference: i.spatialReference?.toJSON(), fields: i.fields ? i.fields.map((n) => n.toJSON()) : void 0 }; + return Promise.resolve(r); + } +}; +function S$i() { + return new x$i(); +} +const C$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: S$i +}, Symbol.toStringTag, { value: "Module" })); +function T$i(t) { + return t === "heatmap" ? Promise.resolve().then(() => eMr) : Promise.resolve().then(() => rMr); +} +let o4 = class { + constructor(e) { + this.size = 0, this._start = 0, this.maxSize = e, this._buffer = new Array(e); + } + get entries() { + return this._buffer; + } + enqueue(e) { + if (this.size === this.maxSize) { + const i = this._buffer[this._start]; + return this._buffer[this._start] = e, this._start = (this._start + 1) % this.maxSize, i; + } + return this._buffer[(this._start + this.size++) % this.maxSize] = e, null; + } + dequeue() { + if (this.size === 0) + return null; + const e = this._buffer[this._start]; + return this._buffer[this._start] = null, this.size--, this._start = (this._start + 1) % this.maxSize, e; + } + peek() { + return this.size === 0 ? null : this._buffer[this._start]; + } + find(e) { + if (this.size === 0) + return null; + for (const i of this._buffer) + if (_e(i) && e(i)) + return i; + return null; + } + clear(e) { + let i = this.dequeue(); + for (; _e(i); ) + e && e(i), i = this.dequeue(); + } +}; +function E$i(t, e, i) { + if (ut(t)) + return null; + const r = e.readArcadeFeature(); + try { + return t.evaluate({ ...i, $feature: r }); + } catch (n) { + return Ei.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:", n), null; + } +} +const I$i = Promise.resolve().then(() => oMr); +let x8e = class { + constructor(e, i) { + this._canCacheExpressionValue = !1, this._sourceInfo = e, this._storage = i, this._bitsets = { computed: i.getBitset(i.createBitset()) }; + } + get storage() { + return this._storage; + } + invalidate() { + this._bitsets.computed.clear(); + } + async updateSchema(e, i) { + const r = zS(this._schema, i); + if (this._schema = i, !i || ut(r) || !zO(r, "attributes")) + return; + Vi("esri-2d-update-debug") && console.debug("Applying Update - Store:", r), this._bitsets.computed.clear(), e.targets[i.name] = !0; + const n = i.attributes, s = [], o = []; + for (const a in n) { + const l = n[a]; + switch (l.type) { + case "field": + break; + case "expression": + s.push(this._createArcadeComputedField(l)); + break; + case "label-expression": + s.push(this._createLabelArcadeComputedField(l)); + break; + case "statistic": + o.push(l); + } + } + this._computedFields = await Promise.all(s), this._canCacheExpressionValue = !this._computedFields.some((a) => a.type === "expression" && _e(a.expression) && a.expression.referencesScale()), this._statisticFields = o; + } + setComputedAttributes(e, i, r, n) { + const s = this._bitsets.computed; + if (!this._canCacheExpressionValue || !s.has(r)) { + s.set(r); + for (const o of this._computedFields) { + const a = this._evaluateField(i, o, n); + switch (o.resultType) { + case "numeric": + e.setComputedNumericAtIndex(r, o.fieldIndex, a); + break; + case "string": + e.setComputedStringAtIndex(r, o.fieldIndex, a); + } + } + } + } + async _createArcadeComputedField(e) { + const i = this._sourceInfo.spatialReference, r = this._sourceInfo.fieldsIndex; + return { ...e, expression: await dge(e.valueExpression, i, r) }; + } + async _createLabelArcadeComputedField(e) { + const i = this._sourceInfo.spatialReference, r = this._sourceInfo.fieldsIndex, { createLabelFunction: n } = await I$i, s = await n(e.label, r, i); + return { ...e, builder: s }; + } + _evaluateField(e, i, r) { + switch (i.type) { + case "label-expression": { + const n = e.readArcadeFeature(); + return i.builder.evaluate(n) || ""; + } + case "expression": { + const { expression: n } = i; + return E$i(n, e, { $view: { scale: r } }); + } + } + } +}, S8e = class Zue { + static fromBuffer(e, i) { + return new Zue(e, i); + } + static create(e, i = 4294967295) { + const r = new Uint32Array(Math.ceil(e / 32)); + return new Zue(r, i); + } + constructor(e, i) { + this._mask = 0, this._buf = e, this._mask = i; + } + _getIndex(e) { + return Math.floor(e / 32); + } + has(e) { + const i = this._mask & e; + return !!(this._buf[this._getIndex(i)] & 1 << i % 32); + } + hasRange(e, i) { + let r = e, n = i; + for (; r % 32 && r !== n; ) { + if (this.has(r)) + return !0; + r++; + } + for (; n % 32 && r !== n; ) { + if (this.has(r)) + return !0; + n--; + } + if (r === n) + return !1; + for (let s = r / 32; s !== n / 32; s++) + if (this._buf[s]) + return !0; + return !1; + } + set(e) { + const i = this._mask & e, r = this._getIndex(i), n = 1 << i % 32; + this._buf[r] |= n; + } + setRange(e, i) { + let r = e, n = i; + for (; r % 32 && r !== n; ) + this.set(r++); + for (; n % 32 && r !== n; ) + this.set(n--); + if (r !== n) + for (let s = r / 32; s !== n / 32; s++) + this._buf[s] = 4294967295; + } + unset(e) { + const i = this._mask & e, r = this._getIndex(i), n = 1 << i % 32; + this._buf[r] &= 4294967295 ^ n; + } + resize(e) { + const i = this._buf, r = new Uint32Array(Math.ceil(e / 32)); + r.set(i), this._buf = r; + } + or(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] |= e._buf[i]; + return this; + } + and(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] &= e._buf[i]; + return this; + } + xor(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] ^= e._buf[i]; + return this; + } + ior(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] |= ~e._buf[i]; + return this; + } + iand(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] &= ~e._buf[i]; + return this; + } + ixor(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] ^= ~e._buf[i]; + return this; + } + any() { + for (let e = 0; e < this._buf.length; e++) + if (this._buf[e]) + return !0; + return !1; + } + copy(e) { + for (let i = 0; i < this._buf.length; i++) + this._buf[i] = e._buf[i]; + return this; + } + clone() { + return new Zue(this._buf.slice(), this._mask); + } + clear() { + for (let e = 0; e < this._buf.length; e++) + this._buf[e] = 0; + } + forEachSet(e) { + for (let i = 0; i < this._buf.length; i++) { + let r = this._buf[i], n = 32 * i; + if (r) + for (; r; ) + 1 & r && e(n), r >>>= 1, n++; + } + } + countSet() { + let e = 0; + return this.forEachSet((i) => { + e++; + }), e; + } +}, sq = 0; +const lve = Vi("featurelayer-simplify-thresholds") ?? [0.5, 0.5, 0.5, 0.5], A$i = lve[0], P$i = lve[1], O$i = lve[2], R$i = lve[3], C8e = Vi("featurelayer-simplify-payload-size-factors") ?? [1, 2, 4], M$i = C8e[0], D$i = C8e[1], F$i = C8e[2], L$i = Vi("featurelayer-simplify-mobile-factor") ?? 2, N$i = Vi("esri-mobile"); +let j$ = class { + constructor(e, i) { + this.type = "FeatureSetReader", this.arcadeDeclaredClass = "esri.arcade.Feature", this.seen = !1, this.instance = 0, this._tx = 0, this._ty = 0, this._sx = 1, this._sy = 1, this._deleted = null, this._joined = [], this._objectIdToIndex = null, this._level = 0, this._datetimeMetadata = null, this.contextTimeReference = null, this.instance = e, this._layerSchema = i; + } + static createInstance() { + return sq++, sq = sq > 65535 ? 0 : sq, sq; + } + get isEmpty() { + return _e(this._deleted) && this._deleted.countSet() === this.getSize(); + } + set level(e) { + this._level = e; + } + getAreaSimplificationThreshold(e, i) { + let r = 1; + const n = N$i ? L$i : 1; + i > 4e6 ? r = F$i * n : i > 1e6 ? r = D$i * n : i > 5e5 ? r = M$i * n : i > 1e5 && (r = n); + let s = 0; + e > 4e3 ? s = R$i * r : e > 2e3 ? s = O$i * r : e > 100 ? s = P$i : e > 15 && (s = A$i); + let o = 8; + return this._level < 4 ? o = 1 : this._level < 5 ? o = 2 : this._level < 6 && (o = 4), s * o; + } + createQuantizedExtrudedQuad(e, i) { + return new Rl([5], [e - 1, i, 1, -1, 1, 1, -1, 1, -1, -1]); + } + setArcadeSpatialReference(e) { + this._arcadeSpatialReference = e; + } + attachStorage(e) { + this._storage = e; + } + getQuantizationTransform() { + throw new Error("Unable to find transform for featureSet"); + } + getStorage() { + return this._storage; + } + getComputedNumeric(e) { + return this.getComputedNumericAtIndex(0); + } + setComputedNumeric(e, i) { + return this.setComputedNumericAtIndex(i, 0); + } + getComputedString(e) { + return this.getComputedStringAtIndex(0); + } + setComputedString(e, i) { + return this.setComputedStringAtIndex(0, i); + } + getComputedNumericAtIndex(e) { + return this._storage.getComputedNumericAtIndex(this.getDisplayId(), e); + } + setComputedNumericAtIndex(e, i) { + this._storage.setComputedNumericAtIndex(this.getDisplayId(), e, i); + } + getComputedStringAtIndex(e) { + return this._storage.getComputedStringAtIndex(this.getDisplayId(), e); + } + setComputedStringAtIndex(e, i) { + return this._storage.setComputedStringAtIndex(this.getDisplayId(), e, i); + } + transform(e, i, r, n) { + const s = this.copy(); + return s._tx += e, s._ty += i, s._sx *= r, s._sy *= n, s; + } + readAttribute(e, i = !1) { + const r = this._readAttribute(e, i); + if (r !== void 0) + return r; + for (const n of this._joined) { + n.setIndex(this.getIndex()); + const s = n._readAttribute(e, i); + if (s !== void 0) + return s; + } + } + readAttributes() { + const e = this._readAttributes(); + for (const i of this._joined) { + i.setIndex(this.getIndex()); + const r = i._readAttributes(); + for (const n of Object.keys(r)) + e[n] = r[n]; + } + return e; + } + joinAttributes(e) { + this._joined.push(e); + } + readArcadeFeature() { + return this; + } + geometry() { + const e = this.readHydratedGeometry(), i = zx(e, this.geometryType, this.hasZ, this.hasM), r = Sl(i); + return r && (r.spatialReference = this._arcadeSpatialReference), r; + } + get dateTimeReferenceFieldIndex() { + return this._datetimeMetadata || (this._datetimeMetadata = zpe.create(this._layerSchema.fields, this._layerSchema)), this._datetimeMetadata; + } + autocastArcadeDate(e, i) { + return i && i instanceof Date ? this.isUnknownDateTimeField(e) ? wl.unknownDateJSToArcadeDate(i) : wl.dateJSAndZoneToArcadeDate(i, this.contextTimeReference?.timeZone ?? "system") : i; + } + isUnknownDateTimeField(e) { + return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e) === "unknown"; + } + fieldSourceTimeZone(e) { + return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e) ?? ""; + } + get layerPreferredTimeZone() { + return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone ?? ""; + } + field(e) { + if (this.hasField(e)) + return this.autocastArcadeDate(e, this.readAttribute(e, !0)); + for (const i of this._joined) + if (i.setIndex(this.getIndex()), i.hasField(e)) { + const r = i._readAttribute(e, !0); + return this.autocastArcadeDate(e, r); + } + throw new Error(`Field ${e} does not exist`); + } + setField(e, i) { + throw new Error("Unable to update feature attribute values, feature is readonly"); + } + keys() { + return this.getFieldNames(); + } + castToText(e = !1) { + if (!e) + return JSON.stringify(this.readLegacyFeature()); + const i = this.readLegacyFeature(); + if (!i) + return JSON.stringify(null); + const r = { geometry: i.geometry, attributes: { ...i.attributes ? i.attributes : {} } }; + for (const n in r.attributes) { + const s = r.attributes[n]; + s instanceof Date && (r.attributes[n] = s.getTime()); + } + return JSON.stringify(r); + } + gdbVersion() { + return null; + } + fullSchema() { + return this._layerSchema; + } + castAsJson(e = null) { + return { attributes: this._readAttributes(), geometry: e?.keepGeometryType === !0 ? this.geometry() : this.geometry()?.toJSON() ?? null }; + } + castAsJsonAsync(e = null, i = null) { + return Promise.resolve(this.castAsJson(i)); + } + removeIds(e) { + if (ut(this._objectIdToIndex)) { + const r = /* @__PURE__ */ new Map(), n = this.getCursor(); + for (; n.next(); ) { + const s = Ru(n.getObjectId()); + r.set(s, n.getIndex()); + } + this._objectIdToIndex = r; + } + const i = this._objectIdToIndex; + for (const r of e) + i.has(r) && this.removeAtIndex(i.get(r)); + } + removeAtIndex(e) { + ut(this._deleted) && (this._deleted = S8e.create(this.getSize())), this._deleted.set(e); + } + readGeometryForDisplay() { + return this.readUnquantizedGeometry(!0); + } + readLegacyGeometryForDisplay() { + return this.readLegacyGeometry(!0); + } + *features() { + const e = this.getCursor(); + for (; e.next(); ) + yield e.readOptimizedFeature(); + } + _getExists() { + return ut(this._deleted) || !this._deleted.has(this.getIndex()); + } + _computeCentroid() { + if (this.geometryType !== "esriGeometryPolygon") + return null; + const e = this.readUnquantizedGeometry(); + if (!e || e.hasIndeterminateRingOrder) + return null; + const i = Gu(this.getQuantizationTransform(), null); + return dIt(new Rl(), e, this.hasM, this.hasZ, i); + } + copyInto(e) { + e.seen = this.seen, e._storage = this._storage, e._arcadeSpatialReference = this._arcadeSpatialReference, e._joined = this._joined, e._tx = this._tx, e._ty = this._ty, e._sx = this._sx, e._sy = this._sy, e._deleted = this._deleted, e._objectIdToIndex = this._objectIdToIndex; + } +}, FAt = class iRe extends j$ { + static from(e, i) { + return new iRe(e.copy(), i); + } + constructor(e, i) { + super(j$.createInstance(), e.fullSchema()), this._currentIndex = -1, this._reader = e, this._indices = i; + } + get hasNext() { + return this._currentIndex + 1 < this._indices.length; + } + getSize() { + return this._indices.length; + } + getCursor() { + return this.copy(); + } + copy() { + const e = new iRe(this._reader.copy(), this._indices); + return e._currentIndex = this._currentIndex, e; + } + next() { + for (; this._nextIndex() && !this._reader._getExists(); ) + ; + return this._currentIndex < this._indices.length; + } + _nextIndex() { + return ++this._currentIndex < this._indices.length && (this._reader.setIndex(this._indices[this._currentIndex]), !0); + } + setArcadeSpatialReference(e) { + this._reader.setArcadeSpatialReference(e); + } + attachStorage(e) { + this._reader.attachStorage(e); + } + get geometryType() { + return this._reader.geometryType; + } + get hasFeatures() { + return this._reader.hasFeatures; + } + get exceededTransferLimit() { + return this._reader.exceededTransferLimit; + } + get hasZ() { + return this._reader.hasZ; + } + get hasM() { + return this._reader.hasM; + } + getStorage() { + return this._reader.getStorage(); + } + getComputedNumeric(e) { + return this._reader.getComputedNumericAtIndex(0); + } + setComputedNumeric(e, i) { + return this._reader.setComputedNumericAtIndex(i, 0); + } + getComputedString(e) { + return this._reader.getComputedStringAtIndex(0); + } + setComputedString(e, i) { + return this._reader.setComputedStringAtIndex(0, i); + } + getComputedNumericAtIndex(e) { + return this._reader.getComputedNumericAtIndex(e); + } + setComputedNumericAtIndex(e, i) { + this._reader.setComputedNumericAtIndex(e, i); + } + getComputedStringAtIndex(e) { + return this._reader.getComputedStringAtIndex(e); + } + setComputedStringAtIndex(e, i) { + return this._reader.setComputedStringAtIndex(e, i); + } + transform(e, i, r, n) { + const s = this.copy(); + return s._reader = this._reader.transform(e, i, r, n), s; + } + readAttribute(e, i = !1) { + return this._reader.readAttribute(e, i); + } + readAttributes() { + return this._reader.readAttributes(); + } + joinAttributes(e) { + return this._reader.joinAttributes(e); + } + readArcadeFeature() { + return this._reader.readArcadeFeature(); + } + geometry() { + return this._reader.geometry(); + } + field(e) { + return this.readAttribute(e, !0); + } + hasField(e) { + return this._reader.hasField(e); + } + setField(e, i) { + return this._reader.setField(e, i); + } + keys() { + return this._reader.keys(); + } + castToText(e = !1) { + return this._reader.castToText(e); + } + getQuantizationTransform() { + return this._reader.getQuantizationTransform(); + } + getFieldNames() { + return this._reader.getFieldNames(); + } + getAttributeHash() { + return this._reader.getAttributeHash(); + } + getObjectId() { + return this._reader.getObjectId(); + } + getDisplayId() { + return this._reader.getDisplayId(); + } + setDisplayId(e) { + return this._reader.setDisplayId(e); + } + getGroupId() { + return this._reader.getGroupId(); + } + setGroupId(e) { + return this._reader.setGroupId(e); + } + getXHydrated() { + return this._reader.getXHydrated(); + } + getYHydrated() { + return this._reader.getYHydrated(); + } + getX() { + return this._reader.getX(); + } + getY() { + return this._reader.getY(); + } + setIndex(e) { + return this._reader.setIndex(e); + } + getIndex() { + return this._reader.getIndex(); + } + readLegacyFeature() { + return this._reader.readLegacyFeature(); + } + readOptimizedFeature() { + return this._reader.readOptimizedFeature(); + } + readLegacyPointGeometry() { + return this._reader.readLegacyPointGeometry(); + } + readLegacyGeometry() { + return this._reader.readLegacyGeometry(); + } + readLegacyCentroid() { + return this._reader.readLegacyCentroid(); + } + readGeometryArea() { + return this._reader.readGeometryArea(); + } + readUnquantizedGeometry() { + return this._reader.readUnquantizedGeometry(); + } + readHydratedGeometry() { + return this._reader.readHydratedGeometry(); + } + readGeometry() { + return this._reader.readGeometry(); + } + readCentroid() { + return this._reader.readCentroid(); + } + _readAttribute(e, i) { + throw new Error("Error: Should not be called. Underlying _reader should be used instead"); + } + _readAttributes() { + throw new Error("Error: Should not be called. Underlying _reader should be used instead"); + } +}; +const kJe = Sx(); +function $Je(t, e) { + return t << 16 | e; +} +function oq(t) { + return (4294901760 & t) >>> 16; +} +function aq(t) { + return 65535 & t; +} +const uve = { getObjectId: (t) => t.getObjectId(), getAttributes: (t) => t.readAttributes(), getAttribute: (t, e) => t.readAttribute(e), cloneWithGeometry: (t, e) => t, getGeometry: (t) => t.readHydratedGeometry(), getCentroid: (t, e) => t.readCentroid() }; +let k$i = class extends x8e { + constructor(e, i, r) { + super(e, i), this.featureAdapter = uve, this.events = new Bd(), this._featureSetsByInstance = /* @__PURE__ */ new Map(), this._objectIdToDisplayId = /* @__PURE__ */ new Map(), this._spatialIndexInvalid = !0, this._indexSearchCache = new o4(50), this._index = C$(9, (n) => ({ minX: this._storage.getXMin(n), minY: this._storage.getYMin(n), maxX: this._storage.getXMax(n), maxY: this._storage.getYMax(n) })), this.mode = r; + } + get storeStatistics() { + let e = 0, i = 0, r = 0; + return this.forEach((n) => { + const s = n.readGeometry(); + s && (i += s.isPoint ? 1 : s.lengths.reduce((o, a) => o + a, 0), r += s.isPoint ? 1 : s.lengths.length, e += 1); + }), { featureCount: e, vertexCount: i, ringCount: r }; + } + hasInstance(e) { + return this._featureSetsByInstance.has(e); + } + onTileData(e, i) { + if (ut(i.addOrUpdate)) + return i; + if (i.addOrUpdate.attachStorage(this._storage), this.mode === "snapshot") { + const n = i.addOrUpdate.getCursor(); + for (; n.next(); ) { + const s = n.getDisplayId(); + this.setComputedAttributes(this._storage, n, s, e.scale); + } + return i; + } + this._featureSetsByInstance.set(i.addOrUpdate.instance, i.addOrUpdate); + const r = i.addOrUpdate.getCursor(); + for (; r.next(); ) + this._insertFeature(r, e.scale); + return this._spatialIndexInvalid = !0, this.events.emit("changed"), i; + } + search(e) { + this._rebuildIndex(); + const i = e.id, r = this._indexSearchCache.find((a) => a.tileId === i); + if (_e(r)) + return r.readers; + const n = /* @__PURE__ */ new Map(), s = this._searchIndex(e.bounds), o = []; + for (const a of s) { + const l = this._storage.getInstanceId(a), c = oq(l), h = aq(l); + n.has(c) || n.set(c, []), n.get(c).push(h); + } + return n.forEach((a, l) => { + const c = this._featureSetsByInstance.get(l); + o.push(FAt.from(c, a)); + }), this._indexSearchCache.enqueue({ tileId: i, readers: o }), o; + } + insert(e) { + const i = e.getCursor(), r = this._storage; + for (; i.next(); ) { + const n = $Je(i.instance, i.getIndex()), s = i.getObjectId(), o = this._objectIdToDisplayId.get(s) ?? this._storage.createDisplayId(); + i.setDisplayId(o), r.setInstanceId(o, n), this._objectIdToDisplayId.set(s, o); + } + this._featureSetsByInstance.set(e.instance, e), this._spatialIndexInvalid = !0; + } + remove(e) { + const i = this._objectIdToDisplayId.get(e); + if (!i) + return; + const r = this._storage.getInstanceId(i), n = aq(r), s = oq(r), o = this._featureSetsByInstance.get(s); + this._objectIdToDisplayId.delete(e), this._storage.releaseDisplayId(i), o.removeAtIndex(n), o.isEmpty && this._featureSetsByInstance.delete(s), this._spatialIndexInvalid = !0; + } + forEach(e) { + this._objectIdToDisplayId.forEach((i) => { + const r = this._storage.getInstanceId(i), n = this._lookupFeature(r); + e(n); + }); + } + forEachUnsafe(e) { + this._objectIdToDisplayId.forEach((i) => { + const r = this._storage.getInstanceId(i), n = oq(r), s = aq(r), o = this._getFeatureSet(n); + o.setIndex(s), e(o); + }); + } + forEachInBounds(e, i) { + const r = this._searchIndex(e); + for (const n of r) { + const s = this.lookupFeatureByDisplayId(n, this._storage); + i(s); + } + } + forEachBounds(e, i) { + this._rebuildIndex(); + for (const r of e) { + if (!r.readGeometry()) + continue; + const n = r.getDisplayId(); + wdt(kJe, this._storage.getXMin(n), this._storage.getYMin(n), this._storage.getXMax(n), this._storage.getYMax(n)), i(kJe); + } + } + sweepFeatures(e, i, r) { + this._spatialIndexInvalid = !0, this._objectIdToDisplayId.forEach((n, s) => { + e.has(n) || (i.releaseDisplayId(n), r && r.unsetAttributeData(n), this._objectIdToDisplayId.delete(s)); + }), this.events.emit("changed"); + } + sweepFeatureSets(e) { + this._spatialIndexInvalid = !0, this._featureSetsByInstance.forEach((i, r) => { + e.has(r) || this._featureSetsByInstance.delete(r); + }); + } + lookupObjectId(e, i) { + const r = this.lookupFeatureByDisplayId(e, i); + return ut(r) ? null : r.getObjectId(); + } + lookupDisplayId(e) { + return this._objectIdToDisplayId.get(e); + } + lookupFeatureByDisplayId(e, i) { + const r = i.getInstanceId(e); + return this._lookupFeature(r); + } + lookupByDisplayIdUnsafe(e) { + const i = this._storage.getInstanceId(e), r = oq(i), n = aq(i), s = this._getFeatureSet(r); + return s ? (s.setIndex(n), s) : null; + } + _insertFeature(e, i) { + const r = this._storage, n = e.getObjectId(), s = $Je(e.instance, e.getIndex()); + r.getInstanceId(e.getDisplayId()); + let o = this._objectIdToDisplayId.get(n); + o || (o = r.createDisplayId(), this._objectIdToDisplayId.set(n, o), this._spatialIndexInvalid = !0), e.setDisplayId(o), r.setInstanceId(o, s), this.setComputedAttributes(r, e, o, i); + } + _searchIndex(e) { + this._rebuildIndex(); + const i = { minX: e[0], minY: e[1], maxX: e[2], maxY: e[3] }; + return this._index.search(i); + } + _rebuildIndex() { + if (!this._spatialIndexInvalid) + return; + const e = []; + this.mode === "snapshot" ? this._featureSetsByInstance.forEach((i) => { + const r = i.getCursor(); + for (; r.next(); ) { + const n = r.getDisplayId(); + this._storage.setBounds(n, r) && e.push(n); + } + }) : this._objectIdToDisplayId.forEach((i) => { + const r = this._storage.getInstanceId(i); + this._storage.setBounds(i, this._lookupFeature(r)) && e.push(i); + }), this._index.clear(), this._index.load(e), this._indexSearchCache.clear(), this._spatialIndexInvalid = !1; + } + _lookupFeature(e) { + const i = oq(e), r = this._getFeatureSet(i); + if (!r) + return; + const n = r.getCursor(), s = aq(e); + return n.setIndex(s), n; + } + _getFeatureSet(e) { + return this._featureSetsByInstance.get(e); + } +}; +const Que = Ei.getLogger("esri.layers.graphics.sources.ogcfeature"), T8e = "http://www.opengis.net/def/crs/", BJe = `${T8e}OGC/1.3/CRS84`; +async function $$i(t, e, i = {}, r = 5) { + const { links: n } = t, s = n3(n, "items", "application/geo+json") || n3(n, "http://www.opengis.net/def/rel/ogc/1.0/items", "application/geo+json"); + if (ut(s)) + throw new ot("ogc-feature-layer:missing-items-page", "Missing items url"); + const { data: o } = await ir(s.href, { signal: i.signal, query: { limit: r, ...i.customParameters, token: i.apiKey }, headers: { accept: "application/geo+json" } }); + await _8e(o); + const a = OAt(o, { geometryType: e.geometryType }), l = e.fields || a.fields || [], c = e.hasZ != null ? e.hasZ : a.hasZ, h = a.geometryType, p = e.objectIdField || a.objectIdFieldName || "OBJECTID"; + let y = e.timeInfo; + const v = l.find(({ name: x }) => x === p); + if (v) + v.editable = !1, v.nullable = !1; + else { + if (!a.objectIdFieldType) + throw new ot("ogc-feature-layer:missing-feature-id", "Collection geojson require a feature id as a unique identifier"); + l.unshift({ name: p, alias: p, type: a.objectIdFieldType === "number" ? "esriFieldTypeOID" : "esriFieldTypeString", editable: !1, nullable: !1 }); + } + if (p !== a.objectIdFieldName) { + const x = l.find(({ name: I }) => I === a.objectIdFieldName); + x && (x.type = "esriFieldTypeInteger"); + } + l === a.fields && a.unknownFields.length > 0 && Que.warn({ name: "ogc-feature-layer:unknown-field-types", message: "Some fields types couldn't be inferred from the features and were dropped", details: { unknownFields: a.unknownFields } }); + for (const x of l) { + if (x.name == null && (x.name = x.alias), x.alias == null && (x.alias = x.name), x.type !== "esriFieldTypeOID" && x.type !== "esriFieldTypeGlobalID" && (x.editable = x.editable == null || !!x.editable, x.nullable = x.nullable == null || !!x.nullable), !x.name) + throw new ot("ogc-feature-layer:invalid-field-name", "field name is missing", { field: x }); + if (!Nge.jsonValues.includes(x.type)) + throw new ot("ogc-feature-layer:invalid-field-type", `invalid type for field "${x.name}"`, { field: x }); + } + if (y) { + const x = new sg(l); + if (y.startTimeField) { + const I = x.get(y.startTimeField); + I ? (y.startTimeField = I.name, I.type = "esriFieldTypeDate") : y.startTimeField = null; + } + if (y.endTimeField) { + const I = x.get(y.endTimeField); + I ? (y.endTimeField = I.name, I.type = "esriFieldTypeDate") : y.endTimeField = null; + } + if (y.trackIdField) { + const I = x.get(y.trackIdField); + I ? y.trackIdField = I.name : (y.trackIdField = null, Que.warn({ name: "ogc-feature-layer:invalid-timeInfo-trackIdField", message: "trackIdField is missing", details: { timeInfo: y } })); + } + y.startTimeField || y.endTimeField || (Que.warn({ name: "ogc-feature-layer:invalid-timeInfo", message: "startTimeField and endTimeField are missing", details: { timeInfo: y } }), y = null); + } + return { drawingInfo: h ? eH(h) : null, extent: Y$i(t), geometryType: h, fields: l, hasZ: !!c, objectIdField: p, timeInfo: y }; +} +async function B$i(t, e = {}) { + const { links: i } = t, r = n3(i, "data", "application/json") || n3(i, "http://www.opengis.net/def/rel/ogc/1.0/data", "application/json"); + if (ut(r)) + throw new ot("ogc-feature-layer:missing-collections-page", "Missing collections url"); + const { apiKey: n, customParameters: s, signal: o } = e, { data: a } = await ir(r.href, { signal: o, headers: { accept: "application/json" }, query: { ...s, token: n } }); + return a; +} +async function V$i(t, e = {}) { + const { links: i } = t, r = n3(i, "conformance", "application/json") || n3(i, "http://www.opengis.net/def/rel/ogc/1.0/conformance", "application/json"); + if (ut(r)) + throw new ot("ogc-feature-layer:missing-conformance-page", "Missing conformance url"); + const { apiKey: n, customParameters: s, signal: o } = e, { data: a } = await ir(r.href, { signal: o, headers: { accept: "application/json" }, query: { ...s, token: n } }); + return a; +} +async function j$i(t, e = {}) { + const { apiKey: i, customParameters: r, signal: n } = e, { data: s } = await ir(t, { signal: n, headers: { accept: "application/json" }, query: { ...r, token: i } }); + return s; +} +async function G$i(t, e = {}) { + const i = "application/vnd.oai.openapi+json;version=3.0", r = n3(t.links, "service-desc", i); + if (ut(r)) + return Que.warn("ogc-feature-layer:missing-openapi-page", "The OGC API-Features server does not have an OpenAPI page."), null; + const { apiKey: n, customParameters: s, signal: o } = e, { data: a } = await ir(r.href, { signal: o, headers: { accept: i }, query: { ...s, token: n } }); + return a; +} +function VJe(t) { + const e = /^http:\/\/www\.opengis.net\/def\/crs\/(?.*)\/(?.*)\/(?.*)$/i.exec(t)?.groups; + if (!e) + return null; + const { authority: i, code: r } = e; + switch (i.toLowerCase()) { + case "ogc": + switch (r.toLowerCase()) { + case "crs27": + return or.GCS_NAD_1927.wkid; + case "crs83": + return 4269; + case "crs84": + case "crs84h": + return or.WGS84.wkid; + default: + return null; + } + case "esri": + case "epsg": { + const n = Number.parseInt(r, 10); + return Number.isNaN(n) ? null : n; + } + default: + return null; + } +} +async function U$i(t, e, i) { + const r = await rRe(t, e, i); + return h0t(r); +} +async function rRe(t, e, i) { + const { collection: r, layerDefinition: n, maxRecordCount: s, queryParameters: { apiKey: o, customParameters: a }, spatialReference: l, supportedCrs: c } = t, { links: h } = r, p = n3(h, "items", "application/geo+json") || n3(h, "http://www.opengis.net/def/rel/ogc/1.0/items", "application/geo+json"); + if (ut(p)) + throw new ot("ogc-feature-layer:missing-items-page", "Missing items url"); + const { geometry: y, num: v, start: x, timeExtent: I, where: P } = e; + if (e.objectIds) + throw new ot("ogc-feature-layer:query-by-objectids-not-supported", "Queries with objectids are not supported"); + const F = or.fromJSON(l), k = Gu(e.outSpatialReference, F), V = k.isWGS84 ? null : LAt(k, c), j = q$i(y, c), Y = H$i(I), X = W$i(P), Q = v ?? (x != null && x !== void 0 ? 10 : s), { data: re } = await ir(p.href, { ...i, query: { ...a, ...j, crs: V, datetime: Y, query: X, limit: Q, startindex: x, token: o }, headers: { accept: "application/geo+json" } }); + let he = !1; + re.links && (he = !!re.links.find((Pe) => Pe.rel === "next")), !he && Number.isInteger(re.numberMatched) && Number.isInteger(re.numberReturned) && (he = re.numberReturned < re.numberMatched); + const { fields: fe, geometryType: be, hasZ: Se, objectIdField: Me } = n, ke = b8e(re, { geometryType: be, hasZ: Se, objectIdField: Me }); + if (!V && k.isWebMercator) { + for (const xe of ke) + if (_e(xe.geometry) && be != null) { + const Pe = zx(xe.geometry, be, Se, !1); + Pe.spatialReference = or.WGS84, xe.geometry = d8(i8(Pe, k)); + } + } + for (const xe of ke) + xe.objectId = xe.attributes[Me]; + const J = V || !V && k.isWebMercator ? k.toJSON() : gm, ce = new k5e(); + return ce.exceededTransferLimit = he, ce.features = ke, ce.fields = fe, ce.geometryType = be, ce.hasZ = Se, ce.objectIdFieldName = Me, ce.spatialReference = J, ce; +} +function z$i(t) { + return _e(t) && t.type === "extent"; +} +function LAt(t, e) { + const { isWebMercator: i, wkid: r } = t; + if (!r) + return null; + const n = i ? e[3857] ?? e[102100] ?? e[102113] ?? e[900913] : e[t.wkid]; + return n ? `${T8e}${n}` : null; +} +function sxe(t) { + if (ut(t)) + return ""; + const { xmin: e, ymin: i, xmax: r, ymax: n } = t; + return `${e},${i},${r},${n}`; +} +function H$i(t) { + if (ut(t)) + return null; + const { start: e, end: i } = t; + return `${_e(e) ? e.toISOString() : ".."}/${_e(i) ? i.toISOString() : ".."}`; +} +function W$i(t) { + return ut(t) || !t || t === "1=1" ? null : t; +} +function q$i(t, e) { + if (!z$i(t)) + return null; + const { spatialReference: i } = t; + if (!i || i.isWGS84) + return { bbox: sxe(t) }; + const r = LAt(i, e); + return _e(r) ? { bbox: sxe(t), "bbox-crs": r } : i.isWebMercator ? { bbox: sxe(i8(t, or.WGS84)) } : null; +} +function Y$i(t) { + const e = t.extent?.spatial; + if (!e) + return null; + const i = e.bbox[0], r = i.length === 4, n = i[0], s = i[1], o = r ? void 0 : i[2]; + return { xmin: n, ymin: s, xmax: r ? i[2] : i[3], ymax: r ? i[3] : i[4], zmin: o, zmax: r ? void 0 : i[5], spatialReference: or.WGS84.toJSON() }; +} +function n3(t, e, i) { + return t.find((r) => r.rel === e && r.type === i) || t.find((r) => r.rel === e && !r.type); +} +function X$i({ coords: t, lengths: e }) { + let i = 0; + for (const r of e) { + for (let n = 1; n < r; n++) + t[2 * (i + n)] += t[2 * (i + n) - 2], t[2 * (i + n) + 1] += t[2 * (i + n) - 1]; + i += r; + } +} +let Vv = class BV extends j$ { + static fromFeatures(e, i) { + const { objectIdField: r, geometryType: n } = i, s = aU([], e, n, !1, !1, r); + for (let o = 0; o < s.length; o++) + s[o].displayId = e[o].displayId; + return BV.fromOptimizedFeatures(s, i); + } + static fromFeatureSet(e, i) { + const r = X5e(e, i.objectIdField); + return BV.fromOptimizedFeatureSet(r, i); + } + static fromOptimizedFeatureSet(e, i) { + const { features: r } = e, n = BV.fromOptimizedFeatures(r, i); + n._exceededTransferLimit = e.exceededTransferLimit, n._transform = e.transform; + for (const s of e.fields) + s.type === "esriFieldTypeDate" && n._dateFields.add(s.name); + return n; + } + static fromOptimizedFeatures(e, i, r) { + const n = j$.createInstance(), s = new BV(n, e, i); + return s._transform = r, s; + } + constructor(e, i, r) { + super(e, r), this._exceededTransferLimit = !1, this._featureIndex = -1, this._dateFields = /* @__PURE__ */ new Set(), this._geometryType = r?.geometryType, this._features = i; + } + get _current() { + return this._features[this._featureIndex]; + } + get geometryType() { + return this._geometryType; + } + get hasFeatures() { + return !!this._features.length; + } + get hasNext() { + return this._featureIndex + 1 < this._features.length; + } + get exceededTransferLimit() { + return this._exceededTransferLimit; + } + get hasZ() { + return !1; + } + get hasM() { + return !1; + } + removeIds(e) { + const i = new Set(e); + this._features = this._features.filter((r) => !(r.objectId && i.has(r.objectId))); + } + append(e) { + for (const i of e) + this._features.push(i); + } + getSize() { + return this._features.length; + } + getCursor() { + return this.copy(); + } + getQuantizationTransform() { + return this._transform; + } + getAttributeHash() { + let e = ""; + for (const i in this._current.attributes) + e += this._current.attributes[i]; + return e; + } + getIndex() { + return this._featureIndex; + } + setIndex(e) { + this._featureIndex = e; + } + getObjectId() { + return this._current?.objectId; + } + getDisplayId() { + return this._current.displayId; + } + setDisplayId(e) { + this._current.displayId = e; + } + getGroupId() { + return this._current.groupId; + } + setGroupId(e) { + this._current.groupId = e; + } + copy() { + const e = new BV(this.instance, this._features, this.fullSchema()); + return this.copyInto(e), e; + } + next() { + for (; ++this._featureIndex < this._features.length && !this._getExists(); ) + ; + return this._featureIndex < this._features.length; + } + readLegacyFeature() { + return Y5e(this._current, this.geometryType, this.hasZ, this.hasM); + } + readOptimizedFeature() { + return this._current; + } + readLegacyPointGeometry() { + return this.readGeometry() ? { x: this.getX(), y: this.getY() } : null; + } + readLegacyGeometry() { + const e = this.readGeometry(); + return zx(e, this.geometryType, this.hasZ, this.hasM); + } + readLegacyCentroid() { + const e = this.readCentroid(); + return ut(e) ? null : { x: e.coords[0] * this._sx + this._tx, y: e.coords[1] * this._sy + this._ty }; + } + readGeometryArea() { + return gM(this._current) ? gti(this._current.geometry, 2) : 0; + } + readUnquantizedGeometry() { + const e = this.readGeometry(); + if (this.geometryType === "esriGeometryPoint" || !e) + return e; + const i = e.clone(); + return X$i(i), i; + } + readHydratedGeometry() { + const e = this._current.geometry; + if (ut(e)) + return null; + const i = e.clone(); + return _e(this._transform) && lU(i, i, this.hasZ, this.hasM, this._transform), i; + } + getXHydrated() { + if (!gM(this._current)) + return 0; + const e = this._current.geometry.coords[0], i = this.getQuantizationTransform(); + return ut(i) ? e : e * i.scale[0] + i.translate[0]; + } + getYHydrated() { + if (!gM(this._current)) + return 0; + const e = this._current.geometry.coords[1], i = this.getQuantizationTransform(); + return ut(i) ? e : i.translate[1] - e * i.scale[1]; + } + getX() { + return gM(this._current) ? this._current.geometry.coords[0] * this._sx + this._tx : 0; + } + getY() { + return gM(this._current) ? this._current.geometry.coords[1] * this._sy + this._ty : 0; + } + readGeometry() { + if (!gM(this._current)) { + if (_e(this._current.centroid)) { + const [r, n] = this._current.centroid.coords; + return this.createQuantizedExtrudedQuad(r, n); + } + return null; + } + const e = this._current.geometry.clone(); + if (e.isPoint) + return e.coords[0] = e.coords[0] * this._sx + this._tx, e.coords[1] = e.coords[1] * this._sy + this._ty, e; + let i = 0; + for (const r of e.lengths) + e.coords[2 * i] = e.coords[2 * i] * this._sx + this._tx, e.coords[2 * i + 1] = e.coords[2 * i + 1] * this._sy + this._ty, i += r; + return e; + } + readCentroid() { + return gM(this._current) ? this._computeCentroid() : this._current.centroid; + } + hasField(e) { + return e in this._current.attributes ? !0 : this.getFieldNames().map((i) => i.toLowerCase()).includes(e.toLowerCase()); + } + getFieldNames() { + return Object.keys(this._current.attributes); + } + _readAttribute(e, i) { + const r = this._current.attributes[e]; + if (r !== void 0) + return r != null && i && this._dateFields.has(e) ? new Date(r) : r; + const n = this.readAttributes(), s = e?.toLocaleLowerCase().trim(); + for (const o in n) + if (o.toLocaleLowerCase().trim() === s) { + const a = this._current.attributes[o]; + return a != null && i && this._dateFields.has(o) ? new Date(a) : a; + } + } + copyInto(e) { + super.copyInto(e), e._featureIndex = this._featureIndex, e._transform = this._transform, e._dateFields = this._dateFields; + } + _readAttributes() { + return this._current.attributes; + } +}; +const oxe = 268435455; +let K$i = class { + constructor() { + this.fieldMap = /* @__PURE__ */ new Map(), this.fields = [], this.hasFeatures = !1, this.exceededTransferLimit = !1, this.fieldCount = 0, this.featureCount = 0, this.objectIdFieldIndex = 0, this.vertexCount = 0, this.offsets = { attributes: new Array(), geometry: new Array() }, this.centroid = new Array(); + } + hasField(e) { + return this.fieldMap.has(e); + } + isDateField(e) { + return (e != null && this.fieldMap.get(e)?.isDate) ?? !1; + } + getFieldIndex(e) { + return e != null ? this.fieldMap.get(e)?.index : void 0; + } +}; +function J$i(t) { + const r = t.asUnsafe(), n = r.getLength(), s = r.pos() + n, o = { name: "", isDate: !1 }; + for (; r.pos() < s && r.next(); ) + switch (r.tag()) { + case 1: + o.name = r.getString(); + break; + case 2: + gAe(r.getEnum()) === "esriFieldTypeDate" && (o.isDate = !0); + break; + default: + r.skip(); + } + return o; +} +function Z$i(t) { + return t.toLowerCase().trim(); +} +function Q$i(t, e, i = !1) { + const c = t.asUnsafe(), h = c.pos(), p = new K$i(); + let y = 0, v = 0; + const x = 1, I = 2, P = 4, F = 3; + let k = null, V = null, j = null, Y = !1; + for (; c.next(); ) + switch (c.tag()) { + case 1: + k = c.getString(); + break; + case 3: + V = c.getString(); + break; + case 12: + j = c.processMessage(Kyt); + break; + case 9: + if (p.exceededTransferLimit = c.getBool(), p.exceededTransferLimit) { + p.offsets.geometry = i ? new Float64Array(8e3) : new Int32Array(8e3), p.centroid = i ? new Float64Array(16e3) : new Int32Array(16e3); + for (let Q = 0; Q < p.centroid.length; Q++) + p.centroid[Q] = oxe; + } + break; + case 13: { + const Q = J$i(t), re = Q.name, he = Z$i(Q.name), fe = { fieldName: re, index: y++, isDate: Q.isDate }; + p.fields.push(fe), p.fieldMap.set(Q.name, fe), p.fieldMap.set(he, fe); + break; + } + case 15: { + const Q = c.getLength(), re = c.pos() + Q; + if (!p.exceededTransferLimit) { + const fe = p.offsets.geometry, be = p.centroid; + fe.push(0), be.push(oxe), be.push(oxe); + } + !Y && p.exceededTransferLimit && (Y = !0, p.offsets.attributes = i ? new Float64Array(8e3 * y) : new Uint32Array(8e3 * y)); + let he = v * y; + for (; c.pos() < re && c.next(); ) + switch (c.tag()) { + case x: { + Y ? p.offsets.attributes[he++] = c.pos() : p.offsets.attributes.push(c.pos()); + const fe = c.getLength(); + c.skipLen(fe); + break; + } + case I: + if (e) { + const fe = c.getLength(), be = c.pos() + fe; + for (; c.pos() < be && c.next(); ) + switch (c.tag()) { + case F: { + c.getUInt32(); + const Se = c.getSInt64(), Me = c.getSInt64(); + p.centroid[2 * v] = Se, p.centroid[2 * v + 1] = Me; + break; + } + default: + c.skip(); + } + } else { + p.offsets.geometry[v] = c.pos(); + const fe = c.getLength(); + p.vertexCount += fe, c.skipLen(fe); + } + break; + case P: { + const fe = c.getLength(), be = c.pos() + fe; + for (; c.pos() < be && c.next(); ) + switch (c.tag()) { + case F: { + c.getUInt32(); + const Se = c.getSInt64(), Me = c.getSInt64(); + p.centroid[2 * v] = Se, p.centroid[2 * v + 1] = Me; + break; + } + default: + c.skip(); + } + break; + } + default: + c.skip(); + } + v++, p.hasFeatures = !0; + break; + } + default: + c.skip(); + } + const X = k || V; + if (!X) + throw new ot("FeatureSet has no objectId or globalId field name"); + return p.featureCount = v, p.fieldCount = y, p.objectIdFieldIndex = p.getFieldIndex(X), p.transform = j, p.displayIds = new Uint32Array(p.featureCount), p.groupIds = new Uint16Array(p.featureCount), c.move(h), p; +} +const e8i = !0, axe = 268435455, jJe = 128, GJe = 128e3, pB = { small: { delta: new Int32Array(jJe), decoded: new Int32Array(jJe) }, large: { delta: new Int32Array(GJe), decoded: new Int32Array(GJe) } }; +function UJe(t) { + return t <= pB.small.delta.length ? pB.small : (t <= pB.large.delta.length || (pB.large.delta = new Int32Array(Math.round(1.25 * t)), pB.large.decoded = new Int32Array(Math.round(1.25 * t))), pB.large); +} +function zJe(t) { + return t.toLowerCase().trim(); +} +function t8i(t) { + try { + const i = new f$(new Uint8Array(t), new DataView(t)); + for (; i.next(); ) { + if (i.tag() === 2) + return i8i(i.getMessage()); + i.skip(); + } + } catch (e) { + const i = new ot("query:parsing-pbf", "Error while parsing FeatureSet PBF payload", { error: e }); + Ei.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(i); + } + return null; +} +function i8i(t) { + for (; t.next(); ) { + if (t.tag() === 1) + return t.getMessage(); + t.skip(); + } + return null; +} +function r8i(t) { + const h = t.getLength(), p = t.pos() + h; + for (; t.pos() < p && t.next(); ) + switch (t.tag()) { + case 1: + return t.getString(); + case 2: + return t.getFloat(); + case 3: + return t.getDouble(); + case 4: + return t.getSInt32(); + case 5: + return t.getUInt32(); + case 6: + return t.getInt64(); + case 7: + return t.getUInt64(); + case 8: + return t.getSInt64(); + case 9: + return t.getBool(); + default: + return t.skip(), null; + } + return null; +} +function n8i(t, e, i, r, n, s) { + return 0.5 * Math.abs(t * r + i * s + n * e - t * s - i * e - n * r); +} +function lxe(t, e, i, r) { + return t * r - i * e === 0 && t * i + e * r > 0; +} +let s8i = class nRe extends j$ { + static fromBuffer(e, i, r = !1) { + const n = i.geometryType, s = t8i(e), o = Q$i(s, n === "esriGeometryPoint", r), a = j$.createInstance(); + return new nRe(a, s, o, i); + } + constructor(e, i, r, n) { + super(e, n), this._hasNext = !1, this._isPoints = !1, this._featureIndex = -1, this._featureOffset = 0, this._cache = { area: 0, unquantGeometry: void 0, geometry: void 0, centroid: void 0, legacyFeature: void 0, optFeature: void 0 }, this._geometryType = n.geometryType, this._reader = i, this._header = r, this._hasNext = r.hasFeatures, this._isPoints = n.geometryType === "esriGeometryPoint"; + } + get geometryType() { + return this._geometryType; + } + get _size() { + return this._header.featureCount; + } + get hasZ() { + return !1; + } + get hasM() { + return !1; + } + get stride() { + return 2 + (this.hasZ ? 1 : 0) + (this.hasM ? 1 : 0); + } + get hasFeatures() { + return this._header.hasFeatures; + } + get hasNext() { + return this._hasNext; + } + get exceededTransferLimit() { + return this._header.exceededTransferLimit; + } + hasField(e) { + return this._header.hasField(e) || this._header.hasField(zJe(e)); + } + getFieldNames() { + return this._header.fields.map((e) => e.fieldName); + } + getSize() { + return this._size; + } + getQuantizationTransform() { + return this._header.transform; + } + getCursor() { + return this.copy(); + } + getIndex() { + return this._featureIndex; + } + setIndex(e) { + this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0, this._featureIndex = e; + } + getAttributeHash() { + let e = ""; + return this._header.fields.forEach(({ index: i }) => { + e += this._readAttributeAtIndex(i) + "."; + }), e; + } + getObjectId() { + return this._readAttributeAtIndex(this._header.objectIdFieldIndex); + } + getDisplayId() { + return this._header.displayIds[this._featureIndex]; + } + setDisplayId(e) { + this._header.displayIds[this._featureIndex] = e; + } + getGroupId() { + return this._header.groupIds[this._featureIndex]; + } + setGroupId(e) { + this._header.groupIds[this._featureIndex] = e; + } + readLegacyFeature() { + if (this._cache.legacyFeature === void 0) { + const e = this.readCentroid(), i = { attributes: this.readAttributes(), geometry: this._isPoints ? this.readLegacyPointGeometry() : this.readLegacyGeometry(), centroid: (e && { x: e.coords[0], y: e.coords[1] }) ?? null }; + return this._cache.legacyFeature = i, i; + } + return this._cache.legacyFeature; + } + readOptimizedFeature() { + if (this._cache.optFeature === void 0) { + const e = new g1(this.readGeometry(), this.readAttributes(), this.readCentroid()); + return e.objectId = this.getObjectId(), e.displayId = this.getDisplayId(), this._cache.optFeature = e, e; + } + return this._cache.optFeature; + } + getXHydrated() { + const e = this._header.centroid[2 * this._featureIndex], i = this.getQuantizationTransform(); + return ut(i) ? e : e * i.scale[0] + i.translate[0]; + } + getYHydrated() { + const e = this._header.centroid[2 * this._featureIndex + 1], i = this.getQuantizationTransform(); + return ut(i) ? e : i.translate[1] - e * i.scale[1]; + } + getX() { + return this._header.centroid[2 * this._featureIndex] * this._sx + this._tx; + } + getY() { + return this._header.centroid[2 * this._featureIndex + 1] * this._sy + this._ty; + } + readLegacyPointGeometry() { + return { x: this.getX(), y: this.getY() }; + } + readLegacyGeometry(e) { + const i = this.readGeometry(e); + return zx(i, this.geometryType, !1, !1); + } + readLegacyCentroid() { + const e = this.readCentroid(); + if (!e) + return null; + const [i, r] = e.coords; + return { x: i, y: r }; + } + readGeometryArea() { + return this._cache.area || this.readGeometry(!0), this._cache.area; + } + readUnquantizedGeometry(e = !1) { + if (this._cache.unquantGeometry === void 0) { + const i = this.readGeometry(e); + if (!i) + return this._cache.unquantGeometry = void 0, null; + const r = UJe(i.coords.length).decoded, n = i.clone(r), s = n.coords; + let o = 0; + for (const a of n.lengths) { + for (let l = 1; l < a; l++) { + const c = 2 * (o + l), h = 2 * (o + l - 1); + s[c] += s[h], s[c + 1] += s[h + 1]; + } + o += a; + } + return this._cache.unquantGeometry = n, n; + } + return this._cache.unquantGeometry; + } + readHydratedGeometry() { + if (this._isPoints) { + if (this._header.centroid[2 * this._featureIndex] === axe) + return null; + const n = this.getXHydrated(), s = this.getYHydrated(); + return new Rl([], [n, s]); + } + const e = this.readGeometry(); + if (!e) + return null; + const i = e.clone(), r = this.getQuantizationTransform(); + return _e(r) && lU(i, i, this.hasZ, this.hasM, r), i; + } + readGeometry(e = !1) { + if (this._cache.geometry === void 0) { + let i = null; + if (this._isPoints) { + if (this._header.centroid[2 * this._featureIndex] === axe) + return null; + const r = this.getX(), n = this.getY(); + i = new Rl([], [r, n]); + } else { + const r = this._header.offsets.geometry[this._featureIndex], n = this._reader; + if (r === 0) { + const s = this._readServerCentroid(); + if (!s) + return null; + const [o, a] = s.coords; + return this.createQuantizedExtrudedQuad(o, a); + } + n.move(r); + try { + if (i = e ? this._parseGeometryForDisplay(n) : this._parseGeometry(n), i === null) { + const s = this._readServerCentroid(); + if (!s) + return null; + const [o, a] = s.coords; + return this.createQuantizedExtrudedQuad(o, a); + } + } catch (s) { + return console.error("Failed to parse geometry!", s), null; + } + } + return this._cache.geometry = i, i; + } + return this._cache.geometry; + } + readCentroid() { + if (this._cache.centroid === void 0) { + let e; + return e = this._computeCentroid(), e || (e = this._readServerCentroid()), this._cache.centroid = e ?? void 0, e ?? null; + } + return this._cache.centroid; + } + copy() { + const e = this._reader.clone(), i = new nRe(this.instance, e, this._header, this.fullSchema()); + return this.copyInto(i), i; + } + next() { + for (this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0; ++this._featureIndex < this._size && !this._getExists(); ) + ; + return this._featureIndex < this._size; + } + _readAttribute(e, i) { + const r = this._header.hasField(e) ? e : zJe(e), n = this._header.getFieldIndex(r); + if (n == null) + return; + const s = this._readAttributeAtIndex(n); + return !i || s == null ? s : this._header.isDateField(r) ? new Date(s) : s; + } + _readAttributes() { + const e = {}; + return this._header.fields.forEach(({ fieldName: i, index: r }) => { + e[i] = this._readAttributeAtIndex(r); + }), e; + } + copyInto(e) { + super.copyInto(e), e._featureIndex = this._featureIndex, e._featureOffset = this._featureOffset, e._hasNext = this._hasNext; + } + _readAttributeAtIndex(e) { + const i = this._header.offsets.attributes[this._featureIndex * this._header.fieldCount + e], r = this._reader; + return r.move(i), r8i(r); + } + _readServerCentroid() { + const e = this._header.centroid[2 * this._featureIndex] + this._tx, i = this._header.centroid[2 * this._featureIndex + 1] + this._ty; + return e === axe ? null : new Rl([], [e, i]); + } + _parseGeometry(e) { + const n = e.asUnsafe(), s = n.getLength(), o = n.pos() + s, a = [], l = []; + for (; n.pos() < o && n.next(); ) + switch (n.tag()) { + case 2: { + const c = n.getUInt32(), h = n.pos() + c; + for (; n.pos() < h; ) + l.push(n.getUInt32()); + break; + } + case 3: { + const c = n.getUInt32(), h = n.pos() + c; + for (a.push(n.getSInt32() + this._tx), a.push(n.getSInt32() + this._ty), this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); n.pos() < h; ) + a.push(n.getSInt32()), a.push(n.getSInt32()), this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); + break; + } + default: + n.skip(); + } + return new Rl(l, a); + } + _parseGeometryForDisplay(e) { + const n = e.asUnsafe(), s = n.getLength(), o = n.pos() + s, a = [], l = []; + let c = 0, h = 0, p = null, y = 0; + const v = this.geometryType === "esriGeometryPolygon"; + for (; n.pos() < o && n.next(); ) + switch (n.tag()) { + case 2: { + const x = n.getUInt32(), I = n.pos() + x; + for (; n.pos() < I; ) { + const P = n.getUInt32(); + a.push(P), c += P; + } + p = UJe(2 * c).delta; + break; + } + case 3: { + n.getUInt32(); + const x = 2 + (this.hasZ ? 1 : 0) + (this.hasM ? 1 : 0); + Fg(p); + for (const I of a) + if (h + x * I > p.length) + for (let P = 0; P < I; P++) + n.getSInt32(), n.getSInt32(), this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); + else if (v && e8i) { + const P = this.getAreaSimplificationThreshold(I, this._header.vertexCount); + let F = 2, k = 1; + const V = !1; + let j = n.getSInt32(), Y = n.getSInt32(); + p[h++] = j, p[h++] = Y, this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); + let X = n.getSInt32(), Q = n.getSInt32(); + for (this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); F < I; ) { + let re = n.getSInt32(), he = n.getSInt32(); + this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(); + const fe = j + X, be = Y + Q; + n8i(j, Y, fe, be, fe + re, be + he) >= P ? (y += -0.5 * (fe - j) * (be + Y), k > 1 && lxe(p[h - 2], p[h - 1], X, Q) ? (p[h - 2] += X, p[h - 1] += Q) : (p[h++] = X, p[h++] = Q, k++), j = fe, Y = be) : (re += X, he += Q), X = re, Q = he, F++; + } + k < 3 || V ? h -= 2 * k : (y += -0.5 * (j + X - j) * (Y + Q + Y), lxe(p[h - 2], p[h - 1], X, Q) ? (p[h - 2] += X, p[h - 1] += Q, l.push(k)) : (p[h++] = X, p[h++] = Q, l.push(++k))); + } else { + let P = 0, F = n.getSInt32(), k = n.getSInt32(); + this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(), p[h++] = F, p[h++] = k, P += 1; + for (let V = 1; V < I; V++) { + const j = n.getSInt32(), Y = n.getSInt32(), X = F + j, Q = k + Y; + y += -0.5 * (X - F) * (Q + k), this.hasZ && n.getSInt32(), this.hasM && n.getSInt32(), V > 2 && lxe(p[h - 2], p[h - 1], j, Y) ? (p[h - 2] += j, p[h - 1] += Y) : (p[h++] = j, p[h++] = Y, P += 1), F = X, k = Q; + } + l.push(P); + } + break; + } + default: + n.skip(); + } + if (this._cache.area = y, !l.length) + return null; + if (this._tx || this._ty) { + let x = 0; + Fg(p); + for (const I of l) + p[2 * x] += this._tx, p[2 * x + 1] += this._ty, x += I; + } + return new Rl(l, p); + } +}, cve = class { + constructor(e) { + this.service = e; + } + destroy() { + } +}; +function o8i(t) { + return Array.isArray(t.source); +} +function a8i(t) { + return t?.type === "ogc-source"; +} +function l8i(t) { + const { capabilities: e } = t; + return a8i(t.source) ? new p8i(t) : o8i(t) ? new c8i(t) : e.query.supportsFormatPBF && Vi("featurelayer-pbf") ? new h8i(t) : new d8i(t); +} +async function u8i(t) { + const e = new Vpt(); + return await e.open(t, {}), e; +} +let c8i = class extends cve { + constructor(e) { + super(e), this._portsOpen = u8i(e.source).then((i) => this.client = i); + } + destroy() { + this.client.close(), this.client = null; + } + async executeQuery(e, i) { + await this._portsOpen; + const r = await this.client.invoke("queryFeatures", e.toJSON(), i); + return Vv.fromFeatureSet(r, this.service); + } +}, h8i = class extends cve { + async executeQuery(e, i) { + const { data: r } = await Zyt(this.service.source, e, i), n = !e.quantizationParameters; + return s8i.fromBuffer(r, this.service, n); + } +}, d8i = class extends cve { + async executeQuery(e, i) { + const { source: r, capabilities: n, spatialReference: s, objectIdField: o, geometryType: a } = this.service; + if (_e(e.quantizationParameters) && !n.query.supportsQuantization) { + const c = e.clone(), h = Jpe(c.quantizationParameters); + c.quantizationParameters = null; + const { data: p } = await oU(r, c, s, i), y = X5e(p, o); + return d0t(h, y), Vv.fromOptimizedFeatureSet(y, this.service); + } + const { data: l } = await oU(r, e, this.service.spatialReference, i); + return a === "esriGeometryPoint" && (l.features = l.features?.filter((c) => { + if (_e(c.geometry)) { + const h = c.geometry; + return Number.isFinite(h.x) && Number.isFinite(h.y); + } + return !0; + })), Vv.fromFeatureSet(l, this.service); + } +}, p8i = class extends cve { + async executeQuery(e, i) { + const { capabilities: r } = this.service; + if (e.quantizationParameters && !r.query.supportsQuantization) { + const s = e.clone(), o = Jpe(s.quantizationParameters); + s.quantizationParameters = null; + const a = await rRe(this.service.source, e, i); + return d0t(o, a), Vv.fromOptimizedFeatureSet(a, this.service); + } + const n = await rRe(this.service.source, e, i); + return Vv.fromOptimizedFeatureSet(n, this.service); + } +}, Y_ = class ece { + constructor() { + this.version = 0, this.source = !1, this.targets = { feature: !1, aggregate: !1 }, this.storage = { filters: !1, data: !1 }, this.mesh = !1, this.queryFilter = !1, this.why = { mesh: [], source: [] }; + } + static create(e) { + const i = new ece(); + for (const r in e) { + const n = e[r]; + if (typeof n == "object") + for (const s in n) { + const o = n[s]; + i[r][s] = o; + } + i[r] = n; + } + return i; + } + static empty() { + return ece.create({}); + } + static all() { + return ece.create({ source: !0, targets: { feature: !0, aggregate: !0 }, storage: { filters: !0, data: !0 }, mesh: !0 }); + } + unset(e) { + this.version = e.version, e.source && (this.source = !1), e.targets.feature && (this.targets.feature = !1), e.targets.aggregate && (this.targets.aggregate = !1), e.storage.filters && (this.storage.filters = !1), e.storage.data && (this.storage.data = !1), e.mesh && (this.mesh = !1), e.queryFilter && (this.queryFilter = !1); + } + any() { + return this.source || this.mesh || this.storage.filters || this.storage.data || this.targets.feature || this.targets.aggregate || this.queryFilter; + } + describe() { + let e = 0, i = ""; + if (this.mesh) { + e += 20, i += `-> (20) Mesh needs update +`; + for (const n of this.why.mesh) + i += ` + ${n} +`; + } + if (this.source) { + e += 10, i += `-> (10) The source needs update +`; + for (const n of this.why.source) + i += ` + ${n} +`; + } + this.targets.feature && (e += 5, i += `-> (5) Feature target parameters changed +`), this.storage.filters && (e += 5, i += `-> (5) Feature filter parameters changed +`), this.targets.aggregate && (e += 4, i += `-> (4) Aggregate target parameters changed +`), this.storage.data && (e += 1, i += "-> (1) Texture storage parameters changed"); + const r = e < 5 ? "Fastest" : e < 10 ? "Fast" : e < 15 ? "Moderate" : e < 20 ? "Slow" : "Very Slow"; + console.debug(`Applying ${r} update of cost ${e}/45 `), console.debug(i); + } + toJSON() { + return { queryFilter: this.queryFilter, source: this.source, targets: this.targets, storage: this.storage, mesh: this.mesh }; + } +}, f8i = class { + constructor(e, i) { + this.requests = { done: new Array(), stream: new o4(10) }, this._edits = null, this._abortController = new AbortController(), this._version = 0, this._done = !1, this.didSend = !1, this.tile = e, this._version = i; + } + get signal() { + return this._abortController.signal; + } + get options() { + return { signal: this._abortController.signal }; + } + get empty() { + return !this.requests.done.length && ut(this.edits); + } + get edits() { + return this._edits; + } + get done() { + return this._done; + } + end() { + this._done = !0; + } + clear() { + this.requests.done = []; + } + applyUpdate(e) { + this.requests.done.forEach((i) => i.message.status.unset(e)), this._version = e.version, _e(this._edits) && this._edits.status.unset(e); + } + add(e) { + e.message.status = e.message.status ?? Y_.empty(), e.message.status.version = this._version, Vi("esri-2d-update-debug") && console.debug(this.tile.id, "DataTileSubscription:add", this._version), e.message.end && this.requests.done.forEach((i) => { + _e(i.message) && i.message.end && (i.message.end = !1); + }), this.requests.done.push(e); + } + edit(e, i) { + const r = e.getQuantizationTransform(), n = e.fullSchema(), s = Array.from(e.features()).filter(_e), o = [...i, ...s.map((a) => a.objectId)]; + if (this.removeIds(o), this._invalidate(), ut(this._edits)) + return void (this._edits = { type: "append", addOrUpdate: Vv.fromOptimizedFeatures(s, n, r), id: this.tile.id, status: Y_.empty(), end: !0 }); + this.requests.done.forEach((a) => a.message.end = !1), this._edits.addOrUpdate.append(e.features()); + } + *readers() { + for (const { message: e } of this.requests.done) + _e(e.addOrUpdate) && (yield e.addOrUpdate); + _e(this._edits) && _e(this._edits.addOrUpdate) && (yield this._edits.addOrUpdate); + } + _invalidate() { + for (const e of this.requests.done) + e.message.status = Y_.empty(); + _e(this._edits) && (this._edits.status = Y_.empty()); + } + removeIds(e) { + this._invalidate(); + for (const { message: i } of this.requests.done) { + const r = i.addOrUpdate; + _e(r) && (r.removeIds(e), r.isEmpty && (Vi("esri-2d-update-debug") && console.debug("Removing FeatureSetReader"), i.addOrUpdate = null)); + } + _e(this._edits) && _e(this._edits.addOrUpdate) && this._edits.addOrUpdate.removeIds(e), this.requests.done = this.requests.done.filter((i) => i.message.addOrUpdate || i.message.end); + } + abort() { + this._abortController.abort(); + } +}; +function m8i(t, e) { + const i = /* @__PURE__ */ new Set(); + return t && t.forEach((r) => i.add(r)), e && e.forEach((r) => i.add(r)), i.has("*") ? ["*"] : Array.from(i); +} +let NAt = class extends vn { + constructor(e) { + super(), this.events = new Bd(), this._resolver = mm(), this._didEdit = !1, this._subscriptions = /* @__PURE__ */ new Map(), this._outSR = e.outSR, this._serviceInfo = e.serviceInfo, this._onTileUpdateMessage = e.onMessage; + } + async _onMessage(e) { + const i = this._subscriptions.get(e.id); + if (!i) + return; + const r = { ...e, remove: e.remove ?? [], status: e.status ?? Y_.empty() }; + return Ef(this._onTileUpdateMessage(r, i.options)); + } + update(e, i) { + const r = i.fields.length; + i.outFields = m8i(this._schema?.outFields, i.outFields), i.outFields = i.outFields.length >= 0.75 * r ? ["*"] : i.outFields, i.outFields.sort(); + const n = zS(this._schema, i); + if (!n) + return; + Vi("esri-2d-update-debug") && console.debug("Applying Update - Source:", n); + const s = "orderByFields" in this._serviceInfo && this._serviceInfo.orderByFields ? this._serviceInfo.orderByFields : this._serviceInfo.objectIdField + " ASC", o = { returnCentroid: this._serviceInfo.geometryType === "esriGeometryPolygon", returnGeometry: !0, timeReferenceUnknownClient: this._serviceInfo.type !== "stream" && this._serviceInfo.timeReferenceUnknownClient, outFields: i.outFields, outSpatialReference: this._outSR, orderByFields: [s], where: i.definitionExpression || "1=1", gdbVersion: i.gdbVersion, historicMoment: i.historicMoment, timeExtent: i.timeExtent ? Ny.fromJSON(i.timeExtent) : null }, a = this._schema && zO(n, "outFields"); + this._schema && czt(n, ["timeExtent", "definitionExpression", "gdbVersion", "historicMoment", "customParameters"]) && (e.why.mesh.push("Layer filter and/or custom parameters changed"), e.why.source.push("Layer filter and/or custom parameters changed"), e.mesh = !0, e.source = !0, e.queryFilter = !0), a && (e.why.source.push("Layer required fields changed"), e.source = !0), zS(o, this._queryInfo) && (this._queryInfo = o), this._schema = i, this._resolver.resolve(); + } + whenInitialized() { + return this._resolver.promise; + } + async applyUpdate(e) { + if (e.queryFilter || e.source && this._didEdit) + return this.refresh(e.version), void (this._didEdit = !1); + this._subscriptions.forEach((i) => i.applyUpdate(e)), await this.resend(); + } + refresh(e, i) { + for (const r of this._tiles()) + this.unsubscribe(r), this.subscribe(r, e); + } + subscribe(e, i) { + const r = new f8i(e, i); + this._subscriptions.set(e.id, r); + } + unsubscribe(e) { + const i = this.getSubscription(e.id); + _e(i) && i.abort(), this._subscriptions.delete(e.id); + } + createQuery(e = {}) { + const i = this._queryInfo.historicMoment ? new Date(this._queryInfo.historicMoment) : null; + return new Os({ ...this._queryInfo, historicMoment: i, ...e }); + } + getSubscription(e) { + return this._subscriptions.has(e) ? this._subscriptions.get(e) : null; + } + async queryLastEditDate() { + throw new Error("Service does not support query type"); + } + async query(e, i) { + throw new Error("Service does not support query"); + } + *_tiles() { + const e = Array.from(this._subscriptions.values()); + for (const i of e) + yield i.tile; + } + async edit(e, i) { + const r = Array.from(this._subscriptions.values()), n = r.map(({ tile: s }) => s); + for (const s of r) + s.removeIds(i); + if (e.length) { + const s = n.map((a) => { + const l = this.createTileQuery(a); + return l.objectIds = e, { tile: a, query: l }; + }).map(async ({ tile: a, query: l }) => ({ tile: a, result: await this.query(l, { query: { tile: Vi("esri-tiles-debug") ? a.id.replace(/\//g, ".") : void 0 } }), query: l })), o = (await DZ(s)).map(async ({ tile: a, result: l }) => { + if (!l.hasFeatures && !i.length && !e.length) + return; + const c = this._subscriptions.get(a.key.id); + c && c.edit(l, e); + }); + await Nu(o); + } + this._didEdit = !0; + } +}; +const g8i = 4; +let E8e = class extends NAt { + constructor(e) { + super(e), this.type = "feature", this.mode = "on-demand", this._adapter = l8i(e.serviceInfo), this._queue = new S$({ concurrency: 8, process: async (i) => { + if (hn(i), _e(i.tile)) { + const r = i.tile.key.id, { signal: n } = i, s = Vi("esri-tiles-debug") ? { tile: r.replace(/\//g, "."), depth: i.depth } : void 0, o = await this._adapter.executeQuery(i.query, { signal: n, query: { ...s, ...this._schema?.customParameters } }); + return o.level = i.tile.key.level, o; + } + return this._adapter.executeQuery(i.query, { ...i, query: this._schema?.customParameters }); + } }), this._patchQueue = new S$({ concurrency: 8, process: async (i) => { + if (hn(i), _e(i.tile)) { + const r = i.tile.key.id, { signal: n } = i, s = Vi("esri-tiles-debug") ? { tile: r.replace(/\//g, "."), depth: i.depth } : void 0, o = await this._adapter.executeQuery(i.query, { signal: n, query: { ...s, ...this._schema?.customParameters } }); + return o.level = i.tile.key.level, o; + } + return this._adapter.executeQuery(i.query, { ...i, query: this._schema?.customParameters }); + } }); + } + destroy() { + super.destroy(), this._adapter.destroy(), this._queue.destroy(), this._patchQueue.destroy(); + } + get updating() { + return !!this._queue.length || Array.from(this._subscriptions.values()).some((e) => !e.done); + } + get maxRecordCountFactor() { + const { query: e } = this._serviceInfo.capabilities; + return e.supportsMaxRecordCountFactor ? g8i : null; + } + get maxPageSize() { + const { query: e } = this._serviceInfo.capabilities; + return (e.maxRecordCount ?? 8e3) * Gu(this.maxRecordCountFactor, 1); + } + get pageSize() { + return Math.min(8e3, this.maxPageSize); + } + enableEvent(e, i) { + } + subscribe(e, i) { + super.subscribe(e, i); + const r = this._subscriptions.get(e.id); + this._fetchDataTile(e).catch((n) => { + us(n) || Ei.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new ot("mapview-query-error", "Encountered error when fetching tile", { tile: e, error: n })); + }).then(() => r.end()); + } + unsubscribe(e) { + super.unsubscribe(e); + } + readers(e) { + return this._subscriptions.get(e).readers(); + } + async query(e, i = {}) { + const r = i.query ?? {}; + return this._adapter.executeQuery(e, { ...i, query: { ...r, ...this._schema?.customParameters } }); + } + async queryLastEditDate() { + const e = this._serviceInfo.source, i = { ...e.query, f: "json" }; + return (await ir(e.path, { query: i, responseType: "json" })).data.editingInfo.lastEditDate; + } + createTileQuery(e, i = {}) { + const r = this._serviceInfo.geometryType, n = this.createQuery(i); + n.quantizationParameters = i.quantizationParameters ?? e.getQuantizationParameters(), n.resultType = "tile", n.geometry = e.extent, this._serviceInfo.capabilities.query.supportsQuantization ? r === "esriGeometryPolyline" && (n.maxAllowableOffset = e.resolution * Vi("feature-polyline-generalization-factor")) : r !== "esriGeometryPolyline" && r !== "esriGeometryPolygon" || (n.maxAllowableOffset = e.resolution, r === "esriGeometryPolyline" && (n.maxAllowableOffset *= Vi("feature-polyline-generalization-factor"))); + const s = this._serviceInfo.capabilities.query; + return n.defaultSpatialReferenceEnabled = s.supportsDefaultSpatialReference, n.compactGeometryEnabled = s.supportsCompactGeometry, n; + } + async _executePatchQuery(e, i, r, n) { + const s = i.clone(); + s.outFields = [this._serviceInfo.objectIdField, ...r], s.returnCentroid = !1, s.returnGeometry = !1; + const o = _e(s.start) ? s.start / 8e3 : 0, a = n.signal; + return this._patchQueue.push({ tile: e, query: s, signal: a, depth: o }); + } + async _resend(e, i) { + const { query: r, message: n } = e, s = _e(r.outFields) ? r.outFields : [], o = this._queryInfo.outFields, a = o.filter((l) => !s.includes(l)); + if (ut(n.addOrUpdate)) + this._onMessage({ ...n, type: "append" }); + else if (a.length) + try { + const l = this._subscriptions.get(n.id).tile, c = await this._executePatchQuery(l, r, a, i); + hn(i), r.outFields = o, n.addOrUpdate.joinAttributes(c), this._onMessage({ ...n, end: n.end, type: "append" }); + } catch { + } + else + this._onMessage({ ...n, type: "append" }); + } + async _resendSubscription(e) { + if (Vi("esri-2d-update-debug") && console.debug(e.tile.id, "Resend Subscription"), e.empty) + return this._onMessage({ id: e.tile.id, addOrUpdate: null, end: !1, type: "append" }); + const i = e.signal; + for (const r of e.requests.done) + await this._resend(r, { signal: i }); + return _e(e.edits) ? this._onMessage(e.edits) : void 0; + } + async resend() { + const e = Array.from(this._subscriptions.values()); + await Promise.all(e.map((i) => this._resendSubscription(i))); + } +}; +const HJe = Vi("esri-mobile"), WJe = { maxDrillLevel: HJe ? 1 : 4, maxRecordCountFactor: HJe ? 1 : 3 }; +let y8i = class extends E8e { + constructor(e) { + super(e); + } + async _fetchDataTile(e) { + const i = this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor, r = this._subscriptions.get(e.key.id), n = r.signal, s = e.getQuantizationParameters(); + let o = 0; + const a = async (l, c) => { + const h = this._queryInfo, p = this.createTileQuery(l, { maxRecordCountFactor: i ? WJe.maxRecordCountFactor : void 0, returnExceededLimitFeatures: !1, quantizationParameters: s }); + o++; + try { + const y = await this._queue.push({ tile: e, query: p, signal: n, depth: c }); + if (o--, hn(n), !y) + return; + if (h !== this._queryInfo) + return void a(l, c); + if (y.exceededTransferLimit && c < WJe.maxDrillLevel) { + for (const x of l.createChildTiles()) + a(x, c + 1); + return; + } + const v = { id: e.id, addOrUpdate: y, end: o === 0, type: "append" }; + r.add({ query: p, message: v }), this._onMessage(v); + } catch (y) { + us(y) || this._onMessage({ id: e.id, addOrUpdate: null, end: !0, type: "append" }); + } + }; + a(e, 0); + } +}, v8i = class extends E8e { + constructor(e) { + super(e); + } + async _fetchDataTile(e) { + const n = this._subscriptions.get(e.key.id); + let s = !1, o = 0, a = 0; + const l = (p, y) => { + a--, hn(n); + const v = e.id, x = p.reader, I = p.query; + if (!x.exceededTransferLimit) { + if (s = !0, y !== 0 && !x.hasFeatures) { + const k = { id: v, addOrUpdate: x, end: a === 0, type: "append" }; + return n.add({ message: k, query: I }), void this._onMessage(k); + } + const F = { id: v, addOrUpdate: x, end: a === 0, type: "append" }; + return n.add({ message: F, query: I }), void this._onMessage(F); + } + const P = { id: v, addOrUpdate: x, end: s && a === 0, type: "append" }; + n.add({ message: P, query: I }), this._onMessage(P); + }; + let c = 0, h = 0; + for (; !s && h++ < 20; ) { + let p; + for (let y = 0; y < c + 1; y++) { + const v = o++; + a++, p = this._fetchDataTilePage(e, v, n).then((x) => x && l(x, v)).catch((x) => { + s = !0, us(x) || (Ei.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new ot("mapview-query-error", "Encountered error when fetching tile", { tile: e, error: x })), this._onMessage({ id: e.id, addOrUpdate: null, end: s, type: "append" })); + }); + } + await p, hn(n), c = Math.min(c + 2, 6); + } + } + async _fetchDataTilePage(e, i, r) { + hn(r); + const n = this._queryInfo, s = { start: this.pageSize * i, num: this.pageSize, returnExceededLimitFeatures: !0, quantizationParameters: e.getQuantizationParameters() }; + _e(this.maxRecordCountFactor) && (s.maxRecordCountFactor = this.maxRecordCountFactor); + const o = this.createTileQuery(e, s); + try { + const a = r.signal, l = await this._queue.push({ tile: e, query: o, signal: a, depth: i }); + return hn(r), l ? n !== this._queryInfo ? this._fetchDataTilePage(e, i, r) : { reader: l, query: o } : null; + } catch (a) { + return eI(a), null; + } + } +}; +function _8i(t, e, i) { + const r = t.getXHydrated(), n = t.getYHydrated(), s = e.getColumnForX(r), o = Math.floor(e.normalizeCol(s)); + return `${i}/${Math.floor(e.getRowForY(n))}/${o}`; +} +function uxe(t, e) { + if (ut(t)) + return null; + const i = e.transform, r = t.getQuantizationTransform(); + if (ut(r)) { + const [P, F] = i.scale, [k, V] = i.translate, j = -k / P, Y = 1 / P, X = V / F, Q = 1 / -F; + return t.transform(j, X, Y, Q); + } + const [n, s] = r.scale, [o, a] = r.translate, [l, c] = i.scale, [h, p] = i.translate, y = n / l, v = (o - h) / l, x = s / c, I = (-a + p) / c; + return t.transform(v, I, y, x); +} +let b8i = class extends E8e { + constructor(e) { + super(e), this.mode = "snapshot", this._loading = !0, this._controller = new AbortController(), this._downloadPromise = null, this._didSendEnd = !1, this._queries = new Array(), this._invalidated = !1, this._hasAggregates = !1, this._random = new VE(1e3), this._store = e.store, this._markedIdsBufId = this._store.storage.createBitset(); + } + destroy() { + super.destroy(), this._controller.abort(); + } + get loading() { + return this._loading; + } + get _signal() { + return this._controller.signal; + } + update(e, i) { + super.update(e, i), this._featureCount == null && (this._featureCount = i.initialFeatureCount), _e(i.changedFeatureCount) && (this._featureCount = i.changedFeatureCount), this._hasAggregates = !!e.targets?.aggregate; + } + async resend(e = !1) { + if (await this._downloadPromise, this._invalidated || e) { + const r = Ru(this._featureCount, "Expected featureCount to be defined"); + return this._invalidated = !1, this._subscriptions.forEach((n) => n.clear()), this._downloadPromise = this._download(r), void await this._downloadPromise; + } + const i = this._queries.map(({ query: r, reader: n }) => this._sendPatchQuery(r, n)); + await Promise.all(i), this._subscriptions.forEach((r) => { + r.requests.done.forEach((n) => this._onMessage(n.message)); + }); + } + async refresh(e, i) { + i && (this._featureCount = i.featureCount), await this.resend(!0); + } + async _sendPatchQuery(e, i) { + const r = _e(e.outFields) ? e.outFields : [], n = this._queryInfo.outFields, s = n.filter((c) => !r.includes(c)); + if (!s.length) + return; + const o = e.clone(), a = this._signal; + o.returnGeometry = !1, o.returnCentroid = !1, o.outFields = s, e.outFields = n; + const l = await this._queue.push({ query: o, depth: 0, signal: a }); + hn({ signal: a }), i.joinAttributes(l); + } + async _fetchDataTile(e) { + if (!this._downloadPromise) { + const l = Ru(this._featureCount, "Expected featureCount to be defined"); + this._downloadPromise = this._download(l); + } + const i = this._store.search(e), r = this._subscriptions.get(e.key.id), n = i.length - 1; + for (let l = 0; l < n; l++) { + const c = uxe(i[l], e), h = { type: "append", id: e.id, addOrUpdate: c, end: !1, status: Y_.empty() }; + r.add({ query: null, message: h }), this._hasAggregates || await _4(1), this._onMessage(h); + } + const s = uxe(n >= 0 ? i[n] : null, e), o = this._didSendEnd, a = { type: "append", id: e.id, addOrUpdate: s, end: o, status: Y_.empty() }; + r.add({ query: null, message: a }), this._onMessage(a); + } + async _download(e) { + try { + await this.whenInitialized(); + const i = this._store.storage.getBitset(this._markedIdsBufId), r = /* @__PURE__ */ new Set(); + i.clear(); + const n = Math.ceil(e / this.pageSize), s = Array.from({ length: n }, (o, a) => a).sort((o, a) => this._random.getInt() - this._random.getInt()).map((o) => this._downloadPage(o, i, r)); + await Promise.all(s), this._store.sweepFeatures(i, this._store.storage), this._store.sweepFeatureSets(r); + } catch (i) { + Ei.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource").error("mapview-snapshot-source", "Encountered and error when downloading feature snapshot", i); + } + this._sendEnd(), this._loading = !1; + } + async _downloadPage(e, i, r) { + const n = this.pageSize, s = { start: e * n, num: n, cacheHint: !0 }; + _e(this.maxRecordCountFactor) && (s.maxRecordCountFactor = this.maxRecordCountFactor); + const o = this.createQuery(s), a = this._signal, l = await this._queue.push({ query: o, depth: e, signal: a }); + hn({ signal: a }), this._queries.push({ query: o, reader: l }), this._store.insert(l), r.add(l.instance); + const c = l.getCursor(); + for (; c.next(); ) + i.set(c.getDisplayId()); + this._send(l); + } + _send(e) { + if (!this._subscriptions.size) + return; + let i = null; + const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(); + this._subscriptions.forEach((o) => { + const a = o.tile; + r.set(a.key.id, null), i = a.tileInfoView, n.add(a.level); + const { row: l, col: c } = a.key, h = `${a.level}/${l}/${c}`, p = s.get(h) ?? []; + p.push(o), s.set(h, p); + }); + for (const o of n) { + const a = i.getLODInfoAt(o), l = e.getCursor(); + for (; l.next(); ) { + const c = _8i(l, a, o), h = l.getIndex(); + if (s.has(c)) + for (const p of s.get(c)) { + const y = p.tile.id; + let v = r.get(y); + ut(v) && (v = [], r.set(y, v)), v.push(h); + } + } + } + r.forEach((o, a) => { + if (_e(o)) { + const l = this._subscriptions.get(a), c = { type: "append", id: a, addOrUpdate: uxe(FAt.from(e, o), l.tile), end: !1, status: Y_.empty() }; + l.add({ query: null, message: c }), this._onMessage(c); + } + }); + } + _sendEnd() { + this._subscriptions.forEach((e) => { + const i = { type: "append", id: e.tile.id, addOrUpdate: null, end: !0, status: Y_.empty() }; + e.add({ query: null, message: i }), this._onMessage(i); + }), this._didSendEnd = !0; + } +}; +const w8i = "__esri_stream_id__", qJe = "__esri_timestamp__", YJe = 1e3; +let x8i = class { + constructor(e, i, r, n, s = 128) { + this._trackIdToObservations = /* @__PURE__ */ new Map(), this._idCounter = 0, this._lastPurge = performance.now(), this._addOrUpdated = /* @__PURE__ */ new Map(), this._removed = [], this._maxAge = 0, this._timeInfo = r, this._purgeOptions = n, this.store = e, this.objectIdField = i, this.purgeInterval = s, this._useGeneratedIds = this.objectIdField === w8i; + } + removeById(e) { + this._removed.push(e); + } + removeByTrackId(e) { + const i = this._trackIdToObservations.get(e); + if (i) + for (const r of i.entries) + this._removed.push(r); + } + add(e) { + if (this._useGeneratedIds) { + const s = this._nextId(); + e.attributes[this.objectIdField] = s, e.objectId = s; + } else + e.objectId = e.attributes[this.objectIdField]; + const i = e.objectId; + if (this._addOrUpdated.set(i, e), this._maxAge = Math.max(this._maxAge, e.attributes[this._timeInfo.startTimeField]), !this._timeInfo.trackIdField) + return ut(this._trackIdLessObservations) && (this._trackIdLessObservations = new o4(1e5)), void this._trackIdLessObservations.enqueue(i); + const r = e.attributes[this._timeInfo.trackIdField]; + if (!this._trackIdToObservations.has(r)) { + const s = _e(this._purgeOptions) && this._purgeOptions.maxObservations != null ? this._purgeOptions.maxObservations : YJe, o = ru(s, 0, YJe); + this._trackIdToObservations.set(r, new o4(o)); + } + const n = this._trackIdToObservations.get(r)?.enqueue(i); + _e(n) && (this._addOrUpdated.has(n) ? this._addOrUpdated.delete(n) : this._removed.push(n)); + } + checkForUpdates() { + const e = this._getToAdd(), i = this._getToRemove(), r = performance.now(); + r - this._lastPurge >= this.purgeInterval && (this._purge(r), this._lastPurge = r); + const n = []; + if (_e(i)) + for (const o of i) { + const a = this.store.removeById(o); + _e(a) && n.push(a); + } + const s = []; + if (_e(e)) { + const o = new Set(Gu(i, [])); + for (const a of e) + o.has(a.objectId) || (a.attributes[qJe] = r, this.store.add(a), s.push(a)); + } + (s.length || n?.length) && this.store.update(s, n); + } + _getToAdd() { + if (!this._addOrUpdated.size) + return null; + const e = new Array(this._addOrUpdated.size); + let i = 0; + return this._addOrUpdated.forEach((r) => e[i++] = r), this._addOrUpdated.clear(), e; + } + _getToRemove() { + const e = this._removed; + return this._removed.length ? (this._removed = [], e) : null; + } + _nextId() { + const e = this._idCounter; + return this._idCounter = (this._idCounter + 1) % 4294967294 + 1, e; + } + _purge(e) { + const i = this._purgeOptions; + _e(i) && (this._purgeSomeByDisplayCount(i), this._purgeByAge(i), this._purgeByAgeReceived(e, i), this._purgeTracks()); + } + _purgeSomeByDisplayCount(e) { + if (!e.displayCount) + return; + let i = this.store.size; + if (i > e.displayCount) { + if (this._timeInfo.trackIdField) { + for (const r of this._trackIdToObservations.values()) + if (i > e.displayCount && r.size) { + const n = r.dequeue(); + this._removed.push(n), i--; + } + } + if (_e(this._trackIdLessObservations)) { + let r = i - e.displayCount; + for (; r-- > 0; ) { + const n = this._trackIdLessObservations.dequeue(); + _e(n) && this._removed.push(n); + } + } + } + } + _purgeByAge(e) { + const i = this._timeInfo?.startTimeField; + if (!e.age || !i) + return; + const r = 60 * e.age * 1e3, n = this._maxAge - r; + this.store.forEach((s) => { + s.attributes[i] < n && this._removed.push(s.objectId); + }); + } + _purgeByAgeReceived(e, i) { + if (!i.ageReceived) + return; + const r = e - 60 * i.ageReceived * 1e3; + this.store.forEach((n) => { + n.attributes[qJe] < r && this._removed.push(n.objectId); + }); + } + _purgeTracks() { + this._trackIdToObservations.forEach((e, i) => { + e.size === 0 && this._trackIdToObservations.delete(i); + }); + } +}, tce = class extends Bd.EventedAccessor { + destroy() { + this.emit("destroy"); + } + get connectionError() { + return this.errorString ? new ot("stream-connection", this.errorString) : null; + } + onFeature(e) { + this.emit("data-received", e); + } + onMessage(e) { + this.emit("message-received", e); + } +}; +E([N({ readOnly: !0 })], tce.prototype, "connectionError", null), tce = E([dt("esri.layers.support.StreamConnection")], tce); +const kAt = tce; +var hG; +(function(t) { + t[t.CONNECTING = 0] = "CONNECTING", t[t.OPEN = 1] = "OPEN", t[t.CLOSING = 2] = "CLOSING", t[t.CLOSED = 3] = "CLOSED"; +})(hG || (hG = {})); +let dG = class extends kAt { + constructor(e) { + super(), this._outstandingMessages = [], this.errorString = null; + const { geometryType: i, spatialReference: r, sourceSpatialReference: n } = e; + this._config = e, this._featureZScaler = Cz(i, n, r), this._open(); + } + async _open() { + await this._tryCreateWebSocket(), this.destroyed || await this._handshake(); + } + destroy() { + super.destroy(), _e(this._websocket) && (this._websocket.onopen = null, this._websocket.onclose = null, this._websocket.onerror = null, this._websocket.onmessage = null, this._websocket.close()), this._websocket = null; + } + get connectionStatus() { + if (ut(this._websocket)) + return "disconnected"; + switch (this._websocket.readyState) { + case hG.CONNECTING: + case hG.OPEN: + return "connected"; + case hG.CLOSING: + case hG.CLOSED: + return "disconnected"; + } + } + sendMessageToSocket(e) { + ut(this._websocket) ? this._outstandingMessages.push(e) : this._websocket.send(JSON.stringify(e)); + } + sendMessageToClient(e) { + this._onMessage(e); + } + updateCustomParameters(e) { + this._config.customParameters = e, _e(this._websocket) && this._websocket.close(); + } + async _tryCreateWebSocket(e = this._config.source.path, i = 1e3, r = 0) { + try { + if (this.destroyed) + return; + const n = M0(e, this._config.customParameters ?? {}); + this._websocket = await this._createWebSocket(n), this.notifyChange("connectionStatus"); + } catch (n) { + const s = i / 1e3; + return this._config.maxReconnectionAttempts && r >= this._config.maxReconnectionAttempts ? (Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Exceeded maxReconnectionAttempts attempts. No further attempts will be made")), void this.destroy()) : (Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", `Failed to connect. Attempting to reconnect in ${s}s`, n)), await _4(i), this._tryCreateWebSocket(e, Math.min(1.5 * i, 1e3 * this._config.maxReconnectionInterval), r + 1)); + } + } + _setWebSocketJSONParseHandler(e) { + e.onmessage = (i) => { + try { + const r = JSON.parse(i.data); + this._onMessage(r); + } catch (r) { + return void Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Failed to parse message, invalid JSON", { error: r })); + } + }; + } + _createWebSocket(e) { + return new Promise((i, r) => { + const n = new WebSocket(e); + n.onopen = () => { + if (n.onopen = null, this.destroyed) + return n.onclose = null, void n.close(); + n.onclose = (s) => this._onClose(s), n.onerror = (s) => this._onError(s), this._setWebSocketJSONParseHandler(n), i(n); + }, n.onclose = (s) => { + n.onopen = n.onclose = null, r(s); + }; + }); + } + async _handshake(e = 1e4) { + const i = this._websocket; + if (ut(i)) + return; + const r = mm(), n = i.onmessage, { filter: s, outFields: o, spatialReference: a } = this._config; + return r.timeout(e), i.onmessage = (l) => { + let c = null; + try { + c = JSON.parse(l.data); + } catch { + } + c && typeof c == "object" || (Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Protocol violation. Handshake failed - malformed message", l.data)), r.reject(), this.destroy()), c.spatialReference?.wkid !== a?.wkid && (Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", `Protocol violation. Handshake failed - expected wkid of ${a.wkid}`, l.data)), r.reject(), this.destroy()), c.format !== "json" && (Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Protocol violation. Handshake failed - format is not set", l.data)), r.reject(), this.destroy()), s && c.filter !== s && Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Tried to set filter, but server doesn't support it")), o && c.outFields !== o && Ei.getLogger(this.declaredClass).error(new ot("websocket-connection", "Tried to set outFields, but server doesn't support it")), i.onmessage = n; + for (const h of this._outstandingMessages) + i.send(JSON.stringify(h)); + this._outstandingMessages = [], r.resolve(); + }, i.send(JSON.stringify({ filter: s, outFields: o, format: "json", spatialReference: { wkid: a.wkid } })), r.promise; + } + _onMessage(e) { + if (this.onMessage(e), "type" in e) + switch (e.type) { + case "features": + case "featureResult": + for (const i of e.features) + _e(this._featureZScaler) && this._featureZScaler(i.geometry), this.onFeature(i); + } + } + _onError(e) { + const i = "Encountered an error over WebSocket connection"; + this._set("errorString", i), Ei.getLogger(this.declaredClass).error("websocket-connection", i); + } + _onClose(e) { + this._websocket = null, this.notifyChange("connectionStatus"), e.code !== 1e3 && Ei.getLogger(this.declaredClass).error("websocket-connection", `WebSocket closed unexpectedly with error code ${e.code}`), this.destroyed || this._open(); + } +}; +E([N()], dG.prototype, "connectionStatus", null), E([N()], dG.prototype, "errorString", void 0), dG = E([dt("esri.layers.graphics.sources.connections.WebSocketConnection")], dG); +const S8i = 1e4, C8i = { maxQueryDepth: 5, maxRecordCountFactor: 3 }; +let sRe = class extends dG { + constructor(e) { + super({ ...C8i, ...e }), this._buddyServicesQuery = null, this._relatedFeatures = null; + } + async _open() { + const e = await this._fetchServiceDefinition(this._config.source); + e.timeInfo.trackIdField || Ei.getLogger(this.declaredClass).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect."); + const i = this._fetchWebSocketUrl(e.streamUrls, this._config.spatialReference); + this._buddyServicesQuery || (this._buddyServicesQuery = this._queryBuddyServices()), await this._buddyServicesQuery, await this._tryCreateWebSocket(i); + const { filter: r, outFields: n } = this._config; + this.destroyed || this._setFilter(r, n); + } + _onMessage(e) { + if ("attributes" in e) { + let i; + try { + i = this._enrich(e), _e(this._featureZScaler) && this._featureZScaler(i.geometry); + } catch (r) { + return void Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Failed to parse message", r)); + } + this.onFeature(i); + } else + this.onMessage(e); + } + async _fetchServiceDefinition(e) { + const i = { f: "json", ...this._config.customParameters }, r = ir(e.path, { query: i, responseType: "json" }), n = (await r).data; + return this._serviceDefinition = n, n; + } + _fetchWebSocketUrl(e, i) { + const r = e[0], { urls: n, token: s } = r, o = this._inferWebSocketBaseUrl(n); + return M0(`${o}/subscribe`, { outSR: "" + i.wkid, token: s }); + } + _inferWebSocketBaseUrl(e) { + if (e.length === 1) + return e[0]; + for (const i of e) + if (i.includes("wss")) + return i; + return Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Unable to infer WebSocket url", e)), null; + } + async _setFilter(e, i) { + const r = this._websocket; + if (ut(r) || ut(e) && ut(i)) + return; + const n = JSON.stringify({ filter: this._serializeFilter(e, i) }); + let s = !1; + const o = mm(), a = () => { + s || (this.destroyed || this._websocket !== r || Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Server timed out when setting filter")), o.reject()); + }, l = (c) => { + const h = JSON.parse(c.data); + h.filter && (h.error && (Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Failed to set service filter", h.error)), this._set("errorString", `Could not set service filter - ${h.error}`), o.reject(h.error)), this._setWebSocketJSONParseHandler(r), s = !0, o.resolve()); + }; + return r.onmessage = l, r.send(n), setTimeout(a, S8i), o.promise; + } + _serializeFilter(e, i) { + const r = {}; + if (ut(e) && ut(i)) + return r; + if (_e(e) && e.geometry) + try { + const n = Sl(e.geometry); + if (n.type !== "extent") + throw new ot(`Expected extent but found type ${n.type}`); + r.geometry = JSON.stringify(n.shiftCentralMeridian()); + } catch (n) { + Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Encountered an error when setting connection geometryDefinition", n)); + } + return _e(e) && e.where && e.where !== "1 = 1" && e.where !== "1=1" && (r.where = e.where), _e(i) && (r.outFields = i.join(",")), r; + } + _enrich(e) { + if (!this._relatedFeatures) + return e; + const i = this._serviceDefinition.relatedFeatures.joinField, r = e.attributes[i], n = this._relatedFeatures.get(r); + if (!n) + return Ei.getLogger(this.declaredClass).warn("geoevent-connection", "Feature join failed. Is the join field configured correctly?", e), e; + const { attributes: s, geometry: o } = n; + for (const a in s) + e.attributes[a] = s[a]; + return o && (e.geometry = o), e.geometry || e.centroid || Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Found malformed feature - no geometry found", e)), e; + } + async _queryBuddyServices() { + try { + const { relatedFeatures: e, keepLatestArchive: i } = this._serviceDefinition, r = this._queryRelatedFeatures(e), n = this._queryArchive(i); + await r; + const s = await n; + if (!s) + return; + for (const o of s.features) + this.onFeature(this._enrich(o)); + } catch (e) { + Ei.getLogger(this.declaredClass).error(new ot("geoevent-connection", "Encountered an error when querying buddy services", { error: e })); + } + } + async _queryRelatedFeatures(e) { + if (!e) + return; + const i = await this._queryBuddy(e.featuresUrl); + this._addRelatedFeatures(i); + } + async _queryArchive(e) { + if (e) + return this._queryBuddy(e.featuresUrl); + } + async _queryBuddy(e) { + const i = new (await Promise.resolve().then(() => f5e)).default({ url: e }), { capabilities: r } = await i.load(), n = r.query.supportsMaxRecordCountFactor, s = r.query.supportsPagination, o = r.query.supportsCentroid, a = this._config.maxRecordCountFactor, l = i.capabilities.query.maxRecordCount, c = n ? l * a : l, h = new Os(); + if (h.outFields = Gu(this._config.outFields, ["*"]), h.where = Gu(sC(this._config.filter, "where"), "1=1"), h.returnGeometry = !0, h.returnExceededLimitFeatures = !0, h.outSpatialReference = or.fromJSON(this._config.spatialReference), o && (h.returnCentroid = !0), n && (h.maxRecordCountFactor = a), s) + return h.num = c, i.destroy(), this._queryPages(e, h); + const p = await oU(e, h, this._config.sourceSpatialReference); + return i.destroy(), p.data; + } + async _queryPages(e, i, r = [], n = 0) { + i.start = _e(i.num) ? n * i.num : null; + const { data: s } = await oU(e, i, this._config.sourceSpatialReference); + return s.exceededTransferLimit && n < (this._config.maxQueryDepth ?? 0) ? (s.features.forEach((o) => r.push(o)), this._queryPages(e, i, r, n + 1)) : (r.forEach((o) => s.features.push(o)), s); + } + _addRelatedFeatures(e) { + const i = /* @__PURE__ */ new Map(), r = e.features, n = this._serviceDefinition.relatedFeatures.joinField; + for (const s of r) { + const o = s.attributes[n]; + i.set(o, s); + } + this._relatedFeatures = i; + } +}; +sRe = E([dt("esri.layers.graphics.sources.connections.GeoEventConnection")], sRe); +const T8i = sRe; +let fX = class extends kAt { + constructor(e) { + super(), this.connectionStatus = "connected", this.errorString = null; + const { geometryType: i, spatialReference: r, sourceSpatialReference: n } = e; + this._featureZScaler = Cz(i, n, r); + } + updateCustomParameters(e) { + } + sendMessageToSocket(e) { + } + sendMessageToClient(e) { + if ("type" in e) + switch (e.type) { + case "features": + case "featureResult": + for (const i of e.features) + _e(this._featureZScaler) && this._featureZScaler(i.geometry), this.onFeature(i); + } + this.onMessage(e); + } +}; +E([N()], fX.prototype, "connectionStatus", void 0), E([N()], fX.prototype, "errorString", void 0), fX = E([dt("esri.layers.support.ClientSideConnection")], fX); +function $At(t, e, i, r, n, s, o, a) { + const l = { source: t, sourceSpatialReference: e, spatialReference: i, geometryType: r, filter: n, maxReconnectionAttempts: s, maxReconnectionInterval: o, customParameters: a }; + return t ? t.path.startsWith("wss://") || t.path.startsWith("ws://") ? new dG(l) : new T8i(l) : new fX(l); +} +const E8i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createConnection: $At +}, Symbol.toStringTag, { value: "Module" })), I8i = 2500; +function A8i(t, e) { + const i = t.weakClone(); + if (_e(t.geometry)) { + const r = gJ(e, t.geometry.coords[0]), n = yJ(e, t.geometry.coords[1]); + i.geometry = new Rl([], [r, n]); + } + return i; +} +function P8i(t) { + return t === "esriGeometryPoint" ? A8i : (e, i) => { + const r = e.weakClone(), n = new Rl(), s = !1, o = !1, a = YO(n, e.geometry, s, o, t, i, !1, !1); + return r.geometry = a, r; + }; +} +function O8i(t) { + return t === "esriGeometryPoint" ? (e) => _e(e.geometry) ? { minX: e.geometry.coords[0], minY: e.geometry.coords[1], maxX: e.geometry.coords[0], maxY: e.geometry.coords[1] } : { minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 } : (e) => { + let i = 1 / 0, r = 1 / 0, n = -1 / 0, s = -1 / 0; + return _e(e.geometry) && e.geometry.forEachVertex((o, a) => { + i = Math.min(i, o), r = Math.min(r, a), n = Math.max(n, o), s = Math.max(s, a); + }), { minX: i, minY: r, maxX: n, maxY: s }; + }; +} +function R8i(t, e) { + const i = C$(9, O8i(e)); + return i.load(t), i; +} +function M8i(t, e) { + return t.search({ minX: e.bounds[0], minY: e.bounds[1], maxX: e.bounds[2], maxY: e.bounds[3] }); +} +let D8i = class { + constructor(e, i) { + this.onUpdate = e, this._geometryType = i, this._objectIdToFeature = /* @__PURE__ */ new Map(), this._index = null; + } + get _features() { + const e = []; + return this._objectIdToFeature.forEach((i) => e.push(i)), e; + } + add(e) { + this._objectIdToFeature.set(e.objectId, e), this._index = null; + } + get(e) { + return this._objectIdToFeature.has(e) ? this._objectIdToFeature.get(e) : null; + } + forEach(e) { + this._objectIdToFeature.forEach(e); + } + search(e) { + return this._index || (this._index = R8i(this._features, this._geometryType)), M8i(this._index, e); + } + clear() { + this._index = null, this._objectIdToFeature.clear(); + } + removeById(e) { + const i = this._objectIdToFeature.get(e); + return i ? (this._objectIdToFeature.delete(e), this._index = null, i) : null; + } + update(e, i) { + this.onUpdate(e, i); + } + get size() { + return this._objectIdToFeature.size; + } +}, VV = class extends NAt { + constructor(e) { + super(e), this.type = "stream", this._updateIntervalId = 0, this._level = 0, this._updateInfo = { websocket: 0, client: 0 }, this._isPaused = !1, this._inUpdate = !1; + const { outSR: i } = e, { geometryType: r, objectIdField: n, timeInfo: s, purgeOptions: o, source: a, spatialReference: l, serviceFilter: c, maxReconnectionAttempts: h, maxReconnectionInterval: p, updateInterval: y, customParameters: v, enabledEventTypes: x } = e.serviceInfo, I = new D8i(this._onUpdate.bind(this), r), P = new x8i(I, n, s, o), F = $At(a, l, i, r, c, h, p, v ?? {}); + this._store = I, this._manager = P, this._connection = F, this._quantize = P8i(r), this._enabledEventTypes = new Set(x), this._handles = [this._connection.on("data-received", (k) => this._onFeature(k)), this._connection.on("message-received", (k) => this._onWebSocketMessage(k))], this._initUpdateInterval = () => { + let k = performance.now(); + this._updateIntervalId = setInterval(() => { + const V = performance.now(), j = V - k; + if (j > I8i) { + k = V; + const Y = Math.round(this._updateInfo.client / (j / 1e3)), X = Math.round(this._updateInfo.websocket / (j / 1e3)); + this._updateInfo.client = 0, this._updateInfo.websocket = 0, this.events.emit("updateRate", { client: Y, websocket: X }); + } + e.canAcceptRequest() && !this._inUpdate && this._manager.checkForUpdates(); + }, y); + }, this._initUpdateInterval(); + } + destroy() { + super.destroy(), this._clearUpdateInterval(), this._handles.forEach((e) => e.remove()), this._connection.destroy(); + } + _fetchDataTile() { + } + get connectionStatus() { + return this._isPaused ? "paused" : this._connection?.connectionStatus; + } + get errorString() { + return this._connection?.errorString; + } + updateCustomParameters(e) { + this._connection.updateCustomParameters(e); + } + pauseStream() { + this._isPaused || (this._isPaused = !0, this._clearUpdateInterval()); + } + resumeStream() { + this._isPaused && (this._isPaused = !1, this._initUpdateInterval()); + } + sendMessageToSocket(e) { + this._connection.sendMessageToSocket(e); + } + sendMessageToClient(e) { + this._connection.sendMessageToClient(e); + } + enableEvent(e, i) { + i ? this._enabledEventTypes.add(e) : this._enabledEventTypes.delete(e); + } + get updating() { + return !1; + } + subscribe(e, i) { + super.subscribe(e, i); + const r = this._subscriptions.get(e.id); + this._level = e.level; + const n = this._getTileFeatures(e); + this._onMessage({ type: "append", id: e.key.id, addOrUpdate: n, end: !0 }), r.didSend = !0; + } + unsubscribe(e) { + super.unsubscribe(e); + } + *readers(e) { + const i = this._subscriptions.get(e), { tile: r } = i; + yield this._getTileFeatures(r); + } + createTileQuery(e) { + throw new Error("Service does not support tile queries"); + } + async resend() { + this._subscriptions.forEach((e) => { + const { tile: i } = e, r = { type: "append", id: i.id, addOrUpdate: this._getTileFeatures(i), end: !0 }; + this._onMessage(r); + }); + } + _getTileFeatures(e) { + const i = this._store.search(e).map((r) => this._quantize(r, e.transform)); + return Vv.fromOptimizedFeatures(i, this._serviceInfo, e.transform); + } + _onWebSocketMessage(e) { + if (this._enabledEventTypes.has("message-received") && this.events.emit("message-received", e), "type" in e) + switch (e.type) { + case "delete": + if (e.objectIds) + for (const i of e.objectIds) + this._manager.removeById(i); + if (e.trackIds) + for (const i of e.trackIds) + this._manager.removeByTrackId(i); + break; + case "clear": + this._store.forEach((i) => this._manager.removeById(i.objectId)); + } + } + _onFeature(e) { + this._updateInfo.websocket++; + try { + this._enabledEventTypes.has("data-received") && this.events.emit("data-received", e); + const i = q5e(e, this._serviceInfo.geometryType, !1, !1, this._serviceInfo.objectIdField); + this._manager.add(i); + } catch { + } + } + _clearUpdateInterval() { + clearInterval(this._updateIntervalId), this._updateIntervalId = 0; + } + async _onUpdate(e, i) { + this._inUpdate = !0; + try { + _e(e) && (this._updateInfo.client += e.length), this._subscriptions.forEach((n, s) => { + n.didSend && n.tile.level === this._level && this._onMessage({ type: "append", id: s, addOrUpdate: null, clear: !0, end: !1 }); + }); + const r = []; + this._subscriptions.forEach((n, s) => { + if (!n.didSend || n.tile.level !== this._level) + return; + const o = n.tile, a = { type: "append", id: s, addOrUpdate: this._getTileFeatures(o), remove: [], end: !1, status: Y_.empty() }; + n.requests.stream.enqueue(a), r.push(this._onMessage(a)); + }), await Promise.all(r), this._subscriptions.forEach((n, s) => { + n.didSend && n.tile.level === this._level && this._onMessage({ type: "append", id: s, addOrUpdate: null, end: !0 }); + }); + } catch { + } + this._inUpdate = !1; + } +}; +E([N()], VV.prototype, "_isPaused", void 0), E([N()], VV.prototype, "connectionStatus", null), E([N()], VV.prototype, "errorString", null), VV = E([dt("esri.views.2d.layers.features.sources")], VV); +function F8i(t, e, i, r, n, s) { + const o = L8i(t, e, i, r, n, s); + switch (o.type) { + case "feature": + switch (o.origin) { + case "hosted": + case "local": + return new v8i(o); + case "snapshot": + return new b8i(o); + default: + return new y8i(o); + } + case "stream": + return new VV(o); + } +} +function L8i(t, e, i, r, n, s) { + switch (t.type) { + case "snapshot": + return { type: "feature", origin: "snapshot", featureCount: Gu(t.featureCount, 0), serviceInfo: t, onMessage: r, outSR: e, tileInfoView: i, canAcceptRequest: n, store: s }; + case "stream": + return { type: "stream", serviceInfo: t, onMessage: r, outSR: e, canAcceptRequest: n }; + case "memory": + case "on-demand": + return { type: "feature", serviceInfo: t, onMessage: r, outSR: e, origin: o(t.source), tileInfoView: i, canAcceptRequest: n }; + } + function o(a) { + return Array.isArray(a) ? "local" : "path" in a && Tz(a.path) ? "hosted" : "unknown"; + } +} +const oRe = 1e-30, BAt = 4294967295, Sc = 512, N8i = 8, XJe = 10, I8e = 29, hve = 24, k8i = 8, KJe = 0, JJe = 0, lfe = 0, ufe = 1, cfe = 2, aRe = 3, lRe = 4, ice = 5, rce = 6, ZJe = 12, lq = 5, VAt = 6, $8i = 5, B8i = 6, V8i = 0, A8e = 1, hfe = 2, uRe = 3, j8i = 4, jAt = 2, G8i = 1, GAt = 2, U8i = 4, P8e = 1.05, UAt = 3, lx = 5, QJe = 6, zAt = 1.15, Cc = 2, lee = 8, z8i = 500, Dy = 10, HAt = 1024, V6 = 2, H8i = 0, W8i = 1, q8i = 4, Y8i = 8, dve = 16, WAt = 4, X8i = 1, qAt = 4, YAt = 8, K8i = 128, J8i = 4, Z8i = 2, em = 8388607, XAt = 8388608, Q8i = 254, e9i = 255, t9i = 0, O8e = 1, R8e = (t) => (t & XAt) >>> 23, pO = (t) => t & em, i9i = (t) => R8e(t) === O8e ? Q8i : e9i; +function KAt(t) { + return R8e(t) === O8e; +} +function M8e(t, e) { + return ((e ? XAt : 0) | t) >>> 0; +} +var Pf, om, vy, eZe, X_, tZe, cRe, hRe, dRe, iZe, uS, rZe, nZe, sZe, oZe, pRe, fRe, aZe, lZe, p7, Pl, Mk, uZe, cZe, fO, hZe, dZe, pG, mRe, pZe, fZe, mZe, gZe, yZe, vZe, TS, O_, _Ze, bZe, ES, wZe, xZe, SZe, CZe, Q2, XJ, mD, fG, TZe, EZe, IZe, AZe, PZe, OZe, RZe, dfe, pfe, MZe, gRe, DZe, FZe; +(function(t) { + t[t.BUTT = 0] = "BUTT", t[t.ROUND = 1] = "ROUND", t[t.SQUARE = 2] = "SQUARE", t[t.UNKNOWN = 4] = "UNKNOWN"; +})(Pf || (Pf = {})), function(t) { + t[t.BEVEL = 0] = "BEVEL", t[t.ROUND = 1] = "ROUND", t[t.MITER = 2] = "MITER", t[t.UNKNOWN = 4] = "UNKNOWN"; +}(om || (om = {})), function(t) { + t[t.SCREEN = 0] = "SCREEN", t[t.MAP = 1] = "MAP"; +}(vy || (vy = {})), function(t) { + t[t.Tint = 0] = "Tint", t[t.Ignore = 1] = "Ignore", t[t.Multiply = 99] = "Multiply"; +}(eZe || (eZe = {})), function(t) { + t.Both = "Both", t.JustBegin = "JustBegin", t.JustEnd = "JustEnd", t.None = "None"; +}(X_ || (X_ = {})), function(t) { + t[t.Mosaic = 0] = "Mosaic", t[t.Centered = 1] = "Centered"; +}(tZe || (tZe = {})), function(t) { + t[t.Normal = 0] = "Normal", t[t.Superscript = 1] = "Superscript", t[t.Subscript = 2] = "Subscript"; +}(cRe || (cRe = {})), function(t) { + t[t.MSSymbol = 0] = "MSSymbol", t[t.Unicode = 1] = "Unicode"; +}(hRe || (hRe = {})), function(t) { + t[t.Unspecified = 0] = "Unspecified", t[t.TrueType = 1] = "TrueType", t[t.PSOpenType = 2] = "PSOpenType", t[t.TTOpenType = 3] = "TTOpenType", t[t.Type1 = 4] = "Type1"; +}(dRe || (dRe = {})), function(t) { + t[t.Display = 0] = "Display", t[t.Map = 1] = "Map"; +}(iZe || (iZe = {})), function(t) { + t.None = "None", t.Loop = "Loop", t.Oscillate = "Oscillate"; +}(uS || (uS = {})), function(t) { + t[t.Z = 0] = "Z", t[t.X = 1] = "X", t[t.Y = 2] = "Y"; +}(rZe || (rZe = {})), function(t) { + t[t.XYZ = 0] = "XYZ", t[t.ZXY = 1] = "ZXY", t[t.YXZ = 2] = "YXZ"; +}(nZe || (nZe = {})), function(t) { + t[t.Rectangle = 0] = "Rectangle", t[t.RoundedRectangle = 1] = "RoundedRectangle", t[t.Oval = 2] = "Oval"; +}(sZe || (sZe = {})), function(t) { + t[t.None = 0] = "None", t[t.Alpha = 1] = "Alpha", t[t.Screen = 2] = "Screen", t[t.Multiply = 3] = "Multiply", t[t.Add = 4] = "Add"; +}(oZe || (oZe = {})), function(t) { + t[t.TTB = 0] = "TTB", t[t.RTL = 1] = "RTL", t[t.BTT = 2] = "BTT"; +}(pRe || (pRe = {})), function(t) { + t[t.None = 0] = "None", t[t.SignPost = 1] = "SignPost", t[t.FaceNearPlane = 2] = "FaceNearPlane"; +}(fRe || (fRe = {})), function(t) { + t[t.Float = 0] = "Float", t[t.String = 1] = "String", t[t.Boolean = 2] = "Boolean"; +}(aZe || (aZe = {})), function(t) { + t[t.Intersect = 0] = "Intersect", t[t.Subtract = 1] = "Subtract"; +}(lZe || (lZe = {})), function(t) { + t.OpenEnded = "OpenEnded", t.Block = "Block", t.Crossed = "Crossed"; +}(p7 || (p7 = {})), function(t) { + t.FullGeometry = "FullGeometry", t.PerpendicularFromFirstSegment = "PerpendicularFromFirstSegment", t.ReversedFirstSegment = "ReversedFirstSegment", t.PerpendicularToSecondSegment = "PerpendicularToSecondSegment", t.SecondSegmentWithTicks = "SecondSegmentWithTicks", t.DoublePerpendicular = "DoublePerpendicular", t.OppositeToFirstSegment = "OppositeToFirstSegment", t.TriplePerpendicular = "TriplePerpendicular", t.HalfCircleFirstSegment = "HalfCircleFirstSegment", t.HalfCircleSecondSegment = "HalfCircleSecondSegment", t.HalfCircleExtended = "HalfCircleExtended", t.OpenCircle = "OpenCircle", t.CoverageEdgesWithTicks = "CoverageEdgesWithTicks", t.GapExtentWithDoubleTicks = "GapExtentWithDoubleTicks", t.GapExtentMidline = "GapExtentMidline", t.Chevron = "Chevron", t.PerpendicularWithArc = "PerpendicularWithArc", t.ClosedHalfCircle = "ClosedHalfCircle", t.TripleParallelExtended = "TripleParallelExtended", t.ParallelWithTicks = "ParallelWithTicks", t.Parallel = "Parallel", t.PerpendicularToFirstSegment = "PerpendicularToFirstSegment", t.ParallelOffset = "ParallelOffset", t.OffsetOpposite = "OffsetOpposite", t.OffsetSame = "OffsetSame", t.CircleWithArc = "CircleWithArc", t.DoubleJog = "DoubleJog", t.PerpendicularOffset = "PerpendicularOffset", t.LineExcludingLastSegment = "LineExcludingLastSegment", t.MultivertexArrow = "MultivertexArrow", t.CrossedArrow = "CrossedArrow", t.ChevronArrow = "ChevronArrow", t.ChevronArrowOffset = "ChevronArrowOffset", t.PartialFirstSegment = "PartialFirstSegment", t.Arch = "Arch", t.CurvedParallelTicks = "CurvedParallelTicks", t.Arc90Degrees = "Arc90Degrees"; +}(Pl || (Pl = {})), function(t) { + t.Mitered = "Mitered", t.Bevelled = "Bevelled", t.Rounded = "Rounded", t.Square = "Square", t.TrueBuffer = "TrueBuffer"; +}(Mk || (Mk = {})), function(t) { + t.ClosePath = "ClosePath", t.ConvexHull = "ConvexHull", t.RectangularBox = "RectangularBox"; +}(uZe || (uZe = {})), function(t) { + t.BeginningOfLine = "BeginningOfLine", t.EndOfLine = "EndOfLine"; +}(cZe || (cZe = {})), function(t) { + t.Mitered = "Mitered", t.Bevelled = "Bevelled", t.Rounded = "Rounded", t.Square = "Square"; +}(fO || (fO = {})), function(t) { + t.Fast = "Fast", t.Accurate = "Accurate"; +}(hZe || (hZe = {})), function(t) { + t.BeginningOfLine = "BeginningOfLine", t.EndOfLine = "EndOfLine"; +}(dZe || (dZe = {})), function(t) { + t.Sinus = "Sinus", t.Square = "Square", t.Triangle = "Triangle", t.Random = "Random"; +}(pG || (pG = {})), function(t) { + t[t.None = 0] = "None", t[t.Default = 1] = "Default", t[t.Force = 2] = "Force"; +}(mRe || (mRe = {})), function(t) { + t[t.Buffered = 0] = "Buffered", t[t.Left = 1] = "Left", t[t.Right = 2] = "Right", t[t.AlongLine = 3] = "AlongLine"; +}(pZe || (pZe = {})), function(t) { + t[t.Linear = 0] = "Linear", t[t.Rectangular = 1] = "Rectangular", t[t.Circular = 2] = "Circular", t[t.Buffered = 3] = "Buffered"; +}(fZe || (fZe = {})), function(t) { + t[t.Discrete = 0] = "Discrete", t[t.Continuous = 1] = "Continuous"; +}(mZe || (mZe = {})), function(t) { + t[t.AcrossLine = 0] = "AcrossLine", t[t.AloneLine = 1] = "AloneLine"; +}(gZe || (gZe = {})), function(t) { + t[t.Left = 0] = "Left", t[t.Right = 1] = "Right", t[t.Center = 2] = "Center", t[t.Justify = 3] = "Justify"; +}(yZe || (yZe = {})), function(t) { + t[t.Base = 0] = "Base", t[t.MidPoint = 1] = "MidPoint", t[t.ThreePoint = 2] = "ThreePoint", t[t.FourPoint = 3] = "FourPoint", t[t.Underline = 4] = "Underline", t[t.CircularCW = 5] = "CircularCW", t[t.CircularCCW = 6] = "CircularCCW"; +}(vZe || (vZe = {})), function(t) { + t.Butt = "Butt", t.Round = "Round", t.Square = "Square"; +}(TS || (TS = {})), function(t) { + t.NoConstraint = "NoConstraint", t.HalfPattern = "HalfPattern", t.HalfGap = "HalfGap", t.FullPattern = "FullPattern", t.FullGap = "FullGap", t.Custom = "Custom"; +}(O_ || (O_ = {})), function(t) { + t[t.None = -1] = "None", t[t.Custom = 0] = "Custom", t[t.Circle = 1] = "Circle", t[t.OpenArrow = 2] = "OpenArrow", t[t.ClosedArrow = 3] = "ClosedArrow", t[t.Diamond = 4] = "Diamond"; +}(_Ze || (_Ze = {})), function(t) { + t[t.ExtraLeading = 0] = "ExtraLeading", t[t.Multiple = 1] = "Multiple", t[t.Exact = 2] = "Exact"; +}(bZe || (bZe = {})), function(t) { + t.Bevel = "Bevel", t.Round = "Round", t.Miter = "Miter"; +}(ES || (ES = {})), function(t) { + t[t.Default = 0] = "Default", t[t.String = 1] = "String", t[t.Numeric = 2] = "Numeric"; +}(wZe || (wZe = {})), function(t) { + t[t.InsidePolygon = 0] = "InsidePolygon", t[t.PolygonCenter = 1] = "PolygonCenter", t[t.RandomlyInsidePolygon = 2] = "RandomlyInsidePolygon"; +}(xZe || (xZe = {})), function(t) { + t[t.Tint = 0] = "Tint", t[t.Replace = 1] = "Replace", t[t.Multiply = 2] = "Multiply"; +}(SZe || (SZe = {})), function(t) { + t[t.ClipAtBoundary = 0] = "ClipAtBoundary", t[t.RemoveIfCenterOutsideBoundary = 1] = "RemoveIfCenterOutsideBoundary", t[t.DoNotTouchBoundary = 2] = "DoNotTouchBoundary", t[t.DoNotClip = 3] = "DoNotClip"; +}(CZe || (CZe = {})), function(t) { + t.NoConstraint = "NoConstraint", t.WithMarkers = "WithMarkers", t.WithFullGap = "WithFullGap", t.WithHalfGap = "WithHalfGap", t.Custom = "Custom"; +}(Q2 || (Q2 = {})), function(t) { + t.Fixed = "Fixed", t.Random = "Random", t.RandomFixedQuantity = "RandomFixedQuantity"; +}(XJ || (XJ = {})), function(t) { + t.LineMiddle = "LineMiddle", t.LineBeginning = "LineBeginning", t.LineEnd = "LineEnd", t.SegmentMidpoint = "SegmentMidpoint"; +}(mD || (mD = {})), function(t) { + t.OnPolygon = "OnPolygon", t.CenterOfMass = "CenterOfMass", t.BoundingBoxCenter = "BoundingBoxCenter"; +}(fG || (fG = {})), function(t) { + t[t.Low = 0] = "Low", t[t.Medium = 1] = "Medium", t[t.High = 2] = "High"; +}(TZe || (TZe = {})), function(t) { + t[t.MarkerCenter = 0] = "MarkerCenter", t[t.MarkerBounds = 1] = "MarkerBounds"; +}(EZe || (EZe = {})), function(t) { + t[t.None = 0] = "None", t[t.PropUniform = 1] = "PropUniform", t[t.PropNonuniform = 2] = "PropNonuniform", t[t.DifUniform = 3] = "DifUniform", t[t.DifNonuniform = 4] = "DifNonuniform"; +}(IZe || (IZe = {})), function(t) { + t.Tube = "Tube", t.Strip = "Strip", t.Wall = "Wall"; +}(AZe || (AZe = {})), function(t) { + t[t.Random = 0] = "Random", t[t.Increasing = 1] = "Increasing", t[t.Decreasing = 2] = "Decreasing", t[t.IncreasingThenDecreasing = 3] = "IncreasingThenDecreasing"; +}(PZe || (PZe = {})), function(t) { + t[t.Relative = 0] = "Relative", t[t.Absolute = 1] = "Absolute"; +}(OZe || (OZe = {})), function(t) { + t[t.Normal = 0] = "Normal", t[t.LowerCase = 1] = "LowerCase", t[t.Allcaps = 2] = "Allcaps"; +}(RZe || (RZe = {})), function(t) { + t[t.LTR = 0] = "LTR", t[t.RTL = 1] = "RTL"; +}(dfe || (dfe = {})), function(t) { + t.Draft = "Draft", t.Picture = "Picture", t.Text = "Text"; +}(pfe || (pfe = {})), function(t) { + t[t.Top = 0] = "Top", t[t.Center = 1] = "Center", t[t.Baseline = 2] = "Baseline", t[t.Bottom = 3] = "Bottom"; +}(MZe || (MZe = {})), function(t) { + t[t.Right = 0] = "Right", t[t.Upright = 1] = "Upright"; +}(gRe || (gRe = {})), function(t) { + t[t.Small = 0] = "Small", t[t.Medium = 1] = "Medium", t[t.Large = 2] = "Large"; +}(DZe || (DZe = {})), function(t) { + t[t.Calm = 0] = "Calm", t[t.Rippled = 1] = "Rippled", t[t.Slight = 2] = "Slight", t[t.Moderate = 3] = "Moderate"; +}(FZe || (FZe = {})); +var En, lo, mG, sd, gG, yG, Zo; +(function(t) { + t[t.FILL = 0] = "FILL", t[t.LINE = 1] = "LINE", t[t.MARKER = 2] = "MARKER", t[t.TEXT = 3] = "TEXT", t[t.LABEL = 4] = "LABEL"; +})(En || (En = {})), function(t) { + t[t.NONE = 0] = "NONE", t[t.MAP = 1] = "MAP", t[t.LABEL = 2] = "LABEL", t[t.LABEL_ALPHA = 4] = "LABEL_ALPHA", t[t.HITTEST = 8] = "HITTEST", t[t.HIGHLIGHT = 16] = "HIGHLIGHT", t[t.CLIP = 32] = "CLIP", t[t.DEBUG = 64] = "DEBUG", t[t.NUM_DRAW_PHASES = 9] = "NUM_DRAW_PHASES"; +}(lo || (lo = {})), function(t) { + t[t.SIZE = 0] = "SIZE", t[t.COLOR = 1] = "COLOR", t[t.OPACITY = 2] = "OPACITY", t[t.ROTATION = 3] = "ROTATION"; +}(mG || (mG = {})), function(t) { + t[t.NONE = 0] = "NONE", t[t.OPACITY = 1] = "OPACITY", t[t.COLOR = 2] = "COLOR", t[t.ROTATION = 4] = "ROTATION", t[t.SIZE_MINMAX_VALUE = 8] = "SIZE_MINMAX_VALUE", t[t.SIZE_SCALE_STOPS = 16] = "SIZE_SCALE_STOPS", t[t.SIZE_FIELD_STOPS = 32] = "SIZE_FIELD_STOPS", t[t.SIZE_UNIT_VALUE = 64] = "SIZE_UNIT_VALUE"; +}(sd || (sd = {})), function(t) { + t[t.MINMAX_TARGETS_OUTLINE = 128] = "MINMAX_TARGETS_OUTLINE", t[t.SCALE_TARGETS_OUTLINE = 256] = "SCALE_TARGETS_OUTLINE", t[t.FIELD_TARGETS_OUTLINE = 512] = "FIELD_TARGETS_OUTLINE", t[t.UNIT_TARGETS_OUTLINE = 1024] = "UNIT_TARGETS_OUTLINE"; +}(gG || (gG = {})), function(t) { + t[t.SPRITE = 0] = "SPRITE", t[t.GLYPH = 1] = "GLYPH"; +}(yG || (yG = {})), function(t) { + t[t.DEFAULT = 0] = "DEFAULT", t[t.SIMPLE = 1] = "SIMPLE", t[t.DOT_DENSITY = 2] = "DOT_DENSITY", t[t.OUTLINE_FILL = 3] = "OUTLINE_FILL", t[t.OUTLINE_FILL_SIMPLE = 4] = "OUTLINE_FILL_SIMPLE", t[t.HEATMAP = 5] = "HEATMAP", t[t.PIE_CHART = 6] = "PIE_CHART"; +}(Zo || (Zo = {})); +const qie = Ei.getLogger("esri.views.2d.engine.webgl.Utils"), I1 = "geometry", r9i = [{ name: I1, strideInBytes: 12 }], n9i = [{ name: I1, strideInBytes: 36 }], s9i = [{ name: I1, strideInBytes: 24 }], o9i = [{ name: I1, strideInBytes: 12 }], a9i = [{ name: I1, strideInBytes: 40 }], l9i = [{ name: I1, strideInBytes: 36 }], u9i = [{ name: I1, strideInBytes: 36 }]; +function G4(t) { + const e = {}; + for (const i of t) + e[i.name] = i.strideInBytes; + return e; +} +const c9i = G4([{ name: I1, strideInBytes: 36 }]), h9i = G4(r9i), d9i = G4(n9i), p9i = G4(s9i), f9i = G4(o9i), m9i = G4(a9i), g9i = G4(l9i), y9i = G4(u9i); +function ffe(t, e) { + switch (t) { + case En.MARKER: + return e === Zo.HEATMAP ? h9i : c9i; + case En.FILL: + switch (e) { + case Zo.DOT_DENSITY: + return f9i; + case Zo.SIMPLE: + case Zo.OUTLINE_FILL_SIMPLE: + return p9i; + default: + return d9i; + } + case En.LINE: + return m9i; + case En.TEXT: + return g9i; + case En.LABEL: + return y9i; + } +} +const v9i = [I1], _9i = [I1], b9i = [I1], w9i = [I1], x9i = [I1]; +function S9i(t) { + switch (t) { + case En.MARKER: + return v9i; + case En.FILL: + return _9i; + case En.LINE: + return b9i; + case En.TEXT: + return w9i; + case En.LABEL: + return x9i; + } +} +function KJ(t) { + switch (t % 4) { + case 0: + case 2: + return 4; + case 1: + case 3: + return 1; + } +} +function D8e(t, e) { + switch (e % 4) { + case 0: + case 2: + return new Uint32Array(Math.floor(t * e / 4)); + case 1: + case 3: + return new Uint8Array(t * e); + } +} +function mfe(t, e) { + switch (e % 4) { + case 0: + case 2: + return new Uint32Array(t); + case 1: + case 3: + return new Uint8Array(t); + } +} +function LZe(t) { + return t != null; +} +function gfe(t) { + return typeof t == "number"; +} +function C9i(t) { + switch (t) { + case "butt": + return Pf.BUTT; + case "round": + return Pf.ROUND; + case "square": + return Pf.SQUARE; + default: + return qie.error(new ot("mapview-invalid-type", `Cap type ${t} is not a valid option. Defaulting to round`)), Pf.ROUND; + } +} +function T9i(t) { + switch (t) { + case "miter": + return om.MITER; + case "bevel": + return om.BEVEL; + case "round": + return om.ROUND; + default: + return qie.error(new ot("mapview-invalid-type", `Join type ${t} is not a valid option. Defaulting to round`)), om.ROUND; + } +} +function E9i(t) { + switch (t) { + case "opacity": + return mG.OPACITY; + case "color": + return mG.COLOR; + case "rotation": + return mG.ROTATION; + case "size": + return mG.SIZE; + default: + return qie.error(`Cannot interpret unknown vv: ${t}`), null; + } +} +function yRe(t, e, i, r, n, s, o) { + for (const a in s) { + const l = s[a].stride, c = KJ(l), h = s[a].data, p = i[a].data; + if (h == null || p == null) + continue; + const y = l * n.vertexCount / c, v = l * t / c, x = l * n.vertexFrom / c; + for (let I = 0; I < y; ++I) + p[I + v] = h[I + x]; + } + if (o != null && r != null) { + const a = n.indexCount; + for (let l = 0; l < a; ++l) + r[l + e] = o[l + n.indexFrom] - n.vertexFrom + t; + } +} +const I9i = { [I1]: Vo.STATIC_DRAW }; +function A9i(t, e) { + const i = []; + for (let r = 0; r < 5; ++r) { + const n = S9i(r), s = {}; + for (const o of n) + s[o] = { data: e(r, o) }; + i.push({ data: t(r), buffers: s }); + } + return i; +} +function P9i(t) { + switch (t) { + case Fi.BYTE: + case Fi.UNSIGNED_BYTE: + return 1; + case Fi.SHORT: + case Fi.UNSIGNED_SHORT: + return 2; + case Fi.FLOAT: + case Fi.INT: + case Fi.UNSIGNED_INT: + return 4; + } +} +function O9i(t) { + switch (t) { + case rs.UNSIGNED_BYTE: + return 1; + case rs.UNSIGNED_SHORT_4_4_4_4: + return 2; + case rs.FLOAT: + return 4; + default: + return void qie.error(new ot("webgl-utils", `Unable to handle type ${t}`)); + } +} +function mX(t) { + switch (t) { + case rs.UNSIGNED_BYTE: + return Uint8Array; + case rs.UNSIGNED_SHORT_4_4_4_4: + return Uint16Array; + case rs.FLOAT: + return Float32Array; + default: + return void qie.error(new ot("webgl-utils", `Unable to handle type ${t}`)); + } +} +function R9i(t) { + const e = {}; + for (const i in t) { + const r = t[i]; + let n = 0; + e[i] = r.map((s) => { + const o = new ea(s.name, s.count, s.type, n, 0, s.normalized || !1); + return n += s.count * P9i(s.type), o; + }), e[i]?.forEach((s) => s.stride = n); + } + return e; +} +const M9i = (t) => { + const e = /* @__PURE__ */ new Map(); + for (const i in t) + for (const r of t[i]) + e.set(r.name, r.location); + return e; +}, D9i = (t) => { + const e = {}; + for (const i in t) { + const r = t[i]; + e[i] = r?.length ? r[0].stride : 0; + } + return e; +}, cxe = /* @__PURE__ */ new Map(), E3 = (t, e) => { + if (!cxe.has(t)) { + const i = R9i(e), r = { strides: D9i(i), bufferLayouts: i, attributes: M9i(e) }; + cxe.set(t, r); + } + return cxe.get(t); +}; +function vRe(t) { + t(En.FILL), t(En.LINE), t(En.MARKER), t(En.TEXT), t(En.LABEL); +} +const NZe = (t) => "path" in t && j9i(t.path), F9i = (t) => "url" in t && t.url || "imageData" in t && t.imageData, kZe = (t) => "imageData" in t && t.imageData && "contentType" in t && t.contentType ? `data:${t.contentType};base64,${t.imageData}` : "url" in t ? t.url : null, $Ze = (t) => t != null && t.startsWith("data:image/gif"), L9i = (t) => "url" in t && t.url && (t.url.includes(".gif") || $Ze(t.url)) || "contentType" in t && t.contentType === "image/gif" || "imageData" in t && $Ze(t.imageData), BZe = (t) => t != null && t.startsWith("data:image/png"), N9i = (t) => "url" in t && t.url && (t.url.includes(".png") || BZe(t.url)) || "contentType" in t && t.contentType === "image/png" || "imageData" in t && BZe(t.imageData), k9i = (t) => t.type && t.type.toLowerCase().includes("3d"); +function $9i(t) { + switch (t.type) { + case "line": { + const e = t; + return e.cim.type === "CIMSolidStroke" && !e.dashTemplate; + } + case "fill": + return t.cim.type === "CIMSolidFill"; + case "esriSFS": + return t.style === "esriSFSSolid" || t.style === "esriSFSNull"; + case "esriSLS": + return t.style === "esriSLSSolid" || t.style === "esriSLSNull"; + default: + return !1; + } +} +const B9i = (t) => t.includes("data:image/svg+xml"); +function Toe(t) { + switch ("cim" in t ? t.cim.type : t.type) { + case "esriSMS": + case "esriPMS": + case "CIMPointSymbol": + return !1; + case "CIMVectorMarker": + case "CIMCharacterMarker": + case "CIMPictureMarker": + return JAt(t); + default: + return !0; + } +} +function VZe(t) { + const e = "maxVVSize" in t && t.maxVVSize, i = "width" in t && t.width || "size" in t && t.size || 0; + return e || i; +} +function V9i(t) { + const e = []; + for (let i = 0; i < t.length; i++) + e.push(t.charCodeAt(i)); + return e; +} +const j9i = (t) => !!t && (t = t.trim(), !!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t) && /[\dz]$/i.test(t) && t.length > 4)), JAt = (t) => t.type === "fill" && t?.cim?.markerPlacement?.type === "CIMMarkerPlacementInsidePolygon", ZAt = (t, e) => t && ((...i) => e.warn("DEBUG:", ...i)) || (() => null), QAt = !1, G9i = new Float32Array(1); +new Uint32Array(G9i.buffer); +function Yie(t) { + return [255 & t, (65280 & t) >>> 8, (16711680 & t) >>> 16, (4278190080 & t) >>> 24]; +} +function Vn(t, e) { + return 65535 & t | e << 16; +} +function tf(t, e, i, r) { + return 255 & t | (255 & e) << 8 | (255 & i) << 16 | r << 24; +} +function U9i(t, e = 0, i = !1) { + const r = t[e + 3]; + return t[e + 0] *= r, t[e + 1] *= r, t[e + 2] *= r, i || (t[e + 3] *= 255), t; +} +function rf(t) { + if (!t) + return 0; + const { r: e, g: i, b: r, a: n } = t; + return tf(e * n, i * n, r * n, 255 * n); +} +function Eb(t) { + if (!t) + return 0; + const [e, i, r, n] = t; + return tf(e * (n / 255), i * (n / 255), r * (n / 255), n); +} +function vG(t, e, i = 0) { + if (ut(e)) + return t[i + 0] = 0, t[i + 1] = 0, t[i + 2] = 0, void (t[i + 3] = 0); + const { r, g: n, b: s, a: o } = e; + t[i + 0] = r * o / 255, t[i + 1] = n * o / 255, t[i + 2] = s * o / 255, t[i + 3] = o; +} +function ePt(t) { + return gfe(t.minDataValue) && gfe(t.maxDataValue) && t.minSize != null && t.maxSize != null ? sd.SIZE_MINMAX_VALUE : (t.expression && t.expression === "view.scale" || t.valueExpression && t.valueExpression === "$view.scale") && Array.isArray(t.stops) ? sd.SIZE_SCALE_STOPS : (t.field != null || t.expression && t.expression !== "view.scale" || t.valueExpression && t.valueExpression !== "$view.scale") && (Array.isArray(t.stops) || "levels" in t && t.levels) ? sd.SIZE_FIELD_STOPS : (t.field != null || t.expression && t.expression !== "view.scale" || t.valueExpression && t.valueExpression !== "$view.scale") && t.valueUnit != null ? sd.SIZE_UNIT_VALUE : (Ei.getLogger("esri.views.2d.engine.webgl").error(new ot("mapview-bad-type", "Found invalid size VisualVariable", t)), sd.NONE); +} +function z9i(t, e) { + if (!t || !e) + return t; + switch (e) { + case "radius": + case "distance": + return 2 * t; + case "diameter": + case "width": + return t; + case "area": + return Math.sqrt(t); + } + return t; +} +function H9i(t) { + return { value: t.value, size: $a(t.size) }; +} +function F8e(t) { + return (t ?? []).map((e) => H9i(e)); +} +function jZe(t) { + if (typeof t == "string" || typeof t == "number") + return $a(t); + const e = t; + return { type: "size", expression: e.expression, stops: F8e(e.stops) }; +} +const GZe = (t) => { + const e = [], i = [], r = F8e(t), n = r.length; + for (let s = 0; s < 6; s++) { + const o = r[Math.min(s, n - 1)]; + e.push(o.value), i.push(o.size == null ? oRe : dn(o.size)); + } + return { values: new Float32Array(e), sizes: new Float32Array(i) }; +}; +function W9i(t) { + const e = t && t.length > 0 ? {} : null, i = e ? {} : null; + if (!e || !i) + return { vvFields: e, vvRanges: i }; + for (const r of t) + if (r.field && (e[r.type] = r.field), r.type === "size") { + i.size || (i.size = {}); + const n = r; + switch (ePt(n)) { + case sd.SIZE_MINMAX_VALUE: + i.size.minMaxValue = { minDataValue: n.minDataValue, maxDataValue: n.maxDataValue, minSize: jZe(n.minSize), maxSize: jZe(n.maxSize) }; + break; + case sd.SIZE_SCALE_STOPS: + i.size.scaleStops = { stops: F8e(n.stops) }; + break; + case sd.SIZE_FIELD_STOPS: + if (n.levels) { + const s = {}; + for (const o in n.levels) + s[o] = GZe(n.levels[o]); + i.size.fieldStops = { type: "level-dependent", levels: s }; + } else + i.size.fieldStops = { type: "static", ...GZe(n.stops) }; + break; + case sd.SIZE_UNIT_VALUE: + i.size.unitValue = { unit: n.valueUnit, valueRepresentation: n.valueRepresentation ?? void 0 }; + } + } else if (r.type === "color") + i.color = Y9i(r); + else if (r.type === "opacity") + i.opacity = q9i(r); + else if (r.type === "rotation") { + const n = r; + i.rotation = { type: n.rotationType }; + } + return { vvFields: e, vvRanges: i }; +} +function q9i(t) { + const e = { values: [0, 0, 0, 0, 0, 0, 0, 0], opacities: [0, 0, 0, 0, 0, 0, 0, 0] }; + if (typeof t.field == "string") { + if (!t.stops) + return null; + { + if (t.stops.length > 8) + return null; + const i = t.stops; + for (let r = 0; r < 8; ++r) { + const n = i[Math.min(r, i.length - 1)]; + e.values[r] = n.value, e.opacities[r] = n.opacity; + } + } + } else { + if (!(t.stops && t.stops.length >= 0)) + return null; + { + const i = t.stops && t.stops.length >= 0 ? t.stops[0].opacity : 0; + for (let r = 0; r < 8; r++) + e.values[r] = 1 / 0, e.opacities[r] = i; + } + } + return e; +} +function UZe(t, e, i) { + t[4 * e + 0] = i.r / 255, t[4 * e + 1] = i.g / 255, t[4 * e + 2] = i.b / 255, t[4 * e + 3] = i.a; +} +function Y9i(t) { + if (ut(t) || t.normalizationField) + return null; + const e = { field: null, values: [0, 0, 0, 0, 0, 0, 0, 0], colors: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }; + if (typeof t.field == "string") { + if (!t.stops) + return null; + { + if (t.stops.length > 8) + return null; + e.field = t.field; + const i = t.stops; + for (let r = 0; r < 8; ++r) { + const n = i[Math.min(r, i.length - 1)]; + e.values[r] = n.value, UZe(e.colors, r, n.color); + } + } + } else { + if (!(t.stops && t.stops.length >= 0)) + return null; + { + const i = t.stops && t.stops.length >= 0 && t.stops[0].color; + for (let r = 0; r < 8; r++) + e.values[r] = 1 / 0, UZe(e.colors, r, i); + } + } + for (let i = 0; i < 32; i += 4) + U9i(e.colors, i, !0); + return e; +} +const _G = Ei.getLogger("esri.views.layers.2d.features.support.AttributeStore"), Eoe = ZAt(QAt, _G), JJ = { sharedArrayBuffer: Vi("esri-shared-array-buffer"), atomics: Vi("esri-atomics") }; +function hxe(t, e) { + return (i) => e(t(i)); +} +let X9i = class { + constructor(e, i, r, n) { + this.size = 0, this.texelSize = 4, this.dirtyStart = 0, this.dirtyEnd = 0; + const { pixelType: s, layout: o, textureOnly: a } = n; + this.textureOnly = a || !1, this.pixelType = s, this._ctype = i, this.layout = o, this._resetRange(), this._shared = e, this.size = r, a || (this.data = this._initData(s, r, e, i)); + } + get buffer() { + return Sa(this.data, (e) => e.buffer); + } + unsetComponentAllTexels(e, i) { + const r = this.data; + for (let n = 0; n < this.size * this.size; n++) + r[n * this.texelSize + e] &= ~i; + this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1; + } + setComponentAllTexels(e, i) { + const r = this.data; + for (let n = 0; n < this.size * this.size; n++) + r[n * this.texelSize + e] |= 255 & i; + this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1; + } + setComponent(e, i, r) { + const n = this.data; + for (const s of r) + n[s * this.texelSize + e] |= i, this.dirtyStart = Math.min(this.dirtyStart, s), this.dirtyEnd = Math.max(this.dirtyEnd, s); + } + setComponentTexel(e, i, r) { + this.data[r * this.texelSize + e] |= i, this.dirtyStart = Math.min(this.dirtyStart, r), this.dirtyEnd = Math.max(this.dirtyEnd, r); + } + unsetComponentTexel(e, i, r) { + this.data[r * this.texelSize + e] &= ~i, this.dirtyStart = Math.min(this.dirtyStart, r), this.dirtyEnd = Math.max(this.dirtyEnd, r); + } + getData(e, i) { + const r = pO(e); + return this.data[r * this.texelSize + i]; + } + setData(e, i, r) { + const n = pO(e), s = 1 << i; + this.layout & s ? ut(this.data) || (this.data[n * this.texelSize + i] = r, this.dirtyStart = Math.min(this.dirtyStart, n), this.dirtyEnd = Math.max(this.dirtyEnd, n)) : _G.error("mapview-attributes-store", "Tried to set a value for a texel's readonly component"); + } + lock() { + this.pixelType === rs.UNSIGNED_BYTE && this._shared && JJ.atomics && this._ctype !== "local" && Atomics.store(this.data, 0, 1); + } + unlock() { + this.pixelType === rs.UNSIGNED_BYTE && this._shared && JJ.atomics && this._ctype !== "local" && Atomics.store(this.data, 0, 0); + } + expand(e) { + if (this.size = e, !this.textureOnly) { + const i = this._initData(this.pixelType, e, this._shared, this._ctype), r = this.data; + i.set(r), this.data = i; + } + } + toMessage() { + const e = this.dirtyStart, i = this.dirtyEnd, r = this.texelSize; + if (e > i) + return null; + this._resetRange(); + const n = !(this._shared || this._ctype === "local"), s = this.pixelType, o = this.layout, a = this.data; + return { start: e, end: i, data: n && a.slice(e * r, (i + 1) * r) || null, pixelType: s, layout: o }; + } + _initData(e, i, r, n) { + const s = r && n !== "local" ? SharedArrayBuffer : ArrayBuffer, o = mX(e), a = new o(new s(i * i * 4 * o.BYTES_PER_ELEMENT)); + for (let l = 0; l < a.length; l += 4) + a[l + 1] = 255; + return a; + } + _resetRange() { + this.dirtyStart = 2147483647, this.dirtyEnd = 0; + } +}, tPt = class { + constructor(e, i, r = () => { + }) { + this._client = e, this.config = i, this._notifyChange = r, this._blocks = new Array(), this._filters = new Array(jAt), this._attributeComputeInfo = null, this._targetType = 0, this._abortController = new AbortController(), this._hasScaleExpr = !1, this._size = 32, this._nextUpdate = null, this._currUpdate = null, this._idsToHighlight = /* @__PURE__ */ new Set(); + const n = i.supportsTextureFloat ? rs.FLOAT : rs.UNSIGNED_BYTE; + Eoe(`Creating AttributeStore ${JJ.sharedArrayBuffer ? "with" : "without"} shared memory`), this._blockDescriptors = [{ pixelType: rs.UNSIGNED_BYTE, layout: 1 }, { pixelType: rs.UNSIGNED_BYTE, layout: 15, textureOnly: !0 }, { pixelType: rs.UNSIGNED_BYTE, layout: 15, textureOnly: !0 }, { pixelType: n, layout: 15 }, { pixelType: n, layout: 15 }, { pixelType: n, layout: 15 }, { pixelType: n, layout: 15 }], this._blocks = this._blockDescriptors.map(() => null); + } + destroy() { + this._abortController.abort(); + } + get hasScaleExpr() { + return this._hasScaleExpr; + } + get _signal() { + return this._abortController.signal; + } + get hasHighlight() { + return this._idsToHighlight.size > 0; + } + isUpdating() { + return !!this._currUpdate || !!this._nextUpdate; + } + update(e, i) { + this.config = i; + const r = i.schema.processors[0].storage, n = zS(this._schema, r); + if ((e.targets.feature || e.targets.aggregate) && (e.storage.data = !0), n && (Vi("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", n), e.storage.data = !0, this._schema = r, this._attributeComputeInfo = null, !ut(r))) { + switch (r.target) { + case "feature": + this._targetType = t9i; + break; + case "aggregate": + this._targetType = O8e; + } + if (r.type === "subtype") { + this._attributeComputeInfo = { isSubtype: !0, subtypeField: r.subtypeField, map: /* @__PURE__ */ new Map() }; + for (const s in r.mapping) { + const o = r.mapping[s]; + if (_e(o) && _e(o.vvMapping)) + for (const a of o.vvMapping) + this._bindAttribute(a, parseInt(s, 10)); + } + } else { + if (this._attributeComputeInfo = { isSubtype: !1, map: /* @__PURE__ */ new Map() }, _e(r.vvMapping)) + for (const s of r.vvMapping) + this._bindAttribute(s); + if (_e(r.attributeMapping)) + for (const s of r.attributeMapping) + this._bindAttribute(s); + } + } + } + onTileData(e, i) { + if (ut(i.addOrUpdate)) + return; + const r = i.addOrUpdate.getCursor(); + for (; r.next(); ) { + const n = r.getDisplayId(); + this.setAttributeData(n, r); + } + } + async setHighlight(e, i) { + const n = this._getBlock(0), s = i.map((o) => pO(o)); + n.lock(), n.unsetComponentAllTexels(0, 1), n.setComponent(0, 1, s), n.unlock(), this._idsToHighlight.clear(); + for (const o of e) + this._idsToHighlight.add(o); + await this.sendUpdates(); + } + async updateFilters(e, i, r) { + const { service: n, spatialReference: s } = r, { filters: o } = i, a = o.map((l, c) => this._updateFilter(l, c, n, s)); + (await Promise.all(a)).some((l) => l) && (e.storage.filters = !0, Vi("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", "Filters changed")); + } + setData(e, i, r, n) { + const s = pO(e); + this._ensureSizeForTexel(s), this._getBlock(i).setData(e, r, n); + } + getData(e, i, r) { + return this._getBlock(i).getData(e, r); + } + getHighlightFlag(e) { + return this._idsToHighlight.has(e) ? G8i : 0; + } + unsetAttributeData(e) { + const i = pO(e); + this._getBlock(0).setData(i, 0, 0); + } + setAttributeData(e, i) { + const r = pO(e); + if (this._ensureSizeForTexel(r), this._getBlock(0).setData(r, 0, this.getFilterFlags(i)), this._targetType !== R8e(e)) + return; + const n = this._attributeComputeInfo, s = this.config.supportsTextureFloat ? 1 : 2, o = 4; + let a = null; + n && (a = n.isSubtype ? n.map.get(i.readAttribute(n.subtypeField)) : n.map, a && a.size && a.forEach((l, c) => { + const h = c * s % o, p = Math.floor(c * s / o), y = this._getBlock(p + uRe), v = l(i); + if (this.config.supportsTextureFloat) + y.setData(r, h, v); + else if (v === oRe) + y.setData(r, h, 255), y.setData(r, h + 1, 255); + else { + const x = ru(Math.round(v), -32767, 32766) + 32768, I = 255 & x, P = (65280 & x) >> 8; + y.setData(r, h, I), y.setData(r, h + 1, P); + } + })); + } + sendUpdates() { + if (Vi("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate"), this._notifyChange(), this._nextUpdate) + return this._nextUpdate.promise; + if (this._currUpdate) + return this._nextUpdate = mm(), this._nextUpdate.promise; + const e = { blocks: this._blocks.map((i) => _e(i) ? i.toMessage() : null) }; + return this._currUpdate = this._createResources().then(() => { + const i = () => { + if (this._currUpdate = null, this._nextUpdate) { + const n = this._nextUpdate; + this._nextUpdate = null, this.sendUpdates().then(() => n.resolve()); + } else + Vi("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::No additional updates queued"); + this._notifyChange(); + }; + Vi("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::client.update"); + const r = this._client.update(e, this._signal).then(i).catch(i); + return this._client.render(this._signal), r; + }).catch((i) => { + if (us(i)) + return this._createResourcesPromise = null, this._createResources(); + this._notifyChange(), _G.error(new ot("mapview-attribute-store", "Encountered an error during client update", i)); + }), this._currUpdate; + } + _ensureSizeForTexel(e) { + for (; e >= this._size * this._size; ) + if (this._expand()) + return; + } + _bindAttribute(e, i) { + function r() { + const { normalizationField: c } = e; + return c ? (h) => { + const p = h.readAttribute(c); + return p ? h.readAttribute(e.field) / p : null; + } : (h) => h.readAttribute(e.field); + } + function n() { + return e.normalizationField && _G.warn("mapview-arcade", "Ignoring normalizationField specified with an arcade expression which is not supported."), (c) => c.getComputedNumericAtIndex(e.fieldIndex); + } + let s; + if (e.fieldIndex != null) + s = n(); + else { + if (!e.field) + return; + s = r(); + } + const { valueRepresentation: o } = e; + o && (s = hxe(s, (c) => z9i(c, o))); + const a = (c) => c === null || isNaN(c) || c === 1 / 0 || c === -1 / 0 ? oRe : c, l = this._attributeComputeInfo; + if (l.isSubtype) { + const c = l.map.get(i) ?? /* @__PURE__ */ new Map(); + c.set(e.binding, hxe(s, a)), l.map.set(i, c); + } else + l.map.set(e.binding, hxe(s, a)); + } + _createResources() { + if (_e(this._createResourcesPromise)) + return this._createResourcesPromise; + this._getBlock(A8e), this._getBlock(hfe), Eoe("Initializing AttributeStore"); + const e = { shared: JJ.sharedArrayBuffer && this._client.type !== "local", size: this._size, blocks: tCe(this._blocks, (r) => ({ textureOnly: r.textureOnly, buffer: r.buffer, pixelType: r.pixelType })) }, i = this._client.initialize(e, this._signal).catch((r) => { + us(r) ? this._createResourcesPromise = null : _G.error(new ot("mapview-attribute-store", "Encountered an error during client initialization", r)); + }); + return this._createResourcesPromise = i, i.then(() => ut(this._createResourcesPromise) ? this._createResources() : void 0), i; + } + _getBlock(e) { + const i = this._blocks[e]; + if (_e(i)) + return i; + Eoe(`Initializing AttributeBlock at index ${e}`); + const r = JJ.sharedArrayBuffer, n = this._client.type, s = new X9i(r, n, this._size, this._blockDescriptors[e]); + return this._blocks[e] = s, this._createResourcesPromise = null, s; + } + _expand() { + if (this._size < this.config.maxTextureSize) { + const e = this._size <<= 1; + return Eoe("Expanding block size to", e, this._blocks), Xlt(this._blocks, (i) => i.expand(e)), this._createResourcesPromise = null, this._size = e, 0; + } + return _G.error(new ot("mapview-limitations", "Maximum number of onscreen features exceeded.")), -1; + } + async _updateFilter(e, i, r, n) { + const s = this._filters[i], o = _e(s) && s.hash; + if (!s && !e || o === JSON.stringify(e)) + return !1; + if (ut(e)) { + if (!s) + return !1; + const l = 1 << i + 1, c = this._getBlock(0); + return this._filters[i] = null, c.setComponentAllTexels(0, l), this.sendUpdates(), !0; + } + return await (await this._getFilter(i, r)).update(e, n), !0; + } + async _getFilter(e, i) { + const r = this._filters[e]; + if (_e(r)) + return r; + const { default: n } = await Promise.resolve().then(() => hMr), s = new n({ geometryType: i.geometryType, hasM: !1, hasZ: !1, timeInfo: i.timeInfo, fieldsIndex: new sg(i.fields) }); + return this._filters[e] = s, s; + } + isVisible(e) { + return !!(2 & this._getBlock(0).getData(e, 0)); + } + getFilterFlags(e) { + let i = 0; + const r = i9i(e.getDisplayId()); + for (let s = 0; s < this._filters.length; s++) { + const o = !!(r & 1 << s), a = this._filters[s]; + i |= (!o || ut(a) || a.check(e) ? 1 : 0) << s; + } + let n = 0; + if (this._idsToHighlight.size) { + const s = e.getObjectId(); + n = this.getHighlightFlag(s); + } + return i << 1 | n; + } +}; +function K9i(t, e) { + let i = -90, r = 90, n = -180, s = 180; + for (let o = 0; o < e; o++) { + const a = Math.ceil((o + 1) / 2), l = Math.floor((o + 1) / 2), c = 1 - o % 2, h = 30 - (3 * a + 2 * l), p = 30 - (2 * a + 3 * l), y = 3 * c + 2 * (1 - c), v = 2 * c + 3 * (1 - c), x = 3 * c + 7 * (1 - c) << p, I = (7 * c + 3 * (1 - c) << h & t.geohashX) >> h, P = (x & t.geohashY) >> p; + for (let F = y - 1; F >= 0; F--) { + const k = (n + s) / 2, V = I & 1 << F ? 1 : 0; + n = (1 - V) * n + V * k, s = (1 - V) * k + V * s; + } + for (let F = v - 1; F >= 0; F--) { + const k = (i + r) / 2, V = P & 1 << F ? 1 : 0; + i = (1 - V) * i + V * k, r = (1 - V) * k + V * r; + } + } + return [n, i, s, r]; +} +function nce(t, e, i, r) { + r % 2 && (r += 1); + let n = 0, s = 0, o = -90, a = 90, l = -180, c = 180; + for (let h = 0; h < r / 2; h++) { + for (let p = 0; p < 5; p++) { + const y = (l + c) / 2, v = i > y ? 1 : 0; + n |= v << 29 - (p + 5 * h), l = (1 - v) * l + v * y, c = (1 - v) * y + v * c; + } + for (let p = 0; p < 5; p++) { + const y = (o + a) / 2, v = e > y ? 1 : 0; + s |= v << 29 - (p + 5 * h), o = (1 - v) * o + v * y, a = (1 - v) * y + v * a; + } + } + t.geohashX = n, t.geohashY = s; +} +function yfe(t, e, i, r, n) { + n % 2 && (n += 1); + let s = 0, o = 0, a = -90, l = 90, c = -180, h = 180; + for (let p = 0; p < n / 2; p++) { + for (let y = 0; y < 5; y++) { + const v = (c + h) / 2, x = r > v ? 1 : 0; + s |= x << 29 - (y + 5 * p), c = (1 - x) * c + x * v, h = (1 - x) * v + x * h; + } + for (let y = 0; y < 5; y++) { + const v = (a + l) / 2, x = i > v ? 1 : 0; + o |= x << 29 - (y + 5 * p), a = (1 - x) * a + x * v, l = (1 - x) * v + x * l; + } + } + t[2 * e] = s, t[2 * e + 1] = o; +} +let iPt = class { + constructor(e = [], i, r = 8096) { + this.onRelease = (n) => { + }, this._nodes = 0, this._root = new dxe(this, 0, 0, 0), this._statisticFields = e, this._pool = r ? new o4(8096) : null, this._serviceInfo = i; + } + destroy() { + this.clear(); + } + _acquire(e, i, r) { + this._nodes++; + let n = null; + return _e(this._pool) && (n = this._pool.dequeue()), _e(n) ? n.realloc(e, i, r) : n = new dxe(this, e, i, r), n; + } + _release(e) { + this.onRelease(e), this._nodes--, _e(this._pool) && this._pool.enqueue(e); + } + get count() { + return this._root.count; + } + get size() { + return this._nodes; + } + get poolSize() { + return $_(this._pool, 0, (e) => e.size); + } + get depth() { + let e = 0; + return this.forEach((i) => e = Math.max(e, i.depth)), e; + } + dropLevels(e) { + this.forEach((i) => { + if (i.depth >= e) + for (let r = 0; r < i.children.length; r++) { + const n = i.children[r]; + n && this._release(n); + } + }), this.forEach((i) => { + if (i.depth >= e) + for (let r = 0; r < i.children.length; r++) + i.children[r] = null; + }); + } + clear() { + this.forEach((e) => this._release(e)), this._root = new dxe(this, 0, 0, 0); + } + insert(e, i, r = 0) { + const n = Vv.fromOptimizedFeatures([e], this._serviceInfo).getCursor(); + n.next(); + const s = n.readGeometry(); + if (!s) + return; + const [o, a] = s.coords, l = e.geohashX, c = e.geohashY; + this.insertCursor(n, e.displayId, o, a, l, c, i, r); + } + insertCursor(e, i, r, n, s, o, a, l = 0) { + let c = this._root, h = 0, p = 0, y = 0; + for (; c !== null; ) { + if (c.depth >= l && (c.count += 1, c.xTotal += r, c.yTotal += n, c.xGeohashTotal += s, c.yGeohashTotal += o, c.referenceId = i, this._updateStatisticsCursor(e, c, 1)), h >= a) + return void c.add(i); + const v = Math.ceil((h + 1) / 2), x = Math.floor((h + 1) / 2), I = 1 - h % 2, P = 30 - (3 * v + 2 * x), F = 30 - (2 * v + 3 * x), k = (s & 7 * I + 3 * (1 - I) << P) >> P, V = (o & 3 * I + 7 * (1 - I) << F) >> F, j = k + V * (8 * I + 4 * (1 - I)); + p = p << 3 * I + 2 * (1 - I) | k, y = y << 2 * I + 3 * (1 - I) | V, c.children[j] == null && (c.children[j] = this._acquire(p, y, h + 1)), h += 1, c = c.children[j]; + } + } + remove(e, i) { + const r = Vv.fromOptimizedFeatures([e], this._serviceInfo).getCursor(); + r.next(); + const n = r.readGeometry(); + if (!n) + return; + const [s, o] = n.coords, a = e.geohashX, l = e.geohashY; + this.removeCursor(r, s, o, a, l, i); + } + removeCursor(e, i, r, n, s, o) { + let a = this._root, l = 0; + for (; a !== null; ) { + if (a.count -= 1, a.xTotal -= i, a.yTotal -= r, a.xGeohashTotal -= n, a.yGeohashTotal -= s, this._updateStatisticsCursor(e, a, -1), l >= o) + return void a.remove(e.getDisplayId()); + const c = Math.ceil((l + 1) / 2), h = Math.floor((l + 1) / 2), p = 1 - l % 2, y = 30 - (3 * c + 2 * h), v = 30 - (2 * c + 3 * h), x = ((n & 7 * p + 3 * (1 - p) << y) >> y) + ((s & 3 * p + 7 * (1 - p) << v) >> v) * (8 * p + 4 * (1 - p)), I = a.children[x]; + I?.count === 1 && (this._release(I), a.children[x] = null), l += 1, a = I; + } + } + forEach(e) { + let i = this._root; + for (; i !== null; ) { + const r = this._linkChildren(i) || i.next; + e(i), i = r; + } + } + find(e, i, r) { + return this._root.find(e, i, r, 0, 0, 0); + } + findIf(e) { + let i = null; + return this.forEach((r) => { + e(r) && (i = r); + }), i; + } + findAllIf(e) { + const i = []; + return this.forEach((r) => { + e(r) && i.push(r); + }), i; + } + findSingleOccupancyNode(e, i, r, n, s) { + let o = this._root; + for (; o !== null; ) { + const a = o.depth, l = o.xNode, c = o.yNode, h = 1 - a % 2, p = o.xGeohashTotal / o.count, y = o.yGeohashTotal / o.count; + if (o.count === 1 && e < p && p <= r && i < y && y <= n) + return o; + if (a >= s) { + o = o.next; + continue; + } + const v = Math.ceil((a + 1) / 2), x = Math.floor((a + 1) / 2), I = 30 - (3 * v + 2 * x), P = 30 - (2 * v + 3 * x), F = ~((1 << I) - 1), k = ~((1 << P) - 1), V = (e & F) >> I, j = (i & k) >> P, Y = (r & F) >> I, X = (n & k) >> P, Q = l << 3 * h + 2 * (1 - h), re = c << 2 * h + 3 * (1 - h), he = Q + 8 * h + 4 * (1 - h), fe = re + 4 * h + 8 * (1 - h), be = Math.max(Q, V), Se = Math.max(re, j), Me = Math.min(he, Y), ke = Math.min(fe, X); + let J = null, ce = null; + for (let xe = Se; xe <= ke; xe++) + for (let Pe = be; Pe <= Me; Pe++) { + const Oe = Pe - Q + (xe - re) * (8 * h + 4 * (1 - h)), Re = o.children[Oe]; + Re && (J || (J = Re, J.next = o.next), ce && (ce.next = Re), ce = Re, Re.next = o.next); + } + o = J || o.next; + } + return null; + } + getRegionDisplayIds(e) { + let i = this._root; + const { bounds: r, geohashBounds: n, level: s } = e, [o, a, l, c] = r, h = []; + for (; i !== null; ) { + const p = i.depth, y = i.xNode, v = i.yNode; + if (p >= s) { + const Oe = i.xTotal / i.count, Re = i.yTotal / i.count; + Oe >= o && Oe <= l && Re >= a && Re <= c && i.displayIds.forEach((Ge) => h.push(Ge)), i = i.next; + continue; + } + const x = Math.ceil((p + 1) / 2), I = Math.floor((p + 1) / 2), P = 1 - p % 2, F = 30 - (3 * x + 2 * I), k = 30 - (2 * x + 3 * I), V = ~((1 << F) - 1), j = ~((1 << k) - 1), Y = (n.xLL & V) >> F, X = (n.yLL & j) >> k, Q = (n.xTR & V) >> F, re = (n.yTR & j) >> k, he = y << 3 * P + 2 * (1 - P), fe = v << 2 * P + 3 * (1 - P), be = he + 8 * P + 4 * (1 - P), Se = fe + 4 * P + 8 * (1 - P), Me = Math.max(he, Y), ke = Math.max(fe, X), J = Math.min(be, Q), ce = Math.min(Se, re); + let xe = null, Pe = null; + for (let Oe = ke; Oe <= ce; Oe++) + for (let Re = Me; Re <= J; Re++) { + const Ge = Re - he + (Oe - fe) * (8 * P + 4 * (1 - P)), je = i.children[Ge]; + je && (xe || (xe = je, xe.next = i.next), Pe && (Pe.next = je), Pe = je, je.next = i.next); + } + i = xe || i.next; + } + return h; + } + getRegionStatistics(e) { + let i = this._root, r = 0, n = 0, s = 0; + const o = {}, { bounds: a, geohashBounds: l, level: c } = e, [h, p, y, v] = a; + let x = 0; + for (; i !== null; ) { + const I = i.depth, P = i.xNode, F = i.yNode; + if (I >= c) { + const et = i.xTotal / i.count, Qe = i.yTotal / i.count; + et > h && et <= y && Qe > p && Qe <= v && (r += i.count, n += i.xTotal, s += i.yTotal, i.count === 1 && (x = i.referenceId), this._aggregateStatistics(o, i.statistics)), i = i.next; + continue; + } + const k = Math.ceil((I + 1) / 2), V = Math.floor((I + 1) / 2), j = 1 - I % 2, Y = 30 - (3 * k + 2 * V), X = 30 - (2 * k + 3 * V), Q = ~((1 << Y) - 1), re = ~((1 << X) - 1), he = (l.xLL & Q) >> Y, fe = (l.yLL & re) >> X, be = (l.xTR & Q) >> Y, Se = (l.yTR & re) >> X, Me = P << 3 * j + 2 * (1 - j), ke = F << 2 * j + 3 * (1 - j), J = Me + 8 * j + 4 * (1 - j), ce = ke + 4 * j + 8 * (1 - j), xe = Math.max(Me, he), Pe = Math.max(ke, fe), Oe = Math.min(J, be), Re = Math.min(ce, Se); + let Ge = null, je = null; + for (let et = Pe; et <= Re; et++) + for (let Qe = xe; Qe <= Oe; Qe++) { + const tt = Qe - Me + (et - ke) * (8 * j + 4 * (1 - j)), ft = i.children[tt]; + if (ft) { + if (et !== Pe && et !== Re && Qe !== xe && Qe !== Oe) { + const Mt = ft.xTotal / ft.count, kt = ft.yTotal / ft.count; + Mt > h && Mt <= y && kt > p && kt <= v && (r += ft.count, n += ft.xTotal, s += ft.yTotal, ft.count === 1 && (x = ft.referenceId), this._aggregateStatistics(o, ft.statistics)); + continue; + } + Ge || (Ge = ft, Ge.next = i.next), je && (je.next = ft), je = ft, ft.next = i.next; + } + } + i = Ge || i.next; + } + return { count: r, attributes: this.normalizeStatistics(o, r), xTotal: n, yTotal: s, referenceId: x }; + } + getBins(e) { + const i = [], { geohashBounds: r, level: n } = e; + let s = this._root; + for (; s !== null; ) { + const o = s.depth, a = s.xNode, l = s.yNode; + if (o >= n) { + i.push(s), s = s.next; + continue; + } + const c = Math.ceil((o + 1) / 2), h = Math.floor((o + 1) / 2), p = 1 - o % 2, y = 30 - (3 * c + 2 * h), v = 30 - (2 * c + 3 * h), x = ~((1 << y) - 1), I = ~((1 << v) - 1), P = (r.xLL & x) >> y, F = (r.yLL & I) >> v, k = (r.xTR & x) >> y, V = (r.yTR & I) >> v, j = a << 3 * p + 2 * (1 - p), Y = l << 2 * p + 3 * (1 - p), X = j + 8 * p + 4 * (1 - p), Q = Y + 4 * p + 8 * (1 - p), re = Math.max(j, P), he = Math.max(Y, F), fe = Math.min(X, k), be = Math.min(Q, V); + let Se = null, Me = null; + for (let ke = he; ke <= be; ke++) + for (let J = re; J <= fe; J++) { + const ce = J - j + (ke - Y) * (8 * p + 4 * (1 - p)), xe = s.children[ce]; + xe && (Se || (Se = xe, Se.next = s.next), Me && (Me.next = xe), Me = xe, xe.next = s.next); + } + s = Se || s.next; + } + return i; + } + _linkChildren(e) { + let i = null, r = null; + for (let n = 0; n <= e.children.length; n++) { + const s = e.children[n]; + s && (i || (i = s, i.next = e.next), r && (r.next = s), r = s, s.next = e.next); + } + return i; + } + _updateStatisticsCursor(e, i, r) { + for (const n of this._statisticFields) { + const s = n.name, o = n.inField ? e.readAttribute(n.inField) : e.getComputedNumericAtIndex(n.inFieldIndex); + switch (n.statisticType) { + case "min": { + if (isNaN(o)) + break; + if (!i.statistics[s]) { + i.statistics[s] = { value: o }; + break; + } + const a = i.statistics[s].value; + i.statistics[s].value = Math.min(a, o); + break; + } + case "max": { + if (isNaN(o)) + break; + if (!i.statistics[s]) { + i.statistics[s] = { value: o }; + break; + } + const a = i.statistics[s].value; + i.statistics[s].value = Math.max(a, o); + break; + } + case "count": + break; + case "sum": + case "avg": { + i.statistics[s] || (i.statistics[s] = { value: 0, nanCount: 0 }); + const a = i.statistics[s].value, l = i.statistics[s].nanCount ?? 0; + o == null || isNaN(o) ? i.statistics[s].nanCount = l + r : i.statistics[s].value = a + r * o; + break; + } + case "avg_angle": { + i.statistics[s] || (i.statistics[s] = { x: 0, y: 0, nanCount: 0 }); + const a = i.statistics[s].x, l = i.statistics[s].y, c = i.statistics[s].nanCount ?? 0, h = Math.PI / 180; + o == null || isNaN(o) ? i.statistics[s].nanCount = c + r : (i.statistics[s].x = a + r * Math.cos(o * h), i.statistics[s].y = l + r * Math.sin(o * h)); + break; + } + case "mode": { + i.statistics[s] || (i.statistics[s] = {}); + const a = i.statistics[s][o] || 0; + i.statistics[s][o] = a + r; + break; + } + } + } + } + _aggregateStatistics(e, i) { + for (const r of this._statisticFields) { + const n = r.name; + switch (r.statisticType) { + case "min": { + if (!e[n]) { + e[n] = { value: i[n].value }; + break; + } + const s = e[n].value; + e[n].value = Math.min(s, i[n].value); + break; + } + case "max": { + if (!e[n]) { + e[n] = { value: i[n].value }; + break; + } + const s = e[n].value; + e[n].value = Math.max(s, i[n].value); + break; + } + case "count": + break; + case "sum": + case "avg": + case "avg_angle": + case "mode": + e[n] || (e[n] = {}); + for (const s in i[n]) { + const o = e[n][s] || 0; + e[n][s] = o + i[n][s]; + } + } + } + } + normalizeStatistics(e, i) { + const r = {}; + for (const n of this._statisticFields) { + const s = n.name; + switch (n.statisticType) { + case "min": + case "max": { + const o = e[s]; + if (!i || !o) + break; + r[s] = o.value; + break; + } + case "count": + if (!i) + break; + r[s] = i; + break; + case "sum": { + if (!i) + break; + const { value: o, nanCount: a } = e[s]; + if (!(i - a)) + break; + r[s] = o; + break; + } + case "avg": { + if (!i) + break; + const { value: o, nanCount: a } = e[s]; + if (!(i - a)) + break; + r[s] = o / (i - a); + break; + } + case "avg_angle": { + if (!i) + break; + const { x: o, y: a, nanCount: l } = e[s]; + if (!(i - l)) + break; + const c = o / (i - l), h = a / (i - l), p = 180 / Math.PI, y = Math.atan2(h, c) * p; + r[s] = y; + break; + } + case "mode": { + const o = e[s]; + let a = 0, l = 0, c = null; + for (const h in o) { + const p = o[h]; + p === a ? l += 1 : p > a && (a = p, l = 1, c = h); + } + r[s] = c === "null" || l > 1 ? null : c; + break; + } + } + } + return r; + } +}, dxe = class { + constructor(e, i, r, n) { + this.count = 0, this.xTotal = 0, this.yTotal = 0, this.statistics = {}, this.displayId = 0, this.referenceId = 0, this.displayIds = /* @__PURE__ */ new Set(), this.next = null, this.depth = 0, this.xNode = 0, this.yNode = 0, this.xGeohashTotal = 0, this.yGeohashTotal = 0, this._tree = e, this.children = new Array(32); + for (let s = 0; s < this.children.length; s++) + this.children[s] = null; + this.xNode = i, this.yNode = r, this.depth = n; + } + realloc(e, i, r) { + for (let n = 0; n < this.children.length; n++) + this.children[n] = null; + return this.xNode = e, this.yNode = i, this.depth = r, this.next = null, this.xGeohashTotal = 0, this.yGeohashTotal = 0, this.displayId = 0, this.referenceId = 0, this.xTotal = 0, this.yTotal = 0, this.count = 0, this.statistics = {}, this.displayIds.clear(), this; + } + get id() { + return `${this.xNode}.${this.yNode}`; + } + add(e) { + this.displayIds.add(e); + } + remove(e) { + this.displayIds.delete(e); + } + getAttributes() { + const e = this._tree.normalizeStatistics(this.statistics, this.count); + return e.referenceId = null, e.aggregateId = this.id, e.aggregateCount = this.count, e; + } + getGeometry(e, i) { + const r = this.getLngLatBounds(), [n, s, o, a] = r, l = Cp({ rings: [[[n, s], [n, a], [o, a], [o, s], [n, s]]] }, or.WGS84, e), c = VF(new Rl(), l, !1, !1); + return _e(i) ? YO(new Rl(), c, !1, !1, "esriGeometryPolygon", i, !1, !1) : c; + } + getGeometryCentroid(e, i) { + const r = this.getLngLatBounds(), [n, s, o, a] = r, l = Cp({ x: (n + o) / 2, y: (s + a) / 2 }, or.WGS84, e), c = oti(new Rl(), l); + return _e(i) ? YO(new Rl(), c, !1, !1, "esriGeometryPoint", i, !1, !1) : c; + } + getLngLatBounds() { + const e = this.depth, i = Math.ceil(e / 2), r = Math.floor(e / 2), n = 30 - (3 * i + 2 * r), s = 30 - (2 * i + 3 * r), o = this.xNode << n, a = this.yNode << s; + return K9i({ geohashX: o, geohashY: a }, this.depth); + } + find(e, i, r, n, s, o) { + if (n >= r) + return this; + const a = 1 - n % 2, l = 3 * a + 2 * (1 - a), c = 2 * a + 3 * (1 - a), h = 30 - s - l, p = 30 - o - c, y = ((e & 7 * a + 3 * (1 - a) << h) >> h) + ((i & 3 * a + 7 * (1 - a) << p) >> p) * (8 * a + 4 * (1 - a)), v = this.children[y]; + return v == null ? null : v.find(e, i, r, n + 1, s + l, o + c); + } +}; +const pxe = Ei.getLogger("esri.view.2d.layers.features.support.BinStore"), zZe = 12, J9i = 64, Z9i = Sx(), Q9i = 5; +function HZe(t) { + return 57.29577951308232 * t; +} +let eBi = class extends x8e { + constructor(e, i, r, n) { + super(e, r), this.type = "bin", this.events = new Bd(), this.objectIdField = "aggregateId", this.featureAdapter = uve, this._geohashLevel = Q9i, this._geohashBuf = [], this._serviceInfo = n, this.geometryInfo = e.geometryInfo, this._spatialReference = i, this._projectionSupportCheck = Py(i, or.WGS84), this._bitsets.geohash = r.getBitset(r.createBitset()), this._bitsets.inserted = r.getBitset(r.createBitset()); + } + destroy() { + this._tree && this._tree.destroy(); + } + get featureSpatialReference() { + return this._spatialReference; + } + get fields() { + return this._fields; + } + async updateSchema(e, i) { + const r = this._schema; + try { + await super.updateSchema(e, i), await this._projectionSupportCheck; + } catch { + } + this._fields = this._schema.params.fields; + const n = zS(r, i); + i && (!ut(n) || e.source || e.storage.filters) ? ((zO(n, "params.fields") || zO(n, "params") || !this._tree || e.source) && (this._tree && this._tree.destroy(), this._tree = new iPt(this._statisticFields, this._serviceInfo), this._tree.onRelease = (s) => s.displayId && this._storage.releaseDisplayId(s.displayId), this._geohashLevel = this._schema.params.fixedBinLevel, this._rebuildTree(), Vi("esri-2d-update-debug") && pxe.info("Aggregate mesh needs update due to tree changing")), Vi("esri-2d-update-debug") && pxe.info("Aggregate mesh needs update due to tree changing"), e.targets[i.name] = !0, e.mesh = !1) : r && (e.mesh = !0); + } + clear() { + this._rebuildTree(); + } + sweepFeatures(e, i) { + this._bitsets.inserted.forEachSet((r) => { + if (!e.has(r)) { + const n = i.lookupByDisplayIdUnsafe(r); + this._remove(n); + } + }); + } + sweepAggregates(e, i, r) { + } + onTileData(e, i, r, n, s = !0) { + if (!this._schema || ut(i.addOrUpdate)) + return i; + this.events.emit("changed"); + const o = this._getTransforms(e, this._spatialReference); + { + const l = i.addOrUpdate.getCursor(); + for (; l.next(); ) + this._update(l, n); + } + if (i.status.mesh || !s) + return i; + const a = new Array(); + this._getBinsForTile(a, e, o, r), i.addOrUpdate = Vv.fromOptimizedFeatures(a, { ...this._serviceInfo, geometryType: "esriGeometryPolygon" }), i.addOrUpdate.attachStorage(r), i.end = !0, i.isRepush || (i.clear = !0); + { + const l = i.addOrUpdate.getCursor(); + for (; l.next(); ) { + const c = l.getDisplayId(); + this._bitsets.computed.unset(c), this.setComputedAttributes(r, l, c, e.scale); + } + } + return i; + } + forEachBin(e) { + this._tree.forEach(e); + } + forEach(e) { + this._tree.forEach((i) => { + if (i.depth !== this._geohashLevel) + return; + const r = this._toFeatureJSON(i), n = Vv.fromFeatures([r], { objectIdField: this.objectIdField, globalIdField: null, geometryType: this.geometryInfo.geometryType, fields: this.fields }).getCursor(); + n.next(), e(n); + }); + } + forEachInBounds(e, i) { + } + forEachBounds(e, i) { + const { hasM: r, hasZ: n } = this.geometryInfo; + for (const s of e) { + const o = aye(Z9i, s.readGeometry(), n, r); + ut(o) || i(o); + } + } + onTileUpdate(e) { + } + getAggregate(e) { + const i = M8e(e, !0), r = this._tree.findIf((n) => n.displayId === i); + return Sa(r, (n) => this._toFeatureJSON(n)); + } + getAggregates() { + return this._tree.findAllIf((e) => e.depth === this._geohashLevel).map(this._toFeatureJSON.bind(this)); + } + getDisplayId(e) { + const i = this._tree.findIf((r) => r.id === e); + return Sa(i, (r) => r.displayId); + } + getFeatureDisplayIdsForAggregate(e) { + const i = this._tree.findIf((r) => r.id === e); + return $_(i, [], (r) => Array.from(r.displayIds)); + } + getDisplayIdForReferenceId(e) { + const i = this._tree.findIf((r) => r.displayIds.size === 1 && r.displayIds.has(e)); + return Sa(i, (r) => r.displayId); + } + _toFeatureJSON(e) { + const i = this._spatialReference; + return { displayId: e.displayId, attributes: e.getAttributes(), geometry: zx(e.getGeometry(i), "esriGeometryPolygon", !1, !1), centroid: null }; + } + _rebuildTree() { + this._bitsets.computed.clear(), this._bitsets.inserted.clear(), this._tree && this._tree.clear(); + } + _remove(e) { + const i = e.getDisplayId(), r = e.getXHydrated(), n = e.getYHydrated(), s = this._geohashBuf[2 * i], o = this._geohashBuf[2 * i + 1]; + this._bitsets.inserted.has(i) && (this._bitsets.inserted.unset(i), this._tree.removeCursor(e, r, n, s, o, this._geohashLevel)); + } + _update(e, i) { + const r = e.getDisplayId(), n = this._bitsets.inserted, s = i.isVisible(r); + if (s === n.has(r)) + return; + if (!s) + return void this._remove(e); + const o = e.getXHydrated(), a = e.getYHydrated(); + if (!this._setGeohash(r, o, a)) + return; + const l = this._geohashBuf[2 * r], c = this._geohashBuf[2 * r + 1]; + this._tree.insertCursor(e, r, o, a, l, c, this._geohashLevel), n.set(r); + } + _setGeohash(e, i, r) { + if (this._bitsets.geohash.has(e)) + return !0; + const n = this._geohashBuf; + if (this._spatialReference.isWebMercator) { + const s = HZe(i / Du.radius), o = s - 360 * Math.floor((s + 180) / 360), a = HZe(Math.PI / 2 - 2 * Math.atan(Math.exp(-r / Du.radius))); + yfe(n, e, a, o, zZe); + } else { + const s = Cp({ x: i, y: r }, this._spatialReference, or.WGS84); + if (!s) + return !1; + yfe(n, e, s.y, s.x, zZe); + } + return this._bitsets.geohash.set(e), !0; + } + _getBinsForTile(e, i, r, n) { + try { + const s = this._getGeohashBounds(i), o = this._tree.getBins(s); + for (const a of o) { + a.displayId || (a.displayId = n.createDisplayId(!0)); + let l = null; + const c = a.getGeometry(this._spatialReference, r.tile); + c || (l = a.getGeometryCentroid(this._spatialReference, r.tile)); + const h = new g1(c, a.getAttributes(), l); + h.objectId = a.id, h.displayId = a.displayId, e.push(h); + } + } catch { + return void pxe.error("Unable to get bins for tile", i.key.id); + } + } + _getGeohash(e, i, r) { + const n = { geohashX: 0, geohashY: 0 }; + return nce(n, i, e, r), n; + } + _getGeohashBounds(e) { + const i = this._getGeohashLevel(e.key.level), r = [e.extent.xmin, e.extent.ymin, e.extent.xmax, e.extent.ymax], n = xo.fromExtent(br.fromBounds(r, this._spatialReference)), s = Cp(n, this._spatialReference, or.WGS84, { densificationStep: e.resolution * J9i }), o = VF(new Rl(), s, !1, !1), a = o.coords.filter((I, P) => !(P % 2)), l = o.coords.filter((I, P) => P % 2), c = Math.min(...a), h = Math.min(...l), p = Math.max(...a), y = Math.max(...l), v = this._getGeohash(c, h, i), x = this._getGeohash(p, y, i); + return { bounds: r, geohashBounds: { xLL: v.geohashX, yLL: v.geohashY, xTR: x.geohashX, yTR: x.geohashY }, level: i }; + } + _getGeohashLevel(e) { + return this._schema.params.fixedBinLevel; + } + _getTransforms(e, i) { + const r = { originPosition: "upperLeft", scale: [e.resolution, e.resolution], translate: [e.bounds[0], e.bounds[3]] }, n = Ld(i); + if (!n) + return { tile: r, left: null, right: null }; + const [s, o] = n.valid; + return { tile: r, left: { ...r, translate: [o, e.bounds[3]] }, right: { ...r, translate: [s - o + e.bounds[0], e.bounds[3]] } }; + } +}; +const fxe = 12, tBi = 64, WZe = 1, iBi = Sx(); +let rBi = class rPt extends Fei { + constructor(e, i, r, n, s) { + super(new Rl([], [i, r]), n, null, e), this.geohashBoundsInfo = s; + } + get count() { + return this.attributes.cluster_count; + } + static create(e, i, r, n, s, o, a, l) { + const c = new rPt(i, r, n, o, a); + return c.displayId = e.createDisplayId(!0), c.referenceId = l, c.tileLevel = s, c; + } + update(e, i, r, n, s, o) { + return this.geometry.coords[0] = e, this.geometry.coords[1] = i, this.tileLevel = r, this.attributes = n, this.geohashBoundsInfo = s, this.referenceId = null, this.referenceId = o, this; + } + toJSON() { + return { attributes: { ...this.attributes, aggregateId: this.objectId, referenceId: this.attributes.cluster_count === 1 ? this.referenceId : null }, geometry: { x: this.geometry.coords[0], y: this.geometry.coords[1] } }; + } +}; +function fB(t) { + return 57.29577951308232 * t; +} +let nBi = class extends x8e { + constructor(e, i, r, n) { + super(e, r), this.type = "cluster", this.events = new Bd(), this.objectIdField = "aggregateId", this.featureAdapter = uve, this._geohashLevel = 0, this._tileLevel = 0, this._aggregateValueRanges = {}, this._aggregateValueRangesChanged = !1, this._geohashBuf = [], this._clusters = /* @__PURE__ */ new Map(), this._tiles = /* @__PURE__ */ new Map(), this._serviceInfo = n, this.geometryInfo = e.geometryInfo, this._spatialReference = i, this._projectionSupportCheck = Py(i, or.WGS84), this._bitsets.geohash = r.getBitset(r.createBitset()), this._bitsets.inserted = r.getBitset(r.createBitset()); + } + destroy() { + this._tree.destroy(); + } + get featureSpatialReference() { + return this._spatialReference; + } + get fields() { + return this._fields; + } + async updateSchema(e, i) { + const r = this._schema; + try { + await super.updateSchema(e, i), await this._projectionSupportCheck; + } catch { + } + this._fields = this._schema.params.fields; + const n = zS(r, i); + i && (!ut(n) || e.source || e.storage.filters) ? ((zO(n, "params.fields") || !this._tree || e.source) && (this._tree && this._tree.destroy(), this._tree = new iPt(this._statisticFields, this._serviceInfo), this._rebuildTree(), Vi("esri-2d-update-debug") && console.debug("Aggregate mesh needs update due to tree changing")), Vi("esri-2d-update-debug") && console.debug("Applying Update - ClusterStore:", n), e.targets[i.name] = !0, e.mesh = !1, this._aggregateValueRanges = {}) : r && (e.mesh = !0); + } + clear() { + this._rebuildTree(); + } + sweepFeatures(e, i) { + this._bitsets.inserted.forEachSet((r) => { + if (!e.has(r)) { + const n = i.lookupByDisplayIdUnsafe(r); + this._remove(n); + } + }); + } + sweepAggregates(e, i, r) { + this._clusters.forEach((n, s) => { + n && n.tileLevel !== r && (e.releaseDisplayId(n.displayId), i.unsetAttributeData(n.displayId), this._clusters.delete(s)); + }); + } + onTileData(e, i, r, n, s = !0) { + if (!this._schema || ut(i.addOrUpdate)) + return i; + this.events.emit("changed"); + const o = this._getTransforms(e, this._spatialReference); + { + const c = i.addOrUpdate.getCursor(); + for (; c.next(); ) + this._update(c, n); + } + if (i.status.mesh || !s) + return i; + const a = new Array(), l = this._schema.params.clusterRadius; + this._getClustersForTile(a, e, l, r, o), i.addOrUpdate = Vv.fromOptimizedFeatures(a, this._serviceInfo), i.addOrUpdate.attachStorage(r), i.clear = !0, i.end = !0; + { + const c = i.addOrUpdate.getCursor(); + for (; c.next(); ) { + const h = c.getDisplayId(); + this._bitsets.computed.unset(h), this.setComputedAttributes(r, c, h, e.scale); + } + } + return this._aggregateValueRangesChanged && i.end && (this.events.emit("valueRangesChanged", { valueRanges: this._aggregateValueRanges }), this._aggregateValueRangesChanged = !1), i; + } + onTileUpdate({ added: e, removed: i }) { + if (e.length) { + const n = e[0].level; + this._tileLevel = n, this._setGeohashLevel(n); + } + if (!this._schema) + return; + const r = this._schema.params.clusterRadius; + i.forEach((n) => { + this._tiles.delete(n.key.id), this._markTileClustersForDeletion(n, r); + }); + } + getAggregate(e) { + for (const i of this._clusters.values()) + if ((i?.displayId & em) == (e & em)) + return i.toJSON(); + return null; + } + getAggregates() { + const e = []; + for (const i of this._clusters.values()) + i?.tileLevel === this._tileLevel && e.push(i.toJSON()); + return e; + } + getDisplayId(e) { + const i = this._clusters.get(e); + return i ? i.displayId : null; + } + getFeatureDisplayIdsForAggregate(e) { + const i = this._clusters.get(e); + return i ? this._tree.getRegionDisplayIds(i.geohashBoundsInfo) : []; + } + getDisplayIdForReferenceId(e) { + for (const i of this._clusters.values()) + if (i?.referenceId === e) + return i.displayId; + return null; + } + getAggregateValueRanges() { + return this._aggregateValueRanges; + } + forEach(e) { + this._clusters.forEach((i) => { + if (!i) + return; + const r = i.toJSON(), n = Vv.fromFeatures([r], { objectIdField: this.objectIdField, globalIdField: null, geometryType: this.geometryInfo.geometryType, fields: this.fields }).getCursor(); + n.next(), e(n); + }); + } + forEachInBounds(e, i) { + } + forEachBounds(e, i) { + const { hasM: r, hasZ: n } = this.geometryInfo; + for (const s of e) { + const o = aye(iBi, s.readGeometry(), n, r); + ut(o) || i(o); + } + } + size() { + let e = 0; + return this.forEach((i) => e++), e; + } + _rebuildTree() { + this._bitsets.computed.clear(), this._bitsets.inserted.clear(), this._tree && this._tree.clear(); + } + _remove(e) { + const i = e.getDisplayId(), r = e.getXHydrated(), n = e.getYHydrated(), s = this._geohashBuf[2 * i], o = this._geohashBuf[2 * i + 1]; + this._bitsets.inserted.has(i) && (this._bitsets.inserted.unset(i), this._tree.removeCursor(e, r, n, s, o, this._geohashLevel)); + } + _update(e, i) { + const r = e.getDisplayId(), n = this._bitsets.inserted, s = i.isVisible(r); + if (s === n.has(r)) + return; + if (!s) + return void this._remove(e); + const o = e.getXHydrated(), a = e.getYHydrated(); + if (!this._setGeohash(r, o, a)) + return; + const l = this._geohashBuf[2 * r], c = this._geohashBuf[2 * r + 1]; + this._tree.insertCursor(e, r, o, a, l, c, this._geohashLevel), n.set(r); + } + _setGeohash(e, i, r) { + if (this._bitsets.geohash.has(e)) + return !0; + const n = this._geohashBuf; + if (this._spatialReference.isWebMercator) { + const s = fB(i / Du.radius), o = s - 360 * Math.floor((s + 180) / 360), a = fB(Math.PI / 2 - 2 * Math.atan(Math.exp(-r / Du.radius))); + yfe(n, e, a, o, fxe); + } else { + const s = Cp({ x: i, y: r }, this._spatialReference, or.WGS84); + if (!s) + return !1; + yfe(n, e, s.y, s.x, fxe); + } + return this._bitsets.geohash.set(e), !0; + } + _getClustersForTile(e, i, r, n, s, o = !0) { + const a = this._schema.params.clusterPixelBuffer, l = 2 * r, c = Math.ceil(2 ** i.key.level * Sc / l) + 1, h = Math.ceil(a / l) + 0, p = Math.ceil(Sc / l), { row: y, col: v } = i.key, x = v * Sc, I = y * Sc, P = Math.floor(x / l) - h, F = Math.floor(I / l) - h, k = P + p + 2 * h, V = F + p + 2 * h, j = i.tileInfoView.getLODInfoAt(i.key.level); + for (let Y = P; Y <= k; Y++) + for (let X = F; X <= V; X++) { + let Q = Y; + j.wrap && (Q = Y < 0 ? Y + c : Y % c); + const re = j.wrap && Y < 0, he = j.wrap && Y % c !== Y, fe = this._lookupCluster(n, j, i.key.level, Q, X, i); + if (_e(fe)) { + const be = Sa(s, (Se) => re ? Se.left : he ? Se.right : Se.tile); + if (o && ut(be) || !fe.count) + continue; + if (_e(be) && o) { + const Se = fe.geometry.clone(); + let Me = fe.attributes; + Se.coords[0] = gJ(be, Se.coords[0]), Se.coords[1] = yJ(be, Se.coords[1]), fe.count === 1 && _e(fe.referenceId) && (Me = { ...fe.attributes, referenceId: fe.referenceId }); + const ke = new g1(Se, Me); + ke.displayId = fe.displayId, e.push(ke); + } + } + } + } + _getGeohashLevel(e) { + return Math.min(Math.ceil(e / 2 + 2), fxe); + } + _setGeohashLevel(e) { + const i = this._getGeohashLevel(e), r = (Math.floor(i / WZe) + 1) * WZe - 1; + if (this._geohashLevel !== r) + return this._geohashLevel = r, this._rebuildTree(), void this._bitsets.geohash.clear(); + } + _getTransforms(e, i) { + const r = { originPosition: "upperLeft", scale: [e.resolution, e.resolution], translate: [e.bounds[0], e.bounds[3]] }, n = Ld(i); + if (!n) + return { tile: r, left: null, right: null }; + const [s, o] = n.valid; + return { tile: r, left: { ...r, translate: [o, e.bounds[3]] }, right: { ...r, translate: [s - o + e.bounds[0], e.bounds[3]] } }; + } + _getClusterId(e, i, r) { + return (15 & e) << 28 | (16383 & i) << 14 | 16383 & r; + } + _markForDeletion(e, i, r) { + const n = this._getClusterId(e, i, r); + this._clusters.delete(n); + } + _getClusterBounds(e, i, r) { + const n = this._schema.params.clusterRadius, s = 2 * n; + let o = r % 2 ? i * s : i * s - n; + const a = r * s; + let l = o + s; + const c = a - s, h = 2 ** e.level * Sc; + e.wrap && o < 0 && (o = 0), e.wrap && l > h && (l = h); + const p = o / Sc, y = a / Sc, v = l / Sc, x = c / Sc; + return [e.getXForColumn(p), e.getYForRow(y), e.getXForColumn(v), e.getYForRow(x)]; + } + _getGeohash(e, i, r) { + const n = { geohashX: 0, geohashY: 0 }; + return nce(n, i, e, r), n; + } + _getGeohashBounds(e, i) { + const r = this._getGeohashLevel(e.key.level); + if (this._spatialReference.isWebMercator) { + const [I, P, F, k] = i, V = { x: I, y: P }, j = { x: F, y: k }; + let Y = 0, X = 0, Q = 0, re = 0; + { + const be = fB(V.x / Du.radius); + Y = be - 360 * Math.floor((be + 180) / 360), X = fB(Math.PI / 2 - 2 * Math.atan(Math.exp(-V.y / Du.radius))); + } + { + const be = fB(j.x / Du.radius); + Q = be - 360 * Math.floor((be + 180) / 360), re = fB(Math.PI / 2 - 2 * Math.atan(Math.exp(-j.y / Du.radius))); + } + const he = { geohashX: 0, geohashY: 0 }, fe = { geohashX: 0, geohashY: 0 }; + return nce(he, X, Y, r), nce(fe, re, Q, r), { bounds: [I, P, F, k], geohashBounds: { xLL: he.geohashX, yLL: he.geohashY, xTR: fe.geohashX, yTR: fe.geohashY }, level: r }; + } + const n = xo.fromExtent(br.fromBounds(i, this._spatialReference)), s = Cp(n, this._spatialReference, or.WGS84, { densificationStep: e.resolution * tBi }); + if (!s) + return null; + const o = VF(new Rl(), s, !1, !1), a = o.coords.filter((I, P) => !(P % 2)), l = o.coords.filter((I, P) => P % 2), c = Math.min(...a), h = Math.min(...l), p = Math.max(...a), y = Math.max(...l), v = this._getGeohash(c, h, r), x = this._getGeohash(p, y, r); + return { bounds: i, geohashBounds: { xLL: v.geohashX, yLL: v.geohashY, xTR: x.geohashX, yTR: x.geohashY }, level: r }; + } + _lookupCluster(e, i, r, n, s, o) { + const a = this._getClusterId(r, n, s), l = this._clusters.get(a), c = this._getClusterBounds(i, n, s), h = this._getGeohashBounds(o, c); + if (ut(h)) + return null; + const p = this._tree.getRegionStatistics(h), { count: y, xTotal: v, yTotal: x, referenceId: I } = p, P = y ? v / y : 0, F = y ? x / y : 0; + if (y === 0) + return this._clusters.set(a, null), null; + const k = { cluster_count: y, ...p.attributes }, V = _e(l) ? l.update(P, F, r, k, h, I) : rBi.create(e, a, P, F, r, k, h, I); + if (y === 0) { + const [j, Y, X, Q] = c; + V.geometry.coords[0] = (j + X) / 2, V.geometry.coords[1] = (Y + Q) / 2; + } + return this._clusters.set(a, V), this._updateAggregateValueRangeForCluster(V, V.tileLevel), V; + } + _updateAggregateValueRangeForCluster(e, i) { + const r = this._aggregateValueRanges[i] || { minValue: 1 / 0, maxValue: 0 }, n = r.minValue, s = r.maxValue; + r.minValue = Math.min(n, e.count), r.maxValue = Math.max(s, e.count), this._aggregateValueRanges[i] = r, n === r.minValue && s === r.maxValue || (this._aggregateValueRangesChanged = !0); + } + _markTileClustersForDeletion(e, i) { + const r = 2 * i, n = Math.ceil(Sc / r), { row: s, col: o } = e.key, a = o * Sc, l = s * Sc, c = Math.floor(a / r), h = Math.floor(l / r); + for (let p = c; p < c + n; p++) + for (let y = h; y < h + n; y++) + this._markForDeletion(e.key.level, p, y); + } +}, sBi = class { + constructor() { + this._freeIds = [], this._idCounter = 1; + } + createId(e = !1) { + return M8e(this._getFreeId(), e); + } + releaseId(e) { + this._freeIds.push(e); + } + _getFreeId() { + return this._freeIds.length ? this._freeIds.pop() : this._idCounter++; + } +}; +function Ioe(t, e, i) { + if (!(t.length > e)) + for (; t.length <= e; ) + t.push(i); +} +let nPt = class { + constructor() { + this._numerics = [], this._strings = [], this._idGenerator = new sBi(), this._allocatedSize = 256, this._bitsets = [], this._instanceIds = [], this._bounds = []; + } + createBitset() { + const e = this._bitsets.length; + return this._bitsets.push(S8e.create(this._allocatedSize, em)), e + 1; + } + getBitset(e) { + return this._bitsets[e - 1]; + } + _expand() { + this._allocatedSize <<= 1; + for (const e of this._bitsets) + e.resize(this._allocatedSize); + } + _ensureNumeric(e, i) { + this._numerics[e] || (this._numerics[e] = []), Ioe(this._numerics[e], i, 0); + } + _ensureInstanceId(e) { + Ioe(this._instanceIds, e, 0); + } + _ensureString(e, i) { + this._strings[e] || (this._strings[e] = []), Ioe(this._strings[e], i, null); + } + createDisplayId(e = !1) { + const i = this._idGenerator.createId(); + return i > this._allocatedSize && this._expand(), M8e(i, e); + } + releaseDisplayId(e) { + for (const i of this._bitsets) + i.unset(e); + return this._idGenerator.releaseId(e & em); + } + getComputedNumeric(e, i) { + return this.getComputedNumericAtIndex(e & em, 0); + } + setComputedNumeric(e, i, r) { + return this.setComputedNumericAtIndex(e & em, r, 0); + } + getComputedString(e, i) { + return this.getComputedStringAtIndex(e & em, 0); + } + setComputedString(e, i, r) { + return this.setComputedStringAtIndex(e & em, 0, r); + } + getComputedNumericAtIndex(e, i) { + const r = e & em; + return this._ensureNumeric(i, r), this._numerics[i][r]; + } + setComputedNumericAtIndex(e, i, r) { + const n = e & em; + this._ensureNumeric(i, n), this._numerics[i][n] = r; + } + getInstanceId(e) { + const i = e & em; + return this._ensureInstanceId(i), this._instanceIds[i]; + } + setInstanceId(e, i) { + const r = e & em; + this._ensureInstanceId(r), this._instanceIds[r] = i; + } + getComputedStringAtIndex(e, i) { + const r = e & em; + return this._ensureString(i, r), this._strings[i][r]; + } + setComputedStringAtIndex(e, i, r) { + const n = e & em; + this._ensureString(i, n), this._strings[i][n] = r; + } + getXMin(e) { + return this._bounds[4 * (e & em)]; + } + getYMin(e) { + return this._bounds[4 * (e & em) + 1]; + } + getXMax(e) { + return this._bounds[4 * (e & em) + 2]; + } + getYMax(e) { + return this._bounds[4 * (e & em) + 3]; + } + setBounds(e, i) { + const r = i.readHydratedGeometry(); + if (!r || !r.coords.length) + return !1; + let n = 1 / 0, s = 1 / 0, o = -1 / 0, a = -1 / 0; + r.forEachVertex((c, h) => { + n = Math.min(n, c), s = Math.min(s, h), o = Math.max(o, c), a = Math.max(a, h); + }); + const l = e & em; + return Ioe(this._bounds, 4 * l + 4, 0), this._bounds[4 * l] = n, this._bounds[4 * l + 1] = s, this._bounds[4 * l + 2] = o, this._bounds[4 * l + 3] = a, !0; + } +}; +const oBi = 5e3, aBi = "tileRenderer.featuresView.attributeView.initialize", lBi = "tileRenderer.featuresView.attributeView.requestUpdate", uBi = "tileRenderer.featuresView.requestRender"; +function cBi(t) { + return t.name === "worker:port-closed"; +} +function PA(t) { + if (!us(t) && !cBi(t)) + throw t; +} +function qZe(t) { + return t.type === "feature" && t.mode === "snapshot"; +} +let G2 = class extends vn { + constructor() { + super(...arguments), this._storage = new nPt(), this._markedIdsBufId = this._storage.createBitset(), this._lastCleanup = performance.now(), this._cleanupNeeded = !1, this._invalidated = !1, this._tileToResolver = /* @__PURE__ */ new Map(), this._didEdit = !1, this._updateVersion = 1, this.tileStore = null, this.config = null, this.processor = null, this.remoteClient = null, this.service = null; + } + initialize() { + this._initStores(), this._initSource(), this._updateQueue = new S$({ concurrency: this._source.type === "stream" ? 1 : 4, process: (e, i) => this._onTileMessage(e, { signal: i }) }), this.addHandles([this.tileStore.on("update", this.onTileUpdate.bind(this)), Oy(() => !this.updating, () => this.onIdle())]), this._checkUpdating = setInterval(() => this.notifyChange("updating"), 300); + } + _initSource() { + const e = this.tileStore.tileScheme, i = () => this._updateQueue && this._updateQueue.length < 50, r = (n, s) => (this._invalidated = !0, this._patchTile(n, s)); + this._source = F8i(this.service, this.spatialReference, e, r, i, this.featureStore), this._proxyEvents(); + } + _proxyEvents() { + if (this._source.type === "stream") { + const e = this._source.events, i = this._source; + this.addHandles([Qi(() => i.connectionStatus, (r) => this.remoteClient.invoke("setProperty", { propertyName: "connectionStatus", value: r }).catch(PA), { initial: !0 }), Qi(() => i.errorString, (r) => this.remoteClient.invoke("setProperty", { propertyName: "errorString", value: r }).catch(PA), { initial: !0 }), e.on("data-received", (r) => this.remoteClient.invoke("emitEvent", { name: "data-received", event: { attributes: r.attributes, centroid: r.centroid, geometry: r.geometry } }).catch(PA)), e.on("message-received", (r) => this.remoteClient.invoke("emitEvent", { name: "message-received", event: r }).catch(PA)), e.on("updateRate", (r) => this.remoteClient.invoke("emitEvent", { name: "update-rate", event: { ...r } }).catch(PA))]); + } + } + _initAttributeStore(e) { + this.attributeStore || (this.attributeStore = new tPt({ type: "remote", initialize: (i, r) => Ef(this.remoteClient.invoke(aBi, i, { signal: r }).catch(PA)), update: (i, r) => Ef(this.remoteClient.invoke(lBi, i, { signal: r }).catch(PA)), render: (i) => Ef(this.remoteClient.invoke(uBi, void 0, { signal: i }).catch(PA)) }, e, () => this.notifyChange("updating"))); + } + _initStores() { + const e = this.service.type === "snapshot" ? "snapshot" : "on-demand", i = { geometryInfo: { geometryType: this.service.geometryType, hasM: !1, hasZ: !1 }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields }; + this.featureStore = new k$i(i, this._storage, e); + } + _initQueryEngine(e) { + const i = this; + this.featureQueryEngine?.destroy(), this.featureQueryEngine = new B$({ definitionExpression: e.schema.source.definitionExpression ?? void 0, fields: this.service.fields, geometryType: this.service.geometryType, objectIdField: this.service.objectIdField, hasM: !1, hasZ: !1, spatialReference: this.spatialReference.toJSON(), cacheSpatialQueries: !0, featureStore: this.featureStore, aggregateAdapter: { getFeatureObjectIds(r) { + return ut(i.aggregateStore) ? [] : i.aggregateStore.getFeatureDisplayIdsForAggregate(r).map((n) => i.getObjectId(n)); + } }, timeInfo: this.service.timeInfo }); + } + _initAggregateQueryEngine(e, i) { + if (this.aggregateQueryEngine?.destroy(), ut(e)) + return; + const r = i.targets.aggregate.params.fields.slice(); + this.aggregateQueryEngine = new B$({ definitionExpression: void 0, fields: r, geometryType: e.geometryInfo.geometryType, objectIdField: e.objectIdField, hasM: e.geometryInfo.hasM, hasZ: e.geometryInfo.hasZ, spatialReference: this.spatialReference.toJSON(), cacheSpatialQueries: !1, featureStore: e, aggregateAdapter: { getFeatureObjectIds: (n) => [] } }); + } + destroy() { + this._updateQueue.destroy(), this._source.destroy(), this.featureQueryEngine?.destroy(), this.aggregateQueryEngine?.destroy(), this.attributeStore?.destroy(); + for (const e of this.tileStore.tiles) + this._source.unsubscribe(e); + clearInterval(this._checkUpdating); + } + get fieldsIndex() { + return new sg(this.service.fields); + } + get spatialReference() { + return this.tileStore.tileScheme.spatialReference; + } + get updating() { + return this.isUpdating(); + } + isUpdating() { + const e = this._source.updating, i = !!this._updateQueue.length, r = !this.attributeStore || this.attributeStore.isUpdating(), n = e || i || r; + return Vi("esri-2d-log-updating") && console.log(`Updating FeatureController2D: ${n} + -> updatingSource ${e} + -> updateQueue ${i} + -> updatingAttributeStore ${r} +`), n; + } + updateCustomParameters(e) { + this._source.type === "stream" && this._source.updateCustomParameters(e); + } + enableEvent(e) { + this._source.enableEvent(e.name, e.value); + } + pause() { + this._updateQueue.pause(), this._updateQueue.clear(); + } + resume() { + this._updateQueue.resume(); + } + pauseStream() { + this._source.type === "stream" && this._source.pauseStream(); + } + resumeStream() { + this._source.type === "stream" && this._source.resumeStream(); + } + sendMessageToSocket(e) { + this._source.type === "stream" && this._source.sendMessageToSocket(e); + } + sendMessageToClient(e) { + this._source.type === "stream" && this._source.sendMessageToClient(e); + } + _initAggregateStore(e) { + const i = e.schema.targets?.aggregate?.type; + if (Sa(this.config, (n) => n.schema.targets?.aggregate?.type) !== i && (_e(this.aggregateStore) && (this.removeHandles("valueRangesChanged"), this.aggregateStore.destroy(), this.aggregateStore = null), i)) { + switch (i) { + case "cluster": { + const n = { geometryInfo: { geometryType: "esriGeometryPoint", hasM: !1, hasZ: !1 }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields }; + this.aggregateStore = new nBi(n, this.spatialReference, this._storage, this.service), this.addHandles(this.aggregateStore.events.on("valueRangesChanged", (s) => { + this.remoteClient.invoke("emitEvent", { name: "valueRangesChanged", event: { valueRanges: s.valueRanges } }).catch(PA); + }), "valueRangesChanged"); + break; + } + case "bin": { + const n = { geometryInfo: { geometryType: "esriGeometryPolygon", hasM: !1, hasZ: !1 }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields }; + this.aggregateStore = new eBi(n, this.spatialReference, this._storage, this.service); + break; + } + } + this.aggregateStore.onTileUpdate({ added: this.tileStore.tiles, removed: [] }); + } + } + async update(e, i) { + this._updateVersion++, this._initQueryEngine(i), this._initAttributeStore(i), this.pause(), await Promise.all([this._source.update(e, i.schema.source), this.featureStore.updateSchema(e, i.schema.targets.feature), this.attributeStore.update(e, i), this.attributeStore.updateFilters(e, i, this)]), this._initAggregateStore(i), _e(this.aggregateStore) && await this.aggregateStore.updateSchema(e, i.schema.targets.aggregate), this._initAggregateQueryEngine(this.aggregateStore, i.schema), Vi("esri-2d-update-debug") && e.describe(), this._set("config", i); + } + async applyUpdate(e) { + e.version = this._updateVersion, Vi("esri-2d-update-debug") && console.debug(`Applying update ${e.version}`), e.mesh && this.clearTiles(), this._updateQueue.resume(), await this._source.applyUpdate(e), this.notifyChange("updating"), await Tb(() => !this.updating), _e(this.aggregateStore) && (await _4(10), await Tb(() => !this.updating)); + } + async onEdits({ edits: e }) { + Vi("esri-2d-update-debug") && console.debug("Applying Edit:", e), this._didEdit = !0; + try { + const i = e.removed.map((n) => n.objectId && n.objectId !== -1 ? n.objectId : this._lookupObjectIdByGlobalId(n.globalId)), r = e.addOrModified.map(({ objectId: n }) => n); + this.featureStore.invalidate(), await this._source.edit(r, i), this.clearTiles(), this.notifyChange("updating"), _e(this.aggregateStore) && this.aggregateStore.clear(), await this._source.resend(), await Tb(() => !this.updating); + } catch { + } + } + async refresh(e) { + if (!e.dataChanged) { + const i = Y_.empty(); + return i.storage.filters = !0, this.applyUpdate(i); + } + this.featureStore.invalidate(), this.clearTiles(), this._source.refresh(this._updateVersion, e), this._cleanupNeeded = !0, this.notifyChange("updating"), await Tb(() => !this.updating); + } + clearTiles() { + for (const e of this.tileStore.tiles) + this.processor.onTileClear(e); + } + onTileUpdate(e) { + _e(this.aggregateStore) && this.aggregateStore.onTileUpdate(e); + for (const i of e.added) + this._source.subscribe(i, this._updateVersion), this._level = i.level; + for (const i of e.removed) + this._source.unsubscribe(i), this._cleanupNeeded = !0, this._tileToResolver.has(i.id) && (this._tileToResolver.get(i.id).resolve(), this._tileToResolver.delete(i.id)); + this.notifyChange("updating"); + } + async onIdle() { + this._invalidated && (this._invalidated = !1, (_e(this.aggregateStore) || this.processor.type === "heatmap") && await this._repushCurrentLevelTiles()), this._markAndSweep(); + } + async querySummaryStatistics({ query: e, params: i }) { + return this.featureQueryEngine.executeQueryForSummaryStatistics(e, i); + } + async queryAggregateSummaryStatistics({ query: e, params: i }) { + return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e, i); + } + async queryUniqueValues({ query: e, params: i }) { + return this.featureQueryEngine.executeQueryForUniqueValues(e, i); + } + async queryAggregateUniqueValues({ query: e, params: i }) { + return this.aggregateQueryEngine.executeQueryForUniqueValues(e, i); + } + async queryClassBreaks({ query: e, params: i }) { + return this.featureQueryEngine.executeQueryForClassBreaks(e, i); + } + async queryAggregateClassBreaks({ query: e, params: i }) { + return this.aggregateQueryEngine.executeQueryForClassBreaks(e, i); + } + async queryHistogram({ query: e, params: i }) { + return this.featureQueryEngine.executeQueryForHistogram(e, i); + } + async queryAggregateHistogram({ query: e, params: i }) { + return this.aggregateQueryEngine.executeQueryForHistogram(e, i); + } + queryExtent(e) { + return this.featureQueryEngine.executeQueryForExtent(e); + } + queryAggregates(e) { + return this.aggregateQueryEngine.executeQuery(e); + } + queryAggregateCount(e) { + return this.aggregateQueryEngine.executeQueryForCount(e); + } + queryAggregateIds(e) { + return this.aggregateQueryEngine.executeQueryForIds(e); + } + queryFeatures(e) { + return this.featureQueryEngine.executeQuery(e); + } + async queryVisibleFeatures(e) { + const i = await this.featureQueryEngine.executeQuery(e), r = i.objectIdFieldName; + return i.features = i.features.filter((n) => { + const s = n.attributes[r], o = this.getDisplayId(s); + return Sa(o, (a) => this.attributeStore.isVisible(a)); + }), i; + } + queryFeatureCount(e) { + return this.featureQueryEngine.executeQueryForCount(e); + } + queryLatestObservations(e) { + return this.featureQueryEngine.executeQueryForLatestObservations(e); + } + queryObjectIds(e) { + return this.featureQueryEngine.executeQueryForIds(e); + } + async queryStatistics() { + return this.featureStore.storeStatistics; + } + getObjectId(e) { + return this.featureStore.lookupObjectId(e, this._storage); + } + getDisplayId(e) { + if (_e(this.aggregateStore)) { + const i = this.aggregateStore.getDisplayId(e); + if (ut(i)) { + const r = this.featureStore.lookupDisplayId(e); + return this.aggregateStore.getDisplayIdForReferenceId(r); + } + return i; + } + return this.featureStore.lookupDisplayId(e); + } + getFeatures(e) { + const i = [], r = []; + for (const n of e) { + const s = _e(this.aggregateStore) ? this.getAggregate(n) : null; + if (_e(s)) + if (_e(s.attributes.referenceId)) { + const o = this.getFeature(s.attributes.referenceId); + _e(o) && i.push(o); + } else + r.push(s); + else { + const o = this.getFeature(n); + _e(o) && i.push(o); + } + } + return { features: i, aggregates: r }; + } + getFeature(e) { + const i = this.featureStore.lookupFeatureByDisplayId(e, this._storage); + if (ut(i)) + return null; + const r = i.readHydratedGeometry(), n = zx(r, i.geometryType, i.hasZ, i.hasM); + return { attributes: i.readAttributes(), geometry: n }; + } + getAggregate(e) { + return ut(this.aggregateStore) ? null : this.aggregateStore.getAggregate(e); + } + getAggregates() { + return ut(this.aggregateStore) ? [] : this.aggregateStore.getAggregates(); + } + async setHighlight(e) { + const i = f$t(e.map((r) => this.getDisplayId(r))); + return this.attributeStore.setHighlight(e, i); + } + _lookupObjectIdByGlobalId(e) { + const i = this.service.globalIdField; + if (ut(i)) + throw new Error("Expected globalIdField to be defined"); + let r = null; + if (this.featureStore.forEach((n) => { + e === n.readAttribute(i) && (r = n.getObjectId()); + }), ut(r)) + throw new Error(`Expected to find a feature with globalId ${e}`); + return r; + } + async _repushCurrentLevelTiles() { + const e = this.tileStore.tiles.filter((r) => r.level === this._level); + e.map(async (r) => this._patchTile({ type: "append", id: r.key.id, clear: !0, addOrUpdate: null, end: !1 })); + const i = e.map(async (r) => this._patchTile({ type: "append", id: r.key.id, addOrUpdate: Vv.fromOptimizedFeatures([], this.service), remove: [], end: !0, isRepush: !0, status: Y_.empty() })); + await Promise.all(i); + } + _maybeForceCleanup() { + performance.now() - this._lastCleanup > oBi && this._markAndSweep(); + } + _patchTile(e, i) { + const r = this._updateQueue.push(e, i).then(() => { + this.notifyChange("updating"); + }).catch((n) => { + this.notifyChange("updating"); + }); + return this.notifyChange("updating"), r; + } + async _onTileMessage(e, i) { + if (hn(i), Vi("esri-2d-update-debug")) { + const o = Sa(e.addOrUpdate, (a) => a.hasFeatures); + console.debug(e.id, `FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${o}]`); + } + const r = this.tileStore.get(e.id); + if (!r) + return; + if (e.clear) + return this.processor.onTileClear(r); + const n = e.status; + this._cleanupNeeded = !0; + const s = []; + for (const o of e.remove ?? []) { + const a = this.featureStore.lookupDisplayId(o); + a && s.push(a); + } + e.remove = s; + try { + if (ut(e.addOrUpdate)) + return void this.processor.onTileMessage(r, { ...e, addOrUpdate: null }, _e(this.aggregateStore), i).catch(eI); + if (e.addOrUpdate.setArcadeSpatialReference(this.spatialReference), this.featureStore.hasInstance(e.addOrUpdate.instance) && n.targets.feature || (n.targets.feature = !0, this.featureStore.onTileData(r, e)), (!n.storage.data || !n.storage.filters) && (n.storage.data = !0, n.storage.filters = !0, this.attributeStore.onTileData(r, e), this._source.type === "stream" || this._didEdit ? (await this.attributeStore.sendUpdates(), hn(i)) : this.attributeStore.sendUpdates()), _e(this.aggregateStore) && !n.targets.aggregate) { + n.targets.aggregate = !0; + const o = qZe(this._source) && this._source.loading, a = !qZe(this._source) || o || e.end; + if (this.aggregateStore.onTileData(r, e, this._storage, this.attributeStore, a), !a) + return; + n.mesh || (this.attributeStore.onTileData(r, e), await this.attributeStore.sendUpdates()); + } + if (!n.mesh) { + n.mesh = !0; + const o = _e(this.aggregateStore) && this.aggregateStore.type === "cluster"; + await this.processor.onTileMessage(r, e, o, i), hn(i); + } + this._maybeForceCleanup(); + } catch (o) { + eI(o); + } + } + _mark(e, i, r) { + const n = (4294901760 & this._storage.getInstanceId(e)) >>> 16; + e && (i.add(n), r.set(e)); + } + _markAndSweep() { + if (this._lastCleanup = performance.now(), !(!(this._source.type === "feature" && this._source.mode === "snapshot") && (this._source.type === "stream" || this._cleanupNeeded))) + return; + this._cleanupNeeded = !1; + const e = this._storage.getBitset(this._markedIdsBufId), i = /* @__PURE__ */ new Set(); + e.clear(); + for (const r of this.tileStore.tiles) + for (const n of this._source.readers(r.id)) { + const s = n.getCursor(); + for (; s.next(); ) { + let o = s.getDisplayId(); + if (!o) { + const a = s.getObjectId(); + o = this.featureStore.lookupDisplayId(a); + } + this._mark(o, i, e); + } + } + this.processor.type === "symbol" && this.processor.forEachBufferId((r) => { + this._mark(r, i, e); + }), this._updateQueue.forEach((r) => { + for (const n of r.remove ?? []) { + const s = this.featureStore.lookupDisplayId(n); + this._mark(s, i, e); + } + }), _e(this.aggregateStore) && (this.aggregateStore.sweepFeatures(e, this.featureStore), "sweepAggregates" in this.aggregateStore && this.aggregateStore.sweepAggregates(this._storage, this.attributeStore, this._level)), this.featureStore.sweepFeatures(e, this._storage, this.attributeStore), this.featureStore.sweepFeatureSets(i); + } +}; +E([N({ constructOnly: !0 })], G2.prototype, "tileStore", void 0), E([N()], G2.prototype, "config", void 0), E([N({ readOnly: !0 })], G2.prototype, "fieldsIndex", null), E([N()], G2.prototype, "processor", void 0), E([N({ constructOnly: !0 })], G2.prototype, "remoteClient", void 0), E([N({ constructOnly: !0 })], G2.prototype, "service", void 0), E([N()], G2.prototype, "spatialReference", null), E([N()], G2.prototype, "updating", null), G2 = E([dt("esri.views.2d.layers.features.controllers.FeatureController2D")], G2); +const hBi = G2; +let PN = class extends aI { + constructor() { + super(...arguments), this.controller = null, this.processor = null, this.remoteClient = null, this.tileStore = null, this.service = null, this.viewState = null, this._paused = !1, this._pendingTileUpdates = []; + } + initialize() { + this.handles.add(Qi(() => this.updating, (e) => { + this.remoteClient.invoke("setUpdating", e).catch((i) => { + }); + })); + } + destroy() { + this.stop(), this.controller?.destroy(), this.processor?.destroy(), this.controller = this.processor = this.tileStore = this.remoteClient = null; + } + get updating() { + return !this.controller || this.controller.updating; + } + stop() { + this._paused = !0, Array.isArray(this.service?.source) && (this.service.source.forEach((e) => e.close()), this.service.source.length = 0), this.tileStore?.updateTiles({ added: [], removed: this.tileStore.tiles.map((e) => e.id) }), this.tileStore?.destroy(), this.tileStore = null, this._pendingTileUpdates.length = 0; + } + async startup({ service: e, config: i, tileInfo: r, tiles: n }) { + if (this._paused = !0, Array.isArray(this.service?.source) && (this.service.source.forEach((s) => s.close()), this.service.source.length = 0), this.service = e, !this.tileStore || !Ea(this.tileStore.tileScheme.spatialReference, r.spatialReference)) { + const s = new f8(Wl.fromJSON(r)); + n.added.length = n.removed.length = 0, this.tileStore?.updateTiles({ added: [], removed: this.tileStore.tiles.map((o) => o.id) }), this.tileStore?.destroy(), this.tileStore = new P1t(s), this._pendingTileUpdates.length = 0; + } + for (await this._createProcessorAndController(i), await this.update({ config: i }), this.controller.resume(), this.tileStore.clear(), this.tileStore.updateTiles(n), this._paused = !1; this._pendingTileUpdates.length; ) + this.tileStore.updateTiles(this._pendingTileUpdates.pop()); + } + async updateTiles(e) { + this._paused ? this._pendingTileUpdates.push(e) : this.tileStore?.updateTiles(e); + } + async update({ config: e }) { + const i = Y_.empty(); + return await Promise.all([this.processor.update(i, e), this.controller.update(i, e)]), i.toJSON(); + } + async applyUpdate(e) { + return this.controller.applyUpdate(Y_.create(e)); + } + async _createProcessorAndController(e) { + await Promise.all([this._handleControllerConfig(e), this._handleProcessorConfig(e)]), this.controller.processor = this.processor; + } + async _handleControllerConfig(e) { + return this._createController(this.service, e); + } + async _handleProcessorConfig(e) { + return this._createProcessor(this.service, e); + } + async _createController(e, i) { + this.controller && this.controller.destroy(); + const { tileStore: r, remoteClient: n } = this, s = new hBi({ service: e, tileStore: r, remoteClient: n }); + return this.controller = s, s; + } + async _createProcessor(e, i) { + const r = i.schema.processors[0].type, n = (await T$i(r)).default, { remoteClient: s, tileStore: o } = this, a = new n({ service: e, config: i, tileStore: o, remoteClient: s }); + return this.processor && this.processor.destroy(), this.processor = a, a; + } +}; +E([N()], PN.prototype, "controller", void 0), E([N()], PN.prototype, "processor", void 0), E([N()], PN.prototype, "updating", null), E([N()], PN.prototype, "viewState", void 0), PN = E([dt("esri.views.2d.layers.features.Pipeline")], PN); +const dBi = PN, pBi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: dBi +}, Symbol.toStringTag, { value: "Module" })); +function L8e() { + const t = new Float32Array(4); + return t[3] = 1, t; +} +function sPt(t) { + const e = new Float32Array(4); + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; +} +function fBi(t, e, i, r) { + const n = new Float32Array(4); + return n[0] = t, n[1] = e, n[2] = i, n[3] = r, n; +} +function mBi(t, e) { + return new Float32Array(t, e, 4); +} +Object.freeze(Object.defineProperty({ __proto__: null, clone: sPt, create: L8e, createView: mBi, fromValues: fBi }, Symbol.toStringTag, { value: "Module" })); +function uee() { + return new Float32Array(3); +} +function oPt(t) { + const e = new Float32Array(3); + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e; +} +function I3(t, e, i) { + const r = new Float32Array(3); + return r[0] = t, r[1] = e, r[2] = i, r; +} +function gBi(t, e) { + return new Float32Array(t, e, 3); +} +function aPt() { + return uee(); +} +function lPt() { + return I3(1, 1, 1); +} +function uPt() { + return I3(1, 0, 0); +} +function cPt() { + return I3(0, 1, 0); +} +function hPt() { + return I3(0, 0, 1); +} +const yBi = aPt(), vBi = lPt(), _Bi = uPt(), bBi = cPt(), wBi = hPt(); +Object.freeze(Object.defineProperty({ __proto__: null, ONES: vBi, UNIT_X: _Bi, UNIT_Y: bBi, UNIT_Z: wBi, ZEROS: yBi, clone: oPt, create: uee, createView: gBi, fromValues: I3, ones: lPt, unitX: uPt, unitY: cPt, unitZ: hPt, zeros: aPt }, Symbol.toStringTag, { value: "Module" })); +var _Re; +let jV = _Re = class extends $i { + constructor() { + super(...arguments), this.field = null, this.minValue = 0, this.maxValue = 255; + } + clone() { + return new _Re({ field: this.field, minValue: this.minValue, maxValue: this.maxValue }); + } +}; +E([N({ type: String, json: { write: !0 } })], jV.prototype, "field", void 0), E([N({ type: Number, nonNullable: !0, json: { write: !0 } })], jV.prototype, "minValue", void 0), E([N({ type: Number, nonNullable: !0, json: { write: !0 } })], jV.prototype, "maxValue", void 0), jV = _Re = E([dt("esri.renderers.support.pointCloud.ColorModulation")], jV); +const xBi = jV, mxe = new zs({ pointCloudFixedSizeAlgorithm: "fixed-size", pointCloudSplatAlgorithm: "splat" }); +let sce = class extends $i { +}; +E([N({ type: mxe.apiValues, readOnly: !0, nonNullable: !0, json: { type: mxe.jsonValues, read: !1, write: mxe.write } })], sce.prototype, "type", void 0), sce = E([dt("esri.renderers.support.pointCloud.PointSizeAlgorithm")], sce); +const N8e = sce; +var bRe; +let GV = bRe = class extends N8e { + constructor() { + super(...arguments), this.type = "fixed-size", this.size = 0, this.useRealWorldSymbolSizes = null; + } + clone() { + return new bRe({ size: this.size, useRealWorldSymbolSizes: this.useRealWorldSymbolSizes }); + } +}; +E([Yr({ pointCloudFixedSizeAlgorithm: "fixed-size" })], GV.prototype, "type", void 0), E([N({ type: Number, nonNullable: !0, json: { write: !0 } })], GV.prototype, "size", void 0), E([N({ type: Boolean, json: { write: !0 } })], GV.prototype, "useRealWorldSymbolSizes", void 0), GV = bRe = E([dt("esri.renderers.support.pointCloud.PointSizeFixedSizeAlgorithm")], GV); +const SBi = GV; +var wRe; +let gX = wRe = class extends N8e { + constructor() { + super(...arguments), this.type = "splat", this.scaleFactor = 1; + } + clone() { + return new wRe({ scaleFactor: this.scaleFactor }); + } +}; +E([Yr({ pointCloudSplatAlgorithm: "splat" })], gX.prototype, "type", void 0), E([N({ type: Number, value: 1, nonNullable: !0, json: { write: !0 } })], gX.prototype, "scaleFactor", void 0), gX = wRe = E([dt("esri.renderers.support.pointCloud.PointSizeSplatAlgorithm")], gX); +const CBi = gX, TBi = { key: "type", base: N8e, typeMap: { "fixed-size": SBi, splat: CBi } }, gxe = ta()({ pointCloudClassBreaksRenderer: "point-cloud-class-breaks", pointCloudRGBRenderer: "point-cloud-rgb", pointCloudStretchRenderer: "point-cloud-stretch", pointCloudUniqueValueRenderer: "point-cloud-unique-value" }); +let dP = class extends $i { + constructor(e) { + super(e), this.type = void 0, this.pointSizeAlgorithm = null, this.colorModulation = null, this.pointsPerInch = 10; + } + clone() { + return console.warn(".clone() is not implemented for " + this.declaredClass), null; + } + cloneProperties() { + return { pointSizeAlgorithm: fi(this.pointSizeAlgorithm), colorModulation: fi(this.colorModulation), pointsPerInch: fi(this.pointsPerInch) }; + } +}; +E([N({ type: gxe.apiValues, readOnly: !0, nonNullable: !0, json: { type: gxe.jsonValues, read: !1, write: gxe.write } })], dP.prototype, "type", void 0), E([N({ types: TBi, json: { write: !0 } })], dP.prototype, "pointSizeAlgorithm", void 0), E([N({ type: xBi, json: { write: !0 } })], dP.prototype, "colorModulation", void 0), E([N({ json: { write: !0 }, nonNullable: !0, type: Number })], dP.prototype, "pointsPerInch", void 0), dP = E([dt("esri.renderers.PointCloudRenderer")], dP), function(t) { + t.fieldTransformTypeKebabDict = new zs({ none: "none", lowFourBit: "low-four-bit", highFourBit: "high-four-bit", absoluteValue: "absolute-value", moduloTen: "modulo-ten" }); +}(dP || (dP = {})); +const Cy = dP; +var xRe; +let PM = xRe = class extends $i { + constructor() { + super(...arguments), this.description = null, this.label = null, this.minValue = 0, this.maxValue = 0, this.color = null; + } + clone() { + return new xRe({ description: this.description, label: this.label, minValue: this.minValue, maxValue: this.maxValue, color: fi(this.color) }); + } +}; +E([N({ type: String, json: { write: !0 } })], PM.prototype, "description", void 0), E([N({ type: String, json: { write: !0 } })], PM.prototype, "label", void 0), E([N({ type: Number, json: { read: { source: "classMinValue" }, write: { target: "classMinValue" } } })], PM.prototype, "minValue", void 0), E([N({ type: Number, json: { read: { source: "classMaxValue" }, write: { target: "classMaxValue" } } })], PM.prototype, "maxValue", void 0), E([N({ type: Wr, json: { type: [Ms], write: !0 } })], PM.prototype, "color", void 0), PM = xRe = E([dt("esri.renderers.support.pointCloud.ColorClassBreakInfo")], PM); +const EBi = PM; +var SRe; +let OM = SRe = class extends Cy { + constructor(t) { + super(t), this.type = "point-cloud-class-breaks", this.field = null, this.legendOptions = null, this.fieldTransformType = null, this.colorClassBreakInfos = null; + } + clone() { + return new SRe({ ...this.cloneProperties(), field: this.field, fieldTransformType: this.fieldTransformType, colorClassBreakInfos: fi(this.colorClassBreakInfos), legendOptions: fi(this.legendOptions) }); + } +}; +E([Yr({ pointCloudClassBreaksRenderer: "point-cloud-class-breaks" })], OM.prototype, "type", void 0), E([N({ json: { write: !0 }, type: String })], OM.prototype, "field", void 0), E([N({ type: jE, json: { write: !0 } })], OM.prototype, "legendOptions", void 0), E([N({ type: Cy.fieldTransformTypeKebabDict.apiValues, json: { type: Cy.fieldTransformTypeKebabDict.jsonValues, read: Cy.fieldTransformTypeKebabDict.read, write: Cy.fieldTransformTypeKebabDict.write } })], OM.prototype, "fieldTransformType", void 0), E([N({ type: [EBi], json: { write: !0 } })], OM.prototype, "colorClassBreakInfos", void 0), OM = SRe = E([dt("esri.renderers.PointCloudClassBreaksRenderer")], OM); +const dPt = OM; +var CRe; +let RM = CRe = class extends Cy { + constructor(t) { + super(t), this.type = "point-cloud-stretch", this.field = null, this.legendOptions = null, this.fieldTransformType = null, this.stops = null; + } + clone() { + return new CRe({ ...this.cloneProperties(), field: fi(this.field), fieldTransformType: fi(this.fieldTransformType), stops: fi(this.stops), legendOptions: fi(this.legendOptions) }); + } +}; +E([Yr({ pointCloudStretchRenderer: "point-cloud-stretch" })], RM.prototype, "type", void 0), E([N({ json: { write: !0 }, type: String })], RM.prototype, "field", void 0), E([N({ type: jE, json: { write: !0 } })], RM.prototype, "legendOptions", void 0), E([N({ type: Cy.fieldTransformTypeKebabDict.apiValues, json: { type: Cy.fieldTransformTypeKebabDict.jsonValues, read: Cy.fieldTransformTypeKebabDict.read, write: Cy.fieldTransformTypeKebabDict.write } })], RM.prototype, "fieldTransformType", void 0), E([N({ type: [Ydt], json: { write: !0 } })], RM.prototype, "stops", void 0), RM = CRe = E([dt("esri.renderers.PointCloudStretchRenderer")], RM); +const pPt = RM; +var TRe; +let ON = TRe = class extends $i { + constructor() { + super(...arguments), this.description = null, this.label = null, this.values = null, this.color = null; + } + clone() { + return new TRe({ description: this.description, label: this.label, values: fi(this.values), color: fi(this.color) }); + } +}; +E([N({ type: String, json: { write: !0 } })], ON.prototype, "description", void 0), E([N({ type: String, json: { write: !0 } })], ON.prototype, "label", void 0), E([N({ type: [String], json: { write: !0 } })], ON.prototype, "values", void 0), E([N({ type: Wr, json: { type: [Ms], write: !0 } })], ON.prototype, "color", void 0), ON = TRe = E([dt("esri.renderers.support.pointCloud.ColorUniqueValueInfo")], ON); +const IBi = ON; +var ERe; +let MM = ERe = class extends Cy { + constructor(t) { + super(t), this.type = "point-cloud-unique-value", this.field = null, this.fieldTransformType = null, this.colorUniqueValueInfos = null, this.legendOptions = null; + } + clone() { + return new ERe({ ...this.cloneProperties(), field: fi(this.field), fieldTransformType: fi(this.fieldTransformType), colorUniqueValueInfos: fi(this.colorUniqueValueInfos), legendOptions: fi(this.legendOptions) }); + } +}; +E([Yr({ pointCloudUniqueValueRenderer: "point-cloud-unique-value" })], MM.prototype, "type", void 0), E([N({ json: { write: !0 }, type: String })], MM.prototype, "field", void 0), E([N({ type: Cy.fieldTransformTypeKebabDict.apiValues, json: { type: Cy.fieldTransformTypeKebabDict.jsonValues, read: Cy.fieldTransformTypeKebabDict.read, write: Cy.fieldTransformTypeKebabDict.write } })], MM.prototype, "fieldTransformType", void 0), E([N({ type: [IBi], json: { write: !0 } })], MM.prototype, "colorUniqueValueInfos", void 0), E([N({ type: jE, json: { write: !0 } })], MM.prototype, "legendOptions", void 0), MM = ERe = E([dt("esri.renderers.PointCloudUniqueValueRenderer")], MM); +const fPt = MM, Td = !0, n6 = { identifierOffset: 0, identifierLength: 10, versionOffset: 10, checksumOffset: 12, byteCount: 16 }; +function k8e(t, e, i) { + return { identifier: String.fromCharCode.apply(null, new Uint8Array(t, i + n6.identifierOffset, n6.identifierLength)), version: e.getUint16(i + n6.versionOffset, Td), checksum: e.getUint32(i + n6.checksumOffset, Td) }; +} +const v_ = { sizeLo: 0, sizeHi: 4, minX: 8, minY: 16, minZ: 24, maxX: 32, maxY: 40, maxZ: 48, errorX: 56, errorY: 64, errorZ: 72, count: 80, reserved: 84, byteCount: 88 }; +function ABi(t, e) { + return { sizeLo: t.getUint32(e + v_.sizeLo, Td), sizeHi: t.getUint32(e + v_.sizeHi, Td), minX: t.getFloat64(e + v_.minX, Td), minY: t.getFloat64(e + v_.minY, Td), minZ: t.getFloat64(e + v_.minZ, Td), maxX: t.getFloat64(e + v_.maxX, Td), maxY: t.getFloat64(e + v_.maxY, Td), maxZ: t.getFloat64(e + v_.maxZ, Td), errorX: t.getFloat64(e + v_.errorX, Td), errorY: t.getFloat64(e + v_.errorY, Td), errorZ: t.getFloat64(e + v_.errorZ, Td), count: t.getUint32(e + v_.count, Td), reserved: t.getUint32(e + v_.reserved, Td) }; +} +function PBi(t) { + const e = new DataView(t, 0); + let i = 0; + const { identifier: r, version: n } = k8e(t, e, i); + if (i += n6.byteCount, r !== "LEPCC ") + throw new ot("lepcc-decode-error", "Bad identifier"); + if (n > 1) + throw new ot("lepcc-decode-error", "Unknown version"); + const s = ABi(e, i); + if (i += v_.byteCount, s.sizeHi * 2 ** 32 + s.sizeLo !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + const o = new Float64Array(3 * s.count), a = [], l = [], c = [], h = []; + if (i = Aoe(t, i, a), i = Aoe(t, i, l), i = Aoe(t, i, c), i = Aoe(t, i, h), i !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad length"); + let p = 0, y = 0; + for (let v = 0; v < a.length; v++) { + y += a[v]; + let x = 0; + for (let I = 0; I < l[v]; I++) { + x += c[p]; + const P = h[p]; + o[3 * p] = Math.min(s.maxX, s.minX + 2 * s.errorX * x), o[3 * p + 1] = Math.min(s.maxY, s.minY + 2 * s.errorY * y), o[3 * p + 2] = Math.min(s.maxZ, s.minZ + 2 * s.errorZ * P), p++; + } + } + return { errorX: s.errorX, errorY: s.errorY, errorZ: s.errorZ, result: o }; +} +function Aoe(t, e, i) { + const r = []; + e = IRe(t, e, r); + const n = []; + for (let s = 0; s < r.length; s++) { + n.length = 0, e = IRe(t, e, n); + for (let o = 0; o < n.length; o++) + i.push(n[o] + r[s]); + } + return e; +} +function IRe(t, e, i) { + const r = new DataView(t, e), n = r.getUint8(0), s = 31 & n, o = !!(32 & n), a = (192 & n) >> 6; + let l = 0; + if (a === 0) + l = r.getUint32(1, Td), e += 5; + else if (a === 1) + l = r.getUint16(1, Td), e += 3; + else { + if (a !== 2) + throw new ot("lepcc-decode-error", "Bad count type"); + l = r.getUint8(1), e += 2; + } + if (o) + throw new ot("lepcc-decode-error", "LUT not implemented"); + const c = Math.ceil(l * s / 8), h = new Uint8Array(t, e, c); + let p = 0, y = 0, v = 0; + const x = -1 >>> 32 - s; + for (let I = 0; I < l; I++) { + for (; y < s; ) + p |= h[v] << y, y += 8, v += 1; + i[I] = p & x, p >>>= s, y -= s, y + s > 32 && (p |= h[v - 1] >> 8 - y); + } + return e + v; +} +const RN = { sizeLo: 0, sizeHi: 4, count: 8, colorMapCount: 12, lookupMethod: 14, compressionMethod: 15, byteCount: 16 }; +function OBi(t, e) { + return { sizeLo: t.getUint32(e + RN.sizeLo, Td), sizeHi: t.getUint32(e + RN.sizeHi, Td), count: t.getUint32(e + RN.count, Td), colorMapCount: t.getUint16(e + RN.colorMapCount, Td), lookupMethod: t.getUint8(e + RN.lookupMethod), compressionMethod: t.getUint8(e + RN.compressionMethod) }; +} +function RBi(t) { + const e = new DataView(t, 0); + let i = 0; + const { identifier: r, version: n } = k8e(t, e, i); + if (i += n6.byteCount, r !== "ClusterRGB") + throw new ot("lepcc-decode-error", "Bad identifier"); + if (n > 1) + throw new ot("lepcc-decode-error", "Unknown version"); + const s = OBi(e, i); + if (i += RN.byteCount, s.sizeHi * 2 ** 32 + s.sizeLo !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + if ((s.lookupMethod === 2 || s.lookupMethod === 1) && s.compressionMethod === 0) { + if (3 * s.colorMapCount + s.count + i !== t.byteLength || s.colorMapCount > 256) + throw new ot("lepcc-decode-error", "Bad count"); + const o = new Uint8Array(t, i, 3 * s.colorMapCount), a = new Uint8Array(t, i + 3 * s.colorMapCount, s.count), l = new Uint8Array(3 * s.count); + for (let c = 0; c < s.count; c++) { + const h = a[c]; + l[3 * c] = o[3 * h], l[3 * c + 1] = o[3 * h + 1], l[3 * c + 2] = o[3 * h + 2]; + } + return l; + } + if (s.lookupMethod === 0 && s.compressionMethod === 0) { + if (3 * s.count + i !== t.byteLength || s.colorMapCount !== 0) + throw new ot("lepcc-decode-error", "Bad count"); + return new Uint8Array(t, i).slice(); + } + if (s.lookupMethod <= 2 && s.compressionMethod === 1) { + if (i + 3 !== t.byteLength || s.colorMapCount !== 1) + throw new ot("lepcc-decode-error", "Bad count"); + const o = e.getUint8(i), a = e.getUint8(i + 1), l = e.getUint8(i + 2), c = new Uint8Array(3 * s.count); + for (let h = 0; h < s.count; h++) + c[3 * h] = o, c[3 * h + 1] = a, c[3 * h + 2] = l; + return c; + } + throw new ot("lepcc-decode-error", "Bad method " + s.lookupMethod + "," + s.compressionMethod); +} +const MN = { sizeLo: 0, sizeHi: 4, count: 8, scaleFactor: 12, bitsPerPoint: 14, reserved: 15, byteCount: 16 }; +function MBi(t, e) { + return { sizeLo: t.getUint32(e + MN.sizeLo, Td), sizeHi: t.getUint32(e + MN.sizeHi, Td), count: t.getUint32(e + MN.count, Td), scaleFactor: t.getUint16(e + MN.scaleFactor, Td), bitsPerPoint: t.getUint8(e + MN.bitsPerPoint), reserved: t.getUint8(e + MN.reserved) }; +} +function DBi(t) { + const e = new DataView(t, 0); + let i = 0; + const { identifier: r, version: n } = k8e(t, e, i); + if (i += n6.byteCount, r !== "Intensity ") + throw new ot("lepcc-decode-error", "Bad identifier"); + if (n > 1) + throw new ot("lepcc-decode-error", "Unknown version"); + const s = MBi(e, i); + if (i += MN.byteCount, s.sizeHi * 2 ** 32 + s.sizeLo !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + const o = new Uint16Array(s.count); + if (s.bitsPerPoint === 8) { + if (s.count + i !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + const a = new Uint8Array(t, i, s.count); + for (let l = 0; l < s.count; l++) + o[l] = a[l] * s.scaleFactor; + } else if (s.bitsPerPoint === 16) { + if (2 * s.count + i !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + const a = new Uint16Array(t, i, s.count); + for (let l = 0; l < s.count; l++) + o[l] = a[l] * s.scaleFactor; + } else { + const a = []; + if (IRe(t, i, a) !== t.byteLength) + throw new ot("lepcc-decode-error", "Bad size"); + for (let l = 0; l < s.count; l++) + o[l] = a[l] * s.scaleFactor; + } + return o; +} +const ARe = Ei.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader"); +function FBi(t, e, i) { + let r = "", n = 0; + for (; n < i; ) { + const s = t[e + n]; + if (s < 128) + r += String.fromCharCode(s), n++; + else if (s >= 192 && s < 224) { + if (n + 1 >= i) + throw new ot("utf8-decode-error", "UTF-8 Decode failed. Two byte character was truncated."); + const o = (31 & s) << 6 | 63 & t[e + n + 1]; + r += String.fromCharCode(o), n += 2; + } else if (s >= 224 && s < 240) { + if (n + 2 >= i) + throw new ot("utf8-decode-error", "UTF-8 Decode failed. Multi byte character was truncated."); + const o = (15 & s) << 12 | (63 & t[e + n + 1]) << 6 | 63 & t[e + n + 2]; + r += String.fromCharCode(o), n += 3; + } else { + if (!(s >= 240 && s < 248)) + throw new ot("utf8-decode-error", "UTF-8 Decode failed. Invalid multi byte sequence."); + { + if (n + 3 >= i) + throw new ot("utf8-decode-error", "UTF-8 Decode failed. Multi byte character was truncated."); + const o = (7 & s) << 18 | (63 & t[e + n + 1]) << 12 | (63 & t[e + n + 2]) << 6 | 63 & t[e + n + 3]; + if (o >= 65536) { + const a = 55296 + (o - 65536 >> 10), l = 56320 + (1023 & o); + r += String.fromCharCode(a, l); + } else + r += String.fromCharCode(o); + n += 4; + } + } + } + return r; +} +function mPt(t, e) { + const i = { byteOffset: 0, byteCount: 0, fields: /* @__PURE__ */ Object.create(null) }; + let r = 0; + for (let n = 0; n < e.length; n++) { + const s = e[n], o = s.valueType || s.type, a = BBi[o]; + i.fields[s.property] = a(t, r), r += pve[o].BYTES_PER_ELEMENT; + } + return i.byteCount = r, i; +} +function LBi(t, e, i) { + return gPt(t, e, i).map((r) => { + const n = r ? Date.parse(r) : null; + return n && !Number.isNaN(n) ? n : null; + }); +} +function gPt(t, e, i) { + const r = []; + let n, s, o = 0; + for (s = 0; s < t; s += 1) { + if (n = e[s], n > 0) { + if (r.push(FBi(i, o, n - 1)), i[o + n - 1] !== 0) + throw new ot("string-array-error", "Invalid string array: missing null termination."); + } else + r.push(null); + o += n; + } + return r; +} +function PRe(t, e) { + return new pve[e.valueType](t, e.byteOffset, e.count * e.valuesPerElement); +} +function NBi(t, e) { + return new Uint8Array(t, e.byteOffset, e.byteCount); +} +function kBi(t, e, i) { + const r = e.header != null ? mPt(t, e.header) : { byteOffset: 0, byteCount: 0, fields: { count: i } }, n = { header: r, byteOffset: r.byteCount, byteCount: 0, entries: /* @__PURE__ */ Object.create(null) }; + let s = r.byteCount; + for (let o = 0; o < e.ordering.length; o++) { + const a = e.ordering[o], l = fi(e[a]); + if (l.count = r.fields.count ?? 0, l.valueType === "String") { + if (l.byteOffset = s, l.byteCount = r.fields[a + "ByteCount"], l.encoding !== "UTF-8") + throw new ot("unsupported-encoding", "Unsupported String encoding.", { encoding: l.encoding }); + if (l.timeEncoding && l.timeEncoding !== "ECMA_ISO8601") + throw new ot("unsupported-time-encoding", "Unsupported time encoding.", { timeEncoding: l.timeEncoding }); + } else { + if (!_Pt(l.valueType)) + throw new ot("unsupported-value-type", "Unsupported binary valueType", { valueType: l.valueType }); + { + const c = oce(l.valueType); + s += s % c != 0 ? c - s % c : 0, l.byteOffset = s, l.byteCount = c * l.valuesPerElement * l.count; + } + } + s += l.byteCount ?? 0, n.entries[a] = l; + } + return n.byteCount = s - n.byteOffset, n; +} +function yPt(t, e, i) { + if (e !== t && ARe.error(`Invalid ${i} buffer size + expected: ${t}, actual: ${e})`), e < t) + throw new ot("buffer-too-small", "Binary buffer is too small", { expectedSize: t, actualSize: e }); +} +function $Bi(t, e) { + const i = mPt(t, e && e.header); + let r = i.byteCount; + const n = { isDraco: !1, header: i, byteOffset: i.byteCount, byteCount: 0, vertexAttributes: {} }, s = i.fields, o = s.vertexCount != null ? s.vertexCount : s.count; + for (const c of e.ordering) { + if (!e.vertexAttributes[c]) + continue; + const h = { ...e.vertexAttributes[c], byteOffset: r, count: o }, p = YZe[c] ? YZe[c] : "_" + c; + n.vertexAttributes[p] = h, r += oce(h.valueType) * h.valuesPerElement * o; + } + const a = s.faceCount; + if (e.faces && a) { + n.faces = {}; + for (const c of e.ordering) { + if (!e.faces[c]) + continue; + const h = { ...e.faces[c], byteOffset: r, count: a }; + n.faces[c] = h, r += oce(h.valueType) * h.valuesPerElement * a; + } + } + const l = s.featureCount; + if (e.featureAttributes && e.featureAttributeOrder && l) { + n.featureAttributes = {}; + for (const c of e.featureAttributeOrder) { + if (!e.featureAttributes[c]) + continue; + const h = { ...e.featureAttributes[c], byteOffset: r, count: l }; + n.featureAttributes[c] = h, r += (h.valueType === "UInt64" ? 8 : oce(h.valueType)) * h.valuesPerElement * l; + } + } + return yPt(r, t.byteLength, "geometry"), n.byteCount = r - n.byteOffset, n; +} +const YZe = { position: Br.POSITION, normal: Br.NORMAL, color: Br.COLOR, uv0: Br.UV0, region: Br.UVREGION }; +function vPt(t, e, i) { + if (t.encoding === "lepcc-rgb") + return RBi(e); + if (t.encoding === "lepcc-intensity") + return DBi(e); + if (t.encoding != null && t.encoding !== "") + throw new ot("unknown-attribute-storage-info-encoding", "Unknown Attribute Storage Info Encoding"); + t["attributeByteCounts "] && !t.attributeByteCounts && (ARe.warn("Warning: Trailing space in 'attributeByteCounts '."), t.attributeByteCounts = t["attributeByteCounts "]), t.ordering[0] === "ObjectIds" && t.hasOwnProperty("objectIds") && (ARe.warn("Warning: Case error in objectIds"), t.ordering[0] = "objectIds"); + const r = kBi(e, t, i); + yPt(r.byteOffset + r.byteCount, e.byteLength, "attribute"); + const n = r.entries.attributeValues || r.entries.objectIds; + if (n) { + if (n.valueType === "String") { + const s = r.entries.attributeByteCounts, o = PRe(e, s), a = NBi(e, n); + return n.timeEncoding ? LBi(s.count, o, a) : gPt(s.count, o, a); + } + return PRe(e, n); + } + throw new ot("bad-attribute-storage-info", "Bad attributeStorageInfo specification."); +} +const pve = { Float32: Float32Array, Float64: Float64Array, UInt8: Uint8Array, Int8: Int8Array, UInt16: Uint16Array, Int16: Int16Array, UInt32: Uint32Array, Int32: Int32Array }, BBi = { Float32: (t, e) => new DataView(t, 0).getFloat32(e, !0), Float64: (t, e) => new DataView(t, 0).getFloat64(e, !0), UInt8: (t, e) => new DataView(t, 0).getUint8(e), Int8: (t, e) => new DataView(t, 0).getInt8(e), UInt16: (t, e) => new DataView(t, 0).getUint16(e, !0), Int16: (t, e) => new DataView(t, 0).getInt16(e, !0), UInt32: (t, e) => new DataView(t, 0).getUint32(e, !0), Int32: (t, e) => new DataView(t, 0).getInt32(e, !0) }; +function _Pt(t) { + return pve.hasOwnProperty(t); +} +function oce(t) { + return _Pt(t) ? pve[t].BYTES_PER_ELEMENT : 0; +} +function VBi(t, e, i, r) { + const { rendererJSON: n, isRGBRenderer: s } = t; + let o = null, a = null; + if (e && s) + o = e; + else if (e && n?.type === "pointCloudUniqueValueRenderer") { + a = fPt.fromJSON(n); + const l = a.colorUniqueValueInfos; + o = new Uint8Array(3 * r); + const c = yxe(a.fieldTransformType); + for (let h = 0; h < r; h++) { + const p = (c ? c(e[h]) : e[h]) + ""; + for (let y = 0; y < l.length; y++) + if (l[y].values.includes(p)) { + o[3 * h] = l[y].color.r, o[3 * h + 1] = l[y].color.g, o[3 * h + 2] = l[y].color.b; + break; + } + } + } else if (e && n?.type === "pointCloudStretchRenderer") { + a = pPt.fromJSON(n); + const l = a.stops; + o = new Uint8Array(3 * r); + const c = yxe(a.fieldTransformType); + for (let h = 0; h < r; h++) { + const p = c ? c(e[h]) : e[h], y = l.length - 1; + if (p < l[0].value) + o[3 * h] = l[0].color.r, o[3 * h + 1] = l[0].color.g, o[3 * h + 2] = l[0].color.b; + else if (p >= l[y].value) + o[3 * h] = l[y].color.r, o[3 * h + 1] = l[y].color.g, o[3 * h + 2] = l[y].color.b; + else + for (let v = 1; v < l.length; v++) + if (p < l[v].value) { + const x = (p - l[v - 1].value) / (l[v].value - l[v - 1].value); + o[3 * h] = l[v].color.r * x + l[v - 1].color.r * (1 - x), o[3 * h + 1] = l[v].color.g * x + l[v - 1].color.g * (1 - x), o[3 * h + 2] = l[v].color.b * x + l[v - 1].color.b * (1 - x); + break; + } + } + } else if (e && n?.type === "pointCloudClassBreaksRenderer") { + a = dPt.fromJSON(n); + const l = a.colorClassBreakInfos; + o = new Uint8Array(3 * r); + const c = yxe(a.fieldTransformType); + for (let h = 0; h < r; h++) { + const p = c ? c(e[h]) : e[h]; + for (let y = 0; y < l.length; y++) + if (p >= l[y].minValue && p <= l[y].maxValue) { + o[3 * h] = l[y].color.r, o[3 * h + 1] = l[y].color.g, o[3 * h + 2] = l[y].color.b; + break; + } + } + } else { + o = new Uint8Array(3 * r); + for (let l = 0; l < o.length; l++) + o[l] = 255; + } + if (i && a && a.colorModulation) { + const l = a.colorModulation.minValue, c = a.colorModulation.maxValue, h = 0.3; + for (let p = 0; p < r; p++) { + const y = i[p], v = y >= c ? 1 : y <= l ? h : h + (1 - h) * (y - l) / (c - l); + o[3 * p] = v * o[3 * p], o[3 * p + 1] = v * o[3 * p + 1], o[3 * p + 2] = v * o[3 * p + 2]; + } + } + return o; +} +function jBi(t, e) { + if (t.encoding == null || t.encoding === "") { + const i = $Bi(e, t); + if (ut(i.vertexAttributes.position)) + return; + const r = PRe(e, i.vertexAttributes.position), n = i.header.fields, s = [n.offsetX, n.offsetY, n.offsetZ], o = [n.scaleX, n.scaleY, n.scaleZ], a = r.length / 3, l = new Float64Array(3 * a); + for (let c = 0; c < a; c++) + l[3 * c] = r[3 * c] * o[0] + s[0], l[3 * c + 1] = r[3 * c + 1] * o[1] + s[1], l[3 * c + 2] = r[3 * c + 2] * o[2] + s[2]; + return l; + } + if (t.encoding === "lepcc-xyz") + return PBi(e).result; +} +function Poe(t, e, i) { + return _e(t) && t.attributeInfo.useElevation ? e ? GBi(e, i) : null : _e(t) && t.attributeInfo.storageInfo ? vPt(t.attributeInfo.storageInfo, t.buffer, i) : null; +} +function GBi(t, e) { + const i = new Float64Array(e); + for (let r = 0; r < e; r++) + i[r] = t[3 * r + 2]; + return i; +} +function UBi(t, e, i, r, n) { + const s = t.length / 3; + let o = 0; + for (let a = 0; a < s; a++) { + let l = !0; + for (let c = 0; c < r.length && l; c++) { + const { filterJSON: h } = r[c], p = n[c].values[a]; + switch (h.type) { + case "pointCloudValueFilter": { + const y = h.mode === "exclude"; + h.values.includes(p) === y && (l = !1); + break; + } + case "pointCloudBitfieldFilter": { + const y = XZe(h.requiredSetBits), v = XZe(h.requiredClearBits); + (p & y) === y && !(p & v) || (l = !1); + break; + } + case "pointCloudReturnFilter": { + const y = 15 & p, v = p >>> 4 & 15, x = v > 1, I = y === 1, P = y === v; + let F = !1; + for (const k of h.includedReturns) + if (k === "last" && P || k === "firstOfMany" && I && x || k === "lastOfMany" && P && x || k === "single" && !x) { + F = !0; + break; + } + F || (l = !1); + break; + } + } + } + l && (i[o] = a, t[3 * o] = t[3 * a], t[3 * o + 1] = t[3 * a + 1], t[3 * o + 2] = t[3 * a + 2], e[3 * o] = e[3 * a], e[3 * o + 1] = e[3 * a + 1], e[3 * o + 2] = e[3 * a + 2], o++); + } + return o; +} +function yxe(t) { + return t == null || t === "none" ? null : t === "low-four-bit" ? (e) => 15 & e : t === "high-four-bit" ? (e) => (240 & e) >> 4 : t === "absolute-value" ? (e) => Math.abs(e) : t === "modulo-ten" ? (e) => e % 10 : null; +} +function XZe(t) { + let e = 0; + for (const i of t || []) + e |= 1 << i; + return e; +} +let zBi = class { + transform(e) { + const i = this._transform(e), r = [i.points.buffer, i.rgb.buffer]; + _e(i.pointIdFilterMap) && r.push(i.pointIdFilterMap.buffer); + for (const n of i.attributes) + "buffer" in n.values && dk(n.values.buffer) && n.values.buffer !== i.rgb.buffer && r.push(n.values.buffer); + return Promise.resolve({ result: i, transferList: r }); + } + _transform(e) { + const i = jBi(e.schema, e.geometryBuffer); + let r = i.length / 3, n = null; + const s = [], o = Poe(e.primaryAttributeData, i, r); + _e(e.primaryAttributeData) && o && s.push({ attributeInfo: e.primaryAttributeData.attributeInfo, values: o }); + const a = Poe(e.modulationAttributeData, i, r); + _e(e.modulationAttributeData) && a && s.push({ attributeInfo: e.modulationAttributeData.attributeInfo, values: a }); + let l = VBi(e.rendererInfo, o, a, r); + if (e.filterInfo && e.filterInfo.length > 0 && _e(e.filterAttributesData)) { + const h = e.filterAttributesData.filter(_e).map((p) => { + const y = Poe(p, i, r), v = { attributeInfo: p.attributeInfo, values: y }; + return s.push(v), v; + }); + n = new Uint32Array(r), r = UBi(i, l, n, e.filterInfo, h); + } + for (const h of e.userAttributesData) { + const p = Poe(h, i, r); + s.push({ attributeInfo: h.attributeInfo, values: p }); + } + 3 * r < l.length && (l = new Uint8Array(l.buffer.slice(0, 3 * r))), this._applyElevationOffsetInPlace(i, r, e.elevationOffset); + const c = this._transformCoordinates(i, r, e.obb, or.fromJSON(e.inSR), or.fromJSON(e.outSR)); + return { obb: e.obb, points: c, rgb: l, attributes: s, pointIdFilterMap: n }; + } + _transformCoordinates(e, i, r, n, s) { + if (!g3(e, n, 0, e, s, 0, i)) + throw new Error("Can't reproject"); + const o = I3(r.center[0], r.center[1], r.center[2]), a = uee(), l = uee(); + f8e(KZe, r.quaternion); + const c = new Float32Array(3 * i); + for (let h = 0; h < i; h++) + a[0] = e[3 * h] - o[0], a[1] = e[3 * h + 1] - o[1], a[2] = e[3 * h + 2] - o[2], G7(l, a, KZe), r.halfSize[0] = Math.max(r.halfSize[0], Math.abs(l[0])), r.halfSize[1] = Math.max(r.halfSize[1], Math.abs(l[1])), r.halfSize[2] = Math.max(r.halfSize[2], Math.abs(l[2])), c[3 * h] = a[0], c[3 * h + 1] = a[1], c[3 * h + 2] = a[2]; + return c; + } + _applyElevationOffsetInPlace(e, i, r) { + if (r !== 0) + for (let n = 0; n < i; n++) + e[3 * n + 2] += r; + } +}; +const KZe = L8e(); +function HBi() { + return new zBi(); +} +const WBi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: HBi +}, Symbol.toStringTag, { value: "Module" })); +let ace = class extends $i { + constructor() { + super(...arguments), this.raster = void 0; + } +}; +E([N({ json: { write: !0 } })], ace.prototype, "raster", void 0), ace = E([dt("esri.layers.support.rasterFunctions.AspectFunctionArguments")], ace); +const zb = ace; +var ORe; +let RRe = ORe = class extends zb { + clone() { + return new ORe({ raster: this.raster }); + } +}; +RRe = ORe = E([dt("esri.layers.support.rasterFunctions.AspectFunctionArguments")], RRe); +const qBi = RRe; +let qf = class extends $i { + constructor() { + super(...arguments), this.functionArguments = null, this.readingBufferSize = 0, this.id = -1, this.isNoopProcess = !1, this.rawInputBandIds = [], this.isInputBandIdsSwizzled = !1, this.swizzledBandSelection = [], this.isBranch = !1, this._bindingResult = null; + } + get supportsGPU() { + return this._bindingResult.supportsGPU; + } + bind(e, i = !1, r = -1) { + this.id = r + 1; + const n = this._getRasterValues(); + let s = !0; + for (let o = 0; o < n.length; o++) { + const a = n[o]; + if (_e(a) && this._isRasterFunctionValue(a)) { + const l = a.bind(e, i, this.id + o); + if (!l.success) + return this._bindingResult = l, l; + s = s && l.supportsGPU; + } + } + return !this.rasterInfo || i ? (this.sourceRasterInfos = this._getSourceRasterInfos(e), this._bindingResult = this._bindSourceRasters(), this._bindingResult.supportsGPU = s && this._bindingResult.supportsGPU, this.processInputBandIds(), this._bindingResult) : (this._bindingResult = { success: !0, supportsGPU: !0 }, this.processInputBandIds(), this._bindingResult); + } + process(e) { + const i = this._getRasterValues(), r = i.length === 0 ? e.pixelBlocks ?? e.primaryPixelBlocks : i.map((n) => this._readRasterValue(n, e)); + return this._processPixels({ ...e, pixelBlocks: r }); + } + processInputBandIds() { + const e = this._getRasterValues().filter(this._isRasterFunctionValue); + let i; + if (e.length > 1) { + const s = e.map((a) => a.processInputBandIds()[0]); + this.rawInputBandIds = s, this.isInputBandIdsSwizzled = this.rawInputBandIds.some((a, l) => a !== l); + const o = e.filter((a) => a.functionName === "ExtractBand"); + return o.length && o.forEach((a, l) => { + a.isInputBandIdsSwizzled = !0, a.swizzledBandSelection = [l, l, l]; + }), this.rawInputBandIds; + } + const r = e[0]; + if (r) { + if (i = r.processInputBandIds(), r.isInputBandIdsSwizzled) + return this.rawInputBandIds = i, i; + } else { + i = []; + const { bandCount: s } = this.sourceRasterInfos[0]; + for (let o = 0; o < s; o++) + i.push(o); + } + const n = this._getInputBandIds(i); + return this.isInputBandIdsSwizzled = n.some((s, o) => s !== o), this.rawInputBandIds = n, this.rawInputBandIds; + } + getPrimaryRasters() { + const e = [], i = []; + return this._getPrimaryRasters(this, e, i), { rasters: e, rasterIds: i }; + } + getWebGLProcessorDefinition() { + const e = this._getWebGLParameters(), { raster: i, rasters: r } = this.functionArguments; + return r && Array.isArray(r) && r.length ? (e.rasters = r.map((n) => this._isRasterFunctionValue(n) ? n.getWebGLProcessorDefinition() : typeof n == "number" ? { name: "Constant", parameters: { value: n }, pixelType: "f32", id: -1, isNoopProcess: !1 } : { name: "Identity", parameters: { value: n }, pixelType: "f32", id: -1, isNoopProcess: !1 }), e.rasters.some((n) => n != null) || (e.rasters = null)) : this._isRasterFunctionValue(i) && (e.raster = i.getWebGLProcessorDefinition()), { name: this.functionName, parameters: e, pixelType: this.outputPixelType, id: this.id, isNoopProcess: this.isNoopProcess }; + } + getFlatWebGLFunctionChain() { + const e = this.getWebGLProcessorDefinition(); + if (!e) + return null; + const i = [e], { parameters: r } = e; + let n = r.rasters || r.raster && [r.raster]; + for (; n?.length; ) { + i.unshift(...n); + const o = []; + for (let a = 0; a < n.length; a++) { + const { parameters: l } = n[a], c = l.rasters || l.raster && [l.raster]; + c?.length && o.push(...c); + } + n = o; + } + for (let o = i.length - 1; o >= 0; o--) + i[o].isNoopProcess && i.splice(o, 1); + let s = !1; + for (let o = 0; o < i.length; o++) { + const a = i[o]; + a.id = i.length - o - 1; + const { rasters: l } = a.parameters; + s = s || l != null && l.length > 1; + } + return { hasBranches: s, functions: i }; + } + _getOutputPixelType(e) { + return this.outputPixelType === "unknown" ? e : this.outputPixelType ?? e; + } + _getWebGLParameters() { + return {}; + } + _getInputBandIds(e) { + return e; + } + _isOutputRoundingNeeded() { + const { outputPixelType: e } = this; + return (e?.startsWith("u") || e?.startsWith("s")) ?? !1; + } + _getRasterValues() { + const { rasterArgumentNames: e } = this; + return e[0] === "rasters" ? this.functionArguments.rasters ?? [] : e.map((i) => this.functionArguments[i]); + } + _getSourceRasterInfos(e) { + const i = this._getRasterValues(), { rasterInfos: r, rasterIds: n } = e; + if (i.length === 0) + return r; + const s = i.map((a) => a && typeof a == "object" && "bind" in a && a.rasterInfo ? a.rasterInfo : typeof a == "string" && n.includes(a) ? r[n.indexOf(a)] : typeof a != "number" ? r[0] : void 0), o = s.find((a) => a) ?? r[0]; + return s.forEach((a, l) => { + a === void 0 && (s[l] = o); + }), s; + } + _getPrimaryRasterId(e) { + return e?.url; + } + _getPrimaryRasters(e, i = [], r = []) { + for (let n = 0; n < e.sourceRasters.length; n++) { + const s = e.sourceRasters[n]; + if (typeof s != "number") + if ("bind" in s) + this._getPrimaryRasters(s, i, r); + else { + const o = s, a = this._getPrimaryRasterId(o); + if (a == null) + continue; + r.includes(a) || (this.mainPrimaryRasterId === a ? (i.unshift(o), r.unshift(a)) : (i.push(o), r.push(a))); + } + } + } + _isRasterFunctionValue(e) { + return e != null && typeof e == "object" && "getWebGLProcessorDefinition" in e; + } + _readRasterValue(e, i) { + const { primaryPixelBlocks: r } = i; + if (ut(e) || e === "$$") { + const n = r[0]; + return ut(n) ? null : n.clone(); + } + if (typeof e == "string") { + const n = i.primaryRasterIds.indexOf(e); + return n === -1 ? null : r[n]; + } + if (typeof e == "number") { + const n = r[0]; + if (ut(n)) + return null; + const { width: s, height: o, pixelType: a, mask: l } = n, c = l ? new Uint8Array(l) : null, h = new Float32Array(s * o); + h.fill(e); + const p = this.sourceRasterInfos[0].bandCount, y = new Array(p).fill(h); + return new nn({ width: s, height: o, pixelType: a, pixels: y, mask: c }); + } + return e.process(i); + } +}; +E([N({ json: { write: !0 } })], qf.prototype, "functionName", void 0), E([N({ json: { write: !0 } })], qf.prototype, "functionArguments", void 0), E([N()], qf.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } }), uo((t) => t?.toLowerCase())], qf.prototype, "outputPixelType", void 0), E([N({ json: { write: !0 } })], qf.prototype, "mainPrimaryRasterId", void 0), E([N()], qf.prototype, "sourceRasters", void 0), E([N({ type: [cC], json: { write: !0 } })], qf.prototype, "sourceRasterInfos", void 0), E([N({ json: { write: !0 } })], qf.prototype, "rasterInfo", void 0), E([N({ json: { write: !0 } })], qf.prototype, "readingBufferSize", void 0), E([N({ json: { write: !0 } })], qf.prototype, "id", void 0), E([N()], qf.prototype, "isNoopProcess", void 0), E([N()], qf.prototype, "supportsGPU", null), E([N()], qf.prototype, "rawInputBandIds", void 0), E([N()], qf.prototype, "isInputBandIdsSwizzled", void 0), E([N()], qf.prototype, "swizzledBandSelection", void 0), E([N()], qf.prototype, "isBranch", void 0), E([N()], qf.prototype, "_bindingResult", void 0), qf = E([dt("esri.layers.support.rasterFunctions.BaseRasterFunction")], qf); +const Hb = qf; +let DN = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Aspect", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.isGCS = !1; + } + _bindSourceRasters() { + const e = this.sourceRasterInfos[0]; + this.isGCS = e.spatialReference?.isGeographic ?? !1, this.outputPixelType = this._getOutputPixelType("f32"); + const i = e.clone(); + return i.pixelType = this.outputPixelType, i.statistics = [{ min: 0, max: 360, avg: 180, stddev: 30 }], i.histograms = null, i.colormap = null, i.attributeTable = null, i.bandCount = 1, this.rasterInfo = i, { success: !0, supportsGPU: !0 }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const { extent: r } = e, n = r ? { x: r.width / i.width, y: r.height / i.height } : { x: 1, y: 1 }; + return cei(i, { resolution: n }); + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], DN.prototype, "functionName", void 0), E([N({ type: qBi, json: { write: !0, name: "rasterFunctionArguments" } })], DN.prototype, "functionArguments", void 0), E([N()], DN.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], DN.prototype, "isGCS", void 0), DN = E([dt("esri.layers.support.rasterFunctions.AspectFunction")], DN); +const YBi = DN, XBi = /* @__PURE__ */ new Set(["+", "-", "*", "/", "(", ")"]); +function KBi(t, e) { + (t = t.replace(/ /g, "")).startsWith("-") && (t = "0" + t), t.startsWith("+") && (t = t.slice(1, t.length)); + const i = t.split(""), r = [], n = []; + let s = ""; + for (let o = 0; o < i.length; o++) { + const a = i[o]; + if (XBi.has(a)) + s !== "" && n.push(parseFloat(s)), r.push(a), s = ""; + else { + if (a.toLowerCase() === "b") { + o++, s = a.concat(i[o]), n.push(e[parseInt(s[1], 10) - 1]), s = ""; + continue; + } + s = s.concat(a), o === i.length - 1 && n.push(parseFloat(s)); + } + } + return { ops: r, nums: n }; +} +function JBi(t, e, i, r) { + if (typeof i == "number" && typeof r == "number") + return i + r; + let n; + if (typeof i == "number") { + n = r.length; + const o = i; + (i = new Float32Array(n)).fill(o); + } else if (n = i.length, r.constructor === Number) { + const o = r; + (r = new Float32Array(n)).fill(o); + } + const s = new Float32Array(n); + switch (e) { + case "+": + for (let o = 0; o < n; o++) + (t == null || t[o]) && (s[o] = i[o] + r[o]); + break; + case "-": + for (let o = 0; o < n; o++) + (t == null || t[o]) && (s[o] = i[o] - r[o]); + break; + case "*": + for (let o = 0; o < n; o++) + (t == null || t[o]) && (s[o] = i[o] * r[o]); + break; + case "/": + for (let o = 0; o < n; o++) + (t == null || t[o]) && r[o] && (s[o] = i[o] / r[o]); + break; + case "(": + case ")": + throw new Error("encountered error with custom band index equation"); + } + return s; +} +function ZBi(t, e) { + t.splice(e, 1); + let i = 0, r = 0; + do { + i = 0, r = 0; + for (let n = 0; n < t.length; n++) + if (t[n] === "(") + i = n; + else if (t[n] === ")") { + r = n; + break; + } + r === i + 1 && t.splice(i, 2); + } while (r === i + 1); + return t; +} +function QBi(t) { + if (t.length === 1) + return { opIndex: 0, numIndex: 0 }; + let e = 0, i = 0; + for (let o = 0; o < t.length; o++) + if (t[o] === "(") + e = o; + else if (t[o] === ")") { + i = o; + break; + } + const r = i === 0 ? t : t.slice(e + 1, i); + let n = -1; + for (let o = 0; o < r.length; o++) + if (r[o] === "*" || r[o] === "/") { + n = o; + break; + } + if (n > -1) + i > 0 && (n += e + 1); + else { + for (let o = 0; o < r.length; o++) + if (r[o] === "+" || r[o] === "-") { + n = o; + break; + } + i > 0 && (n += e + 1); + } + let s = 0; + for (let o = 0; o < n; o++) + t[o] === "(" && s++; + return { opIndex: n, numIndex: n - s }; +} +function eVi(t, e, i) { + let r, { ops: n, nums: s } = KBi(i, e); + if (n.length === 0) { + const o = s.length === 1 ? s[0] : e[0]; + if (o instanceof Float32Array) + return [o]; + const a = new Float32Array(e[0].length); + return typeof o == "number" ? a.fill(o) : a.set(o), [a]; + } + for (; n.length > 0; ) { + const { numIndex: o, opIndex: a } = QBi(n); + if (r = JBi(t, n[a], s[o], s[o + 1]), n.length === 1) + break; + n = ZBi(n, a), s.splice(o, 2, r); + } + return [r]; +} +const tVi = new zs({ 0: "custom", 1: "ndvi", 2: "savi", 3: "tsavi", 4: "msavi", 5: "gemi", 6: "pvi", 7: "gvitm", 8: "sultan", 9: "vari", 10: "gndvi", 11: "sr", 12: "ndvi-re", 13: "sr-re", 14: "mtvi2", 15: "rtvi-core", 16: "ci-re", 17: "ci-g", 18: "ndwi", 19: "evi", 20: "iron-oxide", 21: "ferrous-minerals", 22: "clay-minerals", 23: "wndwi", 24: "bai", 25: "nbr", 26: "ndbi", 27: "ndmi", 28: "ndsi", 29: "mndwi" }, { useNumericKeys: !0 }); +function iVi(t, e) { + if (!Nh(t)) + return t; + const { equation: i, method: r } = e, n = e.bandIndexes.map((h) => h - 1), { pixels: s, mask: o } = t; + let a; + switch (r) { + case "gndvi": + case "nbr": + case "ndbi": + case "ndvi": + case "ndvi-re": + case "ndsi": + case "ndmi": + case "mndwi": + a = JZe(o, s[n[0]], s[n[1]]); + break; + case "ndwi": + a = JZe(o, s[n[1]], s[n[0]]); + break; + case "sr": + case "sr-re": + case "iron-oxide": + case "ferrous-minerals": + case "clay-minerals": + a = nVi(o, s[n[0]], s[n[1]]); + break; + case "ci-g": + case "ci-re": + a = sVi(o, s[n[0]], s[n[1]]); + break; + case "savi": + a = oVi(o, s[n[0]], s[n[1]], n[2] + 1); + break; + case "tsavi": + a = aVi(o, s[n[0]], s[n[1]], n[2] + 1, n[3] + 1, n[4] + 1); + break; + case "msavi": + a = lVi(o, s[n[0]], s[n[1]]); + break; + case "gemi": + a = uVi(o, s[n[0]], s[n[1]]); + break; + case "pvi": + a = cVi(o, s[n[0]], s[n[1]], n[2] + 1, n[3] + 1); + break; + case "gvitm": + a = hVi(o, [s[n[0]], s[n[1]], s[n[2]], s[n[3]], s[n[4]], s[n[5]]]); + break; + case "sultan": + a = dVi(o, [s[n[0]], s[n[1]], s[n[2]], s[n[3]], s[n[4]], s[n[5]]]); + break; + case "vari": + a = pVi(o, [s[n[0]], s[n[1]], s[n[2]]]); + break; + case "mtvi2": + a = fVi(o, [s[n[0]], s[n[1]], s[n[2]]]); + break; + case "rtvi-core": + a = mVi(o, [s[n[0]], s[n[1]], s[n[2]]]); + break; + case "evi": + a = gVi(o, [s[n[0]], s[n[1]], s[n[2]]]); + break; + case "wndwi": + a = yVi(o, [s[n[0]], s[n[1]], s[n[2]]], n[3] ? n[3] + 1 : 0.5); + break; + case "bai": + a = vVi(o, s[n[0]], s[n[1]]); + break; + case "custom": + a = eVi(o, s, i); + break; + default: + return t; + } + const l = _e(o) ? new Uint8Array(o.length) : null; + _e(o) && _e(l) && l.set(o); + const c = new nn({ width: t.width, height: t.height, pixelType: "f32", pixels: a, mask: l }); + return c.updateStatistics(), c; +} +function rVi(t, e, i, r) { + const { mask: n, pixels: s, width: o, height: a } = t, l = s[i], c = s[e], h = c.length, p = r ? new Uint8Array(h) : new Float32Array(h), y = r ? 100 : 1, v = r ? 100.5 : 0; + for (let I = 0; I < h; I++) + if (n == null || n[I]) { + const P = l[I], F = c[I], k = P + F; + k && (p[I] = (P - F) / k * y + v); + } + const x = new nn({ width: o, height: a, mask: n, pixelType: r ? "u8" : "f32", pixels: [p] }); + return x.updateStatistics(), x; +} +function Tg(t) { + const e = new Float32Array(9); + return e[3 * t[0]] = 1, e[3 * t[1] + 1] = 1, e[3 * t[2] + 2] = 1, e; +} +function JZe(t, e, i) { + const r = i.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) { + const o = e[s], a = i[s], l = o + a; + l && (n[s] = (o - a) / l); + } + return [n]; +} +function nVi(t, e, i) { + const r = i.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) { + const o = e[s], a = i[s]; + a && (n[s] = o / a); + } + return [n]; +} +function sVi(t, e, i) { + const r = e.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) { + const o = e[s], a = i[s]; + a && (n[s] = o / a - 1); + } + return [n]; +} +function oVi(t, e, i, r) { + const n = i.length, s = new Float32Array(n); + for (let o = 0; o < n; o++) + if (t == null || t[o]) { + const a = i[o], l = e[o], c = l + a + r; + c && (s[o] = (l - a) / c * (1 + r)); + } + return [s]; +} +function aVi(t, e, i, r, n, s) { + const o = i.length, a = new Float32Array(o), l = -n * r + s * (1 + r * r); + for (let c = 0; c < o; c++) + if (t == null || t[c]) { + const h = i[c], p = e[c], y = n * p + h + l; + y && (a[c] = r * (p - r * h - n) / y); + } + return [a]; +} +function lVi(t, e, i) { + const r = i.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) { + const o = i[s], a = e[s]; + n[s] = 0.5 * (2 * (a + 1) - Math.sqrt((2 * a + 1) ** 2 - 8 * (a - o))); + } + return [n]; +} +function uVi(t, e, i) { + const r = i.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) { + const o = i[s], a = e[s]; + if (o !== 1) { + const l = (2 * (a * a - o * o) + 1.5 * a + 0.5 * o) / (a + o + 0.5); + n[s] = l * (1 - 0.25 * l) - (o - 0.125) / (1 - o); + } + } + return [n]; +} +function cVi(t, e, i, r, n) { + const s = i.length, o = new Float32Array(s), a = Math.sqrt(1 + r * r); + for (let l = 0; l < s; l++) + if (t == null || t[l]) { + const c = i[l], h = e[l]; + o[l] = (h - r * c - n) / a; + } + return [o]; +} +function hVi(t, e) { + const [i, r, n, s, o, a] = e, l = i.length, c = new Float32Array(l); + for (let h = 0; h < l; h++) + (t == null || t[h]) && (c[h] = -0.2848 * i[h] - 0.2435 * r[h] - 0.5436 * n[h] + 0.7243 * s[h] + 0.084 * o[h] - 1.18 * a[h]); + return [c]; +} +function dVi(t, e) { + const [i, , r, n, s, o] = e, a = i.length, l = new Float32Array(a), c = new Float32Array(a), h = new Float32Array(a); + for (let p = 0; p < a; p++) + (t == null || t[p]) && (l[p] = o[p] ? s[p] / o[p] * 100 : 0, c[p] = i[p] ? s[p] / i[p] * 100 : 0, h[p] = n[p] ? r[p] / n[p] * (s[p] / n[p]) * 100 : 0); + return [l, c, h]; +} +function pVi(t, e) { + const [i, r, n] = e, s = i.length, o = new Float32Array(s); + for (let a = 0; a < s; a++) + if (t == null || t[a]) + for (a = 0; a < s; a++) { + const l = i[a], c = r[a], h = c + l - n[a]; + h && (o[a] = (c - l) / h); + } + return [o]; +} +function fVi(t, e) { + const [i, r, n] = e, s = i.length, o = new Float32Array(s); + for (let a = 0; a < s; a++) + if (t == null || t[a]) + for (a = 0; a < s; a++) { + const l = i[a], c = r[a], h = n[a], p = Math.sqrt((2 * l + 1) ** 2 - 6 * l - 5 * Math.sqrt(c) - 0.5); + o[a] = 1.5 * (1.2 * (l - h) - 2.5 * (c - h)) * p; + } + return [o]; +} +function mVi(t, e) { + const [i, r, n] = e, s = i.length, o = new Float32Array(s); + for (let a = 0; a < s; a++) + if (t == null || t[a]) + for (a = 0; a < s; a++) { + const l = i[a], c = r[a], h = n[a]; + o[a] = 100 * (l - c) - 10 * (l - h); + } + return [o]; +} +function gVi(t, e) { + const [i, r, n] = e, s = i.length, o = new Float32Array(s); + for (let a = 0; a < s; a++) + if (t == null || t[a]) + for (a = 0; a < s; a++) { + const l = i[a], c = r[a], h = l + 6 * c - 7.5 * n[a] + 1; + h && (o[a] = 2.5 * (l - c) / h); + } + return [o]; +} +function yVi(t, e, i = 0.5) { + const [r, n, s] = e, o = n.length, a = new Float32Array(o); + for (let l = 0; l < o; l++) + if (t == null || t[l]) + for (l = 0; l < o; l++) { + const c = r[l], h = n[l], p = s[l], y = c + i * h + (1 - i) * p; + y && (a[l] = (c - i * h - (1 - i) * p) / y); + } + return [a]; +} +function vVi(t, e, i) { + const r = i.length, n = new Float32Array(r); + for (let s = 0; s < r; s++) + if (t == null || t[s]) + for (s = 0; s < r; s++) { + const o = (0.1 - e[s]) ** 2 + (0.06 - i[s]) ** 2; + o && (n[s] = 1 / o); + } + return [n]; +} +var MRe; +let yX = MRe = class extends zb { + constructor() { + super(...arguments), this.method = "custom"; + } + clone() { + return new MRe({ method: this.method, bandIndexes: this.bandIndexes, raster: fi(this.raster) }); + } +}; +E([N({ json: { type: String, write: !0 } })], yX.prototype, "bandIndexes", void 0), E([Yr(tVi)], yX.prototype, "method", void 0), yX = MRe = E([dt("esri.layers.support.rasterFunctions.BandArithmeticFunctionArguments")], yX); +const _Vi = yX, bVi = /* @__PURE__ */ new Set(["vari", "mtvi2", "rtvi-core", "evi"]); +let UV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "BandArithmetic", this.functionArguments = null, this.rasterArgumentNames = ["raster"]; + } + _bindSourceRasters() { + this.outputPixelType = this._getOutputPixelType("f32"); + const e = this.sourceRasterInfos[0], i = e.clone(); + return i.pixelType = this.outputPixelType, i.statistics = null, i.histograms = null, i.bandCount = this.functionArguments.method === "sultan" ? e.bandCount : 1, this.rasterInfo = i, { success: !0, supportsGPU: !["custom", "gvitm", "sultan"].includes(this.functionArguments.method) }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return i; + const { method: r, bandIndexes: n } = this.functionArguments, s = n.split(" ").map((o) => parseFloat(o)); + return iVi(i, { method: r, bandIndexes: s, equation: n }); + } + _getWebGLParameters() { + const e = this.functionArguments.bandIndexes.split(" ").map((a) => parseFloat(a) - 1); + e.length === 2 && e.push(0); + const i = this.isInputBandIdsSwizzled ? [0, 1, 2] : e; + let r, n; + const s = new Float32Array(3), { method: o } = this.functionArguments; + switch (o) { + case "gndvi": + case "nbr": + case "ndbi": + case "ndvi": + case "ndvi-re": + case "ndsi": + case "ndmi": + case "mndwi": + r = Tg([i[0], i[1], 0]), n = "ndxi"; + break; + case "ndwi": + r = Tg([i[1], i[0], 0]), n = "ndxi"; + break; + case "sr": + case "sr-re": + case "iron-oxide": + case "ferrous-minerals": + case "clay-minerals": + r = Tg([i[0], i[1], 0]), n = "sr"; + break; + case "ci-g": + case "ci-re": + r = Tg([i[0], i[1], 0]), n = "ci"; + break; + case "savi": + r = Tg([i[0], i[1], 0]), n = "savi", s[0] = e[2] + 1; + break; + case "tsavi": + r = Tg([i[0], i[1], 0]), n = "tsavi", s[0] = e[2] + 1, s[1] = e[3] + 1, s[2] = e[4] + 1; + break; + case "msavi": + r = Tg([i[0], i[1], 0]), n = "msavi"; + break; + case "gemi": + r = Tg([i[0], i[1], 0]), n = "gemi"; + break; + case "pvi": + r = Tg([i[0], i[1], 0]), n = "tsavi", s[0] = e[2] + 1, s[1] = e[3] + 1; + break; + case "vari": + r = Tg([i[0], i[1], i[2]]), n = "vari"; + break; + case "mtvi2": + r = Tg([i[0], i[1], i[2]]), n = "mtvi2"; + break; + case "rtvi-core": + r = Tg([i[0], i[1], i[2]]), n = "rtvicore"; + break; + case "evi": + r = Tg([i[0], i[1], i[2]]), n = "evi"; + break; + case "wndwi": + r = Tg([i[0], i[1], 0]), n = "wndwi", s[0] = e[3] ? e[3] + 1 : 0.5; + break; + case "bai": + r = Tg([i[1], i[0], 0]), n = "bai"; + break; + default: + r = Tg([0, 1, 2]), n = "custom"; + } + return { bandIndexMat3: r, indexType: n, adjustments: s }; + } + _getInputBandIds(e) { + if (this.functionArguments.method === "custom") + return e; + const i = this.functionArguments.bandIndexes.split(" ").map((a) => parseFloat(a) - 1), r = e.length, n = i.map((a) => a >= r ? r - 1 : a), s = bVi.has(this.functionArguments.method) ? 3 : 2, o = n.slice(0, s).map((a) => e[a]); + return o.length === 2 && o.push(0), o; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], UV.prototype, "functionName", void 0), E([N({ type: _Vi, json: { write: !0, name: "rasterFunctionArguments" } })], UV.prototype, "functionArguments", void 0), E([N()], UV.prototype, "rasterArgumentNames", void 0), UV = E([dt("esri.layers.support.rasterFunctions.BandArithmeticFunction")], UV); +const wVi = UV; +var DRe; +let jT = DRe = class extends zb { + castColormapName(t) { + if (!t) + return null; + const e = t.toLowerCase(); + return cJt.includes(e) ? e : null; + } + readColorRamp(t) { + return Pge(t); + } + readColorRampName(t, e) { + if (!t) + return null; + const i = qG.jsonValues.find((r) => r.toLowerCase() === t.toLowerCase()); + return i ? qG.fromJSON(i) : null; + } + clone() { + return new DRe({ colormap: fi(this.colormap), colormapName: this.colormapName, colorRamp: this.colorRamp?.clone(), colorRampName: this.colorRampName }); + } +}; +E([N({ type: [[Number]], json: { write: !0 } })], jT.prototype, "colormap", void 0), E([N({ type: String, json: { write: !0 } })], jT.prototype, "colormapName", void 0), E([uo("colormapName")], jT.prototype, "castColormapName", null), E([N({ types: Age, json: { write: !0 } })], jT.prototype, "colorRamp", void 0), E([Li("colorRamp")], jT.prototype, "readColorRamp", null), E([N({ type: qG.apiValues, json: { type: qG.jsonValues, write: qG.write } })], jT.prototype, "colorRampName", void 0), E([Li("colorRampName")], jT.prototype, "readColorRampName", null), jT = DRe = E([dt("esri.layers.support.rasterFunctions.ColormapFunctionArguments")], jT); +const xVi = jT, SVi = [[36, 0, 255], [36, 0, 255], [36, 0, 255], [36, 0, 255], [112, 75, 3], [113, 76, 3], [114, 77, 3], [115, 77, 3], [116, 78, 3], [117, 79, 3], [118, 79, 3], [119, 80, 3], [121, 81, 4], [122, 82, 4], [123, 82, 4], [124, 83, 4], [125, 84, 4], [126, 84, 4], [127, 85, 4], [128, 86, 4], [129, 86, 4], [130, 87, 4], [131, 88, 4], [132, 89, 4], [133, 89, 4], [134, 90, 4], [135, 91, 4], [136, 91, 4], [137, 92, 4], [138, 93, 4], [139, 94, 4], [140, 94, 4], [142, 95, 5], [143, 96, 5], [144, 96, 5], [145, 97, 5], [146, 98, 5], [147, 99, 5], [148, 99, 5], [149, 100, 5], [150, 101, 5], [151, 101, 5], [152, 102, 5], [153, 103, 5], [154, 104, 5], [155, 104, 5], [156, 105, 5], [157, 106, 5], [158, 106, 5], [159, 107, 5], [160, 108, 5], [161, 108, 5], [162, 109, 5], [164, 110, 6], [165, 111, 6], [166, 111, 6], [167, 112, 6], [168, 113, 6], [169, 113, 6], [170, 114, 6], [171, 115, 6], [172, 116, 6], [173, 116, 6], [174, 117, 6], [245, 0, 0], [245, 5, 0], [245, 10, 0], [246, 15, 0], [246, 20, 0], [246, 25, 0], [246, 30, 0], [247, 35, 0], [247, 40, 0], [247, 45, 0], [247, 50, 0], [247, 55, 0], [248, 60, 0], [248, 65, 0], [248, 70, 0], [248, 75, 0], [249, 81, 0], [249, 86, 0], [249, 91, 0], [249, 96, 0], [250, 101, 0], [250, 106, 0], [250, 111, 0], [250, 116, 0], [250, 121, 0], [251, 126, 0], [251, 131, 0], [251, 136, 0], [251, 141, 0], [252, 146, 0], [252, 151, 0], [252, 156, 0], [252, 156, 0], [251, 159, 0], [250, 162, 0], [249, 165, 0], [248, 168, 0], [247, 171, 0], [246, 174, 0], [245, 177, 0], [245, 179, 0], [244, 182, 0], [243, 185, 0], [242, 188, 0], [241, 191, 0], [240, 194, 0], [239, 197, 0], [238, 200, 0], [237, 203, 0], [236, 206, 0], [235, 209, 0], [234, 212, 0], [233, 215, 0], [232, 218, 0], [231, 221, 0], [230, 224, 0], [230, 226, 0], [229, 229, 0], [228, 232, 0], [227, 235, 0], [226, 238, 0], [225, 241, 0], [224, 244, 0], [223, 247, 0], [165, 247, 0], [163, 244, 0], [161, 240, 0], [158, 237, 0], [156, 233, 1], [154, 230, 1], [152, 227, 1], [149, 223, 1], [147, 220, 1], [145, 216, 1], [143, 213, 1], [140, 210, 2], [138, 206, 2], [136, 203, 2], [134, 200, 2], [132, 196, 2], [129, 193, 2], [127, 189, 2], [125, 186, 3], [123, 183, 3], [120, 179, 3], [118, 176, 3], [116, 172, 3], [114, 169, 3], [111, 166, 3], [109, 162, 4], [107, 159, 4], [105, 155, 4], [103, 152, 4], [100, 149, 4], [98, 145, 4], [96, 142, 4], [94, 138, 5], [91, 135, 5], [89, 132, 5], [87, 128, 5], [85, 125, 5], [82, 121, 5], [80, 118, 5], [78, 115, 6], [76, 111, 6], [73, 108, 6], [71, 105, 6], [69, 101, 6], [67, 98, 6], [65, 94, 6], [62, 91, 7], [60, 88, 7], [58, 84, 7], [56, 81, 7], [53, 77, 7], [51, 74, 7], [49, 71, 7], [47, 67, 8], [44, 64, 8], [42, 60, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8], [40, 57, 8]], CVi = [[36, 0, 255], [36, 0, 255], [36, 0, 255], [36, 0, 255], [245, 20, 0], [245, 24, 0], [245, 29, 0], [245, 31, 0], [247, 33, 0], [247, 33, 0], [247, 37, 0], [247, 41, 0], [247, 41, 0], [247, 41, 0], [247, 45, 0], [247, 45, 0], [247, 47, 0], [247, 49, 0], [247, 49, 0], [247, 54, 0], [247, 54, 0], [247, 56, 0], [247, 58, 0], [247, 58, 0], [250, 62, 0], [250, 62, 0], [250, 62, 0], [250, 67, 0], [250, 67, 0], [250, 67, 0], [250, 69, 0], [250, 71, 0], [250, 71, 0], [250, 75, 0], [250, 75, 0], [250, 78, 0], [250, 79, 0], [250, 79, 0], [250, 79, 0], [250, 81, 0], [250, 83, 0], [250, 83, 0], [250, 87, 0], [250, 87, 0], [250, 90, 0], [250, 92, 0], [252, 93, 0], [252, 93, 0], [252, 97, 0], [252, 97, 0], [252, 97, 0], [252, 97, 0], [252, 101, 0], [252, 101, 0], [252, 101, 0], [252, 101, 0], [252, 105, 0], [252, 105, 0], [252, 107, 0], [252, 109, 0], [252, 109, 0], [252, 113, 13], [255, 118, 20], [255, 119, 23], [255, 121, 25], [255, 126, 33], [255, 132, 38], [255, 133, 40], [255, 135, 43], [255, 141, 48], [255, 144, 54], [255, 150, 59], [255, 152, 61], [255, 153, 64], [255, 159, 69], [255, 163, 77], [255, 165, 79], [255, 168, 82], [255, 174, 87], [255, 176, 92], [255, 181, 97], [255, 183, 99], [255, 186, 102], [255, 191, 107], [255, 197, 115], [255, 201, 120], [255, 203, 123], [255, 205, 125], [255, 209, 130], [255, 214, 138], [255, 216, 141], [255, 218, 143], [255, 224, 150], [255, 228, 156], [255, 234, 163], [255, 236, 165], [255, 238, 168], [255, 243, 173], [255, 248, 181], [255, 252, 186], [253, 252, 186], [250, 252, 187], [244, 250, 180], [238, 247, 176], [234, 246, 173], [231, 245, 169], [223, 240, 163], [217, 237, 157], [211, 235, 150], [205, 233, 146], [200, 230, 142], [195, 227, 136], [189, 224, 132], [184, 222, 126], [180, 220, 123], [174, 217, 119], [169, 214, 114], [163, 212, 108], [160, 210, 105], [154, 207, 101], [148, 204, 96], [143, 201, 93], [138, 199, 88], [134, 197, 84], [130, 194, 81], [126, 191, 77], [117, 189, 70], [115, 186, 68], [112, 184, 64], [106, 181, 60], [100, 179, 55], [94, 176, 49], [92, 174, 47], [90, 173, 45], [81, 168, 37], [75, 166, 33], [71, 163, 28], [66, 160, 24], [62, 158, 21], [56, 156, 14], [51, 153, 0], [51, 153, 0], [51, 153, 0], [50, 150, 0], [50, 150, 0], [50, 150, 0], [50, 150, 0], [49, 148, 0], [49, 148, 0], [49, 148, 0], [48, 145, 0], [48, 145, 0], [48, 145, 0], [48, 145, 0], [48, 143, 0], [48, 143, 0], [48, 143, 0], [48, 143, 0], [47, 140, 0], [47, 140, 0], [47, 140, 0], [47, 140, 0], [46, 138, 0], [46, 138, 0], [46, 138, 0], [46, 138, 0], [45, 135, 0], [45, 135, 0], [45, 135, 0], [45, 135, 0], [44, 133, 0], [44, 133, 0], [44, 133, 0], [43, 130, 0], [43, 130, 0], [43, 130, 0], [43, 130, 0], [43, 130, 0], [43, 130, 0], [42, 128, 0], [42, 128, 0], [42, 128, 0], [42, 125, 0], [42, 125, 0], [42, 125, 0], [42, 125, 0], [41, 122, 0], [41, 122, 0], [41, 122, 0], [41, 122, 0], [40, 120, 0], [40, 120, 0], [40, 120, 0], [40, 120, 0], [40, 120, 0], [39, 117, 0], [39, 117, 0], [39, 117, 0], [39, 117, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0], [38, 115, 0]]; +function $8e(t, e) { + const i = [], r = []; + for (let s = 0; s < t.length - 1; s++) + i.push({ type: "algorithmic", algorithm: "esriHSVAlgorithm", fromColor: t[s].slice(1), toColor: t[s + 1].slice(1) }), r.push(t[s + 1][0] - t[s][0]); + const n = t[t.length - 1][0]; + return y5e({ type: "multipart", colorRamps: i }, { numColors: n, weights: e = e ?? r }); +} +function TVi() { + return $8e([[0, 0, 191, 191], [51, 0, 255, 0], [102, 255, 255, 0], [153, 255, 127, 0], [204, 191, 127, 63], [256, 20, 20, 20]]); +} +function EVi() { + const t = $8e([[0, 255, 255, 255], [70, 0, 0, 255], [80, 205, 193, 173], [100, 150, 150, 150], [110, 120, 100, 51], [130, 120, 200, 100], [140, 28, 144, 3], [160, 6, 55, 0], [180, 10, 30, 25], [201, 6, 27, 7]]); + for (let e = t.length; e < 256; e++) + t.push([6, 27, 7]); + return t; +} +function IVi() { + return y5e({ type: "algorithmic", algorithm: "esriHSVAlgorithm", fromColor: [0, 0, 0], toColor: [255, 255, 255] }); +} +function AVi() { + const t = []; + for (let e = 0; e < 256; e++) { + const i = []; + for (let r = 0; r < 3; r++) + i.push(Math.round(255 * Math.random())); + t.push(i); + } + return t; +} +function PVi() { + return $8e([[0, 38, 54, 41], [69, 79, 90, 82], [131, 156, 156, 156], [256, 253, 241, 253]], [0.268, 0.238, 0.495]); +} +function OVi(t) { + let e; + switch (t) { + case "elevation": + e = TVi(); + break; + case "gray": + e = IVi(); + break; + case "hillshade": + e = PVi(); + break; + case "ndvi": + e = SVi; + break; + case "ndvi2": + e = EVi(); + break; + case "ndvi3": + e = CVi; + break; + case "random": + e = AVi(); + } + return e ? (e = e.map((i, r) => [r, ...i]), e) : null; +} +let DM = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Colormap", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.isNoopProcess = !0; + } + _bindSourceRasters() { + const e = this.sourceRasterInfos[0]; + if (e.bandCount > 1) + return { success: !1, supportsGPU: !1, error: "colormap-function: source data must be single band" }; + let { colormap: i, colormapName: r, colorRamp: n, colorRampName: s } = this.functionArguments; + if (!i?.length) + if (n) + i = qO(n, { interpolateAlpha: !0 }); + else if (s) { + const a = dJt(s); + a && (i = qO(a)); + } else + r && (i = OVi(r)); + if (!i?.length) + return { success: !1, supportsGPU: !1, error: "colormap-function: missing colormap argument" }; + this.outputPixelType = this._getOutputPixelType("u8"); + const o = e.clone(); + return o.pixelType = this.outputPixelType, o.colormap = i, o.bandCount = 1, this.rasterInfo = o, { success: !0, supportsGPU: !0 }; + } + _processPixels(e) { + return e.pixelBlocks?.[0]; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], DM.prototype, "functionName", void 0), E([N({ type: xVi, json: { write: !0, name: "rasterFunctionArguments" } })], DM.prototype, "functionArguments", void 0), E([N()], DM.prototype, "rasterArgumentNames", void 0), E([N()], DM.prototype, "isNoopProcess", void 0), E([N({ json: { write: !0 } })], DM.prototype, "indexedColormap", void 0), DM = E([dt("esri.layers.support.rasterFunctions.ColormapFunction")], DM); +const RVi = DM; +var FRe; +let vX = FRe = class extends zb { + constructor() { + super(...arguments), this.rasters = []; + } + writeRasters(t, e) { + e.rasters = t.map((i) => typeof i == "number" || typeof i == "string" ? i : i.toJSON()); + } + clone() { + return new FRe({ rasters: fi(this.rasters) }); + } +}; +E([N({ json: { write: !0 } })], vX.prototype, "rasters", void 0), E([mr("rasters")], vX.prototype, "writeRasters", null), vX = FRe = E([dt("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")], vX); +const MVi = vX; +let zV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "CompositeBand", this.functionArguments = null, this.rasterArgumentNames = ["rasters"]; + } + _bindSourceRasters() { + const { sourceRasterInfos: e } = this, i = e[0]; + this.outputPixelType = this._getOutputPixelType(i.pixelType); + const r = i.clone(); + if (r.attributeTable = null, r.colormap = null, r.pixelType = this.outputPixelType, r.bandCount = e.map(({ bandCount: n }) => n).reduce((n, s) => n + s), e.every(({ statistics: n }) => _e(n) && n.length)) { + const n = []; + e.forEach(({ statistics: s }) => _e(s) && n.push(...s)), r.statistics = n; + } + if (e.every(({ histograms: n }) => _e(n) && n.length)) { + const n = []; + e.forEach(({ histograms: s }) => _e(s) && n.push(...s)), r.histograms = n; + } + return r.bandCount > 1 && (r.colormap = null, r.attributeTable = null), this.rasterInfo = r, { success: !0, supportsGPU: r.bandCount <= 3 }; + } + _processPixels(e) { + const { pixelBlocks: i } = e; + if (!i) + return null; + const r = i?.[0]; + return ut(r) ? null : AJt(i); + } + _getWebGLParameters() { + return { bandCount: this.rasterInfo.bandCount }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], zV.prototype, "functionName", void 0), E([N({ type: MVi, json: { write: !0, name: "rasterFunctionArguments" } })], zV.prototype, "functionArguments", void 0), E([N()], zV.prototype, "rasterArgumentNames", void 0), zV = E([dt("esri.layers.support.rasterFunctions.CompositeBandFunction")], zV); +const DVi = zV, Qu = { userDefined: -1, lineDetectionHorizontal: 0, lineDetectionVertical: 1, lineDetectionLeftDiagonal: 2, lineDetectionRightDiagonal: 3, gradientNorth: 4, gradientWest: 5, gradientEast: 6, gradientSouth: 7, gradientNorthEast: 8, gradientNorthWest: 9, smoothArithmeticMean: 10, smoothing3x3: 11, smoothing5x5: 12, sharpening3x3: 13, sharpening5x5: 14, laplacian3x3: 15, laplacian5x5: 16, sobelHorizontal: 17, sobelVertical: 18, sharpen: 19, sharpen2: 20, pointSpread: 21, none: 255 }, FVi = { plus: 1, minus: 2, times: 3, sqrt: 4, power: 5, abs: 10, divide: 23, exp: 25, exp10: 26, exp2: 27, int: 30, float: 32, ln: 35, log10: 36, log2: 37, mod: 44, negate: 45, roundDown: 48, roundUp: 49, square: 53, floatDivide: 64, floorDivide: 65 }, R_ = { bitwiseAnd: 11, bitwiseLeftShift: 12, bitwiseNot: 13, bitwiseOr: 14, bitwiseRightShift: 15, bitwiseXOr: 16, booleanAnd: 17, booleanNot: 18, booleanOr: 19, booleanXOr: 20, equalTo: 24, greaterThan: 28, greaterThanEqual: 29, lessThan: 33, lessThanEqual: 34, isNull: 31, notEqual: 46 }, vS = { acos: 6, asin: 7, atan: 8, atanh: 9, cos: 21, cosh: 22, sin: 51, sinh: 52, tan: 56, tanh: 57, acosh: 59, asinh: 60, atan2: 61 }, LVi = { majority: 38, max: 39, mean: 40, med: 41, min: 42, minority: 43, range: 47, stddev: 54, sum: 55, variety: 58, majorityIgnoreNoData: 66, maxIgnoreNoData: 67, meanIgnoreNoData: 68, medIgnoreNoData: 69, minIgnoreNoData: 70, minorityIgnoreNoData: 71, rangeIgnoreNoData: 72, stddevIgnoreNoData: 73, sumIgnoreNoData: 74, varietyIgnoreNoData: 75 }, bPt = { setNull: 50, conditional: 78 }, ZZe = { ...FVi, ...R_, ...vS, ...LVi, ...bPt }, Yd = /* @__PURE__ */ new Map(); +function NVi(t) { + const e = Math.sqrt(t.length), i = t.slice(0, e), r = [1]; + for (let n = 1; n < e; n++) { + let s = null; + for (let o = 0; o < e; o++) { + const a = t[o + n * e], l = t[o]; + if (s == null) + if (l === 0) { + if (a) + return { separable: !1, row: null, col: null }; + } else + s = a / l; + else if (a / l !== s) + return { separable: !1, row: null, col: null }; + } + if (s == null) + return { separable: !1, row: null, col: null }; + r.push(s); + } + return { separable: !0, row: i, col: r }; +} +function QZe(t, e, i, r, n, s, o) { + const a = new Float32Array(e * i), l = s.length, c = o ? 0 : r, h = o ? r : 0, p = o ? 1 : e; + for (let y = c; y < i - c; y++) { + const v = y * e; + for (let x = h; x < e - h; x++) { + if (n && !n[v + x]) + continue; + let I = 0; + for (let P = 0; P < l; P++) + I += t[v + x + (P - r) * p] * s[P]; + a[v + x] = I; + } + } + return a; +} +function kVi(t, e, i, r, n, s, o) { + const a = new Float32Array(e * i), l = Math.floor(r / 2), c = Math.floor(n / 2); + for (let h = l; h < i - l; h++) { + const p = h * e; + for (let y = c; y < e - c; y++) { + if (s && !s[p + y]) + continue; + let v = 0; + for (let x = 0; x < r; x++) + for (let I = 0; I < n; I++) + v += t[p + y + (x - l) * e + I - c] * o[x * n + I]; + a[p + y] = v; + } + } + return a; +} +function $Vi(t, e, i = !0) { + const { pixels: r, width: n, height: s, pixelType: o, mask: a } = t, l = r.length, c = [], { kernel: h, rows: p, cols: y } = e; + for (let v = 0; v < l; v++) { + const x = kVi(r[v], n, s, p, y, a, h); + i && wPt(x, n, s, p, y), c.push(x); + } + return new nn({ width: n, height: s, pixelType: o, pixels: c, mask: a }); +} +function wPt(t, e, i, r, n) { + const s = Math.floor(r / 2); + for (let a = 0; a < s; a++) + for (let l = 0; l < e; l++) + t[a * e + l] = t[(n - 1 - a) * e + l], t[(i - 1 - a) * e + l] = t[(i - n + a) * e + l]; + const o = Math.floor(n / 2); + for (let a = 0; a < i; a++) { + const l = a * e; + for (let c = 0; c < o; c++) + t[l + c] = t[l + n - 1 - c], t[l + e - c - 1] = t[l + e + c - n]; + } +} +function BVi(t, e, i, r = !0) { + const { pixels: n, width: s, height: o, pixelType: a, mask: l } = t, c = n.length, h = [], p = e.length, y = i.length, v = Math.floor(p / 2), x = Math.floor(y / 2); + for (let I = 0; I < c; I++) { + let P = QZe(n[I], s, o, v, l, e, !0); + P = QZe(P, s, o, x, l, i, !1), r && wPt(P, s, o, p, y), h.push(P); + } + return new nn({ width: s, height: o, pixelType: a, pixels: h, mask: l }); +} +function VVi(t, e) { + const i = NVi(e.kernel), r = e.mirrorEdges !== !1, n = i.separable ? BVi(t, i.row, i.col, r) : $Vi(t, e, r), { outputPixelType: s } = e; + return s && n.clamp(s), n; +} +Yd.set(Qu.none, [0, 0, 0, 0, 1, 0, 0, 0, 0]), Yd.set(Qu.lineDetectionHorizontal, [-1, -1, -1, 2, 2, 2, -1, -1, -1]), Yd.set(Qu.lineDetectionVertical, [-1, 2, -1, -1, 2, -1, -1, 2, -1]), Yd.set(Qu.lineDetectionLeftDiagonal, [2, -1, -1, -1, 2, -1, -1, -1, 2]), Yd.set(Qu.lineDetectionRightDiagonal, [-1, -1, 2, -1, 2, -1, 2, -1, -1]), Yd.set(Qu.gradientNorth, [-1, -2, -1, 0, 0, 0, 1, 2, 1]), Yd.set(Qu.gradientWest, [-1, 0, 1, -2, 0, 2, -1, 0, 1]), Yd.set(Qu.gradientEast, [1, 0, -1, 2, 0, -2, 1, 0, -1]), Yd.set(Qu.gradientSouth, [1, 2, 1, 0, 0, 0, -1, -2, -1]), Yd.set(Qu.gradientNorthEast, [0, -1, -2, 1, 0, -1, 2, 1, 0]), Yd.set(Qu.gradientNorthWest, [-2, -1, 0, -1, 0, 1, 0, 1, 2]), Yd.set(Qu.smoothArithmeticMean, [0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111, 0.111111111111]), Yd.set(Qu.smoothing3x3, [0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625]), Yd.set(Qu.smoothing5x5, [1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 4, 12, 4, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 1]), Yd.set(Qu.sharpening3x3, [-1, -1, -1, -1, 9, -1, -1, -1, -1]), Yd.set(Qu.sharpening5x5, [-1, -3, -4, -3, -1, -3, 0, 6, 0, -3, -4, 6, 21, 6, -4, -3, 0, 6, 0, -3, -1, -3, -4, -3, -1]), Yd.set(Qu.laplacian3x3, [0, -1, 0, -1, 4, -1, 0, -1, 0]), Yd.set(Qu.laplacian5x5, [0, 0, -1, 0, 0, 0, -1, -2, -1, 0, -1, -2, 17, -2, -1, 0, -1, -2, -1, 0, 0, 0, -1, 0, 0]), Yd.set(Qu.sobelHorizontal, [-1, -2, -1, 0, 0, 0, 1, 2, 1]), Yd.set(Qu.sobelVertical, [-1, 0, 1, -2, 0, 2, -1, 0, 1]), Yd.set(Qu.sharpen, [0, -0.25, 0, -0.25, 2, -0.25, 0, -0.25, 0]), Yd.set(Qu.sharpen2, [-0.25, -0.25, -0.25, -0.25, 3, -0.25, -0.25, -0.25, -0.25]), Yd.set(Qu.pointSpread, [-0.627, 0.352, -0.627, 0.352, 2.923, 0.352, -0.627, 0.352, -0.627]); +var LRe; +let FN = LRe = class extends zb { + constructor() { + super(...arguments), this.rows = 3, this.cols = 3, this.kernel = [0, 0, 0, 0, 1, 0, 0, 0, 0]; + } + set convolutionType(t) { + this._set("convolutionType", t); + const e = Yd.get(t); + if (!e || t === Qu.userDefined || t === Qu.none) + return; + const i = Math.sqrt(e.length); + this._set("kernel", e), this._set("cols", i), this._set("rows", i); + } + clone() { + return new LRe({ cols: this.cols, rows: this.rows, kernel: [...this.kernel], convolutionType: this.convolutionType, raster: fi(this.raster) }); + } +}; +E([N({ json: { type: Number, write: !0 } })], FN.prototype, "rows", void 0), E([N({ json: { type: Number, write: !0 } })], FN.prototype, "cols", void 0), E([N({ json: { name: "type", type: Number, write: !0 } })], FN.prototype, "convolutionType", null), E([N({ json: { type: [Number], write: !0 } })], FN.prototype, "kernel", void 0), FN = LRe = E([dt("esri.layers.support.rasterFunctions.ConvolutionFunctionArguments")], FN); +const jVi = FN, eQe = 25; +let HV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Convolution", this.rasterArgumentNames = ["raster"]; + } + _bindSourceRasters() { + const { convolutionType: e, rows: i, cols: r, kernel: n } = this.functionArguments; + if (!Object.values(Qu).includes(e)) + return { success: !1, supportsGPU: !1, error: `convolution-function: the specified kernel type is not supported ${e}` }; + if (e !== Qu.none && i * r !== n.length) + return { success: !1, supportsGPU: !1, error: "convolution-function: the specified rows and cols do not match the length of the kernel" }; + const s = this.sourceRasterInfos[0]; + this.outputPixelType = this._getOutputPixelType(s.pixelType); + const o = s.clone(); + o.pixelType = this.outputPixelType; + const a = [Qu.none, Qu.sharpen, Qu.sharpen2, Qu.sharpening3x3, Qu.sharpening5x5]; + return this.outputPixelType === "u8" || a.includes(e) || (o.statistics = null, o.histograms = null), o.colormap = null, o.attributeTable = null, this.rasterInfo = o, { success: !0, supportsGPU: n.length <= eQe }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i) || this.functionArguments.convolutionType === Qu.none) + return i; + let { kernel: r, rows: n, cols: s } = this.functionArguments; + const o = r.reduce((a, l) => a + l); + return o !== 0 && o !== 1 && (r = r.map((a) => a / o)), VVi(i, { kernel: r, rows: n, cols: s, outputPixelType: this.outputPixelType }); + } + _getWebGLParameters() { + let { kernel: e } = this.functionArguments; + const i = e.reduce((n, s) => n + s); + i !== 0 && i !== 1 && (e = e.map((n) => n / i)); + const r = new Float32Array(eQe); + return r.set(e), { kernelRows: this.functionArguments.rows, kernelCols: this.functionArguments.cols, kernel: r, clampRange: $I(this.outputPixelType) }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], HV.prototype, "functionName", void 0), E([N({ type: jVi, json: { write: !0, name: "rasterFunctionArguments" } })], HV.prototype, "functionArguments", void 0), E([N()], HV.prototype, "rasterArgumentNames", void 0), HV = E([dt("esri.layers.support.rasterFunctions.ConvolutionFunction")], HV); +const GVi = HV; +var NRe; +let _X = NRe = class extends zb { + constructor() { + super(...arguments), this.bandIds = [], this.missingBandAction = nde.bestMatch; + } + clone() { + return new NRe({ bandIds: [...this.bandIds], missingBandAction: this.missingBandAction }); + } +}; +E([N({ json: { write: !0 } })], _X.prototype, "bandIds", void 0), E([N({ json: { write: !0 } })], _X.prototype, "missingBandAction", void 0), _X = NRe = E([dt("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")], _X); +const UVi = _X; +let WV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "ExtractBand", this.functionArguments = null, this.rasterArgumentNames = ["raster"]; + } + _bindSourceRasters() { + const { sourceRasterInfos: e } = this, i = e[0], { bandCount: r } = i, { bandIds: n, missingBandAction: s } = this.functionArguments; + if (s === nde.fail && n.some((c) => c < 0 || c >= r)) + return { success: !1, supportsGPU: !1, error: "extract-band-function: invalid bandIds" }; + this.outputPixelType = this._getOutputPixelType("f32"); + const o = i.clone(); + o.pixelType = this.outputPixelType, o.bandCount = n.length; + const { statistics: a, histograms: l } = o; + return _e(a) && a.length && (o.statistics = n.map((c) => a[c] || a[a.length - 1])), _e(l) && l.length && (o.histograms = n.map((c) => l[c] || l[l.length - 1])), this.rasterInfo = o, { success: !0, supportsGPU: o.bandCount <= 3 }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const r = i.pixels.length, n = this.functionArguments.bandIds.map((s) => s >= r ? r - 1 : s); + return i.extractBands(n); + } + _getWebGLParameters() { + let e; + if (this.isInputBandIdsSwizzled) + e = this.swizzledBandSelection.length ? this.swizzledBandSelection : [0, 1, 2]; + else { + e = [...this.functionArguments.bandIds], e.length === 0 ? e = [0, 1, 2] : e.length < 3 && (e[1] = e[1] ?? e[0], e[2] = e[2] ?? e[1]); + for (let i = 0; i < 3; i++) + e[i] = Math.min(e[i], 2); + } + return { bandIndexMat3: Tg(e) }; + } + _getInputBandIds(e) { + const i = e.length; + return this.functionArguments.bandIds.map((r) => r >= i ? i - 1 : r).map((r) => e[r]); + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], WV.prototype, "functionName", void 0), E([N({ type: UVi, json: { write: !0, name: "rasterFunctionArguments" } })], WV.prototype, "functionArguments", void 0), E([N()], WV.prototype, "rasterArgumentNames", void 0), WV = E([dt("esri.layers.support.rasterFunctions.ExtractBandFunction")], WV); +const zVi = WV; +var kRe; +let LN = kRe = class extends zb { + constructor() { + super(...arguments), this.rasters = [], this.processAsMultiband = !0; + } + writeRasters(t, e) { + e.rasters = t.map((i) => typeof i == "number" || typeof i == "string" ? i : i.toJSON()); + } + clone() { + return new kRe({ operation: this.operation, processAsMultiband: this.processAsMultiband, rasters: fi(this.rasters) }); + } +}; +E([N({ json: { write: !0 } })], LN.prototype, "operation", void 0), E([N({ json: { write: !0 } })], LN.prototype, "rasters", void 0), E([mr("rasters")], LN.prototype, "writeRasters", null), E([N({ json: { write: !0 } })], LN.prototype, "processAsMultiband", void 0), LN = kRe = E([dt("esri.layers.support.rasterFunctions.LocalFunctionArguments")], LN); +const HVi = LN, Eg = /* @__PURE__ */ new Map(); +function WVi(t) { + return Eg.get(t); +} +Eg.set(vS.acos, [0, Math.PI]), Eg.set(vS.asin, [-Math.PI / 2, Math.PI / 2]), Eg.set(vS.atan, [-Math.PI / 2, Math.PI / 2]), Eg.set(vS.cos, [-1, 1]), Eg.set(vS.sin, [-1, 1]), Eg.set(R_.booleanAnd, [0, 1]), Eg.set(R_.booleanNot, [0, 1]), Eg.set(R_.booleanOr, [0, 1]), Eg.set(R_.booleanXOr, [0, 1]), Eg.set(R_.equalTo, [0, 1]), Eg.set(R_.notEqual, [0, 1]), Eg.set(R_.greaterThan, [0, 1]), Eg.set(R_.greaterThanEqual, [0, 1]), Eg.set(R_.lessThan, [0, 1]), Eg.set(R_.lessThanEqual, [0, 1]), Eg.set(R_.isNull, [0, 1]); +const tQe = [0, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 999, 999, 999, 999, 999, 999, 2, 1, 2, 999, 1, 1, 2, 1, 1, 1, 999, 999, 1, 1, 999, 1, 1, 2, 999, 999, 2, 2, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 3, 999, 3]; +function qVi(t, e = !1) { + const i = t.map((a) => a.mask), r = i.filter((a) => _e(a)), n = t[0].pixels[0].length; + if (r.length === 0) + return new Uint8Array(n).fill(255); + const s = r[0], o = new Uint8Array(s); + if (r.length === 1) + return o; + if (!e) { + for (let a = 1; a < r.length; a++) { + const l = r[a]; + for (let c = 0; c < o.length; c++) + o[c] && (o[c] = l[c] ? 255 : 0); + } + return o; + } + if (r.length !== i.length) + return new Uint8Array(n).fill(255); + for (let a = 1; a < r.length; a++) { + const l = r[a]; + for (let c = 0; c < o.length; c++) + o[c] === 0 && (o[c] = l[c] ? 255 : 0); + } + return o; +} +function YVi(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] + n[a]); + return o; +} +function XVi(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand("f32", n); + return s.set(r), s; +} +function KVi(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] - n[a]); + return o; +} +function JVi(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] * n[a]); + return o; +} +function ZVi(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand(i, n); + for (let o = 0; o < n; o++) + e && !e[o] || (s[o] = Math.sign(r[o]) * Math.floor(Math.abs(r[o]))); + return s; +} +function xPt(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] / n[a]); + return o; +} +function QVi(t, e, i) { + return xPt(t, e, "f32"); +} +function eji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = Math.floor(r[a] / n[a])); + return o; +} +function tji(t, e, i, r) { + const n = t[0], s = n.length, o = nn.createEmptyBand(i, s); + if (r === vS.atanh) { + for (let l = 0; l < s; l++) + if (e[l]) { + const c = n[l]; + Math.abs(c) >= 1 ? e[l] = 0 : o[l] = Math.atanh(c); + } + return o; + } + const a = r === vS.asin ? Math.asin : Math.acos; + for (let l = 0; l < s; l++) + if (e[l]) { + const c = n[l]; + Math.abs(c) > 1 ? e[l] = 0 : o[l] = a(c); + } + return o; +} +function iji(t, e, i, r) { + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r(n[a])); + return o; +} +function rji(t, e, i, r) { + const [n, s] = t, o = n.length, a = nn.createEmptyBand(i, o); + for (let l = 0; l < o; l++) + e && !e[l] || (a[l] = r(n[l], s[l])); + return a; +} +function nji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] & n[a]); + return o; +} +function iQe(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] << n[a]); + return o; +} +function sji(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand(i, n); + for (let o = 0; o < n; o++) + e && !e[o] || (s[o] = ~r[o]); + return s; +} +function oji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] | n[a]); + return o; +} +function aji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] >> n[a]); + return o; +} +function lji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] ^ n[a]); + return o; +} +function uji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] && n[a] ? 1 : 0); + return o; +} +function cji(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand(i, n); + for (let o = 0; o < n; o++) + e && !e[o] || (s[o] = r[o] ? 0 : 1); + return s; +} +function hji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] || n[a] ? 1 : 0); + return o; +} +function dji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = (r[a] ? 1 : 0) ^ (n[a] ? 1 : 0)); + return o; +} +function pji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] === n[a] ? 1 : 0); + return o; +} +function B8e(t, e, i, r) { + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s), a = r === Math.E; + for (let l = 0; l < s; l++) + e && !e[l] || (o[l] = a ? Math.exp(n[l]) : r ** n[l]); + return o; +} +function fji(t, e, i) { + return B8e(t, e, i, 10); +} +function mji(t, e, i) { + return B8e(t, e, i, 2); +} +function gji(t, e, i) { + return B8e(t, e, i, Math.E); +} +function V8e(t, e, i, r) { + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (n[a] <= 0 ? e[a] = 0 : o[a] = r(n[a])); + return o; +} +function yji(t, e, i) { + return V8e(t, e, i, Math.log10); +} +function vji(t, e, i) { + return V8e(t, e, i, Math.log2); +} +function _ji(t, e, i) { + return V8e(t, e, i, Math.log); +} +function bji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] > n[a] ? 1 : 0); + return o; +} +function wji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] >= n[a] ? 1 : 0); + return o; +} +function xji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] < n[a] ? 1 : 0); + return o; +} +function Sji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] <= n[a] ? 1 : 0); + return o; +} +function Cji(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand(i, n); + if (!e) + return s; + for (let o = 0; o < n; o++) + s[o] = e[o] ? 0 : 1; + return s; +} +function Tji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] % n[a]); + return o; +} +function Eji(t, e, i) { + const [r] = t, n = r.length, s = nn.createEmptyBand(i, n); + for (let o = 0; o < n; o++) + e && !e[o] || (s[o] = -r[o]); + return s; +} +function Iji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e && !e[a] || (o[a] = r[a] === n[a] ? 0 : 1); + return o; +} +function Aji(t, e, i) { + const [r, n] = t, s = r.length, o = nn.createEmptyBand(i, s), a = new Uint8Array(s); + for (let l = 0; l < s; l++) + e != null && !e[l] || r[l] !== 0 || (o[l] = n[l], a[l] = 255); + return { band: o, mask: a }; +} +function rQe(t, e, i) { + const [r, n, s] = t, o = r.length, a = nn.createEmptyBand(i, o); + for (let l = 0; l < o; l++) + e && !e[l] || (a[l] = r[l] ? n[l] : s[l]); + return a; +} +function nQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) { + let l = n[a]; + for (let c = 1; c < r; c++) { + const h = t[c][a]; + l < h && (l = h); + } + o[a] = l; + } + return o; +} +function sQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) { + let l = n[a]; + for (let c = 1; c < r; c++) { + const h = t[c][a]; + l > h && (l = h); + } + o[a] = l; + } + return o; +} +function oQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) { + let l = n[a], c = l; + for (let h = 1; h < r; h++) { + const p = t[h][a]; + c < p ? c = p : l > p && (l = p); + } + o[a] = c - l; + } + return o; +} +function aQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) { + let l = 0; + for (let c = 0; c < r; c++) + l += t[c][a]; + o[a] = l / r; + } + return o; +} +function lQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) + for (let l = 0; l < r; l++) { + const c = t[l]; + o[a] += c[a]; + } + return o; +} +function uQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + if (!e || e[a]) { + const l = new Float32Array(r); + let c = 0; + for (let p = 0; p < r; p++) { + const y = t[p]; + c += y[a], l[p] = y[a]; + } + c /= r; + let h = 0; + for (let p = 0; p < r; p++) + h += (l[p] - c) ** 2; + o[a] = Math.sqrt(h / r); + } + return o; +} +function cQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const n = Math.floor(r / 2), [s] = t, o = s.length, a = nn.createEmptyBand(i, o), l = new Float32Array(r), c = r % 2 == 1; + for (let h = 0; h < o; h++) + if (!e || e[h]) { + for (let p = 0; p < r; p++) + l[p] = t[p][h]; + l.sort(), a[h] = c ? l[n] : (l[n] + l[n - 1]) / 2; + } + return a; +} +function SPt(t, e, i) { + const [r, n] = t; + if (n == null) + return r; + const s = r.length, o = nn.createEmptyBand(i, s); + for (let a = 0; a < s; a++) + e[a] && (r[a] === n[a] ? o[a] = r[a] : e[a] = 0); + return o; +} +function hQe(t, e, i) { + const r = t.length; + if (r <= 2) + return SPt(t, e, i); + const n = t[0].length, s = nn.createEmptyBand(i, n), o = /* @__PURE__ */ new Map(); + for (let a = 0; a < n; a++) + if (!e || e[a]) { + let l; + o.clear(); + for (let p = 0; p < r; p++) + l = t[p][a], o.set(l, o.has(l) ? o.get(l) + 1 : 1); + let c = 0, h = 0; + for (const p of o.keys()) + c = o.get(p), c > h && (h = c, l = p); + s[a] = l; + } + return s; +} +function dQe(t, e, i) { + const r = t.length; + if (r <= 2) + return SPt(t, e, i); + const n = t[0].length, s = nn.createEmptyBand(i, n), o = /* @__PURE__ */ new Map(); + for (let a = 0; a < n; a++) + if (!e || e[a]) { + let l; + o.clear(); + for (let p = 0; p < r; p++) + l = t[p][a], o.set(l, o.has(l) ? o.get(l) + 1 : 1); + let c = 0, h = t.length; + for (const p of o.keys()) + c = o.get(p), c < h && (h = c, l = p); + s[a] = l; + } + return s; +} +function pQe(t, e, i) { + const r = t.length; + if (r < 2) + return t[0]; + const [n] = t, s = n.length, o = nn.createEmptyBand(i, s), a = /* @__PURE__ */ new Set(); + for (let l = 0; l < s; l++) + if (!e || e[l]) { + let c; + a.clear(); + for (let h = 0; h < r; h++) + c = t[h][l], a.add(c); + o[l] = a.size; + } + return o; +} +const Zf = /* @__PURE__ */ new Map(), vfe = /* @__PURE__ */ new Map(), Jl = /* @__PURE__ */ new Map(), Zd = /* @__PURE__ */ new Map(); +function Pji() { + Zf.size || (Zf.set(4, Math.sqrt), Zf.set(6, Math.acos), Zf.set(7, Math.asin), Zf.set(8, Math.atan), Zf.set(9, Math.atanh), Zf.set(10, Math.abs), Zf.set(21, Math.cos), Zf.set(22, Math.cosh), Zf.set(48, Math.floor), Zf.set(49, Math.ceil), Zf.set(51, Math.sin), Zf.set(52, Math.sinh), Zf.set(56, Math.tan), Zf.set(57, Math.tanh), Zf.set(59, Math.acosh), Zf.set(60, Math.asinh), Zf.set(65, Math.floor), vfe.set(5, Math.pow), vfe.set(61, Math.atan2), Jl.set(1, YVi), Jl.set(2, KVi), Jl.set(3, JVi), Jl.set(11, nji), Jl.set(12, iQe), Jl.set(12, iQe), Jl.set(13, sji), Jl.set(14, oji), Jl.set(15, aji), Jl.set(16, lji), Jl.set(17, uji), Jl.set(18, cji), Jl.set(19, hji), Jl.set(20, dji), Jl.set(23, xPt), Jl.set(24, pji), Jl.set(25, gji), Jl.set(26, fji), Jl.set(27, mji), Jl.set(28, bji), Jl.set(29, wji), Jl.set(30, ZVi), Jl.set(31, Cji), Jl.set(32, XVi), Jl.set(33, xji), Jl.set(34, Sji), Jl.set(35, _ji), Jl.set(36, yji), Jl.set(37, vji), Jl.set(44, Tji), Jl.set(45, Eji), Jl.set(46, Iji), Jl.set(64, QVi), Jl.set(65, eji), Jl.set(76, rQe), Jl.set(78, rQe), Zd.set(38, hQe), Zd.set(39, nQe), Zd.set(40, aQe), Zd.set(41, cQe), Zd.set(42, sQe), Zd.set(43, dQe), Zd.set(47, oQe), Zd.set(54, uQe), Zd.set(55, lQe), Zd.set(58, pQe), Zd.set(66, hQe), Zd.set(67, nQe), Zd.set(68, aQe), Zd.set(69, cQe), Zd.set(70, sQe), Zd.set(71, dQe), Zd.set(72, oQe), Zd.set(73, uQe), Zd.set(74, lQe), Zd.set(75, pQe)); +} +function Oji(t, e, i, r) { + let [n, s] = $I(i); + const o = i.startsWith("u") || i.startsWith("s"); + o && (n -= 1e-5, s += 1e-5); + for (let a = 0; a < e.length; a++) + if (e[a]) { + const l = t[a]; + isNaN(l) || l < n || l > s ? e[a] = 0 : r[a] = o ? Math.round(l) : l; + } +} +function Rji(t, e, i = {}) { + Pji(); + let r = qVi(t, e >= 66 && e <= 75); + const { outputPixelType: n = "f32" } = i, s = !Zd.has(e) || i.processAsMultiband, o = s ? t[0].pixels.length : 1, a = []; + for (let c = 0; c < o; c++) { + const h = Zd.has(e) && !s ? t.flatMap((v) => v.pixels) : t.map((v) => v.pixels[c]); + let p, y = !0; + if (e === bPt.setNull) { + const v = Aji(h, r, n); + p = v.band, r = v.mask, y = !1; + } else + Jl.has(e) ? p = Jl.get(e)(h, r, "f64") : Zf.has(e) ? p = e === vS.asin || e === vS.acos || e === vS.atanh ? tji(h, r, "f64", e) : iji(h, r, "f64", Zf.get(e)) : vfe.has(e) ? p = rji(h, r, "f64", vfe.get(e)) : Zd.has(e) ? p = Zd.get(e)(h, r, "f64") : (p = h[0], y = !1); + if (y && e !== R_.isNull && !Eg.has(e)) { + const v = nn.createEmptyBand(n, p.length); + r || (r = new Uint8Array(p.length).fill(255)), Oji(p, r, n, v), p = v; + } + a.push(p); + } + const l = t[0]; + return new nn({ width: l.width, height: l.height, pixelType: n, mask: e === R_.isNull ? null : r, pixels: a }); +} +let qV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Local", this.functionArguments = null, this.rasterArgumentNames = ["rasters"]; + } + _bindSourceRasters() { + const { sourceRasterInfos: e } = this, i = e[0], { bandCount: r } = i, { processAsMultiband: n } = this.functionArguments; + if (e.some((h) => h.bandCount !== r)) + return { success: !1, supportsGPU: !1, error: "local-function: input rasters do not have same band count" }; + const { operation: s, rasters: o } = this.functionArguments, a = tQe[s]; + if (!(a === 999 || o.length === a || o.length <= 1 && a === 1)) + return { success: !1, supportsGPU: !1, error: `local-function: the length of functionArguments.rasters does not match operation's requirement: ${a}` }; + this.outputPixelType = this._getOutputPixelType("f32"); + const l = i.clone(); + l.pixelType = this.outputPixelType, l.statistics = null, l.histograms = null, l.colormap = null, l.attributeTable = null, l.bandCount = a !== 999 || n ? r : 1; + const c = WVi(s); + if (c) { + l.statistics = []; + for (let h = 0; h < l.bandCount; h++) + l.statistics[h] = { min: c[0], max: c[1], avg: (c[0] + c[1]) / 2, stddev: (c[0] + c[1]) / 10 }; + } + return this.rasterInfo = l, { success: !0, supportsGPU: l.bandCount === 1 && a <= 3 && (s < 11 || s > 16) }; + } + _processPixels(e) { + const { pixelBlocks: i } = e; + return ut(i) || i.some((r) => ut(r)) ? null : Rji(i, this.functionArguments.operation, { processAsMultiband: this.functionArguments.processAsMultiband, outputPixelType: this.outputPixelType ?? void 0 }); + } + _getWebGLParameters() { + const { operation: e } = this.functionArguments, i = tQe[e], r = Object.keys(ZZe).find((l) => ZZe[l] === e)?.toLowerCase() ?? "undefined", n = this.outputPixelType ?? "f32"; + let [s, o] = $I(n); + const a = n.startsWith("u") || n.startsWith("s"); + return a && (s -= 1e-4, o += 1e-4), { imageCount: i, operationName: r, domainRange: [s, o], isOutputRounded: a }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], qV.prototype, "functionName", void 0), E([N({ type: HVi, json: { write: !0, name: "rasterFunctionArguments" } })], qV.prototype, "functionArguments", void 0), E([N()], qV.prototype, "rasterArgumentNames", void 0), qV = E([dt("esri.layers.support.rasterFunctions.LocalFunction")], qV); +const Mji = qV; +var $Re; +let NN = $Re = class extends zb { + constructor() { + super(...arguments), this.includedRanges = null, this.noDataValues = null, this.noDataInterpretation = rde.matchAny; + } + get normalizedNoDataValues() { + const { noDataValues: t } = this; + if (!t?.length) + return null; + let e = !1; + const i = t.map((r) => { + if (typeof r == "number") + return e = !0, [r]; + if (typeof r == "string") { + const n = r.trim().split(" ").filter((s) => s.trim() !== "").map((s) => Number(s)); + return e = e || n.length > 0, n.length === 0 ? null : n; + } + return null; + }); + return e ? i : null; + } + clone() { + return new $Re({ includedRanges: this.includedRanges?.slice() ?? [], noDataValues: this.noDataValues?.slice() ?? [], noDataInterpretation: this.noDataInterpretation }); + } +}; +E([N({ json: { write: !0 } })], NN.prototype, "includedRanges", void 0), E([N({ json: { write: !0 } })], NN.prototype, "noDataValues", void 0), E([N()], NN.prototype, "normalizedNoDataValues", null), E([N({ json: { write: !0 } })], NN.prototype, "noDataInterpretation", void 0), NN = $Re = E([dt("esri.layers.support.rasterFunctions.MaskFunctionArguments")], NN); +const Dji = NN; +let kN = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Mask", this.functionArguments = null, this.rasterArgumentNames = ["raster"]; + } + _bindSourceRasters() { + const e = this.sourceRasterInfos[0].clone(), { pixelType: i } = e; + this.outputPixelType = this._getOutputPixelType(i), e.pixelType = this.outputPixelType, this.rasterInfo = e; + const { includedRanges: r, normalizedNoDataValues: n } = this.functionArguments; + if (!r?.length && !n?.length) + return { success: !1, supportsGPU: !1, error: "missing includedRanges or noDataValues argument" }; + let s = []; + for (let a = 0; a < e.bandCount; a++) { + const l = DJt(i, r?.slice(2 * a, 2 * a + 2), n?.[a]); + if (l == null) { + s = null; + break; + } + s.push(l); + } + this.lookups = s; + const o = n != null && n.every((a) => a?.length === n[0]?.length); + return { success: !0, supportsGPU: (!r || r.length <= 2 * jD) && (!n || o && n[0].length <= jD) }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const { outputPixelType: r, lookups: n } = this, { includedRanges: s, noDataInterpretation: o, normalizedNoDataValues: a } = this.functionArguments, l = o === rde.matchAll; + return RJt(i, { includedRanges: s, noDataValues: a, outputPixelType: r, matchAll: l, lookups: n }); + } + _getWebGLParameters() { + const { includedRanges: e, normalizedNoDataValues: i } = this.functionArguments, r = new Float32Array(jD); + r.fill(IO), i?.[0]?.length && r.set(i[0]); + const n = new Float32Array(jD); + for (let s = 0; s < n.length; s += 2) + n[s] = e?.[s] ?? -IO, n[s + 1] = e?.[s + 1] ?? IO; + return e && e.length && n.set(e), { bandCount: this.sourceRasterInfos[0].bandCount, noDataValues: r, includedRanges: n }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], kN.prototype, "functionName", void 0), E([N({ type: Dji, json: { write: !0, name: "rasterFunctionArguments" } })], kN.prototype, "functionArguments", void 0), E([N()], kN.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], kN.prototype, "lookups", void 0), kN = E([dt("esri.layers.support.rasterFunctions.MaskFunction")], kN); +const Fji = kN; +var BRe; +let YV = BRe = class extends zb { + constructor() { + super(...arguments), this.visibleBandID = 0, this.infraredBandID = 1, this.scientificOutput = !1; + } + clone() { + const { visibleBandID: t, infraredBandID: e, scientificOutput: i } = this; + return new BRe({ visibleBandID: t, infraredBandID: e, scientificOutput: i }); + } +}; +E([N({ json: { write: !0 } })], YV.prototype, "visibleBandID", void 0), E([N({ json: { write: !0 } })], YV.prototype, "infraredBandID", void 0), E([N({ json: { write: !0 } })], YV.prototype, "scientificOutput", void 0), YV = BRe = E([dt("esri.layers.support.rasterFunctions.NDVIFunctionArguments")], YV); +const Lji = YV; +let XV = class extends Hb { + constructor() { + super(...arguments), this.functionName = "NDVI", this.functionArguments = null, this.rasterArgumentNames = ["raster"]; + } + _bindSourceRasters() { + const { scientificOutput: e } = this.functionArguments; + this.outputPixelType = this._getOutputPixelType(e ? "f32" : "u8"); + const i = this.sourceRasterInfos[0].clone(); + i.pixelType = this.outputPixelType, i.colormap = null, i.histograms = null, i.bandCount = 1; + const [r, n, s, o] = e ? [-1, 1, 0, 0.1] : [0, 200, 100, 10]; + return i.statistics = [{ min: r, max: n, avg: s, stddev: o }], this.rasterInfo = i, { success: !0, supportsGPU: !0 }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const { visibleBandID: r, infraredBandID: n, scientificOutput: s } = this.functionArguments; + return rVi(i, r, n, !s); + } + _getWebGLParameters() { + const { visibleBandID: e, infraredBandID: i, scientificOutput: r } = this.functionArguments, n = this.isInputBandIdsSwizzled ? [0, 1, 2] : [i, e, 0]; + return { bandIndexMat3: Tg(n), scaled: !r }; + } + _getInputBandIds(e) { + const { visibleBandID: i, infraredBandID: r } = this.functionArguments; + return [r, i, 0].map((n) => e[n]); + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], XV.prototype, "functionName", void 0), E([N({ type: Lji, json: { write: !0, name: "rasterFunctionArguments" } })], XV.prototype, "functionArguments", void 0), E([N()], XV.prototype, "rasterArgumentNames", void 0), XV = E([dt("esri.layers.support.rasterFunctions.NDVIFunction")], XV); +const Nji = XV; +var VRe; +let FM = VRe = class extends zb { + constructor() { + super(...arguments), this.inputRanges = null, this.outputValues = null, this.noDataRanges = null, this.allowUnmatched = !1, this.isLastInputRangeInclusive = !1; + } + clone() { + return new VRe({ inputRanges: [...this.inputRanges], outputValues: [...this.outputValues], noDataRanges: [...this.noDataRanges], allowUnmatched: this.allowUnmatched, isLastInputRangeInclusive: this.isLastInputRangeInclusive }); + } +}; +E([N({ json: { write: !0 } })], FM.prototype, "inputRanges", void 0), E([N({ json: { write: !0 } })], FM.prototype, "outputValues", void 0), E([N({ json: { write: !0 } })], FM.prototype, "noDataRanges", void 0), E([N({ json: { write: !0 } })], FM.prototype, "allowUnmatched", void 0), E([N({ json: { write: !0 } })], FM.prototype, "isLastInputRangeInclusive", void 0), FM = VRe = E([dt("esri.layers.support.rasterFunctions.RemapFunctionArguments")], FM); +const kji = FM; +let $N = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Remap", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.lookup = null; + } + _bindSourceRasters() { + const e = this.sourceRasterInfos[0].clone(), { pixelType: i } = e; + this.outputPixelType = this._getOutputPixelType(i), e.pixelType = this.outputPixelType, e.colormap = null, e.histograms = null, e.bandCount = 1, e.attributeTable = null; + const { statistics: r } = e, { allowUnmatched: n, outputValues: s, inputRanges: o, noDataRanges: a, isLastInputRangeInclusive: l } = this.functionArguments; + if (_e(r) && r.length && s?.length) + if (n) { + const c = Math.min.apply(null, [...s, r[0].min]), h = Math.max.apply(null, [...s, r[0].max]); + e.statistics = [{ ...r[0], min: c, max: h }]; + } else { + let c = s[0], h = c; + for (let p = 0; p < s.length; p++) + c = c > s[p] ? s[p] : c, h = h > s[p] ? h : s[p]; + e.statistics = [{ ...r[0], min: c, max: h }]; + } + return this.rasterInfo = e, this.lookup = n ? null : MJt({ srcPixelType: i, inputRanges: o, outputValues: s, noDataRanges: a, allowUnmatched: n, isLastInputRangeInclusive: l, outputPixelType: this.outputPixelType }), { success: !0, supportsGPU: (!s || s.length <= jD) && (!a || a.length <= jD) }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const { lookup: r, outputPixelType: n } = this; + if (r) { + const h = ode(i, { lut: [r.lut], offset: r.offset, outputPixelType: n }); + return _e(h) && r.mask && (h.mask = x5e(i.pixels[0], i.mask, r.mask, r.offset, "u8")), h; + } + const { inputRanges: s, outputValues: o, noDataRanges: a, allowUnmatched: l, isLastInputRangeInclusive: c } = this.functionArguments; + return OJt(i, { inputRanges: s, outputValues: o, noDataRanges: a, outputPixelType: n, allowUnmatched: l, isLastInputRangeInclusive: c }); + } + _getWebGLParameters() { + const { allowUnmatched: e, inputRanges: i, outputValues: r, noDataRanges: n, isLastInputRangeInclusive: s } = this.functionArguments, o = new Float32Array(3 * jD), a = 1e-5, l = r.length; + if (i?.length) { + let h = 0, p = 0; + for (let y = 0; y < o.length; y += 3) + o[y] = i[h++] ?? IO - 1, o[y + 1] = i[h++] ?? IO, o[y + 2] = r[p++] ?? 0, p <= l && (y > 0 && (o[y] -= a), (p < l || !s) && (o[y + 1] -= a)); + } + const c = new Float32Array(2 * jD); + return c.fill(IO), n?.length && c.set(n), { allowUnmatched: e, rangeMaps: o, noDataRanges: c, clampRange: $I(this.outputPixelType) }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], $N.prototype, "functionName", void 0), E([N({ type: kji, json: { write: !0, name: "rasterFunctionArguments" } })], $N.prototype, "functionArguments", void 0), E([N()], $N.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], $N.prototype, "lookup", void 0), $N = E([dt("esri.layers.support.rasterFunctions.RemapFunction")], $N); +const $ji = $N; +var jRe; +const Bji = new zs({ 1: "degree", 2: "percent-rise", 3: "adjusted" }, { useNumericKeys: !0 }); +let LM = jRe = class extends zb { + constructor() { + super(...arguments), this.slopeType = "degree", this.zFactor = 1, this.pixelSizePower = 0.664, this.pixelSizeFactor = 0.024, this.removeEdgeEffect = !1; + } + clone() { + return new jRe({ slopeType: this.slopeType, zFactor: this.zFactor, pixelSizePower: this.pixelSizePower, pixelSizeFactor: this.pixelSizeFactor, removeEdgeEffect: this.removeEdgeEffect, raster: this.raster }); + } +}; +E([Yr(Bji)], LM.prototype, "slopeType", void 0), E([N({ type: Number, json: { write: !0 } })], LM.prototype, "zFactor", void 0), E([N({ type: Number, json: { name: "psPower", write: !0 } })], LM.prototype, "pixelSizePower", void 0), E([N({ type: Number, json: { name: "psZFactor", write: !0 } })], LM.prototype, "pixelSizeFactor", void 0), E([N({ type: Boolean, json: { write: !0 } })], LM.prototype, "removeEdgeEffect", void 0), LM = jRe = E([dt("esri.layers.support.rasterFunctions.SlopeFunctionArguments")], LM); +const Vji = LM, jji = 1 / 111e3; +let BN = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Slope", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.isGCS = !1; + } + _bindSourceRasters() { + this.outputPixelType = this._getOutputPixelType("f32"); + const e = this.sourceRasterInfos[0].clone(); + return e.pixelType = this.outputPixelType, e.statistics = this.functionArguments.slopeType !== "percent-rise" ? [{ min: 0, max: 90, avg: 1, stddev: 1 }] : null, e.histograms = null, e.colormap = null, e.attributeTable = null, e.bandCount = 1, this.rasterInfo = e, this.isGCS = e.spatialReference?.isGeographic ?? !1, { success: !0, supportsGPU: !0 }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return null; + const { zFactor: r, slopeType: n, pixelSizePower: s, pixelSizeFactor: o } = this.functionArguments, { isGCS: a } = this, { extent: l } = e, c = l ? { x: l.width / i.width, y: l.height / i.height } : { x: 1, y: 1 }; + return uei(i, { zFactor: r, slopeType: n, pixelSizePower: s, pixelSizeFactor: o, isGCS: a, resolution: c }); + } + _getWebGLParameters() { + const { zFactor: e, slopeType: i, pixelSizeFactor: r, pixelSizePower: n } = this.functionArguments; + return { zFactor: this.isGCS && e >= 1 ? e * jji : e, slopeType: i, pixelSizeFactor: r ?? 0, pixelSizePower: n ?? 0 }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], BN.prototype, "functionName", void 0), E([N({ type: Vji, json: { write: !0, name: "rasterFunctionArguments" } })], BN.prototype, "functionArguments", void 0), E([N()], BN.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], BN.prototype, "isGCS", void 0), BN = E([dt("esri.layers.support.rasterFunctions.SlopeFunction")], BN); +const Gji = BN; +var GRe; +let VN = GRe = class extends zb { + constructor() { + super(...arguments), this.statistics = null, this.histograms = null; + } + readStatistics(t, e) { + if (!t?.length) + return null; + const i = []; + return t.forEach((r) => { + const n = { min: r.min, max: r.max, avg: r.avg ?? r.mean, stddev: r.stddev ?? r.standardDeviation }; + i.push(n); + }), i; + } + writeStatistics(t, e, i) { + if (!t?.length) + return; + const r = []; + t.forEach((n) => { + const s = { ...n, mean: n.avg, standardDeviation: n.stddev }; + delete s.avg, delete s.stddev, r.push(s); + }), e[i] = r; + } + clone() { + return new GRe({ statistics: fi(this.statistics), histograms: fi(this.histograms) }); + } +}; +E([N({ json: { write: !0 } })], VN.prototype, "statistics", void 0), E([Li("statistics")], VN.prototype, "readStatistics", null), E([mr("statistics")], VN.prototype, "writeStatistics", null), E([N({ json: { write: !0 } })], VN.prototype, "histograms", void 0), VN = GRe = E([dt("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")], VN); +const Uji = VN; +let NM = class extends Hb { + constructor() { + super(...arguments), this.functionName = "StatisticsHistogram", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.isNoopProcess = !0; + } + _bindSourceRasters() { + const e = this.sourceRasterInfos[0]; + this.outputPixelType = this._getOutputPixelType("u8"); + const i = e.clone(), { statistics: r, histograms: n } = this.functionArguments; + return n && (i.histograms = n), r && (i.statistics = r), this.rasterInfo = i, { success: !0, supportsGPU: !0 }; + } + _processPixels(e) { + return e.pixelBlocks?.[0]; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], NM.prototype, "functionName", void 0), E([N({ type: Uji, json: { write: !0, name: "rasterFunctionArguments" } })], NM.prototype, "functionArguments", void 0), E([N()], NM.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], NM.prototype, "indexedColormap", void 0), E([N()], NM.prototype, "isNoopProcess", void 0), NM = E([dt("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")], NM); +const zji = NM; +var URe; +const Hji = new zs({ 0: "none", 3: "standard-deviation", 4: "histogram-equalization", 5: "min-max", 6: "percent-clip", 9: "sigmoid" }, { useNumericKeys: !0 }); +let iy = URe = class extends zb { + constructor() { + super(...arguments), this.computeGamma = !1, this.dynamicRangeAdjustment = !1, this.gamma = [], this.histograms = null, this.statistics = null, this.stretchType = "none", this.useGamma = !1; + } + writeStatistics(t, e, i) { + t?.length && (Array.isArray(t[0]) || (t = t.map((r) => [r.min, r.max, r.avg, r.stddev])), e[i] = t); + } + clone() { + return new URe({ stretchType: this.stretchType, outputMin: this.outputMin, outputMax: this.outputMax, useGamma: this.useGamma, computeGamma: this.computeGamma, statistics: fi(this.statistics), gamma: fi(this.gamma), sigmoidStrengthLevel: this.sigmoidStrengthLevel, numberOfStandardDeviations: this.numberOfStandardDeviations, minPercent: this.minPercent, maxPercent: this.maxPercent, histograms: fi(this.histograms), dynamicRangeAdjustment: this.dynamicRangeAdjustment, raster: this.raster }); + } +}; +E([N({ type: Boolean, json: { write: !0 } })], iy.prototype, "computeGamma", void 0), E([N({ type: Boolean, json: { name: "dra", write: !0 } })], iy.prototype, "dynamicRangeAdjustment", void 0), E([N({ type: [Number], json: { write: !0 } })], iy.prototype, "gamma", void 0), E([N()], iy.prototype, "histograms", void 0), E([N({ type: Number, json: { write: !0 } })], iy.prototype, "maxPercent", void 0), E([N({ type: Number, json: { write: !0 } })], iy.prototype, "minPercent", void 0), E([N({ type: Number, json: { write: !0 } })], iy.prototype, "numberOfStandardDeviations", void 0), E([N({ type: Number, json: { name: "max", write: !0 } })], iy.prototype, "outputMax", void 0), E([N({ type: Number, json: { name: "min", write: !0 } })], iy.prototype, "outputMin", void 0), E([N({ type: Number, json: { write: !0 } })], iy.prototype, "sigmoidStrengthLevel", void 0), E([N({ json: { type: [[Number]], write: !0 } })], iy.prototype, "statistics", void 0), E([mr("statistics")], iy.prototype, "writeStatistics", null), E([Yr(Hji)], iy.prototype, "stretchType", void 0), E([N({ type: Boolean, json: { write: !0 } })], iy.prototype, "useGamma", void 0), iy = URe = E([dt("esri.layers.support.rasterFunctions.StretchFunctionArguments")], iy); +const Wji = iy; +let kM = class extends Hb { + constructor() { + super(...arguments), this.functionName = "Stretch", this.functionArguments = null, this.rasterArgumentNames = ["raster"], this.lookup = null, this.cutOffs = null; + } + _bindSourceRasters() { + this.lookup = null, this.cutOffs = null; + const e = this.sourceRasterInfos[0], { pixelType: i } = e, { functionArguments: r } = this, { dynamicRangeAdjustment: n, gamma: s, useGamma: o } = r; + if (!n && ["u8", "u16", "s8", "s16"].includes(i)) { + const l = SD(r.toJSON(), { rasterInfo: e }), c = this._isOutputRoundingNeeded() ? "round" : "float"; + this.lookup = mAe({ pixelType: i, ...l, gamma: o ? s : null, rounding: c }), this.cutOffs = l; + } else + n || (this.cutOffs = SD(r.toJSON(), { rasterInfo: e })); + this.outputPixelType = this._getOutputPixelType(i); + const a = e.clone(); + return a.pixelType = this.outputPixelType, a.statistics = null, a.histograms = null, a.colormap = null, a.attributeTable = null, this.outputPixelType === "u8" && (a.keyProperties.DataType = "processed"), this.rasterInfo = a, { success: !0, supportsGPU: !n }; + } + _processPixels(e) { + const i = e.pixelBlocks?.[0]; + if (ut(i)) + return i; + const { lookup: r } = this; + if (r) + return ode(i, { ...r, outputPixelType: this.rasterInfo.pixelType }); + const { functionArguments: n } = this, s = this.cutOffs || SD(n.toJSON(), { rasterInfo: this.sourceRasterInfos[0], pixelBlock: i }), o = n.useGamma ? n.gamma : null; + return Zle(i, { ...s, gamma: o, outputPixelType: this.outputPixelType }); + } + _getWebGLParameters() { + const { outputMin: e = 0, outputMax: i = 255, gamma: r, useGamma: n } = this.functionArguments, s = this.rasterInfo.bandCount >= 2 ? 3 : 1, o = n && r && r.length ? L5e(s, r) : [1, 1, 1], { minCutOff: a, maxCutOff: l } = this.cutOffs ?? { minCutOff: [0, 0, 0], maxCutOff: [255, 255, 255] }; + a.length === 1 && (a[1] = a[2] = a[0], l[1] = l[2] = l[0]); + const c = new Float32Array(s); + let h; + for (h = 0; h < s; h++) + c[h] = (i - e) / (l[h] - a[h]); + const p = this._isOutputRoundingNeeded(); + return { bandCount: s, outMin: e, outMax: i, minCutOff: a, maxCutOff: l, factor: c, useGamma: n, gamma: n && r ? r : [1, 1, 1], gammaCorrection: n && o ? o : [1, 1, 1], stretchType: this.functionArguments.stretchType, isOutputRounded: p, type: "stretch" }; + } +}; +E([N({ json: { write: !0, name: "rasterFunction" } })], kM.prototype, "functionName", void 0), E([N({ type: Wji, json: { write: !0, name: "rasterFunctionArguments" } })], kM.prototype, "functionArguments", void 0), E([N()], kM.prototype, "rasterArgumentNames", void 0), E([N({ json: { write: !0 } })], kM.prototype, "lookup", void 0), E([N({ json: { write: !0 } })], kM.prototype, "cutOffs", void 0), kM = E([dt("esri.layers.support.rasterFunctions.StretchFunction")], kM); +const qji = kM, fv = /* @__PURE__ */ new Map(); +function CPt(t, e) { + const { rasterFunctionArguments: i } = t; + i && (i.rasters || [i.raster]).forEach((r) => { + r && typeof r != "number" && (typeof r == "string" ? r.startsWith("http") && (e.includes(r) || e.push(r)) : "rasterFunctionArguments" in r && CPt(r, e)); + }); +} +function _fe(t, e) { + if (e = e ?? {}, "function" in (t = fi(t)) && "arguments" in t && t.arguments && (t = Xji(t, e)), "rasterFunction" in t) + return TPt(t = zRe(t), e); + throw new ot("raster-function-helper", "unsupported raster function json."); +} +function Yji(t, e) { + return e[0] === "rasters" && Array.isArray(t.rasters) ? t.rasters : e.map((i) => t[i]); +} +function fQe(t) { + return !!(t && typeof t == "object" && t.rasterFunction && t.rasterFunctionArguments); +} +function zRe(t) { + const { rasterFunction: e, rasterFunctionArguments: i } = t, r = {}; + for (const n in i) { + let s = i[n]; + const o = n.toLowerCase(); + if (o === "rasters" && Array.isArray(s)) + r.rasters = s.map((a) => fQe(a) ? zRe(a) : a); + else + switch (fQe(s) && (s = zRe(s)), o) { + case "dra": + r.dra = s; + break; + case "pspower": + r.psPower = s; + break; + case "pszfactor": + r.psZFactor = s; + break; + case "bandids": + r.bandIds = s; + break; + default: + r[n[0].toLowerCase() + n.slice(1)] = s; + } + } + return e !== "Local" || r.rasters?.length || (r.rasters = ["$$"]), { ...t, rasterFunctionArguments: r }; +} +function TPt(t, e) { + const { rasterFunction: i, rasterFunctionArguments: r } = t, n = t.outputPixelType?.toLowerCase(); + if (i == null || !fv.has(i)) + throw new ot("raster-function-helper", `unsupported raster function: ${i}`); + const s = fv.get(i), o = (typeof s.ctor == "function" ? s.ctor : s.ctor.default).fromJSON({ ...t, outputPixelType: n }), { rasterArgumentNames: a } = o, l = [], c = Yji(r, a), h = a[0] === "rasters", p = []; + for (let y = 0; y < c.length; y++) { + const v = c[y]; + let x; + v == null || typeof v == "string" && v.startsWith("$") ? l.push(e?.raster) : typeof v == "string" ? e[v] && l.push(e[v]) : typeof v != "number" && "rasterFunction" in v && (x = TPt(v, e), h || (o.functionArguments[a[y]] = x), l.push(x)), h && p.push(x ?? v); + } + if (h && (o.functionArguments.rasters = p), e) { + o.sourceRasters = l; + const y = e.raster?.url; + y && (o.mainPrimaryRasterId = y); + } + return o; +} +function EPt(t, e) { + if (t && e) + for (const i in t) { + const r = t[i]; + r && typeof r == "object" && (r.function && r.arguments ? EPt(r.arguments, e) : r.type === "RasterFunctionVariable" && e[r.name] != null && (r.value = e[r.name])); + } +} +function HRe(t) { + if (!t || typeof t != "object") + return t; + if (Array.isArray(t) && t.length === 0) + return t.length === 0 ? null : ["number", "string"].includes(typeof t[0]) ? t : t.map((e) => HRe(e)); + if ("value" in t && ["number", "string", "boolean"].includes(typeof t.value)) + return t.value; + if (!("type" in t)) + return t; + switch (t.type) { + case "Scalar": + return t.value; + case "AlgorithmicColorRamp": + return mQe(t); + case "MultiPartColorRamp": + return { type: "multipart", colorRamps: t.ArrayOfColorRamp.map(mQe) }; + case "ArgumentArray": + return t.elements?.length ? t.elements[0].type === "RasterStatistics" ? t.elements : t.elements[0].type === "RasterFunctionVariable" ? t.elements.map((e) => e.value != null ? HRe(e.value) : e.name.toLowerCase().includes("raster") ? "$$" : null) : t : t.elements; + default: + return t; + } +} +function mQe(t) { + const e = t.algorithm ?? "esriHSVAlgorithm"; + let { FromColor: i, ToColor: r } = t; + if (!Array.isArray(i)) { + const { r: n, g: s, b: o } = kF({ h: i.Hue, s: i.Saturation, v: i.Value }); + i = [n, s, o, i.AlphaValue]; + } + if (!Array.isArray(r)) { + const { r: n, g: s, b: o } = kF({ h: r.Hue, s: r.Saturation, v: r.Value }); + r = [n, s, o, r.AlphaValue]; + } + return { type: "algorithmic", algorithm: e, fromColor: i, toColor: r }; +} +function Xji(t, e) { + e && EPt(t, e); + const i = {}; + return IPt(t, i), i; +} +function IPt(t, e) { + if (!t || !e) + return; + const { function: i, arguments: r } = t; + if (!i || !r) + return; + e.rasterFunction = i.type.replace("Function", ""), e.outputPixelType = i.pixelType; + const n = {}; + e.rasterFunctionArguments = n; + for (const s in r) { + const o = r[s]; + typeof o == "object" && ("function" in o && o.function && o.arguments ? (e.rasterFunctionArguments[s] = {}, IPt(o, e.rasterFunctionArguments[s])) : "value" in o && (n[s] = HRe(o.value))); + } + switch (n.DEM && !n.Raster && (n.Raster = n.DEM, delete n.DEM), e.rasterFunction) { + case "Stretch": + Kji(n); + break; + case "Colormap": + Jji(n); + break; + case "Convolution": + Zji(n); + break; + case "Mask": + Qji(n); + } +} +function Kji(t) { + t.Statistics?.length && typeof t.Statistics == "object" && (t.Statistics = t.Statistics.map((e) => [e.min, e.max, e.mean, e.standardDeviation])), t.NumberOfStandardDeviation != null && (t.NumberOfStandardDeviations = t.NumberOfStandardDeviation, delete t.NumberOfStandardDeviation); +} +function Jji(t) { + t.ColorRamp?.type?.toLowerCase() === "randomcolorramp" && (delete t.ColorRamp, t.ColormapName = "Random"), t.ColorSchemeType === 0 && delete t.ColorRamp; +} +function Zji(t) { + t.ConvolutionType != null && (t.Type = t.ConvolutionType, delete t.ConvolutionType); +} +function Qji(t) { + t.NoDataValues?.length && typeof t.NoDataValues[0] == "string" && (t.NoDataValues = t.NoDataValues.filter((e) => e !== "").map((e) => Number(e))); +} +fv.set("Aspect", { desc: "Aspect Function", ctor: YBi, rasterArgumentNames: ["raster"] }), fv.set("BandArithmetic", { desc: "Band Arithmetic Function", ctor: wVi, rasterArgumentNames: ["raster"] }), fv.set("Colormap", { desc: "Colormap Function", ctor: RVi, rasterArgumentNames: ["raster"] }), fv.set("CompositeBand", { desc: "CompositeBand Function", ctor: DVi, rasterArgumentNames: ["rasters"] }), fv.set("Convolution", { desc: "Convolution Function", ctor: GVi, rasterArgumentNames: ["raster"] }), fv.set("ExtractBand", { desc: "ExtractBand Function", ctor: zVi, rasterArgumentNames: ["raster"] }), fv.set("Local", { desc: "Local Function", ctor: Mji, rasterArgumentNames: ["rasters"] }), fv.set("Mask", { desc: "Mask Function", ctor: Fji, rasterArgumentNames: ["raster"] }), fv.set("NDVI", { desc: "NDVI Function", ctor: Nji, rasterArgumentNames: ["raster"] }), fv.set("Remap", { desc: "Remap Function", ctor: $ji, rasterArgumentNames: ["raster"] }), fv.set("Slope", { desc: "Slope Function", ctor: Gji, rasterArgumentNames: ["raster"] }), fv.set("StatisticsHistogram", { desc: "Statistics Histogram Function", ctor: zji, rasterArgumentNames: ["raster"] }), fv.set("Stretch", { desc: "Stretch Function", ctor: qji, rasterArgumentNames: ["raster"] }); +var WRe; +function j8e(t, e, i) { + return !f1(t, e, i); +} +function rH(t, e, i) { + const r = j8e(t, e, i); + if (r && !Tx()) + throw new ot("rasterprojectionhelper-project", "projection engine is not loaded"); + return r; +} +(function(t) { + t[t.None = 0] = "None", t[t.North = 1] = "North", t[t.South = 2] = "South", t[t.Both = 3] = "Both"; +})(WRe || (WRe = {})); +const gQe = (t, e, i, r = 0) => { + if (i[0] === 1) + return [0, 0]; + let n = 1, s = -1, o = 1, a = -1; + for (let P = 0; P < t.length; P += 2) + isNaN(t[P]) || (n = n > t[P] ? t[P] : n, s = s > t[P] ? s : t[P], o = o > t[P + 1] ? t[P + 1] : o, a = a > t[P + 1] ? a : t[P + 1]); + const { cols: l, rows: c } = e, h = (s - n) / l / i[0], p = (a - o) / c / i[1], y = 2 * r; + let v = 0, x = !1, I = [0, 0]; + for (let P = 0; P < l - 3; P++) { + for (let F = 0; F < c - 3; F++) { + const k = P * c * 2 + 2 * F, V = (t[k] + t[k + 4] + t[k + 4 * c] + t[k + 4 * c + 4]) / 4, j = (t[k + 1] + t[k + 5] + t[k + 4 * c + 1] + t[k + 4 * c + 5]) / 4, Y = Math.abs((V - t[k + 2 * c + 2]) / h), X = Math.abs((j - t[k + 2 * c + 3]) / p); + if (Y + X > v && (v = Y + X, I = [Y, X]), y && v > y) { + x = !0; + break; + } + } + if (x) + break; + } + return I; +}, eGi = { 3395: 20037508342789244e-9, 3410: 17334193943686873e-9, 3857: 20037508342788905e-9, 3975: 17367530445161372e-9, 4087: 20037508342789244e-9, 4088: 20015108787169147e-9, 6933: 17367530445161372e-9, 32662: 20037508342789244e-9, 53001: 2001508679602057e-8, 53002: 1000754339801029e-8, 53003: 2001508679602057e-8, 53004: 2001508679602057e-8, 53016: 14152803599503474e-9, 53017: 17333573624304302e-9, 53034: 2001508679602057e-8, 53079: 20015114352186374e-9, 53080: 20015114352186374e-9, 54001: 20037508342789244e-9, 54002: 10018754171394624e-9, 54003: 20037508342789244e-9, 54004: 20037508342789244e-9, 54016: 14168658027268292e-9, 54017: 1736753044516137e-8, 54034: 20037508342789244e-9, 54079: 20037508342789244e-9, 54080: 20037508342789244e-9, 54100: 20037508342789244e-9, 54101: 20037508342789244e-9 }, bfe = 32, wfe = 4, vxe = wfe, _xe = /* @__PURE__ */ new Map(), bxe = /* @__PURE__ */ new Map(), xfe = 500; +async function qRe() { + Tx() || await qS(); +} +function yQe(t, e, i) { + return rH(t.spatialReference, e) ? i ? BIe(e, t.spatialReference, t) : BIe(t.spatialReference, e, t) : null; +} +function cee(t, e, i, r = null) { + const n = t.spatialReference; + if (n.equals(e)) + return t; + rH(n, e, r); + const s = i.center, o = new br({ xmin: s.x - t.x / 2, xmax: s.x + t.x / 2, ymin: s.y - t.y / 2, ymax: s.y + t.y / 2, spatialReference: n }), a = Ip(o, e, r), l = Av(e); + let c; + if (ut(a) || _e(l) && a.width >= l) { + const h = th(n) / th(e); + c = { x: t.x * h, y: t.y * h }; + } else + c = { x: a.width, y: a.height }; + return c; +} +function ux(t, e = 0.01) { + return th(t) ? e / th(t) : 0; +} +function Sfe(t, e, i = null, r = !0) { + const n = t.spatialReference; + if (n.equals(e)) + return t; + rH(n, e, i); + const s = Ip(t, e, i); + return r && s && APt([t], [s], n, e), s; +} +function APt(t, e, i, r) { + const n = Cfe(i, !0), s = Cfe(r, !0), o = ux(i, xfe), a = ux(r, xfe); + if (o && _e(n) && _e(s)) + for (let l = 0; l < t.length; l++) { + const c = e[l]; + if (!c) + continue; + const { x: h } = t[l], { x: p } = c; + p >= s[1] - a && Math.abs(h - n[0]) < o ? c.x -= s[1] - s[0] : p <= s[0] + a && Math.abs(h - n[1]) < o && (c.x += s[1] - s[0]); + } +} +function tGi(t) { + const { inSR: e, outSR: i, datumTransformation: r, preferPE: n } = t; + if (e.equals(i)) { + const { points: s } = G8e(t, null); + return s; + } + if (e.isWebMercator && i.isWGS84 || e.isWGS84 && i.isWebMercator) + return rGi(t); + if (rH(e, i, r) && n) { + if (e.isGeographic) + return vQe(t); + const s = G$(e); + if (_e(s)) + return vQe(t); + } + return iGi(t); +} +function iGi(t) { + const { points: e } = G8e(t, null), { inSR: i, outSR: r, datumTransformation: n } = t, s = e.map((a) => new Xi(a[0], a[1], i)), o = Ip(s, r, n); + return n && APt(s, o, i, r), o.map((a) => a ? [a.x, a.y] : [NaN, NaN]); +} +function vQe(t) { + const { inSR: e, outSR: i, datumTransformation: r } = t, n = G$(e), { points: s, mask: o } = G8e(t, n); + if (!e.isGeographic) { + const l = e.wkid ? gb.coordsys(e.wkid) : gb.fromString(e.isGeographic ? Ou.PE_TYPE_GEOGCS : Ou.PE_TYPE_PROJCS, e.wkt); + iQ.projToGeog(l, s.length, s); + } + if (_e(r) && r.steps.length) { + let l; + if (i.isGeographic && (l = s.map(([h]) => h > 179.9955 ? 1 : h < -179.9955 ? -1 : 0)), r.steps.forEach((h) => { + const p = h.wkid ? gb.geogtran(h.wkid) : gb.fromString(Ou.PE_TYPE_GEOGTRAN, h.wkt); + Xhe.geogToGeog(p, s.length, s, null, h.isInverse ? Ou.PE_TRANSFORM_2_TO_1 : Ou.PE_TRANSFORM_1_TO_2); + }), l) + for (let h = 0; h < s.length; h++) { + const p = l[h], y = s[h][0], v = y > 179.9955 ? 1 : y < -179.9955 ? -1 : 0; + p && v && p !== v && (s[h][0] = p > 0 ? y + 360 : y - 360); + } + } + if (!i.isGeographic) { + const l = G$(i, !0), c = _e(l) && l.isEnvelope ? [l.bbox[1], l.bbox[3]] : [-90, 90]; + nGi(s, c); + const h = i.wkid ? gb.coordsys(i.wkid) : gb.fromString(i.isGeographic ? Ou.PE_TYPE_GEOGCS : Ou.PE_TYPE_PROJCS, i.wkt); + iQ.geogToProj(h, s.length, s); + } + let a = s; + if (o && s.length !== o.length) { + a = []; + for (let l = 0, c = 0; l < o.length; l++) + o[l] ? a.push(s[c++]) : a.push([NaN, NaN]); + } + return a; +} +function rGi(t) { + const { cols: e, rows: i, xres: r, yres: n, usePixelCenter: s, inSR: o, outSR: a } = t; + let { xmin: l, ymax: c } = t; + s && (l += r / 2, c -= n / 2); + const h = [], p = [], y = Math.max(e, i); + for (let x = 0; x < y; x++) { + const I = l + r * Math.min(e, x), P = c - n * Math.min(i, x), F = Ip(new Xi({ x: I, y: P, spatialReference: o }), a); + x <= e && h.push(F.x), x <= i && p.push(F.y); + } + const v = []; + for (let x = 0; x < e; x++) + for (let I = 0; I < i; I++) + v.push([h[x], p[I]]); + return v; +} +function G$(t, e = !1) { + let i = t.wkid || t.wkt; + if (!i || t.isGeographic) + return null; + if (i = String(i), _xe.has(i)) { + const o = _xe.get(i); + return e ? o?.gcs : o?.pcs; + } + const r = t.wkid ? gb.coordsys(t.wkid) : gb.fromString(t.isGeographic ? Ou.PE_TYPE_GEOGCS : Ou.PE_TYPE_PROJCS, t.wkt), n = _Qe(r, ux(t, 1e-4)), s = _Qe(r, 0, !0); + return _xe.set(i, { pcs: n, gcs: s }), e ? s : n; +} +function _Qe(t, e = 0, i = !1) { + const r = rQ.generate(t), n = i ? t.horizonGcsGenerate() : t.horizonPcsGenerate(); + if (!r || !n?.length) + return null; + let s = !1, o = n.find((P) => P.getInclusive() === 1 && P.getKind() === 1); + if (!o) { + if (o = n.find((P) => P.getInclusive() === 1 && P.getKind() === 0), !o) + return null; + s = !0; + } + const a = i ? 0 : (r.getNorthPoleLocation() === 2 ? 1 : 0) | (r.getSouthPoleLocation() === 2 ? 2 : 0), l = r.isPannableRectangle(), c = o.getCoord(); + if (s) + return { isEnvelope: s, isPannable: l, vertices: c, coef: null, bbox: [c[0][0] - e, c[0][1] - e, c[1][0] + e, c[1][1] + e], poleLocation: a }; + let h = 0; + const p = []; + let [y, v] = c[0], [x, I] = c[0]; + for (let P = 0, F = c.length; P < F; P++) { + h++, h === F && (h = 0); + const [k, V] = c[P], [j, Y] = c[h]; + if (Y === V) + p.push([k, j, V, Y, 2]); + else { + const X = (j - k) / (Y - V || 1e-4), Q = k - X * V; + V < Y ? p.push([X, Q, V, Y, 0]) : p.push([X, Q, Y, V, 1]); + } + y = y < k ? y : k, v = v < V ? v : V, x = x > k ? x : k, I = I > V ? I : V; + } + return { isEnvelope: !1, isPannable: l, vertices: c, coef: p, bbox: [y, v, x, I], poleLocation: a }; +} +function G8e(t, e) { + const i = [], { cols: r, rows: n, xres: s, yres: o, usePixelCenter: a } = t; + let { xmin: l, ymax: c } = t; + if (a && (l += s / 2, c -= o / 2), ut(e)) { + for (let v = 0; v < r; v++) + for (let x = 0; x < n; x++) + i.push([l + s * v, c - o * x]); + return { points: i }; + } + const h = new Uint8Array(r * n); + if (e.isEnvelope) { + const { bbox: [v, x, I, P] } = e; + for (let F = 0, k = 0; F < r; F++) { + const V = l + s * F, j = e.isPannable || V >= v && V <= I; + for (let Y = 0; Y < n; Y++, k++) { + const X = c - o * Y; + j && X >= x && X <= P && (i.push([V, X]), h[k] = 1); + } + } + return { points: i, mask: h }; + } + const p = e.coef, y = []; + for (let v = 0; v < n; v++) { + const x = c - o * v, I = [], P = []; + for (let k = 0; k < p.length; k++) { + const [V, j, Y, X, Q] = p[k]; + if (x === Y && Y === X) + I.push(V), I.push(j), P.push(2), P.push(2); + else if (x >= Y && x <= X) { + const re = V * x + j; + I.push(re), P.push(Q); + } + } + let F = I; + if (I.length > 2) { + let k = P[0] === 2 ? 0 : P[0], V = I[0]; + F = []; + for (let j = 1; j < P.length; j++) + P[j] === 2 && j !== P.length - 1 || (P[j] !== k && (F.push(k === 0 ? Math.min(V, I[j - 1]) : Math.max(V, I[j - 1])), k = P[j], V = I[j]), j === P.length - 1 && F.push(P[j] === 0 ? Math.min(V, I[j]) : Math.max(V, I[j]))); + F.sort((j, Y) => j - Y); + } else + I[0] > I[1] && (F = [I[1], I[0]]); + y.push(F); + } + for (let v = 0, x = 0; v < r; v++) { + const I = l + s * v; + for (let P = 0; P < n; P++, x++) { + const F = c - o * P, k = y[P]; + if (k.length === 2) + I >= k[0] && I <= k[1] && (i.push([I, F]), h[x] = 1); + else if (k.length > 2) { + let V = !1; + for (let j = 0; j < k.length; j += 2) + if (I >= k[j] && I <= k[j + 1]) { + V = !0; + break; + } + V && (i.push([I, F]), h[x] = 1); + } + } + } + return { points: i, mask: h }; +} +function nGi(t, e) { + const [i, r] = e; + for (let n = 0; n < t.length; n++) { + const s = t[n][1]; + (s < i || s > r) && (t[n] = [NaN, NaN]); + } +} +function PPt(t) { + const e = Av(t[0].spatialReference); + if (t.length < 2 || ut(e)) + return t[0]; + let { xmin: i, xmax: r, ymin: n, ymax: s } = t[0]; + for (let o = 1; o < t.length; o++) { + const a = t[o]; + r = a.xmax + e * o, n = Math.min(n, a.ymin), s = Math.max(s, a.ymax); + } + return new br({ xmin: i, xmax: r, ymin: n, ymax: s, spatialReference: t[0].spatialReference }); +} +function vF(t, e, i = null, r = !0) { + const n = t.spatialReference; + if (n.equals(e)) + return t; + const s = lce(t), o = Av(n, !0), a = Av(e); + if (s === 0 || ut(o) || ut(a)) { + const c = bQe(t, e, i, r); + if (ut(o) && _e(a) && Math.abs(c.width - a) < ux(e) && Tx()) { + const h = G$(n); + if (_e(h) && h.poleLocation === WRe.None && t.width < (h.bbox[2] - h.bbox[0]) / 2) + return sGi(t, e) || c; + } + return c; + } + const l = t.clone().normalize(); + if (l.length === 1 && t.xmax < o && t.xmax - o / 2 > ux(n)) { + const { xmin: c, xmax: h } = t; + for (let p = 0; p <= s; p++) { + const y = p === 0 ? c : -o / 2, v = p === s ? h - o * p : o / 2; + l[p] = new br({ xmin: y, xmax: v, ymin: t.ymin, ymax: t.ymax, spatialReference: n }); + } + } + return PPt(l.map((c) => bQe(c, e, i, r)).filter(_e)); +} +function sGi(t, e) { + const i = Av(e); + if (ut(i)) + return null; + let { xmin: r, ymin: n, xmax: s, ymax: o } = t; + const a = t.spatialReference, l = new xo({ spatialReference: a, rings: [[[r, n], [s, n], [s, o], [r, o], [r, n]]] }), c = Ip(l, e); + if (c.rings.length !== 2 || !c.rings[0].length || !c.rings[1].length) + return null; + const { rings: h } = c, p = ux(a), y = new br({ spatialReference: e }); + for (let v = 0; v < 2; v++) { + r = s = h[v][0][0], n = o = h[v][0][1]; + for (let x = 0; x < h[v].length; x++) + r = r > h[v][x][0] ? h[v][x][0] : r, s = s < h[v][x][0] ? h[v][x][0] : s, n = n > h[v][x][1] ? h[v][x][1] : n, o = o < h[v][x][1] ? h[v][x][1] : o; + if (v === 0) + y.ymin = n, y.ymax = o, y.xmin = r, y.xmax = s; + else if (y.ymin = Math.min(y.ymin, n), y.ymax = Math.max(y.ymax, o), Math.abs(s - i / 2) < p) + y.xmin = r, y.xmax = y.xmax + i; + else { + if (!(Math.abs(r + i / 2) < p)) + return null; + y.xmax = s + i; + } + } + return y; +} +function bQe(t, e, i = null, r = !0, n = !0) { + const s = t.spatialReference; + if (s.equals(e) || !e) + return t; + rH(s, e, i); + const o = Ip(t, e, i); + if (n && e.isWebMercator && o && (o.ymax = Math.min(20037508342787e-6, o.ymax), o.ymin = Math.max(-20037508342787e-6, o.ymin), o.ymin >= o.ymax)) + return null; + if (!r || !o) + return o; + const a = Cfe(s, !0), l = Cfe(e, !0); + if (ut(a) || ut(l)) + return o; + const c = ux(s, 1e-3), h = ux(s, xfe), p = ux(e, 1e-3); + if (Math.abs(o.xmin - l[0]) < p && Math.abs(o.xmax - l[1]) < p) { + const y = Math.abs(t.xmin - a[0]), v = Math.abs(a[1] - t.xmax); + if (y < c && v > h) { + o.xmin = l[0]; + const x = []; + x.push(new Xi(t.xmax, t.ymin, s)), x.push(new Xi(t.xmax, (t.ymin + t.ymax) / 2, s)), x.push(new Xi(t.xmax, t.ymax, s)); + const I = x.map((P) => Sfe(P, e, i)).filter((P) => !isNaN(P?.x)).map((P) => P.x); + o.xmax = Math.max.apply(null, I); + } + if (v < c && y > h) { + o.xmax = l[1]; + const x = []; + x.push(new Xi(t.xmin, t.ymin, s)), x.push(new Xi(t.xmin, (t.ymin + t.ymax) / 2, s)), x.push(new Xi(t.xmin, t.ymax, s)); + const I = x.map((P) => Sfe(P, e, i)).filter((P) => !isNaN(P?.x)).map((P) => P.x); + o.xmin = Math.min.apply(null, I); + } + } else { + const y = ux(e, 1e-3); + Math.abs(o.xmin - l[0]) < y && (o.xmin = l[0]), Math.abs(o.xmax - l[1]) < y && (o.xmax = l[1]); + } + return o; +} +function Av(t, e = !1) { + if (!t) + return null; + const i = e ? 20037508342787e-6 : 20037508342788905e-9; + return t.isWebMercator ? 2 * i : t.wkid && t.isGeographic ? 360 : 2 * eGi[t.wkid] || null; +} +function Cfe(t, e = !1) { + if (t.isGeographic) + return [-180, 180]; + const i = Av(t, e); + return _e(i) ? [-i / 2, i / 2] : null; +} +function wQe(t, e, i, r) { + let n = (t - e) / i; + return n - Math.floor(n) != 0 ? n = Math.floor(n) : r && (n -= 1), n; +} +function lce(t, e = !1) { + const i = Av(t.spatialReference); + if (ut(i)) + return 0; + const r = e ? 0 : -(i / 2), n = ux(t.spatialReference), s = !e && Math.abs(t.xmax - i / 2) < n ? i / 2 : t.xmax, o = !e && Math.abs(t.xmin + i / 2) < n ? -i / 2 : t.xmin; + return wQe(s, r, i, !0) - wQe(o, r, i, !1); +} +function oGi(t) { + const e = t.storageInfo.origin.x, i = Av(t.spatialReference, !0); + if (ut(i)) + return { originX: e, halfWorldWidth: null, pyramidsInfo: null }; + const r = i / 2, { nativePixelSize: n, storageInfo: s, extent: o } = t, { maximumPyramidLevel: a, blockWidth: l, pyramidScalingFactor: c } = s; + let h = n.x; + const p = [], y = _e(t.transform) && t.transform.type === "gcs-shift", v = e + (y ? 0 : r), x = y ? i - e : r - e; + for (let I = 0; I <= a; I++) { + const P = (o.xmax - e) / h / l, F = P - Math.floor(P) == 0 ? P : Math.ceil(P), k = x / h / l, V = k - Math.floor(k) == 0 ? k : Math.ceil(k), j = Math.floor(v / h / l), Y = Math.round(v / h) % l, X = (l - Math.round(x / h) % l) % l; + p.push({ resolutionX: h, blockWidth: l, datsetColumnCount: F, worldColumnCountFromOrigin: V, leftMargin: Y, rightPadding: X, originColumnOffset: j }), h *= c; + } + return { originX: e, halfWorldWidth: r, pyramidsInfo: p, hasGCSSShiftTransform: y }; +} +function aGi(t) { + if (!t || t.isGeographic) + return t; + const e = String(t.wkid || t.wkt); + let i; + return bxe.has(e) ? i = bxe.get(e) : (i = (t.wkid ? gb.coordsys(t.wkid) : gb.fromString(Ou.PE_TYPE_PROJCS, t.wkt)).getGeogcs().getCode(), bxe.set(e, i)), new or({ wkid: i }); +} +function U8e(t) { + const e = t.isAdaptive && t.spacing == null; + let i = t.spacing || [bfe, bfe], r = wxe(t), n = { cols: r.size[0] + 1, rows: r.size[1] + 1 }; + const s = r.outofBoundPointCount > 0 && r.outofBoundPointCount < r.offsets.length / 2; + let o = r.outofBoundPointCount === r.offsets.length / 2 || e && s ? [0, 0] : gQe(r.offsets, n, i, vxe); + const a = (o[0] + o[1]) / 2, l = t.projectedExtent.spatialReference, c = t.srcBufferExtent.spatialReference; + if (e && (s || a > vxe) && (j8e(l, c, t.datumTransformation) && (l.isGeographic || _e(G$(l))), i = [wfe, wfe], r = wxe({ ...t, spacing: i }), n = { cols: r.size[0] + 1, rows: r.size[1] + 1 }, o = gQe(r.offsets, n, i, vxe)), r.error = o, i[0] > 1 && (r.coefficients = xQe(r.offsets, n, s)), t.includeGCSGrid && !l.isGeographic && !l.isWebMercator) + if (c.isGeographic) + r.gcsGrid = { offsets: r.offsets, coefficients: r.coefficients, spacing: i }; + else { + const h = G$(l); + if (_e(h) && !h.isEnvelope) { + const p = aGi(l), y = vF(t.projectedExtent, p), { offsets: v } = wxe({ ...t, srcBufferExtent: y, spacing: i }), x = xQe(v, n, s); + r.gcsGrid = { offsets: v, coefficients: x, spacing: i }; + } + } + return r; +} +function wxe(t) { + const { projectedExtent: e, srcBufferExtent: i, pixelSize: r, datumTransformation: n, rasterTransform: s } = t, o = e.spatialReference, a = i.spatialReference, l = rH(o, a), { xmin: c, ymin: h, xmax: p, ymax: y } = e, v = Av(a), x = _e(v) && (t.hasWrapAround || s?.type === "gcs-shift"), I = t.spacing || [bfe, bfe], P = I[0] * r.x, F = I[1] * r.y, k = I[0] === 1, V = Math.ceil((p - c) / P - 0.1 / I[0]) + (k ? 0 : 1), j = Math.ceil((y - h) / F - 0.1 / I[1]) + (k ? 0 : 1), Y = tGi({ cols: V, rows: j, xmin: c, ymax: y, xres: P, yres: F, inSR: o, outSR: a, datumTransformation: n, preferPE: I[0] <= wfe, usePixelCenter: k }), X = []; + let Q, re = 0; + const he = k ? -1 : NaN, { xmin: fe, xmax: be, ymax: Se, width: Me, height: ke } = i, J = ux(a, xfe), ce = _e(v) && fe > 0 && be > v / 2; + let xe = !1; + if (l) { + const Pe = G$(o); + xe = _e(Pe) && Pe.poleLocation > 0; + } + for (let Pe = 0; Pe < V; Pe++) { + const Oe = []; + for (let Re = 0; Re < j; Re++) { + let Ge = Y[Pe * j + Re]; + if (x && Ge[0] > be && Ge[0] > v / 2 - J ? Ge[0] -= v : x && Pe === 0 && Ge[0] < 0 && ce && !s && (Ge[0] += v), !Ge || isNaN(Ge[0]) || isNaN(Ge[1])) + X.push(he), X.push(he), Oe.push(null), re++; + else { + if (s) { + const je = s.inverseTransform(new Xi({ x: Ge[0], y: Ge[1], spatialReference: a })); + Ge = [je.x, je.y]; + } + Oe.push(Ge), Pe > 0 && x && Q[Re] && Ge[0] < Q[Re][0] && (Ge[0] += v, xe && Ge[0] > be && Ge[0] > v && (Ge[0] -= v)), X.push((Ge[0] - fe) / Me), X.push((Se - Ge[1]) / ke); + } + } + Q = Oe; + } + return { offsets: X, error: null, coefficients: null, outofBoundPointCount: re, spacing: I, size: k ? [V, j] : [V - 1, j - 1] }; +} +function xQe(t, e, i) { + const { cols: r, rows: n } = e, s = new Float32Array((r - 1) * (n - 1) * 2 * 6), o = new Float32Array([-0, -1, 1, -1, 1, -0, 1, -0, -0]), a = new Float32Array([-1, 1, 0, 0, -1, 1, 1, 0, 0]); + for (let l = 0; l < r - 1; l++) { + for (let c = 0; c < n - 1; c++) { + let h = l * n * 2 + 2 * c; + const p = t[h], y = t[h + 1], v = t[h + 2], x = t[h + 3]; + h += 2 * n; + const I = t[h], P = t[h + 1], F = t[h + 2], k = t[h + 3]; + let V = 0, j = 12 * (c * (r - 1) + l); + for (let Y = 0; Y < 3; Y++) + s[j++] = o[V++] * p + o[V++] * v + o[V++] * F; + V = 0; + for (let Y = 0; Y < 3; Y++) + s[j++] = o[V++] * y + o[V++] * x + o[V++] * k; + V = 0; + for (let Y = 0; Y < 3; Y++) + s[j++] = a[V++] * p + a[V++] * I + a[V++] * F; + V = 0; + for (let Y = 0; Y < 3; Y++) + s[j++] = a[V++] * y + a[V++] * P + a[V++] * k; + } + if (i) + for (let c = 0; c < s.length; c++) + isNaN(s[c]) && (s[c] = -1); + } + return s; +} +function lGi(t) { + const e = t.clone().normalize(); + return e.length === 1 ? e[0] : PPt(e); +} +function YRe(t, e, i) { + const { storageInfo: r, pixelSize: n } = e; + let s = 0, o = !1; + const { pyramidResolutions: a } = r; + if (_e(a) && a.length) { + const y = (t.x + t.y) / 2, v = a[a.length - 1], x = (v.x + v.y) / 2, I = (n.x + n.y) / 2; + if (y <= I) + s = 0; + else if (y >= x) + s = a.length, o = y / x > 8; + else { + let F, k = I; + for (let V = 1; V <= a.length; V++) { + if (F = (a[V - 1].x + a[V - 1].y) / 2, y <= F) { + y === F ? s = V : i === "down" ? (s = V - 1, o = y / k > 8) : s = i === "up" || y - k > F - y || y / k > 2 ? V : V - 1; + break; + } + k = F; + } + } + const P = s === 0 ? n : a[s - 1]; + return o && Math.min(P.x, P.y) * th(e.spatialReference) > 19567 && (o = !1), { pyramidLevel: s, pyramidResolution: new Xi({ x: P.x, y: P.y, spatialReference: e.spatialReference }), excessiveReading: o }; + } + const l = Math.log(t.x / n.x) / Math.LN2, c = Math.log(t.y / n.y) / Math.LN2, h = e.storageInfo.maximumPyramidLevel || 0; + s = i === "down" ? Math.floor(Math.min(l, c)) : i === "up" ? Math.ceil(Math.max(l, c)) : Math.round((l + c) / 2), s < 0 ? s = 0 : s > h && (o = s > h + 3, s = h); + const p = 2 ** s; + return { pyramidLevel: s, pyramidResolution: new Xi({ x: p * e.nativePixelSize.x, y: p * e.nativePixelSize.y, spatialReference: e.spatialReference }), excessiveReading: o }; +} +function uGi(t, e, i = 512, r = !0) { + const { extent: n, spatialReference: s, pixelSize: o } = t, a = cee(new Xi({ x: o.x, y: o.y, spatialReference: s }), e, n); + if (a == null) + return { projectedPixelSize: null, scales: null, srcResolutions: null, isCustomTilingScheme: !1 }; + const l = (a.x + a.y) / 2, c = th(e), h = l * c * 96 * 39.37, p = e.isGeographic ? 256 / i * 2958287637958547e-7 : 256 / i * 591657527591555e-6; + let y = t.dataType === "vector-magdir" || t.dataType === "vector-uv"; + const v = vF(n, e), x = Math.min(Math.ceil(Math.log(Math.min(t.width, t.height) / 32) / Math.LN2), Math.ceil(Math.log(p / 2 / h) / Math.LN2)); + if (!y && r && (e.isGeographic || e.isWebMercator) && (y = v.xmin * v.xmax < 0, !y && x < 3)) { + const Q = Av(e); + if (_e(Q)) { + const re = 2 ** x * l * i, he = Math.ceil(Q / re); + y = he === 1 || he === 2 && Q / 2 - v.xmax < re; + } + } + let I, P = h; + const F = 1.001, k = Math.min(2, Math.max(1.414, t.storageInfo?.pyramidScalingFactor || 2)); + if (y) { + P = p; + const Q = e.isGeographic ? 1341104507446289e-21 : 0.29858214164761665, re = Q * (96 * c * 39.37), he = e.isGeographic ? 4326 : 3857; + I = cee(new Xi({ x: Q, y: Q, spatialReference: { wkid: he } }), s, v), I.x *= P / re, I.y *= P / re; + } else { + I = { x: o.x, y: o.y }; + let Q = 0; + for (; P < p * (F / 2) && Q < x; ) + Q++, P *= k, I.x *= k, I.y *= k; + Math.max(P, p) / Math.min(P, p) <= F && (P = p); + } + const V = [P], j = [{ x: I.x, y: I.y }], Y = 70.5310735, X = Math.min(Y, h) / F; + for (; P >= X; ) + P /= k, I.x /= k, I.y /= k, V.push(P), j.push({ x: I.x, y: I.y }); + return { projectedPixelSize: a, scales: V, srcResolutions: j, isCustomTilingScheme: !y }; +} +let bX = class extends $i { + get affectsPixelSize() { + return !1; + } + forwardTransform(e) { + return e; + } + inverseTransform(e) { + return e; + } +}; +E([N()], bX.prototype, "affectsPixelSize", null), E([N({ json: { write: !0 } })], bX.prototype, "spatialReference", void 0), bX = E([dt("esri.layers.support.rasterTransforms.BaseRasterTransform")], bX); +const z8e = bX; +let wX = class extends z8e { + constructor() { + super(...arguments), this.type = "gcs-shift", this.tolerance = 1e-8; + } + forwardTransform(e) { + return (e = e.clone()).type === "point" ? (e.x > 180 + this.tolerance && (e.x -= 360), e) : (e.xmin >= 180 - this.tolerance ? (e.xmax -= 360, e.xmin -= 360) : e.xmax > 180 + this.tolerance && (e.xmin = -180, e.xmax = 180), e); + } + inverseTransform(e) { + return (e = e.clone()).type === "point" ? (e.x < -this.tolerance && (e.x += 360), e) : (e.xmin < -this.tolerance && (e.xmin += 360, e.xmax += 360), e); + } +}; +E([Yr({ GCSShiftXform: "gcs-shift" })], wX.prototype, "type", void 0), E([N()], wX.prototype, "tolerance", void 0), wX = E([dt("esri.layers.support.rasterTransforms.GCSShiftTransform")], wX); +const OPt = wX; +let uce = class extends z8e { + constructor() { + super(...arguments), this.type = "identity"; + } +}; +E([Yr({ IdentityXform: "identity" })], uce.prototype, "type", void 0), uce = E([dt("esri.layers.support.rasterTransforms.IdentityTransform")], uce); +const cGi = uce; +function XRe(t, e, i) { + const { x: r, y: n } = e; + if (i < 2) + return { x: t[0] + r * t[2] + n * t[4], y: t[1] + r * t[3] + n * t[5] }; + if (i === 2) { + const y = r * r, v = n * n, x = r * n; + return { x: t[0] + r * t[2] + n * t[4] + y * t[6] + x * t[8] + v * t[10], y: t[1] + r * t[3] + n * t[5] + y * t[7] + x * t[9] + v * t[11] }; + } + const s = r * r, o = n * n, a = r * n, l = s * r, c = s * n, h = r * o, p = n * o; + return { x: t[0] + r * t[2] + n * t[4] + s * t[6] + a * t[8] + o * t[10] + l * t[12] + c * t[14] + h * t[16] + p * t[18], y: t[1] + r * t[3] + n * t[5] + s * t[7] + a * t[9] + o * t[11] + l * t[13] + c * t[15] + h * t[17] + p * t[19] }; +} +function SQe(t, e, i) { + const { xmin: r, ymin: n, xmax: s, ymax: o, spatialReference: a } = e; + let l = []; + if (i < 2) + l.push({ x: r, y: o }), l.push({ x: s, y: o }), l.push({ x: r, y: n }), l.push({ x: s, y: n }); + else { + let p = 10; + for (let y = 0; y < p; y++) + l.push({ x: r, y: n + (o - n) * y / (p - 1) }), l.push({ x: s, y: n + (o - n) * y / (p - 1) }); + p = 8; + for (let y = 1; y <= p; y++) + l.push({ x: r + (s - r) * y / p, y: n }), l.push({ x: r + (s - r) * y / p, y: o }); + } + l = l.map((p) => XRe(t, p, i)); + const c = l.map((p) => p.x), h = l.map((p) => p.y); + return new br({ xmin: Math.min.apply(null, c), xmax: Math.max.apply(null, c), ymin: Math.min.apply(null, h), ymax: Math.max.apply(null, h), spatialReference: a }); +} +function hGi(t) { + const [e, i, r, n, s, o] = t, a = r * o - s * n, l = s * n - r * o; + return [(s * i - e * o) / a, (r * i - e * n) / l, o / a, n / l, -s / a, -r / l]; +} +let Ow = class extends z8e { + constructor() { + super(...arguments), this.polynomialOrder = 1, this.type = "polynomial"; + } + readForwardCoefficients(e, i) { + const { coeffX: r, coeffY: n } = i; + if (!r?.length || !n?.length || r.length !== n.length) + return null; + const s = []; + for (let o = 0; o < r.length; o++) + s.push(r[o]), s.push(n[o]); + return s; + } + writeForwardCoefficients(e, i, r) { + const n = [], s = []; + for (let o = 0; o < e?.length; o++) + o % 2 == 0 ? n.push(e[o]) : s.push(e[o]); + i.coeffX = n, i.coeffY = s; + } + get inverseCoefficients() { + let e = this._get("inverseCoefficients"); + const i = this._get("forwardCoefficients"); + return !e && i && this.polynomialOrder < 2 && (e = hGi(i)), e; + } + set inverseCoefficients(e) { + this._set("inverseCoefficients", e); + } + readInverseCoefficients(e, i) { + const { inverseCoeffX: r, inverseCoeffY: n } = i; + if (!r?.length || !n?.length || r.length !== n.length) + return null; + const s = []; + for (let o = 0; o < r.length; o++) + s.push(r[o]), s.push(n[o]); + return s; + } + writeInverseCoefficients(e, i, r) { + const n = [], s = []; + for (let o = 0; o < e?.length; o++) + o % 2 == 0 ? n.push(e[o]) : s.push(e[o]); + i.inverseCoeffX = n, i.inverseCoeffY = s; + } + get affectsPixelSize() { + return this.polynomialOrder > 0; + } + forwardTransform(e) { + if (e.type === "point") { + const i = XRe(this.forwardCoefficients, e, this.polynomialOrder); + return new Xi({ x: i.x, y: i.y, spatialReference: e.spatialReference }); + } + return SQe(this.forwardCoefficients, e, this.polynomialOrder); + } + inverseTransform(e) { + if (e.type === "point") { + const i = XRe(this.inverseCoefficients, e, this.polynomialOrder); + return new Xi({ x: i.x, y: i.y, spatialReference: e.spatialReference }); + } + return SQe(this.inverseCoefficients, e, this.polynomialOrder); + } +}; +E([N({ json: { write: !0 } })], Ow.prototype, "polynomialOrder", void 0), E([N()], Ow.prototype, "forwardCoefficients", void 0), E([Li("forwardCoefficients", ["coeffX", "coeffY"])], Ow.prototype, "readForwardCoefficients", null), E([mr("forwardCoefficients")], Ow.prototype, "writeForwardCoefficients", null), E([N({ json: { write: !0 } })], Ow.prototype, "inverseCoefficients", null), E([Li("inverseCoefficients", ["inverseCoeffX", "inverseCoeffY"])], Ow.prototype, "readInverseCoefficients", null), E([mr("inverseCoefficients")], Ow.prototype, "writeInverseCoefficients", null), E([N()], Ow.prototype, "affectsPixelSize", null), E([Yr({ PolynomialXform: "polynomial" })], Ow.prototype, "type", void 0), Ow = E([dt("esri.layers.support.rasterTransforms.PolynomialTransform")], Ow); +const fve = Ow, RPt = { GCSShiftXform: OPt, IdentityXform: cGi, PolynomialXform: fve }, dGi = Object.keys(RPt); +function pGi(t) { + const e = t?.type; + return !t || dGi.includes(e); +} +function MPt(t) { + if (!t?.type) + return null; + const i = RPt[t?.type]; + if (i) { + const r = new i(); + return r.read(t), r; + } + return null; +} +let fGi = class { + convertVectorFieldData(e) { + const i = nn.fromJSON(e.pixelBlock), r = nU(i, e.type); + return Promise.resolve(_e(r) ? r.toJSON() : null); + } + async decode(e) { + const i = await dde(e.data, e.options); + return i && i.toJSON(); + } + symbolize(e) { + e.pixelBlock = nn.fromJSON(e.pixelBlock), e.extent = e.extent ? br.fromJSON(e.extent) : null; + const i = this.symbolizer.symbolize(e); + return Promise.resolve(_e(i) ? i.toJSON() : null); + } + async updateSymbolizer(e) { + this.symbolizer = N5e.fromJSON(e.symbolizerJSON), e.histograms && this.symbolizer?.rendererJSON.type === "rasterStretch" && (this.symbolizer.rendererJSON.histograms = e.histograms); + } + async updateRasterFunction(e) { + this.rasterFunction = _fe(e.rasterFunctionJSON); + } + async process(e) { + const i = this.rasterFunction.process({ extent: br.fromJSON(e.extent), primaryPixelBlocks: e.primaryPixelBlocks.map((r) => _e(r) ? nn.fromJSON(r) : null), primaryRasterIds: e.primaryRasterIds }); + return _e(i) ? i.toJSON() : null; + } + stretch(e) { + const i = this.symbolizer.simpleStretch(nn.fromJSON(e.srcPixelBlock), e.stretchParams); + return Promise.resolve(_e(i) && i.toJSON()); + } + estimateStatisticsHistograms(e) { + const i = D5e(nn.fromJSON(e.srcPixelBlock)); + return Promise.resolve(i); + } + split(e) { + const i = Wgt(nn.fromJSON(e.srcPixelBlock), e.tileSize, e.maximumPyramidLevel); + return i && i.forEach((r, n) => { + i.set(n, r?.toJSON()); + }), Promise.resolve(i); + } + async mosaicAndTransform(e) { + const i = e.srcPixelBlocks.map((o) => o ? new nn(o) : null), r = cJ(i, e.srcMosaicSize, { blockWidths: e.blockWidths, alignmentInfo: e.alignmentInfo, clipOffset: e.clipOffset, clipSize: e.clipSize }); + let n, s = r; + return e.coefs && (s = Xgt(r, e.destDimension, e.coefs, e.sampleSpacing, e.interpolation)), e.projectDirections && e.gcsGrid && (n = Ygt(e.destDimension, e.gcsGrid), s = Zgt(s, e.isUV ? "vector-uv" : "vector-magdir", n)), { pixelBlock: s?.toJSON(), localNorthDirections: n }; + } + async createFlowMesh(e, i) { + const r = { data: new Float32Array(e.flowData.buffer), mask: new Uint8Array(e.flowData.maskBuffer), width: e.flowData.width, height: e.flowData.height }, { vertexData: n, indexData: s } = await Z5e(e.meshType, e.simulationSettings, r, i.signal); + return { result: { vertexBuffer: n.buffer, indexBuffer: s.buffer }, transferList: [n.buffer, s.buffer] }; + } + async getProjectionOffsetGrid(e) { + const i = br.fromJSON(e.projectedExtent), r = br.fromJSON(e.srcBufferExtent); + let n = null; + e.datumTransformationSteps && (n = new Zhe({ steps: e.datumTransformationSteps })), (e.includeGCSGrid || j8e(i.spatialReference, r.spatialReference, n)) && await qRe(); + const s = e.rasterTransform ? MPt(e.rasterTransform) : null; + return U8e({ ...e, projectedExtent: i, srcBufferExtent: r, datumTransformation: n, rasterTransform: s }); + } +}; +const mGi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: fGi +}, Symbol.toStringTag, { value: "Module" })); +let nH = class { + constructor(e) { + this._allocator = e, this._items = [], this._itemsPtr = 0, this._grow(); + } + get() { + return this._itemsPtr === 0 && N7(() => this._reset()), this._itemsPtr === this._items.length && this._grow(), this._items[this._itemsPtr++]; + } + _reset() { + const e = Math.min(3 * Math.max(8, this._itemsPtr), this._itemsPtr + 3 * CQe); + this._items.length = Math.min(e, this._items.length), this._itemsPtr = 0; + } + _grow() { + for (let e = 0; e < Math.max(8, Math.min(this._items.length, CQe)); e++) + this._items.push(this._allocator()); + } +}; +const CQe = 1024; +let sH = class jN { + constructor(e, i, r) { + this._itemByteSize = e, this._itemCreate = i, this._buffers = new Array(), this._items = new Array(), this._itemsPtr = 0, this._itemsPerBuffer = Math.ceil(r / this._itemByteSize); + } + get() { + this._itemsPtr === 0 && N7(() => this._reset()); + const e = Math.floor(this._itemsPtr / this._itemsPerBuffer); + for (; this._buffers.length <= e; ) { + const i = new ArrayBuffer(this._itemsPerBuffer * this._itemByteSize); + for (let r = 0; r < this._itemsPerBuffer; ++r) + this._items.push(this._itemCreate(i, r * this._itemByteSize)); + this._buffers.push(i); + } + return this._items[this._itemsPtr++]; + } + _reset() { + const e = 2 * (Math.floor(this._itemsPtr / this._itemsPerBuffer) + 1); + for (; this._buffers.length > e; ) + this._buffers.pop(), this._items.length = this._buffers.length * this._itemsPerBuffer; + this._itemsPtr = 0; + } + static createVec2f64(e = mB) { + return new jN(16, J_t, e); + } + static createVec3f64(e = mB) { + return new jN(24, tht, e); + } + static createVec4f64(e = mB) { + return new jN(32, upt, e); + } + static createMat3f64(e = mB) { + return new jN(72, oAt, e); + } + static createMat4f64(e = mB) { + return new jN(128, aAt, e); + } + static createQuatf64(e = mB) { + return new jN(32, uAt, e); + } + get test() { + return { size: this._buffers.length * this._itemsPerBuffer * this._itemByteSize }; + } +}; +const mB = 4 * g$.KILOBYTES; +sH.createVec2f64(); +const a4 = sH.createVec3f64(); +sH.createVec4f64(); +sH.createMat3f64(); +const gGi = sH.createMat4f64(); +sH.createQuatf64(); +function mve(t) { + return t ? { origin: ym(t.origin), vector: ym(t.vector) } : { origin: sn(), vector: sn() }; +} +function yGi(t, e, i = mve()) { + return d1(i.origin, t), Ec(i.vector, e, t), i; +} +function vGi(t, e, i) { + return _Gi(t, e, 0, 1, i); +} +function _Gi(t, e, i, r, n) { + const { vector: s, origin: o } = t, a = Ec(a4.get(), e, o), l = xx(s, a) / uge(s); + return od(n, s, ru(l, i, r)), Zc(n, n, t.origin); +} +new nH(() => mve()); +var f7; +(function(t) { + t[t.X = 0] = "X", t[t.Y = 1] = "Y", t[t.Z = 2] = "Z"; +})(f7 || (f7 = {})); +function KRe(t) { + return t ? TQe(ym(t.origin), ym(t.direction)) : TQe(sn(), sn()); +} +function TQe(t, e) { + return { origin: t, direction: e }; +} +function EQe(t, e) { + const i = wGi.get(); + return i.origin = t, i.direction = e, i; +} +function bGi(t, e, i) { + const r = xx(t.direction, Ec(i, e, t.origin)); + return Zc(i, t.origin, od(i, t.direction, r)), i; +} +const wGi = new nH(() => KRe()); +function xGi(t, e) { + const i = xx(t, e) / (h1(t) * h1(e)); + return -K4e(i); +} +function Wx() { + return h3(); +} +function KU(t, e = Wx()) { + return W4e(e, t); +} +function SGi(t, e) { + return Gv(t[0], t[1], t[2], e); +} +function CGi(t) { + return t; +} +function TGi(t) { + t[0] = t[1] = t[2] = t[3] = 0; +} +function EGi(t, e) { + return t[0] = t[1] = t[2] = 0, t[3] = e, t; +} +function j6(t) { + return t[3]; +} +function IGi(t) { + return t; +} +function AGi(t, e, i, r) { + return Gv(t, e, i, r); +} +function PGi(t, e, i) { + return t !== i && d1(i, t), i[3] = t[3] + e, i; +} +function OGi(t, e, i) { + return Ei.getLogger("esri.geometry.support.sphere").error("sphere.setExtent is not yet supported"), t === i ? i : KU(t, i); +} +function gve(t, e, i) { + if (ut(e)) + return !1; + const { origin: r, direction: n } = e, s = RGi; + s[0] = r[0] - t[0], s[1] = r[1] - t[1], s[2] = r[2] - t[2]; + const o = n[0] * n[0] + n[1] * n[1] + n[2] * n[2]; + if (o === 0) + return !1; + const a = 2 * (n[0] * s[0] + n[1] * s[1] + n[2] * s[2]), l = a * a - 4 * o * (s[0] * s[0] + s[1] * s[1] + s[2] * s[2] - t[3] * t[3]); + if (l < 0) + return !1; + const c = Math.sqrt(l); + let h = (-a - c) / (2 * o); + const p = (-a + c) / (2 * o); + return (h < 0 || p < h && p > 0) && (h = p), !(h < 0) && (i && (i[0] = r[0] + n[0] * h, i[1] = r[1] + n[1] * h, i[2] = r[2] + n[2] * h), !0); +} +const RGi = sn(); +function JRe(t, e) { + return gve(t, e, null); +} +function MGi(t, e, i) { + if (gve(t, e, i)) + return i; + const r = DPt(t, e, a4.get()); + return Zc(i, e.origin, od(a4.get(), e.direction, AF(e.origin, r) / h1(e.direction))), i; +} +function DPt(t, e, i) { + const r = a4.get(), n = gGi.get(); + AS(r, e.origin, e.direction); + const s = j6(t); + AS(i, r, e.origin), od(i, i, 1 / h1(i) * s); + const o = LPt(t, e.origin), a = xGi(e.origin, i); + return RLe(n, a + o, r), GS(i, i, n), i; +} +function DGi(t, e, i) { + return gve(t, e, i) ? i : (bGi(e, t, i), FPt(t, i, i)); +} +function FPt(t, e, i) { + const r = Ec(a4.get(), e, t), n = od(a4.get(), r, t[3] / h1(r)); + return Zc(i, n, t); +} +function FGi(t, e) { + const i = Ec(a4.get(), e, t), r = uge(i), n = t[3] * t[3]; + return Math.sqrt(Math.abs(r - n)); +} +function LPt(t, e) { + const i = Ec(a4.get(), e, t), r = h1(i), n = j6(t), s = n + Math.abs(n - r); + return K4e(n / s); +} +const xxe = sn(); +function NPt(t, e, i, r) { + const n = Ec(xxe, e, t); + switch (i) { + case f7.X: { + const s = Yje(n, xxe)[2]; + return Ol(r, -Math.sin(s), Math.cos(s), 0); + } + case f7.Y: { + const s = Yje(n, xxe), o = s[1], a = s[2], l = Math.sin(o); + return Ol(r, -l * Math.cos(a), -l * Math.sin(a), Math.cos(o)); + } + case f7.Z: + return $0(r, n); + default: + return; + } +} +function kPt(t, e) { + const i = Ec(QRe, e, t); + return h1(i) - t[3]; +} +function LGi(t, e, i, r) { + const n = kPt(t, e), s = NPt(t, e, f7.Z, QRe), o = od(QRe, s, i - n); + return Zc(r, e, o); +} +function ZRe(t, e) { + const i = j7(t, e), r = j6(t); + return i <= r * r; +} +const QRe = sn(), NGi = Wx(); +Object.freeze(Object.defineProperty({ __proto__: null, altitudeAt: kPt, angleToSilhouette: LPt, axisAt: NPt, clear: TGi, closestPoint: DGi, closestPointOnSilhouette: DPt, containsPoint: ZRe, copy: KU, create: Wx, distanceToSilhouette: FGi, elevate: PGi, fromCenterAndRadius: SGi, fromRadius: EGi, fromValues: AGi, getCenter: IGi, getRadius: j6, intersectRay: gve, intersectRayClosestSilhouette: MGi, intersectsRay: JRe, projectPoint: FPt, setAltitudeAt: LGi, setExtent: OGi, tmpSphere: NGi, wrap: CGi }, Symbol.toStringTag, { value: "Module" })); +function $Pt(t) { + return t ? { ray: KRe(t.ray), c0: t.c0, c1: t.c1 } : { ray: KRe(), c0: 0, c1: Number.MAX_VALUE }; +} +new nH(() => $Pt()); +var hee; +(function(t) { + t[t.NONE = 0] = "NONE", t[t.CLAMP = 1] = "CLAMP", t[t.INFINITE_MIN = 4] = "INFINITE_MIN", t[t.INFINITE_MAX = 8] = "INFINITE_MAX"; +})(hee || (hee = {})); +hee.INFINITE_MIN | hee.INFINITE_MAX; +hee.INFINITE_MAX; +function Ooe(t, e) { + for (let i = 0; i < eMe.NUM; i++) { + const r = t[i]; + if (r[0] * e[0] + r[1] * e[1] + r[2] * e[2] + r[3] >= e[3]) + return !1; + } + return !0; +} +var IQe, Jh; +(function(t) { + t[t.LEFT = 0] = "LEFT", t[t.RIGHT = 1] = "RIGHT", t[t.BOTTOM = 2] = "BOTTOM", t[t.TOP = 3] = "TOP", t[t.NEAR = 4] = "NEAR", t[t.FAR = 5] = "FAR"; +})(IQe || (IQe = {})), function(t) { + t[t.NEAR_BOTTOM_LEFT = 0] = "NEAR_BOTTOM_LEFT", t[t.NEAR_BOTTOM_RIGHT = 1] = "NEAR_BOTTOM_RIGHT", t[t.NEAR_TOP_RIGHT = 2] = "NEAR_TOP_RIGHT", t[t.NEAR_TOP_LEFT = 3] = "NEAR_TOP_LEFT", t[t.FAR_BOTTOM_LEFT = 4] = "FAR_BOTTOM_LEFT", t[t.FAR_BOTTOM_RIGHT = 5] = "FAR_BOTTOM_RIGHT", t[t.FAR_TOP_RIGHT = 6] = "FAR_TOP_RIGHT", t[t.FAR_TOP_LEFT = 7] = "FAR_TOP_LEFT"; +}(Jh || (Jh = {})); +Jh.FAR_BOTTOM_RIGHT, Jh.NEAR_BOTTOM_RIGHT, Jh.NEAR_BOTTOM_LEFT, Jh.FAR_BOTTOM_LEFT, Jh.NEAR_BOTTOM_LEFT, Jh.NEAR_BOTTOM_RIGHT, Jh.NEAR_TOP_RIGHT, Jh.NEAR_TOP_LEFT, Jh.FAR_BOTTOM_RIGHT, Jh.FAR_BOTTOM_LEFT, Jh.FAR_TOP_LEFT, Jh.FAR_TOP_RIGHT, Jh.NEAR_BOTTOM_RIGHT, Jh.FAR_BOTTOM_RIGHT, Jh.FAR_TOP_RIGHT, Jh.NEAR_TOP_RIGHT, Jh.FAR_BOTTOM_LEFT, Jh.NEAR_BOTTOM_LEFT, Jh.NEAR_TOP_LEFT, Jh.FAR_TOP_LEFT, Jh.FAR_TOP_LEFT, Jh.NEAR_TOP_LEFT, Jh.NEAR_TOP_RIGHT, Jh.FAR_TOP_RIGHT; +var eMe, AQe; +(function(t) { + t[t.NUM = 6] = "NUM"; +})(eMe || (eMe = {})), function(t) { + t[t.NUM = 8] = "NUM"; +}(AQe || (AQe = {})); +new nH($Pt); +let tMe = class iMe { + get bounds() { + return this._root.bounds; + } + get halfSize() { + return this._root.halfSize; + } + get root() { + return this._root.node; + } + get maximumObjectsPerNode() { + return this._maximumObjectsPerNode; + } + get maximumDepth() { + return this._maximumDepth; + } + get objectCount() { + return this._objectCount; + } + constructor(e, i) { + this._objectToBoundingSphere = e, this._maximumObjectsPerNode = 10, this._maximumDepth = 20, this._degenerateObjects = /* @__PURE__ */ new Set(), this._root = new Qf(), this._objectCount = 0, i && (i.maximumObjectsPerNode !== void 0 && (this._maximumObjectsPerNode = i.maximumObjectsPerNode), i.maximumDepth !== void 0 && (this._maximumDepth = i.maximumDepth)); + } + destroy() { + this._degenerateObjects.clear(), Qf.clearPool(), rMe[0] = null, f5.prune(), GN.prune(); + } + add(e, i = e.length) { + this._objectCount += i, this._grow(e, i); + const r = Qf.acquire(); + for (let n = 0; n < i; n++) { + const s = e[n]; + this._isDegenerate(s) ? this._degenerateObjects.add(s) : (r.init(this._root), this._add(s, r)); + } + Qf.release(r); + } + remove(e, i = null) { + this._objectCount -= e.length; + const r = Qf.acquire(); + for (const n of e) { + const s = _e(i) ? i : KU(this._objectToBoundingSphere(n), jGi); + xX(s[3]) ? (r.init(this._root), this._remove(n, s, r)) : this._degenerateObjects.delete(n); + } + Qf.release(r), this._shrink(); + } + update(e, i) { + if (!xX(i[3]) && this._isDegenerate(e)) + return; + const r = VGi(e); + this.remove(r, i), this.add(r); + } + forEachAlongRay(e, i, r) { + const n = EQe(e, i); + this._forEachNode(this._root, (s) => { + if (!this._intersectsNode(n, s)) + return !1; + const o = s.node; + return o.terminals.forAll((a) => { + this._intersectsObject(n, a) && r(a); + }), o.residents !== null && o.residents.forAll((a) => { + this._intersectsObject(n, a) && r(a); + }), !0; + }); + } + forEachAlongRayWithVerticalOffset(e, i, r, n) { + const s = EQe(e, i); + this._forEachNode(this._root, (o) => { + if (!this._intersectsNodeWithOffset(s, o, n)) + return !1; + const a = o.node; + return a.terminals.forAll((l) => { + this._intersectsObjectWithOffset(s, l, n) && r(l); + }), a.residents !== null && a.residents.forAll((l) => { + this._intersectsObjectWithOffset(s, l, n) && r(l); + }), !0; + }); + } + forEach(e) { + this._forEachNode(this._root, (i) => { + const r = i.node; + return r.terminals.forAll(e), r.residents !== null && r.residents.forAll(e), !0; + }), this._degenerateObjects.forEach(e); + } + forEachDegenerateObject(e) { + this._degenerateObjects.forEach(e); + } + findClosest(e, i, r, n = () => !0, s = 1 / 0) { + let o = 1 / 0, a = 1 / 0, l = null; + const c = Sxe(e, i), h = (p) => { + if (--s, !n(p)) + return; + const y = this._objectToBoundingSphere(p); + if (!Ooe(r, y)) + return; + const v = gD(e, i, y), x = v - y[3], I = v + y[3]; + x < o && (o = x, a = I, l = p); + }; + return this._forEachNodeDepthOrdered(this._root, (p) => { + if (s <= 0 || !Ooe(r, p.bounds) || (od(pw, c, p.halfSize), Zc(pw, pw, p.bounds), gD(e, i, pw) > a)) + return !1; + const y = p.node; + return y.terminals.forAll((v) => h(v)), y.residents !== null && y.residents.forAll((v) => h(v)), !0; + }, e, i), l; + } + forEachInDepthRange(e, i, r, n, s, o, a) { + let l = -1 / 0, c = 1 / 0; + const h = { setRange: (I) => { + r === iMe.DepthOrder.FRONT_TO_BACK ? (l = Math.max(l, I.near), c = Math.min(c, I.far)) : (l = Math.max(l, -I.far), c = Math.min(c, -I.near)); + } }; + h.setRange(n); + const p = gD(i, r, e), y = Sxe(i, r), v = Sxe(i, -r), x = (I) => { + if (!a(I)) + return; + const P = this._objectToBoundingSphere(I), F = P, k = gD(i, r, F) - p, V = k - P[3], j = k + P[3]; + V > c || j < l || !Ooe(o, P) || s(I, h); + }; + this._forEachNodeDepthOrdered(this._root, (I) => { + if (!Ooe(o, I.bounds) || (od(pw, y, I.halfSize), Zc(pw, pw, I.bounds), gD(i, r, pw) - p > c) || (od(pw, v, I.halfSize), Zc(pw, pw, I.bounds), gD(i, r, pw) - p < l)) + return !1; + const P = I.node; + return P.terminals.forAll((F) => x(F)), P.residents !== null && P.residents.forAll((F) => x(F)), !0; + }, i, r); + } + forEachNode(e) { + this._forEachNode(this._root, (i) => e(i.node, i.bounds, i.halfSize)); + } + forEachNeighbor(e, i) { + const r = j6(i), n = i, s = (l) => { + const c = this._objectToBoundingSphere(l), h = j6(c), p = r + h; + return !(j7(c, n) - p * p <= 0) || e(l); + }; + let o = !0; + const a = (l) => { + o && (o = s(l)); + }; + this._forEachNode(this._root, (l) => { + const c = j6(l.bounds), h = r + c; + if (j7(l.bounds, n) - h * h > 0) + return !1; + const p = l.node; + return p.terminals.forAll(a), o && p.residents !== null && p.residents.forAll(a), o; + }), o && this.forEachDegenerateObject(a); + } + _intersectsNode(e, i) { + return Roe(i.bounds, 2 * -i.halfSize, cb), Roe(i.bounds, 2 * i.halfSize, hb), AWe(e.origin, e.direction, cb, hb); + } + _intersectsNodeWithOffset(e, i, r) { + return Roe(i.bounds, 2 * -i.halfSize, cb), Roe(i.bounds, 2 * i.halfSize, hb), r.applyToMinMax(cb, hb), AWe(e.origin, e.direction, cb, hb); + } + _intersectsObject(e, i) { + const r = this._objectToBoundingSphere(i); + return !(r[3] > 0) || JRe(r, e); + } + _intersectsObjectWithOffset(e, i, r) { + const n = this._objectToBoundingSphere(i); + return !(n[3] > 0) || JRe(r.applyToBoundingSphere(n), e); + } + _forEachNode(e, i) { + let r = Qf.acquire().init(e); + const n = [r]; + for (; n.length !== 0; ) { + if (r = n.pop(), i(r) && !r.isLeaf()) + for (let s = 0; s < r.node.children.length; s++) + r.node.children[s] && n.push(Qf.acquire().init(r).advance(s)); + Qf.release(r); + } + } + _forEachNodeDepthOrdered(e, i, r, n = iMe.DepthOrder.FRONT_TO_BACK) { + let s = Qf.acquire().init(e); + const o = [s]; + for (BGi(r, n, RQe); o.length !== 0; ) { + if (s = o.pop(), i(s) && !s.isLeaf()) + for (let a = 7; a >= 0; --a) { + const l = RQe[a]; + s.node.children[l] && o.push(Qf.acquire().init(s).advance(l)); + } + Qf.release(s); + } + } + _remove(e, i, r) { + f5.clear(); + const n = r.advanceTo(i, (s, o) => { + f5.push(s.node), f5.push(o); + }) ? r.node.terminals : r.node.residents; + if (n.removeUnordered(e), n.length === 0) + for (let s = f5.length - 2; s >= 0; s -= 2) { + const o = f5.data[s], a = f5.data[s + 1]; + if (!this._purge(o, a)) + break; + } + } + _nodeIsEmpty(e) { + if (e.terminals.length !== 0) + return !1; + if (e.residents !== null) + return e.residents.length === 0; + for (let i = 0; i < e.children.length; i++) + if (e.children[i]) + return !1; + return !0; + } + _purge(e, i) { + return i >= 0 && (e.children[i] = null), !!this._nodeIsEmpty(e) && (e.residents === null && (e.residents = new Qm({ shrink: !0 })), !0); + } + _add(e, i) { + i.advanceTo(this._objectToBoundingSphere(e)) ? i.node.terminals.push(e) : (i.node.residents.push(e), i.node.residents.length > this._maximumObjectsPerNode && i.depth < this._maximumDepth && this._split(i)); + } + _split(e) { + const i = e.node.residents; + e.node.residents = null; + for (let r = 0; r < i.length; r++) { + const n = Qf.acquire().init(e); + this._add(i.getItemAt(r), n), Qf.release(n); + } + } + _grow(e, i) { + if (i !== 0 && (PQe(e, i, (r) => this._objectToBoundingSphere(r), OA), xX(OA[3]) && !this._fitsInsideTree(OA))) + if (this._nodeIsEmpty(this._root.node)) + KU(OA, this._root.bounds), this._root.halfSize = 1.25 * this._root.bounds[3], this._root.updateBoundsRadiusFromHalfSize(); + else { + const r = this._rootBoundsForRootAsSubNode(OA); + this._placingRootViolatesMaxDepth(r) ? this._rebuildTree(OA, r) : this._growRootAsSubNode(r), Qf.release(r); + } + } + _rebuildTree(e, i) { + d1(Txe, i.bounds), Txe[3] = i.halfSize, PQe([e, Txe], 2, (n) => n, Exe); + const r = Qf.acquire().init(this._root); + this._root.initFrom(null, Exe, Exe[3]), this._root.increaseHalfSize(1.25), this._forEachNode(r, (n) => (this.add(n.node.terminals.data, n.node.terminals.length), n.node.residents !== null && this.add(n.node.residents.data, n.node.residents.length), !0)), Qf.release(r); + } + _placingRootViolatesMaxDepth(e) { + const i = Math.log(e.halfSize / this._root.halfSize) * Math.LOG2E; + let r = 0; + return this._forEachNode(this._root, (n) => (r = Math.max(r, n.depth), r + i <= this._maximumDepth)), r + i > this._maximumDepth; + } + _rootBoundsForRootAsSubNode(e) { + const i = e[3], r = e; + let n = -1 / 0; + const s = this._root.bounds, o = this._root.halfSize; + for (let l = 0; l < 3; l++) { + const c = s[l] - o - (r[l] - i), h = r[l] + i - (s[l] + o), p = Math.max(0, Math.ceil(c / (2 * o))), y = Math.max(0, Math.ceil(h / (2 * o))) + 1, v = 2 ** Math.ceil(Math.log(p + y) * Math.LOG2E); + n = Math.max(n, v), Moe[l].min = p, Moe[l].max = y; + } + for (let l = 0; l < 3; l++) { + let c = Moe[l].min, h = Moe[l].max; + const p = (n - (c + h)) / 2; + c += Math.ceil(p), h += Math.floor(p); + const y = s[l] - o - c * o * 2; + Cxe[l] = y + (h + c) * o; + } + const a = n * o; + return Cxe[3] = a * VPt, Qf.acquire().initFrom(null, Cxe, a, 0); + } + _growRootAsSubNode(e) { + const i = this._root.node; + d1(OA, this._root.bounds), OA[3] = this._root.halfSize, this._root.init(e), e.advanceTo(OA, null, !0), e.node.children = i.children, e.node.residents = i.residents, e.node.terminals = i.terminals; + } + _shrink() { + for (; ; ) { + const e = this._findShrinkIndex(); + if (e === -1) + break; + this._root.advance(e), this._root.depth = 0; + } + } + _findShrinkIndex() { + if (this._root.node.terminals.length !== 0 || this._root.isLeaf()) + return -1; + let e = null; + const i = this._root.node.children; + let r = 0, n = 0; + for (; n < i.length && e == null; ) + r = n++, e = i[r]; + for (; n < i.length; ) + if (i[n++]) + return -1; + return r; + } + _isDegenerate(e) { + return !xX(this._objectToBoundingSphere(e)[3]); + } + _fitsInsideTree(e) { + const i = this._root.bounds, r = this._root.halfSize; + return e[3] <= r && e[0] >= i[0] - r && e[0] <= i[0] + r && e[1] >= i[1] - r && e[1] <= i[1] + r && e[2] >= i[2] - r && e[2] <= i[2] + r; + } +}, Qf = class KV { + constructor() { + this.bounds = Wx(), this.halfSize = 0, this.initFrom(null, null, 0, 0); + } + init(e) { + return this.initFrom(e.node, e.bounds, e.halfSize, e.depth); + } + initFrom(e, i, r, n = this.depth) { + return this.node = _e(e) ? e : KV.createEmptyNode(), _e(i) && KU(i, this.bounds), this.halfSize = r, this.depth = n, this; + } + increaseHalfSize(e) { + this.halfSize *= e, this.updateBoundsRadiusFromHalfSize(); + } + updateBoundsRadiusFromHalfSize() { + this.bounds[3] = this.halfSize * VPt; + } + advance(e) { + let i = this.node.children[e]; + i || (i = KV.createEmptyNode(), this.node.children[e] = i), this.node = i, this.halfSize /= 2, this.depth++; + const r = BPt[e]; + return this.bounds[0] += r[0] * this.halfSize, this.bounds[1] += r[1] * this.halfSize, this.bounds[2] += r[2] * this.halfSize, this.updateBoundsRadiusFromHalfSize(), this; + } + advanceTo(e, i, r = !1) { + for (; ; ) { + if (this.isTerminalFor(e)) + return i && i(this, -1), !0; + if (this.isLeaf()) { + if (!r) + return i && i(this, -1), !1; + this.node.residents = null; + } + const n = this._childIndex(e); + i && i(this, n), this.advance(n); + } + } + isLeaf() { + return this.node.residents != null; + } + isTerminalFor(e) { + return e[3] > this.halfSize / 2; + } + _childIndex(e) { + const i = this.bounds; + return (i[0] < e[0] ? 1 : 0) + (i[1] < e[1] ? 2 : 0) + (i[2] < e[2] ? 4 : 0); + } + static createEmptyNode() { + return { children: [null, null, null, null, null, null, null, null], terminals: new Qm({ shrink: !0 }), residents: new Qm({ shrink: !0 }) }; + } + static acquire() { + return KV._pool.acquire(); + } + static release(e) { + KV._pool.release(e); + } + static clearPool() { + KV._pool.prune(); + } +}; +function kGi(t, e) { + t[0] = Math.min(t[0], e[0] - e[3]), t[1] = Math.min(t[1], e[1] - e[3]), t[2] = Math.min(t[2], e[2] - e[3]); +} +function $Gi(t, e) { + t[0] = Math.max(t[0], e[0] + e[3]), t[1] = Math.max(t[1], e[1] + e[3]), t[2] = Math.max(t[2], e[2] + e[3]); +} +function Roe(t, e, i) { + i[0] = t[0] + e, i[1] = t[1] + e, i[2] = t[2] + e; +} +function PQe(t, e, i, r) { + if (e === 1) { + const n = i(t[0]); + KU(n, r); + } else { + cb[0] = 1 / 0, cb[1] = 1 / 0, cb[2] = 1 / 0, hb[0] = -1 / 0, hb[1] = -1 / 0, hb[2] = -1 / 0; + for (let n = 0; n < e; n++) { + const s = i(t[n]); + xX(s[3]) && (kGi(cb, s), $Gi(hb, s)); + } + GZ(r, cb, hb, 0.5), r[3] = Math.max(hb[0] - cb[0], hb[1] - cb[1], hb[2] - cb[2]) / 2; + } +} +function BGi(t, e, i) { + if (!GN.length) + for (let r = 0; r < 8; ++r) + GN.push({ index: 0, distance: 0 }); + for (let r = 0; r < 8; ++r) { + const n = BPt[r]; + GN.data[r].index = r, GN.data[r].distance = gD(t, e, n); + } + GN.sort((r, n) => r.distance - n.distance); + for (let r = 0; r < 8; ++r) + i[r] = GN.data[r].index; +} +function Sxe(t, e) { + let i, r = 1 / 0; + for (let n = 0; n < 8; ++n) { + const s = gD(t, e, OQe[n]); + s < r && (r = s, i = OQe[n]); + } + return i; +} +function gD(t, e, i) { + return e * (t[0] * i[0] + t[1] * i[1] + t[2] * i[2]); +} +function xX(t) { + return !isNaN(t) && t !== -1 / 0 && t !== 1 / 0 && t > 0; +} +Qf._pool = new EI(Qf), function(t) { + var e; + (e = t.DepthOrder || (t.DepthOrder = {}))[e.FRONT_TO_BACK = 1] = "FRONT_TO_BACK", e[e.BACK_TO_FRONT = -1] = "BACK_TO_FRONT"; +}(tMe || (tMe = {})); +const BPt = [Na(-1, -1, -1), Na(1, -1, -1), Na(-1, 1, -1), Na(1, 1, -1), Na(-1, -1, 1), Na(1, -1, 1), Na(-1, 1, 1), Na(1, 1, 1)], OQe = [Na(-1, -1, -1), Na(-1, -1, 1), Na(-1, 1, -1), Na(-1, 1, 1), Na(1, -1, -1), Na(1, -1, 1), Na(1, 1, -1), Na(1, 1, 1)], VPt = Math.sqrt(3), rMe = [null]; +function VGi(t) { + return rMe[0] = t, rMe; +} +const Cxe = Wx(), pw = sn(), cb = sn(), hb = sn(), f5 = new Qm(), jGi = Wx(), OA = Wx(), Txe = Wx(), Exe = Wx(), Moe = [{ min: 0, max: 0 }, { min: 0, max: 0 }, { min: 0, max: 0 }], GN = new Qm(), RQe = [0, 0, 0, 0, 0, 0, 0, 0], MQe = tMe, GGi = 1e3; +function UGi(t, e, i) { + const r = Wx(), n = r; + return LCe(n, n, t, 0.5), LCe(n, n, e, 0.5), r[3] = AF(n, t), Zc(n, n, i), r; +} +let nMe = class { + constructor() { + this._idToComponent = /* @__PURE__ */ new Map(), this._components = new MQe((e) => e.bounds), this._edges = new MQe((e) => e.bounds), this._tmpLineSegment = mve(), this._tmpP1 = sn(), this._tmpP2 = sn(), this._tmpP3 = sn(), this.remoteClient = null; + } + async fetchCandidates(e, i) { + await Promise.resolve(), hn(i), await this._ensureEdgeLocations(e, i); + const r = []; + return this._edges.forEachNeighbor((n) => (this._addCandidates(e, n, r), r.length < GGi), e.bounds), { result: { candidates: r } }; + } + async _ensureEdgeLocations(e, i) { + const r = []; + if (this._components.forEachNeighbor((o) => { + if (ut(o.info)) { + const { id: a, uid: l } = o; + r.push({ id: a, uid: l }); + } + return !0; + }, e.bounds), !r.length) + return; + const n = { components: r }, s = await this.remoteClient.invoke("fetchAllEdgeLocations", n, Gu(i, {})); + for (const o of s.components) + this._setFetchEdgeLocations(o); + } + async add(e) { + const i = new jPt(e.id, e.bounds); + return this._idToComponent.set(i.id, i), this._components.add([i]), { result: {} }; + } + async remove(e) { + const i = this._idToComponent.get(e.id); + if (i) { + const r = []; + this._edges.forEachNeighbor((n) => (n.component === i && r.push(n), !0), i.bounds), this._edges.remove(r), this._components.remove([i]), this._idToComponent.delete(i.id); + } + return { result: {} }; + } + _setFetchEdgeLocations(e) { + const i = this._idToComponent.get(e.id); + if (ut(i) || e.uid !== i.uid) + return; + const r = nAt.createView(e.locations), n = new Array(r.count), s = sn(), o = sn(); + for (let c = 0; c < r.count; c++) { + r.position0.getVec(c, s), r.position1.getVec(c, o); + const h = UGi(s, o, e.origin), p = new HGi(i, c, h); + n[c] = p; + } + this._edges.add(n); + const { objectIds: a, origin: l } = e; + i.info = { locations: r, objectIds: a, origin: l }; + } + _addCandidates(e, i, r) { + const { info: n } = i.component, { origin: s, objectIds: o } = n, a = n.locations, l = a.position0.getVec(i.index, this._tmpP1), c = a.position1.getVec(i.index, this._tmpP2); + Zc(l, l, s), Zc(c, c, s); + const h = o[a.componentIndex.get(i.index)]; + this._addEdgeCandidate(e, h, l, c, r), this._addVertexCandidate(e, h, l, r), this._addVertexCandidate(e, h, c, r); + } + _addEdgeCandidate(e, i, r, n, s) { + if (!(e.types & $$.EDGE)) + return; + const o = e.bounds, a = yGi(r, n, this._tmpLineSegment), l = vGi(a, o, this._tmpP3); + ZRe(e.bounds, l) && s.push({ type: "edge", objectId: i, target: ym(l), distance: AF(o, l), start: ym(r), end: ym(n) }); + } + _addVertexCandidate(e, i, r, n) { + if (!(e.types & $$.VERTEX)) + return; + const s = e.bounds; + ZRe(e.bounds, r) && n.push({ type: "vertex", objectId: i, target: ym(r), distance: AF(s, r) }); + } +}; +nMe = E([dt("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")], nMe); +const zGi = nMe; +let jPt = class GPt { + constructor(e, i) { + this.id = e, this.bounds = i, this.info = null, this.uid = ++GPt.uid; + } +}; +jPt.uid = 0; +let HGi = class { + constructor(e, i, r) { + this.component = e, this.index = i, this.bounds = r; + } +}; +const WGi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: zGi +}, Symbol.toStringTag, { value: "Module" })); +var Tfe, DQe; +(function(t) { + t[t.None = 0] = "None", t[t.Int16 = 1] = "Int16", t[t.Int32 = 2] = "Int32"; +})(Tfe || (Tfe = {})), function(t) { + t[t.Replace = 0] = "Replace", t[t.Outside = 1] = "Outside", t[t.Inside = 2] = "Inside", t[t.Finished = 3] = "Finished"; +}(DQe || (DQe = {})); +function qGi() { + return Ixe || (Ixe = new Promise((t) => Promise.resolve().then(() => fMr).then((e) => e.i).then(({ default: e }) => { + const i = e({ locateFile: YGi, onRuntimeInitialized: () => t(i) }); + delete i.then; + })).catch((t) => { + throw t; + })), Ixe; +} +function YGi(t) { + return Ql(`esri/libs/i3s/${t}`); +} +let Ixe; +var FQe, bG, LQe, NQe, kQe; +(function(t) { + t[t.Unmodified = 0] = "Unmodified", t[t.Culled = 1] = "Culled", t[t.NotChecked = 2] = "NotChecked"; +})(FQe || (FQe = {})), function(t) { + t[t.Unmodified = 0] = "Unmodified", t[t.PotentiallyModified = 1] = "PotentiallyModified", t[t.Culled = 2] = "Culled", t[t.Unknown = 3] = "Unknown", t[t.NotChecked = 4] = "NotChecked"; +}(bG || (bG = {})); +(function(t) { + t[t.Unknown = 0] = "Unknown", t[t.Uncached = 1] = "Uncached", t[t.Cached = 2] = "Cached"; +})(LQe || (LQe = {})), function(t) { + t[t.None = 0] = "None", t[t.MaxScreenThreshold = 1] = "MaxScreenThreshold", t[t.ScreenSpaceRelative = 2] = "ScreenSpaceRelative", t[t.RemovedFeatureDiameter = 3] = "RemovedFeatureDiameter", t[t.DistanceRangeFromDefaultCamera = 4] = "DistanceRangeFromDefaultCamera"; +}(NQe || (NQe = {})), function(t) { + t[t.Hole = 0] = "Hole", t[t.Leaf = 1] = "Leaf"; +}(kQe || (kQe = {})); +async function XGi(t) { + await oH(); + const e = [t.geometryBuffer]; + return { result: zPt(t, e), transferList: e }; +} +async function KGi(t) { + await oH(); + const e = [t.geometryBuffer], { geometryBuffer: i } = t, r = i.byteLength, n = Pd._malloc(r), s = new Uint8Array(Pd.HEAPU8.buffer, n, r); + s.set(new Uint8Array(i)); + const o = Pd.dracoDecompressPointCloudData(n, s.byteLength); + if (Pd._free(n), o.error.length > 0) + throw new Error(`i3s.wasm: ${o.error}`); + const a = o.featureIds?.length > 0 ? o.featureIds.slice() : null, l = o.positions.slice(); + return a && e.push(a.buffer), e.push(l.buffer), { result: { positions: l, featureIds: a }, transferList: e }; +} +async function JGi(t) { + await oH(), HPt(t); + const e = { buffer: t.buffer }; + return { result: e, transferList: [e.buffer] }; +} +async function ZGi(t) { + await oH(), UPt(t); +} +async function QGi(t) { + await oH(), Pd.setLegacySchema(t.context, t.jsonSchema); +} +function e7i(t) { + WPt(t); +} +let Doe, Pd; +function UPt(t) { + const e = t.modifications, i = Pd._malloc(8 * e.length), r = new Float64Array(Pd.HEAPU8.buffer, i, e.length); + for (let n = 0; n < e.length; ++n) + r[n] = e[n]; + Pd.setModifications(t.context, i, e.length, t.isGeodetic), Pd._free(i); +} +function zPt(t, e) { + if (!Pd) + return null; + const { context: i, localOrigin: r, globalTrafo: n, mbs: s, obb: o, elevationOffset: a, geometryBuffer: l, geometryDescriptor: c, indexToVertexProjector: h, vertexToRenderProjector: p } = t, y = Pd._malloc(l.byteLength), v = 33, x = Pd._malloc(v * Float64Array.BYTES_PER_ELEMENT), I = new Uint8Array(Pd.HEAPU8.buffer, y, l.byteLength); + I.set(new Uint8Array(l)); + const P = new Float64Array(Pd.HEAPU8.buffer, x, v); + gB(P, r); + let F = P.byteOffset + 3 * P.BYTES_PER_ELEMENT, k = new Float64Array(P.buffer, F); + gB(k, n), F += 16 * P.BYTES_PER_ELEMENT, k = new Float64Array(P.buffer, F), gB(k, s), F += 4 * P.BYTES_PER_ELEMENT, _e(o) && (k = new Float64Array(P.buffer, F), gB(k, o.center), F += 3 * P.BYTES_PER_ELEMENT, k = new Float64Array(P.buffer, F), gB(k, o.halfSize), F += 3 * P.BYTES_PER_ELEMENT, k = new Float64Array(P.buffer, F), gB(k, o.quaternion)); + const V = c, j = { isDraco: !1, isLegacy: !1, color: t.layouts.some((Me) => Me.some((ke) => ke.name === "color")), normal: t.needNormals && t.layouts.some((Me) => Me.some((ke) => ke.name === "normalCompressed")), uv0: t.layouts.some((Me) => Me.some((ke) => ke.name === "uv0")), uvRegion: t.layouts.some((Me) => Me.some((ke) => ke.name === "uvRegion")), featureIndex: V.featureIndex }, Y = Pd.process(i, !!t.obb, y, I.byteLength, V, j, x, a, h, p, t.normalReferenceFrame); + if (Pd._free(x), Pd._free(y), Y.error.length > 0) + throw new Error(`i3s.wasm: ${Y.error}`); + if (Y.discarded) + return null; + const X = Y.componentOffsets.length > 0 ? Y.componentOffsets.slice() : null, Q = Y.featureIds.length > 0 ? Y.featureIds.slice() : null, re = Y.interleavedVertedData.slice().buffer, he = Y.indicesType === Tfe.Int16 ? new Uint16Array(Y.indices.buffer, Y.indices.byteOffset, Y.indices.byteLength / 2).slice() : new Uint32Array(Y.indices.buffer, Y.indices.byteOffset, Y.indices.byteLength / 4).slice(), fe = Y.positions.slice(), be = Y.positionIndicesType === Tfe.Int16 ? new Uint16Array(Y.positionIndices.buffer, Y.positionIndices.byteOffset, Y.positionIndices.byteLength / 2).slice() : new Uint32Array(Y.positionIndices.buffer, Y.positionIndices.byteOffset, Y.positionIndices.byteLength / 4).slice(), Se = { layout: t.layouts[0], interleavedVertexData: re, indices: he, hasColors: Y.hasColors, hasModifications: Y.hasModifications, positionData: { data: fe, indices: be } }; + return Q && e.push(Q.buffer), X && e.push(X.buffer), e.push(re), e.push(he.buffer), e.push(fe.buffer), e.push(be.buffer), { componentOffsets: X, featureIds: Q, transformedGeometry: Se, obb: Y.obb }; +} +function t7i(t) { + return t === 0 ? bG.Unmodified : t === 1 ? bG.PotentiallyModified : t === 2 ? bG.Culled : bG.Unknown; +} +function HPt(t) { + const { context: e, buffer: i } = t, r = Pd._malloc(i.byteLength), n = i.byteLength / Float64Array.BYTES_PER_ELEMENT, s = new Float64Array(Pd.HEAPU8.buffer, r, n), o = new Float64Array(i); + s.set(o), Pd.filterOBBs(e, r, n), o.set(s), Pd._free(r); +} +function WPt(t) { + Pd && Pd.destroy(t); +} +function gB(t, e) { + for (let i = 0; i < e.length; ++i) + t[i] = e[i]; +} +function oH() { + return Pd ? Promise.resolve() : (Doe || (Doe = qGi().then((t) => { + Pd = t, Doe = null; + })), Doe); +} +const i7i = { transform: zPt, destroy: WPt }, r7i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + destroyContext: e7i, + dracoDecompressPointCloudData: KGi, + filterObbsForModifications: JGi, + filterObbsForModificationsSync: HPt, + initialize: oH, + interpretObbModificationResults: t7i, + process: XGi, + setLegacySchema: QGi, + setModifications: ZGi, + setModificationsSync: UPt, + test: i7i +}, Symbol.toStringTag, { value: "Module" })); +function n7i(t) { + return o7i(t) ?? s7i(t); +} +function s7i(t) { + const e = new Date(t).getTime(); + return Number.isNaN(e) ? null : e; +} +function o7i(t) { + const e = a7i.exec(t); + if (!e?.groups) + return null; + const i = e.groups, r = +i.year, n = +i.month - 1, s = +i.day, o = +(i.hours ?? "0"), a = +(i.minutes ?? "0"), l = +(i.seconds ?? "0"); + if (o > 23 || a > 59 || l > 59) + return null; + const c = i.ms ?? "0", h = c ? +c.padEnd(3, "0").substring(0, 3) : 0; + let p; + if (i.isUTC) + p = Date.UTC(r, n, s, o, a, l, h); + else if (i.offsetSign) { + const y = +i.offsetHours, v = +i.offsetMinutes; + p = 6e4 * (i.offsetSign === "+" ? -1 : 1) * (60 * y + v) + Date.UTC(r, n, s, o, a, l, h); + } else + p = new Date(r, n, s, o, a, l, h).getTime(); + return Number.isNaN(p) ? null : p; +} +const a7i = /^(?:(?-?\d{4,})-(?\d{2})-(?\d{2}))(?:T(?\d{2}):(?\d{2}):(?\d{2})(?:\.(?\d+))?)?(?:(?Z)|(?:(?\+|-)(?\d{2}):(?\d{2})))?$/; +function l4(t, e) { + if (t && e) { + for (const i of t.children) + if (i.localName in e) { + const r = e[i.localName]; + if (typeof r == "function") { + const n = r(i); + n && l4(i, n); + } else + l4(i, r); + } + } +} +function* dee(t, e) { + for (const i of t.children) + if (i.localName in e) { + const r = e[i.localName]; + typeof r == "function" ? yield r(i) : yield* dee(i, r); + } +} +const Axe = "xlink:href", pee = "2.0.0", sMe = "__esri_wfs_id__", l7i = "wfs-layer:getWFSLayerTypeInfo-error", u7i = "wfs-layer:empty-service", qPt = "wfs-layer:feature-type-not-found", c7i = "wfs-layer:geojson-not-supported", h7i = "wfs-layer:kvp-encoding-not-supported", d7i = "wfs-layer:malformed-json", YPt = "wfs-layer:unknown-geometry-type", p7i = "wfs-layer:unknown-field-type", f7i = "wfs-layer:unsupported-spatial-reference", m7i = "wfs-layer:unsupported-wfs-version"; +async function g7i(t, e) { + const i = y7i((await ir(t, { responseType: "text", query: { SERVICE: "WFS", REQUEST: "GetCapabilities", VERSION: pee, ...e?.customParameters }, signal: e?.signal })).data); + return b7i(t, i), i; +} +function y7i(t) { + const e = QPt(t); + R7i(e), eOt(e); + const i = e.firstElementChild, r = d$t(w7i(i)); + return { operations: _7i(i), get featureTypes() { + return Array.from(r()); + }, readFeatureTypes: r }; +} +const v7i = /* @__PURE__ */ new Set(["json", "application/json", "geojson", "application/json; subtype=geojson"]); +function _7i(t) { + let e = !1; + const i = { GetCapabilities: { url: "" }, DescribeFeatureType: { url: "" }, GetFeature: { url: "", outputFormat: null, supportsPagination: !1 } }; + if (l4(t, { OperationsMetadata: { Operation: (r) => { + switch (r.getAttribute("name")) { + case "GetCapabilities": + return { DCP: { HTTP: { Get: (n) => { + i.GetCapabilities.url = n.getAttribute(Axe); + } } } }; + case "DescribeFeatureType": + return { DCP: { HTTP: { Get: (n) => { + i.DescribeFeatureType.url = n.getAttribute(Axe); + } } } }; + case "GetFeature": + return { DCP: { HTTP: { Get: (n) => { + i.GetFeature.url = n.getAttribute(Axe); + } } }, Parameter: (n) => { + if (n.getAttribute("name") === "outputFormat") + return { AllowedValues: { Value: (s) => { + const o = s.textContent; + o && v7i.has(o.toLowerCase()) && (i.GetFeature.outputFormat = o); + } } }; + } }; + } + }, Constraint: (r) => { + switch (r.getAttribute("name")) { + case "KVPEncoding": + return { DefaultValue: (n) => { + e = n.textContent.toLowerCase() === "true"; + } }; + case "ImplementsResultPaging": + return { DefaultValue: (n) => { + i.GetFeature.supportsPagination = n.textContent.toLowerCase() === "true"; + } }; + } + } } }), !e) + throw new ot(h7i, "WFS service doesn't support key/value pair (KVP) encoding"); + if (ut(i.GetFeature.outputFormat)) + throw new ot(c7i, "WFS service doesn't support GeoJSON output format"); + return i; +} +function b7i(t, e) { + vct(t) && (v0(t, e.operations.DescribeFeatureType.url, !0) && (e.operations.DescribeFeatureType.url = $Z(e.operations.DescribeFeatureType.url)), v0(t, e.operations.GetFeature.url, !0) && (e.operations.GetFeature.url = $Z(e.operations.GetFeature.url))); +} +function w7i(t) { + return dee(t, { FeatureTypeList: { FeatureType: (e) => { + const i = { typeName: "undefined:undefined", name: "", title: "", description: "", extent: null, namespacePrefix: "", namespaceUri: "", supportedSpatialReferences: [] }, r = /* @__PURE__ */ new Set([4326]), n = (s) => { + const o = parseInt(s.textContent?.match(/(?\d+$)/i)?.groups?.wkid ?? "", 10); + Number.isNaN(o) || r.add(o); + }; + return l4(e, { Name: (s) => { + const { name: o, prefix: a } = fee(s.textContent); + i.typeName = `${a}:${o}`, i.name = o, i.namespacePrefix = a, i.namespaceUri = s.lookupNamespaceURI(a); + }, Abstract: (s) => { + i.description = s.textContent; + }, Title: (s) => { + i.title = s.textContent; + }, WGS84BoundingBox: (s) => { + i.extent = x7i(s); + }, DefaultSRS: n, DefaultCRS: n, OtherSRS: n, OtherCRS: n }), i.title || (i.title = i.name), i.supportedSpatialReferences.push(...r), i; + } } }); +} +function x7i(t) { + let e, i, r, n; + for (const s of t.children) + switch (s.localName) { + case "LowerCorner": + [e, i] = s.textContent.split(" ").map((o) => Number.parseFloat(o)); + break; + case "UpperCorner": + [r, n] = s.textContent.split(" ").map((o) => Number.parseFloat(o)); + } + return { xmin: e, ymin: i, xmax: r, ymax: n, spatialReference: gm }; +} +function XPt(t, e, i) { + return rhe(t, (r) => i ? r.name === e && r.namespaceUri === i : r.typeName === e || r.name === e); +} +async function S7i(t, e, i, r = {}) { + const { featureType: n, extent: s } = await C7i(t, e, i, r), { fields: o, geometryType: a, swapXY: l, objectIdField: c, geometryField: h } = await T7i(t, n.typeName, r); + return { url: t.operations.GetCapabilities.url, name: n.name, namespaceUri: n.namespaceUri, fields: o, geometryField: h, geometryType: a, objectIdField: c, spatialReference: r.spatialReference ?? or.WGS84, extent: s, swapXY: l, wfsCapabilities: t, customParameters: r.customParameters }; +} +async function C7i(t, e, i, r = {}) { + const { spatialReference: n = or.WGS84 } = r, s = t.readFeatureTypes(), o = e ? XPt(s, e, i) : s.next().value; + if (ut(o)) + throw e ? new ot(qPt, `The type '${e}' could not be found in the service`) : new ot(u7i, "The service is empty"); + let a = new br({ ...o.extent, spatialReference: n }); + if (!Ea(n, gm)) + try { + await LF(gm, n, void 0, r), a = Ip(a, gm); + } catch { + throw new ot(f7i, "Projection not supported"); + } + return { extent: a, spatialReference: n, featureType: o }; +} +async function T7i(t, e, i = {}) { + const [r, n] = await Nu([I7i(t.operations.DescribeFeatureType.url, e, i), E7i(t, e, i)]); + if (r.error || n.error) + throw new ot(l7i, `An error occurred while getting info about the feature type '${e}'`, { error: r.error || n.error }); + const { fields: s, errors: o } = r.value ?? {}, a = r.value?.geometryType || n.value?.geometryType, l = n.value?.swapXY ?? !1; + if (ut(a)) + throw new ot(YPt, `The geometry type could not be determined for type '${e}`, { typeName: e, geometryType: a, fields: s, errors: o }); + return { ...KPt(s ?? []), geometryType: a, swapXY: l }; +} +function KPt(t) { + const e = t.find((r) => r.type === "geometry"); + let i = t.find((r) => r.type === "oid"); + return t = t.filter((r) => r.type !== "geometry"), i || (i = new Uo({ name: sMe, type: "oid", alias: sMe }), t.unshift(i)), { geometryField: e?.name ?? null, objectIdField: i.name, fields: t }; +} +async function E7i(t, e, i = {}) { + let r, n = !1; + const [s, o] = await Promise.all([JPt(t.operations.GetFeature.url, e, t.operations.GetFeature.outputFormat, { ...i, count: 1 }), ir(t.operations.GetFeature.url, { responseType: "text", query: ZPt(e, void 0, { ...i, count: 1 }), signal: i?.signal })]), a = s.type === "FeatureCollection" && s.features[0]?.geometry; + if (a) { + let l; + switch (r = D0.fromJSON(ofe(a.type)), a.type) { + case "Point": + l = a.coordinates; + break; + case "LineString": + case "MultiPoint": + l = a.coordinates[0]; + break; + case "MultiLineString": + case "Polygon": + l = a.coordinates[0][0]; + break; + case "MultiPolygon": + l = a.coordinates[0][0][0]; + } + const c = /<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(o.data); + if (c) { + const h = l[0].toFixed(3), p = l[1].toFixed(3), y = parseFloat(c[1]).toFixed(3); + h === parseFloat(c[2]).toFixed(3) && p === y && (n = !0); + } + } + return { geometryType: r, swapXY: n }; +} +async function I7i(t, e, i) { + return A7i(e, (await ir(t, { responseType: "text", query: { SERVICE: "WFS", REQUEST: "DescribeFeatureType", VERSION: pee, TYPENAME: e, ...i?.customParameters }, signal: i?.signal })).data); +} +function A7i(t, e) { + const { name: i } = fee(t), r = QPt(e); + eOt(r); + const n = rhe(dee(r.firstElementChild, { element: (s) => ({ name: s.getAttribute("name"), typeName: fee(s.getAttribute("type")).name }) }), ({ name: s }) => s === i); + if (_e(n)) { + const s = rhe(dee(r.firstElementChild, { complexType: (o) => o }), (o) => o.getAttribute("name") === n.typeName); + if (_e(s)) + return O7i(s); + } + throw new ot(qPt, `Type '${t}' not found in document`, { document: new XMLSerializer().serializeToString(r) }); +} +const P7i = /* @__PURE__ */ new Set(["objectid", "fid"]); +function O7i(t) { + const e = [], i = []; + let r; + const n = dee(t, { complexContent: { extension: { sequence: { element: (s) => s } } } }); + for (const s of n) { + const o = s.getAttribute("name"); + if (!o) + continue; + let a, l; + if (s.hasAttribute("type") ? a = fee(s.getAttribute("type")).name : l4(s, { simpleType: { restriction: (p) => (a = fee(p.getAttribute("base")).name, { maxLength: (y) => { + l = +y.getAttribute("value"); + } }) } }), !a) + continue; + const c = s.getAttribute("nillable") === "true"; + let h = !1; + switch (a.toLowerCase()) { + case "integer": + case "nonpositiveinteger": + case "negativeinteger": + case "long": + case "int": + case "short": + case "byte": + case "nonnegativeinteger": + case "unsignedlong": + case "unsignedint": + case "unsignedshort": + case "unsignedbyte": + case "positiveinteger": + i.push(new Uo({ name: o, alias: o, type: "integer", nullable: c })); + break; + case "float": + case "double": + case "decimal": + i.push(new Uo({ name: o, alias: o, type: "double", nullable: c })); + break; + case "boolean": + case "string": + case "gyearmonth": + case "gyear": + case "gmonthday": + case "gday": + case "gmonth": + case "anyuri": + case "qname": + case "notation": + case "normalizedstring": + case "token": + case "language": + case "idrefs": + case "entities": + case "nmtoken": + case "nmtokens": + case "name": + case "ncname": + case "id": + case "idref": + case "entity": + case "duration": + case "time": + i.push(new Uo({ name: o, alias: o, type: "string", nullable: c, length: l ?? 255 })); + break; + case "datetime": + case "date": + i.push(new Uo({ name: o, alias: o, type: "date", nullable: c, length: l ?? 36 })); + break; + case "pointpropertytype": + r = "point", h = !0; + break; + case "multipointpropertytype": + r = "multipoint", h = !0; + break; + case "curvepropertytype": + case "multicurvepropertytype": + case "multilinestringpropertytype": + r = "polyline", h = !0; + break; + case "surfacepropertytype": + case "multisurfacepropertytype": + case "multipolygonpropertytype": + r = "polygon", h = !0; + break; + case "geometrypropertytype": + case "multigeometrypropertytype": + h = !0, e.push(new ot(YPt, `geometry type '${a}' is not supported`, { type: new XMLSerializer().serializeToString(t) })); + break; + default: + e.push(new ot(p7i, `Unknown field type '${a}'`, { type: new XMLSerializer().serializeToString(t) })); + } + h && i.push(new Uo({ name: o, alias: o, type: "geometry", nullable: c })); + } + for (const s of i) + if (s.type === "integer" && !s.nullable && P7i.has(s.name.toLowerCase())) { + s.type = "oid"; + break; + } + return { geometryType: r, fields: i, errors: e }; +} +async function JPt(t, e, i, r) { + let { data: n } = await ir(t, { responseType: "text", query: ZPt(e, i, r), signal: r?.signal }); + n = n.replace(/": +(-?\d+),(\d+)(,)?/g, '": $1.$2$3'); + try { + if (r?.dateFields?.length) { + const s = new Set(r.dateFields); + return JSON.parse(n, (o, a) => s.has(o) ? n7i(a) : a); + } + return JSON.parse(n); + } catch (s) { + throw new ot(d7i, "Error while parsing the response", { response: n, error: s }); + } +} +function ZPt(t, e, i) { + return { SERVICE: "WFS", REQUEST: "GetFeature", VERSION: pee, TYPENAMES: t, OUTPUTFORMAT: e, SRSNAME: "EPSG:4326", STARTINDEX: i?.startIndex, COUNT: i?.count, ...i?.customParameters }; +} +function QPt(t) { + return new DOMParser().parseFromString(t.trim(), "text/xml"); +} +function fee(t) { + const [e, i] = t.split(":"); + return { prefix: i ? e : "", name: i ?? e }; +} +function R7i(t) { + const e = t.firstElementChild?.getAttribute("version"); + if (e && e !== pee) + throw new ot(m7i, `Unsupported WFS version ${e}. Supported version: ${pee}`); +} +function eOt(t) { + let e = "", i = ""; + if (l4(t.firstElementChild, { Exception: (r) => (e = r.getAttribute("exceptionCode"), { ExceptionText: (n) => { + i = n.textContent; + } }) }), e) + throw new ot(`wfs-layer:${e}`, i); +} +let M7i = class { + constructor() { + this._queryEngine = null, this._customParameters = null, this._snapshotFeatures = async (e) => { + const { objectIdField: i } = this._queryEngine, r = await JPt(this._getFeatureUrl ?? "", this._featureType.typeName, this._getFeatureOutputFormat, { customParameters: this._customParameters, dateFields: this._queryEngine.fieldsIndex.dateFields.map((o) => o.name), signal: e }); + await _8e(r), hn(e); + const n = b8e(r, { geometryType: this._queryEngine.geometryType, hasZ: !1, objectIdField: i }); + if (!Ea(this._queryEngine.spatialReference, gm)) + for (const o of n) + _e(o.geometry) && (o.geometry = d8(Cp(zx(o.geometry, this._queryEngine.geometryType, !1, !1), gm, this._queryEngine.spatialReference))); + let s = 1; + for (const o of n) { + const a = {}; + B6(this._fieldsIndex, a, o.attributes, !0), o.attributes = a, o.attributes[i] == null && (o.objectId = o.attributes[i] = s++); + } + return n; + }; + } + destroy() { + this._queryEngine?.destroy(), this._queryEngine = null; + } + async load(e, i) { + const { getFeatureUrl: r, getFeatureOutputFormat: n, spatialReference: s, fields: o, geometryType: a, featureType: l, objectIdField: c, customParameters: h } = e; + this._featureType = l, this._customParameters = h, this._getFeatureUrl = r, this._getFeatureOutputFormat = n, this._fieldsIndex = new sg(o), await this._checkProjection(s), hn(i), this._queryEngine = new B$({ fields: o, geometryType: a, hasM: !1, hasZ: !1, objectIdField: c, spatialReference: s, timeInfo: null, featureStore: new zie({ geometryType: a, hasM: !1, hasZ: !1 }) }); + const p = await this._snapshotFeatures(i.signal); + return this._queryEngine.featureStore.addMany(p), { extent: (await this._queryEngine.fetchRecomputedExtents()).fullExtent }; + } + async applyEdits() { + throw new ot("wfs-source:editing-not-supported", "applyEdits() is not supported on WFSLayer"); + } + async queryFeatures(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQuery(e, i.signal); + } + async queryFeatureCount(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForCount(e, i.signal); + } + async queryObjectIds(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForIds(e, i.signal); + } + async queryExtent(e = {}, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForExtent(e, i.signal); + } + async querySnapping(e, i = {}) { + return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForSnapping(e, i.signal); + } + async refresh(e) { + return this._customParameters = e, this._snapshotTask?.abort(), this._snapshotTask = iI(this._snapshotFeatures), this._snapshotTask.promise.then((i) => { + this._queryEngine.featureStore.clear(), i && this._queryEngine.featureStore.addMany(i); + }, (i) => { + this._queryEngine.featureStore.clear(), us(i) || Ei.getLogger("esri.layers.WFSLayer").error(new ot("wfs-layer:getfeature-error", "An error occurred during the GetFeature request", { error: i })); + }), await this._waitSnapshotComplete(), { extent: (await this._queryEngine.fetchRecomputedExtents()).fullExtent }; + } + async _waitSnapshotComplete() { + if (this._snapshotTask && !this._snapshotTask.finished) { + try { + await this._snapshotTask.promise; + } catch { + } + return this._waitSnapshotComplete(); + } + } + async _checkProjection(e) { + try { + await Py(gm, e); + } catch { + throw new ot("unsupported-projection", "Projection not supported", { spatialReference: e }); + } + } +}; +const D7i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: M7i +}, Symbol.toStringTag, { value: "Module" })); +var Pg, _p, Tf; +(function(t) { + t[t.FILL = 1] = "FILL", t[t.LINE = 2] = "LINE", t[t.SYMBOL = 3] = "SYMBOL", t[t.CIRCLE = 4] = "CIRCLE"; +})(Pg || (Pg = {})), function(t) { + t[t.BACKGROUND = 0] = "BACKGROUND", t[t.FILL = 1] = "FILL", t[t.OUTLINE = 2] = "OUTLINE", t[t.LINE = 3] = "LINE", t[t.ICON = 4] = "ICON", t[t.CIRCLE = 5] = "CIRCLE", t[t.TEXT = 6] = "TEXT", t[t.TILEINFO = 7] = "TILEINFO"; +}(_p || (_p = {})), function(t) { + t[t.PAINTER_CHANGED = 0] = "PAINTER_CHANGED", t[t.LAYOUT_CHANGED = 1] = "LAYOUT_CHANGED", t[t.LAYER_CHANGED = 2] = "LAYER_CHANGED", t[t.LAYER_REMOVED = 3] = "LAYER_REMOVED", t[t.SPRITES_CHANGED = 4] = "SPRITES_CHANGED"; +}(Tf || (Tf = {})); +const F7i = 512; +var py, Ig; +(function(t) { + t[t.Unknown = 0] = "Unknown", t[t.Point = 1] = "Point", t[t.LineString = 2] = "LineString", t[t.Polygon = 3] = "Polygon"; +})(py || (py = {})); +let Jo = class cce { + constructor(e, i) { + this.x = e, this.y = i; + } + clone() { + return new cce(this.x, this.y); + } + equals(e, i) { + return e === this.x && i === this.y; + } + isEqual(e) { + return e.x === this.x && e.y === this.y; + } + setCoords(e, i) { + this.x = e, this.y = i; + } + normalize() { + const e = this.x, i = this.y, r = Math.sqrt(e * e + i * i); + this.x /= r, this.y /= r; + } + rightPerpendicular() { + const e = this.x; + this.x = this.y, this.y = -e; + } + move(e, i) { + this.x += e, this.y += i; + } + assign(e) { + this.x = e.x, this.y = e.y; + } + assignAdd(e, i) { + this.x = e.x + i.x, this.y = e.y + i.y; + } + assignSub(e, i) { + this.x = e.x - i.x, this.y = e.y - i.y; + } + rotate(e, i) { + const r = this.x, n = this.y; + this.x = r * e - n * i, this.y = r * i + n * e; + } + scale(e) { + this.x *= e, this.y *= e; + } + length() { + const e = this.x, i = this.y; + return Math.sqrt(e * e + i * i); + } + static distance(e, i) { + const r = i.x - e.x, n = i.y - e.y; + return Math.sqrt(r * r + n * n); + } + static add(e, i) { + return new cce(e.x + i.x, e.y + i.y); + } + static sub(e, i) { + return new cce(e.x - i.x, e.y - i.y); + } +}, Foe = class { + constructor(e, i, r) { + this.ratio = e, this.x = i, this.y = r; + } +}, Xie = class { + constructor(e, i, r, n = 8, s = 8) { + this._lines = [], this._starts = [], this.validateTessellation = !0, this._pixelRatio = n, this._pixelMargin = s, this._tileSize = F7i * n, this._dz = e, this._yPos = i, this._xPos = r; + } + setPixelMargin(e) { + e !== this._pixelMargin && (this._pixelMargin = e, this.setExtent(this._extent)); + } + setExtent(e) { + this._extent = e, this._finalRatio = this._tileSize / e * (1 << this._dz); + let i = this._pixelRatio * this._pixelMargin; + i /= this._finalRatio; + const r = e >> this._dz; + i > r && (i = r), this._margin = i, this._xmin = r * this._xPos - i, this._ymin = r * this._yPos - i, this._xmax = this._xmin + r + 2 * i, this._ymax = this._ymin + r + 2 * i; + } + reset(e) { + this._type = e, this._lines = [], this._starts = [], this._line = null, this._start = 0; + } + moveTo(e, i) { + this._pushLine(), this._prevIsIn = this._isIn(e, i), this._moveTo(e, i, this._prevIsIn), this._prevPt = new Jo(e, i), this._firstPt = new Jo(e, i), this._dist = 0; + } + lineTo(e, i) { + const r = this._isIn(e, i), n = new Jo(e, i), s = Jo.distance(this._prevPt, n); + let o, a, l, c, h, p, y, v; + if (r) + this._prevIsIn ? this._lineTo(e, i, !0) : (o = this._prevPt, a = n, l = this._intersect(a, o), this._start = this._dist + s * (1 - this._r), this._lineTo(l.x, l.y, !0), this._lineTo(a.x, a.y, !0)); + else if (this._prevIsIn) + a = this._prevPt, o = n, l = this._intersect(a, o), this._lineTo(l.x, l.y, !0), this._lineTo(o.x, o.y, !1); + else { + const x = this._prevPt, I = n; + if (x.x <= this._xmin && I.x <= this._xmin || x.x >= this._xmax && I.x >= this._xmax || x.y <= this._ymin && I.y <= this._ymin || x.y >= this._ymax && I.y >= this._ymax) + this._lineTo(I.x, I.y, !1); + else { + const P = []; + if ((x.x < this._xmin && I.x > this._xmin || x.x > this._xmin && I.x < this._xmin) && (c = (this._xmin - x.x) / (I.x - x.x), v = x.y + c * (I.y - x.y), v <= this._ymin ? p = !1 : v >= this._ymax ? p = !0 : P.push(new Foe(c, this._xmin, v))), (x.x < this._xmax && I.x > this._xmax || x.x > this._xmax && I.x < this._xmax) && (c = (this._xmax - x.x) / (I.x - x.x), v = x.y + c * (I.y - x.y), v <= this._ymin ? p = !1 : v >= this._ymax ? p = !0 : P.push(new Foe(c, this._xmax, v))), (x.y < this._ymin && I.y > this._ymin || x.y > this._ymin && I.y < this._ymin) && (c = (this._ymin - x.y) / (I.y - x.y), y = x.x + c * (I.x - x.x), y <= this._xmin ? h = !1 : y >= this._xmax ? h = !0 : P.push(new Foe(c, y, this._ymin))), (x.y < this._ymax && I.y > this._ymax || x.y > this._ymax && I.y < this._ymax) && (c = (this._ymax - x.y) / (I.y - x.y), y = x.x + c * (I.x - x.x), y <= this._xmin ? h = !1 : y >= this._xmax ? h = !0 : P.push(new Foe(c, y, this._ymax))), P.length === 0) + h ? p ? this._lineTo(this._xmax, this._ymax, !0) : this._lineTo(this._xmax, this._ymin, !0) : p ? this._lineTo(this._xmin, this._ymax, !0) : this._lineTo(this._xmin, this._ymin, !0); + else if (P.length > 1 && P[0].ratio > P[1].ratio) + this._start = this._dist + s * P[1].ratio, this._lineTo(P[1].x, P[1].y, !0), this._lineTo(P[0].x, P[0].y, !0); + else { + this._start = this._dist + s * P[0].ratio; + for (let F = 0; F < P.length; F++) + this._lineTo(P[F].x, P[F].y, !0); + } + this._lineTo(I.x, I.y, !1); + } + } + this._dist += s, this._prevIsIn = r, this._prevPt = n; + } + close() { + if (this._line.length > 2) { + const e = this._firstPt, i = this._prevPt; + e.x === i.x && e.y === i.y || this.lineTo(e.x, e.y); + const r = this._line; + let n = r.length; + for (; n >= 4 && (r[0].x === r[1].x && r[0].x === r[n - 2].x || r[0].y === r[1].y && r[0].y === r[n - 2].y); ) + r.pop(), r[0].x = r[n - 2].x, r[0].y = r[n - 2].y, --n; + } + } + result(e = !0) { + return this._pushLine(), this._lines.length === 0 ? null : (this._type === py.Polygon && e && N7i.simplify(this._tileSize, this._margin * this._finalRatio, this._lines), this._lines); + } + resultWithStarts() { + if (this._type !== py.LineString) + throw new Error("Only valid for lines"); + this._pushLine(); + const e = this._lines, i = e.length; + if (i === 0) + return null; + const r = []; + for (let n = 0; n < i; n++) + r.push({ line: e[n], start: this._starts[n] || 0 }); + return r; + } + _isIn(e, i) { + return e >= this._xmin && e <= this._xmax && i >= this._ymin && i <= this._ymax; + } + _intersect(e, i) { + let r, n, s; + if (i.x >= this._xmin && i.x <= this._xmax) + n = i.y <= this._ymin ? this._ymin : this._ymax, s = (n - e.y) / (i.y - e.y), r = e.x + s * (i.x - e.x); + else if (i.y >= this._ymin && i.y <= this._ymax) + r = i.x <= this._xmin ? this._xmin : this._xmax, s = (r - e.x) / (i.x - e.x), n = e.y + s * (i.y - e.y); + else { + n = i.y <= this._ymin ? this._ymin : this._ymax, r = i.x <= this._xmin ? this._xmin : this._xmax; + const o = (r - e.x) / (i.x - e.x), a = (n - e.y) / (i.y - e.y); + o < a ? (s = o, n = e.y + o * (i.y - e.y)) : (s = a, r = e.x + a * (i.x - e.x)); + } + return this._r = s, new Jo(r, n); + } + _pushLine() { + this._line && (this._type === py.Point ? this._line.length > 0 && (this._lines.push(this._line), this._starts.push(this._start)) : this._type === py.LineString ? this._line.length > 1 && (this._lines.push(this._line), this._starts.push(this._start)) : this._type === py.Polygon && this._line.length > 3 && (this._lines.push(this._line), this._starts.push(this._start))), this._line = [], this._start = 0; + } + _moveTo(e, i, r) { + this._type !== py.Polygon ? r && (e = Math.round((e - (this._xmin + this._margin)) * this._finalRatio), i = Math.round((i - (this._ymin + this._margin)) * this._finalRatio), this._line.push(new Jo(e, i))) : (r || (e < this._xmin && (e = this._xmin), e > this._xmax && (e = this._xmax), i < this._ymin && (i = this._ymin), i > this._ymax && (i = this._ymax)), e = Math.round((e - (this._xmin + this._margin)) * this._finalRatio), i = Math.round((i - (this._ymin + this._margin)) * this._finalRatio), this._line.push(new Jo(e, i)), this._isH = !1, this._isV = !1); + } + _lineTo(e, i, r) { + let n, s; + if (this._type !== py.Polygon) + if (r) { + if (e = Math.round((e - (this._xmin + this._margin)) * this._finalRatio), i = Math.round((i - (this._ymin + this._margin)) * this._finalRatio), this._line.length > 0 && (n = this._line[this._line.length - 1], n.equals(e, i))) + return; + this._line.push(new Jo(e, i)); + } else + this._line && this._line.length > 0 && this._pushLine(); + else if (r || (e < this._xmin && (e = this._xmin), e > this._xmax && (e = this._xmax), i < this._ymin && (i = this._ymin), i > this._ymax && (i = this._ymax)), e = Math.round((e - (this._xmin + this._margin)) * this._finalRatio), i = Math.round((i - (this._ymin + this._margin)) * this._finalRatio), this._line && this._line.length > 0) { + n = this._line[this._line.length - 1]; + const o = n.x === e, a = n.y === i; + if (o && a) + return; + this._isH && o || this._isV && a ? (n.x = e, n.y = i, s = this._line[this._line.length - 2], s.x === e && s.y === i ? (this._line.pop(), this._line.length <= 1 ? (this._isH = !1, this._isV = !1) : (s = this._line[this._line.length - 2], this._isH = s.x === e, this._isV = s.y === i)) : (this._isH = s.x === e, this._isV = s.y === i)) : (this._line.push(new Jo(e, i)), this._isH = o, this._isV = a); + } else + this._line.push(new Jo(e, i)); + } +}, L7i = class { + setExtent(e) { + this._ratio = e === 4096 ? 1 : 4096 / e; + } + get validateTessellation() { + return this._ratio < 1; + } + reset(e) { + this._lines = [], this._line = null; + } + moveTo(e, i) { + this._line && this._lines.push(this._line), this._line = []; + const r = this._ratio; + this._line.push(new Jo(e * r, i * r)); + } + lineTo(e, i) { + const r = this._ratio; + this._line.push(new Jo(e * r, i * r)); + } + close() { + const e = this._line; + e && !e[0].isEqual(e[e.length - 1]) && e.push(e[0]); + } + result() { + return this._line && this._lines.push(this._line), this._lines.length === 0 ? null : this._lines; + } +}; +(function(t) { + t[t.sideLeft = 0] = "sideLeft", t[t.sideRight = 1] = "sideRight", t[t.sideTop = 2] = "sideTop", t[t.sideBottom = 3] = "sideBottom"; +})(Ig || (Ig = {})); +let N7i = class $M { + static simplify(e, i, r) { + if (!r) + return; + const n = -i, s = e + i, o = -i, a = e + i, l = [], c = [], h = r.length; + for (let y = 0; y < h; ++y) { + const v = r[y]; + if (!v || v.length < 2) + continue; + let x, I = v[0]; + const P = v.length; + for (let F = 1; F < P; ++F) + x = v[F], I.x === x.x && (I.x <= n && (I.y > x.y ? (l.push(y), l.push(F), l.push(Ig.sideLeft), l.push(-1)) : (c.push(y), c.push(F), c.push(Ig.sideLeft), c.push(-1))), I.x >= s && (I.y < x.y ? (l.push(y), l.push(F), l.push(Ig.sideRight), l.push(-1)) : (c.push(y), c.push(F), c.push(Ig.sideRight), c.push(-1)))), I.y === x.y && (I.y <= o && (I.x < x.x ? (l.push(y), l.push(F), l.push(Ig.sideTop), l.push(-1)) : (c.push(y), c.push(F), c.push(Ig.sideTop), c.push(-1))), I.y >= a && (I.x > x.x ? (l.push(y), l.push(F), l.push(Ig.sideBottom), l.push(-1)) : (c.push(y), c.push(F), c.push(Ig.sideBottom), c.push(-1)))), I = x; + } + if (l.length === 0 || c.length === 0) + return; + $M.fillParent(r, c, l), $M.fillParent(r, l, c); + const p = []; + $M.calcDeltas(p, c, l), $M.calcDeltas(p, l, c), $M.addDeltas(p, r); + } + static fillParent(e, i, r) { + const n = r.length, s = i.length; + for (let o = 0; o < s; o += 4) { + const a = i[o], l = i[o + 1], c = i[o + 2], h = e[a][l - 1], p = e[a][l]; + let y = 8092, v = -1; + for (let x = 0; x < n; x += 4) { + if (r[x + 2] !== c) + continue; + const I = r[x], P = r[x + 1], F = e[I][P - 1], k = e[I][P]; + switch (c) { + case Ig.sideLeft: + case Ig.sideRight: + if (Loe(h.y, F.y, k.y) && Loe(p.y, F.y, k.y)) { + const V = Math.abs(k.y - F.y); + V < y && (y = V, v = x); + } + break; + case Ig.sideTop: + case Ig.sideBottom: + if (Loe(h.x, F.x, k.x) && Loe(p.x, F.x, k.x)) { + const V = Math.abs(k.x - F.x); + V < y && (y = V, v = x); + } + } + } + i[o + 3] = v; + } + } + static calcDeltas(e, i, r) { + const n = i.length; + for (let s = 0; s < n; s += 4) { + const o = [], a = $M.calcDelta(s, i, r, o); + e.push(i[s]), e.push(i[s + 1]), e.push(i[s + 2]), e.push(a); + } + } + static calcDelta(e, i, r, n) { + const s = i[e + 3]; + if (s === -1) + return 0; + const o = n.length; + return o > 1 && n[o - 2] === s ? 0 : (n.push(s), $M.calcDelta(s, r, i, n) + 1); + } + static addDeltas(e, i) { + const r = e.length; + let n = 0; + for (let s = 0; s < r; s += 4) { + const o = e[s + 3]; + o > n && (n = o); + } + for (let s = 0; s < r; s += 4) { + const o = i[e[s]], a = e[s + 1], l = n - e[s + 3]; + switch (e[s + 2]) { + case Ig.sideLeft: + o[a - 1].x -= l, o[a].x -= l, a === 1 && (o[o.length - 1].x -= l), a === o.length - 1 && (o[0].x -= l); + break; + case Ig.sideRight: + o[a - 1].x += l, o[a].x += l, a === 1 && (o[o.length - 1].x += l), a === o.length - 1 && (o[0].x += l); + break; + case Ig.sideTop: + o[a - 1].y -= l, o[a].y -= l, a === 1 && (o[o.length - 1].y -= l), a === o.length - 1 && (o[0].y -= l); + break; + case Ig.sideBottom: + o[a - 1].y += l, o[a].y += l, a === 1 && (o[o.length - 1].y += l), a === o.length - 1 && (o[0].y += l); + } + } + } +}; +const Loe = (t, e, i) => t >= e && t <= i || t >= i && t <= e, yE = Number.POSITIVE_INFINITY, OD = Math.PI, $Qe = 2 * OD, k7i = 128 / OD, oMe = OD / 180, $7i = 1 / Math.LN2; +function aMe(t, e) { + return (t %= e) >= 0 ? t : t + e; +} +function tOt(t) { + return aMe(t * k7i, 256); +} +function UR(t) { + return Math.log(t) * $7i; +} +function qm(t, e, i) { + return t * (1 - i) + e * i; +} +function B7i(t) { + return t === 746 || t === 747 || !(t < 4352) && (t >= 12704 && t <= 12735 || t >= 12544 && t <= 12591 || t >= 65072 && t <= 65103 && !(t >= 65097 && t <= 65103) || t >= 63744 && t <= 64255 || t >= 13056 && t <= 13311 || t >= 11904 && t <= 12031 || t >= 12736 && t <= 12783 || t >= 12288 && t <= 12351 && !(t >= 12296 && t <= 12305 || t >= 12308 && t <= 12319 || t === 12336) || t >= 13312 && t <= 19903 || t >= 19968 && t <= 40959 || t >= 12800 && t <= 13055 || t >= 12592 && t <= 12687 || t >= 43360 && t <= 43391 || t >= 55216 && t <= 55295 || t >= 4352 && t <= 4607 || t >= 44032 && t <= 55215 || t >= 12352 && t <= 12447 || t >= 12272 && t <= 12287 || t >= 12688 && t <= 12703 || t >= 12032 && t <= 12255 || t >= 12784 && t <= 12799 || t >= 12448 && t <= 12543 && t !== 12540 || t >= 65280 && t <= 65519 && !(t === 65288 || t === 65289 || t === 65293 || t >= 65306 && t <= 65310 || t === 65339 || t === 65341 || t === 65343 || t >= 65371 && t <= 65503 || t === 65507 || t >= 65512 && t <= 65519) || t >= 65104 && t <= 65135 && !(t >= 65112 && t <= 65118 || t >= 65123 && t <= 65126) || t >= 5120 && t <= 5759 || t >= 6320 && t <= 6399 || t >= 65040 && t <= 65055 || t >= 19904 && t <= 19967 || t >= 40960 && t <= 42127 || t >= 42128 && t <= 42191); +} +function V7i(t) { + return !(t < 11904) && (t >= 12704 && t <= 12735 || t >= 12544 && t <= 12591 || t >= 65072 && t <= 65103 || t >= 63744 && t <= 64255 || t >= 13056 && t <= 13311 || t >= 11904 && t <= 12031 || t >= 12736 && t <= 12783 || t >= 12288 && t <= 12351 || t >= 13312 && t <= 19903 || t >= 19968 && t <= 40959 || t >= 12800 && t <= 13055 || t >= 65280 && t <= 65519 || t >= 12352 && t <= 12447 || t >= 12272 && t <= 12287 || t >= 12032 && t <= 12255 || t >= 12784 && t <= 12799 || t >= 12448 && t <= 12543 || t >= 65040 && t <= 65055 || t >= 42128 && t <= 42191 || t >= 40960 && t <= 42127); +} +function j7i(t) { + switch (t) { + case 10: + case 32: + case 38: + case 40: + case 41: + case 43: + case 45: + case 47: + case 173: + case 183: + case 8203: + case 8208: + case 8211: + case 8231: + return !0; + } + return !1; +} +function BQe(t) { + switch (t) { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: + return !0; + } + return !1; +} +let Od = class { + constructor(e = 0, i = 0, r = 0, n = 0) { + this.x = e, this.y = i, this.width = r, this.height = n; + } + get isEmpty() { + return this.width <= 0 || this.height <= 0; + } + union(e) { + this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.width = Math.max(this.width, e.width), this.height = Math.max(this.height, e.height); + } +}; +const vE = 24, iOt = 17; +let rOt = class { + constructor(e, i, r, n, s, o, a) { + this._glyphItems = e, this._maxWidth = i, this._lineHeight = r, this._letterSpacing = n, this._hAnchor = s, this._vAnchor = o, this._justify = a; + } + getShaping(e, i, r) { + const n = this._letterSpacing, s = this._lineHeight, o = this._justify, a = this._maxWidth, l = []; + let c = 0, h = 0; + const p = e.length; + for (let V = 0; V < p; V++) { + const j = e.charCodeAt(V), Y = r && B7i(j); + let X; + for (const Q of this._glyphItems) + if (X = Q[j], X) + break; + l.push({ codePoint: j, x: c, y: h, vertical: Y, glyphMosaicItem: X }), X && (c += X.metrics.advance + n); + } + let y = c; + a > 0 && (y = c / Math.max(1, Math.ceil(c / a))); + const v = e.includes("​"), x = []; + for (let V = 0; V < p - 1; V++) { + const j = l[V].codePoint, Y = V7i(j); + if (j7i(j) || Y) { + let X = 0; + if (j === 10) + X -= 1e4; + else if (Y && v) + X += 150; + else { + j !== 40 && j !== 65288 || (X += 50); + const Q = l[V + 1].codePoint; + Q !== 41 && Q !== 65289 || (X += 50); + } + x.push(this._buildBreak(V + 1, l[V].x, y, x, X, !1)); + } + } + const I = this._optimalBreaks(this._buildBreak(p, c, y, x, 0, !0)); + let P = 0; + const F = i ? -s : s; + let k = 0; + for (let V = 0; V < I.length; V++) { + const j = I[V]; + let Y = k; + for (; Y < j && BQe(l[Y].codePoint); ) + l[Y].glyphMosaicItem = null, ++Y; + let X = j - 1; + for (; X > Y && BQe(l[X].codePoint); ) + l[X].glyphMosaicItem = null, --X; + if (Y <= X) { + const Q = l[Y].x; + for (let he = Y; he <= X; he++) + l[he].x -= Q, l[he].y = h; + let re = l[X].x; + l[X].glyphMosaicItem && (re += l[X].glyphMosaicItem.metrics.advance), P = Math.max(re, P), o && this._applyJustification(l, Y, X); + } + k = j, h += F; + } + if (l.length > 0) { + const V = I.length - 1, j = (o - this._hAnchor) * P; + let Y = (-this._vAnchor * (V + 1) + 0.5) * s; + i && V && (Y += V * s); + for (const X of l) + X.x += j, X.y += Y; + } + return l.filter((V) => V.glyphMosaicItem); + } + static getTextBox(e, i) { + if (!e.length) + return null; + let r = 1 / 0, n = 1 / 0, s = 0, o = 0; + for (const a of e) { + const l = a.glyphMosaicItem.metrics.advance, c = a.x, h = a.y - iOt, p = c + l, y = h + i; + r = Math.min(r, c), s = Math.max(s, p), n = Math.min(n, h), o = Math.max(o, y); + } + return { x: r, y: n, width: s - r, height: o - n }; + } + static getBox(e) { + if (!e.length) + return null; + let i = 1 / 0, r = 1 / 0, n = 0, s = 0; + for (const o of e) { + const { height: a, left: l, top: c, width: h } = o.glyphMosaicItem.metrics, p = o.x, y = o.y - (a - Math.abs(c)), v = p + h + l, x = y + a; + i = Math.min(i, p), n = Math.max(n, v), r = Math.min(r, y), s = Math.max(s, x); + } + return { x: i, y: r, width: n - i, height: s - r }; + } + static addDecoration(e, i) { + const r = e.length; + if (r === 0) + return; + const n = 3; + let s = e[0].x + e[0].glyphMosaicItem.metrics.left, o = e[0].y; + for (let l = 1; l < r; l++) { + const c = e[l]; + if (c.y !== o) { + const h = e[l - 1].x + e[l - 1].glyphMosaicItem.metrics.left + e[l - 1].glyphMosaicItem.metrics.width; + e.push({ codePoint: 0, x: s, y: o + i - n, vertical: !1, glyphMosaicItem: { sdf: !0, rect: new Od(4, 0, 4, 8), metrics: { width: h - s, height: 2 + 2 * n, left: 0, top: 0, advance: 0 }, page: 0, code: 0 } }), o = c.y, s = c.x + c.glyphMosaicItem.metrics.left; + } + } + const a = e[r - 1].x + e[r - 1].glyphMosaicItem.metrics.left + e[r - 1].glyphMosaicItem.metrics.width; + e.push({ codePoint: 0, x: s, y: o + i - n, vertical: !1, glyphMosaicItem: { sdf: !0, rect: new Od(4, 0, 4, 8), metrics: { width: a - s, height: 2 + 2 * n, left: 0, top: 0, advance: 0 }, page: 0, code: 0 } }); + } + _breakScore(e, i, r, n) { + const s = (e - i) * (e - i); + return n ? e < i ? s / 2 : 2 * s : s + Math.abs(r) * r; + } + _buildBreak(e, i, r, n, s, o) { + let a = null, l = this._breakScore(i, r, s, o); + for (const c of n) { + const h = i - c.x, p = this._breakScore(h, r, s, o) + c.score; + p <= l && (a = c, l = p); + } + return { index: e, x: i, score: l, previousBreak: a }; + } + _optimalBreaks(e) { + return e ? this._optimalBreaks(e.previousBreak).concat(e.index) : []; + } + _applyJustification(e, i, r) { + const n = e[r], s = n.vertical ? vE : n.glyphMosaicItem ? n.glyphMosaicItem.metrics.advance : 0, o = (n.x + s) * this._justify; + for (let a = i; a <= r; a++) + e[a].x -= o; + } +}; +const VQe = !0, G7i = 32, U7i = 1.5, JU = 200; +var dl, _E, NO, nc, m7, ec, mee, U_, Efe; +(function(t) { + t[t.BACKGROUND = 0] = "BACKGROUND", t[t.FILL = 1] = "FILL", t[t.LINE = 2] = "LINE", t[t.SYMBOL = 3] = "SYMBOL", t[t.CIRCLE = 4] = "CIRCLE"; +})(dl || (dl = {})), function(t) { + t[t.VISIBLE = 0] = "VISIBLE", t[t.NONE = 1] = "NONE"; +}(_E || (_E = {})), function(t) { + t[t.POINT = 0] = "POINT", t[t.LINE = 1] = "LINE", t[t.LINE_CENTER = 2] = "LINE_CENTER"; +}(NO || (NO = {})), function(t) { + t[t.MAP = 0] = "MAP", t[t.VIEWPORT = 1] = "VIEWPORT", t[t.AUTO = 2] = "AUTO"; +}(nc || (nc = {})), function(t) { + t[t.AUTO = 0] = "AUTO", t[t.LEFT = 1] = "LEFT", t[t.CENTER = 2] = "CENTER", t[t.RIGHT = 3] = "RIGHT"; +}(m7 || (m7 = {})), function(t) { + t[t.CENTER = 0] = "CENTER", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.TOP = 3] = "TOP", t[t.BOTTOM = 4] = "BOTTOM", t[t.TOP_LEFT = 5] = "TOP_LEFT", t[t.TOP_RIGHT = 6] = "TOP_RIGHT", t[t.BOTTOM_LEFT = 7] = "BOTTOM_LEFT", t[t.BOTTOM_RIGHT = 8] = "BOTTOM_RIGHT"; +}(ec || (ec = {})), function(t) { + t[t.NONE = 0] = "NONE", t[t.UPPERCASE = 1] = "UPPERCASE", t[t.LOWERCASE = 2] = "LOWERCASE"; +}(mee || (mee = {})), function(t) { + t[t.MAP = 0] = "MAP", t[t.VIEWPORT = 1] = "VIEWPORT"; +}(U_ || (U_ = {})), function(t) { + t[t.HORIZONTAL = 0] = "HORIZONTAL", t[t.VERTICAL = 1] = "VERTICAL"; +}(Efe || (Efe = {})); +let If = class { +}; +If.backgroundLayoutDefinition = { visibility: { type: "enum", values: ["visible", "none"], default: _E.VISIBLE } }, If.fillLayoutDefinition = { visibility: { type: "enum", values: ["visible", "none"], default: _E.VISIBLE } }, If.lineLayoutDefinition = { visibility: { type: "enum", values: ["visible", "none"], default: _E.VISIBLE }, "line-cap": { type: "enum", values: ["butt", "round", "square"], default: Pf.BUTT }, "line-join": { type: "enum", values: ["bevel", "round", "miter"], default: om.MITER }, "line-miter-limit": { type: "number", default: 2 }, "line-round-limit": { type: "number", default: 1.05 } }, If.symbolLayoutDefinition = { visibility: { type: "enum", values: ["visible", "none"], default: _E.VISIBLE }, "symbol-avoid-edges": { type: "boolean", default: !1 }, "symbol-placement": { type: "enum", values: ["point", "line", "line-center"], default: NO.POINT }, "symbol-sort-key": { type: "number", default: -1 }, "symbol-spacing": { type: "number", minimum: 1, default: 250 }, "icon-allow-overlap": { type: "boolean", default: !1 }, "icon-anchor": { type: "enum", values: ["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"], default: ec.CENTER }, "icon-ignore-placement": { type: "boolean", default: !1 }, "icon-image": { type: "string" }, "icon-keep-upright": { type: "boolean", default: !1 }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0] }, "icon-optional": { type: "boolean", default: !1 }, "icon-padding": { type: "number", minimum: 0, default: 2 }, "icon-rotate": { type: "number", default: 0 }, "icon-rotation-alignment": { type: "enum", values: ["map", "viewport", "auto"], default: nc.AUTO }, "icon-size": { type: "number", minimum: 0, default: 1 }, "text-allow-overlap": { type: "boolean", default: !1 }, "text-anchor": { type: "enum", values: ["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"], default: ec.CENTER }, "text-field": { type: "string" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"] }, "text-ignore-placement": { type: "boolean", default: !1 }, "text-justify": { type: "enum", values: ["auto", "left", "center", "right"], default: m7.CENTER }, "text-keep-upright": { type: "boolean", default: !0 }, "text-letter-spacing": { type: "number", default: 0 }, "text-line-height": { type: "number", default: 1.2 }, "text-max-angle": { type: "number", minimum: 0, default: 45 }, "text-max-width": { type: "number", minimum: 0, default: 10 }, "text-offset": { type: "array", value: "number", length: 2, default: [0, 0] }, "text-optional": { type: "boolean", default: !1 }, "text-padding": { type: "number", minimum: 0, default: 2 }, "text-rotate": { type: "number", default: 0 }, "text-rotation-alignment": { type: "enum", values: ["map", "viewport", "auto"], default: nc.AUTO }, "text-size": { type: "number", minimum: 0, default: 16 }, "text-transform": { type: "enum", values: ["none", "uppercase", "lowercase"], default: mee.NONE }, "text-writing-mode": { type: "array", value: "enum", values: ["horizontal", "vertical"], default: [Efe.HORIZONTAL] } }, If.circleLayoutDefinition = { visibility: { type: "enum", values: ["visible", "none"], default: _E.VISIBLE } }, If.backgroundPaintDefinition = { "background-color": { type: "color", default: [0, 0, 0, 1] }, "background-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "background-pattern": { type: "string" } }, If.fillPaintDefinition = { "fill-antialias": { type: "boolean", default: !0 }, "fill-color": { type: "color", default: [0, 0, 0, 1] }, "fill-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "fill-outline-color": { type: "color", default: [0, 0, 0, 0] }, "fill-pattern": { type: "string" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0] }, "fill-translate-anchor": { type: "enum", values: ["map", "viewport"], default: U_.MAP } }, If.linePaintDefinition = { "line-blur": { type: "number", minimum: 0, default: 0 }, "line-color": { type: "color", default: [0, 0, 0, 1] }, "line-dasharray": { type: "array", value: "number", default: [] }, "line-gap-width": { type: "number", minimum: 0, default: 0 }, "line-offset": { type: "number", default: 0 }, "line-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "line-pattern": { type: "string" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0] }, "line-translate-anchor": { type: "enum", values: ["map", "viewport"], default: U_.MAP }, "line-width": { type: "number", minimum: 0, default: 1 } }, If.symbolPaintDefinition = { "icon-color": { type: "color", default: [0, 0, 0, 1] }, "icon-halo-blur": { type: "number", minimum: 0, default: 0 }, "icon-halo-color": { type: "color", default: [0, 0, 0, 0] }, "icon-halo-width": { type: "number", minimum: 0, default: 0 }, "icon-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0] }, "icon-translate-anchor": { type: "enum", values: ["map", "viewport"], default: U_.MAP }, "text-color": { type: "color", default: [0, 0, 0, 1] }, "text-halo-blur": { type: "number", minimum: 0, default: 0 }, "text-halo-color": { type: "color", default: [0, 0, 0, 0] }, "text-halo-width": { type: "number", minimum: 0, default: 0 }, "text-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0] }, "text-translate-anchor": { type: "enum", values: ["map", "viewport"], default: U_.MAP } }, If.rasterPaintDefinition = { "raster-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "raster-hue-rotate": { type: "number", default: 0 }, "raster-brightness-min": { type: "number", minimum: 0, maximum: 1, default: 0 }, "raster-brightness-max": { type: "number", minimum: 0, maximum: 1, default: 1 }, "raster-saturation": { type: "number", minimum: -1, maximum: 1, default: 0 }, "raster-contrast": { type: "number", minimum: -1, maximum: 1, default: 0 }, "raster-fade-duration": { type: "number", minimum: 0, default: 300 } }, If.circlePaintDefinition = { "circle-blur": { type: "number", minimum: 0, default: 0 }, "circle-color": { type: "color", default: [0, 0, 0, 1] }, "circle-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "circle-radius": { type: "number", minimum: 0, default: 5 }, "circle-stroke-color": { type: "color", default: [0, 0, 0, 1] }, "circle-stroke-opacity": { type: "number", minimum: 0, maximum: 1, default: 1 }, "circle-stroke-width": { type: "number", minimum: 0, default: 0 }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0] }, "circle-translate-anchor": { type: "enum", values: ["map", "viewport"], default: U_.MAP } }; +const jQe = 4096, SX = 8, Dk = 0.5, Pxe = 2; +let Noe = class { + constructor(e, i, r = 0, n = -1, s = Dk) { + this.x = e, this.y = i, this.angle = r, this.segment = n, this.minzoom = s; + } +}, koe = class { + constructor(e, i, r, n, s, o = Dk, a = yE) { + this.anchor = e, this.labelAngle = i, this.glyphAngle = r, this.page = n, this.alternateVerticalGlyph = s, this.minzoom = o, this.maxzoom = a; + } +}, GQe = class { + constructor(e, i, r, n, s, o, a, l, c, h, p, y) { + this.tl = e, this.tr = i, this.bl = r, this.br = n, this.mosaicRect = s, this.labelAngle = o, this.minAngle = a, this.maxAngle = l, this.anchor = c, this.minzoom = h, this.maxzoom = p, this.page = y; + } +}, UQe = class { + constructor(e) { + this.shapes = e; + } +}, z7i = class { + getIconPlacement(e, i, r) { + const n = new Jo(e.x, e.y), s = r.rotationAlignment === nc.MAP, o = r.keepUpright; + let a = r.rotate * oMe; + s && (a += e.angle); + const l = new UQe([]); + return r.allowOverlap && r.ignorePlacement || !VQe || (l.iconColliders = []), this._addIconPlacement(l, n, i, r, a), s && o && this._addIconPlacement(l, n, i, r, a + OD), l; + } + _addIconPlacement(e, i, r, n, s) { + const o = r.pixelRatio, a = r.width / o, l = r.height / o, c = n.offset; + let h = c[0], p = c[1]; + switch (n.anchor) { + case ec.CENTER: + h -= a / 2, p -= l / 2; + break; + case ec.LEFT: + p -= l / 2; + break; + case ec.RIGHT: + h -= a, p -= l / 2; + break; + case ec.TOP: + h -= a / 2; + break; + case ec.BOTTOM: + h -= a / 2, p -= l; + break; + case ec.TOP_LEFT: + break; + case ec.BOTTOM_LEFT: + p -= l; + break; + case ec.TOP_RIGHT: + h -= a; + break; + case ec.BOTTOM_RIGHT: + h -= a, p -= l; + } + const y = r.rect, v = 2 / o, x = h - v, I = p - v, P = x + y.width / o, F = I + y.height / o, k = new Jo(x, I), V = new Jo(P, F), j = new Jo(x, F), Y = new Jo(P, I); + if (s !== 0) { + const Q = Math.cos(s), re = Math.sin(s); + k.rotate(Q, re), V.rotate(Q, re), j.rotate(Q, re), Y.rotate(Q, re); + } + const X = new GQe(k, Y, j, V, y, s, 0, 256, i, Dk, yE, 0); + if (e.shapes.push(X), (!n.allowOverlap || !n.ignorePlacement) && VQe) { + const Q = n.size, re = n.padding, he = { xTile: i.x, yTile: i.y, dxPixels: h * Q - re, dyPixels: p * Q - re, hard: !n.optional, partIndex: 0, width: a * Q + 2 * re, height: l * Q + 2 * re, angle: s, minLod: Dk, maxLod: yE }; + e.iconColliders.push(he); + } + } + getTextPlacement(e, i, r, n) { + const s = new Jo(e.x, e.y), o = n.rotate * oMe, a = n.rotationAlignment === nc.MAP, l = n.keepUpright, c = n.padding; + let h = Dk; + const p = a ? e.angle : 0, y = e.segment >= 0 && a, v = n.allowOverlap && n.ignorePlacement ? null : [], x = [], I = 4, P = !y; + let F = Number.POSITIVE_INFINITY, k = Number.NEGATIVE_INFINITY, V = F, j = k; + const Y = (y || a) && l, X = n.size / vE; + let Q = !1; + for (const Se of i) + if (Se.vertical) { + Q = !0; + break; + } + let re, he = 0, fe = 0; + if (!y && Q) { + const Se = rOt.getTextBox(i, n.lineHeight * vE); + switch (n.anchor) { + case ec.LEFT: + he = Se.height / 2, fe = -Se.width / 2; + break; + case ec.RIGHT: + he = -Se.height / 2, fe = Se.width / 2; + break; + case ec.TOP: + he = Se.height / 2, fe = Se.width / 2; + break; + case ec.BOTTOM: + he = -Se.height / 2, fe = -Se.width / 2; + break; + case ec.TOP_LEFT: + he = Se.height; + break; + case ec.BOTTOM_LEFT: + fe = -Se.width; + break; + case ec.TOP_RIGHT: + fe = Se.width; + break; + case ec.BOTTOM_RIGHT: + he = -Se.height; + } + } + he += n.offset[0] * vE, fe += n.offset[1] * vE; + for (const Se of i) { + const Me = Se.glyphMosaicItem; + if (!Me || Me.rect.isEmpty) + continue; + const ke = Me.rect, J = Me.metrics, ce = Me.page; + if (v && P) { + if (re !== void 0 && re !== Se.y) { + let It, Nt, nt, Ee; + Q ? (It = -j + he, Nt = F + fe, nt = j - V, Ee = k - F) : (It = F + he, Nt = V + fe, nt = k - F, Ee = j - V); + const Be = { xTile: e.x, yTile: e.y, dxPixels: It * X - c, dyPixels: Nt * X - c, hard: !n.optional, partIndex: 1, width: nt * X + 2 * c, height: Ee * X + 2 * c, angle: o, minLod: Dk, maxLod: yE }; + v.push(Be), F = Number.POSITIVE_INFINITY, k = Number.NEGATIVE_INFINITY, V = F, j = k; + } + re = Se.y; + } + const xe = []; + if (y) { + const It = 0.5 * Me.metrics.width, Nt = (Se.x + J.left - I + It) * X * SX; + if (h = this._placeGlyph(e, h, Nt, r, e.segment, 1, Se.vertical, ce, xe), l && (h = this._placeGlyph(e, h, Nt, r, e.segment, -1, Se.vertical, ce, xe)), h >= Pxe) + break; + } else + xe.push(new koe(s, p, p, ce, !1)), a && l && xe.push(new koe(s, p + OD, p + OD, ce, !1)); + const Pe = Se.x + J.left, Oe = Se.y - iOt - J.top, Re = Pe + J.width, Ge = Oe + J.height; + let je, et, Qe, tt, ft, Mt, kt, Tt; + if (!y && Q) + if (Se.vertical) { + const It = (Pe + Re) / 2 - J.height / 2, Nt = (Oe + Ge) / 2 + J.width / 2; + je = new Jo(-Nt - I + he, It - I + fe), et = new Jo(je.x + ke.width, je.y + ke.height), Qe = new Jo(je.x, et.y), tt = new Jo(et.x, je.y); + } else + je = new Jo(-Oe + I + he, Pe - I + fe), et = new Jo(je.x - ke.height, je.y + ke.width), Qe = new Jo(et.x, je.y), tt = new Jo(je.x, et.y); + else + je = new Jo(Pe - I + he, Oe - I + fe), et = new Jo(je.x + ke.width, je.y + ke.height), Qe = new Jo(je.x, et.y), tt = new Jo(et.x, je.y); + for (const It of xe) { + let Nt, nt, Ee, Be; + if (It.alternateVerticalGlyph) { + if (!ft) { + const gt = (Oe + Ge) / 2 + fe; + ft = new Jo((Pe + Re) / 2 + he - J.height / 2 - I, gt + J.width / 2 + I), Mt = new Jo(ft.x + ke.height, ft.y - ke.width), kt = new Jo(Mt.x, ft.y), Tt = new Jo(ft.x, Mt.y); + } + Nt = ft, nt = kt, Ee = Tt, Be = Mt; + } else + Nt = je, nt = Qe, Ee = tt, Be = et; + const at = Oe, wt = Ge, st = It.glyphAngle + o; + if (st !== 0) { + const gt = Math.cos(st), Ne = Math.sin(st); + Nt = Nt.clone(), nt = nt?.clone(), Ee = Ee?.clone(), Be = Be?.clone(), Nt.rotate(gt, Ne), Be?.rotate(gt, Ne), nt?.rotate(gt, Ne), Ee?.rotate(gt, Ne); + } + let le = 0, ct = 256; + if (y && Q ? Se.vertical ? It.alternateVerticalGlyph ? (le = 32, ct = 96) : (le = 224, ct = 32) : (le = 224, ct = 96) : (le = 192, ct = 64), x.push(new GQe(Nt, Ee, nt, Be, ke, It.labelAngle, le, ct, It.anchor, It.minzoom, It.maxzoom, It.page)), v && (!Y || this._legible(It.labelAngle))) { + if (P) + Pe < F && (F = Pe), at < V && (V = at), Re > k && (k = Re), wt > j && (j = wt); + else if (It.minzoom < Pxe) { + const gt = { xTile: e.x, yTile: e.y, dxPixels: (Pe + he) * X - c, dyPixels: (at + he) * X - c, hard: !n.optional, partIndex: 1, width: (Re - Pe) * X + 2 * c, height: (wt - at) * X + 2 * c, angle: st, minLod: It.minzoom, maxLod: It.maxzoom }; + v.push(gt); + } + } + } + } + if (h >= Pxe) + return null; + if (v && P) { + let Se, Me, ke, J; + Q ? (Se = -j + he, Me = F + fe, ke = j - V, J = k - F) : (Se = F + he, Me = V + fe, ke = k - F, J = j - V); + const ce = { xTile: e.x, yTile: e.y, dxPixels: Se * X - c, dyPixels: Me * X - c, hard: !n.optional, partIndex: 1, width: ke * X + 2 * c, height: J * X + 2 * c, angle: o, minLod: Dk, maxLod: yE }; + v.push(ce); + } + const be = new UQe(x); + return v && v.length > 0 && (be.textColliders = v), be; + } + _legible(e) { + const i = tOt(e); + return i < 65 || i >= 193; + } + _placeGlyph(e, i, r, n, s, o, a, l, c) { + let h = o; + const p = h < 0 ? aMe(e.angle + OD, $Qe) : e.angle; + let y = 0; + r < 0 && (h *= -1, r *= -1, y = OD), h > 0 && ++s; + let v = new Jo(e.x, e.y), x = n[s], I = yE; + if (n.length <= s) + return I; + for (; ; ) { + const P = x.x - v.x, F = x.y - v.y, k = Math.sqrt(P * P + F * F), V = Math.max(r / k, i), j = P / k, Y = F / k, X = aMe(Math.atan2(Y, j) + y, $Qe); + if (c.push(new koe(v, p, X, l, !1, V, I)), a && c.push(new koe(v, p, X, l, !0, V, I)), V <= i) + return V; + v = x.clone(); + do { + if (s += h, n.length <= s || s < 0) + return V; + x = n[s]; + } while (v.isEqual(x)); + let Q = x.x - v.x, re = x.y - v.y; + const he = Math.sqrt(Q * Q + re * re); + Q *= k / he, re *= k / he, v.x -= Q, v.y -= re, I = V; + } + } +}; +const H7i = 128e3; +let Oxe = null, nOt = null; +async function sOt() { + return Oxe || (Oxe = W7i()), Oxe; +} +async function W7i() { + nOt = await (Vi("esri-csp-restrictions") ? await Promise.resolve().then(() => vMr).then((e) => e.l) : await Promise.resolve().then(() => xMr).then((e) => e.l)).load({ locateFile: (e) => Ql(`esri/core/libs/libtess/${e}`) }); +} +function oOt(t, e) { + const i = Math.max(t.length, H7i); + return nOt.triangulate(t, e, i); +} +var wG; +(function(t) { + t[t.moveTo = 1] = "moveTo", t[t.lineTo = 2] = "lineTo", t[t.close = 7] = "close"; +})(wG || (wG = {})); +let q7i = class { + constructor(e, i) { + this.values = {}, this._geometry = void 0, this._pbfGeometry = null; + const r = i.keys, n = i.values, s = e.asUnsafe(); + for (; s.next(); ) + switch (s.tag()) { + case 1: + this.id = s.getUInt64(); + break; + case 2: { + const o = s.getMessage().asUnsafe(), a = this.values; + for (; !o.empty(); ) { + const l = o.getUInt32(), c = o.getUInt32(); + a[r[l]] = n[c]; + } + o.release(); + break; + } + case 3: + this.type = s.getUInt32(); + break; + case 4: + this._pbfGeometry = s.getMessage(); + break; + default: + s.skip(); + } + } + getGeometry(e) { + if (this._geometry !== void 0) + return this._geometry; + if (!this._pbfGeometry) + return null; + const i = this._pbfGeometry.asUnsafe(); + let r, n; + this._pbfGeometry = null, e ? e.reset(this.type) : r = []; + let s, o = wG.moveTo, a = 0, l = 0, c = 0; + for (; !i.empty(); ) { + if (a === 0) { + const h = i.getUInt32(); + o = 7 & h, a = h >> 3; + } + switch (a--, o) { + case wG.moveTo: + l += i.getSInt32(), c += i.getSInt32(), e ? e.moveTo(l, c) : r && (n && r.push(n), n = [], n.push(new Jo(l, c))); + break; + case wG.lineTo: + l += i.getSInt32(), c += i.getSInt32(), e ? e.lineTo(l, c) : n && n.push(new Jo(l, c)); + break; + case wG.close: + e ? e.close() : n && !n[0].equals(l, c) && n.push(n[0].clone()); + break; + default: + throw i.release(), new Error("Invalid path operation"); + } + } + return e ? s = e.result() : r && (n && r.push(n), s = r), i.release(), this._geometry = s, s; + } +}, Jm = class { + constructor(e) { + this._array = [], e <= 0 && console.error("strideInBytes must be positive!"), this._stride = e; + } + get array() { + return this._array; + } + get index() { + return 4 * this._array.length / this._stride; + } + get itemSize() { + return this._stride; + } + get sizeInBytes() { + return 4 * this._array.length; + } + reset() { + this.array.length = 0; + } + toBuffer() { + return new Uint32Array(this._array).buffer; + } + static i1616to32(e, i) { + return 65535 & e | i << 16; + } + static i8888to32(e, i, r, n) { + return 255 & e | (255 & i) << 8 | (255 & r) << 16 | n << 24; + } + static i8816to32(e, i, r) { + return 255 & e | (255 & i) << 8 | r << 16; + } +}, yB = class extends Jm { + constructor() { + super(12); + } + add(e, i, r) { + const n = this.array; + n.push(e), n.push(i), n.push(r); + } +}, Y7i = class aOt { + constructor(e) { + this.extent = 4096, this.keys = [], this.values = [], this._pbfLayer = e.clone(); + const i = e.asUnsafe(); + for (; i.next(); ) + switch (i.tag()) { + case 1: + this.name = i.getString(); + break; + case 3: + this.keys.push(i.getString()); + break; + case 4: + this.values.push(i.processMessage(aOt._parseValue)); + break; + case 5: + this.extent = i.getUInt32(); + break; + default: + i.skip(); + } + } + getData() { + return this._pbfLayer; + } + static _parseValue(e) { + for (; e.next(); ) + switch (e.tag()) { + case 1: + return e.getString(); + case 2: + return e.getFloat(); + case 3: + return e.getDouble(); + case 4: + return e.getInt64(); + case 5: + return e.getUInt64(); + case 6: + return e.getSInt64(); + case 7: + return e.getBool(); + default: + e.skip(); + } + return null; + } +}, X7i = class extends Jm { + constructor(e) { + super(e); + } + add(e, i, r, n, s, o, a, l, c, h, p, y) { + const v = this.array; + let x = Jm.i1616to32(e, i); + v.push(x); + const I = 31; + x = Jm.i8888to32(Math.round(I * r), Math.round(I * n), Math.round(I * s), Math.round(I * o)), v.push(x), x = Jm.i8888to32(Math.round(I * a), Math.round(I * l), Math.round(I * c), Math.round(I * h)), v.push(x), x = Jm.i1616to32(p, 0), v.push(x), y && v.push(...y); + } +}, K7i = class extends Jm { + constructor(e) { + super(e); + } + add(e, i, r) { + const n = this.array; + n.push(Jm.i1616to32(e, i)), r && n.push(...r); + } +}, J7i = class extends Jm { + constructor(e) { + super(e); + } + add(e, i, r, n, s, o, a) { + const l = this.array, c = this.index; + let h = Jm.i1616to32(e, i); + l.push(h); + const p = 15; + return h = Jm.i8888to32(Math.round(p * r), Math.round(p * n), s, o), l.push(h), a && l.push(...a), c; + } +}, zQe = class extends Jm { + constructor(e) { + super(e); + } + add(e, i, r, n, s, o, a, l, c, h, p, y) { + const v = this.array; + let x = Jm.i1616to32(e, i); + v.push(x), x = Jm.i1616to32(Math.round(8 * r), Math.round(8 * n)), v.push(x), x = Jm.i8888to32(s / 4, o / 4, l, c), v.push(x), x = Jm.i8888to32(0, tOt(a), 10 * h, Math.min(10 * p, 255)), v.push(x), y && v.push(...y); + } +}, Z7i = class extends Jm { + constructor(e) { + super(e); + } + add(e, i, r, n, s) { + const o = this.array, a = Jm.i1616to32(2 * e + r, 2 * i + n); + o.push(a), s && o.push(...s); + } +}, yve = class { + constructor(e, i, r) { + this.layerExtent = 4096, this._features = [], this.layer = e, this.zoom = i, this._spriteInfo = r, this._filter = e.getFeatureFilter(); + } + pushFeature(e) { + this._filter && !this._filter.filter(e, this.zoom) || this._features.push(e); + } + hasFeatures() { + return this._features.length > 0; + } + getResources(e, i, r) { + } +}, Q7i = class extends yve { + constructor(e, i, r, n, s) { + super(e, i, r), this.type = Pg.CIRCLE, this._circleVertexBuffer = n, this._circleIndexBuffer = s; + } + get circleIndexStart() { + return this._circleIndexStart; + } + get circleIndexCount() { + return this._circleIndexCount; + } + processFeatures(e) { + const i = this._circleVertexBuffer, r = this._circleIndexBuffer; + this._circleIndexStart = 3 * r.index, this._circleIndexCount = 0; + const n = this.layer, s = this.zoom; + e && e.setExtent(this.layerExtent); + for (const o of this._features) { + const a = o.getGeometry(e); + if (!a) + continue; + const l = n.circleMaterial.encodeAttributes(o, s, n); + for (const c of a) + if (c) + for (const h of c) { + const p = i.index; + i.add(h.x, h.y, 0, 0, l), i.add(h.x, h.y, 0, 1, l), i.add(h.x, h.y, 1, 0, l), i.add(h.x, h.y, 1, 1, l), r.add(p + 0, p + 1, p + 2), r.add(p + 1, p + 2, p + 3), this._circleIndexCount += 6; + } + } + } + serialize() { + let e = 6; + e += this.layerUIDs.length, e += this._circleVertexBuffer.array.length, e += this._circleIndexBuffer.array.length; + const i = new Uint32Array(e), r = new Int32Array(i.buffer); + let n = 0; + i[n++] = this.type, i[n++] = this.layerUIDs.length; + for (let s = 0; s < this.layerUIDs.length; s++) + i[n++] = this.layerUIDs[s]; + i[n++] = this._circleIndexStart, i[n++] = this._circleIndexCount, i[n++] = this._circleVertexBuffer.array.length; + for (let s = 0; s < this._circleVertexBuffer.array.length; s++) + r[n++] = this._circleVertexBuffer.array[s]; + i[n++] = this._circleIndexBuffer.array.length; + for (let s = 0; s < this._circleIndexBuffer.array.length; s++) + i[n++] = this._circleIndexBuffer.array[s]; + return i.buffer; + } +}; +var HQe, WQe, qQe, ZU = {}, eUi = { get exports() { + return ZU; +}, set exports(t) { + ZU = t; +} }; +HQe = eUi, WQe = function() { + function t(xe, Pe, Oe) { + Oe = Oe || 2; + var Re, Ge, je, et, Qe, tt, ft, Mt = Pe && Pe.length, kt = Mt ? Pe[0] * Oe : xe.length, Tt = e(xe, 0, kt, Oe, !0), It = []; + if (!Tt || Tt.next === Tt.prev) + return It; + if (Mt && (Tt = l(xe, Pe, Tt, Oe)), xe.length > 80 * Oe) { + Re = je = xe[0], Ge = et = xe[1]; + for (var Nt = Oe; Nt < kt; Nt += Oe) + (Qe = xe[Nt]) < Re && (Re = Qe), (tt = xe[Nt + 1]) < Ge && (Ge = tt), Qe > je && (je = Qe), tt > et && (et = tt); + ft = (ft = Math.max(je - Re, et - Ge)) !== 0 ? 1 / ft : 0; + } + return r(Tt, It, Oe, Re, Ge, ft), It; + } + function e(xe, Pe, Oe, Re, Ge) { + var je, et; + if (Ge === ce(xe, Pe, Oe, Re) > 0) + for (je = Pe; je < Oe; je += Re) + et = Me(je, xe[je], xe[je + 1], et); + else + for (je = Oe - Re; je >= Pe; je -= Re) + et = Me(je, xe[je], xe[je + 1], et); + if (et && Y(et, et.next)) { + var Qe = et.next; + ke(et), et = Qe; + } + return et; + } + function i(xe, Pe) { + if (!xe) + return xe; + Pe || (Pe = xe); + var Oe, Re = xe; + do + if (Oe = !1, Re.steiner || !Y(Re, Re.next) && j(Re.prev, Re, Re.next) !== 0) + Re = Re.next; + else { + var Ge = Re.prev; + if (ke(Re), (Re = Pe = Ge) === Re.next) + break; + Oe = !0; + } + while (Oe || Re !== Pe); + return Pe; + } + function r(xe, Pe, Oe, Re, Ge, je, et) { + if (xe) { + !et && je && x(xe, Re, Ge, je); + for (var Qe, tt, ft = xe; xe.prev !== xe.next; ) + if (Qe = xe.prev, tt = xe.next, je ? s(xe, Re, Ge, je) : n(xe)) + Pe.push(Qe.i / Oe), Pe.push(xe.i / Oe), Pe.push(tt.i / Oe), ke(xe), xe = tt.next, ft = tt.next; + else if ((xe = tt) === ft) { + et ? et === 1 ? r(xe = o(i(xe), Pe, Oe), Pe, Oe, Re, Ge, je, 2) : et === 2 && a(xe, Pe, Oe, Re, Ge, je) : r(i(xe), Pe, Oe, Re, Ge, je, 1); + break; + } + } + } + function n(xe) { + var Pe = xe.prev, Oe = xe, Re = xe.next; + if (j(Pe, Oe, Re) >= 0) + return !1; + for (var Ge = xe.next.next; Ge !== xe.prev; ) { + if (k(Pe.x, Pe.y, Oe.x, Oe.y, Re.x, Re.y, Ge.x, Ge.y) && j(Ge.prev, Ge, Ge.next) >= 0) + return !1; + Ge = Ge.next; + } + return !0; + } + function s(xe, Pe, Oe, Re) { + var Ge = xe.prev, je = xe, et = xe.next; + if (j(Ge, je, et) >= 0) + return !1; + for (var Qe = Ge.x < je.x ? Ge.x < et.x ? Ge.x : et.x : je.x < et.x ? je.x : et.x, tt = Ge.y < je.y ? Ge.y < et.y ? Ge.y : et.y : je.y < et.y ? je.y : et.y, ft = Ge.x > je.x ? Ge.x > et.x ? Ge.x : et.x : je.x > et.x ? je.x : et.x, Mt = Ge.y > je.y ? Ge.y > et.y ? Ge.y : et.y : je.y > et.y ? je.y : et.y, kt = P(Qe, tt, Pe, Oe, Re), Tt = P(ft, Mt, Pe, Oe, Re), It = xe.prevZ, Nt = xe.nextZ; It && It.z >= kt && Nt && Nt.z <= Tt; ) { + if (It !== xe.prev && It !== xe.next && k(Ge.x, Ge.y, je.x, je.y, et.x, et.y, It.x, It.y) && j(It.prev, It, It.next) >= 0 || (It = It.prevZ, Nt !== xe.prev && Nt !== xe.next && k(Ge.x, Ge.y, je.x, je.y, et.x, et.y, Nt.x, Nt.y) && j(Nt.prev, Nt, Nt.next) >= 0)) + return !1; + Nt = Nt.nextZ; + } + for (; It && It.z >= kt; ) { + if (It !== xe.prev && It !== xe.next && k(Ge.x, Ge.y, je.x, je.y, et.x, et.y, It.x, It.y) && j(It.prev, It, It.next) >= 0) + return !1; + It = It.prevZ; + } + for (; Nt && Nt.z <= Tt; ) { + if (Nt !== xe.prev && Nt !== xe.next && k(Ge.x, Ge.y, je.x, je.y, et.x, et.y, Nt.x, Nt.y) && j(Nt.prev, Nt, Nt.next) >= 0) + return !1; + Nt = Nt.nextZ; + } + return !0; + } + function o(xe, Pe, Oe) { + var Re = xe; + do { + var Ge = Re.prev, je = Re.next.next; + !Y(Ge, je) && X(Ge, Re, Re.next, je) && fe(Ge, je) && fe(je, Ge) && (Pe.push(Ge.i / Oe), Pe.push(Re.i / Oe), Pe.push(je.i / Oe), ke(Re), ke(Re.next), Re = xe = je), Re = Re.next; + } while (Re !== xe); + return i(Re); + } + function a(xe, Pe, Oe, Re, Ge, je) { + var et = xe; + do { + for (var Qe = et.next.next; Qe !== et.prev; ) { + if (et.i !== Qe.i && V(et, Qe)) { + var tt = Se(et, Qe); + return et = i(et, et.next), tt = i(tt, tt.next), r(et, Pe, Oe, Re, Ge, je), void r(tt, Pe, Oe, Re, Ge, je); + } + Qe = Qe.next; + } + et = et.next; + } while (et !== xe); + } + function l(xe, Pe, Oe, Re) { + var Ge, je, et, Qe = []; + for (Ge = 0, je = Pe.length; Ge < je; Ge++) + (et = e(xe, Pe[Ge] * Re, Ge < je - 1 ? Pe[Ge + 1] * Re : xe.length, Re, !1)) === et.next && (et.steiner = !0), Qe.push(F(et)); + for (Qe.sort(c), Ge = 0; Ge < Qe.length; Ge++) + Oe = i(Oe = p(Qe[Ge], Oe), Oe.next); + return Oe; + } + function c(xe, Pe) { + return xe.x - Pe.x; + } + function h(xe) { + if (xe.next.prev === xe) + return xe; + let Pe = xe; + for (; ; ) { + const Oe = Pe.next; + if (Oe.prev === Pe || Oe === Pe || Oe === xe) + break; + Pe = Oe; + } + return Pe; + } + function p(xe, Pe) { + var Oe = y(xe, Pe); + if (!Oe) + return Pe; + var Re = Se(Oe, xe), Ge = i(Oe, Oe.next); + let je = h(Re); + return i(je, je.next), Ge = h(Ge), h(Pe === Oe ? Ge : Pe); + } + function y(xe, Pe) { + var Oe, Re = Pe, Ge = xe.x, je = xe.y, et = -1 / 0; + do { + if (je <= Re.y && je >= Re.next.y && Re.next.y !== Re.y) { + var Qe = Re.x + (je - Re.y) * (Re.next.x - Re.x) / (Re.next.y - Re.y); + if (Qe <= Ge && Qe > et) { + if (et = Qe, Qe === Ge) { + if (je === Re.y) + return Re; + if (je === Re.next.y) + return Re.next; + } + Oe = Re.x < Re.next.x ? Re : Re.next; + } + } + Re = Re.next; + } while (Re !== Pe); + if (!Oe) + return null; + if (Ge === et) + return Oe; + var tt, ft = Oe, Mt = Oe.x, kt = Oe.y, Tt = 1 / 0; + Re = Oe; + do + Ge >= Re.x && Re.x >= Mt && Ge !== Re.x && k(je < kt ? Ge : et, je, Mt, kt, je < kt ? et : Ge, je, Re.x, Re.y) && (tt = Math.abs(je - Re.y) / (Ge - Re.x), fe(Re, xe) && (tt < Tt || tt === Tt && (Re.x > Oe.x || Re.x === Oe.x && v(Oe, Re))) && (Oe = Re, Tt = tt)), Re = Re.next; + while (Re !== ft); + return Oe; + } + function v(xe, Pe) { + return j(xe.prev, xe, Pe.prev) < 0 && j(Pe.next, xe, xe.next) < 0; + } + function x(xe, Pe, Oe, Re) { + var Ge = xe; + do + Ge.z === null && (Ge.z = P(Ge.x, Ge.y, Pe, Oe, Re)), Ge.prevZ = Ge.prev, Ge.nextZ = Ge.next, Ge = Ge.next; + while (Ge !== xe); + Ge.prevZ.nextZ = null, Ge.prevZ = null, I(Ge); + } + function I(xe) { + var Pe, Oe, Re, Ge, je, et, Qe, tt, ft = 1; + do { + for (Oe = xe, xe = null, je = null, et = 0; Oe; ) { + for (et++, Re = Oe, Qe = 0, Pe = 0; Pe < ft && (Qe++, Re = Re.nextZ); Pe++) + ; + for (tt = ft; Qe > 0 || tt > 0 && Re; ) + Qe !== 0 && (tt === 0 || !Re || Oe.z <= Re.z) ? (Ge = Oe, Oe = Oe.nextZ, Qe--) : (Ge = Re, Re = Re.nextZ, tt--), je ? je.nextZ = Ge : xe = Ge, Ge.prevZ = je, je = Ge; + Oe = Re; + } + je.nextZ = null, ft *= 2; + } while (et > 1); + return xe; + } + function P(xe, Pe, Oe, Re, Ge) { + return (xe = 1431655765 & ((xe = 858993459 & ((xe = 252645135 & ((xe = 16711935 & ((xe = 32767 * (xe - Oe) * Ge) | xe << 8)) | xe << 4)) | xe << 2)) | xe << 1)) | (Pe = 1431655765 & ((Pe = 858993459 & ((Pe = 252645135 & ((Pe = 16711935 & ((Pe = 32767 * (Pe - Re) * Ge) | Pe << 8)) | Pe << 4)) | Pe << 2)) | Pe << 1)) << 1; + } + function F(xe) { + var Pe = xe, Oe = xe; + do + (Pe.x < Oe.x || Pe.x === Oe.x && Pe.y < Oe.y) && (Oe = Pe), Pe = Pe.next; + while (Pe !== xe); + return Oe; + } + function k(xe, Pe, Oe, Re, Ge, je, et, Qe) { + return (Ge - et) * (Pe - Qe) - (xe - et) * (je - Qe) >= 0 && (xe - et) * (Re - Qe) - (Oe - et) * (Pe - Qe) >= 0 && (Oe - et) * (je - Qe) - (Ge - et) * (Re - Qe) >= 0; + } + function V(xe, Pe) { + return xe.next.i !== Pe.i && xe.prev.i !== Pe.i && !he(xe, Pe) && (fe(xe, Pe) && fe(Pe, xe) && be(xe, Pe) && (j(xe.prev, xe, Pe.prev) || j(xe, Pe.prev, Pe)) || Y(xe, Pe) && j(xe.prev, xe, xe.next) > 0 && j(Pe.prev, Pe, Pe.next) > 0); + } + function j(xe, Pe, Oe) { + return (Pe.y - xe.y) * (Oe.x - Pe.x) - (Pe.x - xe.x) * (Oe.y - Pe.y); + } + function Y(xe, Pe) { + return xe.x === Pe.x && xe.y === Pe.y; + } + function X(xe, Pe, Oe, Re) { + var Ge = re(j(xe, Pe, Oe)), je = re(j(xe, Pe, Re)), et = re(j(Oe, Re, xe)), Qe = re(j(Oe, Re, Pe)); + return Ge !== je && et !== Qe || !(Ge !== 0 || !Q(xe, Oe, Pe)) || !(je !== 0 || !Q(xe, Re, Pe)) || !(et !== 0 || !Q(Oe, xe, Re)) || !(Qe !== 0 || !Q(Oe, Pe, Re)); + } + function Q(xe, Pe, Oe) { + return Pe.x <= Math.max(xe.x, Oe.x) && Pe.x >= Math.min(xe.x, Oe.x) && Pe.y <= Math.max(xe.y, Oe.y) && Pe.y >= Math.min(xe.y, Oe.y); + } + function re(xe) { + return xe > 0 ? 1 : xe < 0 ? -1 : 0; + } + function he(xe, Pe) { + var Oe = xe; + do { + if (Oe.i !== xe.i && Oe.next.i !== xe.i && Oe.i !== Pe.i && Oe.next.i !== Pe.i && X(Oe, Oe.next, xe, Pe)) + return !0; + Oe = Oe.next; + } while (Oe !== xe); + return !1; + } + function fe(xe, Pe) { + return j(xe.prev, xe, xe.next) < 0 ? j(xe, Pe, xe.next) >= 0 && j(xe, xe.prev, Pe) >= 0 : j(xe, Pe, xe.prev) < 0 || j(xe, xe.next, Pe) < 0; + } + function be(xe, Pe) { + var Oe = xe, Re = !1, Ge = (xe.x + Pe.x) / 2, je = (xe.y + Pe.y) / 2; + do + Oe.y > je != Oe.next.y > je && Oe.next.y !== Oe.y && Ge < (Oe.next.x - Oe.x) * (je - Oe.y) / (Oe.next.y - Oe.y) + Oe.x && (Re = !Re), Oe = Oe.next; + while (Oe !== xe); + return Re; + } + function Se(xe, Pe) { + var Oe = new J(xe.i, xe.x, xe.y), Re = new J(Pe.i, Pe.x, Pe.y), Ge = xe.next, je = Pe.prev; + return xe.next = Pe, Pe.prev = xe, Oe.next = Ge, Ge.prev = Oe, Re.next = Oe, Oe.prev = Re, je.next = Re, Re.prev = je, Re; + } + function Me(xe, Pe, Oe, Re) { + var Ge = new J(xe, Pe, Oe); + return Re ? (Ge.next = Re.next, Ge.prev = Re, Re.next.prev = Ge, Re.next = Ge) : (Ge.prev = Ge, Ge.next = Ge), Ge; + } + function ke(xe) { + xe.next.prev = xe.prev, xe.prev.next = xe.next, xe.prevZ && (xe.prevZ.nextZ = xe.nextZ), xe.nextZ && (xe.nextZ.prevZ = xe.prevZ); + } + function J(xe, Pe, Oe) { + this.i = xe, this.x = Pe, this.y = Oe, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1; + } + function ce(xe, Pe, Oe, Re) { + for (var Ge = 0, je = Pe, et = Oe - Re; je < Oe; je += Re) + Ge += (xe[et] - xe[je]) * (xe[je + 1] + xe[et + 1]), et = je; + return Ge; + } + return t.deviation = function(xe, Pe, Oe, Re) { + var Ge = Pe && Pe.length, je = Ge ? Pe[0] * Oe : xe.length, et = Math.abs(ce(xe, 0, je, Oe)); + if (Ge) + for (var Qe = 0, tt = Pe.length; Qe < tt; Qe++) { + var ft = Pe[Qe] * Oe, Mt = Qe < tt - 1 ? Pe[Qe + 1] * Oe : xe.length; + et -= Math.abs(ce(xe, ft, Mt, Oe)); + } + var kt = 0; + for (Qe = 0; Qe < Re.length; Qe += 3) { + var Tt = Re[Qe] * Oe, It = Re[Qe + 1] * Oe, Nt = Re[Qe + 2] * Oe; + kt += Math.abs((xe[Tt] - xe[Nt]) * (xe[It + 1] - xe[Tt + 1]) - (xe[Tt] - xe[It]) * (xe[Nt + 1] - xe[Tt + 1])); + } + return et === 0 && kt === 0 ? 0 : Math.abs((kt - et) / et); + }, t.flatten = function(xe) { + for (var Pe = xe[0][0].length, Oe = { vertices: [], holes: [], dimensions: Pe }, Re = 0, Ge = 0; Ge < xe.length; Ge++) { + for (var je = 0; je < xe[Ge].length; je++) + for (var et = 0; et < Pe; et++) + Oe.vertices.push(xe[Ge][je][et]); + Ge > 0 && (Re += xe[Ge - 1].length, Oe.holes.push(Re)); + } + return Oe; + }, t; +}, (qQe = WQe()) !== void 0 && (HQe.exports = qQe); +let tUi = class lOt extends yve { + constructor(e, i, r, n, s, o, a) { + super(e, i, r), this.type = Pg.FILL, this._patternMap = /* @__PURE__ */ new Map(), this._fillVertexBuffer = n, this._fillIndexBuffer = s, this._outlineVertexBuffer = o, this._outlineIndexBuffer = a; + } + get fillIndexStart() { + return this._fillIndexStart; + } + get fillIndexCount() { + return this._fillIndexCount; + } + get outlineIndexStart() { + return this._outlineIndexStart; + } + get outlineIndexCount() { + return this._outlineIndexCount; + } + getResources(e, i, r) { + const n = this.layer, s = this.zoom, o = n.getPaintProperty("fill-pattern"); + if (o) + if (o.isDataDriven) + for (const a of this._features) + i(o.getValue(s, a), !0); + else + i(o.getValue(s), !0); + } + processFeatures(e) { + this._fillIndexStart = 3 * this._fillIndexBuffer.index, this._fillIndexCount = 0, this._outlineIndexStart = 3 * this._outlineIndexBuffer.index, this._outlineIndexCount = 0; + const i = this.layer, r = this.zoom, { fillMaterial: n, outlineMaterial: s, hasDataDrivenFill: o, hasDataDrivenOutline: a } = i; + e && e.setExtent(this.layerExtent); + const l = i.getPaintProperty("fill-pattern"), c = l?.isDataDriven; + let h = !l && i.getPaintValue("fill-antialias", r); + if (i.outlineUsesFillColor) { + if (h && !i.hasDataDrivenOpacity) { + const v = i.getPaintValue("fill-opacity", r), x = i.getPaintValue("fill-opacity", r + 1); + v < 1 && x < 1 && (h = !1); + } + if (h && !i.hasDataDrivenColor) { + const v = i.getPaintValue("fill-color", r), x = i.getPaintValue("fill-color", r + 1); + v[3] < 1 && x[3] < 1 && (h = !1); + } + } + const p = this._features, y = e?.validateTessellation; + if (c) { + const v = []; + for (const x of p) { + const I = l.getValue(r, x), P = this._spriteInfo[I]; + if (!P || !P.rect) + continue; + const F = n.encodeAttributes(x, r, i, P), k = h && a ? s.encodeAttributes(x, r, i) : [], V = x.getGeometry(e); + v.push({ ddFillAttributes: F, ddOutlineAttributes: k, page: P.page, geometry: V }), v.sort((j, Y) => j.page - Y.page); + for (const { ddFillAttributes: j, ddOutlineAttributes: Y, page: X, geometry: Q } of v) + this._processFeature(Q, h, i.outlineUsesFillColor, j, Y, y, X); + } + } else + for (const v of p) { + const x = o ? n.encodeAttributes(v, r, i) : null, I = h && a ? s.encodeAttributes(v, r, i) : null, P = v.getGeometry(e); + this._processFeature(P, h, i.outlineUsesFillColor, x, I, y); + } + } + serialize() { + let e = 10; + e += this.layerUIDs.length, e += this._fillVertexBuffer.array.length, e += this._fillIndexBuffer.array.length, e += this._outlineVertexBuffer.array.length, e += this._outlineIndexBuffer.array.length, e += 3 * this._patternMap.size + 1; + const i = new Uint32Array(e), r = new Int32Array(i.buffer); + let n = 0; + i[n++] = this.type, i[n++] = this.layerUIDs.length; + for (let a = 0; a < this.layerUIDs.length; a++) + i[n++] = this.layerUIDs[a]; + i[n++] = this._fillIndexStart, i[n++] = this._fillIndexCount, i[n++] = this._outlineIndexStart, i[n++] = this._outlineIndexCount; + const s = this._patternMap, o = s.size; + if (i[n++] = o, o > 0) + for (const [a, [l, c]] of s) + i[n++] = a, i[n++] = l, i[n++] = c; + i[n++] = this._fillVertexBuffer.array.length; + for (let a = 0; a < this._fillVertexBuffer.array.length; a++) + r[n++] = this._fillVertexBuffer.array[a]; + i[n++] = this._fillIndexBuffer.array.length; + for (let a = 0; a < this._fillIndexBuffer.array.length; a++) + i[n++] = this._fillIndexBuffer.array[a]; + i[n++] = this._outlineVertexBuffer.array.length; + for (let a = 0; a < this._outlineVertexBuffer.array.length; a++) + r[n++] = this._outlineVertexBuffer.array[a]; + i[n++] = this._outlineIndexBuffer.array.length; + for (let a = 0; a < this._outlineIndexBuffer.array.length; a++) + i[n++] = this._outlineIndexBuffer.array[a]; + return i.buffer; + } + _processFeature(e, i, r, n, s, o, a) { + if (!e) + return; + const l = e.length, c = !s || s.length === 0; + if (i && (!r || c)) + for (let y = 0; y < l; y++) + this._processOutline(e[y], s); + const h = 32; + let p; + for (let y = 0; y < l; y++) { + const v = lOt._area(e[y]); + v > h ? (p !== void 0 && this._processFill(e, p, n, o, a), p = [y]) : v < -h && p !== void 0 && p.push(y); + } + p !== void 0 && this._processFill(e, p, n, o, a); + } + _processOutline(e, i) { + const r = this._outlineVertexBuffer, n = this._outlineIndexBuffer, s = n.index; + let o, a, l; + const c = new Jo(0, 0), h = new Jo(0, 0), p = new Jo(0, 0); + let y = -1, v = -1, x = -1, I = -1, P = -1, F = !1; + const k = 0; + let V = e.length; + if (V < 2) + return; + const j = e[k]; + let Y = e[V - 1]; + for (; V && Y.isEqual(j); ) + --V, Y = e[V - 1]; + if (!(V - k < 2)) { + for (let X = k; X < V; ++X) { + X === k ? (o = e[V - 1], a = e[k], l = e[k + 1], c.assignSub(a, o), c.normalize(), c.rightPerpendicular()) : (o = a, a = l, l = X !== V - 1 ? e[X + 1] : e[k], c.assign(h)); + const Q = this._isClipEdge(o, a); + I === -1 && (F = Q), h.assignSub(l, a), h.normalize(), h.rightPerpendicular(); + const re = c.x * h.y - c.y * h.x; + p.assignAdd(c, h), p.normalize(); + const he = -p.x * -c.x + -p.y * -c.y; + let fe = Math.abs(he !== 0 ? 1 / he : 1); + fe > 8 && (fe = 8), re >= 0 ? (x = r.add(a.x, a.y, c.x, c.y, 0, 1, i), I === -1 && (I = x), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), v = r.add(a.x, a.y, fe * -p.x, fe * -p.y, 0, -1, i), P === -1 && (P = v), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), y = v, v = x, x = r.add(a.x, a.y, p.x, p.y, 0, 1, i), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), v = r.add(a.x, a.y, h.x, h.y, 0, 1, i), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x)) : (x = r.add(a.x, a.y, fe * p.x, fe * p.y, 0, 1, i), I === -1 && (I = x), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), v = r.add(a.x, a.y, -c.x, -c.y, 0, -1, i), P === -1 && (P = v), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), y = v, v = x, x = r.add(a.x, a.y, -p.x, -p.y, 0, -1, i), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x), y = r.add(a.x, a.y, -h.x, -h.y, 0, -1, i), y >= 0 && v >= 0 && x >= 0 && !Q && n.add(y, v, x)); + } + y >= 0 && v >= 0 && I >= 0 && !F && n.add(y, v, I), y >= 0 && I >= 0 && P >= 0 && !F && n.add(y, P, I), this._outlineIndexCount += 3 * (n.index - s); + } + } + _processFill(e, i, r, n, s) { + n = !0; + let o; + i.length > 1 && (o = []); + let a = 0; + for (const p of i) + a !== 0 && o.push(a), a += e[p].length; + const l = 2 * a, c = my.acquire(); + for (const p of i) { + const y = e[p], v = y.length; + for (let x = 0; x < v; ++x) + c.push(y[x].x, y[x].y); + } + const h = ZU(c, o, 2); + if (n && ZU.deviation(c, o, 2, h) > 0) { + const p = i.map((x) => e[x].length), { buffer: y, vertexCount: v } = oOt(c, p); + if (v > 0) { + const x = this._fillVertexBuffer.index; + for (let I = 0; I < v; I++) + this._fillVertexBuffer.add(y[2 * I], y[2 * I + 1], r); + for (let I = 0; I < v; I += 3) { + const P = x + I; + this._fillIndexBuffer.add(P, P + 1, P + 2); + } + if (s !== void 0) { + const I = this._patternMap, P = I.get(s); + P ? P[1] += v : I.set(s, [this._fillIndexStart + this._fillIndexCount, v]); + } + this._fillIndexCount += v; + } + } else { + const p = h.length; + if (p > 0) { + const y = this._fillVertexBuffer.index; + let v = 0; + for (; v < l; ) + this._fillVertexBuffer.add(c[v++], c[v++], r); + let x = 0; + for (; x < p; ) + this._fillIndexBuffer.add(y + h[x++], y + h[x++], y + h[x++]); + if (s !== void 0) { + const I = this._patternMap, P = I.get(s); + P ? P[1] += p : I.set(s, [this._fillIndexStart + this._fillIndexCount, p]); + } + this._fillIndexCount += p; + } + } + my.release(c); + } + _isClipEdge(e, i) { + return e.x === i.x ? e.x <= -64 || e.x >= 4160 : e.y === i.y && (e.y <= -64 || e.y >= 4160); + } + static _area(e) { + let i = 0; + const r = e.length - 1; + for (let n = 0; n < r; n++) + i += (e[n].x - e[n + 1].x) * (e[n].y + e[n + 1].y); + return i += (e[r].x - e[0].x) * (e[r].y + e[0].y), 0.5 * i; + } +}; +function uOt(t, e) { + return t.x === e.x && t.y === e.y; +} +function iUi(t) { + if (!t) + return; + const e = t.length; + if (e <= 1) + return; + let i = 0; + for (let r = 1; r < e; r++) + uOt(t[r], t[i]) || ++i === r || (t[i] = t[r]); + t.length = i + 1; +} +function _2(t, e) { + return t.x = e.y, t.y = -e.x, t; +} +function fw(t, e) { + return t.x = -e.y, t.y = e.x, t; +} +function YQe(t, e) { + return t.x = e.x, t.y = e.y, t; +} +function Rxe(t, e) { + return t.x = -e.x, t.y = -e.y, t; +} +function Mxe(t) { + return Math.sqrt(t.x * t.x + t.y * t.y); +} +function rUi(t, e) { + return t.x * e.y - t.y * e.x; +} +function XQe(t, e) { + return t.x * e.x + t.y * e.y; +} +function vB(t, e, i, r) { + return t.x = e.x * i + e.y * r, t.y = e.x * r - e.y * i, t; +} +let cOt = class { + constructor(e, i, r) { + this._writeVertex = e, this._writeTriangle = i, this._canUseThinTessellation = r, this._prevNormal = { x: void 0, y: void 0 }, this._nextNormal = { x: void 0, y: void 0 }, this._textureNormalLeft = { x: 0, y: 1 }, this._textureNormalRight = { x: 0, y: -1 }, this._textureNormal = { x: void 0, y: void 0 }, this._joinNormal = { x: void 0, y: void 0 }, this._inner = { x: void 0, y: void 0 }, this._outer = { x: void 0, y: void 0 }, this._roundStart = { x: void 0, y: void 0 }, this._roundEnd = { x: void 0, y: void 0 }, this._startBreak = { x: void 0, y: void 0 }, this._endBreak = { x: void 0, y: void 0 }, this._innerPrev = { x: void 0, y: void 0 }, this._innerNext = { x: void 0, y: void 0 }, this._bevelStart = { x: void 0, y: void 0 }, this._bevelEnd = { x: void 0, y: void 0 }, this._bevelMiddle = { x: void 0, y: void 0 }; + } + tessellate(e, i) { + iUi(e), this._canUseThinTessellation && i.halfWidth < P8e && !i.offset ? this._tessellateThin(e, i) : this._tessellate(e, i); + } + _tessellateThin(e, i) { + if (e.length < 2) + return; + const r = i.wrapDistance || 65535; + let n = i.initialDistance || 0, s = !1, o = e[0].x, a = e[0].y; + const l = e.length; + for (let c = 1; c < l; ++c) { + s && (s = !1, n = 0); + let h = e[c].x, p = e[c].y, y = h - o, v = p - a, x = Math.sqrt(y * y + v * v); + if (y /= x, v /= x, n + x > r) { + s = !0; + const V = (r - n) / x; + x = r - n, h = (1 - V) * o + V * h, p = (1 - V) * a + V * p, --c; + } + const I = this._writeVertex(o, a, 0, 0, y, v, v, -y, 0, -1, n), P = this._writeVertex(o, a, 0, 0, y, v, -v, y, 0, 1, n); + n += x; + const F = this._writeVertex(h, p, 0, 0, y, v, v, -y, 0, -1, n), k = this._writeVertex(h, p, 0, 0, y, v, -v, y, 0, 1, n); + this._writeTriangle(I, P, F), this._writeTriangle(P, F, k), o = h, a = p; + } + } + _tessellate(e, i) { + const r = e[0], n = e[e.length - 1], s = uOt(r, n), o = s ? 3 : 2; + if (e.length < o) + return; + const a = i.pixelCoordRatio, l = i.capType != null ? i.capType : Pf.BUTT, c = i.joinType != null ? i.joinType : om.MITER, h = i.miterLimit != null ? Math.min(i.miterLimit, 4) : 2, p = i.roundLimit != null ? Math.min(i.roundLimit, 1.05) : 1.05, y = i.halfWidth != null ? i.halfWidth : 2, v = !!i.textured; + let x, I, P, F = null; + const k = this._prevNormal, V = this._nextNormal; + let j = -1, Y = -1; + const X = this._joinNormal; + let Q, re; + const he = this._textureNormalLeft, fe = this._textureNormalRight, be = this._textureNormal; + let Se = -1, Me = -1; + const ke = i.wrapDistance || 65535; + let J = i.initialDistance || 0; + const ce = this._writeVertex, xe = this._writeTriangle, Pe = (Re, Ge, je, et, Qe, tt) => { + const ft = ce(I, P, Q, re, je, et, Re, Ge, Qe, tt, J); + return Se >= 0 && Me >= 0 && ft >= 0 && xe(Se, Me, ft), Se = Me, Me = ft, ft; + }; + s && (x = e[e.length - 2], V.x = n.x - x.x, V.y = n.y - x.y, Y = Mxe(V), V.x /= Y, V.y /= Y); + let Oe = !1; + for (let Re = 0; Re < e.length; ++Re) { + if (Oe && (Oe = !1, J = 0), x && (k.x = -V.x, k.y = -V.y, j = Y, J + j > ke && (Oe = !0)), Oe) { + const Mt = (ke - J) / j; + j = ke - J, x = { x: (1 - Mt) * x.x + Mt * e[Re].x, y: (1 - Mt) * x.y + Mt * e[Re].y }, --Re; + } else + x = e[Re]; + I = x.x, P = x.y; + const Ge = Re <= 0 && !Oe, je = Re === e.length - 1; + if (Ge || (J += j), F = je ? s ? e[1] : null : e[Re + 1], F ? (V.x = F.x - I, V.y = F.y - P, Y = Mxe(V), V.x /= Y, V.y /= Y) : (V.x = void 0, V.y = void 0), !s) { + if (Ge) { + fw(X, V), Q = X.x, re = X.y, l === Pf.SQUARE && (Pe(-V.y - V.x, V.x - V.y, V.x, V.y, 0, -1), Pe(V.y - V.x, -V.x - V.y, V.x, V.y, 0, 1)), l === Pf.ROUND && (Pe(-V.y - V.x, V.x - V.y, V.x, V.y, -1, -1), Pe(V.y - V.x, -V.x - V.y, V.x, V.y, -1, 1)), l !== Pf.ROUND && l !== Pf.BUTT || (Pe(-V.y, V.x, V.x, V.y, 0, -1), Pe(V.y, -V.x, V.x, V.y, 0, 1)); + continue; + } + if (je) { + _2(X, k), Q = X.x, re = X.y, l !== Pf.ROUND && l !== Pf.BUTT || (Pe(k.y, -k.x, -k.x, -k.y, 0, -1), Pe(-k.y, k.x, -k.x, -k.y, 0, 1)), l === Pf.SQUARE && (Pe(k.y - k.x, -k.x - k.y, -k.x, -k.y, 0, -1), Pe(-k.y - k.x, k.x - k.y, -k.x, -k.y, 0, 1)), l === Pf.ROUND && (Pe(k.y - k.x, -k.x - k.y, -k.x, -k.y, 1, -1), Pe(-k.y - k.x, k.x - k.y, -k.x, -k.y, 1, 1)); + continue; + } + } + let et, Qe, tt = -rUi(k, V); + if (Math.abs(tt) < 0.01) + XQe(k, V) > 0 ? (X.x = k.x, X.y = k.y, tt = 1, et = Number.MAX_VALUE, Qe = !0) : (fw(X, V), tt = 1, et = 1, Qe = !1); + else { + X.x = (k.x + V.x) / tt, X.y = (k.y + V.y) / tt, et = Mxe(X); + const Mt = (et - 1) * y * a; + Qe = et > 4 || Mt > j && Mt > Y; + } + Q = X.x, re = X.y; + let ft = c; + switch (c) { + case om.BEVEL: + et < 1.05 && (ft = om.MITER); + break; + case om.ROUND: + et < p && (ft = om.MITER); + break; + case om.MITER: + et > h && (ft = om.BEVEL); + } + switch (ft) { + case om.MITER: + if (Pe(X.x, X.y, -k.x, -k.y, 0, -1), Pe(-X.x, -X.y, -k.x, -k.y, 0, 1), je) + break; + if (v) { + const Mt = Oe ? 0 : J; + Se = this._writeVertex(I, P, Q, re, V.x, V.y, X.x, X.y, 0, -1, Mt), Me = this._writeVertex(I, P, Q, re, V.x, V.y, -X.x, -X.y, 0, 1, Mt); + } + break; + case om.BEVEL: { + const Mt = tt < 0; + let kt, Tt, It, Nt; + if (Mt) { + const at = Se; + Se = Me, Me = at, kt = he, Tt = fe; + } else + kt = fe, Tt = he; + if (Qe) + It = Mt ? fw(this._innerPrev, k) : _2(this._innerPrev, k), Nt = Mt ? _2(this._innerNext, V) : fw(this._innerNext, V); + else { + const at = Mt ? Rxe(this._inner, X) : YQe(this._inner, X); + It = at, Nt = at; + } + const nt = Mt ? _2(this._bevelStart, k) : fw(this._bevelStart, k); + Pe(It.x, It.y, -k.x, -k.y, kt.x, kt.y); + const Ee = Pe(nt.x, nt.y, -k.x, -k.y, Tt.x, Tt.y); + if (je) + break; + const Be = Mt ? fw(this._bevelEnd, V) : _2(this._bevelEnd, V); + if (Qe) { + const at = this._writeVertex(I, P, Q, re, -k.x, -k.y, 0, 0, 0, 0, J); + Se = this._writeVertex(I, P, Q, re, V.x, V.y, Nt.x, Nt.y, kt.x, kt.y, J), Me = this._writeVertex(I, P, Q, re, V.x, V.y, Be.x, Be.y, Tt.x, Tt.y, J), this._writeTriangle(Ee, at, Me); + } else { + if (v) { + const at = this._bevelMiddle; + at.x = (nt.x + Be.x) / 2, at.y = (nt.y + Be.y) / 2, vB(be, at, -k.x, -k.y), Pe(at.x, at.y, -k.x, -k.y, be.x, be.y), vB(be, at, V.x, V.y), Se = this._writeVertex(I, P, Q, re, V.x, V.y, at.x, at.y, be.x, be.y, J), Me = this._writeVertex(I, P, Q, re, V.x, V.y, Nt.x, Nt.y, kt.x, kt.y, J); + } else { + const at = Se; + Se = Me, Me = at; + } + Pe(Be.x, Be.y, V.x, V.y, Tt.x, Tt.y); + } + if (Mt) { + const at = Se; + Se = Me, Me = at; + } + break; + } + case om.ROUND: { + const Mt = tt < 0; + let kt, Tt; + if (Mt) { + const mt = Se; + Se = Me, Me = mt, kt = he, Tt = fe; + } else + kt = fe, Tt = he; + const It = Mt ? Rxe(this._inner, X) : YQe(this._inner, X); + let Nt, nt; + Qe ? (Nt = Mt ? fw(this._innerPrev, k) : _2(this._innerPrev, k), nt = Mt ? _2(this._innerNext, V) : fw(this._innerNext, V)) : (Nt = It, nt = It); + const Ee = Mt ? _2(this._roundStart, k) : fw(this._roundStart, k), Be = Mt ? fw(this._roundEnd, V) : _2(this._roundEnd, V), at = Pe(Nt.x, Nt.y, -k.x, -k.y, kt.x, kt.y), wt = Pe(Ee.x, Ee.y, -k.x, -k.y, Tt.x, Tt.y); + if (je) + break; + const st = this._writeVertex(I, P, Q, re, -k.x, -k.y, 0, 0, 0, 0, J); + Qe || this._writeTriangle(Se, Me, st); + const le = Rxe(this._outer, It), ct = this._writeVertex(I, P, Q, re, V.x, V.y, Be.x, Be.y, Tt.x, Tt.y, J); + let gt, Ne; + const pe = et > 2; + if (pe) { + let mt; + et !== Number.MAX_VALUE ? (le.x /= et, le.y /= et, mt = XQe(k, le), mt = (et * (mt * mt - 1) + 1) / mt) : mt = -1, gt = Mt ? _2(this._startBreak, k) : fw(this._startBreak, k), gt.x += k.x * mt, gt.y += k.y * mt, Ne = Mt ? fw(this._endBreak, V) : _2(this._endBreak, V), Ne.x += V.x * mt, Ne.y += V.y * mt; + } + vB(be, le, -k.x, -k.y); + const Ae = this._writeVertex(I, P, Q, re, -k.x, -k.y, le.x, le.y, be.x, be.y, J); + vB(be, le, V.x, V.y); + const it = v ? this._writeVertex(I, P, Q, re, V.x, V.y, le.x, le.y, be.x, be.y, J) : Ae, yt = st, He = v ? this._writeVertex(I, P, Q, re, V.x, V.y, 0, 0, 0, 0, J) : st; + let Ft = -1, ei = -1; + if (pe && (vB(be, gt, -k.x, -k.y), Ft = this._writeVertex(I, P, Q, re, -k.x, -k.y, gt.x, gt.y, be.x, be.y, J), vB(be, Ne, V.x, V.y), ei = this._writeVertex(I, P, Q, re, V.x, V.y, Ne.x, Ne.y, be.x, be.y, J)), v ? pe ? (this._writeTriangle(yt, wt, Ft), this._writeTriangle(yt, Ft, Ae), this._writeTriangle(He, it, ei), this._writeTriangle(He, ei, ct)) : (this._writeTriangle(yt, wt, Ae), this._writeTriangle(He, it, ct)) : pe ? (this._writeTriangle(st, wt, Ft), this._writeTriangle(st, Ft, ei), this._writeTriangle(st, ei, ct)) : (this._writeTriangle(st, wt, Ae), this._writeTriangle(st, it, ct)), Qe ? (Se = this._writeVertex(I, P, Q, re, V.x, V.y, nt.x, nt.y, kt.x, kt.y, J), Me = ct) : (Se = v ? this._writeVertex(I, P, Q, re, V.x, V.y, nt.x, nt.y, kt.x, kt.y, J) : at, this._writeTriangle(Se, He, ct), Me = ct), Mt) { + const mt = Se; + Se = Me, Me = mt; + } + break; + } + } + } + } +}; +const nUi = 65535; +let sUi = class extends yve { + constructor(e, i, r, n, s) { + super(e, i, r), this.type = Pg.LINE, this._tessellationOptions = { pixelCoordRatio: 8, halfWidth: 0, offset: 0 }, this._patternMap = /* @__PURE__ */ new Map(), this.tessellationProperties = { _lineVertexBuffer: null, _lineIndexBuffer: null, _ddValues: null }, this.tessellationProperties._lineVertexBuffer = n, this.tessellationProperties._lineIndexBuffer = s, this._lineTessellator = new cOt(oUi(this.tessellationProperties), aUi(this.tessellationProperties), e.canUseThinTessellation); + } + get lineIndexStart() { + return this._lineIndexStart; + } + get lineIndexCount() { + return this._lineIndexCount; + } + getResources(e, i, r) { + const n = this.layer, s = this.zoom, o = n.getPaintProperty("line-pattern"), a = n.getPaintProperty("line-dasharray"), l = n.getLayoutProperty("line-cap"); + if (!o && !a) + return; + const c = l?.getValue(s) || 0, h = l?.isDataDriven, p = o?.isDataDriven, y = a?.isDataDriven; + if (p || y) + for (const v of this._features) + i(p ? o.getValue(s, v) : this._getDashArrayKey(v, s, n, a, h, l, c)); + else if (o) + i(o.getValue(s)); + else if (a) { + const v = a.getValue(s); + i(n.getDashKey(v, c)); + } + } + processFeatures(e) { + this._lineIndexStart = 3 * this.tessellationProperties._lineIndexBuffer.index, this._lineIndexCount = 0; + const i = this.layer, r = this.zoom, n = this._features, s = this._tessellationOptions, { hasDataDrivenLine: o, lineMaterial: a } = i; + e && e.setExtent(this.layerExtent); + const l = i.getPaintProperty("line-pattern"), c = i.getPaintProperty("line-dasharray"), h = l?.isDataDriven, p = c?.isDataDriven; + let y; + y = i.getLayoutProperty("line-cap"); + const v = y?.isDataDriven ? y : null, x = v ? null : i.getLayoutValue("line-cap", r), I = x || 0, P = !!v; + y = i.getLayoutProperty("line-join"); + const F = y?.isDataDriven ? y : null, k = F ? null : i.getLayoutValue("line-join", r); + y = i.getLayoutProperty("line-miter-limit"); + const V = y?.isDataDriven ? y : null, j = V ? null : i.getLayoutValue("line-miter-limit", r); + y = i.getLayoutProperty("line-round-limit"); + const Y = y?.isDataDriven ? y : null, X = Y ? null : i.getLayoutValue("line-round-limit", r); + y = i.getPaintProperty("line-width"); + const Q = y?.isDataDriven ? y : null, re = Q ? null : i.getPaintValue("line-width", r); + y = i.getPaintProperty("line-offset"); + const he = y?.isDataDriven ? y : null, fe = he ? null : i.getPaintValue("line-offset", r); + if (h || p) { + const be = []; + for (const Se of n) { + const Me = h ? l.getValue(r, Se) : this._getDashArrayKey(Se, r, i, c, P, v, I), ke = this._spriteInfo[Me]; + if (!ke || !ke.rect) + continue; + const J = a.encodeAttributes(Se, r, i, ke), ce = Se.getGeometry(e); + be.push({ ddAttributes: J, page: ke.page, cap: v ? v.getValue(r, Se) : x, join: F ? F.getValue(r, Se) : k, miterLimit: V ? V.getValue(r, Se) : j, roundLimit: Y ? Y.getValue(r, Se) : X, halfWidth: 0.5 * (Q ? Q.getValue(r, Se) : re), offset: he ? he.getValue(r, Se) : fe, geometry: ce }); + } + be.sort((Se, Me) => Se.page - Me.page), s.textured = !0; + for (const { ddAttributes: Se, page: Me, cap: ke, join: J, miterLimit: ce, roundLimit: xe, halfWidth: Pe, offset: Oe, geometry: Re } of be) + s.capType = ke, s.joinType = J, s.miterLimit = ce, s.roundLimit = xe, s.halfWidth = Pe, s.offset = Oe, this._processFeature(Re, Se, Me); + } else { + if (l) { + const be = l.getValue(r), Se = this._spriteInfo[be]; + if (!Se || !Se.rect) + return; + } + s.textured = !(!l && !c), s.capType = x, s.joinType = k, s.miterLimit = j, s.roundLimit = X, s.halfWidth = 0.5 * re, s.offset = fe; + for (const be of n) { + const Se = o ? a.encodeAttributes(be, r, i) : null; + v && (s.capType = v.getValue(r, be)), F && (s.joinType = F.getValue(r, be)), V && (s.miterLimit = V.getValue(r, be)), Y && (s.roundLimit = Y.getValue(r, be)), Q && (s.halfWidth = 0.5 * Q.getValue(r, be)), he && (s.offset = he.getValue(r, be)); + const Me = be.getGeometry(e); + this._processFeature(Me, Se); + } + } + } + serialize() { + let e = 6; + e += this.layerUIDs.length, e += this.tessellationProperties._lineVertexBuffer.array.length, e += this.tessellationProperties._lineIndexBuffer.array.length, e += 3 * this._patternMap.size + 1; + const i = new Uint32Array(e), r = new Int32Array(i.buffer); + let n = 0; + i[n++] = this.type, i[n++] = this.layerUIDs.length; + for (let a = 0; a < this.layerUIDs.length; a++) + i[n++] = this.layerUIDs[a]; + i[n++] = this._lineIndexStart, i[n++] = this._lineIndexCount; + const s = this._patternMap, o = s.size; + if (i[n++] = o, o > 0) + for (const [a, [l, c]] of s) + i[n++] = a, i[n++] = l, i[n++] = c; + i[n++] = this.tessellationProperties._lineVertexBuffer.array.length; + for (let a = 0; a < this.tessellationProperties._lineVertexBuffer.array.length; a++) + r[n++] = this.tessellationProperties._lineVertexBuffer.array[a]; + i[n++] = this.tessellationProperties._lineIndexBuffer.array.length; + for (let a = 0; a < this.tessellationProperties._lineIndexBuffer.array.length; a++) + i[n++] = this.tessellationProperties._lineIndexBuffer.array[a]; + return i.buffer; + } + _processFeature(e, i, r) { + if (!e) + return; + const n = e.length; + for (let s = 0; s < n; s++) + this._processGeometry(e[s], i, r); + } + _processGeometry(e, i, r) { + if (e.length < 2) + return; + const n = 1e-3; + let s, o, a = e[0], l = 1; + for (; l < e.length; ) + s = e[l].x - a.x, o = e[l].y - a.y, s * s + o * o < n * n ? e.splice(l, 1) : (a = e[l], ++l); + if (e.length < 2) + return; + const c = this.tessellationProperties._lineIndexBuffer, h = 3 * c.index; + this._tessellationOptions.initialDistance = 0, this._tessellationOptions.wrapDistance = nUi, this.tessellationProperties._ddValues = i, this._lineTessellator.tessellate(e, this._tessellationOptions); + const p = 3 * c.index - h; + if (r !== void 0) { + const y = this._patternMap, v = y.get(r); + v ? v[1] += p : y.set(r, [h + this._lineIndexCount, p]); + } + this._lineIndexCount += p; + } + _getDashArrayKey(e, i, r, n, s, o, a) { + const l = s ? o.getValue(i, e) : a, c = n.getValue(i, e); + return r.getDashKey(c, l); + } +}; +const oUi = (t) => (e, i, r, n, s, o, a, l, c, h, p) => (t._lineVertexBuffer.add(e, i, a, l, r, n, s, o, c, h, p, t._ddValues), t._lineVertexBuffer.index - 1), aUi = (t) => (e, i, r) => { + t._lineIndexBuffer.add(e, i, r); +}, $oe = [["(", ")"], [")", "("], ["<", ">"], [">", "<"], ["[", "]"], ["]", "["], ["{", "}"], ["}", "{"], ["«", "»"], ["»", "«"], ["‹", "›"], ["›", "‹"], ["⁽", "⁾"], ["⁾", "⁽"], ["₍", "₎"], ["₎", "₍"], ["≤", "≥"], ["≥", "≤"], ["〈", "〉"], ["〉", "〈"], ["﹙", "﹚"], ["﹚", "﹙"], ["﹛", "﹜"], ["﹜", "﹛"], ["﹝", "﹞"], ["﹞", "﹝"], ["﹤", "﹥"], ["﹥", "﹤"]], QU = ["آ", "أ", "إ", "ا"], lUi = ["ﻵ", "ﻷ", "ﻹ", "ﻻ"], uUi = ["ﻶ", "ﻸ", "ﻺ", "ﻼ"], Ife = ["ا", "ب", "ت", "ث", "ج", "ح", "خ", "د", "ذ", "ر", "ز", "س", "ش", "ص", "ض", "ط", "ظ", "ع", "غ", "ف", "ق", "ك", "ل", "م", "ن", "ه", "و", "ي", "إ", "أ", "آ", "ة", "ى", "ل", "م", "ن", "ه", "و", "ي", "إ", "أ", "آ", "ة", "ى", "ی", "ئ", "ؤ"], cUi = ["ﺍ", "ﺏ", "ﺕ", "ﺙ", "ﺝ", "ﺡ", "ﺥ", "ﺩ", "ﺫ", "ﺭ", "ﺯ", "ﺱ", "ﺵ", "ﺹ", "ﺽ", "ﻁ", "ﻅ", "ﻉ", "ﻍ", "ﻑ", "ﻕ", "ﻙ", "ﻝ", "ﻡ", "ﻥ", "ﻩ", "ﻭ", "ﻱ", "ﺇ", "ﺃ", "ﺁ", "ﺓ", "ﻯ", "ﯼ", "ﺉ", "ﺅ", "ﹰ", "ﹲ", "ﹴ", "ﹶ", "ﹸ", "ﹺ", "ﹼ", "ﹾ", "ﺀ", "ﺉ", "ﺅ"], hUi = ["ﺎ", "ﺐ", "ﺖ", "ﺚ", "ﺞ", "ﺢ", "ﺦ", "ﺪ", "ﺬ", "ﺮ", "ﺰ", "ﺲ", "ﺶ", "ﺺ", "ﺾ", "ﻂ", "ﻆ", "ﻊ", "ﻎ", "ﻒ", "ﻖ", "ﻚ", "ﻞ", "ﻢ", "ﻦ", "ﻪ", "ﻮ", "ﻲ", "ﺈ", "ﺄ", "ﺂ", "ﺔ", "ﻰ", "ﯽ", "ﺊ", "ﺆ", "ﹰ", "ﹲ", "ﹴ", "ﹶ", "ﹸ", "ﹺ", "ﹼ", "ﹾ", "ﺀ", "ﺊ", "ﺆ"], dUi = ["ﺎ", "ﺒ", "ﺘ", "ﺜ", "ﺠ", "ﺤ", "ﺨ", "ﺪ", "ﺬ", "ﺮ", "ﺰ", "ﺴ", "ﺸ", "ﺼ", "ﻀ", "ﻄ", "ﻈ", "ﻌ", "ﻐ", "ﻔ", "ﻘ", "ﻜ", "ﻠ", "ﻤ", "ﻨ", "ﻬ", "ﻮ", "ﻴ", "ﺈ", "ﺄ", "ﺂ", "ﺔ", "ﻰ", "ﯿ", "ﺌ", "ﺆ", "ﹱ", "ﹲ", "ﹴ", "ﹷ", "ﹹ", "ﹻ", "ﹽ", "ﹿ", "ﺀ", "ﺌ", "ﺆ"], pUi = ["ﺍ", "ﺑ", "ﺗ", "ﺛ", "ﺟ", "ﺣ", "ﺧ", "ﺩ", "ﺫ", "ﺭ", "ﺯ", "ﺳ", "ﺷ", "ﺻ", "ﺿ", "ﻃ", "ﻇ", "ﻋ", "ﻏ", "ﻓ", "ﻗ", "ﻛ", "ﻟ", "ﻣ", "ﻧ", "ﻫ", "ﻭ", "ﻳ", "ﺇ", "ﺃ", "ﺁ", "ﺓ", "ﻯ", "ﯾ", "ﺋ", "ﺅ", "ﹰ", "ﹲ", "ﹴ", "ﹶ", "ﹸ", "ﹺ", "ﹼ", "ﹾ", "ﺀ", "ﺋ", "ﺅ"], KQe = ["ء", "آ", "أ", "ؤ", "إ", "ا", "ة", "د", "ذ", "ر", "ز", "و", "ى"], fUi = ["ً", "ً", "ٌ", "؟", "ٍ", "؟", "َ", "َ", "ُ", "ُ", "ِ", "ِ", "ّ", "ّ", "ْ", "ْ", "ء", "آ", "آ", "أ", "أ", "ؤ", "ؤ", "إ", "إ", "ئ", "ئ", "ئ", "ئ", "ا", "ا", "ب", "ب", "ب", "ب", "ة", "ة", "ت", "ت", "ت", "ت", "ث", "ث", "ث", "ث", "ج", "ج", "ج", "ج", "ح", "ح", "ح", "ح", "خ", "خ", "خ", "خ", "د", "د", "ذ", "ذ", "ر", "ر", "ز", "ز", "س", "س", "س", "س", "ش", "ش", "ش", "ش", "ص", "ص", "ص", "ص", "ض", "ض", "ض", "ض", "ط", "ط", "ط", "ط", "ظ", "ظ", "ظ", "ظ", "ع", "ع", "ع", "ع", "غ", "غ", "غ", "غ", "ف", "ف", "ف", "ف", "ق", "ق", "ق", "ق", "ك", "ك", "ك", "ك", "ل", "ل", "ل", "ل", "م", "م", "م", "م", "ن", "ن", "ن", "ن", "ه", "ه", "ه", "ه", "و", "و", "ى", "ى", "ي", "ي", "ي", "ي", "ﻵ", "ﻶ", "ﻷ", "ﻸ", "ﻹ", "ﻺ", "ﻻ", "ﻼ", "؟", "؟", "؟"], JQe = ["ء", "ف"], mUi = ["غ", "ي"], gUi = [[0, 3, 0, 1, 0, 0, 0], [0, 3, 0, 1, 2, 2, 0], [0, 3, 0, 17, 2, 0, 1], [0, 3, 5, 5, 4, 1, 0], [0, 3, 21, 21, 4, 0, 1], [0, 3, 5, 5, 4, 2, 0]], yUi = [[2, 0, 1, 1, 0, 1, 0], [2, 0, 1, 1, 0, 2, 0], [2, 0, 2, 1, 3, 2, 0], [2, 0, 2, 33, 3, 1, 1]], jt = 0, Dr = 1, oo = 2, Kp = 3, vt = 4, lE = 5, hce = 6, St = 7, u0 = 8, Q0 = 9, b2 = 10, No = 11, Wi = 12, vUi = 13, _Ui = 14, bUi = 15, wUi = 16, xUi = 17, ms = 18, SUi = ["UBAT_L", "UBAT_R", "UBAT_EN", "UBAT_AN", "UBAT_ON", "UBAT_B", "UBAT_S", "UBAT_AL", "UBAT_WS", "UBAT_CS", "UBAT_ES", "UBAT_ET", "UBAT_NSM", "UBAT_LRE", "UBAT_RLE", "UBAT_PDF", "UBAT_LRO", "UBAT_RLO", "UBAT_BN"], iE = 100, CUi = [iE + 0, jt, jt, jt, jt, iE + 1, iE + 2, iE + 3, Dr, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, iE + 4, vt, vt, vt, jt, vt, jt, vt, jt, vt, vt, vt, jt, jt, vt, vt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, vt, vt, jt, jt, vt, vt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, jt, iE + 5, St, St, iE + 6, iE + 7], TUi = [[ms, ms, ms, ms, ms, ms, ms, ms, ms, hce, lE, hce, u0, lE, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, lE, lE, lE, hce, u0, vt, vt, No, No, No, vt, vt, vt, vt, vt, b2, Q0, b2, Q0, Q0, oo, oo, oo, oo, oo, oo, oo, oo, oo, oo, Q0, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, ms, ms, ms, ms, ms, ms, lE, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, ms, Q0, vt, No, No, No, No, vt, vt, vt, vt, jt, vt, vt, ms, vt, vt, No, No, oo, oo, vt, jt, vt, vt, vt, oo, jt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, jt, jt, jt, jt, jt, jt, jt, jt], [jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, jt, jt, jt, jt, jt, jt, jt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, jt, vt, vt, vt, vt, vt, vt, vt, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Dr, Wi, Dr, Wi, Wi, Dr, Wi, Wi, Dr, Wi, vt, vt, vt, vt, vt, vt, vt, vt, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, vt, vt, vt, vt, vt, Dr, Dr, Dr, Dr, Dr, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt], [Kp, Kp, Kp, Kp, vt, vt, vt, vt, St, No, No, St, Q0, St, vt, vt, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, St, vt, vt, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Kp, Kp, Kp, Kp, Kp, Kp, Kp, Kp, Kp, Kp, No, Kp, Kp, St, St, St, Wi, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Kp, vt, Wi, Wi, Wi, Wi, Wi, Wi, St, St, Wi, Wi, vt, Wi, Wi, Wi, Wi, St, St, oo, oo, oo, oo, oo, oo, oo, oo, oo, oo, St, St, St, St, St, St], [St, St, St, St, St, St, St, St, St, St, St, St, St, St, vt, St, St, Wi, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, vt, vt, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, St, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Dr, Dr, vt, vt, vt, vt, Dr, vt, vt, vt, vt, vt], [u0, u0, u0, u0, u0, u0, u0, u0, u0, u0, u0, ms, ms, ms, jt, Dr, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, u0, lE, vUi, _Ui, bUi, wUi, xUi, Q0, No, No, No, No, No, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, Q0, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, u0, ms, ms, ms, ms, ms, vt, vt, vt, vt, vt, ms, ms, ms, ms, ms, ms, oo, jt, vt, vt, oo, oo, oo, oo, oo, oo, b2, b2, vt, vt, vt, jt, oo, oo, oo, oo, oo, oo, oo, oo, oo, oo, b2, b2, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt], [jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, Dr, Wi, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, b2, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, vt, Dr, Dr, Dr, Dr, Dr, vt, Dr, vt, Dr, Dr, vt, Dr, Dr, vt, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, Dr, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St], [Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, Wi, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, Wi, Wi, Wi, Wi, Wi, Wi, Wi, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, Q0, vt, Q0, vt, vt, Q0, vt, vt, vt, vt, vt, vt, vt, vt, vt, No, vt, vt, b2, b2, vt, vt, vt, vt, vt, No, No, vt, vt, vt, vt, vt, St, St, St, St, St, vt, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, St, vt, vt, ms], [vt, vt, vt, No, No, No, vt, vt, vt, vt, vt, b2, Q0, b2, Q0, Q0, oo, oo, oo, oo, oo, oo, oo, oo, oo, oo, Q0, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, jt, vt, vt, vt, jt, jt, jt, jt, jt, jt, vt, vt, jt, jt, jt, jt, jt, jt, vt, vt, jt, jt, jt, jt, jt, jt, vt, vt, jt, jt, jt, vt, vt, vt, No, No, vt, vt, vt, No, No, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt, vt]]; +let hOt = class { + constructor() { + this.inputFormat = "ILYNN", this.outputFormat = "VLNNN", this.sourceToTarget = [], this.targetToSource = [], this.levels = []; + } + bidiTransform(e, i, r) { + if (this.sourceToTarget = [], this.targetToSource = [], !e) + return ""; + if (GUi(this.sourceToTarget, this.targetToSource, e.length), !this.checkParameters(i, r)) + return e; + i = this.inputFormat, r = this.outputFormat; + let n = e; + const s = zUi, o = eet(i.charAt(1)), a = eet(r.charAt(1)), l = (i.charAt(0) === "I" ? "L" : i.charAt(0)) + o, c = (r.charAt(0) === "I" ? "L" : r.charAt(0)) + a, h = i.charAt(2) + r.charAt(2); + s.defInFormat = l, s.defOutFormat = c, s.defSwap = h; + const p = CX(e, l, c, h, s); + let y = !1; + return r.charAt(1) === "R" ? y = !0 : r.charAt(1) !== "C" && r.charAt(1) !== "D" || (y = this.checkContextual(p) === "rtl"), this.sourceToTarget = Cb, this.targetToSource = UUi(this.sourceToTarget), Pfe = this.targetToSource, n = i.charAt(3) === r.charAt(3) ? p : r.charAt(3) === "S" ? IUi(y, p, !0) : OUi(p, y, !0), this.sourceToTarget = Cb, this.targetToSource = Pfe, this.levels = vve, n; + } + _inputFormatSetter(e) { + if (!tet.test(e)) + throw new Error("dojox/string/BidiEngine: the bidi layout string is wrong!"); + this.inputFormat = e; + } + _outputFormatSetter(e) { + if (!tet.test(e)) + throw new Error("dojox/string/BidiEngine: the bidi layout string is wrong!"); + this.outputFormat = e; + } + checkParameters(e, i) { + return e ? this._inputFormatSetter(e) : e = this.inputFormat, i ? this._outputFormatSetter(i) : i = this.outputFormat, e !== i; + } + checkContextual(e) { + let i = Afe(e); + if (i !== "ltr" && i !== "rtl") { + try { + i = document.dir.toLowerCase(); + } catch { + } + i !== "ltr" && i !== "rtl" && (i = "ltr"); + } + return i; + } + hasBidiChar(e) { + return qUi.test(e); + } +}; +function CX(t, e, i, r, n) { + const s = EUi(t, { inFormat: e, outFormat: i, swap: r }, n); + if (s.inFormat === s.outFormat) + return t; + e = s.inFormat, i = s.outFormat, r = s.swap; + const o = e.substring(0, 1), a = e.substring(1, 4), l = i.substring(0, 1), c = i.substring(1, 4); + if (n.inFormat = e, n.outFormat = i, n.swap = r, o === "L" && i === "VLTR") { + if (a === "LTR") + return n.dir = _B, zR(t, n); + if (a === "RTL") + return n.dir = TX, zR(t, n); + } + if (o === "V" && l === "V") + return n.dir = a === "RTL" ? TX : _B, Dxe(t, n); + if (o === "L" && i === "VRTL") + return a === "LTR" ? (n.dir = _B, t = zR(t, n)) : (n.dir = TX, t = zR(t, n)), Dxe(t); + if (e === "VLTR" && i === "LLTR") + return n.dir = _B, zR(t, n); + if (o === "V" && l === "L" && a !== c) + return t = Dxe(t), a === "RTL" ? CX(t, "LLTR", "VLTR", r, n) : CX(t, "LRTL", "VRTL", r, n); + if (e === "VRTL" && i === "LRTL") + return CX(t, "LRTL", "VRTL", r, n); + if (o === "L" && l === "L") { + const h = n.swap; + return n.swap = h.substr(0, 1) + "N", a === "RTL" ? (n.dir = TX, t = zR(t, n), n.swap = "N" + h.substr(1, 2), n.dir = _B, t = zR(t, n)) : (n.dir = _B, t = zR(t, n), n.swap = "N" + h.substr(1, 2), t = CX(t, "VLTR", "LRTL", n.swap, n)), t; + } + return t; +} +function EUi(t, e, i) { + if (e.inFormat === void 0 && (e.inFormat = i.defInFormat), e.outFormat === void 0 && (e.outFormat = i.defOutFormat), e.swap === void 0 && (e.swap = i.defSwap), e.inFormat === e.outFormat) + return e; + const r = e.inFormat.substring(0, 1), n = e.outFormat.substring(0, 1); + let s, o = e.inFormat.substring(1, 4), a = e.outFormat.substring(1, 4); + return o.charAt(0) === "C" && (s = Afe(t), o = s === "ltr" || s === "rtl" ? s.toUpperCase() : e.inFormat.charAt(2) === "L" ? "LTR" : "RTL", e.inFormat = r + o), a.charAt(0) === "C" && (s = Afe(t), s === "rtl" ? a = "RTL" : s === "ltr" ? (s = PUi(t), a = s.toUpperCase()) : a = e.outFormat.charAt(2) === "L" ? "LTR" : "RTL", e.outFormat = n + a), e; +} +function IUi(t, e, i) { + if (e.length === 0) + return ""; + t === void 0 && (t = !0), i === void 0 && (i = !0); + const r = (e = String(e)).split(""); + let n = 0, s = 1, o = r.length; + t || (n = r.length - 1, s = -1, o = 1); + const a = AUi(r, n, s, o, i); + let l = ""; + for (let c = 0; c < r.length; c++) + i && FUi(a, a.length, c) > -1 ? (fOt(Pfe, c, !t, -1), Cb.splice(c, 1)) : l += r[c]; + return l; +} +function AUi(t, e, i, r, n) { + let s = 0; + const o = []; + let a = 0; + for (let l = e; l * i < r; l += i) + if (pOt(t[l]) || gee(t[l])) { + if (t[l] === "ل" && LUi(t, l + i, i, r)) { + t[l] = jUi(t[l + i], s === 0 ? lUi : uUi), l += i, VUi(t, l, i, r), n && (o[a] = l, a++), s = 0; + continue; + } + const c = t[l]; + s === 1 ? t[l] = ZQe(t, l + i, i, r) ? BUi(t[l]) : Fxe(t[l], hUi) : ZQe(t, l + i, i, r) === !0 ? t[l] = Fxe(t[l], pUi) : t[l] = Fxe(t[l], cUi), gee(c) || (s = 1), $Ui(c) === !0 && (s = 0); + } else + s = 0; + return o; +} +function Afe(t) { + const e = /[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(t); + return e ? e[0] <= "z" ? "ltr" : "rtl" : ""; +} +function PUi(t) { + const e = t.split(""); + return e.reverse(), Afe(e.join("")); +} +function OUi(t, e, i) { + if (t.length === 0) + return ""; + i === void 0 && (i = !0), e === void 0 && (e = !0); + let r = ""; + const n = (t = String(t)).split(""); + for (let s = 0; s < t.length; s++) { + let o = !1; + if (n[s] >= "ﹰ" && n[s] < "\uFEFF") { + const a = t.charCodeAt(s); + n[s] >= "ﻵ" && n[s] <= "ﻼ" ? (e ? (s > 0 && i && n[s - 1] === " " ? r = r.substring(0, r.length - 1) + "ل" : (r += "ل", o = !0), r += QU[(a - 65269) / 2]) : (r += QU[(a - 65269) / 2], r += "ل", s + 1 < t.length && i && n[s + 1] === " " ? s++ : o = !0), o && (fOt(Pfe, s, !0, 1), Cb.splice(s, 0, Cb[s]))) : r += fUi[a - 65136]; + } else + r += n[s]; + } + return r; +} +function zR(t, e) { + const i = t.split(""), r = []; + return dOt(i, r, e), MUi(i, r, e), QQe(2, i, r, e), QQe(1, i, r, e), vve = r, i.join(""); +} +function dOt(t, e, i) { + const r = t.length, n = i.dir ? yUi : gUi; + let s = 0, o = -1; + const a = [], l = []; + i.hiLevel = i.dir, i.lastArabic = !1, i.hasUbatAl = !1, i.hasUbatB = !1, i.hasUbatS = !1; + for (let c = 0; c < r; c++) + a[c] = DUi(t[c]); + for (let c = 0; c < r; c++) { + const h = s, p = NUi(t, a, l, c, i); + l[c] = p, s = n[h][p]; + const y = 240 & s; + s &= 15; + const v = n[s][HUi]; + if (e[c] = v, y > 0) + if (y === 16) { + for (let x = o; x < c; x++) + e[x] = 1; + o = -1; + } else + o = -1; + if (n[s][WUi]) + o === -1 && (o = c); + else if (o > -1) { + for (let x = o; x < c; x++) + e[x] = v; + o = -1; + } + a[c] === lE && (e[c] = 0), i.hiLevel |= v; + } + i.hasUbatS && RUi(a, e, r, i); +} +function RUi(t, e, i, r) { + for (let n = 0; n < i; n++) + if (t[n] === hce) { + e[n] = r.dir; + for (let s = n - 1; s >= 0 && t[s] === u0; s--) + e[s] = r.dir; + } +} +function MUi(t, e, i) { + if (i.hiLevel !== 0 && i.swap.substr(0, 1) !== i.swap.substr(1, 2)) + for (let r = 0; r < t.length; r++) + e[r] === 1 && (t[r] = kUi(t[r])); +} +function DUi(t) { + const e = t.charCodeAt(0), i = CUi[e >> 8]; + return i < iE ? i : TUi[i - iE][255 & e]; +} +function Dxe(t, e) { + const i = t.split(""); + if (e) { + const r = []; + dOt(i, r, e), vve = r; + } + return i.reverse(), Cb.reverse(), i.join(""); +} +function FUi(t, e, i) { + for (let r = 0; r < e; r++) + if (t[r] === i) + return r; + return -1; +} +function pOt(t) { + for (let e = 0; e < JQe.length; e++) + if (t >= JQe[e] && t <= mUi[e]) + return !0; + return !1; +} +function ZQe(t, e, i, r) { + for (; e * i < r && gee(t[e]); ) + e += i; + return !!(e * i < r && pOt(t[e])); +} +function LUi(t, e, i, r) { + for (; e * i < r && gee(t[e]); ) + e += i; + let n = " "; + if (!(e * i < r)) + return !1; + n = t[e]; + for (let s = 0; s < QU.length; s++) + if (QU[s] === n) + return !0; + return !1; +} +function QQe(t, e, i, r) { + if (r.hiLevel < t) + return; + if (t === 1 && r.dir === TX && !r.hasUbatB) + return e.reverse(), void Cb.reverse(); + const n = e.length; + let s, o, a, l, c, h = 0; + for (; h < n; ) { + if (i[h] >= t) { + for (s = h + 1; s < n && i[s] >= t; ) + s++; + for (o = h, a = s - 1; o < a; o++, a--) + l = e[o], e[o] = e[a], e[a] = l, c = Cb[o], Cb[o] = Cb[a], Cb[a] = c; + h = s; + } + h++; + } +} +function NUi(t, e, i, r, n) { + const s = e[r]; + return { UBAT_L: () => (n.lastArabic = !1, jt), UBAT_R: () => (n.lastArabic = !1, Dr), UBAT_ON: () => vt, UBAT_AN: () => Kp, UBAT_EN: () => n.lastArabic ? Kp : oo, UBAT_AL: () => (n.lastArabic = !0, n.hasUbatAl = !0, Dr), UBAT_WS: () => vt, UBAT_CS: () => { + let o, a; + return r < 1 || r + 1 >= e.length || (o = i[r - 1]) !== oo && o !== Kp || (a = e[r + 1]) !== oo && a !== Kp ? vt : (n.lastArabic && (a = Kp), a === o ? a : vt); + }, UBAT_ES: () => (r > 0 ? i[r - 1] : lE) === oo && r + 1 < e.length && e[r + 1] === oo ? oo : vt, UBAT_ET: () => { + if (r > 0 && i[r - 1] === oo) + return oo; + if (n.lastArabic) + return vt; + let o = r + 1; + const a = e.length; + for (; o < a && e[o] === No; ) + o++; + return o < a && e[o] === oo ? oo : vt; + }, UBAT_NSM: () => { + if (n.inFormat === "VLTR") { + const o = e.length; + let a = r + 1; + for (; a < o && e[a] === Wi; ) + a++; + if (a < o) { + const l = t[r].charCodeAt[0], c = l >= 1425 && l <= 2303 || l === 64286, h = e[a]; + if (c && (h === Dr || h === St)) + return Dr; + } + } + return r < 1 || e[r - 1] === lE ? vt : i[r - 1]; + }, UBAT_B: () => (n.lastArabic = !0, n.hasUbatB = !0, n.dir), UBAT_S: () => (n.hasUbatS = !0, vt), UBAT_LRE: () => (n.lastArabic = !1, vt), UBAT_RLE: () => (n.lastArabic = !1, vt), UBAT_LRO: () => (n.lastArabic = !1, vt), UBAT_RLO: () => (n.lastArabic = !1, vt), UBAT_PDF: () => (n.lastArabic = !1, vt), UBAT_BN: () => vt }[SUi[s]](); +} +function kUi(t) { + let e, i = 0, r = $oe.length - 1; + for (; i <= r; ) + if (e = Math.floor((i + r) / 2), t < $oe[e][0]) + r = e - 1; + else { + if (!(t > $oe[e][0])) + return $oe[e][1]; + i = e + 1; + } + return t; +} +function $Ui(t) { + for (let e = 0; e < KQe.length; e++) + if (KQe[e] === t) + return !0; + return !1; +} +function BUi(t) { + for (let e = 0; e < Ife.length; e++) + if (t === Ife[e]) + return dUi[e]; + return t; +} +function Fxe(t, e) { + for (let i = 0; i < Ife.length; i++) + if (t === Ife[i]) + return e[i]; + return t; +} +function gee(t) { + return t >= "ً" && t <= "ٕ"; +} +function eet(t) { + return t === "L" ? "LTR" : t === "R" ? "RTL" : t === "C" ? "CLR" : t === "D" ? "CRL" : ""; +} +function VUi(t, e, i, r) { + for (; e * i < r && gee(t[e]); ) + e += i; + return e * i < r && (t[e] = " ", !0); +} +function jUi(t, e) { + for (let i = 0; i < QU.length; i++) + if (t === QU[i]) + return e[i]; + return t; +} +function GUi(t, e, i) { + Cb = [], vve = []; + for (let r = 0; r < i; r++) + t[r] = r, e[r] = r, Cb[r] = r; +} +function UUi(t) { + const e = new Array(t.length); + for (let i = 0; i < t.length; i++) + e[t[i]] = i; + return e; +} +function fOt(t, e, i, r) { + for (let n = 0; n < t.length; n++) + (t[n] > e || !i && t[n] === e) && (t[n] += r); +} +let Cb = [], Pfe = [], vve = []; +const zUi = { dir: 0, defInFormat: "LLTR", defoutFormat: "VLTR", defSwap: "YN", inFormat: "LLTR", outFormat: "VLTR", swap: "YN", hiLevel: 0, lastArabic: !1, hasUbatAl: !1, hasBlockSep: !1, hasSegSep: !1, defOutFormat: "" }, HUi = 5, WUi = 6, _B = 0, TX = 1, tet = /^[(I|V)][(L|R|C|D)][(Y|N)][(S|N)][N]$/, qUi = /[\u0591-\u06ff\ufb1d-\ufefc]/; +var Ns, Fk; +(function(t) { + t[t.R8_SIGNED = 0] = "R8_SIGNED", t[t.R8_UNSIGNED = 1] = "R8_UNSIGNED", t[t.R16_SIGNED = 2] = "R16_SIGNED", t[t.R16_UNSIGNED = 3] = "R16_UNSIGNED", t[t.R8G8_SIGNED = 4] = "R8G8_SIGNED", t[t.R8G8_UNSIGNED = 5] = "R8G8_UNSIGNED", t[t.R16G16_SIGNED = 6] = "R16G16_SIGNED", t[t.R16G16_UNSIGNED = 7] = "R16G16_UNSIGNED", t[t.R8G8B8A8_SIGNED = 8] = "R8G8B8A8_SIGNED", t[t.R8G8B8A8_UNSIGNED = 9] = "R8G8B8A8_UNSIGNED", t[t.R8G8B8A8_COLOR = 10] = "R8G8B8A8_COLOR", t[t.R16G16B16A16_DASHARRAY = 11] = "R16G16B16A16_DASHARRAY", t[t.R16G16B16A16_PATTERN = 12] = "R16G16B16A16_PATTERN"; +})(Ns || (Ns = {})), function(t) { + t[t.UNIFORM = 0] = "UNIFORM", t[t.DATA_DRIVEN = 1] = "DATA_DRIVEN", t[t.INTERPOLATED_DATA_DRIVEN = 2] = "INTERPOLATED_DATA_DRIVEN", t[t.UNUSED = 3] = "UNUSED"; +}(Fk || (Fk = {})); +let U4 = class lMe { + constructor(e) { + this._locations = /* @__PURE__ */ new Map(), this._key = e; + } + get key() { + return this._key; + } + get type() { + return 7 & this._key; + } + defines() { + return []; + } + getStride() { + return this._layoutInfo || this._buildAttributesInfo(), this._stride; + } + getAttributeLocations() { + return this._locations.size === 0 && this._buildAttributesInfo(), this._locations; + } + getLayoutInfo() { + return this._layoutInfo || this._buildAttributesInfo(), this._layoutInfo; + } + getEncodingInfos() { + return this._propertyEncodingInfo || this._buildAttributesInfo(), this._propertyEncodingInfo; + } + getUniforms() { + return this._uniforms || this._buildAttributesInfo(), this._uniforms; + } + getShaderHeader() { + return this._shaderHeader || this._buildAttributesInfo(), this._shaderHeader; + } + getShaderMain() { + return this._shaderMain || this._buildAttributesInfo(), this._shaderMain; + } + setDataUniforms(e, i, r, n, s) { + const o = this.getUniforms(); + for (const a of o) { + const { name: l, type: c, getValue: h } = a, p = h(r, i, n, s); + if (p !== null) + switch (c) { + case "float": + e.setUniform1f(l, p); + break; + case "vec2": + e.setUniform2fv(l, p); + break; + case "vec4": + e.setUniform4fv(l, p); + } + } + } + encodeAttributes(e, i, r, n) { + const s = this.attributesInfo(), o = this.getEncodingInfos(), a = []; + let l = 0, c = 0; + for (const h of Object.keys(o)) { + const p = o[h], { type: y, precisionFactor: v, isLayout: x } = s[h], I = x ? r.getLayoutProperty(h) : r.getPaintProperty(h), P = I.interpolator?.getInterpolationRange(i); + let F = 0; + for (const k of p) { + const { offset: V, bufferElementsToAdd: j } = k; + if (j > 0) { + for (let X = 0; X < j; X++) + a.push(0); + l += c, c = k.bufferElementsToAdd; + } + const Y = n ?? I.getValue(P ? P[F] : i, e); + switch (y) { + case Ns.R8_SIGNED: + case Ns.R8_UNSIGNED: + a[l] |= this._encodeByte(Y * (v || 1), 8 * V); + break; + case Ns.R16_SIGNED: + case Ns.R16_UNSIGNED: + a[l] |= this._encodeShort(Y * (v || 1), 8 * V); + break; + case Ns.R8G8_SIGNED: + case Ns.R8G8_UNSIGNED: + a[l] |= this._encodeByte(Y * (v || 1), 8 * V), a[l] |= this._encodeByte(Y * (v || 1), 8 * V + 8); + break; + case Ns.R16G16_SIGNED: + case Ns.R16G16_UNSIGNED: + a[l] |= this._encodeShort(Y * (v || 1), 8 * V), a[l] |= this._encodeShort(Y * (v || 1), 8 * V + 16); + break; + case Ns.R8G8B8A8_SIGNED: + case Ns.R8G8B8A8_UNSIGNED: + a[l] |= this._encodeByte(Y * (v || 1), 8 * V), a[l] |= this._encodeByte(Y * (v || 1), 8 * V + 8), a[l] |= this._encodeByte(Y * (v || 1), 8 * V + 16), a[l] |= this._encodeByte(Y * (v || 1), 8 * V + 24); + break; + case Ns.R8G8B8A8_COLOR: + a[l] = this._encodeColor(Y); + break; + case Ns.R16G16B16A16_DASHARRAY: + case Ns.R16G16B16A16_PATTERN: + this._encodePattern(l, a, Y); + break; + default: + throw new Error("Unsupported encoding type"); + } + F++; + } + } + return a; + } + getAtributeState(e) { + let i = 0; + const r = 3 + 2 * e; + return i |= this._bit(r), i |= this._bit(r + 1) << 1, i; + } + _buildAttributesInfo() { + const e = [], i = {}, r = {}; + let n = -1; + const s = this.attributesInfo(), o = this.attributes(); + let a = -1; + for (const p of o) { + a++; + const y = this.getAtributeState(a); + if (y === Fk.UNIFORM || y === Fk.UNUSED) + continue; + const v = s[p], x = []; + i[p] = x; + const I = v.type; + for (let P = 0; P < y; P++) { + const { dataType: F, bytesPerElement: k, count: V, normalized: j } = lMe._encodingInfo[I], Y = k * V, X = `${F}-${j === !0}`; + let Q = r[X], re = 0; + if (!Q || Q.count + V > 4) + n++, Q = { dataIndex: n, count: 0, offset: 0 }, V !== 4 && (r[X] = Q), e.push({ location: -1, name: "a_data_" + n, count: V, type: F, normalized: j }), re = Math.ceil(Math.max(Y / 4, 1)); + else { + const he = e[Q.dataIndex]; + he.count += V, re = Math.ceil(Math.max(he.count * k / 4, 1)) - Math.ceil(Math.max(Q.offset / 4, 1)); + } + x.push({ dataIndex: Q.dataIndex, offset: Q.offset, bufferElementsToAdd: re }), Q.offset += Y, Q.count += V; + } + } + for (const p of e) + switch (p.type) { + case Fi.BYTE: + case Fi.UNSIGNED_BYTE: + p.count = 4; + break; + case Fi.SHORT: + case Fi.UNSIGNED_SHORT: + p.count += p.count % 2; + } + this._buildVertexBufferLayout(e); + let l = 0; + const c = this._layoutInfo.geometry; + for (const p of c) + this._locations.set(p.name, l++); + const h = this._layoutInfo.opacity; + if (h) + for (const p of h) + this._locations.set(p.name, l++); + this._buildShaderInfo(e, i), this._propertyEncodingInfo = i; + } + _buildVertexBufferLayout(e) { + const i = {}, r = this.geometryInfo(); + let n = r[0].stride; + if (e.length === 0) + i.geometry = r; + else { + const s = []; + let o = n; + for (const a of e) + n += iet(a.type) * a.count; + for (const a of r) + s.push(new ea(a.name, a.count, a.type, a.offset, n, a.normalized)); + for (const a of e) + s.push(new ea(a.name, a.count, a.type, o, n, a.normalized)), o += iet(a.type) * a.count; + i.geometry = s; + } + this.opacityInfo() && (i.opacity = this.opacityInfo()), this._layoutInfo = i, this._stride = n; + } + _buildShaderInfo(e, i) { + let r = ` +`, n = ` +`; + const s = []; + for (const c of e) + r += `attribute ${this._getType(c.count)} ${c.name}; +`; + const o = this.attributes(), a = this.attributesInfo(); + let l = -1; + for (const c of o) { + l++; + const { name: h, type: p, precisionFactor: y, isLayout: v } = a[c], x = y && y !== 1 ? " * " + 1 / y : "", { bytesPerElement: I, count: P } = lMe._encodingInfo[p], F = (k) => `a_data_${k.dataIndex}${YUi(P, k.offset, I)}`; + switch (this.getAtributeState(l)) { + case Fk.UNIFORM: + { + const k = this._getType(P), V = `u_${h}`; + s.push({ name: V, type: k, getValue: (j, Y, X, Q) => { + const re = v ? j.getLayoutValue(c, Y) : j.getPaintValue(c, Y); + if (p === Ns.R16G16B16A16_DASHARRAY) { + const he = j.getDashKey(re, j.getLayoutValue("line-cap", Y)), fe = Q.getMosaicItemPosition(he, !1); + if (ut(fe)) + return null; + const { tl: be, br: Se } = fe; + return [be[0], Se[1], Se[0], be[1]]; + } + if (p === Ns.R16G16B16A16_PATTERN) { + const he = Q.getMosaicItemPosition(re, !c.includes("line-")); + if (ut(he)) + return null; + const { tl: fe, br: be } = he; + return [fe[0], be[1], be[0], fe[1]]; + } + if (p === Ns.R8G8B8A8_COLOR) { + const he = re[3]; + return [he * re[0], he * re[1], he * re[2], he]; + } + return re; + } }), r += `uniform ${k} ${V}; +`, n += `${k} ${h} = ${V}; +`; + } + break; + case Fk.DATA_DRIVEN: + { + const k = F(i[c][0]); + n += `${this._getType(P)} ${h} = ${k}${x}; +`; + } + break; + case Fk.INTERPOLATED_DATA_DRIVEN: { + const k = `u_t_${h}`; + s.push({ name: k, type: "float", getValue: (Y, X, Q, re) => (v ? Y.getLayoutProperty(c) : Y.getPaintProperty(c)).interpolator.interpolationUniformValue(Q, X) }), r += `uniform float ${k}; +`; + const V = F(i[c][0]), j = F(i[c][1]); + n += `${this._getType(P)} ${h} = mix(${V}${x}, ${j}${x}, ${k}); +`; + } + } + } + this._shaderHeader = r, this._shaderMain = n, this._uniforms = s; + } + _bit(e) { + return (this._key & 1 << e) >> e; + } + _getType(e) { + switch (e) { + case 1: + return "float"; + case 2: + return "vec2"; + case 3: + return "vec3"; + case 4: + return "vec4"; + } + throw new Error("Invalid count"); + } + _encodeColor(e) { + const i = 255 * e[3]; + return Jm.i8888to32(e[0] * i, e[1] * i, e[2] * i, i); + } + _encodePattern(e, i, r) { + if (!r || !r.rect) + return; + const n = 2, s = r.rect, o = r.width, a = r.height; + i[e] = this._encodeShort(s.x + n, 0), i[e] |= this._encodeShort(s.y + n + a, 16), i[e + 1] = this._encodeShort(s.x + n + o, 0), i[e + 1] |= this._encodeShort(s.y + n, 16); + } + _encodeByte(e, i) { + return (255 & e) << i; + } + _encodeShort(e, i) { + return (65535 & e) << i; + } +}; +U4._encodingInfo = { [Ns.R8_SIGNED]: { dataType: Fi.BYTE, bytesPerElement: 1, count: 1, normalized: !1 }, [Ns.R8_UNSIGNED]: { dataType: Fi.UNSIGNED_BYTE, bytesPerElement: 1, count: 1, normalized: !1 }, [Ns.R16_SIGNED]: { dataType: Fi.SHORT, bytesPerElement: 2, count: 1, normalized: !1 }, [Ns.R16_UNSIGNED]: { dataType: Fi.UNSIGNED_SHORT, bytesPerElement: 2, count: 1, normalized: !1 }, [Ns.R8G8_SIGNED]: { dataType: Fi.BYTE, bytesPerElement: 1, count: 2, normalized: !1 }, [Ns.R8G8_UNSIGNED]: { dataType: Fi.UNSIGNED_BYTE, bytesPerElement: 1, count: 2, normalized: !1 }, [Ns.R16G16_SIGNED]: { dataType: Fi.SHORT, bytesPerElement: 2, count: 2, normalized: !1 }, [Ns.R16G16_UNSIGNED]: { dataType: Fi.UNSIGNED_SHORT, bytesPerElement: 2, count: 2, normalized: !1 }, [Ns.R8G8B8A8_SIGNED]: { dataType: Fi.BYTE, bytesPerElement: 1, count: 4, normalized: !1 }, [Ns.R8G8B8A8_UNSIGNED]: { dataType: Fi.UNSIGNED_BYTE, bytesPerElement: 1, count: 4, normalized: !1 }, [Ns.R8G8B8A8_COLOR]: { dataType: Fi.UNSIGNED_BYTE, bytesPerElement: 1, count: 4, normalized: !0 }, [Ns.R16G16B16A16_DASHARRAY]: { dataType: Fi.UNSIGNED_SHORT, bytesPerElement: 2, count: 4, normalized: !1 }, [Ns.R16G16B16A16_PATTERN]: { dataType: Fi.UNSIGNED_SHORT, bytesPerElement: 2, count: 4, normalized: !1 } }; +const iet = (t) => { + switch (t) { + case Fi.FLOAT: + case Fi.INT: + case Fi.UNSIGNED_INT: + return 4; + case Fi.SHORT: + case Fi.UNSIGNED_SHORT: + return 2; + case Fi.BYTE: + case Fi.UNSIGNED_BYTE: + return 1; + } +}, YUi = (t, e, i) => { + const r = e / i; + if (t === 1) + switch (r) { + case 0: + return ".x"; + case 1: + return ".y"; + case 2: + return ".z"; + case 3: + return ".w"; + } + else if (t === 2) + switch (r) { + case 0: + return ".xy"; + case 1: + return ".yz"; + case 2: + return ".zw"; + } + else if (t === 3) + switch (r) { + case 0: + return ".xyz"; + case 1: + return ".yzw"; + } + return ""; +}; +let g7 = class dce extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return dce.GEOMETRY_LAYOUT; + } + opacityInfo() { + return null; + } + attributes() { + return dce.ATTRIBUTES; + } + attributesInfo() { + return dce.ATTRIBUTES_INFO; + } +}; +g7.ATTRIBUTES = [], g7.GEOMETRY_LAYOUT = [new ea("a_pos", 2, Fi.BYTE, 0, 2)], g7.ATTRIBUTES_INFO = {}; +let y7 = class pce extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return pce.GEOMETRY_LAYOUT; + } + opacityInfo() { + return null; + } + attributes() { + return pce.ATTRIBUTES; + } + attributesInfo() { + return pce.ATTRIBUTES_INFO; + } +}; +y7.ATTRIBUTES = ["circle-radius", "circle-color", "circle-opacity", "circle-stroke-width", "circle-stroke-color", "circle-stroke-opacity", "circle-blur"], y7.GEOMETRY_LAYOUT = [new ea("a_pos", 2, Fi.SHORT, 0, 4)], y7.ATTRIBUTES_INFO = { "circle-radius": { name: "radius", type: Ns.R8_UNSIGNED }, "circle-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "circle-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "circle-stroke-width": { name: "stroke_width", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "circle-stroke-color": { name: "stroke_color", type: Ns.R8G8B8A8_COLOR }, "circle-stroke-opacity": { name: "stroke_opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "circle-blur": { name: "blur", type: Ns.R8_UNSIGNED, precisionFactor: 32 } }; +let v7 = class fce extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return fce.GEOMETRY_LAYOUT; + } + opacityInfo() { + return null; + } + attributes() { + return fce.ATTRIBUTES; + } + attributesInfo() { + return fce.ATTRIBUTES_INFO; + } +}; +v7.ATTRIBUTES = ["fill-color", "fill-opacity", "fill-pattern"], v7.GEOMETRY_LAYOUT = [new ea("a_pos", 2, Fi.SHORT, 0, 4)], v7.ATTRIBUTES_INFO = { "fill-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "fill-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "fill-pattern": { name: "tlbr", type: Ns.R16G16B16A16_PATTERN, isOptional: !0 } }; +let bE = class JV extends U4 { + constructor(e, i) { + super(e), this._usefillColor = i; + } + geometryInfo() { + return JV.GEOMETRY_LAYOUT; + } + opacityInfo() { + return null; + } + attributes() { + return this._usefillColor ? JV.ATTRIBUTES_FILL : JV.ATTRIBUTES_OUTLINE; + } + attributesInfo() { + return this._usefillColor ? JV.ATTRIBUTES_INFO_FILL : JV.ATTRIBUTES_INFO_OUTLINE; + } +}; +bE.ATTRIBUTES_OUTLINE = ["fill-outline-color", "fill-opacity"], bE.ATTRIBUTES_FILL = ["fill-color", "fill-opacity"], bE.GEOMETRY_LAYOUT = [new ea("a_pos", 2, Fi.SHORT, 0, 8), new ea("a_offset", 2, Fi.BYTE, 4, 8), new ea("a_xnormal", 2, Fi.BYTE, 6, 8)], bE.ATTRIBUTES_INFO_OUTLINE = { "fill-outline-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "fill-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 } }, bE.ATTRIBUTES_INFO_FILL = { "fill-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "fill-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 } }; +let _7 = class mce extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return mce.GEOMETRY_LAYOUT; + } + opacityInfo() { + return null; + } + attributes() { + return mce.ATTRIBUTES; + } + attributesInfo() { + return mce.ATTRIBUTES_INFO; + } +}; +_7.ATTRIBUTES = ["line-blur", "line-color", "line-gap-width", "line-offset", "line-opacity", "line-width", "line-pattern", "line-dasharray"], _7.GEOMETRY_LAYOUT = [new ea("a_pos", 2, Fi.SHORT, 0, 16), new ea("a_extrude_offset", 4, Fi.BYTE, 4, 16), new ea("a_dir_normal", 4, Fi.BYTE, 8, 16), new ea("a_accumulatedDistance", 2, Fi.UNSIGNED_SHORT, 12, 16)], _7.ATTRIBUTES_INFO = { "line-width": { name: "width", type: Ns.R8_UNSIGNED, precisionFactor: 2 }, "line-gap-width": { name: "gap_width", type: Ns.R8_UNSIGNED, precisionFactor: 2 }, "line-offset": { name: "offset", type: Ns.R8_SIGNED, precisionFactor: 2 }, "line-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "line-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "line-blur": { name: "blur", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "line-pattern": { name: "tlbr", type: Ns.R16G16B16A16_PATTERN, isOptional: !0 }, "line-dasharray": { name: "tlbr", type: Ns.R16G16B16A16_DASHARRAY, isOptional: !0 } }; +const mOt = [new ea("a_pos", 2, Fi.SHORT, 0, 16), new ea("a_vertexOffset", 2, Fi.SHORT, 4, 16), new ea("a_texAngleRange", 4, Fi.UNSIGNED_BYTE, 8, 16), new ea("a_levelInfo", 4, Fi.UNSIGNED_BYTE, 12, 16)], gOt = [new ea("a_opacityInfo", 1, Fi.UNSIGNED_BYTE, 0, 1)]; +let ZJ = class uMe extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return mOt; + } + opacityInfo() { + return gOt; + } + attributes() { + return uMe.ATTRIBUTES; + } + attributesInfo() { + return uMe.ATTRIBUTES_INFO; + } +}; +ZJ.ATTRIBUTES = ["icon-color", "icon-opacity", "icon-halo-blur", "icon-halo-color", "icon-halo-width", "icon-size"], ZJ.ATTRIBUTES_INFO = { "icon-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "icon-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "icon-halo-color": { name: "halo_color", type: Ns.R8G8B8A8_COLOR }, "icon-halo-width": { name: "halo_width", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "icon-halo-blur": { name: "halo_blur", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "icon-size": { name: "size", type: Ns.R8_UNSIGNED, precisionFactor: 32, isLayout: !0 } }; +let QJ = class cMe extends U4 { + constructor(e) { + super(e); + } + geometryInfo() { + return mOt; + } + opacityInfo() { + return gOt; + } + attributes() { + return cMe.ATTRIBUTES; + } + attributesInfo() { + return cMe.ATTRIBUTES_INFO; + } +}; +QJ.ATTRIBUTES = ["text-color", "text-opacity", "text-halo-blur", "text-halo-color", "text-halo-width", "text-size"], QJ.ATTRIBUTES_INFO = { "text-color": { name: "color", type: Ns.R8G8B8A8_COLOR }, "text-opacity": { name: "opacity", type: Ns.R8_UNSIGNED, precisionFactor: 100 }, "text-halo-color": { name: "halo_color", type: Ns.R8G8B8A8_COLOR }, "text-halo-width": { name: "halo_width", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "text-halo-blur": { name: "halo_blur", type: Ns.R8_UNSIGNED, precisionFactor: 4 }, "text-size": { name: "size", type: Ns.R8_UNSIGNED, isLayout: !0 } }; +const yOt = { kind: "null" }, Ep = { kind: "number" }, Nb = { kind: "string" }, Fy = { kind: "boolean" }, s3 = { kind: "color" }, _ve = { kind: "object" }, kO = { kind: "value" }; +function Kie(t, e) { + return { kind: "array", itemType: t, n: e }; +} +const XUi = [yOt, Ep, Nb, Fy, s3, _ve, Kie(kO)]; +function ez(t) { + if (t.kind === "array") { + const e = ez(t.itemType); + return typeof t.n == "number" ? `array<${e}, ${t.n}>` : t.itemType.kind === "value" ? "array" : `array<${e}>`; + } + return t.kind; +} +function bve(t) { + if (t === null) + return yOt; + if (typeof t == "string") + return Nb; + if (typeof t == "boolean") + return Fy; + if (typeof t == "number") + return Ep; + if (t instanceof Wr) + return s3; + if (Array.isArray(t)) { + let e; + for (const i of t) { + const r = bve(i); + if (e) { + if (e !== r) { + e = kO; + break; + } + } else + e = r; + } + return Kie(e || kO, t.length); + } + return typeof t == "object" ? _ve : kO; +} +function hMe(t, e) { + if (e.kind === "array") + return t.kind === "array" && (t.n === 0 && t.itemType.kind === "value" || hMe(t.itemType, e.itemType)) && (typeof e.n != "number" || e.n === t.n); + if (e.kind === "value") { + for (const i of XUi) + if (hMe(t, i)) + return !0; + } + return e.kind === t.kind; +} +function dMe(t) { + if (t === null) + return ""; + const e = typeof t; + return e === "string" ? t : e === "number" || e === "boolean" ? String(t) : t instanceof Wr ? t.toString() : JSON.stringify(t); +} +let KUi = class { + constructor(e) { + this._parent = e, this._vars = {}; + } + add(e, i) { + this._vars[e] = i; + } + get(e) { + return this._vars[e] ? this._vars[e] : this._parent ? this._parent.get(e) : null; + } +}, JUi = class vOt { + constructor() { + this.type = kO; + } + static parse(e) { + if (e.length > 1) + throw new Error('"id" does not expect arguments'); + return new vOt(); + } + evaluate(e, i) { + return e?.id; + } +}, ZUi = class _Ot { + constructor() { + this.type = Nb; + } + static parse(e) { + if (e.length > 1) + throw new Error('"geometry-type" does not expect arguments'); + return new _Ot(); + } + evaluate(e, i) { + if (!e) + return null; + switch (e.type) { + case py.Point: + return "Point"; + case py.LineString: + return "LineString"; + case py.Polygon: + return "Polygon"; + default: + return null; + } + } +}, QUi = class bOt { + constructor() { + this.type = _ve; + } + static parse(e) { + if (e.length > 1) + throw new Error('"properties" does not expect arguments'); + return new bOt(); + } + evaluate(e, i) { + return e?.values; + } +}, wOt = class xOt { + constructor() { + this.type = Ep; + } + static parse(e) { + if (e.length > 1) + throw new Error('"zoom" does not expect arguments'); + return new xOt(); + } + evaluate(e, i) { + return i; + } +}, Nx = class SOt { + constructor(e, i, r) { + this._lhs = e, this._rhs = i, this._compare = r, this.type = Fy; + } + static parse(e, i, r) { + if (e.length !== 3 && e.length !== 4) + throw new Error(`"${e[0]}" expects 2 or 3 arguments`); + if (e.length === 4) + throw new Error(`"${e[0]}" collator not supported`); + return new SOt(va(e[1], i), va(e[2], i), r); + } + evaluate(e, i) { + return this._compare(this._lhs.evaluate(e, i), this._rhs.evaluate(e, i)); + } +}, ezi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r === n); + } +}, tzi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r !== n); + } +}, izi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r < n); + } +}, rzi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r <= n); + } +}, nzi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r > n); + } +}, szi = class extends Nx { + static parse(e, i) { + return Nx.parse(e, i, (r, n) => r >= n); + } +}, ozi = class COt { + constructor(e) { + this._arg = e, this.type = Fy; + } + static parse(e, i) { + if (e.length !== 2) + throw new Error('"!" expects 1 argument'); + return new COt(va(e[1], i)); + } + evaluate(e, i) { + return !this._arg.evaluate(e, i); + } +}, azi = class TOt { + constructor(e) { + this._args = e, this.type = Fy; + } + static parse(e, i) { + const r = []; + for (let n = 1; n < e.length; n++) + r.push(va(e[n], i)); + return new TOt(r); + } + evaluate(e, i) { + for (const r of this._args) + if (!r.evaluate(e, i)) + return !1; + return !0; + } +}, lzi = class EOt { + constructor(e) { + this._args = e, this.type = Fy; + } + static parse(e, i) { + const r = []; + for (let n = 1; n < e.length; n++) + r.push(va(e[n], i)); + return new EOt(r); + } + evaluate(e, i) { + for (const r of this._args) + if (r.evaluate(e, i)) + return !0; + return !1; + } +}, uzi = class IOt { + constructor(e) { + this._args = e, this.type = Fy; + } + static parse(e, i) { + const r = []; + for (let n = 1; n < e.length; n++) + r.push(va(e[n], i)); + return new IOt(r); + } + evaluate(e, i) { + for (const r of this._args) + if (r.evaluate(e, i)) + return !1; + return !0; + } +}, czi = class AOt { + constructor(e, i, r) { + this.type = e, this._args = i, this._fallback = r; + } + static parse(e, i, r) { + if (e.length < 4) + throw new Error('"case" expects at least 3 arguments'); + if (e.length % 2 == 1) + throw new Error('"case" expects an odd number of arguments'); + let n; + const s = []; + for (let a = 1; a < e.length - 1; a += 2) { + const l = va(e[a], i), c = va(e[a + 1], i, r); + n || (n = c.type), s.push({ condition: l, output: c }); + } + const o = va(e[e.length - 1], i, r); + return n || (n = o.type), new AOt(n, s, o); + } + evaluate(e, i) { + for (const r of this._args) + if (r.condition.evaluate(e, i)) + return r.output.evaluate(e, i); + return this._fallback.evaluate(e, i); + } +}, hzi = class POt { + constructor(e, i) { + this.type = e, this._args = i; + } + static parse(e, i) { + if (e.length < 2) + throw new Error('"coalesce" expects at least 1 argument'); + let r; + const n = []; + for (let s = 1; s < e.length; s++) { + const o = va(e[s], i); + r || (r = o.type), n.push(o); + } + return new POt(r, n); + } + evaluate(e, i) { + for (const r of this._args) { + const n = r.evaluate(e, i); + if (n !== null) + return n; + } + return null; + } +}, dzi = class OOt { + constructor(e, i, r, n, s) { + this.type = e, this._input = i, this._labels = r, this._outputs = n, this._fallback = s; + } + static parse(e, i) { + if (e.length < 3) + throw new Error('"match" expects at least 3 arguments'); + if (e.length % 2 == 0) + throw new Error('"case" expects an even number of arguments'); + let r; + const n = va(e[1], i), s = [], o = {}; + let a; + for (let l = 2; l < e.length - 1; l += 2) { + let c = e[l]; + Array.isArray(c) || (c = [c]); + for (const p of c) { + const y = typeof p; + if (y !== "string" && y !== "number") + throw new Error('"match" requires string or number literal as labels'); + if (a) { + if (y !== a) + throw new Error('"match" requires labels to have the same type'); + } else + a = y; + o[p] = s.length; + } + const h = va(e[l + 1], i); + r || (r = h.type), s.push(h); + } + return new OOt(r, n, o, s, va(e[e.length - 1], i)); + } + evaluate(e, i) { + const r = this._input.evaluate(e, i); + return (this._outputs[this._labels[r]] || this._fallback).evaluate(e, i); + } +}, gce = class UN { + constructor(e, i, r, n, s) { + this._operator = e, this.type = i, this.interpolation = r, this.input = n, this._stops = s; + } + static parse(e, i, r) { + const n = e[0]; + if (e.length < 5) + throw new Error(`"${n}" expects at least 4 arguments`); + const s = e[1]; + if (!Array.isArray(s) || s.length === 0) + throw new Error(`"${s}" is not a valid interpolation`); + switch (s[0]) { + case "linear": + if (s.length !== 1) + throw new Error("Linear interpolation cannot have parameters"); + break; + case "exponential": + if (s.length !== 2 || typeof s[1] != "number") + throw new Error("Exponential interpolation requires one numeric argument"); + break; + case "cubic-bezier": + if (s.length !== 5) + throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1"); + for (let c = 1; c < 5; c++) { + const h = s[c]; + if (typeof h != "number" || h < 0 || h > 1) + throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1"); + } + break; + default: + throw new Error(`"${e[0]}" unknown interpolation type "${s[0]}"`); + } + if (e.length % 2 != 1) + throw new Error(`"${n}" expects an even number of arguments`); + const o = va(e[2], i, Ep); + let a; + n === "interpolate-hcl" || n === "interpolate-lab" ? a = s3 : r && r.kind !== "value" && (a = r); + const l = []; + for (let c = 3; c < e.length; c += 2) { + const h = e[c]; + if (typeof h != "number") + throw new Error(`"${n}" requires stop inputs as literal numbers`); + if (l.length && l[l.length - 1][0] >= h) + throw new Error(`"${n}" requires strictly ascending stop inputs`); + const p = va(e[c + 1], i, a); + a || (a = p.type), l.push([h, p]); + } + if (a && a !== s3 && a !== Ep && (a.kind !== "array" || a.itemType !== Ep)) + throw new Error(`"${n}" cannot interpolate type ${ez(a)}`); + return new UN(n, a, s, o, l); + } + evaluate(e, i) { + const r = this._stops; + if (r.length === 1) + return r[0][1].evaluate(e, i); + const n = this.input.evaluate(e, i); + if (n <= r[0][0]) + return r[0][1].evaluate(e, i); + if (n >= r[r.length - 1][0]) + return r[r.length - 1][1].evaluate(e, i); + let s = 0; + for (; ++s < r.length && !(n < r[s][0]); ) + ; + const o = r[s - 1][0], a = r[s][0], l = UN.interpolationRatio(this.interpolation, n, o, a), c = r[s - 1][1].evaluate(e, i), h = r[s][1].evaluate(e, i); + if (this._operator === "interpolate") { + if (this.type.kind === "array" && Array.isArray(c) && Array.isArray(h)) + return c.map((p, y) => qm(p, h[y], l)); + if (this.type.kind === "color" && c instanceof Wr && h instanceof Wr) { + const p = new Wr(c), y = new Wr(h); + return new Wr([qm(p.r, y.r, l), qm(p.g, y.g, l), qm(p.b, y.b, l), qm(p.a, y.a, l)]); + } + if (this.type.kind === "number" && typeof c == "number" && typeof h == "number") + return qm(c, h, l); + throw new Error(`"${this._operator}" cannot interpolate type ${ez(this.type)}`); + } + if (this._operator === "interpolate-hcl") { + const p = ide(c), y = ide(h), v = y.h - p.h, x = kF({ h: p.h + l * (v > 180 || v < -180 ? v - 360 * Math.round(v / 360) : v), c: qm(p.c, y.c, l), l: qm(p.l, y.l, l) }); + return new Wr({ a: qm(c.a, h.a, l), ...x }); + } + if (this._operator === "interpolate-lab") { + const p = tde(c), y = tde(h), v = kF({ l: qm(p.l, y.l, l), a: qm(p.a, y.a, l), b: qm(p.b, y.b, l) }); + return new Wr({ a: qm(c.a, h.a, l), ...v }); + } + throw new Error(`Unexpected operator "${this._operator}"`); + } + interpolationUniformValue(e, i) { + const r = this._stops; + if (r.length === 1 || e >= r[r.length - 1][0]) + return 0; + let n = 0; + for (; ++n < r.length && !(e < r[n][0]); ) + ; + const s = r[n - 1][0], o = r[n][0]; + return UN.interpolationRatio(this.interpolation, i, s, o); + } + getInterpolationRange(e) { + const i = this._stops; + if (i.length === 1) { + const s = i[0][0]; + return [s, s]; + } + const r = i[i.length - 1][0]; + if (e >= r) + return [r, r]; + let n = 0; + for (; ++n < i.length && !(e < i[n][0]); ) + ; + return [i[n - 1][0], i[n][0]]; + } + static interpolationRatio(e, i, r, n) { + let s = 0; + return e[0] === "linear" ? s = UN._exponentialInterpolationRatio(i, 1, r, n) : e[0] === "exponential" ? s = UN._exponentialInterpolationRatio(i, e[1], r, n) : e[0] === "cubic-bezier" && (s = TD(e[1], e[2], e[3], e[4])(UN._exponentialInterpolationRatio(i, 1, r, n), 1e-5)), s < 0 ? s = 0 : s > 1 && (s = 1), s; + } + static _exponentialInterpolationRatio(e, i, r, n) { + const s = n - r; + if (s === 0) + return 0; + const o = e - r; + return i === 1 ? o / s : (i ** o - 1) / (i ** s - 1); + } +}, pzi = class ROt { + constructor(e, i, r) { + this.type = e, this._input = i, this._stops = r; + } + static parse(e, i) { + if (e.length < 5) + throw new Error('"step" expects at least 4 arguments'); + if (e.length % 2 != 1) + throw new Error('"step" expects an even number of arguments'); + const r = va(e[1], i, Ep); + let n; + const s = []; + s.push([-1 / 0, va(e[2], i)]); + for (let o = 3; o < e.length; o += 2) { + const a = e[o]; + if (typeof a != "number") + throw new Error('"step" requires stop inputs as literal numbers'); + if (s.length && s[s.length - 1][0] >= a) + throw new Error('"step" requires strictly ascending stop inputs'); + const l = va(e[o + 1], i); + n || (n = l.type), s.push([a, l]); + } + return new ROt(n, r, s); + } + evaluate(e, i) { + const r = this._stops; + if (r.length === 1) + return r[0][1].evaluate(e, i); + const n = this._input.evaluate(e, i); + let s = 0; + for (; ++s < r.length && !(n < r[s][0]); ) + ; + return this._stops[s - 1][1].evaluate(e, i); + } +}, fzi = class MOt { + constructor(e, i) { + this.type = e, this._output = i; + } + static parse(e, i, r) { + if (e.length < 4) + throw new Error('"let" expects at least 3 arguments'); + if (e.length % 2 == 1) + throw new Error('"let" expects an odd number of arguments'); + const n = new KUi(i); + for (let o = 1; o < e.length - 1; o += 2) { + const a = e[o]; + if (typeof a != "string") + throw new Error(`"let" requires a string to define variable names - found ${a}`); + n.add(a, va(e[o + 1], i)); + } + const s = va(e[e.length - 1], n, r); + return new MOt(s.type, s); + } + evaluate(e, i) { + return this._output.evaluate(e, i); + } +}, mzi = class DOt { + constructor(e, i) { + this.type = e, this.output = i; + } + static parse(e, i, r) { + if (e.length !== 2 || typeof e[1] != "string") + throw new Error('"var" requires just one literal string argument'); + const n = i.get(e[1]); + if (!n) + throw new Error(`${e[1]} must be defined before being used in a "var" expression`); + return new DOt(r || kO, n); + } + evaluate(e, i) { + return this.output.evaluate(e, i); + } +}, gzi = class FOt { + constructor(e, i, r) { + this.type = e, this._index = i, this._array = r; + } + static parse(e, i) { + if (e.length !== 3) + throw new Error('"at" expects 2 arguments'); + const r = va(e[1], i, Ep), n = va(e[2], i); + return new FOt(n.type.itemType, r, n); + } + evaluate(e, i) { + const r = this._index.evaluate(e, i), n = this._array.evaluate(e, i); + if (r < 0 || r >= n.length) + throw new Error('"at" index out of bounds'); + if (r !== Math.floor(r)) + throw new Error('"at" index must be an integer'); + return n[r]; + } +}, yzi = class pMe { + constructor(e, i) { + this._key = e, this._obj = i, this.type = kO; + } + static parse(e, i) { + let r, n; + switch (e.length) { + case 2: + return r = va(e[1], i), new pMe(r); + case 3: + return r = va(e[1], i), n = va(e[2], i), new pMe(r, n); + default: + throw new Error('"get" expects 1 or 2 arguments'); + } + } + evaluate(e, i) { + const r = this._key.evaluate(e, i); + return this._obj ? this._obj.evaluate(e, i)[r] : e?.values[r]; + } +}, vzi = class fMe { + constructor(e, i) { + this._key = e, this._obj = i, this.type = Fy; + } + static parse(e, i) { + let r, n; + switch (e.length) { + case 2: + return r = va(e[1], i), new fMe(r); + case 3: + return r = va(e[1], i), n = va(e[2], i), new fMe(r, n); + default: + throw new Error('"has" expects 1 or 2 arguments'); + } + } + evaluate(e, i) { + const r = this._key.evaluate(e, i); + return this._obj ? r in this._obj.evaluate(e, i) : !!e?.values[r]; + } +}, _zi = class LOt { + constructor(e, i) { + this._key = e, this._vals = i, this.type = Fy; + } + static parse(e, i) { + if (e.length !== 3) + throw new Error('"in" expects 2 arguments'); + return new LOt(va(e[1], i), va(e[2], i)); + } + evaluate(e, i) { + const r = this._key.evaluate(e, i); + return this._vals.evaluate(e, i).includes(r); + } +}, bzi = class mMe { + constructor(e, i, r) { + this._item = e, this._array = i, this._from = r, this.type = Ep; + } + static parse(e, i) { + if (e.length < 3 || e.length > 4) + throw new Error('"index-of" expects 3 or 4 arguments'); + const r = va(e[1], i), n = va(e[2], i); + if (e.length === 4) { + const s = va(e[3], i, Ep); + return new mMe(r, n, s); + } + return new mMe(r, n); + } + evaluate(e, i) { + const r = this._item.evaluate(e, i), n = this._array.evaluate(e, i); + if (this._from) { + const s = this._from.evaluate(e, i); + if (s !== Math.floor(s)) + throw new Error('"index-of" index must be an integer'); + return n.indexOf(r, s); + } + return n.indexOf(r); + } +}, wzi = class NOt { + constructor(e) { + this._arg = e, this.type = Ep; + } + static parse(e, i) { + if (e.length !== 2) + throw new Error('"length" expects 2 arguments'); + const r = va(e[1], i); + return new NOt(r); + } + evaluate(e, i) { + const r = this._arg.evaluate(e, i); + if (typeof r == "string" || Array.isArray(r)) + return r.length; + throw new Error('"length" expects string or array'); + } +}, xzi = class gMe { + constructor(e, i, r, n) { + this.type = e, this._array = i, this._from = r, this._to = n; + } + static parse(e, i) { + if (e.length < 3 || e.length > 4) + throw new Error('"slice" expects 2 or 3 arguments'); + const r = va(e[1], i), n = va(e[2], i, Ep); + if (n.type !== Ep) + throw new Error('"slice" index must return a number'); + if (e.length === 4) { + const s = va(e[3], i, Ep); + if (s.type !== Ep) + throw new Error('"slice" index must return a number'); + return new gMe(r.type, r, n, s); + } + return new gMe(r.type, r, n); + } + evaluate(e, i) { + const r = this._array.evaluate(e, i); + if (!Array.isArray(r) && typeof r != "string") + throw new Error('"slice" input must be an array or a string'); + const n = this._from.evaluate(e, i); + if (n < 0 || n >= r.length) + throw new Error('"slice" index out of bounds'); + if (n !== Math.floor(n)) + throw new Error('"slice" index must be an integer'); + if (this._to) { + const s = this._to.evaluate(e, i); + if (s < 0 || s >= r.length) + throw new Error('"slice" index out of bounds'); + if (s !== Math.floor(s)) + throw new Error('"slice" index must be an integer'); + return r.slice(n, s); + } + return r.slice(n); + } +}, Szi = class kOt { + constructor() { + this.type = Fy; + } + static parse(e) { + if (e.length !== 1) + throw new Error('"has-id" expects no arguments'); + return new kOt(); + } + evaluate(e, i) { + return e && e.id !== void 0; + } +}, Mb = class $Ot { + constructor(e, i) { + this._args = e, this._calculate = i, this.type = Ep; + } + static parse(e, i, r) { + const n = e.slice(1).map((s) => va(s, i)); + return new $Ot(n, r); + } + evaluate(e, i) { + let r; + return this._args && (r = this._args.map((n) => n.evaluate(e, i))), this._calculate(r); + } +}, Czi = class extends Mb { + static parse(e, i) { + switch (e.length) { + case 2: + return Mb.parse(e, i, (r) => -r[0]); + case 3: + return Mb.parse(e, i, (r) => r[0] - r[1]); + default: + throw new Error('"-" expects 1 or 2 arguments'); + } + } +}, Tzi = class extends Mb { + static parse(e, i) { + return Mb.parse(e, i, (r) => { + let n = 1; + for (const s of r) + n *= s; + return n; + }); + } +}, Ezi = class extends Mb { + static parse(e, i) { + if (e.length === 3) + return Mb.parse(e, i, (r) => r[0] / r[1]); + throw new Error('"/" expects 2 arguments'); + } +}, Izi = class extends Mb { + static parse(e, i) { + if (e.length === 3) + return Mb.parse(e, i, (r) => r[0] % r[1]); + throw new Error('"%" expects 2 arguments'); + } +}, Azi = class extends Mb { + static parse(e, i) { + if (e.length === 3) + return Mb.parse(e, i, (r) => r[0] ** r[1]); + throw new Error('"^" expects 1 or 2 arguments'); + } +}, Pzi = class extends Mb { + static parse(e, i) { + return Mb.parse(e, i, (r) => { + let n = 0; + for (const s of r) + n += s; + return n; + }); + } +}, Yf = class yMe { + constructor(e, i) { + this._args = e, this._calculate = i, this.type = Ep; + } + static parse(e, i) { + const r = e.slice(1).map((n) => va(n, i)); + return new yMe(r, yMe.ops[e[0]]); + } + evaluate(e, i) { + let r; + return this._args && (r = this._args.map((n) => n.evaluate(e, i))), this._calculate(r); + } +}; +Yf.ops = { abs: (t) => Math.abs(t[0]), acos: (t) => Math.acos(t[0]), asin: (t) => Math.asin(t[0]), atan: (t) => Math.atan(t[0]), ceil: (t) => Math.ceil(t[0]), cos: (t) => Math.cos(t[0]), e: () => Math.E, floor: (t) => Math.floor(t[0]), ln: (t) => Math.log(t[0]), ln2: () => Math.LN2, log10: (t) => Math.log(t[0]) / Math.LN10, log2: (t) => Math.log(t[0]) / Math.LN2, max: (t) => Math.max(...t), min: (t) => Math.min(...t), pi: () => Math.PI, round: (t) => Math.round(t[0]), sin: (t) => Math.sin(t[0]), sqrt: (t) => Math.sqrt(t[0]), tan: (t) => Math.tan(t[0]) }; +class H8e { + constructor(e) { + this._args = e, this.type = Nb; + } + static parse(e, i) { + return new H8e(e.slice(1).map((r) => va(r, i))); + } + evaluate(e, i) { + return this._args.map((r) => r.evaluate(e, i)).join(""); + } +} +class tz { + constructor(e, i) { + this._arg = e, this._calculate = i, this.type = Nb; + } + static parse(e, i) { + if (e.length !== 2) + throw new Error(`${e[0]} expects 1 argument`); + const r = va(e[1], i); + return new tz(r, tz.ops[e[0]]); + } + evaluate(e, i) { + return this._calculate(this._arg.evaluate(e, i)); + } +} +tz.ops = { downcase: (t) => t.toLowerCase(), upcase: (t) => t.toUpperCase() }; +class W8e { + constructor(e) { + this._args = e, this.type = s3; + } + static parse(e, i) { + if (e.length !== 4) + throw new Error('"rgb" expects 3 arguments'); + const r = e.slice(1).map((n) => va(n, i)); + return new W8e(r); + } + evaluate(e, i) { + const r = this._validate(this._args[0].evaluate(e, i)), n = this._validate(this._args[1].evaluate(e, i)), s = this._validate(this._args[2].evaluate(e, i)); + return new Wr({ r, g: n, b: s }); + } + _validate(e) { + if (typeof e != "number" || e < 0 || e > 255) + throw new Error(`${e}: invalid color component`); + return Math.round(e); + } +} +class q8e { + constructor(e) { + this._args = e, this.type = s3; + } + static parse(e, i) { + if (e.length !== 5) + throw new Error('"rgba" expects 4 arguments'); + const r = e.slice(1).map((n) => va(n, i)); + return new q8e(r); + } + evaluate(e, i) { + const r = this._validate(this._args[0].evaluate(e, i)), n = this._validate(this._args[1].evaluate(e, i)), s = this._validate(this._args[2].evaluate(e, i)), o = this._validateAlpha(this._args[3].evaluate(e, i)); + return new Wr({ r, g: n, b: s, a: o }); + } + _validate(e) { + if (typeof e != "number" || e < 0 || e > 255) + throw new Error(`${e}: invalid color component`); + return Math.round(e); + } + _validateAlpha(e) { + if (typeof e != "number" || e < 0 || e > 1) + throw new Error(`${e}: invalid alpha color component`); + return e; + } +} +let Ozi = class BOt { + constructor(e) { + this._color = e, this.type = Kie(Ep, 4); + } + static parse(e, i) { + if (e.length !== 2) + throw new Error('"to-rgba" expects 1 argument'); + const r = va(e[1], i); + return new BOt(r); + } + evaluate(e, i) { + return new Wr(this._color.evaluate(e, i)).toRgba(); + } +}; +class Lk { + constructor(e, i) { + this.type = e, this._args = i; + } + static parse(e, i) { + const r = e[0]; + if (e.length < 2) + throw new Error(`${r} expects at least one argument`); + let n, s = 1; + if (r === "array") { + if (e.length > 2) { + switch (e[1]) { + case "string": + n = Nb; + break; + case "number": + n = Ep; + break; + case "boolean": + n = Fy; + break; + default: + throw new Error('"array" type argument must be string, number or boolean'); + } + s++; + } else + n = kO; + let a; + if (e.length > 3) { + if (a = e[2], a !== null && (typeof a != "number" || a < 0 || a !== Math.floor(a))) + throw new Error('"array" length argument must be a positive integer literal'); + s++; + } + n = Kie(n, a); + } else + switch (r) { + case "string": + n = Nb; + break; + case "number": + n = Ep; + break; + case "boolean": + n = Fy; + break; + case "object": + n = _ve; + } + const o = []; + for (; s < e.length; s++) { + const a = va(e[s], i); + o.push(a); + } + return new Lk(n, o); + } + evaluate(e, i) { + let r; + for (const n of this._args) { + const s = n.evaluate(e, i); + if (r = bve(s), hMe(r, this.type)) + return s; + } + throw new Error(`Expected ${ez(this.type)} but got ${ez(r)}`); + } +} +class cx { + constructor(e, i) { + this.type = e, this._args = i; + } + static parse(e, i) { + const r = e[0], n = cx.types[r]; + if (n === Fy || n === Nb) { + if (e.length !== 2) + throw new Error(`${r} expects one argument`); + } else if (e.length < 2) + throw new Error(`${r} expects at least one argument`); + const s = []; + for (let o = 1; o < e.length; o++) { + const a = va(e[o], i); + s.push(a); + } + return new cx(n, s); + } + evaluate(e, i) { + if (this.type === Fy) + return !!this._args[0].evaluate(e, i); + if (this.type === Nb) + return dMe(this._args[0].evaluate(e, i)); + if (this.type === Ep) { + for (const r of this._args) { + const n = Number(r.evaluate(e, i)); + if (!isNaN(n)) + return n; + } + return null; + } + if (this.type === s3) { + for (const r of this._args) + try { + const n = cx.toColor(r.evaluate(e, i)); + if (n instanceof Wr) + return n; + } catch { + } + return null; + } + } + static toBoolean(e) { + return !!e; + } + static toString(e) { + return dMe(e); + } + static toNumber(e) { + const i = Number(e); + if (isNaN(i)) + throw new Error(`"${e}" is not a number`); + return i; + } + static toColor(e) { + if (e instanceof Wr) + return e; + if (typeof e == "string") { + const i = Wr.fromString(e); + if (i) + return i; + throw new Error(`"${e}" is not a color`); + } + if (Array.isArray(e)) + return Wr.fromArray(e); + throw new Error(`"${e}" is not a color`); + } +} +cx.types = { "to-boolean": Fy, "to-color": s3, "to-number": Ep, "to-string": Nb }; +class Y8e { + constructor(e) { + this._val = e, this.type = bve(e); + } + static parse(e) { + if (e.length !== 2) + throw new Error('"literal" expects 1 argument'); + return new Y8e(e[1]); + } + evaluate(e, i) { + return this._val; + } +} +class X8e { + constructor(e) { + this._arg = e, this.type = Nb; + } + static parse(e, i) { + if (e.length !== 2) + throw new Error('"typeof" expects 1 argument'); + return new X8e(va(e[1], i)); + } + evaluate(e, i) { + return ez(bve(this._arg.evaluate(e, i))); + } +} +function va(t, e, i) { + const r = typeof t; + if (r === "string" || r === "boolean" || r === "number" || t === null) { + if (i) + switch (i.kind) { + case "string": + r !== "string" && (t = cx.toString(t)); + break; + case "number": + r !== "number" && (t = cx.toNumber(t)); + break; + case "color": + t = cx.toColor(t); + } + t = ["literal", t]; + } + if (!Array.isArray(t) || t.length === 0) + throw new Error("Expression must be a non empty array"); + const n = t[0]; + if (typeof n != "string") + throw new Error("First element of expression must be a string"); + const s = VOt[n]; + if (s === void 0) + throw new Error(`Invalid expression operator "${n}"`); + if (!s) + throw new Error(`Unimplemented expression operator "${n}"`); + return s.parse(t, e, i); +} +const VOt = { array: Lk, boolean: Lk, collator: null, format: null, image: null, literal: Y8e, number: Lk, "number-format": null, object: Lk, string: Lk, "to-boolean": cx, "to-color": cx, "to-number": cx, "to-string": cx, typeof: X8e, accumulated: null, "feature-state": null, "geometry-type": ZUi, id: JUi, "line-progress": null, properties: QUi, at: gzi, get: yzi, has: vzi, in: _zi, "index-of": bzi, length: wzi, slice: xzi, "!": ozi, "!=": tzi, "<": izi, "<=": rzi, "==": ezi, ">": nzi, ">=": szi, all: azi, any: lzi, case: czi, coalesce: hzi, match: dzi, within: null, interpolate: gce, "interpolate-hcl": gce, "interpolate-lab": gce, step: pzi, let: fzi, var: mzi, concat: H8e, downcase: tz, "is-supported-script": null, "resolved-locale": null, upcase: tz, rgb: W8e, rgba: q8e, "to-rgba": Ozi, "-": Czi, "*": Tzi, "/": Ezi, "%": Izi, "^": Azi, "+": Pzi, abs: Yf, acos: Yf, asin: Yf, atan: Yf, ceil: Yf, cos: Yf, e: Yf, floor: Yf, ln: Yf, ln2: Yf, log10: Yf, log2: Yf, max: Yf, min: Yf, pi: Yf, round: Yf, sin: Yf, sqrt: Yf, tan: Yf, zoom: wOt, "heatmap-density": null, "has-id": Szi, none: uzi }; +let Rzi = class K1 { + constructor(e) { + this._expression = e; + } + filter(e, i) { + if (!this._expression) + return !0; + try { + return this._expression.evaluate(e, i); + } catch (r) { + return console.log(r.message), !0; + } + } + static createFilter(e) { + if (!e) + return null; + this.isLegacyFilter(e) && (e = this.convertLegacyFilter(e)); + try { + const i = va(e, null, Fy); + return new K1(i); + } catch (i) { + return console.log(i.message), null; + } + } + static isLegacyFilter(e) { + if (!Array.isArray(e) || e.length === 0) + return !0; + switch (e[0]) { + case "==": + case "!=": + case ">": + case "<": + case ">=": + case "<=": + return e.length === 3 && typeof e[1] == "string" && !Array.isArray(e[2]); + case "in": + return e.length >= 3 && typeof e[1] == "string" && !Array.isArray(e[2]); + case "!in": + case "none": + case "!has": + return !0; + case "any": + case "all": + for (let i = 1; i < e.length; i++) + if (this.isLegacyFilter(e[i])) + return !0; + return !1; + case "has": + return e.length === 2 && (e[1] === "$id" || e[1] === "$type"); + default: + return !1; + } + } + static convertLegacyFilter(e) { + if (!Array.isArray(e) || e.length === 0) + return !0; + const i = e[0]; + if (e.length === 1) + return i !== "any"; + switch (i) { + case "==": + return K1.convertComparison("==", e[1], e[2]); + case "!=": + return K1.negate(K1.convertComparison("==", e[1], e[2])); + case ">": + case "<": + case ">=": + case "<=": + return K1.convertComparison(i, e[1], e[2]); + case "in": + return K1.convertIn(e[1], e.slice(2)); + case "!in": + return K1.negate(K1.convertIn(e[1], e.slice(2))); + case "any": + case "all": + case "none": + return K1.convertCombining(i, e.slice(1)); + case "has": + return K1.convertHas(e[1]); + case "!has": + return K1.negate(K1.convertHas(e[1])); + default: + throw new Error("Unexpected legacy filter."); + } + } + static convertComparison(e, i, r) { + switch (i) { + case "$type": + return [e, ["geometry-type"], r]; + case "$id": + return [e, ["id"], r]; + default: + return [e, ["get", i], r]; + } + } + static convertIn(e, i) { + switch (e) { + case "$type": + return ["in", ["geometry-type"], ["literal", i]]; + case "$id": + return ["in", ["id"], ["literal", i]]; + default: + return ["in", ["get", e], ["literal", i]]; + } + } + static convertHas(e) { + switch (e) { + case "$type": + return !0; + case "$id": + return ["has-id"]; + default: + return ["has", e]; + } + } + static convertCombining(e, i) { + return [e].concat(i.map(this.convertLegacyFilter)); + } + static negate(e) { + return ["!", e]; + } +}, ret = class jOt { + constructor(e, i) { + let r; + switch (this.isDataDriven = !1, this.interpolator = null, e.type) { + case "number": + case "color": + r = !0; + break; + case "array": + r = e.value === "number"; + break; + default: + r = !1; + } + if (i == null && (i = e.default), Array.isArray(i) && i.length > 0 && VOt[i[0]]) { + const s = { number: Ep, color: s3, string: Nb, boolean: Fy, enum: Nb }; + try { + const o = e.type === "array" ? Kie(s[e.value] || kO, e.length) : s[e.type], a = va(i, null, o); + this.getValue = this._buildExpression(a, e), this.isDataDriven = !0, a instanceof gce && a.input instanceof wOt && (this.interpolator = a); + } catch (o) { + console.log(o.message), this.getValue = this._buildSimple(e.default); + } + return; + } + r && i.type === "interval" && (r = !1); + const n = i && i.stops && i.stops.length > 0; + if (n) + for (const s of i.stops) + s[1] = this._validate(s[1], e); + if (this.isDataDriven = !!i && !!i.property, this.isDataDriven) + if (i.default !== void 0 && (i.default = this._validate(i.default, e)), n) + switch (i.type) { + case "identity": + this.getValue = this._buildIdentity(i, e); + break; + case "categorical": + this.getValue = this._buildCategorical(i, e); + break; + default: + this.getValue = r ? this._buildInterpolate(i, e) : this._buildInterval(i, e); + } + else + this.getValue = this._buildIdentity(i, e); + else + n ? this.getValue = r ? this._buildZoomInterpolate(i) : this._buildZoomInterval(i) : (i = this._validate(i, e), this.getValue = this._buildSimple(i)); + } + _validate(e, i) { + if (i.type === "number") { + if (e < i.minimum) + return i.minimum; + if (e > i.maximum) + return i.maximum; + } else + i.type === "color" ? e = jOt._parseColor(e) : i.type === "enum" ? typeof e == "string" && (e = i.values.indexOf(e)) : i.type === "array" && i.value === "enum" ? e = e.map((r) => typeof r == "string" ? i.values.indexOf(r) : r) : i.type === "string" && (e = dMe(e)); + return e; + } + _buildSimple(e) { + return () => e; + } + _buildExpression(e, i) { + return (r, n) => { + try { + const s = e.evaluate(n, r); + return s === void 0 ? i.default : this._validate(s, i); + } catch (s) { + return console.log(s.message), i.default; + } + }; + } + _buildIdentity(e, i) { + return (r, n) => { + let s; + return n && (s = n.values[e.property]), s !== void 0 && (s = this._validate(s, i)), s ?? (e.default !== void 0 ? e.default : i.default); + }; + } + _buildCategorical(e, i) { + return (r, n) => { + let s; + return n && (s = n.values[e.property]), s = this._categorical(s, e.stops), s !== void 0 ? s : e.default !== void 0 ? e.default : i.default; + }; + } + _buildInterval(e, i) { + return (r, n) => { + let s; + return n && (s = n.values[e.property]), typeof s == "number" ? this._interval(s, e.stops) : e.default !== void 0 ? e.default : i.default; + }; + } + _buildInterpolate(e, i) { + return (r, n) => { + let s; + return n && (s = n.values[e.property]), typeof s == "number" ? this._interpolate(s, e.stops, e.base || 1) : e.default !== void 0 ? e.default : i.default; + }; + } + _buildZoomInterpolate(e) { + return (i) => this._interpolate(i, e.stops, e.base || 1); + } + _buildZoomInterval(e) { + return (i) => this._interval(i, e.stops); + } + _categorical(e, i) { + const r = i.length; + for (let n = 0; n < r; n++) + if (i[n][0] === e) + return i[n][1]; + } + _interval(e, i) { + const r = i.length; + let n = 0; + for (let s = 0; s < r && i[s][0] <= e; s++) + n = s; + return i[n][1]; + } + _interpolate(e, i, r) { + let n, s; + const o = i.length; + for (let a = 0; a < o; a++) { + const l = i[a]; + if (!(l[0] <= e)) { + s = l; + break; + } + n = l; + } + if (n && s) { + const a = s[0] - n[0], l = e - n[0], c = r === 1 ? l / a : (r ** l - 1) / (r ** a - 1); + if (Array.isArray(n[1])) { + const h = n[1], p = s[1], y = []; + for (let v = 0; v < h.length; v++) + y.push(qm(h[v], p[v], c)); + return y; + } + return qm(n[1], s[1], c); + } + return n ? n[1] : s ? s[1] : void 0; + } + static _isEmpty(e) { + for (const i in e) + if (e.hasOwnProperty(i)) + return !1; + return !0; + } + static _parseColor(e) { + return Array.isArray(e) ? e : (typeof e == "string" && (e = new Wr(e)), e instanceof Wr && !this._isEmpty(e) ? Wr.toUnitRGBA(e) : void 0); + } +}; +var eZ; +(function(t) { + t[t.BUTT = 0] = "BUTT", t[t.ROUND = 1] = "ROUND", t[t.SQUARE = 2] = "SQUARE", t[t.UNKNOWN = 4] = "UNKNOWN"; +})(eZ || (eZ = {})); +let Jie = class { + constructor(e, i, r, n) { + switch (this.type = e, this.typeName = i.type, this.id = i.id, this.source = i.source, this.sourceLayer = i["source-layer"], this.minzoom = i.minzoom, this.maxzoom = i.maxzoom, this.filter = i.filter, this.layout = i.layout, this.paint = i.paint, this.z = r, this.uid = n, e) { + case dl.BACKGROUND: + this._layoutDefinition = If.backgroundLayoutDefinition, this._paintDefinition = If.backgroundPaintDefinition; + break; + case dl.FILL: + this._layoutDefinition = If.fillLayoutDefinition, this._paintDefinition = If.fillPaintDefinition; + break; + case dl.LINE: + this._layoutDefinition = If.lineLayoutDefinition, this._paintDefinition = If.linePaintDefinition; + break; + case dl.SYMBOL: + this._layoutDefinition = If.symbolLayoutDefinition, this._paintDefinition = If.symbolPaintDefinition; + break; + case dl.CIRCLE: + this._layoutDefinition = If.circleLayoutDefinition, this._paintDefinition = If.circlePaintDefinition; + } + this._layoutProperties = this._parseLayout(this.layout), this._paintProperties = this._parsePaint(this.paint); + } + getFeatureFilter() { + return this._featureFilter !== void 0 ? this._featureFilter : this._featureFilter = Rzi.createFilter(this.filter); + } + getLayoutProperty(e) { + return this._layoutProperties[e]; + } + getPaintProperty(e) { + return this._paintProperties[e]; + } + getLayoutValue(e, i, r) { + let n; + const s = this._layoutProperties[e]; + return s && (n = s.getValue(i, r)), n === void 0 && (n = this._layoutDefinition[e].default), n; + } + getPaintValue(e, i, r) { + let n; + const s = this._paintProperties[e]; + return s && (n = s.getValue(i, r)), n === void 0 && (n = this._paintDefinition[e].default), n; + } + isPainterDataDriven() { + const e = this._paintProperties; + if (e) { + for (const i in e) + if (e[i].isDataDriven) + return !0; + } + return !1; + } + _parseLayout(e) { + const i = {}; + for (const r in e) { + const n = this._layoutDefinition[r]; + n && (i[r] = new ret(n, e[r])); + } + return i; + } + _parsePaint(e) { + const i = {}; + for (const r in e) { + const n = this._paintDefinition[r]; + n && (i[r] = new ret(n, e[r])); + } + return i; + } + computeAttributesKey(e, i, r, n) { + let s = 0, o = 0; + for (const a of i) { + let l = 3; + if (!a || a !== n) { + const c = r[a], { isLayout: h, isOptional: p } = c, y = h ? this.getLayoutProperty(a) : this.getPaintProperty(a); + l = y?.interpolator ? 2 : y?.isDataDriven ? 1 : p && !y ? 3 : 0; + } + o |= l << s, s += 2; + } + return o << 3 | e; + } +}, net = class extends Jie { + constructor(e, i, r, n) { + super(e, i, r, n), this.backgroundMaterial = new g7(this.computeAttributesKey(_p.BACKGROUND, g7.ATTRIBUTES, g7.ATTRIBUTES_INFO)); + } +}, set = class extends Jie { + constructor(e, i, r, n) { + super(e, i, r, n); + const s = this.getPaintProperty("fill-color"), o = this.getPaintProperty("fill-opacity"), a = this.getPaintProperty("fill-pattern"); + this.hasDataDrivenColor = s?.isDataDriven, this.hasDataDrivenOpacity = o?.isDataDriven, this.hasDataDrivenFill = this.hasDataDrivenColor || this.hasDataDrivenOpacity || a?.isDataDriven; + const l = this.getPaintProperty("fill-outline-color"); + this.outlineUsesFillColor = !l, this.hasDataDrivenOutlineColor = l?.isDataDriven, this.hasDataDrivenOutline = l ? l.isDataDriven : !!s && s.isDataDriven, this.hasDataDrivenOutline = (l ? this.hasDataDrivenOutlineColor : this.hasDataDrivenColor) || this.hasDataDrivenOpacity, this.fillMaterial = new v7(this.computeAttributesKey(_p.FILL, v7.ATTRIBUTES, v7.ATTRIBUTES_INFO)), this.outlineMaterial = new bE(this.computeAttributesKey(_p.OUTLINE, this.outlineUsesFillColor ? bE.ATTRIBUTES_FILL : bE.ATTRIBUTES_OUTLINE, this.outlineUsesFillColor ? bE.ATTRIBUTES_INFO_FILL : bE.ATTRIBUTES_INFO_OUTLINE), this.outlineUsesFillColor); + } +}, oet = class extends Jie { + constructor(e, i, r, n) { + super(e, i, r, n); + const s = this.getPaintProperty("line-pattern"); + if (this.lineMaterial = new _7(this.computeAttributesKey(_p.LINE, _7.ATTRIBUTES, _7.ATTRIBUTES_INFO, s ? "line-dasharray" : "")), this.hasDataDrivenLine = this.getPaintProperty("line-blur")?.isDataDriven || this.getPaintProperty("line-color")?.isDataDriven || this.getPaintProperty("line-gap-width")?.isDataDriven || this.getPaintProperty("line-offset")?.isDataDriven || this.getPaintProperty("line-opacity")?.isDataDriven || this.getPaintProperty("line-pattern")?.isDataDriven || this.getPaintProperty("line-dasharray")?.isDataDriven || this.getLayoutProperty("line-cap")?.isDataDriven || this.getPaintProperty("line-width")?.isDataDriven, this.canUseThinTessellation = !1, !this.hasDataDrivenLine) { + const o = this.getPaintProperty("line-width"); + if (!o || typeof o == "number" && 0.5 * o < P8e) { + const a = this.getPaintProperty("line-offset"); + (!a || typeof a == "number" && a === 0) && (this.canUseThinTessellation = !0); + } + } + } + getDashKey(e, i) { + let r; + switch (i) { + case eZ.BUTT: + r = "Butt"; + break; + case eZ.ROUND: + r = "Round"; + break; + case eZ.SQUARE: + r = "Square"; + break; + default: + r = "Butt"; + } + return `dasharray-[${e.toString()}]-${r}`; + } +}, aet = class extends Jie { + constructor(e, i, r, n) { + super(e, i, r, n), this.iconMaterial = new ZJ(this.computeAttributesKey(_p.ICON, ZJ.ATTRIBUTES, ZJ.ATTRIBUTES_INFO)), this.textMaterial = new QJ(this.computeAttributesKey(_p.TEXT, QJ.ATTRIBUTES, QJ.ATTRIBUTES_INFO)), this.hasDataDrivenIcon = this.getPaintProperty("icon-color")?.isDataDriven || this.getPaintProperty("icon-halo-blur")?.isDataDriven || this.getPaintProperty("icon-halo-color")?.isDataDriven || this.getPaintProperty("icon-halo-width")?.isDataDriven || this.getPaintProperty("icon-opacity")?.isDataDriven || this.getLayoutProperty("icon-size")?.isDataDriven, this.hasDataDrivenText = this.getPaintProperty("text-color")?.isDataDriven || this.getPaintProperty("text-halo-blur")?.isDataDriven || this.getPaintProperty("text-halo-color")?.isDataDriven || this.getPaintProperty("text-halo-width")?.isDataDriven || this.getPaintProperty("text-opacity")?.isDataDriven || this.getLayoutProperty("text-size")?.isDataDriven; + } +}, uet = class extends Jie { + constructor(e, i, r, n) { + super(e, i, r, n), this.circleMaterial = new y7(this.computeAttributesKey(_p.CIRCLE, y7.ATTRIBUTES, y7.ATTRIBUTES_INFO)); + } +}, Mzi = class { + constructor(e, i, r) { + let n; + this.allowOverlap = e.getLayoutValue("icon-allow-overlap", i), this.ignorePlacement = e.getLayoutValue("icon-ignore-placement", i), this.keepUpright = e.getLayoutValue("icon-keep-upright", i), this.optional = e.getLayoutValue("icon-optional", i), this.rotationAlignment = e.getLayoutValue("icon-rotation-alignment", i), this.rotationAlignment === nc.AUTO && (this.rotationAlignment = r ? nc.MAP : nc.VIEWPORT), n = e.getLayoutProperty("icon-anchor"), n?.isDataDriven ? this._anchorProp = n : this.anchor = e.getLayoutValue("icon-anchor", i), n = e.getLayoutProperty("icon-offset"), n?.isDataDriven ? this._offsetProp = n : this.offset = e.getLayoutValue("icon-offset", i), n = e.getLayoutProperty("icon-padding"), n?.isDataDriven ? this._paddingProp = n : this.padding = e.getLayoutValue("icon-padding", i), n = e.getLayoutProperty("icon-rotate"), n?.isDataDriven ? this._rotateProp = n : this.rotate = e.getLayoutValue("icon-rotate", i), n = e.getLayoutProperty("icon-size"), n?.isDataDriven ? this._sizeProp = n : this.size = e.getLayoutValue("icon-size", i); + } + update(e, i) { + this._anchorProp && (this.anchor = this._anchorProp.getValue(e, i)), this._offsetProp && (this.offset = this._offsetProp.getValue(e, i)), this._paddingProp && (this.padding = this._paddingProp.getValue(e, i)), this._rotateProp && (this.rotate = this._rotateProp.getValue(e, i)), this._sizeProp && (this.size = this._sizeProp.getValue(e, i)); + } +}, Dzi = class { + constructor(e, i, r) { + let n; + this.allowOverlap = e.getLayoutValue("text-allow-overlap", i), this.ignorePlacement = e.getLayoutValue("text-ignore-placement", i), this.keepUpright = e.getLayoutValue("text-keep-upright", i), this.optional = e.getLayoutValue("text-optional", i), this.rotationAlignment = e.getLayoutValue("text-rotation-alignment", i), this.rotationAlignment === nc.AUTO && (this.rotationAlignment = r ? nc.MAP : nc.VIEWPORT), n = e.getLayoutProperty("text-anchor"), n?.isDataDriven ? this._anchorProp = n : this.anchor = e.getLayoutValue("text-anchor", i), n = e.getLayoutProperty("text-justify"), n?.isDataDriven ? this._justifyProp = n : this.justify = e.getLayoutValue("text-justify", i), n = e.getLayoutProperty("text-letter-spacing"), n?.isDataDriven ? this._letterSpacingProp = n : this.letterSpacing = e.getLayoutValue("text-letter-spacing", i), n = e.getLayoutProperty("text-line-height"), n?.isDataDriven ? this._lineHeightProp = n : this.lineHeight = e.getLayoutValue("text-line-height", i), n = e.getLayoutProperty("text-max-angle"), n?.isDataDriven ? this._maxAngleProp = n : this.maxAngle = e.getLayoutValue("text-max-angle", i), n = e.getLayoutProperty("text-max-width"), n?.isDataDriven ? this._maxWidthProp = n : this.maxWidth = e.getLayoutValue("text-max-width", i), n = e.getLayoutProperty("text-offset"), n?.isDataDriven ? this._offsetProp = n : this.offset = e.getLayoutValue("text-offset", i), n = e.getLayoutProperty("text-padding"), n?.isDataDriven ? this._paddingProp = n : this.padding = e.getLayoutValue("text-padding", i), n = e.getLayoutProperty("text-rotate"), n?.isDataDriven ? this._rotateProp = n : this.rotate = e.getLayoutValue("text-rotate", i), n = e.getLayoutProperty("text-size"), n?.isDataDriven ? this._sizeProp = n : this.size = e.getLayoutValue("text-size", i), n = e.getLayoutProperty("text-writing-mode"), n?.isDataDriven ? this._writingModeProp = n : this.writingMode = e.getLayoutValue("text-writing-mode", i); + } + update(e, i) { + this._anchorProp && (this.anchor = this._anchorProp.getValue(e, i)), this._justifyProp && (this.justify = this._justifyProp.getValue(e, i)), this._letterSpacingProp && (this.letterSpacing = this._letterSpacingProp.getValue(e, i)), this._lineHeightProp && (this.lineHeight = this._lineHeightProp.getValue(e, i)), this._maxAngleProp && (this.maxAngle = this._maxAngleProp.getValue(e, i)), this._maxWidthProp && (this.maxWidth = this._maxWidthProp.getValue(e, i)), this._offsetProp && (this.offset = this._offsetProp.getValue(e, i)), this._paddingProp && (this.padding = this._paddingProp.getValue(e, i)), this._rotateProp && (this.rotate = this._rotateProp.getValue(e, i)), this._sizeProp && (this.size = this._sizeProp.getValue(e, i)), this._writingModeProp && (this.writingMode = this._writingModeProp.getValue(e, i)); + } +}; +const cet = 10; +function Fzi(t, e) { + return t.iconMosaicItem && e.iconMosaicItem ? t.iconMosaicItem.page === e.iconMosaicItem.page ? 0 : t.iconMosaicItem.page - e.iconMosaicItem.page : t.iconMosaicItem && !e.iconMosaicItem ? 1 : !t.iconMosaicItem && e.iconMosaicItem ? -1 : 0; +} +let GOt = class U2 extends yve { + constructor(e, i, r, n, s, o, a, l) { + super(e, i, l.getSpriteItems()), this.type = Pg.SYMBOL, this._markerMap = /* @__PURE__ */ new Map(), this._glyphMap = /* @__PURE__ */ new Map(), this._glyphBufferDataStorage = /* @__PURE__ */ new Map(), this._isIconSDF = !1, this._iconVertexBuffer = r, this._iconIndexBuffer = n, this._textVertexBuffer = s, this._textIndexBuffer = o, this._placementEngine = a, this._workerTileHandler = l; + } + get markerPageMap() { + return this._markerMap; + } + get glyphsPageMap() { + return this._glyphMap; + } + get symbolInstances() { + return this._symbolInstances; + } + getResources(e, i, r) { + const n = this.layer, s = this.zoom; + e && e.setExtent(this.layerExtent); + const o = n.getLayoutProperty("icon-image"), a = n.getLayoutProperty("text-field"); + let l = n.getLayoutProperty("text-transform"), c = n.getLayoutProperty("text-font"); + const h = []; + let p, y, v, x; + o && !o.isDataDriven && (p = o.getValue(s)), a && !a.isDataDriven && (y = a.getValue(s)), l && l.isDataDriven || (v = n.getLayoutValue("text-transform", s), l = null), c && c.isDataDriven || (x = n.getLayoutValue("text-font", s), c = null); + for (const I of this._features) { + const P = I.getGeometry(e); + if (!P || P.length === 0) + continue; + let F, k; + o && (F = o.isDataDriven ? o.getValue(s, I) : this._replaceKeys(p, I.values), F && i(F)); + let V = !1; + if (a && (k = a.isDataDriven ? a.getValue(s, I) : this._replaceKeys(y, I.values), k)) { + switch (k = k.replace(/\\n/g, ` +`), l && (v = l.getValue(s, I)), v) { + case mee.LOWERCASE: + k = k.toLowerCase(); + break; + case mee.UPPERCASE: + k = k.toUpperCase(); + } + if (U2._bidiEngine.hasBidiChar(k)) { + let Q; + Q = U2._bidiEngine.checkContextual(k) === "rtl" ? "IDNNN" : "ICNNN", k = U2._bidiEngine.bidiTransform(k, Q, "VLYSN"), V = !0; + } + const X = k.length; + if (X > 0) { + c && (x = c.getValue(s, I)); + for (const Q of x) { + let re = r[Q]; + re || (re = r[Q] = /* @__PURE__ */ new Set()); + for (let he = 0; he < X; he++) { + const fe = k.charCodeAt(he); + re.add(fe); + } + } + } + } + if (!F && !k) + continue; + const j = n.getLayoutValue("symbol-sort-key", s, I), Y = { feature: I, sprite: F, label: k, rtl: V, geometry: P, hash: (k ? ih(k) : 0) ^ (F ? ih(F) : 0), priority: j, textFont: x }; + h.push(Y); + } + this._symbolFeatures = h; + } + processFeatures(e) { + e && e.setExtent(this.layerExtent); + const i = this.layer, r = this.zoom, n = i.getLayoutValue("symbol-placement", r), s = n !== NO.POINT, o = i.getLayoutValue("symbol-spacing", r) * SX, a = i.getLayoutProperty("icon-image"), l = i.getLayoutProperty("text-field"), c = a ? new Mzi(i, r, s) : null, h = l ? new Dzi(i, r, s) : null, p = this._workerTileHandler; + let y; + a && (y = p.getSpriteItems()), this._iconIndexStart = 3 * this._iconIndexBuffer.index, this._textIndexStart = 3 * this._textIndexBuffer.index, this._iconIndexCount = 0, this._textIndexCount = 0, this._markerMap.clear(), this._glyphMap.clear(); + const v = []; + let x = 1; + h && h.size && (x = h.size / vE); + const I = h ? h.maxAngle * oMe : 0, P = h ? h.size * SX : 0; + for (const F of this._symbolFeatures) { + let k; + c && y && F.sprite && (k = y[F.sprite], k && k.sdf && (this._isIconSDF = !0)); + let V; + k && c.update(r, F.feature); + let j = 0; + const Y = F.label; + if (Y) { + Fg(h), h.update(r, F.feature); + const X = s && h.rotationAlignment === nc.MAP ? h.keepUpright : h.writingMode && h.writingMode.includes(Efe.VERTICAL); + let Q = 0.5; + switch (h.anchor) { + case ec.TOP_LEFT: + case ec.LEFT: + case ec.BOTTOM_LEFT: + Q = 0; + break; + case ec.TOP_RIGHT: + case ec.RIGHT: + case ec.BOTTOM_RIGHT: + Q = 1; + } + let re = 0.5; + switch (h.anchor) { + case ec.TOP_LEFT: + case ec.TOP: + case ec.TOP_RIGHT: + re = 0; + break; + case ec.BOTTOM_LEFT: + case ec.BOTTOM: + case ec.BOTTOM_RIGHT: + re = 1; + } + let he = 0.5; + switch (h.justify) { + case m7.AUTO: + he = Q; + break; + case m7.LEFT: + he = 0; + break; + case m7.RIGHT: + he = 1; + } + const fe = h.letterSpacing * vE, be = s ? 0 : h.maxWidth * vE, Se = h.lineHeight * vE, Me = F.textFont.map((ke) => p.getGlyphItems(ke)); + if (V = new rOt(Me, be, Se, fe, Q, re, he).getShaping(Y, F.rtl, X), V && V.length > 0) { + let ke = 1e30, J = -1e30; + for (const ce of V) + ke = Math.min(ke, ce.x), J = Math.max(J, ce.x); + j = (J - ke + 2 * vE) * x * SX; + } + } + for (let X of F.geometry) { + const Q = []; + if (n === NO.LINE) { + if (V?.length && h?.size) { + const re = h.size * SX * (2 + Math.min(2, 4 * Math.abs(h.offset[1]))); + X = U2._smoothVertices(X, re); + } + U2._pushAnchors(Q, X, o, j); + } else + n === NO.LINE_CENTER ? U2._pushCenterAnchor(Q, X) : F.feature.type === py.Polygon ? U2._pushCentroid(Q, X) : Q.push(new Noe(X[0].x, X[0].y)); + for (const re of Q) { + if (re.x < 0 || re.x > jQe || re.y < 0 || re.y > jQe || s && j > 0 && h?.rotationAlignment === nc.MAP && !U2._honorsTextMaxAngle(X, re, j, I, P)) + continue; + const he = { shaping: V, line: X, iconMosaicItem: k, anchor: re, symbolFeature: F, textColliders: [], iconColliders: [], textVertexRanges: [], iconVertexRanges: [] }; + v.push(he), this._processFeature(he, c, h); + } + } + } + v.sort(Fzi), this._addPlacedGlyphs(), this._symbolInstances = v; + } + serialize() { + let e = 11; + e += this.layerUIDs.length, e += 3 * this.markerPageMap.size, e += 3 * this.glyphsPageMap.size, e += U2._symbolsSerializationLength(this._symbolInstances), e += this._iconVertexBuffer.array.length, e += this._iconIndexBuffer.array.length, e += this._textVertexBuffer.array.length, e += this._textIndexBuffer.array.length; + const i = new Uint32Array(e), r = new Int32Array(i.buffer), n = new Float32Array(i.buffer); + let s = 0; + i[s++] = this.type, i[s++] = this.layerUIDs.length; + for (let o = 0; o < this.layerUIDs.length; o++) + i[s++] = this.layerUIDs[o]; + i[s++] = this._isIconSDF ? 1 : 0, i[s++] = this.markerPageMap.size; + for (const [o, [a, l]] of this.markerPageMap) + i[s++] = o, i[s++] = a, i[s++] = l; + i[s++] = this.glyphsPageMap.size; + for (const [o, [a, l]] of this.glyphsPageMap) + i[s++] = o, i[s++] = a, i[s++] = l; + i[s++] = this._iconVertexBuffer.index / 4, i[s++] = this._textVertexBuffer.index / 4, s = U2.serializeSymbols(i, r, n, s, this._symbolInstances), i[s++] = this._iconVertexBuffer.array.length; + for (let o = 0; o < this._iconVertexBuffer.array.length; o++) + r[s++] = this._iconVertexBuffer.array[o]; + i[s++] = this._iconIndexBuffer.array.length; + for (let o = 0; o < this._iconIndexBuffer.array.length; o++) + i[s++] = this._iconIndexBuffer.array[o]; + i[s++] = this._textVertexBuffer.array.length; + for (let o = 0; o < this._textVertexBuffer.array.length; o++) + r[s++] = this._textVertexBuffer.array[o]; + i[s++] = this._textIndexBuffer.array.length; + for (let o = 0; o < this._textIndexBuffer.array.length; o++) + i[s++] = this._textIndexBuffer.array[o]; + return i.buffer; + } + static _symbolsSerializationLength(e) { + let i = 0; + i += 1; + for (const r of e || []) { + i += 4, i += 1; + for (const n of r.textColliders) + i += cet; + for (const n of r.iconColliders) + i += cet; + i += 1, i += 2 * r.textVertexRanges.length, i += 1, i += 2 * r.iconVertexRanges.length; + } + return i; + } + static serializeSymbols(e, i, r, n, s) { + s = s || [], i[n++] = s.length; + for (const o of s) { + i[n++] = o.anchor.x, i[n++] = o.anchor.y, i[n++] = o.symbolFeature.hash, i[n++] = o.symbolFeature.priority, i[n++] = o.textColliders.length + o.iconColliders.length; + for (const a of o.textColliders) + i[n++] = a.xTile, i[n++] = a.yTile, i[n++] = a.dxPixels, i[n++] = a.dyPixels, i[n++] = a.hard ? 1 : 0, i[n++] = a.partIndex, r[n++] = a.minLod, r[n++] = a.maxLod, i[n++] = a.width, i[n++] = a.height; + for (const a of o.iconColliders) + i[n++] = a.xTile, i[n++] = a.yTile, i[n++] = a.dxPixels, i[n++] = a.dyPixels, i[n++] = a.hard ? 1 : 0, i[n++] = a.partIndex, r[n++] = a.minLod, r[n++] = a.maxLod, i[n++] = a.width, i[n++] = a.height; + i[n++] = o.textVertexRanges.length; + for (const [a, l] of o.textVertexRanges) + i[n++] = a, i[n++] = l; + i[n++] = o.iconVertexRanges.length; + for (const [a, l] of o.iconVertexRanges) + i[n++] = a, i[n++] = l; + } + return n; + } + _replaceKeys(e, i) { + return e.replace(/{([^{}]+)}/g, (r, n) => n in i ? i[n] : ""); + } + _processFeature(e, i, r) { + const { line: n, iconMosaicItem: s, shaping: o, anchor: a } = e, l = this.zoom, c = this.layer, h = !!s; + let p = !0; + h && (p = i?.optional || !s); + const y = o && o.length > 0, v = !y || r?.optional; + let x, I; + if (h && (x = this._placementEngine.getIconPlacement(a, s, i)), (x || p) && (y && (I = this._placementEngine.getTextPlacement(a, o, n, r)), I || v)) { + if (x && I || (v || p ? v || I ? p || x || (I = null) : x = null : (x = null, I = null)), I) { + const P = c.hasDataDrivenText ? c.textMaterial.encodeAttributes(e.symbolFeature.feature, l, c) : null; + if (this._storePlacedGlyphs(e, I.shapes, l, r.rotationAlignment, P), I.textColliders) { + e.textColliders = I.textColliders; + for (const F of I.textColliders) { + F.minLod = Math.max(l + UR(F.minLod), 0), F.maxLod = Math.min(l + UR(F.maxLod), 25); + const k = F.angle; + if (k) { + const V = Math.cos(k), j = Math.sin(k), Y = F.dxPixels * V - F.dyPixels * j, X = F.dxPixels * j + F.dyPixels * V, Q = (F.dxPixels + F.width) * V - F.dyPixels * j, re = (F.dxPixels + F.width) * j + F.dyPixels * V, he = F.dxPixels * V - (F.dyPixels + F.height) * j, fe = F.dxPixels * j + (F.dyPixels + F.height) * V, be = (F.dxPixels + F.width) * V - (F.dyPixels + F.height) * j, Se = (F.dxPixels + F.width) * j + (F.dyPixels + F.height) * V, Me = Math.min(Y, Q, he, be), ke = Math.max(Y, Q, he, be), J = Math.min(X, re, fe, Se), ce = Math.max(X, re, fe, Se); + F.dxPixels = Me, F.dyPixels = J, F.width = ke - Me, F.height = ce - J; + } + } + } + } + if (x) { + const P = c.hasDataDrivenIcon ? c.iconMaterial.encodeAttributes(e.symbolFeature.feature, l, c) : null; + if (this._addPlacedIcons(e, x.shapes, l, s.page, i.rotationAlignment === nc.VIEWPORT, P), x.iconColliders) { + e.iconColliders = x.iconColliders; + for (const F of x.iconColliders) { + F.minLod = Math.max(l + UR(F.minLod), 0), F.maxLod = Math.min(l + UR(F.maxLod), 25); + const k = F.angle; + if (k) { + const V = Math.cos(k), j = Math.sin(k), Y = F.dxPixels * V - F.dyPixels * j, X = F.dxPixels * j + F.dyPixels * V, Q = (F.dxPixels + F.width) * V - F.dyPixels * j, re = (F.dxPixels + F.width) * j + F.dyPixels * V, he = F.dxPixels * V - (F.dyPixels + F.height) * j, fe = F.dxPixels * j + (F.dyPixels + F.height) * V, be = (F.dxPixels + F.width) * V - (F.dyPixels + F.height) * j, Se = (F.dxPixels + F.width) * j + (F.dyPixels + F.height) * V, Me = Math.min(Y, Q, he, be), ke = Math.max(Y, Q, he, be), J = Math.min(X, re, fe, Se), ce = Math.max(X, re, fe, Se); + F.dxPixels = Me, F.dyPixels = J, F.width = ke - Me, F.height = ce - J; + } + } + } + } + } + } + _addPlacedIcons(e, i, r, n, s, o) { + const a = Math.max(r - 1, 0), l = this._iconVertexBuffer, c = this._iconIndexBuffer, h = this._markerMap; + for (const p of i) { + const y = s ? 0 : Math.max(r + UR(p.minzoom), a), v = s ? 25 : Math.min(r + UR(p.maxzoom), 25); + if (v <= y) + continue; + const x = p.tl, I = p.tr, P = p.bl, F = p.br, k = p.mosaicRect, V = p.labelAngle, j = p.minAngle, Y = p.maxAngle, X = p.anchor, Q = l.index, re = k.x, he = k.y, fe = re + k.width, be = he + k.height, Se = l.index; + l.add(X.x, X.y, x.x, x.y, re, he, V, j, Y, y, v, o), l.add(X.x, X.y, I.x, I.y, fe, he, V, j, Y, y, v, o), l.add(X.x, X.y, P.x, P.y, re, be, V, j, Y, y, v, o), l.add(X.x, X.y, F.x, F.y, fe, be, V, j, Y, y, v, o), e.iconVertexRanges.length > 0 && e.iconVertexRanges[0][0] + e.iconVertexRanges[0][1] === Se ? e.iconVertexRanges[0][1] += 4 : e.iconVertexRanges.push([Se, 4]), c.add(Q + 0, Q + 1, Q + 2), c.add(Q + 1, Q + 2, Q + 3), h.has(n) ? h.get(n)[1] += 6 : h.set(n, [this._iconIndexStart + this._iconIndexCount, 6]), this._iconIndexCount += 6; + } + } + _addPlacedGlyphs() { + const e = this._textVertexBuffer, i = this._textIndexBuffer, r = this._glyphMap; + for (const [n, s] of this._glyphBufferDataStorage) + for (const o of s) { + const a = e.index, l = o.symbolInstance, c = o.ddAttributes, h = e.index; + e.add(o.glyphAnchor[0], o.glyphAnchor[1], o.tl[0], o.tl[1], o.xmin, o.ymin, o.labelAngle, o.minAngle, o.maxAngle, o.minLod, o.maxLod, c), e.add(o.glyphAnchor[0], o.glyphAnchor[1], o.tr[0], o.tr[1], o.xmax, o.ymin, o.labelAngle, o.minAngle, o.maxAngle, o.minLod, o.maxLod, c), e.add(o.glyphAnchor[0], o.glyphAnchor[1], o.bl[0], o.bl[1], o.xmin, o.ymax, o.labelAngle, o.minAngle, o.maxAngle, o.minLod, o.maxLod, c), e.add(o.glyphAnchor[0], o.glyphAnchor[1], o.br[0], o.br[1], o.xmax, o.ymax, o.labelAngle, o.minAngle, o.maxAngle, o.minLod, o.maxLod, c), l.textVertexRanges.length > 0 && l.textVertexRanges[0][0] + l.textVertexRanges[0][1] === h ? l.textVertexRanges[0][1] += 4 : l.textVertexRanges.push([h, 4]), i.add(a + 0, a + 1, a + 2), i.add(a + 1, a + 2, a + 3), r.has(n) ? r.get(n)[1] += 6 : r.set(n, [this._textIndexStart + this._textIndexCount, 6]), this._textIndexCount += 6; + } + this._glyphBufferDataStorage.clear(); + } + _storePlacedGlyphs(e, i, r, n, s) { + const o = Math.max(r - 1, 0), a = n === nc.VIEWPORT; + let l, c, h, p, y, v, x, I, P, F, k; + for (const V of i) + l = a ? 0 : Math.max(r + UR(V.minzoom), o), c = a ? 25 : Math.min(r + UR(V.maxzoom), 25), !(c <= l) && (h = V.tl, p = V.tr, y = V.bl, v = V.br, x = V.labelAngle, I = V.minAngle, P = V.maxAngle, F = V.anchor, k = V.mosaicRect, this._glyphBufferDataStorage.has(V.page) || this._glyphBufferDataStorage.set(V.page, []), this._glyphBufferDataStorage.get(V.page).push({ glyphAnchor: [F.x, F.y], tl: [h.x, h.y], tr: [p.x, p.y], bl: [y.x, y.y], br: [v.x, v.y], xmin: k.x, ymin: k.y, xmax: k.x + k.width, ymax: k.y + k.height, labelAngle: x, minAngle: I, maxAngle: P, minLod: l, maxLod: c, placementLod: o, symbolInstance: e, ddAttributes: s })); + } + static _pushAnchors(e, i, r, n) { + r += n; + let s = 0; + const o = i.length - 1; + for (let y = 0; y < o; y++) + s += Jo.distance(i[y], i[y + 1]); + let a = n || r; + if (a *= 0.5, s <= a) + return; + const l = a / s; + let c = 0, h = -(r = s / Math.max(Math.round(s / r), 1)) / 2; + const p = i.length - 1; + for (let y = 0; y < p; y++) { + const v = i[y], x = i[y + 1], I = x.x - v.x, P = x.y - v.y, F = Math.sqrt(I * I + P * P); + let k; + for (; h + r < c + F; ) { + h += r; + const V = (h - c) / F, j = qm(v.x, x.x, V), Y = qm(v.y, x.y, V); + k === void 0 && (k = Math.atan2(P, I)), e.push(new Noe(j, Y, k, y, l)); + } + c += F; + } + } + static _pushCenterAnchor(e, i) { + let r = 0; + const n = i.length - 1; + for (let l = 0; l < n; l++) + r += Jo.distance(i[l], i[l + 1]); + const s = r / 2; + let o = 0; + const a = i.length - 1; + for (let l = 0; l < a; l++) { + const c = i[l], h = i[l + 1], p = h.x - c.x, y = h.y - c.y, v = Math.sqrt(p * p + y * y); + if (s < o + v) { + const x = (s - o) / v, I = qm(c.x, h.x, x), P = qm(c.y, h.y, x), F = Math.atan2(y, p); + return void e.push(new Noe(I, P, F, l, 0)); + } + o += v; + } + } + static _deviation(e, i, r) { + const n = (i.x - e.x) * (r.x - i.x) + (i.y - e.y) * (r.y - i.y), s = (i.x - e.x) * (r.y - i.y) - (i.y - e.y) * (r.x - i.x); + return Math.atan2(s, n); + } + static _honorsTextMaxAngle(e, i, r, n, s) { + let o = 0; + const a = r / 2; + let l = new Jo(i.x, i.y), c = i.segment + 1; + for (; o > -a; ) { + if (--c, c < 0) + return !1; + o -= Jo.distance(e[c], l), l = e[c]; + } + o += Jo.distance(e[c], e[c + 1]); + const h = []; + let p = 0; + const y = e.length; + for (; o < a; ) { + const v = e[c]; + let x, I = c; + do { + if (++I, I === y) + return !1; + x = e[I]; + } while (x.isEqual(v)); + let P, F = I; + do { + if (++F, F === y) + return !1; + P = e[F]; + } while (P.isEqual(x)); + const k = this._deviation(v, x, P); + for (h.push({ deviation: k, distToAnchor: o }), p += k; o - h[0].distToAnchor > s; ) + p -= h.shift().deviation; + if (Math.abs(p) > n) + return !1; + o += Jo.distance(x, P), c = I; + } + return !0; + } + static _smoothVertices(e, i) { + if (i <= 0) + return e; + let r = e.length; + if (r < 3) + return e; + const n = []; + let s = 0, o = 0; + n.push(0); + for (let I = 1; I < r; I++) { + const P = Jo.distance(e[I], e[I - 1]); + P > 0 && (s += P, n.push(s), o++, o !== I && (e[o] = e[I])); + } + if (r = o + 1, r < 3) + return e; + i = Math.min(i, 0.2 * s); + const a = e[0].x, l = e[0].y, c = e[r - 1].x, h = e[r - 1].y, p = Jo.sub(e[0], e[1]); + p.normalize(), e[0].x += i * p.x, e[0].y += i * p.y, p.assignSub(e[r - 1], e[r - 2]), p.normalize(), e[r - 1].x += i * p.x, e[r - 1].y += i * p.y, n[0] -= i, n[r - 1] += i; + const y = []; + y.push(new Jo(a, l)); + const v = 1e-6, x = 0.5 * i; + for (let I = 1; I < r - 1; I++) { + let P = 0, F = 0, k = 0; + for (let V = I - 1; V >= 0; V--) { + const j = x + n[V + 1] - n[I]; + if (j < 0) + break; + const Y = n[V + 1] - n[V], X = n[I] - n[V] < x ? 1 : j / Y; + if (X < v) + break; + const Q = X * X, re = X * j - 0.5 * Q * Y, he = X * Y / i, fe = e[V + 1], be = e[V].x - fe.x, Se = e[V].y - fe.y; + P += he / re * (fe.x * X * j + 0.5 * Q * (j * be - Y * fe.x) - Q * X * Y * be / 3), F += he / re * (fe.y * X * j + 0.5 * Q * (j * Se - Y * fe.y) - Q * X * Y * Se / 3), k += he; + } + for (let V = I + 1; V < r; V++) { + const j = x - n[V - 1] + n[I]; + if (j < 0) + break; + const Y = n[V] - n[V - 1], X = n[V] - n[I] < x ? 1 : j / Y; + if (X < v) + break; + const Q = X * X, re = X * j - 0.5 * Q * Y, he = X * Y / i, fe = e[V - 1], be = e[V].x - fe.x, Se = e[V].y - fe.y; + P += he / re * (fe.x * X * j + 0.5 * Q * (j * be - Y * fe.x) - Q * X * Y * be / 3), F += he / re * (fe.y * X * j + 0.5 * Q * (j * Se - Y * fe.y) - Q * X * Y * Se / 3), k += he; + } + y.push(new Jo(P / k, F / k)); + } + return y.push(new Jo(c, h)), e[0].x = a, e[0].y = l, e[r - 1].x = c, e[r - 1].y = h, y; + } + static _pushCentroid(e, i) { + const a = i.length - 1; + let l = 0, c = 0, h = 0, p = i[0].x, y = i[0].y; + p > 4096 && (p = 4096), p < 0 && (p = 0), y > 4096 && (y = 4096), y < 0 && (y = 0); + for (let v = 1; v < a; v++) { + let x = i[v].x, I = i[v].y, P = i[v + 1].x, F = i[v + 1].y; + x > 4096 && (x = 4096), x < 0 && (x = 0), I > 4096 && (I = 4096), I < 0 && (I = 0), P > 4096 && (P = 4096), P < 0 && (P = 0), F > 4096 && (F = 4096), F < 0 && (F = 0); + const k = (x - p) * (F - y) - (P - p) * (I - y); + l += k * (p + x + P), c += k * (y + I + F), h += k; + } + l /= 3 * h, c /= 3 * h, isNaN(l) || isNaN(c) || e.push(new Noe(l, c)); + } +}; +GOt._bidiEngine = new hOt(); +var XP; +(function(t) { + t[t.INITIALIZED = 0] = "INITIALIZED", t[t.NO_DATA = 1] = "NO_DATA", t[t.READY = 2] = "READY", t[t.MODIFIED = 3] = "MODIFIED", t[t.INVALID = 4] = "INVALID"; +})(XP || (XP = {})); +const Lzi = 8, Nzi = 14, kzi = 5; +let $zi = class { + constructor(e, i, r, n, s) { + if (this._pbfTiles = {}, this._tileClippers = {}, this._client = r, this._tile = i, s) { + this._styleLayerUIDs = /* @__PURE__ */ new Set(); + for (const h of s) + this._styleLayerUIDs.add(h); + } + this._styleRepository = n, this._layers = this._styleRepository?.layers ?? []; + const [o, a, l] = i.tileKey.split("/").map(parseFloat); + this._level = o; + const c = Lzi + Math.max((this._level - Nzi) * kzi, 0); + for (const h of Object.keys(e)) { + const p = e[h]; + if (this._pbfTiles[h] = new f$(new Uint8Array(p.protobuff), new DataView(p.protobuff)), p.refKey) { + const [y] = p.refKey.split("/").map(parseFloat), v = o - y; + if (v > 0) { + const x = (1 << v) - 1, I = a & x, P = l & x; + this._tileClippers[h] = new Xie(v, I, P, 8, c); + } + } + this._tileClippers[h] || (this._tileClippers[h] = new L7i()); + } + } + _canParseStyleLayer(e) { + return !this._styleLayerUIDs || this._styleLayerUIDs.has(e); + } + async parse(e) { + const i = sOt(), r = this._initialize(e), { returnedBuckets: n } = r; + this._processLayers(r), this._linkReferences(r), this._filterFeatures(r); + const s = [], o = /* @__PURE__ */ new Set(), a = (h, p) => { + o.has(h) || (s.push({ name: h, repeat: p }), o.add(h)); + }, l = {}; + for (const h of n) + h.getResources(h.tileClipper, a, l); + if (this._tile.status === XP.INVALID) + return []; + const c = this._fetchResources(s, l, e); + return Promise.all([...c, i]).then(() => this._processFeatures(r.returnedBuckets)); + } + _initialize(e) { + return { signal: e && e.signal, sourceNameToTileData: this._parseTileData(this._pbfTiles), layers: this._layers, zoom: this._level, sourceNameToTileClipper: this._tileClippers, sourceNameToUniqueSourceLayerBuckets: {}, sourceNameToUniqueSourceLayers: {}, returnedBuckets: [], layerIdToBucket: {}, referencerUIDToReferencedId: /* @__PURE__ */ new Map() }; + } + _processLayers(e) { + const { sourceNameToTileData: i, layers: r, zoom: n, sourceNameToTileClipper: s, sourceNameToUniqueSourceLayerBuckets: o, sourceNameToUniqueSourceLayers: a, returnedBuckets: l, layerIdToBucket: c, referencerUIDToReferencedId: h } = e; + for (let p = r.length - 1; p >= 0; p--) { + const y = r[p]; + if (!this._canParseStyleLayer(y.uid) || y.minzoom && n < Math.floor(y.minzoom) || y.maxzoom && n >= y.maxzoom || y.type === dl.BACKGROUND || !i[y.source] || !s[y.source]) + continue; + const v = i[y.source], x = s[y.source], I = y.sourceLayer, P = v[I]; + if (P) { + let F = a[y.source]; + if (F || (F = a[y.source] = /* @__PURE__ */ new Set()), F.add(y.sourceLayer), y.refLayerId) + h.set(y.uid, y.refLayerId); + else { + const k = this._createBucket(y); + if (k) { + k.layerUIDs = [y.uid], k.layerExtent = P.extent, k.tileClipper = x; + let V = o[y.source]; + V || (V = o[y.source] = {}); + let j = V[I]; + j || (j = V[I] = []), j.push(k), l.push(k), c[y.id] = k; + } + } + } + } + } + _linkReferences(e) { + const { layerIdToBucket: i, referencerUIDToReferencedId: r } = e; + r.forEach((n, s) => { + i[n] && i[n].layerUIDs.push(s); + }); + } + _filterFeatures(e) { + const { signal: i, sourceNameToTileData: r, sourceNameToUniqueSourceLayerBuckets: n, sourceNameToUniqueSourceLayers: s } = e, o = 10 * this._level, a = 10 * (this._level + 1), l = [], c = []; + for (const h of Object.keys(s)) + s[h].forEach((p) => { + l.push(p), c.push(h); + }); + for (let h = 0; h < l.length; h++) { + const p = c[h], y = l[h]; + if (!r[p] || !n[p]) + continue; + const v = r[p][y], x = n[p][y]; + if (!x || x.length === 0) + continue; + if (rg(i)) + return; + const I = v.getData(); + for (; I.nextTag(2); ) { + const P = I.getMessage(), F = new q7i(P, v); + P.release(); + const k = F.values; + if (k) { + const V = k._minzoom; + if (V && V >= a) + continue; + const j = k._maxzoom; + if (j && j <= o) + continue; + } + for (const V of x) + V.pushFeature(F); + } + } + } + _fetchResources(e, i, r) { + const n = [], s = this._tile.getWorkerTileHandler(); + let o, a; + e.length > 0 && (o = s.fetchSprites(e, this._client, r), n.push(o)); + for (const l in i) { + const c = i[l]; + c.size > 0 && (a = s.fetchGlyphs(this._tile.tileKey, l, c, this._client, r), n.push(a)); + } + return n; + } + _processFeatures(e) { + const i = e.filter((r) => r.hasFeatures() || this._canParseStyleLayer(r.layer.uid)); + for (const r of i) + r.processFeatures(r.tileClipper); + return i; + } + _parseTileData(e) { + const i = {}; + for (const r of Object.keys(e)) { + const n = e[r], s = {}; + for (; n.next(); ) + switch (n.tag()) { + case 3: { + const o = n.getMessage(), a = new Y7i(o); + o.release(), s[a.name] = a; + break; + } + default: + n.skip(); + } + i[r] = s; + } + return i; + } + _createBucket(e) { + switch (e.type) { + case dl.BACKGROUND: + return null; + case dl.FILL: + return this._createFillBucket(e); + case dl.LINE: + return this._createLineBucket(e); + case dl.CIRCLE: + return this._createCircleBucket(e); + case dl.SYMBOL: + return this._createSymbolBucket(e); + } + } + _createFillBucket(e) { + return new tUi(e, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new K7i(e.fillMaterial.getStride()), new yB(), new J7i(e.outlineMaterial.getStride()), new yB()); + } + _createLineBucket(e) { + return new sUi(e, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new X7i(e.lineMaterial.getStride()), new yB()); + } + _createCircleBucket(e) { + return new Q7i(e, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new Z7i(e.circleMaterial.getStride()), new yB()); + } + _createSymbolBucket(e) { + const i = this._tile; + return new GOt(e, this._level, new zQe(e.iconMaterial.getStride()), new yB(), new zQe(e.textMaterial.getStride()), new yB(), i.placementEngine, i.getWorkerTileHandler()); + } +}, Bzi = class { + constructor(e, i, r, n) { + this.status = XP.INITIALIZED, this.placementEngine = new z7i(), this.tileKey = e, this.refKeys = i, this._workerTileHandler = r, this._styleRepository = n; + } + release() { + this.tileKey = "", this.refKeys = null, this.status = XP.INITIALIZED, this._workerTileHandler = null; + } + async parse(e, i) { + const r = i && i.signal; + if (_e(r)) { + const h = () => { + r.removeEventListener("abort", h), this.status = XP.INVALID; + }; + r.addEventListener("abort", h); + } + let n; + const s = { bucketsWithData: [], emptyBuckets: null }; + try { + n = await this._parse(e, i); + } catch (h) { + if (us(h)) + throw h; + return { result: s, transferList: [] }; + } + this.status = XP.READY; + const o = s.bucketsWithData, a = []; + for (const h of n) + if (h.hasFeatures()) { + const p = h.serialize(); + o.push(p); + } else + a.push(h.layer.uid); + const l = [...o]; + let c = null; + return a.length > 0 && (c = Uint32Array.from(a), l.push(c.buffer)), s.emptyBuckets = c, { result: s, transferList: l }; + } + setObsolete() { + this.status = XP.INVALID; + } + getLayers() { + return this._workerTileHandler.getLayers(); + } + getWorkerTileHandler() { + return this._workerTileHandler; + } + async _parse(e, i) { + const r = e.sourceName2DataAndRefKey; + return Object.keys(r).length === 0 ? [] : (this.status = XP.MODIFIED, new $zi(r, this, i.client, this._styleRepository, e.styleLayerUIDs).parse(i)); + } +}, Ofe = class EX { + constructor(e) { + if (this._style = e, this.backgroundBucketIds = [], this._uidToLayer = /* @__PURE__ */ new Map(), this._layerByName = {}, this._runningId = 0, e.layers || (e.layers = []), this.version = parseFloat(e.version), this.layers = e.layers.map((i, r, n) => this._create(i, r, n)).filter((i) => !!i), this.layers) { + let i; + for (let r = 0; r < this.layers.length; r++) + i = this.layers[r], this._layerByName[i.id] = i, this._uidToLayer.set(i.uid, i), i.type === dl.BACKGROUND && this.backgroundBucketIds.push(i.id); + } + this._identifyRefLayers(); + } + isPainterDataDriven(e) { + const i = this._layerByName[e]; + return !!i && i.isPainterDataDriven(); + } + getStyleLayerId(e) { + return e >= this.layers.length ? null : this.layers[e].id; + } + getStyleLayerByUID(e) { + return this._uidToLayer.get(e) ?? null; + } + getStyleLayerIndex(e) { + const i = this._layerByName[e]; + return i ? this.layers.indexOf(i) : -1; + } + setStyleLayer(e, i) { + if (!e || !e.id) + return; + const r = this._style; + i != null && i >= this.layers.length && (i = this.layers.length - 1); + let n, s = !0; + const o = this._layerByName[e.id]; + if (o) { + const a = this.layers.indexOf(o); + i || (i = a), i === a ? (s = !1, n = EX._recreateLayer(e, o), this.layers[i] = n, r.layers[i] = e) : (this.layers.splice(a, 1), r.layers.splice(a, 1), n = this._create(e, i, this.layers), this.layers.splice(i, 0, n), r.layers.splice(i, 0, e)); + } else + n = this._create(e, i, this.layers), !i || i >= this.layers.length ? (this.layers.push(n), r.layers.push(e)) : (this.layers.splice(i, 0, n), r.layers.splice(i, 0, e)); + this._layerByName[e.id] = n, this._uidToLayer.set(n.uid, n), s && this._recomputeZValues(), this._identifyRefLayers(); + } + getStyleLayer(e) { + const i = this._layerByName[e]; + return i ? { type: i.typeName, id: i.id, source: i.source, "source-layer": i.sourceLayer, minzoom: i.minzoom, maxzoom: i.maxzoom, filter: i.filter, layout: i.layout, paint: i.paint } : null; + } + deleteStyleLayer(e) { + const i = this._layerByName[e]; + if (i) { + delete this._layerByName[e], this._uidToLayer.delete(i.uid); + const r = this.layers.indexOf(i); + this.layers.splice(r, 1), this._style.layers.splice(r, 1), this._recomputeZValues(), this._identifyRefLayers(); + } + } + getLayerById(e) { + return this._layerByName[e]; + } + getLayoutProperties(e) { + const i = this._layerByName[e]; + return i ? i.layout : null; + } + getPaintProperties(e) { + const i = this._layerByName[e]; + return i ? i.paint : null; + } + setPaintProperties(e, i) { + const r = this._layerByName[e]; + if (!r) + return; + const n = { type: r.typeName, id: r.id, source: r.source, "source-layer": r.sourceLayer, minzoom: r.minzoom, maxzoom: r.maxzoom, filter: r.filter, layout: r.layout, paint: i }, s = EX._recreateLayer(n, r), o = this.layers.indexOf(r); + this.layers[o] = s, this._style.layers[o].paint = i, this._layerByName[r.id] = s, this._uidToLayer.set(r.uid, s); + } + setLayoutProperties(e, i) { + const r = this._layerByName[e]; + if (!r) + return; + const n = { type: r.typeName, id: r.id, source: r.source, "source-layer": r.sourceLayer, minzoom: r.minzoom, maxzoom: r.maxzoom, filter: r.filter, layout: i, paint: r.paint }, s = EX._recreateLayer(n, r), o = this.layers.indexOf(r); + this.layers[o] = s, this._style.layers[o].layout = i, this._layerByName[r.id] = s, this._uidToLayer.set(r.uid, s); + } + setStyleLayerVisibility(e, i) { + const r = this._layerByName[e]; + if (!r) + return; + const n = r.layout || {}; + n.visibility = i; + const s = { type: r.typeName, id: r.id, source: r.source, "source-layer": r.sourceLayer, minzoom: r.minzoom, maxzoom: r.maxzoom, filter: r.filter, layout: n, paint: r.paint }, o = EX._recreateLayer(s, r), a = this.layers.indexOf(r); + this.layers[a] = o, this._style.layers[a].layout = n, this._layerByName[r.id] = o, this._uidToLayer.set(r.uid, o); + } + getStyleLayerVisibility(e) { + const i = this._layerByName[e]; + return i ? i.layout?.visibility ?? "visible" : "none"; + } + _recomputeZValues() { + const e = this.layers, i = 1 / (e.length + 1); + for (let r = 0; r < e.length; r++) + e[r].z = 1 - (1 + r) * i; + } + _identifyRefLayers() { + const e = [], i = []; + let r = 0; + for (const n of this.layers) { + const s = n.layout; + if (n.type === dl.FILL) { + const o = n; + let a = n.source + "|" + n.sourceLayer; + a += "|" + (s?.visibility ?? ""), a += "|" + n.minzoom, a += "|" + n.maxzoom, a += "|" + JSON.stringify(n.filter), (o.hasDataDrivenFill || o.hasDataDrivenOutline) && (a += "|" + r), e.push({ key: a, layer: n }); + } else if (n.type === dl.LINE) { + const o = n, a = n.paint, l = a != null && (a["line-pattern"] != null || a["line-dasharray"] != null); + let c = n.source + "|" + n.sourceLayer; + c += "|" + (s?.visibility ?? ""), c += "|" + n.minzoom, c += "|" + n.maxzoom, c += "|" + JSON.stringify(n.filter), c += "|" + (s !== void 0 ? s["line-cap"] : ""), c += "|" + (s !== void 0 ? s["line-join"] : ""), (o.hasDataDrivenLine || l) && (c += "|" + r), i.push({ key: c, layer: n }); + } + ++r; + } + this._assignRefLayers(e), this._assignRefLayers(i); + } + _assignRefLayers(e) { + let i, r; + e.sort((s, o) => s.key < o.key ? -1 : s.key > o.key ? 1 : 0); + const n = e.length; + for (let s = 0; s < n; s++) { + const o = e[s]; + if (o.key === i) + o.layer.refLayerId = r; + else if (i = o.key, r = o.layer.id, o.layer.type === dl.FILL) { + if (!o.layer.getPaintProperty("fill-outline-color")) + for (let a = s + 1; a < n; a++) { + const l = e[a]; + if (l.key !== i) + break; + if (l.layer.getPaintProperty("fill-outline-color")) { + e[s] = l, e[a] = o, r = l.layer.id; + break; + } + } + } else if (o.layer.type === dl.LINE) { + let a = o.layer; + for (let l = s + 1; l < n; l++) { + const c = e[l]; + if (c.key !== i) + break; + const h = c.layer; + (a.canUseThinTessellation && !h.canUseThinTessellation || !a.canUseThinTessellation && (h.getPaintProperty("line-pattern") || h.getPaintProperty("line-dasharray"))) && (a = h, e[s] = c, e[l] = o, r = c.layer.id); + } + } + } + } + _create(e, i, r) { + const n = 1 - (1 + i) * (1 / (r.length + 1)), s = this._runningId++; + switch (e.type) { + case "background": + return new net(dl.BACKGROUND, e, n, s); + case "fill": + return new set(dl.FILL, e, n, s); + case "line": + return new oet(dl.LINE, e, n, s); + case "symbol": + return new aet(dl.SYMBOL, e, n, s); + case "raster": + return console.warn(`Unsupported vector tile raster layer ${e.id}`), null; + case "circle": + return new uet(dl.CIRCLE, e, n, s); + } + return null; + } + static _recreateLayer(e, i) { + switch (e.type) { + case "background": + return new net(dl.BACKGROUND, e, i.z, i.uid); + case "fill": + return new set(dl.FILL, e, i.z, i.uid); + case "line": + return new oet(dl.LINE, e, i.z, i.uid); + case "symbol": + return new aet(dl.SYMBOL, e, i.z, i.uid); + case "raster": + return console.warn(`Unsupported vector tile raster layer ${e.id}`), null; + case "circle": + return new uet(dl.CIRCLE, e, i.z, i.uid); + } + return null; + } +}, Vzi = class { + constructor() { + this._spriteInfo = {}, this._glyphInfo = {}; + } + reset() { + return this._spriteInfo = {}, this._glyphInfo = {}, Promise.resolve(); + } + getLayers() { + return this._styleRepository?.layers ?? []; + } + async createTileAndParse(e, i) { + const { key: r } = e, n = {}; + for (const o of Object.keys(e.sourceName2DataAndRefKey)) { + const a = e.sourceName2DataAndRefKey[o]; + n[o] = a.refKey; + } + const s = new Bzi(r, n, this, this._styleRepository); + try { + return await s.parse(e, i); + } catch (o) { + if (s.setObsolete(), s.release(), !us(o)) + throw o; + return null; + } + } + updateStyle(e) { + if (!e || e.length === 0 || !this._styleRepository) + return; + const i = this._styleRepository; + for (const r of e) { + const n = r.type, s = r.data; + switch (n) { + case Tf.PAINTER_CHANGED: + i.setPaintProperties(s.layer, s.paint); + break; + case Tf.LAYOUT_CHANGED: + i.setLayoutProperties(s.layer, s.layout); + break; + case Tf.LAYER_REMOVED: + i.deleteStyleLayer(s.layer); + break; + case Tf.LAYER_CHANGED: + i.setStyleLayer(s.layer, s.index); + break; + case Tf.SPRITES_CHANGED: + this._spriteInfo = {}; + } + } + } + setStyle(e) { + this._styleRepository = new Ofe(e), this._spriteInfo = {}, this._glyphInfo = {}; + } + fetchSprites(e, i, r) { + const n = [], s = this._spriteInfo; + for (const o of e) + s[o.name] === void 0 && n.push(o); + return n.length === 0 ? Promise.resolve() : i.invoke("getSprites", n, { signal: r && r.signal }).then((o) => { + for (const a in o) { + const l = o[a]; + s[a] = l; + } + }); + } + getSpriteItems() { + return this._spriteInfo; + } + fetchGlyphs(e, i, r, n, s) { + const o = []; + let a = this._glyphInfo[i]; + return a ? r.forEach((l) => { + a[l] || o.push(l); + }) : (a = this._glyphInfo[i] = [], r.forEach((l) => o.push(l))), o.length === 0 ? Promise.resolve() : n.invoke("getGlyphs", { tileID: e, font: i, codePoints: o }, s).then((l) => { + for (let c = 0; c < l.length; c++) + l[c] && (a[c] = l[c]); + }); + } + getGlyphItems(e) { + return this._glyphInfo[e]; + } +}; +const jzi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Vzi +}, Symbol.toStringTag, { value: "Module" })); +var Rfe; +(function(t) { + t[t.PROJECT_VERTICES = 1] = "PROJECT_VERTICES"; +})(Rfe || (Rfe = {})); +var Mfe; +(function(t) { + t.GLTF_BINARY = "3D_glb", t.GLTF_JSON = "3D_gltf"; +})(Mfe || (Mfe = {})); +function Gzi(t) { + return t && t.applyEdits != null; +} +async function Uzi(t, e, i, r = {}) { + let n, s; + const o = { edits: i, result: new Promise((a, l) => { + n = a, s = l; + }) }; + t.emit("apply-edits", o); + try { + const { results: a, edits: l } = await zzi(t, e, i, r), c = (p) => p.filter((y) => !y.error).map(fi), h = { edits: l, addedFeatures: c(a.addFeatureResults), updatedFeatures: c(a.updateFeatureResults), deletedFeatures: c(a.deleteFeatureResults), addedAttachments: c(a.addAttachmentResults), updatedAttachments: c(a.updateAttachmentResults), deletedAttachments: c(a.deleteAttachmentResults), exceededTransferLimit: !1 }; + return a.editedFeatureResults?.length && (h.editedFeatures = a.editedFeatureResults), (h.addedFeatures.length || h.updatedFeatures.length || h.deletedFeatures.length || h.addedAttachments.length || h.updatedAttachments.length || h.deletedAttachments.length) && (t.emit("edits", h), RWt(t) && wft.emit("edits", { layer: t, event: h })), n(h), a; + } catch (a) { + throw s(a), a; + } +} +async function zzi(t, e, i, r) { + if (await t.load(), !Gzi(e)) + throw new ot(`${t.type}-layer:no-editing-support`, "Layer source does not support applyEdits capability", { layer: t }); + if (!Jct(t)) + throw new ot(`${t.type}-layer:editing-disabled`, "Editing is disabled for layer", { layer: t }); + const { edits: n, options: s } = await Hzi(t, i, r); + return n.addFeatures?.length || n.updateFeatures?.length || n.deleteFeatures?.length || n.addAttachments?.length || n.updateAttachments?.length || n.deleteAttachments?.length ? { edits: n, results: await e.applyEdits(n, s) } : { edits: n, results: { addFeatureResults: [], updateFeatureResults: [], deleteFeatureResults: [], addAttachmentResults: [], updateAttachmentResults: [], deleteAttachmentResults: [] } }; +} +async function Hzi(t, e, i) { + const r = e && (e.addFeatures || e.updateFeatures || e.deleteFeatures), n = e && (e.addAttachments || e.updateAttachments || e.deleteAttachments), s = _e(t.infoFor3D); + if (!e || !r && !n) + throw new ot(`${t.type}-layer:missing-parameters`, "'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required"); + const o = v6(t); + if (!o.data.isVersioned && i?.gdbVersion) + throw new ot(`${t.type}-layer:invalid-parameter`, "'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'"); + if (!o.editing.supportsRollbackOnFailure && i?.rollbackOnFailureEnabled) + throw new ot(`${t.type}-layer:invalid-parameter`, "This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'"); + if (!o.editing.supportsGlobalId && i?.globalIdUsed) + throw new ot(`${t.type}-layer:invalid-parameter`, "This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'"); + if (!o.editing.supportsGlobalId && n) + throw new ot(`${t.type}-layer:invalid-parameter`, "'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'"); + if (!i?.globalIdUsed && n) + throw new ot(`${t.type}-layer:invalid-parameter`, "When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true"); + const a = { ...i }; + if (a.rollbackOnFailureEnabled != null || o.editing.supportsRollbackOnFailure || (a.rollbackOnFailureEnabled = !0), a.rollbackOnFailureEnabled === !1 && a.returnServiceEditsOption === "original-and-current-features") + throw new ot(`${t.type}-layer:invalid-parameter`, "'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true."); + if (!o.editing.supportsReturnServiceEditsInSourceSpatialReference && a.returnServiceEditsInSourceSR) + throw new ot(`${t.type}-layer:invalid-parameter`, "This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'"); + if (a.returnServiceEditsInSourceSR && a.returnServiceEditsOption !== "original-and-current-features") + throw new ot(`${t.type}-layer:invalid-parameter`, "'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'"); + const l = { ...e }; + if (l.addFeatures = e && gr.isCollection(e.addFeatures) ? e.addFeatures.toArray() : l.addFeatures || [], l.updateFeatures = e && gr.isCollection(e.updateFeatures) ? e.updateFeatures.toArray() : l.updateFeatures || [], l.deleteFeatures = e && gr.isCollection(e.deleteFeatures) ? e.deleteFeatures.toArray() : l.deleteFeatures || [], l.addFeatures.length && !o.operations.supportsAdd) + throw new ot(`${t.type}-layer:unsupported-operation`, "Layer does not support adding features."); + if (l.updateFeatures.length && !o.operations.supportsUpdate) + throw new ot(`${t.type}-layer:unsupported-operation`, "Layer does not support updating features."); + if (l.deleteFeatures.length && !o.operations.supportsDelete) + throw new ot(`${t.type}-layer:unsupported-operation`, "Layer does not support deleting features."); + l.addAttachments = l.addAttachments || [], l.updateAttachments = l.updateAttachments || [], l.deleteAttachments = l.deleteAttachments || [], l.addFeatures = l.addFeatures.map(det), l.updateFeatures = l.updateFeatures.map(det), l.addAssets = []; + const c = i?.globalIdUsed || s; + return l.addFeatures.forEach((h) => Wzi(h, t, c)), l.updateFeatures.forEach((h) => Yzi(h, t, c)), l.deleteFeatures.forEach((h) => qzi(h, t, c)), l.addAttachments.forEach((h) => het(h, t)), l.updateAttachments.forEach((h) => het(h, t)), s && await Kzi(l, t), { edits: await Xzi(l), options: a }; +} +function K8e(t, e, i) { + if (i) { + if ("attributes" in t && !t.attributes[e.globalIdField]) + throw new ot(`${e.type}-layer:invalid-parameter`, "Feature should have 'globalId' when 'globalIdUsed' is true"); + if (!("attributes" in t) && !t.globalId) + throw new ot(`${e.type}-layer:invalid-parameter`, "'globalId' of the feature should be passed when 'globalIdUsed' is true"); + } + if ("geometry" in t && _e(t.geometry)) { + if (t.geometry.hasZ && e.capabilities?.data.supportsZ === !1) + throw new ot(`${e.type}-layer:z-unsupported`, "Layer does not support z values while feature has z values."); + if (t.geometry.hasM && e.capabilities?.data.supportsM === !1) + throw new ot(`${e.type}-layer:m-unsupported`, "Layer does not support m values while feature has m values."); + } +} +function Wzi(t, e, i) { + K8e(t, e, i); +} +function qzi(t, e, i) { + K8e(t, e, i); +} +function Yzi(t, e, i) { + K8e(t, e, i); + const r = v6(e); + if ("geometry" in t && _e(t.geometry) && !r?.editing.supportsGeometryUpdate) + throw new ot(`${e.type}-layer:unsupported-operation`, "Layer does not support geometry updates."); +} +function het(t, e) { + const { feature: i, attachment: r } = t; + if (!i || "attributes" in i && !i.attributes[e.globalIdField]) + throw new ot(`${e.type}-layer:invalid-parameter`, "Attachment should have reference to a feature with 'globalId'"); + if (!("attributes" in i) && !i.globalId) + throw new ot(`${e.type}-layer:invalid-parameter`, "Attachment should have reference to 'globalId' of the parent feature"); + if (!r.globalId) + throw new ot(`${e.type}-layer:invalid-parameter`, "Attachment should have 'globalId'"); + if (!r.data && !r.uploadId) + throw new ot(`${e.type}-layer:invalid-parameter`, "Attachment should have 'data' or 'uploadId'"); + if (!(r.data instanceof File && r.data.name) && !r.name) + throw new ot(`${e.type}-layer:invalid-parameter`, "'name' is required when attachment is specified as Base64 encoded string using 'data'"); + if (!e.capabilities?.editing.supportsUploadWithItemId && r.uploadId) + throw new ot(`${e.type}-layer:invalid-parameter`, "This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'"); + if (typeof r.data == "string") { + const n = CF(r.data); + if (n && !n.isBase64) + throw new ot(`${e.type}-layer:invalid-parameter`, "Attachment 'data' should be a Blob, File or Base64 encoded string"); + } +} +async function Xzi(t) { + const e = t.addFeatures ?? [], i = t.updateFeatures ?? [], r = e.concat(i).map((a) => a.geometry), n = await Nv(r), s = e.length, o = i.length; + return n.slice(0, s).forEach((a, l) => e[l].geometry = a), n.slice(s, s + o).forEach((a, l) => i[l].geometry = a), t; +} +function det(t) { + const e = new ro(); + return t.attributes || (t.attributes = {}), e.geometry = t.geometry, e.attributes = t.attributes, e; +} +async function Kzi(t, e) { + if (ut(e.infoFor3D)) + return; + const { infoFor3D: i } = e; + let r = !1; + for (const o of i.editFormats) + if (o === Mfe.GLTF_BINARY) { + r = !0; + break; + } + const n = []; + for (const o of t.addFeatures ?? []) + n.push(pet(o, t, e, r)); + for (const o of t.updateFeatures ?? []) + n.push(pet(o, t, e, r)); + const s = await Promise.allSettled(n); + for (const o of s) + if (o.status === "rejected") + throw o.reason; +} +async function pet(t, e, i, r) { + if (ut(t.geometry) || t.geometry.type !== "mesh") + return; + const n = t.geometry, s = i.globalIdField; + if (_e(i.parsedUrl) && _e(n.external) && Array.isArray(n.external.source) && n.external.source.length === 1 && "source" in n.external.source[0] && typeof n.external.source[0].source == "string" && n.external.source[0].source.startsWith(i.parsedUrl.path)) + return; + if (!r) + throw new ot(`${i.type}-layer:binary-gltf-asset-not-supported`, "3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry."); + const o = await n.toBinaryGLTF({ ignoreLocalTransform: !0 }), a = await o.buffer(), l = `{${Vz()}}`, c = `${l}.glb`; + e.addAssets?.push({ featureGlobalId: t.getAttribute(s), assetMapGlobalId: l, assetName: c, flags: _e(n.transform) && n.transform.geographic ? Rfe.PROJECT_VERTICES : 0, data: a.data, mimeType: a.type, assetType: Mfe.GLTF_BINARY, feature: t }); +} +const J8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + applyEdits: Uzi +}, Symbol.toStringTag, { value: "Module" })); +function Jzi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var fet, uq, met, Dfe = {}; +fet = { get exports() { + return Dfe; +}, set exports(t) { + Dfe = t; +} }, uq = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0, typeof __filename < "u" && (uq = uq || __filename), met = function(t) { + var e, i; + (t = (t = t || {}) !== void 0 ? t : {}).ready = new Promise(function(Ot, Bi) { + e = Ot, i = Bi; + }); + var r, n, s, o = Object.assign({}, t), a = "./this.program", l = typeof window == "object", c = typeof importScripts == "function", h = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", p = ""; + function y(Ot) { + return t.locateFile ? t.locateFile(Ot, p) : p + Ot; + } + if (h) { + var v = require("fs"), x = require("path"); + p = c ? x.dirname(p) + "/" : __dirname + "/", r = (Ot, Bi) => (Ot = wt(Ot) ? new URL(Ot) : x.normalize(Ot), v.readFileSync(Ot, Bi ? void 0 : "utf8")), s = (Ot) => { + var Bi = r(Ot, !0); + return Bi.buffer || (Bi = new Uint8Array(Bi)), Bi; + }, n = (Ot, Bi, Mr) => { + Ot = wt(Ot) ? new URL(Ot) : x.normalize(Ot), v.readFile(Ot, function(zn, xs) { + zn ? Mr(zn) : Bi(xs.buffer); + }); + }, process.argv.length > 1 && (a = process.argv[1].replace(/\\/g, "/")), process.argv.slice(2), process.on("uncaughtException", function(Ot) { + if (!(Ot instanceof gt)) + throw Ot; + }), process.on("unhandledRejection", function(Ot) { + throw Ot; + }), t.inspect = function() { + return "[Emscripten Module object]"; + }; + } else + (l || c) && (c ? p = self.location.href : typeof document < "u" && document.currentScript && (p = document.currentScript.src), uq && (p = uq), p = p.indexOf("blob:") !== 0 ? p.substr(0, p.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", r = (Ot) => { + var Bi = new XMLHttpRequest(); + return Bi.open("GET", Ot, !1), Bi.send(null), Bi.responseText; + }, c && (s = (Ot) => { + var Bi = new XMLHttpRequest(); + return Bi.open("GET", Ot, !1), Bi.responseType = "arraybuffer", Bi.send(null), new Uint8Array(Bi.response); + }), n = (Ot, Bi, Mr) => { + var zn = new XMLHttpRequest(); + zn.open("GET", Ot, !0), zn.responseType = "arraybuffer", zn.onload = () => { + zn.status == 200 || zn.status == 0 && zn.response ? Bi(zn.response) : Mr(); + }, zn.onerror = Mr, zn.send(null); + }); + var I, P, F = t.print || console.log.bind(console), k = t.printErr || console.warn.bind(console); + Object.assign(t, o), o = null, t.arguments && t.arguments, t.thisProgram && (a = t.thisProgram), t.quit && t.quit, t.wasmBinary && (I = t.wasmBinary), t.noExitRuntime, typeof WebAssembly != "object" && nt("no native wasm support detected"); + var V = !1; + function j(Ot, Bi) { + Ot || nt(Bi); + } + var Y, X, Q, re, he, fe, be, Se, Me = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0; + function ke(Ot, Bi, Mr) { + for (var zn = Bi + Mr, xs = Bi; Ot[xs] && !(xs >= zn); ) + ++xs; + if (xs - Bi > 16 && Ot.buffer && Me) + return Me.decode(Ot.subarray(Bi, xs)); + for (var Ss = ""; Bi < xs; ) { + var da = Ot[Bi++]; + if (128 & da) { + var qa = 63 & Ot[Bi++]; + if ((224 & da) != 192) { + var hg = 63 & Ot[Bi++]; + if ((da = (240 & da) == 224 ? (15 & da) << 12 | qa << 6 | hg : (7 & da) << 18 | qa << 12 | hg << 6 | 63 & Ot[Bi++]) < 65536) + Ss += String.fromCharCode(da); + else { + var By = da - 65536; + Ss += String.fromCharCode(55296 | By >> 10, 56320 | 1023 & By); + } + } else + Ss += String.fromCharCode((31 & da) << 6 | qa); + } else + Ss += String.fromCharCode(da); + } + return Ss; + } + function J(Ot, Bi) { + return Ot ? ke(Q, Ot, Bi) : ""; + } + function ce(Ot, Bi, Mr, zn) { + if (!(zn > 0)) + return 0; + for (var xs = Mr, Ss = Mr + zn - 1, da = 0; da < Ot.length; ++da) { + var qa = Ot.charCodeAt(da); + if (qa >= 55296 && qa <= 57343 && (qa = 65536 + ((1023 & qa) << 10) | 1023 & Ot.charCodeAt(++da)), qa <= 127) { + if (Mr >= Ss) + break; + Bi[Mr++] = qa; + } else if (qa <= 2047) { + if (Mr + 1 >= Ss) + break; + Bi[Mr++] = 192 | qa >> 6, Bi[Mr++] = 128 | 63 & qa; + } else if (qa <= 65535) { + if (Mr + 2 >= Ss) + break; + Bi[Mr++] = 224 | qa >> 12, Bi[Mr++] = 128 | qa >> 6 & 63, Bi[Mr++] = 128 | 63 & qa; + } else { + if (Mr + 3 >= Ss) + break; + Bi[Mr++] = 240 | qa >> 18, Bi[Mr++] = 128 | qa >> 12 & 63, Bi[Mr++] = 128 | qa >> 6 & 63, Bi[Mr++] = 128 | 63 & qa; + } + } + return Bi[Mr] = 0, Mr - xs; + } + function xe(Ot) { + for (var Bi = 0, Mr = 0; Mr < Ot.length; ++Mr) { + var zn = Ot.charCodeAt(Mr); + zn <= 127 ? Bi++ : zn <= 2047 ? Bi += 2 : zn >= 55296 && zn <= 57343 ? (Bi += 4, ++Mr) : Bi += 3; + } + return Bi; + } + function Pe(Ot) { + Y = Ot, t.HEAP8 = X = new Int8Array(Ot), t.HEAP16 = re = new Int16Array(Ot), t.HEAP32 = he = new Int32Array(Ot), t.HEAPU8 = Q = new Uint8Array(Ot), t.HEAPU16 = new Uint16Array(Ot), t.HEAPU32 = fe = new Uint32Array(Ot), t.HEAPF32 = be = new Float32Array(Ot), t.HEAPF64 = Se = new Float64Array(Ot); + } + t.INITIAL_MEMORY; + var Oe = [], Re = [], Ge = []; + function je() { + if (t.preRun) + for (typeof t.preRun == "function" && (t.preRun = [t.preRun]); t.preRun.length; ) + tt(t.preRun.shift()); + Ne(Oe); + } + function et() { + Ne(Re); + } + function Qe() { + if (t.postRun) + for (typeof t.postRun == "function" && (t.postRun = [t.postRun]); t.postRun.length; ) + Mt(t.postRun.shift()); + Ne(Ge); + } + function tt(Ot) { + Oe.unshift(Ot); + } + function ft(Ot) { + Re.unshift(Ot); + } + function Mt(Ot) { + Ge.unshift(Ot); + } + var kt = 0, Tt = null; + function It(Ot) { + kt++, t.monitorRunDependencies && t.monitorRunDependencies(kt); + } + function Nt(Ot) { + if (kt--, t.monitorRunDependencies && t.monitorRunDependencies(kt), kt == 0 && Tt) { + var Bi = Tt; + Tt = null, Bi(); + } + } + function nt(Ot) { + t.onAbort && t.onAbort(Ot), k(Ot = "Aborted(" + Ot + ")"), V = !0, Ot += ". Build with -sASSERTIONS for more info."; + var Bi = new WebAssembly.RuntimeError(Ot); + throw i(Bi), Bi; + } + var Ee, Be = "data:application/octet-stream;base64,"; + function at(Ot) { + return Ot.startsWith(Be); + } + function wt(Ot) { + return Ot.startsWith("file://"); + } + function st(Ot) { + try { + if (Ot == Ee && I) + return new Uint8Array(I); + if (s) + return s(Ot); + throw "both async and sync fetching of the wasm failed"; + } catch (Bi) { + nt(Bi); + } + } + function le() { + if (!I && (l || c)) { + if (typeof fetch == "function" && !wt(Ee)) + return fetch(Ee, { credentials: "same-origin" }).then(function(Ot) { + if (!Ot.ok) + throw "failed to load wasm binary file at '" + Ee + "'"; + return Ot.arrayBuffer(); + }).catch(function() { + return st(Ee); + }); + if (n) + return new Promise(function(Ot, Bi) { + n(Ee, function(Mr) { + Ot(new Uint8Array(Mr)); + }, Bi); + }); + } + return Promise.resolve().then(function() { + return st(Ee); + }); + } + function ct() { + var Ot = { a: Xt }; + function Bi(Ss, da) { + var qa = Ss.exports; + t.asm = qa, Pe((P = t.asm.t).buffer), t.asm.Yb, ft(t.asm.u), Nt(); + } + function Mr(Ss) { + Bi(Ss.instance); + } + function zn(Ss) { + return le().then(function(da) { + return WebAssembly.instantiate(da, Ot); + }).then(function(da) { + return da; + }).then(Ss, function(da) { + k("failed to asynchronously prepare wasm: " + da), nt(da); + }); + } + function xs() { + return I || typeof WebAssembly.instantiateStreaming != "function" || at(Ee) || wt(Ee) || h || typeof fetch != "function" ? zn(Mr) : fetch(Ee, { credentials: "same-origin" }).then(function(Ss) { + return WebAssembly.instantiateStreaming(Ss, Ot).then(Mr, function(da) { + return k("wasm streaming compile failed: " + da), k("falling back to ArrayBuffer instantiation"), zn(Mr); + }); + }); + } + if (It(), t.instantiateWasm) + try { + return t.instantiateWasm(Ot, Bi); + } catch (Ss) { + k("Module.instantiateWasm callback failed with error: " + Ss), i(Ss); + } + return xs().catch(i), {}; + } + function gt(Ot) { + this.name = "ExitStatus", this.message = "Program terminated with exit(" + Ot + ")", this.status = Ot; + } + function Ne(Ot) { + for (; Ot.length > 0; ) + Ot.shift()(t); + } + function pe(Ot, Bi = "i8") { + switch (Bi.endsWith("*") && (Bi = "*"), Bi) { + case "i1": + case "i8": + return X[Ot >> 0]; + case "i16": + return re[Ot >> 1]; + case "i32": + case "i64": + return he[Ot >> 2]; + case "float": + return be[Ot >> 2]; + case "double": + return Se[Ot >> 3]; + case "*": + return fe[Ot >> 2]; + default: + nt("invalid type for getValue: " + Bi); + } + return null; + } + function Ae(Ot, Bi, Mr) { + return 0; + } + function it(Ot, Bi, Mr) { + } + function yt(Ot, Bi, Mr) { + return 0; + } + function He(Ot, Bi, Mr, zn) { + } + function Ft(Ot) { + } + function ei(Ot, Bi) { + } + function mt(Ot, Bi, Mr) { + } + function Ue(Ot) { + return fe[Ot >> 2] + 4294967296 * he[Ot + 4 >> 2]; + } + function si(Ot) { + return Ot % 4 == 0 && (Ot % 100 != 0 || Ot % 400 == 0); + } + at(Ee = "pe-wasm.wasm") || (Ee = y(Ee)); + var A = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335], ve = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + function H(Ot) { + return (si(Ot.getFullYear()) ? A : ve)[Ot.getMonth()] + Ot.getDate() - 1; + } + function T(Ot, Bi) { + var Mr = new Date(1e3 * Ue(Ot)); + he[Bi >> 2] = Mr.getSeconds(), he[Bi + 4 >> 2] = Mr.getMinutes(), he[Bi + 8 >> 2] = Mr.getHours(), he[Bi + 12 >> 2] = Mr.getDate(), he[Bi + 16 >> 2] = Mr.getMonth(), he[Bi + 20 >> 2] = Mr.getFullYear() - 1900, he[Bi + 24 >> 2] = Mr.getDay(); + var zn = 0 | H(Mr); + he[Bi + 28 >> 2] = zn, he[Bi + 36 >> 2] = -60 * Mr.getTimezoneOffset(); + var xs = new Date(Mr.getFullYear(), 0, 1), Ss = new Date(Mr.getFullYear(), 6, 1).getTimezoneOffset(), da = xs.getTimezoneOffset(), qa = 0 | (Ss != da && Mr.getTimezoneOffset() == Math.min(da, Ss)); + he[Bi + 32 >> 2] = qa; + } + function b(Ot) { + var Bi = xe(Ot) + 1, Mr = lt(Bi); + return Mr && ce(Ot, X, Mr, Bi), Mr; + } + function m(Ot, Bi, Mr) { + var zn = (/* @__PURE__ */ new Date()).getFullYear(), xs = new Date(zn, 0, 1), Ss = new Date(zn, 6, 1), da = xs.getTimezoneOffset(), qa = Ss.getTimezoneOffset(), hg = Math.max(da, qa); + function By(rt) { + var Xl = rt.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return Xl ? Xl[1] : "GMT"; + } + fe[Ot >> 2] = 60 * hg, he[Bi >> 2] = +(da != qa); + var ff = By(xs), kf = By(Ss), up = b(ff), YI = b(kf); + qa < da ? (fe[Mr >> 2] = up, fe[Mr + 4 >> 2] = YI) : (fe[Mr >> 2] = YI, fe[Mr + 4 >> 2] = up); + } + function _() { + nt(""); + } + function C() { + return Date.now(); + } + function D(Ot, Bi, Mr) { + Q.copyWithin(Ot, Bi, Bi + Mr); + } + function L() { + return 2147483648; + } + function B(Ot) { + try { + return P.grow(Ot - Y.byteLength + 65535 >>> 16), Pe(P.buffer), 1; + } catch { + } + } + function q(Ot) { + var Bi = Q.length; + Ot >>>= 0; + var Mr = L(); + if (Ot > Mr) + return !1; + let zn = (da, qa) => da + (qa - da % qa) % qa; + for (var xs = 1; xs <= 4; xs *= 2) { + var Ss = Bi * (1 + 0.2 / xs); + if (Ss = Math.min(Ss, Ot + 100663296), B(Math.min(Mr, zn(Math.max(Ot, Ss), 65536)))) + return !0; + } + return !1; + } + var Z = {}; + function ie() { + return a || "./this.program"; + } + function se() { + if (!se.strings) { + var Ot = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: ie() }; + for (var Bi in Z) + Z[Bi] === void 0 ? delete Ot[Bi] : Ot[Bi] = Z[Bi]; + var Mr = []; + for (var Bi in Ot) + Mr.push(Bi + "=" + Ot[Bi]); + se.strings = Mr; + } + return se.strings; + } + function de(Ot, Bi, Mr) { + for (var zn = 0; zn < Ot.length; ++zn) + X[Bi++ >> 0] = Ot.charCodeAt(zn); + Mr || (X[Bi >> 0] = 0); + } + function Ce(Ot, Bi) { + var Mr = 0; + return se().forEach(function(zn, xs) { + var Ss = Bi + Mr; + fe[Ot + 4 * xs >> 2] = Ss, de(zn, Ss), Mr += zn.length + 1; + }), 0; + } + function Ve(Ot, Bi) { + var Mr = se(); + fe[Ot >> 2] = Mr.length; + var zn = 0; + return Mr.forEach(function(xs) { + zn += xs.length + 1; + }), fe[Bi >> 2] = zn, 0; + } + function Je(Ot) { + return 52; + } + function Pt(Ot, Bi, Mr, zn) { + return 52; + } + function $t(Ot, Bi, Mr, zn, xs) { + return 70; + } + var qe = [null, [], []]; + function Rt(Ot, Bi) { + var Mr = qe[Ot]; + Bi === 0 || Bi === 10 ? ((Ot === 1 ? F : k)(ke(Mr, 0)), Mr.length = 0) : Mr.push(Bi); + } + function Zt(Ot, Bi, Mr, zn) { + for (var xs = 0, Ss = 0; Ss < Mr; Ss++) { + var da = fe[Bi >> 2], qa = fe[Bi + 4 >> 2]; + Bi += 8; + for (var hg = 0; hg < qa; hg++) + Rt(Ot, Q[da + hg]); + xs += qa; + } + return fe[zn >> 2] = xs, 0; + } + function Jt(Ot, Bi, Mr) { + var zn = Mr > 0 ? Mr : xe(Ot) + 1, xs = new Array(zn), Ss = ce(Ot, xs, 0, xs.length); + return Bi && (xs.length = Ss), xs; + } + var Xt = { c: Ae, p: it, f: yt, d: He, n: Ft, m: ei, o: mt, h: T, i: m, k: _, g: C, s: D, l: q, q: Ce, r: Ve, a: Je, e: Pt, j: $t, b: Zt }; + ct(), t.___wasm_call_ctors = function() { + return (t.___wasm_call_ctors = t.asm.u).apply(null, arguments); + }; + var Qt = t._emscripten_bind_PeObject_getCode_0 = function() { + return (Qt = t._emscripten_bind_PeObject_getCode_0 = t.asm.v).apply(null, arguments); + }, bi = t._emscripten_bind_PeObject_getName_1 = function() { + return (bi = t._emscripten_bind_PeObject_getName_1 = t.asm.w).apply(null, arguments); + }, Mi = t._emscripten_bind_PeObject_getType_0 = function() { + return (Mi = t._emscripten_bind_PeObject_getType_0 = t.asm.x).apply(null, arguments); + }, Ri = t._emscripten_bind_PeCoordsys_getCode_0 = function() { + return (Ri = t._emscripten_bind_PeCoordsys_getCode_0 = t.asm.y).apply(null, arguments); + }, Yi = t._emscripten_bind_PeCoordsys_getName_1 = function() { + return (Yi = t._emscripten_bind_PeCoordsys_getName_1 = t.asm.z).apply(null, arguments); + }, rr = t._emscripten_bind_PeCoordsys_getType_0 = function() { + return (rr = t._emscripten_bind_PeCoordsys_getType_0 = t.asm.A).apply(null, arguments); + }, _i = t._emscripten_bind_VoidPtr___destroy___0 = function() { + return (_i = t._emscripten_bind_VoidPtr___destroy___0 = t.asm.B).apply(null, arguments); + }, fn = t._emscripten_bind_PeDatum_getSpheroid_0 = function() { + return (fn = t._emscripten_bind_PeDatum_getSpheroid_0 = t.asm.C).apply(null, arguments); + }, jr = t._emscripten_bind_PeDatum_getCode_0 = function() { + return (jr = t._emscripten_bind_PeDatum_getCode_0 = t.asm.D).apply(null, arguments); + }, no = t._emscripten_bind_PeDatum_getName_1 = function() { + return (no = t._emscripten_bind_PeDatum_getName_1 = t.asm.E).apply(null, arguments); + }, $r = t._emscripten_bind_PeDatum_getType_0 = function() { + return ($r = t._emscripten_bind_PeDatum_getType_0 = t.asm.F).apply(null, arguments); + }, Zn = t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0 = function() { + return (Zn = t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0 = t.asm.G).apply(null, arguments); + }, bs = t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0 = function() { + return (bs = t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0 = t.asm.H).apply(null, arguments); + }, On = t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0 = function() { + return (On = t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0 = t.asm.I).apply(null, arguments); + }, Jn = t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0 = function() { + return (Jn = t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0 = t.asm.J).apply(null, arguments); + }, ki = t._emscripten_bind_PeDefs_get_PE_DD_MAX_0 = function() { + return (ki = t._emscripten_bind_PeDefs_get_PE_DD_MAX_0 = t.asm.K).apply(null, arguments); + }, Ur = t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0 = function() { + return (Ur = t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0 = t.asm.L).apply(null, arguments); + }, So = t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0 = function() { + return (So = t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0 = t.asm.M).apply(null, arguments); + }, Cn = t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0 = function() { + return (Cn = t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0 = t.asm.N).apply(null, arguments); + }, Ki = t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0 = function() { + return (Ki = t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0 = t.asm.O).apply(null, arguments); + }, ui = t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0 = function() { + return (ui = t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0 = t.asm.P).apply(null, arguments); + }, W = t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0 = function() { + return (W = t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0 = t.asm.Q).apply(null, arguments); + }, Cr = t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0 = function() { + return (Cr = t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0 = t.asm.R).apply(null, arguments); + }, ia = t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0 = function() { + return (ia = t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0 = t.asm.S).apply(null, arguments); + }, Ho = t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0 = function() { + return (Ho = t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0 = t.asm.T).apply(null, arguments); + }, Ut = t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0 = function() { + return (Ut = t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0 = t.asm.U).apply(null, arguments); + }, Ca = t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0 = function() { + return (Ca = t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0 = t.asm.V).apply(null, arguments); + }, xi = t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0 = function() { + return (xi = t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0 = t.asm.W).apply(null, arguments); + }, _t = t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0 = function() { + return (_t = t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0 = t.asm.X).apply(null, arguments); + }, Fr = t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0 = function() { + return (Fr = t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0 = t.asm.Y).apply(null, arguments); + }, ln = t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0 = function() { + return (ln = t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0 = t.asm.Z).apply(null, arguments); + }, kn = t._emscripten_bind_PeDefs_get_PE_PARM_X0_0 = function() { + return (kn = t._emscripten_bind_PeDefs_get_PE_PARM_X0_0 = t.asm._).apply(null, arguments); + }, Un = t._emscripten_bind_PeDefs_get_PE_PARM_ND_0 = function() { + return (Un = t._emscripten_bind_PeDefs_get_PE_PARM_ND_0 = t.asm.$).apply(null, arguments); + }, Cs = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0 = function() { + return (Cs = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0 = t.asm.aa).apply(null, arguments); + }, ra = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0 = function() { + return (ra = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0 = t.asm.ba).apply(null, arguments); + }, yn = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0 = function() { + return (yn = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0 = t.asm.ca).apply(null, arguments); + }, Io = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0 = function() { + return (Io = t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0 = t.asm.da).apply(null, arguments); + }, oh = t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0 = function() { + return (oh = t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0 = t.asm.ea).apply(null, arguments); + }, gh = t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0 = function() { + return (gh = t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0 = t.asm.fa).apply(null, arguments); + }, vc = t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0 = function() { + return (vc = t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0 = t.asm.ga).apply(null, arguments); + }, qu = t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0 = function() { + return (qu = t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0 = t.asm.ha).apply(null, arguments); + }, ss = t._emscripten_bind_PeFactory_initialize_1 = function() { + return (ss = t._emscripten_bind_PeFactory_initialize_1 = t.asm.ia).apply(null, arguments); + }, dd = t._emscripten_bind_PeFactory_factoryByType_2 = function() { + return (dd = t._emscripten_bind_PeFactory_factoryByType_2 = t.asm.ja).apply(null, arguments); + }, Vd = t._emscripten_bind_PeFactory_fromString_2 = function() { + return (Vd = t._emscripten_bind_PeFactory_fromString_2 = t.asm.ka).apply(null, arguments); + }, pd = t._emscripten_bind_PeFactory_getCode_1 = function() { + return (pd = t._emscripten_bind_PeFactory_getCode_1 = t.asm.la).apply(null, arguments); + }, cs = t._emscripten_bind_PeGCSExtent_PeGCSExtent_6 = function() { + return (cs = t._emscripten_bind_PeGCSExtent_PeGCSExtent_6 = t.asm.ma).apply(null, arguments); + }, Nl = t._emscripten_bind_PeGCSExtent_getLLon_0 = function() { + return (Nl = t._emscripten_bind_PeGCSExtent_getLLon_0 = t.asm.na).apply(null, arguments); + }, ii = t._emscripten_bind_PeGCSExtent_getSLat_0 = function() { + return (ii = t._emscripten_bind_PeGCSExtent_getSLat_0 = t.asm.oa).apply(null, arguments); + }, bt = t._emscripten_bind_PeGCSExtent_getRLon_0 = function() { + return (bt = t._emscripten_bind_PeGCSExtent_getRLon_0 = t.asm.pa).apply(null, arguments); + }, Kt = t._emscripten_bind_PeGCSExtent_getNLat_0 = function() { + return (Kt = t._emscripten_bind_PeGCSExtent_getNLat_0 = t.asm.qa).apply(null, arguments); + }, Pi = t._emscripten_bind_PeGCSExtent___destroy___0 = function() { + return (Pi = t._emscripten_bind_PeGCSExtent___destroy___0 = t.asm.ra).apply(null, arguments); + }, Sr = t._emscripten_bind_PeGeogcs_getDatum_0 = function() { + return (Sr = t._emscripten_bind_PeGeogcs_getDatum_0 = t.asm.sa).apply(null, arguments); + }, Tr = t._emscripten_bind_PeGeogcs_getPrimem_0 = function() { + return (Tr = t._emscripten_bind_PeGeogcs_getPrimem_0 = t.asm.ta).apply(null, arguments); + }, ri = t._emscripten_bind_PeGeogcs_getUnit_0 = function() { + return (ri = t._emscripten_bind_PeGeogcs_getUnit_0 = t.asm.ua).apply(null, arguments); + }, pi = t._emscripten_bind_PeGeogcs_getCode_0 = function() { + return (pi = t._emscripten_bind_PeGeogcs_getCode_0 = t.asm.va).apply(null, arguments); + }, mi = t._emscripten_bind_PeGeogcs_getName_1 = function() { + return (mi = t._emscripten_bind_PeGeogcs_getName_1 = t.asm.wa).apply(null, arguments); + }, hr = t._emscripten_bind_PeGeogcs_getType_0 = function() { + return (hr = t._emscripten_bind_PeGeogcs_getType_0 = t.asm.xa).apply(null, arguments); + }, Lr = t._emscripten_bind_PeGeogtran_isEqual_1 = function() { + return (Lr = t._emscripten_bind_PeGeogtran_isEqual_1 = t.asm.ya).apply(null, arguments); + }, wr = t._emscripten_bind_PeGeogtran_getGeogcs1_0 = function() { + return (wr = t._emscripten_bind_PeGeogtran_getGeogcs1_0 = t.asm.za).apply(null, arguments); + }, Nr = t._emscripten_bind_PeGeogtran_getGeogcs2_0 = function() { + return (Nr = t._emscripten_bind_PeGeogtran_getGeogcs2_0 = t.asm.Aa).apply(null, arguments); + }, _r = t._emscripten_bind_PeGeogtran_getParameters_0 = function() { + return (_r = t._emscripten_bind_PeGeogtran_getParameters_0 = t.asm.Ba).apply(null, arguments); + }, Tn = t._emscripten_bind_PeGeogtran_loadConstants_0 = function() { + return (Tn = t._emscripten_bind_PeGeogtran_loadConstants_0 = t.asm.Ca).apply(null, arguments); + }, os = t._emscripten_bind_PeGeogtran_getCode_0 = function() { + return (os = t._emscripten_bind_PeGeogtran_getCode_0 = t.asm.Da).apply(null, arguments); + }, fs = t._emscripten_bind_PeGeogtran_getName_1 = function() { + return (fs = t._emscripten_bind_PeGeogtran_getName_1 = t.asm.Ea).apply(null, arguments); + }, di = t._emscripten_bind_PeGeogtran_getType_0 = function() { + return (di = t._emscripten_bind_PeGeogtran_getType_0 = t.asm.Fa).apply(null, arguments); + }, nr = t._emscripten_bind_PeGTlistExtended_getGTlist_6 = function() { + return (nr = t._emscripten_bind_PeGTlistExtended_getGTlist_6 = t.asm.Ga).apply(null, arguments); + }, fr = t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0 = function() { + return (fr = t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0 = t.asm.Ha).apply(null, arguments); + }, Zr = t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0 = function() { + return (Zr = t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0 = t.asm.Ia).apply(null, arguments); + }, er = t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0 = function() { + return (er = t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0 = t.asm.Ja).apply(null, arguments); + }, ys = t._emscripten_bind_PeGTlistExtendedEntry_Delete_1 = function() { + return (ys = t._emscripten_bind_PeGTlistExtendedEntry_Delete_1 = t.asm.Ka).apply(null, arguments); + }, Da = t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0 = function() { + return (Da = t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0 = t.asm.La).apply(null, arguments); + }, Ta = t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0 = function() { + return (Ta = t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0 = t.asm.Ma).apply(null, arguments); + }, Ds = t._emscripten_bind_PeHorizon_getNump_0 = function() { + return (Ds = t._emscripten_bind_PeHorizon_getNump_0 = t.asm.Na).apply(null, arguments); + }, fu = t._emscripten_bind_PeHorizon_getKind_0 = function() { + return (fu = t._emscripten_bind_PeHorizon_getKind_0 = t.asm.Oa).apply(null, arguments); + }, mu = t._emscripten_bind_PeHorizon_getInclusive_0 = function() { + return (mu = t._emscripten_bind_PeHorizon_getInclusive_0 = t.asm.Pa).apply(null, arguments); + }, Rc = t._emscripten_bind_PeHorizon_getSize_0 = function() { + return (Rc = t._emscripten_bind_PeHorizon_getSize_0 = t.asm.Qa).apply(null, arguments); + }, Mc = t._emscripten_bind_PeHorizon_getCoord_0 = function() { + return (Mc = t._emscripten_bind_PeHorizon_getCoord_0 = t.asm.Ra).apply(null, arguments); + }, Tl = t._emscripten_bind_PeInteger_PeInteger_1 = function() { + return (Tl = t._emscripten_bind_PeInteger_PeInteger_1 = t.asm.Sa).apply(null, arguments); + }, ah = t._emscripten_bind_PeInteger_get_val_0 = function() { + return (ah = t._emscripten_bind_PeInteger_get_val_0 = t.asm.Ta).apply(null, arguments); + }, jh = t._emscripten_bind_PeInteger_set_val_1 = function() { + return (jh = t._emscripten_bind_PeInteger_set_val_1 = t.asm.Ua).apply(null, arguments); + }, Rp = t._emscripten_bind_PeInteger___destroy___0 = function() { + return (Rp = t._emscripten_bind_PeInteger___destroy___0 = t.asm.Va).apply(null, arguments); + }, kl = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0 = function() { + return (kl = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0 = t.asm.Wa).apply(null, arguments); + }, lh = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0 = function() { + return (lh = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0 = t.asm.Xa).apply(null, arguments); + }, Gh = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0 = function() { + return (Gh = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0 = t.asm.Ya).apply(null, arguments); + }, ou = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0 = function() { + return (ou = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0 = t.asm.Za).apply(null, arguments); + }, Mp = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0 = function() { + return (Mp = t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0 = t.asm._a).apply(null, arguments); + }, yh = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0 = function() { + return (yh = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0 = t.asm.$a).apply(null, arguments); + }, ag = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0 = function() { + return (ag = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0 = t.asm.ab).apply(null, arguments); + }, lg = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0 = function() { + return (lg = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0 = t.asm.bb).apply(null, arguments); + }, jd = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0 = function() { + return (jd = t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0 = t.asm.cb).apply(null, arguments); + }, ha = t._emscripten_bind_PeParameter_getValue_0 = function() { + return (ha = t._emscripten_bind_PeParameter_getValue_0 = t.asm.db).apply(null, arguments); + }, Nf = t._emscripten_bind_PeParameter_getCode_0 = function() { + return (Nf = t._emscripten_bind_PeParameter_getCode_0 = t.asm.eb).apply(null, arguments); + }, al = t._emscripten_bind_PeParameter_getName_1 = function() { + return (al = t._emscripten_bind_PeParameter_getName_1 = t.asm.fb).apply(null, arguments); + }, Dp = t._emscripten_bind_PeParameter_getType_0 = function() { + return (Dp = t._emscripten_bind_PeParameter_getType_0 = t.asm.gb).apply(null, arguments); + }, uh = t._emscripten_bind_PePCSInfo_getCentralMeridian_0 = function() { + return (uh = t._emscripten_bind_PePCSInfo_getCentralMeridian_0 = t.asm.hb).apply(null, arguments); + }, hi = t._emscripten_bind_PePCSInfo_getDomainMinx_0 = function() { + return (hi = t._emscripten_bind_PePCSInfo_getDomainMinx_0 = t.asm.ib).apply(null, arguments); + }, ll = t._emscripten_bind_PePCSInfo_getDomainMiny_0 = function() { + return (ll = t._emscripten_bind_PePCSInfo_getDomainMiny_0 = t.asm.jb).apply(null, arguments); + }, Fp = t._emscripten_bind_PePCSInfo_getDomainMaxx_0 = function() { + return (Fp = t._emscripten_bind_PePCSInfo_getDomainMaxx_0 = t.asm.kb).apply(null, arguments); + }, ug = t._emscripten_bind_PePCSInfo_getDomainMaxy_0 = function() { + return (ug = t._emscripten_bind_PePCSInfo_getDomainMaxy_0 = t.asm.lb).apply(null, arguments); + }, Wo = t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0 = function() { + return (Wo = t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0 = t.asm.mb).apply(null, arguments); + }, lp = t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0 = function() { + return (lp = t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0 = t.asm.nb).apply(null, arguments); + }, Hs = t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0 = function() { + return (Hs = t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0 = t.asm.ob).apply(null, arguments); + }, Xs = t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0 = function() { + return (Xs = t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0 = t.asm.pb).apply(null, arguments); + }, ql = t._emscripten_bind_PePCSInfo_isDensificationNeeded_0 = function() { + return (ql = t._emscripten_bind_PePCSInfo_isDensificationNeeded_0 = t.asm.qb).apply(null, arguments); + }, Su = t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0 = function() { + return (Su = t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0 = t.asm.rb).apply(null, arguments); + }, Im = t._emscripten_bind_PePCSInfo_isPannableRectangle_0 = function() { + return (Im = t._emscripten_bind_PePCSInfo_isPannableRectangle_0 = t.asm.sb).apply(null, arguments); + }, Vc = t._emscripten_bind_PePCSInfo_generate_2 = function() { + return (Vc = t._emscripten_bind_PePCSInfo_generate_2 = t.asm.tb).apply(null, arguments); + }, jc = t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0 = function() { + return (jc = t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0 = t.asm.ub).apply(null, arguments); + }, gu = t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0 = function() { + return (gu = t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0 = t.asm.vb).apply(null, arguments); + }, Yl = t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0 = function() { + return (Yl = t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0 = t.asm.wb).apply(null, arguments); + }, Ba = t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0 = function() { + return (Ba = t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0 = t.asm.xb).apply(null, arguments); + }, vh = t._emscripten_bind_PePrimem_getLongitude_0 = function() { + return (vh = t._emscripten_bind_PePrimem_getLongitude_0 = t.asm.yb).apply(null, arguments); + }, Yu = t._emscripten_bind_PePrimem_getCode_0 = function() { + return (Yu = t._emscripten_bind_PePrimem_getCode_0 = t.asm.zb).apply(null, arguments); + }, $l = t._emscripten_bind_PePrimem_getName_1 = function() { + return ($l = t._emscripten_bind_PePrimem_getName_1 = t.asm.Ab).apply(null, arguments); + }, _c = t._emscripten_bind_PePrimem_getType_0 = function() { + return (_c = t._emscripten_bind_PePrimem_getType_0 = t.asm.Bb).apply(null, arguments); + }, Am = t._emscripten_bind_PeProjcs_getGeogcs_0 = function() { + return (Am = t._emscripten_bind_PeProjcs_getGeogcs_0 = t.asm.Cb).apply(null, arguments); + }, Gd = t._emscripten_bind_PeProjcs_getParameters_0 = function() { + return (Gd = t._emscripten_bind_PeProjcs_getParameters_0 = t.asm.Db).apply(null, arguments); + }, df = t._emscripten_bind_PeProjcs_getUnit_0 = function() { + return (df = t._emscripten_bind_PeProjcs_getUnit_0 = t.asm.Eb).apply(null, arguments); + }, Ug = t._emscripten_bind_PeProjcs_loadConstants_0 = function() { + return (Ug = t._emscripten_bind_PeProjcs_loadConstants_0 = t.asm.Fb).apply(null, arguments); + }, cg = t._emscripten_bind_PeProjcs_horizonGcsGenerate_0 = function() { + return (cg = t._emscripten_bind_PeProjcs_horizonGcsGenerate_0 = t.asm.Gb).apply(null, arguments); + }, zt = t._emscripten_bind_PeProjcs_horizonPcsGenerate_0 = function() { + return (zt = t._emscripten_bind_PeProjcs_horizonPcsGenerate_0 = t.asm.Hb).apply(null, arguments); + }, Wt = t._emscripten_bind_PeProjcs_getCode_0 = function() { + return (Wt = t._emscripten_bind_PeProjcs_getCode_0 = t.asm.Ib).apply(null, arguments); + }, Ai = t._emscripten_bind_PeProjcs_getName_1 = function() { + return (Ai = t._emscripten_bind_PeProjcs_getName_1 = t.asm.Jb).apply(null, arguments); + }, Ui = t._emscripten_bind_PeProjcs_getType_0 = function() { + return (Ui = t._emscripten_bind_PeProjcs_getType_0 = t.asm.Kb).apply(null, arguments); + }, ge = t._emscripten_bind_PeSpheroid_getAxis_0 = function() { + return (ge = t._emscripten_bind_PeSpheroid_getAxis_0 = t.asm.Lb).apply(null, arguments); + }, Le = t._emscripten_bind_PeSpheroid_getFlattening_0 = function() { + return (Le = t._emscripten_bind_PeSpheroid_getFlattening_0 = t.asm.Mb).apply(null, arguments); + }, Ye = t._emscripten_bind_PeSpheroid_getCode_0 = function() { + return (Ye = t._emscripten_bind_PeSpheroid_getCode_0 = t.asm.Nb).apply(null, arguments); + }, xt = t._emscripten_bind_PeSpheroid_getName_1 = function() { + return (xt = t._emscripten_bind_PeSpheroid_getName_1 = t.asm.Ob).apply(null, arguments); + }, oe = t._emscripten_bind_PeSpheroid_getType_0 = function() { + return (oe = t._emscripten_bind_PeSpheroid_getType_0 = t.asm.Pb).apply(null, arguments); + }, ee = t._emscripten_bind_PeUnit_getUnitFactor_0 = function() { + return (ee = t._emscripten_bind_PeUnit_getUnitFactor_0 = t.asm.Qb).apply(null, arguments); + }, ae = t._emscripten_bind_PeUnit_getCode_0 = function() { + return (ae = t._emscripten_bind_PeUnit_getCode_0 = t.asm.Rb).apply(null, arguments); + }, ye = t._emscripten_bind_PeUnit_getName_1 = function() { + return (ye = t._emscripten_bind_PeUnit_getName_1 = t.asm.Sb).apply(null, arguments); + }, Ie = t._emscripten_bind_PeUnit_getType_0 = function() { + return (Ie = t._emscripten_bind_PeUnit_getType_0 = t.asm.Tb).apply(null, arguments); + }, We = t._emscripten_bind_PeVersion_version_string_0 = function() { + return (We = t._emscripten_bind_PeVersion_version_string_0 = t.asm.Ub).apply(null, arguments); + }; + t._pe_getPeGTlistExtendedEntrySize = function() { + return (t._pe_getPeGTlistExtendedEntrySize = t.asm.Vb).apply(null, arguments); + }, t._pe_getPeGTlistExtendedGTsSize = function() { + return (t._pe_getPeGTlistExtendedGTsSize = t.asm.Wb).apply(null, arguments); + }, t._pe_getPeHorizonSize = function() { + return (t._pe_getPeHorizonSize = t.asm.Xb).apply(null, arguments); + }, t._pe_geog_to_geog = function() { + return (t._pe_geog_to_geog = t.asm.Zb).apply(null, arguments); + }, t._pe_geog_to_proj = function() { + return (t._pe_geog_to_proj = t.asm._b).apply(null, arguments); + }, t._pe_geog_to_dd = function() { + return (t._pe_geog_to_dd = t.asm.$b).apply(null, arguments); + }, t._pe_dd_to_geog = function() { + return (t._pe_dd_to_geog = t.asm.ac).apply(null, arguments); + }, t._pe_geog_to_ddm = function() { + return (t._pe_geog_to_ddm = t.asm.bc).apply(null, arguments); + }, t._pe_ddm_to_geog = function() { + return (t._pe_ddm_to_geog = t.asm.cc).apply(null, arguments); + }, t._pe_geog_to_dms = function() { + return (t._pe_geog_to_dms = t.asm.dc).apply(null, arguments); + }, t._pe_dms_to_geog = function() { + return (t._pe_dms_to_geog = t.asm.ec).apply(null, arguments); + }, t._pe_geog_to_mgrs_extended = function() { + return (t._pe_geog_to_mgrs_extended = t.asm.fc).apply(null, arguments); + }, t._pe_mgrs_to_geog_extended = function() { + return (t._pe_mgrs_to_geog_extended = t.asm.gc).apply(null, arguments); + }, t._pe_geog_to_usng = function() { + return (t._pe_geog_to_usng = t.asm.hc).apply(null, arguments); + }, t._pe_usng_to_geog = function() { + return (t._pe_usng_to_geog = t.asm.ic).apply(null, arguments); + }, t._pe_geog_to_utm = function() { + return (t._pe_geog_to_utm = t.asm.jc).apply(null, arguments); + }, t._pe_utm_to_geog = function() { + return (t._pe_utm_to_geog = t.asm.kc).apply(null, arguments); + }, t._pe_object_to_string_ext = function() { + return (t._pe_object_to_string_ext = t.asm.lc).apply(null, arguments); + }, t._pe_proj_to_geog_center = function() { + return (t._pe_proj_to_geog_center = t.asm.mc).apply(null, arguments); + }; + var Xe, lt = t._malloc = function() { + return (lt = t._malloc = t.asm.nc).apply(null, arguments); + }; + function Et(Ot) { + function Bi() { + Xe || (Xe = !0, t.calledRun = !0, V || (et(), e(t), t.onRuntimeInitialized && t.onRuntimeInitialized(), Qe())); + } + kt > 0 || (je(), kt > 0 || (t.setStatus ? (t.setStatus("Running..."), setTimeout(function() { + setTimeout(function() { + t.setStatus(""); + }, 1), Bi(); + }, 1)) : Bi())); + } + if (t._free = function() { + return (t._free = t.asm.oc).apply(null, arguments); + }, t.___start_em_js = 1970140, t.___stop_em_js = 1970238, t.UTF8ToString = J, t.getValue = pe, Tt = function Ot() { + Xe || Et(), Xe || (Tt = Ot); + }, t.preInit) + for (typeof t.preInit == "function" && (t.preInit = [t.preInit]); t.preInit.length > 0; ) + t.preInit.pop()(); + function Ht() { + } + function vi(Ot) { + return (Ot || Ht).__cache__; + } + function yi(Ot, Bi) { + var Mr = vi(Bi), zn = Mr[Ot]; + return zn || ((zn = Object.create((Bi || Ht).prototype)).ptr = Ot, Mr[Ot] = zn); + } + function Oi(Ot, Bi) { + return yi(Ot.ptr, Bi); + } + function zi(Ot) { + if (!Ot.__destroy__) + throw "Error: Cannot destroy object. (Did you create it yourself?)"; + Ot.__destroy__(), delete vi(Ot.__class__)[Ot.ptr]; + } + function ar(Ot, Bi) { + return Ot.ptr === Bi.ptr; + } + function tr(Ot) { + return Ot.ptr; + } + function Ir(Ot) { + return Ot.__class__; + } + Et(), Ht.prototype = Object.create(Ht.prototype), Ht.prototype.constructor = Ht, Ht.prototype.__class__ = Ht, Ht.__cache__ = {}, t.WrapperObject = Ht, t.getCache = vi, t.wrapPointer = yi, t.castObject = Oi, t.NULL = yi(0), t.destroy = zi, t.compare = ar, t.getPointer = tr, t.getClass = Ir; + var ur = { buffer: 0, size: 0, pos: 0, temps: [], needed: 0, prepare: function() { + if (ur.needed) { + for (var Ot = 0; Ot < ur.temps.length; Ot++) + t._free(ur.temps[Ot]); + ur.temps.length = 0, t._free(ur.buffer), ur.buffer = 0, ur.size += ur.needed, ur.needed = 0; + } + ur.buffer || (ur.size += 128, ur.buffer = t._malloc(ur.size), j(ur.buffer)), ur.pos = 0; + }, alloc: function(Ot, Bi) { + j(ur.buffer); + var Mr, zn = Bi.BYTES_PER_ELEMENT, xs = Ot.length * zn; + return xs = xs + 7 & -8, ur.pos + xs >= ur.size ? (j(xs > 0), ur.needed += xs, Mr = t._malloc(xs), ur.temps.push(Mr)) : (Mr = ur.buffer + ur.pos, ur.pos += xs), Mr; + }, copy: function(Ot, Bi, Mr) { + switch (Mr >>>= 0, Bi.BYTES_PER_ELEMENT) { + case 2: + Mr >>>= 1; + break; + case 4: + Mr >>>= 2; + break; + case 8: + Mr >>>= 3; + } + for (var zn = 0; zn < Ot.length; zn++) + Bi[Mr + zn] = Ot[zn]; + } }; + function Jr(Ot) { + if (typeof Ot == "string") { + var Bi = Jt(Ot), Mr = ur.alloc(Bi, X); + return ur.copy(Bi, X, Mr), Mr; + } + return Ot; + } + function on(Ot) { + if (typeof Ot == "object") { + var Bi = ur.alloc(Ot, X); + return ur.copy(Ot, X, Bi), Bi; + } + return Ot; + } + function $n(Ot) { + if (typeof Ot == "object") { + var Bi = ur.alloc(Ot, re); + return ur.copy(Ot, re, Bi), Bi; + } + return Ot; + } + function Fs(Ot) { + if (typeof Ot == "object") { + var Bi = ur.alloc(Ot, he); + return ur.copy(Ot, he, Bi), Bi; + } + return Ot; + } + function Ro(Ot) { + if (typeof Ot == "object") { + var Bi = ur.alloc(Ot, be); + return ur.copy(Ot, be, Bi), Bi; + } + return Ot; + } + function Wa(Ot) { + if (typeof Ot == "object") { + var Bi = ur.alloc(Ot, Se); + return ur.copy(Ot, Se, Bi), Bi; + } + return Ot; + } + function Ks() { + throw "cannot construct a PeObject, no constructor in IDL"; + } + function vs() { + throw "cannot construct a PeCoordsys, no constructor in IDL"; + } + function yo() { + throw "cannot construct a VoidPtr, no constructor in IDL"; + } + function Gc() { + throw "cannot construct a PeDatum, no constructor in IDL"; + } + function Pr() { + throw "cannot construct a PeDefs, no constructor in IDL"; + } + function _h() { + throw "cannot construct a PeFactory, no constructor in IDL"; + } + function Xu(Ot, Bi, Mr, zn, xs, Ss) { + Ot && typeof Ot == "object" && (Ot = Ot.ptr), Bi && typeof Bi == "object" && (Bi = Bi.ptr), Mr && typeof Mr == "object" && (Mr = Mr.ptr), zn && typeof zn == "object" && (zn = zn.ptr), xs && typeof xs == "object" && (xs = xs.ptr), Ss && typeof Ss == "object" && (Ss = Ss.ptr), this.ptr = cs(Ot, Bi, Mr, zn, xs, Ss), vi(Xu)[this.ptr] = this; + } + function Cu() { + throw "cannot construct a PeGeogcs, no constructor in IDL"; + } + function Bl() { + throw "cannot construct a PeGeogtran, no constructor in IDL"; + } + function bh() { + throw "cannot construct a PeGTlistExtended, no constructor in IDL"; + } + function fd() { + throw "cannot construct a PeGTlistExtendedEntry, no constructor in IDL"; + } + function pf() { + throw "cannot construct a PeGTlistExtendedGTs, no constructor in IDL"; + } + function wh() { + throw "cannot construct a PeHorizon, no constructor in IDL"; + } + function md(Ot) { + Ot && typeof Ot == "object" && (Ot = Ot.ptr), this.ptr = Tl(Ot), vi(md)[this.ptr] = this; + } + function yl() { + throw "cannot construct a PeNotationMgrs, no constructor in IDL"; + } + function Dc() { + throw "cannot construct a PeNotationUtm, no constructor in IDL"; + } + function Vl() { + throw "cannot construct a PeParameter, no constructor in IDL"; + } + function co() { + throw "cannot construct a PePCSInfo, no constructor in IDL"; + } + function xh() { + throw "cannot construct a PePrimem, no constructor in IDL"; + } + function yu() { + throw "cannot construct a PeProjcs, no constructor in IDL"; + } + function Sh() { + throw "cannot construct a PeSpheroid, no constructor in IDL"; + } + function Ud() { + throw "cannot construct a PeUnit, no constructor in IDL"; + } + function zg() { + throw "cannot construct a PeVersion, no constructor in IDL"; + } + return Ks.prototype = Object.create(Ht.prototype), Ks.prototype.constructor = Ks, Ks.prototype.__class__ = Ks, Ks.__cache__ = {}, t.PeObject = Ks, Ks.prototype.getCode = Ks.prototype.getCode = function() { + var Ot = this.ptr; + return Qt(Ot); + }, Ks.prototype.getName = Ks.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(bi(Bi, Ot)); + }, Ks.prototype.getType = Ks.prototype.getType = function() { + var Ot = this.ptr; + return Mi(Ot); + }, vs.prototype = Object.create(Ks.prototype), vs.prototype.constructor = vs, vs.prototype.__class__ = vs, vs.__cache__ = {}, t.PeCoordsys = vs, vs.prototype.getCode = vs.prototype.getCode = function() { + var Ot = this.ptr; + return Ri(Ot); + }, vs.prototype.getName = vs.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(Yi(Bi, Ot)); + }, vs.prototype.getType = vs.prototype.getType = function() { + var Ot = this.ptr; + return rr(Ot); + }, yo.prototype = Object.create(Ht.prototype), yo.prototype.constructor = yo, yo.prototype.__class__ = yo, yo.__cache__ = {}, t.VoidPtr = yo, yo.prototype.__destroy__ = yo.prototype.__destroy__ = function() { + var Ot = this.ptr; + _i(Ot); + }, Gc.prototype = Object.create(Ks.prototype), Gc.prototype.constructor = Gc, Gc.prototype.__class__ = Gc, Gc.__cache__ = {}, t.PeDatum = Gc, Gc.prototype.getSpheroid = Gc.prototype.getSpheroid = function() { + var Ot = this.ptr; + return yi(fn(Ot), Sh); + }, Gc.prototype.getCode = Gc.prototype.getCode = function() { + var Ot = this.ptr; + return jr(Ot); + }, Gc.prototype.getName = Gc.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(no(Bi, Ot)); + }, Gc.prototype.getType = Gc.prototype.getType = function() { + var Ot = this.ptr; + return $r(Ot); + }, Pr.prototype = Object.create(Ht.prototype), Pr.prototype.constructor = Pr, Pr.prototype.__class__ = Pr, Pr.__cache__ = {}, t.PeDefs = Pr, Pr.prototype.get_PE_BUFFER_MAX = Pr.prototype.get_PE_BUFFER_MAX = function() { + var Ot = this.ptr; + return Zn(Ot); + }, Object.defineProperty(Pr.prototype, "PE_BUFFER_MAX", { get: Pr.prototype.get_PE_BUFFER_MAX }), Pr.prototype.get_PE_NAME_MAX = Pr.prototype.get_PE_NAME_MAX = function() { + var Ot = this.ptr; + return bs(Ot); + }, Object.defineProperty(Pr.prototype, "PE_NAME_MAX", { get: Pr.prototype.get_PE_NAME_MAX }), Pr.prototype.get_PE_MGRS_MAX = Pr.prototype.get_PE_MGRS_MAX = function() { + var Ot = this.ptr; + return On(Ot); + }, Object.defineProperty(Pr.prototype, "PE_MGRS_MAX", { get: Pr.prototype.get_PE_MGRS_MAX }), Pr.prototype.get_PE_USNG_MAX = Pr.prototype.get_PE_USNG_MAX = function() { + var Ot = this.ptr; + return Jn(Ot); + }, Object.defineProperty(Pr.prototype, "PE_USNG_MAX", { get: Pr.prototype.get_PE_USNG_MAX }), Pr.prototype.get_PE_DD_MAX = Pr.prototype.get_PE_DD_MAX = function() { + var Ot = this.ptr; + return ki(Ot); + }, Object.defineProperty(Pr.prototype, "PE_DD_MAX", { get: Pr.prototype.get_PE_DD_MAX }), Pr.prototype.get_PE_DMS_MAX = Pr.prototype.get_PE_DMS_MAX = function() { + var Ot = this.ptr; + return Ur(Ot); + }, Object.defineProperty(Pr.prototype, "PE_DMS_MAX", { get: Pr.prototype.get_PE_DMS_MAX }), Pr.prototype.get_PE_DDM_MAX = Pr.prototype.get_PE_DDM_MAX = function() { + var Ot = this.ptr; + return So(Ot); + }, Object.defineProperty(Pr.prototype, "PE_DDM_MAX", { get: Pr.prototype.get_PE_DDM_MAX }), Pr.prototype.get_PE_UTM_MAX = Pr.prototype.get_PE_UTM_MAX = function() { + var Ot = this.ptr; + return Cn(Ot); + }, Object.defineProperty(Pr.prototype, "PE_UTM_MAX", { get: Pr.prototype.get_PE_UTM_MAX }), Pr.prototype.get_PE_PARM_MAX = Pr.prototype.get_PE_PARM_MAX = function() { + var Ot = this.ptr; + return Ki(Ot); + }, Object.defineProperty(Pr.prototype, "PE_PARM_MAX", { get: Pr.prototype.get_PE_PARM_MAX }), Pr.prototype.get_PE_TYPE_NONE = Pr.prototype.get_PE_TYPE_NONE = function() { + var Ot = this.ptr; + return ui(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_NONE", { get: Pr.prototype.get_PE_TYPE_NONE }), Pr.prototype.get_PE_TYPE_GEOGCS = Pr.prototype.get_PE_TYPE_GEOGCS = function() { + var Ot = this.ptr; + return W(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_GEOGCS", { get: Pr.prototype.get_PE_TYPE_GEOGCS }), Pr.prototype.get_PE_TYPE_PROJCS = Pr.prototype.get_PE_TYPE_PROJCS = function() { + var Ot = this.ptr; + return Cr(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_PROJCS", { get: Pr.prototype.get_PE_TYPE_PROJCS }), Pr.prototype.get_PE_TYPE_GEOGTRAN = Pr.prototype.get_PE_TYPE_GEOGTRAN = function() { + var Ot = this.ptr; + return ia(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_GEOGTRAN", { get: Pr.prototype.get_PE_TYPE_GEOGTRAN }), Pr.prototype.get_PE_TYPE_COORDSYS = Pr.prototype.get_PE_TYPE_COORDSYS = function() { + var Ot = this.ptr; + return Ho(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_COORDSYS", { get: Pr.prototype.get_PE_TYPE_COORDSYS }), Pr.prototype.get_PE_TYPE_UNIT = Pr.prototype.get_PE_TYPE_UNIT = function() { + var Ot = this.ptr; + return Ut(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_UNIT", { get: Pr.prototype.get_PE_TYPE_UNIT }), Pr.prototype.get_PE_TYPE_LINUNIT = Pr.prototype.get_PE_TYPE_LINUNIT = function() { + var Ot = this.ptr; + return Ca(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TYPE_LINUNIT", { get: Pr.prototype.get_PE_TYPE_LINUNIT }), Pr.prototype.get_PE_STR_OPTS_NONE = Pr.prototype.get_PE_STR_OPTS_NONE = function() { + var Ot = this.ptr; + return xi(Ot); + }, Object.defineProperty(Pr.prototype, "PE_STR_OPTS_NONE", { get: Pr.prototype.get_PE_STR_OPTS_NONE }), Pr.prototype.get_PE_STR_AUTH_NONE = Pr.prototype.get_PE_STR_AUTH_NONE = function() { + var Ot = this.ptr; + return _t(Ot); + }, Object.defineProperty(Pr.prototype, "PE_STR_AUTH_NONE", { get: Pr.prototype.get_PE_STR_AUTH_NONE }), Pr.prototype.get_PE_STR_AUTH_TOP = Pr.prototype.get_PE_STR_AUTH_TOP = function() { + var Ot = this.ptr; + return Fr(Ot); + }, Object.defineProperty(Pr.prototype, "PE_STR_AUTH_TOP", { get: Pr.prototype.get_PE_STR_AUTH_TOP }), Pr.prototype.get_PE_STR_NAME_CANON = Pr.prototype.get_PE_STR_NAME_CANON = function() { + var Ot = this.ptr; + return ln(Ot); + }, Object.defineProperty(Pr.prototype, "PE_STR_NAME_CANON", { get: Pr.prototype.get_PE_STR_NAME_CANON }), Pr.prototype.get_PE_PARM_X0 = Pr.prototype.get_PE_PARM_X0 = function() { + var Ot = this.ptr; + return kn(Ot); + }, Object.defineProperty(Pr.prototype, "PE_PARM_X0", { get: Pr.prototype.get_PE_PARM_X0 }), Pr.prototype.get_PE_PARM_ND = Pr.prototype.get_PE_PARM_ND = function() { + var Ot = this.ptr; + return Un(Ot); + }, Object.defineProperty(Pr.prototype, "PE_PARM_ND", { get: Pr.prototype.get_PE_PARM_ND }), Pr.prototype.get_PE_TRANSFORM_1_TO_2 = Pr.prototype.get_PE_TRANSFORM_1_TO_2 = function() { + var Ot = this.ptr; + return Cs(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TRANSFORM_1_TO_2", { get: Pr.prototype.get_PE_TRANSFORM_1_TO_2 }), Pr.prototype.get_PE_TRANSFORM_2_TO_1 = Pr.prototype.get_PE_TRANSFORM_2_TO_1 = function() { + var Ot = this.ptr; + return ra(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TRANSFORM_2_TO_1", { get: Pr.prototype.get_PE_TRANSFORM_2_TO_1 }), Pr.prototype.get_PE_TRANSFORM_P_TO_G = Pr.prototype.get_PE_TRANSFORM_P_TO_G = function() { + var Ot = this.ptr; + return yn(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TRANSFORM_P_TO_G", { get: Pr.prototype.get_PE_TRANSFORM_P_TO_G }), Pr.prototype.get_PE_TRANSFORM_G_TO_P = Pr.prototype.get_PE_TRANSFORM_G_TO_P = function() { + var Ot = this.ptr; + return Io(Ot); + }, Object.defineProperty(Pr.prototype, "PE_TRANSFORM_G_TO_P", { get: Pr.prototype.get_PE_TRANSFORM_G_TO_P }), Pr.prototype.get_PE_HORIZON_RECT = Pr.prototype.get_PE_HORIZON_RECT = function() { + var Ot = this.ptr; + return oh(Ot); + }, Object.defineProperty(Pr.prototype, "PE_HORIZON_RECT", { get: Pr.prototype.get_PE_HORIZON_RECT }), Pr.prototype.get_PE_HORIZON_POLY = Pr.prototype.get_PE_HORIZON_POLY = function() { + var Ot = this.ptr; + return gh(Ot); + }, Object.defineProperty(Pr.prototype, "PE_HORIZON_POLY", { get: Pr.prototype.get_PE_HORIZON_POLY }), Pr.prototype.get_PE_HORIZON_LINE = Pr.prototype.get_PE_HORIZON_LINE = function() { + var Ot = this.ptr; + return vc(Ot); + }, Object.defineProperty(Pr.prototype, "PE_HORIZON_LINE", { get: Pr.prototype.get_PE_HORIZON_LINE }), Pr.prototype.get_PE_HORIZON_DELTA = Pr.prototype.get_PE_HORIZON_DELTA = function() { + var Ot = this.ptr; + return qu(Ot); + }, Object.defineProperty(Pr.prototype, "PE_HORIZON_DELTA", { get: Pr.prototype.get_PE_HORIZON_DELTA }), _h.prototype = Object.create(Ht.prototype), _h.prototype.constructor = _h, _h.prototype.__class__ = _h, _h.__cache__ = {}, t.PeFactory = _h, _h.prototype.initialize = _h.prototype.initialize = function(Ot) { + var Bi = this.ptr; + ur.prepare(), Ot = Ot && typeof Ot == "object" ? Ot.ptr : Jr(Ot), ss(Bi, Ot); + }, _h.prototype.factoryByType = _h.prototype.factoryByType = function(Ot, Bi) { + var Mr = this.ptr; + return Ot && typeof Ot == "object" && (Ot = Ot.ptr), Bi && typeof Bi == "object" && (Bi = Bi.ptr), yi(dd(Mr, Ot, Bi), Ks); + }, _h.prototype.fromString = _h.prototype.fromString = function(Ot, Bi) { + var Mr = this.ptr; + return ur.prepare(), Ot && typeof Ot == "object" && (Ot = Ot.ptr), Bi = Bi && typeof Bi == "object" ? Bi.ptr : Jr(Bi), yi(Vd(Mr, Ot, Bi), Ks); + }, _h.prototype.getCode = _h.prototype.getCode = function(Ot) { + var Bi = this.ptr; + return Ot && typeof Ot == "object" && (Ot = Ot.ptr), pd(Bi, Ot); + }, Xu.prototype = Object.create(Ht.prototype), Xu.prototype.constructor = Xu, Xu.prototype.__class__ = Xu, Xu.__cache__ = {}, t.PeGCSExtent = Xu, Xu.prototype.getLLon = Xu.prototype.getLLon = function() { + var Ot = this.ptr; + return Nl(Ot); + }, Xu.prototype.getSLat = Xu.prototype.getSLat = function() { + var Ot = this.ptr; + return ii(Ot); + }, Xu.prototype.getRLon = Xu.prototype.getRLon = function() { + var Ot = this.ptr; + return bt(Ot); + }, Xu.prototype.getNLat = Xu.prototype.getNLat = function() { + var Ot = this.ptr; + return Kt(Ot); + }, Xu.prototype.__destroy__ = Xu.prototype.__destroy__ = function() { + var Ot = this.ptr; + Pi(Ot); + }, Cu.prototype = Object.create(vs.prototype), Cu.prototype.constructor = Cu, Cu.prototype.__class__ = Cu, Cu.__cache__ = {}, t.PeGeogcs = Cu, Cu.prototype.getDatum = Cu.prototype.getDatum = function() { + var Ot = this.ptr; + return yi(Sr(Ot), Gc); + }, Cu.prototype.getPrimem = Cu.prototype.getPrimem = function() { + var Ot = this.ptr; + return yi(Tr(Ot), xh); + }, Cu.prototype.getUnit = Cu.prototype.getUnit = function() { + var Ot = this.ptr; + return yi(ri(Ot), Ud); + }, Cu.prototype.getCode = Cu.prototype.getCode = function() { + var Ot = this.ptr; + return pi(Ot); + }, Cu.prototype.getName = Cu.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(mi(Bi, Ot)); + }, Cu.prototype.getType = Cu.prototype.getType = function() { + var Ot = this.ptr; + return hr(Ot); + }, Bl.prototype = Object.create(Ks.prototype), Bl.prototype.constructor = Bl, Bl.prototype.__class__ = Bl, Bl.__cache__ = {}, t.PeGeogtran = Bl, Bl.prototype.isEqual = Bl.prototype.isEqual = function(Ot) { + var Bi = this.ptr; + return Ot && typeof Ot == "object" && (Ot = Ot.ptr), !!Lr(Bi, Ot); + }, Bl.prototype.getGeogcs1 = Bl.prototype.getGeogcs1 = function() { + var Ot = this.ptr; + return yi(wr(Ot), Cu); + }, Bl.prototype.getGeogcs2 = Bl.prototype.getGeogcs2 = function() { + var Ot = this.ptr; + return yi(Nr(Ot), Cu); + }, Bl.prototype.getParameters = Bl.prototype.getParameters = function() { + var Ot = this.ptr; + return _r(Ot); + }, Bl.prototype.loadConstants = Bl.prototype.loadConstants = function() { + var Ot = this.ptr; + return !!Tn(Ot); + }, Bl.prototype.getCode = Bl.prototype.getCode = function() { + var Ot = this.ptr; + return os(Ot); + }, Bl.prototype.getName = Bl.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(fs(Bi, Ot)); + }, Bl.prototype.getType = Bl.prototype.getType = function() { + var Ot = this.ptr; + return di(Ot); + }, bh.prototype = Object.create(Ht.prototype), bh.prototype.constructor = bh, bh.prototype.__class__ = bh, bh.__cache__ = {}, t.PeGTlistExtended = bh, bh.prototype.getGTlist = bh.prototype.getGTlist = function(Ot, Bi, Mr, zn, xs, Ss) { + var da = this.ptr; + return Ot && typeof Ot == "object" && (Ot = Ot.ptr), Bi && typeof Bi == "object" && (Bi = Bi.ptr), Mr && typeof Mr == "object" && (Mr = Mr.ptr), zn && typeof zn == "object" && (zn = zn.ptr), xs && typeof xs == "object" && (xs = xs.ptr), Ss && typeof Ss == "object" && (Ss = Ss.ptr), yi(nr(da, Ot, Bi, Mr, zn, xs, Ss), fd); + }, bh.prototype.get_PE_GTLIST_OPTS_COMMON = bh.prototype.get_PE_GTLIST_OPTS_COMMON = function() { + var Ot = this.ptr; + return fr(Ot); + }, Object.defineProperty(bh.prototype, "PE_GTLIST_OPTS_COMMON", { get: bh.prototype.get_PE_GTLIST_OPTS_COMMON }), fd.prototype = Object.create(Ht.prototype), fd.prototype.constructor = fd, fd.prototype.__class__ = fd, fd.__cache__ = {}, t.PeGTlistExtendedEntry = fd, fd.prototype.getEntries = fd.prototype.getEntries = function() { + var Ot = this.ptr; + return yi(Zr(Ot), pf); + }, fd.prototype.getSteps = fd.prototype.getSteps = function() { + var Ot = this.ptr; + return er(Ot); + }, fd.prototype.Delete = fd.prototype.Delete = function(Ot) { + var Bi = this.ptr; + Ot && typeof Ot == "object" && (Ot = Ot.ptr), ys(Bi, Ot); + }, pf.prototype = Object.create(Ht.prototype), pf.prototype.constructor = pf, pf.prototype.__class__ = pf, pf.__cache__ = {}, t.PeGTlistExtendedGTs = pf, pf.prototype.getDirection = pf.prototype.getDirection = function() { + var Ot = this.ptr; + return Da(Ot); + }, pf.prototype.getGeogtran = pf.prototype.getGeogtran = function() { + var Ot = this.ptr; + return yi(Ta(Ot), Bl); + }, wh.prototype = Object.create(Ht.prototype), wh.prototype.constructor = wh, wh.prototype.__class__ = wh, wh.__cache__ = {}, t.PeHorizon = wh, wh.prototype.getNump = wh.prototype.getNump = function() { + var Ot = this.ptr; + return Ds(Ot); + }, wh.prototype.getKind = wh.prototype.getKind = function() { + var Ot = this.ptr; + return fu(Ot); + }, wh.prototype.getInclusive = wh.prototype.getInclusive = function() { + var Ot = this.ptr; + return mu(Ot); + }, wh.prototype.getSize = wh.prototype.getSize = function() { + var Ot = this.ptr; + return Rc(Ot); + }, wh.prototype.getCoord = wh.prototype.getCoord = function() { + var Ot = this.ptr; + return Mc(Ot); + }, md.prototype = Object.create(Ht.prototype), md.prototype.constructor = md, md.prototype.__class__ = md, md.__cache__ = {}, t.PeInteger = md, md.prototype.get_val = md.prototype.get_val = function() { + var Ot = this.ptr; + return ah(Ot); + }, md.prototype.set_val = md.prototype.set_val = function(Ot) { + var Bi = this.ptr; + Ot && typeof Ot == "object" && (Ot = Ot.ptr), jh(Bi, Ot); + }, Object.defineProperty(md.prototype, "val", { get: md.prototype.get_val, set: md.prototype.set_val }), md.prototype.__destroy__ = md.prototype.__destroy__ = function() { + var Ot = this.ptr; + Rp(Ot); + }, yl.prototype = Object.create(Ht.prototype), yl.prototype.constructor = yl, yl.prototype.__class__ = yl, yl.__cache__ = {}, t.PeNotationMgrs = yl, yl.prototype.get_PE_MGRS_STYLE_NEW = yl.prototype.get_PE_MGRS_STYLE_NEW = function() { + var Ot = this.ptr; + return kl(Ot); + }, Object.defineProperty(yl.prototype, "PE_MGRS_STYLE_NEW", { get: yl.prototype.get_PE_MGRS_STYLE_NEW }), yl.prototype.get_PE_MGRS_STYLE_OLD = yl.prototype.get_PE_MGRS_STYLE_OLD = function() { + var Ot = this.ptr; + return lh(Ot); + }, Object.defineProperty(yl.prototype, "PE_MGRS_STYLE_OLD", { get: yl.prototype.get_PE_MGRS_STYLE_OLD }), yl.prototype.get_PE_MGRS_STYLE_AUTO = yl.prototype.get_PE_MGRS_STYLE_AUTO = function() { + var Ot = this.ptr; + return Gh(Ot); + }, Object.defineProperty(yl.prototype, "PE_MGRS_STYLE_AUTO", { get: yl.prototype.get_PE_MGRS_STYLE_AUTO }), yl.prototype.get_PE_MGRS_180_ZONE_1_PLUS = yl.prototype.get_PE_MGRS_180_ZONE_1_PLUS = function() { + var Ot = this.ptr; + return ou(Ot); + }, Object.defineProperty(yl.prototype, "PE_MGRS_180_ZONE_1_PLUS", { get: yl.prototype.get_PE_MGRS_180_ZONE_1_PLUS }), yl.prototype.get_PE_MGRS_ADD_SPACES = yl.prototype.get_PE_MGRS_ADD_SPACES = function() { + var Ot = this.ptr; + return Mp(Ot); + }, Object.defineProperty(yl.prototype, "PE_MGRS_ADD_SPACES", { get: yl.prototype.get_PE_MGRS_ADD_SPACES }), Dc.prototype = Object.create(Ht.prototype), Dc.prototype.constructor = Dc, Dc.prototype.__class__ = Dc, Dc.__cache__ = {}, t.PeNotationUtm = Dc, Dc.prototype.get_PE_UTM_OPTS_NONE = Dc.prototype.get_PE_UTM_OPTS_NONE = function() { + var Ot = this.ptr; + return yh(Ot); + }, Object.defineProperty(Dc.prototype, "PE_UTM_OPTS_NONE", { get: Dc.prototype.get_PE_UTM_OPTS_NONE }), Dc.prototype.get_PE_UTM_OPTS_NS = Dc.prototype.get_PE_UTM_OPTS_NS = function() { + var Ot = this.ptr; + return ag(Ot); + }, Object.defineProperty(Dc.prototype, "PE_UTM_OPTS_NS", { get: Dc.prototype.get_PE_UTM_OPTS_NS }), Dc.prototype.get_PE_UTM_OPTS_NS_STRICT = Dc.prototype.get_PE_UTM_OPTS_NS_STRICT = function() { + var Ot = this.ptr; + return lg(Ot); + }, Object.defineProperty(Dc.prototype, "PE_UTM_OPTS_NS_STRICT", { get: Dc.prototype.get_PE_UTM_OPTS_NS_STRICT }), Dc.prototype.get_PE_UTM_OPTS_ADD_SPACES = Dc.prototype.get_PE_UTM_OPTS_ADD_SPACES = function() { + var Ot = this.ptr; + return jd(Ot); + }, Object.defineProperty(Dc.prototype, "PE_UTM_OPTS_ADD_SPACES", { get: Dc.prototype.get_PE_UTM_OPTS_ADD_SPACES }), Vl.prototype = Object.create(Ks.prototype), Vl.prototype.constructor = Vl, Vl.prototype.__class__ = Vl, Vl.__cache__ = {}, t.PeParameter = Vl, Vl.prototype.getValue = Vl.prototype.getValue = function() { + var Ot = this.ptr; + return ha(Ot); + }, Vl.prototype.getCode = Vl.prototype.getCode = function() { + var Ot = this.ptr; + return Nf(Ot); + }, Vl.prototype.getName = Vl.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(al(Bi, Ot)); + }, Vl.prototype.getType = Vl.prototype.getType = function() { + var Ot = this.ptr; + return Dp(Ot); + }, co.prototype = Object.create(Ht.prototype), co.prototype.constructor = co, co.prototype.__class__ = co, co.__cache__ = {}, t.PePCSInfo = co, co.prototype.getCentralMeridian = co.prototype.getCentralMeridian = function() { + var Ot = this.ptr; + return uh(Ot); + }, co.prototype.getDomainMinx = co.prototype.getDomainMinx = function() { + var Ot = this.ptr; + return hi(Ot); + }, co.prototype.getDomainMiny = co.prototype.getDomainMiny = function() { + var Ot = this.ptr; + return ll(Ot); + }, co.prototype.getDomainMaxx = co.prototype.getDomainMaxx = function() { + var Ot = this.ptr; + return Fp(Ot); + }, co.prototype.getDomainMaxy = co.prototype.getDomainMaxy = function() { + var Ot = this.ptr; + return ug(Ot); + }, co.prototype.getNorthPoleLocation = co.prototype.getNorthPoleLocation = function() { + var Ot = this.ptr; + return Wo(Ot); + }, co.prototype.getNorthPoleGeometry = co.prototype.getNorthPoleGeometry = function() { + var Ot = this.ptr; + return lp(Ot); + }, co.prototype.getSouthPoleLocation = co.prototype.getSouthPoleLocation = function() { + var Ot = this.ptr; + return Hs(Ot); + }, co.prototype.getSouthPoleGeometry = co.prototype.getSouthPoleGeometry = function() { + var Ot = this.ptr; + return Xs(Ot); + }, co.prototype.isDensificationNeeded = co.prototype.isDensificationNeeded = function() { + var Ot = this.ptr; + return !!ql(Ot); + }, co.prototype.isGcsHorizonMultiOverlap = co.prototype.isGcsHorizonMultiOverlap = function() { + var Ot = this.ptr; + return !!Su(Ot); + }, co.prototype.isPannableRectangle = co.prototype.isPannableRectangle = function() { + var Ot = this.ptr; + return !!Im(Ot); + }, co.prototype.generate = co.prototype.generate = function(Ot, Bi) { + var Mr = this.ptr; + return Ot && typeof Ot == "object" && (Ot = Ot.ptr), Bi && typeof Bi == "object" && (Bi = Bi.ptr), yi(Vc(Mr, Ot, Bi), co); + }, co.prototype.get_PE_PCSINFO_OPTION_NONE = co.prototype.get_PE_PCSINFO_OPTION_NONE = function() { + var Ot = this.ptr; + return jc(Ot); + }, Object.defineProperty(co.prototype, "PE_PCSINFO_OPTION_NONE", { get: co.prototype.get_PE_PCSINFO_OPTION_NONE }), co.prototype.get_PE_PCSINFO_OPTION_DOMAIN = co.prototype.get_PE_PCSINFO_OPTION_DOMAIN = function() { + var Ot = this.ptr; + return gu(Ot); + }, Object.defineProperty(co.prototype, "PE_PCSINFO_OPTION_DOMAIN", { get: co.prototype.get_PE_PCSINFO_OPTION_DOMAIN }), co.prototype.get_PE_POLE_OUTSIDE_BOUNDARY = co.prototype.get_PE_POLE_OUTSIDE_BOUNDARY = function() { + var Ot = this.ptr; + return Yl(Ot); + }, Object.defineProperty(co.prototype, "PE_POLE_OUTSIDE_BOUNDARY", { get: co.prototype.get_PE_POLE_OUTSIDE_BOUNDARY }), co.prototype.get_PE_POLE_POINT = co.prototype.get_PE_POLE_POINT = function() { + var Ot = this.ptr; + return Ba(Ot); + }, Object.defineProperty(co.prototype, "PE_POLE_POINT", { get: co.prototype.get_PE_POLE_POINT }), xh.prototype = Object.create(Ks.prototype), xh.prototype.constructor = xh, xh.prototype.__class__ = xh, xh.__cache__ = {}, t.PePrimem = xh, xh.prototype.getLongitude = xh.prototype.getLongitude = function() { + var Ot = this.ptr; + return vh(Ot); + }, xh.prototype.getCode = xh.prototype.getCode = function() { + var Ot = this.ptr; + return Yu(Ot); + }, xh.prototype.getName = xh.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J($l(Bi, Ot)); + }, xh.prototype.getType = xh.prototype.getType = function() { + var Ot = this.ptr; + return _c(Ot); + }, yu.prototype = Object.create(vs.prototype), yu.prototype.constructor = yu, yu.prototype.__class__ = yu, yu.__cache__ = {}, t.PeProjcs = yu, yu.prototype.getGeogcs = yu.prototype.getGeogcs = function() { + var Ot = this.ptr; + return yi(Am(Ot), Cu); + }, yu.prototype.getParameters = yu.prototype.getParameters = function() { + var Ot = this.ptr; + return Gd(Ot); + }, yu.prototype.getUnit = yu.prototype.getUnit = function() { + var Ot = this.ptr; + return yi(df(Ot), Ud); + }, yu.prototype.loadConstants = yu.prototype.loadConstants = function() { + var Ot = this.ptr; + return !!Ug(Ot); + }, yu.prototype.horizonGcsGenerate = yu.prototype.horizonGcsGenerate = function() { + var Ot = this.ptr; + return yi(cg(Ot), wh); + }, yu.prototype.horizonPcsGenerate = yu.prototype.horizonPcsGenerate = function() { + var Ot = this.ptr; + return yi(zt(Ot), wh); + }, yu.prototype.getCode = yu.prototype.getCode = function() { + var Ot = this.ptr; + return Wt(Ot); + }, yu.prototype.getName = yu.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(Ai(Bi, Ot)); + }, yu.prototype.getType = yu.prototype.getType = function() { + var Ot = this.ptr; + return Ui(Ot); + }, Sh.prototype = Object.create(Ks.prototype), Sh.prototype.constructor = Sh, Sh.prototype.__class__ = Sh, Sh.__cache__ = {}, t.PeSpheroid = Sh, Sh.prototype.getAxis = Sh.prototype.getAxis = function() { + var Ot = this.ptr; + return ge(Ot); + }, Sh.prototype.getFlattening = Sh.prototype.getFlattening = function() { + var Ot = this.ptr; + return Le(Ot); + }, Sh.prototype.getCode = Sh.prototype.getCode = function() { + var Ot = this.ptr; + return Ye(Ot); + }, Sh.prototype.getName = Sh.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(xt(Bi, Ot)); + }, Sh.prototype.getType = Sh.prototype.getType = function() { + var Ot = this.ptr; + return oe(Ot); + }, Ud.prototype = Object.create(Ks.prototype), Ud.prototype.constructor = Ud, Ud.prototype.__class__ = Ud, Ud.__cache__ = {}, t.PeUnit = Ud, Ud.prototype.getUnitFactor = Ud.prototype.getUnitFactor = function() { + var Ot = this.ptr; + return ee(Ot); + }, Ud.prototype.getCode = Ud.prototype.getCode = function() { + var Ot = this.ptr; + return ae(Ot); + }, Ud.prototype.getName = Ud.prototype.getName = function(Ot) { + var Bi = this.ptr; + return ur.prepare(), typeof Ot == "object" && (Ot = on(Ot)), J(ye(Bi, Ot)); + }, Ud.prototype.getType = Ud.prototype.getType = function() { + var Ot = this.ptr; + return Ie(Ot); + }, zg.prototype = Object.create(Ht.prototype), zg.prototype.constructor = zg, zg.prototype.__class__ = zg, zg.__cache__ = {}, t.PeVersion = zg, zg.prototype.version_string = zg.prototype.version_string = function() { + var Ot = this.ptr; + return J(We(Ot)); + }, t.ensureCache = ur, t.ensureString = Jr, t.ensureInt8 = on, t.ensureInt16 = $n, t.ensureInt32 = Fs, t.ensureFloat32 = Ro, t.ensureFloat64 = Wa, t.ready; +}, fet.exports = met; +const Zzi = Jzi({ __proto__: null, default: Dfe }, [Dfe]), Qzi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + p: Zzi +}, Symbol.toStringTag, { value: "Module" })), Wu = { convertToGEGeometry: eHi, exportPoint: tHi, exportPolygon: iHi, exportPolyline: rHi, exportMultipoint: nHi, exportExtent: sHi }; +function eHi(t, e) { + if (e == null) + return null; + let i = "cache" in e ? e.cache._geVersion : void 0; + return i == null && (i = t.convertJSONToGeometry(e), "cache" in e && (e.cache._geVersion = i)), i; +} +function tHi(t, e, i) { + const r = t.hasZ(e), n = t.hasM(e), s = new Xi({ x: t.getPointX(e), y: t.getPointY(e), spatialReference: i }); + return r && (s.z = t.getPointZ(e)), n && (s.m = t.getPointM(e)), s.cache._geVersion = e, s; +} +function iHi(t, e, i) { + const r = new xo({ rings: t.exportPaths(e), hasZ: t.hasZ(e), hasM: t.hasM(e), spatialReference: i }); + return r.cache._geVersion = e, r; +} +function rHi(t, e, i) { + const r = new xa({ paths: t.exportPaths(e), hasZ: t.hasZ(e), hasM: t.hasM(e), spatialReference: i }); + return r.cache._geVersion = e, r; +} +function nHi(t, e, i) { + const r = new Dd({ hasZ: t.hasZ(e), hasM: t.hasM(e), points: t.exportPoints(e), spatialReference: i }); + return r.cache._geVersion = e, r; +} +function sHi(t, e, i) { + const r = t.hasZ(e), n = t.hasM(e), s = new br({ xmin: t.getXMin(e), ymin: t.getYMin(e), xmax: t.getXMax(e), ymax: t.getYMax(e), spatialReference: i }); + if (r) { + const o = t.getZExtent(e); + s.zmin = o.vmin, s.zmax = o.vmax; + } + if (n) { + const o = t.getMExtent(e); + s.mmin = o.vmin, s.mmax = o.vmax; + } + return s.cache._geVersion = e, s; +} +const oHi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + hydratedAdapter: Wu +}, Symbol.toStringTag, { value: "Module" })), aHi = new zs({ originalAndCurrentFeatures: "original-and-current-features", none: "none" }); +async function get(t) { + return typeof t == "string" ? CF(t) || { data: t } : new Promise((e, i) => { + const r = new FileReader(); + r.readAsDataURL(t), r.onload = () => e(CF(r.result)), r.onerror = (n) => i(n); + }); +} +const lHi = /* @__PURE__ */ new Set(["Feature Layer", "Table"]), uHi = new zs({ Started: "published", Publishing: "publishing", Stopped: "unavailable" }); +let ZV = class extends kd { + constructor() { + super(...arguments), this.type = "feature-layer", this.refresh = Fv(async () => { + await this.load(); + const e = this.sourceJSON.editingInfo?.lastEditDate; + if (e == null) + return { dataChanged: !0, updates: {} }; + try { + await this._fetchService(null); + } catch { + return { dataChanged: !0, updates: {} }; + } + const i = e !== this.sourceJSON.editingInfo?.lastEditDate; + return { dataChanged: i, updates: i ? { editingInfo: this.sourceJSON.editingInfo, extent: this.sourceJSON.extent } : null }; + }); + } + load(e) { + const i = _e(e) ? e.signal : null, r = this.layer.sourceJSON; + return this.addResolvingPromise(this._fetchService(r, i)), Promise.resolve(this); + } + get queryTask() { + const { capabilities: e, parsedUrl: i, dynamicDataSource: r, infoFor3D: n, gdbVersion: s, spatialReference: o, fieldsIndex: a } = this.layer, l = Vi("featurelayer-pbf") && e?.query.supportsFormatPBF && ut(n), c = e?.operations?.supportsQueryAttachments ?? !1; + return new w0t({ url: i.path, pbfSupported: l, fieldsIndex: a, infoFor3D: n, dynamicDataSource: r, gdbVersion: s, sourceSpatialReference: o, queryAttachmentsSupported: c }); + } + async addAttachment(e, i) { + await this.load(); + const r = e.attributes[this.layer.objectIdField], n = this.layer.parsedUrl.path + "/" + r + "/addAttachment", s = this._getLayerRequestOptions(), o = this._getFormDataForAttachment(i, s.query); + try { + const a = await ir(n, { body: o }); + return this._createFeatureEditResult(a.data.addAttachmentResult); + } catch (a) { + throw this._createAttachmentErrorResult(r, a); + } + } + async updateAttachment(e, i, r) { + await this.load(); + const n = e.attributes[this.layer.objectIdField], s = this.layer.parsedUrl.path + "/" + n + "/updateAttachment", o = this._getLayerRequestOptions({ query: { attachmentId: i } }), a = this._getFormDataForAttachment(r, o.query); + try { + const l = await ir(s, { body: a }); + return this._createFeatureEditResult(l.data.updateAttachmentResult); + } catch (l) { + throw this._createAttachmentErrorResult(n, l); + } + } + async applyEdits(e, i) { + await this.load(); + const r = this.layer.infoFor3D, n = _e(r), s = n || (i?.globalIdUsed ?? !1), o = e.addFeatures?.map((V) => this._serializeFeature(V, r)).filter(_e) ?? [], a = e.updateFeatures?.map((V) => this._serializeFeature(V, r)).filter(_e) ?? [], l = this._getFeatureIds(e.deleteFeatures, s); + zpt(o, a, this.layer.spatialReference); + const c = [], h = [], p = [...e.deleteAttachments ?? []]; + for (const V of e.addAttachments ?? []) + c.push(await this._serializeAttachment(V)); + for (const V of e.updateAttachments ?? []) + h.push(await this._serializeAttachment(V)); + const y = c.length || h.length || p.length ? { adds: c, updates: h, deletes: p } : null; + let v, x = null; + if (n) { + x = /* @__PURE__ */ new Map(); + const V = []; + for (const Y of e.addAssets ?? []) + V.push(this._serializeAssetMapEditAndUploadAssets(Y, x)); + const j = await Promise.all(V); + v = j.length ? { adds: j, updates: [], deletes: [] } : void 0; + } + const I = { gdbVersion: i?.gdbVersion || this.layer.gdbVersion, rollbackOnFailure: i?.rollbackOnFailureEnabled, useGlobalIds: s, returnEditMoment: i?.returnEditMoment, usePreviousEditMoment: i?.usePreviousEditMoment, sessionId: i?.sessionId }; + i?.returnServiceEditsOption ? (I.edits = JSON.stringify([{ id: this.layer.layerId, adds: o, updates: a, deletes: l, attachments: y, assetMaps: v }]), I.returnServiceEditsOption = aHi.toJSON(i?.returnServiceEditsOption), I.returnServiceEditsInSourceSR = i?.returnServiceEditsInSourceSR) : (I.adds = o.length ? JSON.stringify(o) : null, I.updates = a.length ? JSON.stringify(a) : null, I.deletes = l.length ? s ? JSON.stringify(l) : l.join(",") : null, I.attachments = y && JSON.stringify(y), I.assetMaps = _e(v) ? JSON.stringify(v) : void 0); + const P = this._getLayerRequestOptions({ method: "post", query: I }), F = i?.returnServiceEditsOption ? this.layer.url : this.layer.parsedUrl.path, k = await ir(F + "/applyEdits", P); + if (!this.layer.capabilities.operations?.supportsEditing && this.layer.effectiveCapabilities?.operations?.supportsEditing && await $o?.findCredential(this.layer.url)?.refreshToken(), n && k.data != null && k.data.assetMaps != null) { + const V = k.data, j = this.layer.objectIdField, Y = []; + for (const re of V.addResults) + re.success && Y.push(re.objectId); + for (const re of V.updateResults) + re.success && Y.push(re.objectId); + const X = this._createRequestQueryOptions(), Q = await ir(F + "/query", { ...X, query: { f: "json", formatOf3DObjects: "3D_glb", where: `OBJECTID IN (${Y.join(",")})`, outFields: `${j}` } }); + if (Q && Q.data && Q.data.assetMaps && _e(x)) { + const re = Q.data.assetMaps; + for (const he of re) { + const fe = x.get(he.parentGlobalId).geometry; + _e(fe) && fe.type === "mesh" && fe.updateExternalSource({ source: [{ name: he.assetName, source: he.assetName }], extent: fe.extent }); + } + } + } + return this._createEditsResult(k); + } + async deleteAttachments(e, i) { + await this.load(); + const r = e.attributes[this.layer.objectIdField], n = this.layer.parsedUrl.path + "/" + r + "/deleteAttachments"; + try { + return (await ir(n, this._getLayerRequestOptions({ query: { attachmentIds: i.join(",") }, method: "post" }))).data.deleteAttachmentResults.map(this._createFeatureEditResult); + } catch (s) { + throw this._createAttachmentErrorResult(r, s); + } + } + fetchRecomputedExtents(e = {}) { + const i = e.signal; + return this.load({ signal: i }).then(async () => { + const r = this._getLayerRequestOptions({ ...e, query: { returnUpdates: !0 } }), { layerId: n, url: s } = this.layer, { data: o } = await ir(`${s}/${n}`, r), { id: a, extent: l, fullExtent: c, timeExtent: h } = o, p = l || c; + return { id: a, fullExtent: p && br.fromJSON(p), timeExtent: h && Ny.fromJSON({ start: h[0], end: h[1] }) }; + }); + } + async queryAttachments(e, i = {}) { + await this.load(); + const r = this._getLayerRequestOptions(i); + return this.queryTask.executeAttachmentQuery(e, r); + } + async queryFeatures(e, i) { + return await this.load(), this.queryTask.execute(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryFeaturesJSON(e, i) { + return await this.load(), this.queryTask.executeJSON(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryObjectIds(e, i) { + return await this.load(), this.queryTask.executeForIds(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryFeatureCount(e, i) { + return await this.load(), this.queryTask.executeForCount(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryExtent(e, i) { + return await this.load(), this.queryTask.executeForExtent(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryRelatedFeatures(e, i) { + return await this.load(), this.queryTask.executeRelationshipQuery(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryRelatedFeaturesCount(e, i) { + return await this.load(), this.queryTask.executeRelationshipQueryForCount(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryTopFeatures(e, i) { + return await this.load(), this.queryTask.executeTopFeaturesQuery(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryTopObjectIds(e, i) { + return await this.load(), this.queryTask.executeForTopIds(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryTopExtents(e, i) { + return await this.load(), this.queryTask.executeForTopExtents(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async queryTopCount(e, i) { + return await this.load(), this.queryTask.executeForTopCount(e, { ...i, query: this._createRequestQueryOptions(i) }); + } + async fetchPublishingStatus() { + if (!Tz(this.layer.url)) + return "unavailable"; + const e = $d(this.layer.url, "status"), i = await ir(e, { query: { f: "json" } }); + return uHi.fromJSON(i.data.status); + } + _createRequestQueryOptions(e) { + const i = { ...this.layer.customParameters, token: this.layer.apiKey, ...e?.query }; + return this.layer.datesInUnknownTimezone && (i.timeReferenceUnknownClient = !0), i; + } + async _fetchService(e, i) { + if (!e) { + const { data: n } = await ir(this.layer.parsedUrl.path, this._getLayerRequestOptions({ query: Vi("featurelayer-advanced-symbols") ? { returnAdvancedSymbols: !0 } : {}, signal: i })); + e = n; + } + this.sourceJSON = this._patchServiceJSON(e); + const r = e.type; + if (!lHi.has(r)) + throw new ot("feature-layer-source:unsupported-type", `Source type "${r}" is not supported`); + } + _patchServiceJSON(e) { + if (e.type !== "Table" && e.geometryType && !e?.drawingInfo?.renderer && !e.defaultSymbol) { + const i = eH(e.geometryType).renderer; + lf("drawingInfo.renderer", i, e); + } + return e.geometryType === "esriGeometryMultiPatch" && e.infoFor3D && (e.geometryType = "mesh"), e; + } + _serializeFeature(e, i) { + const { geometry: r, attributes: n } = e; + if (_e(i) && _e(e.geometry) && e.geometry.type === "mesh") { + const s = { ...n }, o = e.geometry, a = o.origin, l = o.transform; + if (s[i.transformFieldRoles.originX] = a.x, s[i.transformFieldRoles.originY] = a.y, s[i.transformFieldRoles.originZ] = a.z, _e(l)) { + const c = l.translation, h = l.scale, p = l.rotation; + s[i.transformFieldRoles.translationX] = c[0], s[i.transformFieldRoles.translationY] = -c[2], s[i.transformFieldRoles.translationZ] = c[1], s[i.transformFieldRoles.scaleX] = h[0], s[i.transformFieldRoles.scaleY] = h[1], s[i.transformFieldRoles.scaleZ] = h[2], s[i.transformFieldRoles.rotationX] = p[0], s[i.transformFieldRoles.rotationY] = p[2], s[i.transformFieldRoles.rotationZ] = p[1], s[i.transformFieldRoles.rotationDeg] = p[3]; + } + return { geometry: null, attributes: s }; + } + return ut(r) ? { attributes: n } : r.type === "mesh" || r.type === "extent" ? null : { geometry: r.toJSON(), attributes: n }; + } + async _serializeAttachment(e) { + const { feature: i, attachment: r } = e, { globalId: n, name: s, contentType: o, data: a, uploadId: l } = r, c = { globalId: n, parentGlobalId: null, contentType: null, name: null, uploadId: null, data: null }; + if (i && (c.parentGlobalId = "attributes" in i ? i.attributes && i.attributes[this.layer.globalIdField] : i.globalId), l) + c.uploadId = l; + else if (a) { + const h = await get(a); + h && (c.contentType = h.mediaType, c.data = h.data), a instanceof File && (c.name = a.name); + } + return s && (c.name = s), o && (c.contentType = o), c; + } + async _serializeAssetMapEditAndUploadAssets(e, i) { + const r = this.layer.url; + let n = null; + try { + const h = new Blob([e.data], { type: e.mimeType }), p = new FormData(); + p.append("f", "json"), p.append("file", h, `${e.assetName}`); + const y = { body: p, method: "post", responseType: "json" }, { data: v } = await ir(`${r}/uploads/upload`, y); + if (!v.success) + throw new ot("feature-layer-source:upload-failure", "Expected upload to be successfull."); + n = { assetType: e.assetType, assetUploadId: v.item.itemID }; + } catch { + n = null; + } + if (ut(n)) { + const h = await get(new Blob([e.data])); + if (!h.isBase64) + throw new ot("feature-layer-source:uploadAssets-failure", "Expected gltf data in base64 format after conversion."); + n = { assetType: e.assetType, assetData: h.data }; + } + if (ut(n)) + throw new ot("feature-layer-source:uploadAssets-failure", "Unable to prepare uploadAsset request options."); + const s = { method: "post", query: { f: "json", assets: JSON.stringify([n]) }, responseType: "json" }, o = await ir($d(this.layer.parsedUrl.path, "uploadAssets"), s); + if (o.data.uploadResults.length !== 1 || !o.data.uploadResults[0].success) + throw new ot("feature-layer-source:uploadAssets-failure", "Bad response."); + const a = o.data.uploadResults[0].assetHash, l = []; + e.flags & Rfe.PROJECT_VERTICES && l.push("PROJECT_VERTICES"); + const c = { globalId: e.assetMapGlobalId, parentGlobalId: e.featureGlobalId, assetName: e.assetName, assetHash: a, flags: l }; + return i.set(e.featureGlobalId, e.feature), c; + } + _getFeatureIds(e, i) { + const r = e?.[0]; + return r ? this._canUseGlobalIds(i, e) ? this._getGlobalIdsFromFeatureIdentifier(e) : "objectId" in r ? this._getObjectIdsFromFeatureIdentifier(e) : this._getIdsFromFeatures(e) : []; + } + _getIdsFromFeatures(e) { + const i = this.layer.objectIdField; + return e.map((r) => r.attributes && r.attributes[i]); + } + _canUseGlobalIds(e, i) { + return e && "globalId" in i[0]; + } + _getObjectIdsFromFeatureIdentifier(e) { + return e.map((i) => i.objectId); + } + _getGlobalIdsFromFeatureIdentifier(e) { + return e.map((i) => i.globalId); + } + _createEditsResult(e) { + const i = e.data, { layerId: r } = this.layer, n = []; + let s = null; + if (Array.isArray(i)) + for (const l of i) + n.push({ id: l.id, editedFeatures: l.editedFeatures }), l.id === r && (s = { addResults: l.addResults ?? [], updateResults: l.updateResults ?? [], deleteResults: l.deleteResults ?? [], attachments: l.attachments, editMoment: l.editMoment }); + else + s = i; + const o = s?.attachments, a = { addFeatureResults: s?.addResults?.map(this._createFeatureEditResult, this) ?? [], updateFeatureResults: s?.updateResults?.map(this._createFeatureEditResult, this) ?? [], deleteFeatureResults: s?.deleteResults?.map(this._createFeatureEditResult, this) ?? [], addAttachmentResults: o && o.addResults ? o.addResults.map(this._createFeatureEditResult, this) : [], updateAttachmentResults: o && o.updateResults ? o.updateResults.map(this._createFeatureEditResult, this) : [], deleteAttachmentResults: o && o.deleteResults ? o.deleteResults.map(this._createFeatureEditResult, this) : [] }; + if (s?.editMoment && (a.editMoment = s.editMoment), n.length > 0) { + a.editedFeatureResults = []; + for (const l of n) { + const { editedFeatures: c } = l, h = c?.spatialReference ? new or(c.spatialReference) : null; + a.editedFeatureResults.push({ layerId: l.id, editedFeatures: { adds: c?.adds?.map((p) => this._createEditedFeature(p, h)) || [], updates: c?.updates?.map((p) => ({ original: this._createEditedFeature(p[0], h), current: this._createEditedFeature(p[1], h) })) || [], deletes: c?.deletes?.map((p) => this._createEditedFeature(p, h)) || [], spatialReference: h } }); + } + } + return a; + } + _createEditedFeature(e, i) { + return new ro({ attributes: e.attributes, geometry: Sl({ ...e.geometry, spatialReference: i }) }); + } + _createFeatureEditResult(e) { + const i = e.success === !0 ? null : e.error || { code: void 0, description: void 0 }; + return { objectId: e.objectId, globalId: e.globalId, error: i ? new ot("feature-layer-source:edit-failure", i.description, { code: i.code }) : null }; + } + _createAttachmentErrorResult(e, i) { + const r = i.details.messages && i.details.messages[0] || i.message, n = i.details.httpStatus || i.details.messageCode; + return { objectId: e, globalId: null, error: new ot("feature-layer-source:attachment-failure", r, { code: n }) }; + } + _getFormDataForAttachment(e, i) { + const r = e instanceof FormData ? e : e && e.elements ? new FormData(e) : null; + if (r) + for (const n in i) { + const s = i[n]; + s != null && (r.set ? r.set(n, s) : r.append(n, s)); + } + return r; + } + _getLayerRequestOptions(e = {}) { + const { parsedUrl: i, gdbVersion: r, dynamicDataSource: n } = this.layer; + return { ...e, query: { gdbVersion: r, layer: n ? JSON.stringify({ source: n }) : void 0, ...i.query, f: "json", ...this._createRequestQueryOptions(e) }, responseType: "json" }; + } +}; +E([N()], ZV.prototype, "type", void 0), E([N({ constructOnly: !0 })], ZV.prototype, "layer", void 0), E([N({ readOnly: !0 })], ZV.prototype, "queryTask", null), ZV = E([dt("esri.layers.graphics.sources.FeatureLayerSource")], ZV); +const cHi = ZV, UOt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: cHi +}, Symbol.toStringTag, { value: "Module" })); +function zOt(t) { + return t && "getAtOrigin" in t && "originOf" in t; +} +function yee(t) { + t && t.writtenProperties && t.writtenProperties.forEach(({ target: e, propName: i, newOrigin: r }) => { + zOt(e) && r && e.originOf(i) !== r && e.updateOrigin(i, r); + }); +} +const hHi = Ei.getLogger("esri.layers.FeatureLayer"), vMe = "Feature Service"; +function Ffe(t, e) { + return `Layer (title: ${t.title}, id: ${t.id}) of type '${t.declaredClass}' ${e}`; +} +function HOt(t, e) { + if (e.type !== vMe) + throw new ot("feature-layer:portal-item-wrong-type", Ffe(t, `should have portal item of type "${vMe}"`)); +} +async function WOt(t) { + if (await t.load(), age(t)) + throw new ot("feature-layer:save", Ffe(t, "using an in-memory source cannot be saved to a portal item")); +} +function dHi(t, e) { + let i = (t.messages ?? []).filter(({ type: r }) => r === "error").map(({ name: r, message: n, details: s }) => new ot(r, n, s)); + if (e?.ignoreUnsupported && (i = i.filter(({ name: r }) => r !== "layer:unsupported" && r !== "symbol:unsupported" && r !== "symbol-layer:unsupported" && r !== "property:unsupported" && r !== "url:unsupported")), i.length > 0) + throw new ot("feature-layer:save", "Failed to save feature layer due to unsupported or invalid content. See 'details.errors' for more detailed information", { errors: i }); +} +async function qOt(t, e, i) { + "beforeSave" in t && typeof t.beforeSave == "function" && await t.beforeSave(); + const r = t.write({}, e); + return dHi(e, i), r; +} +function YOt(t) { + const { layer: e, layerJSON: i } = t; + return e.isTable ? { layers: [], tables: [i] } : { layers: [i], tables: [] }; +} +function XOt(t) { + VIe(t, Uj.JSAPI), t.typeKeywords && (t.typeKeywords = t.typeKeywords.filter((e, i, r) => r.indexOf(e) === i)); +} +function pHi(t) { + const e = t.portalItem; + if (!e) + throw hHi.error("save: requires the portalItem property to be set"), new ot("feature-layer:portal-item-not-set", Ffe(t, "requires the portalItem property to be set")); + if (!e.loaded) + throw new ot("feature-layer:portal-item-not-loaded", Ffe(t, "cannot be saved to a portal item that does not exist or is inaccessible")); + HOt(t, e); +} +async function fHi(t, e) { + return /\/\d+\/?$/.test(t.url ?? "") ? YOt(e[0]) : mHi(t, e); +} +async function mHi(t, e) { + const { layer: { url: i, customParameters: r, apiKey: n } } = e[0]; + let s = await t.fetchData("json"); + s && s.layers != null && s.tables != null || (s = await gHi(s, { url: i ?? "", customParameters: r, apiKey: n }, e.map((o) => o.layer.layerId))); + for (const o of e) + KOt(o.layer, o.layerJSON, s); + return s; +} +async function gHi(t, e, i) { + var r, n; + t || (t = {}), (r = t).layers || (r.layers = []), (n = t).tables || (n.tables = []); + const { url: s, customParameters: o, apiKey: a } = e, { serviceJSON: l, layersJSON: c } = await l$e(s, { customParameters: o, apiKey: a }), h = yet(t.layers, l.layers, i), p = yet(t.tables, l.tables, i); + t.layers = h.itemResources, t.tables = p.itemResources; + const y = [...h.added, ...p.added], v = c ? [...c.layers, ...c.tables] : []; + return await yHi(t, y, s, v), t; +} +function yet(t, e, i) { + const r = g$t(t, e, (s, o) => s.id === o.id); + t = t.filter((s) => !r.removed.some((o) => o.id === s.id)); + const n = r.added.map(({ id: s }) => ({ id: s })); + return n.forEach(({ id: s }) => { + t.push({ id: s }); + }), { itemResources: t, added: n.filter(({ id: s }) => !i.includes(s)) }; +} +async function yHi(t, e, i, r) { + const n = e.map(({ id: s }) => new Qc({ url: i, layerId: s, sourceJSON: r.find(({ id: o }) => o === s) })); + await Nu(n.map((s) => s.load())), n.forEach((s) => { + const { layerId: o, loaded: a, defaultPopupTemplate: l } = s; + !a || ut(l) || KOt(s, { id: o, popupInfo: l.toJSON() }, t); + }); +} +function KOt(t, e, i) { + t.isTable ? vet(i.tables, e) : vet(i.layers, e); +} +function vet(t, e) { + if (!t) + return; + const i = t.findIndex(({ id: r }) => r === e.id); + i === -1 ? t.push(e) : t[i] = e; +} +function vHi(t, e) { + var i, r; + let n = Ov.from(e); + return n.id && (n = n.clone(), n.id = null), (i = n).type ?? (i.type = vMe), (r = n).portal ?? (r.portal = Ic.getDefault()), HOt(t, n), n; +} +async function _Hi(t, e) { + const { url: i, layerId: r, title: n, fullExtent: s, isTable: o } = t, a = FI(i), l = _e(a) && a.serverType === "FeatureServer"; + e.url = l ? i : `${i}/${r}`, e.title || (e.title = n), e.extent = null, !o && _e(s) && (e.extent = await TKt(s)), K7e(e, Uj.METADATA), K7e(e, Uj.MULTI_LAYER), VIe(e, Uj.SINGLE_LAYER), o && VIe(e, Uj.TABLE), XOt(e); +} +async function bHi(t, e, i) { + const r = t.portal; + await r?.signIn(), await r?.user?.addItem({ item: t, data: e, folder: i?.folder }); +} +const wHi = Fv(xHi); +async function xHi(t, e) { + await WOt(t), pHi(t); + const i = t.portalItem, r = jCt(i), n = await qOt(t, r, e), s = await fHi(i, [{ layer: t, layerJSON: n }]); + return XOt(i), await i.update({ data: s }), yee(r), i; +} +const SHi = Fv(CHi); +async function CHi(t, e, i) { + await WOt(t); + const r = vHi(t, e), n = jCt(r), s = YOt({ layer: t, layerJSON: await qOt(t, n, i) }); + return await _Hi(t, r), await bHi(r, s, i), t.portalItem = r, yee(n), r; +} +const _et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + save: wHi, + saveAs: SHi +}, Symbol.toStringTag, { value: "Module" })), Zie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + buffer: qEt, + changeDefaultSpatialReferenceTolerance: uIt, + clearDefaultSpatialReferenceTolerance: cIt, + clip: IEt, + contains: PEt, + convexHull: jEt, + crosses: OEt, + cut: AEt, + densify: iIt, + difference: GEt, + disjoint: NEt, + distance: REt, + equals: MEt, + extendedSpatialReferenceInfo: EEt, + flipHorizontal: QEt, + flipVertical: eIt, + generalize: tIt, + geodesicArea: oIt, + geodesicBuffer: YEt, + geodesicDensify: rIt, + geodesicLength: aIt, + intersect: zEt, + intersectLinesToPoints: lIt, + intersects: DEt, + isSimple: BEt, + nearestCoordinate: XEt, + nearestVertex: KEt, + nearestVertices: JEt, + offset: WEt, + overlaps: kEt, + planarArea: nIt, + planarLength: sIt, + relate: $Et, + rotate: ZEt, + simplify: VEt, + symmetricDifference: UEt, + touches: FEt, + union: HEt, + within: LEt +}, Symbol.toStringTag, { value: "Module" })); +let _Me = JOt(); +function JOt() { + return new ade(50); +} +function THi() { + _Me = JOt(); +} +function EHi(t, e) { + if (t.type === "icon") + return Z8e(t, e); + if (t.type === "object") + return Q8e(t, e); + throw new ot("symbol3d:unsupported-symbol-layer", "computeLayerSize only works with symbol layers of type Icon and Object"); +} +async function IHi(t, e) { + if (t.type === "icon") + return AHi(t, e); + if (t.type === "object") + return OHi(t, e); + throw new ot("symbol3d:unsupported-symbol-layer", "computeLayerSize only works with symbol layers of type Icon and Object"); +} +async function Z8e(t, e) { + if (t.resource?.href) + return PHi(t.resource.href).then((i) => [i.width, i.height]); + if (t.resource?.primitive) + return _e(e) ? [e, e] : [256, 256]; + throw new ot("symbol3d:invalid-symbol-layer", "symbol layers of type Icon must have either an href or a primitive resource"); +} +function AHi(t, e) { + return Z8e(t, e).then((i) => { + if (t.size == null) + return i; + const r = i[0] / i[1]; + return r > 1 ? [t.size, t.size / r] : [t.size * r, t.size]; + }); +} +function PHi(t) { + return ir(t, { responseType: "image" }).then((e) => e.data); +} +function Q8e(t, e) { + return RHi(t, e).then((i) => T7t(i)); +} +async function OHi(t, e) { + const i = await Q8e(t, e); + return R7t(i, t); +} +async function RHi(t, e) { + if (!t.isPrimitive) { + const r = Ru(t.resource?.href), n = _Me.get(r); + if (n !== void 0) + return n; + const s = await Promise.resolve().then(() => Y4r), o = await s.fetch(r, { disableTextures: !0 }); + return _Me.put(r, o.referenceBoundingBox), o.referenceBoundingBox; + } + let i = null; + if (t.resource && t.resource.primitive && (i = Sx(L7t(t.resource.primitive)), _e(e))) + for (let r = 0; r < i.length; r++) + i[r] *= e; + return i ? Promise.resolve(i) : Promise.reject(new ot("symbol:invalid-resource", "The symbol does not have a valid resource")); +} +const MHi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + clearBoundingBoxCache: THi, + computeIconLayerResourceSize: Z8e, + computeLayerResourceSize: EHi, + computeLayerSize: IHi, + computeObjectLayerResourceSize: Q8e +}, Symbol.toStringTag, { value: "Module" })); +function DHi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var bet, cq, wet, Lfe = {}; +bet = { get exports() { + return Lfe; +}, set exports(t) { + Lfe = t; +} }, cq = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0, typeof __filename < "u" && (cq = cq || __filename), wet = function(t) { + var e, i; + (t = (t = t || {}) !== void 0 ? t : {}).ready = new Promise(function(A, ve) { + e = A, i = ve; + }); + var r, n, s, o, a, l, c = Object.assign({}, t), h = typeof window == "object", p = typeof importScripts == "function", y = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", v = ""; + function x(A) { + return t.locateFile ? t.locateFile(A, v) : v + A; + } + y ? (v = p ? require("path").dirname(v) + "/" : __dirname + "/", l = () => { + a || (o = require("fs"), a = require("path")); + }, r = function(A, ve) { + return l(), A = a.normalize(A), o.readFileSync(A, ve ? void 0 : "utf8"); + }, s = (A) => { + var ve = r(A, !0); + return ve.buffer || (ve = new Uint8Array(ve)), ve; + }, n = (A, ve, H) => { + l(), A = a.normalize(A), o.readFile(A, function(T, b) { + T ? H(T) : ve(b.buffer); + }); + }, process.argv.length > 1 && process.argv[1].replace(/\\/g, "/"), process.argv.slice(2), process.on("uncaughtException", function(A) { + if (!(A instanceof Ue)) + throw A; + }), process.on("unhandledRejection", function(A) { + throw A; + }), t.inspect = function() { + return "[Emscripten Module object]"; + }) : (h || p) && (p ? v = self.location.href : typeof document < "u" && document.currentScript && (v = document.currentScript.src), cq && (v = cq), v = v.indexOf("blob:") !== 0 ? v.substr(0, v.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", r = (A) => { + var ve = new XMLHttpRequest(); + return ve.open("GET", A, !1), ve.send(null), ve.responseText; + }, p && (s = (A) => { + var ve = new XMLHttpRequest(); + return ve.open("GET", A, !1), ve.responseType = "arraybuffer", ve.send(null), new Uint8Array(ve.response); + }), n = (A, ve, H) => { + var T = new XMLHttpRequest(); + T.open("GET", A, !0), T.responseType = "arraybuffer", T.onload = () => { + T.status == 200 || T.status == 0 && T.response ? ve(T.response) : H(); + }, T.onerror = H, T.send(null); + }), t.print || console.log.bind(console); + var I, P, F = t.printErr || console.warn.bind(console); + Object.assign(t, c), c = null, t.arguments && t.arguments, t.thisProgram && t.thisProgram, t.quit && t.quit, t.wasmBinary && (I = t.wasmBinary), t.noExitRuntime, typeof WebAssembly != "object" && ft("no native wasm support detected"); + var k, V, j, Y, X, Q, re = !1, he = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0; + function fe(A, ve, H) { + for (var T = ve + H, b = ve; A[b] && !(b >= T); ) + ++b; + if (b - ve > 16 && A.buffer && he) + return he.decode(A.subarray(ve, b)); + for (var m = ""; ve < b; ) { + var _ = A[ve++]; + if (128 & _) { + var C = 63 & A[ve++]; + if ((224 & _) != 192) { + var D = 63 & A[ve++]; + if ((_ = (240 & _) == 224 ? (15 & _) << 12 | C << 6 | D : (7 & _) << 18 | C << 12 | D << 6 | 63 & A[ve++]) < 65536) + m += String.fromCharCode(_); + else { + var L = _ - 65536; + m += String.fromCharCode(55296 | L >> 10, 56320 | 1023 & L); + } + } else + m += String.fromCharCode((31 & _) << 6 | C); + } else + m += String.fromCharCode(_); + } + return m; + } + function be(A, ve) { + return A ? fe(j, A, ve) : ""; + } + function Se(A) { + k = A, t.HEAP8 = V = new Int8Array(A), t.HEAP16 = new Int16Array(A), t.HEAP32 = Y = new Int32Array(A), t.HEAPU8 = j = new Uint8Array(A), t.HEAPU16 = new Uint16Array(A), t.HEAPU32 = X = new Uint32Array(A), t.HEAPF32 = new Float32Array(A), t.HEAPF64 = new Float64Array(A); + } + t.INITIAL_MEMORY; + var Me = [], ke = [], J = []; + function ce() { + if (t.preRun) + for (typeof t.preRun == "function" && (t.preRun = [t.preRun]); t.preRun.length; ) + Oe(t.preRun.shift()); + Be(Me); + } + function xe() { + Be(ke); + } + function Pe() { + if (t.postRun) + for (typeof t.postRun == "function" && (t.postRun = [t.postRun]); t.postRun.length; ) + Ge(t.postRun.shift()); + Be(J); + } + function Oe(A) { + Me.unshift(A); + } + function Re(A) { + ke.unshift(A); + } + function Ge(A) { + J.unshift(A); + } + var je = 0, et = null; + function Qe(A) { + je++, t.monitorRunDependencies && t.monitorRunDependencies(je); + } + function tt(A) { + if (je--, t.monitorRunDependencies && t.monitorRunDependencies(je), je == 0 && et) { + var ve = et; + et = null, ve(); + } + } + function ft(A) { + t.onAbort && t.onAbort(A), F(A = "Aborted(" + A + ")"), re = !0, A += ". Build with -sASSERTIONS for more info."; + var ve = new WebAssembly.RuntimeError(A); + throw i(ve), ve; + } + var Mt, kt = "data:application/octet-stream;base64,"; + function Tt(A) { + return A.startsWith(kt); + } + function It(A) { + return A.startsWith("file://"); + } + function Nt(A) { + try { + if (A == Mt && I) + return new Uint8Array(I); + if (s) + return s(A); + throw "both async and sync fetching of the wasm failed"; + } catch (ve) { + ft(ve); + } + } + function nt() { + if (!I && (h || p)) { + if (typeof fetch == "function" && !It(Mt)) + return fetch(Mt, { credentials: "same-origin" }).then(function(A) { + if (!A.ok) + throw "failed to load wasm binary file at '" + Mt + "'"; + return A.arrayBuffer(); + }).catch(function() { + return Nt(Mt); + }); + if (n) + return new Promise(function(A, ve) { + n(Mt, function(H) { + A(new Uint8Array(H)); + }, ve); + }); + } + return Promise.resolve().then(function() { + return Nt(Mt); + }); + } + function Ee() { + var A = { a: He }; + function ve(m, _) { + var C = m.exports; + t.asm = C, Se((P = t.asm.g).buffer), Q = t.asm.m, Re(t.asm.h), tt(); + } + function H(m) { + ve(m.instance); + } + function T(m) { + return nt().then(function(_) { + return WebAssembly.instantiate(_, A); + }).then(function(_) { + return _; + }).then(m, function(_) { + F("failed to asynchronously prepare wasm: " + _), ft(_); + }); + } + function b() { + return I || typeof WebAssembly.instantiateStreaming != "function" || Tt(Mt) || It(Mt) || y || typeof fetch != "function" ? T(H) : fetch(Mt, { credentials: "same-origin" }).then(function(m) { + return WebAssembly.instantiateStreaming(m, A).then(H, function(_) { + return F("wasm streaming compile failed: " + _), F("falling back to ArrayBuffer instantiation"), T(H); + }); + }); + } + if (Qe(), t.instantiateWasm) + try { + return t.instantiateWasm(A, ve); + } catch (m) { + return F("Module.instantiateWasm callback failed with error: " + m), !1; + } + return b().catch(i), {}; + } + function Be(A) { + for (; A.length > 0; ) { + var ve = A.shift(); + if (typeof ve != "function") { + var H = ve.func; + typeof H == "number" ? ve.arg === void 0 ? wt(H)() : wt(H)(ve.arg) : H(ve.arg === void 0 ? null : ve.arg); + } else + ve(t); + } + } + Tt(Mt = "lerc-wasm.wasm") || (Mt = x(Mt)); + var at = []; + function wt(A) { + var ve = at[A]; + return ve || (A >= at.length && (at.length = A + 1), at[A] = ve = Q.get(A)), ve; + } + function st(A, ve, H, T) { + ft("Assertion failed: " + be(A) + ", at: " + [ve ? be(ve) : "unknown filename", H, T ? be(T) : "unknown function"]); + } + function le(A) { + return Ft(A + 24) + 24; + } + function ct(A) { + this.excPtr = A, this.ptr = A - 24, this.set_type = function(ve) { + X[this.ptr + 4 >> 2] = ve; + }, this.get_type = function() { + return X[this.ptr + 4 >> 2]; + }, this.set_destructor = function(ve) { + X[this.ptr + 8 >> 2] = ve; + }, this.get_destructor = function() { + return X[this.ptr + 8 >> 2]; + }, this.set_refcount = function(ve) { + Y[this.ptr >> 2] = ve; + }, this.set_caught = function(ve) { + ve = ve ? 1 : 0, V[this.ptr + 12 >> 0] = ve; + }, this.get_caught = function() { + return V[this.ptr + 12 >> 0] != 0; + }, this.set_rethrown = function(ve) { + ve = ve ? 1 : 0, V[this.ptr + 13 >> 0] = ve; + }, this.get_rethrown = function() { + return V[this.ptr + 13 >> 0] != 0; + }, this.init = function(ve, H) { + this.set_adjusted_ptr(0), this.set_type(ve), this.set_destructor(H), this.set_refcount(0), this.set_caught(!1), this.set_rethrown(!1); + }, this.add_ref = function() { + var ve = Y[this.ptr >> 2]; + Y[this.ptr >> 2] = ve + 1; + }, this.release_ref = function() { + var ve = Y[this.ptr >> 2]; + return Y[this.ptr >> 2] = ve - 1, ve === 1; + }, this.set_adjusted_ptr = function(ve) { + X[this.ptr + 16 >> 2] = ve; + }, this.get_adjusted_ptr = function() { + return X[this.ptr + 16 >> 2]; + }, this.get_exception_ptr = function() { + if (mt(this.get_type())) + return X[this.excPtr >> 2]; + var ve = this.get_adjusted_ptr(); + return ve !== 0 ? ve : this.excPtr; + }; + } + function gt(A, ve, H) { + throw new ct(A).init(ve, H), A; + } + function Ne() { + ft(""); + } + function pe(A, ve, H) { + j.copyWithin(A, ve, ve + H); + } + function Ae() { + return 2147483648; + } + function it(A) { + try { + return P.grow(A - k.byteLength + 65535 >>> 16), Se(P.buffer), 1; + } catch { + } + } + function yt(A) { + var ve = j.length; + A >>>= 0; + var H = Ae(); + if (A > H) + return !1; + let T = (_, C) => _ + (C - _ % C) % C; + for (var b = 1; b <= 4; b *= 2) { + var m = ve * (1 + 0.2 / b); + if (m = Math.min(m, A + 100663296), it(Math.min(H, T(Math.max(A, m), 65536)))) + return !0; + } + return !1; + } + var He = { a: st, c: le, b: gt, d: Ne, f: pe, e: yt }; + Ee(), t.___wasm_call_ctors = function() { + return (t.___wasm_call_ctors = t.asm.h).apply(null, arguments); + }, t._lerc_getBlobInfo = function() { + return (t._lerc_getBlobInfo = t.asm.i).apply(null, arguments); + }, t._lerc_getDataRanges = function() { + return (t._lerc_getDataRanges = t.asm.j).apply(null, arguments); + }, t._lerc_decode = function() { + return (t._lerc_decode = t.asm.k).apply(null, arguments); + }, t._lerc_decode_4D = function() { + return (t._lerc_decode_4D = t.asm.l).apply(null, arguments); + }; + var Ft = t._malloc = function() { + return (Ft = t._malloc = t.asm.n).apply(null, arguments); + }; + t._free = function() { + return (t._free = t.asm.o).apply(null, arguments); + }; + var ei, mt = t.___cxa_is_pointer_type = function() { + return (mt = t.___cxa_is_pointer_type = t.asm.p).apply(null, arguments); + }; + function Ue(A) { + this.name = "ExitStatus", this.message = "Program terminated with exit(" + A + ")", this.status = A; + } + function si(A) { + function ve() { + ei || (ei = !0, t.calledRun = !0, re || (xe(), e(t), t.onRuntimeInitialized && t.onRuntimeInitialized(), Pe())); + } + je > 0 || (ce(), je > 0 || (t.setStatus ? (t.setStatus("Running..."), setTimeout(function() { + setTimeout(function() { + t.setStatus(""); + }, 1), ve(); + }, 1)) : ve())); + } + if (et = function A() { + ei || si(), ei || (et = A); + }, t.run = si, t.preInit) + for (typeof t.preInit == "function" && (t.preInit = [t.preInit]); t.preInit.length > 0; ) + t.preInit.pop()(); + return si(), t.ready; +}, bet.exports = wet; +const FHi = DHi({ __proto__: null, default: Lfe }, [Lfe]), LHi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + l: FHi +}, Symbol.toStringTag, { value: "Module" })); +var QV; +const Lxe = /* @__PURE__ */ new WeakMap(); +let NHi = 0, GT = QV = class extends $i { + constructor(t) { + super(t), this.wrap = "repeat"; + } + get url() { + return this._get("url") || null; + } + set url(t) { + this._set("url", t), t && this._set("data", null); + } + get data() { + return this._get("data") || null; + } + set data(t) { + this._set("data", t), t && this._set("url", null); + } + writeData(t, e, i, r) { + if (t instanceof HTMLImageElement) { + const n = { type: "image-element", src: US(t.src, r), crossOrigin: t.crossOrigin }; + e[i] = n; + } else if (t instanceof HTMLCanvasElement) { + const n = t.getContext("2d").getImageData(0, 0, t.width, t.height), s = { type: "canvas-element", imageData: this._encodeImageData(n) }; + e[i] = s; + } else if (t instanceof HTMLVideoElement) { + const n = { type: "video-element", src: US(t.src, r), autoplay: t.autoplay, loop: t.loop, muted: t.muted, crossOrigin: t.crossOrigin, preload: t.preload }; + e[i] = n; + } else if (t instanceof ImageData) { + const n = { type: "image-data", imageData: this._encodeImageData(t) }; + e[i] = n; + } + } + readData(t) { + switch (t.type) { + case "image-element": { + const e = new Image(); + return e.src = t.src, e.crossOrigin = t.crossOrigin, e; + } + case "canvas-element": { + const e = this._decodeImageData(t.imageData), i = document.createElement("canvas"); + return i.width = e.width, i.height = e.height, i.getContext("2d").putImageData(e, 0, 0), i; + } + case "image-data": + return this._decodeImageData(t.imageData); + case "video-element": { + const e = document.createElement("video"); + return e.src = t.src, e.crossOrigin = t.crossOrigin, e.autoplay = t.autoplay, e.loop = t.loop, e.muted = t.muted, e.preload = t.preload, e; + } + default: + return; + } + } + get transparent() { + const t = this.data, e = this.url; + if (t instanceof HTMLCanvasElement) + return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0, 0, t.width, t.height)); + if (t instanceof ImageData) + return this._imageDataContainsTransparent(t); + if (e) { + const i = e.substr(e.length - 4, 4).toLowerCase(), r = e.substr(0, 15).toLocaleLowerCase(); + if (i === ".png" || r === "data:image/png;") + return !0; + } + return !1; + } + set transparent(t) { + this._overrideIfSome("transparent", t); + } + get contentHash() { + const t = typeof this.wrap == "string" ? this.wrap : typeof this.wrap == "object" ? `${this.wrap.horizontal}/${this.wrap.vertical}` : "", e = (i = "") => `d:${i},t:${this.transparent},w:${t}`; + return this.url != null ? e(this.url) : this.data != null ? this.data instanceof HTMLImageElement || this.data instanceof HTMLVideoElement ? e(this.data.src) : (Lxe.has(this.data) || Lxe.set(this.data, ++NHi), e(Lxe.get(this.data))) : e(); + } + clone() { + const t = { url: this.url, data: this.data, wrap: this._cloneWrap() }; + return new QV(t); + } + cloneWithDeduplication(t) { + const e = t.get(this); + if (e) + return e; + const i = this.clone(); + return t.set(this, i), i; + } + _cloneWrap() { + return typeof this.wrap == "string" ? this.wrap : { horizontal: this.wrap.horizontal, vertical: this.wrap.vertical }; + } + _encodeImageData(t) { + let e = ""; + for (let i = 0; i < t.data.length; i++) + e += String.fromCharCode(t.data[i]); + return { data: btoa(e), width: t.width, height: t.height }; + } + _decodeImageData(t) { + const e = atob(t.data), i = new Uint8ClampedArray(e.length); + for (let r = 0; r < e.length; r++) + i[r] = e.charCodeAt(r); + return Dhi(i, t.width, t.height); + } + _imageDataContainsTransparent(t) { + for (let e = 3; e < t.data.length; e += 4) + if (t.data[e] !== 255) + return !0; + return !1; + } + static from(t) { + return typeof t == "string" ? new QV({ url: t }) : t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof ImageData || t instanceof HTMLVideoElement ? new QV({ data: t }) : Qd(QV, t); + } +}; +E([N({ type: String, json: { write: UO } })], GT.prototype, "url", null), E([N({ json: { write: { overridePolicy() { + return { enabled: !this.url }; +} } } }), N()], GT.prototype, "data", null), E([mr("data")], GT.prototype, "writeData", null), E([Li("data")], GT.prototype, "readData", null), E([N({ type: Boolean, json: { write: { overridePolicy() { + return { enabled: this._isOverridden("transparent") }; +} } } })], GT.prototype, "transparent", null), E([N({ json: { write: !0 } })], GT.prototype, "wrap", void 0), E([N({ readOnly: !0 })], GT.prototype, "contentHash", null), GT = QV = E([dt("esri.geometry.support.MeshTexture")], GT); +const b7 = GT; +var bMe; +let z2 = bMe = class extends $i { + constructor(t) { + super(t), this.color = null, this.colorTexture = null, this.normalTexture = null, this.alphaMode = "auto", this.alphaCutoff = 0.5, this.doubleSided = !0; + } + clone() { + return this.cloneWithDeduplication(null, /* @__PURE__ */ new Map()); + } + cloneWithDeduplication(t, e) { + const i = _e(t) ? t.get(this) : null; + if (i) + return i; + const r = new bMe(this.clonePropertiesWithDeduplication(e)); + return _e(t) && t.set(this, r), r; + } + clonePropertiesWithDeduplication(t) { + return { color: _e(this.color) ? this.color.clone() : null, colorTexture: _e(this.colorTexture) ? this.colorTexture.cloneWithDeduplication(t) : null, normalTexture: _e(this.normalTexture) ? this.normalTexture.cloneWithDeduplication(t) : null, alphaMode: this.alphaMode, alphaCutoff: this.alphaCutoff, doubleSided: this.doubleSided, colorTextureTransform: _e(this.colorTextureTransform) ? this.colorTextureTransform : null, normalTextureTransform: _e(this.normalTextureTransform) ? this.normalTextureTransform : null }; + } +}; +E([N({ type: Wr, json: { write: !0 } })], z2.prototype, "color", void 0), E([N({ type: b7, json: { write: !0 } })], z2.prototype, "colorTexture", void 0), E([N({ type: b7, json: { write: !0 } })], z2.prototype, "normalTexture", void 0), E([N({ nonNullable: !0, json: { write: !0 } })], z2.prototype, "alphaMode", void 0), E([N({ nonNullable: !0, json: { write: !0 } })], z2.prototype, "alphaCutoff", void 0), E([N({ nonNullable: !0, json: { write: !0 } })], z2.prototype, "doubleSided", void 0), E([N()], z2.prototype, "colorTextureTransform", void 0), E([N()], z2.prototype, "normalTextureTransform", void 0), z2 = bMe = E([dt("esri.geometry.support.MeshMaterial")], z2); +const e9e = z2; +var wMe; +let Rw = wMe = class extends e9e { + constructor(t) { + super(t), this.emissiveColor = null, this.emissiveTexture = null, this.occlusionTexture = null, this.metallic = 1, this.roughness = 1, this.metallicRoughnessTexture = null; + } + clone() { + return this.cloneWithDeduplication(null, /* @__PURE__ */ new Map()); + } + cloneWithDeduplication(t, e) { + const i = _e(t) ? t.get(this) : null; + if (i) + return i; + const r = new wMe(this.clonePropertiesWithDeduplication(e)); + return _e(t) && t.set(this, r), r; + } + clonePropertiesWithDeduplication(t) { + return { ...super.clonePropertiesWithDeduplication(t), emissiveColor: _e(this.emissiveColor) ? this.emissiveColor.clone() : null, emissiveTexture: _e(this.emissiveTexture) ? this.emissiveTexture.cloneWithDeduplication(t) : null, occlusionTexture: _e(this.occlusionTexture) ? this.occlusionTexture.cloneWithDeduplication(t) : null, metallic: this.metallic, roughness: this.roughness, metallicRoughnessTexture: _e(this.metallicRoughnessTexture) ? this.metallicRoughnessTexture.cloneWithDeduplication(t) : null, occlusionTextureTransform: _e(this.occlusionTextureTransform) ? this.occlusionTextureTransform : null, emissiveTextureTransform: _e(this.emissiveTextureTransform) ? this.emissiveTextureTransform : null, metallicRoughnessTextureTransform: _e(this.metallicRoughnessTextureTransform) ? this.metallicRoughnessTextureTransform : null }; + } +}; +E([N({ type: Wr, json: { write: !0 } })], Rw.prototype, "emissiveColor", void 0), E([N({ type: b7, json: { write: !0 } })], Rw.prototype, "emissiveTexture", void 0), E([N({ type: b7, json: { write: !0 } })], Rw.prototype, "occlusionTexture", void 0), E([N({ type: Number, nonNullable: !0, json: { write: !0 }, range: { min: 0, max: 1 } })], Rw.prototype, "metallic", void 0), E([N({ type: Number, nonNullable: !0, json: { write: !0 }, range: { min: 0, max: 1 } })], Rw.prototype, "roughness", void 0), E([N({ type: b7, json: { write: !0 } })], Rw.prototype, "metallicRoughnessTexture", void 0), E([N()], Rw.prototype, "occlusionTextureTransform", void 0), E([N()], Rw.prototype, "emissiveTextureTransform", void 0), E([N()], Rw.prototype, "metallicRoughnessTextureTransform", void 0), Rw = wMe = E([dt("esri.geometry.support.MeshMaterialMetallicRoughness")], Rw); +const t9e = Rw; +var yce; +const ZOt = "esri.geometry.support.MeshVertexAttributes", bB = Ei.getLogger(ZOt); +let sy = yce = class extends $i { + constructor(t) { + super(t), this.color = null, this.position = new Float64Array(0), this.uv = null, this.normal = null, this.tangent = null; + } + castColor(t) { + return ej(t, Uint8Array, [Uint8ClampedArray], { loggerTag: ".color=", stride: 4 }, bB); + } + castPosition(t) { + return t && t instanceof Float32Array && bB.warn(".position=", "Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array"), ej(t, Float64Array, [Float32Array], { loggerTag: ".position=", stride: 3 }, bB); + } + castUv(t) { + return ej(t, Float32Array, [Float64Array], { loggerTag: ".uv=", stride: 2 }, bB); + } + castNormal(t) { + return ej(t, Float32Array, [Float64Array], { loggerTag: ".normal=", stride: 3 }, bB); + } + castTangent(t) { + return ej(t, Float32Array, [Float64Array], { loggerTag: ".tangent=", stride: 4 }, bB); + } + clone() { + const t = { position: fi(this.position), uv: fi(this.uv), normal: fi(this.normal), tangent: fi(this.tangent), color: fi(this.color) }; + return new yce(t); + } + clonePositional() { + const t = { position: fi(this.position), normal: fi(this.normal), tangent: fi(this.tangent), uv: this.uv, color: this.color }; + return new yce(t); + } +}; +function Nxe(t, e, i, r) { + const { loggerTag: n, stride: s } = e; + return t.length % s != 0 ? (r.error(n, `Invalid array length, expected a multiple of ${s}`), new i([])) : t; +} +function ej(t, e, i, r, n) { + if (!t) + return t; + if (t instanceof e) + return Nxe(t, r, e, n); + for (const s of i) + if (t instanceof s) + return Nxe(new e(t), r, e, n); + if (Array.isArray(t)) + return Nxe(new e(t), r, e, n); + { + const s = i.map((o) => `'${o.name}'`); + return n.error(`Failed to set property, expected one of ${s}, but got ${t.constructor.name}`), new e([]); + } +} +function hq(t, e, i) { + e[i] = kHi(t); +} +function kHi(t) { + const e = new Array(t.length); + for (let i = 0; i < t.length; i++) + e[i] = t[i]; + return e; +} +E([N({ json: { write: hq } })], sy.prototype, "color", void 0), E([uo("color")], sy.prototype, "castColor", null), E([N({ nonNullable: !0, json: { write: hq } })], sy.prototype, "position", void 0), E([uo("position")], sy.prototype, "castPosition", null), E([N({ json: { write: hq } })], sy.prototype, "uv", void 0), E([uo("uv")], sy.prototype, "castUv", null), E([N({ json: { write: hq } })], sy.prototype, "normal", void 0), E([uo("normal")], sy.prototype, "castNormal", null), E([N({ json: { write: hq } })], sy.prototype, "tangent", void 0), E([uo("tangent")], sy.prototype, "castTangent", null), sy = yce = E([dt(ZOt)], sy); +var IX; +const QOt = "esri.geometry.support.MeshComponent", $Hi = Ei.getLogger(QOt); +let pP = IX = class extends $i { + static from(t) { + return Qd(IX, t); + } + constructor(t) { + super(t), this.faces = null, this.material = null, this.shading = "source", this.trustSourceNormals = !1; + } + castFaces(t) { + return ej(t, Uint32Array, [Uint16Array], { loggerTag: ".faces=", stride: 3 }, $Hi); + } + castMaterial(t) { + return Qd(t && typeof t == "object" && ("metallic" in t || "roughness" in t || "metallicRoughnessTexture" in t) ? t9e : e9e, t); + } + clone() { + return new IX({ faces: fi(this.faces), shading: this.shading, material: fi(this.material), trustSourceNormals: this.trustSourceNormals }); + } + cloneWithDeduplication(t, e) { + const i = { faces: fi(this.faces), shading: this.shading, material: this.material ? this.material.cloneWithDeduplication(t, e) : null, trustSourceNormals: this.trustSourceNormals }; + return new IX(i); + } +}; +E([N({ json: { write: !0 } })], pP.prototype, "faces", void 0), E([uo("faces")], pP.prototype, "castFaces", null), E([N({ type: e9e, json: { write: !0 } })], pP.prototype, "material", void 0), E([uo("material")], pP.prototype, "castMaterial", null), E([N({ type: String, json: { write: !0 } })], pP.prototype, "shading", void 0), E([N({ type: Boolean })], pP.prototype, "trustSourceNormals", void 0), pP = IX = E([dt(QOt)], pP); +const U$ = pP; +function e3t(t, e = !1) { + return t <= Z6 ? e ? new Array(t).fill(0) : new Array(t) : new Float64Array(t); +} +function BHi(t, e, i) { + return Array.isArray(t) ? t.slice(e, e + i) : t.subarray(e, e + i); +} +function VHi(t) { + const e = GHi(t.rings, t.hasZ, Nfe.CCW_IS_HOLE), i = new Array(); + let r = 0, n = 0; + for (const a of e.polygons) { + const l = a.count, c = a.index, h = BHi(e.position, 3 * c, 3 * l), p = a.holeIndices.map((v) => v - c), y = new Uint32Array(ZU(h, p, 3)); + i.push({ position: h, faces: y }), r += h.length, n += y.length; + } + const s = jHi(i, r, n), o = Array.isArray(s.position) ? q3e(s.position, 3, { originalIndices: s.faces }) : q3e(s.position.buffer, 6, { originalIndices: s.faces }); + return s.position = new Float64Array(o.buffer), s.faces = o.indices, s; +} +function jHi(t, e, i) { + if (t.length === 1) + return t[0]; + const r = e3t(e), n = new Uint32Array(i); + let s = 0, o = 0, a = 0; + for (const l of t) { + for (let c = 0; c < l.position.length; c++) + r[s++] = l.position[c]; + for (let c = 0; c < l.faces.length; c++) + n[o++] = l.faces[c] + a; + a = s / 3; + } + return { position: r, faces: n }; +} +function GHi(t, e, i) { + const r = t.length, n = new Array(r), s = new Array(r), o = new Array(r); + let a = 0, l = 0, c = 0, h = 0; + for (let v = 0; v < r; ++v) + h += t[v].length; + const p = e3t(3 * h); + let y = 0; + for (let v = r - 1; v >= 0; v--) { + const x = t[v], I = i === Nfe.CCW_IS_HOLE && UHi(x); + if (I && r !== 1) + n[a++] = x; + else { + let P = x.length; + for (let k = 0; k < a; ++k) + P += n[k].length; + const F = { index: y, pathLengths: new Array(a + 1), count: P, holeIndices: new Array(a) }; + F.pathLengths[0] = x.length, x.length > 0 && (o[c++] = { index: y, count: x.length }), y = I ? Boe(x, x.length - 1, -1, p, y, x.length, e) : Boe(x, 0, 1, p, y, x.length, e); + for (let k = 0; k < a; ++k) { + const V = n[k]; + F.holeIndices[k] = y, F.pathLengths[k + 1] = V.length, V.length > 0 && (o[c++] = { index: y, count: V.length }), y = Boe(V, 0, 1, p, y, V.length, e); + } + a = 0, F.count > 0 && (s[l++] = F); + } + } + for (let v = 0; v < a; ++v) { + const x = n[v]; + x.length > 0 && (o[c++] = { index: y, count: x.length }), y = Boe(x, 0, 1, p, y, x.length, e); + } + return s.length = l, o.length = c, { position: p, polygons: s, outlines: o }; +} +function Boe(t, e, i, r, n, s, o) { + n *= 3; + for (let a = 0; a < s; ++a) { + const l = t[e]; + r[n++] = l[0], r[n++] = l[1], r[n++] = o ? l[2] : 0, e += i; + } + return n / 3; +} +function UHi(t) { + return !kte(t, !1, !1); +} +var Nfe; +(function(t) { + t[t.NONE = 0] = "NONE", t[t.CCW_IS_HOLE = 1] = "CCW_IS_HOLE"; +})(Nfe || (Nfe = {})); +const xMe = Ei.getLogger("esri.geometry.support.meshUtils.centerAt"); +function zHi(t, e, i) { + if (!t.vertexAttributes || !t.vertexAttributes.position) + return; + const r = i?.origin ?? t.origin; + _e(t.transform) ? (i?.geographic != null && i.geographic !== t.transform.geographic && xMe.warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`), HHi(t.transform, e, r)) : S8(t.spatialReference, i) ? WHi(t, e, r) : qHi(t, e, r); +} +function HHi(t, e, i) { + const r = e.x - i.x, n = e.y - i.y, s = e.hasZ && i.hasZ ? e.z - i.z : 0, o = t.origin; + t.origin = [o[0] + r, o[1] + n, o[2] + s]; +} +function WHi(t, e, i) { + const r = Q3e(t.vertexAttributes, i, { geographic: !0 }), { position: n, normal: s, tangent: o } = g8e(r, e, { geographic: !0 }); + t.vertexAttributes.position = n, t.vertexAttributes.normal = s, t.vertexAttributes.tangent = o, t.vertexAttributesChanged(); +} +function qHi(t, e, i) { + const r = KHi, n = XHi; + if (NF(e, n, t.spatialReference)) { + if (!NF(i, r, t.spatialReference)) { + const s = t.origin; + r[0] = s.x, r[1] = s.y, r[2] = s.z, xMe.error(`Failed to project specified origin (wkid:${i.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}).`); + } + YHi(t.vertexAttributes.position, n, r), t.vertexAttributesChanged(); + } else + xMe.error(`Failed to project centerAt location (wkid:${e.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid})`); +} +function YHi(t, e, i) { + if (t) + for (let r = 0; r < t.length; r += 3) + for (let n = 0; n < 3; n++) + t[r + n] += e[n] - i[n]; +} +const XHi = sn(), KHi = sn(); +async function JHi(t, e, i) { + const { loadGLTFMesh: r } = await hy(Promise.resolve().then(() => ENt), i), n = await t3t(e, i), s = r(new Xi({ x: 0, y: 0, z: 0, spatialReference: t.spatialReference }), n.url, { resolveFile: ZHi(n), useTransform: !0, signal: _e(i) ? i.signal : null }); + s.then(() => n.dispose(), () => n.dispose()); + const { vertexAttributes: o, components: a } = await s; + t.vertexAttributes = o, t.components = a; +} +function ZHi(t) { + const e = Dte(t.url); + return (i) => { + const r = nge(i, e, e), n = r ? r.replace(/^ *\.\//, "") : null; + return (n ? t.files.get(n) : null) ?? i; + }; +} +async function t3t(t, e) { + return t instanceof Blob ? kfe.fromBlob(t) : typeof t == "string" ? new kfe(t) : Array.isArray(t) ? QHi(t, e) : eWi(t, e); +} +async function QHi(t, e) { + const i = /* @__PURE__ */ new Map(); + let r = null; + const n = await DZ(t.map(async (o) => ({ name: o.name, source: await t3t(o instanceof Blob ? o : o.source, e) }))), s = []; + for (const o of n) + o && (rg(e) ? o.source.dispose() : s.push(o)); + hn(e); + for (const { name: o, source: a } of s) + (ut(r) || /\.(gltf|glb)/i.test(o)) && (r = a.url), i.set(o, a.url), a.files && a.files.forEach((l, c) => i.set(c, l)); + if (ut(r)) + throw new ot("mesh-load-external:missing-files", "Missing files to load external mesh source"); + return new kfe(r, () => s.forEach(({ source: o }) => o.dispose()), i); +} +async function eWi(t, e) { + const { default: i } = await hy(Promise.resolve().then(() => $4e), e), r = typeof t.multipart[0] == "string" ? await Promise.all(t.multipart.map(async (n) => (await i(n, { responseType: "array-buffer" })).data)) : t.multipart; + return kfe.fromBlob(new Blob(r)); +} +let kfe = class i3t { + constructor(e, i = () => { + }, r = /* @__PURE__ */ new Map()) { + this.url = e, this.dispose = i, this.files = r; + } + static fromBlob(e) { + const i = URL.createObjectURL(e); + return new i3t(i, () => URL.revokeObjectURL(i)); + } +}; +function tWi(t, e, i) { + t.vertexAttributes && t.vertexAttributes.position && (_e(t.transform) ? (i?.geographic != null && i.geographic !== t.transform.geographic && Ei.getLogger("esri.geometry.support.meshUtils.offset").warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`), iWi(t.transform, e)) : S8(t.spatialReference, i) ? rWi(t, e) : nWi(t, e)); +} +function iWi(t, e) { + const i = t.origin; + t.origin = Zc(sn(), i, e); +} +function rWi(t, e) { + const i = t.spatialReference, r = t.vertexAttributes.position, n = t.vertexAttributes.normal, s = t.vertexAttributes.tangent, o = new Float64Array(r.length), a = _e(n) ? new Float32Array(n.length) : null, l = _e(s) ? new Float32Array(s.length) : null, c = t.extent.center, h = sWi; + iU(i, [c.x, c.y, c.z], xet, j4(i)), xQ(Cet, xet), nI(h, e, Cet), ive(r, i, o), _e(n) && _e(a) && eve(n, r, o, i, a), _e(s) && _e(l) && nve(s, r, o, i, l), r3t(o, h), rve(o, r, i), _e(n) && _e(a) && tve(a, r, o, i, n), _e(s) && _e(l) && sve(l, r, o, i, s), t.vertexAttributesChanged(); +} +function nWi(t, e) { + r3t(t.vertexAttributes.position, e), t.vertexAttributesChanged(); +} +function r3t(t, e) { + if (t) + for (let i = 0; i < t.length; i += 3) + for (let r = 0; r < 3; r++) + t[i + r] += e[r]; +} +const sWi = sn(), xet = Dv(), Cet = Tm(); +function oWi() { + const { faceDescriptions: t, faceVertexOffsets: e, uvScales: i } = fWi, r = 4 * t.length, n = new Float64Array(3 * r), s = new Float32Array(3 * r), o = new Float32Array(2 * r), a = new Uint32Array(2 * t.length * 3); + let l = 0, c = 0, h = 0, p = 0; + for (let y = 0; y < t.length; y++) { + const v = t[y], x = l / 3; + for (const P of e) + a[p++] = x + P; + const I = v.corners; + for (let P = 0; P < 4; P++) { + const F = I[P]; + let k = 0; + o[h++] = 0.25 * i[P][0] + v.uvOrigin[0], o[h++] = v.uvOrigin[1] - 0.25 * i[P][1]; + for (let V = 0; V < 3; V++) + v.axis[V] !== 0 ? (n[l++] = 0.5 * v.axis[V], s[c++] = v.axis[V]) : (n[l++] = 0.5 * F[k++], s[c++] = 0); + } + } + return { position: n, normal: s, uv: o, faces: a }; +} +function aWi(t, e) { + const i = t.components[0], r = i.faces, n = mWi[e], s = 6 * n, o = new Array(6), a = new Array(r.length - 6); + let l = 0, c = 0; + for (let h = 0; h < r.length; h++) + h >= s && h < s + 6 ? o[l++] = r[h] : a[c++] = r[h]; + if (_e(t.vertexAttributes.uv)) { + const h = new Float32Array(t.vertexAttributes.uv), p = 4 * n * 2, y = [0, 1, 1, 1, 1, 0, 0, 0]; + for (let v = 0; v < y.length; v++) + h[p + v] = y[v]; + t.vertexAttributes.uv = h; + } + return t.components = [new U$({ faces: o, material: i.material }), new U$({ faces: a })], t; +} +function lWi(t = 0) { + const e = Math.round(8 * 2 ** t), i = 2 * e, r = (e - 1) * (i + 1) + 2 * i, n = new Float64Array(3 * r), s = new Float32Array(3 * r), o = new Float32Array(2 * r), a = new Uint32Array(3 * ((e - 1) * i * 2)); + let l = 0, c = 0, h = 0, p = 0; + for (let y = 0; y <= e; y++) { + const v = y / e * Math.PI + 0.5 * Math.PI, x = Math.cos(v), I = Math.sin(v); + am[2] = I; + const P = y === 0 || y === e, F = P ? i - 1 : i; + for (let k = 0; k <= F; k++) { + const V = k / F * 2 * Math.PI; + am[0] = -Math.sin(V) * x, am[1] = Math.cos(V) * x; + for (let j = 0; j < 3; j++) + n[l] = 0.5 * am[j], s[l] = am[j], ++l; + o[c++] = (k + (P ? 0.5 : 0)) / i, o[c++] = y / e, y !== 0 && k !== i && (y !== e && (a[h++] = p, a[h++] = p + 1, a[h++] = p - i), y !== 1 && (a[h++] = p, a[h++] = p - i, a[h++] = p - i - 1)), p++; + } + } + return { position: n, normal: s, uv: o, faces: a }; +} +function uWi(t = 0) { + const i = Math.round(16 * 2 ** t), r = (5 - 1) * (i + 1) + 2 * i, n = new Float64Array(3 * r), s = new Float32Array(3 * r), o = new Float32Array(2 * r), a = new Uint32Array(3 * (4 * i)); + let l = 0, c = 0, h = 0, p = 0, y = 0; + for (let v = 0; v <= 5; v++) { + const x = v === 0 || v === 5, I = v <= 1 || v >= 5 - 1, P = v === 2 || v === 4, F = x ? i - 1 : i; + for (let k = 0; k <= F; k++) { + const V = k / F * 2 * Math.PI, j = x ? 0 : 0.5; + am[0] = j * Math.sin(V), am[1] = j * -Math.cos(V), am[2] = v <= 2 ? 0.5 : -0.5; + for (let Y = 0; Y < 3; Y++) + n[l++] = am[Y], s[c++] = I ? Y === 2 ? v <= 1 ? 1 : -1 : 0 : Y === 2 ? 0 : am[Y] / j; + o[h++] = (k + (x ? 0.5 : 0)) / i, o[h++] = v <= 1 ? 1 * v / 3 : v <= 3 ? 1 * (v - 2) / 3 + 1 / 3 : 1 * (v - 4) / 3 + 2 / 3, P || v === 0 || k === i || (v !== 5 && (a[p++] = y, a[p++] = y + 1, a[p++] = y - i), v !== 1 && (a[p++] = y, a[p++] = y - i, a[p++] = y - i - 1)), y++; + } + } + return { position: n, normal: s, uv: o, faces: a }; +} +function cWi(t, e) { + const i = typeof e == "number" ? e : e != null ? e.width : 1, r = typeof e == "number" ? e : e != null ? e.height : 1; + switch (t) { + case "up": + case "down": + return { width: i, depth: r }; + case "north": + case "south": + return { width: i, height: r }; + case "east": + case "west": + return { depth: i, height: r }; + } +} +function hWi(t) { + const e = dq.facingAxisOrderSwap[t], i = dq.position, r = dq.normal, n = new Float64Array(i.length), s = new Float32Array(r.length); + let o = 0; + for (let a = 0; a < 4; a++) { + const l = o; + for (let c = 0; c < 3; c++) { + const h = e[c], p = Math.abs(h) - 1, y = h >= 0 ? 1 : -1; + n[o] = i[l + p] * y, s[o] = r[l + p] * y, o++; + } + } + return { position: n, normal: s, uv: new Float32Array(dq.uv), faces: new Uint32Array(dq.faces), isPlane: !0 }; +} +const wB = 1, xB = 2, SB = 3, dq = { position: [-0.5, -0.5, 0, 0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0], normal: [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1], uv: [0, 1, 1, 1, 1, 0, 0, 0], faces: [0, 1, 2, 0, 2, 3], facingAxisOrderSwap: { east: [SB, wB, xB], west: [-SB, -wB, xB], north: [-wB, SB, xB], south: [wB, -SB, xB], up: [wB, xB, SB], down: [wB, -xB, -SB] } }; +function Voe(t, e, i) { + t.isPlane || dWi(t), pWi(t, i?.size); + const { vertexAttributes: r, transform: n } = bAt(t, e, i); + return { vertexAttributes: new sy({ ...r, uv: t.uv }), transform: n, components: [new U$({ faces: t.faces, material: i && i.material || null })], spatialReference: e.spatialReference }; +} +function dWi(t) { + for (let e = 0; e < t.position.length; e += 3) + t.position[e + 2] += 0.5; +} +function pWi(t, e) { + if (e == null) + return; + const i = typeof e == "number" ? [e, e, e] : [e.width != null ? e.width : 1, e.depth != null ? e.depth : 1, e.height != null ? e.height : 1]; + HR[0] = i[0], HR[4] = i[1], HR[8] = i[2]; + for (let r = 0; r < t.position.length; r += 3) { + for (let n = 0; n < 3; n++) + am[n] = t.position[r + n]; + nI(am, am, HR); + for (let n = 0; n < 3; n++) + t.position[r + n] = am[n]; + } + if (i[0] !== i[1] || i[1] !== i[2]) { + HR[0] = 1 / i[0], HR[4] = 1 / i[1], HR[8] = 1 / i[2]; + for (let r = 0; r < t.normal.length; r += 3) { + for (let n = 0; n < 3; n++) + am[n] = t.normal[r + n]; + nI(am, am, HR), $0(am, am); + for (let n = 0; n < 3; n++) + t.normal[r + n] = am[n]; + } + } +} +const fWi = { faceDescriptions: [{ axis: [0, -1, 0], uvOrigin: [0, 0.625], corners: [[-1, -1], [1, -1], [1, 1], [-1, 1]] }, { axis: [1, 0, 0], uvOrigin: [0.25, 0.625], corners: [[-1, -1], [1, -1], [1, 1], [-1, 1]] }, { axis: [0, 1, 0], uvOrigin: [0.5, 0.625], corners: [[1, -1], [-1, -1], [-1, 1], [1, 1]] }, { axis: [-1, 0, 0], uvOrigin: [0.75, 0.625], corners: [[1, -1], [-1, -1], [-1, 1], [1, 1]] }, { axis: [0, 0, 1], uvOrigin: [0, 0.375], corners: [[-1, -1], [1, -1], [1, 1], [-1, 1]] }, { axis: [0, 0, -1], uvOrigin: [0, 0.875], corners: [[-1, 1], [1, 1], [1, -1], [-1, -1]] }], uvScales: [[0, 0], [1, 0], [1, 1], [0, 1]], faceVertexOffsets: [0, 1, 2, 0, 2, 3] }, mWi = { south: 0, east: 1, north: 2, west: 3, up: 4, down: 5 }, am = sn(), HR = Tm(), n3t = Ei.getLogger("esri.geometry.support.meshUtils.rotate"); +function gWi(t, e, i) { + if (!t.vertexAttributes || !t.vertexAttributes.position || e[3] === 0) + return; + const r = t.spatialReference; + if (_e(t.transform)) { + i?.geographic != null && i.geographic !== t.transform.geographic && n3t.warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`); + const n = i?.origin ?? t.transform.getOriginPoint(r); + yWi(t.transform, e, n); + } else { + const n = i?.origin ?? t.origin; + S8(t.spatialReference, i) ? vWi(t, e, n) : _Wi(t, e, n); + } +} +function yWi(t, e, i) { + const r = Ol(xG, i.x, i.y, i.z), n = Ec(xG, r, t.origin); + t.applyLocalInverse(n, Tet), t.rotation = J3e(t.rotation, e, bI()), t.applyLocalInverse(n, n), Ec(n, n, Tet), t.translation = Zc(sn(), t.translation, n); +} +function vWi(t, e, i) { + const r = t.spatialReference, n = j4(r), s = s3t; + NF(i, s, n) || NF(t.origin, s, n); + const o = t.vertexAttributes.position, a = t.vertexAttributes.normal, l = t.vertexAttributes.tangent, c = new Float64Array(o.length), h = _e(a) ? new Float32Array(a.length) : null, p = _e(l) ? new Float32Array(l.length) : null; + iU(n, s, $fe, n), xQ(Iet, $fe); + const y = Eet; + nI(Eet, e, Iet), y[3] = e[3], ive(o, r, c), _e(a) && _e(h) && eve(a, o, c, r, h), _e(l) && _e(p) && nve(l, o, c, r, p), w7(c, y, 3, s), rve(c, o, r), _e(a) && _e(h) && (w7(h, y, 3), tve(h, o, c, r, a)), _e(l) && _e(p) && (w7(p, y, 4), sve(p, o, c, r, l)), t.vertexAttributesChanged(); +} +function _Wi(t, e, i) { + const r = s3t; + if (!NF(i, r, t.spatialReference)) { + const n = t.origin; + r[0] = n.x, r[1] = n.y, r[2] = n.z, n3t.error(`Failed to project specified origin (wkid:${i.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}).`); + } + w7(t.vertexAttributes.position, e, 3, r), w7(t.vertexAttributes.normal, e, 3), w7(t.vertexAttributes.tangent, e, 4), t.vertexAttributesChanged(); +} +function w7(t, e, i, r = r8) { + if (!ut(t)) { + RLe($fe, nfe(e), e); + for (let n = 0; n < t.length; n += i) { + for (let s = 0; s < 3; s++) + xG[s] = t[n + s] - r[s]; + GS(xG, xG, $fe); + for (let s = 0; s < 3; s++) + t[n + s] = xG[s] + r[s]; + } + } +} +const xG = sn(), Tet = sn(), Eet = bI(), $fe = Dv(), Iet = Tm(), s3t = sn(), o3t = Ei.getLogger("esri.geometry.support.meshUtils.scale"); +function bWi(t, e, i) { + if (!t.vertexAttributes || !t.vertexAttributes.position) + return; + const r = t.spatialReference; + if (_e(t.transform)) { + i?.geographic != null && i.geographic !== t.transform.geographic && o3t.warn(`Specifying the 'geographic' parameter (${i.geographic}) different from the Mesh transform setting (${t.transform.geographic}) is not supported`); + const n = i?.origin ?? t.transform.getOriginPoint(r); + wWi(t.transform, e, n); + } else { + const n = S8(t.spatialReference, i), s = i && i.origin || t.origin; + n ? xWi(t, e, s) : SWi(t, e, s); + } +} +function wWi(t, e, i) { + const r = Ol(SG, i.x, i.y, i.z), n = Ec(SG, r, t.origin); + t.applyLocalInverse(n, Aet); + const s = od(sn(), t.scale, e); + t.scale = s, t.applyLocalInverse(n, n), Ec(n, n, Aet), t.translation = Zc(sn(), t.translation, n); +} +function xWi(t, e, i) { + const r = t.spatialReference, n = j4(r), s = l3t; + NF(i, s, n) || NF(t.origin, s, n); + const o = t.vertexAttributes.position, a = t.vertexAttributes.normal, l = t.vertexAttributes.tangent, c = new Float64Array(o.length), h = _e(a) ? new Float32Array(a.length) : null, p = _e(l) ? new Float32Array(l.length) : null; + ive(o, r, c), _e(a) && _e(h) && eve(a, o, c, r, h), _e(l) && _e(p) && nve(l, o, c, r, p), a3t(c, e, s), rve(c, o, r), _e(a) && _e(h) && tve(h, o, c, r, a), _e(l) && _e(p) && sve(p, o, c, r, l), t.vertexAttributesChanged(); +} +function SWi(t, e, i) { + const r = l3t; + if (!NF(i, r, t.spatialReference)) { + const n = t.origin; + r[0] = n.x, r[1] = n.y, r[2] = n.z, o3t.error(`Failed to project specified origin (wkid:${i.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}).`); + } + a3t(t.vertexAttributes.position, e, r), t.vertexAttributesChanged(); +} +function a3t(t, e, i = r8) { + if (t) + for (let r = 0; r < t.length; r += 3) { + for (let n = 0; n < 3; n++) + SG[n] = t[r + n] - i[n]; + od(SG, SG, e); + for (let n = 0; n < 3; n++) + t[r + n] = SG[n] + i[n]; + } +} +const SG = sn(), Aet = sn(), l3t = sn(); +var H2; +const zN = "esri.geometry.Mesh"; +let __ = H2 = class extends ap(kd.LoadableMixin(oC(tn))) { + constructor(t) { + super(t), this.components = null, this.transform = null, this.external = null, this.hasZ = !0, this.hasM = !1, this.vertexAttributes = new sy(), this.type = "mesh"; + } + initialize() { + (ut(this.external) || this.vertexAttributes.position.length) && (this.loadStatus = "loaded"), this.when(() => { + this.handles.add(Qi(() => ({ vertexAttributes: this.vertexAttributes, components: this.components?.map((t) => t.clone()) }), () => this._set("external", null), { once: !0, sync: !0 })); + }); + } + get hasExtent() { + return !this.loaded && _e(this.external) && _e(this.external.extent) || this.loaded && this.vertexAttributes.position.length > 0 && (!this.components || this.components.length > 0); + } + get _boundingInfo() { + const t = this.vertexAttributes.position, e = this.spatialReference; + if (t.length === 0 || this.components && this.components.length === 0) + return { extent: new br({ xmin: 0, ymin: 0, zmin: 0, xmax: 0, ymax: 0, zmax: 0, spatialReference: e }), center: new Xi({ x: 0, y: 0, z: 0, spatialReference: e }) }; + const i = _e(this.transform) ? this.transform.project(t, e) : t; + let r = 1 / 0, n = 1 / 0, s = 1 / 0, o = -1 / 0, a = -1 / 0, l = -1 / 0, c = 0, h = 0, p = 0; + const y = i.length, v = 1 / (y / 3); + let x = 0; + for (; x < y; ) { + const I = i[x++], P = i[x++], F = i[x++]; + r = Math.min(r, I), n = Math.min(n, P), s = Math.min(s, F), o = Math.max(o, I), a = Math.max(a, P), l = Math.max(l, F), c += v * I, h += v * P, p += v * F; + } + return { extent: new br({ xmin: r, ymin: n, zmin: s, xmax: o, ymax: a, zmax: l, spatialReference: e }), center: new Xi({ x: c, y: h, z: p, spatialReference: e }) }; + } + get anchor() { + if (_e(this.transform)) + return this.transform.getOriginPoint(this.spatialReference); + const t = this._boundingInfo; + return new Xi({ x: t.center.x, y: t.center.y, z: t.extent.zmin, spatialReference: this.spatialReference }); + } + get origin() { + return _e(this.transform) ? this.transform.getOriginPoint(this.spatialReference) : this._boundingInfo.center; + } + get extent() { + return !this.loaded && _e(this.external) && _e(this.external.extent) ? this.external.extent.clone() : this._boundingInfo.extent; + } + addComponent(t) { + this.loaded ? (this.components || (this.components = []), this.components.push(U$.from(t)), this.notifyChange("components")) : Ei.getLogger(this.declaredClass).error("addComponent()", "Mesh must be loaded before applying operations"); + } + removeComponent(t) { + if (this.loaded) { + if (this.components) { + const e = this.components.indexOf(t); + if (e !== -1) + return this.components.splice(e, 1), void this.notifyChange("components"); + } + Ei.getLogger(this.declaredClass).error("removeComponent()", "Provided component is not part of the list of components"); + } else + Ei.getLogger(this.declaredClass).error("removeComponent()", "Mesh must be loaded before applying operations"); + } + rotate(t, e, i, r) { + return Xue(kxe.x, t, CB), Xue(kxe.y, e, Pet), Xue(kxe.z, i, Oet), J3e(CB, Pet, CB), J3e(CB, Oet, CB), gWi(this, CB, r), this; + } + offset(t, e, i, r) { + return this.loaded ? (joe[0] = t, joe[1] = e, joe[2] = i, tWi(this, joe, r), this) : (Ei.getLogger(this.declaredClass).error("offset()", "Mesh must be loaded before applying operations"), this); + } + scale(t, e) { + return this.loaded ? (bWi(this, t, e), this) : (Ei.getLogger(this.declaredClass).error("scale()", "Mesh must be loaded before applying operations"), this); + } + centerAt(t, e) { + return this.loaded ? (zHi(this, t, e), this) : (Ei.getLogger(this.declaredClass).error("centerAt()", "Mesh must be loaded before applying operations"), this); + } + load(t) { + return _e(this.external) && this.addResolvingPromise(JHi(this, this.external.source, t)), Promise.resolve(this); + } + updateExternalSource(t) { + this._set("external", t); + } + clone() { + let t = null; + if (this.components) { + const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(); + t = this.components.map((n) => n.cloneWithDeduplication(i, r)); + } + const e = { components: t, spatialReference: this.spatialReference, vertexAttributes: this.vertexAttributes.clone(), transform: _e(this.transform) ? this.transform.clone() : null, external: _e(this.external) ? { source: this.external.source, extent: _e(this.external.extent) ? this.external.extent.clone() : null } : null }; + return new H2(e); + } + vertexAttributesChanged() { + this.notifyChange("vertexAttributes"); + } + async toBinaryGLTF(t) { + const e = Promise.resolve().then(() => CLr), i = this.load(), r = await Promise.all([e, i]), { toBinaryGLTF: n } = r[0]; + return n(this, t); + } + static createBox(t, e) { + if (!(t instanceof Xi)) + return Ei.getLogger(zN).error(".createBox()", "expected location to be a Point instance"), null; + const i = new H2(Voe(oWi(), t, e)); + return e && e.imageFace && e.imageFace !== "all" ? aWi(i, e.imageFace) : i; + } + static createSphere(t, e) { + return t instanceof Xi ? new H2(Voe(lWi(e && e.densificationFactor || 0), t, e)) : (Ei.getLogger(zN).error(".createSphere()", "expected location to be a Point instance"), null); + } + static createCylinder(t, e) { + return t instanceof Xi ? new H2(Voe(uWi(e && e.densificationFactor || 0), t, e)) : (Ei.getLogger(zN).error(".createCylinder()", "expected location to be a Point instance"), null); + } + static createPlane(t, e) { + if (!(t instanceof Xi)) + return Ei.getLogger(zN).error(".createPlane()", "expected location to be a Point instance"), null; + const i = e?.facing ?? "up", r = cWi(i, e?.size); + return new H2(Voe(hWi(i), t, { ...e, size: r })); + } + static createFromPolygon(t, e) { + if (!(t instanceof xo)) + return Ei.getLogger(zN).error(".createFromPolygon()", "expected polygon to be a Polygon instance"), null; + const i = VHi(t); + return new H2({ vertexAttributes: new sy({ position: i.position }), components: [new U$({ faces: i.faces, shading: "flat", material: e?.material ?? null })], spatialReference: t.spatialReference }); + } + static async createFromGLTF(t, e, i) { + if (!(t instanceof Xi)) + throw Ei.getLogger(zN).error(".createfromGLTF()", "expected location to be a Point instance"), new ot("invalid-input", "Expected location to be a Point instance"); + const { loadGLTFMesh: r } = await hy(Promise.resolve().then(() => ENt), i); + return new H2(await r(t, e, i)); + } + static createWithExternalSource(t, e, i) { + const r = i?.extent ?? null, n = i?.transform?.clone() ?? new XU(); + n.origin = [t.x, t.y, t.z ?? 0]; + const s = t.spatialReference; + return new H2({ external: { source: e, extent: r }, transform: n, spatialReference: s }); + } + static createIncomplete(t, e) { + const i = e?.transform?.clone() ?? new XU(); + i.origin = [t.x, t.y, t.z ?? 0]; + const r = t.spatialReference, n = new H2({ transform: i, spatialReference: r }); + return n.addResolvingPromise(Promise.reject(new ot("mesh-incomplete", "Mesh resources are not complete"))), n; + } +}; +E([N({ type: [U$], json: { write: !0 } })], __.prototype, "components", void 0), E([N({ type: XU, json: { write: !0 } })], __.prototype, "transform", void 0), E([N({ constructOnly: !0 })], __.prototype, "external", void 0), E([N({ readOnly: !0 })], __.prototype, "hasExtent", null), E([N({ readOnly: !0 })], __.prototype, "_boundingInfo", null), E([N({ readOnly: !0 })], __.prototype, "anchor", null), E([N({ readOnly: !0 })], __.prototype, "origin", null), E([N({ readOnly: !0, json: { read: !1 } })], __.prototype, "extent", null), E([N({ readOnly: !0, json: { read: !1, write: !0, default: !0 } })], __.prototype, "hasZ", void 0), E([N({ readOnly: !0, json: { read: !1, write: !0, default: !1 } })], __.prototype, "hasM", void 0), E([N({ type: sy, nonNullable: !0, json: { write: !0 } })], __.prototype, "vertexAttributes", void 0), __ = H2 = E([dt(zN)], __); +const kxe = { x: Na(1, 0, 0), y: Na(0, 1, 0), z: Na(0, 0, 1) }, CB = bI(), Pet = bI(), Oet = bI(), joe = sn(), Ret = __; +function CWi(t, e, i) { + const r = i.features; + i.features = [], delete i.geometryType; + const n = sc.fromJSON(i); + if (n.geometryType = "mesh", !i.assetMaps) + return n; + const s = PWi(e, i.assetMaps), o = n.spatialReference ?? or.WGS84, a = i.globalIdFieldName, { outFields: l } = t, c = _e(l) && l.length > 0 ? TWi(l.includes("*") ? null : new Set(l)) : () => ({}); + for (const h of r) { + const p = EWi(h, a, o, e, s); + _e(p) && n.features.push(new ro({ geometry: p, attributes: c(h) })); + } + return n; +} +function TWi(t) { + return ({ attributes: e }) => { + if (!e) + return {}; + if (!t) + return e; + for (const i in e) + t.has(i) || delete e[i]; + return e; + }; +} +function EWi(t, e, i, r, n) { + const s = t.attributes[e], o = n.get(s); + if (o == null || o.status === qD.FAILED || o.url == null) + return null; + const a = IWi(t, i, r), l = br.fromJSON(t.geometry); + l.spatialReference = i; + const c = AWi(t.attributes, r, o.projectVertices); + return o.status === qD.PENDING ? Ret.createIncomplete(a, { extent: l, transform: c }) : Ret.createWithExternalSource(a, [{ name: o.name, source: o.url }], { extent: l, transform: c }); +} +function IWi({ attributes: t }, e, { transformFieldRoles: i }) { + return new Xi({ x: t[i.originX], y: t[i.originY], z: t[i.originZ], spatialReference: e }); +} +function AWi(t, { transformFieldRoles: e }, i) { + return new XU({ translation: [t[e.translationX], -t[e.translationZ], t[e.translationY]], rotation: Xue([t[e.rotationX], t[e.rotationZ], t[e.rotationY]], t[e.rotationDeg]), scale: [t[e.scaleX], t[e.scaleY], t[e.scaleZ]], geographic: i }); +} +var qD; +function PWi(t, e) { + const i = /* @__PURE__ */ new Map(); + for (const r of e) { + const n = r.parentGlobalId; + if (n == null) + continue; + const s = r.assetName, o = r.assetURL, a = r.conversionStatus; + let l = i.get(n); + if (l == null) + switch (l = { name: s, status: qD.FAILED, url: o, projectVertices: OWi(r.flags).projectVertices }, i.set(n, l), a) { + case "COMPLETED": + case "SUBMITTED": + l.status = qD.COMPLETED; + break; + case "INPROGRESS": + l.status = qD.PENDING; + break; + default: + l.status = qD.FAILED; + } + else + console.warn(`Multiple asset parts not expected. Ignoring additional parts. conflicting assetname: ${r.assetName}`); + } + return i; +} +function OWi(t) { + return { projectVertices: t.includes("PROJECT_VERTICES") }; +} +(function(t) { + t[t.FAILED = 0] = "FAILED", t[t.PENDING = 1] = "PENDING", t[t.COMPLETED = 2] = "COMPLETED"; +})(qD || (qD = {})); +const RWi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + meshFeatureSetFromJSON: CWi +}, Symbol.toStringTag, { value: "Module" })), i9e = Ei.getLogger("esri.layers.support.ElevationSampler"); +let u3t = class { + queryElevation(e) { + return DWi(e.clone(), this); + } + on() { + return kWi; + } + projectIfRequired(e, i) { + return c3t(e, i); + } +}, MWi = class extends u3t { + get spatialReference() { + return this.extent.spatialReference; + } + constructor(e, i, r) { + super(), this.tile = e, this.noDataValue = r; + const n = e.tile.extent; + this.extent = a$(n, i.spatialReference), this.extent.zmin = e.zmin, this.extent.zmax = e.zmax, this._aaExtent = n; + const s = th(i.spatialReference), o = i.lodAt(e.tile.level).resolution * s; + this.demResolution = { min: o, max: o }; + } + contains(e) { + const i = this.projectIfRequired(e, this.spatialReference); + return !ut(i) && this.containsAt(i.x, i.y); + } + containsAt(e, i) { + return ydt(this._aaExtent, e, i); + } + elevationAt(e, i) { + if (!this.containsAt(e, i)) { + const r = this.extent, n = `${r.xmin}, ${r.ymin}, ${r.xmax}, ${r.ymax}`; + return i9e.warn("#elevationAt()", `Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`), this.noDataValue; + } + return Gu(this.tile.sample(e, i), this.noDataValue); + } +}, Met = class extends u3t { + get spatialReference() { + return this.extent.spatialReference; + } + constructor(e, i, r) { + let n; + super(), typeof i == "number" ? (this.noDataValue = i, n = null) : (n = i, this.noDataValue = r), this.samplers = n ? e.map((o) => new MWi(o, n, this.noDataValue)) : e; + const s = this.samplers[0]; + if (s) { + this.extent = s.extent.clone(); + const { min: o, max: a } = s.demResolution; + this.demResolution = { min: o, max: a }; + for (let l = 1; l < this.samplers.length; l++) { + const c = this.samplers[l]; + this.extent.union(c.extent), this.demResolution.min = Math.min(this.demResolution.min, c.demResolution.min), this.demResolution.max = Math.max(this.demResolution.max, c.demResolution.max); + } + } else + this.extent = a$(Eo(), n.spatialReference), this.demResolution = { min: 0, max: 0 }; + } + elevationAt(e, i) { + for (const r of this.samplers) + if (r.containsAt(e, i)) + return r.elevationAt(e, i); + return i9e.warn("#elevationAt()", `Point used to sample elevation (${e}, ${i}) is outside of the sampler`), this.noDataValue; + } +}; +function DWi(t, e) { + const i = c3t(t, e.spatialReference); + if (!i) + return null; + switch (t.type) { + case "point": + FWi(t, i, e); + break; + case "polyline": + LWi(t, i, e); + break; + case "multipoint": + NWi(t, i, e); + } + return t; +} +function c3t(t, e) { + if (ut(t)) + return null; + const i = t.spatialReference; + if (i.equals(e)) + return t; + const r = i8(t, e); + return r || i9e.error(`Cannot project geometry spatial reference (wkid:${i.wkid}) to elevation sampler spatial reference (wkid:${e.wkid})`), r; +} +function FWi(t, e, i) { + t.z = i.elevationAt(e.x, e.y); +} +function LWi(t, e, i) { + wE.spatialReference = e.spatialReference; + const r = t.hasM && !t.hasZ; + for (let n = 0; n < t.paths.length; n++) { + const s = t.paths[n], o = e.paths[n]; + for (let a = 0; a < s.length; a++) { + const l = s[a], c = o[a]; + wE.x = c[0], wE.y = c[1], r && (l[3] = l[2]), l[2] = i.elevationAt(wE.x, wE.y); + } + } + t.hasZ = !0; +} +function NWi(t, e, i) { + wE.spatialReference = e.spatialReference; + const r = t.hasM && !t.hasZ; + for (let n = 0; n < t.points.length; n++) { + const s = t.points[n], o = e.points[n]; + wE.x = o[0], wE.y = o[1], r && (s[3] = s[2]), s[2] = i.elevationAt(wE.x, wE.y); + } + t.hasZ = !0; +} +const wE = new Xi(), kWi = { remove() { +} }; +let $Wi = class { + constructor(e, i) { + this.data = e, this.safeWidth = 0.99999999 * (e.width - 1), this.dx = (e.width - 1) / (i[2] - i[0]), this.dy = (e.width - 1) / (i[3] - i[1]), this.x0 = i[0], this.y1 = i[3]; + } +}, Det = class { + constructor(e, i = null) { + if (this.tile = e, _e(i) && _e(e)) { + const r = e.extent; + this._samplerData = new $Wi(i, r); + } + } + get zmin() { + return _e(this._samplerData) ? this._samplerData.data.minValue : 0; + } + get zmax() { + return _e(this._samplerData) ? this._samplerData.data.maxValue : 0; + } + sample(e, i) { + if (ut(this._samplerData)) + return; + const { safeWidth: r, data: n, dx: s, dy: o, y1: a, x0: l } = this._samplerData, { width: c, values: h, noDataValue: p } = n, y = Fet(o * (a - i), 0, r), v = Fet(s * (e - l), 0, r), x = Math.floor(y), I = Math.floor(v), P = x * c + I, F = P + c, k = h[P], V = h[F], j = h[P + 1], Y = h[F + 1]; + if (k !== p && V !== p && j !== p && Y !== p) { + const X = v - I, Q = k + (j - k) * X; + return Q + (V + (Y - V) * X - Q) * (y - x); + } + } +}; +function Fet(t, e, i) { + return t < e ? e : t > i ? i : t; +} +let BWi = class { + async queryAll(e, i, r) { + if (!(e = r && r.ignoreInvisibleLayers ? e.filter((c) => c.visible) : e.slice()).length) + throw new ot("elevation-query:invalid-layer", "Elevation queries require at least one elevation layer to fetch tiles from"); + const n = AX.fromGeometry(i); + let s = !1; + r && r.returnSampleInfo || (s = !0); + const o = { ...Goe, ...r, returnSampleInfo: !0 }, a = await this.query(e[e.length - 1], n, o), l = await this._queryAllContinue(e, a, o); + return l.geometry = l.geometry.export(), s && delete l.sampleInfo, l; + } + async query(e, i, r) { + if (!e) + throw new ot("elevation-query:invalid-layer", "Elevation queries require an elevation layer to fetch tiles from"); + if (!i || !(i instanceof AX) && i.type !== "point" && i.type !== "multipoint" && i.type !== "polyline") + throw new ot("elevation-query:invalid-geometry", "Only point, polyline and multipoint geometries can be used to query elevation"); + const n = { ...Goe, ...r }, s = new VWi(e, i.spatialReference, n), o = n.signal; + return await e.load({ signal: o }), await this._createGeometryDescriptor(s, i, o), await this._selectTiles(s, o), await this._populateElevationTiles(s, o), this._sampleGeometryWithElevation(s), this._createQueryResult(s, o); + } + async createSampler(e, i, r) { + if (!e) + throw new ot("elevation-query:invalid-layer", "Elevation queries require an elevation layer to fetch tiles from"); + if (!i || i.type !== "extent") + throw new ot("elevation-query:invalid-extent", "Invalid or undefined extent"); + const n = { ...Goe, ...r }; + return this._createSampler(e, i, n); + } + async createSamplerAll(e, i, r) { + if (!(e = r && r.ignoreInvisibleLayers ? e.filter((o) => o.visible) : e.slice()).length) + throw new ot("elevation-query:invalid-layer", "Elevation queries require at least one elevation layer to fetch tiles from"); + if (!i || i.type !== "extent") + throw new ot("elevation-query:invalid-extent", "Invalid or undefined extent"); + const n = { ...Goe, ...r, returnSampleInfo: !0 }, s = await this._createSampler(e[e.length - 1], i, n); + return this._createSamplerAllContinue(e, i, s, n); + } + async _createSampler(e, i, r, n) { + const s = r.signal; + await e.load({ signal: s }); + const o = i.spatialReference, a = e.tileInfo.spatialReference; + o.equals(a) || (await LF([{ source: o, dest: a }], { signal: s }), i = Ip(i, a)); + const l = new jWi(e, i, r, n); + return await this._selectTiles(l, s), await this._populateElevationTiles(l, s), new Met(l.elevationTiles, l.layer.tileInfo, l.options.noDataValue); + } + async _createSamplerAllContinue(e, i, r, n) { + if (e.pop(), !e.length) + return r; + const s = r.samplers.map((c) => PF(c.extent)), o = await this._createSampler(e[e.length - 1], i, n, s); + if (o.samplers.length === 0) + return r; + const a = r.samplers.concat(o.samplers), l = new Met(a, n.noDataValue); + return this._createSamplerAllContinue(e, i, l, n); + } + async _queryAllContinue(e, i, r) { + const n = e.pop(), s = i.geometry.coordinates, o = i.sampleInfo; + Fg(o); + const a = [], l = []; + for (let y = 0; y < s.length; y++) { + const v = o[y]; + v.demResolution >= 0 ? v.source || (v.source = n) : e.length && (a.push(s[y]), l.push(y)); + } + if (!e.length || a.length === 0) + return i; + const c = i.geometry.clone(a), h = await this.query(e[e.length - 1], c, r), p = h.sampleInfo; + if (!p) + throw new Error("no sampleInfo"); + return l.forEach((y, v) => { + s[y].z = h.geometry.coordinates[v].z, o[y].demResolution = p[v].demResolution; + }), this._queryAllContinue(e, i, r); + } + async _createQueryResult(e, i) { + const r = await e.geometry.project(e.outSpatialReference, i); + Fg(r); + const n = { geometry: r.export(), noDataValue: e.options.noDataValue }; + return e.options.returnSampleInfo && (n.sampleInfo = this._extractSampleInfo(e)), e.geometry.coordinates.forEach((s) => { + s.tile = null, s.elevationTile = null; + }), n; + } + async _createGeometryDescriptor(e, i, r) { + let n; + const s = e.layer.tileInfo.spatialReference; + if (i instanceof AX ? n = await i.project(s, r) : (await LF([{ source: i.spatialReference, dest: s }], { signal: r }), n = Ip(i, s)), !n) + throw new ot("elevation-query:spatial-reference-mismatch", `Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${s.wkid}'`); + e.geometry = AX.fromGeometry(n); + } + async _selectTiles(e, i) { + const r = e.options.demResolution; + if (e.type === "geometry" && this._preselectOutsideLayerExtent(e), typeof r == "number") + this._selectTilesClosestResolution(e); + else if (r === "finest-contiguous") + await this._selectTilesFinestContiguous(e, i); + else { + if (r !== "auto") + throw new ot("elevation-query:invalid-dem-resolution", `Invalid dem resolution value '${r}', expected a number, "finest-contiguous" or "auto"`); + await this._selectTilesAuto(e, i); + } + } + _preselectOutsideLayerExtent(e) { + if (ut(e.layer.fullExtent)) + return; + const i = new Det(null); + i.sample = () => e.options.noDataValue, e.outsideExtentTile = i; + const r = e.layer.fullExtent; + e.geometry.coordinates.forEach((n) => { + const s = n.x, o = n.y; + (s < r.xmin || s > r.xmax || o < r.ymin || o > r.ymax) && (n.elevationTile = i); + }); + } + _selectTilesClosestResolution(e) { + const i = e.layer.tileInfo, r = this._findNearestDemResolutionLODIndex(i, e.options.demResolution); + e.selectTilesAtLOD(r); + } + _findNearestDemResolutionLODIndex(e, i) { + const r = i / th(e.spatialReference); + let n = e.lods[0], s = 0; + for (let o = 1; o < e.lods.length; o++) { + const a = e.lods[o]; + Math.abs(a.resolution - r) < Math.abs(n.resolution - r) && (n = a, s = o); + } + return s; + } + async _selectTilesFinestContiguous(e, i) { + const r = SMe(e.layer.tileInfo, e.options.minDemResolution); + await this._selectTilesFinestContiguousAt(e, r, i); + } + async _selectTilesFinestContiguousAt(e, i, r) { + const n = e.layer; + if (e.selectTilesAtLOD(i), i < 0) + return; + const s = n.tilemapCache, o = e.getTilesToFetch(); + try { + if (s) + await hy(Promise.all(o.map((a) => s.fetchAvailability(a.level, a.row, a.col, { signal: r }))), r); + else if (await this._populateElevationTiles(e, r), !e.allElevationTilesFetched()) + throw e.clearElevationTiles(), new ot("elevation-query:has-unavailable-tiles"); + } catch (a) { + ja(a), await this._selectTilesFinestContiguousAt(e, i - 1, r); + } + } + async _populateElevationTiles(e, i) { + const r = e.getTilesToFetch(), n = {}, s = e.options.cache, o = e.options.noDataValue, a = r.map(async (l) => { + if (l.id == null) + return; + const c = `${e.layer.uid}:${l.id}:${o}`, h = _e(s) ? s.get(c) : null, p = _e(h) ? h : await e.layer.fetchTile(l.level, l.row, l.col, { noDataValue: o, signal: i }); + _e(s) && s.put(c, p), n[l.id] = new Det(l, p); + }); + await hy(Nu(a), i), e.populateElevationTiles(n); + } + async _selectTilesAuto(e, i) { + this._selectTilesAutoFinest(e), this._reduceTilesForMaximumRequests(e); + const r = e.layer.tilemapCache; + if (!r) + return this._selectTilesAutoPrefetchUpsample(e, i); + const n = e.getTilesToFetch(), s = {}, o = n.map(async (a) => { + const l = new Bz(null, 0, 0, 0, Eo()), c = await PI(r.fetchAvailabilityUpsample(a.level, a.row, a.col, l, { signal: i })); + c.ok !== !1 ? a.id != null && (s[a.id] = l) : ja(c.error); + }); + await hy(Promise.all(o), i), e.remapTiles(s); + } + _reduceTilesForMaximumRequests(e) { + const i = e.layer.tileInfo; + let r = 0; + const n = {}, s = (l) => { + l.id != null && (l.id in n ? n[l.id]++ : (n[l.id] = 1, r++)); + }, o = (l) => { + if (l.id == null) + return; + const c = n[l.id]; + c === 1 ? (delete n[l.id], r--) : n[l.id] = c - 1; + }; + e.forEachTileToFetch(s, o); + let a = !0; + for (; a && (a = !1, e.forEachTileToFetch((l) => { + r <= e.options.maximumAutoTileRequests || (o(l), i.upsampleTile(l) && (a = !0), s(l)); + }, o), a); ) + ; + } + _selectTilesAutoFinest(e) { + const i = SMe(e.layer.tileInfo, e.options.minDemResolution); + e.selectTilesAtLOD(i, e.options.maximumAutoTileRequests); + } + async _selectTilesAutoPrefetchUpsample(e, i) { + const r = e.layer.tileInfo; + await this._populateElevationTiles(e, i); + let n = !1; + e.forEachTileToFetch((s, o) => { + r.upsampleTile(s) ? n = !0 : o(); + }), n && await this._selectTilesAutoPrefetchUpsample(e, i); + } + _sampleGeometryWithElevation(e) { + e.geometry.coordinates.forEach((i) => { + const r = i.elevationTile; + let n = e.options.noDataValue; + if (r) { + const s = r.sample(i.x, i.y); + _e(s) ? n = s : i.elevationTile = null; + } + i.z = n; + }); + } + _extractSampleInfo(e) { + const i = e.layer.tileInfo, r = th(i.spatialReference); + return e.geometry.coordinates.map((n) => { + let s = -1; + return n.elevationTile && n.elevationTile !== e.outsideExtentTile && (s = i.lodAt(n.elevationTile.tile.level).resolution * r), { demResolution: s }; + }); + } +}, AX = class vce { + export() { + return this._exporter(this.coordinates, this.spatialReference); + } + clone(e) { + const i = new vce(); + return i.geometry = this.geometry, i.spatialReference = this.spatialReference, i.coordinates = e || this.coordinates.map((r) => r.clone()), i._exporter = this._exporter, i; + } + async project(e, i) { + if (this.spatialReference.equals(e)) + return this.clone(); + await LF([{ source: this.spatialReference, dest: e }], { signal: i }); + const r = new Dd({ spatialReference: this.spatialReference, points: this.coordinates.map((a) => [a.x, a.y]) }), n = Ip(r, e); + if (!n) + return null; + const s = this.coordinates.map((a, l) => { + const c = a.clone(), h = n.points[l]; + return c.x = h[0], c.y = h[1], c; + }), o = this.clone(s); + return o.spatialReference = e, o; + } + static fromGeometry(e) { + const i = new vce(); + if (i.geometry = e, i.spatialReference = e.spatialReference, e instanceof vce) + i.coordinates = e.coordinates.map((r) => r.clone()), i._exporter = (r, n) => { + const s = e.clone(r); + return s.spatialReference = n, s; + }; + else + switch (e.type) { + case "point": { + const r = e, { hasZ: n, hasM: s } = r; + i.coordinates = n && s ? [new mw(r.x, r.y, r.z, r.m)] : n ? [new mw(r.x, r.y, r.z)] : s ? [new mw(r.x, r.y, null, r.m)] : [new mw(r.x, r.y)], i._exporter = (o, a) => e.hasM ? new Xi(o[0].x, o[0].y, o[0].z, o[0].m, a) : new Xi(o[0].x, o[0].y, o[0].z, a); + break; + } + case "multipoint": { + const r = e, { hasZ: n, hasM: s } = r; + i.coordinates = n && s ? r.points.map((o) => new mw(o[0], o[1], o[2], o[3])) : n ? r.points.map((o) => new mw(o[0], o[1], o[2])) : s ? r.points.map((o) => new mw(o[0], o[1], null, o[2])) : r.points.map((o) => new mw(o[0], o[1])), i._exporter = (o, a) => e.hasM ? new Dd({ points: o.map((l) => [l.x, l.y, l.z, l.m]), hasZ: !0, hasM: !0, spatiaReference: a }) : new Dd(o.map((l) => [l.x, l.y, l.z]), a); + break; + } + case "polyline": { + const r = e, n = [], s = [], { hasZ: o, hasM: a } = e; + let l = 0; + for (const c of r.paths) + if (s.push([l, l + c.length]), l += c.length, o && a) + for (const h of c) + n.push(new mw(h[0], h[1], h[2], h[3])); + else if (o) + for (const h of c) + n.push(new mw(h[0], h[1], h[2])); + else if (a) + for (const h of c) + n.push(new mw(h[0], h[1], null, h[2])); + else + for (const h of c) + n.push(new mw(h[0], h[1])); + i.coordinates = n, i._exporter = (c, h) => { + const p = e.hasM ? c.map((v) => [v.x, v.y, v.z, v.m]) : c.map((v) => [v.x, v.y, v.z]), y = s.map((v) => p.slice(v[0], v[1])); + return new xa({ paths: y, hasM: e.hasM, hasZ: !0, spatialReference: h }); + }; + break; + } + } + return i; + } +}, mw = class h3t { + constructor(e, i, r = null, n = null, s = null, o = null) { + this.x = e, this.y = i, this.z = r, this.m = n, this.tile = s, this.elevationTile = o; + } + clone() { + return new h3t(this.x, this.y, this.z, this.m); + } +}, d3t = class { + constructor(e, i) { + this.layer = e, this.options = i; + } +}, VWi = class extends d3t { + constructor(e, i, r) { + super(e, r), this.outSpatialReference = i, this.type = "geometry"; + } + selectTilesAtLOD(e) { + if (e < 0) + this.geometry.coordinates.forEach((i) => { + i.tile = null; + }); + else { + const i = this.layer.tileInfo, r = i.lods[e].level; + this.geometry.coordinates.forEach((n) => { + n.tile = i.tileAt(r, n.x, n.y); + }); + } + } + allElevationTilesFetched() { + return !this.geometry.coordinates.some((e) => !e.elevationTile); + } + clearElevationTiles() { + for (const e of this.geometry.coordinates) + e.elevationTile !== this.outsideExtentTile && (e.elevationTile = null); + } + populateElevationTiles(e) { + for (const i of this.geometry.coordinates) + !i.elevationTile && i.tile?.id && (i.elevationTile = e[i.tile.id]); + } + remapTiles(e) { + for (const i of this.geometry.coordinates) { + const r = i.tile?.id; + i.tile = r ? e[r] : null; + } + } + getTilesToFetch() { + const e = {}, i = []; + for (const r of this.geometry.coordinates) { + const n = r.tile; + if (!n) + continue; + const s = r.tile?.id; + r.elevationTile || !s || e[s] || (e[s] = n, i.push(n)); + } + return i; + } + forEachTileToFetch(e) { + for (const i of this.geometry.coordinates) + i.tile && !i.elevationTile && e(i.tile, () => { + i.tile = null; + }); + } +}, jWi = class extends d3t { + constructor(e, i, r, n) { + super(e, r), this.type = "extent", this.elevationTiles = [], this._candidateTiles = [], this._fetchedCandidates = /* @__PURE__ */ new Set(), this.extent = i.intersection(e.fullExtent), this.maskExtents = n; + } + selectTilesAtLOD(e, i) { + const r = this._maximumLodForRequests(i), n = Math.min(r, e); + n < 0 ? this._candidateTiles.length = 0 : this._selectCandidateTilesCoveringExtentAt(n); + } + _maximumLodForRequests(e) { + const i = this.layer.tileInfo; + if (!e) + return i.lods.length - 1; + const r = this.extent; + if (ut(r)) + return -1; + for (let n = i.lods.length - 1; n >= 0; n--) { + const s = i.lods[n], o = s.resolution * i.size[0], a = s.resolution * i.size[1]; + if (Math.ceil(r.width / o) * Math.ceil(r.height / a) <= e) + return n; + } + return -1; + } + allElevationTilesFetched() { + return this._candidateTiles.length === this.elevationTiles.length; + } + clearElevationTiles() { + this.elevationTiles.length = 0, this._fetchedCandidates.clear(); + } + populateElevationTiles(e) { + for (const i of this._candidateTiles) { + const r = i.id && e[i.id]; + r && (this._fetchedCandidates.add(i), this.elevationTiles.push(r)); + } + } + remapTiles(e) { + this._candidateTiles = this._uniqueNonOverlappingTiles(this._candidateTiles.map((i) => e[i.id])); + } + getTilesToFetch() { + return this._candidateTiles; + } + forEachTileToFetch(e, i) { + const r = this._candidateTiles; + this._candidateTiles = [], r.forEach((n) => { + if (this._fetchedCandidates.has(n)) + return void (i && i(n)); + let s = !1; + e(n, () => s = !0), s ? i && i(n) : this._candidateTiles.push(n); + }), this._candidateTiles = this._uniqueNonOverlappingTiles(this._candidateTiles, i); + } + _uniqueNonOverlappingTiles(e, i) { + const r = {}, n = []; + for (const o of e) { + const a = o.id; + a && !r[a] ? (r[a] = o, n.push(o)) : i && i(o); + } + const s = n.sort((o, a) => o.level - a.level); + return s.filter((o, a) => { + for (let l = 0; l < a; l++) { + const c = s[l].extent; + if (c && o.extent && CTe(c, o.extent)) + return i && i(o), !1; + } + return !0; + }); + } + _selectCandidateTilesCoveringExtentAt(e) { + this._candidateTiles.length = 0; + const i = this.extent; + if (ut(i)) + return; + const r = this.layer.tileInfo, n = r.lods[e], s = r.tileAt(n.level, i.xmin, i.ymin), o = s.extent; + if (ut(o)) + return; + const a = n.resolution * r.size[0], l = n.resolution * r.size[1], c = Math.ceil((i.xmax - o[0]) / a), h = Math.ceil((i.ymax - o[1]) / l); + for (let p = 0; p < h; p++) + for (let y = 0; y < c; y++) { + const v = new Bz(null, s.level, s.row - p, s.col + y); + r.updateTileInfo(v), this._tileIsMasked(v) || this._candidateTiles.push(v); + } + } + _tileIsMasked(e) { + return !!this.maskExtents && this.maskExtents.some((i) => e.extent && CTe(i, e.extent)); + } +}; +function SMe(t, e = 0) { + let i = t.lods.length - 1; + if (e > 0) { + const r = e / th(t.spatialReference), n = t.lods.findIndex((s) => s.resolution < r); + n === 0 ? i = 0 : n > 0 && (i = n - 1); + } + return i; +} +const Goe = { maximumAutoTileRequests: 20, noDataValue: 0, returnSampleInfo: !1, demResolution: "auto", minDemResolution: 0 }, Bfe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + ElevationQuery: BWi, + GeometryDescriptor: AX, + getFinestLodIndex: SMe +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function z4(t, e, i) { + const r = GWi(t); + return new r(e, i); +} +function GWi(t) { + class e extends window.MutationObserver { + constructor(r) { + super(r), this.observedEntry = [], this.callback = r; + } + observe(r, n) { + return this.observedEntry.push({ target: r, options: n }), super.observe(r, n); + } + unobserve(r) { + const n = this.observedEntry.filter((s) => s.target !== r); + this.observedEntry = [], this.callback(super.takeRecords(), this), this.disconnect(), n.forEach((s) => this.observe(s.target, s.options)); + } + } + return function() { + return t === "intersection" ? window.IntersectionObserver : t === "mutation" ? e : window.ResizeObserver; + }(); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const UWi = { + icon: "icon", + flipRtl: "flip-rtl" +}, $xe = {}, Bxe = {}, p3t = { + s: 16, + m: 24, + l: 32 +}; +async function zWi({ icon: t, scale: e }) { + const i = p3t[e], r = HWi(t), n = r.charAt(r.length - 1) === "F", o = `${n ? r.substring(0, r.length - 1) : r}${i}${n ? "F" : ""}`; + if ($xe[o]) + return $xe[o]; + Bxe[o] || (Bxe[o] = fetch(vvt(`./assets/icon/${o}.json`)).then((l) => l.json()).catch(() => (console.error(`"${o}" is not a valid calcite-ui-icon name`), ""))); + const a = await Bxe[o]; + return $xe[o] = a, a; +} +function HWi(t) { + const e = !isNaN(Number(t.charAt(0))), i = t.split("-"); + if (i.length > 0) { + const n = /[a-z]/i; + t = i.map((s, o) => s.replace(n, function(l, c) { + return o === 0 && c === 0 ? l : l.toUpperCase(); + })).join(""); + } + return e ? `i${t}` : t; +} +const WWi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{display:inline-flex;color:var(--calcite-ui-icon-color)}:host([scale=s]){block-size:1rem;inline-size:1rem;min-inline-size:1rem;min-block-size:1rem}:host([scale=m]){block-size:1.5rem;inline-size:1.5rem;min-inline-size:1.5rem;min-block-size:1.5rem}:host([scale=l]){block-size:2rem;inline-size:2rem;min-inline-size:2rem;min-block-size:2rem}.flip-rtl{transform:scaleX(-1)}.svg{display:block}", f3t = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.icon = null, this.flipRtl = !1, this.scale = "m", this.textLabel = void 0, this.pathData = void 0, this.visible = !1; + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + this.waitUntilVisible(() => { + this.visible = !0, this.loadIconPathData(); + }); + } + disconnectedCallback() { + this.intersectionObserver?.disconnect(), this.intersectionObserver = null; + } + async componentWillLoad() { + this.loadIconPathData(); + } + render() { + const { el: t, flipRtl: e, pathData: i, scale: r, textLabel: n } = this, s = mie(t), o = p3t[r], a = !!n, l = [].concat(i || ""); + return pr(y3, { "aria-hidden": fx(!a), "aria-label": a ? n : null, role: a ? "img" : null }, pr("svg", { "aria-hidden": "true", class: { + [UWi.flipRtl]: s === "rtl" && e, + svg: !0 + }, fill: "currentColor", height: "100%", viewBox: `0 0 ${o} ${o}`, width: "100%", xmlns: "http://www.w3.org/2000/svg" }, l.map((c) => typeof c == "string" ? pr("path", { d: c }) : pr("path", { d: c.d, opacity: "opacity" in c ? c.opacity : 1 })))); + } + //-------------------------------------------------------------------------- + // + // Private Methods + // + //-------------------------------------------------------------------------- + async loadIconPathData() { + const { icon: t, scale: e, visible: i } = this; + !t || !i || (this.pathData = await zWi({ icon: t, scale: e })); + } + waitUntilVisible(t) { + if (this.intersectionObserver = z4("intersection", (e) => { + e.forEach((i) => { + i.isIntersecting && (this.intersectionObserver.disconnect(), this.intersectionObserver = null, t()); + }); + }, { rootMargin: "50px" }), !this.intersectionObserver) { + t(); + return; + } + this.intersectionObserver.observe(this.el); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + icon: ["loadIconPathData"], + scale: ["loadIconPathData"] + }; + } + static get style() { + return WWi; + } +}, [1, "calcite-icon", { + icon: [513], + flipRtl: [516, "flip-rtl"], + scale: [513], + textLabel: [1, "text-label"], + pathData: [32], + visible: [32] +}]); +function qx() { + if (typeof customElements > "u") + return; + ["calcite-icon"].forEach((e) => { + switch (e) { + case "calcite-icon": + customElements.get(e) || customElements.define(e, f3t); + break; + } + }); +} +qx(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const qWi = f3t, YWi = qx, r9e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteIcon: qWi, + defineCustomElement: YWi +}, Symbol.toStringTag, { value: "Module" })); +function Cl(t) { + throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +} +function XWi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Let, Net, vee = {}, KWi = { get exports() { + return vee; +}, set exports(t) { + vee = t; +} }; +Let = KWi, (Net = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "م", _era_bc: "ق.م", A: "ص", P: "م", AM: "ص", PM: "م", "A.M.": "ص", "P.M.": "م", January: "يناير", February: "فبراير", March: "مارس", April: "أبريل", May: "مايو", June: "يونيو", July: "يوليو", August: "أغسطس", September: "سبتمبر", October: "أكتوبر", November: "نوفمبر", December: "ديسمبر", Jan: "يناير", Feb: "فبراير", Mar: "مارس", Apr: "أبريل", "May(short)": "مايو", Jun: "يونيو", Jul: "يوليو", Aug: "أغسطس", Sep: "سبتمبر", Oct: "أكتوبر", Nov: "نوفمبر", Dec: "ديسمبر", Sunday: "الأحد", Monday: "الاثنين", Tuesday: "الثلاثاء", Wednesday: "الأربعاء", Thursday: "الخميس", Friday: "الجمعة", Saturday: "السبت", Sun: "الأحد", Mon: "الاثنين", Tue: "الثلاثاء", Wed: "الأربعاء", Thu: "الخميس", Fri: "الجمعة", Sat: "السبت", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "تغيير مقياس الرسم", Play: "تشغيل", Stop: "إيقاف تشغيل", Legend: "وسيلة الإيضاح", "Click, tap or press ENTER to toggle": "", Loading: "تحميل", Home: "الصفحة الرئيسية", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "طباعة", Image: "صورة", Data: "بيانات", Print: "طباعة", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "من %1 إلى %2", "From %1": "من %1", "To %1": "إلى %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, vee)) !== void 0 && (Let.exports = Net); +const JWi = XWi({ __proto__: null, default: nl(vee) }, [vee]), ZWi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + a: JWi +}, Symbol.toStringTag, { value: "Module" })); +function QWi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ket, $et, _ee = {}, eqi = { get exports() { + return _ee; +}, set exports(t) { + _ee = t; +} }; +ket = eqi, ($et = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _percentPrefix: null, _percentSuffix: "%", "Zoom Out": "Отдалечаване", "From %1 to %2": "От %1 до %2", "From %1": "От %1", "To %1": "До %1" }; +}(Cl, _ee)) !== void 0 && (ket.exports = $et); +const tqi = QWi({ __proto__: null, default: nl(_ee) }, [_ee]), iqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + b: tqi +}, Symbol.toStringTag, { value: "Module" })); +function rqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Bet, Vet, bee = {}, nqi = { get exports() { + return bee; +}, set exports(t) { + bee = t; +} }; +Bet = nqi, (Vet = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "n. e.", _era_bc: "p. n. e.", A: "prijepodne", P: "popodne", AM: "AM", PM: "PM", "A.M.": "prijepodne", "P.M.": "popodne", January: "januar", February: "februar", March: "mart", April: "april", May: "maj", June: "juni", July: "juli", August: "august", September: "septembar", October: "oktobar", November: "novembar", December: "decembar", Jan: "jan", Feb: "feb", Mar: "mar", Apr: "apr", "May(short)": "maj", Jun: "jun", Jul: "jul", Aug: "aug", Sep: "sep", Oct: "okt", Nov: "nov", Dec: "dec", Sunday: "nedjelja", Monday: "ponedjeljak", Tuesday: "utorak", Wednesday: "srijeda", Thursday: "četvrtak", Friday: "petak", Saturday: "subota", Sun: "ned", Mon: "pon", Tue: "uto", Wed: "sri", Thu: "čet", Fri: "pet", Sat: "sub", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Povećaj", Play: "Reproduciraj", Stop: "Zaustavi", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Učitavanje", Home: "Početna", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Ispis", Image: "Slika", Data: "Podaci", Print: "Ispis", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, bee)) !== void 0 && (Bet.exports = Vet); +const sqi = rqi({ __proto__: null, default: nl(bee) }, [bee]), oqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + b: sqi +}, Symbol.toStringTag, { value: "Module" })); +function aqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var jet, Get, wee = {}, lqi = { get exports() { + return wee; +}, set exports(t) { + wee = t; +} }; +jet = lqi, (Get = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "dC", _era_bc: "aC", A: "a. m.", P: "p. m.", AM: "a. m.", PM: "p. m.", "A.M.": "a. m.", "P.M.": "p. m.", January: "de gener", February: "de febrer", March: "de març", April: "d’abril", May: "de maig", June: "de juny", July: "de juliol", August: "d’agost", September: "de setembre", October: "d’octubre", November: "de novembre", December: "de desembre", Jan: "de gen.", Feb: "de febr.", Mar: "de març", Apr: "d’abr.", "May(short)": "de maig", Jun: "de juny", Jul: "de jul.", Aug: "d’ag.", Sep: "de set.", Oct: "d’oct.", Nov: "de nov.", Dec: "de des.", Sunday: "diumenge", Monday: "dilluns", Tuesday: "dimarts", Wednesday: "dimecres", Thursday: "dijous", Friday: "divendres", Saturday: "dissabte", Sun: "dg.", Mon: "dl.", Tue: "dt.", Wed: "dc.", Thu: "dj.", Fri: "dv.", Sat: "ds.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zoom", Play: "Reprodueix", Stop: "Parada", Legend: "Llegenda", "Click, tap or press ENTER to toggle": "", Loading: "S'està carregant", Home: "Inici", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Imprimeix", Image: "Imatge", Data: "Dades", Print: "Imprimeix", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "De %1 a %2", "From %1": "De %1", "To %1": "A %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, wee)) !== void 0 && (jet.exports = Get); +const uqi = aqi({ __proto__: null, default: nl(wee) }, [wee]), cqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + c: uqi +}, Symbol.toStringTag, { value: "Module" })); +function hqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Uet, zet, xee = {}, dqi = { get exports() { + return xee; +}, set exports(t) { + xee = t; +} }; +Uet = dqi, (zet = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "n. l.", _era_bc: "př. n. l.", A: "dop.", P: "odp.", AM: "dop.", PM: "odp.", "A.M.": "dop.", "P.M.": "odp.", January: "ledna", February: "února", March: "března", April: "dubna", May: "května", June: "června", July: "července", August: "srpna", September: "září", October: "října", November: "listopadu", December: "prosince", Jan: "led", Feb: "úno", Mar: "bře", Apr: "dub", "May(short)": "kvě", Jun: "čvn", Jul: "čvc", Aug: "srp", Sep: "zář", Oct: "říj", Nov: "lis", Dec: "pro", Sunday: "neděle", Monday: "pondělí", Tuesday: "úterý", Wednesday: "středa", Thursday: "čtvrtek", Friday: "pátek", Saturday: "sobota", Sun: "ne", Mon: "po", Tue: "út", Wed: "st", Thu: "čt", Fri: "pá", Sat: "so", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zvětšení", Play: "Přehrát", Stop: "Ukončit iteraci (Stop)", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Načítání", Home: "Domů", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Tisk", Image: "Snímek", Data: "Data", Print: "Tisk", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, xee)) !== void 0 && (Uet.exports = zet); +const pqi = hqi({ __proto__: null, default: nl(xee) }, [xee]), fqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + c: pqi +}, Symbol.toStringTag, { value: "Module" })); +function mqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Het, Wet, See = {}, gqi = { get exports() { + return See; +}, set exports(t) { + See = t; +} }; +Het = gqi, (Wet = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "e.Kr.", _era_bc: "f.Kr.", A: "a", P: "p", AM: "AM", PM: "PM", "A.M.": "AM", "P.M.": "PM", January: "januar", February: "februar", March: "marts", April: "april", May: "maj", June: "juni", July: "juli", August: "august", September: "september", October: "oktober", November: "november", December: "december", Jan: "jan.", Feb: "feb.", Mar: "mar.", Apr: "apr.", "May(short)": "maj", Jun: "jun.", Jul: "jul.", Aug: "aug.", Sep: "sep.", Oct: "okt.", Nov: "nov.", Dec: "dec.", Sunday: "søndag", Monday: "mandag", Tuesday: "tirsdag", Wednesday: "onsdag", Thursday: "torsdag", Friday: "fredag", Saturday: "lørdag", Sun: "søn.", Mon: "man.", Tue: "tir.", Wed: "ons.", Thu: "tor.", Fri: "fre.", Sat: "lør.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zoom", Play: "Afspil", Stop: "Stop", Legend: "Signaturforklaring", "Click, tap or press ENTER to toggle": "", Loading: "Indlæser", Home: "Hjem", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Udskriv", Image: "Billede", Data: "Data", Print: "Udskriv", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Fra %1 til %2", "From %1": "Fra %1", "To %1": "Til %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, See)) !== void 0 && (Het.exports = Wet); +const yqi = mqi({ __proto__: null, default: nl(See) }, [See]), vqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + d: yqi +}, Symbol.toStringTag, { value: "Module" })); +function _qi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var qet, Yet, Cee = {}, bqi = { get exports() { + return Cee; +}, set exports(t) { + Cee = t; +} }; +qet = bqi, (Yet = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "K", _big_number_suffix_6: "Mio", _big_number_suffix_9: "Mrd", _big_number_suffix_12: "Bio", _big_number_suffix_15: "Brd", _big_number_suffix_18: "Trill", _big_number_suffix_21: "Trd", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd. MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "v. Chr.", _era_bc: "n. Chr.", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Januar", February: "Februar", March: "März", April: "April", May: "Mai", June: "Juni", July: "Juli", August: "August", September: "September", October: "Oktober", November: "November", December: "Dezember", Jan: "Jan.", Feb: "Febr.", Mar: "März", Apr: "Apr.", "May(short)": "Mai", Jun: "Juni", Jul: "Juli", Aug: "Aug.", Sep: "Sept.", Oct: "Okt.", Nov: "Nov.", Dec: "Dez.", Sunday: "Sonntag", Monday: "Montag", Tuesday: "Dienstag", Wednesday: "Mittwoch", Thursday: "Donnerstag", Friday: "Freitag", Saturday: "Samstag", Sun: "So.", Mon: "Mo.", Tue: "Di.", Wed: "Mi.", Thu: "Do.", Fri: "Fr.", Sat: "Sa.", _dateOrd: function(i) { + return i + "."; + }, "Zoom Out": "Herauszoomen", Play: "Abspielen", Stop: "Stop", Legend: "Legende", "Click, tap or press ENTER to toggle": "Klicken, tippen oder ENTER drücken zum Umschalten", Loading: "Wird geladen", Home: "Home", Chart: "Diagramm", "Serial chart": "Seriendiagramm", "X/Y chart": "X-Y-Diagramm", "Pie chart": "Kreisdiagramm", "Gauge chart": "Messdiagramm", "Radar chart": "Netzdiagramm", "Sankey diagram": "Sankey-Diagramm", "Chord diagram": "", "Flow diagram": "Flussdiagramm", "TreeMap chart": "Baumdiagramm", Series: "Serie", "Candlestick Series": "Kerzendiagramm", "Column Series": "Balkendiagramm", "Line Series": "Liniendiagramm", "Pie Slice Series": "Kreisdiagramm", "X/Y Series": "Punktdiagramm", Map: "Karte", "Press ENTER to zoom in": "Drücke ENTER zum Hereinzoomen", "Press ENTER to zoom out": "Drücke ENTER zum Herauszoomen", "Use arrow keys to zoom in and out": "Benutze die Pfeiltasten zum Zoomen", "Use plus and minus keys on your keyboard to zoom in and out": "Benutze Plus- und Minustasten zum Zoomen", Export: "Export", Image: "Bild", Data: "Daten", Print: "Drucken", "Click, tap or press ENTER to open": "Zum Öffnen klicken, tippen oder ENTER drücken", "Click, tap or press ENTER to print.": "Zum Drucken klicken, tippen oder ENTER drücken.", "Click, tap or press ENTER to export as %1.": "Klicken, tippen oder ENTER drücken um als %1 zu exportieren", 'To save the image, right-click this link and choose "Save picture as..."': 'Um das Bild zu speichern, Rechtsklicken und "Bild speichern unter ..." auswählen', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Um das Bild zu speichern, Rechtsklick auf das Vorschaubild links und "Bild speichern unter ..." auswählen', "(Press ESC to close this message)": "ESC drücken um diese Nachricht zu schließen", "Image Export Complete": "Bildexport komplett", "Export operation took longer than expected. Something might have gone wrong.": "Der Export dauert länger als geplant. Vielleicht ist etwas schiefgelaufen.", "Saved from": "Gespeichert von", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "TAB nutzen, um Ankerpunkte auszuwählen oder linke und rechte Pfeiltaste um die Auswahl zu ändern", "Use left and right arrows to move selection": "Linke und rechte Pfeiltaste nutzen um die Auswahl zu verschieben", "Use left and right arrows to move left selection": "Linke und rechte Pfeiltaste nutzen um die linke Auswahl zu verschieben", "Use left and right arrows to move right selection": "Linke und rechte Pfeiltaste nutzen um die rechte Auswahl zu verschieben", "Use TAB select grip buttons or up and down arrows to change selection": "TAB nutzen, um Ankerpunkte auszuwählen oder Pfeiltaste nach oben und unten drücken, um die Auswahl zu ändern", "Use up and down arrows to move selection": "Pfeiltaste nach oben und unten drücken, um die Auswahl zu verschieben", "Use up and down arrows to move lower selection": "Pfeiltaste nach oben und unten drücken, um die untere Auswahl zu verschieben", "Use up and down arrows to move upper selection": "Pfeiltaste nach oben und unten drücken, um die obere Auswahl zu verschieben", "From %1 to %2": "Von %1 bis %2", "From %1": "Von %1", "To %1": "Bis %1", "No parser available for file: %1": "Kein Parser für Datei %1 verfügbar", "Error parsing file: %1": "Fehler beim Parsen von Datei %1", "Unable to load file: %1": "Datei %1 konnte nicht geladen werden", "Invalid date": "Kein Datum" }; +}(Cl, Cee)) !== void 0 && (qet.exports = Yet); +const wqi = _qi({ __proto__: null, default: nl(Cee) }, [Cee]), xqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + d: wqi +}, Symbol.toStringTag, { value: "Module" })); +function Sqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Xet, Ket, Tee = {}, Cqi = { get exports() { + return Tee; +}, set exports(t) { + Tee = t; +} }; +Xet = Cqi, (Ket = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: "'", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "K", _big_number_suffix_6: "Mio", _big_number_suffix_9: "Mrd", _big_number_suffix_12: "Bio", _big_number_suffix_15: "Brd", _big_number_suffix_18: "Trill", _big_number_suffix_21: "Trd", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd. MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "v. Chr.", _era_bc: "n. Chr.", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Januar", February: "Februar", March: "März", April: "April", May: "Mai", June: "Juni", July: "Juli", August: "August", September: "September", October: "Oktober", November: "November", December: "Dezember", Jan: "Jan.", Feb: "Febr.", Mar: "März", Apr: "Apr.", "May(short)": "Mai", Jun: "Juni", Jul: "Juli", Aug: "Aug.", Sep: "Sept.", Oct: "Okt.", Nov: "Nov.", Dec: "Dez.", Sunday: "Sonntag", Monday: "Montag", Tuesday: "Dienstag", Wednesday: "Mittwoch", Thursday: "Donnerstag", Friday: "Freitag", Saturday: "Samstag", Sun: "So.", Mon: "Mo.", Tue: "Di.", Wed: "Mi.", Thu: "Do.", Fri: "Fr.", Sat: "Sa.", _dateOrd: function(i) { + return i + "."; + }, "Zoom Out": "Herauszoomen", Play: "Abspielen", Stop: "Stop", Legend: "Legende", "Click, tap or press ENTER to toggle": "Klicken, tippen oder ENTER drücken zum Umschalten", Loading: "Wird geladen", Home: "Home", Chart: "Diagramm", "Serial chart": "Seriendiagramm", "X/Y chart": "X-Y-Diagramm", "Pie chart": "Kreisdiagramm", "Gauge chart": "Messdiagramm", "Radar chart": "Netzdiagramm", "Sankey diagram": "Sankey-Diagramm", "Chord diagram": "", "Flow diagram": "Flussdiagramm", "TreeMap chart": "Baumdiagramm", Series: "Serie", "Candlestick Series": "Kerzendiagramm", "Column Series": "Balkendiagramm", "Line Series": "Liniendiagramm", "Pie Slice Series": "Kreisdiagramm", "X/Y Series": "Punktdiagramm", Map: "Karte", "Press ENTER to zoom in": "Drücke ENTER zum Hereinzoomen", "Press ENTER to zoom out": "Drücke ENTER zum Herauszoomen", "Use arrow keys to zoom in and out": "Benutze die Pfeiltasten zum Zoomen", "Use plus and minus keys on your keyboard to zoom in and out": "Benutze Plus- und Minustasten zum Zoomen", Export: "Export", Image: "Bild", Data: "Daten", Print: "Drucken", "Click, tap or press ENTER to open": "Zum Öffnen klicken, tippen oder ENTER drücken", "Click, tap or press ENTER to print.": "Zum Drucken klicken, tippen oder ENTER drücken.", "Click, tap or press ENTER to export as %1.": "Klicken, tippen oder ENTER drücken um als %1 zu exportieren", 'To save the image, right-click this link and choose "Save picture as..."': 'Um das Bild zu speichern, Rechtsklicken und "Bild speichern unter ..." auswählen', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Um das Bild zu speichern, Rechtsklick auf das Vorschaubild links und "Bild speichern unter ..." auswählen', "(Press ESC to close this message)": "ESC drücken um diese Nachricht zu schließen", "Image Export Complete": "Bildexport komplett", "Export operation took longer than expected. Something might have gone wrong.": "Der Export dauert länger als geplant. Vielleicht ist etwas schiefgelaufen.", "Saved from": "Gespeichert von", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "TAB nutzen, um Ankerpunkte auszuwählen oder linke und rechte Pfeiltaste um die Auswahl zu ändern", "Use left and right arrows to move selection": "Linke und rechte Pfeiltaste nutzen um die Auswahl zu verschieben", "Use left and right arrows to move left selection": "Linke und rechte Pfeiltaste nutzen um die linke Auswahl zu verschieben", "Use left and right arrows to move right selection": "Linke und rechte Pfeiltaste nutzen um die rechte Auswahl zu verschieben", "Use TAB select grip buttons or up and down arrows to change selection": "TAB nutzen, um Ankerpunkte auszuwählen oder Pfeiltaste nach oben und unten drücken, um die Auswahl zu ändern", "Use up and down arrows to move selection": "Pfeiltaste nach oben und unten drücken, um die Auswahl zu verschieben", "Use up and down arrows to move lower selection": "Pfeiltaste nach oben und unten drücken, um die untere Auswahl zu verschieben", "Use up and down arrows to move upper selection": "Pfeiltaste nach oben und unten drücken, um die obere Auswahl zu verschieben", "From %1 to %2": "Von %1 bis %2", "From %1": "Von %1", "To %1": "Bis %1", "No parser available for file: %1": "Kein Parser für Datei %1 verfügbar", "Error parsing file: %1": "Fehler beim Parsen von Datei %1", "Unable to load file: %1": "Datei %1 konnte nicht geladen werden", "Invalid date": "Kein Datum" }; +}(Cl, Tee)) !== void 0 && (Xet.exports = Ket); +const Tqi = Sqi({ __proto__: null, default: nl(Tee) }, [Tee]), Eqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + d: Tqi +}, Symbol.toStringTag, { value: "Module" })); +function Iqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Jet, Zet, Eee = {}, Aqi = { get exports() { + return Eee; +}, set exports(t) { + Eee = t; +} }; +Jet = Aqi, (Zet = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "μ.Χ.", _era_bc: "π.Χ.", A: "πμ", P: "μμ", AM: "π.μ.", PM: "μ.μ.", "A.M.": "π.μ.", "P.M.": "μ.μ.", January: "Ιανουαρίου", February: "Φεβρουαρίου", March: "Μαρτίου", April: "Απριλίου", May: "Μαΐου", June: "Ιουνίου", July: "Ιουλίου", August: "Αυγούστου", September: "Σεπτεμβρίου", October: "Οκτωβρίου", November: "Νοεμβρίου", December: "Δεκεμβρίου", Jan: "Ιαν", Feb: "Φεβ", Mar: "Μαρ", Apr: "Απρ", "May(short)": "Μαΐ", Jun: "Ιουν", Jul: "Ιουλ", Aug: "Αυγ", Sep: "Σεπ", Oct: "Οκτ", Nov: "Νοε", Dec: "Δεκ", Sunday: "Κυριακή", Monday: "Δευτέρα", Tuesday: "Τρίτη", Wednesday: "Τετάρτη", Thursday: "Πέμπτη", Friday: "Παρασκευή", Saturday: "Σάββατο", Sun: "Κυρ", Mon: "Δευ", Tue: "Τρί", Wed: "Τετ", Thu: "Πέμ", Fri: "Παρ", Sat: "Σάβ", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Εστίαση", Play: "Αναπαραγωγή", Stop: "Στάση", Legend: "Υπόμνημα", "Click, tap or press ENTER to toggle": "", Loading: "Φόρτωση", Home: "Αρχική", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Εκτύπωση", Image: "Image", Data: "Δεδομένα", Print: "Εκτύπωση", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Από %1 έως %2", "From %1": "Από %1", "To %1": "Έως %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Eee)) !== void 0 && (Jet.exports = Zet); +const Pqi = Iqi({ __proto__: null, default: nl(Eee) }, [Eee]), Oqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + e: Pqi +}, Symbol.toStringTag, { value: "Module" })); +function Rqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Qet, ett, Iee = {}, Mqi = { get exports() { + return Iee; +}, set exports(t) { + Iee = t; +} }; +Qet = Mqi, (ett = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm::ss SSS", _date_second: "hh:mm:ss a", _date_minute: "hh:mm a", _date_hour: "hh:mm a", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "AD", _era_bc: "BC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "", February: "", March: "", April: "", May: "", June: "", July: "", August: "", September: "", October: "", November: "", December: "", Jan: "", Feb: "", Mar: "", Apr: "", "May(short)": "May", Jun: "", Jul: "", Aug: "", Sep: "", Oct: "", Nov: "", Dec: "", Sunday: "", Monday: "", Tuesday: "", Wednesday: "", Thursday: "", Friday: "", Saturday: "", Sun: "", Mon: "", Tue: "", Wed: "", Thu: "", Fri: "", Sat: "", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, Play: "", Stop: "", "Zoom Out": "", Legend: "", "Click, tap or press ENTER to toggle": "", Loading: "", Home: "", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Chord diagram": "", "Flow diagram": "", "TreeMap chart": "", Series: "", "Candlestick Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "", Image: "", Data: "", Print: "", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "", "From %1": "", "To %1": "", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Iee)) !== void 0 && (Qet.exports = ett); +const Dqi = Rqi({ __proto__: null, default: nl(Iee) }, [Iee]), Fqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + e: Dqi +}, Symbol.toStringTag, { value: "Module" })); +function Lqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ttt, itt, Aee = {}, Nqi = { get exports() { + return Aee; +}, set exports(t) { + Aee = t; +} }; +ttt = Nqi, (itt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm::ss SSS", _date_second: "hh:mm:ss a", _date_minute: "hh:mm a", _date_hour: "hh:mm a", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "AD", _era_bc: "BC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "", February: "", March: "", April: "", May: "", June: "", July: "", August: "", September: "", October: "", November: "", December: "", Jan: "", Feb: "", Mar: "", Apr: "", "May(short)": "May", Jun: "", Jul: "", Aug: "", Sep: "", Oct: "", Nov: "", Dec: "", Sunday: "", Monday: "", Tuesday: "", Wednesday: "", Thursday: "", Friday: "", Saturday: "", Sun: "", Mon: "", Tue: "", Wed: "", Thu: "", Fri: "", Sat: "", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, Play: "", Stop: "", "Zoom Out": "", Legend: "", "Click, tap or press ENTER to toggle": "", Loading: "", Home: "", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Chord diagram": "", "Flow diagram": "", "TreeMap chart": "", Series: "", "Candlestick Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "", Image: "", Data: "", Print: "", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "", "From %1": "", "To %1": "", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Aee)) !== void 0 && (ttt.exports = itt); +const kqi = Lqi({ __proto__: null, default: nl(Aee) }, [Aee]), $qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + e: kqi +}, Symbol.toStringTag, { value: "Module" })); +function Bqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var rtt, ntt, Pee = {}, Vqi = { get exports() { + return Pee; +}, set exports(t) { + Pee = t; +} }; +rtt = Vqi, (ntt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "DC", _era_bc: "AC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Enero", February: "Febrero", March: "Marzo", April: "Abril", May: "Mayo", June: "Junio", July: "Julio", August: "Agosto", September: "Septiembre", October: "Octubre", November: "Noviembre", December: "Diciembre", Jan: "Ene", Feb: "Feb", Mar: "Mar", Apr: "Abr", "May(short)": "May", Jun: "Jun", Jul: "Jul", Aug: "Ago", Sep: "Sep", Oct: "Oct", Nov: "Nov", Dec: "Dic", Sunday: "Domingo", Monday: "Lunes", Tuesday: "Martes", Wednesday: "Miércoles", Thursday: "Jueves", Friday: "Viernes", Saturday: "Sábado", Sun: "Dom", Mon: "Lun", Tue: "Mar", Wed: "Mie", Thu: "Jue", Fri: "Vie", Sat: "Sáb", _dateOrd: function(i) { + return "º"; + }, "Zoom Out": "Aumentar Zoom", Play: "Reproducir", Stop: "Detener", Legend: "Leyenda", "Click, tap or press ENTER to toggle": "Haga clic, toque o presione ENTER para alternar", Loading: "Cargando", Home: "Inicio", Chart: "Gráfico", "Serial chart": "Gráfico de serie", "X/Y chart": "Gráfico X/Y", "Pie chart": "Gráfico circular", "Gauge chart": "Gráfico de medidor radial", "Radar chart": "Gráfico de radar", "Sankey diagram": "Diagrama de sankey", "Chord diagram": "Diagrama de cuerdas", "Flow diagram": "Diagrama de flujo", "TreeMap chart": "Gráfico de mapa de árbol", Series: "Series", "Candlestick Series": "Series de velas", "Column Series": "Series de columnas", "Line Series": "Series de líneas", "Pie Slice Series": "Series de trozos circular", "X/Y Series": "Series de X/Y", Map: "Mapa", "Press ENTER to zoom in": "Presione ENTER para aumentar el zoom", "Press ENTER to zoom out": "Presione ENTER para disminuir el zoom", "Use arrow keys to zoom in and out": "Use los cursores para disminuir o aumentar el zoom", "Use plus and minus keys on your keyboard to zoom in and out": "Use las teclas mas o menos en su teclado para disminuir ou aumentar el zoom", Export: "Exportar", Image: "Imagen", Data: "Datos", Print: "Imprimir", "Click, tap or press ENTER to open": "Haga clic, toque o presione ENTER para abrir", "Click, tap or press ENTER to print.": "Haga clic, toque o presione ENTER para imprimir", "Click, tap or press ENTER to export as %1.": "Haga clic, toque o presione ENTER para exportar como %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'Para guardar la imagen, haga clic en el link con el botón derecho y elija "Guardar imagen como..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Para guardar la imagen, haga clic con el botón derecho en la miniatura a la izquierda y elija "Guardar imagen como ..."', "(Press ESC to close this message)": "(Presione ESC para cerrar este mensaje)", "Image Export Complete": "Exportación de imagen completada", "Export operation took longer than expected. Something might have gone wrong.": "La operación de exportación llevó más tiempo de lo esperado. Algo pudo haber salido mal.", "Saved from": "Guardado de", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Use TAB para seleccionar los botones de agarre o las flechas izquierda y derecha para cambiar la selección", "Use left and right arrows to move selection": "Use las flechas izquierda y derecha para mover la selección", "Use left and right arrows to move left selection": "Use las flechas izquierda y derecha para mover la selección izquierda", "Use left and right arrows to move right selection": "Use las flechas izquierda y derecha para mover la selección derecha", "Use TAB select grip buttons or up and down arrows to change selection": "Utilice los botones de control de selección TAB o flechas arriba y abajo para cambiar la selección", "Use up and down arrows to move selection": "Use las flechas hacia arriba y hacia abajo para mover la selección", "Use up and down arrows to move lower selection": "Use las flechas hacia arriba y hacia abajo para mover la selección inferior", "Use up and down arrows to move upper selection": "Use las flechas hacia arriba y hacia abajo para mover la selección superior", "From %1 to %2": "Desde %1 hasta %2", "From %1": "Desde %1", "To %1": "Hasta %1", "No parser available for file: %1": "No hay analizador disponible para el archivo: %1", "Error parsing file: %1": "Error al analizar el archivo: %1", "Unable to load file: %1": "No se puede cargar el archivo: %1", "Invalid date": "Fecha inválida" }; +}(Cl, Pee)) !== void 0 && (rtt.exports = ntt); +const jqi = Bqi({ __proto__: null, default: nl(Pee) }, [Pee]), Gqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + e: jqi +}, Symbol.toStringTag, { value: "Module" })); +function Uqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var stt, ott, Oee = {}, zqi = { get exports() { + return Oee; +}, set exports(t) { + Oee = t; +} }; +stt = zqi, (ott = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "pKr", _era_bc: "eKr", A: "AM", P: "PM", AM: "AM", PM: "PM", "A.M.": "AM", "P.M.": "PM", January: "jaanuar", February: "veebruar", March: "märts", April: "aprill", May: "mai", June: "juuni", July: "juuli", August: "august", September: "september", October: "oktoober", November: "november", December: "detsember", Jan: "jaan", Feb: "veebr", Mar: "märts", Apr: "apr", "May(short)": "mai", Jun: "juuni", Jul: "juuli", Aug: "aug", Sep: "sept", Oct: "okt", Nov: "nov", Dec: "dets", Sunday: "pühapäev", Monday: "esmaspäev", Tuesday: "teisipäev", Wednesday: "kolmapäev", Thursday: "neljapäev", Friday: "reede", Saturday: "laupäev", Sun: "P", Mon: "E", Tue: "T", Wed: "K", Thu: "N", Fri: "R", Sat: "L", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Suumi", Play: "Esita", Stop: "Lõpeta", Legend: "Legend", "Click, tap or press ENTER to toggle": "", Loading: "Laadin", Home: "Kodu", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Prindi", Image: "Pilt", Data: "Andmed", Print: "Prindi", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Alates %1 kuni %2", "From %1": "Alates %1", "To %1": "Kuni %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Oee)) !== void 0 && (stt.exports = ott); +const Hqi = Uqi({ __proto__: null, default: nl(Oee) }, [Oee]), Wqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + e: Hqi +}, Symbol.toStringTag, { value: "Module" })); +function qqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var att, ltt, Ree = {}, Yqi = { get exports() { + return Ree; +}, set exports(t) { + Ree = t; +} }; +att = Yqi, (ltt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "jKr.", _era_bc: "eKr.", A: "ap.", P: "ip.", AM: "ap.", PM: "ip.", "A.M.": "ap.", "P.M.": "ip.", January: "tammikuuta", February: "helmikuuta", March: "maaliskuuta", April: "huhtikuuta", May: "toukokuuta", June: "kesäkuuta", July: "heinäkuuta", August: "elokuuta", September: "syyskuuta", October: "lokakuuta", November: "marraskuuta", December: "joulukuuta", Jan: "tammik.", Feb: "helmik.", Mar: "maalisk.", Apr: "huhtik.", "May(short)": "toukok.", Jun: "kesäk.", Jul: "heinäk.", Aug: "elok.", Sep: "syysk.", Oct: "lokak.", Nov: "marrask.", Dec: "jouluk.", Sunday: "sunnuntaina", Monday: "maanantaina", Tuesday: "tiistaina", Wednesday: "keskiviikkona", Thursday: "torstaina", Friday: "perjantaina", Saturday: "lauantaina", Sun: "su", Mon: "ma", Tue: "ti", Wed: "ke", Thu: "to", Fri: "pe", Sat: "la", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Tarkennus", Play: "Toista", Stop: "Lopeta", Legend: "Selite", "Click, tap or press ENTER to toggle": "", Loading: "Ladataan", Home: "Aloitussivu", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Tulosta", Image: "kuva", Data: "Data", Print: "Tulosta", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Mistä %1 mihin %2", "From %1": "Mistä %1", "To %1": "Mihin %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Ree)) !== void 0 && (att.exports = ltt); +const Xqi = qqi({ __proto__: null, default: nl(Ree) }, [Ree]), Kqi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + f: Xqi +}, Symbol.toStringTag, { value: "Module" })); +function Jqi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var utt, ctt, Mee = {}, Zqi = { get exports() { + return Mee; +}, set exports(t) { + Mee = t; +} }; +utt = Zqi, (ctt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "AD", _era_bc: "BC", A: "A", P: "P", AM: "AM", PM: "PM", "A.M.": "A.M.", "P.M.": "P.M.", January: "Janvier", February: "Février", March: "Mars", April: "Avril", May: "Mai", June: "Juin", July: "Juillet", August: "Août", September: "Septembre", October: "Octobre", November: "Novembre", December: "Décembre", Jan: "Jan", Feb: "Fév", Mar: "Mar", Apr: "Avr", "May(short)": "Mai", Jun: "Jui", Jul: "Jul", Aug: "Aoû", Sep: "Sep", Oct: "Oct", Nov: "Nov", Dec: "Déc", Sunday: "Dimanche", Monday: "Lundi", Tuesday: "Mardi", Wednesday: "Mercredi", Thursday: "Jeudi", Friday: "Vendredi", Saturday: "Samedi", Sun: "Dim", Mon: "Lun", Tue: "Mar", Wed: "Mer", Thu: "Jeu", Fri: "Ven", Sat: "Sam", _dateOrd: function(i) { + var r = "e"; + return (i < 11 || i > 13) && i % 10 == 1 && (r = "er"), r; + }, "Zoom Out": "Zoom Arrière", Play: "Joue", Stop: "Arrête", Legend: "Légende", "Click, tap or press ENTER to toggle": "cliquez, appuyez ou appuyez sur entrée pour basculer", Loading: "Charger", Home: "Accueil", Chart: "Graphique", "Serial chart": "Graphique sérial", "X/Y chart": "Graphique X/Y", "Pie chart": "Camembert", "Gauge chart": "Jauge graphique", "Radar chart": "Carte radar", "Sankey diagram": "Graphique Sankey", "Flow diagram": "représentation schématique", "Chord diagram": "diagramme d'accord", "TreeMap chart": "carte de l'arbre", "Sliced chart": "graphique en tranches", Series: "Séries", "Candlestick Series": "Séries chandelier", "OHLC Series": "Séries OHLC", "Column Series": "Séries de colonnes", "Line Series": "Série de lignes", "Pie Slice Series": "Tarte tranche Séries", "Funnel Series": "Séries d'entonnoir", "Pyramid Series": "Séries pyramidale", "X/Y Series": "Séries X/Y", Map: "Mappe", "Press ENTER to zoom in": "Appuyez sur ENTER pour zoomer", "Press ENTER to zoom out": "Appuyez sur ENTER pour effectuer un zoom arrière", "Use arrow keys to zoom in and out": "Utilisez les touches fléchées pour zoomer et dézoomer", "Use plus and minus keys on your keyboard to zoom in and out": "Utilisez les touches plus et moins de votre clavier pour effectuer un zoom avant ou arrière", Export: "Exporter", Image: "Image", Data: "Data", Print: "Imprimer", "Click, tap or press ENTER to open": "Cliquez, appuyez ou appuyez sur ENTER pour ouvrir", "Click, tap or press ENTER to print.": "Cliquez, appuyez ou appuyez sur ENTER pour imprimer", "Click, tap or press ENTER to export as %1.": "Cliquez, appuyez ou appuyez sur ENTER pour exporter comme %1", 'To save the image, right-click this link and choose "Save picture as..."': "Pour enregistrer l'image, cliquez avec le bouton droit sur ce lien et choisissez 'Enregistrer l'image sous ...'", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "'Pour enregistrer l'image, cliquez sur la vignette à gauche avec le bouton droit de la souris et choisissez 'Enregistrer l'image sous ...'", "(Press ESC to close this message)": "(Appuyez sur ESC pour fermer ce message)", "Image Export Complete": "Exportation d'image terminée", "Export operation took longer than expected. Something might have gone wrong.": "L'exportation a pris plus de temps que prévu. Quelque chose aurait mal tourné.", "Saved from": "Enregistré de", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Utilisez la touche TAB pour sélectionner les boutons des poignées ou les flèches gauche et droite pour modifier la sélection.", "Use left and right arrows to move selection": "Utilisez les flèches gauche et droite pour déplacer la sélection", "Use left and right arrows to move left selection": "Utilisez les flèches gauche et droite pour déplacer la sélection gauche", "Use left and right arrows to move right selection": "Utilisez les flèches gauche et droite pour déplacer la sélection droite", "Use TAB select grip buttons or up and down arrows to change selection": "Utilisez les boutons de sélection TAB ou les flèches vers le haut et le bas pour modifier la sélection.", "Use up and down arrows to move selection": "Utilisez les flèches haut et bas pour déplacer la sélection", "Use up and down arrows to move lower selection": "Utilisez les flèches haut et bas pour déplacer la sélection inférieure", "Use up and down arrows to move upper selection": "Utilisez les flèches haut et bas pour déplacer la sélection supérieure", "From %1 to %2": "De %1 à %2", "From %1": "De %1", "To %1": "à %1", "No parser available for file: %1": "Aucun analyseur disponible pour le fichier: %1", "Error parsing file: %1": "Erreur d'analyse du fichier: %1", "Unable to load file: %1": "Impossible de charger le fichier: %1", "Invalid date": "Date invalide" }; +}(Cl, Mee)) !== void 0 && (utt.exports = ctt); +const Qqi = Jqi({ __proto__: null, default: nl(Mee) }, [Mee]), eYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + f: Qqi +}, Symbol.toStringTag, { value: "Module" })); +function tYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var htt, dtt, Dee = {}, iYi = { get exports() { + return Dee; +}, set exports(t) { + Dee = t; +} }; +htt = iYi, (dtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "לספירה", _era_bc: "לפנה״ס", A: "לפנה״צ", P: "אחה״צ", AM: "לפנה״צ", PM: "אחה״צ", "A.M.": "לפנה״צ", "P.M.": "אחה״צ", January: "ינואר", February: "פברואר", March: "מרץ", April: "אפריל", May: "מאי", June: "יוני", July: "יולי", August: "אוגוסט", September: "ספטמבר", October: "אוקטובר", November: "נובמבר", December: "דצמבר", Jan: "ינו׳", Feb: "פבר׳", Mar: "מרץ", Apr: "אפר׳", "May(short)": "מאי", Jun: "יוני", Jul: "יולי", Aug: "אוג׳", Sep: "ספט׳", Oct: "אוק׳", Nov: "נוב׳", Dec: "דצמ׳", Sunday: "יום ראשון", Monday: "יום שני", Tuesday: "יום שלישי", Wednesday: "יום רביעי", Thursday: "יום חמישי", Friday: "יום שישי", Saturday: "יום שבת", Sun: "יום א׳", Mon: "יום ב׳", Tue: "יום ג׳", Wed: "יום ד׳", Thu: "יום ה׳", Fri: "יום ו׳", Sat: "שבת", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "התמקד", Play: "נגן", Stop: "עצור", Legend: "מקרא", "Click, tap or press ENTER to toggle": "", Loading: "טעינה", Home: "דף הבית", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "הדפס", Image: "תמונה", Data: "נתונים", Print: "הדפס", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "מ %1 עד %2", "From %1": "מ %1", "To %1": "עד %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Dee)) !== void 0 && (htt.exports = dtt); +const rYi = tYi({ __proto__: null, default: nl(Dee) }, [Dee]), nYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + h: rYi +}, Symbol.toStringTag, { value: "Module" })); +function sYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ptt, ftt, Fee = {}, oYi = { get exports() { + return Fee; +}, set exports(t) { + Fee = t; +} }; +ptt = oYi, (ftt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "po. Kr.", _era_bc: "pr. Kr.", A: "AM", P: "PM", AM: "AM", PM: "PM", "A.M.": "AM", "P.M.": "PM", January: "siječnja", February: "veljače", March: "ožujka", April: "travnja", May: "svibnja", June: "lipnja", July: "srpnja", August: "kolovoza", September: "rujna", October: "listopada", November: "studenoga", December: "prosinca", Jan: "sij", Feb: "velj", Mar: "ožu", Apr: "tra", "May(short)": "svi", Jun: "lip", Jul: "srp", Aug: "kol", Sep: "ruj", Oct: "lis", Nov: "stu", Dec: "pro", Sunday: "nedjelja", Monday: "ponedjeljak", Tuesday: "utorak", Wednesday: "srijeda", Thursday: "četvrtak", Friday: "petak", Saturday: "subota", Sun: "ned", Mon: "pon", Tue: "uto", Wed: "sri", Thu: "čet", Fri: "pet", Sat: "sub", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Povećaj", Play: "Reproduciraj", Stop: "Zaustavi", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Učitavanje", Home: "Početna", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Ispis", Image: "Slika", Data: "Podaci", Print: "Ispis", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Fee)) !== void 0 && (ptt.exports = ftt); +const aYi = sYi({ __proto__: null, default: nl(Fee) }, [Fee]), lYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + h: aYi +}, Symbol.toStringTag, { value: "Module" })); +function uYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var mtt, gtt, Lee = {}, cYi = { get exports() { + return Lee; +}, set exports(t) { + Lee = t; +} }; +mtt = cYi, (gtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "i. sz.", _era_bc: "i. e.", A: "de.", P: "du.", AM: "de.", PM: "du.", "A.M.": "de.", "P.M.": "du.", January: "január", February: "február", March: "március", April: "április", May: "május", June: "június", July: "július", August: "augusztus", September: "szeptember", October: "október", November: "november", December: "december", Jan: "jan.", Feb: "febr.", Mar: "márc.", Apr: "ápr.", "May(short)": "máj.", Jun: "jún.", Jul: "júl.", Aug: "aug.", Sep: "szept.", Oct: "okt.", Nov: "nov.", Dec: "dec.", Sunday: "vasárnap", Monday: "hétfő", Tuesday: "kedd", Wednesday: "szerda", Thursday: "csütörtök", Friday: "péntek", Saturday: "szombat", Sun: "V", Mon: "H", Tue: "K", Wed: "Sze", Thu: "Cs", Fri: "P", Sat: "Szo", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Nagyítás/kicsinyítés", Play: "Lejátszás", Stop: "Megálló", Legend: "Jelmagyarázat", "Click, tap or press ENTER to toggle": "", Loading: "Betöltés", Home: "Kezdőlap", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Nyomtatás", Image: "Kép", Data: "Adatok", Print: "Nyomtatás", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Ettől %1 eddig %2", "From %1": "Ettől %1", "To %1": "Eddig %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Lee)) !== void 0 && (mtt.exports = gtt); +const hYi = uYi({ __proto__: null, default: nl(Lee) }, [Lee]), dYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + h: hYi +}, Symbol.toStringTag, { value: "Module" })); +function pYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ytt, vtt, Nee = {}, fYi = { get exports() { + return Nee; +}, set exports(t) { + Nee = t; +} }; +ytt = fYi, (vtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "M", _era_bc: "SM", A: "AM", P: "PM", AM: "AM", PM: "PM", "A.M.": "AM", "P.M.": "PM", January: "Januari", February: "Februari", March: "Maret", April: "April", May: "Mei", June: "Juni", July: "Juli", August: "Agustus", September: "September", October: "Oktober", November: "November", December: "Desember", Jan: "Jan", Feb: "Feb", Mar: "Mar", Apr: "Apr", "May(short)": "Mei", Jun: "Jun", Jul: "Jul", Aug: "Agu", Sep: "Sep", Oct: "Okt", Nov: "Nov", Dec: "Des", Sunday: "Minggu", Monday: "Senin", Tuesday: "Selasa", Wednesday: "Rabu", Thursday: "Kamis", Friday: "Jumat", Saturday: "Sabtu", Sun: "Min", Mon: "Sen", Tue: "Sel", Wed: "Rab", Thu: "Kam", Fri: "Jum", Sat: "Sab", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Perkecil", Play: "Putar", Stop: "Hentikan", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Klik, ketuk atau tekan ENTER untuk beralih", Loading: "Memuat", Home: "Beranda", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "Peta", "Press ENTER to zoom in": "Tekan ENTER untuk memperbesar", "Press ENTER to zoom out": "Tekan ENTER untuk memperkecil", "Use arrow keys to zoom in and out": "Gunakan tombol panah untuk memperbesar dan memperkecil", "Use plus and minus keys on your keyboard to zoom in and out": "Gunakan tombol plus dan minus pada keyboard Anda untuk memperbesar dan memperkecil", Export: "Cetak", Image: "Gambar", Data: "Data", Print: "Cetak", "Click, tap or press ENTER to open": "Klik, ketuk atau tekan ENTER untuk membuka", "Click, tap or press ENTER to print.": "Klik, ketuk atau tekan ENTER untuk mencetak", "Click, tap or press ENTER to export as %1.": "Klik, ketuk atau tekan ENTER untuk mengekspor sebagai %1", 'To save the image, right-click this link and choose "Save picture as..."': 'Untuk menyimpan gambar, klik kanan tautan ini dan pilih "Simpan gambar sebagai"', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "Tekan ESC untuk menutup pesan ini", "Image Export Complete": "Ekspor gambar selesai", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Dari %1 ke %2", "From %1": "Dari %1", "To %1": "Ke %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Nee)) !== void 0 && (ytt.exports = vtt); +const mYi = pYi({ __proto__: null, default: nl(Nee) }, [Nee]), gYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + i: mYi +}, Symbol.toStringTag, { value: "Module" })); +function yYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var _tt, btt, kee = {}, vYi = { get exports() { + return kee; +}, set exports(t) { + kee = t; +} }; +_tt = vYi, (btt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "HH:mm:ss SSS", _duration_millisecond_day: "d'g' mm:ss SSS", _duration_millisecond_week: "d'g' mm:ss SSS", _duration_millisecond_month: "M'm' dd'g' mm:ss SSS", _duration_millisecond_year: "y'a' MM'm' dd'g' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'g' hh:mm:ss", _duration_second_week: "d'g' hh:mm:ss", _duration_second_month: "M'm' dd'g' hh:mm:ss", _duration_second_year: "y'a' MM'm' dd'g' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'g' hh:mm", _duration_minute_week: "d'g' hh:mm", _duration_minute_month: "M'm' dd'g' hh:mm", _duration_minute_year: "y'a' MM'm' dd'g' hh:mm", _duration_hour: "hh'o'", _duration_hour_day: "d'g' hh'o'", _duration_hour_week: "d'g' hh'o'", _duration_hour_month: "M'm' dd'g' hh'o'", _duration_hour_year: "y'a' MM'm' dd'g' hh'o'", _duration_day: "d'g'", _duration_day_week: "d'g'", _duration_day_month: "M'm' dd'g'", _duration_day_year: "y'a' MM'm' dd'g'", _duration_week: "w's'", _duration_week_month: "w's'", _duration_week_year: "w's'", _duration_month: "M'm'", _duration_month_year: "y'a' MM'm'", _duration_year: "y'a'", _era_ad: "A.C.", _era_bc: "D.C.", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Gennaio", February: "Febbraio", March: "Marzo", April: "Aprile", May: "Maggio", June: "Giugno", July: "Luglio", August: "Agosto", September: "Settembre", October: "Ottobre", November: "Novembre", December: "Dicembre", Jan: "Gen", Feb: "Feb", Mar: "Mar", Apr: "Apr", "May(short)": "Mag", Jun: "Giu", Jul: "Lug", Aug: "Ago", Sep: "Set", Oct: "Ott", Nov: "Nov", Dec: "Dic", Sunday: "Domenica", Monday: "Lunedì", Tuesday: "Martedì", Wednesday: "Mercoledì", Thursday: "Giovedì", Friday: "Venerdì", Saturday: "Sabato", Sun: "Dom", Mon: "Lun", Tue: "Mar", Wed: "Mer", Thu: "Gio", Fri: "Ven", Sat: "Sab", _dateOrd: function(i) { + return i + "°"; + }, "Zoom Out": "Riduci zoom", Play: "Avvia", Stop: "Ferma", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Clicca, tappa o premi ENTER per attivare", Loading: "Caricamento", Home: "Home", Chart: "Grafico", "Serial chart": "Grafico combinato", "X/Y chart": "Grafico X/Y", "Pie chart": "Grafico a torta", "Gauge chart": "Diagramma di livello", "Radar chart": "Grafico radar", "Sankey diagram": "Diagramma di Sankey", "Flow diagram": "Diagramma di flusso", "Chord diagram": "Diagramma a corda", "TreeMap chart": "Mappa ad albero", "Sliced chart": "Grafico a fette", Series: "Serie", "Candlestick Series": "Serie a candele", "OHLC Series": "Serie OHLC", "Column Series": "Serie a colonne", "Line Series": "Serie a linee", "Pie Slice Series": "Serie a fetta di torta", "Funnel Series": "Serie ad imbuto", "Pyramid Series": "Serie a piramide", "X/Y Series": "Serie X/Y", Map: "Mappa", "Press ENTER to zoom in": "Premi ENTER per ingrandire", "Press ENTER to zoom out": "Premi ENTER per ridurre", "Use arrow keys to zoom in and out": "Usa le frecce per ingrandire e ridurre", "Use plus and minus keys on your keyboard to zoom in and out": "Utilizza i tasti più e meno sulla tastiera per ingrandire e ridurre", Export: "Esporta", Image: "Immagine", Data: "Dati", Print: "Stampa", "Click, tap or press ENTER to open": "Clicca, tappa o premi ENTER per aprire", "Click, tap or press ENTER to print.": "Clicca, tappa o premi ENTER per stampare.", "Click, tap or press ENTER to export as %1.": "Clicca, tappa o premi ENTER per esportare come %1.", 'To save the image, right-click this link and choose "Save picture as..."': `Per salvare l'immagine, fai clic con il pulsante destro del mouse su questo link e seleziona "Salva immagine come ..."`, 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': `Per salvare l'immagine, fare clic con il tasto destro del mouse sulla miniatura e selezionare "Salva immagine come ..."`, "(Press ESC to close this message)": "(Premere ESC per chiudere questo messaggio)", "Image Export Complete": "Esportazione immagine completata", "Export operation took longer than expected. Something might have gone wrong.": "L'operazione di esportazione ha richiesto più tempo del previsto. Potrebbe esserci qualche problema.", "Saved from": "Salvato da", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Utilizzare TAB per selezionare i punti di ancoraggio o i tasti freccia sinistra e destra per modificare la selezione", "Use left and right arrows to move selection": "Utilizzare le frecce sinistra e destra per spostare la selezione", "Use left and right arrows to move left selection": "Utilizzare frecce destra e sinistra per spostare la selezione sinistra", "Use left and right arrows to move right selection": "Utilizzare frecce destra e sinistra per spostare la selezione destra", "Use TAB select grip buttons or up and down arrows to change selection": "Utilizzare TAB per selezionare i punti di ancoraggio o premere le frecce su e giù per modificare la selezione", "Use up and down arrows to move selection": "Utilizzare le frecce su e giù per spostare la selezione", "Use up and down arrows to move lower selection": "Utilizzare le frecce su e giù per spostare la selezione inferiore", "Use up and down arrows to move upper selection": "Utilizzare le frecce su e giù per spostare la selezione superiore", "From %1 to %2": "Da %1 a %2", "From %1": "Da %1", "To %1": "a %1", "No parser available for file: %1": "Nessun parser disponibile per il file: %1", "Error parsing file: %1": "Errore durante l'analisi del file: %1", "Unable to load file: %1": "Impossibile caricare il file: %1", "Invalid date": "Data non valida" }; +}(Cl, kee)) !== void 0 && (_tt.exports = btt); +const _Yi = yYi({ __proto__: null, default: nl(kee) }, [kee]), bYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + i: _Yi +}, Symbol.toStringTag, { value: "Module" })); +function wYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var wtt, xtt, $ee = {}, xYi = { get exports() { + return $ee; +}, set exports(t) { + $ee = t; +} }; +wtt = xYi, (xtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "西暦", _era_bc: "紀元前", A: "午前", P: "午後", AM: "午前", PM: "午後", "A.M.": "午前", "P.M.": "午後", January: "1月", February: "2月", March: "3月", April: "4月", May: "5月", June: "6月", July: "7月", August: "8月", September: "9月", October: "10月", November: "11月", December: "12月", Jan: "1月", Feb: "2月", Mar: "3月", Apr: "4月", "May(short)": "5月", Jun: "6月", Jul: "7月", Aug: "8月", Sep: "9月", Oct: "10月", Nov: "11月", Dec: "12月", Sunday: "日曜日", Monday: "月曜日", Tuesday: "火曜日", Wednesday: "水曜日", Thursday: "木曜日", Friday: "金曜日", Saturday: "土曜日", Sun: "日", Mon: "月", Tue: "火", Wed: "水", Thu: "木", Fri: "金", Sat: "土", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "ズーム", Play: "再生", Stop: "停止", Legend: "凡例", "Click, tap or press ENTER to toggle": "", Loading: "読み込んでいます", Home: "ホーム", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "印刷", Image: "イメージ", Data: "データ", Print: "印刷", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "始点 %1 終点 %2", "From %1": "始点 %1", "To %1": "終点 %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, $ee)) !== void 0 && (wtt.exports = xtt); +const SYi = wYi({ __proto__: null, default: nl($ee) }, [$ee]), CYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + j: SYi +}, Symbol.toStringTag, { value: "Module" })); +function TYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Stt, Ctt, Bee = {}, EYi = { get exports() { + return Bee; +}, set exports(t) { + Bee = t; +} }; +Stt = EYi, (Ctt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date: "yyyy-MM-dd", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "AD", _era_bc: "BC", A: "AM", P: "PM", AM: "AM", PM: "PM", "A.M.": "오전", "P.M.": "오후", January: "1월", February: "2월", March: "3월", April: "4월", May: "5월", June: "6월", July: "7월", August: "8월", September: "9월", October: "10월", November: "11월", December: "12월", Jan: "1월", Feb: "2월", Mar: "3월", Apr: "4월", "May(short)": "5월", Jun: "6월", Jul: "7월", Aug: "8월", Sep: "9월", Oct: "10월", Nov: "11월", Dec: "12월", Sunday: "일요일", Monday: "월요일", Tuesday: "화요일", Wednesday: "수요일", Thursday: "목요일", Friday: "금요일", Saturday: "토요일", Sun: "일", Mon: "월", Tue: "화", Wed: "수", Thu: "목", Fri: "금", Sat: "토", _dateOrd: function(i) { + var r = "일"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + case 2: + case 3: + r = "일"; + } + return r; + }, "Zoom Out": "축소", Play: "시작", Stop: "정지", Legend: "범례", "Click, tap or press ENTER to toggle": "켜고 끄려면 클릭, 탭 혹은 엔터를 눌러주세요.", Loading: "불러오는 중", Home: "홈", Chart: "차트", "Serial chart": "시리얼 차트", "X/Y chart": "X/Y 차트", "Pie chart": "파이 차트", "Gauge chart": "게이지 차트", "Radar chart": "레이더 차트", "Sankey diagram": "생키 다이어그램", "Flow diagram": "플로우 다이어그램", "Chord diagram": "코드 다이어그램", "TreeMap chart": "트리맵 차트", "Force directed tree": "포스 디렉티드 트리", "Sliced chart": "슬라이스 차트", Series: "시리즈", "Candlestick Series": "캔들스틱 시리즈", "OHLC Series": "OHLC 시리즈", "Column Series": "컬럼 시리즈", "Line Series": "라인 시리즈", "Pie Slice Series": "파이 슬라이스 시리즈", "Funnel Series": "퍼널 시리즈", "Pyramid Series": "피라미드 시리즈", "X/Y Series": "X/Y 시리즈", Map: "맵", "Press ENTER to zoom in": "확대하려면 엔터를 누르세요.", "Press ENTER to zoom out": "축소하려면 엔터를 누르세요.", "Use arrow keys to zoom in and out": "확대 혹은 축소하려면 방향키를 이용하세요.", "Use plus and minus keys on your keyboard to zoom in and out": "확대 혹은 축소하려면 키보드의 +/- 키를 이용하세요.", Export: "내보내기", Image: "이미지", Data: "데이터", Print: "인쇄", "Click, tap or press ENTER to open": "열려면, 클릭, 탭 또는 엔터를 누르세요.", "Click, tap or press ENTER to print.": "출력하려면, 클릭, 탭 또는 엔터를 누르세요.", "Click, tap or press ENTER to export as %1.": "%1(으)로 내보내려면 클릭, 탭 또는 엔터를 누르세요.", 'To save the image, right-click this link and choose "Save picture as..."': '이미지를 저장하려면, 이 링크를 마우스로 우클릭하여 "다른 이름으로 저장"을 선택하세요.', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': '이미지를 저장하려면, 좌측 썸네일을 마우스로 우클릭하여 "다른 이름으로 저장"을 선택하세요.', "(Press ESC to close this message)": "(이 메시지를 끄려면 ESC를 누르세요.)", "Image Export Complete": "이미지 내보내기 완료", "Export operation took longer than expected. Something might have gone wrong.": "내보내기가 지연되고 있습니다. 문제가 없는지 확인이 필요합니다.", "Saved from": "다음으로부터 저장됨: ", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "선택 범위를 변경하려면 선택 버튼이나 좌우 화살표를 이용하세요.", "Use left and right arrows to move selection": "선택 범위를 움직이려면 좌우 화살표를 이용하세요.", "Use left and right arrows to move left selection": "왼쪽 선택 범위를 움직이려면 좌우 화살표를 이용하세요.", "Use left and right arrows to move right selection": "오른쪽 선택 범위를 움직이려면 좌우 화살표를 이용하세요.", "Use TAB select grip buttons or up and down arrows to change selection": "선택 범위를 변경하려면 선택 버튼이나 상하 화살표를 이용하세요.", "Use up and down arrows to move selection": "선택 범위를 움직이려면 상하 화살표를 이용하세요.", "Use up and down arrows to move lower selection": "하단 선택 범위를 움직이려면 상하 화살표를 이용하세요.", "Use up and down arrows to move upper selection": "상단 선택 범위를 움직이려면 상하 화살표를 이용하세요.", "From %1 to %2": "%1 부터 %2 까지", "From %1": "%1 부터", "To %1": "%1 까지", "No parser available for file: %1": "파일 파싱 불가능: %1", "Error parsing file: %1": "파일 파싱 오류: %1", "Unable to load file: %1": "파일 로드 불가능: %1", "Invalid date": "날짜 올바르지 않음" }; +}(Cl, Bee)) !== void 0 && (Stt.exports = Ctt); +const IYi = TYi({ __proto__: null, default: nl(Bee) }, [Bee]), AYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + k: IYi +}, Symbol.toStringTag, { value: "Module" })); +function PYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Ttt, Ett, Vee = {}, OYi = { get exports() { + return Vee; +}, set exports(t) { + Vee = t; +} }; +Ttt = OYi, (Ett = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm::ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "yyyy-MM-dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "m.e.", _era_bc: "p.m.e.", A: "R", P: "V", AM: "ryto", PM: "vakaro", "A.M.": "ryto", "P.M.": "vakaro", January: "sausio", February: "vasario", March: "kovo", April: "balandžio", May: "gegužės", June: "birželio", July: "liepos", August: "rugpjūčio", September: "rugsėjo", October: "spalio", November: "lapkričio", December: "gruodžio", Jan: "sau.", Feb: "vas.", Mar: "kov.", Apr: "bal.", "May(short)": "geg.", Jun: "bir.", Jul: "lie.", Aug: "rgp.", Sep: "rgs.", Oct: "spa.", Nov: "lap.", Dec: "gruo.", Sunday: "sekmadienis", Monday: "pirmadienis", Tuesday: "antradienis", Wednesday: "trečiadienis", Thursday: "ketvirtadienis", Friday: "penktadienis", Saturday: "šeštadienis", Sun: "sekm.", Mon: "pirm.", Tue: "antr.", Wed: "treč.", Thu: "ketv.", Fri: "penk.", Sat: "šešt.", _dateOrd: function(i) { + return "-a(s)"; + }, "Zoom Out": "Rodyti viską", Play: "Paleisti", Stop: "Sustabdyti", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Spragtelkite, palieskite arba spauskite ENTER, kad perjungtumėte", Loading: "Kraunama", Home: "Pradžia", Chart: "Grafikas", "Serial chart": "Serijinis grafikas", "X/Y chart": "X/Y grafikas", "Pie chart": "Pyrago tipo grafikas", "Gauge chart": "Daviklio tipo grafikas", "Radar chart": "Radaro tipo grafikas", "Sankey diagram": "Sankey diagrama", "Chord diagram": "Chord diagrama", "Flow diagram": "Flow diagrama", "TreeMap chart": "TreeMap grafikas", Series: "Serija", "Candlestick Series": '"Candlestick" tipo grafiko serija', "Column Series": "Stulpelinio grafiko serija", "Line Series": "Linijinio grafiko serija", "Pie Slice Series": "Pyrago tipo serija", "X/Y Series": "X/Y serija", Map: "Žemėlapis", "Press ENTER to zoom in": "Spauskite ENTER, kad pritrauktumėte vaizdą", "Press ENTER to zoom out": "Spauskite ENTER, kad atitolintumėte vaizdą", "Use arrow keys to zoom in and out": "Naudokitės royklėmis vaizdo pritraukimui ar atitolinimui", "Use plus and minus keys on your keyboard to zoom in and out": "Spauskite pliuso arba minuso klavišus ant klaviatūros, kad pritrautumėte arba atitolintumėte vaizdą", Export: "Eksportuoti", Image: "Paveiksliukas", Data: "Duomenys", Print: "Spausdinti", "Click, tap or press ENTER to open": "Spragtelkite arba spauskite ENTER, kad atidarytumėte", "Click, tap or press ENTER to print.": "Spragtelkite arba spauskite ENTER, kad spausdintumėte.", "Click, tap or press ENTER to export as %1.": "Spragtelkite arba spauskite ENTER, kad eksportuotumėte kaip %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'Kad išsaugotumėte paveiksliuką, spauskite dešinį pelės klavišą ir pasirinkite "Išsaugoti, kaip paveiksliuką..."', "(Press ESC to close this message)": "(Spauskite ESC, kad uždarytumėte šį pranešimą)", "Image Export Complete": "Paveiksliuko eksportas baigtas", "Export operation took longer than expected. Something might have gone wrong.": "Eksportas užtruko ilgiau negu turėtų. Greičiausiai įvyko klaida.", "Saved from": "Išsaugota iš", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Spauskite TAB klavišą, kad pasirinktumėte žymeklius, arba kairė/dešinė klavišus, kad pakeistumėte pasirinkimą", "Use left and right arrows to move selection": "Naudokitės klavišais kairė/dešinė, kad pajudintumėte pasirinkimą", "Use left and right arrows to move left selection": "Naudokitės klavišais kairė/dešinė, kad pajudintumėte kairį žymeklį", "Use left and right arrows to move right selection": "Naudokitės klavišais kairė/dešinė, kad pajudintumėte dešinį žymeklį", "Use TAB select grip buttons or up and down arrows to change selection": "Spauskite TAB klavišą, kad pasirinktumėte žymeklius, arba aukštyn/žemyn klavišus, kad pakeistumėte pasirinkimą", "Use up and down arrows to move selection": "Naudokitės klavišais aukštyn/žemyn, kad pajudintumėte pasirinkimą", "Use up and down arrows to move lower selection": "Naudokitės klavišais aukštyn/žemyn, kad pajudintumėte apatinį žymeklį", "Use up and down arrows to move upper selection": "Naudokitės klavišais aukštyn/žemyn, kad pajudintumėte viršutinį žymeklį", "From %1 to %2": "Nuo %1 iki %2", "From %1": "Nuo %1", "To %1": "Iki %1", "No parser available for file: %1": "Failui %1 neturime tinkamo dešifruotojo", "Error parsing file: %1": "Skaitant failą %1 įvyko klaida", "Unable to load file: %1": "Nepavyko užkrauti failo %1", "Invalid date": "Klaidinga data" }; +}(Cl, Vee)) !== void 0 && (Ttt.exports = Ett); +const RYi = PYi({ __proto__: null, default: nl(Vee) }, [Vee]), MYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + l: RYi +}, Symbol.toStringTag, { value: "Module" })); +function DYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Itt, Att, jee = {}, FYi = { get exports() { + return jee; +}, set exports(t) { + jee = t; +} }; +Itt = FYi, (Att = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "m.ē.", _era_bc: "p.m.ē.", A: "priekšp.", P: "pēcp.", AM: "priekšp.", PM: "pēcp.", "A.M.": "priekšpusdienā", "P.M.": "pēcpusdienā", January: "janvāris", February: "februāris", March: "marts", April: "aprīlis", May: "maijs", June: "jūnijs", July: "jūlijs", August: "augusts", September: "septembris", October: "oktobris", November: "novembris", December: "decembris", Jan: "janv.", Feb: "febr.", Mar: "marts", Apr: "apr.", "May(short)": "maijs", Jun: "jūn.", Jul: "jūl.", Aug: "aug.", Sep: "sept.", Oct: "okt.", Nov: "nov.", Dec: "dec.", Sunday: "svētdiena", Monday: "pirmdiena", Tuesday: "otrdiena", Wednesday: "trešdiena", Thursday: "ceturtdiena", Friday: "piektdiena", Saturday: "sestdiena", Sun: "svētd.", Mon: "pirmd.", Tue: "otrd.", Wed: "trešd.", Thu: "ceturtd.", Fri: "piektd.", Sat: "sestd.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Tālummaiņa", Play: "Darbināt", Stop: "Apturēt", Legend: "Apzīmējumi", "Click, tap or press ENTER to toggle": "", Loading: "Ielādē", Home: "Sākums", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Drukāt", Image: "Attēls", Data: "Dati", Print: "Drukāt", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "No %1 līdz %2", "From %1": "No %1", "To %1": "Līdz %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, jee)) !== void 0 && (Itt.exports = Att); +const LYi = DYi({ __proto__: null, default: nl(jee) }, [jee]), NYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + l: LYi +}, Symbol.toStringTag, { value: "Module" })); +function kYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Ptt, Ott, Gee = {}, $Yi = { get exports() { + return Gee; +}, set exports(t) { + Gee = t; +} }; +Ptt = $Yi, (Ott = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "e.Kr.", _era_bc: "f.Kr.", A: "a", P: "p", AM: "a.m.", PM: "p.m.", "A.M.": "a.m.", "P.M.": "p.m.", January: "januar", February: "februar", March: "mars", April: "april", May: "mai", June: "juni", July: "juli", August: "august", September: "september", October: "oktober", November: "november", December: "desember", Jan: "jan.", Feb: "feb.", Mar: "mar.", Apr: "apr.", "May(short)": "mai", Jun: "jun.", Jul: "jul.", Aug: "aug.", Sep: "sep.", Oct: "okt.", Nov: "nov.", Dec: "des.", Sunday: "søndag", Monday: "mandag", Tuesday: "tirsdag", Wednesday: "onsdag", Thursday: "torsdag", Friday: "fredag", Saturday: "lørdag", Sun: "søn.", Mon: "man.", Tue: "tir.", Wed: "ons.", Thu: "tor.", Fri: "fre.", Sat: "lør.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zoom", Play: "Spill av", Stop: "Stopp", Legend: "Tegnforklaring", "Click, tap or press ENTER to toggle": "", Loading: "Laster inn", Home: "Hjem", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Skriv ut", Image: "Bilde", Data: "Data", Print: "Skriv ut", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Fra %1 til %2", "From %1": "Fra %1", "To %1": "Til %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Gee)) !== void 0 && (Ptt.exports = Ott); +const BYi = kYi({ __proto__: null, default: nl(Gee) }, [Gee]), VYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + n: BYi +}, Symbol.toStringTag, { value: "Module" })); +function jYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Rtt, Mtt, Uee = {}, GYi = { get exports() { + return Uee; +}, set exports(t) { + Uee = t; +} }; +Rtt = GYi, (Mtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "d MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "AD", _era_bc: "v.C.", A: "A", P: "P", AM: "AM", PM: "PM", "A.M.": "a.m.", "P.M.": "p.m.", January: "januari", February: "februari", March: "maart", April: "april", May: "mei", June: "juni", July: "juli", August: "augustus", September: "september", October: "oktober", November: "november", December: "december", Jan: "jan", Feb: "feb", Mar: "mrt", Apr: "apr", "May(short)": "mei", Jun: "jun", Jul: "jul", Aug: "aug", Sep: "sep", Oct: "okt", Nov: "nov", Dec: "dec", Sunday: "zondag", Monday: "maandag", Tuesday: "dinsdag", Wednesday: "woensdag", Thursday: "donderdag", Friday: "vrijdag", Saturday: "zaterdag", Sun: "Zo", Mon: "Ma", Tue: "Di", Wed: "Wo", Thu: "Do", Fri: "Vr", Sat: "Za", _dateOrd: function(i) { + var r = "de"; + return (i == 1 || i == 8 || i > 19) && (r = "ste"), r; + }, "Zoom Out": "Uitzoomen", Play: "Afspelen", Stop: "Stoppen", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Klik, tik of druk op Enter om aan of uit te zetten", Loading: "Laden", Home: "Home", Chart: "Grafiek", "Serial chart": "Periodieke grafiek", "X/Y chart": "X-Y grafiek", "Pie chart": "Taartdiagram", "Gauge chart": "Meterdiagram", "Radar chart": "Radardiagram", "Sankey diagram": "Sankey-diagram", "Chord diagram": "Chord-diagram", "Flow diagram": "Flow-diagram", "TreeMap chart": "Treemap-grafiek", Series: "Reeks", "Candlestick Series": "Candlestick-reeks", "Column Series": "Kolomreeks", "Line Series": "Lijnreeks", "Pie Slice Series": "Taartpuntreeks", "X/Y Series": "XY reeks", Map: "Kaart", "Press ENTER to zoom in": "Druk op Enter om in te zoomen", "Press ENTER to zoom out": "Druk op Enter om uit te zoomen", "Use arrow keys to zoom in and out": "Zoom in of uit met de pijltjestoetsen", "Use plus and minus keys on your keyboard to zoom in and out": "Zoom in of uit met de plus- en minustoetsen", Export: "Exporteren", Image: "Afbeelding", Data: "Data", Print: "Printen", "Click, tap or press ENTER to open": "Klik, tik of druk op Enter om te openen", "Click, tap or press ENTER to print.": "Klik, tik of druk op Enter om te printen", "Click, tap or press ENTER to export as %1.": "Klik, tik of druk op Enter om te exporteren als %1", 'To save the image, right-click this link and choose "Save picture as..."': 'Klik met de rechtermuisknop op deze link en kies "Afbeelding opslaan als..." om de afbeelding op te slaan', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Klik met de rechtermuisknop op de miniatuur links en kies "Afbeelding opslaan als..." om de afbeelding op te slaan', "(Press ESC to close this message)": "(Druk op ESC om dit bericht te sluiten)", "Image Export Complete": "Afbeelding exporteren gereed", "Export operation took longer than expected. Something might have gone wrong.": "Exportproces duurt langer dan verwacht. Er is misschien iets fout gegaan.", "Saved from": "Opgeslagen via:", PNG: "PNG", JPG: "JPG", GIF: "GIF", SVG: "SVG", PDF: "PDF", JSON: "JSON", CSV: "CSV", XLSX: "XLSX", "Use TAB to select grip buttons or left and right arrows to change selection": "Gebruik Tab om de hendels te selecteren of linker- en rechterpijltje om de selectie te veranderen", "Use left and right arrows to move selection": "Gebruik linker- en rechterpijltje om de selectie te verplaatsen", "Use left and right arrows to move left selection": "Gebruik linker- en rechterpijltje om de linkerselectie te verplaatsen", "Use left and right arrows to move right selection": "Gebruik linker- en rechterpijltje om de rechterselectie te verplaatsen", "Use TAB select grip buttons or up and down arrows to change selection": "Gebruik Tab om de hendels te selecteren of pijltje omhoog en omlaag om de selectie te veranderen", "Use up and down arrows to move selection": "Gebruik pijltje omhoog en omlaag om de selectie te verplaatsen", "Use up and down arrows to move lower selection": "Gebruik pijltje omhoog en omlaag om de onderste selectie te verplaatsen", "Use up and down arrows to move upper selection": "Gebruik pijltje omhoog en omlaag om de bovenste selectie te verplaatsen", "From %1 to %2": "Van %1 tot %2", "From %1": "Van %1", "To %1": "Tot %2", "No parser available for file: %1": "Geen data-parser beschikbaar voor dit bestand: %1", "Error parsing file: %1": "Fout tijdens parsen van bestand: %1", "Unable to load file: %1": "Kan bestand niet laden: %1", "Invalid date": "Ongeldige datum" }; +}(Cl, Uee)) !== void 0 && (Rtt.exports = Mtt); +const UYi = jYi({ __proto__: null, default: nl(Uee) }, [Uee]), zYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + n: UYi +}, Symbol.toStringTag, { value: "Module" })); +function HYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Dtt, Ftt, zee = {}, WYi = { get exports() { + return zee; +}, set exports(t) { + zee = t; +} }; +Dtt = WYi, (Ftt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "n.e.", _era_bc: "p.n.e.", A: "a", P: "p", AM: "AM", PM: "PM", "A.M.": "AM", "P.M.": "PM", January: "stycznia", February: "lutego", March: "marca", April: "kwietnia", May: "maja", June: "czerwca", July: "lipca", August: "sierpnia", September: "września", October: "października", November: "listopada", December: "grudnia", Jan: "sty", Feb: "lut", Mar: "mar", Apr: "kwi", "May(short)": "maj", Jun: "cze", Jul: "lip", Aug: "sie", Sep: "wrz", Oct: "paź", Nov: "lis", Dec: "gru", Sunday: "niedziela", Monday: "poniedziałek", Tuesday: "wtorek", Wednesday: "środa", Thursday: "czwartek", Friday: "piątek", Saturday: "sobota", Sun: "niedz.", Mon: "pon.", Tue: "wt.", Wed: "śr.", Thu: "czw.", Fri: "pt.", Sat: "sob.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zmiana skali", Play: "Odtwarzanie", Stop: "Zatrzymaj", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Wczytywanie", Home: "Strona główna", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Drukuj", Image: "Obraz", Data: "Dane", Print: "Drukuj", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, zee)) !== void 0 && (Dtt.exports = Ftt); +const qYi = HYi({ __proto__: null, default: nl(zee) }, [zee]), YYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + p: qYi +}, Symbol.toStringTag, { value: "Module" })); +function XYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Ltt, Ntt, Hee = {}, KYi = { get exports() { + return Hee; +}, set exports(t) { + Hee = t; +} }; +Ltt = KYi, (Ntt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "DC", _era_bc: "AC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Janeiro", February: "Fevereiro", March: "Março", April: "Abril", May: "Maio", June: "Junho", July: "Julho", August: "Agosto", September: "Setembro", October: "Outubro", November: "Novembro", December: "Dezembro", Jan: "Jan", Feb: "Fev", Mar: "Mar", Apr: "Abr", "May(short)": "Mai", Jun: "Jun", Jul: "Jul", Aug: "Ago", Sep: "Set", Oct: "Out", Nov: "Nov", Dec: "Dez", Sunday: "Domingo", Monday: "Segunda-feira", Tuesday: "Terça-feira", Wednesday: "Quarta-feira", Thursday: "Quinta-feira", Friday: "Sexta-feira", Saturday: "Sábado", Sun: "Dom", Mon: "Seg", Tue: "Ter", Wed: "Qua", Thu: "Qui", Fri: "Sex", Sat: "Sáb", _dateOrd: function(i) { + return "º"; + }, "Zoom Out": "Reduzir Zoom", Play: "Play", Stop: "Parar", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Clique, toque ou pressione ENTER para alternar", Loading: "Carregando", Home: "Início", Chart: "Gráfico", "Serial chart": "Gráfico Serial", "X/Y chart": "Gráfico XY", "Pie chart": "Gráfico de Pizza", "Gauge chart": "Gráfico Indicador", "Radar chart": "Gráfico de Radar", "Sankey diagram": "Diagrama Sankey", "Chord diagram": "Diagram Chord", "Flow diagram": "Diagrama Flow", "TreeMap chart": "Gráfico de Mapa de Árvore", Series: "Séries", "Candlestick Series": "Séries do Candlestick", "Column Series": "Séries de Colunas", "Line Series": "Séries de Linhas", "Pie Slice Series": "Séries de Fatias de Pizza", "X/Y Series": "Séries de XY", Map: "Mapa", "Press ENTER to zoom in": "Pressione ENTER para aumentar o zoom", "Press ENTER to zoom out": "Pressione ENTER para diminuir o zoom", "Use arrow keys to zoom in and out": "Use as setas para diminuir ou aumentar o zoom", "Use plus and minus keys on your keyboard to zoom in and out": "Use as teclas mais ou menos no seu teclado para diminuir ou aumentar o zoom", Export: "Exportar", Image: "Imagem", Data: "Dados", Print: "Imprimir", "Click, tap or press ENTER to open": "Clique, toque ou pressione ENTER para abrir", "Click, tap or press ENTER to print.": "Clique, toque ou pressione ENTER para imprimir", "Click, tap or press ENTER to export as %1.": "Clique, toque ou pressione ENTER para exportar como %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'Para salvar a imagem, clique no link com o botão da direira e escolha "Salvar imagem como..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Para salvar, clique na imagem à esquerda com o botão direito e escolha "Salvar imagem como..."', "(Press ESC to close this message)": "(Pressione ESC para fechar esta mensagem)", "Image Export Complete": "A exportação da imagem foi completada", "Export operation took longer than expected. Something might have gone wrong.": "A exportação da imagem demorou mais do que o experado. Algo deve ter dado errado.", "Saved from": "Salvo de", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Use TAB para selecionar os botões ou setas para a direita ou esquerda para mudar a seleção", "Use left and right arrows to move selection": "Use as setas para a esquerda ou direita para mover a seleção", "Use left and right arrows to move left selection": "Use as setas para a esquerda ou direita para mover a seleção da esquerda", "Use left and right arrows to move right selection": "Use as setas para a esquerda ou direita para mover a seleção da direita", "Use TAB select grip buttons or up and down arrows to change selection": "Use TAB para selecionar os botões ou setas para cima ou para baixo para mudar a seleção", "Use up and down arrows to move selection": "Use as setas para cima ou para baixo para mover a seleção", "Use up and down arrows to move lower selection": "Use as setas para cima ou para baixo para mover a seleção de baixo", "Use up and down arrows to move upper selection": "Use as setas para cima ou para baixo para mover a seleção de cima", "From %1 to %2": "De %1 até %2", "From %1": "De %1", "To %1": "Até %1", "No parser available for file: %1": "Não há um interpretador para este arquivo: %1", "Error parsing file: %1": "Erro analizando o arquivo: %1", "Unable to load file: %1": "O arquivo não pôde ser carregado: %1", "Invalid date": "Data inválida" }; +}(Cl, Hee)) !== void 0 && (Ltt.exports = Ntt); +const JYi = XYi({ __proto__: null, default: nl(Hee) }, [Hee]), ZYi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + p: JYi +}, Symbol.toStringTag, { value: "Module" })); +function QYi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ktt, $tt, Wee = {}, eXi = { get exports() { + return Wee; +}, set exports(t) { + Wee = t; +} }; +ktt = eXi, ($tt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "DC", _era_bc: "AC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "Janeiro", February: "Fevereiro", March: "Março", April: "Abril", May: "Maio", June: "Junho", July: "Julho", August: "Agosto", September: "Setembro", October: "Outubro", November: "Novembro", December: "Dezembro", Jan: "Jan", Feb: "Fev", Mar: "Mar", Apr: "Abr", "May(short)": "Mai", Jun: "Jun", Jul: "Jul", Aug: "Ago", Sep: "Set", Oct: "Out", Nov: "Nov", Dec: "Dez", Sunday: "Domingo", Monday: "Segunda-feira", Tuesday: "Terça-feira", Wednesday: "Quarta-feira", Thursday: "Quinta-feira", Friday: "Sexta-feira", Saturday: "Sábado", Sun: "Dom", Mon: "Seg", Tue: "Ter", Wed: "Qua", Thu: "Qui", Fri: "Sex", Sat: "Sáb", _dateOrd: function(i) { + return "º"; + }, "Zoom Out": "Reduzir Zoom", Play: "Play", Stop: "Parar", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Clique, toque ou pressione ENTER para alternar", Loading: "Carregando", Home: "Início", Chart: "Gráfico", "Serial chart": "Gráfico Serial", "X/Y chart": "Gráfico XY", "Pie chart": "Gráfico de Pizza", "Gauge chart": "Gráfico Indicador", "Radar chart": "Gráfico de Radar", "Sankey diagram": "Diagrama Sankey", "Chord diagram": "Diagram Chord", "Flow diagram": "Diagrama Flow", "TreeMap chart": "Gráfico de Mapa de Árvore", Series: "Séries", "Candlestick Series": "Séries do Candlestick", "Column Series": "Séries de Colunas", "Line Series": "Séries de Linhas", "Pie Slice Series": "Séries de Fatias de Pizza", "X/Y Series": "Séries de XY", Map: "Mapa", "Press ENTER to zoom in": "Pressione ENTER para aumentar o zoom", "Press ENTER to zoom out": "Pressione ENTER para diminuir o zoom", "Use arrow keys to zoom in and out": "Use as setas para diminuir ou aumentar o zoom", "Use plus and minus keys on your keyboard to zoom in and out": "Use as teclas mais ou menos no seu teclado para diminuir ou aumentar o zoom", Export: "Exportar", Image: "Imagem", Data: "Dados", Print: "Imprimir", "Click, tap or press ENTER to open": "Clique, toque ou pressione ENTER para abrir", "Click, tap or press ENTER to print.": "Clique, toque ou pressione ENTER para imprimir", "Click, tap or press ENTER to export as %1.": "Clique, toque ou pressione ENTER para exportar como %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'Para salvar a imagem, clique no link com o botão da direira e escolha "Salvar imagem como..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Para salvar, clique na imagem à esquerda com o botão direito e escolha "Salvar imagem como..."', "(Press ESC to close this message)": "(Pressione ESC para fechar esta mensagem)", "Image Export Complete": "A exportação da imagem foi completada", "Export operation took longer than expected. Something might have gone wrong.": "A exportação da imagem demorou mais do que o experado. Algo deve ter dado errado.", "Saved from": "Salvo de", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "Use TAB para selecionar os botões ou setas para a direita ou esquerda para mudar a seleção", "Use left and right arrows to move selection": "Use as setas para a esquerda ou direita para mover a seleção", "Use left and right arrows to move left selection": "Use as setas para a esquerda ou direita para mover a seleção da esquerda", "Use left and right arrows to move right selection": "Use as setas para a esquerda ou direita para mover a seleção da direita", "Use TAB select grip buttons or up and down arrows to change selection": "Use TAB para selecionar os botões ou setas para cima ou para baixo para mudar a seleção", "Use up and down arrows to move selection": "Use as setas para cima ou para baixo para mover a seleção", "Use up and down arrows to move lower selection": "Use as setas para cima ou para baixo para mover a seleção de baixo", "Use up and down arrows to move upper selection": "Use as setas para cima ou para baixo para mover a seleção de cima", "From %1 to %2": "De %1 até %2", "From %1": "De %1", "To %1": "Até %1", "No parser available for file: %1": "Nenhum interpretador está disponível para este arquivo: %1", "Error parsing file: %1": "Erro ao analizar o arquivo: %1", "Unable to load file: %1": "O arquivo não pôde ser carregado: %1", "Invalid date": "Data inválida" }; +}(Cl, Wee)) !== void 0 && (ktt.exports = $tt); +const tXi = QYi({ __proto__: null, default: nl(Wee) }, [Wee]), iXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + p: tXi +}, Symbol.toStringTag, { value: "Module" })); +function rXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Btt, Vtt, qee = {}, nXi = { get exports() { + return qee; +}, set exports(t) { + qee = t; +} }; +Btt = nXi, (Vtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "d.Hr.", _era_bc: "î.Hr.", A: "a.m.", P: "p.m.", AM: "a.m.", PM: "p.m.", "A.M.": "a.m.", "P.M.": "p.m.", January: "ianuarie", February: "februarie", March: "martie", April: "aprilie", May: "mai", June: "iunie", July: "iulie", August: "august", September: "septembrie", October: "octombrie", November: "noiembrie", December: "decembrie", Jan: "ian.", Feb: "feb.", Mar: "mar.", Apr: "apr.", "May(short)": "mai", Jun: "iun.", Jul: "iul.", Aug: "aug.", Sep: "sept.", Oct: "oct.", Nov: "nov.", Dec: "dec.", Sunday: "duminică", Monday: "luni", Tuesday: "marți", Wednesday: "miercuri", Thursday: "joi", Friday: "vineri", Saturday: "sâmbătă", Sun: "dum.", Mon: "lun.", Tue: "mar.", Wed: "mie.", Thu: "joi", Fri: "vin.", Sat: "sâm.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zoom", Play: "Redare", Stop: "Oprire", Legend: "Legendă", "Click, tap or press ENTER to toggle": "", Loading: "Se încarcă", Home: "Pagina principală", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Imprimare", Image: "Imagine", Data: "Date", Print: "Imprimare", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Din %1 la %2", "From %1": "Din %1", "To %1": "La %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, qee)) !== void 0 && (Btt.exports = Vtt); +const sXi = rXi({ __proto__: null, default: nl(qee) }, [qee]), oXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + r: sXi +}, Symbol.toStringTag, { value: "Module" })); +function aXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var jtt, Gtt, Yee = {}, lXi = { get exports() { + return Yee; +}, set exports(t) { + Yee = t; +} }; +jtt = lXi, (Gtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "dd MMM", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "н.э.", _era_bc: "до н.э.", A: "У", P: "В", AM: "утра", PM: "вечера", "A.M.": "до полудня", "P.M.": "после полудня", January: "января", February: "февраля", March: "марта", April: "апреля", May: "мая", June: "июня", July: "июля", August: "августа", September: "сентября", October: "октября", November: "ноября", December: "декабря", Jan: "янв.", Feb: "февр.", Mar: "март", Apr: "апр.", "May(short)": "май", Jun: "июнь", Jul: "июль", Aug: "авг.", Sep: "сент.", Oct: "окт.", Nov: "нояб.", Dec: "дек.", Sunday: "воскресенье", Monday: "понедельник", Tuesday: "вторник", Wednesday: "среда", Thursday: "четверг", Friday: "пятница", Saturday: "суббота", Sun: "вс.", Mon: "пн.", Tue: "вт.", Wed: "ср.", Thu: "чт.", Fri: "пт.", Sat: "сб.", _dateOrd: function(i) { + return "-ое"; + }, "Zoom Out": "Уменьшить", Play: "Старт", Stop: "Стоп", Legend: "Легенда", "Click, tap or press ENTER to toggle": "Щелкните, коснитесь или нажмите ВВОД, чтобы переключить", Loading: "Идет загрузка", Home: "Начало", Chart: "График", "Serial chart": "Серийная диаграмма", "X/Y chart": "Диаграмма X/Y", "Pie chart": "Круговая диаграмма", "Gauge chart": "Датчик-диаграмма", "Radar chart": "Лепестковая диаграмма", "Sankey diagram": "Диаграмма Сэнки", "Chord diagram": "Диаграмма Chord", "Flow diagram": "Диаграмма флоу", "TreeMap chart": "Иерархическая диаграмма", Series: "Серия", "Candlestick Series": "Серия-подсвечник", "Column Series": "Столбчатая серия", "Line Series": "Линейная серия", "Pie Slice Series": "Круговая серия", "X/Y Series": "X/Y серия", Map: "Карта", "Press ENTER to zoom in": "Нажмите ВВОД чтобу увеличить", "Press ENTER to zoom out": "Нажмите ВВОД чтобы уменьшить", "Use arrow keys to zoom in and out": "Используйте клавиши-стрелки чтобы увеличить и уменьшить", "Use plus and minus keys on your keyboard to zoom in and out": "Используйте клавиши плюс и минус на клавиатуре чтобы увеличить и уменьшить", Export: "Экспортировать", Image: "Изображение", Data: "Данные", Print: "Печатать", "Click, tap or press ENTER to open": "Щелкните, коснитесь или нажмите ВВОД чтобы открыть", "Click, tap or press ENTER to print.": "Щелкните, коснитесь или нажмите ВВОД чтобы распечатать", "Click, tap or press ENTER to export as %1.": "Щелкните, коснитесь или нажмите ВВОД чтобы экспортировать как %1", 'To save the image, right-click this link and choose "Save picture as..."': 'Чтобы сохранить изображение, щелкните правой кнопкой на ссылке и выберите "Сохранить изображение как..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Чтобы сохранить изображение, щелкните правой кнопкой на картинке слева и выберите "Сохранить изображение как..."', "(Press ESC to close this message)": "(Нажмите ESC чтобы закрыть это сообщение)", "Image Export Complete": "Экспорт изображения завершен", "Export operation took longer than expected. Something might have gone wrong.": "Экспортирование заняло дольше, чем планировалось. Возможно что-то пошло не так.", "Saved from": "Сохранено из", PNG: "PNG", JPG: "JPG", GIF: "GIF", SVG: "SVG", PDF: "PDF", JSON: "JSON", CSV: "CSV", XLSX: "XLSX", "Use TAB to select grip buttons or left and right arrows to change selection": "Используйте клавишу TAB, чтобы выбрать рукоятки или клавиши стрелок влево и вправо, чтобы изменить выделение", "Use left and right arrows to move selection": "Используйте стрелки влево-вправо, чтобы передвинуть выделение", "Use left and right arrows to move left selection": "Используйте стрелки влево-вправо, чтобы передвинуть левое выделение", "Use left and right arrows to move right selection": "Используйте стрелки влево-вправо, чтобы передвинуть правое выделение", "Use TAB select grip buttons or up and down arrows to change selection": "Используйте TAB, чтобы выбрать рукоятки или клавиши вверх-вниз, чтобы изменить выделение", "Use up and down arrows to move selection": "Используйте стрелки вверх-вниз, чтобы передвинуть выделение", "Use up and down arrows to move lower selection": "Используйте стрелки вверх-вниз, чтобы передвинуть нижнее выделение", "Use up and down arrows to move upper selection": "Используйте стрелки вверх-вниз, чтобы передвинуть верхнее выделение", "From %1 to %2": "От %1 до %2", "From %1": "От %1", "To %1": "До %1", "No parser available for file: %1": "Нет анализатора для файла: %1", "Error parsing file: %1": "Ошибка при разборе файла: %1", "Unable to load file: %1": "Не удалось загрузить файл: %1", "Invalid date": "Некорректная дата" }; +}(Cl, Yee)) !== void 0 && (jtt.exports = Gtt); +const uXi = aXi({ __proto__: null, default: nl(Yee) }, [Yee]), cXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + r: uXi +}, Symbol.toStringTag, { value: "Module" })); +function hXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Utt, ztt, Xee = {}, dXi = { get exports() { + return Xee; +}, set exports(t) { + Xee = t; +} }; +Utt = dXi, (ztt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "n. l.", _era_bc: "pr. n. l.", A: "dop.", P: "odp.", AM: "dop.", PM: "odp.", "A.M.": "dop.", "P.M.": "odp.", January: "januára", February: "februára", March: "marca", April: "apríla", May: "mája", June: "júna", July: "júla", August: "augusta", September: "septembra", October: "októbra", November: "novembra", December: "decembra", Jan: "jan", Feb: "feb", Mar: "mar", Apr: "apr", "May(short)": "máj", Jun: "jún", Jul: "júl", Aug: "aug", Sep: "sep", Oct: "okt", Nov: "nov", Dec: "dec", Sunday: "nedela", Monday: "pondelok", Tuesday: "utorok", Wednesday: "streda", Thursday: "štvrtok", Friday: "piatok", Saturday: "sobota", Sun: "ne", Mon: "po", Tue: "ut", Wed: "st", Thu: "št", Fri: "pi", Sat: "so", _dateOrd: function(i) { + return "."; + }, "Zoom Out": "Zväčšenie", Play: "Prehrať", Stop: "Ukončiť iteráciu (Stop)", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Načítanie", Home: "Domov", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Export", Image: "Obrázok", Data: "Data", Print: "Tlač", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Xee)) !== void 0 && (Utt.exports = ztt); +const pXi = hXi({ __proto__: null, default: nl(Xee) }, [Xee]), fXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + s: pXi +}, Symbol.toStringTag, { value: "Module" })); +function mXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Htt, Wtt, Kee = {}, gXi = { get exports() { + return Kee; +}, set exports(t) { + Kee = t; +} }; +Htt = gXi, (Wtt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "n. št.", _era_bc: "pr. n. št.", A: "A", P: "P", AM: "AM", PM: "PM", "A.M.": "A.M.", "P.M.": "P.M.", January: "Januar", February: "Februar", March: "Marec", April: "April", May: "Maj", June: "Junij", July: "Julij", August: "Avgust", September: "September", October: "Oktober", November: "November", December: "December", Jan: "Jan", Feb: "Feb", Mar: "Mar", Apr: "Apr", "May(short)": "Maj", Jun: "Jun", Jul: "Jul", Aug: "Avg", Sep: "Sep", Oct: "Okt", Nov: "Nov", Dec: "Dec", Sunday: "Nedelja", Monday: "Ponedeljek", Tuesday: "Torek", Wednesday: "Sreda", Thursday: "Četrtek", Friday: "Petek", Saturday: "Sobota", Sun: "Ned", Mon: "Pon", Tue: "Tor", Wed: "Sre", Thu: "Čet", Fri: "Pet", Sat: "Sob", _dateOrd: function(i) { + return "."; + }, "Zoom Out": "Oddalji pogled", Play: "Zaženi", Stop: "Ustavi", Legend: "Legenda", "Click, tap or press ENTER to toggle": "Klikni, tapni ali pritisni ENTER za preklop", Loading: "Nalagam", Home: "Domov", Chart: "Graf", "Serial chart": "Serijski graf", "X/Y chart": "X/Y graf", "Pie chart": "Tortni graf", "Gauge chart": "Stevčni graf", "Radar chart": "Radar graf", "Sankey diagram": "Sankey diagram", "Flow diagram": "Prikaz poteka", "Chord diagram": "Kolobarni diagram", "TreeMap chart": "Drevesi graf", "Sliced chart": "Sliced graf", Series: "Serija", "Candlestick Series": "Svečna serija", "OHLC Series": "OHLC serija", "Column Series": "Stolpičasta serija", "Line Series": "Črtna serija", "Pie Slice Series": "Tortna serija", "Funnel Series": "Lijak serija", "Pyramid Series": "Piramidna serija", "X/Y Series": "X/Y serija", Map: "Mapa", "Press ENTER to zoom in": "Pritisni ENTER za približevanje", "Press ENTER to zoom out": "Pritisni ENTER za oddaljevanje", "Use arrow keys to zoom in and out": "Uporabi smerne tiple za približevanje in oddaljevanje", "Use plus and minus keys on your keyboard to zoom in and out": "Uporabi plus in minus tipke na tipkovnici za približevanje in oddaljevanje", Export: "Izvozi", Image: "Slika", Data: "Podatki", Print: "Natisni", "Click, tap or press ENTER to open": "Klikni, tapni ali pritisni ENTER da odpreš.", "Click, tap or press ENTER to print.": "Klikni, tapni ali pritisni ENTER za tiskanje.", "Click, tap or press ENTER to export as %1.": "Klikni, tapni ali pritisni ENTER da izvoziš kot %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'Da shraniš sliko, z desnim gumbom miške klikni to povezavo in izberi "Shrani sliko kot..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'Da shraniš sliko, z desnim gumbom miške klikni sličico na levi in izberi "Shrani sliko kot..."', "(Press ESC to close this message)": "(Pritisni ESC da zapreš to sporočilo)", "Image Export Complete": "Izvoz slike končan", "Export operation took longer than expected. Something might have gone wrong.": "Operacija izvoza je trajala dlje kot pričakovano. Nekaj je šlo narobe.", "Saved from": "Shranjeno od", PNG: "PNG", JPG: "JPG", GIF: "GIF", SVG: "SVG", PDF: "PDF", JSON: "JSON", CSV: "CSV", XLSX: "XLSX", "Use TAB to select grip buttons or left and right arrows to change selection": "Uporabi TAB za izbiro drsnih gumbov ali levo in desno smerno tipko da spremeniš izbiro", "Use left and right arrows to move selection": "Uporabi levo in desno smerno tipko za premik izbranega", "Use left and right arrows to move left selection": "Uporabi levo in desno smerno tipko za premik leve izbire", "Use left and right arrows to move right selection": "Uporabi levo in desno smerno tipko za premik desne izbire", "Use TAB select grip buttons or up and down arrows to change selection": "Uporabi TAB za izbiro drsnih gumbov ali gor in dol smerno tipko da spremeniš izbiro", "Use up and down arrows to move selection": "Uporabi gor in dol smerne tipke za premik izbire", "Use up and down arrows to move lower selection": "Uporabi gor in dol smerne tipke za premik spodnje izbire", "Use up and down arrows to move upper selection": "Uporabi gor in dol smerne tipke za premik zgornje izbire", "From %1 to %2": "Od %1 do %2", "From %1": "Od %1", "To %1": "Do %1", "No parser available for file: %1": "Nobenega parserja ni na voljo za datoteko: %1", "Error parsing file: %1": "Napaka pri parsanju datoteke: %1", "Unable to load file: %1": "Ni mogoče naložiti datoteke: %1", "Invalid date": "Neveljaven datum" }; +}(Cl, Kee)) !== void 0 && (Htt.exports = Wtt); +const yXi = mXi({ __proto__: null, default: nl(Kee) }, [Kee]), vXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + s: yXi +}, Symbol.toStringTag, { value: "Module" })); +function _Xi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var qtt, Ytt, Jee = {}, bXi = { get exports() { + return Jee; +}, set exports(t) { + Jee = t; +} }; +qtt = bXi, (Ytt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "н. е.", _era_bc: "п. н. е.", A: "a", P: "p", AM: "пре подне", PM: "по подне", "A.M.": "пре подне", "P.M.": "по подне", January: "јануар", February: "фебруар", March: "март", April: "април", May: "мај", June: "јун", July: "јул", August: "август", September: "септембар", October: "октобар", November: "новембар", December: "децембар", Jan: "јан", Feb: "феб", Mar: "мар", Apr: "апр", "May(short)": "мај", Jun: "јун", Jul: "јул", Aug: "авг", Sep: "сеп", Oct: "окт", Nov: "нов", Dec: "дец", Sunday: "недеља", Monday: "понедељак", Tuesday: "уторак", Wednesday: "среда", Thursday: "четвртак", Friday: "петак", Saturday: "субота", Sun: "нед", Mon: "пон", Tue: "уто", Wed: "сре", Thu: "чет", Fri: "пет", Sat: "суб", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Zumiranje", Play: "Reprodukuj", Stop: "Zaustavi", Legend: "Legenda", "Click, tap or press ENTER to toggle": "", Loading: "Učitavanje", Home: "Matična stranica", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Štampaj", Image: "Snimak", Data: "Podaci", Print: "Štampaj", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Iz %1 u %2", "From %1": "Iz %1", "To %1": "U %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Jee)) !== void 0 && (qtt.exports = Ytt); +const wXi = _Xi({ __proto__: null, default: nl(Jee) }, [Jee]), xXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + s: wXi +}, Symbol.toStringTag, { value: "Module" })); +function SXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Xtt, Ktt, Zee = {}, CXi = { get exports() { + return Zee; +}, set exports(t) { + Zee = t; +} }; +Xtt = CXi, (Ktt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "yyyy-MM-dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_second: "ss", _duration_minute: "mm", _duration_hour: "hh", _duration_day: "dd", _duration_week: "ww", _duration_month: "MM", _duration_year: "yyyy", _era_ad: "e.Kr.", _era_bc: "f.Kr.", A: "fm", P: "em", AM: "fm", PM: "em", "A.M.": "f.m.", "P.M.": "e.m.", January: "januari", February: "februari", March: "mars", April: "april", May: "maj", June: "juni", July: "juli", August: "augusti", September: "september", October: "oktober", November: "november", December: "december", Jan: "jan.", Feb: "feb.", Mar: "mars", Apr: "apr.", "May(short)": "maj", Jun: "juni", Jul: "juli", Aug: "aug.", Sep: "sep.", Oct: "okt.", Nov: "nov.", Dec: "dec.", Sunday: "söndag", Monday: "måndag", Tuesday: "tisdag", Wednesday: "onsdag", Thursday: "torsdag", Friday: "fredag", Saturday: "lördag", Sun: "sön", Mon: "mån", Tue: "tis", Wed: "ons", Thu: "tor", Fri: "fre", Sat: "lör", _dateOrd: function(i) { + return ""; + }, "Zoom Out": "Zooma ut", Play: "Spela", Stop: "Stoppa", Legend: "Teckenförklaring", "Click, tap or press ENTER to toggle": "Klicka eller tryck ENTER för att ändra", Loading: "Läser in", Home: "Hem", Chart: "Diagram", "Serial chart": "Seriediagram", "X/Y chart": "XY-diagram", "Pie chart": "Tårtdiagram", "Gauge chart": "Instrumentdiagram", "Radar chart": "Radardiagram", "Sankey diagram": "Sankeydiagram", "Chord diagram": "Strängdiagram", "Flow diagram": "Flödesschema", "TreeMap chart": "Träddiagram ", Series: "Serier", "Candlestick Series": "Candlestick-serier", "Column Series": "Kolumnserier", "Line Series": "Linjeserier", "Pie Slice Series": "Tårtserier", "X/Y Series": "X/Y-serier", Map: "Karta", "Press ENTER to zoom in": "Tryck RETUR för att zooma in", "Press ENTER to zoom out": "Tryck RETUR för att zooma ut", "Use arrow keys to zoom in and out": "Använd pil-knapparna för att zooma in och ut", "Use plus and minus keys on your keyboard to zoom in and out": "Använd plus- och minus-knapparna för att zooma in och ut", Export: "Exportera", Image: "Bild", Data: "Data", Print: "Skriv ut", "Click, tap or press ENTER to open": "Klicka eller tryck ENTER för att öppna", "Click, tap or press ENTER to print.": "Klicka eller tryck ENTER för att skriva ut.", "Click, tap or press ENTER to export as %1.": "Klicka eller tryck ENTER för att exportera till %1.", 'To save the image, right-click this link and choose "Save picture as..."': 'För att spara bilden, höger-klicka länken och välj "Spara bild som..."', 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': 'För att spara bilden, höger-klicka miniatyrbilden till vänster och välj "Spara bild som..."', "(Press ESC to close this message)": "(Tryck ESC för att stänga)", "Image Export Complete": "Bildexport klar", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "Sparad från", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "Använd vänster och höger pilknappar för att flytta urvalet", "Use left and right arrows to move left selection": "Använd vänster och höger pilknappar för att flytta vänsterurval", "Use left and right arrows to move right selection": "Använd vänster och höger pilknappar för att flytta högerurval", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "Använd upp och ner pilknappar för att flytta urvalet", "Use up and down arrows to move lower selection": "Använd upp och ner pilknappar för att flytta nedre urvalet", "Use up and down arrows to move upper selection": "Använd upp och ner pilknappar för att flytta övre urvalet", "From %1 to %2": "Från %1 till %2", "From %1": "Från %1", "To %1": "Till %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "Ogiltigt datum" }; +}(Cl, Zee)) !== void 0 && (Xtt.exports = Ktt); +const TXi = SXi({ __proto__: null, default: nl(Zee) }, [Zee]), EXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + s: TXi +}, Symbol.toStringTag, { value: "Module" })); +function IXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Jtt, Ztt, Qee = {}, AXi = { get exports() { + return Qee; +}, set exports(t) { + Qee = t; +} }; +Jtt = AXi, (Ztt = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "ค.ศ.", _era_bc: "ก่อน ค.ศ.", A: "a", P: "p", AM: "ก่อนเที่ยง", PM: "หลังเที่ยง", "A.M.": "ก่อนเที่ยง", "P.M.": "หลังเที่ยง", January: "มกราคม", February: "กุมภาพันธ์", March: "มีนาคม", April: "เมษายน", May: "พฤษภาคม", June: "มิถุนายน", July: "กรกฎาคม", August: "สิงหาคม", September: "กันยายน", October: "ตุลาคม", November: "พฤศจิกายน", December: "ธันวาคม", Jan: "ม.ค.", Feb: "ก.พ.", Mar: "มี.ค.", Apr: "เม.ย.", "May(short)": "พ.ค.", Jun: "มิ.ย.", Jul: "ก.ค.", Aug: "ส.ค.", Sep: "ก.ย.", Oct: "ต.ค.", Nov: "พ.ย.", Dec: "ธ.ค.", Sunday: "วันอาทิตย์", Monday: "วันจันทร์", Tuesday: "วันอังคาร", Wednesday: "วันพุธ", Thursday: "วันพฤหัสบดี", Friday: "วันศุกร์", Saturday: "วันเสาร์", Sun: "อา.", Mon: "จ.", Tue: "อ.", Wed: "พ.", Thu: "พฤ.", Fri: "ศ.", Sat: "ส.", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "ขยาย", Play: "เล่น", Stop: "หยุด", Legend: "คำอธิบายสัญลักษณ์", "Click, tap or press ENTER to toggle": "", Loading: "กำลังโหลด", Home: "หน้าหลัก", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "พิมพ์", Image: "รูปภาพ", Data: "ข้อมูล", Print: "พิมพ์", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "จาก %1 ถึง %2", "From %1": "จาก %1", "To %1": "ถึง %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, Qee)) !== void 0 && (Jtt.exports = Ztt); +const PXi = IXi({ __proto__: null, default: nl(Qee) }, [Qee]), OXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + t: PXi +}, Symbol.toStringTag, { value: "Module" })); +function RXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var Qtt, eit, ete = {}, MXi = { get exports() { + return ete; +}, set exports(t) { + ete = t; +} }; +Qtt = MXi, (eit = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: "%", _percentSuffix: null, _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "MS", _era_bc: "MÖ", A: "öö", P: "ös", AM: "ÖÖ", PM: "ÖS", "A.M.": "ÖÖ", "P.M.": "ÖS", January: "Ocak", February: "Şubat", March: "Mart", April: "Nisan", May: "Mayıs", June: "Haziran", July: "Temmuz", August: "Ağustos", September: "Eylül", October: "Ekim", November: "Kasım", December: "Aralık", Jan: "Oca", Feb: "Şub", Mar: "Mar", Apr: "Nis", "May(short)": "May", Jun: "Haz", Jul: "Tem", Aug: "Ağu", Sep: "Eyl", Oct: "Eki", Nov: "Kas", Dec: "Ara", Sunday: "Pazar", Monday: "Pazartesi", Tuesday: "Salı", Wednesday: "Çarşamba", Thursday: "Perşembe", Friday: "Cuma", Saturday: "Cumartesi", Sun: "Paz", Mon: "Pzt", Tue: "Sal", Wed: "Çar", Thu: "Per", Fri: "Cum", Sat: "Cmt", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Yakınlaştır", Play: "Oynat", Stop: "Durdur", Legend: "Gösterge", "Click, tap or press ENTER to toggle": "", Loading: "Yükleniyor", Home: "Giriş Sayfası", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Yazdır", Image: "Görüntü", Data: "Veri", Print: "Yazdır", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Kaynak %1 hedef %2", "From %1": "Kaynak %1", "To %1": "Hedef %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, ete)) !== void 0 && (Qtt.exports = eit); +const DXi = RXi({ __proto__: null, default: nl(ete) }, [ete]), FXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + t: DXi +}, Symbol.toStringTag, { value: "Module" })); +function LXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var tit, iit, tte = {}, NXi = { get exports() { + return tte; +}, set exports(t) { + tte = t; +} }; +tit = NXi, (iit = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: " ", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "н. е.", _era_bc: "до н. е.", A: "дп", P: "пп", AM: "дп", PM: "пп", "A.M.": "дп", "P.M.": "пп", January: "січня", February: "лютого", March: "березня", April: "квітня", May: "травня", June: "червня", July: "липня", August: "серпня", September: "вересня", October: "жовтня", November: "листопада", December: "грудня", Jan: "січ.", Feb: "лют.", Mar: "бер.", Apr: "квіт.", "May(short)": "трав.", Jun: "черв.", Jul: "лип.", Aug: "серп.", Sep: "вер.", Oct: "жовт.", Nov: "лист.", Dec: "груд.", Sunday: "неділя", Monday: "понеділок", Tuesday: "вівторок", Wednesday: "середа", Thursday: "четвер", Friday: "пʼятниця", Saturday: "субота", Sun: "нд", Mon: "пн", Tue: "вт", Wed: "ср", Thu: "чт", Fri: "пт", Sat: "сб", _dateOrd: function(i) { + return ""; + }, "Zoom Out": "Масштабування", Play: "Відтворювати", Stop: "Зупинка", Legend: "Легенда", "Click, tap or press ENTER to toggle": "", Loading: "Завантажується", Home: "Головна сторінка", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "карта", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "Друк", Image: "Зображення", Data: "Дані", Print: "Друк", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Від %1 до %2", "From %1": "Від %1", "To %1": "До %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, tte)) !== void 0 && (tit.exports = iit); +const kXi = LXi({ __proto__: null, default: nl(tte) }, [tte]), $Xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + u: kXi +}, Symbol.toStringTag, { value: "Module" })); +function BXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var rit, nit, ite = {}, VXi = { get exports() { + return ite; +}, set exports(t) { + ite = t; +} }; +rit = VXi, (nit = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ",", _thousandSeparator: ".", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "sau CN", _era_bc: "Trước CN", A: "s", P: "c", AM: "SA", PM: "CH", "A.M.": "SA", "P.M.": "CH", January: "tháng 1", February: "tháng 2", March: "tháng 3", April: "tháng 4", May: "tháng 5", June: "tháng 6", July: "tháng 7", August: "tháng 8", September: "tháng 9", October: "tháng 10", November: "tháng 11", December: "tháng 12", Jan: "thg 1", Feb: "thg 2", Mar: "thg 3", Apr: "thg 4", "May(short)": "thg 5", Jun: "thg 6", Jul: "thg 7", Aug: "thg 8", Sep: "thg 9", Oct: "thg 10", Nov: "thg 11", Dec: "thg 12", Sunday: "Chủ Nhật", Monday: "Thứ Hai", Tuesday: "Thứ Ba", Wednesday: "Thứ Tư", Thursday: "Thứ Năm", Friday: "Thứ Sáu", Saturday: "Thứ Bảy", Sun: "CN", Mon: "Th 2", Tue: "Th 3", Wed: "Th 4", Thu: "Th 5", Fri: "Th 6", Sat: "Th 7", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + r = "st"; + break; + case 2: + r = "nd"; + break; + case 3: + r = "rd"; + } + return r; + }, "Zoom Out": "Thu phóng", Play: "Phát", Stop: "Dừng", Legend: "Chú giải", "Click, tap or press ENTER to toggle": "", Loading: "Đang tải", Home: "Trang chủ", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "In", Image: "Hình ảnh", Data: "Dữ liệu", Print: "In", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "Từ %1 đến %2", "From %1": "Từ %1", "To %1": "Đến %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, ite)) !== void 0 && (rit.exports = nit); +const jXi = BXi({ __proto__: null, default: nl(ite) }, [ite]), GXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + v: jXi +}, Symbol.toStringTag, { value: "Module" })); +function UXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var sit, oit, rte = {}, zXi = { get exports() { + return rte; +}, set exports(t) { + rte = t; +} }; +sit = zXi, (oit = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "公元", _era_bc: "公元前", A: "上午", P: "下午", AM: "上午", PM: "下午", "A.M.": "上午", "P.M.": "下午", January: "一月", February: "二月", March: "三月", April: "四月", May: "五月", June: "六月", July: "七月", August: "八月", September: "九月", October: "十月", November: "十一月", December: "十二月", Jan: "1月", Feb: "2月", Mar: "3月", Apr: "4月", "May(short)": "5月", Jun: "6月", Jul: "7月", Aug: "8月", Sep: "9月", Oct: "10月", Nov: "11月", Dec: "12月", Sunday: "星期日", Monday: "星期一", Tuesday: "星期二", Wednesday: "星期三", Thursday: "星期四", Friday: "星期五", Saturday: "星期六", Sun: "周日", Mon: "周一", Tue: "周二", Wed: "周三", Thu: "周四", Fri: "周五", Sat: "周六", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + case 2: + case 3: + r = "日"; + } + return r; + }, "Zoom Out": "缩放", Play: "播放", Stop: "停靠点", Legend: "图例", "Click, tap or press ENTER to toggle": "", Loading: "加载", Home: "主页", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "打印", Image: "影像", Data: "数据", Print: "打印", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "自 %1 至 %2", "From %1": "自 %1", "To %1": "至 %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, rte)) !== void 0 && (sit.exports = oit); +const HXi = UXi({ __proto__: null, default: nl(rte) }, [rte]), WXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + z: HXi +}, Symbol.toStringTag, { value: "Module" })); +function qXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var ait, lit, nte = {}, YXi = { get exports() { + return nte; +}, set exports(t) { + nte = t; +} }; +ait = YXi, (lit = function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "西元", _era_bc: "西元前", A: "上午", P: "下午", AM: "上午", PM: "下午", "A.M.": "上午", "P.M.": "下午", January: "1月", February: "2月", March: "3月", April: "4月", May: "5月", June: "6月", July: "7月", August: "8月", September: "9月", October: "10月", November: "11月", December: "12月", Jan: "1月", Feb: "2月", Mar: "3月", Apr: "4月", "May(short)": "5月", Jun: "6月", Jul: "7月", Aug: "8月", Sep: "9月", Oct: "10月", Nov: "11月", Dec: "12月", Sunday: "星期日", Monday: "星期一", Tuesday: "星期二", Wednesday: "星期三", Thursday: "星期四", Friday: "星期五", Saturday: "星期六", Sun: "週日", Mon: "週一", Tue: "週二", Wed: "週三", Thu: "週四", Fri: "週五", Sat: "週六", _dateOrd: function(i) { + var r = "th"; + if (i < 11 || i > 13) + switch (i % 10) { + case 1: + case 2: + case 3: + r = "日"; + } + return r; + }, "Zoom Out": "縮放", Play: "播放", Stop: "停止", Legend: "圖例", "Click, tap or press ENTER to toggle": "", Loading: "正在載入", Home: "首頁", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "列印", Image: "影像", Data: "資料", Print: "列印", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "從 %1 至 %2", "From %1": "從 %1", "To %1": "至 %1", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "" }; +}(Cl, nte)) !== void 0 && (ait.exports = lit); +const XXi = qXi({ __proto__: null, default: nl(nte) }, [nte]), uit = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + z: XXi +}, Symbol.toStringTag, { value: "Module" })); +function KXi(t, e) { + for (var i = 0; i < e.length; i++) { + const r = e[i]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const n in r) + if (n !== "default" && !(n in t)) { + const s = Object.getOwnPropertyDescriptor(r, n); + s && Object.defineProperty(t, n, s.get ? s : { enumerable: !0, get: () => r[n] }); + } + } + } + return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" })); +} +var cit, Vfe = {}; +cit = () => (() => { + var t, e, i, r, n = {}, s = {}; + function o(U) { + var R = s[U]; + if (R !== void 0) + return R.exports; + var u = s[U] = { exports: {} }; + return n[U].call(u.exports, u, u.exports, o), u.exports; + } + o.m = n, o.n = (U) => { + var R = U && U.__esModule ? () => U.default : () => U; + return o.d(R, { a: R }), R; + }, e = Object.getPrototypeOf ? (U) => Object.getPrototypeOf(U) : (U) => U.__proto__, o.t = function(U, R) { + if (1 & R && (U = this(U)), 8 & R || typeof U == "object" && U && (4 & R && U.__esModule || 16 & R && typeof U.then == "function")) + return U; + var u = /* @__PURE__ */ Object.create(null); + o.r(u); + var w = {}; + t = t || [null, e({}), e([]), e(e)]; + for (var $ = 2 & R && U; typeof $ == "object" && !~t.indexOf($); $ = e($)) + Object.getOwnPropertyNames($).forEach((G) => w[G] = () => U[G]); + return w.default = () => U, o.d(u, w), u; + }, o.d = (U, R) => { + for (var u in R) + o.o(R, u) && !o.o(U, u) && Object.defineProperty(U, u, { enumerable: !0, get: R[u] }); + }, o.f = {}, o.e = (U) => Promise.all(Object.keys(o.f).reduce((R, u) => (o.f[u](U, R), R), [])), o.u = (U) => ({ 265: "canvg", 297: "xlsx", 643: "pdfmake" }[U] || U) + ".js", o.g = function() { + if (typeof globalThis == "object") + return globalThis; + try { + return this || new Function("return this")(); + } catch { + if (typeof window == "object") + return window; + } + }(), o.o = (U, R) => Object.prototype.hasOwnProperty.call(U, R), i = {}, r = "EsriAmCharts:", o.l = (U, R, u, w) => { + if (i[U]) + i[U].push(R); + else { + var $, G; + if (u !== void 0) + for (var K = document.getElementsByTagName("script"), ne = 0; ne < K.length; ne++) { + var ue = K[ne]; + if (ue.getAttribute("src") == U || ue.getAttribute("data-webpack") == r + u) { + $ = ue; + break; + } + } + $ || (G = !0, ($ = document.createElement("script")).charset = "utf-8", $.timeout = 120, o.nc && $.setAttribute("nonce", o.nc), $.setAttribute("data-webpack", r + u), $.src = U), i[U] = [R]; + var we = ($e, Ke) => { + $.onerror = $.onload = null, clearTimeout(De); + var Ze = i[U]; + if (delete i[U], $.parentNode && $.parentNode.removeChild($), Ze && Ze.forEach((pt) => pt(Ke)), $e) + return $e(Ke); + }, De = setTimeout(we.bind(null, void 0, { type: "timeout", target: $ }), 12e4); + $.onerror = we.bind(null, $.onerror), $.onload = we.bind(null, $.onload), G && document.head.appendChild($); + } + }, o.r = (U) => { + typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(U, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(U, "__esModule", { value: !0 }); + }, o.p = "", (() => { + var U = { 826: 0 }; + o.f.j = (w, $) => { + var G = o.o(U, w) ? U[w] : void 0; + if (G !== 0) + if (G) + $.push(G[2]); + else { + var K = new Promise((we, De) => G = U[w] = [we, De]); + $.push(G[2] = K); + var ne = o.p + o.u(w), ue = new Error(); + o.l(ne, (we) => { + if (o.o(U, w) && ((G = U[w]) !== 0 && (U[w] = void 0), G)) { + var De = we && (we.type === "load" ? "missing" : we.type), $e = we && we.target && we.target.src; + ue.message = "Loading chunk " + w + ` failed. +(` + De + ": " + $e + ")", ue.name = "ChunkLoadError", ue.type = De, ue.request = $e, G[1](ue); + } + }, "chunk-" + w, w); + } + }; + var R = (w, $) => { + var G, K, [ne, ue, we] = $, De = 0; + if (ne.some(($e) => U[$e] !== 0)) { + for (G in ue) + o.o(ue, G) && (o.m[G] = ue[G]); + we && we(o); + } + for (w && w($); De < ne.length; De++) + K = ne[De], o.o(U, K) && U[K] && U[K][0](), U[K] = 0; + }, u = self.webpackChunkEsriAmCharts = self.webpackChunkEsriAmCharts || []; + u.forEach(R.bind(null, 0)), u.push = R.bind(null, u.push.bind(u)); + })(); + var a = {}; + o.r(a), o.d(a, { am4charts: () => X, am4core: () => Y, am4themes_animated: () => C_e, am4themes_dark: () => ew }); + var l = {}; + o.r(l), o.d(l, { castNumber: () => kt, castString: () => Mt, checkArray: () => tt, checkBoolean: () => je, checkDate: () => ft, checkNumber: () => et, checkObject: () => Qe, checkString: () => Ge, getDefault: () => Re, getType: () => Oe, getValue: () => Be, getValueDefault: () => at, hasValue: () => Ee, isArray: () => gt, isDate: () => wt, isNaN: () => Pe, isNumber: () => le, isObject: () => ct, isString: () => st, toBoolean: () => Tt, toNumber: () => It, toNumberOrPercent: () => nt, toText: () => Nt }); + var c = {}; + o.r(c), o.d(c, { DEGREES: () => it, HALFPI: () => pe, PI: () => Ne, RADIANS: () => Ae, adjustTension: () => Rt, ceil: () => Ft, closest: () => T, cos: () => A, fitAngleToRange: () => Jt, fitToRange: () => mt, getAngle: () => se, getArcPoint: () => Qt, getArcRect: () => Xt, getBBox: () => Ce, getCenterShift: () => de, getCommonRectangle: () => Ve, getCubicControlPointA: () => $t, getCubicControlPointB: () => qe, getCubicCurveDistance: () => B, getDistance: () => C, getHorizontalDistance: () => D, getLineIntersection: () => Mi, getMidPoint: () => Z, getPointOnCubicCurve: () => Pt, getPointOnQuadraticCurve: () => Je, getRotation: () => ie, getScale: () => q, getVerticalDistance: () => L, intersect: () => b, intersection: () => _, invertRange: () => m, isInRectangle: () => bi, max: () => ve, min: () => H, normalizeAngle: () => Zt, round: () => He, sin: () => Ue, stretch: () => ei, tan: () => si, toNumberRange: () => yt }); + var h = {}; + o.r(h), o.d(h, { add: () => So, any: () => Yi, copy: () => W, each: () => _i, eachContinue: () => jr, eachReverse: () => fn, find: () => xi, findIndex: () => Ca, first: () => Zn, getSortedIndex: () => Ut, has: () => ui, indexOf: () => Ri, insert: () => bs, insertIndex: () => ia, keepIf: () => Fr, last: () => $r, map: () => rr, move: () => Ur, pushAll: () => Jn, remove: () => ki, removeIndex: () => Ho, replace: () => Cn, setIndex: () => On, shiftLeft: () => no, shuffle: () => _t, slice: () => Cr, toArray: () => Ki }); + var p = {}; + o.r(p), o.d(p, { clone: () => Nr, copy: () => Lr, copyAllProperties: () => fs, copyProperties: () => _r, each: () => mi, eachContinue: () => pi, eachOrdered: () => hr, entries: () => Kt, forceCopyProperties: () => os, getKey: () => ri, hasKey: () => Tr, keys: () => Pi, keysOrdered: () => Sr, merge: () => wr, softCopyProperties: () => Tn }); + var y = {}; + o.r(y), o.d(y, { ListIterator: () => Mp, concat: () => Ds, contains: () => ah, each: () => er, eachContinue: () => Zr, filter: () => Ta, find: () => Mc, findIndex: () => Rc, findMap: () => Tl, flatten: () => fu, foldl: () => jh, fromArray: () => di, indexed: () => mu, join: () => ou, length: () => nr, map: () => Da, max: () => Gh, min: () => kl, sort: () => ys, toArray: () => fr }); + var v = {}; + o.r(v), o.d(v, { order: () => yh, random: () => lg, repeat: () => ag }); + var x = {}; + o.r(x), o.d(x, { order: () => jc }); + var I = {}; + o.r(I), o.d(I, { brighten: () => ge, getBrightnessStep: () => Le, getLightnessStep: () => Ui, hexToRgb: () => Am, hexToRgbWithAlpha: () => Gd, hslToRgb: () => xt, hsvToRgb: () => ae, interpolate: () => Wt, isLight: () => ye, lighten: () => Ai, pad2: () => zt, rgb: () => _c, rgbToHex: () => Ug, rgbToHsl: () => oe, rgbToHsv: () => ee, rgbToRGBA: () => cg, rgbaToRgb: () => df, saturate: () => Ye }); + var P = {}; + o.r(P), o.d(P, { anyToDate: () => zg, anyToNumber: () => Ot, camelToDashed: () => _h, capitalize: () => Xu, cleanFormat: () => xh, copy: () => Wa, copyProperties: () => on, decimalPlaces: () => nL, documentPointToSprite: () => O1, documentPointToSvg: () => Xl, escapeForRgex: () => Bl, fitNumber: () => hg, fitNumberRelative: () => By, get12Hours: () => Ss, getBaseURI: () => Fs, getDayFromWeek: () => xs, getFormat: () => co, getMonthWeek: () => zn, getPixelRatio: () => Pr, getTimeZone: () => da, getWeek: () => Mr, getYearDay: () => Bi, height: () => Hg, isIE: () => Yx, isNotEmpty: () => Ks, joinUrl: () => XI, ltrim: () => md, numberToString: () => Ud, padString: () => Vl, parseUrl: () => D3, plainText: () => Sh, random: () => qa, relativeRadiusToValue: () => yo, relativeToValue: () => vs, reverseString: () => yl, rtrim: () => wh, serializeUrl: () => xn, softCopyProperties: () => Ro, splitTextByCharCount: () => bh, spritePointToDocument: () => cr, spritePointToSprite: () => up, spritePointToSvg: () => kf, spriteRectToSvg: () => rt, stringify: () => Cu, stripHash: () => $n, stripTags: () => yu, svgPointToDocument: () => Vy, svgPointToSprite: () => ff, svgRectToSprite: () => YI, trim: () => pf, truncateWithEllipsis: () => fd, unquote: () => Dc, used: () => Jr, valueToRelative: () => Gc, width: () => _s }); + var F = {}; + o.r(F), o.d(F, { bounceIn: () => pa, bounceInOut: () => JI, bounceOut: () => bC, circleIn: () => O8, circleInOut: () => k3, circleOut: () => qr, cubicIn: () => N3, cubicInOut: () => ba, cubicOut: () => W0, elasticIn: () => $3, elasticInOut: () => R8, elasticOut: () => aL, expIn: () => gC, expInOut: () => jy, expOut: () => yC, linear: () => ch, polyIn: () => sL, polyIn3: () => Pm, polyInOut: () => Hv, polyInOut3: () => oL, polyOut: () => ho, polyOut3: () => F3, quadIn: () => mC, quadInOut: () => Ch, quadOut: () => KI, sinIn: () => Wg, sinInOut: () => vC, sinOut: () => L3 }); + var k = {}; + o.r(k), o.d(k, { add: () => cp, checkChange: () => AC, copy: () => Jx, getDuration: () => Tu, getNextUnit: () => H3, getTime: () => Om, getTimezoneMinutes: () => B8, now: () => IC, round: () => Uh, setTimezone: () => nA, timeUnitDurations: () => z3 }); + var V = {}; + o.r(V), o.d(V, { load: () => oi, readBlob: () => Hn }); + var j = {}; + o.r(j), o.d(j, { arc: () => r2, arcTo: () => gd, arcToPoint: () => Uy, closePath: () => l_e, cubicCurveTo: () => aA, lineTo: () => xr, moveTo: () => pn, pathToPoints: () => u_e, pointsToPath: () => h_e, polyline: () => Z3, quadraticCurveTo: () => i2, rectToPath: () => n2, rectangle: () => z8, spiralPoints: () => c_e }); + var Y = {}; + o.r(Y), o.d(Y, { AMElement: () => EC, Adapter: () => Yu, Animation: () => $f, BaseObject: () => Ht, BaseObjectEvents: () => vi, Basis: () => d_e, BlurFilter: () => Rre, Button: () => t2, CSVParser: () => e2, Cache: () => al, Circle: () => NC, CirclePattern: () => SL, CloseButton: () => Cre, Color: () => Ie, ColorModifier: () => jn, ColorSet: () => Mm, ColorizeFilter: () => Ore, Component: () => LC, Cone: () => Y8, Container: () => Qn, CounterDisposer: () => Cs, DATE: () => ar, DURATION: () => tr, DataItem: () => FC, DataLoader: () => _re, DataParser: () => fH, DataSource: () => G8, DateFormatter: () => OC, DesaturateFilter: () => CL, Dictionary: () => ha, DictionaryDisposer: () => jd, DictionaryTemplate: () => Nf, Disposer: () => ln, DropShadowFilter: () => yH, DurationFormatter: () => J3, Ellipse: () => U8, EventDispatcher: () => ii, Export: () => fg, ExportMenu: () => Gt, Filter: () => o2, FocusFilter: () => Mre, GlobalAdapter: () => Ba, Group: () => G3, Image: () => yL, IndexedIterable: () => Fp, Inertia: () => U3, Interaction: () => mL, InteractionKeyboardObject: () => fL, InteractionObject: () => pL, InteractionObjectEventDispatcher: () => rA, InterfaceColorSet: () => Fa, JSONParser: () => oA, Keyboard: () => $8, Label: () => Rm, Language: () => Yv, LightenFilter: () => X8, Line: () => q0, LinePattern: () => SH, LinearGradient: () => qg, LinearGradientModifier: () => tR, List: () => Hs, ListDisposer: () => Wo, ListGrouper: () => ug, ListIterator: () => Mp, ListTemplate: () => Xs, Modal: () => gL, Morpher: () => Sre, MouseCursorStyle: () => vl, MultiDisposer: () => kn, MutableValueDisposer: () => Un, NUMBER: () => zi, NumberFormatter: () => sA, OrderedList: () => ql, OrderedListTemplate: () => Im, PLACEHOLDER: () => Ir, PLACEHOLDER2: () => ur, PX: () => yi, Paper: () => Qx, Pattern: () => qv, PatternSet: () => CH, Percent: () => J, PlayButton: () => bH, Plugin: () => Dre, PointedRectangle: () => xre, PointedShape: () => wre, Polyarc: () => mH, Polygon: () => lA, Polyline: () => Q3, Polyspline: () => eR, Popup: () => Gy, Preloader: () => s2, RadialGradient: () => Yg, RadialGradientModifier: () => xH, RectPattern: () => mg, Rectangle: () => MC, Rectangle3D: () => N1, Registry: () => uh, ResizeButton: () => vL, Responsive: () => bre, ResponsiveBreakpoints: () => gf, RoundedRectangle: () => L1, STRING: () => Oi, SVGContainer: () => F1, SVGDefaults: () => B3, Scrollbar: () => zy, Slice: () => kC, Slice3D: () => Pre, Slider: () => gH, SortedList: () => Su, SortedListTemplate: () => Vc, Sprite: () => so, SpriteEventDispatcher: () => M8, SpriteState: () => Hr, StyleClass: () => dL, StyleRule: () => $s, SwitchButton: () => _L, System: () => vre, TargetedEventDispatcher: () => bt, Tension: () => Kv, TextFormatter: () => K3, TextLink: () => H8, Tooltip: () => $C, Trapezoid: () => W8, Triangle: () => bL, Validatable: () => Ct, WavedCircle: () => wL, WavedLine: () => Ar, WavedRectangle: () => xL, ZoomOutButton: () => _H, addClass: () => M1, addLicense: () => w_e, animate: () => R1, array: () => h, blur: () => Kx, cache: () => Dp, castColor: () => lt, castNumber: () => kt, castString: () => Mt, checkBoolean: () => je, checkNumber: () => et, checkObject: () => Qe, checkString: () => Ge, color: () => We, colors: () => I, copyAttributes: () => Th, create: () => m_e, createDeferred: () => y_e, createFromConfig: () => g_e, dataLoader: () => DC, defaultRules: () => Wd, disposeAllCharts: () => TL, ease: () => F, fixPixelPerfect: () => hL, focus: () => j3, getElement: () => cL, getInteraction: () => Gs, getTextFormatter: () => Xv, globalAdapter: () => vh, is: () => ll, isArray: () => gt, isColor: () => Xe, isElement: () => Wv, isNaN: () => Pe, isNumber: () => le, isObject: () => ct, isPercent: () => xe, isString: () => st, iter: () => y, join: () => ou, keyboard: () => dg, math: () => c, max: () => Gh, min: () => kl, net: () => V, nextFrame: () => dd, number: () => x, object: () => p, options: () => zd, or: () => Yl, outerHTML: () => SC, path: () => j, percent: () => ce, readFrame: () => Vd, ready: () => CC, registry: () => hi, removeClass: () => Xx, reverse: () => gu, string: () => v, system: () => qo, time: () => k, triggerIdle: () => Nl, type: () => l, unuseAllThemes: () => b_e, unuseTheme: () => __e, useTheme: () => v_e, utils: () => P, viewPortHandler: () => f_e, whenIdle: () => cs, writeFrame: () => pd }); + var X = {}; + o.r(X), o.d(X, { Axis: () => OL, AxisBreak: () => PL, AxisBullet: () => nR, AxisDataItem: () => a2, AxisFill: () => Q8, AxisFillCircular: () => FH, AxisLabel: () => e9, AxisLabelCircular: () => LL, AxisLine: () => PH, AxisRenderer: () => RL, AxisRendererCircular: () => LH, AxisRendererRadial: () => NL, AxisRendererX: () => yd, AxisRendererX3D: () => cA, AxisRendererY: () => Zv, AxisRendererY3D: () => WH, AxisTick: () => t9, Bullet: () => Mo, Candlestick: () => GL, CandlestickSeries: () => YH, CandlestickSeriesDataItem: () => uR, CategoryAxis: () => Eh, CategoryAxisBreak: () => MH, CategoryAxisDataItem: () => Jb, Chart: () => Kb, ChartDataItem: () => EH, ChordDiagram: () => qre, ChordDiagramDataItem: () => Wre, ChordLink: () => m9, ChordNode: () => f9, CircleBullet: () => S9, ClockHand: () => l9, Column: () => jC, Column3D: () => qH, ColumnSeries: () => Y0, ColumnSeries3D: () => jL, ColumnSeries3DDataItem: () => lR, ColumnSeriesDataItem: () => k1, ConeColumn: () => w9, ConeSeries: () => ene, ConeSeriesDataItem: () => x9, Cursor: () => QH, CurvedColumn: () => UC, CurvedColumnSeries: () => tne, CurvedColumnSeriesDataItem: () => ZH, DateAxis: () => Ju, DateAxisBreak: () => OH, DateAxisDataItem: () => RH, DurationAxis: () => DL, DurationAxisDataItem: () => Bre, ErrorBullet: () => ine, FlowDiagram: () => d9, FlowDiagramDataItem: () => BL, FlowDiagramLink: () => aR, FlowDiagramNode: () => $L, FunnelSeries: () => _9, FunnelSeriesDataItem: () => Qb, FunnelSlice: () => GC, GaugeChart: () => jre, GaugeChartDataItem: () => kH, Grid: () => iR, GridCircular: () => a9, HeatLegend: () => g9, LabelBullet: () => uA, Legend: () => EL, LegendDataItem: () => J8, LegendSettings: () => IH, LineSeries: () => s9, LineSeriesDataItem: () => FL, LineSeriesSegment: () => n9, NavigationBar: () => hA, NavigationBarDataItem: () => rne, OHLC: () => y9, OHLCSeries: () => Xre, OHLCSeriesDataItem: () => UL, PictorialStackedSeries: () => Qre, PictorialStackedSeriesDataItem: () => cR, PieChart: () => VH, PieChart3D: () => Ure, PieChart3DDataItem: () => Gre, PieChartDataItem: () => sR, PieSeries: () => h9, PieSeries3D: () => jH, PieSeries3DDataItem: () => l2, PieSeriesDataItem: () => c9, PieTick: () => BH, PyramidSeries: () => JH, PyramidSeriesDataItem: () => b9, RadarChart: () => NH, RadarChartDataItem: () => Vre, RadarColumn: () => KH, RadarColumnSeries: () => Zre, RadarColumnSeriesDataItem: () => Jre, RadarCursor: () => nne, RadarSeries: () => DH, RadarSeriesDataItem: () => o9, SankeyDiagram: () => Hre, SankeyDiagramDataItem: () => zre, SankeyLink: () => p9, SankeyNode: () => Bf, SerialChart: () => Z8, SerialChartDataItem: () => AH, Series: () => AL, SeriesDataItem: () => IL, SlicedChart: () => GH, SlicedChartDataItem: () => oR, StepLineSeries: () => XH, StepLineSeriesDataItem: () => v9, Tick: () => rR, TreeMap: () => HH, TreeMapDataItem: () => zH, TreeMapSeries: () => VL, TreeMapSeriesDataItem: () => UH, ValueAxis: () => vo, ValueAxisBreak: () => i9, ValueAxisDataItem: () => ML, XYChart: () => Hy, XYChart3D: () => Yre, XYChart3DDataItem: () => S_e, XYChartDataItem: () => r9, XYChartScrollbar: () => VC, XYCursor: () => hR, XYSeries: () => BC, XYSeriesDataItem: () => Dm }); + var Q = function(U, R) { + return Q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(u, w) { + u.__proto__ = w; + } || function(u, w) { + for (var $ in w) + Object.prototype.hasOwnProperty.call(w, $) && (u[$] = w[$]); + }, Q(U, R); + }; + function re(U, R) { + if (typeof R != "function" && R !== null) + throw new TypeError("Class extends value " + String(R) + " is not a constructor or null"); + function u() { + this.constructor = U; + } + Q(U, R), U.prototype = R === null ? Object.create(R) : (u.prototype = R.prototype, new u()); + } + var he = function() { + return he = Object.assign || function(U) { + for (var R, u = 1, w = arguments.length; u < w; u++) + for (var $ in R = arguments[u]) + Object.prototype.hasOwnProperty.call(R, $) && (U[$] = R[$]); + return U; + }, he.apply(this, arguments); + }; + function fe(U, R, u, w) { + return new (u || (u = Promise))(function($, G) { + function K(we) { + try { + ue(w.next(we)); + } catch (De) { + G(De); + } + } + function ne(we) { + try { + ue(w.throw(we)); + } catch (De) { + G(De); + } + } + function ue(we) { + var De; + we.done ? $(we.value) : (De = we.value, De instanceof u ? De : new u(function($e) { + $e(De); + })).then(K, ne); + } + ue((w = w.apply(U, R || [])).next()); + }); + } + function be(U, R) { + var u, w, $, G, K = { label: 0, sent: function() { + if (1 & $[0]) + throw $[1]; + return $[1]; + }, trys: [], ops: [] }; + return G = { next: ne(0), throw: ne(1), return: ne(2) }, typeof Symbol == "function" && (G[Symbol.iterator] = function() { + return this; + }), G; + function ne(ue) { + return function(we) { + return function(De) { + if (u) + throw new TypeError("Generator is already executing."); + for (; K; ) + try { + if (u = 1, w && ($ = 2 & De[0] ? w.return : De[0] ? w.throw || (($ = w.return) && $.call(w), 0) : w.next) && !($ = $.call(w, De[1])).done) + return $; + switch (w = 0, $ && (De = [2 & De[0], $.value]), De[0]) { + case 0: + case 1: + $ = De; + break; + case 4: + return K.label++, { value: De[1], done: !1 }; + case 5: + K.label++, w = De[1], De = [0]; + continue; + case 7: + De = K.ops.pop(), K.trys.pop(); + continue; + default: + if (!(($ = ($ = K.trys).length > 0 && $[$.length - 1]) || De[0] !== 6 && De[0] !== 2)) { + K = 0; + continue; + } + if (De[0] === 3 && (!$ || De[1] > $[0] && De[1] < $[3])) { + K.label = De[1]; + break; + } + if (De[0] === 6 && K.label < $[1]) { + K.label = $[1], $ = De; + break; + } + if ($ && K.label < $[2]) { + K.label = $[2], K.ops.push(De); + break; + } + $[2] && K.ops.pop(), K.trys.pop(); + continue; + } + De = R.call(U, K); + } catch ($e) { + De = [6, $e], w = 0; + } finally { + u = $ = 0; + } + if (5 & De[0]) + throw De[1]; + return { value: De[0] ? De[1] : void 0, done: !0 }; + }([ue, we]); + }; + } + } + function Se(U) { + var R = typeof Symbol == "function" && Symbol.iterator, u = R && U[R], w = 0; + if (u) + return u.call(U); + if (U && typeof U.length == "number") + return { next: function() { + return U && w >= U.length && (U = void 0), { value: U && U[w++], done: !U }; + } }; + throw new TypeError(R ? "Object is not iterable." : "Symbol.iterator is not defined."); + } + function Me(U, R) { + var u = typeof Symbol == "function" && U[Symbol.iterator]; + if (!u) + return U; + var w, $, G = u.call(U), K = []; + try { + for (; (R === void 0 || R-- > 0) && !(w = G.next()).done; ) + K.push(w.value); + } catch (ne) { + $ = { error: ne }; + } finally { + try { + w && !w.done && (u = G.return) && u.call(G); + } finally { + if ($) + throw $.error; + } + } + return K; + } + function ke() { + for (var U = [], R = 0; R < arguments.length; R++) + U = U.concat(Me(arguments[R])); + return U; + } + var J = function() { + function U(R) { + this._value = R; + } + return Object.defineProperty(U.prototype, "value", { get: function() { + return this._value / 100; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "percent", { get: function() { + return this._value; + }, enumerable: !0, configurable: !0 }), U.prototype.toString = function() { + return this._value + "%"; + }, U; + }(); + function ce(U) { + return new J(U); + } + function xe(U) { + return U instanceof J; + } + function Pe(U) { + return Number(U) !== U; + } + function Oe(U) { + return {}.toString.call(U); + } + function Re(U, R) { + return U || R; + } + function Ge(U) { + if (typeof U == "string") + return !0; + throw new Error("Expected a string but got " + Oe(U)); + } + function je(U) { + if (typeof U == "boolean") + return !0; + throw new Error("Expected a boolean but got " + Oe(U)); + } + function et(U) { + if (typeof U != "number") + throw new Error("Expected a number but got " + Oe(U)); + if (Pe(U)) + throw new Error("Expected a number but got NaN"); + return !0; + } + function Qe(U) { + var R = Oe(U); + if (R === "[object Object]") + return !0; + throw new Error("Expected an object but got " + R); + } + function tt(U) { + if (Array.isArray(U)) + return !0; + throw new Error("Expected an array but got " + Oe(U)); + } + function ft(U) { + var R = Oe(U); + if (R === "[object Date]") + return !0; + throw new Error("Expected a date but got " + R); + } + function Mt(U) { + if (typeof U == "string") + return U; + if (typeof U == "number") + return "" + U; + throw new Error("Expected a string or number but got " + Oe(U)); + } + function kt(U) { + if (typeof U == "string") { + var R = +U; + if (Pe(R)) + throw new Error("Cannot cast string " + JSON.stringify(U) + " to a number"); + return R; + } + if (typeof U == "number") { + if (Pe(U)) + throw new Error("Expected a number but got NaN"); + return U; + } + var u = Oe(U); + if (u === "[object Date]") + return U.getTime(); + throw new Error("Expected a string, number, or date but got " + u); + } + function Tt(U) { + return !!U; + } + function It(U) { + if (Ee(U) && !le(U)) { + var R = Number(U); + return Pe(R) && st(U) && U != "" ? It(U.replace(/[^0-9.\-]+/g, "")) : R; + } + return U; + } + function Nt(U) { + if (Ee(U) && !st(U)) { + if (le(U)) + return Mt(U); + if (ct(U)) + return U.toString(); + } + return U; + } + function nt(U) { + return !Ee(U) || le(U) || xe(U) ? U : st(U) && U.indexOf("%") != -1 ? ce(It(U)) : It(U); + } + function Ee(U) { + return U != null; + } + function Be(U) { + if (Ee(U)) + return U; + throw new Error("Value doesn't exist"); + } + function at(U, R) { + return Ee(U) ? U : R; + } + function wt(U) { + return Oe(U) === "[object Date]"; + } + function st(U) { + return typeof U == "string"; + } + function le(U) { + return typeof U == "number" && Number(U) == U; + } + function ct(U) { + return typeof U == "object" && U != null; + } + function gt(U) { + return Array.isArray(U); + } + var Ne = Math.PI, pe = Ne / 2, Ae = Ne / 180, it = 180 / Ne; + function yt(U, R, u) { + return Ee(U) ? mt(U = It(U), R, u) : U; + } + function He(U, R, u) { + if (!le(R) || R <= 0) { + var w = Math.round(U); + return u && w - U == 0.5 && w--, w; + } + var $ = Math.pow(10, R); + return Math.round(U * $) / $; + } + function Ft(U, R) { + if (!le(R) || R <= 0) + return Math.ceil(U); + var u = Math.pow(10, R); + return Math.ceil(U * u) / u; + } + function ei(U, R, u) { + return U * (u - R) + R; + } + function mt(U, R, u) { + if (le(R)) { + if (le(u) && u < R) { + var w = u; + u = R, R = w; + } + U < R && (U = R); + } + return le(u) && U > u && (U = u), U; + } + function Ue(U) { + return He(Math.sin(Ae * U), 10); + } + function si(U) { + return He(Math.tan(Ae * U), 10); + } + function A(U) { + return He(Math.cos(Ae * U), 10); + } + function ve(U, R) { + return le(U) ? le(R) && R > U ? R : U : le(R) ? R : null; + } + function H(U, R) { + return le(U) ? le(R) && R < U ? R : U : le(R) ? R : null; + } + function T(U, R) { + return U.reduce(function(u, w) { + return Math.abs(w - R) < Math.abs(u - R) ? w : u; + }); + } + function b(U, R) { + var u = Be(U.start), w = Be(R.start), $ = Be(U.end), G = Be(R.end); + return Math.max(u, w) <= Math.min($, G); + } + function m(U) { + var R = Be(U.start); + return { start: 1 - Be(U.end), end: 1 - R }; + } + function _(U, R) { + var u = Be(U.start), w = Be(R.start), $ = Be(U.end), G = Be(R.end), K = Math.max(u, w), ne = Math.min($, G); + return ne < K ? void 0 : { start: K, end: ne }; + } + function C(U, R) { + return U ? (R || (R = { x: 0, y: 0 }), Math.sqrt(Math.pow(Math.abs(U.x - R.x), 2) + Math.pow(Math.abs(U.y - R.y), 2))) : 0; + } + function D(U, R) { + return U ? (R || (R = { x: 0, y: 0 }), Math.abs(U.x - R.x)) : 0; + } + function L(U, R) { + return U ? (R || (R = { x: 0, y: 0 }), Math.abs(U.y - R.y)) : 0; + } + function B(U, R, u, w, $) { + if (!U) + return 0; + R || (R = { x: 0, y: 0 }); + var G = 0, K = U; + if ($ > 0) + for (var ne = 0; ne <= $; ne++) { + var ue = Pt(U, R, u, w, ne / $); + G += C(K, ue), K = ue; + } + return G; + } + function q(U, R, u, w) { + var $ = C(R, w), G = C(U, u); + return Math.abs(G / $); + } + function Z(U, R, u) { + return le(u) || (u = 0.5), { x: U.x + (R.x - U.x) * u, y: U.y + (R.y - U.y) * u }; + } + function ie(U, R, u, w) { + var $ = se(R, w) - se(U, u); + return $ < 0 && ($ += 360), $; + } + function se(U, R) { + R || (R = { x: 2 * U.x, y: 2 * U.y }); + var u = R.x - U.x, w = R.y - U.y, $ = Math.atan2(w, u) * it; + return $ < 0 && ($ += 360), Zt($); + } + function de(U, R, u, w, $) { + var G = ie(R, u, w, $) - 90; + G < 0 && (G += 360); + var K = C(R, w), ne = Math.cos(G) / K + R.x, ue = Math.cos(G) / K + R.y; + return { x: ne - U.x, y: ue - U.y }; + } + function Ce(U) { + if (U) { + var R = U.length; + if (R !== 0) { + for (var u, w = void 0, $ = void 0, G = void 0, K = 0; K < R; K++) { + var ne = U[K]; + (!le($) || ne.x > $) && ($ = ne.x), (!le(w) || ne.x < w) && (w = ne.x), (!le(u) || ne.y < u) && (u = ne.y), (!le(G) || ne.y > G) && (G = ne.y); + } + return { x: w, y: u, width: $ - w, height: G - u }; + } + } + return { x: 0, y: 0, width: 0, height: 0 }; + } + function Ve(U) { + var R = U.length; + if (R !== 0) { + for (var u = void 0, w = void 0, $ = void 0, G = void 0, K = 0; K < R; K++) { + var ne = U[K]; + u = H(ne.x, u), w = H(ne.y, w), $ = ve(ne.x + ne.width, $), G = ve(ne.y + ne.height, G); + } + return { x: u, y: w, width: $ - u, height: G - w }; + } + } + function Je(U, R, u, w) { + return { x: (1 - w) * (1 - w) * U.x + 2 * (1 - w) * w * u.x + w * w * R.x, y: (1 - w) * (1 - w) * U.y + 2 * (1 - w) * w * u.y + w * w * R.y }; + } + function Pt(U, R, u, w, $) { + var G = { x: 0, y: 0 }, K = 1 - $, ne = K * K, ue = ne * K; + return G.x = U.x * ue + 3 * u.x * ne * $ + 3 * w.x * K * $ * $ + R.x * $ * $ * $, G.y = U.y * ue + 3 * u.y * ne * $ + 3 * w.y * K * $ * $ + R.y * $ * $ * $, G; + } + function $t(U, R, u, w, $, G) { + return $ = Rt($), G = Rt(G), { x: (-U.x + R.x / $ + u.x) * $, y: (-U.y + R.y / G + u.y) * G }; + } + function qe(U, R, u, w, $, G) { + return $ = Rt($), G = Rt(G), { x: (R.x + u.x / $ - w.x) * $, y: (R.y + u.y / G - w.y) * G }; + } + function Rt(U) { + return 1 - U + 1e-5; + } + function Zt(U) { + return U == 360 ? 360 : U % 360; + } + function Jt(U, R, u) { + if (R > u) { + var w = R; + R = u, u = w; + } + U = Zt(U); + var $ = (R - Zt(R)) / 360; + return U < R && (U += 360 * ($ + 1)), U > u && (U - 360 > R ? U -= 360 : U = U < R + (u - R) / 2 + 180 ? u : R), U < R && (U = U > R + (u - R) / 2 - 180 ? R : u), U; + } + function Xt(U, R, u) { + var w = Number.MAX_VALUE, $ = Number.MAX_VALUE, G = -Number.MAX_VALUE, K = -Number.MAX_VALUE, ne = []; + le(u) || (u = 1), ne.push(Qt(u, U)), ne.push(Qt(u, R)); + for (var ue = Math.min(90 * Math.floor(U / 90), 90 * Math.floor(R / 90)), we = Math.max(90 * Math.ceil(U / 90), 90 * Math.ceil(R / 90)), De = ue; De <= we; De += 90) + De >= U && De <= R && ne.push(Qt(u, De)); + for (var $e = 0; $e < ne.length; $e++) { + var Ke = ne[$e]; + Ke.x < w && (w = Ke.x), Ke.y < $ && ($ = Ke.y), Ke.x > G && (G = Ke.x), Ke.y > K && (K = Ke.y); + } + return { x: w, y: $, width: G - w, height: K - $ }; + } + function Qt(U, R) { + return { x: U * A(R), y: U * Ue(R) }; + } + function bi(U, R) { + return U.x >= R.x && U.x <= R.x + R.width && U.y >= R.y && U.y <= R.y + R.height; + } + function Mi(U, R, u, w) { + return { x: ((U.x * R.y - R.x * U.y) * (u.x - w.x) - (U.x - R.x) * (u.x * w.y - u.y * w.x)) / ((U.x - R.x) * (u.y - w.y) - (U.y - R.y) * (u.x - w.x)), y: ((U.x * R.y - R.x * U.y) * (u.y - w.y) - (U.y - R.y) * (u.x * w.y - u.y * w.x)) / ((U.x - R.x) * (u.y - w.y) - (U.y - R.y) * (u.x - w.x)) }; + } + function Ri(U, R) { + for (var u = U.length, w = 0; w < u; ++w) + if (U[w] === R) + return w; + return -1; + } + function Yi(U, R) { + for (var u = U.length, w = 0; w < u; ++w) + if (R(U[w])) + return !0; + return !1; + } + function rr(U, R) { + for (var u = U.length, w = new Array(u), $ = 0; $ < u; ++$) + w[$] = R(U[$], $); + return w; + } + function _i(U, R) { + for (var u = U.length, w = 0; w < u; ++w) + R(U[w], w); + } + function fn(U, R) { + for (var u = U.length; u--; ) + R(U[u], u); + } + function jr(U, R) { + for (var u = U.length, w = 0; w < u && R(U[w], w); ++w) + ; + } + function no(U, R) { + for (var u = U.length, w = R; w < u; ++w) + U[w - R] = U[w]; + U.length = u - R; + } + function $r(U) { + var R = U.length; + return R ? U[R - 1] : void 0; + } + function Zn(U) { + return U[0]; + } + function bs(U, R, u) { + u = mt(u, 0, U.length), U.splice(u, 0, R); + } + function On(U, R, u) { + ki(U, R), bs(U, R, u); + } + function Jn(U, R) { + for (var u = R.length, w = 0; w < u; ++w) + U.push(R[w]); + } + function ki(U, R) { + var u = !1, w = U.indexOf(R); + if (w !== -1) { + u = !0, U.splice(w, 1); + for (var $ = U.length; w < $; ) + U[w] === R ? (U.splice(w, 1), --$) : ++w; + } + return u; + } + function Ur(U, R, u) { + var w = Ri(U, R); + w !== -1 && Ho(U, w), u == null ? U.push(R) : ia(U, u, R); + } + function So(U, R, u) { + le(u) ? u === 0 ? U.unshift(R) : U.splice(u, 0, R) : U.push(R); + } + function Cn(U, R, u) { + var w = U.indexOf(R); + w !== -1 && U.splice(w, 1), le(u) ? U.splice(u, 0, R) : U.push(R); + } + function Ki(U) { + return Array.isArray(U) ? U : [U]; + } + function ui(U, R) { + return Ri(U, R) !== -1; + } + function W(U) { + for (var R = U.length, u = new Array(R), w = 0; w < R; ++w) + u[w] = U[w]; + return u; + } + function Cr(U, R, u) { + u === void 0 && (u = U.length); + for (var w = new Array(u - R), $ = R; $ < u; ++$) + w[$ - R] = U[$]; + return w; + } + function ia(U, R, u) { + U.splice(R, 0, u); + } + function Ho(U, R) { + U.splice(R, 1); + } + function Ut(U, R, u) { + for (var w = 0, $ = U.length, G = !1; w < $; ) { + var K = w + $ >> 1, ne = R(u, U[K]); + ne < 0 ? $ = K : (ne === 0 && (G = !0), w = K + 1); + } + return { found: G, index: G ? w - 1 : w }; + } + function Ca(U, R) { + for (var u = U.length, w = 0; w < u; ++w) + if (R(U[w], w)) + return w; + return -1; + } + function xi(U, R) { + var u = Ca(U, R); + if (u !== -1) + return U[u]; + } + function _t(U) { + for (var R, u, w = U.length; w !== 0; ) + u = Math.floor(Math.random() * w), R = U[w -= 1], U[w] = U[u], U[u] = R; + } + function Fr(U, R) { + for (var u = U.length, w = 0; w < u; ) + R(U[w]) ? ++w : (U.splice(w, 1), --u); + } + var ln = function() { + function U(R) { + this._disposed = !1, this._dispose = R; + } + return U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + this._disposed || (this._disposed = !0, this._dispose()); + }, U; + }(), kn = function(U) { + function R(u) { + return U.call(this, function() { + _i(u, function(w) { + w.dispose(); + }); + }) || this; + } + return re(R, U), R; + }(ln), Un = function(U) { + function R() { + var u = U.call(this, function() { + Ee(u._disposer) && (u._disposer.dispose(), u._disposer = void 0); + }) || this; + return u; + } + return re(R, U), R.prototype.get = function() { + return this._value; + }, R.prototype.set = function(u, w) { + Ee(this._disposer) && this._disposer.dispose(), this._disposer = w, this._value = u; + }, R.prototype.reset = function() { + this.set(void 0, void 0); + }, R; + }(ln), Cs = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u._counter = 0, u; + } + return re(R, U), R.prototype.increment = function() { + var u = this; + return ++this._counter, new ln(function() { + --u._counter, u._counter === 0 && u.dispose(); + }); + }, R; + }(ln), ra = !1, yn = [], Io = [], oh = [], gh = [], vc = typeof requestAnimationFrame == "function" ? function(U) { + requestAnimationFrame(U); + } : function(U) { + setTimeout(U, 16.666666666666668); + }; + function qu() { + for (var U = Date.now(), R = yn.length, u = 0; u < R; ++u) + yn[u](U); + for (no(yn, R), u = 0; u < Io.length; ++u) + Io[u](U); + for (Io.length = 0, u = 0; u < oh.length; ++u) + oh[u](U); + oh.length = 0, yn.length === 0 && Io.length === 0 ? ra = !1 : vc(qu); + } + function ss() { + ra || (ra = !0, vc(qu)); + } + function dd(U) { + yn.push(U), ss(); + } + function Vd(U) { + Io.push(U), ss(); + } + function pd(U) { + oh.push(U), ss(); + } + function cs(U) { + gh.push(U); + } + function Nl() { + for (var U = Date.now(), R = gh.length, u = 0; u < R; ++u) + gh.shift()(U); + } + var ii = function() { + function U() { + this._listeners = [], this._killed = [], this._disabled = {}, this._iterating = 0, this._enabled = !0, this._disposed = !1; + } + return U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + if (!this._disposed) { + this._disposed = !0; + var R = this._listeners; + this._iterating = 1, this._listeners = null, this._disabled = null; + try { + _i(R, function(u) { + u.disposer.dispose(); + }); + } finally { + this._killed = null, this._iterating = null; + } + } + }, U.prototype.hasListeners = function() { + return this._listeners.length !== 0; + }, U.prototype.hasListenersByType = function(R) { + return Yi(this._listeners, function(u) { + return (u.type === null || u.type === R) && !u.killed; + }); + }, U.prototype.enable = function() { + this._enabled = !0; + }, U.prototype.disable = function() { + this._enabled = !1; + }, U.prototype.enableType = function(R) { + delete this._disabled[R]; + }, U.prototype.disableType = function(R, u) { + u === void 0 && (u = 1 / 0), this._disabled[R] = u; + }, U.prototype._removeListener = function(R) { + if (this._iterating === 0) { + var u = this._listeners.indexOf(R); + if (u === -1) + throw new Error("Invalid state: could not remove listener"); + this._listeners.splice(u, 1); + } else + this._killed.push(R); + }, U.prototype._removeExistingListener = function(R, u, w, $) { + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + this._eachListener(function(G) { + G.once !== R || G.type !== u || w != null && G.callback !== w || G.context !== $ || G.disposer.dispose(); + }); + }, U.prototype.isEnabled = function(R) { + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + return this._enabled && this._listeners.length > 0 && this.hasListenersByType(R) && this._disabled[R] == null; + }, U.prototype.has = function(R, u, w) { + return Ca(this._listeners, function($) { + return $.once !== !0 && $.type === R && (u == null || $.callback === u) && $.context === w; + }) !== -1; + }, U.prototype._shouldDispatch = function(R) { + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + var u = this._disabled[R]; + return le(u) ? (u <= 1 ? delete this._disabled[R] : --this._disabled[R], !1) : this._enabled; + }, U.prototype._eachListener = function(R) { + var u = this; + ++this._iterating; + try { + _i(this._listeners, R); + } finally { + --this._iterating, this._iterating === 0 && this._killed.length !== 0 && (_i(this._killed, function(w) { + u._removeListener(w); + }), this._killed.length = 0); + } + }, U.prototype.dispatchImmediately = function(R, u) { + this._shouldDispatch(R) && this._eachListener(function(w) { + w.killed || w.type !== null && w.type !== R || w.dispatch(R, u); + }); + }, U.prototype.dispatch = function(R, u) { + this._shouldDispatch(R) && this._eachListener(function(w) { + w.killed || w.type !== null && w.type !== R || cs(function() { + w.killed || w.dispatch(R, u); + }); + }); + }, U.prototype._on = function(R, u, w, $, G, K) { + var ne = this; + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + this._removeExistingListener(R, u, w, $); + var ue = { type: u, callback: w, context: $, shouldClone: G, dispatch: K, killed: !1, once: R, disposer: new ln(function() { + ue.killed = !0, ne._removeListener(ue); + }) }; + return this._listeners.push(ue), ue; + }, U.prototype.onAll = function(R, u, w) { + return w === void 0 && (w = !0), this._on(!1, null, R, u, w, function($, G) { + return R.call(u, $, G); + }).disposer; + }, U.prototype.on = function(R, u, w, $) { + return $ === void 0 && ($ = !0), this._on(!1, R, u, w, $, function(G, K) { + return u.call(w, K); + }).disposer; + }, U.prototype.once = function(R, u, w, $) { + $ === void 0 && ($ = !0); + var G = this._on(!0, R, u, w, $, function(K, ne) { + G.disposer.dispose(), u.call(w, ne); + }); + return G.disposer; + }, U.prototype.off = function(R, u, w) { + this._removeExistingListener(!1, R, u, w); + }, U.prototype.copyFrom = function(R) { + var u = this; + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + if (R === this) + throw new Error("Cannot copyFrom the same TargetedEventDispatcher"); + _i(R._listeners, function(w) { + !w.killed && w.shouldClone && (w.type === null ? u.onAll(w.callback, w.context) : w.once ? u.once(w.type, w.callback, w.context) : u.on(w.type, w.callback, w.context)); + }); + }, U; + }(), bt = function(U) { + function R(u) { + var w = U.call(this) || this; + return w.target = u, w; + } + return re(R, U), R.prototype.copyFrom = function(u) { + var w = this; + if (this._disposed) + throw new Error("EventDispatcher is disposed"); + if (u === this) + throw new Error("Cannot copyFrom the same TargetedEventDispatcher"); + _i(u._listeners, function($) { + $.context !== u.target && !$.killed && $.shouldClone && ($.type === null ? w.onAll($.callback, $.context) : $.once ? w.once($.type, $.callback, $.context) : w.on($.type, $.callback, $.context)); + }); + }, R; + }(ii); + function Kt(U) { + return function(R) { + for (var u in U) + if (Tr(U, u) && !R([u, U[u]])) + break; + }; + } + function Pi(U) { + var R = []; + for (var u in U) + Tr(U, u) && R.push(u); + return R; + } + function Sr(U, R) { + return Pi(U).sort(R); + } + function Tr(U, R) { + return {}.hasOwnProperty.call(U, R); + } + function ri(U, R) { + return U[R]; + } + function pi(U, R) { + for (var u in U) + if (Tr(U, u) && !R(u, U[u])) + break; + } + function mi(U, R) { + pi(U, function(u, w) { + return R(u, w), !0; + }); + } + function hr(U, R, u) { + _i(Sr(U, u), function(w) { + R(w, U[w]); + }); + } + function Lr(U) { + return Object.assign({}, U); + } + function wr(U, R) { + return Object.assign({}, U, R); + } + function Nr(U) { + return JSON.parse(JSON.stringify(U)); + } + function _r(U, R, u) { + _i(u, function(w) { + Ee(U[w]) && (R[w] = U[w]); + }); + } + function Tn(U, R, u) { + _i(u, function(w) { + Ee(U[w]) && !Ee(R[w]) && (R[w] = U[w]); + }); + } + function os(U, R, u) { + _i(u, function(w) { + R[w] = U[w]; + }); + } + function fs(U, R) { + _r(U, R, Pi(U)); + } + function di(U) { + return function(R) { + for (var u = U.length, w = 0; w < u && R(U[w]); ++w) + ; + }; + } + function nr(U) { + var R = 0; + return U(function(u) { + return ++R, !0; + }), R; + } + function fr(U) { + var R = []; + return U(function(u) { + return R.push(u), !0; + }), R; + } + function Zr(U, R) { + U(R); + } + function er(U, R) { + U(function(u) { + return R(u), !0; + }); + } + function ys(U, R) { + return di(fr(U).sort(R)); + } + function Da(U, R) { + return function(u) { + return U(function(w) { + return u(R(w)); + }); + }; + } + function Ta(U, R) { + return function(u) { + return U(function(w) { + return !R(w) || u(w); + }); + }; + } + function Ds() { + for (var U = [], R = 0; R < arguments.length; R++) + U[R] = arguments[R]; + return function(u) { + for (var w = !0, $ = function(ne) { + return w = u(ne); + }, G = U.length, K = 0; K < G && (U[K]($), w); ++K) + ; + }; + } + function fu(U) { + return function(R) { + var u = !0, w = function($) { + return u = R($); + }; + U(function($) { + return $(w), u; + }); + }; + } + function mu(U) { + return function(R) { + var u = 0; + U(function(w) { + return R([u++, w]); + }); + }; + } + function Rc(U, R) { + var u = !1, w = 0; + return U(function($) { + return R($) ? (u = !0, !1) : (++w, !0); + }), u ? w : -1; + } + function Mc(U, R) { + var u; + return U(function(w) { + return !R(w) || (u = w, !1); + }), u; + } + function Tl(U, R) { + var u; + return U(function(w) { + var $ = R(w); + return $ === null || (u = $, !1); + }), u; + } + function ah(U, R) { + var u = !1; + return U(function(w) { + return !R(w) || (u = !0, !1); + }), u; + } + function jh(U, R, u) { + return U(function(w) { + return R = u(R, w), !0; + }), R; + } + function Rp(U, R) { + return U == null || R < U ? R : U; + } + function kl(U) { + return jh(U, null, Rp); + } + function lh(U, R) { + return U == null || R > U ? R : U; + } + function Gh(U) { + return jh(U, null, lh); + } + function ou(U, R) { + R === void 0 && (R = ""); + var u = !0, w = ""; + return U(function($) { + return u ? u = !1 : w += R, w += $, !0; + }), w; + } + var Mp = function() { + function U(R, u) { + this.createNewItems = !1, this.list = R, this._create = u, this.reset(); + } + return U.prototype.reset = function() { + this._listCopy = fr(this.list.iterator()); + }, U.prototype.clear = function() { + this._listCopy.length = 0; + }, U.prototype.getFirst = function() { + return this.returnItem(0); + }, U.prototype.getLast = function() { + return this.returnItem(this._listCopy.length - 1); + }, U.prototype.find = function(R) { + var u = Ca(this._listCopy, R); + if (u !== -1) { + var w = this._listCopy[u]; + return ki(this._listCopy, w), w; + } + return this.getLast(); + }, U.prototype.removeItem = function(R) { + return ki(this._listCopy, R); + }, U.prototype.returnItem = function(R) { + if (R >= 0 && R < this._listCopy.length) { + var u = this._listCopy[R]; + return ki(this._listCopy, u), u; + } + if (this.createNewItems) + return this._create(); + }, U.prototype.iterator = function() { + return di(this._listCopy); + }, U; + }(); + function yh(U, R) { + return U === R ? 0 : U < R ? -1 : 1; + } + function ag(U, R) { + return new Array(R + 1).join(U); + } + function lg(U) { + for (var R = "", u = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", w = 0; w < U; w++) + R += u.charAt(Math.floor(Math.random() * u.length)); + return R; + } + var jd = function(U) { + function R(u) { + var w = u.events.on("removed", function($) { + $.oldValue.dispose(); + }, void 0, !1); + return U.call(this, function() { + w.dispose(), er(u.iterator(), function($) { + $[1].dispose(); + }); + }) || this; + } + return re(R, U), R; + }(ln), ha = function() { + function U() { + this.events = new ii(), this._dictionary = {}; + } + return U.prototype.hasKey = function(R) { + return Tr(this._dictionary, R); + }, U.prototype.getKey = function(R) { + return this._dictionary[R]; + }, U.prototype.insertKey = function(R, u) { + if (Tr(this._dictionary, R)) + throw new Error("Key " + R + " already exists in dictionary"); + this._dictionary[R] = u, this.events.isEnabled("insertKey") && this.events.dispatchImmediately("insertKey", { type: "insertKey", target: this, key: R, newValue: u }); + }, U.prototype.setKey = function(R, u) { + if (Tr(this._dictionary, R)) { + var w = this._dictionary[R]; + w !== u && (this._dictionary[R] = u, this.events.isEnabled("setKey") && this.events.dispatchImmediately("setKey", { type: "setKey", target: this, key: R, oldValue: w, newValue: u }), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, oldValue: w })); + } else + this._dictionary[R] = u, this.events.isEnabled("insertKey") && this.events.dispatchImmediately("insertKey", { type: "insertKey", target: this, key: R, newValue: u }); + }, U.prototype.updateKey = function(R, u) { + if (!Tr(this._dictionary, R)) + throw new Error("Key " + R + " doesn't exist in dictionary"); + var w = this._dictionary[R], $ = u(w); + w !== $ && (this._dictionary[R] = $, this.events.isEnabled("setKey") && this.events.dispatchImmediately("setKey", { type: "setKey", target: this, key: R, oldValue: w, newValue: $ }), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, oldValue: w })); + }, U.prototype.removeKey = function(R) { + if (Tr(this._dictionary, R)) { + var u = this._dictionary[R]; + delete this._dictionary[R], this.events.isEnabled("removeKey") && this.events.dispatchImmediately("removeKey", { type: "removeKey", target: this, key: R, oldValue: u }), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, oldValue: u }); + } + }, U.prototype.insertKeyIfEmpty = function(R, u) { + return this.hasKey(R) || this.insertKey(R, u()), this.getKey(R); + }, U.prototype.clear = function() { + var R = this; + this.events.isEnabled("removed") && mi(this._dictionary, function(u, w) { + R.events.dispatchImmediately("removed", { type: "removed", target: R, oldValue: w }); + }), this._dictionary = {}, this.events.isEnabled("cleared") && this.events.dispatchImmediately("cleared", { type: "cleared", target: this }); + }, U.prototype.copyFrom = function(R) { + var u = this; + er(R.iterator(), function(w) { + u.setKey(w[0], w[1]); + }); + }, U.prototype.iterator = function() { + return Kt(this._dictionary); + }, U.prototype[Symbol.iterator] = function() { + var R, u, w, $; + return be(this, function(G) { + switch (G.label) { + case 0: + for (u in R = [], this._dictionary) + R.push(u); + w = 0, G.label = 1; + case 1: + return w < R.length ? ($ = R[w], Tr(this._dictionary, $) ? [4, [$, this._dictionary[$]]] : [3, 3]) : [3, 4]; + case 2: + G.sent(), G.label = 3; + case 3: + return w++, [3, 1]; + case 4: + return [2]; + } + }); + }, U.prototype.each = function(R) { + er(this.iterator(), function(u) { + var w = Me(u, 2), $ = w[0], G = w[1]; + return R($, G); + }); + }, U.prototype.sortedIterator = function() { + return ys(this.iterator(), function(R, u) { + return yh(R[0], u[0]); + }); + }, U; + }(), Nf = function(U) { + function R(u) { + var w = U.call(this) || this; + return w.template = u, w; + } + return re(R, U), Object.defineProperty(R.prototype, "template", { get: function() { + return this._template; + }, set: function(u) { + u.isTemplate = !0, this._template = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + er(u.iterator(), function($) { + w.setKey($[0], $[1].clone()); + }); + }, R.prototype.create = function(u) { + var w = this; + return this.insertKeyIfEmpty(u, function() { + return w.template.clone(); + }); + }, R; + }(ha), al = function() { + function U() { + this._storage = new ha(), this.ttl = 1e3; + } + return U.prototype.set = function(R, u, w, $) { + var G = this._storage.insertKeyIfEmpty(R, function() { + return new ha(); + }), K = { touched: (/* @__PURE__ */ new Date()).getTime(), ttl: le($) ? $ : this.ttl, value: w }; + G.setKey(u, K); + }, U.prototype.get = function(R, u, w) { + if (w === void 0 && (w = void 0), this._storage.hasKey(R)) { + var $ = this._storage.getKey(R); + if ($.hasKey(u)) { + var G = $.getKey(u); + return G.ttl && G.touched + G.ttl < (/* @__PURE__ */ new Date()).getTime() && (G.expired = !0), G.expired ? ($.removeKey(u), w) : G.value; + } + return w; + } + return w; + }, U.prototype.clear = function(R) { + R ? this._storage.removeKey(R) : this._storage.clear(); + }, U; + }(), Dp = new al(), uh = function() { + function U() { + var R = this; + this.events = new ii(), this.themes = [], this.loadedThemes = {}, this._uidCount = 0, this.registeredClasses = {}, this._placeholders = {}, this.invalidSprites = {}, this.invalidDatas = {}, this.invalidRawDatas = [], this.invalidDataItems = [], this.invalidDataRange = [], this.invalidPositions = {}, this.invalidLayouts = {}, this.baseSprites = [], this.baseSpritesByUid = {}, this.queue = [], this.deferred = [], this.uid = this.getUniqueId(), this.invalidSprites.noBase = [], this.invalidDatas.noBase = [], this.invalidLayouts.noBase = [], this.invalidPositions.noBase = [], typeof addEventListener < "u" && (addEventListener("beforeprint", function() { + _i(R.baseSprites, function(u) { + var w = u.paper.svg; + w.setAttribute("viewBox", "0 0 " + w.clientWidth + " " + w.clientHeight); + }); + }), addEventListener("afterprint", function() { + _i(R.baseSprites, function(u) { + u.paper.svg.removeAttribute("viewBox"); + }); + })); + } + return U.prototype.getUniqueId = function() { + var R = this._uidCount; + return this._uidCount += 1, "id-" + R; + }, Object.defineProperty(U.prototype, "map", { get: function() { + return this._map || (this._map = new ha()), this._map; + }, enumerable: !0, configurable: !0 }), U.prototype.setCache = function(R, u, w) { + Dp.set(this.uid, R, u, w); + }, U.prototype.getCache = function(R, u) { + return u === void 0 && (u = void 0), Dp.get(this.uid, R, u); + }, U.prototype.dispatch = function(R, u) { + this.events.isEnabled(R) && (u ? (u.type = R, u.target = u.target || this, this.events.dispatch(R, { type: R, target: this })) : this.events.dispatch(R, { type: R, target: this })); + }, U.prototype.dispatchImmediately = function(R, u) { + this.events.isEnabled(R) && (u ? (u.type = R, u.target = u.target || this, this.events.dispatchImmediately(R, u)) : this.events.dispatchImmediately(R, { type: R, target: this })); + }, U.prototype.getPlaceholder = function(R) { + return Ee(this._placeholders[R]) || (this._placeholders[R] = "__amcharts_" + R + "_" + lg(8) + "__"), this._placeholders[R]; + }, U.prototype.addToInvalidComponents = function(R) { + R.baseId ? Ur(this.invalidDatas[R.baseId], R) : Ur(this.invalidDatas.noBase, R); + }, U.prototype.removeFromInvalidComponents = function(R) { + R.baseId && ki(this.invalidDatas[R.baseId], R), ki(this.invalidDatas.noBase, R); + }, U.prototype.addToInvalidSprites = function(R) { + R.baseId ? So(this.invalidSprites[R.baseId], R) : So(this.invalidSprites.noBase, R); + }, U.prototype.removeFromInvalidSprites = function(R) { + R.baseId && ki(this.invalidSprites[R.baseId], R), ki(this.invalidSprites.noBase, R); + }, U.prototype.addToInvalidPositions = function(R) { + R.baseId ? So(this.invalidPositions[R.baseId], R) : So(this.invalidPositions.noBase, R); + }, U.prototype.removeFromInvalidPositions = function(R) { + R.baseId && ki(this.invalidPositions[R.baseId], R), ki(this.invalidPositions.noBase, R); + }, U.prototype.addToInvalidLayouts = function(R) { + R.baseId ? So(this.invalidLayouts[R.baseId], R) : So(this.invalidLayouts.noBase, R); + }, U.prototype.removeFromInvalidLayouts = function(R) { + R.baseId && ki(this.invalidLayouts[R.baseId], R), ki(this.invalidLayouts.noBase, R); + }, U; + }(), hi = new uh(); + function ll(U, R) { + var u = hi.registeredClasses[R]; + return u != null && U instanceof u; + } + var Fp = function() { + function U(R, u, w) { + this._array = R, this._start = u, this._end = w; + } + return U.prototype.iterator = function() { + var R = this; + return function(u) { + if (R._start !== R._end) + if (R._start < R._end) + for (var w = R._start; w < R._end && u(R._array[w]); ++w) + ; + else + for (w = R._start - 1; w >= R._end && u(R._array[w]); --w) + ; + }; + }, U.prototype.backwards = function() { + return new U(this._array, this._end, this._start); + }, U.prototype.range = function(R, u) { + if (R <= u) { + if (this._start === this._end) + return this; + if (this._start < this._end) { + var w = u - R; + return R = Math.max(this._start + R, this._start), u = Math.min(R + w, this._end), new U(this._array, R, u); + } + return w = u - R, R = Math.max(this._start - R, this._end), u = Math.max(R - w, this._end), new U(this._array, R, u); + } + throw new Error("Start index must be lower than end index"); + }, U; + }(), ug = function(U) { + function R(u, w, $) { + var G = U.call(this, [u.events.on("inserted", function(K) { + var ne = K.newValue, ue = G._getKey(ne), we = 0; + Zr(u.iterator(), function(De) { + return De !== ne && (G._getKey(De) === ue && ++we, !0); + }), G._insert(ne, ue, we); + }, void 0, !1), u.events.on("removed", function(K) { + G._remove(K.oldValue); + }, void 0, !1)]) || this; + return G._keys = [], G._groups = {}, G._getKey = w, G._sort = $, er(u.iterator(), function(K) { + G._insert(K, w(K)); + }), G; + } + return re(R, U), R.prototype._insert = function(u, w, $) { + if (this._groups[w] == null) { + this._groups[w] = []; + var G = Ut(this._keys, this._sort, w), K = G.found, ne = G.index; + if (K) + throw new Error("Key already exists: " + w); + ia(this._keys, ne, w); + } + $ == null ? this._groups[w].push(u) : ia(this._groups[w], $, u); + }, R.prototype._remove = function(u) { + var w = this._getKey(u), $ = this._groups[w]; + if ($ != null && (ki($, u), $.length === 0)) { + delete this._groups[w]; + var G = Ut(this._keys, this._sort, w), K = G.found, ne = G.index; + if (!K) + throw new Error("Key doesn't exist: " + w); + Ho(this._keys, ne); + } + }, R.prototype.iterator = function() { + var u = this; + return fu(Da(di(this._keys), function(w) { + return di(u._groups[w]); + })); + }, R; + }(kn), Wo = function(U) { + function R(u, w) { + w === void 0 && (w = !0); + var $ = this; + if (w) { + var G = u.events.on("removed", function(K) { + K.oldValue.dispose(); + }, void 0, !1); + $ = U.call(this, function() { + G.dispose(), er(u.iterator(), function(K) { + K.dispose(); + }); + }) || this; + } else + $ = U.call(this, function() { + er(u.iterator(), function(K) { + K.dispose(); + }); + }) || this; + return $; + } + return re(R, U), R; + }(ln); + function lp(U, R) { + if (!(U >= 0 && U < R)) + throw new Error("Index out of bounds: " + U); + } + var Hs = function() { + function U(R) { + R === void 0 && (R = []), this.events = new ii(), this._values = R; + } + return Object.defineProperty(U.prototype, "values", { get: function() { + return this._values; + }, enumerable: !0, configurable: !0 }), U.prototype.contains = function(R) { + return this._values.indexOf(R) !== -1; + }, U.prototype.removeValue = function(R) { + for (var u = 0, w = this._values.length; u < w; ) + this._values[u] === R ? (this.removeIndex(u), --w) : ++u; + }, U.prototype.indexOf = function(R) { + return Ri(this._values, R); + }, Object.defineProperty(U.prototype, "length", { get: function() { + return this._values.length; + }, enumerable: !0, configurable: !0 }), U.prototype.hasIndex = function(R) { + return R >= 0 && R < this._values.length; + }, U.prototype.getIndex = function(R) { + return this._values[R]; + }, U.prototype.setIndex = function(R, u) { + lp(R, this._values.length); + var w = this._values[R]; + return w !== u && (this._values[R] = u, this.events.isEnabled("setIndex") && this.events.dispatchImmediately("setIndex", { type: "setIndex", target: this, index: R, oldValue: w, newValue: u }), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, oldValue: w }), this.events.isEnabled("inserted") && this.events.dispatchImmediately("inserted", { type: "inserted", target: this, newValue: u })), w; + }, U.prototype.insertIndex = function(R, u) { + lp(R, this._values.length + 1), ia(this._values, R, u), this.events.isEnabled("insertIndex") && this.events.dispatchImmediately("insertIndex", { type: "insertIndex", target: this, index: R, newValue: u }), this.events.isEnabled("inserted") && this.events.dispatchImmediately("inserted", { type: "inserted", target: this, newValue: u }); + }, U.prototype._sortQuicksort = function(R, u, w) { + if (R < u) { + var $ = this._sortPartition(R, u, w); + this._sortQuicksort(R, $, w), this._sortQuicksort($ + 1, u, w); + } + }, U.prototype._sortPartition = function(R, u, w) { + for (var $ = this._values, G = $[R], K = R - 1, ne = u + 1; ; ) { + do + ++K; + while (w($[K], G) < 0); + do + --ne; + while (w($[ne], G) > 0); + if (K >= ne) + return ne; + this.swap(K, ne); + } + }, U.prototype.sort = function(R) { + this._sortQuicksort(0, this._values.length - 1, R); + }, U.prototype.swap = function(R, u) { + var w = this._values.length; + if (lp(R, w), lp(u, w), R !== u) { + var $ = this._values[R], G = this._values[u]; + this._values[R] = G, this.events.isEnabled("setIndex") && this.events.dispatchImmediately("setIndex", { type: "setIndex", target: this, index: R, oldValue: $, newValue: G }), this._values[u] = $, this.events.isEnabled("setIndex") && this.events.dispatchImmediately("setIndex", { type: "setIndex", target: this, index: u, oldValue: G, newValue: $ }); + } + }, U.prototype.removeIndex = function(R) { + lp(R, this._values.length); + var u = this._values[R]; + return Ho(this._values, R), this.events.isEnabled("removeIndex") && this.events.dispatchImmediately("removeIndex", { type: "removeIndex", target: this, index: R, oldValue: u }), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, oldValue: u }), u; + }, U.prototype.moveValue = function(R, u) { + var w = this.indexOf(R); + if (w !== -1) { + var $ = this._values[w]; + Ho(this._values, w), this.events.isEnabled("removeIndex") && this.events.dispatchImmediately("removeIndex", { type: "removeIndex", target: this, index: w, oldValue: $ }); + } + u == null ? (u = this._values.length, this._values.push(R)) : ia(this._values, u, R), this.events.isEnabled("insertIndex") && this.events.dispatchImmediately("insertIndex", { type: "insertIndex", target: this, index: u, newValue: R }), w === -1 && this.events.isEnabled("inserted") && this.events.dispatchImmediately("inserted", { type: "inserted", target: this, newValue: R }); + }, U.prototype.push = function(R) { + var u = this._values.push(R) - 1; + return this.events.isEnabled("insertIndex") && this.events.dispatchImmediately("insertIndex", { type: "insertIndex", target: this, index: u, newValue: R }), this.events.isEnabled("inserted") && this.events.dispatchImmediately("inserted", { type: "inserted", target: this, newValue: R }), R; + }, U.prototype.unshift = function(R) { + this.insertIndex(0, R); + }, U.prototype.pushAll = function(R) { + var u = this; + _i(R, function(w) { + u.push(w); + }); + }, U.prototype.copyFrom = function(R) { + this.pushAll(R._values); + }, U.prototype.pop = function() { + return this._values.length - 1 < 0 ? void 0 : this.removeIndex(this._values.length - 1); + }, U.prototype.shift = function() { + return this._values.length ? this.removeIndex(0) : void 0; + }, U.prototype.setAll = function(R) { + var u = this, w = W(this._values); + this._values.length = 0, _i(R, function($) { + u._values.push($); + }), this.events.isEnabled("setAll") && this.events.dispatchImmediately("setAll", { type: "setAll", target: this, oldArray: w, newArray: this._values }), this.events.isEnabled("removed") && _i(w, function($) { + u.events.dispatchImmediately("removed", { type: "removed", target: u, oldValue: $ }); + }), this.events.isEnabled("inserted") && _i(this._values, function($) { + u.events.dispatchImmediately("inserted", { type: "inserted", target: u, newValue: $ }); + }); + }, U.prototype.clear = function() { + this.setAll([]); + }, U.prototype.iterator = function() { + return di(this._values); + }, U.prototype[Symbol.iterator] = function() { + var R, u; + return be(this, function(w) { + switch (w.label) { + case 0: + R = this._values.length, u = 0, w.label = 1; + case 1: + return u < R ? [4, this._values[u]] : [3, 4]; + case 2: + w.sent(), w.label = 3; + case 3: + return ++u, [3, 1]; + case 4: + return [2]; + } + }); + }, U.prototype.each = function(R) { + _i(this._values, R); + }, U.prototype.range = function(R, u) { + if (R <= u) { + var w = u - R; + return R = Math.max(R, 0), u = Math.min(R + w, this._values.length), new Fp(this._values, R, u); + } + throw new Error("Start index must be lower than end index"); + }, U.prototype.backwards = function() { + return new Fp(this._values, this._values.length, 0); + }, U; + }(), Xs = function(U) { + function R(u) { + var w = U.call(this) || this; + return w.template = u, w; + } + return re(R, U), Object.defineProperty(R.prototype, "template", { get: function() { + return this._template; + }, set: function(u) { + u.isTemplate = !0, this._template = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + er(u.iterator(), function($) { + w.push($.clone()); + }); + }, R.prototype.create = function(u) { + var w = u != null ? new u() : this.template.clone(); + return this.push(w), w; + }, R.prototype.clone = function() { + for (var u = new R(this.template), w = this.values, $ = w.length, G = 0; G < $; ++G) + u.push(w[G].clone()); + return u; + }, R; + }(Hs), ql = function() { + function U(R) { + this._values = [], this.events = new ii(), R != null && this.setAll(R); + } + return Object.defineProperty(U.prototype, "values", { get: function() { + return this._values; + }, enumerable: !0, configurable: !0 }), U.prototype._insert = function(R) { + return this._values.push(R), this._values.length - 1; + }, Object.defineProperty(U.prototype, "length", { get: function() { + return this._values.length; + }, enumerable: !0, configurable: !0 }), U.prototype.indexOf = function(R) { + return Ri(this._values, R); + }, U.prototype.contains = function(R) { + return this.indexOf(R) !== -1; + }, U.prototype.getIndex = function(R) { + return this._values[R]; + }, Object.defineProperty(U.prototype, "first", { get: function() { + return this._values[0]; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "last", { get: function() { + return this._values[this._values.length - 1]; + }, enumerable: !0, configurable: !0 }), U.prototype.insert = function(R) { + var u = this._insert(R); + this.events.isEnabled("inserted") && this.events.dispatchImmediately("inserted", { type: "inserted", target: this, index: u, newValue: R }); + }, U.prototype.remove = function(R) { + var u = this.indexOf(R); + if (u !== -1) { + var w = this._values[u]; + Ho(this._values, u), this.events.isEnabled("removed") && this.events.dispatchImmediately("removed", { type: "removed", target: this, index: u, oldValue: w }); + } + }, U.prototype.setAll = function(R) { + var u = this; + fn(this._values, function(w, $) { + u._values.pop(), u.events.isEnabled("removed") && u.events.dispatchImmediately("removed", { type: "removed", target: u, index: $, oldValue: w }); + }), _i(R, function(w) { + u.insert(w); + }); + }, U.prototype.clear = function() { + this.setAll([]); + }, U.prototype.slice = function(R, u) { + var w = new U(); + return w._values = this._values.slice(R, u), w; + }, U.prototype.findClosestIndex = function(R, u, w) { + w === void 0 && (w = "any"); + var $, G, K = -1, ne = 0; + return Zr(this.iterator(), function(ue) { + var we = u(ue); + if (w === "any") { + if (we === R) + return K = ne, !1; + var De = Math.abs(R - we); + (!Ee(G) || G > De) && (K = ne, $ = we, G = De); + } else + w === "left" && we < R ? (!Ee($) || $ < we) && (K = ne, $ = we) : w === "right" && we >= R && (!Ee($) || $ >= we) && (K = ne, $ = we); + return ++ne, !0; + }), K === -1 && (w === "left" ? K = 0 : w === "right" && (K = this.length - 1)), K; + }, U.prototype.iterator = function() { + return di(this._values); + }, U.prototype[Symbol.iterator] = function() { + var R, u; + return be(this, function(w) { + switch (w.label) { + case 0: + R = this._values.length, u = 0, w.label = 1; + case 1: + return u < R ? [4, this._values[u]] : [3, 4]; + case 2: + w.sent(), w.label = 3; + case 3: + return ++u, [3, 1]; + case 4: + return [2]; + } + }); + }, U.prototype.each = function(R) { + _i(this._values, R); + }, U; + }(), Su = function(U) { + function R(u) { + var w = U.call(this) || this; + return w._ordering = u, w; + } + return re(R, U), R.prototype._insert = function(u) { + var w = Ut(this._values, this._ordering, u).index; + return ia(this._values, w, u), w; + }, R.prototype.indexOf = function(u) { + var w = Ut(this._values, this._ordering, u), $ = w.found, G = w.index; + return $ ? G : -1; + }, R.prototype.update = function(u) { + var w = Ri(this._values, u); + if (w !== -1) { + var $ = this._values.length - 1; + (w === 0 || this._ordering(this._values[w - 1], u) < 0) && (w === $ || this._ordering(u, this._values[w + 1]) < 0) || (Ho(this._values, w), this._insert(u)); + } + }, R; + }(ql), Im = function(U) { + function R(u) { + var w = U.call(this) || this; + return w.template = u, w; + } + return re(R, U), Object.defineProperty(R.prototype, "template", { get: function() { + return this._template; + }, set: function(u) { + u.isTemplate = !0, this._template = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + er(u.iterator(), function($) { + w.insert($.clone()); + }); + }, R.prototype.slice = function(u, w) { + var $ = new R(this.template); + return $._values = this._values.slice(u, w), $; + }, R.prototype.create = function(u) { + var w = u != null ? new u() : this.template.clone(); + return this.insert(w), w; + }, R; + }(ql), Vc = function(U) { + function R(u, w) { + var $ = U.call(this, w) || this; + return $.template = u, $; + } + return re(R, U), Object.defineProperty(R.prototype, "template", { get: function() { + return this._template; + }, set: function(u) { + u.isTemplate = !0, this._template = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + er(u.iterator(), function($) { + w.insert($.clone()); + }); + }, R.prototype.create = function(u) { + var w = u != null ? new u() : this.template.clone(); + return this.insert(w), w; + }, R; + }(Su); + function jc(U, R) { + return U === R ? 0 : U < R ? -1 : 1; + } + function gu(U) { + switch (U) { + case 0: + return 0; + case -1: + return 1; + case 1: + return -1; + } + } + function Yl(U, R) { + return U === 0 ? R : U; + } + var Ba = function() { + function U() { + this._callbackId = 0, this._callbacks = new Su(function(R, u) { + return Yl(jc(R.priority, u.priority), jc(R.id, u.id)); + }); + } + return U.prototype.addAll = function(R, u, w, $, G) { + $ === void 0 && ($ = 0), this._callbacks.insert({ id: ++this._callbackId, key: u, callback: w, priority: $, scope: G, type: R }); + }, U.prototype.isEnabled = function(R, u) { + return Yi(this._callbacks.values, function(w) { + return w.key === u && R instanceof w.type; + }); + }, U.prototype.applyAll = function(R, u, w) { + var $ = this._callbacks.values, G = $.length; + if (G == 0) + return w; + for (var K = 0; K < G; ++K) { + var ne = $[K]; + ne.key === u && R instanceof ne.type && (w = ne.callback.call(ne.scope, w, R, u)); + } + return w; + }, U; + }(), vh = new Ba(), Yu = function() { + function U(R) { + this._callbackId = 0, this._callbacks = new Su(function(u, w) { + return Yl(jc(u.priority, w.priority), jc(u.id, w.id)); + }), this._disabled = {}, this.object = R, this.events = this._callbacks.events; + } + return U.prototype.add = function(R, u, w, $) { + w === void 0 && (w = 0), this._callbacks.insert({ id: ++this._callbackId, key: R, callback: u, priority: w, scope: $ }); + }, U.prototype.has = function(R, u, w, $) { + return w === void 0 && (w = 0), ah(this._callbacks.iterator(), function(G) { + return G.key === R && G.callback === u && G.priority === w && G.scope === $; + }); + }, U.prototype.remove = function(R, u) { + var w = this; + _i(fr(this._callbacks.iterator()), function($) { + $.key !== R || le(u) && u !== $.priority || w._callbacks.remove($); + }); + }, U.prototype.enableKey = function(R) { + delete this._disabled[R]; + }, U.prototype.disableKey = function(R, u) { + u === void 0 && (u = 1 / 0), this._disabled[R] = u; + }, U.prototype._hasListenersByType = function(R) { + return Yi(this._callbacks.values, function(u) { + return u.key === R; + }); + }, U.prototype.isEnabled = function(R) { + return this._disabled[R] == null && (this._hasListenersByType(R) || vh.isEnabled(this.object, R)); + }, U.prototype._shouldDispatch = function(R) { + var u = this._disabled[R]; + return !le(u) || (u <= 1 ? delete this._disabled[R] : --this._disabled[R], !1); + }, U.prototype.apply = function(R, u) { + if (this._shouldDispatch(R)) { + var w = this._callbacks.values, $ = w.length; + if ($ > 0) + for (var G = 0; G < $; ++G) { + var K = w[G]; + K.key === R && (u = K.callback.call(K.scope, u, this.object, R)); + } + return vh.applyAll(this.object, R, u); + } + return u; + }, U.prototype.keys = function() { + return fr(Da(this._callbacks.iterator(), function(R) { + return R.key; + })); + }, U.prototype.copyFrom = function(R) { + var u = this; + er(R._callbacks.iterator(), function(w) { + u.add(w.key, w.callback, w.priority, w.scope); + }), mi(R._disabled, function(w, $) { + u._disabled[w] = $; + }); + }, U.prototype.clear = function() { + this._callbacks.clear(); + }, U; + }(), $l = { aliceblue: { r: 240, g: 248, b: 255 }, antiquewhite: { r: 250, g: 235, b: 215 }, aqua: { r: 0, g: 255, b: 255 }, aquamarine: { r: 127, g: 255, b: 212 }, azure: { r: 240, g: 255, b: 255 }, beige: { r: 245, g: 245, b: 220 }, bisque: { r: 255, g: 228, b: 196 }, black: { r: 0, g: 0, b: 0 }, blanchedalmond: { r: 255, g: 235, b: 205 }, blue: { r: 0, g: 0, b: 255 }, blueviolet: { r: 138, g: 43, b: 226 }, brown: { r: 165, g: 42, b: 42 }, burlywood: { r: 222, g: 184, b: 135 }, cadetblue: { r: 95, g: 158, b: 160 }, chartreuse: { r: 127, g: 255, b: 0 }, chocolate: { r: 210, g: 105, b: 30 }, coral: { r: 255, g: 127, b: 80 }, cornflowerblue: { r: 100, g: 149, b: 237 }, cornsilk: { r: 255, g: 248, b: 220 }, crimson: { r: 220, g: 20, b: 60 }, cyan: { r: 0, g: 255, b: 255 }, darkblue: { r: 0, g: 0, b: 139 }, darkcyan: { r: 0, g: 139, b: 139 }, darkgoldenrod: { r: 184, g: 134, b: 11 }, darkgray: { r: 169, g: 169, b: 169 }, darkgrey: { r: 169, g: 169, b: 169 }, darkgreen: { r: 0, g: 100, b: 0 }, darkkhaki: { r: 189, g: 183, b: 107 }, darkmagenta: { r: 139, g: 0, b: 139 }, darkolivegreen: { r: 85, g: 107, b: 47 }, darkorange: { r: 255, g: 140, b: 0 }, darkorchid: { r: 153, g: 50, b: 204 }, darkred: { r: 139, g: 0, b: 0 }, darksalmon: { r: 233, g: 150, b: 122 }, darkseagreen: { r: 143, g: 188, b: 143 }, darkslateblue: { r: 72, g: 61, b: 139 }, darkslategray: { r: 47, g: 79, b: 79 }, darkslategrey: { r: 47, g: 79, b: 79 }, darkturquoise: { r: 0, g: 206, b: 209 }, darkviolet: { r: 148, g: 0, b: 211 }, deeppink: { r: 255, g: 20, b: 147 }, deepskyblue: { r: 0, g: 191, b: 255 }, dimgray: { r: 105, g: 105, b: 105 }, dimgrey: { r: 105, g: 105, b: 105 }, dodgerblue: { r: 30, g: 144, b: 255 }, firebrick: { r: 178, g: 34, b: 34 }, floralwhite: { r: 255, g: 250, b: 240 }, forestgreen: { r: 34, g: 139, b: 34 }, fuchsia: { r: 255, g: 0, b: 255 }, gainsboro: { r: 220, g: 220, b: 220 }, ghostwhite: { r: 248, g: 248, b: 255 }, gold: { r: 255, g: 215, b: 0 }, goldenrod: { r: 218, g: 165, b: 32 }, gray: { r: 128, g: 128, b: 128 }, grey: { r: 128, g: 128, b: 128 }, green: { r: 0, g: 128, b: 0 }, greenyellow: { r: 173, g: 255, b: 47 }, honeydew: { r: 240, g: 255, b: 240 }, hotpink: { r: 255, g: 105, b: 180 }, indianred: { r: 205, g: 92, b: 92 }, indigo: { r: 75, g: 0, b: 130 }, ivory: { r: 255, g: 255, b: 240 }, khaki: { r: 240, g: 230, b: 140 }, lavender: { r: 230, g: 230, b: 250 }, lavenderblush: { r: 255, g: 240, b: 245 }, lawngreen: { r: 124, g: 252, b: 0 }, lemonchiffon: { r: 255, g: 250, b: 205 }, lightblue: { r: 173, g: 216, b: 230 }, lightcoral: { r: 240, g: 128, b: 128 }, lightcyan: { r: 224, g: 255, b: 255 }, lightgoldenrodyellow: { r: 250, g: 250, b: 210 }, lightgray: { r: 211, g: 211, b: 211 }, lightgrey: { r: 211, g: 211, b: 211 }, lightgreen: { r: 144, g: 238, b: 144 }, lightpink: { r: 255, g: 182, b: 193 }, lightsalmon: { r: 255, g: 160, b: 122 }, lightseagreen: { r: 32, g: 178, b: 170 }, lightskyblue: { r: 135, g: 206, b: 250 }, lightslategray: { r: 119, g: 136, b: 153 }, lightslategrey: { r: 119, g: 136, b: 153 }, lightsteelblue: { r: 176, g: 196, b: 222 }, lightyellow: { r: 255, g: 255, b: 224 }, lime: { r: 0, g: 255, b: 0 }, limegreen: { r: 50, g: 205, b: 50 }, linen: { r: 250, g: 240, b: 230 }, magenta: { r: 255, g: 0, b: 255 }, maroon: { r: 128, g: 0, b: 0 }, mediumaquamarine: { r: 102, g: 205, b: 170 }, mediumblue: { r: 0, g: 0, b: 205 }, mediumorchid: { r: 186, g: 85, b: 211 }, mediumpurple: { r: 147, g: 112, b: 219 }, mediumseagreen: { r: 60, g: 179, b: 113 }, mediumslateblue: { r: 123, g: 104, b: 238 }, mediumspringgreen: { r: 0, g: 250, b: 154 }, mediumturquoise: { r: 72, g: 209, b: 204 }, mediumvioletred: { r: 199, g: 21, b: 133 }, midnightblue: { r: 25, g: 25, b: 112 }, mintcream: { r: 245, g: 255, b: 250 }, mistyrose: { r: 255, g: 228, b: 225 }, moccasin: { r: 255, g: 228, b: 181 }, navajowhite: { r: 255, g: 222, b: 173 }, navy: { r: 0, g: 0, b: 128 }, oldlace: { r: 253, g: 245, b: 230 }, olive: { r: 128, g: 128, b: 0 }, olivedrab: { r: 107, g: 142, b: 35 }, orange: { r: 255, g: 165, b: 0 }, orangered: { r: 255, g: 69, b: 0 }, orchid: { r: 218, g: 112, b: 214 }, palegoldenrod: { r: 238, g: 232, b: 170 }, palegreen: { r: 152, g: 251, b: 152 }, paleturquoise: { r: 175, g: 238, b: 238 }, palevioletred: { r: 219, g: 112, b: 147 }, papayawhip: { r: 255, g: 239, b: 213 }, peachpuff: { r: 255, g: 218, b: 185 }, peru: { r: 205, g: 133, b: 63 }, pink: { r: 255, g: 192, b: 203 }, plum: { r: 221, g: 160, b: 221 }, powderblue: { r: 176, g: 224, b: 230 }, purple: { r: 128, g: 0, b: 128 }, rebeccapurple: { r: 102, g: 51, b: 153 }, red: { r: 255, g: 0, b: 0 }, rosybrown: { r: 188, g: 143, b: 143 }, royalblue: { r: 65, g: 105, b: 225 }, saddlebrown: { r: 139, g: 69, b: 19 }, salmon: { r: 250, g: 128, b: 114 }, sandybrown: { r: 244, g: 164, b: 96 }, seagreen: { r: 46, g: 139, b: 87 }, seashell: { r: 255, g: 245, b: 238 }, sienna: { r: 160, g: 82, b: 45 }, silver: { r: 192, g: 192, b: 192 }, skyblue: { r: 135, g: 206, b: 235 }, slateblue: { r: 106, g: 90, b: 205 }, slategray: { r: 112, g: 128, b: 144 }, slategrey: { r: 112, g: 128, b: 144 }, snow: { r: 255, g: 250, b: 250 }, springgreen: { r: 0, g: 255, b: 127 }, steelblue: { r: 70, g: 130, b: 180 }, tan: { r: 210, g: 180, b: 140 }, teal: { r: 0, g: 128, b: 128 }, thistle: { r: 216, g: 191, b: 216 }, tomato: { r: 255, g: 99, b: 71 }, turquoise: { r: 64, g: 224, b: 208 }, violet: { r: 238, g: 130, b: 238 }, wheat: { r: 245, g: 222, b: 179 }, white: { r: 255, g: 255, b: 255 }, whitesmoke: { r: 245, g: 245, b: 245 }, yellow: { r: 255, g: 255, b: 0 }, yellowgreen: { r: 154, g: 205, b: 50 } }; + function _c(U, R) { + var u; + return $l[U] ? u = $l[U] : U.charAt(0) === "#" ? u = Am(U) : U.match(/^rgba?\(/) && (u = df(U)), u || (u = { r: 0, g: 0, b: 0, a: 1 }), Ee(R) && (u.a = R), u; + } + function Am(U) { + U = U.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function(u, w, $, G) { + return w + w + $ + $ + G + G; + }); + var R = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(U); + return R ? { r: parseInt(R[1], 16), g: parseInt(R[2], 16), b: parseInt(R[3], 16) } : Gd(U); + } + function Gd(U) { + U = U.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i, function(u, w, $, G, K) { + return w + w + $ + $ + G + G + K + K; + }); + var R = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(U); + return R ? { r: parseInt(R[1], 16), g: parseInt(R[2], 16), b: parseInt(R[3], 16), a: parseInt(R[4], 16) / 256 } : void 0; + } + function df(U) { + var R = (U = U.replace(/[ ]/g, "")).match(/^rgb\(([0-9]*),([0-9]*),([0-9]*)\)/i); + if (R) + R.push("1"); + else if (!(R = U.match(/^rgba\(([0-9]*),([0-9]*),([0-9]*),([.0-9]*)\)/i))) + return; + return { r: parseInt(R[1]), g: parseInt(R[2]), b: parseInt(R[3]), a: parseFloat(R[4]) }; + } + function Ug(U) { + return "#" + zt(U.r.toString(16)) + zt(U.g.toString(16)) + zt(U.b.toString(16)); + } + function cg(U) { + return Ee(U.a) && U.a !== 1 ? "rgba(" + U.r + "," + U.g + "," + U.b + "," + U.a + ")" : "rgb(" + U.r + "," + U.g + "," + U.b + ")"; + } + function zt(U) { + return U.length == 1 ? "0" + U : "" + U; + } + function Wt(U, R, u) { + return u = mt(u, 0, 1), U ? R ? { r: U.r + Math.round((R.r - U.r) * u), g: U.g + Math.round((R.g - U.g) * u), b: U.b + Math.round((R.b - U.b) * u), a: (U.a || 1) + Math.round(((R.a || 1) - (U.a || 1)) * u) } : U : R || U; + } + function Ai(U, R) { + return U && { r: Math.max(0, Math.min(255, U.r + Ui(U.r, R))), g: Math.max(0, Math.min(255, U.g + Ui(U.g, R))), b: Math.max(0, Math.min(255, U.b + Ui(U.b, R))), a: U.a }; + } + function Ui(U, R) { + var u = R > 0 ? 255 - U : U; + return Math.round(u * R); + } + function ge(U, R) { + if (U) { + var u = Ui(Math.min(Math.max(U.r, U.g, U.b), 230), R); + return { r: Math.max(0, Math.min(255, Math.round(U.r + u))), g: Math.max(0, Math.min(255, Math.round(U.g + u))), b: Math.max(0, Math.min(255, Math.round(U.b + u))), a: U.a }; + } + return U; + } + function Le(U, R) { + return Math.round(255 * R); + } + function Ye(U, R) { + if (U == null || R == 1) + return U; + var u = oe(U); + return u.s = R, xt(u); + } + function xt(U) { + var R, u, w, $ = U.h, G = U.s, K = U.l; + if (G == 0) + R = u = w = K; + else { + var ne = function(De, $e, Ke) { + return Ke < 0 && (Ke += 1), Ke > 1 && (Ke -= 1), Ke < 0.16666666666666666 ? De + 6 * ($e - De) * Ke : Ke < 0.5 ? $e : Ke < 0.6666666666666666 ? De + ($e - De) * (0.6666666666666666 - Ke) * 6 : De; + }, ue = K < 0.5 ? K * (1 + G) : K + G - K * G, we = 2 * K - ue; + R = ne(we, ue, $ + 1 / 3), u = ne(we, ue, $), w = ne(we, ue, $ - 1 / 3); + } + return { r: Math.round(255 * R), g: Math.round(255 * u), b: Math.round(255 * w) }; + } + function oe(U) { + var R = U.r / 255, u = U.g / 255, w = U.b / 255, $ = Math.max(R, u, w), G = Math.min(R, u, w), K = 0, ne = 0, ue = ($ + G) / 2; + if ($ === G) + K = ne = 0; + else { + var we = $ - G; + switch (ne = ue > 0.5 ? we / (2 - $ - G) : we / ($ + G), $) { + case R: + K = (u - w) / we + (u < w ? 6 : 0); + break; + case u: + K = (w - R) / we + 2; + break; + case w: + K = (R - u) / we + 4; + } + K /= 6; + } + return { h: K, s: ne, l: ue }; + } + function ee(U) { + var R, u = U.r / 255, w = U.g / 255, $ = U.b / 255, G = Math.max(u, w, $), K = Math.min(u, w, $), ne = 0, ue = G, we = G - K; + if (R = G == 0 ? 0 : we / G, G == K) + ne = 0; + else { + switch (G) { + case u: + ne = (w - $) / we + (w < $ ? 6 : 0); + break; + case w: + ne = ($ - u) / we + 2; + break; + case $: + ne = (u - w) / we + 4; + } + ne /= 6; + } + return { h: ne, s: R, v: ue }; + } + function ae(U) { + var R = 0, u = 0, w = 0, $ = U.h, G = U.s, K = U.v, ne = Math.floor(6 * $), ue = 6 * $ - ne, we = K * (1 - G), De = K * (1 - ue * G), $e = K * (1 - (1 - ue) * G); + switch (ne % 6) { + case 0: + R = K, u = $e, w = we; + break; + case 1: + R = De, u = K, w = we; + break; + case 2: + R = we, u = K, w = $e; + break; + case 3: + R = we, u = De, w = K; + break; + case 4: + R = $e, u = we, w = K; + break; + case 5: + R = K, u = we, w = De; + } + return { r: Math.round(255 * R), g: Math.round(255 * u), b: Math.round(255 * w) }; + } + function ye(U) { + return (299 * U.r + 587 * U.g + 114 * U.b) / 1e3 >= 128; + } + var Ie = function() { + function U(R) { + this._value = R; + } + return Object.defineProperty(U.prototype, "rgb", { get: function() { + return this._value; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "hex", { get: function() { + return this._value ? Ug(this._value) : "none"; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "rgba", { get: function() { + return this._value ? cg(this._value) : "none"; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "alpha", { get: function() { + return this._value != null && this._value.a != null ? this._value.a : 1; + }, set: function(R) { + this._value && (this._value.a = R); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "lightColor", { get: function() { + return this._lightColor || (this._lightColor = new U({ r: 255, g: 255, b: 255 })), this._lightColor; + }, set: function(R) { + this._lightColor = R; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "darkColor", { get: function() { + return this._darkColor || (this._darkColor = new U({ r: 0, g: 0, b: 0 })), this._darkColor; + }, set: function(R) { + this._darkColor = R; + }, enumerable: !0, configurable: !0 }), U.prototype.toString = function() { + return this.alpha < 1 ? this.rgba : this.hex; + }, U.prototype.lighten = function(R) { + return new U(Ai(this.rgb, R)); + }, U.prototype.brighten = function(R) { + return new U(ge(this.rgb, R)); + }, U.prototype.saturate = function(R) { + return new U(Ye(this.rgb, R)); + }, Object.defineProperty(U.prototype, "alternative", { get: function() { + if (this.rgb != null) + return ye(this.rgb) ? this.darkColor : this.lightColor; + throw new Error("Color does not exist"); + }, enumerable: !0, configurable: !0 }), U; + }(); + function We(U, R) { + if (!Ee(U)) + return new Ie(void 0); + if (typeof U == "string") { + var u = "_color_" + U + "_" + (R || "1"), w = hi.getCache(u); + if (w) + return new Ie({ r: w.r, g: w.g, b: w.b, a: w.a }); + var $ = _c(U, R); + return hi.setCache(u, $), new Ie($); + } + return U instanceof Ie ? (Ee(R) && (U.alpha = R), U) : new Ie(U); + } + function Xe(U) { + return U instanceof Ie; + } + function lt(U) { + return We(U); + } + function Et(U) { + return Ee(U) && !Xe(U) ? lt(U) : U; + } + var Ht = function() { + function U() { + this._disposed = !1, this._disposers = [], this.className = "BaseObject"; + } + return U.prototype.debug = function() { + }, Object.defineProperty(U.prototype, "uid", { get: function() { + return this._uid || (this._uid = hi.getUniqueId(), hi.map.setKey(this._uid, this)), this._uid; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "id", { get: function() { + return this._id; + }, set: function(R) { + this._id = R; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "map", { get: function() { + return this._map || (this._map = new ha()), this._map; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "delayedMap", { get: function() { + return this._delayedMap || (this._delayedMap = new ha()), this._delayedMap; + }, enumerable: !0, configurable: !0 }), U.prototype.addDelayedMap = function(R, u) { + var w = this.delayedMap; + w.hasKey(u) || w.setKey(u, []), w.getKey(u).push({ property: R, target: this }); + }, U.prototype.processDelayedMap = function() { + var R = this; + this.delayedMap.each(function(u, w) { + if (R.map.hasKey(u)) { + var $ = R.map.getKey(u); + _i(w, function(G) { + G.target[G.property] = $; + }), R.delayedMap.removeKey(u); + } + }); + }, U.prototype.applyTheme = function() { + var R = this; + if (hi) { + var u = this.getCurrentThemes(); + u && _i(u, function(w, $) { + w(R); + }); + } + }, Object.defineProperty(U.prototype, "themes", { get: function() { + return this._themes; + }, set: function(R) { + this._themes = R; + }, enumerable: !0, configurable: !0 }), U.prototype.getCurrentThemes = function() { + return this.themes || hi.themes; + }, U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + if (!this._disposed) { + this._disposed = !0; + var R = this._disposers; + for (this._disposers = null; R.length !== 0; ) + R.shift().dispose(); + this.clearCache(), this.clonedFrom && this.clonedFrom.clones.removeValue(this); + var u = this._uid; + u != null && hi.map.removeKey(u); + } + }, U.prototype.addDisposer = function(R) { + this._disposers.push(R); + }, U.prototype.removeDispose = function(R) { + if (!this._disposed) { + var u = Ri(this._disposers, R); + u > -1 && this._disposers.splice(u, 1); + } + R.dispose(); + }, U.prototype.clone = function(R) { + R || (R = "clone-" + hi.getUniqueId()); + var u = new this.constructor(); + return u.cloneId = R, u.copyFrom(this), u; + }, Object.defineProperty(U.prototype, "clones", { get: function() { + return this._clones || (this._clones = new Hs()), this._clones; + }, enumerable: !0, configurable: !0 }), U.prototype.copyFrom = function(R) { + R.clones.push(this), this.clonedFrom = R; + }, Object.defineProperty(U.prototype, "className", { get: function() { + return this._className; + }, set: function(R) { + this._className = R; + }, enumerable: !0, configurable: !0 }), U.prototype.setCache = function(R, u, w) { + Dp.set(this.uid, R, u, w); + }, U.prototype.getCache = function(R, u) { + return u === void 0 && (u = void 0), Dp.get(this.uid, R, u); + }, U.prototype.clearCache = function() { + Dp.clear(this.uid); + }, U.prototype.setTimeout = function(R, u) { + var w = this, $ = setTimeout(function() { + w.removeDispose(G), R(); + }, u), G = new ln(function() { + clearTimeout($); + }); + return this._disposers.push(G), G; + }, U.prototype.setInterval = function(R, u) { + var w = this, $ = setInterval(function() { + w.removeDispose(G), R(); + }, u), G = new ln(function() { + clearTimeout($); + }); + return this._disposers.push(G), G; + }, Object.defineProperty(U.prototype, "config", { set: function(R) { + try { + this.processConfig(R); + } catch (u) { + this.raiseCriticalError(u); + } + }, enumerable: !0, configurable: !0 }), U.prototype.processConfig = function(R) { + var u = this; + if (R) { + var w = this; + if (hr(R, function(G, K) { + var ne, ue = K; + if (G == "callback" && typeof K == "function" && K.call(w), u.hasProperty(G)) + if (!ct(ue) || !Ee(ue.type) || ct(w[G]) && Ee(w[G].className) && !ue.forceCreate && w[G].className == ue.type || u.asIs(G) ? ne = w[G] : (ne = u.createClassInstance(ue.type)) ? w[G] = ne : ne = w[G], ne instanceof Yu) + u.processAdapters(ne, ue); + else if (ne instanceof ii) + u.processEvents(ne, ue); + else if (G == "locale" && st(ue)) + window["am4lang_" + ue] && (w[G] = window["am4lang_" + ue]); + else if (G == "parent" && st(ue)) { + var we = u.map.getKey(ue); + we ? w[G] = we : u.addDelayedMap("parent", ue); + } else if (u.asIs(G)) + w[G] = ue; + else if (u.asFunction(G) && st(ue)) { + if (!Ee(hi.registeredClasses[ue])) + throw Error("Invalid easing function: " + ue); + w[G] = hi.registeredClasses[ue]; + } else if (ue instanceof U) + w[G] = ue; + else if (ne instanceof U) + ne.config = ue; + else if (ne instanceof Xs || ne instanceof Im || ne instanceof Vc) { + if (gt(ue)) + ne instanceof Xs ? u.processListTemplate(ue, ne) : u.processOrderedTemplate(ue, ne); + else if (ct(ue)) + if (ue instanceof U) + ne.template = ue; + else { + var De; + De = Ee(ue.template) ? ue.template : ue, ne.template instanceof U ? ne.template.config = De : mi(De, function($e, Ke) { + var Ze = ne.template[$e]; + Ze instanceof Yu ? u.processAdapters(Ze, Ke) : Ze instanceof ii ? u.processEvents(Ze, Ke) : Ze instanceof Nf ? u.processDictionaryTemplate(Ze, Ke) : ne.template[$e] instanceof U ? ne.template[$e].config = Ke : ct(Ke) && Ee(Ke.type) ? (Ze = u.createClassInstance(Ke.type)) ? (Ze instanceof U && (Ze.config = Ke), ne.template[$e] = Ze) : ne.template[$e] = Ke : Ze instanceof Hs ? u.processList(Ke, Ze) : ne.template[$e] = u.maybeColorOrPercent(Ke); + }), Ee(ue.values) && (ne instanceof Xs ? u.processListTemplate(ue.values, ne) : u.processOrderedTemplate(ue.values, ne)); + } + } else + ne instanceof Hs ? G == "children" ? u.processList(ue, ne, u) : u.processList(ue, ne) : ne instanceof Nf ? u.processDictionaryTemplate(ne, ue) : ne instanceof ha ? u.processDictionary(ne, ue) : ne instanceof Ie || ne instanceof J ? w[G] = u.maybeColorOrPercent(ue) : ct(ne) && ct(ue) ? fs(ue, ne) : (ue = u.maybeColorOrPercent(ue), w[G] = ue); + else + u.isReserved(G) || (w[G] = ue); + }, this.configOrder), this.processingErrors.length) { + var $ = this.processingErrors.join(` +`); + throw this._processingErrors = [], Error($); + } + } + }, U.prototype.maybeColorOrPercent = function(R) { + if (st(R)) { + if (R.match(/^[\-]?[0-9.]+\%$/)) + return ce(It(R)); + if (R.match(/^\#[0-9abcdef]{3,}$/i)) + return We(R); + } + return R; + }, U.prototype.processAdapters = function(R, u) { + var w = this; + gt(u) ? _i(u, function($, G) { + R.add($.key, $.callback, $.priority || 0, w); + }) : ct(u) && mi(u, function($, G) { + R.has($, G) || R.add($, G); + }); + }, U.prototype.processEvents = function(R, u) { + var w = this; + gt(u) ? _i(u, function($, G) { + R.on($.type, $.callback, w); + }) : ct(u) && mi(u, function($, G) { + R.has($, G) || R.on($, G); + }); + }, U.prototype.processDictionaryTemplate = function(R, u) { + ct(u) && mi(u, function(w, $) { + var G; + (G = w == "template" ? R.template : R.hasKey(w) ? R.getKey(w) : R.create(w)) instanceof U ? G.config = $ : ct(G) && ct($) ? fs($, G) : G.setKey(w, $); + }); + }, U.prototype.processDictionary = function(R, u) { + ct(u) && mi(u, function(w, $) { + R.setKey(w, $); + }); + }, U.prototype.processListTemplate = function(R, u) { + var w = this; + for (_i(R, function($, G) { + var K, ne = w.getConfigEntryType($); + if (u.hasIndex(G) && !$.forceCreate) + K = u.getIndex(G); + else { + if ($ instanceof U) + return void u.push($); + K = ne ? u.create(ne) : u.create(); + } + $ === K || ct($) && (K instanceof U ? K.config = $ : ct(K) && ct($) ? fs($, K) : u.setIndex(u.indexOf(K), $)); + }); R.length > u.length; ) + u.pop(); + }, U.prototype.processOrderedTemplate = function(R, u) { + var w = this; + _i(R, function($, G) { + var K, ne = w.getConfigEntryType($); + K = ne ? u.create(ne) : u.create(), ct($) && (K instanceof U ? K.config = $ : ct(K) && ct($) ? fs($, K) : u.insert($)); + }); + }, U.prototype.processList = function(R, u, w) { + var $ = this; + gt(R) || (R = [R]); + var G = u.length, K = 0; + for (_i(R, function(ne, ue) { + if (ct(ne)) { + var we = void 0; + if (ue < G && !ne.forceCreate) + we = u.getIndex(ue); + else { + if (ne instanceof U) + return void u.push(ne); + K++, we = $.createEntryInstance(ne), w ? we.parent = w : u.push(we); + } + we instanceof U ? we.config = ne : ct(we) && ct(ne) && fs(ne, we); + } else + u.hasIndex(ue) ? u.setIndex(ue, ne) : u.push(ne); + }); !w && R.length + K < u.length; ) + u.pop(); + }, U.prototype.configOrder = function(R, u) { + return R == u ? 0 : R == "language" ? -1 : u == "language" ? 1 : 0; + }, U.prototype.asIs = function(R) { + return Ri(["locale"], R) != -1; + }, U.prototype.asFunction = function(R) { + return !1; + }, U.prototype.createClassInstance = function(R) { + if (Ee(hi.registeredClasses[R])) + return new hi.registeredClasses[R](); + throw Error('Invalid type: "' + R + '".'); + }, U.prototype.createEntryInstance = function(R) { + var u; + return Ee(R.type) && (u = this.createClassInstance(R.type)), u || R; + }, U.prototype.getConfigEntryType = function(R) { + if (Ee(R.type)) { + if (Ee(hi.registeredClasses[R.type])) + return hi.registeredClasses[R.type]; + throw Error('Invalid type: "' + R.type + '".'); + } + }, U.prototype.hasProperty = function(R) { + return R in this; + }, U.prototype.isReserved = function(R) { + return ["type", "forceCreate"].indexOf(R) !== -1; + }, Object.defineProperty(U.prototype, "processingErrors", { get: function() { + return this._processingErrors || (this._processingErrors = []), this._processingErrors; + }, enumerable: !0, configurable: !0 }), U; + }(), vi = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "BaseObjectEvents", u; + } + return re(R, U), Object.defineProperty(R.prototype, "events", { get: function() { + return this._eventDispatcher || (this._eventDispatcher = new ii(), this._disposers.push(this._eventDispatcher)), this._eventDispatcher; + }, enumerable: !0, configurable: !0 }), R.prototype.dispatch = function(u, w) { + this._eventDispatcher && this.events.isEnabled(u) && (w ? (w.type = u, w.target = w.target || this, this.events.dispatch(u, { type: u, target: this })) : this.events.dispatch(u, { type: u, target: this })); + }, R.prototype.dispatchImmediately = function(u, w) { + this._eventDispatcher && this.events.isEnabled(u) && (w ? (w.type = u, w.target = w.target || this, this.events.dispatchImmediately(u, w)) : this.events.dispatchImmediately(u, { type: u, target: this })); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), u._eventDispatcher && this.events.copyFrom(u._eventDispatcher); + }, R; + }(Ht), yi = "px", Oi = "string", zi = "number", ar = "date", tr = "duration", Ir = "__§§§__", ur = "__§§§§__"; + function Jr(U) { + } + function on(U, R) { + return mi(U, function(u, w) { + Ee(w) && (R[u] = w); + }), R; + } + function $n(U) { + return /^[^#]*/.exec(U)[0]; + } + function Fs() { + var U = "#"; + if (/apple/i.test(navigator.vendor)) { + var R = document.baseURI; + if (R) { + R = $n(R); + var u = $n(location.href); + R !== u && (U = u + U); + } + } + return U; + } + function Ro(U, R) { + return mi(U, function(u, w) { + Ee(w) && !Ee(R[u]) && (R[u] = w); + }), R; + } + function Wa(U, R) { + return mi(U, function(u, w) { + R[u] = w; + }), R; + } + function Ks(U) { + return Ee(U) && U.toString() !== ""; + } + function vs(U, R) { + return le(U) ? U : U != null && le(U.value) && le(R) ? R * U.value : 0; + } + function yo(U, R, u) { + var w; + return le(U) ? (w = U) < 0 && (w = u ? R + w : R - w) : U != null && le(U.value) && (w = R * U.value), w; + } + function Gc(U, R) { + return U instanceof J ? U.value : U / R; + } + function Pr() { + return window.devicePixelRatio || 1; + } + function _h(U) { + return U.replace(/\W+/g, "-").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase(); + } + function Xu(U) { + var R = U.split(""); + return R[0] = R[0].toUpperCase(), R.join(""); + } + function Cu(U) { + return JSON.stringify(U); + } + function Bl(U) { + return U.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + } + function bh(U, R, u, w, $) { + if (U.length <= R) + return [U]; + var G = []; + if (u) { + for (var K = -1, ne = U.replace(/([,;:!?\\\/]+|[\s])/g, Ir + "$1" + Ir).split(Ir), ue = 1; ue < ne.length; ue++) + (we = ne[ue]) != "." && we != "," || !ne[ue - 1].match(/[\w]+$/) || (ne[ue - 1] += we, ne[ue] = ""); + for (ue = 0; ue < ne.length; ue++) { + var we, De = (we = ne[ue]).length; + if (De !== 0) { + if (De > R && (u !== !0 || $ != 0)) { + if (w && (we = yl(we)), Ke = we.match(new RegExp(".{1," + R + "}", "g"))) { + if (w) + for (var $e = 0; $e < Ke.length; $e++) + Ke[$e] = yl(Ke[$e]); + G = G.concat(Ke); + } + } else + K === -1 && (G.push(""), K = 0), G[K].length + De + 1 > R && G[K] !== "" && (G.push(""), K++), G[K] += we; + K = G.length - 1; + } + } + } else { + var Ke; + if (Ke = U.match(new RegExp(".{1," + R + "}", "g"))) { + if (w) + for ($e = 0; $e < Ke.length; $e++) + Ke[$e] = yl(Ke[$e]); + G = Ke; + } + } + return G.length == 1 && u && $ && G[0].length > R && (G = []), G; + } + function fd(U, R, u, w, $) { + return U.length <= R ? U : ((R -= u.length) < 1 && (R = 1), (bh(U, R, w, $)[0] || "") + u); + } + function pf(U) { + return U.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); + } + function wh(U) { + return U.replace(/[\s\uFEFF\xA0]+$/g, ""); + } + function md(U) { + return U.replace(/^[\s\uFEFF\xA0]+/g, ""); + } + function yl(U) { + return U.split("").reverse().join(""); + } + function Dc(U) { + var R = U.trim(); + return (R = U.replace(/^'(.*)'$/, "$1")) == U && (R = U.replace(/^"(.*)"$/, "$1")), R; + } + function Vl(U, R, u) { + return R === void 0 && (R = 0), u === void 0 && (u = "0"), typeof U != "string" && (U = U.toString()), R > U.length ? Array(R - U.length + 1).join(u) + U : U; + } + function co(U) { + if (U === void 0) + return Oi; + var R = (U = (U = (U = U.toLowerCase().replace(/^\[[^\]]*\]/, "")).replace(/\[[^\]]+\]/, "")).trim()).match(/\/(date|number|duration)$/); + return R ? R[1] : U === zi ? zi : U === ar ? ar : U === tr ? tr : U.match(/[#0]/) ? zi : U.match(/[ymwdhnsqaxkzgtei]/) ? ar : Oi; + } + function xh(U) { + return U.replace(/\/(date|number|duration)$/i, ""); + } + function yu(U) { + return U && U.replace(/<[^>]*>/g, ""); + } + function Sh(U) { + return U && yu(("" + U).replace(/[\n\r]+/g, ". ")); + } + function Ud(U) { + if (Pe(U)) + return "NaN"; + if (U === 1 / 0) + return "Infinity"; + if (U === -1 / 0) + return "-Infinity"; + if (U === 0 && 1 / U == -1 / 0) + return "-0"; + var R = U < 0; + U = Math.abs(U); + var u, w = Be(/^([0-9]+)(?:\.([0-9]+))?(?:e[\+\-]([0-9]+))?$/.exec("" + U)), $ = w[1], G = w[2] || ""; + if (w[3] == null) + u = G === "" ? $ : $ + "." + G; + else { + var K, ne = +w[3]; + u = U < 1 ? "0." + ag("0", K = ne - 1) + $ + G : (K = ne - G.length) == 0 ? $ + G : K < 0 ? $ + G.slice(0, K) + "." + G.slice(K) : $ + G + ag("0", K); + } + return R ? "-" + u : u; + } + function zg(U) { + if (wt(U)) { + var R = new Date(U); + return R.setMilliseconds(U.getMilliseconds()), R; + } + if (le(U)) + return new Date(U); + var u = Number(U); + return le(u) ? new Date(u) : new Date(U); + } + function Ot(U) { + if (wt(U)) + return U.getTime(); + if (le(U)) + return U; + if (st(U)) { + var R = Number(U); + return le(R) ? R : void 0; + } + } + function Bi(U, R) { + var u = new Date(U.getFullYear(), 0, 0), w = U.getTime() - u.getTime() + 60 * (u.getTimezoneOffset() - U.getTimezoneOffset()) * 1e3; + return Math.floor(w / 864e5); + } + function Mr(U, R) { + var u = new Date(Date.UTC(U.getFullYear(), U.getMonth(), U.getDate())), w = u.getUTCDay() || 7; + u.setUTCDate(u.getUTCDate() + 4 - w); + var $ = new Date(Date.UTC(u.getUTCFullYear(), 0, 1)); + return Math.ceil(((u.getTime() - $.getTime()) / 864e5 + 1) / 7); + } + function zn(U, R) { + var u = Mr(new Date(U.getFullYear(), U.getMonth(), 1)), w = Mr(U); + return w == 1 && (w = 53), w - u + 1; + } + function xs(U, R, u, w) { + u === void 0 && (u = 1), w === void 0 && (w = !1); + var $ = new Date(R, 0, 4, 0, 0, 0, 0); + return w && $.setUTCFullYear(R), 7 * U + u - (($.getDay() || 7) + 3); + } + function Ss(U, R) { + return U > 12 ? U -= 12 : U === 0 && (U = 12), Ee(R) ? U + (R - 1) : U; + } + function da(U, R, u, w) { + if (R === void 0 && (R = !1), u === void 0 && (u = !1), w === void 0 && (w = !1), w) + return R ? "Coordinated Universal Time" : "UTC"; + var $ = U.toLocaleString("UTC"), G = U.toLocaleString("UTC", { timeZoneName: R ? "long" : "short" }).substr($.length); + return u === !1 && (G = G.replace(/ (standard|daylight|summer|winter) /i, " ")), G; + } + function qa(U, R) { + return Math.floor(Math.random() * (R - U)) + U; + } + function hg(U, R, u) { + return U > u ? u : U < R ? R : U; + } + function By(U, R, u) { + var w = u - R; + return (U > u || U < R) && (U = R + (U - w * Math.floor(U / w))), U; + } + function ff(U, R) { + var u = U.x, w = U.y, $ = []; + if (R) { + for (; Ee(R.parent); ) + $.push(R), R = R.parent; + $.reverse(); + for (var G = 0; G < $.length; G++) { + var K = $[G], ne = K.rotation, ue = u - K.pixelX - K.ex, we = w - K.pixelY - K.ey; + K.dx && (u -= K.dx), K.dy && (w -= K.dy); + var De = K.scale; + K.group && (De = K.group.scale), u = (A(-ne) * ue - Ue(-ne) * we) / De - K.pixelPaddingLeft, w = (A(-ne) * we + Ue(-ne) * ue) / De - K.pixelPaddingTop; + } + } + return { x: u, y: w }; + } + function kf(U, R) { + var u = U.x, w = U.y; + if (R) + for (; Ee(R.parent); ) { + var $ = R.rotation; + u += R.pixelPaddingLeft + R.ex, w += R.pixelPaddingTop + R.ey; + var G = R.scale; + R.group && (G = R.group.scale); + var K = R.pixelX + (u * A($) - w * Ue($)) * G, ne = R.pixelY + (u * Ue($) + w * A($)) * G; + R.dx && (K += R.dx), R.dy && (ne += R.dy), u = K, w = ne, R = R.parent; + } + return { x: u, y: w }; + } + function up(U, R, u) { + return ff(kf(U, R), u); + } + function YI(U, R) { + var u = ff(U, R), w = ff({ x: U.x + U.width, y: U.y + U.height }, R); + return { x: u.x, y: u.y, width: w.x - u.x, height: w.y - u.y }; + } + function rt(U, R) { + var u = kf(U, R), w = kf({ x: U.x + U.width, y: U.y + U.height }, R); + return { x: u.x, y: u.y, width: w.x - u.x, height: w.y - u.y }; + } + function Xl(U, R, u) { + try { + var w = R.getBoundingClientRect(); + return le(u) || (u = 1), { x: (U.x - w.left) / u, y: (U.y - w.top) / u }; + } catch { + return U; + } + } + function Vy(U, R) { + try { + var u = R.getBoundingClientRect(); + return { x: U.x + u.left, y: U.y + u.top }; + } catch { + return U; + } + } + function O1(U, R) { + return R && R.htmlContainer ? ff(Xl(U, Be(R.htmlContainer), R.svgContainer.cssScale), R) : U; + } + function cr(U, R) { + return R && R.htmlContainer ? Vy(kf(U, R), Be(R.htmlContainer)) : U; + } + function _s(U) { + var R = getComputedStyle(U), u = parseFloat(R.paddingLeft) + parseFloat(R.paddingRight), w = parseFloat(R.borderLeftWidth) + parseFloat(R.borderRightWidth); + return U.clientWidth - u - w; + } + function Hg(U) { + var R = getComputedStyle(U), u = parseFloat(R.paddingTop) + parseFloat(R.paddingBottom), w = parseFloat(R.borderTopWidth) + parseFloat(R.borderBottomWidth); + return U.clientHeight - u - w; + } + function nL(U) { + var R = ("" + U).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); + return R ? Math.max(0, (R[1] ? R[1].length : 0) - (R[2] ? +R[2] : 0)) : 0; + } + var A8 = /^([a-zA-Z][a-zA-Z0-9\+\.\-]*:)?(?:(\/\/)([^\@]+\@)?([^\/\?\#\:]*)(\:[0-9]+)?)?([^\?\#]*)(\?[^\#]*)?(\#.*)?$/; + function D3(U) { + var R = A8.exec(U); + return { protocol: R && R[1] || "", separator: R && R[2] || "", authority: R && R[3] || "", domain: R && R[4] || "", port: R && R[5] || "", path: R && R[6] || "", query: R && R[7] || "", hash: R && R[8] || "" }; + } + function xn(U) { + return U.protocol + U.separator + U.authority + U.domain + U.port + U.path + U.query + U.hash; + } + function P8(U) { + return U.protocol === "" && U.separator === "" && U.authority === "" && U.domain === "" && U.port === ""; + } + function XI(U, R) { + var u = D3(U), w = D3(R); + if (P8(u)) + throw new Error("Left URL is not absolute"); + if (P8(w)) { + if (w.path !== "") + if (w.path[0] === "/") + u.path = w.path; + else { + var $ = u.path.split(/\//), G = w.path.split(/\//); + if ($.length === 0 ? G.length !== 0 && $.push("") : $.length > 1 && $.pop(), Jn($, G), u.path = $.join("/"), u.path !== "" && u.path[0] !== "/") + throw new Error("URL path must start with /"); + } + return u.query = w.query, u.hash = w.hash, xn(u); + } + return xn(w); + } + function Yx() { + return !!window.MSInputMethodContext && !!document.documentMode; + } + function ch(U) { + return +U; + } + function mC(U) { + return U * U; + } + function KI(U) { + return U * (2 - U); + } + function Ch(U) { + return ((U *= 2) <= 1 ? U * U : --U * (2 - U) + 1) / 2; + } + function sL(U, R) { + return Math.pow(U, R); + } + function ho(U, R) { + return 1 - Math.pow(1 - U, R); + } + function Hv(U, R) { + return ((U *= 2) <= 1 ? Math.pow(U, R) : 2 - Math.pow(2 - U, R)) / 2; + } + function Pm(U) { + return sL(U, 3); + } + function F3(U) { + return ho(U, 3); + } + function oL(U) { + return Hv(U, 3); + } + function gC(U) { + return Math.pow(2, 10 * U - 10); + } + function yC(U) { + return 1 - Math.pow(2, -10 * U); + } + function jy(U) { + return ((U *= 2) <= 1 ? Math.pow(2, 10 * U - 10) : 2 - Math.pow(2, 10 - 10 * U)) / 2; + } + function Wg(U) { + return 1 - Math.cos(U * pe); + } + function L3(U) { + return Math.sin(U * pe); + } + function vC(U) { + return (1 - Math.cos(Ne * U)) / 2; + } + function N3(U) { + return U * U * U; + } + function W0(U) { + return --U * U * U + 1; + } + function ba(U) { + return ((U *= 2) <= 1 ? U * U * U : (U -= 2) * U * U + 2) / 2; + } + function O8(U) { + return 1 - Math.sqrt(1 - U * U); + } + function qr(U) { + return Math.sqrt(1 - --U * U); + } + function k3(U) { + return ((U *= 2) <= 1 ? 1 - Math.sqrt(1 - U * U) : Math.sqrt(1 - (U -= 2) * U) + 1) / 2; + } + hi.registeredClasses["ease.linear"] = ch, hi.registeredClasses["ease.quadIn"] = mC, hi.registeredClasses["ease.quadOut"] = KI, hi.registeredClasses["ease.quadInOut"] = Ch, hi.registeredClasses["ease.polyIn"] = sL, hi.registeredClasses["ease.polyOut"] = ho, hi.registeredClasses["ease.polyInOut"] = Hv, hi.registeredClasses["ease.polyIn3"] = Pm, hi.registeredClasses["ease.polyOut3"] = F3, hi.registeredClasses["ease.polyInOut3"] = oL, hi.registeredClasses["ease.expIn"] = gC, hi.registeredClasses["ease.expOut"] = yC, hi.registeredClasses["ease.expInOut"] = jy, hi.registeredClasses["ease.sinIn"] = Wg, hi.registeredClasses["ease.sinOut"] = L3, hi.registeredClasses["ease.sinInOut"] = vC, hi.registeredClasses["ease.cubicIn"] = N3, hi.registeredClasses["ease.cubicOut"] = W0, hi.registeredClasses["ease.cubicInOut"] = ba, hi.registeredClasses["ease.circleIn"] = O8, hi.registeredClasses["ease.circleOut"] = qr, hi.registeredClasses["ease.circleInOut"] = k3; + var _C = 7.5625; + function pa(U) { + return 1 - bC(1 - U); + } + function bC(U) { + return (U = +U) < 0.36363636363636365 ? _C * U * U : U < 0.7272727272727273 ? _C * (U -= 0.5454545454545454) * U + 0.75 : U < 0.9090909090909091 ? _C * (U -= 0.8181818181818182) * U + 0.9375 : _C * (U -= 0.9545454545454546) * U + 0.984375; + } + function JI(U) { + return ((U *= 2) <= 1 ? 1 - bC(1 - U) : bC(U - 1) + 1) / 2; + } + hi.registeredClasses["ease.bounceIn"] = pa, hi.registeredClasses["ease.bounceOut"] = bC, hi.registeredClasses["ease.bounceInOut"] = JI; + var ZI = 0.3 / (2 * Math.PI), QI = Math.asin(1) * ZI; + function $3(U) { + return 1 * Math.pow(2, 10 * --U) * Math.sin((QI - U) / ZI); + } + function aL(U) { + return 1 - 1 * Math.pow(2, -10 * (U = +U)) * Math.sin((U + QI) / ZI); + } + function R8(U) { + return ((U = 2 * U - 1) < 0 ? 1 * Math.pow(2, 10 * U) * Math.sin((QI - U) / ZI) : 2 - 1 * Math.pow(2, -10 * U) * Math.sin((QI + U) / ZI)) / 2; + } + hi.registeredClasses["ease.elasticIn"] = $3, hi.registeredClasses["ease.elasticOut"] = aL, hi.registeredClasses["ease.elasticInOut"] = R8; + var Hr = function(U) { + function R() { + var u = U.call(this) || this; + return u.transitionDuration = 0, u.transitionEasing = W0, u.properties = {}, u.propertyFields = {}, u.filters = new Hs(), u.isTemplate = !1, u.className = "SpriteState", u._disposers.push(new Wo(u.filters)), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "adapter", { get: function() { + var u = this; + return this._adapterO || (this._adapterO = new Yu(this), this._adapterO.events.on("inserted", function(w) { + u[w.newValue.key] = u[w.newValue.key]; + }, void 0, !1), this._adapterO.events.on("removed", function(w) { + u[w.newValue.key] = u[w.newValue.key]; + }, void 0, !1)), this._adapterO; + }, enumerable: !0, configurable: !0 }), R.prototype.getPropertyValue = function(u) { + var w = this.properties[u], $ = this.sprite; + if ($) { + var G = this.propertyFields[u]; + if (Ee(G) && ($.dataItem && (w = $.dataItem.dataContext[G]), w == null && (w = "__unset")), Ee(w)) + this._adapterO && (w = this._adapterO.apply(u, w)); + else { + var K = $.getPropertyValue(u); + (w = this._adapterO ? this._adapterO.apply(u, K) : K) == K && (w = void 0); + } + } + return w; + }, R.prototype.copyFrom = function(u) { + u && u != this && (this.transitionDuration = u.transitionDuration, this.transitionEasing = u.transitionEasing, on(u.properties, this.properties), on(u.propertyFields, this.propertyFields), this.filters.copyFrom(u.filters), u._adapterO && this.adapter.copyFrom(u._adapterO)); + }, Object.defineProperty(R.prototype, "allValues", { get: function() { + var u = this, w = {}; + return mi(this.properties, function($, G) { + w[$] = u.getPropertyValue($); + }), this._adapterO && mi(this._adapterO.keys(), function($, G) { + var K = u.getPropertyValue(G); + w[G] = K; + }), mi(this.propertyFields, function($) { + var G = u.getPropertyValue($); + w[$] = G; + }), w; + }, enumerable: !0, configurable: !0 }), R.prototype.reset = function() { + this.properties = {}, this.filters.clear(); + }, R.prototype.processConfig = function(u) { + Ee(u) && Ee(u.properties) && mi(u.properties, function(w, $) { + st($) && ($.match(/^[0-9.\-]+\%$/) ? u.properties[w] = ce(It($)) : $.match(/^\#[0-9abcdef]{3,}$/i) && (u.properties[w] = Et($))); + }), U.prototype.processConfig.call(this, u); + }, R.prototype.asFunction = function(u) { + return u == "transitionEasing" || U.prototype.asIs.call(this, u); + }, R; + }(Ht); + hi.registeredClasses.SpriteState = Hr; + var M8 = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u._interactionEvents = new ha(), u; + } + return re(R, U), R.prototype._dispatchSpriteEvent = function(u) { + if (!this.target.disabled && !this.target.isTemplate && this.target.events.isEnabled(u.type)) { + var w = wr(u, { target: this.target }); + this.target.events.dispatchImmediately(w.type, w); + } + }, R.prototype._dispatchSpritePointEvent = function(u) { + if (!this.target.disabled && !this.target.isTemplate && this.target.events.isEnabled(u.type)) { + var w = wr(u, { target: this.target, spritePoint: u.point ? O1(u.point, this.target) : void 0, svgPoint: this.target.getSvgPoint(u.point) }); + this.target.events.dispatchImmediately(w.type, w); + } + }, R.prototype._addInteractionObjectEvent = function(u, w, $, G) { + var K = this, ne = G + "-" + u; + return this._interactionEvents.insertKeyIfEmpty(ne, function() { + var ue = K.target.interactions.events.on(u, w, $, G); + return new Cs(function() { + K._interactionEvents.removeKey(ne), ue.dispose(); + }); + }).increment(); + }, R.prototype._on = function(u, w, $, G, K, ne) { + var ue = U.prototype._on.call(this, u, w, $, G, K, ne), we = [ue.disposer]; + switch (w) { + case "hit": + case "track": + case "doublehit": + case "wheel": + case "wheelup": + case "wheeldown": + case "wheelleft": + case "wheelright": + we.push(this._addInteractionObjectEvent(w, this._dispatchSpritePointEvent, this, K)); + break; + case "rightclick": + case "down": + case "up": + case "drag": + case "dragged": + case "dragstart": + case "dragstop": + case "over": + case "out": + case "swipe": + case "swipeleft": + case "swiperight": + case "resize": + case "focus": + case "blur": + case "toggled": + we.push(this._addInteractionObjectEvent(w, this._dispatchSpriteEvent, this, K)); + } + switch (w) { + case "hit": + case "doublehit": + case "rightclick": + case "down": + case "up": + this.target.clickable = !0; + break; + case "toggled": + this.target.togglable = !0; + break; + case "drag": + case "dragstart": + case "dragstop": + this.target.draggable = !0; + break; + case "track": + this.target.trackable = !0; + break; + case "resize": + this.target.resizable = !0; + break; + case "swipe": + case "swipeleft": + case "swiperight": + this.target.swipeable = !0; + break; + case "wheel": + case "wheelup": + case "wheeldown": + case "wheelleft": + case "wheelright": + this.target.wheelable = !0; + break; + case "over": + this.target.hoverable = !0; + case "out": + this.target.hoverable = !0; + break; + case "focus": + case "blur": + this.target.focusable = !0; + } + return ue.disposer = new kn(we), ue; + }, R; + }(bt), B3 = function() { + function U() { + } + return U.opacity = 1, U.strokeOpacity = 1, U.strokeWidth = 1, U.fillOpacity = 1, U.fill = We("#000000"), U.stroke = We("#000000"), U.focusable = void 0, U.tabindex = 0, U; + }(), zd = { verbose: !0, commercialLicense: !1, classNamePrefix: "amcharts-", autoSetClassName: !1, minPolylineStep: 0.5, onlyShowOnViewport: !1, queue: !1, autoDispose: !1, licenses: [], suppressErrors: !1, suppressWarnings: !1, animationsEnabled: !0, nonce: "", deferredDelay: 100, disableHoverOnTransform: "never", pixelPerfectPrecision: 0 }; + function R1(U, R) { + var u = !1, w = Date.now(); + return dd(function $(G) { + if (!u) { + var K = G - w; + K >= U ? R(1) : (dd($), R(K / U)); + } + }), new ln(function() { + u = !0; + }); + } + function D8(U, R, u) { + return R + (u - R) * U; + } + function lL(U, R, u) { + return new J(D8(U, R.percent, u.percent)); + } + function wC(U, R, u) { + var w = new Ie(Wt(R.rgb, u.rgb, U)); + return R.alpha != u.alpha && (w.alpha = R.alpha + (u.alpha - R.alpha) * U), w; + } + function F8(U, R) { + return R + U.charAt(0).toUpperCase() + U.substr(1); + } + var uL, Wb = function() { + function U(R) { + this._disposer = new ln(function() { + for (; R.length !== 0; ) + R[0].dispose(); + }); + } + return U.prototype.isDisposed = function() { + return this._disposer.isDisposed(); + }, U.prototype.dispose = function() { + this._disposer.dispose(); + }, U; + }(), $f = function(U) { + function R(u, w, $, G) { + var K = U.call(this) || this; + return K.duration = 0, K.easing = ch, K.progress = 0, K._loop = 0, K._pause = !1, K._delayTimeout = null, K._time = 0, K._isFinished = !1, K.className = "Animation", K.object = u, K.animationOptions = Ki(w), K.duration = $, G && (K.easing = G), K.applyTheme(), K; + } + return re(R, U), R.prototype.debug = function() { + }, R.prototype.dispose = function() { + U.prototype.dispose.call(this), this.pause(); + }, R.prototype.delay = function(u) { + var w = this; + if (u > 0) { + this.pause(), Ur(this.object.animations, this); + var $ = setTimeout(function() { + w._delayTimeout = null, w.start(); + }, u); + this._delayTimeout = new ln(function() { + clearTimeout($); + }); + } + return this; + }, R.prototype._start = function() { + this._isFinished = !1, this._delayTimeout && (this.removeDispose(this._delayTimeout), this._delayTimeout = null), this.stopSameAnimations(), this._pause = !1, Ur(qo.animations, this), Ur(this.object.animations, this), qo.requestFrame(); + }, R.prototype.start = function() { + this._start(), this._startTime = Date.now(), this._time = 0, this.staticOptions = []; + for (var u = this.animationOptions.length - 1; u >= 0; u--) { + var w = this.animationOptions[u]; + if (Ee(w.from) || (w.childObject ? w.from = w.childObject[w.property] : (w.from = this.object[w.property], Ee(w.from) || (w.from = B3[w.property]))), w.from == w.to) + ki(this.animationOptions, w); + else if (!Ee(w.from) || !(w.from instanceof J) && w.to instanceof J || w.from instanceof J && !(w.to instanceof J)) + this.staticOptions.push(w), ki(this.animationOptions, w); + else if (le(w.to)) + if (w.updateMethod = D8, w.from instanceof J) { + var $ = this.object[F8(w.property, "pixel")]; + isNaN($) ? (this.staticOptions.push(w), ki(this.animationOptions, w)) : w.from = $; + } else + isNaN(w.from) && (this.staticOptions.push(w), ki(this.animationOptions, w)); + else + w.to instanceof Ie ? w.from ? w.updateMethod = wC : (this.staticOptions.push(w), ki(this.animationOptions, w)) : w.to instanceof J ? (w.updateMethod = lL, isNaN(w.from) || ($ = this.object[F8(w.property, "relative")], isNaN($) || (w.from = ce(100 * $)))) : (this.staticOptions.push(w), ki(this.animationOptions, w)); + } + if (this.applyStaticOptions(), this.events.isEnabled("animationstarted")) { + var G = { type: "animationstarted", target: this, progress: this.progress }; + this.events.dispatchImmediately("animationstarted", G); + } + return this.update(), this.duration === 0 && this.end(), this; + }, R.prototype.loop = function(u) { + return le(u) || (u = 1 / 0), this._loop = u, this; + }, R.prototype.pause = function() { + return this._pause = !0, this._delayTimeout && (this.removeDispose(this._delayTimeout), this._delayTimeout = null), ki(qo.animations, this), ki(this.object.animations, this), this; + }, R.prototype.resume = function() { + return this._start(), this._startTime = Date.now() - this._time, this; + }, R.prototype.end = function() { + if (this._loop == 0 && this.pause(), this.setProgress(1), this.applyStaticOptions(), this.events.isEnabled("animationended")) { + var u = { type: "animationended", target: this, progress: this.progress }; + this.events.dispatchImmediately("animationended", u); + } + return this._loop > 0 ? (this._loop--, this.start()) : (this.stop(), this._isFinished = !0), this; + }, R.prototype.kill = function() { + this.pause(), this._isFinished = !0; + }, R.prototype.isFinished = function() { + return this._isFinished; + }, R.prototype.applyStaticOptions = function() { + var u = this; + _i(this.staticOptions, function(w) { + w.childObject ? w.childObject[w.property] = u.progress == 1 ? w.to : w.from : u.object[w.property] = u.progress == 1 ? w.to : w.from; + }); + }, R.prototype.stop = function(u) { + if (this.pause(), !u && this.events.isEnabled("animationstopped")) { + var w = { type: "animationstopped", target: this, progress: this.progress }; + this.events.dispatchImmediately("animationstopped", w); + } + return this; + }, R.prototype.setProgress = function(u) { + var w = this; + if (this._time = this.duration * u, _i(this.animationOptions, function(G) { + if (G.updateMethod && Ee(G.from)) { + var K = G.updateMethod(u, G.from, G.to); + G.childObject ? G.childObject[G.property] = K : w.object[G.property] = K; + } + }), this.progress = u, this.events.isEnabled("animationprogress")) { + var $ = { type: "animationprogress", target: this, progress: this.progress }; + this.events.dispatchImmediately("animationprogress", $); + } + qo.requestFrame(); + }, R.prototype.update = function() { + if (!this._pause) { + var u = void 0; + this._time = mt(Date.now() - this._startTime, 0, this.duration); + var w = this._time / this.duration; + u = this.easing(w), (this.duration == 0 || !le(u) || w >= 1) && (u = 1), this.setProgress(u), He(this._time / this.duration, 6) == 1 && this.end(); + } + return this; + }, Object.defineProperty(R.prototype, "delayed", { get: function() { + return !!this._delayTimeout; + }, enumerable: !0, configurable: !0 }), R.prototype.stopSameAnimations = function() { + var u = this; + _i(W(this.object.animations), function(w) { + if (w !== u && !w.delayed) { + var $ = []; + _i(u.animationOptions, function(G) { + _i(w.animationOptions, function(K) { + G.property == K.property && G.childObject == K.childObject && ($.push(K), w.animationOptions.length == 0 && w.kill()); + }); + }), _i($, function(G) { + ki(w.animationOptions, G); + }); + } + }); + }, R.prototype.asFunction = function(u) { + return u == "easing" || U.prototype.asIs.call(this, u); + }, R; + }(vi), mf = "http://www.w3.org/2000/svg", eA = "http://www.w3.org/2000/xmlns/", xC = "http://www.w3.org/1999/xlink"; + function Uc(U, R, u, w) { + return U.addEventListener(R, u, w || !1), new ln(function() { + U.removeEventListener(R, u, w || !1); + }); + } + function cL(U) { + if (st(U)) { + var R = document.getElementById(U); + if (R == null && (R = document.getElementsByClassName(U)[0]), R instanceof HTMLElement) + return R; + } else if (U instanceof HTMLElement) + return U; + } + function M1(U, R) { + if (U) + if (U.classList) + _i(R.split(" "), function(w) { + U.classList.add(w); + }); + else { + var u = U.getAttribute("class"); + u ? U.setAttribute("class", u.split(" ").filter(function(w) { + return w !== R; + }).join(" ") + " " + R) : U.setAttribute("class", R); + } + } + function Xx(U, R) { + if (U) + if (U.classList) + U.classList.remove(R); + else { + var u = U.getAttribute("class"); + u && U.setAttribute("class", u.split(" ").filter(function(w) { + return w !== R; + }).join(" ")); + } + } + function L8(U, R, u) { + U.style[R] = u; + } + function V3(U, R) { + return U.currentStyle ? U.currentStyle[R] : document.defaultView.getComputedStyle(U, null).getPropertyValue(R); + } + function Kx() { + if (document.activeElement && document.activeElement != document.body) + if (document.activeElement.blur) + document.activeElement.blur(); + else { + var U = document.createElement("button"); + U.style.position = "fixed", U.style.top = "0px", U.style.left = "-10000px", document.body.appendChild(U), U.focus(), U.blur(), document.body.removeChild(U); + } + } + function j3(U) { + if (U instanceof HTMLElement) + U.focus(); + else { + var R = document.createElement("input"), u = document.createElementNS(mf, "foreignObject"); + u.appendChild(R), U.appendChild(u), R.focus(), R.disabled = !0, u.remove(); + } + } + function SC(U) { + if (U.outerHTML) + return U.outerHTML; + var R = document.createElement("div"), u = U.cloneNode(!0); + return R.appendChild(u), R.innerHTML; + } + function Wv(U) { + return U instanceof Object && U && U.nodeType === 1; + } + function N8(U, R) { + for (var u = R; ; ) { + if (U === u) + return !0; + if (u.parentNode == null) { + if (u.host == null) + return !1; + u = u.host; + } else + u = u.parentNode; + } + } + function D1(U) { + for (var R = U; ; ) { + if (R.parentNode == null) + return R.host != null ? R : null; + R = R.parentNode; + } + } + function Hd(U) { + for (var R = U.ownerDocument, u = U; ; ) { + if (u.parentNode == null) + return u === R || u.host != null ? u : null; + u = u.parentNode; + } + } + function Th(U, R) { + _i(U.attributes, function(u) { + u.value != null && R.setAttribute(u.name, u.value); + }); + } + function hL(U) { + Vd(function() { + try { + var R = U.getBoundingClientRect(), u = R.left - Math.round(R.left), w = R.top - Math.round(R.top); + u !== 0 && pd(function() { + U.style.left = u + "px"; + }), w !== 0 && pd(function() { + U.style.top = w + "px"; + }); + } catch { + } + }); + } + var $s = function(U) { + function R(u, w, $) { + var G = this, K = function(ne) { + return ne == null ? (Ee(uL) || ((ue = document.createElement("style")).type = "text/css", document.head.appendChild(ue), uL = ue.sheet), uL) : ((ue = document.createElement("style")).type = "text/css", ne.appendChild(ue), ue.sheet); + var ue; + }(u); + return (G = U.call(this, function() { + var ne = Ri(K.cssRules, G._rule); + if (ne === -1) + throw new Error("Could not dispose StyleRule"); + K.deleteRule(ne); + }) || this)._rule = function(ne, ue) { + var we = ne.cssRules.length; + return ne.insertRule(ue + "{}", we), ne.cssRules[we]; + }(K, w), mi($, function(ne, ue) { + G.setStyle(ne, ue); + }), G; + } + return re(R, U), Object.defineProperty(R.prototype, "selector", { get: function() { + return this._rule.selectorText; + }, set: function(u) { + this._rule.selectorText = u; + }, enumerable: !0, configurable: !0 }), R.prototype._setVendorPrefixName = function(u, w) { + var $ = this._rule.style; + $.setProperty("-webkit-" + u, w, ""), $.setProperty("-moz-" + u, w, ""), $.setProperty("-ms-" + u, w, ""), $.setProperty("-o-" + u, w, ""), $.setProperty(u, w, ""); + }, R.prototype.setStyle = function(u, w) { + u === "transition" ? this._setVendorPrefixName(u, w) : this._rule.style.setProperty(u, w, ""); + }, R; + }(ln), k8 = 0, dL = function(U) { + function R(u, w, $) { + var G = this, K = Ee($) ? $ : "__style_" + ++k8 + "__"; + return (G = U.call(this, u, "." + K, w) || this)._className = K, G; + } + return re(R, U), Object.defineProperty(R.prototype, "className", { get: function() { + return this._className; + }, set: function(u) { + this._className = u, this.selector = "." + u; + }, enumerable: !0, configurable: !0 }), R.prototype.toString = function() { + return this._className; + }, R; + }($s); + function CC(U) { + if (document.readyState !== "loading") + U(); + else { + var R = function() { + document.readyState !== "loading" && (document.removeEventListener("readystatechange", R), U()); + }; + document.addEventListener("readystatechange", R); + } + } + function tA(U) { + var R = V3(U, "font-family"); + if (R) + return R; + var u = U.parentElement || U.parentNode; + return u ? tA(u) : void 0; + } + function iA(U) { + var R = V3(U, "font-size"); + if (R) + return R; + var u = U.parentElement || U.parentNode; + return u ? iA(u) : void 0; + } + function TC(U, R) { + var u = U.getBoundingClientRect(), w = gt(R) ? R : R ? [R] : []; + if (w.length) { + for (var $ = 0; $ < w.length; $++) { + var G = w[$]; + if (!TC(G)) + return !1; + var K = G.getBoundingClientRect(); + if (u.top >= 0 && u.left >= 0 && u.top <= K.top + K.height && u.left <= K.left + K.width) + return !0; + } + return !1; + } + return u.top >= 0 && u.left >= 0 && u.top <= (window.innerHeight || document.documentElement.clientHeight) && u.left <= (window.innerWidth || document.documentElement.clientWidth); + } + var EC = function() { + function U(R) { + this._isDisposed = !1, this._x = 0, this._y = 0, this._rotationY = 0, this._rotationX = 0, this._rotation = 0, this._scale = 1, this.node = typeof R == "string" ? document.createElementNS(mf, R) : R; + } + return U.prototype.removeNode = function() { + this.node && this.node.parentNode && this.node.parentNode.removeChild(this.node); + }, Object.defineProperty(U.prototype, "transformString", { get: function() { + if (this.node) + return this._transformString; + }, enumerable: !0, configurable: !0 }), U.prototype.transform = function() { + var R = "translate(" + this._x + "," + this._y + ")"; + if (this._scale != 1 && (R += (R ? " " : "") + "scale(" + this._scale + ")"), this._rotation != 0) { + var u = "rotate(" + this._rotation + ")"; + this._rotationX && this._rotationY && (u = "rotate(" + this._rotation + " " + this._rotationX + " " + this._rotationY + ")"), R += (R ? " " : "") + u; + } + this._transformString = R, this.node.setAttribute("transform", R); + }, U.prototype.getBBox = function() { + var R = { width: 0, height: 0, x: 0, y: 0 }; + if (this.node && this.node.parentNode) + try { + var u = this.node.getBBox(); + R.x = u.x, R.y = u.y, R.width = u.width, R.height = u.height; + } catch { + } + return R; + }, U.prototype.moveTo = function(R) { + if (R) { + var u = R.x, w = R.y; + this._x == u && this._y == w || (this._x = u, this._y = w, this.transform()); + } + }, Object.defineProperty(U.prototype, "content", { get: function() { + return this.node.innerHTML || ""; + }, set: function(R) { + this.node.innerHTML = R; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "textContent", { get: function() { + return this.node.textContent || ""; + }, set: function(R) { + this.node.textContent = R; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "x", { get: function() { + return this._x; + }, set: function(R) { + this._x != R && (this._x = R, this.transform()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "y", { get: function() { + return this._y; + }, set: function(R) { + this._y != R && (this._y = R, this.transform()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "rotation", { get: function() { + return this._rotation; + }, set: function(R) { + this._rotation != R && (this._rotation = R, this.transform()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "rotationX", { get: function() { + return this._rotationX; + }, set: function(R) { + this._rotationX != R && (this._rotationX = R, this.transform()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "rotationY", { get: function() { + return this._rotationY; + }, set: function(R) { + this._rotationY != R && (this._rotationY = R, this.transform()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "scale", { get: function() { + return this._scale; + }, set: function(R) { + this._scale != R && (this._scale = R, this.transform()); + }, enumerable: !0, configurable: !0 }), U.prototype.removeAttr = function(R) { + this.node.removeAttribute(R); + }, U.prototype.attr = function(R) { + var u = this; + return mi(R, function(w, $) { + Ee($) ? u.node.setAttribute(w, $) : u.node.removeAttribute(w); + }), this; + }, U.prototype.getAttr = function(R) { + return this.node.getAttribute(R); + }, U.prototype.attrNS = function(R, u, w) { + return this.node.setAttributeNS(R, u, w), this; + }, U.prototype.getAttrNS = function(R, u) { + return this.node.getAttributeNS(R, u); + }, U.prototype.removeStyle = function(R) { + this.node.style[R] = null, delete this.node.style[R]; + }, U.prototype.getStyle = function(R) { + return this.node.style[R]; + }, U.prototype.addStyle = function(R) { + var u = this; + return mi(R, function(w, $) { + Ee($) ? u.node.style[w] = $ : u.removeStyle(w); + }), this; + }, U.prototype.addClass = function(R) { + M1(this.node, R); + }, U.prototype.removeClass = function(R) { + Xx(this.node, R); + }, U.prototype.setClass = function(R) { + this.node.setAttribute("class", R); + }, U.prototype.removeChildNodes = function() { + for (; this.node.childNodes.length > 0; ) + this.node.removeChild(this.node.firstChild); + }, U.prototype.isDisposed = function() { + return this._isDisposed; + }, U.prototype.dispose = function() { + this.removeNode(); + }, U; + }(), G3 = function(U) { + function R(u) { + return U.call(this, u) || this; + } + return re(R, U), R.prototype.add = function(u) { + u && this.node.appendChild(u.node); + }, R.prototype.addToBack = function(u) { + if (u) { + var w = this.node.childNodes[0]; + w ? w != u.node && this.node.insertBefore(u.node, w) : this.node.appendChild(u.node); + } + }, R.prototype.removeElement = function(u) { + if (u) + try { + u.node && u.node.parentNode == this.node && this.node.removeChild(u.node); + } catch { + } + }, R.prototype.hasChild = function(u) { + for (var w = 0; w < this.node.childNodes.length; w++) + if (this.node.childNodes[w] == u.node) + return !0; + return !1; + }, Object.defineProperty(R.prototype, "content", { get: function() { + return this.node.innerHTML; + }, set: function(u) { + this.node.innerHTML = u; + }, enumerable: !0, configurable: !0 }), R.prototype.removeChildren = function() { + if (this.node.childNodes) + for (; this.node.childNodes.length > 0; ) { + var u = this.node.firstChild; + u && u.parentNode && u.parentNode.removeChild(u); + } + }, R.prototype.removeChildrenByTag = function(u) { + if (this.node.childNodes) + for (var w = this.node.getElementsByTagName(u), $ = 0; $ < w.length; $++) + this.node.removeChild(w[$]); + }, R; + }(EC), Fa = function(U) { + function R() { + var u = U.call(this) || this; + return u._purposes = { stroke: We("#e5e5e5"), fill: We("#f3f3f3"), primaryButton: We("#6794dc"), primaryButtonHover: We("#6771dc"), primaryButtonDown: We("#68dc75"), primaryButtonActive: We("#68dc75"), primaryButtonText: We("#FFFFFF"), primaryButtonStroke: We("#FFFFFF"), secondaryButton: We("#d9d9d9"), secondaryButtonHover: We("#d9d9d9").brighten(-0.25), secondaryButtonDown: We("#d9d9d9").brighten(-0.35), secondaryButtonActive: We("#d9d9d9").brighten(0.35), secondaryButtonText: We("#000000"), secondaryButtonStroke: We("#FFFFFF"), grid: We("#000000"), background: We("#ffffff"), alternativeBackground: We("#000000"), text: We("#000000"), alternativeText: We("#FFFFFF"), disabledBackground: We("#999999"), positive: We("#67dc75"), negative: We("#dc6788") }, u.className = "InterfaceColorSet", u.applyTheme(), u; + } + return re(R, U), R.prototype.debug = function() { + }, R.prototype.getFor = function(u) { + return this._purposes[u]; + }, R.prototype.setFor = function(u, w) { + this._purposes[u] = w; + }, R; + }(Ht); + hi.registeredClasses.InterfaceColorSet = Fa; + var qb = new ha(), rA = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u._domEvents = {}, u; + } + return re(R, U), R.prototype._addDOMEvent = function(u, w, $, G) { + var K = this; + if (!this._domEvents[u]) { + var ne = function(ue) { + $.call(G, w, ue); + }; + this.target.element.addEventListener(u, ne, !1), this._domEvents[u] = new Cs(function() { + delete K._domEvents[u], K.target.element.removeEventListener(u, ne, !1); + }); + } + return this._domEvents[u].increment(); + }, R.prototype._dispatchKeyboardEvent = function(u, w) { + this.target.events.isEnabled(u) && this.target.events.dispatchImmediately(u, { type: u, target: this.target, event: w }); + }, R.prototype._on = function(u, w, $, G, K, ne) { + var ue = U.prototype._on.call(this, u, w, $, G, K, ne), we = [ue.disposer]; + switch (w) { + case "hit": + case "doublehit": + case "rightclick": + case "down": + case "up": + this.target.clickable = !0; + break; + case "drag": + case "dragstart": + case "dragstop": + this.target.draggable = !0; + break; + case "track": + this.target.trackable = !0; + break; + case "resize": + this.target.resizable = !0; + break; + case "swipe": + case "swipeleft": + case "swiperight": + this.target.swipeable = !0; + break; + case "wheel": + case "wheelup": + case "wheeldown": + case "wheelleft": + case "wheelright": + this.target.wheelable = !0; + break; + case "over": + case "out": + this.target.hoverable = !0; + break; + case "focus": + case "blur": + case "focusin": + case "focusout": + this.target.focusable = !0; + break; + case "keydown": + case "keyup": + case "keypress": + case "input": + we.push(this._addDOMEvent(w, w, this._dispatchKeyboardEvent, this)); + } + return ue.disposer = new kn(we), ue; + }, R; + }(bt), pL = function(U) { + function R(u) { + var w = U.call(this) || this; + return w._eventDispatcher = new rA(w), w.eventDisposers = new ha(), w.replacedStyles = new ha(), w._clickable = !1, w._contextMenuDisabled = !1, w._hoverable = !1, w._trackable = !1, w._draggable = !1, w._swipeable = !1, w._resizable = !1, w._wheelable = !1, w._inert = !1, w._isHover = !1, w.isRealHover = !1, w._isHoverByTouch = !1, w._isDown = !1, w._isFocused = !1, w._isTouchProtected = !1, w._inertiaOptions = new ha(), w.inertias = new ha(), w._hitOptions = {}, w._hoverOptions = {}, w._swipeOptions = {}, w._keyboardOptions = {}, w._mouseOptions = {}, w._cursorOptions = { defaultStyle: [{ property: "cursor", value: "default" }] }, w._disposers.push(w._eventDispatcher), w._element = u, w.className = "InteractionObject", w._disposers.push(new jd(w.inertias)), w._disposers.push(new jd(w.eventDisposers)), w.applyTheme(), w; + } + return re(R, U), Object.defineProperty(R.prototype, "events", { get: function() { + return this._eventDispatcher; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isHover", { get: function() { + return this._isHover; + }, set: function(u) { + this.isHover != u && (this._isHover = u, u ? Gs().overObjects.moveValue(this) : (this.isRealHover = !1, Gs().overObjects.removeValue(this))); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isHoverByTouch", { get: function() { + return this._isHoverByTouch; + }, set: function(u) { + this.isHoverByTouch != u && (this._isHoverByTouch = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "overPointers", { get: function() { + return this._overPointers || (this._overPointers = new Hs()), this._overPointers; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isDown", { get: function() { + return this._isDown; + }, set: function(u) { + this.isDown != u && (this._isDown = u, u ? Gs().downObjects.moveValue(this) : Gs().downObjects.removeValue(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "downPointers", { get: function() { + return this._downPointers || (this._downPointers = new Hs()), this._downPointers; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isFocused", { get: function() { + return this._isFocused; + }, set: function(u) { + this.isFocused != u && (this._isFocused = u, Gs().focusedObject = u ? this : void 0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isTouchProtected", { get: function() { + return this._isTouchProtected; + }, set: function(u) { + this._isTouchProtected != u && (this._isTouchProtected = u, u ? Gs().unprepElement(this) : (this.draggable || this.swipeable || this.trackable || this.resizable) && Gs().prepElement(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "clickable", { get: function() { + return this._clickable; + }, set: function(u) { + this._clickable !== u && (this._clickable = u, Gs().processClickable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "contextMenuDisabled", { get: function() { + return this._contextMenuDisabled; + }, set: function(u) { + this._contextMenuDisabled !== u && (this._contextMenuDisabled = u, Gs().processContextMenu(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hoverable", { get: function() { + return this._hoverable; + }, set: function(u) { + this._hoverable !== u && (this._hoverable = u, Gs().processHoverable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "trackable", { get: function() { + return this._trackable; + }, set: function(u) { + this._trackable !== u && (this._trackable = u, Gs().processTrackable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "draggable", { get: function() { + return this._draggable; + }, set: function(u) { + this._draggable !== u && (this._draggable = u, Gs().processDraggable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "swipeable", { get: function() { + return this._swipeable; + }, set: function(u) { + this._swipeable !== u && (this._swipeable = u, Gs().processSwipeable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "resizable", { get: function() { + return this._resizable; + }, set: function(u) { + this._resizable !== u && (this._resizable = u, Gs().processResizable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wheelable", { get: function() { + return this._wheelable; + }, set: function(u) { + this._wheelable !== u && (this._wheelable = u, Gs().processWheelable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inert", { get: function() { + return this._inert; + }, set: function(u) { + this._inert !== u && (this._inert = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "focusable", { get: function() { + return this._focusable; + }, set: function(u) { + this._focusable !== u && (this._focusable = u, this._focusable && this.tabindex == -1 && (this._tabindex = 1), Gs().processFocusable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tabindex", { get: function() { + return at(this._tabindex, -1); + }, set: function(u) { + this._tabindex !== u && (this._tabindex = u, u > -1 && (this.focusable = !0), Gs().processFocusable(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "element", { get: function() { + return this._element; + }, set: function(u) { + this._element = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "originalPosition", { get: function() { + return this._originalPosition || { x: 0, y: 0 }; + }, set: function(u) { + this._originalPosition = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "originalScale", { get: function() { + return at(this._originalScale, 1); + }, set: function(u) { + this._originalScale !== u && (this._originalScale = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "originalAngle", { get: function() { + return at(this._originalAngle, 0); + }, set: function(u) { + this._originalAngle !== u && (this._originalAngle = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inertiaOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("inertiaOptions", this._inertiaOptions) : this._inertiaOptions; + }, set: function(u) { + this._inertiaOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hitOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("hitOptions", this._hitOptions) : this._hitOptions; + }, set: function(u) { + this._hitOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hoverOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("hoverOptions", this._hoverOptions) : this._hoverOptions; + }, set: function(u) { + this._hoverOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "swipeOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("swipeOptions", this._swipeOptions) : this._swipeOptions; + }, set: function(u) { + this._swipeOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "keyboardOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("keyboardOptions", this._keyboardOptions) : this._keyboardOptions; + }, set: function(u) { + this._keyboardOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "mouseOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("mouseOptions", this._mouseOptions) : this._mouseOptions; + }, set: function(u) { + this._mouseOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cursorOptions", { get: function() { + return this.sprite && this.sprite._adapterO ? this.sprite._adapterO.apply("cursorOptions", this._cursorOptions) : this._cursorOptions; + }, set: function(u) { + this._cursorOptions = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.inertiaOptions = u.inertiaOptions, this.hitOptions = u.hitOptions, this.hoverOptions = u.hoverOptions, this.swipeOptions = u.swipeOptions, this.keyboardOptions = u.keyboardOptions, this.cursorOptions = u.cursorOptions, this.contextMenuDisabled = u.contextMenuDisabled, Gs().applyCursorOverStyle(this); + }, R.prototype.setEventDisposer = function(u, w, $) { + var G = this.eventDisposers.getKey(u); + w ? G == null && this.eventDisposers.setKey(u, $()) : G != null && (G.dispose(), this.eventDisposers.removeKey(u)); + }, R.prototype.dispose = function() { + U.prototype.dispose.call(this); + var u = Gs(); + u.overObjects.removeValue(this), u.downObjects.removeValue(this), u.trackedObjects.removeValue(this), u.transformedObjects.removeValue(this), this.isHover && this.wheelable && u.unlockWheel(), u.focusedObject === this && (u.focusedObject = void 0); + }, R; + }(vi), fL = function() { + function U(R, u) { + this._disposed = !1, this.directionX = 0, this.directionY = 0, this.interaction = R, this.keyboardEvent = u, this._startedOn = (/* @__PURE__ */ new Date()).getTime(), Gs().processDragStart(R), qo.animations.push(this), this.update(); + } + return U.prototype.update = function() { + var R = this.interaction, u = Gs().getKeyboardOption(R, "speed"), w = Gs().getKeyboardOption(R, "accelleration"), $ = Gs().getKeyboardOption(R, "accellerationDelay"), G = { x: 0, y: 0 }; + this.keyboardEvent.shiftKey ? (u *= 0.5, w = 1) : this.keyboardEvent.ctrlKey && (u *= 2); + var K = (/* @__PURE__ */ new Date()).getTime() - this._startedOn, ne = K - $; + if (w > 0 && ne > 0) { + var ue = K / $; + K = $, G.x += this.directionX * (u * w * ue * ne), G.y += this.directionY * (u * w * ue * ne); + } + G.x += this.directionX * (u * K), G.y += this.directionY * (u * K), Gs().handleTransformMove(R, G, { x: 0, y: 0 }, this.keyboardEvent, !0, !1); + }, U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + this._disposed || (Gs().processDragStop(this.interaction), ki(qo.animations, this)); + }, U; + }(), U3 = function(U) { + function R(u, w, $, G) { + var K = U.call(this) || this; + return K.animations = [], K.className = "Inertia", K.interaction = u, K.type = w, K.point = $, K.startPoint = G, K._disposers.push(new Wb(K.animations)), K; + } + return re(R, U), Object.defineProperty(R.prototype, "x", { get: function() { + return this.point.x; + }, set: function(u) { + le(u) && (this.point.x = u, this.handleMove()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y", { get: function() { + return this.point.y; + }, set: function(u) { + le(u) && (this.point.y = u, this.handleMove()); + }, enumerable: !0, configurable: !0 }), R.prototype.handleMove = function() { + if (this.interaction.events.isEnabled("drag")) { + var u = { type: "drag", target: this.interaction, shift: { x: this.x - this.startPoint.x, y: this.y - this.startPoint.y }, startPoint: this.startPoint, point: { x: this.x, y: this.y }, touch: !1 }; + this.interaction.events.dispatchImmediately("drag", u); + } + }, R.prototype.done = function() { + this.interaction.inertias.removeKey(this.type), this.type === "move" && Gs().processDragStop(this.interaction), this.dispose(); + }, R; + }(Ht), $8 = function() { + function U() { + } + return U.prototype.getEventKey = function(R) { + var u; + switch (R.keyCode || R.which) { + case 38: + u = "up"; + break; + case 40: + u = "down"; + break; + case 37: + u = "left"; + break; + case 39: + u = "right"; + break; + case 13: + u = "enter"; + break; + case 27: + u = "esc"; + break; + case 36: + case 36: + u = "home"; + break; + case 35: + case 35: + u = "end"; + break; + case 9: + u = "tab"; + break; + case 17: + u = "ctrl"; + break; + case 18: + u = "alt"; + break; + case 16: + u = "shift"; + break; + case 32: + u = "space"; + break; + case 33: + u = "pgup"; + break; + case 34: + u = "pgdn"; + break; + case 45: + u = "ins"; + break; + case 46: + u = "del"; + break; + case 107: + u = "plus"; + break; + case 109: + u = "minus"; + break; + default: + u = "other"; + } + return u; + }, U.prototype.isKey = function(R, u) { + var w = this.getEventKey(R); + return st(u) && (u = [u]), u.indexOf(w) !== -1; + }, U.prototype.shiftKey = function(R) { + return R.shiftKey; + }, U.prototype.ctrlKey = function(R) { + return R.ctrlKey; + }, U.prototype.altKey = function(R) { + return R.altKey; + }, U.prototype.metaKey = function(R) { + return R.metaKey; + }, U; + }(), dg = new $8(), z3 = { millisecond: 1, second: 1e3, minute: 6e4, hour: 36e5, day: 864e5, week: 6048e5, month: 2592e6, year: 31536e6 }; + function H3(U) { + switch (U) { + case "year": + return; + case "month": + return "year"; + case "week": + case "day": + return "month"; + case "hour": + return "day"; + case "minute": + return "hour"; + case "second": + return "minute"; + case "millisecond": + return "second"; + } + } + function Tu(U, R) { + return Ee(R) || (R = 1), z3[U] * R; + } + function IC() { + return /* @__PURE__ */ new Date(); + } + function Om() { + return IC().getTime(); + } + function Jx(U) { + return new Date(U.getTime()); + } + function AC(U, R, u, w) { + U = new Date(U.getTime()), R = new Date(R.getTime()); + var $ = 0, G = 0; + w || u == "millisecond" || ($ = U.getTimezoneOffset(), U.setUTCMinutes(U.getUTCMinutes() - $), G = R.getTimezoneOffset(), R.setUTCMinutes(R.getUTCMinutes() - G)); + var K = !1; + switch (u) { + case "year": + U.getUTCFullYear() != R.getUTCFullYear() && (K = !0); + break; + case "month": + (U.getUTCFullYear() != R.getUTCFullYear() || U.getUTCMonth() != R.getUTCMonth()) && (K = !0); + break; + case "day": + (U.getUTCMonth() != R.getUTCMonth() || U.getUTCDate() != R.getUTCDate()) && (K = !0); + break; + case "hour": + U.getUTCHours() != R.getUTCHours() && (K = !0); + break; + case "minute": + U.getUTCMinutes() != R.getUTCMinutes() && (K = !0); + break; + case "second": + U.getUTCSeconds() != R.getUTCSeconds() && (K = !0); + break; + case "millisecond": + U.getTime() != R.getTime() && (K = !0); + } + if (K) + return !0; + var ne = H3(u); + return !!ne && (U.setUTCMinutes(U.getUTCMinutes() + $), R.setUTCMinutes(R.getUTCMinutes() + G), AC(U, R, ne, w)); + } + function cp(U, R, u, w) { + var $ = 0; + switch (w || R == "millisecond" || ($ = U.getTimezoneOffset(), U.setUTCMinutes(U.getUTCMinutes() - $)), R) { + case "day": + var G = U.getUTCDate(); + U.setUTCDate(G + u); + break; + case "second": + var K = U.getUTCSeconds(); + U.setUTCSeconds(K + u); + break; + case "millisecond": + var ne = U.getUTCMilliseconds(); + U.setUTCMilliseconds(ne + u); + break; + case "hour": + var ue = U.getUTCHours(); + U.setUTCHours(ue + u); + break; + case "minute": + var we = U.getUTCMinutes(); + U.setUTCMinutes(we + u); + break; + case "year": + var De = U.getUTCFullYear(); + U.setUTCFullYear(De + u); + break; + case "month": + var $e = U.getUTCMonth(); + U.setUTCMonth($e + u); + break; + case "week": + var Ke = U.getUTCDate(); + U.setUTCDate(Ke + 7 * u); + } + if (!w && R != "millisecond" && (U.setUTCMinutes(U.getUTCMinutes() + $), R == "day" || R == "week" || R == "month" || R == "year")) { + var Ze = U.getTimezoneOffset(); + if (Ze != $) { + var pt = Ze - $; + U.setUTCMinutes(U.getUTCMinutes() + pt), U.getTimezoneOffset() != Ze && U.setUTCMinutes(U.getUTCMinutes() - pt); + } + } + return U; + } + function Uh(U, R, u, w, $, G, K, ne) { + K === void 0 && (K = 0), le(u) || (u = 1); + var ue = 0; + switch (ne && ["day", "month", "week", "year"].indexOf(R) != -1 && (U = nA(U, ne)), $ || R == "millisecond" || (ue = U.getTimezoneOffset(), U.setUTCMinutes(U.getUTCMinutes() - ue)), R) { + case "day": + var we = U.getUTCDate(); + if (u > 1) { + if (G) { + G = Uh(G, "day", 1); + var De = U.getTime() - G.getTime(), $e = Math.floor(De / Tu("day") / u), Ke = Tu("day", $e * u); + U.setTime(G.getTime() + Ke - ue * Tu("minute")); + } + } else + U.setUTCDate(we); + U.setUTCHours(0, 0, 0, 0); + break; + case "second": + var Ze = U.getUTCSeconds(); + u > 1 && (Ze = Math.floor(Ze / u) * u), U.setUTCSeconds(Ze, 0); + break; + case "millisecond": + if (u == 1) + return U; + var pt = U.getUTCMilliseconds(); + pt = Math.floor(pt / u) * u, U.setUTCMilliseconds(pt); + break; + case "hour": + var Vt = U.getUTCHours(); + u > 1 && (Vt = Math.floor(Vt / u) * u), U.setUTCHours(Vt, K, 0, 0); + break; + case "minute": + var Yt = U.getUTCMinutes(); + pt = U.getUTCMilliseconds(), u > 1 && (Yt = Math.floor(Yt / u) * u), U.setUTCMinutes(Yt, 0, 0); + break; + case "month": + var ci = U.getUTCMonth(); + u > 1 && (ci = Math.floor(ci / u) * u), U.setUTCMonth(ci, 1), U.setUTCHours(0, K, 0, 0); + break; + case "year": + var ai = U.getUTCFullYear(); + u > 1 && (ai = Math.floor(ai / u) * u), U.setUTCFullYear(ai, 0, 1), U.setUTCHours(0, K, 0, 0); + break; + case "week": + var Gi = U.getUTCDate(), Ji = U.getUTCDay(); + le(w) || (w = 1), Gi = Ji >= w ? Gi - Ji + w : Gi - (7 + Ji) + w, U.setUTCDate(Gi), U.setUTCHours(0, K, 0, 0); + } + if (!$ && R != "millisecond" && (U.setUTCMinutes(U.getUTCMinutes() + ue), R == "day" || R == "week" || R == "month" || R == "year")) { + var Ci = U.getTimezoneOffset(); + if (Ci != ue) { + var Hi = Ci - ue; + U.setUTCMinutes(U.getUTCMinutes() + Hi); + } + } + return U; + } + function nA(U, R) { + return new Date(U.toLocaleString("en-US", { timeZone: R })); + } + function B8(U) { + var R = /* @__PURE__ */ new Date(); + return R.setHours(0, 0, 0, 0), nA(R, U).getMinutes(); + } + var mL = function(U) { + function R() { + var u = U.call(this) || this; + return u._globalEventsAdded = !1, u._pointerEvents = { pointerdown: "mousedown", pointerup: "mouseup", pointermove: "mousemove", pointercancel: "mouseup", pointerover: "mouseover", pointerout: "mouseout", wheel: "wheel" }, u._usePointerEventsOnly = !1, u._useTouchEventsOnly = !1, u._addHoverEvents = !0, u._passiveSupported = !1, u._delayedEvents = { out: [] }, u.overObjects = new Hs(), u.downObjects = new Hs(), u.trackedObjects = new Hs(), u.transformedObjects = new Hs(), u.pointers = new ha(), u.inertiaOptions = new ha(), u.hitOptions = { doubleHitTime: 300, hitTolerance: 10, noFocus: !0 }, u.hoverOptions = { touchOutBehavior: "leave", touchOutDelay: 1e3 }, u.swipeOptions = { time: 500, verticalThreshold: 75, horizontalThreshold: 30 }, u.keyboardOptions = { speed: 0.1, accelleration: 1.2, accellerationDelay: 2e3 }, u.mouseOptions = { sensitivity: 1 }, u.className = "Interaction", u.body = u.getInteraction(document.body), u._disposers.push(u.body), window.hasOwnProperty("PointerEvent") ? (u._pointerEvents.pointerdown = "pointerdown", u._pointerEvents.pointerup = "pointerup", u._pointerEvents.pointermove = "pointermove", u._pointerEvents.pointercancel = "pointercancel", u._pointerEvents.pointerover = "pointerover", u._pointerEvents.pointerout = "pointerout") : window.hasOwnProperty("MSPointerEvent") ? (u._pointerEvents.pointerdown = "MSPointerDown", u._pointerEvents.pointerup = "MSPointerUp", u._pointerEvents.pointermove = "MSPointerMove", u._pointerEvents.pointercancel = "MSPointerUp", u._pointerEvents.pointerover = "MSPointerOver", u._pointerEvents.pointerout = "MSPointerOut") : typeof matchMedia < "u" && matchMedia("(pointer:fine)").matches ? "ontouchstart" in window && (u._addHoverEvents = !1, u._useTouchEventsOnly = !0) : window.navigator.userAgent.match(/MSIE /) || u.fullFF() ? u._usePointerEventsOnly = !0 : u._useTouchEventsOnly = !0, "onwheel" in document.createElement("div") ? u._pointerEvents.wheel = "wheel" : Ee(document.onmousewheel) && (u._pointerEvents.wheel = "mousewheel"), u.inertiaOptions.setKey("move", { time: 100, duration: 500, factor: 1, easing: F3 }), u.inertiaOptions.setKey("resize", { time: 100, duration: 500, factor: 1, easing: F3 }), u._passiveSupported = R.passiveSupported, u.applyTheme(), u; + } + return re(R, U), R.prototype.fullFF = function() { + return window.navigator.userAgent.match(/Firefox/) && !window.navigator.userAgent.match(/Android/); + }, R.prototype.debug = function() { + }, R.prototype.addGlobalEvents = function() { + var u = this; + this._globalEventsAdded || (this._useTouchEventsOnly || (this._disposers.push(Uc(document, this._pointerEvents.pointerdown, function(w) { + u.handleGlobalPointerDown(w); + })), this._disposers.push(Uc(document, this._pointerEvents.pointermove, function(w) { + u.handleGlobalPointerMove(w); + })), this._disposers.push(Uc(document, this._pointerEvents.pointerup, function(w) { + u.handleGlobalPointerUp(w); + })), this._disposers.push(Uc(document, this._pointerEvents.pointercancel, function(w) { + u.handleGlobalPointerUp(w, !0); + })), this._disposers.push(Uc(document, "mouseenter", function(w) { + Ee(w.relatedTarget) || w.buttons != 0 && w.which != 0 || u.handleDocumentLeave(w); + }))), this._usePointerEventsOnly || (this._disposers.push(Uc(document, "touchstart", function(w) { + u.handleGlobalTouchStart(w); + })), this._disposers.push(Uc(document, "touchmove", function(w) { + u.handleGlobalTouchMove(w); + })), this._disposers.push(Uc(document, "touchend", function(w) { + u.handleGlobalTouchEnd(w); + }))), this._disposers.push(Uc(document, "keydown", function(w) { + u.handleGlobalKeyDown(w); + })), this._disposers.push(Uc(document, "keyup", function(w) { + u.handleGlobalKeyUp(w); + })), this._globalEventsAdded = !0); + }, R.prototype.processClickable = function(u) { + this.processTouchable(u); + }, R.prototype.processContextMenu = function(u) { + u.contextMenuDisabled ? u.eventDisposers.hasKey("contextMenuDisabled") || u.eventDisposers.setKey("contextMenuDisabled", Uc(u.element, "contextmenu", function(w) { + w.preventDefault(); + })) : u.eventDisposers.hasKey("contextMenuDisabled") && u.eventDisposers.getKey("contextMenuDisabled").dispose(); + }, R.prototype.processHoverable = function(u) { + var w = this; + if (u.hoverable || u.trackable) + this.addGlobalEvents(), this.applyCursorOverStyle(u), !u.eventDisposers.hasKey("hoverable") && this._addHoverEvents && u.eventDisposers.setKey("hoverable", new kn([Uc(u.element, this._pointerEvents.pointerout, function(G) { + return w.handlePointerOut(u, G); + }), Uc(u.element, this._pointerEvents.pointerover, function(G) { + return w.handlePointerOver(u, G); + })])), u.trackable; + else { + var $ = u.eventDisposers.getKey("hoverable"); + $ != null && ($.dispose(), u.eventDisposers.removeKey("hoverable")); + } + this.processTouchable(u); + }, R.prototype.processMovable = function(u) { + (u.draggable || u.swipeable || u.trackable || u.resizable) && (this.isGlobalElement(u) || u.isTouchProtected || this.prepElement(u), this.applyCursorOverStyle(u)), this.processTouchable(u); + }, R.prototype.processTrackable = function(u) { + this.processHoverable(u), this.processMovable(u), u.trackable ? this.trackedObjects.moveValue(u) : this.trackedObjects.removeValue(u); + }, R.prototype.processDraggable = function(u) { + this.processMovable(u); + }, R.prototype.processSwipeable = function(u) { + this.processMovable(u); + }, R.prototype.processResizable = function(u) { + this.processMovable(u); + }, R.prototype.processWheelable = function(u) { + var w = this; + if (u.wheelable) + u.eventDisposers.hasKey("wheelable") || u.eventDisposers.setKey("wheelable", new kn([Uc(u.element, this._pointerEvents.wheel, function(G) { + return w.handleMouseWheel(u, G); + }, !!this._passiveSupported && { passive: !1 }), u.events.on("out", function(G) { + u.wheelable && w.unlockWheel(); + }), u.events.on("over", function(G) { + u.wheelable && w.lockWheel(); + })])); + else { + var $ = u.eventDisposers.getKey("wheelable"); + $ != null && ($.dispose(), u.eventDisposers.removeKey("wheelable")); + } + }, R.prototype.processFocusable = function(u) { + var w = this; + if (u.focusable === !0 && u.tabindex > -1 && !this._useTouchEventsOnly) + u.eventDisposers.hasKey("focusable") || u.eventDisposers.setKey("focusable", new kn([Uc(u.element, "focus", function(G) { + return w.handleFocus(u, G); + }), Uc(u.element, "blur", function(G) { + return w.handleBlur(u, G); + }), Uc(u.element, this._pointerEvents.pointerdown, function(G) { + return w.handleFocusBlur(u, G); + }), Uc(u.element, "touchstart", function(G) { + return w.handleFocusBlur(u, G); + }, !!this._passiveSupported && { passive: !1 })])); + else { + var $ = u.eventDisposers.getKey("focusable"); + $ != null && ($.dispose(), u.eventDisposers.removeKey("focusable")); + } + }, R.prototype.processTouchable = function(u) { + var w = this; + if (u.clickable || u.hoverable || u.trackable || u.draggable || u.swipeable || u.resizable) + this.addGlobalEvents(), u.eventDisposers.hasKey("touchable") || (this._useTouchEventsOnly || this._usePointerEventsOnly ? this._useTouchEventsOnly ? this._usePointerEventsOnly || u.eventDisposers.setKey("touchable", Uc(u.element, "touchstart", function(G) { + return w.handleTouchDown(u, G); + }, !!this._passiveSupported && { passive: !1 })) : u.eventDisposers.setKey("touchable", Uc(u.element, this._pointerEvents.pointerdown, function(G) { + return w.handlePointerDown(u, G); + })) : u.eventDisposers.setKey("touchable", new kn([Uc(u.element, this._pointerEvents.pointerdown, function(G) { + return w.handlePointerDown(u, G); + }), Uc(u.element, "touchstart", function(G) { + return w.handleTouchDown(u, G); + }, !!this._passiveSupported && { passive: !1 })]))); + else { + var $ = u.eventDisposers.getKey("touchable"); + $ != null && ($.dispose(), u.eventDisposers.removeKey("touchable")); + } + }, R.prototype.handleFocus = function(u, w) { + if (u.focusable) { + if (u.isFocused = !0, u.events.isEnabled("focus") && !qo.isPaused) { + var $ = { type: "focus", target: u, event: w }; + u.events.dispatchImmediately("focus", $); + } + } else + w.preventDefault(); + }, R.prototype.handleFocusBlur = function(u, w) { + u.focusable !== !1 && this.getHitOption(u, "noFocus") && u.events.once("focus", function() { + u.events.disableType("blur"), Kx(), u.sprite && u.sprite.handleBlur(), u.events.enableType("blur"); + }); + }, R.prototype.handleBlur = function(u, w) { + if (u.focusable) { + if (u.isFocused = !1, u.events.isEnabled("blur") && !qo.isPaused) { + var $ = { type: "blur", target: u, event: w }; + u.events.dispatchImmediately("blur", $); + } + } else + w.preventDefault(); + }, R.prototype.handleGlobalKeyDown = function(u) { + if (this.focusedObject) { + if (dg.isKey(u, "esc")) + Kx(); + else if (this.focusedObject.draggable && dg.isKey(u, ["up", "down", "left", "right"])) { + u.preventDefault(); + var w = this.focusedObject, $ = "interactionKeyboardObject"; + if (w.eventDisposers.hasKey($)) + return; + var G = new fL(w, u); + switch (w.eventDisposers.setKey($, G), dg.getEventKey(u)) { + case "up": + G.directionY = -1; + break; + case "down": + G.directionY = 1; + break; + case "left": + G.directionX = -1; + break; + case "right": + G.directionX = 1; + } + } + } + }, R.prototype.handleGlobalKeyUp = function(u) { + var w = "interactionKeyboardObject"; + if (this.focusedObject) { + var $ = this.focusedObject.eventDisposers.getKey(w); + $ != null && (u.preventDefault(), $.dispose(), this.focusedObject.eventDisposers.removeKey(w)); + var G = this.focusedObject.sprite; + dg.isKey(u, "enter") && G && (G.events.isEnabled("hit") || G.events.isEnabled("toggled") ? this.focusedObject.dispatchImmediately("hit") : G.showTooltipOn == "hit" && this.focusedObject.dispatchImmediately("up")); + } + }, R.prototype.handleGlobalPointerMove = function(u) { + var w = this.getPointer(u); + if (w.point = this.getPointerPoint(u), this.events.isEnabled("track") && !qo.isPaused) { + var $ = { type: "track", target: this, event: u, pointer: w, touch: w.touch }; + this.events.dispatchImmediately("track", $); + } + this.addBreadCrumb(w, w.point), this.handleGlobalMove(w, u); + }, R.prototype.handleGlobalPointerDown = function(u) { + this.processDelayed(); + var w = this.getPointer(u); + if (this.events.isEnabled("down") && !qo.isPaused) { + var $ = { type: "down", target: this, event: u, pointer: w, touch: w.touch }; + this.events.dispatchImmediately("down", $); + } + }, R.prototype.preventTouchAction = function(u) { + u.defaultPrevented || u.preventDefault(); + }, R.prototype.handleGlobalPointerUp = function(u, w) { + w === void 0 && (w = !1); + var $ = this.getPointer(u); + if (this.events.isEnabled("up") && !qo.isPaused) { + var G = { type: "up", target: this, event: u, pointer: $, touch: $.touch }; + this.events.dispatchImmediately("up", G); + } + this.handleGlobalUp($, u, w); + }, R.prototype.handleGlobalTouchMove = function(u) { + for (var w = 0; w < u.changedTouches.length; w++) { + var $ = this.getPointer(u.changedTouches[w]); + if ($.point = this.getPointerPoint(u.changedTouches[w]), this.events.isEnabled("track") && !qo.isPaused) { + var G = { type: "track", target: this, event: u, pointer: $, touch: $.touch }; + this.events.dispatchImmediately("track", G); + } + this.addBreadCrumb($, $.point), this.handleGlobalMove($, u); + } + }, R.prototype.handleGlobalTouchStart = function(u) { + this.processDelayed(); + for (var w = 0; w < u.changedTouches.length; w++) { + var $ = this.getPointer(u.changedTouches[w]); + if (!this._usePointerEventsOnly && this.events.isEnabled("down") && !qo.isPaused) { + var G = { type: "down", target: this, event: u, pointer: $, touch: $.touch }; + this.events.dispatchImmediately("down", G); + } + } + }, R.prototype.handleGlobalTouchEnd = function(u) { + for (var w = 0; w < u.changedTouches.length; w++) { + var $ = this.getPointer(u.changedTouches[w]); + if (this.events.isEnabled("up") && !qo.isPaused) { + var G = { type: "up", target: this, event: u, pointer: $, touch: $.touch }; + this.events.dispatchImmediately("up", G); + } + this.handleGlobalUp($, u); + } + }, R.prototype.handlePointerDown = function(u, w) { + var $ = this.getPointer(w); + ($.touch || w.which == 1 || w.which == 3) && ($.button = w.which, this.resetPointer($, w), this.handleDown(u, $, w)); + }, R.prototype.handlePointerOver = function(u, w) { + var $ = this.getPointer(w); + this.handleOver(u, $, w); + }, R.prototype.handlePointerOut = function(u, w) { + var $ = this.getPointer(w); + this.handleOut(u, $, w); + }, R.prototype.handleMouseWheel = function(u, w) { + var $ = this.getPointer(w); + $.point = this.getPointerPoint(w); + var G, K, ne = 1; + if (w.deltaMode == 1 && (ne = 50), ne *= this.getMouseOption(u, "sensitivity"), !(w instanceof WheelEvent)) + throw new Error("Invalid event type"); + G = Math.round(-1 * w.wheelDeltaX || w.deltaX * ne), K = Math.round(-1 * w.wheelDeltaY || w.deltaY * ne), this.handleWheel(u, $, G, K, w); + }, R.prototype.handleTouchDown = function(u, w) { + for (var $ = 0; $ < w.changedTouches.length; $++) { + var G = this.getPointer(w.changedTouches[$]); + this.maybePreventDefault(u, w, G), this.resetPointer(G, w.changedTouches[$]), this.handleDown(u, G, w); + } + }, R.prototype.handleHit = function(u, w, $) { + var G = Om(); + if (u.lastHit && u.lastHit >= G - this.getHitOption(u, "doubleHitTime")) { + if (G - u.lastHit < 100) + return; + if (u.lastHit = void 0, u.lastHitPointer = void 0, u.events.isEnabled("doublehit") && !qo.isPaused) { + var K = { type: "doublehit", target: u, point: w.point, event: $, touch: w.touch }; + u.events.dispatchImmediately("doublehit", K); + } + } else + u.lastHit = G, u.lastHitPointer = w, w.button === 3 ? u.events.isEnabled("rightclick") && !qo.isPaused && (K = { type: "rightclick", target: u, event: $ }, u.events.dispatchImmediately("rightclick", K)) : u.events.isEnabled("hit") && !qo.isPaused && (K = { type: "hit", target: u, event: $, point: w.point, touch: w.touch }, u.events.dispatchImmediately("hit", K)); + }, R.prototype.handleOver = function(u, w, $, G) { + if (u.hoverable) { + var K = !1; + if (this.shouldCancelHovers(w) && this.areTransformed() && this.moved(w, this.getHitOption(u, "hitTolerance")) && (K = !0, this.cancelAllHovers($)), this.processDelayed(), u.overPointers.moveValue(w), !u.isRealHover && (K || (u.isHover = !0, u.isRealHover = !0, this.overObjects.moveValue(u)), this.handleTrack(this.body, w, $, !0), u.events.isEnabled("over") && !qo.isPaused && !K)) { + var ne = { type: "over", target: u, event: $, pointer: w, touch: w.touch }; + u.events.dispatchImmediately("over", ne); + } + } + }, R.prototype.handleOut = function(u, w, $, G, K) { + var ne = this; + if (G === void 0 && (G = !1), K === void 0 && (K = !1), u.hoverable && (u.overPointers.removeValue(w), u.isHover && (!u.hasDelayedOut || K))) { + if (G && u.overPointers.length) + return; + if (w && w.touch && !K && !this.old(w)) { + var ue = this.getHoverOption(u, "touchOutBehavior"); + if (ue == "leave") + return this._delayedEvents.out.push({ type: "out", io: u, pointer: w, event: $, keepUntil: Om() + 500 }), void (u.hasDelayedOut = !0); + if (ue == "delay" && this.getHoverOption(u, "touchOutDelay")) + return void this._delayedEvents.out.push({ type: "out", io: u, pointer: w, event: $, keepUntil: Om() + 500, timeout: this.setTimeout(function() { + ne.handleOut(u, w, $, !0); + }, this.getHoverOption(u, "touchOutDelay")) }); + } + if (u.isHover = !1, this.overObjects.removeValue(u), !u.isDisposed() && u.events.isEnabled("out") && !qo.isPaused) { + var we = { type: "out", target: u, event: $, pointer: w, touch: w.touch }; + u.events.dispatchImmediately("out", we); + } + u.overPointers.clear(), u.hasDelayedOut = !1; + } + }, R.prototype.processDelayed = function() { + for (var u; u = this._delayedEvents.out.pop(); ) + u.timeout && u.timeout.dispose(), this.handleOut(u.io, u.pointer, u.event, !1, !0); + }, R.prototype.handleDown = function(u, w, $) { + if (this.maybePreventDefault(u, $, w), u.inert && this.stopInertia(u), this.handleOver(u, w, $, !0), u.downPointers.moveValue(w), this.applyCursorDownStyle(u, w), u.isDown || (u.focusable !== !1 && this.getHitOption(u, "noFocus") && this.focusedObject && Kx(), u.isDown = !0, this.downObjects.moveValue(u), u.draggable && this.processDragStart(u, w, $), u.resizable && this.processResizeStart(u, w, $)), u.events.isEnabled("down") && !qo.isPaused) { + var G = { type: "down", target: u, event: $, pointer: w, touch: w.touch }; + u.events.dispatchImmediately("down", G); + } + }, R.prototype.handleGlobalUp = function(u, w, $) { + var G = this; + $ === void 0 && ($ = !1); + var K = this.downObjects.values.slice(); + K.sort(function(ne, ue) { + if (ne && ue) { + var we = ne.element.compareDocumentPosition(ue.element); + return we & Node.DOCUMENT_POSITION_CONTAINED_BY ? 1 : we & Node.DOCUMENT_POSITION_CONTAINS ? -1 : 0; + } + return 0; + }), _i(K, function(ne) { + ne && ne.downPointers.contains(u) && G.handleUp(ne, u, w, $); + }); + }, R.prototype.handleDocumentLeave = function(u) { + var w = this; + er(this.downObjects.backwards().iterator(), function($) { + $.downPointers.each(function(G) { + w.handleUp($, G, u); + }); + }); + }, R.prototype.handleUp = function(u, w, $, G) { + if (G === void 0 && (G = !1), this.restoreCursorDownStyle(u, w), u.downPointers.removeValue(w), (w.touch || this._useTouchEventsOnly) && this.handleOut(u, w, $, !0), u.isDown) { + if (u.downPointers.length == 0 && (u.isDown = !1, this.downObjects.removeValue(u)), u.events.isEnabled("up") && !qo.isPaused) { + var K = { type: "up", target: u, event: $, pointer: w, touch: w.touch }; + u.events.dispatchImmediately("up", K); + } + G || (u.swipeable && this.swiped(u, w) ? this.handleSwipe(u, w, $) : (u.clickable && !this.moved(w, this.getHitOption(u, "hitTolerance")) && this.handleHit(u, w, $), u.inert && this.moved(w, this.getHitOption(u, "hitTolerance")) ? this.handleInertia(u, w) : u.draggable && this.processDragStop(u, w, $), u.resizable && this.processResizeStop(u, w, $))); + } + }, R.prototype.maybePreventDefault = function(u, w, $) { + !Ee(w) || !(u.draggable || u.swipeable || u.trackable || u.resizable) || this.isGlobalElement(u) || w.cancelable === !1 || u.isTouchProtected && $ && $.touch || w.preventDefault(); + }, R.prototype.cancelAllHovers = function(u) { + var w = this; + er(this.overObjects.backwards().iterator(), function($) { + if ($) { + var G = $.overPointers.getIndex(0); + w.handleOut($, G, u, !0, !0); + } + }); + }, R.prototype.shouldCancelHovers = function(u) { + return zd.disableHoverOnTransform == "touch"; + }, R.prototype.handleGlobalMove = function(u, w) { + var $, G = this; + if (!u.touch) { + var K = typeof ($ = u.lastEvent).composedPath == "function" ? $.composedPath()[0] : $.target; + er(this.overObjects.backwards().iterator(), function(ne) { + if (ne && ne.overPointers.contains(u) && ne.hoverable) { + var ue = !1; + ne.element && u.lastEvent && N8(ne.element, K) || (ue = !0), ue && G.handleOut(ne, u, w, !0); + } + }); + } + er(this.transformedObjects.backwards().iterator(), function(ne) { + !ne.downPointers.contains(u) || ne.swipeable && G.swiping(ne, u) || !ne.draggable && !ne.resizable || G.handleTransform(ne, w); + }), er(this.trackedObjects.backwards().iterator(), function(ne) { + ne.overPointers.contains(u) || G.handleTrack(ne, u, w); + }); + }, R.prototype.handleTrack = function(u, w, $, G) { + if (G === void 0 && (G = !1), (G || this.moved(w, 0)) && u.events.isEnabled("track") && !qo.isPaused) { + var K = { type: "track", target: u, event: $, point: w.point, pointer: w, touch: w.touch }; + u.events.dispatchImmediately("track", K); + } + }, R.prototype.handleSwipe = function(u, w, $) { + if (u.events.isEnabled("swipe") && !qo.isPaused) { + var G = { type: "swipe", target: u, event: $, touch: w.touch }; + u.events.dispatchImmediately("swipe", G); + } + w.startPoint.x < w.point.x ? u.events.isEnabled("swiperight") && !qo.isPaused && (G = { type: "swiperight", target: u, event: $, touch: w.touch }, u.events.dispatchImmediately("swiperight", G)) : u.events.isEnabled("swipeleft") && !qo.isPaused && (G = { type: "swipeleft", target: u, event: $, touch: w.touch }, u.events.dispatchImmediately("swipeleft", G)); + }, R.prototype.handleWheel = function(u, w, $, G, K) { + var ne = { x: $, y: G }; + u.events.isEnabled("wheel") && !qo.isPaused && u.events.dispatchImmediately("wheel", { type: "wheel", target: u, event: K, point: w.point, shift: ne }), $ < 0 ? u.events.isEnabled("wheelleft") && !qo.isPaused && u.events.dispatchImmediately("wheelleft", { type: "wheelleft", target: u, event: K, point: w.point, shift: ne }) : $ > 0 ? u.events.isEnabled("swiperight") && !qo.isPaused && u.events.dispatchImmediately("wheelright", { type: "wheelright", target: u, event: K, point: w.point, shift: ne }) : G < 0 ? u.events.isEnabled("wheelup") && !qo.isPaused && u.events.dispatchImmediately("wheelup", { type: "wheelup", target: u, event: K, point: w.point, shift: ne }) : G > 0 && u.events.isEnabled("wheeldown") && !qo.isPaused && u.events.dispatchImmediately("wheeldown", { type: "wheeldown", target: u, event: K, point: w.point, shift: ne }); + }, R.prototype.handleInertia = function(u, w) { + u.draggable && u.downPointers.length === 0 && this.handleMoveInertia(u, w), u.resizable && u.downPointers.length > 1 && this.handleResizeInertia(u, w); + }, R.prototype.handleMoveInertia = function(u, w) { + var $ = u, G = { x: w.point.x, y: w.point.y }, K = { x: w.startPoint.x, y: w.startPoint.y }, ne = new U3($, "move", G, K), ue = this.getTrailPoint(w, Om() - this.getInertiaOption(u, "move", "time")); + if (ue !== void 0) { + var we = this.getInertiaOption(u, "move", "factor"), De = [{ to: w.point.x + (w.point.x - ue.point.x) * we, property: "x" }, { to: w.point.y + (w.point.y - ue.point.y) * we, property: "y" }], $e = new $f(ne, De, this.getInertiaOption(u, "move", "duration"), this.getInertiaOption(u, "move", "easing")).start(); + this._disposers.push($e.events.on("animationended", function(Ke) { + ne.done(); + })), u.inertias.setKey("move", ne); + } else + this.processDragStop(u, w, w.lastUpEvent); + }, R.prototype.handleResizeInertia = function(u, w) { + }, R.prototype.handleTransform = function(u, w) { + var $, G, K, ne = u.downPointers.getIndex(0), ue = null, we = null; + ne && (ue = ne.point, we = ne.startPoint), K = G = { x: u.originalPosition.x, y: u.originalPosition.y }; + for (var De = !0, $e = 1; $e < u.downPointers.length; $e++) { + var Ke = u.downPointers.getIndex($e); + if (we.x != Ke.startPoint.x && we.y != Ke.startPoint.y) { + De = !1, G = ($ = Ke).point, K = $.startPoint; + break; + } + } + var Ze = ne && this.moved(ne, 0); + if (u.draggable && ne && ne.dragStartEvents && ne.dragStartEvents.length && Ze && u.events.isEnabled("dragstart") && !qo.isPaused && u.events.dispatchImmediately("dragstart", ne.dragStartEvents.shift()), De && u.draggable) + this.handleTransformMove(u, ue, we, w, Ze, ne.touch), this.shouldCancelHovers(ne) && this.moved(ne, this.getHitOption(u, "hitTolerance")) && this.cancelAllHovers(w); + else { + var pt = $ && this.moved($, 0); + (this.shouldCancelHovers(ne) && this.moved(ne, this.getHitOption(u, "hitTolerance")) || this.shouldCancelHovers($) && this.moved($, this.getHitOption(u, "hitTolerance"))) && this.cancelAllHovers(w), u.draggable && u.resizable ? (this.handleTransformMove(u, ue, we, w, Ze && pt, ne.touch), this.handleTransformResize(u, ue, we, G, K, w, Ze && pt, ne.touch)) : (u.draggable && this.handleTransformMove(u, ue, we, w, Ze, ne.touch), !u.resizable || De && !w.ctrlKey || this.handleTransformResize(u, ue, we, G, K, w, Ze && pt, ne.touch)); + } + }, R.prototype.handleTransformMove = function(u, w, $, G, K, ne) { + if (K && u.events.isEnabled("drag") && !qo.isPaused && (!u.isTouchProtected || !ne)) { + var ue = { type: "drag", target: u, event: G, shift: { x: w.x - $.x, y: w.y - $.y }, startPoint: $, point: w, touch: ne }; + u.events.dispatchImmediately("drag", ue); + } + }, R.prototype.handleTransformResize = function(u, w, $, G, K, ne, ue, we) { + if (u.events.isEnabled("resize") && !qo.isPaused && (!u.isTouchProtected || !we)) { + var De = { type: "resize", target: u, event: ne, scale: q(w, $, G, K), startPoint1: $, point1: w, startPoint2: K, point2: G, touch: we }; + u.events.dispatchImmediately("resize", De); + } + }, R.prototype.processDragStart = function(u, w, $) { + this.transformedObjects.moveValue(u), this.shouldCancelHovers(w) && this.cancelAllHovers($); + var G = { type: "dragstart", target: u, event: $, touch: !!w && w.touch }; + w && (w.dragTarget = u), w && w.dragStartEvents ? w.dragStartEvents.push(G) : qo.isPaused || u.dispatchImmediately("dragstart", G); + }, R.prototype.processDragStop = function(u, w, $) { + if (w || (w = this.getDragPointer(u)), w && (w.dragTarget = void 0), this.transformedObjects.removeValue(u), (!w || this.moved(w, 0)) && u.events.isEnabled("dragstop") && !qo.isPaused) { + var G = { type: "dragstop", target: u, touch: !!w && w.touch }; + u.events.dispatchImmediately("dragstop", G); + } + }, R.prototype.processResizeStart = function(u, w, $) { + this.transformedObjects.moveValue(u); + }, R.prototype.processResizeStop = function(u, w, $) { + this.transformedObjects.removeValue(u); + }, R.prototype.dragStart = function(u, w) { + w || (w = this.getDragPointer(u)), w && this.handleDown(u, w, w.lastDownEvent); + }, R.prototype.dragStop = function(u, w, $) { + w || (w = this.getDragPointer(u)), w && !$ && this.handleGlobalUp(w, w.lastUpEvent, $); + }, R.prototype.getDragPointer = function(u) { + return u ? u.downPointers.getIndex(0) : this.transformedObjects.length ? this.getDragPointer(this.transformedObjects.getIndex(0)) : void 0; + }, R.prototype.getPointerId = function(u) { + return (Ee(u.identifier) ? "" + u.identifier : Ee(u.pointerId) ? "" + u.pointerId : "m").replace("-", ""); + }, R.prototype.getPointerPoint = function(u) { + return { x: u.clientX, y: u.clientY }; + }, R.prototype.getPointer = function(u) { + var w, $ = this.getPointerId(u), G = this.getPointerPoint(u); + return this.pointers.hasKey($) ? (w = this.pointers.getKey($)).touch = this.isPointerTouch(u) : (w = { id: $, touch: this.isPointerTouch(u), startPoint: G, startTime: Om(), point: G, track: [], swipeCanceled: !1, dragStartEvents: [] }, this.addBreadCrumb(w, G), this.pointers.setKey($, w)), w.lastEvent = u, this.lastPointer = w, w; + }, R.prototype.isPointerTouch = function(u) { + if (typeof Touch < "u" && u instanceof Touch) + return !0; + if (typeof PointerEvent < "u" && u instanceof PointerEvent && Ee(u.pointerType)) + switch (u.pointerType) { + case "touch": + case "pen": + case 2: + return !0; + case "mouse": + case 4: + return !1; + default: + return !(u instanceof MouseEvent); + } + else if (Ee(u.type) && u.type.match(/^mouse/)) + return !1; + return !0; + }, R.prototype.resetPointer = function(u, w) { + var $ = this.getPointerPoint(w); + u.startTime = Om(), u.startPoint = { x: $.x, y: $.y }, u.point = { x: $.x, y: $.y }, u.track = [], u.swipeCanceled = !1; + }, R.prototype.addBreadCrumb = function(u, w) { + u.track.push({ timestamp: Om(), point: w }); + }, R.prototype.lockDocument = function() { + this.prepElement(this.body); + }, R.prototype.unlockDocument = function() { + this.transformedObjects.length == 0 && this.restoreAllStyles(this.body); + }, R.prototype.lockElement = function(u) { + this.prepElement(u); + }, R.prototype.unlockElement = function(u) { + this.restoreAllStyles(u); + }, R.prototype.lockWheel = function() { + window.addEventListener(this._pointerEvents.wheel, this.wheelLockEvent, !!this._passiveSupported && { passive: !1 }); + }, R.prototype.unlockWheel = function() { + window.removeEventListener(this._pointerEvents.wheel, this.wheelLockEvent); + }, R.prototype.isLocalElement = function(u, w, $) { + var G = this.getCache("local_pointer_" + u.id); + if (Ee(G)) + return G; + var K = Hd(w) || document; + if (K.elementFromPoint) { + var ne = K.elementFromPoint(u.point.x, u.point.y), ue = ne && N8(w, ne); + return this.setCache("local_pointer_" + u.id + "_" + $, ue, 100), ue; + } + return !1; + }, R.prototype.wheelLockEvent = function(u) { + return u.preventDefault(), !1; + }, R.prototype.prepElement = function(u) { + var w = u.element; + if (w) { + for (var $ = ["touchAction", "webkitTouchAction", "MozTouchAction", "MSTouchAction", "msTouchAction", "oTouchAction", "userSelect", "webkitUserSelect", "MozUserSelect", "MSUserSelect", "msUserSelect", "oUserSelect", "touchSelect", "webkitTouchSelect", "MozTouchSelect", "MSTouchSelect", "msTouchSelect", "oTouchSelect", "touchCallout", "webkitTouchCallout", "MozTouchCallout", "MSTouchCallout", "msTouchCallout", "oTouchCallout", "contentZooming", "webkitContentZooming", "MozContentZooming", "MSContentZooming", "msContentZooming", "oContentZooming", "userDrag", "webkitUserDrag", "MozUserDrag", "MSUserDrag", "msUserDrag", "oUserDrag"], G = 0; G < $.length; G++) + $[G] in w.style && this.setTemporaryStyle(u, $[G], "none"); + this.setTemporaryStyle(u, "tapHighlightColor", "rgba(0, 0, 0, 0)"); + } + }, R.prototype.unprepElement = function(u) { + var w = u.element; + if (w) { + for (var $ = ["touchAction", "webkitTouchAction", "MozTouchAction", "MSTouchAction", "msTouchAction", "oTouchAction", "userSelect", "webkitUserSelect", "MozUserSelect", "MSUserSelect", "msUserSelect", "oUserSelect", "touchSelect", "webkitTouchSelect", "MozTouchSelect", "MSTouchSelect", "msTouchSelect", "oTouchSelect", "touchCallout", "webkitTouchCallout", "MozTouchCallout", "MSTouchCallout", "msTouchCallout", "oTouchCallout", "contentZooming", "webkitContentZooming", "MozContentZooming", "MSContentZooming", "msContentZooming", "oContentZooming", "userDrag", "webkitUserDrag", "MozUserDrag", "MSUserDrag", "msUserDrag", "oUserDrag"], G = 0; G < $.length; G++) + $[G] in w.style && this.restoreStyle(u, $[G]); + this.restoreStyle(u, "tapHighlightColor"); + } + }, R.prototype.getHitOption = function(u, w) { + var $ = u.hitOptions[w]; + return $ === void 0 && ($ = this.hitOptions[w]), $; + }, R.prototype.getHoverOption = function(u, w) { + var $ = u.hoverOptions[w]; + return $ === void 0 && ($ = this.hoverOptions[w]), $; + }, R.prototype.getSwipeOption = function(u, w) { + var $ = u.swipeOptions[w]; + return $ === void 0 && ($ = this.swipeOptions[w]), $; + }, R.prototype.getKeyboardOption = function(u, w) { + var $ = u.keyboardOptions[w]; + return $ === void 0 && ($ = this.keyboardOptions[w]), $; + }, R.prototype.getMouseOption = function(u, w) { + var $ = u.mouseOptions[w]; + return $ === void 0 && ($ = this.mouseOptions[w]), $; + }, R.prototype.getInertiaOption = function(u, w, $) { + var G = u.inertiaOptions.getKey(w); + return G && Ee(G[$]) ? G[$] : this.inertiaOptions.getKey(w)[$]; + }, R.prototype.stopInertia = function(u) { + for (var w, $ = ["move", "resize"], G = 0; G < $.length; G++) + if (w = $[G], u.inertias.hasKey(w)) { + var K = u.inertias.getKey(w); + if (K) { + K.dispose(); + continue; + } + } + }, R.prototype.swiping = function(u, w) { + var $ = Om(); + return !(w.swipeCanceled || !u.swipeable) && Math.abs(w.startPoint.y - w.point.y) < this.getSwipeOption(u, "verticalThreshold") && w.startTime > $ - this.getSwipeOption(u, "time"); + }, R.prototype.swiped = function(u, w) { + var $ = Om(); + return !w.swipeCanceled && Math.abs(w.startPoint.x - w.point.x) > this.getSwipeOption(u, "horizontalThreshold") && Math.abs(w.startPoint.y - w.point.y) < this.getSwipeOption(u, "verticalThreshold") && w.startTime > $ - this.getSwipeOption(u, "time"); + }, R.prototype.applyCursorOverStyle = function(u) { + var w = u.cursorOptions; + if (Ee(w.overStyle)) + for (var $ = 0; $ < w.overStyle.length; $++) + L8(u.element, w.overStyle[$].property, w.overStyle[$].value); + }, R.prototype.applyCursorDownStyle = function(u, w) { + if (!w || !w.touch) { + var $ = u.cursorOptions.downStyle; + if (u.downPointers.contains(w) && Ee($)) + for (var G = 0; G < $.length; G++) + this.setTemporaryStyle(this.body, $[G].property, $[G].value), this.setTemporaryStyle(u, $[G].property, $[G].value); + } + }, R.prototype.restoreCursorDownStyle = function(u, w) { + if (!w || !w.touch) { + var $ = u.cursorOptions.downStyle; + if (u.downPointers.contains(w) && Ee($)) + for (var G = 0; G < $.length; G++) + this.restoreStyle(this.body, $[G].property), this.restoreStyle(u, $[G].property); + } + }, R.prototype.setGlobalStyle = function(u) { + for (var w = Gs().body, $ = gt(u) ? u : [u], G = 0; G < $.length; G++) + this.setTemporaryStyle(w, $[G].property, $[G].value); + }, R.prototype.restoreGlobalStyle = function(u) { + for (var w = Gs().body, $ = gt(u) ? u : [u], G = 0; G < $.length; G++) + this.restoreStyle(w, $[G].property); + }, R.prototype.isGlobalElement = function(u) { + return document.body === u.element; + }, R.prototype.moved = function(u, w, $) { + var G = this.getShift(u); + return Math.abs(G.x) > w || Math.abs(G.y) > w; + }, R.prototype.old = function(u, w) { + return w === void 0 && (w = 300), Om() - u.startTime > w; + }, R.prototype.getShift = function(u) { + return { x: u.startPoint.x - u.point.x, y: u.startPoint.y - u.point.y }; + }, R.prototype.getTrailPoint = function(u, w) { + for (var $, G = 0; G < u.track.length; G++) + if (u.track[G].timestamp >= w) { + $ = u.track[G]; + break; + } + return $; + }, R.prototype.pointerExists = function(u, w) { + var $ = !1; + return u.each(function(G) { + G != w && ($ = G.point.x == w.point.x && G.point.y == w.point.y); + }), $; + }, R.prototype.getInteraction = function(u) { + return new pL(u); + }, R.prototype.setTemporaryStyle = function(u, w, $) { + var G = u.element; + Ee(G.style[w]) && !u.replacedStyles.hasKey(w) && u.replacedStyles.setKey(w, G.style[w]), L8(G, w, $); + }, R.prototype.restoreStyle = function(u, w) { + u.replacedStyles.hasKey(w) ? (u.element.style[w] = u.replacedStyles.getKey(w), u.replacedStyles.removeKey(w)) : delete u.element.style[w]; + }, R.prototype.restoreAllStyles = function(u) { + er(u.replacedStyles.iterator(), function(w) { + var $ = w[0], G = w[1]; + u.element.style[$] = G, u.replacedStyles.removeKey($); + }); + }, R.prototype.dispose = function() { + this.isDisposed() || (U.prototype.dispose.call(this), this.restoreAllStyles(this.body), this.unlockWheel()); + }, R.prototype.log = function(u, w, $) { + if (w.changedTouches) + for (var G = 0; G < w.changedTouches.length; G++) + this.logTouch(u, w.type, w.changedTouches[G]); + else { + var K, ne = ""; + if (w.pointerType) + switch (w.pointerType) { + case 2: + ne = "touch"; + break; + case 4: + ne = "mouse"; + break; + default: + ne = w.pointerType; + } + else + ne = typeof TouchEvent < "u" && w instanceof TouchEvent ? "touch" : w.type.match(/^mouse/) ? "mouse" : "???"; + K = Ee(w.identifier) ? w.identifier : Ee(w.pointerId) ? w.pointerId : "???", console.log($ ? u + " (" + $.uid + ") " + w.type + " " + ne + " " + K : u + " " + w.type + " " + ne + " " + K); + } + }, R.prototype.areTransformed = function(u) { + var w = this.transformedObjects.length; + if (u) + for (var $ = gt(u) ? u : [u], G = 0; G < $.length; G++) + this.transformedObjects.contains($[G]) && w--; + return w > 0; + }, R.prototype.logTouch = function(u, w, $) { + console.log(u + " " + w + " touch " + $.identifier); + }, Object.defineProperty(R, "passiveSupported", { get: function() { + var u = this; + if (this._passiveSupported == null) + try { + var w = Object.defineProperty({}, "passive", { get: function() { + u._passiveSupported = !0; + } }); + window.addEventListener("test", w, w), window.removeEventListener("test", w, w); + } catch { + this._passiveSupported = !1; + } + return this._passiveSupported; + }, enumerable: !0, configurable: !0 }), R; + }(vi), pg = null; + function Gs() { + return pg == null && (pg = new mL()), pg; + } + var Gy = function(U) { + function R() { + var u = U.call(this) || this; + return u.adapter = new Yu(u), u._elements = {}, u._IOs = {}, u._content = "", u._title = "", u._classPrefix = "ampopup", u._defaultStyles = !0, u._showCurtain = !1, u._draggable = !0, u._align = "center", u._dynamicResize = !0, u._verticalAlign = "middle", u._shift = { x: 0, y: 0 }, u._tempShift = { x: 0, y: 0 }, u._readerTitle = "", u._closable = !0, u._cssLoaded = !1, u._fitTo = "window", u.isTemplate = !1, u._sized = !1, u.className = "Popup", u; + } + return re(R, U), R.prototype.open = function() { + this.container && (this._elements.wrapper && this.container.appendChild(this._elements.wrapper), this._elements.curtain && (this.container.appendChild(this._elements.curtain), this.showCurtain = this.showCurtain), this.positionElement(), this.dispatchImmediately("opened")); + }, R.prototype.close = function() { + this._elements.wrapper && this._elements.wrapper.parentElement && this._elements.wrapper.parentElement.removeChild(this._elements.wrapper), this._elements.curtain && this._elements.curtain.parentElement && this._elements.curtain.parentElement.removeChild(this._elements.curtain), this.dispatchImmediately("closed"), this.releasePointers(); + }, R.prototype.dispose = function() { + this.close(), U.prototype.dispose.call(this); + }, R.prototype.positionElement = function(u) { + var w = this; + u === void 0 && (u = !0), this._elements.wrapper && setTimeout(function() { + if (w._elements.wrapper) { + if (u || !w._sized) { + w._elements.wrapper.style.opacity = "0.01", w._elements.wrapper.style.left = "0", w._elements.wrapper.style.top = "0", w._elements.wrapper.style.margin = "0 0 0 0", w._elements.wrapper.style.width = "", w._elements.wrapper.style.height = ""; + var $ = w._elements.wrapper.getBoundingClientRect(); + w._elements.wrapper.style.width = $.width + "px", w._elements.wrapper.style.height = $.height + "px", w._sized = !0; + } + if (w.dynamicResize) + for (var G = w._elements.wrapper.getElementsByTagName("img"), K = 0; K < G.length; K++) { + var ne = G[K]; + if (!ne.complete) { + ne.addEventListener("load", function() { + w.positionElement(!0); + }); + break; + } + } + setTimeout(function() { + if (w._elements.wrapper) { + var ue; + switch (!u && w._sized || !w._bbox ? (ue = w._elements.wrapper.getBoundingClientRect(), w._elements.wrapper.style.opacity = "") : ue = w._bbox, w.align) { + case "left": + w._elements.wrapper.style.left = "0", w._elements.wrapper.style.right = "auto", w._elements.wrapper.style.marginLeft = w.toStyle(w._shift.x + w._tempShift.x); + break; + case "center": + w._elements.wrapper.style.left = "50%", w._elements.wrapper.style.right = "auto", w._elements.wrapper.style.marginLeft = w.toStyle(Math.round(-ue.width / 2) + (w._shift.x + w._tempShift.x)); + break; + case "right": + w._elements.wrapper.style.left = "auto", w._elements.wrapper.style.right = "0", w._elements.wrapper.style.marginLeft = w.toStyle(w._shift.x + w._tempShift.x); + break; + default: + w._elements.wrapper.style.left = w.toStyle(w.left) || "auto", w._elements.wrapper.style.right = w.toStyle(w.right) || "auto", w._elements.wrapper.style.marginLeft = w.toStyle(w._shift.x + w._tempShift.x); + } + switch (w.verticalAlign) { + case "top": + w._elements.wrapper.style.top = "0", w._elements.wrapper.style.bottom = "auto", w._elements.wrapper.style.marginTop = w.toStyle(w._shift.y + w._tempShift.y); + break; + case "middle": + w._elements.wrapper.style.top = "50%", w._elements.wrapper.style.bottom = "auto", w._elements.wrapper.style.marginTop = w.toStyle(Math.round(-ue.height / 2) + (w._shift.y + w._tempShift.y)); + break; + case "bottom": + w._elements.wrapper.style.top = "auto", w._elements.wrapper.style.bottom = "0", w._elements.wrapper.style.marginTop = w.toStyle(w._shift.y + w._tempShift.y); + break; + default: + w._elements.wrapper.style.top = w.toStyle(w.top) || "auto", w._elements.wrapper.style.bottom = w.toStyle(w.bottom) || "auto", w._elements.wrapper.style.marginTop = w.toStyle(w._shift.y + w._tempShift.y); + } + } + }, 1); + } + }, 1); + }, R.prototype.setupDragging = function() { + var u = this; + this.draggable ? (this._IOs.header.events.has("drag") || this._IOs.header.events.on("drag", function(w) { + u._tempShift.x = w.shift.x, u._tempShift.y = w.shift.y, u.positionElement(!1); + }), this._IOs.header.events.has("dragstop") || this._IOs.header.events.on("dragstop", function(w) { + u._shift.x += u._tempShift.x, u._shift.y += u._tempShift.y, u._tempShift.x = 0, u._tempShift.y = 0, u.positionElement(!1); + })) : this._IOs.header && (Gs().unprepElement(this._IOs.header), this._IOs.header.events.has("drag") && this._IOs.header.events.off("drag"), this._IOs.header.events.has("dragstop") && this._IOs.header.events.off("dragstop")); + }, R.prototype.toStyle = function(u) { + return Ee(u) ? le(u) ? u + "px" : u.toString() : null; + }, Object.defineProperty(R.prototype, "classPrefix", { get: function() { + return this.adapter.apply("classPrefix", this._classPrefix); + }, set: function(u) { + this._classPrefix = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "classPrefixRaw", { get: function() { + return this._classPrefix; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "content", { get: function() { + return this.adapter.apply("content", this._content); + }, set: function(u) { + this._content != u && (this._content = u, this._elements.content || this.createContentElement(), this._elements.content.innerHTML = u, this.positionElement()); + }, enumerable: !0, configurable: !0 }), R.prototype.getClassNames = function() { + return this.adapter.apply("classNames", { wrapperClass: this.classPrefix + "", headerClass: this.classPrefix + "-header", titleClass: this.classPrefix + "-title", contentClass: this.classPrefix + "-content", insideClass: this.classPrefix + "-inside", curtainClass: this.classPrefix + "-curtain", closeClass: this.classPrefix + "-close" }); + }, R.prototype.createContentElement = function() { + if (!this._elements.wrapper) { + var u = this.getClassNames(), w = document.createElement("div"); + w.className = u.contentClass, w.style.opacity = "0.01"; + var $ = document.createElement("a"); + $.className = u.closeClass; + var G = document.createElement("div"); + G.className = u.headerClass; + var K = document.createElement("div"); + K.innerHTML = this.title, K.className = u.titleClass, this.title || (K.style.display = "none"); + var ne = document.createElement("div"); + ne.className = u.insideClass, ne.innerHTML = this.content, this._IOs.wrapper = Gs().getInteraction(w), this._IOs.header = Gs().getInteraction(G), this._disposers.push(this._IOs.wrapper), this._IOs.wrapper.events.on("over", this.disablePointers, this), this._IOs.wrapper.events.on("out", this.releasePointers, this), this._IOs.close = Gs().getInteraction($), this._disposers.push(this._IOs.close), $.style.visibility = "hidden", w.setAttribute("role", "dialog"), G.appendChild($), G.appendChild(K), w.appendChild(G), w.appendChild(ne), this.container.appendChild(w), this._elements.wrapper = w, this._elements.header = G, this._elements.content = ne, this._elements.title = K, this._elements.close = $, this.defaultStyles && this.loadDefaultCSS(), this.createCurtainElement(), this.applyEvents(), this.applyReaderSettings(), this.setupDragging(); + } + }, Object.defineProperty(R.prototype, "title", { get: function() { + return this.adapter.apply("title", this._title); + }, set: function(u) { + this._title != u && (this._title = u, this._elements.content || this.createContentElement(), this._elements.title.innerHTML = u, this.positionElement(), this.applyReaderSettings()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerTitle", { get: function() { + return this.adapter.apply("readerTitle", this._readerTitle != "" ? this._readerTitle : this.title); + }, set: function(u) { + this._readerTitle != u && (this._readerTitle = u, this.applyReaderSettings()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "closable", { get: function() { + return this.adapter.apply("closable", this._closable); + }, set: function(u) { + u !== this._closable && (this._closable = u, this.applyEvents()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fitTo", { get: function() { + return this.adapter.apply("fitTo", this._fitTo); + }, set: function(u) { + u != this._fitTo && (this._fitTo = u, this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "defaultStyles", { get: function() { + return this.adapter.apply("defaultStyles", this._defaultStyles); + }, set: function(u) { + this._defaultStyles != u && (this._defaultStyles = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "showCurtain", { get: function() { + return this.adapter.apply("showCurtain", this._showCurtain); + }, set: function(u) { + this._showCurtain != u && (this._showCurtain = u, this._elements.curtain && (this._elements.curtain.style.display = u ? "block" : "none")); + }, enumerable: !0, configurable: !0 }), R.prototype.createCurtainElement = function() { + var u = this.getClassNames(), w = document.createElement("div"); + w.className = u.curtainClass, this.container.appendChild(w), this._IOs.curtain = Gs().getInteraction(w), this._disposers.push(this._IOs.curtain), this._IOs.curtain.events.on("over", this.disablePointers, this), this._IOs.curtain.events.on("out", this.releasePointers, this), w.style.display = this.showCurtain ? "block" : "none", this._elements.curtain = w; + }, Object.defineProperty(R.prototype, "draggable", { get: function() { + return this.adapter.apply("draggable", this._draggable); + }, set: function(u) { + this._draggable != u && (this._draggable = u, this.setupDragging()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dynamicResize", { get: function() { + return this.adapter.apply("dynamicResize", this._dynamicResize); + }, set: function(u) { + this._dynamicResize != u && (this._dynamicResize = u, this.positionElement(!0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "align", { get: function() { + return this.adapter.apply("align", this._align); + }, set: function(u) { + this._align != u && (this._align = u, this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "verticalAlign", { get: function() { + return this.adapter.apply("verticalAlign", this._verticalAlign); + }, set: function(u) { + this._verticalAlign != u && (this._verticalAlign = u, this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "left", { get: function() { + return this.adapter.apply("left", this._left); + }, set: function(u) { + this.left != u && (this._left = u, this._align = "none", this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "right", { get: function() { + return this.adapter.apply("right", this._right); + }, set: function(u) { + this.right != u && (this._right = u, this._align = "none", this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "top", { get: function() { + return this.adapter.apply("top", this._top); + }, set: function(u) { + this.top != u && (this._top = u, this._verticalAlign = "none", this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bottom", { get: function() { + return this.adapter.apply("bottom", this._bottom); + }, set: function(u) { + this.bottom != u && (this._bottom = u, this._verticalAlign = "none", this.positionElement()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "elements", { get: function() { + return this._elements; + }, enumerable: !0, configurable: !0 }), R.prototype.loadDefaultCSS = function() { + this._cssLoaded || (this._disposers.push(function(u, w) { + w || (w = "ampopup"); + var $ = new Fa(), G = $.getFor("text"), K = $.getFor("background"); + K.alpha = 0.8; + var ne = $.getFor("alternativeBackground"); + return ne.alpha = 0.05, qb.insertKeyIfEmpty(w, function() { + var ue = new kn([new $s(u, "." + w, { overflow: "visible", position: "absolute", top: "0", left: "0", "z-index": "2000" }), new $s(u, "." + w + "-curtain", { width: "100%", height: "100%", position: "absolute", top: "0", left: "0", "z-index": "2001", "background-color": K.hex, opacity: "0.5" }), new $s(u, "." + w + "-header", { display: "block", width: "100%", "min-height": "1.8em", background: ne.rgba }), new $s(u, "." + w + "-title", { "font-weight": "bold", "font-size": "110%", padding: "0.5em 1.2em 0.5em 1em" }), new $s(u, "." + w + "-content", { background: K.hex, "background-color": K.rgba, color: G.hex, display: "inline-block", position: "absolute", top: "0", left: "0", "max-width": "90%", "max-height": "90%", overflow: "auto", "z-index": "2002" }), new $s(u, "." + w + "-inside", { padding: "1em" }), new $s(u, "." + w + "-close", { display: "block", position: "absolute", top: "0.3em", right: "0.3em", "background-color": "rgb(100, 100, 100)", background: "rgba(100, 100, 100, 0.1) url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyBoZWlnaHQ9IjUxMiIgdmVyc2lvbj0iMSIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHdpZHRoPSI1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQ0NS4yIDEwOS4ybC00Mi40LTQyLjRMMjU2IDIxMy42IDEwOS4yIDY2LjhsLTQyLjQgNDIuNEwyMTMuNiAyNTYgNjYuOCA0MDIuOGw0Mi40IDQyLjRMMjU2IDI5OC40bDE0Ni44IDE0Ni44IDQyLjQtNDIuNEwyOTguNCAyNTYiLz48L3N2Zz4=) no-repeat center", "background-size": "80%", width: "1.2em", height: "1.2em", cursor: "pointer" })]); + return new Cs(function() { + qb.removeKey(w), ue.dispose(); + }); + }).increment(); + }(D1(this.container), this.classPrefix)), mi(this._elements, function(u, w) { + w.style.display = ""; + }), this._cssLoaded = !0); + }, R.prototype.applyEvents = function() { + var u = this; + if (this._IOs.close) + if (this.closable) { + this._IOs.close.element.style.visibility = "visible"; + var w = [Gs().body.events.on("keyup", function($) { + dg.isKey($.event, "esc") && u.closable && u.close(); + }), this._IOs.close.events.on("hit", function($) { + u.close(); + })]; + w.push(this._IOs.curtain.events.on("hit", function($) { + u.showCurtain && u.closable && u.close(); + })), this._disposers.push(new kn(w)); + } else + this._IOs.close.element.style.visibility = "hidden"; + }, R.prototype.disablePointers = function() { + this.sprite && (this._spriteInteractionsEnabled = this.sprite.interactionsEnabled, this.sprite.interactionsEnabled = !1); + }, R.prototype.releasePointers = function() { + Ee(this._spriteInteractionsEnabled) && (this.sprite.interactionsEnabled = this._spriteInteractionsEnabled, this._spriteInteractionsEnabled = void 0); + }, R.prototype.applyReaderSettings = function() { + this.elements.wrapper.setAttribute("aria-label", this.readerTitle); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.container = u.container, this.sprite = u.sprite, this.classPrefix = u.classPrefixRaw, this.content = u.content, this.title = u.title, this.readerTitle = u.readerTitle, this.defaultStyles = u.defaultStyles, this.showCurtain = u.showCurtain, this.align = u.align, this.verticalAlign = u.verticalAlign, this.left = u.left, this.right = u.right, this.top = u.top, this.bottom = u.bottom, this.adapter.copyFrom(u.adapter); + }, R; + }(vi), gL = function(U) { + function R() { + var u = U.call(this) || this; + return u.adapter = new Yu(u), u.className = "Modal", u.showCurtain = !0, u.draggable = !1, u; + } + return re(R, U), R; + }(Gy); + function W3() { + for (var U = [], R = 0; R < arguments.length; R++) + U[R] = arguments[R]; + console && console.warn.apply(console, ke(U)); + } + var q3 = function() { + function U() { + var R = this; + this._targets = [], this._observer = new ResizeObserver(function(u) { + _i(u, function(w) { + _i(R._targets, function($) { + $.target === w.target && $.callback(); + }); + }); + }); + } + return U.prototype.addTarget = function(R, u) { + this._observer.observe(R, { box: "content-box" }), this._targets.push({ target: R, callback: u }); + }, U.prototype.removeTarget = function(R) { + this._observer.unobserve(R), Fr(this._targets, function(u) { + return u.target !== R; + }); + }, U; + }(), V8 = function() { + function U() { + this._targets = []; + } + return U.prototype.addTarget = function(R, u) { + var w = this; + if (this._targets.length === 0) { + var $ = null, G = function() { + var ne = Date.now(); + ($ === null || ne > $ + U.delay) && ($ = ne, _i(w._targets, function(ue) { + var we = ue.target.getBoundingClientRect(); + we.width === ue.size.width && we.height === ue.size.height || (ue.size = we, ue.callback()); + })), w._timer = requestAnimationFrame(G); + }; + this._timer = requestAnimationFrame(G); + } + var K = R.getBoundingClientRect(); + this._targets.push({ target: R, callback: u, size: K }); + }, U.prototype.removeTarget = function(R) { + Fr(this._targets, function(u) { + return u.target !== R; + }), this._targets.length === 0 && cancelAnimationFrame(this._timer); + }, U.delay = 200, U; + }(), Y3 = null, Zx = function() { + function U(R, u) { + this._disposed = !1, this._sensor = (Y3 === null && (Y3 = typeof ResizeObserver < "u" ? new q3() : new V8()), Y3), this._element = R, this._sensor.addTarget(R, u); + } + return U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + this._disposed || (this._disposed = !0, this._sensor.removeTarget(this._element)); + }, Object.defineProperty(U.prototype, "sensor", { get: function() { + return this._sensor; + }, enumerable: !0, configurable: !0 }), U.prototype.reset = function() { + W3("resizeSensor.reset() is no longer needed and can be removed"); + }, U; + }(), X3 = [], F1 = function() { + function U(R, u) { + var w = this; + this._disposed = !1, this.autoResize = !0, this.nonExportableSprites = [], this._disposers = [], this.cssScale = 1, this._printing = !1, this.htmlElement = R, u || (this._printing = !1, this.initSensor(), this._disposers.push(Uc(window, "beforeprint", function() { + w._printing = !0; + })), this._disposers.push(Uc(window, "afterprint", function() { + w._printing = !1; + }))), X3.push(this); + var $ = document.createElement("div"), G = $.style; + G.width = "100%", G.height = "100%", G.position = "relative", R.appendChild($), this.SVGContainer = $; + } + return U.prototype.initSensor = function() { + var R = this; + this.resizeSensor && this.resizeSensor.dispose(), this.resizeSensor = new Zx(this.htmlElement, function() { + R.autoResize && !R._printing && R.measure(); + }), this._disposers.push(this.resizeSensor); + }, U.prototype.measure = function() { + var R = _s(this.htmlElement), u = Hg(this.htmlElement), w = this.container; + w && (this.width == R && this.height == u || (this.width = R, this.height = u, R > 0 && (w.maxWidth = R), u > 0 && (w.maxHeight = u), hL(this.SVGContainer)), w.maxWidth || (w.maxWidth = 0), w.maxHeight || (w.maxHeight = 0), this.cssScale = 1, this.checkTransform(this.htmlElement)); + }, Object.defineProperty(U.prototype, "container", { get: function() { + return this._container; + }, set: function(R) { + this._container = R, this.measure(); + }, enumerable: !0, configurable: !0 }), U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + this._disposed || ki(X3, this), _i(this._disposers, function(R) { + R.dispose(); + }); + }, Object.defineProperty(U.prototype, "hideOverflow", { set: function(R) { + this.SVGContainer.style.overflow = R ? "hidden" : ""; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "modal", { get: function() { + return Ee(this._modal) || (this._modal = new gL(), this._modal.container = this.SVGContainer, this._disposers.push(this._modal)), this._modal; + }, enumerable: !0, configurable: !0 }), U.prototype.openModal = function(R, u) { + this.closeModal(); + var w = this.modal; + return w.content = R, w.readerTitle = u || "", w.title = u || "", w.open(), w; + }, U.prototype.closeModal = function() { + this._modal && this.modal.close(); + }, Object.defineProperty(U.prototype, "popups", { get: function() { + if (!Ee(this._popups)) { + var R = new Gy(); + R.container = this.SVGContainer, this._popups = new Xs(R), this._disposers.push(new Wo(this._popups)), this._disposers.push(this._popups.template); + } + return this._popups; + }, enumerable: !0, configurable: !0 }), U.prototype.openPopup = function(R, u) { + var w = this.popups.create(); + return w.content = R, Ee(u) && (w.title = u), w.open(), w; + }, U.prototype.closeAllPopups = function() { + this.popups.each(function(R) { + R.close(); + }); + }, Object.defineProperty(U.prototype, "readerAlertElement", { get: function() { + if (!Ee(this._readerAlertElement)) { + var R = document.createElement("div"); + R.setAttribute("role", "alert"), R.style.zIndex = "-100000", R.style.opacity = "0", R.style.position = "absolute", R.style.top = "0", this.SVGContainer.appendChild(R), this._readerAlertElement = R; + } + return this._readerAlertElement; + }, enumerable: !0, configurable: !0 }), U.prototype.readerAlert = function(R) { + this.readerAlertElement.innerHTML = R; + }, U.prototype.checkTransform = function(R) { + if (window.getComputedStyle) { + if (R && R.style) { + var u = window.getComputedStyle(R, null); + if (u) { + var w = u.getPropertyValue("-webkit-transform") || u.getPropertyValue("-moz-transform") || u.getPropertyValue("-ms-transform") || u.getPropertyValue("-o-transform") || u.getPropertyValue("transform"); + if (w && w !== "none") { + var $ = w.split("(")[1].split(")")[0].split(","), G = Number($[0]), K = Number($[1]), ne = Math.sqrt(G * G + K * K); + isNaN(ne) || (this.cssScale *= ne); + } + } + } + R.parentNode && R.parentNode instanceof HTMLElement && this.checkTransform(R.parentNode); + } + }, U; + }(), Qx = function() { + function U(R, u) { + this.container = R, this.id = u; + var w = document.createElementNS(mf, "svg"); + w.setAttribute("version", "1.1"), w.setAttributeNS(eA, "xmlns", mf), w.setAttributeNS(eA, "xmlns:xlink", xC), w.setAttribute("role", "group"), this.container.appendChild(w), this.defs = document.createElementNS(mf, "defs"), w.appendChild(this.defs), w.style.width = "100%", w.style.height = "100%", w.style.overflow = "visible", this.svg = w; + } + return U.prototype.add = function(R) { + return new EC(R); + }, U.prototype.addGroup = function(R) { + return new G3(R); + }, U.prototype.append = function(R) { + R && this.svg.appendChild(R.node); + }, U.prototype.appendDef = function(R) { + R && this.defs.appendChild(R.node); + }, U.prototype.foreignObject = function() { + return new EC("foreignObject"); + }, U.prototype.supportsForeignObject = function() { + return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Extensibility", "1.1"); + }, U; + }(), PC = null; + function Yb() { + if (PC === null) { + var U = document.createElement("div"); + U.hidden = !0, U.style.width = "1px", U.style.height = "1px", U.style.position = "absolute", U.style.zIndex = "-1000000", document.body.appendChild(U); + var R = new F1(U, !0); + PC = new Qx(R.SVGContainer, "ghost"); + } + return PC; + } + var qv = function(U) { + function R() { + var u = U.call(this) || this; + u._elements = new Hs(), u.properties = {}, u.className = "Pattern", u.width = 10, u.height = 10, u.x = 0, u.y = 0, u.patternUnits = "userSpaceOnUse"; + var w = new Fa(); + return u.backgroundFill = w.getFor("background"), u.backgroundOpacity = 0, u.fillOpacity = 1, u.fill = w.getFor("alternativeBackground"), u.stroke = w.getFor("alternativeBackground"), u.strokeOpacity = 1, u.strokeWidth = 1, u.shapeRendering = "crispEdges", u.rotation = 0, u.element = u.paper.addGroup("pattern"), u.id = "pattern-" + hi.getUniqueId(), u.element.attr({ id: u.id }), u._disposers.push(u.element), u._disposers.push(new Wo(u._elements)), u.patternUnits = u.patternUnits, u.width = u.width, u.height = u.height, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + var u = this, w = this.element; + if (w) { + w.removeChildNodes(); + var $ = this.paper.add("rect"); + $.attr({ width: this.width, height: this.height, "shape-rendering": "crispEdges", fill: this.backgroundFill.hex, "fill-opacity": this.backgroundOpacity, stroke: this.backgroundFill.hex, "stroke-opacity": 0 }), w.add($), w.attr({ x: this.x, y: this.y, width: this.width, height: this.height, stroke: this.stroke.hex, fill: this.fill.hex, "fill-opacity": this.fillOpacity, "stroke-opacity": this.strokeOpacity, "stroke-width": this.strokeWidth, "shape-rendering": this.shapeRendering, patternUnits: this.patternUnits, "stroke-dasharray": this.strokeDasharray }), er(this._elements.iterator(), function(G) { + G.rotation = u.rotation, G.rotationX = u.properties.rotationX, G.rotationY = u.properties.rotationY, u.element.add(G); + }); + } + }, R.prototype.animate = function(u, w, $) { + return new $f(this, u, w, $).start(); + }, R.prototype.addElement = function(u) { + this._elements.push(u), this._disposers.push(u); + }, R.prototype.removeElement = function(u) { + this._elements.removeValue(u), this.removeDispose(u); + }, Object.defineProperty(R.prototype, "elements", { get: function() { + return this._elements; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fillOpacity", { get: function() { + return this.properties.fillOpacity; + }, set: function(u) { + this.properties.fillOpacity = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fill", { get: function() { + return this.properties.fill; + }, set: function(u) { + this.properties.fill = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "backgroundFill", { get: function() { + return this.properties.backgroundFill; + }, set: function(u) { + this.properties.backgroundFill = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "backgroundOpacity", { get: function() { + return this.properties.backgroundOpacity; + }, set: function(u) { + this.properties.backgroundOpacity = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "stroke", { get: function() { + return this.properties.stroke; + }, set: function(u) { + this.properties.stroke = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeOpacity", { get: function() { + return this.properties.strokeOpacity; + }, set: function(u) { + this.properties.strokeOpacity = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeWidth", { get: function() { + return this.properties.strokeWidth; + }, set: function(u) { + this.properties.strokeWidth = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "shapeRendering", { get: function() { + return this.properties.shapeRendering; + }, set: function(u) { + this.properties.shapeRendering = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rotation", { get: function() { + return this.properties.rotation; + }, set: function(u) { + this.properties.rotation = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "patternUnits", { get: function() { + return this.properties.patternUnits; + }, set: function(u) { + this.properties.patternUnits = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "width", { get: function() { + return this.properties.width; + }, set: function(u) { + this.properties.width = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "height", { get: function() { + return this.properties.height; + }, set: function(u) { + this.properties.height = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "x", { get: function() { + return this.properties.x; + }, set: function(u) { + this.properties.x = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y", { get: function() { + return this.properties.y; + }, set: function(u) { + this.properties.y = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paper", { get: function() { + return this._paper ? this._paper : Yb(); + }, set: function(u) { + this._paper != u && (this._paper = u, this.draw(), u.appendDef(this.element)); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + U.prototype.copyFrom.call(this, u), mi(u.properties, function($, G) { + w[$] = G; + }); + }, Object.defineProperty(R.prototype, "animations", { get: function() { + return this._animations || (this._animations = [], this._disposers.push(new Wb(this._animations))), this._animations; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeDasharray", { get: function() { + return this.properties.strokeDashArray; + }, set: function(u) { + this.properties.strokeDashArray = u, this.draw(); + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + if (u && Ee(u.elements) && gt(u.elements)) + for (var w = 0, $ = u.elements.length; w < $; w++) { + var G = u.elements[w]; + if (Ee(G.type)) { + var K = this.createEntryInstance(G); + K instanceof Ht && (K.config = G), this.addElement(Ee(G.typeProperty) ? K[G.typeProperty] : K.element); + } + } + U.prototype.processConfig.call(this, u); + }, R; + }(Ht); + hi.registeredClasses.Pattern = qv; + var qg = function(U) { + function R() { + var u = U.call(this) || this; + return u._stops = new Hs(), u._rotation = 0, u.className = "LinearGradient", u._stops.events.on("setIndex", u.validate, u), u._stops.events.on("inserted", u.validate, u), u.element = u.paper.addGroup("linearGradient"), u.id = "gradient-" + hi.getUniqueId(), u.element.attr({ id: u.id }), u._disposers.push(u.element), u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + var u = this, w = (this._rotation + 90) * Ae, $ = Math.round(50 + 50 * Math.sin(w + Math.PI)) + "%", G = Math.round(50 + 50 * Math.cos(w)) + "%", K = Math.round(50 + 50 * Math.sin(w)) + "%", ne = Math.round(50 + 50 * Math.cos(w + Math.PI)) + "%", ue = this.element; + ue.removeChildNodes(), ue.attr({ x1: $, x2: K, y1: G, y2: ne }), er(mu(this._stops.iterator()), function(we) { + var De = we[0], $e = we[1], Ke = $e.offset; + le(Ke) || (Ke = De / (u._stops.length - 1)); + var Ze = u.paper.add("stop"); + Ee($e.color) && Ze.attr({ "stop-color": $e.color.toString() }), le($e.opacity) && Ze.attr({ "stop-opacity": $e.opacity }), le(Ke) && Ze.attr({ offset: Ke }), ue.add(Ze); + }); + }, R.prototype.clear = function() { + this._stops.clear(); + }, R.prototype.addColor = function(u, w, $) { + this._stops.push({ color: u, opacity: w, offset: $ }); + }, Object.defineProperty(R.prototype, "stops", { get: function() { + return this._stops; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paper", { get: function() { + return this._paper ? this._paper : Yb(); + }, set: function(u) { + this._paper != u && (this._paper = u, this.validate(), u.appendDef(this.element)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rotation", { get: function() { + return this._rotation; + }, set: function(u) { + this._rotation = u, this.validate(); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.stops.copyFrom(u.stops), this._rotation = u.rotation; + }, Object.defineProperty(R.prototype, "gradientUnits", { set: function(u) { + this.element.attr({ gradientUnits: u }); + }, enumerable: !0, configurable: !0 }), R; + }(Ht); + hi.registeredClasses.LinearGradient = qg; + var Yg = function(U) { + function R() { + var u = U.call(this) || this; + return u._stops = new Hs(), u.element = u.paper.addGroup("radialGradient"), u.id = "gradient-" + hi.getUniqueId(), u.element.attr({ id: u.id }), u._disposers.push(u.element), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + var u, w = this, $ = this.element; + le(this.cx) && ((u = this.cx) instanceof J && (u = u.percent + "%"), $.attr({ cx: u })), le(this.cy) && ((u = this.cy) instanceof J && (u = u.percent + "%"), $.attr({ cy: u })), this.fx && ((u = this.fx) instanceof J && (u = u.percent + "%"), $.attr({ fx: u })), this.fy && ((u = this.fy) instanceof J && (u = u.percent + "%"), $.attr({ fy: u })), $.removeChildNodes(), er(mu(this._stops.iterator()), function(G) { + var K = G[0], ne = G[1], ue = ne.offset; + le(ue) || (ue = K / (w._stops.length - 1)); + var we = w.paper.add("stop"); + Ee(ne.color) && we.attr({ "stop-color": ne.color.toString() }), le(ne.opacity) && we.attr({ "stop-opacity": ne.opacity }), le(ue) && we.attr({ offset: ue }), $.add(we); + }); + }, R.prototype.addColor = function(u, w, $) { + this._stops.push({ color: u, opacity: w, offset: $ }), this.draw(); + }, Object.defineProperty(R.prototype, "paper", { get: function() { + return this._paper ? this._paper : Yb(); + }, set: function(u) { + this._paper != u && (this._paper = u, this.draw(), u.appendDef(this.element)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cx", { get: function() { + return this._cx; + }, set: function(u) { + this._cx = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cy", { get: function() { + return this._cy; + }, set: function(u) { + this._cy = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fx", { get: function() { + return this._fx; + }, set: function(u) { + this._fx = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fy", { get: function() { + return this._fy; + }, set: function(u) { + this._fy = u, this.draw(); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.stops.copyFrom(u.stops), this.cx = u.cx, this.cy = u.cy, this.fx = u.fx, this.fy = u.fy; + }, Object.defineProperty(R.prototype, "stops", { get: function() { + return this._stops; + }, enumerable: !0, configurable: !0 }), R.prototype.clear = function() { + this._stops.clear(); + }, R; + }(Ht); + hi.registeredClasses.RadialGradient = Yg; + var vl = function() { + function U() { + } + return U.grab = [{ property: "cursor", value: "move" }, { property: "cursor", value: "grab" }, { property: "cursor", value: "-webkit-grab" }], U.grabbing = [{ property: "cursor", value: "move" }, { property: "cursor", value: "grabbing" }, { property: "cursor", value: "-webkit-grabbing" }], U.pointer = [{ property: "cursor", value: "pointer" }], U.default = [{ property: "cursor", value: "default" }], U.horizontalResize = [{ property: "cursor", value: "ew-resize" }], U.verticalResize = [{ property: "cursor", value: "ns-resize" }], U.notAllowed = [{ property: "cursor", value: "not-allowed" }], U.text = [{ property: "cursor", value: "text" }], U; + }(); + const Lp = { _decimalSeparator: ".", _thousandSeparator: ",", _percentPrefix: null, _percentSuffix: "%", _big_number_suffix_3: "k", _big_number_suffix_6: "M", _big_number_suffix_9: "G", _big_number_suffix_12: "T", _big_number_suffix_15: "P", _big_number_suffix_18: "E", _big_number_suffix_21: "Z", _big_number_suffix_24: "Y", _small_number_suffix_3: "m", _small_number_suffix_6: "μ", _small_number_suffix_9: "n", _small_number_suffix_12: "p", _small_number_suffix_15: "f", _small_number_suffix_18: "a", _small_number_suffix_21: "z", _small_number_suffix_24: "y", _byte_suffix_B: "B", _byte_suffix_KB: "KB", _byte_suffix_MB: "MB", _byte_suffix_GB: "GB", _byte_suffix_TB: "TB", _byte_suffix_PB: "PB", _date: "yyyy-MM-dd", _date_millisecond: "mm:ss SSS", _date_second: "HH:mm:ss", _date_minute: "HH:mm", _date_hour: "HH:mm", _date_day: "MMM dd", _date_week: "ww", _date_month: "MMM", _date_year: "yyyy", _duration_millisecond: "SSS", _duration_millisecond_second: "ss.SSS", _duration_millisecond_minute: "mm:ss SSS", _duration_millisecond_hour: "hh:mm:ss SSS", _duration_millisecond_day: "d'd' mm:ss SSS", _duration_millisecond_week: "d'd' mm:ss SSS", _duration_millisecond_month: "M'm' dd'd' mm:ss SSS", _duration_millisecond_year: "y'y' MM'm' dd'd' mm:ss SSS", _duration_second: "ss", _duration_second_minute: "mm:ss", _duration_second_hour: "hh:mm:ss", _duration_second_day: "d'd' hh:mm:ss", _duration_second_week: "d'd' hh:mm:ss", _duration_second_month: "M'm' dd'd' hh:mm:ss", _duration_second_year: "y'y' MM'm' dd'd' hh:mm:ss", _duration_minute: "mm", _duration_minute_hour: "hh:mm", _duration_minute_day: "d'd' hh:mm", _duration_minute_week: "d'd' hh:mm", _duration_minute_month: "M'm' dd'd' hh:mm", _duration_minute_year: "y'y' MM'm' dd'd' hh:mm", _duration_hour: "hh'h'", _duration_hour_day: "d'd' hh'h'", _duration_hour_week: "d'd' hh'h'", _duration_hour_month: "M'm' dd'd' hh'h'", _duration_hour_year: "y'y' MM'm' dd'd' hh'h'", _duration_day: "d'd'", _duration_day_week: "d'd'", _duration_day_month: "M'm' dd'd'", _duration_day_year: "y'y' MM'm' dd'd'", _duration_week: "w'w'", _duration_week_month: "w'w'", _duration_week_year: "w'w'", _duration_month: "M'm'", _duration_month_year: "y'y' MM'm'", _duration_year: "y'y'", _era_ad: "AD", _era_bc: "BC", A: "", P: "", AM: "", PM: "", "A.M.": "", "P.M.": "", January: "", February: "", March: "", April: "", May: "", June: "", July: "", August: "", September: "", October: "", November: "", December: "", Jan: "", Feb: "", Mar: "", Apr: "", "May(short)": "May", Jun: "", Jul: "", Aug: "", Sep: "", Oct: "", Nov: "", Dec: "", Sunday: "", Monday: "", Tuesday: "", Wednesday: "", Thursday: "", Friday: "", Saturday: "", Sun: "", Mon: "", Tue: "", Wed: "", Thu: "", Fri: "", Sat: "", _dateOrd: function(U) { + var R = "th"; + if (U < 11 || U > 13) + switch (U % 10) { + case 1: + R = "st"; + break; + case 2: + R = "nd"; + break; + case 3: + R = "rd"; + } + return R; + }, "Zoom Out": "", Play: "", Stop: "", Legend: "", "Click, tap or press ENTER to toggle": "", Loading: "", Home: "", Chart: "", "Serial chart": "", "X/Y chart": "", "Pie chart": "", "Gauge chart": "", "Radar chart": "", "Sankey diagram": "", "Flow diagram": "", "Chord diagram": "", "TreeMap chart": "", "Force directed tree": "", "Sliced chart": "", Series: "", "Candlestick Series": "", "OHLC Series": "", "Column Series": "", "Line Series": "", "Pie Slice Series": "", "Funnel Series": "", "Pyramid Series": "", "X/Y Series": "", Map: "", "Press ENTER to zoom in": "", "Press ENTER to zoom out": "", "Use arrow keys to zoom in and out": "", "Use plus and minus keys on your keyboard to zoom in and out": "", Export: "", Image: "", Data: "", Print: "", "Press ENTER or use arrow keys to navigate": "", "Click, tap or press ENTER to open": "", "Click, tap or press ENTER to print.": "", "Click, tap or press ENTER to export as %1.": "", 'To save the image, right-click this link and choose "Save picture as..."': "", 'To save the image, right-click thumbnail on the left and choose "Save picture as..."': "", "(Press ESC to close this message)": "", "Image Export Complete": "", "Export operation took longer than expected. Something might have gone wrong.": "", "Saved from": "", PNG: "", JPG: "", GIF: "", SVG: "", PDF: "", JSON: "", CSV: "", XLSX: "", "Use TAB to select grip buttons or left and right arrows to change selection": "", "Use left and right arrows to move selection": "", "Use left and right arrows to move left selection": "", "Use left and right arrows to move right selection": "", "Use TAB select grip buttons or up and down arrows to change selection": "", "Use up and down arrows to move selection": "", "Use up and down arrows to move lower selection": "", "Use up and down arrows to move upper selection": "", "From %1 to %2": "", "From %1": "", "To %1": "", "No parser available for file: %1": "", "Error parsing file: %1": "", "Unable to load file: %1": "", "Invalid date": "", Close: "", Minimize: "" }; + var Er, Yv = function(U) { + function R() { + var u = U.call(this) || this; + return u.adapter = new Yu(u), u._locale = Lp, u._defaultLocale = Lp, u.className = "Language", Ee(zd.defaultLocale) && (u.locale = zd.defaultLocale), u.applyTheme(), u; + } + return re(R, U), R.prototype.getLocale = function(u) { + return u == null && (u = this._locale), this.adapter.apply("locale", { locale: u }).locale; + }, R.prototype.translate = function(u, w) { + for (var $ = [], G = 2; G < arguments.length; G++) + $[G - 2] = arguments[G]; + w = this.getLocale(w); + var K = u, ne = this.getTranslations(w)[u]; + if (ne === null) + K = ""; + else if (Ee(ne)) + ne && (K = ne); + else if (w !== this._defaultLocale) + return this.translate.apply(this, ke([u, this._defaultLocale], $)); + if ($.length) + for (var ue = $.length, we = 0; we < ue; ++we) + K = K.split("%" + (we + 1)).join($[we]); + return this.adapter.apply("translate", { translation: K, locale: w }).translation; + }, R.prototype.translateAny = function(u, w) { + for (var $ = [], G = 2; G < arguments.length; G++) + $[G - 2] = arguments[G]; + return this.translate.apply(this, ke([u, w], $)); + }, R.prototype.setTranslationAny = function(u, w, $) { + ($ || this.locale)[u] = w; + }, R.prototype.translateEmpty = function(u, w) { + for (var $ = [], G = 2; G < arguments.length; G++) + $[G - 2] = arguments[G]; + var K = this.translate.apply(this, ke([u, w], $)); + return K == u ? "" : K; + }, R.prototype.translateFunc = function(u, w) { + w = this.getLocale(w); + var $ = this.getTranslations(w)[u]; + return $ ?? (w !== this._defaultLocale ? this.translateFunc(u, this._defaultLocale) : function() { + return ""; + }); + }, R.prototype.translateAll = function(u, w) { + var $ = this; + return this.isDefault() ? u : rr(u, function(G) { + return $.translate(G, w); + }); + }, R.prototype.isDefault = function() { + return this._defaultLocale === this._locale; + }, Object.defineProperty(R.prototype, "locale", { get: function() { + return this._locale; + }, set: function(u) { + if (this._locale != u && (this._locale = u, this.events.isEnabled("localechanged"))) { + var w = { type: "localechanged", locale: u, target: this }; + this.events.dispatchImmediately("localechanged", w); + } + }, enumerable: !0, configurable: !0 }), R.prototype.getTranslations = function(u) { + return this.adapter.apply("translations", { translations: u, locale: u }).translations; + }, R; + }(vi), K3 = function(U) { + function R() { + var u = U.call(this) || this; + return u.adapter = new Yu(u), u.className = "TextFormatter", u.applyTheme(), u; + } + return re(R, U), R.prototype.debug = function() { + }, R.prototype.format = function(u, w) { + Ee(w) || (w = "svg"); + var $ = "", G = (u = this.escape(u)).match(/\[([^\]]*?)\]/gm); + if (!G) + return this.wrap(u, "", w); + for (var K = u.split(/\[[^\[\]]*\]/), ne = 0, ue = K.length; ne < ue; ne++) { + var we = K[ne]; + if (we !== "") { + we = this.adapter.apply("chunk", we); + var De = ""; + ne > 0 && (De = G[ne - 1].replace("[", "").replace("]", "")), $ += this.wrap(we, De, w); + } + } + return $ = this.unescape($), this.cleanUp($); + }, R.prototype.escape = function(u) { + return u.replace(/\[\[/g, hi.getPlaceholder("1")).replace(/([^\/\]]{1})\]\]/g, "$1" + hi.getPlaceholder("2")).replace(/\]\]/g, hi.getPlaceholder("2")).replace(/\{\{/g, hi.getPlaceholder("3")).replace(/\}\}/g, hi.getPlaceholder("4")).replace(/\'\'/g, hi.getPlaceholder("5")); + }, R.prototype.unescape = function(u) { + return u.replace(new RegExp(hi.getPlaceholder("1"), "g"), "[[").replace(new RegExp(hi.getPlaceholder("2"), "g"), "]]").replace(new RegExp(hi.getPlaceholder("3"), "g"), "{{").replace(new RegExp(hi.getPlaceholder("4"), "g"), "}}").replace(new RegExp(hi.getPlaceholder("5"), "g"), "''"); + }, R.prototype.cleanUp = function(u) { + return u.replace(/\[\[/g, "[").replace(/\]\]/g, "]").replace(/\{\{/g, "{").replace(/\}\}/g, "}").replace(/\'\'/g, "'"); + }, R.prototype.wrap = function(u, w, $) { + return w !== "" && w !== "/" || (w = ""), $ === "html" ? this.wrapHtml(u, this.translateStyleShortcuts(w)) : this.wrapSvg(u, this.translateStyleShortcuts(w)); + }, R.prototype.wrapSvg = function(u, w) { + return w === "" ? "" + u + "" : "" + u + ""; + }, R.prototype.getSvgElement = function(u, w) { + var $ = new EC("tspan"); + return $.textContent = u, w && $.node.setAttribute("style", w), $; + }, R.prototype.wrapHtml = function(u, w) { + return w === "" ? "" + u + "" : "" + u + ""; + }, R.prototype.getHtmlElement = function(u, w) { + var $ = document.createElement("span"); + return $.innerHTML = u, w && $.setAttribute("style", w), $; + }, R.prototype.styleSvgToHtml = function(u) { + return u.replace(/fill:/, "color:"); + }, R.prototype.translateStyleShortcuts = function(u) { + if (u == "" || u == "[ ]") + return ""; + var w = hi.getCache("translateStyleShortcuts_" + u); + if (w) + return w; + var $ = u.match(/('[^']*')|("[^"]*")/gi); + if ($) + for (var G = 0; G < $.length; G++) + u = u.replace($[G], $[G].replace(/['"]*/g, "").replace(/[ ]+/g, "+")); + var K = u.match(/([\w\-]*:[\s]?[^;\s\]]*)|(\#[\w]{1,6})|([\w]+)|(\/)/gi); + if (!K) + return u; + for (G = 0; G < K.length; G++) + K[G].match(/^bold$/i) ? K[G] = "font-weight:" + K[G] : K[G] == "/" ? K[G] = "" : K[G].match(/:/) ? K[G] = K[G].replace(/\+/g, " ") : K[G] = "fill:" + K[G]; + var ne = K.join(";"); + return hi.setCache("translateStyleShortcuts_" + u, ne), ne; + }, R.prototype.chunk = function(u, w, $) { + w === void 0 && (w = !1), $ === void 0 && ($ = !1); + var G = []; + u = this.escape(u); + for (var K = w ? u.split("'") : [u], ne = 0; ne < K.length; ne++) { + var ue = K[ne]; + if (ue !== "") + if (ne % 2 == 0) + for (var we = (ue = (ue = ue.replace(/\]\[/g, "]" + Ir + "[")).replace(/\[\]/g, "[ ]")).split(/[\[\]]+/), De = 0; De < we.length; De++) + ($e = this.cleanUp(this.unescape(we[De]))) !== Ir && $e !== "" && (De % 2 == 0 ? G.push({ type: "value", text: this.adapter.apply("chunk", $e) }) : G.push({ type: $ ? "value" : "format", text: "[" + $e + "]" })); + else + for (we = ue.split(/[\[\]]+/), De = 0; De < we.length; De++) { + var $e; + ($e = this.cleanUp(this.unescape(we[De]))) !== "" && (De % 2 == 0 ? G.push({ type: "text", text: $e }) : this.isImage($e) ? G.push({ type: "image", text: "[" + $e + "]" }) : G.push({ type: "format", text: "[" + $e + "]" })); + } + } + return G; + }, R.prototype.isImage = function(u) { + return !!u.match(/img[ ]?:/); + }, R; + }(Ht); + function Xv() { + return Er == null && (Er = new K3()), Er; + } + hi.registeredClasses.TextFormatter = K3; + var sA = function(U) { + function R() { + var u = U.call(this) || this; + return u._negativeBase = 0, u._numberFormat = "#,###.#####", u._outputFormat = "svg", u._smallNumberThreshold = 1, u._forceLTR = !1, u.className = "NumberFormatter", u.applyTheme(), u; + } + return re(R, U), R.prototype.dispose = function() { + U.prototype.dispose.call(this), this.language && this.language.dispose(); + }, Object.defineProperty(R.prototype, "language", { get: function() { + return this._language || (this.sprite ? this._language = this.sprite.language : this._language = new Yv()), this._language; + }, set: function(u) { + this._language = u; + }, enumerable: !0, configurable: !0 }), R.prototype.format = function(u, w, $) { + var G; + (w === void 0 || st(w) && w.toLowerCase() === "number") && (w = this._numberFormat); + var K = Number(u); + if (ct(w)) + try { + return this.intlLocales ? new Intl.NumberFormat(this.intlLocales, w).format(K) : new Intl.NumberFormat(void 0, w).format(K); + } catch { + return "Invalid"; + } + else { + w = xh(w); + var ne = this.parseFormat(w, this.language), ue = void 0; + ue = K > this._negativeBase ? ne.positive : K < this._negativeBase ? ne.negative : ne.zero, Ee($) && !ue.mod && ((ue = Nr(ue)).decimals.active = K == 0 ? 0 : $), G = ue.template.split(Ir).join(this.applyFormat(K, ue)); + } + return this.forceLTR && (G = "‎" + G), G; + }, R.prototype.parseFormat = function(u, w) { + var $ = this, G = this.getCache(u); + if (Ee(G)) + return G; + var K = { positive: { thousands: { active: -1, passive: -1, interval: -1, separator: w.translateEmpty("_thousandSeparator") }, decimals: { active: -1, passive: -1, separator: w.translateEmpty("_decimalSeparator") }, template: "", source: "", parsed: !1 }, negative: { thousands: { active: -1, passive: -1, interval: -1, separator: w.translateEmpty("_thousandSeparator") }, decimals: { active: -1, passive: -1, separator: w.translateEmpty("_decimalSeparator") }, template: "", source: "", parsed: !1 }, zero: { thousands: { active: -1, passive: -1, interval: -1, separator: w.translateEmpty("_thousandSeparator") }, decimals: { active: -1, passive: -1, separator: w.translateEmpty("_decimalSeparator") }, template: "", source: "", parsed: !1 } }, ne = (u = u.replace("||", ur)).split("|"); + return K.positive.source = ne[0], ne[2] === void 0 ? K.zero = K.positive : K.zero.source = ne[2], ne[1] === void 0 ? K.negative = K.positive : K.negative.source = ne[1], mi(K, function(ue, we) { + if (!we.parsed) + if ($.getCache(we.source) === void 0) { + var De = we.source; + De.toLowerCase() === "number" && (De = st($._numberFormat) ? $._numberFormat : "#,###.#####"); + for (var $e = Xv().chunk(De, !0), Ke = 0; Ke < $e.length; Ke++) { + var Ze = $e[Ke]; + if (Ze.text = Ze.text.replace(ur, "|"), Ze.type === "value") { + var pt = Ze.text.match(/[#0.,]+[ ]?[abespABESP%!]?[abespABESP‰!]?/); + if (pt) + if (pt === null || pt[0] === "") + we.template += Ze.text; + else { + var Vt = pt[0].match(/[abespABESP%‰!]{2}|[abespABESP%‰]{1}$/); + Vt && (we.mod = Vt[0].toLowerCase(), we.modSpacing = !!pt[0].match(/[ ]{1}[abespABESP%‰!]{1}$/)); + var Yt = pt[0].split("."); + if (Yt[0] !== "") { + we.thousands.active = (Yt[0].match(/0/g) || []).length, we.thousands.passive = (Yt[0].match(/\#/g) || []).length + we.thousands.active; + var ci = Yt[0].split(","); + ci.length === 1 || (we.thousands.interval = Be(ci.pop()).length, we.thousands.interval === 0 && (we.thousands.interval = -1)); + } + Yt[1] === void 0 || (we.decimals.active = (Yt[1].match(/0/g) || []).length, we.decimals.passive = (Yt[1].match(/\#/g) || []).length + we.decimals.active), we.template += Ze.text.split(pt[0]).join(Ir); + } + } else + we.template += Ze.text; + } + $.setCache(we.source, we), we.parsed = !0; + } else + K[ue] = $.getCache(we.source); + }), this.setCache(u, K), K; + }, R.prototype.applyFormat = function(u, w) { + var $ = u < 0; + u = Math.abs(u); + var G, K = "", ne = "", ue = w.mod ? w.mod.split("") : []; + if (ue.indexOf("b") !== -1) { + var we = this.applyPrefix(u, this.bytePrefixes, ue.indexOf("!") !== -1); + u = we[0], K = we[1], ne = we[2], w.modSpacing && (ne = " " + ne); + } else if (ue.indexOf("a") !== -1) { + var De = this.applyPrefix(u, u < this.smallNumberThreshold ? this.smallNumberPrefixes : this.bigNumberPrefixes, ue.indexOf("!") !== -1); + u = De[0], K = De[1], ne = De[2], w.modSpacing && (ne = " " + ne); + } else if (ue.indexOf("p") !== -1) { + var $e = Math.min(u.toString().length + 2, 21); + u = parseFloat(u.toPrecision($e)), K = this.language.translate("_percentPrefix") || "", ne = this.language.translate("_percentSuffix") || "", K == "" && ne == "" && (ne = "%"); + } else + ue.indexOf("%") !== -1 ? ($e = H(u.toString().length + 2, 21), u *= 100, u = parseFloat(u.toPrecision($e)), ne = "%") : ue.indexOf("‰") !== -1 && ($e = H(u.toString().length + 3, 21), u *= 1e3, u = parseFloat(u.toPrecision($e)), ne = "‰"); + if (ue.indexOf("e") !== -1) + G = w.decimals.passive >= 0 ? u.toExponential(w.decimals.passive).split("e") : u.toExponential().split("e"), u = Number(G[0]), ne = "e" + G[1], w.modSpacing && (ne = " " + ne); + else if (w.decimals.passive === 0) + u = Math.round(u); + else if (w.decimals.passive > 0) { + var Ke = Math.pow(10, w.decimals.passive); + u = Math.round(u * Ke) / Ke; + } + var Ze = "", pt = Ud(u).split("."), Vt = pt[0]; + if (Vt.length < w.thousands.active && (Vt = Array(w.thousands.active - Vt.length + 1).join("0") + Vt), w.thousands.interval > 0) { + for (var Yt = [], ci = Vt.split("").reverse().join(""), ai = 0, Gi = Vt.length; ai <= Gi; ai += w.thousands.interval) { + var Ji = ci.substr(ai, w.thousands.interval).split("").reverse().join(""); + Ji !== "" && Yt.unshift(Ji); + } + Vt = Yt.join(w.thousands.separator); + } + Ze += Vt, pt.length === 1 && pt.push(""); + var Ci = pt[1]; + return Ci.length < w.decimals.active && (Ci += Array(w.decimals.active - Ci.length + 1).join("0")), Ci !== "" && (Ze += w.decimals.separator + Ci), Ze === "" && (Ze = "0"), u !== 0 && $ && ue.indexOf("s") === -1 && (Ze = "-" + Ze), K && (Ze = K + Ze), ne && (Ze += ne), Ze; + }, R.prototype.applyPrefix = function(u, w, $) { + $ === void 0 && ($ = !1); + for (var G = u, K = "", ne = "", ue = !1, we = 1, De = 0, $e = w.length; De < $e; De++) + w[De].number <= u && (w[De].number === 0 ? G = 0 : (G = u / w[De].number, we = w[De].number), K = w[De].prefix, ne = w[De].suffix, ue = !0); + return !ue && $ && w.length && u != 0 && (G = u / w[0].number, K = w[0].prefix, ne = w[0].suffix, ue = !0), ue && (G = parseFloat(G.toPrecision(H(we.toString().length + Math.floor(G).toString().replace(/[^0-9]*/g, "").length, 21)))), [G, K, ne]; + }, R.prototype.invalidateSprite = function() { + this.sprite && this.sprite.invalidate(); + }, Object.defineProperty(R.prototype, "numberFormat", { get: function() { + return this._numberFormat; + }, set: function(u) { + this._numberFormat = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "intlLocales", { get: function() { + return this._intlLocales; + }, set: function(u) { + this._intlLocales = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "negativeBase", { get: function() { + return this._negativeBase; + }, set: function(u) { + this._negativeBase = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bigNumberPrefixes", { get: function() { + return Ee(this._bigNumberPrefixes) || (this._bigNumberPrefixes = [{ number: 1e3, suffix: this.language.translate("_big_number_suffix_3") }, { number: 1e6, suffix: this.language.translate("_big_number_suffix_6") }, { number: 1e9, suffix: this.language.translate("_big_number_suffix_9") }, { number: 1e12, suffix: this.language.translate("_big_number_suffix_12") }, { number: 1e15, suffix: this.language.translate("_big_number_suffix_15") }, { number: 1e18, suffix: this.language.translate("_big_number_suffix_18") }, { number: 1e21, suffix: this.language.translate("_big_number_suffix_21") }, { number: 1e24, suffix: this.language.translate("_big_number_suffix_24") }]), this._bigNumberPrefixes; + }, set: function(u) { + this._bigNumberPrefixes = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "smallNumberPrefixes", { get: function() { + return Ee(this._smallNumberPrefixes) || (this._smallNumberPrefixes = [{ number: 1e-24, suffix: this.language.translate("_small_number_suffix_24") }, { number: 1e-21, suffix: this.language.translate("_small_number_suffix_21") }, { number: 1e-18, suffix: this.language.translate("_small_number_suffix_18") }, { number: 1e-15, suffix: this.language.translate("_small_number_suffix_15") }, { number: 1e-12, suffix: this.language.translate("_small_number_suffix_12") }, { number: 1e-9, suffix: this.language.translate("_small_number_suffix_9") }, { number: 1e-6, suffix: this.language.translate("_small_number_suffix_6") }, { number: 1e-3, suffix: this.language.translate("_small_number_suffix_3") }]), this._smallNumberPrefixes; + }, set: function(u) { + this._smallNumberPrefixes = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "smallNumberThreshold", { get: function() { + return this._smallNumberThreshold; + }, set: function(u) { + this._smallNumberThreshold = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bytePrefixes", { get: function() { + return Ee(this._bytePrefixes) || (this._bytePrefixes = [{ number: 1, suffix: this.language.translate("_byte_suffix_B") }, { number: 1024, suffix: this.language.translate("_byte_suffix_KB") }, { number: 1048576, suffix: this.language.translate("_byte_suffix_MB") }, { number: 1073741824, suffix: this.language.translate("_byte_suffix_GB") }, { number: 1099511627776, suffix: this.language.translate("_byte_suffix_TB") }, { number: 1125899906842624, suffix: this.language.translate("_byte_suffix_PB") }]), this._bytePrefixes; + }, set: function(u) { + this._bytePrefixes = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outputFormat", { get: function() { + return this._outputFormat; + }, set: function(u) { + this._outputFormat = u.toLowerCase(), this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "forceLTR", { get: function() { + return this._forceLTR; + }, set: function(u) { + this._forceLTR = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), R.prototype.escape = function(u) { + return u.replace("||", ur); + }, R.prototype.unescape = function(u) { + return u.replace(ur, "|"); + }, R; + }(Ht); + hi.registeredClasses.NumberFormatter = sA; + var OC = function(U) { + function R() { + var u = U.call(this) || this; + return u._dateFormat = "yyyy-MM-dd", u._inputDateFormat = "yyyy-MM-dd", u._utc = !1, u.timezoneMinutes = 0, u._firstDayOfWeek = 1, u.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], u.monthsShort = ["Jan", "Feb", "Mar", "Apr", "May(short)", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], u.weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], u.weekdaysShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], u._outputFormat = "svg", u.capitalize = !0, u.className = "DateFormatter", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "language", { get: function() { + return this._language; + }, set: function(u) { + this._language = u, this.dateFormat = this._language.translate("_date"); + }, enumerable: !0, configurable: !0 }), R.prototype.format = function(u, w, $) { + var G, K; + if (this.language || (this.sprite ? this.language = this.sprite.language : this.language = new Yv()), w !== void 0 && w !== "" || (w = this._dateFormat), K = st(u) ? this.parse(u) : zg(u), ct(w)) + try { + return this.intlLocales ? new Intl.DateTimeFormat(this.intlLocales, w).format(K) : new Intl.DateTimeFormat(void 0, w).format(K); + } catch { + return "Invalid"; + } + else { + w = xh(w); + var ne = this.parseFormat(w); + if (Ee(this.timezoneOffset) ? K.setMinutes(K.getMinutes() + K.getTimezoneOffset() - this.timezoneOffset) : Ee(this.timezone) && $ !== !1 && (K = nA(K, this.timezone)), !le(K.getTime())) + return this.language.translate("Invalid date"); + G = this.applyFormat(K, ne, this.language), this.capitalize && (G = G.replace(/^.{1}/, G.substr(0, 1).toUpperCase())); + } + return G; + }, R.prototype.parseFormat = function(u) { + var w = this.getCache(u); + if (Ee(w)) + return w; + for (var $ = { template: "", parts: [] }, G = Xv().chunk(u, !0), K = 0; K < G.length; K++) { + var ne = G[K]; + if (ne.type === "value") { + ne.text.match(/^date$/i) && st(this._dateFormat) && (ne.text = this._dateFormat); + var ue = ne.text.match(/G|yyyy|yyy|yy|y|YYYY|YYY|YY|Y|u|q|MMMMM|MMMM|MMM|MM|M|ww|w|W|dd|d|DDD|DD|D|F|g|EEEEE|EEEE|EEE|EE|E|eeeee|eeee|eee|ee|e|aaa|aa|a|hh|h|HH|H|KK|K|kk|k|mm|m|ss|s|SSS|SS|S|A|zzzz|zzz|zz|z|ZZ|Z|t|x|nnn|nn|n|i|I/g); + if (ue) + for (var we = 0; we < ue.length; we++) + $.parts.push(ue[we]), ne.text = ne.text.replace(ue[we], Ir); + } + $.template += ne.text; + } + return this.setCache(u, $), $; + }, R.prototype.applyFormat = function(u, w, $) { + var G, K, ne, ue, we, De, $e, Ke, Ze = w.template, pt = u.getTimezoneOffset(), Vt = u.getTime(); + this.utc ? (G = u.getUTCFullYear(), K = u.getUTCMonth(), ne = u.getUTCDay(), ue = u.getUTCDate(), we = u.getUTCHours(), De = u.getUTCMinutes(), $e = u.getUTCSeconds(), Ke = u.getUTCMilliseconds()) : (G = u.getFullYear(), K = u.getMonth(), ne = u.getDay(), ue = u.getDate(), we = u.getHours(), De = u.getMinutes(), $e = u.getSeconds(), Ke = u.getMilliseconds()); + for (var Yt = 0, ci = w.parts.length; Yt < ci; Yt++) { + var ai = ""; + switch (w.parts[Yt]) { + case "G": + ai = $.translate(G < 0 ? "_era_bc" : "_era_ad"); + break; + case "yyyy": + ai = Math.abs(G).toString(), G < 0 && (ai += $.translate("_era_bc")); + break; + case "yyy": + case "yy": + case "y": + ai = Math.abs(G).toString().substr(-w.parts[Yt].length), G < 0 && (ai += $.translate("_era_bc")); + break; + case "YYYY": + case "YYY": + case "YY": + case "Y": + var Gi = G; + Mr(u) == 1 && ne > 4 && Gi--, ai = w.parts[Yt] == "YYYY" ? Math.abs(Gi).toString() : Math.abs(Gi).toString().substr(-w.parts[Yt].length), Gi < 0 && (ai += $.translate("_era_bc")); + break; + case "u": + case "F": + case "g": + break; + case "q": + ai = "" + Math.ceil((u.getMonth() + 1) / 3); + break; + case "MMMMM": + ai = $.translate(this.months[K]).substr(0, 1); + break; + case "MMMM": + ai = $.translate(this.months[K]); + break; + case "MMM": + ai = $.translate(this.monthsShort[K]); + break; + case "MM": + ai = Vl(K + 1, 2, "0"); + break; + case "M": + ai = (K + 1).toString(); + break; + case "ww": + ai = Vl(Mr(u, this.utc), 2, "0"); + break; + case "w": + ai = Mr(u, this.utc).toString(); + break; + case "W": + ai = zn(u, this.utc).toString(); + break; + case "dd": + ai = Vl(ue, 2, "0"); + break; + case "d": + ai = ue.toString(); + break; + case "DD": + case "DDD": + ai = Vl(Bi(u, this.utc).toString(), w.parts[Yt].length, "0"); + break; + case "D": + ai = Bi(u, this.utc).toString(); + break; + case "t": + ai = $.translateFunc("_dateOrd").call(this, ue); + break; + case "E": + ai = (ne || 7).toString(); + break; + case "EE": + ai = Vl((ne || 7).toString(), 2, "0"); + break; + case "EEE": + case "eee": + ai = $.translate(this.weekdaysShort[ne]); + break; + case "EEEE": + case "eeee": + ai = $.translate(this.weekdays[ne]); + break; + case "EEEEE": + case "eeeee": + ai = $.translate(this.weekdays[ne]).substr(0, 1); + break; + case "e": + case "ee": + ai = (ne - this.firstDayOfWeek + 1).toString(), w.parts[Yt] == "ee" && (ai = Vl(ai, 2, "0")); + break; + case "a": + ai = we >= 12 ? $.translate("PM") : $.translate("AM"); + break; + case "aa": + ai = we >= 12 ? $.translate("P.M.") : $.translate("A.M."); + break; + case "aaa": + ai = we >= 12 ? $.translate("P") : $.translate("A"); + break; + case "h": + ai = Ss(we).toString(); + break; + case "hh": + ai = Vl(Ss(we), 2, "0"); + break; + case "H": + ai = we.toString(); + break; + case "HH": + ai = Vl(we, 2, "0"); + break; + case "K": + ai = Ss(we, 0).toString(); + break; + case "KK": + ai = Vl(Ss(we, 0), 2, "0"); + break; + case "k": + ai = (we + 1).toString(); + break; + case "kk": + ai = Vl(we + 1, 2, "0"); + break; + case "m": + ai = De.toString(); + break; + case "mm": + ai = Vl(De, 2, "0"); + break; + case "s": + ai = $e.toString(); + break; + case "ss": + ai = Vl($e, 2, "0"); + break; + case "S": + case "SS": + case "SSS": + ai = Math.round(Ke / 1e3 * Math.pow(10, w.parts[Yt].length)).toString(); + break; + case "x": + ai = Vt.toString(); + break; + case "n": + case "nn": + case "nnn": + ai = Vl(Ke, w.parts[Yt].length, "0"); + break; + case "z": + ai = da(u, !1, !1, this.utc); + break; + case "zz": + ai = da(u, !0, !1, this.utc); + break; + case "zzz": + ai = da(u, !1, !0, this.utc); + break; + case "zzzz": + ai = da(u, !0, !0, this.utc); + break; + case "Z": + case "ZZ": + var Ji = Math.abs(pt) / 60, Ci = Math.floor(Ji), Hi = 60 * Ji - 60 * Ci; + this.utc && (Ci = 0, Hi = 0), w.parts[Yt] == "Z" ? (ai = "GMT", ai += pt > 0 ? "-" : "+", ai += Vl(Ci, 2) + ":" + Vl(Hi, 2)) : (ai = pt > 0 ? "-" : "+", ai += Vl(Ci, 2) + Vl(Hi, 2)); + break; + case "i": + ai = u.toISOString(); + break; + case "I": + ai = u.toUTCString(); + } + Ze = Ze.replace(Ir, ai); + } + return Ze; + }, R.prototype.parse = function(u, w) { + if (Ee(w) || (w = this.inputDateFormat), u instanceof Date) + return u; + if (typeof u == "number") + return new Date(u); + var $; + typeof u != "string" && (u = u.toString()), this.language || (this.sprite ? this.language = this.sprite.language : this.language = new Yv()); + var G = ""; + w = (w = xh(w)).substr(0, u.length); + for (var K = this.parseFormat(w), ne = { year: -1, year3: -1, year2: -1, year1: -1, month: -1, monthShort: -1, monthLong: -1, weekdayShort: -1, weekdayLong: -1, day: -1, yearDay: -1, week: -1, hourBase0: -1, hour12Base0: -1, hourBase1: -1, hour12Base1: -1, minute: -1, second: -1, millisecond: -1, millisecondDigits: -1, am: -1, zone: -1, timestamp: -1, iso: -1 }, ue = { year: 1970, month: 0, day: 1, hour: 0, minute: 0, second: 0, millisecond: 0, timestamp: null, offset: 0, utc: this.utc }, we = 0, De = 0, $e = 0; $e < K.parts.length; $e++) { + switch (De = $e + we + 1, K.parts[$e]) { + case "yyyy": + case "YYYY": + G += "([0-9]{4})", ne.year = De; + break; + case "yyy": + case "YYY": + G += "([0-9]{3})", ne.year3 = De; + break; + case "yy": + case "YY": + G += "([0-9]{2})", ne.year2 = De; + break; + case "y": + case "Y": + G += "([0-9]{1})", ne.year1 = De; + break; + case "MMMM": + G += "(" + this.getStringList(this.months).join("|") + ")", ne.monthLong = De; + break; + case "MMM": + G += "(" + this.getStringList(this.monthsShort).join("|") + ")", ne.monthShort = De; + break; + case "MM": + case "M": + G += "([0-9]{2}|[0-9]{1})", ne.month = De; + break; + case "ww": + case "w": + G += "([0-9]{2}|[0-9]{1})", ne.week = De; + break; + case "dd": + case "d": + G += "([0-9]{2}|[0-9]{1})", ne.day = De; + break; + case "DDD": + case "DD": + case "D": + G += "([0-9]{3}|[0-9]{2}|[0-9]{1})", ne.yearDay = De; + break; + case "dddd": + G += "(" + this.getStringList(this.weekdays).join("|") + ")", ne.weekdayLong = De; + break; + case "ddd": + G += "(" + this.getStringList(this.weekdaysShort).join("|") + ")", ne.weekdayShort = De; + break; + case "aaa": + case "aa": + case "a": + G += "(" + this.getStringList(["AM", "PM", "A.M.", "P.M.", "A", "P"]).join("|") + ")", ne.am = De; + break; + case "hh": + case "h": + G += "([0-9]{2}|[0-9]{1})", ne.hour12Base1 = De; + break; + case "HH": + case "H": + G += "([0-9]{2}|[0-9]{1})", ne.hourBase0 = De; + break; + case "KK": + case "K": + G += "([0-9]{2}|[0-9]{1})", ne.hour12Base0 = De; + break; + case "kk": + case "k": + G += "([0-9]{2}|[0-9]{1})", ne.hourBase1 = De; + break; + case "mm": + case "m": + G += "([0-9]{2}|[0-9]{1})", ne.minute = De; + break; + case "ss": + case "s": + G += "([0-9]{2}|[0-9]{1})", ne.second = De; + break; + case "SSS": + case "SS": + case "S": + G += "([0-9]{3}|[0-9]{2}|[0-9]{1})", ne.millisecond = De, ne.millisecondDigits = K.parts[$e].length; + break; + case "nnn": + case "nn": + case "n": + G += "([0-9]{3}|[0-9]{2}|[0-9]{1})", ne.millisecond = De; + break; + case "x": + G += "([0-9]{1,})", ne.timestamp = De; + break; + case "Z": + G += "GMT([-+]+[0-9]{2}:[0-9]{2})", ne.zone = De; + break; + case "ZZ": + G += "([\\-+]+[0-9]{2}[0-9]{2})", ne.zone = De; + break; + case "i": + G += "([0-9]{4})-?([0-9]{2})-?([0-9]{2})T?([0-9]{2}):?([0-9]{2}):?([0-9]{2}).?([0-9]{0,3})([zZ]|[+-][0-9]{2}:?[0-9]{2}|$)", ne.iso = De, we += 7; + break; + case "G": + case "YYYY": + case "YYY": + case "YY": + case "Y": + case "MMMMM": + case "W": + case "EEEEE": + case "EEEE": + case "EEE": + case "EE": + case "E": + case "eeeee": + case "eeee": + case "eee": + case "ee": + case "e": + case "zzzz": + case "zzz": + case "zz": + case "z": + case "t": + we--; + } + G += "[^0-9]*"; + } + var Ke = new RegExp(G), Ze = u.match(Ke); + if (Ze) { + if (ne.year > -1 && (ue.year = parseInt(Ze[ne.year])), ne.year3 > -1) { + var pt = parseInt(Ze[ne.year3]); + pt += 1e3, ue.year = pt; + } + if (ne.year2 > -1 && (pt = parseInt(Ze[ne.year2]), pt += pt > 50 ? 1e3 : 2e3, ue.year = pt), ne.year1 > -1 && (pt = parseInt(Ze[ne.year1]), pt = 10 * Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 10) + pt, ue.year = pt), ne.monthLong > -1 && (ue.month = this.resolveMonth(Ze[ne.monthLong])), ne.monthShort > -1 && (ue.month = this.resolveShortMonth(Ze[ne.monthShort])), ne.month > -1 && (ue.month = parseInt(Ze[ne.month]) - 1), ne.week > -1 && ne.day === -1 && (ue.month = 0, ue.day = xs(parseInt(Ze[ne.week]), ue.year, 1, this.utc)), ne.day > -1 && (ue.day = parseInt(Ze[ne.day])), ne.yearDay > -1 && (ue.month = 0, ue.day = parseInt(Ze[ne.yearDay])), ne.hourBase0 > -1 && (ue.hour = parseInt(Ze[ne.hourBase0])), ne.hourBase1 > -1 && (ue.hour = parseInt(Ze[ne.hourBase1]) - 1), ne.hour12Base0 > -1 && ((pt = parseInt(Ze[ne.hour12Base0])) == 11 && (pt = 0), ne.am > -1 && !this.isAm(Ze[ne.am]) && (pt += 12), ue.hour = pt), ne.hour12Base1 > -1 && ((pt = parseInt(Ze[ne.hour12Base1])) == 12 && (pt = 0), ne.am > -1 && !this.isAm(Ze[ne.am]) && (pt += 12), ue.hour = pt), ne.minute > -1 && (ue.minute = parseInt(Ze[ne.minute])), ne.second > -1 && (ue.second = parseInt(Ze[ne.second])), ne.millisecond > -1 && (pt = parseInt(Ze[ne.millisecond]), ne.millisecondDigits == 2 ? pt *= 10 : ne.millisecondDigits == 1 && (pt *= 100), ue.millisecond = pt), ne.timestamp > -1) { + ue.timestamp = parseInt(Ze[ne.timestamp]); + var Vt = new Date(ue.timestamp); + ue.year = Vt.getUTCFullYear(), ue.month = Vt.getUTCMonth(), ue.day = Vt.getUTCDate(), ue.hour = Vt.getUTCHours(), ue.minute = Vt.getUTCMinutes(), ue.second = Vt.getUTCSeconds(), ue.millisecond = Vt.getUTCMilliseconds(); + } + ne.zone > -1 && (ue.offset = this.resolveTimezoneOffset(new Date(ue.year, ue.month, ue.day), Ze[ne.zone])), ne.iso > -1 && (ue.year = It(Ze[ne.iso + 0]), ue.month = It(Ze[ne.iso + 1]) - 1, ue.day = It(Ze[ne.iso + 2]), ue.hour = It(Ze[ne.iso + 3]), ue.minute = It(Ze[ne.iso + 4]), ue.second = It(Ze[ne.iso + 5]), ue.millisecond = It(Ze[ne.iso + 6]), Ze[ne.iso + 7] == "Z" || Ze[ne.iso + 7] == "z" ? ue.utc = !0 : Ze[ne.iso + 7] != "" && (ue.offset = this.resolveTimezoneOffset(new Date(ue.year, ue.month, ue.day), Ze[ne.iso + 7]))), $ = ue.utc ? new Date(Date.UTC(ue.year, ue.month, ue.day, ue.hour, ue.minute, ue.second, ue.millisecond)) : new Date(ue.year, ue.month, ue.day, ue.hour, ue.minute + ue.offset, ue.second, ue.millisecond); + } else + $ = new Date(u); + return $; + }, R.prototype.resolveTimezoneOffset = function(u, w) { + if (w.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/)) { + var $ = Be(w.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/)), G = $[1], K = $[2], ne = $[3], ue = 60 * parseInt(K) + parseInt(ne); + return G == "+" && (ue *= -1), ue - (u || /* @__PURE__ */ new Date()).getTimezoneOffset(); + } + return 0; + }, R.prototype.resolveMonth = function(u) { + var w = this.months.indexOf(u); + return w > -1 || this.language && !this.language.isDefault() && (w = this.language.translateAll(this.months).indexOf(u)) > -1 ? w : 0; + }, R.prototype.resolveShortMonth = function(u) { + var w = this.monthsShort.indexOf(u); + return w > -1 || (w = this.months.indexOf(u)) > -1 || this.language && !this.language.isDefault() && (w = this.language.translateAll(this.monthsShort).indexOf(u)) > -1 ? w : 0; + }, R.prototype.isAm = function(u) { + return this.getStringList(["AM", "A.M.", "A"]).indexOf(u.toUpperCase()) > -1; + }, R.prototype.invalidateSprite = function() { + this.sprite && this.sprite.invalidate(); + }, R.prototype.getStringList = function(u) { + for (var w = [], $ = 0; $ < u.length; $++) + this.language ? w.push(Bl(this.language.translate(u[$]))) : w.push(Bl(u[$])); + return w; + }, Object.defineProperty(R.prototype, "dateFormat", { get: function() { + return this._dateFormat; + }, set: function(u) { + this._dateFormat = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inputDateFormat", { get: function() { + return this._inputDateFormat; + }, set: function(u) { + this._inputDateFormat = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "intlLocales", { get: function() { + return this._intlLocales; + }, set: function(u) { + this._intlLocales = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "utc", { get: function() { + return this._utc; + }, set: function(u) { + this._utc = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "timezoneOffset", { get: function() { + return this._timezoneOffset; + }, set: function(u) { + this._timezoneOffset != u && (this._timezoneOffset = u, this.invalidateSprite()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "timezone", { get: function() { + return this._timezone; + }, set: function(u) { + this._timezone != u && (this._timezone = u, this.timezoneMinutes = B8(u), this.invalidateSprite()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "firstDayOfWeek", { get: function() { + return this._firstDayOfWeek; + }, set: function(u) { + this._firstDayOfWeek = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outputFormat", { get: function() { + return this._outputFormat; + }, set: function(u) { + this._outputFormat = u.toLowerCase(), this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), R; + }(Ht); + hi.registeredClasses.DateFormatter = OC; + var J3 = function(U) { + function R() { + var u = U.call(this) || this; + return u._negativeBase = 0, u._baseUnit = "second", u._outputFormat = "svg", u._unitValues = { millisecond: 1, second: 1e3, minute: 6e4, hour: 36e5, day: 864e5, week: 6048e5, month: 2592e6, year: 31536e6 }, u._unitAliases = { Y: "y", D: "d", H: "h", K: "h", k: "h", n: "S" }, u.className = "DurationFormatter", u.applyTheme(), u; + } + return re(R, U), R.prototype.format = function(u, w, $) { + this.language || (this.sprite ? this.language = this.sprite.language : this.language = new Yv()); + var G = $ || this._baseUnit; + w !== void 0 && w !== "" || (w = Ee(this.durationFormat) ? this.durationFormat : this.getFormat(It(u), null, G)), w = xh(w); + var K, ne = this.parseFormat(w, G), ue = Number(u); + K = ue > this._negativeBase ? ne.positive : ue < this._negativeBase ? ne.negative : ne.zero; + var we = this.applyFormat(ue, K); + return K.color !== "" && (this._outputFormat === "svg" ? we = "" + we + "" : this._outputFormat === "html" && (we = "" + we + "")), we; + }, R.prototype.parseFormat = function(u, w) { + var $ = this, G = this.getCache(u); + if (Ee(G)) + return G; + var K = w || this._baseUnit, ne = { positive: { color: "", template: "", parts: [], source: "", baseUnit: K, parsed: !1, absolute: !1 }, negative: { color: "", template: "", parts: [], source: "", baseUnit: K, parsed: !1, absolute: !1 }, zero: { color: "", template: "", parts: [], source: "", baseUnit: K, parsed: !1, absolute: !1 } }, ue = (u = u.replace("||", ur)).split("|"); + return ne.positive.source = ue[0], ue[2] === void 0 ? ne.zero = ne.positive : ne.zero.source = ue[2], ue[1] === void 0 ? ne.negative = ne.positive : ne.negative.source = ue[1], mi(ne, function(we, De) { + if (!De.parsed) + if ($.getCache(De.source) === void 0) { + var $e, Ke = De.source; + ($e = De.source.match(/^\[([^\]]*)\]/)) && $e.length && $e[0] !== "" && (Ke = De.source.substr($e[0].length), De.color = $e[1]); + for (var Ze = Xv().chunk(Ke, !0), pt = 0; pt < Ze.length; pt++) { + var Vt = Ze[pt]; + if (Vt.text = Vt.text.replace(ur, "|"), Vt.type === "value") { + Vt.text.match(/[yYMdDwhHKkmsSn]+a/) && (De.absolute = !0, Vt.text = Vt.text.replace(/([yYMdDwhHKkmsSn]+)a/, "$1")); + var Yt = Vt.text.match(/y+|Y+|M+|d+|D+|w+|h+|H+|K+|k+|m+|s+|S+|n+/g); + if (Yt) + for (var ci = 0; ci < Yt.length; ci++) + Ee(Yt[ci]) || (Yt[ci] = $._unitAliases[Yt[ci]]), De.parts.push(Yt[ci]), Vt.text = Vt.text.replace(Yt[ci], Ir); + } + De.template += Vt.text; + } + $.setCache(De.source, De), De.parsed = !0; + } else + ne[we] = $.getCache(De.source); + }), this.setCache(u, ne), ne; + }, R.prototype.applyFormat = function(u, w) { + var $ = !w.absolute && u < this._negativeBase; + u = Math.abs(u); + for (var G = this.toTimeStamp(u, w.baseUnit), K = w.template, ne = 0, ue = w.parts.length; ne < ue; ne++) { + var we = w.parts[ne], De = this.toTimeUnit(we.substr(0, 1)), $e = we.length, Ke = Math.floor(G / this._unitValues[De]); + K = K.replace(Ir, Vl(Ke, $e, "0")), G -= Ke * this._unitValues[De]; + } + return $ && (K = "-" + K), K; + }, R.prototype.toTimeStamp = function(u, w) { + return u * this._unitValues[w]; + }, R.prototype.toTimeUnit = function(u) { + switch (u) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + return "hour"; + case "d": + return "day"; + case "w": + return "week"; + case "M": + return "month"; + case "y": + return "year"; + } + }, R.prototype.invalidateSprite = function() { + this.sprite && this.sprite.invalidate(); + }, Object.defineProperty(R.prototype, "baseUnit", { get: function() { + return this._baseUnit; + }, set: function(u) { + this._baseUnit = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outputFormat", { get: function() { + return this._outputFormat; + }, set: function(u) { + this._outputFormat = u.toLowerCase(), this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), R.prototype.getFormat = function(u, w, $) { + if (Ee(this.durationFormat)) + return this.durationFormat; + if ($ || ($ = this.baseUnit), Ee(w) && u != w) { + u = Math.abs(u), w = Math.abs(w); + var G = this.getValueUnit(ve(u, w), $); + return this.durationFormats[$][G]; + } + var K = this.getValueUnit(u, $); + return this.durationFormats[$][K]; + }, R.prototype.getValueUnit = function(u, w) { + var $; + w || (w = this.baseUnit); + var G = this.getMilliseconds(u, w); + return pi(this._unitValues, function(K, ne) { + if (K == w || $) { + if (G / ne <= 1) + return $ || ($ = K), !1; + $ = K; + } + return !0; + }), $; + }, R.prototype.getMilliseconds = function(u, w) { + return w || (w = this.baseUnit), u * this._unitValues[w]; + }, Object.defineProperty(R.prototype, "durationFormat", { get: function() { + return this._durationFormat; + }, set: function(u) { + this._durationFormat != u && (this._durationFormat = u, this.invalidateSprite()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "durationFormats", { get: function() { + return this._durationFormats || (this._durationFormats = { millisecond: { millisecond: this.language.translate("_duration_millisecond"), second: this.language.translate("_duration_millisecond_second"), minute: this.language.translate("_duration_millisecond_minute"), hour: this.language.translate("_duration_millisecond_hour"), day: this.language.translate("_duration_millisecond_day"), week: this.language.translate("_duration_millisecond_week"), month: this.language.translate("_duration_millisecond_month"), year: this.language.translate("_duration_millisecond_year") }, second: { second: this.language.translate("_duration_second"), minute: this.language.translate("_duration_second_minute"), hour: this.language.translate("_duration_second_hour"), day: this.language.translate("_duration_second_day"), week: this.language.translate("_duration_second_week"), month: this.language.translate("_duration_second_month"), year: this.language.translate("_duration_second_year") }, minute: { minute: this.language.translate("_duration_minute"), hour: this.language.translate("_duration_minute_hour"), day: this.language.translate("_duration_minute_day"), week: this.language.translate("_duration_minute_week"), month: this.language.translate("_duration_minute_month"), year: this.language.translate("_duration_minute_year") }, hour: { hour: this.language.translate("_duration_hour"), day: this.language.translate("_duration_hour_day"), week: this.language.translate("_duration_hour_week"), month: this.language.translate("_duration_hour_month"), year: this.language.translate("_duration_hour_year") }, day: { day: this.language.translate("_duration_day"), week: this.language.translate("_duration_day_week"), month: this.language.translate("_duration_day_month"), year: this.language.translate("_duration_day_year") }, week: { week: this.language.translate("_duration_week"), month: this.language.translate("_duration_week_month"), year: this.language.translate("_duration_week_year") }, month: { month: this.language.translate("_duration_month"), year: this.language.translate("_duration_month_year") }, year: { year: this.language.translate("_duration_year") } }), this._durationFormats; + }, set: function(u) { + this._durationFormats = u, this.invalidateSprite(); + }, enumerable: !0, configurable: !0 }), R; + }(Ht); + hi.registeredClasses.DurationFormatter = J3; + var Xb, Te = new ha(), Ct = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u._validateDisposer = null, u; + } + return re(R, U), R.prototype.invalidate = function() { + this._validateDisposer === null && (this._validateDisposer = hi.events.on("exitframe", this.validate, this)); + }, R.prototype.validate = function() { + this._validateDisposer !== null && (this._validateDisposer.dispose(), this._validateDisposer = null); + }, R.prototype.dispose = function() { + this._validateDisposer !== null && (this._validateDisposer.dispose(), this._validateDisposer = null), U.prototype.dispose.call(this); + }, R; + }(vi), Gt = function(U) { + function R() { + var u = U.call(this) || this; + return u.adapter = new Yu(u), u.closeDelay = 1e3, u.closeOnClick = !0, u._language = new Un(), u._menuTag = "ul", u._itemTag = "li", u._labelTag = "a", u._iconTag = "img", u._classPrefix = "amexport", u._defaultStyles = !0, u._align = "right", u._verticalAlign = "top", u._tabindex = 0, u._ignoreNextClose = !1, u._items = [{ label: "...", menu: [{ label: "Image", menu: [{ type: "png", label: "PNG" }, { type: "jpg", label: "JPG" }, { type: "svg", label: "SVG" }, { type: "pdf", label: "PDF" }] }, { label: "Data", menu: [{ type: "json", label: "JSON" }, { type: "csv", label: "CSV" }, { type: "xlsx", label: "XLSX" }, { type: "html", label: "HTML" }, { type: "pdfdata", label: "PDF" }] }, { label: "Print", type: "print" }] }], u.className = "ExportMenu", u._disposers.push(u._language), u.invalidate(), u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + this.draw(), U.prototype.validate.call(this); + }, R.prototype.draw = function() { + var u = this; + this._element ? (this._element.innerHTML = "", this._element.className = this.getMenuItemClass(0)) : this._element = this.createMenuElement(0), this.defaultStyles && (this._element.style.display = "none"), Be(this._container).appendChild(this._element); + for (var w = this.adapter.apply("items", { items: this._items }).items, $ = w.length, G = 0; G < $; G++) + this.drawBranch(this._element, w[G], 0); + this._element = this.adapter.apply("menuElement", { menuElement: this._element }).menuElement, this._disposers.push(Gs().body.events.on("down", function(K) { + K.pointer.touch || (u._ignoreNextClose = !1), u.close(); + })), this._disposers.push(Gs().body.events.on("keydown", function(K) { + var ne = dg.getEventKey(K.event); + switch (ne) { + case "esc": + u.close(); + break; + case "up": + case "down": + case "left": + case "right": + u._currentSelection && K.event.preventDefault(), u.moveSelection(ne); + } + })), this.defaultStyles && this.loadDefaultCSS(); + }, R.prototype.drawBranch = function(u, w, $) { + var G = this; + if ((w = this.adapter.apply("branch", { branch: w, level: $ }).branch).unsupported !== !0) { + w.ascendants || (w.ascendants = new Hs()); + var K, ne = w.type, ue = this.createItemElement($, ne); + w.icon ? ((K = this.createIconElement($, ne)).src = w.icon, (w.label || w.title) && (K.title = w.title || w.label)) : w.svg ? (K = this.createSvgElement($, ne, w.svg), (w.label || w.title) && (K.title = w.title || w.label)) : ((K = this.createLabelElement($, ne)).innerHTML = w.label ? this.language.translate(w.label) : "", w.title && (K.title = w.title)); + var we = this.getReaderLabel(w, K.innerHTML); + K.setAttribute("aria-label", we), ue.appendChild(K), w.interactions = Gs().getInteraction(ue), w.element = ue, this.typeClickable(ne) && (w.interactions.events.on("hit", function(Yt) { + if (G.events.isEnabled("hit") && !G.isDisposed()) { + var ci = { type: "hit", event: Yt.event, target: G, branch: w }; + G.events.dispatchImmediately("hit", ci); + } + }), w.interactions.events.on("keyup", function(Yt) { + if (dg.isKey(Yt.event, "enter") && G.events.isEnabled("enter")) { + var ci = { type: "enter", event: Yt.event, target: G, branch: w }; + G.events.dispatchImmediately("enter", ci); + } + })); + var De = this.getSubMenu(w); + De != null && (w.interactions.events.on("keyup", function(Yt) { + dg.isKey(Yt.event, "enter") && (G.selectBranch(De[0]), G.setFocus(De[0])); + }), w.interactions.events.on("hit", function(Yt) { + G.selectBranch(w); + })), w.interactions.events.on("over", function(Yt) { + if (Yt.pointer.touch && (G._ignoreNextClose = !0), G.selectBranch(w), G.events.isEnabled("over")) { + var ci = { type: "over", event: Yt.event, target: G, branch: w }; + G.events.dispatchImmediately("over", ci); + } + }), w.interactions.events.on("out", function(Yt) { + if (!G.isDisposed() && (Yt.pointer.touch || G.delayUnselectBranch(w), G.events.isEnabled("out"))) { + var ci = { type: "out", event: Yt.event, target: G, branch: w }; + G.events.dispatchImmediately("out", ci); + } + }), w.interactions.events.on("focus", function(Yt) { + G.selectBranch(w); + }), w.interactions.events.on("blur", function(Yt) { + G.delayUnselectBranch(w); + }); + var $e = $ + 1; + if (w.menu) { + var Ke = this.createMenuElement($e); + w.submenuElement = Ke; + for (var Ze = w.menu.length, pt = 0; pt < Ze; pt++) { + var Vt = new Hs(); + w.menu[pt].ascendants = Vt, w.ascendants.length && Vt.copyFrom(w.ascendants), Vt.push(w), this.drawBranch(Ke, w.menu[pt], $e); + } + if (Ke.innerHTML == "") + return; + ue.appendChild(Ke); + } + w.hidden && this.hideBranch(w), w.id && ue.setAttribute("id", w.id), w.color && (ue.style.backgroundColor = w.color.hex), u.appendChild(ue); + } + }, R.prototype.createMenuElement = function(u) { + var w = document.createElement(this.menuTag); + return w.className = this.getMenuItemClass(u), u === 0 ? w.setAttribute("role", "menubar") : w.setAttribute("role", "menu"), w; + }, R.prototype.getMenuItemClass = function(u) { + var w = this.classPrefix + "-menu " + this.classPrefix + "-menu-level-" + u; + return u === 0 && (w += " " + this.classPrefix + "-menu-root " + this.classPrefix + "-" + this.align + " " + this.classPrefix + "-" + this.verticalAlign), this.adapter.apply("menuClass", { className: w, level: u }).className; + }, R.prototype.createItemElement = function(u, w) { + var $ = document.createElement(this.itemTag), G = this.classPrefix + "-item " + this.classPrefix + "-item-level-" + u + " " + this.classPrefix + "-item-" + (w || "blank"); + return $.className = this.adapter.apply("itemClass", { className: G, level: u, type: w }).className, $.setAttribute("role", "menuitem"), $.setAttribute("tabindex", this.tabindex.toString()), $; + }, R.prototype.createLabelElement = function(u, w) { + var $ = document.createElement(this.labelTag), G = this.classPrefix + "-label " + this.classPrefix + "-label-level-" + u + " " + this.classPrefix + "-item-" + (w || "blank"); + return this.typeClickable(w) && (G += " " + this.classPrefix + "-clickable"), $.className = this.adapter.apply("labelClass", { className: G, level: u, type: w }).className, $; + }, R.prototype.createIconElement = function(u, w) { + var $ = document.createElement(this.iconTag), G = this.classPrefix + "-icon " + this.classPrefix + "-icon-level-" + u + " " + this.classPrefix + "-item-" + (w || "blank"); + return this.typeClickable(w) && (G += " " + this.classPrefix + "-clickable"), $.className = this.adapter.apply("labelClass", { className: G, level: u, type: w }).className, $.setAttribute("tabindex", this.tabindex.toString()), $.setAttribute("role", "menuitem"), $; + }, R.prototype.createSvgElement = function(u, w, $) { + var G = new DOMParser().parseFromString($, "image/svg+xml").documentElement, K = this.classPrefix + "-icon " + this.classPrefix + "-icon-level-" + u + " " + this.classPrefix + "-item-" + (w || "blank"); + return this.typeClickable(w) && (K += " " + this.classPrefix + "-clickable"), G.setAttribute("class", this.adapter.apply("labelClass", { className: K, level: u, type: w }).className), G.setAttribute("tabindex", this.tabindex.toString()), G.setAttribute("role", "menuitem"), G; + }, R.prototype.dispose = function() { + this._disposed || (U.prototype.dispose.call(this), this._element && this._element.parentNode && this._element.parentNode.removeChild(this._element)); + }, R.prototype.typeClickable = function(u) { + return Ee(u); + }, R.prototype.hasSubMenu = function(u) { + return !(!u.menu || !u.menu.length); + }, R.prototype.getSubMenu = function(u) { + if (u.menu && u.menu.length) + return u.menu; + }, R.prototype.getReaderLabel = function(u, w) { + return w = yu(w), u.ascendants.length == 0 ? (w = w == "..." ? this.language.translate("Export") : w, w += " [" + this.language.translate("Press ENTER or use arrow keys to navigate") + "]") : this.hasSubMenu(u) ? w += " [" + this.language.translate("Click, tap or press ENTER to open") + "]" : u.type == "print" ? w = this.language.translate("Click, tap or press ENTER to print.") : this.typeClickable(u.type) && (w = this.language.translate("Click, tap or press ENTER to export as %1.", void 0, w)), this.adapter.apply("rederLabel", { label: w, branch: u }).label; + }, Object.defineProperty(R.prototype, "container", { get: function() { + return this._container; + }, set: function(u) { + this._container = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "items", { get: function() { + return this._items; + }, set: function(u) { + this._items = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tag", { set: function(u) { + this._menuTag = u, this._itemTag = u == "ul" ? "li" : "div", this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "menuTag", { get: function() { + return this.adapter.apply("menuTag", { tag: this._menuTag }).tag; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "itemTag", { get: function() { + return this.adapter.apply("itemTag", { tag: this._itemTag }).tag; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "labelTag", { get: function() { + return this.adapter.apply("labelTag", { tag: this._labelTag }).tag; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "iconTag", { get: function() { + return this.adapter.apply("iconTag", { tag: this._iconTag }).tag; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "align", { get: function() { + return this.adapter.apply("align", { align: this._align }).align; + }, set: function(u) { + this._align = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "verticalAlign", { get: function() { + return this.adapter.apply("verticalAlign", { verticalAlign: this._verticalAlign }).verticalAlign; + }, set: function(u) { + this._verticalAlign = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "classPrefix", { get: function() { + return this.adapter.apply("classPrefix", { classPrefix: this._classPrefix }).classPrefix; + }, set: function(u) { + this._classPrefix = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "defaultStyles", { get: function() { + return this.adapter.apply("defaultStyles", { defaultStyles: this._defaultStyles }).defaultStyles; + }, set: function(u) { + this._defaultStyles != u && (this._defaultStyles = u, u && this.loadDefaultCSS()), this.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.loadDefaultCSS = function() { + var u, w, $, G; + this._disposers.push((u = D1(this.container), w = this.classPrefix, $ = w || "amexport", G = new Fa(), Te.insertKeyIfEmpty($, function() { + var K = new kn([new $s(u, "." + $ + "-menu *", { "box-sizing": "border-box" }), new $s(u, "." + $ + "-menu-level-0", { position: "absolute", top: "5px", right: "5px" }), new $s(u, "." + $ + "-menu-level-0." + $ + "-left", { right: "auto", left: "5px" }), new $s(u, "." + $ + "-menu-level-0." + $ + "-right", { right: "5px", left: "auto" }), new $s(u, "." + $ + "-menu-level-0." + $ + "-top", { top: "5px", bottom: "auto" }), new $s(u, "." + $ + "-menu-level-0." + $ + "-bottom", { top: "auto", bottom: "5px" }), new $s(u, "." + $ + "-item." + $ + "-item-level-0", { opacity: "0.3", width: "30px", "min-height": "30px", transition: "all 100ms ease-in-out" }), new $s(u, "div:hover > div > ." + $ + "-menu ." + $ + "-item." + $ + "-item-level-0, ." + $ + "-item." + $ + "-item-level-0.active", { opacity: "0.9" }), new $s(u, "." + $ + "-item." + $ + "-item-level-0 > a", { padding: "0", "text-align": "center", overflow: "hidden" }), new $s(u, "." + $ + "-item." + $ + "-item-level-0:before", { display: "block" }), new $s(u, "." + $ + "-item", { position: "relative", display: "block", opacity: "0", "z-index": "1", "border-radius": "3px", "background-color": G.getFor("secondaryButton").hex, padding: "0", margin: "1px 1px 0 0", color: G.getFor("secondaryButton").alternative.hex, transition: "all 100ms ease-in-out, opacity 0.5s ease 0.5s" }), new $s(u, "." + $ + "-left ." + $ + "-item", { margin: "1px 0 0 1px" }), new $s(u, "." + $ + "-item:hover, ." + $ + "-item.active", { background: G.getFor("secondaryButtonHover").hex, color: G.getFor("secondaryButtonText").hex }), new $s(u, "." + $ + "-item > ." + $ + "-menu", { position: "absolute", top: "-1px", right: "0", "margin-right": "100%" }), new $s(u, "." + $ + "-left ." + $ + "-item > ." + $ + "-menu", { left: "0", right: "auto", "margin-left": "100%", "margin-right": "auto" }), new $s(u, "." + $ + "-right ." + $ + "-item > ." + $ + "-menu", { left: "auto", right: "0", "margin-left": "auto", "margin-right": "100%" }), new $s(u, "." + $ + "-top ." + $ + "-item > ." + $ + "-menu", { top: "-1px", bottom: "auto" }), new $s(u, "." + $ + "-bottom ." + $ + "-item > ." + $ + "-menu", { top: "auto", bottom: "0" }), new $s(u, "." + $ + "-item > ." + $ + "-menu", { display: "none" }), new $s(u, "." + $ + "-item:hover > ." + $ + "-menu, ." + $ + "-item.active > ." + $ + "-menu", { display: "block" }), new $s(u, "." + $ + "-item:hover > ." + $ + "-menu > ." + $ + "-item, ." + $ + "-item.active > ." + $ + "-menu > ." + $ + "-item", { opacity: "1" }), new $s(u, "." + $ + "-menu", { display: "block", "list-style": "none", margin: "0", padding: "0" }), new $s(u, "." + $ + "-label", { display: "block", cursor: "default", padding: "0.5em 1em" }), new $s(u, "." + $ + "-icon", { display: "block", cursor: "default", padding: "0.2em 0.4em", width: "1.2em", height: "1.2em", "min-width": "32px", "min-height": "32px", margin: "auto auto", "border-radius": "3px" }), new $s(u, "." + $ + "-item-level-0 > ." + $ + "-icon", { padding: "0.1em 0.2em" }), new $s(u, "." + $ + "-clickable", { cursor: "pointer" })]); + return new Cs(function() { + Te.removeKey($), K.dispose(); + }); + }).increment())), this._element && (this._element.style.display = ""); + }, Object.defineProperty(R.prototype, "tabindex", { get: function() { + return this.adapter.apply("tabindex", { tabindex: this._tabindex }).tabindex; + }, set: function(u) { + this._tabindex = u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "language", { get: function() { + var u = this, w = this._language.get(); + return w == null && (w = new Yv(), this._language.set(w, w.events.on("localechanged", function($) { + u.invalidate(); + }))), w; + }, set: function(u) { + var w = this; + this._language.set(u, u.events.on("localechanged", function($) { + w.invalidate(); + })), this.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.close = function() { + var u = this; + if (!this.isDisposed()) + if (this._ignoreNextClose) + this._ignoreNextClose = !1; + else { + if (this.closeOnClick && (this._element.style.pointerEvents = "none", setTimeout(function() { + u._element.style.pointerEvents = "auto"; + }, 100)), this._currentSelection && (this.setBlur(this._currentSelection), this._currentSelection = void 0), this._element) + for (var w = this._element.getElementsByClassName("active"), $ = w.length - 1; $ >= 0; $--) + w[$] && Xx(w[$], "active"); + this.events.dispatchImmediately("closed", { type: "closed", target: this }); + } + }, R.prototype.selectBranch = function(u) { + var w = this; + if (!this.isDisposed() && (u.closeTimeout && (this.removeDispose(u.closeTimeout), u.closeTimeout = void 0), M1(u.element, "active"), u.submenuElement && u.submenuElement.setAttribute("aria-expanded", "true"), this._currentSelection && this._currentSelection !== u && this._currentSelection.ascendants && er(Ds(di([this._currentSelection]), this._currentSelection.ascendants.iterator()), function(G) { + u.ascendants.contains(G) || u === G || w.unselectBranch(G, !0); + }), er(u.ascendants.iterator(), function(G) { + G.closeTimeout && (w.removeDispose(G.closeTimeout), G.closeTimeout = void 0), M1(G.element, "active"); + }), this._currentSelection = u, this.events.isEnabled("branchselected"))) { + var $ = { type: "branchselected", target: this, branch: u }; + this.events.dispatchImmediately("branchselected", $); + } + }, R.prototype.unselectBranch = function(u, w) { + if (!this.isDisposed() && (Xx(u.element, "active"), u.submenuElement && u.submenuElement.removeAttribute("aria-expanded"), this._currentSelection == u && (this._currentSelection = void 0), this.events.isEnabled("branchunselected"))) { + var $ = { type: "branchunselected", target: this, branch: u }; + this.events.dispatchImmediately("branchunselected", $); + } + }, R.prototype.delayUnselectBranch = function(u, w) { + var $ = this; + this.isDisposed() || (u.closeTimeout && (this.removeDispose(u.closeTimeout), u.closeTimeout = void 0), u.closeTimeout = this.setTimeout(function() { + $.unselectBranch(u, w); + }, this.closeDelay), w !== !0 && u.ascendants && er(u.ascendants.iterator(), function(G) { + $.delayUnselectBranch(G, !0); + })); + }, R.prototype.moveSelection = function(u) { + if (!this.isDisposed() && this._currentSelection) { + var w; + if (u == "up") + w = this.getPrevSibling(this._currentSelection); + else if (u == "down") + w = this.getNextSibling(this._currentSelection); + else if (u == "left" && this.align == "right" || u == "right" && this.align == "left") { + var $ = this.getSubMenu(this._currentSelection); + $ != null && (w = $[0]); + } else + (u == "right" && this.align == "right" || u == "left" && this.align == "left") && (w = this.getParentItem(this._currentSelection)); + w && w !== this._currentSelection && (this.selectBranch(w), this.setFocus(w), this._currentSelection = w); + } + }, R.prototype.getSiblings = function(u) { + var w = this.getParentItem(u); + return w && w.menu ? w.menu : []; + }, R.prototype.getParentItem = function(u) { + return u.ascendants && u.ascendants.length ? u.ascendants.getIndex(u.ascendants.length - 1) : void 0; + }, R.prototype.getNextSibling = function(u) { + var w = this.getSiblings(u); + if (w.length > 1) { + var $ = w.indexOf(u) + 1; + return w[$ = w.length == $ ? 0 : $].unsupported ? this.getNextSibling(w[$]) : w[$]; + } + return u; + }, R.prototype.getPrevSibling = function(u) { + var w = this.getSiblings(u); + if (w.length > 1) { + var $ = w.indexOf(u) - 1; + return w[$ = $ == -1 ? w.length - 1 : $].unsupported ? this.getPrevSibling(w[$]) : w[$]; + } + return u; + }, R.prototype.setFocus = function(u) { + if (u.interactions) + try { + u.interactions.element.focus(); + } catch { + } + }, R.prototype.setBlur = function(u) { + if (u.interactions) + try { + u.interactions.element.blur(); + } catch { + } + }, R.prototype.hideBranch = function(u) { + u.element.style.display = "none"; + }, R.prototype.showBranch = function(u) { + u.element.style.display = ""; + }, Object.defineProperty(R.prototype, "element", { get: function() { + return this._element; + }, enumerable: !0, configurable: !0 }), R; + }(Ct); + function oi(U, R, u) { + return new Promise(function(w, $) { + var G = Ee(u) && u.responseType == "blob", K = new XMLHttpRequest(); + if (K.onload = function() { + if (K.status === 200) { + var we, De; + if (G) + return void Hn(we = K.response).then(function(Ke) { + var Ze = { xhr: K, error: !1, response: Ke, blob: we, type: K.getResponseHeader("Content-Type"), target: R }; + w(Ze); + }); + De = K.responseText || K.response; + var $e = { xhr: K, error: !1, response: De, blob: we, type: K.getResponseHeader("Content-Type"), target: R }; + w($e); + } else + $({ xhr: K, error: !0, type: K.getResponseHeader("Content-Type"), target: R }); + }, K.onerror = function() { + $({ xhr: K, error: !0, type: K.getResponseHeader("Content-Type"), target: R }); + }, K.open("GET", U, !0), u && u.withCredentials && (K.withCredentials = !0), Ee(u)) { + if (Ee(u.requestHeaders)) + for (var ne = 0; ne < u.requestHeaders.length; ne++) { + var ue = u.requestHeaders[ne]; + K.setRequestHeader(ue.key, ue.value); + } + Ee(u.responseType) && (K.responseType = u.responseType); + } + K.send(); + }); + } + function Hn(U) { + return new Promise(function(R, u) { + var w = new FileReader(); + w.onload = function($) { + R(w.result); + }, w.onerror = function($) { + u($); + }, w.readAsText(U); + }); + } + var _l = /src: ([^;]+);/; + function Ku(U) { + return fe(this, void 0, void 0, function() { + var R; + return be(this, function(u) { + switch (u.label) { + case 0: + R = U.sheet, u.label = 1; + case 1: + return u.trys.push([1, 2, , 4]), [2, R.cssRules]; + case 2: + return u.sent(), [4, new Promise(function(w, $) { + U.addEventListener("load", function() { + w(R.cssRules); + }, !0), U.addEventListener("error", function(G) { + $(G); + }, !0), setTimeout(function() { + $(new Error("Timeout while waiting for " + this.serializeElement(this.sprite.paper.defs) + this.serializeElement(this.sprite.dom), u, ue, we, Ke, De, $e), ai = new Blob([ci], { type: "image/svg+xml" }), G = $.createObjectURL(ai), [4, this.loadNewImage(G, ue * Ke * Ze, we * Ke * Ze, "anonymous")]; + case 3: + return Gi = Ji.sent(), pt.drawImage(Gi, 0, 0), [3, 5]; + case 4: + return G !== null && $.revokeObjectURL(G), K !== null && _i(K, function(Ci) { + $.revokeObjectURL(Ci); + }), this.restoreRemovedObjects(), [7]; + case 5: + return [2, ne]; + } + }); + }); + }, R.prototype.getCanvasAdvanced = function(u) { + return fe(this, void 0, void 0, function() { + var w, $, G, K, ne, ue, we, De, $e, Ke, Ze; + return be(this, function(pt) { + switch (pt.label) { + case 0: + return Ee(u) || (u = {}), [4, this.imagesToDataURI(this.sprite.dom, u)]; + case 1: + return pt.sent(), w = this.backgroundColor || this.findBackgroundColor(this.sprite.dom), [4, this.canvg]; + case 2: + return $ = pt.sent(), G = this.sprite.pixelWidth, K = this.sprite.pixelHeight, ne = tA(this.sprite.dom), ue = iA(this.sprite.dom), we = u.scale || 1, De = this.getPixelRatio(u), we = this.getAdjustedScale(G * De, K * De, we, u), $e = this.normalizeSVG(this.serializeElement(this.sprite.paper.defs) + this.serializeElement(this.sprite.dom), u, G, K, we, ne, ue, w), (Ke = this.getDisposableCanvas()).style.width = G * De * we + "px", Ke.style.height = K * De * we + "px", Ke.width = G * De * we, Ke.height = K * De * we, Ze = { useCORS: !0 }, De != 1 && (Ze.ignoreDimensions = !0, Ze.scaleWidth = G * De * we, Ze.scaleHeight = K * De * we), [4, $.fromString(Ke.getContext("2d"), $e, Ze).render()]; + case 3: + return pt.sent(), [2, Ke]; + } + }); + }); + }, R.prototype.getImageAdvanced = function(u, w, $) { + return fe(this, void 0, void 0, function() { + var G, K, ne; + return be(this, function(ue) { + switch (ue.label) { + case 0: + return (G = this._objectsAlreadyHidden) || this.hideNonExportableSprites(), Ee(w) || (w = this.getFormatOptions(u)), [4, this.getCanvasAdvanced(w)]; + case 1: + return K = ue.sent(), $ === !1 ? [3, 3] : [4, this.addExtras(K, w, !0)]; + case 2: + K = ue.sent(), ue.label = 3; + case 3: + return ne = K.toDataURL(this.getContentType(u), w.quality), this.disposeCanvas(K), G || this.restoreNonExportableSprites(), [2, ne]; + } + }); + }); + }, R.prototype.getDisposableCanvas = function() { + var u = document.createElement("canvas"); + return u.style.position = "fixed", u.style.top = "-10000px", document.body.appendChild(u), u; + }, R.prototype.disposeCanvas = function(u) { + document.body.removeChild(u); + }, R.prototype.getPixelRatio = function(u) { + return this.useRetina ? Pr() : 1; + }, R.prototype.getAdjustedScale = function(u, w, $, G) { + if (!G) + return $; + var K, ne, ue = u * $, we = u * $; + return G.maxWidth && ue > G.maxWidth && (K = G.maxWidth / u), G.maxHeight && we > G.maxHeight && (ne = G.maxHeight / w), K || ne ? H(K, ne) : (G.minWidth && ue < G.minWidth && (K = G.minWidth / u), G.minHeight && we < G.minHeight && (ne = G.minHeight / w), K || ne ? ve(K, ne) : $); + }, R.prototype.imagesToDataURI = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K, ne, ue, we; + return be(this, function(De) { + switch (De.label) { + case 0: + if (!($ = u.querySelectorAll("image")).length) + return [3, 2]; + for (G = [], K = $.length, ne = 0; ne < K; ne++) + ue = $[ne], (we = ue.getAttributeNS(R.XLINK, "href")) && (we.indexOf("data:image") !== -1 || (we.indexOf(".svg") !== -1 ? G.push(this.svgToDataURI(ue, w)) : G.push(this.imageToDataURI(ue, w)))); + return [4, Promise.all(G)]; + case 1: + return De.sent(), [2]; + case 2: + return [2]; + } + }); + }); + }, R.prototype.prepForeignObjects = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K; + return be(this, function(ne) { + if (($ = u.querySelectorAll("foreignObject")).length) + for (G = $.length, K = 0; K < G; K++) + this.temporarilyRemoveObject($[K]); + return [2]; + }); + }); + }, R.prototype.imageToDataURI = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K; + return be(this, function(ne) { + switch (ne.label) { + case 0: + return ne.trys.push([0, 2, , 3]), [4, this.loadNewImage(u.getAttributeNS(R.XLINK, "href"), null, null, "anonymous")]; + case 1: + $ = ne.sent(), (G = document.createElement("canvas")).width = $.width, G.height = $.height, G.getContext("2d").drawImage($, 0, 0); + try { + return K = G.toDataURL(), u.setAttribute("href", K), [2, K]; + } catch { + return w.keepTainted !== !1 && this.temporarilyRemoveObject(u), [2, void 0]; + } + return [3, 3]; + case 2: + return ne.sent(), w && w.keepTainted === !1 || this.temporarilyRemoveObject(u), [2, void 0]; + case 3: + return [2]; + } + }); + }); + }, R.prototype.svgToDataURI = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K, ne; + return be(this, function(ue) { + switch (ue.label) { + case 0: + $ = u.getAttributeNS(R.XLINK, "href"), ue.label = 1; + case 1: + return ue.trys.push([1, 3, , 4]), [4, oi($)]; + case 2: + return G = ue.sent(), K = this.adapter.apply("charset", { charset: "base64", type: "svg", options: w }).charset, ne = this.adapter.apply("svgToDataURI", { data: "data:" + this.getContentType("svg") + ";" + K + "," + btoa(G.response), options: w }).data, u.setAttributeNS(R.XLINK, "href", ne), [2, ne]; + case 3: + return ue.sent(), w && w.keepTainted === !1 || this.temporarilyRemoveObject(u), [2, void 0]; + case 4: + return [2]; + } + }); + }); + }, R.prototype.temporarilyRemoveObject = function(u, w) { + var $ = u.parentElement || u.parentNode; + w || (w = this.sprite.paper.add("g").node), $.insertBefore(w, u), u.textContent, $.removeChild(u), this._removedObjects.push({ element: u, placeholder: w }); + }, R.prototype.restoreRemovedObjects = function() { + for (var u; u = this._removedObjects.pop(); ) + (u.placeholder.parentElement || u.placeholder.parentNode).insertBefore(u.element, u.placeholder); + }, R.prototype.simplifiedImageExport = function() { + return fe(this, void 0, void 0, function() { + var u, w, $, G, K, ne, ue; + return be(this, function(we) { + switch (we.label) { + case 0: + if (this.useSimplifiedExport === !1) + return [2, !1]; + if ((u = hi.getCache("simplifiedImageExport")) === !1 || u === !0) + return [2, u]; + we.label = 1; + case 1: + we.trys.push([1, 6, , 7]), (w = document.createElement("canvas")).width = 1, w.height = 1, $ = w.getContext("2d"), G = this.getDOMURL(), K = new Blob([this.normalizeSVG("", {}, 1, 1)], { type: "image/svg+xml" }), ne = G.createObjectURL(K), ue = void 0, we.label = 2; + case 2: + return we.trys.push([2, 4, , 5]), [4, this.loadNewImage(ne, 1, 1)]; + case 3: + return ue = we.sent(), [3, 5]; + case 4: + return we.sent(), [2, !1]; + case 5: + $.drawImage(ue, 0, 0), G.revokeObjectURL(ne); + try { + return hi.setCache("simplifiedImageExport", !0), [2, !0]; + } catch { + return hi.setCache("simplifiedImageExport", !1), [2, !1]; + } + return [3, 7]; + case 6: + return we.sent(), hi.setCache("simplifiedImageExport", !1), [2, !1]; + case 7: + return [2]; + } + }); + }); + }, R.prototype.loadNewImage = function(u, w, $, G) { + return new Promise(function(K, ne) { + var ue; + function we() { + if (G) { + var De = ue.src; + ue.onerror = function() { + ne(new Error('Loading image "' + u + '" failed')); + }, ue.removeAttribute("crossorigin"), ue.src = "", ue.src = De; + } else + ne(new Error('Loading image "' + u + '" failed')); + } + ue = w && $ ? new Image(w, $) : new Image(), G && ue.setAttribute("crossOrigin", G), ue.onload = function() { + K(ue); + }, ue.onabort = we, ue.onerror = we, ue.src = u; + }); + }, R.prototype.getDOMURL = function() { + return self.URL || self.webkitURL || self; + }, R.prototype.getSVG = function(u, w, $) { + return $ === void 0 && ($ = !0), fe(this, void 0, void 0, function() { + var G, K, ne, ue, we, De, $e, Ke, Ze, pt; + return be(this, function(Vt) { + switch (Vt.label) { + case 0: + return (G = this._objectsAlreadyHidden) || this.hideNonExportableSprites(), Ee(w) || (w = this.getFormatOptions("svg")), [4, this.awaitValidSprites()]; + case 1: + return Vt.sent(), K = this.sprite.pixelWidth, ne = this.sprite.pixelHeight, ue = tA(this.sprite.dom), we = iA(this.sprite.dom), De = w.scale || 1, $e = this.getPixelRatio(w), De = this.getAdjustedScale(K * $e, ne * $e, De, w), Ke = this.normalizeSVG(this.serializeElement(this.sprite.paper.defs) + this.serializeElement(this.sprite.dom), w, K, ne, De, ue, we), Ze = this.adapter.apply("charset", { charset: "charset=utf-8", type: "svg", options: w }).charset, pt = this.adapter.apply("getSVG", { data: $ ? "data:" + this.getContentType(u) + ";" + Ze + "," + encodeURIComponent(Ke) : Ke, options: w }).data, G || this.restoreNonExportableSprites(), [2, pt]; + } + }); + }); + }, R.prototype.normalizeSVG = function(u, w, $, G, K, ne, ue, we) { + var De = ""; + $ && (De += 'width="' + Math.round($ * (K || 1)) + 'px" '), G && (De += 'height="' + Math.round(G * (K || 1)) + 'px" '); + var $e = ""; + ne && ($e += "font-family: " + ne.replace(/"/g, "") + ";"), ue && ($e += "font-size: " + ue + ";"), K && (De += 'viewBox="0 0 ' + $ + " " + G + '" '); + var Ke = [], Ze = u.match(//gi); + if (Ze) + for (var pt = 0; pt < Ze.length; pt++) + u = u.replace(Ze[pt], Ir), Ke.push(Ze[pt]); + u.match(/]*)width="[^"]*"/, "$1")).replace(/(]*)height="[^"]*"/, "$1")).replace(/(' + u + "", we && (u = u.replace(/(]*>)/, '$1')), /MSIE |Trident\//.test(navigator.userAgent) && (u = u.replace(/]*\/>/gi, "")); + var Vt = new RegExp("url\\(" + Bl(Fs()), "g"); + if (u = (u = u.replace(Vt, "url(#")).replace(/url\("([^)]*)"\)/gm, "url($1)"), Ke.length) + for (pt = 0; pt < Ke.length; pt++) + u = u.replace(Ir, Ke[pt]); + return this.adapter.apply("normalizeSVG", { data: u, options: w }).data; + }, R.prototype.serializeElement = function(u) { + return new XMLSerializer().serializeToString(u); + }, R.prototype.getPDF = function(u, w) { + return fe(this, void 0, void 0, function() { + function $(Yt) { + var ci = {}; + ci.normal = Yt.normal.path, Vt[Yt.normal.path] = Yt.normal.bytes, Yt.bold ? (ci.bold = Yt.bold.path, Vt[Yt.bold.path] = Yt.bold.bytes) : ci.bold = Yt.normal.path, Yt.italics ? (ci.italics = Yt.italics.path, Vt[Yt.italics.path] = Yt.italics.bytes) : ci.italics = Yt.normal.path, Yt.bolditalics ? (ci.bolditalics = Yt.bolditalics.path, Vt[Yt.bolditalics.path] = Yt.bolditalics.bytes) : ci.bolditalics = Yt.normal.path, pt[Yt.name] = ci; + } + var G, K, ne, ue, we, De, $e, Ke, Ze, pt, Vt; + return be(this, function(Yt) { + switch (Yt.label) { + case 0: + return [4, this.getImage(w.imageFormat || "png", w)]; + case 1: + return G = Yt.sent(), [4, this.pdfmake]; + case 2: + return K = Yt.sent(), ne = [30, 30, 30, 30], ue = { pageSize: w.pageSize || "A4", pageOrientation: w.pageOrientation || "portrait", pageMargins: w.pageMargins || ne, defaultStyle: { font: w.font ? w.font.name : void 0 }, content: [] }, we = this.adapter.apply("title", { title: this.title, options: w }).title, De = 0, we && (ue.content.push({ text: we, fontSize: w.fontSize || 14, bold: !0, margin: [0, 0, 0, 15] }), De += 50), w.addURL && (ue.content.push({ text: this.language.translate("Saved from") + ": " + document.location.href, fontSize: w.fontSize, margin: [0, 0, 0, 15] }), De += 50), u != "pdfdata" && ue.content.push({ image: G, alignment: w.align || "left", fit: this.getPageSizeFit(ue.pageSize, ue.pageMargins, De) }), u == "pdfdata" || w.addData ? (Ke = ($e = ue.content).push, Ze = {}, [4, this.getPDFData("pdf", w)]) : [3, 4]; + case 3: + Ke.apply($e, [(Ze.table = Yt.sent(), Ze.fontSize = w.fontSize || 14, Ze)]), Yt.label = 4; + case 4: + return ue = this.adapter.apply("pdfmakeDocument", { doc: ue, options: w }).doc, pt = null, Vt = null, w.font && (pt = {}, Vt = {}, $(w.font), w.extraFonts && _i(w.extraFonts, $)), [4, new Promise(function(ci, ai) { + K.createPdf(ue, null, pt, Vt).getDataUrl(function(Gi) { + ci(Gi); + }); + })]; + case 5: + return [2, Yt.sent()]; + } + }); + }); + }, R.prototype.getPDFData = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K, ne, ue, we, De = this; + return be(this, function($e) { + if ($ = { body: [] }, G = this.adapter.apply("formatDataFields", { dataFields: this.dataFields, format: "pdf" }).dataFields, K = this.data, w.pivot) + ne = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "pdfdata" }).dataFieldsOrder, hr(G, function(Ke, Ze) { + var pt = []; + w.addColumnNames && pt.push(Ze); + for (var Vt = K.length, Yt = 0; Yt < Vt; Yt++) { + var ci = K[Yt][Ke]; + pt.push(De.convertToSpecialFormat(Ke, ci, w, !0)); + } + $.body.push(De.getPDFDataRow(pt, w, void 0, !0)); + }, function(Ke, Ze) { + var pt = ne.indexOf(Ke), Vt = ne.indexOf(Ze); + return pt > Vt ? 1 : pt < Vt ? -1 : 0; + }); + else + for (w.addColumnNames && ($.body.push(this.getPDFDataRow(G, w, void 0, !0)), $.headerRows = 1), ue = K.length, we = 0; we < ue; we++) + $.body.push(this.getPDFDataRow(K[we], w, G)); + return [2, this.adapter.apply("pdfmakeTable", { table: $, options: w }).table]; + }); + }); + }, R.prototype.getPDFDataRow = function(u, w, $, G) { + var K = this; + G === void 0 && (G = !1); + var ne = []; + $ || ($ = u); + var ue = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "pdfdata" }).dataFieldsOrder; + return hr($, function(we, De) { + var $e = K.convertEmptyValue(we, u[we], w), Ke = G ? $e : K.convertToSpecialFormat(we, $e, w); + Ke = "" + Ke, ne.push(Ke); + }, function(we, De) { + var $e = ue.indexOf(we), Ke = ue.indexOf(De); + return $e > Ke ? 1 : $e < Ke ? -1 : 0; + }), ne; + }, R.prototype.getPageSizeFit = function(u, w, $) { + $ === void 0 && ($ = 0); + var G = [0, 0, 0, 0]; + typeof w == "number" ? G = [w, w, w, w] : w.length == 2 ? G = [w[0], w[1], w[0], w[1]] : w.length == 4 && (G = w); + var K = { "4A0": [4767.87, 6740.79], "2A0": [3370.39, 4767.87], A0: [2383.94, 3370.39], A1: [1683.78, 2383.94], A2: [1190.55, 1683.78], A3: [841.89, 1190.55], A4: [595.28, 841.89], A5: [419.53, 595.28], A6: [297.64, 419.53], A7: [209.76, 297.64], A8: [147.4, 209.76], A9: [104.88, 147.4], A10: [73.7, 104.88], B0: [2834.65, 4008.19], B1: [2004.09, 2834.65], B2: [1417.32, 2004.09], B3: [1000.63, 1417.32], B4: [708.66, 1000.63], B5: [498.9, 708.66], B6: [354.33, 498.9], B7: [249.45, 354.33], B8: [175.75, 249.45], B9: [124.72, 175.75], B10: [87.87, 124.72], C0: [2599.37, 3676.54], C1: [1836.85, 2599.37], C2: [1298.27, 1836.85], C3: [918.43, 1298.27], C4: [649.13, 918.43], C5: [459.21, 649.13], C6: [323.15, 459.21], C7: [229.61, 323.15], C8: [161.57, 229.61], C9: [113.39, 161.57], C10: [79.37, 113.39], RA0: [2437.8, 3458.27], RA1: [1729.13, 2437.8], RA2: [1218.9, 1729.13], RA3: [864.57, 1218.9], RA4: [609.45, 864.57], SRA0: [2551.18, 3628.35], SRA1: [1814.17, 2551.18], SRA2: [1275.59, 1814.17], SRA3: [907.09, 1275.59], SRA4: [637.8, 907.09], EXECUTIVE: [521.86, 756], FOLIO: [612, 936], LEGAL: [612, 1008], LETTER: [612, 792], TABLOID: [792, 1224] }[u]; + return K[0] -= G[0] + G[2], K[1] -= G[1] + G[3] + $, K; + }, R.prototype.getExcel = function(u, w) { + return fe(this, void 0, void 0, function() { + var $, G, K, ne, ue, we, De, $e, Ke, Ze = this; + return be(this, function(pt) { + switch (pt.label) { + case 0: + return Ee(w) || (w = this.getFormatOptions("xlsx")), [4, this.xlsx]; + case 1: + if ($ = pt.sent(), G = this.adapter.apply("xlsxWorkbookOptions", { xlsx: $, options: { bookType: "xlsx", bookSST: !1, type: "base64" } }).options, K = this.normalizeExcelSheetName(this.adapter.apply("xlsxSheetName", { xlsx: $, name: this.title || this.language.translate("Data") }).name), ne = { SheetNames: [K], Sheets: {} }, ue = [], we = this.adapter.apply("formatDataFields", { dataFields: this.dataFields, format: "xslx" }).dataFields, w.pivot) + De = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "xlsx" }).dataFieldsOrder, hr(we, function(Vt, Yt) { + var ci = []; + w.addColumnNames && ci.push(Yt); + for (var ai = Ze.data.length, Gi = 0; Gi < ai; Gi++) { + var Ji = Ze.data[Gi][Vt]; + ci.push(Ze.convertToSpecialFormat(Vt, Ji, w, !0)); + } + ue.push(Ze.getExcelRow(ci, w, void 0, !0)); + }, function(Vt, Yt) { + var ci = De.indexOf(Vt), ai = De.indexOf(Yt); + return ci > ai ? 1 : ci < ai ? -1 : 0; + }); + else + for (w.addColumnNames && ue.push(this.getExcelRow(we, w, void 0, !0)), $e = this.data.length, Ke = 0; Ke < $e; Ke++) + ue.push(this.getExcelRow(this.data[Ke], w, we)); + return ne.Sheets[K] = $.utils.aoa_to_sheet(ue), ne = this.adapter.apply("xlsxWorkbook", { xlsx: $, workbook: ne, options: w }).workbook, [2, this.adapter.apply("getExcel", { data: "data:" + this.getContentType(u) + ";base64," + $.write(ne, G), options: w }).data]; + } + }); + }); + }, R.prototype.normalizeExcelSheetName = function(u) { + return fd(u = u.replace(/([:\\\/?*\[\]]+)/g, " "), 31, "...", !0); + }, R.prototype.getExcelRow = function(u, w, $, G) { + var K = this; + G === void 0 && (G = !1); + var ne = []; + $ || ($ = u); + var ue = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "xlsx" }).dataFieldsOrder; + return hr($, function(we, De) { + var $e = K.convertEmptyValue(we, u[we], w), Ke = G ? $e : K.convertToSpecialFormat(we, $e, w, !0); + ne.push(Ke); + }, function(we, De) { + var $e = ue.indexOf(we), Ke = ue.indexOf(De); + return $e > Ke ? 1 : $e < Ke ? -1 : 0; + }), ne; + }, R.prototype.getCSV = function(u, w, $) { + return $ === void 0 && ($ = !0), fe(this, void 0, void 0, function() { + var G, K, ne, ue, we, De, $e, Ke, Ze, pt = this; + return be(this, function(Vt) { + if (Ee(w) || (w = this.getFormatOptions("csv")), G = "", K = this.adapter.apply("formatDataFields", { dataFields: this.dataFields, format: "csv" }).dataFields, ne = "", ue = this.data, w.pivot) + we = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "csv" }).dataFieldsOrder, hr(K, function(Yt, ci) { + var ai = []; + w.addColumnNames && ai.push(ci); + for (var Gi = ue.length, Ji = 0; Ji < Gi; Ji++) { + var Ci = ue[Ji][Yt]; + ai.push(pt.convertToSpecialFormat(Yt, Ci, w, !0)); + } + G += ne + pt.getCSVRow(ai, w, void 0, !0), ne = ` +`; + }, function(Yt, ci) { + var ai = we.indexOf(Yt), Gi = we.indexOf(ci); + return ai > Gi ? -1 : ai < Gi ? 1 : 0; + }); + else { + for (De = ue.length, $e = 0; $e < De; $e++) + Ke = this.getCSVRow(ue[$e], w, K), w.reverse ? G = Ke + ne + G : G += ne + Ke, ne = ` +`; + w.addColumnNames && (G = this.getCSVRow(K, w, void 0, !0) + ne + G); + } + return Ze = this.adapter.apply("charset", { charset: "charset=utf-8", type: u, options: w }).charset, [2, this.adapter.apply("getCSV", { data: $ ? "data:" + this.getContentType(u) + ";" + Ze + "," + encodeURIComponent(G) : G, options: w }).data]; + }); + }); + }, R.prototype.getCSVRow = function(u, w, $, G) { + var K = this; + G === void 0 && (G = !1); + var ne = w.separator || ",", ue = []; + $ || ($ = u); + var we = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "csv" }).dataFieldsOrder; + return hr($, function(De, $e) { + var Ke = K.convertEmptyValue(De, u[De], w), Ze = G ? Ke : K.convertToSpecialFormat(De, Ke, w); + Ze = (Ze = "" + Ze).replace(/"/g, '""'), (w.forceQuotes || Ze.search(new RegExp(`"| +|` + ne, "g")) >= 0) && (Ze = '"' + Ze + '"'), ue.push(Ze); + }, function(De, $e) { + var Ke = we.indexOf(De), Ze = we.indexOf($e); + return Ke > Ze ? 1 : Ke < Ze ? -1 : 0; + }), ue.join(ne); + }, R.prototype.getHTML = function(u, w, $) { + return $ === void 0 && ($ = !0), fe(this, void 0, void 0, function() { + var G, K, ne, ue, we, De, $e, Ke = this; + return be(this, function(Ze) { + if (Ee(w) || (w = this.getFormatOptions("html")), G = "", w.tableClass && (G = '
'), K = this.adapter.apply("formatDataFields", { dataFields: this.dataFields, format: "html" }).dataFields, ne = this.data, w.pivot) + ue = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "html" }).dataFieldsOrder, G += ` +`, hr(K, function(pt, Vt) { + var Yt = []; + w.addColumnNames && Yt.push(Vt); + for (var ci = ne.length, ai = 0; ai < ci; ai++) { + var Gi = ne[ai][pt]; + Yt.push(Ke.convertToSpecialFormat(pt, Gi, w, !0)); + } + G += ` +` + Ke.getHTMLRow(Yt, w, void 0, !0); + }, function(pt, Vt) { + var Yt = ue.indexOf(pt), ci = ue.indexOf(Vt); + return Yt > ci ? -1 : Yt < ci ? 1 : 0; + }), G += ` +`; + else { + for (w.addColumnNames && (G += ` + +` + this.getHTMLRow(K, w, void 0, !0, !0) + ` +`), G += ` +`, we = ne.length, De = 0; De < we; De++) + G += ` +` + this.getHTMLRow(ne[De], w, K); + G += ` +`; + } + return G += ` +
`, $e = this.adapter.apply("charset", { charset: "charset=utf-8", type: u, options: w }).charset, [2, this.adapter.apply("getHTML", { data: $ ? "data:" + this.getContentType(u) + ";" + $e + "," + encodeURIComponent(G) : G, options: w }).data]; + }); + }); + }, R.prototype.getHTMLRow = function(u, w, $, G, K) { + var ne = this; + G === void 0 && (G = !1), K === void 0 && (K = !1); + var ue = " "; + w.rowClass && (ue = ' '), $ || ($ = u); + var we = this.adapter.apply("dataFieldsOrder", { dataFieldsOrder: this.dataFieldsOrder, format: "html" }).dataFieldsOrder, De = K ? "th" : "td", $e = !0; + return hr($, function(Ke, Ze) { + var pt = ne.convertEmptyValue(Ke, u[Ke], w), Vt = G ? pt : ne.convertToSpecialFormat(Ke, pt, w); + Vt = (Vt = "" + Vt).replace(/[\u00A0-\u9999<>\&]/gim, function(ci) { + return "&#" + ci.charCodeAt(0) + ";"; + }); + var Yt = De; + w.pivot && $e && (Yt = "th"), w.cellClass ? ue += ` + <` + Yt + ' class="' + w.cellClass + '">' + Vt + "" : ue += ` + <` + Yt + ">" + Vt + "", $e = !1; + }, function(Ke, Ze) { + var pt = we.indexOf(Ke), Vt = we.indexOf(Ze); + return pt > Vt ? 1 : pt < Vt ? -1 : 0; + }), ue += ` + `; + }, R.prototype.getJSON = function(u, w, $) { + return $ === void 0 && ($ = !0), fe(this, void 0, void 0, function() { + var G, K, ne, ue, we, De, $e, Ke, Ze = this; + return be(this, function(pt) { + if (Ee(w) || (w = this.getFormatOptions("json")), K = this.adapter.apply("formatDataFields", { dataFields: this.dataFields, format: "json" }).dataFields, this._dynamicDataFields) + G = this.data; + else + for (G = [], ne = this.data, ue = function(Vt, Yt) { + var ci = ne[Yt]; + if (typeof ci == "object") { + var ai = {}; + mi(ci, function(Gi, Ji) { + Ee(K[Gi]) && (ai[K[Gi]] = Ze.convertToSpecialFormat(Gi, Ji, w)); + }), G.push(ai); + } + }, we = ne.length, De = 0; De < we; De++) + ue(0, De); + return $e = JSON.stringify(G, function(Vt, Yt) { + return typeof Yt == "object" && mi(Yt, function(ci, ai) { + Yt[ci] = Ze.convertToSpecialFormat(ci, ai, w); + }), Yt; + }, w.indent), Ke = this.adapter.apply("charset", { charset: "charset=utf-8", type: u, options: w }).charset, [2, this.adapter.apply("getJSON", { data: $ ? "data:" + this.getContentType(u) + ";" + Ke + "," + encodeURIComponent($e) : $e, options: w }).data]; + }); + }); + }, R.prototype.convertToSpecialFormat = function(u, w, $, G) { + if (typeof w == "number") + if (this.isDateField(u)) + w = new Date(w); + else { + if (this.isDurationField(u)) + return this.durationFormatter.format(w, this.durationFormat); + if (this.isNumberField(u) && this.numberFormat) + return this.numberFormatter.format(w, this.numberFormat); + } + return w instanceof Date ? $.useTimestamps ? w = w.getTime() : $.useLocale ? G || (w = w.toLocaleString()) : w = this.dateFormatter.format(w, this.dateFormat) : st(w) && this.isDateField(u) && this.dateFormat && (w = this.dateFormatter.format(this.dateFormatter.parse(w), this.dateFormat)), w; + }, R.prototype.convertEmptyValue = function(u, w, $) { + return Ee(w) ? w : $.emptyAs; + }, R.prototype.download = function(u, w, $) { + return $ === void 0 && ($ = !1), fe(this, void 0, void 0, function() { + var G, K, ne, ue, we, De, $e, Ke, Ze, pt, Vt, Yt, ci, ai, Gi; + return be(this, function(Ji) { + if (this.msBlobDownloadSupport()) { + if (Yt = u.split(";"), ci = Yt.shift().replace(/data:/, ""), u = decodeURIComponent(Yt.join(";").replace(/^[^,]*,/, "")), ["image/svg+xml", "application/json", "text/csv"].indexOf(ci) != -1) + return G = new Blob([u], { type: ci }), window.navigator.msSaveBlob(G, w), [2, !0]; + try { + ne = atob(u), u = ne; + } catch { + return [2, !1]; + } + for (De = new Array(u.length), $e = 0; $e < u.length; ++$e) + Ke = u.charCodeAt($e), De[$e] = Ke; + Ze = new Blob([new Uint8Array(De)], { type: ci }), window.navigator.msSaveBlob(Ze, w); + } else if (this.blobDownloadSupport()) { + if ((K = document.createElement("a")).download = w, document.body.appendChild(K), Yt = u.split(";"), ci = Yt.shift().replace(/data:/, ""), u = decodeURIComponent(Yt.join(";").replace(/^[^,]*,/, "")), ["image/svg+xml", "application/json", "text/csv", "text/html"].indexOf(ci) != -1) + return $ && (u = "\uFEFF" + u), ue = new Blob([u], { type: ci }), we = window.URL.createObjectURL(ue), K.href = we, K.download = w, K.click(), setTimeout(function() { + document.body.removeChild(K), window.URL.revokeObjectURL(we); + }, 100), [2, !0]; + try { + ne = atob(u), u = ne; + } catch { + return [2, !1]; + } + for (De = new Array(u.length), $e = 0; $e < u.length; ++$e) + Ke = u.charCodeAt($e), De[$e] = Ke; + $ && (De = [239, 187, 191].concat(De)), Ze = new Blob([new Uint8Array(De)], { type: ci }), pt = window.URL.createObjectURL(Ze), K.href = pt, K.download = w, document.body.appendChild(K), K.click(), document.body.removeChild(K), setTimeout(function() { + window.URL.revokeObjectURL(pt); + }, 100); + } else + this.linkDownloadSupport() ? ((Vt = document.createElement("a")).download = w, Vt.href = u, document.body.appendChild(Vt), Vt.click(), document.body.removeChild(Vt)) : this.legacyIE() ? (Yt = u.match(/^data:(.*);[ ]*([^,]*),(.*)$/)).length === 4 && (Yt[2] == "base64" ? Yt[1].match(/^image\//) && this.showModal('

' + this.language.translate('To save the image, right-click thumbnail on the left and choose "Save picture as..."') + '

' + this.language.translate("(Press ESC to close this message)") + "

", this.language.translate("Image Export Complete")) : (ci = void 0, w.match(/\.svg$/) ? ci = "image/svg+xml" : (ci = "text/plain", w += ".txt"), (ai = document.createElement("iframe")).width = "1px", ai.height = "1px", ai.style.display = "none", document.body.appendChild(ai), (Gi = ai.contentDocument).open(ci, "replace"), Gi.write(decodeURIComponent(Yt[3])), Gi.close(), Gi.execCommand("SaveAs", !0, w), document.body.removeChild(ai))) : window.location.href = u; + return [2, !0]; + }); + }); + }, R.prototype.downloadSupport = function() { + return this.linkDownloadSupport() || this.msBlobDownloadSupport(); + }, R.prototype.linkDownloadSupport = function() { + var u = hi.getCache("linkDownloadSupport"); + if (u === !1 || u === !0) + return u; + var w = document.createElement("a").download !== void 0; + return hi.setCache("linkDownloadSupport", w), w; + }, R.prototype.blobDownloadSupport = function() { + return Ee(window.Blob); + }, R.prototype.msBlobDownloadSupport = function() { + return Ee(window.navigator.msSaveOrOpenBlob); + }, R.prototype.legacyIE = function() { + var u = document.createElement("div"); + return u.innerHTML = "", u.getElementsByTagName("i").length == 1; + }, R.prototype.print = function(u, w, $) { + return fe(this, void 0, void 0, function() { + return be(this, function(G) { + return w.printMethod == "css" ? [2, this.printViaCSS(u, w, $)] : [2, this.printViaIframe(u, w, $)]; + }); + }); + }, R.prototype.printViaCSS = function(u, w, $) { + return fe(this, void 0, void 0, function() { + var G, K, ne, ue; + return be(this, function(we) { + return G = document.documentElement.scrollTop || document.body.scrollTop, K = new $s(D1(this.container), "body > *", { display: "none", position: "fixed", visibility: "hidden", opacity: "0", clipPath: "polygon(0px 0px,0px 0px,0px 0px,0px 0px);" }), $ && document && document.title && (ne = document.title, document.title = $), (ue = new Image()).src = u, ue.style.maxWidth = "100%", ue.style.display = "block", ue.style.position = "relative", ue.style.visibility = "visible", ue.style.opacity = "1", ue.style.clipPath = "none", document.body.appendChild(ue), this.setTimeout(function() { + window.print(); + }, 50), /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && w.delay < 1e3 ? w.delay = 1e3 : w.delay < 100 && (w.delay = 100), this.setTimeout(function() { + document.body.removeChild(ue), K.dispose(), ne && (document.title = document.title), document.documentElement.scrollTop = document.body.scrollTop = G; + }, w.delay || 500), [2, !0]; + }); + }); + }, R.prototype.printViaIframe = function(u, w, $) { + return fe(this, void 0, void 0, function() { + var G, K; + return be(this, function(ne) { + return (G = document.createElement("iframe")).style.visibility = "hidden", document.body.appendChild(G), G.contentWindow.document.open(), G.contentWindow.document.close(), (K = new Image()).src = u, K.style.maxWidth = "100%", K.style.height = "auto", $ && (G.contentWindow.document.title = $), G.contentWindow.document.body.appendChild(K), G.load = function() { + G.contentWindow.document.body.appendChild(K); + }, this.setTimeout(function() { + try { + G.contentWindow.document.execCommand("print", !1, null) || G.contentWindow.print(); + } catch { + G.contentWindow.print(); + } + }, w.delay || 50), /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && w.delay < 1e3 ? w.delay = 1e3 : w.delay < 100 && (w.delay = 100), this.setTimeout(function() { + document.body.removeChild(G); + }, w.delay + 50 || 100), [2, !0]; + }); + }); + }, R.prototype.findBackgroundColor = function(u) { + var w = 1, $ = V3(u, "background-color"); + if (($.match(/[^,]*,[^,]*,[^,]*,[ ]?0/) || $ == "transparent") && (w = 0), w == 0) { + var G = u.parentElement; + return G ? this.findBackgroundColor(G) : We("#fff"); + } + return We($, w); + }, Object.defineProperty(R.prototype, "container", { get: function() { + return this.adapter.apply("container", { container: this._container }).container; + }, set: function(u) { + this._container = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sprite", { get: function() { + return this.adapter.apply("sprite", { sprite: this._sprite }).sprite; + }, set: function(u) { + this._sprite = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "extraSprites", { get: function() { + return this.adapter.apply("extraSprites", { extraSprites: this._extraSprites }).extraSprites; + }, set: function(u) { + this._extraSprites = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "validateSprites", { get: function() { + return this.adapter.apply("validateSprites", { validateSprites: this._validateSprites }).validateSprites; + }, set: function(u) { + this._validateSprites = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "data", { get: function() { + return this.adapter.apply("data", { data: this._data }).data; + }, set: function(u) { + this._data = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dataFields", { get: function() { + return this._dataFields || this.generateDataFields(), this.adapter.apply("dataFields", { dataFields: this._dataFields }).dataFields; + }, set: function(u) { + this._dataFields = u, this._dynamicDataFields = !1; + }, enumerable: !0, configurable: !0 }), R.prototype.handleDataUpdated = function() { + this._dynamicDataFields && (this._dataFields = void 0); + var u = this.data.length > 0; + this._prevHasData != u && (this._prevHasData = u, this.menu && this.menu.invalidate()); + }, Object.defineProperty(R.prototype, "dateFormatter", { get: function() { + return this._dateFormatter || (this._dateFormatter = new OC(), this._dateFormatter.language = this.language), this.adapter.apply("dateFormatter", { dateFormatter: this._dateFormatter }).dateFormatter; + }, set: function(u) { + this._dateFormatter = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateFormat", { get: function() { + return this.adapter.apply("dateFormat", { dateFormat: this._dateFormat }).dateFormat; + }, set: function(u) { + this._dateFormat = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateFields", { get: function() { + return this._dateFields || (this._dateFields = new Hs()), this.adapter.apply("dateFields", { dateFields: this._dateFields }).dateFields; + }, set: function(u) { + this._dateFields = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "numberFormatter", { get: function() { + return this._numberFormatter || (this._numberFormatter = new sA(), this._numberFormatter.language = this.language), this.adapter.apply("numberFormatter", { numberFormatter: this._numberFormatter }).numberFormatter; + }, set: function(u) { + this._numberFormatter = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "numberFormat", { get: function() { + return this.adapter.apply("numberFormat", { numberFormat: this._numberFormat }).numberFormat; + }, set: function(u) { + this._numberFormat = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "numberFields", { get: function() { + return this._numberFields || (this._numberFields = new Hs()), this.adapter.apply("numberFields", { numberFields: this._numberFields }).numberFields; + }, set: function(u) { + this._numberFields = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "durationFormatter", { get: function() { + return this._durationFormatter || (this._durationFormatter = new J3(), this._durationFormatter.language = this.language), this.adapter.apply("durationFormatter", { durationFormatter: this._durationFormatter }).durationFormatter; + }, set: function(u) { + this._durationFormatter = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "durationFormat", { get: function() { + return this.adapter.apply("durationFormat", { durationFormat: this._durationFormat }).durationFormat; + }, set: function(u) { + this._durationFormat = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "durationFields", { get: function() { + return this._durationFields || (this._durationFields = new Hs()), this.adapter.apply("durationFields", { durationFields: this._durationFields }).durationFields; + }, set: function(u) { + this._durationFields = u; + }, enumerable: !0, configurable: !0 }), R.prototype.generateDataFields = function() { + var u = this; + this._dataFields = {}, this.data.length && _i(this.data, function(w) { + mi(w, function($, G) { + Ee(u._dataFields[$]) || (u._dataFields[$] = u.adapter.apply("dataFieldName", { name: $, field: $ }).name); + }); + }); + }, R.prototype.isDateField = function(u) { + return this.adapter.apply("isDateField", { isDateField: this.dateFields.contains(u), field: u }).isDateField; + }, R.prototype.isNumberField = function(u) { + return this.adapter.apply("isNumberField", { isNumberField: this.numberFields.contains(u), field: u }).isNumberField; + }, R.prototype.isDurationField = function(u) { + return this.adapter.apply("isDurationField", { isDurationField: this.durationFields.contains(u), field: u }).isDurationField; + }, R.prototype.getContentType = function(u) { + var w = ""; + switch (u) { + case "png": + case "gif": + w = "image/" + u; + break; + case "jpg": + w = "image/jpeg"; + break; + case "svg": + w = "image/svg+xml"; + break; + case "csv": + w = "text/csv"; + break; + case "json": + w = "application/json"; + break; + case "html": + w = "text/html"; + break; + case "pdf": + case "pdfdata": + w = "application/pdf"; + break; + case "xlsx": + w = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + } + return this.adapter.apply("contentType", { contentType: w, type: u }).contentType; + }, Object.defineProperty(R.prototype, "filePrefix", { get: function() { + return this.adapter.apply("filePrefix", { filePrefix: this._filePrefix }).filePrefix; + }, set: function(u) { + this._filePrefix = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "backgroundColor", { get: function() { + return this.adapter.apply("backgroundColor", { backgroundColor: this._backgroundColor }).backgroundColor; + }, set: function(u) { + this._backgroundColor = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "title", { get: function() { + return this.adapter.apply("title", { title: this._title }).title; + }, set: function(u) { + this._title = u; + }, enumerable: !0, configurable: !0 }), R.prototype.showPreloader = function() { + var u = this.preloader; + u && (u.progress = 0.5, u.label.text = "..."); + }, R.prototype.hidePreloader = function() { + var u = this.preloader; + u && (u.progress = 1); + }, Object.defineProperty(R.prototype, "preloader", { get: function() { + return this._sprite && this._sprite.parent && this._sprite.parent.preloader ? this._sprite.parent.preloader : void 0; + }, enumerable: !0, configurable: !0 }), R.prototype.showTimeout = function() { + this.showModal(this.adapter.apply("timeoutMessage", { message: this.language.translate("Export operation took longer than expected. Something might have gone wrong.") }).message); + }, R.prototype.hideTimeout = function() { + this._timeoutTimeout && (this.removeDispose(this._timeoutTimeout), this._timeoutTimeout = null), this.hideModal(); + }, Object.defineProperty(R.prototype, "language", { get: function() { + return this._language || (this._language = new Yv()), this._language; + }, set: function(u) { + this._language = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "modal", { get: function() { + return this._modal || (this._modal = new gL(), this._modal.adapter.add("classPrefix", function(u) { + return zd.classNamePrefix + u; + })), this._modal; + }, enumerable: !0, configurable: !0 }), R.prototype.showModal = function(u, w) { + this.hideModal(), this.hidePreloader(); + var $ = this.modal; + $.container = this.sprite.svgContainer.SVGContainer, $.content = u, $.readerTitle = w, $.open(); + }, R.prototype.hideModal = function() { + this._modal && this.modal.close(); + }, R.prototype._canvg = function() { + return fe(this, void 0, void 0, function() { + var u; + return be(this, function(w) { + switch (w.label) { + case 0: + return [4, o.e(265).then(o.bind(o, 1234))]; + case 1: + return (u = w.sent()).default != null ? [2, u.default] : [2, u]; + } + }); + }); + }, Object.defineProperty(R.prototype, "canvg", { get: function() { + return this._canvg(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pdfmake", { get: function() { + return Xb == null && (Xb = function() { + return fe(this, void 0, void 0, function() { + var u, w, $, G; + return be(this, function(K) { + switch (K.label) { + case 0: + return [4, Promise.all([o.e(643).then(o.t.bind(o, 6727, 23)), o.e(643).then(o.bind(o, 4995))])]; + case 1: + return u = K.sent(), w = u[0], $ = u[1], (G = window).pdfMake = G.pdfMake || {}, G.pdfMake.vfs = $.default, w.vfs = $.default, [2, w]; + } + }); + }); + }()), Xb; + }, enumerable: !0, configurable: !0 }), R.prototype._xlsx = function() { + return fe(this, void 0, void 0, function() { + return be(this, function(u) { + switch (u.label) { + case 0: + return [4, Promise.all([o.e(739), o.e(297)]).then(o.t.bind(o, 7739, 23))]; + case 1: + return [2, u.sent()]; + } + }); + }); + }, Object.defineProperty(R.prototype, "xlsx", { get: function() { + return this._xlsx(); + }, enumerable: !0, configurable: !0 }), R.prototype.setFormatOptions = function(u, w) { + this._formatOptions.setKey(u, w); + }, R.prototype.getFormatOptions = function(u) { + return this._formatOptions.getKey(u); + }, Object.defineProperty(R.prototype, "formatOptions", { get: function() { + return this._formatOptions; + }, enumerable: !0, configurable: !0 }), R.prototype._disablePointers = function() { + Ee(this._spriteInteractionsEnabled) || (this._spriteInteractionsEnabled = this.sprite.interactionsEnabled), this.sprite.interactionsEnabled = !1; + }, R.prototype._releasePointers = function() { + Ee(this._spriteInteractionsEnabled) && !this._exportRunning && (this.sprite.interactionsEnabled = this._spriteInteractionsEnabled); + }, R.prototype.hideNonExportableSprites = function() { + var u = this; + if (!this._objectsAlreadyHidden) { + var w = this.sprite.svgContainer; + w && _i(w.nonExportableSprites, function($) { + $.isHidden || $.isHiding || !$.visible || u._hiddenObjects.push($), $.hide(0); + }), this._objectsAlreadyHidden = !0; + } + }, R.prototype.restoreNonExportableSprites = function() { + this._objectsAlreadyHidden && (_i(this._hiddenObjects, function(u) { + u.show(0); + }), this._hiddenObjects = [], this._objectsAlreadyHidden = !1); + }, R.prototype.awaitValidSprites = function() { + return fe(this, void 0, void 0, function() { + var u; + return be(this, function(w) { + switch (w.label) { + case 0: + return u = [], this.validateSprites.length && _i(this.validateSprites, function($, G) { + $.invalid && u.push(new Promise(function(K, ne) { + $.events.once("validated", function(ue) { + K(); + }); + })); + }), u.length ? [4, Promise.all(u)] : [3, 2]; + case 1: + w.sent(), w.label = 2; + case 2: + return [2]; + } + }); + }); + }, R.prototype.processConfig = function(u) { + hi.registeredClasses.ExportMenu = Gt, u && (Ee(u.menu) && !Ee(u.menu.type) && (u.menu.type = "ExportMenu"), Ee(u.dataFields) && ct(u.dataFields) && (this.dataFields = u.dataFields, delete u.dataFields)), U.prototype.processConfig.call(this, u); + }, R.XLINK = "http://www.w3.org/1999/xlink", R; + }(Ct), lc = ["fill", "fillOpacity", "stroke", "strokeOpacity", "strokeWidth", "strokeDasharray", "strokeDashoffset", "strokeLinecap", "strokeLinejoin"], so = function(U) { + function R() { + var u = U.call(this) || this; + return u.properties = {}, u._eventDispatcher = new M8(u), u._bindings = {}, u._isTemplate = !1, u._isPath = !1, u._inited = !1, u._ready = !1, u.isHiding = !1, u._isHidden = !1, u.isShowing = !1, u.isStandaloneInstance = !1, u._isActive = !1, u._mask = new Un(), u._positionPrecision = 3, u._language = new Un(), u._exporting = new Un(), u._exportable = !0, u._bbox = { x: 0, y: 0, width: 0, height: 0 }, u.invalid = !1, u.positionInvalid = !1, u.propertyFields = {}, u.applyOnClones = !1, u._measuredWidthSelf = 0, u._measuredHeightSelf = 0, u.maxLeft = 0, u.maxRight = 0, u.maxTop = 0, u.maxBottom = 0, u.maxLeftSelf = 0, u.maxRightSelf = 0, u.maxTopSelf = 0, u.maxBottomSelf = 0, u._isDragged = !1, u._isResized = !1, u._disabled = !1, u._internalDisabled = !1, u._updateDisabled = !1, u._internalDefaultsApplied = !1, u.rollOutDelay = 0, u.isBaseSprite = !1, u.shouldClone = !0, u.appeared = !1, u.ex = 0, u.ey = 0, u.dragWhileResize = !1, u.measureFailed = !1, u.preventShow = !1, u.cloneTooltip = !0, u.className = "Sprite", u._disposers.push(u._eventDispatcher), u.uid, u.group = u.paper.addGroup("g"), u.setPropertyValue("scale", 1), u.setPropertyValue("rotation", 0), u.setPropertyValue("align", "none"), u.setPropertyValue("valign", "none"), u.setPropertyValue("pixelPerfect", !1), u.setPropertyValue("visible", !0), u.setPropertyValue("tooltipPosition", "fixed"), u.setPropertyValue("verticalCenter", "none"), u.setPropertyValue("horizontalCenter", "none"), u.setPropertyValue("tooltipX", ce(50)), u.setPropertyValue("tooltipX", ce(50)), u.setPropertyValue("marginTop", 0), u.setPropertyValue("marginBottom", 0), u.setPropertyValue("marginLeft", 0), u.setPropertyValue("marginRight", 0), u.setPropertyValue("dx", 0), u.setPropertyValue("dy", 0), u.setPropertyValue("paddingTop", 0), u.setPropertyValue("paddingBottom", 0), u.setPropertyValue("paddingRight", 0), u.setPropertyValue("paddingLeft", 0), u.setPropertyValue("togglable", !1), u.setPropertyValue("hidden", !1), u.setPropertyValue("urlTarget", "_self"), u.setPropertyValue("alwaysShowTooltip", !1), u.setPropertyValue("showTooltipOn", "hover"), u._prevMeasuredWidth = 0, u._prevMeasuredHeight = 0, u._measuredWidth = 0, u._measuredHeight = 0, u._isMeasured = !0, u.invalidate(), u.applyTheme(), u._disposers.push(u.events), u._disposers.push(u.group), u._disposers.push(u._mask), u._disposers.push(u._language), u._disposers.push(u._exporting), u._disposers.push(new ln(function() { + mi(u._bindings, function(w, $) { + $.dispose(); + }); + })), u.setPropertyValue("interactionsEnabled", !0), u; + } + return re(R, U), Object.defineProperty(R.prototype, "events", { get: function() { + return this._eventDispatcher; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "adapter", { get: function() { + return this._adapterO || (this._adapterO = new Yu(this)), this._adapterO; + }, enumerable: !0, configurable: !0 }), R.prototype.applyTheme = function() { + U.prototype.applyTheme.call(this); + }, R.prototype.getCurrentThemes = function() { + var u = this._themes; + if (u) + return u; + var w = this._parent; + return w ? w.getCurrentThemes() : hi.themes; + }, R.prototype.applyInternalDefaults = function() { + this._internalDefaultsApplied = !0; + }, R.prototype.invalidate = function() { + this.disabled || this._isTemplate || this.__disabled || this.invalid || (this.invalid = !0, hi.addToInvalidSprites(this), qo.requestFrame()); + }, R.prototype.validate = function() { + this.dispatchImmediately("beforevalidated"), this._internalDefaultsApplied || this.applyInternalDefaults(), this.beforeDraw(), this.draw(), this.invalid = !1, hi.removeFromInvalidSprites(this), this.afterDraw(); + }, R.prototype.invalidatePosition = function() { + this.disabled || this._isTemplate || this.positionInvalid || (this.positionInvalid = !0, hi.addToInvalidPositions(this), qo.requestFrame()); + }, R.prototype.validatePosition = function() { + var u = this.pixelX, w = this.pixelY, $ = this.dx, G = this.dy, K = u + $, ne = w + G; + this._updateDisabled && (this._internalDisabled ? this.group.attr({ display: "none" }) : this.disabled || this.removeSVGAttribute("display"), this._updateDisabled = !1); + var ue = this.measure(), we = this.group.transformString; + this.group.moveTo({ x: K, y: ne }), this.group.rotation = this.rotation, this.nonScaling ? this.group.scale = this.scale / this.globalScale : this.group.scale = this.scale, (we != this.group.transformString || ue) && (we == null ? this.dispatch("transformed") : this.dispatchImmediately("transformed"), this.dispatch("positionchanged"), this.showTooltipOn != "hit" && this.showTooltipOn != "always" || this.updateTooltipPosition()), u + $ == K && w + G == ne && (hi.removeFromInvalidPositions(this), this.positionInvalid = !1); + var De = this._maskRectangle; + De && this._clipElement.moveTo({ x: De.x - u, y: De.y - w }); + }, R.prototype.beforeDraw = function() { + }, R.prototype.draw = function() { + }, R.prototype.afterDraw = function() { + var u, w; + if ((this.isMeasured || this.horizontalCenter !== "none" || this.verticalCenter !== "none") && this.measureElement(), this._inited) + this.dispatch("validated"); + else { + if (this._adapterO) + try { + for (var $ = Se(this._adapterO.keys()), G = $.next(); !G.done; G = $.next()) { + var K = G.value; + switch (K) { + case "mask": + case "fill": + case "opacity": + case "fillOpacity": + case "stroke": + case "strokeOpacity": + case "strokeWidth": + case "shapeRendering": + case "strokeDasharray": + case "strokeDashoffset": + case "strokeLinecap": + case "strokeLinejoin": + case "textDecoration": + case "fontSize": + case "fontFamily": + case "fontWeight": + this[K] = this[K]; + } + } + } catch (ne) { + u = { error: ne }; + } finally { + try { + G && !G.done && (w = $.return) && w.call($); + } finally { + if (u) + throw u.error; + } + } + this.applyFilters(), this.visible = this.visible, this.interactionsEnabled = this.getPropertyValue("interactionsEnabled"), this._inited = !0, this.showOnInit || (this.appeared = !0), this.hidden && this.hide(0), this.applyMask(), this.dispatch("validated"), this.dispatch("inited"), this.dispatchReady(); + } + this.showTooltipOn == "always" && (!this.visible || this.disabled || this.__disabled ? this.hideTooltip(0) : this.showTooltip()); + }, R.prototype.dispatchReady = function() { + this.isReady() || (this._ready = !0, this.dispatch("ready")); + }, R.prototype.reinit = function() { + this._inited = !1, this.setState(this.defaultState), this.invalidate(); + }, R.prototype.handleGlobalScale = function() { + this.dispatch("globalscalechanged"), this.nonScalingStroke && (this.strokeWidth = this.strokeWidth), this.nonScaling && this.validatePosition(), this.updateFilterScale(); + }, R.prototype.updateFilterScale = function() { + var u = this; + er(this.filters.iterator(), function(w) { + w.scale = u.globalScale; + }); + }, R.prototype.removeFromInvalids = function() { + hi.removeFromInvalidSprites(this), hi.removeFromInvalidPositions(this); + }, R.prototype.copyFrom = function(u) { + var w = this; + U.prototype.copyFrom.call(this, u), this.isMeasured = u.isMeasured, this.states.copyFrom(u.states), u.filters.length > 0 && u.filters.each(function($) { + w.filters.push($.clone()); + }), u._adapterO && this.adapter.copyFrom(u._adapterO), u._interaction && this.interactions.copyFrom(u.interactions), u._plugins && this.plugins.copyFrom(u.plugins), this.configField = u.configField, this.applyOnClones = u.applyOnClones, this.disabled = u.disabled, this.virtualParent = u.virtualParent, this.exportable = u.exportable, u._tooltip && (this._tooltip ? this._tooltip.copyFrom(u.tooltip) : u.cloneTooltip ? this.tooltip = u.tooltip.clone() : this._tooltip = u.tooltip), this._showSystemTooltip = u.showSystemTooltip, on(u.propertyFields, this.propertyFields), on(u.properties, this), u.fillModifier && (this.fillModifier = u.fillModifier.clone()), u.strokeModifier && (this.strokeModifier = u.strokeModifier.clone()), u.focusFilter && (this.focusFilter = u.focusFilter.clone()); + }, R.prototype.dispose = function() { + if (!this.isDisposed()) { + if (this.showTooltipOn == "always" && this.tooltip && this.tooltip.hide(), this.dispatchImmediately("beforedisposed"), this.isBaseSprite) { + if (this.htmlContainer) + for (; this.htmlContainer.childNodes.length > 0; ) + this.htmlContainer.removeChild(this.htmlContainer.firstChild); + this.isBaseSprite = !1; + } + if (U.prototype.dispose.call(this), this._adapterO && this._adapterO.clear(), this.applyOnClones && this._clones) + for (var u = this._clones.length - 1; u >= 0; u--) + this._clones.getIndex(u).dispose(); + this._svgContainer && this._svgContainer.dispose(), this._interactionDisposer && (this._interactionDisposer.dispose(), this._interactionDisposer = void 0), this._urlDisposer && this._urlDisposer.dispose(), this.removeFromInvalids(), this.element && this.element.dispose(), this.group && this.group.dispose(), this._numberFormatter && this._numberFormatter.dispose(), this._focusFilter && this._focusFilter.dispose(); + var w = this.stroke; + !w || w instanceof Ie || !w.dispose || this.clonedFrom && this.clonedFrom.stroke == w || w.dispose(); + var $ = this.fill; + if (!$ || $ instanceof Ie || !$.dispose || this.clonedFrom && this.clonedFrom.fill == $ || $.dispose(), Ee(this.id) && this.map.removeKey(this.id), this.parent = void 0, this._filters) + for (; this._filters.length > 0; ) { + var G = this._filters.getIndex(0); + G.dispose(), this._filters.removeValue(G); + } + this._alwaysShowDisposers = void 0; + } + }, Object.defineProperty(R.prototype, "isTemplate", { get: function() { + return this._isTemplate; + }, set: function(u) { + u = Tt(u), this._isTemplate != u && (this._isTemplate = u, this instanceof Qn && er(this.children.iterator(), function(w) { + w.isTemplate = u; + }), u ? (this.parent = this._parent, this.removeFromInvalids()) : this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "showSystemTooltip", { get: function() { + return Ee(this._showSystemTooltip) ? this._showSystemTooltip : this.virtualParent ? this.virtualParent.showSystemTooltip : !!this._parent && this._parent.showSystemTooltip; + }, set: function(u) { + u = Tt(u), this._showSystemTooltip != u && (this._showSystemTooltip = u, this.applyAccessibility()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "topParent", { get: function() { + return this._topParent ? this._topParent : this._parent ? this._parent.topParent : void 0; + }, set: function(u) { + this._topParent = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "parent", { get: function() { + return this._parent; + }, set: function(u) { + if (!this._isTemplate) { + this.paper; + var w = this._parent; + w != u && (w && w.children.removeValue(this), this._parent = u, u ? (this.topParent = u.topParent, u.isTemplate && (this.isTemplate = !0), this.baseId = u.baseId, u.children.push(this), this._tooltip && !this._tooltipContainer && (this._tooltip.parent = u.tooltipContainer), this._dataItem || (this.dataItem = u.dataItem), this.handleAlwaysShowTooltip(), this.dataItem && this.applyAccessibility(), this.dispatchImmediately("parentset")) : this.topParent = void 0); + } + }, enumerable: !0, configurable: !0 }), R.prototype.handleAlwaysShow = function() { + this.showTooltip(); + }, R.prototype.handleAlwaysShowTooltip = function() { + var u = this, w = this._alwaysShowDisposers; + if (w && _i(w, function(G) { + G.dispose(); + }), this._alwaysShowDisposers = [], this.showTooltipOn == "always") + for (; u != null; ) { + var $ = u.events.on("visibilitychanged", this.handleAlwaysShow, this, !1); + this.addDisposer($), this._alwaysShowDisposers.push($), u = u.parent; + } + }, Object.defineProperty(R.prototype, "virtualParent", { get: function() { + return this._virtualParent; + }, set: function(u) { + this._virtualParent = u, this.dataItem && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), R.prototype.appendDefs = function() { + this.filterElement && this.paper.appendDef(this.filterElement); + var u = this.fill; + u && u.element && this.paper.appendDef(u.element); + var w = this.stroke; + if (w && w.element && this.paper.appendDef(w.element), this.fillModifier && this.fill instanceof Ie) { + var $ = this.fillModifier.modify(this.fill); + $ && $.element && this.paper.appendDef($.element); + } + if (this.strokeModifier && this.stroke instanceof Ie) { + var G = this.strokeModifier.modify(this.stroke); + G && G.element && this.paper.appendDef(G.element); + } + this._clipPath && this.paper.appendDef(this._clipPath), this._exportable === !1 && (this.exportable = !1); + }, Object.defineProperty(R.prototype, "map", { get: function() { + var u = this.topParent; + return u ? u.map : (this._map || (this._map = new ha()), this._map); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "delayedMap", { get: function() { + var u = this.topParent; + return u ? u.delayedMap : (this._delayedMap || (this._delayedMap = new ha()), this._delayedMap); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "id", { get: function() { + return this._id; + }, set: function(u) { + if (this._id != u) { + if (this._id = u, this.map.hasKey(u)) + throw Error("Duplicate id (" + u + ") used on multiple objects."); + this.map.setKey(u, this); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dom", { get: function() { + return this.group.node; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paper", { get: function() { + if (this._paper) + return this._paper; + var u = this._parent; + return u ? u.paper : Yb(); + }, set: function(u) { + this.setPaper(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setPaper = function(u) { + return this._paper != u && (this._paper = u, this.appendDefs(), !0); + }, Object.defineProperty(R.prototype, "htmlContainer", { get: function() { + if (this._htmlContainer) + return this._htmlContainer; + var u = this._parent; + return u ? u.htmlContainer : void 0; + }, set: function(u) { + this._htmlContainer = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "titleElement", { get: function() { + return this._titleElement || (this._titleElement = this.paper.add("title"), this.group.add(this._titleElement)), this._titleElement; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "descriptionElement", { get: function() { + return this._descriptionElement || (this._descriptionElement = this.paper.add("desc"), this.group.add(this._descriptionElement)), this._descriptionElement; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "filters", { get: function() { + return this._filters || (this._filters = new Hs(), this._disposers.push(this._filters.events.onAll(this.applyFilters, this)), this._disposers.push(new Wo(this._filters))), this._filters; + }, enumerable: !0, configurable: !0 }), R.prototype.setSVGAttributes = function() { + this.fill = this.fill, this.opacity = this.opacity, this.fillOpacity = this.fillOpacity, this.stroke = this.stroke, this.strokeOpacity = this.strokeOpacity, this.shapeRendering = this.shapeRendering, this.strokeDasharray = this.strokeDasharray, this.strokeDashoffset = this.strokeDashoffset, this.strokeLinecap = this.strokeLinecap, this.strokeLinejoin = this.strokeLinejoin, this.focusable = this.focusable, this.tabindex = this.tabindex, this.role = this.role; + }, R.prototype.setSVGAttribute = function(u) { + this.group.attr(u); + }, R.prototype.removeSVGAttribute = function(u) { + this.group.removeAttr(u); + }, R.prototype.setClassName = function() { + var u = this.className, w = zd.classNamePrefix; + this.element && this.element.addClass(w + u), this.group.addClass(w + u + "-group"), Ee(this.id) && this.group.addClass(w + this.id), this.userClassName && this.group.addClass(this.userClassName); + }, R.prototype.uidAttr = function() { + return this.setSVGAttribute({ id: this.uid }), this.uid; + }, R.prototype.updateClipPath = function() { + var u = this._clipElement; + u && u.moveTo({ x: this.mask.pixelX, y: this.mask.pixelY }); + }, R.prototype.createClipPath = function() { + if (!this._clipPath) { + this._clipPath = this.paper.addGroup("clipPath"), this.paper.appendDef(this._clipPath), this._disposers.push(this._clipPath); + var u = hi.getUniqueId(); + this._clipPath.attr({ id: u }), this.group.attr({ "clip-path": 'url("' + Fs() + u + '")' }); + } + }, R.prototype.applyMask = function() { + var u = this.mask; + if (this._clipPath && u) + if (u instanceof Qn) { + this._clipElement.attr({ width: ve(0, u.pixelWidth), height: ve(0, u.pixelHeight) }); + var w = up({ x: u.pixelX, y: u.pixelY }, u.parent, this); + this._clipPath.x = w.x, this._clipPath.y = w.y; + } else + u.element && u.element != this._clipElement && (this._clipElement = u.element, this._clipPath.add(this._clipElement)), this._clipPath.scale = u.scale, this._clipPath.x = u.pixelX, this._clipPath.y = u.pixelY, this._clipPath.rotation = u.rotation; + }, R.prototype.applyFilters = function() { + var u = this; + if (this._filters && this._filters.length > 0) { + var w = 100, $ = 100; + this.filterElement ? this.filterElement.removeChildNodes() : (this.filterElement = this.paper.addGroup("filter"), this._disposers.push(this.filterElement)), this.paper.appendDef(this.filterElement); + var G = "filter-" + this.uid; + this.filterElement.attr({ id: G }), er(this.filters.iterator(), function(ue) { + ue.sprite = u, ue.paper = u.paper, u.filterElement.attr({ filterUnits: ue.filterUnits }), ue.appendPrimitives(u.filterElement), ue.width > w && (w = ue.width), ue.height > $ && ($ = ue.height), ue.scale = u.globalScale; + }); + var K = w + "%", ne = $ + "%"; + this.filterElement.attr({ width: K, height: ne, x: -(w - 100) / 2 + "%", y: -($ - 100) / 2 + "%" }), this.group.attr({ filter: 'url("' + Fs() + G + '")' }); + } else + this.filterElement && (this.group.removeAttr("filter"), this.filterElement.removeChildNodes()); + }, R.prototype.removeClipPath = function() { + this._clipPath && (this.removeDispose(this._clipPath), this._clipPath = void 0); + }, R.prototype.setElement = function(u) { + this.element = u, this.setSVGAttributes(), this.applyAccessibility(); + }, Object.defineProperty(R.prototype, "element", { get: function() { + return this._element; + }, set: function(u) { + this.removeElement(), this._element = u, this.group.add(u), u.node instanceof SVGPathElement && (this._isPath = !0), this.invalid || this.validate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "svgContainer", { get: function() { + return this._svgContainer ? this._svgContainer : this._parent ? this._parent.svgContainer : void 0; + }, set: function(u) { + this._svgContainer = u; + }, enumerable: !0, configurable: !0 }), R.prototype.measureElement = function() { + if (this.element) + if (this.definedBBox) + this._bbox = this.definedBBox; + else { + var u = this.element.getBBox(); + this._bbox = { x: u.x, y: u.y, width: u.width, height: u.height }; + } + }, R.prototype.updateCenter = function() { + if (this.element) { + var u = this.element.transformString, w = this.bbox, $ = 0, G = 0, K = w.x, ne = w.y, ue = w.width, we = w.height, De = this.pixelPaddingLeft, $e = this.pixelPaddingRight, Ke = this.pixelPaddingTop, Ze = this.pixelPaddingBottom, pt = ve(ue + De + $e, this.pixelWidth), Vt = ve(we + Ke + Ze, this.pixelHeight), Yt = w.x, ci = w.x + pt, ai = w.y, Gi = w.y + Vt, Ji = this.horizontalCenter, Ci = this.verticalCenter; + switch (Ji) { + case "none": + $ = K + De; + break; + case "left": + $ = De; + break; + case "middle": + $ = De - (ue + $e + De) / 2; + break; + case "right": + $ = -$e - ue; + } + switch (Ci) { + case "none": + G = ne + Ke; + break; + case "top": + G = Ke; + break; + case "middle": + G = Ke - (we + Ze + Ke) / 2; + break; + case "bottom": + G = -Ze - we; + } + this._measuredHeight = Vt, this._measuredWidth = pt; + var Hi = He($ - K, this._positionPrecision, !0), sr = He(G - ne, this._positionPrecision, !0); + this.ex = Hi - De, this.ey = sr - Ke, this.maxLeft = Yt + Hi - De, this.maxRight = ci + Hi - De, this.maxTop = ai + sr - Ke, this.maxBottom = Gi + sr - Ke, this.pixelPerfect && zd.pixelPerfectPrecision == 0 && (Hi -= 0.5, sr -= 0.5), this.element.moveTo({ x: Hi, y: sr }), u != this.element.transformString && this.dispatchImmediately("transformed"); + } + }, R.prototype.measure = function() { + this.updateCenter(); + var u = this._measuredWidth, w = this._measuredHeight, $ = this.maxLeft, G = this.maxRight, K = this.maxTop, ne = this.maxBottom; + this._measuredWidthSelf = u, this._measuredHeightSelf = w; + var ue = this._positionPrecision; + if (this.maxLeftSelf = this.maxLeft, this.maxRightSelf = this.maxRight, this.maxTopSelf = this.maxTop, this.maxBottomSelf = this.maxBottom, this.rotation !== 0 || this.scale !== 1 || this.nonScaling) { + this.nonScalingStroke && (this.strokeWidth = this.strokeWidth); + var we = this.paper.svg, De = we.createSVGMatrix(), $e = this.rotation, Ke = this.scale; + this.nonScaling && (Ke = this.scale / this.globalScale), De.a = A($e) * Ke, De.c = -Ue($e) * Ke, De.e = 0, De.b = Ue($e) * Ke, De.d = A($e) * Ke, De.f = 0; + var Ze = we.createSVGPoint(); + Ze.x = $, Ze.y = K; + var pt = we.createSVGPoint(); + pt.x = G, pt.y = K; + var Vt = we.createSVGPoint(); + Vt.x = G, Vt.y = ne; + var Yt = we.createSVGPoint(); + Yt.x = $, Yt.y = ne; + var ci = Ze.matrixTransform(De), ai = pt.matrixTransform(De), Gi = Vt.matrixTransform(De), Ji = Yt.matrixTransform(De); + $ = Math.min(ci.x, ai.x, Gi.x, Ji.x), G = Math.max(ci.x, ai.x, Gi.x, Ji.x), K = Math.min(ci.y, ai.y, Gi.y, Ji.y), u = G - $, w = (ne = Math.max(ci.y, ai.y, Gi.y, Ji.y)) - K, this.maxLeft = He($, ue, !0), this.maxRight = He(G, ue, !0), this.maxTop = He(K, ue, !0), this.maxBottom = He(ne, ue, !0); + } + return this._measuredWidth = He(u, ue, !0), this._measuredHeight = He(w, ue, !0), (this._measuredWidth != this._prevMeasuredWidth || this._measuredHeight != this._prevMeasuredHeight) && (this._prevMeasuredHeight = this._measuredHeight, this._prevMeasuredWidth = this._measuredWidth, this.dispatch("sizechanged"), (this.isHover || this.showTooltipOn == "hit" || this.showTooltipOn == "always") && this.tooltip && this.tooltip.visible && (Ee(this.tooltipText) || Ee(this.tooltipHTML)) && this.updateTooltipPosition(), !0); + }, R.prototype.insertBefore = function(u) { + var w = this._parent; + if (w) { + var $ = w.children.indexOf(u); + $ !== -1 && (w.children.moveValue(this, $), w.sortChildren()); + } + return this; + }, R.prototype.insertAfter = function(u) { + var w = this._parent; + if (w) { + var $ = w.children.indexOf(u); + $ !== -1 && (w.children.moveValue(this, $ + 1), w.sortChildren()); + } + return this; + }, R.prototype.removeElement = function() { + this._element && (this.removeDispose(this._element), this._element = void 0); + }, R.prototype.getRelativeX = function(u) { + return u instanceof J ? u.value : this._parent ? u / this._parent.innerWidth : 0; + }, R.prototype.getRelativeY = function(u) { + return u instanceof J ? u.value : this._parent ? u / this._parent.innerHeight : 0; + }, R.prototype.getPixelX = function(u) { + var w = 0; + if (le(u)) + w = u; + else if (u instanceof J) { + var $ = u.value; + this._parent && (w = He(this._parent.innerWidth * $, this._positionPrecision, !0)); + } + return w; + }, R.prototype.getPixelY = function(u) { + var w = 0; + if (le(u)) + w = u; + else if (u instanceof J) { + var $ = u.value; + this._parent && (w = He(this._parent.innerHeight * $, this._positionPrecision, !0)); + } + return w; + }, R.prototype.moveTo = function(u, w, $, G) { + this.isDragged && !G || (u && (le(u.x) && this.setPropertyValue("x", He(u.x, this._positionPrecision, !0)), le(u.y) && this.setPropertyValue("y", He(u.y, this._positionPrecision, !0))), le(w) && (this.rotation = w), le($) && (this.scale = $), this.invalidatePosition()); + }, Object.defineProperty(R.prototype, "mask", { get: function() { + return this._adapterO ? this._adapterO.apply("mask", this._mask.get()) : this._mask.get(); + }, set: function(u) { + var w = this; + this._mask.get() !== u && (u ? (this.createClipPath(), u instanceof Qn ? this._clipElement = this.paper.add("rect") : (u.isMeasured = !1, u.element && (this._clipElement = u.element)), this._clipElement && this._clipPath.add(this._clipElement), this._mask.set(u, new kn([u.events.on("maxsizechanged", function() { + w.inited && w.applyMask(); + }, void 0, !1), u.events.on("validated", this.applyMask, this, !1), u.events.on("positionchanged", this.applyMask, this, !1)])), this.applyMask()) : (this._mask.reset(), this.group.removeAttr("clip-path"), this.removeClipPath())); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maskRectangle", { get: function() { + return this._maskRectangle; + }, set: function(u) { + u ? (this.createClipPath(), this._clipElement || (this._clipElement = this.paper.add("rect"), this._clipPath.add(this._clipElement)), this._clipElement.attr({ width: u.width, height: u.height })) : (this.removeClipPath(), this._clipElement = void 0), this._maskRectangle = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isMeasured", { get: function() { + return this._isMeasured; + }, set: function(u) { + (u = Tt(u)) || (this._measuredWidth = 0, this._measuredHeight = 0), this._isMeasured != u && (this._isMeasured = u, this.invalidatePosition()); + }, enumerable: !0, configurable: !0 }), R.prototype.hitTest = function(u) { + this.invalid && this.validate(), u.invalid && u.validate(); + var w = this.pixelX + this.maxLeft, $ = this.pixelY + this.maxTop, G = w + this.maxRight, K = $ + this.maxBottom, ne = u.pixelX + u.maxLeft, ue = u.pixelY + u.maxTop, we = ne + u.maxRight, De = ue + u.maxBottom; + return !(ne > G || we < w || ue > K || De < $); + }, Object.defineProperty(R.prototype, "inited", { get: function() { + return this._inited; + }, enumerable: !0, configurable: !0 }), R.prototype.isReady = function() { + return this._ready; + }, Object.defineProperty(R.prototype, "states", { get: function() { + if (!this._states) { + var u = new Hr(); + this._states = new Nf(u), this._disposers.push(this._states.events.on("insertKey", this.processState, this, !1)), this._disposers.push(this._states.events.on("setKey", this.processState, this, !1)), this._disposers.push(new jd(this._states)), this._disposers.push(u); + } + return this._states; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hiddenState", { get: function() { + if (!this.states.getKey("hidden")) { + var u = this.states.create("hidden"); + u.properties.opacity = 0, u.properties.visible = !1; + } + return this.states.getKey("hidden"); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "defaultState", { get: function() { + return this.states.getKey("default") || (this.states.create("default").properties.opacity = 1), this.states.getKey("default"); + }, enumerable: !0, configurable: !0 }), R.prototype.processState = function(u) { + var w = u.newValue; + if (w.sprite = this, w.name = u.key, (this.states.hasKey("hover") || this.showTooltipOn == "hover" && (Ee(this.tooltipHTML) || Ee(this.tooltipText))) && (this.hoverable = !0), (this.states.hasKey("down") || this.showTooltipOn == "hover" && (Ee(this.tooltipHTML) || Ee(this.tooltipText))) && (this.clickable = !0), this.states.hasKey("focus") && (this.focusable = !0), this.applyOnClones) + for (var $ = this.clones.values, G = $.length, K = 0; K < G; ++K) { + var ne = $[K]; + ne.isDisposed() || ne.states.setKey(w.name, w); + } + }, Object.defineProperty(R.prototype, "animations", { get: function() { + return this._animations || (this._animations = [], this._disposers.push(new Wb(this._animations))), this._animations; + }, enumerable: !0, configurable: !0 }), R.prototype.getSvgPoint = function(u) { + try { + var w = this.htmlContainer.getBoundingClientRect(); + return { x: u.x - w.left, y: u.y - w.top }; + } catch { + return u; + } + }, R.prototype.animate = function(u, w, $) { + return new $f(this, u, w, $).start(); + }, R.prototype.setState = function(u, w, $) { + var G; + if (u instanceof Hr) + this.states.setKey(u.name, u), G = u; + else if (!(G = this.states.getKey(u))) + return; + if (G.name == "hover") { + if (this.isHidden) + return; + this.isHover = !0; + } + return G.name == "hidden" ? this.isHiding = !0 : this.visible || this.setVisibility(G.properties.visible || this.defaultState.properties.visible), G.name == "active" && (this.isActive = !0), le(w) || (w = G.transitionDuration), Ee($) || ($ = G.transitionEasing), this.transitTo(G, w, $); + }, R.prototype.applyCurrentState = function(u) { + var w = this.setState(this.defaultState, u); + return this.isHover && (w = this.setState("hover", u)), this.isDown && this.interactions.downPointers.length && (w = this.setState("down", u)), this.isFocused = this.isFocused, this.isActive && (w = this.setState("active", u), this.isHover && this.states.hasKey("hoverActive") && (w = this.setState("hoverActive", u))), w; + }, R.prototype.transitTo = function(u, w, $) { + var G, K = this, ne = []; + if (mi(u.allValues, function(we, De) { + var $e = K[we]; + if (De != $e && K.defaultState.properties[we] == null && (K.defaultState.properties[we] = $e), De != "__unset") { + var Ke = { from: $e, to: De, property: we }; + ne.push(Ke); + } + }), ne.length > 0 && ((G = this.animate(ne, w, $)) && !G.isFinished() ? this._disposers.push(G.events.on("animationended", function() { + K.dispatchImmediately("transitionended"); + })) : this.dispatchImmediately("transitionended")), u.filters.length > 0) { + var ue = []; + er(u.filters.iterator(), function(we) { + var De = we.clone(); + ue.push(De); + var $e = []; + er(K.filters.iterator(), function(Ke) { + Ke.className == De.className && (ah(K.defaultState.filters.iterator(), function(Ze) { + return Ze.className === De.className; + }) || K.defaultState.filters.push(Ke), mi(De.properties, function(Ze, pt) { + var Vt = Ke.properties[Ze]; + Vt != pt && $e.push({ property: Ze, from: Vt, to: pt }); + })); + }), De.animate($e, w, $); + }), this.filters.clear(), this.filters.pushAll(ue); + } + return G; + }, R.prototype.isInTransition = function() { + return this.animations.length > 0; + }, Object.defineProperty(R.prototype, "isHover", { get: function() { + return !!this.isInteractive() && this.interactions.isHover; + }, set: function(u) { + (u = Tt(u)) !== this.isHover && this.isInteractive() && (this.interactions.isHover = u, u ? this.handleOver() : (this.interactions.isRealHover = !1, this.handleOut())); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isDragged", { get: function() { + return this._isDragged; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isResized", { get: function() { + return this._isResized; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isDown", { get: function() { + return !!this.isInteractive() && this.interactions.isDown; + }, set: function(u) { + u = Tt(u), this.isInteractive() && this.isDown != u && (this.interactions.isDown = u, u ? this.handleDown() : this.handleUp()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isFocused", { get: function() { + return !!this.isInteractive() && this.interactions.isFocused; + }, set: function(u) { + u = Tt(u), this.focusable && this.isFocused != u && this.isInteractive() && (this.interactions.isFocused = u, u === !0 ? this.handleFocus() : this.handleBlur()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isActive", { get: function() { + return this._isActive; + }, set: function(u) { + this.setActive(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setActive = function(u) { + u = Tt(u), this._isActive !== u && (this._isActive = u, u && this.states.hasKey("active") ? (this.setState("active"), this.isHover && this.states.hasKey("hoverActive") && this.setState("hoverActive")) : this.applyCurrentState(), this.dispatchImmediately("toggled")); + }, Object.defineProperty(R.prototype, "disabled", { get: function() { + var u = this.getPropertyValue("disabled"); + return Ee(u) ? u : this.virtualParent ? this.virtualParent.disabled : !!this._parent && this._parent.disabled; + }, set: function(u) { + this.setDisabled(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + if (u = Tt(u), this.getPropertyValue("disabled") != u) { + if (this.setPropertyValue("disabled", u, !0), u) + this.parent = this._parent, this.removeFromInvalids(), this.group.attr({ display: "none" }), this.dispatch("disabled"); + else { + if (this._parent) { + var w = this._parent.element; + w.hasChild(this.group) || w.add(this.group); + } + this instanceof Qn ? (this.deepInvalidate(), this._background && this._background.invalidate()) : this.invalidate(), this.__disabled || this.removeSVGAttribute("display"), this.dispatch("enabled"); + } + return this.dispatch("transformed"), qo.requestFrame(), !0; + } + return !1; + }, Object.defineProperty(R.prototype, "__disabled", { get: function() { + return this._internalDisabled; + }, set: function(u) { + this._internalDisabled != u && (this._internalDisabled = u, this._updateDisabled = !0, this.invalidatePosition(), u || this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "numberFormatter", { get: function() { + return this._numberFormatter ? this._numberFormatter : this.virtualParent ? this.virtualParent.numberFormatter : this._parent ? this._parent.numberFormatter : (this._numberFormatter = new sA(), this._numberFormatter.language = this.language, this.numberFormatter); + }, set: function(u) { + this._numberFormatter = u, this._numberFormatter.language = this.language; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateFormatter", { get: function() { + return this._dateFormatter ? this._dateFormatter : this.virtualParent ? this.virtualParent.dateFormatter : this._parent ? this._parent.dateFormatter : (this._dateFormatter = new OC(), this._dateFormatter.language = this.language, this.dateFormatter); + }, set: function(u) { + this._dateFormatter = u, this._dateFormatter.language = this.language; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "durationFormatter", { get: function() { + return this._durationFormatter ? this._durationFormatter : this.virtualParent ? this.virtualParent.durationFormatter : this._parent ? this._parent.durationFormatter : (this._durationFormatter = new J3(), this._durationFormatter.language = this.language, this.durationFormatter); + }, set: function(u) { + this._durationFormatter = u, this._durationFormatter.language = this.language; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "language", { get: function() { + var u = this._language.get(); + return u || (this.virtualParent ? this.virtualParent.language : this._parent ? this._parent.language : (u = new Yv(), this.language = u, u)); + }, set: function(u) { + var w = this; + this._language.get() !== u && this._language.set(u, u.events.on("localechanged", function($) { + if (w._numberFormatter && (w._numberFormatter.language = w.language), w._dateFormatter && (w._dateFormatter.language = w.language), w._durationFormatter && (w._durationFormatter.language = w.language), w._exporting.get()) { + var G = w._exporting.get(); + G.numberFormatter.language = w.language, G.dateFormatter.language = w.language, G.durationFormatter.language = w.language, G.language = w.language; + } + w instanceof Qn && w.deepInvalidate(); + })); + }, enumerable: !0, configurable: !0 }), R.prototype.populateString = function(u, w) { + if (Ee(u)) { + u = Mt(u); + var $ = (u = Xv().escape(u)).match(/\{([^}]+)\}/g), G = void 0; + if ($) + for (G = 0; G < $.length; G++) { + var K = $[G].replace(/\{([^}]+)\}/, "$1"), ne = this.getTagValue(K, "", w); + Ee(ne) || (ne = ""), u = u.split($[G]).join(ne); + } + u = Xv().unescape(u); + } else + u = ""; + return this._adapterO ? this._adapterO.apply("populateString", u) : u; + }, R.prototype.getTagValue = function(u, w, $) { + var G; + Ee($) || ($ = this.dataItem); + for (var K, ne = [], ue = /([^.]+)\(([^)]*)\)|([^.]+)/g; (K = ue.exec(u)) !== null; ) + if (K[3]) + ne.push({ prop: K[3] }); + else { + var we = []; + if (pf(K[2]) != "") + for (var De = /'([^']*)'|"([^"]*)"|([0-9\-]+)/g, $e = void 0; ($e = De.exec(K[2])) !== null; ) + we.push($e[1] || $e[2] || $e[3]); + ne.push({ method: K[1], params: we }); + } + if ($) { + Ee(G = this.getTagValueFromObject(ne, $.values)) && !ct(G) || (G = this.getTagValueFromObject(ne, $)); + var Ke = $.dataContext; + !Ee(G) && Ke && (Ee(G = this.getTagValueFromObject(ne, $.dataContext)) || (G = this.getTagValueFromObject([{ prop: u }], Ke)), !Ee(G) && Ke.dataContext && (G = this.getTagValueFromObject(ne, Ke.dataContext))), !Ee(G) && $.component && $.component.dataItem !== $ && (G = $.component.getTagValue(u, w)); + } + return Ee(G) || (G = this.getTagValueFromObject(ne, this.populateStringFrom || this)), !Ee(G) && this._parent && (G = this._parent.getTagValue(u, w)), G; + }, R.prototype.getTagValueFromObject = function(u, w, $) { + for (var G = w, K = !1, ne = 0, ue = u.length; ne < ue; ne++) { + var we = u[ne]; + if (we.prop) { + if (!Ee(G = G[we.prop])) + return; + } else + switch (we.method) { + case "formatNumber": + var De = Ot(G); + Ee(De) && (G = this.numberFormatter.format(De, $ || we.params[0] || void 0), K = !0); + break; + case "formatDate": + var $e = void 0; + if (!wt($e = st(G) ? this.dateFormatter.parse(G) : zg(G)) || Pe($e.getTime())) + return; + Ee($e) && (G = this.dateFormatter.format($e, $ || we.params[0] || void 0), K = !0); + break; + case "formatDuration": + var Ke = Ot(G); + Ee(Ke) && (G = this.durationFormatter.format(Ke, $ || we.params[0] || void 0, we.params[1] || void 0), K = !0); + break; + case "urlEncode": + case "encodeURIComponent": + G = encodeURIComponent(G); + break; + default: + G[we.method] && G[we.method].apply(this, we.params); + } + } + if (!K) { + var Ze = [{ method: "", params: $ }]; + if (Ee($)) { + var pt = co($); + pt === zi ? Ze[0].method = "formatNumber" : pt === ar ? Ze[0].method = "formatDate" : pt === tr && (Ze[0].method = "formatDuration"); + } else + le(G) ? (Ze[0].method = "formatNumber", Ze[0].params = "") : wt(G) && (Ze[0].method = "formatDate", Ze[0].params = ""); + Ze[0].method && (G = this.getTagValueFromObject(Ze, G)); + } + return G; + }, Object.defineProperty(R.prototype, "dataItem", { get: function() { + if (!this._dataItem) { + if (this.virtualParent) + return this.virtualParent.dataItem; + if (this._parent) + return this._parent.dataItem; + } + return this._dataItem; + }, set: function(u) { + this.setDataItem(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setDataItem = function(u) { + var w = this; + if (this._dataItem != u) { + if (this._dataItem = u, u) { + if (this.configField) { + var $ = u.dataContext; + $ && (this.config = $[this.configField], !this.config && $.dataContext && (this.config = $.dataContext[this.configField])); + } + var G = u.dataContext; + if (G) { + var K = G.dataContext; + mi(this.propertyFields, function(ne, ue) { + if (Ee(G[ue])) + w[ne] = G[ue]; + else if (K) { + var we = K[ue]; + Ee(we) && (w[ne] = we); + } + }); + } + } + this.invalidate(); + } + }, R.prototype.getPropertyValue = function(u) { + var w = this.properties[u]; + return this._isTemplate || (this._adapterO && (w = this._adapterO.apply(u, w)), w = vh.applyAll(this, u, w)), w; + }, R.prototype.setColorProperty = function(u, w, $) { + var G = this.properties[u]; + return !(w instanceof Ie && G instanceof Ie && w.toString() == G.toString()) && this.setPropertyValue(u, w, $); + }, R.prototype.setPercentProperty = function(u, w, $, G, K, ne) { + if (le(w = nt(w))) + return le(K) && (w = He(w, K, ne)), this.setPropertyValue(u, w, $, G); + var ue = this.properties[u]; + return !(w instanceof J && ue instanceof J && w.value == ue.value) && this.setPropertyValue(u, w, $, G); + }, R.prototype.setPropertyValue = function(u, w, $, G) { + if (this.properties[u] !== w && !this.isDisposed()) { + if (this.properties[u] = w, this.events.isEnabled("propertychanged")) { + var K = { type: "propertychanged", target: this, property: u }; + this.events.dispatchImmediately("propertychanged", K); + } + if ($ && this.invalidate(), G && this.invalidatePosition(), this.applyOnClones) + for (var ne = this.clones.values, ue = ne.length, we = 0; we < ue; ++we) { + var De = ne[we]; + De.isDisposed() || (De[u] = w); + } + return !0; + } + return !1; + }, R.prototype.bind = function(u, w, $, G) { + var K = this; + $ === void 0 && ($ = u), Ee(this._bindings[u]) && this._bindings[u].dispose(), this[u] = w[$], this._bindings[u] = w.events.on("propertychanged", function(ne) { + if (ne.property === $) { + var ue = w[$]; + G && (ue = G(ue)), K[u] = ue; + } + }); + }, R.prototype.observe = function(u, w, $, G) { + var K = this; + return new kn(rr(Ki(u), function(ne) { + return K.events.on("propertychanged", function(ue) { + ue.property === ne && w.call($, ue); + }, $, G); + })); + }, R.prototype.applyAccessibility = function() { + var u = this.readerTitle, w = this.readerDescription, $ = this.role, G = this.readerHidden, K = this.readerChecked, ne = this.readerControls, ue = this.readerLive, we = this.readerOrientation, De = this.readerValueNow, $e = this.readerValueText, Ke = [], Ze = [], pt = this.readerLabelledBy; + pt && Ke.push(pt); + var Vt = this.readerDescribedBy; + if (Vt && Ze.push(Vt), u) + if (Ke.length || this.showSystemTooltip) { + var Yt = this.titleElement, ci = this.uid + "-title"; + Yt.node.textContent != u && (Yt.node.textContent = u, Yt.attr({ id: ci })), Ke.push(ci); + } else + this._titleElement && (this.group.removeElement(this._titleElement), this._titleElement = void 0), this.setSVGAttribute({ "aria-label": u }); + else + this.removeSVGAttribute("aria-label"), this._titleElement && (this.group.removeElement(this._titleElement), this._titleElement = void 0); + if (w) { + var ai = this.descriptionElement, Gi = this.uid + "-description"; + ai.node.textContent != w && (ai.node.textContent = w, ai.attr({ id: Gi })), Ze.push(Gi); + } else + this._descriptionElement && (this.group.removeElement(this._descriptionElement), this._descriptionElement = void 0); + Ke.length ? this.setSVGAttribute({ "aria-labelledby": Ke.join(" ") }) : this.removeSVGAttribute("aria-labelledby"), Ze.length ? this.setSVGAttribute({ "aria-describedby": Ze.join(" ") }) : this.removeSVGAttribute("aria-describedby"), $ ? this.setSVGAttribute({ role: $ }) : this.removeSVGAttribute("role"), G ? this.setSVGAttribute({ "aria-hidden": "true" }) : this.removeSVGAttribute("aria-hidden"), K ? this.setSVGAttribute({ "aria-checked": "true" }) : K === !1 ? this.setSVGAttribute({ "aria-checked": "false" }) : this.removeSVGAttribute("aria-checked"), ne ? this.setSVGAttribute({ "aria-controls": ne }) : this.removeSVGAttribute("aria-controls"), ue ? this.setSVGAttribute({ "aria-live": ue }) : this.removeSVGAttribute("aria-live"), we ? this.setSVGAttribute({ "aria-orientation": we }) : this.removeSVGAttribute("aria-orientation"), De ? this.setSVGAttribute({ "aria-valuenow": De }) : this.removeSVGAttribute("aria-valuenow"), $e ? this.setSVGAttribute({ "aria-valuetext": $e }) : this.removeSVGAttribute("aria-valuetext"); + }, Object.defineProperty(R.prototype, "readerTitle", { get: function() { + var u = this.getPropertyValue("readerTitle"); + return Ee(u) && this.dataItem ? this.populateString(u) : u; + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerTitle", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerDescription", { get: function() { + var u = this.getPropertyValue("readerDescription"); + return Ee(u) && this.dataItem ? this.populateString(u) : this.getPropertyValue("readerDescription"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerDescription", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "role", { get: function() { + return this.getPropertyValue("role"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("role", u) && (this.applyAccessibility(), u == "slider" && (this.setSVGAttribute({ "aria-valuemin": "0" }), this.setSVGAttribute({ "aria-valuemax": "100" }))); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerHidden", { get: function() { + return this.getPropertyValue("readerHidden"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("readerHidden", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerChecked", { get: function() { + return this.getPropertyValue("readerChecked"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("readerChecked", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerControls", { get: function() { + return this.getPropertyValue("readerControls"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerControls", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerLive", { get: function() { + return this.getPropertyValue("readerLive"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerLive", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerLabelledBy", { get: function() { + return this.getPropertyValue("readerLabelledBy"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerLabelledBy", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerDescribedBy", { get: function() { + return this.getPropertyValue("readerDescribedBy"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerDescribedBy", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerOrientation", { get: function() { + return this.getPropertyValue("readerOrientation"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerOrientation", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerValueNow", { get: function() { + return this.getPropertyValue("readerValueNow"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerValueNow", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "readerValueText", { get: function() { + return this.getPropertyValue("readerValueText"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerValueText", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "keyboardOptions", { get: function() { + if (!this.interactions.keyboardOptions) { + if (this.virtualParent) + return this.virtualParent.keyboardOptions; + if (this._parent) + return this._parent.keyboardOptions; + } + return this.interactions.keyboardOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "mouseOptions", { get: function() { + if (!this.interactions.mouseOptions) { + if (this.virtualParent) + return this.virtualParent.mouseOptions; + if (this._parent) + return this._parent.mouseOptions; + } + return this.interactions.mouseOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "interactions", { get: function() { + if (!this._interaction) { + var u = Gs().getInteraction(this.dom); + this._interaction = u, this._interaction.clickable = this.clickable, this._interaction.hoverable = this.hoverable, this._interaction.trackable = this.trackable, this._interaction.draggable = this.draggable, this._interaction.swipeable = this.swipeable, this._interaction.resizable = this.resizable, this._interaction.wheelable = this.wheelable, this._interaction.contextMenuDisabled = this.contextMenuDisabled, this._interaction.inert = this.inert, this._interaction.sprite = this, this._disposers.push(this._interaction); + } + return this._interaction; + }, enumerable: !0, configurable: !0 }), R.prototype.isInteractive = function() { + return !!this._interaction; + }, Object.defineProperty(R.prototype, "focusable", { get: function() { + return this.getPropertyValue("focusable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("focusable", u) && (u || this.isInteractive()) && (this.interactions.focusable = u, u ? (this.setSVGAttribute({ focusable: u }), Ee(this._tabindex) || (this.tabindex = 0)) : (this.removeSVGAttribute("focusable"), this.tabindex = void 0), this.interactions.setEventDisposer("sprite-focusable", u, function() { + return new kn([w.events.on("blur", w.handleBlur, w, !1), w.events.on("focus", w.handleFocus, w, !1)]); + })); + }, enumerable: !0, configurable: !0 }), R.prototype.handleFocus = function(u) { + this.focusable && (this.topParent && (this.topParent.hasFocused = !0, this.topParent.focusedElement = this), this.focusFilter && this.filters.push(this.focusFilter), this.hoverOnFocus && (this.isHover = !0, this.handleOver())); + }, R.prototype.handleBlur = function(u) { + this.focusable && (this.topParent && (this.topParent.hasFocused = !1, this.topParent.focusedElement = void 0), this.focusFilter && this.filters.removeValue(this.focusFilter), this.hoverOnFocus && (this.isHover = !1, this.handleOut())); + }, Object.defineProperty(R.prototype, "focusFilter", { get: function() { + return this._focusFilter || (this.virtualParent ? this.virtualParent.focusFilter : this._parent ? this._parent.focusFilter : void 0); + }, set: function(u) { + this._focusFilter = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hoverOnFocus", { get: function() { + return this.getPropertyValue("hoverOnFocus"); + }, set: function(u) { + u !== this.hoverOnFocus && this.setPropertyValue("hoverOnFocus", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tabindex", { get: function() { + var u = this._tabindex; + return u ?? (this.virtualParent ? this.virtualParent.tabindex : this._parent ? this._parent.tabindex : void 0); + }, set: function(u) { + u = It(u), this.setPropertyValue("tabindex", u) && le(u) && (this.interactions.tabindex = u, this.setSVGAttribute({ tabindex: u }), this._tabindex = u, this.focusable = !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inertiaOptions", { get: function() { + return !this.interactions.inertiaOptions && this._parent ? this._parent.inertiaOptions : this.interactions.inertiaOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "draggable", { get: function() { + return this.getPropertyValue("draggable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("draggable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.draggable = u, this.interactions.setEventDisposer("sprite-draggable", u, function() { + return new kn([w.events.on("down", w.handleDown, w, !1), w.events.on("dragstart", w.handleDragStart, w, !1), w.events.on("drag", w.handleDragMove, w, !1), w.events.on("dragstop", w.handleDragStop, w, !1)]); + })); + }, enumerable: !0, configurable: !0 }), R.prototype.handleDragStart = function(u) { + this.interactions.isTouchProtected && u.touch || (this.interactions.originalPosition = { x: this.pixelX, y: this.pixelY }, this._isDragged = !0, this.hideTooltip(0)); + }, R.prototype.dragStart = function(u) { + this._isDragged = !0, Gs().dragStart(this.interactions, u); + }, R.prototype.handleDragStop = function(u) { + this.interactions.isTouchProtected && u.touch || (this._isDragged = !1, this.showTooltip(), this.interactions.originalPosition = void 0); + }, R.prototype.dragStop = function(u, w) { + this._isDragged = !1, Gs().dragStop(this.interactions, u, w); + }, R.prototype.handleDragMove = function(u) { + if (!this.interactions.isTouchProtected || !u.touch) { + var w = this.interactions.originalPosition; + if (w && this._isDragged) { + var $ = this._parent.globalScale * this.svgContainer.cssScale; + this.moveTo({ x: w.x + u.shift.x / $, y: w.y + u.shift.y / $ }, void 0, void 0, !0); + } + this.dispatchImmediately("dragged", u); + } + }, Object.defineProperty(R.prototype, "inert", { get: function() { + return this.getPropertyValue("inert"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("inert", u) && (u || this.isInteractive()) && (this.interactions.inert = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hoverOptions", { get: function() { + if (!this.interactions.hoverOptions) { + if (this.virtualParent) + return this.virtualParent.hoverOptions; + if (this._parent) + return this._parent.hoverOptions; + } + return this.interactions.hoverOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hoverable", { get: function() { + return this.getPropertyValue("hoverable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("hoverable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.hoverable = u, this.interactions.setEventDisposer("sprite-hoverable", u, function() { + return new kn([w.events.on("over", w.handleOver, w, !1), w.events.on("out", w.handleOut, w, !1)]); + })); + }, enumerable: !0, configurable: !0 }), R.prototype.handleOver = function(u) { + if (this._outTimeout && this._outTimeout.dispose(), this.isHover) { + this.states.hasKey("hover") && (this.isHidden || this.applyCurrentState()); + var w = void 0; + u && u.pointer && (w = Xl(u.pointer.point, this.svgContainer.SVGContainer, this.svgContainer.cssScale)), this.showTooltipOn == "hover" && this.showTooltip(w); + } else + this.showTooltipOn == "hover" && this.hideTooltip(), !this.isHidden && this.states.hasKey("hover") && this.applyCurrentState(); + }, R.prototype.handleOut = function(u) { + var w = this; + this.tooltip && this.tooltip.targetSprite == this && this.tooltip.keepTargetHover ? this._outTimeout = this.setTimeout(function() { + w.tooltip.isHover || (w.tooltip.targetSprite == w && w.hideTooltip(), w._outTimeout = w.setTimeout(w.handleOutReal.bind(w), w.rollOutDelay)); + }, 10) : (this.showTooltipOn == "hover" && this.hideTooltip(), this._outTimeout = this.setTimeout(this.handleOutReal.bind(this), this.rollOutDelay)); + }, R.prototype.handleOutReal = function() { + this.isHidden || this.isHiding || !this.states.hasKey("hover") || this.applyCurrentState(); + }, Object.defineProperty(R.prototype, "hitOptions", { get: function() { + if (!this.interactions.hitOptions) { + if (this.virtualParent) + return this.virtualParent.hitOptions; + if (this._parent) + return this._parent.hitOptions; + } + return this.interactions.hitOptions; + }, enumerable: !0, configurable: !0 }), R.prototype.handleDown = function(u) { + this.interactions.downPointers.length === 1 && (this.interactions.originalPosition = { x: this.pixelX, y: this.pixelY }, this.interactions.originalAngle = this.rotation, this.interactions.originalScale = this.scale, this.states.hasKey("down") && this.setState("down")); + }, R.prototype.handleUp = function(u) { + var w = this; + this._isResized = !1, this.states.hasKey("down") && this.applyCurrentState(), this.showTooltipOn == "hit" && (this.updateTooltipPosition(u.pointer ? u.pointer.point : void 0), this._disposers.push(hi.events.once("exitframe", function() { + w.showTooltip(); + })), this._disposers.push(Gs().body.events.once("down", function($) { + w.hideTooltip(); + }))); + }, Object.defineProperty(R.prototype, "clickable", { get: function() { + return this.getPropertyValue("clickable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("clickable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.clickable = u, this.interactions.setEventDisposer("sprite-clickable", u, function() { + return new kn([w.events.on("down", w.handleDown, w, !1), w.events.on("up", w.handleUp, w, !1)]); + })); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "togglable", { get: function() { + return this.getPropertyValue("togglable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("togglable", u) && (u || this.isInteractive()) && this.interactions.setEventDisposer("sprite-togglable", u, function() { + return w.events.on("hit", w.handleToggle, w, !1); + }); + }, enumerable: !0, configurable: !0 }), R.prototype.handleToggle = function(u) { + this.isActive = !this.isActive; + }, Object.defineProperty(R.prototype, "contextMenuDisabled", { get: function() { + return this.getPropertyValue("contextMenuDisabled"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("contextMenuDisabled", u) && (this.interactions.contextMenuDisabled = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "url", { get: function() { + return this.getPropertyValue("url"); + }, set: function(u) { + this.setPropertyValue("url", u) && (this._urlDisposer && this._urlDisposer.dispose(), Ks(u) && (this._urlDisposer = this.events.on("hit", this.urlHandler, this, !1), this.clickable = !0, this.cursorOverStyle = vl.pointer)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "baseId", { get: function() { + return !this._baseId && this._parent && (this.baseId = this._parent.baseId), this._baseId; + }, set: function(u) { + this.setBaseId(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setBaseId = function(u) { + u != this._baseId && (this.invalid && (this.invalid = !1, hi.removeFromInvalidSprites(this), this.invalidate()), this._baseId = u); + }, Object.defineProperty(R.prototype, "baseSprite", { get: function() { + return this.isBaseSprite ? this : this._parent ? this._parent.baseSprite : void 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "urlTarget", { get: function() { + return this.getPropertyValue("urlTarget"); + }, set: function(u) { + this.setPropertyValue("urlTarget", u); + }, enumerable: !0, configurable: !0 }), R.prototype.urlHandler = function(u) { + if (Ks(this.url)) { + var w = this.populateString(this.url); + this.urlTarget === "_self" ? window.location.href = w : window.open(w, this.urlTarget); + } + }, Object.defineProperty(R.prototype, "swipeOptions", { get: function() { + if (!this.interactions.swipeOptions) { + if (this.virtualParent) + return this.virtualParent.swipeOptions; + if (this._parent) + return this._parent.swipeOptions; + } + return this.interactions.swipeOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "swipeable", { get: function() { + return this.getPropertyValue("swipeable"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("swipeable", u) && (this.applyCursorStyle(), (u || this.isInteractive()) && (this.interactions.swipeable = u)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "trackable", { get: function() { + return this.getPropertyValue("trackable"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("trackable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.trackable = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wheelable", { get: function() { + return this.getPropertyValue("wheelable"); + }, set: function(u) { + this.setPropertyValue("wheelable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.wheelable = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "resizable", { get: function() { + return this.getPropertyValue("resizable"); + }, set: function(u) { + var w = this; + u = Tt(u), this.setPropertyValue("resizable", u) && (u || this.isInteractive()) && (this.applyCursorStyle(), this.interactions.resizable = u, this.interactions.setEventDisposer("sprite-resizable", u, function() { + return new kn([w.events.on("down", w.handleDown, w, !1), w.events.on("resize", w.handleResize, w, !1)]); + })); + }, enumerable: !0, configurable: !0 }), R.prototype.handleResize = function(u) { + if ((!this.interactions.isTouchProtected || !u.touch) && (this._isResized = !0, this.scale = this.interactions.originalScale * u.scale, this.validatePosition(), this.draggable || this.dragWhileResize)) { + this._isDragged = !1; + var w = Z(Xl(u.point1, this.htmlContainer, this.svgContainer.cssScale), Xl(u.point2, this.htmlContainer, this.svgContainer.cssScale)), $ = O1(u.startPoint1, this._parent), G = O1(u.startPoint2, this._parent), K = this.interactions.originalPosition, ne = this.interactions.originalScale; + if (K) { + var ue = Z({ x: ($.x - K.x) / ne, y: ($.y - K.y) / ne }, { x: (G.x - K.x) / ne, y: (G.y - K.y) / ne }), we = ff(w, this._parent); + this.moveTo({ x: we.x - ue.x * this.scale, y: we.y - ue.y * this.scale }, void 0, void 0, !0); + } + } + }, Object.defineProperty(R.prototype, "cursorOptions", { get: function() { + if (!this.interactions.cursorOptions) { + if (this.virtualParent) + return this.virtualParent.cursorOptions; + if (this._parent) + return this._parent.cursorOptions; + } + return this.interactions.cursorOptions; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cursorOverStyle", { set: function(u) { + this.cursorOptions.overStyle || (this.interactions.cursorOptions = { defaultStyle: this.cursorOptions.defaultStyle }), this.cursorOptions.overStyle = u, Gs().applyCursorOverStyle(this.interactions); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cursorDownStyle", { set: function(u) { + this.cursorOptions.downStyle = u; + }, enumerable: !0, configurable: !0 }), R.prototype.applyCursorStyle = function() { + }, Object.defineProperty(R.prototype, "interactionsEnabled", { get: function() { + return this.getPropertyValue("interactionsEnabled") !== !1 && (this.virtualParent ? this.virtualParent.interactionsEnabled : !this._parent || this._parent.interactionsEnabled); + }, set: function(u) { + if (u = Tt(u), this.setPropertyValue("interactionsEnabled", u)) { + var w = null; + u ? this.group.node.style.pointerEvents = "" : w = "none", this.group.node.style.pointerEvents = w; + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "exporting", { get: function() { + return this.getExporting(); + }, set: function(u) { + this._exporting.set(u, u); + }, enumerable: !0, configurable: !0 }), R.prototype.getExporting = function() { + var u = this._exporting.get(); + return u || (!this.isStandaloneInstance && this._parent ? this._parent.exporting : ((u = new fg(this.svgContainer.SVGContainer)).sprite = this, u.language = this.language, u.numberFormatter = this.numberFormatter, u.dateFormatter = this.dateFormatter, u.durationFormatter = this.durationFormatter, this._exporting.set(u, u), u)); + }, Object.defineProperty(R.prototype, "exportable", { get: function() { + return this._exportable; + }, set: function(u) { + var w = this.svgContainer; + this._exportable = u, w && (u ? ki(w.nonExportableSprites, this) : Ri(w.nonExportableSprites, this) == -1 && w.nonExportableSprites.push(this)); + }, enumerable: !0, configurable: !0 }), R.prototype.modalPrefix = function(u) { + return zd.classNamePrefix + u; + }, Object.defineProperty(R.prototype, "modal", { get: function() { + var u = this.svgContainer; + if (u) { + var w = u.modal; + return w.adapter.has("classPrefix", this.modalPrefix) || w.adapter.add("classPrefix", this.modalPrefix), w; + } + }, enumerable: !0, configurable: !0 }), R.prototype.openModal = function(u, w) { + var $ = this.svgContainer; + if ($) + return $.openModal(u, w); + }, R.prototype.closeModal = function() { + var u = this.svgContainer; + u && u.closeModal(); + }, Object.defineProperty(R.prototype, "popups", { get: function() { + var u = this.svgContainer; + if (u) { + var w = u.popups; + return w.template.sprite = this, w.template.adapter.has("classPrefix", this.modalPrefix) || w.template.adapter.add("classPrefix", this.modalPrefix), w; + } + }, enumerable: !0, configurable: !0 }), R.prototype.openPopup = function(u, w) { + var $ = this.svgContainer; + if ($) + return $.openPopup(u, w); + }, R.prototype.closeAllPopups = function() { + var u = this.svgContainer; + u && u.closeAllPopups(); + }, Object.defineProperty(R.prototype, "x", { get: function() { + return this.getPropertyValue("x"); + }, set: function(u) { + this.isDragged || this.setPercentProperty("x", u, !1, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelX", { get: function() { + var u = mt(this.getPixelX(this.x), this.minX, this.maxX); + return this._adapterO ? this._adapterO.apply("pixelX", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeX", { get: function() { + return this._adapterO ? this._adapterO.apply("relativeX", this.getRelativeX(this.x)) : this.getRelativeX(this.x); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minX", { get: function() { + return this.getPropertyValue("minX"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("minX", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxX", { get: function() { + return this.getPropertyValue("maxX"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("maxX", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y", { get: function() { + return this.getPropertyValue("y"); + }, set: function(u) { + this.isDragged || this.setPercentProperty("y", u, !1, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelY", { get: function() { + var u = mt(this.getPixelY(this.y), this.minY, this.maxY); + return this._adapterO ? this._adapterO.apply("pixelY", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeY", { get: function() { + return this._adapterO ? this._adapterO.apply("relativeY", this.getRelativeX(this.y)) : this.getRelativeX(this.y); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minY", { get: function() { + return this.getPropertyValue("minY"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("minY", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxY", { get: function() { + return this.getPropertyValue("maxY"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("maxY", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dx", { get: function() { + return this.getPropertyValue("dx"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("dx", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dy", { get: function() { + return this.getPropertyValue("dy"); + }, set: function(u) { + le(u) && (u = He(u, this._positionPrecision, !0), this.setPropertyValue("dy", u, !1, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rotation", { get: function() { + return this.getPropertyValue("rotation"); + }, set: function(u) { + le(u = It(u)) || (u = 0), this.setPropertyValue("rotation", u, !1, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "align", { get: function() { + return this.getPropertyValue("align"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("align", u) && this._parent && this._parent.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "valign", { get: function() { + return this.getPropertyValue("valign"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("valign", u) && this._parent && this._parent.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "horizontalCenter", { get: function() { + return this.getPropertyValue("horizontalCenter"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("horizontalCenter", u) && this.updateCenter(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "verticalCenter", { get: function() { + return this.getPropertyValue("verticalCenter"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("verticalCenter", u) && this.updateCenter(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxWidth", { get: function() { + var u = this.getPropertyValue("maxWidth"); + if (!le(u) && this._parent) { + var w = this._parent.maxWidth; + return this._parent.layout != "absolute" && this.align != "none" && this.align != null && (w = w - this.pixelMarginLeft - this.pixelMarginRight), w; + } + return u; + }, set: function(u) { + this.setMaxWidth(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setMaxWidth = function(u) { + var w = this.maxWidth, $ = this.maxHeight; + if (this.setPropertyValue("maxWidth", u)) { + le(this.relativeWidth) && this.invalidate(); + var G = { type: "maxsizechanged", target: this, previousWidth: w, previousHeight: $ }; + this.dispatchImmediately("maxsizechanged", G); + } + }, Object.defineProperty(R.prototype, "maxHeight", { get: function() { + var u = this.getPropertyValue("maxHeight"); + if (!le(u) && this._parent) { + var w = this._parent.maxHeight; + return this._parent.layout != "absolute" && this.valign != "none" && this.valign != null && (w = w - this.pixelMarginTop - this.pixelMarginBottom), w; + } + return u; + }, set: function(u) { + this.setMaxHeight(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setMaxHeight = function(u) { + var w = this.maxWidth, $ = this.maxHeight; + if (this.setPropertyValue("maxHeight", u)) { + le(this.relativeHeight) && this.invalidate(); + var G = { type: "maxsizechanged", target: this, previousWidth: w, previousHeight: $ }; + this.dispatchImmediately("maxsizechanged", G); + } + }, Object.defineProperty(R.prototype, "minWidth", { get: function() { + return this.getPropertyValue("minWidth"); + }, set: function(u) { + this.setPropertyValue("minWidth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minHeight", { get: function() { + return this.getPropertyValue("minHeight"); + }, set: function(u) { + this.setPropertyValue("minHeight", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "width", { get: function() { + return this.getPropertyValue("width"); + }, set: function(u) { + this.setPercentProperty("width", u, !0, !1, this._positionPrecision, !0) && (this.percentWidth = void 0, this.relativeWidth = void 0, u instanceof J ? (this.percentWidth = u.percent, le(this._pixelWidth) && (this.maxWidth = void 0), this._pixelWidth = void 0) : (this._pixelWidth = Number(u), this.maxWidth = this._pixelWidth), this.invalidatePosition()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "height", { get: function() { + return this.getPropertyValue("height"); + }, set: function(u) { + this.setPercentProperty("height", u, !0, !1, this._positionPrecision, !0) && (this.percentHeight = void 0, this._relativeHeight = void 0, u instanceof J ? (this.percentHeight = u.percent, le(this._pixelHeight) && (this.maxHeight = void 0), this._pixelHeight = void 0) : (this._pixelHeight = Number(u), this.maxHeight = this._pixelHeight), this.invalidatePosition()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelWidth", { get: function() { + var u; + u = le(this.percentWidth) ? this.maxWidth : le(this._pixelWidth) ? this._pixelWidth : 0; + var w = this.minWidth; + w != null && u < w && (u = w); + var $ = He(u, this._positionPrecision, !0); + return this._adapterO ? this._adapterO.apply("pixelWidth", $) : $; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelHeight", { get: function() { + var u; + u = le(this.percentHeight) ? this.maxHeight : le(this._pixelHeight) ? this._pixelHeight : 0; + var w = this.minHeight; + w != null && u < w && (u = w); + var $ = He(u, this._positionPrecision, !0); + return this._adapterO ? this._adapterO.apply("pixelHeight", $) : $; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeWidth", { get: function() { + var u = this._relativeWidth; + if (le(u)) + return this._adapterO ? this._adapterO.apply("relativeWidth", u) : u; + }, set: function(u) { + this._relativeWidth != u && (this._relativeWidth = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeHeight", { get: function() { + var u = this._relativeHeight; + if (le(u)) + return this._adapterO ? this._adapterO.apply("relativeHeight", u) : u; + }, set: function(u) { + this._relativeHeight != u && (this._relativeHeight = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "measuredWidth", { get: function() { + return this.disabled || this.__disabled ? 0 : this._adapterO ? this._adapterO.apply("measuredWidth", this._measuredWidth) : this._measuredWidth; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "measuredHeight", { get: function() { + return this.disabled || this.__disabled ? 0 : this._adapterO ? this._adapterO.apply("measuredHeight", this._measuredHeight) : this._measuredHeight; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outerWidth", { get: function() { + var u = this.pixelWidth + this.pixelMarginRight + this.pixelMarginLeft; + return this._adapterO ? this._adapterO.apply("outerWidth", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outerHeight", { get: function() { + var u = this.pixelHeight + this.pixelMarginTop + this.pixelMarginBottom; + return this._adapterO ? this._adapterO.apply("outerHeight", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerWidth", { get: function() { + var u = Math.max(0, this.pixelWidth - this.pixelPaddingRight - this.pixelPaddingLeft); + return this._adapterO ? this._adapterO.apply("innerWidth", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerHeight", { get: function() { + var u = Math.max(0, this.pixelHeight - this.pixelPaddingTop - this.pixelPaddingBottom); + return this._adapterO ? this._adapterO.apply("innerHeight", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "globalScale", { get: function() { + var u = this.scale; + return this._parent && (u *= this._parent.globalScale), this._adapterO ? this._adapterO.apply("globalScale", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "scale", { get: function() { + return this.getPropertyValue("scale"); + }, set: function(u) { + (u = It(u)) < 0 && (u = 0), u != this.getPropertyValue("scale") && (this.setPropertyValue("scale", u, !1, !0), this.handleGlobalScale()); + }, enumerable: !0, configurable: !0 }), R.prototype.margin = function(u, w, $, G) { + return this.marginTop = u, this.marginRight = w, this.marginBottom = $, this.marginLeft = G, this; + }, Object.defineProperty(R.prototype, "marginLeft", { get: function() { + return this.getPropertyValue("marginLeft"); + }, set: function(u) { + this.setPercentProperty("marginLeft", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "marginRight", { get: function() { + return this.getPropertyValue("marginRight"); + }, set: function(u) { + this.setPercentProperty("marginRight", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "marginTop", { get: function() { + return this.getPropertyValue("marginTop"); + }, set: function(u) { + this.setPercentProperty("marginTop", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "marginBottom", { get: function() { + return this.getPropertyValue("marginBottom"); + }, set: function(u) { + this.setPercentProperty("marginBottom", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelMarginRight", { get: function() { + var u = this.getPixelX(this.marginRight); + return this._adapterO ? this._adapterO.apply("pixelMarginRight", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeMarginRight", { get: function() { + var u = this.getRelativeX(this.marginRight); + return this._adapterO ? this._adapterO.apply("relativeMarginRight", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelMarginLeft", { get: function() { + var u = this.getPixelX(this.marginLeft); + return this._adapterO ? this._adapterO.apply("pixelMarginLeft", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeMarginLeft", { get: function() { + var u = this.getRelativeX(this.marginLeft); + return this._adapterO ? this._adapterO.apply("relativeMarginLeft", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelMarginTop", { get: function() { + var u = this.getPixelY(this.marginTop); + return this._adapterO ? this._adapterO.apply("pixelMarginTop", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeMarginTop", { get: function() { + var u = this.getRelativeY(this.marginTop); + return this._adapterO ? this._adapterO.apply("relativeMarginTop", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelMarginBottom", { get: function() { + var u = this.getPixelY(this.marginBottom); + return this._adapterO ? this._adapterO.apply("pixelMarginBottom", u) : u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativeMarginBottom", { get: function() { + var u = this.getRelativeY(this.marginBottom); + return this._adapterO ? this._adapterO.apply("relativeMarginBottom", u) : u; + }, enumerable: !0, configurable: !0 }), R.prototype.padding = function(u, w, $, G) { + return this.paddingTop = u, this.paddingRight = w, this.paddingBottom = $, this.paddingLeft = G, this; + }, Object.defineProperty(R.prototype, "paddingLeft", { get: function() { + return this.getPropertyValue("paddingLeft"); + }, set: function(u) { + this.setPercentProperty("paddingLeft", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paddingRight", { get: function() { + return this.getPropertyValue("paddingRight"); + }, set: function(u) { + this.setPercentProperty("paddingRight", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paddingTop", { get: function() { + return this.getPropertyValue("paddingTop"); + }, set: function(u) { + this.setPercentProperty("paddingTop", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "paddingBottom", { get: function() { + return this.getPropertyValue("paddingBottom"); + }, set: function(u) { + this.setPercentProperty("paddingBottom", u, !0, !0, this._positionPrecision, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelPaddingRight", { get: function() { + return this.getPixelX(this.paddingRight); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativePaddingRight", { get: function() { + return this.getRelativeX(this.paddingRight); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelPaddingLeft", { get: function() { + return this.getPixelX(this.paddingLeft); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativePaddingLeft", { get: function() { + return this.getRelativeX(this.paddingLeft); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelPaddingTop", { get: function() { + return this.getPixelY(this.paddingTop); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativePaddingTop", { get: function() { + return this.getRelativeY(this.paddingTop); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelPaddingBottom", { get: function() { + return this.getPixelY(this.paddingBottom); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "relativePaddingBottom", { get: function() { + return this.getRelativeY(this.paddingBottom); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "path", { get: function() { + return this.getPropertyValue("path"); + }, set: function(u) { + this.setPath(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setPath = function(u) { + return !!this.setPropertyValue("path", u) && (this._adapterO && (u = this._adapterO.apply("path", u)), this._isPath || (this.element && (!this.element.node || this.element.node instanceof SVGPathElement) || (this.element = this.paper.add("path")), this._isPath = !0), Ee(u) ? this.element.attr({ d: u }) : this.element.removeAttr("d"), this.invalidatePosition(), this.inited || this.events.once("inited", this.validatePosition, this, !1), !0); + }, Object.defineProperty(R.prototype, "fillModifier", { get: function() { + return this.getPropertyValue("fillModifier"); + }, set: function(u) { + this.setPropertyValue("fillModifier", u) && this.setFill(this.fill); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeModifier", { get: function() { + return this.getPropertyValue("strokeModifier"); + }, set: function(u) { + this.setPropertyValue("strokeModifier", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fillOpacity", { get: function() { + return this.getPropertyValue("fillOpacity"); + }, set: function(u) { + u = yt(u, 0, 1), this.setPropertyValue("fillOpacity", u) && this.setSVGAttribute({ "fill-opacity": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fill", { get: function() { + return this.getPropertyValue("fill"); + }, set: function(u) { + this.setFill(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setFill = function(u) { + if (ct(u) && !("r" in u) || (u = Et(u)), this.setColorProperty("fill", u) || this.fillModifier) + if (u instanceof Ie && this.fillModifier && (u = this.fillModifier.modify(u)), this.realFill = u, u instanceof Ie) + this.setSVGAttribute({ fill: u.toString() }); + else if (Ee(u)) { + if (u instanceof qv || u instanceof qg || u instanceof Yg) { + var w = u; + w.paper = this.paper, this.setSVGAttribute({ fill: 'url("' + Fs() + w.id + '")' }); + } + } else + this.removeSVGAttribute("fill"); + }, Object.defineProperty(R.prototype, "opacity", { get: function() { + return this.getPropertyValue("opacity"); + }, set: function(u) { + u = yt(u, 0, 1), this.setPropertyValue("opacity", u) && this.setSVGAttribute({ opacity: u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "stroke", { get: function() { + return this.getPropertyValue("stroke"); + }, set: function(u) { + this.setStroke(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setStroke = function(u) { + if (ct(u) && !("r" in u) || (u = Et(u)), this.setColorProperty("stroke", u) || this.strokeModifier) + if (u instanceof Ie && this.strokeModifier && (u = this.strokeModifier.modify(u)), this.realStroke = u, u instanceof Ie) + u.hex == "none" ? this.removeSVGAttribute("stroke") : this.setSVGAttribute({ stroke: u.toString() }); + else if (Ee(u)) { + if (u instanceof qv || u instanceof qg || u instanceof Yg) { + var w = u; + w.paper = this.paper, this.setSVGAttribute({ stroke: 'url("' + Fs() + w.id + '")' }); + } + } else + this.removeSVGAttribute("stroke"); + }, Object.defineProperty(R.prototype, "strokeOpacity", { get: function() { + return this.getPropertyValue("strokeOpacity"); + }, set: function(u) { + u = yt(u, 0, 1), this.setPropertyValue("strokeOpacity", u) && this.setSVGAttribute({ "stroke-opacity": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "nonScalingStroke", { get: function() { + return this.getPropertyValue("nonScalingStroke"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("nonScalingStroke", u) && (this.strokeWidth = this.strokeWidth); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "nonScaling", { get: function() { + return this.getPropertyValue("nonScaling"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("nonScaling", u, !1, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeWidth", { get: function() { + return this.getPropertyValue("strokeWidth"); + }, set: function(u) { + u = It(u), this.setPropertyValue("strokeWidth", u, !0), this.nonScalingStroke && (le(u) || (u = 1), u /= this.globalScale), this.setSVGAttribute({ "stroke-width": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeDasharray", { get: function() { + return this.getPropertyValue("strokeDasharray"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("strokeDasharray", u) && this.setSVGAttribute({ "stroke-dasharray": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeDashoffset", { get: function() { + return this.getPropertyValue("strokeDashoffset"); + }, set: function(u) { + u = It(u), this.setPropertyValue("strokeDashoffset", u) && this.setSVGAttribute({ "stroke-dashoffset": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeLinecap", { get: function() { + return this.getPropertyValue("strokeLinecap"); + }, set: function(u) { + this.setPropertyValue("strokeLinecap", u) && this.setSVGAttribute({ "stroke-linecap": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeLinejoin", { get: function() { + return this.getPropertyValue("strokeLinejoin"); + }, set: function(u) { + this.setPropertyValue("strokeLinejoin", u) && this.setSVGAttribute({ "stroke-linejoin": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "shapeRendering", { get: function() { + return this.getPropertyValue("shapeRendering"); + }, set: function(u) { + u = Nt(u), this.setPropertyValue("shapeRendering", u) && this.setSVGAttribute({ "shape-rendering": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelPerfect", { get: function() { + return this.getPropertyValue("pixelPerfect"); + }, set: function(u) { + u = Tt(u), this._positionPrecision = u ? zd.pixelPerfectPrecision : 3, this.setPropertyValue("pixelPerfect", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rtl", { get: function() { + return Ee(this._rtl) ? this._rtl : !!this._topParent && this._topParent.rtl; + }, set: function(u) { + u = Tt(u), this.isBaseSprite && (this.topParent.rtl = u), this._rtl = u; + }, enumerable: !0, configurable: !0 }), R.prototype.show = function(u) { + return this.showReal(u); + }, R.prototype.showReal = function(u) { + var w = this; + if (!this.preventShow) { + var $, G = this.defaultState.properties; + if (!this.disabled && (this.isHidden || !this.visible || this.isHiding || G.opacity != null && this.opacity < G.opacity && !this.isShowing) && !this.isDisposed()) { + this.invalid && this.validate(), this.positionInvalid && this.validatePosition(), le(u) || (u = this.defaultState.transitionDuration), this._hideAnimation && (this._hideAnimation.kill(), this._hideAnimation = void 0), this._showHideDisposer && this.removeDispose(this._showHideDisposer), this._isHidden = !1, this.isHiding = !1, this.isShowing = !0, ($ = this.applyCurrentState(u)) && !$.isFinished() ? (this._showHideDisposer = $.events.on("animationended", function() { + w.isShowing = !1; + }), this._disposers.push(this._showHideDisposer)) : this.isShowing = !1; + var K = this.defaultState.properties.visible; + Ee(K) || (K = !0), this.visible = K, this.readerHidden = !1, this.dispatchImmediately("shown"); + } + return $; + } + }, R.prototype.hide = function(u) { + return this.hideReal(u); + }, R.prototype.hideReal = function(u) { + var w, $ = this; + if (!this.isHiding && this.visible && !this.isDisposed()) { + this.tooltip && this.tooltip.currentSprite == this && this.hideTooltip(0), this._hideAnimation && (this._hideAnimation.kill(), this._hideAnimation = void 0), this.isShowing = !1, this._showHideDisposer && this.removeDispose(this._showHideDisposer); + var G = this.hiddenState; + G ? (w = this.setState(G, u, void 0)) && !w.isFinished() ? (this._hideAnimation = w, this._showHideDisposer = w.events.on("animationended", function() { + $.isHiding = !1, $._isHidden = !0, G.properties.visible == 0 && ($.visible = !1); + }, this), this._disposers.push(this._showHideDisposer), this._disposers.push(w)) : (this.isHiding = !1, this._isHidden = !0) : (this.visible = !1, this.isHiding = !1, this._isHidden = !0), this.readerHidden = !0, this.dispatchImmediately("hidden"), this.invalidate(); + } + return le(u) || (u = this.hiddenState.transitionDuration), w; + }, Object.defineProperty(R.prototype, "visible", { get: function() { + return this.getVisibility(); + }, set: function(u) { + u = Tt(u), this.setVisibility(u); + }, enumerable: !0, configurable: !0 }), R.prototype.getVisibility = function() { + var u = this.getPropertyValue("visible"); + return Ee(u) || (u = !0), u; + }, R.prototype.setVisibility = function(u) { + if (this.setPropertyValue("visible", u) && (u ? this.group.removeAttr("visibility") : this.group.attr({ visibility: "hidden" }), this.events.isEnabled("visibilitychanged"))) { + var w = { type: "visibilitychanged", target: this, visible: u }; + this.events.dispatchImmediately("visibilitychanged", w); + } + }, Object.defineProperty(R.prototype, "zIndex", { get: function() { + return this.getPropertyValue("zIndex"); + }, set: function(u) { + u = It(u), this.setPropertyValue("zIndex", u) && this.dispatch("zIndexChanged"); + }, enumerable: !0, configurable: !0 }), R.prototype.toFront = function() { + var u = this._parent; + u && u.children.indexOf(this) != u.children.length - 1 && (u.children.moveValue(this, u.children.length - 1), this.dispatch("zIndexChanged")); + }, R.prototype.toBack = function() { + var u = this._parent; + u && u.children.indexOf(this) != 0 && (u.children.moveValue(this, 0), this.dispatch("zIndexChanged")); + }, Object.defineProperty(R.prototype, "userClassName", { get: function() { + return this.getPropertyValue("userClassName"); + }, set: function(u) { + this.setPropertyValue("userClassName", u) && (!u && this.userClassName && this.group.removeClass(this.userClassName), this.setClassName()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltip", { get: function() { + return this._tooltip ? this._tooltip : this.virtualParent ? this.virtualParent.tooltip : this._parent ? this._parent.tooltip : void 0; + }, set: function(u) { + this._tooltip && this.removeDispose(this._tooltip), this._tooltip = u, u && (u.parent = this.tooltipContainer); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipDataItem", { get: function() { + return this._tooltipDataItem || this.dataItem; + }, set: function(u) { + this._tooltipDataItem = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipColorSource", { get: function() { + return this._tooltipColorSource; + }, set: function(u) { + this._tooltipColorSource = u; + }, enumerable: !0, configurable: !0 }), R.prototype.showTooltip = function(u) { + this.showTooltipOn == "always" && !this._tooltip && this.tooltip && (this._tooltip = this.tooltip.clone()), !u && this.tooltipPosition == "pointer" && this.isHover && (u = Xl(Gs().lastPointer.point, this.svgContainer.SVGContainer, this.svgContainer.cssScale)); + for (var w = this; w != null; ) { + if (!w.visible || w.disabled || w.__disabled) + return void (this._tooltip && this._tooltip.visible && this._tooltip.hide(0)); + w = w.parent; + } + if (Ee(this.tooltipText) || Ee(this.tooltipHTML)) { + var $ = this.tooltip, G = this.tooltipDataItem; + if ($) { + $.targetSprite = this; + var K = this, ne = this.tooltipColorSource; + if (($.getStrokeFromObject || $.getFillFromObject) && ne && (ne.isTemplate ? G && jr(G.sprites, function(Ze) { + return Ze.clonedFrom != ne || (K = Ze, !1); + }) : K = ne), $.getStrokeFromObject) { + for (var ue = this.stroke, we = K; we.parent != null && ((ue = we.stroke) == null && (we = we.parent), ue == null); ) + ; + ue instanceof Ie ? $.background.animate({ property: "stroke", to: ue }, $.animationDuration) : $.background.stroke = ue; + } + if ($.dataItem = G, $.label.populateStringFrom = this, $.getFillFromObject) { + var De = this.fill; + for (we = K; we.parent != null; ) + if ((De = we.fill) == null || De instanceof Ie && De.rgb == null) + we = we.parent; + else if (De != null) + break; + De == null && (De = We("#000000")), De instanceof Ie && $.visible ? $.background.animate({ property: "fill", to: De }, $.animationDuration) : $.background.fill = De, $.autoTextColor && De instanceof Ie && ($.label.fill = De.alternative); + } + var $e = ""; + if (this.tooltipHTML && ($.html = this.tooltipHTML, $e = this.tooltipHTML), this.tooltipText && ($.text = this.tooltipText, $e = this.tooltipText), this.updateTooltipPosition(u)) { + if ($.readerDescribedBy = this.uidAttr(), $.label.invalid && $.label.validate(), $e != null && $e != "" && $.label.currentText != "") { + $ && !$.parent && ($.parent = this.tooltipContainer); + var Ke = $.defaultState.transitionDuration; + return Ke <= 0 && (Ke = 1), $.show(Ke), $.currentSprite = this, !0; + } + this.hideTooltip(0); + } else + this.hideTooltip(0); + } + } + return !1; + }, R.prototype.updateTooltipPosition = function(u) { + var w = this; + if (this.tooltipPosition != "pointer") { + var $ = kf({ x: this.getTooltipX(), y: this.getTooltipY() }, this); + return this.pointTooltipTo($); + } + if (this._interactionDisposer && this._interactionDisposer.dispose(), this._interactionDisposer = Gs().body.events.on("track", function(G) { + return w.pointTooltipTo(Xl(G.point, w.svgContainer.SVGContainer, w.svgContainer.cssScale), !0); + }), u) + return this.pointTooltipTo(u, !0); + }, R.prototype.pointTooltipTo = function(u, w) { + var $ = this.tooltip; + return $ && this.topParent && ($.showInViewport || bi(u, { x: 0, y: 0, width: this.topParent.maxWidth, height: this.topParent.maxHeight })) ? ($.pointTo(u, w), !0) : !1; + }, R.prototype.hideTooltip = function(u) { + if (this.showTooltipOn != "always") { + var w = this.tooltip; + w && (w.targetSprite == this && (w.targetSprite = void 0), w.hide(u), this._interactionDisposer && (this._interactionDisposer.dispose(), this._interactionDisposer = void 0)); + } + }, Object.defineProperty(R.prototype, "tooltipHTML", { get: function() { + return this.getPropertyValue("tooltipHTML"); + }, set: function(u) { + u = Nt(u), this.hoverable = !0, this.setPropertyValue("tooltipHTML", u) && this.tooltip && this.tooltip.visible && this.showTooltip(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipText", { get: function() { + return this.getPropertyValue("tooltipText"); + }, set: function(u) { + (u = Nt(u)) && (this.hoverable = !0), this.setPropertyValue("tooltipText", u) && this.tooltip && this.tooltip.visible && this.showTooltip(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipContainer", { get: function() { + return this._tooltipContainer ? this._tooltipContainer : this._parent ? this._parent.tooltipContainer : void 0; + }, set: function(u) { + this._tooltipContainer = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipX", { get: function() { + return this.getTooltipX(); + }, set: function(u) { + this.setPercentProperty("tooltipX", u) && this.tooltip && this.tooltip.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "alwaysShowTooltip", { get: function() { + return this.getPropertyValue("showTooltipOn") == "always"; + }, set: function(u) { + (u = Tt(u)) && (this.showTooltipOn = "always"); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "showTooltipOn", { get: function() { + return this.getPropertyValue("showTooltipOn"); + }, set: function(u) { + this.setPropertyValue("showTooltipOn", u) && (u == "hit" && (this.clickable = !0), this.tooltip && (u == "always" ? this.showTooltip() : this.handleAlwaysShowTooltip())); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipPosition", { get: function() { + return this.getPropertyValue("tooltipPosition"); + }, set: function(u) { + this.setPropertyValue("tooltipPosition", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipY", { get: function() { + return this.getTooltipY(); + }, set: function(u) { + this.setPercentProperty("tooltipY", u) && this.tooltip && this.tooltip.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.getTooltipX = function() { + var u, w = this.getPropertyValue("tooltipX"); + return Ee(w) || (w = ce(50)), le(w) && (u = w), w instanceof J && (u = this.maxLeftSelf + this._measuredWidthSelf * w.value - this.pixelPaddingLeft - this.ex), le(u) || (u = 0), u; + }, R.prototype.getTooltipY = function() { + var u, w = this.getPropertyValue("tooltipY"); + return Ee(w) || (w = ce(50)), le(w) && (u = w), w instanceof J && (u = this.maxTopSelf + this._measuredHeightSelf * w.value - this.pixelPaddingTop - this.ey), le(u) || (u = 0), u; + }, R.prototype.raiseCriticalError = function(u, w) { + this.svgContainer && (this._adapterO ? this.modal.content = this._adapterO.apply("criticalError", u).message : this.modal.content = u.message, w ? this.modal.closable = !0 : this.disabled = !0, this.modal.open()), console.log(u); + }, R.prototype.processConfig = function(u) { + u && (Ee(u.tooltipColorSource) && st(u.tooltipColorSource) && this.map.hasKey(u.tooltipColorSource) && (u.tooltipColorSource = this.map.getKey(u.tooltipColorSource)), Ee(u.cursorOverStyle) && st(u.cursorOverStyle) && (u.cursorOverStyle = this.getCursorStyle(u.cursorOverStyle)), Ee(u.cursorDowntyle) && st(u.cursorDowntyle) && (u.cursorDowntyle = this.getCursorStyle(u.cursorDowntyle)), Ee(u.cursorOptions) && (Ee(u.cursorOptions.overStyle) && st(u.cursorOptions.overStyle) && (u.cursorOptions.overStyle = this.getCursorStyle(u.cursorOptions.overStyle)), Ee(u.cursorOptions.downStyle) && st(u.cursorOptions.downStyle) && (u.cursorOptions.downStyle = this.getCursorStyle(u.cursorOptions.downStyle)))), U.prototype.processConfig.call(this, u), this.processDelayedMap(); + }, R.prototype.getCursorStyle = function(u) { + switch (u) { + case "grab": + return vl.grab; + case "grabbing": + return vl.grabbing; + case "pointer": + return vl.pointer; + case "horizontalResize": + return vl.horizontalResize; + case "verticalResize": + return vl.verticalResize; + default: + return vl.default; + } + }, R.prototype.configOrder = function(u, w) { + return u == w ? 0 : u == "tooltipColorSource" ? 1 : w == "tooltipColorSource" ? -1 : U.prototype.configOrder.call(this, u, w); + }, Object.defineProperty(R.prototype, "isHidden", { get: function() { + return this._isHidden ? this._isHidden : !!this._parent && this._parent.isHidden; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "showOnInit", { get: function() { + return this.getPropertyValue("showOnInit"); + }, set: function(u) { + u = Tt(u), this.setShowOnInit(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setShowOnInit = function(u) { + this.setPropertyValue("showOnInit", u) && (this.isTemplate || (!u || this.inited || this.hidden ? this._showOnInitDisposer && this._showOnInitDisposer.dispose() : (this._showOnInitDisposer = new kn([hi.events.once("enterframe", this.hideInitially, this), this.events.once("beforevalidated", this.hideInitially, this, !1), this.events.on("inited", this.appear, this, !1)]), this._disposers.push(this._showOnInitDisposer)))); + }, R.prototype.hideInitially = function() { + this.isDisposed() || (this.appeared = !1, this.inited || this.hide(0)); + }, R.prototype.appear = function() { + var u = this; + if (this.appeared = !1, this.hidden || this.isHidden || this.hide(0), this.hidden) + this.appeared = !0, this.dispatch("appeared"); + else { + var w = this.show(); + w && !w.isFinished() ? this.addDisposer(w.events.on("animationended", function() { + u.appeared = !0, u.dispatch("appeared"); + })) : (this.appeared = !0, this.dispatch("appeared")); + } + }, Object.defineProperty(R.prototype, "hidden", { get: function() { + return this.getPropertyValue("hidden"); + }, set: function(u) { + u = Tt(u), this.setPropertyValue("hidden", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bbox", { get: function() { + return this.definedBBox ? this.definedBBox : this._bbox; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "plugins", { get: function() { + var u = this; + return this._plugins || (this._plugins = new Hs(), this._disposers.push(this._plugins.events.on("inserted", function(w) { + w.newValue.target = u, w.newValue.init(); + })), this._disposers.push(new Wo(this._plugins))), this._plugins; + }, enumerable: !0, configurable: !0 }), R.prototype._systemUpdate = function(u) { + this.validate(); + }, R.prototype._systemCheckIfValidate = function() { + return !0; + }, R.prototype._systemValidatePositions = function() { + this.validatePosition(); + }, R.prototype._systemValidateLayouts = function() { + }, R; + }(vi); + hi.registeredClasses.Sprite = so; + var MC = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Rectangle", u.element = u.paper.add("rect"), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this._positionPrecision; + this.pixelPerfect && (u = 0); + var w = He(this.innerWidth, u), $ = He(this.innerHeight, u); + this.element.attr({ width: w, height: $ }); + }, R.prototype.measureElement = function() { + }, Object.defineProperty(R.prototype, "bbox", { get: function() { + return this.definedBBox ? this.definedBBox : this.isMeasured ? { x: 0, y: 0, width: this.innerWidth, height: this.innerHeight } : { x: 0, y: 0, width: 0, height: 0 }; + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Rectangle = MC; + var Qn = function(U) { + function R() { + var u = U.call(this) || this; + return u._childrenByLayout = [], u._childrenDisposers = new ha(), u.hasFocused = !1, u.setStateOnSprites = [], u.layoutInvalid = !1, u._absoluteWidth = 0, u._absoluteHeight = 0, u._shouldBeReady = [], u._tapToActivate = !1, u.tapTimeout = 3e3, u.className = "Container", u._element = u.paper.addGroup("g"), u.group.add(u.element), u.setPropertyValue("pixelPerfect", !1), u.setPropertyValue("layout", "absolute"), u.setPropertyValue("fixedWidthGrid", !1), u.setPropertyValue("verticalCenter", "none"), u.setPropertyValue("horizontalCenter", "none"), u._positionPrecision = 4, u._disposers.push(new jd(u._childrenDisposers)), u.children.events.on("inserted", u.handleChildAdded, u), u.children.events.on("removed", u.handleChildRemoved, u), u.applyTheme(), u; + } + return re(R, U), R.prototype.handleChildAdded = function(u) { + this.processChild(u.newValue); + }, R.prototype.processChild = function(u) { + try { + this._childrenDisposers.insertKey(u.uid, new kn([u.events.on("transformed", this.handleChildTransform, this), u.events.on("zIndexChanged", this.sortAndAdd, this)])); + } catch { + } + this.element && this.element.add(u.group), u.parent = this, u.paper = this.paper, this.dispatchImmediately("childadded", { type: "childadded", newValue: u }), this.invalidate(); + }, R.prototype.sortAndAdd = function() { + this.sortChildren(), this.addChildren(); + }, R.prototype.handleChildRemoved = function(u) { + var w = u.oldValue; + this._childrenDisposers.removeKey(w.uid), this.element && this.element.removeElement(w.group), w.isMeasured && this.invalidateLayout(), this.dispatchImmediately("childremoved", { type: "childremoved", oldValue: w }); + }, R.prototype.handleChildTransform = function(u) { + u.target.isMeasured && this.invalidateLayout(); + }, R.prototype.invalidateLayout = function() { + this.layoutInvalid || this.disabled || this.isTemplate || this.layout == "none" || this.__disabled || (this.layoutInvalid = !0, hi.addToInvalidLayouts(this), qo.requestFrame()); + }, R.prototype.invalidate = function() { + U.prototype.invalidate.call(this), this.invalidateLayout(); + }, R.prototype.deepInvalidate = function() { + U.prototype.invalidate.call(this), _i(this._childrenByLayout, function(u) { + u instanceof R ? u.deepInvalidate() : u.invalidate(); + }), this.invalidateLayout(); + }, Object.defineProperty(R.prototype, "children", { get: function() { + return this._children || (this._children = new Hs()), this._children; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minWidth", { get: function() { + return this.getPropertyValue("minWidth"); + }, set: function(u) { + this.setPropertyValue("minWidth", u) && this.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minHeight", { get: function() { + return this.getPropertyValue("minHeight"); + }, set: function(u) { + this.setPropertyValue("minHeight", u) && this.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), R.prototype.removeElement = function() { + }, R.prototype.sortChildren = function() { + var u = this; + if (this._childrenByLayout = [], this.layout != "none" && this.layout != "absolute" && this.layout) { + var w = [], $ = []; + er(this.children.iterator(), function(G) { + u.layout == "horizontal" || u.layout == "grid" ? le(G.percentWidth) ? $.push(G) : w.push(G) : u.layout == "vertical" && le(G.percentHeight) ? $.push(G) : w.push(G); + }), this._childrenByLayout = w.concat($); + } else + this._childrenByLayout = this.children.values; + this.calculateRelativeSize(); + }, R.prototype.calculateRelativeSize = function() { + var u = this, w = 0, $ = 0; + _i(this._childrenByLayout, function(G) { + G.isMeasured && (le(G.percentWidth) && (w += G.percentWidth), le(G.percentHeight) && ($ += G.percentHeight)); + }), _i(this._childrenByLayout, function(G) { + G.isMeasured && (u.layout == "horizontal" && (le(G.percentWidth) && (G.relativeWidth = G.percentWidth / w), le(G.percentHeight) && (G.relativeHeight = G.percentHeight / 100)), u.layout == "vertical" && (le(G.percentHeight) && (G.relativeHeight = G.percentHeight / $), le(G.percentWidth) && (G.relativeWidth = G.percentWidth / 100)), u.layout == "grid" && (le(G.percentHeight) && (G.relativeHeight = G.percentHeight / 100), le(G.percentWidth) && (G.relativeWidth = G.percentWidth / 100))), u.layout != "absolute" && G.isMeasured || (le(G.percentWidth) && (G.relativeWidth = G.percentWidth / 100), le(G.percentHeight) && (G.relativeHeight = G.percentHeight / 100)); + }); + }, R.prototype.addChildren = function() { + if (this.element) { + var u = W(this.children.values), w = u.map(function(ue, we) { + return { idx: we, data: ue }; + }); + w.sort(function(ue, we) { + var De = ue.data.zIndex || 0, $e = we.data.zIndex || 0; + return De < $e ? -1 : De > $e ? 1 : ue.idx - we.idx; + }), u = w.map(function(ue) { + return ue.data; + }); + var $ = this.element, G = !0; + if ($.node && $.node.childNodes) { + for (var K = 0, ne = $.node.childNodes.length; K < ne; K++) + if ($.node.childNodes[K] != u[K].group.node) { + G = !1; + break; + } + } + G || (_i(u, function(ue) { + ue.group && $.add(ue.group); + }), this._background && this.group.addToBack(this._background.group), this.invalidateLayout()); + } + }, R.prototype.createChild = function(u) { + var w = new u(); + return w.parent = this, w; + }, R.prototype.removeChildren = function() { + for (; this.children.length > 0; ) { + var u = this.children.getIndex(0); + u.parent = void 0, this.children.removeValue(u); + } + }, R.prototype.disposeChildren = function() { + for (; this.children.length > 0; ) { + var u = this.children.getIndex(0); + u.dispose(), this.children.removeValue(u); + } + }, Object.defineProperty(R.prototype, "background", { get: function() { + return this._background || (this._background = this.createBackground(), this.processBackground()), this._background; + }, set: function(u) { + this._background && this.background != u && this.removeDispose(this._background), u && (this._background = u, this._disposers.push(u), this.processBackground()); + }, enumerable: !0, configurable: !0 }), R.prototype.handleGlobalScale = function() { + U.prototype.handleGlobalScale.call(this), this.children.each(function(u) { + u.handleGlobalScale(); + }); + }, R.prototype.createBackground = function() { + return new MC(); + }, R.prototype.processBackground = function() { + var u = this._background; + u && (u.isMeasured = !1, this._background.fill = new Fa().getFor("background"), u.parent = this, u.isMeasured = !1, this.children.removeValue(u), this._disposers.push(u), this.group.addToBack(this._background.group)); + }, R.prototype.validateLayout = function() { + var u = this; + hi.removeFromInvalidLayouts(this), this.layoutInvalid = !1, this._availableWidth = this.innerWidth, this._availableHeight = this.innerHeight; + var w = 0, $ = 0, G = !0; + this.children && (this.sortChildren(), _i(this._childrenByLayout, function(K) { + var ne, ue; + if (le(K.relativeWidth) ? (ne = He(u._availableWidth * K.relativeWidth, 2), u.layout == "horizontal" && (ne -= K.pixelMarginRight + K.pixelMarginLeft)) : u.layout == "horizontal" && K.invalid && K.validate(), le(K.relativeHeight) ? (ue = He(u._availableHeight * K.relativeHeight, 2), u.layout == "vertical" && (ue -= K.pixelMarginTop + K.pixelMarginBottom)) : u.layout == "vertical" && K.invalid && K.validate(), K.invalid == 0) { + if (le(K.relativeWidth) && (K.maxWidth = ne), le(K.relativeHeight) && (K.maxHeight = ue), K.isMeasured) { + u.layout == "horizontal" && (le(K.percentWidth) || K.measuredWidth > 0 && (u._availableWidth -= K.measuredWidth + K.pixelMarginLeft + K.pixelMarginRight)), u.layout == "vertical" && (le(K.percentHeight) || K.measuredHeight > 0 && (u._availableHeight -= K.measuredHeight + K.pixelMarginTop + K.pixelMarginBottom)); + var we = K.measuredWidth, De = K.measuredHeight; + K.align != "none" && (we += K.pixelMarginLeft + K.pixelMarginRight), K.valign != "none" && (De += K.pixelMarginTop + K.pixelMarginBottom), w = Math.max(w, we), $ = Math.max($, De); + } + } else + K.isMeasured && (le(K.relativeWidth) && K.maxWidth != ne && (K.maxWidth = ne, G = !1), le(K.relativeHeight) && K.maxHeight != ue && (K.maxHeight = ue, G = !1)); + })), this._absoluteWidth = w, this._absoluteHeight = $, G && this.arrange(); + }, R.prototype.arrange = function() { + var u, w, $, G, K, ne, ue, we, De, $e, Ke, Ze = this, pt = this.children, Vt = 0, Yt = 0, ci = ve(this.innerWidth, this._absoluteWidth), ai = ve(this.innerHeight, this._absoluteHeight), Gi = this.pixelPaddingLeft, Ji = this.pixelPaddingRight, Ci = this.pixelPaddingTop, Hi = this.pixelPaddingBottom, sr = 0, Or = 0, yr = 0, As = 0, Fn = [], Aa = [], hh = this.maxWidth, Np = this.maxHeight, bl = this.minWidth, Vf = this.minHeight, ku = W(pt.values); + if (this.reverseOrder && ku.reverse(), this.layout == "grid") { + ne = hh, K = 1; + for (var Bs = 0, yf = ku.length; Bs < yf; Bs++) + if ((Ps = ku[Bs]).isMeasured && !Ps.disabled && !Ps.__disabled) { + var vf = Ps.measuredWidth; + vf < ne && (ne = vf), vf > K && (K = vf); + } + ne = mt(ne, 1, hh), K = mt(K, 1, hh), ue = this.fixedWidthGrid ? hh / K : hh / ne, ue = ve(1, Math.floor(ue)), ue = H(this.maxColumns, ue), Fn = this.getColumnWidth(ku, ue, K); + } + for (Bs = 0, yf = ku.length; Bs < yf; Bs++) { + var Ps; + if (!(Ps = ku[Bs]).isMeasured || Ps.disabled || Ps.__disabled) + Ps.validatePosition(); + else { + var zh = void 0, au = void 0, dh = Ps.pixelMarginLeft, tw = Ps.pixelMarginRight, gg = Ps.pixelMarginTop, jf = Ps.pixelMarginBottom, Qv = Ps.measuredWidth, iw = Ps.measuredHeight, u2 = void 0, zC = void 0, dA = void 0, zL = void 0; + switch (this.layout) { + case "none": + break; + case "absolute": + switch (Ps.align) { + case "left": + zh = dh - Ps.maxLeft; + break; + case "center": + zh = (ci - Qv) / 2 - Ps.maxLeft; + break; + case "right": + zh = ci - tw - Ps.maxRight; + break; + default: + Ps.x instanceof J || (zh = Ps.pixelX); + } + switch (Ps.valign) { + case "top": + au = gg - Ps.maxTop; + break; + case "middle": + au = (ai - iw) / 2 - Ps.maxTop; + break; + case "bottom": + au = ai - jf - Ps.maxBottom; + break; + default: + Ps.y instanceof J || (au = Ps.pixelY); + } + break; + case "vertical": + switch (Ps.align) { + case "left": + zh = dh - Ps.maxLeft; + break; + case "center": + zh = (ci - Qv) / 2 - Ps.maxLeft; + break; + case "right": + zh = ci - tw - Ps.maxRight; + break; + default: + zh = Ps.pixelX; + } + Or = (au = Or + gg - Ps.maxTop) + Ps.maxBottom + jf; + break; + case "horizontal": + switch (Ps.valign) { + case "top": + au = gg - Ps.maxTop; + break; + case "middle": + au = (ai - iw) / 2 - Ps.maxTop; + break; + case "bottom": + au = ai - jf - Ps.maxBottom; + break; + default: + au = Ps.pixelY; + } + sr = (zh = sr + dh - Ps.maxLeft) + Ps.maxRight + tw; + break; + case "grid": + switch (zh = sr + dh - Ps.maxLeft, Ps.valign) { + case "top": + au = Or + gg - Ps.maxTop; + break; + case "middle": + au = Or + (ai - iw) / 2 - Ps.maxTop; + break; + case "bottom": + au = Or + ai - jf - Ps.maxBottom; + break; + default: + au = Or - Ps.maxTop; + } + sr += Fn[As], Aa[yr] = ve(Aa[yr], iw); + var C9 = Fn[++As]; + if (le(C9) || (C9 = K), sr > H(this.innerWidth, hh) - C9 + 1 && As < ue) { + ue = As, sr = 0, Or = 0, yr = 0, As = 0, Fn = this.getColumnWidth(ku, ue, K), Aa = [], Bs = -1; + continue; + } + As >= ue && (As = 0, Or += Aa[yr], yr++, sr = 0); + } + this.layout !== "none" && (Ps.moveTo({ x: zh, y: au }), u2 = zh + Ps.maxLeft - dh, zC = zh + Ps.maxRight + tw, dA = au + Ps.maxTop - gg, zL = au + Ps.maxBottom + jf, (zC > w || !le(w)) && (w = zC), (u2 < u || !le(u)) && (u = u2), (dA < $ || !le($)) && ($ = dA), (zL > G || !le(G)) && (G = zL), (zC > De || !le(De)) && (De = zC), (u2 < we || !le(we)) && (we = u2), (dA < $e || !le($e)) && ($e = dA), zL > Ke || le(Ke)); + } + } + if (this.layout == "none") { + var dR = this.bbox; + u = dR.x, w = dR.x + dR.width, $ = dR.y, G = dR.y + dR.height; + } + le(u) || (u = 0, we = 0), le(w) || (De = w = this._availableWidth), le($) || ($ = 0, $e = 0), le(G) || (Ke = G = this._availableHeight), le($e) || ($e = 0), le(Ke) || (Ke = $e), le(we) || (we = 0), le(De) || (De = we), Vt = w - u, Yt = G - $, le(this.relativeWidth) && (u = 0, w = Vt = hh - Gi - Ji), le(this.relativeHeight) && ($ = 0, G = Yt = Np - Ci - Hi), le(this._pixelWidth) && (u = 0, Vt = this._pixelWidth - Gi - Ji), le(bl) && Vt < bl && (u = 0, Vt = this.minWidth - Gi - Ji), le(this._pixelHeight) && ($ = 0, Yt = this._pixelHeight - Ci - Hi), le(Vf) && Yt < Vf && ($ = 0, Yt = Vf - Ci - Hi); + var HL = De - we, T9 = Ke - $e; + if (this.layout != "none" && (this.contentAlign || this.contentValign) && pt.length > 0) { + var HC, WL, E9 = Vt, Xg = Yt; + E9 < HL && (E9 = HL), Xg < T9 && (Xg = T9), this.contentAlign == "center" && (HC = (E9 - HL) / 2), this.contentAlign == "right" && (HC = E9 - HL), this.contentValign == "middle" && (WL = (Xg - T9) / 2), this.contentValign == "bottom" && (WL = Xg - T9), le(HC) && er(pt.iterator(), function(Hh) { + var pR = Hh.maxLeft, Gf = HC; + Ze.layout == "horizontal" && (Hh.x = Hh.pixelX + Gf), Ze.layout == "grid" && (Hh.x = Hh.pixelX + Gf), Ze.layout == "vertical" && (Gf += Hh.pixelMarginLeft, Hh.align == "none" && (Hh.x = Gf - pR)), Ze.layout == "absolute" && (Gf += Hh.pixelMarginLeft, Hh.align == "none" && (Hh.x = Gf - pR)); + }), le(WL) && er(pt.iterator(), function(Hh) { + var pR = Hh.maxTop, Gf = WL; + Ze.layout == "horizontal" && (Gf += Hh.pixelMarginTop, Hh.valign == "none" && (Hh.y = Gf - pR)), Ze.layout == "grid" && (Gf += Hh.pixelMarginTop, Hh.y = Gf - pR), Ze.layout == "vertical" && (Hh.y = Hh.pixelY + Gf), Ze.layout == "absolute" && (Gf += Hh.pixelMarginTop, Hh.valign == "none" && (Hh.y = Gf - pR)); + }); + } + var eW = this.bbox; + Vt = ve(Vt, bl), Yt = ve(Yt, Vf), this.contentWidth = Vt, this.contentHeight = Yt, Vt = H(Vt, hh), Yt = H(Yt, Np), this._bbox = { x: u, y: $, width: Vt, height: Yt }; + var sne = this.maxLeft, one = this.maxTop, T_e = this.maxBottom, E_e = this.maxRight; + if (this.measure(), (sne != this.maxLeft || E_e != this.maxRight || one != this.maxTop || T_e != this.maxBottom) && this.events.isEnabled("transformed")) { + var tW = { type: "transformed", target: this }; + eW && (tW.dummyData = eW.width + " " + Vt + " " + eW.height + " " + Yt), this.events.dispatchImmediately("transformed", tW); + } + this.dispatchImmediately("layoutvalidated"); + }, R.prototype.updateCenter = function() { + U.prototype.updateCenter.call(this), this.updateBackground(); + }, R.prototype.updateBackground = function() { + var u = this._background; + u && (u.x = this.maxLeft, u.y = this.maxTop, u.width = this.maxRight - this.maxLeft, u.height = this.maxBottom - this.maxTop); + }, R.prototype.getColumnWidth = function(u, w, $) { + var G = this, K = [], ne = 0; + return _i(u, function(ue) { + !ue.isMeasured || ue.disabled || ue.__disabled || (G.fixedWidthGrid ? K[ne] = $ : K[ne] = ve(K[ne], ue.measuredWidth + ue.pixelMarginRight + ue.pixelMarginLeft), ++ne == w && (ne = 0)); + }), K; + }, Object.defineProperty(R.prototype, "layout", { get: function() { + return this.getPropertyValue("layout"); + }, set: function(u) { + this.setPropertyValue("layout", u) && this.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "contentValign", { get: function() { + return this.getPropertyValue("contentValign"); + }, set: function(u) { + this.setPropertyValue("contentValign", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "contentAlign", { get: function() { + return this.getPropertyValue("contentAlign"); + }, set: function(u) { + this.setPropertyValue("contentAlign", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fixedWidthGrid", { get: function() { + return this.getPropertyValue("fixedWidthGrid"); + }, set: function(u) { + this.setPropertyValue("fixedWidthGrid", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxColumns", { get: function() { + return this.getPropertyValue("maxColumns"); + }, set: function(u) { + this.setPropertyValue("maxColumns", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "reverseOrder", { get: function() { + return this.getPropertyValue("reverseOrder"); + }, set: function(u) { + this.setPropertyValue("reverseOrder", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "setStateOnChildren", { get: function() { + return this.getPropertyValue("setStateOnChildren"); + }, set: function(u) { + this.setPropertyValue("setStateOnChildren", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.fitsToBounds = function(u) { + var w = u.x, $ = u.y; + return w >= -0.5 && w <= this.pixelWidth + 0.5 && $ >= -0.5 && $ <= this.pixelHeight + 0.5; + }, R.prototype.copyFrom = function(u) { + var w = this; + U.prototype.copyFrom.call(this, u), this.layout = u.layout, this.setStateOnChildren = u.setStateOnChildren, u._background && (this.background = u._background.clone(), this.background.copyFrom(u._background)), er(u.children.iterator(), function($) { + $.shouldClone && ($.clone().parent = w); + }); + }, Object.defineProperty(R.prototype, "preloader", { get: function() { + return this._preloader || (this.parent ? this.parent.preloader : void 0); + }, set: function(u) { + this._preloader && this.removeDispose(this._preloader), this._preloader = u, u && (u.parent = this.tooltipContainer, this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), R.prototype.setPaper = function(u) { + var w = this, $ = U.prototype.setPaper.call(this, u); + return $ && (this._background && (this._background.paper = u, this._background.topParent = this.topParent), this.children.each(function(G) { + G.setPaper(u), G.topParent = w.topParent; + })), $; + }, R.prototype.removeFromInvalids = function() { + U.prototype.removeFromInvalids.call(this), hi.removeFromInvalidLayouts(this); + }, R.prototype.setDataItem = function(u) { + this._dataItem != u && (er(this.children.iterator(), function(w) { + w.dataItem = u; + }), this._background && (this._background.dataItem = u)), U.prototype.setDataItem.call(this, u); + }, R.prototype.measureElement = function() { + this.disabled || this.isTemplate || this.layout == "none" || this.__disabled || this.validateLayout(); + }, Object.defineProperty(R.prototype, "fontFamily", { get: function() { + return this.getPropertyValue("fontFamily"); + }, set: function(u) { + this.setPropertyValue("fontFamily", u, !0) && (this.setSVGAttribute({ "font-family": u }), this.invalidateLabels()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fontSize", { get: function() { + return this.getPropertyValue("fontSize"); + }, set: function(u) { + this.setPropertyValue("fontSize", u, !0) && (this.setSVGAttribute({ "font-size": u }), this.invalidateLabels()); + }, enumerable: !0, configurable: !0 }), R.prototype.invalidateLabels = function() { + this.children.each(function(u) { + u.hardInvalidate ? (u.hardInvalidate(), u.events.once("validated", u.handleValidate, u, !1)) : u instanceof R && u.invalidateLabels(); + }); + }, Object.defineProperty(R.prototype, "fontWeight", { get: function() { + return this.getPropertyValue("fontWeight"); + }, set: function(u) { + this.setPropertyValue("fontWeight", u), this.setSVGAttribute({ "font-weight": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "textDecoration", { get: function() { + return this.getPropertyValue("textDecoration"); + }, set: function(u) { + this.setPropertyValue("textDecoration", u), this.setSVGAttribute({ "text-decoration": u }); + }, enumerable: !0, configurable: !0 }), R.prototype.dispose = function() { + this._background && this._background.dispose(), this._shouldBeReady = [], this.disposeChildren(), U.prototype.dispose.call(this); + }, R.prototype.setState = function(u, w, $) { + var G = u; + return u instanceof Hr && (G = u.name), this.setStateOnChildren && er(this.children.iterator(), function(K) { + K.setState(G, w, $), G != "active" && (K.isActive = !1); + }), this._background && this._background.setState(G), this.setStateOnSprites.length && _i(this.setStateOnSprites, function(K) { + K.setState(G, w, $); + }), U.prototype.setState.call(this, u, w, $); + }, R.prototype.setActive = function(u) { + U.prototype.setActive.call(this, u), this._background && (this._background.isActive = u); + }, R.prototype.dispatchReady = function() { + var u = this; + if (!this.isReady() && !this.isDisposed()) { + var w = !0; + Zr(this.children.iterator(), function($) { + return !!($.__disabled || $.disabled || $.isReady()) || (w = !1, !1); + }), jr(this._shouldBeReady, function($) { + return !!($.__disabled || $.disabled || $.isReady()) || (w = !1, !1); + }), w ? U.prototype.dispatchReady.call(this) : hi.events.once("exitframe", function() { + u.dispatchReady(), qo.requestFrame(); + }, void 0, !1); + } + }, R.prototype._systemUpdate = function(u) { + this.children.each(function(w) { + w.invalid && (w._systemCheckIfValidate() ? w.dataItem && w.dataItem.component && w.dataItem.component.dataInvalid ? u.push(w) : w.validate() : u.push(w)); + }), U.prototype._systemUpdate.call(this, u); + }, R.prototype._systemValidatePositions = function() { + this.children.each(function(u) { + u.positionInvalid && u.validatePosition(); + }), U.prototype._systemValidatePositions.call(this); + }, R.prototype._systemValidateLayouts = function() { + this.layoutInvalid && !this.isDisposed() && this.validateLayout(); + }, Object.defineProperty(R.prototype, "tapToActivate", { get: function() { + return this._tapToActivate; + }, set: function(u) { + this._tapToActivate != u && this.setTapToActivate(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setTapToActivate = function(u) { + var w = this; + this._tapToActivate = u, this.interactions.isTouchProtected = u, u && this.interactions.setEventDisposer("container-tapToActivate", u, function() { + return new kn([w.events.on("hit", w.handleTapToActivate, w, !1), w.events.on("down", w.initTapTimeout, w, !1), w.events.on("track", w.initTapTimeout, w, !1), Gs().body.events.on("down", function($) { + Gs().isLocalElement($.pointer, w.paper.svg, w.uid) || w.handleTapToActivateDeactivation(); + }, w, !1)]); + }), Gs(); + }, R.prototype.handleTapToActivate = function() { + this.interactions.isTouchProtected = !1, this.initTapTimeout(); + }, R.prototype.handleTapToActivateDeactivation = function() { + this.interactions.isTouchProtected = !0; + }, R.prototype.initTapTimeout = function() { + var u = this; + this._tapToActivateTimeout && this._tapToActivateTimeout.dispose(), this.tapToActivate && !this.interactions.isTouchProtected && this.tapTimeout && (this._tapToActivateTimeout = this.setTimeout(function() { + u.handleTapToActivateDeactivation(); + }, this.tapTimeout)); + }, R.prototype.moveHtmlContainer = function(u) { + var w = cL(u); + if (w) { + this.htmlContainer = w; + var $ = this.svgContainer; + $.htmlElement = w, $.htmlElement.appendChild($.SVGContainer), $.initSensor(), $.measure(); + } else + st(u) && u != "" && qo.log("html container '" + u + "' not found"); + }, R.prototype.hasLicense = function() { + if (zd.commercialLicense) + return !0; + for (var u = 0; u < zd.licenses.length; u++) + if (zd.licenses[u].match(/^CH.{5,}/i)) + return !0; + return !1; + }, R; + }(so); + hi.registeredClasses.Container = Qn; + var vre = function() { + function U() { + this._isPaused = !1, this.animations = [], this.uid = hi.getUniqueId(), this.dummyCounter = 0, this._frameRequested = !1, this.updateStepDuration = 45, this.time = Date.now(); + } + return U.prototype.reportTime = function(R, u) { + this.dummyCounter, u && (this.time = Date.now()); + }, U.prototype.update = function() { + var R = this; + if (!this._isPaused) { + this._frameRequested = !1; + var u = Date.now(); + for (var w in hi.dispatchImmediately("enterframe"), hi.invalidDatas) + if (Tr(hi.invalidDatas, w)) { + for (var $ = hi.invalidDatas[w]; $.length > 0; ) { + var G = (K = $[0]).dataProvider; + if (K.isDisposed()) + ki($, K); + else if (G && G.dataInvalid) + try { + if (G.validateData(), G.dataValidationProgress < 1) + break; + } catch (De) { + ki($, G), G.raiseCriticalError(De); + } + else + try { + if (K.validateData(), K.dataValidationProgress < 1) + break; + } catch (De) { + ki($, K), K.raiseCriticalError(De); + } + } + if (Date.now() - u > this.updateStepDuration) + break; + } + for (; hi.invalidRawDatas.length > 0; ) + if ((K = hi.invalidRawDatas[0]).isDisposed()) + ki(hi.invalidRawDatas, K); + else + try { + K.validateRawData(); + } catch (De) { + ki(hi.invalidRawDatas, K), K.raiseCriticalError(De); + } + for (; hi.invalidDataItems.length > 0; ) { + if (G = (K = hi.invalidDataItems[0]).dataProvider, !(K.isDisposed() || K.dataInvalid || G && G.dataInvalid)) + try { + K.validateDataItems(); + } catch (De) { + ki(hi.invalidDataItems, K), K.raiseCriticalError(De); + } + ki(hi.invalidDataItems, K); + } + for (; hi.invalidDataRange.length > 0; ) { + var K; + if (G = (K = hi.invalidDataRange[0]).dataProvider, !(K.isDisposed() || K.dataInvalid || G && G.dataInvalid)) + try { + K.validateDataRange(), K.skipRangeEvent || K.dispatchImmediately("datarangechanged"), K.skipRangeEvent = !1; + } catch (De) { + ki(hi.invalidDataRange, K), K.raiseCriticalError(De); + } + ki(hi.invalidDataRange, K); + } + var ne = []; + mi(hi.invalidLayouts, function(De) { + R.validateLayouts(De); + }), mi(hi.invalidPositions, function(De) { + R.validatePositions(De); + }); + var ue = !1; + if (u = Date.now(), mi(hi.invalidSprites, function(De, $e) { + for (var Ke = 0; $e.length > 0; ) { + if (R.validateLayouts(De), R.validatePositions(De), ++Ke == 5) { + if (Date.now() - u > R.updateStepDuration) + break; + Ke = 0; + } + var Ze = $e[$e.length - 1]; + if (Ze && !Ze.isDisposed()) { + if (Ze._systemCheckIfValidate()) + if (R.checkIfValidate2(Ze)) + try { + Ze._systemUpdate(ne); + } catch (pt) { + Ze.invalid = !1, ki($e, Ze), Ze.raiseCriticalError(pt); + } + else + ne.push(Ze); + else + ne.push(Ze); + Ze.invalid = !1; + } + ki($e, Ze); + } + hi.invalidSprites[De] = hi.invalidSprites[De].concat(ne); + }), mi(hi.invalidSprites, function(De, $e) { + $e.length > 0 && (ue = !0); + }), mi(hi.invalidDatas, function(De, $e) { + $e.length > 0 && (ue = !0); + }), _i(W(this.animations), function(De) { + De.update(); + }), mi(hi.invalidLayouts, function(De) { + R.validateLayouts(De); + }), mi(hi.invalidPositions, function(De) { + R.validatePositions(De); + }), Nl(), mi(hi.invalidLayouts, function(De) { + R.validateLayouts(De); + }), mi(hi.invalidPositions, function(De) { + R.validatePositions(De); + }), hi.dispatchImmediately("exitframe"), (ue || this.animations.length > 0 || [].length > 0) && this.requestFrame(), this.updateStepDuration < 200) { + var we = !0; + mi(hi.invalidDatas, function(De, $e) { + $e.length > 0 && (we = !1); + }), mi(hi.invalidSprites, function(De, $e) { + $e.length > 0 && (we = !1); + }), we && (this.updateStepDuration = 200); + } + } + }, U.prototype.checkIfValidate2 = function(R) { + return !(R.dataItem && R.dataItem.component && R.dataItem.component.dataInvalid && !R.dataItem.component.isTemplate); + }, U.prototype.requestFrame = function() { + var R = this; + this._frameRequested || (vc(function() { + R.update(); + }), this._frameRequested = !0); + }, U.prototype.softInvalidate = function(R) { + var u = this; + R.children.each(function(w) { + w instanceof Qn && u.softInvalidate(w), w.measureFailed && (ll(w, "Label") ? w.hardInvalidate() : w.invalidate(), w.measureFailed = !1); + }); + }, U.prototype.validatePositions = function(R) { + for (var u = hi.invalidPositions[R]; u.length > 0; ) { + var w = u[u.length - 1]; + if (w.isDisposed()) + ki(u, w); + else + try { + w._systemValidatePositions(); + } catch ($) { + w.positionInvalid = !1, ki(u, w), w.raiseCriticalError($); + } + } + }, U.prototype.validateLayouts = function(R) { + for (var u = hi.invalidLayouts[R]; u.length > 0; ) { + var w = u[u.length - 1]; + if (w.isDisposed()) + ki(u, w); + else + try { + w.children.each(function($) { + $._systemValidateLayouts(); + }), w.validateLayout(); + } catch ($) { + w.layoutInvalid = !1, ki(u, w), w.raiseCriticalError($); + } + } + }, U.prototype.log = function(R) { + (function() { + for (var u = [], w = 0; w < arguments.length; w++) + u[w] = arguments[w]; + console && console.log.apply(console, ke(u)); + })(R); + }, Object.defineProperty(U.prototype, "isPaused", { get: function() { + return this._isPaused; + }, set: function(R) { + this._isPaused = R, R || (this._frameRequested = !1, this.requestFrame()); + }, enumerable: !0, configurable: !0 }), U.VERSION = "4.10.28", U; + }(), qo = new vre(), fH = function() { + function U() { + } + return U.prototype.parse = function(R) { + return []; + }, Object.defineProperty(U.prototype, "parsableNumbers", { get: function() { + return this.options.numberFields && this.options.numberFields.length > 0; + }, enumerable: !0, configurable: !0 }), U.prototype.maybeToNumber = function(R, u) { + return this.options.numberFields.indexOf(R) !== -1 ? Ot(u) : u; + }, Object.defineProperty(U.prototype, "parsableDates", { get: function() { + return this.options.dateFields && this.options.dateFields.length > 0; + }, enumerable: !0, configurable: !0 }), U.prototype.maybeToDate = function(R, u) { + return this.options.dateFields.indexOf(R) !== -1 ? this.options.dateFormatter.parse(u, this.dateFormat) : u; + }, U.prototype.maybeToEmpty = function(R) { + return Ee(R) && R != "" || !Ee(this.options.emptyAs) ? R : this.options.emptyAs; + }, Object.defineProperty(U.prototype, "dateFormatter", { get: function() { + return this.options.dateFormatter || (this.options.dateFormatter = new OC(), this.options.dateFormat && (this.options.dateFormat = this.options.dateFormat)), this.options.dateFormatter; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(U.prototype, "dateFormat", { get: function() { + return this.options.dateFormat || this.dateFormatter.inputDateFormat; + }, enumerable: !0, configurable: !0 }), U; + }(), j8 = [",", ";", " "], e2 = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u.contentType = "text/csv", u.options = { delimiter: "", reverse: !1, skipRows: 0, skipEmpty: !0, useColumnNames: !1 }, u; + } + return re(R, U), R.isCSV = function(u) { + return !!R.getDelimiterFromData(u); + }, R.getDelimiterFromData = function(u) { + var w, $ = u.split(` +`), G = $.length; + return _i(j8, function(K) { + for (var ne = 0, ue = 0, we = 0; we < G; ++we) { + if (!((ne = $[we].split(K).length) > 1)) { + ue = 0; + break; + } + if (ue === 0) + ue = ne; + else if (ne != ue) { + ue = 0; + break; + } + } + ue && (w = K); + }), w; + }, R.prototype.parse = function(u) { + this.options.delimiter || (this.options.delimiter = R.getDelimiterFromData(u)); + var w, $, G, K = this.CSVToArray(u, this.options.delimiter), ne = Ee(this.options.emptyAs), ue = this.parsableNumbers, we = this.parsableDates, De = [], $e = []; + for ($ = 0; $ < this.options.skipRows; $++) + K.shift(); + if (this.options.useColumnNames) { + $e = K.shift(); + for (var Ke = 0; Ke < $e.length; Ke++) + (w = Ee($e[Ke]) ? $e[Ke].replace(/^\s+|\s+$/gm, "") : "") === "" && (w = "col" + Ke), $e[Ke] = w; + } + for (; G = this.options.reverse ? K.pop() : K.shift(); ) + if (!this.options.skipEmpty || G.length !== 1 || G[0] !== "") { + var Ze = {}; + for ($ = 0; $ < G.length; $++) + Ze[w = $e[$] === void 0 ? "col" + $ : $e[$]] = G[$] === "" ? this.options.emptyAs : G[$], ne && (Ze[w] = this.maybeToEmpty(Ze[w])), ue && (Ze[w] = this.maybeToNumber(w, Ze[w])), we && (Ze[w] = this.maybeToDate(w, Ze[w])); + De.push(Ze); + } + return De; + }, R.prototype.CSVToArray = function(u, w) { + w = w || ","; + for (var $ = new RegExp("(\\" + w + '|\\r?\\n|\\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^"\\' + w + "\\r\\n]*))", "gi"), G = [[]], K = null; K = $.exec(u); ) { + var ne, ue = K[1]; + ue.length && ue !== w && G.push([]), ne = K[2] ? K[2].replace(new RegExp('""', "g"), '"') : K[3], G[G.length - 1].push(ne); + } + return G; + }, R; + }(fH), oA = function(U) { + function R() { + var u = U !== null && U.apply(this, arguments) || this; + return u.contentType = "application/json", u.options = {}, u; + } + return re(R, U), R.isJSON = function(u) { + try { + return JSON.parse(u), !0; + } catch { + return !1; + } + }, R.prototype.parse = function(u) { + var w, $ = this; + try { + Ee(JSON) && (w = JSON.parse(u)); + } catch { + return; + } + var G = Ee(this.options.emptyAs), K = this.parsableNumbers, ne = this.parsableDates; + if (Array.isArray(w) && (K || ne || G)) + for (var ue = function($e, Ke) { + var Ze = w[$e]; + mi(Ze, function(pt, Vt) { + G && (Ze[pt] = $.maybeToEmpty(Ze[pt])), K && (Ze[pt] = $.maybeToNumber(pt, Ze[pt])), ne && (Ze[pt] = $.maybeToDate(pt, Ze[pt])); + }); + }, we = 0, De = w.length; we < De; we++) + ue(we); + return w; + }, R; + }(fH), _re = function() { + function U() { + this.adapter = new Yu(this); + } + return U.prototype.load = function(R) { + var u = rr(Array.isArray(R) ? R : [R], function(w) { + return w.dispatchImmediately("started"), w.dispatchImmediately("loadstarted"), oi(w.url, w, w.requestOptions); + }); + Promise.all(u).then(function(w) { + _i(w, function($) { + var G = $.target; + G.dispatchImmediately("loadended"), $.error ? G.events.isEnabled("error") && G.events.dispatchImmediately("error", { type: "error", code: $.xhr.status, message: G.language.translate("Unable to load file: %1", null, G.url), target: G }) : G.processData($.response, $.type), G.dispatchImmediately("ended"); + }); + }).catch(function(w) { + w.target && (w.target.dispatchImmediately("loadended"), w.target.events.isEnabled("error") && w.target.events.dispatchImmediately("error", { type: "error", code: w.xhr.status, message: w.target.language.translate("Unable to load file: %1", null, w.target.url), target: w.target }), w.target.dispatchImmediately("ended")); + }); + }, U.prototype.getParserByType = function(R) { + return this.adapter.apply("getParserByType", { parser: null, type: R }).parser || (R == "csv" || R == "text/csv" || R == "application/vnd.ms-excel" ? new e2() : R == "json" || R == "application/json" ? new oA() : void 0); + }, U.prototype.getParserByData = function(R, u) { + var w = this.adapter.apply("getParserByData", { parser: null, data: R, type: u }).parser; + if (!w) { + if (w = this.getParserByType(u)) + return w; + if (oA.isJSON(R)) + return this.getParserByType("json"); + if (e2.isCSV(R)) + return this.getParserByType("csv"); + } + return w; + }, U; + }(), DC = new _re(), G8 = function(U) { + function R(u, w) { + var $ = U.call(this) || this; + return $.adapter = new Yu($), $._requestOptions = {}, $._incremental = !1, $._incrementalParams = {}, $._keepCount = !1, $._updateCurrentData = !1, $.showPreloader = !0, $.className = "DataSource", u && ($.url = u), w && ($.parser = typeof w == "string" ? DC.getParserByType(w) : w), $; + } + return re(R, U), R.prototype.processData = function(u, w) { + if (this.dispatchImmediately("parsestarted"), this.parser || (this.parser = DC.getParserByData(u, w), this.parser)) { + if (this.parser.options = this.adapter.apply("parserOptions", this.parser.options), this.parser.options.dateFields = this.adapter.apply("dateFields", this.parser.options.dateFields || []), this.parser.options.numberFields = this.adapter.apply("numberFields", this.parser.options.numberFields || []), this.parser.options.dateFields && !this.parser.options.dateFormatter && (this.parser.options.dateFormatter = this.dateFormatter), this.data = this.adapter.apply("parsedData", this.parser.parse(this.adapter.apply("unparsedData", u))), !Ee(this.data) && this.events.isEnabled("parseerror")) { + var $ = { type: "parseerror", message: this.language.translate("Error parsing file: %1", null, this.url), target: this }; + this.events.dispatchImmediately("parseerror", $); + } + this.dispatchImmediately("parseended"), Ee(this.data) && this.dispatchImmediately("done", { data: this.data }), this.lastLoad = /* @__PURE__ */ new Date(); + } else { + if (this.events.isEnabled("parseerror")) { + var G = { type: "parseerror", message: this.language.translate("No parser available for file: %1", null, this.url), target: this }; + this.events.dispatchImmediately("parseerror", G); + } + this.dispatchImmediately("parseended"); + } + }, Object.defineProperty(R.prototype, "url", { get: function() { + var u = this.disableCache ? this.timestampUrl(this._url) : this._url; + return this.incremental && this.component.data.length && (u = this.addUrlParams(u, this.incrementalParams)), this.adapter.apply("url", u); + }, set: function(u) { + this._url = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "requestOptions", { get: function() { + return this.adapter.apply("requestOptions", this._requestOptions); + }, set: function(u) { + this._requestOptions = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "parser", { get: function() { + return this._parser || (this._parser = new oA()), this.adapter.apply("parser", this._parser); + }, set: function(u) { + this._parser = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "reloadFrequency", { get: function() { + return this.adapter.apply("reloadTimeout", this._reloadFrequency); + }, set: function(u) { + var w = this; + this._reloadFrequency != u && (this._reloadFrequency = u, u ? Ee(this._reloadDisposer) || (this._reloadDisposer = this.events.on("ended", function($) { + w._reloadTimeout = setTimeout(function() { + w.load(); + }, w.reloadFrequency); + })) : Ee(this._reloadDisposer) && (this._reloadDisposer.dispose(), this._reloadDisposer = void 0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "incremental", { get: function() { + return this.adapter.apply("incremental", this._incremental); + }, set: function(u) { + this._incremental = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "incrementalParams", { get: function() { + return this.adapter.apply("incrementalParams", this._incrementalParams); + }, set: function(u) { + this._incrementalParams = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "keepCount", { get: function() { + return this.adapter.apply("keepCount", this._keepCount); + }, set: function(u) { + this._keepCount = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "updateCurrentData", { get: function() { + return this.adapter.apply("updateCurrentData", this._updateCurrentData); + }, set: function(u) { + this._updateCurrentData = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "language", { get: function() { + return this._language ? this._language : this.component ? (this._language = this.component.language, this._language) : (this.language = new Yv(), this.language); + }, set: function(u) { + this._language = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateFormatter", { get: function() { + return this._dateFormatter ? this._dateFormatter : this.component ? (this._dateFormatter = this.component.dateFormatter, this._dateFormatter) : (this.dateFormatter = new OC(), this.dateFormatter); + }, set: function(u) { + this._dateFormatter = u; + }, enumerable: !0, configurable: !0 }), R.prototype.timestampUrl = function(u) { + var w = {}; + return w[(/* @__PURE__ */ new Date()).getTime().toString()] = "", this.addUrlParams(u, w); + }, R.prototype.dispose = function() { + U.prototype.dispose.call(this), this._reloadTimeout && clearTimeout(this._reloadTimeout), Ee(this._reloadDisposer) && (this._reloadDisposer.dispose(), this._reloadDisposer = void 0); + }, R.prototype.load = function() { + this.url && (this._reloadTimeout && clearTimeout(this._reloadTimeout), DC.load(this)); + }, R.prototype.addUrlParams = function(u, w) { + var $ = u.match(/\?/) ? "&" : "?", G = []; + return mi(w, function(K, ne) { + ne != "" ? G.push(K + "=" + encodeURIComponent(ne)) : G.push(K); + }), G.length ? u + $ + G.join("&") : u; + }, R.prototype.processConfig = function(u) { + hi.registeredClasses.json = oA, hi.registeredClasses.JSONParser = oA, hi.registeredClasses.csv = e2, hi.registeredClasses.CSVParser = e2, U.prototype.processConfig.call(this, u); + }, R; + }(vi), bre = function(U) { + function R() { + var u = U.call(this) || this; + return u._rules = new Hs(), u._appliedRules = {}, u._appliedTargets = [], u._useDefault = !0, u.adapter = new Yu(u), u._enabled = !1, u._responsiveDisposers = [], u._noStates = [], u.className = "Responsive", u.rules.events.on("inserted", function() { + u.checkRules(); + }, !0), u.rules.events.on("removed", function() { + u.checkRules(); + }, !0), u._disposers.push(u.rules.events), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "component", { get: function() { + return this._component; + }, set: function(u) { + var w = this; + u != this._component && (this.disposeResponsiveHandlers(), this._component = u, this._responsiveDisposers.push(Be(this.component).events.on("sizechanged", function() { + w.checkRules(); + }, this)), this._responsiveDisposers.push(Be(this.component).events.once("datavalidated", function() { + w._component.isReady() && w.checkRules(!0); + }, this)), this.enabled = !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "enabled", { get: function() { + return this.adapter.apply("enabled", this._enabled); + }, set: function(u) { + this._enabled != u && (this._enabled = u, this.applyRules()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "useDefault", { get: function() { + return this.adapter.apply("useDefault", this._useDefault); + }, set: function(u) { + this._useDefault != u && (this._useDefault = u, this.applyRules()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rules", { get: function() { + return this.adapter.apply("rules", this._rules); + }, set: function(u) { + this._rules = u, this._enabled = !0, this.applyRules(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "defaultRules", { get: function() { + return this.adapter.apply("defaultRules", Wd); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "allRules", { get: function() { + var u = new Hs(); + return this.useDefault && u.copyFrom(this.defaultRules), u.copyFrom(this.rules), this.adapter.apply("allRules", u); + }, enumerable: !0, configurable: !0 }), R.prototype.isApplied = function(u) { + var w = this._appliedRules[u]; + return !!Ee(w) && w; + }, R.prototype.checkRules = function(u) { + var w = this; + u === void 0 && (u = !1); + var $ = this.allRules; + if ($ && $.length != 0) { + var G = !1, K = Be(this.component); + if (K.pixelWidth != 0 && K.pixelHeight != 0 && (er($.iterator(), function(ne) { + ne.id || (ne.id = hi.getUniqueId()); + var ue = ne.relevant(K); + (ue && !w.isApplied(ne.id) || !ue && w.isApplied(ne.id)) && (G = !0), w._appliedRules[ne.id] = ue; + }), u && (G = !0), G)) { + if (!this.component.isReady()) + return K.hidden = !0, void K.events.once("ready", function(ne) { + ne.target.show(0), w._applyRules(); + }); + this.dispatchImmediately("ruleschanged"), this._applyRules(); + } + } + }, R.prototype._applyRules = function() { + var u = this; + this._timeout && this._timeout.dispose(), this._timeout = this.setTimeout(function() { + u.applyRules(); + }, 10); + }, R.prototype.applyRules = function(u) { + var w = this, $ = Ee(u) ? u : Be(this.component), G = !1; + if (this.enabled) { + var K = !1; + er(this.allRules.iterator(), function(ne) { + var ue = w.getState(ne, $); + ue && (G || (Ri(w._appliedTargets, $.uid) !== -1 && $.setState(w.getDefaultState($), 0), G = !0), w.isApplied(Be(ne.id)) && (ue.transitionDuration = 0, w.setTargetState($, ue), w.dispatchImmediately("ruleapplied", { rule: ne }), K = !0)); + }), K ? Cn(this._appliedTargets, $.uid) : ki(this._appliedTargets, $.uid); + } + $.children && er($.children.iterator(), function(ne) { + w.applyRules(ne); + }); + }, R.prototype.getState = function(u, w) { + var $ = "responsive-" + u.id, G = w.uid + "_" + $; + if (Ri(this._noStates, G) === -1) { + if (w.states.hasKey($)) + return w.states.getKey($); + var K = u.state(w, $); + return K || this._noStates.push(G), K; + } + }, R.prototype.getDefaultState = function(u) { + return u.states.hasKey("responsive-default") ? u.states.getKey("responsive-default") : u.states.create("responsive-default"); + }, R.prototype.setTargetState = function(u, w) { + var $ = this, G = this.getDefaultState(u); + mi(w.properties, function(K, ne) { + Ee(G.properties[K]) || (G.properties[K] = $.getValue(u, K)); + }), u.setState(w); + }, R.prototype.getValue = function(u, w) { + var $ = u.getPropertyValue(w); + return !Ee($) && Ee(u[w]) && ($ = u[w]), $; + }, R.prototype.dispose = function() { + this.disposeResponsiveHandlers(), U.prototype.dispose.call(this); + }, R.prototype.disposeResponsiveHandlers = function() { + for (var u = this._responsiveDisposers.pop(); u; ) + u.dispose(), u = this._responsiveDisposers.pop(); + }, R; + }(vi), Wd = new Hs(); + Wd.events.on("inserted", function(U) { + U.newValue.id = hi.getUniqueId(); + }); + var gf = function() { + function U() { + } + return U.widthXXS = function(R) { + return R.pixelWidth <= U.XXS; + }, U.widthXS = function(R) { + return R.pixelWidth <= U.XS; + }, U.widthS = function(R) { + return R.pixelWidth <= U.S; + }, U.widthM = function(R) { + return R.pixelWidth <= U.M; + }, U.widthL = function(R) { + return R.pixelWidth <= U.L; + }, U.widthXL = function(R) { + return R.pixelWidth <= U.XL; + }, U.widthXXL = function(R) { + return R.pixelWidth <= U.XXL; + }, U.heightXXS = function(R) { + return R.pixelHeight <= U.XXS; + }, U.heightXS = function(R) { + return R.pixelHeight <= U.XS; + }, U.heightS = function(R) { + return R.pixelHeight <= U.S; + }, U.heightM = function(R) { + return R.pixelHeight <= U.M; + }, U.heightL = function(R) { + return R.pixelHeight <= U.L; + }, U.heightXL = function(R) { + return R.pixelHeight <= U.XL; + }, U.heightXXL = function(R) { + return R.pixelHeight <= U.XXL; + }, U.isXXS = function(R) { + return R.pixelWidth <= U.XXS && R.pixelHeight <= U.XXS; + }, U.isXS = function(R) { + return R.pixelWidth <= U.XS && R.pixelHeight <= U.XS; + }, U.isS = function(R) { + return R.pixelWidth <= U.S && R.pixelHeight <= U.S; + }, U.isM = function(R) { + return R.pixelWidth <= U.M && R.pixelHeight <= U.M; + }, U.isL = function(R) { + return R.pixelWidth <= U.L && R.pixelHeight <= U.L; + }, U.isXL = function(R) { + return R.pixelWidth <= U.XL && R.pixelHeight <= U.XL; + }, U.isXXL = function(R) { + return R.pixelWidth <= U.XXL && R.pixelHeight <= U.XXL; + }, U.maybeXXS = function(R) { + return R.pixelWidth <= U.XXS || R.pixelHeight <= U.XXS; + }, U.maybeXS = function(R) { + return R.pixelWidth <= U.XS || R.pixelHeight <= U.XS; + }, U.maybeS = function(R) { + return R.pixelWidth <= U.S || R.pixelHeight <= U.S; + }, U.maybeM = function(R) { + return R.pixelWidth <= U.M || R.pixelHeight <= U.M; + }, U.maybeL = function(R) { + return R.pixelWidth <= U.L || R.pixelHeight <= U.L; + }, U.maybeXL = function(R) { + return R.pixelWidth <= U.XL || R.pixelHeight <= U.XL; + }, U.maybeXXL = function(R) { + return R.pixelWidth <= U.XXL || R.pixelHeight <= U.XXL; + }, U.XXS = 100, U.XS = 200, U.S = 300, U.M = 400, U.L = 600, U.XL = 800, U.XXL = 1e3, U; + }(), FC = function(U) { + function R() { + var u = U.call(this) || this; + return u._disabled = !1, u.hasProperties = !1, u.values = {}, u.categories = {}, u.dates = {}, u.locations = {}, u.workingLocations = {}, u.properties = {}, u.sprites = [], u.isTemplate = !1, u._index = null, u._visible = !0, u._hidden = !1, u._ignoreMinMax = !1, u.hasChildren = {}, u.isHiding = !1, u._valueAnimations = {}, u._locationAnimations = {}, u.className = "DataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "adapter", { get: function() { + return this._adapterO || (this._adapterO = new Yu(this)), this._adapterO; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "index", { get: function() { + return this.component && this._index != null ? this._index : -1; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animations", { get: function() { + return this._animations || (this._animations = [], this._disposers.push(new Wb(this._animations))), this._animations; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "visible", { get: function() { + return !this._hidden && this._visible; + }, set: function(u) { + u && (this.hidden = !1), this._visible != u && this.setVisibility(u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hidden", { get: function() { + return this._hidden; + }, set: function(u) { + this._hidden != u && (this._hidden = u, u ? this.setVisibility(!1) : this.setVisibility(!0, !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "__disabled", { get: function() { + return this._disabled; + }, set: function(u) { + this._disabled = u, _i(this.sprites, function(w) { + w.__disabled = u; + }); + }, enumerable: !0, configurable: !0 }), R.prototype.setVisibility = function(u, w) { + if (_i(this.sprites, function(G) { + u ? G.visible = G.defaultState.properties.visible : G.hiddenState ? G.visible = G.hiddenState.properties.visible : G.visible = !1; + }), this._visible = u, this._eventDispatcher && !this.__disabled && this.events.isEnabled("visibilitychanged")) { + var $ = { type: "visibilitychanged", target: this, visible: u }; + this.events.dispatchImmediately("visibilitychanged", $); + } + }, R.prototype.show = function(u, w, $) { + var G, K = this; + if (!this.hidden) + return this.setVisibility(!0, !0), this.isHiding = !1, this._hideDisposer && this.removeDispose(this._hideDisposer), $ && _i($, function(ne) { + G = K.setWorkingValue(ne, K.values[ne].value, u, w); + }), _i(this.sprites, function(ne) { + var ue = ne.show(u); + ue == null || ue.isFinished() || (K._disposers.push(ue), w != null && w > 0 && ue.delay(w)); + }), G; + }, R.prototype.dispose = function() { + U.prototype.dispose.call(this), _i(this.sprites, function(u) { + u.dispose(); + }), this.sprites = []; + }, R.prototype.hide = function(u, w, $, G) { + var K = this; + if (this.isHiding = !0, _i(this.sprites, function(ue) { + var we = ue.hide(u); + we == null || we.isFinished() || (K._disposers.push(we), w != null && w > 0 && we.delay(w)); + }), le($) && G) { + var ne; + if (_i(G, function(ue) { + var we = K.setWorkingValue(ue, $, u, w); + we && (ne = we); + }), ne && !ne.isFinished()) + return this._hideDisposer = ne.events.on("animationended", function() { + K.setVisibility(!1, !0), K.isHiding = !1; + }), this._disposers.push(this._hideDisposer), ne; + this.isHiding = !1, this.setVisibility(!1, !0); + } else + this.isHiding = !1, this.setVisibility(!1); + }, R.prototype.getDuration = function(u) { + if (!le(u)) { + var w = this.component; + w && (u = w.interpolationDuration); + } + if (u != null) + return this._adapterO ? this._adapterO.apply("duration", u) : u; + }, R.prototype.getValue = function(u, w) { + if (u && this.component) { + w || (w = this.component.dataFields[u + "Show"]) || (w = "value"); + var $ = this.values[u][w]; + return this._adapterO && this._adapterO.isEnabled("value") ? this._adapterO.apply("value", { value: $, field: u }).value : $; + } + }, R.prototype.getWorkingValue = function(u) { + if (u && this.component) { + var w = this.component.dataFields[u + "Show"]; + return w || (w = "workingValue"), this._adapterO ? this._adapterO.apply("workingValue", { workingValue: this.values[u][w], field: u }).workingValue : this.values[u][w]; + } + }, R.prototype.getActualWorkingValue = function(u) { + return this.values[u].workingValue; + }, R.prototype.setValue = function(u, w, $, G) { + var K = this.values[u].value, ne = this.getDuration($); + if (K !== (w = It(w))) { + if (this.values[u].value = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("valuechanged")) { + var ue = { type: "valuechanged", target: this, property: u }; + this.events.dispatchImmediately("valuechanged", ue); + } + this.component && this.component.handleDataItemValueChange(this, u); + } + this.setWorkingValue(u, w, ne, G); + }, R.prototype.setCalculatedValue = function(u, w, $) { + if (this.values[u][$] !== w && le(w)) { + if (this.values[u][$] = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("calculatedvaluechanged")) { + var G = { type: "calculatedvaluechanged", target: this, property: u }; + this.events.dispatchImmediately("calculatedvaluechanged", G); + } + this.component && this.component.handleDataItemCalculatedValueChange(this, u); + } + }, R.prototype.setWorkingValue = function(u, w, $, G) { + if (le(this.values[u].value)) { + var K = this.getDuration($), ne = this.values[u].workingValue; + if (K != null && K > 0 && le(ne) && this.component) { + if (ne != w) { + var ue = this.animate({ childObject: this.values[u], property: "workingValue", from: ne, to: w, dummyData: u }, K, this.component.interpolationEasing); + return G != null && ue.delay(G), ue.events.on("animationstarted", this.handleInterpolationProgress, this), ue.events.on("animationprogress", this.handleInterpolationProgress, this), ue.events.on("animationended", this.handleInterpolationProgress, this), this._valueAnimations[u] = ue, ue; + } + (we = this._valueAnimations[u]) && we.stop(), this.values[u].workingValue = w; + } else { + var we; + if ((we = this._valueAnimations[u]) && we.stop(), this.values[u].workingValue = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("workingvaluechanged")) { + var De = { type: "workingvaluechanged", target: this, property: u }; + this.events.dispatchImmediately("workingvaluechanged", De); + } + this.component && this.component.handleDataItemWorkingValueChange(this, u); + } + } + }, R.prototype.setLocation = function(u, w, $, G) { + if (this.locations[u] !== w) { + if (this.locations[u] = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("locationchanged")) { + var K = { type: "locationchanged", target: this, property: u }; + this.events.dispatchImmediately("locationchanged", K); + } + this.component && this.component.handleDataItemValueChange(this, u), this.setWorkingLocation(u, w, $, G); + } + }, R.prototype.setWorkingLocation = function(u, w, $, G) { + var K = this.getDuration($), ne = this.workingLocations[u]; + if (K != null && K > 0 && le(ne) && this.component) { + if (ne != w) { + var ue = this.animate({ childObject: this.workingLocations, property: u, from: ne, to: w, dummyData: u }, K, this.component.interpolationEasing); + return G != null && ue.delay(G), ue.events.on("animationstarted", this.handleInterpolationProgress, this), ue.events.on("animationprogress", this.handleInterpolationProgress, this), ue.events.on("animationended", this.handleInterpolationProgress, this), this._locationAnimations[u] = ue, ue; + } + (we = this._locationAnimations[u]) && we.stop(), this.workingLocations[u] = w; + } else { + var we; + if ((we = this._locationAnimations[u]) && we.stop(), this.workingLocations[u] = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("workinglocationchanged")) { + var De = { type: "workinglocationchanged", target: this, property: u }; + this.events.dispatchImmediately("workinglocationchanged", De); + } + this.component && this.component.handleDataItemWorkingLocationChange(this, u); + } + }, R.prototype.setDate = function(u, w, $) { + !wt(w) && this.component && (w = this.component.dateFormatter.parse(w)), this.dates[u] !== w && (this.dates[u] = w, this.setValue(u, w.getTime(), $)); + }, R.prototype.getDate = function(u) { + return this._adapterO ? this._adapterO.apply("date", { date: this.dates[u], field: u }).date : this.dates[u]; + }, R.prototype.setProperty = function(u, w) { + if (this.properties[u] !== w) { + if (this.hasProperties = !0, this.properties[u] = w, this._eventDispatcher && !this.__disabled && this.events.isEnabled("propertychanged")) { + var $ = { type: "propertychanged", target: this, property: u, value: w }; + this.events.dispatchImmediately("propertychanged", $); + } + this.component && this.component.handleDataItemPropertyChange(this, u); + } + }, R.prototype.setCategory = function(u, w) { + st(w) || (w = Mt(w)), this.categories[u] !== w && (this.categories[u] = w); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), u.dataContext && (this.dataContext = Wa(u.dataContext, {})), on(u.locations, this.locations), u._adapterO && this.adapter.copyFrom(u._adapterO), this.component = u.component; + }, Object.defineProperty(R.prototype, "opacity", { set: function(u) { + _i(this.sprites, function(w) { + w.opacity = u; + }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "ignoreMinMax", { get: function() { + return this._ignoreMinMax; + }, set: function(u) { + if (this._ignoreMinMax = u, this._eventDispatcher && !this.__disabled && this.events.isEnabled("propertychanged")) { + var w = { type: "propertychanged", target: this, property: "ignoreMinMax", value: u }; + this.events.dispatchImmediately("propertychanged", w); + } + this.component && this.component.handleDataItemPropertyChange(this, "ignoreMinMax"); + }, enumerable: !0, configurable: !0 }), R.prototype.animate = function(u, w, $) { + return new $f(this, u, w, $).start(); + }, R.prototype.handleInterpolationProgress = function(u) { + var w = u.target.animationOptions[0]; + if (w) { + if (this._eventDispatcher && !this.__disabled && this.events.isEnabled("workingvaluechanged")) { + var $ = { type: "workingvaluechanged", target: this, property: w.dummyData }; + this.events.dispatchImmediately("workingvaluechanged", $); + } + this.component && this.component.handleDataItemWorkingValueChange(this, w.dummyData); + } + }, R.prototype.hasValue = function(u) { + for (var w = 0, $ = u.length; w < $; w++) { + var G = this.values[u[w]]; + if (!G || !Ee(G.value)) + return !1; + } + return !0; + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.parent ? this.parent.depth + 1 : 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dataContext", { get: function() { + return this._dataContext; + }, set: function(u) { + this._dataContext = u; + }, enumerable: !0, configurable: !0 }), R.prototype.addSprite = function(u) { + u.dataItem && u.dataItem != this && ki(u.dataItem.sprites, u), this.visible || u.hide(0), this.isHiding && u.hide(), this.sprites.push(u), u.dataItem = this; + }, R; + }(vi), LC = function(U) { + function R() { + var u = U.call(this) || this; + return u.dataFields = {}, u._dataSources = {}, u._parseDataFrom = 0, u._dataDisposers = [], u._currentDataSetId = "", u._start = 0, u._end = 1, u.skipRangeEvent = !1, u.rangeChangeDuration = 0, u.rangeChangeEasing = W0, u.parsingStepDuration = 50, u.dataInvalid = !1, u.rawDataInvalid = !1, u.dataRangeInvalid = !1, u.dataItemsInvalid = !1, u.interpolationDuration = 0, u.interpolationEasing = W0, u.sequencedInterpolation = !0, u.sequencedInterpolationDelay = 0, u.dataValidationProgress = 0, u._addAllDataItems = !0, u._usesData = !0, u.className = "Component", u.minZoomCount = 1, u.maxZoomCount = 0, u._dataItems = new Im(u.createDataItem()), u._dataItems.events.on("inserted", u.handleDataItemAdded, u, !1), u._dataItems.events.on("removed", u.handleDataItemRemoved, u, !1), u._disposers.push(new Wo(u._dataItems)), u._disposers.push(u._dataItems.template), u.invalidateData(), u.dataUsers.events.on("inserted", u.handleDataUserAdded, u, !1), u._disposers.push(new kn(u._dataDisposers)), u._start = 0, u._end = 1, u.maxZoomDeclination = 1, u.applyTheme(), u; + } + return re(R, U), R.prototype.createDataItem = function() { + return new FC(); + }, R.prototype.handleDataUserAdded = function(u) { + u.newValue.dataProvider = this; + }, R.prototype.handleDataItemValueChange = function(u, w) { + this.dataItemsInvalid || this.invalidateDataItems(); + }, R.prototype.handleDataItemWorkingValueChange = function(u, w) { + }, R.prototype.handleDataItemWorkingLocationChange = function(u, w) { + }, R.prototype.handleDataItemCalculatedValueChange = function(u, w) { + }, R.prototype.handleDataItemPropertyChange = function(u, w) { + }, R.prototype.processDataItem = function(u, w) { + var $ = this; + if (u) { + w || (w = {}), u.dataContext = w; + var G = !1; + mi(this.dataFields, function(K, ne) { + var ue = K, we = w[ne]; + if ($._adapterO && $._adapterO.isEnabled("dataContextValue") && (we = $._adapterO.apply("dataContextValue", { field: ue, value: we, dataItem: u }).value), Ee(we)) + if (G = !0, u.hasChildren[ue]) { + var De = $.createDataItem(); + De.copyFrom($.mainDataSet.template); + var $e = new Im(De); + $e.events.on("inserted", $.handleDataItemAdded, $, !1), $e.events.on("removed", $.handleDataItemRemoved, $, !1), $._dataDisposers.push(new Wo($e)); + for (var Ke = we.length, Ze = 0; Ze < Ke; Ze++) { + var pt = we[Ze], Vt = $e.create(); + Vt.parent = u, $.processDataItem(Vt, pt); + } + u[ue] = $e; + } else + u[ue] = we; + }), mi(this.propertyFields, function(K, ne) { + var ue = K, we = w[ne]; + Ee(we) && (G = !0, u.setProperty(ue, we)); + }), this._addAllDataItems || G || this.mainDataSet.remove(u); + } + }, R.prototype.updateDataItem = function(u) { + var w = this; + if (u) { + var $ = u.dataContext; + mi(this.dataFields, function(G, K) { + var ne = G, ue = $[K]; + w._adapterO && (ue = w._adapterO.apply("dataContextValue", { field: ne, value: ue, dataItem: u }).value), Ee(ue) && (u.hasChildren[ne] ? u[ne].each(function(we) { + w.updateDataItem(we); + }) : u[ne] = ue); + }), mi(this.propertyFields, function(G, K) { + var ne = G, ue = $[K]; + Ee(ue) && u.setProperty(ne, ue); + }); + } + }, R.prototype.validateDataElements = function() { + for (var u = this.endIndex, w = this.startIndex; w < u; w++) { + var $ = this.dataItems.getIndex(w); + $ && this.validateDataElement($); + } + }, R.prototype.validate = function() { + this.validateDataElements(), U.prototype.validate.call(this); + }, R.prototype.validateDataElement = function(u) { + }, R.prototype.addData = function(u, w, $) { + var G = this; + if (!this.dataInvalid && this.inited && (this._parseDataFrom = this.data.length), $ || (u instanceof Array ? _i(u, function(K) { + G.data.push(K); + }) : this.data.push(u)), this.inited) + this.removeData(w, $); + else if (le(w)) + for (; w > 0; ) + this.data.shift(), w--; + this.invalidateData(); + }, R.prototype.removeData = function(u, w) { + if (le(u) && u > 0) { + for (; u > 0; ) { + var $ = this.mainDataSet.getIndex(0); + $ && this.mainDataSet.remove($), this.dataUsers.each(function(G) { + if (!G.data || G.data.length == 0) { + var K = G.mainDataSet.getIndex(0); + K && G.mainDataSet.remove(K); + } + }), w || this.data.shift(), this._parseDataFrom > 0 && this._parseDataFrom--, u--; + } + this.invalidateDataItems(); + } + }, R.prototype.invalidateData = function() { + this.disabled || this.isTemplate || (hi.addToInvalidComponents(this), qo.requestFrame(), this.dataInvalid = !0, er(this.dataUsers.iterator(), function(u) { + u.invalidateDataItems(); + })); + }, R.prototype.invalidateDataUsers = function() { + er(this.dataUsers.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.invalidateDataItems = function() { + this.disabled || this.isTemplate || (Ur(hi.invalidDataItems, this), qo.requestFrame(), this.dataItemsInvalid = !0, er(this.dataUsers.iterator(), function(u) { + u.invalidateDataItems(); + })); + }, R.prototype.invalidateDataRange = function() { + this.disabled || this.isTemplate || (this.dataRangeInvalid = !0, Ur(hi.invalidDataRange, this), qo.requestFrame()); + }, R.prototype.validateDataRange = function() { + ki(hi.invalidDataRange, this), this.dataRangeInvalid = !1, this.startIndex == this._prevStartIndex && this.endIndex == this._prevEndIndex || (this.rangeChangeUpdate(), this.appendDataItems(), this.invalidate(), this.dispatchImmediately("datarangechanged")); + }, R.prototype.sliceData = function() { + this._workingStartIndex = this.startIndex, this._workingEndIndex = this.endIndex; + }, R.prototype.rangeChangeUpdate = function() { + this.sliceData(), this._prevStartIndex = this.startIndex, this._prevEndIndex = this.endIndex; + }, R.prototype.appendDataItems = function() { + for (var u = this.endIndex, w = this.startIndex; w < u; w++) + ($ = this.dataItems.getIndex(w)) && ($.__disabled = !1); + for (w = 0; w < this.startIndex; w++) + ($ = this.dataItems.getIndex(w)) && ($.__disabled = !0); + for (w = this.endIndex; w < this.dataItems.length; w++) { + var $; + ($ = this.dataItems.getIndex(w)) && ($.__disabled = !0); + } + }, R.prototype.invalidateRawData = function() { + this.disabled || this.isTemplate || (Ur(hi.invalidRawDatas, this), qo.requestFrame(), this.rawDataInvalid = !0, er(this.dataUsers.iterator(), function(u) { + u.invalidateRawData(); + })); + }, R.prototype.validateRawData = function() { + var u = this; + ki(hi.invalidRawDatas, this), er(this.mainDataSet.iterator(), function(w) { + w && u.updateDataItem(w); + }); + }, R.prototype.dispose = function() { + var u = this; + this.mainDataSet.template.clones.clear(), mi(this._dataSources, function(w, $) { + u.removeDispose($); + }), this.disposeData(), U.prototype.dispose.call(this); + }, R.prototype.disposeData = function() { + this.mainDataSet.template.clones.clear(), _i(this._dataDisposers, function(u) { + u.dispose(); + }), er(this.dataUsers.iterator(), function(u) { + u.disposeData(); + }), this._dataDisposers.length = 0, this._startIndex = void 0, this._endIndex = void 0, this.mainDataSet.clear(), this.mainDataSet.template.clones.clear(), this._dataSets && this._dataSets.clear(); + }, R.prototype.getDataItem = function(u) { + return this.mainDataSet.create(); + }, R.prototype.validateData = function() { + if (this.dispatchImmediately("beforedatavalidated"), this.dataInvalid = !1, hi.removeFromInvalidComponents(this), !this.__disabled) { + if (this.dataValidationProgress = 0, this._prevStartIndex = void 0, this._prevEndIndex = void 0, this._startIndex = void 0, this._endIndex = void 0, this.dataFields.data && this.dataItem) { + var u = this.dataItem.dataContext; + this._data = u[this.dataFields.data]; + } + if (this._parseDataFrom === 0 && this.data.length > 0 && this.disposeData(), this.data.length > 0) { + var w = this.preloader; + er(this.dataUsers.iterator(), function($e) { + $e._startIndex = void 0, $e._endIndex = void 0; + }); + for (var $ = 0, G = Date.now(), K = this._parseDataFrom, ne = this.data.length, ue = function() { + var $e = we.data[K]; + if (we._usesData) { + var Ke = we.getDataItem($e); + we.processDataItem(Ke, $e); + } + if (we.dataUsers.each(function(Ze) { + if (Ze.data.length == 0) { + var pt = Ze.getDataItem($e); + Ze.processDataItem(pt, $e); + } + }), ++$ == 100 && ($ = 0, Date.now() - G > we.parsingStepDuration && K < we.data.length - 10)) + return we._parseDataFrom = K + 1, w && (K / we.data.length > 0.5 && !w.visible || (w.progress = K / we.data.length)), we.dataValidationProgress = K / we.data.length, K = we.data.length, we.invalidateData(), { value: void 0 }; + }, we = this; K < ne; K++) { + var De = ue(); + if (typeof De == "object") + return De.value; + } + w && (w.progress = 1), this.dataUsers.each(function($e) { + $e.hidden && $e.hide(0); + }); + } + this.dataValidationProgress = 1, this._parseDataFrom = 0, this.invalidateDataItems(), this._internalDefaultsApplied || this.applyInternalDefaults(), this.dispatch("datavalidated"); + } + }, R.prototype.validateDataItems = function() { + ki(hi.invalidDataItems, this), this.dataItemsInvalid = !1, this.invalidateDataRange(), this.invalidate(), this.dispatch("dataitemsvalidated"); + }, Object.defineProperty(R.prototype, "data", { get: function() { + return this._data || (this._data = []), this._adapterO ? this._adapterO.apply("data", this._data) : this._data; + }, set: function(u) { + this.setData(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setData = function(u) { + this.isDisposed() || (this._parseDataFrom = 0, this.disposeData(), this._data = u, u && u.length > 0 ? this.invalidateData() : (this.dispatchImmediately("beforedatavalidated"), this.dispatch("datavalidated"))); + }, R.prototype.getDataSource = function(u) { + var w = this; + return Ee(this._dataSources[u]) || (this._dataSources[u] = new G8(), this._dataSources[u].component = this, this.setDataSourceEvents(this._dataSources[u], u), this._dataSources[u].adapter.add("dateFields", function($) { + return w.dataSourceDateFields($); + }), this._dataSources[u].adapter.add("numberFields", function($) { + return w.dataSourceNumberFields($); + }), this.events.on("inited", function() { + w.loadData(u); + }, this, !1)), this._dataSources[u]; + }, Object.defineProperty(R.prototype, "dataSource", { get: function() { + return this._dataSources.data || this.getDataSource("data"), this._dataSources.data; + }, set: function(u) { + var w = this; + this._dataSources.data && this.removeDispose(this._dataSources.data), this._dataSources.data = u, this._dataSources.data.component = this, this.events.on("inited", function() { + w.loadData("data"); + }, this, !1), this.setDataSourceEvents(u, "data"); + }, enumerable: !0, configurable: !0 }), R.prototype.loadData = function(u) { + this._dataSources[u].load(); + }, R.prototype.dataSourceDateFields = function(u) { + return u; + }, R.prototype.dataSourceNumberFields = function(u) { + return u; + }, R.prototype.populateDataSourceFields = function(u, w, $) { + return _i($, function(G) { + w[G] && Ri(u, w[G]) === -1 && u.push(w[G]); + }), u; + }, R.prototype.setDataSourceEvents = function(u, w) { + var $ = this; + u.events.on("started", function(G) { + var K = $.preloader; + K && (K.progress = 0); + }, void 0, !1), u.events.on("loadstarted", function(G) { + var K = $.preloader; + K && (K.progress = 0.25); + }, void 0, !1), u.events.on("loadended", function(G) { + var K = $.preloader; + K && (K.progress = 0.5); + }, void 0, !1), u.events.on("parseended", function(G) { + var K = $.preloader; + K && (K.progress = 0.75); + }, void 0, !1), u.events.on("ended", function(G) { + var K = $.preloader; + K && (K.progress = 1); + }, void 0, !1), u.events.on("error", function(G) { + var K = $.preloader; + K && (K.progress = 1), $.openModal(G.message); + }, void 0, !1), w && u.events.on("done", function(G) { + var K = $.preloader; + K && (K.progress = 1), w != "data" || gt(G.data) || (G.data = [G.data]), u.incremental && w == "data" && $.data.length ? $.addData(G.data, u.keepCount ? G.data.length : 0) : u.updateCurrentData && w == "data" && $.data.length ? (_i($.data, function(ne, ue) { + Ee(G.data[ue]) && mi(ne, function(we, De) { + Ee(G.data[ue][we]) && (ne[we] = G.data[ue][we]); + }); + }), $.invalidateRawData()) : $[w] = G.data; + }); + }, Object.defineProperty(R.prototype, "responsive", { get: function() { + return this._responsive || (this._responsive = new bre(), this._responsive.component = this), this._responsive; + }, set: function(u) { + this._responsive = u, this._responsive.component = this; + }, enumerable: !0, configurable: !0 }), R.prototype.zoom = function(u, w, $, G) { + var K = this; + w === void 0 && (w = !1), $ === void 0 && ($ = !1); + var ne = u.start, ue = u.end, we = u.priority; + if (u.start == u.end && (u.start = u.start - 0.5 / this.maxZoomFactor, u.end = u.end + 0.5 / this.maxZoomFactor), we == "end" && ue == 1 && ne != 0 && ne < this.start && (we = "start"), we == "start" && ne == 0 && ue > this.end && (we = "end"), le(G) || (G = this.maxZoomDeclination), !le(ne) || !le(ue)) + return { start: this.start, end: this.end }; + if (this._finalStart != ne || this._finalEnd != ue) { + var De = this.maxZoomFactor / this.minZoomCount, $e = this.maxZoomFactor / this.maxZoomCount; + if (we == "start" ? (this.maxZoomCount > 0 && 1 / (ue - ne) < $e && (ue = ne + 1 / $e), 1 / (ue - ne) > De && (ue = ne + 1 / De), ue > 1 && ue - ne < 1 / De && (ne = ue - 1 / De)) : (this.maxZoomCount > 0 && 1 / (ue - ne) < $e && (ne = ue - 1 / $e), 1 / (ue - ne) > De && (ne <= 0 ? ue = ne + 1 / De : ne = ue - 1 / De), ne < 0 && ue - ne < 1 / De && (ue = ne + 1 / De)), ne < -G && (ne = -G), 1 / (ue - ne) > De && (ue = ne + 1 / De), ue > 1 + G && (ue = 1 + G), 1 / (ue - ne) > De && (ne = ue - 1 / De), this._finalEnd = ue, this._finalStart = ne, this.skipRangeEvent = w, this.dispatchImmediately("rangechangestarted"), this.rangeChangeDuration > 0 && !$) { + var Ke = this.rangeChangeAnimation; + if (Ke && Ke.progress < 1) { + var Ze = Ke.animationOptions; + if (Ze.length > 1) { + if (Ze[0].to == ne && Ze[1].to == ue) + return { start: ne, end: ue }; + Ke.isDisposed() || Ke.stop(); + } + } + this.rangeChangeAnimation && this.rangeChangeAnimation.kill(), Ke = this.animate([{ property: "start", to: ne }, { property: "end", to: ue }], this.rangeChangeDuration, this.rangeChangeEasing), this.rangeChangeAnimation = Ke, Ke && !Ke.isFinished() ? Ke.events.on("animationended", function() { + K.dispatchImmediately("rangechangeended"); + }) : this.dispatchImmediately("rangechangeended"); + } else + this.start = ne, this.end = ue, this.dispatch("rangechangeended"); + } + return { start: ne, end: ue }; + }, R.prototype.zoomToIndexes = function(u, w, $, G) { + if (le(u) && le(w)) { + var K = u / this.dataItems.length, ne = w / this.dataItems.length; + this.zoom({ start: K, end: ne }, $, G); + } + }, Object.defineProperty(R.prototype, "zoomFactor", { get: function() { + return mt(1 / (this.end - this.start), 1, this.maxZoomFactor); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxZoomFactor", { get: function() { + return this.getPropertyValue("maxZoomFactor"); + }, set: function(u) { + this.setPropertyValue("maxZoomFactor", u) && (u == 1 && (this.maxZoomDeclination = 0), this.invalidateDataRange()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxZoomDeclination", { get: function() { + return this.getPropertyValue("maxZoomDeclination"); + }, set: function(u) { + this.setPropertyValue("maxZoomDeclination", u) && this.invalidateDataRange(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startIndex", { get: function() { + return le(this._startIndex) || (this._startIndex = 0), this._startIndex; + }, set: function(u) { + this._startIndex = mt(Math.round(u), 0, this.dataItems.length), this.start = this.indexToPosition(this._startIndex); + }, enumerable: !0, configurable: !0 }), R.prototype.indexToPosition = function(u) { + return u / this.dataItems.length; + }, Object.defineProperty(R.prototype, "endIndex", { get: function() { + var u = this.dataItems.length; + return (!le(this._endIndex) || this._endIndex > u) && (this._endIndex = u), this._endIndex; + }, set: function(u) { + this._endIndex = mt(Math.round(u), 0, this.dataItems.length), this.end = this.indexToPosition(this._endIndex); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "start", { get: function() { + return this._adapterO ? this._adapterO.apply("start", this._start) : this._start; + }, set: function(u) { + if (this._start != u) { + this._start = u; + var w = Math.max(0, Math.floor(this.dataItems.length * u) || 0); + this._startIndex = Math.min(w, this.dataItems.length), this.invalidateDataRange(), this.invalidate(), this.dispatchImmediately("startchanged"), this.dispatch("startendchanged"); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "end", { get: function() { + return this._adapterO ? this._adapterO.apply("end", this._end) : this._end; + }, set: function(u) { + this._end != u && (this._end = u, this._endIndex = Math.min(this.dataItems.length, Math.ceil(this.dataItems.length * u) || 0), this.invalidateDataRange(), this.invalidate(), this.dispatchImmediately("endchanged"), this.dispatch("startendchanged")); + }, enumerable: !0, configurable: !0 }), R.prototype.removeFromInvalids = function() { + U.prototype.removeFromInvalids.call(this), hi.removeFromInvalidComponents(this), ki(hi.invalidDataItems, this), ki(hi.invalidDataRange, this), ki(hi.invalidRawDatas, this); + }, Object.defineProperty(R.prototype, "dataItems", { get: function() { + if (this._currentDataSetId != "") { + var u = this.dataSets.getKey(this._currentDataSetId); + if (u) + return u; + } + return this._dataItems; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dataSets", { get: function() { + return this._dataSets || (this._dataSets = new ha()), this._dataSets; + }, enumerable: !0, configurable: !0 }), R.prototype.setDataSet = function(u) { + if (this._currentDataSetId != u) { + if (this.dataSets.getKey(u)) + return this.dataItems.each(function(w) { + w.__disabled = !0; + }), this._currentDataSetId = u, this.invalidateDataRange(), this._prevStartIndex = void 0, this.dataItems.each(function(w) { + w.__disabled = !1; + }), !0; + if (this._currentDataSetId != "") + return this.dataItems.each(function(w) { + w.__disabled = !0; + }), this._currentDataSetId = "", this.invalidateDataRange(), this._prevStartIndex = void 0, this.dataItems.each(function(w) { + w.__disabled = !1; + }), !0; + } + return !1; + }, Object.defineProperty(R.prototype, "currentDataSetId", { get: function() { + return this._currentDataSetId; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "mainDataSet", { get: function() { + return this._dataItems; + }, enumerable: !0, configurable: !0 }), R.prototype._updateDataItemIndexes = function(u) { + for (var w = this.mainDataSet.values, $ = w.length, G = u; G < $; ++G) + w[G]._index = G; + }, R.prototype.handleDataItemAdded = function(u) { + u.newValue.component = this, this._updateDataItemIndexes(u.index), this.dataItemsInvalid || this.invalidateDataItems(); + }, R.prototype.handleDataItemRemoved = function(u) { + this._updateDataItemIndexes(u.index), this.dataItemsInvalid || this.invalidateDataItems(); + }, R.prototype.bindDataField = function(u, w) { + this.dataFields[u] = w, this.invalidateDataRange(); + }, R.prototype.invalidateProcessedData = function() { + this.resetProcessedRange(), this.invalidateDataRange(); + }, R.prototype.resetProcessedRange = function() { + this._prevEndIndex = null, this._prevStartIndex = null; + }, Object.defineProperty(R.prototype, "dataUsers", { get: function() { + var u = this; + return this._dataUsers || (this._dataUsers = new Hs(), this._disposers.push(new ln(function() { + er(u._dataUsers.iterator(), function(w) { + w.dispose(); + }); + }))), this._dataUsers; + }, enumerable: !0, configurable: !0 }), R.prototype.clone = function() { + var u = U.prototype.clone.call(this); + return u.dataFields = on(this.dataFields, {}), u; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.data = u.data, this.sequencedInterpolation = u.sequencedInterpolation, this.sequencedInterpolationDelay = u.sequencedInterpolationDelay, this.interpolationDuration = u.interpolationDuration, this.interpolationEasing = u.interpolationEasing; + }, R.prototype.reinit = function() { + this._inited = !1, this.deepInvalidate(); + }, R.prototype.getExporting = function() { + var u = U.prototype.getExporting.call(this); + return u.adapter.has("data", this._exportData, -1, this) || (u.adapter.add("data", this._exportData, -1, this), this.events.on("datavalidated", function(w) { + u.handleDataUpdated(); + })), u; + }, R.prototype._exportData = function(u) { + return u.data = this.data, u; + }, R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return w && this.invalidateData(), w; + }, R.prototype.setShowOnInit = function(u) { + u != this.getPropertyValue("showOnInit") && (!u || this.inited || this.hidden ? this._showOnInitDisposer2 && this.removeDispose(this._showOnInitDisposer2) : (this._showOnInitDisposer2 = this.events.once("dataitemsvalidated", this.hideInitially, this, !1), this._disposers.push(this._showOnInitDisposer2))), U.prototype.setShowOnInit.call(this, u); + }, R.prototype.setBaseId = function(u) { + u != this._baseId && this.dataInvalid && (this.dataInvalid = !1, hi.removeFromInvalidComponents(this), this._baseId = u, this.invalidateData()), U.prototype.setBaseId.call(this, u); + }, Object.defineProperty(R.prototype, "minZoomCount", { get: function() { + return this.getPropertyValue("minZoomCount"); + }, set: function(u) { + this.setPropertyValue("minZoomCount", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxZoomCount", { get: function() { + return this.getPropertyValue("maxZoomCount"); + }, set: function(u) { + this.setPropertyValue("maxZoomCount", u); + }, enumerable: !0, configurable: !0 }), R.prototype._systemCheckIfValidate = function() { + return !(this.dataInvalid || this.dataProvider && this.dataProvider.dataInvalid); + }, R.prototype.asFunction = function(u) { + return u == "interpolationEasing" || u == "rangeChangeEasing" || U.prototype.asIs.call(this, u); + }, R; + }(Qn); + hi.registeredClasses.Component = LC; + var Rm = function(U) { + function R() { + var u = U.call(this) || this; + return u.isOversized = !1, u.className = "Label", u.fill = new Fa().getFor("text"), u.wrap = !1, u.truncate = !1, u.fullWords = !0, u.ellipsis = "…", u.textAlign = "start", u.textValign = "top", u.layout = "absolute", u.baseLineRatio = -0.27, u._positionPrecision = 1, u.events.on("maxsizechanged", function() { + u.inited && u.handleMaxSize(); + }, u, !1), u.events.once("validated", u.handleValidate, u, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.afterDraw = function() { + U.prototype.afterDraw.call(this), this.validatePosition(); + }, R.prototype.setPaper = function(u) { + var w = U.prototype.setPaper.call(this, u); + return w && this.hardInvalidate(), w; + }, R.prototype.handleValidate = function() { + !this.currentText && !this.text || this.bbox.width != 0 && this.bbox.height != 0 || hi.events.once("exitframe", this.hardInvalidate, this); + }, R.prototype.handleMaxSize = function() { + (this.bbox.width > this.availableWidth || this.bbox.width < this.availableWidth && (this.isOversized || this.truncate) || this.bbox.height > this.availableHeight || this.bbox.height < this.availableHeight && this.isOversized) && this.invalidate(); + }, R.prototype.arrange = function() { + }, R.prototype.updateCurrentText = function() { + var u, w; + Ks(this.html) && this.paper.supportsForeignObject() ? (u = "html", w = this.html) : (u = "svg", w = this.text), ct(w) && (w = w.toString()), Ee(w) && w !== "" && (w = this.populateString(w, this.dataItem)), u == "html" ? this._adapterO && (w = this._adapterO.apply("htmlOutput", w)) : this._adapterO && (w = this._adapterO.apply("textOutput", w)); + var $ = w != this.currentText || u != this._currentFormat; + return this.currentText = w, this._currentFormat = u, $; + }, R.prototype.hardInvalidate = function() { + this._prevStatus = "", this.invalidate(); + }, R.prototype.getLineBBox = function(u) { + var w = u && u.element, $ = w && w.node; + $ && $.parentNode && (u.bbox = w.getBBox()); + }, R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.bbox.width, w = this.bbox.height, $ = this.topParent; + if (!$ || $.maxWidth && $.maxHeight) { + var G = ve(this.availableWidth - this.pixelPaddingLeft - this.pixelPaddingRight, 0), K = ve(this.availableHeight - this.pixelPaddingTop - this.pixelPaddingBottom, 0), ne = K + "," + G + this.wrap + this.truncate + this.fullWords + this.rtl + this.ellipsis; + if (this.updateCurrentText() || !this.inited || this._prevStatus != ne) { + this._measuredWidth = 0, this._measuredHeight = 0, this.isOversized = !1; + var ue = this._currentFormat, we = this.currentText; + if (Ee(we) && we != "") { + var De = we.split(` +`); + this._prevStatus = ne, this.textAlign = this.textAlign; + var $e = this.group.getAttr("display"); + if ($e == "none" && this.group.removeAttr("display"), this.textPathElement && this.textPathElement.removeChildren(), ue === "svg") { + this.element.removeAttr("display"); + var Ke = this.element; + this.resetBBox(); + for (var Ze = 0, pt = "", Vt = 0; Vt < De.length; Vt++) { + var Yt = De[Vt]; + if (Yt != "") { + var ci = Xv().chunk(Yt, null, this.ignoreFormatting), ai = 0, Gi = !0, Ji = !1, Ci = this.getLineInfo(Vt); + Ci ? (Ci.text = "", Ci.element.textContent = "") : (Ci = { text: "", element: this.getSVGLineElement("", 0), complex: !1 }, Ke.add(Ci.element)), Ci.element.removeAttr("display"), Ci.element.removeChildren(), this.textPathElement && Ci.element.add(this.textPathElement); + for (var Hi = 0; Hi < ci.length; Hi++) { + Hi && (Ci.complex = !0); + var sr = ci[Hi]; + if (sr.type === "format") + pt = sr.text; + else { + if (Ji) + continue; + if (Ci.text = sr.text, Ci.style = Xv().translateStyleShortcuts(pt), this.textPathElement ? this.getSvgElement(Ci.text, Ci.style, this.textPathElement) : this.getSvgElement(Ci.text, Ci.style, Ci.element), this.getLineBBox(Ci), Ci.bbox.width = Math.ceil(Ci.bbox.width), ai < Ci.bbox.height && (ai = Ci.bbox.height), (this.wrap || this.truncate) && Ci.bbox.width > G) { + this.isOversized = !0; + var Or = Ci.element.textContent, yr = Ci.bbox.width / Or.length, As = H(Math.ceil((Ci.bbox.width - G) / yr), Or.length); + if (this.truncate) { + var Fn = !1, Aa = Ci.element.node; + if (Aa && Aa.childNodes) + for (var hh = Ci.element.node.childNodes.length - 1; hh >= 0; hh--) { + var Np = Ci.element.node.childNodes[hh]; + if (Fn && Ci.bbox.width <= G && (Np.textContent += " " + this.ellipsis, Ci.bbox = Ci.element.getBBox(), Ci.bbox.width = Math.floor(Ci.bbox.width), Ci.bbox.width <= G)) + break; + Fn = !1; + var bl = Np.textContent; + for (Or = Ci.element.textContent, As = H(Math.ceil((Ci.bbox.width - G) / yr), Or.length); Ci.bbox.width > G && As <= Or.length && As > 0; ) + (Bs = ve(Or.length - As - this.ellipsis.length, 1)) <= 1 && (As = 0, hh > 0 && (Fn = !0, Ci.element.node.removeChild(Np))), (bl = fd(bl, Bs, this.ellipsis, this.fullWords, this.rtl)).length > Bs && this.fullWords && (bl = fd(bl, Bs, this.ellipsis, !1, this.rtl)), Np.textContent = bl, Ci.bbox = Ci.element.getBBox(), Ci.bbox.width = Math.floor(Ci.bbox.width), As = Math.ceil(1.1 * As); + Ji = !0; + } + } else if (Ci.element.node) { + for (var Vf = Ci.element.node.lastChild, ku = void 0; Ci.bbox.width > G && As <= Or.length && As > 0; ) { + var Bs = ve(sr.text.length - As, 1); + if (Gi ? ku = bh(sr.text, Bs, !0, this.rtl) : ((ku = bh(sr.text, Bs, !0, this.rtl, !1))[0].length > Bs || Bs === 1) && (Ci.element.node.removeChild(Vf), As = 0), As > 0) { + var yf = ku.shift(); + Gi && (yf = pf(yf)), Vf.textContent = Xv().cleanUp(yf); + } + Ci.bbox = Ci.element.getBBox(), Ci.bbox.width = Math.floor(Ci.bbox.width), As++; + } + if (ku.length > 0) { + var vf = ""; + Ee(ku) && (this.rtl ? vf += ku.join("") + pt : vf += pt + ku.join("").replace(/([\[\]]{1})/g, "$1$1")); + for (var Ps = Hi + 1; Ps < ci.length; Ps++) + ci[Ps].type == "value" ? vf += ci[Ps].text.replace(/([\[\]]{1})/g, "$1$1") : vf += ci[Ps].text; + De.splice(Vt + 1, 0, vf); + } + Ji = !0; + } + } + this.bbox.width < Ci.bbox.width && (this.bbox.width = Ci.bbox.width), this.bbox.height = Ze + ai, this.textPathElement ? Ci.element.attr({ dy: -this.paddingBottom.toString() }) : Ci.element.attr({ x: "0", y: Ze + ai, dy: He(this.baseLineRatio * ai, 3).toString() }), Gi = !1; + } + } + var zh = Ci.element.node; + zh && (Vf = zh.lastChild) && (Vf.textContent = this.rtl ? md(Vf.textContent) : wh(Vf.textContent)), Ze += ai, this.addLineInfo(Ci, Vt); + } else { + var au = this.getSVGLineElement("", 0); + au.add(this.getSvgElement(".", Xv().translateStyleShortcuts(pt))), Ke.add(au); + var dh = Math.ceil(au.getBBox().height); + dh > 0 && (Ze += dh), Ke.removeElement(au); + var tw = this.getLineInfo(Vt); + tw && (tw.text = "", tw.element.textContent = ""); + } + } + this.maybeHideOversized(), this.measureFailed = !1, this.bbox.width != 0 && this.bbox.height != 0 || (this.measureFailed = !0), this._measuredWidth = He(ve(this.bbox.width, this.pixelWidth - this.pixelPaddingLeft - this.pixelPaddingRight)), this._measuredHeight = He(ve(this.bbox.height, this.pixelHeight - this.pixelPaddingTop - this.pixelPaddingBottom)), this.alignSVGText(), this.bbox.width = this._measuredWidth, this.bbox.height = this._measuredHeight, w == this._measuredHeight && u == this._measuredWidth || this.dispatch("transformed"), this.hideUnused(De.length); + } else { + this.element.removeAttr("display"), this.resetBBox(), (Ke = this.element).removeChildren(), this.setCache("lineInfo", [], 0); + var gg = this.paper.foreignObject(); + Ke.add(gg), this.maxWidth && gg.attr({ width: this.maxWidth - this.pixelPaddingLeft - this.pixelPaddingRight }), this.maxHeight && gg.attr({ height: this.maxHeight - this.pixelPaddingTop - this.pixelPaddingBottom }); + var jf = this.getHTMLLineElement(we); + gg.node.appendChild(jf), jf.style.display = "inline-block"; + var Qv = jf.clientWidth, iw = jf.clientHeight; + jf.style.display = "block", this._bbox = { x: 0, y: 0, width: Qv, height: iw }, gg.attr({ width: Qv + 1, height: iw }), this.maybeHideOversized(), this._measuredWidth = ve(this.bbox.width, this.pixelWidth - this.pixelPaddingLeft - this.pixelPaddingRight), this._measuredHeight = ve(this.bbox.height, this.pixelHeight - this.pixelPaddingTop - this.pixelPaddingBottom), this.bbox.width = this._measuredWidth, this.bbox.height = this._measuredHeight, this.truncate && (jf.style.overflow = "hidden"), (Qv > G || iw > K) && (this.isOversized = !0); + } + this.setStyles(), this.updateCenter(), this.updateBackground(), $e == "none" && this.group.attr({ display: "none" }), this.pathElement && this.paper.appendDef(this.pathElement); + } else + this.element.attr({ display: "none" }); + } + } else + $.events.once("maxsizechanged", this.hardInvalidate, this, !1); + }, R.prototype.maybeHideOversized = function() { + this.hideOversized && (this.availableWidth < this.bbox.width || this.availableHeight < this.bbox.height ? (this.element.attr({ display: "none" }), this.isOversized = !0) : (this.element.removeAttr("display"), this.isOversized = !1)); + }, R.prototype.alignSVGText = function() { + var u = this.element, w = u.node.children || u.node.childNodes; + if (w && (!w || w.length != 0)) { + var $ = this._measuredWidth, G = this._measuredHeight; + this.pixelPaddingLeft, this.pixelPaddingRight, this.pixelPaddingTop, this.pixelPaddingBottom, this.rtl ? u.attr({ direction: "rtl" }) : u.removeAttr("direction"); + for (var K = w.length - 1; K >= 0; K--) { + var ne = w[K]; + if (ne.setAttribute("text-anchor", this.textAlign), this.textPathElement) + ne.removeAttribute("x"), ne.removeAttribute("y"); + else { + switch (this.textAlign) { + case "middle": + ne.setAttribute("x", ($ / 2).toString() + "px"); + break; + case "end": + this.rtl || ne.setAttribute("x", $.toString()); + break; + default: + this.rtl ? ne.setAttribute("x", $.toString()) : ne.removeAttribute("text-anchor"); + } + var ue = It(ne.getAttribute("y")); + switch (this.textValign) { + case "middle": + ne.setAttribute("y", ((ue || 0) + (G - this.bbox.height) / 2).toString()); + break; + case "bottom": + ne.setAttribute("y", ((ue || 0) + G - this.bbox.height).toString()); + break; + default: + ne.setAttribute("y", (ue || 0).toString()); + } + } + } + } + }, R.prototype.getSVGLineElement = function(u, w) { + var $ = this.paper.addGroup("text"); + return $.textContent = u, $.attr({ x: "0" }), Ee(w) && $.attr({ y: w.toString() }), (this.truncate || this.wrap) && $.attr({ overflow: "hidden" }), $; + }, Object.defineProperty(R.prototype, "rtl", { get: function() { + return Ee(this._rtl) ? this._rtl : !!this._topParent && this._topParent.rtl; + }, set: function(u) { + u = Tt(u), this._rtl = u, this.element && this.alignSVGText(); + }, enumerable: !0, configurable: !0 }), R.prototype.resetBBox = function() { + this._bbox = { x: 0, y: 0, width: 0, height: 0 }; + }, R.prototype.getHTMLLineElement = function(u) { + var w = document.createElement("div"); + switch (w.innerHTML = u, this.textAlign) { + case "middle": + w.style.textAlign = "center"; + break; + case "end": + w.style.textAlign = "right"; + } + return this.wrap ? w.style.wordWrap = "break-word" : w.style.whiteSpace = "nowrap", this.rtl && (w.style.direction = "rtl"), Ee(this.fill) && (w.style.color = this.fill.toString()), w; + }, R.prototype.setStyles = function() { + var u = this.element; + !this.selectable || this.draggable || this.resizable || this.swipeable ? u.addStyle({ webkitUserSelect: "none", msUserSelect: "none" }) : this.selectable && (u.removeStyle("webkitUserSelect"), u.removeStyle("msUserSelect")); + }, R.prototype.hideUnused = function(u) { + this.initLineCache(); + var w = this.getCache("lineInfo"); + if (w.length >= u) + for (var $ = u; $ < w.length; $++) { + var G = w[$]; + G && G.element && G.element.attr({ display: "none" }); + } + }, Object.defineProperty(R.prototype, "text", { get: function() { + return this.getPropertyValue("text"); + }, set: function(u) { + this.setPropertyValue("text", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "path", { get: function() { + return this.getPropertyValue("path"); + }, set: function(u) { + this.setPropertyValue("path", u, !0) && (this.pathElement && this.pathElement.dispose(), this.textPathElement && this.textPathElement.dispose(), this.pathElement = this.paper.add("path"), this.pathElement.attr({ d: u }), this.pathElement.attr({ id: "text-path-" + this.uid }), this._disposers.push(this.pathElement), this.textPathElement = this.paper.addGroup("textPath"), this.textPathElement.attrNS(xC, "xlink:href", "#text-path-" + this.uid), this.textPathElement.attr({ path: u }), this._disposers.push(this.textPathElement), this.hardInvalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "locationOnPath", { get: function() { + return this.getPropertyValue("locationOnPath"); + }, set: function(u) { + this.setPropertyValue("locationOnPath", u), this.textPathElement && this.textPathElement.attr({ startOffset: 100 * u + "%" }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "baseLineRatio", { get: function() { + return this.getPropertyValue("baseLineRatio"); + }, set: function(u) { + this.setPropertyValue("baseLineRatio", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wrap", { get: function() { + return this.getPropertyValue("wrap"); + }, set: function(u) { + this.resetBBox(), this.setPropertyValue("wrap", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "truncate", { get: function() { + return this.getPropertyValue("truncate"); + }, set: function(u) { + this.resetBBox(), this.setPropertyValue("truncate", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fullWords", { get: function() { + return this.getPropertyValue("fullWords"); + }, set: function(u) { + this.setPropertyValue("fullWords", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "ellipsis", { get: function() { + return this.getPropertyValue("ellipsis"); + }, set: function(u) { + this.setPropertyValue("ellipsis", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "selectable", { get: function() { + return this.getPropertyValue("selectable"); + }, set: function(u) { + this.setPropertyValue("selectable", u, !0), this.setStyles(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "textAlign", { get: function() { + return this.getPropertyValue("textAlign"); + }, set: function(u) { + this.setPropertyValue("textAlign", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "textValign", { get: function() { + return this.getPropertyValue("textValign"); + }, set: function(u) { + this.setPropertyValue("textValign", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "html", { get: function() { + return this.getPropertyValue("html"); + }, set: function(u) { + this.setPropertyValue("html", u, !0), Ee(u) || this.element.removeChildrenByTag("foreignObject"); + }, enumerable: !0, configurable: !0 }), R.prototype.setFill = function(u) { + if (U.prototype.setFill.call(this, u), this.html) + for (var w = this.element.node.getElementsByTagName("div"), $ = 0; $ < w.length; $++) { + var G = w[$]; + Ee(this.fill) && (G.style.color = this.fill.toString()); + } + }, Object.defineProperty(R.prototype, "hideOversized", { get: function() { + return this.getPropertyValue("hideOversized"); + }, set: function(u) { + this.setPropertyValue("hideOversized", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "ignoreFormatting", { get: function() { + return this.getPropertyValue("ignoreFormatting"); + }, set: function(u) { + this.setPropertyValue("ignoreFormatting", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.measureElement = function() { + }, R.prototype.getLineInfo = function(u) { + this.initLineCache(); + var w = this.getCache("lineInfo"); + return w.length > u ? w[u] : void 0; + }, R.prototype.addLineInfo = function(u, w) { + this.initLineCache(), this.getCache("lineInfo")[w] = u; + }, R.prototype.initLineCache = function() { + Ee(this.getCache("lineInfo")) || this.setCache("lineInfo", [], 0); + }, R.prototype.setDataItem = function(u) { + this._sourceDataItemEvents && this._sourceDataItemEvents.dispose(), u && (this._sourceDataItemEvents = new kn([u.events.on("valuechanged", this.invalidate, this, !1), u.events.on("workingvaluechanged", this.invalidate, this, !1), u.events.on("calculatedvaluechanged", this.invalidate, this, !1), u.events.on("propertychanged", this.invalidate, this, !1)])), U.prototype.setDataItem.call(this, u); + }, Object.defineProperty(R.prototype, "availableWidth", { get: function() { + return Ee(this.maxWidth) ? this.maxWidth : this.pixelWidth; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "availableHeight", { get: function() { + return Ee(this.maxHeight) ? this.maxHeight : this.pixelHeight; + }, enumerable: !0, configurable: !0 }), R.prototype.getSvgElement = function(u, w, $) { + var G = this.paper.add("tspan"); + return G.textContent = u, w && G.node.setAttribute("style", w), $ && $.add(G), G; + }, R.prototype.deepInvalidate = function() { + U.prototype.deepInvalidate.call(this), this.hardInvalidate(); + }, Object.defineProperty(R.prototype, "readerTitle", { get: function() { + var u = this.getPropertyValue("readerTitle"); + return u ? this.dataItem && (u = this.populateString(u)) : u = this.populateString(Sh(Ks(this.html) ? this.html : this.text)), u; + }, set: function(u) { + u = Nt(u), this.setPropertyValue("readerTitle", u) && this.applyAccessibility(); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.Label = Rm, Wd.push({ relevant: gf.heightXS, state: function(U, R) { + if (U instanceof Rm && U.parent && U.parent.isBaseSprite) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var L1 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RoundedRectangle", u.element = u.paper.add("path"), u.cornerRadius(3, 3, 3, 3), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.innerWidth, w = this.innerHeight; + if (le(u) && le(w)) { + var $ = H(u, w) / 2, G = vs(this.cornerRadiusTopLeft, $), K = vs(this.cornerRadiusTopRight, $), ne = vs(this.cornerRadiusBottomRight, $), ue = vs(this.cornerRadiusBottomLeft, $), we = H(Math.abs(u / 2), Math.abs(w / 2)), De = mt(G, 0, we), $e = mt(K, 0, we), Ke = mt(ne, 0, we), Ze = mt(ue, 0, we), pt = "M" + De + ",0 L" + (u - $e) + ",0 a" + $e + "," + $e + " 0 0 1 " + $e + "," + $e + " L" + u + "," + (w - Ke) + " a" + Ke + "," + Ke + " 0 0 1 -" + Ke + "," + Ke + " L" + Ze + "," + w + " a" + Ze + "," + Ze + " 0 0 1 -" + Ze + ",-" + Ze + " L0," + De + " a" + De + "," + De + " 0 0 1 " + De + ",-" + De + " Z"; + this.path = pt; + } + }, R.prototype.cornerRadius = function(u, w, $, G) { + this.cornerRadiusTopLeft = u, this.cornerRadiusTopRight = w, this.cornerRadiusBottomLeft = $, this.cornerRadiusBottomRight = G; + }, Object.defineProperty(R.prototype, "cornerRadiusTopLeft", { get: function() { + return this.getPropertyValue("cornerRadiusTopLeft"); + }, set: function(u) { + this.setPercentProperty("cornerRadiusTopLeft", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cornerRadiusTopRight", { get: function() { + return this.getPropertyValue("cornerRadiusTopRight"); + }, set: function(u) { + this.setPercentProperty("cornerRadiusTopRight", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cornerRadiusBottomRight", { get: function() { + return this.getPropertyValue("cornerRadiusBottomRight"); + }, set: function(u) { + this.setPercentProperty("cornerRadiusBottomRight", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cornerRadiusBottomLeft", { get: function() { + return this.getPropertyValue("cornerRadiusBottomLeft"); + }, set: function(u) { + this.setPercentProperty("cornerRadiusBottomLeft", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.measureElement = function() { + }, Object.defineProperty(R.prototype, "bbox", { get: function() { + return this.definedBBox ? this.definedBBox : this.isMeasured ? { x: 0, y: 0, width: this.innerWidth, height: this.innerHeight } : { x: 0, y: 0, width: 0, height: 0 }; + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.RoundedRectangle = L1; + var t2 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Button", u.tooltipY = 0, u.iconPosition = "left", u.layout = "horizontal", u.contentAlign = "center", u.contentValign = "middle", u.padding(8, 16, 8, 16), u.setStateOnChildren = !0; + var w = new Fa(), $ = u.background; + $.fill = w.getFor("secondaryButton"), $.stroke = w.getFor("secondaryButtonStroke"), $.fillOpacity = 1, $.strokeOpacity = 1, $.cornerRadius(3, 3, 3, 3), u.label = new Rm(), u.label.fill = w.getFor("secondaryButtonText"), u.label.shouldClone = !1; + var G = $.states.create("hover"); + G.properties.fillOpacity = 1, G.properties.fill = w.getFor("secondaryButtonHover"); + var K = $.states.create("down"); + return K.transitionDuration = 100, K.properties.fill = w.getFor("secondaryButtonDown"), K.properties.fillOpacity = 1, u.role = "button", u.focusable = !0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "icon", { get: function() { + return this._icon; + }, set: function(u) { + var w = this._icon; + w && (w.parent = void 0), u && (this._icon = u, u.parent = this, u.interactionsEnabled = !1, u.shouldClone = !1, this.iconPosition = this.iconPosition, this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "iconPosition", { get: function() { + return this.getPropertyValue("iconPosition"); + }, set: function(u) { + this.setPropertyValue("iconPosition", u), this.icon && (u == "left" ? this.icon.toBack() : this.icon.toFront()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "label", { get: function() { + return this._label; + }, set: function(u) { + this._label && this.removeDispose(this._label), this._label = u, u && (u.parent = this, u.interactionsEnabled = !1, this._disposers.push(this._label)); + }, enumerable: !0, configurable: !0 }), R.prototype.createBackground = function() { + return new L1(); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), u.label && this.label.copyFrom(u.label), u.icon && (this.icon = u.icon.clone()); + }, R; + }(Qn); + hi.registeredClasses.Button = t2; + var NC = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Circle", u.element = u.paper.add("circle"), u.setPercentProperty("radius", ce(100)), u.setPropertyValue("horizontalCenter", "middle"), u.setPropertyValue("verticalCenter", "middle"), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), this.element.attr({ r: this.pixelRadius }); + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelRadius", { get: function() { + return vs(this.radius, H(this.innerWidth / 2, this.innerHeight / 2)); + }, enumerable: !0, configurable: !0 }), R.prototype.measureElement = function() { + var u = this.pixelRadius; + this._bbox = { x: -u, y: -u, width: 2 * u, height: 2 * u }; + }, R; + }(so); + hi.registeredClasses.Circle = NC; + var U8 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Ellipse", u.element = u.paper.add("ellipse"), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), this.element.attr({ rx: this.radius }), this.element.attr({ ry: this.radiusY }); + }, Object.defineProperty(R.prototype, "radiusY", { get: function() { + return this.innerHeight / 2; + }, set: function(u) { + this.height = 2 * u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.innerWidth / 2; + }, set: function(u) { + this.width = 2 * u, this.invalidate(); + }, enumerable: !0, configurable: !0 }), R; + }(NC); + hi.registeredClasses.Ellipse = U8; + var yL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Image", u.element = u.paper.add("image"), u.applyTheme(), u.width = 50, u.height = 50, u; + } + return re(R, U), R.prototype.draw = function() { + if (U.prototype.draw.call(this), this.href) { + var u = this.innerWidth, w = this.innerHeight; + le(this.widthRatio) && (u = w * this.widthRatio, this.width = u), le(this.heightRatio) && (w = u * this.heightRatio, this.height = w), this.element.attr({ width: u, height: w }), this.element.attrNS(xC, "xlink:href", this.href); + } + }, Object.defineProperty(R.prototype, "href", { get: function() { + return this.getPropertyValue("href"); + }, set: function(u) { + this.setPropertyValue("href", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "widthRatio", { get: function() { + return this.getPropertyValue("widthRatio"); + }, set: function(u) { + this.setPropertyValue("widthRatio", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "heightRatio", { get: function() { + return this.getPropertyValue("heightRatio"); + }, set: function(u) { + this.setPropertyValue("heightRatio", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bbox", { get: function() { + return { x: 0, y: 0, width: this.pixelWidth, height: this.pixelHeight }; + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Image = yL; + var q0 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Line", u.element = u.paper.add("line"), u.fill = We(), u.x1 = 0, u.y1 = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), this.x1 == this.x2 || this.y1 == this.y2 ? this.pixelPerfect = !0 : this.pixelPerfect = !1, this.x1 = this.x1, this.x2 = this.x2, this.y1 = this.y1, this.y2 = this.y2; + }, Object.defineProperty(R.prototype, "x1", { get: function() { + return this.getPropertyValue("x1"); + }, set: function(u) { + le(u) || (u = 0); + var w = 0; + this.pixelPerfect && this.stroke instanceof qg && (w = 1e-5), this.setPropertyValue("x1", u, !0), this.element.attr({ x1: u + w }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "x2", { get: function() { + var u = this.getPropertyValue("x2"); + return le(u) || (u = this.pixelWidth), u; + }, set: function(u) { + le(u) || (u = 0), this.setPropertyValue("x2", u, !0), this.element.attr({ x2: u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y1", { get: function() { + return this.getPropertyValue("y1"); + }, set: function(u) { + le(u) || (u = 0); + var w = 0; + this.pixelPerfect && this.stroke instanceof qg && (w = 1e-5), this.setPropertyValue("y1", u, !0), this.element.attr({ y1: u + w }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y2", { get: function() { + var u = this.getPropertyValue("y2"); + return le(u) || (u = this.pixelHeight), u; + }, set: function(u) { + le(u) || (u = 0), this.setPropertyValue("y2", u, !0), this.element.attr({ y2: u }); + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u) { + var w = { x: this.x1, y: this.y1 }, $ = { x: this.x2, y: this.y2 }, G = Z(w, $, u), K = se(w, $); + return { x: G.x, y: G.y, angle: K }; + }, R; + }(so); + hi.registeredClasses.Line = q0; + var wre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PointedShape", u.pointerBaseWidth = 15, u.pointerLength = 10, u.pointerY = 0, u.pointerX = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), le(this.pointerX) || (this.pointerX = this.pixelWidth / 2), le(this.pointerY) || (this.pointerY = this.pixelHeight + 10); + }, Object.defineProperty(R.prototype, "pointerBaseWidth", { get: function() { + return this.getPropertyValue("pointerBaseWidth"); + }, set: function(u) { + this.setPropertyValue("pointerBaseWidth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pointerLength", { get: function() { + return this.getPropertyValue("pointerLength"); + }, set: function(u) { + this.setPropertyValue("pointerLength", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pointerX", { get: function() { + return this.getPropertyValue("pointerX"); + }, set: function(u) { + this.setPropertyValue("pointerX", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pointerY", { get: function() { + return this.getPropertyValue("pointerY"); + }, set: function(u) { + this.setPropertyValue("pointerY", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(so), xre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PointedRectangle", u.element = u.paper.add("path"), u.cornerRadius = 6, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.cornerRadius, w = this.innerWidth, $ = this.innerHeight; + if (w > 0 && $ > 0) { + var G, K, ne = this.pointerX, ue = this.pointerY, we = this.pointerBaseWidth / 2, De = H(w / 2, $ / 2), $e = mt(u, 0, De), Ke = mt(u, 0, De), Ze = mt(u, 0, De), pt = mt(u, 0, De), Vt = void 0, Yt = void 0, ci = void 0, ai = void 0, Gi = (ne - 0) * ($ - 0) - (ue - 0) * (w - 0), Ji = (ne - 0) * (0 - $) - (ue - $) * (w - 0); + Vt = Gi > 0 && Ji > 0 ? "M" + $e + ",0 L" + ((G = mt(ne, $e + we, w - we - Ke)) - we) + ",0 L" + ne + "," + (ue = mt(ue, -1 / 0, 0)) + " L" + (G + we) + ",0 L" + (w - Ke) + ",0" : "M" + $e + ",0 L" + (w - Ke) + ",0", ci = Gi < 0 && Ji < 0 ? " L" + (w - Ze) + "," + $ + " L" + ((G = mt(ne, pt + we, w - we - Ze)) + we) + "," + $ + " L" + ne + "," + (ue = mt(ue, $, 1 / 0)) + " L" + (G - we) + "," + $ + " L" + pt + "," + $ : " L" + pt + "," + $, ai = Gi < 0 && Ji > 0 ? " L0," + ($ - pt) + " L0," + ((K = mt(ue, $e + we, $ - pt - we)) + we) + " L" + (ne = mt(ne, -1 / 0, 0)) + "," + ue + " L0," + (K - we) + " L0," + $e : " L0," + $e, Yt = Gi > 0 && Ji < 0 ? " L" + w + "," + Ke + " L" + w + "," + ((K = mt(ue, Ke + we, $ - we - Ze)) - we) + " L" + (ne = mt(ne, w, 1 / 0)) + "," + ue + " L" + w + "," + (K + we) + " L" + w + "," + ($ - Ze) : " L" + w + "," + ($ - Ze); + var Ci = " a" + Ke + "," + Ke + " 0 0 1 " + Ke + "," + Ke, Hi = " a" + Ze + "," + Ze + " 0 0 1 -" + Ze + "," + Ze, sr = " a" + pt + "," + pt + " 0 0 1 -" + pt + ",-" + pt, Or = " a" + $e + "," + $e + " 0 0 1 " + $e + ",-" + $e; + this.path = Vt + Ci + Yt + Hi + ci + sr + ai + Or; + } + }, Object.defineProperty(R.prototype, "cornerRadius", { get: function() { + return this.getPropertyValue("cornerRadius"); + }, set: function(u) { + this.setPropertyValue("cornerRadius", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(wre); + function Z3(U) { + var R = xr(U[0]), u = { x: 0, y: 0 }, w = zd.minPolylineStep; + le(w) || (w = 0.5); + for (var $ = 0, G = U.length; $ < G; $++) { + var K = U[$]; + C(K, u) > w && (R += xr(K), u = K); + } + return R; + } + function pn(U) { + return " M" + He(U.x, 4) + "," + He(U.y, 4) + " "; + } + function xr(U) { + return " L" + He(U.x, 4) + "," + He(U.y, 4) + " "; + } + function i2(U, R) { + return " Q" + He(R.x, 4) + "," + He(R.y, 4) + " " + He(U.x, 4) + "," + He(U.y, 4); + } + function aA(U, R, u) { + return " C" + He(R.x, 4) + "," + He(R.y, 4) + " " + He(u.x, 4) + "," + He(u.y, 4) + " " + He(U.x, 4) + "," + He(U.y, 4); + } + function l_e() { + return " Z"; + } + function gd(U, R, u, w) { + if (R == 0) + return ""; + le(w) || (w = u); + var $ = "", G = ",", K = Math.ceil(Math.abs(R) / 180), ne = 1; + R < 0 && (ne = 0); + var ue = 0, we = 0, De = -A(U) * u, $e = -Ue(U) * w; + if (R < 0.5 && u > 3e3) + return xr({ x: pt = He(A(Ze = U + R) * u, 4), y: Vt = He(Ue(Ze) * w, 4) }); + for (var Ke = 0; Ke < K; Ke++) { + var Ze, pt, Vt; + $ += " a" + u + G + w + G + 0 + G + 0 + G + ne + G + (pt = He(A(Ze = U + R / K * (Ke + 1)) * u + De - ue, 4)) + G + (Vt = He(Ue(Ze) * w + $e - we, 4)), ue = pt, we = Vt; + } + return $; + } + function r2(U, R, u, w, $, G, K) { + if (R == 0 || (le(w) || (w = 0), u == 0 && w <= 0)) + return ""; + if (u < w) { + var ne = u; + u = w, w = ne, le($) && ($ = $ / w * u); + } + (R = H(R, 360)) == 360 && (G = 0, K = 0); + var ue = U + R, we = Ue(H(R, 45) / 2), De = ($ = le($) ? $ : u) / u * w, $e = $ / u * (G = G || 0), Ke = $ / u * (K = le(K) ? K : G); + G = mt(G, 0, (u - w) / 2), $e = mt($e, 0, ($ - De) / 2), K = mt(K, 0, (u - w) / 2), Ke = mt(Ke, 0, ($ - De) / 2), G = He(mt(G, 0, u * we), 4), $e = He(mt($e, 0, $ * we), 4), K = He(mt(K, 0, w * we), 4), Ke = He(mt(Ke, 0, De * we), 4); + var Ze = Math.asin(G / u / 2) * it * 2, pt = Math.asin($e / $ / 2) * it * 2; + w < K && (w = K), De < Ke && (De = Ke); + var Vt = Math.asin(K / w / 2) * it * 2, Yt = Math.asin(Ke / De / 2) * it * 2; + le(Vt) || (Vt = 0), le(Yt) || (Yt = 0); + var ci = U + R / 2, ai = { x: He(A(ci) * w, 4), y: Ue(ci) * De }, Gi = { x: A(U) * (w + K), y: Ue(U) * (De + Ke) }, Ji = { x: A(U) * (u - G), y: Ue(U) * ($ - $e) }, Ci = { x: A(ue) * (u - G), y: Ue(ue) * ($ - $e) }, Hi = { x: A(ue) * (w + K), y: Ue(ue) * (De + Ke) }, sr = { x: A(U + Ze) * u, y: Ue(U + pt) * $ }, Or = { x: A(ue - Vt) * w, y: Ue(ue - Yt) * De }; + K += K * Ue(Vt / 2), Ke += Ke * Ue(Yt / 2), Vt > (ue - U) / 2 && (Or = ai); + var yr = ""; + return R == 360 ? yr = pn(Ji) : (yr = pn(Gi), yr += xr(Ji), yr += Uy(sr, G, $e, !0)), yr += gd(U + Ze, R - 2 * Ze, u, $), le(w) && w != 0 ? (R == 360 && G == 0 ? yr += pn(Hi) : (yr += Uy(Ci, G, $e, !0), yr += xr(Hi), yr += Uy(Or, K, Ke, !0)), yr += gd(ue - Vt, -(R - 2 * Vt), w, De), (R < 360 || G > 0) && (yr += Uy(Gi, K, Ke, !0)), yr += xr(Gi)) : (yr += Uy(Ci, G, $e, !0), R < 360 && (yr += xr(Gi))), yr; + } + function Uy(U, R, u, w, $, G) { + if (R == 0) + return ""; + var K = ","; + return " A" + R + K + u + K + (G = G || 0) + K + +($ = !!$) + K + +(w = !!w) + K + He(U.x, 4) + K + He(U.y, 4); + } + function z8(U, R, u, w) { + return le(u) || (u = 0), le(w) || (w = 0), pn({ x: u, y: w }) + xr({ x: u + U, y: w }) + xr({ x: u + U, y: w + R }) + xr({ x: u, y: w + R }) + " Z"; + } + function n2(U, R) { + var u = ",", w = " L"; + return R ? "M" + U.x + u + U.y + w + U.x + u + (U.y + U.height) + w + (U.x + U.width) + u + (U.y + U.height) + w + (U.x + U.width) + u + U.y + w + U.x + u + U.y : "M" + U.x + u + U.y + w + (U.x + U.width) + u + U.y + w + (U.x + U.width) + u + (U.y + U.height) + w + U.x + u + (U.y + U.height) + w + U.x + u + U.y; + } + function u_e(U, R) { + var u = Yb().add("path").node; + if (u.setAttribute("d", U), u.getPointAtLength && u.getTotalLength) { + for (var w = u.getTotalLength(), $ = [], G = 0; G < R; G++) { + var K = u.getPointAtLength(G / R * w); + $.push({ x: K.x, y: K.y }); + } + return $; + } + u.remove(); + } + function c_e(U, R, u, w, $, G, K, ne, ue) { + le(ne) || (ne = 0), le(ne) || (ue = ne); + for (var we = $ + 0.01, De = ne * Ae, $e = []; we < u + K; ) { + var Ke = G; + if (Ke / 2 > we && (Ke = 2 * we), (De += 2 * Math.asin(Ke / 2 / we)) * it > ue + (u - $) / K * 360) + break; + var Ze = De * it, pt = { x: U + we * Math.cos(De), y: R + we * w / u * Math.sin(De) }; + $e.push(pt), we = $ + Ze / 360 * K; + } + return $e.shift(), $e; + } + function h_e(U) { + if (!U || U.length == 0) + return ""; + var R = pn(U[0]); + if (U && U.length > 0) + for (var u = 1; u < U.length; u++) + R += xr(U[u]); + return R; + } + var Q3 = function(U) { + function R() { + var u = U.call(this) || this; + return u._distance = 0, u.className = "Polyline", u.element = u.paper.add("path"), u.shapeRendering = "auto", u.fill = We(), u.strokeOpacity = 1, u.applyTheme(), u; + } + return re(R, U), R.prototype.makePath = function() { + this._distance = 0; + var u = this.segments; + if (u && u.length > 0) { + for (var w = "", $ = 0, G = u.length; $ < G; $++) { + var K = u[$]; + if (K.length > 0) { + w += pn(K[0]); + for (var ne = 1; ne < K.length; ne++) { + var ue = K[ne]; + w += xr(ue), this._distance += C(K[ne - 1], ue); + } + } + } + this.path = w; + } + this._realSegments = u; + }, Object.defineProperty(R.prototype, "segments", { get: function() { + return this.getPropertyValue("segments"); + }, set: function(u) { + this.setPropertyValue("segments", u), this.makePath(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "distance", { get: function() { + return this._distance; + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u) { + var w = 0; + u < 0 && (u = Math.abs(u), w = 180); + var $ = this._realSegments; + if ($) { + for (var G = this.distance, K = 0, ne = 0, ue = 0, we = void 0, De = void 0, $e = 0; $e < $.length; $e++) { + var Ke = $[$e]; + if (Ke.length > 1) { + for (var Ze = 1; Ze < Ke.length; Ze++) + if (ne = K / G, ue = (K += C(we = Ke[Ze - 1], De = Ke[Ze])) / G, ne <= u && ue > u) { + $e = $.length; + break; + } + } else + Ke.length == 1 && (we = Ke[0], De = Ke[0], ne = 0, ue = 1); + } + if (we && De) { + var pt = Z(we, De, (u - ne) / (ue - ne)); + return { x: pt.x, y: pt.y, angle: w + se(we, De) }; + } + } + return { x: 0, y: 0, angle: 0 }; + }, Object.defineProperty(R.prototype, "realSegments", { get: function() { + return this._realSegments; + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Polyline = Q3; + var mH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Polyarc", u.controlPointDistance = 0.5, u.controlPointPosition = 0.5, u.applyTheme(), u; + } + return re(R, U), R.prototype.makePath = function() { + this._distance = 0; + var u = this.segments; + if (u && u.length > 0) { + var w = ""; + this._realSegments = []; + for (var $ = 0, G = u.length; $ < G; $++) { + var K = u[$], ne = []; + if (this._realSegments.push(ne), K.length > 0) { + w += pn(K[0]); + for (var ue = 1; ue < K.length; ue++) { + var we = K[ue - 1], De = K[ue], $e = C(De, we), Ke = $e * this.controlPointDistance, Ze = this.controlPointPosition, pt = -se(we, De), Vt = { x: we.x + (De.x - we.x) * Ze * 0.5 - Ke * Ue(pt), y: we.y + (De.y - we.y) * Ze * 0.5 - Ke * A(pt) }, Yt = { x: we.x + (De.x - we.x) * Ze * 1.5 - Ke * Ue(pt), y: we.y + (De.y - we.y) * Ze * 1.5 - Ke * A(pt) }; + w += aA(De, Vt, Yt); + var ci = Math.ceil($e), ai = we; + if (ci > 0) + for (var Gi = 0; Gi <= ci; Gi++) { + var Ji = Pt(we, De, Vt, Yt, Gi / ci); + ne.push(Ji), this._distance += C(ai, Ji), ai = Ji; + } + else + ne.push(we); + } + } + } + this.path = w; + } + }, Object.defineProperty(R.prototype, "controlPointPosition", { get: function() { + return this.getPropertyValue("controlPointPosition"); + }, set: function(u) { + this.setPropertyValue("controlPointPosition", u), this.makePath(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "controlPointDistance", { get: function() { + return this.getPropertyValue("controlPointDistance"); + }, set: function(u) { + this.setPropertyValue("controlPointDistance", u), this.makePath(); + }, enumerable: !0, configurable: !0 }), R; + }(Q3); + hi.registeredClasses.Polyarc = mH; + var Sre = function(U) { + function R(u) { + var w = U.call(this) || this; + return w._bboxes = [], w.morphDuration = 800, w.morphEasing = W0, w.morphToSingle = !0, w.scaleRatio = 1, w.className = "Morpher", w.morphable = u, w.applyTheme(), w; + } + return re(R, U), R.prototype.morphToPolygon = function(u, w, $) { + var G = this.morphable.currentPoints; + if (G && u) { + this.sortPoints(G), this.sortPoints(u), this._morphFromPointsReal = [], this._morphToPointsReal = [], Ee(w) || (w = this.morphDuration), Ee($) || ($ = this.morphEasing), this._morphFromPointsReal = this.normalizePoints(u, G), this._morphToPointsReal = this.normalizePoints(G, u), this.morphable.currentPoints = this._morphFromPointsReal; + var K = new $f(this, { property: "morphProgress", from: 0, to: 1 }, w, $); + return this._disposers.push(K), K.start(), K; + } + }, R.prototype.normalizePoints = function(u, w) { + for (var $ = 0, G = u.length; $ < G; $++) { + var K = u[$][0], ne = u[$][1], ue = Be(Ce(K)), we = ue.x + ue.width, De = ue.y + ue.height; + if (w[$] || (w[$] = []), K && !w[$][0] && (w[$][0] = [{ x: we, y: De }, { x: we, y: De }]), w[$][0]) { + w[$][0] = this.addPoints(w[$][0], K.length); + for (var $e = 1 / 0, Ke = 0, Ze = 0; Ze < w[$][0].length; Ze++) { + var pt = C(w[$][0][Ze], K[0]); + pt < $e && (Ke = Ze, $e = pt); + } + var Vt = w[$][0].slice(0, Ke), Yt = w[$][0].slice(Ke); + w[$][0] = Yt.concat(Vt); + } + ne && (w[$][1] || (w[$][1] = [{ x: we, y: De }, { x: we, y: De }]), w[$][1] = this.addPoints(w[$][1], ne.length)); + } + return w; + }, R.prototype.sortPoints = function(u) { + u.sort(function(ne, ue) { + var we = Be(Ce(ne[0])), De = Be(Ce(ue[0])); + return we.width * we.height > De.width * De.height ? -1 : 1; + }); + for (var w = [], $ = 0, G = u.length; $ < G; $++) { + var K = u[$][0]; + K && w.push(Be(Ce(K))); + } + return Ve(w); + }, R.prototype.morphToCircle = function(u, w, $) { + var G = this.morphable.points, K = this.sortPoints(G); + this._morphFromPointsReal = [], this._morphToPointsReal = [], Ee(w) || (w = this.morphDuration), Ee($) || ($ = this.morphEasing); + for (var ne = 0, ue = G.length; ne < ue; ne++) { + var we = G[ne][0], De = G[ne][1]; + if (this._morphFromPointsReal[ne] = [], this._morphToPointsReal[ne] = [], we) { + var $e = we, Ke = we, Ze = Be(Ce(Ke)); + this.morphToSingle && (Ze = Be(K)); + var pt = Ze.x + Ze.width / 2, Vt = Ze.y + Ze.height / 2, Yt = u; + le(Yt) || (Yt = Math.min(Ze.width / 2, Ze.height / 2)), $e = []; + var ci = se({ x: pt, y: Vt }, we[0]), ai = 100; + we.length > ai && (ai = we.length); + for (var Gi = 360 / ((ai = (Ke = this.addPoints(we, ai)).length) - 1), Ji = 0; Ji < ai; Ji++) { + var Ci = Gi * Ji + ci, Hi = { x: pt + Yt * A(Ci), y: Vt + Yt * Ue(Ci) }; + $e[Ji] = Hi; + } + if (De && De.length > 0) + for (var sr = 0, Or = De.length; sr < Or; sr++) + $e.push({ x: pt, y: Vt }); + this._morphFromPointsReal[ne][0] = Ke, this._morphToPointsReal[ne][0] = $e; + } + } + this.morphable.currentPoints = this._morphFromPointsReal; + var yr = new $f(this, { property: "morphProgress", from: 0, to: 1 }, w, $); + return this._disposers.push(yr), yr.start(), yr; + }, R.prototype.addPoints = function(u, w) { + for (var $ = Math.round(w / u.length), G = [], K = 0, ne = u.length; K < ne; K++) { + var ue, we = u[K]; + ue = K == u.length - 1 ? u[0] : u[K + 1], G.push(we); + for (var De = 1; De < $; De++) { + var $e = De / $, Ke = { x: we.x + (ue.x - we.x) * $e, y: we.y + (ue.y - we.y) * $e }; + G.push(Ke); + } + G.length + u.length - K == w && ($ = 0); + } + if (G.length < w && u.length > 0) { + var Ze = u[u.length - 1]; + for (De = G.length; De < w; De++) + G.push({ x: Ze.x, y: Ze.y }); + } + return G; + }, R.prototype.morphToRectangle = function(u, w, $, G) { + var K = this.morphable.points; + this.sortPoints(K), this._morphFromPointsReal = [], this._morphToPointsReal = [], Ee($) || ($ = this.morphDuration), Ee(G) || (G = this.morphEasing); + for (var ne = 0, ue = K.length; ne < ue; ne++) { + var we = K[ne][0], De = K[ne][1]; + if (this._morphFromPointsReal[ne] = [], this._morphToPointsReal[ne] = [], we) { + var $e = we, Ke = we, Ze = this._bboxes[ne]; + this.morphToSingle; + var pt = Ze.x, Vt = Ze.y, Yt = u, ci = w; + if (le(Yt) || (Yt = Ze.width), le(ci) || (ci = Ze.height), $e = [{ x: pt, y: Vt }, { x: pt + Yt, y: Vt }, { x: pt + Yt, y: Vt + ci }, { x: pt, y: Vt + ci }], $e = this.addPoints($e, we.length), we.length < 4) + for (var ai = we.length; ai < 4; ai++) + $e.push({ x: we[ai].x, y: we[ai].y }); + if (De && De.length > 0) + for (var Gi = Ze.x + Ze.width / 2, Ji = Ze.y + Ze.height / 2, Ci = 0, Hi = De.length; Ci < Hi; Ci++) + $e.push({ x: Gi, y: Ji }); + this._morphFromPointsReal[ne][0] = Ke, this._morphToPointsReal[ne][0] = $e; + } + } + this.morphable.currentPoints = this._morphFromPointsReal; + var sr = new $f(this, { property: "morphProgress", from: 0, to: 1 }, $, G); + return this._disposers.push(sr), sr.start(), sr; + }, Object.defineProperty(R.prototype, "morphProgress", { get: function() { + return this._morphProgress; + }, set: function(u) { + this._morphProgress = u; + var w = []; + if (u != null) { + var $ = this._morphFromPointsReal, G = this._morphToPointsReal; + if ($ != null && G != null) + for (var K = 0, ne = $.length; K < ne; K++) { + var ue = []; + w.push(ue); + var we = $[K][0], De = $[K][1], $e = G[K][0], Ke = G[K][1]; + if (we && we.length > 0 && $e && $e.length > 0) { + for (var Ze = [], pt = 0, Vt = we.length; pt < Vt; pt++) { + var Yt = we[pt], ci = $e[pt], ai = { x: Yt.x + (ci.x * this.scaleRatio - Yt.x) * u, y: Yt.y + (ci.y * this.scaleRatio - Yt.y) * u }; + Ze.push(ai); + } + ue[0] = Ze; + } + if (De && De.length > 0 && Ke && Ke.length > 0) { + for (var Gi = [], Ji = 0, Ci = De.length; Ji < Ci; Ji++) + Yt = De[Ji], ci = Ke[Ji], ai = { x: Yt.x + (ci.x * this.scaleRatio - Yt.x) * u, y: Yt.y + (ci.y * this.scaleRatio - Yt.y) * u }, Gi.push(ai); + ue[1] = Gi; + } + } + } + this.morphable.currentPoints = w; + }, enumerable: !0, configurable: !0 }), R.prototype.morphBack = function(u, w) { + this._morphToPointsReal = this._morphFromPointsReal, this._morphFromPointsReal = this.morphable.currentPoints, Ee(u) || (u = this.morphDuration), Ee(w) || (w = this.morphEasing); + var $ = new $f(this, { property: "morphProgress", from: 0, to: 1 }, u, w); + return this._disposers.push($), $.start(), $; + }, Object.defineProperty(R.prototype, "animations", { get: function() { + return this._animations || (this._animations = [], this._disposers.push(new Wb(this._animations))), this._animations; + }, enumerable: !0, configurable: !0 }), R; + }(Ht), lA = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Polygon", u.element = u.paper.add("path"), u.shapeRendering = "auto", u._currentPoints = [], u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "points", { get: function() { + var u = this.getPropertyValue("points"), w = this.path; + if (w && (!u || u.length == 0)) { + for (var $ = w.slice(1, w.length - 1).split("ZM"), G = 0; G < $.length; G++) { + var K = $[G]; + if (K.length > 0) { + var ne = K.split("M"), ue = ne[0], we = ne[1]; + if (ue && ue.length > 0) { + var De = ue.split("L"); + if (De.length > 0) { + var $e = [], Ke = [$e]; + u.push(Ke); + for (var Ze = 0; Ze < De.length; Ze++) { + var pt = De[Ze].split(","); + $e.push({ x: +pt[0], y: +pt[1] }); + } + if (we && we.length > 0) { + var Vt = we.split("L"); + if (Vt.length > 0) { + var Yt = []; + for (Ke.push(Yt), Ze = Vt.length - 1; Ze >= 0; Ze--) + pt = Vt[Ze].split(","), Yt.push({ x: +pt[0], y: +pt[1] }); + } + } + } + } + } + } + this.setPropertyValue("points", u), this._currentPoints = u; + } + return u; + }, set: function(u) { + this.setPropertyValue("points", u, !0), this._currentPoints = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "currentPoints", { get: function() { + return this._currentPoints && this._currentPoints.length != 0 || !this.path || (this._currentPoints = this.points), this._currentPoints; + }, set: function(u) { + this._currentPoints != u && (this._currentPoints = u, this.draw()); + }, enumerable: !0, configurable: !0 }), R.prototype.draw = function() { + var u, w, $, G, K = "", ne = this._currentPoints; + if (ne.length > 0) { + for (var ue = 0, we = ne.length; ue < we; ue++) { + var De = ne[ue][0], $e = ne[ue][1]; + if (De && De.length > 0) { + K += pn(Ze = De[0]); + for (var Ke = 0; Ke < De.length; Ke++) + K += xr(Ze = De[Ke]), (!le(w) || w < Ze.x) && (w = Ze.x), (!le(u) || u > Ze.x) && (u = Ze.x), (!le($) || $ > Ze.y) && ($ = Ze.y), (!le(G) || G < Ze.y) && (G = Ze.y); + } + if ($e && $e.length > 0) { + var Ze; + K += pn(Ze = $e[0]); + for (var pt = 0, Vt = $e.length; pt < Vt; pt++) + K += xr(Ze = $e[pt]); + } + } + K && (K += " Z"), this.bbox.x = u, this.bbox.y = $, this.bbox.width = w - u, this.bbox.height = G - $, U.prototype.setPath.call(this, K); + } + }, R.prototype.setPath = function(u) { + return !!U.prototype.setPath.call(this, u) && (this.points = [], this._bbox = this.group.getBBox(), !0); + }, R.prototype.measureElement = function() { + }, Object.defineProperty(R.prototype, "centerPoint", { get: function() { + return { x: this.bbox.x + this.bbox.width / 2, y: this.bbox.y + this.bbox.height / 2 }; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "morpher", { get: function() { + return this._morpher || (this._morpher = new Sre(this), this._disposers.push(this._morpher)), this._morpher; + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Polygon = lA; + var eR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Polyspline", u.tensionX = 0.5, u.tensionY = 0.5, u.applyTheme(), u; + } + return re(R, U), R.prototype.makePath = function() { + this._distance = 0; + var u = this.segments, w = this.tensionX, $ = this.tensionY; + if (this.allPoints = [], u && u.length > 0) { + var G = ""; + this._realSegments = []; + for (var K = 0, ne = u.length; K < ne; K++) { + var ue = u[K], we = []; + if (this._realSegments.push(we), ue.length > 0) { + var De = ue[0], $e = ue[ue.length - 1], Ke = !1; + He(De.x, 3) == He($e.x) && He(De.y) == He($e.y) && (Ke = !0), G += pn(ue[0]); + for (var Ze = 0; Ze < ue.length - 1; Ze++) { + var pt = ue[Ze - 1], Vt = ue[Ze], Yt = ue[Ze + 1], ci = ue[Ze + 2]; + Ze === 0 ? pt = ue[Ze] : Ze == ue.length - 2 && (ci = ue[Ze + 1]), ci || (ci = Yt), Ze === 0 ? pt = Ke ? ue[ue.length - 2] : ue[K] : Ze == ue.length - 2 && (ci = Ke ? ue[1] : ue[Ze + 1]); + var ai = $t(pt, Vt, Yt, 0, w, $), Gi = qe(0, Vt, Yt, ci, w, $); + G += aA(Yt, ai, Gi); + var Ji = 1.2 * Math.ceil(B(Vt, Yt, ai, Gi, 20)), Ci = Vt; + if (Ji > 0) + for (var Hi = 0; Hi <= Ji; Hi++) { + var sr = Pt(Vt, Yt, ai, Gi, Hi / Ji); + if (sr.x != Ci.x || sr.y != Ci.y) { + we.push(sr); + var Or = He(se(Ci, sr), 5); + this._distance += C(Ci, sr), this.allPoints[Math.floor(this._distance)] = { x: sr.x, y: sr.y, angle: Or }, Ci = sr; + } + } + else + we.push(pt); + } + } + var yr = this.allPoints; + if (yr.length > 1) { + for (var As = 0; As < yr.length; As++) + if (!yr[As]) { + if (As > 1) + yr[As] = yr[As - 1]; + else + for (var Fn = 1; Fn < yr.length; Fn++) + if (yr[Fn]) { + yr[As] = yr[Fn]; + break; + } + } + } + } + this.path = G; + } + }, R.prototype.getClosestPointIndex = function(u) { + var w, $ = this.allPoints, G = 1 / 0; + if ($.length > 1) + for (var K = 1; K < $.length; K++) { + var ne = C(u, $[K]); + ne < G && (w = K, G = ne); + } + return w; + }, Object.defineProperty(R.prototype, "tensionX", { get: function() { + return this.getPropertyValue("tensionX"); + }, set: function(u) { + this.setPropertyValue("tensionX", u), this.makePath(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tensionY", { get: function() { + return this.getPropertyValue("tensionY"); + }, set: function(u) { + this.setPropertyValue("tensionY", u, !0), this.makePath(); + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u, w) { + var $ = 0, G = this.allPoints, K = G.length; + if (le(u) || (u = 0), K > 1) { + if (w && K > 3) { + if (u < 0) { + u < -0.01 && (u = -0.01); + var ne = G[0], ue = G[1]; + return { x: we = ne.x - (ne.x - ue.x) * K * u, y: De = ne.y - (ne.y - ue.y) * K * u, angle: se(ne, ue) }; + } + var we, De; + if (u > 1) + return u > 1.01 && (u = 1.01), ne = G[G.length - 2], ue = G[G.length - 3], { x: we = ne.x + (ne.x - ue.x) * K * (u - 1), y: De = ne.y + (ne.y - ue.y) * K * (u - 1), angle: se(ne, { x: we, y: De }) }; + if (u == 1) { + var $e = G[G.length - 1]; + return { x: $e.x, y: $e.y, angle: $e.angle }; + } + } else + u < 0 && (u = Math.abs(u), $ = 180), u >= 1 && (u = 0.9999999999999); + var Ke; + return { x: (Ke = G[Math.floor(u * K)]).x, y: Ke.y, angle: Ke.angle + $ }; + } + return K == 1 ? { x: (Ke = G[0]).x, y: Ke.y, angle: Ke.angle } : { x: 0, y: 0, angle: 0 }; + }, R; + }(Q3); + hi.registeredClasses.Polyspline = eR; + var kC = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Slice", u.setPropertyValue("cornerRadius", 0), u.setPropertyValue("startAngle", 0), u.setPercentProperty("innerRadius", 0), u.setPercentProperty("radius", 0), u.setPropertyValue("arc", 0), u.setPropertyValue("shiftRadius", 0), u.strokeOpacity = 1, u.setPropertyValue("layout", "none"), u.slice = u.createChild(so), u.slice.isMeasured = !1, u._disposers.push(u.slice), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.radiusY; + this.radius > 0 && u == 0 && (u = 0.01), this.slice.path = r2(this.startAngle, this.arc, this.radius, this.pixelInnerRadius, u, this.cornerRadius, this.innerCornerRadius), this.slice.invalidate(), this.shiftRadius = this.shiftRadius, this.realFill instanceof Yg && this.updateGradient(this.realFill), this.realStroke instanceof Yg && this.updateGradient(this.realStroke); + }, R.prototype.updateGradient = function(u) { + u.element.attr({ gradientUnits: "userSpaceOnUse" }), u.element.attr({ r: this.radius }), u.cx = 0, u.cy = 0, u.element.attr({ radius: this.radius }); + }, Object.defineProperty(R.prototype, "bbox", { get: function() { + return this.definedBBox ? this.definedBBox : this.isMeasured ? Ve([Xt(this.startAngle, this.startAngle + this.arc, this.pixelInnerRadius), Xt(this.startAngle, this.startAngle + this.arc, this.radius)]) : { x: 0, y: 0, width: 0, height: 0 }; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", Zt(u), !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "arc", { get: function() { + return this.getPropertyValue("arc"); + }, set: function(u) { + le(u) || (u = 0), this.setPropertyValue("arc", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + var u = this.getPropertyValue("radius"); + return le(u) || (u = 0), u; + }, set: function(u) { + this.setPropertyValue("radius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radiusY", { get: function() { + var u = this.getPropertyValue("radiusY"); + return le(u) || (u = this.radius), u; + }, set: function(u) { + this.setPropertyValue("radiusY", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return vs(this.innerRadius, this.radius); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cornerRadius", { get: function() { + return this.getPropertyValue("cornerRadius"); + }, set: function(u) { + this.setPropertyValue("cornerRadius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerCornerRadius", { get: function() { + return this.getPropertyValue("innerCornerRadius"); + }, set: function(u) { + this.setPropertyValue("innerCornerRadius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "shiftRadius", { get: function() { + return this.getPropertyValue("shiftRadius"); + }, set: function(u) { + this.setPropertyValue("shiftRadius", u), u = this.getPropertyValue("shiftRadius"), this.dx = u * this.radius * this.ix, this.dy = u * this.radiusY * this.iy; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "ix", { get: function() { + return A(this.middleAngle); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "iy", { get: function() { + return Ue(this.middleAngle); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "middleAngle", { get: function() { + return this.startAngle + this.arc / 2; + }, enumerable: !0, configurable: !0 }), R.prototype.getTooltipX = function() { + var u = this.getPropertyValue("tooltipX"); + if (le(u)) + return u; + var w = 0.5; + u instanceof J && (w = u.value); + var $ = vs(this.innerRadius, this.radius); + return this.ix * ($ + (this.radius - $) * w); + }, R.prototype.getTooltipY = function() { + var u = this.getPropertyValue("tooltipY"); + if (le(u)) + return u; + var w = 0.5; + u instanceof J && (w = u.value); + var $ = vs(this.innerRadius, this.radius); + return this.iy * ($ + (this.radius - $) * w) + this.slice.dy; + }, R; + }(Qn); + hi.registeredClasses.Slice = kC; + var s2 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Preloader", u.width = ce(100), u.height = ce(100); + var w = new Fa(), $ = u.createChild(Qn); + $.shouldClone = !1; + var G = $.createChild(kC); + G.shouldClone = !1, G.radius = 53, G.arc = 360, G.fill = w.getFor("fill"), G.fillOpacity = 0.8, G.innerRadius = 42, G.isMeasured = !1, u.backgroundSlice = G; + var K = $.createChild(kC); + K.shouldClone = !1, K.radius = 50, K.innerRadius = 45, K.fill = w.getFor("alternativeBackground"), K.fillOpacity = 0.2, K.isMeasured = !1, u.progressSlice = K; + var ne = $.createChild(Rm); + return ne.shouldClone = !1, ne.horizontalCenter = "middle", ne.verticalCenter = "middle", ne.isMeasured = !1, ne.fill = w.getFor("text"), ne.align = "center", ne.valign = "middle", ne.textAlign = "middle", ne.fillOpacity = 0.4, u.label = ne, u.background.opacity = 1, u.background.fill = w.getFor("background"), u.contentAlign = "center", u.contentValign = "middle", u.delay = 300, u.states.create("hidden").properties.opacity = 0, u.visible = !1, u.hide(0), u.__disabled = !0, u._disposers.push(u.backgroundSlice), u._disposers.push(u.progressSlice), u._disposers.push(u.label), u._disposers.push($), u; + } + return re(R, U), Object.defineProperty(R.prototype, "progress", { get: function() { + return this.getPropertyValue("progress"); + }, set: function(u) { + var w = this; + this.__disabled = !1, this.validateLayout(), this.setPropertyValue("progress", u), this.progressSlice.arc = 360 * u, this.label && (this.label.text = Math.round(100 * u) + "%"), u >= 1 ? (this._started && (this._started = void 0), hi.events.once("enterframe", function() { + var $ = w.hide(); + $ && !$.isFinished() ? $.events.once("animationended", function() { + w.__disabled = !0; + }) : w.__disabled = !0; + }), this.interactionsEnabled = !1, this.setPropertyValue("progress", 0)) : u > 0 && (this.delay ? this._started ? this._started + this.delay <= (/* @__PURE__ */ new Date()).getTime() && (this.__disabled = !1, this.show(), this.interactionsEnabled = !0) : this._started = (/* @__PURE__ */ new Date()).getTime() : (this.__disabled = !1, this.show(), this.interactionsEnabled = !0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "delay", { get: function() { + return this.getPropertyValue("delay"); + }, set: function(u) { + this.setPropertyValue("delay", u); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.Preloader = s2; + var vL = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "ResizeButton", u.orientation = "horizontal", u.layout = "absolute", u.horizontalCenter = "middle", u.verticalCenter = "middle", u.draggable = !0, u.padding(8, 8, 8, 8), u.background.cornerRadius(20, 20, 20, 20); + var w = new so(); + w.element = u.paper.add("path"); + var $ = pn({ x: -2, y: -6 }); + return $ += xr({ x: -2, y: 6 }), $ += pn({ x: 2, y: -6 }), $ += xr({ x: 2, y: 6 }), w.path = $, w.pixelPerfect = !0, w.padding(0, 4, 0, 4), w.stroke = new Fa().getFor("alternativeText"), w.strokeOpacity = 0.7, u.icon = w, u.label.dispose(), u.label = void 0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "orientation", { set: function(u) { + var w = this.icon; + w && (w.rotation = u == "horizontal" ? 0 : -90); + }, enumerable: !0, configurable: !0 }), R; + }(t2); + hi.registeredClasses.ResizeButton = vL; + var Cre = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "CloseButton", u.padding(8, 8, 8, 8), u.showSystemTooltip = !0, u.width = 30, u.height = 30; + var w = new Fa(); + u.cursorOverStyle = vl.pointer; + var $ = u.background; + $.cornerRadius(20, 20, 20, 20); + var G = w.getFor("background"); + $.fill = G, $.stroke = w.getFor("primaryButton"), $.strokeOpacity = 1, $.strokeWidth = 1; + var K = w.getFor("primaryButtonActive"), ne = $.states.getKey("hover"); + ne.properties.strokeWidth = 3, ne.properties.fill = G; + var ue = $.states.getKey("down"); + ue.properties.stroke = K, ue.properties.fill = G; + var we = new so(); + return we.element = u.paper.add("path"), we.stroke = $.stroke, u.icon = we, u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + U.prototype.validate.call(this); + var u = this.pixelWidth / 3, w = this.pixelHeight / 3, $ = pn({ x: -u / 2, y: -w / 2 }); + $ += xr({ x: u / 2, y: w / 2 }), $ += pn({ x: u / 2, y: -w / 2 }), $ += xr({ x: -u / 2, y: w / 2 }), this.icon.path = $, this.invalidateLayout(); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Close")); + }, R; + }(t2); + hi.registeredClasses.CloseButton = Cre; + var _L = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "SwitchButton", u.tooltipY = 0, u.layout = "horizontal", u.contentAlign = "center", u.contentValign = "middle", u.padding(8, 16, 8, 16), u.setStateOnChildren = !0, u.states.create("active"); + var w = new Fa(), $ = new Rm(); + $.fillOpacity = 0.3, $.states.create("active").properties.fillOpacity = 1, $.isActive = !0, u.leftLabel = $; + var G = new t2(), K = new NC(); + G.contentValign = "none", G.padding(0, 0, 0, 0), K.radius = 10, G.icon = K, G.icon.valign = "middle", G.label = void 0; + var ne = ce(100); + G.background.cornerRadius(ne, ne, ne, ne), G.width = 3.5 * K.radius, G.height = 2.1 * K.radius, G.marginLeft = 8, G.marginRight = 8, G.togglable = !0, K.dx = 0.7 * -K.radius, K.fill = w.getFor("primaryButton"), K.states.create("hover").properties.fill = w.getFor("primaryButtonHover"); + var ue = K.states.create("active"); + ue.properties.fill = w.getFor("primaryButtonActive"), ue.properties.dx = 0.7 * K.radius, u.switchButton = G, u.events.on("toggled", function() { + u.leftLabel.isActive = !u.isActive, u.rightLabel.isActive = u.isActive; + }); + var we = new Rm(); + return we.fillOpacity = 0.3, we.states.create("active").properties.fillOpacity = 1, u.rightLabel = we, u.role = "button", u.focusable = !0, we.valign = "middle", $.valign = "middle", G.valign = "middle", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "leftLabel", { get: function() { + return this._leftLabel; + }, set: function(u) { + this._leftLabel && this.removeDispose(this._leftLabel), this._leftLabel = u, u && (u.parent = this, u.interactionsEnabled = !1, u.shouldClone = !1, this._disposers.push(this._leftLabel)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rightLabel", { get: function() { + return this._rightLabel; + }, set: function(u) { + this._rightLabel && this.removeDispose(this._rightLabel), this._rightLabel = u, u && (u.parent = this, u.interactionsEnabled = !1, u.shouldClone = !1, this._disposers.push(this._rightLabel)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "switch", { get: function() { + return this._switchButton; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "switchButton", { get: function() { + return this._switchButton; + }, set: function(u) { + this._switchButton && this.removeDispose(this._switchButton), this._switchButton = u, u && (u.parent = this, u.shouldClone = !1, this._disposers.push(this._switchButton)); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), u.leftLabel && this.leftLabel.copyFrom(u.leftLabel), u.rightLabel && this.rightLabel.copyFrom(u.rightLabel), u.switchButton && this.switchButton.copyFrom(u.switchButton); + }, R; + }(Qn); + hi.registeredClasses.SwitchButton = _L; + var zy = function(U) { + function R() { + var u = U.call(this) || this; + u._previousStart = 0, u._previousEnd = 1, u._prevStart = 0, u._prevEnd = 1, u._isBusy = !1, u._skipRangeEvents = !1, u.updateWhileMoving = !0, u.className = "Scrollbar", u.minHeight = 12, u.minWidth = 12, u.animationDuration = 0, u.animationEasing = W0, u.margin(10, 10, 10, 10); + var w = new Fa(), $ = u.background; + return $.cornerRadius(10, 10, 10, 10), $.fill = w.getFor("fill"), $.fillOpacity = 0.5, u.showSystemTooltip = !0, u.startGrip = new vL(), u.endGrip = new vL(), u.events.on("transformed", function() { + u.updateThumb(); + }, u, !1), u.start = 0, u.end = 1, u.role = "scrollbar", u.thumb.role = "slider", u.thumb.readerLive = "polite", u.startGrip.role = "slider", u.endGrip.role = "slider", u.events.once("inited", function() { + u._previousStart = void 0, u.dispatchRangeChange(); + }, void 0, !1), u.hideGrips = !1, u.orientation = "horizontal", u.setSVGAttribute({ "aria-valuemin": "0" }), u.setSVGAttribute({ "aria-valuemax": "100" }), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), this.orientation === "horizontal" ? (Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Use TAB to select grip buttons or left and right arrows to change selection")), Ee(this.thumb.readerDescription) || (this.thumb.readerDescription = this.language.translate("Use left and right arrows to move selection")), Ee(this.startGrip.readerDescription) || (this.startGrip.readerDescription = this.language.translate("Use left and right arrows to move left selection")), Ee(this.endGrip.readerDescription) || (this.endGrip.readerDescription = this.language.translate("Use left and right arrows to move right selection")), this.readerOrientation = "horizontal") : (Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Use TAB select grip buttons or up and down arrows to change selection")), Ee(this.thumb.readerDescription) || (this.thumb.readerDescription = this.language.translate("Use up and down arrows to move selection")), Ee(this.startGrip.readerDescription) || (this.startGrip.readerDescription = this.language.translate("Use up and down arrows to move upper selection")), Ee(this.endGrip.readerDescription) || (this.endGrip.readerDescription = this.language.translate("Use up and down arrows to move lower selection")), this.readerOrientation = "vertical"), this.readerControls = this.baseSprite.uidAttr(); + }, R.prototype.validateLayout = function() { + this.updateSize(), U.prototype.validateLayout.call(this), this.updateExtremes(); + }, R.prototype.processBackground = function() { + U.prototype.processBackground.call(this); + var u = this.background; + u.clickable = !0, u.events.on("hit", this.handleBgHit, this, void 0); + }, R.prototype.handleBgHit = function(u) { + this.makeBusy(); + var w = u.spritePoint; + w = up(w, this.background, this); + var $ = this.thumb; + if (this.orientation == "horizontal") { + var G = w.x - $.pixelWidth / 2; + G = mt(G, 0, this.innerWidth - $.pixelWidth), this._thumbAnimation = $.animate({ property: "x", to: G }, this.animationDuration, this.animationEasing); + } else { + var K = w.y - $.pixelHeight / 2; + K = mt(K, 0, this.innerHeight - $.pixelHeight), this._thumbAnimation = $.animate({ property: "y", to: K }, this.animationDuration, this.animationEasing); + } + this.animationDuration > 0 ? this._thumbAnimation.events.on("animationended", this.makeUnbusy, this, !1) : (this._thumb.validate(), this.makeUnbusy()); + }, R.prototype.makeBusy = function() { + this._isBusy = !0, this._skipRangeEvents = !1, this._unbusyTimeout && this.removeDispose(this._unbusyTimeout), this._unbusyTimeout = void 0, this.stopAnimations(); + }, R.prototype.stopAnimations = function() { + this._thumbAnimation && this._thumbAnimation.stop(!0), this._zoomAnimation && this._zoomAnimation.stop(!0); + }, R.prototype.makeUnbusy = function() { + this._unbusyTimeout = this.setTimeout(this.makeUnbusyReal.bind(this), 1.1 * this.animationDuration); + }, R.prototype.makeUnbusyReal = function() { + this._usingGrip = void 0, this._isBusy = !1, this.updateWhileMoving || this.dispatchRangeChange(); + }, R.prototype.dispatchRangeChange = function() { + this._previousEnd == this.end && this._previousStart == this.start || (this._previousStart = this.start, this._previousEnd = this.end, this.dispatch("rangechanged")); + }, R.prototype.updateThumb = function(u) { + if (u === void 0 && (u = !0), this.parent) { + var w = this.thumb, $ = this.start, G = this.end, K = this.startGrip, ne = this.endGrip; + if (this.orientation == "horizontal") { + var ue = this.innerWidth; + w.width = ue * (G - $), w.maxX = ue - w.pixelWidth, w.x = $ * ue, K.moveTo({ x: w.pixelX, y: 0 }, void 0, void 0, !0), ne.moveTo({ x: w.pixelX + w.pixelWidth, y: 0 }, void 0, void 0, !0), K.readerTitle = this.language.translate("From %1", void 0, this.adapter.apply("positionValue", { value: Math.round(100 * $) + "%", position: $ }).value), K.readerValueNow = "" + Math.round(100 * $), K.readerValueText = K.readerTitle, ne.readerTitle = this.language.translate("To %1", void 0, this.adapter.apply("positionValue", { value: Math.round(100 * G) + "%", position: G }).value), ne.readerValueNow = "" + Math.round(100 * G), ne.readerValueText = ne.readerTitle; + } else { + var we = this.innerHeight; + w.height = we * (G - $), w.maxY = we - w.pixelHeight, w.y = (1 - G) * we, K.moveTo({ x: 0, y: w.pixelY + w.pixelHeight }, void 0, void 0, !0), ne.moveTo({ x: 0, y: w.pixelY }, void 0, void 0, !0), K.readerTitle = this.language.translate("To %1", void 0, this.adapter.apply("positionValue", { value: Math.round(100 * (1 - $)) + "%", position: 1 - $ }).value), K.readerValueNow = "" + Math.round(100 * $), K.readerValueText = K.readerTitle, ne.readerTitle = this.language.translate("From %1", void 0, this.adapter.apply("positionValue", { value: Math.round(100 * (1 - G)) + "%", position: 1 - G }).value), ne.readerValueNow = "" + Math.round(100 * G), ne.readerValueText = ne.readerTitle; + } + w.readerTitle = this.language.translate("From %1 to %2", void 0, this.adapter.apply("positionValue", { value: Math.round(100 * $) + "%", position: $ }).value, this.adapter.apply("positionValue", { value: Math.round(100 * G) + "%", position: G }).value), w.readerValueNow = "" + Math.round(100 * $), w.readerValueText = w.readerTitle, this.readerValueNow = "" + Math.round(100 * $), this.readerValueText = w.readerTitle, !this._skipRangeEvents && this.updateWhileMoving && u && this.dispatchRangeChange(); + } + }, R.prototype.updateExtremes = function() { + var u = 0, w = 0, $ = 0, G = 0; + this.orientation == "horizontal" ? ($ = this.innerWidth, w = G = this.innerHeight / 2) : (G = this.innerHeight, u = $ = this.innerWidth / 2); + var K = this.startGrip; + K.minX = u, K.maxX = $, K.minY = w, K.maxY = G; + var ne = this.endGrip; + ne.minX = u, ne.maxX = $, ne.minY = w, ne.maxY = G; + var ue = this.thumb; + ue.minX = u, ue.maxX = $, ue.minY = w, ue.maxY = G; + }, R.prototype.updateSize = function() { + var u = this.orientation, w = this.startGrip; + w && (w.orientation = u), this.endGrip && (this.endGrip.orientation = u); + var $ = this.thumb; + $ && (u == "horizontal" ? (le(this._pixelWidth) || this.width instanceof J || (this.width = ce(100)), Ee(this.percentHeight) && (this.height = this.minHeight), $.height = this.innerHeight, $.verticalCenter = "middle", $.horizontalCenter = "left") : (le(this._pixelHeight) || this.height instanceof J || (this.height = ce(100)), Ee(this.percentWidth) && (this.width = this.minWidth), $.width = this.innerWidth, $.verticalCenter = "top", $.horizontalCenter = "middle")); + }, Object.defineProperty(R.prototype, "isBusy", { get: function() { + return this._isBusy; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "start", { get: function() { + return Math.min(this.getPosition(this._start), this.getPosition(this._end)); + }, set: function(u) { + this._isBusy || (this.__start = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "__start", { get: function() { + return this._start; + }, set: function(u) { + this._start = this.getPosition(u), this.updateThumb(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "end", { get: function() { + return Math.max(this.getPosition(this._start), this.getPosition(this._end)); + }, set: function(u) { + this._isBusy || (this.__end = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "__end", { get: function() { + return this._end; + }, set: function(u) { + this._end = this.getPosition(u), this.updateThumb(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "range", { get: function() { + return { start: this.start, end: this.end, priority: this._usingGrip }; + }, enumerable: !0, configurable: !0 }), R.prototype.skipRangeEvents = function() { + this._isBusy || (this._skipRangeEvents = !0); + }, R.prototype.fixRange = function(u) { + u.start == He(this._start, 2) && u.end == He(this._end, 2) || (this._start = u.start, this._end = u.end, this._skipRangeEvents = !0, this.updateThumb(), this._skipRangeEvents = !1, this.thumb.validate(), this.thumb.background.validate()); + }, R.prototype.getPosition = function(u) { + return mt(He(u, 4), 0, 1); + }, Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u) && (u === "horizontal" ? (this.startGrip.cursorOverStyle = vl.horizontalResize, this.endGrip.cursorOverStyle = vl.horizontalResize) : (this.startGrip.cursorOverStyle = vl.verticalResize, this.endGrip.cursorOverStyle = vl.verticalResize), this.updateByOrientation(), this.invalidate()); + }, enumerable: !0, configurable: !0 }), R.prototype.updateByOrientation = function() { + }, Object.defineProperty(R.prototype, "startGrip", { get: function() { + return this._startGrip; + }, set: function(u) { + this._startGrip && this.removeDispose(this._startGrip), this._startGrip = u, this.processGrip(u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endGrip", { get: function() { + return this._endGrip; + }, set: function(u) { + this._endGrip && this.removeDispose(this._endGrip), this._endGrip = u, this.processGrip(u); + }, enumerable: !0, configurable: !0 }), R.prototype.processGrip = function(u) { + u.parent = this, u.isMeasured = !1, u.focusable = !0, u.shouldClone = !1, u.zIndex = 100, u.events.on("drag", this.handleGripDrag, this, !1), u.events.on("dragstop", this.makeUnbusy, this, !1), u.events.on("down", this.makeBusy, this, !1), u.events.on("up", this.makeUnbusy, this, !1), this._disposers.push(u); + }, R.prototype.handleGripDrag = function(u) { + this.makeBusy(), u.target === this._startGrip ? this._usingGrip = "start" : this._usingGrip = "end", this.orientation == "horizontal" ? (this._start = this.startGrip.pixelX / this.innerWidth, this._end = this.endGrip.pixelX / this.innerWidth) : (this._start = 1 - this.startGrip.pixelY / this.innerHeight, this._end = 1 - this.endGrip.pixelY / this.innerHeight), this.updateThumb(); + }, Object.defineProperty(R.prototype, "thumb", { get: function() { + if (!this._thumb) { + var u = new t2(); + u.background.cornerRadius(10, 10, 10, 10), u.padding(0, 0, 0, 0), this.thumb = u; + } + return this._thumb; + }, set: function(u) { + var w = this; + u && (this._thumb && this.removeDispose(this._thumb), this._thumb = u, u.parent = this, u.isMeasured = !1, u.inert = !0, u.draggable = !0, u.clickable = !0, u.hoverable = !0, u.focusable = !0, u.shouldClone = !1, u.zIndex = 0, u.cursorOverStyle = vl.grab, u.cursorDownStyle = vl.grabbing, u.events.on("dragstart", this.makeBusy, this, !1), u.events.on("dragstop", this.makeUnbusy, this, !1), u.events.on("positionchanged", this.handleThumbPosition, this, !1), u.events.on("sizechanged", this.handleThumbPosition, this, !1), u.events.on("doublehit", this.handleDoubleClick, this, !1), this._disposers.push(Gs().body.events.on("keyup", function($) { + dg.isKey($.event, ["space", "enter"]) && w.thumb.isFocused && ($.event.preventDefault(), w.handleDoubleClick()); + })), this._disposers.push(this._thumb)); + }, enumerable: !0, configurable: !0 }), R.prototype.handleDoubleClick = function() { + this.makeBusy(); + var u = 0, w = 1; + this.start != 0 || this.end != 1 ? (this._prevStart = this.start, this._prevEnd = this.end) : (u = this._prevStart, w = this._prevEnd); + var $ = this.animate([{ property: "__start", to: u }, { property: "__end", to: w }], this.animationDuration, this.animationEasing); + $ && !$.isFinished() ? ($.events.on("animationended", this.makeUnbusy, this, !1), this._zoomAnimation = $) : this.makeUnbusy(); + }, R.prototype.handleThumbPosition = function() { + var u = this.thumb; + if (this.orientation == "horizontal") { + var w = this.innerWidth, $ = u.innerWidth, G = u.pixelX; + this._start = G / w, this._end = (G + $) / w, this.updateThumb(); + } else { + var K = this.innerHeight, ne = u.innerHeight, ue = u.pixelY; + ue + ne > K && (ue = K - ne, u.y = ue), this._start = 1 - (ue + ne) / K, this._end = 1 - ue / K, this.updateThumb(); + } + }, R.prototype.createBackground = function() { + return new L1(); + }, Object.defineProperty(R.prototype, "hideGrips", { get: function() { + return this._hideGrips; + }, set: function(u) { + var w = this; + this._hideGrips = u, this._overDisposer && this.removeDispose(this._overDisposer), this._outDisposer && this.removeDispose(this._outDisposer), u ? (this._overDisposer = this.events.on("over", function() { + w.startGrip.show(), w.endGrip.show(); + }, void 0, !1), this._outDisposer = this.events.on("out", function() { + w.startGrip.hide(), w.endGrip.hide(); + }, void 0, !1), this.startGrip.hide(), this.endGrip.hide()) : (this.startGrip.show(), this.endGrip.show()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animationDuration", { get: function() { + return this.getPropertyValue("animationDuration"); + }, set: function(u) { + this.setPropertyValue("animationDuration", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animationEasing", { get: function() { + return this.getPropertyValue("animationEasing"); + }, set: function(u) { + this.setPropertyValue("animationEasing", u); + }, enumerable: !0, configurable: !0 }), R.prototype.asFunction = function(u) { + return u == "animationEasing" || U.prototype.asIs.call(this, u); + }, R; + }(Qn); + hi.registeredClasses.Scrollbar = zy; + var gH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Slider", u.thumb.opacity = 0, u.thumb.interactionsEnabled = !1, u.endGrip.opacity = 0, u.endGrip.interactionsEnabled = !1, u.startGrip.events.on("drag", function() { + u.endGrip.x = u.startGrip.x, u.endGrip.y = u.startGrip.y; + }), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "__end", { get: function() { + return this._start; + }, set: function(u) { + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "end", { get: function() { + return this._start; + }, set: function(u) { + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "start", { get: function() { + return this._start; + }, set: function(u) { + this._isBusy || (this.__start = u); + }, enumerable: !0, configurable: !0 }), R; + }(zy); + hi.registeredClasses.Slider = gH; + var H8 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "TextLink", u.selectable = !0; + var w = new Fa(); + return u.fill = w.getFor("primaryButton").brighten(0.3), u.states.create("hover").properties.fill = w.getFor("primaryButtonHover").brighten(0.3), u.states.create("down").properties.fill = w.getFor("primaryButtonDown").brighten(0.3), u.cursorOverStyle = vl.pointer, u.applyTheme(), u; + } + return re(R, U), R; + }(Rm); + hi.registeredClasses.TextLink = H8; + var o2 = function(U) { + function R() { + var u = U.call(this) || this; + return u.properties = {}, u.isTemplate = !1, u._scale = 1, u._nonScaling = !0, u.className = "Filter", u.filterPrimitives = new Hs(), u.properties.filterUnits = "objectBoundingBox", u.filterPrimitives.events.on("inserted", function(w) { + u._disposers.push(w.newValue); + }), u.width = 120, u.height = 120, u.applyTheme(), u; + } + return re(R, U), R.prototype.appendPrimitives = function(u) { + er(this.filterPrimitives.iterator(), function(w) { + u.add(w); + }); + }, R.prototype.animate = function(u, w, $) { + return new $f(this, u, w, $).start(); + }, Object.defineProperty(R.prototype, "width", { get: function() { + return this.properties.width; + }, set: function(u) { + this.properties.width = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "height", { get: function() { + return this.properties.height; + }, set: function(u) { + this.properties.height = u; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + U.prototype.copyFrom.call(this, u), mi(u.properties, function($, G) { + w[$] = G; + }); + }, Object.defineProperty(R.prototype, "paper", { get: function() { + return this._paper ? this._paper : Yb(); + }, set: function(u) { + this._paper != u && (this._paper = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animations", { get: function() { + return this._animations || (this._animations = [], this._disposers.push(new Wb(this._animations))), this._animations; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "scale", { get: function() { + return this._scale; + }, set: function(u) { + this._scale = u, this.updateScale(); + }, enumerable: !0, configurable: !0 }), R.prototype.updateScale = function() { + }, Object.defineProperty(R.prototype, "filterUnits", { get: function() { + return this.properties.filterUnits; + }, set: function(u) { + this.properties.filterUnits = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "nonScaling", { get: function() { + return this._nonScaling; + }, set: function(u) { + this._nonScaling = u, u || (this._scale = 1), this.updateScale(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sprite", { set: function(u) { + this.setSprite(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setSprite = function(u) { + this._sprite && this._sprite != u && this._sprite.filters.removeValue(this), this._sprite = u; + }, R; + }(Ht), yH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "DropShadowFilter", u.color = We("#000"), u.feGaussianBlur = u.paper.add("feGaussianBlur"), u.feGaussianBlur.attr({ result: "blurOut", in: "SourceGraphic" }), u.filterPrimitives.push(u.feGaussianBlur), u.feOffset = u.paper.add("feOffset"), u.feOffset.attr({ result: "offsetBlur" }), u.filterPrimitives.push(u.feOffset), u.feFlood = u.paper.add("feFlood"), u.feFlood.attr({ "flood-color": u.color }), u.filterPrimitives.push(u.feFlood), u.feComposite = u.paper.add("feComposite"), u.feComposite.attr({ in2: "offsetBlur", operator: "in" }), u.filterPrimitives.push(u.feComposite), u.feMerge = u.paper.addGroup("feMerge"), u.feMerge.add(u.paper.add("feMergeNode")), u.feMerge.add(u.paper.add("feMergeNode").attr({ in: "SourceGraphic" })), u.filterPrimitives.push(u.feMerge), u.width = 200, u.height = 200, u.blur = 1.5, u.dx = 3, u.dy = 3, u.opacity = 0.5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "color", { get: function() { + return this.properties.color; + }, set: function(u) { + this.properties.color = u, this.feFlood && this.feFlood.attr({ "flood-color": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "opacity", { get: function() { + return this.properties.opacity; + }, set: function(u) { + this.properties.opacity = u, this.feFlood.attr({ "flood-opacity": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dx", { get: function() { + return this.properties.dx; + }, set: function(u) { + this.properties.dx = u, this.feOffset.attr({ dx: u / this.scale }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dy", { get: function() { + return this.properties.dy; + }, set: function(u) { + this.properties.dy = u, this.feOffset.attr({ dy: u / this.scale }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "blur", { get: function() { + return this.properties.blur; + }, set: function(u) { + this.properties.blur = u, this.feGaussianBlur.attr({ stdDeviation: u / this.scale }); + }, enumerable: !0, configurable: !0 }), R.prototype.updateScale = function() { + this.dx = this.dx, this.dy = this.dy, this.blur = this.blur; + }, R; + }(o2); + hi.registeredClasses.DropShadowFilter = yH; + var $C = function(U) { + function R() { + var u = U.call(this) || this; + u._boundingRect = { x: -4e4, y: -4e4, width: 8e4, height: 8e4 }, u._pointTo = { x: 0, y: 0 }, u.fitPointerToBounds = !1, u._verticalOrientation = "up", u.fixDoc = !0, u.className = "Tooltip", u.isMeasured = !1, u.getFillFromObject = !0, u.margin(5, 5, 5, 5), u.defaultState.transitionDuration = 1, u.hiddenState.transitionDuration = 1; + var w = u.background; + w.interactionsEnabled = !1, w.fillOpacity = 0.9, w.strokeWidth = 1, w.strokeOpacity = 1, w.stroke = We("#ffffff"), w.cornerRadius = 3, w.pointerLength = 6, w.pointerBaseWidth = 10; + var $ = new yH(); + $.dy = 1, $.dx = 1, $.opacity = 0.5, w.filters.push($), u.autoTextColor = !0; + var G = u.createChild(Rm); + return G.shouldClone = !1, u.label = G, G.padding(7, 12, 4, 12), G.interactionsEnabled = !1, G.horizontalCenter = "middle", G.fill = We("#ffffff"), u._disposers.push(G), u.label.events.on("sizechanged", u.drawBackground, u), u.label.zIndex = 1, u.pointerOrientation = "vertical", u.animationDuration = 0, u.animationEasing = W0, u.setPropertyValue("showInViewport", !1), u.role = "tooltip", u.visible = !1, u.opacity = 0, u.x = 0, u.y = 0, u.events.on("visibilitychanged", u.handleVisibility, u), u.applyTheme(), u; + } + return re(R, U), R.prototype.handleVisibility = function() { + this.visible && this.label.invalidate(); + }, Object.defineProperty(R.prototype, "getStrokeFromObject", { get: function() { + return this.getPropertyValue("getStrokeFromObject"); + }, set: function(u) { + this.setPropertyValue("getStrokeFromObject", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "autoTextColor", { get: function() { + return this.getPropertyValue("autoTextColor"); + }, set: function(u) { + this.setPropertyValue("autoTextColor", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "keepTargetHover", { get: function() { + return this.getPropertyValue("keepTargetHover"); + }, set: function(u) { + var w = this; + this.setPropertyValue("keepTargetHover", u, !0) && u && (this.hoverable = !0, this.background.interactionsEnabled = !0, this._disposers.push(this.events.on("over", function($) { + w.targetSprite && w.targetSprite.hoverable && (w.targetSprite.isHover = !0); + })), this._disposers.push(this.events.on("out", function($) { + w.targetSprite && w.targetSprite.hoverable && (w.targetSprite.isHover = !1); + }))); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "showInViewport", { get: function() { + return this.getPropertyValue("showInViewport"); + }, set: function(u) { + this.setPropertyValue("showInViewport", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "getFillFromObject", { get: function() { + return this.getPropertyValue("getFillFromObject"); + }, set: function(u) { + this.setPropertyValue("getFillFromObject", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.createBackground = function() { + return new xre(); + }, Object.defineProperty(R.prototype, "pointerOrientation", { get: function() { + return this.getPropertyValue("pointerOrientation"); + }, set: function(u) { + this.setPropertyValue("pointerOrientation", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animationDuration", { get: function() { + return this.getPropertyValue("animationDuration"); + }, set: function(u) { + this.setPropertyValue("animationDuration", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "animationEasing", { get: function() { + return this.getPropertyValue("animationEasing"); + }, set: function(u) { + this.setPropertyValue("animationEasing", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "html", { get: function() { + return this.label.html; + }, set: function(u) { + this.label.html != u && (this.label.html = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "text", { get: function() { + return this.label.text; + }, set: function(u) { + this.label.text != u && (this.label.text = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.label; + u.invalid && u.validate(); + var w, $, G = this._pointTo.x, K = this._pointTo.y, ne = this._boundingRect, ue = u.measuredWidth, we = u.measuredHeight, De = this.background.pointerLength; + if (this.ignoreBounds && (ne = void 0), ne && this.fixDoc && ue > ne.width) { + cr({ x: ne.x, y: ne.y }, this.parent); + var $e = cr({ x: ne.x + ne.width, y: ne.y + ne.height }, this.parent), Ke = document.body.offsetWidth; + document.body.offsetHeight, $e.x > Ke / 2 ? ne.x = ne.width - ue : ne.width = ne.x + ue; + } + var Ze = this.pointerOrientation; + Ze == "horizontal" || Ze == "left" || Ze == "right" ? ($ = -we / 2, w = Ze == "horizontal" ? ne && G > ne.x + ne.width / 2 ? -ue / 2 - De : ue / 2 + De : Ze == "left" ? ue / 2 + De : -ue / 2 - De) : (ne && (w = mt(0, ne.x - G + ue / 2, ne.x - G + ne.width - ue / 2)), Ze == "vertical" ? ne && K > ne.y + we + De ? ($ = -we - De, this._verticalOrientation = "up") : ($ = De, this._verticalOrientation = "down") : Ze == "down" ? ($ = -we - De, this._verticalOrientation = "up") : ($ = De, this._verticalOrientation = "down")), ne && ($ = mt($, ne.y - K, ne.y + ne.height - we - K)), u.x = w, u.y = $, this.drawBackground(); + }, R.prototype.updateBackground = function() { + this.group.addToBack(this.background.group); + }, R.prototype.drawBackground = function() { + var u = this.label, w = this.background, $ = u.measuredWidth, G = u.measuredHeight, K = this._boundingRect, ne = $, ue = u.pixelX - $ / 2, we = G, De = u.pixelY, $e = this._pointTo.x, Ke = this._pointTo.y, Ze = K.x - $e, pt = Ze + K.width, Vt = K.y - Ke, Yt = Vt + K.height; + w.x = ue, w.y = De, w.width = ne, w.height = we, this.fitPointerToBounds ? (w.pointerX = mt(-w.x, Ze - w.x, pt - w.x), w.pointerY = mt(-w.y, Vt - w.y, Yt - w.y)) : (w.pointerX = -w.x, w.pointerY = -w.y), w.validate(); + }, R.prototype.delayedPointTo = function(u, w) { + var $ = this; + this._pointToDisposer && this._pointToDisposer.dispose(), this._pointToDisposer = hi.events.once("exitframe", function() { + $.pointTo(u, w); + }), this.addDisposer(this._pointToDisposer); + }, R.prototype.pointTo = function(u, w) { + this._pointTo.x == u.x && this._pointTo.y == u.y || (this._pointTo = u, this.invalidate(), !this.visible || w ? (this.moveTo(this._pointTo), this._animation && this._animation.kill()) : this.pixelX == 0 && this.pixelY == 0 ? this.moveTo(this._pointTo) : (this._animation && this._animation.kill(), this._animation = new $f(this, [{ property: "x", to: u.x, from: this.pixelX }, { property: "y", to: u.y, from: this.pixelY }], this.animationDuration, this.animationEasing).start())); + }, R.prototype.setBounds = function(u) { + var w = this._boundingRect; + w.x == u.x && w.y == u.y && w.width == u.width && w.height == u.height || (this._boundingRect = u, this.invalidate()); + }, Object.defineProperty(R.prototype, "boundingContainer", { set: function(u) { + this._boundingContainer = u, u.events.on("sizechanged", this.updateBounds, this), u.events.on("positionchanged", this.updateBounds, this); + }, enumerable: !0, configurable: !0 }), R.prototype.updateBounds = function() { + var u = this._boundingContainer, w = rt({ x: u.pixelX, y: u.pixelY, width: u.maxWidth, height: u.maxHeight }, u); + this.setBounds(w); + }, Object.defineProperty(R.prototype, "ignoreBounds", { get: function() { + return this.getPropertyValue("ignoreBounds"); + }, set: function(u) { + this.setPropertyValue("ignoreBounds", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "verticalOrientation", { get: function() { + return this._verticalOrientation; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltip", { get: function() { + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.label.copyFrom(u.label), u._boundingRect && (this._boundingRect = u._boundingRect); + }, R.prototype.asFunction = function(u) { + return u == "animationEasing" || U.prototype.asIs.call(this, u); + }, R; + }(Qn); + hi.registeredClasses.Tooltip = $C; + var W8 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Trapezoid", u.element = u.paper.add("path"), u.topSide = ce(100), u.bottomSide = ce(100), u.leftSide = ce(100), u.rightSide = ce(100), u.isMeasured = !1, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.pixelWidth, w = this.pixelHeight, $ = vs(this.topSide, u), G = vs(this.bottomSide, u), K = vs(this.leftSide, w), ne = vs(this.rightSide, w), ue = (u - $) / 2, we = (w - K) / 2, De = u - (u - $) / 2, $e = (w - ne) / 2, Ke = u - (u - G) / 2, Ze = w - (w - ne) / 2, pt = (u - G) / 2, Vt = w - (w - K) / 2, Yt = "", ci = "", ai = "", Gi = ""; + if (Ee(this.horizontalNeck)) { + var Ji = this.horizontalNeck.value; + Yt = xr({ x: u * Ji, y: Math.max(we, $e) }), ai = xr({ x: u * Ji, y: Math.min(Ze, Vt) }); + } + if (Ee(this.verticalNeck)) { + var Ci = this.verticalNeck.value; + ci = xr({ x: Math.min(De, Ke), y: w * Ci }), Gi = xr({ x: Math.max(ue, pt), y: w * Ci }); + } + var Hi = pn({ x: ue, y: we }) + Yt + xr({ x: De, y: $e }) + ci + xr({ x: Ke, y: Ze }) + ai + xr({ x: pt, y: Vt }) + Gi; + this.path = Hi; + }, Object.defineProperty(R.prototype, "topSide", { get: function() { + return this.getPropertyValue("topSide"); + }, set: function(u) { + this.setPercentProperty("topSide", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bottomSide", { get: function() { + return this.getPropertyValue("bottomSide"); + }, set: function(u) { + this.setPercentProperty("bottomSide", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "leftSide", { get: function() { + return this.getPropertyValue("leftSide"); + }, set: function(u) { + this.setPercentProperty("leftSide", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rightSide", { get: function() { + return this.getPropertyValue("rightSide"); + }, set: function(u) { + this.setPercentProperty("rightSide", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "horizontalNeck", { get: function() { + return this.getPropertyValue("horizontalNeck"); + }, set: function(u) { + this.setPropertyValue("horizontalNeck", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "verticalNeck", { get: function() { + return this.getPropertyValue("verticalNeck"); + }, set: function(u) { + this.setPropertyValue("verticalNeck", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Trapezoid = W8; + var bL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Triangle", u.element = u.paper.add("path"), u.direction = "top", u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u, w = this.pixelWidth, $ = this.pixelHeight; + switch (this.direction) { + case "right": + u = pn({ x: 0, y: 0 }) + xr({ x: w, y: $ / 2 }) + xr({ x: 0, y: $ }) + " Z"; + break; + case "left": + u = pn({ x: w, y: 0 }) + xr({ x: 0, y: $ / 2 }) + xr({ x: w, y: $ }) + " Z"; + break; + case "bottom": + u = pn({ x: 0, y: 0 }) + xr({ x: w, y: 0 }) + xr({ x: w / 2, y: $ }) + " Z"; + break; + case "top": + u = pn({ x: w / 2, y: 0 }) + xr({ x: w, y: $ }) + xr({ x: 0, y: $ }) + " Z"; + } + this.path = u; + }, Object.defineProperty(R.prototype, "direction", { get: function() { + return this.getPropertyValue("direction"); + }, set: function(u) { + this.setPropertyValue("direction", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Triangle = bL; + var Kv = function() { + function U(R, u) { + this._tensionX = R, this._tensionY = u; + } + return U.prototype.smooth = function(R) { + for (var u = R.length - 1; u > 0; u--) { + var w = R[u], $ = R[u - 1]; + Math.abs(w.x - $.x) < 0.1 && Math.abs(w.y - $.y) < 0.1 && R.splice(u - 1, 1); + } + var G = this._tensionX, K = this._tensionY; + if (R.length < 3 || G >= 1 && K >= 1) + return Z3(R); + var ne = R[0], ue = R[R.length - 1], we = !1; + He(ne.x, 3) == He(ue.x) && He(ne.y) == He(ue.y) && (we = !0); + for (var De = "", $e = (u = 0, R.length - 1); u < $e; u++) { + w = R[u - 1], $ = R[u]; + var Ke = R[u + 1], Ze = R[u + 2]; + u === 0 ? w = we ? R[R.length - 2] : R[u] : u == R.length - 2 && (Ze = we ? R[1] : R[u + 1]), De += aA(Ke, $t(w, $, Ke, 0, G, K), qe(0, $, Ke, Ze, G, K)); + } + return De; + }, U; + }(); + function Jv(U, R, u, w, $, G) { + var K = U.x, ne = U.y, ue = R.x, we = R.y, De = C(U, R); + G && (u = De / Math.round(De / u)); + var $e = hi.getCache(Cu(["wavedLine", U.x, R.x, U.y, R.y, u, w])); + if (!$e) { + if (De > 0) { + var Ke = Math.atan2(we - ne, ue - K), Ze = Math.cos(Ke), pt = Math.sin(Ke), Vt = u * Ze, Yt = u * pt; + if (u <= 1 || w <= 1) + $e = xr(R); + else { + var ci = Math.round(2 * De / u), ai = [], Gi = 1; + ue < K && (Gi *= -1), we < ne && (Gi *= -1); + for (var Ji = 0; Ji <= ci; Ji++) { + var Ci = K + Ji * Vt / 2 + (Gi *= -1) * w / 2 * pt, Hi = ne + Ji * Yt / 2 - Gi * w / 2 * Ze; + ai.push({ x: Ci, y: Hi }); + } + $e = new Kv($, $).smooth(ai); + } + } else + $e = ""; + hi.setCache(Cu(["wavedLine", U.x, R.x, U.y, R.y, u, w]), $e); + } + return $e; + } + var vH = function() { + function U(R, u) { + this._reversed = R, this._closed = u.closed; + } + return U.prototype._curve = function(R, u, w, $, G, K) { + var ne = (u - R) / 3; + return this._reversed ? aA({ x: $, y: u }, { x: w + ne * G, y: R + ne }, { x: $ - ne * K, y: u - ne }) : aA({ x: u, y: $ }, { x: R + ne, y: w + ne * G }, { x: u - ne, y: $ - ne * K }); + }, U.prototype.smooth = function(R) { + var u = this, w = NaN, $ = NaN, G = NaN, K = NaN, ne = NaN, ue = 0, we = ""; + switch (_i(R, function(De) { + var $e = De.x, Ke = De.y; + if (u._reversed) { + var Ze = $e; + $e = Ke, Ke = Ze; + } + var pt = NaN; + if ($e !== $ || Ke !== K) { + switch (ue) { + case 0: + ue = 1, u._reversed ? we += xr({ x: Ke, y: $e }) : we += xr({ x: $e, y: Ke }); + break; + case 1: + ue = 2; + break; + case 2: + ue = 3, we += u._curve(w, $, G, K, q8(w, $, G, K, pt = Ere(w, $, G, K, $e, Ke)), pt); + break; + default: + we += u._curve(w, $, G, K, ne, pt = Ere(w, $, G, K, $e, Ke)); + } + w = $, $ = $e, G = K, K = Ke, ne = pt; + } + }), ue) { + case 2: + this._reversed ? we += xr({ x: K, y: $ }) : we += xr({ x: $, y: K }); + break; + case 3: + we += this._curve(w, $, G, K, ne, q8(w, $, G, K, ne)); + } + return this._closed && (we += " Z"), we; + }, U; + }(); + function Tre(U) { + return U < 0 ? -1 : 1; + } + function q8(U, R, u, w, $) { + var G = R - U; + return G ? (3 * (w - u) / G - $) / 2 : $; + } + function Ere(U, R, u, w, $, G) { + var K = R - U, ne = $ - R, ue = (w - u) / (K || ne < 0 && -0), we = (G - w) / (ne || K < 0 && -0), De = (ue * ne + we * K) / (K + ne); + return (Tre(ue) + Tre(we)) * Math.min(Math.abs(ue), Math.abs(we), 0.5 * Math.abs(De)) || 0; + } + var Ire = function(U) { + function R(u) { + return U.call(this, !1, u) || this; + } + return re(R, U), R; + }(vH), Are = function(U) { + function R(u) { + return U.call(this, !0, u) || this; + } + return re(R, U), R; + }(vH), d_e = function() { + function U(R) { + this._closed = R.closed; + } + return U.prototype.smooth = function(R) { + var u = this, w = NaN, $ = NaN, G = NaN, K = NaN, ne = NaN, ue = NaN, we = NaN, De = NaN, $e = NaN, Ke = NaN, Ze = 0, pt = "", Vt = function(ci, ai) { + pt += aA({ x: (w + 4 * $ + ci) / 6, y: (ue + 4 * we + ai) / 6 }, { x: (2 * w + $) / 3, y: (2 * ue + we) / 3 }, { x: (w + 2 * $) / 3, y: (ue + 2 * we) / 3 }); + }, Yt = function(ci) { + var ai = ci.x, Gi = ci.y; + switch (Ze) { + case 0: + Ze = 1, u._closed ? (G = ai, De = Gi) : pt += xr({ x: ai, y: Gi }); + break; + case 1: + Ze = 2, u._closed && (K = ai, $e = Gi); + break; + case 2: + if (Ze = 3, u._closed) { + ne = ai, Ke = Gi, pt += pn({ x: (w + 4 * $ + ai) / 6, y: (ue + 4 * we + Gi) / 6 }); + break; + } + pt += xr({ x: (5 * w + $) / 6, y: (5 * ue + we) / 6 }); + default: + Vt(ai, Gi); + } + w = $, $ = ai, ue = we, we = Gi; + }; + if (_i(R, Yt), this._closed) + switch (Ze) { + case 1: + pt += pn({ x: G, y: De }), pt += " Z"; + break; + case 2: + pt += pn({ x: (G + 2 * K) / 3, y: (De + 2 * $e) / 3 }), pt += xr({ x: (K + 2 * G) / 3, y: ($e + 2 * De) / 3 }), pt += " Z"; + break; + case 3: + Yt({ x: G, y: De }), Yt({ x: K, y: $e }), Yt({ x: ne, y: Ke }); + } + else { + switch (Ze) { + case 3: + Vt($, we); + case 2: + pt += xr({ x: $, y: we }); + } + pt += " Z"; + } + return pt; + }, U; + }(), wL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "WavedCircle", u.element = u.paper.add("path"), u.waveLength = 16, u.waveHeight = 4, u.fill = void 0, u.fillOpacity = 0, u.tension = 0.8, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + var u = "", w = this.pixelRadius; + w > 0 && (u = pn(($ = this.getPoints(w))[0]) + new Kv(this.tension, this.tension).smooth($)); + var $, G = this.pixelInnerRadius; + G > 0 && (($ = this.getPoints(G)).reverse(), u += pn($[0]) + new Kv(this.tension, this.tension).smooth($)), this.path = u; + }, R.prototype.getPoints = function(u) { + for (var w = u * Math.PI * 2, $ = this.waveHeight / 2, G = w / Math.round(w / this.waveLength), K = G / 2, ne = [], ue = w / G, we = 0; we <= ue; we++) { + var De = we * G / w * 360, $e = (we * G + K) / w * 360; + ne.push({ x: (u - $) * A(De), y: (u - $) * Ue(De) }), ne.push({ x: (u + $) * A($e), y: (u + $) * Ue($e) }); + } + return ne.pop(), ne; + }, Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return vs(this.innerRadius, H(this.innerWidth / 2, this.innerHeight / 2)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "waveLength", { get: function() { + return this.getPropertyValue("waveLength"); + }, set: function(u) { + this.setPropertyValue("waveLength", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "waveHeight", { get: function() { + return this.getPropertyValue("waveHeight"); + }, set: function(u) { + this.setPropertyValue("waveHeight", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tension", { get: function() { + return this.getPropertyValue("tension"); + }, set: function(u) { + this.setPropertyValue("tension", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), R; + }(NC); + hi.registeredClasses.WavedCircle = wL; + var Ar = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "WavedLine", u.element = u.paper.add("path"), u.waveLength = 16, u.waveHeight = 4, u.tension = 0.8, u.pixelPerfect = !1, u.fill = We(), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + var u = { x: this.x1, y: this.y1 }, w = { x: this.x2, y: this.y2 }; + this.path = pn(u) + Jv(u, w, this.waveLength, this.waveHeight, this.tension, !0); + }, Object.defineProperty(R.prototype, "waveLength", { get: function() { + return this.getPropertyValue("waveLength"); + }, set: function(u) { + this.setPropertyValue("waveLength", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "waveHeight", { get: function() { + return this.getPropertyValue("waveHeight"); + }, set: function(u) { + this.setPropertyValue("waveHeight", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tension", { get: function() { + return this.getPropertyValue("tension"); + }, set: function(u) { + this.setPropertyValue("tension", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), R; + }(q0), xL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "WavedRectangle", u.element = u.paper.add("path"), u.waveLength = 16, u.waveHeight = 4, u.tension = 0.8, u.setPropertyValue("wavedLeft", !0), u.setPropertyValue("wavedRight", !0), u.setPropertyValue("wavedTop", !0), u.setPropertyValue("wavedBottom", !0), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.pixelWidth, w = this.pixelHeight; + if (u > 0 && w > 0) { + var $ = { x: 0, y: 0 }, G = { x: u, y: 0 }, K = { x: u, y: w }, ne = { x: 0, y: w }, ue = Math.min(u, this.waveLength), we = Math.min(w, this.waveHeight), De = Math.min(w, this.waveLength), $e = Math.min(u, this.waveHeight), Ke = "", Ze = "", pt = "", Vt = ""; + this.wavedTop && (Ke = Jv($, G, ue, we, this.tension, !0)), this.wavedRight && (Ze = Jv(G, K, De, $e, this.tension, !0)), this.wavedBottom && (pt = Jv(K, ne, ue, we, this.tension, !0)), this.wavedLeft && (Vt = Jv(ne, $, De, $e, this.tension, !0)), this.path = pn($) + Ke + xr(G) + Ze + xr(K) + pt + xr(ne) + Vt + "z"; + } + }, Object.defineProperty(R.prototype, "waveLength", { get: function() { + return this.getPropertyValue("waveLength"); + }, set: function(u) { + this.setPropertyValue("waveLength", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "waveHeight", { get: function() { + return this.getPropertyValue("waveHeight"); + }, set: function(u) { + this.setPropertyValue("waveHeight", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.setWavedSides = function(u, w, $, G) { + this.wavedTop = u, this.wavedRight = w, this.wavedBottom = $, this.wavedLeft = G; + }, Object.defineProperty(R.prototype, "tension", { get: function() { + return this.getPropertyValue("tension"); + }, set: function(u) { + this.setPropertyValue("tension", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wavedRight", { get: function() { + return this.getPropertyValue("wavedRight"); + }, set: function(u) { + this.setPropertyValue("wavedRight", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wavedLeft", { get: function() { + return this.getPropertyValue("wavedLeft"); + }, set: function(u) { + this.setPropertyValue("wavedLeft", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wavedTop", { get: function() { + return this.getPropertyValue("wavedTop"); + }, set: function(u) { + this.setPropertyValue("wavedTop", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "wavedBottom", { get: function() { + return this.getPropertyValue("wavedBottom"); + }, set: function(u) { + this.setPropertyValue("wavedBottom", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(MC), _H = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "ZoomOutButton", u.padding(9, 9, 9, 9), u.showSystemTooltip = !0; + var w = new Fa(), $ = u.background; + $.cornerRadius(20, 20, 20, 20), $.fill = w.getFor("primaryButton"), $.stroke = w.getFor("primaryButtonStroke"), $.strokeOpacity = 0, $.states.getKey("hover").properties.fill = w.getFor("primaryButtonHover"), $.states.getKey("down").properties.fill = w.getFor("primaryButtonActive"); + var G = new so(); + G.element = u.paper.add("path"); + var K = pn({ x: 0, y: 0 }); + return K += xr({ x: 11, y: 0 }), G.path = K, G.pixelPerfect = !0, G.padding(8, 3, 8, 3), G.stroke = w.getFor("primaryButtonText"), u.icon = G, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Zoom Out")); + }, R; + }(t2); + hi.registeredClasses.ZoomOutButton = _H; + var bH = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "PlayButton", u.padding(12, 12, 12, 12), u.showSystemTooltip = !0; + var w = new Fa(), $ = u.background; + $.cornerRadius(25, 25, 25, 25), $.fill = w.getFor("primaryButton"), $.stroke = w.getFor("primaryButtonStroke"), $.strokeOpacity = 0, $.states.getKey("hover").properties.fill = w.getFor("primaryButtonHover"), $.states.getKey("down").properties.fill = w.getFor("primaryButtonActive"); + var G = new bL(); + G.direction = "right", G.width = 9, G.height = 11, G.marginLeft = 1, G.marginRight = 1, G.horizontalCenter = "middle", G.verticalCenter = "middle", G.stroke = w.getFor("primaryButtonText"), G.fill = G.stroke, u.icon = G; + var K = new L1(); + K.width = 11, K.height = 11, K.horizontalCenter = "middle", K.verticalCenter = "middle", K.cornerRadius(0, 0, 0, 0), K.stroke = w.getFor("primaryButtonText"), K.fill = G.stroke, u.togglable = !0; + var ne = u.states.create("active"); + return ne.transitionDuration = 0, ne.properties.icon = K, u.defaultState.transitionDuration = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Play")); + }, R; + }(t2); + hi.registeredClasses.PlayButton = bH; + var jn = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColorModifier", u.applyTheme(), u; + } + return re(R, U), R.prototype.modify = function(u) { + return u; + }, R; + }(Ht); + hi.registeredClasses.ColorModifier = jn; + var wH = function(U) { + function R() { + var u = U.call(this) || this; + return u.lightnesses = [], u.brightnesses = [], u.opacities = [], u.offsets = [], u.className = "GradientModifier", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "lightnesses", { get: function() { + return this._lightnesses; + }, set: function(u) { + this._lightnesses = u, this._brightnesses = []; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "brightnesses", { get: function() { + return this._brightnesses; + }, set: function(u) { + this._brightnesses = u, this._lightnesses = []; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "opacities", { get: function() { + return this._opacities; + }, set: function(u) { + this._opacities = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "offsets", { get: function() { + return this._offsets; + }, set: function(u) { + this._offsets = u; + }, enumerable: !0, configurable: !0 }), R.prototype.modify = function(u) { + this.gradient.clear(); + var w = 0; + this.opacities && (w = ve(w, this.opacities.length)), this.lightnesses && (w = ve(w, this.lightnesses.length)), this.brightnesses && (w = ve(w, this.brightnesses.length)); + for (var $, G, K = 1, ne = 0; ne < w; ne++) { + var ue = u; + this.opacities && le(this.opacities[ne]) && (K = this.opacities[ne]), this.lightnesses && le(this.lightnesses[ne]) && ($ = this.lightnesses[ne], G = void 0), this.brightnesses && le(this.brightnesses[ne]) && (G = this.brightnesses[ne], $ = void 0), le(G) ? ue = u.brighten(this.brightnesses[ne]) : le($) && (ue = u.lighten(this.lightnesses[ne])); + var we = this.offsets[ne]; + this.gradient.addColor(ue, K, we); + } + return this.gradient; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this._offsets = u.offsets, this._brightnesses = u.brightnesses, this._lightnesses = u.lightnesses, this._opacities = u.opacities; + }, R; + }(jn); + hi.registeredClasses.GradientModifier = wH; + var tR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "LinearGradientModifier", u.gradient = new qg(), u.applyTheme(), u; + } + return re(R, U), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.gradient = u.gradient.clone(); + }, R; + }(wH); + hi.registeredClasses.LinearGradientModifier = tR; + var Y8 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Cone", u.angle = 30, u.radius = ce(100), u.topRadius = ce(100), u.top = u.createChild(U8), u.top.shouldClone = !1, u.bottom = u.createChild(U8), u.bottom.shouldClone = !1, u.body = u.createChild(so), u.body.shouldClone = !1, u.body.setElement(u.paper.add("path")), u.layout = "none", u.bodyFillModifier = new tR(), u.bodyFillModifier.lightnesses = [0, -0.25, 0], u.body.fillModifier = u.bodyFillModifier, u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), _r(this, this.top, lc), _r(this, this.bottom, lc), _r(this, this.body, lc); + var u, w, $, G = this.innerWidth, K = this.innerHeight, ne = this.bottom, ue = this.top, we = this.angle; + this.orientation == "horizontal" ? (u = K / 2, ne.y = K / 2, ue.y = K / 2, ue.x = G, w = (90 - we) / 90, $ = 0, this.bodyFillModifier.gradient.rotation = 90) : (w = 0, $ = (90 - we) / 90, u = G / 2, ne.y = K, ne.x = G / 2, ue.x = G / 2, this.bodyFillModifier.gradient.rotation = 0); + var De, $e = this.radius.value * u, Ke = this.topRadius.value * u; + ne.radius = $e - $e * w, ne.radiusY = $e - $e * $, ue.radius = Ke - Ke * w, ue.radiusY = Ke - Ke * $, De = this.orientation == "horizontal" ? pn({ x: 0, y: K / 2 - ne.radiusY }) + gd(-90, -180, ne.radius, ne.radiusY) + xr({ x: G, y: K / 2 + ue.radiusY }) + gd(90, 180, ue.radius, ue.radiusY) + " Z" : pn({ x: G / 2 - ue.radius, y: 0 }) + gd(180, -180, ue.radius, ue.radiusY) + xr({ x: G / 2 + ne.radius, y: K }) + gd(0, 180, ne.radius, ne.radiusY) + " Z", this.body.path = De; + }, Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + this.setPropertyValue("angle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPropertyValue("radius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "topRadius", { get: function() { + return this.getPropertyValue("topRadius"); + }, set: function(u) { + this.setPropertyValue("topRadius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(Qn), X8 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "LightenFilter", u.feColorMatrix = u.paper.add("feColorMatrix"), u.feColorMatrix.attr({ type: "matrix" }), u.filterPrimitives.push(u.feColorMatrix), u.lightness = 0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "lightness", { get: function() { + return this.properties.lightness; + }, set: function(u) { + this.properties.lightness = u; + var w = u + 1; + this.feColorMatrix.attr({ values: w + " 0 0 0 0 0 " + w + " 0 0 0 0 0 " + w + " 0 0 0 0 0 1 0" }); + }, enumerable: !0, configurable: !0 }), R; + }(o2); + hi.registeredClasses.LightenFilter = X8; + var N1 = function(U) { + function R() { + var u = U.call(this) || this; + u.angle = 30, u.depth = 30, u.className = "Rectangle3D", u.layout = "none"; + var w = u.createChild(so); + w.shouldClone = !1, w.setElement(u.paper.add("path")), w.isMeasured = !1, u.sideBack = w, u._disposers.push(u.sideBack); + var $ = u.createChild(so); + $.shouldClone = !1, $.setElement(u.paper.add("path")), $.isMeasured = !1, u.sideBottom = $, u._disposers.push(u.sideBottom); + var G = u.createChild(so); + G.shouldClone = !1, G.setElement(u.paper.add("path")), G.isMeasured = !1, u.sideLeft = G, u._disposers.push(u.sideLeft); + var K = u.createChild(so); + K.shouldClone = !1, K.setElement(u.paper.add("path")), K.isMeasured = !1, u.sideRight = K, u._disposers.push(u.sideRight); + var ne = u.createChild(so); + ne.shouldClone = !1, ne.setElement(u.paper.add("path")), ne.isMeasured = !1, u.sideTop = ne, u._disposers.push(u.sideTop); + var ue = u.createChild(so); + return ue.shouldClone = !1, ue.setElement(u.paper.add("path")), ue.isMeasured = !1, u.sideFront = ue, u._disposers.push(u.sideFront), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.innerWidth, w = this.innerHeight, $ = this.depth, G = this.angle, K = Ue(G), ne = A(G), ue = { x: 0, y: 0 }, we = { x: u, y: 0 }, De = { x: u, y: w }, $e = { x: 0, y: w }, Ke = { x: $ * ne, y: -$ * K }, Ze = { x: $ * ne + u, y: -$ * K }, pt = { x: $ * ne + u, y: -$ * K + w }, Vt = { x: $ * ne, y: -$ * K + w }; + this.sideFront.path = pn(ue) + xr(we) + xr(De) + xr($e) + " Z", this.sideBack.path = pn(Ke) + xr(Ze) + xr(pt) + xr(Vt) + " Z", this.sideLeft.path = pn(ue) + xr(Ke) + xr(Vt) + xr($e) + " Z", this.sideRight.path = pn(we) + xr(Ze) + xr(pt) + xr(De) + " Z", this.sideBottom.path = pn($e) + xr(Vt) + xr(pt) + xr(De) + " Z", this.sideTop.path = pn(ue) + xr(Ke) + xr(Ze) + xr(we) + " Z"; + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + this.setPropertyValue("angle", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setFill = function(u) { + var w; + if (U.prototype.setFill.call(this, u), ct(u) && !("r" in u) || (u = Et(u)), u instanceof Ie) + w = u.hex; + else if (u instanceof qg || u instanceof Yg) + w = u.stops.getIndex(0).color.hex; + else { + var $ = new X8(); + $.lightness = -0.2, this.sideBack.filters.push($); + var G = $.clone(); + G.lightness = -0.4, this.sideLeft.filters.push(G); + var K = $.clone(); + K.lightness = -0.2, this.sideRight.filters.push(K); + var ne = $.clone(); + ne.lightness = -0.1, this.sideTop.filters.push(ne); + var ue = $.clone(); + ue.lightness = -0.5, this.sideBottom.filters.push(ue); + } + w && (this.sideBack.fill = We(w).lighten(-0.2), this.sideLeft.fill = We(w).lighten(-0.4), this.sideRight.fill = We(w).lighten(-0.2), this.sideTop.fill = We(w).lighten(-0.1), this.sideBottom.fill = We(w).lighten(-0.5)); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.sideBack.copyFrom(u.sideBack), this.sideLeft.copyFrom(u.sideLeft), this.sideRight.copyFrom(u.sideRight), this.sideTop.copyFrom(u.sideTop), this.sideBottom.copyFrom(u.sideBottom); + }, R; + }(Qn), Pre = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Slice3D", u.layout = "none"; + var w = u.createChild(so); + u.edge = w, w.shouldClone = !1, w.isMeasured = !1, w.toBack(), u.angle = 30, u.depth = 20; + var $ = u.createChild(so); + u.sideA = $, $.shouldClone = !1, $.isMeasured = !1; + var G = u.createChild(so); + return u.sideB = G, G.shouldClone = !1, G.isMeasured = !1, u.applyTheme(), u; + } + return re(R, U), R.prototype.setFill = function(u) { + var w; + if (U.prototype.setFill.call(this, u), u instanceof Ie) + w = u.hex; + else if (u instanceof qg || u instanceof Yg) + w = u.stops.getIndex(0).color.hex; + else { + var $ = new X8(); + $.lightness = -0.25, this.edge.filters.push($), this.sideA.filters.push($.clone()), this.sideB.filters.push($.clone()); + } + if (w) { + var G = We(w).lighten(-0.25); + this.edge.fill = G, this.sideA.fill = G, this.sideB.fill = G, this.edge.stroke = G, this.sideA.stroke = G, this.sideB.stroke = G; + } + }, R.prototype.draw = function() { + if (this.cornerRadius = 0, this.innerCornerRadius = 0, U.prototype.draw.call(this), this.arc !== 0 && this.radius > 0 && this.depth > 0) { + this.sideB.show(0), this.sideA.show(0), this.edge.show(0); + for (var u = this.startAngle, w = this.arc, $ = this.pixelInnerRadius || 0, G = this.radiusY || 0, K = this.radius, ne = u + w, ue = G / K * $, we = { x: A(u) * $, y: Ue(u) * ue }, De = { x: A(u) * K, y: Ue(u) * G }, $e = { x: A(ne) * K, y: Ue(ne) * G }, Ke = { x: A(ne) * $, y: Ue(ne) * ue }, Ze = this.depth, pt = { x: we.x, y: we.y - Ze }, Vt = { x: De.x, y: De.y - Ze }, Yt = { x: $e.x, y: $e.y - Ze }, ci = { x: Ke.x, y: Ke.y - Ze }, ai = "", Gi = Math.ceil(w / 5), Ji = w / Gi, Ci = u, Hi = Vt, sr = 0; sr < Gi; sr++) + if ((Ci += Ji) > 0 && Ci < 180) { + ai += pn(Hi); + var Or = { x: A(Ci) * K, y: Ue(Ci) * G - Ze }; + ai += xr({ x: Hi.x, y: Hi.y + Ze }), ai += Uy({ x: Or.x, y: Or.y + Ze }, K, G, !0), ai += xr(Or), ai += Uy(Hi, K, G), ai += "z", Hi = Or; + } else + ai += pn(Hi), ai += Uy(Or = { x: A(Ci) * K, y: Ue(Ci) * G - Ze }, K, G, !0), ai += xr({ x: Or.x, y: Or.y + Ze }), ai += Uy({ x: Hi.x, y: Hi.y + Ze }, K, G), ai += xr(Hi), ai += "z", Hi = Or; + for (Hi = pt, Ci = u, sr = 0; sr < Gi; sr++) + (Ci += Ji) > 0 && Ci < 180 ? (ai += pn(Hi), Or = { x: A(Ci) * $, y: Ue(Ci) * ue - Ze }, ai += xr({ x: Hi.x, y: Hi.y + Ze }), ai += Uy({ x: Or.x, y: Or.y + Ze }, $, ue, !0), ai += xr(Or), ai += Uy(Hi, $, ue), ai += "z", Hi = Or) : (ai += pn(Hi), ai += Uy(Or = { x: A(Ci) * $, y: Ue(Ci) * ue - Ze }, $, ue, !0), ai += xr({ x: Or.x, y: Or.y + Ze }), ai += Uy({ x: Hi.x, y: Hi.y + Ze }, $, ue), ai += xr(Hi), ai += "z", Hi = Or); + this.edge.path = ai, this.sideA.path = pn(we) + xr(De) + xr(Vt) + xr(pt) + " Z", this.sideB.path = pn($e) + xr(Ke) + xr(ci) + xr(Yt) + " Z", this.startAngle < 90 ? this.sideA.toBack() : this.sideA.toFront(), this.startAngle + this.arc > 90 ? this.sideB.toBack() : this.sideB.toFront(), this.slice.dy = -Ze; + } else + this.sideA.hide(0), this.sideB.hide(0), this.edge.hide(0); + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + var u = this.getPropertyValue("angle"); + return le(u) || (u = 0), u; + }, set: function(u) { + this.setPropertyValue("angle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radiusY", { get: function() { + var u = this.getPropertyValue("radiusY"); + return le(u) || (u = this.radius - this.radius * this.angle / 90), u; + }, set: function(u) { + this.setPropertyValue("radiusY", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.edge.copyFrom(u.edge), this.sideA.copyFrom(u.sideA), this.sideB.copyFrom(u.sideB); + }, R; + }(kC), xH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadialGradientModifier", u.gradient = new Yg(), u.applyTheme(), u; + } + return re(R, U), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.gradient = u.gradient.clone(); + }, R; + }(wH); + hi.registeredClasses.RadialGradientModifier = xH; + var SH = function(U) { + function R() { + var u = U.call(this) || this; + return u.properties.gap = 0, u._line = u.paper.add("path"), u.addElement(u._line), u; + } + return re(R, U), R.prototype.draw = function() { + if (U.prototype.draw.call(this), Math.round(this.rotation / 90) != this.rotation / 90 && (this.properties.shapeRendering = "auto"), this._line) { + var u = this.width, w = this.height, $ = ""; + if (this.gap) + for (var G = this.gap + this.strokeWidth, K = this.height / G, ne = -K / 2; ne < 1.5 * K; ne++) + Math.round(this.rotation / 90) != this.rotation / 90 ? ($ += pn({ x: -u, y: (ne + 0.5) * G }) + xr({ x: 2 * u, y: (ne + 0.5) * G }), this.properties.rotationX = this.width / 2, this.properties.rotationY = this.height / 2) : $ += pn({ x: -u, y: ne * G }) + xr({ x: 2 * u, y: ne * G }); + else + Math.round(this.rotation / 90) != this.rotation / 90 ? ($ = pn({ x: -u, y: w / 2 }) + xr({ x: 2 * u, y: w / 2 }), this.properties.rotationX = this.width / 2, this.properties.rotationY = this.height / 2) : $ = pn({ x: 0, y: 0 }) + xr({ x: u, y: 0 }); + this._line.attr({ d: $ }); + } + }, Object.defineProperty(R.prototype, "gap", { get: function() { + return this.properties.gap; + }, set: function(u) { + this.properties.gap = u, this.draw(); + }, enumerable: !0, configurable: !0 }), R; + }(qv); + hi.registeredClasses.LinePattern = SH; + var SL = function(U) { + function R() { + var u = U.call(this) || this; + return u.properties.radius = 2, u._circle = u.paper.add("circle"), u.addElement(u._circle), u.shapeRendering = "auto", u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), this._circle && this._circle.attr({ r: this.radius, cx: this.width / 2, cy: this.height / 2 }); + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.properties.radius; + }, set: function(u) { + this.properties.radius = u, this.draw(); + }, enumerable: !0, configurable: !0 }), R; + }(qv); + hi.registeredClasses.CirclePattern = SL; + var mg = function(U) { + function R() { + var u = U.call(this) || this; + return u.rectHeight = 1, u.rectWidth = 1, u._rect = u.paper.add("rect"), u.addElement(u._rect), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this), this.properties.rotationX = this.width / 2, this.properties.rotationY = this.height / 2, this._rect && this._rect.attr({ width: this.rectWidth, height: this.rectHeight, x: (this.width - this.rectWidth) / 2, y: (this.height - this.rectHeight) / 2 }); + }, Object.defineProperty(R.prototype, "rectWidth", { get: function() { + return this.properties.rectWidth; + }, set: function(u) { + this.properties.rectWidth = u, this.draw(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rectHeight", { get: function() { + return this.properties.rectHeight; + }, set: function(u) { + this.properties.rectHeight = u, this.draw(); + }, enumerable: !0, configurable: !0 }), R; + }(qv); + hi.registeredClasses.RectPattern = mg; + var Ore = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColorizeFilter", u.feColorMatrix = u.paper.add("feColorMatrix"), u.feColorMatrix.attr({ type: "matrix" }), u.filterPrimitives.push(u.feColorMatrix), u.intensity = 1, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyFilter = function() { + var u, w, $, G = this.intensity, K = 1 - G, ne = this.color; + ne && ne.rgb ? (u = ne.rgb.r / 255 * G, w = ne.rgb.g / 255 * G, $ = ne.rgb.b / 255 * G) : (u = 0, w = 0, $ = 0), this.feColorMatrix.attr({ values: K + " 0 0 0 " + u + " 0 " + K + " 0 0 " + w + " 0 0 " + K + " 0 " + $ + " 0 0 0 1 0" }); + }, Object.defineProperty(R.prototype, "color", { get: function() { + return this.properties.color; + }, set: function(u) { + this.properties.color = u, this.applyFilter(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "intensity", { get: function() { + return this.properties.intensity; + }, set: function(u) { + this.properties.intensity = u, this.applyFilter(); + }, enumerable: !0, configurable: !0 }), R; + }(o2); + hi.registeredClasses.ColorizeFilter = Ore; + var CL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "DesaturateFilter", u.feColorMatrix = u.paper.add("feColorMatrix"), u.feColorMatrix.attr({ type: "saturate" }), u.filterPrimitives.push(u.feColorMatrix), u.width = 120, u.height = 120, u.saturation = 0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "saturation", { get: function() { + return this.properties.saturation; + }, set: function(u) { + this.properties.saturation = u, this.feColorMatrix.attr({ values: u.toString() }); + }, enumerable: !0, configurable: !0 }), R; + }(o2); + hi.registeredClasses.DesaturateFilter = CL; + var Rre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "BlurFilter", u.feGaussianBlur = u.paper.add("feGaussianBlur"), u.feGaussianBlur.attr({ result: "blurOut", in: "SourceGraphic" }), u.filterPrimitives.push(u.feGaussianBlur), u.width = 200, u.height = 200, u.blur = 1.5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "blur", { get: function() { + return this.properties.blur; + }, set: function(u) { + this.properties.blur = u, this.feGaussianBlur.attr({ stdDeviation: u / this.scale }); + }, enumerable: !0, configurable: !0 }), R; + }(o2); + hi.registeredClasses.BlurFilter = Rre; + var Mre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "FocusFilter", u.feFlood = u.paper.add("feFlood"), u.feFlood.attr({ "flood-color": new Fa().getFor("primaryButtonHover"), result: "base" }), u.filterPrimitives.push(u.feFlood), u.feMorphology = u.paper.add("feMorphology"), u.feMorphology.attr({ result: "bigger", in: "SourceGraphic", operator: "dilate", radius: "2" }), u.filterPrimitives.push(u.feMorphology), u.feColorMatrix = u.paper.add("feColorMatrix"), u.feColorMatrix.attr({ result: "mask", in: "bigger", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0" }), u.filterPrimitives.push(u.feColorMatrix), u.feComposite = u.paper.add("feComposite"), u.feComposite.attr({ result: "drop", in: "base", in2: "mask", operator: "in" }), u.filterPrimitives.push(u.feComposite), u.feBlend = u.paper.add("feBlend"), u.feBlend.attr({ in: "SourceGraphic", in2: "drop", mode: "normal" }), u.filterPrimitives.push(u.feBlend), u.width = 130, u.height = 130, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "stroke", { get: function() { + return this.properties.stroke; + }, set: function(u) { + this.properties.stroke = u, this.feFlood.attr({ "flood-color": u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "strokeWidth", { get: function() { + return this.properties.strokeWidth; + }, set: function(u) { + this.properties.strokeWidth = u, this.feMorphology.attr({ radius: u }); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "opacity", { get: function() { + return this.properties.opacity; + }, set: function(u) { + this.properties.opacity = u, this.feColorMatrix.attr({ values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " + u + " 0" }); + }, enumerable: !0, configurable: !0 }), R.prototype.setSprite = function(u) { + this._sprite && this._sprite != u && this._sprite.group.removeStyle("outline"), u.group.addStyle({ outline: "none" }), U.prototype.setSprite.call(this, u); + }, R; + }(o2), Mm = function(U) { + function R() { + var u = U.call(this) || this; + return u._list = [], u._currentStep = 0, u._startIndex = 0, u._currentPass = 0, u.baseColor = new Ie({ r: 103, g: 183, b: 220 }), u.stepOptions = {}, u.passOptions = { brighten: -0.2 }, u.step = 1, u.minColors = 20, u.minLightness = 0.2, u.maxLightness = 0.9, u.shuffle = !1, u.wrap = !0, u.reuse = !1, u.saturation = 1, u.className = "ColorSet", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "list", { get: function() { + return this._list || this.generate(this.minColors), this._list; + }, set: function(u) { + this._list = u, this.reset(); + }, enumerable: !0, configurable: !0 }), R.prototype.getReusableColor = function(u) { + if (this._list.length == 0) + return this.generate(1), this.list[0]; + var w = u - Math.floor(u / this._list.length) * this.list.length; + return this.list[w]; + }, R.prototype.next = function() { + var u; + return this.list.length <= this._currentStep ? this.reuse ? u = this.getReusableColor(this._currentStep) : (this.generate(ve(this.minColors, this._currentStep + 1)), u = this.list[this._currentStep]) : u = this.list[this._currentStep], this._currentStep += this.step, u.saturate(this.saturation); + }, R.prototype.getIndex = function(u) { + var w; + return this.list.length <= u ? this.reuse ? w = this.getReusableColor(u) : (this.generate(this.minColors), w = this.getIndex(u)) : w = this.list[u], w.saturate(this.saturation); + }, R.prototype.reset = function() { + this._currentStep = this._startIndex; + }, Object.defineProperty(R.prototype, "currentStep", { get: function() { + return this._currentStep; + }, set: function(u) { + this._currentStep = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startIndex", { get: function() { + return this._startIndex; + }, set: function(u) { + this._startIndex = u, this.reset(); + }, enumerable: !0, configurable: !0 }), R.prototype.generate = function(u) { + var w = oe(Be(this.currentColor.rgb)), $ = Ee(this.stepOptions.hue) ? this.stepOptions.hue : 1 / u, G = { brighten: 0, lighten: 0, hue: w.h, lightness: w.l, saturation: w.s }, K = [], ne = this.list.length == 0 ? 0 : 1; + if (this.reuse) + for (var ue = ne; ue <= u; ue++) + K.push(oe(Be(this._list[ue].rgb)).h); + else + for (ue = ne; ue <= u; ue++) { + var we = w.h + $ * ue; + this.wrap && we > 1 && (we -= 1), K.push(we); + } + for (this.shuffle && K.sort(function(Ze, pt) { + return Math.random() - 0.5; + }), ue = 0; ue < u; ue++) { + this.reuse ? w = oe(Be(this._list[ue].rgb)) : w.h = K.shift(), this.applyStepOptions(w, G, ue, this._currentPass); + var De = We(xt(w)), $e = (this.stepOptions.brighten || 0) * ue + (this.passOptions.brighten || 0) * this._currentPass; + $e != 0 && ($e = this.wrap ? By($e, this.minLightness, this.maxLightness) : hg($e, this.minLightness, this.maxLightness), De = De.brighten($e)); + var Ke = (this.stepOptions.lighten || 0) * ue + (this.passOptions.lighten || 0) * this._currentPass; + Ke != 0 && (Ke = this.wrap ? By(Ke, this.minLightness, this.maxLightness) : hg(Ke, this.minLightness, this.maxLightness), De = De.lighten(Ke)), this._list.push(De); + } + this._currentPass++; + }, Object.defineProperty(R.prototype, "currentColor", { get: function() { + return this._list.length == 0 ? this.baseColor.saturate(this.saturation) : this._list[this._list.length - 1].saturate(this.saturation); + }, enumerable: !0, configurable: !0 }), R.prototype.applyStepOptions = function(u, w, $, G) { + u.l = w.lightness + (this.stepOptions.lightness || 0) * $ + (this.passOptions.lightness || 0) * G, this.wrap ? (u.l > 1 ? u.l = u.l - Math.floor(u.l) : u.l < 0 && (u.l = -(u.l - Math.floor(u.l))), u.l = By(u.l, this.minLightness, this.maxLightness)) : (u.l > 1 ? u.l = 1 : u.l < 0 && (u.l = 0), u.l = hg(u.l, this.minLightness, this.maxLightness)); + }, R.prototype.processConfig = function(u) { + if (u) { + if (Ee(u.list) && gt(u.list)) + for (var w = 0, $ = u.list.length; w < $; w++) + u.list[w] instanceof Ie || (u.list[w] = We(u.list[w])); + !Ee(u.baseColor) || u.baseColor instanceof Ie || (u.baseColor = We(u.baseColor)); + } + U.prototype.processConfig.call(this, u); + }, R; + }(Ht); + hi.registeredClasses.ColorSet = Mm; + var CH = function(U) { + function R() { + var u = U.call(this) || this; + u._list = [], u._currentStep = 0, u._startIndex = 0, u._currentPass = 0, u.baseColor = new Ie({ r: 103, g: 183, b: 220 }), u.className = "PatternSet"; + var w = new Fa(); + return u.list = [u.getLinePattern(1e3, 45, 1, 6), u.getRectPattern(10, 0, 4), u.getLinePattern(1e3, -45, 1, 6), u.getCirclePattern(11, 2, !0), u.getLinePattern(6, 90, 1), u.getRectPattern(12, 45, 6, !0), u.getLinePattern(6, 0, 1), u.getRectPattern(7, 0, 4), u.getLinePattern(1e3, 45, 2, 3, "4,2"), u.getCirclePattern(9, 3, !1), u.getLinePattern(1e3, -45, 2, 3, "4,2"), u.getRectPattern(10, 45, Math.sqrt(50)), u.getLinePattern(1e3, -45, 2, 1), u.getRectPattern(10, 0, 9), u.getLinePattern(1e3, 45, 2, 1), u.getLinePattern(1e3, 0, 3, 1), u.getRectPattern(10, 45, 10), u.getLinePattern(1e3, 90, 3, 1)], u.baseColor = w.getFor("stroke"), u.applyTheme(), u; + } + return re(R, U), R.prototype.getLinePattern = function(u, w, $, G, K) { + var ne = new SH(); + return ne.width = u, ne.height = u, ne.stroke = this.baseColor, ne.gap = G, ne.strokeDasharray = K, ne.strokeWidth = $, ne.rotation = w, ne; + }, R.prototype.getRectPattern = function(u, w, $, G) { + var K = new mg(); + return K.width = u, K.height = u, K.rectWidth = $, K.rectHeight = $, G ? (K.stroke = this.baseColor, K.strokeWidth = 1, K.fillOpacity = 0) : (K.fill = this.baseColor, K.strokeWidth = 0), w != 0 && (K.shapeRendering = "auto"), K.rotation = w, K; + }, R.prototype.getCirclePattern = function(u, w, $) { + var G = new SL(); + return G.width = u, G.height = u, G.shapeRendering = "auto", G.radius = w, $ ? (G.stroke = this.baseColor, G.strokeWidth = 1, G.fillOpacity = 0) : (G.fill = this.baseColor, G.strokeWidth = 0), G; + }, Object.defineProperty(R.prototype, "list", { get: function() { + return this._list; + }, set: function(u) { + this._list = u, this.reset(); + }, enumerable: !0, configurable: !0 }), R.prototype.next = function() { + var u = this.getIndex(this.currentStep); + return this._currentStep++, u; + }, R.prototype.getIndex = function(u) { + for (; this.list.length <= u; ) + this.generatePatterns(); + return this.list[u].clone(); + }, R.prototype.generatePatterns = function() { + var u = this.list.length / (this._currentPass + 1); + this._currentPass++; + for (var w = 0; w < u; w++) + this.list.push(this.list[w].clone()); + }, R.prototype.reset = function() { + this._currentStep = this._startIndex; + }, Object.defineProperty(R.prototype, "currentStep", { get: function() { + return this._currentStep; + }, set: function(u) { + this._currentStep = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startIndex", { get: function() { + return this._startIndex; + }, set: function(u) { + this._startIndex = u, this.reset(); + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + U.prototype.processConfig.call(this, u); + }, R; + }(Ht); + hi.registeredClasses.PatternSet = CH; + var Dre = function() { + function U() { + this._disposed = !1, this._disposers = []; + } + return U.prototype.init = function() { + }, U.prototype.isDisposed = function() { + return this._disposed; + }, U.prototype.dispose = function() { + if (!this._disposed) { + this._disposed = !0; + var R = this._disposers; + for (this._disposers = null; R.length !== 0; ) + R.shift().dispose(); + } + }, U; + }(), Fre = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "AmChartsLogo", u.valign = "bottom", u.opacity = 0.3, u.defaultState.properties.opacity = 0.4, u.url = "https://www.amcharts.com/", u.urlTarget = "_blank", u.showSystemTooltip = !0, u.readerTitle = "Chart created using amCharts library", u.width = 66, u.height = 21, u.background.opacity = 0; + var w = We("#474758"); + new Fa().getFor("background").alternative.hex == "#ffffff" && (w = We("#ffffff")); + var $ = new qg(); + $.addColor(w), $.addColor(w, 1, 0.75), $.addColor(We("#3cabff"), 1, 0.755), $.rotation = -10; + var G = $, K = u.createChild(eR); + K.shouldClone = !1, K.isMeasured = !1, K.segments = [[{ x: 15, y: 15 }, { x: 27, y: 15 }, { x: 36, y: 6 }, { x: 40.5, y: 10.5 }, { x: 45, y: 6 }, { x: 54, y: 15 }, { x: 60, y: 15 }]], K.strokeWidth = 6 * 0.3, K.tensionX = 0.8, K.tensionY = 1, K.stroke = We("#3cabff"); + var ne = u.createChild(eR); + ne.shouldClone = !1, ne.isMeasured = !1, ne.segments = [[{ x: 6, y: 15 }, { x: 15, y: 15 }, { x: 27, y: 12 * 0.3 }, { x: 39.9, y: 15 }, { x: 51, y: 15 }, { x: 60, y: 15 }]], ne.strokeWidth = 6 * 0.3, ne.tensionX = 0.75, ne.tensionY = 1, ne.stroke = G, u._disposers.push(ne); + var ue = new CL(); + u.filters.push(ue); + var we = new CL(); + we.saturation = 1; + var De = u.states.create("hover"); + return De.properties.opacity = 1, De.filters.push(we), u.applyTheme(), u; + } + return re(R, U), R; + }(Qn); + function TH(U, R) { + var u = cL(U), w = !1; + if (u || ((u = document.createElement("div")).style.width = "200px", u.style.height = "200px", u.style.top = "0", u.style.left = "0", u.style.visibility = "hidden", u.style.position = "absolute", document.body.appendChild(u), w = !0), u) { + u.innerHTML = ""; + var $ = new F1(u), G = new Qx($.SVGContainer, "svg-" + (X3.length - 1)), K = new Qn(); + K.htmlContainer = u, K.svgContainer = $, K.width = ce(100), K.height = ce(100), K.background.fillOpacity = 0, K.paper = G, G.append(K.group), w && CC(function() { + K.moveHtmlContainer(U); + }), K.relativeWidth = 1, K.relativeHeight = 1, $.container = K; + var ne = K.createChild(R); + ne.topParent = K; + var ue = ne.uid; + hi.invalidSprites[ue] = [], hi.invalidDatas[ue] = [], hi.invalidPositions[ue] = [], hi.invalidLayouts[ue] = [], K.baseId = ue, ne.isBaseSprite = !0, ne.focusFilter = new Mre(), hi.baseSprites.push(ne), hi.baseSpritesByUid[ue] = ne, ne.maskRectangle = { x: 0, y: 0, width: Math.max($.width || 0, 0), height: Math.max($.height || 0, 0) }, K.events.on("maxsizechanged", function(pt) { + pt.previousWidth != 0 && pt.previousHeight != 0 || K.deepInvalidate(), ne.maskRectangle && (ne.maskRectangle = { x: 0, y: 0, width: Math.max($.width || 0, 0), height: Math.max($.height || 0, 0) }); + }); + var we = null, De = function() { + ne.isDisposed() ? we = null : Hd(ne.dom) == null ? (W3("Chart was not disposed", ne.uid), we = null) : we = window.setTimeout(De, 1e3); + }; + De(), ne.addDisposer(new ln(function() { + we !== null && clearTimeout(we), ki(hi.baseSprites, ne), hi.baseSpritesByUid[ne.uid] = void 0; + })), ne.addDisposer(K); + var $e = K.createChild(Qn); + $e.topParent = K, $e.width = ce(100), $e.height = ce(100), $e.isMeasured = !1, K.tooltipContainer = $e, ne.tooltip = new $C(), ne.tooltip.hide(0), ne.tooltip.setBounds({ x: 0, y: 0, width: $e.maxWidth, height: $e.maxHeight }), $e.events.on("maxsizechanged", function() { + Be(ne.tooltip).setBounds({ x: 0, y: 0, width: $e.maxWidth, height: $e.maxHeight }); + }, void 0, !1); + var Ke = new s2(); + if (Ke.events.on("inited", function() { + Ke.__disabled = !0; + }, void 0, !1), K.preloader = Ke, ne instanceof Qn && !ne.hasLicense()) { + var Ze = $e.createChild(Fre); + $e.events.on("maxsizechanged", function(pt) { + $e.maxWidth <= 100 || $e.maxHeight <= 50 ? Ze.hide() : (Ze.isHidden || Ze.isHiding) && Ze.show(); + }, void 0, !1), ne.logo = Ze, Ze.align = "left", Ze.valign = "bottom"; + } + return ne.numberFormatter, K.isStandaloneInstance = !0, zd.onlyShowOnViewport, ne; + } + throw qo.log("html container not found"), new Error("html container not found"); + } + function TL() { + for (; hi.baseSprites.length !== 0; ) + hi.baseSprites.pop().dispose(); + } + function p_e(U) { + hi.queue.indexOf(U) == -1 && (U.__disabled = !0, U.tooltipContainer.__disabled = !0, U.events.disableType("appeared"), hi.queue.length == 0 && (hi.events.once("exitframe", function() { + Lre(U); + }), qo.requestFrame()), U.addDisposer(new ln(function() { + K8(U); + })), hi.queue.push(U)); + } + function K8(U) { + var R = hi.queue.indexOf(U); + if (R >= 0) { + hi.queue.splice(hi.queue.indexOf(U), 1); + var u = hi.queue[R]; + u && Lre(u); + } + } + function f_e(U) { + U.__disabled && TC(U.htmlContainer, zd.viewportTarget) && (U.vpDisposer && U.vpDisposer.dispose(), p_e(U)); + } + function Lre(U) { + U && U.tooltipContainer && (U.__disabled = !1, U.tooltipContainer.__disabled = !1, U.events.enableType("appeared"), U.dispatch("removedfromqueue"), U.showOnInit && U.events.on("appeared", function() { + K8(U); + }), U.vpDisposer && U.vpDisposer.dispose(), U instanceof Qn && U.invalidateLabels(), U.tooltipContainer && U.tooltipContainer.invalidateLayout(), U instanceof LC ? (U.invalidateData(), U.reinit(), U.events.once("datavalidated", function() { + U.showOnInit ? U.appear() : K8(U); + })) : (U.reinit(), U.events.once("inited", function() { + K8(U); + }), U.showOnInit && U.appear())); + } + function m_e(U, R) { + var u; + st(R) && (Ee(hi.registeredClasses[R]) ? R = hi.registeredClasses[R] : (R = hi.registeredClasses.Container, u = new Error("Class [" + R + "] is not loaded."))); + var w = TH(U, R); + return u && w.raiseCriticalError(u), w; + } + function g_e(U, R, u) { + var w, $; + Ee(u) || (u = U.type, delete U.type), Ee(R) || (R = U.container, delete U.container), st(u) && Ee(hi.registeredClasses[u]) ? w = hi.registeredClasses[u] : typeof u != "function" ? (w = Qn, $ = new Error("Class [" + u + "] is not loaded.")) : w = u; + var G = TH(R, w); + return $ ? G.raiseCriticalError($) : G.config = U, G; + } + function y_e(U, R) { + for (var u = [], w = 2; w < arguments.length; w++) + u[w - 2] = arguments[w]; + return new Promise(function($, G) { + hi.deferred.push({ scope: R, callback: U, args: u, resolve: $ }), hi.deferred.length == 1 && Nre(); + }); + } + function Nre() { + var U, R = hi.deferred[0]; + if (R) { + var u = (U = R.callback).call.apply(U, ke([R.scope], R.args)); + u.events.on("ready", function() { + R.resolve(u), hi.deferred.shift(), setTimeout(Nre, zd.deferredDelay); + }); + } + } + function v_e(U) { + hi.themes.indexOf(U) === -1 && hi.themes.push(U); + } + function __e(U) { + ki(hi.themes, U); + } + function b_e() { + hi.themes = []; + } + function w_e(U) { + zd.licenses.push(U); + } + var kre = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Grip"; + var w = new Fa(); + u.layout = "absolute", u.padding(10, 10, 10, 10), u.margin(3, 3, 3, 3), u.background.fillOpacity = 0.3, u.background.cornerRadius(10, 10, 10, 10); + var $ = new so(); + $.element = u.paper.add("path"); + var G = pn({ x: -6, y: 0 }); + return G += xr({ x: 6, y: 0 }), G += pn({ x: -8, y: -6 }), G += xr({ x: 0, y: -12 }), G += xr({ x: 8, y: -6 }), G += pn({ x: -8, y: 6 }), G += xr({ x: 0, y: 12 }), G += xr({ x: 8, y: 6 }), $.path = G, $.strokeWidth = 2, $.fillOpacity = 0, $.pixelPerfect = !0, $.padding(0, 4, 0, 4), $.stroke = w.getFor("text"), $.strokeOpacity = 0.7, $.align = "center", $.valign = "middle", u.icon = $, u.label.dispose(), u.label = void 0, u.position = "right", u.autoHideDelay = 3e3, u.events.on("shown", function(K) { + u._autoHideTimeout && u._autoHideTimeout.dispose(), u.autoHideDelay && (u._autoHideTimeout = u.setTimeout(function() { + u.hide(); + }, u.autoHideDelay)); + }), u.events.on("down", function(K) { + u._autoHideTimeout && u._autoHideTimeout.dispose(); + }), u.events.on("out", function(K) { + u.autoHideDelay && (u._autoHideTimeout = u.setTimeout(function() { + u.hide(); + }, u.autoHideDelay)); + }), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "position", { get: function() { + return this.getPropertyValue("position"); + }, set: function(u) { + if (this.setPropertyValue("position", u)) + switch (u) { + case "left": + this.align = "left", this.valign = "middle", this.horizontalCenter = "left", this.verticalCenter = "middle", this.icon.rotation = 0, this.width = void 0, this.height = ce(30); + break; + case "right": + this.align = "right", this.valign = "middle", this.horizontalCenter = "right", this.verticalCenter = "middle", this.icon.rotation = 0, this.width = void 0, this.height = ce(30); + break; + case "top": + this.align = "center", this.valign = "top", this.horizontalCenter = "middle", this.verticalCenter = "top", this.icon.rotation = 90, this.width = ce(30), this.height = void 0; + break; + case "bottom": + this.align = "center", this.valign = "bottom", this.horizontalCenter = "middle", this.verticalCenter = "bottom", this.icon.rotation = 90, this.width = ce(30), this.height = void 0; + break; + default: + this.align = "center", this.valign = "middle", this.horizontalCenter = "middle", this.verticalCenter = "middle", this.icon.rotation = 90, this.width = ce(30), this.height = void 0; + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "autoHideDelay", { get: function() { + return this.getPropertyValue("autoHideDelay"); + }, set: function(u) { + this.setPropertyValue("autoHideDelay", u); + }, enumerable: !0, configurable: !0 }), R; + }(t2); + hi.registeredClasses.Grip = kre; + var EH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(FC), Kb = function(U) { + function R() { + var u = U.call(this) || this; + if (u._legend = new Un(), u.constructor === R) + throw new Error("'Chart' cannot be instantiated directly. Please use a specific chart type."); + u.className = "Chart"; + var w = new Rm(); + u.titles = new Xs(w), u._disposers.push(new Wo(u.titles)), u._disposers.push(w), u.width = ce(100), u.height = ce(100), u.layout = "vertical"; + var $ = u.createChild(Qn); + $.shouldClone = !1, $.layout = "vertical", $.width = ce(100), $.height = ce(100), u.chartAndLegendContainer = $; + var G = $.createChild(Qn); + return G.shouldClone = !1, G.width = ce(100), G.height = ce(100), u.chartContainer = G, u.showOnInit = !0, u._disposers.push(u._legend), u.titles.events.on("inserted", function(K) { + u.processTitle(K), u.updateReaderTitleReferences(); + }, u, !1), u.titles.events.on("removed", function(K) { + u.updateReaderTitleReferences(); + }, u, !1), u.role = "region", u.defaultState.transitionDuration = 1, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Chart")); + }, R.prototype.draw = function() { + this.fixLayout(), U.prototype.draw.call(this); + }, R.prototype.fixLayout = function() { + var u = this.legend; + if (u) { + var w = this.chartAndLegendContainer, $ = this.chartContainer; + switch ($.x = void 0, $.y = void 0, u.position != "absolute" && (u.x = void 0, u.y = void 0), u.position) { + case "left": + w.layout = "horizontal", u.toBack(); + break; + case "right": + w.layout = "horizontal", u.toFront(); + break; + case "top": + w.layout = "vertical", u.toBack(); + break; + case "bottom": + w.layout = "vertical", u.toFront(); + break; + case "absolute": + u.isMeasured = !1; + } + } + }, R.prototype.feedLegend = function() { + }, R.prototype.processTitle = function(u) { + var w = u.newValue; + return w.parent = this, w.toBack(), w.shouldClone = !1, w.align = "center", w.uidAttr(), w; + }, R.prototype.updateReaderTitleReferences = function() { + if (this.titles.length) { + var u = []; + er(this.titles.iterator(), function(w) { + u.push(w.uid); + }), this.setSVGAttribute({ "aria-labelledby": u.join(" ") }); + } else + this.removeSVGAttribute("aria-labelledby"); + }, Object.defineProperty(R.prototype, "legend", { get: function() { + return this._legend.get(); + }, set: function(u) { + this.setLegend(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setLegend = function(u) { + var w = this; + this._legend.get() !== u && (u ? (u.parent = this.chartAndLegendContainer, this._legend.set(u, u.events.on("propertychanged", function($) { + $.property == "position" && w.fixLayout(); + }, void 0, !1)), u.addDisposer(new ln(function() { + w.legend = void 0; + }))) : this._legend.reset(), this.feedLegend()); + }, R.prototype.dispose = function() { + this.legend && this.legend.dispose(), U.prototype.dispose.call(this); + }, R.prototype.processConfig = function(u) { + u && Ee(u.legend) && !Ee(u.legend.type) && (u.legend.type = "Legend"), U.prototype.processConfig.call(this, u); + }, R.prototype.copyFrom = function(u) { + this.titles.copyFrom(u.titles), this.chartContainer.copyFrom(u.chartContainer), u.legend && (this.legend = u.legend.clone(), this.legend.removeChildren()), U.prototype.copyFrom.call(this, u); + }, Object.defineProperty(R.prototype, "dragGrip", { get: function() { + var u = this; + if (!this._dragGrip) { + var w = this.tooltipContainer.createChild(kre); + w.align = "right", w.valign = "middle", w.hide(0), w.events.on("down", function($) { + $.touch && (u.interactionsEnabled = !1); + }), w.events.on("up", function($) { + u.interactionsEnabled = !0; + }), this.events.on("down", function($) { + $.touch && w.show(); + }), this._dragGrip = w; + } + return this._dragGrip; + }, set: function(u) { + this._dragGrip = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "focusable", { get: function() { + return this.parent.focusable; + }, set: function(u) { + this.parent.focusable = u; + }, enumerable: !0, configurable: !0 }), R; + }(LC); + hi.registeredClasses.Chart = Kb, Wd.push({ relevant: gf.widthXS, state: function(U, R) { + if (U instanceof Kb) { + var u = U.states.create(R); + return U.pixelPaddingLeft > 10 && (u.properties.paddingLeft = 10), U.pixelPaddingRight > 10 && (u.properties.paddingRight = 10), u; + } + return null; + } }), Wd.push({ relevant: gf.heightXS, state: function(U, R) { + if (U instanceof Kb) { + var u = U.states.create(R); + return U.pixelPaddingTop > 10 && (u.properties.paddingTop = 10), U.pixelPaddingBottom > 10 && (u.properties.paddingBottom = 10), u; + } + return null; + } }), Wd.push({ relevant: gf.widthXXS, state: function(U, R) { + if (U instanceof Kb) { + var u = U.states.create(R); + return u.properties.paddingLeft = 0, u.properties.paddingRight = 0, u; + } + return null; + } }), Wd.push({ relevant: gf.heightXXS, state: function(U, R) { + if (U instanceof Kb) { + var u = U.states.create(R); + return u.properties.paddingTop = 0, u.properties.paddingBottom = 0, u; + } + return null; + } }); + var Mo = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Bullet", u.isMeasured = !1, u.tooltipX = 0, u.tooltipY = 0, u.layout = "none", u.applyOnClones = !0, u.copyToLegendMarker = !0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "locationX", { get: function() { + return this.getPropertyValue("locationX"); + }, set: function(u) { + if (this.setPropertyValue("locationX", u)) { + var w = this.dataItem; + w && w.component && w.component.invalidate(); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "locationY", { get: function() { + return this.getPropertyValue("locationY"); + }, set: function(u) { + if (this.setPropertyValue("locationY", u)) { + var w = this.dataItem; + w && w.component && w.component.invalidate(); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "xField", { get: function() { + return this.getPropertyValue("xField"); + }, set: function(u) { + this.setPropertyValue("xField", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yField", { get: function() { + return this.getPropertyValue("yField"); + }, set: function(u) { + this.setPropertyValue("yField", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "isDynamic", { get: function() { + return this.getPropertyValue("isDynamic"); + }, set: function(u) { + this.setPropertyValue("isDynamic", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "copyToLegendMarker", { get: function() { + return this.getPropertyValue("copyToLegendMarker"); + }, set: function(u) { + this.setPropertyValue("copyToLegendMarker", u); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.Bullet = Mo, Wd.push({ relevant: gf.isXS, state: function(U, R) { + if (U instanceof Mo) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var J8 = function(U) { + function R() { + var u = U.call(this) || this; + return u.childrenCreated = !1, u.className = "LegendDataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "label", { get: function() { + var u = this; + if (!this._label) { + var w = this.component.labels.create(); + this._label = w, this.addSprite(w), this._disposers.push(w), w.parent = this.itemContainer, this._disposers.push(new ln(function() { + Ee(u.component) && u.component.labels.removeValue(w); + })); + } + return this._label; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "color", { get: function() { + return this.properties.color; + }, set: function(u) { + this.setProperty("color", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "valueLabel", { get: function() { + var u = this; + if (!this._valueLabel) { + var w = this.component.valueLabels.create(); + this._valueLabel = w, this.addSprite(w), this._disposers.push(w), w.parent = this.itemContainer, this._disposers.push(new ln(function() { + Ee(u.component) && u.component.valueLabels.removeValue(w); + })); + } + return this._valueLabel; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "itemContainer", { get: function() { + var u = this; + if (!this._itemContainer) { + var w = this.component, $ = w.itemContainers.create(); + $.parent = w, this._itemContainer = $, this.addSprite($), this._disposers.push($), $.togglable && $.events.on("toggled", function(ne) { + w.toggleDataItem(ne.target.dataItem); + }, void 0, !1), $.focusable && ($.events.on("hit", function(ne) { + w.focusedItem = void 0; + }, void 0, !1), $.events.on("focus", function(ne) { + w.focusedItem = ne.target.dataItem; + }, void 0, !1), $.events.on("blur", function(ne) { + w.focusedItem = void 0; + }, void 0, !1)), this._disposers.push(new ln(function() { + Ee(u.component) && u.component.itemContainers.removeValue($); + })), this.dataContext.uidAttr && ($.readerControls = this.dataContext.uidAttr(), $.readerLabelledBy = this.dataContext.uidAttr()); + var G = this.dataContext; + if ((G instanceof FC || G instanceof so) && !G.isDisposed()) { + var K = function(ne) { + $.readerChecked = ne.visible, $.events.disableType("toggled"), $.isActive = !ne.visible, $.events.enableType("toggled"); + }; + G.addDisposer(new ln(function() { + u.component && u.component.dataItems.remove(u); + })), G instanceof so ? ($.addDisposer(G.events.on("visibilitychanged", K, void 0, !1)), $.addDisposer(G.events.on("hidden", function(ne) { + $.readerChecked = !1, $.events.disableType("toggled"), $.isActive = !0, $.events.enableType("toggled"); + }, void 0, !1)), $.addDisposer(G.events.on("shown", function(ne) { + $.readerChecked = !0, $.events.disableType("toggled"), $.isActive = !1, $.events.enableType("toggled"); + }, void 0, !1))) : $.addDisposer(G.events.on("visibilitychanged", K, void 0, !1)); + } + } + return this._itemContainer; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "marker", { get: function() { + var u = this; + if (!this._marker) { + var w = this.component.markers.create(); + this._marker = w, w.parent = this.itemContainer, this.addSprite(w), this._disposers.push(w), this._disposers.push(new ln(function() { + Ee(u.component) && u.component.markers.removeValue(w); + })); + } + return this._marker; + }, enumerable: !0, configurable: !0 }), R; + }(FC), IH = function() { + this.createMarker = !0; + }, EL = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Legend", u.layout = "grid", u.setPropertyValue("useDefaultMarker", !1), u.setPropertyValue("scrollable", !1), u.setPropertyValue("contentAlign", "center"); + var w = new Qn(); + w.applyOnClones = !0, w.padding(8, 0, 8, 0), w.margin(0, 10, 0, 10), w.layout = "horizontal", w.clickable = !0, w.focusable = !0, w.role = "switch", w.togglable = !0, w.cursorOverStyle = vl.pointer, w.background.fillOpacity = 0, u.itemContainers = new Xs(w), u._disposers.push(new Wo(u.itemContainers)), u._disposers.push(u.itemContainers.template), u._disposers.push(Gs().body.events.on("keyup", function(De) { + if (dg.isKey(De.event, "enter") && u.focusedItem) { + var $e = u.focusedItem, Ke = $e.itemContainer; + Ke.togglable ? u.toggleDataItem($e) : Ke.clickable && Ke.events.isEnabled("hit") && (Ke.dispatchImmediately("hit", { event: De }), u.focusedItem = $e); + } + }, u)); + var $ = new Fa(), G = new Qn(); + G.width = 23, G.height = 23, G.interactionsEnabled = !1, G.applyOnClones = !0, G.setStateOnChildren = !0, G.background.fillOpacity = 0, G.background.strokeOpacity = 0, G.propertyFields.fill = "fill", G.valign = "middle"; + var K = $.getFor("disabledBackground"); + G.events.on("childadded", function(De) { + var $e = De.newValue.states.create("active"); + $e.properties.stroke = K, $e.properties.fill = K; + }), u.markers = new Xs(G), u._disposers.push(new Wo(u.markers)), u._disposers.push(u.markers.template); + var ne = G.createChild(L1); + ne.width = ce(100), ne.height = ce(100), ne.applyOnClones = !0, ne.propertyFields.fill = "fill", ne.strokeOpacity = 0; + var ue = new Rm(); + ue.text = "{name}", ue.margin(0, 5, 0, 5), ue.valign = "middle", ue.applyOnClones = !0, ue.states.create("active").properties.fill = $.getFor("disabledBackground"), u.labels = new Xs(ue), u._disposers.push(new Wo(u.labels)), u._disposers.push(u.labels.template), ue.interactionsEnabled = !1, ue.truncate = !0, ue.fullWords = !1; + var we = new Rm(); + return we.margin(0, 5, 0, 0), we.valign = "middle", we.width = 50, we.align = "right", we.textAlign = "end", we.applyOnClones = !0, we.states.create("active").properties.fill = $.getFor("disabledBackground"), we.interactionsEnabled = !1, u.valueLabels = new Xs(we), u._disposers.push(new Wo(u.valueLabels)), u._disposers.push(u.valueLabels.template), u.position = "bottom", w.states.create("active"), w.setStateOnChildren = !0, u.role = "group", u.events.on("layoutvalidated", u.handleScrollbar, u, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Legend")); + }, R.prototype.createDataItem = function() { + return new J8(); + }, R.prototype.validateDataElements = function() { + this.scrollbar && (this.scrollbar.start = 0, this.scrollbar.end = 1), U.prototype.validateDataElements.call(this); + }, R.prototype.validateDataElement = function(u) { + U.prototype.validateDataElement.call(this, u); + var w = u.itemContainer, $ = u.marker; + u.label; + var G = u.valueLabel; + w.readerChecked = u.dataContext.visible, u.dataContext.legendDataItem = u; + var K = u.label.maxWidth; + u.label.width instanceof J || (u.label.width = void 0), K > 0 && (u.label.maxWidth = K), G.align == "right" && (G.width = void 0); + var ne = u.dataContext.legendSettings, ue = u.dataContext; + !ue.createLegendMarker || this.useDefaultMarker && ue instanceof so ? this.markers.template.propertyFields.fill = void 0 : u.childrenCreated || (ue.createLegendMarker($), u.childrenCreated = !0), ue.updateLegendValue && ue.updateLegendValue(), ue.component && ue.component.updateLegendValue && ue.component.updateLegendValue(ue), G.invalid && G.validate(), G.text == "" || G.text == null ? G.__disabled = !0 : G.__disabled = !1, !ne || ne.itemValueText == null && ne.valueText == null || (G.__disabled = !1); + var we = u.dataContext.visible; + we === void 0 && (we = !0), we = Tt(we), u.dataContext.visible = we, w.events.disableType("toggled"), w.isActive = !we, w.isActive ? w.setState("active", 0) : w.setState("default", 0), w.events.enableType("toggled"); + }, R.prototype.afterDraw = function() { + var u = this, w = this.getPropertyValue("maxWidth"), $ = 0; + this.labels.each(function($e) { + $e.invalid && ($e.maxWidth = void 0, $e.validate()), $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight > $ && ($ = $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight); + }); + var G = 0; + this.valueLabels.each(function($e) { + $e.invalid && $e.validate(), $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight > G && (G = $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight); + }); + var K = 0; + this.markers.each(function($e) { + $e.invalid && $e.validate(), $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight > K && (K = $e.measuredWidth + $e.pixelMarginLeft + $e.pixelMarginRight); + }); + var ne, ue = this.itemContainers.template, we = ue.pixelMarginRight + ue.pixelMarginLeft, De = $ + G + K; + le(w) ? ((w -= we) > De && (w = De), ne = w - K - G) : ne = $, this.labels.each(function($e) { + (u.valueLabels.template.align == "right" || $e.measuredWidth > ne) && ($e.width instanceof J || ($e.width = Math.min($e.maxWidth, ne - $e.pixelMarginLeft - $e.pixelMarginRight), $e.maxWidth = $e.width)); + }), this.valueLabels.template.align == "right" && this.valueLabels.each(function($e) { + $e.width = G - $e.pixelMarginRight - $e.pixelMarginLeft; + }), U.prototype.afterDraw.call(this); + }, R.prototype.handleScrollbar = function() { + var u = this.scrollbar; + this.scrollable && u && (u.height = this.measuredHeight, u.x = this.measuredWidth - u.pixelWidth - u.pixelMarginLeft, this.contentHeight > this.measuredHeight ? (u.visible = !0, u.thumb.height = u.height * this.measuredHeight / this.contentHeight, this.paddingRight = u.pixelWidth + u.pixelMarginLeft + +u.pixelMarginRight) : u.visible = !1, u.handleThumbPosition(), this.updateMasks()); + }, Object.defineProperty(R.prototype, "position", { get: function() { + return this.getPropertyValue("position"); + }, set: function(u) { + this.setPropertyValue("position", u) && (u == "left" || u == "right" ? (this.margin(10, 5, 10, 10), this.valign = "middle", this.contentAlign = "none", this.valueLabels.template.align = "right", le(this.maxColumns) || (this.maxColumns = 1), this.width = void 0, this.maxWidth = 220) : (this.maxColumns = void 0, this.width = ce(100), this.valueLabels.template.align = "left"), this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "useDefaultMarker", { get: function() { + return this.getPropertyValue("useDefaultMarker"); + }, set: function(u) { + this.setPropertyValue("useDefaultMarker", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "scrollable", { get: function() { + return this.getPropertyValue("scrollable"); + }, set: function(u) { + if (this.setPropertyValue("scrollable", u, !0)) + if (u) { + var w = this.createChild(zy); + this.scrollbar = w, w.isMeasured = !1, w.orientation = "vertical", w.endGrip.__disabled = !0, w.startGrip.__disabled = !0, w.visible = !1, w.marginLeft = 5, this._mouseWheelDisposer = this.events.on("wheel", this.handleWheel, this, !1), this._disposers.push(this._mouseWheelDisposer), this._disposers.push(w.events.on("rangechanged", this.updateMasks, this, !1)); + } else + this._mouseWheelDisposer && (this._mouseWheelDisposer.dispose(), this.scrollbar && (this.scrollbar.dispose(), this.scrollbar = void 0)); + }, enumerable: !0, configurable: !0 }), R.prototype.handleWheel = function(u) { + var w = u.shift.y, $ = this.scrollbar; + if ($) { + var G = w / 1e3 * this.measuredHeight / this.contentHeight, K = $.end - $.start; + w > 0 ? ($.start = ve(0, $.start - G), $.end = $.start + K) : ($.end = H(1, $.end - G), $.start = $.end - K); + } + }, R.prototype.updateMasks = function() { + var u = this; + this.scrollbar && this.itemContainers.each(function(w) { + w.dy = -u.scrollbar.thumb.pixelY * u.contentHeight / u.measuredHeight, w.maskRectangle = { x: 0, y: -w.dy, width: u.measuredWidth, height: u.measuredHeight }; + }); + }, R.prototype.toggleDataItem = function(u) { + var w = u.dataContext; + !w.visible || w.isHiding || w instanceof so && w.isHidden ? (u.color = u.colorOrig, w.appeared = !0, u.itemContainer.isActive = !1, w.hidden === !0 && (w.hidden = !1), w.show ? w.show() : w.visible = !0, this.svgContainer.readerAlert(this.language.translate("%1 shown", this.language.locale, u.label.readerTitle))) : (u.itemContainer.isActive = !0, w.appeared = !0, w.hide ? w.hide() : w.visible = !1, this.svgContainer.readerAlert(this.language.translate("%1 hidden", this.language.locale, u.label.readerTitle)), u.color = new Fa().getFor("disabledBackground")); + }, Object.defineProperty(R.prototype, "preloader", { get: function() { + }, enumerable: !0, configurable: !0 }), R.prototype.handleDataItemPropertyChange = function(u, w) { + u.valueLabel.invalidate(), u.label.invalidate(); + }, R; + }(LC); + hi.registeredClasses.Legend = EL, Wd.push({ relevant: gf.widthXS, state: function(U, R) { + if (U instanceof EL && (U.position == "left" || U.position == "right")) { + var u = U.states.create(R); + return u.properties.position = "bottom", u; + } + return null; + } }), Wd.push({ relevant: gf.heightXS, state: function(U, R) { + if (U instanceof EL && (U.position == "top" || U.position == "bottom")) { + var u = U.states.create(R); + return u.properties.position = "right", u; + } + return null; + } }), Wd.push({ relevant: gf.isXS, state: function(U, R) { + if (U instanceof EL) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var IL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SeriesDataItem", u.values.value = {}, u.values.value = {}, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "bullets", { get: function() { + return this._bullets || (this._bullets = new ha(), this._disposers.push(new jd(this._bullets))), this._bullets; + }, enumerable: !0, configurable: !0 }), R.prototype.dispose = function() { + this.bullets.clear(), U.prototype.dispose.call(this); + }, Object.defineProperty(R.prototype, "value", { get: function() { + return this.values.value.value; + }, set: function(u) { + this.setValue("value", u); + }, enumerable: !0, configurable: !0 }), R; + }(FC), AL = function(U) { + function R() { + var u = U.call(this) || this; + if (u._ignoreMinMax = !1, u._showBullets = !0, u.legendSettings = new IH(), u._tmin = new ha(), u._tmax = new ha(), u._smin = new ha(), u._smax = new ha(), u.dataItemsByAxis = new ha(), u.skipFocusThreshold = 20, u._itemReaderTextChanged = !1, u.calculatePercent = !1, u.usePercentHack = !0, u.autoDispose = !0, u.simplifiedProcessing = !1, u.constructor === R) + throw new Error("'Series' cannot be instantiated directly. Please use a specific series type."); + u.className = "Series", u.isMeasured = !1, u.layout = "none", u.shouldClone = !1, u.setPropertyValue("hidden", !1), u.axisRanges = new Hs(), u.axisRanges.events.on("inserted", u.processAxisRange, u, !1), u.minBulletDistance = 0, u.mainContainer = u.createChild(Qn), u.mainContainer.shouldClone = !1, u.mainContainer.mask = u.createChild(so), u._disposers.push(u.mainContainer); + var w = u.mainContainer.createChild(Qn); + return u._shouldBeReady.push(w), w.shouldClone = !1, w.layout = "none", w.virtualParent = u, u._disposers.push(w), u.bulletsContainer = w, u.tooltip = new $C(), u.tooltip.virtualParent = u, u._disposers.push(u.tooltip), u.hiddenState.transitionEasing = N3, u.dataItem = u.createDataItem(), u._disposers.push(u.dataItem), u.dataItem.component = u, u.role = "group", u.applyTheme(), u; + } + return re(R, U), R.prototype.applyTheme = function() { + U.prototype.applyTheme.call(this); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Series")); + }, R.prototype.createDataItem = function() { + return new IL(); + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart; + }, set: function(u) { + this._chart = u; + }, enumerable: !0, configurable: !0 }), R.prototype.positionBullet = function(u) { + }, R.prototype.processBullet = function(u) { + var w = this, $ = u.newValue; + $.isTemplate = !0, this.events.once("datavalidated", function(G) { + w.itemsFocusable() && ($.focusable = !0); + }), this.invalidate(); + }, R.prototype.removeBullet = function(u) { + var w = u.oldValue; + this.dataItems.each(function($) { + var G = $.bullets.getKey(w.uid); + G && G.dispose(); + }), this.invalidate(); + }, R.prototype.validateDataItems = function() { + U.prototype.validateDataItems.call(this), this.processValues(!1); + }, R.prototype.getFirstValue = function(u, w) { + for (var $ = w; $ >= 0; $--) { + var G = this.dataItems.getIndex($).getActualWorkingValue(u); + if (le(G)) + return G; + } + return null; + }, R.prototype.getAbsoluteFirstValue = function(u) { + for (var w = 0; w < this.dataItems.length; w++) { + var $ = this.dataItems.getIndex(w).values[u].value; + if (le($)) + return $; + } + return null; + }, R.prototype.rangeChangeUpdate = function() { + U.prototype.rangeChangeUpdate.call(this), this.processValues(!0); + }, R.prototype.processValues = function(u) { + var w = this; + if (!this.simplifiedProcessing) { + var $ = this.dataItems, G = {}, K = {}, ne = {}, ue = {}, we = {}, De = {}, $e = {}, Ke = {}, Ze = {}, pt = {}, Vt = ve(0, this.startIndex); + Vt = H(Vt, this.dataItems.length); + var Yt = H(this.endIndex, this.dataItems.length); + if (le(Vt) || (Vt = 0), le(Yt) || (Yt = this.dataItems.length), Vt > 0) { + var ci = $.getIndex(Vt - 1); + mi(ci.values, function(sr, Or) { + var yr = ci.getActualWorkingValue(sr); + le(yr) && (Ke[sr] = yr); + }); + } + for (var ai = function(sr) { + var Or = $.getIndex(sr); + mi(Or.values, function(yr, As) { + var Fn = Or.getActualWorkingValue(yr); + if (le(Fn)) { + le(G[yr]) || (G[yr] = 0), G[yr]++, le(K[yr]) || (K[yr] = 0), K[yr] += Fn, le(ne[yr]) || (ne[yr] = 0), ne[yr] += Math.abs(Fn), le(De[yr]) || (De[yr] = Fn), $e[yr] = Fn, le(ue[yr]) ? ue[yr] > Fn && (ue[yr] = Fn) : ue[yr] = Fn, le(we[yr]) ? we[yr] < Fn && (we[yr] = Fn) : we[yr] = Fn, le(Ze[yr]) || (Ze[yr] = w.getFirstValue(yr, Vt)), le(pt[yr]) || (pt[yr] = w.getAbsoluteFirstValue(yr)), Or.setCalculatedValue(yr, Fn - Ze[yr], "change"), Or.setCalculatedValue(yr, (Fn - Ze[yr]) / Ze[yr] * 100, "changePercent"), Or.setCalculatedValue(yr, Fn - pt[yr], "startChange"), Or.setCalculatedValue(yr, (Fn - pt[yr]) / pt[yr] * 100, "startChangePercent"); + var Aa = Ke[yr]; + le(Aa) || (Aa = Fn), Or.setCalculatedValue(yr, Fn - Aa, "previousChange"), Or.setCalculatedValue(yr, (Fn - Aa) / Aa * 100, "previousChangePercent"), Ke[yr] = Fn; + } + }); + }, Gi = Vt; Gi < Yt; Gi++) + ai(Gi); + if (this.calculatePercent) { + var Ji = function(sr) { + var Or = $.getIndex(sr); + mi(Or.values, function(yr) { + var As = ne[yr], Fn = Or.getActualWorkingValue(yr); + if (le(Fn)) + if (As > 0) { + w.usePercentHack && Fn == As && (As = Or.values[yr].value); + var Aa = Fn / As * 100; + Or.setCalculatedValue(yr, Aa, "percent"); + } else + Or.setCalculatedValue(yr, 0, "percent"); + }); + }; + for (Gi = Vt; Gi < Yt; Gi++) + Ji(Gi); + } + if (Vt > 0) { + var Ci = $.getIndex(Vt - 1); + mi(Ci.values, function(sr) { + var Or = Ci.values[sr].value; + Ci.setCalculatedValue(sr, Or - De[sr], "change"), Ci.setCalculatedValue(sr, (Or - De[sr]) / De[sr] * 100, "changePercent"); + }); + } + var Hi = this.dataItem; + mi(Hi.values, function(sr) { + Hi.setCalculatedValue(sr, K[sr], "sum"), Hi.setCalculatedValue(sr, ne[sr], "absoluteSum"), Hi.setCalculatedValue(sr, K[sr] / G[sr], "average"), Hi.setCalculatedValue(sr, De[sr], "open"), Hi.setCalculatedValue(sr, $e[sr], "close"), Hi.setCalculatedValue(sr, ue[sr], "low"), Hi.setCalculatedValue(sr, we[sr], "high"), Hi.setCalculatedValue(sr, G[sr], "count"); + }); + } + }, R.prototype.validate = function() { + Yx() && this.filters.clear(), er(this.axisRanges.iterator(), function(G) { + G.validate(); + }), U.prototype.validate.call(this); + var u = this.bulletsContainer; + if (u.fill = this.fill, u.stroke = this.stroke, u.x = this.pixelX, u.y = this.pixelY, this.bulletsContainer.children.length > 0) + if (this._showBullets) { + for (var w = 0; w < this.startIndex; w++) + ($ = this.dataItems.getIndex(w)) && $.bullets.each(function(G, K) { + K.__disabled = !0; + }); + for (w = this.dataItems.length - 1; w > this.endIndex; w--) { + var $; + ($ = this.dataItems.getIndex(w)) && $.bullets.each(function(G, K) { + K.__disabled = !0; + }); + } + } else + this.bulletsContainer.children.each(function(G) { + G.__disabled = !0; + }); + this.updateTooltipBounds(); + }, R.prototype.updateTooltipBounds = function() { + if (this.topParent) { + var u = { x: 0, y: 0, width: this.topParent.maxWidth, height: this.topParent.maxHeight }; + this.tooltip.setBounds(u); + } + }, R.prototype.shouldCreateBullet = function(u, w) { + return !0; + }, R.prototype.validateDataElement = function(u) { + var w = this; + U.prototype.validateDataElement.call(this, u), this._showBullets ? (this.isHidden || (this.bulletsContainer.visible = !0), this.bullets.each(function($) { + var G = u.bullets.getKey($.uid); + if (w.shouldCreateBullet(u, $)) { + if (!G) { + var K = $.propertyFields.disabled, ne = u.dataContext; + K && ne && ne[K] === !1 ? ($.applyOnClones = !1, $.disabled = !1, G = $.clone(), $.disabled = !0, $.applyOnClones = !0) : G = $.clone(), G.shouldClone = !1, u.addSprite(G), w.visible && !w.isHiding || G.hide(0); + } + var ue = G.dataItem; + if (ue != u) { + ue && ue.bullets.setKey($.uid, void 0); + var we = w.itemReaderText; + G instanceof Mo && (we || (we = "{" + G.xField + "}: {" + G.yField + "}"), G.isDynamic && (u.events.on("workingvaluechanged", G.deepInvalidate, G, !1), w.dataItem.events.on("workingvaluechanged", G.deepInvalidate, G, !1)), G.deepInvalidate()), G.focusable && (G.events.on("focus", function(De) { + G.readerTitle = w.populateString(we, G.dataItem); + }, void 0, !1), G.events.on("blur", function(De) { + G.readerTitle = ""; + }, void 0, !1)), G.hoverable && (G.events.on("over", function(De) { + G.readerTitle = w.populateString(we, G.dataItem); + }, void 0, !1), G.events.on("out", function(De) { + G.readerTitle = ""; + }, void 0, !1)); + } + G.parent = w.bulletsContainer, u.bullets.setKey($.uid, G), G.maxWidth = u.itemWidth, G.maxHeight = u.itemHeight, G.__disabled = !1, w.positionBullet(G); + } else + G && (G.__disabled = !0); + })) : this.bulletsContainer.visible = !1; + }, R.prototype.handleDataItemWorkingValueChange = function(u, w) { + this.dataRangeInvalid || this.invalidateProcessedData(); + }, Object.defineProperty(R.prototype, "ignoreMinMax", { get: function() { + return this._ignoreMinMax; + }, set: function(u) { + this._ignoreMinMax = u, this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), R.prototype.createMask = function() { + }, R.prototype.processAxisRange = function(u) { + this.rangesContainer || (this.rangesContainer = this.createChild(Qn), this.rangesContainer.shouldClone = !1, this.rangesContainer.isMeasured = !1); + var w = u.newValue; + w && (w.contents.parent = this.rangesContainer, w.isRange = !0, w.events.on("valuechanged", this.invalidateDataItems, this, !1)); + }, R.prototype.getAxisField = function(u) { + }, R.prototype.showTooltipAtPosition = function(u, w) { + }, Object.defineProperty(R.prototype, "minBulletDistance", { get: function() { + return this.getPropertyValue("minBulletDistance"); + }, set: function(u) { + this.setPropertyValue("minBulletDistance", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bullets", { get: function() { + return this._bullets || (this._bullets = new Xs(new Mo()), this._bullets.template.virtualParent = this, this._bullets.events.on("inserted", this.processBullet, this, !1), this._bullets.events.on("removed", this.removeBullet, this, !1), this._disposers.push(new Wo(this._bullets)), this._disposers.push(this._bullets.template)), this._bullets; + }, enumerable: !0, configurable: !0 }), R.prototype.createLegendMarker = function(u) { + }, Object.defineProperty(R.prototype, "hiddenInLegend", { get: function() { + return this.getPropertyValue("hiddenInLegend"); + }, set: function(u) { + this.setPropertyValue("hiddenInLegend", u) && this.chart && this.chart.feedLegend(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "name", { get: function() { + return this.getPropertyValue("name"); + }, set: function(u) { + this.setPropertyValue("name", u); + var w = this.legendDataItem; + w && (w.component.invalidate(), w.component.invalidateRawData()), this.readerTitle = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "itemReaderText", { get: function() { + var u = this._itemReaderText; + return u || (this.tooltipText ? u = Sh(this.tooltipText) : this.tooltipHTML && (u = Sh(this.tooltipHTML))), this._adapterO ? this._adapterO.apply("itemReaderText", u) : u; + }, set: function(u) { + this._itemReaderText = u, this._itemReaderTextChanged = !0; + }, enumerable: !0, configurable: !0 }), R.prototype.itemsFocusable = function() { + return !(this.dataItems.length >= this.skipFocusThreshold); + }, Object.defineProperty(R.prototype, "legendDataItem", { get: function() { + return this._legendDataItem; + }, set: function(u) { + this._legendDataItem = u, this._legendDataItem.itemContainer.deepInvalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.updateLegendValue = function(u, w) { + if (this.legendDataItem) { + var $ = this.legendSettings, G = this.legendDataItem, K = G.label, ne = G.valueLabel; + u && !u.isDisposed() || w ? (ne && ($.itemValueText && (ne.text = $.itemValueText), ne.dataItem = u), K && ($.itemLabelText && (K.text = $.itemLabelText), K.dataItem = u)) : (K && (($.labelText || $.itemLabelText != null) && (K.text = $.labelText), K.dataItem = this.dataItem), ne && (($.valueText || $.itemValueText != null) && (ne.text = $.valueText), ne.dataItem = this.dataItem)); + } + }, R.prototype.copyFrom = function(u) { + this.bullets.copyFrom(u.bullets), this.bulletsContainer.copyFrom(u.bulletsContainer), this.calculatePercent = u.calculatePercent, this.usePercentHack = u.usePercentHack, this.simplifiedProcessing = u.simplifiedProcessing, U.prototype.copyFrom.call(this, u); + }, R.prototype.raiseCriticalError = function(u) { + this._chart && this._chart.modal && (this._chart.modal.content = this._chart.adapter.apply("criticalError", u).message, this._chart.modal.closable = !1, this._chart.modal.open(), this._chart.disabled = !0), console.log(u); + }, R.prototype.applyFilters = function() { + var u = this; + U.prototype.applyFilters.call(this), this.bulletsContainer.filters.clear(), er(this.filters.iterator(), function(w) { + u.bulletsContainer.filters.push(w.clone()); + }); + }, Object.defineProperty(R.prototype, "heatRules", { get: function() { + var u = this; + return this._heatRules || (this._heatRules = new Hs(), this._heatRules.events.on("inserted", function(w) { + var $ = w.newValue, G = $.target; + if (G) { + var K = $.dataField; + Ee(K) || (K = "value"); + var ne = u.dataItem, ue = $.property, we = It($.minValue), De = It($.maxValue); + le(we) || le(De) || u.dataItem.events.on("calculatedvaluechanged", function($e) { + $e.property == K && er(u.dataItems.iterator(), function(Ke) { + var Ze = !1; + _i(Ke.sprites, function(pt) { + if (pt.clonedFrom == G) { + var Vt = pt; + Vt[ue] = Vt[ue], Ze = !0; + } + }), Ze || _i(Ke.sprites, function(pt) { + pt instanceof Qn && er(pt.children.iterator(), function(Vt) { + if (Vt.className == G.className) { + var Yt = Vt; + Yt[ue] = Yt[ue]; + } else + Vt instanceof Qn && Vt.deepInvalidate(); + }); + }); + }); + }), u.dataItems.template.events.on("workingvaluechanged", function($e) { + if ($e.property == K) { + var Ke = $e.target, Ze = !1; + _i(Ke.sprites, function(pt) { + if (pt.clonedFrom == G) { + var Vt = pt; + Vt[ue] = Vt[ue], Ze = !0; + } + }), Ze || _i(Ke.sprites, function(pt) { + pt instanceof Qn && er(pt.children.iterator(), function(Vt) { + if (Vt.className == G.className) { + var Yt = Vt; + Yt[ue] = Yt[ue]; + } else + Vt instanceof Qn && Vt.deepInvalidate(); + }); + }); + } + }), G.adapter.add(ue, function($e, Ke, Ze) { + var pt = It($.minValue), Vt = It($.maxValue), Yt = $.min, ci = $.max; + if (Ke instanceof so) { + var ai = Ke.propertyFields[Ze]; + if (ai && Ke.dataItem) { + var Gi = Ke.dataItem.dataContext; + if (Gi && Ee(Gi[ai])) + return $e; + } + } + var Ji = Ke.dataItem; + if (le(pt) || (pt = ne.values[K].low), le(Vt) || (Vt = ne.values[K].high), Ji && Ji.values[K]) { + var Ci = Ji.getActualWorkingValue(K); + if (Ee(Yt) && Ee(ci) && le(pt) && le(Vt) && le(Ci)) { + var Hi = void 0; + if (Hi = $.logarithmic ? (Math.log(Ci) * Math.LOG10E - Math.log(pt) * Math.LOG10E) / (Math.log(Vt) * Math.LOG10E - Math.log(pt) * Math.LOG10E) : (Ci - pt) / (Vt - pt), !le(Ci) || le(Hi) && Math.abs(Hi) != 1 / 0 || (Hi = 0.5), le(Yt)) + return Yt + (ci - Yt) * Hi; + if (Yt instanceof Ie) + return new Ie(Wt(Yt.rgb, ci.rgb, Hi)); + } + } + return $e; + }); + } + })), this._heatRules; + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + var w; + if (u) { + if (Ee(u.bullets) && gt(u.bullets)) + for (var $ = 0, G = u.bullets.length; $ < G; $++) { + var K = u.bullets[$]; + Ee(K.type) || (K.type = "Bullet"); + } + Ee(u.heatRules) && gt(u.heatRules) && (w = u.heatRules, delete u.heatRules); + } + if (U.prototype.processConfig.call(this, u), w) { + for ($ = 0, G = w.length; $ < G; $++) { + var ne = w[$], ue = this; + if (Ee(ne.target) && st(ne.target)) + if (this.map.hasKey(ne.target)) + ue = this.map.getKey(ne.target); + else + for (var we = ne.target.split("."), De = 0; De < we.length; De++) + if (ue instanceof Hs) { + var $e = ue.getIndex(It(we[De])); + ue = $e || ue[we[De]]; + } else { + var Ke = we[De].match(/^(.*)\[([0-9]+)\]/); + ue = Ke ? ue[Ke[1]] instanceof Hs ? ue[Ke[1]].getIndex(It(Ke[2])) : ue[Ke[1]][It(Ke[2])] : ue[we[De]]; + } + ne.target = ue, Ee(ne.min) && (ne.min = this.maybeColorOrPercent(ne.min)), Ee(ne.max) && (ne.max = this.maybeColorOrPercent(ne.max)); + } + U.prototype.processConfig.call(this, { heatRules: w }); + } + }, R.prototype.configOrder = function(u, w) { + return u == w ? 0 : u == "heatRules" ? 1 : w == "heatRules" ? -1 : U.prototype.configOrder.call(this, u, w); + }, R.prototype.setVisibility = function(u) { + U.prototype.setVisibility.call(this, u), this.bulletsContainer.visible = u; + }, R; + }(LC); + hi.registeredClasses.Series = AL, hi.registeredClasses.SeriesDataItem = IL; + var AH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SerialChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(EH), Z8 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "SerialChart", u.colors = new Mm(), u._usesData = !1; + var w = u.chartContainer.createChild(Qn); + w.shouldClone = !1, w.width = ce(100), w.height = ce(100), w.isMeasured = !1, w.layout = "none", w.zIndex = 2, u.seriesContainer = w; + var $ = u.chartContainer.createChild(Qn); + return $.shouldClone = !1, $.width = ce(100), $.height = ce(100), $.isMeasured = !1, $.zIndex = 3, $.layout = "none", u.bulletsContainer = $, u.applyTheme(), u; + } + return re(R, U), R.prototype.dispose = function() { + U.prototype.dispose.call(this), this.colors && this.colors.dispose(), this.patterns && this.patterns.dispose(); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Serial chart")); + }, Object.defineProperty(R.prototype, "series", { get: function() { + return this._series || (this._series = new Xs(this.createSeries()), this._series.events.on("inserted", this.handleSeriesAdded, this, !1), this._series.events.on("removed", this.handleSeriesRemoved, this, !1), this._disposers.push(new Wo(this._series, !1)), this._disposers.push(this._series.template)), this._series; + }, enumerable: !0, configurable: !0 }), R.prototype.handleSeriesRemoved = function(u) { + var w = u.oldValue; + this.dataUsers.removeValue(w), this.dataUsers.each(function(we) { + we.invalidateDataItems(); + }), w.autoDispose ? w.dispose() : (w.parent = void 0, w.bulletsContainer.parent = void 0); + var $ = this.legend; + if ($) { + for (var G = this.legend.dataItems, K = G.length - 1; K >= 0; K--) { + var ne = G.getIndex(K); + ne && ne.dataContext == w && $.dataItems.remove(ne); + } + for (K = $.data.length - 1; K >= 0; K--) { + var ue = $.data[K]; + ue && ue == w && ki($.data, ue); + } + } + }, R.prototype.handleSeriesAdded = function(u) { + var w = this, $ = u.newValue; + $.isDisposed() || ($.chart = this, $.parent = this.seriesContainer, $.bulletsContainer.parent = this.bulletsContainer, this._dataUsers.moveValue($), $.addDisposer(new ln(function() { + w.dataUsers.removeValue($); + })), this.handleSeriesAdded2($), this.handleLegendSeriesAdded($)); + }, R.prototype.handleLegendSeriesAdded = function(u) { + u.hiddenInLegend || this.legend && this.legend.addData(u); + }, R.prototype.handleSeriesAdded2 = function(u) { + var w = this; + this.dataInvalid || this._disposers.push(hi.events.once("exitframe", function() { + u.data && u.data.length != 0 || (u.data = w.data, u.showOnInit && (u.reinit(), u.setPropertyValue("showOnInit", !1), u.showOnInit = !0), u.isDisposed() || u.events.once("datavalidated", function() { + u.data == w.data && (u._data = []); + })); + })); + }, R.prototype.feedLegend = function() { + var u = this.legend; + if (u) { + var w = []; + er(this.series.iterator(), function($) { + $.hiddenInLegend || w.push($); + }), u.dataFields.name = "name", u.data = w; + } + }, R.prototype.createSeries = function() { + return new AL(); + }, Object.defineProperty(R.prototype, "colors", { get: function() { + return this.getPropertyValue("colors"); + }, set: function(u) { + this.setPropertyValue("colors", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "patterns", { get: function() { + return this.getPropertyValue("patterns"); + }, set: function(u) { + this.setPropertyValue("patterns", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.series.copyFrom(u.series); + }, R.prototype.appear = function() { + U.prototype.appear.call(this), this.series.each(function(u) { + u.showOnInit && u.inited && u.appear(); + }); + }, R; + }(Kb); + hi.registeredClasses.SerialChart = Z8; + var PL = function(U) { + function R() { + var u = U.call(this) || this; + u._axis = new Un(), u.dataItems = new Hs(), u.className = "AxisBreak", u.breakSize = 0.01, u.marginLeft = -5, u.marginRight = -5, u.marginTop = -5, u.marginBottom = -5; + var w = new Fa(), $ = new Ar(); + $.fill = w.getFor("background"), $.stroke = We(), $.fillOpacity = 0.9, $.zIndex = 0, u._fillShape = $; + var G = new Ar(); + G.fill = We(), G.stroke = w.getFor("grid"), G.strokeOpacity = 0.3, G.zIndex = 1, u._startLine = G; + var K = new Ar(); + return K.fill = We(), K.stroke = We("#000000"), K.strokeOpacity = 0.3, K.zIndex = 2, u._endLine = K, u._disposers.push(u._axis), u.applyTheme(), u; + } + return re(R, U), R.prototype.dispose = function() { + U.prototype.dispose.call(this), this._fillShape && this._fillShape.dispose(), this._startLine && this._startLine.dispose(), this._endLine && this._endLine.dispose(); + }, Object.defineProperty(R.prototype, "startLine", { get: function() { + return this._startLine; + }, set: function(u) { + this._startLine && this._startLine.dispose(), this._startLine = u, this.addBreakSprite(u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endLine", { get: function() { + return this._endLine; + }, set: function(u) { + this._endLine && this._endLine.dispose(), this._endLine = u, this.addBreakSprite(u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fillShape", { get: function() { + return this._fillShape; + }, set: function(u) { + this._fillShape && this._fillShape.dispose(), this._fillShape = u, this.addBreakSprite(u); + }, enumerable: !0, configurable: !0 }), R.prototype.addBreakSprite = function(u) { + u.parent = this, u.isMeasured = !1, this._disposers.push(u); + }, Object.defineProperty(R.prototype, "axis", { get: function() { + return this._axis.get(); + }, set: function(u) { + if (this._axis.get() !== u) { + this._axis.set(u, u.renderer.gridContainer.events.on("transformed", this.invalidate, this, !1)), u.renderer.createBreakSprites(this); + var w = u.axisBreaks.template; + this.startLine.copyFrom(w.startLine), this.endLine.copyFrom(w.endLine), this.fillShape.copyFrom(w.fillShape); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "breakSize", { get: function() { + return this.getPropertyValue("breakSize"); + }, set: function(u) { + this.setPropertyValue("breakSize", u) && this.axis && (this.axis.invalidate(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startPoint", { get: function() { + var u = this.axis.renderer; + if (u) + return u.positionToPoint(this.startPosition); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endPoint", { get: function() { + var u = this.axis.renderer; + if (u) + return u.positionToPoint(this.endPosition); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startPosition", { get: function() { + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endPosition", { get: function() { + }, enumerable: !0, configurable: !0 }), R.prototype.draw = function() { + U.prototype.draw.call(this), this.axis && this.axis.renderer.updateBreakElement(this); + }, Object.defineProperty(R.prototype, "startValue", { get: function() { + return this.getPropertyValue("startValue"); + }, set: function(u) { + this.setPropertyValue("startValue", u) && this.axis && (this.axis.invalidate(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endValue", { get: function() { + return this.getPropertyValue("endValue"); + }, set: function(u) { + this.setPropertyValue("endValue", u) && this.axis && (this.axis.invalidate(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.AxisBreak = PL; + var $re, a2 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisDataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "grid", { get: function() { + if (!this._grid) { + var u = this.component; + if (u) { + var w, $ = void 0; + if (this.isRange) { + if (($ = u.axisRanges.template.grid).disabled) + return; + w = $.clone(); + } else { + if (($ = u.renderer.grid.template).disabled) + return; + w = u.renderer.grid.create(), this._disposers.push(new ln(function() { + u.renderer.grid.removeValue(w); + })); + } + this.grid = w, w.shouldClone = !1, this._disposers.push(w), w.axis = this.component; + } + } + return this._grid; + }, set: function(u) { + this._grid && this._grid != u && (ki(this.sprites, this._grid), this._grid.dataItem = void 0), u && (u.dataItem && u.dataItem != this && (ki(u.dataItem.sprites, u), u.dataItem.grid = void 0), this.addSprite(u)), this._grid = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tick", { get: function() { + if (!this._tick) { + var u = this.component; + if (u) { + var w, $ = void 0; + if (this.isRange) { + if (($ = u.axisRanges.template.tick).disabled) + return; + w = $.clone(); + } else { + if (($ = u.renderer.ticks.template).disabled) + return; + w = u.renderer.ticks.create(), this._disposers.push(new ln(function() { + u.renderer.ticks.removeValue(w); + })); + } + this.tick = w, w.axis = this.component, w.shouldClone = !1, this._disposers.push(w); + } + } + return this._tick; + }, set: function(u) { + this._tick && this._tick != u && (ki(this.sprites, this._tick), this._tick.dataItem = void 0), u && (u.dataItem && u.dataItem != this && (ki(u.dataItem.sprites, u), u.dataItem.tick = void 0), this.addSprite(u)), this._tick = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "label", { get: function() { + if (!this._label) { + var u = this.component; + if (u) { + var w, $ = void 0; + if (this.isRange) { + if (($ = u.axisRanges.template.label).disabled) + return; + w = $.clone(); + } else { + if (($ = u.renderer.labels.template).disabled) + return; + w = u.renderer.labels.create(), this._disposers.push(new ln(function() { + u.renderer.labels.removeValue(w); + })); + } + this._disposers.push(w), this.label = w, w.shouldClone = !1, w.axis = this.component, w.virtualParent = u; + } + } + return this._label; + }, set: function(u) { + this._label && this._label != u && (ki(this.sprites, this._label), this._label.dataItem = void 0), u && (u.dataItem && u.dataItem != this && (ki(u.dataItem.sprites, u), u.dataItem.label = void 0), this.addSprite(u)), this._label = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "axisFill", { get: function() { + if (!this._axisFill) { + var u = this.component; + if (u) { + var w, $ = void 0; + if (this.isRange) { + if ($ = u.axisRanges.template.axisFill, !this.isTemplate && $.disabled) + return; + w = $.clone(); + } else { + if (($ = u.renderer.axisFills.template).disabled) + return; + w = u.renderer.axisFills.create(), this._disposers.push(new ln(function() { + u.renderer.axisFills.removeValue(w); + })); + } + this.axisFill = w, w.shouldClone = !1, this._disposers.push(w); + } + } + return this._axisFill; + }, set: function(u) { + this._axisFill && this._axisFill != u && (ki(this.sprites, this._axisFill), this._axisFill.dataItem = void 0), u && (u.dataItem && u.dataItem != this && (ki(u.dataItem.sprites, u), u.dataItem.axisFill = void 0), u.axis = this.component, this.addSprite(u)), this._axisFill = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "text", { get: function() { + return this._text; + }, set: function(u) { + this._text = u, this._label && (this._label.text = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "mask", { get: function() { + return this._mask; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "contents", { get: function() { + if (!this._contents) { + var u = new Qn(); + this.addSprite(u), u.isMeasured = !1, this._contents = u; + var w = this.component; + if (w) { + var $ = w.renderer.createFill(this.component); + $.disabled = !1, $.axis = w, this.addSprite($), this._mask = $, u.mask = $; + } + } + return this._contents; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "axisBreak", { get: function() { + return this._axisBreak; + }, set: function(u) { + this._axisBreak && this._axisBreak.dataItems.removeValue(this), u && u.dataItems.push(this), this._axisBreak = u; + }, enumerable: !0, configurable: !0 }), R.prototype.validate = function() { + this.component && this.component.validateDataElement(this); + }, R.prototype.appendChildren = function() { + this.component && this.component.appendDataItem(this); + }, R.prototype.hasProperty = function(u) { + return u == "component" || U.prototype.hasProperty.call(this, u); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.text = u.text, u.bullet && (this.bullet = u.bullet.clone()), this.minPosition = u.minPosition, this.maxPosition = u.maxPosition; + }, R.prototype.setVisibility = function(u, w) { + U.prototype.setVisibility.call(this, u, w), this._contents && (this._contents.visible = u); + }, Object.defineProperty(R.prototype, "bullet", { get: function() { + return this._bullet; + }, set: function(u) { + this._bullet && this._bullet != u && (ki(this.sprites, this._bullet), this._bullet.dataItem = void 0), this._bullet = u, u && this.addSprite(u); + }, enumerable: !0, configurable: !0 }), R; + }(FC); + (function(U) { + U[U.Start = 0] = "Start", U[U.Middle = 0.5] = "Middle", U[U.End = 1] = "End"; + })($re || ($re = {})); + var OL = function(U) { + function R() { + var u = U.call(this) || this; + if (u._gridCount = 10, u._series = new Hs(), u.autoDispose = !0, u._axisItemCount = 0, u.constructor === R) + throw new Error("'Axis' cannot be instantiated directly. Please use a specific axis type."); + u.hideTooltipWhileZooming = !0, u.minWidth = 1e-4, u.minHeight = 1e-4, u.className = "Axis", u.shouldClone = !1, u.setPropertyValue("cursorTooltipEnabled", !0), u.toggleZoomOutButton = !0, u.zoomable = !0; + var w = new Fa(); + u.title = new Rm(), u.title.shouldClone = !1, u._disposers.push(u.title), u.setPropertyValue("startLocation", 0), u.setPropertyValue("endLocation", 1), u._dataItemsIterator = new Mp(u.dataItems, function() { + return u.dataItems.create(); + }), u._dataItemsIterator.createNewItems = !0; + var $ = new $C(); + u._disposers.push($), $.label.padding(5, 10, 5, 10), $.background.pointerLength = 5, $.fitPointerToBounds = !0, $.background.filters.clear(), $.virtualParent = u; + var G = $.background; + return G.cornerRadius = 0, G.fill = w.getFor("alternativeBackground"), G.stroke = G.fill, G.strokeWidth = 1, G.fillOpacity = 1, $.label.fill = w.getFor("alternativeText"), u.tooltip = $, u.readerHidden = !0, u.events.on("rangechangestarted", function() { + u.series.each(function(K) { + K.hideTooltipWhileZooming && (K.tooltip.hide(), K.tooltip.preventShow = !0); + }), u.hideTooltipWhileZooming && (u.tooltip.hide(), u.tooltip.preventShow = !0); + }, void 0, !1), u.events.on("rangechangeended", function() { + u.series.each(function(K) { + K.hideTooltipWhileZooming && (K.tooltip.hide(), K.tooltip.preventShow = !1); + }), u.hideTooltipWhileZooming && (u.tooltip.hide(), u.tooltip.preventShow = !1); + }, void 0, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.fillRule = function(u, w) { + le(w) || (w = u.index), w / 2 == Math.round(w / 2) ? (u.axisFill.__disabled = !0, u.axisFill.opacity = 0) : (u.axisFill.opacity = 1, u.axisFill.__disabled = !1); + }, R.prototype.createDataItem = function() { + return new a2(); + }, R.prototype.invalidateLayout = function() { + U.prototype.invalidateLayout.call(this), er(this.series.iterator(), function(u) { + u.invalidateLayout(); + }); + }, R.prototype.invalidateSeries = function() { + er(this.series.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.validateDataElements = function() { + this._axisItemCount = 0, this.ghostLabel && (this.renderer.updateLabelElement(this.ghostLabel, this.start, this.end), this.ghostLabel.validate()); + }, R.prototype.updateGridCount = function() { + if (this.renderer) { + var u = this.axisLength / this.renderer.minGridDistance; + u != this._gridCount && (this._gridCount = u, this.clearCache()); + } + }, R.prototype.validateLayout = function() { + this.axisFullLength = this.axisLength / (this.end - this.start), U.prototype.validateLayout.call(this), this.updateGridCount(); + var u = this.renderer; + u && (u.updateAxisLine(), u.updateTooltip(), u.updateBaseGridElement()), this._prevLength != this.axisLength && (this.dispatchImmediately("lengthchanged"), this._prevLength = this.axisLength); + }, R.prototype.initRenderer = function() { + }, R.prototype.appendDataItem = function(u) { + var w = this.renderer, $ = u.tick; + $ && ($.above ? $.parent = w.bulletsContainer : $.parent = w.gridContainer), u.label && (u.label.parent = w); + var G = u.axisFill; + G && (G.above ? G.parent = w.bulletsContainer : G.parent = w.gridContainer); + var K = u.grid; + K && (K.above ? K.parent = w.bulletsContainer : K.parent = w.gridContainer), u.bullet && (u.bullet.parent = w.bulletsContainer); + }, R.prototype.validate = function() { + U.prototype.validate.call(this), this.validateLayout(), this.renderer.updateGridContainer(); + }, R.prototype.validateAxisRanges = function() { + var u = this; + er(this.axisRanges.iterator(), function(w) { + u.appendDataItem(w), u.validateDataElement(w), w.grid && w.grid.validate(), w.tick && w.tick.validate(), w.axisFill && w.axisFill.validate(), w.label && w.label.validate(); + }); + }, R.prototype.validateBreaks = function() { + this._axisBreaks && er(this._axisBreaks.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.processBreak = function(u) { + var w = u.newValue; + w.parent = this.renderer.breakContainer, w.axis = this; + }, R.prototype.registerSeries = function(u) { + var w = this; + return this.series.moveValue(u), new kn([new ln(function() { + w.series.removeValue(u); + }), this.events.on("lengthchanged", u.invalidate, u, !1), this.events.on("lengthchanged", u.createMask, u, !1), this.events.on("startchanged", u.invalidate, u, !1), this.events.on("endchanged", u.invalidate, u, !1)]); + }, Object.defineProperty(R.prototype, "renderer", { get: function() { + return this._renderer; + }, set: function(u) { + if (u != this._renderer) { + this._renderer = u, u.chart = this.chart, u.axis = this, u.parent = this, this.title.parent = this, this.initRenderer(), this._disposers.push(u.gridContainer.events.on("maxsizechanged", this.invalidate, this, !1)); + var w = this.renderer.labels.create(); + this._disposers.push(w), w.dataItem = this.dataItems.template.clone(), w.text = "L", w.parent = this.renderer, w.shouldClone = !1, w.fillOpacity = 0, w.opacity = 0, w.strokeOpacity = 0, w.interactionsEnabled = !1, w.validate(), this.ghostLabel = w, this.events.on("beforedatavalidated", function() { + w.text = "L"; + }, void 0, !1); + } + }, enumerable: !0, configurable: !0 }), R.prototype.positionToAngle = function(u) { + return this.renderer.positionToAngle(u); + }, R.prototype.pointToPosition = function(u) { + return this.renderer.pointToPosition(u); + }, R.prototype.positionToCoordinate = function(u) { + return this.renderer.positionToCoordinate(u); + }, R.prototype.getAnyRangePath = function(u, w) { + return this.renderer.getPositionRangePath(u, w); + }, R.prototype.anyToPosition = function(u) { + return 0; + }, R.prototype.anyToPoint = function(u) { + return { x: 0, y: 0, angle: 0 }; + }, R.prototype.getPositionRangePath = function(u, w) { + return this.renderer ? this.renderer.getPositionRangePath(u, w) : ""; + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + return this.renderer ? this.renderer.axisLength : 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cursorTooltipEnabled", { get: function() { + return this.getPropertyValue("cursorTooltipEnabled"); + }, set: function(u) { + this.setPropertyValue("cursorTooltipEnabled", u) && (u && this.renderer ? this.renderer.updateTooltip() : this.tooltip && this.tooltip.hide(0)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "toggleZoomOutButton", { get: function() { + return this.getPropertyValue("toggleZoomOutButton"); + }, set: function(u) { + this.setPropertyValue("toggleZoomOutButton", u); + }, enumerable: !0, configurable: !0 }), R.prototype.hideTooltip = function(u) { + U.prototype.hideTooltip.call(this, u), this._tooltipPosition = void 0; + }, R.prototype.showTooltipAtPosition = function(u, w) { + var $ = this._tooltip; + if (!$ || this.dataItems.length <= 0) + this._tooltipPosition = void 0; + else { + if (w || (u = this.toAxisPosition(u)), !le(u) || u < this.start || u > this.end) + return $.hide(0), void (this._tooltipPosition = void 0); + var G = this.renderer; + $.parent || ($.parent = this.tooltipContainer); + var K = G.tooltipLocation, ne = this.getCellStartPosition(u), ue = this.getCellEndPosition(u); + if (this.tooltipPosition == "fixed" && (u = ne + (ue - ne) * K), u = mt(u, this.start, this.end), this._tooltipPosition != u) { + this._tooltipPosition = u; + var we = G.tooltipLocation2, De = G.positionToPoint(ne, we), $e = G.positionToPoint(ue, we); + this.currentItemStartPoint = De, this.currentItemEndPoint = $e, G.fullWidthTooltip && ($.width = $e.x - De.x, $.height = $e.y - De.y); + var Ke = kf(G.positionToPoint(u, we), this.renderer.line); + $.text = this.getTooltipText(u), $.text && ($.delayedPointTo(Ke), $.show()); + } + this.cursorTooltipEnabled && !this.tooltip.disabled || $.hide(0); + } + }, R.prototype.toAxisPosition = function(u) { + if ((u = this.renderer.toAxisPosition(u)) != null) + return u *= this.end - this.start, this.renderer.inversed ? this.end - u : this.start + u; + }, R.prototype.toGlobalPosition = function(u) { + return this.renderer.inversed ? u = this.end - u : u -= this.start, u / (this.end - this.start); + }, R.prototype.getTooltipText = function(u) { + }, R.prototype.updateTooltip = function(u, w) { + var $ = this._tooltip; + $ && ($.fixDoc = !1, $.pointerOrientation = u, $.setBounds(rt(w, this.renderer.line))); + }, R.prototype.roundPosition = function(u, w, $) { + return u; + }, R.prototype.getCellStartPosition = function(u) { + return u; + }, R.prototype.getCellEndPosition = function(u) { + return u; + }, Object.defineProperty(R.prototype, "axisRanges", { get: function() { + if (!this._axisRanges) { + var u = this.createDataItem(); + u.isRange = !0, u.axisFill = this.renderer.axisFills.template.clone(), u.grid = this.renderer.grid.template.clone(), u.tick = this.renderer.ticks.template.clone(), u.label = this.renderer.labels.template.clone(), u.isTemplate = !0, u.component = this, u.axisFill.disabled = !1, u.tick.disabled = !1, u.grid.disabled = !1, u.label.disabled = !1, this._axisRanges = new Xs(u), this._axisRanges.events.on("inserted", this.processAxisRange, this, !1), this._disposers.push(new Wo(this._axisRanges)), this._disposers.push(this._axisRanges.template); + } + return this._axisRanges; + }, enumerable: !0, configurable: !0 }), R.prototype.processAxisRange = function(u) { + var w = u.newValue; + w.component = this, w.isRange = !0; + }, Object.defineProperty(R.prototype, "axisBreaks", { get: function() { + return this._axisBreaks || (this._axisBreaks = new Vc(this.createAxisBreak(), function(u, w) { + return jc(u.adjustedStartValue, w.adjustedStartValue); + }), this._axisBreaks.events.on("inserted", this.processBreak, this, !1), this._disposers.push(new Wo(this._axisBreaks)), this._disposers.push(this._axisBreaks.template)), this._axisBreaks; + }, enumerable: !0, configurable: !0 }), R.prototype.createAxisBreak = function() { + return new PL(); + }, Object.defineProperty(R.prototype, "series", { get: function() { + return this._series || (this._series = new Hs()), this._series; + }, enumerable: !0, configurable: !0 }), R.prototype.processSeriesDataItems = function() { + }, R.prototype.processSeriesDataItem = function(u, w) { + }, R.prototype.postProcessSeriesDataItems = function(u) { + }, R.prototype.postProcessSeriesDataItem = function(u) { + }, R.prototype.updateAxisBySeries = function() { + }, R.prototype.hideUnusedDataItems = function() { + var u = this, w = this._dataItemsIterator; + w.createNewItems = !1, er(w.iterator(), function($) { + u.validateDataElement($), $.__disabled = !0; + }), w.clear(), w.createNewItems = !0; + }, R.prototype.getSeriesDataItem = function(u, w, $) { + }, R.prototype.getAngle = function(u, w, $, G, K) { + }, R.prototype.getX = function(u, w, $, G, K) { + }, R.prototype.getPositionX = function(u, w, $, G, K) { + }, R.prototype.getY = function(u, w, $, G, K) { + }, R.prototype.getPositionY = function(u, w, $, G, K) { + }, Object.defineProperty(R.prototype, "basePoint", { get: function() { + return { x: 0, y: 0 }; + }, enumerable: !0, configurable: !0 }), R.prototype.dataChangeUpdate = function() { + }, R.prototype.seriesDataChangeUpdate = function(u) { + }, R.prototype.adjustDifference = function(u, w) { + var $ = w - u; + if (le($)) + return this._axisBreaks && Zr(this._axisBreaks.iterator(), function(G) { + var K = G.adjustedStartValue, ne = G.adjustedEndValue; + if (le(K) && le(ne)) { + if (K > w) + return !1; + if (ne >= u && le(K) && le(ne)) { + var ue = G.breakSize, we = _({ start: K, end: ne }, { start: u, end: w }); + we && ($ -= (we.end - we.start) * (1 - ue)); + } + return !0; + } + }), $; + }, R.prototype.isInBreak = function(u) { + if (this._axisBreaks) + return Mc(this._axisBreaks.iterator(), function(w) { + return u >= w.adjustedStartValue && u <= w.adjustedEndValue; + }); + }, R.prototype.fixAxisBreaks = function() { + var u = this; + if (this._axisBreaks) { + var w = this._axisBreaks; + if (w.length > 0) { + _i(fr(w.iterator()), function(K) { + var ne = H(K.startValue, K.endValue), ue = ve(K.startValue, K.endValue); + K.adjustedStartValue = ne, K.adjustedEndValue = ue, u._axisBreaks.update(K); + }); + var $ = w.first, G = Math.min($.startValue, $.endValue); + er(w.iterator(), function(K) { + var ne = K.adjustedStartValue, ue = K.adjustedEndValue; + ne < G && (ne = G, ue < G && (ue = G)), K.adjustedStartValue = ne, K.adjustedEndValue = ue; + }); + } + } + }, Object.defineProperty(R.prototype, "startIndex", { get: function() { + return 0; + }, set: function(u) { + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endIndex", { get: function() { + return this.dataItems.length; + }, set: function(u) { + }, enumerable: !0, configurable: !0 }), R.prototype.getPositionLabel = function(u) { + return Math.round(100 * u) + "%x"; + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart; + }, set: function(u) { + this._chart = u; + }, enumerable: !0, configurable: !0 }), R.prototype.createSeriesRange = function(u) { + var w = this.axisRanges.create(); + return w.component = this, w.axisFill = this.renderer.axisFills.template.clone(), w.axisFill.disabled = !1, w.axisFill.fillOpacity = 0, w.grid = this.renderer.grid.template.clone(), w.grid.disabled = !0, w.tick = this.renderer.ticks.template.clone(), w.tick.disabled = !0, w.label = this.renderer.labels.template.clone(), w.label.disabled = !0, w.addDisposer(new ln(function() { + u.axisRanges.removeValue(w); + })), u.axisRanges.push(w), w; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.renderer ? this.renderer.copyFrom(u.renderer) : u.renderer && (this.renderer = u.renderer.clone(), this._disposers.push(this.renderer)), u.title && (this.title ? this.title.copyFrom(u.title) : (this.title = u.title.clone(), this.title.parent = this), this._disposers.push(this.title)); + }, R.prototype.resetIterators = function() { + this._dataItemsIterator.reset(); + }, R.prototype.processConfig = function(u) { + if (u && Ee(u.axisRanges) && gt(u.axisRanges)) + for (var w = 0, $ = u.axisRanges.length; w < $; w++) { + var G = u.axisRanges[w]; + Ee(G.series) && st(G.series) && this.map.hasKey(G.series) && (u.axisRanges[w] = this.createSeriesRange(this.map.getKey(G.series)), delete G.series, u.axisRanges[w].config = G); + } + U.prototype.processConfig.call(this, u); + }, R.prototype.configOrder = function(u, w) { + return u == w ? 0 : u == "title" ? 1 : w == "title" || u == "component" ? -1 : w == "component" ? 1 : U.prototype.configOrder.call(this, u, w); + }, Object.defineProperty(R.prototype, "startLocation", { get: function() { + return this.getPropertyValue("startLocation"); + }, set: function(u) { + this.setPropertyValue("startLocation", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endLocation", { get: function() { + return this.getPropertyValue("endLocation"); + }, set: function(u) { + this.setPropertyValue("endLocation", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.renderer && (this.renderer.gridContainer.disabled = u), w; + }, Object.defineProperty(R.prototype, "title", { get: function() { + return this._title; + }, set: function(u) { + this._title && this._title != u && this._title.dispose(), u && (this._title = u, u.parent = this, u.shouldClone = !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hideTooltipWhileZooming", { get: function() { + return this.getPropertyValue("hideTooltipWhileZooming"); + }, set: function(u) { + this.setPropertyValue("hideTooltipWhileZooming", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "zoomable", { get: function() { + return this.getPropertyValue("zoomable"); + }, set: function(u) { + this.setPropertyValue("zoomable", u); + }, enumerable: !0, configurable: !0 }), R; + }(LC); + hi.registeredClasses.Axis = OL, hi.registeredClasses.AxisDataItem = a2, Wd.push({ relevant: gf.maybeXS, state: function(U, R) { + if (U instanceof OL && U.tooltip) { + var u = U.states.create(R); + return u.properties.cursorTooltipEnabled = !1, u; + } + return null; + } }); + var PH = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "AxisLine", u.element = u.paper.add("path"); + var w = new Fa(); + return u.stroke = w.getFor("grid"), u.strokeOpacity = 0.15, u.pixelPerfect = !0, u.fill = We(), u.applyTheme(), u.interactionsEnabled = !1, u; + } + return re(R, U), R; + }(so); + hi.registeredClasses.AxisLine = PH; + var Q8 = function(U) { + function R(u) { + var w = U.call(this) || this; + w.axis = u, w.element = w.paper.add("path"), w.className = "AxisFill", w.isMeasured = !1, w.location = 0, w.above = !1; + var $ = new Fa(); + return w.fill = $.getFor("alternativeBackground"), w.fillOpacity = 0, w.applyTheme(), w; + } + return re(R, U), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.axis && this.axis.invalidateDataItems(), w; + }, R.prototype.draw = function() { + U.prototype.draw.call(this), this.__disabled || this.disabled || this.axis && le(this.startPosition) && le(this.endPosition) && (this.fillPath = this.axis.getPositionRangePath(this.startPosition, this.endPosition), this.path = this.fillPath, this.isMeasured && this.measure()); + }, Object.defineProperty(R.prototype, "startPosition", { get: function() { + return this.getPropertyValue("startPosition"); + }, set: function(u) { + this.setPropertyValue("startPosition", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endPosition", { get: function() { + return this.getPropertyValue("endPosition"); + }, set: function(u) { + this.setPropertyValue("endPosition", u), this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "location", { get: function() { + return this.getPropertyValue("location"); + }, set: function(u) { + this.setPropertyValue("location", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setPath = function(u) { + return !!this.setPropertyValue("path", u) && (this.element.attr({ d: u }), !0); + }, Object.defineProperty(R.prototype, "above", { get: function() { + return this.getPropertyValue("above"); + }, set: function(u) { + this.setPropertyValue("above", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.AxisFill = Q8; + var iR = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Grid", u.element = u.paper.add("path"), u.location = 0.5, u.isMeasured = !1, u.above = !1; + var w = new Fa(); + return u.stroke = w.getFor("grid"), u.pixelPerfect = !0, u.strokeOpacity = 0.15, u.fill = We(), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "location", { get: function() { + return this.getPropertyValue("location"); + }, set: function(u) { + this.setPropertyValue("location", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "above", { get: function() { + return this.getPropertyValue("above"); + }, set: function(u) { + this.setPropertyValue("above", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.axis && this.axis.invalidateDataItems(), w; + }, R; + }(so); + hi.registeredClasses.Grid = iR, Wd.push({ relevant: gf.maybeXS, state: function(U, R) { + if (U instanceof iR) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var e9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisLabel", u.isMeasured = !1, u.padding(10, 10, 10, 10), u.location = 0.5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "location", { get: function() { + return this.getPropertyValue("location"); + }, set: function(u) { + this.setPropertyValue("location", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inside", { get: function() { + return this.getPropertyValue("inside"); + }, set: function(u) { + this.setPropertyValue("inside", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.axis && this.axis.invalidateDataItems(), w; + }, R; + }(Rm); + hi.registeredClasses.AxisLabel = e9; + var rR = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "Tick"; + var w = new Fa(); + return u.fillOpacity = 0, u.length = 6, u.strokeOpacity = 0.2, u.stroke = w.getFor("grid"), u.isMeasured = !1, u.nonScalingStroke = !0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "length", { get: function() { + return this.disabled ? 0 : this.getPropertyValue("length"); + }, set: function(u) { + this.setPropertyValue("length", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(so); + hi.registeredClasses.Tick = rR; + var t9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisTick", u.element = u.paper.add("path"), u.location = 0.5, u.above = !1, u.isMeasured = !1, u.pixelPerfect = !0, u.strokeOpacity = 0, u.length = 5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "location", { get: function() { + return this.getPropertyValue("location"); + }, set: function(u) { + this.setPropertyValue("location", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inside", { get: function() { + return this.getPropertyValue("inside"); + }, set: function(u) { + this.setPropertyValue("inside", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "above", { get: function() { + return this.getPropertyValue("above"); + }, set: function(u) { + this.setPropertyValue("above", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.axis && this.axis.invalidateDataItems(), w; + }, R; + }(rR); + hi.registeredClasses.AxisTick = t9; + var RL = function(U) { + function R() { + var u = U.call(this) || this; + u._chart = new Un(), u.className = "AxisRenderer", u.minGridDistance = 50, u.inside = !1, u.inversed = !1, u.tooltipLocation = 0.5, u.fullWidthTooltip = !1, u.cellStartLocation = 0, u.cellEndLocation = 1, u.minLabelPosition = 0, u.maxLabelPosition = 1, u.shouldClone = !1; + var w = u.createChild(Qn); + w.shouldClone = !1, w.layout = "none", w.virtualParent = u, w.width = ce(100), w.height = ce(100), u.gridContainer = w, w.events.on("maxsizechanged", function() { + u.inited && u.invalidateAxisItems(); + }, u, !1); + var $ = u.createChild(Qn); + $.shouldClone = !1, $.isMeasured = !1, $.layout = "none", $.width = ce(100), $.height = ce(100), u.breakContainer = $; + var G = u.createChild(Qn); + G.shouldClone = !1, G.isMeasured = !1, G.layout = "none", G.width = ce(100), G.height = ce(100), u.bulletsContainer = G, u.line = u.createChild(PH), u.line.shouldClone = !1, u.line.strokeOpacity = 0; + var K = u.createChild(iR); + K.shouldClone = !1, u.baseGrid = K; + var ne = u._disposers; + return ne.push(K), ne.push(u.line), ne.push(w), ne.push($), ne.push(G), ne.push(u._chart), u.ticks.template.disabled = !0, u.axisFills.template.disabled = !0, u.axisFills.template.interactionsEnabled = !1, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "axis", { get: function() { + return this._axis; + }, set: function(u) { + this.setAxis(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setAxis = function(u) { + this._axis = u, this.baseGrid.parent = u, this.line.parent = u, this.gridContainer.bind("opacity", u); + }, R.prototype.processRenderer = function() { + this.events.on("sizechanged", this.updateTooltip, this, !1), this.events.on("positionchanged", this.updateTooltip, this, !1), this.labels.template.inside = this.inside, this.ticks.template.inside = this.inside; + }, R.prototype.updateTooltip = function() { + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + return 0; + }, enumerable: !0, configurable: !0 }), R.prototype.positionItem = function(u, w) { + u && u.moveTo(w); + }, R.prototype.positionToPoint = function(u, w) { + return { x: 0, y: 0 }; + }, R.prototype.positionToAngle = function(u) { + return 0; + }, R.prototype.positionToCoordinate = function(u) { + var w = this.axis, $ = w.axisFullLength; + return w.renderer.inversed ? (w.end - u) * $ : (u - w.start) * $; + }, R.prototype.updateGridContainer = function() { + }, R.prototype.getHeight = function() { + var u = this.gridContainer; + return u.parent ? u.parent.pixelHeight : this.gridContainer.pixelHeight || 0; + }, R.prototype.getWidth = function() { + var u = this.gridContainer; + return u.parent ? u.parent.pixelWidth : this.gridContainer.pixelWidth || 0; + }, R.prototype.coordinateToPosition = function(u, w) { + var $ = this.axis, G = $.axisFullLength; + return He($.renderer.inversed ? $.end - u / G : u / G + $.start, 5); + }, R.prototype.pointToPosition = function(u) { + return 0; + }, R.prototype.getPositionRangePath = function(u, w) { + return ""; + }, R.prototype.invalidateAxisItems = function() { + var u = this.axis; + u && u.invalidateDataItems(); + }, R.prototype.updateGridElement = function(u, w, $) { + }, R.prototype.updateTickElement = function(u, w, $) { + }, R.prototype.updateBullet = function(u, w, $) { + }, R.prototype.updateLabelElement = function(u, w, $, G) { + }, R.prototype.updateFillElement = function(u, w, $) { + u.startPosition = w, u.endPosition = $; + }, R.prototype.updateAxisLine = function() { + }, R.prototype.updateBaseGridElement = function() { + }, R.prototype.updateBreakElement = function(u) { + this.positionItem(u.startLine, u.startPoint), this.toggleVisibility(u.startLine, u.startPosition, 0, 1), this.positionItem(u.endLine, u.endPoint), this.toggleVisibility(u.endLine, u.endPosition, 0, 1); + }, Object.defineProperty(R.prototype, "minGridDistance", { get: function() { + return this.getPropertyValue("minGridDistance"); + }, set: function(u) { + this.setPropertyValue("minGridDistance", u) && this.axis && this.axis.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart.get(); + }, set: function(u) { + this._chart.set(u, null); + }, enumerable: !0, configurable: !0 }), R.prototype.toggleVisibility = function(u, w, $, G) { + var K = this.axis, ne = u.dataItem; + ne && ne instanceof a2 && (le(ne.minPosition) && ($ = ne.minPosition), le(ne.maxPosition) && (G = ne.maxPosition)); + var ue = K.start + (K.end - K.start) * ($ - 1e-4), we = K.start + (K.end - K.start) * (G + 1e-4); + u.disabled || (u.__disabled = w < ue || w > we); + }, R.prototype.createBreakSprites = function(u) { + }, Object.defineProperty(R.prototype, "axisFills", { get: function() { + if (!this._axisFills) { + var u = this.createFill(this.axis); + this._axisFills = new Xs(u), u.applyOnClones = !0, u.events.on("enabled", this.invalidateAxisItems, this, !1), this._disposers.push(new Wo(this._axisFills)), this._disposers.push(this._axisFills.template); + } + return this._axisFills; + }, enumerable: !0, configurable: !0 }), R.prototype.createFill = function(u) { + return new Q8(u); + }, Object.defineProperty(R.prototype, "grid", { get: function() { + if (!this._grid) { + var u = this.createGrid(); + this._grid = new Xs(u), u.applyOnClones = !0, u.events.on("enabled", this.invalidateAxisItems, this, !1), this._disposers.push(new Wo(this._grid)), this._disposers.push(this._grid.template); + } + return this._grid; + }, enumerable: !0, configurable: !0 }), R.prototype.createGrid = function() { + return new iR(); + }, Object.defineProperty(R.prototype, "ticks", { get: function() { + if (!this._ticks) { + var u = this.createTick(); + u.applyOnClones = !0, u.isMeasured = !1, u.events.on("enabled", this.invalidateAxisItems, this, !1), this._ticks = new Xs(u), this._disposers.push(new Wo(this._ticks)), this._disposers.push(this._ticks.template); + } + return this._ticks; + }, enumerable: !0, configurable: !0 }), R.prototype.createTick = function() { + return new t9(); + }, Object.defineProperty(R.prototype, "labels", { get: function() { + if (!this._labels) { + var u = this.createLabel(); + this._labels = new Xs(u), u.applyOnClones = !0, u.events.on("enabled", this.invalidateAxisItems, this, !1), this._disposers.push(new Wo(this._labels)), this._disposers.push(this._labels.template); + } + return this._labels; + }, enumerable: !0, configurable: !0 }), R.prototype.createLabel = function() { + return new e9(); + }, Object.defineProperty(R.prototype, "inside", { get: function() { + return this.getPropertyValue("inside"); + }, set: function(u) { + this.setPropertyValue("inside", u) && this.axis && this.axis.invalidate(), u ? (this.width = 0, this.height = 0) : (this.width = void 0, this.height = void 0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "opposite", { get: function() { + return this.getPropertyValue("opposite"); + }, set: function(u) { + this.setPropertyValue("opposite", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fullWidthTooltip", { get: function() { + return this.getPropertyValue("fullWidthTooltip"); + }, set: function(u) { + this.setPropertyValue("fullWidthTooltip", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipLocation", { get: function() { + return this.getPropertyValue("tooltipLocation"); + }, set: function(u) { + this.setPropertyValue("tooltipLocation", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipLocation2", { get: function() { + return this.getPropertyValue("tooltipLocation2"); + }, set: function(u) { + this.setPropertyValue("tooltipLocation2", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cellStartLocation", { get: function() { + return this.getPropertyValue("cellStartLocation"); + }, set: function(u) { + this.setPropertyValue("cellStartLocation", u) && this.axis && this.axis.invalidateSeries(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cellEndLocation", { get: function() { + return this.getPropertyValue("cellEndLocation"); + }, set: function(u) { + this.setPropertyValue("cellEndLocation", u) && this.axis && this.axis.invalidateSeries(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "inversed", { get: function() { + return this.getPropertyValue("inversed"); + }, set: function(u) { + this.setPropertyValue("inversed", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minLabelPosition", { get: function() { + return this.getPropertyValue("minLabelPosition"); + }, set: function(u) { + this.setPropertyValue("minLabelPosition", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxLabelPosition", { get: function() { + return this.getPropertyValue("maxLabelPosition"); + }, set: function(u) { + this.setPropertyValue("maxLabelPosition", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.grid.template.copyFrom(u.grid.template), this.ticks.template.copyFrom(u.ticks.template), this.labels.template.copyFrom(u.labels.template), this.axisFills.template.copyFrom(u.axisFills.template), this.line.copyFrom(u.line), this.baseGrid.copyFrom(u.baseGrid); + }, R.prototype.toAxisPosition = function(u) { + return u; + }, R.prototype.setVisibility = function(u) { + U.prototype.setVisibility.call(this, u), this.bulletsContainer.visible = u; + }, R; + }(Qn); + hi.registeredClasses.AxisRenderer = RL; + var nR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisBullet", u.location = 0.5, u.isMeasured = !1, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "location", { get: function() { + return this.getPropertyValue("location"); + }, set: function(u) { + this.setPropertyValue("location", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setDisabled = function(u) { + var w = U.prototype.setDisabled.call(this, u); + return this.axis && this.axis.invalidateDataItems(), w; + }, R; + }(Qn); + hi.registeredClasses.AxisBullet = nR; + var Zv = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisRendererY", u.minGridDistance = 40, u.opposite = !1, u.height = ce(100), u.labels.template.verticalCenter = "middle", u.applyTheme(), u; + } + return re(R, U), R.prototype.setAxis = function(u) { + U.prototype.setAxis.call(this, u), u.layout = "horizontal"; + }, R.prototype.updateGridContainer = function() { + var u = this.axis; + if (u) { + var w = this.gridContainer; + w.y = u.pixelY, w.height = u.axisLength; + } + }, R.prototype.toAxisPosition = function(u) { + var w = this.axis; + if (w) { + var $ = 1 - u, G = w.relativePositionSprite, K = w.pixelY; + if (G ? K = up({ x: 0, y: this.pixelY }, this.parent, G).y : G = w.parent, G) + return 1 - ($ - K / G.innerHeight) / (w.axisLength / G.innerHeight); + } + return u; + }, R.prototype.processRenderer = function() { + U.prototype.processRenderer.call(this); + var u = this.axis; + if (u) { + var w = u.title; + w.valign = "middle", u.height instanceof J || (u.height = ce(100)), this.opposite ? (w.rotation = 90, this.line.toBack(), w.toFront()) : (w.rotation = -90, w.toBack(), this.line.toFront()); + } + }, R.prototype.updateTooltip = function() { + if (this.axis) { + var u = 2e3, w = 0, $ = u, G = this.axisLength; + this.opposite ? this.inside && (w = -2e3, $ = u) : this.inside || (w = -2e3, $ = u), this.axis.updateTooltip("horizontal", { x: w, y: 0, width: $, height: G }); + } + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + var u = this.axis; + return u.measuredHeight - u.pixelPaddingTop - u.pixelPaddingBottom || 0; + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u, w) { + return { x: 0, y: this.positionToCoordinate(u) }; + }, R.prototype.pointToPosition = function(u) { + return this.coordinateToPosition(u.y, u.x); + }, R.prototype.coordinateToPosition = function(u, w) { + var $ = this.axis, G = $.axisFullLength; + return He($.renderer.inversed ? 1 - $.start - u / G : u / G + (1 - $.end), 5); + }, R.prototype.getPositionRangePath = function(u, w) { + var $ = mt(this.positionToCoordinate(u), 0, this.axisLength), G = mt(this.positionToCoordinate(w), 0, this.axisLength), K = Math.abs(G - $), ne = this.getWidth(); + return n2({ x: 0, y: Math.min($, G), width: ne, height: K }, !0); + }, R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + u.path = pn({ x: 0, y: 0 }) + xr({ x: this.getWidth(), y: 0 }), this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateTickElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w), K = u.length; + try { + this.axis.title.measuredWidth; + } catch { + } + G.x = up({ x: this.line.pixelX, y: 0 }, this.line.parent, this.gridContainer).x, this.opposite ? K *= u.inside ? -1 : 1 : K *= u.inside ? 1 : -1, u.path = pn({ x: 0, y: 0 }) + xr({ x: K, y: 0 }), this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateAxisLine = function() { + this.line.path = pn({ x: 0, y: 0 }) + xr({ x: 0, y: this.axisLength }); + }, R.prototype.updateBaseGridElement = function() { + U.prototype.updateBaseGridElement.call(this); + var u = this.axis, w = this.getWidth(), $ = this.axisLength, G = u.basePoint.y, K = this.baseGrid; + if (G < -0.2 || G > $ + 0.2) + K.hide(0); + else { + var ne = up({ x: 0, y: 0 }, this.gridContainer, K.parent).x; + K.path = pn({ x: 0, y: 0 }) + xr({ x: w, y: 0 }), K.moveTo({ x: ne, y: G }), K.show(0); + } + }, R.prototype.updateLabelElement = function(u, w, $, G) { + Ee(G) || (G = u.location), w += ($ - w) * G, u.isMeasured = !u.inside; + var K, ne = this.positionToPoint(w), ue = 0, we = this.gridContainer.maxWidth; + this.opposite ? (u.inside ? (K = "right", u.align == "left" && (ue = -we, K = "left"), u.align == "center" && (ue = -we / 2, K = "middle")) : K = "left", ne.x = 0 + ue) : (u.inside ? (K = "left", u.align == "right" && (ue = we, K = "right"), u.align == "center" && (ue = we / 2, K = "middle")) : K = "right", ne.x = this.measuredWidth + ue), u.rotation == 0 && (u.horizontalCenter = K), this.positionItem(u, ne), this.toggleVisibility(u, w, this.minLabelPosition, this.maxLabelPosition); + }, R.prototype.updateBreakElement = function(u) { + U.prototype.updateBreakElement.call(this, u); + var w = u.startLine, $ = u.endLine, G = u.fillShape, K = u.startPoint, ne = u.endPoint, ue = u.pixelMarginLeft, we = this.getWidth() - u.pixelMarginLeft - u.pixelMarginRight; + K.y = mt(K.y, -1, this.axisLength + 1), ne.y = mt(ne.y, -1, this.axisLength + 1), K.y == ne.y && (K.y < 0 || K.y > this.axisLength) ? u.fillShape.__disabled = !0 : u.fillShape.__disabled = !1; + var De = Math.abs(we - ue); + w.x = ue, w.height = 0, w.width = De, $.x = ue, $.height = 0, $.width = De, G.width = De, G.height = Math.abs(ne.y - K.y), G.x = ue, G.y = ne.y; + }, R.prototype.createBreakSprites = function(u) { + u.startLine = new Ar(), u.endLine = new Ar(); + var w = new xL(); + w.setWavedSides(!0, !1, !0, !1), u.fillShape = w; + }, R.prototype.positionToCoordinate = function(u) { + var w = this.axis, $ = w.axisFullLength; + return w.renderer.inversed ? (u - w.start) * $ : (w.end - u) * $; + }, R.prototype.updateBullet = function(u, w, $) { + var G = 0.5; + u instanceof nR && (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w); + K.x = up({ x: this.line.pixelX, y: 0 }, this.line.parent, this.gridContainer).x, this.positionItem(u, K), this.toggleVisibility(u, w, 0, 1); + }, R; + }(RL); + hi.registeredClasses.AxisRendererY = Zv, Wd.push({ relevant: gf.widthS, state: function(U, R) { + if (U instanceof Zv) { + var u = U.states.create(R); + return u.properties.inside = !0, u.properties.maxLabelPosition = 0.9, u.properties.minLabelPosition = 0.1, u; + } + return null; + } }), Wd.push({ relevant: gf.widthXS, state: function(U, R) { + if (U instanceof Zv) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var i9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ValueAxisBreak", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "startPosition", { get: function() { + if (this.axis) + return this.axis.valueToPosition(this.adjustedStartValue); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endPosition", { get: function() { + if (this.axis) + return this.axis.valueToPosition(this.adjustedEndValue); + }, enumerable: !0, configurable: !0 }), R; + }(PL); + hi.registeredClasses.ValueAxisBreak = i9; + var ML = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ValueAxisDataItem", u.values.value = {}, u.values.endValue = {}, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "value", { get: function() { + return this.values.value.value; + }, set: function(u) { + this.setValue("value", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endValue", { get: function() { + return this.values.endValue.value; + }, set: function(u) { + this.setValue("endValue", u); + }, enumerable: !0, configurable: !0 }), R; + }(a2), vo = function(U) { + function R() { + var u = U.call(this) || this; + return u._stepDecimalPlaces = 0, u._prevStepDecimalPlaces = 0, u._adjustLabelPrecision = !0, u._baseValue = 0, u._adjustedStart = 0, u._adjustedEnd = 1, u._extremesChanged = !1, u._deltaMinMax = 1, u._dsc = !1, u.calculateTotals = !1, u.className = "ValueAxis", u.axisFieldName = "value", u.setPropertyValue("maxZoomFactor", 1e3), u.setPropertyValue("extraMin", 0), u.setPropertyValue("extraMax", 0), u.setPropertyValue("strictMinMax", !1), u.setPropertyValue("maxPrecision", Number.MAX_VALUE), u.setPropertyValue("adjustLabelPrecision", !0), u.setPropertyValue("extraTooltipPrecision", 0), u.keepSelection = !1, u.includeRangesInMinMax = !1, u.applyTheme(), u; + } + return re(R, U), R.prototype.fillRule = function(u) { + var w = u.value, $ = u.component; + u.axisFill.disabled || (He(w / $.step / 2, 5) == Math.round(w / $.step / 2) ? u.axisFill.__disabled = !0 : u.axisFill.__disabled = !1); + }, R.prototype.createDataItem = function() { + return new ML(); + }, R.prototype.createAxisBreak = function() { + return new i9(); + }, R.prototype.dataChangeUpdate = function() { + this.clearCache(), this.keepSelection ? (this._start != 0 && this.dispatchImmediately("startchanged"), this._end != 1 && this.dispatchImmediately("endchanged"), this._start == 0 && this._end == 1 || this.dispatchImmediately("startendchanged")) : this._start == 0 && this._end == 1 || (this._start = 0, this._end = 1, this.dispatchImmediately("startendchanged")), this._maxZoomed = this._maxDefined, this._minZoomed = this._minDefined, this._maxAdjusted = this._maxDefined, this._minAdjusted = this._minDefined; + }, R.prototype.processSeriesDataItems = function() { + if (this.calculateTotals) { + var u = this.series.getIndex(0), w = u.startIndex; + if (u.dataItems.length > 0) { + w > 0 && w--; + var $ = u.endIndex; + $ < u.dataItems.length && $++; + for (var G = function(ue) { + var we = {}, De = {}; + K.series.each(function($e) { + if (!$e.excludeFromTotal) { + var Ke = $e.dataItems.getIndex(ue); + Ke && mi(Ke.values, function(Ze) { + var pt = Ke.values[Ze].workingValue; + le(pt) && (le(we[Ze]) ? we[Ze] += Math.abs(pt) : we[Ze] = Math.abs(pt), le(De[Ze]) ? De[Ze] += pt : De[Ze] = pt); + }); + } + }), K.series.each(function($e) { + if (!$e.excludeFromTotal) { + var Ke = $e.dataItems.getIndex(ue); + Ke && mi(Ke.values, function(Ze) { + var pt = Ke.values[Ze].workingValue; + le(pt) && (Ke.setCalculatedValue(Ze, we[Ze], "total"), Ke.setCalculatedValue(Ze, 100 * pt / we[Ze], "totalPercent"), Ke.setCalculatedValue(Ze, De[Ze], "sum")); + }); + } + }); + }, K = this, ne = w; ne < $; ++ne) + G(ne); + } + } + }, R.prototype.validate = function() { + this.axisLength <= 0 || (U.prototype.validate.call(this), this.getMinMax(), le(this._minAdjusted) || this.dataItems.each(function(u) { + u.value = null; + }), this.fixAxisBreaks(), this.calculateZoom(), this.validateAxisElements(), this.validateAxisRanges(), this.validateBreaks(), this.hideUnusedDataItems(), this.renderer.invalidateLayout()); + }, R.prototype.calculateZoom = function() { + if (le(this.min) && le(this.max)) { + var u = this.positionToValue(this.start), w = this.positionToValue(this.end), $ = this.adjustDifference(u, w), G = this.adjustMinMax(u, w, $, this._gridCount, !0), K = nL(G.step); + this._stepDecimalPlaces = K, u = He(u, K), w = He(w, K); + var ne = (G = this.adjustMinMax(u, w, $, this._gridCount, !0)).step; + if (this.syncWithAxis) { + var ue = this.getCache(u + "-" + w); + le(ue) && (ne = ue); + } else + u = G.min, w = G.max; + (this._minZoomed != u || this._maxZoomed != w || this._step != ne || this._dsc) && (this._dsc = !1, this._minZoomed = u, this._maxZoomed = w, this._step = ne, this.dispatchImmediately("selectionextremeschanged")); + } + }, R.prototype.fixSmallStep = function(u) { + return 1 + u == 1 ? (u *= 2, this.fixSmallStep(u)) : u; + }, R.prototype.validateAxisElements = function() { + var u = this; + if (le(this.max) && le(this.min)) { + var w = this.minZoomed - 2 * this._step; + this.logarithmic ? Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E > 1 ? w = Math.pow(10, Math.log(this.min) * Math.LOG10E) : (w = Math.floor(this.minZoomed / this._step) * this._step) == 0 && (w = this.minZoomed) : w = Math.floor(w / this._step) * this._step; + var $ = this._maxZoomed + this._step; + this.resetIterators(); + var G = this._dataItemsIterator; + if (this._step == 0) + return; + this._step = this.fixSmallStep(this._step); + var K = 0, ne = this._prevStepDecimalPlaces != this._stepDecimalPlaces; + for (this._prevStepDecimalPlaces = this._stepDecimalPlaces; w <= $; ) { + if (!this.isInBreak(w)) { + var ue = G.find(function(pt) { + return pt.value === w; + }); + ue.__disabled && (ue.__disabled = !1), this.appendDataItem(ue), ue.axisBreak = void 0, (ue.value != w || ne) && (ue.value = w, ue.text = this.formatLabel(w), ue.label && ue.label.invalid && ue.label.validate(), ue.value >= this.min && ue.value <= this.max && ue.label && (this.axisLetter == "Y" && ue.label.measuredWidth > this.ghostLabel.measuredWidth || this.axisLetter == "X" && ue.label.measuredHeight > this.ghostLabel.measuredHeight) && (this.ghostLabel.text = ue.label.currentText, this.ghostLabel.validate())), this.validateDataElement(ue); + } + K++; + var we = w; + this.logarithmic && Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E > 1 ? w = Math.pow(10, Math.log(this.min) * Math.LOG10E + K) : w += this._step; + var De = Math.pow(10, Math.floor(Math.log(Math.abs(this._step)) * Math.LOG10E)); + if (De < 1) { + var $e = Math.round(Math.abs(Math.log(Math.abs(De)) * Math.LOG10E)) + 2; + if ($e = Math.min(13, $e), we == (w = He(w, $e))) { + w = $; + break; + } + } + } + var Ke = this._axisBreaks; + if (Ke) { + var Ze = this.renderer; + er(Ke.iterator(), function(pt) { + if (pt.breakSize > 0 && C(pt.startPoint, pt.endPoint) > Ze.minGridDistance) + for (var Vt = pt.adjustedMin; Vt <= pt.adjustedMax; ) { + if (Vt >= pt.adjustedStartValue && Vt <= pt.adjustedEndValue) { + var Yt = G.find(function(ci) { + return ci.value === Vt; + }); + Yt.__disabled && (Yt.__disabled = !1), u.appendDataItem(Yt), Yt.axisBreak = pt, Yt.value != Vt && (Yt.value = Vt, Yt.text = u.formatLabel(Vt), Yt.label && Yt.label.invalid && Yt.label.validate()), u.validateDataElement(Yt); + } + Vt += pt.adjustedStep; + } + }); + } + } + }, R.prototype.validateDataElement = function(u) { + U.prototype.validateDataElement.call(this, u), u.itemIndex = this._axisItemCount, this._axisItemCount++; + var w = this.renderer, $ = u.value, G = u.endValue, K = this.valueToPosition($); + u.position = K; + var ne = K, ue = this.valueToPosition($ + this._step); + le(G) && (ue = ne = this.valueToPosition(G)), u.point = w.positionToPoint(K); + var we = u.tick; + we && !we.disabled && w.updateTickElement(we, K, ne); + var De = u.grid; + De && !De.disabled && w.updateGridElement(De, K, ne); + var $e = u.label; + $e && !$e.disabled && w.updateLabelElement($e, K, ne); + var Ke = u.axisFill; + Ke && !Ke.disabled && (w.updateFillElement(Ke, K, ue), u.isRange || this.fillRule(u)), u.bullet && w.updateBullet(u.bullet, K, ne); + var Ze = u.mask; + Ze && w.updateFillElement(Ze, K, ue); + }, R.prototype.formatLabel = function(u) { + return this.adjustLabelPrecision && u != 0 ? this.numberFormatter.format(u, void 0, this._stepDecimalPlaces) : this.numberFormatter.format(u); + }, Object.defineProperty(R.prototype, "basePoint", { get: function() { + var u = this.baseValue, w = this.valueToPosition(u); + return this.renderer.positionToPoint(w); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "baseValue", { get: function() { + var u = this._baseValue; + return this.logarithmic && (u = this.min), this._adapterO ? this._adapterO.apply("baseValue", u) : u; + }, set: function(u) { + this._baseValue = u, this.invalidateLayout(), this.invalidateSeries(); + }, enumerable: !0, configurable: !0 }), R.prototype.anyToPosition = function(u) { + return this.valueToPosition(u); + }, R.prototype.valueToPoint = function(u) { + var w = this.valueToPosition(u), $ = this.renderer.positionToPoint(w), G = this.renderer.positionToAngle(w); + return { x: $.x, y: $.y, angle: G }; + }, R.prototype.anyToPoint = function(u) { + return this.valueToPoint(u); + }, R.prototype.valueToPosition = function(u) { + if (le(u)) { + var w = this.min, $ = this.max; + if (le(w) && le($)) { + var G = this._difference, K = this._axisBreaks; + K && K.length > 0 && Zr(K.iterator(), function(we) { + var De = we.adjustedStartValue, $e = we.adjustedEndValue; + if (le(De) && le($e)) { + if (u < De) + return !1; + if (b({ start: De, end: $e }, { start: w, end: $ })) { + De = Math.max(De, w), $e = Math.min($e, $); + var Ke = we.breakSize; + u > $e ? w += ($e - De) * (1 - Ke) : u < De || (u = De + (u - De) * Ke); + } + } + return !0; + }); + var ne = void 0; + if (this.logarithmic) { + var ue = this.treatZeroAs; + le(ue) && u <= ue && (u = ue), ne = (Math.log(u) * Math.LOG10E - Math.log(this.min) * Math.LOG10E) / (Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E); + } else + ne = (u - w) / G; + return ne; + } + } + return 0; + }, R.prototype.invalidateLabels = function() { + U.prototype.invalidateLabels.call(this), this.dataItems && (this.dataItems.each(function(u) { + u.value = void 0; + }), this.invalidate()); + }, R.prototype.positionToValue = function(u) { + var w = this.min, $ = this.max; + if (le(w) && le($)) { + var G = $ - w, K = null, ne = this._axisBreaks; + return ne && ne.length > 0 && Zr(ne.iterator(), function(ue) { + var we = ue.startPosition, De = ue.endPosition, $e = ue.adjustedStartValue, Ke = ue.adjustedEndValue; + if (le($e) && le(Ke)) { + if ($e > $) + return !1; + if (b({ start: $e, end: Ke }, { start: w, end: $ })) { + $e = ve($e, w), Ke = H(Ke, $); + var Ze = ue.breakSize; + if (G -= (Ke - $e) * (1 - Ze), u > De) + w += (Ke - $e) * (1 - Ze); + else if (!(u < we)) + return K = $e + (u - we) / (De - we) * (Ke - $e), !1; + } + return !0; + } + }), le(K) || (K = this.logarithmic ? Math.pow(Math.E, (u * (Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E) + Math.log(this.min) * Math.LOG10E) / Math.LOG10E) : u * G + w), K; + } + }, R.prototype.xToValue = function(u) { + return this.positionToValue(this.pointToPosition({ x: u, y: 0 })); + }, R.prototype.yToValue = function(u) { + return this.positionToValue(this.pointToPosition({ x: 0, y: u })); + }, R.prototype.pointToPosition = function(u) { + return this.renderer instanceof Zv ? 1 - this.renderer.pointToPosition(u) : this.renderer.pointToPosition(u); + }, R.prototype.animateMinMax = function(u, w) { + return this.animate([{ property: "_minAdjusted", from: this._minAdjusted, to: u }, { property: "_maxAdjusted", from: this._maxAdjusted, to: w }], this.rangeChangeDuration, this.rangeChangeEasing); + }, R.prototype.getMinMax = function() { + var u = this; + this.updateGridCount(); + var w = Number.POSITIVE_INFINITY, $ = Number.NEGATIVE_INFINITY; + if (le(this._minDefined) && le(this._maxDefined) || (this.series.each(function(Ke) { + if (!Ke.ignoreMinMax) { + var Ze = Ke.min(u); + le(Ze) && Ze < w && (w = Ze); + var pt = Ke.max(u); + le(pt) && pt > $ && ($ = pt); + } + }), this.includeRangesInMinMax && this.axisRanges.each(function(Ke) { + if (!Ke.ignoreMinMax) { + var Ze = H(Ke.value, Ke.endValue), pt = ve(Ke.value, Ke.endValue); + (Ze < w || !le(w)) && (w = Ze), (pt > $ || !le($)) && ($ = pt); + } + })), this.logarithmic) { + var G = this.treatZeroAs; + le(G) && w <= 0 && (w = G), w <= 0 && this.raiseCriticalError(new Error("Logarithmic value axis can not have values <= 0."), !0); + } + if (w == 0 && $ == 0 && ($ = 0.9, w = -0.9), le(this._minDefined) && (w = this._minDefined), le(this._maxDefined) && ($ = this._maxDefined), this._adapterO && (w = this._adapterO.apply("min", w)), this._adapterO && ($ = this._adapterO.apply("max", $)), le(w) && le($)) { + this._minReal = w, this._maxReal = $, w == Number.POSITIVE_INFINITY && (w = void 0), $ == Number.NEGATIVE_INFINITY && ($ = void 0); + var K = this.adjustDifference(w, $); + if (w = this.fixMin(w), ($ = this.fixMax($)) - w <= 1 / Math.pow(10, 15)) { + if ($ - w != 0) + this._deltaMinMax = ($ - w) / 2; + else { + var ne = Math.log(Math.abs($)) * Math.LOG10E, ue = Math.pow(10, Math.floor(ne)); + ue /= 10, this._deltaMinMax = ue; + } + w -= this._deltaMinMax, $ += this._deltaMinMax; + } + w -= ($ - w) * this.extraMin, $ += ($ - w) * this.extraMax; + var we = this.strictMinMax; + le(this._maxDefined) && (we = !0); + var De = this.adjustMinMax(w, $, K, this._gridCount, we); + if (w = De.min, K = ($ = De.max) - w, De = this.adjustMinMax(w, $, $ - w, this._gridCount, !0), w = De.min, $ = De.max, this.strictMinMax && (w = le(this._minDefined) ? this._minDefined : this._minReal, ($ = le(this._maxDefined) ? this._maxDefined : this._maxReal) - w <= 1e-8 && (w -= this._deltaMinMax, $ += this._deltaMinMax), w -= ($ - w) * this.extraMin, $ += ($ - w) * this.extraMax), this._adapterO && (w = this._adapterO.apply("min", w)), this._adapterO && ($ = this._adapterO.apply("max", $)), this._step = De.step, le(w) || le($) || (this.start = 0, this.end = 1, this.renderer.labels.each(function(Ke) { + Ke.dataItem.text = ""; + })), (this._minAdjusted != w || this._maxAdjusted != $) && le(w) && le($)) { + var $e = this._minMaxAnimation; + if (this._extremesChanged && le(this._minAdjusted) && le(this._maxAdjusted) && this.inited) { + if ($e && !$e.isFinished() && this._finalMax == $ && this._finalMin == w) + return; + this._finalMin = w, this._finalMax = $, ($e = this.animateMinMax(w, $)) && !$e.isFinished() ? ($e.events.on("animationprogress", this.validateDataItems, this), $e.events.on("animationended", function() { + u.series.each(function(Ke) { + Ke.validate(); + }), u.validateDataItems(), u.handleSelectionExtremesChange(); + }), this._minMaxAnimation = $e) : this.series.each(function(Ke) { + Ke.invalidate(); + }), this.validateDataItems(), this.dispatchImmediately("extremeschanged"), this.handleSelectionExtremesChange(); + } else { + if ($e && !$e.isFinished() && this._finalMax == $ && this._finalMin == w) + return; + this._minAdjusted = w, this._maxAdjusted = $, this._finalMin = w, this._finalMax = $, this.invalidateDataItems(), this.dispatchImmediately("extremeschanged"); + } + } + this._extremesChanged = !1, this._difference = this.adjustDifference(w, $); + } + }, R.prototype.fixMin = function(u) { + return u; + }, R.prototype.fixMax = function(u) { + return u; + }, R.prototype.adjustMinMax = function(u, w, $, G, K) { + G <= 1 && (G = 1), G = Math.round(G); + var ne = u, ue = w; + $ === 0 && ($ = Math.abs(w)); + var we = Math.log(Math.abs($)) * Math.LOG10E, De = Math.pow(10, Math.floor(we)), $e = De /= 10; + K && ($e = 0), this.logarithmic ? (u <= 0 && (u = this.baseValue), u == 1 / 0 && (u = 1), w == -1 / 0 && (w = 10), this.strictMinMax ? (this._minDefined > 0 && (u = this._minDefined), this._maxDefined) : (u = Math.pow(10, Math.floor(Math.log(Math.abs(u)) * Math.LOG10E)), w = Math.pow(10, Math.ceil(Math.log(Math.abs(w)) * Math.LOG10E)))) : (K ? (u = Math.floor(u / De) * De, w = Math.ceil(w / De) * De) : (u = Math.ceil(u / De) * De - $e, w = Math.floor(w / De) * De + $e), u < 0 && ne >= 0 && (u = 0), w > 0 && ue <= 0 && (w = 0)), we = Math.log(Math.abs($)) * Math.LOG10E, De = Math.pow(10, Math.floor(we)), De /= 10; + var Ke = Math.ceil($ / G / De) * De, Ze = Math.pow(10, Math.floor(Math.log(Math.abs(Ke)) * Math.LOG10E)), pt = Math.ceil(Ke / Ze); + pt > 5 ? pt = 10 : pt <= 5 && pt > 2 && (pt = 5), Ke = Math.ceil(Ke / (Ze * pt)) * Ze * pt, this.maxPrecision < Number.MAX_VALUE && Ke != Ft(Ke, this.maxPrecision) && (Ke = Ft(Ke, this.maxPrecision)); + var Vt = 0; + if (Ze < 1 && (Ke = He(Ke, Vt = Math.round(Math.abs(Math.log(Math.abs(Ze)) * Math.LOG10E)) + 1)), !this.logarithmic) { + var Yt = Math.floor(u / Ke); + u = He(Ke * Yt, Vt); + var ci = void 0; + (ci = K ? Math.floor(w / Ke) : Math.ceil(w / Ke)) == Yt && ci++, (w = He(Ke * ci, Vt)) < ue && (w += Ke), u > ne && (u -= Ke); + } + return { min: u, max: w, step: Ke }; + }, Object.defineProperty(R.prototype, "min", { get: function() { + var u = this._minAdjusted; + return le(u) || (u = this._minDefined), u; + }, set: function(u) { + this._minDefined != u && (this._minDefined = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minDefined", { get: function() { + return this._minDefined; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxDefined", { get: function() { + return this._maxDefined; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "extraMin", { get: function() { + return this.getPropertyValue("extraMin"); + }, set: function(u) { + this.setPropertyValue("extraMin", u) && this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "extraMax", { get: function() { + return this.getPropertyValue("extraMax"); + }, set: function(u) { + this.setPropertyValue("extraMax", u) && this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "step", { get: function() { + return this._step; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "max", { get: function() { + var u = this._maxAdjusted; + return le(u) || (u = this._maxDefined), u; + }, set: function(u) { + this._maxDefined != u && (this._maxDefined = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "adjustLabelPrecision", { get: function() { + return this.getPropertyValue("adjustLabelPrecision"); + }, set: function(u) { + this.setPropertyValue("adjustLabelPrecision", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.registerSeries = function(u) { + return new kn([U.prototype.registerSeries.call(this, u), u.events.on("extremeschanged", this.handleExtremesChange, this, !1), u.events.on("selectionextremeschanged", this.handleSelectionExtremesChange, this, !1), this.events.on("extremeschanged", u.invalidate, u, !1)]); + }, R.prototype.handleSelectionExtremesChange = function() { + var u, w, $ = this, G = !0; + if (er(this.series.iterator(), function(Ze) { + if (!Ze.ignoreMinMax && !Ze.isHidden && !Ze.outOfRange) { + Ze.visible && !Ze.isHiding && (G = !1); + var pt = Ze.selectionMin($), Vt = Ze.selectionMax($); + le(pt) && (!le(u) || pt < u) && (u = pt), le(Vt) && (!le(w) || Vt > w) && (w = Vt); + } + }), this.includeRangesInMinMax && this.axisRanges.each(function(Ze) { + if (!Ze.ignoreMinMax) { + var pt = H(Ze.value, Ze.endValue), Vt = ve(Ze.value, Ze.endValue); + pt < u && (u = pt), Vt > w && (w = Vt); + } + }), le(this._minDefined) ? u = this.strictMinMax ? this._minDefined : this.min : this.strictMinMax && (u = this._minReal), le(this._maxDefined) ? w = this.strictMinMax ? this._maxDefined : this.max : this.strictMinMax && (w = this._maxReal), u == w) { + u -= this._deltaMinMax, w += this._deltaMinMax; + var K = this.adjustMinMax(u, w, 0, this._gridCount, this.strictMinMax); + u = K.min, w = K.max; + } + var ne = this.adjustDifference(u, w), ue = this.adjustMinMax(u, w, ne, this._gridCount); + u = ue.min, w = ue.max, u -= (w - u) * this.extraMin, w += (w - u) * this.extraMax, u = mt(u, this.min, this.max), w = mt(w, this.min, this.max), ne = this.adjustDifference(u, w), ue = this.adjustMinMax(u, w, ne, this._gridCount, !0), u = ue.min, w = ue.max, this.strictMinMax && (u = ve(u, this._minDefined), w = H(w, this._maxDefined)); + var we = ue.step; + this.syncWithAxis && (ue = this.syncAxes(u, w, we), u = ue.min, w = ue.max, this.invalidate()), we = ue.step, this._difference = this.adjustDifference(this.min, this.max); + var De = this.valueToPosition(u), $e = this.valueToPosition(w); + G && !this.syncWithAxis && (De = 0, $e = 1); + var Ke = 0; + this.syncWithAxis ? (Ke = 5, this.setCache(u + "-" + w, we)) : (this._step == we && this._minZoomed == u && this._maxZoomed == w || (this._dsc = !0), this._step = we, this._minZoomed = u, this._maxZoomed = w), this.keepSelection || this.zoom({ start: De, end: $e }, !1, !1, Ke); + }, Object.defineProperty(R.prototype, "strictMinMax", { get: function() { + return this.getPropertyValue("strictMinMax"); + }, set: function(u) { + this.setPropertyValue("strictMinMax", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "logarithmic", { get: function() { + return this.getPropertyValue("logarithmic"); + }, set: function(u) { + this.setPropertyValue("logarithmic", u) && (this.invalidate(), this.series.each(function(w) { + w.invalidateDataItems(); + })); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "keepSelection", { get: function() { + return this.getPropertyValue("keepSelection"); + }, set: function(u) { + this.setPropertyValue("keepSelection", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "includeRangesInMinMax", { get: function() { + return this.getPropertyValue("includeRangesInMinMax"); + }, set: function(u) { + this.setPropertyValue("includeRangesInMinMax", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxPrecision", { get: function() { + return this.getPropertyValue("maxPrecision"); + }, set: function(u) { + this.setPropertyValue("maxPrecision", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "extraTooltipPrecision", { get: function() { + return this.getPropertyValue("extraTooltipPrecision"); + }, set: function(u) { + this.setPropertyValue("extraTooltipPrecision", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), R.prototype.handleExtremesChange = function() { + var u = this; + this._extremesChanged = !0, this.getMinMax(), this.ghostLabel && this.dataItems.each(function(w) { + w.label && w.label.pixelWidth > 0 && (u.ghostLabel.text = w.label.currentText); + }); + }, R.prototype.getX = function(u, w, $, G, K) { + return this.renderer.positionToPoint(this.getPositionX(u, w, $, G, K)).x; + }, R.prototype.getPositionX = function(u, w, $, G, K) { + var ne = u.getWorkingValue(w); + Ee(G) || (G = "valueX"); + var ue = u.getValue(G, "stack"); + le(ne) || (ne = this.baseValue, this.logarithmic && ue > 0 && (ne = 0)); + var we = this.valueToPosition(ne + ue); + return K && (we = mt(we, K.start, K.end)), we; + }, R.prototype.getY = function(u, w, $, G, K) { + return this.renderer.positionToPoint(this.getPositionY(u, w, $, G, K)).y; + }, R.prototype.getPositionY = function(u, w, $, G, K) { + var ne = u.getWorkingValue(w); + Ee(G) || (G = "valueY"); + var ue = u.getValue(G, "stack"); + le(ne) || (ne = this.baseValue, this.logarithmic && ue > 0 && (ne = 0)); + var we = this.valueToPosition(ne + ue); + return K && (we = mt(we, K.start, K.end)), we; + }, R.prototype.getAngle = function(u, w, $, G, K) { + var ne = u.getWorkingValue(w), ue = u.getValue(G, "stack"); + le(ne) || (ne = this.baseValue); + var we = this.valueToPosition(ne + ue); + return K && (we = mt(we, K.start, K.end)), this.positionToAngle(we); + }, R.prototype.getAnyRangePath = function(u, w, $) { + var G = this.valueToPosition(u), K = this.valueToPosition(w); + return this.getPositionRangePath(G, K); + }, R.prototype.getTooltipText = function(u) { + var w = He(this.positionToValue(u), this._stepDecimalPlaces + this.extraTooltipPrecision), $ = this.tooltip.numberFormatter.format(w); + return this._adapterO ? this._adapterO.apply("getTooltipText", $) : $; + }, R.prototype.zoomToValues = function(u, w, $, G) { + var K = (u - this.min) / (this.max - this.min), ne = (w - this.min) / (this.max - this.min); + this.zoom({ start: K, end: ne }, $, G); + }, Object.defineProperty(R.prototype, "minZoomed", { get: function() { + return this.syncWithAxis ? this._minZoomed : ve(this.min, this._minZoomed); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxZoomed", { get: function() { + return this.syncWithAxis ? this._maxZoomed : H(this.max, this._maxZoomed); + }, enumerable: !0, configurable: !0 }), R.prototype.fixAxisBreaks = function() { + var u = this; + U.prototype.fixAxisBreaks.call(this); + var w = this._axisBreaks; + w && w.length > 0 && w.each(function($) { + var G = $.adjustedStartValue, K = $.adjustedEndValue, ne = K - G, ue = Math.ceil(ne * $.breakSize) * u._gridCount / (u.max - u.min), we = u.adjustMinMax(G, K, ne, ue, !0); + $.adjustedStep = we.step, $.adjustedMin = we.min, $.adjustedMax = we.max; + }), this._difference = this.adjustDifference(this.min, this.max); + }, R.prototype.getPositionLabel = function(u) { + var w = this.positionToValue(u); + return this.numberFormatter.format(w); + }, R.prototype.showTooltipAt = function(u) { + this.showTooltipAtPosition(this.valueToPosition(u)); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.min = u.min, this.max = u.max, this.calculateTotals = u.calculateTotals, this._baseValue = u.baseValue; + }, Object.defineProperty(R.prototype, "syncWithAxis", { get: function() { + return this.getPropertyValue("syncWithAxis"); + }, set: function(u) { + var w = this; + this.setPropertyValue("syncWithAxis", u, !0) && u && (this._disposers.push(u.events.on("extremeschanged", this.handleSelectionExtremesChange, this, !1)), this._disposers.push(u.events.on("selectionextremeschanged", this.handleSelectionExtremesChange, this, !1)), this._disposers.push(u.events.on("startendchanged", this.handleSelectionExtremesChange, this, !1)), this.events.on("shown", this.handleSelectionExtremesChange, this, !1), this.events.on("maxsizechanged", function() { + w.clearCache(), w._disposers.push(hi.events.once("exitframe", function() { + w.handleSelectionExtremesChange(); + })); + }, this, !1)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "treatZeroAs", { get: function() { + return this.getPropertyValue("treatZeroAs"); + }, set: function(u) { + this.setPropertyValue("treatZeroAs", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.syncAxes = function(u, w, $) { + var G = this.syncWithAxis; + if (G) { + le(u) || (u = this.min), le(w) || (w = this.max), le($) || ($ = this._step); + var K = Math.round((G.maxZoomed - G.minZoomed) / G.step), ne = Math.round((w - u) / $); + if (le(K) && le(ne)) + for (var ue = !1, we = 0, De = 0.01 * (w - u), $e = u, Ke = w, Ze = $; ue != 1; ) + if (ue = this.checkSync($e, Ke, Ze, K), ++we > 1e3 && (ue = !0), ue) + u = $e, w = Ke, $ = Ze; + else { + we / 3 == Math.round(we / 3) ? ($e = u - De * we, u >= 0 && $e < 0 && ($e = 0)) : (Ke = w + De * we) <= 0 && Ke > 0 && (Ke = 0); + var pt = this.adjustMinMax($e, Ke, Ke - $e, this._gridCount, !0); + $e = pt.min, Ke = pt.max, Ze = pt.step; + } + } + return { min: u, max: w, step: $ }; + }, R.prototype.checkSync = function(u, w, $, G) { + for (var K = (w - u) / $, ne = 1; ne < G; ne++) + if (He(K / ne, 1) == G || K * ne == G) + return !0; + return !1; + }, R.prototype.processConfig = function(u) { + u && Ee(u.syncWithAxis) && st(u.syncWithAxis) && (this.map.hasKey(u.syncWithAxis) ? u.syncWithAxis = this.map.getKey(u.syncWithAxis) : (this.processingErrors.push('[ValueAxis] No axis with id "' + u.syncWithAxis + '" found for `syncWithAxis`'), delete u.xAxis)), U.prototype.processConfig.call(this, u); + }, R; + }(OL); + hi.registeredClasses.ValueAxis = vo, hi.registeredClasses.ValueAxisDataItem = ML; + var OH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "DateAxisBreak", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "startDate", { get: function() { + return this.getPropertyValue("startDate"); + }, set: function(u) { + this.setPropertyValue("startDate", u) && (this.startValue = u.getTime(), this.axis && (this.axis.invalidate(), this.axis.invalidateSeries())); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endDate", { get: function() { + return this.getPropertyValue("endDate"); + }, set: function(u) { + this.setPropertyValue("endDate", u) && (this.endValue = u.getTime(), this.axis && (this.axis.invalidate(), this.axis.invalidateSeries())); + }, enumerable: !0, configurable: !0 }), R; + }(i9); + hi.registeredClasses.DateAxisBreak = OH; + var RH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "DateAxisDataItem", u.applyTheme(), u.values.date = {}, u.values.endDate = {}, u; + } + return re(R, U), Object.defineProperty(R.prototype, "date", { get: function() { + return this.dates.date; + }, set: function(u) { + this.setDate("date", u), this.value = u.getTime(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endDate", { get: function() { + return this.dates.endDate; + }, set: function(u) { + this.setDate("endDate", u), this.endValue = u.getTime(); + }, enumerable: !0, configurable: !0 }), R; + }(ML), Ju = function(U) { + function R() { + var u = U.call(this) || this; + return u._gapBreaks = !1, u.gridIntervals = new Hs(), u.groupIntervals = new Hs(), u.dateFormats = new ha(), u.periodChangeDateFormats = new ha(), u._baseIntervalReal = { timeUnit: "day", count: 1 }, u._prevSeriesTime = {}, u._minDifference = {}, u._firstWeekDay = 1, u.groupMin = {}, u.groupMax = {}, u.className = "DateAxis", u.setPropertyValue("markUnitChange", !0), u.snapTooltip = !0, u.tooltipPosition = "pointer", u.setPropertyValue("groupData", !1), u.groupCount = 200, u.events.on("parentset", u.getDFFormatter, u, !1), u.gridIntervals.pushAll([{ timeUnit: "millisecond", count: 1 }, { timeUnit: "millisecond", count: 5 }, { timeUnit: "millisecond", count: 10 }, { timeUnit: "millisecond", count: 50 }, { timeUnit: "millisecond", count: 100 }, { timeUnit: "millisecond", count: 500 }, { timeUnit: "second", count: 1 }, { timeUnit: "second", count: 5 }, { timeUnit: "second", count: 10 }, { timeUnit: "second", count: 30 }, { timeUnit: "minute", count: 1 }, { timeUnit: "minute", count: 5 }, { timeUnit: "minute", count: 10 }, { timeUnit: "minute", count: 15 }, { timeUnit: "minute", count: 30 }, { timeUnit: "hour", count: 1 }, { timeUnit: "hour", count: 3 }, { timeUnit: "hour", count: 6 }, { timeUnit: "hour", count: 12 }, { timeUnit: "day", count: 1 }, { timeUnit: "day", count: 2 }, { timeUnit: "day", count: 3 }, { timeUnit: "day", count: 4 }, { timeUnit: "day", count: 5 }, { timeUnit: "week", count: 1 }, { timeUnit: "month", count: 1 }, { timeUnit: "month", count: 2 }, { timeUnit: "month", count: 3 }, { timeUnit: "month", count: 6 }, { timeUnit: "year", count: 1 }, { timeUnit: "year", count: 2 }, { timeUnit: "year", count: 5 }, { timeUnit: "year", count: 10 }, { timeUnit: "year", count: 50 }, { timeUnit: "year", count: 100 }, { timeUnit: "year", count: 200 }, { timeUnit: "year", count: 500 }, { timeUnit: "year", count: 1e3 }, { timeUnit: "year", count: 2e3 }, { timeUnit: "year", count: 5e3 }, { timeUnit: "year", count: 1e4 }, { timeUnit: "year", count: 1e5 }]), u.groupIntervals.pushAll([{ timeUnit: "millisecond", count: 1 }, { timeUnit: "millisecond", count: 10 }, { timeUnit: "millisecond", count: 100 }, { timeUnit: "second", count: 1 }, { timeUnit: "second", count: 10 }, { timeUnit: "minute", count: 1 }, { timeUnit: "minute", count: 10 }, { timeUnit: "hour", count: 1 }, { timeUnit: "day", count: 1 }, { timeUnit: "week", count: 1 }, { timeUnit: "month", count: 1 }, { timeUnit: "year", count: 1 }]), u.axisFieldName = "date", u.applyTheme(), u; + } + return re(R, U), R.prototype.fillRule = function(u) { + var w = u.value, $ = u.component, G = $._gridInterval, K = Tu(G.timeUnit, G.count); + Math.round((w - $.min) / K) / 2 == Math.round(Math.round((w - $.min) / K) / 2) ? u.axisFill.__disabled = !0 : u.axisFill.__disabled = !1; + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), this.dateFormats.hasKey("millisecond") || this.dateFormats.setKey("millisecond", this.language.translate("_date_millisecond")), this.dateFormats.hasKey("second") || this.dateFormats.setKey("second", this.language.translate("_date_second")), this.dateFormats.hasKey("minute") || this.dateFormats.setKey("minute", this.language.translate("_date_minute")), this.dateFormats.hasKey("hour") || this.dateFormats.setKey("hour", this.language.translate("_date_hour")), this.dateFormats.hasKey("day") || this.dateFormats.setKey("day", this.language.translate("_date_day")), this.dateFormats.hasKey("week") || this.dateFormats.setKey("week", this.language.translate("_date_day")), this.dateFormats.hasKey("month") || this.dateFormats.setKey("month", this.language.translate("_date_month")), this.dateFormats.hasKey("year") || this.dateFormats.setKey("year", this.language.translate("_date_year")), this.periodChangeDateFormats.hasKey("millisecond") || this.periodChangeDateFormats.setKey("millisecond", this.language.translate("_date_millisecond")), this.periodChangeDateFormats.hasKey("second") || this.periodChangeDateFormats.setKey("second", this.language.translate("_date_second")), this.periodChangeDateFormats.hasKey("minute") || this.periodChangeDateFormats.setKey("minute", this.language.translate("_date_minute")), this.periodChangeDateFormats.hasKey("hour") || this.periodChangeDateFormats.setKey("hour", this.language.translate("_date_day")), this.periodChangeDateFormats.hasKey("day") || this.periodChangeDateFormats.setKey("day", this.language.translate("_date_day")), this.periodChangeDateFormats.hasKey("week") || this.periodChangeDateFormats.setKey("week", this.language.translate("_date_day")), this.periodChangeDateFormats.hasKey("month") || this.periodChangeDateFormats.setKey("month", this.language.translate("_date_month") + " " + this.language.translate("_date_year")); + }, R.prototype.createDataItem = function() { + return new RH(); + }, R.prototype.createAxisBreak = function() { + return new OH(); + }, R.prototype.validateDataItems = function() { + var u = this.start, w = this.end, $ = this.baseDuration, G = (this.max - this.min) / $; + this._firstWeekDay = this.getFirstWeekDay(), this.getDFFormatter(), U.prototype.validateDataItems.call(this); + var K = Tu(this.mainBaseInterval.timeUnit, this.mainBaseInterval.count); + this.maxZoomFactor = Math.max(1, (this.max - this.min) / K), this._deltaMinMax = this.baseDuration / 2, u += (w - u) * (1 - G / ((this.max - this.min) / $)), this.zoom({ start: u, end: w }, !1, !0); + }, R.prototype.handleSelectionExtremesChange = function() { + }, R.prototype.calculateZoom = function() { + var u = this; + U.prototype.calculateZoom.call(this); + var w = this.adjustDifference(this._minZoomed, this._maxZoomed), $ = !1; + if (this.groupData && Ee(w)) { + var G = this.mainBaseInterval, K = w + (this.startLocation + (1 - this.endLocation)) * this.baseDuration, ne = void 0; + this.groupInterval ? ne = he({}, this.groupInterval) : Tu((ne = this.chooseInterval(0, K, this.groupCount, this.groupIntervals)).timeUnit, ne.count) < Tu(G.timeUnit, G.count) && (ne = he({}, G)), this._groupInterval = ne; + var ue = ne.timeUnit + ne.count; + this._currentDataSetId != ue && (this._currentDataSetId = ue, this.dispatch("groupperiodchanged")), this.series.each(function(De) { + De.baseAxis == u && De.setDataSet(u._currentDataSetId) && ($ = !0); + }); + } + var we = this.chooseInterval(0, w, this._gridCount); + Tu(we.timeUnit, we.count) < this.baseDuration && (we = he({}, this.baseInterval)), this._gridInterval = we, this._nextGridUnit = H3(we.timeUnit), this._intervalDuration = Tu(we.timeUnit, we.count), this._gridDate = Uh(new Date(this.minZoomed - Tu(we.timeUnit, we.count)), we.timeUnit, we.count, this._firstWeekDay, this._df.utc, new Date(this.min), this._df.timezoneMinutes, this._df.timezone), er(this.series.iterator(), function(De) { + if (De.baseAxis == u) { + var $e = De.getAxisField(u), Ke = Uh(new Date(u._minZoomed + 0.05 * u.baseDuration), u.baseInterval.timeUnit, u.baseInterval.count, u._firstWeekDay, u._df.utc, void 0, u._df.timezoneMinutes, u._df.timezone).getTime(), Ze = Ke.toString(), pt = De.dataItemsByAxis.getKey(u.uid).getKey(Ze + De.currentDataSetId), Vt = 0; + u.start != 0 && (Vt = pt ? (pt = u.findFirst(pt, Ke, $e)).index : De.dataItems.findClosestIndex(u._minZoomed, function(Ci) { + return Ci[$e]; + }, "left")); + var Yt = u.baseInterval, ci = cp(Uh(new Date(u._maxZoomed), Yt.timeUnit, Yt.count, u._firstWeekDay, u._df.utc, void 0, u._df.timezoneMinutes, u._df.timezone), Yt.timeUnit, Yt.count, u._df.utc).getTime(), ai = ci.toString(), Gi = De.dataItemsByAxis.getKey(u.uid).getKey(ai + De.currentDataSetId), Ji = De.dataItems.length; + u.end != 1 && (Gi ? Ji = Gi.index : (ci -= 1, Ji = De.dataItems.findClosestIndex(ci, function(Ci) { + return Ci[$e]; + }, "right"), Ji++)), De.max(u) < Ke ? (De.startIndex = De.dataItems.length, De.endIndex = De.dataItems.length, De.outOfRange = !0) : De.min(u) > ci ? (De.startIndex = 0, De.endIndex = 0, De.outOfRange = !0) : (De.outOfRange = !1, De.startIndex = Vt, De.endIndex = Ji), !$ && De.dataRangeInvalid && De.validateDataRange(); + } + }); + }, R.prototype.findFirst = function(u, w, $) { + var G = u.index; + if (G > 0) { + var K = u.component.dataItems.getIndex(G - 1), ne = K[$]; + return !ne || ne.getTime() < w ? u : this.findFirst(K, w, $); + } + return u; + }, R.prototype.validateData = function() { + U.prototype.validateData.call(this), le(this.baseInterval.count) || (this.baseInterval.count = 1); + }, Object.defineProperty(R.prototype, "minDifference", { get: function() { + var u = this, w = Number.MAX_VALUE; + return this.series.each(function($) { + w > u._minDifference[$.uid] && (w = u._minDifference[$.uid]); + }), w != Number.MAX_VALUE && w != 0 || (w = Tu("day")), w; + }, enumerable: !0, configurable: !0 }), R.prototype.seriesDataChangeUpdate = function(u) { + this._minDifference[u.uid] = Number.MAX_VALUE; + }, R.prototype.postProcessSeriesDataItems = function(u) { + var w = this; + this._firstWeekDay = this.getFirstWeekDay(), u ? this.seriesGroupUpdate(u) : this.series.each(function($) { + w.seriesGroupUpdate($); + }), this.addEmptyUnitsBreaks(); + }, R.prototype.seriesGroupUpdate = function(u) { + var w = this; + JSON.stringify(u._baseInterval[this.uid]) != JSON.stringify(this.mainBaseInterval) && (u._baseInterval[this.uid] = this.mainBaseInterval, u.mainDataSet.each(function($) { + w.postProcessSeriesDataItem($); + }), this.groupData && this.groupSeriesData(u)); + }, R.prototype.groupSeriesData = function(u) { + var w = this; + if (u.baseAxis == this && u.dataItems.length > 0 && !u.dataGrouped) { + u.bulletsContainer.removeChildren(); + var $ = [], G = this.mainBaseInterval, K = Tu(G.timeUnit, G.count); + this.groupIntervals.each(function(ne) { + var ue = Tu(ne.timeUnit, ne.count); + (ue > K && ue < w.max - w.min || w.groupInterval) && $.push(ne); + }), u._dataSets && (u._dataSets.each(function(ne, ue) { + ue.each(function(we) { + we.dispose(); + }), ue.clear(); + }), u._dataSets.clear()), u.dataGrouped = !0, _i($, function(ne) { + var ue = "date" + w.axisLetter, we = ne.timeUnit + ne.count, De = new Im(u.mainDataSet.template.clone()); + u.dataSets.setKey(we, De); + var $e, Ke, Ze = u.mainDataSet, pt = Number.NEGATIVE_INFINITY, Vt = 0, Yt = []; + mi(u.dataFields, function(ci, ai) { + var Gi = ci; + Gi != ue && Gi.indexOf("Show") == -1 && Yt.push(Gi); + }), Ze.each(function(ci) { + var ai = ci.getDate(ue); + if (ai) { + var Gi = ai.getTime(), Ji = (Ke = Uh(new Date(Gi), ne.timeUnit, ne.count, w._df.firstDayOfWeek, w._df.utc, void 0, w._df.timezoneMinutes, w._df.timezone)).getTime(); + pt < Ji ? ($e && u._adapterO && _i(Yt, function(Ci) { + $e.values[Ci].value = u._adapterO.apply("groupDataItem", { dataItem: $e, interval: ne, dataField: Ci, date: Ke, value: $e.values[Ci].value }).value, $e.values[Ci].workingValue = $e.values[Ci].value; + }), ($e = De.create()).dataContext = {}, $e.setWorkingLocation("dateX", u.dataItems.template.locations.dateX, 0), $e.setWorkingLocation("openDateX", u.dataItems.template.locations.openDateX, 0), $e.setWorkingLocation("dateY", u.dataItems.template.locations.dateY, 0), $e.setWorkingLocation("openDateY", u.dataItems.template.locations.openDateY, 0), $e.component = u, $e.setDate(ue, Ke), $e._index = Vt, Vt++, _i(Yt, function(Ci) { + var Hi = ci.values[Ci]; + if (Hi) { + var sr = Hi.value; + u._adapterO && (sr = u._adapterO.apply("groupValue", { dataItem: ci, interval: ne, dataField: Ci, date: Ke, value: sr }).value); + var Or = $e.values[Ci]; + le(sr) ? (Or.value = sr, Or.workingValue = sr, Or.open = sr, Or.close = sr, Or.low = sr, Or.high = sr, Or.sum = sr, Or.average = sr, Or.count = 1) : Or.count = 0; + } + }), w.postProcessSeriesDataItem($e, ne), mi(u.propertyFields, function(Ci, Hi) { + var sr = Ci, Or = ci.properties[Ci]; + Ee(Or) && ($e.hasProperties = !0, $e.setProperty(sr, Or)); + }), $e.groupDataItems = [ci], pt = Ji) : $e && (_i(Yt, function(Ci) { + var Hi = u.groupFields[Ci], sr = ci.values[Ci]; + if (sr) { + var Or = sr.value; + if (u._adapterO && (Or = u._adapterO.apply("groupValue", { dataItem: ci, interval: ne, dataField: Ci, date: Ke, value: Or }).value), le(Or)) { + var yr = $e.values[Ci]; + le(yr.open) || (yr.open = Or), yr.close = Or, (yr.low > Or || !le(yr.low)) && (yr.low = Or), (yr.high < Or || !le(yr.high)) && (yr.high = Or), le(yr.sum) ? yr.sum += Or : yr.sum = Or, yr.count++, yr.average = yr.sum / yr.count, le(yr[Hi]) && (yr.value = yr[Hi], yr.workingValue = yr.value); + } + } + }), on(ci.properties, $e.properties), mi(u.propertyFields, function(Ci, Hi) { + var sr = Ci, Or = ci.properties[Ci]; + Ee(Or) && ($e.hasProperties = !0, $e.setProperty(sr, Or)); + }), $e.groupDataItems.push(ci)); + } + $e && on(ci.dataContext, $e.dataContext); + }), $e && u._adapterO && _i(Yt, function(ci) { + $e.values[ci].value = u._adapterO.apply("groupDataItem", { dataItem: $e, interval: ne, dataField: ci, date: Ke, value: $e.values[ci].value }).value, $e.values[ci].workingValue = $e.values[ci].value; + }); + }), this.calculateZoom(); + } + }, R.prototype.getDFFormatter = function() { + this._df = this.dateFormatter; + }, R.prototype.postProcessSeriesDataItem = function(u, w) { + var $ = this, G = ""; + w ? G = w.timeUnit + w.count : w = this.mainBaseInterval; + var K = u.component.dataItemsByAxis.getKey(this.uid); + mi(u.dates, function(ne) { + var ue = u.getDate(ne).getTime(), we = Uh(new Date(ue), w.timeUnit, w.count, $._firstWeekDay, $._df.utc, void 0, $._df.timezoneMinutes, $._df.timezone).getTime(), De = cp(new Date(we), w.timeUnit, w.count, $._df.utc); + u.setCalculatedValue(ne, we, "open"), u.setCalculatedValue(ne, De.getTime(), "close"), K.setKey(we + G, u); + }); + }, R.prototype.addEmptyUnitsBreaks = function() { + var u = this; + if (this.skipEmptyPeriods && le(this.min) && le(this.max)) { + var w = this.baseInterval.timeUnit, $ = this.baseInterval.count; + this._axisBreaks && this._axisBreaks.clear(); + for (var G = Uh(new Date(this.min), w, $, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), K = void 0, ne = function() { + cp(G, w, $, ue._df.utc); + var we = G.getTime(), De = we.toString(); + ah(ue.series.iterator(), function($e) { + return !!$e.dataItemsByAxis.getKey(u.uid).getKey(De + $e.currentDataSetId); + }) ? K && (K.endDate = new Date(we - 1), K = void 0) : K || ((K = ue.axisBreaks.create()).startDate = new Date(we), ue._gapBreaks = !0); + }, ue = this; G.getTime() < this.max - this.baseDuration; ) + ne(); + } + }, R.prototype.fixAxisBreaks = function() { + var u = this; + U.prototype.fixAxisBreaks.call(this); + var w = this._axisBreaks; + w && w.length > 0 && w.each(function($) { + var G = Math.ceil(u._gridCount * (Math.min(u.end, $.endPosition) - Math.max(u.start, $.startPosition)) / (u.end - u.start)); + $.gridInterval = u.chooseInterval(0, $.adjustedEndValue - $.adjustedStartValue, G); + var K = Uh(new Date($.adjustedStartValue), $.gridInterval.timeUnit, $.gridInterval.count, u._firstWeekDay, u._df.utc, void 0, u._df.timezoneMinutes, u._df.timezone); + K.getTime() > $.startDate.getTime() && cp(K, $.gridInterval.timeUnit, $.gridInterval.count, u._df.utc), $.gridDate = K; + }); + }, R.prototype.getFirstWeekDay = function() { + return this._df ? this._df.firstDayOfWeek : 1; + }, R.prototype.getGridDate = function(u, w) { + var $ = this._gridInterval.timeUnit, G = this._gridInterval.count; + Uh(u, $, 1, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone); + var K = u.getTime(), ne = Jx(u), ue = cp(ne, $, w, this._df.utc).getTime(), we = this.isInBreak(ue); + we && we.endDate && (Uh(ne = new Date(we.endDate.getTime()), $, G, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), ne.getTime() < we.endDate.getTime() && cp(ne, $, G, this._df.utc), ue = ne.getTime()); + var De = this.adjustDifference(K, ue); + return Math.round(De / Tu($)) < G ? this.getGridDate(u, w + G) : ne; + }, R.prototype.getBreaklessDate = function(u, w, $) { + var G = new Date(u.endValue); + Uh(G, w, $, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), cp(G, w, $, this._df.utc); + var K = G.getTime(); + return (u = this.isInBreak(K)) ? this.getBreaklessDate(u, w, $) : G; + }, R.prototype.validateAxisElements = function() { + var u = this; + if (le(this.max) && le(this.min)) { + this.calculateZoom(); + var w = this._gridDate.getTime(), $ = this._gridInterval.timeUnit, G = this._gridInterval.count, K = Jx(this._gridDate), ne = this._dataItemsIterator; + this.resetIterators(); + for (var ue = function() { + var $e = we.getGridDate(Jx(K), G); + w = $e.getTime(); + var Ke = Jx($e); + Ke = cp(Ke, $, G, we._df.utc); + var Ze = we.dateFormats.getKey($); + we.markUnitChange && K && AC($e, K, we._nextGridUnit, we._df.utc) && $ !== "year" && (Ze = we.periodChangeDateFormats.getKey($)); + var pt = we._df.format($e, Ze), Vt = ne.find(function(Yt) { + return Yt.text === pt; + }); + Vt.__disabled && (Vt.__disabled = !1), we.appendDataItem(Vt), Vt.axisBreak = void 0, Vt.date = $e, Vt.endDate = Ke, Vt.text = pt, we.validateDataElement(Vt), K = $e; + }, we = this; w <= this._maxZoomed; ) + ue(); + var De = this.renderer; + this._axisBreaks && er(this._axisBreaks.iterator(), function($e) { + if ($e.breakSize > 0) { + var Ke = $e.gridInterval.timeUnit, Ze = $e.gridInterval.count; + if (C($e.startPoint, $e.endPoint) > 4 * De.minGridDistance) + for (var pt, Vt = $e.gridDate.getTime(), Yt = 0, ci = function() { + var ai = Jx($e.gridDate); + if (Vt = cp(ai, Ke, Ze * Yt, u._df.utc).getTime(), Yt++, Vt > $e.adjustedStartValue && Vt < $e.adjustedEndValue) { + var Gi = Jx(ai); + Gi = cp(Gi, Ke, Ze, u._df.utc); + var Ji = u.dateFormats.getKey(Ke); + u.markUnitChange && pt && AC(ai, pt, u._nextGridUnit, u._df.utc) && Ke !== "year" && (Ji = u.periodChangeDateFormats.getKey(Ke)); + var Ci = u._df.format(ai, Ji), Hi = ne.find(function(sr) { + return sr.text === Ci; + }); + Hi.__disabled && (Hi.__disabled = !1), u.appendDataItem(Hi), Hi.axisBreak = $e, $e.dataItems.moveValue(Hi), Hi.date = ai, Hi.endDate = Gi, Hi.text = Ci, pt = ai, u.validateDataElement(Hi); + } + }; Vt <= $e.adjustedMax; ) + ci(); + } + }); + } + }, R.prototype.validateDataElement = function(u) { + if (u.itemIndex = this._axisItemCount, this._axisItemCount++, le(this.max) && le(this.min)) { + var w = this.renderer, $ = u.value, G = u.endValue; + le(G) || (G = $); + var K = this.valueToPosition($), ne = this.valueToPosition(G), ue = ne; + !u.isRange && this._gridInterval.count > this.baseInterval.count && (ne = K + (ne - K) / (this._gridInterval.count / this.baseInterval.count)), u.position = K; + var we = u.tick; + we && !we.disabled && w.updateTickElement(we, K, ne); + var De = u.grid; + De && !De.disabled && w.updateGridElement(De, K, ne); + var $e = u.axisFill; + $e && !$e.disabled && (w.updateFillElement($e, K, ue), u.isRange || this.fillRule(u)); + var Ke = u.mask; + Ke && w.updateFillElement(Ke, K, ne), u.bullet && w.updateBullet(u.bullet, K, ne); + var Ze = u.label; + if (Ze && !Ze.disabled) { + var pt = Ze.location; + pt == 0 && (pt = this._gridInterval.count != 1 || this._gridInterval.timeUnit == "week" || u.isRange ? 0 : 0.5), w.updateLabelElement(Ze, K, ne, pt); + } + } + }, Object.defineProperty(R.prototype, "baseDuration", { get: function() { + return Tu(this.baseInterval.timeUnit, this.baseInterval.count); + }, enumerable: !0, configurable: !0 }), R.prototype.adjustMinMax = function(u, w) { + return { min: u, max: w, step: this.baseDuration }; + }, R.prototype.fixMin = function(u) { + var w = this.baseInterval, $ = Uh(new Date(u), w.timeUnit, w.count, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone).getTime(); + return $ + (cp(new Date($), w.timeUnit, w.count, this._df.utc).getTime() - $) * this.startLocation; + }, R.prototype.fixMax = function(u) { + var w = this.baseInterval, $ = Uh(new Date(u), w.timeUnit, w.count, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone).getTime(); + return $ + (cp(new Date($), w.timeUnit, w.count, this._df.utc).getTime() - $) * this.endLocation; + }, R.prototype.chooseInterval = function(u, w, $, G) { + G || (G = this.gridIntervals); + var K = G.getIndex(u), ne = Tu(K.timeUnit, K.count), ue = G.length - 1; + if (u >= ue) + return he({}, G.getIndex(ue)); + var we = Math.ceil(w / ne); + return w < ne && u > 0 ? he({}, G.getIndex(u - 1)) : we <= $ ? he({}, G.getIndex(u)) : u + 1 < G.length ? this.chooseInterval(u + 1, w, $, G) : he({}, G.getIndex(u)); + }, R.prototype.formatLabel = function(u) { + return this._df.format(u); + }, R.prototype.dateToPosition = function(u) { + return this.valueToPosition(u.getTime()); + }, R.prototype.anyToPosition = function(u) { + return u instanceof Date ? this.dateToPosition(u) : this.valueToPosition(u); + }, R.prototype.dateToPoint = function(u) { + var w = this.dateToPosition(u), $ = this.renderer.positionToPoint(w), G = this.renderer.positionToAngle(w); + return { x: $.x, y: $.y, angle: G }; + }, R.prototype.anyToPoint = function(u) { + return u instanceof Date ? this.dateToPoint(u) : this.valueToPoint(u); + }, R.prototype.positionToDate = function(u) { + return new Date(this.positionToValue(u)); + }, R.prototype.getPositionX = function(u, w, $, G, K) { + var ne = this.getTimeByLocation(u, w, $); + le(ne) || (ne = this.baseValue); + var ue = this.valueToPosition(ne); + return K && (ue = mt(ue, K.start, K.end)), ue; + }, R.prototype.getPositionY = function(u, w, $, G, K) { + var ne = this.getTimeByLocation(u, w, $), ue = u.getValue("valueX", "stack"); + le(ne) || (ne = this.baseValue); + var we = this.valueToPosition(ne + ue); + return K && (we = mt(we, K.start, K.end)), we; + }, R.prototype.getAngle = function(u, w, $, G, K) { + var ne = this.getTimeByLocation(u, w, $), ue = u.getValue(G, "stack"); + le(ne) || (ne = this.baseValue); + var we = this.valueToPosition(ne + ue); + return K && (we = mt(we, K.start, K.end)), this.positionToAngle(we); + }, R.prototype.getTimeByLocation = function(u, w, $) { + if (Ee(w)) { + le($) || le($ = u.workingLocations[w]) || ($ = 0); + var G = u.values[w].open, K = u.values[w].close, ne = u.values[w].workingValue, ue = u.values[w].value - ne; + return K -= ue, le(G -= ue) && le(K) ? G + (K - G) * $ : void 0; + } + }, R.prototype.processSeriesDataItem = function(u, w) { + var $, G = u.component, K = u["date" + w]; + if (le(this.timezoneOffset) ? (K.setTime(K.getTime() + 6e4 * (K.getTimezoneOffset() - this.timezoneOffset)), u.setValue("date" + w, K.getTime(), 0)) : Ee(this.timezone) && (K = nA(K, this.timezone), u.setValue("date" + w, K.getTime(), 0), u["date" + w] = K), K) { + $ = K.getTime(); + var ne, ue = u["openDate" + w], we = this._prevSeriesTime[G.uid]; + if (ue && (ne = ue.getTime()), le(ne)) { + var De = Math.abs($ - ne); + this._minDifference[G.uid] > De && (this._minDifference[G.uid] = De); + } + var $e = $ - we; + $e > 0 && this._minDifference[G.uid] > $e && (this._minDifference[G.uid] = $e), this._prevSeriesTime[G.uid] = $, G._baseInterval[this.uid] && this.postProcessSeriesDataItem(u); + } + }, R.prototype.updateAxisBySeries = function() { + U.prototype.updateAxisBySeries.call(this); + var u = this.chooseInterval(0, this.minDifference, 1); + this.minDifference >= Tu("day", 27) && u.timeUnit == "week" && (u.timeUnit = "month", u.count = 1), u.timeUnit == "month" && (this.minDifference >= Tu("day", 58) && u.count == 1 && (u.count = 2), this.minDifference >= Tu("day", 87) && u.count == 2 && (u.count = 3), this.minDifference >= Tu("day", 174) && u.count == 5 && (u.count = 6)), this.minDifference >= Tu("hour", 23) && u.timeUnit == "hour" && (u.timeUnit = "day", u.count = 1), this.minDifference >= Tu("week", 1) - Tu("hour", 1) && u.timeUnit == "day" && (u.timeUnit = "week", u.count = 1), this.minDifference >= Tu("year", 1) - Tu("day", 1.01) && u.timeUnit == "month" && (u.timeUnit = "year", u.count = 1), this._baseIntervalReal = u, this._mainBaseInterval = u; + }, Object.defineProperty(R.prototype, "baseInterval", { get: function() { + return this._groupInterval ? this._groupInterval : this._baseInterval ? this._baseInterval : this._baseIntervalReal; + }, set: function(u) { + JSON.stringify(this._baseInterval) != JSON.stringify(u) && (this._baseInterval = u, this._mainBaseInterval = u, le(u.count) || (u.count = 1), this.invalidate(), this.postProcessSeriesDataItems()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "mainBaseInterval", { get: function() { + return this._baseInterval ? this._baseInterval : this._mainBaseInterval ? this._mainBaseInterval : this._baseIntervalReal; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "skipEmptyPeriods", { get: function() { + return this.getPropertyValue("skipEmptyPeriods"); + }, set: function(u) { + if (u) { + var w = this.axisBreaks.template; + w.startLine.disabled = !0, w.endLine.disabled = !0, w.fillShape.disabled = !0, w.breakSize = 0; + } else + this._gapBreaks && (this.axisBreaks.clear(), this._gapBreaks = !1); + this.setPropertyValue("skipEmptyPeriods", u) && (this.invalidate(), this.postProcessSeriesDataItems(), this.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipDateFormat", { get: function() { + return this.getPropertyValue("tooltipDateFormat"); + }, set: function(u) { + this.setPropertyValue("tooltipDateFormat", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "markUnitChange", { get: function() { + return this.getPropertyValue("markUnitChange"); + }, set: function(u) { + this.setPropertyValue("markUnitChange", u) && this.invalidateData(); + }, enumerable: !0, configurable: !0 }), R.prototype.getTooltipText = function(u) { + var w, $ = this.positionToDate(u); + if ($ = Uh($, this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc, new Date(this.min), this._df.timezoneMinutes, this._df.timezone), this.tooltipDate = $, Ee(this.tooltipDateFormat)) + w = this._df.format($, this.tooltipDateFormat, ["day", "month", "week", "year"].indexOf(this.baseInterval.timeUnit) == -1); + else { + var G = this.dateFormats.getKey(this.baseInterval.timeUnit); + w = G ? this._df.format($, G) : this.getPositionLabel(u); + } + return this._adapterO ? this._adapterO.apply("getTooltipText", w) : w; + }, R.prototype.roundPosition = function(u, w, $) { + var G = this.baseInterval, K = G.timeUnit, ne = G.count, ue = this.positionToDate(u); + if (Uh(ue, K, ne, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), w > 0 && cp(ue, K, w * ne, this._df.utc), $ > 0 && $ < 1 && ue.setTime(ue.getTime() + this.baseDuration * $), this.isInBreak(ue.getTime())) + for (; ue.getTime() < this.max && (cp(ue, K, ne, this._df.utc), this.isInBreak(ue.getTime())); ) + ; + return this.dateToPosition(ue); + }, R.prototype.getCellStartPosition = function(u) { + return this.roundPosition(u, 0); + }, R.prototype.getCellEndPosition = function(u) { + return this.roundPosition(u, 1); + }, R.prototype.getSeriesDataItem = function(u, w, $) { + var G = this.positionToValue(w), K = G - (this.axisLetter == "Y" ? u.dataItems.template.locations.dateY : u.dataItems.template.locations.dateX) * this.baseDuration, ne = Uh(new Date(G), this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), ue = Uh(new Date(G + this.baseDuration), this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone); + ue.getTime() > ne.getTime() && Math.abs(ue.getTime() - K) < Math.abs(K - ne.getTime()) && (ne = ue); + var we, De = u.dataItemsByAxis.getKey(this.uid).getKey(ne.getTime() + u.currentDataSetId); + return !De && $ && (we = this.axisLetter == "Y" ? "dateY" : "dateX", De = u.dataItems.getIndex(u.dataItems.findClosestIndex(ne.getTime(), function($e) { + return $e[we] ? $e[we].getTime() : -1 / 0; + }, "any"))), De; + }, R.prototype.getPositionLabel = function(u) { + var w = this.positionToDate(u); + return this._df.format(w, this.getCurrentLabelFormat()); + }, R.prototype.getCurrentLabelFormat = function() { + return this.dateFormats.getKey(this._gridInterval ? this._gridInterval.timeUnit : "day"); + }, R.prototype.initRenderer = function() { + U.prototype.initRenderer.call(this); + var u = this.renderer; + u && (u.ticks.template.location = 0, u.grid.template.location = 0, u.labels.template.location = 0, u.baseGrid.disabled = !0); + }, Object.defineProperty(R.prototype, "basePoint", { get: function() { + return { x: 0, y: 0 }; + }, enumerable: !0, configurable: !0 }), R.prototype.animateMinMax = function(u, w) { + var $ = this, G = this.animate([{ property: "_minAdjusted", from: this._minAdjusted, to: u }, { property: "_maxAdjusted", from: this._maxAdjusted, to: w }], this.rangeChangeDuration, this.rangeChangeEasing); + return G.events.on("animationprogress", function() { + $.dispatch("extremeschanged"); + }), G; + }, R.prototype.handleExtremesChange = function() { + if (U.prototype.handleExtremesChange.call(this), this.groupData) { + var u = this.baseInterval.timeUnit + this.baseInterval.count; + this.groupMin[u] = this._finalMin, this.groupMax[u] = this._finalMax; + } + }, R.prototype.zoomToDates = function(u, w, $, G, K) { + u = this._df.parse(u), w = this._df.parse(w), this.zoomToValues(u.getTime(), w.getTime(), $, G, K); + }, R.prototype.zoomToValues = function(u, w, $, G, K) { + var ne = this; + if (this.groupData) { + var ue = this.adjustDifference(u, w), we = !1; + w == this.max && (we = !0); + var De = !1; + if (u == this.min && (De = !0), Ee(ue)) { + var $e = this.mainBaseInterval, Ke = this.chooseInterval(0, ue, this.groupCount, this.groupIntervals); + (Ke.timeUnit == $e.timeUnit && Ke.count < $e.count || Tu(Ke.timeUnit, 1) < Tu($e.timeUnit, 1)) && (Ke = he({}, $e)); + var Ze = Ke.timeUnit + Ke.count, pt = this.groupMin[Ze], Vt = this.groupMax[Ze]; + le(pt) && le(Vt) || (pt = Number.POSITIVE_INFINITY, Vt = Number.NEGATIVE_INFINITY, this.series.each(function(ai) { + var Gi = ai.min(ne), Ji = ai.max(ne); + if (ai._dataSets) { + var Ci = ai._dataSets.getKey(Ke.timeUnit + Ke.count); + if (Ci) { + var Hi = Ci.getIndex(0), sr = Ci.getIndex(Ci.length - 1); + Hi && (ai.xAxis == ne ? Gi = Hi.dateX.getTime() : ai.yAxis == ne && (Gi = Hi.dateY.getTime())), sr && (ai.xAxis == ne ? Ji = sr.dateX.getTime() : ai.yAxis == ne && (Ji = sr.dateY.getTime())); + } + } + Ji = Uh(cp(new Date(Ji), Ke.timeUnit, 1, ne._df.utc), Ke.timeUnit, 1, ne._df.firstDayOfWeek, ne._df.utc, void 0, ne._df.timezoneMinutes, ne._df.timezone).getTime(), Gi < pt && (pt = Gi), Ji > Vt && (Vt = Ji); + }), this.groupMin[Ze] = pt, this.groupMax[Ze] = Vt), u = mt(u, pt, Vt), w = mt(w, pt, Vt), K && (we && (u = mt(u = w - ue, pt, Vt)), De && (w = mt(w = u + ue, pt, Vt))), Yt = (u - pt) / (Vt - pt), ci = (w - pt) / (Vt - pt), this.zoom({ start: Yt, end: ci }, $, G); + } + } else { + var Yt = this.valueToPosition(u), ci = this.valueToPosition(w); + this.zoom({ start: Yt, end: ci }, $, G); + } + }, R.prototype.asIs = function(u) { + return u == "baseInterval" || U.prototype.asIs.call(this, u); + }, R.prototype.copyFrom = function(u) { + var w = this; + U.prototype.copyFrom.call(this, u), this.dateFormats = u.dateFormats, this.periodChangeDateFormats = u.periodChangeDateFormats, this.groupIntervals.clear(), u.groupIntervals.each(function($) { + w.groupIntervals.push(he({}, $)); + }), this.gridIntervals.clear(), u.gridIntervals.each(function($) { + w.gridIntervals.push(he({}, $)); + }), u._baseInterval && (this.baseInterval = u._baseInterval); + }, R.prototype.showTooltipAtPosition = function(u, w) { + var $ = this; + if (w || (u = this.toAxisPosition(u)), this.snapTooltip) { + var G, K = this.positionToDate(u).getTime(); + if (this.series.each(function(we) { + if (we.baseAxis == $) { + var De = $.getSeriesDataItem(we, u, !0); + if (De) { + var $e = void 0; + we.xAxis == $ && ($e = De.dateX), we.yAxis == $ && ($e = De.dateY), G ? Math.abs(G.getTime() - K) > Math.abs($e.getTime() - K) && (G = $e) : G = $e; + } + } + }), G) { + var ne = G.getTime(); + G = Uh(new Date(ne), this.baseInterval.timeUnit, this.baseInterval.count, this._firstWeekDay, this._df.utc, void 0, this._df.timezoneMinutes, this._df.timezone), ne = G.getTime(); + var ue = this.renderer.tooltipLocation; + ue == 0 && (ue = 1e-4), G = new Date(G.getTime() + this.baseDuration * ue), u = this.dateToPosition(G), this.chart.cursor && this.chart.cursor.snapToSeries || this.series.each(function(we) { + var De = we.dataItemsByAxis.getKey($.uid).getKey(ne + we.currentDataSetId), $e = we.showTooltipAtDataItem(De); + $e ? $.chart._seriesPoints.push({ series: we, point: $e }) : (we.tooltipText || we.tooltipHTML) && we.hideTooltip(); + }); + } + } + U.prototype.showTooltipAtPosition.call(this, u, !0); + }, Object.defineProperty(R.prototype, "snapTooltip", { get: function() { + return this.getPropertyValue("snapTooltip"); + }, set: function(u) { + this.setPropertyValue("snapTooltip", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "groupData", { get: function() { + return this.getPropertyValue("groupData"); + }, set: function(u) { + var w = this; + this.setPropertyValue("groupData", u) && (this.series.each(function($) { + $.setDataSet(""), u && !$.dataGrouped && $.inited && ($._baseInterval[w.uid] = w.mainBaseInterval, w.groupSeriesData($)); + }), this._currentDataSetId = "", this._groupInterval = void 0, this.invalidate(), this.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "groupInterval", { get: function() { + return this.getPropertyValue("groupInterval"); + }, set: function(u) { + this.setPropertyValue("groupInterval", u) && (this.invalidate(), this.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "groupCount", { get: function() { + return this.getPropertyValue("groupCount"); + }, set: function(u) { + this.setPropertyValue("groupCount", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "timezoneOffset", { get: function() { + return this.getPropertyValue("timezoneOffset"); + }, set: function(u) { + this.setPropertyValue("timezoneOffset", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "timezone", { get: function() { + return this.getPropertyValue("timezone"); + }, set: function(u) { + this.setPropertyValue("timezone", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "gridInterval", { get: function() { + return this._gridInterval; + }, enumerable: !0, configurable: !0 }), R.prototype.makeGap = function(u, w) { + var $ = u.component; + if (u && w && !$.connect && le($.autoGapCount) && $.baseAxis == this) { + var G = u.dates["date" + this.axisLetter], K = w.dates["date" + this.axisLetter]; + if (G && K && G.getTime() - K.getTime() > $.autoGapCount * this.baseDuration) + return !0; + } + return !1; + }, Object.defineProperty(R.prototype, "baseValue", { get: function() { + return this.min; + }, enumerable: !0, configurable: !0 }), R; + }(vo); + hi.registeredClasses.DateAxis = Ju, hi.registeredClasses.DateAxisDataItem = RH; + var yd = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "AxisRendererX", u.minGridDistance = 120, u.opposite = !1, u.rotation = 0, u.width = ce(100), u.labels.template.horizontalCenter = "middle", u.applyTheme(), u; + } + return re(R, U), R.prototype.setAxis = function(u) { + U.prototype.setAxis.call(this, u), u.layout = "vertical"; + }, R.prototype.updateGridContainer = function() { + var u = this.axis; + if (u) { + var w = this.gridContainer; + w.x = u.pixelX, w.width = u.axisLength; + } + }, R.prototype.processRenderer = function() { + U.prototype.processRenderer.call(this); + var u = this.axis; + if (u) { + u.width instanceof J || (u.width = ce(100)), this.line; + var w = u.title; + w.rotation = 0, w.align = "center", this.opposite ? (this.line.toFront(), w.toBack()) : (w.toFront(), this.toBack(), this.line.toBack()); + } + }, R.prototype.updateTooltip = function() { + if (this.axis) { + var u = 1e3, w = this.line.pixelX, $ = this.line.pixelY, G = this.axisLength, K = u; + this.opposite ? this.inside || ($ = -1e3, K = u) : this.inside && ($ = -1e3, K = u), this.axis.updateTooltip("vertical", { x: w, y: $, width: G, height: K }); + } + }, R.prototype.updateLabelElement = function(u, w, $, G) { + Ee(G) || (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w); + u.isMeasured = !u.inside; + var ne, ue = 0, we = this.gridContainer.maxHeight; + this.opposite ? (u.inside ? (ne = "top", u.valign == "bottom" && (ue = we, ne = "bottom"), u.valign == "middle" && (ue = we / 2, ne = "middle")) : ne = "bottom", K.y = ue) : (u.inside ? (ne = "bottom", u.valign == "top" && (ue = -we, ne = "top"), u.valign == "middle" && (ue = -we / 2, ne = "middle")) : ne = "top", K.y += ue), u.rotation == 0 && (u.verticalCenter = ne), this.positionItem(u, K), this.toggleVisibility(u, w, this.minLabelPosition, this.maxLabelPosition); + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + var u = this.axis; + return u.measuredWidth - u.pixelPaddingRight - u.pixelPaddingLeft || 0; + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u, w) { + return { x: this.positionToCoordinate(u), y: 0 }; + }, R.prototype.pointToPosition = function(u) { + return this.coordinateToPosition(u.x, u.y); + }, R.prototype.getPositionRangePath = function(u, w) { + var $ = mt(this.positionToCoordinate(u), 0, this.axisLength), G = mt(this.positionToCoordinate(w), 0, this.axisLength), K = Math.abs(G - $), ne = this.getHeight(); + return n2({ x: Math.min($, G), y: 0, width: K, height: ne }, !0); + }, R.prototype.updateBreakElement = function(u) { + U.prototype.updateBreakElement.call(this, u); + var w = u.startLine, $ = u.endLine, G = u.fillShape, K = u.startPoint, ne = u.endPoint, ue = u.pixelMarginLeft, we = this.getHeight() - u.pixelMarginTop - u.pixelMarginBottom; + K.x = mt(K.x, -1, this.axisLength + 1), ne.x = mt(ne.x, -1, this.axisLength + 1), K.x == ne.x && (K.x < 0 || K.x > this.axisLength) ? u.fillShape.__disabled = !0 : u.fillShape.__disabled = !1, w.y = ue, w.width = 0, w.height = we, $.y = ue, $.width = 0, $.height = we, G.height = we, G.width = Math.abs(ne.x - K.x), G.y = ue, G.x = K.x; + }, R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + u.path = pn({ x: 0, y: 0 }) + xr({ x: 0, y: this.getHeight() }), this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateTickElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w), K = u.length; + G.y = up({ x: 0, y: this.line.pixelY }, this.line.parent, this.gridContainer).y, this.opposite ? K *= u.inside ? 1 : -1 : K *= u.inside ? -1 : 1, u.path = pn({ x: 0, y: 0 }) + xr({ x: 0, y: K }), this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateAxisLine = function() { + this.line.path = pn({ x: 0, y: 0 }) + xr({ x: this.axisLength, y: 0 }); + }, R.prototype.updateBaseGridElement = function() { + U.prototype.updateBaseGridElement.call(this); + var u = this.axis, w = this.getHeight(), $ = this.axisLength, G = this.baseGrid, K = u.basePoint.x; + if (K < -0.2 || K > $ + 0.2) + G.hide(0); + else { + var ne = up({ x: 0, y: 0 }, this.gridContainer, G.parent).y; + G.path = pn({ x: 0, y: 0 }) + xr({ x: 0, y: w }), G.moveTo({ x: K, y: ne }), G.show(0); + } + }, R.prototype.createBreakSprites = function(u) { + u.startLine = new Ar(), u.endLine = new Ar(); + var w = new xL(); + w.setWavedSides(!1, !0, !1, !0), u.fillShape = w; + }, R.prototype.toAxisPosition = function(u) { + var w = u, $ = this.axis; + if ($) { + var G = $.relativePositionSprite, K = $.pixelX; + if (G ? K = up({ x: this.pixelX, y: 0 }, this.parent, G).x : G = $.parent, G) + return (w - K / G.innerWidth) / ($.axisLength / G.innerWidth); + } + return u; + }, R.prototype.updateBullet = function(u, w, $) { + var G = 0.5; + u instanceof nR && (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w); + K.y = up({ x: 0, y: this.line.pixelY }, this.line.parent, this.gridContainer).y, this.positionItem(u, K), this.toggleVisibility(u, w, 0, 1); + }, R; + }(RL); + hi.registeredClasses.AxisRendererX = yd, Wd.push({ relevant: gf.heightXS, state: function(U, R) { + if (U instanceof yd) { + var u = U.states.create(R); + return u.properties.inside = !0, u.properties.maxLabelPosition = 0.9, u.properties.minLabelPosition = 0.1, u; + } + return null; + } }), Wd.push({ relevant: gf.heightXXS, state: function(U, R) { + if (U instanceof yd) { + var u = U.states.create(R); + return u.properties.disabled = !0, u; + } + return null; + } }); + var MH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "CategoryAxisBreak", u.properties.startLocation = 0.5, u.properties.endLocation = 0.5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "startPosition", { get: function() { + if (this.axis) + return this.axis.indexToPosition(this.adjustedStartValue, this.startLocation); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endPosition", { get: function() { + if (this.axis) + return this.axis.indexToPosition(this.adjustedEndValue, this.endLocation); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startCategory", { get: function() { + return this.getPropertyValue("startCategory"); + }, set: function(u) { + this.setPropertyValue("startCategory", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endCategory", { get: function() { + return this.getPropertyValue("endCategory"); + }, set: function(u) { + this.setPropertyValue("endCategory", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startValue", { get: function() { + var u = this.getPropertyValue("startCategory"); + return u ? this.axis.categoryToIndex(u) : this.getPropertyValue("startValue"); + }, set: function(u) { + this.setPropertyValue("startValue", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endValue", { get: function() { + var u = this.getPropertyValue("endCategory"); + return u ? this.axis.categoryToIndex(u) : this.getPropertyValue("endValue"); + }, set: function(u) { + this.setPropertyValue("endValue", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startLocation", { get: function() { + return this.getPropertyValue("startLocation"); + }, set: function(u) { + this.setPropertyValue("startLocation", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endLocation", { get: function() { + return this.getPropertyValue("endLocation"); + }, set: function(u) { + this.setPropertyValue("endLocation", u) && this.axis && (this.axis.invalidateDataItems(), this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), R; + }(PL); + hi.registeredClasses.CategoryAxisBreak = MH; + var Jb = function(U) { + function R() { + var u = U.call(this) || this; + return u.seriesDataItems = {}, u.className = "CategoryAxisDataItem", u.text = "{category}", u.locations.category = 0, u.locations.endCategory = 1, u.deltaPosition = 0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "category", { get: function() { + return this._adapterO && this._adapterO.isEnabled("category") ? this._adapterO.apply("category", this.properties.category) : this.properties.category; + }, set: function(u) { + var w = this.properties.category; + this.setProperty("category", u), Ee(w) && w != u && this.component && this.component.validateDataElement(this); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endCategory", { get: function() { + return this.properties.endCategory; + }, set: function(u) { + this.setProperty("endCategory", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "deltaPosition", { get: function() { + return this.properties.deltaCoordinate; + }, set: function(u) { + u != this.properties.deltaCoordinate && (this.setProperty("deltaCoordinate", u), this.component && (this.component.invalidateDataItems(), this.component.invalidateSeries())); + }, enumerable: !0, configurable: !0 }), R; + }(a2), Eh = function(U) { + function R() { + var u = U.call(this) || this; + u.dataItemsByCategory = new ha(), u.className = "CategoryAxis", u.axisFieldName = "category", u._lastDataItem = u.createDataItem(), u._lastDataItem.component = u, u._disposers.push(u._lastDataItem), u.applyTheme(); + var w = u.dataItemsByCategory; + return u.addDisposer(u.mainDataSet.events.on("removed", function($) { + w.removeKey($.oldValue.category); + })), u; + } + return re(R, U), R.prototype.createDataItem = function() { + return new Jb(); + }, R.prototype.createAxisBreak = function() { + return new MH(); + }, R.prototype.processSeriesDataItem = function(u, w) { + U.prototype.processSeriesDataItem.call(this, u, w); + var $ = u["category" + this.axisLetter]; + if (Ee($)) { + var G = this.dataItemsByCategory.getKey($); + if (G) { + var K = u.component.uid, ne = G.seriesDataItems[K]; + ne || (ne = [], G.seriesDataItems[K] = ne), ne.push(u); + } + } else + u.component.dataItems.remove(u); + }, R.prototype.validateDataRange = function() { + var u = this; + U.prototype.validateDataRange.call(this), er(this._series.iterator(), function(w) { + if (w.xAxis instanceof R && w.yAxis instanceof R) + w.invalidateDataRange(); + else { + var $ = u.positionToIndex(u.start), G = u.positionToIndex(u.end); + G >= u.dataItems.length && G--; + for (var K = w.uid, ne = void 0, ue = void 0, we = $; we <= G; we++) { + var De = u.dataItems.getIndex(we); + if (De) { + var $e = De.seriesDataItems[K]; + if ($e) + for (var Ke = 0; Ke < $e.length; Ke++) { + var Ze = $e[Ke]; + if (Ze) { + var pt = Ze.index; + (!le(ne) || pt < ne) && (ne = pt), (!le(ue) || pt > ue) && (ue = pt); + } + } + } + } + le(ne) ? w.startIndex = ne : w.start = u.start, le(ue) ? w.endIndex = ue + 1 : w.end = u.end, u._axisBreaks && u._axisBreaks.length > 0 && w.invalidateDataRange(); + } + }); + }, R.prototype.validate = function() { + var u = this; + U.prototype.validate.call(this); + var w = this.dataItems.length, $ = mt(Math.floor(this.start * w - 1), 0, w), G = mt(Math.ceil(this.end * w), 0, w); + this.renderer.invalid && this.renderer.validate(); + var K = this.renderer.axisLength / Math.max(this.renderer.minGridDistance, 1 / Number.MAX_SAFE_INTEGER), ne = Math.min(this.dataItems.length, Math.ceil((G - $) / K)); + if (this._startIndex = Math.floor($ / ne) * ne, this._endIndex = Math.ceil(this.end * w), this.fixAxisBreaks(), this._startIndex == this._endIndex && this._endIndex++, this._frequency = ne, !(this.axisLength <= 0)) { + this.maxZoomFactor = this.dataItems.length, this.dataItems.length <= 0 && (this.maxZoomFactor = 1), this.resetIterators(), $ = ve(0, this._startIndex - this._frequency), G = H(this.dataItems.length, this._endIndex + this._frequency); + for (var ue = 0, we = 0; we < $; we++) + ($e = this.dataItems.getIndex(we)).__disabled = !0; + we = G; + for (var De = this.dataItems.length; we < De; we++) + ($e = this.dataItems.getIndex(we)).__disabled = !0; + for (we = $; we < G; we++) + if (we < this.dataItems.length) { + var $e = this.dataItems.getIndex(we); + we / this._frequency == Math.round(we / this._frequency) ? (this.isInBreak(we) || (this.appendDataItem($e), this.validateDataElement($e, ue)), ue++) : $e.__disabled = !0; + } + this.appendDataItem(this._lastDataItem), this.validateDataElement(this._lastDataItem, ue + 1, this.dataItems.length), this._axisBreaks && this._axisBreaks.each(function(Ke) { + var Ze = Ke.adjustedStartValue, pt = Ke.adjustedEndValue; + if (b({ start: Ze, end: pt }, { start: u._startIndex, end: u._endIndex })) { + for (var Vt = Ze; Vt <= pt; Vt++) + (ai = u.dataItems.getIndex(Vt)).__disabled = !0; + var Yt = mt(Math.ceil(u._frequency / Ke.breakSize), 1, pt - Ze), ci = 0; + if (Ke.breakSize > 0) + for (Vt = Ze; Vt <= pt; Vt += Yt) { + var ai; + (ai = u.dataItems.getIndex(Vt)).__disabled = !1, u.appendDataItem(ai), u.validateDataElement(ai, ci), ci++; + } + } + }), this.validateBreaks(), this.validateAxisRanges(), this.ghostLabel.invalidate(), this.renderer.invalidateLayout(); + } + }, R.prototype.validateDataElement = function(u, w, $) { + U.prototype.validateDataElement.call(this, u), u.itemIndex = this._axisItemCount, this._axisItemCount++; + var G = this.renderer; + le($) || ($ = this.categoryToIndex(u.category)); + var K = this.categoryToIndex(u.endCategory); + le(K) || (K = $); + var ne, ue, we, De = this.indexToPosition($, u.locations.category), $e = this.indexToPosition(K, u.locations.endCategory); + u.position = De, u.isRange && (ne = K, ue = this.indexToPosition($, u.locations.category), we = this.indexToPosition(ne, u.locations.endCategory)), u.point = G.positionToPoint(De); + var Ke = u.tick; + Ke && !Ke.disabled && G.updateTickElement(Ke, De, $e); + var Ze = u.grid; + Ze && !Ze.disabled && G.updateGridElement(Ze, De, $e); + var pt = u.label; + pt && !pt.disabled && (u.isRange && pt.text != null || (u.text = u.text), G.updateLabelElement(pt, De, $e), (G instanceof Zv && u.label.measuredWidth > this.ghostLabel.measuredWidth || G instanceof yd && u.label.measuredHeight > this.ghostLabel.measuredHeight) && (u.label.html ? this.ghostLabel.html = u.label.currentText : this.ghostLabel.text = u.label.currentText)); + var Vt = u.axisFill; + Vt && !Vt.disabled && (u.isRange || (ne = $ + this._frequency, ue = this.indexToPosition($, Vt.location), we = this.indexToPosition(ne, Vt.location)), G.updateFillElement(Vt, ue, we), u.isRange || this.fillRule(u, w)), u.bullet && G.updateBullet(u.bullet, De, $e); + var Yt = u.mask; + Yt && G.updateFillElement(Yt, ue, we); + }, R.prototype.disposeData = function() { + this.dataItemsByCategory.clear(), U.prototype.disposeData.call(this); + }, R.prototype.processDataItem = function(u, w) { + u && (U.prototype.processDataItem.call(this, u, w), Ee(u.category) && this.dataItemsByCategory.setKey(u.category, u)); + }, R.prototype.getDataItem = function(u) { + var w = u[this.dataFields.category]; + if (Ee(w)) + return this.dataItemsByCategory.getKey(w) || this.dataItems.create(); + }, R.prototype.indexToPosition = function(u, w) { + le(w) || (w = 0.5); + var $ = this.startIndex, G = this.endIndex, K = this.adjustDifference($, G), ne = this.startLocation; + K -= ne, K -= 1 - this.endLocation, this._axisBreaks && Zr(this._axisBreaks.iterator(), function(De) { + var $e = De.adjustedStartValue, Ke = De.adjustedEndValue; + if (u < $ || !le($e) || !le(Ke)) + return !1; + if (b({ start: $e, end: Ke }, { start: $, end: G })) { + $e = Math.max($, $e), Ke = Math.min(G, Ke); + var Ze = De.breakSize; + u > Ke ? $ += (Ke - $e) * (1 - Ze) : u < $e || (u = $e + (u - $e) * Ze); + } + return !0; + }); + var ue = 0, we = this.dataItems.getIndex(u); + return we && (ue = we.deltaPosition), He(ue + (u + w - ne - $) / K, 5); + }, R.prototype.categoryToPosition = function(u, w) { + var $ = this.categoryToIndex(u); + return this.indexToPosition($, w); + }, R.prototype.categoryToPoint = function(u, w) { + var $ = this.categoryToPosition(u, w), G = this.renderer.positionToPoint($), K = this.renderer.positionToAngle($); + return { x: G.x, y: G.y, angle: K }; + }, R.prototype.anyToPoint = function(u, w) { + return this.categoryToPoint(u, w); + }, R.prototype.anyToPosition = function(u, w) { + return this.categoryToPosition(u, w); + }, R.prototype.categoryToIndex = function(u) { + if (Ee(u)) { + var w = this.dataItemsByCategory.getKey(u); + if (w) + return w.index; + } + }, R.prototype.zoomToCategories = function(u, w) { + this.zoomToIndexes(this.categoryToIndex(u), this.categoryToIndex(w) + 1); + }, R.prototype.getAnyRangePath = function(u, w, $, G) { + var K = this.categoryToPosition(u, $), ne = this.categoryToPosition(w, G); + return this.getPositionRangePath(K, ne); + }, R.prototype.roundPosition = function(u, w) { + var $ = this.positionToIndex(u); + return this.indexToPosition($, w); + }, R.prototype.getFirstSeriesDataItem = function(u, w) { + for (var $ = 0; $ < u.dataItems.length; $++) { + var G = u.dataItems.getIndex($); + if (u.xAxis == this && G.categoryX == w || u.yAxis == this && G.categoryY == w) + return G; + } + }, R.prototype.getLastSeriesDataItem = function(u, w) { + for (var $ = u.dataItems.length - 1; $ >= 0; $--) { + var G = u.dataItems.getIndex($); + if (u.xAxis == this && G.categoryX == w || u.yAxis == this && G.categoryY == w) + return G; + } + }, R.prototype.getSeriesDataItemByCategory = function(u, w) { + var $, G = this; + return w.dataItems.each(function(K) { + w.xAxis == G ? K.categoryX == u && ($ = K) : w.yAxis == G && K.categoryY == u && ($ = K); + }), $; + }, R.prototype.getSeriesDataItem = function(u, w, $) { + var G = this; + if (le(w)) { + var K = this.positionToIndex(w); + K >= this.dataItems.length && K--; + var ne = this.dataItems.getIndex(K); + if (ne) { + var ue, we = ne.category, De = u.dataItems.getIndex(K); + return De && (u.xAxis == this && De.categoryX == we || u.yAxis == this && De.categoryY == we) ? De : (u.dataItems.each(function($e) { + u.xAxis == G && $e.categoryX == we && (ue || (ue = $e), Math.abs(K - ue.index) > Math.abs(K - $e.index) && (ue = $e)), u.yAxis == G && $e.categoryY == we && (ue || (ue = $e), Math.abs(K - ue.index) > Math.abs(K - $e.index) && (ue = $e)); + }), ue); + } + } + }, R.prototype.getX = function(u, w, $, G, K) { + var ne = this.getPositionX(u, w, $, G, K); + return Pe(ne) ? this.basePoint.x : this.renderer.positionToPoint(ne).x; + }, R.prototype.getPositionX = function(u, w, $, G, K) { + var ne; + return Ee(w) && (ne = this.categoryToPosition(u.categories[w], $)), K && (ne = mt(ne, K.start, K.end)), ne; + }, R.prototype.getY = function(u, w, $, G, K) { + var ne = this.getPositionY(u, w, $, G, K); + return Pe(ne) ? this.basePoint.y : this.renderer.positionToPoint(ne).y; + }, R.prototype.getPositionY = function(u, w, $, G, K) { + var ne; + return Ee(w) && (ne = this.categoryToPosition(u.categories[w], $)), K && (ne = mt(ne, K.start, K.end)), ne; + }, R.prototype.getAngle = function(u, w, $, G, K) { + var ne = this.categoryToPosition(u.categories[w], $); + return K && (ne = mt(ne, K.start, K.end)), this.positionToAngle(ne); + }, R.prototype.getCellStartPosition = function(u) { + return this.roundPosition(u, 0); + }, R.prototype.getCellEndPosition = function(u) { + return this.roundPosition(u, 1); + }, R.prototype.getTooltipText = function(u) { + var w = this.dataItems.getIndex(this.positionToIndex(u)); + if (w) + return this.tooltipDataItem = w, this.tooltip.dataItem = w, this.tooltipText ? this.tooltipText : this._adapterO ? this._adapterO.apply("getTooltipText", w.category) : w.category; + }, R.prototype.positionToIndex = function(u) { + (u = He(u, 10)) < 0 && (u = 0), u > 1 && (u = 1); + var w = this.startIndex, $ = this.endIndex, G = $ - w - this.startLocation - (1 - this.endLocation); + u += 1 / G * this.startLocation; + var K = null; + return this._axisBreaks && Zr(this._axisBreaks.iterator(), function(ne) { + var ue = ne.startPosition, we = ne.endPosition, De = ne.adjustedStartValue, $e = ne.adjustedEndValue; + De = ve(De, w), $e = H($e, $); + var Ke = ne.breakSize; + if (G -= ($e - De) * (1 - Ke), u > we) + w += ($e - De) * (1 - Ke); + else if (!(u < ue)) { + var Ze = (u - ue) / (we - ue); + return K = De + Math.round(Ze * ($e - De)), !1; + } + return !0; + }), le(K) || (K = Math.floor(u * G + w)), K >= this.dataItems.length && (K = this.dataItems.length - 1), K; + }, R.prototype.positionToCategory = function(u) { + return this.getPositionLabel(u); + }, R.prototype.getPositionLabel = function(u) { + var w = this.dataItems.getIndex(this.positionToIndex(u)); + if (w) + return w.category; + }, Object.defineProperty(R.prototype, "basePoint", { get: function() { + return this.renderer.positionToPoint(1); + }, enumerable: !0, configurable: !0 }), R.prototype.initRenderer = function() { + U.prototype.initRenderer.call(this), this.renderer.baseGrid.disabled = !0; + }, Object.defineProperty(R.prototype, "frequency", { get: function() { + return this._frequency; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sortBySeries", { get: function() { + return this.getPropertyValue("sortBySeries"); + }, set: function(u) { + this.setPropertyValue("sortBySeries", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + u && Ee(u.sortBySeries) && st(u.sortBySeries) && (this.map.hasKey(u.sortBySeries) ? u.sortBySeries = this.map.getKey(u.sortBySeries) : (this.addDelayedMap("sortBySeries", u.sortBySeries), delete u.sortBySeries)), U.prototype.processConfig.call(this, u); + }, R; + }(OL); + hi.registeredClasses.CategoryAxis = Eh, hi.registeredClasses.CategoryAxisDataItem = Jb; + var Dm = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "XYSeriesDataItem", u.values.customValue = {}, u.values.valueX = { stack: 0 }, u.values.valueY = { stack: 0 }, u.values.openValueX = {}, u.values.openValueY = {}, u.values.dateX = {}, u.values.dateY = {}, u.values.openDateX = {}, u.values.openDateY = {}, u.setLocation("dateX", 0.5, 0), u.setLocation("dateY", 0.5, 0), u.setLocation("categoryX", 0.5, 0), u.setLocation("categoryY", 0.5, 0), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "valueX", { get: function() { + return this.values.valueX.value; + }, set: function(u) { + this.setValue("valueX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "customValue", { get: function() { + return this.values.customValue.value; + }, set: function(u) { + this.setValue("customValue", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "valueY", { get: function() { + return this.values.valueY.value; + }, set: function(u) { + this.setValue("valueY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateX", { get: function() { + return this.getDate("dateX"); + }, set: function(u) { + this.setDate("dateX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dateY", { get: function() { + return this.getDate("dateY"); + }, set: function(u) { + this.setDate("dateY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "categoryX", { get: function() { + return this.categories.categoryX; + }, set: function(u) { + this.setCategory("categoryX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "categoryY", { get: function() { + return this.categories.categoryY; + }, set: function(u) { + this.setCategory("categoryY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openValueX", { get: function() { + return this.values.openValueX.value; + }, set: function(u) { + this.setValue("openValueX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openValueY", { get: function() { + return this.values.openValueY.value; + }, set: function(u) { + this.setValue("openValueY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openDateX", { get: function() { + return this.getDate("openDateX"); + }, set: function(u) { + this.setDate("openDateX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openDateY", { get: function() { + return this.getDate("openDateY"); + }, set: function(u) { + this.setDate("openDateY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openCategoryX", { get: function() { + return this.categories.openCategoryX; + }, set: function(u) { + this.setCategory("openCategoryX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "openCategoryY", { get: function() { + return this.categories.openCategoryY; + }, set: function(u) { + this.setCategory("openCategoryY", u); + }, enumerable: !0, configurable: !0 }), R.prototype.getMin = function(u, w, $) { + var G, K = this; + return le($) || ($ = 0), _i(u, function(ne) { + var ue; + ue = w ? K.getWorkingValue(ne) : K.getValue(ne), ((ue += $) < G || !le(G)) && (G = ue); + }), G; + }, R.prototype.getMax = function(u, w, $) { + var G, K = this; + return le($) || ($ = 0), _i(u, function(ne) { + var ue; + ue = w ? K.getWorkingValue(ne) : K.getValue(ne), ((ue += $) > G || !le(G)) && (G = ue); + }), G; + }, R; + }(IL), BC = function(U) { + function R() { + var u = U.call(this) || this; + return u.groupFields = {}, u._xAxis = new Un(), u._yAxis = new Un(), u._xValueFields = [], u._yValueFields = [], u._baseInterval = {}, u.dataGrouped = !1, u.usesShowFields = !1, u._dataSetChanged = !1, u._maxxX = 1e5, u._maxxY = 1e5, u._propertiesChanged = !1, u.outOfRange = !1, u.className = "XYSeries", u.isMeasured = !1, u.groupFields.valueX = "close", u.groupFields.valueY = "close", u.groupFields.customValue = "close", u.groupFields.openValueX = "open", u.groupFields.openValueY = "open", u.cursorTooltipEnabled = !0, u.cursorHoverEnabled = !0, u.excludeFromTotal = !1, u.mainContainer.mask = new so(), u.mainContainer.mask.setElement(u.paper.add("path")), u.stacked = !1, u.snapTooltip = !1, u._showBullets = !1, u.tooltip.pointerOrientation = "horizontal", u.properties.stackToNegative = !0, u.hideTooltipWhileZooming = !0, u.setPropertyValue("maskBullets", !0), u.tooltip.events.on("hidden", function() { + u.returnBulletDefaultState(); + }, void 0, !1), u._disposers.push(u._xAxis), u._disposers.push(u._yAxis), u.observe(lc, function() { + u.inited && (u._propertiesChanged = !0, u.legendDataItem && (u.legendDataItem.childrenCreated = !1), u.chart && u.chart.legend && u.chart.legend.invalidateDataItems(), u.invalidate()); + }, void 0, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("X/Y Series")); + }, R.prototype.createDataItem = function() { + return new Dm(); + }, R.prototype.resetExtremes = function() { + this._tmin.clear(), this._tmax.clear(), this._smin.clear(), this._smax.clear(); + }, R.prototype.dataChangeUpdate = function() { + this.dataGrouped = !1, this._baseInterval = {}, this._currentDataSetId = "", this.resetExtremes(), this.xAxis && this.xAxis.seriesDataChangeUpdate(this), this.yAxis && this.yAxis.seriesDataChangeUpdate(this); + }, R.prototype.validateData = function() { + this._baseInterval = {}; + var u = this.dataFields; + if (u.valueYShow || u.openValueXShow || u.openValueXShow || u.openValueYShow ? this.usesShowFields = !0 : this.usesShowFields = !1, this.defineFields(), this.data.length > 0 && this.dataChangeUpdate(), U.prototype.validateData.call(this), this.updateItemReaderText(), this.chart && (!Ee(this.dataFields[this._xField]) || !Ee(this.dataFields[this._yField]))) + throw Error('Data fields for series "' + (this.name ? this.name : this.uid) + '" are not properly defined.'); + this.inited && this.isHidden && this.hide(0), this.dataGrouped = !1; + }, R.prototype.processDataItem = function(u, w) { + try { + U.prototype.processDataItem.call(this, u, w), this.xAxis.processSeriesDataItem(u, "X"), this.yAxis.processSeriesDataItem(u, "Y"), this.setInitialWorkingValues(u); + } catch ($) { + this._chart && this._chart.raiseCriticalError($); + } + }, R.prototype.updateDataItem = function(u) { + U.prototype.updateDataItem.call(this, u), this.xAxis.processSeriesDataItem(u, "X"), this.yAxis.processSeriesDataItem(u, "Y"); + }, R.prototype.setInitialWorkingValues = function(u) { + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this); + var u = this.xAxis, w = this.yAxis; + if (u) { + var $ = this.dataItemsByAxis.getKey(u.uid); + $ && $.clear(), u instanceof Eh && this.clearCatAxis(u); + } + if (w) { + var G = this.dataItemsByAxis.getKey(w.uid); + G && G.clear(), w instanceof Eh && this.clearCatAxis(w); + } + }, R.prototype.clearCatAxis = function(u) { + var w = this.uid; + u.dataItems.each(function($) { + $.seriesDataItems[w] && ($.seriesDataItems[w] = []); + }); + }, R.prototype.defineFields = function() { + var u = this.xAxis, w = this.yAxis; + if (u && w) { + var $ = u.axisFieldName, G = $ + "X", K = "open" + Xu($) + "X", ne = w.axisFieldName, ue = ne + "Y", we = "open" + Xu(ne) + "Y"; + this._xField = G, this._yField = ue, this.dataFields[K] && (this._xOpenField = K), this.dataFields[we] && (this._yOpenField = we), this.dataFields[we] || this.baseAxis != w || (this._yOpenField = ue), this.dataFields[K] || this.baseAxis != u || (this._xOpenField = G), this.stacked && this.baseAxis == u && (this._xOpenField = G), this.stacked && this.baseAxis == w && (this._yOpenField = ue), u instanceof Eh && w instanceof Eh && (this._yOpenField || (this._yOpenField = ue)), this._xValueFields = [], this._yValueFields = [], this.addValueField(u, this._xValueFields, this._xField), this.addValueField(u, this._xValueFields, this._xOpenField), this.addValueField(w, this._yValueFields, this._yField), this.addValueField(w, this._yValueFields, this._yOpenField); + } + }, R.prototype.addValueField = function(u, w, $) { + u instanceof vo && Ee(this.dataFields[$]) && w.indexOf($) == -1 && w.push($); + }, R.prototype.setCategoryAxisField = function(u, w) { + Ee(this.dataFields[u]) || (this.dataFields[u] = w.dataFields.category); + }, R.prototype.setDateAxisField = function(u, w) { + Ee(this.dataFields[u]) || (this.dataFields[u] = w.dataFields.date); + }, R.prototype.afterDraw = function() { + U.prototype.afterDraw.call(this), this.createMask(); + }, R.prototype.createMask = function() { + if (this.mainContainer.mask) { + var u = this.getMaskPath(); + er(this.axisRanges.iterator(), function(w) { + w.axisFill.fillPath && (w.axisFill.validate(), u += w.axisFill.fillPath); + }), this.mainContainer.mask.path = u; + } + }, R.prototype.getMaskPath = function() { + return this.xAxis && this.yAxis ? n2({ x: 0, y: 0, width: this.xAxis.axisLength, height: this.yAxis.axisLength }) : ""; + }, R.prototype.getAxisField = function(u) { + return u == this.xAxis ? this.xField : u == this.yAxis ? this.yField : void 0; + }, R.prototype.validateDataItems = function() { + var u = this.chart; + u && (this._maxxX = ve(1e5, 2 * u.plotContainer.maxWidth), this._maxxY = ve(1e5, 2 * u.plotContainer.maxHeight)); + var w = this.xAxis, $ = this.yAxis; + w && $ && (w.updateAxisBySeries(), $.updateAxisBySeries()), U.prototype.validateDataItems.call(this), w && $ && (w.postProcessSeriesDataItems(this), $.postProcessSeriesDataItems(this)); + }, R.prototype.validateDataRange = function() { + var u = this.xAxis, w = this.yAxis; + u && w && (u.dataRangeInvalid && u.validateDataRange(), w.dataRangeInvalid && w.validateDataRange()), U.prototype.validateDataRange.call(this); + }, R.prototype.validate = function() { + var u = this.xAxis, w = this.yAxis; + if (u && w) { + u.invalid && u.validate(), w.invalid && w.validate(), this.y = w.pixelY, this.x = u.pixelX, this._showBullets = !0; + var $ = this.minBulletDistance; + le($) && this.baseAxis.axisLength / (this.endIndex - this.startIndex) < $ && (this._showBullets = !1); + } + if (this.updateTooltip(), !(u instanceof Ju && u.groupData && !this.dataGrouped || w instanceof Ju && w.groupData && !this.dataGrouped)) { + U.prototype.validate.call(this); + var G = this.chart, K = this.maskBullets; + G && K && G.className == "XYChart" && (G.leftAxesContainer.layout != "vertical" && G.rightAxesContainer.layout != "vertical" || (this.yAxis ? this.bulletsContainer.mask = this.yAxis.renderer.gridContainer : this.bulletsContainer.mask = void 0), G.topAxesContainer.layout != "horizontal" && G.bottomAxesContainer.layout != "horizontal" || (this.xAxis ? this.bulletsContainer.mask = this.xAxis.renderer.gridContainer : this.bulletsContainer.mask = void 0)); + } + }, Object.defineProperty(R.prototype, "xAxis", { get: function() { + if (this.chart) { + if (!this._xAxis.get()) { + var u = this.chart.xAxes.getIndex(0); + if (!u) + throw Error("There are no X axes on chart."); + this.xAxis = u; + } + return this._xAxis.get(); + } + }, set: function(u) { + this.setXAxis(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setXAxis = function(u) { + var w = this._xAxis.get(); + w != u && (w && (this.dataItemsByAxis.removeKey(w.uid), this._xAxis.dispose(), w.series.removeValue(this)), this._xAxis.set(u, u.registerSeries(this)), this.dataItemsByAxis.setKey(u.uid, new ha()), this.invalidateData()); + }, Object.defineProperty(R.prototype, "yAxis", { get: function() { + if (this.chart) { + if (!this._yAxis.get()) { + var u = this.chart.yAxes.getIndex(0); + if (!u) + throw Error("There are no Y axes on chart."); + this.yAxis = u; + } + return this._yAxis.get(); + } + }, set: function(u) { + this.setYAxis(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setYAxis = function(u) { + var w = this._yAxis.get(); + w != u && (w && (this.dataItemsByAxis.removeKey(w.uid), this._yAxis.dispose(), w.series.removeValue(this)), this._yAxis.set(u, u.registerSeries(this)), u.chart instanceof Hy && u.chart.handleYAxisSet(this), this.dataItemsByAxis.setKey(u.uid, new ha()), this.invalidateData()); + }, Object.defineProperty(R.prototype, "baseAxis", { get: function() { + var u = this.xAxis, w = this.yAxis; + return !this._baseAxis && u && w && (w instanceof Ju && (this._baseAxis = w), u instanceof Ju && (this._baseAxis = u), w instanceof Eh && (this._baseAxis = w), u instanceof Eh && (this._baseAxis = u), this._baseAxis || (this._baseAxis = u)), this._baseAxis; + }, set: function(u) { + this._baseAxis != u && (this._baseAxis = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), R.prototype.addData = function(u, w, $) { + U.prototype.addData.call(this, u, w, $), this.scrollbarSeries && (this.scrollbarSeries.addData(u, w, !0), this.scrollbarSeries._parseDataFrom = this._parseDataFrom); + }, R.prototype.setData = function(u) { + U.prototype.setData.call(this, u), this.scrollbarSeries && this.scrollbarSeries.setData(u); + }, R.prototype.setDataSet = function(u) { + var w = U.prototype.setDataSet.call(this, u); + if (w) { + this._dataSetChanged = !0; + var $ = this.dataItems; + if (this.resetExtremes(), $ && $.length > 0) { + var G = this.xAxis, K = this.yAxis; + this._prevStartIndex = void 0, this._prevEndIndex = void 0, this._startIndex = void 0, this._endIndex = void 0, this.appeared || this.processValues(!1), G instanceof Ju && G == this.baseAxis && (this._tmin.setKey(G.uid, $.getIndex(0).dateX.getTime()), this._tmax.setKey(G.uid, $.getIndex($.length - 1).dateX.getTime()), this.dispatch("extremeschanged")), K instanceof Ju && K == this.baseAxis && (this._tmin.setKey(K.uid, $.getIndex(0).dateY.getTime()), this._tmax.setKey(K.uid, $.getIndex($.length - 1).dateY.getTime()), this.dispatch("extremeschanged")); + } + } + return w; + }, R.prototype.processValues = function(u) { + U.prototype.processValues.call(this, u); + var w = this.xAxis, $ = this.yAxis; + if (w && $) { + var G = this.dataItems, K = 1 / 0, ne = -1 / 0, ue = 1 / 0, we = -1 / 0, De = this.startIndex, $e = this.endIndex, Ke = De, Ze = $e; + u || (De = 0, $e = this.dataItems.length); + for (var pt = De; pt < $e; pt++) { + var Vt = G.getIndex(pt); + this.getStackValue(Vt, u); + var Yt = Vt.getValue("valueX", "stack"), ci = Vt.getValue("valueY", "stack"); + K = H(Vt.getMin(this._xValueFields, u, Yt), K), ue = H(Vt.getMin(this._yValueFields, u, ci), ue), ne = ve(Vt.getMax(this._xValueFields, u, Yt), ne), we = ve(Vt.getMax(this._yValueFields, u, ci), we), this.stacked && (this.baseAxis == w && (ci < ue && (ue = ci), ci > we && (we = ci)), this.baseAxis == $ && (Yt < K && (K = Yt), Yt > ne && (ne = Yt))); + } + w.processSeriesDataItems(), $.processSeriesDataItems(); + var ai = w.uid, Gi = $.uid; + if (this.xAxis instanceof vo && (K == 1 / 0 || ne == -1 / 0)) + return this._smin.setKey(ai, void 0), this._smax.setKey(ai, void 0), void this.dispatchImmediately("selectionextremeschanged"); + if (this.yAxis instanceof vo && (ue == 1 / 0 || we == -1 / 0)) + return this._smin.setKey(Gi, void 0), this._smax.setKey(Gi, void 0), void this.dispatchImmediately("selectionextremeschanged"); + if (!u && (this._tmin.getKey(ai) != K || this._tmax.getKey(ai) != ne || this._tmin.getKey(Gi) != ue || this._tmax.getKey(Gi) != we)) { + this._tmin.setKey(ai, K), this._tmax.setKey(ai, ne), this._tmin.setKey(Gi, ue), this._tmax.setKey(Gi, we); + var Ji = this.stackedSeries; + Ji && (Ji.isDisposed() ? this.stackedSeries = void 0 : Ji.processValues(!1)), this.dispatchImmediately("extremeschanged"); + } + if (De != Ke || $e != Ze) + for (K = 1 / 0, ne = -1 / 0, ue = 1 / 0, we = -1 / 0, pt = Ke; pt < Ze; pt++) + Vt = G.getIndex(pt), this.getStackValue(Vt, u), Yt = Vt.getValue("valueX", "stack"), ci = Vt.getValue("valueY", "stack"), K = H(Vt.getMin(this._xValueFields, u, Yt), K), ue = H(Vt.getMin(this._yValueFields, u, ci), ue), ne = ve(Vt.getMax(this._xValueFields, u, Yt), ne), we = ve(Vt.getMax(this._yValueFields, u, ci), we), this.stacked && (this.baseAxis == w && (ci < ue && (ue = ci), ci > we && (we = ci)), this.baseAxis == $ && (Yt < K && (K = Yt), Yt > ne && (ne = Yt))); + if (this.xAxis instanceof vo && (K == 1 / 0 || ne == -1 / 0)) + return this._smin.setKey(ai, void 0), this._smax.setKey(ai, void 0), void this.dispatchImmediately("selectionextremeschanged"); + if (this.yAxis instanceof vo && (ue == 1 / 0 || we == -1 / 0)) + return this._smin.setKey(Gi, void 0), this._smax.setKey(Gi, void 0), void this.dispatchImmediately("selectionextremeschanged"); + if ((this._smin.getKey(ai) != K || this._smax.getKey(ai) != ne || this._smin.getKey(Gi) != ue || this._smax.getKey(Gi) != we) && (this._smin.setKey(ai, K), this._smax.setKey(ai, ne), this._smin.setKey(Gi, ue), this._smax.setKey(Gi, we), this.appeared || this.start != 0 || this.end != 1 || this.dataItems != this.mainDataSet)) { + var Ci, Hi, sr = !1; + $ instanceof vo && !($ instanceof Ju) && ((!le(Ci = this._tmin.getKey(Gi)) || (this.usesShowFields || this._dataSetChanged || w instanceof Ju && w.groupData && this.isShowing) && ue < Ci || this.stackedSeries && !this.isHidden) && (this._tmin.setKey(Gi, ue), sr = !0), (!le(Hi = this._tmax.getKey(Gi)) || (this.usesShowFields || this._dataSetChanged || w instanceof Ju && w.groupData && this.isShowing) && we > Hi || this.stackedSeries && !this.isHidden) && (this._tmax.setKey(Gi, we), sr = !0)), w instanceof vo && !(w instanceof Ju) && ((!le(Ci = this._tmin.getKey(ai)) || (this.usesShowFields || this._dataSetChanged || $ instanceof Ju && $.groupData && this.isShowing) && K < Ci || this.stackedSeries && !this.isHidden) && (this._tmin.setKey(ai, K), sr = !0), (!le(Hi = this._tmax.getKey(ai)) || (this.usesShowFields || this._dataSetChanged || $ instanceof Ju && $.groupData && this.isShowing) && ne > Hi || this.stackedSeries && !this.isHidden) && (this._tmax.setKey(ai, ne), sr = !0)), sr && this.dispatchImmediately("extremeschanged"), this.start == 0 && this.end == 1 && (this._dataSetChanged = !1), this.dispatchImmediately("selectionextremeschanged"); + } + !u && this.stacked && this.processValues(!0); + } + }, R.prototype.hideTooltip = function(u) { + U.prototype.hideTooltip.call(this, u), this.returnBulletDefaultState(), this._prevTooltipDataItem = void 0; + }, R.prototype.showTooltipAtPosition = function(u, w) { + var $; + if (this.visible && !this.isHiding && !this.isShowing) { + var G = this._xAxis.get(), K = this._yAxis.get(); + G == this.baseAxis && ($ = G.getSeriesDataItem(this, G.toAxisPosition(u), this.snapTooltip)), K == this.baseAxis && ($ = K.getSeriesDataItem(this, K.toAxisPosition(w), this.snapTooltip)); + var ne = this.showTooltipAtDataItem($); + if (ne) + return ne; + if (!this.tooltipText && !this.tooltipHTML) + return; + } + this.hideTooltip(); + }, R.prototype.getAdjustedXLocation = function(u, w, $) { + return u.locations[w]; + }, R.prototype.getAdjustedYLocation = function(u, w, $) { + return u.locations[w]; + }, R.prototype.showTooltipAtDataItem = function(u) { + var w, $, G = this.chart.cursor; + if (G && G.hideSeriesTooltipsOnSelection && G.selection.visible && G.downPoint) + this.hideTooltip(); + else if (this.returnBulletDefaultState(u), u && u.visible) { + if (this.updateLegendValue(u), this.cursorTooltipEnabled) { + this.tooltipDataItem = u; + var K = this.tooltipXField, ne = this.tooltipYField; + if (Ee(u[K]) && Ee(u[ne])) { + var ue = this.getPoint(u, K, ne, this.getAdjustedXLocation(u, K), this.getAdjustedYLocation(u, ne)); + if (ue && (this.chart.className != "XYChart" || !(ue.y < -1 || ue.y > this.yAxis.pixelHeight + 1 || ue.x < -1 || ue.x > this.xAxis.pixelWidth + 1))) { + if (this.tooltipX = ue.x, this.tooltipY = ue.y, this._prevTooltipDataItem != u && (this.dispatchImmediately("tooltipshownat", { type: "tooltipshownat", target: this, dataItem: u }), this._prevTooltipDataItem = u), this.cursorHoverEnabled) + try { + for (var we = Se(u.sprites), De = we.next(); !De.done; De = we.next()) { + var $e = De.value; + !$e.parent.visible || $e.isHidden || $e.__disabled || $e.disabled || $e.isHiding || ($e.interactions.isRealHover || ($e.dispatchImmediately("over"), $e.interactions.isRealHover = !0), $e.isHover = !0); + } + } catch (Ke) { + w = { error: Ke }; + } finally { + try { + De && !De.done && ($ = we.return) && $.call(we); + } finally { + if (w) + throw w.error; + } + } + return this.showTooltip() ? kf({ x: ue.x, y: ue.y }, this) : void 0; + } + } + } + } else + this.updateLegendValue(u, !0); + }, R.prototype.returnBulletDefaultState = function(u) { + var w, $; + if (this._prevTooltipDataItem && this._prevTooltipDataItem != u) + try { + for (var G = Se(this._prevTooltipDataItem.sprites), K = G.next(); !K.done; K = G.next()) { + var ne = K.value; + if (ne.isDisposed()) + this._prevTooltipDataItem = void 0; + else { + var ue = ne.interactions.isRealHover; + ne.isHover = !1, ue && ne.dispatchImmediately("out"); + } + } + } catch (we) { + w = { error: we }; + } finally { + try { + K && !K.done && ($ = G.return) && $.call(G); + } finally { + if (w) + throw w.error; + } + } + }, R.prototype.shouldCreateBullet = function(u, w) { + var $ = w.xField; + Ee($) || ($ = this.xField); + var G = w.yField; + if (Ee(G) || (G = this.yField), this.xAxis instanceof vo && !u.hasValue([$]) || this.yAxis instanceof vo && !u.hasValue([G])) + return !1; + if (w.disabled) { + var K = w.propertyFields.disabled, ne = u.dataContext; + return !(!ne || ne[K] !== !1); + } + return !0; + }, R.prototype.updateTooltip = function() { + this.hideTooltipWhileZooming || !this.tooltip || this.tooltip.isHidden || this.isHiding || this.isHidden || !this.tooltipDataItem || this.showTooltipAtDataItem(this.tooltipDataItem); + }, R.prototype.positionBullet = function(u) { + U.prototype.positionBullet.call(this, u); + var w = u.dataItem, $ = u.xField; + Ee($) || ($ = this.xField); + var G = u.yField; + Ee(G) || (G = this.yField); + var K = this.xAxis, ne = this.yAxis; + if (K instanceof vo && !w.hasValue([$]) || ne instanceof vo && !w.hasValue([G])) + u.visible = !1; + else { + var ue = this.getBulletLocationX(u, $), we = this.getBulletLocationY(u, G); + if (this.getPoint(w, $, G, ue, we)) { + var De = this.xOpenField, $e = this.yOpenField, Ke = void 0, Ze = void 0; + if (K instanceof Ju) { + le(ue) || (ue = 0); + var pt = void 0, Vt = w.getWorkingValue($); + if (De ? pt = w.getWorkingValue(De) : K == this.baseAxis && (pt = K.baseValue), le(pt) || (pt = Vt), (pt += Hi = w.getValue("valueX", "stack")) == (Vt += Hi)) { + var Yt = K.baseInterval, ci = K.dateFormatter; + pt = Uh(new Date(pt), Yt.timeUnit, Yt.count, ci.firstDayOfWeek, ci.utc, void 0, ci.timezoneMinutes, ci.timezone).getTime(), Vt = cp(new Date(pt), Yt.timeUnit, Yt.count, ci.utc).getTime(); + } + var ai = void 0; + ai = K == this.baseAxis ? pt + (Vt - pt) * ue : pt + (Vt - pt) * (1 - ue), Ke = K.valueToPosition(ai); + } else if (K instanceof vo) + le(ue) || (ue = 0), pt = void 0, Vt = w.getWorkingValue($), pt = De ? w.getWorkingValue(De) : K.baseValue, ai = (pt += Hi = w.getValue("valueX", "stack")) + ((Vt += Hi) - pt) * (1 - ue), Ke = K.valueToPosition(ai); + else if (K instanceof Eh) { + var Gi = this.getAdjustedXLocation(w, $, u.locationX), Ji = this.getAdjustedXLocation(w, De, u.locationX); + Ke = K.categoryToPosition(w[$], Gi); + var Ci = void 0; + De && (Ci = K.categoryToPosition(w[De], Ji)), le(Ci) || (Ci = 1), Ke = Ci + (Ke - Ci) * ue; + } + if (ne instanceof Ju) + le(we) || (we = 0), pt = void 0, Vt = w.getWorkingValue(G), $e ? pt = w.getWorkingValue($e) : ne == this.baseAxis && (pt = ne.baseValue), le(pt) || (pt = Vt), (pt += Hi = w.getValue("valueY", "stack")) == (Vt += Hi) && (Yt = ne.baseInterval, ci = ne.dateFormatter, pt = Uh(new Date(pt), Yt.timeUnit, Yt.count, ci.firstDayOfWeek, ci.utc, void 0, ci.timezoneMinutes, ci.timezone).getTime(), Vt = cp(new Date(pt), Yt.timeUnit, Yt.count, ci.utc).getTime()), ai = void 0, ai = ne == this.baseAxis ? pt + (Vt - pt) * we : pt + (Vt - pt) * (1 - we), Ze = ne.valueToPosition(ai); + else if (ne instanceof vo) { + var Hi; + le(we) || (we = 0), pt = void 0, Vt = w.getWorkingValue(G), pt = $e ? w.getWorkingValue($e) : ne.baseValue, ai = (pt += Hi = w.getValue("valueY", "stack")) + ((Vt += Hi) - pt) * (1 - we), Ze = ne.valueToPosition(ai); + } else if (ne instanceof Eh) { + Ze = ne.categoryToPosition(w[G], we); + var sr = this.getAdjustedYLocation(w, G, u.locationY), Or = this.getAdjustedYLocation(w, $e, u.locationY); + Ze = ne.categoryToPosition(w[G], sr); + var yr = void 0; + $e && (yr = ne.categoryToPosition(w[$e], Or)), le(yr) || (yr = 1), Ze = yr + (Ze - yr) * we; + } + u.visible = !0, this.positionBulletReal(u, Ke, Ze); + } else + u.visible = !1; + } + }, R.prototype.positionBulletReal = function(u, w, $) { + u.x = this.xAxis.renderer.positionToPoint(w, $).x, u.y = this.yAxis.renderer.positionToPoint($, w).y; + }, R.prototype.getBulletLocationX = function(u, w) { + var $ = u.locationX, G = u.dataItem; + return le($) || ($ = G.workingLocations[w]), $; + }, R.prototype.getBulletLocationY = function(u, w) { + var $ = u.locationY, G = u.dataItem; + return le($) || ($ = G.workingLocations[w]), $; + }, R.prototype.updateStacking = function() { + var u = this; + this.invalidateDataItems(), this.chart && this.chart.series.each(function(w) { + w.baseAxis == u.baseAxis && (w.stackedSeries = void 0, w.invalidateDataItems(), w.invalidateProcessedData()); + }); + }, Object.defineProperty(R.prototype, "stacked", { get: function() { + return this.getPropertyValue("stacked"); + }, set: function(u) { + if (this.setPropertyValue("stacked", u, !0)) { + this.updateStacking(); + var w, $ = this.xAxis, G = this.yAxis; + u || ($ != this.baseAxis && $ instanceof vo && (w = this.xField), G != this.baseAxis && G instanceof vo && (w = this.yField), w && this.dataItems.each(function(K) { + K.setCalculatedValue(w, 0, "stack"); + })); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "snapTooltip", { get: function() { + return this.getPropertyValue("snapTooltip"); + }, set: function(u) { + this.setPropertyValue("snapTooltip", u); + }, enumerable: !0, configurable: !0 }), R.prototype.show = function(u) { + var w, $ = this; + this.isHidden && (this.appeared && this.xAxis instanceof Ju && this.xAxis.groupData && (this._tmin.setKey(this.yAxis.uid, void 0), this._tmax.setKey(this.yAxis.uid, void 0)), this.appeared && this.yAxis instanceof Ju && this.yAxis.groupData && (this._tmin.setKey(this.xAxis.uid, void 0), this._tmax.setKey(this.xAxis.uid, void 0))), this.xAxis instanceof vo && this.xAxis != this.baseAxis && (w = this._xValueFields), this.yAxis instanceof vo && this.yAxis != this.baseAxis && (w = this._yValueFields); + var G, K = this.startIndex, ne = this.endIndex, ue = 0, we = this.defaultState.transitionDuration; + le(u) && (we = u), er(mu(this.dataItems.iterator()), function($e) { + var Ke = $e[0], Ze = $e[1], pt = we; + (Ke < $.startIndex - 10 || Ke > $.endIndex + 10) && (pt = 0, ue = 0), $.sequencedInterpolation && pt > 0 && (ue = $.sequencedInterpolationDelay * Ke + we * (Ke - K) / (ne - K)), G = Ze.show(pt, ue, w); + }), this.dataSets.each(function($e, Ke) { + Ke != $.dataItems && Ke.each(function(Ze) { + Ze.events.disable(), Ze.show(0, 0, w), Ze.events.enable(); + }); + }), this.mainDataSet != this.dataItems && this.mainDataSet.each(function($e) { + $e.events.disable(), $e.show(0, 0, w), $e.events.enable(); + }); + var De = U.prototype.show.call(this, u); + return G && !G.isFinished() && (De = G), this.hidden && (this.dispatchImmediately("selectionextremeschanged"), this.hidden = !1), De; + }, R.prototype.hide = function(u) { + var w, $, G = this, K = this.xAxis; + K instanceof vo && K != this.baseAxis && (w = this._xValueFields, $ = this.stacked || K.minZoomed < K.baseValue && K.maxZoomed > K.baseValue || this.stackedSeries ? K.baseValue : K.min); + var ne = this.yAxis; + ne instanceof vo && ne != this.baseAxis && (w = this._yValueFields, $ = this.stacked || ne.minZoomed < ne.baseValue && ne.maxZoomed > ne.baseValue || this.stackedSeries ? ne.baseValue : ne.min); + var ue = this.startIndex, we = this.endIndex, De = this.hiddenState.transitionDuration; + le(u) && (De = u); + var $e, Ke = 0; + er(mu(this.dataItems.iterator()), function(pt) { + var Vt = pt[0], Yt = pt[1], ci = De; + (Vt < G.startIndex - 10 || Vt > G.endIndex + 10) && (ci = 0), ci == 0 ? Yt.hide(0, 0, $, w) : (G.sequencedInterpolation && ci > 0 && (Ke = G.sequencedInterpolationDelay * Vt + De * (Vt - ue) / (we - ue)), $e = Yt.hide(ci, Ke, $, w)); + }), this.dataSets.each(function(pt, Vt) { + Vt != G.dataItems && Vt.each(function(Yt) { + Yt.events.disable(), Yt.hide(0, 0, $, w), Yt.events.enable(); + }); + }), this.mainDataSet != this.dataItems && this.mainDataSet.each(function(pt) { + pt.events.disable(), pt.hide(0, 0, $, w), pt.events.enable(); + }); + var Ze = U.prototype.hide.call(this, De); + return Ze && !Ze.isFinished() && Ze.delay(Ke), $e && !$e.isFinished() && (Ze = $e), this.validateDataElements(), Ze; + }, R.prototype.handleDataItemWorkingValueChange = function(u, w) { + U.prototype.handleDataItemWorkingValueChange.call(this, u, w), er(this.baseAxis.series.iterator(), function($) { + ($.stacked || $.stackedSeries) && $.invalidateProcessedData(); + }); + }, R.prototype.getStackValue = function(u, w) { + var $ = this, G = this.xAxis, K = this.yAxis; + if (this.stacked && G && K) { + var ne, ue = this.chart, we = ue.series.indexOf(this); + G != this.baseAxis && G instanceof vo && (ne = this.xField), K != this.baseAxis && K instanceof vo && (ne = this.yField), ne && (u.setCalculatedValue(ne, 0, "stack"), Zr(ue.series.range(0, we).backwards().iterator(), function(De) { + if (De.xAxis == G && De.yAxis == K && De.className == $.className) { + De.stackedSeries = $; + var $e = De.dataItems.getIndex(u.index); + if ($e && $e.hasValue($._xValueFields) && $e.hasValue($._yValueFields)) { + var Ke, Ze = u.getValue(ne), pt = $e.getValue(ne) + $e.getValue(ne, "stack"); + if (Ke = w ? $e.getWorkingValue(ne) + $e.getValue(ne, "stack") : $e.getValue(ne) + $e.getValue(ne, "stack"), !$.stackToNegative || Ze >= 0 && pt >= 0 || Ze < 0 && pt < 0) + return u.setCalculatedValue(ne, Ke, "stack"), !1; + if (!De.stacked) + return !1; + } else if (!De.stacked) + return !1; + } + return !0; + })); + } + }, Object.defineProperty(R.prototype, "stackToNegative", { get: function() { + return this.getPropertyValue("stackToNegative"); + }, set: function(u) { + this.setPropertyValue("stackToNegative", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "xField", { get: function() { + return this._xField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yField", { get: function() { + return this._yField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "xOpenField", { get: function() { + return this._xOpenField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yOpenField", { get: function() { + return this._yOpenField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipXField", { get: function() { + return this._tooltipXField ? this._tooltipXField : this._xField; + }, set: function(u) { + this._tooltipXField = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipYField", { get: function() { + return this._tooltipYField ? this._tooltipYField : this._yField; + }, set: function(u) { + this._tooltipYField = u; + }, enumerable: !0, configurable: !0 }), R.prototype.min = function(u) { + return this._tmin.getKey(u.uid); + }, R.prototype.max = function(u) { + return this._tmax.getKey(u.uid); + }, R.prototype.selectionMin = function(u) { + return this._smin.getKey(u.uid); + }, R.prototype.selectionMax = function(u) { + return this._smax.getKey(u.uid); + }, R.prototype.processConfig = function(u) { + if (u) { + if (Ee(u.baseAxis) && st(u.baseAxis) && (this.map.hasKey(u.baseAxis) ? u.baseAxis = this.map.getKey(u.baseAxis) : (this.processingErrors.push("[XYSeries (" + (this.name || "unnamed") + ')] No axis with id "' + u.baseAxis + '" found for `baseAxis`.'), delete u.baseAxis)), Ee(u.xAxis) && st(u.xAxis) && (this.map.hasKey(u.xAxis) ? u.xAxis = this.map.getKey(u.xAxis) : (this.processingErrors.push("[XYSeries (" + (this.name || "unnamed") + ')] No axis with id "' + u.xAxis + '" found for `xAxis`.'), delete u.xAxis)), Ee(u.yAxis) && st(u.yAxis) && (this.map.hasKey(u.yAxis) ? u.yAxis = this.map.getKey(u.yAxis) : (this.processingErrors.push("[XYSeries (" + (this.name || "unnamed") + ')] No axis with id "' + u.yAxis + '" found for `yAxis`.'), delete u.yAxis)), Ee(u.axisRanges) && gt(u.axisRanges)) + for (var w = 0, $ = u.axisRanges.length; w < $; w++) { + var G = u.axisRanges[w]; + Ee(G.type) || (G.type = "AxisDataItem"), Ee(G.axis) && st(G.axis) && this.map.hasKey(G.axis) ? G.component = this.map.getKey(G.axis) : Ee(G.component) && st(G.component) && this.map.hasKey(G.component) && (G.component = this.map.getKey(G.component)); + } + Ee(u.dataFields) && ct(u.dataFields) || this.processingErrors.push("`dataFields` is not set for series [" + (this.name || "unnamed") + "]"); + } + U.prototype.processConfig.call(this, u); + }, R.prototype.getPoint = function(u, w, $, G, K, ne, ue) { + if (this.xAxis && this.yAxis) { + var we = this.xAxis.getX(u, w, G), De = this.yAxis.getY(u, $, K); + return { x: we = mt(we, -this._maxxX, this._maxxX), y: De = mt(De, -this._maxxY, this._maxxY) }; + } + }, R.prototype.updateItemReaderText = function() { + if (!this._itemReaderTextChanged) { + var u = ""; + mi(this.dataFields, function(w, $) { + u += "{" + w + "} "; + }), this.itemReaderText = u, this._itemReaderTextChanged = !1; + } + }, Object.defineProperty(R.prototype, "cursorTooltipEnabled", { get: function() { + return this.getPropertyValue("cursorTooltipEnabled"); + }, set: function(u) { + this.setPropertyValue("cursorTooltipEnabled", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cursorHoverEnabled", { get: function() { + return this.getPropertyValue("cursorHoverEnabled"); + }, set: function(u) { + this.setPropertyValue("cursorHoverEnabled", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "excludeFromTotal", { get: function() { + return this.getPropertyValue("excludeFromTotal"); + }, set: function(u) { + this.setPropertyValue("excludeFromTotal", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hideTooltipWhileZooming", { get: function() { + return this.getPropertyValue("hideTooltipWhileZooming"); + }, set: function(u) { + this.setPropertyValue("hideTooltipWhileZooming", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maskBullets", { get: function() { + return this.getPropertyValue("maskBullets"); + }, set: function(u) { + this.setPropertyValue("maskBullets", u); + var w = this.chart; + w && (this.bulletsContainer.parent = u ? w.bulletsContainer : w.axisBulletsContainer); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + this.groupFields = on(u.groupFields, {}), U.prototype.copyFrom.call(this, u); + }, R.prototype.dispose = function() { + this.scrollbarSeries && this.scrollbarSeries.dispose(), U.prototype.dispose.call(this); + }, R; + }(AL); + hi.registeredClasses.XYSeries = BC, hi.registeredClasses.XYSeriesDataItem = Dm; + var VC = function(U) { + function R() { + var u = U.call(this) || this; + u._chart = new Un(), u.className = "XYChartScrollbar"; + var w = new Fa(); + u.padding(0, 0, 0, 0); + var $ = u.createChild(Hy); + if ($.shouldClone = !1, $.margin(0, 0, 0, 0), $.padding(0, 0, 0, 0), $.interactionsEnabled = !1, u._scrollbarChart = $, !Yx()) { + var G = new CL(); + G.filterUnits = "userSpaceOnUse", $.plotContainer.filters.push(G); + } + u._disposers.push(u._scrollbarChart), u.minHeight = 60, u.minWidth = 60; + var K = u.createChild(so); + K.shouldClone = !1, K.setElement(u.paper.add("path")), K.fill = w.getFor("background"), K.fillOpacity = 0.8, K.interactionsEnabled = !1, K.isMeasured = !1, K.toBack(), u._unselectedOverlay = K, u._disposers.push(u._unselectedOverlay), $.toBack(), u.background.cornerRadius(0, 0, 0, 0); + var ne = u.thumb.background; + ne.cornerRadius(0, 0, 0, 0), ne.fillOpacity = 0, ne.fill = w.getFor("background"); + var ue = ne.states.getKey("hover"); + ue && (ue.properties.fillOpacity = 0.2); + var we = ne.states.getKey("down"); + return we && (we.properties.fillOpacity = 0.4), u._disposers.push(u._chart), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "series", { get: function() { + return this._series || (this._series = new Hs(), this._disposers.push(this._series.events.on("inserted", this.handleSeriesAdded, this, !1)), this._disposers.push(this._series.events.on("removed", this.handleSeriesRemoved, this, !1))), this._series; + }, enumerable: !0, configurable: !0 }), R.prototype.handleSeriesAdded = function(u) { + var w = this, $ = u.newValue; + if ($.xAxis && $.yAxis) { + var G = this.scrollbarChart; + G.zoomOutButton.disabled = !0, this.chart = $.chart, G.dateFormatter.inputDateFormat = this.chart.dateFormatter.inputDateFormat, G.language.locale = this.chart.language.locale; + var K = !0, ne = !0; + er(this.series.iterator(), function(ai) { + ai != $ && (ai.xAxis == $.xAxis && w.scrollbarChart.xAxes.length > 0 && (K = !1), ai.yAxis == $.yAxis && w.scrollbarChart.yAxes.length > 0 && (ne = !1)); + }), $.events.on("beforedisposed", function() { + w.series.removeValue($); + }); + var ue = new Fa(), we = $.clone(); + if (Yx() && (we.stroke = We("#aaaaaa"), we.fill = we.stroke, we.propertyFields.fill = void 0, we.propertyFields.stroke = void 0), $.scrollbarSeries = we, K) { + var De = $.xAxis.clone(); + if (G.xAxes.moveValue(De), De.title.disabled = !0, De.rangeChangeDuration = 0, (pt = De.renderer).ticks.template.disabled = !0, pt.inside = !0, pt.labels.template.inside = !0, pt.line.strokeOpacity = 0, pt.minLabelPosition = 0.02, pt.maxLabelPosition = 0.98, pt.line.disabled = !0, pt.axisFills.template.disabled = !0, pt.baseGrid.disabled = !0, pt.grid.template.strokeOpacity = 0.05, pt.minWidth = void 0, pt.minHeight = void 0, pt.padding(0, 0, 0, 0), pt.chart = G, pt.margin(0, 0, 0, 0), De.width = ce(100), pt.labels.template.fillOpacity = 0.5, De.maxZoomCount = void 0, De.minZoomCount = void 0, De instanceof Ju) { + var $e = De, Ke = $.xAxis; + $e.groupCount = 5 * Ke.groupCount, $e.min = void 0, $e.max = void 0, this._disposers.push($e.clonedFrom.events.on("extremeschanged", function() { + le($e.clonedFrom.minDefined) && ($e.min = $e.clonedFrom.minDefined), le($e.clonedFrom.maxDefined) && ($e.max = $e.clonedFrom.maxDefined); + }, void 0, !1)); + } else if (De instanceof vo) { + var Ze = De; + Ze.min = void 0, Ze.max = void 0, le(Ze.clonedFrom.minDefined) || (Ze.min = void 0), le(Ze.clonedFrom.maxDefined) || (Ze.max = void 0), this._disposers.push(Ze.clonedFrom.events.on("extremeschanged", function() { + le(Ze.clonedFrom.minDefined) && (Ze.min = Ze.clonedFrom.min), le(Ze.clonedFrom.maxDefined) && (Ze.max = Ze.clonedFrom.max); + }, void 0, !1)); + } + we.xAxis = De; + } else + this.scrollbarChart.xAxes.each(function(ai) { + ai.clonedFrom == $.xAxis && (we.xAxis = ai); + }); + if (ne) { + var pt, Vt = $.yAxis.clone(); + if (G.yAxes.moveValue(Vt), Vt.title.disabled = !0, Vt.rangeChangeDuration = 0, (pt = Vt.renderer).ticks.template.disabled = !0, pt.inside = !0, pt.labels.template.inside = !0, pt.line.strokeOpacity = 0, pt.minLabelPosition = 0.02, pt.maxLabelPosition = 0.98, pt.line.disabled = !0, pt.axisFills.template.disabled = !0, pt.grid.template.stroke = ue.getFor("background"), pt.baseGrid.disabled = !0, pt.grid.template.strokeOpacity = 0.05, pt.minWidth = void 0, pt.minHeight = void 0, pt.chart = G, pt.padding(0, 0, 0, 0), pt.margin(0, 0, 0, 0), Vt.height = ce(100), pt.labels.template.fillOpacity = 0.5, we.yAxis = Vt, Vt.maxZoomCount = void 0, Vt.minZoomCount = void 0, Vt instanceof Ju) { + var Yt = Vt; + Yt.min = void 0, Yt.max = void 0, Ke = $.yAxis, Vt.groupCount = 5 * Ke.groupCount, this._disposers.push(Yt.clonedFrom.events.on("extremeschanged", function() { + le(Yt.clonedFrom.minDefined) && (Yt.min = Yt.clonedFrom.minDefined), le(Yt.clonedFrom.maxDefined) && (Yt.max = Yt.clonedFrom.maxDefined); + })); + } else if (Vt instanceof vo) { + var ci = Vt; + ci.min = void 0, ci.max = void 0, le(ci.clonedFrom.minDefined) || (ci.min = void 0), le(ci.clonedFrom.maxDefined) || (ci.max = void 0), this._disposers.push(ci.clonedFrom.events.on("extremeschanged", function() { + le(ci.clonedFrom.minDefined) && (ci.min = ci.clonedFrom.minDefined), le(ci.clonedFrom.maxDefined) && (ci.max = ci.clonedFrom.maxDefined); + })); + } + } else + this.scrollbarChart.yAxes.each(function(ai) { + ai.clonedFrom == $.yAxis && (we.yAxis = ai); + }); + we.rangeChangeDuration = 0, we.interpolationDuration = 0, we.defaultState.transitionDuration = 0, we.showOnInit = !1, this._disposers.push(we.events.on("validated", this.zoomOutAxes, this, !1)), this._disposers.push($.events.on("datavalidated", function() { + we.data != $.data && (we.data = $.data); + }, void 0, !1)), we.defaultState.properties.visible = !0, G.series.push(we), this.updateByOrientation(); + } + }, R.prototype.updateByOrientation = function() { + var u = this; + this._scrollbarChart && (er(this._scrollbarChart.xAxes.iterator(), function(w) { + var $ = w.renderer; + u.orientation == "vertical" ? ($.grid.template.disabled = !0, $.labels.template.disabled = !0, $.minGridDistance = 10) : ($.grid.template.disabled = !1, $.labels.template.disabled = !1, $.minGridDistance = w.clonedFrom.renderer.minGridDistance); + }), er(this._scrollbarChart.yAxes.iterator(), function(w) { + var $ = w.renderer; + u.orientation == "horizontal" ? ($.grid.template.disabled = !0, $.labels.template.disabled = !0, $.minGridDistance = 10) : ($.grid.template.disabled = !1, $.labels.template.disabled = !1, $.minGridDistance = w.clonedFrom.renderer.minGridDistance); + })); + }, R.prototype.handleSeriesRemoved = function(u) { + var w = u.oldValue, $ = this.scrollbarChart; + $.series.each(function(G) { + G && G.clonedFrom == w && $.series.removeValue(G); + }), $.series.length == 0 && ($.xAxes.clear(), $.yAxes.clear()); + try { + w.events.off("validated", this.zoomOutAxes, this); + } catch { + } + }, Object.defineProperty(R.prototype, "scrollbarChart", { get: function() { + return this._scrollbarChart; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart.get(); + }, set: function(u) { + this._chart.get() !== u && (this._chart.set(u, u.events.on("datavalidated", this.handleDataChanged, this, !1)), this.handleDataChanged(), this._scrollbarChart.dataProvider = u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "unselectedOverlay", { get: function() { + return this._unselectedOverlay; + }, enumerable: !0, configurable: !0 }), R.prototype.handleDataChanged = function() { + this.chart.data != this.scrollbarChart.data ? this.scrollbarChart.data = this.chart.data : this.scrollbarChart.invalidateRawData(); + }, R.prototype.zoomOutAxes = function() { + var u = this.scrollbarChart; + er(u.xAxes.iterator(), function(w) { + w.zoom({ start: 0, end: 1 }, !0, !0); + }), er(u.yAxes.iterator(), function(w) { + w.zoom({ start: 0, end: 1 }, !0, !0); + }); + }, R.prototype.updateThumb = function(u) { + if (u === void 0 && (u = !0), U.prototype.updateThumb.call(this, u), this._unselectedOverlay) { + var w = this.thumb, $ = w.pixelX || 0, G = w.pixelY || 0, K = w.pixelWidth || 0, ne = w.pixelHeight || 0, ue = ""; + this.orientation == "horizontal" ? (ue = n2({ x: -1, y: 0, width: $, height: ne }), ue += n2({ x: $ + K, y: 0, width: (this.pixelWidth || 0) - $ - K, height: ne })) : (ue = n2({ x: 0, y: 0, width: K, height: G }), ue += n2({ x: 0, y: G + ne, width: K, height: (this.pixelHeight || 0) - G - ne })), this._unselectedOverlay.path = ue; + } + }, R.prototype.processConfig = function(u) { + if (u && Ee(u.series) && gt(u.series)) + for (var w = 0, $ = u.series.length; w < $; w++) { + var G = u.series[w]; + if (Ee(G) && st(G)) { + if (!this.map.hasKey(G)) + throw Error("XYChartScrollbar error: Series with id `" + G + "` does not exist."); + u.series[w] = this.map.getKey(G); + } + } + U.prototype.processConfig.call(this, u); + }, R; + }(zy); + hi.registeredClasses.XYChartScrollbar = VC; + var r9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "XYChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(AH), Hy = function(U) { + function R() { + var u = U.call(this) || this; + u._axisRendererX = yd, u._axisRendererY = Zv, u._seriesPoints = [], u.className = "XYChart", u.maskBullets = !0, u.arrangeTooltips = !0; + var w = u.chartContainer; + w.layout = "vertical", u.padding(15, 15, 15, 15); + var $ = w.createChild(Qn); + $.shouldClone = !1, $.layout = "vertical", $.width = ce(100), $.zIndex = 1, u.topAxesContainer = $; + var G = w.createChild(Qn); + G.shouldClone = !1, G.layout = "horizontal", G.width = ce(100), G.height = ce(100), G.zIndex = 0, u.yAxesAndPlotContainer = G; + var K = w.createChild(Qn); + K.shouldClone = !1, K.width = ce(100), K.layout = "vertical", K.zIndex = 1, u.bottomAxesContainer = K; + var ne = G.createChild(Qn); + ne.shouldClone = !1, ne.layout = "horizontal", ne.height = ce(100), ne.contentAlign = "right", ne.events.on("transformed", u.updateXAxesMargins, u, !1), ne.zIndex = 1, u.leftAxesContainer = ne; + var ue = G.createChild(Qn); + ue.shouldClone = !1, ue.height = ce(100), ue.width = ce(100), ue.background.fillOpacity = 0, u.plotContainer = ue, u.mouseWheelBehavior = "none", u._cursorContainer = ue; + var we = G.createChild(Qn); + we.shouldClone = !1, we.layout = "horizontal", we.height = ce(100), we.zIndex = 1, we.events.on("transformed", u.updateXAxesMargins, u, !1), u.rightAxesContainer = we, u.seriesContainer.parent = ue, u.bulletsContainer.parent = ue; + var De = ue.createChild(_H); + De.shouldClone = !1, De.align = "right", De.valign = "top", De.zIndex = Number.MAX_SAFE_INTEGER, De.marginTop = 5, De.marginRight = 5, De.hide(0), u.zoomOutButton = De; + var $e = u.plotContainer.createChild(Qn); + return $e.shouldClone = !1, $e.width = ce(100), $e.height = ce(100), $e.isMeasured = !1, $e.zIndex = 4, $e.layout = "none", u.axisBulletsContainer = $e, u._bulletMask = u.plotContainer, u.events.on("beforedatavalidated", function() { + u.series.each(function(Ke) { + Ke.dataGrouped = !1, Ke._baseInterval = {}; + }); + }, u, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), this.zoomOutButton.exportable = !1, Ee(this.readerTitle) || (this.readerTitle = this.language.translate("X/Y chart")); + }, R.prototype.draw = function() { + U.prototype.draw.call(this), this.seriesContainer.toFront(), this.bulletsContainer.toFront(), this.maskBullets && (this.bulletsContainer.mask = this._bulletMask), this.updateSeriesLegend(); + }, R.prototype.updatePlotElements = function() { + er(this.series.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.validateData = function() { + this._parseDataFrom == 0 && (er(this.xAxes.iterator(), function(u) { + u.dataChangeUpdate(); + }), er(this.yAxes.iterator(), function(u) { + u.dataChangeUpdate(); + }), er(this.series.iterator(), function(u) { + u.dataChangeUpdate(); + })), U.prototype.validateData.call(this); + }, R.prototype.updateXAxesMargins = function() { + var u = this.leftAxesContainer.measuredWidth, w = this.rightAxesContainer.measuredWidth, $ = this.bottomAxesContainer; + $.paddingLeft == u && $.paddingRight == w || ($.paddingLeft = u, $.paddingRight = w); + var G = this.topAxesContainer; + G.paddingLeft == u && G.paddingRight == w || (G.paddingLeft = u, G.paddingRight = w); + }, R.prototype.reinit = function() { + U.prototype.reinit.call(this), this.series.each(function(u) { + u.appeared = !1; + }); + }, R.prototype.handleXAxisChange = function(u) { + this.updateXAxis(u.target); + }, R.prototype.handleYAxisChange = function(u) { + this.updateYAxis(u.target); + }, R.prototype.processXAxis = function(u) { + var w = u.newValue; + w.chart = this, w.renderer || (w.renderer = new this._axisRendererX(), w.renderer.observe(["opposite", "inside", "inversed", "minGridDistance"], this.handleXAxisChange, this, !1)), w.axisLetter = "X", w.events.on("startendchanged", this.handleXAxisRangeChange, this, !1), w.dataProvider = this, this.updateXAxis(w.renderer), this.processAxis(w); + }, R.prototype.processYAxis = function(u) { + var w = u.newValue; + w.chart = this, w.renderer || (w.renderer = new this._axisRendererY(), w.renderer.observe(["opposite", "inside", "inversed", "minGridDistance"], this.handleYAxisChange, this, !1)), w.axisLetter = "Y", w.events.on("startendchanged", this.handleYAxisRangeChange, this, !1), w.dataProvider = this, this.updateYAxis(w.renderer), this.processAxis(w); + }, R.prototype.handleXAxisRangeChange = function() { + var u = this.getCommonAxisRange(this.xAxes); + this.scrollbarX && this.zoomAxes(this.xAxes, u, !0), this.toggleZoomOutButton(), this.updateScrollbar(this.scrollbarX, u); + }, R.prototype.toggleZoomOutButton = function() { + if (this.zoomOutButton) { + var u = !1; + Zr(this.xAxes.iterator(), function(w) { + if (w.toggleZoomOutButton) { + if (w.maxZoomCount > 0) { + var $ = w.maxZoomFactor / w.maxZoomCount; + if (He(w.end - w.start, 3) < 1 / $) + return u = !0, !1; + } else if (He(w.start, 3) > 0 || He(w.end, 3) < 1) + return u = !0, !1; + } + return !0; + }), Zr(this.yAxes.iterator(), function(w) { + if (w.toggleZoomOutButton) { + if (w.maxZoomCount > 0) { + var $ = w.maxZoomFactor / w.maxZoomCount; + if (He(w.end - w.start, 3) < 1 / $) + return u = !0, !1; + } else if (He(w.start, 3) > 0 || He(w.end, 3) < 1) + return u = !0, !1; + return !0; + } + }), this.seriesAppeared || (u = !1), u ? this.zoomOutButton.show() : this.zoomOutButton.hide(); + } + }, R.prototype.seriesAppeared = function() { + var u = !1; + return er(this.series.iterator(), function(w) { + if (!w.appeared) + return u = !1, !1; + }), u; + }, R.prototype.handleYAxisRangeChange = function() { + var u = this.getCommonAxisRange(this.yAxes); + this.scrollbarY && this.zoomAxes(this.yAxes, u, !0), this.toggleZoomOutButton(), this.updateScrollbar(this.scrollbarY, u); + }, R.prototype.updateScrollbar = function(u, w) { + u && (u.skipRangeEvents(), u.start = w.start, u.end = w.end); + }, R.prototype.getCommonAxisRange = function(u) { + var w, $; + return u.each(function(G) { + if (!(!G.zoomable || G instanceof vo && G.syncWithAxis)) { + var K = G.start, ne = G.end; + G.renderer.inversed && (K = 1 - G.end, ne = 1 - G.start), (!le(w) || K < w) && (w = K), (!le($) || ne > $) && ($ = ne); + } + }), { start: w, end: $ }; + }, R.prototype.updateXAxis = function(u) { + var w = u.axis; + u.opposite ? (w.parent = this.topAxesContainer, w.toFront()) : (w.parent = this.bottomAxesContainer, w.toBack()), w.renderer && w.renderer.processRenderer(); + }, R.prototype.updateYAxis = function(u) { + var w = u.axis; + u.opposite ? (w.parent = this.rightAxesContainer, w.toBack()) : (w.parent = this.leftAxesContainer, w.toFront()), w.renderer && w.renderer.processRenderer(); + }, R.prototype.processAxis = function(u) { + var w = this; + u instanceof Eh && this._dataUsers.moveValue(u); + var $ = u.renderer; + $.gridContainer.parent = this.plotContainer, $.gridContainer.toBack(), $.breakContainer.parent = this.plotContainer, $.breakContainer.toFront(), $.breakContainer.zIndex = 10, u.addDisposer(new ln(function() { + w.dataUsers.removeValue(u); + })), $.bulletsContainer.parent = this.axisBulletsContainer, this._disposers.push(u.events.on("positionchanged", function() { + var G = up({ x: 0, y: 0 }, u, w.axisBulletsContainer); + u.renderer instanceof Zv && ($.bulletsContainer.y = G.y), u.renderer instanceof yd && ($.bulletsContainer.x = G.x); + }, void 0, !1)), this.plotContainer.events.on("maxsizechanged", function() { + w.inited && (u.invalidateDataItems(), w.updateSeriesMasks()); + }, u, !1); + }, R.prototype.updateSeriesMasks = function() { + Yx() && this.series.each(function(u) { + var w = u.mainContainer.mask; + u.mainContainer.mask = void 0, u.mainContainer.mask = w; + }); + }, R.prototype.handleSeriesRemoved = function(u) { + var w = u.oldValue; + w && (w.xAxis && (w.xAxis.series.removeValue(w), w.xAxis.invalidateProcessedData()), w.yAxis && (w.yAxis.series.removeValue(w), w.yAxis.invalidateProcessedData()), this.series.each(function($) { + $.resetExtremes(); + })), U.prototype.handleSeriesRemoved.call(this, u); + }, Object.defineProperty(R.prototype, "xAxes", { get: function() { + return this._xAxes || (this._xAxes = new Hs(), this._xAxes.events.on("inserted", this.processXAxis, this, !1), this._xAxes.events.on("removed", this.handleAxisRemoval, this, !1), this._disposers.push(new Wo(this._xAxes, !1))), this._xAxes; + }, enumerable: !0, configurable: !0 }), R.prototype.handleAxisRemoval = function(u) { + var w = u.oldValue; + this.dataUsers.removeValue(w), w.autoDispose && w.dispose(); + }, Object.defineProperty(R.prototype, "yAxes", { get: function() { + return this._yAxes || (this._yAxes = new Hs(), this._yAxes.events.on("inserted", this.processYAxis, this, !1), this._yAxes.events.on("removed", this.handleAxisRemoval, this, !1), this._disposers.push(new Wo(this._yAxes, !1))), this._yAxes; + }, enumerable: !0, configurable: !0 }), R.prototype.handleSeriesAdded = function(u) { + try { + U.prototype.handleSeriesAdded.call(this, u); + var w = u.newValue; + this.xAxes.length != 0 && this.yAxes.length != 0 || (hi.removeFromInvalidComponents(w), w.dataInvalid = !1), w.xAxis, w.yAxis, w.maskBullets = w.maskBullets, w.fill == null && (this.patterns ? (Ee(w.stroke) || (w.stroke = this.colors.next()), w.fill = this.patterns.next(), Ee(w.fillOpacity) && (w.fill.backgroundOpacity = w.fillOpacity), w.stroke instanceof Ie && (w.fill.stroke = w.stroke, w.fill.fill = w.stroke)) : w.fill = this.colors.next()), Ee(w.stroke) || (w.stroke = w.fill); + } catch ($) { + this.raiseCriticalError($); + } + }, Object.defineProperty(R.prototype, "cursor", { get: function() { + return this._cursor; + }, set: function(u) { + this._cursor != u && (this._cursor && this.removeDispose(this._cursor), this._cursor = u, u && (this._disposers.push(u), u.chart = this, u.shouldClone = !1, u.parent = this._cursorContainer, u.events.on("cursorpositionchanged", this.handleCursorPositionChange, this, !1), u.events.on("zoomstarted", this.handleCursorZoomStart, this, !1), u.events.on("zoomended", this.handleCursorZoomEnd, this, !1), u.events.on("panstarted", this.handleCursorPanStart, this, !1), u.events.on("panning", this.handleCursorPanning, this, !1), u.events.on("panended", this.handleCursorPanEnd, this, !1), u.events.on("behaviorcanceled", this.handleCursorCanceled, this, !1), u.events.on("hidden", this.handleHideCursor, this, !1), u.zIndex = Number.MAX_SAFE_INTEGER - 1, this.tapToActivate && this.setTapToActivate(this.tapToActivate))); + }, enumerable: !0, configurable: !0 }), R.prototype.handleCursorPositionChange = function() { + var u = this.cursor; + if (u.visible && !u.isHiding) { + var w = this.cursor.xPosition, $ = this.cursor.yPosition; + this.showSeriesTooltip({ x: w, y: $ }); + var G = [], K = u.snapToSeries; + if (K && !u.downPoint) { + K instanceof BC && (K = [K]); + var ne = []; + _i(K, function(we) { + if (!we.isHidden && !we.isHiding) { + var De = we.xAxis, $e = we.yAxis; + De instanceof vo && !(De instanceof Ju) && $e instanceof vo && !($e instanceof Ju) ? (we.dataItems.each(function(Ke) { + ne.push(Ke); + }), Ur(G, we.yAxis), Ur(G, we.xAxis)) : (we.baseAxis == we.xAxis && (Ur(G, we.yAxis), ne.push(De.getSeriesDataItem(we, De.toAxisPosition(w), !0))), we.baseAxis == we.yAxis && (Ur(G, we.xAxis), ne.push($e.getSeriesDataItem(we, $e.toAxisPosition($), !0)))); + } + }); + var ue = this.getClosest(ne, w, $); + ue && (this.series.each(function(we) { + var De = ue.component; + we != De && (we.hideTooltip(), we.xAxis != De.xAxis && (we.xAxis.hideTooltip(), G.push(we.xAxis)), we.yAxis != De.yAxis && (we.yAxis.hideTooltip(), G.push(we.yAxis))); + }), ue.component.showTooltipAtDataItem(ue), u.handleSnap(ue.component)); + } + this._seriesPoints = [], this._cursorXPosition != w && this.showAxisTooltip(this.xAxes, w, G), this._cursorYPosition != $ && this.showAxisTooltip(this.yAxes, $, G), this.arrangeTooltips && this.sortSeriesTooltips(this._seriesPoints), this.legend && this.legend.afterDraw(); + } + }, R.prototype.getClosest = function(u, w, $) { + var G, K = 1 / 0; + return jr(u, function(ne) { + if (ne) { + var ue = ne.component.xAxis, we = ne.component.yAxis, De = ue.positionToCoordinate(ue.toGlobalPosition(ue.toAxisPosition(w))), $e = we.positionToCoordinate(we.toGlobalPosition(we.toAxisPosition($))), Ke = ne.component.xField, Ze = ne.component.yField; + if (ue instanceof vo && !le(ne.getValue(Ke)) || we instanceof vo && !le(ne.getValue(Ze))) + return !0; + var pt = ue.positionToCoordinate(ue.toGlobalPosition(ue.getPositionX(ne, Ke, ne.locations[Ke], "valueX"))), Vt = we.positionToCoordinate(we.toGlobalPosition(we.getPositionY(ne, Ze, ne.locations[Ze], "valueY"))), Yt = Math.sqrt(Math.pow(De - pt, 2) + Math.pow($e - Vt, 2)); + return Yt < K && (K = Yt, G = ne), !0; + } + }), G; + }, R.prototype.handleHideCursor = function() { + this.hideObjectTooltip(this.xAxes), this.hideObjectTooltip(this.yAxes), this.hideObjectTooltip(this.series), this._cursorXPosition = void 0, this._cursorYPosition = void 0, this.updateSeriesLegend(); + }, R.prototype.updateSeriesLegend = function() { + er(this.series.iterator(), function(u) { + u.updateLegendValue(); + }); + }, R.prototype.hideObjectTooltip = function(u) { + er(u.iterator(), function(w) { + w.cursorTooltipEnabled && w.hideTooltip(0); + }); + }, R.prototype.showSeriesTooltip = function(u) { + var w = this; + if (u) { + var $ = []; + this.series.each(function(G) { + if (!(G.xAxis instanceof Ju && G.xAxis.snapTooltip || G.yAxis instanceof Ju && G.yAxis.snapTooltip)) { + var K = G.showTooltipAtPosition(u.x, u.y); + K && (G.tooltip.setBounds(rt({ x: 0, y: 0, width: w.pixelWidth, height: w.pixelHeight }, w)), $.push({ series: G, point: K })); + } + }), this.arrangeTooltips && this.sortSeriesTooltips($); + } else + this.series.each(function(G) { + G.hideTooltip(); + }); + }, R.prototype.sortSeriesTooltips = function(u) { + if (u.length > 0) { + var w = this.cursor; + if (w && le(w.maxTooltipDistance)) { + var $, G, K = kf({ x: w.point.x, y: w.point.y }, w), ne = 1 / 0; + _i(u, function(Fn) { + var Aa = Fn.series, hh = Fn.point; + if (hh) { + var Np = { x: hh.x, y: hh.y }, bl = Math.abs(C(Np, K)); + bl < ne && (G = Np, ne = bl, $ = Aa); + } + }); + var ue = []; + $ && (_i(u, function(Fn) { + if (Math.abs(C(Fn.point, G)) <= Math.abs(w.maxTooltipDistance)) + ue.push({ series: Fn.series, point: Fn.point }); + else { + var Aa = Fn.series.tooltipDataItem; + Aa && _i(Aa.sprites, function(hh) { + hh.isHover = !1, hh.handleOutReal(); + }), Fn.series.hideTooltip(0); + } + }), w.maxTooltipDistance < 0 && (ue.length > 0 && _i(ue, function(Fn) { + $ != Fn.series && Fn.series.hideTooltip(0); + }), ue = [{ series: $, point: G }])), u = ue; + } + var we = kf({ x: -0.5, y: -0.5 }, this.plotContainer), De = kf({ x: this.plotContainer.pixelWidth + 0.5, y: this.plotContainer.pixelHeight + 0.5 }, this.plotContainer), $e = 0, Ke = []; + _i(u, function(Fn) { + var Aa = Fn.point; + Aa && bi(Aa, { x: we.x, y: we.y, width: De.x - we.x, height: De.y - we.y }) && (Ke.push({ point: Aa, series: Fn.series }), $e += Aa.y); + }), u = Ke; + var Ze = this.series.getIndex(0), pt = !1; + Ze && Ze.yAxis && Ze.yAxis.renderer.inversed && (pt = !0), pt ? u.sort(function(Fn, Aa) { + return jc(Fn.point.y, Aa.point.y); + }) : (u.sort(function(Fn, Aa) { + return jc(Aa.point.y, Fn.point.y); + }), u.reverse()); + var Vt = $e / u.length, Yt = Vy({ x: 0, y: 0 }, this.svgContainer.SVGContainer).y; + if (u.length > 0) { + var ci = we.y, ai = De.y; + cr({ x: 0, y: ci }, this); + var Gi = !1; + if (Vt > ci + (ai - ci) / 2) + for (var Ji = ai, Ci = u.length - 1; Ci >= 0; Ci--) { + var Hi = (As = u[Ci].series).tooltip, sr = u[Ci].point.y; + if (Hi.setBounds({ x: 0, y: -Yt, width: this.pixelWidth, height: Ji + Yt }), Hi.invalid && Hi.validate(), Hi.toBack(), (Ji = kf({ x: 0, y: Hi.label.pixelY - Hi.pixelY + sr - Hi.pixelMarginTop }, Hi).y) < -Yt) { + Gi = !0; + break; + } + } + if (Vt <= ci + (ai - ci) / 2 || Gi) + for (var Or = ci, yr = (Ci = 0, u.length); Ci < yr; Ci++) { + var As = u[Ci].series; + sr = u[Ci].point.y, (Hi = As.tooltip).setBounds({ x: 0, y: Or, width: this.pixelWidth, height: ai }), Hi.invalid && Hi.validate(), Hi.toBack(), Or = kf({ x: 0, y: Hi.label.pixelY + Hi.label.measuredHeight - Hi.pixelY + sr + Hi.pixelMarginBottom }, Hi).y; + } + } + } + }, R.prototype.showAxisTooltip = function(u, w, $) { + var G = this; + er(u.iterator(), function(K) { + $ && $.indexOf(K) != -1 || (G.dataItems.length > 0 || K.dataItems.length > 0) && K.showTooltipAtPosition(w); + }); + }, R.prototype.getUpdatedRange = function(u, w) { + if (u) { + var $, G; + u.renderer.inversed ? (m(w), $ = 1 - u.end, G = 1 - u.start) : ($ = u.start, G = u.end); + var K = G - $; + return { start: $ + w.start * K, end: $ + w.end * K }; + } + }, R.prototype.handleCursorZoomEnd = function(u) { + var w = this.cursor, $ = w.behavior; + if ($ == "zoomX" || $ == "zoomXY") { + var G = w.xRange; + G && this.xAxes.length > 0 && ((G = this.getUpdatedRange(this.xAxes.getIndex(0), G)).priority = "start", this.zoomAxes(this.xAxes, G)); + } + if ($ == "zoomY" || $ == "zoomXY") { + var K = w.yRange; + K && this.yAxes.length > 0 && ((K = this.getUpdatedRange(this.yAxes.getIndex(0), K)).priority = "start", this.zoomAxes(this.yAxes, K)); + } + this.handleHideCursor(); + }, R.prototype.handleCursorPanStart = function(u) { + var w = this.xAxes.getIndex(0); + w && (this._panStartXRange = { start: w.start, end: w.end }, w.renderer.inversed && (this._panStartXRange = m(this._panStartXRange))); + var $ = this.yAxes.getIndex(0); + $ && (this._panStartYRange = { start: $.start, end: $.end }, $.renderer.inversed && (this._panStartYRange = m(this._panStartYRange))); + }, R.prototype.handleCursorPanEnd = function(u) { + var w = this.cursor, $ = w.behavior; + if (this._panEndXRange && ($ == "panX" || $ == "panXY")) { + var G = this._panEndXRange, K = this._panStartXRange, ne = 0; + G.start < 0 && (ne = G.start), K.end > 1 ? G.end > K.end && (ne = G.end - K.end) : G.end > 1 && (ne = G.end - 1), this.zoomAxes(this.xAxes, { start: G.start - ne, end: G.end - ne }, !1, w.snapOnPan), this._panEndXRange = void 0, this._panStartXRange = void 0; + } + !this._panEndYRange || $ != "panY" && $ != "panXY" || (ne = 0, (G = this._panEndYRange).start < 0 && (ne = G.start), G.end > 1 && (ne = G.end - 1), this.zoomAxes(this.yAxes, { start: G.start - ne, end: G.end - ne }, !1, w.snapOnPan), this._panEndYRange = void 0, this._panStartYRange = void 0); + }, R.prototype.handleCursorCanceled = function() { + this._panEndXRange = void 0, this._panStartXRange = void 0; + }, R.prototype.handleCursorPanning = function(u) { + var w = this.cursor, $ = w.behavior, G = w.maxPanOut; + if (this._panStartXRange && ($ == "panX" || $ == "panXY")) { + var K = this._panStartXRange, ne = w.xRange, ue = this.getCommonAxisRange(this.xAxes), we = K.end - K.start, De = ne.start * (ue.end - ue.start), $e = Math.max(-G, De + K.start), Ke = Math.min(De + K.end, 1 + G); + $e <= 0 && (Ke = $e + we), Ke >= 1 && ($e = Ke - we); + var Ze = { start: $e, end: Ke }; + this._panEndXRange = Ze, this.zoomAxes(this.xAxes, Ze, !1, !1, w.maxPanOut); + } + !this._panStartYRange || $ != "panY" && $ != "panXY" || (K = this._panStartYRange, ne = w.yRange, ue = this.getCommonAxisRange(this.yAxes), we = K.end - K.start, De = ne.start * (ue.end - ue.start), $e = Math.max(-G, De + K.start), Ke = Math.min(De + K.end, 1 + G), $e <= 0 && (Ke = $e + we), Ke >= 1 && ($e = Ke - we), Ze = { start: $e, end: Ke }, this._panEndYRange = Ze, this.zoomAxes(this.yAxes, Ze, !1, !1, w.maxPanOut)), this.handleHideCursor(); + }, R.prototype.handleYAxisSet = function(u) { + }, R.prototype.handleCursorZoomStart = function(u) { + }, Object.defineProperty(R.prototype, "scrollbarX", { get: function() { + return this._scrollbarX; + }, set: function(u) { + var w = this; + this._scrollbarX && this.removeDispose(this._scrollbarX), this._scrollbarX = u, u && (this._disposers.push(u), u.parent = this.topAxesContainer, u.shouldClone = !1, u.startGrip.exportable = !1, u.endGrip.exportable = !1, u.toBack(), u.orientation = "horizontal", u.events.on("rangechanged", this.handleXScrollbarChange, this, !1), this.events.on("datavalidated", function() { + return u.updateThumb(!1); + }, this, !1), u.adapter.add("positionValue", function($) { + var G = w.xAxes.getIndex(0); + return G && ($.value = G.getPositionLabel(G.renderer.inversed ? 1 - $.position : $.position)), $; + })); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "scrollbarY", { get: function() { + return this._scrollbarY; + }, set: function(u) { + var w = this; + this._scrollbarY && this.removeDispose(this._scrollbarY), this._scrollbarY = u, u && (this._disposers.push(u), u.parent = this.rightAxesContainer, u.startGrip.exportable = !1, u.shouldClone = !1, u.endGrip.exportable = !1, u.toFront(), u.orientation = "vertical", u.events.on("rangechanged", this.handleYScrollbarChange, this, !1), this.events.on("datavalidated", function() { + return u.updateThumb(!1); + }, this, !1), u.adapter.add("positionValue", function($) { + var G = w.yAxes.getIndex(0); + return G && ($.value = G.getPositionLabel($.position)), $; + })); + }, enumerable: !0, configurable: !0 }), R.prototype.handleXScrollbarChange = function(u) { + if (this.inited) { + var w = u.target, $ = w.range; + $.start == 0 && ($.priority = "start"), $.end == 1 && ($.priority = "end"), $ = this.zoomAxes(this.xAxes, $), w.fixRange($); + } + }, R.prototype.handleYScrollbarChange = function(u) { + if (this.inited) { + var w = u.target, $ = w.range; + $.end == 1 && ($.priority = "end"), $.start == 0 && ($.priority = "start"), $ = this.zoomAxes(this.yAxes, $), w.fixRange($); + } + }, R.prototype.zoomAxes = function(u, w, $, G, K, ne) { + var ue = { start: 0, end: 1 }; + this.showSeriesTooltip(); + var we = w; + return this.dataInvalid || er(u.iterator(), function(De) { + var $e = De.maxZoomFactor; + if (le(De.minZoomCount) && ($e /= De.minZoomCount), !(ne && 1 / (w.end - w.start) >= $e)) { + if (De.zoomable) { + if (w = De.renderer.inversed ? m(we) : we, De.hideTooltip(0), G) + if (De instanceof Eh) { + var Ke = De.getCellEndPosition(0) - De.getCellStartPosition(0); + w.start = De.roundPosition(w.start + Ke / 2 - De.startLocation * Ke, De.startLocation), w.end = De.roundPosition(w.end - Ke / 2 + (1 - De.endLocation) * Ke, De.endLocation); + } else + w.start = De.roundPosition(w.start + 1e-4, 0, De.startLocation), w.end = De.roundPosition(w.end + 1e-4, 0, De.endLocation); + var Ze = De.zoom(w, $, $, K); + De.renderer.inversed && (Ze = m(Ze)), ue = Ze; + } + } + }), ue; + }, Object.defineProperty(R.prototype, "maskBullets", { get: function() { + return this.getPropertyValue("maskBullets"); + }, set: function(u) { + this.setPropertyValue("maskBullets", u, !0) && this.bulletsContainer && (this.bulletsContainer.mask = u ? this._bulletMask : void 0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "arrangeTooltips", { get: function() { + return this.getPropertyValue("arrangeTooltips"); + }, set: function(u) { + this.setPropertyValue("arrangeTooltips", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.handleWheel = function(u) { + var w = this.plotContainer, $ = ff(Xl(u.point, this.htmlContainer, this.svgContainer.cssScale), w), G = u.shift.y; + this.handleWheelReal(G, this.mouseWheelBehavior, $); + }, R.prototype.handleHorizontalWheel = function(u) { + var w = this.plotContainer, $ = ff(Xl(u.point, this.htmlContainer, this.svgContainer.cssScale), w); + this.handleWheelReal(u.shift.x, this.horizontalMouseWheelBehavior, $); + }, R.prototype.handleWheelReal = function(u, w, $) { + if (u != 0) { + var G = this.plotContainer, K = this.getCommonAxisRange(this.xAxes), ne = this.getCommonAxisRange(this.yAxes), ue = 0.1; + if (w == "panX" || w == "panXY") { + var we = K.end - K.start, De = Math.max(-0, K.start + ue * u / 100 * (K.end - K.start)), $e = Math.min(K.end + ue * u / 100 * (K.end - K.start), 1); + De <= 0 && ($e = De + we), $e >= 1 && (De = $e - we), this.zoomAxes(this.xAxes, { start: De, end: $e }); + } + if (w == "panY" || w == "panXY") { + u *= -1; + var Ke = ne.end - ne.start, Ze = Math.max(-0, ne.start + ue * u / 100 * (ne.end - ne.start)), pt = Math.min(ne.end + ue * u / 100 * (ne.end - ne.start), 1); + Ze <= 0 && (pt = Ze + Ke), pt >= 1 && (Ze = pt - Ke), this.zoomAxes(this.yAxes, { start: Ze, end: pt }); + } + if (w == "zoomX" || w == "zoomXY") { + var Vt = $.x / G.maxWidth, Yt = this.xAxes.getIndex(0).toAxisPosition(Vt); + De = Math.max(-0, K.start - ue * (K.end - K.start) * u / 100 * Vt), De = Math.min(De, Yt), $e = Math.min(K.end + ue * (K.end - K.start) * u / 100 * (1 - Vt), 1), $e = Math.max($e, Yt), this.zoomAxes(this.xAxes, { start: De, end: $e }, void 0, void 0, void 0, !0); + } + if (w == "zoomY" || w == "zoomXY") { + var ci = $.y / G.maxHeight, ai = this.yAxes.getIndex(0).toAxisPosition(ci); + Ze = Math.max(-0, ne.start - ue * (ne.end - ne.start) * u / 100 * (1 - ci)), Ze = Math.min(Ze, ai), pt = Math.min(ne.end + ue * u / 100 * ci * (ne.end - ne.start), 1), pt = Math.max(pt, ai), this.zoomAxes(this.yAxes, { start: Ze, end: pt }, void 0, void 0, void 0, !0); + } + } + }, Object.defineProperty(R.prototype, "mouseWheelBehavior", { get: function() { + return this.getPropertyValue("mouseWheelBehavior"); + }, set: function(u) { + this.setPropertyValue("mouseWheelBehavior", u) && (u != "none" ? (this._mouseWheelDisposer = this.plotContainer.events.on("wheel", this.handleWheel, this, !1), this._disposers.push(this._mouseWheelDisposer)) : this._mouseWheelDisposer && (this.plotContainer.wheelable = !1, this.plotContainer.hoverable = !1, this._mouseWheelDisposer.dispose())); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "horizontalMouseWheelBehavior", { get: function() { + return this.getPropertyValue("horizontalMouseWheelBehavior"); + }, set: function(u) { + this.setPropertyValue("horizontalMouseWheelBehavior", u) && (u != "none" ? (this._mouseWheelDisposer2 = this.plotContainer.events.on("wheel", this.handleHorizontalWheel, this, !1), this._disposers.push(this._mouseWheelDisposer2)) : this._mouseWheelDisposer2 && (this.plotContainer.wheelable = !1, this.plotContainer.hoverable = !1, this._mouseWheelDisposer2.dispose())); + }, enumerable: !0, configurable: !0 }), R.prototype.dataSourceDateFields = function(u) { + var w = this; + return u = U.prototype.dataSourceDateFields.call(this, u), er(this.series.iterator(), function($) { + u = w.populateDataSourceFields(u, $.dataFields, ["dateX", "dateY", "openDateX", "openDateY"]); + }), u; + }, R.prototype.dataSourceNumberFields = function(u) { + var w = this; + return u = U.prototype.dataSourceDateFields.call(this, u), er(this.series.iterator(), function($) { + u = w.populateDataSourceFields(u, $.dataFields, ["valueX", "valueY", "openValueX", "openValueY"]); + }), u; + }, R.prototype.processConfig = function(u) { + if (u) { + var w = [], $ = []; + if (Ee(u.xAxes) && gt(u.xAxes)) + for (var G = 0, K = u.xAxes.length; G < K; G++) { + if (!u.xAxes[G].type) + throw Error("[XYChart error] No type set for xAxes[" + G + "]."); + if (Ee(u.xAxes[G].axisRanges)) { + for (var ne = 0, ue = u.xAxes[G].axisRanges.length; ne < ue; ne++) + Ee((De = u.xAxes[G].axisRanges[ne]).date) && st(De.date) && (De.date = this.dateFormatter.parse(De.date)), Ee(De.endDate) && st(De.endDate) && (De.endDate = this.dateFormatter.parse(De.endDate)); + w.push({ axisRanges: u.xAxes[G].axisRanges, index: G }), delete u.xAxes[G].axisRanges; + } + } + if (Ee(u.yAxes) && gt(u.yAxes)) + for (G = 0, K = u.yAxes.length; G < K; G++) { + if (!u.yAxes[G].type) + throw Error("[XYChart error] No type set for yAxes[" + G + "]."); + if (Ee(u.yAxes[G].axisRanges)) { + ne = 0; + for (var we = u.yAxes[G].axisRanges.length; ne < we; ne++) { + var De; + Ee((De = u.yAxes[G].axisRanges[ne]).date) && st(De.date) && (De.date = this.dateFormatter.parse(De.date)), Ee(De.endDate) && st(De.endDate) && (De.endDate = this.dateFormatter.parse(De.endDate)); + } + $.push({ axisRanges: u.yAxes[G].axisRanges, index: G }), delete u.yAxes[G].axisRanges; + } + } + if (Ee(u.series) && gt(u.series)) + for (G = 0, K = u.series.length; G < K; G++) + u.series[G].type = u.series[G].type || "LineSeries"; + if (Ee(u.cursor) && !Ee(u.cursor.type) && (u.cursor.type = "XYCursor"), Ee(u.scrollbarX) && !Ee(u.scrollbarX.type) && (u.scrollbarX.type = "Scrollbar"), Ee(u.scrollbarY) && !Ee(u.scrollbarY.type) && (u.scrollbarY.type = "Scrollbar"), U.prototype.processConfig.call(this, u), $.length) + for (G = 0, K = $.length; G < K; G++) + this.yAxes.getIndex($[G].index).config = { axisRanges: $[G].axisRanges }; + if (w.length) + for (G = 0, K = w.length; G < K; G++) + this.xAxes.getIndex(w[G].index).config = { axisRanges: w[G].axisRanges }; + } + }, R.prototype.configOrder = function(u, w) { + return u == w ? 0 : u == "scrollbarX" ? 1 : w == "scrollbarX" ? -1 : u == "scrollbarY" ? 1 : w == "scrollbarY" ? -1 : u == "cursor" ? 1 : w == "cursor" ? -1 : u == "series" ? 1 : w == "series" ? -1 : U.prototype.configOrder.call(this, u, w); + }, R.prototype.createSeries = function() { + return new BC(); + }, Object.defineProperty(R.prototype, "zoomOutButton", { get: function() { + return this._zoomOutButton; + }, set: function(u) { + var w = this; + this._zoomOutButton = u, u && u.events.on("hit", function() { + w.zoomAxes(w.xAxes, { start: 0, end: 1 }), w.zoomAxes(w.yAxes, { start: 0, end: 1 }); + }, void 0, !1); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + var w = this; + u.xAxes.each(function($) { + var G = w.xAxes.push($.clone()); + G.chart = w, G.renderer.chart = w; + }), u.yAxes.each(function($) { + var G = w.yAxes.push($.clone()); + G.renderer.chart = w, G.chart = w; + }), U.prototype.copyFrom.call(this, u), u.cursor && (this.cursor = u.cursor.clone()), u.scrollbarX && (this.scrollbarX = u.scrollbarX.clone()), u.scrollbarY && (this.scrollbarY = u.scrollbarY.clone()); + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this); + var u = this.scrollbarX; + u && u instanceof VC && u.scrollbarChart.disposeData(); + var w = this.scrollbarY; + w && w instanceof VC && w.scrollbarChart.disposeData(), this.xAxes.each(function($) { + $ instanceof Eh && $.disposeData(); + }), this.yAxes.each(function($) { + $ instanceof Eh && $.disposeData(); + }); + }, R.prototype.addData = function(u, w) { + this.scrollbarX instanceof VC && this.addScrollbarData(this.scrollbarX, w), this.scrollbarY instanceof VC && this.addScrollbarData(this.scrollbarY, w), U.prototype.addData.call(this, u, w); + }, R.prototype.addScrollbarData = function(u, w) { + var $ = u.scrollbarChart; + $._parseDataFrom = $.data.length, $.invalidateData(); + }, R.prototype.removeScrollbarData = function(u, w) { + var $ = u.scrollbarChart; + if (le(w)) { + for (; w > 0; ) { + var G = this.dataItems.getIndex(0); + G && $.dataItems.remove(G), $.dataUsers.each(function(K) { + var ne = K.dataItems.getIndex(0); + ne && K.dataItems.remove(ne); + }), $._parseDataFrom--, w--; + } + $.invalidateData(); + } + }, R.prototype.removeData = function(u) { + this.scrollbarX instanceof VC && this.removeScrollbarData(this.scrollbarX, u), this.scrollbarY instanceof VC && this.removeScrollbarData(this.scrollbarY, u), U.prototype.removeData.call(this, u); + }, R.prototype.setTapToActivate = function(u) { + U.prototype.setTapToActivate.call(this, u), this.cursor && (this.cursor.interactions.isTouchProtected = u, this.plotContainer.interactions.isTouchProtected = u); + }, R.prototype.handleTapToActivate = function() { + U.prototype.handleTapToActivate.call(this), this.cursor && (this.cursor.interactions.isTouchProtected = !1, this.plotContainer.interactions.isTouchProtected = !1); + }, R.prototype.handleTapToActivateDeactivation = function() { + U.prototype.handleTapToActivateDeactivation.call(this), this.cursor && (this.cursor.interactions.isTouchProtected = !0, this.plotContainer.interactions.isTouchProtected = !0); + }, R; + }(Z8); + hi.registeredClasses.XYChart = Hy, Wd.push({ relevant: gf.maybeXS, state: function(U, R) { + if (U instanceof Hy && U.scrollbarX) { + var u = U.states.create(R); + return U.scrollbarX.states.create(R).properties.disabled = !0, u; + } + return null; + } }), Wd.push({ relevant: gf.maybeXS, state: function(U, R) { + if (U instanceof Hy && U.scrollbarY) { + var u = U.states.create(R); + return U.scrollbarY.states.create(R).properties.disabled = !0, u; + } + return null; + } }); + var n9 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "LineSeriesSegment", u.isMeasured = !1, u.interactionsEnabled = !1, u.layout = "none"; + var w = u.createChild(so); + u.fillSprite = w, w.shouldClone = !1, w.setElement(u.paper.add("path")), w.isMeasured = !1, u._disposers.push(w); + var $ = u.createChild(so); + return u.strokeSprite = $, $.shouldClone = !1, $.fill = We(), $.setElement(u.paper.add("path")), $.isMeasured = !1, u._disposers.push($), u; + } + return re(R, U), R.prototype.drawSegment = function(u, w, $, G) { + if (!this.disabled) + if (u.length > 0 && w.length > 0 && le(u[0].x) && le(u[0].y)) { + var K = pn({ x: u[0].x - 0.2, y: u[0].y - 0.2 }) + pn(u[0]), ne = this.series; + ne.smoothing == "bezier" ? K += new Kv($, G).smooth(u) : ne.smoothing == "monotoneX" ? K += new Ire({ closed: !1 }).smooth(u) : ne.smoothing == "monotoneY" && (K += new Are({ closed: !1 }).smooth(u)), this.strokeOpacity == 0 || this.strokeSprite.strokeOpacity == 0 || (this.strokeSprite.path = K), (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) && le(w[0].x) && le(w[0].y) && (K += xr(w[0]), ne.smoothing == "bezier" ? K += new Kv($, G).smooth(w) : ne.smoothing == "monotoneX" ? K += new Ire({ closed: !1 }).smooth(w) : ne.smoothing == "monotoneY" && (K += new Are({ closed: !1 }).smooth(w)), K += xr(u[0]), K += " Z", this.fillSprite.path = K); + } else + this.fillSprite.path = "", this.strokeSprite.path = ""; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u); + var w = this.strokeSprite; + _r(u, w.properties, lc), w.events.copyFrom(u.strokeSprite.events), w.fillOpacity = 0; + var $ = this.fillSprite; + _r(u, $.properties, lc), $.events.copyFrom(u.fillSprite.events), $.strokeOpacity = 0; + }, R; + }(Qn); + hi.registeredClasses.LineSeriesSegment = n9; + var Bre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "DurationAxisDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(ML), DL = function(U) { + function R() { + var u = U.call(this) || this; + return u._baseUnit = "second", u.className = "DurationAxis", u.setPropertyValue("maxZoomFactor", 1e6), u.applyTheme(), u; + } + return re(R, U), R.prototype.formatLabel = function(u, w) { + return this.durationFormatter.format(u, w || this.axisDurationFormat); + }, R.prototype.adjustMinMax = function(u, w, $, G, K) { + var ne, ue, we, De = this.baseUnit; + if (this.setPropertyValue("maxPrecision", 0), De == "millisecond" || De == "second" || De == "minute" || De == "hour") { + G <= 1 && (G = 1), G = Math.round(G); + var $e = u, Ke = w; + $ === 0 && ($ = Math.abs(w)); + var Ze, pt = [60, 30, 20, 15, 10, 2, 1], Vt = 1; + De == "hour" && (pt = [24, 12, 6, 4, 2, 1]); + try { + for (var Yt = Se(pt), ci = Yt.next(); !ci.done; ci = Yt.next()) { + var ai = ci.value; + if ($ / ai > G) { + Vt = ai; + break; + } + } + } catch (Hi) { + ne = { error: Hi }; + } finally { + try { + ci && !ci.done && (ue = Yt.return) && ue.call(Yt); + } finally { + if (ne) + throw ne.error; + } + } + var Gi = Math.ceil((w - u) / Vt / G), Ji = Math.log(Math.abs(Gi)) * Math.LOG10E, Ci = Math.pow(10, Math.floor(Ji)) / 10; + Ze = Vt * (Gi = T(pt, Gi / Ci) * Ci), this.durationFormatter.getValueUnit(Ze, this.baseUnit), u = Math.floor(u / Ze) * Ze, w = Math.ceil(w / Ze) * Ze, K && ((u -= Ze) < 0 && $e >= 0 && (u = 0), (w += Ze) > 0 && Ke <= 0 && (w = 0)), we = { min: u, max: w, step: Ze }; + } else + we = U.prototype.adjustMinMax.call(this, u, w, $, G, K); + return this.axisDurationFormat = this.durationFormatter.getFormat(we.step, we.max, this.baseUnit), we; + }, Object.defineProperty(R.prototype, "tooltipDurationFormat", { get: function() { + return this._tooltipDurationFormat; + }, set: function(u) { + this._tooltipDurationFormat = u; + }, enumerable: !0, configurable: !0 }), R.prototype.getTooltipText = function(u) { + var w = He(this.positionToValue(u), this._stepDecimalPlaces), $ = this.formatLabel(w, this.tooltipDurationFormat); + return this._adapterO ? this._adapterO.apply("getTooltipText", $) : $; + }, Object.defineProperty(R.prototype, "baseUnit", { get: function() { + return this._baseUnit; + }, set: function(u) { + this._baseUnit != u && (this._baseUnit = u, this.durationFormatter.baseUnit = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.baseUnit = u.baseUnit; + }, R; + }(vo); + hi.registeredClasses.DurationAxis = DL, hi.registeredClasses.DurationAxisDataItem = Bre; + var FL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "LineSeriesDataItem", u; + } + return re(R, U), R; + }(Dm), s9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.minDistance = 0.5, u.segments = new Xs(u.createSegment()), u.segments.template.applyOnClones = !0, u._disposers.push(new Wo(u.segments)), u._disposers.push(u.segments.template), u._segmentsIterator = new Mp(u.segments, function() { + return u.segments.create(); + }), u._segmentsIterator.createNewItems = !0, u.className = "LineSeries", u.strokeOpacity = 1, u.fillOpacity = 0, u.connect = !0, u.tensionX = 1, u.tensionY = 1, u.autoGapCount = 1.1, u.smoothing = "bezier", u.segmentsContainer = u.mainContainer.createChild(Qn), u.segmentsContainer.isMeasured = !1, u.bulletsContainer.toFront(), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Line Series")); + }, R.prototype.createSegment = function() { + return new n9(); + }, R.prototype.createDataItem = function() { + return new FL(); + }, R.prototype.setInitialWorkingValues = function(u) { + var w = this._yAxis.get(), $ = this._xAxis.get(); + if (this.appeared && this.visible) { + var G = this.dataItems.getIndex(u.index - 1); + if (u.component = this, this.baseAxis == $ && w instanceof vo) { + var K = w.minZoomed; + if (G && (K = G.values.valueY.workingValue), u.setWorkingValue("valueY", K, 0), u.setWorkingValue("valueY", u.values.valueY.value), $ instanceof Ju) + u.setWorkingLocation("dateX", u.locations.dateX - 1, 0), u.setWorkingLocation("dateX", u.locations.dateX); + else if ($ instanceof DL && G) { + var ne = u.valueX; + u.setWorkingValue("valueX", G.valueX, 0), u.setWorkingValue("valueX", ne); + } + } + if (this.baseAxis == w && $ instanceof vo) { + var ue = $.minZoomed; + G && (ue = G.values.valueX.workingValue), u.setWorkingValue("valueX", ue, 0), u.setWorkingValue("valueX", u.values.valueX.value), w instanceof Ju ? (u.setWorkingLocation("dateY", u.locations.dateX - 1, 0), u.setWorkingLocation("dateY", u.locations.dateY)) : w instanceof DL && G && (ne = u.valueY, u.setWorkingValue("valueY", G.valueY, 0), u.setWorkingValue("valueY", ne)); + } + } else + this.baseAxis == $ && w instanceof vo && ($ instanceof Ju && u.setWorkingLocation("dateX", u.locations.dateX), $ instanceof Eh && u.setWorkingLocation("categoryX", u.locations.categoryX)), this.baseAxis == w && $ instanceof vo && (w instanceof Ju && u.setWorkingLocation("dateY", u.locations.dateY), w instanceof Eh && u.setWorkingLocation("categoryY", u.locations.categoryY)); + }, R.prototype.updateLegendValue = function(u, w) { + U.prototype.updateLegendValue.call(this, u, w), u && u.segment && (this.tooltipColorSource = u.segment); + }, R.prototype.validate = function() { + var u = this; + U.prototype.validate.call(this), this.xAxis && this.yAxis && (this._segmentsIterator.reset(), this.openSegmentWrapper(this._adjustedStartIndex), er(this.axisRanges.iterator(), function(w) { + u.openSegmentWrapper(u._adjustedStartIndex, w); + }), er(this._segmentsIterator.iterator(), function(w) { + w.__disabled = !0; + })); + }, R.prototype.sliceData = function() { + for (var u = this.startIndex, w = this.endIndex, $ = this.startIndex - 1; $ >= 0; $--) + if ((K = this.dataItems.getIndex($)) && K.hasValue(this._xValueFields) && K.hasValue(this._yValueFields)) { + u = $; + break; + } + this._adjustedStartIndex = this.findAdjustedIndex(u, ["stroke", "strokeWidth", "strokeDasharray", "strokeOpacity", "fill", "fillOpacity", "opacity"]), $ = this.endIndex; + for (var G = this.dataItems.length; $ < G; $++) { + var K; + if ((K = this.dataItems.getIndex($)) && K.hasValue(this._xValueFields) && K.hasValue(this._yValueFields)) { + w = $ + 1; + break; + } + } + this._workingStartIndex = u, this._workingEndIndex = w; + }, R.prototype.findAdjustedIndex = function(u, w) { + var $ = this, G = this.propertyFields, K = u; + return _i(w, function(ne) { + if (Ee(G[ne])) + for (var ue = K; ue >= 0; ue--) { + var we = $.dataItems.getIndex(ue); + if (we && Ee(we.properties[ne])) { + u > ue && (u = ue); + break; + } + } + }), u; + }, R.prototype.openSegmentWrapper = function(u, w) { + var $ = { index: u, axisRange: w }; + do + $ = this.openSegment($.index, $.axisRange); + while ($); + }, R.prototype.getSegment = function() { + var u = this._segmentsIterator.getFirst(); + return u.series = this, u.isDisposed() ? (this.segments.removeValue(u), this.getSegment()) : u; + }, R.prototype.openSegment = function(u, w) { + var $ = !1, G = []; + u = Math.min(u, this.dataItems.length); + var K, ne = Math.min(this._workingEndIndex, this.dataItems.length); + this._workingEndIndex = Math.min(this._workingEndIndex, this.dataItems.length); + var ue = !1, we = this.getSegment(); + we.strokeDasharray = void 0, we.__disabled = !1, w ? (we.parent = w.contents, _r(w.contents, we, lc)) : (_r(this, we, lc), we.filters.clear(), we.parent = this.segmentsContainer), this.group.node.removeAttribute("fill"); + for (var De = this.connect, $e = !1, Ke = u; Ke < ne; Ke++) { + var Ze = this.dataItems.getIndex(Ke); + if (Ze.segment = we, Ze.hasProperties && (Ke == u ? this.updateSegmentProperties(Ze.properties, we) : ue = this.updateSegmentProperties(Ze.properties, we, !0)), Ze.hasValue(this._xValueFields) && Ze.hasValue(this._yValueFields)) + this.addPoints(G, Ze, this.xField, this.yField), $e = !0; + else { + if (Ke == u) + continue; + if (!De && $e) { + K = Ke; + break; + } + } + if (K = Ke, this.baseAxis instanceof Ju) { + var pt = this.dataItems.getIndex(Ke + 1); + if (pt && this.baseAxis.makeGap(pt, Ze)) { + $ = !0; + break; + } + } + if (ue) + break; + } + return this.closeSegment(we, G, u, K, w, $); + }, R.prototype.addPoints = function(u, w, $, G, K) { + var ne = this.getPoint(w, $, G, w.workingLocations[$], w.workingLocations[G]); + K || (w.point = ne), u.push(ne); + }, R.prototype.closeSegment = function(u, w, $, G, K, ne) { + var ue = []; + if (this.dataFields[this._xOpenField] || this.dataFields[this._yOpenField] || this.stacked) + for (var we = G; we >= $; we--) { + var De = this.dataItems.getIndex(we); + De.hasValue(this._xValueFields) && De.hasValue(this._yValueFields) && this.addPoints(ue, De, this.xOpenField, this.yOpenField, !0); + } + else { + var $e = this.baseAxis, Ke = w.length, Ze = this.xAxis, pt = this.yAxis; + Ke > 0 && ($e == Ze ? (ue.push({ x: w[Ke - 1].x, y: pt.basePoint.y }), ue.push({ x: w[0].x, y: pt.basePoint.y })) : (ue.push({ x: Ze.basePoint.x, y: w[Ke - 1].y }), ue.push({ x: Ze.basePoint.x, y: w[0].y }))); + } + return this.drawSegment(u, w, ue), ne && G++, G < this._workingEndIndex - 1 ? { index: G, axisRange: K } : null; + }, R.prototype.drawSegment = function(u, w, $) { + u.drawSegment(w, $, this.tensionX, this.tensionY); + }, R.prototype.updateSegmentProperties = function(u, w, $) { + var G = !1; + return mi(u, function(K, ne) { + if (Ee(ne)) { + var ue = w[K], we = void 0; + ue && (we = ue.toString ? ue.toString() : ue); + var De = void 0; + ne && (De = ne.toString ? ne.toString() : ne), ue == ne || we != null && De != null && we == De || ($ || (w[K] = ne), G = !0); + } + }), G; + }, Object.defineProperty(R.prototype, "connect", { get: function() { + return this.getPropertyValue("connect"); + }, set: function(u) { + this.setPropertyValue("connect", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tensionX", { get: function() { + return this.getPropertyValue("tensionX"); + }, set: function(u) { + this.setPropertyValue("tensionX", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tensionY", { get: function() { + return this.getPropertyValue("tensionY"); + }, set: function(u) { + this.setPropertyValue("tensionY", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.createLegendMarker = function(u) { + var w = this, $ = u.pixelWidth, G = u.pixelHeight; + u.disposeChildren(); + var K = u.createChild(q0); + if (K.shouldClone = !1, _r(this, K, lc), K.x2 = $, K.y = G / 2, K.y2 = 1e-5, K.visible = !0, this.fillOpacity > 0) { + var ne = u.createChild(MC); + _r(this, ne, lc), ne.width = $, ne.height = G, ne.y = 0, ne.strokeOpacity = 0, ne.visible = !0, K.y = 0; + } + var ue = u.dataItem; + ue.color = this.stroke, ue.colorOrig = this.fill, Zr(this.bullets.iterator(), function(we) { + if (we instanceof Mo && !we.copyToLegendMarker) + return !1; + var De = !1; + if (we instanceof Qn && er(we.children.iterator(), function(Ke) { + if (Ke instanceof Rm) + return De = !0, !0; + }), !De) { + var $e = we.clone(); + return $e.parent = u, $e.isMeasured = !0, $e.tooltipText = void 0, $e.x = $ / 2, w.fillOpacity > 0 ? $e.y = 0 : $e.y = G / 2, $e.visible = !0, Ee($e.fill) || ($e.fill = w.fill), Ee($e.stroke) || ($e.stroke = w.stroke), !1; + } + }); + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this), this.segments.clear(); + }, Object.defineProperty(R.prototype, "autoGapCount", { get: function() { + return this.getPropertyValue("autoGapCount"); + }, set: function(u) { + this.setPropertyValue("autoGapCount", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "smoothing", { get: function() { + return this.getPropertyValue("smoothing"); + }, set: function(u) { + this.setPropertyValue("smoothing", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(BC); + hi.registeredClasses.LineSeries = s9, hi.registeredClasses.LineSeriesDataItem = FL; + var o9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarSeriesDataItem", u.setLocation("dateX", 0, 0), u.setLocation("dateY", 0, 0), u.setLocation("categoryX", 0, 0), u.setLocation("categoryY", 0, 0), u.applyTheme(), u; + } + return re(R, U), R; + }(FL), DH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarSeries", u.connectEnds = !0, u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + this.chart.invalid && this.chart.validate(), U.prototype.validate.call(this); + }, R.prototype.createDataItem = function() { + return new o9(); + }, R.prototype.getPoint = function(u, w, $, G, K, ne, ue) { + ne || (ne = "valueX"), ue || (ue = "valueY"); + var we = C({ x: this.yAxis.getX(u, $, K, ue), y: this.yAxis.getY(u, $, K, ue) }); + we == 0 && (we = 1e-5); + var De = this.xAxis.getAngle(u, w, G, ne), $e = this.chart.startAngle, Ke = this.chart.endAngle; + return De < $e || De > Ke ? void 0 : { x: we * A(De), y: we * Ue(De) }; + }, R.prototype.addPoints = function(u, w, $, G, K) { + var ne = this.getPoint(w, $, G, w.locations[$], w.locations[G]); + ne && u.push(ne); + }, R.prototype.getMaskPath = function() { + var u = this.yAxis.renderer; + return r2(u.startAngle, u.endAngle - u.startAngle, u.pixelRadius, u.pixelInnerRadius); + }, R.prototype.drawSegment = function(u, w, $) { + var G = this.yAxis.renderer; + this.connectEnds && Math.abs(G.endAngle - G.startAngle) == 360 && (this.dataFields[this._xOpenField] || this.dataFields[this._yOpenField] || this.stacked) && (w.push(w[0]), $.length > 0 && $.unshift($[$.length - 1])), U.prototype.drawSegment.call(this, u, w, $); + }, Object.defineProperty(R.prototype, "connectEnds", { get: function() { + return this.getPropertyValue("connectEnds"); + }, set: function(u) { + this.setPropertyValue("connectEnds", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.positionBulletReal = function(u, w, $) { + var G = this.xAxis, K = this.yAxis; + (w < G.start || w > G.end || $ < K.start || $ > K.end) && (u.visible = !1), u.moveTo(this.xAxis.renderer.positionToPoint(w, $)); + }, R.prototype.setXAxis = function(u) { + U.prototype.setXAxis.call(this, u), this.updateRendererRefs(); + }, R.prototype.setYAxis = function(u) { + U.prototype.setYAxis.call(this, u), this.updateRendererRefs(); + }, R.prototype.updateRendererRefs = function() { + var u = this.xAxis.renderer, w = this.yAxis.renderer; + u.axisRendererY = w; + }, R; + }(s9); + hi.registeredClasses.RadarSeries = DH, hi.registeredClasses.RadarSeriesDataItem = o9; + var FH = function(U) { + function R(u) { + var w = U.call(this, u) || this; + return w.className = "AxisFillCircular", w.element = w.paper.add("path"), w.radius = ce(100), w.applyTheme(), w; + } + return re(R, U), R.prototype.draw = function() { + if (U.prototype.draw.call(this), !this.__disabled && !this.disabled && this.axis) { + var u = this.axis.renderer; + this.fillPath = u.getPositionRangePath(this.startPosition, this.endPosition, this.radius, Ee(this.innerRadius) ? this.innerRadius : u.innerRadius, this.cornerRadius), this.path = this.fillPath; + } + }, Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cornerRadius", { get: function() { + return this.getPropertyValue("cornerRadius"); + }, set: function(u) { + this.setPropertyValue("cornerRadius", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(Q8); + hi.registeredClasses.AxisFillCircular = FH; + var a9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "GridCircular", u.pixelPerfect = !1, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), R; + }(iR); + hi.registeredClasses.GridCircular = a9; + var LL = function(U) { + function R() { + var u = U.call(this) || this; + return u.fdx = 0, u.fdy = 0, u.className = "AxisLabelCircular", u.padding(0, 0, 0, 0), u.location = 0.5, u.locationOnPath = 0.5, u.radius = 0, u.isMeasured = !1, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "relativeRotation", { get: function() { + return this.getPropertyValue("relativeRotation"); + }, set: function(u) { + if (this.setPropertyValue("relativeRotation", u, !0), !Ee(u)) { + this.rotation = void 0; + var w = this.dataItem; + w && w.component && w.component.invalidateDataItems(); + } + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bent", { get: function() { + return this.getPropertyValue("bent"); + }, set: function(u) { + this.setPropertyValue("bent", u, !0), this.setPropertyValue("wrap", !1), this.setPropertyValue("horizontalCenter", "none"), this.setPropertyValue("verticalCenter", "none"), u ? (this.setPropertyValue("dx", 0), this.setPropertyValue("dy", 0), this.setPropertyValue("x", 0), this.setPropertyValue("y", 0), this.setPropertyValue("rotation", 0), this.fdx = 0, this.fdy = 0, this.textAlign = "middle") : this.textPathElement && (this.textPathElement.dispose(), this.textPathElement = void 0); + }, enumerable: !0, configurable: !0 }), R.prototype.pixelRadius = function(u) { + var w = 1; + return this.inside && (w = -1), vs(this.radius, u) * w; + }, R.prototype.pixelRadiusY = function(u, w) { + var $ = 1; + this.inside && ($ = -1); + var G = this.radius; + return le(G) ? vs(G *= w / u, u) * $ : vs(G, w) * $; + }, R.prototype.fixPosition = function(u, w, $, G, K) { + le($) || ($ = w), le(G) || (G = 0), le(K) || (K = 0); + var ne = { x: w * A(u), y: $ * Ue(u) }; + this.invalid && this.validate(); + var ue = !1, we = this.radius; + (we instanceof J && we.value < 0 || we < 0) && (ue = !0); + var De = this.relativeRotation, $e = this.pixelRadius(w); + if (this.bent) { + var Ke = { x: (w + $e) * A(u + 180), y: ($ + $e * $ / w) * Ue(u + 180) }; + return this.path = pn(Ke) + gd(u + 180, 360, w + $e, $ + $e * $ / w), void (this.textPathElement && this.textPathElement.attr({ startOffset: 100 * this.locationOnPath + "%" })); + } + if (le(De)) { + this.horizontalCenter = "none", this.verticalCenter = "none", u = Jt(u, -180, 180); + var Ze = this.bbox.width, pt = this.bbox.height, Vt = this.pixelPaddingBottom, Yt = this.pixelPaddingTop, ci = this.pixelPaddingLeft, ai = this.pixelPaddingRight; + u > 90 || u < -90 ? De == -90 && (De = 90, Ze = 0) : (De == -90 && (pt = -pt), De == 90 && (De = -90, Ze = -ci - ai, pt = -pt - Yt - Vt)), this.rotation = De + u + 90; + var Gi = Ue(De) / 2, Ji = A(De) / 2, Ci = this.rotation; + this.dx = pt * Gi * Ue(Ci) - Ze * Ji * A(Ci), this.dy = -pt * Gi * A(Ci) - Ze * Ji * Ue(Ci), this.inside ? u > 90 || u < -90 ? $e -= (Vt + Yt) * A(De) + (ci + ai) * Ue(De) : $e += (Vt + this.bbox.height + Yt) * A(De) + (ci + ai + this.bbox.width) * Ue(De) : $e += (pt + Vt + Yt) * A(De) + (Ze + ci + ai) * Ue(De), ne.x += A(u) * $e, ne.y += Ue(u) * $e * $ / w; + } else + this.horizontalCenter = "middle", this.verticalCenter = "middle", ue ? (this.dx = 0, this.dy = 0, ne.x = (w + $e) * A(u), ne.y = ($ + $e * $ / w) * Ue(u)) : (this.dy = this._measuredHeight / 2 * Ue(u), this.dx = this._measuredWidth / 2 * A(u), ne.x += A(u) * $e, ne.y += Ue(u) * $e * $ / w); + ne.x += G, ne.y += K, this.fdx = this.dx, this.fdy = this.dy, this.moveTo(ne); + }, R; + }(e9); + hi.registeredClasses.AxisLabelCircular = LL; + var LH = function(U) { + function R() { + var u = U.call(this) || this; + return u.pixelRadiusReal = 0, u.layout = "none", u.className = "AxisRendererCircular", u.isMeasured = !1, u.startAngle = -90, u.endAngle = 270, u.useChartAngles = !0, u.radius = ce(100), u.isMeasured = !1, u.grid.template.location = 0, u.labels.template.location = 0, u.labels.template.radius = 15, u.ticks.template.location = 0, u.ticks.template.pixelPerfect = !1, u.tooltipLocation = 0, u.line.strokeOpacity = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.setAxis = function(u) { + var w = this; + U.prototype.setAxis.call(this, u), u.isMeasured = !1; + var $ = u.tooltip; + $.adapter.add("dx", function(G, K) { + var ne = ff({ x: K.pixelX, y: K.pixelY }, w); + return w.pixelRadius * Math.cos(Math.atan2(ne.y, ne.x)) - ne.x; + }), $.adapter.add("dy", function(G, K) { + var ne = ff({ x: K.pixelX, y: K.pixelY }, w); + return w.pixelRadius * Math.sin(Math.atan2(ne.y, ne.x)) - ne.y; + }); + }, R.prototype.validate = function() { + this.chart && this.chart.invalid && this.chart.validate(), U.prototype.validate.call(this); + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + return 2 * Math.PI * this.pixelRadius; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !1, !1, 10, !1) && this.axis && this.axis.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelRadius", { get: function() { + return yo(this.radius, this.pixelRadiusReal) || 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + var u = this.chart, w = this.getPropertyValue("innerRadius"); + if (u) { + if (Ee(w)) { + if (w instanceof J && u) { + var $ = u.mr, G = w.value; + w = ce(100 * (G = Math.max($ * G, $ - Math.min(u.plotContainer.innerHeight, u.plotContainer.innerWidth)) / $)); + } + } else + (w = u.innerRadius) instanceof J && u && (w = ce(w.value * u.innerRadiusModifyer * 100)); + return w; + } + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !1, !1, 10, !1) && this.axis && this.axis.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "useChartAngles", { get: function() { + return this.getPropertyValue("useChartAngles"); + }, set: function(u) { + this.setPropertyValue("useChartAngles", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return yo(this.innerRadius, this.pixelRadiusReal) || 0; + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u, w) { + le(w) || (w = 1); + var $ = this.positionToCoordinate(u), G = this.startAngle + (this.endAngle - this.startAngle) * $ / this.axisLength, K = this.pixelRadius, ne = this.pixelInnerRadius; + if (this.axisRendererY) { + var ue = mt(this.axisRendererY.positionToCoordinate(w), 0, 1 / 0); + return ue == 0 && (ue = 1e-6), { x: ue * A(G), y: ue * Ue(G) }; + } + return { x: A(G) * ne + (K - ne) * A(G) * w, y: Ue(G) * ne + (K - ne) * Ue(G) * w }; + }, R.prototype.positionToAngle = function(u) { + var w = this.axis, $ = (this.endAngle - this.startAngle) / (w.end - w.start); + return He(w.renderer.inversed ? this.startAngle + (w.end - u) * $ : this.startAngle + (u - w.start) * $, 3); + }, R.prototype.angleToPosition = function(u) { + var w = this.axis, $ = (this.endAngle - this.startAngle) / (w.end - w.start); + return He(w.renderer.inversed ? w.end - (u - this.startAngle) / $ : (u - this.startAngle) / $ + w.start, 5); + }, R.prototype.updateAxisLine = function() { + var u = this.pixelRadius, w = this.startAngle, $ = H(360, this.endAngle - w); + this.line.path = pn({ x: u * A(w), y: u * Ue(w) }) + gd(w, $, u, u); + }, R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + if (le(G.x) && le(G.y) && u.element) { + var K = it * Math.atan2(G.y, G.x), ne = yo(Ee(u.radius) ? u.radius : ce(100), this.pixelRadius), ue = yo(u.innerRadius, this.pixelRadius); + u.zIndex = 0; + var we = yo(le(ue) ? ue : this.innerRadius, this.pixelRadiusReal, !0); + le(we) || (we = 0), u.path = pn({ x: we * A(K), y: we * Ue(K) }) + xr({ x: ne * A(K), y: ne * Ue(K) }); + } + this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateTickElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + if (u.element) { + var K = this.pixelRadius, ne = it * Math.atan2(G.y, G.x), ue = u.length; + u.inside && (ue = -ue), u.zIndex = 1, u.path = pn({ x: K * A(ne), y: K * Ue(ne) }) + xr({ x: (K + ue) * A(ne), y: (K + ue) * Ue(ne) }); + } + this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateBullet = function(u, w, $) { + var G = 0.5; + u instanceof nR && (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w), ne = this.pixelRadius, ue = it * Math.atan2(K.y, K.x); + K = { x: ne * A(ue), y: ne * Ue(ue) }, this.positionItem(u, K), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateLabelElement = function(u, w, $, G) { + Ee(G) || (G = u.location), w += ($ - w) * G, u.fixPosition(this.positionToAngle(w), this.pixelRadius), u.zIndex = 2, this.toggleVisibility(u, w, this.minLabelPosition, this.maxLabelPosition); + }, R.prototype.fitsToBounds = function(u) { + return !0; + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u) && (this.invalidateAxisItems(), this.axis && this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u) && (this.invalidateAxisItems(), this.axis && this.axis.invalidateSeries()); + }, enumerable: !0, configurable: !0 }), R.prototype.getPositionRangePath = function(u, w, $, G, K) { + var ne = ""; + if (le(u) && le(w)) { + Ee($) || ($ = this.radius), u = ve(u, this.axis.start), (w = H(w, this.axis.end)) < u && (w = u); + var ue = yo($, this.pixelRadius), we = yo(G, this.pixelRadius, !0), De = this.positionToAngle(u); + ne = r2(De, this.positionToAngle(w) - De, ue, we, ue, K); + } + return ne; + }, R.prototype.createGrid = function() { + return new a9(); + }, R.prototype.createFill = function(u) { + return new FH(u); + }, R.prototype.createLabel = function() { + return new LL(); + }, R.prototype.pointToPosition = function(u) { + var w = Jt(se(u), this.startAngle, this.endAngle); + return this.coordinateToPosition((w - this.startAngle) / 360 * this.axisLength); + }, R; + }(RL); + hi.registeredClasses.AxisRendererCircular = LH; + var NL = function(U) { + function R() { + var u = U.call(this) || this; + return u._chart = new Un(), u.pixelRadiusReal = 0, u.className = "AxisRendererRadial", u.isMeasured = !1, u.startAngle = -90, u.endAngle = 270, u.minGridDistance = 30, u.gridType = "circles", u.axisAngle = -90, u.isMeasured = !1, u.layout = "none", u.radius = ce(100), u.line.strokeOpacity = 0, u.labels.template.horizontalCenter = "middle", u._disposers.push(u._chart), u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + this.chart && this.chart.invalid && this.chart.validate(), U.prototype.validate.call(this); + }, Object.defineProperty(R.prototype, "axisLength", { get: function() { + return this.pixelRadius - this.pixelInnerRadius; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !1, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelRadius", { get: function() { + return yo(this.radius, this.pixelRadiusReal) || 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + var u = this.chart, w = this.getPropertyValue("innerRadius"); + if (u) + if (Ee(w)) { + if (w instanceof J && u) { + var $ = u.mr, G = w.value; + w = ce(100 * (G = Math.max($ * G, $ - Math.min(u.plotContainer.innerHeight, u.plotContainer.innerWidth)) / $)); + } + } else + (w = u.innerRadius) instanceof J && u && (w = ce(w.value * u.innerRadiusModifyer * 100)); + return w; + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !1, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return yo(this.innerRadius, this.pixelRadiusReal) || 0; + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u, w) { + var $ = mt(this.positionToCoordinate(u), 0, 1 / 0); + return { x: $ * A(this.axisAngle), y: $ * Ue(this.axisAngle) }; + }, R.prototype.updateAxisLine = function() { + this.line.path = pn({ x: this.pixelInnerRadius * A(this.axisAngle), y: this.pixelInnerRadius * Ue(this.axisAngle) }) + xr({ x: this.pixelRadius * A(this.axisAngle), y: this.pixelRadius * Ue(this.axisAngle) }); + var u = this.axis.title; + u.valign = "none", u.horizontalCenter = "middle", u.verticalCenter = "bottom", u.y = -this.axisLength / 2; + var w = 90; + this.opposite ? this.inside || (w = -90) : this.inside && (w = -90), u.rotation = w; + }, R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G, K = C(this.positionToPoint(w)), ne = this.startAngle, ue = this.endAngle, we = this.chart; + if (le(K) && u.element && we) { + var De = we.xAxes.getIndex(0), $e = 0, Ke = we.series.getIndex(0); + if (Ke && ($e = Ke.dataItems.length), this.gridType == "polygons" && $e > 0 && Ke && De && De instanceof Eh) { + var Ze = De.renderer.grid.template.location, pt = De.getAngle(Ke.dataItems.getIndex(0), "categoryX", Ze); + G = pn({ x: K * A(pt), y: K * Ue(pt) }); + for (var Vt = 1; Vt < $e; Vt++) + G += xr({ x: K * A(pt = De.getAngle(Ke.dataItems.getIndex(Vt), "categoryX", Ze)), y: K * Ue(pt) }); + G += xr({ x: K * A(pt = De.getAngle(Ke.dataItems.getIndex($e - 1), "categoryX", De.renderer.cellEndLocation)), y: K * Ue(pt) }); + } else + G = pn({ x: K * A(ne), y: K * Ue(ne) }) + gd(ne, ue - ne, K, K); + u.path = G; + } + this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateLabelElement = function(u, w, $, G) { + Ee(G) || (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w); + this.positionItem(u, K), this.toggleVisibility(u, w, this.minLabelPosition, this.maxLabelPosition); + }, R.prototype.updateBaseGridElement = function() { + }, R.prototype.fitsToBounds = function(u) { + return !0; + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u) && this.invalidateAxisItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u) && this.invalidateAxisItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "axisAngle", { get: function() { + return this.getPropertyValue("axisAngle"); + }, set: function(u) { + this.setPropertyValue("axisAngle", Zt(u)), this.invalidateAxisItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "gridType", { get: function() { + return this.chart.xAxes.getIndex(0) instanceof Eh ? this.getPropertyValue("gridType") : "circles"; + }, set: function(u) { + this.setPropertyValue("gridType", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.getPositionRangePath = function(u, w) { + var $, G = this.pixelInnerRadius, K = this.axisLength + G, ne = mt(this.positionToCoordinate(u), G, K), ue = mt(this.positionToCoordinate(w), G, K), we = this.startAngle, De = this.endAngle - we, $e = this.chart, Ke = $e.xAxes.getIndex(0), Ze = $e.series.getIndex(0), pt = 0; + if (Ze && (pt = Ze.dataItems.length), this.gridType == "polygons" && pt > 0 && Ze && Ke && Ke instanceof Eh) { + var Vt = Ke.renderer.grid.template.location, Yt = Ke.getAngle(Ze.dataItems.getIndex(0), "categoryX", Vt); + $ = pn({ x: ue * A(Yt), y: ue * Ue(Yt) }); + for (var ci = 1; ci < pt; ci++) + $ += xr({ x: ue * A(Yt = Ke.getAngle(Ze.dataItems.getIndex(ci), "categoryX", Vt)), y: ue * Ue(Yt) }); + for ($ += xr({ x: ue * A(Yt = Ke.getAngle(Ze.dataItems.getIndex(pt - 1), "categoryX", Ke.renderer.cellEndLocation)), y: ue * Ue(Yt) }), $ += pn({ x: ne * A(Yt), y: ne * Ue(Yt) }), ci = pt - 1; ci >= 0; ci--) + $ += xr({ x: ne * A(Yt = Ke.getAngle(Ze.dataItems.getIndex(ci), "categoryX", Vt)), y: ne * Ue(Yt) }); + } else + $ = r2(we, De, ue, ne); + return $; + }, R.prototype.updateBreakElement = function(u) { + var w = u.startLine, $ = u.endLine, G = u.fillShape, K = u.startPoint, ne = u.endPoint; + w.radius = Math.abs(K.y), $.radius = Math.abs(ne.y), G.radius = Math.abs(ne.y), G.innerRadius = Math.abs(K.y); + }, R.prototype.createBreakSprites = function(u) { + u.startLine = new wL(), u.endLine = new wL(), u.fillShape = new wL(); + }, R.prototype.updateTooltip = function() { + if (this.axis) { + var u = this.axisAngle; + u < 0 && (u += 360); + var w = "vertical"; + (u > 45 && u < 135 || u > 225 && u < 315) && (w = "horizontal"), this.axis.updateTooltip(w, { x: -4e3, y: -4e3, width: 8e3, height: 8e3 }); + } + }, R.prototype.updateTickElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + if (u.element) { + var K = Zt(this.axisAngle + 90); + K / 90 != Math.round(K / 90) ? u.pixelPerfect = !1 : u.pixelPerfect = !0; + var ne = -u.length; + u.inside && (ne *= -1), u.path = pn({ x: 0, y: 0 }) + xr({ x: ne * A(K), y: ne * Ue(K) }); + } + this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateBullet = function(u, w, $) { + var G = 0.5; + u instanceof nR && (G = u.location), w += ($ - w) * G; + var K = this.positionToPoint(w); + this.positionItem(u, K), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.positionToCoordinate = function(u) { + var w = this.axis, $ = w.axisFullLength, G = this.pixelInnerRadius; + return He(w.renderer.inversed ? (w.end - u) * $ + G : (u - w.start) * $ + G, 1); + }, R.prototype.pointToPosition = function(u) { + var w = C(u) - this.pixelInnerRadius; + return this.coordinateToPosition(w); + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart.get(); + }, set: function(u) { + this._chart.set(u, null); + }, enumerable: !0, configurable: !0 }), R; + }(Zv); + hi.registeredClasses.AxisRendererRadial = NL; + var Vre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(r9), NH = function(U) { + function R() { + var u = U.call(this) || this; + u._axisRendererX = LH, u._axisRendererY = NL, u.innerRadiusModifyer = 1, u.mr = 1, u.className = "RadarChart", u.startAngle = -90, u.endAngle = 270, u.radius = ce(80), u.innerRadius = 0; + var w = u.plotContainer.createChild(Qn); + return w.shouldClone = !1, w.layout = "absolute", w.align = "center", w.valign = "middle", u.seriesContainer.parent = w, u.radarContainer = w, u.bulletsContainer.parent = w, u.axisBulletsContainer = w, u._cursorContainer = w, u.chartContainer.events.on("maxsizechanged", u.invalidate, u, !1), u._bulletMask = w.createChild(NC), u._bulletMask.shouldClone = !1, u._bulletMask.element = u.paper.add("path"), u._bulletMask.opacity = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Radar chart")); + }, R.prototype.processAxis = function(u) { + U.prototype.processAxis.call(this, u); + var w = u.renderer; + w.gridContainer.parent = w, w.breakContainer.parent = w, u.parent = this.radarContainer, w.toBack(); + }, R.prototype.handleXAxisRangeChange = function() { + U.prototype.handleXAxisRangeChange.call(this), er(this.yAxes.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.handleYAxisRangeChange = function() { + U.prototype.handleYAxisRangeChange.call(this), er(this.xAxes.iterator(), function(u) { + u.invalidate(); + }); + }, R.prototype.processConfig = function(u) { + if (u && (Ee(u.cursor) && !Ee(u.cursor.type) && (u.cursor.type = "RadarCursor"), Ee(u.series) && gt(u.series))) + for (var w = 0, $ = u.series.length; w < $; w++) + u.series[w].type = u.series[w].type || "RadarSeries"; + U.prototype.processConfig.call(this, u); + }, R.prototype.beforeDraw = function() { + U.prototype.beforeDraw.call(this); + var u = this.plotContainer, w = Xt(this.startAngle, this.endAngle, 1), $ = { x: 0, y: 0, width: 0, height: 0 }, G = u.innerWidth / w.width, K = u.innerHeight / w.height, ne = this.innerRadius; + if (ne instanceof J) { + var ue = ne.value, we = Math.min(G, K); + this.mr = we, ue = Math.max(we * ue, we - Math.min(u.innerHeight, u.innerWidth)) / we, $ = Xt(this.startAngle, this.endAngle, ue), this.innerRadiusModifyer = ue / ne.value, ne = ce(100 * ue); + } + w = Ve([w, $]); + var De = Math.min(u.innerWidth / w.width, u.innerHeight / w.height), $e = 2 * yo(this.radius, De) || 0, Ke = $e / 2, Ze = this.startAngle, pt = this.endAngle; + this._pixelInnerRadius = yo(ne, Ke), this._bulletMask.path = r2(Ze, pt - Ze, Ke, this._pixelInnerRadius), er(this.xAxes.iterator(), function(Yt) { + Yt.renderer.useChartAngles && (Yt.renderer.startAngle = Ze, Yt.renderer.endAngle = pt), Yt.width = $e, Yt.height = $e, Yt.renderer.pixelRadiusReal = Ke; + }), er(this.yAxes.iterator(), function(Yt) { + Yt.renderer.startAngle = Ze, Yt.renderer.endAngle = pt, Yt.width = $e, Yt.height = $e, Yt.renderer.pixelRadiusReal = Ke; + }); + var Vt = this.cursor; + Vt && (Vt.width = $e, Vt.height = $e, Vt.startAngle = Ze, Vt.endAngle = pt), this.radarContainer.definedBBox = { x: Ke * w.x, y: Ke * w.y, width: Ke * w.width, height: Ke * w.height }, this.radarContainer.validatePosition(); + }, R.prototype.createSeries = function() { + return new DH(); + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return this._pixelInnerRadius; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), R.prototype.updateXAxis = function(u) { + u && u.processRenderer(); + }, R.prototype.updateYAxis = function(u) { + u && u.processRenderer(); + }, R; + }(Hy); + hi.registeredClasses.RadarChart = NH; + var l9 = function(U) { + function R() { + var u = U.call(this) || this; + u._axis = new Un(), u.className = "ClockHand"; + var w = new Fa(); + u.fill = w.getFor("alternativeBackground"), u.stroke = u.fill; + var $ = new NC(); + $.radius = 5, u.pin = $, u.isMeasured = !1, u.startWidth = 5, u.endWidth = 1, u.width = ce(100), u.height = ce(100), u.radius = ce(100), u.innerRadius = ce(0); + var G = new W8(); + return u.hand = G, u._disposers.push(u._axis), u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + U.prototype.validate.call(this); + var u = this.hand; + u.width = this.pixelWidth; + var w = Math.max(this.startWidth, this.endWidth); + if (u.height = w, u.leftSide = ce(this.startWidth / w * 100), u.rightSide = ce(this.endWidth / w * 100), this.axis) { + var $ = this.axis.renderer, G = yo(this.innerRadius, $.pixelRadius), K = yo(this.radius, $.pixelRadius); + u.x = G, u.y = -w / 2, u.width = K - G; + } + }, Object.defineProperty(R.prototype, "pin", { get: function() { + return this._pin; + }, set: function(u) { + this._pin && this.removeDispose(this._pin), u && (this._pin = u, u.parent = this, this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hand", { get: function() { + return this._hand; + }, set: function(u) { + this._hand && this.removeDispose(this._hand), u && (this._hand = u, u.parent = this, this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startWidth", { get: function() { + return this.getPropertyValue("startWidth"); + }, set: function(u) { + this.setPropertyValue("startWidth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endWidth", { get: function() { + return this.getPropertyValue("endWidth"); + }, set: function(u) { + this.setPropertyValue("endWidth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rotationDirection", { get: function() { + return this.getPropertyValue("rotationDirection"); + }, set: function(u) { + this.setPropertyValue("rotationDirection", u); + }, enumerable: !0, configurable: !0 }), R.prototype.showValue = function(u, w, $) { + if (this._value = u, u != null && (le(w) || (w = 0), this.axis)) { + var G = this.axis.renderer.positionToAngle(this.axis.anyToPosition(u)), K = this.rotation; + this.rotationDirection == "clockWise" && G < K && (this.rotation = K - 360), this.rotationDirection == "counterClockWise" && G > K && (this.rotation = K + 360), this.animate({ property: "rotation", to: G }, w, $); + } + }, Object.defineProperty(R.prototype, "currentPosition", { get: function() { + if (this.axis) + return this.axis.renderer.angleToPosition(this.rotation); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "value", { get: function() { + return this._value; + }, set: function(u) { + this.showValue(u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "axis", { get: function() { + return this._axis.get(); + }, set: function(u) { + if (this.axis != u && this._axis.set(u, new kn([u.events.on("datavalidated", this.updateValue, this, !1), u.events.on("datarangechanged", this.updateValue, this, !1), u.events.on("dataitemsvalidated", this.updateValue, this, !1), u.events.on("propertychanged", this.invalidate, this, !1)])), u) { + var w = u.chart; + w && (this.rotation = w.startAngle); + } + this.parent = u.renderer, this.zIndex = 5; + }, enumerable: !0, configurable: !0 }), R.prototype.updateValue = function() { + this.value = this.value; + }, R.prototype.processConfig = function(u) { + u && Ee(u.axis) && st(u.axis) && this.map.hasKey(u.axis) && (u.axis = this.map.getKey(u.axis)), U.prototype.processConfig.call(this, u); + }, R; + }(Qn); + hi.registeredClasses.ClockHand = l9; + var kH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "GaugeChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(Vre), jre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "GaugeChart", u.startAngle = 180, u.endAngle = 360, u.hands = new Xs(new l9()), u.hands.events.on("inserted", u.processHand, u, !1), u._disposers.push(new Wo(u.hands)), u._disposers.push(u.hands.template), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Gauge chart")); + }, R.prototype.processHand = function(u) { + var w = u.newValue; + w.axis || (w.axis = this.xAxes.getIndex(0)); + }, R.prototype.configOrder = function(u, w) { + return u == w ? 0 : u == "hands" ? 1 : w == "hands" ? -1 : U.prototype.configOrder.call(this, u, w); + }, R; + }(NH); + hi.registeredClasses.GaugeChart = jre; + var Zb = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PercentSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R.prototype.uidAttr = function() { + return this.slice.uidAttr(); + }, R.prototype.hide = function(u, w, $, G) { + return G || (G = ["value"]), U.prototype.hide.call(this, u, w, 0, G); + }, R.prototype.setVisibility = function(u, w) { + w || (u ? this.setWorkingValue("value", this.values.value.value, 0, 0) : this.setWorkingValue("value", 0, 0, 0)), U.prototype.setVisibility.call(this, u, w); + }, R.prototype.show = function(u, w, $) { + return $ || ($ = ["value"]), U.prototype.show.call(this, u, w, $); + }, Object.defineProperty(R.prototype, "category", { get: function() { + return this.properties.category; + }, set: function(u) { + this.setProperty("category", u); + }, enumerable: !0, configurable: !0 }), R.prototype.createLegendMarker = function(u) { + this.component.createLegendMarker(u, this); + }, Object.defineProperty(R.prototype, "legendDataItem", { get: function() { + return this._legendDataItem; + }, set: function(u) { + this._legendDataItem = u, u.label && (u.label.dataItem = this), u.valueLabel && (u.valueLabel.dataItem = this); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tick", { get: function() { + var u = this; + if (!this._tick) { + var w = this.component.ticks.create(); + this._tick = w, this.addSprite(w), this._disposers.push(w), w.parent = this.component.ticksContainer, this._disposers.push(new ln(function() { + u.component && u.component.ticks.removeValue(w); + })), w.visible = this.visible; + } + return this._tick; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "label", { get: function() { + var u = this; + if (!this._label) { + var w = this.component.labels.create(); + this.addSprite(w), this._label = w, this._disposers.push(w), w.parent = this.component.labelsContainer, this._disposers.push(new ln(function() { + u.component && u.component.labels.removeValue(w); + })), w.visible = this.visible; + } + return this._label; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "slice", { get: function() { + var u = this; + if (!this._slice) { + var w = this.component, $ = w.slices.create(); + this.addSprite($), this._slice = $, this._disposers.push($), $.parent = w.slicesContainer, this._disposers.push(new ln(function() { + w.slices.removeValue($); + })), $.visible = this.visible, w.itemsFocusable() ? (Ee(this.component.role) || (this.component.role = "menu"), Ee($.role) || ($.role = "menuitem"), $.focusable = !0) : (Ee(this.component.role) || (this.component.role = "list"), Ee($.role) || ($.role = "listitem"), $.focusable = !1), $.focusable && ($.events.on("focus", function(G) { + $.readerTitle = w.populateString(w.itemReaderText, u); + }, void 0, !1), $.events.on("blur", function(G) { + $.readerTitle = ""; + }, void 0, !1)), $.hoverable && ($.events.on("over", function(G) { + $.readerTitle = w.populateString(w.itemReaderText, u); + }, void 0, !1), $.events.on("out", function(G) { + $.readerTitle = ""; + }, void 0, !1)); + } + return this._slice; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hiddenInLegend", { get: function() { + return this.properties.hiddenInLegend; + }, set: function(u) { + this.setProperty("hiddenInLegend", u); + }, enumerable: !0, configurable: !0 }), R; + }(IL), kL = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "PercentSeries", u._addAllDataItems = !1, u.colors = new Mm(), u.colors.step = 1, u.isMeasured = !0, u.calculatePercent = !0; + var w = u.createChild(Qn); + w.shouldClone = !1, w.isMeasured = !1, u.slicesContainer = w; + var $ = u.createChild(Qn); + $.shouldClone = !1, $.isMeasured = !1, $.layout = "none", u.ticksContainer = $; + var G = u.createChild(Qn); + return G.shouldClone = !1, G.isMeasured = !1, G.layout = "none", u.labelsContainer = G, u.alignLabels = !1, u.bulletsContainer.toFront(), u.skipFocusThreshold = 50, u.defaultState.transitionEasing = L3, u.itemReaderText = "{category}: {value.percent.formatNumber('#.#p')}", u.applyTheme(), u; + } + return re(R, U), R.prototype.createSlice = function() { + return new so(); + }, R.prototype.createTick = function() { + return new rR(); + }, R.prototype.createLabel = function() { + return new Rm(); + }, Object.defineProperty(R.prototype, "slices", { get: function() { + if (!this._slices) { + var u = this.createSlice(); + u.applyOnClones = !0, this._disposers.push(u), this.initSlice(u), this._slices = new Xs(u), this._disposers.push(new Wo(this._slices)); + } + return this._slices; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "ticks", { get: function() { + if (!this._ticks) { + var u = this.createTick(); + u.applyOnClones = !0, this._disposers.push(u), this.initTick(u), this._ticks = new Xs(u), this._disposers.push(new Wo(this._ticks)); + } + return this._ticks; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "labels", { get: function() { + if (!this._labels) { + var u = this.createLabel(); + u.applyOnClones = !0, this._disposers.push(u), this.initLabel(u), this._labels = new Xs(u), this._disposers.push(new Wo(this._labels)); + } + return this._labels; + }, enumerable: !0, configurable: !0 }), R.prototype.createDataItem = function() { + return new Zb(); + }, R.prototype.initSlice = function(u) { + }, R.prototype.initLabel = function(u) { + u.text = "{category}: {value.percent.formatNumber('#.0p')}", u.isMeasured = !1, u.padding(5, 5, 5, 5); + }, R.prototype.initTick = function(u) { + }, R.prototype.validateDataItems = function() { + this.colors.reset(), this.patterns && this.patterns.reset(), U.prototype.validateDataItems.call(this); + }, R.prototype.validateDataElement = function(u) { + var w = u.slice; + w && (w.fill == null ? this.patterns ? (Ee(w.stroke) || (w.stroke = this.colors.next()), w.fill = this.patterns.next(), Ee(w.fillOpacity) && (w.fill.backgroundOpacity = w.fillOpacity), w.stroke instanceof Ie && (w.fill.stroke = w.stroke, w.fill.fill = w.stroke)) : w.fill = this.colors.next() : this.colors.currentStep += this.colors.step, w.stroke == null && (w.stroke = w.fill)), U.prototype.validateDataElement.call(this, u), w && u.bullets.each(function($, G) { + G.fill == null && (G.fill = w.fill), G.stroke == null && (G.stroke = w.stroke); + }), this.updateLegendValue(u); + }, R.prototype.validateData = function() { + U.prototype.validateData.call(this), this.chart && this.chart.feedLegend(); + }, R.prototype.arrangeLabels = function(u) { + for (var w = 0, $ = u.length; w < $; w++) { + var G = u[w].label; + if (G) { + G.invalid && G.validate(); + var K = G.measuredHeight; + G.visible || (K = 0), G.pixelY - K / 2 < -this.maxHeight / 2 && (G.y = -this.maxHeight / 2 + K / 2); + var ne = this.getNextLabel(w + 1, u), ue = G.pixelY + K; + ne && ne.y < ue && (ne.y = ue); + } + } + }, R.prototype.arrangeLabels2 = function(u) { + for (var w = this.maxHeight / 2, $ = u.length - 1; $ >= 0; $--) { + var G = u[$].label; + if (G) { + G.invalid && G.validate(); + var K = G.measuredHeight; + G.visible || (K = 0), $ == u.length - 1 && (w += K / 2), G.pixelY + K > w && (G.y = w - K, w = G.y); + } + } + }, R.prototype.getNextLabel = function(u, w) { + if (w.length >= u) { + var $ = w[u]; + if ($) + return $.label && $.visible ? $.label : this.getNextLabel(u + 1, w); + } + }, Object.defineProperty(R.prototype, "colors", { get: function() { + return this.getPropertyValue("colors"); + }, set: function(u) { + this.setPropertyValue("colors", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "patterns", { get: function() { + return this.getPropertyValue("patterns"); + }, set: function(u) { + this.setPropertyValue("patterns", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.createLegendMarker = function(u, w) { + er(u.children.iterator(), function($) { + var G = w.slice; + $.defaultState.properties.fill = G.fill, $.defaultState.properties.stroke = G.stroke, $.defaultState.properties.fillOpacity = G.fillOpacity, $.defaultState.properties.strokeOpacity = G.strokeOpacity, $.fill = G.fill, $.stroke = G.stroke, $.fillOpacity = G.fillOpacity, $.strokeOpacity = G.strokeOpacity, $.fill == null && ($.__disabled = !0); + var K = u.dataItem; + K.color = G.fill, K.colorOrig = G.fill, $.addDisposer(G.events.on("propertychanged", function(ne) { + ne.property == "fill" && ($.__disabled = !1, $.isActive || ($.fill = G.fill), $.defaultState.properties.fill = G.fill, K.color = G.fill, K.colorOrig = G.fill), ne.property == "stroke" && ($.isActive || ($.stroke = G.stroke), $.defaultState.properties.stroke = G.stroke), ne.property == "strokeOpacity" && ($.isActive || ($.strokeOpacity = G.strokeOpacity), $.defaultState.properties.strokeOpacity = G.strokeOpacity); + }, void 0, !1)); + }); + }, R.prototype.handleSliceScale = function(u) { + var w = this, $ = u.target.dataItem; + $ && $.bullets && er($.bullets.iterator(), function(G) { + var K = G[1]; + w.positionBullet(K); + }); + }, R.prototype.handleSliceMove = function(u) { + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.slices.template.copyFrom(u.slices.template), this.labels.template.copyFrom(u.labels.template), this.ticks.template.copyFrom(u.ticks.template), this.colors = u.colors.clone(); + }, Object.defineProperty(R.prototype, "alignLabels", { get: function() { + return this.getPropertyValue("alignLabels"); + }, set: function(u) { + this.setAlignLabels(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setAlignLabels = function(u) { + this.setPropertyValue("alignLabels", u, !0); + }, Object.defineProperty(R.prototype, "ignoreZeroValues", { get: function() { + return this.getPropertyValue("ignoreZeroValues"); + }, set: function(u) { + this.setPropertyValue("ignoreZeroValues", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.updateLegendValue = function(u) { + if (u) { + var w = u.legendDataItem, $ = u.legendSettings; + w && $ && $ && ($.labelText && (w.label.text = $.labelText), $.itemLabelText && (w.label.text = $.itemLabelText), $.valueText && (w.valueLabel.text = $.valueText), $.itemValueText && (w.valueLabel.text = $.itemValueText)); + } + }, R; + }(AL); + hi.registeredClasses.PercentSeries = kL, hi.registeredClasses.PercentSeriesDataItem = Zb, Wd.push({ relevant: gf.maybeXS, state: function(U, R) { + if (U instanceof kL) { + var u = U.states.create(R); + return U.labels.template.states.create(R).properties.disabled = !0, U.ticks.template.states.create(R).properties.disabled = !0, u; + } + return null; + } }); + var $H = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PercentChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(AH), u9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PercentChart", u.align = "none", u.valign = "none", u.chartContainer.minHeight = 50, u.chartContainer.minWidth = 50, u.applyTheme(), u; + } + return re(R, U), R.prototype.validateData = function() { + U.prototype.validateData.call(this), this.feedLegend(); + }, R.prototype.feedLegend = function() { + var u = this.legend; + if (u) { + var w = []; + er(this.series.iterator(), function($) { + $.hiddenInLegend || er($.dataItems.iterator(), function(G) { + G.hiddenInLegend || (w.push(G), G.legendSettings || (G.legendSettings = $.legendSettings)); + }); + }), u.data = w, u.dataFields.name = "category"; + } + }, R.prototype.createSeries = function() { + return new kL(); + }, R.prototype.setLegend = function(u) { + U.prototype.setLegend.call(this, u), u && (u.labels.template.text = "{category}", u.valueLabels.template.text = "{value.percent.formatNumber('#.0p')}", u.itemContainers.template.events.on("over", function(w) { + var $ = w.target.dataItem.dataContext; + if ($.visible && !$.isHiding) { + var G = $.slice; + G.dispatchImmediately("over"), G.isHover = !0, G.interactions.isRealHover = !0; + } + }), u.itemContainers.template.events.on("out", function(w) { + var $ = w.target.dataItem.dataContext.slice; + $.dispatchImmediately("out"), $.isHover = !1; + })); + }, R; + }(Z8); + hi.registeredClasses.PercentChart = u9, hi.registeredClasses.PercentChartDataItem = $H; + var BH = function(U) { + function R() { + var u = U.call(this) || this; + return u._label = new Un(), u._slice = new Un(), u.className = "PieTick", u.element = u.paper.add("polyline"), u._disposers.push(u._label), u._disposers.push(u._slice), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.slice, w = this.label, $ = u.dataItem.component; + if (u && u.radius > 0 && w && w.text) { + var G = u.dx + u.slice.dx + u.pixelX + u.ix * u.radius * u.scale, K = u.dy + u.slice.dy + u.pixelY + u.iy * u.radiusY * u.scale, ne = void 0, ue = void 0, we = void 0, De = void 0; + if ($.alignLabels) + ne = w.pixelX - this.length, ue = w.pixelY, we = w.pixelX, De = ue, w.horizontalCenter == "right" && (we = (ne += 2 * this.length) - this.length); + else { + var $e = w.pixelRadius(u.radius); + we = ne = G + $e * u.ix, De = ue = K + $e * u.iy; + } + this.element.attr({ points: [G, K, ne, ue, we, De] }); + } + }, Object.defineProperty(R.prototype, "slice", { get: function() { + return this._slice.get(); + }, set: function(u) { + this._slice.set(u, new kn([u.events.on("transformed", this.invalidate, this), u.events.on("validated", this.invalidate, this)])); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "label", { get: function() { + return this._label.get(); + }, set: function(u) { + this._label.set(u, u.events.on("transformed", this.invalidate, this, !1)); + }, enumerable: !0, configurable: !0 }), R; + }(rR); + hi.registeredClasses.PieTick = BH; + var c9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieSeriesDataItem", u.values.radiusValue = {}, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "radiusValue", { get: function() { + return this.values.radiusValue.value; + }, set: function(u) { + this.setValue("radiusValue", u); + }, enumerable: !0, configurable: !0 }), R.prototype.hide = function(u, w, $, G) { + return U.prototype.hide.call(this, u, w, 0, ["value", "radiusValue"]); + }, R.prototype.show = function(u, w, $) { + return U.prototype.show.call(this, u, w, ["value", "radiusValue"]); + }, R; + }(Zb), h9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieSeries", u.alignLabels = !0, u.layout = "none", u.labels.template.radius = ce(5), u.addDisposer(u.labels.template.events.on("enabled", u.invalidate, u, !1)), u.applyTheme(), u; + } + return re(R, U), R.prototype.createSlice = function() { + return new kC(); + }, R.prototype.createTick = function() { + return new BH(); + }, R.prototype.createLabel = function() { + return new LL(); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Pie Slice Series")); + }, R.prototype.createDataItem = function() { + return new c9(); + }, R.prototype.initSlice = function(u) { + u.isMeasured = !1, u.defaultState.properties.scale = 1, u.observe("scale", this.handleSliceScale, this), u.observe(["dx", "dy", "x", "y", "shiftRadius"], this.handleSliceMove, this), u.tooltipText = "{category}: {value.percent.formatNumber('#.#p')} ({value.value})", u.states.create("hover").properties.scale = 1.05, u.defaultState.properties.shiftRadius = 0, u.togglable = !0, u.events.on("toggled", function(w) { + w.target.hideTooltip(), w.target.interactions.lastHitPointer && w.target.interactions.lastHitPointer.touch && !w.target.isActive && (w.target.isHover = !1); + }), u.states.create("active").properties.shiftRadius = 0.1; + }, R.prototype.validate = function() { + this._leftItems = [], this._rightItems = [], this._currentStartAngle = this.startAngle, this._arcRect = Xt(this.startAngle, this.endAngle), this._maxRadiusPercent = 0; + for (var u = this.startIndex; u < this.endIndex; u++) { + var w = this.dataItems.getIndex(u).values.radiusValue.percent; + w > this._maxRadiusPercent && (this._maxRadiusPercent = w); + } + U.prototype.validate.call(this), this.alignLabels && (this.startAngle > this.endAngle ? this._rightItems.reverse() : this._leftItems.reverse(), this._rightItems.sort(function($, G) { + var K = ($.slice.middleAngle + 360) % 360, ne = (G.slice.middleAngle + 360) % 360; + return K > 270 && (K -= 360), ne > 270 && (ne -= 360), K < ne ? -1 : K > ne ? 1 : 0; + }), this._leftItems.sort(function($, G) { + var K = ($.slice.middleAngle + 360) % 360, ne = (G.slice.middleAngle + 360) % 360; + return K < ne ? 1 : K > ne ? -1 : 0; + }), this.arrangeLabels(this._rightItems), this.arrangeLabels2(this._rightItems), this.arrangeLabels(this._leftItems), this.arrangeLabels2(this._leftItems)); + }, R.prototype.validateDataElement = function(u) { + if (this.pixelRadius > 0) { + !this.ignoreZeroValues || u.value != 0 && u.value != null ? u.__disabled = !1 : u.__disabled = !0; + var w = u.slice; + if (w.radius = this.pixelRadius, le(u.radiusValue) && (w.radius = this.pixelInnerRadius + (this.pixelRadius - this.pixelInnerRadius) * u.values.radiusValue.percent / this._maxRadiusPercent), w.innerRadius instanceof J || (w.innerRadius = this.pixelInnerRadius), w.startAngle = this._currentStartAngle, w.arc = Math.abs(u.values.value.percent) * (this.endAngle - this.startAngle) / 100, !this.labels.template.disabled) { + var $ = u.label, G = u.tick; + G.slice = w, G.label = $; + var K = (w.middleAngle + 360) % 360, ne = void 0; + if (this.alignLabels) { + var ue = $.pixelRadius(w.radius), we = G.length + ue; + $.dx = 0, $.dy = 0, $.verticalCenter = "middle"; + var De = this._arcRect; + K > 270 || K <= 90 ? (we += (De.width + De.x) * this.pixelRadius, $.horizontalCenter = "left", this._rightItems.push(u)) : (we -= De.x * this.pixelRadius, $.horizontalCenter = "right", this._leftItems.push(u), we *= -1); + var $e = w.radius + G.length + ue; + ne = { x: we, y: w.iy * $e }, $.moveTo(ne); + } else { + var Ke = w.depth; + le(Ke) || (Ke = 0), $.fixPosition(w.middleAngle, w.radius, w.radiusY, 0, -Ke); + } + } + this._currentStartAngle += w.arc, U.prototype.validateDataElement.call(this, u); + } + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1) && this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelRadius", { get: function() { + return this._pixelRadius; + }, set: function(u) { + this._pixelRadius != u && (this._pixelRadius = u, this.invalidateDataItems()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + return this._pixelInnerRadius; + }, set: function(u) { + this._pixelInnerRadius != u && (this._pixelInnerRadius = u, this.invalidateDataItems()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startAngle", { get: function() { + var u = this.getPropertyValue("startAngle"); + return le(u) ? u : this._startAngleInternal; + }, set: function(u) { + this.setPropertyValue("startAngle", Zt(u), !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + var u = this.getPropertyValue("endAngle"); + return le(u) ? u : this._endAngleInternal; + }, set: function(u) { + this.setPropertyValue("endAngle", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.positionBullet = function(u) { + U.prototype.positionBullet.call(this, u); + var w = u.dataItem.slice, $ = u.locationX; + le($) || ($ = 0.5); + var G = u.locationY; + le(G) || (G = 1); + var K = w.startAngle + w.arc * $; + u.x = G * w.radius * A(K), u.y = G * w.radiusY * Ue(K); + }, R.prototype.handleSliceMove = function(u) { + if (!this.alignLabels) { + var w = u.target, $ = w.dataItem; + if ($) { + var G = $.label; + G && (G.dx = G.fdx + w.dx + w.pixelX, G.dy = G.fdy + w.dy + w.pixelY); + } + } + }, Object.defineProperty(R.prototype, "bbox", { get: function() { + if (this.definedBBox) + return this.definedBBox; + var u = this.chart; + return u ? Xt(u.startAngle, u.endAngle, this.pixelRadius) : Xt(this.startAngle, this.endAngle, this.pixelRadius); + }, enumerable: !0, configurable: !0 }), R; + }(kL); + hi.registeredClasses.PieSeries = h9, hi.registeredClasses.PieSeriesDataItem = c9; + var sR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }($H), VH = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "PieChart", u.innerRadius = 0, u.radius = ce(80), u.align = "none", u.valign = "none", u.startAngle = -90, u.endAngle = 270; + var w = u.seriesContainer; + return w.isMeasured = !0, w.valign = "middle", w.align = "center", w.layout = "absolute", w.width = void 0, w.height = void 0, u.chartContainer.minHeight = 50, u.chartContainer.minWidth = 50, u.chartContainer.events.on("maxsizechanged", u.updateRadius, u, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Pie chart")); + }, R.prototype.validateLayout = function() { + U.prototype.validateLayout.call(this), this.updateRadius(); + }, R.prototype.handleSeriesAdded = function(u) { + U.prototype.handleSeriesAdded.call(this, u), this._chartPixelRadius = void 0, this.updateSeriesAngles(); + }, R.prototype.updateSeriesAngles = function() { + var u = this; + this.series.each(function(w) { + w._startAngleInternal = u.startAngle, w._endAngleInternal = u.endAngle; + }); + }, R.prototype.updateRadius = function() { + var u = this.chartContainer, w = Xt(this.startAngle, this.endAngle, 1), $ = { x: 0, y: 0, width: 0, height: 0 }, G = this.innerRadius; + G instanceof J && ($ = Xt(this.startAngle, this.endAngle, G.value)), w = Ve([w, $]); + var K = Math.min(u.innerWidth / w.width, u.innerHeight / w.height); + le(K) || (K = 0); + var ne = yo(this.radius, K), ue = yo(this.innerRadius, K), we = (ne - ue) / this.series.length; + ne == this._chartPixelRadius && ue == this._chartPixelInnerRadius || (this._chartPixelRadius = ne, this._chartPixelInnerRadius = ue, er(mu(this.series.iterator()), function(De) { + var $e = De[0], Ke = De[1], Ze = ue + yo(Ke.radius, ne - ue), pt = ue + yo(Ke.innerRadius, ne - ue); + le(Ze) || (Ze = ue + we * ($e + 1)), le(pt) || (pt = ue + we * $e), Ke.pixelRadius = Ze, Ke.pixelInnerRadius = pt; + }), this.seriesContainer.definedBBox = { x: ne * w.x, y: ne * w.y, width: ne * w.width, height: ne * w.height }, this.seriesContainer.invalidateLayout(), this.bulletsContainer.x = this.seriesContainer.x, this.bulletsContainer.y = this.seriesContainer.y); + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1) && this.invalidateLayout(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), R.prototype.createSeries = function() { + return new h9(); + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u) && (this.updateRadius(), this.updateSeriesAngles()); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u) && (this.updateRadius(), this.updateSeriesAngles()); + }, enumerable: !0, configurable: !0 }), R; + }(u9); + hi.registeredClasses.PieChart = VH, hi.registeredClasses.PieChartDataItem = sR; + var l2 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieSeries3DDataItem", u.values.depthValue = {}, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "depthValue", { get: function() { + return this.values.depthValue.value; + }, set: function(u) { + this.setValue("depthValue", u); + }, enumerable: !0, configurable: !0 }), R; + }(c9), jH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieSeries3D", u.applyTheme(), u; + } + return re(R, U), R.prototype.createDataItem = function() { + return new l2(); + }, R.prototype.createSlice = function() { + return new Pre(); + }, R.prototype.validateDataElement = function(u) { + var w = u.slice, $ = this.depth; + le($) || ($ = this.chart.depth); + var G = u.values.depthValue.percent; + le(G) || (G = 100), w.depth = G * $ / 100; + var K = this.angle; + le(K) || (K = this.chart.angle), w.angle = K, U.prototype.validateDataElement.call(this, u); + }, R.prototype.validate = function() { + U.prototype.validate.call(this); + for (var u = this._workingStartIndex; u < this._workingEndIndex; u++) { + var w = this.dataItems.getIndex(u).slice, $ = w.startAngle; + $ >= -90 && $ < 90 ? w.toFront() : $ >= 90 && w.toBack(); + } + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + this.setPropertyValue("angle", u); + }, enumerable: !0, configurable: !0 }), R.prototype.positionBullet = function(u) { + U.prototype.positionBullet.call(this, u); + var w = u.dataItem.slice; + u.y = u.pixelY - w.depth; + }, R; + }(h9); + hi.registeredClasses.PieSeries3D = jH, hi.registeredClasses.PieSeries3DDataItem = l2; + var Gre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieChart3DDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(sR), Ure = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PieChart3D", u.depth = 20, u.angle = 10, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u) && this.invalidateDataUsers(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + u = mt(u, 0, 90), this.setPropertyValue("angle", u) && this.invalidateDataUsers(); + }, enumerable: !0, configurable: !0 }), R.prototype.createSeries = function() { + return new jH(); + }, R; + }(VH); + hi.registeredClasses.PieChart3D = Ure; + var oR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SlicedChartDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }($H), GH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SlicedChart", u.seriesContainer.layout = "horizontal", u.padding(15, 15, 15, 15), u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Sliced chart")); + }, R.prototype.validate = function() { + U.prototype.validate.call(this); + }, R; + }(u9); + hi.registeredClasses.SlicedChart = GH, hi.registeredClasses.SlicedChartDataItem = oR; + var $L = function(U) { + function R() { + var u = U.call(this) || this; + return u.legendSettings = new IH(), u.className = "FlowDiagramNode", u.isMeasured = !1, new Fa(), u.draggable = !0, u.inert = !0, u.setStateOnChildren = !0, u.events.on("positionchanged", u.invalidateLinks, u, !1), u.events.on("sizechanged", u.invalidateLinks, u, !1), u; + } + return re(R, U), R.prototype.handleHit = function(u) { + this.isHidden || this.isHiding ? this.show() : this.hide(); + }, R.prototype.show = function(u) { + var w = U.prototype.show.call(this, u); + return this.outgoingDataItems.each(function($) { + (!$.toNode || $.toNode && !$.toNode.isHidden) && ($.setWorkingValue("value", $.getValue("value"), u), $.link.show()); + }), this.incomingDataItems.each(function($) { + (!$.fromNode || $.fromNode && !$.fromNode.isHidden) && ($.setWorkingValue("value", $.getValue("value"), u), $.link.show()); + }), w; + }, R.prototype.hide = function(u) { + var w = U.prototype.hide.call(this, u); + return this.outgoingDataItems.each(function($) { + $.setWorkingValue("value", 0, u), $.link.hide(); + }), this.incomingDataItems.each(function($) { + $.setWorkingValue("value", 0, u), $.link.hide(); + }), w; + }, R.prototype.validate = function() { + this.isDisposed() || (U.prototype.validate.call(this), this.invalidateLinks()); + }, R.prototype.invalidateLinks = function() { + var u = this; + this.outgoingDataItems.each(function(w) { + var $ = w.link; + if ($.colorMode == "fromNode" && ($.fill = $.dataItem.fromNode.color), $.colorMode == "gradient") { + $.fill = $.gradient, $.stroke = $.gradient; + var G = $.gradient.stops.getIndex(0); + G && (G.color = u.color, $.gradient.validate()); + } + }), this.incomingDataItems.each(function(w) { + var $ = w.link; + if ($.colorMode == "toNode" && ($.fill = $.dataItem.toNode.color), $.colorMode == "gradient") { + $.fill = $.gradient, $.stroke = $.gradient; + var G = $.gradient.stops.getIndex(1); + G && (G.color = u.color, $.gradient.validate()); + } + }); + }, Object.defineProperty(R.prototype, "incomingDataItems", { get: function() { + var u = this; + if (!this._incomingDataItems) { + var w = new Hs(); + w.events.on("inserted", function() { + u.chart.sortBy == "name" ? u._incomingSorted = ys(u._incomingDataItems.iterator(), function($, G) { + return yh($.fromName, G.fromName); + }) : u.chart.sortBy == "value" ? u._incomingSorted = ys(u._incomingDataItems.iterator(), function($, G) { + return gu(jc($.value, G.value)); + }) : u._incomingSorted = u._incomingDataItems.iterator(); + }, void 0, !1), this._incomingDataItems = w; + } + return this._incomingDataItems; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "outgoingDataItems", { get: function() { + var u = this; + if (!this._outgoingDataItems) { + var w = new Hs(); + w.events.on("inserted", function() { + u.chart.sortBy == "name" ? u._outgoingSorted = ys(u._outgoingDataItems.iterator(), function($, G) { + return yh($.fromName, G.fromName); + }) : u.chart.sortBy == "value" ? u._outgoingSorted = ys(u._outgoingDataItems.iterator(), function($, G) { + return gu(jc($.value, G.value)); + }) : u._outgoingSorted = u._outgoingDataItems.iterator(); + }, void 0, !1), this._outgoingDataItems = w; + } + return this._outgoingDataItems; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "name", { get: function() { + return this.getPropertyValue("name"); + }, set: function(u) { + this.setPropertyValue("name", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "total", { get: function() { + return this.getPropertyValue("total"); + }, set: function(u) { + this.setPropertyValue("total", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "totalIncoming", { get: function() { + return this.getPropertyValue("totalIncoming"); + }, set: function(u) { + this.setPropertyValue("totalIncoming", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "totalOutgoing", { get: function() { + return this.getPropertyValue("totalOutgoing"); + }, set: function(u) { + this.setPropertyValue("totalOutgoing", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "color", { get: function() { + return this.getPropertyValue("color"); + }, set: function(u) { + this.setColorProperty("color", u), this._background && (this._background.fill = u), this.fill = u; + }, enumerable: !0, configurable: !0 }), R.prototype.createLegendMarker = function(u) { + var w = u.pixelWidth, $ = u.pixelHeight; + u.removeChildren(); + var G = u.createChild(L1); + G.shouldClone = !1, _r(this, G, lc), G.stroke = this.fill, G.copyFrom(this), G.padding(0, 0, 0, 0), G.width = w, G.height = $; + var K = u.dataItem; + K.color = G.fill, K.colorOrig = G.fill; + }, Object.defineProperty(R.prototype, "legendDataItem", { get: function() { + return this._legendDataItem; + }, set: function(u) { + this._legendDataItem = u, this._legendDataItem.itemContainer.deepInvalidate(); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.FlowDiagramNode = $L; + var aR = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "FlowDiagramLink"; + var w = new Fa(); + return u.maskBullets = !1, u.colorMode = "fromNode", u.layout = "none", u.isMeasured = !1, u.startAngle = 0, u.endAngle = 0, u.strokeOpacity = 0, u.verticalCenter = "none", u.horizontalCenter = "none", u.tooltipText = "{fromName}→{toName}:{value.value}", u.tooltipLocation = 0.5, u.link = u.createChild(so), u.link.shouldClone = !1, u.link.setElement(u.paper.add("path")), u.link.isMeasured = !1, u.fillOpacity = 0.2, u.fill = w.getFor("alternativeBackground"), u.applyTheme(), u; + } + return re(R, U), R.prototype.positionBullets = function() { + var u = this; + er(this.bullets.iterator(), function(w) { + w.parent = u.bulletsContainer, w.maxWidth = u.maxWidth, w.maxHeight = u.maxHeight, u.positionBullet(w); + }); + }, Object.defineProperty(R.prototype, "bulletsContainer", { get: function() { + if (!this._bulletsContainer) { + var u = this.createChild(Qn); + u.shouldClone = !1, u.layout = "none", this._bulletsContainer = u; + } + return this._bulletsContainer; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bulletsMask", { get: function() { + if (!this._bulletsMask) { + var u = this.createChild(so); + u.shouldClone = !1, u.setElement(this.paper.add("path")), u.isMeasured = !1, this._bulletsMask = u; + } + return this._bulletsMask; + }, enumerable: !0, configurable: !0 }), R.prototype.positionBullet = function(u) { + var w = u.locationX; + le(w) || (w = u.locationY), le(w) || (w = 0.5); + var $ = this.middleLine.positionToPoint(w); + u.moveTo($); + var G, K = u.propertyFields.rotation; + u.dataItem && (G = u.dataItem.dataContext[K]), le(G) || (G = $.angle), u.rotation = G; + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "colorMode", { get: function() { + return this.getPropertyValue("colorMode"); + }, set: function(u) { + if (u == "gradient") { + var w = this.fill; + this.gradient.stops.clear(), w instanceof Ie && (this.gradient.addColor(w), this.gradient.addColor(w)), this.fill = this.gradient, this.stroke = this.gradient; + } + this.setPropertyValue("colorMode", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maskBullets", { get: function() { + return this.getPropertyValue("maskBullets"); + }, set: function(u) { + this.setPropertyValue("maskBullets", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tooltipLocation", { get: function() { + return this.getPropertyValue("tooltipLocation"); + }, set: function(u) { + this.setPropertyValue("tooltipLocation", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.setFill = function(u) { + U.prototype.setFill.call(this, u); + var w = this._gradient; + w && u instanceof Ie && (w.stops.clear(), w.addColor(u), w.addColor(u)); + }, R.prototype.measureElement = function() { + }, Object.defineProperty(R.prototype, "bullets", { get: function() { + var u = this; + return this._bullets || (this._bullets = new Xs(new Mo()), this._disposers.push(new Wo(this._bullets)), this._disposers.push(this._bullets.template), this._bullets.events.on("inserted", function(w) { + w.newValue.events.on("propertychanged", function($) { + $.property != "locationX" && $.property != "locationY" || u.positionBullet($.target); + }, void 0, !1); + }, void 0, !1)), this._bullets; + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.bullets.copyFrom(u.bullets); + var w = this.middleLine; + w && (w instanceof q0 && u.middleLine instanceof q0 && w.copyFrom(u.middleLine), w instanceof Q3 && u.middleLine instanceof Q3 && w.copyFrom(u.middleLine)), this.link.copyFrom(u.link); + }, R.prototype.getTooltipX = function() { + if (this.middleLine) + return this.middleLine.positionToPoint(this.tooltipLocation).x; + }, R.prototype.getTooltipY = function() { + if (this.middleLine) + return this.middleLine.positionToPoint(this.tooltipLocation).y; + }, Object.defineProperty(R.prototype, "gradient", { get: function() { + return this._gradient || (this._gradient = new qg()), this._gradient; + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.FlowDiagramLink = aR; + var BL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "FlowDiagramDataItem", u.values.value = {}, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "fromName", { get: function() { + return this.properties.fromName; + }, set: function(u) { + this.setProperty("fromName", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "toName", { get: function() { + return this.properties.toName; + }, set: function(u) { + this.setProperty("toName", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "color", { get: function() { + return this.properties.color; + }, set: function(u) { + this.setProperty("color", Et(u)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "value", { get: function() { + return this.values.value.value; + }, set: function(u) { + this.setValue("value", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "link", { get: function() { + var u = this; + if (!this._link) { + var w = this.component.links.create(); + this._link = w, this.addSprite(w), this._disposers.push(new ln(function() { + u.component && u.component.links.removeValue(w); + })); + } + return this._link; + }, enumerable: !0, configurable: !0 }), R; + }(EH), d9 = function(U) { + function R() { + var u = U.call(this) || this; + u.colors = new Mm(), u.className = "FlowDiagram", u.nodePadding = 20, u.sortBy = "none", u.sequencedInterpolation = !0, u.colors.step = 2, u.minNodeSize = 0.02; + var w = u.chartContainer.createChild(Qn); + w.shouldClone = !1, w.layout = "none", w.isMeasured = !1, u.linksContainer = w; + var $ = u.chartContainer.createChild(Qn); + return $.shouldClone = !1, $.layout = "none", $.isMeasured = !1, u.nodesContainer = $, u.dataItem = u.createDataItem(), u.dataItem.component = u, u.applyTheme(), u; + } + return re(R, U), R.prototype.dispose = function() { + U.prototype.dispose.call(this), this.dataItem.dispose(); + }, R.prototype.validateData = function() { + var u = this; + this._parseDataFrom == 0 && this.nodes.clear(), this.sortNodes(), this.colors.reset(), U.prototype.validateData.call(this); + var w, $, G = 0, K = 0; + er(this.dataItems.iterator(), function(ue) { + var we = ue.fromName; + we && ((De = u.nodes.getKey(we)) || ((De = u.nodes.create(we)).name = we, De.chart = u, De.dataItem = ue), ue.fromNode = De, ue.fromNode.outgoingDataItems.push(ue)); + var De, $e = ue.toName; + if ($e && ((De = u.nodes.getKey($e)) || ((De = u.nodes.create($e)).name = $e, De.chart = u, De.dataItem = ue), ue.toNode = De, ue.toNode.incomingDataItems.push(ue)), !ue.fromNode) { + var Ke = new tR(); + Ke.opacities = [0, 1], ue.link.strokeModifier = Ke; + } + if (!ue.toNode) { + var Ze = new tR(); + Ze.opacities = [1, 0], ue.link.strokeModifier = Ze; + } + var pt = ue.value; + le(pt) && (G += pt, K++, (w > pt || !le(w)) && (w = pt), ($ < pt || !le($)) && ($ = pt)); + }); + var ne = "value"; + this.dataItem.setCalculatedValue(ne, $, "high"), this.dataItem.setCalculatedValue(ne, w, "low"), this.dataItem.setCalculatedValue(ne, G, "sum"), this.dataItem.setCalculatedValue(ne, G / K, "average"), this.dataItem.setCalculatedValue(ne, K, "count"), er(this.nodes.iterator(), function(ue) { + var we = ue[1]; + we.fill instanceof Ie && (we.color = we.fill), we.color == null && (we.color = u.colors.next()), we.dataItem.color != null && (we.color = we.dataItem.color), we.dataItem.visible || we.hide(0), u.getNodeValue(we); + }), this.sortNodes(), this.feedLegend(); + }, R.prototype.handleDataItemWorkingValueChange = function(u, w) { + this.invalidate(); + }, R.prototype.sortNodes = function() { + this.sortBy == "name" ? this._sorted = this.nodes.sortedIterator() : this.sortBy == "value" ? this._sorted = ys(this.nodes.iterator(), function(u, w) { + return gu(jc(u[1].total, w[1].total)); + }) : this._sorted = this.nodes.iterator(); + }, R.prototype.getNodeValue = function(u) { + var w = 0, $ = 0; + er(u.incomingDataItems.iterator(), function(G) { + var K = G.getWorkingValue("value"); + le(K) && (w += K); + }), er(u.outgoingDataItems.iterator(), function(G) { + var K = G.getWorkingValue("value"); + le(K) && ($ += K); + }), u.total = w + $, u.totalIncoming = w, u.totalOutgoing = $; + }, R.prototype.changeSorting = function() { + this.sortNodes(); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Flow diagram")); + }, R.prototype.createDataItem = function() { + return new BL(); + }, Object.defineProperty(R.prototype, "nodePadding", { get: function() { + return this.getPropertyValue("nodePadding"); + }, set: function(u) { + this.setPropertyValue("nodePadding", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sortBy", { get: function() { + return this.getPropertyValue("sortBy"); + }, set: function(u) { + this.setPropertyValue("sortBy", u), this.changeSorting(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minNodeSize", { get: function() { + return this.getPropertyValue("minNodeSize"); + }, set: function(u) { + this.setPropertyValue("minNodeSize", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "nodes", { get: function() { + if (!this._nodes) { + var u = this.createNode(); + u.events.on("hit", function(w) { + w.target.handleHit(w); + }), this._nodes = new Nf(u), this._disposers.push(new jd(this._nodes)); + } + return this._nodes; + }, enumerable: !0, configurable: !0 }), R.prototype.createNode = function() { + var u = new $L(); + return this._disposers.push(u), u; + }, Object.defineProperty(R.prototype, "links", { get: function() { + return this._links || (this._links = new Xs(this.createLink()), this._disposers.push(new Wo(this._links))), this._links; + }, enumerable: !0, configurable: !0 }), R.prototype.createLink = function() { + var u = new aR(); + return this._disposers.push(u), u; + }, R.prototype.feedLegend = function() { + var u = this.legend; + if (u) { + var w = []; + this.nodes.each(function($, G) { + w.push(G); + }), u.data = w, u.dataFields.name = "name"; + } + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this), this.nodes.clear(); + }, R; + }(Kb); + hi.registeredClasses.FlowDiagram = d9; + var uA = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "LabelBullet"; + var w = u.createChild(Rm); + return w.shouldClone = !1, w.verticalCenter = "middle", w.horizontalCenter = "middle", w.truncate = !0, w.hideOversized = !1, w.maxWidth = 500, w.maxHeight = 500, w.stroke = We(), w.strokeOpacity = 0, w.fill = new Fa().getFor("text"), u.events.on("maxsizechanged", u.handleMaxSize, u, !1), u.label = w, u.applyTheme(), u; + } + return re(R, U), R.prototype.handleMaxSize = function() { + this.label.maxWidth = this.maxWidth, this.label.maxHeight = this.maxHeight; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.label.copyFrom(u.label); + }, R; + }(Mo); + hi.registeredClasses.LabelBullet = uA; + var Bf = function(U) { + function R() { + var u = U.call(this) || this; + u.nextInCoord = 0, u.nextOutCoord = 0, u.className = "SankeyNode", u.width = 10, u.height = 10; + var w = u.createChild(uA); + w.shouldClone = !1, w.locationX = 1, w.locationY = 0.5, w.label.text = "{name}", w.width = 150, w.height = 150, w.label.horizontalCenter = "left", w.label.padding(0, 5, 0, 5), u.nameLabel = w; + var $ = u.createChild(uA); + $.shouldClone = !1, $.label.hideOversized = !1, $.locationX = 0.5, $.locationY = 0.5, $.width = 150, $.height = 150, $.label.horizontalCenter = "middle", u.valueLabel = $; + var G = u.hiddenState; + return G.properties.fill = new Fa().getFor("disabledBackground"), G.properties.opacity = 0.5, G.properties.visible = !0, u.background.hiddenState.copyFrom(G), u; + } + return re(R, U), R.prototype.invalidateLinks = function() { + var u = this; + U.prototype.invalidateLinks.call(this), this.nextInCoord = 0, this.nextOutCoord = 0; + var w = this.chart; + if (w) { + var $ = w.orientation; + this._incomingSorted && er(this._incomingSorted, function(G) { + var K = G.link, ne = G.getWorkingValue("value"); + if (le(ne)) { + K.parent = u.chart.linksContainer; + var ue = void 0, we = void 0, De = void 0; + if ($ == "horizontal" ? (ue = u.pixelX + u.dx, we = u.nextInCoord + u.pixelY + u.dy, De = 0) : (we = u.pixelY + u.dy, ue = u.nextInCoord + u.pixelX + u.dx, De = 90), K.endX = ue, K.endY = we, K.startAngle = De, K.endAngle = De, K.gradient.rotation = De, K.linkWidth = ne * w.valueHeight, !G.fromNode) { + $ == "horizontal" ? (K.maxWidth = 200, K.startX = u.pixelX + u.dx - K.maxWidth, K.startY = K.endY) : (K.maxHeight = 200, K.startX = K.endX, K.startY = u.pixelY + u.dy - K.maxHeight), K.gradient, K.fill = G.toNode.color; + var $e = K.gradient.stops.getIndex(0); + $e && (K.colorMode == "gradient" && ($e.color = u.color), $e.opacity = 0, K.fill = K.gradient, K.stroke = K.gradient, K.gradient.validate()); + } + u.nextInCoord += K.linkWidth; + } + }), this._outgoingSorted && er(this._outgoingSorted, function(G) { + var K = G.link; + K.parent = u.chart.linksContainer; + var ne = G.getWorkingValue("value"); + if (le(ne)) { + var ue = void 0, we = void 0, De = void 0; + if ($ == "horizontal" ? (De = 0, ue = u.pixelX + u.pixelWidth + u.dx - 1, we = u.nextOutCoord + u.pixelY + u.dy) : (De = 90, ue = u.nextOutCoord + u.pixelX + u.dx, we = u.pixelY + u.pixelHeight + u.dy - 1), K.startX = ue, K.startY = we, K.startAngle = De, K.endAngle = De, K.gradient.rotation = De, K.linkWidth = ne * u.chart.valueHeight, !G.toNode) { + $ == "horizontal" ? (K.maxWidth = 200, K.endX = u.pixelX + K.maxWidth + u.dx, K.endY = K.startY) : (K.maxHeight = 200, K.endX = K.startX, K.endY = u.pixelY + K.maxHeight + u.dy), K.opacity = u.opacity; + var $e = K.gradient.stops.getIndex(1); + $e && (K.colorMode == "gradient" && ($e.color = u.color), $e.opacity = 0, K.fill = K.gradient, K.stroke = K.gradient, K.gradient.validate()); + } + u.nextOutCoord += K.linkWidth; + } + }); + } + this.positionBullet(this.nameLabel), this.positionBullet(this.valueLabel); + }, R.prototype.positionBullet = function(u) { + u && (u.x = this.measuredWidth * u.locationX, u.y = this.measuredHeight * u.locationY); + }, Object.defineProperty(R.prototype, "level", { get: function() { + return this.getPropertyValue("level"); + }, set: function(u) { + this.setPropertyValue("level", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.nameLabel.copyFrom(u.nameLabel), this.valueLabel.copyFrom(u.valueLabel); + }, R; + }($L); + hi.registeredClasses.SankeyNode = Bf; + var p9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SankeyLink", new Fa(), u.tension = 0.8, u.controlPointDistance = 0.2, u.startAngle = 0, u.endAngle = 0, u.linkWidth = 0, u.startX = 0, u.endX = 0, u.startY = 0, u.endY = 0, u.middleLine = u.createChild(eR), u.middleLine.shouldClone = !1, u.middleLine.strokeOpacity = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.makeBackwards = function() { + this.states.getKey("backwards") != null && this.setState("backwards"); + }, R.prototype.validate = function() { + var u, w, $, G; + if (U.prototype.validate.call(this), !this.isTemplate) { + var K = this.startX, ne = this.startY, ue = this.endX, we = this.endY; + if (this.states.getKey("backwards") && this.setState("default"), this.dataItem) { + var De = this.dataItem.component; + De && (De.orientation == "horizontal" ? ue < K && (K = (u = Me([ue, K], 2))[0], ue = u[1], ne = (w = Me([we, ne], 2))[0], we = w[1], this.makeBackwards()) : we < ne && (ne = ($ = Me([we, ne], 2))[0], we = $[1], K = (G = Me([ue, K], 2))[0], ue = G[1], this.makeBackwards())); + } + le(ue) || (ue = K), le(we) || (we = ne); + var $e = this.startAngle, Ke = this.endAngle, Ze = this.linkWidth, pt = "", Vt = K, Yt = ne, ci = ue, ai = we, Gi = K + Ze * Ue($e), Ji = ue + Ze * Ue(Ke), Ci = ne + Ze * A($e), Hi = we + Ze * A(Ke), sr = K + Ze / 2 * Ue($e), Or = ue + Ze / 2 * Ue(Ke), yr = ne + Ze / 2 * A($e), As = we + Ze / 2 * A(Ke); + this.zIndex = this.zIndex || this.dataItem.index; + var Fn = this.tension + (1 - this.tension) * Ue($e), Aa = this.tension + (1 - this.tension) * A($e); + if (this.middleLine.tensionX = Fn, this.middleLine.tensionY = Aa, le(Ze) && le(K) && le(ue) && le(ne) && le(we)) { + He(Vt, 3) == He(ci, 3) && (ci += 0.01), He(Yt, 3) == He(ai, 3) && (ai += 0.01), He(Gi, 3) == He(Ji, 3) && (Ji += 0.01), He(Ci, 3) == He(Hi, 3) && (Hi += 0.01); + var hh = Math.min(Gi, Ji, Vt, ci), Np = Math.min(Ci, Hi, Yt, ai), bl = Math.max(Gi, Ji, Vt, ci), Vf = Math.max(Ci, Hi, Yt, ai); + this._bbox = { x: hh, y: Np, width: bl - hh, height: Vf - Np }; + var ku = this.controlPointDistance, Bs = Vt + (ci - Vt) * ku * A($e), yf = Yt + (ai - Yt) * ku * Ue($e), vf = ci - (ci - Vt) * ku * A(Ke), Ps = ai - (ai - Yt) * ku * Ue(Ke), zh = sr + (Or - sr) * ku * A($e), au = yr + (As - yr) * ku * Ue($e), dh = Or - (Or - sr) * ku * A(Ke), tw = As - (As - yr) * ku * Ue(Ke), gg = se({ x: Bs, y: yf }, { x: vf, y: Ps }), jf = (Ze / A(gg) - Ze) / si(gg) * A($e), Qv = (Ze / Ue(gg) - Ze) * si(gg) * Ue($e), iw = -jf / 2 + Gi + (Ji - Gi) * ku * A($e), u2 = -Qv / 2 + Ci + (Hi - Ci) * ku * Ue($e), zC = -jf / 2 + Ji - (Ji - Gi) * ku * A(Ke), dA = -Qv / 2 + Hi - (Hi - Ci) * ku * Ue(Ke); + As == yr && (As += 0.01), this.middleLine.segments = [[{ x: sr, y: yr }, { x: zh, y: au }, { x: dh, y: tw }, { x: Or, y: As }]], Bs += jf / 2, yf += Qv / 2, vf += jf / 2, Ps += Qv / 2, pt += pn({ x: Vt, y: Yt }), pt += new Kv(Fn, Aa).smooth([{ x: Vt, y: Yt }, { x: Bs, y: yf }, { x: vf, y: Ps }, { x: ci, y: ai }]), pt += xr({ x: Ji, y: Hi }), pt += new Kv(Fn, Aa).smooth([{ x: Ji, y: Hi }, { x: zC, y: dA }, { x: iw, y: u2 }, { x: Gi, y: Ci }]), pt += " Z"; + } + this.link.path = pt, this.maskBullets && (this.bulletsMask.path = pt, this.bulletsContainer.mask = this.bulletsMask), this.positionBullets(); + } + }, Object.defineProperty(R.prototype, "startX", { get: function() { + return this.getPropertyValue("startX"); + }, set: function(u) { + this.setPropertyValue("startX", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endX", { get: function() { + return this.getPropertyValue("endX"); + }, set: function(u) { + this.setPropertyValue("endX", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startY", { get: function() { + return this.getPropertyValue("startY"); + }, set: function(u) { + this.setPropertyValue("startY", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endY", { get: function() { + return this.getPropertyValue("endY"); + }, set: function(u) { + this.setPropertyValue("endY", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "linkWidth", { get: function() { + return this.getPropertyValue("linkWidth"); + }, set: function(u) { + this.setPropertyValue("linkWidth", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "controlPointDistance", { get: function() { + return this.getPropertyValue("controlPointDistance"); + }, set: function(u) { + this.setPropertyValue("controlPointDistance", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "tension", { get: function() { + return this.getPropertyValue("tension"); + }, set: function(u) { + this.setPropertyValue("tension", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(aR); + hi.registeredClasses.SankeyLink = p9; + var zre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SankeyDiagramDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(BL), Hre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "SankeyDiagram", u.orientation = "horizontal", u.nodeAlign = "middle", u.nodesContainer.width = ce(100), u.nodesContainer.height = ce(100), u.linksContainer.width = ce(100), u.linksContainer.height = ce(100), u.applyTheme(), u; + } + return re(R, U), R.prototype.validateData = function() { + var u = this; + this._valueHeight = void 0, U.prototype.validateData.call(this), this._levelCount = 0, this.nodes.each(function(w, $) { + $.level = void 0; + }), this.nodes.each(function(w, $) { + $.level = u.getNodeLevel($, 0), u._levelCount = ve(u._levelCount, $.level); + }); + }, R.prototype.getNodeLevel = function(u, w) { + var $ = this, G = [w]; + return er(u.incomingDataItems.iterator(), function(K) { + K.fromNode && (le(K.fromNode.level) ? G.push(K.fromNode.level + 1) : ($._counter = 0, $.checkLoop(K.fromNode), $._counter < $.dataItems.length && G.push($.getNodeLevel(K.fromNode, w + 1)))); + }), Math.max.apply(Math, ke(G)); + }, R.prototype.checkLoop = function(u) { + var w = this; + this._counter++, this._counter > this.dataItems.length || er(u.incomingDataItems.iterator(), function($) { + w.checkLoop($.fromNode); + }); + }, R.prototype.calculateValueHeight = function() { + var u = this; + this._levelSum = {}, this._levelNodesCount = {}, this.maxSum = 0; + var w, $, G, K = this.dataItem.values.value.sum; + er(this._sorted, function($e) { + var Ke = $e[1]; + u.getNodeValue(Ke); + }), this.nodes.each(function($e, Ke) { + var Ze = Ke.level, pt = Math.max(Ke.totalIncoming, Ke.totalOutgoing); + pt / K < u.minNodeSize && (pt = K * u.minNodeSize), le(u._levelSum[Ze]) ? u._levelSum[Ze] += pt : u._levelSum[Ze] = pt, le(u._levelNodesCount[Ze]) ? u._levelNodesCount[Ze]++ : u._levelNodesCount[Ze] = 1; + }), w = this.orientation == "horizontal" ? this.chartContainer.maxHeight - 1 : this.chartContainer.maxWidth - 1, mi(this._levelSum, function($e, Ke) { + var Ze = Ke, pt = u._levelNodesCount[$e], Vt = (w - (pt - 1) * u.nodePadding) / Ze; + Vt == 1 / 0 && (Vt = 0), (G > Vt || !le(G)) && (G = Vt, u.maxSum = Ze, $ = It($e)); + }), this._maxSumLevel = $; + var ne = this._levelNodesCount[this._maxSumLevel], ue = (w - (ne - 1) * this.nodePadding) / this.maxSum; + if (ue == 1 / 0 && (ue = 0), le(this.valueHeight)) { + var we = void 0; + try { + we = this._heightAnimation.animationOptions[0].to; + } catch { + } + if (we != ue) { + var De = this.interpolationDuration; + try { + De = this.nodes.template.states.getKey("active").transitionDuration; + } catch { + } + this._heightAnimation = new $f(this, { property: "valueHeight", from: this.valueHeight, to: ue }, De, this.interpolationEasing).start(), this._disposers.push(this._heightAnimation); + } + } else + this.valueHeight = ue; + }, R.prototype.validate = function() { + var u = this; + U.prototype.validate.call(this), this.calculateValueHeight(); + var w, $ = this.nodesContainer, G = {}, K = this._levelNodesCount[this._maxSumLevel], ne = this.dataItem.values.value.sum; + w = this.orientation == "horizontal" ? this.chartContainer.maxHeight - 1 : this.chartContainer.maxWidth - 1, er(this._sorted, function(ue) { + var we, De, $e, Ke = ue[1], Ze = Ke.level, pt = 0, Vt = u._levelNodesCount[Ze]; + switch (u.nodeAlign) { + case "bottom": + pt = (u.maxSum - u._levelSum[Ze]) * u.valueHeight - (Vt - K) * u.nodePadding; + break; + case "middle": + pt = (u.maxSum - u._levelSum[Ze]) * u.valueHeight / 2 - (Vt - K) * u.nodePadding / 2; + } + if (u.maxSum == 0) + switch (u.nodeAlign) { + case "bottom": + pt = w - Vt * (u.minNodeSize * w + u.nodePadding); + break; + case "middle": + pt = w / 2 - Vt / 2 * (u.minNodeSize * w + u.nodePadding); + } + Ke.parent = $; + var Yt = Math.max(Ke.totalIncoming, Ke.totalOutgoing); + if (Yt / ne < u.minNodeSize && (Yt = ne * u.minNodeSize), u.orientation == "horizontal") { + De = (we = (u.innerWidth - Ke.pixelWidth) / u._levelCount) * Ke.level, $e = G[Ze] || pt; + var ci = Yt * u.valueHeight; + ne == 0 && ci == 0 && (ci = u.minNodeSize * w), Ke.height = ci, Ke.minX = De, Ke.maxX = De, G[Ze] = $e + ci + u.nodePadding; + } else { + we = (u.innerHeight - Ke.pixelHeight) / u._levelCount, De = G[Ze] || pt, $e = we * Ke.level; + var ai = Yt * u.valueHeight; + ne == 0 && ai == 0 && (ai = u.minNodeSize * w), Ke.width = ai, Ke.minY = $e, Ke.maxY = $e, G[Ze] = De + ai + u.nodePadding; + } + Ke.x = De, Ke.y = $e; + }); + }, R.prototype.showReal = function(u) { + var w = this; + if (!this.preventShow) { + if (this.interpolationDuration > 0) { + var $ = this.nodesContainer, G = 0; + er(this.links.iterator(), function(K) { + K.hide(0); + }), er(this._sorted, function(K) { + var ne, ue = K[1]; + w.orientation == "horizontal" ? (ue.dx = -($.pixelWidth - ue.pixelWidth) / Math.max(w._levelCount, 1), ne = "dx") : (ue.dy = -($.pixelHeight - ue.pixelHeight) / Math.max(w._levelCount, 1), ne = "dy"); + var we = 0, De = w.interpolationDuration; + w.sequencedInterpolation && (we = w.sequencedInterpolationDelay * G + De * G / nr(w.nodes.iterator())), ue.opacity = 0, ue.invalidateLinks(), ue.animate([{ property: "opacity", from: 0, to: 1 }, { property: ne, to: 0 }], w.interpolationDuration, w.interpolationEasing).delay(we), er(ue.outgoingDataItems.iterator(), function($e) { + var Ke = $e.link.show(w.interpolationDuration); + Ke && !Ke.isFinished() && Ke.delay(we); + }), er(ue.incomingDataItems.iterator(), function($e) { + if (!$e.fromNode) { + var Ke = $e.link.show(w.interpolationDuration); + Ke && !Ke.isFinished() && Ke.delay(we); + } + }), G++; + }); + } + return U.prototype.showReal.call(this); + } + }, R.prototype.changeSorting = function() { + var u = this; + this.sortNodes(); + var w = {}; + er(this._sorted, function($) { + var G, K, ne = $[1], ue = ne.level, we = (u.maxSum - u._levelSum[ue]) * u.valueHeight / 2; + u.orientation == "horizontal" ? (G = "y", K = ne.pixelHeight) : (G = "x", K = ne.pixelWidth), ne.animate({ property: G, to: w[ue] || we }, u.interpolationDuration, u.interpolationEasing), w[ue] = (w[ue] || we) + K + u.nodePadding, ne.invalidateLinks(); + }); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Sankey diagram")); + }, R.prototype.createDataItem = function() { + return new zre(); + }, Object.defineProperty(R.prototype, "nodeAlign", { get: function() { + return this.getPropertyValue("nodeAlign"); + }, set: function(u) { + this.setPropertyValue("nodeAlign", u), this.changeSorting(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u, !0); + var w = this.nodes.template.nameLabel; + u == "vertical" ? (this.nodes.template.width = void 0, w.label.horizontalCenter = "middle", w.locationX = 0.5) : (this.nodes.template.height = void 0, w.label.horizontalCenter = "left", w.locationX = 1); + }, enumerable: !0, configurable: !0 }), R.prototype.createNode = function() { + var u = new Bf(); + return this._disposers.push(u), u; + }, R.prototype.createLink = function() { + var u = new p9(); + return this._disposers.push(u), u; + }, Object.defineProperty(R.prototype, "valueHeight", { get: function() { + return this._valueHeight; + }, set: function(u) { + u != this._valueHeight && (this._valueHeight = u, this.invalidate()); + }, enumerable: !0, configurable: !0 }), R.prototype.disposeData = function() { + U.prototype.disposeData.call(this), this._sorted = this.nodes.iterator(); + }, R; + }(d9); + hi.registeredClasses.SankeyDiagram = Hre; + var f9 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "ChordNode"; + var w = u.createChild(LL); + w.location = 0.5, w.radius = 5, w.text = "{name}", w.zIndex = 1, w.shouldClone = !1, u.label = w, u.layout = "none", u.events.on("positionchanged", u.updateRotation, u, !1), u.isMeasured = !1, u.slice = u.createChild(kC), u.slice.isMeasured = !1; + var $ = u.hiddenState; + return $.properties.fill = new Fa().getFor("disabledBackground"), $.properties.opacity = 0.5, $.properties.visible = !0, u.setStateOnChildren = !1, u.slice.hiddenState.properties.visible = !0, u.adapter.add("tooltipX", function(G, K) { + return K.slice.ix * (K.slice.radius - (K.slice.radius - K.slice.pixelInnerRadius) / 2); + }), u.adapter.add("tooltipY", function(G, K) { + return K.slice.iy * (K.slice.radius - (K.slice.radius - K.slice.pixelInnerRadius) / 2); + }), u; + } + return re(R, U), R.prototype.invalidateLinks = function() { + var u = this; + U.prototype.invalidateLinks.call(this); + var w = this.label, $ = this.slice, G = this.chart; + if (G && $) { + var K = this.total, ne = $.arc, ue = $.startAngle; + this.children.each(function($e) { + if ($e instanceof Mo) { + var Ke = $e.locationX; + le(Ke) || (Ke = 0.5); + var Ze = $e.locationY; + le(Ze) || (Ze = 1); + var pt = ue + ne * Ke, Vt = Ze * $.radius; + $e.x = Vt * A(pt), $e.y = Vt * Ue(pt); + } + }); + var we = ue + ne * w.location, De = ue + (1 - K / this.adjustedTotal) * ne * 0.5; + Pe(De) && (De = ue), w.fixPosition(we, $.radius), this.nextAngle = De, this._outgoingSorted && er(this._outgoingSorted, function($e) { + var Ke = $e.link; + Ke.parent = u.chart.linksContainer; + var Ze = $e.getWorkingValue("value"); + if (le(Ze)) { + if (G.nonRibbon) { + var pt = Ke.percentWidth; + le(pt) || (pt = 5), pt /= 100, Ke.startAngle = ue + ne / 2 - ne / 2 * pt, Ke.arc = ne * pt; + } else + Ke.arc = Ze * G.valueAngle, Ke.startAngle = u.nextAngle, u.nextAngle += Ke.arc; + $e.toNode || (Ke.endAngle = Ke.startAngle), Ke.radius = $.pixelInnerRadius; + } + }), this._incomingSorted && er(this._incomingSorted, function($e) { + var Ke = $e.link; + if (Ke.radius = $.pixelInnerRadius, G.nonRibbon) { + var Ze = Ke.percentWidth; + le(Ze) || (Ze = 5), Ze /= 100, Ke.endAngle = ue + ne / 2 - ne / 2 * Ze, Ke.arc = ne * Ze; + } else { + Ke.endAngle = u.nextAngle; + var pt = $e.getWorkingValue("value"); + le(pt) && (Ke.arc = pt * G.valueAngle, u.nextAngle += Ke.arc); + } + $e.fromNode || (Ke.startAngle = Ke.endAngle); + }); + } + }, R.prototype.updateRotation = function() { + var u = this.slice, w = this.trueStartAngle + u.arc / 2, $ = u.radius, G = $ * A(w), K = $ * Ue(w), ne = se({ x: G + this.pixelX, y: K + this.pixelY }); + u.startAngle = this.trueStartAngle + (ne - w), this.dx = -this.pixelX, this.dy = -this.pixelY; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.label.copyFrom(u.label), this.slice.copyFrom(u.slice); + }, R; + }($L); + hi.registeredClasses.ChordNode = f9; + var x_e = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "QuadraticCurve", u.element = u.paper.add("path"), u.pixelPerfect = !1, u.fill = We(), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + if (le(this.x1 + this.x2 + this.y1 + this.y2 + this.cpx + this.cpy)) { + var u = { x: this.x1, y: this.y1 }, w = { x: this.x2, y: this.y2 }, $ = { x: this.cpx, y: this.cpy }, G = pn(u) + i2(w, $); + this.path = G; + } + }, Object.defineProperty(R.prototype, "cpx", { get: function() { + return this.getPropertyValue("cpx"); + }, set: function(u) { + this.setPropertyValue("cpx", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "cpy", { get: function() { + return this.getPropertyValue("cpy"); + }, set: function(u) { + this.setPropertyValue("cpy", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.positionToPoint = function(u) { + var w = { x: this.x1, y: this.y1 }, $ = { x: this.cpx, y: this.cpy }, G = { x: this.x2, y: this.y2 }, K = Je(w, G, $, u), ne = Je(w, G, $, u + 1e-3); + return { x: K.x, y: K.y, angle: se(K, ne) }; + }, R; + }(q0), m9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ChordLink", u.middleLine = u.createChild(x_e), u.middleLine.shouldClone = !1, u.middleLine.strokeOpacity = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + if (U.prototype.validate.call(this), !this.isTemplate) { + var u = this.startAngle, w = this.endAngle, $ = this.arc, G = this.radius, K = this.dataItem.fromNode, ne = this.dataItem.toNode, ue = 0, we = 0; + K && (ue = K.pixelX + K.dx, we = K.pixelY + K.dy); + var De = 0, $e = 0; + if (ne && (De = ne.pixelX + ne.dx, $e = ne.pixelY + ne.dy), G > 0) { + var Ke = G * A(u) + ue, Ze = G * Ue(u) + we, pt = G * A(w) + De, Vt = G * Ue(w) + $e, Yt = { x: 0, y: 0 }, ci = pn({ x: Ke, y: Ze }); + ci += gd(u, $, G), ci += i2({ x: pt, y: Vt }, Yt), ci += gd(w, $, G), ci += i2({ x: Ke, y: Ze }, Yt), this.link.path = $ > 0 ? ci : "", this.maskBullets && (this.bulletsMask.path = ci, this.bulletsContainer.mask = this.bulletsMask); + var ai = u + $ / 2, Gi = w + $ / 2, Ji = this.middleLine; + Ji.x1 = G * A(ai) + ue, Ji.y1 = G * Ue(ai) + we, Ji.x2 = G * A(Gi) + De, Ji.y2 = G * Ue(Gi) + $e, Ji.cpx = 0, Ji.cpy = 0, Ji.stroke = this.fill, this.positionBullets(); + } + } + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPropertyValue("radius", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "arc", { get: function() { + return this.getPropertyValue("arc"); + }, set: function(u) { + this.setPropertyValue("arc", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(aR); + hi.registeredClasses.ChordLink = m9; + var Wre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ChordDiagramDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(BL), qre = function(U) { + function R() { + var u = U.call(this) || this; + u.valueAngle = 0, u.className = "ChordDiagram", u.startAngle = -90, u.endAngle = 270, u.radius = ce(80), u.innerRadius = -15, u.nodePadding = 5; + var w = u.chartContainer.createChild(Qn); + return w.align = "center", w.valign = "middle", w.shouldClone = !1, w.layout = "absolute", u.chordContainer = w, u.nodesContainer.parent = w, u.linksContainer.parent = w, u.chartContainer.events.on("maxsizechanged", u.invalidate, u, !1), u.applyTheme(), u; + } + return re(R, U), R.prototype.validate = function() { + var u = this, w = this.chartContainer, $ = this.endAngle, G = this.startAngle + this.nodePadding / 2, K = Xt(this.startAngle, this.endAngle, 1); + K = Ve([K, { x: 0, y: 0, width: 0, height: 0 }]); + var ne = Math.min(w.innerWidth / K.width, w.innerHeight / K.height); + le(ne) || (ne = 0); + var ue = yo(this.radius, ne), we = yo(this.innerRadius, ue, !0), De = this.dataItem.values.value.sum, $e = 0, Ke = 0; + er(this._sorted, function(Ze) { + var pt = Ze[1]; + u.getNodeValue(pt), $e++; + var Vt = pt.total; + pt.total / De < u.minNodeSize && (Vt = De * u.minNodeSize), Ke += Vt; + }), this.valueAngle = ($ - this.startAngle - this.nodePadding * $e) / Ke, er(this._sorted, function(Ze) { + var pt = Ze[1], Vt = pt.slice; + Vt.radius = ue, Vt.innerRadius = we; + var Yt, ci = pt.total; + pt.total / De < u.minNodeSize && (ci = De * u.minNodeSize), pt.adjustedTotal = ci, Yt = u.nonRibbon ? ($ - u.startAngle) / $e - u.nodePadding : u.valueAngle * ci, Vt.arc = Yt, Vt.startAngle = G, pt.trueStartAngle = G, pt.parent = u.nodesContainer, pt.validate(), G += Yt + u.nodePadding; + }), this.chordContainer.definedBBox = { x: ue * K.x, y: ue * K.y, width: ue * K.width, height: ue * K.height }, this.chordContainer.invalidateLayout(), U.prototype.validate.call(this); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Chord diagram")); + }, R.prototype.createDataItem = function() { + return new Wre(); + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "nonRibbon", { get: function() { + return this.getPropertyValue("nonRibbon"); + }, set: function(u) { + this.setPropertyValue("nonRibbon", u, !0), this.links.template.middleLine.strokeOpacity = 1, this.links.template.link.fillOpacity = 0; + }, enumerable: !0, configurable: !0 }), R.prototype.createNode = function() { + var u = new f9(); + return this._disposers.push(u), u; + }, R.prototype.createLink = function() { + var u = new m9(); + return this._disposers.push(u), u; + }, R; + }(d9); + hi.registeredClasses.ChordDiagram = qre; + var jC = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Column", u.width = ce(80), u.height = ce(80), u.events.disableType("transformed"), u.applyOnClones = !0, u.strokeOpacity = 1, u.layout = "none", u.createAssets(), u.events.on("childadded", u.handleKidAdded, u, !1), u; + } + return re(R, U), R.prototype.handleKidAdded = function() { + this.layout == "none" && (this.layout = "absolute"); + }, R.prototype.createAssets = function() { + this.column = this.createChild(L1), this.column.shouldClone = !1, this.column.isMeasured = !1, this.column.cornerRadius(0, 0, 0, 0), this._disposers.push(this.column); + }, R.prototype.validate = function() { + U.prototype.validate.call(this); + var u = this.column; + u && (u.width = H(this.pixelWidth, this.maxWidth), u.height = H(this.pixelHeight, this.maxHeight), u.invalid && u.validate()); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.column && this.column.copyFrom(u.column); + }, Object.defineProperty(R.prototype, "bbox", { get: function() { + return this.definedBBox ? this.definedBBox : this.column ? { x: 0, y: 0, width: this.column.measuredWidth, height: this.column.measuredHeight } : { x: 0, y: 0, width: H(this.pixelWidth, this.maxWidth), height: H(this.pixelHeight, this.maxHeight) }; + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.Column = jC; + var k1 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColumnSeriesDataItem", u.locations.dateX = 0.5, u.locations.dateY = 0.5, u.locations.categoryX = 0.5, u.locations.categoryY = 0.5, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "column", { get: function() { + return this._column; + }, set: function(u) { + this.setColumn(u); + }, enumerable: !0, configurable: !0 }), R.prototype.setColumn = function(u) { + var w = this; + if (this._column && u != this._column && ki(this.sprites, this._column), this._column = u, u) { + var $ = u.dataItem; + $ && $ != this && ($.column = void 0), this.addSprite(u), this._disposers.push(new ln(function() { + w.component && w.component.columns.removeValue(u); + })); + } + }, Object.defineProperty(R.prototype, "width", { get: function() { + var u = this.properties.width; + return this._adapterO && (u = this._adapterO.apply("width", u)), u; + }, set: function(u) { + this.properties.width != u && (this.properties.width = u, this.component && this.component.validateDataElement(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "height", { get: function() { + var u = this.properties.height; + return this._adapterO && (u = this._adapterO.apply("height", u)), u; + }, set: function(u) { + this.properties.height != u && (this.properties.height = u, this.component && this.component.validateDataElement(this)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "rangesColumns", { get: function() { + return this._rangesColumns || (this._rangesColumns = new ha()), this._rangesColumns; + }, enumerable: !0, configurable: !0 }), R; + }(Dm), Y0 = function(U) { + function R() { + var u = U.call(this) || this; + u._startLocation = 0, u._endLocation = 1, u.className = "ColumnSeries", u.width = ce(100), u.height = ce(100), u.strokeOpacity = 0, u.fillOpacity = 1, u.clustered = !0; + var w = u.mainContainer.createChild(Qn); + return w.shouldClone = !1, w.isMeasured = !1, w.layout = "none", u._columnsContainer = w, u.columns.template.pixelPerfect = !1, u.tooltipColorSource = u.columns.template, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "columnsContainer", { get: function() { + return this._columnsContainer; + }, enumerable: !0, configurable: !0 }), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Column Series")); + }, R.prototype.createDataItem = function() { + return new k1(); + }, R.prototype.validate = function() { + var u = this; + if (this.group.node.removeAttribute("fill"), this.chart && this.xAxis && this.yAxis) { + var w, $ = this.chart.series, G = 0, K = 0, ne = []; + er($.iterator(), function(Vt) { + var Yt; + Vt instanceof R && u.baseAxis == Vt.baseAxis && (Yt = u.baseAxis == u.xAxis ? u.chart.yAxes.indexOf(Vt.yAxis) : u.chart.xAxes.indexOf(Vt.xAxis), ne.push({ series: Vt, axis: Yt })); + }), ne.sort(function(Vt, Yt) { + return Vt.axis - Yt.axis; + }), _i(ne, function(Vt) { + var Yt = Vt.series; + Yt instanceof R && ((!Yt.stacked && Yt.clustered || w != Vt.axis && Yt.clustered) && G++, Yt == u && (K = G - 1)), w = Vt.axis; + }), this.clustered || (K = 0, G = 1); + var ue = this.baseAxis.renderer, we = ue.cellStartLocation, De = ue.cellEndLocation; + this._startLocation = we + K / G * (De - we), this._endLocation = we + (K + 1) / G * (De - we); + var $e = this.xAxis, Ke = this.yAxis; + $e instanceof Eh && Ke instanceof vo && $e.sortBySeries == this && this.sortCategoryAxis($e, "valueY"), Ke instanceof Eh && $e instanceof vo && Ke.sortBySeries == this && this.sortCategoryAxis(Ke, "valueX"); + } + U.prototype.validate.call(this); + for (var Ze = 0; Ze < this.startIndex; Ze++) { + var pt = this.dataItems.getIndex(Ze); + this.disableUnusedColumns(pt); + } + for (Ze = this.dataItems.length - 1; Ze > this.endIndex; Ze--) + pt = this.dataItems.getIndex(Ze), this.disableUnusedColumns(pt); + this._propertiesChanged = !1; + }, R.prototype.sortCategoryAxis = function(u, w) { + var $ = this; + this.dataItems.values.sort(function(K, ne) { + return ne.values[w].workingValue - K.values[w].workingValue; + }); + var G = 0; + this.dataItems.each(function(K) { + K._index = G, G++; + }), u.dataItems.each(function(K) { + var ne = K.component, ue = ne.categoryToPosition(K.category) - K.deltaPosition, we = ne.getSeriesDataItemByCategory(K.category, $); + if (we) { + var De = $.dataItems.indexOf(we); + K._index = De; + var $e = He((De + 0.5) / $.dataItems.length - ue, 3); + K.deltaAnimation && !K.deltaAnimation.isDisposed() && K.deltaAnimation.animationOptions[0].to == $e || $e != He(K.deltaPosition, 3) && (K.deltaAnimation && K.deltaAnimation.stop(), K.deltaAnimation = K.animate({ property: "deltaPosition", from: -$e, to: 0 }, ne.interpolationDuration, ne.interpolationEasing), $._disposers.push(K.deltaAnimation)); + } + }), u.dataItems.values.sort(function(K, ne) { + return K.index - ne.index; + }); + }, R.prototype.validateDataElement = function(u) { + this.chart && this.xAxis && this.yAxis && (this.validateDataElementReal(u), U.prototype.validateDataElement.call(this, u)); + }, R.prototype.getStartLocation = function(u) { + var w = this._startLocation; + return this.baseAxis == this.xAxis ? w += u.locations[this.xOpenField] - 0.5 : w += u.locations[this.yOpenField] - 0.5, w; + }, R.prototype.getEndLocation = function(u) { + var w = this._endLocation; + return this.baseAxis == this.xAxis ? w += u.locations[this.xField] - 0.5 : w += u.locations[this.yField] - 0.5, w; + }, R.prototype.validateDataElementReal = function(u) { + var w, $, G, K, ne = this, ue = this.getStartLocation(u), we = this.getEndLocation(u), De = this.xField, $e = this.xOpenField, Ke = this.yField, Ze = this.yOpenField, pt = this.columns.template, Vt = pt.percentWidth, Yt = pt.percentHeight, ci = pt.pixelWidth, ai = pt.pixelHeight, Gi = pt.maxWidth, Ji = pt.maxHeight, Ci = pt.pixelPaddingLeft, Hi = pt.pixelPaddingRight, sr = pt.pixelPaddingTop, Or = pt.pixelPaddingBottom, yr = !1, As = u.width; + Ee(As) && (le(As) && (ci = As), As instanceof J && (Vt = 100 * As.value)); + var Fn = u.height; + if (Ee(Fn) && (le(Fn) && (ai = Fn), Fn instanceof J && (Yt = 100 * Fn.value)), this.xAxis instanceof Eh && this.yAxis instanceof Eh) { + if (!u.hasValue(this._xValueFields) || !u.hasValue(this._yValueFields)) + return; + ue = 0, we = 1, Pe(Vt) || (ue += bl = He((we - ue) * (1 - Vt / 100) / 2, 5), we -= bl), w = this.xAxis.getX(u, $e, ue), $ = this.xAxis.getX(u, De, we), Pe(Vt) && (w += bl = ($ - w - ci) / 2, $ -= bl), !Pe(Gi) && Gi < Math.abs($ - w) && (w += bl = ($ - w - Gi) / 2, $ -= bl), ue = 0, we = 1, Pe(Yt) || (ue += bl = He((1 - Yt / 100) / 2, 5), we -= bl), G = this.yAxis.getY(u, Ze, ue), K = this.yAxis.getY(u, Ke, we), Pe(Yt) && (K += bl = (K - G - ai) / 2, G -= bl), !Pe(Ji) && Ji < Math.abs(K - G) && (K += bl = (K - G - Ji) / 2, G -= bl), $ = this.fixHorizontalCoordinate($), w = this.fixHorizontalCoordinate(w), G = this.fixVerticalCoordinate(G), K = this.fixVerticalCoordinate(K); + } else if (this.baseAxis == this.xAxis) { + if (!u.hasValue(this._yValueFields)) + return; + Pe(Vt) || (ue += bl = He((we - ue) * (1 - Vt / 100) / 2, 5), we -= bl), w = this.xAxis.getX(u, $e, ue), $ = this.xAxis.getX(u, De, we), Pe(Vt) && (w += bl = ($ - w - ci) / 2, $ -= bl), !Pe(Gi) && Gi < Math.abs($ - w) && (w += bl = ($ - w - Gi) / 2, $ -= bl); + var Aa = u.locations[Ze], hh = u.locations[Ke]; + this.yAxis instanceof vo && this.dataFields[this.yField] != this.dataFields[this.yOpenField] && (Aa = 0, hh = 0), K = this.yAxis.getY(u, Ze, Aa), G = this.yAxis.getY(u, Ke, hh); + var Np = Math.ceil(this.yAxis.axisLength); + (G < 0 && K < 0 || G > Np && K > Np) && (yr = !0), G = this.fixVerticalCoordinate(G), K = this.fixVerticalCoordinate(K), Math.abs($ - w) - Ci - Hi == 0 && (yr = !0); + } else { + if (!u.hasValue(this._xValueFields)) + return; + var bl; + Pe(Yt) || (ue += bl = He((we - ue) * (1 - Yt / 100) / 2, 5), we -= bl), G = this.yAxis.getY(u, Ze, ue), K = this.yAxis.getY(u, Ke, we), Pe(Yt) && (K -= bl = (K - G - ai) / 2, G += bl), !Pe(Ji) && Ji < Math.abs(K - G) && (K -= bl = (K - G - Ji) / 2, G += bl); + var Vf = u.locations[De], ku = u.locations[$e]; + this.xAxis instanceof vo && this.dataFields[this.xField] != this.dataFields[this.xOpenField] && (Vf = 0, ku = 0), $ = this.xAxis.getX(u, De, Vf), w = this.xAxis.getX(u, $e, ku), Np = Math.ceil(this.xAxis.axisLength), ($ < 0 && w < 0 || $ > Np && w > Np) && (yr = !0), $ = this.fixHorizontalCoordinate($), w = this.fixHorizontalCoordinate(w), Math.abs(G - K) - sr - Or == 0 && (yr = !0); + } + var Bs, yf = Math.abs($ - w), vf = Math.abs(K - G), Ps = Math.min(w, $), zh = Math.min(G, K); + yr ? this.disableUnusedColumns(u) : (u.column ? (Bs = u.column, this._propertiesChanged && (_r(this, Bs, lc), _r(this.columns.template, Bs, lc), _i(lc, function(au) { + Bs[au] = Bs[au]; + }))) : (_r(this, Bs = this.columns.create(), lc), _r(this.columns.template, Bs, lc), u.addSprite(Bs), u.column = Bs, Bs.paper = this.paper, this.itemsFocusable() ? (Ee(this.role) || (this.role = "menu"), Ee(Bs.role) || (Bs.role = "menuitem"), Bs.focusable = !0) : (Ee(this.role) || (this.role = "list"), Ee(Bs.role) || (Bs.role = "listitem"), Bs.focusable = !1), Bs.focusable && (Bs.events.on("focus", function(au) { + Bs.readerTitle = ne.populateString(ne.itemReaderText, u); + }, void 0, !1), Bs.events.on("blur", function(au) { + Bs.readerTitle = ""; + }, void 0, !1)), Bs.hoverable && (Bs.events.on("over", function(au) { + Bs.readerTitle = ne.populateString(ne.itemReaderText, u); + }, void 0, !1), Bs.events.on("out", function(au) { + Bs.readerTitle = ""; + }, void 0, !1)), Bs.parent = this.columnsContainer, Bs.virtualParent = this), Bs.width = yf, Bs.height = vf, Bs.x = Ps, Bs.y = zh, Bs.realX = w, Bs.realY = G, Bs.realWidth = $ - w, Bs.realHeight = K - G, this.setColumnStates(Bs), Bs.invalid && Bs.validate(), Bs.__disabled = !1, er(this.axisRanges.iterator(), function(au) { + var dh = u.rangesColumns.getKey(au.uid); + dh || (dh = ne.columns.create(), _r(au.contents, dh, lc), u.addSprite(dh), u.rangesColumns.setKey(au.uid, dh), dh.paper = ne.paper), dh.parent = au.contents, dh.width = yf, dh.height = vf, dh.x = Ps, dh.y = zh, ne.setColumnStates(dh), dh.invalid && dh.validate(), dh.__disabled = !1; + })), u.itemWidth = yf, u.itemHeight = vf; + }, R.prototype.disableUnusedColumns = function(u) { + u && (u.column && (u.column.width = 0, u.column.height = 0, u.column.__disabled = !0), er(this.axisRanges.iterator(), function(w) { + var $ = u.rangesColumns.getKey(w.uid); + $ && ($.width = 0, $.height = 0, $.__disabled = !0); + })); + }, R.prototype.setColumnStates = function(u) { + if (this._dropFromOpenState || this._dropFromPreviousState || this._riseFromOpenState || this._riseFromPreviousState) { + var w = u.dataItem; + if (this.xAxis instanceof vo || this.yAxis instanceof vo) { + var $, G = void 0, K = void 0; + this.baseAxis == this.yAxis ? (this.xOpenField && this.xField && this.xAxis instanceof vo && ($ = w.getValue(this.xOpenField), G = w.getValue(this.xField)), K = w.getValue(this.xAxis.axisFieldName + "X", "previousChange")) : (this.yOpenField && this.yField && this.yAxis instanceof vo && ($ = w.getValue(this.yOpenField), G = w.getValue(this.yField)), K = w.getValue(this.yAxis.axisFieldName + "Y", "previousChange")), G < $ ? (w.droppedFromOpen = !0, u.defaultState.copyFrom(this._dropFromOpenState), u.setState(this._dropFromOpenState, 0)) : (w.droppedFromOpen = !1, u.defaultState.copyFrom(this._riseFromOpenState), u.setState(this._riseFromOpenState, 0)), K < 0 ? (w.droppedFromPrevious = !0, u.defaultState.copyFrom(this._dropFromPreviousState), u.setState(this._dropFromPreviousState, 0)) : (w.droppedFromPrevious = !1, u.defaultState.copyFrom(this._riseFromPreviousState), u.setState(this._riseFromPreviousState, 0)); + } + } + }, Object.defineProperty(R.prototype, "columns", { get: function() { + return this._columns || (this._columns = new Xs(this.createColumnTemplate()), this._disposers.push(new Wo(this._columns)), this._disposers.push(this._columns.template)), this._columns; + }, enumerable: !0, configurable: !0 }), R.prototype.createColumnTemplate = function() { + return new jC(); + }, Object.defineProperty(R.prototype, "clustered", { get: function() { + return this.getPropertyValue("clustered"); + }, set: function(u) { + this.setPropertyValue("clustered", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dropFromOpenState", { get: function() { + return this._dropFromOpenState || (this._dropFromOpenState = this.states.create("dropFromOpenState")), this._dropFromOpenState; + }, set: function(u) { + this._dropFromOpenState = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dropFromPreviousState", { get: function() { + return this._dropFromPreviousState || (this._dropFromPreviousState = this.states.create("dropFromPreviousState")), this._dropFromPreviousState; + }, set: function(u) { + this._dropFromPreviousState = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "riseFromOpenState", { get: function() { + return this._riseFromOpenState || (this._riseFromOpenState = this.states.create("riseFromOpenState")), this._riseFromOpenState; + }, set: function(u) { + this._riseFromOpenState = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "riseFromPreviousState", { get: function() { + return this._riseFromPreviousState || (this._riseFromPreviousState = this.states.create("riseFromPreviousState")), this._riseFromPreviousState; + }, set: function(u) { + this._riseFromPreviousState = u; + }, enumerable: !0, configurable: !0 }), R.prototype.updateLegendValue = function(u, w) { + var $ = this; + if (U.prototype.updateLegendValue.call(this, u, w), this.legendDataItem) { + var G, K, ne = this.legendDataItem.marker; + u && (G = u.droppedFromOpen ? this._dropFromOpenState : this._riseFromOpenState, K = u.droppedFromPrevious ? this._dropFromPreviousState : this._riseFromPreviousState), er(ne.children.iterator(), function(ue) { + u ? (ue.setState(K), ue.setState(G)) : (ue.setState($._riseFromPreviousState), ue.setState($._riseFromOpenState)); + }); + } + }, R.prototype.createLegendMarker = function(u) { + var w = u.pixelWidth, $ = u.pixelHeight; + u.removeChildren(); + var G = u.createChild(L1); + G.shouldClone = !1, _r(this, G, lc), G.copyFrom(this.columns.template), G.padding(0, 0, 0, 0), G.width = w, G.height = $; + var K = u.dataItem; + K.color = this.fill, K.colorOrig = this.fill; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.columns.template.copyFrom(u.columns.template); + }, R.prototype.getBulletLocationX = function(u, w) { + if (this.baseAxis == this.xAxis) { + var $ = u.locationX; + le($) || ($ = 0.5); + var G = this.getEndLocation(u.dataItem); + return G - (G - this.getStartLocation(u.dataItem)) * $; + } + return U.prototype.getBulletLocationX.call(this, u, w); + }, R.prototype.getBulletLocationY = function(u, w) { + if (this.baseAxis == this.yAxis) { + var $ = u.locationY; + le($) || ($ = 0.5); + var G = this.getEndLocation(u.dataItem); + return G - (G - this.getStartLocation(u.dataItem)) * $; + } + return U.prototype.getBulletLocationY.call(this, u, w); + }, R.prototype.getAdjustedXLocation = function(u, w, $) { + return le($) || ($ = u ? u.locations[w] : 0.5), this._endLocation - (this._endLocation - this._startLocation) * (1 - $); + }, R.prototype.getAdjustedYLocation = function(u, w, $) { + return le($) || ($ = u ? u.locations[w] : 0.5), this._endLocation - (this._endLocation - this._startLocation) * $; + }, R.prototype.fixVerticalCoordinate = function(u) { + var w = this.columns.template.pixelPaddingBottom; + return mt(u, -this.columns.template.pixelPaddingTop, this.yAxis.axisLength + w); + }, R.prototype.fixHorizontalCoordinate = function(u) { + var w = this.columns.template.pixelPaddingLeft, $ = this.columns.template.pixelPaddingRight; + return mt(u, -w, this.xAxis.axisLength + $); + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this), this.columns.clear(); + }, R; + }(BC); + hi.registeredClasses.ColumnSeries = Y0, hi.registeredClasses.ColumnSeriesDataItem = k1; + var UH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "TreeMapSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "parentName", { get: function() { + var u = this.treeMapDataItem; + if (u && u.parent) + return u.parent.name; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "value", { get: function() { + var u = this.treeMapDataItem; + if (u) + return u.value; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "treeMapDataItem", { get: function() { + return this._dataContext; + }, enumerable: !0, configurable: !0 }), R.prototype.hide = function(u, w, $, G) { + var K = this.treeMapDataItem; + return K && K.hide(u), U.prototype.hide.call(this, u, w, $, G); + }, R.prototype.show = function(u, w, $) { + var G = this.treeMapDataItem; + return G && G.show(u, w, $), U.prototype.show.call(this, u, w, $); + }, R; + }(k1), VL = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "TreeMapSeries", u.applyTheme(), u.fillOpacity = 1, u.strokeOpacity = 1, u.minBulletDistance = 0, u.columns.template.tooltipText = "{parentName} {name}: {value}", u.columns.template.configField = "config"; + var w = new Fa(); + return u.stroke = w.getFor("background"), u.dataFields.openValueX = "x0", u.dataFields.valueX = "x1", u.dataFields.openValueY = "y0", u.dataFields.valueY = "y1", u.sequencedInterpolation = !1, u.showOnInit = !1, u.columns.template.pixelPerfect = !1, u; + } + return re(R, U), R.prototype.processDataItem = function(u, w) { + w.seriesDataItem = u, U.prototype.processDataItem.call(this, u, w); + }, R.prototype.createDataItem = function() { + return new UH(); + }, R.prototype.show = function(u) { + if (!this.preventShow) { + var w = this.defaultState.transitionDuration; + return le(u) && (w = u), this.dataItems.each(function($) { + $.show(u); + }), U.prototype.showReal.call(this, w); + } + }, R.prototype.hide = function(u) { + var w = this.defaultState.transitionDuration; + le(u) && (w = u); + var $ = U.prototype.hideReal.call(this, w); + return this.dataItems.each(function(G) { + G.hide(u); + }), $; + }, R.prototype.processValues = function() { + }, R.prototype.getStartLocation = function(u) { + return 0; + }, R.prototype.getEndLocation = function(u) { + return 1; + }, R.prototype.dataChangeUpdate = function() { + }, R.prototype.processConfig = function(u) { + u && (Ee(u.dataFields) && ct(u.dataFields) || (u.dataFields = {})), U.prototype.processConfig.call(this, u); + }, R.prototype.createLegendMarker = function(u) { + var w = u.pixelWidth, $ = u.pixelHeight; + u.removeChildren(); + var G = u.createChild(L1); + G.shouldClone = !1, _r(this, G, lc), G.padding(0, 0, 0, 0), G.width = w, G.height = $; + var K = u.dataItem; + K.color = G.fill, K.colorOrig = G.fill; + }, R.prototype.disableUnusedColumns = function(u) { + U.prototype.disableUnusedColumns.call(this, u), u.column && (u.column.__disabled = !1); + }, R; + }(Y0); + hi.registeredClasses.TreeMapSeries = VL, hi.registeredClasses.TreeMapSeriesDataItem = UH; + var zH = function(U) { + function R() { + var u = U.call(this) || this; + return u.rows = [], u.className = "TreeMapDataItem", u.values.value = { workingValue: 0 }, u.values.x0 = {}, u.values.y0 = {}, u.values.x1 = {}, u.values.y1 = {}, u.hasChildren.children = !0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "legendDataItem", { get: function() { + return this._legendDataItem; + }, set: function(u) { + this._legendDataItem = u, u.label && (u.label.dataItem = this), u.valueLabel && (u.valueLabel.dataItem = this); + }, enumerable: !0, configurable: !0 }), R.prototype.getDuration = function() { + return 0; + }, Object.defineProperty(R.prototype, "value", { get: function() { + var u = 0; + return this.children && this.children.length != 0 ? er(this.children.iterator(), function(w) { + var $ = w.value; + le($) && (u += $); + }) : u = this.values.value.workingValue, u; + }, set: function(u) { + this.setValue("value", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "percent", { get: function() { + return this.parent ? this.value / this.parent.value * 100 : 100; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "x0", { get: function() { + return this.values.x0.value; + }, set: function(u) { + this.setValue("x0", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "x1", { get: function() { + return this.values.x1.value; + }, set: function(u) { + this.setValue("x1", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y0", { get: function() { + return this.values.y0.value; + }, set: function(u) { + this.setValue("y0", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "y1", { get: function() { + return this.values.y1.value; + }, set: function(u) { + this.setValue("y1", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "name", { get: function() { + return this.properties.name; + }, set: function(u) { + this.setProperty("name", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "children", { get: function() { + return this.properties.children; + }, set: function(u) { + this.setProperty("children", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "level", { get: function() { + return this.parent ? this.parent.level + 1 : 0; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "color", { get: function() { + var u = this.properties.color; + return u == null && this.parent && (u = this.parent.color), u == null && this.component && (u = this.component.colors.getIndex(this.component.colors.step * this.index)), u; + }, set: function(u) { + this.setProperty("color", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fill", { get: function() { + return this.color; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "series", { get: function() { + return this._series; + }, set: function(u) { + u != this._series && (this._series && (this.component.series.removeValue(this._series), this._series.dispose()), this._series = u, this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), R.prototype.hide = function(u, w, $, G) { + this.setWorkingValue("value", 0), this.children && this.children.each(function(ne) { + ne.hide(u, w, $, G); + }); + var K = this.seriesDataItem; + return K && K.bullets.each(function(ne, ue) { + ue.hide(), ue.preventShow = !0; + }), U.prototype.hide.call(this, u, w, $, G); + }, R.prototype.show = function(u, w, $) { + this.setWorkingValue("value", this.values.value.value), this.children && this.children.each(function(K) { + K.show(u, w, $); + }); + var G = this.seriesDataItem; + return G && G.bullets.each(function(K, ne) { + ne.preventShow = !1; + }), U.prototype.show.call(this, u, w, $); + }, R; + }(r9), HH = function(U) { + function R() { + var u = U.call(this) || this; + u.layoutAlgorithm = u.squarify, u.zoomable = !0, u.className = "TreeMap", u._usesData = !0, u.maxLevels = 2, u.currentLevel = 0, u.hideParentColumns = !1, u.colors = new Mm(), u.sorting = "descending"; + var w = u.xAxes.push(new vo()); + w.title.disabled = !0, w.strictMinMax = !0; + var $ = w.renderer; + $.inside = !0, $.labels.template.disabled = !0, $.ticks.template.disabled = !0, $.grid.template.disabled = !0, $.axisFills.template.disabled = !0, $.minGridDistance = 100, $.line.disabled = !0, $.baseGrid.disabled = !0; + var G = u.yAxes.push(new vo()); + G.title.disabled = !0, G.strictMinMax = !0; + var K = G.renderer; + K.inside = !0, K.labels.template.disabled = !0, K.ticks.template.disabled = !0, K.grid.template.disabled = !0, K.axisFills.template.disabled = !0, K.minGridDistance = 100, K.line.disabled = !0, K.baseGrid.disabled = !0, K.inversed = !0, u.xAxis = w, u.yAxis = G; + var ne = new VL(); + return u.seriesTemplates = new Nf(ne), ne.virtualParent = u, u._disposers.push(new jd(u.seriesTemplates)), u._disposers.push(ne), u.zoomOutButton.events.on("hit", function() { + u.zoomToChartDataItem(u._homeDataItem); + }, void 0, !1), u.seriesTemplates.events.on("insertKey", function(ue) { + ue.newValue.isTemplate = !0; + }, void 0, !1), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "navigationBar", { get: function() { + return this._navigationBar; + }, set: function(u) { + var w = this; + this._navigationBar != u && (this._navigationBar = u, u.parent = this, u.toBack(), u.links.template.events.on("hit", function($) { + var G = $.target.dataItem.dataContext; + G.isDisposed() || (w.zoomToChartDataItem(G), w.createTreeSeries(G)); + }, void 0, !0), this._disposers.push(u)); + }, enumerable: !0, configurable: !0 }), R.prototype.validateData = function() { + this.series.clear(), this._tempSeries = [], U.prototype.validateData.call(this), this._homeDataItem && this._homeDataItem.dispose(); + var u = this.dataItems.template.clone(); + this._homeDataItem = u, er(this.dataItems.iterator(), function(G) { + G.parent = u; + }), u.children = this.dataItems, u.x0 = 0, u.y0 = 0, u.name = this._homeText; + var w = 1e3, $ = 10 * Math.round(w * this.pixelHeight / this.pixelWidth / 10) || 1e3; + u.x1 = w, u.y1 = $, this.xAxis.min = 0, this.xAxis.max = w, this.xAxis.getMinMax(), this.yAxis.min = 0, this.yAxis.max = $, this.yAxis.getMinMax(), this.layoutItems(u), this.createTreeSeries(u), this.feedLegend(); + }, R.prototype.layoutItems = function(u, w) { + if (u) { + var $ = u.children; + w || (w = this.sorting), w == "ascending" && $.values.sort(function(ue, we) { + return ue.value - we.value; + }), w == "descending" && $.values.sort(function(ue, we) { + return we.value - ue.value; + }), this._updateDataItemIndexes(0), this.layoutAlgorithm(u); + for (var G = 0, K = $.length; G < K; G++) { + var ne = $.getIndex(G); + ne.children && this.layoutItems(ne); + } + } + }, R.prototype.createTreeSeries = function(u) { + var w = this; + this._tempSeries = []; + for (var $ = [u], G = u.parent; G != null; ) + this.initSeries(G), $.push(G), G = G.parent; + $.reverse(), this.navigationBar && (this.navigationBar.data = $), this.createTreeSeriesReal(u), _i(this._tempSeries, function(K) { + w.series.indexOf(K) == -1 && w.series.push(K), K.zIndex = K.level; + }); + }, R.prototype.createTreeSeriesReal = function(u) { + if (u.children && u.level < this.currentLevel + this.maxLevels) { + this.initSeries(u); + for (var w = 0; w < u.children.length; w++) { + var $ = u.children.getIndex(w); + $.children && this.createTreeSeriesReal($); + } + } + }, R.prototype.setData = function(u) { + this.currentLevel = 0, this.currentlyZoomed = void 0, this.xAxis.start = 0, this.xAxis.end = 1, this.yAxis.start = 0, this.yAxis.end = 1, U.prototype.setData.call(this, u); + }, R.prototype.seriesAppeared = function() { + return !0; + }, R.prototype.initSeries = function(u) { + var w = this; + if (!u.series) { + var $ = void 0, G = this.seriesTemplates.getKey(u.level.toString()); + ($ = G ? G.clone() : this.series.create()).dataItem.dataContext = u, $.name = u.name, $.parentDataItem = u, u.series = $; + var K = u.level; + $.level = K; + var ne = u.dataContext; + ne && ($.config = ne.config), this.dataUsers.removeValue($), $.data = u.children.values, $.fill = u.color, $.columnsContainer.hide(0), $.bulletsContainer.hide(0), $.columns.template.adapter.add("fill", function(ue, we) { + var De = we.dataItem; + if (De) { + var $e = De.treeMapDataItem; + if ($e) + return we.fill = $e.color, we.adapter.remove("fill"), $e.color; + } + }), this.zoomable && (u.level > this.currentLevel || u.children && u.children.length > 0) && ($.columns.template.cursorOverStyle = vl.pointer, this.zoomable && $.columns.template.events.on("hit", function(ue) { + var we = ue.target.dataItem; + u.level > w.currentLevel ? w.zoomToChartDataItem(we.treeMapDataItem.parent) : w.zoomToSeriesDataItem(we); + }, this, void 0)); + } + this._tempSeries.push(u.series); + }, R.prototype.toggleBullets = function(u) { + var w = this; + er(this.series.iterator(), function($) { + w._tempSeries.indexOf($) == -1 ? ($.columnsContainer.hide(), $.bulletsContainer.hide(u)) : ($.columnsContainer.show(), $.bulletsContainer.show(u), $.dataItems.each(function(G) { + G.bullets.each(function(K, ne) { + ne.show(); + }); + }), $.level < w.currentLevel ? (w.hideParentColumns && $.columnsContainer.hide(), $.bulletsContainer.hide(u)) : $.level == w.currentLevel && w.maxLevels > 1 && $.dataItems.each(function(G) { + G.treeMapDataItem.children && G.bullets.each(function(K, ne) { + ne.hide(); + }); + })); + }); + }, R.prototype.zoomToSeriesDataItem = function(u) { + this.zoomToChartDataItem(u.treeMapDataItem); + }, R.prototype.zoomToChartDataItem = function(u) { + var w = this; + u || (u = this._homeDataItem); + var $ = this.zoomOutButton; + if ($ && (u != this._homeDataItem ? $.show() : $.hide()), u && u.children) { + this.xAxis.zoomToValues(u.x0, u.x1), this.yAxis.zoomToValues(u.y0, u.y1), this.currentLevel = u.level, this.currentlyZoomed = u, this.createTreeSeries(u); + var G = this.xAxis.rangeChangeAnimation || this.yAxis.rangeChangeAnimation; + !G || G.isDisposed() || G.isFinished() ? this.toggleBullets() : (this._dataDisposers.push(G), G.events.once("animationended", function() { + w.toggleBullets(); + })); + } + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("TreeMap chart")); + }, R.prototype.createDataItem = function() { + return new zH(); + }, Object.defineProperty(R.prototype, "maxLevels", { get: function() { + return this.getPropertyValue("maxLevels"); + }, set: function(u) { + this.setPropertyValue("maxLevels", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "currentLevel", { get: function() { + return this.getPropertyValue("currentLevel"); + }, set: function(u) { + this.setPropertyValue("currentLevel", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hideParentColumns", { get: function() { + return this.getPropertyValue("hideParentColumns"); + }, set: function(u) { + this.setPropertyValue("hideParentColumns", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sorting", { get: function() { + return this.getPropertyValue("sorting"); + }, set: function(u) { + this.setPropertyValue("sorting", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.createSeries = function() { + return new VL(); + }, Object.defineProperty(R.prototype, "homeText", { get: function() { + return this._homeText; + }, set: function(u) { + this._homeText = u, this._homeDataItem && (this._homeDataItem.name = this._homeText); + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + if (u) { + if (Ee(u.layoutAlgorithm) && st(u.layoutAlgorithm)) + switch (u.layoutAlgorithm) { + case "squarify": + u.layoutAlgorithm = this.squarify; + break; + case "binaryTree": + u.layoutAlgorithm = this.binaryTree; + break; + case "slice": + u.layoutAlgorithm = this.slice; + break; + case "dice": + u.layoutAlgorithm = this.dice; + break; + case "sliceDice": + u.layoutAlgorithm = this.sliceDice; + break; + default: + delete u.layoutAlgorithm; + } + Ee(u.navigationBar) && !Ee(u.navigationBar.type) && (u.navigationBar.type = "NavigationBar"), U.prototype.processConfig.call(this, u); + } + }, R.prototype.validateLayout = function() { + U.prototype.validateLayout.call(this), this.layoutItems(this.currentlyZoomed); + }, R.prototype.validateDataItems = function() { + U.prototype.validateDataItems.call(this), this.layoutItems(this._homeDataItem), er(this.series.iterator(), function(u) { + u.validateRawData(); + }), this.zoomToChartDataItem(this._homeDataItem); + }, R.prototype.binaryTree = function(u) { + var w, $, G = u.children, K = G.length, ne = new Array(K + 1); + for (ne[0] = $ = w = 0; w < K; ++w) + ne[w + 1] = $ += G.getIndex(w).value; + K > 0 && function ue(we, De, $e, Ke, Ze, pt, Vt) { + if (we >= De - 1) + return (Ci = G.getIndex(we)).x0 = Ke, Ci.y0 = Ze, Ci.x1 = pt, void (Ci.y1 = Vt); + for (var Yt = ne[we], ci = $e / 2 + Yt, ai = we + 1, Gi = De - 1; ai < Gi; ) { + var Ji = ai + Gi >>> 1; + ne[Ji] < ci ? ai = Ji + 1 : Gi = Ji; + } + ci - ne[ai - 1] < ne[ai] - ci && we + 1 < ai && --ai; + var Ci, Hi = ne[ai] - Yt, sr = $e - Hi; + if ($e == 0) + return (Ci = G.getIndex(we)).x0 = Ke, Ci.y0 = Ze, Ci.x1 = pt, void (Ci.y1 = Vt); + if (pt - Ke > Vt - Ze) { + var Or = (Ke * sr + pt * Hi) / $e; + ue(we, ai, Hi, Ke, Ze, Or, Vt), ue(ai, De, sr, Or, Ze, pt, Vt); + } else { + var yr = (Ze * sr + Vt * Hi) / $e; + ue(we, ai, Hi, Ke, Ze, pt, yr), ue(ai, De, sr, Ke, yr, pt, Vt); + } + }(0, K, u.value, u.x0, u.y0, u.x1, u.y1); + }, R.prototype.slice = function(u) { + for (var w, $ = u.x0, G = u.x1, K = u.y0, ne = u.y1, ue = u.children, we = -1, De = ue.length, $e = u.value && (ne - K) / u.value; ++we < De; ) + (w = ue.getIndex(we)).x0 = $, w.x1 = G, w.y0 = K, K += w.value * $e, w.y1 = K; + }, R.prototype.dice = function(u) { + for (var w, $ = u.x0, G = u.x1, K = u.y0, ne = u.y1, ue = u.children, we = -1, De = ue.length, $e = u.value && (G - $) / u.value; ++we < De; ) + (w = ue.getIndex(we)).y0 = K, w.y1 = ne, w.x0 = $, $ += w.value * $e, w.x1 = $; + }, R.prototype.sliceDice = function(u) { + 1 & u.level ? this.slice(u) : this.dice(u); + }, R.prototype.squarify = function(u) { + for (var w, $, G, K, ne, ue, we, De, $e, Ke, Ze = (1 + Math.sqrt(5)) / 2, pt = u.x0, Vt = u.x1, Yt = u.y0, ci = u.y1, ai = u.children, Gi = 0, Ji = 0, Ci = ai.length, Hi = u.value; Gi < Ci; ) { + $ = Vt - pt, G = ci - Yt; + do + K = ai.getIndex(Ji++).value; + while (!K && Ji < Ci); + for (ne = ue = K, Ke = K * K * ($e = Math.max(G / $, $ / G) / (Hi * Ze)), De = Math.max(ue / Ke, Ke / ne); Ji < Ci; ++Ji) { + if (K += w = ai.getIndex(Ji).value, w < ne && (ne = w), w > ue && (ue = w), Ke = K * K * $e, (we = Math.max(ue / Ke, Ke / ne)) > De) { + K -= w; + break; + } + De = we; + } + var sr = this.dataItems.template.clone(); + sr.value = K, sr.dice = $ < G, sr.children = ai.slice(Gi, Ji), sr.x0 = pt, sr.y0 = Yt, sr.x1 = Vt, sr.y1 = ci, sr.dice ? (sr.y1 = Hi ? Yt += G * K / Hi : ci, this.dice(sr)) : (sr.x1 = Hi ? pt += $ * K / Hi : Vt, this.slice(sr)), Hi -= K, Gi = Ji; + } + }, R.prototype.handleSeriesAdded2 = function() { + }, R.prototype.handleDataItemValueChange = function(u, w) { + w == "value" && this.invalidateDataItems(); + }, R.prototype.handleDataItemWorkingValueChange = function(u, w) { + w == "value" && this.invalidateDataItems(); + }, R.prototype.getLegendLevel = function(u) { + if (u && u.children) { + if (u.children.length > 1) + return u; + if (u.children.length == 1) { + var w = u.children.getIndex(0); + return w.children ? this.getLegendLevel(w) : u; + } + return u; + } + }, R.prototype.handleLegendSeriesAdded = function(u) { + }, Object.defineProperty(R.prototype, "homeDataItem", { get: function() { + return this._homeDataItem; + }, enumerable: !0, configurable: !0 }), R.prototype.feedLegend = function() { + var u = this.legend; + if (u) { + u.dataFields.name = "name"; + var w = this.getLegendLevel(this._homeDataItem); + if (w) { + var $ = []; + w.children.each(function(G) { + $.push(G); + }), u.data = $; + } + } + }, R.prototype.disposeData = function() { + U.prototype.disposeData.call(this), this._homeDataItem = void 0, this.series.clear(), this.navigationBar && this.navigationBar.disposeData(), this.xAxis.disposeData(), this.yAxis.disposeData(); + }, R.prototype.getExporting = function() { + var u = this, w = U.prototype.getExporting.call(this); + return w.adapter.add("formatDataFields", function($) { + return $.format != "csv" && $.format != "xlsx" || Ee(u.dataFields.children) && delete $.dataFields[u.dataFields.children], $; + }), w; + }, R; + }(Hy); + hi.registeredClasses.TreeMap = HH; + var cA = function(U) { + function R() { + var u = U.call(this) || this; + return u._chart = new Un(), u.className = "AxisRendererX3D", u._disposers.push(u._chart), u.applyTheme(), u; + } + return re(R, U), R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + if (u.element) { + var K = this.chart.dx3D || 0, ne = this.chart.dy3D || 0, ue = this.getHeight(); + u.path = pn({ x: K, y: ne }) + xr({ x: K, y: ue + ne }) + xr({ x: 0, y: ue }); + } + this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateBaseGridElement = function() { + U.prototype.updateBaseGridElement.call(this); + var u = this.getHeight(), w = this.chart.dx3D || 0, $ = this.chart.dy3D || 0; + this.baseGrid.path = pn({ x: w, y: $ }) + xr({ x: 0, y: 0 }) + xr({ x: 0, y: u }); + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart.get(); + }, set: function(u) { + u && this._chart.set(u, u.events.on("propertychanged", this.handle3DChanged, this, !1)); + }, enumerable: !0, configurable: !0 }), R.prototype.handle3DChanged = function(u) { + u.property != "depth" && u.property != "angle" || this.invalidate(); + }, R; + }(yd); + hi.registeredClasses.AxisRendererX3D = cA; + var WH = function(U) { + function R() { + var u = U.call(this) || this; + return u._chart = new Un(), u.className = "AxisRendererY3D", u._disposers.push(u._chart), u.applyTheme(), u; + } + return re(R, U), R.prototype.updateGridElement = function(u, w, $) { + w += ($ - w) * u.location; + var G = this.positionToPoint(w); + if (u.element) { + var K = this.chart.dx3D || 0, ne = this.chart.dy3D || 0, ue = this.getWidth(); + u.path = pn({ x: 0, y: 0 }) + xr({ x: K, y: ne }) + xr({ x: ue + K, y: ne }); + } + this.positionItem(u, G), this.toggleVisibility(u, w, 0, 1); + }, R.prototype.updateBaseGridElement = function() { + U.prototype.updateBaseGridElement.call(this); + var u = this.chart.dx3D || 0, w = this.chart.dy3D || 0, $ = this.getWidth(); + this.baseGrid.path = pn({ x: 0, y: 0 }) + xr({ x: $, y: 0 }) + xr({ x: $ + u, y: w }); + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart.get(); + }, set: function(u) { + u && this._chart.set(u, u.events.on("propertychanged", this.handle3DChanged, this, !1)); + }, enumerable: !0, configurable: !0 }), R.prototype.handle3DChanged = function(u) { + u.property != "depth" && u.property != "angle" || this.invalidate(); + }, R; + }(Zv), qH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Column3D", u; + } + return re(R, U), R.prototype.createAssets = function() { + this.column3D = this.createChild(N1), this.column3D.shouldClone = !1, this.column3D.strokeOpacity = 0, this.column = this.column3D; + }, R.prototype.validate = function() { + U.prototype.validate.call(this), this.column3D && (this.column3D.width = this.pixelWidth, this.column3D.height = this.pixelHeight, this.column3D.invalid && this.column3D.validate()); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.column3D && this.column3D.copyFrom(u.column3D); + }, R.prototype.setFill = function(u) { + U.prototype.setFill.call(this, u), this.column.fill = u; + }, R; + }(jC); + hi.registeredClasses.Column3D = qH; + var lR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColumnSeries3DDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(k1), jL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColumnSeries3D", u.columns.template.column3D.applyOnClones = !0, u.columns.template.hiddenState.properties.visible = !0, u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "columnsContainer", { get: function() { + var u = this.chart; + return u && u.columnsContainer && u.leftAxesContainer.layout != "vertical" && u.rightAxesContainer.layout != "vertical" && u.bottomAxesContainer.layout != "horizontal" && u.topAxesContainer.layout != "horizontal" ? u.columnsContainer : this._columnsContainer; + }, enumerable: !0, configurable: !0 }), R.prototype.validateDataElementReal = function(u) { + U.prototype.validateDataElementReal.call(this, u), u.column && (u.column.dx = this.dx, u.column.dy = this.dy, u.column.visible = this.visible); + }, R.prototype.validateDataElements = function() { + U.prototype.validateDataElements.call(this), this.chart && this.chart.invalidateLayout(); + }, R.prototype.createColumnTemplate = function() { + return new qH(); + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u, !0), this.columns.template.column3D.depth = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + this.setPropertyValue("angle", u), this.columns.template.column3D.angle = u; + }, enumerable: !0, configurable: !0 }), R; + }(Y0); + hi.registeredClasses.ColumnSeries3D = jL, hi.registeredClasses.ColumnSeries3DDataItem = lR; + var S_e = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "XYChart3DDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(r9), Yre = function(U) { + function R() { + var u = U.call(this) || this; + u._axisRendererX = cA, u._axisRendererY = WH, u.className = "XYChart3D", u.depth = 30, u.angle = 30; + var w = u.seriesContainer.createChild(Qn); + return w.shouldClone = !1, w.isMeasured = !1, w.layout = "none", u.columnsContainer = w, u.columnsContainer.mask = u.createChild(so), u.applyTheme(), u; + } + return re(R, U), R.prototype.updateSeriesMasks = function() { + if (U.prototype.updateSeriesMasks.call(this), Yx()) { + var u = this.columnsContainer, w = u.mask; + u.mask = void 0, u.mask = w; + } + }, Object.defineProperty(R.prototype, "depth", { get: function() { + return this.getPropertyValue("depth"); + }, set: function(u) { + this.setPropertyValue("depth", u), this.fixLayout(), this.invalidateDataUsers(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "angle", { get: function() { + return this.getPropertyValue("angle"); + }, set: function(u) { + this.setPropertyValue("angle", u), this.fixLayout(), this.invalidateDataUsers(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dx3D", { get: function() { + return A(this.angle) * this.depth; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "dy3D", { get: function() { + return -Ue(this.angle) * this.depth; + }, enumerable: !0, configurable: !0 }), R.prototype.validateLayout = function() { + U.prototype.validateLayout.call(this), this.fixColumns(); + }, R.prototype.fixLayout = function() { + this.chartContainer.paddingTop = -this.dy3D, this.chartContainer.paddingRight = this.dx3D, this.scrollbarX && (this.scrollbarX.dy = this.dy3D, this.scrollbarX.dx = this.dx3D), this.scrollbarY && (this.scrollbarY.dy = this.dy3D, this.scrollbarY.dx = this.dx3D), this.fixColumns(), U.prototype.fixLayout.call(this); + }, R.prototype.fixColumns = function() { + var u = this, w = 1, $ = 0; + er(this.series.iterator(), function(K) { + K instanceof jL && (!K.clustered && $ > 0 && w++, K.depthIndex = w - 1, $++); + }); + var G = 0; + er(this.series.iterator(), function(K) { + if (K instanceof jL) { + K.depth = u.depth / w, K.angle = u.angle, K.columnsContainer == u.columnsContainer && (K.dx = u.depth / w * A(u.angle) * K.depthIndex, K.dy = -u.depth / w * Ue(u.angle) * K.depthIndex); + var ne = !1; + (K.baseAxis == K.xAxis && K.xAxis.renderer.inversed || K.baseAxis == K.yAxis && K.yAxis.renderer.inversed) && (ne = !0); + var ue = 1; + K.dataItems.each(function(we) { + var De = we.column; + De && (De.zIndex = ne ? 1e3 * (1e3 - ue) + G - 100 * K.depthIndex : 1e3 * ue + G - 100 * K.depthIndex), ue++; + }), ne ? G-- : G++; + } + }), this.maskColumns(); + }, R.prototype.processConfig = function(u) { + if (u && Ee(u.series) && gt(u.series)) + for (var w = 0, $ = u.series.length; w < $; w++) + u.series[w].type = u.series[w].type || "ColumnSeries3D"; + U.prototype.processConfig.call(this, u); + }, R.prototype.maskColumns = function() { + var u = this.plotContainer.pixelWidth, w = this.plotContainer.pixelHeight, $ = this.dx3D, G = this.dy3D, K = pn({ x: 0, y: 0 }) + xr({ x: $, y: G }) + xr({ x: u + $, y: G }) + xr({ x: u + $, y: w + G }) + xr({ x: u, y: w }) + xr({ x: u, y: w }) + xr({ x: 0, y: w }) + " Z", ne = this.columnsContainer; + ne && ne.mask && (ne.mask.path = K); + }, R; + }(Hy); + hi.registeredClasses.XYChart3D = Yre; + var g9 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "HeatLegend", u.markerContainer = u.createChild(Qn), u.markerContainer.shouldClone = !1, u.markerCount = 1; + var w = new L1(); + return w.minHeight = 20, w.minWidth = 20, w.interactionsEnabled = !1, w.fillOpacity = 1, w.cornerRadius(0, 0, 0, 0), u.markerContainer.minHeight = 20, u.markerContainer.minWidth = 20, u.orientation = "horizontal", u.markers = new Xs(w), u._disposers.push(new Wo(u.markers)), u._disposers.push(u.markers.template), u.applyTheme(), u; + } + return re(R, U), R.prototype.getMinFromRules = function(u) { + var w, $ = this.series; + if ($) + return Zr($.heatRules.iterator(), function(G) { + return G.property != u || (w = G.min, !1); + }), w; + }, R.prototype.getMaxFromRules = function(u) { + var w, $ = this.series; + if ($) + return er($.heatRules.iterator(), function(G) { + return G.property != u || (w = G.max, !1); + }), w; + }, R.prototype.validate = function() { + U.prototype.validate.call(this), this.valueAxis.renderer.inversed = this.reverseOrder; + var u = this.series, w = this.minColor, $ = this.maxColor; + if (Ee(w) || (w = Et(this.getMinFromRules("fill"))), Ee($) || ($ = Et(this.getMaxFromRules("fill"))), u) { + var G = u.fill; + !Ee(w) && G instanceof Ie && (w = G), !Ee($) && G instanceof Ie && ($ = G); + } + Ee($) || ($ = Et(this.getMaxFromRules("fill"))); + var K = It(this.getMinFromRules("fillOpacity")); + le(K) || (K = 1); + var ne = It(this.getMaxFromRules("fillOpacity")); + le(ne) || (ne = 1); + var ue = It(this.getMinFromRules("strokeOpacity")); + le(ue) || (ue = 1); + var we = It(this.getMaxFromRules("strokeOpacity")); + le(we) || (we = 1); + for (var De = Et(this.getMinFromRules("stroke")), $e = Et(this.getMaxFromRules("stroke")), Ke = 0; Ke < this.markerCount; Ke++) { + var Ze = this.markers.getIndex(Ke); + if (Ze || ((Ze = this.markers.create()).parent = this.markerContainer, Ze.height = ce(100), Ze.width = ce(100)), this.markerCount == 1) { + var pt = new qg(); + if (this.reverseOrder ? (pt.addColor($, ne), pt.addColor(w, K)) : (pt.addColor(w, K), pt.addColor($, ne)), this.orientation == "vertical" && (pt.rotation = -90), Ze.fill = pt, Ee(De) && Ee($e)) { + var Vt = new qg(); + this.reverseOrder ? (Vt.addColor($e, we), Vt.addColor(De, ue)) : (Vt.addColor(De, ue), Vt.addColor($e, we)), this.orientation == "vertical" && (Vt.rotation = -90), Ze.stroke = Vt; + } + } else { + var Yt = Ke; + this.reverseOrder && (Yt = this.markerCount - Ke - 1); + var ci = new Ie(Wt(w.rgb, $.rgb, Yt / this.markerCount)); + Ze.fill = ci; + var ai = K + (ne - K) * Yt / this.markerCount; + if (Ze.fillOpacity = ai, Ee(De) && Ee($e)) { + var Gi = new Ie(Wt(De.rgb, $e.rgb, Yt / this.markerCount)); + Ze.stroke = Gi; + var Ji = ue + (we - ue) * Yt / this.markerCount; + Ze.strokeOpacity = Ji; + } + } + } + var Ci = this.valueAxis.renderer; + this.markerCount > 1 && (this.orientation == "horizontal" ? Ci.minGridDistance = this.measuredWidth / this.markerCount : Ci.minGridDistance = this.measuredHeight / this.markerCount), this.valueAxis.invalidate(), Ke = this.markerCount; + for (var Hi = this.markers.length; Ke < Hi; Ke++) + this.markers.getIndex(Ke).parent = void 0; + }, Object.defineProperty(R.prototype, "minColor", { get: function() { + return this.getPropertyValue("minColor"); + }, set: function(u) { + u instanceof Ie || (u = Et(u)), this.setColorProperty("minColor", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxColor", { get: function() { + return this.getPropertyValue("maxColor"); + }, set: function(u) { + u instanceof Ie || (u = Et(u)), this.setColorProperty("maxColor", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "markerCount", { get: function() { + return this.getPropertyValue("markerCount"); + }, set: function(u) { + this.setPropertyValue("markerCount", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "minValue", { get: function() { + return this.getPropertyValue("minValue"); + }, set: function(u) { + this.setPropertyValue("minValue", u), this.valueAxis.min = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxValue", { get: function() { + return this.getPropertyValue("maxValue"); + }, set: function(u) { + this.setPropertyValue("maxValue", u), this.valueAxis.max = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u, !0); + var w = this.markerContainer, $ = this.valueAxis; + u == "horizontal" ? (Ee(this.width) || (this.width = 200), this.height = void 0, $.width = ce(100), $.height = void 0, $.tooltip.pointerOrientation = "vertical", this.layout = "vertical", w.width = ce(100), w.height = void 0, $.renderer instanceof yd || ($.renderer = new yd())) : (Ee(this.height) || (this.height = 200), this.width = void 0, this.layout = "horizontal", w.width = void 0, w.height = ce(100), $.height = ce(100), $.width = void 0, $.tooltip.pointerOrientation = "horizontal", $.renderer instanceof Zv || ($.renderer = new Zv()), $.renderer.inside = !0, $.renderer.labels.template.inside = !0, this.markerContainer.reverseOrder = !0); + var G = $.renderer; + G.grid.template.disabled = !0, G.axisFills.template.disabled = !0, G.baseGrid.disabled = !0, G.labels.template.padding(2, 3, 2, 3), G.minHeight = void 0, G.minWidth = void 0, this.markerContainer.layout = u; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "valueAxis", { get: function() { + return this._valueAxis || (this.valueAxis = this.createChild(vo), this.valueAxis.shouldClone = !1), this._valueAxis; + }, set: function(u) { + this._valueAxis = u, u.parent = this, u.strictMinMax = !0, this.orientation = this.orientation; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "series", { get: function() { + return this._series; + }, set: function(u) { + var w = this; + this._series = u; + var $ = "value"; + try { + var G = u.heatRules.getIndex(0).dataField; + G && ($ = G); + } catch { + } + this.updateMinMax(u.dataItem.values[$].low, u.dataItem.values[$].high), u.dataItem.events.on("calculatedvaluechanged", function(K) { + w.updateMinMax(u.dataItem.values[$].low, u.dataItem.values[$].high); + }, void 0, !1), u.heatRules.events.on("inserted", this.invalidate, this, !1), u.heatRules.events.on("removed", this.invalidate, this, !1); + }, enumerable: !0, configurable: !0 }), R.prototype.updateMinMax = function(u, w) { + var $ = this.valueAxis; + le(this.minValue) || ($.min = u, $.invalidate()), le(this.maxValue) || ($.max = w, $.invalidate()); + }, R.prototype.processConfig = function(u) { + if (u && Ee(u.series) && st(u.series) && st(u.series)) + if (this.map.hasKey(u.series)) + u.series = this.map.getKey(u.series); + else { + var w = u.series, $ = this.map.events.on("insertKey", function(G) { + G.key == w && (this.series = G.newValue, $.dispose()); + }, this); + this._disposers.push($), delete u.series; + } + U.prototype.processConfig.call(this, u); + }, R; + }(Qn); + hi.registeredClasses.HeatLegend = g9; + var GL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "Candlestick", u.layout = "none", u; + } + return re(R, U), R.prototype.createAssets = function() { + U.prototype.createAssets.call(this), this.lowLine = this.createChild(q0), this.lowLine.shouldClone = !1, this.highLine = this.createChild(q0), this.highLine.shouldClone = !1; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.lowLine && this.lowLine.copyFrom(u.lowLine), this.highLine && this.highLine.copyFrom(u.highLine); + }, R; + }(jC); + hi.registeredClasses.Candlestick = GL; + var uR = function(U) { + function R() { + var u = U.call(this) || this; + return u.values.lowValueX = {}, u.values.lowValueY = {}, u.values.highValueX = {}, u.values.highValueY = {}, u.className = "CandlestickSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "lowValueX", { get: function() { + return this.values.lowValueX.value; + }, set: function(u) { + this.setValue("lowValueX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "lowValueY", { get: function() { + return this.values.lowValueY.value; + }, set: function(u) { + this.setValue("lowValueY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "highValueX", { get: function() { + return this.values.highValueX.value; + }, set: function(u) { + this.setValue("highValueX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "highValueY", { get: function() { + return this.values.highValueY.value; + }, set: function(u) { + this.setValue("highValueY", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "closeValueX", { get: function() { + return this.values.valueX.value; + }, set: function(u) { + this.setValue("valueX", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "closeValueY", { get: function() { + return this.values.valueY.value; + }, set: function(u) { + this.setValue("valueY", u); + }, enumerable: !0, configurable: !0 }), R; + }(k1), YH = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "CandlestickSeries", u.groupFields.lowValueX = "low", u.groupFields.lowValueY = "low", u.groupFields.highValueX = "high", u.groupFields.highValueY = "high", u.strokeOpacity = 1; + var w = new Fa(), $ = w.getFor("positive"), G = w.getFor("negative"); + return u.dropFromOpenState.properties.fill = G, u.dropFromOpenState.properties.stroke = G, u.riseFromOpenState.properties.fill = $, u.riseFromOpenState.properties.stroke = $, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Candlestick Series")); + }, R.prototype.createDataItem = function() { + return new uR(); + }, R.prototype.validateDataElementReal = function(u) { + U.prototype.validateDataElementReal.call(this, u), this.validateCandlestick(u); + }, R.prototype.validateCandlestick = function(u) { + var w = u.column; + if (w) { + var $ = w.lowLine, G = w.highLine; + if (this.baseAxis == this.xAxis) { + var K = w.pixelWidth / 2; + $.x = K, G.x = K; + var ne = u.getWorkingValue(this.yOpenField), ue = u.getWorkingValue(this.yField), we = this.yAxis.getY(u, this.yOpenField), De = this.yAxis.getY(u, this.yField), $e = this.yAxis.getY(u, this.yLowField), Ke = this.yAxis.getY(u, this.yHighField), Ze = w.pixelY; + $.y1 = $e - Ze, G.y1 = Ke - Ze, ne < ue ? ($.y2 = we - Ze, G.y2 = De - Ze) : ($.y2 = De - Ze, G.y2 = we - Ze); + } + if (this.baseAxis == this.yAxis) { + var pt = w.pixelHeight / 2; + $.y = pt, G.y = pt; + var Vt = u.getWorkingValue(this.xOpenField), Yt = u.getWorkingValue(this.xField), ci = this.xAxis.getX(u, this.xOpenField), ai = this.xAxis.getX(u, this.xField), Gi = this.xAxis.getX(u, this.xLowField), Ji = this.xAxis.getX(u, this.xHighField), Ci = w.pixelX; + $.x1 = Gi - Ci, G.x1 = Ji - Ci, Vt < Yt ? ($.x2 = ci - Ci, G.x2 = ai - Ci) : ($.x2 = ai - Ci, G.x2 = ci - Ci); + } + er(this.axisRanges.iterator(), function(Hi) { + var sr = u.rangesColumns.getKey(Hi.uid); + if (sr) { + var Or = sr.lowLine; + Or.x = $.x, Or.y = $.y, Or.x1 = $.x1, Or.x2 = $.x2, Or.y1 = $.y1, Or.y2 = $.y2; + var yr = sr.highLine; + yr.x = G.x, yr.y = G.y, yr.x1 = G.x1, yr.x2 = G.x2, yr.y1 = G.y1, yr.y2 = G.y2; + } + }); + } + }, Object.defineProperty(R.prototype, "xLowField", { get: function() { + return this._xLowField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yLowField", { get: function() { + return this._yLowField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "xHighField", { get: function() { + return this._xHighField; + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yHighField", { get: function() { + return this._yHighField; + }, enumerable: !0, configurable: !0 }), R.prototype.defineFields = function() { + U.prototype.defineFields.call(this); + var u = this.xAxis, w = this.yAxis; + if (u && w) { + if (this.baseAxis == u) { + var $ = Xu(w.axisFieldName); + this._yLowField = "low" + $ + "Y", this._yHighField = "high" + $ + "Y"; + } + if (this.baseAxis == w) { + var G = Xu(u.axisFieldName); + this._xLowField = "low" + G + "X", this._xHighField = "high" + G + "X"; + } + this.addValueField(u, this._xValueFields, this._xLowField), this.addValueField(u, this._xValueFields, this._xHighField), this.addValueField(w, this._yValueFields, this._yLowField), this.addValueField(w, this._yValueFields, this._yHighField); + } + }, R.prototype.createLegendMarker = function(u) { + var w = u.pixelWidth, $ = u.pixelHeight; + u.removeChildren(); + var G, K, ne = u.createChild(GL); + ne.shouldClone = !1, ne.copyFrom(this.columns.template); + var ue = ne.lowLine, we = ne.highLine; + this.baseAxis == this.yAxis ? (G = w / 3, K = $, ue.y = $ / 2, we.y = $ / 2, ue.x2 = w / 3, we.x2 = w / 3, we.x = w / 3 * 2, ne.column.x = w / 3) : (G = w, K = $ / 3, ue.x = w / 2, we.x = w / 2, ue.y2 = $ / 3, we.y2 = $ / 3, we.y = $ / 3 * 2, ne.column.y = $ / 3), ne.width = G, ne.height = K, _r(this, u, lc), _r(this.columns.template, ne, lc), ne.stroke = this.riseFromOpenState.properties.stroke, ne.fill = ne.stroke; + var De = u.dataItem; + De.color = ne.fill, De.colorOrig = ne.fill; + }, R.prototype.createColumnTemplate = function() { + return new GL(); + }, R; + }(Y0); + hi.registeredClasses.CandlestickSeries = YH, hi.registeredClasses.CandlestickSeriesDataItem = uR; + var y9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "OHLC", u.layout = "none", u; + } + return re(R, U), R.prototype.createAssets = function() { + this.openLine = this.createChild(q0), this.openLine.shouldClone = !1, this.highLowLine = this.createChild(q0), this.highLowLine.shouldClone = !1, this.closeLine = this.createChild(q0), this.closeLine.shouldClone = !1; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.openLine && this.openLine.copyFrom(u.openLine), this.highLowLine && this.highLowLine.copyFrom(u.highLowLine), this.closeLine && this.closeLine.copyFrom(u.closeLine); + }, R; + }(GL); + hi.registeredClasses.OHLC = y9; + var UL = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "OHLCSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(uR), Xre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "OHLCSeries", u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("OHLC Series")); + }, R.prototype.createDataItem = function() { + return new UL(); + }, R.prototype.validateCandlestick = function(u) { + var w = u.column; + if (w) { + var $ = w.openLine, G = w.highLowLine, K = w.closeLine; + if (this.baseAxis == this.xAxis) { + var ne = w.pixelWidth / 2; + G.x = ne, u.getWorkingValue(this.yOpenField), u.getWorkingValue(this.yField); + var ue = this.yAxis.getY(u, this.yOpenField), we = this.yAxis.getY(u, this.yField), De = this.yAxis.getY(u, this.yLowField), $e = this.yAxis.getY(u, this.yHighField), Ke = w.pixelY; + $.y1 = ue - Ke, $.y2 = ue - Ke, $.x1 = 0, $.x2 = ne, K.y1 = we - Ke, K.y2 = we - Ke, K.x1 = ne, K.x2 = 2 * ne, G.y1 = $e - Ke, G.y2 = De - Ke; + } + if (this.baseAxis == this.yAxis) { + var Ze = w.pixelHeight / 2; + G.y = Ze, u.getWorkingValue(this.xOpenField), u.getWorkingValue(this.xField); + var pt = this.xAxis.getX(u, this.xOpenField), Vt = this.xAxis.getX(u, this.xField), Yt = this.xAxis.getX(u, this.xLowField), ci = this.xAxis.getX(u, this.xHighField), ai = w.pixelX; + $.x1 = pt - ai, $.x2 = pt - ai, $.y1 = Ze, $.y2 = 2 * Ze, K.x1 = Vt - ai, K.x2 = Vt - ai, K.y1 = 0, K.y2 = Ze, G.x1 = ci - ai, G.x2 = Yt - ai; + } + er(this.axisRanges.iterator(), function(Gi) { + var Ji = u.rangesColumns.getKey(Gi.uid); + if (Ji) { + var Ci = Ji.openLine; + Ci.x = $.x, Ci.y = $.y, Ci.x1 = $.x1, Ci.x2 = $.x2, Ci.y1 = $.y1, Ci.y2 = $.y2; + var Hi = Ji.closeLine; + Hi.x = K.x, Hi.y = K.y, Hi.x1 = K.x1, Hi.x2 = K.x2, Hi.y1 = K.y1, Hi.y2 = K.y2; + var sr = Ji.highLowLine; + sr.x = G.x, sr.y = G.y, sr.x1 = G.x1, sr.x2 = G.x2, sr.y1 = G.y1, sr.y2 = G.y2; + } + }); + } + }, R.prototype.createLegendMarker = function(u) { + var w = u.pixelWidth, $ = u.pixelHeight; + u.removeChildren(); + var G, K, ne = u.createChild(y9); + ne.shouldClone = !1, ne.copyFrom(this.columns.template); + var ue = ne.openLine, we = ne.closeLine, De = ne.highLowLine; + this.baseAxis == this.yAxis ? (G = w / 3, K = $, De.y = $ / 2, De.x2 = w, ue.x = w / 3 * 2, ue.y2 = $ / 2, we.x = w / 3, we.y2 = $, we.y1 = $ / 2) : (G = w, K = $ / 3, De.x = w / 2, De.y2 = $, ue.y = $ / 3 * 2, ue.x2 = w / 2, we.y = $ / 3, we.x2 = w, we.x1 = w / 2), ne.width = G, ne.height = K, _r(this, u, lc), _r(this.columns.template, ne, lc), ne.stroke = this.riseFromOpenState.properties.stroke; + var $e = u.dataItem; + $e.color = ne.stroke, $e.colorOrig = ne.stroke; + }, R.prototype.createColumnTemplate = function() { + return new y9(); + }, R; + }(YH); + hi.registeredClasses.OHLCSeries = Xre, hi.registeredClasses.OHLCSeriesDataItem = UL; + var Kre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "StepLineSeriesSegment", u; + } + return re(R, U), R.prototype.drawSegment = function(u, w, $, G, K, ne) { + if (u.length > 0 && w.length > 0) + if (K) { + var ue = pn(u[0]); + if (u.length > 0) + for (var we = 1; we < u.length; we++) { + var De = u[we]; + we / 2 == Math.round(we / 2) ? ue += pn(De) : ue += xr(De); + } + this.strokeSprite.path = ue, (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) && (ue = pn(u[0]) + Z3(u), ue += xr(w[0]) + Z3(w), ue += xr(u[0]), ue += " Z", this.fillSprite.path = ue); + } else + ue = pn(u[0]) + Z3(u), this.strokeSprite.path = ue, (this.fillOpacity > 0 || this.fillSprite.fillOpacity > 0) && (ue += xr(w[0]) + Z3(w), ue += xr(u[0]), ue += " Z", this.fillSprite.path = ue); + else + this.strokeSprite.path = "", this.fillSprite.path = ""; + }, R; + }(n9); + hi.registeredClasses.StepLineSeriesSegment = Kre; + var v9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "StepLineSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(FL), XH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "StepLineSeries", u.applyTheme(), u.startLocation = 0, u.endLocation = 1, u; + } + return re(R, U), R.prototype.createDataItem = function() { + return new v9(); + }, R.prototype.addPoints = function(u, w, $, G, K) { + var ne, ue, we, De; + this.baseAxis == this.xAxis && (ne = this.startLocation, ue = this.endLocation, we = this.getAdjustedXLocation(w, this.yOpenField), De = this.getAdjustedXLocation(w, this.yField)), this.baseAxis == this.yAxis && (we = this.startLocation, De = this.endLocation, ne = this.getAdjustedXLocation(w, this.xOpenField), ue = this.getAdjustedXLocation(w, this.xField)); + var $e = this.xAxis.getX(w, $, ne), Ke = this.yAxis.getY(w, G, we), Ze = this.xAxis.getX(w, $, ue), pt = this.yAxis.getY(w, G, De); + if ($e = mt($e, -1e5, 1e5), Ke = mt(Ke, -1e5, 1e5), Ze = mt(Ze, -1e5, 1e5), pt = mt(pt, -1e5, 1e5), !this.noRisers && u.length > 1) { + var Vt = u[u.length - 1]; + this.baseAxis == this.xAxis && (K ? u.push({ x: Vt.x, y: pt }) : u.push({ x: $e, y: Vt.y })), this.baseAxis == this.yAxis && (K ? u.push({ x: Ze, y: Vt.y }) : u.push({ x: Vt.x, y: Ke })); + } + var Yt = { x: $e, y: Ke }, ci = { x: Ze, y: pt }; + K ? u.push(ci, Yt) : u.push(Yt, ci); + }, R.prototype.drawSegment = function(u, w, $) { + var G = !1; + this.yAxis == this.baseAxis && (G = !0), u.drawSegment(w, $, this.tensionX, this.tensionY, this.noRisers, G); + }, R.prototype.createSegment = function() { + return new Kre(); + }, Object.defineProperty(R.prototype, "noRisers", { get: function() { + return this.getPropertyValue("noRisers"); + }, set: function(u) { + this.setPropertyValue("noRisers", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "startLocation", { get: function() { + return this.getPropertyValue("startLocation"); + }, set: function(u) { + this.setPropertyValue("startLocation", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endLocation", { get: function() { + return this.getPropertyValue("endLocation"); + }, set: function(u) { + this.setPropertyValue("endLocation", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(s9); + hi.registeredClasses.StepLineSeries = XH, hi.registeredClasses.StepLineSeriesDataItem = v9; + var KH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarColumn", u; + } + return re(R, U), R.prototype.createAssets = function() { + this.radarColumn = this.createChild(kC), this.radarColumn.shouldClone = !1, this.radarColumn.strokeOpacity = void 0, this.column = this.radarColumn; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.radarColumn && this.radarColumn.copyFrom(u.radarColumn); + }, R.prototype.getTooltipX = function() { + var u = this.getPropertyValue("tooltipX"); + return le(u) ? u : this.radarColumn.getTooltipX(); + }, R.prototype.getTooltipY = function() { + var u = this.getPropertyValue("tooltipX"); + return le(u) ? u : this.radarColumn.getTooltipY(); + }, R; + }(jC); + hi.registeredClasses.RadarColumn = KH; + var Jre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ColumnSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(k1), Zre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarColumnSeries", u.applyTheme(), u; + } + return re(R, U), R.prototype.createColumnTemplate = function() { + return new KH(); + }, R.prototype.validate = function() { + this.chart.invalid && this.chart.validate(), U.prototype.validate.call(this); + }, R.prototype.disableUnusedColumns = function(u) { + u && (u.column && (u.column.__disabled = !0), er(this.axisRanges.iterator(), function(w) { + var $ = u.rangesColumns.getKey(w.uid); + $ && ($.__disabled = !0); + })); + }, R.prototype.validateDataElementReal = function(u) { + var w, $, G, K, ne = this, ue = this.chart.startAngle, we = this.chart.endAngle, De = this.yField, $e = this.yOpenField, Ke = this.xField, Ze = this.xOpenField, pt = this.getStartLocation(u), Vt = this.getEndLocation(u), Yt = (we - ue) / (this.dataItems.length * (this.end - this.start)), ci = u.column; + ci || (ci = this.columns.create(), u.column = ci, _r(this, ci, lc), _r(this.columns.template, ci, lc), u.addSprite(ci), ci.paper = this.paper, this.setColumnStates(ci)); + var ai = ci.width, Gi = 100; + ai instanceof J && (Gi = ai.percent); + var Ji = He((Vt - pt) * (1 - Gi / 100) / 2, 5); + if (pt += Ji, Vt -= Ji, this.xAxis instanceof Eh && this.yAxis instanceof Eh) + G = C({ x: this.yAxis.getX(u, De, 0, "valueY"), y: this.yAxis.getY(u, De, 0, "valueY") }), K = C({ x: this.yAxis.getX(u, $e, 1, "valueY"), y: this.yAxis.getY(u, $e, 1, "valueY") }), w = this.xAxis.getAngle(u, Ze, 0, "valueX"), $ = this.xAxis.getAngle(u, Ke, 1, "valueX"), ue += pt * Yt, we -= (1 - Vt) * Yt; + else if (this.baseAxis == this.xAxis) + G = C({ x: this.yAxis.getX(u, De, u.locations[De], "valueY"), y: this.yAxis.getY(u, De, u.locations[De], "valueY") }), K = C({ x: this.yAxis.getX(u, $e, u.locations[$e], "valueY"), y: this.yAxis.getY(u, $e, u.locations[$e], "valueY") }), w = this.xAxis.getAngle(u, Ze, pt, "valueX"), $ = this.xAxis.getAngle(u, Ke, Vt, "valueX"), ue += pt * Yt, we -= (1 - Vt) * Yt; + else { + if (G = C({ x: this.yAxis.getX(u, De, pt, "valueY"), y: this.yAxis.getY(u, De, pt, "valueY") }), K = C({ x: this.yAxis.getX(u, $e, Vt, "valueY"), y: this.yAxis.getY(u, $e, Vt, "valueY") }), le(ai)) { + var Ci = Math.abs(G - K); + if (Ci > ai) { + var Hi = (Ci - ai) / 2; + G += Hi, K -= Hi; + } + } + w = this.xAxis.getAngle(u, Ke, u.locations[Ke], "valueX"), $ = this.xAxis.getAngle(u, Ze, u.locations[Ze], "valueX"); + } + if ($ < w) { + var sr = $; + $ = w, w = sr; + } + w = mt(w, ue, we), $ = mt($, ue, we); + var Or = ci.radarColumn; + Or.startAngle = w; + var yr = $ - w; + yr > 0 ? (Or.arc = yr, Or.radius = G, Or.innerRadius = K, ci.__disabled = !1, ci.parent = this.columnsContainer, er(this.axisRanges.iterator(), function(As) { + var Fn = u.rangesColumns.getKey(As.uid); + Fn || (Fn = ne.columns.create(), os(ne.columns.template, Fn, lc), _r(As.contents, Fn, lc), Fn.dataItem && ki(Fn.dataItem.sprites, Fn), u.addSprite(Fn), Fn.paper = ne.paper, ne.setColumnStates(Fn), u.rangesColumns.setKey(As.uid, Fn)); + var Aa = Fn.radarColumn; + Aa.startAngle = w, Aa.arc = yr, Aa.radius = G, Aa.innerRadius = K, Aa.invalid && (Aa.paper = ne.paper, Aa.validate()), Fn.__disabled = !1, Fn.parent = As.contents; + })) : this.disableUnusedColumns(u); + }, R.prototype.getPoint = function(u, w, $, G, K, ne, ue) { + ne || (ne = "valueX"), ue || (ue = "valueY"); + var we = C({ x: this.yAxis.getX(u, $, K, ue), y: this.yAxis.getY(u, $, K, ue) }); + we == 0 && (we = 1e-5); + var De = this.xAxis.getAngle(u, w, G, ne); + return { x: we * A(De), y: we * Ue(De) }; + }, R.prototype.getMaskPath = function() { + var u = this.yAxis.renderer; + return r2(u.startAngle, u.endAngle - u.startAngle, u.pixelRadius, u.pixelInnerRadius); + }, R.prototype.positionBulletReal = function(u, w, $) { + var G = this.xAxis, K = this.yAxis; + (w < G.start || w > G.end || $ < K.start || $ > K.end) && (u.visible = !1), u.moveTo(this.xAxis.renderer.positionToPoint(w, $)); + }, R.prototype.setXAxis = function(u) { + U.prototype.setXAxis.call(this, u), this.updateRendererRefs(); + }, R.prototype.setYAxis = function(u) { + U.prototype.setYAxis.call(this, u), this.updateRendererRefs(); + }, R.prototype.updateRendererRefs = function() { + var u = this.xAxis.renderer, w = this.yAxis.renderer; + u.axisRendererY = w; + }, R; + }(Y0); + hi.registeredClasses.RadarColumnSeries = Zre, hi.registeredClasses.RadarColumnSeriesDataItem = Jre; + var GC = function(U) { + function R() { + var u = U.call(this) || this; + return u.slice = u.createChild(so), u.slice.shouldClone = !1, u.slice.setElement(u.paper.add("path")), u.slice.isMeasured = !1, u.orientation = "vertical", u.bottomWidth = ce(100), u.topWidth = ce(100), u.isMeasured = !1, u.width = 10, u.height = 10, u.expandDistance = 0, u.className = "FunnelSlice", u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.pixelPaddingTop, w = this.pixelPaddingBottom, $ = this.pixelPaddingRight, G = this.pixelPaddingLeft, K = this.pixelWidth - $ - G, ne = this.pixelHeight - u - w, ue = this.expandDistance, we = ""; + if (this.orientation == "vertical") { + var De = { x: (K - (ai = vs(this.topWidth, K))) / 2 + G, y: u }, $e = { x: (K + ai) / 2 + G, y: u }, Ke = { x: (K + (Gi = vs(this.bottomWidth, K))) / 2 + G, y: u + ne }, Ze = { x: (K - Gi) / 2 + G, y: u + ne }, pt = { x: $e.x + (Ke.x - $e.x) / 2 + ue * ne, y: $e.y + 0.5 * ne }, Vt = { x: De.x + (Ze.x - De.x) / 2 - ue * ne, y: De.y + 0.5 * ne }, Yt = xr(Ke), ci = xr(De); + ue != 0 && (Yt = i2(Ke, pt), ci = i2(De, Vt)), we = pn(De) + xr($e) + Yt + xr(Ze) + ci, this.tickPoint = { x: $e.x + (Ke.x - $e.x) / 2, y: $e.y + (Ke.y - $e.y) / 2 }; + } else { + var ai, Gi, Ji = { x: G, y: (ne - (ai = vs(this.topWidth, ne))) / 2 + u }, Ci = { x: G, y: (ne + ai) / 2 + u }, Hi = { x: G + K, y: (ne - (Gi = vs(this.bottomWidth, ne))) / 2 + u }, sr = { x: G + K, y: (ne + Gi) / 2 + u }; + pt = { y: Ji.y + (Hi.y - Ji.y) / 2 - ue * K, x: Ji.x + 0.5 * K }, Vt = { y: Ci.y + (sr.y - Ci.y) / 2 + ue * K, x: Ci.x + 0.5 * K }, Yt = xr(Hi), ci = xr(Ci), ue != 0 && (Yt = i2(Hi, pt), ci = i2(Ci, Vt)), we = pn(Ci) + xr(Ji) + Yt + xr(sr) + ci, this.tickPoint = { y: Ci.y + (sr.y - Ci.y) / 2, x: Ci.x + (sr.x - Ci.x) / 2 }; + } + this.slice.path = we, this.invalidateLayout(); + }, R.prototype.getPoint = function(u, w) { + var $ = this.pixelPaddingTop, G = this.pixelPaddingBottom, K = this.pixelPaddingRight, ne = this.pixelPaddingLeft, ue = this.pixelWidth - K - ne, we = this.pixelHeight - $ - G; + if (this.orientation == "vertical") { + var De = { x: (ue - (pt = vs(this.topWidth, ue))) / 2 + ne, y: $ }, $e = { x: (ue + pt) / 2 + ne, y: $ }, Ke = { x: (ue + (Vt = vs(this.bottomWidth, ue))) / 2 + ne, y: $ + we }, Ze = De.x + ((ue - Vt) / 2 + ne - De.x) * w; + return { x: Ze + ($e.x + (Ke.x - $e.x) * w - Ze) * u, y: $e.y + (Ke.y - $e.y) * w }; + } + var pt, Vt, Yt = ne, ci = (we - (pt = vs(this.topWidth, we))) / 2 + $, ai = (we + pt) / 2 + $, Gi = ne + ue, Ji = ci + ((we - (Vt = vs(this.bottomWidth, we))) / 2 + $ - ci) * u; + return { y: Ji + (ai + ((we + Vt) / 2 + $ - ai) * u - Ji) * w, x: Yt + (Gi - Yt) * u }; + }, Object.defineProperty(R.prototype, "bottomWidth", { get: function() { + return this.getPropertyValue("bottomWidth"); + }, set: function(u) { + this.setPercentProperty("bottomWidth", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "topWidth", { get: function() { + return this.getPropertyValue("topWidth"); + }, set: function(u) { + this.setPercentProperty("topWidth", u, !0, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "expandDistance", { get: function() { + return this.getPropertyValue("expandDistance"); + }, set: function(u) { + this.setPropertyValue("expandDistance", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.slice && this.slice.copyFrom(u.slice); + }, R; + }(Qn); + hi.registeredClasses.FunnelSlice = GC; + var jl = function(U) { + function R() { + var u = U.call(this) || this; + return u._label = new Un(), u._slice = new Un(), u.className = "FunnelTick", u.element = u.paper.add("path"), u._disposers.push(u._label), u._disposers.push(u._slice), u.setPropertyValue("locationX", 0), u.setPropertyValue("locationY", 0), u.applyTheme(), u; + } + return re(R, U), R.prototype.draw = function() { + U.prototype.draw.call(this); + var u = this.slice, w = u.getPoint(this.locationX, this.locationY); + if (w) { + var $ = this.label, G = u.dataItem.component, K = void 0, ne = void 0, ue = void 0; + if (G.orientation == "vertical") { + var we = $.pixelX, De = $.pixelY; + G.labelsOpposite || (we += $.maxRight), K = up(w, u, this.parent), ue = up({ x: we, y: De }, $.parent, this.parent), ne = { x: $.parent.pixelX - this.length, y: ue.y }, G.labelsOpposite || (ne.x = $.parent.measuredWidth + this.length); + } else + we = $.pixelX, De = $.pixelY, G.labelsOpposite || (De += $.maxBottom), K = up(w, u, this.parent), ne = { x: (ue = up({ x: we, y: De }, $.parent, this.parent)).x, y: $.parent.pixelY - this.length }, G.labelsOpposite || (ne.y = $.parent.measuredHeight + this.length); + this.path = pn(K) + xr(ne) + xr(ue); + } + }, Object.defineProperty(R.prototype, "slice", { get: function() { + return this._slice.get(); + }, set: function(u) { + this._slice.set(u, new kn([u.events.on("transformed", this.invalidate, this, !1), u.events.on("validated", this.invalidate, this, !1)])); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "label", { get: function() { + return this._label.get(); + }, set: function(u) { + this._label.set(u, u.events.on("transformed", this.invalidate, this, !1)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "locationX", { get: function() { + return this.getPropertyValue("locationX"); + }, set: function(u) { + this.setPropertyValue("locationX", u, !1, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "locationY", { get: function() { + return this.getPropertyValue("locationY"); + }, set: function(u) { + this.setPropertyValue("locationY", u, !1, !0); + }, enumerable: !0, configurable: !0 }), R; + }(rR); + hi.registeredClasses.FunnelTick = jl; + var Qb = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "FunnelSeriesDataItem", u.events.on("visibilitychanged", function() { + u.component && u.component.invalidateDataItems(); + }, u, !1), u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "sliceLink", { get: function() { + var u = this; + if (!this._sliceLink) { + var w = this.component.sliceLinks.create(); + this._sliceLink = w, this._disposers.push(w), w.parent = this.component.slicesContainer, this._disposers.push(new ln(function() { + u.component && u.component.sliceLinks.removeValue(w); + })), this.addSprite(w), w.visible = this.visible; + } + return this._sliceLink; + }, enumerable: !0, configurable: !0 }), R; + }(Zb), _9 = function(U) { + function R() { + var u = U.call(this) || this; + return u._nextY = 0, u.className = "FunnelSeries", u.orientation = "vertical", u.width = ce(100), u.height = ce(100), u.slicesContainer.width = ce(100), u.slicesContainer.height = ce(100), u._disposers.push(u.slicesContainer.events.on("maxsizechanged", u.invalidateDataItems, u, !1)), u.labelsOpposite = !0, u.labelsContainer.layout = "absolute", u.bottomRatio = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.createSlice = function() { + return new GC(); + }, R.prototype.createTick = function() { + return new jl(); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Funnel Series")); + }, R.prototype.createDataItem = function() { + return new Qb(); + }, R.prototype.initSlice = function(u) { + u.isMeasured = !1, u.defaultState.properties.scale = 1, u.observe("scale", this.handleSliceScale, this), u.observe(["dx", "dy", "x", "y"], this.handleSliceMove, this), u.tooltipText = "{category}: {value.percent.formatNumber('#.#p')} ({value.value})", u.states.create("hover").properties.expandDistance = 0.2; + }, R.prototype.initLabel = function(u) { + U.prototype.initLabel.call(this, u), u.verticalCenter = "middle", u.horizontalCenter = "middle", u.isMeasured = !0, u.padding(5, 5, 5, 5); + }, R.prototype.validate = function() { + U.prototype.validate.call(this), this._nextY = 0; + }, R.prototype.validateDataElements = function() { + var u = this, w = this.slicesContainer, $ = this.labelsContainer, G = this.labels.template; + this.alignLabels ? (G.interactionsEnabled = !0, w.isMeasured = !0, $.isMeasured = !0) : (G.interactionsEnabled = !1, w.isMeasured = !1, $.isMeasured = !1); + var K = 0, ne = 0; + this.dataItems.each(function(ue) { + Ee(ue.value) && (ne++, ue.value > 0 ? K += Math.abs(ue.getWorkingValue("value") / ue.value) : u.ignoreZeroValues || !ue.visible || ue.__disabled || ue.isHiding ? ne-- : K += 1); + }), this._total = 1 / ne * K, this._count = ne, U.prototype.validateDataElements.call(this), this.arrangeLabels(); + }, R.prototype.getNextValue = function(u) { + var w = u.index, $ = u.getWorkingValue("value"); + if (w < this.dataItems.length - 1) { + var G = this.dataItems.getIndex(w + 1); + if ($ = G.getWorkingValue("value"), !G.visible || G.isHiding || G.__disabled || G.value == 0 && this.ignoreZeroValues) + return this.getNextValue(G); + } + return $; + }, R.prototype.formDataElement = function() { + }, R.prototype.validateDataElement = function(u) { + var w = this, $ = u.slice; + $.orientation = this.orientation; + var G = u.sliceLink; + G.orientation = this.orientation; + var K = u.tick, ne = u.label; + K.slice = $, K.label = ne, Ee(u.value) ? (this.decorateSlice(u), _i(u.sprites, function(ue) { + u.value == 0 && w.ignoreZeroValues ? ue.__disabled = !0 : ue.__disabled = !1; + })) : _i(u.sprites, function(ue) { + ue.__disabled = !0; + }), u.index == this.dataItems.length - 1 && (G.disabled = !0), U.prototype.validateDataElement.call(this, u), G.fill = $.fill; + }, R.prototype.decorateSlice = function(u) { + var w = u.slice, $ = u.sliceLink, G = u.label, K = u.tick, ne = this.slicesContainer.innerWidth, ue = this.slicesContainer.innerHeight, we = this.getNextValue(u), De = Math.abs(u.getWorkingValue("value")), $e = this.bottomRatio, Ke = 1; + if (u.value != 0 ? Ke = De / Math.abs(u.value) : (u.__disabled || u.isHiding || !u.visible) && (Ke = 1e-6), this.ignoreZeroValues && u.value == 0) + u.__disabled = !0; + else if (u.__disabled = !1, this._nextY == 1 / 0 && (this._nextY = 0), this.orientation == "vertical") { + var Ze = $.pixelHeight * Ke; + ue += Ze, w.topWidth = De / this.dataItem.values.value.high * ne, w.bottomWidth = (De - (De - we) * $e) / this.dataItem.values.value.high * ne, $.topWidth = w.bottomWidth, $.bottomWidth = (De - (De - we)) / this.dataItem.values.value.high * ne, w.y = this._nextY, w.height = Math.min(1e5, ve(0, ue / this._count * Ke / this._total - Ze)), w.x = ne / 2, this.alignLabels ? G.x = void 0 : G.x = w.x, G.y = w.pixelY + w.pixelHeight * K.locationY, this._nextY += w.pixelHeight + Ze, $.y = this._nextY - Ze, $.x = w.x; + } else { + var pt = $.pixelWidth * Ke; + ne += pt, w.topWidth = De / this.dataItem.values.value.high * ue, w.bottomWidth = (De - (De - we) * $e) / this.dataItem.values.value.high * ue, $.topWidth = w.bottomWidth, $.bottomWidth = (De - (De - we)) / this.dataItem.values.value.high * ue, w.x = this._nextY, w.width = Math.min(1e5, ne / this._count * Ke * 1 / this._total - pt), w.y = ue / 2, this.alignLabels ? G.y = this.labelsContainer.measuredHeight : G.y = w.y, G.x = w.pixelX + w.pixelWidth * K.locationX, this._nextY += w.pixelWidth + pt, $.x = this._nextY - pt, $.y = w.y; + } + }, R.prototype.getLastLabel = function(u) { + if (u > 0) { + var w = this.labels.getIndex(u); + return w.__disabled || !w.visible ? this.getLastLabel(u - 1) : w; + } + }, R.prototype.arrangeLabels = function() { + if (this.alignLabels) { + var u = this.labels.length; + if (u > 1) { + var w = this.getLastLabel(u - 1); + if (w) { + var $ = w.pixelY, G = w.pixelX; + if (u > 1) { + for (var K = u - 2; K >= 0; K--) + (ne = this.labels.getIndex(K)).visible && !ne.__disabled && (ne.invalid && ne.validate(), this.orientation == "vertical" ? ne.pixelY + ne.measuredHeight > $ && (ne.y = Math.min(1e6, $ - ne.measuredHeight)) : ne.pixelX + ne.measuredWidth > G && (ne.x = Math.min(1e6, G - ne.measuredWidth)), $ = ne.pixelY, G = ne.pixelX); + for ($ = 0, G = 0, K = 0; K < u; K++) { + var ne; + (ne = this.labels.getIndex(K)).visible && !ne.__disabled && (ne.invalid && ne.validate(), this.orientation == "vertical" ? ne.pixelY < $ && (ne.y = Math.min(1e6, $)) : ne.pixelX < G && (ne.x = Math.min(1e6, G)), $ += ne.measuredHeight, G += ne.measuredWidth); + } + } + } + } + } + }, R.prototype.positionBullet = function(u) { + U.prototype.positionBullet.call(this, u); + var w = u.dataItem.slice, $ = u.locationX; + le($) || ($ = 0.5); + var G = u.locationY; + le(G) || (G = 1), u.x = w.pixelX + w.measuredWidth * $, u.y = w.pixelY + w.measuredHeight * G; + }, Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u) && (this.labelsOpposite = this.labelsOpposite, this.invalidate(), u == "vertical" ? (this.ticks.template.locationX = 1, this.ticks.template.locationY = 0.5, this.labels.template.rotation = 0, this.layout = "horizontal") : (this.ticks.template.locationX = 0.5, this.ticks.template.locationY = 1, this.labels.template.rotation = -90, this.layout = "vertical")); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bottomRatio", { get: function() { + return this.getPropertyValue("bottomRatio"); + }, set: function(u) { + this.setPropertyValue("bottomRatio", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "sliceLinks", { get: function() { + if (!this._sliceLinks) { + var u = new GC(); + u.applyOnClones = !0, u.fillOpacity = 0.5, u.expandDistance = -0.3, u.hiddenState.properties.opacity = 0, this._disposers.push(u), this._sliceLinks = new Xs(u), this._disposers.push(new Wo(this._sliceLinks)); + } + return this._sliceLinks; + }, enumerable: !0, configurable: !0 }), R.prototype.show = function(u) { + var w = this, $ = this.startIndex, G = this.endIndex, K = this.defaultState.transitionDuration; + le(u) && (K = u); + var ne = 0; + return er(mu(this.dataItems.iterator()), function(ue) { + var we = ue[0], De = ue[1]; + w.sequencedInterpolation && (ne = w.sequencedInterpolationDelay * we + K * (we - $) / (G - $)), De.show(K, ne, ["value"]); + }), U.prototype.show.call(this, u); + }, R.prototype.hide = function(u) { + var w = this, $ = ["value"], G = this.startIndex, K = this.endIndex, ne = 0, ue = this.hiddenState.transitionDuration; + le(u) && (ue = u), er(mu(this.dataItems.iterator()), function(De) { + var $e = De[0], Ke = De[1]; + w.sequencedInterpolation && (ne = w.sequencedInterpolationDelay * $e + ue * ($e - G) / (K - G)), Ke.hide(ue, ne, 0, $); + }); + var we = U.prototype.hide.call(this, u); + return we && !we.isFinished() && we.delay(ne), we; + }, R.prototype.setAlignLabels = function(u) { + U.prototype.setAlignLabels.call(this, u), this.ticks.template.disabled = !u; + var w = this.labelsContainer; + w && (u ? (w.height = void 0, w.width = void 0, w.margin(10, 10, 10, 10)) : (w.width = ce(100), w.height = ce(100))), this.labelsOpposite = this.labelsOpposite; + }, Object.defineProperty(R.prototype, "labelsOpposite", { get: function() { + return this.getPropertyValue("labelsOpposite"); + }, set: function(u) { + this.setPropertyValue("labelsOpposite", u); + var w = this.labels.template, $ = "none", G = "none"; + this.alignLabels ? u ? (this.labelsContainer.toFront(), this.orientation == "vertical" ? (this.ticks.template.locationX = 1, w.horizontalCenter = "left", $ = "right") : (this.ticks.template.locationY = 1, w.horizontalCenter = "right", G = "bottom")) : (this.labelsContainer.toBack(), this.orientation == "vertical" ? (this.ticks.template.locationX = 0, $ = "left") : (G = "top", this.ticks.template.locationY = 0)) : this.orientation == "vertical" ? $ = "center" : G = "middle", w.align = $, w.valign = G, this.validateLayout(), this.ticks.each(function(K) { + K.invalidate(); + }), this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), R; + }(kL); + hi.registeredClasses.FunnelSeries = _9, hi.registeredClasses.FunnelSeriesDataItem = Qb; + var b9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PyramidSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(Qb), JH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PyramidSeries", u.topWidth = ce(0), u.bottomWidth = ce(100), u.pyramidHeight = ce(100), u.valueIs = "area", u.sliceLinks.template.width = 0, u.sliceLinks.template.height = 0, u.applyTheme(), u; + } + return re(R, U), R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Pyramid Series")); + }, R.prototype.createDataItem = function() { + return new b9(); + }, R.prototype.validate = function() { + U.prototype.validate.call(this), this._nextWidth = void 0; + }, R.prototype.getNextValue = function(u) { + var w = u.index, $ = u.getWorkingValue("value"); + return w < this.dataItems.length - 1 && ($ = this.dataItems.getIndex(w + 1).getWorkingValue("value")), $ == 0 && ($ = 1e-6), $; + }, R.prototype.validateDataElements = function() { + var u = this, w = this.slicesContainer.innerWidth, $ = this.slicesContainer.innerHeight; + if (this.dataItems.each(function(ne) { + if (ne.value > 0) { + var ue = ne.getWorkingValue("value") / ne.value, we = ne.sliceLink; + u.orientation == "vertical" ? $ -= we.pixelHeight * ue : w -= we.pixelWidth * ue; + } + }), this._pyramidHeight = vs(this.pyramidHeight, $), this._pyramidWidth = vs(this.pyramidHeight, w), this.orientation == "vertical") { + var G = ($ - this._pyramidHeight) / 2; + this.slicesContainer.y = G, this.labelsContainer.y = G, this.ticksContainer.y = G; + } else { + var K = (w - this._pyramidWidth) / 2; + this.slicesContainer.x = K, this.labelsContainer.x = K, this.ticksContainer.x = K; + } + U.prototype.validateDataElements.call(this); + }, R.prototype.decorateSlice = function(u) { + var w = this.dataItem.values.value.absoluteSum; + if (w != 0) { + var $ = u.slice, G = u.sliceLink, K = u.label, ne = u.tick; + this.getNextValue(u); + var ue = Math.abs(u.getWorkingValue("value")), we = this._pyramidWidth, De = this._pyramidHeight, $e = this.slicesContainer.innerWidth, Ke = this.slicesContainer.innerHeight, Ze = G.pixelWidth, pt = G.pixelHeight; + if (u.value != 0 && u.value != null || !this.ignoreZeroValues ? u.__disabled = !1 : u.__disabled = !0, this.orientation == "vertical") { + var Vt = vs(this.topWidth, $e); + le(this._nextWidth) || (this._nextWidth = Vt); + var Yt = vs(this.bottomWidth, $e), ci = this._nextWidth, ai = Math.atan2(De, Vt - Yt); + (sr = Math.tan(Math.PI / 2 - ai)) == 0 && (sr = 1e-8); + var Gi = void 0, Ji = void 0; + if (this.valueIs == "area") { + var Ci = (Vt + Yt) / 2 * De * ue / w, Hi = Math.abs(ci * ci - 2 * Ci * sr); + Ji = (Gi = (ci - Math.sqrt(Hi)) / sr) > 0 ? (2 * Ci - Gi * ci) / Gi : ci; + } else + Ji = ci - (Gi = De * ue / w) * sr; + $.height = Gi, $.width = $e, $.bottomWidth = Ji, $.topWidth = ci, G.topWidth = $.bottomWidth, G.bottomWidth = $.bottomWidth, $.y = this._nextY, this.alignLabels ? K.x = 0 : K.x = $e / 2, K.y = $.pixelY + $.pixelHeight * ne.locationY + $.dy, this._nextY += $.pixelHeight + pt * ue / Math.max(Math.abs(u.value), 1e-8), G.y = this._nextY - pt, G.x = $e / 2; + } else { + var sr; + Vt = vs(this.topWidth, Ke), le(this._nextWidth) || (this._nextWidth = Vt), Yt = vs(this.bottomWidth, Ke), ci = this._nextWidth, ai = Math.atan2(we, Vt - Yt), (sr = Math.tan(Math.PI / 2 - ai)) == 0 && (sr = 1e-8); + var Or = void 0; + Ji = void 0, Ji = this.valueIs == "area" ? (2 * (Ci = (Vt + Yt) / 2 * we * ue / w) - (Or = (ci - Math.sqrt(ci * ci - 2 * Ci * sr)) / sr) * ci) / Or : ci - (Or = we * ue / w) * sr, $.width = Or, $.height = Ke, $.bottomWidth = Ji, $.topWidth = ci, G.topWidth = $.bottomWidth, G.bottomWidth = $.bottomWidth, $.x = this._nextY, this.alignLabels ? K.y = this.labelsContainer.measuredHeight : K.y = Ke / 2, K.x = $.pixelX + $.pixelWidth * ne.locationX + $.dx, this._nextY += $.pixelWidth + Ze * ue / Math.max(Math.abs(u.value), 1e-8), G.x = this._nextY - Ze, G.y = Ke / 2; + } + this._nextWidth = $.bottomWidth; + } + }, Object.defineProperty(R.prototype, "topWidth", { get: function() { + return this.getPropertyValue("topWidth"); + }, set: function(u) { + this.setPercentProperty("topWidth", u, !1, !1, 10, !1) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pyramidHeight", { get: function() { + return this.getPropertyValue("pyramidHeight"); + }, set: function(u) { + this.setPercentProperty("pyramidHeight", u, !1, !1, 10, !1) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "bottomWidth", { get: function() { + return this.getPropertyValue("bottomWidth"); + }, set: function(u) { + this.setPercentProperty("bottomWidth", u, !1, !1, 10, !1) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "valueIs", { get: function() { + return this.getPropertyValue("valueIs"); + }, set: function(u) { + this.setPropertyValue("valueIs", u) && this.invalidate(); + }, enumerable: !0, configurable: !0 }), R; + }(_9); + hi.registeredClasses.PyramidSeries = JH, hi.registeredClasses.PyramidSeriesDataItem = b9; + var cR = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PictorialStackedSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(b9), Qre = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "PictorialStackedSeries", u.topWidth = ce(100), u.bottomWidth = ce(100), u.valueIs = "height", u.applyTheme(), u.startLocation = 0, u.endLocation = 1, u.align = "center", u.valign = "middle", u._maskSprite = u.slicesContainer.createChild(so), u._maskSprite.visible = !1, u._maskSprite.zIndex = 100, u._maskSprite.shouldClone = !1, u; + } + return re(R, U), R.prototype.validateDataElements = function() { + var u = this.slicesContainer.maxWidth, w = this.slicesContainer.maxHeight, $ = this._maskSprite, G = $.measuredWidth / $.scale, K = $.measuredHeight / $.scale, ne = H(w / K, u / G); + ne == 1 / 0 && (ne = 1), ne = ve(1e-3, ne); + var ue, we, De = this.startLocation, $e = this.endLocation, Ke = H(u, G * ne), Ze = H(w, K * ne); + $.scale = ne, this.orientation == "vertical" ? (this.topWidth = Ke + 4, this.bottomWidth = Ke + 4, this.pyramidHeight = Ze * ($e - De), $.x = u / 2, $.y = Ze / 2) : (this.topWidth = Ze + 4, this.bottomWidth = Ze + 4, this.pyramidHeight = Ke * ($e - De), $.valign = "middle", $.x = Ke / 2, $.y = w / 2), $.verticalCenter = "middle", $.horizontalCenter = "middle", U.prototype.validateDataElements.call(this), this.orientation == "vertical" ? (this.valign == "bottom" && (ue = w - Ze), this.valign == "middle" && (ue = (w - Ze) / 2), this.valign == "top" && (ue = 0), this.align == "left" && (we = -(u - Ke) / 2), this.align == "center" && (we = 0), this.align == "right" && (we = (u - Ke) / 2), this.slices.template.dy = De * Ze, this.alignLabels && (this.slicesContainer.dx = we)) : (this.valign == "bottom" && (ue = (w - Ze) / 2), this.valign == "middle" && (ue = 0), this.valign == "top" && (ue = -(w - Ze) / 2), this.align == "left" && (we = 0), this.align == "center" && (we = (u - Ke) / 2), this.align == "right" && (we = u - Ke), this.slices.template.dx = De * Ke, this.alignLabels && (this.slicesContainer.dy = ue)), this.slicesContainer.x = we, this.labelsContainer.x = we, this.ticksContainer.x = we, this.slicesContainer.y = ue, this.labelsContainer.y = ue, this.ticksContainer.y = ue, Ke > 0 && Ze > 0 && (this.slicesContainer.mask = $); + }, R.prototype.applyInternalDefaults = function() { + U.prototype.applyInternalDefaults.call(this), Ee(this.readerTitle) || (this.readerTitle = this.language.translate("Pyramid Series")); + }, R.prototype.createDataItem = function() { + return new cR(); + }, Object.defineProperty(R.prototype, "maskSprite", { get: function() { + return this._maskSprite; + }, enumerable: !0, configurable: !0 }), R.prototype.initSlice = function(u) { + U.prototype.initSlice.call(this, u); + var w = u.states.getKey("hover"); + w && (w.properties.expandDistance = 0); + }, Object.defineProperty(R.prototype, "startLocation", { get: function() { + return this.getPropertyValue("startLocation"); + }, set: function(u) { + this.setPropertyValue("startLocation", u) && this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endLocation", { get: function() { + return this.getPropertyValue("endLocation"); + }, set: function(u) { + this.setPropertyValue("endLocation", u) && this.invalidateDataItems(); + }, enumerable: !0, configurable: !0 }), R; + }(JH); + hi.registeredClasses.PictorialStackedSeries = Qre, hi.registeredClasses.PictorialStackedSeriesDataItem = cR; + var w9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ConeColumn", u; + } + return re(R, U), R.prototype.createAssets = function() { + this.coneColumn = this.createChild(Y8), this.coneColumn.shouldClone = !1, this.column = this.coneColumn; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.coneColumn && this.coneColumn.copyFrom(u.coneColumn); + }, R; + }(jC); + hi.registeredClasses.ConeColumn = w9; + var x9 = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ConeSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(k1), ene = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ConeSeries", u.applyTheme(), u; + } + return re(R, U), R.prototype.createColumnTemplate = function() { + return new w9(); + }, R.prototype.getMaskPath = function() { + var u = 0, w = 0, $ = this.columns.getIndex(0); + if ($) + return this.baseAxis == this.xAxis ? w = $.coneColumn.innerWidth / 2 + 1 : u = $.coneColumn.innerHeight / 2 + 1, n2({ x: -u, y: 0, width: this.xAxis.axisLength + u, height: this.yAxis.axisLength + w }); + }, R.prototype.validateDataElementReal = function(u) { + if (U.prototype.validateDataElementReal.call(this, u), u.column) { + var w = u.column.coneColumn; + w.fill = u.column.fill, this.baseAxis == this.yAxis ? w.orientation = "horizontal" : w.orientation = "vertical"; + } + }, R; + }(Y0); + hi.registeredClasses.ConeSeries = ene, hi.registeredClasses.ConeSeriesDataItem = x9; + var UC = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "CurvedColumn", u; + } + return re(R, U), R.prototype.createAssets = function() { + this.curvedColumn = this.createChild(so), this.curvedColumn.shouldClone = !1, this.setPropertyValue("tension", 0.7), this.width = ce(120), this.height = ce(120), this.column = this.curvedColumn; + }, R.prototype.draw = function() { + U.prototype.draw.call(this); + var u, w = this.realWidth, $ = this.realHeight, G = this.realX - this.pixelX, K = this.realY - this.pixelY; + this.width; + var ne = 1, ue = 1; + this.orientation == "vertical" ? (ne = this.tension, u = [{ x: 0, y: $ + K }, { x: w / 2, y: K }, { x: w, y: $ + K }]) : (ue = this.tension, u = [{ x: G, y: $ = Math.abs($) }, { x: G + w, y: $ / 2 }, { x: G, y: 0 }]); + var we = pn(u[0]) + new Kv(ne, ue).smooth(u); + this.column.path = we; + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.curvedColumn && this.curvedColumn.copyFrom(u.curvedColumn); + }, Object.defineProperty(R.prototype, "tension", { get: function() { + return this.getPropertyValue("tension"); + }, set: function(u) { + this.setPropertyValue("tension", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "orientation", { get: function() { + return this.getPropertyValue("orientation"); + }, set: function(u) { + this.setPropertyValue("orientation", u, !0); + }, enumerable: !0, configurable: !0 }), R; + }(jC); + hi.registeredClasses.CurvedColumn = UC; + var ZH = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "CurvedColumnSeriesDataItem", u.applyTheme(), u; + } + return re(R, U), R; + }(k1), tne = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "CurvedColumnSeries", u.applyTheme(), u; + } + return re(R, U), R.prototype.createColumnTemplate = function() { + return new UC(); + }, R.prototype.validateDataElementReal = function(u) { + U.prototype.validateDataElementReal.call(this, u); + var w = u.column; + (w = u.column) && (u.column.curvedColumn.fill = u.column.fill, this.baseAxis == this.yAxis ? w.orientation = "horizontal" : w.orientation = "vertical"); + }, R; + }(Y0); + hi.registeredClasses.CurvedColumnSeries = tne, hi.registeredClasses.CurvedColumnSeriesDataItem = ZH; + var S9 = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "CircleBullet"; + var w = u.createChild(NC); + return w.shouldClone = !1, w.radius = 5, w.isMeasured = !1, u.circle = w, u.applyTheme(), u; + } + return re(R, U), R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.circle.copyFrom(u.circle); + }, R; + }(Mo); + hi.registeredClasses.CircleBullet = S9; + var ine = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "ErrorBullet", u.errorLine = u.createChild(so), u.errorLine.shouldClone = !1, u.width = 20, u.height = 20, u.strokeOpacity = 1, u.isDynamic = !0, u; + } + return re(R, U), R.prototype.validatePosition = function() { + U.prototype.validatePosition.call(this); + var u = this.pixelWidth / 2, w = this.pixelHeight / 2; + this.errorLine.path = pn({ x: -u, y: -w }) + xr({ x: u, y: -w }) + pn({ x: 0, y: -w }) + xr({ x: 0, y: w }) + pn({ x: -u, y: w }) + xr({ x: u, y: w }); + }, R.prototype.copyFrom = function(u) { + U.prototype.copyFrom.call(this, u), this.errorLine.copyFrom(u.errorLine); + }, R; + }(Mo); + hi.registeredClasses.ErrorBullet = ine; + var rne = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "NavigationBarDataItem", u.applyTheme(), u; + } + return re(R, U), Object.defineProperty(R.prototype, "name", { get: function() { + return this.properties.name; + }, set: function(u) { + this.setProperty("name", u); + }, enumerable: !0, configurable: !0 }), R; + }(FC), hA = function(U) { + function R() { + var u = U.call(this) || this; + u.className = "NavigationBar"; + var w = new Fa(), $ = new H8(); + $.valign = "middle", $.paddingTop = 8, $.paddingBottom = 8, u.paddingBottom = 2, u.links = new Xs($), u._disposers.push(new Wo(u.links)), u._disposers.push($), u._linksIterator = new Mp(u.links, function() { + return u.links.create(); + }), u._linksIterator.createNewItems = !0; + var G = new bL(); + G.direction = "right", G.width = 8, G.height = 12, G.fill = w.getFor("alternativeBackground"), G.fillOpacity = 0.5, G.valign = "middle", G.marginLeft = 10, G.marginRight = 10, u.separators = new Xs(G), u._disposers.push(new Wo(u.separators)), u._disposers.push(G); + var K = new H8(); + return u.activeLink = K, K.copyFrom($), K.valign = "middle", K.fontWeight = "bold", u.width = ce(100), u.layout = "grid", u.dataFields.name = "name", u.applyTheme(), u; + } + return re(R, U), R.prototype.validateDataElements = function() { + this.removeChildren(), this._linksIterator.reset(), U.prototype.validateDataElements.call(this); + }, R.prototype.validateDataElement = function(u) { + var w; + if (U.prototype.validateDataElement.call(this, u), u.index < this.dataItems.length - 1) { + (w = this._linksIterator.getLast()).parent = this; + var $ = this.separators.create(); + $.parent = this, $.valign = "middle"; + } else + (w = this.activeLink).events.copyFrom(this.links.template.events), w.hide(0), w.show(), w.parent = this; + w.dataItem = u, w.text = u.name, w.validate(); + }, R; + }(LC); + hi.registeredClasses.NavigationBar = hA, hi.registeredClasses.NavigationBarDataItem = rne; + var QH = function(U) { + function R() { + var u = U.call(this) || this; + u.point = { x: 0, y: 0 }, u._stick = "none", u.className = "Cursor", u.width = ce(100), u.height = ce(100), u.shouldClone = !1, u.hide(0), u.trackable = !0, u.clickable = !0, u.isMeasured = !1; + var w = Gs(); + return u._disposers.push(w.body.events.on("down", u.handleCursorDown, u)), u._disposers.push(w.body.events.on("up", u.handleCursorUp, u)), u._disposers.push(w.body.events.on("track", u.handleCursorMove, u)), u.applyTheme(), u; + } + return re(R, U), R.prototype.handleCursorMove = function(u) { + if (!(!this.interactionsEnabled || this.interactions.isTouchProtected && u.touch)) { + if ((this._generalBehavior == "zoom" || this._generalBehavior == "pan") && this.downPoint || Gs().isLocalElement(u.pointer, this.paper.svg, this.uid)) { + var w = O1(u.pointer.point, this); + return this._stick == "hard" && this._stickPoint && (w = this._stickPoint), this._stick == "soft" && this._stickPoint && (this.fitsToBounds(w) || (w = this._stickPoint)), this._adapterO && this._adapterO.apply("cursorPoint", w), this.triggerMove(w), w; + } + this.isHidden && this.isHiding || this.hide(); + } + }, R.prototype.hideReal = function(u) { + if (this._stick != "hard" && this._stick != "soft" || !this._stickPoint) + return U.prototype.hideReal.call(this, u); + }, R.prototype.triggerMove = function(u, w, $) { + u.x = He(u.x, 1), u.y = He(u.y, 1), w && (this._stick = w), w != "hard" && w != "soft" || (this._stickPoint = u), this.triggerMoveReal(u, $); + }, R.prototype.triggerMoveReal = function(u, w) { + (this.point.x != u.x || this.point.y != u.y || w) && (this.point = u, this.invalidatePosition(), this.fitsToBounds(u) ? this.show(0) : this.downPoint || this.hide(0), this.visible && (this.getPositions(), this.dispatch("cursorpositionchanged"))); + }, R.prototype.triggerDown = function(u) { + this.triggerDownReal(u); + }, R.prototype.triggerDownReal = function(u) { + switch (this._generalBehavior) { + case "zoom": + this.dispatchImmediately("zoomstarted"); + break; + case "select": + this.dispatchImmediately("selectstarted"); + break; + case "pan": + this.dispatchImmediately("panstarted"), Gs().setGlobalStyle(vl.grabbing); + } + }, R.prototype.triggerUp = function(u) { + this.triggerUpReal(u); + }, R.prototype.triggerUpReal = function(u) { + qo.requestFrame(), this.updatePoint(this.upPoint); + var w = Gs(); + if (C(this._upPointOrig, this._downPointOrig) > w.getHitOption(this.interactions, "hitTolerance")) { + switch (this._generalBehavior) { + case "zoom": + this.dispatch("zoomended"); + break; + case "select": + this.dispatch("selectended"); + break; + case "pan": + this.dispatch("panended"), w.setGlobalStyle(vl.default); + } + this.downPoint = void 0, this.updateSelection(); + } + }, R.prototype.updateSelection = function() { + }, R.prototype.getPositions = function() { + this.xPosition = this.point.x / this.innerWidth, this.yPosition = 1 - this.point.y / this.innerHeight; + }, R.prototype.handleCursorDown = function(u) { + if (!(!this.interactionsEnabled || this.interactions.isTouchProtected && u.touch) && Gs().isLocalElement(u.pointer, this.paper.svg, this.uid)) { + Kx(); + var w = O1(u.pointer.point, this); + this._stick == "hard" && this._stickPoint && (w = this._stickPoint), this._adapterO && this._adapterO.apply("cursorPoint", w), this.fitsToBounds(w) && (this._downPointOrig = { x: w.x, y: w.y }, u.event.cancelable && this.shouldPreventGestures(u.touch) && this.fitsToBounds(w) && u.event.preventDefault(), this.triggerMove(w), this.triggerDown(w)); + } + }, R.prototype.shouldPreventGestures = function(u) { + return !0; + }, R.prototype.updatePoint = function(u) { + }, R.prototype.handleCursorUp = function(u) { + if (this.interactionsEnabled && (this.downPoint || Gs().isLocalElement(u.pointer, this.paper.svg, this.uid))) { + var w = O1(u.pointer.point, this); + this._adapterO && this._adapterO.apply("cursorPoint", w), this.downPoint && this.fitsToBounds(this.downPoint) && (this._stick == "hard" && this._stickPoint && (w = this._stickPoint), this._upPointOrig = { x: w.x, y: w.y }, this.triggerMove(w), this.triggerUp(w)); + } + }, Object.defineProperty(R.prototype, "chart", { get: function() { + return this._chart; + }, set: function(u) { + this._chart = u, Ee(this._chart.plotContainer) && Gs().lockElement(this._chart.plotContainer.interactions); + }, enumerable: !0, configurable: !0 }), R; + }(Qn); + hi.registeredClasses.Cursor = QH; + var hR = function(U) { + function R() { + var u = U.call(this) || this; + u._lineX = new Un(), u._lineY = new Un(), u._xAxis = new Un(), u._yAxis = new Un(), u._snapToDisposers = [], u.className = "XYCursor", u.behavior = "zoomX", u.maxPanOut = 0.1; + var w = new Fa(); + u.snapOnPan = !0; + var $ = u.createChild(so); + $.shouldClone = !1, $.fillOpacity = 0.2, $.fill = w.getFor("alternativeBackground"), $.isMeasured = !1, $.visible = !1, $.interactionsEnabled = !1, u.selection = $, u._disposers.push(u.selection); + var G = u.createChild(so); + G.shouldClone = !1, G.stroke = w.getFor("grid"), G.fill = We(), G.strokeDasharray = "3,3", G.isMeasured = !1, G.strokeOpacity = 0.4, G.interactionsEnabled = !1, G.y = 0, u.lineX = G, u._disposers.push(u.lineX); + var K = u.createChild(so); + return K.shouldClone = !1, K.stroke = w.getFor("grid"), K.fill = We(), K.strokeDasharray = "3,3", K.isMeasured = !1, K.strokeOpacity = 0.4, K.interactionsEnabled = !1, K.x = 0, u.lineY = K, u._disposers.push(u.lineY), u.events.on("sizechanged", u.updateSize, u, !1), u._disposers.push(u._lineX), u._disposers.push(u._lineY), u._disposers.push(u._xAxis), u._disposers.push(u._yAxis), u.mask = u, u.hideSeriesTooltipsOnSelection = !0, u.applyTheme(), u; + } + return re(R, U), R.prototype.updateSize = function() { + this.lineX && (this.lineX.path = pn({ x: 0, y: 0 }) + xr({ x: 0, y: this.innerHeight })), this.lineY && (this.lineY.path = pn({ x: 0, y: 0 }) + xr({ x: this.innerWidth, y: 0 })); + }, R.prototype.updateSelection = function() { + if (this._usesSelection) { + var u = this.downPoint, w = this.behavior; + if (u) { + var $ = this.point; + this.lineX && ($.x = this.lineX.pixelX), this.lineY && ($.y = this.lineY.pixelY); + var G = this.selection, K = Math.min($.x, u.x), ne = Math.min($.y, u.y), ue = He(Math.abs(u.x - $.x), this._positionPrecision), we = He(Math.abs(u.y - $.y), this._positionPrecision); + switch (w) { + case "zoomX": + case "selectX": + ne = 0, we = this.pixelHeight; + break; + case "zoomY": + case "selectY": + K = 0, ue = this.pixelWidth; + } + G.x = K, G.y = ne, G.path = z8(ue, we), G.validatePosition(); + } else + this._generalBehavior != "select" && this.selection.hide(); + } + }, R.prototype.fixPoint = function(u) { + return u.x = Math.max(0, u.x), u.y = Math.max(0, u.y), u.x = Math.min(this.pixelWidth, u.x), u.y = Math.min(this.pixelHeight, u.y), u; + }, R.prototype.triggerMoveReal = function(u, w) { + U.prototype.triggerMoveReal.call(this, u, w); + var $ = this.snapToSeries; + if ($ && !this.downPoint) + if ($ instanceof BC) + $.isHidden && this.updateLinePositions(u); + else { + var G = !0; + _i($, function(K) { + K.isHidden || (G = !1); + }), G && this.updateLinePositions(u); + } + else + this.updateLinePositions(u); + this.downPoint && C(this.downPoint, u) > 3 && this._generalBehavior == "pan" && (this.getPanningRanges(), this.dispatch("panning")); + }, R.prototype.updateLinePositions = function(u) { + u = this.fixPoint(this.point), this.lineX && this.lineX.visible && !this.xAxis && (this.lineX.x = u.x), this.lineY && this.lineY.visible && !this.yAxis && (this.lineY.y = u.y), this.updateSelection(); + }, R.prototype.triggerDownReal = function(u) { + if (this.visible && !this.isHiding) + if (this._generalBehavior == "select" && (this.selection.parent = this.parent), this.fitsToBounds(u)) { + this.downPoint = { x: u.x, y: u.y }, this.updatePoint(u), this.point.x = this.downPoint.x, this.point.y = this.downPoint.y; + var w = this.selection, $ = this.downPoint.x, G = this.downPoint.y; + this._usesSelection && (w.x = $, w.y = G, w.path = "", w.show()), U.prototype.triggerDownReal.call(this, u); + } else + this.downPoint = void 0; + else + this.downPoint = void 0; + }, R.prototype.updatePoint = function(u) { + this.lineX && (u.x = this.lineX.pixelX), this.lineY && (u.y = this.lineY.pixelY); + }, R.prototype.triggerUpReal = function(u) { + this.hasMoved() ? this.downPoint && (this.upPoint = u, this.updatePoint(this.upPoint), this._generalBehavior != "pan" && this.getRanges(), this._generalBehavior != "select" && this.selection.hide(), U.prototype.triggerUpReal.call(this, u)) : (this._generalBehavior != "select" ? this.selection.hide(0) : (this.xRange = void 0, this.yRange = void 0, this.dispatchImmediately("selectended")), this._generalBehavior == "pan" && Gs().setGlobalStyle(vl.default), this.dispatchImmediately("behaviorcanceled")), this.downPoint = void 0, this.dispatch("cursorpositionchanged"); + }, R.prototype.hasMoved = function() { + return (this.behavior == "zoomX" || this.behavior == "panX" ? D(this._upPointOrig, this._downPointOrig) : this.behavior == "zoomY" || this.behavior == "panY" ? L(this._upPointOrig, this._downPointOrig) : C(this._upPointOrig, this._downPointOrig)) > Gs().getHitOption(this.interactions, "hitTolerance"); + }, R.prototype.getPanningRanges = function() { + var u = He(this.downPoint.x / this.innerWidth, 5), w = 1 - He(this.downPoint.y / this.innerHeight, 5), $ = u - He(this.point.x / this.innerWidth, 5), G = w - (1 - He(this.point.y / this.innerHeight, 5)); + this.xRange = { start: $, end: 1 + $ }, this.yRange = { start: G, end: 1 + G }, this.behavior == "panX" && (this.yRange.start = 0, this.yRange.end = 1), this.behavior == "panY" && (this.xRange.start = 0, this.xRange.end = 1); + }, R.prototype.getRanges = function() { + this.lineX && (this.upPoint.x = this.lineX.pixelX), this.lineY && (this.upPoint.y = this.lineY.pixelY), this.selection; + var u = He(this.downPoint.x / this.innerWidth, 5), w = He(this.upPoint.x / this.innerWidth, 5), $ = 1 - He(this.downPoint.y / this.innerHeight, 5), G = 1 - He(this.upPoint.y / this.innerHeight, 5); + this.xRange = { start: H(u, w), end: ve(u, w) }, this.yRange = { start: H($, G), end: ve($, G) }; + }, Object.defineProperty(R.prototype, "behavior", { get: function() { + return this.getPropertyValue("behavior"); + }, set: function(u) { + this.setPropertyValue("behavior", u, !0), this._usesSelection = !1, u.indexOf("zoom") != -1 && (this._generalBehavior = "zoom", this._usesSelection = !0), u.indexOf("select") != -1 && (this._generalBehavior = "select", this._usesSelection = !0), u.indexOf("pan") != -1 && (this._generalBehavior = "pan", this._usesSelection = !1); + }, enumerable: !0, configurable: !0 }), R.prototype.shouldPreventGestures = function(u) { + return !(this.interactions.isTouchProtected && u || this.behavior == "none"); + }, Object.defineProperty(R.prototype, "fullWidthLineX", { get: function() { + return this.getPropertyValue("fullWidthLineX"); + }, set: function(u) { + this.setPropertyValue("fullWidthLineX", u), u || this.updateSize(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "fullWidthLineY", { get: function() { + return this.getPropertyValue("fullWidthLineY"); + }, set: function(u) { + this.setPropertyValue("fullWidthLineY", u), u || this.updateSize(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "hideSeriesTooltipsOnSelection", { get: function() { + return this.getPropertyValue("hideSeriesTooltipsOnSelection"); + }, set: function(u) { + this.setPropertyValue("hideSeriesTooltipsOnSelection", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxTooltipDistance", { get: function() { + return this.getPropertyValue("maxTooltipDistance"); + }, set: function(u) { + this.setPropertyValue("maxTooltipDistance", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "maxPanOut", { get: function() { + return this.getPropertyValue("maxPanOut"); + }, set: function(u) { + this.setPropertyValue("maxPanOut", u); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "xAxis", { get: function() { + return this._xAxis.get(); + }, set: function(u) { + var w = this; + this._xAxis.get() != u && this._xAxis.set(u, new kn([u.tooltip.events.on("positionchanged", this.handleXTooltipPosition, this, !1), u.events.on("rangechangestarted", function($) { + w.hide(0), w.preventShow = !0; + }, void 0, !1), u.events.on("rangechangeended", function($) { + w.preventShow = !1, w.hide(0), w.dispatch("cursorpositionchanged"); + }, void 0, !1)])); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "yAxis", { get: function() { + return this._yAxis.get(); + }, set: function(u) { + var w = this; + this._yAxis.get() != u && this._yAxis.set(u, new kn([u.tooltip.events.on("positionchanged", this.handleYTooltipPosition, this, !1), u.events.on("rangechangestarted", function($) { + w.hide(0), w.__disabled = !0; + }, void 0, !1), u.events.on("rangechangeended", function($) { + w.__disabled = !1, w.hide(0), w.dispatch("cursorpositionchanged"); + }, void 0, !1)])); + }, enumerable: !0, configurable: !0 }), R.prototype.handleXTooltipPosition = function(u) { + var w = this.xAxis.tooltip, $ = ff({ x: w.pixelX, y: w.pixelY }, this), G = $.x; + if ($.y = 1, this.lineX && (this.lineX.x = G, this.fitsToBounds($) || this.hide()), this.xAxis && this.fullWidthLineX) { + var K = this.xAxis.currentItemStartPoint, ne = this.xAxis.currentItemEndPoint; + if (K && ne) { + this.lineX.x = G; + var ue = ne.x - K.x; + this.lineX.path = z8(ue, this.innerHeight, -ue / 2); + } + } + }, R.prototype.handleYTooltipPosition = function(u) { + var w = this.yAxis.tooltip, $ = ff({ x: w.pixelX, y: w.pixelY }, this), G = $.y; + if ($.x = 1, this.lineY && (this.lineY.y = G, this.fitsToBounds($) || this.hide()), this.yAxis && this.fullWidthLineY) { + var K = this.yAxis.currentItemStartPoint, ne = this.yAxis.currentItemEndPoint; + if (K && ne) { + this.lineY.y = G; + var ue = ne.y - K.y; + this.lineY.path = z8(this.innerWidth, ue, 0, -ue / 2); + } + } + }, Object.defineProperty(R.prototype, "lineX", { get: function() { + return this._lineX.get(); + }, set: function(u) { + u ? (u.setElement(this.paper.add("path")), this._lineX.set(u, u.events.on("positionchanged", this.updateSelection, this, !1)), u.interactionsEnabled = !1, u.parent = this) : this._lineX.reset(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "lineY", { get: function() { + return this._lineY.get(); + }, set: function(u) { + u ? (u.setElement(this.paper.add("path")), this._lineY.set(u, u.events.on("positionchanged", this.updateSelection, this, !1)), u.parent = this, u.interactionsEnabled = !1) : this._lineY.reset(); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "selection", { get: function() { + return this._selection; + }, set: function(u) { + this._selection = u, u && (u.element = this.paper.add("path"), u.parent = this); + }, enumerable: !0, configurable: !0 }), R.prototype.processConfig = function(u) { + var w = this; + if (u && (Ee(u.xAxis) && st(u.xAxis) && (this.map.hasKey(u.xAxis) ? u.xAxis = this.map.getKey(u.xAxis) : (this.processingErrors.push('[XYCursor] No axis with id "' + u.xAxis + '" found for `xAxis`'), delete u.xAxis)), Ee(u.yAxis) && st(u.yAxis) && (this.map.hasKey(u.yAxis) ? u.yAxis = this.map.getKey(u.yAxis) : (this.processingErrors.push('[XYCursor] No axis with id "' + u.yAxis + '" found for `yAxis`'), delete u.yAxis)), Ee(u.snapToSeries))) { + var $ = gt(u.snapToSeries) ? u.snapToSeries : [u.snapToSeries], G = !1; + _i($, function(K, ne) { + st(K) && (w.map.hasKey(K) ? $[ne] = w.map.getKey(K) : (w.processingErrors.push('[XYCursor] No series with id "' + K + '" found for `series`'), G = !0)); + }), G ? delete u.snapToSeries : u.snapToSeries = $; + } + U.prototype.processConfig.call(this, u); + }, Object.defineProperty(R.prototype, "snapToSeries", { get: function() { + return this.getPropertyValue("snapToSeries"); + }, set: function(u) { + var w = this; + this.setPropertyValue("snapToSeries", u) && (u instanceof BC && (u = [u]), this._snapToDisposers && _i(this._snapToDisposers, function($) { + $.dispose(); + }), this._snapToDisposers = [], u && _i(u, function($) { + w._snapToDisposers.push($.events.on("tooltipshownat", function() { + w.handleSnap($); + }, void 0, !1)); + })); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "snapOnPan", { get: function() { + return this.getPropertyValue("snapOnPan"); + }, set: function(u) { + this.setPropertyValue("snapOnPan", u); + }, enumerable: !0, configurable: !0 }), R.prototype.handleSnap = function(u) { + if (!this.downPoint) { + var w = u.getTooltipX() + u.xAxis.pixelX, $ = u.getTooltipY() + u.yAxis.pixelY, G = u.xAxis, K = u.yAxis; + G && G.renderer.opposite && ($ -= this.pixelHeight), this.point = { x: w, y: $ }, this.getPositions(); + var ne = w, ue = $; + w -= this.pixelWidth, K && K.renderer.opposite && (w += this.pixelWidth); + var we = u.tooltip, De = we.animationDuration, $e = we.animationEasing; + G instanceof vo && !(G instanceof Ju) && K instanceof vo && !(K instanceof Ju) ? (u.yAxis.showTooltipAtPosition(this.yPosition), u.xAxis.showTooltipAtPosition(this.xPosition)) : (u.baseAxis == u.xAxis && u.yAxis.showTooltipAtPosition(this.yPosition), u.baseAxis == u.yAxis && u.xAxis.showTooltipAtPosition(this.xPosition)), this.lineY.x = w, this.lineX.y = $, this.xAxis || this.lineX.animate([{ property: "x", to: ne }], De, $e), this.yAxis || this.lineY.animate([{ property: "y", to: ue }], De, $e); + } + }, R.prototype.dispose = function() { + this.hide(0), U.prototype.dispose.call(this); + }, R; + }(QH); + hi.registeredClasses.XYCursor = hR; + var nne = function(U) { + function R() { + var u = U.call(this) || this; + return u.className = "RadarCursor", u.radius = ce(100), u.innerRadius = ce(0), u.applyTheme(), u.mask = void 0, u; + } + return re(R, U), R.prototype.fitsToBounds = function(u) { + var w = C(u); + return w < this.truePixelRadius + 1 && w > this.pixelInnerRadius - 1; + }, Object.defineProperty(R.prototype, "startAngle", { get: function() { + return this.getPropertyValue("startAngle"); + }, set: function(u) { + this.setPropertyValue("startAngle", u, !0); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "endAngle", { get: function() { + return this.getPropertyValue("endAngle"); + }, set: function(u) { + this.setPropertyValue("endAngle", u, !0); + }, enumerable: !0, configurable: !0 }), R.prototype.triggerMoveReal = function(u, w) { + this.xAxis && (!this.xAxis || this.xAxis.cursorTooltipEnabled && !this.xAxis.tooltip.disabled) || this.updateLineX(this.point), this.yAxis && (!this.yAxis || this.yAxis.cursorTooltipEnabled && !this.yAxis.tooltip.disabled) || this.updateLineY(this.point), this.updateSelection(), U.prototype.triggerMoveReal.call(this, u, w); + }, R.prototype.updateLineX = function(u) { + var w = this.pixelRadius, $ = this.startAngle, G = this.endAngle, K = this.pixelInnerRadius; + if (w > 0 && le($) && le(G) && le(K)) { + var ne = Jt(se(u), $, G), ue = void 0; + if (this.lineX && this.lineX.visible) { + if (this.lineX.moveTo({ x: 0, y: 0 }), this.xAxis && this.fullWidthLineX) { + var we = this.xAxis.currentItemStartPoint, De = this.xAxis.currentItemEndPoint; + if (we && De) { + var $e = Jt(se(we), $, G), Ke = Jt(se(De), $, G) - $e; + $ < G ? Ke < 0 && (Ke += 360) : Ke > 0 && (Ke -= 360), ue = pn({ x: K * A(ne -= Ke / 2), y: K * Ue(ne) }) + xr({ x: w * A(ne), y: w * Ue(ne) }) + gd(ne, Ke, w) + xr({ x: K * A(ne + Ke), y: K * Ue(ne + Ke) }) + gd(ne + Ke, -Ke, K); + } + } + ue || (ue = pn({ x: K * A(ne), y: K * Ue(ne) }) + xr({ x: w * A(ne), y: w * Ue(ne) })), this.lineX.path = ue; + } + } + }, R.prototype.updateLineY = function(u) { + if (this.lineY && this.lineY.visible) { + var w = this.startAngle, $ = this.endAngle, G = this.truePixelRadius, K = mt(C(u), 0, this.truePixelRadius); + if (le(K) && le(w)) { + this.lineY.moveTo({ x: 0, y: 0 }); + var ne = void 0, ue = $ - w; + if (this.yAxis && this.fullWidthLineY) { + var we = this.yAxis.currentItemStartPoint, De = this.yAxis.currentItemEndPoint; + if (we && De) { + var $e = mt(C(we), 0, G); + ne = pn({ x: (K = mt(C(De), 0, G)) * A(w), y: K * Ue(w) }) + gd(w, ue, K), ne += pn({ x: $e * A($), y: $e * Ue($) }) + gd($, -ue, $e); + } + } + ne || (ne = pn({ x: K * A(w), y: K * Ue(w) }) + gd(w, $ - w, K)), this.lineY.path = ne; + } + } + }, R.prototype.updateSelection = function() { + if (this._usesSelection) { + var u = this.downPoint; + if (u) { + var w = this.point, $ = this.pixelRadius, G = this.truePixelRadius, K = this.pixelInnerRadius, ne = Math.min(this.startAngle, this.endAngle), ue = Math.max(this.startAngle, this.endAngle), we = Jt(se(u), ne, ue), De = Jt(se(w), ne, ue), $e = C(u); + if ($e < G) { + var Ke = mt(C(w), 0, G); + this._prevAngle = De; + var Ze = pn({ x: 0, y: 0 }), pt = Ue(we), Vt = A(we), Yt = Ue(De), ci = A(De), ai = this.behavior; + ai == "zoomX" || ai == "selectX" ? Ze += xr({ x: $ * Vt, y: $ * pt }) + gd(we, De - we, $) + xr({ x: K * ci, y: K * Yt }) + gd(De, we - De, K) : ai == "zoomY" || ai == "selectY" ? Ze = pn({ x: Ke * A(ne), y: Ke * Ue(ne) }) + gd(ne, ue - ne, Ke) + xr({ x: $e * A(ue), y: $e * Ue(ue) }) + gd(ue, ne - ue, $e) + " Z" : ai == "zoomXY" && (Ze = pn({ x: Ke * A(we), y: Ke * Ue(we) }) + gd(we, De - we, Ke) + xr({ x: $e * A(De), y: $e * Ue(De) }) + gd(De, we - De, $e) + " Z"), this.selection.path = Ze; + } + this.selection.moveTo({ x: 0, y: 0 }); + } + } + }, R.prototype.getPositions = function() { + if (this.chart) { + var u = this.pixelInnerRadius, w = this.truePixelRadius - u, $ = this.startAngle, G = this.endAngle, K = (Jt(se(this.point), $, G) - $) / (G - $); + this.xPosition = K, this.yPosition = mt((C(this.point) - u) / w, 0, 1); + } + }, R.prototype.updatePoint = function(u) { + }, R.prototype.handleXTooltipPosition = function(u) { + if (this.xAxis.cursorTooltipEnabled) { + var w = this.xAxis.tooltip; + this.updateLineX(ff({ x: w.pixelX, y: w.pixelY }, this)); + } + }, R.prototype.handleYTooltipPosition = function(u) { + if (this.yAxis.cursorTooltipEnabled) { + var w = this.yAxis.tooltip; + this.updateLineY(ff({ x: w.pixelX, y: w.pixelY }, this)); + } + }, R.prototype.updateLinePositions = function(u) { + }, R.prototype.getRanges = function() { + var u = this.downPoint; + if (u) { + var w = this.upPoint; + if (this.chart) { + var $ = this.pixelRadius, G = this.startAngle, K = this.endAngle, ne = Jt(se(u), this.startAngle, this.endAngle), ue = Jt(se(w), this.startAngle, this.endAngle), we = mt(C(u), 0, $), De = mt(C(w), 0, $), $e = 0, Ke = 1, Ze = 0, pt = 1, Vt = this.behavior; + if (Vt == "zoomX" || Vt == "selectX" || Vt == "zoomXY" || Vt == "selectXY") { + var Yt = K - G; + $e = He((ne - G) / Yt, 5), Ke = He((ue - G) / Yt, 5); + } + Vt != "zoomY" && Vt != "selectY" && Vt != "zoomXY" && Vt != "selectXY" || (Ze = He(we / $, 5), pt = He(De / $, 5)), this.xRange = { start: Math.min($e, Ke), end: Math.max($e, Ke) }, this.yRange = { start: Math.min(Ze, pt), end: Math.max(Ze, pt) }, this.behavior == "selectX" || this.behavior == "selectY" || this.behavior == "selectXY" || this.selection.hide(); + } + } + }, R.prototype.updateSize = function() { + }, Object.defineProperty(R.prototype, "radius", { get: function() { + return this.getPropertyValue("radius"); + }, set: function(u) { + this.setPercentProperty("radius", u, !1, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelRadius", { get: function() { + return yo(this.radius, this.truePixelRadius); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "truePixelRadius", { get: function() { + return vs(ce(100), H(this.innerWidth / 2, this.innerHeight / 2)); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "innerRadius", { get: function() { + return this.getPropertyValue("innerRadius"); + }, set: function(u) { + this.setPercentProperty("innerRadius", u, !1, !1, 10, !1); + }, enumerable: !0, configurable: !0 }), Object.defineProperty(R.prototype, "pixelInnerRadius", { get: function() { + var u = this.innerRadius; + return u instanceof J && (u = ce(100 * u.value * this.chart.innerRadiusModifyer)), yo(u, this.truePixelRadius) || 0; + }, enumerable: !0, configurable: !0 }), R.prototype.fixPoint = function(u) { + return u; + }, R; + }(hR); + hi.registeredClasses.RadarCursor = nne; + const C_e = function(U) { + ll(U, "SpriteState") && (U.transitionDuration = 400), ll(U, "Component") && (U.rangeChangeDuration = 500, U.interpolationDuration = 500, U.sequencedInterpolation = !1, ll(U, "SankeyDiagram") && (U.sequencedInterpolation = !0), ll(U, "FunnelSeries") && (U.sequencedInterpolation = !0)), ll(U, "Chart") && (U.defaultState.transitionDuration = 2e3, U.hiddenState.transitionDuration = 1e3), ll(U, "Tooltip") && (U.animationDuration = 400, U.defaultState.transitionDuration = 400, U.hiddenState.transitionDuration = 400), ll(U, "Scrollbar") && (U.animationDuration = 500), ll(U, "Series") && (U.defaultState.transitionDuration = 1e3, U.hiddenState.transitionDuration = 700, U.hiddenState.properties.opacity = 1, U.showOnInit = !0), ll(U, "MapSeries") && (U.hiddenState.properties.opacity = 0), ll(U, "PercentSeries") && (U.hiddenState.properties.opacity = 0), ll(U, "FunnelSlice") && (U.defaultState.transitionDuration = 800, U.hiddenState.transitionDuration = 1e3, U.hiddenState.properties.opacity = 1), ll(U, "Slice") && (U.defaultState.transitionDuration = 700, U.hiddenState.transitionDuration = 1e3, U.hiddenState.properties.opacity = 1), ll(U, "Preloader") && (U.hiddenState.transitionDuration = 2e3), ll(U, "Column") && (U.defaultState.transitionDuration = 700, U.hiddenState.transitionDuration = 1e3, U.hiddenState.properties.opacity = 1), ll(U, "Column3D") && (U.hiddenState.properties.opacity = 0); + }, ew = function(U) { + ll(U, "InterfaceColorSet") && (U.setFor("stroke", We("#000000")), U.setFor("fill", We("#2b2b2b")), U.setFor("primaryButton", We("#6794dc").lighten(-0.2)), U.setFor("primaryButtonHover", We("#6771dc").lighten(-0.2)), U.setFor("primaryButtonDown", We("#68dc75").lighten(-0.2)), U.setFor("primaryButtonActive", We("#68dc75").lighten(-0.2)), U.setFor("primaryButtonText", We("#FFFFFF")), U.setFor("primaryButtonStroke", We("#6794dc")), U.setFor("secondaryButton", We("#3b3b3b")), U.setFor("secondaryButtonHover", We("#3b3b3b").lighten(0.1)), U.setFor("secondaryButtonDown", We("#3b3b3b").lighten(0.15)), U.setFor("secondaryButtonActive", We("#3b3b3b").lighten(0.15)), U.setFor("secondaryButtonText", We("#bbbbbb")), U.setFor("secondaryButtonStroke", We("#3b3b3b").lighten(-0.2)), U.setFor("grid", We("#bbbbbb")), U.setFor("background", We("#000000")), U.setFor("alternativeBackground", We("#ffffff")), U.setFor("text", We("#ffffff")), U.setFor("alternativeText", We("#000000")), U.setFor("disabledBackground", We("#bbbbbb"))), ll(U, "Scrollbar") && (U.background.fillOpacity = 0.4, U.thumb.background.fillOpacity = 0.5); + }; + return zd.commercialLicense = !0, a; +})(), { get exports() { + return Vfe; +}, set exports(t) { + Vfe = t; +} }.exports = cit(); +const JXi = KXi({ __proto__: null, default: nl(Vfe) }, [Vfe]), ZXi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + i: JXi +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function QXi() { +} +function C8(t, e = !1) { + if (t.disabled) { + t.el.setAttribute("tabindex", "-1"), t.el.setAttribute("aria-disabled", "true"), t.el.contains(document.activeElement) && document.activeElement.blur(), t.el.click = QXi; + return; + } + t.el.click = HTMLElement.prototype.click, typeof e == "function" ? t.el.setAttribute("tabindex", e.call(t) ? "0" : "-1") : e === !0 ? t.el.setAttribute("tabindex", "0") : e === !1 && t.el.removeAttribute("tabindex"), t.el.removeAttribute("aria-disabled"); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Fm = { + container: "container", + containerBorderSelected: "container--border-selected", + containerBorderUnselected: "container--border-unselected", + contentContainer: "content-container", + contentContainerSelectable: "content-container--selectable", + contentContainerHasCenterContent: "content-container--has-center-content", + nestedContainer: "nested-container", + nestedContainerHidden: "nested-container--hidden", + content: "content", + customContent: "custom-content", + actionsStart: "actions-start", + contentStart: "content-start", + label: "label", + description: "description", + contentEnd: "content-end", + actionsEnd: "actions-end", + selectionContainer: "selection-container", + openContainer: "open-container" +}, pq = { + actionsStart: "actions-start", + contentStart: "content-start", + content: "content", + contentEnd: "content-end", + actionsEnd: "actions-end" +}, eKi = 5, m5 = { + selectedMultiple: "check-circle-f", + selectedSingle: "circle-f", + unselected: "blank", + closedLTR: "caret-right", + closedRTL: "caret-left", + open: "caret-down", + blank: "blank" +}, tKi = "calcite-list-item-group", hit = "calcite-list-item"; +function m3t(t) { + const e = t.target.assignedElements({ flatten: !0 }), i = e.filter((n) => n?.matches(tKi)).map((n) => Array.from(n.querySelectorAll(hit))).reduce((n, s) => [...n, ...s], []), r = e.filter((n) => n?.matches(hit)); + return [...i, ...r]; +} +function g3t(t) { + t.forEach((e) => { + e.setPosition = t.indexOf(e) + 1, e.setSize = t.length; + }); +} +function dit(t, e = !1) { + const i = e ? "ancestor::calcite-list-item | ancestor::calcite-list-item-group" : "ancestor::calcite-list-item"; + return document.evaluate(i, t, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotLength; +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const y3t = /* @__PURE__ */ new WeakMap(), v3t = /* @__PURE__ */ new WeakMap(); +function GI(t) { + v3t.set(t, new Promise((e) => y3t.set(t, e))); +} +function UI(t) { + y3t.get(t)(); +} +function zI(t) { + return v3t.get(t); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +var _3t = typeof global == "object" && global && global.Object === Object && global, iKi = typeof self == "object" && self && self.Object === Object && self, n9e = _3t || iKi || Function("return this")(), iz = n9e.Symbol, b3t = Object.prototype, rKi = b3t.hasOwnProperty, nKi = b3t.toString, fq = iz ? iz.toStringTag : void 0; +function sKi(t) { + var e = rKi.call(t, fq), i = t[fq]; + try { + t[fq] = void 0; + var r = !0; + } catch { + } + var n = nKi.call(t); + return r && (e ? t[fq] = i : delete t[fq]), n; +} +var oKi = Object.prototype, aKi = oKi.toString; +function lKi(t) { + return aKi.call(t); +} +var uKi = "[object Null]", cKi = "[object Undefined]", pit = iz ? iz.toStringTag : void 0; +function wve(t) { + return t == null ? t === void 0 ? cKi : uKi : pit && pit in Object(t) ? sKi(t) : lKi(t); +} +function xve(t) { + return t != null && typeof t == "object"; +} +var hKi = "[object Symbol]"; +function w3t(t) { + return typeof t == "symbol" || xve(t) && wve(t) == hKi; +} +var dKi = /\s/; +function pKi(t) { + for (var e = t.length; e-- && dKi.test(t.charAt(e)); ) + ; + return e; +} +var fKi = /^\s+/; +function mKi(t) { + return t && t.slice(0, pKi(t) + 1).replace(fKi, ""); +} +function ste(t) { + var e = typeof t; + return t != null && (e == "object" || e == "function"); +} +var fit = 0 / 0, gKi = /^[-+]0x[0-9a-f]+$/i, yKi = /^0b[01]+$/i, vKi = /^0o[0-7]+$/i, _Ki = parseInt; +function mit(t) { + if (typeof t == "number") + return t; + if (w3t(t)) + return fit; + if (ste(t)) { + var e = typeof t.valueOf == "function" ? t.valueOf() : t; + t = ste(e) ? e + "" : e; + } + if (typeof t != "string") + return t === 0 ? t : +t; + t = mKi(t); + var i = yKi.test(t); + return i || vKi.test(t) ? _Ki(t.slice(2), i ? 2 : 8) : gKi.test(t) ? fit : +t; +} +var Vxe = function() { + return n9e.Date.now(); +}, bKi = "Expected a function", wKi = Math.max, xKi = Math.min; +function jfe(t, e, i) { + var r, n, s, o, a, l, c = 0, h = !1, p = !1, y = !0; + if (typeof t != "function") + throw new TypeError(bKi); + e = mit(e) || 0, ste(i) && (h = !!i.leading, p = "maxWait" in i, s = p ? wKi(mit(i.maxWait) || 0, e) : s, y = "trailing" in i ? !!i.trailing : y); + function v(X) { + var Q = r, re = n; + return r = n = void 0, c = X, o = t.apply(re, Q), o; + } + function x(X) { + return c = X, a = setTimeout(F, e), h ? v(X) : o; + } + function I(X) { + var Q = X - l, re = X - c, he = e - Q; + return p ? xKi(he, s - re) : he; + } + function P(X) { + var Q = X - l, re = X - c; + return l === void 0 || Q >= e || Q < 0 || p && re >= s; + } + function F() { + var X = Vxe(); + if (P(X)) + return k(X); + a = setTimeout(F, I(X)); + } + function k(X) { + return a = void 0, y && r ? v(X) : (r = n = void 0, o); + } + function V() { + a !== void 0 && clearTimeout(a), c = 0, r = l = n = a = void 0; + } + function j() { + return a === void 0 ? o : k(Vxe()); + } + function Y() { + var X = Vxe(), Q = P(X); + if (r = arguments, n = this, l = X, Q) { + if (a === void 0) + return x(l); + if (p) + return clearTimeout(a), a = setTimeout(F, e), v(l); + } + return a === void 0 && (a = setTimeout(F, e)), o; + } + return Y.cancel = V, Y.flush = j, Y; +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function SKi(t, e) { + for (var i = -1, r = t == null ? 0 : t.length, n = Array(r); ++i < r; ) + n[i] = e(t[i], i, t); + return n; +} +var x3t = Array.isArray, CKi = 1 / 0, git = iz ? iz.prototype : void 0, yit = git ? git.toString : void 0; +function S3t(t) { + if (typeof t == "string") + return t; + if (x3t(t)) + return SKi(t, S3t) + ""; + if (w3t(t)) + return yit ? yit.call(t) : ""; + var e = t + ""; + return e == "0" && 1 / t == -CKi ? "-0" : e; +} +function TKi(t) { + return t; +} +var EKi = "[object AsyncFunction]", IKi = "[object Function]", AKi = "[object GeneratorFunction]", PKi = "[object Proxy]"; +function OKi(t) { + if (!ste(t)) + return !1; + var e = wve(t); + return e == IKi || e == AKi || e == EKi || e == PKi; +} +var RKi = 9007199254740991, MKi = /^(?:0|[1-9]\d*)$/; +function DKi(t, e) { + var i = typeof t; + return e = e ?? RKi, !!e && (i == "number" || i != "symbol" && MKi.test(t)) && t > -1 && t % 1 == 0 && t < e; +} +var FKi = 9007199254740991; +function C3t(t) { + return typeof t == "number" && t > -1 && t % 1 == 0 && t <= FKi; +} +function LKi(t) { + return t != null && C3t(t.length) && !OKi(t); +} +var NKi = Object.prototype; +function kKi(t) { + var e = t && t.constructor, i = typeof e == "function" && e.prototype || NKi; + return t === i; +} +function $Ki(t, e) { + for (var i = -1, r = Array(t); ++i < t; ) + r[i] = e(i); + return r; +} +var BKi = "[object Arguments]"; +function vit(t) { + return xve(t) && wve(t) == BKi; +} +var T3t = Object.prototype, VKi = T3t.hasOwnProperty, jKi = T3t.propertyIsEnumerable, GKi = vit(function() { + return arguments; +}()) ? vit : function(t) { + return xve(t) && VKi.call(t, "callee") && !jKi.call(t, "callee"); +}; +function UKi() { + return !1; +} +var E3t = typeof exports == "object" && exports && !exports.nodeType && exports, _it = E3t && typeof module == "object" && module && !module.nodeType && module, zKi = _it && _it.exports === E3t, bit = zKi ? n9e.Buffer : void 0, HKi = bit ? bit.isBuffer : void 0, WKi = HKi || UKi, qKi = "[object Arguments]", YKi = "[object Array]", XKi = "[object Boolean]", KKi = "[object Date]", JKi = "[object Error]", ZKi = "[object Function]", QKi = "[object Map]", eJi = "[object Number]", tJi = "[object Object]", iJi = "[object RegExp]", rJi = "[object Set]", nJi = "[object String]", sJi = "[object WeakMap]", oJi = "[object ArrayBuffer]", aJi = "[object DataView]", lJi = "[object Float32Array]", uJi = "[object Float64Array]", cJi = "[object Int8Array]", hJi = "[object Int16Array]", dJi = "[object Int32Array]", pJi = "[object Uint8Array]", fJi = "[object Uint8ClampedArray]", mJi = "[object Uint16Array]", gJi = "[object Uint32Array]", Sd = {}; +Sd[lJi] = Sd[uJi] = Sd[cJi] = Sd[hJi] = Sd[dJi] = Sd[pJi] = Sd[fJi] = Sd[mJi] = Sd[gJi] = !0; +Sd[qKi] = Sd[YKi] = Sd[oJi] = Sd[XKi] = Sd[aJi] = Sd[KKi] = Sd[JKi] = Sd[ZKi] = Sd[QKi] = Sd[eJi] = Sd[tJi] = Sd[iJi] = Sd[rJi] = Sd[nJi] = Sd[sJi] = !1; +function yJi(t) { + return xve(t) && C3t(t.length) && !!Sd[wve(t)]; +} +function vJi(t) { + return function(e) { + return t(e); + }; +} +var I3t = typeof exports == "object" && exports && !exports.nodeType && exports, tZ = I3t && typeof module == "object" && module && !module.nodeType && module, _Ji = tZ && tZ.exports === I3t, jxe = _Ji && _3t.process, wit = function() { + try { + var t = tZ && tZ.require && tZ.require("util").types; + return t || jxe && jxe.binding && jxe.binding("util"); + } catch { + } +}(), xit = wit && wit.isTypedArray, bJi = xit ? vJi(xit) : yJi, wJi = Object.prototype, xJi = wJi.hasOwnProperty; +function SJi(t, e) { + var i = x3t(t), r = !i && GKi(t), n = !i && !r && WKi(t), s = !i && !r && !n && bJi(t), o = i || r || n || s, a = o ? $Ki(t.length, String) : [], l = a.length; + for (var c in t) + (e || xJi.call(t, c)) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. + (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + n && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties. + DKi(c, l))) && a.push(c); + return a; +} +function CJi(t) { + var e = []; + if (t != null) + for (var i in Object(t)) + e.push(i); + return e; +} +var TJi = Object.prototype, EJi = TJi.hasOwnProperty; +function IJi(t) { + if (!ste(t)) + return CJi(t); + var e = kKi(t), i = []; + for (var r in t) + r == "constructor" && (e || !EJi.call(t, r)) || i.push(r); + return i; +} +function AJi(t) { + return LKi(t) ? SJi(t, !0) : IJi(t); +} +function PJi(t) { + return t == null ? "" : S3t(t); +} +function OJi(t) { + return function(e, i, r) { + for (var n = -1, s = Object(e), o = r(e), a = o.length; a--; ) { + var l = o[t ? a : ++n]; + if (i(s[l], l, s) === !1) + break; + } + return e; + }; +} +var RJi = OJi(); +function MJi(t) { + return typeof t == "function" ? t : TKi; +} +var A3t = /[\\^$.*+?()[\]{}|]/g, DJi = RegExp(A3t.source); +function FJi(t) { + return t = PJi(t), t && DJi.test(t) ? t.replace(A3t, "\\$&") : t; +} +function LJi(t, e) { + return t == null ? t : RJi(t, MJi(e), AJi); +} +const Sit = (t, e) => { + const i = FJi(e), r = new RegExp(i, "i"); + t.length === 0 && console.warn(`No data was passed to the filter function. + The data argument should be an array of objects`); + const n = (o, a) => { + if (o?.constant || o?.filterDisabled) + return !0; + let l = !1; + return LJi(o, (c) => { + typeof c == "function" || c == null || (Array.isArray(c) || typeof c == "object" && c !== null ? n(c, a) && (l = !0) : a.test(c) && (l = !0)); + }), l; + }; + return t.filter((o) => n(o, r)); +}; +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function P3t(t) { + return t === "Enter" || t === " "; +} +const s9e = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const NJi = new RegExp("-", "g"), kJi = new RegExp("\\.?0+$"); +class wc { + constructor(e) { + if (this.add = (n) => wc.fromBigInt(this.value + new wc(n).value), this.subtract = (n) => wc.fromBigInt(this.value - new wc(n).value), this.multiply = (n) => wc._divRound(this.value * new wc(n).value, wc.SHIFT), this.divide = (n) => wc._divRound(this.value * wc.SHIFT, new wc(n).value), e instanceof wc) + return e; + const [i, r] = String(e).split(".").concat(""); + this.value = BigInt(i + r.padEnd(wc.DECIMALS, "0").slice(0, wc.DECIMALS)) + BigInt(wc.ROUNDED && r[wc.DECIMALS] >= "5"), this.isNegative = e.charAt(0) === "-"; + } + getIntegersAndDecimals() { + const e = this.value.toString().replace(NJi, "").padStart(wc.DECIMALS + 1, "0"), i = e.slice(0, -wc.DECIMALS), r = e.slice(-wc.DECIMALS).replace(kJi, ""); + return { integers: i, decimals: r }; + } + toString() { + const { integers: e, decimals: i } = this.getIntegersAndDecimals(); + return `${this.isNegative ? "-" : ""}${e}${i.length ? "." + i : ""}`; + } + formatToParts(e) { + const { integers: i, decimals: r } = this.getIntegersAndDecimals(), n = e.numberFormatter.formatToParts(BigInt(i)); + return this.isNegative && n.unshift({ type: "minusSign", value: e.minusSign }), r.length && (n.push({ type: "decimal", value: e.decimal }), r.split("").forEach((s) => n.push({ type: "fraction", value: s }))), n; + } + format(e) { + const { integers: i, decimals: r } = this.getIntegersAndDecimals(), n = `${this.isNegative ? e.minusSign : ""}${e.numberFormatter.format(BigInt(i))}`, s = r.length ? `${e.decimal}${r.split("").map((o) => e.numberFormatter.format(Number(o))).join("")}` : ""; + return `${n}${s}`; + } +} +wc.DECIMALS = 100; +wc.ROUNDED = !0; +wc.SHIFT = BigInt("1" + "0".repeat(wc.DECIMALS)); +wc._divRound = (t, e) => wc.fromBigInt(t / e + (wc.ROUNDED ? t * BigInt(2) / e % BigInt(2) : BigInt(0))); +wc.fromBigInt = (t) => Object.assign(Object.create(wc.prototype), { value: t }); +function uE(t) { + return !(!t || isNaN(Number(t))); +} +function $Ji(t) { + return !t || !zJi(t) ? "" : Gfe(t, (e) => { + let i = !1; + const r = e.split("").filter((n, s) => n.match(/\./g) && !i ? (i = !0, !0) : n.match(/\-/g) && s === 0 ? !0 : s9e.includes(n)).reduce((n, s) => n + s); + return uE(r) ? new wc(r).toString() : ""; + }); +} +const BJi = /^([-0])0+(?=\d)/, VJi = /(?!^\.)\.$/, jJi = /(?!^-)-/g, GJi = /^-\b0\b\.?0*$/, UJi = (t) => Gfe(t, (e) => { + const i = e.replace(jJi, "").replace(VJi, "").replace(BJi, "$1"); + return uE(i) ? GJi.test(i) ? i : new wc(i).toString() : e; +}); +function Gfe(t, e) { + if (!t) + return t; + const i = t.toLowerCase().indexOf("e") + 1; + return i ? t.replace(/[eE]*$/g, "").substring(0, i).concat(t.slice(i).replace(/[eE]/g, "")).split(/[eE]/).map((r, n) => e(n === 1 ? r.replace(/\./g, "") : r)).join("e").replace(/^e/, "1e") : e(t); +} +function zJi(t) { + return s9e.some((e) => t.includes(e)); +} +const u4 = "en", HJi = [ + "ar", + "bg", + "bs", + "ca", + "cs", + "da", + "de", + "el", + u4, + "es", + "et", + "fi", + "fr", + "he", + "hr", + "hu", + "id", + "it", + "ja", + "ko", + "lt", + "lv", + "no", + "nl", + "pl", + "pt-BR", + "pt-PT", + "ro", + "ru", + "sk", + "sl", + "sr", + "sv", + "th", + "tr", + "uk", + "vi", + "zh-CN", + "zh-HK", + "zh-TW" +], WJi = [ + "ar", + "bg", + "bs", + "ca", + "cs", + "da", + "de", + "de-CH", + "el", + u4, + "en-AU", + "en-CA", + "en-GB", + "es", + "es-MX", + "et", + "fi", + "fr", + "fr-CH", + "he", + "hi", + "hr", + "hu", + "id", + "it", + "it-CH", + "ja", + "ko", + "lt", + "lv", + "mk", + "no", + "nl", + "pl", + "pt", + "pt-PT", + "ro", + "ru", + "sk", + "sl", + "sr", + "sv", + "th", + "tr", + "uk", + "vi", + "zh-CN", + "zh-HK", + "zh-TW" +], qJi = [ + "arab", + "arabext", + "bali", + "beng", + "deva", + "fullwide", + "gujr", + "guru", + "hanidec", + "khmr", + "knda", + "laoo", + "latn", + "limb", + "mlym", + "mong", + "mymr", + "orya", + "tamldec", + "telu", + "thai", + "tibt" +], O3t = (t) => qJi.includes(t), Gxe = new Intl.NumberFormat().resolvedOptions().numberingSystem, o9e = Gxe === "arab" || !O3t(Gxe) ? "latn" : Gxe, YJi = (t) => O3t(t) ? t : o9e; +function R3t(t, e = "cldr") { + const i = e === "cldr" ? WJi : HJi; + return t ? i.includes(t) ? t : (t = t.toLowerCase(), t === "nb" ? "no" : e === "t9n" && t === "pt" ? "pt-BR" : (t.includes("-") && (t = t.replace(/(\w+)-(\w+)/, (r, n, s) => `${n}-${s.toUpperCase()}`), i.includes(t) || (t = t.split("-")[0])), t === "zh" ? "zh-CN" : i.includes(t) ? t : (console.warn(`Translations for the "${t}" locale are not available and will fall back to the default, English (en).`), u4))) : u4; +} +const ote = /* @__PURE__ */ new Set(); +function H4(t) { + XJi(t), ote.size === 0 && M3t?.observe(document.documentElement, { + attributes: !0, + attributeFilter: ["lang"], + subtree: !0 + }), ote.add(t); +} +function XJi(t) { + t.effectiveLocale = KJi(t); +} +function W4(t) { + ote.delete(t), ote.size === 0 && M3t.disconnect(); +} +const M3t = z4("mutation", (t) => { + t.forEach((e) => { + const i = e.target; + ote.forEach((r) => { + if (!Lsi(i, r.el)) + return; + const s = jz(r.el, "[lang]"); + if (!s) { + r.effectiveLocale = u4; + return; + } + const o = s.lang; + r.effectiveLocale = // user set lang="" means unknown language, so we use default + s.hasAttribute("lang") && o === "" ? u4 : o; + }); + }); +}); +function KJi(t) { + return t.el.lang || jz(t.el, "[lang]")?.lang || document.documentElement.lang || u4; +} +class JJi { + constructor() { + this.delocalize = (e) => ( + // For performance, (de)localization is skipped if the formatter isn't initialized. + // In order to localize/delocalize, e.g. when lang/numberingSystem props are not default values, + // `numberFormatOptions` must be set in a component to create and cache the formatter. + this._numberFormatOptions ? Gfe(e, (i) => i.trim().replace(new RegExp(`[${this._minusSign}]`, "g"), "-").replace(new RegExp(`[${this._group}]`, "g"), "").replace(new RegExp(`[${this._decimal}]`, "g"), ".").replace(new RegExp(`[${this._digits.join("")}]`, "g"), this._getDigitIndex)) : e + ), this.localize = (e) => this._numberFormatOptions ? Gfe(e, (i) => uE(i.trim()) ? new wc(i.trim()).format(this).replace(new RegExp(`[${this._actualGroup}]`, "g"), this._group) : i) : e; + } + get group() { + return this._group; + } + get decimal() { + return this._decimal; + } + get minusSign() { + return this._minusSign; + } + get digits() { + return this._digits; + } + get numberFormatter() { + return this._numberFormatter; + } + get numberFormatOptions() { + return this._numberFormatOptions; + } + /** + * numberFormatOptions needs to be set before localize/delocalize is called to ensure the options are up to date + */ + set numberFormatOptions(e) { + if (e.locale = R3t(e?.locale), e.numberingSystem = YJi(e?.numberingSystem), // No need to create the formatter if `locale` and `numberingSystem` + // are the default values and `numberFormatOptions` has not been set + !this._numberFormatOptions && e.locale === u4 && e.numberingSystem === o9e && // don't skip initialization if any options besides locale/numberingSystem are set + Object.keys(e).length === 2 || // cache formatter by only recreating when options change + JSON.stringify(this._numberFormatOptions) === JSON.stringify(e)) + return; + this._numberFormatOptions = e, this._numberFormatter = new Intl.NumberFormat(this._numberFormatOptions.locale, this._numberFormatOptions), this._digits = [ + ...new Intl.NumberFormat(this._numberFormatOptions.locale, { + useGrouping: !1, + numberingSystem: this._numberFormatOptions.numberingSystem + }).format(9876543210) + ].reverse(); + const i = new Map(this._digits.map((n, s) => [n, s])), r = new Intl.NumberFormat(this._numberFormatOptions.locale).formatToParts(-123456789e-1); + this._actualGroup = r.find((n) => n.type === "group").value, this._group = this._actualGroup.trim().length === 0 ? " " : this._actualGroup, this._decimal = r.find((n) => n.type === "decimal").value, this._minusSign = r.find((n) => n.type === "minusSign").value, this._getDigitIndex = (n) => i.get(n); + } +} +const RA = new JJi(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Uoe = {}; +async function ZJi(t, e) { + const i = `${e}_${t}`; + return Uoe[i] || (Uoe[i] = fetch(vvt(`./assets/${e}/t9n/messages_${t}.json`)).then((r) => (r.ok || Cit(), r.json())).catch(() => Cit())), Uoe[i]; +} +function Cit() { + throw new Error("could not fetch component message bundle"); +} +function a9e(t) { + t.messages = { + ...t.defaultMessages, + ...t.messageOverrides + }; +} +async function q4(t) { + t.defaultMessages = await D3t(t, t.effectiveLocale), a9e(t); +} +async function D3t(t, e) { + const { el: i } = t, n = i.tagName.toLowerCase().replace("calcite-", ""); + return ZJi(R3t(e, "t9n"), n); +} +async function Y4(t, e) { + t.defaultMessages = await D3t(t, e), a9e(t); +} +function X4(t) { + t.onMessagesChange = QJi; +} +function K4(t) { + t.onMessagesChange = void 0; +} +function QJi() { + a9e(this); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const CMe = "hidden-form-input"; +function l9e(t) { + return "checked" in t; +} +const TMe = /* @__PURE__ */ new WeakMap(), u9e = /* @__PURE__ */ new WeakSet(); +function eZi(t, e) { + const i = "calciteInternalFormComponentRegister"; + let r = !1; + return t.addEventListener(i, (n) => { + r = n.composedPath().some((s) => u9e.has(s)), n.stopPropagation(); + }, { once: !0 }), e.dispatchEvent(new CustomEvent(i, { + bubbles: !0, + composed: !0 + })), r; +} +function tZi(t) { + const { formEl: e } = t; + return e ? ("requestSubmit" in e ? e.requestSubmit() : e.submit(), !0) : !1; +} +function iZi(t) { + const { el: e, value: i } = t, r = jz(e, "form"); + if (!r || eZi(r, e)) + return; + t.formEl = r, t.defaultValue = i, l9e(t) && (t.defaultChecked = t.checked); + const n = (t.onFormReset || rZi).bind(t); + r.addEventListener("reset", n), TMe.set(t.el, n), u9e.add(e); +} +function rZi() { + if (l9e(this)) { + this.checked = this.defaultChecked; + return; + } + this.value = this.defaultValue; +} +function nZi(t) { + const { el: e, formEl: i } = t; + if (!i) + return; + const r = TMe.get(e); + i.removeEventListener("reset", r), TMe.delete(e), t.formEl = null, u9e.delete(e); +} +const F3t = (t) => { + t.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange", { bubbles: !0 })); +}, Tit = (t) => t.removeEventListener("change", F3t); +function sZi(t) { + const { el: e, formEl: i, name: r, value: n } = t, { ownerDocument: s } = e, o = e.querySelectorAll(`input[slot="${CMe}"]`); + if (!i || !r) { + o.forEach((p) => { + Tit(p), p.remove(); + }); + return; + } + const a = Array.isArray(n) ? n : [n], l = [], c = /* @__PURE__ */ new Set(); + o.forEach((p) => { + const y = a.find((v) => ( + /* intentional non-strict equality check */ + v == p.value + )); + y != null ? (c.add(y), Eit(t, p, y)) : l.push(p); + }); + let h; + a.forEach((p) => { + if (c.has(p)) + return; + let y = l.pop(); + y || (y = s.createElement("input"), y.slot = CMe), h || (h = s.createDocumentFragment()), h.append(y), y.addEventListener("change", F3t), Eit(t, y, p); + }), h && e.append(h), l.forEach((p) => { + Tit(p), p.remove(); + }); +} +function Eit(t, e, i) { + const { defaultValue: r, disabled: n, name: s, required: o } = t; + e.defaultValue = r, e.disabled = n, e.name = s, e.required = o, e.tabIndex = -1, l9e(t) ? (e.checked = t.checked, e.defaultChecked = t.defaultChecked, e.value = t.checked ? i || "on" : "") : e.value = i || "", t.syncHiddenFormInput?.(e); +} +const oZi = ({ component: t }) => (sZi(t), pr("slot", { name: CMe })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const L3t = "calciteInternalLabelClick", c9e = "calciteInternalLabelConnected", EMe = "calciteInternaLabelDisconnected", Iit = "calcite-label", Ufe = /* @__PURE__ */ new WeakMap(), ate = /* @__PURE__ */ new WeakMap(), zfe = /* @__PURE__ */ new WeakMap(), x7 = /* @__PURE__ */ new Set(), aZi = (t) => { + const { id: e } = t, i = e && vNe(t, { selector: `${Iit}[for="${e}"]` }); + if (i) + return i; + const r = jz(t, Iit); + return !r || // labelable components within other custom elements are not considered labelable + lZi(r, t) ? null : r; +}; +function lZi(t, e) { + let i; + const r = "custom-element-ancestor-check", n = (o) => { + o.stopImmediatePropagation(); + const a = o.composedPath(); + i = a.slice(a.indexOf(e), a.indexOf(t)); + }; + return t.addEventListener(r, n, { once: !0 }), e.dispatchEvent(new CustomEvent(r, { composed: !0, bubbles: !0 })), t.removeEventListener(r, n), i.filter((o) => o !== e && o !== t).filter((o) => o.tagName?.includes("-")).length > 0; +} +function N3t(t) { + const e = aZi(t.el); + if (Ufe.has(e) || !e && x7.has(t)) + return; + const i = dZi.bind(t); + if (e) { + t.labelEl = e; + const r = cZi.bind(t); + Ufe.set(t.labelEl, r), t.labelEl.addEventListener(L3t, r), x7.delete(t), document.removeEventListener(c9e, ate.get(t)), zfe.set(t, i), document.addEventListener(EMe, i); + } else + x7.has(t) || (i(), document.removeEventListener(EMe, zfe.get(t))); +} +function uZi(t) { + if (x7.delete(t), document.removeEventListener(c9e, ate.get(t)), document.removeEventListener(EMe, zfe.get(t)), ate.delete(t), zfe.delete(t), !t.labelEl) + return; + const e = Ufe.get(t.labelEl); + t.labelEl.removeEventListener(L3t, e), Ufe.delete(t.labelEl); +} +function Ait(t) { + return t.label || t.labelEl?.textContent?.trim() || ""; +} +function cZi(t) { + this.disabled || this.el.contains(t.detail.sourceEvent.target) || this.onLabelClick(t); +} +function hZi() { + x7.has(this) && N3t(this); +} +function dZi() { + x7.add(this); + const t = ate.get(this) || hZi.bind(this); + ate.set(this, t), document.addEventListener(c9e, t); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Pit = (t) => { + const e = ("" + t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); + return e ? Math.max( + 0, + // Number of digits right of decimal point. + (e[1] ? e[1].length : 0) - // Adjust for scientific notation. + (e[2] ? +e[2] : 0) + ) : 0; +}; +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const pZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{position:relative;display:block;inline-size:100%}.track,.bar{position:absolute;inset-block-start:0px;block-size:2px}.track{z-index:1;inline-size:100%;overflow:hidden;background:var(--calcite-ui-border-3)}.bar{z-index:1;background-color:var(--calcite-ui-brand)}@media (forced-colors: active){.track{background-color:highlightText}.bar{background-color:linkText}}.indeterminate{inline-size:20%;animation:looping-progress-bar-ani calc(var(--calcite-internal-animation-timing-medium) * 11) linear infinite}.reversed{animation-direction:reverse}.text{padding-inline:0px;padding-block:1rem 0px;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}@keyframes looping-progress-bar-ani{0%{transform:translate3d(-100%, 0, 0)}50%{inline-size:40%}100%{transform:translate3d(600%, 0, 0)}}", fZi = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.type = "determinate", this.value = 0, this.label = void 0, this.text = void 0, this.reversed = !1; + } + render() { + const e = this.type === "determinate" ? { width: `${this.value * 100}%` } : {}; + return pr("div", { "aria-label": this.label || this.text, "aria-valuemax": 1, "aria-valuemin": 0, "aria-valuenow": this.value, role: "progressbar" }, pr("div", { class: "track" }, pr("div", { class: { + bar: !0, + indeterminate: this.type === "indeterminate", + reversed: this.reversed + }, style: e })), this.text ? pr("div", { class: "text" }, this.text) : null); + } + get el() { + return this; + } + static get style() { + return pZi; + } +}, [1, "calcite-progress", { + type: [513], + value: [2], + label: [1], + text: [1], + reversed: [516] +}]); +function Sve() { + if (typeof customElements > "u") + return; + ["calcite-progress"].forEach((e) => { + switch (e) { + case "calcite-progress": + customElements.get(e) || customElements.define(e, fZi); + break; + } + }); +} +Sve(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Jy = { + loader: "loader", + clearButton: "clear-button", + editingEnabled: "editing-enabled", + inlineChild: "inline-child", + inputIcon: "icon", + prefix: "prefix", + suffix: "suffix", + numberButtonWrapper: "number-button-wrapper", + buttonItemHorizontal: "number-button-item--horizontal", + wrapper: "element-wrapper", + inputWrapper: "wrapper", + actionWrapper: "action-wrapper", + resizeIconWrapper: "resize-icon-wrapper", + numberButtonItem: "number-button-item" +}, Oit = { + tel: "phone", + password: "lock", + email: "email-address", + date: "calendar", + time: "clock", + search: "search" +}, mZi = { + action: "action" +}, gZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) textarea{block-size:1.5rem;min-block-size:1.5rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{block-size:1.5rem}:host([scale=s]) input[type=file]{block-size:1.5rem}:host([scale=s]) .clear-button{min-block-size:1.5rem;min-inline-size:1.5rem}:host([scale=s]) textarea{block-size:auto;padding-block:0.25rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) textarea{min-block-size:2rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{block-size:2rem}:host([scale=m]) input[type=file]{block-size:2rem}:host([scale=m]) .clear-button{min-block-size:2rem;min-inline-size:2rem}:host([scale=m]) textarea{block-size:auto;padding-block:0.5rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) textarea{min-block-size:2.75rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{block-size:2.75rem}:host([scale=l]) input[type=file]{block-size:2.75rem}:host([scale=l]) .clear-button{min-block-size:2.75rem;min-inline-size:2.75rem}:host([scale=l]) textarea{block-size:auto;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([disabled]) textarea{resize:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host textarea,:host input{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}:host input[type=search]::-webkit-search-decoration{-webkit-appearance:none}:host input,:host textarea{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}:host input::placeholder,:host input:-ms-input-placeholder,:host input::-ms-input-placeholder,:host textarea::placeholder,:host textarea:-ms-input-placeholder,:host textarea::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}:host input:focus,:host textarea:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}:host input[readonly],:host textarea[readonly]{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}:host input[readonly]:focus,:host textarea[readonly]:focus{color:var(--calcite-ui-text-1)}:host calcite-icon{color:var(--calcite-ui-text-3)}:host textarea,:host input{outline-color:transparent}:host textarea:focus,:host input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([status=invalid]) input,:host([status=invalid]) textarea{border-color:var(--calcite-ui-danger)}:host([status=invalid]) input:focus,:host([status=invalid]) textarea:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}:host([scale=s]) .icon{inset-inline-start:0.5rem}:host([scale=m]) .icon{inset-inline-start:0.75rem}:host([scale=l]) .icon{inset-inline-start:1rem}:host([icon][scale=s]) input{padding-inline-start:2rem}:host([icon][scale=m]) input{padding-inline-start:2.5rem}:host([icon][scale=l]) input{padding-inline-start:3.5rem}.element-wrapper{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}.icon{pointer-events:none;position:absolute;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.icon,.resize-icon-wrapper{z-index:1}input[type=text]::-ms-clear,input[type=text]::-ms-reveal{display:none;block-size:0px;inline-size:0px}input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration,input[type=date]::-webkit-clear-button,input[type=time]::-webkit-clear-button{display:none}.clear-button{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.clear-button:active{background-color:var(--calcite-ui-foreground-3)}.clear-button:active calcite-icon{color:var(--calcite-ui-text-1)}.clear-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) textarea,:host([alignment=start]) input{text-align:start}:host([alignment=end]) textarea,:host([alignment=end]) input{text-align:end}:host input[type=number]{-moz-appearance:textfield}:host input[type=number]::-webkit-inner-spin-button,:host input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0px}.number-button-wrapper{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([number-button-type=vertical]) .wrapper{flex-direction:row;display:flex}:host([number-button-type=vertical]) input,:host([number-button-type=vertical]) textarea{order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:1;max-block-size:100%;min-block-size:100%;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]{border-block-start-width:0px}.number-button-item{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}.number-button-item calcite-icon{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}.number-button-item:disabled{pointer-events:none}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host input::-webkit-calendar-picker-indicator{display:none}:host input[type=date]::-webkit-input-placeholder{visibility:hidden !important}:host textarea::-webkit-resizer{position:absolute;inset-block-end:0px;box-sizing:border-box;padding-block:0px;padding-inline:0.25rem;inset-inline-end:0}.resize-icon-wrapper{inset-block-end:2px;inset-inline-end:2px;pointer-events:none;position:absolute;block-size:0.75rem;inline-size:0.75rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3)}.resize-icon-wrapper calcite-icon{inset-block-end:0.25rem;inset-inline-end:0.25rem;transform:rotate(-45deg)}.calcite--rtl .resize-icon-wrapper calcite-icon{transform:rotate(45deg)}:host([type=color]) input{padding:0.25rem}:host([type=file]) input{cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);text-align:center}:host([type=file][scale=s]) input{padding-block:1px;padding-inline:0.5rem}:host([type=file][scale=m]) input{padding-block:0.25rem;padding-inline:0.75rem}:host([type=file][scale=l]) input{padding-block:0.5rem;padding-inline:1rem}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}:host .inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:flex;cursor:pointer;text-overflow:ellipsis;border-color:transparent;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}", yZi = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteInternalInputFocus = ad(this, "calciteInternalInputFocus", 6), this.calciteInternalInputBlur = ad(this, "calciteInternalInputBlur", 6), this.calciteInputInput = ad(this, "calciteInputInput", 7), this.calciteInputChange = ad(this, "calciteInputChange", 6), this.childElType = "input", this.previousValueOrigin = "initial", this.mutationObserver = z4("mutation", () => this.setDisabledAction()), this.userChangedValue = !1, this.keyDownHandler = (t) => { + this.readOnly || this.disabled || (this.isClearable && t.key === "Escape" && (this.clearInputValue(t), t.preventDefault()), t.key === "Enter" && !t.defaultPrevented && tZi(this) && t.preventDefault()); + }, this.clearInputValue = (t) => { + this.setValue({ + committing: !0, + nativeEvent: t, + origin: "user", + value: "" + }); + }, this.emitChangeIfUserModified = () => { + this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue && (this.calciteInputChange.emit(), this.setPreviousEmittedValue(this.value)); + }, this.inputBlurHandler = () => { + this.calciteInternalInputBlur.emit(), this.emitChangeIfUserModified(); + }, this.clickHandler = (t) => { + const e = HAe(this.el, "action"); + t.target !== e && this.setFocus(); + }, this.inputFocusHandler = () => { + this.calciteInternalInputFocus.emit(); + }, this.inputInputHandler = (t) => { + this.disabled || this.readOnly || this.setValue({ + nativeEvent: t, + origin: "user", + value: t.target.value + }); + }, this.inputKeyDownHandler = (t) => { + this.disabled || this.readOnly || t.key === "Enter" && this.emitChangeIfUserModified(); + }, this.inputNumberInputHandler = (t) => { + if (this.disabled || this.readOnly) + return; + const e = t.target.value; + RA.numberFormatOptions = { + locale: this.effectiveLocale, + numberingSystem: this.numberingSystem, + useGrouping: this.groupSeparator + }; + const i = RA.delocalize(e); + t.inputType === "insertFromPaste" ? (uE(i) || t.preventDefault(), this.setValue({ + nativeEvent: t, + origin: "user", + value: $Ji(i) + }), this.childNumberEl.value = this.localizedValue) : this.setValue({ + nativeEvent: t, + origin: "user", + value: i + }); + }, this.inputNumberKeyDownHandler = (t) => { + if (this.type !== "number" || this.disabled || this.readOnly) + return; + if (t.key === "ArrowUp") { + t.preventDefault(), this.nudgeNumberValue("up", t); + return; + } + if (t.key === "ArrowDown") { + this.nudgeNumberValue("down", t); + return; + } + const e = [ + ...s9e, + "ArrowLeft", + "ArrowRight", + "Backspace", + "Delete", + "Enter", + "Escape", + "Tab" + ]; + if (t.altKey || t.ctrlKey || t.metaKey) + return; + const i = t.shiftKey && t.key === "Tab"; + if (e.includes(t.key) && (!t.shiftKey || i)) { + t.key === "Enter" && this.emitChangeIfUserModified(); + return; + } + RA.numberFormatOptions = { + locale: this.effectiveLocale, + numberingSystem: this.numberingSystem, + useGrouping: this.groupSeparator + }, !(t.key === RA.decimal && (!this.value && !this.childNumberEl.value || this.value && this.childNumberEl.value.indexOf(RA.decimal) === -1)) && (/[eE]/.test(t.key) && (!this.value && !this.childNumberEl.value || this.value && !/[eE]/.test(this.childNumberEl.value)) || t.key === "-" && (!this.value && !this.childNumberEl.value || this.value && this.childNumberEl.value.split("-").length <= 2) || t.preventDefault()); + }, this.nudgeNumberValue = (t, e) => { + if (e instanceof KeyboardEvent && e.repeat || this.type !== "number") + return; + const i = this.maxString ? parseFloat(this.maxString) : null, r = this.minString ? parseFloat(this.minString) : null, n = 150; + this.incrementOrDecrementNumberValue(t, i, r, e), this.nudgeNumberValueIntervalId && window.clearInterval(this.nudgeNumberValueIntervalId); + let s = !0; + this.nudgeNumberValueIntervalId = window.setInterval(() => { + if (s) { + s = !1; + return; + } + this.incrementOrDecrementNumberValue(t, i, r, e); + }, n); + }, this.numberButtonPointerUpAndOutHandler = () => { + window.clearInterval(this.nudgeNumberValueIntervalId); + }, this.numberButtonPointerDownHandler = (t) => { + if (!vQ(t)) + return; + t.preventDefault(); + const e = t.target.dataset.adjustment; + this.disabled || this.nudgeNumberValue(e, t); + }, this.hiddenInputChangeHandler = (t) => { + t.target.name === this.name && this.setValue({ + value: t.target.value, + origin: "direct" + }), t.stopPropagation(); + }, this.setChildElRef = (t) => { + this.childEl = t; + }, this.setChildNumberElRef = (t) => { + this.childNumberEl = t; + }, this.setInputValue = (t) => { + this.type === "text" && !this.childEl || this.type === "number" && !this.childNumberEl || (this[`child${this.type === "number" ? "Number" : ""}El`].value = t); + }, this.setPreviousEmittedValue = (t) => { + this.previousEmittedValue = this.normalizeValue(t); + }, this.setPreviousValue = (t) => { + this.previousValue = this.normalizeValue(t); + }, this.setValue = ({ committing: t = !1, nativeEvent: e, origin: i, previousValue: r, value: n }) => { + if (this.setPreviousValue(r ?? this.value), this.previousValueOrigin = i, this.type === "number") { + RA.numberFormatOptions = { + locale: this.effectiveLocale, + numberingSystem: this.numberingSystem, + useGrouping: this.groupSeparator, + signDisplay: "never" + }; + const s = UJi( + // no need to delocalize a string that ia already in latn numerals + this.numberingSystem && this.numberingSystem !== "latn" || o9e !== "latn" ? RA.delocalize(n) : n + ), o = n && !s ? uE(this.previousValue) ? this.previousValue : "" : s, a = RA.localize(o); + this.localizedValue = a, this.userChangedValue = i === "user" && this.value !== o, this.value = ["-", "."].includes(o) ? "" : o; + } else + this.userChangedValue = i === "user" && this.value !== n, this.value = n; + i === "direct" && (this.setInputValue(n), this.previousEmittedValue = n), e && (this.calciteInputInput.emit().defaultPrevented ? (this.value = this.previousValue, this.localizedValue = this.type === "number" ? RA.localize(this.previousValue) : this.previousValue) : t && this.emitChangeIfUserModified()); + }, this.inputKeyUpHandler = () => { + window.clearInterval(this.nudgeNumberValueIntervalId); + }, this.alignment = "start", this.autofocus = !1, this.clearable = !1, this.disabled = !1, this.groupSeparator = !1, this.hidden = !1, this.icon = void 0, this.iconFlipRtl = !1, this.label = void 0, this.loading = !1, this.numberingSystem = void 0, this.localeFormat = !1, this.max = void 0, this.min = void 0, this.maxLength = void 0, this.minLength = void 0, this.name = void 0, this.numberButtonType = "vertical", this.placeholder = void 0, this.prefixText = void 0, this.readOnly = !1, this.required = !1, this.scale = "m", this.status = "idle", this.step = void 0, this.autocomplete = void 0, this.pattern = void 0, this.accept = void 0, this.multiple = !1, this.inputMode = "text", this.enterKeyHint = void 0, this.suffixText = void 0, this.editingEnabled = !1, this.type = "text", this.value = "", this.messages = void 0, this.messageOverrides = void 0, this.effectiveLocale = "", this.defaultMessages = void 0, this.localizedValue = void 0, this.slottedActionElDisabledInternally = !1; + } + disabledWatcher() { + this.setDisabledAction(); + } + /** watcher to update number-to-string for max */ + maxWatcher() { + this.maxString = this.max?.toString() || null; + } + /** watcher to update number-to-string for min */ + minWatcher() { + this.minString = this.min?.toString() || null; + } + onMessagesChange() { + } + valueWatcher(t, e) { + this.userChangedValue || (this.setValue({ + origin: "direct", + previousValue: e, + value: t == null || t == "" ? "" : this.type === "number" ? uE(t) ? t : this.previousValue || "" : t + }), this.warnAboutInvalidNumberValue(t)), this.userChangedValue = !1; + } + updateRequestedIcon() { + this.requestedIcon = Cde(Oit, this.icon, this.type); + } + get isClearable() { + return !this.isTextarea && (this.clearable || this.type === "search") && this.value.length > 0; + } + get isTextarea() { + return this.childElType === "textarea"; + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + H4(this), X4(this), this.scale = Zze(this.el, "scale", this.scale), this.status = Zze(this.el, "status", this.status), this.inlineEditableEl = this.el.closest("calcite-inline-editable"), this.inlineEditableEl && (this.editingEnabled = this.inlineEditableEl.editingEnabled || !1), N3t(this), iZi(this), this.setPreviousEmittedValue(this.value), this.setPreviousValue(this.value), this.type === "number" && (this.warnAboutInvalidNumberValue(this.value), this.setValue({ + origin: "connected", + value: uE(this.value) ? this.value : "" + })), this.mutationObserver?.observe(this.el, { childList: !0 }), this.setDisabledAction(), this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler); + } + disconnectedCallback() { + uZi(this), nZi(this), W4(this), K4(this), this.mutationObserver?.disconnect(), this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler); + } + async componentWillLoad() { + GI(this), this.childElType = this.type === "textarea" ? "textarea" : "input", this.maxString = this.max?.toString(), this.minString = this.min?.toString(), this.requestedIcon = Cde(Oit, this.icon, this.type), await q4(this); + } + componentDidLoad() { + UI(this); + } + componentShouldUpdate(t, e, i) { + return this.type === "number" && i === "value" && t && !uE(t) ? (this.setValue({ + origin: "reset", + value: e + }), !1) : !0; + } + componentDidRender() { + C8(this); + } + //-------------------------------------------------------------------------- + // + // Public Methods + // + //-------------------------------------------------------------------------- + /** Sets focus on the component. */ + async setFocus() { + await zI(this), this.type === "number" ? this.childNumberEl?.focus() : this.childEl?.focus(); + } + /** Selects all text of the component's `value`. */ + async selectText() { + this.type === "number" ? this.childNumberEl?.select() : this.childEl?.select(); + } + // TODO: refactor so we don't need to sync the internals in color-picker + // https://github.com/Esri/calcite-components/issues/6100 + /** @internal */ + async internalSyncChildElValue() { + this.type === "number" ? this.childNumberEl.value = this.value : this.childEl.value = this.value; + } + onLabelClick() { + this.setFocus(); + } + incrementOrDecrementNumberValue(t, e, i, r) { + const { value: n } = this, s = this.step === "any" ? 1 : Math.abs(this.step || 1), o = n && n !== "" ? parseFloat(n) : 0, l = o + s * (t === "up" ? 1 : -1), c = typeof i == "number" && !isNaN(i) && l < i ? i : typeof e == "number" && !isNaN(e) && l > e ? e : l, h = Pit(o), p = Pit(s); + this.setValue({ + committing: !0, + nativeEvent: r, + origin: "user", + value: c.toFixed(Math.max(h, p)) + }); + } + onFormReset() { + this.setValue({ + origin: "reset", + value: this.defaultValue + }); + } + syncHiddenFormInput(t) { + const { type: e } = this; + t.type = e, e === "number" ? (t.min = this.min?.toString(10) ?? "", t.max = this.max?.toString(10) ?? "") : e === "text" && (this.minLength != null && (t.minLength = this.minLength), this.maxLength != null && (t.maxLength = this.maxLength)); + } + setDisabledAction() { + const t = HAe(this.el, "action"); + t && (this.disabled ? (t.getAttribute("disabled") == null && (this.slottedActionElDisabledInternally = !0), t.setAttribute("disabled", "")) : this.slottedActionElDisabledInternally && (t.removeAttribute("disabled"), this.slottedActionElDisabledInternally = !1)); + } + normalizeValue(t) { + return this.type === "number" ? uE(t) ? t : "" : t; + } + warnAboutInvalidNumberValue(t) { + this.type === "number" && t && !uE(t) && console.warn(`The specified value "${t}" cannot be parsed, or is out of range.`); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + render() { + const t = mie(this.el), e = pr("div", { class: Jy.loader }, pr("calcite-progress", { label: this.messages.loading, type: "indeterminate" })), i = pr("button", { "aria-label": this.messages.clear, class: Jy.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, pr("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })), r = pr("calcite-icon", { class: Jy.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }), n = this.numberButtonType === "horizontal", s = pr("button", { "aria-hidden": "true", class: { + [Jy.numberButtonItem]: !0, + [Jy.buttonItemHorizontal]: n + }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, pr("calcite-icon", { icon: "chevron-up", scale: this.scale === "l" ? "m" : "s" })), o = pr("button", { "aria-hidden": "true", class: { + [Jy.numberButtonItem]: !0, + [Jy.buttonItemHorizontal]: n + }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, pr("calcite-icon", { icon: "chevron-down", scale: this.scale === "l" ? "m" : "s" })), a = pr("div", { class: Jy.numberButtonWrapper }, s, o), l = pr("div", { class: Jy.prefix }, this.prefixText), c = pr("div", { class: Jy.suffix }, this.suffixText), h = this.type === "number" ? pr("input", { accept: this.accept, "aria-label": Ait(this), autocomplete: this.autocomplete, autofocus: this.autofocus ? !0 : null, defaultValue: this.defaultValue, disabled: this.disabled ? !0 : null, enterKeyHint: this.enterKeyHint, inputMode: this.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, multiple: this.multiple, name: void 0, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, pattern: this.pattern, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue }) : null, p = this.type !== "number" ? [ + pr(this.childElType, { accept: this.accept, "aria-label": Ait(this), autocomplete: this.autocomplete, autofocus: this.autofocus ? !0 : null, class: { + [Jy.editingEnabled]: this.editingEnabled, + [Jy.inlineChild]: !!this.inlineEditableEl + }, defaultValue: this.defaultValue, disabled: this.disabled ? !0 : null, enterKeyHint: this.enterKeyHint, inputMode: this.inputMode, max: this.maxString, maxLength: this.maxLength, min: this.minString, minLength: this.minLength, multiple: this.multiple, name: this.name, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeyDownHandler, onKeyUp: this.inputKeyUpHandler, pattern: this.pattern, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? !0 : null, step: this.step, tabIndex: this.disabled || this.inlineEditableEl && !this.editingEnabled ? -1 : null, type: this.type, value: this.value }), + this.isTextarea ? pr("div", { class: Jy.resizeIconWrapper }, pr("calcite-icon", { icon: "chevron-down", scale: this.scale === "l" ? "m" : "s" })) : null + ] : null; + return pr(y3, { onClick: this.clickHandler, onKeyDown: this.keyDownHandler }, pr("div", { class: { [Jy.inputWrapper]: !0, [_si.rtl]: t === "rtl" } }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly ? o : null, this.prefixText ? l : null, pr("div", { class: Jy.wrapper }, h, p, this.isClearable ? i : null, this.requestedIcon ? r : null, this.loading ? e : null), pr("div", { class: Jy.actionWrapper }, pr("slot", { name: mZi.action })), this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly ? a : null, this.suffixText ? c : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly ? s : null, pr(oZi, { component: this }))); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + disabled: ["disabledWatcher"], + max: ["maxWatcher"], + min: ["minWatcher"], + messageOverrides: ["onMessagesChange"], + value: ["valueWatcher"], + icon: ["updateRequestedIcon"], + type: ["updateRequestedIcon"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return gZi; + } +}, [1, "calcite-input", { + alignment: [513], + autofocus: [516], + clearable: [516], + disabled: [516], + groupSeparator: [516, "group-separator"], + hidden: [516], + icon: [520], + iconFlipRtl: [516, "icon-flip-rtl"], + label: [1], + loading: [516], + numberingSystem: [513, "numbering-system"], + localeFormat: [4, "locale-format"], + max: [514], + min: [514], + maxLength: [514, "max-length"], + minLength: [514, "min-length"], + name: [513], + numberButtonType: [513, "number-button-type"], + placeholder: [1], + prefixText: [1, "prefix-text"], + readOnly: [516, "read-only"], + required: [516], + scale: [1537], + status: [1537], + step: [520], + autocomplete: [1], + pattern: [1], + accept: [1], + multiple: [4], + inputMode: [1, "input-mode"], + enterKeyHint: [1, "enter-key-hint"], + suffixText: [1, "suffix-text"], + editingEnabled: [1540, "editing-enabled"], + type: [513], + value: [1025], + messages: [1040], + messageOverrides: [1040], + effectiveLocale: [32], + defaultMessages: [32], + localizedValue: [32], + slottedActionElDisabledInternally: [32], + setFocus: [64], + selectText: [64], + internalSyncChildElValue: [64] +}]); +function h9e() { + if (typeof customElements > "u") + return; + ["calcite-input", "calcite-icon", "calcite-progress"].forEach((e) => { + switch (e) { + case "calcite-input": + customElements.get(e) || customElements.define(e, yZi); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-progress": + customElements.get(e) || Sve(); + break; + } + }); +} +h9e(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const vZi = { + container: "container", + searchIcon: "search-icon" +}, _Zi = { + search: "search", + close: "x" +}, bZi = 250, wZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:flex;inline-size:100%}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.container{display:flex;inline-size:100%;padding:0.5rem}label{position:relative;margin-inline:0.25rem;margin-block:0px;display:flex;inline-size:100%;align-items:center;overflow:hidden}input[type=text]{margin-block-end:0.25rem;inline-size:100%;border-style:none;background-color:transparent;padding-block:0.25rem;font-family:inherit;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);padding-inline-end:0.25rem;padding-inline-start:1.5rem;transition:padding var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing)}input[type=text]::-ms-clear{display:none}calcite-input{inline-size:100%}.search-icon{position:absolute;display:flex;color:var(--calcite-ui-text-2);inset-inline-start:0;transition:inset-inline-start var(--calcite-animation-timing), inset-inline-end var(--calcite-animation-timing), opacity var(--calcite-animation-timing)}input[type=text]:focus{border-color:var(--calcite-ui-brand);outline:2px solid transparent;outline-offset:2px;padding-inline:0.25rem}input[type=text]:focus~.search-icon{inset-inline-start:calc(1rem * -1);opacity:0}.clear-button{display:flex;cursor:pointer;align-items:center;border-width:0px;background-color:transparent;color:var(--calcite-ui-text-2)}.clear-button:hover,.clear-button:focus{color:var(--calcite-ui-text-1)}", xZi = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteFilterChange = ad(this, "calciteFilterChange", 6), this.filter = jfe((t, e = !1) => this.updateFiltered(Sit(this.items, t), e), bZi), this.inputHandler = (t) => { + const e = t.target; + this.value = e.value, this.filter(e.value, !0); + }, this.keyDownHandler = (t) => { + t.key === "Escape" && (this.clear(), t.preventDefault()), t.key === "Enter" && t.preventDefault(); + }, this.clear = () => { + this.value = "", this.filter("", !0), this.setFocus(); + }, this.items = [], this.disabled = !1, this.filteredItems = [], this.placeholder = void 0, this.scale = "m", this.value = "", this.messages = void 0, this.messageOverrides = void 0, this.effectiveLocale = void 0, this.defaultMessages = void 0; + } + watchItemsHandler() { + this.filter(this.value); + } + onMessagesChange() { + } + valueHandler(t) { + this.filter(t); + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + async componentWillLoad() { + GI(this), this.updateFiltered(Sit(this.items, this.value)), await q4(this); + } + connectedCallback() { + H4(this), X4(this); + } + componentDidRender() { + C8(this); + } + disconnectedCallback() { + W4(this), K4(this); + } + componentDidLoad() { + UI(this); + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** Sets focus on the component. */ + async setFocus() { + await zI(this), this.el?.focus(); + } + updateFiltered(t, e = !1) { + this.filteredItems.length = 0, this.filteredItems = this.filteredItems.concat(t), e && this.calciteFilterChange.emit(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + render() { + const { disabled: t, scale: e } = this; + return pr(yNe, null, pr("div", { class: vZi.container }, pr("label", null, pr("calcite-input", { "aria-label": this.messages.label, clearable: !0, disabled: t, icon: _Zi.search, messageOverrides: { clear: this.messages.clear }, onCalciteInputInput: this.inputHandler, onKeyDown: this.keyDownHandler, placeholder: this.placeholder, ref: (i) => { + this.textInput = i; + }, scale: e, type: "text", value: this.value })))); + } + static get delegatesFocus() { + return !0; + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + items: ["watchItemsHandler"], + messageOverrides: ["onMessagesChange"], + value: ["valueHandler"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return wZi; + } +}, [17, "calcite-filter", { + items: [1040], + disabled: [516], + filteredItems: [1040], + placeholder: [1], + scale: [513], + value: [1025], + messages: [1040], + messageOverrides: [1040], + effectiveLocale: [32], + defaultMessages: [32], + setFocus: [64] +}]); +function k3t() { + if (typeof customElements > "u") + return; + ["calcite-filter", "calcite-icon", "calcite-input", "calcite-progress"].forEach((e) => { + switch (e) { + case "calcite-filter": + customElements.get(e) || customElements.define(e, xZi); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-input": + customElements.get(e) || h9e(); + break; + case "calcite-progress": + customElements.get(e) || Sve(); + break; + } + }); +} +k3t(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const SZi = '@charset "UTF-8";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{position:relative;margin-inline:auto;display:none;align-items:center;justify-content:center;opacity:1;min-block-size:var(--calcite-loader-size);font-size:var(--calcite-loader-font-size);stroke:var(--calcite-ui-brand);stroke-width:3;fill:none;transform:scale(1, 1);animation:loader-color-shift calc(var(--calcite-internal-animation-timing-slow) * 2) alternate-reverse infinite linear;padding-block:var(--calcite-loader-padding, 4rem)}:host([scale=s]){--calcite-loader-font-size:var(--calcite-font-size--2);--calcite-loader-size:2rem;--calcite-loader-size-inline:0.75rem}:host([scale=m]){--calcite-loader-font-size:var(--calcite-font-size-0);--calcite-loader-size:4rem;--calcite-loader-size-inline:1rem}:host([scale=l]){--calcite-loader-font-size:var(--calcite-font-size-2);--calcite-loader-size:6rem;--calcite-loader-size-inline:1.5rem}:host([no-padding]){padding-block:0px}:host{display:flex}.loader__text{display:block;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);margin-block-start:calc(var(--calcite-loader-size) + 1.5rem)}.loader__percentage{position:absolute;display:block;text-align:center;color:var(--calcite-ui-text-1);font-size:var(--calcite-loader-font-size);inline-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);line-height:0.25;transform:scale(1, 1)}.loader__svgs{position:absolute;overflow:visible;opacity:1;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);transform:scale(1, 1)}.loader__svg{position:absolute;inset-block-start:0px;transform-origin:center;overflow:visible;inset-inline-start:0;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);animation-iteration-count:infinite;animation-timing-function:linear;animation-name:loader-clockwise}@supports (display: grid){.loader__svg--1{animation-name:loader-offset-1}.loader__svg--2{animation-name:loader-offset-2}.loader__svg--3{animation-name:loader-offset-3}}:host([type=determinate]){animation:none;stroke:var(--calcite-ui-border-3)}:host([type=determinate]) .loader__svg--3{animation:none;stroke:var(--calcite-ui-brand);stroke-dasharray:150.79632;transform:rotate(-90deg);transition:all var(--calcite-internal-animation-timing-fast) linear}:host([inline]){position:relative;margin:0px;animation:none;stroke:currentColor;stroke-width:2;padding-block:0px;block-size:var(--calcite-loader-size-inline);min-block-size:var(--calcite-loader-size-inline);inline-size:var(--calcite-loader-size-inline);margin-inline-end:calc(var(--calcite-loader-size-inline) * 0.5);vertical-align:calc(var(--calcite-loader-size-inline) * -1 * 0.2)}:host([inline]) .loader__svgs{inset-block-start:0px;margin:0px;inset-inline-start:0;inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}:host([inline]) .loader__svg{inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}:host([complete]){opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, transform var(--calcite-internal-animation-timing-medium) linear 1000ms}:host([complete]) .loader__svgs{opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms}:host([complete]) .loader__percentage{color:var(--calcite-ui-brand);transform:scale(1.05, 1.05);transform-origin:center;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear}.loader__svg--1{stroke-dasharray:27.9252444444% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 2.4)}@keyframes loader-offset-1{0%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-83.7757333333%}100%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:-279.2524444444%}}.loader__svg--2{stroke-dasharray:55.8504888889% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.2)}@keyframes loader-offset-2{0%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-97.7383555556%}100%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:-279.2524444444%}}.loader__svg--3{stroke-dasharray:13.9626222222% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.867)}@keyframes loader-offset-3{0%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-76.7944222222%}100%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-color-shift{0%{stroke:var(--calcite-ui-brand)}33%{stroke:var(--calcite-ui-brand-press)}66%{stroke:var(--calcite-ui-brand-hover)}100%{stroke:var(--calcite-ui-brand)}}@keyframes loader-clockwise{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}', CZi = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.inline = !1, this.label = void 0, this.scale = "m", this.type = void 0, this.value = 0, this.text = ""; + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + render() { + const { el: t, inline: e, label: i, scale: r, text: n, type: s, value: o } = this, a = t.id || fie(), l = 0.45, c = e ? this.getInlineSize(r) : this.getSize(r), h = c * l, p = `0 0 ${c} ${c}`, y = s === "determinate", v = 2 * h * Math.PI, x = o / 100 * v, I = v - x, P = Math.floor(o), F = { + "aria-valuenow": P, + "aria-valuemin": 0, + "aria-valuemax": 100, + complete: P === 100 + }, k = { r: h, cx: c / 2, cy: c / 2 }, V = { "stroke-dasharray": `${x} ${I}` }; + return pr(y3, { "aria-label": i, id: a, role: "progressbar", ...y ? F : {} }, pr("div", { class: "loader__svgs" }, pr("svg", { "aria-hidden": "true", class: "loader__svg loader__svg--1", viewBox: p }, pr("circle", { ...k })), pr("svg", { "aria-hidden": "true", class: "loader__svg loader__svg--2", viewBox: p }, pr("circle", { ...k })), pr("svg", { "aria-hidden": "true", class: "loader__svg loader__svg--3", viewBox: p, ...y ? { style: V } : {} }, pr("circle", { ...k }))), n && pr("div", { class: "loader__text" }, n), y && pr("div", { class: "loader__percentage" }, o)); + } + //-------------------------------------------------------------------------- + // + // Private Methods + // + //-------------------------------------------------------------------------- + /** + * Return the proper sizes based on the scale property + * + * @param scale + */ + getSize(t) { + return { + s: 32, + m: 56, + l: 80 + }[t]; + } + getInlineSize(t) { + return { + s: 12, + m: 16, + l: 20 + }[t]; + } + get el() { + return this; + } + static get style() { + return SZi; + } +}, [1, "calcite-loader", { + inline: [516], + label: [1], + scale: [513], + type: [513], + value: [2], + text: [1] +}]); +function J4() { + if (typeof customElements > "u") + return; + ["calcite-loader"].forEach((e) => { + switch (e) { + case "calcite-loader": + customElements.get(e) || customElements.define(e, CZi); + break; + } + }); +} +J4(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Rit = { + scrim: "scrim", + content: "content" +}, TZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{position:absolute;inset:0px;z-index:700;display:flex;block-size:100%;inline-size:100%;flex-direction:column;align-items:stretch}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}.scrim{position:absolute;inset:0px;display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background, var(--calcite-scrim-background-internal))}.content{padding:1rem}", $3t = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.loading = !1, this.messages = void 0, this.messageOverrides = void 0, this.defaultMessages = void 0, this.effectiveLocale = ""; + } + onMessagesChange() { + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + H4(this), X4(this); + } + async componentWillLoad() { + await q4(this); + } + disconnectedCallback() { + W4(this), K4(this); + } + // -------------------------------------------------------------------------- + // + // Render Method + // + // -------------------------------------------------------------------------- + render() { + const { el: t, loading: e, messages: i } = this, r = t.innerHTML.trim().length > 0, n = e ? pr("calcite-loader", { label: i.loading }) : null, s = r ? pr("div", { class: Rit.content }, pr("slot", null)) : null; + return pr("div", { class: Rit.scrim }, n, s); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + messageOverrides: ["onMessagesChange"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return TZi; + } +}, [1, "calcite-scrim", { + loading: [516], + messages: [1040], + messageOverrides: [1040], + defaultMessages: [32], + effectiveLocale: [32] +}]); +function Qie() { + if (typeof customElements > "u") + return; + ["calcite-scrim", "calcite-loader"].forEach((e) => { + switch (e) { + case "calcite-scrim": + customElements.get(e) || customElements.define(e, $3t); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + } + }); +} +Qie(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const mq = { + container: "container", + table: "table", + scrim: "scrim", + tableContainer: "table-container", + sticky: "sticky-pos" +}, EZi = 100, IZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.container{position:relative}.table-container{position:relative;z-index:1;box-sizing:border-box;display:flex;inline-size:100%;flex-direction:column;background-color:transparent}.table-container *{box-sizing:border-box}.table{inline-size:100%}::slotted(calcite-list-item){margin-block-end:1px;--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}::slotted(calcite-list-item:last-child){--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.sticky-pos{position:sticky;inset-block-start:0px;z-index:300}calcite-filter{margin-block-end:1px}", Mit = "calcite-list-item", B3t = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteListFilter = ad(this, "calciteListFilter", 6), this.listItems = [], this.enabledListItems = [], this.mutationObserver = z4("mutation", () => this.updateListItems()), this.handleDefaultSlotChange = (t) => { + g3t(m3t(t)); + }, this.setActiveListItem = () => { + const { enabledListItems: t } = this; + t.some((e) => e.active) || t[0] && (t[0].active = !0); + }, this.updateSelectedItems = jfe(() => { + this.selectedItems = this.enabledListItems.filter((t) => t.selected); + }, EZi), this.updateFilteredItems = jfe(() => { + const { listItems: t, filteredData: e, filterText: i } = this, r = e.map((o) => o.value), n = /* @__PURE__ */ new Set(), s = t?.filter((o) => { + const a = o.parentElement; + a.matches("calcite-list-item-group") && n.add(a); + const c = i ? r.includes(o.value) : !0; + return o.hidden = !c, c; + }) || []; + this.filteredItems = s, n.forEach((o) => { + const a = s.some((c) => o.contains(c)); + if (o.hidden = !a, !a) + return; + const l = o.closest("calcite-list-item"); + l && (l.hidden = !1, s.includes(l) && Array.from(o.querySelectorAll("calcite-list-item")).forEach((c) => c.hidden = !1)); + }), n.clear(); + }), this.handleFilter = (t) => { + t.stopPropagation(); + const { filteredItems: e, value: i } = t.currentTarget; + this.filteredData = e, this.filterText = i, this.updateFilteredItems(), this.calciteListFilter.emit(); + }, this.getItemData = () => this.listItems.map((t) => ({ + label: t.label, + description: t.description, + metadata: t.metadata, + value: t.value + })), this.queryListItems = () => Array.from(this.el.querySelectorAll(Mit)), this.focusRow = (t) => { + const { enabledListItems: e } = this; + t && (e.forEach((i) => i.active = i === t), t.setFocus()); + }, this.isNavigable = (t) => { + const e = t.parentElement?.closest(Mit); + return e ? e.open && this.isNavigable(e) : !0; + }, this.handleListKeydown = (t) => { + const { key: e } = t, i = this.enabledListItems.filter((n) => this.isNavigable(n)), r = i.findIndex((n) => n.active); + if (e === "ArrowDown") { + t.preventDefault(); + const n = r + 1; + i[n] && this.focusRow(i[n]); + } else if (e === "ArrowUp") { + t.preventDefault(); + const n = r - 1; + i[n] && this.focusRow(i[n]); + } else if (e === "Home") { + t.preventDefault(); + const n = i[0]; + n && this.focusRow(n); + } else if (e === "End") { + t.preventDefault(); + const n = i[i.length - 1]; + n && this.focusRow(n); + } + }, this.disabled = !1, this.filterEnabled = !1, this.filteredItems = [], this.filteredData = [], this.filterPlaceholder = void 0, this.filterText = void 0, this.label = void 0, this.loading = !1, this.openable = !1, this.selectedItems = [], this.selectionMode = "none", this.selectionAppearance = "icon", this.dataForFilter = []; + } + handleFilterEnabledChange() { + this.updateListItems(); + } + handleSelectionAppearanceChange() { + this.updateListItems(); + } + handleCalciteInternalFocusPreviousItem(t) { + t.stopPropagation(); + const { enabledListItems: e } = this, r = e.findIndex((n) => n.active) - 1; + e[r] && this.focusRow(e[r]); + } + handleCalciteListItemActive(t) { + const e = t.target, { listItems: i } = this; + i.forEach((r) => { + r.active = r === e; + }); + } + handleCalciteListItemSelect(t) { + const e = t.target, { listItems: i, selectionMode: r } = this; + i.forEach((n) => { + r === "single" && (n.selected = n === e); + }), this.updateSelectedItems(); + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + this.mutationObserver?.observe(this.el, { childList: !0, subtree: !0 }), this.updateListItems(); + } + disconnectedCallback() { + this.mutationObserver?.disconnect(); + } + componentWillLoad() { + GI(this); + } + componentDidRender() { + C8(this); + } + componentDidLoad() { + UI(this); + const { filterEl: t } = this, e = t?.filteredItems; + e && (this.filteredData = e), this.updateFilteredItems(); + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** Sets focus on the component's first focusable element. */ + async setFocus() { + await zI(this), this.enabledListItems.find((t) => t.active)?.setFocus(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + render() { + const { loading: t, label: e, disabled: i, dataForFilter: r, filterEnabled: n, filterPlaceholder: s, filterText: o } = this; + return pr("div", { class: mq.container }, t ? pr("calcite-scrim", { class: mq.scrim, loading: t }) : null, pr("table", { "aria-busy": fx(t), "aria-label": e || "", class: mq.table, onKeyDown: this.handleListKeydown, role: "treegrid" }, n ? pr("thead", null, pr("tr", { class: { [mq.sticky]: !0 } }, pr("th", { colSpan: eKi }, pr("calcite-filter", { "aria-label": s, disabled: t || i, items: r, onCalciteFilterChange: this.handleFilter, placeholder: s, ref: (a) => this.filterEl = a, value: o })))) : null, pr("tbody", { class: mq.tableContainer }, pr("slot", { onSlotchange: this.handleDefaultSlotChange })))); + } + updateListItems() { + const { selectionAppearance: t, selectionMode: e } = this, i = this.queryListItems(); + i.forEach((r) => { + r.selectionAppearance = t, r.selectionMode = e; + }), this.listItems = i, this.enabledListItems = i.filter((r) => !r.disabled), this.filterEnabled && (this.dataForFilter = this.getItemData()), this.setActiveListItem(), this.updateSelectedItems(), this.updateFilteredItems(); + } + get el() { + return this; + } + static get watchers() { + return { + filterEnabled: ["handleFilterEnabledChange"], + selectionMode: ["handleSelectionAppearanceChange"], + selectionAppearance: ["handleSelectionAppearanceChange"] + }; + } + static get style() { + return IZi; + } +}, [1, "calcite-list", { + disabled: [516], + filterEnabled: [516, "filter-enabled"], + filteredItems: [1040], + filteredData: [1040], + filterPlaceholder: [513, "filter-placeholder"], + filterText: [1537, "filter-text"], + label: [1], + loading: [516], + openable: [4], + selectedItems: [1040], + selectionMode: [513, "selection-mode"], + selectionAppearance: [513, "selection-appearance"], + dataForFilter: [32], + setFocus: [64] +}, [[0, "calciteInternalFocusPreviousItem", "handleCalciteInternalFocusPreviousItem"], [0, "calciteInternalListItemActive", "handleCalciteListItemActive"], [0, "calciteInternalListItemSelect", "handleCalciteListItemSelect"]]]); +function V3t() { + if (typeof customElements > "u") + return; + ["calcite-list", "calcite-filter", "calcite-icon", "calcite-input", "calcite-loader", "calcite-progress", "calcite-scrim"].forEach((e) => { + switch (e) { + case "calcite-list": + customElements.get(e) || customElements.define(e, B3t); + break; + case "calcite-filter": + customElements.get(e) || k3t(); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-input": + customElements.get(e) || h9e(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + case "calcite-progress": + customElements.get(e) || Sve(); + break; + case "calcite-scrim": + customElements.get(e) || Qie(); + break; + } + }); +} +V3t(); +const AZi = B3t, PZi = V3t, OZi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteList: AZi, + defineCustomElement: PZi +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const RZi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:flex;flex-direction:column;--calcite-list-item-icon-color:var(--calcite-ui-brand);--calcite-list-item-spacing-indent:1rem}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.container{box-sizing:border-box;display:flex;flex:1 1 0%;background-color:var(--calcite-ui-foreground-1);font-family:var(--calcite-sans-family);padding-inline-start:calc(var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier))}.container *{box-sizing:border-box}.container:hover{cursor:pointer;background-color:var(--calcite-ui-foreground-2)}.container--border-selected{border-inline-start:4px solid var(--calcite-ui-brand)}.container--border-unselected{border-inline-start:4px solid transparent}.nested-container{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}.nested-container--hidden{display:none}.content-container{display:flex;flex:1 1 auto;align-items:stretch;padding:0px;font-family:var(--calcite-sans-family);font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2)}tr,td{outline-color:transparent}tr:focus,td:focus{z-index:300;outline:2px solid var(--calcite-ui-brand)}.content,.custom-content{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}.label,.description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}.label:only-child,.description:only-child{margin:0px;padding-block:0.25rem}.label{color:var(--calcite-ui-text-1)}.description{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}.content-start{justify-content:flex-start}.content-end{justify-content:flex-end}.content-start,.content-end{flex:1 1 auto}.content-container--has-center-content .content-start,.content-container--has-center-content .content-end{flex:0 1 auto}.selection-container{display:flex;padding-inline:0.75rem;color:var(--calcite-list-item-icon-color)}.actions-start,.actions-end,.content-start,.content-end,.selection-container,.open-container{display:flex;align-items:center}.open-container,.selection-container{cursor:pointer}.content-start ::slotted(calcite-icon),.content-end ::slotted(calcite-icon){margin-inline:0.75rem;align-self:center}.actions-start ::slotted(calcite-action),.actions-end ::slotted(calcite-action){align-self:stretch;color:inherit}::slotted(calcite-list-item){border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}[hidden]{display:none}", Uxe = /* @__PURE__ */ new Map(), MZi = "calcite-list", j3t = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteListItemSelect = ad(this, "calciteListItemSelect", 6), this.calciteInternalListItemSelect = ad(this, "calciteInternalListItemSelect", 6), this.calciteInternalListItemActive = ad(this, "calciteInternalListItemActive", 6), this.calciteInternalFocusPreviousItem = ad(this, "calciteInternalFocusPreviousItem", 6), this.handleContentSlotChange = (t) => { + this.hasCustomContent = FW(t); + }, this.handleActionsStartSlotChange = (t) => { + this.hasActionsStart = FW(t); + }, this.handleActionsEndSlotChange = (t) => { + this.hasActionsEnd = FW(t); + }, this.handleContentStartSlotChange = (t) => { + this.hasContentStart = FW(t); + }, this.handleContentEndSlotChange = (t) => { + this.hasContentEnd = FW(t); + }, this.handleDefaultSlotChange = (t) => { + const { parentListEl: e } = this, i = m3t(t); + g3t(i); + const r = !!i.length; + r && e && !e.openable && (e.openable = !0), this.openable = r, r || (this.open = !1); + }, this.toggleOpen = () => { + this.open = !this.open; + }, this.itemClicked = () => { + this.toggleSelected(), this.calciteInternalListItemActive.emit(); + }, this.toggleSelected = () => { + this.disabled || (this.selectionMode !== "none" && (this.selected = !this.selected), this.calciteListItemSelect.emit()); + }, this.handleItemKeyDown = (t) => { + const { key: e } = t, i = t.composedPath(), { containerEl: r, contentEl: n, actionsStartEl: s, actionsEndEl: o, open: a, openable: l } = this, c = [s, n, o].filter(Boolean), h = c.findIndex((p) => i.includes(p)); + if (e === " ") + t.preventDefault(), this.toggleSelected(); + else if (e === "ArrowRight") { + t.preventDefault(); + const p = h + 1; + h === -1 ? !a && l ? (this.open = !0, this.focusCell(null)) : c[0] && this.focusCell(c[0]) : c[h] && c[p] && this.focusCell(c[p]); + } else if (e === "ArrowLeft") { + t.preventDefault(); + const p = h - 1; + h === -1 ? (this.focusCell(null), a && l ? this.open = !1 : this.calciteInternalFocusPreviousItem.emit()) : h === 0 ? (this.focusCell(null), r.focus()) : c[h] && c[p] && this.focusCell(c[p]); + } + }, this.focusCellNull = () => { + this.focusCell(null); + }, this.focusCell = (t, e = !0) => { + const { contentEl: i, actionsStartEl: r, actionsEndEl: n, parentListEl: s } = this; + e && Uxe.set(s, null), [r, i, n].filter(Boolean).forEach((o, a) => { + const l = "tabindex"; + o === t ? (o.setAttribute(l, "0"), e && Uxe.set(s, a)) : o.removeAttribute(l); + }), t?.focus(); + }, this.active = !1, this.description = void 0, this.disabled = !1, this.label = void 0, this.metadata = void 0, this.open = !1, this.setSize = null, this.setPosition = null, this.selected = !1, this.value = void 0, this.selectionMode = null, this.selectionAppearance = null, this.level = null, this.visualLevel = null, this.parentListEl = void 0, this.openable = !1, this.hasActionsStart = !1, this.hasActionsEnd = !1, this.hasCustomContent = !1, this.hasContentStart = !1, this.hasContentEnd = !1; + } + activeHandler(t) { + t || this.focusCell(null, !1); + } + handleSelectedChange(t) { + t && this.calciteInternalListItemSelect.emit(); + } + connectedCallback() { + const { el: t } = this; + this.parentListEl = t.closest(MZi), this.level = dit(t) + 1, this.visualLevel = dit(t, !0), this.setSelectionDefaults(); + } + componentWillLoad() { + GI(this); + } + componentDidLoad() { + UI(this); + } + componentDidRender() { + C8(this, "managed"); + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** Sets focus on the component. */ + async setFocus() { + await zI(this); + const { containerEl: t, contentEl: e, actionsStartEl: i, actionsEndEl: r, parentListEl: n } = this, s = Uxe.get(n); + if (typeof s == "number") { + const o = [i, e, r].filter(Boolean); + o[s] ? this.focusCell(o[s]) : t?.focus(); + return; + } + t?.focus(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + renderSelected() { + const { selected: t, selectionMode: e, selectionAppearance: i } = this; + return e === "none" || i === "border" ? null : pr("td", { class: Fm.selectionContainer, key: "selection-container", onClick: this.itemClicked }, pr("calcite-icon", { icon: t ? e === "multiple" ? m5.selectedMultiple : m5.selectedSingle : m5.unselected, scale: "s" })); + } + renderOpen() { + const { el: t, open: e, openable: i, parentListEl: r } = this, n = mie(t); + return i ? pr("td", { class: Fm.openContainer, key: "open-container", onClick: this.toggleOpen }, pr("calcite-icon", { icon: e ? m5.open : n === "rtl" ? m5.closedRTL : m5.closedLTR, scale: "s" })) : r?.openable ? pr("td", { class: Fm.openContainer, key: "open-container", onClick: this.itemClicked }, pr("calcite-icon", { icon: m5.blank, scale: "s" })) : null; + } + renderActionsStart() { + const { label: t, hasActionsStart: e } = this; + return pr("td", { "aria-label": t, class: Fm.actionsStart, hidden: !e, key: "actions-start-container", ref: (i) => this.actionsStartEl = i, role: "gridcell" }, pr("slot", { name: pq.actionsStart, onSlotchange: this.handleActionsStartSlotChange })); + } + renderActionsEnd() { + const { label: t, hasActionsEnd: e } = this; + return pr("td", { "aria-label": t, class: Fm.actionsEnd, hidden: !e, key: "actions-end-container", ref: (i) => this.actionsEndEl = i, role: "gridcell" }, pr("slot", { name: pq.actionsEnd, onSlotchange: this.handleActionsEndSlotChange })); + } + renderContentStart() { + const { hasContentStart: t } = this; + return pr("div", { class: Fm.contentStart, hidden: !t }, pr("slot", { name: pq.contentStart, onSlotchange: this.handleContentStartSlotChange })); + } + renderCustomContent() { + const { hasCustomContent: t } = this; + return pr("div", { class: Fm.customContent, hidden: !t }, pr("slot", { name: pq.content, onSlotchange: this.handleContentSlotChange })); + } + renderContentEnd() { + const { hasContentEnd: t } = this; + return pr("div", { class: Fm.contentEnd, hidden: !t }, pr("slot", { name: pq.contentEnd, onSlotchange: this.handleContentEndSlotChange })); + } + renderContentProperties() { + const { label: t, description: e, hasCustomContent: i } = this; + return !i && (t || e) ? pr("div", { class: Fm.content, key: "content" }, t ? pr("div", { class: Fm.label, key: "label" }, t) : null, e ? pr("div", { class: Fm.description, key: "description" }, e) : null) : null; + } + renderContentContainer() { + const { description: t, label: e, selectionMode: i, hasCustomContent: r } = this, n = r || !!e || !!t, s = [ + this.renderContentStart(), + this.renderCustomContent(), + this.renderContentProperties(), + this.renderContentEnd() + ]; + return pr("td", { "aria-label": e, class: { + [Fm.contentContainer]: !0, + [Fm.contentContainerSelectable]: i !== "none", + [Fm.contentContainerHasCenterContent]: n + }, key: "content-container", onClick: this.itemClicked, ref: (o) => this.contentEl = o, role: "gridcell" }, s); + } + render() { + const { openable: t, open: e, level: i, setPosition: r, setSize: n, active: s, label: o, selected: a, selectionAppearance: l, selectionMode: c } = this, h = c !== "none" && l === "border", p = h && a, y = h && !a; + return pr(y3, null, pr("tr", { "aria-expanded": t ? fx(e) : null, "aria-label": o, "aria-level": i, "aria-posinset": r, "aria-selected": fx(a), "aria-setsize": n, class: { + [Fm.container]: !0, + [Fm.containerBorderSelected]: p, + [Fm.containerBorderUnselected]: y + }, onFocus: this.focusCellNull, onKeyDown: this.handleItemKeyDown, ref: (v) => this.containerEl = v, role: "row", style: { "--calcite-list-item-spacing-indent-multiplier": `${this.visualLevel}` }, tabIndex: s ? 0 : -1 }, this.renderSelected(), this.renderOpen(), this.renderActionsStart(), this.renderContentContainer(), this.renderActionsEnd()), pr("div", { class: { + [Fm.nestedContainer]: !0, + [Fm.nestedContainerHidden]: t && !e + } }, pr("slot", { onSlotchange: this.handleDefaultSlotChange }))); + } + setSelectionDefaults() { + const { parentListEl: t, selectionMode: e, selectionAppearance: i } = this; + t && (e || (this.selectionMode = t.selectionMode), i || (this.selectionAppearance = t.selectionAppearance)); + } + get el() { + return this; + } + static get watchers() { + return { + active: ["activeHandler"], + selected: ["handleSelectedChange"] + }; + } + static get style() { + return RZi; + } +}, [1, "calcite-list-item", { + active: [4], + description: [1], + disabled: [516], + label: [1], + metadata: [16], + open: [1540], + setSize: [2, "set-size"], + setPosition: [2, "set-position"], + selected: [1540], + value: [8], + selectionMode: [1025, "selection-mode"], + selectionAppearance: [1025, "selection-appearance"], + level: [32], + visualLevel: [32], + parentListEl: [32], + openable: [32], + hasActionsStart: [32], + hasActionsEnd: [32], + hasCustomContent: [32], + hasContentStart: [32], + hasContentEnd: [32], + setFocus: [64] +}]); +function G3t() { + if (typeof customElements > "u") + return; + ["calcite-list-item", "calcite-icon"].forEach((e) => { + switch (e) { + case "calcite-list-item": + customElements.get(e) || customElements.define(e, j3t); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + } + }); +} +G3t(); +const DZi = j3t, FZi = G3t, LZi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteListItem: DZi, + defineCustomElement: FZi +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Dit = /* @__PURE__ */ new Set(); +let S7; +const U3t = { childList: !0 }; +function NZi(t) { + S7 || (S7 = z4("mutation", z3t)), S7.observe(t.el, U3t); +} +function kZi(t) { + Dit.delete(t.el), z3t(S7.takeRecords()), S7.disconnect(); + for (const [e] of Dit.entries()) + S7.observe(e, U3t); +} +function z3t(t) { + t.forEach(({ target: e }) => { + gNe(e); + }); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +var Hfe; +(function(t) { + t.brand = "lightbulb", t.danger = "exclamationMarkTriangle", t.info = "information", t.success = "checkCircle", t.warning = "exclamationMarkTriangle"; +})(Hfe || (Hfe = {})); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const gq = { + title: "title", + message: "message", + link: "link", + actionsEnd: "actions-end" +}, yq = { + actionsEnd: "actions-end", + close: "notice-close", + container: "container", + content: "notice-content", + icon: "notice-icon" +}, $Zi = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([scale=s]){--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .notice-close{padding:0.5rem}:host([scale=m]){--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=l]){--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([width=auto]){--calcite-notice-width:auto}:host([width=half]){--calcite-notice-width:50%}:host([width=full]){--calcite-notice-width:100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}.notice-close{outline-color:transparent}.notice-close:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host{display:flex}:host([open]) .container{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);margin-inline-end:var(--calcite-notice-spacing-token-small)}.notice-content{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}.notice-content:first-of-type:not(:only-child){padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}.notice-close{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}.notice-close:hover,.notice-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.notice-close:active{background-color:var(--calcite-ui-foreground-3)}.actions-end{display:flex;align-self:stretch}:host([kind=brand]) .container{border-color:var(--calcite-ui-brand)}:host([kind=brand]) .container .notice-icon{color:var(--calcite-ui-brand)}:host([kind=info]) .container{border-color:var(--calcite-ui-info)}:host([kind=info]) .container .notice-icon{color:var(--calcite-ui-info)}:host([kind=danger]) .container{border-color:var(--calcite-ui-danger)}:host([kind=danger]) .container .notice-icon{color:var(--calcite-ui-danger)}:host([kind=success]) .container{border-color:var(--calcite-ui-success)}:host([kind=success]) .container .notice-icon{color:var(--calcite-ui-success)}:host([kind=warning]) .container{border-color:var(--calcite-ui-warning)}:host([kind=warning]) .container .notice-icon{color:var(--calcite-ui-warning)}", H3t = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteNoticeClose = ad(this, "calciteNoticeClose", 6), this.calciteNoticeOpen = ad(this, "calciteNoticeOpen", 6), this.close = () => { + this.open = !1, this.calciteNoticeClose.emit(); + }, this.open = !1, this.kind = "brand", this.closable = !1, this.icon = void 0, this.iconFlipRtl = !1, this.scale = "m", this.width = "auto", this.messages = void 0, this.messageOverrides = void 0, this.effectiveLocale = void 0, this.defaultMessages = void 0; + } + onMessagesChange() { + } + updateRequestedIcon() { + this.requestedIcon = Cde(Hfe, this.icon, this.kind); + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + NZi(this), H4(this), X4(this); + } + disconnectedCallback() { + kZi(this), W4(this), K4(this); + } + async componentWillLoad() { + GI(this), this.requestedIcon = Cde(Hfe, this.icon, this.kind), await q4(this); + } + componentDidLoad() { + UI(this); + } + render() { + const { el: t } = this, e = pr("button", { "aria-label": this.messages.close, class: yq.close, onClick: this.close, ref: (r) => this.closeButton = r }, pr("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })), i = HAe(t, gq.actionsEnd); + return pr("div", { class: yq.container }, this.requestedIcon ? pr("div", { class: yq.icon }, pr("calcite-icon", { flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" })) : null, pr("div", { class: yq.content }, pr("slot", { name: gq.title }), pr("slot", { name: gq.message }), pr("slot", { name: gq.link })), i ? pr("div", { class: yq.actionsEnd }, pr("slot", { name: gq.actionsEnd })) : null, this.closable ? e : null); + } + //-------------------------------------------------------------------------- + // + // Public Methods + // + //-------------------------------------------------------------------------- + /** Sets focus on the component's first focusable element. */ + async setFocus() { + await zI(this); + const t = this.el.querySelector("calcite-link"); + !this.closeButton && !t || (t ? t.setFocus() : this.closeButton && this.closeButton.focus()); + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + messageOverrides: ["onMessagesChange"], + icon: ["updateRequestedIcon"], + kind: ["updateRequestedIcon"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return $Zi; + } +}, [1, "calcite-notice", { + open: [1540], + kind: [513], + closable: [516], + icon: [520], + iconFlipRtl: [516, "icon-flip-rtl"], + scale: [513], + width: [513], + messages: [1040], + messageOverrides: [1040], + effectiveLocale: [32], + defaultMessages: [32], + setFocus: [64] +}]); +function W3t() { + if (typeof customElements > "u") + return; + ["calcite-notice", "calcite-icon"].forEach((e) => { + switch (e) { + case "calcite-notice": + customElements.get(e) || customElements.define(e, H3t); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + } + }); +} +W3t(); +const BZi = H3t, VZi = W3t, q3t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteNotice: BZi, + defineCustomElement: VZi +}, Symbol.toStringTag, { value: "Module" })); +function d9e(t) { + if (!t) + return "arial-unicode-ms"; + const e = t.toLowerCase().split(" ").join("-"); + switch (e) { + case "serif": + return "noto-serif"; + case "sans-serif": + return "arial-unicode-ms"; + case "monospace": + return "ubuntu-mono"; + case "fantasy": + return "cabin-sketch"; + case "cursive": + return "redressed"; + default: + return e; + } +} +function jZi(t) { + const e = GZi(t) + UZi(t); + return d9e(t.family) + (e.length > 0 ? e : "-regular"); +} +function GZi(t) { + if (!t.weight) + return ""; + switch (t.weight.toLowerCase()) { + case "bold": + case "bolder": + return "-bold"; + } + return ""; +} +function UZi(t) { + if (!t.style) + return ""; + switch (t.style.toLowerCase()) { + case "italic": + case "oblique": + return "-italic"; + } + return ""; +} +const zxe = new hOt(); +function c4(t) { + if (t == null) + return ["", !1]; + if (!zxe.hasBidiChar(t)) + return [t, !1]; + let e; + return e = zxe.checkContextual(t) === "rtl" ? "IDNNN" : "ICNNN", [zxe.bidiTransform(t, e, "VLYSN"), !0]; +} +let aH = class { + constructor() { + this.setIdentity(); + } + getAngle() { + return (this.rz == null || this.rz === 0 && this.rzCos !== 1 && this.rzSin !== 0) && (this.rz = Math.atan2(this.rzSin, this.rzCos)), this.rz; + } + setIdentity() { + this.tx = 0, this.ty = 0, this.tz = 0, this.s = 1, this.rx = 0, this.ry = 0, this.rz = 0, this.rzCos = 1, this.rzSin = 0; + } + setTranslate(e, i) { + this.tx = e, this.ty = i; + } + setTranslateZ(e) { + this.tz = e; + } + setRotateCS(e, i) { + this.rz = void 0, this.rzCos = e, this.rzSin = i; + } + setRotate(e) { + this.rz = e, this.rzCos = void 0, this.rzSin = void 0; + } + setRotateY(e) { + this.ry = e; + } + setScale(e) { + this.s = e; + } + setMeasure(e) { + this.m = e; + } +}; +const Y3t = 512; +let uy, IMe = class { + constructor(e) { + this._geometry = e; + } + next() { + const e = this._geometry; + return this._geometry = null, e; + } +}; +function p9e(t, e) { + let i, r; + uy || (uy = new Xie(0, 0, 0, 1)), uy.reset(py.Polygon), uy.setPixelMargin(e + 1), uy.setExtent(Y3t); + for (const s of t.rings) + if (s && !(s.length < 3)) { + i = s[0][0], r = -s[0][1], uy.moveTo(i, r); + for (let o = 1; o < s.length; o++) + i = s[o][0], r = -s[o][1], uy.lineTo(i, r); + uy.close(); + } + const n = uy.result(!1); + if (n) { + const s = []; + for (const o of n) { + const a = []; + s.push(a); + for (const l of o) + a.push([l.x, -l.y]); + } + return { rings: s }; + } + return { rings: [] }; +} +function X3t(t, e) { + let i, r; + uy || (uy = new Xie(0, 0, 0, 1)), uy.reset(py.LineString), uy.setPixelMargin(e + 1), uy.setExtent(Y3t); + for (const s of t.paths) + if (s && !(s.length < 2)) { + i = s[0][0], r = -s[0][1], uy.moveTo(i, r); + for (let o = 1; o < s.length; o++) + i = s[o][0], r = -s[o][1], uy.lineTo(i, r); + } + const n = uy.result(!1); + if (n) { + const s = []; + for (const o of n) { + const a = []; + s.push(a); + for (const l of o) + a.push([l.x, -l.y]); + } + return { paths: s }; + } + return { paths: [] }; +} +let zZi = class { + applyColorSubstituition(e, i) { + if (!i) + return e; + this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")); + const { width: r, height: n } = e, s = this._rasterizationCanvas, o = s.getContext("2d"); + e !== s && (s.width = r, s.height = n, o.drawImage(e, 0, 0, r, n)); + const a = o.getImageData(0, 0, r, n).data; + if (i) { + for (const c of i) + if (c && c.oldColor && c.oldColor.length === 4 && c.newColor && c.newColor.length === 4) { + const [h, p, y, v] = c.oldColor, [x, I, P, F] = c.newColor; + if (h === x && p === I && y === P && v === F) + continue; + for (let k = 0; k < a.length; k += 4) + h === a[k] && p === a[k + 1] && y === a[k + 2] && v === a[k + 3] && (a[k] = x, a[k + 1] = I, a[k + 2] = P, a[k + 3] = F); + } + } + const l = new ImageData(a, r, n); + return o.putImageData(l, 0, 0), s; + } + tintImageData(e, i) { + if (!i || i.length < 4) + return e; + this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")); + const { width: r, height: n } = e, s = this._rasterizationCanvas, o = s.getContext("2d"); + e !== s && (s.width = r, s.height = n, o.drawImage(e, 0, 0, r, n)); + const a = o.getImageData(0, 0, r, n), l = new Uint8Array(a.data), c = [i[0] / 255, i[1] / 255, i[2] / 255, i[3] / 255]; + for (let p = 0; p < l.length; p += 4) + l[p + 0] *= c[0], l[p + 1] *= c[1], l[p + 2] *= c[2], l[p + 3] *= c[3]; + const h = new ImageData(new Uint8ClampedArray(l.buffer), r, n); + return o.putImageData(h, 0, 0), s; + } +}; +function K3t(t) { + const e = fi(t); + return HZi(e), e; +} +function J3t(t) { + t && (B0(t) ? t.y = -t.y : za(t) ? Fit(t.rings) : ju(t) ? Fit(t.paths) : Lg(t) && Z3t(t.points)); +} +function Z3t(t) { + if (t) { + const e = t.length; + for (let i = 0; i < e; i++) + t[i][1] = -t[i][1]; + } +} +function Fit(t) { + if (t) + for (const e of t) + Z3t(e); +} +function Q3t(t) { + if (t) + for (let e = t.length - 1; e > 0; --e) + t[e][0] -= t[e - 1][0], t[e][1] -= t[e - 1][1]; +} +function Lit(t) { + if (t) + for (const e of t) + Q3t(e); +} +function eRt(t) { + if (t) { + const e = t.length; + for (let i = 1; i < e; ++i) + t[i][0] += t[i - 1][0], t[i][1] += t[i - 1][1]; + } +} +function Nit(t) { + if (t) + for (const e of t) + eRt(e); +} +function HZi(t) { + t && (za(t) ? Nit(t.rings) : ju(t) ? Nit(t.paths) : Lg(t) && eRt(t.points), J3t(t)); +} +function WZi(t) { + t && (J3t(t), za(t) ? Lit(t.rings) : ju(t) ? Lit(t.paths) : Lg(t) && Q3t(t.points)); +} +function qZi(t) { + if (t) + for (const e of t) + AMe(e); +} +function AMe(t) { + t && t.reverse(); +} +function PMe(t, e, i) { + return [t[0] + (e[0] - t[0]) * i, t[1] + (e[1] - t[1]) * i]; +} +function YZi(t) { + return !(!t || t.length === 0) && t[0][0] === t[t.length - 1][0] && t[0][1] === t[t.length - 1][1]; +} +function iZ(t) { + return t[4]; +} +function C7(t, e) { + t[4] = e; +} +let ere = class { + constructor(e, i, r, n = 0) { + this.isClosed = !1, this.multiPath = null, this.acceptPolygon = i, this.acceptPolyline = r, this.geomUnitsPerPoint = n, this.pathCount = -1, this.pathIndex = -1, this.iteratePath = !1, e && (za(e) ? i && (this.multiPath = e.rings, this.isClosed = !0) : ju(e) ? r && (this.multiPath = e.paths, this.isClosed = !1) : gc(e) && i && (this.multiPath = tRt(e).rings, this.isClosed = !0), this.multiPath && (this.pathCount = this.multiPath.length)), this.internalPlacement = new aH(); + } + next() { + if (!this.multiPath) + return null; + for (; this.iteratePath || this.pathIndex < this.pathCount - 1; ) { + this.iteratePath || this.pathIndex++; + const e = this.processPath(this.multiPath[this.pathIndex]); + if (e) + return e; + } + return this.pathCount = -1, this.pathIndex = -1, this.multiPath = null, null; + } +}, Cve = class { + constructor(e, i, r, n = 0) { + this.isClosed = !1, this.multiPath = null, this.inputGeometries = e, this.acceptPolygon = i, this.acceptPolyline = r, this.geomUnitsPerPoint = n, this.pathCount = -1, this.pathIndex = -1, this.iteratePath = !1; + } + next() { + for (; ; ) { + if (!this.multiPath) { + let e = this.inputGeometries.next(); + for (; e; ) { + if (za(e) ? this.acceptPolygon && (this.multiPath = e.rings, this.isClosed = !0) : ju(e) ? this.acceptPolyline && (this.multiPath = e.paths, this.isClosed = !1) : gc(e) && this.acceptPolygon && (this.multiPath = tRt(e).rings, this.isClosed = !0), this.multiPath) { + this.pathCount = this.multiPath.length, this.pathIndex = -1; + break; + } + e = this.inputGeometries.next(); + } + if (!this.multiPath) + return null; + } + for (; this.iteratePath || this.pathIndex < this.pathCount - 1; ) { + this.iteratePath || this.pathIndex++; + const e = this.processPath(this.multiPath[this.pathIndex]); + if (e) + return e; + } + this.pathCount = -1, this.pathIndex = -1, this.multiPath = null; + } + } +}; +function tRt(t) { + return { rings: [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] }; +} +let iRt = class PX { + static local() { + return PX.instance === null && (PX.instance = new PX()), PX.instance; + } + execute(e, i, r, n, s) { + return new XZi(e, i, r); + } +}; +iRt.instance = null; +let XZi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._angleTolerance = i.angleTolerance !== void 0 ? i.angleTolerance : 120, this._maxCosAngle = Math.cos((1 - Math.abs(this._angleTolerance) / 180) * Math.PI); + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (za(e)) { + this._isClosed = !0; + const i = fi(e); + return this._processMultipath(i.rings), i; + } + if (ju(e)) { + this._isClosed = !1; + const i = fi(e); + return this._processMultipath(i.paths), i; + } + if (gc(e)) { + if (this._maxCosAngle) + return e; + this._isClosed = !0; + const i = [[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]]; + return this._processPath(i), { rings: [i] }; + } + e = this._inputGeometries.next(); + } + return null; + } + _processMultipath(e) { + if (e) + for (const i of e) + this._processPath(i); + } + _processPath(e) { + if (e) { + let i, r, n, s, o, a, l = e.length, c = e[0]; + this._isClosed && ++l; + for (let h = 1; h < l; ++h) { + let p; + p = this._isClosed && h === l - 1 ? e[0] : e[h]; + const y = p[0] - c[0], v = p[1] - c[1], x = Math.sqrt(y * y + v * v); + h > 1 && x > 0 && n > 0 && (i * y + r * v) / x / n <= this._maxCosAngle && C7(c, 1), h === 1 && (s = y, o = v, a = x), x > 0 && (c = p, i = y, r = v, n = x); + } + this._isClosed && n > 0 && a > 0 && (i * s + r * o) / a / n <= this._maxCosAngle && C7(e[0], 1); + } + } +}; +const lte = 0.03; +let T7 = class { + constructor() { + this._path = []; + } + path() { + return this._path; + } + addPath(e, i) { + i || e.reverse(), Array.prototype.push.apply(this._path, e), i || e.reverse(); + } + static mergePath(e, i) { + i && Array.prototype.push.apply(e, i); + } + startPath(e) { + this._path.push(e); + } + lineTo(e) { + this._path.push(e); + } + close() { + const e = this._path; + e.length > 1 && (e[0][0] === e[e.length - 1][0] && e[0][1] === e[e.length - 1][1] || e.push([e[0][0], e[0][1]])); + } +}, A3 = class { + constructor(e = 0, i = !1) { + } + normalize(e) { + const i = Math.sqrt(e[0] * e[0] + e[1] * e[1]); + i !== 0 && (e[0] /= i, e[1] /= i); + } + calculateLength(e, i) { + const r = i[0] - e[0], n = i[1] - e[1]; + return Math.sqrt(r * r + n * n); + } + calculateSegLength(e, i) { + return this.calculateLength(e[i], e[i + 1]); + } + calculatePathLength(e) { + let i = 0; + const r = e ? e.length : 0; + for (let n = 0; n < r - 1; ++n) + i += this.calculateSegLength(e, n); + return i; + } + calculatePathArea(e) { + let i = 0; + const r = e ? e.length : 0; + for (let n = 0; n < r - 1; ++n) + i += (e[n + 1][0] - e[n][0]) * (e[n + 1][1] + e[n][1]); + return i / 2; + } + getCoord2D(e, i, r) { + return [e[0] + (i[0] - e[0]) * r, e[1] + (i[1] - e[1]) * r]; + } + getSegCoord2D(e, i, r) { + return this.getCoord2D(e[i], e[i + 1], r); + } + getAngle(e, i, r) { + const n = i[0] - e[0], s = i[1] - e[1]; + return Math.atan2(s, n); + } + getSegAngle(e, i, r) { + return this.getAngle(e[i], e[i + 1], r); + } + getAngleCS(e, i, r) { + const n = i[0] - e[0], s = i[1] - e[1], o = Math.sqrt(n * n + s * s); + return o > 0 ? [n / o, s / o] : [1, 0]; + } + getSegAngleCS(e, i, r) { + return this.getAngleCS(e[i], e[i + 1], r); + } + cut(e, i, r, n) { + return [r <= 0 ? e[i] : this.getSegCoord2D(e, i, r), n >= 1 ? e[i + 1] : this.getSegCoord2D(e, i, n)]; + } + addSegment(e, i, r) { + r && e.push(i[0]), e.push(i[1]); + } + getSubCurve(e, i, r) { + const n = []; + return this.appendSubCurve(n, e, i, r) ? n : null; + } + appendSubCurve(e, i, r, n) { + const s = i ? i.length - 1 : 0; + let o = 0, a = !0, l = 0; + for (; l < s; ) { + const c = this.calculateSegLength(i, l); + if (c !== 0) { + if (a) { + if (o + c > r) { + const h = (r - o) / c; + let p = 1, y = !1; + o + c >= n && (p = (n - o) / c, y = !0); + const v = this.cut(i, l, h, p); + if (v && this.addSegment(e, v, a), y) + break; + a = !1; + } + } else { + if (o + c > n) { + const h = this.cut(i, l, 0, (n - o) / c); + h && this.addSegment(e, h, a); + break; + } + this.addSegment(e, [i[l], i[l + 1]], a); + } + o += c, ++l; + } else + ++l; + } + return !0; + } + getCIMPointAlong(e, i) { + const r = e ? e.length - 1 : 0; + let n = 0, s = -1; + for (; s < r; ) { + ++s; + const o = this.calculateSegLength(e, s); + if (o !== 0) { + if (n + o > i) { + const a = (i - n) / o; + return this.getCoord2D(e[s], e[s + 1], a); + } + n += o; + } + } + return null; + } + isEmpty(e, i) { + if (!e || e.length <= 1) + return !0; + const r = e ? e.length - 1 : 0; + let n = -1; + for (; n < r; ) + if (++n, e[n + 1][0] !== e[n][0] || e[n + 1][1] !== e[n][1] || i && e[n + 1][2] !== e[n][2]) + return !1; + return !0; + } + offset(e, i, r, n, s) { + if (!e || e.length < 2) + return null; + let o = 0, a = e[o++], l = o; + for (; o < e.length; ) { + const y = e[o]; + y[0] === a[0] && y[1] === a[1] || (o !== l && (e[l] = e[o]), a = e[l++]), o++; + } + const c = e[0][0] === e[l - 1][0] && e[0][1] === e[l - 1][1]; + if (c && --l, l < (c ? 3 : 2)) + return null; + const h = []; + a = c ? e[l - 1] : null; + let p = e[0]; + for (let y = 0; y < l; y++) { + const v = y === l - 1 ? c ? e[0] : null : e[y + 1]; + if (a) + if (v) { + const x = [v[0] - p[0], v[1] - p[1]]; + this.normalize(x); + const I = [p[0] - a[0], p[1] - a[1]]; + this.normalize(I); + const P = I[0] * x[1] - I[1] * x[0], F = I[0] * x[0] + I[1] * x[1]; + if (P === 0 && F === 1) { + p = v; + continue; + } + if (P >= 0 == i <= 0) { + if (F < 1) { + const k = [x[0] - I[0], x[1] - I[1]]; + this.normalize(k); + const V = Math.sqrt((1 + F) / 2); + if (V > 1 / n) { + const j = -Math.abs(i) / V; + h.push([p[0] - k[0] * j, p[1] - k[1] * j]); + } + } + } else + switch (r) { + case fO.Mitered: { + const k = Math.sqrt((1 + F) / 2); + if (k > 0 && 1 / k < n) { + const V = [x[0] - I[0], x[1] - I[1]]; + this.normalize(V); + const j = Math.abs(i) / k; + h.push([p[0] - V[0] * j, p[1] - V[1] * j]); + break; + } + } + case fO.Bevelled: + h.push([p[0] + I[1] * i, p[1] - I[0] * i]), h.push([p[0] + x[1] * i, p[1] - x[0] * i]); + break; + case fO.Rounded: + if (F < 1) { + h.push([p[0] + I[1] * i, p[1] - I[0] * i]); + const k = Math.floor(2.5 * (1 - F)); + if (k > 0) { + const V = 1 / k; + let j = V; + for (let Y = 1; Y < k; Y++, j += V) { + const X = [I[1] * (1 - j) + x[1] * j, -I[0] * (1 - j) - x[0] * j]; + this.normalize(X), h.push([p[0] + X[0] * i, p[1] + X[1] * i]); + } + } + h.push([p[0] + x[1] * i, p[1] - x[0] * i]); + } + break; + case fO.Square: + default: + if (P < 0) + h.push([p[0] + (I[1] + I[0]) * i, p[1] + (I[1] - I[0]) * i]), h.push([p[0] + (x[1] - x[0]) * i, p[1] - (x[0] + x[1]) * i]); + else { + const k = Math.sqrt((1 + Math.abs(F)) / 2), V = [x[0] - I[0], x[1] - I[1]]; + this.normalize(V); + const j = i / k; + h.push([p[0] - V[0] * j, p[1] - V[1] * j]); + } + } + } else { + const x = [p[0] - a[0], p[1] - a[1]]; + this.normalize(x), h.push([p[0] + x[1] * i, p[1] - x[0] * i]); + } + else { + const x = [v[0] - p[0], v[1] - p[1]]; + this.normalize(x), h.push([p[0] + x[1] * i, p[1] - x[0] * i]); + } + a = p, p = v; + } + return h.length < (c ? 3 : 2) ? null : (c && h.push([h[0][0], h[0][1]]), h); + } +}; +const Hxe = 1.7320508075688772, KZi = 5, JZi = p7.OpenEnded; +let rRt = class OX { + static local() { + return OX.instance === null && (OX.instance = new OX()), OX.instance; + } + execute(e, i, r, n, s) { + return new ZZi(e, i, r); + } +}; +rRt.instance = null; +let ZZi = class extends Cve { + constructor(e, i, r) { + super(e, !1, !0), this._curveHelper = new A3(), this._width = (i.width !== void 0 ? i.width : KZi) * r, this._arrowType = i.geometricEffectArrowType !== void 0 ? i.geometricEffectArrowType : i.arrowType !== void 0 ? i.arrowType : JZi, this._offsetFlattenError = lte * r; + } + processPath(e) { + switch (this._arrowType) { + case p7.OpenEnded: + default: + return this._constructSimpleArrow(e, !0); + case p7.Block: + return this._constructSimpleArrow(e, !1); + case p7.Crossed: + return this._constructCrossedArrow(e); + } + } + _constructSimpleArrow(e, i) { + const r = this._curveHelper.calculatePathLength(e); + let n = this._width; + r < 2 * n && (n = r / 2); + const s = this._curveHelper.getSubCurve(e, 0, r - n); + if (!s) + return null; + const o = n / 2; + if (this._curveHelper.isEmpty(s, !1)) + return null; + const a = this._constructOffset(s, -o); + if (!a) + return null; + const l = this._constructOffset(s, o); + if (!l) + return null; + const c = this._constructArrowBasePoint(a, -o / 2); + if (!c) + return null; + const h = this._constructArrowBasePoint(l, o / 2); + if (!h) + return null; + const p = e[e.length - 1]; + i || (this._makeControlPoint(l, !0), this._makeControlPoint(a, !0)); + const y = new T7(); + return y.addPath(l, !0), y.lineTo(h), this._makeControlPoint(y.path()), y.lineTo(p), this._makeControlPoint(y.path()), y.lineTo(c), this._makeControlPoint(y.path()), y.addPath(a, !1), i ? { paths: [y.path()] } : (y.close(), { rings: [y.path()] }); + } + _constructCrossedArrow(e) { + const i = this._curveHelper.calculatePathLength(e); + let r = this._width; + i < r * (1 + Hxe + 1) && (r = i / (1 + Hxe + 1)); + const n = this._curveHelper.getSubCurve(e, 0, i - r * (1 + Hxe)); + if (!n) + return null; + const s = r / 2; + if (this._curveHelper.isEmpty(n, !1)) + return null; + const o = this._constructOffset(n, s); + if (!o) + return null; + const a = this._constructOffset(n, -s); + if (!a) + return null; + const l = this._curveHelper.getSubCurve(e, 0, i - r); + if (!l || this._curveHelper.isEmpty(l, !1)) + return null; + const c = this._constructOffset(l, s); + if (!c) + return null; + const h = this._constructOffset(l, -s); + if (!h) + return null; + const p = c[c.length - 1], y = this._constructArrowBasePoint(c, s / 2); + if (!y) + return null; + const v = h[h.length - 1], x = this._constructArrowBasePoint(h, -s / 2); + if (!x) + return null; + const I = e[e.length - 1]; + this._makeControlPoint(o, !1), this._makeControlPoint(a, !1); + const P = new T7(); + return P.addPath(o, !0), this._makeControlPoint(P.path()), P.lineTo(v), P.lineTo(x), this._makeControlPoint(P.path()), P.lineTo(I), this._makeControlPoint(P.path()), P.lineTo(y), this._makeControlPoint(P.path()), P.lineTo(p), this._makeControlPoint(P.path()), P.addPath(a, !1), { paths: [P.path()] }; + } + _constructOffset(e, i) { + return this._curveHelper.offset(e, i, fO.Rounded, 4, this._offsetFlattenError); + } + _constructArrowBasePoint(e, i) { + if (!e || e.length < 2) + return null; + const r = e[e.length - 2], n = e[e.length - 1], s = [n[0] - r[0], n[1] - r[1]]; + return this._curveHelper.normalize(s), [n[0] + s[1] * i, n[1] - s[0] * i]; + } + _makeControlPoint(e, i = !1) { + C7(i ? e[0] : e[e.length - 1], 1); + } +}, nRt = class RX { + static local() { + return RX.instance === null && (RX.instance = new RX()), RX.instance; + } + execute(e, i, r, n, s) { + return new QZi(e, i, r, n, s); + } +}; +nRt.instance = null; +let QZi = class { + constructor(e, i, r, n, s) { + this._inputGeometries = e, this._tileKey = n, this._geometryEngine = s, this._curveHelper = new A3(), this._size = (i.size !== void 0 ? i.size : 1) * r, this._offsetFlattenError = lte * r; + } + next() { + let e; + for (; e = this._inputGeometries.next(); ) { + if (this._size === 0) + return e; + if (gc(e)) { + if (this._size > 0) { + const n = [[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]], s = this._curveHelper.offset(n, this._size, fO.Rounded, 4, this._offsetFlattenError); + if (s) + return { rings: [s] }; + } else if (this._size < 0 && Math.min(e.xmax - e.xmin, e.ymax - e.ymin) + 2 * this._size > 0) + return { xmin: e.xmin - this._size, xmax: e.xmax + this._size, ymin: e.ymin - this._size, ymax: e.ymax + this._size }; + } + const i = this._geometryEngine; + if (ut(i)) + return null; + let r = e; + if ((!za(e) || !this._tileKey || (r = p9e(e, Math.abs(this._size) + 1), r && r.rings && r.rings.length !== 0)) && (!ju(e) || !this._tileKey || (r = X3t(e, Math.abs(this._size) + 1), r && r.paths && r.paths.length !== 0))) + return i.buffer(or.WebMercator, r, this._size, 1); + } + return null; + } +}, sRt = class MX { + static local() { + return MX.instance === null && (MX.instance = new MX()), MX.instance; + } + execute(e, i, r, n, s) { + return new eQi(e, i, r); + } +}; +sRt.instance = null; +let eQi = class { + constructor(e, i, r) { + this._defaultPointSize = 20, this._inputGeometries = e, this._geomUnitsPerPoint = r, this._rule = i.rule ?? Pl.FullGeometry, this._defaultSize = this._defaultPointSize * r; + } + next() { + let e; + for (; e = this._inputGeometries.next(); ) { + let i; + if (B0(e) ? i = this._processGeom([[[e.x, e.y]]]) : Lg(e) ? i = this._processGeom([e.points]) : ju(e) ? i = this._processGeom(e.paths) : za(e) && (i = this._processGeom(e.rings)), i && i.length) + return { paths: i }; + } + return null; + } + _clone(e) { + return [e[0], e[1]]; + } + _mid(e, i) { + return [(e[0] + i[0]) / 2, (e[1] + i[1]) / 2]; + } + _mix(e, i, r, n) { + return [e[0] * i + r[0] * n, e[1] * i + r[1] * n]; + } + _add(e, i) { + return [e[0] + i[0], e[1] + i[1]]; + } + _add2(e, i, r) { + return [e[0] + i, e[1] + r]; + } + _sub(e, i) { + return [e[0] - i[0], e[1] - i[1]]; + } + _dist(e, i) { + return Math.sqrt((e[0] - i[0]) * (e[0] - i[0]) + (e[1] - i[1]) * (e[1] - i[1])); + } + _norm(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1]); + } + _normalize(e, i = 1) { + const r = i / this._norm(e); + e[0] *= r, e[1] *= r; + } + _leftPerpendicular(e) { + const i = -e[1], r = e[0]; + e[0] = i, e[1] = r; + } + _leftPerp(e) { + return [-e[1], e[0]]; + } + _rightPerpendicular(e) { + const i = e[1], r = -e[0]; + e[0] = i, e[1] = r; + } + _rightPerp(e) { + return [e[1], -e[0]]; + } + _dotProduct(e, i) { + return e[0] * i[0] + e[1] * i[1]; + } + _crossProduct(e, i) { + return e[0] * i[1] - e[1] * i[0]; + } + _rotateDirect(e, i, r) { + const n = e[0] * i - e[1] * r, s = e[0] * r + e[1] * i; + e[0] = n, e[1] = s; + } + _makeCtrlPt(e) { + const i = [e[0], e[1]]; + return C7(i, 1), i; + } + _addAngledTicks(e, i, r, n) { + const s = this._sub(r, i); + this._normalize(s); + const o = this._crossProduct(s, this._sub(n, i)); + let a; + a = o > 0 ? this._rightPerp(s) : this._leftPerp(s); + const l = Math.abs(o) / 2, c = []; + c.push([i[0] + (a[0] - s[0]) * l, i[1] + (a[1] - s[1]) * l]), c.push(i), c.push(r), c.push([r[0] + (a[0] + s[0]) * l, r[1] + (a[1] + s[1]) * l]), e.push(c); + } + _addBezier2(e, i, r, n, s) { + if (s-- == 0) + return void e.push(n); + const o = this._mid(i, r), a = this._mid(r, n), l = this._mid(o, a); + this._addBezier2(e, i, o, l, s), this._addBezier2(e, l, a, n, s); + } + _addBezier3(e, i, r, n, s, o) { + if (o-- == 0) + return void e.push(s); + const a = this._mid(i, r), l = this._mid(r, n), c = this._mid(n, s), h = this._mid(a, l), p = this._mid(l, c), y = this._mid(h, p); + this._addBezier3(e, i, a, h, y, o), this._addBezier3(e, y, p, c, s, o); + } + _add90DegArc(e, i, r, n, s) { + const o = s ?? this._crossProduct(this._sub(r, i), this._sub(n, i)) > 0, a = this._mid(i, r), l = this._sub(a, i); + o ? this._leftPerpendicular(l) : this._rightPerpendicular(l), a[0] += l[0], a[1] += l[1], this._addBezier3(e, i, this._mix(i, 0.33333, a, 0.66667), this._mix(r, 0.33333, a, 0.66667), r, 4); + } + _addArrow(e, i, r) { + const n = i[0], s = i[1], o = i[i.length - 1], a = this._sub(n, s); + this._normalize(a); + const l = this._crossProduct(a, this._sub(o, s)), c = 0.5 * l, h = this._leftPerp(a), p = [o[0] - h[0] * l, o[1] - h[1] * l], y = i.length - 1, v = []; + v.push(r ? [-h[0], -h[1]] : h); + let x = [-a[0], -a[1]]; + for (let I = 1; I < y - 1; I++) { + const P = this._sub(i[I + 1], i[I]); + this._normalize(P); + const F = this._dotProduct(P, x), k = this._crossProduct(P, x), V = Math.sqrt((1 + F) / 2), j = this._sub(P, x); + this._normalize(j), j[0] /= V, j[1] /= V, v.push(k < 0 ? [-j[0], -j[1]] : j), x = P; + } + v.push(this._rightPerp(x)); + for (let I = v.length - 1; I > 0; I--) + e.push([i[I][0] + v[I][0] * c, i[I][1] + v[I][1] * c]); + e.push([p[0] + v[0][0] * c, p[1] + v[0][1] * c]), e.push([p[0] + v[0][0] * l, p[1] + v[0][1] * l]), e.push(n), e.push([p[0] - v[0][0] * l, p[1] - v[0][1] * l]), e.push([p[0] - v[0][0] * c, p[1] - v[0][1] * c]); + for (let I = 1; I < v.length; I++) + e.push([i[I][0] - v[I][0] * c, i[I][1] - v[I][1] * c]); + } + _cp2(e, i, r) { + return e.length >= 2 ? e[1] : this._add2(e[0], i * this._defaultSize, r * this._defaultSize); + } + _cp3(e, i, r, n) { + if (e.length >= 3) + return e[2]; + const s = this._mix(e[0], 1 - r, i, r), o = this._sub(i, e[0]); + return this._normalize(o), this._rightPerpendicular(o), [s[0] + o[0] * n * this._defaultSize, s[1] + o[1] * n * this._defaultSize]; + } + _arrowPath(e) { + if (e.length > 2) + return e; + const i = e[0], r = this._cp2(e, -4, 0), n = this._sub(i, r); + this._normalize(n); + const s = this._rightPerp(n); + return [i, r, [i[0] + (s[0] - n[0]) * this._defaultSize, i[1] + (s[1] - n[1]) * this._defaultSize]]; + } + _arrowLastSeg(e) { + const i = e[0], r = this._cp2(e, -4, 0); + let n; + if (e.length >= 3) + n = e[e.length - 1]; + else { + const s = this._sub(i, r); + this._normalize(s); + const o = this._rightPerp(s); + n = [i[0] + (o[0] - s[0]) * this._defaultSize, i[1] + (o[1] - s[1]) * this._defaultSize]; + } + return [r, n]; + } + _processGeom(e) { + if (!e) + return null; + const i = []; + for (const r of e) { + if (!r || r.length === 0) + continue; + const n = r.length; + let s = r[0]; + switch (this._rule) { + case Pl.PerpendicularFromFirstSegment: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 4), l = []; + l.push(a), l.push(this._mid(s, o)), i.push(l); + break; + } + case Pl.ReversedFirstSegment: { + const o = this._cp2(r, 0, -1); + i.push([o, s]); + break; + } + case Pl.PerpendicularToSecondSegment: { + const o = this._cp2(r, -4, 1), a = this._cp3(r, o, 0.882353, -1.94), l = []; + l.push(this._mid(o, a)), l.push(s), i.push(l); + break; + } + case Pl.SecondSegmentWithTicks: { + const o = this._cp2(r, -4, 1), a = this._cp3(r, o, 0.882353, -1.94), l = this._sub(a, o); + let c; + c = this._crossProduct(l, this._sub(s, o)) > 0 ? this._rightPerp(c) : this._leftPerp(l); + const h = []; + h.push([o[0] + (c[0] - l[0]) / 3, o[1] + (c[1] - l[1]) / 3]), h.push(o), h.push(a), h.push([a[0] + (c[0] + l[0]) / 3, a[1] + (c[1] + l[1]) / 3]), i.push(h); + break; + } + case Pl.DoublePerpendicular: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 3), l = this._mid(s, o), c = this._sub(l, a); + this._normalize(c); + const h = this._crossProduct(c, this._sub(s, a)); + this._leftPerpendicular(c); + const p = []; + p.push(s), p.push([a[0] + c[0] * h, a[1] + c[1] * h]), i.push(p); + const y = []; + y.push([a[0] - c[0] * h, a[1] - c[1] * h]), y.push(o), i.push(y); + break; + } + case Pl.OppositeToFirstSegment: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 3), l = this._mid(s, o), c = this._sub(l, a); + this._normalize(c); + const h = this._crossProduct(c, this._sub(s, a)); + this._leftPerpendicular(c); + const p = []; + p.push([a[0] + c[0] * h, a[1] + c[1] * h]), p.push([a[0] - c[0] * h, a[1] - c[1] * h]), i.push(p); + break; + } + case Pl.TriplePerpendicular: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 4), l = this._mid(s, o), c = this._sub(l, a); + this._normalize(c); + const h = this._crossProduct(c, this._sub(s, a)); + this._leftPerpendicular(c); + const p = []; + p.push([a[0] + c[0] * h * 0.8, a[1] + c[1] * h * 0.8]), p.push([l[0] + 0.8 * (s[0] - l[0]), l[1] + 0.8 * (s[1] - l[1])]), i.push(p), i.push([a, l]); + const y = []; + y.push([a[0] - c[0] * h * 0.8, a[1] - c[1] * h * 0.8]), y.push([l[0] + 0.8 * (o[0] - l[0]), l[1] + 0.8 * (o[1] - l[1])]), i.push(y); + break; + } + case Pl.HalfCircleFirstSegment: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 4), l = this._mid(s, o); + let c = this._sub(o, s); + const h = Math.cos(Math.PI / 18), p = Math.sin(Math.PI / 18), y = Math.sqrt((1 + h) / 2), v = Math.sqrt((1 - h) / 2), x = []; + let I; + this._crossProduct(c, this._sub(a, s)) > 0 ? (x.push(s), c = this._sub(s, l), I = o) : (x.push(o), c = this._sub(o, l), I = s), this._rotateDirect(c, y, v), c[0] /= y, c[1] /= y; + for (let P = 1; P <= 18; P++) + x.push(this._add(l, c)), this._rotateDirect(c, h, p); + x.push(I), i.push(x); + break; + } + case Pl.HalfCircleSecondSegment: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 1, -1); + let l = this._sub(s, o); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, o)) / 2; + this._leftPerpendicular(l); + const h = [o[0] + l[0] * c, o[1] + l[1] * c]; + l = this._sub(o, h); + const p = Math.cos(Math.PI / 18); + let y = Math.sin(Math.PI / 18); + c > 0 && (y = -y); + const v = [o]; + for (let x = 1; x <= 18; x++) + this._rotateDirect(l, p, y), v.push(this._add(h, l)); + i.push(v); + break; + } + case Pl.HalfCircleExtended: { + const o = this._cp2(r, 0, -2), a = this._cp3(r, o, 1, -1); + let l; + if (n >= 4) + l = r[3]; + else { + const x = this._sub(s, o); + l = this._add(a, x); + } + const c = this._dist(o, a) / 2 / 0.75, h = this._sub(o, s); + this._normalize(h, c); + const p = this._sub(a, l); + this._normalize(p, c); + const y = [l, a]; + i.push(y); + const v = [this._clone(a)]; + this._addBezier3(v, a, this._add(a, p), this._add(o, h), o, 4), v.push(s), i.push(v); + break; + } + case Pl.OpenCircle: { + const o = this._cp2(r, -2, 0), a = this._sub(o, s), l = Math.cos(Math.PI / 18), c = -Math.sin(Math.PI / 18), h = [o]; + for (let p = 1; p <= 33; p++) + this._rotateDirect(a, l, c), h.push(this._add(s, a)); + i.push(h); + break; + } + case Pl.CoverageEdgesWithTicks: { + const o = this._cp2(r, 0, -1); + let a, l; + if (n >= 3) + a = r[2]; + else { + const y = this._sub(o, s), v = this._leftPerp(y); + a = [s[0] + v[0] - 0.25 * y[0], s[1] + v[1] - 0.25 * y[1]]; + } + if (n >= 4) + l = r[3]; + else { + const y = this._mid(s, o), v = this._sub(s, o); + this._normalize(v), this._leftPerpendicular(v); + const x = this._crossProduct(v, this._sub(a, y)); + this._rightPerpendicular(v), l = [a[0] + v[0] * x * 2, a[1] + v[1] * x * 2]; + } + const c = this._sub(o, s); + let h, p; + h = this._crossProduct(c, this._sub(a, s)) > 0 ? this._rightPerp(c) : this._leftPerp(c), p = [], p.push(a), p.push(s), p.push([s[0] + (h[0] - c[0]) / 3, s[1] + (h[1] - c[1]) / 3]), i.push(p), h = this._crossProduct(c, this._sub(l, o)) > 0 ? this._rightPerp(h) : this._leftPerp(c), p = [], p.push([o[0] + (h[0] + c[0]) / 3, o[1] + (h[1] + c[1]) / 3]), p.push(o), p.push(l), i.push(p); + break; + } + case Pl.GapExtentWithDoubleTicks: { + const o = this._cp2(r, 0, 2), a = this._cp3(r, o, 0, 1); + let l; + if (n >= 4) + l = r[3]; + else { + const c = this._sub(o, s); + l = this._add(a, c); + } + this._addAngledTicks(i, s, o, this._mid(a, l)), this._addAngledTicks(i, a, l, this._mid(s, o)); + break; + } + case Pl.GapExtentMidline: { + const o = this._cp2(r, 2, 0), a = this._cp3(r, o, 0, 1); + let l; + if (n >= 4) + l = r[3]; + else { + const h = this._sub(o, s); + l = this._add(a, h); + } + const c = []; + c.push(this._mid(s, a)), c.push(this._mid(o, l)), i.push(c); + break; + } + case Pl.Chevron: { + const o = this._cp2(r, -1, -1); + let a; + if (n >= 3) + a = r[2]; + else { + const l = this._sub(o, s); + this._leftPerpendicular(l), a = this._add(s, l); + } + i.push([o, this._makeCtrlPt(s), a]); + break; + } + case Pl.PerpendicularWithArc: { + const o = this._cp2(r, 0, -2), a = this._cp3(r, o, 0.5, -1); + let l = this._sub(o, s); + const c = this._norm(l); + l[0] /= c, l[1] /= c; + const h = this._crossProduct(l, this._sub(a, s)); + let p = this._dotProduct(l, this._sub(a, s)); + p < 0.05 * c ? p = 0.05 * c : p > 0.95 * c && (p = 0.95 * c); + const y = [s[0] + l[0] * p, s[1] + l[1] * p]; + this._leftPerpendicular(l); + let v = []; + v.push([y[0] - l[0] * h, y[1] - l[1] * h]), v.push([y[0] + l[0] * h, y[1] + l[1] * h]), i.push(v); + const x = [o[0] + l[0] * h, o[1] + l[1] * h]; + l = this._sub(o, x); + const I = Math.cos(Math.PI / 18); + let P = Math.sin(Math.PI / 18); + h < 0 && (P = -P), v = [s, o]; + for (let F = 1; F <= 9; F++) + this._rotateDirect(l, I, P), v.push(this._add(x, l)); + i.push(v); + break; + } + case Pl.ClosedHalfCircle: { + const o = this._cp2(r, 2, 0), a = this._mid(s, o), l = this._sub(o, a), c = Math.cos(Math.PI / 18), h = Math.sin(Math.PI / 18), p = [s, o]; + for (let y = 1; y <= 18; y++) + this._rotateDirect(l, c, h), p.push(this._add(a, l)); + i.push(p); + break; + } + case Pl.TripleParallelExtended: { + const o = this._cp2(r, 0, -2), a = this._cp3(r, o, 1, -2), l = this._mid(s, o), c = this._sub(a, o); + this._normalize(c); + const h = Math.abs(this._crossProduct(c, this._sub(l, o))) / 2, p = this._dist(o, a), y = [o, s]; + y.push([s[0] + c[0] * p * 0.5, s[1] + c[1] * p * 0.5]), i.push(y); + const v = []; + v.push([l[0] - c[0] * h, l[1] - c[1] * h]), v.push([l[0] + c[0] * p * 0.375, l[1] + c[1] * p * 0.375]), C7(v[v.length - 1], 1), v.push([l[0] + c[0] * p * 0.75, l[1] + c[1] * p * 0.75]), i.push(v); + const x = [o, a]; + i.push(x); + break; + } + case Pl.ParallelWithTicks: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._sub(a, o); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, s)); + this._leftPerpendicular(l), this._addAngledTicks(i, s, o, a), this._addAngledTicks(i, this._mix(s, 1, l, c), this._mix(o, 1, l, c), this._mid(s, o)); + break; + } + case Pl.Parallel: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._sub(o, s); + this._normalize(l); + const c = this._leftPerp(l), h = this._crossProduct(l, this._sub(a, s)); + let p = [s, o]; + i.push(p), p = [], p.push([s[0] + c[0] * h, s[1] + c[1] * h]), p.push([o[0] + c[0] * h, o[1] + c[1] * h]), i.push(p); + break; + } + case Pl.PerpendicularToFirstSegment: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._mid(s, o), c = this._sub(o, s); + this._normalize(c); + const h = this._crossProduct(c, this._sub(a, s)); + this._leftPerpendicular(c); + const p = []; + p.push([l[0] - c[0] * h * 0.25, l[1] - c[1] * h * 0.25]), p.push([l[0] + c[0] * h * 1.25, l[1] + c[1] * h * 1.25]), i.push(p); + break; + } + case Pl.ParallelOffset: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._sub(o, s); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, s)); + this._leftPerpendicular(l); + const h = []; + h.push([s[0] - l[0] * c, s[1] - l[1] * c]), h.push([o[0] - l[0] * c, o[1] - l[1] * c]), i.push(h); + const p = []; + p.push([s[0] + l[0] * c, s[1] + l[1] * c]), p.push([o[0] + l[0] * c, o[1] + l[1] * c]), i.push(p); + break; + } + case Pl.OffsetOpposite: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._sub(o, s); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, s)); + this._leftPerpendicular(l); + const h = []; + h.push([s[0] - l[0] * c, s[1] - l[1] * c]), h.push([o[0] - l[0] * c, o[1] - l[1] * c]), i.push(h); + break; + } + case Pl.OffsetSame: { + const o = this._cp2(r, 3, 0), a = this._cp3(r, o, 0.5, -1), l = this._sub(o, s); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, s)); + this._leftPerpendicular(l); + const h = []; + h.push([s[0] + l[0] * c, s[1] + l[1] * c]), h.push([o[0] + l[0] * c, o[1] + l[1] * c]), i.push(h); + break; + } + case Pl.CircleWithArc: { + let o = this._cp2(r, 3, 0); + const a = this._cp3(r, o, 0.5, -1); + let l, c; + if (n >= 4) + l = r[3], c = this._crossProduct(this._sub(l, o), this._sub(a, o)) > 0; + else { + l = o, c = this._crossProduct(this._sub(l, s), this._sub(a, s)) > 0; + const x = 24 * this._geomUnitsPerPoint, I = this._sub(l, s); + this._normalize(I, x); + const P = Math.sqrt(2) / 2; + this._rotateDirect(I, P, c ? P : -P), o = this._add(s, I); + } + const h = this._sub(o, s), p = Math.cos(Math.PI / 18), y = Math.sin(Math.PI / 18), v = [o]; + for (let x = 1; x <= 36; x++) + this._rotateDirect(h, p, y), v.push(this._add(s, h)); + this._add90DegArc(v, o, l, a, c), C7(v[v.length - 8], 1), i.push(v); + break; + } + case Pl.DoubleJog: { + let o, a, l = this._cp2(r, -3, 1); + if (o = n >= 3 ? r[2] : this._add(s, this._sub(s, l)), n >= 4) + a = r[3]; + else { + const F = s; + s = l, a = o; + const k = this._dist(s, F), V = this._dist(a, F); + let j = 30 * this._geomUnitsPerPoint; + 0.5 * k < j && (j = 0.5 * k), 0.5 * V < j && (j = 0.5 * V), l = this._mix(s, j / k, F, (k - j) / k), o = this._mix(a, j / V, F, (V - j) / V); + } + const c = this._mid(s, l), h = this._mid(a, o), p = this._dist(s, l), y = this._dist(o, a); + let v = Math.min(p, y) / 8; + v = Math.min(v, 24 * this._geomUnitsPerPoint); + const x = Math.cos(Math.PI / 4); + let I = this._sub(s, l); + this._normalize(I, v), this._crossProduct(I, this._sub(a, l)) > 0 ? this._rotateDirect(I, x, -x) : this._rotateDirect(I, x, x); + let P = []; + P.push(l), P.push(this._add(c, I)), P.push(this._sub(c, I)), P.push(s), i.push(P), I = this._sub(a, o), this._normalize(I, v), this._crossProduct(I, this._sub(s, o)) < 0 ? this._rotateDirect(I, x, x) : this._rotateDirect(I, x, -x), P = [], P.push(o), P.push(this._add(h, I)), P.push(this._sub(h, I)), P.push(a), i.push(P); + break; + } + case Pl.PerpendicularOffset: { + const o = this._cp2(r, -4, 1), a = this._cp3(r, o, 0.882353, -1.94), l = this._sub(a, o); + this._crossProduct(l, this._sub(s, o)) > 0 ? this._rightPerpendicular(l) : this._leftPerpendicular(l); + const c = [l[0] / 8, l[1] / 8], h = this._sub(this._mid(o, a), c); + i.push([h, s]); + break; + } + case Pl.LineExcludingLastSegment: { + const o = this._arrowPath(r), a = []; + let l = o.length - 2; + for (; l--; ) + a.push(o[l]); + i.push(a); + break; + } + case Pl.MultivertexArrow: { + const o = this._arrowPath(r), a = []; + this._addArrow(a, o, !1), i.push(a); + break; + } + case Pl.CrossedArrow: { + const o = this._arrowPath(r), a = []; + this._addArrow(a, o, !0), i.push(a); + break; + } + case Pl.ChevronArrow: { + const [o, a] = this._arrowLastSeg(r), l = 10 * this._geomUnitsPerPoint, c = this._sub(s, o); + this._normalize(c); + const h = this._crossProduct(c, this._sub(a, o)), p = this._leftPerp(c), y = [a[0] - p[0] * h * 2, a[1] - p[1] * h * 2], v = []; + v.push([a[0] + c[0] * l, a[1] + c[1] * l]), v.push(s), v.push([y[0] + c[0] * l, y[1] + c[1] * l]), i.push(v); + break; + } + case Pl.ChevronArrowOffset: { + const [o, a] = this._arrowLastSeg(r), l = this._sub(s, o); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, o)); + this._leftPerpendicular(l); + const h = [a[0] - l[0] * c, a[1] - l[1] * c], p = []; + p.push([h[0] + l[0] * c * 0.5, h[1] + l[1] * c * 0.5]), p.push(this._mid(h, s)), p.push([h[0] - l[0] * c * 0.5, h[1] - l[1] * c * 0.5]), i.push(p); + break; + } + case Pl.PartialFirstSegment: { + const [o, a] = this._arrowLastSeg(r), l = this._sub(s, o); + this._normalize(l); + const c = this._crossProduct(l, this._sub(a, o)); + this._leftPerpendicular(l); + const h = [a[0] - l[0] * c, a[1] - l[1] * c]; + i.push([o, h]); + break; + } + case Pl.Arch: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 1), l = this._sub(s, o), c = this._mix(a, 1, l, 0.55), h = this._mix(a, 1, l, -0.55), p = [s]; + this._addBezier2(p, s, c, a, 4), this._addBezier2(p, a, h, o, 4), i.push(p); + break; + } + case Pl.CurvedParallelTicks: { + const o = this._cp2(r, -4, 1), a = this._cp3(r, o, 0.882353, -1.94), l = this._sub(a, o); + this._crossProduct(l, this._sub(s, o)) > 0 ? this._rightPerpendicular(l) : this._leftPerpendicular(l); + const c = [l[0] / 8, l[1] / 8], h = this._sub(this._mid(o, a), c), p = this._sub(this._mix(o, 0.75, a, 0.25), c), y = this._sub(this._mix(o, 0.25, a, 0.75), c), v = [o]; + this._addBezier2(v, o, p, h, 3), this._addBezier2(v, h, y, a, 3), i.push(v); + for (let x = 0; x < 8; x++) { + const I = v[2 * x + 1], P = [this._clone(I)]; + P.push(this._add(I, [l[0] / 4, l[1] / 4])), i.push(P); + } + break; + } + case Pl.Arc90Degrees: { + const o = this._cp2(r, 0, -1), a = this._cp3(r, o, 0.5, 1), l = [o]; + this._add90DegArc(l, o, s, a), i.push(l); + break; + } + case Pl.FullGeometry: + default: + i.push(r); + } + } + return i; + } +}, oRt = class DX { + static local() { + return DX.instance === null && (DX.instance = new DX()), DX.instance; + } + execute(e, i, r, n, s) { + return new tQi(e, i, r); + } +}; +oRt.instance = null; +let tQi = class extends Cve { + constructor(e, i, r) { + super(e, !0, !0), this._curveHelper = new A3(), this._beginCut = (i.beginCut !== void 0 ? i.beginCut : 1) * r, this._endCut = (i.endCut !== void 0 ? i.endCut : 1) * r, this._middleCut = (i.middleCut !== void 0 ? i.middleCut : 0) * r, this._invert = i.invert !== void 0 && i.invert, this._beginCut < 0 && (this._beginCut = 0), this._endCut < 0 && (this._endCut = 0), this._middleCut < 0 && (this._middleCut = 0); + } + processPath(e) { + const i = this._beginCut, r = this._endCut, n = this._middleCut, s = this._curveHelper.calculatePathLength(e), o = []; + if (this._invert) { + if (!(i === 0 && r === 0 && n === 0)) + if (i + r + n >= s) + o.push(e); + else { + let a = this._curveHelper.getSubCurve(e, 0, i); + a && o.push(a), a = this._curveHelper.getSubCurve(e, 0.5 * (s - n), 0.5 * (s + n)), a && o.push(a), a = this._curveHelper.getSubCurve(e, s - r, r), a && o.push(a); + } + } else if (i === 0 && r === 0 && n === 0) + o.push(e); + else if (!(i + r + n >= s)) + if (n === 0) { + const a = this._curveHelper.getSubCurve(e, i, s - r); + a && o.push(a); + } else { + let a = this._curveHelper.getSubCurve(e, i, 0.5 * (s - n)); + a && o.push(a), a = this._curveHelper.getSubCurve(e, 0.5 * (s + n), s - r), a && o.push(a); + } + return o.length === 0 ? null : { paths: o }; + } +}; +const kit = 1e-7; +let Tve = class { + constructor() { + this._values = [], this.extPtGap = 0, this.ctrlPtGap = 0, this._length = 0, this._currentValue = 0; + } + isEmpty() { + return this._values.length === 0; + } + size() { + return this._values.length; + } + init(e, i, r = !0) { + if (this._setEmpty(), !e || e.length === 0) + return !1; + for (let n = 0; n < e.length; n++) { + let s = Math.abs(e[n]); + r && s < kit && (s = kit), this._values.push(s), this._length += s; + } + return i && 1 & e.length && (this._length *= 2), this._length !== 0 && (this.ctrlPtGap = this.extPtGap = 0, this._currentValue = -1, !0); + } + scale(e) { + const i = this._values ? this._values.length : 0; + for (let r = 0; r < i; ++r) + this._values[r] *= e; + this._length *= e, this.extPtGap *= e, this.ctrlPtGap *= e; + } + addValue(e) { + this._length += e, this._values.push(e); + } + firstValue() { + return this._values[0]; + } + lastValue() { + return this._values[this._values.length - 1]; + } + nextValue() { + return this._currentValue++, this._currentValue === this._values.length && (this._currentValue = 0), this._values[this._currentValue]; + } + reset() { + this._currentValue = -1; + } + length() { + return this._length; + } + _setEmpty() { + this.extPtGap = this.ctrlPtGap = this._length = 0, this._currentValue = -1, this._values.length = 0; + } +}, jP = class { + constructor() { + this.pt = null, this.ca = 0, this.sa = 0; + } +}; +var RD; +(function(t) { + t[t.FAIL = 0] = "FAIL", t[t.END = 1] = "END", t[t.CONTINUE = 2] = "CONTINUE"; +})(RD || (RD = {})); +let zoe = class { + constructor() { + this.reset(); + } + reset() { + this.segment = -1, this.segmentLength = 0, this.abscissa = 0, this.isPathEnd = !1, this.isPartEnd = !1; + } + isValid() { + return this.segment !== -1; + } + copyTo(e) { + e.segment = this.segment, e.segmentLength = this.segmentLength, e.abscissa = this.abscissa, e.isPathEnd = this.isPathEnd, e.isPartEnd = this.isPartEnd; + } +}, Eve = class extends A3 { + constructor(e = 0, i = !1) { + super(e, i), this._tolerance = lte, this._currentPosition = new zoe(); + } + updateTolerance(e) { + this._tolerance = lte * e; + } + init(e, i, r = !0) { + return r ? (this._patternLength = i.length(), this._partExtPtGap = i.extPtGap, this._partCtrlPtGap = i.ctrlPtGap) : (this._patternLength = 0, this._partExtPtGap = 0, this._partCtrlPtGap = 0), this._currentPosition.reset(), this._partSegCount = 0, this._path = e, this._seg = -1, this._setPosAtNextPart(); + } + curPositionIsValid() { + return this._currentPosition.isValid(); + } + nextPosition(e, i = RD.FAIL) { + const r = new zoe(); + return !!this._nextPosition(e, r, null, i) && (r.copyTo(this._currentPosition), !0); + } + curPointAndAngle(e) { + e.pt = this._getPoint(this._currentPosition); + const [i, r] = this._getAngle(this._currentPosition); + e.ca = i, e.sa = r; + } + nextPointAndAngle(e, i, r = RD.FAIL) { + const n = new zoe(); + if (!this._nextPosition(e, n, null, r)) + return !1; + n.copyTo(this._currentPosition), i.pt = this._getPoint(n); + const [s, o] = this._getAngle(n); + return i.ca = s, i.sa = o, !0; + } + nextCurve(e) { + if (e === 0) + return null; + const i = [], r = new zoe(); + return this._nextPosition(e, r, i, RD.END) ? (r.copyTo(this._currentPosition), i) : null; + } + isPathEnd() { + return this._currentPosition.isPathEnd; + } + getPathEnd() { + if (this._currentPosition.segment === -1) + throw new Error("missing segment"); + return this._path[this._currentPosition.segment + 1]; + } + _nextPosition(e, i, r, n) { + if (this._currentPosition.isPathEnd) + return !1; + let s = this._currentPosition.abscissa; + for (this._currentPosition.segmentLength > 0 && (s /= this._currentPosition.segmentLength), this._currentPosition.copyTo(i); i.abscissa + e * this._partLengthRatio > i.segmentLength + this._tolerance; ) { + if (r) { + if (r.length === 0) + if (s === 0) { + const a = this._path[i.segment]; + r.push([a[0], a[1]]); + } else + r.push(this.getSegCoord2D(this._path, i.segment, s)); + const o = this._path[i.segment + 1]; + r.push([o[0], o[1]]); + } + if (s = 0, e -= (i.segmentLength - i.abscissa) / this._partLengthRatio, this._partSegCount) + i.segment = this._nextSegment(), i.segmentLength = this.calculateSegLength(this._path, i.segment), i.abscissa = 0, this._partSegCount--; + else { + if (!this._setPosAtNextPart()) + return n !== RD.FAIL && (i.segmentLength = this.calculateSegLength(this._path, i.segment), i.isPartEnd = !0, n === RD.END ? (i.abscissa = i.segmentLength, i.isPathEnd = !0) : i.abscissa = i.segmentLength + e, !0); + this._currentPosition.copyTo(i); + } + } + if (i.abscissa += e * this._partLengthRatio, r) { + if (r.length === 0) + if (s === 0) { + const a = this._path[i.segment]; + r.push([a[0], a[1]]); + } else + r.push(this.getSegCoord2D(this._path, i.segment, s)); + const o = i.abscissa / i.segmentLength; + if (o === 1) { + const a = this._path[i.segment + 1]; + r.push([a[0], a[1]]); + } else + r.push(this.getSegCoord2D(this._path, i.segment, o)); + } + return this._partSegCount || Math.abs(i.abscissa - i.segmentLength) < this._tolerance && (i.isPathEnd = this._partIsLast, i.isPartEnd = !0), !0; + } + _getPoint(e) { + if (e.segment === -1) + throw new Error("missing segment"); + const i = e.segmentLength <= 0 ? 0 : e.abscissa / e.segmentLength; + return this.getSegCoord2D(this._path, e.segment, i); + } + _getAngle(e) { + if (e.segment === -1) + throw new Error("missing segment"); + const i = e.segmentLength <= 0 ? 0 : e.abscissa / e.segmentLength; + return this.getSegAngleCS(this._path, e.segment, i); + } + _setPosAtNextPart() { + for (; this._partSegCount; ) + this._hasNextSegment() && this._nextSegment(), this._partSegCount--; + if (!this._hasNextSegment()) + return !1; + for (this._partLength = 0, this._partIsLast = !0, this._partSegCount = 0; this._hasNextSegment(); ) + if (this._partLength += this.calculateSegLength(this._path, this._nextSegment()), this._partSegCount++, iZ(this._path[this._getEndPointIndex()]) === 1) { + this._partIsLast = !this._hasNextSegment(); + break; + } + let e = this._partSegCount; + for (; e; ) + this._previousSegment(), --e; + this._currentPosition.segment = this._nextSegment(), this._currentPosition.segmentLength = this.calculateSegLength(this._path, this._currentPosition.segment), this._currentPosition.abscissa = 0, this._currentPosition.isPathEnd = this._currentPosition.isPartEnd = !1, --this._partSegCount; + const i = this._getStartPointIndex(); + this._ctrlPtBegin = iZ(this._path[i]) === 1; + let r = i + this._partSegCount + 1; + if (r >= this._path.length && (r = 0), this._ctrlPtEnd = iZ(this._path[r]) === 1, this._patternLength > 0) { + const n = this._ctrlPtBegin ? this._partCtrlPtGap : this._partExtPtGap, s = this._ctrlPtEnd ? this._partCtrlPtGap : this._partExtPtGap; + let o = Math.round((this._partLength - (n + s)) / this._patternLength); + o <= 0 && (o = n + s > 0 ? 0 : 1), this._partLengthRatio = this._partLength / (n + s + o * this._patternLength), this._partLengthRatio < 0.01 && (this._partLengthRatio = 1); + } else + this._partLengthRatio = 1; + return !0; + } + _hasNextSegment() { + return this._seg < this._path.length - 2; + } + _previousSegment() { + return --this._seg; + } + _nextSegment() { + return ++this._seg; + } + _getStartPointIndex() { + return this._seg; + } + _getEndPointIndex() { + return this._seg + 1; + } +}, aRt = class FX { + static local() { + return FX.instance === null && (FX.instance = new FX()), FX.instance; + } + execute(e, i, r, n, s) { + return new iQi(e, i, r); + } +}; +aRt.instance = null; +let iQi = class extends Cve { + constructor(e, i, r) { + super(e, !0, !0), this._firstCurve = null, this._walker = new Eve(), this._walker.updateTolerance(r), this._endings = i.lineDashEnding, this._customDashPos = -(i.offsetAlongLine ?? 0) * r, this._offsetAtEnd = (i.customEndingOffset ?? 0) * r, this._pattern = new Tve(), this._pattern.init(i.dashTemplate, !0), this._pattern.scale(r); + } + processPath(e) { + if (this._pattern.length() === 0) + return this.iteratePath = !1, { paths: [e] }; + if (!this.iteratePath) { + let n = !0; + switch (this._endings) { + case O_.HalfPattern: + case O_.HalfGap: + default: + this._pattern.extPtGap = 0; + break; + case O_.FullPattern: + this.isClosed || (this._pattern.extPtGap = 0.5 * this._pattern.firstValue()); + break; + case O_.FullGap: + this.isClosed || (this._pattern.extPtGap = 0.5 * this._pattern.lastValue()); + break; + case O_.NoConstraint: + this.isClosed || (n = !1); + break; + case O_.Custom: + this.isClosed || (this._pattern.extPtGap = 0.5 * this._offsetAtEnd); + } + const s = this._walker.calculatePathLength(e); + if (this._pattern.isEmpty() || s < 0.1 * this._pattern.length()) + return { paths: [e] }; + if (!this._walker.init(e, this._pattern, n)) + return { paths: [e] }; + } + let i; + if (this.iteratePath) + i = this._pattern.nextValue(); + else { + let n; + switch (this._endings) { + case O_.HalfPattern: + default: + n = 0.5 * this._pattern.firstValue(); + break; + case O_.HalfGap: + n = 0.5 * -this._pattern.lastValue(); + break; + case O_.FullGap: + n = -this._pattern.lastValue(); + break; + case O_.FullPattern: + n = 0; + break; + case O_.NoConstraint: + case O_.Custom: + n = -this._customDashPos; + } + let s = n / this._pattern.length(); + s -= Math.floor(s), n = s * this._pattern.length(), this._pattern.reset(), i = this._pattern.nextValue(); + let o = !1; + for (; n >= i; ) + n -= i, i = this._pattern.nextValue(), o = !o; + i -= n, o ? (this._walker.nextPosition(i), i = this._pattern.nextValue()) : this.isClosed && (this._firstCurve = this._walker.nextCurve(i), i = this._pattern.nextValue(), this._walker.nextPosition(i), i = this._pattern.nextValue()); + } + let r = this._walker.nextCurve(i); + return r ? this._walker.isPathEnd() ? (this.iteratePath = !1, this._firstCurve && (this._firstCurve.splice(0, 1), T7.mergePath(r, this._firstCurve), this._firstCurve = null)) : (i = this._pattern.nextValue(), !this._walker.nextPosition(i) || this._walker.isPathEnd() ? (this.iteratePath = !1, this._firstCurve && (r = this._firstCurve, this._firstCurve = null)) : this.iteratePath = !0) : (this.iteratePath = !1, r = this._firstCurve, this._firstCurve = null), { paths: [r] }; + } +}, lRt = class LX { + static local() { + return LX.instance === null && (LX.instance = new LX()), LX.instance; + } + execute(e, i, r, n, s) { + return new rQi(e, i, r, n, s); + } +}; +lRt.instance = null; +let rQi = class { + constructor(e, i, r, n, s) { + switch (this._inputGeometries = e, this._tileKey = n, this._geometryEngine = s, this._width = (i.width !== void 0 ? i.width : 2) * r, i.method) { + case Mk.Mitered: + case Mk.Bevelled: + case Mk.Rounded: + case Mk.TrueBuffer: + case Mk.Square: + } + this._option = i.option; + } + next() { + let e; + for (; e = this._inputGeometries.next(); ) { + if (gc(e) && this._width > 0) { + if (Math.min(e.xmax - e.xmin, e.ymax - e.ymin) - 2 * this._width < 0) + return e; + const i = []; + return i.push([[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]]), i.push([[e.xmin + this._width, e.ymin + this._width], [e.xmax - this._width, e.ymin + this._width], [e.xmax - this._width, e.ymax - this._width], [e.xmin + this._width, e.ymax - this._width], [e.xmin + this._width, e.ymin + this._width]]), { rings: i }; + } + if (za(e)) { + let i = null; + const r = this._geometryEngine; + let n = e; + if (this._tileKey && (n = p9e(e, Math.abs(this._width) + 1), !n || !n.rings || n.rings.length === 0)) + continue; + if (_e(r) && (i = r.buffer(or.WebMercator, n, -this._width, 1)), this._width > 0) { + const s = []; + for (const o of e.rings) + o && s.push(o); + if (i) + for (const o of i.rings) + o && s.push(o.reverse()); + if (s.length) + return { rings: s }; + } + } + } + return null; + } +}, uRt = class NX { + static local() { + return NX.instance === null && (NX.instance = new NX()), NX.instance; + } + execute(e, i, r, n, s) { + return new nQi(e, i, r); + } +}; +uRt.instance = null; +let nQi = class extends Cve { + constructor(e, i, r) { + super(e, !1, !0), this._curveHelper = new A3(), this._length = (i.length !== void 0 ? i.length : 20) * r, this._angle = i.angle !== void 0 ? i.angle : 225, this._position = i.position !== void 0 ? i.position : 50, this._length < 0 && (this._length = -this._length), this._position < 20 && (this._position = 20), this._position > 80 && (this._position = 80), this._mirror = !1; + } + processPath(e) { + if (this._curveHelper.isEmpty(e, !1)) + return null; + const i = e[0], r = e[e.length - 1], n = [r[0] - i[0], r[1] - i[1]]; + this._curveHelper.normalize(n); + const s = [i[0] + (r[0] - i[0]) * this._position / 100, i[1] + (r[1] - i[1]) * this._position / 100], o = Math.cos((90 - this._angle) / 180 * Math.PI); + let a = Math.sin((90 - this._angle) / 180 * Math.PI); + return this._mirror && (a = -a), this._mirror = !this._mirror, { paths: [[i, [s[0] - this._length / 2 * o, s[1] - this._length / 2 * a], [s[0] + this._length / 2 * o, s[1] + this._length / 2 * a], r]] }; + } +}, cRt = class kX { + static local() { + return kX.instance === null && (kX.instance = new kX()), kX.instance; + } + execute(e, i, r, n, s) { + return new sQi(e, i, r); + } +}; +cRt.instance = null; +let sQi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._offsetX = i.offsetX !== void 0 ? i.offsetX * r : 0, this._offsetY = i.offsetY !== void 0 ? -i.offsetY * r : 0; + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (gc(e)) + return { xmin: e.xmin + this._offsetX, xmax: e.xmax + this._offsetX, ymin: e.ymin + this._offsetY, ymax: e.ymax + this._offsetY }; + if (za(e)) { + const i = fi(e); + return this._moveMultipath(i.rings, this._offsetX, this._offsetY), i; + } + if (ju(e)) { + const i = fi(e); + return this._moveMultipath(i.paths, this._offsetX, this._offsetY), i; + } + if (Lg(e)) { + const i = fi(e); + return this._movePath(i.points, this._offsetX, this._offsetY), i; + } + if (B0(e)) + return { x: e.x + this._offsetX, y: e.y + this._offsetY }; + e = this._inputGeometries.next(); + } + return null; + } + _moveMultipath(e, i, r) { + if (e) + for (const n of e) + this._movePath(n, i, r); + } + _movePath(e, i, r) { + if (e) + for (const n of e) + n[0] += i, n[1] += r; + } +}, hRt = class $X { + static local() { + return $X.instance === null && ($X.instance = new $X()), $X.instance; + } + execute(e, i, r, n, s) { + return new oQi(e, i, r, n, s); + } +}; +hRt.instance = null; +let oQi = class { + constructor(e, i, r, n, s) { + this._inputGeometries = e, this._tileKey = n, this._geometryEngine = s, this._curveHelper = new A3(), this._offset = (i.offset ?? 1) * r, this._method = i.method, this._option = i.option, this._offsetFlattenError = lte * r; + } + next() { + let e; + for (; e = this._inputGeometries.next(); ) { + if (this._offset === 0) + return e; + if (gc(e)) { + if (this._method === fO.Rounded && this._offset > 0) { + const n = [[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]], s = this._curveHelper.offset(n, -this._offset, this._method, 4, this._offsetFlattenError); + return s ? { rings: [s] } : null; + } + if (Math.min(e.xmax - e.xmin, e.ymax - e.ymin) + 2 * this._offset > 0) + return { xmin: e.xmin - this._offset, xmax: e.xmax + this._offset, ymin: e.ymin - this._offset, ymax: e.ymax + this._offset }; + } + const i = this._geometryEngine; + if (ut(i)) + return null; + let r = e; + if (za(e)) { + if (this._tileKey && (r = p9e(e, Math.abs(this._offset) + 1), !r || !r.rings || r.rings.length === 0)) + continue; + } else if (ju(e) && this._tileKey && (r = X3t(e, Math.abs(this._offset) + 1), !r || !r.paths || r.paths.length === 0)) + continue; + return i.offset(or.WebMercator, r, -this._offset, 1, this._method, 4, this._offsetFlattenError); + } + return null; + } +}, dRt = class BX { + static local() { + return BX.instance === null && (BX.instance = new BX()), BX.instance; + } + execute(e, i, r, n, s) { + return new aQi(e, i, r); + } +}; +dRt.instance = null; +let aQi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._reverse = i.reverse === void 0 || i.reverse; + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (!this._reverse) + return e; + if (ju(e)) { + const i = fi(e); + return qZi(i.paths), i; + } + e = this._inputGeometries.next(); + } + return null; + } +}, pRt = class VX { + static local() { + return VX.instance === null && (VX.instance = new VX()), VX.instance; + } + execute(e, i, r, n, s) { + return new lQi(e, i, r); + } +}; +pRt.instance = null; +let lQi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._rotateAngle = i.angle !== void 0 ? i.angle * Math.PI / 180 : 0; + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (this._rotateAngle === 0) + return e; + const i = Eo(); + OI(i, e); + const r = (i[2] + i[0]) / 2, n = (i[3] + i[1]) / 2; + if (gc(e)) { + const s = { rings: [[[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]]] }; + return this._rotateMultipath(s.rings, r, n), s; + } + if (za(e)) { + const s = fi(e); + return this._rotateMultipath(s.rings, r, n), s; + } + if (ju(e)) { + const s = fi(e); + return this._rotateMultipath(s.paths, r, n), s; + } + if (Lg(e)) { + const s = fi(e); + return this._rotatePath(s.points, r, n), s; + } + if (B0(e)) + return e; + e = this._inputGeometries.next(); + } + return null; + } + _rotateMultipath(e, i, r) { + if (e) + for (const n of e) + this._rotatePath(n, i, r); + } + _rotatePath(e, i, r) { + if (e) { + const n = Math.cos(this._rotateAngle), s = Math.sin(this._rotateAngle); + for (const o of e) { + const a = o[0] - i, l = o[1] - r; + o[0] = i + a * n - l * s, o[1] = r + a * s + l * n; + } + } + } +}, fRt = class jX { + static local() { + return jX.instance === null && (jX.instance = new jX()), jX.instance; + } + execute(e, i, r, n, s) { + return new uQi(e, i, r); + } +}; +fRt.instance = null; +let uQi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._xFactor = i.xScaleFactor !== void 0 ? i.xScaleFactor : 1.15, this._yFactor = i.yScaleFactor !== void 0 ? i.yScaleFactor : 1.15; + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (this._xFactor === 1 && this._yFactor === 1) + return e; + const i = Eo(); + OI(i, e); + const r = (i[2] + i[0]) / 2, n = (i[3] + i[1]) / 2; + if (gc(e)) { + const s = { rings: [[[e.xmin, e.ymin], [e.xmin, e.ymax], [e.xmax, e.ymax], [e.xmax, e.ymin], [e.xmin, e.ymin]]] }; + return this._scaleMultipath(s.rings, r, n), s; + } + if (za(e)) { + const s = fi(e); + return this._scaleMultipath(s.rings, r, n), s; + } + if (ju(e)) { + const s = fi(e); + return this._scaleMultipath(s.paths, r, n), s; + } + if (Lg(e)) { + const s = fi(e); + return this._scalePath(s.points, r, n), s; + } + if (B0(e)) + return e; + e = this._inputGeometries.next(); + } + return null; + } + _scaleMultipath(e, i, r) { + if (e) + for (const n of e) + this._scalePath(n, i, r); + } + _scalePath(e, i, r) { + if (e) + for (const n of e) { + const s = (n[0] - i) * this._xFactor, o = (n[1] - r) * this._yFactor; + n[0] = i + s, n[1] = r + o; + } + } +}, mRt = class GX { + static local() { + return GX.instance === null && (GX.instance = new GX()), GX.instance; + } + execute(e, i, r, n, s) { + return new cQi(e, i, r); + } +}; +mRt.instance = null; +let cQi = class { + constructor(e, i, r) { + this._inputGeometries = e, this._height = (i.amplitude !== void 0 ? i.amplitude : 2) * r, this._period = (i.period !== void 0 ? i.period : 3) * r, this._style = i.waveform, this._height <= 0 && (this._height = Math.abs(this._height)), this._period <= 0 && (this._period = Math.abs(this._period)), this._pattern = new Tve(), this._pattern.addValue(this._period), this._pattern.addValue(this._period), this._walker = new Eve(), this._walker.updateTolerance(r); + } + next() { + let e = this._inputGeometries.next(); + for (; e; ) { + if (this._height === 0 || this._period === 0) + return e; + if (ju(e)) { + const i = this._processGeom(e.paths); + if (i.length) + return { paths: i }; + } + if (za(e)) { + const i = this._processGeom(e.rings); + if (i.length) + return { rings: i }; + } + e = this._inputGeometries.next(); + } + return null; + } + _processGeom(e) { + const i = []; + for (const r of e) + if (this._walker.init(r, this._pattern)) + switch (this._style) { + case pG.Sinus: + default: + i.push(this._constructCurve(r, !1)); + break; + case pG.Square: + i.push(this._constructSquare(r)); + break; + case pG.Triangle: + i.push(this._constructTriangle(r)); + break; + case pG.Random: + i.push(this._constructCurve(r, !0)); + } + else + i.push(r); + return i; + } + _constructCurve(e, i) { + const r = new T7(), n = this._walker.calculatePathLength(e); + let s = Math.round(n / this._period); + s === 0 && (s = 1); + const o = s * 16 + 1, a = n / s, l = this._period / 16, c = 1 / o, h = 2 * Math.PI * n / a, p = 2 * Math.PI * Math.random(), y = 2 * Math.PI * Math.random(), v = 2 * Math.PI * Math.random(), x = 0.75 - Math.random() / 2, I = 0.75 - Math.random() / 2, P = new jP(); + this._walker.curPointAndAngle(P), r.startPath(P.pt); + let F = 0; + for (; ; ) { + if (!this._walker.nextPointAndAngle(l, P)) { + r.lineTo(e[e.length - 1]); + break; + } + { + const k = F; + let V; + if (F += c, i) { + const j = this._height / 2 * (1 + 0.3 * Math.sin(x * h * k + p)); + V = j * Math.sin(h * k + y), V += j * Math.sin(I * h * k + v), V /= 2; + } else + V = 0.5 * this._height * Math.sin(0.5 * h * k); + r.lineTo([P.pt[0] - V * P.sa, P.pt[1] + V * P.ca]); + } + } + return r.path(); + } + _constructSquare(e) { + const i = new T7(), r = this._walker.calculatePathLength(e); + Math.round(r / this._period); + let n = !0; + for (; ; ) { + let s = !1; + if (this._walker.curPositionIsValid()) { + const o = new jP(); + this._walker.curPointAndAngle(o); + const a = new jP(); + if (this._walker.nextPointAndAngle(this._period, a)) { + const l = new jP(); + this._walker.nextPointAndAngle(this._period, l) && (n ? (i.startPath(o.pt), n = !1) : i.lineTo(o.pt), i.lineTo([o.pt[0] - this._height / 2 * o.sa, o.pt[1] + this._height / 2 * o.ca]), i.lineTo([a.pt[0] - this._height / 2 * a.sa, a.pt[1] + this._height / 2 * a.ca]), i.lineTo([a.pt[0] + this._height / 2 * a.sa, a.pt[1] - this._height / 2 * a.ca]), i.lineTo([l.pt[0] + this._height / 2 * l.sa, l.pt[1] - this._height / 2 * l.ca]), s = !0); + } + } + if (!s) { + i.lineTo(this._walker.getPathEnd()); + break; + } + } + return i.path(); + } + _constructTriangle(e) { + const i = new T7(), r = this._walker.calculatePathLength(e); + Math.round(r / this._period); + let n = !0; + for (; ; ) { + let s = !1; + if (this._walker.curPositionIsValid()) { + const o = new jP(); + this._walker.curPointAndAngle(o); + const a = new jP(); + if (this._walker.nextPointAndAngle(this._period / 2, a)) { + const l = new jP(); + this._walker.nextPointAndAngle(this._period, l) && (this._walker.nextPosition(this._period / 2) && (n ? (i.startPath(o.pt), n = !1) : i.lineTo(o.pt), i.lineTo([a.pt[0] - this._height / 2 * a.sa, a.pt[1] + this._height / 2 * a.ca]), i.lineTo([l.pt[0] + this._height / 2 * l.sa, l.pt[1] - this._height / 2 * l.ca])), s = !0); + } + } + if (!s) { + i.lineTo(this._walker.getPathEnd()); + break; + } + } + return i.path(); + } +}, gRt = class UX { + static local() { + return UX.instance === null && (UX.instance = new UX()), UX.instance; + } + execute(e, i, r, n, s) { + return new hQi(e, i, r); + } +}; +gRt.instance = null; +let hQi = class extends ere { + constructor(e, i, r) { + super(e, !0, !0), this._geometryWalker = new Eve(), this._geometryWalker.updateTolerance(r), this._angleToLine = i.angleToLine ?? !0, this._offset = (i.offset ? i.offset : 0) * r, this._originalEndings = i.endings, this._offsetAtEnd = (i.customEndingOffset ? i.customEndingOffset : 0) * r, this._position = -(i.offsetAlongLine ? i.offsetAlongLine : 0) * r, this._pattern = new Tve(), this._pattern.init(i.placementTemplate, !1), this._pattern.scale(r), this._endings = this._originalEndings; + } + processPath(e) { + if (this._pattern.isEmpty()) + return null; + let i; + if (this.iteratePath) + i = this._pattern.nextValue(); + else { + this._originalEndings === Q2.WithFullGap && this.isClosed ? this._endings = Q2.WithMarkers : this._endings = this._originalEndings, this._pattern.extPtGap = 0; + let n, s = !0; + switch (this._endings) { + case Q2.NoConstraint: + n = -this._position, n = this._adjustPosition(n), s = !1; + break; + case Q2.WithHalfGap: + default: + n = -this._pattern.lastValue() / 2; + break; + case Q2.WithFullGap: + n = -this._pattern.lastValue(), this._pattern.extPtGap = this._pattern.lastValue(); + break; + case Q2.WithMarkers: + n = 0; + break; + case Q2.Custom: + n = -this._position, n = this._adjustPosition(n), this._pattern.extPtGap = 0.5 * this._offsetAtEnd; + } + if (!this._geometryWalker.init(e, this._pattern, s)) + return null; + this._pattern.reset(); + let o = 0; + for (; n > o; ) + n -= o, o = this._pattern.nextValue(); + o -= n, i = o, this.iteratePath = !0; + } + const r = new jP(); + return this._geometryWalker.nextPointAndAngle(i, r) ? this._endings === Q2.WithFullGap && this._geometryWalker.isPathEnd() ? (this.iteratePath = !1, null) : this._endings === Q2.WithMarkers && this._geometryWalker.isPathEnd() && (this.iteratePath = !1, this.isClosed) ? null : (this.internalPlacement.setTranslate(r.pt[0] - this._offset * r.sa, r.pt[1] + this._offset * r.ca), this._angleToLine && this.internalPlacement.setRotateCS(r.ca, r.sa), this.internalPlacement) : (this.iteratePath = !1, null); + } + _adjustPosition(e) { + let i = e / this._pattern.length(); + return i -= Math.floor(i), i * this._pattern.length(); + } +}, yRt = class zX { + static local() { + return zX.instance === null && (zX.instance = new zX()), zX.instance; + } + execute(e, i, r, n, s) { + return new dQi(e, i, r); + } +}; +yRt.instance = null; +let dQi = class extends ere { + constructor(e, i, r) { + super(e, !1, !0), this._curveHelper = new A3(), this._angleToLine = i.angleToLine === void 0 || i.angleToLine, this._offset = i.offset !== void 0 ? i.offset * r : 0, this._type = i.extremityPlacement, this._position = i.offsetAlongLine !== void 0 ? i.offsetAlongLine * r : 0, this._beginProcessed = !1; + } + processPath(e) { + let i; + switch (this._type) { + case X_.Both: + default: + this._beginProcessed ? (i = this._atExtremities(e, this._position, !1), this._beginProcessed = !1, this.iteratePath = !1) : (i = this._atExtremities(e, this._position, !0), this._beginProcessed = !0, this.iteratePath = !0); + break; + case X_.JustBegin: + i = this._atExtremities(e, this._position, !0); + break; + case X_.JustEnd: + i = this._atExtremities(e, this._position, !1); + case X_.None: + } + return i; + } + _atExtremities(e, i, r) { + const n = e.length; + if (n < 2) + return null; + const s = r ? 1 : n - 2, o = r ? n : -1, a = r ? 1 : -1; + let l, c = 0, h = r ? e[0] : e[n - 1]; + for (let p = s; p !== o; p += a) { + l = h, h = e[p]; + const y = this._curveHelper.calculateLength(l, h); + if (c + y > i) { + const v = (i - c) / y, [x, I] = this._curveHelper.getAngleCS(l, h, v), P = PMe(l, h, v); + return this.internalPlacement.setTranslate(P[0] - this._offset * I, P[1] + this._offset * x), this._angleToLine && this.internalPlacement.setRotateCS(-x, -I), this.internalPlacement; + } + c += y; + } + return null; + } +}, vRt = class HX { + static local() { + return HX.instance === null && (HX.instance = new HX()), HX.instance; + } + execute(e, i, r, n, s) { + return new pQi(e, i, r); + } +}; +vRt.instance = null; +let pQi = class extends ere { + constructor(e, i, r) { + super(e, !0, !0), this._walker = new Eve(), this._walker.updateTolerance(r), this._angleToLine = i.angleToLine === void 0 || i.angleToLine, this._offset = i.offset !== void 0 ? i.offset * r : 0, this._beginGap = i.beginPosition !== void 0 ? i.beginPosition * r : 0, this._endGap = i.endPosition !== void 0 ? i.endPosition * r : 0, this._flipFirst = i.flipFirst === void 0 || i.flipFirst, this._pattern = new Tve(), this._pattern.init(i.positionArray, !1, !1), this._subPathLen = 0, this._posCount = this._pattern.size(), this._isFirst = !0, this._prevPos = 0; + } + processPath(e) { + if (this._pattern.isEmpty()) + return null; + let i; + if (this.iteratePath) { + const a = this._pattern.nextValue() * this._subPathLen, l = this._beginGap + a; + i = l - this._prevPos, this._prevPos = l; + } else { + if (this._posCount = this._pattern.size(), this._isFirst = !0, this._prevPos = 0, this._subPathLen = this._walker.calculatePathLength(e) - this._beginGap - this._endGap, this._subPathLen < 0) + return this.iteratePath = !1, null; + if (!this._walker.init(e, this._pattern, !1)) + return null; + this._pattern.reset(); + const a = this._pattern.nextValue() * this._subPathLen, l = this._beginGap + a; + i = l - this._prevPos, this._prevPos = l, this.iteratePath = !0; + } + const r = new jP(); + if (!this._walker.nextPointAndAngle(i, r, RD.END)) + return this.iteratePath = !1, null; + this.internalPlacement.setTranslate(r.pt[0] - this._offset * r.sa, r.pt[1] + this._offset * r.ca); + const n = this._isFirst && this._flipFirst; + let s, o; + return this._angleToLine ? (s = r.ca, o = r.sa) : (s = 1, o = 0), n && (s = -s, o = -o), this.internalPlacement.setRotateCS(s, o), this._isFirst = !1, this._posCount--, this._posCount === 0 && (this.iteratePath = !1), this.internalPlacement; + } +}; +const WR = 512, fQi = 10, mQi = 12, $it = 25, nT = 24; +function gQi(t) { + return t.rings !== void 0; +} +let _Rt = class WX { + static local() { + return WX.instance === null && (WX.instance = new WX()), WX.instance; + } + execute(e, i, r, n, s) { + return new yQi(e, i, r, n, s); + } +}; +_Rt.instance = null; +let yQi = class HN { + constructor(e, i, r, n, s) { + if (this._xMin = 0, this._xMax = 0, this._yMin = 0, this._yMax = 0, this._currentX = 0, this._currentY = 0, this._accelerationMap = null, this._testInsidePolygon = !1, this._verticalSubdivision = !0, this._stepX = Math.abs(i.stepX ?? 16) * r, this._stepY = Math.abs(i.stepY ?? 16) * r, this._stepX !== 0 && this._stepY !== 0 && e && gQi(e) && e.rings) { + if (this._gridType = i.gridType ?? XJ.Fixed, this._gridType === XJ.Random) { + const o = i.seed ?? 13, a = 1; + this._randomLCG = new VE(o * a), this._randomness = (i.randomness ?? 100) / 100, this._gridAngle = 0, this._shiftOddRows = !1, this._cosAngle = 1, this._sinAngle = 0, this._offsetX = 0, this._offsetY = 0, this._buildRandomValues(); + } else { + if (this._randomness = 0, this._gridAngle = i.gridAngle ?? 0, this._shiftOddRows = i.shiftOddRows ?? !1, this._offsetX = (i.offsetX ?? 0) * r, this._offsetY = (i.offsetY ?? 0) * r, this._cosAngle = Math.cos(this._gridAngle / 180 * Math.PI), this._sinAngle = -Math.sin(this._gridAngle / 180 * Math.PI), this._stepX) + if (this._offsetX < 0) + for (; this._offsetX < -0.5 * this._stepX; ) + this._offsetX += this._stepX; + else + for (; this._offsetX >= 0.5 * this._stepX; ) + this._offsetX -= this._stepX; + if (this._stepY) + if (this._offsetY < 0) + for (; this._offsetY < -0.5 * this._stepY; ) + this._offsetY += this._stepY; + else + for (; this._offsetY >= 0.5 * this._stepY; ) + this._offsetY -= this._stepY; + } + if (this._graphicOriginX = 0, this._graphicOriginY = 0, n != null) { + const [o, a, l] = n.split("/"), c = parseFloat(a), h = parseFloat(l); + this._graphicOriginX = -h * WR, this._graphicOriginY = c * WR, this._testInsidePolygon = !0; + } + this._internalPlacement = new aH(), this._calculateMinMax(e), this._geometry = e; + } + } + next() { + return this._geometry ? this._nextInside() : null; + } + _buildRandomValues() { + if (!HN._randValues) { + HN._randValues = []; + for (let e = 0; e < nT; e++) + for (let i = 0; i < nT; i++) + HN._randValues.push(this._randomLCG.getFloat()), HN._randValues.push(this._randomLCG.getFloat()); + } + } + _calculateMinMax(e) { + let i, r, n, s, o, a, l, c, h, p, y, v, x, I; + this._xMin = 0, this._xMax = 0, this._yMin = 0, this._yMax = 0, l = c = x = y = Number.MAX_VALUE, h = p = I = v = -Number.MAX_VALUE; + const P = this._cosAngle !== 1; + let F = 0; + for (const j of e.rings) { + const Y = j ? j.length : 0; + for (let X = 0; X < Y; X++) + a = j[X][0], o = j[X][1], i = a - this._graphicOriginX - this._offsetX, r = o - this._graphicOriginY - this._offsetY, P ? (n = this._cosAngle * i - this._sinAngle * r, s = this._sinAngle * i + this._cosAngle * r) : (n = i, s = r), l = Math.min(l, n), h = Math.max(h, n), c = Math.min(c, s), p = Math.max(p, s), y = Math.min(y, o), v = Math.max(v, o), x = Math.min(x, a), I = Math.max(I, a), F++; + } + y = y !== Number.MAX_VALUE ? y : -WR - this._stepY, v = v !== -Number.MAX_VALUE ? v : this._stepY, x = x !== Number.MAX_VALUE ? x : -this._stepX, I = I !== -Number.MAX_VALUE ? I : WR + this._stepX; + const k = v - y, V = I - x; + if (this._verticalSubdivision = k >= V, this._polygonMin = this._verticalSubdivision ? y : x, this._testInsidePolygon) { + let j = 0 - this._graphicOriginX - this._offsetX - this._stepX, Y = WR - this._graphicOriginX - this._offsetX + this._stepX, X = -WR - this._graphicOriginY - this._offsetY - this._stepY, Q = 0 - this._graphicOriginY - this._offsetY + this._stepY; + if (P) { + const re = [[j, X], [j, Q], [Y, X], [Y, Q]]; + j = X = Number.MAX_VALUE, Y = Q = -Number.MAX_VALUE; + for (const he of re) { + const fe = this._cosAngle * he[0] - this._sinAngle * he[1], be = this._sinAngle * he[0] + this._cosAngle * he[1]; + j = Math.min(j, fe), Y = Math.max(Y, fe), X = Math.min(X, be), Q = Math.max(Q, be); + } + } + l = l !== Number.MAX_VALUE ? Math.max(l, j) : j, c = c !== Number.MAX_VALUE ? Math.max(c, X) : X, h = h !== -Number.MAX_VALUE ? Math.min(h, Y) : Y, p = p !== -Number.MAX_VALUE ? Math.min(p, Q) : Q; + } + this._xMin = Math.round(l / this._stepX), this._xMax = Math.round(h / this._stepX), this._yMin = Math.round(c / this._stepY), this._yMax = Math.round(p / this._stepY), this._currentX = this._xMax + 1, this._currentY = this._yMin - 1, this._testInsidePolygon && F > mQi && (k > $it || V > $it) && this._buildAccelerationMap(e, x, I, y, v); + } + _buildAccelerationMap(e, i, r, n, s) { + const { rings: o } = e, a = /* @__PURE__ */ new Map(), l = this._verticalSubdivision, c = l ? s - n : r - i; + let h = Math.ceil(c / fQi); + if (h <= 1) + return; + const p = Math.floor(c / h); + let y, v, x, I, P, F, k, V, j, Y; + h++, this._delta = p, l ? (V = -WR - this._stepY, j = this._stepY, Y = n) : (V = -this._stepX, j = WR + this._stepX, Y = i); + for (let X = 0; X < o.length; X++) + if (y = o[X], !(y.length < 2)) + for (let Q = 1; Q < y.length; Q++) { + if (v = y[Q - 1], x = y[Q], l) { + if (v[1] === x[1] || v[1] < V && x[1] < V || v[1] > j && x[1] > j) + continue; + I = Math.min(v[1], x[1]), P = Math.max(v[1], x[1]); + } else { + if (v[0] === x[0] || v[0] < V && x[0] < V || v[0] > j && x[0] > j) + continue; + I = Math.min(v[0], x[0]), P = Math.max(v[0], x[0]); + } + for (; I < P; ) + F = Math.floor((I - Y) / p), Bit(F, X, Q, a), I += p; + k = Math.floor((P - Y) / p), k > F && Bit(k, X, Q, a); + } + this._accelerationMap = a; + } + _nextInside() { + for (; ; ) { + if (this._currentX > this._xMax) { + if (this._currentY++, this._currentY > this._yMax) + return null; + this._currentX = this._xMin, this._shiftOddRows && this._currentY % 2 && this._currentX--; + } + let e = this._currentX * this._stepX + this._offsetX; + this._shiftOddRows && this._currentY % 2 && (e += 0.5 * this._stepX); + const i = this._currentY * this._stepY + this._offsetY; + let r, n; + if (this._currentX++, this._gridType === XJ.Random) { + const s = (this._currentX % nT + nT) % nT, o = (this._currentY % nT + nT) % nT; + r = this._graphicOriginX + e + this._stepX * this._randomness * (0.5 - HN._randValues[o * nT + s]) * 2 / 3, n = this._graphicOriginY + i + this._stepY * this._randomness * (0.5 - HN._randValues[o * nT + s + 1]) * 2 / 3; + } else + r = this._graphicOriginX + this._cosAngle * e + this._sinAngle * i, n = this._graphicOriginY - this._sinAngle * e + this._cosAngle * i; + if (!this._testInsidePolygon || this._isInsidePolygon(r, n, this._geometry)) + return this._internalPlacement.setTranslate(r, n), this._internalPlacement; + } + } + _isInsidePolygon(e, i, r) { + const { rings: n } = r; + if (ut(this._accelerationMap)) + return vQi(e, i, r); + const s = this._verticalSubdivision, o = s ? i : e, a = Math.floor((o - this._polygonMin) / this._delta), l = this._accelerationMap.get(a); + if (!l) + return !1; + let c, h, p, y, v, x = 0; + for (const I of l) { + v = I[0]; + const P = n[v]; + if (y = I[1], c = P[y - 1], h = P[y], s) { + if (c[1] > i == h[1] > i) + continue; + p = (h[0] - c[0]) * (i - c[1]) - (h[1] - c[1]) * (e - c[0]); + } else { + if (c[0] > e == h[0] > e) + continue; + p = (h[1] - c[1]) * (e - c[0]) - (h[0] - c[0]) * (i - c[1]); + } + p > 0 ? x++ : x--; + } + return x !== 0; + } +}; +function vQi(t, e, i) { + const { rings: r } = i; + let n, s, o, a = 0; + for (const l of r) { + n = l.length; + for (let c = 1; c < n; ++c) + s = l[c - 1], o = l[c], s[1] > e != o[1] > e && ((o[0] - s[0]) * (e - s[1]) - (o[1] - s[1]) * (t - s[0]) > 0 ? a++ : a--); + } + return a !== 0; +} +function Bit(t, e, i, r) { + let n = r.get(t); + n || (n = [], r.set(t, n)), n.push([e, i]); +} +const _Qi = 1e-3; +let bRt = class qX { + static local() { + return qX.instance === null && (qX.instance = new qX()), qX.instance; + } + execute(e, i, r, n, s) { + return new bQi(e, i, r); + } +}; +bRt.instance = null; +let bQi = class extends ere { + constructor(e, i, r) { + super(e, !0, !0), this._curveHelper = new A3(), this._angleToLine = i.angleToLine === void 0 || i.angleToLine, this._offset = i.offset !== void 0 ? i.offset * r : 0, this._relativeTo = i.relativeTo, this._position = i.startPointOffset !== void 0 ? i.startPointOffset * r : 0, this._epsilon = _Qi * r; + } + processPath(e) { + const i = this._position; + if (this._relativeTo === mD.SegmentMidpoint) { + for (this.iteratePath || (this._segmentCount = e.length, this._curSegment = 1, this.iteratePath = !0); this._curSegment < this._segmentCount; ) { + const n = this._curSegment; + this._curSegment++; + const s = e[n - 1], o = e[n], a = this._curveHelper.calculateLength(s, o); + if (a < this._epsilon) + continue; + const l = 0.5 + this._position / a, [c, h] = this._curveHelper.getAngleCS(s, o, l), p = PMe(s, o, l); + return this.internalPlacement.setTranslate(p[0] - this._offset * h, p[1] + this._offset * c), this._angleToLine && this.internalPlacement.setRotateCS(c, h), this.internalPlacement; + } + return this.iteratePath = !1, null; + } + this._relativeTo === mD.LineEnd && AMe(e); + const r = this.onLine(e, i); + return this._relativeTo === mD.LineEnd && AMe(e), r; + } + onLine(e, i) { + let r, n = !1; + switch (this._relativeTo) { + case mD.LineMiddle: + default: + r = this._curveHelper.calculatePathLength(e) / 2 + i; + break; + case mD.LineBeginning: + r = i; + break; + case mD.LineEnd: + r = i, n = !0; + } + const s = e.length; + let o, a = 0, l = e[0]; + for (let c = 1; c < s; ++c) { + o = l, l = e[c]; + const h = this._curveHelper.calculateLength(o, l); + if (a + h > r) { + const p = (r - a) / h, [y, v] = this._curveHelper.getAngleCS(o, l, p), x = PMe(o, l, p), I = n ? -this._offset : this._offset; + return this.internalPlacement.setTranslate(x[0] - I * v, x[1] + I * y), this._angleToLine && (n ? this.internalPlacement.setRotateCS(-y, -v) : this.internalPlacement.setRotateCS(y, v)), this.internalPlacement; + } + a += h; + } + return null; + } +}, wRt = class YX { + static local() { + return YX.instance === null && (YX.instance = new YX()), YX.instance; + } + execute(e, i, r, n, s) { + return new xQi(e, i, r); + } +}; +wRt.instance = null; +const wQi = 1e-15; +let xQi = class extends ere { + constructor(e, i, r) { + super(e, !0, !0), this._curveHelper = new A3(), this._angleToLine = i.angleToLine === void 0 || i.angleToLine, this._offset = i.offset !== void 0 ? i.offset * r : 0, this._endPoints = i.placeOnEndPoints === void 0 || i.placeOnEndPoints, this._controlPoints = i.placeOnControlPoints === void 0 || i.placeOnControlPoints, this._regularVertices = i.placeOnRegularVertices === void 0 || i.placeOnRegularVertices, this._tags = [], this._tagIterator = 0; + } + processPath(e) { + if (this.iteratePath || (this._preparePath(e), this.iteratePath = !0), this._tagIterator >= this._tags.length) + return this._tags.length = 0, this._tagIterator = 0, this.iteratePath = !1, null; + const i = this._tags[this._tagIterator]; + this._angleToLine && this.internalPlacement.setRotate(i[2]); + let r = i[0], n = i[1]; + if (this._offset !== 0) { + const s = Math.cos(i[2]), o = Math.sin(i[2]); + r -= this._offset * o, n += this._offset * s; + } + return this.internalPlacement.setTranslate(r, n), this._tagIterator++, this.internalPlacement; + } + _preparePath(e) { + this._tags.length = 0, this._tagIterator = 0; + const i = YZi(e), r = e.length - 1; + let n, s, o = 0, a = 0, l = 0, c = 0, h = 0; + for (; o < r; ) { + o++, n = e[o - 1], s = e[o]; + const p = iZ(n), y = iZ(s); + (this._angleToLine || this._offset !== 0) && (c = this._curveHelper.getAngle(n, s, 0)), o === 1 ? i ? (a = c, l = p) : (this._endPoints || this._controlPoints && p === 1) && this._tags.push([n[0], n[1], c]) : p === 1 ? this._controlPoints && this._tags.push([n[0], n[1], Hoe(h, c)]) : this._regularVertices && this._tags.push([n[0], n[1], Hoe(h, c)]), (this._angleToLine || this._offset !== 0) && (h = this._curveHelper.getAngle(n, s, 1)), o === r && (i ? y === 1 || l === 1 ? this._controlPoints && this._tags.push([s[0], s[1], Hoe(h, a)]) : this._regularVertices && this._tags.push([s[0], s[1], Hoe(h, a)]) : (this._endPoints || this._controlPoints && y === 1) && this._tags.push([s[0], s[1], h])); + } + this._tagIterator = 0; + } +}; +function Hoe(t, e) { + const i = Math.PI; + for (; Math.abs(e - t) > i + 2 * wQi; ) + e - t > i ? e -= 2 * i : e += 2 * i; + return (t + e) / 2; +} +let SQi = class { + constructor(e = CQi) { + this._data = [], this._compare = e; + } + get size() { + return this._data.length; + } + enqueue(e) { + if (e == null) + return; + const { _data: i, _compare: r } = this; + i.push(e); + let n = i.length - 1 >>> 0; + const s = i[n]; + for (; n > 0; ) { + const o = n - 1 >> 1, a = i[o]; + if (!(r(a, s) <= 0)) + break; + i[o] = s, i[n] = a, n = o; + } + } + dequeue() { + const { _data: e, _compare: i } = this, r = e[0], n = e.pop(); + if (e.length === 0) + return r; + e[0] = n; + let s = 0; + const o = e.length, a = e[0]; + let l, c, h = null; + for (; ; ) { + const p = 2 * s + 1, y = 2 * s + 2; + if (h = null, p < o && (l = e[p], i(l, a) > 0 && (h = p)), y < o && (c = e[y], (h === null && i(c, a) <= 0 || h !== null && i(c, l) <= 0) && (h = y)), h === null) + break; + e[s] = e[h], e[h] = a, s = h; + } + return r; + } +}; +const CQi = (t, e) => t < e ? -1 : t > e ? 1 : 0, TQi = 100 * 222045e-21; +function EQi(t) { + const { rings: e } = t; + if (!e || e.length === 0) + return null; + const i = OI(Eo(), t); + if (!i) + return null; + const r = 4 * (Math.abs(i[0]) + Math.abs(i[2]) + Math.abs(i[1]) + Math.abs(i[3]) + 1) * TQi; + let n = 0, s = 0; + for (let fe = 0; fe < e.length; fe++) { + const be = J4e(e[fe]); + be > s && (s = be, n = fe); + } + if (Math.abs(s) <= 2 * r * r) { + const fe = W7(Eo(), e[n]); + return [(fe[0] + fe[2]) / 2, (fe[1] + fe[3]) / 2]; + } + const o = Tht(e[n], !1, Eo()); + if (o === null) + return null; + if (e.length === 1 && e[0].length < 4) + return o; + const a = [[NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN]], l = [NaN, NaN, NaN, NaN], c = [NaN, NaN, NaN, NaN]; + let h = !1, p = vq(o, t, !0); + p.distance === 0 && (h = !0, a[0][0] = o[0], a[0][1] = o[1], p = vq(o, t, !1)), l[0] = p.distance, c[0] = 0; + const y = [NaN, NaN]; + let v = !1, x = 0.25, I = -1; + const P = W7(Eo(), e[n]); + let F = NaN; + do + if (F = NaN, a[1] = Wxe(t, qxe(P[0], P[2], x), r, i), isNaN(a[1][0]) || isNaN(a[1][1]) || (p = vq(a[1], t, !1), F = p.distance), !isNaN(F) && F > r && _ce(a[1], t)) + v = !0, l[1] = F, c[1] = WN(a[1], o); + else if (!isNaN(F) && F > I && (I = F, y[0] = a[1][0], y[1] = a[1][1]), x -= 0.01, x < 0.1) { + if (!(I >= 0)) + break; + v = !0, l[1] = I, a[1][0] = y[0], a[1][1] = y[1], c[1] = WN(a[1], o); + } + while (!v); + v = !1, x = 0.5, I = -1; + let k = 0.01, V = 1; + do + if (F = NaN, a[2] = Wxe(t, qxe(P[0], P[2], x), r, i), isNaN(a[2][0]) || isNaN(a[2][1]) || (p = vq(a[2], t, !1), F = p.distance), !isNaN(F) && F > r && _ce(a[2], t)) + v = !0, l[2] = F, c[2] = WN(a[2], o); + else if (!isNaN(F) && F > I) + I = F, y[0] = a[2][0], y[1] = a[2][1]; + else if (F > I && (I = F, y[0] = a[2][0], y[1] = a[2][1]), x = 0.5 + k * V, k += 0.01, V *= -1, x < 0.3 || x > 0.7) { + if (!(I >= 0)) + break; + v = !0, l[2] = I, a[2][0] = y[0], a[2][1] = y[1], c[2] = WN(a[2], o); + } + while (!v); + v = !1, x = 0.75, I = -1; + do + if (F = NaN, a[3] = Wxe(t, qxe(P[0], P[2], x), r, i), isNaN(a[3][0]) || isNaN(a[3][1]) || (p = vq(a[3], t, !1), F = p.distance), !isNaN(F) && F > r && _ce(a[3], t)) + v = !0, l[3] = F, c[3] = WN(a[3], o); + else if (F > I && (I = F, y[0] = a[3][0], y[1] = a[3][1]), x += 0.01, x > 0.9) { + if (!(I >= 0)) + break; + v = !0, l[3] = I, a[3][0] = y[0], a[3][1] = y[1], c[3] = WN(a[3], o); + } + while (!v); + const j = [0, 1, 2, 3], Y = h ? 0 : 1; + let X; + for (let fe = Y; fe < 4; fe++) + for (let be = Y; be < 3; be++) { + const Se = c[be], Me = c[be + 1]; + PQi(Se, Me) > 0 && (X = j[be], j[be] = j[be + 1], j[be + 1] = X, c[be] = Me, c[be + 1] = Se); + } + let Q = Y, re = 0, he = 0; + for (let fe = Y; fe < 4; fe++) { + switch (fe) { + case 0: + he = 2 * l[j[fe]]; + break; + case 1: + he = 1.66666666 * l[j[fe]]; + break; + case 2: + he = 1.33333333 * l[j[fe]]; + break; + case 3: + he = l[j[fe]]; + } + he > re && (re = he, Q = j[fe]); + } + return a[Q]; +} +function _ce(t, e) { + const { rings: i } = e; + let r = 0; + for (const n of i) { + const s = n.length; + for (let o = 1; o < s; ++o) { + const a = n[o - 1], l = n[o]; + a[1] > t[1] != l[1] > t[1] && ((l[0] - a[0]) * (t[1] - a[1]) - (l[1] - a[1]) * (t[0] - a[0]) > 0 ? r++ : r--); + } + } + return r !== 0; +} +function vq(t, e, i) { + if (i && _ce(t, e)) + return { coord: t, distance: 0 }; + let r = 1 / 0, n = 0, s = 0; + const o = [0, 0], { rings: a } = e; + for (const l of a) + if (!(l.length < 2)) + for (let c = 0; c < l.length - 1; c++) { + Sht(o, t, l, c); + const h = WN(t, o); + h < r && (r = h, n = o[0], s = o[1]); + } + return { coord: [n, s], distance: Math.sqrt(r) }; +} +function Wxe(t, e, i, r) { + const n = [e, 0]; + let s = 1 / 0, o = 1 / 0, a = !1, l = !1; + const c = [[e, r[1] - 1], [e, r[3] + 1]], h = [0, 0], p = [0, 0], y = [0, 0], v = [[0, 0], [0, 0]], x = Eo(), { rings: I } = t; + for (const P of I) + if (!(P.length < 2)) + for (let F = 1; F < P.length; F++) { + if (v[0][0] = P[F - 1][0], v[0][1] = P[F - 1][1], v[1][0] = P[F][0], v[1][1] = P[F][1], IQi(x, v) === null || (p[0] = c[0][0], p[1] = c[0][1], y[0] = c[1][0], y[1] = c[1][1], AQi(x, p, y) === 0) || !V7(c[0], c[1], v[0], v[1], h)) + continue; + const k = h[1]; + s > o ? k < s && (s = k, a = !0) : k < o && (o = k, l = !0); + } + return a && l ? n[1] = (s + o) / 2 : n[0] = n[1] = NaN, n; +} +function IQi(t, e) { + if (e.length < 2) + return null; + t || (t = Eo()); + const [i, r] = e[0], [n, s] = e[1]; + return t[0] = Math.min(i, n), t[1] = Math.min(r, s), t[2] = Math.max(i, n), t[3] = Math.max(r, s), t; +} +const Woe = 1, qoe = 4, Vit = 3, jit = 12; +function AQi(t, e, i) { + let r = sT(e, t), n = sT(i, t); + const s = t[0], o = t[1], a = t[2], l = t[3]; + if (r & n) + return 0; + if (!(r | n)) + return 4; + const c = (r ? 1 : 0) | (n ? 2 : 0); + do { + const h = i[0] - e[0], p = i[1] - e[1]; + if (h > p) + r & Vit ? (r & Woe ? (e[1] += p * (s - e[0]) / h, e[0] = s) : (e[1] += p * (a - e[0]) / h, e[0] = a), r = sT(e, t)) : n & Vit ? (n & Woe ? (i[1] += p * (s - i[0]) / h, i[0] = s) : (i[1] += p * (a - i[0]) / h, i[0] = a), n = sT(i, t)) : r ? (r & qoe ? (e[0] += h * (o - e[1]) / p, e[1] = o) : (e[0] += h * (l - e[1]) / p, e[1] = l), r = sT(e, t)) : (n & qoe ? (i[0] += h * (o - i[1]) / p, i[1] = o) : (i[0] += h * (l - i[1]) / p, i[1] = l), n = sT(i, t)); + else if (r & jit ? (r & qoe ? (e[0] += h * (o - e[1]) / p, e[1] = o) : (e[0] += h * (l - e[1]) / p, e[1] = l), r = sT(e, t)) : n & jit ? (n & qoe ? (i[0] += h * (o - i[1]) / p, i[1] = o) : (i[0] += h * (l - i[1]) / p, i[1] = l), n = sT(i, t)) : r ? (r & Woe ? (e[1] += p * (s - e[0]) / h, e[0] = s) : (e[1] += p * (a - e[0]) / h, e[0] = a), r = sT(e, t)) : (n & Woe ? (i[1] += p * (s - i[0]) / h, i[0] = s) : (i[1] += p * (a - i[0]) / h, i[0] = a), n = sT(i, t)), r & n) + return 0; + } while (r | n); + return c; +} +function sT(t, e) { + return (t[0] < e[0] ? 1 : 0) | (t[0] > e[2] ? 1 : 0) << 1 | (t[1] < e[1] ? 1 : 0) << 2 | (t[1] > e[3] ? 1 : 0) << 3; +} +function qxe(t, e, i) { + return t + (e - t) * i; +} +function WN(t, e) { + return (t[0] - e[0]) * (t[0] - e[0]) + (t[1] - e[1]) * (t[1] - e[1]); +} +function PQi(t, e) { + if (t < e) + return -1; + if (t > e) + return 1; + if (t === e) + return 0; + const i = isNaN(t), r = isNaN(e); + return i < r ? -1 : i > r ? 1 : 0; +} +let TB = class { + constructor(e, i, r, n) { + this.x = e, this.y = i, this.cellSize = r, this.distancefromCellCenter = kjt(e, i, n), this.maxDistanceToPolygon = this.distancefromCellCenter + this.cellSize * Math.SQRT2; + } +}; +const OQi = 1, RQi = 100; +function MQi(t) { + if (!t || !t.rings || t.rings.length === 0) + return null; + const e = W7(Eo(), t.rings[0]); + if (!e) + return null; + const i = e[2] - e[0], r = e[3] - e[1]; + if (i === 0 || r === 0) + return [e[0] + i / 2, e[1] + r / 2]; + const n = Math.max(Math.min(i, r) / RQi, OQi), s = new SQi((v, x) => x.maxDistanceToPolygon - v.maxDistanceToPolygon), o = Math.min(i, r); + let a = o / 2, l = 0, c = 0; + for (l = e[0]; l < e[2]; l += o) + for (c = e[1]; c < e[3]; c += o) + s.enqueue(new TB(l + a, c + a, a, t)); + const h = Z4e(t.rings, !1); + if (h === null) + return null; + let p, y = new TB(h[0], h[1], 0, t); + for (; s.size > 0; ) + p = s.dequeue(), p.distancefromCellCenter > y.distancefromCellCenter && (y = p), p.maxDistanceToPolygon - y.distancefromCellCenter <= n || (a = p.cellSize / 2, s.enqueue(new TB(p.x - a, p.y - a, a, t)), s.enqueue(new TB(p.x + a, p.y - a, a, t)), s.enqueue(new TB(p.x - a, p.y + a, a, t)), s.enqueue(new TB(p.x + a, p.y + a, a, t))); + return [y.x, y.y]; +} +function DQi(t) { + return t.rings !== void 0; +} +let xRt = class XX { + static local() { + return XX.instance === null && (XX.instance = new XX()), XX.instance; + } + execute(e, i, r, n, s) { + return new FQi(e, i, r); + } +}; +xRt.instance = null; +let FQi = class { + constructor(e, i, r) { + this._geometry = e, this._offsetX = i.offsetX !== void 0 ? i.offsetX * r : 0, this._offsetY = i.offsetY !== void 0 ? i.offsetY * r : 0, this._method = i.method !== void 0 ? i.method : fG.OnPolygon, this._internalPlacement = new aH(); + } + next() { + const e = this._geometry; + return this._geometry = null, e && DQi(e) ? this._polygonCenter(e) : null; + } + _polygonCenter(e) { + let i = !1; + switch (this._method) { + case fG.CenterOfMass: + { + const r = Hjt(e); + r && (this._internalPlacement.setTranslate(r[0] + this._offsetX, r[1] + this._offsetY), i = !0); + } + break; + case fG.BoundingBoxCenter: + { + const r = Eo(); + OI(r, e), r && (this._internalPlacement.setTranslate((r[2] + r[0]) / 2 + this._offsetX, (r[3] + r[1]) / 2 + this._offsetY), i = !0); + } + break; + case fG.OnPolygon: + default: { + let r; + r = Vi("polylabel-placement-enabled") ? MQi(e) : EQi(e), r !== null && (this._internalPlacement.setTranslate(r[0] + this._offsetX, r[1] + this._offsetY), i = !0); + } + } + return i ? this._internalPlacement : null; + } +}; +function OMe(t) { + if (!t) + return null; + switch (t.type) { + case "CIMGeometricEffectAddControlPoints": + return iRt.local(); + case "CIMGeometricEffectArrow": + return rRt.local(); + case "CIMGeometricEffectBuffer": + return nRt.local(); + case "CIMGeometricEffectControlMeasureLine": + return sRt.local(); + case "CIMGeometricEffectCut": + return oRt.local(); + case "CIMGeometricEffectDashes": + return aRt.local(); + case "CIMGeometricEffectDonut": + return lRt.local(); + case "CIMGeometricEffectJog": + return uRt.local(); + case "CIMGeometricEffectMove": + return cRt.local(); + case "CIMGeometricEffectOffset": + return hRt.local(); + case "CIMGeometricEffectReverse": + return dRt.local(); + case "CIMGeometricEffectRotate": + return pRt.local(); + case "CIMGeometricEffectScale": + return fRt.local(); + case "CIMGeometricEffectWave": + return mRt.local(); + } + return null; +} +function SRt(t) { + if (!t) + return null; + switch (t.type) { + case "CIMMarkerPlacementAlongLineSameSize": + return gRt.local(); + case "CIMMarkerPlacementAtExtremities": + return yRt.local(); + case "CIMMarkerPlacementAtRatioPositions": + return vRt.local(); + case "CIMMarkerPlacementInsidePolygon": + return _Rt.local(); + case "CIMMarkerPlacementOnLine": + return bRt.local(); + case "CIMMarkerPlacementOnVertices": + return wRt.local(); + case "CIMMarkerPlacementPolygonCenter": + return xRt.local(); + } + return null; +} +function Yxe(t) { + const e = t.getFrame(0); + if (e instanceof HTMLImageElement || e instanceof HTMLCanvasElement) + return e; + const i = document.createElement("canvas"); + i.width = t.width, i.height = t.height; + const r = i.getContext("2d"); + return e instanceof ImageData ? r.putImageData(e, 0, 0) : r.drawImage(e, 0, 0), i; +} +let Wfe = class { + constructor(e = 0, i = 0, r = 0, n = 0) { + this.x = e, this.y = i, this.width = r, this.height = n; + } + get isEmpty() { + return this.width <= 0 || this.height <= 0; + } + union(e) { + this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.width = Math.max(this.width, e.width), this.height = Math.max(this.height, e.height); + } +}; +function LQi(t) { + return `rgb(${t.slice(0, 3).toString()})`; +} +function NQi(t) { + return `rgba(${t.slice(0, 3).toString()},${t[3]})`; +} +let CRt = class { + constructor(e) { + e && (this._textRasterizationCanvas = e); + } + rasterizeText(e, i) { + this._textRasterizationCanvas || (this._textRasterizationCanvas = document.createElement("canvas")); + const r = this._textRasterizationCanvas, n = r.getContext("2d"); + this._setFontProperties(n, i), this._parameters = i, this._textLines = e.split(/\r?\n/), this._lineHeight = this._computeLineHeight(); + const s = this._computeTextWidth(n, i), { decoration: o, weight: a } = i.font; + this._lineThroughWidthOffset = o && o === "line-through" ? 0.1 * this._lineHeight : 0; + const l = this._lineHeight * this._textLines.length; + r.width = s + 2 * this._lineThroughWidthOffset, r.height = l, this._renderedLineHeight = Math.round(this._lineHeight * i.pixelRatio), this._renderedHaloSize = i.halo.size * i.pixelRatio, this._renderedWidth = s * i.pixelRatio, this._renderedHeight = l * i.pixelRatio, this._lineThroughWidthOffset *= i.pixelRatio; + const c = i.color ?? [0, 0, 0, 0], h = i.halo && i.halo.color ? i.halo.color : [0, 0, 0, 0]; + this._fillStyle = NQi(c), this._haloStyle = LQi(h); + const p = this._renderedLineHeight, y = this._renderedHaloSize; + n.save(), n.clearRect(0, 0, r.width, r.height), this._setFontProperties(n, i); + const v = kQi(n.textAlign, this._renderedWidth) + y, x = y, I = y > 0; + let P = this._lineThroughWidthOffset, F = 0; + I && this._renderHalo(n, v, x, P, F, i), F += x, P += v; + for (const re of this._textLines) + I ? (n.globalCompositeOperation = "destination-out", n.fillStyle = "rgb(0, 0, 0)", n.fillText(re, P, F), n.globalCompositeOperation = "source-over", n.fillStyle = this._fillStyle, n.fillText(re, P, F)) : (n.fillStyle = this._fillStyle, n.fillText(re, P, F)), o && o !== "none" && this._renderDecoration(n, P, F, o, a), F += p; + n.restore(); + const k = this._renderedWidth + 2 * this._lineThroughWidthOffset, V = this._renderedHeight, j = n.getImageData(0, 0, k, V), Y = new Uint8Array(j.data); + if (i.premultiplyColors) { + let re; + for (let he = 0; he < Y.length; he += 4) + re = Y[he + 3] / 255, Y[he] = Y[he] * re, Y[he + 1] = Y[he + 1] * re, Y[he + 2] = Y[he + 2] * re; + } + let X, Q; + switch (i.horizontalAlignment) { + case "left": + X = -0.5; + break; + case "right": + X = 0.5; + break; + default: + X = 0; + } + switch (i.verticalAlignment) { + case "bottom": + Q = -0.5; + break; + case "top": + Q = 0.5; + break; + default: + Q = 0; + } + return { size: [k, V], image: new Uint32Array(Y.buffer), sdf: !1, simplePattern: !1, anchorX: X, anchorY: Q, canvas: r }; + } + _renderHalo(e, i, r, n, s, o) { + const a = this._renderedWidth, l = this._renderedHeight; + this._haloRasterizationCanvas || (this._haloRasterizationCanvas = document.createElement("canvas")), this._haloRasterizationCanvas.width = a, this._haloRasterizationCanvas.height = l; + const c = this._haloRasterizationCanvas, h = c.getContext("2d"); + h.clearRect(0, 0, a, l), this._setFontProperties(h, o); + const { decoration: p, weight: y } = o.font; + h.fillStyle = this._haloStyle, h.strokeStyle = this._haloStyle, h.lineJoin = "round", this._renderHaloNative(h, i, r, p, y), e.globalAlpha = this._parameters.halo.color[3], e.drawImage(c, 0, 0, a, l, n, s, a, l), e.globalAlpha = 1; + } + _renderHaloNative(e, i, r, n, s) { + const o = this._renderedLineHeight, a = this._renderedHaloSize; + for (const l of this._textLines) { + const c = 2 * a, h = 5, p = 0.1; + for (let y = 0; y < h; y++) { + const v = (1 - (h - 1) * p + y * p) * c; + e.lineWidth = v, e.strokeText(l, i, r), n && n !== "none" && this._renderDecoration(e, i, r, n, s, v); + } + r += o; + } + } + _setFontProperties(e, i) { + const r = Math.max(i.size, 0.5), n = i.font, s = `${n.style} ${n.weight} ${dn(r * i.pixelRatio).toFixed(1)}px ${n.family}, sans-serif`; + let o; + switch (e.font = s, e.textBaseline = "top", i.horizontalAlignment) { + case "left": + default: + o = "left"; + break; + case "right": + o = "right"; + break; + case "center": + o = "center"; + } + e.textAlign = o; + } + computeTextSize(e, i) { + this._textRasterizationCanvas || (this._textRasterizationCanvas = document.createElement("canvas")); + const r = this._textRasterizationCanvas, n = r.getContext("2d"); + this._setFontProperties(n, i), this._parameters = i, this._textLines = e.split(/\r?\n/), this._lineHeight = this._computeLineHeight(); + const s = this._computeTextWidth(n, i), o = this._lineHeight * this._textLines.length; + return r.width = s, r.height = o, [s * i.pixelRatio, o * i.pixelRatio]; + } + _computeTextWidth(e, i) { + let r = 0; + for (const s of this._textLines) + r = Math.max(r, e.measureText(s).width); + const n = i.font; + return (n.style === "italic" || n.style === "oblique" || typeof n.weight == "string" && (n.weight === "bold" || n.weight === "bolder") || typeof n.weight == "number" && n.weight > 600) && (r += 0.3 * e.measureText("w").width), r += 2 * this._parameters.halo.size, Math.round(r); + } + _computeLineHeight() { + let e = 1.275 * this._parameters.size; + const i = this._parameters.font.decoration; + return i && i === "underline" && (e *= 1.3), Math.round(e + 2 * this._parameters.halo.size); + } + _renderDecoration(e, i, r, n, s, o) { + const a = 0.9 * this._lineHeight, l = s === "bold" ? 0.06 : s === "bolder" ? 0.09 : 0.04; + switch (e.textAlign) { + case "center": + i -= this._renderedWidth / 2; + break; + case "right": + i -= this._renderedWidth; + } + const c = e.textBaseline; + if (n === "underline") + switch (c) { + case "top": + r += a; + break; + case "middle": + r += a / 2; + } + else if (n === "line-through") + switch (c) { + case "top": + r += a / 1.5; + break; + case "middle": + r += a / 3; + } + const h = o ? 1.5 * o : Math.ceil(a * l); + e.save(), e.beginPath(), e.strokeStyle = e.fillStyle, e.lineWidth = h, e.moveTo(i - this._lineThroughWidthOffset, r), e.lineTo(i + this._renderedWidth + 2 * this._lineThroughWidthOffset, r), e.stroke(), e.restore(); + } +}; +function kQi(t, e) { + return t === "center" ? 0.5 * e : t === "right" ? e : 0; +} +var Ed, Id; +function TRt(t) { + switch (t) { + case "left": + return Ed.Left; + case "right": + return Ed.Right; + case "center": + return Ed.Center; + } +} +function ERt(t) { + switch (t) { + case "top": + return Id.Top; + case "middle": + return Id.Center; + case "baseline": + return Id.Baseline; + case "bottom": + return Id.Bottom; + } +} +function $Qi(t) { + switch (t) { + case "above-left": + case "esriServerPointLabelPlacementAboveLeft": + return [Ed.Right, Id.Bottom]; + case "above-center": + case "above-along": + case "esriServerPointLabelPlacementAboveCenter": + case "esriServerLinePlacementAboveAlong": + return [Ed.Center, Id.Bottom]; + case "above-right": + case "esriServerPointLabelPlacementAboveRight": + return [Ed.Left, Id.Bottom]; + case "center-left": + case "esriServerPointLabelPlacementCenterLeft": + return [Ed.Right, Id.Center]; + case "center-center": + case "center-along": + case "esriServerPointLabelPlacementCenterCenter": + case "esriServerLinePlacementCenterAlong": + case "always-horizontal": + case "esriServerPolygonPlacementAlwaysHorizontal": + return [Ed.Center, Id.Center]; + case "center-right": + case "esriServerPointLabelPlacementCenterRight": + return [Ed.Left, Id.Center]; + case "below-left": + case "esriServerPointLabelPlacementBelowLeft": + return [Ed.Right, Id.Top]; + case "below-center": + case "below-along": + case "esriServerPointLabelPlacementBelowCenter": + case "esriServerLinePlacementBelowAlong": + return [Ed.Center, Id.Top]; + case "below-right": + case "esriServerPointLabelPlacementBelowRight": + return [Ed.Left, Id.Top]; + default: + return console.debug(`Found invalid placement type ${t}`), [Ed.Center, Id.Center]; + } +} +function BQi(t) { + switch (t) { + case Ed.Right: + return -1; + case Ed.Center: + return 0; + case Ed.Left: + return 1; + default: + return console.debug(`Found invalid horizontal alignment ${t}`), 0; + } +} +function VQi(t) { + switch (t) { + case Id.Top: + return 1; + case Id.Center: + return 0; + case Id.Bottom: + case Id.Baseline: + return -1; + default: + return console.debug(`Found invalid vertical alignment ${t}`), 0; + } +} +function jQi(t) { + switch (t) { + case "left": + return Ed.Left; + case "right": + return Ed.Right; + case "center": + return Ed.Center; + } +} +function IRt(t) { + switch (t) { + case "above-along": + case "below-along": + case "center-along": + case "esriServerLinePlacementAboveAlong": + case "esriServerLinePlacementBelowAlong": + case "esriServerLinePlacementCenterAlong": + return !0; + default: + return !1; + } +} +(function(t) { + t[t.Left = -1] = "Left", t[t.Center = 0] = "Center", t[t.Right = 1] = "Right"; +})(Ed || (Ed = {})), function(t) { + t[t.Top = 1] = "Top", t[t.Center = 0] = "Center", t[t.Bottom = -1] = "Bottom", t[t.Baseline = 2] = "Baseline"; +}(Id || (Id = {})); +let KX = class RMe { + constructor(e, i, r, n) { + this.center = Tp(e, i), this.centerT = cI(), this.halfWidth = r / 2, this.halfHeight = n / 2, this.width = r, this.height = n; + } + get x() { + return this.center[0]; + } + get y() { + return this.center[1]; + } + get blX() { + return this.center[0] + this.halfWidth; + } + get blY() { + return this.center[1] + this.halfHeight; + } + get trX() { + return this.center[0] - this.halfWidth; + } + get trY() { + return this.center[1] - this.halfHeight; + } + get xmin() { + return this.x - this.halfWidth; + } + get xmax() { + return this.x + this.halfWidth; + } + get ymin() { + return this.y - this.halfHeight; + } + get ymax() { + return this.y + this.halfHeight; + } + set x(e) { + this.center[0] = e; + } + set y(e) { + this.center[1] = e; + } + clone() { + return new RMe(this.x, this.y, this.width, this.height); + } + serialize(e) { + return e.writeF32(this.center[0]), e.writeF32(this.center[1]), e.push(this.width), e.push(this.height), e; + } + findCollisionDelta(e, i = 4) { + const r = Math.abs(e.centerT[0] - this.centerT[0]), n = Math.abs(e.centerT[1] - this.centerT[1]), s = (e.halfWidth + this.halfWidth + i) / r, o = (e.halfHeight + this.halfHeight + i) / n, a = Math.min(s, o); + return Math.log2(a); + } + extend(e) { + const i = Math.min(this.xmin, e.xmin), r = Math.min(this.ymin, e.ymin), n = Math.max(this.xmax, e.xmax) - i, s = Math.max(this.ymax, e.ymax) - r, o = i + n / 2, a = r + s / 2; + this.width = n, this.height = s, this.halfWidth = n / 2, this.halfHeight = s / 2, this.x = o, this.y = a; + } + static deserialize(e) { + const i = e.readF32(), r = e.readF32(), n = e.readInt32(), s = e.readInt32(); + return new RMe(i, r, n, s); + } +}; +const f9e = 26, ARt = 4, GQi = f9e + ARt, UQi = f9e - 6, Git = 3, b0 = 8, zQi = Math.PI / 180, qR = 8, HQi = 1.5; +let PRt = class { + constructor(e, i, r, n) { + this._rotationT = e1(), this._xBounds = 0, this._yBounds = 0, this.minZoom = 0, this.maxZoom = 255, this._bounds = null; + const s = r.rect, o = new Float32Array(8); + e *= n, i *= n; + const a = r.code ? s.width * n : r.metrics.width, l = r.code ? s.height * n : r.metrics.height; + this.width = a, this.height = l, o[0] = e, o[1] = i, o[2] = e + a, o[3] = i, o[4] = e, o[5] = i + l, o[6] = e + a, o[7] = i + l, this._data = o, this._setTextureCoords(s), this._scale = n, this._mosaic = r, this.x = e, this.y = i, this.maxOffset = Math.max(e + a, i + l); + } + get mosaic() { + return this._mosaic; + } + set angle(e) { + this._angle = e, yie(this._rotationT, -e), this._setOffsets(this._data); + } + get angle() { + return this._angle; + } + get xTopLeft() { + return this._data[0]; + } + get yTopLeft() { + return this._data[1]; + } + get xBottomRight() { + return this._data[6]; + } + get yBottomRight() { + return this._data[7]; + } + get texcoords() { + return this._texcoords; + } + get textureBinding() { + return this._mosaic.textureBinding; + } + get offsets() { + return this._offsets || this._setOffsets(this._data), this._offsets; + } + get char() { + return String.fromCharCode(this._mosaic.code); + } + get code() { + return this._mosaic.code; + } + get bounds() { + if (!this._bounds) { + const { height: e, width: i } = this._mosaic.metrics, r = i * this._scale, n = Math.abs(e) * this._scale, s = new Float32Array(8); + s[0] = this.x, s[1] = this.y, s[2] = this.x + r, s[3] = this.y, s[4] = this.x, s[5] = this.y + n, s[6] = this.x + r, s[7] = this.y + n; + const o = dU(e1(), this._rotationT, this._transform); + KAe(s, s, o); + let a = 1 / 0, l = 1 / 0, c = 0, h = 0; + for (let I = 0; I < 4; I++) { + const P = s[2 * I], F = s[2 * I + 1]; + a = Math.min(a, P), l = Math.min(l, F), c = Math.max(c, P), h = Math.max(h, F); + } + const p = c - a, y = h - l, v = a + p / 2, x = l + y / 2; + this._bounds = new KX(v, x, p, y); + } + return this._bounds; + } + setTransform(e) { + this._transform = e, this._offsets = null; + } + _setOffsets(e) { + this._offsets || (this._offsets = { upperLeft: 0, upperRight: 0, lowerLeft: 0, lowerRight: 0 }); + const i = this._offsets, r = new Float32Array(8), n = dU(e1(), this._rotationT, this._transform); + KAe(r, e, n), i.upperLeft = Vn(r[0] * b0, r[1] * b0), i.upperRight = Vn(r[2] * b0, r[3] * b0), i.lowerLeft = Vn(r[4] * b0, r[5] * b0), i.lowerRight = Vn(r[6] * b0, r[7] * b0); + } + _setTextureCoords({ x: e, y: i, width: r, height: n }) { + this._texcoords = { upperLeft: Vn(e, i), upperRight: Vn(e + r, i), lowerLeft: Vn(e, i + n), lowerRight: Vn(e + r, i + n) }; + } +}; +const WQi = (t, e) => ({ code: 0, page: 0, sdf: !0, rect: new Od(0, 0, 11, 8), textureBinding: e, metrics: { advance: 0, height: 4, width: t, left: 0, top: 0 } }); +function _q(t, e) { + return t.forEach((i) => x0(i, i, e)), { upperLeft: Vn(b0 * t[0][0], b0 * t[0][1]), upperRight: Vn(b0 * t[1][0], b0 * t[1][1]), lowerLeft: Vn(b0 * t[2][0], b0 * t[2][1]), lowerRight: Vn(b0 * t[3][0], b0 * t[3][1]) }; +} +let qQi = class { + constructor(e, i, r) { + this._rotation = 0, this._decorate(e, i, r), this.glyphs = e, this.bounds = this._createBounds(e), this.isMultiline = i.length > 1, this._hasRotation = r.angle !== 0, this._transform = this._createGlyphTransform(this.bounds, r), this._borderLineSize = r.borderLineSize, (r.borderLineSize || r.hasBackground) && ([this.bounds, this.background] = this.shapeBackground(this._transform)); + for (const n of e) + n.setTransform(this._transform); + } + setRotation(e) { + if (e === 0 && this._rotation === 0) + return; + this._rotation = e; + const i = this._transform, r = yie(e1(), e); + dU(i, r, i); + for (const n of this.glyphs) + n.setTransform(this._transform); + } + _decorate(e, i, r) { + if (!r.decoration || r.decoration === "none" || !e.length) + return; + const n = r.scale, s = r.decoration === "underline" ? GQi : UQi, o = e[0].textureBinding; + for (const a of i) { + const l = a.startX * n, c = a.startY * n, h = (a.width + a.glyphWidthEnd) * n; + e.push(new PRt(l, c + s * n, WQi(h, o), 1)); + } + } + shapeBackground(e) { + const i = dn(this._borderLineSize || 0), r = (HQi + i) / 2, n = this._borderLineSize ? r : 0, { xmin: s, ymin: o, xmax: a, ymax: l, x: c, y: h, width: p, height: y } = this.bounds, v = [s - qR, o - qR], x = [a + qR, o - qR], I = [s - qR, l + qR], P = [a + qR, l + qR], F = _q([[v[0] - r, v[1] - r], [x[0] + r, x[1] - r], [v[0] + n, v[1] + n], [x[0] - n, x[1] + n]], e), k = _q([[I[0] + n, I[1] - n], [P[0] - n, P[1] - n], [I[0] - r, I[1] + r], [P[0] + r, P[1] + r]], e), V = _q([[v[0] - r, v[1] - r], [v[0] + n, v[1] + n], [I[0] - r, I[1] + r], [I[0] + n, I[1] - n]], e), j = _q([[x[0] - n, x[1] + n], [x[0] + r, x[1] - r], [P[0] - n, P[1] - n], [P[0] + r, P[1] + r]], e), Y = { main: _q([v, x, I, P], e), top: F, bot: k, left: V, right: j }; + return [new KX(c, h, p + 2 * r, y + 2 * r), Y]; + } + get boundsT() { + const e = this.bounds, i = aa(cI(), e.x, e.y); + if (x0(i, i, this._transform), this._hasRotation) { + const r = Math.max(e.width, e.height); + return new KX(i[0], i[1], r, r); + } + return new KX(i[0], i[1], e.width, e.height); + } + _createBounds(e) { + let i = 1 / 0, r = 1 / 0, n = 0, s = 0; + for (const l of e) + i = Math.min(i, l.xTopLeft), r = Math.min(r, l.yTopLeft), n = Math.max(n, l.xBottomRight), s = Math.max(s, l.yBottomRight); + const o = n - i, a = s - r; + return new KX(i + o / 2, r + a / 2, o, a); + } + _createGlyphTransform(e, i) { + const r = zQi * i.angle, n = e1(), s = cI(); + return lF(n, n, aa(s, i.xOffset, -i.yOffset)), i.isCIM ? w$(n, n, r) : (lF(n, n, aa(s, e.x, e.y)), w$(n, n, r), lF(n, n, aa(s, -e.x, -e.y))), n; + } +}, Yoe = class { + constructor(e, i, r, n, s, o) { + this.glyphWidthEnd = 0, this.startX = 0, this.startY = 0, this.start = Math.max(0, Math.min(i, r)), this.end = Math.max(0, Math.max(i, r)), this.end < e.length && (this.glyphWidthEnd = e[this.end].metrics.width), this.width = n, this.yMin = s, this.yMax = o; + } +}; +const MMe = (t) => t === 10, Uit = (t) => t === 32; +function YQi(t, e, i) { + const r = new Array(), n = 1 / i.scale, s = i.maxLineWidth * n, o = e ? t.length - 1 : 0, a = e ? -1 : t.length, l = e ? -1 : 1; + let c = o, h = 0, p = 0, y = c, v = y, x = 0, I = 1 / 0, P = 0; + for (; c !== a; ) { + const { code: k, metrics: V } = t[c], j = Math.abs(V.top); + if (MMe(k) || Uit(k) || (I = Math.min(I, j), P = Math.max(P, j + V.height)), MMe(k)) + c !== o && (r.push(new Yoe(t, y, c - l, h, I, P)), I = 1 / 0, P = 0), h = 0, y = c + l, v = c + l, p = 0; + else if (Uit(k)) + v = c + l, p = 0, x = V.advance, h += V.advance; + else if (h > s) { + if (v !== y) { + const Y = v - 2 * l; + h -= x, r.push(new Yoe(t, y, Y, h - p, I, P)), I = 1 / 0, P = 0, y = v, h = p; + } else + r.push(new Yoe(t, y, c - l, h, I, P)), I = 1 / 0, P = 0, y = c, v = c, h = 0; + h += V.advance, p += V.advance; + } else + h += V.advance, p += V.advance; + c += l; + } + const F = new Yoe(t, y, c - l, h, I, P); + return F.start >= 0 && F.end < t.length && r.push(F), r; +} +function XQi(t, e) { + let i = 0; + for (let s = 0; s < t.length; s++) { + const { width: o } = t[s]; + i = Math.max(o, i); + } + const r = e.decoration === "underline" ? ARt : 0, n = t[0].yMin; + return { x: 0, y: n, height: t[t.length - 1].yMax + e.lineHeight * (t.length - 1) + r - n, width: i }; +} +function m9e(t, e, i) { + const r = i.scale, n = new Array(), s = YQi(t, e, i), o = XQi(s, i), { vAlign: a, hAlign: l } = i, c = a === Id.Baseline ? 1 : 0, h = c ? 0 : a - 1, p = (1 - c) * -o.y + h * (o.height / 2) + (c ? 1 : 0) * -f9e; + for (let y = 0; y < s.length; y++) { + const { start: v, end: x, width: I } = s[y]; + let P = -1 * (l + 1) * (I / 2) - Git; + const F = y * i.lineHeight + p - Git; + s[y].startX = P, s[y].startY = F; + for (let k = v; k <= x; k++) { + const V = t[k]; + if (MMe(V.code)) + continue; + const j = new PRt(P + V.metrics.left, F - V.metrics.top, V, r); + P += V.metrics.advance, n.push(j); + } + } + return new qQi(n, s, i); +} +const g5 = Math.PI / 180, KQi = 10, ORt = Ei.getLogger("esri.symbols.cim.CIMSymbolDrawHelper"); +let qN = class UT { + constructor(e) { + this._t = e; + } + static createIdentity() { + return new UT([1, 0, 0, 0, 1, 0]); + } + clone() { + const e = this._t; + return new UT(e.slice()); + } + transform(e) { + const i = this._t; + return [i[0] * e[0] + i[1] * e[1] + i[2], i[3] * e[0] + i[4] * e[1] + i[5]]; + } + static createScale(e, i) { + return new UT([e, 0, 0, 0, i, 0]); + } + scale(e, i) { + const r = this._t; + return r[0] *= e, r[1] *= e, r[2] *= e, r[3] *= i, r[4] *= i, r[5] *= i, this; + } + scaleRatio() { + return Math.sqrt(this._t[0] * this._t[0] + this._t[1] * this._t[1]); + } + static createTranslate(e, i) { + return new UT([0, 0, e, 0, 0, i]); + } + translate(e, i) { + const r = this._t; + return r[2] += e, r[5] += i, this; + } + static createRotate(e) { + const i = Math.cos(e), r = Math.sin(e); + return new UT([i, -r, 0, r, i, 0]); + } + rotate(e) { + return UT.multiply(this, UT.createRotate(e), this); + } + angle() { + const e = this._t[0], i = this._t[3], r = Math.sqrt(e * e + i * i); + return [e / r, i / r]; + } + static multiply(e, i, r) { + const n = e._t, s = i._t, o = n[0] * s[0] + n[3] * s[1], a = n[1] * s[0] + n[4] * s[1], l = n[2] * s[0] + n[5] * s[1] + s[2], c = n[0] * s[3] + n[3] * s[4], h = n[1] * s[3] + n[4] * s[4], p = n[2] * s[3] + n[5] * s[4] + s[5], y = r._t; + return y[0] = o, y[1] = a, y[2] = l, y[3] = c, y[4] = h, y[5] = p, r; + } + invert() { + const e = this._t; + let i = e[0] * e[4] - e[1] * e[3]; + if (i === 0) + return new UT([0, 0, 0, 0, 0, 0]); + i = 1 / i; + const r = (e[1] * e[5] - e[2] * e[4]) * i, n = (e[2] * e[3] - e[0] * e[5]) * i, s = e[4] * i, o = -e[1] * i, a = -e[3] * i, l = e[0] * i; + return new UT([s, o, r, a, l, n]); + } +}, g9e = class { + constructor(e, i) { + this._resourceManager = e, this._transfos = [], this._sizeTransfos = [], this._geomUnitsPerPoint = 1, this._placementPool = new EI(aH, void 0, void 0, 100), this._earlyReturn = !1, this._mapRotation = 0, this._transfos.push(i || qN.createIdentity()), this._sizeTransfos.push(i ? i.scaleRatio() : 1); + } + setTransform(e, i) { + this._transfos = [e || qN.createIdentity()], this._sizeTransfos = [i || (e ? e.scaleRatio() : 1)]; + } + setGeomUnitsPerPoint(e) { + this._geomUnitsPerPoint = e; + } + transformPt(e) { + return this._transfos[this._transfos.length - 1].transform(e); + } + transformSize(e) { + return e * this._sizeTransfos[this._sizeTransfos.length - 1]; + } + reverseTransformPt(e) { + return this._transfos[this._transfos.length - 1].invert().transform(e); + } + reverseTransformSize(e) { + return e / this._sizeTransfos[this._sizeTransfos.length - 1]; + } + getTransformAngle() { + return this._transfos[this._transfos.length - 1].angle(); + } + geomUnitsPerPoint() { + return this.isEmbedded() ? 1 : this._geomUnitsPerPoint; + } + isEmbedded() { + return this._transfos.length > 1; + } + back() { + return this._transfos[this._transfos.length - 1]; + } + push(e, i) { + const r = i ? e.scaleRatio() : 1; + qN.multiply(e, this.back(), e), this._transfos.push(e), this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length - 1] * r); + } + pop() { + this._transfos.splice(-1, 1), this._sizeTransfos.splice(-1, 1); + } + drawSymbol(e, i, r) { + if (e) + switch (e.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + this.drawMultiLayerSymbol(e, i); + break; + case "CIMTextSymbol": + this.drawTextSymbol(e, i, r); + } + } + drawMultiLayerSymbol(e, i) { + if (!e || !i) + return; + const r = e.symbolLayers; + if (!r) + return; + const n = e.effects; + if (n && n.length > 0) { + const s = this.executeEffects(n, i); + if (s) { + let o = s.next(); + for (; o; ) + this.drawSymbolLayers(r, o), o = s.next(); + } + } else + this.drawSymbolLayers(r, i); + } + executeEffects(e, i) { + const r = this._resourceManager.geometryEngine; + let n = new IMe(i); + for (const s of e) { + const o = OMe(s); + o && (n = o.execute(n, s, this.geomUnitsPerPoint(), null, r)); + } + return n; + } + drawSymbolLayers(e, i) { + let r = e.length; + for (; r--; ) { + const n = e[r]; + if (!n || n.enable === !1) + continue; + const s = n.effects; + if (s && s.length > 0) { + const o = this.executeEffects(s, i); + if (o) { + let a = null; + for (; (a = o.next()) && (this.drawSymbolLayer(n, a), !this._earlyReturn); ) + ; + } + } else + this.drawSymbolLayer(n, i); + if (this._earlyReturn) + return; + } + } + drawSymbolLayer(e, i) { + switch (e.type) { + case "CIMSolidFill": + this.drawSolidFill(i, e.color); + break; + case "CIMHatchFill": + this.drawHatchFill(i, e); + break; + case "CIMPictureFill": + this.drawPictureFill(i, e); + break; + case "CIMGradientFill": + this.drawGradientFill(i, e); + break; + case "CIMSolidStroke": + this.drawSolidStroke(i, e.color, e.width, e.capStyle, e.joinStyle, e.miterLimit); + break; + case "CIMPictureStroke": + this.drawPictureStroke(i, e); + break; + case "CIMGradientStroke": + this.drawGradientStroke(i, e); + break; + case "CIMCharacterMarker": + case "CIMPictureMarker": + case "CIMVectorMarker": + this.drawMarkerLayer(e, i); + } + } + drawHatchFill(e, i) { + const r = this._buildHatchPolyline(i, e, this.geomUnitsPerPoint()); + r && (this.pushClipPath(e), this.drawMultiLayerSymbol(i.lineSymbol, r), this.popClipPath()); + } + drawPictureFill(e, i) { + } + drawGradientFill(e, i) { + } + drawPictureStroke(e, i) { + } + drawGradientStroke(e, i) { + } + drawMarkerLayer(e, i) { + const r = e.markerPlacement; + if (r) { + const n = SRt(r); + if (n) { + const s = r.type === "CIMMarkerPlacementInsidePolygon" || r.type === "CIMMarkerPlacementPolygonCenter" && r.clipAtBoundary; + s && this.pushClipPath(i); + const o = n.execute(i, r, this.geomUnitsPerPoint(), null, this._resourceManager.geometryEngine); + if (o) { + let a = null; + for (; (a = o.next()) && (this.drawMarker(e, a), !this._earlyReturn); ) + ; + } + s && this.popClipPath(); + } + } else { + const n = this._placementPool.acquire(); + if (B0(i)) + n.tx = i.x, n.ty = i.y, this.drawMarker(e, n); + else if (za(i)) { + const s = hge(i); + s && ([n.tx, n.ty] = s, this.drawMarker(e, n)); + } else + for (const s of i.points) + if (n.tx = s[0], n.ty = s[1], this.drawMarker(e, n), this._earlyReturn) + break; + this._placementPool.release(n); + } + } + drawMarker(e, i) { + switch (e.type) { + case "CIMCharacterMarker": + case "CIMPictureMarker": + this.drawPictureMarker(e, i); + break; + case "CIMVectorMarker": + this.drawVectorMarker(e, i); + } + } + drawPictureMarker(e, i) { + if (!e) + return; + const r = this._resourceManager.getResource(e.url), n = e.size ?? 10; + if (ut(r) || n <= 0) + return; + const s = r.width, o = r.height; + if (!s || !o) + return; + const a = s / o, l = e.scaleX ?? 1, c = qN.createIdentity(), h = e.anchorPoint; + if (h) { + let P = h.x, F = h.y; + e.anchorPointUnits !== "Absolute" && (P *= n * a * l, F *= n), c.translate(-P, -F); + } + let p = e.rotation ?? 0; + e.rotateClockwise && (p = -p), this._mapRotation && (p += this._mapRotation), p && c.rotate(p * g5); + let y = e.offsetX ?? 0, v = e.offsetY ?? 0; + if (y || v) { + if (this._mapRotation) { + const P = g5 * this._mapRotation, F = Math.cos(P), k = Math.sin(P), V = y * k + v * F; + y = y * F - v * k, v = V; + } + c.translate(y, v); + } + const x = this.geomUnitsPerPoint(); + x !== 1 && c.scale(x, x); + const I = i.getAngle(); + I && c.rotate(I), c.translate(i.tx, i.ty), this.push(c, !1), this.drawImage(e, n), this.pop(); + } + drawVectorMarker(e, i) { + if (!e) + return; + const r = e.markerGraphics; + if (!r) + return; + const n = e.size ?? 10, s = e.frame, o = s ? s.ymax - s.ymin : 0, a = n && o ? n / o : 1, l = qN.createIdentity(); + s && l.translate(0.5 * -(s.xmax + s.xmin), 0.5 * -(s.ymax + s.ymin)); + const c = e.anchorPoint; + if (c) { + let I = c.x, P = c.y; + e.anchorPointUnits !== "Absolute" ? s && (I *= s.xmax - s.xmin, P *= s.ymax - s.ymin) : (I /= a, P /= a), l.translate(-I, -P); + } + a !== 1 && l.scale(a, a); + let h = e.rotation ?? 0; + e.rotateClockwise && (h = -h), this._mapRotation && (h += this._mapRotation), h && l.rotate(h * g5); + let p = e.offsetX ?? 0, y = e.offsetY ?? 0; + if (p || y) { + if (this._mapRotation) { + const I = g5 * this._mapRotation, P = Math.cos(I), F = Math.sin(I), k = p * F + y * P; + p = p * P - y * F, y = k; + } + l.translate(p, y); + } + const v = this.geomUnitsPerPoint(); + v !== 1 && l.scale(v, v); + const x = i.getAngle(); + x && l.rotate(x), l.translate(i.tx, i.ty), this.push(l, e.scaleSymbolsProportionally); + for (const I of r) + if (I && I.symbol && I.geometry || ORt.error("Invalid marker graphic", I), this.drawSymbol(I.symbol, I.geometry, I.textString), this._earlyReturn) + break; + this.pop(); + } + drawTextSymbol(e, i, r) { + if (!e || !B0(i) || (e.height ?? 10) <= 0) + return; + const n = qN.createIdentity(); + let s = e.angle ?? 0; + s = -s, s && n.rotate(s * g5); + const o = e.offsetX ?? 0, a = e.offsetY ?? 0; + (o || a) && n.translate(o, a); + const l = this.geomUnitsPerPoint(); + l !== 1 && n.scale(l, l), n.translate(i.x, i.y), this.push(n, !1), this.drawText(e, r), this.pop(); + } + _buildHatchPolyline(e, i, r) { + let n = (e.separation !== void 0 ? e.separation : 4) * r, s = e.rotation !== void 0 ? e.rotation : 0; + if (n === 0) + return null; + n < 0 && (n = -n); + let o = 0; + const a = 0.5 * n; + for (; o > a; ) + o -= n; + for (; o < -a; ) + o += n; + const l = Eo(); + OI(l, i), l[0] -= a, l[1] -= a, l[2] += a, l[3] += a; + const c = [[l[0], l[1]], [l[0], l[3]], [l[2], l[3]], [l[2], l[1]]]; + for (; s > 180; ) + s -= 180; + for (; s < 0; ) + s += 180; + const h = Math.cos(s * g5), p = Math.sin(s * g5), y = -n * p, v = n * h; + let x, I, P, F; + o = (e.offsetX !== void 0 ? e.offsetX * r : 0) * p - (e.offsetY !== void 0 ? e.offsetY * r : 0) * h, x = P = Number.MAX_VALUE, I = F = -Number.MAX_VALUE; + for (const re of c) { + const he = re[0], fe = re[1], be = h * he + p * fe, Se = -p * he + h * fe; + x = Math.min(x, be), P = Math.min(P, Se), I = Math.max(I, be), F = Math.max(F, Se); + } + P = Math.floor(P / n) * n; + let k = h * x - p * P - y * o / n, V = p * x + h * P - v * o / n, j = h * I - p * P - y * o / n, Y = p * I + h * P - v * o / n; + const X = 1 + Math.round((F - P) / n), Q = []; + for (let re = 0; re < X; re++) + k += y, V += v, j += y, Y += v, Q.push([[k, V], [j, Y]]); + return { paths: Q }; + } +}, JQi = class extends g9e { + constructor(e, i) { + super(e, i), this.reset(); + } + reset() { + this._xmin = this._ymin = 1 / 0, this._xmax = this._ymax = -1 / 0, this._clipCount = 0; + } + envelope() { + return new Wfe(this._xmin, this._ymin, this._xmax - this._xmin, this._ymax - this._ymin); + } + bounds() { + return Lhe(this._xmin, this._ymin, this._xmax, this._ymax); + } + drawSolidFill(e) { + if (e && !(this._clipCount > 0)) + if (za(e)) + this._processPath(e.rings, 0); + else if (ju(e)) + this._processPath(e.paths, 0); + else if (gc(e)) { + const i = Nk(e); + i && this._processPath(i.rings, 0); + } else + console.error("drawSolidFill Unexpected geometry type!"); + } + drawSolidStroke(e, i, r) { + if (!e || this._clipCount > 0) + return; + const n = 0.5 * this.transformSize(r ?? 0); + if (za(e)) + this._processPath(e.rings, n); + else if (ju(e)) + this._processPath(e.paths, n); + else if (gc(e)) { + const s = Nk(e); + s && this._processPath(s.rings, n); + } else + console.error("drawSolidStroke unexpected geometry type!"); + } + drawMarkerLayer(e, i) { + za(i) && e.markerPlacement && (e.markerPlacement.type === "CIMMarkerPlacementInsidePolygon" || e.markerPlacement.type === "CIMMarkerPlacementPolygonCenter" && e.markerPlacement.clipAtBoundary) ? this._processPath(i.rings, 0) : super.drawMarkerLayer(e, i); + } + drawHatchFill(e, i) { + this.drawSolidFill(e); + } + drawPictureFill(e, i) { + this.drawSolidFill(e); + } + drawGradientFill(e, i) { + this.drawSolidFill(e); + } + drawPictureStroke(e, i) { + this.drawSolidStroke(e, null, i.width); + } + drawGradientStroke(e, i) { + this.drawSolidStroke(e, null, i.width); + } + pushClipPath(e) { + this.drawSolidFill(e), this._clipCount++; + } + popClipPath() { + this._clipCount--; + } + drawImage(e, i) { + const { url: r } = e, n = e.scaleX ?? 1; + let s = n * i, o = i; + const a = this._resourceManager.getResource(r); + !i && _e(a) && (s = n * a.width, o = a.height), this._merge(this.transformPt([-s / 2, -o / 2]), 0), this._merge(this.transformPt([-s / 2, o / 2]), 0), this._merge(this.transformPt([s / 2, -o / 2]), 0), this._merge(this.transformPt([s / 2, o / 2]), 0); + } + drawText(e, i) { + if (!i || i.length === 0) + return; + this._textRasterizer || (this._textRasterizer = new CRt()); + const r = FRt(e), [n, s] = this._textRasterizer.computeTextSize(i, r); + let o = 0; + switch (e.horizontalAlignment) { + case "Left": + o = n / 2; + break; + case "Right": + o = -n / 2; + } + let a = 0; + switch (e.verticalAlignment) { + case "Bottom": + a = s / 2; + break; + case "Top": + a = -s / 2; + break; + case "Baseline": + a = s / 6; + } + this._merge(this.transformPt([-n / 2 + o, -s / 2 + a]), 0), this._merge(this.transformPt([-n / 2 + o, s / 2 + a]), 0), this._merge(this.transformPt([n / 2 + o, -s / 2 + a]), 0), this._merge(this.transformPt([n / 2 + o, s / 2 + a]), 0); + } + _processPath(e, i) { + if (e) + for (const r of e) { + const n = r ? r.length : 0; + if (n > 1) { + this._merge(this.transformPt(r[0]), i); + for (let s = 1; s < n; s++) + this._merge(this.transformPt(r[s]), i); + } + } + } + _merge(e, i) { + e[0] - i < this._xmin && (this._xmin = e[0] - i), e[0] + i > this._xmax && (this._xmax = e[0] + i), e[1] - i < this._ymin && (this._ymin = e[1] - i), e[1] + i > this._ymax && (this._ymax = e[1] + i); + } +}, ZQi = class extends g9e { + constructor() { + super(...arguments), this._searchPoint = [0, 0], this._searchDistPoint = 0, this._textInfo = null; + } + hitTest(e, i, r, n, s, o) { + const a = o * dn(1); + this.setTransform(), this.setGeomUnitsPerPoint(a), this._searchPoint = [(e[0] + e[2]) / 2, (e[1] + e[3]) / 2], this._searchDistPoint = (e[2] - e[0]) / 2 / a, this._textInfo = n; + const l = i && (i.type === "CIMPointSymbol" && i.angleAlignment !== "Map" || i.type === "CIMTextSymbol"); + return this._mapRotation = l ? s : 0, this._earlyReturn = !1, this.drawSymbol(i, r), this._earlyReturn; + } + drawSolidFill(e, i) { + this._hitTestFill(e); + } + drawHatchFill(e, i) { + this._hitTestFill(e); + } + drawPictureFill(e, i) { + this._hitTestFill(e); + } + drawGradientFill(e, i) { + this._hitTestFill(e); + } + drawSolidStroke(e, i, r, n, s, o) { + this._hitTestStroke(e, r); + } + drawPictureStroke(e, i) { + this._hitTestStroke(e, i.width); + } + drawGradientStroke(e, i) { + this._hitTestStroke(e, i.width); + } + drawMarkerLayer(e, i) { + e.markerPlacement && (e.markerPlacement.type === "CIMMarkerPlacementInsidePolygon" || e.markerPlacement.type === "CIMMarkerPlacementPolygonCenter" && e.markerPlacement.clipAtBoundary) ? this._hitTestFill(i) : super.drawMarkerLayer(e, i); + } + pushClipPath(e) { + } + popClipPath() { + } + drawImage(e, i) { + const { url: r } = e, n = e.scaleX ?? 1, s = this._resourceManager.getResource(r); + if (ut(s) || s.height === 0 || i === 0) + return; + const o = i * this.geomUnitsPerPoint(), a = o * n * (s.width / s.height), l = this.reverseTransformPt(this._searchPoint), c = this._searchDistPoint; + Math.abs(l[0]) < a / 2 + c && Math.abs(l[1]) < o / 2 + c && (this._earlyReturn = !0); + } + drawText(e, i) { + const r = this._textInfo; + if (!r) + return; + const n = r.get(e); + if (!n) + return; + const { text: s, mosaicItem: o } = n; + if (!o?.glyphMosaicItems?.length) + return; + const a = e.height ?? KQi, { lineGapType: l, lineGap: c } = e, h = l ? DRt(l, c ?? 0, a) : 0, p = c4(s)[1], y = o.glyphMosaicItems, v = e.callout?.type === "CIMBackgroundCallout", x = m9e(y, p, { scale: a / hve, angle: 0, xOffset: 0, yOffset: 0, hAlign: RRt(e.horizontalAlignment), vAlign: MRt(e.verticalAlignment), maxLineWidth: 512, lineHeight: I8e * Math.max(0.25, Math.min(h || 1, 4)), decoration: e.font.decoration || "none", isCIM: !0, hasBackground: v }), I = this.reverseTransformPt(this._searchPoint), P = I[0], F = I[1]; + for (const k of x.glyphs) + if (P > k.xTopLeft && P < k.xBottomRight && F > -k.yBottomRight && F < -k.yTopLeft) { + this._earlyReturn = !0; + break; + } + } + _hitTestFill(e) { + let i = null; + if (gc(e)) { + const n = e; + i = [[[n.xmin, n.ymin], [n.xmin, n.ymax], [n.xmax, n.ymax], [n.xmax, n.ymin], [n.xmin, n.ymin]]]; + } else if (za(e)) + i = e.rings; + else { + if (!ju(e)) + return; + i = e.paths; + } + const r = this.reverseTransformPt(this._searchPoint); + if (this._pointInPolygon(r, i) && (this._earlyReturn = !0), !this._earlyReturn) { + const n = this.reverseTransformSize(this._searchDistPoint) * this.geomUnitsPerPoint(); + this._nearLine(r, i, n) && (this._earlyReturn = !0); + } + } + _hitTestStroke(e, i) { + let r = null; + if (gc(e)) { + const a = e; + r = [[[a.xmin, a.ymin], [a.xmin, a.ymax], [a.xmax, a.ymax], [a.xmax, a.ymin], [a.xmin, a.ymin]]]; + } else if (za(e)) + r = e.rings; + else { + if (!ju(e)) + return; + r = e.paths; + } + const n = this.reverseTransformPt(this._searchPoint), s = (i ?? 0) * this.geomUnitsPerPoint(), o = this.reverseTransformSize(this._searchDistPoint) * this.geomUnitsPerPoint(); + this._nearLine(n, r, s / 2 + o) && (this._earlyReturn = !0); + } + _pointInPolygon(e, i) { + let r = 0; + for (const n of i) { + const s = n.length; + for (let o = 1; o < s; o++) { + const a = n[o - 1], l = n[o]; + a[1] > e[1] != l[1] > e[1] && ((l[0] - a[0]) * (e[1] - a[1]) - (l[1] - a[1]) * (e[0] - a[0]) > 0 ? r++ : r--); + } + } + return r !== 0; + } + _nearLine(e, i, r) { + for (const n of i) { + const s = n.length; + for (let o = 1; o < s; o++) { + const a = n[o - 1], l = n[o]; + let c = (l[0] - a[0]) * (l[0] - a[0]) + (l[1] - a[1]) * (l[1] - a[1]); + if (c === 0) + continue; + c = Math.sqrt(c); + const h = ((l[0] - a[0]) * (e[1] - a[1]) - (l[1] - a[1]) * (e[0] - a[0])) / c; + if (Math.abs(h) < r) { + const p = ((l[0] - a[0]) * (e[0] - a[0]) + (l[1] - a[1]) * (e[1] - a[1])) / c; + if (p > -r && p < c + r) + return !0; + } + } + } + return !1; + } +}, QQi = class extends g9e { + constructor(e, i, r, n) { + super(i, r), this._applyAdditionalRenderProps = n, this._colorSubstitutionHelper = new zZi(), this._ctx = e; + } + drawSolidFill(e, i) { + if (!e) + return; + if (za(e)) + this._buildPath(e.rings, !0); + else if (ju(e)) + this._buildPath(e.paths, !0); + else if (gc(e)) + this._buildPath(Nk(e).rings, !0); + else { + if (!Lg(e)) + return; + console.log("CanvasDrawHelper.drawSolidFill - No implementation!"); + } + const r = this._ctx; + r.fillStyle = typeof i == "string" ? i : "rgba(" + Math.round(i[0]) + "," + Math.round(i[1]) + "," + Math.round(i[2]) + "," + (i[3] ?? 255) / 255 + ")", r.fill("evenodd"); + } + drawSolidStroke(e, i, r, n, s, o) { + if (!e || !i || r === 0) + return; + if (za(e)) + this._buildPath(e.rings, !0); + else if (ju(e)) + this._buildPath(e.paths, !1); + else { + if (!gc(e)) + return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!"); + this._buildPath(Nk(e).rings, !0); + } + const a = this._ctx; + a.strokeStyle = typeof i == "string" ? i : "rgba(" + Math.round(i[0]) + "," + Math.round(i[1]) + "," + Math.round(i[2]) + "," + (i[3] ?? 255) / 255 + ")", a.lineWidth = Math.max(this.transformSize(r), 0.5), this._setCapStyle(n), this._setJoinStyle(s), a.miterLimit = o, a.stroke(); + } + pushClipPath(e) { + if (this._ctx.save(), za(e)) + this._buildPath(e.rings, !0); + else if (ju(e)) + this._buildPath(e.paths, !0); + else { + if (!gc(e)) + return; + this._buildPath(Nk(e).rings, !0); + } + this._ctx.clip("evenodd"); + } + popClipPath() { + this._ctx.restore(); + } + drawImage(e, i) { + const { colorSubstitutions: r, url: n, tintColor: s } = e, o = e.scaleX ?? 1, a = this._resourceManager.getResource(n); + if (ut(a)) + return; + let l = i * (a.width / a.height), c = i; + i || (l = a.width, c = a.height); + const h = $9(n) || "src" in a && $9(a.src); + let p = "getFrame" in a ? Yxe(a) : a; + r && (p = this._colorSubstitutionHelper.applyColorSubstituition(p, r)), this._applyAdditionalRenderProps && !h && s && (p = this._colorSubstitutionHelper.tintImageData(p, s)); + const y = this.transformPt([0, 0]), [v, x] = this.getTransformAngle(), I = this.transformSize(1), P = this._ctx; + P.save(), P.setTransform({ m11: o * I * v, m12: o * I * x, m21: -I * x, m22: I * v, m41: y[0], m42: y[1] }), P.drawImage(p, -l / 2, -c / 2, l, c), P.restore(); + } + drawText(e, i) { + if (!i || i.length === 0) + return; + this._textRasterizer || (this._textRasterizer = new CRt()); + const r = FRt(e); + r.size *= this.transformSize(A0(1)); + const n = this._textRasterizer.rasterizeText(i, r); + if (!n) + return; + const { size: s, anchorX: o, anchorY: a, canvas: l } = n, c = s[0] * (o + 0.5), h = s[1] * (a - 0.5), p = this._ctx, y = this.transformPt([0, 0]), [v, x] = this.getTransformAngle(), I = 1; + p.save(), p.setTransform({ m11: I * v, m12: I * x, m21: -I * x, m22: I * v, m41: y[0] - I * c, m42: y[1] + I * h }), p.drawImage(l, 0, 0), p.restore(); + } + drawPictureFill(e, i) { + if (!e) + return; + let { colorSubstitutions: r, height: n, offsetX: s, offsetY: o, rotation: a, scaleX: l, tintColor: c, url: h } = i; + const p = this._resourceManager.getResource(h); + if (ut(p)) + return; + if (za(e)) + this._buildPath(e.rings, !0); + else if (ju(e)) + this._buildPath(e.paths, !0); + else if (gc(e)) + this._buildPath(Nk(e).rings, !0); + else { + if (!Lg(e)) + return; + console.log("CanvasDrawHelper.drawPictureFill - No implementation!"); + } + const y = this._ctx, v = $9(h) || "src" in p && $9(p.src); + let x, I = "getFrame" in p ? Yxe(p) : p; + if (r && (I = this._colorSubstitutionHelper.applyColorSubstituition(I, r)), this._applyAdditionalRenderProps) { + v || c && (I = this._colorSubstitutionHelper.tintImageData(I, c)), x = y.createPattern(I, "repeat"); + const P = this.transformSize(1); + a || (a = 0), s ? s *= P : s = 0, o ? o *= P : o = 0, n && (n *= P); + const F = n ? n / p.height : 1, k = l && n ? l * n / p.width : 1; + if (a !== 0 || F !== 1 || k !== 1 || s !== 0 || o !== 0) { + const V = new DOMMatrix(); + V.rotateSelf(0, 0, -a).translateSelf(s, o).scaleSelf(k, F, 1), x.setTransform(V); + } + } else + x = y.createPattern(I, "repeat"); + y.save(), y.fillStyle = x, y.fill("evenodd"), y.restore(); + } + drawPictureStroke(e, i) { + if (!e) + return; + let { colorSubstitutions: r, capStyle: n, joinStyle: s, miterLimit: o, tintColor: a, url: l, width: c } = i; + const h = this._resourceManager.getResource(l); + if (ut(h)) + return; + let p; + if (za(e)) + p = e.rings; + else if (ju(e)) + p = e.paths; + else { + if (!gc(e)) + return Lg(e) ? void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!") : void 0; + p = Nk(e).rings; + } + c || (c = h.width); + const y = $9(l) || "src" in h && $9(h.src); + let v = "getFrame" in h ? Yxe(h) : h; + r && (v = this._colorSubstitutionHelper.applyColorSubstituition(v, r)), this._applyAdditionalRenderProps && (y || a && (v = this._colorSubstitutionHelper.tintImageData(v, a))); + const x = Math.max(this.transformSize(dn(c)), 0.5), I = x / v.width, P = this._ctx, F = P.createPattern(v, "repeat-y"); + let k, V; + P.save(), this._setCapStyle(n), this._setJoinStyle(s), o !== void 0 && (P.miterLimit = o), P.lineWidth = x; + for (let j of p) + if (j = fi(j), ier(j), j && !(j.length <= 1)) { + k = this.transformPt(j[0]); + for (let Y = 1; Y < j.length; Y++) { + V = this.transformPt(j[Y]); + const X = eer(k, V), Q = new DOMMatrix(); + Q.translateSelf(0, k[1] - x / 2).scaleSelf(I, I, 1).rotateSelf(0, 0, 90 - X), F.setTransform(Q), P.strokeStyle = F, P.beginPath(), P.moveTo(k[0], k[1]), P.lineTo(V[0], V[1]), P.stroke(), k = V; + } + } + P.restore(); + } + _buildPath(e, i) { + const r = this._ctx; + if (r.beginPath(), e) + for (const n of e) { + const s = n ? n.length : 0; + if (s > 1) { + let o = this.transformPt(n[0]); + r.moveTo(o[0], o[1]); + for (let a = 1; a < s; a++) + o = this.transformPt(n[a]), r.lineTo(o[0], o[1]); + i && r.closePath(); + } + } + } + _setCapStyle(e) { + switch (e) { + case TS.Butt: + this._ctx.lineCap = "butt"; + break; + case TS.Round: + this._ctx.lineCap = "round"; + break; + case TS.Square: + this._ctx.lineCap = "square"; + } + } + _setJoinStyle(e) { + switch (e) { + case ES.Bevel: + this._ctx.lineJoin = "bevel"; + break; + case ES.Round: + this._ctx.lineJoin = "round"; + break; + case ES.Miter: + this._ctx.lineJoin = "miter"; + } + } +}; +function eer(t, e) { + const i = e[0] - t[0], r = e[1] - t[1]; + return 180 / Math.PI * Math.atan2(r, i); +} +const Nk = (t) => t ? { spatialReference: t.spatialReference, rings: [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] } : null, RRt = (t) => { + switch (t) { + case "Left": + return Ed.Left; + case "Right": + return Ed.Right; + case "Center": + return Ed.Center; + case "Justify": + return ORt.warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."), Ed.Center; + } +}, MRt = (t) => { + switch (t) { + case "Top": + return Id.Top; + case "Center": + return Id.Center; + case "Bottom": + return Id.Bottom; + case "Baseline": + return Id.Baseline; + } +}, DRt = (t, e, i) => { + switch (t) { + case "ExtraLeading": + return 1 + e / i; + case "Multiple": + return e; + case "Exact": + return e / i; + } +}; +function FRt(t, e = 1) { + const i = nyt(t), r = ryt(t.fontStyleName), n = d9e(t.fontFamilyName), { weight: s, style: o } = r, a = e * (t.height || 5), l = syt(t.horizontalAlignment), c = oyt(t.verticalAlignment), h = h$(t), p = d$(t.haloSymbol), y = p ? e * (0 | t.haloSize) : 0; + return { color: h, size: a, horizontalAlignment: l, verticalAlignment: c, font: { family: n, style: nZt(o), weight: sZt(s), decoration: i }, halo: { size: y || 0, color: p, style: o }, pixelRatio: 1, premultiplyColors: !0 }; +} +const ter = 1e-4; +function ier(t) { + let e, i, r, n, s, o = t[0], a = 1; + for (; a < t.length; ) + e = t[a][0] - o[0], i = t[a][1] - o[1], n = e !== 0 ? i / e : Math.PI / 2, r !== void 0 && n - r <= ter ? (t.splice(a - 1, 1), o = s) : (s = o, o = t[a], a++), r = n; +} +function T8(t, e, i, r, n) { + if (ut(t)) + return null; + const s = t.referencesGeometry() && n ? rer(e, r, n) : e, o = t.repurposeFeature(s); + try { + return t.evaluate({ ...i, $feature: o }); + } catch (a) { + return Ei.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:", a), null; + } +} +const Xxe = /* @__PURE__ */ new Map(); +function rer(t, e, i) { + const { transform: r, hasZ: n, hasM: s } = i; + Xxe.has(e) || Xxe.set(e, ner(e)); + const o = Xxe.get(e)(t.geometry, r, n, s); + return { ...t, geometry: o }; +} +function ner(t) { + const e = {}; + switch (t) { + case "esriGeometryPoint": + return (i, r, n, s) => ELi(r, e, i, n, s); + case "esriGeometryPolygon": + return (i, r, n, s) => ILi(r, e, i, n, s); + case "esriGeometryPolyline": + return (i, r, n, s) => ALi(r, e, i, n, s); + case "esriGeometryMultipoint": + return (i, r, n, s) => TLi(r, e, i, n, s); + default: + return Ei.getLogger("esri.views.2d.support.arcadeOnDemand").error(new ot("mapview-arcade", `Unable to handle geometryType: ${t}`)), (i) => i; + } +} +const LRt = Math.PI, ser = LRt / 2, oer = 4, zit = 4, aer = 10, oT = 96 / 72, Hit = Math.PI / 180, DMe = Ei.getLogger("esri.symbols.cim.CIMSymbolHelper"); +function ler(t) { + if (!t || !t.type) + return null; + let e; + switch (t.type) { + case "cim": + return t.data; + case "web-style": + return t; + case "simple-marker": { + const i = wb.fromSimpleMarker(t); + if (!i) + return null; + e = i; + break; + } + case "picture-marker": + e = wb.fromPictureMarker(t); + break; + case "simple-line": + e = wb.fromSimpleLineSymbol(t); + break; + case "simple-fill": + e = wb.fromSimpleFillSymbol(t); + break; + case "picture-fill": + e = wb.fromPictureFillSymbol(t); + break; + case "text": + e = wb.fromTextSymbol(t); + } + return { type: "CIMSymbolReference", symbol: e }; +} +function bce(t, e, i) { + switch (e.type) { + case "CIMSymbolReference": + return bce(t, e.symbol, i); + case "CIMPointSymbol": + i == null && (i = { x: 0, y: 0 }), t.drawSymbol(e, i); + break; + case "CIMLineSymbol": + i == null && (i = { paths: [[[0, 0], [10, 0]]] }), t.drawSymbol(e, i); + break; + case "CIMPolygonSymbol": + i == null && (i = { rings: [[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]] }), t.drawSymbol(e, i); + break; + case "CIMTextSymbol": { + const r = { x: 0, y: 0 }; + t.drawSymbol(e, r); + break; + } + case "CIMVectorMarker": { + const r = new aH(); + t.drawMarker(e, r); + break; + } + } + return t.envelope(); +} +function uer(t) { + if (!t) + return 0; + switch (t.type) { + case "CIMMarkerPlacementAlongLineSameSize": + case "CIMMarkerPlacementAlongLineRandomSize": + case "CIMMarkerPlacementAtExtremities": + case "CIMMarkerPlacementAtMeasuredUnits": + case "CIMMarkerPlacementAtRatioPositions": + case "CIMMarkerPlacementOnLine": + case "CIMMarkerPlacementOnVertices": + return Math.abs(t.offset); + default: + return 0; + } +} +function cer(t) { + if (!t) + return 0; + switch (t.type) { + case "CIMGeometricEffectArrow": + return Math.abs(0.5 * t.width); + case "CIMGeometricEffectBuffer": + return Math.abs(t.size); + case "CIMGeometricEffectExtension": + case "CIMGeometricEffectRadial": + return Math.abs(t.length); + case "CIMGeometricEffectJog": + return Math.abs(0.5 * t.length); + case "CIMGeometricEffectMove": + return Math.max(Math.abs(To(t.offsetX)), Math.abs(To(t.offsetY))); + case "CIMGeometricEffectOffset": + case "CIMGeometricEffectOffsetTangent": + return Math.abs(t.offset); + case "CIMGeometricEffectRegularPolygon": + return Math.abs(t.radius); + case "CIMGeometricEffectRotate": + case "CIMGeometricEffectScale": + default: + return 0; + case "CIMGeometricEffectTaperedPolygon": + return 0.5 * Math.max(Math.abs(t.fromWidth), Math.abs(t.toWidth)); + case "CIMGeometricEffectWave": + return Math.abs(t.amplitude); + } +} +function Wit(t) { + if (!t) + return 0; + let e = 0; + for (const i of t) + e += cer(i); + return e; +} +let qit = class { + getSymbolInflateSize(e, i, r, n, s) { + return e || (e = [0, 0, 0, 0]), i ? this._getInflateSize(e, i, r, n, s) : e; + } + static safeSize(e) { + const i = Math.max(Math.abs(e[0]), Math.abs(e[2])), r = Math.max(Math.abs(e[1]), Math.abs(e[3])); + return Math.sqrt(i * i + r * r); + } + _vectorMarkerBounds(e, i, r, n) { + let s = !0; + const o = Eo(); + if (i && i.markerGraphics) + for (const a of i.markerGraphics) { + const l = [0, 0, 0, 0]; + a.geometry && (OI(o, a.geometry), l[0] = 0, l[1] = 0, l[2] = 0, l[3] = 0, this.getSymbolInflateSize(l, a.symbol, r, 0, n), o[0] += l[0], o[1] += l[1], o[2] += l[2], o[3] += l[3], s ? (e[0] = o[0], e[1] = o[1], e[2] = o[2], e[3] = o[3], s = !1) : (e[0] = Math.min(e[0], o[0]), e[1] = Math.min(e[1], o[1]), e[2] = Math.max(e[2], o[2]), e[3] = Math.max(e[3], o[3]))); + } + return e; + } + _getInflateSize(e, i, r, n, s) { + if (ger(i)) { + const o = this._getLayersInflateSize(e, i.symbolLayers, r, n, s), a = Wit(i.effects); + return a > 0 && (o[0] -= a, o[1] -= a, o[2] += a, o[3] += a), o; + } + return this._getTextInflatedSize(e, i, s); + } + _getLayersInflateSize(e, i, r, n, s) { + let o = !0; + if (!i) + return e; + for (const a of i) { + if (!a) + continue; + let l = [0, 0, 0, 0]; + switch (a.type) { + case "CIMSolidFill": + case "CIMPictureFill": + case "CIMHatchFill": + case "CIMGradientFill": + break; + case "CIMSolidStroke": + case "CIMPictureStroke": + case "CIMGradientStroke": { + const h = a; + let p = h.width; + p != null && (h.capStyle === TS.Square || h.joinStyle === ES.Miter ? p /= 1.4142135623730951 : p /= 2, l[0] = -p, l[1] = -p, l[2] = p, l[3] = p); + break; + } + case "CIMCharacterMarker": + case "CIMVectorMarker": + case "CIMPictureMarker": { + const h = a; + if (a.type === "CIMVectorMarker") { + const I = a; + if (l = this._vectorMarkerBounds(l, I, r, s), I.frame) { + const P = (I.frame.xmin + I.frame.xmax) / 2, F = (I.frame.ymin + I.frame.ymax) / 2; + if (l[0] -= P, l[1] -= F, l[2] -= P, l[3] -= F, I.size != null) { + const k = I.size / (I.frame.ymax - I.frame.ymin); + l[0] *= k, l[1] *= k, l[2] *= k, l[3] *= k; + } + } + } else if (a.type === "CIMPictureMarker") { + const I = a, P = r.getResource(I.url); + let F = 1; + if (_e(P) && P.height && (F = P.width / P.height), h.size != null) { + const k = h.size / 2, V = h.size * F * I.scaleX / 2; + l = [-V, -k, V, k]; + } + } else if (h.size != null) { + const I = h.size / 2; + l = [-I, -I, I, I]; + } + if (h.anchorPoint) { + let I, P; + h.anchorPointUnits === "Absolute" ? (I = h.anchorPoint.x, P = h.anchorPoint.y) : (I = h.anchorPoint.x * (l[2] - l[0]), P = h.anchorPoint.y * (l[3] - l[1])), l[0] -= I, l[1] -= P, l[2] -= I, l[3] -= P; + } + let p = To(h.rotation); + if (h.rotateClockwise && (p = -p), n && (p -= n), p) { + const I = Hit * p, P = Math.cos(I), F = Math.sin(I), k = Eo([yE, yE, -yE, -yE]); + kne(k, [l[0] * P - l[1] * F, l[0] * F + l[1] * P]), kne(k, [l[0] * P - l[3] * F, l[0] * F + l[3] * P]), kne(k, [l[2] * P - l[1] * F, l[2] * F + l[1] * P]), kne(k, [l[2] * P - l[3] * F, l[2] * F + l[3] * P]), l = k; + } + let y = To(h.offsetX), v = To(h.offsetY); + if (n) { + const I = Hit * n, P = Math.cos(I), F = Math.sin(I), k = y * F + v * P; + y = y * P - v * F, v = k; + } + l[0] += y, l[1] += v, l[2] += y, l[3] += v; + const x = uer(h.markerPlacement); + x > 0 && (l[0] -= x, l[1] -= x, l[2] += x, l[3] += x); + break; + } + } + const c = Wit(a.effects); + c > 0 && (l[0] -= c, l[1] -= c, l[2] += c, l[3] += c), o ? (e[0] = l[0], e[1] = l[1], e[2] = l[2], e[3] = l[3], o = !1) : (e[0] = Math.min(e[0], l[0]), e[1] = Math.min(e[1], l[1]), e[2] = Math.max(e[2], l[2]), e[3] = Math.max(e[3], l[3])); + } + return e; + } + _getTextInflatedSize(e, i, r) { + const n = i.height ?? aer; + if (e[0] = -n / 2, e[1] = -n / 2, e[2] = n / 2, e[3] = n / 2, !r) + return e; + const s = r.get(i); + if (!s) + return e; + const { text: o, mosaicItem: a } = s; + if (!a?.glyphMosaicItems?.length) + return e; + const { lineGapType: l, lineGap: c } = i, h = l ? DRt(l, c ?? 0, n) : 0, p = c4(o)[1], y = a.glyphMosaicItems, v = i.callout?.type === "CIMBackgroundCallout", x = m9e(y, p, { scale: n / hve, angle: To(i.angle), xOffset: To(i.offsetX), yOffset: To(i.offsetY), hAlign: RRt(i.horizontalAlignment), vAlign: MRt(i.verticalAlignment), maxLineWidth: 512, lineHeight: I8e * Math.max(0.25, Math.min(h || 1, 4)), decoration: i.font.decoration || "none", isCIM: !0, hasBackground: v }).boundsT; + return e[0] = x.x - x.halfWidth, e[1] = -x.y - x.halfHeight, e[2] = x.x + x.halfWidth, e[3] = -x.y + x.halfHeight, e; + } +}, wb = class FMe { + static getEnvelope(e, i, r) { + if (!e) + return null; + const n = new JQi(r); + if (Array.isArray(e)) { + let s; + for (const o of e) + s ? s.union(bce(n, o, i)) : s = bce(n, o, i); + return s; + } + return bce(n, e, i); + } + static getTextureAnchor(e, i) { + const r = this.getEnvelope(e, null, i); + if (!r) + return [0, 0, 0]; + const n = (r.x + 0.5 * r.width) * oT, s = (r.y + 0.5 * r.height) * oT, o = r.width * oT + 2, a = r.height * oT + 2; + return [-n / o, -s / a, a]; + } + static rasterize(e, i, r, n, s = !0) { + const o = r || this.getEnvelope(i, null, n); + if (!o) + return [null, 0, 0, 0, 0]; + const a = (o.x + 0.5 * o.width) * oT, l = (o.y + 0.5 * o.height) * oT; + e.width = o.width * oT, e.height = o.height * oT, r || (e.width += 2, e.height += 2); + const c = e.getContext("2d"), h = qN.createScale(oT, -oT); + h.translate(0.5 * e.width - a, 0.5 * e.height + l); + const p = new QQi(c, n, h); + switch (i.type) { + case "CIMPointSymbol": { + const x = { type: "point", x: 0, y: 0 }; + p.drawSymbol(i, x); + break; + } + case "CIMVectorMarker": { + const x = new aH(); + p.drawMarker(i, x); + break; + } + } + const y = c.getImageData(0, 0, e.width, e.height), v = new Uint8Array(y.data); + if (s) { + let x; + for (let I = 0; I < v.length; I += 4) + x = v[I + 3] / 255, v[I] = v[I] * x, v[I + 1] = v[I + 1] * x, v[I + 2] = v[I + 2] * x; + } + return [v, e.width, e.height, -a / e.width, -l / e.height]; + } + static fromTextSymbol(e) { + const { angle: i, color: r, font: n, haloColor: s, haloSize: o, horizontalAlignment: a, kerning: l, text: c, verticalAlignment: h, xoffset: p, yoffset: y, backgroundColor: v, borderLineColor: x, borderLineSize: I } = e; + let P, F, k, V, j, Y; + n && (P = n.family, F = n.style, k = n.weight, V = n.size, j = n.decoration); + let X = !1; + return c && (X = c4(c)[1]), (v || I) && (Y = { type: "CIMBackgroundCallout", margin: null, backgroundSymbol: { type: "CIMPolygonSymbol", symbolLayers: [{ type: "CIMSolidFill", color: n_(v) }, { type: "CIMSolidStroke", color: n_(x), width: I }] }, accentBarSymbol: null, gap: null, leaderLineSymbol: null, lineStyle: null }), { type: "CIMPointSymbol", symbolLayers: [{ type: "CIMVectorMarker", enable: !0, anchorPointUnits: "Relative", dominantSizeAxis3D: "Y", size: 10, billboardMode3D: "FaceNearPlane", frame: { xmin: -5, ymin: -5, xmax: 5, ymax: 5 }, markerGraphics: [{ type: "CIMMarkerGraphic", geometry: { x: 0, y: 0 }, symbol: { type: "CIMTextSymbol", angle: i, blockProgression: pRe.BTT, depth3D: 1, extrapolateBaselines: !0, fontEffects: cRe.Normal, fontEncoding: hRe.Unicode, fontFamilyName: P || "Arial", fontStyleName: per(F, k), fontType: dRe.Unspecified, haloSize: o, height: V, hinting: mRe.Default, horizontalAlignment: her(a ?? "center"), kerning: l, letterWidth: 100, ligatures: !0, lineGapType: "Multiple", offsetX: To(p), offsetY: To(y), strikethrough: j === "line-through", underline: j === "underline", symbol: { type: "CIMPolygonSymbol", symbolLayers: [{ type: "CIMSolidFill", enable: !0, color: n_(r) }] }, haloSymbol: { type: "CIMPolygonSymbol", symbolLayers: [{ type: "CIMSolidFill", enable: !0, color: n_(s) }] }, shadowColor: [0, 0, 0, 255], shadowOffsetX: 1, shadowOffsetY: 1, textCase: "Normal", textDirection: X ? dfe.RTL : dfe.LTR, verticalAlignment: der(h ?? "baseline"), verticalGlyphOrientation: gRe.Right, wordSpacing: 100, billboardMode3D: fRe.FaceNearPlane, callout: Y }, textString: c }], scaleSymbolsProportionally: !0, respectFrame: !0 }], scaleX: 1, angleAlignment: "Display" }; + } + static fromPictureFillSymbol(e) { + const { height: i, outline: r, width: n, xoffset: s, xscale: o, yoffset: a, yscale: l } = e, c = [], h = { type: "CIMPolygonSymbol", symbolLayers: c }; + if (r) { + const { cap: I, join: P, miterLimit: F, width: k } = r; + c.push({ type: "CIMSolidStroke", color: n_(r.color), capStyle: Kxe(I), joinStyle: Jxe(P), miterLimit: F, width: k }); + } + let p = e.url; + e.type === "esriPFS" && e.imageData && (p = e.imageData); + const y = "angle" in e ? e.angle ?? 0 : 0, v = (n ?? 0) * (o || 1), x = (i ?? 0) * (l || 1); + return c.push({ type: "CIMPictureFill", invertBackfaceTexture: !1, scaleX: 1, textureFilter: pfe.Picture, tintColor: null, url: p, height: x, width: v, offsetX: To(s), offsetY: To(a), rotation: To(-y), colorSubstitutions: null }), h; + } + static fromSimpleFillSymbol(e) { + const { color: i, style: r, outline: n } = e, s = [], o = { type: "CIMPolygonSymbol", symbolLayers: s }; + let a = null; + if (n) { + const { cap: l, join: c, style: h } = n; + h !== "solid" && h !== "none" && h !== "esriSLSSolid" && h !== "esriSLSNull" && (a = [{ type: "CIMGeometricEffectDashes", dashTemplate: LMe(h, l), lineDashEnding: "NoConstraint", scaleDash: !0, offsetAlongLine: null }]), s.push({ type: "CIMSolidStroke", color: n_(n.color), capStyle: Kxe(l), joinStyle: Jxe(c), miterLimit: n.miterLimit, width: n.width, effects: a }); + } + if (r && r !== "solid" && r !== "none" && r !== "esriSFSSolid" && r !== "esriSFSNull") { + const l = { type: "CIMLineSymbol", symbolLayers: [{ type: "CIMSolidStroke", color: n_(i), capStyle: TS.Butt, joinStyle: ES.Miter, width: 0.75 }] }; + let c = 0; + const h = A0(yer(r) ? 8 : 10); + switch (r) { + case "vertical": + case "esriSFSVertical": + c = 90; + break; + case "forward-diagonal": + case "esriSFSForwardDiagonal": + case "diagonal-cross": + case "esriSFSDiagonalCross": + c = -45; + break; + case "backward-diagonal": + case "esriSFSBackwardDiagonal": + c = 45; + break; + case "cross": + case "esriSFSCross": + c = 0; + } + s.push({ type: "CIMHatchFill", lineSymbol: l, offsetX: 0, offsetY: 0, rotation: c, separation: h }), r === "cross" || r === "esriSFSCross" ? s.push({ type: "CIMHatchFill", lineSymbol: fi(l), offsetX: 0, offsetY: 0, rotation: 90, separation: h }) : r !== "diagonal-cross" && r !== "esriSFSDiagonalCross" || s.push({ type: "CIMHatchFill", lineSymbol: fi(l), offsetX: 0, offsetY: 0, rotation: 45, separation: h }); + } else + !r || r !== "solid" && r !== "esriSFSSolid" || s.push({ type: "CIMSolidFill", enable: !0, color: n_(i) }); + return o; + } + static fromSimpleLineSymbol(e) { + const { cap: i, color: r, join: n, marker: s, miterLimit: o, style: a, width: l } = e; + let c = null; + a !== "solid" && a !== "none" && a !== "esriSLSSolid" && a !== "esriSLSNull" && (c = [{ type: "CIMGeometricEffectDashes", dashTemplate: LMe(a, i), lineDashEnding: "NoConstraint", scaleDash: !0, offsetAlongLine: null }]); + const h = []; + if (s) { + let p; + switch (s.placement) { + case "begin-end": + p = X_.Both; + break; + case "begin": + p = X_.JustBegin; + break; + case "end": + p = X_.JustEnd; + break; + default: + p = X_.None; + } + const y = FMe.fromSimpleMarker(s, l, r).symbolLayers[0]; + y.markerPlacement = { type: "CIMMarkerPlacementAtExtremities", angleToLine: !0, offset: 0, extremityPlacement: p, offsetAlongLine: 0 }, h.push(y); + } + return a !== "none" && a !== "esriSLSNull" && h.push({ type: "CIMSolidStroke", color: n_(r), capStyle: Kxe(i), joinStyle: Jxe(n), miterLimit: o, width: l, effects: c }), { type: "CIMLineSymbol", symbolLayers: h }; + } + static fromPictureMarker(e) { + const { angle: i, height: r, width: n, xoffset: s, yoffset: o } = e; + let a = e.url; + return e.type === "esriPMS" && e.imageData && (a = e.imageData), { type: "CIMPointSymbol", symbolLayers: [{ type: "CIMPictureMarker", invertBackfaceTexture: !1, scaleX: 1, textureFilter: pfe.Picture, tintColor: null, url: a, size: r, width: n, offsetX: To(s), offsetY: To(o), rotation: To(-i) }] }; + } + static fromSimpleMarker(e, i, r) { + const { style: n } = e, s = e.color ?? r; + if (n === "path") { + const c = []; + if ("outline" in e && e.outline) { + const y = e.outline; + c.push({ type: "CIMSolidStroke", enable: !0, width: dn(Math.round(A0(y.width))), color: n_(y.color) }); + } + c.push({ type: "CIMSolidFill", enable: !0, color: n_(s), path: e.path }); + const [h, p] = Yit("square"); + return { type: "CIMPointSymbol", symbolLayers: [{ type: "CIMVectorMarker", enable: !0, rotation: To(-e.angle), size: To(e.size || 6), offsetX: To(e.xoffset), offsetY: To(e.yoffset), frame: h, markerGraphics: [{ type: "CIMMarkerGraphic", geometry: p, symbol: { type: "CIMPolygonSymbol", symbolLayers: c } }] }] }; + } + const [o, a] = Yit(n); + let l; + if (a && o) { + const c = []; + if ("outline" in e && e.outline) { + const p = e.outline; + c.push({ type: "CIMSolidStroke", enable: !0, width: p.width != null && p.width > 0.667 ? dn(Math.round(A0(p.width))) : p.width, color: n_(p.color) }); + } else + !i || e.type !== "line-marker" || e.style !== "cross" && e.style !== "x" || c.push({ type: "CIMSolidStroke", enable: !0, width: i, color: n_(s) }); + c.push({ type: "CIMSolidFill", enable: !0, color: n_(s) }); + const h = { type: "CIMPolygonSymbol", symbolLayers: c }; + l = { type: "CIMPointSymbol", symbolLayers: [{ type: "CIMVectorMarker", enable: !0, rotation: To(-e.angle), size: To(e.size || 6 * i), offsetX: To(e.xoffset), offsetY: To(e.yoffset), frame: o, markerGraphics: [{ type: "CIMMarkerGraphic", geometry: a, symbol: h }] }] }; + } + return l; + } + static fromCIMHatchFill(e, i) { + const r = i * (e.separation ?? oer), n = r / 2, s = fi(e.lineSymbol); + s.symbolLayers?.forEach((l) => { + switch (l.type) { + case "CIMSolidStroke": + l.width != null && (l.width *= i), l.effects?.forEach((c) => { + c.type === "CIMGeometricEffectDashes" && (c.dashTemplate = c.dashTemplate.map((h) => h * i)); + }); + break; + case "CIMVectorMarker": { + l.size != null && (l.size *= i); + const c = l.markerPlacement; + c != null && "placementTemplate" in c && (c.placementTemplate = c.placementTemplate.map((h) => h * i)); + break; + } + } + }); + let o = this._getLineSymbolPeriod(s) || zit; + for (; o < zit; ) + o *= 2; + const a = o / 2; + return { type: "CIMVectorMarker", frame: { xmin: -a, xmax: a, ymin: -n, ymax: n }, markerGraphics: [{ type: "CIMMarkerGraphic", geometry: { paths: [[[-a, 0], [a, 0]]] }, symbol: s }], size: r }; + } + static fetchResources(e, i, r) { + if (e && i) + switch (e.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": { + const n = e.symbolLayers; + if (!n) + return; + for (const s of n) + switch (_er(s, i, r), s.type) { + case "CIMPictureFill": + case "CIMHatchFill": + case "CIMGradientFill": + case "CIMPictureStroke": + case "CIMGradientStroke": + case "CIMCharacterMarker": + case "CIMPictureMarker": + "url" in s && s.url && r.push(i.fetchResource(s.url, null)); + break; + case "CIMVectorMarker": { + const o = s.markerGraphics; + if (!o) + continue; + for (const a of o) + if (a) { + const l = a.symbol; + l && FMe.fetchResources(l, i, r); + } + } + } + } + } + } + static _getLineSymbolPeriod(e) { + if (e) { + const i = this._getEffectsRepeat(e.effects); + if (i) + return i; + if (e.symbolLayers) { + for (const r of e.symbolLayers) + if (r) { + const n = this._getEffectsRepeat(r.effects); + if (n) + return n; + switch (r.type) { + case "CIMCharacterMarker": + case "CIMPictureMarker": + case "CIMVectorMarker": + case "CIMObjectMarker3D": + case "CIMglTFMarker3D": { + const s = this._getPlacementRepeat(r.markerPlacement); + if (s) + return s; + } + } + } + } + } + return 0; + } + static _getEffectsRepeat(e) { + if (e) { + for (const i of e) + if (i) + switch (i.type) { + case "CIMGeometricEffectDashes": { + const r = i.dashTemplate; + if (r && r.length) { + let n = 0; + for (const s of r) + n += s; + return 1 & r.length && (n *= 2), n; + } + break; + } + case "CIMGeometricEffectWave": + return i.period; + default: + DMe.error(`unsupported geometric effect type ${i.type}`); + } + } + return 0; + } + static _getPlacementRepeat(e) { + if (e) + switch (e.type) { + case "CIMMarkerPlacementAlongLineSameSize": + case "CIMMarkerPlacementAlongLineRandomSize": + case "CIMMarkerPlacementAlongLineVariableSize": { + const i = e.placementTemplate; + if (i && i.length) { + let r = 0; + for (const n of i) + r += +n; + return 1 & i.length && (r *= 2), r; + } + break; + } + } + return 0; + } + static fromCIMInsidePolygon(e) { + const i = e.markerPlacement, r = { ...e }; + r.markerPlacement = null, r.anchorPoint = null; + const n = Math.abs(i.stepX), s = Math.abs(i.stepY), o = (i.randomness ?? 100) / 100; + let a, l, c, h; + if (i.gridType === "Random") { + const p = A0(HAt), y = Math.max(Math.floor(p / n), 1), v = Math.max(Math.floor(p / s), 1); + a = y * n / 2, l = v * s / 2, c = 2 * l; + const x = new VE(i.seed), I = o * n / 1.5, P = o * s / 1.5; + h = []; + for (let F = 0; F < y; F++) + for (let k = 0; k < v; k++) { + const V = F * n - a + I * (0.5 - x.getFloat()), j = k * s - l + P * (0.5 - x.getFloat()); + h.push({ x: V, y: j }), F === 0 && h.push({ x: V + 2 * a, y: j }), k === 0 && h.push({ x: V, y: j + 2 * l }); + } + } else + i.shiftOddRows === !0 ? (a = n / 2, l = s, c = 2 * s, h = [{ x: -a, y: 0 }, { x: a, y: 0 }, { x: 0, y: l }, { x: 0, y: -l }]) : (a = n / 2, l = s / 2, c = s, h = [{ x: -n, y: 0 }, { x: 0, y: -s }, { x: -n, y: -s }, { x: 0, y: 0 }, { x: n, y: 0 }, { x: 0, y: s }, { x: n, y: s }, { x: -n, y: s }, { x: n, y: -s }]); + return { type: "CIMVectorMarker", frame: { xmin: -a, xmax: a, ymin: -l, ymax: l }, markerGraphics: h.map((p) => ({ type: "CIMMarkerGraphic", geometry: p, symbol: { type: "CIMPointSymbol", symbolLayers: [r] } })), size: c }; + } + static getSize(e) { + if (e) + switch (e.type) { + case "CIMTextSymbol": + return e.height; + case "CIMPointSymbol": { + let i = 0; + if (e.symbolLayers) { + for (const r of e.symbolLayers) + if (r) + switch (r.type) { + case "CIMCharacterMarker": + case "CIMPictureMarker": + case "CIMVectorMarker": + case "CIMObjectMarker3D": + case "CIMglTFMarker3D": { + const n = r.size; + n != null && n > i && (i = n); + break; + } + } + } + return i; + } + case "CIMLineSymbol": + case "CIMPolygonSymbol": { + let i = 0; + if (e.symbolLayers) { + for (const r of e.symbolLayers) + if (r) + switch (r.type) { + case "CIMSolidStroke": + case "CIMPictureStroke": + case "CIMGradientStroke": { + const n = r.width; + n != null && n > i && (i = n); + break; + } + case "CIMCharacterMarker": + case "CIMPictureMarker": + case "CIMVectorMarker": + case "CIMObjectMarker3D": + case "CIMglTFMarker3D": + if (r.markerPlacement && tZt(r.markerPlacement)) { + const n = r.size; + n != null && n > i && (i = n); + } + } + } + return i; + } + } + } + static getMarkerScaleRatio(e) { + if (e && e.type === "CIMVectorMarker" && e.scaleSymbolsProportionally !== !1 && e.frame && e.size != null) { + const i = e.frame.ymax - e.frame.ymin; + return e.size / i; + } + return 1; + } +}, z$ = class xf { + static findApplicableOverrides(e, i, r) { + if (e && i) { + if (e.primitiveName) { + let n = !1; + for (const s of r) + if (s.primitiveName === e.primitiveName) { + n = !0; + break; + } + if (!n) + for (const s of i) + s.primitiveName === e.primitiveName && r.push(s); + } + switch (e.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + if (e.effects) + for (const n of e.effects) + xf.findApplicableOverrides(n, i, r); + if (e.symbolLayers) + for (const n of e.symbolLayers) + xf.findApplicableOverrides(n, i, r); + break; + case "CIMTextSymbol": + break; + case "CIMSolidStroke": + case "CIMPictureStroke": + case "CIMGradientStroke": + case "CIMSolidFill": + case "CIMPictureFill": + case "CIMHatchFill": + case "CIMGradientFill": + case "CIMVectorMarker": + case "CIMCharacterMarker": + case "CIMPictureMarker": + if (e.effects) + for (const n of e.effects) + xf.findApplicableOverrides(n, i, r); + if (e.markerPlacement && xf.findApplicableOverrides(e.markerPlacement, i, r), e.type === "CIMVectorMarker") { + if (e.markerGraphics) + for (const n of e.markerGraphics) + xf.findApplicableOverrides(n, i, r), xf.findApplicableOverrides(n.symbol, i, r); + } else + e.type === "CIMCharacterMarker" ? xf.findApplicableOverrides(e.symbol, i, r) : e.type === "CIMHatchFill" ? xf.findApplicableOverrides(e.lineSymbol, i, r) : e.type === "CIMPictureMarker" && xf.findApplicableOverrides(e.animatedSymbolProperties, i, r); + } + } + } + static findEffectOverrides(e, i, r) { + if (!i || !e) + return; + const n = e.length; + for (let s = 0; s < n; s++) { + const o = e[s]?.primitiveName; + if (o) { + let a = !1; + for (const l of r) + if (l.primitiveName === o) { + a = !0; + break; + } + if (!a) + for (const l of i) + l.primitiveName === o && r.push(l); + } + } + } + static async resolveSymbolOverrides(e, i, r, n, s, o, a) { + if (!e || !e.symbol) + return null; + let { symbol: l, primitiveOverrides: c } = e; + const h = !!c; + if (!h && !n) + return l; + l = fi(l); + let p = !0; + if (i || (i = { attributes: {} }, p = !1), h) { + if (p || (c = c.filter((y) => !y.valueExpressionInfo?.expression.includes("$feature"))), a || (c = c.filter((y) => !y.valueExpressionInfo?.expression.includes("$view"))), c.length > 0) { + const y = oZt(i.attributes); + await xf.evaluateOverrides(c, i, { spatialReference: r, fields: y, geometryType: s }, o, a); + } + xf.applyOverrides(l, c); + } + return n && xf.applyDictionaryTextOverrides(l, i, n), l; + } + static async evaluateOverrides(e, i, r, n, s) { + if (!i) + return; + let o; + for (const a of e) { + const l = a.valueExpressionInfo; + if (l && r && r.geometryType) { + o || (o = []), a.value = void 0; + const c = dge(l.expression, r.spatialReference, r.fields).then((h) => { + a.value = T8(h, i, { $view: s }, r.geometryType, n); + }); + o.push(c); + } + } + o !== void 0 && o.length > 0 && await Promise.all(o); + } + static applyDictionaryTextOverrides(e, i, r, n = "Normal") { + if (e && e.type) + switch (e.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + case "CIMTextSymbol": + { + const s = e.symbolLayers; + if (!s) + return; + for (const o of s) + o && o.type === "CIMVectorMarker" && xf.applyDictionaryTextOverrides(o, i, r, e.type === "CIMTextSymbol" ? e.textCase : n); + } + break; + case "CIMVectorMarker": + { + const s = e.markerGraphics; + if (!s) + return; + for (const o of s) + o && xf.applyDictionaryTextOverrides(o, i, r); + } + break; + case "CIMMarkerGraphic": { + const s = e.textString; + if (s && s.includes("[")) { + const o = eyt(s, r); + e.textString = tyt(i, o, n); + } + } + } + } + static applyOverrides(e, i, r, n) { + if (e.primitiveName) { + for (const s of i) + if (s.primitiveName === e.primitiveName) { + const o = ver(s.propertyName); + if (n && n.push({ cim: e, nocapPropertyName: o, value: e[o] }), s.expression && (s.value = xf.toValue(s.propertyName, s.expression)), r) { + let a = !1; + for (const l of r) + l.primitiveName === e.primitiveName && (a = !0); + a || r.push(s); + } + _e(s.value) && (e[o] = s.value); + } + } + switch (e.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + if (e.effects) + for (const s of e.effects) + xf.applyOverrides(s, i, r, n); + if (e.symbolLayers) + for (const s of e.symbolLayers) + xf.applyOverrides(s, i, r, n); + break; + case "CIMTextSymbol": + break; + case "CIMSolidStroke": + case "CIMSolidFill": + case "CIMVectorMarker": + if (e.effects) + for (const s of e.effects) + xf.applyOverrides(s, i, r, n); + if (e.type === "CIMVectorMarker" && e.markerGraphics) + for (const s of e.markerGraphics) + xf.applyOverrides(s, i, r, n), xf.applyOverrides(s.symbol, i, r, n); + } + } + static restoreOverrides(e) { + for (const i of e) + i.cim[i.nocapPropertyName] = i.value; + } + static buildOverrideKey(e) { + let i = ""; + for (const r of e) + r.value !== void 0 && (i += `${r.primitiveName}${r.propertyName}${JSON.stringify(r.value)}`); + return i; + } + static toValue(e, i) { + if (e === "DashTemplate") + return i.split(" ").map((r) => Number(r)); + if (e === "Color") { + const r = new Wr(i).toRgba(); + return r[3] *= 255, r; + } + return i; + } +}; +const Kxe = (t) => { + if (!t) + return TS.Butt; + switch (t) { + case "butt": + return TS.Butt; + case "square": + return TS.Square; + case "round": + return TS.Round; + } +}, Jxe = (t) => { + if (!t) + return ES.Miter; + switch (t) { + case "miter": + return ES.Miter; + case "round": + return ES.Round; + case "bevel": + return ES.Bevel; + } +}, her = (t) => { + if (ut(t)) + return "Center"; + switch (t) { + case "left": + return "Left"; + case "right": + return "Right"; + case "center": + return "Center"; + } +}, der = (t) => { + if (ut(t)) + return "Center"; + switch (t) { + case "baseline": + return "Baseline"; + case "top": + return "Top"; + case "middle": + return "Center"; + case "bottom": + return "Bottom"; + } +}, n_ = (t) => { + if (!t) + return [0, 0, 0, 0]; + const { r: e, g: i, b: r, a: n } = t; + return [e, i, r, 255 * n]; +}, per = (t, e) => { + const i = fer(e), r = mer(t); + return i && r ? `${i}-${r}` : `${i}${r}`; +}, fer = (t) => { + if (!t) + return ""; + switch (t.toLowerCase()) { + case "bold": + case "bolder": + return "bold"; + } + return ""; +}, mer = (t) => { + if (!t) + return ""; + switch (t.toLowerCase()) { + case "italic": + case "oblique": + return "italic"; + } + return ""; +}, LMe = (t, e) => { + const i = e === "butt"; + switch (t) { + case "dash": + case "esriSLSDash": + return i ? [4, 3] : [3, 4]; + case "dash-dot": + case "esriSLSDashDot": + return i ? [4, 3, 1, 3] : [3, 4, 0, 4]; + case "dot": + case "esriSLSDot": + return i ? [1, 3] : [0, 4]; + case "long-dash": + case "esriSLSLongDash": + return i ? [8, 3] : [7, 4]; + case "long-dash-dot": + case "esriSLSLongDashDot": + return i ? [8, 3, 1, 3] : [7, 4, 0, 4]; + case "long-dash-dot-dot": + case "esriSLSDashDotDot": + return i ? [8, 3, 1, 3, 1, 3] : [7, 4, 0, 4, 0, 4]; + case "short-dash": + case "esriSLSShortDash": + return i ? [4, 1] : [3, 2]; + case "short-dash-dot": + case "esriSLSShortDashDot": + return i ? [4, 1, 1, 1] : [3, 2, 0, 2]; + case "short-dash-dot-dot": + case "esriSLSShortDashDotDot": + return i ? [4, 1, 1, 1, 1, 1] : [3, 2, 0, 2, 0, 2]; + case "short-dot": + case "esriSLSShortDot": + return i ? [1, 1] : [0, 2]; + case "solid": + case "esriSLSSolid": + case "none": + return DMe.error("Unexpected: style does not require rasterization"), [0, 0]; + default: + return DMe.error(`Tried to rasterize SLS, but found an unexpected style: ${t}!`), [0, 0]; + } +}; +function ger(t) { + return t.symbolLayers !== void 0; +} +const Yit = (t) => { + let r, n; + const s = t; + if (s === "circle" || s === "esriSMSCircle") { + let a = Math.acos(0.995), l = Math.ceil(LRt / a / 4); + l === 0 && (l = 1), a = ser / l, l *= 4; + const c = []; + c.push([50, 0]); + for (let h = 1; h < l; h++) + c.push([50 * Math.cos(h * a), -50 * Math.sin(h * a)]); + c.push([50, 0]), r = { rings: [c] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }; + } else if (s === "cross" || s === "esriSMSCross") + r = { rings: [[[0, 50], [0, 0], [50, 0], [50, -0], [0, -0], [0, -50], [-0, -50], [-0, -0], [-50, -0], [-50, 0], [-0, 0], [-0, 50], [0, 50]]] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }; + else if (s === "diamond" || s === "esriSMSDiamond") + r = { rings: [[[-50, 0], [0, 50], [50, 0], [0, -50], [-50, 0]]] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }; + else if (s === "square" || s === "esriSMSSquare") + r = { rings: [[[-50, -50], [-50, 50], [50, 50], [50, -50], [-50, -50]]] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }; + else if (s === "x" || s === "esriSMSX") + r = { rings: [[[0, 0], [50 - 0, 50], [50, 50 - 0], [0, 0], [50, 0 - 50], [50 - 0, -50], [0, -0], [0 - 50, -50], [-50, 0 - 50], [-0, 0], [-50, 50 - 0], [0 - 50, 50], [0, 0]]] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }; + else if (s === "triangle" || s === "esriSMSTriangle") { + const o = 57.735026918962575, a = -o, l = 2 / 3 * 100, c = l - 100; + r = { rings: [[[a, c], [0, l], [o, c], [a, c]]] }, n = { xmin: a, ymin: c, xmax: o, ymax: l }; + } else + s === "arrow" && (r = { rings: [[[-50, 50], [50, 0], [-50, -50], [-33, -20], [-33, 20], [-50, 50]]] }, n = { xmin: -50, ymin: -50, xmax: 50, ymax: 50 }); + return [n, r]; +}, yer = (t) => t === "vertical" || t === "horizontal" || t === "cross" || t === "esriSFSCross" || t === "esriSFSVertical" || t === "esriSFSHorizontal", ver = (t) => t && t.charAt(0).toLowerCase() + t.substr(1); +function _er(t, e, i) { + if (!(!t.effects || _e(e.geometryEngine))) { + if (e.geometryEnginePromise) + return void i.push(e.geometryEnginePromise); + iZt(t.effects) && (e.geometryEnginePromise = rZt(), i.push(e.geometryEnginePromise), e.geometryEnginePromise.then((r) => e.geometryEngine = r)); + } +} +const Xit = 0.05; +function ber(t) { + return Math.max(Math.round(t / Xit), 1) * Xit; +} +const wer = /* @__PURE__ */ new Set(["StartTimeOffset", "Duration", "RepeatDelay"]); +function xer(t, e) { + return wer.has(e) ? ber(t) : t; +} +function y9e(t, e, i = 0) { + const r = ru(t, 0, Ter); + for (let n = 0; n < 4; n++) + e[i + n] = Math.floor(256 * Eer(r * Ser[n])); +} +function NRt(t, e = 0) { + let i = 0; + for (let r = 0; r < 4; r++) + i += t[e + r] * Cer[r]; + return i; +} +const Ser = [1, 256, 65536, 16777216], Cer = [1 / 256, 1 / 65536, 1 / 16777216, 1 / 4294967296], Ter = NRt(new Uint8ClampedArray([255, 255, 255, 255])); +function Eer(t) { + return t - Math.floor(t); +} +function NMe(t) { + if (!t) + return null; + switch (t.type) { + case "CIMPointSymbol": { + const e = t.symbolLayers; + return e && e.length === 1 ? NMe(e[0]) : null; + } + case "CIMVectorMarker": { + const e = t.markerGraphics; + if (!e || e.length !== 1) + return null; + const i = e[0]; + if (!i) + return null; + const r = i.geometry; + if (!r) + return null; + const n = i.symbol; + return !n || n.type !== "CIMPolygonSymbol" && n.type !== "CIMLineSymbol" || n.symbolLayers?.some((s) => !!s.effects) ? null : { geom: r, asFill: n.type === "CIMPolygonSymbol" }; + } + case "sdf": + return { geom: t.geom, asFill: t.asFill }; + } + return null; +} +function Ier(t) { + return t ? t.rings ? t.rings : t.paths ? t.paths : t.xmin !== void 0 && t.ymin !== void 0 && t.xmax !== void 0 && t.ymax !== void 0 ? [[[t.xmin, t.ymin], [t.xmin, t.ymax], [t.xmax, t.ymax], [t.xmax, t.ymin], [t.xmin, t.ymin]]] : null : null; +} +function Aer(t) { + let e = 1 / 0, i = -1 / 0, r = 1 / 0, n = -1 / 0; + for (const s of t) + for (const o of s) + o[0] < e && (e = o[0]), o[0] > i && (i = o[0]), o[1] < r && (r = o[1]), o[1] > n && (n = o[1]); + return new Wfe(e, r, i - e, n - r); +} +function Kit(t) { + let e = 1 / 0, i = -1 / 0, r = 1 / 0, n = -1 / 0; + for (const s of t) + for (const o of s) + o[0] < e && (e = o[0]), o[0] > i && (i = o[0]), o[1] < r && (r = o[1]), o[1] > n && (n = o[1]); + return [e, r, i, n]; +} +function kRt(t) { + return t ? t.rings ? Kit(t.rings) : t.paths ? Kit(t.paths) : gc(t) ? [t.xmin, t.ymin, t.xmax, t.ymax] : null : null; +} +function $Rt(t, e, i, r, n) { + const [s, o, a, l] = t; + if (a < s || l < o) + return [0, 0, 0]; + const c = a - s, h = l - o, p = 128, y = 1, v = Math.floor(0.5 * (0.5 * p - y)), x = (p - 2 * (v + y)) / Math.max(c, h), I = Math.round(c * x) + 2 * v, P = Math.round(h * x) + 2 * v; + let F = 1; + e && (F = P / x / (e.ymax - e.ymin)); + let k = 0, V = 0, j = 1; + r && (n ? e && i && e.ymax - e.ymin > 0 && (j = (e.xmax - e.xmin) / (e.ymax - e.ymin), k = r.x / (i * j), V = r.y / i) : (k = r.x, V = r.y)), e && (k = 0.5 * (e.xmax + e.xmin) + k * (e.xmax - e.xmin), V = 0.5 * (e.ymax + e.ymin) + V * (e.ymax - e.ymin)), k -= s, V -= o, k *= x, V *= x, k += v, V += v; + let Y = k / I - 0.5, X = V / P - 0.5; + return n && i && (Y *= i * j, X *= i), [F, Y, X]; +} +function Per(t) { + const e = Ier(t.geom), i = Aer(e), r = 128, n = 1, s = Math.floor(0.5 * (0.5 * r - n)), o = (r - 2 * (s + n)) / Math.max(i.width, i.height), a = Math.round(i.width * o) + 2 * s, l = Math.round(i.height * o) + 2 * s, c = []; + for (const p of e) + if (p && p.length > 1) { + const y = []; + for (const v of p) { + let [x, I] = v; + x -= i.x, I -= i.y, x *= o, I *= o, x += s - 0.5, I += s - 0.5, t.asFill ? y.push([x, I]) : y.push([Math.round(x), Math.round(I)]); + } + if (t.asFill) { + const v = y.length - 1; + y[0][0] === y[v][0] && y[0][1] === y[v][1] || y.push(y[0]); + } + c.push(y); + } + const h = Oer(c, a, l, s); + return t.asFill && Rer(c, a, l, s, h), [Mer(h, s), a, l]; +} +function Oer(t, e, i, r) { + const n = e * i, s = new Array(n), o = r * r + 1; + for (let a = 0; a < n; ++a) + s[a] = o; + for (const a of t) { + const l = a.length; + for (let c = 1; c < l; ++c) { + const h = a[c - 1], p = a[c]; + let y, v, x, I; + h[0] < p[0] ? (y = h[0], v = p[0]) : (y = p[0], v = h[0]), h[1] < p[1] ? (x = h[1], I = p[1]) : (x = p[1], I = h[1]); + let P = Math.floor(y) - r, F = Math.floor(v) + r, k = Math.floor(x) - r, V = Math.floor(I) + r; + P < 0 && (P = 0), F > e && (F = e), k < 0 && (k = 0), V > i && (V = i); + const j = p[0] - h[0], Y = p[1] - h[1], X = j * j + Y * Y; + for (let Q = P; Q < F; Q++) + for (let re = k; re < V; re++) { + let he, fe, be = (Q - h[0]) * j + (re - h[1]) * Y; + be < 0 ? (he = h[0], fe = h[1]) : be > X ? (he = p[0], fe = p[1]) : (be /= X, he = h[0] + be * j, fe = h[1] + be * Y); + const Se = (Q - he) * (Q - he) + (re - fe) * (re - fe), Me = (i - re - 1) * e + Q; + Se < s[Me] && (s[Me] = Se); + } + } + } + for (let a = 0; a < n; ++a) + s[a] = Math.sqrt(s[a]); + return s; +} +function Rer(t, e, i, r, n) { + for (const s of t) { + const o = s.length; + for (let a = 1; a < o; ++a) { + const l = s[a - 1], c = s[a]; + let h, p, y, v; + l[0] < c[0] ? (h = l[0], p = c[0]) : (h = c[0], p = l[0]), l[1] < c[1] ? (y = l[1], v = c[1]) : (y = c[1], v = l[1]); + let x = Math.floor(h), I = Math.floor(p) + 1, P = Math.floor(y), F = Math.floor(v) + 1; + x < r && (x = r), I > e - r && (I = e - r), P < r && (P = r), F > i - r && (F = i - r); + for (let k = P; k < F; ++k) { + if (l[1] > k == c[1] > k) + continue; + const V = (i - k - 1) * e; + for (let j = x; j < I; ++j) + j < (c[0] - l[0]) * (k - l[1]) / (c[1] - l[1]) + l[0] && (n[V + j] = -n[V + j]); + for (let j = r; j < x; ++j) + n[V + j] = -n[V + j]; + } + } + } +} +function Mer(t, e) { + const i = 2 * e, r = t.length, n = new Uint8Array(4 * r); + for (let s = 0; s < r; ++s) { + const o = 0.5 - t[s] / i; + y9e(o, n, 4 * s); + } + return n; +} +const Der = 96 / 72; +let rZ = class { + static executeEffects(e, i, r, n) { + const s = K3t(i), o = Der; + let a = new IMe(s); + for (const l of e) { + const c = OMe(l); + c && (a = c.execute(a, l, o, r, n)); + } + return a; + } + static next(e) { + const i = e.next(); + return WZi(i), i; + } + static applyEffects(e, i, r) { + if (!e) + return i; + let n = new IMe(i); + for (const a of e) { + const l = OMe(a); + l && (n = l.execute(n, a, 1, null, r)); + } + let s, o = null; + for (; s = n.next(); ) + o ? ju(o) ? ju(s) && o.paths.push(...s.paths) : za(o) && za(s) && o.rings.push(...s.rings) : o = s; + return o; + } +}; +function BRt(t, e) { + let i; + if (typeof t == "string") + i = ih(t + `-seed(${e})`); + else { + let r = 12; + i = t ^ e; + do + i = 107 * (i >> 8 ^ i) + r | 0; + while (--r != 0); + } + return (1 + i / (1 << 31)) / 2; +} +function VRt(t) { + return Math.floor(BRt(t, Fer) * Ler); +} +const Fer = 53290320, Ler = 10, jRt = Ei.getLogger("esri.symbols.cim.cimAnalyzer"); +function v9e(t) { + switch (t) { + case "Butt": + return Pf.BUTT; + case "Square": + return Pf.SQUARE; + default: + return Pf.ROUND; + } +} +function _9e(t) { + switch (t) { + case "Bevel": + return om.BEVEL; + case "Miter": + return om.MITER; + default: + return om.ROUND; + } +} +function Jit(t, e, i, r) { + let n; + t[e] ? n = t[e] : (n = {}, t[e] = n), n[i] = r; +} +function Zit(t) { + const e = t.markerPlacement; + return e && e.angleToLine ? vy.MAP : vy.SCREEN; +} +async function Ner(t, e, i, r, n) { + const s = r ?? []; + if (!t) + return s; + let o, a; + const l = {}; + if (t.type !== "CIMSymbolReference") + return jRt.error("Expect cim type to be 'CIMSymbolReference'"), s; + if (o = t.symbol, a = t.primitiveOverrides, a) { + const h = []; + for (const p of a) { + const y = p.valueExpressionInfo; + if (y && e) { + const v = y.expression, x = dge(v, e.spatialReference, e.fields).then((I) => { + ut(I) || Jit(l, p.primitiveName, p.propertyName, I); + }); + h.push(x); + } else + p.value != null && Jit(l, p.primitiveName, p.propertyName, p.value); + } + h.length > 0 && await Promise.all(h); + } + const c = []; + switch (wb.fetchResources(o, i, c), c.length > 0 && await Promise.all(c), o?.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + ker(o, a, l, e, s, i, !!n); + } + return s; +} +function ker(t, e, i, r, n, s, o) { + if (!t) + return; + const a = t.symbolLayers; + if (!a) + return; + const l = t.effects; + let c = vy.SCREEN; + const h = wb.getSize(t) ?? 0; + t.type === "CIMPointSymbol" && t.angleAlignment === "Map" && (c = vy.MAP); + let p = a.length; + for (; p--; ) { + const y = a[p]; + if (!y || y.enable === !1) + continue; + let v; + l && l.length && (v = [...l]); + const x = y.effects; + x && x.length && (l ? v.push(...x) : v = [...x]); + const I = []; + let P; + z$.findEffectOverrides(v, e, I), P = I.length > 0 ? Jer(v, I, i, r) : v; + const F = []; + switch (z$.findApplicableOverrides(y, e, F), y.type) { + case "CIMSolidFill": + $er(y, P, i, F, r, n); + break; + case "CIMPictureFill": + Ber(y, P, i, F, r, s, n); + break; + case "CIMHatchFill": + Ver(y, P, i, F, r, n); + break; + case "CIMGradientFill": + jer(y, P, i, F, r, n); + break; + case "CIMSolidStroke": + Ger(y, P, i, F, r, n, t.type === "CIMPolygonSymbol", h); + break; + case "CIMPictureStroke": + Uer(y, P, i, F, r, n, t.type === "CIMPolygonSymbol", h); + break; + case "CIMGradientStroke": + zer(y, P, i, F, r, n, t.type === "CIMPolygonSymbol", h); + break; + case "CIMCharacterMarker": + if (Zxe(y, P, i, F, r, n)) + break; + break; + case "CIMPictureMarker": + if (Zxe(y, P, i, F, r, n)) + break; + t.type === "CIMLineSymbol" && (c = Zit(y)), Her(y, P, i, F, r, s, n, c, h); + break; + case "CIMVectorMarker": + if (Zxe(y, P, i, F, r, n)) + break; + t.type === "CIMLineSymbol" && (c = Zit(y)), Wer(y, P, i, F, r, n, s, c, h, o); + break; + default: + jRt.error("Cannot analyze CIM layer", y.type); + } + } +} +function $er(t, e, i, r, n, s) { + const o = t.primitiveName, a = xb(t.color), [l, c] = vx(r, o, e, null, null), h = ih(JSON.stringify(t) + c).toString(); + s.push({ type: "fill", templateHash: h, materialHash: l ? () => h : h, cim: t, materialOverrides: null, colorLocked: !!t.colorLocked, color: to(o, i, "Color", n, a, iC), height: 0, angle: 0, offsetX: 0, offsetY: 0, scaleX: 1, effects: e, applyRandomOffset: !1, sampleAlphaOnly: !0 }); +} +function Ber(t, e, i, r, n, s, o) { + const a = t.primitiveName, l = Zge(t), [c, h] = vx(r, a, e, null, null), p = ih(JSON.stringify(t) + h).toString(), y = ih(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(); + let v = To(t.scaleX); + if ("width" in t && typeof t.width == "number") { + const x = t.width; + let I = 1; + const P = s.getResource(t.url); + _e(P) && (I = P.width / P.height), v /= I * (t.height / x); + } + o.push({ type: "fill", templateHash: p, materialHash: c ? () => y : y, cim: t, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, color: to(a, i, "TintColor", n, l, iC), height: to(a, i, "Height", n, t.height), scaleX: to(a, i, "ScaleX", n, v), angle: to(a, i, "Rotation", n, To(t.rotation)), offsetX: to(a, i, "OffsetX", n, To(t.offsetX)), offsetY: to(a, i, "OffsetY", n, To(t.offsetY)), url: t.url, applyRandomOffset: !1, sampleAlphaOnly: !1 }); +} +function Ver(t, e, i, r, n, s) { + const o = ["Rotation", "OffsetX", "OffsetY"], a = r.filter((P) => P.primitiveName !== t.primitiveName || !o.includes(P.propertyName)), l = t.primitiveName; + let [c, h] = vx(r, l, e, null, null); + const p = ih(JSON.stringify(t) + h).toString(), y = ih(`${t.separation}${JSON.stringify(t.lineSymbol)}`).toString(); + let v = { r: 255, g: 255, b: 255, a: 1 }, x = !1; + const I = t.lineSymbol?.symbolLayers?.find((P) => P.type === "CIMSolidStroke" && i[P.primitiveName]?.Color != null); + if (I) { + v = xb(I.color), v = to(I.primitiveName, i, "Color", n, v, iC); + const P = typeof v == "function"; + c = c || P, x = I.color != null || P; + } + s.push({ type: "fill", templateHash: p, materialHash: c ? tre(y, i, a, n) : y, cim: t, materialOverrides: a, colorLocked: !!t.colorLocked, effects: e, color: v, height: to(l, i, "Separation", n, t.separation), scaleX: 1, angle: to(l, i, "Rotation", n, To(t.rotation)), offsetX: to(l, i, "OffsetX", n, To(t.offsetX)), offsetY: to(l, i, "OffsetY", n, To(t.offsetY)), applyRandomOffset: !1, sampleAlphaOnly: !0, hasUnresolvedReplacementColor: !x }); +} +function jer(t, e, i, r, n, s) { + const o = t.primitiveName, [a, l] = vx(r, o, e, null, null), c = ih(JSON.stringify(t) + l).toString(); + s.push({ type: "fill", templateHash: c, materialHash: a ? tre(c, i, r, n) : c, cim: t, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, color: { r: 128, g: 128, b: 128, a: 1 }, height: 0, angle: 0, offsetX: 0, offsetY: 0, scaleX: 1, applyRandomOffset: !1, sampleAlphaOnly: !1 }); +} +function Ger(t, e, i, r, n, s, o, a) { + const l = t.primitiveName, c = xb(t.color), h = t.width != null ? t.width : 4, p = v9e(t.capStyle), y = _9e(t.joinStyle), v = t.miterLimit, [x, I] = vx(r, l, e, null, null), P = ih(JSON.stringify(t) + I).toString(); + let F, k; + if (e && e instanceof Array && e.length > 0) { + const V = e[e.length - 1]; + if (V.type === "CIMGeometricEffectDashes" && V.lineDashEnding === "NoConstraint" && V.offsetAlongLine === null) { + const j = (e = [...e]).pop(); + F = j.dashTemplate, k = j.scaleDash; + } + } + s.push({ type: "line", templateHash: P, materialHash: x ? () => P : P, cim: t, materialOverrides: null, isOutline: o, colorLocked: !!t.colorLocked, effects: e, color: to(l, i, "Color", n, c, iC), width: to(l, i, "Width", n, h), cap: to(l, i, "CapStyle", n, p), join: to(l, i, "JoinStyle", n, y), miterLimit: v && to(l, i, "MiterLimit", n, v), referenceWidth: a, zOrder: b9e(t.name), dashTemplate: F, scaleDash: k, sampleAlphaOnly: !0 }); +} +function Uer(t, e, i, r, n, s, o, a) { + const l = ih(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(), c = t.primitiveName, h = Zge(t), p = t.width != null ? t.width : 4, y = v9e(t.capStyle), v = _9e(t.joinStyle), x = t.miterLimit, [I, P] = vx(r, c, e, null, null), F = ih(JSON.stringify(t) + P).toString(); + s.push({ type: "line", templateHash: F, materialHash: I ? () => l : l, cim: t, materialOverrides: null, isOutline: o, colorLocked: !!t.colorLocked, effects: e, color: to(c, i, "TintColor", n, h, iC), width: to(c, i, "Width", n, p), cap: to(c, i, "CapStyle", n, y), join: to(c, i, "JoinStyle", n, v), miterLimit: x && to(c, i, "MiterLimit", n, x), referenceWidth: a, zOrder: b9e(t.name), dashTemplate: null, scaleDash: !1, url: t.url, sampleAlphaOnly: !1 }); +} +function zer(t, e, i, r, n, s, o, a) { + const l = t.primitiveName, c = t.width != null ? t.width : 4, h = v9e(t.capStyle), p = _9e(t.joinStyle), y = t.miterLimit, [v, x] = vx(r, l, e, null, null), I = ih(JSON.stringify(t) + x).toString(); + s.push({ type: "line", templateHash: I, materialHash: v ? tre(I, i, r, n) : I, cim: t, materialOverrides: null, isOutline: o, colorLocked: !!t.colorLocked, effects: e, color: { r: 128, g: 128, b: 128, a: 1 }, width: to(l, i, "Width", n, c), cap: to(l, i, "CapStyle", n, h), join: to(l, i, "JoinStyle", n, p), miterLimit: y && to(l, i, "MiterLimit", n, y), referenceWidth: a, zOrder: b9e(t.name), dashTemplate: null, scaleDash: !1, sampleAlphaOnly: !1 }); +} +function Zxe(t, e, i, r, n, s) { + const { markerPlacement: o, type: a } = t; + if (!o || o.type !== "CIMMarkerPlacementInsidePolygon") + return !1; + if (a === "CIMVectorMarker" || a === "CIMPictureMarker") { + const Y = t.primitiveName; + if (Y) { + const [Q, re] = vx(r, Y, e, null, null); + if (Q) + return !1; + } + const X = o.primitiveName; + if (X) { + const [Q, re] = vx(r, X, e, null, null); + if (Q) + return !1; + } + if (a === "CIMVectorMarker") { + const { markerGraphics: Q } = t; + if (Q) + for (const re of Q) { + const { symbol: he } = re; + if (he?.type === "CIMPolygonSymbol" && he.symbolLayers) { + const { symbolLayers: fe } = he; + for (const be of fe) + if (be.type === "CIMSolidStroke") + return !1; + } + } + } else { + const { animatedSymbolProperties: Q } = t; + if (Q) + return !1; + } + } + const l = o, c = Math.abs(l.stepX), h = Math.abs(l.stepY); + if (c === 0 || h === 0) + return !0; + const p = ["Rotation", "OffsetX", "OffsetY"], y = r.filter((Y) => Y.primitiveName !== t.primitiveName || !p.includes(Y.propertyName)), v = "url" in t && typeof t.url == "string" ? t.url : void 0, [x, I] = vx(r, l.primitiveName, e, null, null), P = ih(JSON.stringify(t) + I).toString(); + let F, k, V = null; + if (o.gridType === "Random") { + const Y = A0(HAt), X = Math.max(Math.floor(Y / c), 1), Q = Math.max(Math.floor(Y / h), 1); + F = h * Q, V = (re) => re ? re * Q : 0, k = X * c / F; + } else + o.shiftOddRows ? (F = 2 * h, V = (Y) => Y ? 2 * Y : 0, k = c / h * 0.5) : (F = h, V = null, k = c / h); + const j = Zge(t); + return s.push({ type: "fill", templateHash: P, materialHash: x ? tre(P, i, y, n) : P, cim: t, materialOverrides: y, colorLocked: !!t.colorLocked, effects: e, color: to(l.primitiveName, i, "TintColor", n, j, iC), height: to(l.primitiveName, i, "StepY", n, F, V), scaleX: k, angle: to(l.primitiveName, i, "GridAngle", n, l.gridAngle), offsetX: to(l.primitiveName, i, "OffsetX", n, To(l.offsetX)), offsetY: to(l.primitiveName, i, "OffsetY", n, To(l.offsetY)), url: v, applyRandomOffset: o.gridType === "Random", sampleAlphaOnly: !v, hasUnresolvedReplacementColor: !0 }), !0; +} +function Her(t, e, i, r, n, s, o, a, l) { + const c = t.primitiveName, h = To(t.size); + let p = To(t.scaleX, 1); + const y = To(t.rotation), v = To(t.offsetX), x = To(t.offsetY), I = Zge(t), P = ih(`${t.url}${JSON.stringify(t.colorSubstitutions)}${JSON.stringify(t.animatedSymbolProperties)}`).toString(), F = GRt(t.markerPlacement, r, i, n), k = Zer(t.animatedSymbolProperties, r, i, n), [V, j] = vx(r, c, e, F, k), Y = ih(JSON.stringify(t) + j).toString(), X = t.anchorPoint ?? { x: 0, y: 0 }; + if ("width" in t && typeof t.width == "number") { + const he = t.width; + let fe = 1; + const be = s.getResource(t.url); + _e(be) && (fe = be.width / be.height), p /= fe * (h / he); + } + function Q(he, fe) { + return _e(k) ? Hj(k, he, fe) : null; + } + const re = t.animatedSymbolProperties && t.animatedSymbolProperties.randomizeStartTime === !0 ? (he, fe, be, Se) => { + const Me = VRt(Se ?? 0), ke = Q(he, fe); + return P + `-MATERIALGROUP(${Me})-ASP(${JSON.stringify(ke)})`; + } : V ? (he, fe) => { + const be = Q(he, fe); + return P + `-ASP(${JSON.stringify(be)})`; + } : P; + o.push({ type: "marker", templateHash: Y, materialHash: re, cim: t, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, scaleSymbolsProportionally: !1, alignment: a, size: to(c, i, "Size", n, h), scaleX: to(c, i, "ScaleX", n, p), rotation: to(c, i, "Rotation", n, y), offsetX: to(c, i, "OffsetX", n, v), offsetY: to(c, i, "OffsetY", n, x), color: to(c, i, "TintColor", n, I, iC), anchorPoint: { x: X.x, y: -X.y }, isAbsoluteAnchorPoint: t.anchorPointUnits !== "Relative", outlineColor: { r: 0, g: 0, b: 0, a: 0 }, outlineWidth: 0, frameHeight: 0, rotateClockwise: !!t.rotateClockwise, referenceSize: l, sizeRatio: 1, markerPlacement: F, url: t.url, animatedSymbolProperties: k }); +} +function Wer(t, e, i, r, n, s, o, a, l, c) { + const h = t.markerGraphics; + if (!h) + return; + let p = 0; + if (t.scaleSymbolsProportionally) { + const v = t.frame; + v && (p = v.ymax - v.ymin); + } + const y = GRt(t.markerPlacement, r, i, n); + for (const v of h) + if (v) { + const x = v.symbol; + if (!x) + continue; + switch (x.type) { + case "CIMPointSymbol": + case "CIMLineSymbol": + case "CIMPolygonSymbol": + Yer(t, e, y, null, v, r, i, n, s, o, a, l, p, !!c); + break; + case "CIMTextSymbol": + qer(t, e, y, v, i, r, n, s, a, l, p); + } + } +} +function qer(t, e, i, r, n, s, o, a, l, c, h) { + const p = []; + z$.findApplicableOverrides(r, s, p); + const y = r.geometry; + if (!("x" in y) || !("y" in y)) + return; + const v = r.symbol, x = nyt(v), I = ryt(v.fontStyleName), P = d9e(v.fontFamilyName); + v.font = { family: P, decoration: x, ...I }; + const F = t.frame, k = y.x - 0.5 * (F.xmin + F.xmax), V = y.y - 0.5 * (F.ymin + F.ymax), j = t.size / h, Y = t.primitiveName, X = To(v.height) * j, Q = To(v.angle), re = To(t.offsetX) + (To(v.offsetX) + k) * j, he = To(t.offsetY) + (To(v.offsetY) + V) * j, fe = xb(h$(v)); + let be = xb(d$(v)), Se = uQ(v) ?? 0; + Se || (be = xb(h$(v.haloSymbol)), v.haloSize && (Se = v.haloSize * j)); + let Me = null, ke = null, J = 0; + if (v.callout && v.callout.type === "CIMBackgroundCallout") { + const Qe = v.callout; + if (Qe.backgroundSymbol) { + const tt = Qe.backgroundSymbol.symbolLayers; + if (tt) + for (const ft of tt) + ft.type === "CIMSolidFill" ? Me = xb(ft.color) : ft.type === "CIMSolidStroke" && (ke = xb(ft.color), J = To(ft.width)); + } + } + const [ce, xe] = vx(s, Y, e, i, null), Pe = JSON.stringify(t.effects) + Number(t.colorLocked).toString() + JSON.stringify(t.anchorPoint) + t.anchorPointUnits + JSON.stringify(t.markerPlacement) + t.size.toString(), Oe = ih(JSON.stringify(r) + Pe + xe).toString(); + let Re = to(r.primitiveName, n, "TextString", o, r.textString ?? "", iyt, v.textCase); + if (Re == null) + return; + const { fontStyleName: Ge } = v, je = P + (Ge ? "-" + Ge.toLowerCase() : "-regular"), et = je; + typeof Re == "string" && Re.includes("[") && v.fieldMap && (Re = QJt(v.fieldMap, Re, v.textCase)), a.push({ type: "text", templateHash: Oe, materialHash: ce || typeof Re == "function" || Re.match(/\[(.*?)\]/) ? (Qe, tt, ft) => et + "-" + Hj(Re, Qe, tt, ft) : et + "-" + ih(Re), cim: v, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, alignment: l, anchorPoint: { x: t.anchorPoint ? t.anchorPoint.x : 0, y: t.anchorPoint ? t.anchorPoint.y : 0 }, isAbsoluteAnchorPoint: t.anchorPointUnits !== "Relative", fontName: je, decoration: x, weight: to(Y, n, "Weight", o, I.weight), style: to(Y, n, "Size", o, I.style), size: to(Y, n, "Size", o, X), angle: to(Y, n, "Rotation", o, Q), offsetX: to(Y, n, "OffsetX", o, re), offsetY: to(Y, n, "OffsetY", o, he), horizontalAlignment: syt(v.horizontalAlignment), verticalAlignment: oyt(v.verticalAlignment), text: Re, color: fe, outlineColor: be, outlineSize: Se, backgroundColor: Me, borderLineColor: ke, borderLineWidth: J, referenceSize: c, sizeRatio: 1, markerPlacement: i }); +} +function Yer(t, e, i, r, n, s, o, a, l, c, h, p, y, v) { + const x = n.symbol, I = x.symbolLayers; + if (!I) + return; + if (v) + return void Qit(t, e, i, r, n, o, s, a, l, c, h, p, y); + let P = I.length; + if (etr(I)) + return void Xer(t, e, i, r, n, I, s, o, a, l, h, p, y); + const F = rZ.applyEffects(x.effects, n.geometry, c.geometryEngine); + if (F) + for (; P--; ) { + const k = I[P]; + if (k && k.enable !== !1) + switch (k.type) { + case "CIMSolidFill": + case "CIMSolidStroke": { + const V = rZ.applyEffects(k.effects, F, c.geometryEngine), j = kRt(V); + if (!j) + continue; + const Y = t.anchorPointUnits !== "Relative", [X, Q, re] = $Rt(j, t.frame, t.size, t.anchorPoint, Y), he = k.type === "CIMSolidFill", fe = { type: "sdf", geom: V, asFill: he }, be = t.primitiveName, Se = To(t.size) ?? 10, Me = To(t.rotation), ke = To(t.offsetX), J = To(t.offsetY), ce = k.path, xe = k.primitiveName, Pe = xb(he ? h$(k) : d$(k)), Oe = he ? { r: 0, g: 0, b: 0, a: 0 } : xb(d$(k)), Re = uQ(k) ?? 0; + if (!he && !Re) + break; + let Ge = !1, je = ""; + for (const ft of s) + ft.primitiveName !== xe && ft.primitiveName !== be || (ft.value !== void 0 ? je += `-${ft.primitiveName}-${ft.propertyName}-${JSON.stringify(ft.value)}` : ft.valueExpressionInfo && (Ge = !0)); + (_e(e) && typeof e == "function" || _e(i) && typeof i == "function") && (Ge = !0); + const et = JSON.stringify({ ...t, markerGraphics: null }), Qe = ih(JSON.stringify(fe) + ce).toString(), tt = { type: "marker", templateHash: ih(JSON.stringify(n) + JSON.stringify(k) + et + je).toString(), materialHash: Ge ? () => Qe : Qe, cim: fe, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, scaleSymbolsProportionally: !!t.scaleSymbolsProportionally, alignment: h, anchorPoint: { x: Q, y: re }, isAbsoluteAnchorPoint: Y, size: to(t.primitiveName, o, "Size", a, Se), rotation: to(t.primitiveName, o, "Rotation", a, Me), offsetX: to(t.primitiveName, o, "OffsetX", a, ke), offsetY: to(t.primitiveName, o, "OffsetY", a, J), scaleX: 1, frameHeight: y, rotateClockwise: !!t.rotateClockwise, referenceSize: p, sizeRatio: X, color: to(xe, o, "Color", a, Pe, iC), outlineColor: to(xe, o, "Color", a, Oe, iC), outlineWidth: to(xe, o, "Width", a, Re), markerPlacement: i, animatedSymbolProperties: r, path: ce }; + l.push(tt); + break; + } + default: + Qit(t, e, i, r, n, o, s, a, l, c, h, p, y); + } + } +} +function Xer(t, e, i, r, n, s, o, a, l, c, h, p, y) { + const v = n.geometry, x = s[0], I = s[1], P = kRt(v); + if (!P) + return; + const F = t.anchorPointUnits !== "Relative", [k, V, j] = $Rt(P, t.frame, t.size, t.anchorPoint, F), Y = { type: "sdf", geom: v, asFill: !0 }, X = t.primitiveName, Q = To(t.size), re = To(t.rotation), he = To(t.offsetX), fe = To(t.offsetY), be = I.path, Se = I.primitiveName, Me = x.primitiveName, ke = xb(h$(I)), J = xb(d$(x)), ce = uQ(x) ?? 0; + let xe = !1, Pe = ""; + for (const je of o) + je.primitiveName !== Se && je.primitiveName !== Me && je.primitiveName !== X || (je.value !== void 0 ? Pe += `-${je.primitiveName}-${je.propertyName}-${JSON.stringify(je.value)}` : je.valueExpressionInfo && (xe = !0)); + _e(i) && typeof i == "function" && (xe = !0); + const Oe = JSON.stringify({ ...t, markerGraphics: null }), Re = ih(JSON.stringify(Y) + be).toString(), Ge = { type: "marker", templateHash: ih(JSON.stringify(n) + JSON.stringify(I) + JSON.stringify(x) + Oe + Pe).toString(), materialHash: xe ? () => Re : Re, cim: Y, materialOverrides: null, colorLocked: !!t.colorLocked, effects: e, scaleSymbolsProportionally: !!t.scaleSymbolsProportionally, alignment: h, anchorPoint: { x: V, y: j }, isAbsoluteAnchorPoint: F, size: to(t.primitiveName, a, "Size", l, Q), rotation: to(t.primitiveName, a, "Rotation", l, re), offsetX: to(t.primitiveName, a, "OffsetX", l, he), offsetY: to(t.primitiveName, a, "OffsetY", l, fe), scaleX: 1, frameHeight: y, rotateClockwise: !!t.rotateClockwise, referenceSize: p, sizeRatio: k, color: to(Se, a, "Color", l, ke, iC), outlineColor: to(Me, a, "Color", l, J, iC), outlineWidth: to(Me, a, "Width", l, ce), markerPlacement: i, path: be, animatedSymbolProperties: r }; + c.push(Ge); +} +function Qit(t, e, i, r, n, s, o, a, l, c, h, p, y) { + const v = Ker(t, n), x = ["Rotation", "OffsetX", "OffsetY"], I = o.filter((fe) => fe.primitiveName !== t.primitiveName || !x.includes(fe.propertyName)); + let P = ""; + for (const fe of o) + fe.value !== void 0 && (P += `-${fe.primitiveName}-${fe.propertyName}-${JSON.stringify(fe.value)}`); + const [F, k, V] = wb.getTextureAnchor(v, c), j = t.primitiveName, Y = To(t.rotation), X = To(t.offsetX), Q = To(t.offsetY), re = ih(JSON.stringify(v) + P).toString(), he = { type: "marker", templateHash: re, materialHash: I.length > 0 || _e(e) && typeof e == "function" ? tre(re, s, I, a) : re, cim: v, materialOverrides: I, colorLocked: !!t.colorLocked, effects: e, scaleSymbolsProportionally: !!t.scaleSymbolsProportionally, alignment: h, anchorPoint: { x: F, y: k }, isAbsoluteAnchorPoint: !1, size: To(t.size), rotation: to(j, s, "Rotation", a, Y), offsetX: to(j, s, "OffsetX", a, X), offsetY: to(j, s, "OffsetY", a, Q), color: { r: 255, g: 255, b: 255, a: 1 }, outlineColor: { r: 0, g: 0, b: 0, a: 0 }, outlineWidth: 0, scaleX: 1, frameHeight: y, rotateClockwise: !!t.rotateClockwise, referenceSize: p, sizeRatio: V / dn(t.size), markerPlacement: i, animatedSymbolProperties: r, avoidSDFRasterization: !0 }; + l.push(he); +} +function Ker(t, e) { + return { type: t.type, enable: !0, name: t.name, colorLocked: t.colorLocked, primitiveName: t.primitiveName, anchorPoint: t.anchorPoint, anchorPointUnits: t.anchorPointUnits, offsetX: 0, offsetY: 0, rotateClockwise: t.rotateClockwise, rotation: 0, size: t.size, billboardMode3D: t.billboardMode3D, depth3D: t.depth3D, frame: t.frame, markerGraphics: [e], scaleSymbolsProportionally: t.scaleSymbolsProportionally, respectFrame: t.respectFrame, clippingPath: t.clippingPath }; +} +function b9e(t) { + if (t && t.indexOf("Level_") === 0) { + const e = parseInt(t.substr(6), 10); + if (!isNaN(e)) + return e; + } + return 0; +} +function iC(t) { + if (!t || t.length === 0) + return null; + const e = new Wr(t).toRgba(); + return { r: e[0], g: e[1], b: e[2], a: e[3] }; +} +function to(t, e, i, r, n, s, o) { + if (t == null) + return n; + const a = e[t]; + if (a) { + const l = a[i]; + if (typeof l == "string" || typeof l == "number" || l instanceof Array) + return s ? s.call(null, l, o) : l; + if (l != null && l instanceof w4 && r?.geometryType) + return (c, h, p) => { + let y = T8(l, c, { $view: p }, r.geometryType, h); + return y !== null && s && (y = s.call(null, y, o)), y !== null ? y : n; + }; + } + return n; +} +function w9e(t) { + return t && t.charAt(0).toLowerCase() + t.substr(1); +} +function Jer(t, e, i, r) { + for (const n of e) + if (n.valueExpressionInfo && r?.geometryType) { + const s = i[n.primitiveName] && i[n.primitiveName][n.propertyName]; + s instanceof w4 && (n.fn = (o, a, l) => T8(s, o, { $view: l }, r.geometryType, a)); + } + return (n, s, o) => { + for (const l of e) + l.fn && (l.value = l.fn(n, s, o)); + const a = []; + for (let l of t) { + const c = l?.primitiveName; + if (c) { + let h = !1; + for (const p of e) + if (p.primitiveName === c) { + const y = w9e(p.propertyName); + p.value != null && p.value !== l[y] && (h || (l = fi(l), h = !0), l[y] = p.value); + } + } + a.push(l); + } + return a; + }; +} +function GRt(t, e, i, r) { + const n = []; + if (z$.findApplicableOverrides(t, e, n), t == null || n.length === 0) + return t; + for (const s of n) + if (s.valueExpressionInfo && r?.geometryType) { + const o = i[s.primitiveName] && i[s.primitiveName][s.propertyName]; + o instanceof w4 && (s.fn = (a, l, c) => T8(o, a, { $view: c }, r.geometryType, l)); + } + return (s, o, a) => { + for (const h of n) + h.fn && (h.value = h.fn(s, o, a)); + const l = fi(t), c = t.primitiveName; + for (const h of n) + if (h.primitiveName === c) { + const p = w9e(h.propertyName); + h.value != null && h.value !== l[p] && (l[p] = h.value); + } + return l; + }; +} +function Zer(t, e, i, r) { + const n = []; + if (z$.findApplicableOverrides(t, e, n), t == null || n.length === 0) + return t; + for (const s of n) + if (s.valueExpressionInfo && r?.geometryType) { + const o = i[s.primitiveName] && i[s.primitiveName][s.propertyName]; + o instanceof w4 && (s.fn = (a, l, c) => T8(o, a, { $view: c }, r.geometryType, l)); + } + return (s, o, a) => { + for (const h of n) + h.fn && (h.value = h.fn(s, o, a)); + const l = fi(t), c = t.primitiveName; + for (const h of n) + if (h.primitiveName === c) { + const p = w9e(h.propertyName); + if (h.value != null) { + const y = xer(h.value, h.propertyName); + y !== l[p] && (l[p] = y); + } + } + return l; + }; +} +function tre(t, e, i, r) { + for (const n of i) + if (n.valueExpressionInfo && r?.geometryType) { + const s = e[n.primitiveName] && e[n.primitiveName][n.propertyName]; + s instanceof w4 && (n.fn = (o, a, l) => T8(s, o, { $view: l }, r.geometryType, a)); + } + return (n, s, o) => { + for (const a of i) + a.fn && (a.value = a.fn(n, s, o)); + return ih(t + z$.buildOverrideKey(i)).toString(); + }; +} +function Qer(t, e) { + if (!e || e.length === 0) + return t; + const i = fi(t); + return z$.applyOverrides(i, e), i; +} +function vx(t, e, i, r, n) { + let s = !1, o = ""; + for (const a of t) + a.primitiveName === e && (a.value !== void 0 ? o += `-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}` : a.valueExpressionInfo && (s = !0)); + return _e(i) && typeof i == "function" && (s = !0), _e(r) && typeof r == "function" && (s = !0), _e(n) && typeof n == "function" && (s = !0), [s, o]; +} +const etr = (t) => t && t.length === 2 && t[0].enable && t[1].enable && t[0].type === "CIMSolidStroke" && t[1].type === "CIMSolidFill" && !t[0].effects && !t[1].effects; +var ert, kMe = {}; +ert = function() { + return function(t) { + var e = {}; + function i(r) { + if (e[r]) + return e[r].exports; + var n = e[r] = { exports: {}, id: r, loaded: !1 }; + return t[r].call(n.exports, n, n.exports, i), n.loaded = !0, n.exports; + } + return i.m = t, i.c = e, i.p = "", i(0); + }([function(t, e, i) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.isNotPNG = l, e.isNotAPNG = c, e.default = p; + var r = s(i(1)), n = i(2); + function s(k) { + return k && k.__esModule ? k : { default: k }; + } + var o = new Error("Not a PNG"), a = new Error("Not an animated PNG"); + function l(k) { + return k === o; + } + function c(k) { + return k === a; + } + var h = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]); + function p(k) { + var V = new Uint8Array(k); + if (Array.prototype.some.call(h, function(Me, ke) { + return Me !== V[ke]; + })) + return o; + var j = !1; + if (y(V, function(Me) { + return !(j = Me === "acTL"); + }), !j) + return a; + var Y = [], X = [], Q = null, re = null, he = 0, fe = new n.APNG(); + if (y(V, function(Me, ke, J, ce) { + var xe = new DataView(ke.buffer); + switch (Me) { + case "IHDR": + Q = ke.subarray(J + 8, J + 8 + ce), fe.width = xe.getUint32(J + 8), fe.height = xe.getUint32(J + 12); + break; + case "acTL": + fe.numPlays = xe.getUint32(J + 8 + 4); + break; + case "fcTL": + re && (fe.frames.push(re), he++), (re = new n.Frame()).width = xe.getUint32(J + 8 + 4), re.height = xe.getUint32(J + 8 + 8), re.left = xe.getUint32(J + 8 + 12), re.top = xe.getUint32(J + 8 + 16); + var Pe = xe.getUint16(J + 8 + 20), Oe = xe.getUint16(J + 8 + 22); + Oe === 0 && (Oe = 100), re.delay = 1e3 * Pe / Oe, re.delay <= 10 && (re.delay = 100), fe.playTime += re.delay, re.disposeOp = xe.getUint8(J + 8 + 24), re.blendOp = xe.getUint8(J + 8 + 25), re.dataParts = [], he === 0 && re.disposeOp === 2 && (re.disposeOp = 1); + break; + case "fdAT": + re && re.dataParts.push(ke.subarray(J + 8 + 4, J + 8 + ce)); + break; + case "IDAT": + re && re.dataParts.push(ke.subarray(J + 8, J + 8 + ce)); + break; + case "IEND": + X.push(I(ke, J, 12 + ce)); + break; + default: + Y.push(I(ke, J, 12 + ce)); + } + }), re && fe.frames.push(re), fe.frames.length == 0) + return a; + var be = new Blob(Y), Se = new Blob(X); + return fe.frames.forEach(function(Me) { + var ke = []; + ke.push(h), Q.set(F(Me.width), 0), Q.set(F(Me.height), 4), ke.push(P("IHDR", Q)), ke.push(be), Me.dataParts.forEach(function(J) { + return ke.push(P("IDAT", J)); + }), ke.push(Se), Me.imageData = new Blob(ke, { type: "image/png" }), delete Me.dataParts, ke = null; + }), fe; + } + function y(k, V) { + var j = new DataView(k.buffer), Y = 8, X = void 0, Q = void 0, re = void 0; + do + Q = j.getUint32(Y), re = V(X = v(k, Y + 4, 4), k, Y, Q), Y += 12 + Q; + while (re !== !1 && X != "IEND" && Y < k.length); + } + function v(k, V, j) { + var Y = Array.prototype.slice.call(k.subarray(V, V + j)); + return String.fromCharCode.apply(String, Y); + } + function x(k) { + for (var V = new Uint8Array(k.length), j = 0; j < k.length; j++) + V[j] = k.charCodeAt(j); + return V; + } + function I(k, V, j) { + var Y = new Uint8Array(j); + return Y.set(k.subarray(V, V + j)), Y; + } + var P = function(k, V) { + var j = k.length + V.length, Y = new Uint8Array(j + 8), X = new DataView(Y.buffer); + X.setUint32(0, V.length), Y.set(x(k), 4), Y.set(V, 8); + var Q = (0, r.default)(Y, 4, j); + return X.setUint32(j + 4, Q), Y; + }, F = function(k) { + return new Uint8Array([k >>> 24 & 255, k >>> 16 & 255, k >>> 8 & 255, 255 & k]); + }; + }, function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.default = function(o) { + for (var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, l = -1, c = a, h = a + (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : o.length - a); c < h; c++) + l = l >>> 8 ^ i[255 & (l ^ o[c])]; + return -1 ^ l; + }; + for (var i = new Uint32Array(256), r = 0; r < 256; r++) { + for (var n = r, s = 0; s < 8; s++) + n = 1 & n ? 3988292384 ^ n >>> 1 : n >>> 1; + i[r] = n; + } + }, function(t, e, i) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.Frame = e.APNG = void 0; + var r = function() { + function a(l, c) { + for (var h = 0; h < c.length; h++) { + var p = c[h]; + p.enumerable = p.enumerable || !1, p.configurable = !0, "value" in p && (p.writable = !0), Object.defineProperty(l, p.key, p); + } + } + return function(l, c, h) { + return c && a(l.prototype, c), h && a(l, h), l; + }; + }(), n = s(i(3)); + function s(a) { + return a && a.__esModule ? a : { default: a }; + } + function o(a, l) { + if (!(a instanceof l)) + throw new TypeError("Cannot call a class as a function"); + } + e.APNG = function() { + function a() { + o(this, a), this.width = 0, this.height = 0, this.numPlays = 0, this.playTime = 0, this.frames = []; + } + return r(a, [{ key: "createImages", value: function() { + return Promise.all(this.frames.map(function(l) { + return l.createImage(); + })); + } }, { key: "getPlayer", value: function(l) { + var c = this, h = arguments.length > 1 && arguments[1] !== void 0 && arguments[1]; + return this.createImages().then(function() { + return new n.default(c, l, h); + }); + } }]), a; + }(), e.Frame = function() { + function a() { + o(this, a), this.left = 0, this.top = 0, this.width = 0, this.height = 0, this.delay = 0, this.disposeOp = 0, this.blendOp = 0, this.imageData = null, this.imageElement = null; + } + return r(a, [{ key: "createImage", value: function() { + var l = this; + return this.imageElement ? Promise.resolve() : new Promise(function(c, h) { + var p = URL.createObjectURL(l.imageData); + l.imageElement = document.createElement("img"), l.imageElement.onload = function() { + URL.revokeObjectURL(p), c(); + }, l.imageElement.onerror = function() { + URL.revokeObjectURL(p), l.imageElement = null, h(new Error("Image creation error")); + }, l.imageElement.src = p; + }); + } }]), a; + }(); + }, function(t, e, i) { + Object.defineProperty(e, "__esModule", { value: !0 }); + var r = function() { + function c(h, p) { + for (var y = 0; y < p.length; y++) { + var v = p[y]; + v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(h, v.key, v); + } + } + return function(h, p, y) { + return p && c(h.prototype, p), y && c(h, y), h; + }; + }(); + function n(c) { + return c && c.__esModule ? c : { default: c }; + } + function s(c, h) { + if (!(c instanceof h)) + throw new TypeError("Cannot call a class as a function"); + } + function o(c, h) { + if (!c) + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return !h || typeof h != "object" && typeof h != "function" ? c : h; + } + function a(c, h) { + if (typeof h != "function" && h !== null) + throw new TypeError("Super expression must either be null or a function, not " + typeof h); + c.prototype = Object.create(h && h.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), h && (Object.setPrototypeOf ? Object.setPrototypeOf(c, h) : c.__proto__ = h); + } + var l = function(c) { + function h(p, y, v) { + s(this, h); + var x = o(this, (h.__proto__ || Object.getPrototypeOf(h)).call(this)); + return x.playbackRate = 1, x._currentFrameNumber = 0, x._ended = !1, x._paused = !0, x._numPlays = 0, x._apng = p, x.context = y, x.stop(), v && x.play(), x; + } + return a(h, c), r(h, [{ key: "renderNextFrame", value: function() { + this._currentFrameNumber = (this._currentFrameNumber + 1) % this._apng.frames.length, this._currentFrameNumber === this._apng.frames.length - 1 && (this._numPlays++, this._apng.numPlays !== 0 && this._numPlays >= this._apng.numPlays && (this._ended = !0, this._paused = !0)), this._prevFrame && this._prevFrame.disposeOp == 1 ? this.context.clearRect(this._prevFrame.left, this._prevFrame.top, this._prevFrame.width, this._prevFrame.height) : this._prevFrame && this._prevFrame.disposeOp == 2 && this.context.putImageData(this._prevFrameData, this._prevFrame.left, this._prevFrame.top); + var p = this.currentFrame; + this._prevFrame = p, this._prevFrameData = null, p.disposeOp == 2 && (this._prevFrameData = this.context.getImageData(p.left, p.top, p.width, p.height)), p.blendOp == 0 && this.context.clearRect(p.left, p.top, p.width, p.height), this.context.drawImage(p.imageElement, p.left, p.top), this.emit("frame", this._currentFrameNumber), this._ended && this.emit("end"); + } }, { key: "play", value: function() { + var p = this; + this.emit("play"), this._ended && this.stop(), this._paused = !1; + var y = performance.now() + this.currentFrame.delay / this.playbackRate, v = function x(I) { + if (!p._ended && !p._paused) { + if (I >= y) { + for (; I - y >= p._apng.playTime / p.playbackRate; ) + y += p._apng.playTime / p.playbackRate, p._numPlays++; + do + p.renderNextFrame(), y += p.currentFrame.delay / p.playbackRate; + while (!p._ended && I > y); + } + requestAnimationFrame(x); + } + }; + requestAnimationFrame(v); + } }, { key: "pause", value: function() { + this._paused || (this.emit("pause"), this._paused = !0); + } }, { key: "stop", value: function() { + this.emit("stop"), this._numPlays = 0, this._ended = !1, this._paused = !0, this._currentFrameNumber = -1, this.context.clearRect(0, 0, this._apng.width, this._apng.height), this.renderNextFrame(); + } }, { key: "currentFrameNumber", get: function() { + return this._currentFrameNumber; + } }, { key: "currentFrame", get: function() { + return this._apng.frames[this._currentFrameNumber]; + } }, { key: "paused", get: function() { + return this._paused; + } }, { key: "ended", get: function() { + return this._ended; + } }]), h; + }(n(i(4)).default); + e.default = l; + }, function(t, e) { + function i() { + this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0; + } + function r(a) { + return typeof a == "function"; + } + function n(a) { + return typeof a == "number"; + } + function s(a) { + return typeof a == "object" && a !== null; + } + function o(a) { + return a === void 0; + } + t.exports = i, i.EventEmitter = i, i.prototype._events = void 0, i.prototype._maxListeners = void 0, i.defaultMaxListeners = 10, i.prototype.setMaxListeners = function(a) { + if (!n(a) || a < 0 || isNaN(a)) + throw TypeError("n must be a positive number"); + return this._maxListeners = a, this; + }, i.prototype.emit = function(a) { + var l, c, h, p, y, v; + if (this._events || (this._events = {}), a === "error" && (!this._events.error || s(this._events.error) && !this._events.error.length)) { + if ((l = arguments[1]) instanceof Error) + throw l; + var x = new Error('Uncaught, unspecified "error" event. (' + l + ")"); + throw x.context = l, x; + } + if (o(c = this._events[a])) + return !1; + if (r(c)) + switch (arguments.length) { + case 1: + c.call(this); + break; + case 2: + c.call(this, arguments[1]); + break; + case 3: + c.call(this, arguments[1], arguments[2]); + break; + default: + p = Array.prototype.slice.call(arguments, 1), c.apply(this, p); + } + else if (s(c)) + for (p = Array.prototype.slice.call(arguments, 1), h = (v = c.slice()).length, y = 0; y < h; y++) + v[y].apply(this, p); + return !0; + }, i.prototype.addListener = function(a, l) { + var c; + if (!r(l)) + throw TypeError("listener must be a function"); + return this._events || (this._events = {}), this._events.newListener && this.emit("newListener", a, r(l.listener) ? l.listener : l), this._events[a] ? s(this._events[a]) ? this._events[a].push(l) : this._events[a] = [this._events[a], l] : this._events[a] = l, s(this._events[a]) && !this._events[a].warned && (c = o(this._maxListeners) ? i.defaultMaxListeners : this._maxListeners) && c > 0 && this._events[a].length > c && (this._events[a].warned = !0, console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[a].length), typeof console.trace == "function" && console.trace()), this; + }, i.prototype.on = i.prototype.addListener, i.prototype.once = function(a, l) { + if (!r(l)) + throw TypeError("listener must be a function"); + var c = !1; + function h() { + this.removeListener(a, h), c || (c = !0, l.apply(this, arguments)); + } + return h.listener = l, this.on(a, h), this; + }, i.prototype.removeListener = function(a, l) { + var c, h, p, y; + if (!r(l)) + throw TypeError("listener must be a function"); + if (!this._events || !this._events[a]) + return this; + if (p = (c = this._events[a]).length, h = -1, c === l || r(c.listener) && c.listener === l) + delete this._events[a], this._events.removeListener && this.emit("removeListener", a, l); + else if (s(c)) { + for (y = p; y-- > 0; ) + if (c[y] === l || c[y].listener && c[y].listener === l) { + h = y; + break; + } + if (h < 0) + return this; + c.length === 1 ? (c.length = 0, delete this._events[a]) : c.splice(h, 1), this._events.removeListener && this.emit("removeListener", a, l); + } + return this; + }, i.prototype.removeAllListeners = function(a) { + var l, c; + if (!this._events) + return this; + if (!this._events.removeListener) + return arguments.length === 0 ? this._events = {} : this._events[a] && delete this._events[a], this; + if (arguments.length === 0) { + for (l in this._events) + l !== "removeListener" && this.removeAllListeners(l); + return this.removeAllListeners("removeListener"), this._events = {}, this; + } + if (r(c = this._events[a])) + this.removeListener(a, c); + else if (c) + for (; c.length; ) + this.removeListener(a, c[c.length - 1]); + return delete this._events[a], this; + }, i.prototype.listeners = function(a) { + return this._events && this._events[a] ? r(this._events[a]) ? [this._events[a]] : this._events[a].slice() : []; + }, i.prototype.listenerCount = function(a) { + if (this._events) { + var l = this._events[a]; + if (r(l)) + return 1; + if (l) + return l.length; + } + return 0; + }, i.listenerCount = function(a, l) { + return a.listenerCount(l); + }; + }]); +}, { get exports() { + return kMe; +}, set exports(t) { + kMe = t; +} }.exports = ert(); +const ttr = nl(kMe); +async function itr(t, e) { + const i = ttr(t); + if (i instanceof Error) + throw i; + await i.createImages(), hn(e); + const { frames: r, width: n, height: s } = i, o = document.createElement("canvas"); + o.width = n, o.height = s; + const a = o.getContext("2d", { willReadFrequently: !0 }), l = [], c = []; + for (const h of r) { + c.push(h.delay || 100); + const p = h.imageElement; + h.blendOp === 0 ? a.globalCompositeOperation = "copy" : a.globalCompositeOperation = "source-over"; + const y = h.disposeOp === 2 ? a.getImageData(h.left, h.top, h.width, h.height) : void 0; + a.drawImage(p, h.left, h.top); + const v = a.getImageData(0, 0, n, s); + l.push(v), h.disposeOp === 0 || (h.disposeOp === 1 ? a.clearRect(h.left, h.top, h.width, h.height) : h.disposeOp === 2 && a.putImageData(y, h.left, h.top)); + } + return { frameDurations: c, getFrame: (h) => l[h], width: n, height: s }; +} +const rtr = [137, 80, 78, 71, 13, 10, 26, 10]; +function ntr(t) { + const e = new Uint8Array(t); + return !rtr.some((i, r) => i !== e[r]); +} +function str(t) { + if (!ntr(t)) + return !1; + const e = new DataView(t), i = new Uint8Array(t); + let r, n = 8; + do { + const s = e.getUint32(n); + if (r = String.fromCharCode.apply(String, Array.prototype.slice.call(i.subarray(n + 4, n + 8))), r === "acTL") + return !0; + n += 12 + s; + } while (r !== "IEND" && n < i.length); + return !1; +} +function otr(t) { + const e = Ive(t); + return _e(e) ? e.toDataURL() : ""; +} +async function trt(t) { + const e = Ive(t); + if (ut(e)) + throw new ot("imageToArrayBuffer", "Unsupported image type"); + const i = await atr(t), r = await new Promise((n) => e.toBlob(n, i)); + if (!r) + throw new ot("imageToArrayBuffer", "Failed to encode image"); + return { data: await r.arrayBuffer(), type: i }; +} +async function atr(t) { + if (!(t instanceof HTMLImageElement)) + return "image/png"; + const e = t.src; + if ($b(e)) { + const i = CF(e); + return i?.mediaType === "image/jpeg" ? i.mediaType : "image/png"; + } + return /\.png$/i.test(e) ? "image/png" : /\.(jpg|jpeg)$/i.test(e) ? "image/jpeg" : "image/png"; +} +function Ive(t) { + if (t instanceof HTMLCanvasElement) + return t; + if (t instanceof HTMLVideoElement) + return null; + const e = document.createElement("canvas"); + e.width = t.width, e.height = t.height; + const i = e.getContext("2d"); + return t instanceof HTMLImageElement ? i.drawImage(t, 0, 0, t.width, t.height) : t instanceof ImageData && i.putImageData(t, 0, 0), e; +} +function ltr(t) { + const e = [], i = new Uint8Array(t); + for (let r = 0; r < i.length; r++) + e.push(String.fromCharCode(i[r])); + return "data:application/octet-stream;base64," + btoa(e.join("")); +} +function utr(t) { + if (t.byteLength < 8) + return !1; + const e = new Uint8Array(t); + return e[0] === 137 && e[1] === 80 && e[2] === 78 && e[3] === 71 && e[4] === 13 && e[5] === 10 && e[6] === 26 && e[7] === 10; +} +var G6 = {}, URt = {}, mO = {}; +Object.defineProperty(mO, "__esModule", { value: !0 }), mO.loop = mO.conditional = mO.parse = void 0; +var ctr = function t(e, i) { + var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : r; + if (Array.isArray(i)) + i.forEach(function(o) { + return t(e, o, r, n); + }); + else if (typeof i == "function") + i(e, r, n, t); + else { + var s = Object.keys(i)[0]; + Array.isArray(i[s]) ? (n[s] = {}, t(e, i[s], r, n[s])) : n[s] = i[s](e, r, n, t); + } + return r; +}; +mO.parse = ctr; +var htr = function(t, e) { + return function(i, r, n, s) { + e(i, r, n) && s(i, t, r, n); + }; +}; +mO.conditional = htr; +var dtr = function(t, e) { + return function(i, r, n, s) { + for (var o = [], a = i.pos; e(i, r, n); ) { + var l = {}; + if (s(i, t, r, l), i.pos === a) + break; + a = i.pos, o.push(l); + } + return o; + }; +}; +mO.loop = dtr; +var Af = {}; +Object.defineProperty(Af, "__esModule", { value: !0 }), Af.readBits = Af.readArray = Af.readUnsigned = Af.readString = Af.peekBytes = Af.readBytes = Af.peekByte = Af.readByte = Af.buildStream = void 0; +var ptr = function(t) { + return { data: t, pos: 0 }; +}; +Af.buildStream = ptr; +var zRt = function() { + return function(t) { + return t.data[t.pos++]; + }; +}; +Af.readByte = zRt; +var ftr = function() { + var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; + return function(e) { + return e.data[e.pos + t]; + }; +}; +Af.peekByte = ftr; +var Ave = function(t) { + return function(e) { + return e.data.subarray(e.pos, e.pos += t); + }; +}; +Af.readBytes = Ave; +var mtr = function(t) { + return function(e) { + return e.data.subarray(e.pos, e.pos + t); + }; +}; +Af.peekBytes = mtr; +var gtr = function(t) { + return function(e) { + return Array.from(Ave(t)(e)).map(function(i) { + return String.fromCharCode(i); + }).join(""); + }; +}; +Af.readString = gtr; +var ytr = function(t) { + return function(e) { + var i = Ave(2)(e); + return t ? (i[1] << 8) + i[0] : (i[0] << 8) + i[1]; + }; +}; +Af.readUnsigned = ytr; +var vtr = function(t, e) { + return function(i, r, n) { + for (var s = typeof e == "function" ? e(i, r, n) : e, o = Ave(t), a = new Array(s), l = 0; l < s; l++) + a[l] = o(i); + return a; + }; +}; +Af.readArray = vtr; +var _tr = function(t, e, i) { + for (var r = 0, n = 0; n < i; n++) + r += t[e + n] && Math.pow(2, i - n - 1); + return r; +}, btr = function(t) { + return function(e) { + for (var i = zRt()(e), r = new Array(8), n = 0; n < 8; n++) + r[7 - n] = !!(i & 1 << n); + return Object.keys(t).reduce(function(s, o) { + var a = t[o]; + return a.length ? s[o] = _tr(r, a.index, a.length) : s[o] = r[a.index], s; + }, {}); + }; +}; +Af.readBits = btr, function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.default = void 0; + var e = mO, i = Af, r = { blocks: function(h) { + for (var p = 0, y = [], v = h.data.length, x = 0, I = (0, i.readByte)()(h); I !== p && I; I = (0, i.readByte)()(h)) { + if (h.pos + I >= v) { + var P = v - h.pos; + y.push((0, i.readBytes)(P)(h)), x += P; + break; + } + y.push((0, i.readBytes)(I)(h)), x += I; + } + for (var F = new Uint8Array(x), k = 0, V = 0; V < y.length; V++) + F.set(y[V], k), k += y[V].length; + return F; + } }, n = (0, e.conditional)({ gce: [{ codes: (0, i.readBytes)(2) }, { byteSize: (0, i.readByte)() }, { extras: (0, i.readBits)({ future: { index: 0, length: 3 }, disposal: { index: 3, length: 3 }, userInput: { index: 6 }, transparentColorGiven: { index: 7 } }) }, { delay: (0, i.readUnsigned)(!0) }, { transparentColorIndex: (0, i.readByte)() }, { terminator: (0, i.readByte)() }] }, function(h) { + var p = (0, i.peekBytes)(2)(h); + return p[0] === 33 && p[1] === 249; + }), s = (0, e.conditional)({ image: [{ code: (0, i.readByte)() }, { descriptor: [{ left: (0, i.readUnsigned)(!0) }, { top: (0, i.readUnsigned)(!0) }, { width: (0, i.readUnsigned)(!0) }, { height: (0, i.readUnsigned)(!0) }, { lct: (0, i.readBits)({ exists: { index: 0 }, interlaced: { index: 1 }, sort: { index: 2 }, future: { index: 3, length: 2 }, size: { index: 5, length: 3 } }) }] }, (0, e.conditional)({ lct: (0, i.readArray)(3, function(h, p, y) { + return Math.pow(2, y.descriptor.lct.size + 1); + }) }, function(h, p, y) { + return y.descriptor.lct.exists; + }), { data: [{ minCodeSize: (0, i.readByte)() }, r] }] }, function(h) { + return (0, i.peekByte)()(h) === 44; + }), o = (0, e.conditional)({ text: [{ codes: (0, i.readBytes)(2) }, { blockSize: (0, i.readByte)() }, { preData: function(h, p, y) { + return (0, i.readBytes)(y.text.blockSize)(h); + } }, r] }, function(h) { + var p = (0, i.peekBytes)(2)(h); + return p[0] === 33 && p[1] === 1; + }), a = (0, e.conditional)({ application: [{ codes: (0, i.readBytes)(2) }, { blockSize: (0, i.readByte)() }, { id: function(h, p, y) { + return (0, i.readString)(y.blockSize)(h); + } }, r] }, function(h) { + var p = (0, i.peekBytes)(2)(h); + return p[0] === 33 && p[1] === 255; + }), l = (0, e.conditional)({ comment: [{ codes: (0, i.readBytes)(2) }, r] }, function(h) { + var p = (0, i.peekBytes)(2)(h); + return p[0] === 33 && p[1] === 254; + }), c = [{ header: [{ signature: (0, i.readString)(3) }, { version: (0, i.readString)(3) }] }, { lsd: [{ width: (0, i.readUnsigned)(!0) }, { height: (0, i.readUnsigned)(!0) }, { gct: (0, i.readBits)({ exists: { index: 0 }, resolution: { index: 1, length: 3 }, sort: { index: 4 }, size: { index: 5, length: 3 } }) }, { backgroundColorIndex: (0, i.readByte)() }, { pixelAspectRatio: (0, i.readByte)() }] }, (0, e.conditional)({ gct: (0, i.readArray)(3, function(h, p) { + return Math.pow(2, p.lsd.gct.size + 1); + }) }, function(h, p) { + return p.lsd.gct.exists; + }), { frames: (0, e.loop)([n, a, l, s, o], function(h) { + var p = (0, i.peekByte)()(h); + return p === 33 || p === 44; + }) }]; + t.default = c; +}(URt); +var qfe = {}; +Object.defineProperty(qfe, "__esModule", { value: !0 }), qfe.deinterlace = void 0; +var wtr = function(t, e) { + for (var i = new Array(t.length), r = t.length / e, n = function(h, p) { + var y = t.slice(p * e, (p + 1) * e); + i.splice.apply(i, [h * e, e].concat(y)); + }, s = [0, 4, 2, 1], o = [8, 8, 4, 2], a = 0, l = 0; l < 4; l++) + for (var c = s[l]; c < r; c += o[l]) + n(c, a), a++; + return i; +}; +qfe.deinterlace = wtr; +var Yfe = {}; +Object.defineProperty(Yfe, "__esModule", { value: !0 }), Yfe.lzw = void 0; +var xtr = function(t, e, i) { + var r, n, s, o, a, l, c, h, p, y, v, x, I, P, F, k, V = 4096, j = -1, Y = i, X = new Array(i), Q = new Array(V), re = new Array(V), he = new Array(V + 1); + for (a = (n = 1 << (y = t)) + 1, r = n + 2, c = j, s = (1 << (o = y + 1)) - 1, h = 0; h < n; h++) + Q[h] = 0, re[h] = h; + for (v = x = I = P = F = k = 0, p = 0; p < Y; ) { + if (P === 0) { + if (x < o) { + v += e[k] << x, x += 8, k++; + continue; + } + if (h = v & s, v >>= o, x -= o, h > r || h == a) + break; + if (h == n) { + s = (1 << (o = y + 1)) - 1, r = n + 2, c = j; + continue; + } + if (c == j) { + he[P++] = re[h], c = h, I = h; + continue; + } + for (l = h, h == r && (he[P++] = I, h = c); h > n; ) + he[P++] = re[h], h = Q[h]; + I = 255 & re[h], he[P++] = I, r < V && (Q[r] = c, re[r] = I, !(++r & s) && r < V && (o++, s += r)), c = l; + } + P--, X[F++] = he[P], p++; + } + for (p = F; p < Y; p++) + X[p] = 0; + return X; +}; +Yfe.lzw = xtr, Object.defineProperty(G6, "__esModule", { value: !0 }); +var HRt = G6.decompressFrames = G6.decompressFrame = WRt = G6.parseGIF = void 0, Str = Atr(URt), Ctr = mO, Ttr = Af, Etr = qfe, Itr = Yfe; +function Atr(t) { + return t && t.__esModule ? t : { default: t }; +} +var Ptr = function(t) { + var e = new Uint8Array(t); + return (0, Ctr.parse)((0, Ttr.buildStream)(e), Str.default); +}, WRt = G6.parseGIF = Ptr, Otr = function(t) { + for (var e = t.pixels.length, i = new Uint8ClampedArray(4 * e), r = 0; r < e; r++) { + var n = 4 * r, s = t.pixels[r], o = t.colorTable[s] || [0, 0, 0]; + i[n] = o[0], i[n + 1] = o[1], i[n + 2] = o[2], i[n + 3] = s !== t.transparentIndex ? 255 : 0; + } + return i; +}, qRt = function(t, e, i) { + if (t.image) { + var r = t.image, n = r.descriptor.width * r.descriptor.height, s = (0, Itr.lzw)(r.data.minCodeSize, r.data.blocks, n); + r.descriptor.lct.interlaced && (s = (0, Etr.deinterlace)(s, r.descriptor.width)); + var o = { pixels: s, dims: { top: t.image.descriptor.top, left: t.image.descriptor.left, width: t.image.descriptor.width, height: t.image.descriptor.height } }; + return r.descriptor.lct && r.descriptor.lct.exists ? o.colorTable = r.lct : o.colorTable = e, t.gce && (o.delay = 10 * (t.gce.delay || 10), o.disposalType = t.gce.extras.disposal, t.gce.extras.transparentColorGiven && (o.transparentIndex = t.gce.transparentColorIndex)), i && (o.patch = Otr(o)), o; + } + console.warn("gif frame does not have associated image."); +}; +G6.decompressFrame = qRt; +var Rtr = function(t, e) { + return t.frames.filter(function(i) { + return i.image; + }).map(function(i) { + return qRt(i, t.gct, e); + }); +}; +HRt = G6.decompressFrames = Rtr; +async function Mtr(t, e) { + const i = WRt(t), r = HRt(i, !0), { width: n, height: s } = i.lsd, o = document.createElement("canvas"); + o.width = n, o.height = s; + const a = o.getContext("2d", { willReadFrequently: !0 }), l = [], c = []; + for (const h of r) { + c.push(h.delay || 100); + const p = new ImageData(h.patch, h.dims.width, h.dims.height), y = Ive(p), v = h.disposalType === 3 ? a.getImageData(h.dims.left, h.dims.top, h.dims.width, h.dims.height) : void 0; + a.drawImage(y, h.dims.left, h.dims.top); + const x = a.getImageData(0, 0, n, s); + l.push(x), h.disposalType === 1 || (h.disposalType === 2 ? a.clearRect(h.dims.left, h.dims.top, h.dims.width, h.dims.height) : h.disposalType === 3 && a.putImageData(v, h.dims.left, h.dims.top)); + } + return { frameDurations: c, getFrame: (h) => l[h], width: n, height: s }; +} +const Dtr = [71, 73, 70]; +function Ftr(t) { + const e = new Uint8Array(t); + return !Dtr.some((i, r) => i !== e[r]); +} +function Ltr(t) { + if (!Ftr(t)) + return !1; + const e = new DataView(t), i = e.getUint8(10); + let r = 13 + (128 & i ? 3 * 2 ** (1 + (7 & i)) : 0), n = 0, s = !1; + for (; !s; ) { + switch (e.getUint8(r++)) { + case 33: + if (!o()) + return !1; + break; + case 44: + a(); + break; + case 59: + s = !0; + break; + default: + return !1; + } + if (n > 1) + return !0; + } + function o() { + switch (e.getUint8(r++)) { + case 249: + l(); + break; + case 1: + c(); + break; + case 254: + h(); + break; + case 255: + p(); + break; + default: + return !1; + } + return !0; + } + function a() { + n++, r += 8; + const v = e.getUint8(r++); + r += 128 & v ? 3 * 2 ** (1 + (7 & v)) : 0, r++, y(); + } + function l() { + r++, r += 4, y(); + } + function c() { + n++, r++, r += 12, y(); + } + function h() { + y(); + } + function p() { + r++, r += 8, r += 3, y(); + } + function y() { + let v; + for (; v = e.getUint8(r++); ) + r += v; + } + return !1; +} +let Ntr = class { + constructor() { + this._resourceMap = /* @__PURE__ */ new Map(), this._inFlightResourceMap = /* @__PURE__ */ new Map(), this.geometryEngine = null, this.geometryEnginePromise = null; + } + destroy() { + this._inFlightResourceMap.clear(), this._resourceMap.clear(); + } + getResource(e) { + return this._resourceMap.get(e) ?? null; + } + async fetchResource(e, i) { + const r = this._resourceMap.get(e); + if (r) + return { width: r.width, height: r.height }; + let n = this._inFlightResourceMap.get(e); + return n ? n.then((s) => ({ width: s.width, height: s.height })) : (n = $tr(e, i), this._inFlightResourceMap.set(e, n), n.then((s) => (this._inFlightResourceMap.delete(e), this._resourceMap.set(e, s), { width: s.width, height: s.height }), () => ({ width: 0, height: 0 }))); + } + deleteResource(e) { + this._inFlightResourceMap.delete(e), this._resourceMap.delete(e); + } +}; +async function ktr(t, e) { + const i = window.URL.createObjectURL(t); + try { + const { data: r } = await ir(i, { ...e, responseType: "image" }); + return r; + } catch (r) { + throw us(r) ? r : new ot("mapview-invalid-resource", `Could not fetch requested resource at ${i}`); + } finally { + window.URL.revokeObjectURL(i); + } +} +async function $tr(t, e) { + const { arrayBuffer: i, mediaType: r } = await Btr(t, e), n = r === "image/png"; + return r === "image/gif" && Ltr(i) ? Mtr(i) : n && str(i) ? itr(i, e) : ktr(new Blob([i], { type: r }), e); +} +async function Btr(t, e) { + let i; + const r = ";base64,"; + if (t.includes(r)) { + const n = t.indexOf(r), s = t.indexOf(r) + r.length, o = t.substring(s), a = atob(o), l = new Uint8Array(a.length); + for (let c = 0; c < a.length; c++) + l[c] = a.charCodeAt(c); + i = { arrayBuffer: l.buffer, mediaType: t.substring(0, n).replace("data:", "") }; + } else + try { + const n = await ir(t, { responseType: "array-buffer", ...e }); + i = { arrayBuffer: n.data, mediaType: n.getHeader("Content-Type") }; + } catch (n) { + if (!us(n)) + throw new ot("mapview-invalid-resource", `Could not fetch requested resource at ${t}`); + } + return i; +} +const Vtr = (t) => t === "vertical" || t === "horizontal" || t === "cross" || t === "esriSFSCross" || t === "esriSFSVertical" || t === "esriSFSHorizontal"; +function jtr(t, e, i) { + const r = U7(Math.ceil(i)), n = Vtr(e) ? 8 * r : 16 * r, s = 2 * r; + t.width = n, t.height = n; + const o = t.getContext("2d"); + o.strokeStyle = "#FFFFFF", o.lineWidth = r, o.beginPath(), e !== "vertical" && e !== "cross" && e !== "esriSFSCross" && e !== "esriSFSVertical" || (o.moveTo(n / 2, -s), o.lineTo(n / 2, n + s)), e !== "horizontal" && e !== "cross" && e !== "esriSFSCross" && e !== "esriSFSHorizontal" || (o.moveTo(-s, n / 2), o.lineTo(n + s, n / 2)), e !== "forward-diagonal" && e !== "diagonal-cross" && e !== "esriSFSDiagonalCross" && e !== "esriSFSForwardDiagonal" || (o.moveTo(-s, -s), o.lineTo(n + s, n + s), o.moveTo(n - s, -s), o.lineTo(n + s, s), o.moveTo(-s, n - s), o.lineTo(s, n + s)), e !== "backward-diagonal" && e !== "diagonal-cross" && e !== "esriSFSBackwardDiagonal" && e !== "esriSFSDiagonalCross" || (o.moveTo(n + s, -s), o.lineTo(-s, n + s), o.moveTo(s, -s), o.lineTo(-s, s), o.moveTo(n + s, n - s), o.lineTo(n - s, n + s)), o.stroke(); + const a = o.getImageData(0, 0, t.width, t.height), l = new Uint8Array(a.data); + let c; + for (let h = 0; h < l.length; h += 4) + c = l[h + 3] / 255, l[h] = l[h] * c, l[h + 1] = l[h + 1] * c, l[h + 2] = l[h + 2] * c; + return [l, t.width, t.height]; +} +function YRt(t, e) { + const i = e === "Butt", r = e === "Square", n = !i && !r; + t.length % 2 == 1 && (t = [...t, ...t]); + const s = 15.5, o = 2 * s; + let a = 0; + for (const F of t) + a += F; + const l = Math.round(a * s), c = new Float32Array(l * o), h = 0.5 * s; + let p = 0, y = 0, v = 0.5, x = !0; + for (const F of t) { + for (p = y, y += F * s; v <= y; ) { + let k = 0.5; + for (; k < o; ) { + const V = (k - 0.5) * l + v - 0.5, j = n ? (k - s) * (k - s) : Math.abs(k - s); + c[V] = x ? i ? Math.max(Math.max(p + h - v, j), Math.max(v - y + h, j)) : j : n ? Math.min((v - p) * (v - p) + j, (v - y) * (v - y) + j) : r ? Math.min(Math.max(v - p, j), Math.max(y - v, j)) : Math.min(Math.max(v - p + h, j), Math.max(y + h - v, j)), k++; + } + v++; + } + x = !x; + } + const I = c.length, P = new Uint8Array(4 * I); + for (let F = 0; F < I; ++F) { + const k = (n ? Math.sqrt(c[F]) : c[F]) / s; + y9e(k, P, 4 * F); + } + return [P, l, o]; +} +const Gtr = 512; +let Utr = class { + constructor(e) { + this._resourceManager = e, this._rasterizationCanvas = null; + } + dispose() { + this._rasterizationCanvas = null; + } + rasterizeJSONResource(e, i, r) { + if (this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")), e.type === "simple-fill" || e.type === "esriSFS") { + const [v, x, I] = jtr(this._rasterizationCanvas, e.style, i); + return { size: [x, I], image: new Uint32Array(v.buffer), sdf: !1, simplePattern: !0, anchorX: 0, anchorY: 0, rasterizationScale: U7(Math.ceil(i)) }; + } + if (e.type === "simple-line" || e.type === "esriSLS" || e.type === "line" && e.dashTemplate) { + let v, x; + if (e.type === "simple-line" || e.type === "esriSLS") + switch (v = LMe(e.style, e.cap), e.cap) { + case "butt": + x = "Butt"; + break; + case "square": + x = "Square"; + break; + default: + x = "Round"; + } + else + v = e.dashTemplate, x = e.cim.capStyle; + const [I, P, F] = YRt(v, x); + return { size: [P, F], image: new Uint32Array(I.buffer), sdf: !0, simplePattern: !0, anchorX: 0, anchorY: 0 }; + } + let n, s = null, o = null, a = 1; + if (e.type === "simple-marker" || e.type === "esriSMS" || e.type === "line-marker" ? (n = wb.fromSimpleMarker(e), o = NMe(n)) : e.cim && e.cim.type === "CIMHatchFill" ? (n = wb.fromCIMHatchFill(e.cim, i), s = new Wfe(n.frame.xmin, -n.frame.ymax, n.frame.xmax - n.frame.xmin, n.frame.ymax - n.frame.ymin), a = i) : e.cim.markerPlacement && e.cim.markerPlacement.type === "CIMMarkerPlacementInsidePolygon" ? (n = wb.fromCIMInsidePolygon(e.cim), s = new Wfe(n.frame.xmin, -n.frame.ymax, n.frame.xmax - n.frame.xmin, n.frame.ymax - n.frame.ymin)) : (n = e.cim, e.avoidSDFRasterization || (o = NMe(n))), o && !r) { + const [v, x, I] = Per(o); + return v ? { size: [x, I], image: new Uint32Array(v.buffer), sdf: !0, simplePattern: !0, anchorX: 0, anchorY: 0, rasterizationScale: a } : null; + } + const [l, c, h, p, y] = wb.rasterize(this._rasterizationCanvas, n, s, this._resourceManager, !r); + return l ? { size: [c, h], image: new Uint32Array(l.buffer), sdf: !1, simplePattern: !1, anchorX: p, anchorY: y } : null; + } + rasterizeImageResource(e, i, r, n) { + this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")), this._rasterizationCanvas.width = e, this._rasterizationCanvas.height = i; + const s = this._rasterizationCanvas.getContext("2d"); + r instanceof ImageData ? s.putImageData(r, 0, 0) : (r.setAttribute("width", `${e}px`), r.setAttribute("height", `${i}px`), s.drawImage(r, 0, 0, e, i)); + const o = s.getImageData(0, 0, e, i), a = new Uint8Array(o.data); + if (n) { + for (const v of n) + if (v && v.oldColor && v.oldColor.length === 4 && v.newColor && v.newColor.length === 4) { + const [x, I, P, F] = v.oldColor, [k, V, j, Y] = v.newColor; + if (x === k && I === V && P === j && F === Y) + continue; + for (let X = 0; X < a.length; X += 4) + x === a[X] && I === a[X + 1] && P === a[X + 2] && F === a[X + 3] && (a[X] = k, a[X + 1] = V, a[X + 2] = j, a[X + 3] = Y); + } + } + let l; + for (let v = 0; v < a.length; v += 4) + l = a[v + 3] / 255, a[v] = a[v] * l, a[v + 1] = a[v + 1] * l, a[v + 2] = a[v + 2] * l; + let c = a, h = e, p = i; + const y = Gtr; + if (h >= y || p >= y) { + const v = h / p; + v > 1 ? (h = y, p = Math.round(y / v)) : (p = y, h = Math.round(y * v)), c = new Uint8Array(4 * h * p); + const x = new Uint8ClampedArray(c.buffer); + eZt(a, e, i, x, h, p, !1); + } + return { size: [h, p], image: new Uint32Array(c.buffer), sdf: !1, simplePattern: !1, anchorX: 0, anchorY: 0 }; + } +}; +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Qxe = { + frame: "frame", + frameAdvancing: "frame--advancing", + frameRetreating: "frame--retreating" +}, ztr = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}", XRt = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.itemMutationObserver = z4("mutation", () => this.updateFlowProps()), this.getFlowDirection = (t, e) => { + const i = t > 1; + return !(t && e > 1) && !i ? null : e < t ? "retreating" : "advancing"; + }, this.updateFlowProps = () => { + const { el: t, items: e } = this, i = Array.from(t.querySelectorAll("calcite-flow-item")).filter((a) => a.closest("calcite-flow") === t), r = e.length, n = i.length, s = i[n - 1], o = i[n - 2]; + if (n && s && i.forEach((a) => { + a.showBackButton = a === s && n > 1, a.hidden = a !== s; + }), o && (o.menuOpen = !1), this.items = i, r !== n) { + const a = this.getFlowDirection(r, n); + this.itemCount = n, this.flowDirection = a; + } + }, this.flowDirection = null, this.itemCount = 0, this.items = []; + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** + * Removes the currently active `calcite-flow-item`. + */ + async back() { + const { items: t } = this, e = t[t.length - 1]; + return e ? (e.beforeBack ? e.beforeBack : () => Promise.resolve()).call(e).then(() => (e.remove(), e)) : void 0; + } + // -------------------------------------------------------------------------- + // + // Lifecycle + // + // -------------------------------------------------------------------------- + connectedCallback() { + this.itemMutationObserver?.observe(this.el, { childList: !0, subtree: !0 }), this.updateFlowProps(); + } + disconnectedCallback() { + this.itemMutationObserver?.disconnect(); + } + // -------------------------------------------------------------------------- + // + // Private Methods + // + // -------------------------------------------------------------------------- + handleItemBackClick() { + this.back(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + render() { + const { flowDirection: t } = this, e = { + [Qxe.frame]: !0, + [Qxe.frameAdvancing]: t === "advancing", + [Qxe.frameRetreating]: t === "retreating" + }; + return pr("div", { class: e }, pr("slot", null)); + } + get el() { + return this; + } + static get style() { + return ztr; + } +}, [1, "calcite-flow", { + flowDirection: [32], + itemCount: [32], + items: [32], + back: [64] +}, [[0, "calciteFlowItemBack", "handleItemBackClick"]]]); +function KRt() { + if (typeof customElements > "u") + return; + ["calcite-flow"].forEach((e) => { + switch (e) { + case "calcite-flow": + customElements.get(e) || customElements.define(e, XRt); + break; + } + }); +} +KRt(); +const Htr = XRt, Wtr = KRt, qtr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteFlow: Htr, + defineCustomElement: Wtr +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function irt(t, e) { + return (t + e) % e; +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const MA = { + button: "button", + buttonTextVisible: "button--text-visible", + buttonCompact: "button--compact", + indicatorText: "indicator-text", + iconContainer: "icon-container", + slotContainer: "slot-container", + slotContainerHidden: "slot-container--hidden", + textContainer: "text-container", + textContainerVisible: "text-container--visible" +}, Ytr = { + tooltip: "tooltip" +}, Xtr = '@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:flex;background-color:transparent;--calcite-action-indicator-color:var(--calcite-ui-brand)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.button{position:relative;margin:0px;display:flex;inline-size:auto;cursor:pointer;align-items:center;justify-content:flex-start;border-style:none;background-color:var(--calcite-ui-foreground-1);fill:var(--calcite-ui-text-3);font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-3);outline-color:transparent;text-align:unset;flex:1 0 auto}.button:hover{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}.button:focus{background-color:var(--calcite-ui-foreground-2);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.button:active{background-color:var(--calcite-ui-foreground-3)}.button .icon-container{pointer-events:none;margin:0px;display:flex;align-items:center;justify-content:center;min-inline-size:1rem;min-block-size:1rem}.button .text-container{margin:0px;inline-size:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5rem;opacity:0;transition-property:opacity;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:margin;transition-property:inline-size}.button .text-container--visible{inline-size:auto;flex:1 1 auto;opacity:1}:host([scale=s]) .button{padding-inline:0.5rem;padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=s]) .button--text-visible .icon-container{margin-inline-end:0.5rem}:host([scale=m]) .button{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=m]) .button--text-visible .icon-container{margin-inline-end:0.75rem}:host([scale=l]) .button{padding:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=l]) .button--text-visible .icon-container{margin-inline-end:1rem}:host([alignment=center]) .button{justify-content:center}:host([alignment=end]) .button{justify-content:flex-end}:host([alignment=center]) .button .text-container--visible,:host([alignment=end]) .button .text-container--visible{flex:0 1 auto}:host([scale=s][compact]) .button,:host([scale=m][compact]) .button,:host([scale=l][compact]) .button{padding-inline:0px}.slot-container{display:flex}.slot-container--hidden{display:none}.button--text-visible{inline-size:100%}:host([active]) .button,:host([active]) .button:hover,:host([active]) .button:focus,:host([active][loading]) .button{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}:host([active]) .button:active{background-color:var(--calcite-ui-foreground-1)}:host([appearance=transparent]) .button{background-color:transparent;transition-property:box-shadow;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}:host([appearance=transparent]) .button:hover,:host([appearance=transparent]) .button:focus{background-color:transparent;box-shadow:0 0 0 2px var(--calcite-ui-border-1) inset}:host([active][appearance=transparent]) .button,:host([active][appearance=transparent]) .button:hover,:host([active][appearance=transparent]) .button:focus{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}:host([appearance=transparent][loading]) .button,:host([appearance=transparent][disabled]) .button{background-color:transparent}:host([loading]) .button,:host([loading]) .button:hover,:host([loading]) .button:focus{background-color:var(--calcite-ui-foreground-1)}:host([loading]) .button .text-container,:host([loading]) .button:hover .text-container,:host([loading]) .button:focus .text-container{opacity:var(--calcite-ui-opacity-disabled)}:host([loading]) calcite-loader[inline]{color:var(--calcite-ui-text-3);margin-inline-end:0px}:host([disabled]) .button,:host([disabled]) .button:hover,:host([disabled]) .button:focus{cursor:default;background-color:var(--calcite-ui-foreground-1);opacity:var(--calcite-ui-opacity-disabled)}:host([disabled][active]) .button,:host([disabled][active]) .button:hover,:host([disabled][active]) .button:focus{background-color:var(--calcite-ui-foreground-3);opacity:var(--calcite-ui-opacity-disabled)}:host([indicator]) .button::after{content:"";position:absolute;block-size:0.5rem;inline-size:0.5rem;border-radius:9999px;border-width:2px;background-color:var(--calcite-action-indicator-color);border-color:var(--calcite-ui-foreground-1);inset-block-end:0.75rem;inset-inline-end:0.75rem}:host([indicator]) .button--text-visible::after{inset-block-end:auto}:host([indicator]) .button--text-visible .text-container--visible{margin-inline-end:1rem}:host([indicator]) .button:hover::after,:host([indicator]) .button:focus::after{border-color:var(--calcite-ui-foreground-1)}:host([indicator][scale=s]) .button::after{inset-block-end:0.25rem;inset-inline-end:0.25rem}:host([indicator][scale=s]) .button--text-visible::after{inset-block-end:auto;inset-inline-end:0.5rem}:host([indicator][active]) .button::after{border-color:var(--calcite-ui-foreground-3)}.indicator-text{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}', JRt = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.mutationObserver = z4("mutation", () => gNe(this)), this.guid = `calcite-action-${fie()}`, this.indicatorId = `${this.guid}-indicator`, this.buttonId = `${this.guid}-button`, this.handleTooltipSlotChange = (t) => { + const i = t.target.assignedElements({ + flatten: !0 + }).filter((r) => r?.matches("calcite-tooltip"))[0]; + i && (i.referenceElement = this.buttonEl); + }, this.active = !1, this.alignment = void 0, this.appearance = "solid", this.compact = !1, this.disabled = !1, this.icon = void 0, this.iconFlipRtl = !1, this.indicator = !1, this.label = void 0, this.loading = !1, this.scale = "m", this.text = void 0, this.textEnabled = !1, this.messages = void 0, this.messageOverrides = void 0, this.effectiveLocale = "", this.defaultMessages = void 0; + } + onMessagesChange() { + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + // -------------------------------------------------------------------------- + // + // Lifecycle + // + // -------------------------------------------------------------------------- + connectedCallback() { + H4(this), X4(this), this.mutationObserver?.observe(this.el, { childList: !0, subtree: !0 }); + } + async componentWillLoad() { + GI(this), await q4(this); + } + componentDidLoad() { + UI(this); + } + disconnectedCallback() { + W4(this), K4(this), this.mutationObserver?.disconnect(); + } + componentDidRender() { + C8(this); + } + // -------------------------------------------------------------------------- + // + // Methods + // + // -------------------------------------------------------------------------- + /** Sets focus on the component. */ + async setFocus() { + await zI(this), this.buttonEl?.focus(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + renderTextContainer() { + const { text: t, textEnabled: e } = this, i = { + [MA.textContainer]: !0, + [MA.textContainerVisible]: e + }; + return t ? pr("div", { class: i, key: "text-container" }, t) : null; + } + renderIndicatorText() { + const { indicator: t, messages: e, indicatorId: i, buttonId: r } = this; + return pr("div", { "aria-labelledby": r, "aria-live": "polite", class: MA.indicatorText, id: i, role: "region" }, t ? e.indicator : null); + } + renderIconContainer() { + const { loading: t, icon: e, scale: i, el: r, iconFlipRtl: n } = this, s = i === "l" ? "m" : "s", o = i === "l" ? "l" : "m", a = t ? pr("calcite-loader", { inline: !0, label: this.messages.loading, scale: o }) : null, l = e ? pr("calcite-icon", { flipRtl: n, icon: e, scale: s }) : null, c = a || l, h = c || r.children?.length, p = pr("div", { class: { + [MA.slotContainer]: !0, + [MA.slotContainerHidden]: t + } }, pr("slot", null)); + return h ? pr("div", { "aria-hidden": "true", class: MA.iconContainer, key: "icon-container" }, c, p) : null; + } + render() { + const { active: t, compact: e, disabled: i, loading: r, textEnabled: n, label: s, text: o, indicator: a, indicatorId: l, buttonId: c, messages: h } = this, p = `${s || o}${a ? ` (${h.indicator})` : ""}`, y = { + [MA.button]: !0, + [MA.buttonTextVisible]: n, + [MA.buttonCompact]: e + }; + return pr(y3, null, pr("button", { "aria-busy": fx(r), "aria-controls": a ? l : null, "aria-disabled": fx(i), "aria-label": p, "aria-pressed": fx(t), class: y, disabled: i, id: c, ref: (v) => this.buttonEl = v }, this.renderIconContainer(), this.renderTextContainer()), pr("slot", { name: Ytr.tooltip, onSlotchange: this.handleTooltipSlotChange }), this.renderIndicatorText()); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + messageOverrides: ["onMessagesChange"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return Xtr; + } +}, [1, "calcite-action", { + active: [516], + alignment: [513], + appearance: [513], + compact: [516], + disabled: [516], + icon: [1], + iconFlipRtl: [516, "icon-flip-rtl"], + indicator: [516], + label: [1], + loading: [516], + scale: [513], + text: [1], + textEnabled: [516, "text-enabled"], + messages: [1040], + messageOverrides: [1040], + effectiveLocale: [32], + defaultMessages: [32], + setFocus: [64] +}]); +function lH() { + if (typeof customElements > "u") + return; + ["calcite-action", "calcite-icon", "calcite-loader"].forEach((e) => { + switch (e) { + case "calcite-action": + customElements.get(e) || customElements.define(e, JRt); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + } + }); +} +lH(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +function KE(t) { + return t.split("-")[1]; +} +function x9e(t) { + return t === "y" ? "height" : "width"; +} +function o3(t) { + return t.split("-")[0]; +} +function ire(t) { + return ["top", "bottom"].includes(o3(t)) ? "x" : "y"; +} +function rrt(t, e, i) { + let { + reference: r, + floating: n + } = t; + const s = r.x + r.width / 2 - n.width / 2, o = r.y + r.height / 2 - n.height / 2, a = ire(e), l = x9e(a), c = r[l] / 2 - n[l] / 2, h = o3(e), p = a === "x"; + let y; + switch (h) { + case "top": + y = { + x: s, + y: r.y - n.height + }; + break; + case "bottom": + y = { + x: s, + y: r.y + r.height + }; + break; + case "right": + y = { + x: r.x + r.width, + y: o + }; + break; + case "left": + y = { + x: r.x - n.width, + y: o + }; + break; + default: + y = { + x: r.x, + y: r.y + }; + } + switch (KE(e)) { + case "start": + y[a] -= c * (i && p ? -1 : 1); + break; + case "end": + y[a] += c * (i && p ? -1 : 1); + break; + } + return y; +} +const Ktr = async (t, e, i) => { + const { + placement: r = "bottom", + strategy: n = "absolute", + middleware: s = [], + platform: o + } = i, a = s.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(e)); + let c = await o.getElementRects({ + reference: t, + floating: e, + strategy: n + }), { + x: h, + y: p + } = rrt(c, r, l), y = r, v = {}, x = 0; + for (let I = 0; I < a.length; I++) { + const { + name: P, + fn: F + } = a[I], { + x: k, + y: V, + data: j, + reset: Y + } = await F({ + x: h, + y: p, + initialPlacement: r, + placement: y, + strategy: n, + middlewareData: v, + rects: c, + platform: o, + elements: { + reference: t, + floating: e + } + }); + if (h = k ?? h, p = V ?? p, v = { + ...v, + [P]: { + ...v[P], + ...j + } + }, Y && x <= 50) { + x++, typeof Y == "object" && (Y.placement && (y = Y.placement), Y.rects && (c = Y.rects === !0 ? await o.getElementRects({ + reference: t, + floating: e, + strategy: n + }) : Y.rects), { + x: h, + y: p + } = rrt(c, y, l)), I = -1; + continue; + } + } + return { + x: h, + y: p, + placement: y, + strategy: n, + middlewareData: v + }; +}; +function Jtr(t) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0, + ...t + }; +} +function ZRt(t) { + return typeof t != "number" ? Jtr(t) : { + top: t, + right: t, + bottom: t, + left: t + }; +} +function $Me(t) { + return { + ...t, + top: t.y, + left: t.x, + right: t.x + t.width, + bottom: t.y + t.height + }; +} +async function ute(t, e) { + var i; + e === void 0 && (e = {}); + const { + x: r, + y: n, + platform: s, + rects: o, + elements: a, + strategy: l + } = t, { + boundary: c = "clippingAncestors", + rootBoundary: h = "viewport", + elementContext: p = "floating", + altBoundary: y = !1, + padding: v = 0 + } = e, x = ZRt(v), P = a[y ? p === "floating" ? "reference" : "floating" : p], F = $Me(await s.getClippingRect({ + element: (i = await (s.isElement == null ? void 0 : s.isElement(P))) == null || i ? P : P.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(a.floating)), + boundary: c, + rootBoundary: h, + strategy: l + })), k = p === "floating" ? { + ...o.floating, + x: r, + y: n + } : o.reference, V = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), j = await (s.isElement == null ? void 0 : s.isElement(V)) ? await (s.getScale == null ? void 0 : s.getScale(V)) || { + x: 1, + y: 1 + } : { + x: 1, + y: 1 + }, Y = $Me(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({ + rect: k, + offsetParent: V, + strategy: l + }) : k); + return { + top: (F.top - Y.top + x.top) / j.y, + bottom: (Y.bottom - F.bottom + x.bottom) / j.y, + left: (F.left - Y.left + x.left) / j.x, + right: (Y.right - F.right + x.right) / j.x + }; +} +const Ztr = Math.min, Qtr = Math.max; +function BMe(t, e, i) { + return Qtr(t, Ztr(e, i)); +} +const eir = (t) => ({ + name: "arrow", + options: t, + async fn(e) { + const { + element: i, + padding: r = 0 + } = t || {}, { + x: n, + y: s, + placement: o, + rects: a, + platform: l + } = e; + if (i == null) + return {}; + const c = ZRt(r), h = { + x: n, + y: s + }, p = ire(o), y = x9e(p), v = await l.getDimensions(i), x = p === "y" ? "top" : "left", I = p === "y" ? "bottom" : "right", P = a.reference[y] + a.reference[p] - h[p] - a.floating[y], F = h[p] - a.reference[p], k = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(i)); + let V = k ? p === "y" ? k.clientHeight || 0 : k.clientWidth || 0 : 0; + V === 0 && (V = a.floating[y]); + const j = P / 2 - F / 2, Y = c[x], X = V - v[y] - c[I], Q = V / 2 - v[y] / 2 + j, re = BMe(Y, Q, X), fe = KE(o) != null && Q != re && a.reference[y] / 2 - (Q < Y ? c[x] : c[I]) - v[y] / 2 < 0 ? Q < Y ? Y - Q : X - Q : 0; + return { + [p]: h[p] - fe, + data: { + [p]: re, + centerOffset: Q - re + } + }; + } +}), QRt = ["top", "right", "bottom", "left"], nrt = /* @__PURE__ */ QRt.reduce((t, e) => t.concat(e, e + "-start", e + "-end"), []), tir = { + left: "right", + right: "left", + bottom: "top", + top: "bottom" +}; +function Xfe(t) { + return t.replace(/left|right|bottom|top/g, (e) => tir[e]); +} +function eMt(t, e, i) { + i === void 0 && (i = !1); + const r = KE(t), n = ire(t), s = x9e(n); + let o = n === "x" ? r === (i ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top"; + return e.reference[s] > e.floating[s] && (o = Xfe(o)), { + main: o, + cross: Xfe(o) + }; +} +const iir = { + start: "end", + end: "start" +}; +function Kfe(t) { + return t.replace(/start|end/g, (e) => iir[e]); +} +function rir(t, e, i) { + return (t ? [...i.filter((n) => KE(n) === t), ...i.filter((n) => KE(n) !== t)] : i.filter((n) => o3(n) === n)).filter((n) => t ? KE(n) === t || (e ? Kfe(n) !== n : !1) : !0); +} +const nir = function(t) { + return t === void 0 && (t = {}), { + name: "autoPlacement", + options: t, + async fn(e) { + var i, r, n; + const { + rects: s, + middlewareData: o, + placement: a, + platform: l, + elements: c + } = e, { + crossAxis: h = !1, + alignment: p, + allowedPlacements: y = nrt, + autoAlignment: v = !0, + ...x + } = t, I = p !== void 0 || y === nrt ? rir(p || null, v, y) : y, P = await ute(e, x), F = ((i = o.autoPlacement) == null ? void 0 : i.index) || 0, k = I[F]; + if (k == null) + return {}; + const { + main: V, + cross: j + } = eMt(k, s, await (l.isRTL == null ? void 0 : l.isRTL(c.floating))); + if (a !== k) + return { + reset: { + placement: I[0] + } + }; + const Y = [P[o3(k)], P[V], P[j]], X = [...((r = o.autoPlacement) == null ? void 0 : r.overflows) || [], { + placement: k, + overflows: Y + }], Q = I[F + 1]; + if (Q) + return { + data: { + index: F + 1, + overflows: X + }, + reset: { + placement: Q + } + }; + const re = X.map((be) => { + const Se = KE(be.placement); + return [be.placement, Se && h ? ( + // Check along the mainAxis and main crossAxis side. + be.overflows.slice(0, 2).reduce((Me, ke) => Me + ke, 0) + ) : ( + // Check only the mainAxis. + be.overflows[0] + ), be.overflows]; + }).sort((be, Se) => be[1] - Se[1]), fe = ((n = re.filter((be) => be[2].slice( + 0, + // Aligned placements should not check their opposite crossAxis + // side. + KE(be[0]) ? 2 : 3 + ).every((Se) => Se <= 0))[0]) == null ? void 0 : n[0]) || re[0][0]; + return fe !== a ? { + data: { + index: F + 1, + overflows: X + }, + reset: { + placement: fe + } + } : {}; + } + }; +}; +function sir(t) { + const e = Xfe(t); + return [Kfe(t), e, Kfe(e)]; +} +function oir(t, e, i) { + const r = ["left", "right"], n = ["right", "left"], s = ["top", "bottom"], o = ["bottom", "top"]; + switch (t) { + case "top": + case "bottom": + return i ? e ? n : r : e ? r : n; + case "left": + case "right": + return e ? s : o; + default: + return []; + } +} +function air(t, e, i, r) { + const n = KE(t); + let s = oir(o3(t), i === "start", r); + return n && (s = s.map((o) => o + "-" + n), e && (s = s.concat(s.map(Kfe)))), s; +} +const srt = function(t) { + return t === void 0 && (t = {}), { + name: "flip", + options: t, + async fn(e) { + var i; + const { + placement: r, + middlewareData: n, + rects: s, + initialPlacement: o, + platform: a, + elements: l + } = e, { + mainAxis: c = !0, + crossAxis: h = !0, + fallbackPlacements: p, + fallbackStrategy: y = "bestFit", + fallbackAxisSideDirection: v = "none", + flipAlignment: x = !0, + ...I + } = t, P = o3(r), F = o3(o) === o, k = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), V = p || (F || !x ? [Xfe(o)] : sir(o)); + !p && v !== "none" && V.push(...air(o, x, v, k)); + const j = [o, ...V], Y = await ute(e, I), X = []; + let Q = ((i = n.flip) == null ? void 0 : i.overflows) || []; + if (c && X.push(Y[P]), h) { + const { + main: be, + cross: Se + } = eMt(r, s, k); + X.push(Y[be], Y[Se]); + } + if (Q = [...Q, { + placement: r, + overflows: X + }], !X.every((be) => be <= 0)) { + var re, he; + const be = (((re = n.flip) == null ? void 0 : re.index) || 0) + 1, Se = j[be]; + if (Se) + return { + data: { + index: be, + overflows: Q + }, + reset: { + placement: Se + } + }; + let Me = (he = Q.filter((ke) => ke.overflows[0] <= 0).sort((ke, J) => ke.overflows[1] - J.overflows[1])[0]) == null ? void 0 : he.placement; + if (!Me) + switch (y) { + case "bestFit": { + var fe; + const ke = (fe = Q.map((J) => [J.placement, J.overflows.filter((ce) => ce > 0).reduce((ce, xe) => ce + xe, 0)]).sort((J, ce) => J[1] - ce[1])[0]) == null ? void 0 : fe[0]; + ke && (Me = ke); + break; + } + case "initialPlacement": + Me = o; + break; + } + if (r !== Me) + return { + reset: { + placement: Me + } + }; + } + return {}; + } + }; +}; +function ort(t, e) { + return { + top: t.top - e.height, + right: t.right - e.width, + bottom: t.bottom - e.height, + left: t.left - e.width + }; +} +function art(t) { + return QRt.some((e) => t[e] >= 0); +} +const lir = function(t) { + return t === void 0 && (t = {}), { + name: "hide", + options: t, + async fn(e) { + const { + strategy: i = "referenceHidden", + ...r + } = t, { + rects: n + } = e; + switch (i) { + case "referenceHidden": { + const s = await ute(e, { + ...r, + elementContext: "reference" + }), o = ort(s, n.reference); + return { + data: { + referenceHiddenOffsets: o, + referenceHidden: art(o) + } + }; + } + case "escaped": { + const s = await ute(e, { + ...r, + altBoundary: !0 + }), o = ort(s, n.floating); + return { + data: { + escapedOffsets: o, + escaped: art(o) + } + }; + } + default: + return {}; + } + } + }; +}; +async function uir(t, e) { + const { + placement: i, + platform: r, + elements: n + } = t, s = await (r.isRTL == null ? void 0 : r.isRTL(n.floating)), o = o3(i), a = KE(i), l = ire(i) === "x", c = ["left", "top"].includes(o) ? -1 : 1, h = s && l ? -1 : 1, p = typeof e == "function" ? e(t) : e; + let { + mainAxis: y, + crossAxis: v, + alignmentAxis: x + } = typeof p == "number" ? { + mainAxis: p, + crossAxis: 0, + alignmentAxis: null + } : { + mainAxis: 0, + crossAxis: 0, + alignmentAxis: null, + ...p + }; + return a && typeof x == "number" && (v = a === "end" ? x * -1 : x), l ? { + x: v * h, + y: y * c + } : { + x: y * c, + y: v * h + }; +} +const cir = function(t) { + return t === void 0 && (t = 0), { + name: "offset", + options: t, + async fn(e) { + const { + x: i, + y: r + } = e, n = await uir(e, t); + return { + x: i + n.x, + y: r + n.y, + data: n + }; + } + }; +}; +function hir(t) { + return t === "x" ? "y" : "x"; +} +const dir = function(t) { + return t === void 0 && (t = {}), { + name: "shift", + options: t, + async fn(e) { + const { + x: i, + y: r, + placement: n + } = e, { + mainAxis: s = !0, + crossAxis: o = !1, + limiter: a = { + fn: (P) => { + let { + x: F, + y: k + } = P; + return { + x: F, + y: k + }; + } + }, + ...l + } = t, c = { + x: i, + y: r + }, h = await ute(e, l), p = ire(o3(n)), y = hir(p); + let v = c[p], x = c[y]; + if (s) { + const P = p === "y" ? "top" : "left", F = p === "y" ? "bottom" : "right", k = v + h[P], V = v - h[F]; + v = BMe(k, v, V); + } + if (o) { + const P = y === "y" ? "top" : "left", F = y === "y" ? "bottom" : "right", k = x + h[P], V = x - h[F]; + x = BMe(k, x, V); + } + const I = a.fn({ + ...e, + [p]: v, + [y]: x + }); + return { + ...I, + data: { + x: I.x - i, + y: I.y - r + } + }; + } + }; +}; +function Ib(t) { + var e; + return ((e = t.ownerDocument) == null ? void 0 : e.defaultView) || window; +} +function wI(t) { + return Ib(t).getComputedStyle(t); +} +const lrt = Math.min, nZ = Math.max, Jfe = Math.round; +function tMt(t) { + const e = wI(t); + let i = parseFloat(e.width), r = parseFloat(e.height); + const n = t.offsetWidth, s = t.offsetHeight, o = Jfe(i) !== n || Jfe(r) !== s; + return o && (i = n, r = s), { + width: i, + height: r, + fallback: o + }; +} +function h4(t) { + return rMt(t) ? (t.nodeName || "").toLowerCase() : ""; +} +let Xoe; +function iMt() { + if (Xoe) + return Xoe; + const t = navigator.userAgentData; + return t && Array.isArray(t.brands) ? (Xoe = t.brands.map((e) => e.brand + "/" + e.version).join(" "), Xoe) : navigator.userAgent; +} +function xI(t) { + return t instanceof Ib(t).HTMLElement; +} +function DS(t) { + return t instanceof Ib(t).Element; +} +function rMt(t) { + return t instanceof Ib(t).Node; +} +function urt(t) { + if (typeof ShadowRoot > "u") + return !1; + const e = Ib(t).ShadowRoot; + return t instanceof e || t instanceof ShadowRoot; +} +function Pve(t) { + const { + overflow: e, + overflowX: i, + overflowY: r, + display: n + } = wI(t); + return /auto|scroll|overlay|hidden|clip/.test(e + r + i) && !["inline", "contents"].includes(n); +} +function pir(t) { + return ["table", "td", "th"].includes(h4(t)); +} +function S9e(t) { + const e = /firefox/i.test(iMt()), i = wI(t), r = i.backdropFilter || i.WebkitBackdropFilter; + return i.transform !== "none" || i.perspective !== "none" || (r ? r !== "none" : !1) || e && i.willChange === "filter" || e && (i.filter ? i.filter !== "none" : !1) || ["transform", "perspective"].some((n) => i.willChange.includes(n)) || ["paint", "layout", "strict", "content"].some((n) => { + const s = i.contain; + return s != null ? s.includes(n) : !1; + }); +} +function C9e() { + return /^((?!chrome|android).)*safari/i.test(iMt()); +} +function T9e(t) { + return ["html", "body", "#document"].includes(h4(t)); +} +function nMt(t) { + return DS(t) ? t : t.contextElement; +} +const sMt = { + x: 1, + y: 1 +}; +function E7(t) { + const e = nMt(t); + if (!xI(e)) + return sMt; + const i = e.getBoundingClientRect(), { + width: r, + height: n, + fallback: s + } = tMt(e); + let o = (s ? Jfe(i.width) : i.width) / r, a = (s ? Jfe(i.height) : i.height) / n; + return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), { + x: o, + y: a + }; +} +function H$(t, e, i, r) { + var n, s; + e === void 0 && (e = !1), i === void 0 && (i = !1); + const o = t.getBoundingClientRect(), a = nMt(t); + let l = sMt; + e && (r ? DS(r) && (l = E7(r)) : l = E7(t)); + const c = a ? Ib(a) : window, h = C9e() && i; + let p = (o.left + (h && ((n = c.visualViewport) == null ? void 0 : n.offsetLeft) || 0)) / l.x, y = (o.top + (h && ((s = c.visualViewport) == null ? void 0 : s.offsetTop) || 0)) / l.y, v = o.width / l.x, x = o.height / l.y; + if (a) { + const I = Ib(a), P = r && DS(r) ? Ib(r) : r; + let F = I.frameElement; + for (; F && r && P !== I; ) { + const k = E7(F), V = F.getBoundingClientRect(), j = getComputedStyle(F); + V.x += (F.clientLeft + parseFloat(j.paddingLeft)) * k.x, V.y += (F.clientTop + parseFloat(j.paddingTop)) * k.y, p *= k.x, y *= k.y, v *= k.x, x *= k.y, p += V.x, y += V.y, F = Ib(F).frameElement; + } + } + return { + width: v, + height: x, + top: y, + right: p + v, + bottom: y + x, + left: p, + x: p, + y + }; +} +function Z4(t) { + return ((rMt(t) ? t.ownerDocument : t.document) || window.document).documentElement; +} +function Ove(t) { + return DS(t) ? { + scrollLeft: t.scrollLeft, + scrollTop: t.scrollTop + } : { + scrollLeft: t.pageXOffset, + scrollTop: t.pageYOffset + }; +} +function fir(t) { + let { + rect: e, + offsetParent: i, + strategy: r + } = t; + const n = xI(i), s = Z4(i); + if (i === s) + return e; + let o = { + scrollLeft: 0, + scrollTop: 0 + }, a = { + x: 1, + y: 1 + }; + const l = { + x: 0, + y: 0 + }; + if ((n || !n && r !== "fixed") && ((h4(i) !== "body" || Pve(s)) && (o = Ove(i)), xI(i))) { + const c = H$(i); + a = E7(i), l.x = c.x + i.clientLeft, l.y = c.y + i.clientTop; + } + return { + width: e.width * a.x, + height: e.height * a.y, + x: e.x * a.x - o.scrollLeft * a.x + l.x, + y: e.y * a.y - o.scrollTop * a.y + l.y + }; +} +function oMt(t) { + return H$(Z4(t)).left + Ove(t).scrollLeft; +} +function mir(t) { + const e = Z4(t), i = Ove(t), r = t.ownerDocument.body, n = nZ(e.scrollWidth, e.clientWidth, r.scrollWidth, r.clientWidth), s = nZ(e.scrollHeight, e.clientHeight, r.scrollHeight, r.clientHeight); + let o = -i.scrollLeft + oMt(t); + const a = -i.scrollTop; + return wI(r).direction === "rtl" && (o += nZ(e.clientWidth, r.clientWidth) - n), { + width: n, + height: s, + x: o, + y: a + }; +} +function cte(t) { + if (h4(t) === "html") + return t; + const e = ( + // Step into the shadow DOM of the parent of a slotted node. + t.assignedSlot || // DOM Element detected. + t.parentNode || // ShadowRoot detected. + urt(t) && t.host || // Fallback. + Z4(t) + ); + return urt(e) ? e.host : e; +} +function aMt(t) { + const e = cte(t); + return T9e(e) ? e.ownerDocument.body : xI(e) && Pve(e) ? e : aMt(e); +} +function sZ(t, e) { + var i; + e === void 0 && (e = []); + const r = aMt(t), n = r === ((i = t.ownerDocument) == null ? void 0 : i.body), s = Ib(r); + return n ? e.concat(s, s.visualViewport || [], Pve(r) ? r : []) : e.concat(r, sZ(r)); +} +function gir(t, e) { + const i = Ib(t), r = Z4(t), n = i.visualViewport; + let s = r.clientWidth, o = r.clientHeight, a = 0, l = 0; + if (n) { + s = n.width, o = n.height; + const c = C9e(); + (!c || c && e === "fixed") && (a = n.offsetLeft, l = n.offsetTop); + } + return { + width: s, + height: o, + x: a, + y: l + }; +} +function yir(t, e) { + const i = H$(t, !0, e === "fixed"), r = i.top + t.clientTop, n = i.left + t.clientLeft, s = xI(t) ? E7(t) : { + x: 1, + y: 1 + }, o = t.clientWidth * s.x, a = t.clientHeight * s.y, l = n * s.x, c = r * s.y; + return { + width: o, + height: a, + x: l, + y: c + }; +} +function crt(t, e, i) { + let r; + if (e === "viewport") + r = gir(t, i); + else if (e === "document") + r = mir(Z4(t)); + else if (DS(e)) + r = yir(e, i); + else { + const o = { + ...e + }; + if (C9e()) { + var n, s; + const a = Ib(t); + o.x -= ((n = a.visualViewport) == null ? void 0 : n.offsetLeft) || 0, o.y -= ((s = a.visualViewport) == null ? void 0 : s.offsetTop) || 0; + } + r = o; + } + return $Me(r); +} +function vir(t, e) { + const i = e.get(t); + if (i) + return i; + let r = sZ(t).filter((a) => DS(a) && h4(a) !== "body"), n = null; + const s = wI(t).position === "fixed"; + let o = s ? cte(t) : t; + for (; DS(o) && !T9e(o); ) { + const a = wI(o), l = S9e(o); + a.position === "fixed" ? n = null : (s ? !l && !n : !l && a.position === "static" && !!n && ["absolute", "fixed"].includes(n.position)) ? r = r.filter((p) => p !== o) : n = a, o = cte(o); + } + return e.set(t, r), r; +} +function _ir(t) { + let { + element: e, + boundary: i, + rootBoundary: r, + strategy: n + } = t; + const o = [...i === "clippingAncestors" ? vir(e, this._c) : [].concat(i), r], a = o[0], l = o.reduce((c, h) => { + const p = crt(e, h, n); + return c.top = nZ(p.top, c.top), c.right = lrt(p.right, c.right), c.bottom = lrt(p.bottom, c.bottom), c.left = nZ(p.left, c.left), c; + }, crt(e, a, n)); + return { + width: l.right - l.left, + height: l.bottom - l.top, + x: l.left, + y: l.top + }; +} +function bir(t) { + return xI(t) ? tMt(t) : t.getBoundingClientRect(); +} +function hrt(t, e) { + return !xI(t) || wI(t).position === "fixed" ? null : e ? e(t) : t.offsetParent; +} +function wir(t) { + let e = cte(t); + for (; xI(e) && !T9e(e); ) { + if (S9e(e)) + return e; + e = cte(e); + } + return null; +} +function drt(t, e) { + const i = Ib(t); + let r = hrt(t, e); + for (; r && pir(r) && wI(r).position === "static"; ) + r = hrt(r, e); + return r && (h4(r) === "html" || h4(r) === "body" && wI(r).position === "static" && !S9e(r)) ? i : r || wir(t) || i; +} +function xir(t, e, i) { + const r = xI(e), n = Z4(e), s = H$(t, !0, i === "fixed", e); + let o = { + scrollLeft: 0, + scrollTop: 0 + }; + const a = { + x: 0, + y: 0 + }; + if (r || !r && i !== "fixed") + if ((h4(e) !== "body" || Pve(n)) && (o = Ove(e)), xI(e)) { + const l = H$(e, !0); + a.x = l.x + e.clientLeft, a.y = l.y + e.clientTop; + } else + n && (a.x = oMt(n)); + return { + x: s.left + o.scrollLeft - a.x, + y: s.top + o.scrollTop - a.y, + width: s.width, + height: s.height + }; +} +const VMe = { + getClippingRect: _ir, + convertOffsetParentRelativeRectToViewportRelativeRect: fir, + isElement: DS, + getDimensions: bir, + getOffsetParent: drt, + getDocumentElement: Z4, + getScale: E7, + async getElementRects(t) { + let { + reference: e, + floating: i, + strategy: r + } = t; + const n = this.getOffsetParent || drt, s = this.getDimensions; + return { + reference: xir(e, await n(i), r), + floating: { + x: 0, + y: 0, + ...await s(i) + } + }; + }, + getClientRects: (t) => Array.from(t.getClientRects()), + isRTL: (t) => wI(t).direction === "rtl" +}; +function Sir(t, e, i, r) { + r === void 0 && (r = {}); + const { + ancestorScroll: n = !0, + ancestorResize: s = !0, + elementResize: o = !0, + animationFrame: a = !1 + } = r, l = n && !a, c = l || s ? [...DS(t) ? sZ(t) : t.contextElement ? sZ(t.contextElement) : [], ...sZ(e)] : []; + c.forEach((x) => { + l && x.addEventListener("scroll", i, { + passive: !0 + }), s && x.addEventListener("resize", i); + }); + let h = null; + if (o) { + let x = !0; + h = new ResizeObserver(() => { + x || i(), x = !1; + }), DS(t) && !a && h.observe(t), !DS(t) && t.contextElement && !a && h.observe(t.contextElement), h.observe(e); + } + let p, y = a ? H$(t) : null; + a && v(); + function v() { + const x = H$(t); + y && (x.x !== y.x || x.y !== y.y || x.width !== y.width || x.height !== y.height) && i(), y = x, p = requestAnimationFrame(v); + } + return i(), () => { + var x; + c.forEach((I) => { + l && I.removeEventListener("scroll", i), s && I.removeEventListener("resize", i); + }), (x = h) == null || x.disconnect(), h = null, a && cancelAnimationFrame(p); + }; +} +const Cir = (t, e, i) => { + const r = /* @__PURE__ */ new Map(), n = { + platform: VMe, + ...i + }, s = { + ...n.platform, + _c: r + }; + return Ktr(t, e, { + ...n, + platform: s + }); +}, Tir = globalThis.calciteComponentsConfig, Eir = { + /** + * We apply a custom fix to improve positioning for non-Chromium browsers. + * The fix comes at a performance cost, so provides users a way to opt-out if necessary. + * + * @internal + */ + floatingUINonChromiumPositioningFix: !0, + ...Tir +}, Iir = Air(); +async function Air() { + function t() { + return navigator.userAgentData; + } + function e() { + const r = t(); + return r?.brands ? r.brands.map(({ brand: n, version: s }) => `${n}/${s}`).join(" ") : navigator.userAgent; + } + function i() { + const r = t(); + return r?.brands ? !!r.brands.find(({ brand: n, version: s }) => (n === "Google Chrome" || n === "Chromium") && Number(s) >= 109) : !!navigator.userAgent.split(" ").find((n) => { + const [s, o] = n.split("/"); + return s === "Chrome" && parseInt(o) >= 109; + }); + } + if (Eir.floatingUINonChromiumPositioningFix && // ⚠️ browser-sniffing is not a best practice and should be avoided ⚠️ + (/firefox|safari/i.test(e()) || i())) { + const { offsetParent: r } = await Promise.resolve().then(() => ELr), n = VMe.getOffsetParent; + VMe.getOffsetParent = (s) => n(s, r); + } +} +const lMt = "data-placement", prt = 100, frt = [ + "top", + "bottom", + "right", + "left", + "top-start", + "top-end", + "bottom-start", + "bottom-end", + "right-start", + "right-end", + "left-start", + "left-end" +], hte = { + animation: "calcite-floating-ui-anim", + animationActive: "calcite-floating-ui-anim--active" +}; +function Pir({ placement: t, flipDisabled: e, flipPlacements: i, offsetDistance: r, offsetSkidding: n, arrowEl: s, type: o }) { + const a = [dir(), lir()]; + if (o === "menu") + return [ + ...a, + srt({ + fallbackPlacements: i || ["top-start", "top", "top-end", "bottom-start", "bottom", "bottom-end"] + }) + ]; + if (o === "popover" || o === "tooltip") { + const l = [ + ...a, + cir({ + mainAxis: typeof r == "number" ? r : 0, + crossAxis: typeof n == "number" ? n : 0 + }) + ]; + return t === "auto" || t === "auto-start" || t === "auto-end" ? l.push(nir({ alignment: t === "auto-start" ? "start" : t === "auto-end" ? "end" : null })) : e || l.push(srt(i ? { fallbackPlacements: i } : {})), s && l.push(eir({ + element: s + })), l; + } + return []; +} +function Oir(t, e) { + const i = t.filter((r) => frt.includes(r)); + return i.length !== t.length && console.warn(`${e.tagName}: Invalid value found in: flipPlacements. Try any of these: ${frt.map((r) => `"${r}"`).join(", ").trim()}`, { el: e }), i; +} +function Rir(t, e) { + const i = ["left", "right"]; + return mie(t) === "rtl" && i.reverse(), e.replace(/leading/gi, i[0]).replace(/trailing/gi, i[1]); +} +async function uMt(t, e, i = !1) { + if (t.open) + return i ? Mir(e) : cMt(e); +} +const Mir = jfe(cMt, prt, { + leading: !0, + maxWait: prt +}); +async function cMt({ referenceEl: t, floatingEl: e, overlayPositioning: i = "absolute", placement: r, flipDisabled: n, flipPlacements: s, offsetDistance: o, offsetSkidding: a, includeArrow: l = !1, arrowEl: c, type: h }) { + if (!t || !e || l && !c) + return null; + await Iir; + const { x: p, y, placement: v, strategy: x, middlewareData: I } = await Cir(t, e, { + strategy: i, + placement: r === "auto" || r === "auto-start" || r === "auto-end" ? void 0 : Rir(e, r), + middleware: Pir({ + placement: r, + flipDisabled: n, + flipPlacements: s, + offsetDistance: o, + offsetSkidding: a, + arrowEl: c, + type: h + }) + }); + if (I?.arrow) { + const { x: j, y: Y } = I.arrow; + Object.assign(c.style, { + left: j != null ? `${j}px` : "", + top: Y != null ? `${Y}px` : "" + }); + } + const F = I?.hide?.referenceHidden ? "hidden" : null, k = F ? "none" : null; + e.setAttribute(lMt, v); + const V = `translate(${Math.round(p)}px,${Math.round(y)}px)`; + Object.assign(e.style, { + visibility: F, + pointerEvents: k, + position: x, + top: "0", + left: "0", + transform: V + }); +} +const jMe = /* @__PURE__ */ new WeakMap(); +function hMt(t, e, i) { + if (!i || !e) + return; + E9e(t, e, i); + const r = t.overlayPositioning; + Object.assign(i.style, { + visibility: "hidden", + pointerEvents: "none", + position: r + }), r === "absolute" && fMt(i); + const n = Sir; + jMe.set(t, n(e, i, () => t.reposition())); +} +function E9e(t, e, i) { + if (!i || !e) + return; + I9e(i).removeEventListener("transitionend", A9e); + const r = jMe.get(t); + r && r(), jMe.delete(t); +} +const mrt = 4, dMt = Math.ceil(Math.hypot(mrt, mrt)); +function pMt(t) { + !t || t.style.position !== "absolute" || I9e(t).addEventListener("transitionend", A9e); +} +function I9e(t) { + return t.shadowRoot || t; +} +function A9e(t) { + const e = t.target; + if ( + // using any prop from floating-ui transition + t.propertyName === "opacity" && e.classList.contains(hte.animation) + ) { + const i = Dir(e); + fMt(i), I9e(i).removeEventListener("transitionend", A9e); + } +} +function fMt(t) { + t.style.transform = "", t.style.top = "0", t.style.left = "0"; +} +function Dir(t) { + return jz(t, `[${lMt}]`); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +/*! +* focus-trap 7.2.0 +* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE +*/ +function grt(t, e) { + var i = Object.keys(t); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(t); + e && (r = r.filter(function(n) { + return Object.getOwnPropertyDescriptor(t, n).enumerable; + })), i.push.apply(i, r); + } + return i; +} +function yrt(t) { + for (var e = 1; e < arguments.length; e++) { + var i = arguments[e] != null ? arguments[e] : {}; + e % 2 ? grt(Object(i), !0).forEach(function(r) { + Fir(t, r, i[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : grt(Object(i)).forEach(function(r) { + Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(i, r)); + }); + } + return t; +} +function Fir(t, e, i) { + return e = Nir(e), e in t ? Object.defineProperty(t, e, { + value: i, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[e] = i, t; +} +function Lir(t, e) { + if (typeof t != "object" || t === null) + return t; + var i = t[Symbol.toPrimitive]; + if (i !== void 0) { + var r = i.call(t, e || "default"); + if (typeof r != "object") + return r; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (e === "string" ? String : Number)(t); +} +function Nir(t) { + var e = Lir(t, "string"); + return typeof e == "symbol" ? e : String(e); +} +var vrt = { + activateTrap: function(e, i) { + if (e.length > 0) { + var r = e[e.length - 1]; + r !== i && r.pause(); + } + var n = e.indexOf(i); + n === -1 || e.splice(n, 1), e.push(i); + }, + deactivateTrap: function(e, i) { + var r = e.indexOf(i); + r !== -1 && e.splice(r, 1), e.length > 0 && e[e.length - 1].unpause(); + } +}, kir = function(e) { + return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function"; +}, $ir = function(e) { + return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27; +}, oZ = function(e) { + return e.key === "Tab" || e.keyCode === 9; +}, Bir = function(e) { + return oZ(e) && !e.shiftKey; +}, Vir = function(e) { + return oZ(e) && e.shiftKey; +}, _rt = function(e) { + return setTimeout(e, 0); +}, brt = function(e, i) { + var r = -1; + return e.every(function(n, s) { + return i(n) ? (r = s, !1) : !0; + }), r; +}, bq = function(e) { + for (var i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), n = 1; n < i; n++) + r[n - 1] = arguments[n]; + return typeof e == "function" ? e.apply(void 0, r) : e; +}, Koe = function(e) { + return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target; +}, jir = [], Gir = function(e, i) { + var r = i?.document || document, n = i?.trapStack || jir, s = yrt({ + returnFocusOnDeactivate: !0, + escapeDeactivates: !0, + delayInitialFocus: !0, + isKeyForward: Bir, + isKeyBackward: Vir + }, i), o = { + // containers given to createFocusTrap() + // @type {Array} + containers: [], + // list of objects identifying tabbable nodes in `containers` in the trap + // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap + // is active, but the trap should never get to a state where there isn't at least one group + // with at least one tabbable node in it (that would lead to an error condition that would + // result in an error being thrown) + // @type {Array<{ + // container: HTMLElement, + // tabbableNodes: Array, // empty if none + // focusableNodes: Array, // empty if none + // firstTabbableNode: HTMLElement|null, + // lastTabbableNode: HTMLElement|null, + // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined + // }>} + containerGroups: [], + // same order/length as `containers` list + // references to objects in `containerGroups`, but only those that actually have + // tabbable nodes in them + // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__ + // the same length + tabbableGroups: [], + nodeFocusedBeforeActivation: null, + mostRecentlyFocusedNode: null, + active: !1, + paused: !1, + // timer ID for when delayInitialFocus is true and initial focus in this trap + // has been delayed during activation + delayInitialFocusTimer: void 0 + }, a, l = function(Q, re, he) { + return Q && Q[re] !== void 0 ? Q[re] : s[he || re]; + }, c = function(Q) { + return o.containerGroups.findIndex(function(re) { + var he = re.container, fe = re.tabbableNodes; + return he.contains(Q) || // fall back to explicit tabbable search which will take into consideration any + // web components if the `tabbableOptions.getShadowRoot` option was used for + // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't + // look inside web components even if open) + fe.find(function(be) { + return be === Q; + }); + }); + }, h = function(Q) { + var re = s[Q]; + if (typeof re == "function") { + for (var he = arguments.length, fe = new Array(he > 1 ? he - 1 : 0), be = 1; be < he; be++) + fe[be - 1] = arguments[be]; + re = re.apply(void 0, fe); + } + if (re === !0 && (re = void 0), !re) { + if (re === void 0 || re === !1) + return re; + throw new Error("`".concat(Q, "` was specified but was not a node, or did not return a node")); + } + var Se = re; + if (typeof re == "string" && (Se = r.querySelector(re), !Se)) + throw new Error("`".concat(Q, "` as selector refers to no known node")); + return Se; + }, p = function() { + var Q = h("initialFocus"); + if (Q === !1) + return !1; + if (Q === void 0) + if (c(r.activeElement) >= 0) + Q = r.activeElement; + else { + var re = o.tabbableGroups[0], he = re && re.firstTabbableNode; + Q = he || h("fallbackFocus"); + } + if (!Q) + throw new Error("Your focus-trap needs to have at least one focusable element"); + return Q; + }, y = function() { + if (o.containerGroups = o.containers.map(function(Q) { + var re = $vt(Q, s.tabbableOptions), he = Msi(Q, s.tabbableOptions); + return { + container: Q, + tabbableNodes: re, + focusableNodes: he, + firstTabbableNode: re.length > 0 ? re[0] : null, + lastTabbableNode: re.length > 0 ? re[re.length - 1] : null, + /** + * Finds the __tabbable__ node that follows the given node in the specified direction, + * in this container, if any. + * @param {HTMLElement} node + * @param {boolean} [forward] True if going in forward tab order; false if going + * in reverse. + * @returns {HTMLElement|undefined} The next tabbable node, if any. + */ + nextTabbableNode: function(be) { + var Se = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, Me = he.findIndex(function(ke) { + return ke === be; + }); + if (!(Me < 0)) + return Se ? he.slice(Me + 1).find(function(ke) { + return xse(ke, s.tabbableOptions); + }) : he.slice(0, Me).reverse().find(function(ke) { + return xse(ke, s.tabbableOptions); + }); + } + }; + }), o.tabbableGroups = o.containerGroups.filter(function(Q) { + return Q.tabbableNodes.length > 0; + }), o.tabbableGroups.length <= 0 && !h("fallbackFocus")) + throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times"); + }, v = function X(Q) { + if (Q !== !1 && Q !== r.activeElement) { + if (!Q || !Q.focus) { + X(p()); + return; + } + Q.focus({ + preventScroll: !!s.preventScroll + }), o.mostRecentlyFocusedNode = Q, kir(Q) && Q.select(); + } + }, x = function(Q) { + var re = h("setReturnFocus", Q); + return re || (re === !1 ? !1 : Q); + }, I = function(Q) { + var re = Koe(Q); + if (!(c(re) >= 0)) { + if (bq(s.clickOutsideDeactivates, Q)) { + a.deactivate({ + // if, on deactivation, we should return focus to the node originally-focused + // when the trap was activated (or the configured `setReturnFocus` node), + // then assume it's also OK to return focus to the outside node that was + // just clicked, causing deactivation, as long as that node is focusable; + // if it isn't focusable, then return focus to the original node focused + // on activation (or the configured `setReturnFocus` node) + // NOTE: by setting `returnFocus: false`, deactivate() will do nothing, + // which will result in the outside click setting focus to the node + // that was clicked, whether it's focusable or not; by setting + // `returnFocus: true`, we'll attempt to re-focus the node originally-focused + // on activation (or the configured `setReturnFocus` node) + returnFocus: s.returnFocusOnDeactivate && !mbe(re, s.tabbableOptions) + }); + return; + } + bq(s.allowOutsideClick, Q) || Q.preventDefault(); + } + }, P = function(Q) { + var re = Koe(Q), he = c(re) >= 0; + he || re instanceof Document ? he && (o.mostRecentlyFocusedNode = re) : (Q.stopImmediatePropagation(), v(o.mostRecentlyFocusedNode || p())); + }, F = function(Q) { + var re = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, he = Koe(Q); + y(); + var fe = null; + if (o.tabbableGroups.length > 0) { + var be = c(he), Se = be >= 0 ? o.containerGroups[be] : void 0; + if (be < 0) + re ? fe = o.tabbableGroups[o.tabbableGroups.length - 1].lastTabbableNode : fe = o.tabbableGroups[0].firstTabbableNode; + else if (re) { + var Me = brt(o.tabbableGroups, function(Oe) { + var Re = Oe.firstTabbableNode; + return he === Re; + }); + if (Me < 0 && (Se.container === he || mbe(he, s.tabbableOptions) && !xse(he, s.tabbableOptions) && !Se.nextTabbableNode(he, !1)) && (Me = be), Me >= 0) { + var ke = Me === 0 ? o.tabbableGroups.length - 1 : Me - 1, J = o.tabbableGroups[ke]; + fe = J.lastTabbableNode; + } else + oZ(Q) || (fe = Se.nextTabbableNode(he, !1)); + } else { + var ce = brt(o.tabbableGroups, function(Oe) { + var Re = Oe.lastTabbableNode; + return he === Re; + }); + if (ce < 0 && (Se.container === he || mbe(he, s.tabbableOptions) && !xse(he, s.tabbableOptions) && !Se.nextTabbableNode(he)) && (ce = be), ce >= 0) { + var xe = ce === o.tabbableGroups.length - 1 ? 0 : ce + 1, Pe = o.tabbableGroups[xe]; + fe = Pe.firstTabbableNode; + } else + oZ(Q) || (fe = Se.nextTabbableNode(he)); + } + } else + fe = h("fallbackFocus"); + fe && (oZ(Q) && Q.preventDefault(), v(fe)); + }, k = function(Q) { + if ($ir(Q) && bq(s.escapeDeactivates, Q) !== !1) { + Q.preventDefault(), a.deactivate(); + return; + } + (s.isKeyForward(Q) || s.isKeyBackward(Q)) && F(Q, s.isKeyBackward(Q)); + }, V = function(Q) { + var re = Koe(Q); + c(re) >= 0 || bq(s.clickOutsideDeactivates, Q) || bq(s.allowOutsideClick, Q) || (Q.preventDefault(), Q.stopImmediatePropagation()); + }, j = function() { + if (o.active) + return vrt.activateTrap(n, a), o.delayInitialFocusTimer = s.delayInitialFocus ? _rt(function() { + v(p()); + }) : v(p()), r.addEventListener("focusin", P, !0), r.addEventListener("mousedown", I, { + capture: !0, + passive: !1 + }), r.addEventListener("touchstart", I, { + capture: !0, + passive: !1 + }), r.addEventListener("click", V, { + capture: !0, + passive: !1 + }), r.addEventListener("keydown", k, { + capture: !0, + passive: !1 + }), a; + }, Y = function() { + if (o.active) + return r.removeEventListener("focusin", P, !0), r.removeEventListener("mousedown", I, !0), r.removeEventListener("touchstart", I, !0), r.removeEventListener("click", V, !0), r.removeEventListener("keydown", k, !0), a; + }; + return a = { + get active() { + return o.active; + }, + get paused() { + return o.paused; + }, + activate: function(Q) { + if (o.active) + return this; + var re = l(Q, "onActivate"), he = l(Q, "onPostActivate"), fe = l(Q, "checkCanFocusTrap"); + fe || y(), o.active = !0, o.paused = !1, o.nodeFocusedBeforeActivation = r.activeElement, re && re(); + var be = function() { + fe && y(), j(), he && he(); + }; + return fe ? (fe(o.containers.concat()).then(be, be), this) : (be(), this); + }, + deactivate: function(Q) { + if (!o.active) + return this; + var re = yrt({ + onDeactivate: s.onDeactivate, + onPostDeactivate: s.onPostDeactivate, + checkCanReturnFocus: s.checkCanReturnFocus + }, Q); + clearTimeout(o.delayInitialFocusTimer), o.delayInitialFocusTimer = void 0, Y(), o.active = !1, o.paused = !1, vrt.deactivateTrap(n, a); + var he = l(re, "onDeactivate"), fe = l(re, "onPostDeactivate"), be = l(re, "checkCanReturnFocus"), Se = l(re, "returnFocus", "returnFocusOnDeactivate"); + he && he(); + var Me = function() { + _rt(function() { + Se && v(x(o.nodeFocusedBeforeActivation)), fe && fe(); + }); + }; + return Se && be ? (be(x(o.nodeFocusedBeforeActivation)).then(Me, Me), this) : (Me(), this); + }, + pause: function() { + return o.paused || !o.active ? this : (o.paused = !0, Y(), this); + }, + unpause: function() { + return !o.paused || !o.active ? this : (o.paused = !1, y(), j(), this); + }, + updateContainerElements: function(Q) { + var re = [].concat(Q).filter(Boolean); + return o.containers = re.map(function(he) { + return typeof he == "string" ? r.querySelector(he) : he; + }), o.active && y(), this; + } + }, a.updateContainerElements(e), a; +}; +const Uir = []; +function zir(t) { + const { focusTrapEl: e } = t; + if (!e) + return; + e.tabIndex == null && (e.tabIndex = -1); + const i = { + clickOutsideDeactivates: !0, + document: e.ownerDocument, + escapeDeactivates: !1, + fallbackFocus: e, + setReturnFocus: (r) => (Uvt(r), !1), + tabbableOptions: Bvt, + trapStack: Uir + }; + t.focusTrap = Gir(e, i); +} +function wrt(t) { + t.focusTrapDisabled || t.focusTrap?.activate(); +} +function e2e(t) { + t.focusTrap?.deactivate(); +} +function Hir(t) { + t.focusTrap?.updateContainerElements(t.focusTrapEl); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const wce = /* @__PURE__ */ new WeakMap(); +function Wir(t) { + t.propertyName === this.openTransitionProp && t.target === this.transitionEl && (this.open ? this.onBeforeOpen() : this.onBeforeClose()); +} +function qir(t) { + t.propertyName === this.openTransitionProp && t.target === this.transitionEl && (this.open ? this.onOpen() : this.onClose()); +} +function Zfe(t) { + if (P9e(t), t.transitionEl) { + const e = Wir.bind(t), i = qir.bind(t); + wce.set(t, [ + t.transitionEl, + e, + i + ]), t.transitionEl.addEventListener("transitionstart", e), t.transitionEl.addEventListener("transitionend", i); + } +} +function P9e(t) { + if (!wce.has(t)) + return; + const [e, i, r] = wce.get(t); + e.removeEventListener("transitionstart", i), e.removeEventListener("transitionend", r), wce.delete(t); +} +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const mMt = (t, e) => { + const i = t.level ? `h${t.level}` : "div"; + return delete t.level, pr(i, { ...t }, e); +}; +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const aT = { + container: "container", + arrow: "arrow", + imageContainer: "image-container", + closeButtonContainer: "close-button-container", + closeButton: "close-button", + content: "content", + hasHeader: "has-header", + header: "header", + headerContent: "header-content", + heading: "heading" +}, Yir = "auto", xrt = "aria-controls", Srt = "aria-expanded"; +class Xir { + constructor() { + this.registeredElements = /* @__PURE__ */ new Map(), this.registeredElementCount = 0, this.queryPopover = (e) => { + const { registeredElements: i } = this, r = e.find((n) => i.has(n)); + return i.get(r); + }, this.togglePopovers = (e) => { + const i = e.composedPath(), r = this.queryPopover(i); + r && !r.triggerDisabled && (r.open = !r.open), Array.from(this.registeredElements.values()).filter((n) => n !== r && n.autoClose && n.open && !i.includes(n)).forEach((n) => n.open = !1); + }, this.keyHandler = (e) => { + e.defaultPrevented || (e.key === "Escape" ? this.closeAllPopovers() : P3t(e.key) && this.togglePopovers(e)); + }, this.clickHandler = (e) => { + vQ(e) && this.togglePopovers(e); + }; + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + registerElement(e, i) { + this.registeredElementCount++, this.registeredElements.set(e, i), this.registeredElementCount === 1 && this.addListeners(); + } + unregisterElement(e) { + this.registeredElements.delete(e) && this.registeredElementCount--, this.registeredElementCount === 0 && this.removeListeners(); + } + closeAllPopovers() { + Array.from(this.registeredElements.values()).forEach((e) => e.open = !1); + } + addListeners() { + document.addEventListener("pointerdown", this.clickHandler, { capture: !0 }), document.addEventListener("keydown", this.keyHandler, { capture: !0 }); + } + removeListeners() { + document.removeEventListener("pointerdown", this.clickHandler, { capture: !0 }), document.removeEventListener("keydown", this.keyHandler, { capture: !0 }); + } +} +const Kir = '@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, 900);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.arrow,.arrow::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}.arrow::before{content:"";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}:host([data-placement^=top]) .arrow{inset-block-end:-4px}:host([data-placement^=bottom]) .arrow{inset-block-start:-4px}:host([data-placement^=right]) .arrow,:host([data-placement^=left]) .arrow{direction:ltr;text-align:start}:host([data-placement^=left]) .arrow{inset-inline-end:-4px}:host([data-placement^=right]) .arrow{inset-inline-start:-4px}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}', Crt = new Xir(), Jir = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calcitePopoverBeforeClose = ad(this, "calcitePopoverBeforeClose", 6), this.calcitePopoverClose = ad(this, "calcitePopoverClose", 6), this.calcitePopoverBeforeOpen = ad(this, "calcitePopoverBeforeOpen", 6), this.calcitePopoverOpen = ad(this, "calcitePopoverOpen", 6), this.guid = `calcite-popover-${fie()}`, this.openTransitionProp = "opacity", this.hasLoaded = !1, this.setTransitionEl = (t) => { + this.transitionEl = t, Zfe(this), this.focusTrapEl = t, zir(this); + }, this.setFilteredPlacements = () => { + const { el: t, flipPlacements: e } = this; + this.filteredFlipPlacements = e ? Oir(e, t) : null; + }, this.setUpReferenceElement = (t = !0) => { + this.removeReferences(), this.effectiveReferenceElement = this.getReferenceElement(), hMt(this, this.effectiveReferenceElement, this.el); + const { el: e, referenceElement: i, effectiveReferenceElement: r } = this; + t && i && !r && console.warn(`${e.tagName}: reference-element id "${i}" was not found.`, { + el: e + }), this.addReferences(); + }, this.getId = () => this.el.id || this.guid, this.setExpandedAttr = () => { + const { effectiveReferenceElement: t, open: e } = this; + t && "setAttribute" in t && t.setAttribute(Srt, fx(e)); + }, this.addReferences = () => { + const { effectiveReferenceElement: t } = this; + if (!t) + return; + const e = this.getId(); + "setAttribute" in t && t.setAttribute(xrt, e), Crt.registerElement(t, this.el), this.setExpandedAttr(); + }, this.removeReferences = () => { + const { effectiveReferenceElement: t } = this; + t && ("removeAttribute" in t && (t.removeAttribute(xrt), t.removeAttribute(Srt)), Crt.unregisterElement(t)); + }, this.hide = () => { + this.open = !1; + }, this.storeArrowEl = (t) => { + this.arrowEl = t, this.reposition(!0); + }, this.autoClose = !1, this.closable = !1, this.flipDisabled = !1, this.focusTrapDisabled = !1, this.pointerDisabled = !1, this.flipPlacements = void 0, this.heading = void 0, this.headingLevel = void 0, this.label = void 0, this.messageOverrides = void 0, this.messages = void 0, this.offsetDistance = dMt, this.offsetSkidding = 0, this.open = !1, this.overlayPositioning = "absolute", this.placement = Yir, this.referenceElement = void 0, this.scale = "m", this.triggerDisabled = !1, this.effectiveLocale = "", this.effectiveReferenceElement = void 0, this.defaultMessages = void 0; + } + handlefocusTrapDisabled(t) { + this.open && (t ? e2e(this) : wrt(this)); + } + flipPlacementsHandler() { + this.setFilteredPlacements(), this.reposition(!0); + } + onMessagesChange() { + } + offsetDistanceOffsetHandler() { + this.reposition(!0); + } + offsetSkiddingHandler() { + this.reposition(!0); + } + openHandler(t) { + t ? this.reposition(!0) : pMt(this.el), this.setExpandedAttr(); + } + overlayPositioningHandler() { + this.reposition(!0); + } + placementHandler() { + this.reposition(!0); + } + referenceElementHandler() { + this.setUpReferenceElement(), this.reposition(!0); + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + // -------------------------------------------------------------------------- + // + // Lifecycle + // + // -------------------------------------------------------------------------- + connectedCallback() { + this.setFilteredPlacements(), H4(this), X4(this), Zfe(this), this.setUpReferenceElement(this.hasLoaded); + } + async componentWillLoad() { + await q4(this), GI(this); + } + componentDidLoad() { + UI(this), this.referenceElement && !this.effectiveReferenceElement && this.setUpReferenceElement(), this.reposition(), this.hasLoaded = !0; + } + disconnectedCallback() { + this.removeReferences(), W4(this), K4(this), E9e(this, this.effectiveReferenceElement, this.el), P9e(this), e2e(this); + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** + * Updates the position of the component. + * + * @param delayed + */ + async reposition(t = !1) { + const { el: e, effectiveReferenceElement: i, placement: r, overlayPositioning: n, flipDisabled: s, filteredFlipPlacements: o, offsetDistance: a, offsetSkidding: l, arrowEl: c } = this; + return uMt(this, { + floatingEl: e, + referenceEl: i, + overlayPositioning: n, + placement: r, + flipDisabled: s, + flipPlacements: o, + offsetDistance: a, + offsetSkidding: l, + includeArrow: !this.pointerDisabled, + arrowEl: c, + type: "popover" + }, t); + } + /** + * Sets focus on the component's first focusable element. + */ + async setFocus() { + await zI(this), gNe(this.el), zvt(this.focusTrapEl); + } + /** + * Updates the element(s) that are used within the focus-trap of the component. + */ + async updateFocusTrapElements() { + Hir(this); + } + getReferenceElement() { + const { referenceElement: t, el: e } = this; + return (typeof t == "string" ? vNe(e, { id: t }) : t) || null; + } + onBeforeOpen() { + this.calcitePopoverBeforeOpen.emit(); + } + onOpen() { + this.calcitePopoverOpen.emit(), wrt(this); + } + onBeforeClose() { + this.calcitePopoverBeforeClose.emit(); + } + onClose() { + this.calcitePopoverClose.emit(), e2e(this); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + renderCloseButton() { + const { messages: t, closable: e } = this; + return e ? pr("div", { class: aT.closeButtonContainer, key: aT.closeButtonContainer }, pr("calcite-action", { class: aT.closeButton, onClick: this.hide, ref: (i) => this.closeButtonEl = i, scale: this.scale, text: t.close }, pr("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : this.scale }))) : null; + } + renderHeader() { + const { heading: t, headingLevel: e } = this, i = t ? pr(mMt, { class: aT.heading, level: e }, t) : null; + return i ? pr("div", { class: aT.header, key: aT.header }, i, this.renderCloseButton()) : null; + } + render() { + const { effectiveReferenceElement: t, heading: e, label: i, open: r, pointerDisabled: n } = this, s = t && r, o = !s, a = n ? null : pr("div", { class: aT.arrow, ref: this.storeArrowEl }); + return pr(y3, { "aria-hidden": fx(o), "aria-label": i, "aria-live": "polite", "calcite-hydrated-hidden": o, id: this.getId(), role: "dialog" }, pr("div", { class: { + [hte.animation]: !0, + [hte.animationActive]: s + }, ref: this.setTransitionEl }, a, pr("div", { class: { + [aT.hasHeader]: !!e, + [aT.container]: !0 + } }, this.renderHeader(), pr("div", { class: aT.content }, pr("slot", null)), e ? null : this.renderCloseButton()))); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + focusTrapDisabled: ["handlefocusTrapDisabled"], + flipPlacements: ["flipPlacementsHandler"], + messageOverrides: ["onMessagesChange"], + offsetDistance: ["offsetDistanceOffsetHandler"], + offsetSkidding: ["offsetSkiddingHandler"], + open: ["openHandler"], + overlayPositioning: ["overlayPositioningHandler"], + placement: ["placementHandler"], + referenceElement: ["referenceElementHandler"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return Kir; + } +}, [1, "calcite-popover", { + autoClose: [516, "auto-close"], + closable: [1540], + flipDisabled: [516, "flip-disabled"], + focusTrapDisabled: [516, "focus-trap-disabled"], + pointerDisabled: [516, "pointer-disabled"], + flipPlacements: [16], + heading: [1], + headingLevel: [514, "heading-level"], + label: [1], + messageOverrides: [1040], + messages: [1040], + offsetDistance: [514, "offset-distance"], + offsetSkidding: [514, "offset-skidding"], + open: [1540], + overlayPositioning: [513, "overlay-positioning"], + placement: [513], + referenceElement: [1, "reference-element"], + scale: [513], + triggerDisabled: [516, "trigger-disabled"], + effectiveLocale: [32], + effectiveReferenceElement: [32], + defaultMessages: [32], + reposition: [64], + setFocus: [64], + updateFocusTrapElements: [64] +}]); +function Rve() { + if (typeof customElements > "u") + return; + ["calcite-popover", "calcite-action", "calcite-icon", "calcite-loader"].forEach((e) => { + switch (e) { + case "calcite-popover": + customElements.get(e) || customElements.define(e, Jir); + break; + case "calcite-action": + customElements.get(e) || lH(); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + } + }); +} +Rve(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Trt = { + menu: "menu", + defaultTrigger: "default-trigger" +}, GMe = { + tooltip: "tooltip", + trigger: "trigger" +}, Zir = { + menu: "ellipsis" +}, Qir = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{box-sizing:border-box;display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}.menu ::slotted(calcite-action){margin:0.125rem;display:flex;outline-color:transparent}.menu ::slotted(calcite-action[active]){outline:2px solid var(--calcite-ui-brand);outline-offset:0px}.default-trigger{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}slot[name=trigger]::slotted(calcite-action),calcite-action::slotted([slot=trigger]){position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}.menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}", err = ["ArrowUp", "ArrowDown", "End", "Home"], trr = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteActionMenuOpen = ad(this, "calciteActionMenuOpen", 6), this.actionElements = [], this.guid = `calcite-action-menu-${fie()}`, this.menuId = `${this.guid}-menu`, this.menuButtonId = `${this.guid}-menu-button`, this.connectMenuButtonEl = () => { + const { menuButtonId: t, menuId: e, open: i, label: r } = this, n = this.slottedMenuButtonEl || this.defaultMenuButtonEl; + this.menuButtonEl !== n && (this.disconnectMenuButtonEl(), this.menuButtonEl = n, this.setTooltipReferenceElement(), n && (n.active = i, n.setAttribute("aria-controls", e), n.setAttribute("aria-expanded", fx(i)), n.setAttribute("aria-haspopup", "true"), n.id || (n.id = t), n.label || (n.label = r), n.text || (n.text = r), n.addEventListener("pointerdown", this.menuButtonClick), n.addEventListener("keydown", this.menuButtonKeyDown))); + }, this.disconnectMenuButtonEl = () => { + const { menuButtonEl: t } = this; + t && (t.removeEventListener("pointerdown", this.menuButtonClick), t.removeEventListener("keydown", this.menuButtonKeyDown)); + }, this.setMenuButtonEl = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }).filter((i) => i?.matches("calcite-action")); + this.slottedMenuButtonEl = e[0], this.connectMenuButtonEl(); + }, this.setDefaultMenuButtonEl = (t) => { + this.defaultMenuButtonEl = t, this.connectMenuButtonEl(); + }, this.handleCalciteActionClick = () => { + this.open = !1, this.setFocus(); + }, this.menuButtonClick = (t) => { + vQ(t) && this.toggleOpen(); + }, this.updateTooltip = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }).filter((i) => i?.matches("calcite-tooltip")); + this.tooltipEl = e[0], this.setTooltipReferenceElement(); + }, this.setTooltipReferenceElement = () => { + const { tooltipEl: t, expanded: e, menuButtonEl: i, open: r } = this; + t && (t.referenceElement = !e && !r ? i : null); + }, this.updateAction = (t, e) => { + const { guid: i, activeMenuItemIndex: r } = this, n = `${i}-action-${e}`; + t.tabIndex = -1, t.setAttribute("role", "menuitem"), t.id || (t.id = n), t.active = e === r; + }, this.updateActions = (t) => { + t?.forEach(this.updateAction); + }, this.handleDefaultSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }).filter((i) => i?.matches("calcite-action")); + this.actionElements = e; + }, this.menuButtonKeyDown = (t) => { + const { key: e } = t, { actionElements: i, activeMenuItemIndex: r, open: n } = this; + if (i.length) { + if (P3t(e)) { + if (t.preventDefault(), !n) { + this.toggleOpen(); + return; + } + const s = i[r]; + s ? s.click() : this.toggleOpen(!1); + } + if (e === "Tab") { + this.open = !1; + return; + } + if (e === "Escape") { + this.toggleOpen(!1), t.preventDefault(); + return; + } + this.handleActionNavigation(t, e, i); + } + }, this.handleActionNavigation = (t, e, i) => { + if (!this.isValidKey(e, err)) + return; + if (t.preventDefault(), !this.open) { + this.toggleOpen(), (e === "Home" || e === "ArrowDown") && (this.activeMenuItemIndex = 0), (e === "End" || e === "ArrowUp") && (this.activeMenuItemIndex = i.length - 1); + return; + } + e === "Home" && (this.activeMenuItemIndex = 0), e === "End" && (this.activeMenuItemIndex = i.length - 1); + const r = this.activeMenuItemIndex; + e === "ArrowUp" && (this.activeMenuItemIndex = irt(Math.max(r - 1, -1), i.length)), e === "ArrowDown" && (this.activeMenuItemIndex = irt(r + 1, i.length)); + }, this.toggleOpenEnd = () => { + this.setFocus(), this.el.removeEventListener("calcitePopoverOpen", this.toggleOpenEnd); + }, this.toggleOpen = (t = !this.open) => { + this.el.addEventListener("calcitePopoverOpen", this.toggleOpenEnd), this.open = t; + }, this.expanded = !1, this.flipPlacements = void 0, this.label = void 0, this.open = !1, this.overlayPositioning = "absolute", this.placement = "auto", this.scale = void 0, this.menuButtonEl = void 0, this.activeMenuItemIndex = -1; + } + // -------------------------------------------------------------------------- + // + // Lifecycle + // + // -------------------------------------------------------------------------- + componentWillLoad() { + GI(this); + } + componentDidLoad() { + UI(this); + } + disconnectedCallback() { + this.disconnectMenuButtonEl(); + } + expandedHandler() { + this.open = !1, this.setTooltipReferenceElement(); + } + openHandler(t) { + this.activeMenuItemIndex = this.open ? 0 : -1, this.menuButtonEl && (this.menuButtonEl.active = t), this.calciteActionMenuOpen.emit(), this.setTooltipReferenceElement(); + } + closeCalciteActionMenuOnClick(t) { + !vQ(t) || t.composedPath().includes(this.el) || (this.open = !1); + } + activeMenuItemIndexHandler() { + this.updateActions(this.actionElements); + } + // -------------------------------------------------------------------------- + // + // Methods + // + // -------------------------------------------------------------------------- + /** Sets focus on the component. */ + async setFocus() { + await zI(this), Uvt(this.menuButtonEl); + } + renderMenuButton() { + const { label: t, scale: e, expanded: i } = this; + return pr("slot", { name: GMe.trigger, onSlotchange: this.setMenuButtonEl }, pr("calcite-action", { class: Trt.defaultTrigger, icon: Zir.menu, ref: this.setDefaultMenuButtonEl, scale: e, text: t, textEnabled: i })); + } + renderMenuItems() { + const { actionElements: t, activeMenuItemIndex: e, open: i, menuId: r, menuButtonEl: n, label: s, placement: o, overlayPositioning: a, flipPlacements: l } = this, h = t[e]?.id || null; + return pr("calcite-popover", { flipPlacements: l, focusTrapDisabled: !0, label: s, offsetDistance: 0, open: i, overlayPositioning: a, placement: o, pointerDisabled: !0, referenceElement: n }, pr("div", { "aria-activedescendant": h, "aria-labelledby": n?.id, class: Trt.menu, id: r, onClick: this.handleCalciteActionClick, role: "menu", tabIndex: -1 }, pr("slot", { onSlotchange: this.handleDefaultSlotChange }))); + } + render() { + return pr(yNe, null, this.renderMenuButton(), this.renderMenuItems(), pr("slot", { name: GMe.tooltip, onSlotchange: this.updateTooltip })); + } + isValidKey(t, e) { + return !!e.find((i) => i === t); + } + get el() { + return this; + } + static get watchers() { + return { + expanded: ["expandedHandler"], + open: ["openHandler"], + activeMenuItemIndex: ["activeMenuItemIndexHandler"] + }; + } + static get style() { + return Qir; + } +}, [1, "calcite-action-menu", { + expanded: [516], + flipPlacements: [16], + label: [1], + open: [1540], + overlayPositioning: [513, "overlay-positioning"], + placement: [513], + scale: [513], + menuButtonEl: [32], + activeMenuItemIndex: [32], + setFocus: [64] +}, [[9, "pointerdown", "closeCalciteActionMenuOnClick"]]]); +function O9e() { + if (typeof customElements > "u") + return; + ["calcite-action-menu", "calcite-action", "calcite-icon", "calcite-loader", "calcite-popover"].forEach((e) => { + switch (e) { + case "calcite-action-menu": + customElements.get(e) || customElements.define(e, trr); + break; + case "calcite-action": + customElements.get(e) || lH(); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + case "calcite-popover": + customElements.get(e) || Rve(); + break; + } + }); +} +O9e(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Zy = { + backButton: "back-button", + container: "container", + header: "header", + heading: "heading", + summary: "summary", + description: "description", + headerContent: "header-content", + headerActions: "header-actions", + headerActionsEnd: "header-actions--end", + headerActionsStart: "header-actions--start", + contentWrapper: "content-wrapper", + contentContainer: "content-container", + contentHeight: "content-height", + fabContainer: "fab-container", + footer: "footer" +}, Ert = { + close: "x", + menu: "ellipsis", + backLeft: "chevron-left", + backRight: "chevron-right" +}, V_ = { + headerActionsStart: "header-actions-start", + headerActionsEnd: "header-actions-end", + headerMenuActions: "header-menu-actions", + headerContent: "header-content", + fab: "fab", + footer: "footer", + footerActions: "footer-actions" +}, irr = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;overflow:hidden;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{flex:1 1 auto;padding:0.5rem}.container{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;transition:max-block-size var(--calcite-animation-timing), inline-size var(--calcite-animation-timing)}.container[hidden]{display:none}.header{border-block-end:1px solid;position:sticky;inset-block-start:0px;z-index:400;inline-size:100%;align-items:stretch;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3);flex:0 0 auto}.header-content{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}.header-content .heading,.header-content .description{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-inline:0px;margin-block:0px 0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}.header-content .heading:only-child{margin-block-end:0px}.header-content .description{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}.header-actions{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}.header-actions--end{margin-inline-start:auto}.content-wrapper{overflow:auto}.content-height{block-size:100%}.content-container{display:flex;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;background-color:var(--calcite-ui-background)}.footer{border-block-start:1px solid;position:sticky;inset-block-end:0px;display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-block-start-color:var(--calcite-ui-border-3);flex:0 0 auto;min-block-size:3rem;padding:0.5rem}.fab-container{position:sticky;inset-block-end:0px;z-index:300;margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}[hidden]{display:none}", rrr = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calcitePanelClose = ad(this, "calcitePanelClose", 6), this.calcitePanelScroll = ad(this, "calcitePanelScroll", 6), this.resizeObserver = z4("resize", () => this.resizeHandler()), this.resizeHandler = () => { + const { panelScrollEl: t } = this; + !t || typeof t.scrollHeight != "number" || typeof t.offsetHeight != "number" || (t.tabIndex = t.scrollHeight > t.offsetHeight ? 0 : -1); + }, this.setContainerRef = (t) => { + this.containerEl = t; + }, this.setCloseRef = (t) => { + this.closeButtonEl = t; + }, this.setBackRef = (t) => { + this.backButtonEl = t; + }, this.panelKeyDownHandler = (t) => { + this.closable && t.key === "Escape" && !t.defaultPrevented && (this.close(), t.preventDefault()); + }, this.close = () => { + this.closed = !0, this.calcitePanelClose.emit(); + }, this.panelScrollHandler = () => { + this.calcitePanelScroll.emit(); + }, this.handleHeaderActionsStartSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasStartActions = !!e.length; + }, this.handleHeaderActionsEndSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasEndActions = !!e.length; + }, this.handleHeaderMenuActionsSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasMenuItems = !!e.length; + }, this.handleHeaderContentSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasHeaderContent = !!e.length; + }, this.handleFooterSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasFooterContent = !!e.length; + }, this.handleFooterActionsSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasFooterActions = !!e.length; + }, this.handleFabSlotChange = (t) => { + const e = t.target.assignedElements({ + flatten: !0 + }); + this.hasFab = !!e.length; + }, this.setPanelScrollEl = (t) => { + this.panelScrollEl = t, this.resizeObserver?.disconnect(), t && (this.resizeObserver?.observe(t), this.resizeHandler()); + }, this.closed = !1, this.disabled = !1, this.closable = !1, this.headingLevel = void 0, this.loading = !1, this.heading = void 0, this.description = void 0, this.menuOpen = !1, this.messageOverrides = void 0, this.messages = void 0, this.hasStartActions = !1, this.hasEndActions = !1, this.hasMenuItems = !1, this.hasHeaderContent = !1, this.hasFooterContent = !1, this.hasFooterActions = !1, this.hasFab = !1, this.defaultMessages = void 0, this.effectiveLocale = ""; + } + onMessagesChange() { + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + H4(this), X4(this); + } + async componentWillLoad() { + GI(this), await q4(this); + } + componentDidLoad() { + UI(this); + } + componentDidRender() { + C8(this); + } + disconnectedCallback() { + W4(this), K4(this), this.resizeObserver?.disconnect(); + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + // -------------------------------------------------------------------------- + // + // Methods + // + // -------------------------------------------------------------------------- + /** + * Sets focus on the component's first focusable element. + */ + async setFocus() { + await zI(this), zvt(this.containerEl); + } + /** + * Scrolls the component's content to a specified set of coordinates. + * + * @example + * myCalciteFlowItem.scrollContentTo({ + * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element. + * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element + * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value). + * }); + * @param options + */ + async scrollContentTo(t) { + this.panelScrollEl?.scrollTo(t); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + renderHeaderContent() { + const { heading: t, headingLevel: e, description: i, hasHeaderContent: r } = this, n = t ? pr(mMt, { class: Zy.heading, level: e }, t) : null, s = i ? pr("span", { class: Zy.description }, i) : null; + return !r && (n || s) ? pr("div", { class: Zy.headerContent, key: "header-content" }, n, s) : null; + } + /** + * Allows user to override the entire header-content node. + */ + renderHeaderSlottedContent() { + return pr("div", { class: Zy.headerContent, hidden: !this.hasHeaderContent, key: "slotted-header-content" }, pr("slot", { name: V_.headerContent, onSlotchange: this.handleHeaderContentSlotChange })); + } + renderHeaderStartActions() { + const { hasStartActions: t } = this; + return pr("div", { class: { [Zy.headerActionsStart]: !0, [Zy.headerActions]: !0 }, hidden: !t, key: "header-actions-start" }, pr("slot", { name: V_.headerActionsStart, onSlotchange: this.handleHeaderActionsStartSlotChange })); + } + renderHeaderActionsEnd() { + const { close: t, hasEndActions: e, messages: i, closable: r } = this, n = i.close, s = r ? pr("calcite-action", { "aria-label": n, icon: Ert.close, onClick: t, ref: this.setCloseRef, text: n }) : null, o = pr("slot", { name: V_.headerActionsEnd, onSlotchange: this.handleHeaderActionsEndSlotChange }), a = e || s; + return pr("div", { class: { [Zy.headerActionsEnd]: !0, [Zy.headerActions]: !0 }, hidden: !a, key: "header-actions-end" }, o, s); + } + renderMenu() { + const { hasMenuItems: t, messages: e, menuOpen: i } = this; + return pr("calcite-action-menu", { flipPlacements: ["top", "bottom"], hidden: !t, key: "menu", label: e.options, open: i, placement: "bottom-end" }, pr("calcite-action", { icon: Ert.menu, slot: GMe.trigger, text: e.options }), pr("slot", { name: V_.headerMenuActions, onSlotchange: this.handleHeaderMenuActionsSlotChange })); + } + renderHeaderNode() { + const { hasHeaderContent: t, hasStartActions: e, hasEndActions: i, closable: r, hasMenuItems: n } = this, s = this.renderHeaderContent(), o = t || s || e || i || r || n; + return pr("header", { class: Zy.header, hidden: !o }, this.renderHeaderStartActions(), this.renderHeaderSlottedContent(), s, this.renderHeaderActionsEnd(), this.renderMenu()); + } + renderFooterNode() { + const { hasFooterContent: t, hasFooterActions: e } = this, i = t || e; + return pr("footer", { class: Zy.footer, hidden: !i }, pr("slot", { key: "footer-slot", name: V_.footer, onSlotchange: this.handleFooterSlotChange }), pr("slot", { key: "footer-actions-slot", name: V_.footerActions, onSlotchange: this.handleFooterActionsSlotChange })); + } + renderContent() { + const { hasFab: t } = this, e = pr("slot", { key: "default-slot" }), i = t ? pr("section", { class: Zy.contentContainer }, e) : e; + return pr("div", { class: { + [Zy.contentWrapper]: !0, + [Zy.contentContainer]: !t, + [Zy.contentHeight]: t + }, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, i, this.renderFab()); + } + renderFab() { + return pr("div", { class: Zy.fabContainer, hidden: !this.hasFab }, pr("slot", { name: V_.fab, onSlotchange: this.handleFabSlotChange })); + } + render() { + const { loading: t, panelKeyDownHandler: e, closed: i, closable: r } = this, n = pr("article", { "aria-busy": fx(t), class: Zy.container, hidden: i, onKeyDown: e, ref: this.setContainerRef, tabIndex: r ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()); + return pr(yNe, null, t ? pr("calcite-scrim", { loading: t }) : null, n); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + messageOverrides: ["onMessagesChange"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return irr; + } +}, [1, "calcite-panel", { + closed: [1540], + disabled: [516], + closable: [1540], + headingLevel: [514, "heading-level"], + loading: [516], + heading: [1], + description: [1], + menuOpen: [516, "menu-open"], + messageOverrides: [1040], + messages: [1040], + hasStartActions: [32], + hasEndActions: [32], + hasMenuItems: [32], + hasHeaderContent: [32], + hasFooterContent: [32], + hasFooterActions: [32], + hasFab: [32], + defaultMessages: [32], + effectiveLocale: [32], + setFocus: [64], + scrollContentTo: [64] +}]); +function gMt() { + if (typeof customElements > "u") + return; + ["calcite-panel", "calcite-action", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-popover", "calcite-scrim"].forEach((e) => { + switch (e) { + case "calcite-panel": + customElements.get(e) || customElements.define(e, rrr); + break; + case "calcite-action": + customElements.get(e) || lH(); + break; + case "calcite-action-menu": + customElements.get(e) || O9e(); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + case "calcite-popover": + customElements.get(e) || Rve(); + break; + case "calcite-scrim": + customElements.get(e) || Qie(); + break; + } + }); +} +gMt(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Irt = { + container: "container", + arrow: "arrow" +}, nrr = 500, Art = "aria-describedby"; +function yMt(t) { + const { referenceElement: e } = t; + return (typeof e == "string" ? vNe(t, { id: e }) : e) || null; +} +class srr { + constructor() { + this.registeredElements = /* @__PURE__ */ new WeakMap(), this.hoverTimeout = null, this.registeredElementCount = 0, this.queryTooltip = (e) => { + const { registeredElements: i } = this, r = e.find((n) => i.has(n)); + return i.get(r); + }, this.keyDownHandler = (e) => { + if (e.key === "Escape" && !e.defaultPrevented) { + const { activeTooltipEl: i } = this; + if (i && i.open) { + this.clearHoverTimeout(), this.toggleTooltip(i, !1); + const r = yMt(i); + r instanceof Element && r.contains(e.target) && e.preventDefault(); + } + } + }, this.queryHoveredTooltip = (e) => { + const { activeTooltipEl: i } = this; + if (i && e.includes(i)) { + this.clearHoverTimeout(); + return; + } + const r = this.queryTooltip(e); + r ? this.toggleHoveredTooltip(r, !0) : i && this.toggleHoveredTooltip(i, !1); + }, this.pointerMoveHandler = (e) => { + const i = e.composedPath(); + this.clearHoverTimeout(), this.hoverTimeout = window.setTimeout(() => this.queryHoveredTooltip(i), nrr); + }, this.pointerDownHandler = (e) => { + if (!vQ(e)) + return; + const i = this.queryTooltip(e.composedPath()); + this.clickedTooltip = i, i?.closeOnClick && (this.toggleTooltip(i, !1), this.clearHoverTimeout()); + }, this.focusInHandler = (e) => { + this.queryFocusedTooltip(e, !0); + }, this.focusOutHandler = (e) => { + this.queryFocusedTooltip(e, !1); + }, this.toggleHoveredTooltip = (e, i) => { + i && this.closeExistingTooltip(), this.toggleTooltip(e, i); + }; + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + registerElement(e, i) { + this.registeredElementCount++, this.registeredElements.set(e, i), this.registeredElementCount === 1 && this.addListeners(); + } + unregisterElement(e) { + this.registeredElements.delete(e) && this.registeredElementCount--, this.registeredElementCount === 0 && this.removeListeners(); + } + addListeners() { + document.addEventListener("keydown", this.keyDownHandler, { capture: !0 }), document.addEventListener("pointermove", this.pointerMoveHandler, { capture: !0 }), document.addEventListener("pointerdown", this.pointerDownHandler, { capture: !0 }), document.addEventListener("focusin", this.focusInHandler, { capture: !0 }), document.addEventListener("focusout", this.focusOutHandler, { capture: !0 }); + } + removeListeners() { + document.removeEventListener("keydown", this.keyDownHandler, { capture: !0 }), document.removeEventListener("pointermove", this.pointerMoveHandler, { capture: !0 }), document.removeEventListener("pointerdown", this.pointerDownHandler, { capture: !0 }), document.removeEventListener("focusin", this.focusInHandler, { capture: !0 }), document.removeEventListener("focusout", this.focusOutHandler, { capture: !0 }); + } + clearHoverTimeout() { + window.clearTimeout(this.hoverTimeout); + } + closeExistingTooltip() { + const { activeTooltipEl: e } = this; + e && this.toggleTooltip(e, !1); + } + toggleFocusedTooltip(e, i) { + this.closeExistingTooltip(), i && this.clearHoverTimeout(), this.toggleTooltip(e, i); + } + toggleTooltip(e, i) { + e.open = i, i && (this.activeTooltipEl = e); + } + queryFocusedTooltip(e, i) { + const r = this.queryTooltip(e.composedPath()); + if (!r || r === this.clickedTooltip) { + this.clickedTooltip = null; + return; + } + this.toggleFocusedTooltip(r, i); + } +} +const orr = '@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host{--calcite-floating-ui-z-index:var(--calcite-tooltip-z-index, 901);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.arrow,.arrow::before{position:absolute;inline-size:8px;block-size:8px;z-index:-1}.arrow::before{content:"";--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}:host([data-placement^=top]) .arrow{inset-block-end:-4px}:host([data-placement^=bottom]) .arrow{inset-block-start:-4px}:host([data-placement^=right]) .arrow,:host([data-placement^=left]) .arrow{direction:ltr;text-align:start}:host([data-placement^=left]) .arrow{inset-inline-end:-4px}:host([data-placement^=right]) .arrow{inset-inline-start:-4px}.container{position:relative;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}', Prt = new srr(), vMt = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteTooltipBeforeClose = ad(this, "calciteTooltipBeforeClose", 6), this.calciteTooltipClose = ad(this, "calciteTooltipClose", 6), this.calciteTooltipBeforeOpen = ad(this, "calciteTooltipBeforeOpen", 6), this.calciteTooltipOpen = ad(this, "calciteTooltipOpen", 6), this.guid = `calcite-tooltip-${fie()}`, this.hasLoaded = !1, this.openTransitionProp = "opacity", this.setTransitionEl = (t) => { + this.transitionEl = t, Zfe(this); + }, this.setUpReferenceElement = (t = !0) => { + this.removeReferences(), this.effectiveReferenceElement = yMt(this.el), hMt(this, this.effectiveReferenceElement, this.el); + const { el: e, referenceElement: i, effectiveReferenceElement: r } = this; + t && i && !r && console.warn(`${e.tagName}: reference-element id "${i}" was not found.`, { + el: e + }), this.addReferences(); + }, this.getId = () => this.el.id || this.guid, this.addReferences = () => { + const { effectiveReferenceElement: t } = this; + if (!t) + return; + const e = this.getId(); + "setAttribute" in t && t.setAttribute(Art, e), Prt.registerElement(t, this.el); + }, this.removeReferences = () => { + const { effectiveReferenceElement: t } = this; + t && ("removeAttribute" in t && t.removeAttribute(Art), Prt.unregisterElement(t)); + }, this.closeOnClick = !1, this.label = void 0, this.offsetDistance = dMt, this.offsetSkidding = 0, this.open = !1, this.overlayPositioning = "absolute", this.placement = "auto", this.referenceElement = void 0, this.effectiveReferenceElement = void 0; + } + offsetDistanceOffsetHandler() { + this.reposition(!0); + } + offsetSkiddingHandler() { + this.reposition(!0); + } + openHandler(t) { + t ? this.reposition(!0) : pMt(this.el); + } + overlayPositioningHandler() { + this.reposition(!0); + } + placementHandler() { + this.reposition(!0); + } + referenceElementHandler() { + this.setUpReferenceElement(); + } + // -------------------------------------------------------------------------- + // + // Lifecycle + // + // -------------------------------------------------------------------------- + connectedCallback() { + Zfe(this), this.setUpReferenceElement(this.hasLoaded); + } + componentDidLoad() { + this.referenceElement && !this.effectiveReferenceElement && this.setUpReferenceElement(), this.reposition(!0), this.hasLoaded = !0; + } + disconnectedCallback() { + this.removeReferences(), E9e(this, this.effectiveReferenceElement, this.el), P9e(this); + } + // -------------------------------------------------------------------------- + // + // Public Methods + // + // -------------------------------------------------------------------------- + /** + * Updates the position of the component. + * + * @param delayed + */ + async reposition(t = !1) { + const { el: e, effectiveReferenceElement: i, placement: r, overlayPositioning: n, offsetDistance: s, offsetSkidding: o, arrowEl: a } = this; + return uMt(this, { + floatingEl: e, + referenceEl: i, + overlayPositioning: n, + placement: r, + offsetDistance: s, + offsetSkidding: o, + includeArrow: !0, + arrowEl: a, + type: "tooltip" + }, t); + } + // -------------------------------------------------------------------------- + // + // Private Methods + // + // -------------------------------------------------------------------------- + onBeforeOpen() { + this.calciteTooltipBeforeOpen.emit(); + } + onOpen() { + this.calciteTooltipOpen.emit(); + } + onBeforeClose() { + this.calciteTooltipBeforeClose.emit(); + } + onClose() { + this.calciteTooltipClose.emit(); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + render() { + const { effectiveReferenceElement: t, label: e, open: i } = this, r = t && i, n = !r; + return pr(y3, { "aria-hidden": fx(n), "aria-label": e, "aria-live": "polite", "calcite-hydrated-hidden": n, id: this.getId(), role: "tooltip" }, pr("div", { class: { + [hte.animation]: !0, + [hte.animationActive]: r + }, ref: this.setTransitionEl }, pr("div", { class: Irt.arrow, ref: (s) => this.arrowEl = s }), pr("div", { class: Irt.container }, pr("slot", null)))); + } + get el() { + return this; + } + static get watchers() { + return { + offsetDistance: ["offsetDistanceOffsetHandler"], + offsetSkidding: ["offsetSkiddingHandler"], + open: ["openHandler"], + overlayPositioning: ["overlayPositioningHandler"], + placement: ["placementHandler"], + referenceElement: ["referenceElementHandler"] + }; + } + static get style() { + return orr; + } +}, [1, "calcite-tooltip", { + closeOnClick: [516, "close-on-click"], + label: [1], + offsetDistance: [514, "offset-distance"], + offsetSkidding: [514, "offset-skidding"], + open: [516], + overlayPositioning: [513, "overlay-positioning"], + placement: [513], + referenceElement: [1, "reference-element"], + effectiveReferenceElement: [32], + reposition: [64] +}]); +function R9e() { + if (typeof customElements > "u") + return; + ["calcite-tooltip"].forEach((e) => { + switch (e) { + case "calcite-tooltip": + customElements.get(e) || customElements.define(e, vMt); + break; + } + }); +} +R9e(); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const arr = { + backButton: "back-button" +}, Ort = { + backLeft: "chevron-left", + backRight: "chevron-right" +}, y5 = { + headerActionsStart: "header-actions-start", + headerActionsEnd: "header-actions-end", + headerMenuActions: "header-menu-actions", + headerContent: "header-content", + fab: "fab", + footer: "footer", + footerActions: "footer-actions" +}, lrr = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing);--calcite-floating-ui-z-index:600}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;overflow:hidden}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}", _Mt = /* @__PURE__ */ U0(class extends z0 { + constructor() { + super(), this.__registerHost(), this.__attachShadow(), this.calciteFlowItemBack = ad(this, "calciteFlowItemBack", 6), this.calciteFlowItemScroll = ad(this, "calciteFlowItemScroll", 6), this.calciteFlowItemClose = ad(this, "calciteFlowItemClose", 6), this.handlePanelScroll = (t) => { + t.stopPropagation(), this.calciteFlowItemScroll.emit(); + }, this.handlePanelClose = (t) => { + t.stopPropagation(), this.calciteFlowItemClose.emit(); + }, this.backButtonClick = () => { + this.calciteFlowItemBack.emit(); + }, this.setBackRef = (t) => { + this.backButtonEl = t; + }, this.setContainerRef = (t) => { + this.containerEl = t; + }, this.closable = !1, this.closed = !1, this.beforeBack = void 0, this.description = void 0, this.disabled = !1, this.heading = void 0, this.headingLevel = void 0, this.loading = !1, this.menuOpen = !1, this.messageOverrides = void 0, this.messages = void 0, this.showBackButton = !1, this.backButtonEl = void 0, this.defaultMessages = void 0, this.effectiveLocale = ""; + } + onMessagesChange() { + } + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + connectedCallback() { + H4(this), X4(this); + } + async componentWillLoad() { + await q4(this), GI(this); + } + componentDidRender() { + C8(this); + } + disconnectedCallback() { + W4(this), K4(this); + } + componentDidLoad() { + UI(this); + } + effectiveLocaleChange() { + Y4(this, this.effectiveLocale); + } + // -------------------------------------------------------------------------- + // + // Methods + // + // -------------------------------------------------------------------------- + /** + * Sets focus on the component. + */ + async setFocus() { + await zI(this); + const { backButtonEl: t, containerEl: e } = this; + if (t) { + t.setFocus(); + return; + } + e?.setFocus(); + } + /** + * Scrolls the component's content to a specified set of coordinates. + * + * @example + * myCalciteFlowItem.scrollContentTo({ + * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element. + * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element + * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value). + * }); + * @param options + */ + async scrollContentTo(t) { + await this.containerEl?.scrollContentTo(t); + } + // -------------------------------------------------------------------------- + // + // Render Methods + // + // -------------------------------------------------------------------------- + renderBackButton() { + const { el: t } = this, e = mie(t) === "rtl", { showBackButton: i, backButtonClick: r, messages: n } = this, s = n.back, o = e ? Ort.backRight : Ort.backLeft; + return i ? pr("calcite-action", { "aria-label": s, class: arr.backButton, icon: o, key: "flow-back-button", onClick: r, ref: this.setBackRef, scale: "s", slot: "header-actions-start", text: s }) : null; + } + render() { + const { closable: t, closed: e, description: i, disabled: r, heading: n, headingLevel: s, loading: o, menuOpen: a, messages: l, backButtonEl: c } = this, h = l.back; + return pr(y3, null, pr("calcite-panel", { closable: t, closed: e, description: i, disabled: r, heading: n, headingLevel: s, loading: o, menuOpen: a, messageOverrides: l, onCalcitePanelClose: this.handlePanelClose, onCalcitePanelScroll: this.handlePanelScroll, ref: this.setContainerRef }, this.renderBackButton(), pr("slot", { name: y5.headerActionsStart, slot: V_.headerActionsStart }), pr("slot", { name: y5.headerActionsEnd, slot: V_.headerActionsEnd }), pr("slot", { name: y5.headerContent, slot: V_.headerContent }), pr("slot", { name: y5.headerMenuActions, slot: V_.headerMenuActions }), pr("slot", { name: y5.fab, slot: V_.fab }), pr("slot", { name: y5.footerActions, slot: V_.footerActions }), pr("slot", { name: y5.footer, slot: V_.footer }), pr("slot", null)), c ? pr("calcite-tooltip", { label: h, overlayPositioning: "fixed", placement: "top", referenceElement: c }, h) : null); + } + static get assetsDirs() { + return ["assets"]; + } + get el() { + return this; + } + static get watchers() { + return { + messageOverrides: ["onMessagesChange"], + effectiveLocale: ["effectiveLocaleChange"] + }; + } + static get style() { + return lrr; + } +}, [1, "calcite-flow-item", { + closable: [1540], + closed: [1540], + beforeBack: [16], + description: [1], + disabled: [516], + heading: [1], + headingLevel: [514, "heading-level"], + loading: [516], + menuOpen: [516, "menu-open"], + messageOverrides: [1040], + messages: [1040], + showBackButton: [4, "show-back-button"], + backButtonEl: [32], + defaultMessages: [32], + effectiveLocale: [32], + setFocus: [64], + scrollContentTo: [64] +}]); +function bMt() { + if (typeof customElements > "u") + return; + ["calcite-flow-item", "calcite-action", "calcite-action-menu", "calcite-icon", "calcite-loader", "calcite-panel", "calcite-popover", "calcite-scrim", "calcite-tooltip"].forEach((e) => { + switch (e) { + case "calcite-flow-item": + customElements.get(e) || customElements.define(e, _Mt); + break; + case "calcite-action": + customElements.get(e) || lH(); + break; + case "calcite-action-menu": + customElements.get(e) || O9e(); + break; + case "calcite-icon": + customElements.get(e) || qx(); + break; + case "calcite-loader": + customElements.get(e) || J4(); + break; + case "calcite-panel": + customElements.get(e) || gMt(); + break; + case "calcite-popover": + customElements.get(e) || Rve(); + break; + case "calcite-scrim": + customElements.get(e) || Qie(); + break; + case "calcite-tooltip": + customElements.get(e) || R9e(); + break; + } + }); +} +bMt(); +const urr = _Mt, crr = bMt, hrr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteFlowItem: urr, + defineCustomElement: crr +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const drr = JRt, prr = lH, frr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteAction: drr, + defineCustomElement: prr +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const mrr = vMt, grr = R9e, yrr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteTooltip: mrr, + defineCustomElement: grr +}, Symbol.toStringTag, { value: "Module" })); +let YN = class extends $i { + constructor(e) { + super(e), this.geometries = [], this.outSpatialReference = null, this.transformation = null, this.transformForward = null; + } + toJSON() { + const e = this.geometries.map((n) => n.toJSON()), i = this.geometries[0], r = {}; + return r.outSR = this.outSpatialReference.wkid || JSON.stringify(this.outSpatialReference.toJSON()), r.inSR = i.spatialReference.wkid || JSON.stringify(i.spatialReference.toJSON()), r.geometries = JSON.stringify({ geometryType: Fd(i), geometries: e }), this.transformation && (r.transformation = this.transformation.wkid || JSON.stringify(this.transformation)), this.transformForward != null && (r.transformForward = this.transformForward), r; + } +}; +E([N()], YN.prototype, "geometries", void 0), E([N({ json: { read: { source: "outSR" } } })], YN.prototype, "outSpatialReference", void 0), E([N()], YN.prototype, "transformation", void 0), E([N()], YN.prototype, "transformForward", void 0), YN = E([dt("esri.rest.support.ProjectParameters")], YN); +const wMt = YN, vrr = Nd(wMt); +async function _rr(t, e, i) { + e = vrr(e); + const r = mh(t), n = { ...r.query, f: "json", ...e.toJSON() }, s = e.outSpatialReference, o = Fd(e.geometries[0]), a = m1(n, i); + return ir(r.path + "/project", a).then(({ data: { geometries: l } }) => Ggt(l, o, s)); +} +async function xMt(t = null, e) { + if (ua.geometryServiceUrl) + return ua.geometryServiceUrl; + if (!t) + throw new ot("internal:geometry-service-url-not-configured"); + let i; + i = "portal" in t ? t.portal || Ic.getDefault() : t, await i.load({ signal: e }); + const r = i.helperServices?.geometry?.url; + if (!r) + throw new ot("internal:geometry-service-url-not-configured"); + return r; +} +async function brr(t, e, i = null, r) { + const n = await xMt(i, r), s = new wMt(); + s.geometries = [t], s.outSpatialReference = e; + const o = await _rr(n, s, { signal: r }); + if (o && Array.isArray(o) && o.length === 1) + return o[0]; + throw new ot("internal:geometry-service-projection-failed"); +} +const wrr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + getGeometryServiceURL: xMt, + projectGeometry: brr +}, Symbol.toStringTag, { value: "Module" })), xrr = Ei.getLogger("esri.views.webgl.checkWebGLError"); +function Srr(t, e) { + switch (e) { + case t.INVALID_ENUM: + return "Invalid Enum. An unacceptable value has been specified for an enumerated argument."; + case t.INVALID_VALUE: + return "Invalid Value. A numeric argument is out of range."; + case t.INVALID_OPERATION: + return "Invalid Operation. The specified command is not allowed for the current state."; + case t.INVALID_FRAMEBUFFER_OPERATION: + return "Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it."; + case t.OUT_OF_MEMORY: + return "Out of memory. Not enough memory is left to execute the command."; + case t.CONTEXT_LOST_WEBGL: + return "WebGL context has been lost"; + default: + return "Unknown error"; + } +} +const SMt = !!Vi("enable-feature:webgl-debug"); +function db() { + return SMt; +} +function UMe() { + return SMt; +} +function MD(t) { + if (db()) { + const e = t.getError(); + if (e) { + const i = Srr(t, e), r = new Error().stack; + xrr.error(new ot("webgl-error", "WebGL error occured", { message: i, stack: r })); + } + } +} +const lT = Ei.getLogger("esri.views.webgl.BufferObject"); +let Qo = class tj { + static createIndex(e, i, r) { + return new tj(e, ao.ELEMENT_ARRAY_BUFFER, i, r); + } + static createVertex(e, i, r) { + return new tj(e, ao.ARRAY_BUFFER, i, r); + } + static createUniform(e, i, r) { + if (e.type !== go.WEBGL2) + throw new Error("Uniform buffers are supported in WebGL2 only!"); + return new tj(e, ao.UNIFORM_BUFFER, i, r); + } + static createPixelPack(e, i = Vo.STREAM_READ, r) { + if (e.type !== go.WEBGL2) + throw new Error("Pixel pack buffers are supported in WebGL2 only!"); + const n = new tj(e, ao.PIXEL_PACK_BUFFER, i); + return r && n.setSize(r), n; + } + static createPixelUnpack(e, i = Vo.STREAM_DRAW, r) { + if (e.type !== go.WEBGL2) + throw new Error("Pixel unpack buffers are supported in WebGL2 only!"); + return new tj(e, ao.PIXEL_UNPACK_BUFFER, i, r); + } + constructor(e, i, r, n) { + this._context = e, this.bufferType = i, this.usage = r, this._glName = null, this._size = -1, this._indexType = void 0, e.instanceCounter.increment(Df.BufferObject, this), this._glName = this._context.gl.createBuffer(), MD(this._context.gl), n && this.setData(n); + } + get glName() { + return this._glName; + } + get size() { + return this._size; + } + get indexType() { + return this._indexType; + } + get byteSize() { + return this.bufferType === ao.ELEMENT_ARRAY_BUFFER ? this._indexType === Fi.UNSIGNED_INT ? 4 * this._size : 2 * this._size : this._size; + } + get _isVAOAware() { + return this.bufferType === ao.ELEMENT_ARRAY_BUFFER || this.bufferType === ao.ARRAY_BUFFER; + } + dispose() { + this._context?.gl ? (this._glName && (this._context.gl.deleteBuffer(this._glName), this._glName = null), this._context.instanceCounter.decrement(Df.BufferObject, this), this._context = Tte(this._context)) : this._glName && lT.warn("Leaked WebGL buffer object"); + } + setSize(e, i = null) { + if (e <= 0 && lT.error("Buffer size needs to be positive!"), this.bufferType === ao.ELEMENT_ARRAY_BUFFER && _e(i)) + switch (this._indexType = i, i) { + case Fi.UNSIGNED_SHORT: + e *= 2; + break; + case Fi.UNSIGNED_INT: + e *= 4; + } + this._setBufferData(e); + } + setData(e) { + if (!e) + return; + let i = e.byteLength; + this.bufferType === ao.ELEMENT_ARRAY_BUFFER && (c4e(e) && (i /= 2, this._indexType = Fi.UNSIGNED_SHORT), nut(e) && (i /= 4, this._indexType = Fi.UNSIGNED_INT)), this._setBufferData(i, e); + } + _setBufferData(e, i = null) { + this._size = e; + const r = this._context.getBoundVAO(); + this._isVAOAware && this._context.bindVAO(null), this._context.bindBuffer(this); + const n = this._context.gl; + _e(i) ? n.bufferData(this.bufferType, i, this.usage) : n.bufferData(this.bufferType, e, this.usage), MD(n), this._isVAOAware && this._context.bindVAO(r); + } + setSubData(e, i, r, n) { + if (!e) + return; + (i < 0 || i * e.BYTES_PER_ELEMENT >= this.byteSize) && lT.error("offset is out of range!"), r >= n && lT.error("end must be bigger than start!"), (i + (n - r)) * e.BYTES_PER_ELEMENT > this.byteSize && lT.error("An attempt to write beyond the end of the buffer!"); + const s = this._context.getBoundVAO(); + this._isVAOAware && this._context.bindVAO(null), this._context.bindBuffer(this); + const o = this._context.gl; + if (this._context.type === go.WEBGL2) + o.bufferSubData(this.bufferType, i * e.BYTES_PER_ELEMENT, e, r, n - r); + else { + const a = r === 0 && n === e.length ? e : e.subarray(r, n); + o.bufferSubData(this.bufferType, i * e.BYTES_PER_ELEMENT, a); + } + MD(o), this._isVAOAware && this._context.bindVAO(s); + } + getSubData(e, i = 0, r, n) { + if (this._context.type !== go.WEBGL2) + return void lT.error("Get buffer subdata is supported in WebGL2 only!"); + if (r < 0 || n < 0) + return void lT.error("Problem getting subdata: offset and length were less than zero!"); + const s = Crr(e) ? e.BYTES_PER_ELEMENT : 1; + if (s * ((r ?? 0) + (n ?? 0)) > e.byteLength) + return void lT.error("Problem getting subdata: offset and length exceeded destination size!"); + i + s * (n ?? 0) > this.byteSize && lT.warn("Potential problem getting subdata: requested data exceeds buffer size!"); + const o = this._context.gl; + this._context.bindBuffer(this, ao.COPY_READ_BUFFER), o.getBufferSubData(ao.COPY_READ_BUFFER, i, e, r, n), this._context.unbindBuffer(ao.COPY_READ_BUFFER); + } + async getSubDataAsync(e, i = 0, r, n) { + this._context.type === go.WEBGL2 ? (await this._context.clientWaitAsync(), this.getSubData(e, i, r, n)) : lT.error("Get buffer subdata is supported in WebGL2 only!"); + } +}; +function Crr(t) { + return Zlt(t); +} +let nO = class { + constructor(e, i) { + this._context = e, this._desc = i, this.type = "renderbuffer", this._context.instanceCounter.increment(Df.Renderbuffer, this); + const r = this._context.gl; + this.glName = r.createRenderbuffer(), this._context.bindRenderbuffer(this); + const { width: n, height: s, internalFormat: o, multisampled: a } = i; + if (a) { + if (this._context.type !== go.WEBGL2) + throw new Error("Multisampled renderbuffers are not supported in WebGL1!"); + r.renderbufferStorageMultisample(r.RENDERBUFFER, this.samples, o, n, s); + } else + r.renderbufferStorage(r.RENDERBUFFER, o, n, s); + } + get descriptor() { + return this._desc; + } + get samples() { + const e = this._desc.samples, i = this._context.parameters.maxSamples; + return e ? Math.min(e, i) : i; + } + resize(e, i) { + const r = this._desc; + if (r.width === e && r.height === i) + return; + r.width = e, r.height = i; + const n = this._context.gl; + this._context.bindRenderbuffer(this), r.multisampled ? n.renderbufferStorageMultisample(n.RENDERBUFFER, this.samples, r.internalFormat, r.width, r.height) : n.renderbufferStorage(n.RENDERBUFFER, r.internalFormat, r.width, r.height); + } + dispose() { + this._context && (this._context.gl.deleteRenderbuffer(this.glName), this._context.instanceCounter.decrement(Df.Renderbuffer, this), this._context = Tte(this._context)); + } +}; +const t2e = { target: io.TEXTURE_2D, samplingMode: _n.LINEAR, wrapMode: ds.REPEAT, flipped: !1, hasMipmap: !1, isOpaque: !1, unpackAlignment: 4, preMultiplyAlpha: !1, isImmutable: !1 }, Rrt = 4; +let Ts = class { + constructor(e, i, r = null) { + this._context = e, this.type = "texture", this._glName = null, this._samplingModeDirty = !1, this._wrapModeDirty = !1, this._wasImmutablyAllocated = !1, e.instanceCounter.increment(Df.Texture, this), this._descriptor = { ...t2e, ...i }; + for (const n in t2e) + this._descriptor[n] === void 0 && (this._descriptor[n] = t2e[n]); + if (e.type !== go.WEBGL2 && (this._descriptor.isImmutable && (this._descriptor.isImmutable = !1), v5(this._descriptor.target))) + throw new Error("3D and array textures are not supported in WebGL1"); + this._descriptor.target === io.TEXTURE_CUBE_MAP ? this._setDataCubeMap(r) : this.setData(r); + } + get glName() { + return this._glName; + } + get descriptor() { + return this._descriptor; + } + get isDirty() { + return this._samplingModeDirty || this._wrapModeDirty; + } + dispose() { + this._context.gl && this._glName && (this._context.unbindTexture(this), this._context.gl.deleteTexture(this._glName), this._glName = null, this._context.instanceCounter.decrement(Df.Texture, this)); + } + release() { + this.dispose(); + } + resize(e, i) { + const r = this._descriptor; + if (r.width !== e || r.height !== i) { + if (this._wasImmutablyAllocated) + throw new Error("Immutable textures can't be resized!"); + r.width = e, r.height = i, this._descriptor.target === io.TEXTURE_CUBE_MAP ? this._setDataCubeMap(null) : this.setData(null); + } + } + _setDataCubeMap(e = null) { + for (let i = io.TEXTURE_CUBE_MAP_POSITIVE_X; i <= io.TEXTURE_CUBE_MAP_NEGATIVE_Z; i++) + this._setData(e, i); + } + setData(e) { + this._setData(e); + } + _setData(e, i) { + if (!this._context || !this._context.gl) + return; + const r = this._context.gl; + this._glName || (this._glName = r.createTexture()), e === void 0 && (e = null); + const n = this._descriptor, s = i ?? n.target, o = v5(s); + e === null && (n.width = n.width || Rrt, n.height = n.height || Rrt, o && (n.depth = n.depth ?? 1)); + const a = this._context.bindTexture(this, Ts.TEXTURE_UNIT_FOR_UPDATES); + this._context.setActiveTexture(Ts.TEXTURE_UNIT_FOR_UPDATES), Ts._validateTexture(this._context, n), this._configurePixelStorage(), MD(r); + const l = n.pixelFormat; + let c = n.internalFormat ?? this._deriveInternalFormat(l, n.dataType); + if (i2e(e)) { + let h = e.width, p = e.height; + const y = 1; + e instanceof HTMLVideoElement && (h = e.videoWidth, p = e.videoHeight), n.width && n.height, o && n.depth, n.isImmutable && !this._wasImmutablyAllocated && this._texStorage(s, c, n.hasMipmap, h, p, y), this._texImage(s, 0, c, h, p, y, e), MD(r), n.hasMipmap && this.generateMipmap(), n.width === void 0 && (n.width = h), n.height === void 0 && (n.height = p), o && n.depth === void 0 && (n.depth = y); + } else { + const { width: h, height: p, depth: y } = n; + if (h == null || p == null) + throw new Error("Width and height must be specified!"); + if (o && y == null) + throw new Error("Depth must be specified!"); + if (n.isImmutable && !this._wasImmutablyAllocated && this._texStorage(s, c, n.hasMipmap, h, p, y), r.DEPTH24_STENCIL8 && c === r.DEPTH_STENCIL && (c = r.DEPTH24_STENCIL8), xce(e)) { + const v = e.levels, x = Mrt(s, h, p, y), I = Math.min(x - 1, v.length - 1); + _e(this._context.gl2) ? r.texParameteri(n.target, this._context.gl2.TEXTURE_MAX_LEVEL, I) : n.hasMipmap = n.hasMipmap && x === v.length; + const P = c; + if (!Err(P)) + throw new Error("Attempting to use compressed data with an umcompressed format!"); + this._forEachMipmapLevel((F, k, V, j) => { + const Y = v[Math.min(F, v.length - 1)]; + this._compressedTexImage(s, F, P, k, V, j, Y); + }, I); + } else + _e(e) ? (this._texImage(s, 0, c, h, p, y, e), MD(r), n.hasMipmap && this.generateMipmap()) : this._forEachMipmapLevel((v, x, I, P) => { + this._texImage(s, v, c, x, I, P, null), MD(r); + }); + } + Ts._applySamplingMode(r, this._descriptor), Ts._applyWrapMode(r, this._descriptor), Ts._applyAnisotropicFilteringParameters(this._context, this._descriptor), MD(r), this._context.bindTexture(a, Ts.TEXTURE_UNIT_FOR_UPDATES); + } + updateData(e, i, r, n, s, o, a = 0) { + o || console.error("An attempt to use uninitialized data!"), this._glName || console.error("An attempt to update uninitialized texture!"); + const l = this._context.gl, c = this._descriptor, { pixelFormat: h, dataType: p, target: y, isImmutable: v } = c, x = c.internalFormat ?? this._deriveInternalFormat(h, p); + if (v && !this._wasImmutablyAllocated) + throw new Error("Cannot update immutable texture before allocation!"); + const I = this._context.bindTexture(this, Ts.TEXTURE_UNIT_FOR_UPDATES, !0); + if ((i < 0 || r < 0 || n > c.width || s > c.height || i + n > c.width || r + s > c.height) && console.error("An attempt to update out of bounds of the texture!"), this._configurePixelStorage(), a) { + if (ut(this._context.gl2)) + return void console.error("Webgl2 must be enabled to use dataRowOffset!"); + l.pixelStorei(this._context.gl2.UNPACK_SKIP_ROWS, a); + } + if (i2e(o) ? _e(this._context.gl2) ? this._context.gl2.texSubImage2D(y, e, i, r, n, s, h, p, o) : l.texSubImage2D(y, e, i, r, h, p, o) : xce(o) ? l.compressedTexSubImage2D(y, e, i, r, n, s, x, o.levels[e]) : l.texSubImage2D(y, e, i, r, n, s, h, p, o), a) { + if (ut(this._context.gl2)) + return void console.error("Webgl2 must be enabled to use dataRowOffset!"); + l.pixelStorei(this._context.gl2.UNPACK_SKIP_ROWS, 0); + } + this._context.bindTexture(I, Ts.TEXTURE_UNIT_FOR_UPDATES); + } + updateData3D(e, i, r, n, s, o, a, l) { + l || console.error("An attempt to use uninitialized data!"), this._glName || console.error("An attempt to update uninitialized texture!"); + const c = this._context.gl2; + if (ut(c)) + throw new Error("3D textures are not supported in WebGL1"); + const h = this._descriptor, { pixelFormat: p, dataType: y, isImmutable: v, target: x } = h, I = h.internalFormat ?? this._deriveInternalFormat(p, y); + if (v && !this._wasImmutablyAllocated) + throw new Error("Cannot update immutable texture before allocation!"); + v5(x) || console.warn("Attempting to set 3D texture data on a non-3D texture"); + const P = this._context.bindTexture(this, Ts.TEXTURE_UNIT_FOR_UPDATES); + if (this._context.setActiveTexture(Ts.TEXTURE_UNIT_FOR_UPDATES), (i < 0 || r < 0 || n < 0 || s > h.width || o > h.height || a > h.depth || i + s > h.width || r + o > h.height || n + a > h.depth) && console.error("An attempt to update out of bounds of the texture!"), this._configurePixelStorage(), xce(l)) + l = l.levels[e], c.compressedTexSubImage3D(x, e, i, r, n, s, o, a, I, l); + else { + const F = l; + c.texSubImage3D(x, e, i, r, n, s, o, a, p, y, F); + } + this._context.bindTexture(P, Ts.TEXTURE_UNIT_FOR_UPDATES); + } + generateMipmap() { + const e = this._descriptor; + if (!e.hasMipmap) { + if (this._wasImmutablyAllocated) + throw new Error("Cannot add mipmaps to immutable texture after allocation"); + e.hasMipmap = !0, this._samplingModeDirty = !0, Ts._validateTexture(this._context, e); + } + e.samplingMode === _n.LINEAR ? (this._samplingModeDirty = !0, e.samplingMode = _n.LINEAR_MIPMAP_NEAREST) : e.samplingMode === _n.NEAREST && (this._samplingModeDirty = !0, e.samplingMode = _n.NEAREST_MIPMAP_NEAREST); + const i = this._context.bindTexture(this, Ts.TEXTURE_UNIT_FOR_UPDATES); + this._context.setActiveTexture(Ts.TEXTURE_UNIT_FOR_UPDATES), this._context.gl.generateMipmap(e.target), this._context.bindTexture(i, Ts.TEXTURE_UNIT_FOR_UPDATES); + } + setSamplingMode(e) { + e !== this._descriptor.samplingMode && (this._descriptor.samplingMode = e, this._samplingModeDirty = !0); + } + setWrapMode(e) { + e !== this._descriptor.wrapMode && (this._descriptor.wrapMode = e, Ts._validateTexture(this._context, this._descriptor), this._wrapModeDirty = !0); + } + applyChanges() { + const e = this._context.gl, i = this._descriptor; + this._samplingModeDirty && (Ts._applySamplingMode(e, i), this._samplingModeDirty = !1), this._wrapModeDirty && (Ts._applyWrapMode(e, i), this._wrapModeDirty = !1); + } + _deriveInternalFormat(e, i) { + if (this._context.type === go.WEBGL1) + return e; + switch (i) { + case rs.FLOAT: + switch (e) { + case cn.RGBA: + return Vs.RGBA32F; + case cn.RGB: + return Vs.RGB32F; + default: + throw new Error("Unable to derive format"); + } + case rs.UNSIGNED_BYTE: + switch (e) { + case cn.RGBA: + return Vs.RGBA8; + case cn.RGB: + return Vs.RGB8; + } + default: + return e; + } + } + _configurePixelStorage() { + const e = this._context.gl, { unpackAlignment: i, flipped: r, preMultiplyAlpha: n } = this._descriptor; + e.pixelStorei(e.UNPACK_ALIGNMENT, i), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, r ? 1 : 0), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0); + } + _texStorage(e, i, r, n, s, o) { + const a = this._context.gl2; + if (ut(a)) + throw new Error("Immutable textures are not supported in WebGL1"); + if (!Trr(i)) + throw new Error("Immutable textures must have a sized internal format"); + if (!this._descriptor.isImmutable) + return; + const l = r ? Mrt(e, n, s, o) : 1; + if (v5(e)) { + if (o == null) + throw new Error("Missing depth dimension for 3D texture upload"); + a.texStorage3D(e, l, i, n, s, o); + } else + a.texStorage2D(e, l, i, n, s); + this._wasImmutablyAllocated = !0; + } + _texImage(e, i, r, n, s, o, a) { + const l = this._context.gl; + let c = null; + const h = this._context.type === go.WEBGL2, p = v5(e), { isImmutable: y, pixelFormat: v, dataType: x } = this._descriptor; + if (h && (c = l), h || !i2e(a)) + if (y) { + if (_e(a)) { + const I = a; + if (p) { + if (o == null) + throw new Error("Missing depth dimension for 3D texture upload"); + c.texSubImage3D(e, i, 0, 0, 0, n, s, o, v, x, I); + } else + l.texSubImage2D(e, i, 0, 0, n, s, v, x, I); + } + } else { + const I = a; + if (p) { + if (o == null) + throw new Error("Missing depth dimension for 3D texture upload"); + c.texImage3D(e, i, r, n, s, o, 0, v, x, I); + } else + l.texImage2D(e, i, r, n, s, 0, v, x, I); + } + else + l.texImage2D(e, 0, r, v, x, a); + } + _compressedTexImage(e, i, r, n, s, o, a) { + const l = this._context.gl; + let c = null; + const h = v5(e), p = this._descriptor.isImmutable; + if (h) { + if (this._context.type !== go.WEBGL2) + throw new Error("3D textures are not supported in WebGL1"); + c = l; + } + if (p) { + if (_e(a)) + if (h) { + if (o == null) + throw new Error("Missing depth dimension for 3D texture upload"); + c.compressedTexSubImage3D(e, i, 0, 0, 0, n, s, o, r, a); + } else + l.compressedTexSubImage2D(e, i, 0, 0, n, s, r, a); + } else if (h) { + if (o == null) + throw new Error("Missing depth dimension for 3D texture upload"); + c.compressedTexImage3D(e, i, r, n, s, o, 0, a); + } else + l.compressedTexImage2D(e, i, r, n, s, 0, a); + } + _forEachMipmapLevel(e, i = 1 / 0) { + let { width: r, height: n, depth: s, hasMipmap: o, target: a } = this._descriptor; + const l = a === io.TEXTURE_3D; + if (r == null || n == null || l && s == null) + throw new Error("Missing texture dimensions for mipmap calculation"); + for (let c = 0; e(c, r, n, s), o && (r !== 1 || n !== 1 || l && s !== 1) && !(c >= i); ++c) + r = Math.max(1, r >> 1), n = Math.max(1, n >> 1), l && (s = Math.max(1, s >> 1)); + } + static _validateTexture(e, i) { + (i.width != null && i.width < 0 || i.height != null && i.height < 0 || i.depth != null && i.depth < 0) && console.error("Negative dimension parameters are not allowed!"); + const r = e.type === go.WEBGL2, n = i.width != null && TE(i.width) && i.height != null && TE(i.height); + r || !i.isImmutable && !v5(i.target) || console.error("Immutable and 3D-like textures are not supported in WebGL1!"), r || n || (typeof i.wrapMode == "number" ? i.wrapMode !== ds.CLAMP_TO_EDGE && console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!") : i.wrapMode.s === ds.CLAMP_TO_EDGE && i.wrapMode.t === ds.CLAMP_TO_EDGE || console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"), i.hasMipmap && console.error("Mipmapping requires power-of-two textures!")); + } + static _applySamplingMode(e, i) { + let r = i.samplingMode, n = i.samplingMode; + r === _n.LINEAR_MIPMAP_NEAREST || r === _n.LINEAR_MIPMAP_LINEAR ? (r = _n.LINEAR, i.hasMipmap || (n = _n.LINEAR)) : r !== _n.NEAREST_MIPMAP_NEAREST && r !== _n.NEAREST_MIPMAP_LINEAR || (r = _n.NEAREST, i.hasMipmap || (n = _n.NEAREST)), e.texParameteri(i.target, e.TEXTURE_MAG_FILTER, r), e.texParameteri(i.target, e.TEXTURE_MIN_FILTER, n); + } + static _applyWrapMode(e, i) { + typeof i.wrapMode == "number" ? (e.texParameteri(i.target, e.TEXTURE_WRAP_S, i.wrapMode), e.texParameteri(i.target, e.TEXTURE_WRAP_T, i.wrapMode)) : (e.texParameteri(i.target, e.TEXTURE_WRAP_S, i.wrapMode.s), e.texParameteri(i.target, e.TEXTURE_WRAP_T, i.wrapMode.t)); + } + static _applyAnisotropicFilteringParameters(e, i) { + const r = e.capabilities.textureFilterAnisotropic; + r && e.gl.texParameterf(i.target, r.TEXTURE_MAX_ANISOTROPY, i.maxAnisotropy ?? 1); + } +}; +function Trr(t) { + return t in Vs; +} +function Err(t) { + return t in ed; +} +function xce(t) { + return _e(t) && "type" in t && t.type === "compressed"; +} +function Irr(t) { + return _e(t) && "byteLength" in t; +} +function i2e(t) { + return _e(t) && !xce(t) && !Irr(t); +} +function v5(t) { + return t === io.TEXTURE_3D || t === io.TEXTURE_2D_ARRAY; +} +function Mrt(t, e, i, r = 1) { + let n = Math.max(e, i); + return t === io.TEXTURE_3D && (n = Math.max(n, r)), Math.round(Math.log(n) / Math.LN2) + 1; +} +Ts.TEXTURE_UNIT_FOR_UPDATES = 0; +function Drt(t) { + const e = t.gl; + switch (e.getError()) { + case e.NO_ERROR: + return null; + case e.INVALID_ENUM: + return "An unacceptable value has been specified for an enumerated argument"; + case e.INVALID_VALUE: + return "An unacceptable value has been specified for an argument"; + case e.INVALID_OPERATION: + return "The specified command is not allowed for the current state"; + case e.INVALID_FRAMEBUFFER_OPERATION: + return "The currently bound framebuffer is not framebuffer complete"; + case e.OUT_OF_MEMORY: + return "Not enough memory is left to execute the command"; + case e.CONTEXT_LOST_WEBGL: + return "WebGL context is lost"; + } + return "Unknown error"; +} +function Arr(t, e) { + return t.vertexBuffers[e].size / Prr(t.layout[e]); +} +function Prr(t) { + return t[0].stride; +} +function Orr(t, e, i, r, n = 0) { + const s = t.gl, o = t.capabilities.instancing; + t.bindBuffer(i); + for (const a of r) { + const l = e.get(a.name); + l === void 0 && console.error(`There is no location for vertex attribute '${a.name}' defined.`); + const c = n * a.stride; + if (a.count <= 4) + s.vertexAttribPointer(l, a.count, a.type, a.normalized, a.stride, a.offset + c), s.enableVertexAttribArray(l), a.divisor > 0 && o && o.vertexAttribDivisor(l, a.divisor); + else if (a.count === 9) + for (let h = 0; h < 3; h++) + s.vertexAttribPointer(l + h, 3, a.type, a.normalized, a.stride, a.offset + 12 * h + c), s.enableVertexAttribArray(l + h), a.divisor > 0 && o && o.vertexAttribDivisor(l + h, a.divisor); + else if (a.count === 16) + for (let h = 0; h < 4; h++) + s.vertexAttribPointer(l + h, 4, a.type, a.normalized, a.stride, a.offset + 16 * h + c), s.enableVertexAttribArray(l + h), a.divisor > 0 && o && o.vertexAttribDivisor(l + h, a.divisor); + else + console.error("Unsupported vertex attribute element count: " + a.count); + } +} +function Rrr(t, e, i, r) { + const n = t.gl, s = t.capabilities.instancing; + t.bindBuffer(i); + for (const o of r) { + const a = e.get(o.name); + if (o.count <= 4) + n.disableVertexAttribArray(a), o.divisor && o.divisor > 0 && s && s.vertexAttribDivisor(a, 0); + else if (o.count === 9) + for (let l = 0; l < 3; l++) + n.disableVertexAttribArray(a + l), o.divisor && o.divisor > 0 && s && s.vertexAttribDivisor(a + l, 0); + else if (o.count === 16) + for (let l = 0; l < 4; l++) + n.disableVertexAttribArray(a + l), o.divisor && o.divisor > 0 && s && s.vertexAttribDivisor(a + l, 0); + else + console.error("Unsupported vertex attribute element count: " + o.count); + } + t.unbindBuffer(ao.ARRAY_BUFFER); +} +function CMt(t) { + switch (t) { + case cn.ALPHA: + case cn.LUMINANCE: + case cn.RED: + case cn.RED_INTEGER: + case Vs.R8: + case Vs.R8I: + case Vs.R8UI: + case Vs.R8_SNORM: + case Ag.STENCIL_INDEX8: + return 1; + case cn.LUMINANCE_ALPHA: + case cn.RG: + case cn.RG_INTEGER: + case Vs.RGBA4: + case Vs.R16F: + case Vs.R16I: + case Vs.R16UI: + case Vs.RG8: + case Vs.RG8I: + case Vs.RG8UI: + case Vs.RG8_SNORM: + case Vs.RGB565: + case Vs.RGB5_A1: + case Ag.DEPTH_COMPONENT16: + return 2; + case cn.DEPTH_COMPONENT: + case cn.RGB: + case cn.RGB_INTEGER: + case Vs.RGB8: + case Vs.RGB8I: + case Vs.RGB8UI: + case Vs.RGB8_SNORM: + case Vs.SRGB8: + case Ag.DEPTH_COMPONENT24: + return 3; + case cn.DEPTH_STENCIL: + case cn.RGBA: + case cn.RGBA_INTEGER: + case Vs.RGBA8: + case Vs.R32F: + case Vs.R11F_G11F_B10F: + case Vs.RG16F: + case Vs.R32I: + case Vs.R32UI: + case Vs.RG16I: + case Vs.RG16UI: + case Vs.RGBA8I: + case Vs.RGBA8UI: + case Vs.RGBA8_SNORM: + case Vs.SRGB8_ALPHA8: + case Vs.RGB9_E5: + case Vs.RGB10_A2UI: + case Vs.RGB10_A2: + case Ag.DEPTH_STENCIL: + case Ag.DEPTH_COMPONENT32F: + case Ag.DEPTH24_STENCIL8: + return 4; + case Ag.DEPTH32F_STENCIL8: + return 5; + case Vs.RGB16F: + case Vs.RGB16I: + case Vs.RGB16UI: + return 6; + case Vs.RG32F: + case Vs.RG32I: + case Vs.RG32UI: + case Vs.RGBA16F: + case Vs.RGBA16I: + case Vs.RGBA16UI: + return 8; + case Vs.RGB32F: + case Vs.RGB32I: + case Vs.RGB32UI: + return 12; + case Vs.RGBA32F: + case Vs.RGBA32I: + case Vs.RGBA32UI: + return 16; + case ed.COMPRESSED_RGB_S3TC_DXT1_EXT: + case ed.COMPRESSED_RGBA_S3TC_DXT1_EXT: + return 0.5; + case ed.COMPRESSED_RGBA_S3TC_DXT3_EXT: + case ed.COMPRESSED_RGBA_S3TC_DXT5_EXT: + return 1; + case ed.COMPRESSED_R11_EAC: + case ed.COMPRESSED_SIGNED_R11_EAC: + case ed.COMPRESSED_RGB8_ETC2: + case ed.COMPRESSED_SRGB8_ETC2: + case ed.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case ed.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + return 0.5; + case ed.COMPRESSED_RG11_EAC: + case ed.COMPRESSED_SIGNED_RG11_EAC: + case ed.COMPRESSED_RGBA8_ETC2_EAC: + case ed.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: + return 1; + } + return 0; +} +function zMe(t) { + if (ut(t)) + return 0; + if ("descriptor" in t) + return t.glName ? zMe(t.descriptor) : 0; + const e = t.internalFormat || "pixelFormat" in t && t.pixelFormat; + if (!e) + return 0; + const i = "hasMipmap" in t && t.hasMipmap ? 1.3 : 1, r = t.width * t.height; + return CMt(e) * r * i; +} +let cd = class ij { + constructor(e, i, r = null, n = null) { + if (this._context = e, this._glName = null, this._depthAttachment = null, this._stencilAttachment = null, this._colorAttachments = /* @__PURE__ */ new Map(), this._depthStencilTexture = null, this._initialized = !1, this._desc = { ...i }, e.instanceCounter.increment(Df.FramebufferObject, this), _e(r)) { + Array.isArray(r) || (r = [r]); + for (let s = 0; s < r.length; ++s) { + const o = r[s], a = xv.COLOR_ATTACHMENT0 + s; + let l; + Lrt(o) ? (fP(o) ? (l = o.descriptor, this._colorAttachments.set(a, o)) : (l = o, this._colorAttachments.set(a, new Ts(this._context, l))), Joe(l, this._desc)) : (Frt(o) ? (l = o.descriptor, this._colorAttachments.set(a, o)) : (l = o, this._colorAttachments.set(a, new nO(this._context, l))), r2e(l, this._desc)), this._validateColorAttachmentPoint(a); + } + } + if (_e(n)) { + let s, o; + if (Lrt(n)) + this._context.capabilities.depthTexture || console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"), fP(n) ? (o = n.descriptor, this._depthStencilTexture = n) : (o = n, this._depthStencilTexture = new Ts(this._context, o)), Joe(o, this._desc); + else { + Frt(n) ? (o = n.descriptor, s = n) : (o = n, s = new nO(this._context, o)); + const a = this._desc.depthStencilTarget ?? xl.DEPTH_STENCIL_RENDER_BUFFER; + a === xl.STENCIL_RENDER_BUFFER ? this._stencilAttachment = s : a === xl.DEPTH_RENDER_BUFFER || a === xl.DEPTH_STENCIL_RENDER_BUFFER ? this._depthAttachment = s : console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'), this._desc.depthStencilTarget = a, r2e(o, this._desc); + } + } + } + dispose() { + if (!this._desc) + return; + const e = this._context.getBoundFramebufferObject(); + this._disposeColorAttachments(), this._disposeDepthStencilAttachments(), this._glName && (this._context.gl.deleteFramebuffer(this._glName), this._glName = null), this._context.bindFramebuffer(e), this._context.instanceCounter.decrement(Df.FramebufferObject, this), this._desc = null; + } + get glName() { + return this._glName; + } + get descriptor() { + return this._desc; + } + get colorTexture() { + const e = this._colorAttachments.get(xv.COLOR_ATTACHMENT0); + return e && fP(e) ? e : null; + } + get colorAttachment() { + return this._colorAttachments.get(xv.COLOR_ATTACHMENT0); + } + get depthStencilAttachment() { + return this._depthStencilTexture || this._depthAttachment || this._stencilAttachment; + } + get depthStencilTexture() { + return this._depthStencilTexture; + } + get width() { + return this._desc.width ?? 0; + } + get height() { + return this._desc.height ?? 0; + } + get gpuMemoryUsage() { + return [...this._colorAttachments].reduce((e, [i, r]) => e + zMe(r), 0) + zMe(this.depthStencilAttachment); + } + getColorTexture(e) { + const i = this._colorAttachments.get(e); + return i && fP(i) ? i : null; + } + attachColorTexture(e, i = xv.COLOR_ATTACHMENT0) { + e && (this._validateColorAttachmentPoint(i), Joe(e.descriptor, this._desc), this._disposeColorAttachments(), this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(e.glName, i)), this._colorAttachments.set(i, e)); + } + detachColorTexture(e = xv.COLOR_ATTACHMENT0) { + const i = this._colorAttachments.get(e); + if (fP(i)) { + const r = i; + return this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(null, e)), this._colorAttachments.delete(e), r; + } + } + setColorTextureTarget(e, i = xv.COLOR_ATTACHMENT0) { + const r = this._colorAttachments.get(i); + fP(r) && this._framebufferTexture2D(r.glName, i, e); + } + attachDepthStencilTexture(e) { + if (ut(e)) + return; + const i = e.descriptor; + i.pixelFormat !== cn.DEPTH_STENCIL && console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"), i.dataType !== rs.UNSIGNED_INT_24_8 && console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"), this._context.capabilities.depthTexture || console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"), Joe(i, this._desc), this._desc.depthStencilTarget && this._desc.depthStencilTarget !== xl.DEPTH_STENCIL_TEXTURE && (this._desc.depthStencilTarget = xl.DEPTH_STENCIL_TEXTURE), this._disposeDepthStencilAttachments(), this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(e.glName, pJe)), this._depthStencilTexture = e; + } + detachDepthStencilTexture() { + const e = this._depthStencilTexture; + return e && this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(null, pJe)), this._depthStencilTexture = null, e; + } + attachDepthStencilBuffer(e) { + if (ut(e)) + return; + const i = e.descriptor; + if (i.internalFormat !== Ag.DEPTH_STENCIL && i.internalFormat !== Ag.DEPTH_COMPONENT16 && console.error("Depth/Stencil buffer must have correct internalFormat"), r2e(i, this._desc), this._disposeDepthStencilAttachments(), this._desc.depthStencilTarget = i.internalFormat === Ag.DEPTH_STENCIL ? xl.DEPTH_STENCIL_RENDER_BUFFER : xl.DEPTH_RENDER_BUFFER, this._initialized) { + this._context.bindFramebuffer(this); + const r = this._context.gl, n = this._desc.depthStencilTarget === xl.DEPTH_RENDER_BUFFER ? r.DEPTH_ATTACHMENT : r.DEPTH_STENCIL_ATTACHMENT; + r.framebufferRenderbuffer(nm.FRAMEBUFFER, n, r.RENDERBUFFER, e.glName); + } + this._depthAttachment = e; + } + detachDepthStencilBuffer() { + const e = this._context.gl, i = this._depthAttachment; + if (i && this._initialized) { + this._context.bindFramebuffer(this); + const r = this._desc.depthStencilTarget === xl.DEPTH_RENDER_BUFFER ? e.DEPTH_ATTACHMENT : e.DEPTH_STENCIL_ATTACHMENT; + e.framebufferRenderbuffer(nm.FRAMEBUFFER, r, e.RENDERBUFFER, null); + } + return this._depthAttachment = null, i; + } + detachAll() { + this._colorAttachments.forEach((e, i) => this._detachColorAttachment(i)), this.detachDepthStencilBuffer(), this.detachDepthStencilTexture(); + } + copyToTexture(e, i, r, n, s, o, a) { + (e < 0 || i < 0 || s < 0 || o < 0) && console.error("Offsets cannot be negative!"), (r <= 0 || n <= 0) && console.error("Copy width and height must be greater than zero!"); + const l = this._desc, c = a.descriptor; + a.descriptor.target !== io.TEXTURE_2D && console.error("Texture target must be TEXTURE_2D!"), (l?.width == null || l?.height == null || c?.width == null || c?.height == null || e + r > l.width || i + n > l.height || s + r > c.width || o + n > c.height) && console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!"); + const h = this._context, p = h.bindTexture(a, Ts.TEXTURE_UNIT_FOR_UPDATES); + h.setActiveTexture(Ts.TEXTURE_UNIT_FOR_UPDATES), h.bindFramebuffer(this), h.gl.copyTexSubImage2D(io.TEXTURE_2D, 0, s, o, e, i, r, n), h.bindTexture(p, Ts.TEXTURE_UNIT_FOR_UPDATES); + } + readPixels(e, i, r, n, s, o, a) { + (r <= 0 || n <= 0) && console.error("Copy width and height must be greater than zero!"), a || console.error("Target memory is not initialized!"), this._context.bindFramebuffer(this), this._context.gl.readPixels(e, i, r, n, s, o, a); + } + async readPixelsAsync(e, i, r, n, s, o, a) { + if (this._context.type !== go.WEBGL2) + return db() && console.warn("Attempting to read pixels using pixel buffer object without WebGL2"), void this.readPixels(e, i, r, n, s, o, a); + const l = this._context.gl, c = Qo.createPixelPack(this._context, Vo.STREAM_READ, a.byteLength); + this._context.bindBuffer(c), this._context.bindFramebuffer(this), l.readPixels(e, i, r, n, s, o, 0), this._context.unbindBuffer(ao.PIXEL_PACK_BUFFER), await c.getSubDataAsync(a), c.dispose(); + } + resize(e, i) { + const r = this._desc; + if (r.width !== e || r.height !== i) { + if (r.width = e, r.height = i, !this._initialized) + return this._colorAttachments.forEach((n) => { + n && n.resize(e, i); + }), void (this._depthStencilTexture && this._depthStencilTexture.resize(e, i)); + this._colorAttachments.forEach((n) => { + n && n.resize(e, i); + }), this._depthStencilTexture != null ? this._depthStencilTexture.resize(e, i) : (this._depthAttachment || this._stencilAttachment) && (this._depthAttachment && this._depthAttachment.resize(e, i), this._stencilAttachment && this._stencilAttachment.resize(e, i)), this._context.getBoundFramebufferObject() === this && this._context.bindFramebuffer(null), this._initialized = !1; + } + } + initializeAndBind(e = nm.FRAMEBUFFER) { + const i = this._context.gl; + if (this._initialized) + return void i.bindFramebuffer(e, this.glName); + this._glName && i.deleteFramebuffer(this._glName); + const r = this._context, n = i.createFramebuffer(), s = this._desc, o = s.colorTarget ?? Fh.RENDER_BUFFER, a = s.width ?? 1, l = s.height ?? 1; + if (i.bindFramebuffer(e, n), this._colorAttachments.size === 0) + if (o === Fh.TEXTURE || o === Fh.CUBEMAP) + this._colorAttachments.set(xv.COLOR_ATTACHMENT0, Mrr(r, s, this.descriptor.colorTarget === Fh.CUBEMAP ? io.TEXTURE_CUBE_MAP : io.TEXTURE_2D)); + else { + const h = new nO(r, { internalFormat: Vs.RGBA4, width: a, height: l }); + this._colorAttachments.set(xv.COLOR_ATTACHMENT0, h); + } + this._colorAttachments.forEach((h, p) => { + h && (fP(h) ? this._framebufferTexture2D(h.glName, p, Nrt(h), e) : i.framebufferRenderbuffer(e, p, i.RENDERBUFFER, h.glName)); + }); + const c = s.depthStencilTarget ?? xl.NONE; + switch (c) { + case xl.DEPTH_RENDER_BUFFER: + case xl.DEPTH_STENCIL_RENDER_BUFFER: { + this._depthAttachment || (this._depthAttachment = new nO(r, { internalFormat: s.depthStencilTarget === xl.DEPTH_RENDER_BUFFER ? Ag.DEPTH_COMPONENT16 : Ag.DEPTH_STENCIL, width: a, height: l })); + const h = c === xl.DEPTH_RENDER_BUFFER ? i.DEPTH_ATTACHMENT : i.DEPTH_STENCIL_ATTACHMENT; + i.framebufferRenderbuffer(e, h, i.RENDERBUFFER, this._depthAttachment.glName); + break; + } + case xl.STENCIL_RENDER_BUFFER: + this._stencilAttachment || (this._stencilAttachment = new nO(r, { internalFormat: Ag.STENCIL_INDEX8, width: a, height: l })), i.framebufferRenderbuffer(e, i.STENCIL_ATTACHMENT, i.RENDERBUFFER, this._stencilAttachment.glName); + break; + case xl.DEPTH_STENCIL_TEXTURE: + if (!this._depthStencilTexture) { + r.capabilities.depthTexture || console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!"); + const h = { target: io.TEXTURE_2D, pixelFormat: cn.DEPTH_STENCIL, dataType: rs.UNSIGNED_INT_24_8, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, width: a, height: l }; + this._depthStencilTexture = new Ts(r, h); + } + this._framebufferTexture2D(this._depthStencilTexture.glName, i.DEPTH_STENCIL_ATTACHMENT, Nrt(this._depthStencilTexture), e); + } + db() && i.checkFramebufferStatus(e) !== i.FRAMEBUFFER_COMPLETE && console.error("Framebuffer is incomplete!"), this._glName = n, this._initialized = !0; + } + _framebufferTexture2D(e, i = xv.COLOR_ATTACHMENT0, r = io.TEXTURE_2D, n = nm.FRAMEBUFFER, s = 0) { + this._context.gl.framebufferTexture2D(n, i, r, e, s); + } + _detachColorAttachment(e) { + db() && console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!"); + const i = this._context.gl, r = this._colorAttachments.get(e); + return fP(r) ? this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(null, e)) : this._initialized && (this._context.bindFramebuffer(this), i.framebufferRenderbuffer(nm.FRAMEBUFFER, e, i.RENDERBUFFER, null)), this._colorAttachments.delete(e), r; + } + _disposeColorAttachments() { + this._colorAttachments.forEach((e, i) => { + this._detachColorAttachment(i), e.dispose(); + }), this._colorAttachments.clear(); + } + _disposeDepthStencilAttachments() { + const e = this._context.gl; + if (this._depthAttachment) { + if (this._initialized) { + this._context.bindFramebuffer(this); + const i = this._desc.depthStencilTarget === xl.DEPTH_RENDER_BUFFER ? e.DEPTH_ATTACHMENT : e.DEPTH_STENCIL_ATTACHMENT; + e.framebufferRenderbuffer(nm.FRAMEBUFFER, i, e.RENDERBUFFER, null); + } + this._depthAttachment.dispose(), this._depthAttachment = null; + } + this._stencilAttachment && (this._initialized && (this._context.bindFramebuffer(this), e.framebufferRenderbuffer(nm.FRAMEBUFFER, e.STENCIL_ATTACHMENT, e.RENDERBUFFER, null)), this._stencilAttachment.dispose(), this._stencilAttachment = null), this._depthStencilTexture && (this._initialized && (this._context.bindFramebuffer(this), this._framebufferTexture2D(null, e.DEPTH_STENCIL_ATTACHMENT)), this._depthStencilTexture.dispose(), this._depthStencilTexture = null); + } + _validateColorAttachmentPoint(e) { + if (ij._MAX_COLOR_ATTACHMENTS === -1) { + const r = this._context.capabilities.drawBuffers; + if (r) { + const n = this._context.gl; + ij._MAX_COLOR_ATTACHMENTS = n.getParameter(r.MAX_COLOR_ATTACHMENTS); + } else + ij._MAX_COLOR_ATTACHMENTS = 1; + } + const i = e - xv.COLOR_ATTACHMENT0; + i + 1 > ij._MAX_COLOR_ATTACHMENTS && Ei.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject", `illegal attachment point for color attachment: ${i + 1}. Implementation supports up to ${ij._MAX_COLOR_ATTACHMENTS} color attachments`); + } +}; +function fP(t) { + return t != null && "type" in t && t.type === "texture"; +} +function Frt(t) { + return t != null && "type" in t && t.type === "renderbuffer"; +} +function Lrt(t) { + return fP(t) || t != null && "pixelFormat" in t; +} +function Mrr(t, e, i) { + return new Ts(t, { target: i, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, width: e.width, height: e.height }); +} +function Joe(t, e) { + t.target !== io.TEXTURE_2D && t.target !== io.TEXTURE_CUBE_MAP && console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"), e.width !== void 0 && e.width >= 0 && e.height !== void 0 && e.height >= 0 ? e.width === t.width && e.height === t.height || console.error("Color attachment texture must match the framebuffer's!") : (e.width = t.width, e.height = t.height); +} +function r2e(t, e) { + e.width !== void 0 && e.width >= 0 && e.height !== void 0 && e.height >= 0 ? e.width === t.width && e.height === t.height || console.error("Renderbuffer dimensions must match the framebuffer's!") : (e.width = t.width, e.height = t.height); +} +function Nrt(t) { + return t.descriptor.target === io.TEXTURE_CUBE_MAP ? io.TEXTURE_CUBE_MAP_POSITIVE_X : io.TEXTURE_2D; +} +cd._MAX_COLOR_ATTACHMENTS = -1; +const Drr = ["layout", "centroid", "smooth", "case", "mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", "uint", "uvec2", "uvec3", "uvec4", "samplerCubeShadow", "sampler2DArray", "sampler2DArrayShadow", "isampler2D", "isampler3D", "isamplerCube", "isampler2DArray", "usampler2D", "usampler3D", "usamplerCube", "usampler2DArray", "coherent", "restrict", "readonly", "writeonly", "resource", "atomic_uint", "noperspective", "patch", "sample", "subroutine", "common", "partition", "active", "filter", "image1D", "image2D", "image3D", "imageCube", "iimage1D", "iimage2D", "iimage3D", "iimageCube", "uimage1D", "uimage2D", "uimage3D", "uimageCube", "image1DArray", "image2DArray", "iimage1DArray", "iimage2DArray", "uimage1DArray", "uimage2DArray", "image1DShadow", "image2DShadow", "image1DArrayShadow", "image2DArrayShadow", "imageBuffer", "iimageBuffer", "uimageBuffer", "sampler1DArray", "sampler1DArrayShadow", "isampler1D", "isampler1DArray", "usampler1D", "usampler1DArray", "isampler2DRect", "usampler2DRect", "samplerBuffer", "isamplerBuffer", "usamplerBuffer", "sampler2DMS", "isampler2DMS", "usampler2DMS", "sampler2DMSArray", "isampler2DMSArray", "usampler2DMSArray", "trunc", "round", "roundEven", "isnan", "isinf", "floatBitsToInt", "floatBitsToUint", "intBitsToFloat", "uintBitsToFloat", "packSnorm2x16", "unpackSnorm2x16", "packUnorm2x16", "unpackUnorm2x16", "packHalf2x16", "unpackHalf2x16", "outerProduct", "transpose", "determinant", "inverse", "texture", "textureSize", "textureProj", "textureLod", "textureOffset", "texelFetch", "texelFetchOffset", "textureProjOffset", "textureLodOffset", "textureProjLod", "textureProjLodOffset", "textureGrad", "textureGradOffset", "textureProjGrad", "textureProjGradOffset"]; +var krt, HMe = {}, Frr = { get exports() { + return HMe; +}, set exports(t) { + HMe = t; +} }; +(krt = ["precision", "highp", "mediump", "lowp", "attribute", "const", "uniform", "varying", "break", "continue", "do", "for", "while", "if", "else", "in", "out", "inout", "float", "int", "void", "bool", "true", "false", "discard", "return", "mat2", "mat3", "mat4", "vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4", "bvec2", "bvec3", "bvec4", "sampler1D", "sampler2D", "sampler3D", "samplerCube", "sampler1DShadow", "sampler2DShadow", "struct", "asm", "class", "union", "enum", "typedef", "template", "this", "packed", "goto", "switch", "default", "inline", "noinline", "volatile", "public", "static", "extern", "external", "interface", "long", "short", "double", "half", "fixed", "unsigned", "input", "output", "hvec2", "hvec3", "hvec4", "dvec2", "dvec3", "dvec4", "fvec2", "fvec3", "fvec4", "sampler2DRect", "sampler3DRect", "sampler2DRectShadow", "sizeof", "cast", "namespace", "using"]) !== void 0 && (Frr.exports = krt); +const Lrr = HMe; +var $rt, WMe = {}, Nrr = { get exports() { + return WMe; +}, set exports(t) { + WMe = t; +} }; +$rt = Nrr, function(t) { + var e = ["<<=", ">>=", "++", "--", "<<", ">>", "<=", ">=", "==", "!=", "&&", "||", "+=", "-=", "*=", "/=", "%=", "&=", "^^", "^=", "|=", "(", ")", "[", "]", ".", "!", "~", "*", "/", "%", "+", "-", "<", ">", "&", "^", "|", "?", ":", "=", ",", ";", "{", "}"]; + e !== void 0 && ($rt.exports = e); +}(); +const Brt = WMe; +var qMe = {}, krr = { get exports() { + return qMe; +}, set exports(t) { + qMe = t; +} }; +(function(t) { + (function(e) { + var i = function() { + return ["abs", "acos", "all", "any", "asin", "atan", "ceil", "clamp", "cos", "cross", "dFdx", "dFdy", "degrees", "distance", "dot", "equal", "exp", "exp2", "faceforward", "floor", "fract", "gl_BackColor", "gl_BackLightModelProduct", "gl_BackLightProduct", "gl_BackMaterial", "gl_BackSecondaryColor", "gl_ClipPlane", "gl_ClipVertex", "gl_Color", "gl_DepthRange", "gl_DepthRangeParameters", "gl_EyePlaneQ", "gl_EyePlaneR", "gl_EyePlaneS", "gl_EyePlaneT", "gl_Fog", "gl_FogCoord", "gl_FogFragCoord", "gl_FogParameters", "gl_FragColor", "gl_FragCoord", "gl_FragData", "gl_FragDepth", "gl_FragDepthEXT", "gl_FrontColor", "gl_FrontFacing", "gl_FrontLightModelProduct", "gl_FrontLightProduct", "gl_FrontMaterial", "gl_FrontSecondaryColor", "gl_LightModel", "gl_LightModelParameters", "gl_LightModelProducts", "gl_LightProducts", "gl_LightSource", "gl_LightSourceParameters", "gl_MaterialParameters", "gl_MaxClipPlanes", "gl_MaxCombinedTextureImageUnits", "gl_MaxDrawBuffers", "gl_MaxFragmentUniformComponents", "gl_MaxLights", "gl_MaxTextureCoords", "gl_MaxTextureImageUnits", "gl_MaxTextureUnits", "gl_MaxVaryingFloats", "gl_MaxVertexAttribs", "gl_MaxVertexTextureImageUnits", "gl_MaxVertexUniformComponents", "gl_ModelViewMatrix", "gl_ModelViewMatrixInverse", "gl_ModelViewMatrixInverseTranspose", "gl_ModelViewMatrixTranspose", "gl_ModelViewProjectionMatrix", "gl_ModelViewProjectionMatrixInverse", "gl_ModelViewProjectionMatrixInverseTranspose", "gl_ModelViewProjectionMatrixTranspose", "gl_MultiTexCoord0", "gl_MultiTexCoord1", "gl_MultiTexCoord2", "gl_MultiTexCoord3", "gl_MultiTexCoord4", "gl_MultiTexCoord5", "gl_MultiTexCoord6", "gl_MultiTexCoord7", "gl_Normal", "gl_NormalMatrix", "gl_NormalScale", "gl_ObjectPlaneQ", "gl_ObjectPlaneR", "gl_ObjectPlaneS", "gl_ObjectPlaneT", "gl_Point", "gl_PointCoord", "gl_PointParameters", "gl_PointSize", "gl_Position", "gl_ProjectionMatrix", "gl_ProjectionMatrixInverse", "gl_ProjectionMatrixInverseTranspose", "gl_ProjectionMatrixTranspose", "gl_SecondaryColor", "gl_TexCoord", "gl_TextureEnvColor", "gl_TextureMatrix", "gl_TextureMatrixInverse", "gl_TextureMatrixInverseTranspose", "gl_TextureMatrixTranspose", "gl_Vertex", "greaterThan", "greaterThanEqual", "inversesqrt", "length", "lessThan", "lessThanEqual", "log", "log2", "matrixCompMult", "max", "min", "mix", "mod", "normalize", "not", "notEqual", "pow", "radians", "reflect", "refract", "sign", "sin", "smoothstep", "sqrt", "step", "tan", "texture2D", "texture2DLod", "texture2DProj", "texture2DProjLod", "textureCube", "textureCubeLod", "texture2DLodEXT", "texture2DProjLodEXT", "textureCubeLodEXT", "texture2DGradEXT", "texture2DProjGradEXT", "textureCubeGradEXT", "textureSize", "texelFetch"]; + }(); + i !== void 0 && (t.exports = i); + })(); +})(krr); +const $rr = qMe; +var w2 = 999, Vrt = 9999, n2e = 0, s2e = 1, jrt = 2, Grt = 3, Urt = 4, Zoe = 5, Brr = 6, Vrr = 7, jrr = 8, zrt = 9, Grr = 10, Hrt = 11, Urr = ["block-comment", "line-comment", "preprocessor", "operator", "integer", "float", "ident", "builtin", "keyword", "whitespace", "eof", "integer"]; +function zrr() { + var t, e, i, r = 0, n = 0, s = w2, o = [], a = [], l = 1, c = 0, h = 0, p = !1, y = !1, v = ""; + return function(Se) { + return a = [], Se !== null ? I(Se.replace ? Se.replace(/\r\n/g, ` +`) : Se) : P(); + }; + function x(Se) { + Se.length && a.push({ type: Urr[s], data: Se, position: h, line: l, column: c }); + } + function I(Se) { + var Me; + for (r = 0, i = (v += Se).length; t = v[r], r < i; ) { + switch (Me = r, s) { + case n2e: + r = Y(); + break; + case s2e: + r = j(); + break; + case jrt: + r = V(); + break; + case Grt: + r = X(); + break; + case Urt: + r = he(); + break; + case Hrt: + r = re(); + break; + case Zoe: + r = fe(); + break; + case Vrt: + r = be(); + break; + case zrt: + r = k(); + break; + case w2: + r = F(); + } + Me !== r && (v[Me] === ` +` ? (c = 0, ++l) : ++c); + } + return n += r, v = v.slice(r), a; + } + function P(Se) { + return o.length && x(o.join("")), s = Grr, x("(eof)"), a; + } + function F() { + return o = o.length ? [] : o, e === "/" && t === "*" ? (h = n + r - 1, s = n2e, e = t, r + 1) : e === "/" && t === "/" ? (h = n + r - 1, s = s2e, e = t, r + 1) : t === "#" ? (s = jrt, h = n + r, r) : /\s/.test(t) ? (s = zrt, h = n + r, r) : (p = /\d/.test(t), y = /[^\w_]/.test(t), h = n + r, s = p ? Urt : y ? Grt : Vrt, r); + } + function k() { + return /[^\s]/g.test(t) ? (x(o.join("")), s = w2, r) : (o.push(t), e = t, r + 1); + } + function V() { + return t !== "\r" && t !== ` +` || e === "\\" ? (o.push(t), e = t, r + 1) : (x(o.join("")), s = w2, r); + } + function j() { + return V(); + } + function Y() { + return t === "/" && e === "*" ? (o.push(t), x(o.join("")), s = w2, r + 1) : (o.push(t), e = t, r + 1); + } + function X() { + if (e === "." && /\d/.test(t)) + return s = Zoe, r; + if (e === "/" && t === "*") + return s = n2e, r; + if (e === "/" && t === "/") + return s = s2e, r; + if (t === "." && o.length) { + for (; Q(o); ) + ; + return s = Zoe, r; + } + if (t === ";" || t === ")" || t === "(") { + if (o.length) + for (; Q(o); ) + ; + return x(t), s = w2, r + 1; + } + var Se = o.length === 2 && t !== "="; + if (/[\w_\d\s]/.test(t) || Se) { + for (; Q(o); ) + ; + return s = w2, r; + } + return o.push(t), e = t, r + 1; + } + function Q(Se) { + for (var Me, ke, J = 0; ; ) { + if (Me = Brt.indexOf(Se.slice(0, Se.length + J).join("")), ke = Brt[Me], Me === -1) { + if (J-- + Se.length > 0) + continue; + ke = Se.slice(0, 1).join(""); + } + return x(ke), h += ke.length, (o = o.slice(ke.length)).length; + } + } + function re() { + return /[^a-fA-F0-9]/.test(t) ? (x(o.join("")), s = w2, r) : (o.push(t), e = t, r + 1); + } + function he() { + return t === "." || /[eE]/.test(t) ? (o.push(t), s = Zoe, e = t, r + 1) : t === "x" && o.length === 1 && o[0] === "0" ? (s = Hrt, o.push(t), e = t, r + 1) : /[^\d]/.test(t) ? (x(o.join("")), s = w2, r) : (o.push(t), e = t, r + 1); + } + function fe() { + return t === "f" && (o.push(t), e = t, r += 1), /[eE]/.test(t) || t === "-" && /[eE]/.test(e) ? (o.push(t), e = t, r + 1) : /[^\d]/.test(t) ? (x(o.join("")), s = w2, r) : (o.push(t), e = t, r + 1); + } + function be() { + if (/[^\d\w_]/.test(t)) { + var Se = o.join(""); + return s = Lrr.indexOf(Se) > -1 ? jrr : $rr.indexOf(Se) > -1 ? Vrr : Brr, x(o.join("")), s = w2, r; + } + return o.push(t), e = t, r + 1; + } +} +function Hrr(t) { + var e = zrr(), i = []; + return i = (i = i.concat(e(t))).concat(e(null)); +} +function Wrr(t) { + return Hrr(t); +} +function qrr(t) { + return t.map((e) => e.type !== "eof" ? e.data : "").join(""); +} +const o2e = ["GL_OES_standard_derivatives", "GL_EXT_frag_depth", "GL_EXT_draw_buffers", "GL_EXT_shader_texture_lod"]; +function Yrr(t, e = "100", i = "300 es") { + const r = /^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/; + for (const n of t) + if (n.type === "preprocessor") { + const s = r.exec(n.data); + if (s) { + const o = s[1].replace(/\s\s+/g, " "); + if (o === i) + return o; + if (o === e) + return n.data = "#version " + i, e; + throw new Error("unknown glsl version: " + o); + } + } + return t.splice(0, 0, { type: "preprocessor", data: "#version " + i }, { type: "whitespace", data: ` +` }), null; +} +function Xrr(t, e) { + for (let i = e - 1; i >= 0; i--) { + const r = t[i]; + if (r.type !== "whitespace" && r.type !== "block-comment") { + if (r.type !== "keyword") + break; + if (r.data === "attribute" || r.data === "in") + return !0; + } + } + return !1; +} +function JX(t, e, i, r) { + r = r || i; + for (const n of t) + if (n.type === "ident" && n.data === i) + return r in e ? e[r]++ : e[r] = 0, JX(t, e, r + "_" + e[r], r); + return i; +} +function TMt(t, e, i = "afterVersion") { + function r(l, c) { + for (let h = c; h < l.length; h++) { + const p = l[h]; + if (p.type === "operator" && p.data === ";") + return h; + } + return null; + } + function n(l) { + let c = -1, h = 0, p = -1; + for (let y = 0; y < l.length; y++) { + const v = l[y]; + if (v.type === "preprocessor" && (v.data.match(/\#(if|ifdef|ifndef)\s+.+/) ? ++h : v.data.match(/\#endif\s*.*/) && --h), i !== "afterVersion" && i !== "afterPrecision" || v.type === "preprocessor" && /^#version/.test(v.data) && (p = Math.max(p, y)), i === "afterPrecision" && v.type === "keyword" && v.data === "precision") { + const x = r(l, y); + if (x === null) + throw new Error("precision statement not followed by any semicolons!"); + p = Math.max(p, x); + } + c < p && h === 0 && (c = y); + } + return c + 1; + } + const s = { data: ` +`, type: "whitespace" }, o = (l) => l < t.length && /[^\r\n]$/.test(t[l].data); + let a = n(t); + o(a - 1) && t.splice(a++, 0, s); + for (const l of e) + t.splice(a++, 0, l); + o(a - 1) && o(a) && t.splice(a, 0, s); +} +function Krr(t, e, i, r = "lowp") { + TMt(t, [{ type: "keyword", data: "out" }, { type: "whitespace", data: " " }, { type: "keyword", data: r }, { type: "whitespace", data: " " }, { type: "keyword", data: i }, { type: "whitespace", data: " " }, { type: "ident", data: e }, { type: "operator", data: ";" }], "afterPrecision"); +} +function Jrr(t, e, i, r, n = "lowp") { + TMt(t, [{ type: "keyword", data: "layout" }, { type: "operator", data: "(" }, { type: "keyword", data: "location" }, { type: "whitespace", data: " " }, { type: "operator", data: "=" }, { type: "whitespace", data: " " }, { type: "integer", data: r.toString() }, { type: "operator", data: ")" }, { type: "whitespace", data: " " }, { type: "keyword", data: "out" }, { type: "whitespace", data: " " }, { type: "keyword", data: n }, { type: "whitespace", data: " " }, { type: "keyword", data: i }, { type: "whitespace", data: " " }, { type: "ident", data: e }, { type: "operator", data: ";" }], "afterPrecision"); +} +function Zrr(t, e) { + let i, r, n = -1; + for (let s = e; s < t.length; s++) { + const o = t[s]; + if (o.type === "operator" && (o.data === "[" && (i = s), o.data === "]")) { + r = s; + break; + } + o.type === "integer" && (n = parseInt(o.data, 10)); + } + return i && r && t.splice(i, r - i + 1), n; +} +function Wrt(t, e) { + const i = Qrr(); + if (_e(i)) + return i; + const r = Wrr(t); + if (Yrr(r, "100", "300 es") === "300 es") + return t; + let n = null, s = null; + const o = {}, a = {}; + for (let l = 0; l < r.length; ++l) { + const c = r[l]; + switch (c.type) { + case "keyword": + e === bb.VERTEX_SHADER && c.data === "attribute" ? c.data = "in" : c.data === "varying" && (c.data = e === bb.VERTEX_SHADER ? "out" : "in"); + break; + case "builtin": + if (/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(c.data.trim()) && (c.data = c.data.replace(/(2D|Cube|EXT)/g, "")), e === bb.FRAGMENT_SHADER && c.data === "gl_FragColor" && (n || (n = JX(r, o, "fragColor"), Krr(r, n, "vec4")), c.data = n), e === bb.FRAGMENT_SHADER && c.data === "gl_FragData") { + const h = Zrr(r, l + 1), p = JX(r, o, "fragData"); + Jrr(r, p, "vec4", h, "mediump"), c.data = p; + } else + e === bb.FRAGMENT_SHADER && c.data === "gl_FragDepthEXT" && (s || (s = JX(r, o, "gl_FragDepth")), c.data = s); + break; + case "ident": + if (Drr.includes(c.data)) { + if (e === bb.VERTEX_SHADER && Xrr(r, l)) + throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es"); + c.data in a || (a[c.data] = JX(r, o, c.data)), c.data = a[c.data]; + } + } + } + for (let l = r.length - 1; l >= 0; --l) { + const c = r[l]; + if (c.type === "preprocessor") { + const h = c.data.match(/\#extension\s+(.*)\:/); + if (h && h[1] && o2e.includes(h[1].trim())) { + const v = r[l + 1]; + r.splice(l, v && v.type === "whitespace" ? 2 : 1); + } + const p = c.data.match(/\#ifdef\s+(.*)/); + p && p[1] && o2e.includes(p[1].trim()) && (c.data = "#if 1"); + const y = c.data.match(/\#ifndef\s+(.*)/); + y && y[1] && o2e.includes(y[1].trim()) && (c.data = "#if 0"); + } + } + return enr(t, qrr(r)); +} +function Qrr(t) { + return null; +} +function enr(t, e) { + return e; +} +const tnr = 4294967295; +let M9e = class { + constructor(e, i, r, n, s = /* @__PURE__ */ new Map()) { + this._context = e, this._locations = n, this._uniformBlockBindings = s, this._refCount = 1, this._compiled = !1, this._nameToUniformLocation = {}, this._nameToUniform1 = {}, this._nameToUniform1v = /* @__PURE__ */ new Map(), this._nameToUniform2 = /* @__PURE__ */ new Map(), this._nameToUniform3 = /* @__PURE__ */ new Map(), this._nameToUniform4 = /* @__PURE__ */ new Map(), this._nameToUniformMatrix3 = /* @__PURE__ */ new Map(), this._nameToUniformMatrix4 = /* @__PURE__ */ new Map(), e || console.error("RenderingContext isn't initialized!"), i.length === 0 && console.error("Shaders source should not be empty!"), this._context.type === go.WEBGL2 && (i = Wrt(i, bb.VERTEX_SHADER), r = Wrt(r, bb.FRAGMENT_SHADER)), this._vShader = qrt(this._context, bb.VERTEX_SHADER, i), this._fShader = qrt(this._context, bb.FRAGMENT_SHADER, r), this._vShader && this._fShader || console.error("Error loading shaders!"), this._context.instanceCounter.increment(Df.Shader, this), UMe() && (this.vertexShader = i, this.fragmentShader = r); + const o = this._context.gl, a = o.createProgram(); + if (o.attachShader(a, this._vShader), o.attachShader(a, this._fShader), this._locations.forEach((l, c) => o.bindAttribLocation(a, l, c)), o.linkProgram(a), UMe() && !o.getProgramParameter(a, o.LINK_STATUS) && console.error(`Could not link shader +validated: ${o.getProgramParameter(a, o.VALIDATE_STATUS)}, gl error ${o.getError()}, vertex: ${o.getShaderParameter(this._vShader, o.COMPILE_STATUS)}, fragment: ${o.getShaderParameter(this._fShader, o.COMPILE_STATUS)}, info log: ${o.getProgramInfoLog(a)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`), this._context.type === go.WEBGL2) { + const l = o; + for (const [c, h] of this._uniformBlockBindings) { + const p = l.getUniformBlockIndex(a, c); + p < tnr && l.uniformBlockBinding(a, p, h); + } + } + this._glName = a, this._context.instanceCounter.increment(Df.Program, this); + } + get glName() { + return this._glName; + } + get hasGLName() { + return _e(this._glName); + } + get compiled() { + if (this._compiled) + return !0; + const e = this._context.gl.getExtension("KHR_parallel_shader_compile"); + return e == null || ut(this.glName) ? (this._compiled = !0, !0) : (this._compiled = !!this._context.gl.getProgramParameter(this.glName, e.COMPLETION_STATUS_KHR), this._compiled); + } + dispose() { + if (--this._refCount > 0) + return; + const e = this._context.gl; + this._vShader && (e.deleteShader(this._vShader), this._vShader = null, this._context.instanceCounter.decrement(Df.Shader, this)), this._fShader && (e.deleteShader(this._fShader), this._fShader = null), this._glName && (e.deleteProgram(this._glName), this._glName = null, this._context.instanceCounter.decrement(Df.Program, this)); + } + ref() { + ++this._refCount; + } + _getUniformLocation(e) { + return this._nameToUniformLocation[e] === void 0 && _e(this.glName) && (++YMe.numUniforms, this._nameToUniformLocation[e] = this._context.gl.getUniformLocation(this.glName, e)), this._nameToUniformLocation[e]; + } + hasUniform(e) { + return this._getUniformLocation(e) !== null; + } + setUniform1i(e, i) { + const r = this._nameToUniform1[e]; + r !== void 0 && i === r || (this._context.gl.uniform1i(this._getUniformLocation(e), i), this._nameToUniform1[e] = i); + } + setUniform1iv(e, i) { + uT(this._nameToUniform1v, e, i) && this._context.gl.uniform1iv(this._getUniformLocation(e), i); + } + setUniform2iv(e, i) { + uT(this._nameToUniform2, e, i) && this._context.gl.uniform2iv(this._getUniformLocation(e), i); + } + setUniform3iv(e, i) { + uT(this._nameToUniform3, e, i) && this._context.gl.uniform3iv(this._getUniformLocation(e), i); + } + setUniform4iv(e, i) { + uT(this._nameToUniform4, e, i) && this._context.gl.uniform4iv(this._getUniformLocation(e), i); + } + setUniform1f(e, i) { + const r = this._nameToUniform1[e]; + r !== void 0 && i === r || (this._context.gl.uniform1f(this._getUniformLocation(e), i), this._nameToUniform1[e] = i); + } + setUniform1fv(e, i) { + uT(this._nameToUniform1v, e, i) && this._context.gl.uniform1fv(this._getUniformLocation(e), i); + } + setUniform2f(e, i, r) { + const n = this._nameToUniform2.get(e); + n === void 0 ? (this._context.gl.uniform2f(this._getUniformLocation(e), i, r), this._nameToUniform2.set(e, [i, r])) : i === n[0] && r === n[1] || (this._context.gl.uniform2f(this._getUniformLocation(e), i, r), n[0] = i, n[1] = r); + } + setUniform2fv(e, i) { + uT(this._nameToUniform2, e, i) && this._context.gl.uniform2fv(this._getUniformLocation(e), i); + } + setUniform3f(e, i, r, n) { + const s = this._nameToUniform3.get(e); + s === void 0 ? (this._context.gl.uniform3f(this._getUniformLocation(e), i, r, n), this._nameToUniform3[e] = [i, r, n]) : i === s[0] && r === s[1] && n === s[2] || (this._context.gl.uniform3f(this._getUniformLocation(e), i, r, n), s[0] = i, s[1] = r, s[2] = n); + } + setUniform3fv(e, i) { + uT(this._nameToUniform3, e, i) && this._context.gl.uniform3fv(this._getUniformLocation(e), i); + } + setUniform4f(e, i, r, n, s) { + const o = this._nameToUniform4.get(e); + o === void 0 ? (this._context.gl.uniform4f(this._getUniformLocation(e), i, r, n, s), this._nameToUniform4.set(e, [i, r, n, s])) : o !== void 0 && i === o[0] && r === o[1] && n === o[2] && s === o[3] || (this._context.gl.uniform4f(this._getUniformLocation(e), i, r, n, s), o[0] = i, o[1] = r, o[2] = n, o[3] = s); + } + setUniform4fv(e, i) { + uT(this._nameToUniform4, e, i) && this._context.gl.uniform4fv(this._getUniformLocation(e), i); + } + setUniformMatrix3fv(e, i, r = !1) { + uT(this._nameToUniformMatrix3, e, i) && this._context.gl.uniformMatrix3fv(this._getUniformLocation(e), r, i); + } + setUniformMatrix4fv(e, i, r = !1) { + uT(this._nameToUniformMatrix4, e, i) && this._context.gl.uniformMatrix4fv(this._getUniformLocation(e), r, i); + } + stop() { + } +}; +function qrt(t, e, i) { + const r = t.gl, n = r.createShader(e); + return r.shaderSource(n, i), r.compileShader(n), UMe() && !r.getShaderParameter(n, r.COMPILE_STATUS) && (console.error("Compile error in ".concat(e === bb.VERTEX_SHADER ? "vertex" : "fragment", " shader")), console.error(r.getShaderInfoLog(n)), console.error(inr(i))), YMe.enabled && (YMe.compiledLOC += i.match(/\n/g).length + 1), n; +} +function inr(t) { + let e = 2; + return t.replace(/\n/g, () => ` +` + rnr(e++) + ":"); +} +function rnr(t) { + return t >= 1e3 ? t.toString() : (" " + t).slice(-3); +} +function uT(t, e, i) { + const r = t.get(e); + return r ? Jlt(r, i) : (t.set(e, Array.from(i)), !0); +} +const YMe = { compiledLOC: 0, numUniforms: 0, enabled: !1 }; +let EMt = class { + constructor() { + this._outer = /* @__PURE__ */ new Map(); + } + clear() { + this._outer.clear(); + } + get empty() { + return this._outer.size === 0; + } + get(e, i) { + return this._outer.get(e)?.get(i); + } + set(e, i, r) { + const n = this._outer.get(e); + n ? n.set(i, r) : this._outer.set(e, /* @__PURE__ */ new Map([[i, r]])); + } + delete(e, i) { + const r = this._outer.get(e); + r && (r.delete(i), r.size === 0 && this._outer.delete(e)); + } + forEach(e) { + this._outer.forEach((i, r) => e(i, r)); + } +}, IMt = class { + constructor(e) { + this._rctx = e, this._store = new EMt(); + } + dispose() { + this._store.forEach((e) => e.forEach((i) => i.dispose())), this._store.clear(); + } + acquire(e, i, r, n) { + const s = this._store.get(e, i); + if (_e(s)) + return s.ref(), s; + const o = new M9e(this._rctx, e, i, r, n); + return o.ref(), this._store.set(e, i, o), o; + } + get test() { + let e = 0; + return this._store.forEach((i) => i.forEach((r) => e += r.hasGLName ? 2 : 1)), { cachedWebGLObjects: e }; + } +}, D9e = class { + constructor(e) { + this._readFile = e; + } + resolveIncludes(e) { + return this._resolve(e); + } + _resolve(e, i = /* @__PURE__ */ new Map()) { + if (i.has(e)) + return i.get(e); + const r = this._read(e); + if (!r) + throw new Error(`cannot find shader file ${e}`); + const n = /^[^\S\n]*#include\s+<(\S+)>[^\S\n]?/gm; + let s = n.exec(r); + const o = []; + for (; s != null; ) + o.push({ path: s[1], start: s.index, length: s[0].length }), s = n.exec(r); + let a = 0, l = ""; + return o.forEach((c) => { + l += r.slice(a, c.start), l += i.has(c.path) ? "" : this._resolve(c.path, i), a = c.start + c.length; + }), l += r.slice(a), i.set(e, l), l; + } + _read(e) { + return this._readFile(e); + } +}; +const _5 = Ei.getLogger("esri.views.webgl.VertexArrayObject"); +let Ac = class { + constructor(e, i, r, n, s = null) { + this._context = e, this._locations = i, this._layout = r, this._buffers = n, this._indexBuffer = s, this._glName = null, this._initialized = !1, e.instanceCounter.increment(Df.VertexArrayObject, this); + } + get glName() { + return this._glName; + } + get context() { + return this._context; + } + get vertexBuffers() { + return this._buffers; + } + get indexBuffer() { + return this._indexBuffer; + } + get size() { + return Object.keys(this._buffers).reduce((e, i) => e + this._buffers[i].size, _e(this._indexBuffer) ? this._indexBuffer.size : 0); + } + get layout() { + return this._layout; + } + get locations() { + return this._locations; + } + dispose(e = !0) { + if (!this._context) + return void ((this._glName || e && Object.getOwnPropertyNames(this._buffers).length > 0) && _5.warn("Leaked WebGL VAO")); + if (this._glName) { + const i = this._context?.capabilities?.vao; + i ? (i.deleteVertexArray(this._glName), this._glName = null) : _5.warn("Leaked WebGL VAO"); + } + if (this._context.getBoundVAO() === this && this._context.bindVAO(null), e) { + for (const i in this._buffers) + this._buffers[i]?.dispose(), delete this._buffers[i]; + this._indexBuffer = Ua(this._indexBuffer); + } + this._context.instanceCounter.decrement(Df.VertexArrayObject, this), this._context = Tte(this._context); + } + initialize() { + if (this._initialized) + return; + const e = this._context.capabilities.vao; + if (e) { + const i = e.createVertexArray(); + e.bindVertexArray(i), this._bindLayout(), e.bindVertexArray(null), this._glName = i; + } + this._initialized = !0; + } + bind() { + this.initialize(); + const e = this._context.capabilities.vao; + e ? e.bindVertexArray(this.glName) : (this._context.bindVAO(null), this._bindLayout()); + } + _bindLayout() { + const { _buffers: e, _layout: i, _indexBuffer: r } = this; + e || _5.error("Vertex buffer dictionary is empty!"); + const n = this._context.gl; + for (const s in e) { + const o = e[s]; + o || _5.error("Vertex buffer is uninitialized!"); + const a = i[s]; + a || _5.error("Vertex element descriptor is empty!"), Orr(this._context, this._locations, o, a); + } + _e(r) && (this._context.capabilities.vao ? n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, r.glName) : this._context.bindBuffer(r)); + } + unbind() { + this.initialize(); + const e = this._context.capabilities.vao; + e ? e.bindVertexArray(null) : this._unbindLayout(); + } + _unbindLayout() { + const { _buffers: e, _layout: i } = this; + e || _5.error("Vertex buffer dictionary is empty!"); + for (const r in e) { + const n = e[r]; + n || _5.error("Vertex buffer is uninitialized!"); + const s = i[r]; + Rrr(this._context, this._locations, n, s); + } + _e(this._indexBuffer) && this._context.unbindBuffer(this._indexBuffer.bufferType); + } +}; +function nnr(t) { + const { options: e, value: i } = t; + return typeof e[i] == "number"; +} +function P3(t) { + let e = ""; + for (const i in t) { + const r = t[i]; + if (typeof r == "boolean") + r && (e += `#define ${i} +`); + else if (typeof r == "number") + e += `#define ${i} ${r.toFixed()} +`; + else if (typeof r == "object") + if (nnr(r)) { + const { value: n, options: s, namespace: o } = r, a = o ? `${o}_` : ""; + for (const l in s) + e += `#define ${a}${l} ${s[l].toFixed()} +`; + e += `#define ${i} ${a}${n} +`; + } else { + const n = r.options; + let s = 0; + for (const o in n) + e += `#define ${n[o]} ${(s++).toFixed()} +`; + e += `#define ${i} ${n[r.value]} +`; + } + } + return e; +} +function SI(t, e, i = "") { + return new M9e(t, i + e.shaders.vertexShader, i + e.shaders.fragmentShader, e.attributes); +} +const AMt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + BufferObject: Qo, + FramebufferObject: cd, + Program: M9e, + ProgramCache: IMt, + Renderbuffer: nO, + ShaderCompiler: D9e, + Texture: Ts, + VertexArrayObject: Ac, + createContextOrErrorHTML: D1t, + createProgram: SI, + glslifyDefineMap: P3 +}, Symbol.toStringTag, { value: "Module" })), dte = -1; +let Uw = class extends vn { + constructor(e) { + super(e), this._from = null, this._to = null, this._final = null, this._current = [], this._time = 0, this.duration = Vi("mapview-transitions-duration"), this.effects = []; + } + set effect(e) { + if (this._get("effect") !== (e = e || "")) { + this._set("effect", e); + try { + this._transitionTo(Yrt(e)); + } catch (i) { + this._transitionTo([]), Ei.getLogger(this.declaredClass).warn("Invalid Effect", { effect: e, error: i }); + } + } + } + get hasEffects() { + return this.transitioning || !!this.effects.length; + } + set scale(e) { + this._updateForScale(e); + } + get transitioning() { + return this._to !== null; + } + canTransitionTo(e) { + try { + return this.scale > 0 && Xrt(this._current, Yrt(e), this.scale); + } catch { + return !1; + } + } + transitionStep(e, i) { + this._applyTimeTransition(e), this._updateForScale(i); + } + endTransitions() { + this._applyTimeTransition(this.duration); + } + _transitionTo(e) { + this.scale > 0 && Xrt(this._current, e, this.scale) ? (this._final = e, this._to = fi(e), snr(this._current, this._to, this.scale), this._from = fi(this._current), this._time = 0) : (this._from = this._to = this._final = null, this._current = e), this._set("effects", this._current[0] ? fi(this._current[0].effects) : []); + } + _applyTimeTransition(e) { + if (!(this._to && this._from && this._current && this._final)) + return; + this._time += e; + const i = Math.min(1, this._time / this.duration); + for (let r = 0; r < this._current.length; r++) { + const n = this._current[r], s = this._from[r], o = this._to[r]; + n.scale = onr(s.scale, o.scale, i); + for (let a = 0; a < n.effects.length; a++) { + const l = n.effects[a], c = s.effects[a], h = o.effects[a]; + l.interpolate(c, h, i); + } + } + i === 1 && (this._current = this._final, this._set("effects", this._current[0] ? fi(this._current[0].effects) : []), this._from = this._to = this._final = null); + } + _updateForScale(e) { + if (this._set("scale", e), this._current.length === 0) + return; + const i = this._current, r = this._current.length - 1; + let n, s, o = 1; + if (i.length === 1 || e >= i[0].scale) + s = n = i[0].effects; + else if (e <= i[r].scale) + s = n = i[r].effects; + else + for (let a = 0; a < r; a++) { + const l = i[a], c = i[a + 1]; + if (l.scale >= e && c.scale <= e) { + o = (e - l.scale) / (c.scale - l.scale), n = l.effects, s = c.effects; + break; + } + } + for (let a = 0; a < this.effects.length; a++) + this.effects[a].interpolate(n[a], s[a], o); + } +}; +function Yrt(t) { + const e = FLe(t) || []; + return anr(e) ? [{ scale: dte, effects: e }] : e; +} +function Xrt(t, e, i) { + return !t[0]?.effects || !e[0]?.effects ? !0 : !((t[0]?.scale === dte || e[0]?.scale === dte) && (t.length > 1 || e.length > 1) && i <= 0) && vft(t[0].effects, e[0].effects); +} +function snr(t, e, i) { + const r = t.length > e.length ? t : e, n = t.length > e.length ? e : t, s = n[n.length - 1], o = s?.scale ?? i, a = s?.effects ?? []; + for (let l = n.length; l < r.length; l++) + n.push({ scale: o, effects: [...a] }); + for (let l = 0; l < r.length; l++) + n[l].scale = n[l].scale === dte ? i : n[l].scale, r[l].scale = r[l].scale === dte ? i : r[l].scale, _ft(n[l].effects, r[l].effects); +} +function onr(t, e, i) { + return t + (e - t) * i; +} +function anr(t) { + const e = t[0]; + return !!e && "type" in e; +} +E([N()], Uw.prototype, "_to", void 0), E([N()], Uw.prototype, "duration", void 0), E([N({ value: "" })], Uw.prototype, "effect", null), E([N({ readOnly: !0 })], Uw.prototype, "effects", void 0), E([N({ readOnly: !0 })], Uw.prototype, "hasEffects", null), E([N({ value: 0 })], Uw.prototype, "scale", null), E([N({ readOnly: !0 })], Uw.prototype, "transitioning", null), Uw = E([dt("esri.layers.effects.EffectView")], Uw); +const lnr = 1 / Vi("mapview-transitions-duration"); +let pC = class extends Bd { + constructor() { + super(...arguments), this._fadeOutResolver = null, this._fadeInResolver = null, this._clips = null, this.computedVisible = !0, this.computedOpacity = 1, this.fadeTransitionEnabled = !1, this.inFadeTransition = !1, this._isReady = !1, this._opacity = 1, this.parent = null, this._stage = null, this._visible = !0; + } + get clips() { + return this._clips; + } + set clips(e) { + this._clips = e, this.requestRender(); + } + get isReady() { + return this._isReady; + } + get opacity() { + return this._opacity; + } + set opacity(e) { + this._opacity !== e && (this._opacity = Math.min(1, Math.max(e, 0)), this.requestRender()); + } + get stage() { + return this._stage; + } + set stage(e) { + if (this._stage === e) + return; + const i = this._stage; + this._stage = e, e ? this._stage?.untrashDisplayObject(this) || (this.onAttach(), this.emit("attach")) : i?.trashDisplayObject(this); + } + get transforms() { + return this._getTransforms(); + } + _getTransforms() { + return ut(this._transforms) && (this._transforms = this._createTransforms()), this._transforms; + } + get visible() { + return this._visible; + } + set visible(e) { + this._visible !== e && (this._visible = e, this.requestRender()); + } + fadeIn() { + return this._fadeInResolver || (this._fadeOutResolver && (this._fadeOutResolver(), this._fadeOutResolver = null), this.opacity = 1, this.computedOpacity = 0, this.fadeTransitionEnabled = !0, this._fadeInResolver = mm(), this.requestRender()), this._fadeInResolver.promise; + } + fadeOut() { + return this._fadeOutResolver || (this.opacity = 0, this._fadeInResolver && (this._fadeInResolver(), this._fadeInResolver = null), this.fadeTransitionEnabled = !0, this._fadeOutResolver = mm(), this.requestRender()), this._fadeOutResolver.promise; + } + endTransitions() { + this._fadeInResolver?.(), this._fadeInResolver = null, this._fadeOutResolver?.(), this._fadeOutResolver = null, this.computedOpacity = this.visible ? this.opacity : 0, this.requestRender(); + } + beforeRender(e) { + this.updateTransitionProperties(e.deltaTime, e.state.scale); + } + afterRender(e) { + this._fadeInResolver && this.computedOpacity === this.opacity ? (this._fadeInResolver(), this._fadeInResolver = null) : this._fadeOutResolver && this.computedOpacity === 0 && (this._fadeOutResolver(), this._fadeOutResolver = null); + } + remove() { + this.parent?.removeChild(this); + } + setTransform(e) { + } + processRender(e) { + this.stage && this.computedVisible && this.doRender(e); + } + requestRender() { + this.stage && this.stage.requestRender(); + } + processDetach() { + this._fadeInResolver && (this._fadeInResolver(), this._fadeInResolver = null), this._fadeOutResolver && (this._fadeOutResolver(), this._fadeOutResolver = null), this.onDetach(), this.emit("detach"); + } + updateTransitionProperties(e, i) { + if (this.fadeTransitionEnabled) { + const r = this._fadeOutResolver || !this.visible ? 0 : this.opacity, n = this.computedOpacity; + if (n === r) + this.computedVisible = this.visible; + else { + const s = e * lnr; + this.computedOpacity = n > r ? Math.max(r, n - s) : Math.min(r, n + s), this.computedVisible = this.computedOpacity > 0; + const o = r === this.computedOpacity; + this.inFadeTransition = !o, o || this.requestRender(); + } + } else + this.computedOpacity = this.opacity, this.computedVisible = this.visible; + } + onAttach() { + } + onDetach() { + } + doRender(e) { + } + ready() { + this._isReady || (this._isReady = !0, this.emit("isReady"), this.requestRender()); + } +}; +const XMe = 1, unr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1], cnr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], wq = 256, YD = { outlineWidth: 1.3, outerHaloWidth: 0.4, innerHaloWidth: 0.4, outlinePosition: 0 }, a2e = Ei.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient"); +function hnr(t, e) { + e.fillColor[0] = t.color.r / 255, e.fillColor[1] = t.color.g / 255, e.fillColor[2] = t.color.b / 255, e.fillColor[3] = t.color.a, t.haloColor ? (e.outlineColor[0] = t.haloColor.r / 255, e.outlineColor[1] = t.haloColor.g / 255, e.outlineColor[2] = t.haloColor.b / 255, e.outlineColor[3] = t.haloColor.a) : (e.outlineColor[0] = e.fillColor[0], e.outlineColor[1] = e.fillColor[1], e.outlineColor[2] = e.fillColor[2], e.outlineColor[3] = e.fillColor[3]), e.fillColor[3] *= t.fillOpacity, e.outlineColor[3] *= t.haloOpacity, e.fillColor[0] *= e.fillColor[3], e.fillColor[1] *= e.fillColor[3], e.fillColor[2] *= e.fillColor[3], e.outlineColor[0] *= e.outlineColor[3], e.outlineColor[1] *= e.outlineColor[3], e.outlineColor[2] *= e.outlineColor[3], e.outlineWidth = YD.outlineWidth, e.outerHaloWidth = YD.outerHaloWidth, e.innerHaloWidth = YD.innerHaloWidth, e.outlinePosition = YD.outlinePosition; +} +const dnr = [0, 0, 0, 0]; +let pnr = class { + constructor() { + this._convertedHighlightOptions = { fillColor: [0.2 * 0.75, 0.6 * 0.75, 0.675, 0.75], outlineColor: [0.2 * 0.9, 0.54, 0.81, 0.9], outlinePosition: YD.outlinePosition, outlineWidth: YD.outlineWidth, innerHaloWidth: YD.innerHaloWidth, outerHaloWidth: YD.outerHaloWidth }, this._shadeTexChanged = !0, this._texelData = new Uint8Array(4 * wq), this._minMaxDistance = [0, 0]; + } + setHighlightOptions(e) { + const i = this._convertedHighlightOptions; + hnr(e, i); + const r = i.outlinePosition - i.outlineWidth / 2 - i.outerHaloWidth, n = i.outlinePosition - i.outlineWidth / 2, s = i.outlinePosition + i.outlineWidth / 2, o = i.outlinePosition + i.outlineWidth / 2 + i.innerHaloWidth, a = Math.sqrt(Math.PI / 2) * XMe, l = Math.abs(r) > a ? Math.round(10 * (Math.abs(r) - a)) / 10 : 0, c = Math.abs(o) > a ? Math.round(10 * (Math.abs(o) - a)) / 10 : 0; + let h; + l && !c ? a2e.error("The outer rim of the highlight is " + l + "px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards).") : !l && c ? a2e.error("The inner rim of the highlight is " + c + "px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards).") : l && c && a2e.error("The highlight is " + Math.max(l, c) + "px away from the edge of the feature; consider reducing some width values."); + const p = [void 0, void 0, void 0, void 0]; + function y(x, I, P) { + p[0] = (1 - P) * x[0] + P * I[0], p[1] = (1 - P) * x[1] + P * I[1], p[2] = (1 - P) * x[2] + P * I[2], p[3] = (1 - P) * x[3] + P * I[3]; + } + const { _texelData: v } = this; + for (let x = 0; x < wq; ++x) + h = r + x / (wq - 1) * (o - r), h < r ? (p[4 * x + 0] = 0, p[4 * x + 1] = 0, p[4 * x + 2] = 0, p[4 * x + 3] = 0) : h < n ? y(dnr, i.outlineColor, (h - r) / (n - r)) : h < s ? [p[0], p[1], p[2], p[3]] = i.outlineColor : h < o ? y(i.outlineColor, i.fillColor, (h - s) / (o - s)) : [p[4 * x + 0], p[4 * x + 1], p[4 * x + 2], p[4 * x + 3]] = i.fillColor, v[4 * x + 0] = 255 * p[0], v[4 * x + 1] = 255 * p[1], v[4 * x + 2] = 255 * p[2], v[4 * x + 3] = 255 * p[3]; + this._minMaxDistance[0] = r, this._minMaxDistance[1] = o, this._shadeTexChanged = !0; + } + applyHighlightOptions(e, i) { + this._shadeTex || (this._shadeTex = new Ts(e, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, width: wq, height: 1, samplingMode: _n.LINEAR })), this._shadeTexChanged && (this._shadeTex.updateData(0, 0, 0, wq, 1, this._texelData), this._shadeTexChanged = !1), e.bindTexture(this._shadeTex, VAt), i.setUniform2fv("u_minMaxDistance", this._minMaxDistance); + } + destroy() { + this._shadeTex?.dispose(), this._shadeTex = null; + } +}, rz = class extends pC { + constructor() { + super(...arguments), this._childrenSet = /* @__PURE__ */ new Set(), this._needsSort = !1, this.children = [], this._effectView = null, this._highlightOptions = null, this._highlightGradient = null; + } + get blendMode() { + return this._blendMode; + } + set blendMode(e) { + this._blendMode = e, this.requestRender(); + } + get clips() { + return this._clips; + } + set clips(e) { + this._clips = e, this.children.forEach((i) => i.clips = e); + } + get computedEffects() { + return this._effectView?.effects ?? null; + } + get effect() { + return this._effectView?.effect ?? ""; + } + set effect(e) { + (this._effectView || e) && (this._effectView || (this._effectView = new Uw()), this._effectView.effect = e, this.requestRender()); + } + get highlightOptions() { + return this._highlightOptions; + } + set highlightOptions(e) { + if (!e) + return this._highlightOptions = null, void (this._highlightGradient && (this._highlightGradient.destroy(), this._highlightGradient = null, this.requestRender())); + this._highlightOptions && this._highlightOptions.equals(e) || (this._highlightOptions = e, this._highlightGradient || (this._highlightGradient = new pnr()), this._highlightGradient.setHighlightOptions(e), this.requestRender()); + } + updateTransitionProperties(e, i) { + super.updateTransitionProperties(e, i), this._effectView && (this._effectView.transitionStep(e, i), this._effectView.transitioning && this.requestRender()); + } + doRender(e) { + const i = this.createRenderParams(e); + this.renderChildren(i); + } + addChild(e) { + return this.addChildAt(e, this.children.length); + } + addChildAt(e, i = this.children.length) { + if (!e || this.contains(e)) + return e; + this._needsSort = !0; + const r = e.parent; + return r && r !== this && r.removeChild(e), i >= this.children.length ? this.children.push(e) : this.children.splice(i, 0, e), this._childrenSet.add(e), e.parent = this, e.stage = this.stage, this !== this.stage && (e.clips = this.clips), this.requestRender(), e; + } + contains(e) { + return this._childrenSet.has(e); + } + endTransitions() { + super.endTransitions(), this._effectView && (this._effectView.endTransitions(), this.requestRender()); + } + removeAllChildren() { + this._childrenSet.clear(), this._needsSort = !0; + for (const e of this.children) + this !== this.stage && (e.clips = null), e.stage = null, e.parent = null; + this.children.length = 0; + } + removeChild(e) { + return this.contains(e) ? this.removeChildAt(this.children.indexOf(e)) : e; + } + removeChildAt(e) { + if (e < 0 || e >= this.children.length) + return null; + this._needsSort = !0; + const i = this.children.splice(e, 1)[0]; + return this._childrenSet.delete(i), this !== this.stage && (i.clips = null), i.stage = null, i.parent = null, i; + } + sortChildren(e) { + this._needsSort && (this.children.sort(e), this._needsSort = !1); + } + beforeRender(e) { + super.beforeRender(e); + for (const i of this.children) + i.beforeRender(e); + } + afterRender(e) { + super.afterRender(e); + for (const i of this.children) + i.afterRender(e); + } + _createTransforms() { + return { dvs: Ml() }; + } + onAttach() { + super.onAttach(); + const e = this.stage; + for (const i of this.children) + i.stage = e; + } + onDetach() { + super.onDetach(); + for (const e of this.children) + e.stage = null; + } + renderChildren(e) { + for (const i of this.children) + i.processRender(e); + } + createRenderParams(e) { + return { ...e, blendMode: this.blendMode, effects: this.computedEffects, globalOpacity: e.globalOpacity * this.computedOpacity, inFadeTransition: this.inFadeTransition, highlightGradient: this._highlightGradient || e.highlightGradient }; + } +}, xE = class PMt { + constructor(e) { + if (this.next = null, !Array.isArray(e)) + return void (this.data = e); + this.data = e[0]; + let i = this; + for (let r = 1; r < e.length; r++) + i.next = new PMt([e[r]]), i = i.next; + } + *values() { + let e = this; + for (; e; ) + yield e.data, e = e.next; + } + forEach(e) { + let i = this; + for (; i; ) + e(i.data), i = i.next; + } + find(e) { + return e(this.data) ? this : this.next?.find(e); + } + max(e, i = this) { + const r = e(this.data) > e(i.data) ? this : i; + return this.next ? this.next.max(e, r) : r; + } + remove(e, i = null) { + return this === e ? i ? (i.next = this.next, i) : this.next : this.next?.remove(e, this) ?? null; + } + get last() { + return this.next ? this.next.last : this; + } +}, OMt = class { + constructor(e) { + this._head = null, ut(e) || (this._head = new xE(e)); + } + get head() { + return this._head; + } + maxAvailableSpace() { + if (ut(this._head)) + return 0; + const e = this._head.max((i) => i.end - i.start); + return e.data.end - e.data.start; + } + firstFit(e) { + if (ut(this._head)) + return null; + let i = null, r = this._head; + for (; r; ) { + const n = r.data.end - r.data.start; + if (n === e) + return i ? i.next = r.next : this._head = r.next, r.data.start; + if (n > e) { + const s = r.data.start; + return r.data.start += e, s; + } + i = r, r = r.next; + } + return null; + } + free(e, i) { + const r = e + i; + if (ut(this._head)) { + const a = new xE({ start: e, end: r }); + return void (this._head = a); + } + if (r <= this._head.data.start) { + if (r === this._head.data.start) + return void (this._head.data.start -= i); + const a = new xE({ start: e, end: r }); + return a.next = this._head, void (this._head = a); + } + let n = this._head, s = n.next; + for (; s; ) { + if (s.data.start >= r) { + if (n.data.end === e) { + if (n.data.end += i, n.data.end === s.data.start) { + const l = s.data.end - s.data.start; + return n.data.end += l, void (n.next = s.next); + } + return; + } + if (s.data.start === r) + return void (s.data.start -= i); + const a = new xE({ start: e, end: r }); + return a.next = n.next, void (n.next = a); + } + n = s, s = s.next; + } + if (e === n.data.end) + return void (n.data.end += i); + const o = new xE({ start: e, end: r }); + n.next = o; + } +}; +const Krt = Vi("esri-2d-log-allocations"); +let fnr = class KMe { + constructor(e, i) { + this._array = e, this._pool = i; + } + get array() { + return this._array; + } + get length() { + return this._array.length; + } + static create(e, i) { + const r = i.acquire(e); + return new KMe(r, i); + } + expand(e) { + const i = this._pool.acquire(e); + i.set(this._array), this._pool.release(this._array), this._array = i; + } + destroy() { + this._pool.release(this._array); + } + set(e, i) { + this._array.set(e._array, i); + } + slice() { + const e = this._pool.acquire(this._array.byteLength); + return e.set(this._array), new KMe(e, this._pool); + } +}, l2e = class RMt { + constructor() { + this._data = new ArrayBuffer(RMt.BYTE_LENGTH), this._freeList = new OMt({ start: 0, end: this._data.byteLength }); + } + static get BYTE_LENGTH() { + return 64e6; + } + get buffer() { + return this._data; + } + allocate(e) { + const i = this._freeList.firstFit(e); + return ut(i) ? null : new Uint32Array(this._data, i, e / Uint32Array.BYTES_PER_ELEMENT); + } + free(e) { + this._freeList.free(e.byteOffset, e.byteLength); + } +}, mnr = class { + constructor() { + this._bytesAllocated = 0, this._pages = [], this._pagesByBuffer = /* @__PURE__ */ new Map(), this._addPage(); + } + destroy() { + this._pages = [], this._pagesByBuffer = null; + } + get _bytesTotal() { + return this._pages.length * l2e.BYTE_LENGTH; + } + acquire(e) { + if (this._bytesAllocated += e, Krt && console.log(`Allocating ${e}, (${this._bytesAllocated} / ${this._bytesTotal})`), e > l2e.BYTE_LENGTH) + return new Uint32Array(e / Uint32Array.BYTES_PER_ELEMENT); + for (const i of this._pages) { + const r = i.allocate(e); + if (_e(r)) + return r; + } + return Ru(this._addPage().allocate(e), "Expected to allocate page"); + } + release(e) { + this._bytesAllocated -= e.byteLength, Krt && console.log(`Freeing ${e.byteLength}, (${this._bytesAllocated} / ${this._bytesTotal})`); + const i = this._pagesByBuffer.get(e.buffer); + i && i.free(e); + } + _addPage() { + const e = new l2e(); + return this._pages.push(e), this._pagesByBuffer.set(e.buffer, e), e; + } +}, kx = class { + constructor(e, i) { + this._rctx = e, this._vertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Uint16Array(i)), this._vao = new Ac(e, /* @__PURE__ */ new Map([["a_position", 0]]), { geometry: [new ea("a_position", 2, Fi.SHORT, 0, 4)] }, { geometry: this._vertexBuffer }), this._count = i.length / 2; + } + bind() { + this._rctx.bindVAO(this._vao); + } + unbind() { + this._rctx.bindVAO(null); + } + dispose() { + this._vao.dispose(!1), this._vertexBuffer.dispose(); + } + draw() { + this._rctx.bindVAO(this._vao), this._rctx.drawArrays(ps.TRIANGLE_STRIP, 0, this._count); + } +}, A1 = class { + constructor() { + this.name = this.constructor.name || "UnnamedBrush", this.brushEffect = null; + } + prepareState(e, i) { + } + draw(e, i, r) { + } + drawMany(e, i, r) { + for (const n of i) + n.visible && this.draw(e, n, r); + } +}; +const u2e = { nearest: { defines: [], samplingMode: _n.NEAREST, mips: !1 }, bilinear: { defines: [], samplingMode: _n.LINEAR, mips: !1 }, bicubic: { defines: ["bicubic"], samplingMode: _n.LINEAR, mips: !1 }, trilinear: { defines: [], samplingMode: _n.LINEAR_MIPMAP_LINEAR, mips: !0 } }, gnr = (t, e, i) => { + if (i.samplingMode === "dynamic") { + const { state: r } = t, n = e.resolution / e.pixelRatio / r.resolution, s = Math.round(t.pixelRatio) !== t.pixelRatio, o = n > 1.05 || n < 0.95; + return r.rotation || o || s || e.isSourceScaled || e.rotation ? u2e.bilinear : u2e.nearest; + } + return u2e[i.samplingMode]; +}; +let ynr = class extends A1 { + constructor() { + super(...arguments), this._desc = { vsPath: "raster/bitmap", fsPath: "raster/bitmap", attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }; + } + dispose() { + this._quad && this._quad.dispose(); + } + prepareState({ context: e }) { + e.setBlendingEnabled(!0), e.setColorMask(!0, !0, !0, !0), e.setStencilWriteMask(0), e.setStencilTestEnabled(!0); + } + draw(e, i) { + const { context: r, renderingOptions: n, painter: s, requestRender: o, allowDelayedRender: a } = e; + if (!i.source || !i.isReady) + return; + const l = gnr(e, i, n), c = s.materialManager.getProgram(this._desc, l.defines); + if (a && _e(o) && !c.compiled) + return void o(); + e.timeline.begin(this.name), i.blendFunction === "additive" ? r.setBlendFunctionSeparate(gn.ONE, gn.ONE, gn.ONE, gn.ONE) : r.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), r.setStencilFunction(Ll.EQUAL, i.stencilRef, 255), this._quad || (this._quad = new kx(r, [0, 0, 1, 0, 0, 1, 1, 1])); + const { coordScale: h, computedOpacity: p, transforms: y } = i; + i.setSamplingProfile(l), i.bind(e.context, lfe), r.useProgram(c), c.setUniformMatrix3fv("u_dvsMat3", y.dvs), c.setUniform1i("u_texture", lfe), c.setUniform2fv("u_coordScale", h), c.setUniform1f("u_opacity", p), this._quad.draw(), e.timeline.end(this.name); + } +}; +function MMt() { + return new Float32Array(4); +} +function vnr(t) { + const e = new Float32Array(4); + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; +} +function HI(t, e, i, r) { + const n = new Float32Array(4); + return n[0] = t, n[1] = e, n[2] = i, n[3] = r, n; +} +function _nr(t, e) { + return new Float32Array(t, e, 4); +} +function DMt() { + return MMt(); +} +function FMt() { + return HI(1, 1, 1, 1); +} +function LMt() { + return HI(1, 0, 0, 0); +} +function NMt() { + return HI(0, 1, 0, 0); +} +function kMt() { + return HI(0, 0, 1, 0); +} +function $Mt() { + return HI(0, 0, 0, 1); +} +const bnr = DMt(), wnr = FMt(), xnr = LMt(), Snr = NMt(), Cnr = kMt(), Tnr = $Mt(); +Object.freeze(Object.defineProperty({ __proto__: null, ONES: wnr, UNIT_W: Tnr, UNIT_X: xnr, UNIT_Y: Snr, UNIT_Z: Cnr, ZEROS: bnr, clone: vnr, create: MMt, createView: _nr, fromValues: HI, ones: FMt, unitW: $Mt, unitX: LMt, unitY: NMt, unitZ: kMt, zeros: DMt }, Symbol.toStringTag, { value: "Module" })); +const Enr = { background: { "background.frag": `uniform lowp vec4 u_color; +void main() { +gl_FragColor = u_color; +}`, "background.vert": `attribute vec2 a_pos; +uniform highp mat3 u_dvsMat3; +uniform mediump vec2 u_coord_range; +uniform mediump float u_depth; +void main() { +vec3 v_pos = u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0); +gl_Position = vec4(v_pos.xy, 0.0, 1.0); +}` }, bitBlit: { "bitBlit.frag": `uniform lowp sampler2D u_tex; +uniform lowp float u_opacity; +varying mediump vec2 v_uv; +void main() { +lowp vec4 color = texture2D(u_tex, v_uv); +gl_FragColor = color * u_opacity; +}`, "bitBlit.vert": `attribute vec2 a_pos; +attribute vec2 a_tex; +varying mediump vec2 v_uv; +void main(void) { +gl_Position = vec4(a_pos, 0.0, 1.0); +v_uv = a_tex; +}` }, blend: { "blend.frag": `precision mediump float; +uniform sampler2D u_layerTexture; +uniform lowp float u_opacity; +uniform lowp float u_inFadeOpacity; +#ifndef NORMAL +uniform sampler2D u_backbufferTexture; +#endif +varying mediump vec2 v_uv; +float rgb2v(in vec3 c) { +return max(c.x, max(c.y, c.z)); +} +vec3 rgb2hsv(in vec3 c) { +vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); +vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); +vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); +float d = q.x - min(q.w, q.y); +float e = 1.0e-10; +return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x); +} +vec3 hsv2rgb(in vec3 c) { +vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); +vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); +return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} +vec3 tint(in vec3 Cb, in vec3 Cs) { +float vIn = rgb2v(Cb); +vec3 hsvTint = rgb2hsv(Cs); +vec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z); +return hsv2rgb(hsvOut); +} +float overlay(in float Cb, in float Cs) { +return (1.0 - step(0.5, Cs)) * (1.0 - 2.0 * (1.0 - Cs ) * (1.0 - Cb)) + step(0.5, Cs) * (2.0 * Cs * Cb); +} +float colorDodge(in float Cb, in float Cs) { +return (Cb == 0.0) ? 0.0 : (Cs == 1.0) ? 1.0 : min(1.0, Cb / (1.0 - Cs)); +} +float colorBurn(in float Cb, in float Cs) { +return (Cb == 1.0) ? 1.0 : (Cs == 0.0) ? 0.0 : 1.0 - min(1.0, (1.0 - Cb) / Cs); +} +float hardLight(in float Cb, in float Cs) { +return (1.0 - step(0.5, Cs)) * (2.0 * Cs * Cb) + step(0.5, Cs) * (1.0 - 2.0 * (1.0 - Cs) * (1.0 - Cb)); +} +float reflectBlend(in float Cb, in float Cs) { +return (Cs == 1.0) ? Cs : min(Cb * Cb / (1.0 - Cs), 1.0); +} +float softLight(in float Cb, in float Cs) { +if (Cs <= 0.5) { +return Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb); +} +if (Cb <= 0.25) { +return Cb + (2.0 * Cs - 1.0) * Cb * ((16.0 * Cb - 12.0) * Cb + 3.0); +} +return Cb + (2.0 * Cs - 1.0) * (sqrt(Cb) - Cb); +} +float vividLight(in float Cb, in float Cs) { +return (1.0 - step(0.5, Cs)) * colorBurn(Cb, 2.0 * Cs) + step(0.5, Cs) * colorDodge(Cb, (2.0 * (Cs - 0.5))); +} +float minv3(in vec3 c) { +return min(min(c.r, c.g), c.b); +} +float maxv3(in vec3 c) { +return max(max(c.r, c.g), c.b); +} +float lumv3(in vec3 c) { +return dot(c, vec3(0.3, 0.59, 0.11)); +} +float satv3(vec3 c) { +return maxv3(c) - minv3(c); +} +vec3 clipColor(vec3 color) { +float lum = lumv3(color); +float mincol = minv3(color); +float maxcol = maxv3(color); +if (mincol < 0.0) { +color = lum + ((color - lum) * lum) / (lum - mincol); +} +if (maxcol > 1.0) { +color = lum + ((color - lum) * (1.0 - lum)) / (maxcol - lum); +} +return color; +} +vec3 setLum(vec3 cbase, vec3 clum) { +float lbase = lumv3(cbase); +float llum = lumv3(clum); +float ldiff = llum - lbase; +vec3 color = cbase + vec3(ldiff); +return clipColor(color); +} +vec3 setLumSat(vec3 cbase, vec3 csat, vec3 clum) +{ +float minbase = minv3(cbase); +float sbase = satv3(cbase); +float ssat = satv3(csat); +vec3 color; +if (sbase > 0.0) { +color = (cbase - minbase) * ssat / sbase; +} else { +color = vec3(0.0); +} +return setLum(color, clum); +} +void main() { +vec4 src = texture2D(u_layerTexture, v_uv); +#ifdef NORMAL +gl_FragColor = src * u_opacity; +#else +vec4 dst = texture2D(u_backbufferTexture, v_uv); +vec3 Cs = src.a == 0.0 ? src.rgb : vec3(src.rgb / src.a); +vec3 Cb = dst.a == 0.0 ? dst.rgb : vec3(dst.rgb / dst.a); +float as = u_opacity * src.a; +float ab = dst.a; +#ifdef DESTINATION_OVER +gl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb, as + ab - as * ab); +#endif +#ifdef SOURCE_IN +vec4 color = vec4(as * Cs * ab, as * ab); +vec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab); +gl_FragColor = color + fadeColor; +#endif +#ifdef DESTINATION_IN +vec4 color = vec4(ab * Cb * as, ab * as); +vec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab); +gl_FragColor = color + fadeColor; +#endif +#ifdef SOURCE_OUT +gl_FragColor = vec4(as * Cs * (1.0 - ab), as * (1.0 - ab)); +#endif +#ifdef DESTINATION_OUT +gl_FragColor = vec4(ab * Cb * (1.0 - as), ab * (1.0 - as)); +#endif +#ifdef SOURCE_ATOP +gl_FragColor = vec4(as * Cs * ab + ab * Cb * (1.0 - as), ab); +#endif +#ifdef DESTINATION_ATOP +gl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * as, as); +#endif +#ifdef XOR +gl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * (1.0 - as), +as * (1.0 - ab) + ab * (1.0 - as)); +#endif +#ifdef MULTIPLY +gl_FragColor = vec4(as * Cs * ab * Cb + (1.0 - ab) * as * Cs + (1.0 - as) * ab * Cb, +as + ab * (1.0 - as)); +#endif +#ifdef SCREEN +gl_FragColor = vec4((Cs + Cb - Cs * Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef OVERLAY +vec3 f = vec3(overlay(Cb.r, Cs.r), overlay(Cb.g, Cs.g), overlay(Cb.b, Cs.b)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef DARKEN +gl_FragColor = vec4(min(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef LIGHTER +gl_FragColor = vec4(as * Cs + ab * Cb, as + ab); +#endif +#ifdef LIGHTEN +gl_FragColor = vec4(max(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef COLOR_DODGE +vec3 f = clamp(vec3(colorDodge(Cb.r, Cs.r), colorDodge(Cb.g, Cs.g), colorDodge(Cb.b, Cs.b)), vec3(0.0), vec3(1.0)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef COLOR_BURN +vec3 f = vec3(colorBurn(Cb.r, Cs.r), colorBurn(Cb.g, Cs.g), colorBurn(Cb.b, Cs.b)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef HARD_LIGHT +vec3 f = vec3(hardLight(Cb.r, Cs.r), hardLight(Cb.g, Cs.g), hardLight(Cb.b, Cs.b)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef SOFT_LIGHT +vec3 f = vec3(softLight(Cb.r, Cs.r), softLight(Cb.g, Cs.g), softLight(Cb.b, Cs.b)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef DIFFERENCE +gl_FragColor = vec4(abs(Cb - Cs) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef EXCLUSION +vec3 f = Cs + Cb - 2.0 * Cs * Cb; +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef INVERT +gl_FragColor = vec4((1.0 - Cb) * as * ab + Cb * ab * (1.0 - as), ab); +#endif +#ifdef VIVID_LIGHT +vec3 f = vec3(clamp(vividLight(Cb.r, Cs.r), 0.0, 1.0), +clamp(vividLight(Cb.g, Cs.g), 0.0, 1.0), +clamp(vividLight(Cb.b, Cs.b), 0.0, 1.0)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef HUE +vec3 f = setLumSat(Cs,Cb,Cb); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef SATURATION +vec3 f = setLumSat(Cb,Cs,Cb); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef COLOR +vec3 f = setLum(Cs,Cb); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef LUMINOSITY +vec3 f = setLum(Cb,Cs); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef PLUS +gl_FragColor = clamp(vec4(src.r + Cb.r, src.g + Cb.g, src.b + Cb.b, as + ab), 0.0, 1.0); +#endif +#ifdef MINUS +gl_FragColor = vec4(clamp(vec3(Cb.r - src.r, Cb.g - src.g, Cb.b - src.b), 0.0, 1.0), ab * as); +#endif +#ifdef AVERAGE +vec3 f = (Cb + Cs) / 2.0; +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#ifdef REFLECT +vec3 f = clamp(vec3(reflectBlend(Cb.r, Cs.r), +reflectBlend(Cb.g, Cs.g), +reflectBlend(Cb.b, Cs.b)), vec3(0.0), vec3(1.0)); +gl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as), +as + ab * (1.0 - as)); +#endif +#endif +}`, "blend.vert": `attribute vec2 a_position; +varying mediump vec2 v_uv; +void main(void) { +gl_Position = vec4(a_position , 0.0, 1.0); +v_uv = (a_position + 1.0) / 2.0; +}` }, debug: { overlay: { "overlay.frag": `precision mediump float; +varying vec4 v_color; +void main(void) { +gl_FragColor = v_color; +}`, "overlay.vert": `attribute vec3 a_PositionAndFlags; +uniform mat3 u_dvsMat3; +uniform vec4 u_colors[4]; +uniform float u_opacities[4]; +varying vec4 v_color; +void main(void) { +vec2 position = a_PositionAndFlags.xy; +float flags = a_PositionAndFlags.z; +int colorIndex = int(mod(flags, 4.0)); +vec4 color; +for (int i = 0; i < 4; i++) { +color = u_colors[i]; +if (i == colorIndex) { +break; +} +} +int opacityIndex = int(mod(floor(flags / 4.0), 4.0)); +float opacity; +for (int i = 0; i < 4; i++) { +opacity = u_opacities[i]; +if (i == opacityIndex) { +break; +} +} +v_color = color * opacity; +gl_Position = vec4((u_dvsMat3 * vec3(position, 1.0)).xy, 0.0, 1.0); +}` } }, dot: { dot: { "dot.frag": `precision mediump float; +varying vec4 v_color; +varying float v_dotRatio; +varying float v_invEdgeRatio; +uniform highp float u_tileZoomFactor; +void main() +{ +float dist = length(gl_PointCoord - vec2(.5, .5)) * 2.; +float alpha = smoothstep(0., 1., v_invEdgeRatio * (dist - v_dotRatio) + 1.); +gl_FragColor = v_color * alpha; +}`, "dot.vert": `precision highp float; +attribute vec2 a_pos; +uniform sampler2D u_texture; +uniform highp mat3 u_dvsMat3; +uniform highp float u_tileZoomFactor; +uniform highp float u_dotSize; +uniform highp float u_pixelRatio; +varying vec2 v_pos; +varying vec4 v_color; +varying float v_dotRatio; +varying float v_invEdgeRatio; +const float EPSILON = 0.000001; +void main() +{ +mat3 tileToTileTexture = mat3( 1., 0., 0., +0., -1., 0., +0., 1., 1. ); +vec3 texCoords = tileToTileTexture * vec3(a_pos.xy / 512., 1.); +v_color = texture2D(u_texture, texCoords.xy); +float smoothEdgeWidth = max(u_dotSize / 2., 1.) ; +float z = 0.; +z += 2.0 * step(v_color.a, EPSILON); +gl_PointSize = (smoothEdgeWidth + u_dotSize); +gl_Position = vec4((u_dvsMat3 * vec3(a_pos + .5, 1.)).xy, z, 1.); +v_dotRatio = u_dotSize / gl_PointSize; +v_invEdgeRatio = -1. / ( smoothEdgeWidth / gl_PointSize ); +gl_PointSize *= (u_pixelRatio * u_tileZoomFactor); +}` } }, filtering: { "bicubic.glsl": `vec4 computeWeights(float v) { +float b = 1.0 / 6.0; +float v2 = v * v; +float v3 = v2 * v; +float w0 = b * (-v3 + 3.0 * v2 - 3.0 * v + 1.0); +float w1 = b * (3.0 * v3 - 6.0 * v2 + 4.0); +float w2 = b * (-3.0 * v3 + 3.0 * v2 + 3.0 * v + 1.0); +float w3 = b * v3; +return vec4(w0, w1, w2, w3); +} +vec4 bicubicOffsetsAndWeights(float v) { +vec4 w = computeWeights(v); +float g0 = w.x + w.y; +float g1 = w.z + w.w; +float h0 = 1.0 - (w.y / g0) + v; +float h1 = 1.0 + (w.w / g1) - v; +return vec4(h0, h1, g0, g1); +} +vec4 sampleBicubicBSpline(sampler2D sampler, vec2 coords, vec2 texSize) { +vec2 eX = vec2(1.0 / texSize.x, 0.0); +vec2 eY = vec2(0.0, 1.0 / texSize.y); +vec2 texel = coords * texSize - 0.5; +vec3 hgX = bicubicOffsetsAndWeights(fract(texel).x).xyz; +vec3 hgY = bicubicOffsetsAndWeights(fract(texel).y).xyz; +vec2 coords10 = coords + hgX.x * eX; +vec2 coords00 = coords - hgX.y * eX; +vec2 coords11 = coords10 + hgY.x * eY; +vec2 coords01 = coords00 + hgY.x * eY; +coords10 = coords10 - hgY.y * eY; +coords00 = coords00 - hgY.y * eY; +vec4 color00 = texture2D(sampler, coords00); +vec4 color10 = texture2D(sampler, coords10); +vec4 color01 = texture2D(sampler, coords01); +vec4 color11 = texture2D(sampler, coords11); +color00 = mix(color00, color01, hgY.z); +color10 = mix(color10, color11, hgY.z); +color00 = mix(color00, color10, hgX.z); +return color00; +}`, "bilinear.glsl": `vec4 sampleBilinear(sampler2D sampler, vec2 coords, vec2 texSize) { +vec2 texelStart = floor(coords * texSize); +vec2 coord0 = texelStart / texSize; +vec2 coord1 = (texelStart + vec2(1.0, 0.0)) / texSize; +vec2 coord2 = (texelStart + vec2(0.0, 1.0)) / texSize; +vec2 coord3 = (texelStart + vec2(1.0, 1.0)) / texSize; +vec4 color0 = texture2D(sampler, coord0); +vec4 color1 = texture2D(sampler, coord1); +vec4 color2 = texture2D(sampler, coord2); +vec4 color3 = texture2D(sampler, coord3); +vec2 blend = fract(coords * texSize); +vec4 color01 = mix(color0, color1, blend.x); +vec4 color23 = mix(color2, color3, blend.x); +vec4 color = mix(color01, color23, blend.y); +#ifdef NNEDGE +float alpha = floor(color0.a * color1.a * color2.a * color3.a + 0.5); +color = color * alpha + (1.0 - alpha) * texture2D(sampler, coords); +#endif +return color; +}`, "epx.glsl": `vec4 sampleEPX(sampler2D sampler, float size, vec2 coords, vec2 texSize) { +vec2 invSize = 1.0 / texSize; +vec2 texel = coords * texSize; +vec2 texel_i = floor(texel); +vec2 texel_frac = fract(texel); +vec4 colorP = texture2D(sampler, texel_i * invSize); +vec4 colorP1 = vec4(colorP); +vec4 colorP2 = vec4(colorP); +vec4 colorP3 = vec4(colorP); +vec4 colorP4 = vec4(colorP); +vec4 colorA = texture2D(sampler, (texel_i - vec2(0.0, 1.0)) * invSize); +vec4 colorB = texture2D(sampler, (texel_i + vec2(1.0, 0.0)) * invSize); +vec4 colorC = texture2D(sampler, (texel_i - vec2(1.0, 0.0)) * invSize); +vec4 colorD = texture2D(sampler, (texel_i + vec2(0.0, 1.0)) * invSize); +if (colorC == colorA && colorC != colorD && colorA != colorB) { +colorP1 = colorA; +} +if (colorA == colorB && colorA != colorC && colorB != colorD) { +colorP2 = colorB; +} +if (colorD == colorC && colorD != colorB && colorC != colorA) { +colorP3 = colorC; +} +if (colorB == colorD && colorB != colorA && colorD != colorC) { +colorP4 = colorD; +} +vec4 colorP12 = mix(colorP1, colorP2, texel_frac.x); +vec4 colorP34 = mix(colorP1, colorP2, texel_frac.x); +return mix(colorP12, colorP34, texel_frac.y); +}` }, fx: { integrate: { "integrate.frag": `precision mediump float; +uniform lowp sampler2D u_sourceTexture; +uniform lowp sampler2D u_maskTexture; +uniform mediump float u_zoomLevel; +uniform highp float u_timeDelta; +uniform highp float u_animationTime; +varying highp vec2 v_texcoord; +#include +void main() +{ +#ifdef DELTA +vec4 texel = texture2D(u_sourceTexture, v_texcoord); +vec4 data0 = texture2D(u_maskTexture, v_texcoord); +float flags = data0.r * 255.0; +float groupMinZoom = data0.g * 255.0; +float isVisible = getFilterBit(flags, 0); +float wouldClip = step(groupMinZoom, u_zoomLevel); +float direction = wouldClip * 1.0 + (1.0 - wouldClip) * -1.0; +float dt = u_timeDelta / max(u_animationTime, 0.0001); +vec4 nextState = vec4(texel + direction * dt); +gl_FragColor = vec4(nextState); +#elif defined(UPDATE) +vec4 texel = texture2D(u_sourceTexture, v_texcoord); +gl_FragColor = texel; +#endif +}`, "integrate.vert": `precision mediump float; +attribute vec2 a_pos; +varying highp vec2 v_texcoord; +void main() +{ +v_texcoord = a_pos; +gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0); +}` } }, heatmap: { heatmapResolve: { "heatmapResolve.frag": `precision highp float; +#ifdef HEATMAP_PRECISION_HALF_FLOAT +#define COMPRESSION_FACTOR 4.0 +#else +#define COMPRESSION_FACTOR 1.0 +#endif +uniform sampler2D u_texture; +uniform sampler2D u_gradient; +uniform vec2 u_densityMinAndInvRange; +uniform float u_densityNormalization; +varying vec2 v_uv; +void main() { +vec4 data = texture2D(u_texture, v_uv); +float density = data.r * COMPRESSION_FACTOR; +density *= u_densityNormalization; +density = (density - u_densityMinAndInvRange.x) * u_densityMinAndInvRange.y; +vec4 color = texture2D(u_gradient, vec2(density, 0.5)); +gl_FragColor = vec4(color.rgb * color.a, color.a); +}`, "heatmapResolve.vert": `precision highp float; +attribute vec2 a_pos; +varying vec2 v_uv; +void main() { +v_uv = a_pos; +gl_Position = vec4(a_pos * 2.0 - 1.0, 1., 1.); +}` } }, highlight: { "blur.frag": `varying mediump vec2 v_texcoord; +uniform mediump vec4 u_direction; +uniform mediump mat4 u_channelSelector; +uniform mediump float u_sigma; +uniform sampler2D u_texture; +mediump float gauss1(mediump vec2 dir) { +return exp(-dot(dir, dir) / (2.0 * u_sigma * u_sigma)); +} +mediump vec4 selectChannel(mediump vec4 sample) { +return u_channelSelector * sample; +} +void accumGauss1(mediump float i, inout mediump float tot, inout mediump float weight) { +mediump float w = gauss1(i * u_direction.xy); +tot += selectChannel(texture2D(u_texture, v_texcoord + i * u_direction.zw))[3] * w; +weight += w; +} +void main(void) { +mediump float tot = 0.0; +mediump float weight = 0.0; +accumGauss1(-5.0, tot, weight); +accumGauss1(-4.0, tot, weight); +accumGauss1(-3.0, tot, weight); +accumGauss1(-2.0, tot, weight); +accumGauss1(-1.0, tot, weight); +accumGauss1(0.0, tot, weight); +accumGauss1(1.0, tot, weight); +accumGauss1(2.0, tot, weight); +accumGauss1(3.0, tot, weight); +accumGauss1(4.0, tot, weight); +accumGauss1(5.0, tot, weight); +gl_FragColor = vec4(0.0, 0.0, 0.0, tot / weight); +}`, "highlight.frag": `varying mediump vec2 v_texcoord; +uniform sampler2D u_texture; +uniform mediump float u_sigma; +uniform sampler2D u_shade; +uniform mediump vec2 u_minMaxDistance; +mediump float estimateDistance() { +mediump float y = texture2D(u_texture, v_texcoord)[3]; +const mediump float y0 = 0.5; +mediump float m0 = 1.0 / (sqrt(2.0 * 3.1415) * u_sigma); +mediump float d = (y - y0) / m0; +return d; +} +mediump vec4 shade(mediump float d) { +mediump float mappedDistance = (d - u_minMaxDistance.x) / (u_minMaxDistance.y - u_minMaxDistance.x); +mappedDistance = clamp(mappedDistance, 0.0, 1.0); +return texture2D(u_shade, vec2(mappedDistance, 0.5)); +} +void main(void) { +mediump float d = estimateDistance(); +gl_FragColor = shade(d); +}`, "textured.vert": `attribute mediump vec2 a_position; +attribute mediump vec2 a_texcoord; +varying mediump vec2 v_texcoord; +void main(void) { +gl_Position = vec4(a_position, 0.0, 1.0); +v_texcoord = a_texcoord; +}` }, magnifier: { "magnifier.frag": `uniform lowp vec4 u_background; +uniform mediump sampler2D u_readbackTexture; +uniform mediump sampler2D u_maskTexture; +uniform mediump sampler2D u_overlayTexture; +uniform bool u_maskEnabled; +uniform bool u_overlayEnabled; +varying mediump vec2 v_texCoord; +const lowp float barrelFactor = 1.1; +lowp vec2 barrel(lowp vec2 uv) { +lowp vec2 uvn = uv * 2.0 - 1.0; +if (uvn.x == 0.0 && uvn.y == 0.0) { +return vec2(0.5, 0.5); +} +lowp float theta = atan(uvn.y, uvn.x); +lowp float r = pow(length(uvn), barrelFactor); +return r * vec2(cos(theta), sin(theta)) * 0.5 + 0.5; +} +void main(void) +{ +lowp vec4 color = texture2D(u_readbackTexture, barrel(v_texCoord)); +color = (color + (1.0 - color.a) * u_background); +lowp float mask = u_maskEnabled ? texture2D(u_maskTexture, v_texCoord).a : 1.0; +color *= mask; +lowp vec4 overlayColor = u_overlayEnabled ? texture2D(u_overlayTexture, v_texCoord) : vec4(0); +gl_FragColor = overlayColor + (1.0 - overlayColor.a) * color; +}`, "magnifier.vert": `precision mediump float; +attribute mediump vec2 a_pos; +uniform mediump vec4 u_drawPos; +varying mediump vec2 v_texCoord; +void main(void) +{ +v_texCoord = a_pos; +gl_Position = vec4(u_drawPos.xy + vec2(a_pos - 0.5) * u_drawPos.zw, 0.0, 1.0); +}` }, materials: { "attributeData.glsl": `uniform highp sampler2D u_attributeData0; +uniform highp sampler2D u_attributeData1; +uniform highp sampler2D u_attributeData2; +uniform highp sampler2D u_attributeData3; +uniform highp sampler2D u_attributeData4; +uniform highp sampler2D u_attributeData5; +uniform highp int u_attributeTextureSize; +highp vec2 getAttributeDataCoords(in highp vec3 id) { +highp vec3 texel = unpackDisplayIdTexel(id); +highp float size = float(u_attributeTextureSize); +highp float u32 = float(int(texel.r) + int(texel.g) * 256 + int(texel.b) * 256 * 256); +highp float col = mod(u32, size); +highp float row = (u32 - col) / size; +highp float u = col / size; +highp float v = row / size; +return vec2(u, v); +} +highp vec2 getAttributeDataTextureCoords(in highp vec3 id) { +return (getAttributeDataCoords(id) * 2.0) - 1.0 + (.5 / vec2(u_attributeTextureSize)); +} +highp vec4 getAttributeData0(in highp vec3 id) { +vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData0, coords); +} +highp vec4 getAttributeData1(in highp vec3 id) { +highp vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData1, coords); +} +highp vec4 getAttributeData2(in highp vec3 id) { +highp vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData2, coords); +} +highp vec4 getAttributeData3(in highp vec3 id) { +highp vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData3, coords); +} +highp vec4 getAttributeData4(in highp vec3 id) { +highp vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData4, coords); +} +highp vec4 getAttributeData5(in highp vec3 id) { +highp vec2 coords = getAttributeDataCoords(id); +return texture2D(u_attributeData5, coords); +} +float u88VVToFloat(in vec2 v) { +bool isMagic = v.x == 255.0 && v.y == 255.0; +if (isMagic) { +return NAN_MAGIC_NUMBER; +} +return (v.x + v.y * float(0x100)) - 32768.0; +}`, "barycentric.glsl": `float inTriangle(vec3 bary) { +vec3 absBary = abs(bary); +return step((absBary.x + absBary.y + absBary.z), 1.05); +} +vec3 xyToBarycentric(in vec2 pos, in vec2 v0, in vec2 v1, in vec2 v2) { +mat3 xyToBarycentricMat3 = mat3( +v1.x * v2.y - v2.x * v1.y, v2.x * v0.y - v0.x * v2.y, v0.x * v1.y - v1.x * v0.y, +v1.y - v2.y, v2.y - v0.y, v0.y - v1.y, +v2.x - v1.x, v0.x - v2.x, v1.x - v0.x +); +float A2 = v0.x * (v1.y - v2.y) + v1.x * (v2.y - v0.y) + v2.x * (v0.y - v1.y); +return (1. / A2) * xyToBarycentricMat3 * vec3(1., pos); +}`, "constants.glsl": `const float C_DEG_TO_RAD = 3.14159265359 / 180.0; +const float C_256_TO_RAD = 3.14159265359 / 128.0; +const float C_RAD_TO_DEG = 180.0 / 3.141592654; +const float POSITION_PRECISION = 1.0 / 8.0; +const float FILL_POSITION_PRECISION = 1.0 / 1.0; +const float SOFT_EDGE_RATIO = 1.0; +const float THIN_LINE_WIDTH_FACTOR = 1.1; +const float THIN_LINE_HALF_WIDTH = 1.0; +const float EXTRUDE_SCALE_PLACEMENT_PADDING = 1.0 / 4.0; +const float OFFSET_PRECISION = 1.0 / 8.0; +const float OUTLINE_SCALE = 1.0 / 5.0; +const float SDF_FONT_SIZE = 24.0; +const float MAX_SDF_DISTANCE = 8.0; +const float PLACEMENT_PADDING = 8.0; +const float EPSILON = 0.00001; +const float EPSILON_HITTEST = 0.05; +const int MAX_FILTER_COUNT = 2; +const int ATTR_VV_SIZE = 0; +const int ATTR_VV_COLOR = 1; +const int ATTR_VV_OPACITY = 2; +const int ATTR_VV_ROTATION = 3; +const highp float NAN_MAGIC_NUMBER = 1e-30; +const int BITSET_GENERIC_LOCK_COLOR = 1; +const int BITSET_GENERIC_CONSIDER_ALPHA_ONLY = 4; +const int BITSET_MARKER_ALIGNMENT_MAP = 0; +const int BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE = 2; +const int BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY = 3; +const int BITSET_TYPE_FILL_OUTLINE = 0; +const int BITSET_FILL_RANDOM_PATTERN_OFFSET = 2; +const int BITSET_FILL_HAS_UNRESOLVED_REPLACEMENT_COLOR = 3; +const int BITSET_LINE_SCALE_DASH = 2;`, fill: { "common.glsl": `#include +#ifdef PATTERN +uniform mediump vec2 u_mosaicSize; +varying mediump float v_sampleAlphaOnly; +#endif +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +uniform lowp vec4 u_isActive[ 2 ]; +uniform highp float u_dotValue; +uniform highp float u_tileDotsOverArea; +uniform highp float u_dotTextureDotCount; +uniform mediump float u_tileZoomFactor; +#endif +varying highp vec3 v_id; +varying lowp vec4 v_color; +varying lowp float v_opacity; +varying mediump vec4 v_aux1; +#ifdef PATTERN +varying mediump vec2 v_tileTextureCoord; +#endif +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +varying lowp float v_isOutline; +#endif +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +varying highp vec2 v_dotTextureCoords; +varying highp vec4 v_dotThresholds[ 2 ]; +#endif`, "fill.frag": `precision highp float; +#include +#include +#include +#ifdef PATTERN +uniform lowp sampler2D u_texture; +#endif +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +uniform mediump mat4 u_dotColors[ 2 ]; +uniform sampler2D u_dotTextures[ 2 ]; +uniform vec4 u_dotBackgroundColor; +#endif +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#include +#include +lowp vec4 drawLine() { +float v_lineWidth = v_aux1.x; +vec2 v_normal = v_aux1.yz; +LineData inputs = LineData( +v_color, +v_normal, +v_lineWidth, +v_opacity, +v_id +); +return shadeLine(inputs); +} +#endif +lowp vec4 drawFill() { +lowp vec4 out_color = vec4(0.); +#ifdef HITTEST +out_color = v_color; +#elif defined(PATTERN) +mediump vec4 v_tlbr = v_aux1; +mediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0); +mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); +lowp vec4 color = texture2D(u_texture, samplePos); +if (v_sampleAlphaOnly > 0.5) { +color.rgb = vec3(color.a); +} +out_color = v_opacity * v_color * color; +#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY && !defined(HIGHLIGHT) +vec4 textureThresholds0 = texture2D(u_dotTextures[0], v_dotTextureCoords); +vec4 textureThresholds1 = texture2D(u_dotTextures[1], v_dotTextureCoords); +vec4 difference0 = v_dotThresholds[0] - textureThresholds0; +vec4 difference1 = v_dotThresholds[1] - textureThresholds1; +#ifdef DD_DOT_BLENDING +vec4 isPositive0 = step(0.0, difference0); +vec4 isPositive1 = step(0.0, difference1); +float weightSum = dot(isPositive0, difference0) + dot(isPositive1, difference1); +float lessThanEqZero = step(weightSum, 0.0); +float greaterThanZero = 1.0 - lessThanEqZero ; +float divisor = (weightSum + lessThanEqZero); +vec4 weights0 = difference0 * isPositive0 / divisor; +vec4 weights1 = difference1 * isPositive1 / divisor; +vec4 dotColor = u_dotColors[0] * weights0 + u_dotColors[1] * weights1; +vec4 preEffectColor = greaterThanZero * dotColor + lessThanEqZero * u_dotBackgroundColor; +#else +float diffMax = max(max4(difference0), max4(difference1)); +float lessThanZero = step(diffMax, 0.0); +float greaterOrEqZero = 1.0 - lessThanZero; +vec4 isMax0 = step(diffMax, difference0); +vec4 isMax1 = step(diffMax, difference1); +vec4 dotColor = u_dotColors[0] * isMax0 + u_dotColors[1] * isMax1; +vec4 preEffectColor = greaterOrEqZero * dotColor + lessThanZero * u_dotBackgroundColor; +#endif +out_color = preEffectColor; +#else +out_color = v_opacity * v_color; +#endif +#ifdef HIGHLIGHT +out_color.a = 1.0; +#endif +return out_color; +} +void main() { +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +if (v_isOutline > 0.5) { +gl_FragColor = drawLine(); +} else { +gl_FragColor = drawFill(); +} +#else +gl_FragColor = drawFill(); +#endif +}`, "fill.vert": `#include +#define PACKED_LINE +precision highp float; +attribute float a_bitset; +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +attribute float a_inverseArea; +vec4 a_color = vec4(0.0, 0.0, 0.0, 1.0); +vec2 a_zoomRange = vec2(0.0, 10000.0); +#else +attribute vec4 a_color; +attribute vec4 a_aux2; +attribute vec4 a_aux3; +#ifndef SYMBOLOGY_TYPE_IS_SIMPLE_LIKE +attribute vec4 a_aux1; +attribute vec2 a_zoomRange; +#else +vec2 a_zoomRange = vec2(0.0, 10000.0); +#endif +#endif +uniform vec2 u_tileOffset; +#include +#include +#include +#include +const float INV_SCALE_COMPRESSION_FACTOR = 1.0 / 128.0; +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +vec4 dotThreshold(vec4 featureAttrOverFeatureArea, float dotValue, float tileDotsOverArea) { +return featureAttrOverFeatureArea * (1.0 / dotValue) * (1.0 / tileDotsOverArea); +} +#endif +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#include +#include +void drawLine(out lowp vec4 out_color, out highp vec3 out_pos) { +LineData outputs = buildLine( +out_pos, +a_id, +a_pos, +a_color, +(a_aux3.xy - 128.) / 16., +(a_aux3.zw - 128.) / 16., +0., +a_aux2.z / 16., +a_bitset, +vec4(0.), +vec2(0.), +a_aux2.w / 16. +); +v_id = outputs.id; +v_opacity = outputs.opacity; +v_aux1 = vec4(outputs.lineHalfWidth, outputs.normal, 0.); +out_color = outputs.color; +} +#endif +void drawFill(out lowp vec4 out_color, out highp vec3 out_pos) { +float a_bitSet = a_bitset; +out_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR); +v_opacity = getOpacity(); +v_id = norm(a_id); +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +mat3 tileToTileNormalized = mat3( 2. / 512., 0., 0., +0., -2. / 512., 0., +-1., 1., 1. ); +out_pos = tileToTileNormalized * vec3((a_pos * FILL_POSITION_PRECISION), 1.); +#else +out_pos = u_dvsMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.); +#endif +#ifdef PATTERN +vec4 a_tlbr = a_aux1; +float a_width = a_aux2.x; +float a_height = a_aux2.y; +vec2 a_offset = a_aux2.zw; +vec2 a_scale = a_aux3.xy; +float a_angle = a_aux3.z; +vec2 scale = INV_SCALE_COMPRESSION_FACTOR * a_scale; +float width = u_zoomFactor * a_width * scale.x; +float height = u_zoomFactor * a_height * scale.y; +float angle = C_256_TO_RAD * a_angle; +float sinA = sin(angle); +float cosA = cos(angle); +float dx = 0.0; +float dy = 0.0; +if (getBit(a_bitset, BITSET_FILL_RANDOM_PATTERN_OFFSET) > 0.5) { +float id = rgba2float(vec4(a_id, 0.0)); +dx = rand(vec2(id, 0.0)); +dy = rand(vec2(0.0, id)); +} +mat3 patternMatrix = mat3(cosA / width, sinA / height, 0, +-sinA / width, cosA / height, 0, +dx, dy, 1); +vec2 tileOffset = vec2(u_tileOffset.x * cosA - u_tileOffset.y * sinA, u_tileOffset.x * sinA + u_tileOffset.y * cosA); +tileOffset = mod(tileOffset, vec2(a_aux2.x, a_aux2.y)); +vec2 symbolOffset = (a_offset - tileOffset) / vec2(width, height); +v_tileTextureCoord = (patternMatrix * vec3(a_pos * FILL_POSITION_PRECISION, 1.0)).xy - symbolOffset; +v_aux1 = a_tlbr / u_mosaicSize.xyxy; +v_sampleAlphaOnly = getBit(a_bitset, BITSET_GENERIC_CONSIDER_ALPHA_ONLY); +if (getBit(a_bitSet, BITSET_FILL_HAS_UNRESOLVED_REPLACEMENT_COLOR) > 0.5) { +#ifdef VV_COLOR +v_sampleAlphaOnly *= 1.0 - getBit(a_bitSet, BITSET_GENERIC_LOCK_COLOR); +#else +v_sampleAlphaOnly = 0.0; +#endif +} +#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY +vec4 ddAttributeData0 = getAttributeData2(a_id) * u_isActive[0] * a_inverseArea; +vec4 ddAttributeData1 = getAttributeData3(a_id) * u_isActive[1] * a_inverseArea; +float size = u_tileZoomFactor * 512.0 * 1.0 / u_pixelRatio; +v_dotThresholds[0] = dotThreshold(ddAttributeData0, u_dotValue, u_tileDotsOverArea); +v_dotThresholds[1] = dotThreshold(ddAttributeData1, u_dotValue, u_tileDotsOverArea); +v_dotTextureCoords = (a_pos * FILL_POSITION_PRECISION + 0.5) / size; +#endif +} +#ifdef HITTEST +void draw(out lowp vec4 out_color, out highp vec3 out_pos) { +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +if (getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE) > 0.5) { +out_pos = vec3(0., 0., 2.); +return; +} +#endif +hittestFill(out_color, out_pos); +gl_PointSize = 1.0; +} +#elif defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) +void draw(out lowp vec4 out_color, out highp vec3 out_pos) { +v_isOutline = getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE); +if (v_isOutline > 0.5) { +drawLine(out_color, out_pos); +} else { +drawFill(out_color, out_pos); +} +} +#else +#define draw drawFill +#endif +void main() +{ +INIT; +highp vec3 pos = vec3(0.); +highp vec4 color = vec4(0.); +draw(color, pos); +v_color = color; +gl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0); +}`, "hittest.glsl": `#ifdef HITTEST +#include +attribute vec2 a_pos1; +attribute vec2 a_pos2; +void hittestFill( +out lowp vec4 out_color, +out highp vec3 out_pos +) { +vec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.); +vec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * FILL_POSITION_PRECISION, 1.); +vec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * FILL_POSITION_PRECISION, 1.); +float hittestDist = u_hittestDist; +float dist = distPointTriangle(u_hittestPos, pos.xy, pos1.xy, pos2.xy); +out_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0); +if (dist < 0. || dist >= hittestDist) { +out_pos.z += 2.0; +} +out_color = vec4(1. / 255., 0, 0, dist == 0. ? (1. / 255.) : 0.); +} +#endif` }, hittest: { "common.glsl": `#ifdef HITTEST +uniform float u_hittestDist; +uniform highp vec2 u_hittestPos; +float projectScalar(vec2 a, vec2 b) { +return dot(a, normalize(b)); +} +float distPointSegment(vec2 p0, vec2 p1, vec2 p2) { +vec2 L = p2 - p1; +vec2 A = p0 - p1; +float projAL = projectScalar(A, L); +float t = clamp(projAL / length(L), 0., 1.); +return distance(p0, p1 + t * (p2 - p1)); +} +void hittestMarker(out lowp vec4 out_color, out highp vec3 out_pos, in highp vec3 pos, float size) { +float dist = distance(pos, vec3(u_hittestPos, 1.)); +out_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0); +if ((dist - size) > u_hittestDist) { +out_pos.z += 2.0; +} +out_color = vec4(1. / 255., 0, 0, (dist - size) < 0. ? (1. / 255.) : 0.); +} +float intersectPointTriangleBary(vec2 p, vec2 a, vec2 b, vec2 c) { +return inTriangle(xyToBarycentric(p, a, b, c)); +} +float distPointTriangle(vec2 p, vec2 a, vec2 b, vec2 c) { +vec2 ba = b - a; +vec2 ca = c - a; +float crossProduct = ba.x * ca.y - ca.x * ba.y; +bool isParallel = crossProduct < EPSILON_HITTEST && crossProduct > -EPSILON_HITTEST; +if (isParallel) { +return -1.; +} +if (intersectPointTriangleBary(p.xy, a, b, c) == 1.) { +return 0.; +} +float distAB = distPointSegment(p, a, b); +float distBC = distPointSegment(p, b, c); +float distCA = distPointSegment(p, c, a); +return min(min(distAB, distBC), distCA); +} +#endif` }, icon: { "common.glsl": `#include +uniform lowp vec2 u_mosaicSize; +varying lowp vec4 v_color; +varying highp vec3 v_id; +varying highp vec4 v_sizeTex; +varying mediump vec3 v_pos; +varying lowp float v_opacity; +uniform lowp sampler2D u_texture; +#ifdef SDF +varying lowp vec4 v_outlineColor; +varying mediump float v_outlineWidth; +varying mediump float v_distRatio; +varying mediump float v_overridingOutlineColor; +varying mediump float v_isThin; +#endif +#ifdef SDF +vec4 getColor(vec2 v_size, vec2 v_tex) { +lowp vec4 fillPixelColor = v_color; +float d = 0.5 - rgba2float(texture2D(u_texture, v_tex)); +float size = max(v_size.x, v_size.y); +float dist = d * size * SOFT_EDGE_RATIO * v_distRatio; +fillPixelColor *= clamp(0.5 - dist, 0.0, 1.0); +float outlineWidth = v_outlineWidth; +#ifdef HIGHLIGHT +outlineWidth = max(outlineWidth, 4.0 * v_isThin); +#endif +if (outlineWidth > 0.25) { +lowp vec4 outlinePixelColor = v_overridingOutlineColor * v_color + (1.0 - v_overridingOutlineColor) * v_outlineColor; +float clampedOutlineSize = min(outlineWidth, size); +outlinePixelColor *= clamp(0.5 - abs(dist) + clampedOutlineSize * 0.5, 0.0, 1.0); +return v_opacity * ((1.0 - outlinePixelColor.a) * fillPixelColor + outlinePixelColor); +} +return v_opacity * fillPixelColor; +} +#else +vec4 getColor(vec2 _v_size, vec2 v_tex) { +lowp vec4 texColor = texture2D(u_texture, v_tex); +return v_opacity * texColor * v_color; +} +#endif`, heatmapAccumulate: { "common.glsl": `varying lowp vec4 v_hittestResult; +varying mediump vec2 v_offsetFromCenter; +varying highp float v_fieldValue;`, "heatmapAccumulate.frag": `precision mediump float; +#include +#ifdef HEATMAP_PRECISION_HALF_FLOAT +#define COMPRESSION_FACTOR 0.25 +#else +#define COMPRESSION_FACTOR 1.0 +#endif +uniform lowp sampler2D u_texture; +void main() { +#ifdef HITTEST +gl_FragColor = v_hittestResult; +#else +float radius = length(v_offsetFromCenter); +float shapeWeight = step(radius, 1.0); +float oneMinusRadiusSquared = 1.0 - radius * radius; +float kernelWeight = oneMinusRadiusSquared * oneMinusRadiusSquared; +gl_FragColor = vec4(shapeWeight * kernelWeight * v_fieldValue * COMPRESSION_FACTOR); +#endif +}`, "heatmapAccumulate.vert": `precision highp float; +attribute vec2 a_vertexOffset; +vec4 a_color = vec4(0.0); +vec2 a_zoomRange = vec2(0.0, 10000.0); +uniform float u_radius; +uniform float u_isFieldActive; +#include +#include +#include +void main() { +float filterFlags = getFilterFlags(); +#ifdef HITTEST +highp vec4 out_hittestResult = vec4(0.); +highp vec3 out_pos = vec3(0.); +vec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0); +hittestMarker(out_hittestResult, out_pos, pos, u_radius); +v_hittestResult = out_hittestResult; +gl_PointSize = 1.; +gl_Position = vec4(clip(a_color, out_pos, filterFlags, a_zoomRange), 1.0); +#else +v_offsetFromCenter = sign(a_vertexOffset); +v_fieldValue = getAttributeData2(a_id).x * u_isFieldActive + 1.0 - u_isFieldActive; +vec3 centerPos = u_dvsMat3 * vec3(a_pos * POSITION_PRECISION, 1.0); +vec3 vertexPos = centerPos + u_displayViewMat3 * vec3(v_offsetFromCenter, 0.0) * u_radius; +gl_Position = vec4(clip(a_color, vertexPos, filterFlags, a_zoomRange), 1.0); +#endif +}` }, "hittest.glsl": `#ifdef HITTEST +#include +attribute vec2 a_vertexOffset1; +attribute vec2 a_vertexOffset2; +attribute vec2 a_texCoords1; +attribute vec2 a_texCoords2; +vec2 getTextureCoords(in vec3 bary, in vec2 texCoords0, in vec2 texCoords1, in vec2 texCoords2) { +return texCoords0 * bary.x + texCoords1 * bary.y + texCoords2 * bary.z; +} +void hittestIcon( +inout lowp vec4 out_color, +out highp vec3 out_pos, +in vec3 pos, +in vec3 offset, +in vec2 size, +in float scaleFactor, +in float isMapAligned +) { +out_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0); +vec3 posBase = u_viewMat3 * u_tileMat3 * pos; +vec3 offset1 = scaleFactor * vec3(a_vertexOffset1 / 16.0, 0.); +vec3 offset2 = scaleFactor * vec3(a_vertexOffset2 / 16.0, 0.); +vec2 pos0 = (posBase + getMatrixNoDisplay(isMapAligned) * offset).xy; +vec2 pos1 = (posBase + getMatrixNoDisplay(isMapAligned) * offset1).xy; +vec2 pos2 = (posBase + getMatrixNoDisplay(isMapAligned) * offset2).xy; +vec3 bary0 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, -u_hittestDist), pos0, pos1, pos2); +vec3 bary1 = xyToBarycentric(u_hittestPos + vec2(0., -u_hittestDist), pos0, pos1, pos2); +vec3 bary2 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, -u_hittestDist), pos0, pos1, pos2); +vec3 bary3 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, 0.), pos0, pos1, pos2); +vec3 bary4 = xyToBarycentric(u_hittestPos, pos0, pos1, pos2); +vec3 bary5 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, 0.), pos0, pos1, pos2); +vec3 bary6 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, u_hittestDist), pos0, pos1, pos2); +vec3 bary7 = xyToBarycentric(u_hittestPos + vec2(0., u_hittestDist), pos0, pos1, pos2); +vec3 bary8 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, u_hittestDist), pos0, pos1, pos2); +vec2 tex0 = a_texCoords / u_mosaicSize; +vec2 tex1 = a_texCoords1 / u_mosaicSize; +vec2 tex2 = a_texCoords2 / u_mosaicSize; +float alphaSum = 0.; +alphaSum += inTriangle(bary0) * getColor(size, getTextureCoords(bary0, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary1) * getColor(size, getTextureCoords(bary1, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary2) * getColor(size, getTextureCoords(bary2, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary3) * getColor(size, getTextureCoords(bary3, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary4) * getColor(size, getTextureCoords(bary4, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary5) * getColor(size, getTextureCoords(bary5, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary6) * getColor(size, getTextureCoords(bary6, tex0, tex1, tex2)).a; +alphaSum += inTriangle(bary7) * getColor(size, getTextureCoords(bary7, tex0, tex1, tex2)).a; +out_pos.z += step(alphaSum, .05) * 2.0; +out_color = vec4(1. / 255., 0., 0., alphaSum / 255.); +} +#endif`, "icon.frag": `precision mediump float; +#include +#include +#include +void main() +{ +#ifdef HITTEST +vec4 color = v_color; +#else +vec4 color = getColor(v_sizeTex.xy, v_sizeTex.zw); +#endif +#ifdef HIGHLIGHT +color.a = step(1.0 / 255.0, color.a); +#endif +gl_FragColor = color; +}`, "icon.vert": `precision highp float; +attribute vec4 a_color; +attribute vec4 a_outlineColor; +attribute vec4 a_sizeAndOutlineWidth; +attribute vec2 a_vertexOffset; +attribute vec2 a_texCoords; +attribute vec2 a_bitSetAndDistRatio; +attribute vec2 a_zoomRange; +#include +#include +#include +float getMarkerScaleFactor(inout vec2 size, in float referenceSize) { +#ifdef VV_SIZE +float f = getSize(size.y) / size.y; +float sizeFactor = size.y / referenceSize; +return getSize(referenceSize) / referenceSize; +#else +return 1.; +#endif +} +void main() +{ +INIT; +float a_bitSet = a_bitSetAndDistRatio.x; +vec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0); +vec2 size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0; +vec3 offset = vec3(a_vertexOffset / 16.0, 0.); +float outlineSize = a_sizeAndOutlineWidth.z * a_sizeAndOutlineWidth.z / 128.0; +float isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP); +float referenceSize = a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0; +float scaleSymbolProportionally = getBit(a_bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY); +float scaleFactor = getMarkerScaleFactor(size, referenceSize); +size.xy *= scaleFactor; +offset.xy *= scaleFactor; +outlineSize *= scaleSymbolProportionally * (scaleFactor - 1.0) + 1.0; +vec2 v_tex = a_texCoords / u_mosaicSize; +float filterFlags = getFilterFlags(); +v_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR); +v_opacity = getOpacity(); +v_id = norm(a_id); +v_pos = u_dvsMat3 * pos + getMatrix(isMapAligned) * getRotation() * offset; +v_sizeTex = vec4(size.xy, v_tex.xy); +#ifdef SDF +v_isThin = getBit(a_bitSet, BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE); +#ifdef VV_COLOR +v_overridingOutlineColor = v_isThin; +#else +v_overridingOutlineColor = 0.0; +#endif +v_outlineWidth = min(outlineSize, max(max(size.x, size.y) - 0.99, 0.0)); +v_outlineColor = a_outlineColor; +v_distRatio = a_bitSetAndDistRatio.y / 126.0; +#endif +#ifdef HITTEST +highp vec4 out_color = vec4(0.); +highp vec3 out_pos = vec3(0.); +hittestIcon(out_color, out_pos, pos, offset, size, scaleFactor, isMapAligned); +v_color = out_color; +gl_PointSize = 1.; +gl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0); +#else +gl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0); +#endif +}` }, label: { "common.glsl": `uniform mediump float u_zoomLevel; +uniform mediump float u_mapRotation; +uniform mediump float u_mapAligned; +uniform mediump vec2 u_mosaicSize; +varying mediump float v_antialiasingWidth; +varying mediump float v_edgeDistanceOffset; +varying mediump vec2 v_tex; +varying mediump vec4 v_color; +varying lowp vec4 v_animation;`, "label.frag": "#include ", "label.vert": `precision highp float; +#include +#include +attribute vec4 a_color; +attribute vec4 a_haloColor; +attribute vec4 a_texAndSize; +attribute vec4 a_refSymbolAndPlacementOffset; +attribute vec4 a_glyphData; +attribute vec2 a_vertexOffset; +attribute vec2 a_texCoords; +uniform float u_isHaloPass; +uniform float u_isBackgroundPass; +uniform float u_mapRotation; +uniform float u_mapAligned; +float getZ(in float minZoom, in float maxZoom, in float angle) { +float glyphAngle = angle * 360.0 / 254.0; +float mapAngle = u_mapRotation * 360.0 / 254.0; +float diffAngle = min(360.0 - abs(mapAngle - glyphAngle), abs(mapAngle - glyphAngle)); +float z = 0.0; +z += u_mapAligned * (2.0 * (1.0 - step(minZoom, u_currentZoom))); +z += u_mapAligned * 2.0 * step(90.0, diffAngle); +z += 2.0 * (1.0 - step(u_currentZoom, maxZoom)); +return z; +} +void main() +{ +INIT; +float groupMinZoom = getMinZoom(); +float glyphMinZoom = a_glyphData.x; +float glyphMaxZoom = a_glyphData.y; +float glyphAngle = a_glyphData.z; +float a_isBackground = a_glyphData.w; +float a_minZoom = max(groupMinZoom, glyphMinZoom); +float a_placementPadding = a_refSymbolAndPlacementOffset.x * EXTRUDE_SCALE_PLACEMENT_PADDING; +vec2 a_placementDir = unpack_u8_nf32(a_refSymbolAndPlacementOffset.zw); +float a_refSymbolSize = a_refSymbolAndPlacementOffset.y; +float fontSize = a_texAndSize.z; +float haloSize = a_texAndSize.w * OUTLINE_SCALE; +vec2 vertexOffset = a_vertexOffset * OFFSET_PRECISION; +vec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0); +float z = getZ(a_minZoom, glyphMaxZoom, glyphAngle); +float fontScale = fontSize / SDF_FONT_SIZE; +float halfSize = getSize(a_refSymbolSize) / 2.0; +float animation = pow(getAnimationState(), vec4(2.0)).r; +float isText = 1.0 - a_isBackground; +float isBackground = u_isBackgroundPass * a_isBackground; +vec4 nonHaloColor = (isBackground + isText) * a_color; +v_color = animation * ((1.0 - u_isHaloPass) * nonHaloColor + (u_isHaloPass * a_haloColor)); +v_opacity = 1.0; +v_tex = a_texCoords / u_mosaicSize; +v_edgeDistanceOffset = u_isHaloPass * haloSize / fontScale / MAX_SDF_DISTANCE; +v_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio; +vec2 placementOffset = a_placementDir * (halfSize + a_placementPadding); +vec3 glyphOffset = u_displayMat3 * vec3(vertexOffset + placementOffset, 0.0); +vec3 v_pos = vec3((u_dvsMat3 * pos + glyphOffset).xy, z); +float isHidden = u_isBackgroundPass * isText + (1.0 - u_isBackgroundPass) * a_isBackground; +v_pos.z += 2.0 * isHidden; +gl_Position = vec4(v_pos, 1.0); +#ifdef DEBUG +v_color = vec4(a_color.rgb, z == 0.0 ? 1.0 : 0.645); +#endif +}` }, line: { "common.glsl": `varying lowp vec4 v_color; +varying highp vec3 v_id; +varying mediump vec2 v_normal; +varying mediump float v_lineHalfWidth; +varying lowp float v_opacity; +#ifdef PATTERN +varying mediump vec4 v_tlbr; +varying mediump vec2 v_patternSize; +#endif +#if defined(PATTERN) || defined(SDF) +varying highp float v_accumulatedDistance; +#endif +#ifdef SDF +varying mediump float v_lineWidthRatio; +#endif`, "hittest.glsl": `#include +#ifdef HITTEST +attribute vec2 a_pos1; +attribute vec2 a_pos2; +void hittestLine(out lowp vec4 out_color, out highp vec3 out_pos, float halfWidth) { +vec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.); +vec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * POSITION_PRECISION, 1.); +vec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * POSITION_PRECISION, 1.); +vec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0); +float dist = min(distPointSegment(u_hittestPos, pos.xy, pos1.xy), +distPointSegment(u_hittestPos, pos.xy, pos2.xy)) - halfWidth; +out_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0); +if (dist >= u_hittestDist) { +out_pos.z += 2.0; +} +out_color = vec4(1. / 255., 0, 0, dist <= 0. ? (1. / 255.) : 0.); +} +#endif`, "line.frag": `precision lowp float; +#include +#include +#include +#include +#include +#include +#ifdef HITTEST +void main() { +gl_FragColor = v_color; +} +#else +void main() { +LineData inputs = LineData( +v_color, +v_normal, +v_lineHalfWidth, +v_opacity, +#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#ifdef PATTERN +v_tlbr, +v_patternSize, +#endif +#ifdef SDF +v_lineWidthRatio, +#endif +#if defined(PATTERN) || defined(SDF) +v_accumulatedDistance, +#endif +#endif +v_id +); +gl_FragColor = shadeLine(inputs); +} +#endif`, "line.vert": `precision highp float; +attribute vec4 a_color; +attribute vec4 a_offsetAndNormal; +attribute vec2 a_accumulatedDistanceAndHalfWidth; +attribute vec4 a_tlbr; +attribute vec4 a_segmentDirection; +attribute vec2 a_aux; +attribute vec2 a_zoomRange; +#include +#include +#include +#include +#include +#include +#ifdef HITTEST +void draw() { +float aa = 0.5 * u_antialiasing; +float a_halfWidth = a_accumulatedDistanceAndHalfWidth.y / 16.; +float a_cimHalfWidth = a_aux.x / 16. ; +vec2 a_offset = a_offsetAndNormal.xy / 16.; +float baseWidth = getBaseLineHalfWidth(a_halfWidth, a_cimHalfWidth); +float halfWidth = getLineHalfWidth(baseWidth, aa); +highp vec3 pos = vec3(0.); +v_color = vec4(0.); +hittestLine(v_color, pos, halfWidth); +gl_PointSize = 1.; +gl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0); +} +#else +void draw() +{ +highp vec3 pos = vec3(0.); +LineData outputs = buildLine( +pos, +a_id, +a_pos, +a_color, +a_offsetAndNormal.xy / 16., +a_offsetAndNormal.zw / 16., +a_accumulatedDistanceAndHalfWidth.x, +a_accumulatedDistanceAndHalfWidth.y / 16., +a_segmentDirection.w, +a_tlbr, +a_segmentDirection.xy / 16., +a_aux.x / 16. +); +v_id = outputs.id; +v_color = outputs.color; +v_normal = outputs.normal; +v_lineHalfWidth = outputs.lineHalfWidth; +v_opacity = outputs.opacity; +#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#ifdef PATTERN +v_tlbr = outputs.tlbr; +v_patternSize = outputs.patternSize; +#endif +#ifdef SDF +v_lineWidthRatio = outputs.lineWidthRatio; +#endif +#if defined(PATTERN) || defined(SDF) +v_accumulatedDistance = outputs.accumulatedDistance; +#endif +#endif +gl_Position = vec4(clip(outputs.color, pos, getFilterFlags(), a_zoomRange), 1.0); +} +#endif +void main() { +INIT; +draw(); +}` }, pie: { "pie.frag": `precision mediump float; +#include +#include +#include +#include +varying float v_size; +varying vec2 v_offset; +varying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS]; +varying float v_numOfEntries; +varying float v_maxSectorAngle; +uniform lowp vec4 u_colors[NUMBER_OF_FIELDS]; +uniform lowp vec4 u_defaultColor; +uniform lowp vec4 u_othersColor; +uniform lowp vec4 u_outlineColor; +uniform float u_donutRatio; +uniform float u_sectorThreshold; +struct FilteredChartInfo { +float endSectorAngle; +int colorId; +}; +lowp vec4 getSectorColor(in int index, in vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) { +#if __VERSION__ == 300 +mediump int colorIndex = int(filteredSectorToColorId[index].y); +return u_colors[colorIndex]; +#else +mediump int colorIndex; +for (int i = 0; i < NUMBER_OF_FIELDS; ++i) { +if (i == index) { +colorIndex = int(filteredSectorToColorId[i].y); +} +} +for (int i = 0; i < NUMBER_OF_FIELDS; ++i) { +if (i == colorIndex) { +return u_colors[i]; +} +} +return u_colors[NUMBER_OF_FIELDS - 1]; +#endif +} +const int OTHER_SECTOR_ID = 255; +#ifdef HITTEST +vec4 getColor() { +return v_color; +} +#else +vec4 getColor() { +float angle = 90.0 - C_RAD_TO_DEG * atan2(v_offset.y, v_offset.x); +if (angle < 0.0) { +angle += 360.0; +} else if (angle > 360.0) { +angle = mod(angle, 360.0); +} +int numOfEntries = int(v_numOfEntries); +float maxSectorAngle = v_maxSectorAngle; +lowp vec4 fillColor = (maxSectorAngle > 0.0 || u_sectorThreshold > 0.0) ? u_othersColor : u_defaultColor; +lowp vec4 prevColor = vec4(0.0); +lowp vec4 nextColor = vec4(0.0); +float startSectorAngle = 0.0; +float endSectorAngle = 0.0; +if (angle < maxSectorAngle) { +for (int index = 0; index < NUMBER_OF_FIELDS; ++index) { +startSectorAngle = endSectorAngle; +endSectorAngle = v_filteredSectorToColorId[index].x; +if (endSectorAngle > angle) { +fillColor = getSectorColor(index, v_filteredSectorToColorId); +prevColor = u_sectorThreshold != 0.0 && index == 0 && abs(360.0 - maxSectorAngle) < EPSILON ? u_othersColor : +getSectorColor(index > 0 ? index - 1 : numOfEntries - 1, v_filteredSectorToColorId); +nextColor = u_sectorThreshold != 0.0 && abs(endSectorAngle - maxSectorAngle) < EPSILON ? u_othersColor : +getSectorColor(index < numOfEntries - 1 ? index + 1 : 0, v_filteredSectorToColorId); +break; +} +if (index == numOfEntries - 1) { +break; +} +} +} else { +prevColor = getSectorColor(numOfEntries - 1, v_filteredSectorToColorId); +nextColor = getSectorColor(0, v_filteredSectorToColorId); +startSectorAngle = maxSectorAngle; +endSectorAngle = 360.0; +} +lowp vec4 outlineColor = u_outlineColor; +float offset = length(v_offset); +float distanceSize = offset * v_size; +if (startSectorAngle != 0.0 || endSectorAngle != 360.0) { +float distanceToStartSector = (angle - startSectorAngle); +float distanceToEndSector = (endSectorAngle - angle); +float sectorThreshold = 0.6; +float beginSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToStartSector * offset); +float endSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToEndSector * offset); +if (endSectorAlpha > 0.0) { +fillColor = mix(nextColor, fillColor, endSectorAlpha); +} else if (beginSectorAlpha > 0.0) { +fillColor = mix(prevColor, fillColor, beginSectorAlpha); +} +} +float donutSize = u_donutRatio * (v_size - v_outlineWidth); +float endOfDonut = donutSize - v_outlineWidth; +float aaThreshold = 0.75; +float innerCircleAlpha = endOfDonut - aaThreshold > 0.0 ? smoothstep(endOfDonut - aaThreshold, endOfDonut + aaThreshold, distanceSize) : 1.0; +float outerCircleAlpha = 1.0 - smoothstep(v_size - aaThreshold, v_size + aaThreshold , distanceSize); +float circleAlpha = innerCircleAlpha * outerCircleAlpha; +float startOfOutline = v_size - v_outlineWidth; +if (startOfOutline > 0.0 && v_outlineWidth > 0.25) { +float outlineFactor = smoothstep(startOfOutline - aaThreshold, startOfOutline + aaThreshold, distanceSize); +float innerLineFactor = donutSize - aaThreshold > 0.0 ? 1.0 - smoothstep(donutSize - aaThreshold, donutSize + aaThreshold , distanceSize) : 0.0; +fillColor = mix(fillColor, outlineColor, innerLineFactor + outlineFactor); +} +return v_opacity * circleAlpha * fillColor; +} +#endif +void main() +{ +vec4 color = getColor(); +#ifdef HIGHLIGHT +color.a = step(1.0 / 255.0, color.a); +#endif +gl_FragColor = color; +}`, "pie.vert": `precision highp float; +attribute vec4 a_color; +attribute vec4 a_outlineColor; +attribute vec4 a_sizeAndOutlineWidth; +attribute vec2 a_vertexOffset; +attribute vec2 a_texCoords; +attribute vec2 a_bitSetAndDistRatio; +attribute vec2 a_zoomRange; +uniform float u_outlineWidth; +uniform mediump float u_sectorThreshold; +varying float v_size; +varying vec2 v_offset; +varying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS]; +varying float v_numOfEntries; +varying float v_maxSectorAngle; +struct FilteredChartInfo { +float endSectorAngle; +int colorId; +}; +int filter(in float sectorAngle, +in int currentIndex, +inout FilteredChartInfo filteredInfo, +inout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) { +if (sectorAngle > u_sectorThreshold * 360.0) { +filteredInfo.endSectorAngle += sectorAngle; +#if __VERSION__ == 300 +filteredSectorToColorId[filteredInfo.colorId] = vec2(filteredInfo.endSectorAngle, currentIndex); +#else +for (int i = 0; i < NUMBER_OF_FIELDS; i++) { +if (i == filteredInfo.colorId) { +filteredSectorToColorId[i] = vec2(filteredInfo.endSectorAngle, currentIndex); +} +} +#endif +++filteredInfo.colorId; +} +return 0; +} +int filterValues(inout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS], +inout FilteredChartInfo filteredInfo, +in float sectorAngles[NUMBER_OF_FIELDS]) { +for (int index = 0; index < NUMBER_OF_FIELDS; ++index) { +float sectorValue = sectorAngles[index]; +filter(sectorValue, index, filteredInfo, filteredSectorToColorId); +} +return filteredInfo.colorId; +} +#include +#include +#include +vec2 getMarkerSize(inout vec2 offset, inout vec2 baseSize, inout float outlineSize, in float referenceSize, in float bitSet) { +vec2 outSize = baseSize; +#ifdef VV_SIZE +float r = 0.5 * getSize(referenceSize) / referenceSize; +outSize.xy *= r; +offset.xy *= r; +float scaleSymbolProportionally = getBit(bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY); +outlineSize *= scaleSymbolProportionally * (r - 1.0) + 1.0; +#endif +return outSize; +} +vec3 getOffset(in vec2 in_offset, float a_bitSet) { +float isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP); +vec3 offset = vec3(in_offset, 0.0); +return getMatrix(isMapAligned) * offset; +} +float filterNaNValues(in float value) { +return value != NAN_MAGIC_NUMBER && value > 0.0 ? value : 0.0; +} +void main() +{ +INIT; +vec2 a_size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0; +vec2 a_offset = a_vertexOffset / 16.0; +float outlineSize = u_outlineWidth; +float a_bitSet = a_bitSetAndDistRatio.x; +vec2 size = getMarkerSize(a_offset, a_size, outlineSize, a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0, a_bitSet); +float filterFlags = getFilterFlags(); +vec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0); +v_opacity = getOpacity(); +v_id = norm(a_id); +v_pos = u_dvsMat3 * pos + getOffset(a_offset, a_bitSet); +v_offset = sign(a_texCoords - 0.5); +v_size = max(size.x, size.y); +v_outlineWidth = outlineSize; +float attributeData[10]; +vec4 attributeData0 = getAttributeData3(a_id); +attributeData[0] = filterNaNValues(attributeData0.x); +attributeData[1] = filterNaNValues(attributeData0.y); +attributeData[2] = filterNaNValues(attributeData0.z); +attributeData[3] = filterNaNValues(attributeData0.w); +#if (NUMBER_OF_FIELDS > 4) +vec4 attributeData1 = getAttributeData4(a_id); +attributeData[4] = filterNaNValues(attributeData1.x); +attributeData[5] = filterNaNValues(attributeData1.y); +attributeData[6] = filterNaNValues(attributeData1.z); +attributeData[7] = filterNaNValues(attributeData1.w); +#endif +#if (NUMBER_OF_FIELDS > 8) +vec4 attributeData2 = getAttributeData5(a_id); +attributeData[8] = filterNaNValues(attributeData2.x); +attributeData[9] = filterNaNValues(attributeData2.y); +#endif +float sum = 0.0; +for (int i = 0; i < NUMBER_OF_FIELDS; ++i) { +sum += attributeData[i]; +} +float sectorAngles[NUMBER_OF_FIELDS]; +for (int i = 0; i < NUMBER_OF_FIELDS; ++i) { +sectorAngles[i] = 360.0 * attributeData[i] / sum; +} +vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]; +FilteredChartInfo filteredInfo = FilteredChartInfo(0.0, 0); +int numOfEntries = filterValues(filteredSectorToColorId, filteredInfo, sectorAngles); +v_numOfEntries = float(numOfEntries); +v_maxSectorAngle = filteredInfo.endSectorAngle; +#if __VERSION__ == 300 +v_filteredSectorToColorId = filteredSectorToColorId; +#else +for (int i = 0; i < NUMBER_OF_FIELDS; ++i) { +if (i == numOfEntries) { +break; +} +v_filteredSectorToColorId[i] = filteredSectorToColorId[i]; +} +#endif +#ifdef HITTEST +highp vec3 out_pos = vec3(0.0); +v_color = vec4(0.0); +hittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * pos, v_size); +gl_PointSize = 1.0; +gl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0); +#else +gl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0); +#endif +}` }, shared: { line: { "common.glsl": `#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN) +uniform mediump vec2 u_mosaicSize; +varying mediump float v_sampleAlphaOnly; +#endif +struct LineData { +lowp vec4 color; +mediump vec2 normal; +mediump float lineHalfWidth; +lowp float opacity; +#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#ifdef PATTERN +mediump vec4 tlbr; +mediump vec2 patternSize; +#endif +#ifdef SDF +mediump float lineWidthRatio; +#endif +#if defined(PATTERN) || defined(SDF) +highp float accumulatedDistance; +#endif +#endif +highp vec3 id; +};`, "line.frag": `uniform lowp float u_blur; +#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && !defined(HIGHLIGHT) +#if defined(PATTERN) || defined(SDF) +uniform sampler2D u_texture; +uniform highp float u_pixelRatio; +#endif +#endif +#if defined(SDF) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) +lowp vec4 getLineColor(LineData line) { +mediump float adjustedPatternWidth = line.patternSize.x * 2.0 * line.lineWidthRatio; +mediump float relativeTexX = fract(line.accumulatedDistance / adjustedPatternWidth); +mediump float relativeTexY = 0.5 + 0.25 * line.normal.y; +mediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY)); +mediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5; +float dist = d * line.lineHalfWidth; +return line.opacity * clamp(0.5 - dist, 0.0, 1.0) * line.color; +} +#elif defined(PATTERN) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) +lowp vec4 getLineColor(LineData line) { +mediump float lineHalfWidth = line.lineHalfWidth; +mediump float adjustedPatternHeight = line.patternSize.y * 2.0 * lineHalfWidth / line.patternSize.x; +mediump float relativeTexY = fract(line.accumulatedDistance / adjustedPatternHeight); +mediump float relativeTexX = 0.5 + 0.5 * line.normal.y; +mediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY)); +lowp vec4 color = texture2D(u_texture, texCoord); +#ifdef VV_COLOR +if (v_sampleAlphaOnly > 0.5) { +color.rgb = vec3(color.a); +} +#endif +return line.opacity * line.color * color; +} +#else +lowp vec4 getLineColor(LineData line) { +return line.opacity * line.color; +} +#endif +vec4 shadeLine(LineData line) +{ +mediump float thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(line.lineHalfWidth, THIN_LINE_HALF_WIDTH), 1.0); +mediump float fragDist = length(line.normal) * line.lineHalfWidth; +lowp float alpha = clamp(thinLineFactor * (line.lineHalfWidth - fragDist) / (u_blur + thinLineFactor - 1.0), 0.0, 1.0); +lowp vec4 out_color = getLineColor(line) * alpha; +#ifdef HIGHLIGHT +out_color.a = step(1.0 / 255.0, out_color.a); +#endif +#ifdef ID +if (out_color.a < 1.0 / 255.0) { +discard; +} +out_color = vec4(line.id, 0.0); +#endif +return out_color; +}`, "line.vert": `float getBaseLineHalfWidth(in float lineHalfWidth, in float referenceHalfWidth) { +#ifdef VV_SIZE +float refLineWidth = 2.0 * referenceHalfWidth; +return 0.5 * (lineHalfWidth / max(referenceHalfWidth, EPSILON)) * getSize(refLineWidth); +#else +return lineHalfWidth; +#endif +} +float getLineHalfWidth(in float baseWidth, in float aa) { +float halfWidth = max(baseWidth + aa, 0.45) + 0.1 * aa; +#ifdef HIGHLIGHT +halfWidth = max(halfWidth, 2.0); +#endif +return halfWidth; +} +vec2 getDist(in vec2 offset, in float halfWidth) { +float thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(halfWidth, THIN_LINE_HALF_WIDTH), 1.0); +return thinLineFactor * halfWidth * offset; +} +LineData buildLine( +out vec3 out_pos, +in vec3 in_id, +in vec2 in_pos, +in vec4 in_color, +in vec2 in_offset, +in vec2 in_normal, +in float in_accumulatedDist, +in float in_lineHalfWidth, +in float in_bitSet, +in vec4 in_tlbr, +in vec2 in_segmentDirection, +in float in_referenceHalfWidth +) +{ +float aa = 0.5 * u_antialiasing; +float baseWidth = getBaseLineHalfWidth(in_lineHalfWidth, in_referenceHalfWidth); +float halfWidth = getLineHalfWidth(baseWidth, aa); +float z = 2.0 * step(baseWidth, 0.0); +vec2 dist = getDist(in_offset, halfWidth); +vec3 offset = u_displayViewMat3 * vec3(dist, 0.0); +vec3 pos = u_dvsMat3 * vec3(in_pos * POSITION_PRECISION, 1.0) + offset; +#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +vec4 color = in_color; +float opacity = 1.0; +#else +vec4 color = getColor(in_color, in_bitSet, BITSET_GENERIC_LOCK_COLOR); +float opacity = getOpacity(); +#ifdef SDF +const float SDF_PATTERN_HALF_WIDTH = 15.5; +float scaleDash = getBit(in_bitSet, BITSET_LINE_SCALE_DASH); +float lineWidthRatio = (scaleDash * max(halfWidth - 0.55 * u_antialiasing, 0.25) + (1.0 - scaleDash)) / SDF_PATTERN_HALF_WIDTH; +#endif +#endif +#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN) +v_sampleAlphaOnly = getBit(in_bitSet, BITSET_GENERIC_CONSIDER_ALPHA_ONLY); +#endif +out_pos = vec3(pos.xy, z); +return LineData( +color, +in_normal, +halfWidth, +opacity, +#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#ifdef PATTERN +in_tlbr / u_mosaicSize.xyxy, +vec2(in_tlbr.z - in_tlbr.x, in_tlbr.w - in_tlbr.y), +#endif +#ifdef SDF +lineWidthRatio, +#endif +#if defined(PATTERN) || defined(SDF) +in_accumulatedDist * u_zoomFactor + dot(in_segmentDirection, dist), +#endif +#endif +norm(in_id) +); +}` } }, "symbologyTypeUtils.glsl": `#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE +#define SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE +#endif +#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_SIMPLE || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE +#define SYMBOLOGY_TYPE_IS_SIMPLE_LIKE +#endif`, text: { "common.glsl": `uniform highp vec2 u_mosaicSize; +varying highp vec3 v_id; +varying mediump vec3 v_pos; +varying lowp float v_opacity; +varying lowp vec4 v_color; +varying highp vec2 v_tex; +varying mediump float v_antialiasingWidth; +varying mediump float v_edgeDistanceOffset; +varying lowp float v_transparency;`, "hittest.glsl": "#include ", "text.frag": `precision mediump float; +#include +uniform lowp sampler2D u_texture; +#ifdef HITTEST +vec4 getColor() { +return v_color; +} +#else +vec4 getColor() +{ +float SDF_CUTOFF = (2.0 / 8.0); +float SDF_BASE_EDGE_DIST = 1.0 - SDF_CUTOFF; +lowp float dist = texture2D(u_texture, v_tex).a; +mediump float edge = SDF_BASE_EDGE_DIST - v_edgeDistanceOffset; +#ifdef HIGHLIGHT +edge /= 2.0; +#endif +lowp float aa = v_antialiasingWidth; +lowp float alpha = smoothstep(edge - aa, edge + aa, dist); +return alpha * v_color * v_opacity; +} +#endif +void main() +{ +gl_FragColor = getColor(); +}`, "text.vert": `precision highp float; +#include +#include +#include +#include +attribute vec4 a_color; +attribute vec4 a_haloColor; +attribute vec4 a_texFontSize; +attribute vec4 a_aux; +attribute vec2 a_zoomRange; +attribute vec2 a_vertexOffset; +attribute vec2 a_texCoords; +uniform float u_isHaloPass; +uniform float u_isBackgroundPass; +float getTextSize(inout vec2 offset, inout float baseSize, in float referenceSize) { +#ifdef VV_SIZE +float r = getSize(referenceSize) / referenceSize; +baseSize *= r; +offset.xy *= r; +return baseSize; +#endif +return baseSize; +} +void main() +{ +INIT; +float a_isBackground = a_aux.y; +float a_referenceSize = a_aux.z * a_aux.z / 256.0; +float a_bitSet = a_aux.w; +float a_fontSize = a_texFontSize.z; +vec2 a_offset = a_vertexOffset * OFFSET_PRECISION; +vec3 in_pos = vec3(a_pos * POSITION_PRECISION, 1.0); +float fontSize = getTextSize(a_offset, a_fontSize, a_referenceSize); +float fontScale = fontSize / SDF_FONT_SIZE; +vec3 offset = getRotation() * vec3(a_offset, 0.0); +mat3 extrudeMatrix = getBit(a_bitSet, 0) == 1.0 ? u_displayViewMat3 : u_displayMat3; +float isText = 1.0 - a_isBackground; +float isBackground = u_isBackgroundPass * a_isBackground; +vec4 nonHaloColor = (isBackground * a_color) + (isText * getColor(a_color, a_bitSet, 1)); +v_color = u_isHaloPass * a_haloColor + (1.0 - u_isHaloPass) * nonHaloColor; +v_opacity = getOpacity(); +v_id = norm(a_id); +v_tex = a_texCoords / u_mosaicSize; +v_pos = u_dvsMat3 * in_pos + extrudeMatrix * offset; +float isHidden = u_isBackgroundPass * isText + (1.0 - u_isBackgroundPass) * a_isBackground; +v_pos.z += 2.0 * isHidden; +v_edgeDistanceOffset = u_isHaloPass * OUTLINE_SCALE * a_texFontSize.w / fontScale / MAX_SDF_DISTANCE; +v_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio; +#ifdef HITTEST +highp vec3 out_pos = vec3(0.); +v_color = vec4(0.); +hittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0) ++ u_tileMat3 * offset, fontSize / 2.); +gl_PointSize = 1.; +gl_Position = vec4(clip(v_color, out_pos, getFilterFlags(), a_zoomRange), 1.0); +#else +gl_Position = vec4(clip(v_color, v_pos, getFilterFlags(), a_zoomRange), 1.0); +#endif +}` }, "utils.glsl": `float rshift(in float u32, in int amount) { +return floor(u32 / pow(2.0, float(amount))); +} +float getBit(in float bitset, in int bitIndex) { +float offset = pow(2.0, float(bitIndex)); +return mod(floor(bitset / offset), 2.0); +} +float getFilterBit(in float bitset, in int bitIndex) { +return getBit(bitset, bitIndex + 1); +} +float getHighlightBit(in float bitset) { +return getBit(bitset, 0); +} +highp vec3 unpackDisplayIdTexel(in highp vec3 bitset) { +float isAggregate = getBit(bitset.b, 7); +return (1.0 - isAggregate) * bitset + isAggregate * (vec3(bitset.rgb) - vec3(0.0, 0.0, float(0x80))); +} +vec4 unpack(in float u32) { +float r = mod(rshift(u32, 0), 255.0); +float g = mod(rshift(u32, 8), 255.0); +float b = mod(rshift(u32, 16), 255.0); +float a = mod(rshift(u32, 24), 255.0); +return vec4(r, g, b, a); +} +vec3 norm(in vec3 v) { +return v /= 255.0; +} +vec4 norm(in vec4 v) { +return v /= 255.0; +} +float max4(vec4 target) { +return max(max(max(target.x, target.y), target.z), target.w); +} +vec2 unpack_u8_nf32(vec2 bytes) { +return (bytes - 127.0) / 127.0; +} +highp float rand(in vec2 co) { +highp float a = 12.9898; +highp float b = 78.233; +highp float c = 43758.5453; +highp float dt = dot(co, vec2(a,b)); +highp float sn = mod(dt, 3.14); +return fract(sin(sn) * c); +}`, "vcommon.glsl": `#include +#include +#include +#include +#include +attribute vec2 a_pos; +attribute highp vec3 a_id; +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform highp mat3 u_tileMat3; +uniform highp mat3 u_viewMat3; +uniform highp float u_pixelRatio; +uniform mediump float u_zoomFactor; +uniform mediump float u_antialiasing; +uniform mediump float u_currentZoom; +vec4 VV_ADATA = vec4(0.0); +void loadVisualVariableData(inout vec4 target) { +#ifdef SUPPORTS_TEXTURE_FLOAT +target.rgba = getAttributeData2(a_id); +#else +vec4 data0 = getAttributeData2(a_id); +vec4 data1 = getAttributeData3(a_id); +target.r = u88VVToFloat(data0.rg * 255.0); +target.g = u88VVToFloat(data0.ba * 255.0); +target.b = u88VVToFloat(data1.rg * 255.0); +target.a = u88VVToFloat(data1.ba * 255.0); +#endif +} +#ifdef VV +#define INIT loadVisualVariableData(VV_ADATA) +#else +#define INIT +#endif +vec4 getColor(in vec4 a_color, in float a_bitSet, int index) { +#ifdef VV_COLOR +float isColorLocked = getBit(a_bitSet, index); +return getVVColor(VV_ADATA[ATTR_VV_COLOR], a_color, isColorLocked); +#else +return a_color; +#endif +} +float getOpacity() { +#ifdef VV_OPACITY +return getVVOpacity(VV_ADATA[ATTR_VV_OPACITY]); +#else +return 1.0; +#endif +} +float getSize(in float in_size) { +#ifdef VV_SIZE +return getVVSize(in_size, VV_ADATA[ATTR_VV_SIZE]); +#else +return in_size; +#endif +} +mat3 getRotation() { +#ifdef VV_ROTATION +return getVVRotationMat3(mod(VV_ADATA[ATTR_VV_ROTATION], 360.0)); +#else +return mat3(1.0); +#endif +} +float getFilterFlags() { +#ifdef IGNORES_SAMPLER_PRECISION +return ceil(getAttributeData0(a_id).x * 255.0); +#else +return getAttributeData0(a_id).x * 255.0; +#endif +} +vec4 getAnimationState() { +return getAttributeData1(a_id); +} +float getMinZoom() { +vec4 data0 = getAttributeData0(a_id) * 255.0; +return data0.g; +} +mat3 getMatrixNoDisplay(float isMapAligned) { +return isMapAligned * u_viewMat3 * u_tileMat3 + (1.0 - isMapAligned) * u_tileMat3; +} +mat3 getMatrix(float isMapAligned) { +return isMapAligned * u_displayViewMat3 + (1.0 - isMapAligned) * u_displayMat3; +} +vec3 clip(inout vec4 color, inout vec3 pos, in float filterFlags, in vec2 minMaxZoom) { +pos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 0)); +#ifdef INSIDE +pos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 1)); +#elif defined(OUTSIDE) +pos.z += 2.0 * getFilterBit(filterFlags, 1); +#elif defined(HIGHLIGHT) +#if !defined(HIGHLIGHT_ALL) +pos.z += 2.0 * (1.0 - getHighlightBit(filterFlags)); +#endif +#endif +pos.z += 2.0 * (step(minMaxZoom.y, u_currentZoom) + (1.0 - step(minMaxZoom.x, u_currentZoom))); +return pos; +}`, "vv.glsl": `#if defined(VV_SIZE_MIN_MAX_VALUE) || defined(VV_SIZE_SCALE_STOPS) || defined(VV_SIZE_FIELD_STOPS) || defined(VV_SIZE_UNIT_VALUE) +#define VV_SIZE +#endif +#if defined(VV_COLOR) || defined(VV_SIZE) || defined(VV_OPACITY) || defined(VV_ROTATION) +#define VV +#endif +#ifdef VV_COLOR +uniform highp float u_vvColorValues[8]; +uniform vec4 u_vvColors[8]; +#endif +#ifdef VV_SIZE_MIN_MAX_VALUE +uniform highp vec4 u_vvSizeMinMaxValue; +#endif +#ifdef VV_SIZE_SCALE_STOPS +uniform highp float u_vvSizeScaleStopsValue; +#endif +#ifdef VV_SIZE_FIELD_STOPS +uniform highp float u_vvSizeFieldStopsValues[6]; +uniform float u_vvSizeFieldStopsSizes[6]; +#endif +#ifdef VV_SIZE_UNIT_VALUE +uniform highp float u_vvSizeUnitValueWorldToPixelsRatio; +#endif +#ifdef VV_OPACITY +uniform highp float u_vvOpacityValues[8]; +uniform float u_vvOpacities[8]; +#endif +#ifdef VV_ROTATION +uniform lowp float u_vvRotationType; +#endif +bool isNan(float val) { +return (val == NAN_MAGIC_NUMBER); +} +#ifdef VV_SIZE_MIN_MAX_VALUE +float getVVMinMaxSize(float sizeValue, float fallback) { +if (isNan(sizeValue)) { +return fallback; +} +float interpolationRatio = (sizeValue - u_vvSizeMinMaxValue.x) / (u_vvSizeMinMaxValue.y - u_vvSizeMinMaxValue.x); +interpolationRatio = clamp(interpolationRatio, 0.0, 1.0); +return u_vvSizeMinMaxValue.z + interpolationRatio * (u_vvSizeMinMaxValue.w - u_vvSizeMinMaxValue.z); +} +#endif +#ifdef VV_SIZE_FIELD_STOPS +const int VV_SIZE_N = 6; +float getVVStopsSize(float sizeValue, float fallback) { +if (isNan(sizeValue)) { +return fallback; +} +if (sizeValue <= u_vvSizeFieldStopsValues[0]) { +return u_vvSizeFieldStopsSizes[0]; +} +for (int i = 1; i < VV_SIZE_N; ++i) { +if (u_vvSizeFieldStopsValues[i] >= sizeValue) { +float f = (sizeValue - u_vvSizeFieldStopsValues[i-1]) / (u_vvSizeFieldStopsValues[i] - u_vvSizeFieldStopsValues[i-1]); +return mix(u_vvSizeFieldStopsSizes[i-1], u_vvSizeFieldStopsSizes[i], f); +} +} +return u_vvSizeFieldStopsSizes[VV_SIZE_N - 1]; +} +#endif +#ifdef VV_SIZE_UNIT_VALUE +float getVVUnitValue(float sizeValue, float fallback) { +if (isNan(sizeValue)) { +return fallback; +} +return u_vvSizeUnitValueWorldToPixelsRatio * sizeValue; +} +#endif +#ifdef VV_OPACITY +const int VV_OPACITY_N = 8; +float getVVOpacity(float opacityValue) { +if (isNan(opacityValue)) { +return 1.0; +} +if (opacityValue <= u_vvOpacityValues[0]) { +return u_vvOpacities[0]; +} +for (int i = 1; i < VV_OPACITY_N; ++i) { +if (u_vvOpacityValues[i] >= opacityValue) { +float f = (opacityValue - u_vvOpacityValues[i-1]) / (u_vvOpacityValues[i] - u_vvOpacityValues[i-1]); +return mix(u_vvOpacities[i-1], u_vvOpacities[i], f); +} +} +return u_vvOpacities[VV_OPACITY_N - 1]; +} +#endif +#ifdef VV_ROTATION +mat4 getVVRotation(float rotationValue) { +if (isNan(rotationValue)) { +return mat4(1, 0, 0, 0, +0, 1, 0, 0, +0, 0, 1, 0, +0, 0, 0, 1); +} +float rotation = rotationValue; +if (u_vvRotationType == 1.0) { +rotation = 90.0 - rotation; +} +float angle = C_DEG_TO_RAD * rotation; +float sinA = sin(angle); +float cosA = cos(angle); +return mat4(cosA, sinA, 0, 0, +-sinA, cosA, 0, 0, +0, 0, 1, 0, +0, 0, 0, 1); +} +mat3 getVVRotationMat3(float rotationValue) { +if (isNan(rotationValue)) { +return mat3(1, 0, 0, +0, 1, 0, +0, 0, 1); +} +float rotation = rotationValue; +if (u_vvRotationType == 1.0) { +rotation = 90.0 - rotation; +} +float angle = C_DEG_TO_RAD * -rotation; +float sinA = sin(angle); +float cosA = cos(angle); +return mat3(cosA, -sinA, 0, +sinA, cosA, 0, +0, 0, 1); +} +#endif +#ifdef VV_COLOR +const int VV_COLOR_N = 8; +vec4 getVVColor(float colorValue, vec4 fallback, float isColorLocked) { +if (isNan(colorValue) || isColorLocked == 1.0) { +return fallback; +} +if (colorValue <= u_vvColorValues[0]) { +return u_vvColors[0]; +} +for (int i = 1; i < VV_COLOR_N; ++i) { +if (u_vvColorValues[i] >= colorValue) { +float f = (colorValue - u_vvColorValues[i-1]) / (u_vvColorValues[i] - u_vvColorValues[i-1]); +return mix(u_vvColors[i-1], u_vvColors[i], f); +} +} +return u_vvColors[VV_COLOR_N - 1]; +} +#endif +float getVVSize(in float size, in float vvSize) { +#ifdef VV_SIZE_MIN_MAX_VALUE +return getVVMinMaxSize(vvSize, size); +#elif defined(VV_SIZE_SCALE_STOPS) +return u_vvSizeScaleStopsValue; +#elif defined(VV_SIZE_FIELD_STOPS) +float outSize = getVVStopsSize(vvSize, size); +return isNan(outSize) ? size : outSize; +#elif defined(VV_SIZE_UNIT_VALUE) +return getVVUnitValue(vvSize, size); +#else +return size; +#endif +}` }, overlay: { overlay: { "overlay.frag": `precision lowp float; +uniform lowp sampler2D u_texture; +uniform lowp float u_opacity; +varying mediump vec2 v_uv; +void main() { +vec4 color = texture2D(u_texture, v_uv); +gl_FragColor = color * u_opacity; +}`, "overlay.vert": `precision mediump float; +attribute vec2 a_pos; +attribute vec2 a_uv; +uniform highp mat3 u_dvsMat3; +uniform mediump vec2 u_perspective; +varying mediump vec2 v_uv; +void main(void) { +v_uv = a_uv; +float w = 1.0 + dot(a_uv, u_perspective); +vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0); +gl_Position = vec4(w * pos.xy, 0.0, w); +}` } }, "post-processing": { blit: { "blit.frag": `precision mediump float; +uniform sampler2D u_texture; +varying vec2 v_uv; +void main() { +gl_FragColor = texture2D(u_texture, v_uv); +}` }, bloom: { composite: { "composite.frag": `precision mediump float; +varying vec2 v_uv; +uniform sampler2D u_blurTexture1; +uniform sampler2D u_blurTexture2; +uniform sampler2D u_blurTexture3; +uniform sampler2D u_blurTexture4; +uniform sampler2D u_blurTexture5; +uniform float u_bloomStrength; +uniform float u_bloomRadius; +uniform float u_bloomFactors[NUMMIPS]; +uniform vec3 u_bloomTintColors[NUMMIPS]; +float lerpBloomFactor(const in float factor) { +float mirrorFactor = 1.2 - factor; +return mix(factor, mirrorFactor, u_bloomRadius); +} +void main() { +vec4 color = u_bloomStrength * ( +lerpBloomFactor(u_bloomFactors[0]) * vec4(u_bloomTintColors[0], 1.0) * texture2D(u_blurTexture1, v_uv) + +lerpBloomFactor(u_bloomFactors[1]) * vec4(u_bloomTintColors[1], 1.0) * texture2D(u_blurTexture2, v_uv) + +lerpBloomFactor(u_bloomFactors[2]) * vec4(u_bloomTintColors[2], 1.0) * texture2D(u_blurTexture3, v_uv) + +lerpBloomFactor(u_bloomFactors[3]) * vec4(u_bloomTintColors[3], 1.0) * texture2D(u_blurTexture4, v_uv) + +lerpBloomFactor(u_bloomFactors[4]) * vec4(u_bloomTintColors[4], 1.0) * texture2D(u_blurTexture5, v_uv) +); +gl_FragColor = clamp(color, 0.0, 1.0); +}` }, gaussianBlur: { "gaussianBlur.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +uniform vec2 u_texSize; +uniform vec2 u_direction; +varying vec2 v_uv; +#define KERNEL_RADIUS RADIUS +#define SIGMA RADIUS +float gaussianPdf(in float x, in float sigma) { +return 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma; +} +void main() { +vec2 invSize = 1.0 / u_texSize; +float fSigma = float(SIGMA); +float weightSum = gaussianPdf(0.0, fSigma); +vec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum; +for (int i = 1; i < KERNEL_RADIUS; i ++) { +float x = float(i); +float w = gaussianPdf(x, fSigma); +vec2 uvOffset = u_direction * invSize * x; +vec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset); +vec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset); +pixelColorSum += (sample1 + sample2) * w; +weightSum += 2.0 * w; +} +gl_FragColor = pixelColorSum /weightSum; +}` }, luminosityHighPass: { "luminosityHighPass.frag": `precision mediump float; +uniform sampler2D u_texture; +uniform vec3 u_defaultColor; +uniform float u_defaultOpacity; +uniform float u_luminosityThreshold; +uniform float u_smoothWidth; +varying vec2 v_uv; +void main() { +vec4 texel = texture2D(u_texture, v_uv); +vec3 luma = vec3(0.299, 0.587, 0.114); +float v = dot(texel.xyz, luma); +vec4 outputColor = vec4(u_defaultColor.rgb, u_defaultOpacity); +float alpha = smoothstep(u_luminosityThreshold, u_luminosityThreshold + u_smoothWidth, v); +gl_FragColor = mix(outputColor, texel, alpha); +}` } }, blur: { gaussianBlur: { "gaussianBlur.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +uniform vec2 u_texSize; +uniform vec2 u_direction; +uniform float u_sigma; +varying vec2 v_uv; +#define KERNEL_RADIUS RADIUS +float gaussianPdf(in float x, in float sigma) { +return 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma; +} +void main() { +vec2 invSize = 1.0 / u_texSize; +float fSigma = u_sigma; +float weightSum = gaussianPdf(0.0, fSigma); +vec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum; +for (int i = 1; i < KERNEL_RADIUS; i ++) { +float x = float(i); +float w = gaussianPdf(x, fSigma); +vec2 uvOffset = u_direction * invSize * x; +vec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset); +vec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset); +pixelColorSum += (sample1 + sample2) * w; +weightSum += 2.0 * w; +} +gl_FragColor = pixelColorSum /weightSum; +}` }, "radial-blur": { "radial-blur.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +varying vec2 v_uv; +const float sampleDist = 1.0; +const float sampleStrength = 2.2; +void main(void) { +float samples[10]; +samples[0] = -0.08; +samples[1] = -0.05; +samples[2] = -0.03; +samples[3] = -0.02; +samples[4] = -0.01; +samples[5] = 0.01; +samples[6] = 0.02; +samples[7] = 0.03; +samples[8] = 0.05; +samples[9] = 0.08; +vec2 dir = 0.5 - v_uv; +float dist = sqrt(dir.x * dir.x + dir.y * dir.y); +dir = dir / dist; +vec4 color = texture2D(u_colorTexture,v_uv); +vec4 sum = color; +for (int i = 0; i < 10; i++) { +sum += texture2D(u_colorTexture, v_uv + dir * samples[i] * sampleDist); +} +sum *= 1.0 / 11.0; +float t = dist * sampleStrength; +t = clamp(t, 0.0, 1.0); +gl_FragColor = mix(color, sum, t); +}` } }, dra: { "dra.frag": `precision mediump float; +uniform sampler2D u_minColor; +uniform sampler2D u_maxColor; +uniform sampler2D u_texture; +varying vec2 v_uv; +void main() { +vec4 minColor = texture2D(u_minColor, vec2(0.5)); +vec4 maxColor = texture2D(u_maxColor, vec2(0.5)); +vec4 color = texture2D(u_texture, v_uv); +vec3 minColorUnpremultiply = minColor.rgb / minColor.a; +vec3 maxColorUnpremultiply = maxColor.rgb / maxColor.a; +vec3 colorUnpremultiply = color.rgb / color.a; +vec3 range = maxColorUnpremultiply - minColorUnpremultiply; +gl_FragColor = vec4(color.a * (colorUnpremultiply - minColorUnpremultiply) / range, color.a); +}`, "min-max": { "min-max.frag": `#extension GL_EXT_draw_buffers : require +precision mediump float; +#define CELL_SIZE 2 +uniform sampler2D u_minTexture; +uniform sampler2D u_maxTexture; +uniform vec2 u_srcResolution; +uniform vec2 u_dstResolution; +varying vec2 v_uv; +void main() { +vec2 srcPixel = floor(gl_FragCoord.xy) * float(CELL_SIZE); +vec2 onePixel = vec2(1.0) / u_srcResolution; +vec2 uv = (srcPixel + 0.5) / u_srcResolution; +vec4 minColor = vec4(1.0); +vec4 maxColor = vec4(0.0); +for (int y = 0; y < CELL_SIZE; ++y) { +for (int x = 0; x < CELL_SIZE; ++x) { +vec2 offset = uv + vec2(x, y) * onePixel; +minColor = min(minColor, texture2D(u_minTexture, offset)); +maxColor = max(maxColor, texture2D(u_maxTexture, offset)); +} +} +gl_FragData[0] = minColor; +gl_FragData[1] = maxColor; +}` } }, "drop-shadow": { composite: { "composite.frag": `precision mediump float; +uniform sampler2D u_layerFBOTexture; +uniform sampler2D u_blurTexture; +uniform vec4 u_shadowColor; +uniform vec2 u_shadowOffset; +uniform highp mat3 u_displayViewMat3; +varying vec2 v_uv; +void main() { +vec3 offset = u_displayViewMat3 * vec3(u_shadowOffset, 0.0); +vec4 layerColor = texture2D(u_layerFBOTexture, v_uv); +vec4 blurColor = texture2D(u_blurTexture, v_uv - offset.xy / 2.0); +gl_FragColor = ((1.0 - layerColor.a) * blurColor.a * u_shadowColor + layerColor); +}` } }, "edge-detect": { "frei-chen": { "frei-chen.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +uniform vec2 u_texSize; +varying vec2 v_uv; +vec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y); +mat3 G[9]; +const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 ); +const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 ); +const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 ); +const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 ); +const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 ); +const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 ); +const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 ); +const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 ); +const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 ); +void main() { +G[0] = g0, +G[1] = g1, +G[2] = g2, +G[3] = g3, +G[4] = g4, +G[5] = g5, +G[6] = g6, +G[7] = g7, +G[8] = g8; +mat3 I; +float cnv[9]; +vec3 sample; +for (float i = 0.0; i < 3.0; i++) { +for (float j = 0.0; j < 3.0; j++) { +sample = texture2D(u_colorTexture, v_uv + texel * vec2(i - 1.0,j - 1.0)).rgb; +I[int(i)][int(j)] = length(sample); +} +} +for (int i = 0; i < 9; i++) { +float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); +cnv[i] = dp3 * dp3; +} +float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]); +float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M); +gl_FragColor = vec4(vec3(sqrt(M / S)), texture2D(u_colorTexture, v_uv).a); +}` }, sobel: { "sobel.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +varying vec2 v_uv; +uniform vec2 u_texSize; +vec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y); +mat3 G[2]; +const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 ); +const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 ); +void main() { +mat3 I; +float cnv[2]; +vec3 sample; +G[0] = g0; +G[1] = g1; +for (float i = 0.0; i < 3.0; i++) { +for (float j = 0.0; j < 3.0; j++) { +sample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb; +I[int(i)][int(j)] = length(sample); +} +} +for (int i = 0; i < 2; i++) { +float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); +cnv[i] = dp3 * dp3; +} +gl_FragColor = vec4(vec3(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1])), texture2D(u_colorTexture, v_uv).a); +}` } }, "edge-enhance": { "edge-enhance.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +varying vec2 v_uv; +uniform vec2 u_texSize; +vec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y); +mat3 G[2]; +const mat3 g0 = mat3( 1.0, 0.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, -1.0 ); +const mat3 g1 = mat3( 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0 ); +void main() { +mat3 I; +float cnv[2]; +vec3 sample; +G[0] = g0; +G[1] = g1; +for (float i = 0.0; i < 3.0; i++) { +for (float j = 0.0; j < 3.0; j++) { +sample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb; +I[int(i)][int(j)] = length(sample); +} +} +for (int i = 0; i < 2; i++) { +float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); +cnv[i] = dp3 * dp3; +} +vec4 color = texture2D(u_colorTexture, v_uv); +gl_FragColor = vec4(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1]) * color); +}` }, filterEffect: { "filterEffect.frag": `precision mediump float; +uniform sampler2D u_colorTexture; +uniform mat4 u_coefficients; +varying vec2 v_uv; +void main() { +vec4 color = texture2D(u_colorTexture, v_uv); +vec4 rgbw = u_coefficients * vec4(color.a > 0.0 ? color.rgb / color.a : vec3(0.0), 1.0); +float a = color.a; +gl_FragColor = vec4(a * rgbw.rgb, a); +}` }, pp: { "pp.vert": `precision mediump float; +attribute vec2 a_position; +varying vec2 v_uv; +void main() { +gl_Position = vec4(a_position, 0.0, 1.0); +v_uv = (a_position + 1.0) / 2.0; +}` } }, raster: { bitmap: { "bitmap.frag": `precision mediump float; +varying highp vec2 v_texcoord; +uniform sampler2D u_texture; +uniform highp vec2 u_coordScale; +uniform lowp float u_opacity; +#include +void main() { +#ifdef BICUBIC +vec4 color = sampleBicubicBSpline(u_texture, v_texcoord, u_coordScale); +#else +vec4 color = texture2D(u_texture, v_texcoord); +#endif +gl_FragColor = vec4(color.rgb * u_opacity, color.a * u_opacity); +}`, "bitmap.vert": `precision mediump float; +attribute vec2 a_pos; +uniform highp mat3 u_dvsMat3; +uniform highp vec2 u_coordScale; +varying highp vec2 v_texcoord; +void main() +{ +v_texcoord = a_pos; +gl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0); +}` }, common: { "common.glsl": `uniform sampler2D u_image; +uniform int u_bandCount; +uniform bool u_flipY; +uniform float u_opacity; +uniform int u_resampling; +uniform vec2 u_srcImageSize; +#ifdef APPLY_PROJECTION +#include +#endif +#ifdef BICUBIC +#include +#endif +#ifdef BILINEAR +#include +#endif +vec2 getPixelLocation(vec2 coords) { +vec2 targetLocation = u_flipY ? vec2(coords.s, 1.0 - coords.t) : coords; +#ifdef APPLY_PROJECTION +targetLocation = projectPixelLocation(targetLocation); +#endif +return targetLocation; +} +bool isOutside(vec2 coords){ +if (coords.t>1.00001 ||coords.t<-0.00001 || coords.s>1.00001 ||coords.s<-0.00001) { +return true; +} else { +return false; +} +} +vec4 getPixel(vec2 pixelLocation) { +#ifdef BICUBIC +vec4 color = sampleBicubicBSpline(u_image, pixelLocation, u_srcImageSize); +#elif defined(BILINEAR) +vec4 color = sampleBilinear(u_image, pixelLocation, u_srcImageSize); +#else +vec4 color = texture2D(u_image, pixelLocation); +#endif +return color; +}`, "common.vert": `precision mediump float; +attribute vec2 a_pos; +uniform highp mat3 u_dvsMat3; +uniform highp vec2 u_coordScale; +uniform highp float u_scale; +uniform highp vec2 u_offset; +varying highp vec2 v_texcoord; +void main() +{ +v_texcoord = a_pos * u_scale + u_offset; +gl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0); +}`, "contrastBrightness.glsl": `uniform float u_contrastOffset; +uniform float u_brightnessOffset; +vec4 adjustContrastBrightness(vec4 currentPixel, bool isFloat) { +vec4 pixelValue = isFloat ? currentPixel * 255.0 : currentPixel; +float maxI = 255.0; +float mid = 128.0; +float c = u_contrastOffset; +float b = u_brightnessOffset; +vec4 v; +if (c > 0.0 && c < 100.0) { +v = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) / (2.0 * (100.0 - c)) + mid; +} else if (c <= 0.0 && c > -100.0) { +v = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) * (100.0 + c) / 20000.0 + mid; +} else if (c == 100.0) { +v = (200.0 * pixelValue - 100.0 * maxI + (maxI + 1.0) * (100.0 - c) + 2.0 * maxI * b); +v = (sign(v) + 1.0) / 2.0; +} else if (c == -100.0) { +v = vec4(mid, mid, mid, currentPixel.a); +} +return vec4(v.r / 255.0, v.g / 255.0, v.b / 255.0, currentPixel.a); +}`, "inverse.glsl": `float invertValue(float value) { +float s = sign(value); +return (s * s) / (value + abs(s) - 1.0); +}`, "mirror.glsl": `vec2 mirror(vec2 pos) { +vec2 pos1 = abs(pos); +return step(pos1, vec2(1.0, 1.0)) * pos1 + step(1.0, pos1) * (2.0 - pos1); +}`, "projection.glsl": `uniform sampler2D u_transformGrid; +uniform vec2 u_transformSpacing; +uniform vec2 u_transformGridSize; +uniform vec2 u_targetImageSize; +vec2 projectPixelLocation(vec2 coords) { +#ifdef LOOKUP_PROJECTION +vec4 pv = texture2D(u_transformGrid, coords); +return vec2(pv.r, pv.g); +#endif +vec2 index_image = floor(coords * u_targetImageSize); +vec2 oneTransformPixel = vec2(0.25 / u_transformGridSize.s, 1.0 / u_transformGridSize.t); +vec2 index_transform = floor(index_image / u_transformSpacing) / u_transformGridSize; +vec2 pos = fract((index_image + vec2(0.5, 0.5)) / u_transformSpacing); +vec2 srcLocation; +vec2 transform_location = index_transform + oneTransformPixel * 0.5; +if (pos.s <= pos.t) { +vec4 ll_abc = texture2D(u_transformGrid, vec2(transform_location.s, transform_location.t)); +vec4 ll_def = texture2D(u_transformGrid, vec2(transform_location.s + oneTransformPixel.s, transform_location.t)); +srcLocation.s = dot(ll_abc.rgb, vec3(pos, 1.0)); +srcLocation.t = dot(ll_def.rgb, vec3(pos, 1.0)); +} else { +vec4 ur_abc = texture2D(u_transformGrid, vec2(transform_location.s + 2.0 * oneTransformPixel.s, transform_location.t)); +vec4 ur_def = texture2D(u_transformGrid, vec2(transform_location.s + 3.0 * oneTransformPixel.s, transform_location.t)); +srcLocation.s = dot(ur_abc.rgb, vec3(pos, 1.0)); +srcLocation.t = dot(ur_def.rgb, vec3(pos, 1.0)); +} +return srcLocation; +}` }, flow: { "getFadeOpacity.glsl": `uniform float u_decayRate; +uniform float u_fadeToZero; +float getFadeOpacity(float x) { +float cutOff = mix(0.0, exp(-u_decayRate), u_fadeToZero); +return (exp(-u_decayRate * x) - cutOff) / (1.0 - cutOff); +}`, "getFragmentColor.glsl": `vec4 getFragmentColor(vec4 color, float dist, float size, float featheringSize) { +float featheringStart = clamp(0.5 - featheringSize / size, 0.0, 0.5); +if (dist > featheringStart) { +color *= 1.0 - (dist - featheringStart) / (0.5 - featheringStart); +} +return color; +}`, imagery: { "imagery.frag": `precision highp float; +varying vec2 v_texcoord; +uniform sampler2D u_texture; +uniform float u_Min; +uniform float u_Max; +uniform float u_featheringSize; +#include +float getIntensity(float v) { +return u_Min + v * (u_Max - u_Min); +} +void main(void) { +vec4 sampled = texture2D(u_texture, v_texcoord); +float intensity = getIntensity(sampled.r); +gl_FragColor = getColor(intensity); +gl_FragColor.a *= getOpacity(sampled.r); +gl_FragColor.a *= sampled.a; +gl_FragColor.rgb *= gl_FragColor.a; +}`, "imagery.vert": `attribute vec2 a_position; +attribute vec2 a_texcoord; +uniform mat3 u_dvsMat3; +varying vec2 v_texcoord; +void main(void) { +vec2 xy = (u_dvsMat3 * vec3(a_position, 1.0)).xy; +gl_Position = vec4(xy, 0.0, 1.0); +v_texcoord = a_texcoord; +}` }, particles: { "particles.frag": `precision highp float; +varying vec4 v_color; +varying vec2 v_texcoord; +varying float v_size; +uniform float u_featheringSize; +#include +void main(void) { +gl_FragColor = getFragmentColor(v_color, length(v_texcoord - 0.5), v_size, u_featheringSize); +}`, "particles.vert": `attribute vec4 a_xyts0; +attribute vec4 a_xyts1; +attribute vec4 a_typeIdDurationSeed; +attribute vec4 a_extrudeInfo; +uniform mat3 u_dvsMat3; +uniform mat3 u_displayViewMat3; +uniform float u_time; +uniform float u_trailLength; +uniform float u_flowSpeed; +varying vec4 v_color; +varying vec2 v_texcoord; +varying float v_size; +uniform float u_featheringSize; +uniform float u_introFade; +#include +#include +void main(void) { +vec2 position0 = a_xyts0.xy; +float t0 = a_xyts0.z; +float speed0 = a_xyts0.w; +vec2 position1 = a_xyts1.xy; +float t1 = a_xyts1.z; +float speed1 = a_xyts1.w; +float type = a_typeIdDurationSeed.x; +float id = a_typeIdDurationSeed.y; +float duration = a_typeIdDurationSeed.z; +float seed = a_typeIdDurationSeed.w; +vec2 e0 = a_extrudeInfo.xy; +vec2 e1 = a_extrudeInfo.zw; +float animationPeriod = duration + u_trailLength; +float scaledTime = u_time * u_flowSpeed; +float randomizedTime = scaledTime + seed * animationPeriod; +float t = mod(randomizedTime, animationPeriod); +float fUnclamped = (t - t0) / (t1 - t0); +float f = clamp(fUnclamped, 0.0, 1.0); +float clampedTime = mix(t0, t1, f); +float speed = mix(speed0, speed1, f); +vec2 extrude; +vec2 position; +float fadeOpacity; +float introOpacity; +if (type == 2.0) { +if (fUnclamped < 0.0 || (fUnclamped > 1.0 && t1 != duration)) { +gl_Position = vec4(0.0, 0.0, -2.0, 1.0); +return; +} +vec2 ortho = mix(e0, e1, f); +vec2 parallel; +parallel = normalize(position1 - position0) * 0.5; +if (id == 1.0) { +extrude = ortho; +v_texcoord = vec2(0.5, 0.0); +} else if (id == 2.0) { +extrude = -ortho; +v_texcoord = vec2(0.5, 1.0); +} else if (id == 3.0) { +extrude = ortho + parallel; +v_texcoord = vec2(1.0, 0.0); +} else if (id == 4.0) { +extrude = -ortho + parallel; +v_texcoord = vec2(1.0, 1.0); +} +fadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength); +introOpacity = 1.0 - exp(-clampedTime); +v_size = getSize(speed); +v_color = getColor(speed); +v_color.a *= getOpacity(speed); +position = mix(position0, position1, f); +} else { +if (fUnclamped < 0.0) { +gl_Position = vec4(0.0, 0.0, -2.0, 1.0); +return; +} +if (id == 1.0) { +extrude = e0; +v_texcoord = vec2(0.5, 0.0); +fadeOpacity = getFadeOpacity((t - t0) / u_trailLength); +introOpacity = 1.0 - exp(-t0); +v_size = getSize(speed0); +v_color = getColor(speed0); +v_color.a *= getOpacity(speed0); +position = position0; +} else if (id == 2.0) { +extrude = -e0; +v_texcoord = vec2(0.5, 1.0); +fadeOpacity = getFadeOpacity((t - t0) / u_trailLength); +introOpacity = 1.0 - exp(-t0); +v_size = getSize(speed0); +v_color = getColor(speed0); +v_color.a *= getOpacity(speed0); +position = position0; +} else if (id == 3.0) { +extrude = mix(e0, e1, f); +v_texcoord = vec2(0.5, 0.0); +fadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength); +introOpacity = 1.0 - exp(-clampedTime); +v_size = getSize(speed); +v_color = getColor(speed); +v_color.a *= getOpacity(speed); +position = mix(position0, position1, f); +} else if (id == 4.0) { +extrude = -mix(e0, e1, f); +v_texcoord = vec2(0.5, 1.0); +fadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength); +introOpacity = 1.0 - exp(-clampedTime); +v_size = getSize(speed); +v_color = getColor(speed); +v_color.a *= getOpacity(speed); +position = mix(position0, position1, f); +} +} +vec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(extrude * v_size, 0.0)).xy; +gl_Position = vec4(xy, 0.0, 1.0); +v_color.a *= fadeOpacity; +v_color.a *= mix(1.0, introOpacity, u_introFade); +v_color.rgb *= v_color.a; +}` }, streamlines: { "streamlines.frag": `precision highp float; +varying float v_side; +varying float v_time; +varying float v_totalTime; +varying float v_timeSeed; +varying vec4 v_color; +varying float v_size; +uniform float u_time; +uniform float u_trailLength; +uniform float u_flowSpeed; +uniform float u_featheringSize; +uniform float u_introFade; +#include +#include +void main(void) { +float t = mod(v_timeSeed * (v_totalTime + u_trailLength) + u_time * u_flowSpeed, v_totalTime + u_trailLength) - v_time; +vec4 color = v_color * step(0.0, t) * getFadeOpacity(t / u_trailLength); +color *= mix(1.0, 1.0 - exp(-v_time), u_introFade); +gl_FragColor = getFragmentColor(color, length((v_side + 1.0) / 2.0 - 0.5), v_size, u_featheringSize); +}`, "streamlines.vert": `attribute vec3 a_positionAndSide; +attribute vec3 a_timeInfo; +attribute vec2 a_extrude; +attribute float a_speed; +uniform mat3 u_dvsMat3; +uniform mat3 u_displayViewMat3; +varying float v_time; +varying float v_totalTime; +varying float v_timeSeed; +varying vec4 v_color; +varying float v_side; +varying float v_size; +uniform float u_featheringSize; +#include +void main(void) { +vec4 lineColor = getColor(a_speed); +float lineOpacity = getOpacity(a_speed); +float lineSize = getSize(a_speed); +vec2 position = a_positionAndSide.xy; +v_side = a_positionAndSide.z; +vec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(a_extrude * lineSize, 0.0)).xy; +gl_Position = vec4(xy, 0.0, 1.0); +v_time = a_timeInfo.x; +v_totalTime = a_timeInfo.y; +v_timeSeed = a_timeInfo.z; +v_color = lineColor; +v_color.a *= lineOpacity; +v_color.rgb *= v_color.a; +v_size = lineSize; +}` }, "vv.glsl": `#define MAX_STOPS 8 +#ifdef VV_COLOR +uniform float u_color_stops[MAX_STOPS]; +uniform vec4 u_color_values[MAX_STOPS]; +uniform int u_color_count; +#else +uniform vec4 u_color; +#endif +#ifdef VV_OPACITY +uniform float u_opacity_stops[MAX_STOPS]; +uniform float u_opacity_values[MAX_STOPS]; +uniform int u_opacity_count; +#else +uniform float u_opacity; +#endif +#ifdef VV_SIZE +uniform float u_size_stops[MAX_STOPS]; +uniform float u_size_values[MAX_STOPS]; +uniform int u_size_count; +#else +uniform float u_size; +#endif +uniform float u_featheringOffset; +vec4 getColor(float x) { +#ifdef VV_COLOR +vec4 color = u_color_values[0]; +{ +for (int i = 1; i < MAX_STOPS; i++) { +if (i >= u_color_count) { +break; +} +float x1 = u_color_stops[i - 1]; +if (x < x1) { +break; +} +float x2 = u_color_stops[i]; +vec4 y2 = u_color_values[i]; +if (x < x2) { +vec4 y1 = u_color_values[i - 1]; +color = y1 + (y2 - y1) * (x - x1) / (x2 - x1); +} else { +color = y2; +} +} +} +#else +vec4 color = u_color; +#endif +return color; +} +float getOpacity(float x) { +#ifdef VV_OPACITY +float opacity = u_opacity_values[0]; +{ +for (int i = 1; i < MAX_STOPS; i++) { +if (i >= u_opacity_count) { +break; +} +float x1 = u_opacity_stops[i - 1]; +if (x < x1) { +break; +} +float x2 = u_opacity_stops[i]; +float y2 = u_opacity_values[i]; +if (x < x2) { +float y1 = u_opacity_values[i - 1]; +opacity = y1 + (y2 - y1) * (x - x1) / (x2 - x1); +} else { +opacity = y2; +} +} +} +#else +float opacity = u_opacity; +#endif +return opacity; +} +float getSize(float x) { +#ifdef VV_SIZE +float size = u_size_values[0]; +{ +for (int i = 1; i < MAX_STOPS; i++) { +if (i >= u_size_count) { +break; +} +float x1 = u_size_stops[i - 1]; +if (x < x1) { +break; +} +float x2 = u_size_stops[i]; +float y2 = u_size_values[i]; +if (x < x2) { +float y1 = u_size_values[i - 1]; +size = y1 + (y2 - y1) * (x - x1) / (x2 - x1); +} else { +size = y2; +} +} +} +#else +float size = u_size; +#endif +return size + 2.0 * u_featheringSize * u_featheringOffset; +}` }, hillshade: { "hillshade.frag": `precision mediump float; +varying highp vec2 v_texcoord; +#include +uniform int u_hillshadeType; +uniform float u_sinZcosAs[6]; +uniform float u_sinZsinAs[6]; +uniform float u_cosZs[6]; +uniform float u_weights[6]; +uniform vec2 u_factor; +uniform float u_minValue; +uniform float u_maxValue; +#include +float getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){ +if (a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0) { +return 0.0; +} +else { +return e; +} +} +vec3 rgb2hsv(vec3 c) { +vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); +vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); +vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); +float d = q.x - min(q.w, q.y); +float e = 1.0e-10; +return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x); +} +vec3 hsv2rgb(vec3 c) { +vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); +vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); +return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} +vec4 overlay(float val, float minValue, float maxValue, float hillshade) { +val = clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0); +vec4 rgb = colorize(vec4(val, val, val, 1.0), 255.0); +vec3 hsv = rgb2hsv(rgb.xyz); +hsv.z = hillshade; +return vec4(hsv2rgb(hsv), 1.0) * rgb.a; +} +void main() { +vec2 pixelLocation = getPixelLocation(v_texcoord); +if (isOutside(pixelLocation)) { +gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +return; +} +vec4 currentPixel = getPixel(pixelLocation); +if (currentPixel.a == 0.0) { +gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +return; +} +vec2 axy = vec2(-1.0, -1.0); +vec2 bxy = vec2(0.0, -1.0); +vec2 cxy = vec2(1.0, -1.0); +vec2 dxy = vec2(-1.0, 0.0); +vec2 fxy = vec2(1.0, 0.0); +vec2 gxy = vec2(-1.0, 1.0); +vec2 hxy = vec2(0.0, 1.0); +vec2 ixy = vec2(1.0, 1.0); +vec2 onePixel = 1.0 / u_srcImageSize; +if (pixelLocation.s < onePixel.s) { +axy[0] = 1.0; +dxy[0] = 1.0; +gxy[0] = 1.0; +} +if (pixelLocation.t < onePixel.t) { +axy[1] = 1.0; +bxy[1] = 1.0; +cxy[1] = 1.0; +} +if (pixelLocation.s > 1.0 - onePixel.s) { +cxy[0] = -1.0; +fxy[0] = -1.0; +ixy[0] = -1.0; +} +if (pixelLocation.t > 1.0 - onePixel.t) { +gxy[1] = -1.0; +hxy[1] = -1.0; +ixy[1] = -1.0; +} +vec4 va = texture2D(u_image, pixelLocation + onePixel * axy); +vec4 vb = texture2D(u_image, pixelLocation + onePixel * bxy); +vec4 vc = texture2D(u_image, pixelLocation + onePixel * cxy); +vec4 vd = texture2D(u_image, pixelLocation + onePixel * dxy); +vec4 ve = texture2D(u_image, pixelLocation); +vec4 vf = texture2D(u_image, pixelLocation + onePixel * fxy); +vec4 vg = texture2D(u_image, pixelLocation + onePixel * gxy); +vec4 vh = texture2D(u_image, pixelLocation + onePixel * hxy); +vec4 vi = texture2D(u_image, pixelLocation + onePixel * ixy); +float dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * u_factor.s; +float dzy = (vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * u_factor.t; +float dzd = sqrt(1.0 + dzx * dzx + dzy * dzy); +float hillshade = 0.0; +if (u_hillshadeType == 0){ +float cosDelta = u_sinZsinAs[0] * dzy - u_sinZcosAs[0] * dzx; +float z = (u_cosZs[0] + cosDelta) / dzd; +if (z < 0.0) z = 0.0; +hillshade = z; +} else { +for (int k = 0; k < 6; k++) { +float cosDelta = u_sinZsinAs[k] * dzy - u_sinZcosAs[k] * dzx; +float z = (u_cosZs[k] + cosDelta) / dzd; +if (z < 0.0) z = 0.0; +hillshade = hillshade + z * u_weights[k]; +if (k == 5) break; +} +} +float alpha = getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a); +#ifdef APPLY_COLORMAP +gl_FragColor = overlay(ve.r, u_minValue, u_maxValue, hillshade) * alpha * u_opacity; +#else +gl_FragColor = vec4(hillshade, hillshade, hillshade, 1.0) * alpha * u_opacity; +#endif +}` }, lut: { "colorize.glsl": `uniform sampler2D u_colormap; +uniform float u_colormapOffset; +uniform float u_colormapMaxIndex; +vec4 colorize(vec4 currentPixel, float scaleFactor) { +float clrIndex = clamp(currentPixel.r * scaleFactor - u_colormapOffset, 0.0, u_colormapMaxIndex); +vec2 clrPosition = vec2((clrIndex + 0.5) / (u_colormapMaxIndex + 1.0), 0.0); +vec4 color = texture2D(u_colormap, clrPosition); +vec4 result = vec4(color.rgb, color.a * currentPixel.a); +return result; +}`, "lut.frag": `precision mediump float; +varying highp vec2 v_texcoord; +#include +#include +void main() { +vec2 pixelLocation = getPixelLocation(v_texcoord); +if (isOutside(pixelLocation)) { +gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +return; +} +vec4 currentPixel = getPixel(pixelLocation); +vec4 result = colorize(currentPixel, 1.0); +gl_FragColor = vec4(result.xyz, 1.0) * result.a * u_opacity; +}` }, magdir: { "magdir.frag": `precision mediump float; +varying vec4 v_color; +uniform lowp float u_opacity; +void main() { +gl_FragColor = v_color * u_opacity; +}`, "magdir.vert": `precision mediump float; +attribute vec2 a_pos; +attribute vec2 a_offset; +attribute vec2 a_vv; +uniform highp mat3 u_dvsMat3; +uniform highp vec2 u_coordScale; +uniform vec2 u_symbolSize; +uniform vec2 u_symbolPercentRange; +uniform vec2 u_dataRange; +uniform float u_rotation; +uniform vec4 u_colors[12]; +varying vec4 v_color; +void main() +{ +float angle = a_offset.y + u_rotation; +#ifndef ROTATION_GEOGRAPHIC +angle = 3.14159265359 * 2.0 - angle - 3.14159265359 / 2.0; +#endif +vec2 offset = vec2(cos(angle), sin(angle)) * a_offset.x; +#ifdef DATA_RANGE +float valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0); +float sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x); +float sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y); +#else +float sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0; +#endif +vec2 pos = a_pos + offset * sizePercentage * u_symbolSize; +v_color = u_colors[int(a_vv.x)]; +gl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0); +}` }, reproject: { "reproject.frag": `precision mediump float; +varying vec2 v_texcoord; +#include +void main() { +vec2 pixelLocation = getPixelLocation(v_texcoord); +if (isOutside(pixelLocation)) { +gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); +return; +} +vec4 currentPixel = getPixel(pixelLocation); +gl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity; +}`, "reproject.vert": `precision mediump float; +attribute vec2 a_position; +varying highp vec2 v_texcoord; +void main() +{ +v_texcoord = a_position; +gl_Position = vec4(2.0 * (a_position - 0.5), 0.0, 1.0); +}` }, rfx: { aspect: { "aspect.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform vec2 u_cellSize; +uniform vec2 u_srcImageSize; +#include +const float pi = 3.14159265359; +void main() { +vec2 axy = vec2(-1.0, -1.0); +vec2 bxy = vec2(0.0, -1.0); +vec2 cxy = vec2(1.0, -1.0); +vec2 dxy = vec2(-1.0, 0.0); +vec2 fxy = vec2(1.0, 0.0); +vec2 gxy = vec2(-1.0, 1.0); +vec2 hxy = vec2(0.0, 1.0); +vec2 ixy = vec2(1.0, 1.0); +vec2 onePixel = 1.0 / u_srcImageSize; +vec4 va = texture2D(u_image, mirror(v_texcoord + onePixel * axy)); +vec4 vb = texture2D(u_image, mirror(v_texcoord + onePixel * bxy)); +vec4 vc = texture2D(u_image, mirror(v_texcoord + onePixel * cxy)); +vec4 vd = texture2D(u_image, mirror(v_texcoord + onePixel * dxy)); +vec4 ve = texture2D(u_image, mirror(v_texcoord + onePixel * vec2(0, 0))); +vec4 vf = texture2D(u_image, mirror(v_texcoord + onePixel * fxy)); +vec4 vg = texture2D(u_image, mirror(v_texcoord + onePixel * gxy)); +vec4 vh = texture2D(u_image, mirror(v_texcoord + onePixel * hxy)); +vec4 vi = texture2D(u_image, mirror(v_texcoord + onePixel * ixy)); +float dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r / (8.0 * u_cellSize[0]); +float dzy = -(vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r / (8.0 * u_cellSize[1]); +float alpha = va.a * vb.a * vc.a * vd.a * ve.a * vf.a * vg.a * vh.a * vi.a * sign(abs(dzx) + abs(dzy)); +float aspect_rad = (dzx == 0.0) ? (step(0.0, dzy) * 0.5 * pi + step(dzy, 0.0) * 1.5 * pi) : mod((2.5 * pi + atan(dzy, -dzx)), 2.0 * pi); +float aspect = aspect_rad * 180.0 / pi; +gl_FragColor = vec4(aspect, aspect, aspect, 1.0) * alpha; +}` }, bandarithmetic: { "bandarithmetic.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform mediump mat3 u_bandIndexMat3; +uniform float u_adjustments[3]; +#include +void main() { +vec4 pv = texture2D(u_image, v_texcoord); +vec3 pv2 = u_bandIndexMat3 * pv.rgb; +float nir = pv2.r; +float red = pv2.g; +float index; +#ifdef NDXI +index = (nir - red) * invertValue(nir + red); +#elif defined(SR) +index = nir * invertValue(red); +#elif defined(CI) +index = nir * invertValue(red) - 1.0; +#elif defined(SAVI) +index = (nir - red) * invertValue(nir + red + u_adjustments[0]) * (1.0 + u_adjustments[0]); +#elif defined(TSAVI) +float s = u_adjustments[0]; +float a = u_adjustments[1]; +float x = u_adjustments[2]; +float y = -a * s + x * (1.0 + s * s); +index = (s * (nir - s * red - a)) * invertValue(a * nir + red + y); +#elif defined(MAVI) +index = 0.5 * (2.0 * (nir + 1.0) - sqrt(pow((2.0 * nir + 1.0), 2.0) - 8.0 * (nir - red))); +#elif defined(GEMI) +float eta = (2.0 * (nir * nir - red * red) + 1.5 * nir + 0.5 * red) * invertValue(nir + red + 0.5); +index = eta * (1.0 - 0.25 * eta) - (red - 0.125) * invertValue(1.0 - red); +#elif defined(PVI) +float a = u_adjustments[0]; +float b = u_adjustments[1]; +float y = sqrt(1.0 + a * a); +index = (nir - a * red - b) * invertValue(y); +#elif defined(VARI) +index = (pv2.g - pv2.r) * invertValue(pv2.g + pv2.r - pv2.b); +#elif defined(MTVI2) +float green = pv2.b; +float v = pow(sqrt((2.0 * nir + 1.0), 2.0) - 6.0 * nir - 5.0 * sqrt(red) - 0.5); +index = 1.5 * (1.2 * (nir - green) - 2.5 * (red - green)) * v; +#elif defined(RTVICORE) +float green = pv2.b; +index = 100.0 * (nir - red) - 10.0 * (nir - green); +#elif defined(EVI) +float blue = pv2.b; +float denom = nir + 6.0 * red - 7.5 * blue + 1.0; +index = (2.5 * (nir - red)) * invertValue(denom); +#elif defined(WNDWI) +float g = pv2.r; +float n = pv2.g; +float s = pv2.s; +float a = u_adjustments[0]; +float denom = g + a * n + (1.0 - a) * s; +index = (g - a * n - (1 - a) * s) * invertValue(denom); +#elif defined(BAI) +index = invertValue(pow((0.1 - red), 2.0) + pow((0.06 - nir), 2.0)); +#else +gl_FragColor = pv; +return; +#endif +gl_FragColor = vec4(index, index, index, pv.a); +}` }, compositeband: { "compositeband.frag": `precision mediump float; +uniform sampler2D u_image; +uniform sampler2D u_image1; +uniform sampler2D u_image2; +varying vec2 v_texcoord; +void main() { +vec4 p0 = texture2D(u_image, v_texcoord); +vec4 p1 = texture2D(u_image1, v_texcoord); +vec4 p2 = texture2D(u_image2, v_texcoord); +gl_FragColor = vec4(p0.r, p1.r, p2.r, p0.a * p1.a * p2.a); +}` }, convolution: { "convolution.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform vec2 u_srcImageSize; +#define KERNEL_SIZE_ROWS ROWS +#define KERNEL_SIZE_COLS COLS +uniform vec2 u_clampRange; +uniform float u_kernel[25]; +#include +void main() { +vec3 rgb = vec3(0.0, 0.0, 0.0); +vec2 resolution = 1.0 / u_srcImageSize; +float rowOffset = -float(floor(float(KERNEL_SIZE_ROWS) / 2.0)); +float colOffset = -float(floor(float(KERNEL_SIZE_COLS) / 2.0)); +float alpha = 1.0; +for (int row = 0; row < KERNEL_SIZE_ROWS; row++) { +float pos_row = rowOffset + float(row); +for (int col = 0; col < KERNEL_SIZE_COLS; col++) { +vec2 pos = v_texcoord + vec2(colOffset + float(col), pos_row) * resolution; +vec4 pv = texture2D(u_image, mirror(pos)); +rgb += pv.rgb * u_kernel[row * KERNEL_SIZE_COLS + col]; +alpha *= pv.a; +} +} +rgb = clamp(rgb, u_clampRange.s, u_clampRange.t); +gl_FragColor = vec4(rgb * alpha, alpha); +}` }, extractband: { "extractband.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform mediump mat3 u_bandIndexMat3; +void main() { +vec4 pv = texture2D(u_image, v_texcoord); +vec3 pv2 = u_bandIndexMat3 * pv.rgb; +gl_FragColor = vec4(pv2, pv.a); +}` }, local: { "local.frag": `precision mediump float; +uniform sampler2D u_image; +uniform sampler2D u_image1; +#ifdef ONE_CONSTANT +uniform float u_image1Const; +#ifdef TWO_CONSTANT +uniform float u_image2Const; +#endif +uniform mat3 u_imageSwap; +#endif +varying vec2 v_texcoord; +uniform vec2 u_domainRange; +#include +void main() { +vec4 pv0 = texture2D(u_image, v_texcoord); +float a = pv0.r; +#ifdef TWO_IMAGES +#ifdef ONE_CONSTANT +float b = u_image1Const; +vec3 abc = u_imageSwap * vec3(a, b, 0); +a = abc.s; +b = abc.t; +#else +vec4 pv1 = texture2D(u_image1, v_texcoord); +float b = pv1.r; +#endif +#elif defined(CONDITIONAL) +#ifdef TWO_CONSTANT +float b = u_image1Const; +float c = u_image2Const; +vec3 abc = u_imageSwap * vec3(a, b, c); +a = abc.s; +b = abc.t; +c = abc.p; +#elif defined(ONE_CONSTANT) +vec4 pv1 = texture2D(u_image1, v_texcoord); +float b = pv1.r; +float c = u_image1Const; +vec3 abc = u_imageSwap * vec3(a, b, c); +a = abc.s; +b = abc.t; +c = abc.p; +#else +vec4 pv1 = texture2D(u_image1, v_texcoord); +vec4 pv2 = texture2D(u_image2, v_texcoord); +float b = pv1.r; +float c = pv2.r; +#endif +#endif +float result = a; +float alpha = pv0.a; +#ifdef PLUS +result = a + b; +#elif defined(MINUS) +result = a - b; +#elif defined(TIMES) +result = a * b; +#elif defined(DIVIDE) +result = a * invertValue(b); +alpha *= float(abs(sign(b))); +#elif defined(FLOATDIVIDE) +result = a * invertValue(b); +alpha *= float(abs(sign(b))); +#elif defined(FLOORDIVIDE) +result = floor(a * invertValue(b)); +alpha *= float(abs(sign(b))); +#elif defined(SQUARE) +result = a * a; +#elif defined(SQRT) +result = sqrt(a); +#elif defined(POWER) +result = pow(a, b); +#elif defined(LN) +result = a <= 0.0 ? 0.0: log(a); +alpha *= float(a > 0.0); +#elif defined(LOG_1_0) +result = a <= 0.0 ? 0.0: log2(a) * invertValue(log2(10.0)); +alpha *= float(a > 0.0); +#elif defined(LOG_2) +result = a <= 0.0 ? 0.0: log2(a); +alpha *= float(a > 0.0); +#elif defined(EXP) +result = exp(a); +#elif defined(EXP_1_0) +result = pow(10.0, a); +#elif defined(EXP_2) +result = pow(2.0, a); +#elif defined(ROUNDDOWN) +result = floor(a); +#elif defined(ROUNDUP) +result = ceil(a); +#elif defined(INT) +result = float(sign(a)) * floor(abs(a)); +#elif defined(MOD) +result = mod(a, b); +#elif defined(NEGATE) +result = -a; +#elif defined(ABS) +result = abs(a); +#elif defined(ACOS) +result = abs(a) > 1.0 ? 0.0: acos(a); +alpha *= step(abs(a), 1.00001); +#elif defined(ACOSH) +result = acosh(a); +#elif defined(POLYFILLACOSH) +result = log(a + sqrt(a * a - 1.0)); +#elif defined(ASIN) +result = abs(a) > 1.0 ? 0.0: asin(a); +alpha *= step(abs(a), 1.00001); +#elif defined(ASINH) +result = asinh(a); +#elif defined(POLYFILLASINH) +result = log(a + sqrt(a * a + 1.0)); +#elif defined(ATAN) +result = atan(a); +#elif defined(ATANH) +result = abs(a) > 1.0 ? 0.0: atanh(a); +alpha *= step(abs(a), 1.0); +#elif defined(POLYFILLATANH) +result = a == 1.0 ? 0.0 : 0.5 * log((1.0 + a)/(1.0 -a)); +#elif defined(ATAN_2) +result = atan(a, b); +#elif defined(COS) +result = cos(a); +#elif defined(COSH) +result = cosh(a); +#elif defined(POLYFILLCOSH) +float halfexp = exp(a) / 2.0; +result = halfexp + 1.0 / halfexp; +#elif defined(SIN) +result = sin(a); +#elif defined(SINH) +result = sinh(a); +#elif defined(POLYFILLSINH) +float halfexp = exp(a) / 2.0; +result = halfexp - 1.0 / halfexp; +#elif defined(TAN) +result = tan(a); +#elif defined(TANH) +result = tanh(a); +#elif defined(POLYFILLTANH) +float expx = exp(a); +result = (expx - 1.0 / expx) / (expx + 1.0 / expx); +#elif defined(BITWISEAND) +result = a & b; +#elif defined(BITWISEOR) +result = a | b; +#elif defined(BITWISELEFTSHIFT) +result = a << b; +#elif defined(BITWISERIGHTSHIFT) +result = a >> b; +#elif defined(BITWISENOT) +result = ~a; +#elif defined(BITWISEXOR) +result = a ^ b; +#elif defined(BOOLEANAND) +result = float((a != 0.0) && (b != 0.0)); +#elif defined(BOOLEANNOT) +result = float(a == 0.0); +#elif defined(BOOLEANOR) +result = float((a != 0.0) || (b != 0.0)); +#elif defined(BOOLEANXOR) +result = float((a != 0.0) ^^ (b != 0.0)); +#elif defined(GREATERTHAN) +result = float(a > b); +#elif defined(GREATERTHANEQUAL) +result = float(a >= b); +#elif defined(LESSTHAN) +result = float(a < b); +#elif defined(LESSTHANEQUAL) +result = float(a <= b); +#elif defined(EQUALTO) +result = float(a == b); +#elif defined(NOTEQUAL) +result = float(a != b); +#elif defined(ISNULL) +result = float(alpha == 0.0); +alpha = 1.0; +#elif defined(SETNULL) +float maskValue = float(a == 0.0); +result = maskValue * b; +alpha *= maskValue; +#elif defined(CONDITIONAL) +float weight = float(abs(sign(a))); +result = weight * b + (1.0 - weight) * c; +#endif +bool isInvalid = result < u_domainRange.s || result > u_domainRange.t; +result = isInvalid ? 0.0 : result; +alpha *= float(!isInvalid); +#ifdef ROUND_OUTPUT +result = floor(result + 0.5); +#endif +gl_FragColor = vec4(result, result, result, alpha); +}` }, mask: { "mask.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +#define LEN_INCLUDED_RANGES 6 +#define LEN_NODATA_VALUES 6 +uniform highp float u_includedRanges[6]; +uniform highp float u_noDataValues[6]; +float maskFactor(float bandValue, float fromValue, float to) { +float factor = 1.0; +for (int i = 0; i < LEN_NODATA_VALUES; i++) { +factor *= float(u_noDataValues[i] != bandValue); +} +factor *= step(fromValue, bandValue) * step(bandValue, to); +return factor; +} +void main() { +vec4 pv = texture2D(u_image, v_texcoord); +float redFactor = maskFactor(pv.r, u_includedRanges[0], u_includedRanges[1]); +#ifdef MULTI_BAND +float greenFactor = maskFactor(pv.g, u_includedRanges[2], u_includedRanges[3]); +float blueFactor = maskFactor(pv.b, u_includedRanges[4], u_includedRanges[5]); +float maskFactor = redFactor * greenFactor * blueFactor; +gl_FragColor = pv * maskFactor; +#else +gl_FragColor = pv * redFactor; +#endif +}` }, ndvi: { "ndvi.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform mediump mat3 u_bandIndexMat3; +#include +void main() { +vec4 pv = texture2D(u_image, v_texcoord); +vec3 pv2 = u_bandIndexMat3 * pv.rgb; +float nir = pv2.r; +float red = pv2.g; +float index = (nir - red) * invertValue(nir + red); +#ifdef SCALED +index = floor((index + 1.0) * 100.0 + 0.5); +#endif +gl_FragColor = vec4(index, index, index, pv.a); +}` }, remap: { "remap.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +#define LEN_REMAP_RANGES 18 +#define LEN_NODATA_RANGES 12 +uniform highp float u_rangeMaps[18]; +uniform highp float u_noDataRanges[12]; +uniform highp float u_unmatchMask; +uniform vec2 u_clampRange; +void main() { +vec4 pv = texture2D(u_image, v_texcoord); +float factor = 1.0; +float bandValue = pv.r; +for (int i = 0; i < LEN_NODATA_RANGES; i+=2) { +float inside = 1.0 - step(u_noDataRanges[i], bandValue) * step(bandValue, u_noDataRanges[i+1]); +factor *= inside; +} +float mapValue = 0.0; +float includeMask = 0.0; +for (int i = 0; i < LEN_REMAP_RANGES; i+=3) { +float stepMask = step(u_rangeMaps[i], bandValue) * step(bandValue, u_rangeMaps[i+1]); +includeMask = (1.0 - stepMask) * includeMask + stepMask; +mapValue = (1.0 - stepMask) * mapValue + stepMask * u_rangeMaps[i+2]; +} +bandValue = factor * (mapValue + (1.0 - includeMask) * u_unmatchMask * pv.r); +float bandMask = factor * max(u_unmatchMask, includeMask); +bandValue = clamp(bandValue, u_clampRange.s, u_clampRange.t); +gl_FragColor = vec4(bandValue, bandValue, bandValue, bandMask * pv.a); +}` }, slope: { "slope.frag": `precision mediump float; +uniform sampler2D u_image; +varying vec2 v_texcoord; +uniform vec2 u_cellSize; +uniform float u_zFactor; +uniform vec2 u_srcImageSize; +uniform float u_pixelSizePower; +uniform float u_pixelSizeFactor; +#include +void main() { +vec2 axy = vec2(-1.0, -1.0); +vec2 bxy = vec2(0.0, -1.0); +vec2 cxy = vec2(1.0, -1.0); +vec2 dxy = vec2(-1.0, 0.0); +vec2 fxy = vec2(1.0, 0.0); +vec2 gxy = vec2(-1.0, 1.0); +vec2 hxy = vec2(0.0, 1.0); +vec2 ixy = vec2(1.0, 1.0); +vec2 onePixel = 1.0 / u_srcImageSize; +vec4 va = texture2D(u_image, mirror(v_texcoord + onePixel * axy)); +vec4 vb = texture2D(u_image, mirror(v_texcoord + onePixel * bxy)); +vec4 vc = texture2D(u_image, mirror(v_texcoord + onePixel * cxy)); +vec4 vd = texture2D(u_image, mirror(v_texcoord + onePixel * dxy)); +vec4 ve = texture2D(u_image, mirror(v_texcoord + onePixel * vec2(0, 0))); +vec4 vf = texture2D(u_image, mirror(v_texcoord + onePixel * fxy)); +vec4 vg = texture2D(u_image, mirror(v_texcoord + onePixel * gxy)); +vec4 vh = texture2D(u_image, mirror(v_texcoord + onePixel * hxy)); +vec4 vi = texture2D(u_image, mirror(v_texcoord + onePixel * ixy)); +float xf = (u_zFactor + pow(u_cellSize[0], u_pixelSizePower) * u_pixelSizeFactor) / (8.0 * u_cellSize[0]); +float yf = (u_zFactor + pow(u_cellSize[1], u_pixelSizePower) * u_pixelSizeFactor) / (8.0 * u_cellSize[1]); +float dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * xf; +float dzy = -(vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * yf; +float alpha = va.a * vb.a * vc.a * vd.a * ve.a * vf.a * vg.a * vh.a * vi.a; +float rise2run = sqrt(dzx * dzx + dzy * dzy); +#ifdef PERCENT_RISE +float percentRise = rise2run * 100.0; +gl_FragColor = vec4(percentRise, percentRise, percentRise, alpha); +#else +float degree = atan(rise2run) * 57.2957795; +gl_FragColor = vec4(degree, degree, degree, alpha); +#endif +}` }, stretch: { "stretch.frag": `precision mediump float; +uniform sampler2D u_image; +varying highp vec2 v_texcoord; +uniform float u_minCutOff[3]; +uniform float u_maxCutOff[3]; +uniform float u_minOutput; +uniform float u_maxOutput; +uniform float u_factor[3]; +uniform float u_gamma[3]; +uniform float u_gammaCorrection[3]; +float stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, float gamma, float gammaCorrection) { +val = clamp(val, minCutOff, maxCutOff); +float stretchedVal; +#ifdef USE_GAMMA +float tempf = 1.0; +float outRange = maxOutput - minOutput; +float relativeVal = (val - minCutOff) / (maxCutOff - minCutOff); +tempf -= step(1.0, gamma) * sign(gamma - 1.0) * pow(1.0 / outRange, relativeVal * gammaCorrection); +stretchedVal = tempf * outRange * pow(relativeVal, 1.0 / gamma) + minOutput; +stretchedVal = clamp(stretchedVal, minOutput, maxOutput); +#else +stretchedVal = minOutput + (val - minCutOff) * factor; +#endif +#ifdef ROUND_OUTPUT +stretchedVal = floor(stretchedVal + 0.5); +#endif +return stretchedVal; +} +void main() { +vec4 currentPixel = texture2D(u_image, v_texcoord); +float redVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_gamma[0], u_gammaCorrection[0]); +#ifdef MULTI_BAND +float greenVal = stretchOneValue(currentPixel.g, u_minCutOff[1], u_maxCutOff[1], u_minOutput, u_maxOutput, u_factor[1], u_gamma[1], u_gammaCorrection[1]); +float blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_gamma[2], u_gammaCorrection[2]); +gl_FragColor = vec4(redVal, greenVal, blueVal, currentPixel.a); +#else +gl_FragColor = vec4(redVal, redVal, redVal, currentPixel.a); +#endif +}` }, vs: { "vs.vert": `precision mediump float; +attribute vec2 a_pos; +uniform highp mat3 u_dvsMat3; +uniform highp vec2 u_coordScale; +varying highp vec2 v_texcoord; +void main() +{ +v_texcoord = a_pos; +gl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0); +}` } }, scalar: { "scalar.frag": `precision mediump float; +uniform lowp float u_opacity; +varying vec2 v_pos; +const vec4 outlineColor = vec4(0.2, 0.2, 0.2, 1.0); +const float outlineSize = 0.02; +const float innerRadius = 0.25; +const float outerRadius = 0.42; +const float innerSquareLength = 0.15; +void main() { +mediump float dist = length(v_pos); +mediump float fillalpha1 = smoothstep(outerRadius, outerRadius + outlineSize, dist); +fillalpha1 *= (1.0-smoothstep(outerRadius + outlineSize, outerRadius + 0.1 + outlineSize, dist)); +#ifdef INNER_CIRCLE +mediump float fillalpha2 = smoothstep(innerRadius, innerRadius + outlineSize, dist); +fillalpha2 *= (1.0-smoothstep(innerRadius + outlineSize, innerRadius + 0.1 + outlineSize, dist)); +#else +mediump float fillalpha2 = (abs(v_pos.x) < innerSquareLength ? 1.0 : 0.0) * (abs(v_pos.y) < innerSquareLength ? 1.0 : 0.0); +#endif +gl_FragColor = (fillalpha2 + fillalpha1) * outlineColor * u_opacity; +}`, "scalar.vert": `precision mediump float; +attribute vec2 a_pos; +attribute vec2 a_offset; +attribute vec2 a_vv; +uniform highp mat3 u_dvsMat3; +uniform highp vec2 u_coordScale; +uniform vec2 u_symbolSize; +uniform vec2 u_symbolPercentRange; +uniform vec2 u_dataRange; +varying vec2 v_pos; +void main() +{ +#ifdef DATA_RANGE +float valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0); +float sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x); +float sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y); +#else +float sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0; +#endif +vec2 size = u_symbolSize * sizePercentage; +vec2 pos = a_pos + a_offset * size; +v_pos = a_offset; +gl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0); +}` }, stretch: { "stretch.frag": `precision mediump float; +varying highp vec2 v_texcoord; +#include +uniform float u_minCutOff[3]; +uniform float u_maxCutOff[3]; +uniform float u_minOutput; +uniform float u_maxOutput; +uniform float u_factor[3]; +uniform bool u_useGamma; +uniform float u_gamma[3]; +uniform float u_gammaCorrection[3]; +#include +float stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) { +if (val >= maxCutOff) { +return maxOutput; +} else if (val <= minCutOff) { +return minOutput; +} +float stretchedVal; +if (useGamma) { +float tempf = 1.0; +float outRange = maxOutput - minOutput; +float relativeVal = (val - minCutOff) / (maxCutOff - minCutOff); +if (gamma > 1.0) { +tempf -= pow(1.0 / outRange, relativeVal * gammaCorrection); +} +stretchedVal = (tempf * outRange * pow(relativeVal, 1.0 / gamma) + minOutput) / 255.0; +} else { +stretchedVal = minOutput + (val - minCutOff) * factor; +} +return stretchedVal; +} +void main() { +vec2 pixelLocation = getPixelLocation(v_texcoord); +if (isOutside(pixelLocation)) { +gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +return; +} +vec4 currentPixel = getPixel(pixelLocation); +#ifdef NOOP +gl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity; +return; +#endif +if (u_bandCount == 1) { +float grayVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]); +#ifdef APPLY_COLORMAP +vec4 result = colorize(vec4(grayVal, grayVal, grayVal, 1.0), u_useGamma ? 255.0 : 1.0); +gl_FragColor = vec4(result.xyz, 1.0) * result.a * currentPixel.a * u_opacity; +#else +gl_FragColor = vec4(grayVal, grayVal, grayVal, 1.0) * currentPixel.a * u_opacity; +#endif +} else { +float redVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]); +float greenVal = stretchOneValue(currentPixel.g, u_minCutOff[1], u_maxCutOff[1], u_minOutput, u_maxOutput, u_factor[1], u_useGamma, u_gamma[1], u_gammaCorrection[1]); +float blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_useGamma, u_gamma[2], u_gammaCorrection[2]); +gl_FragColor = vec4(redVal, greenVal, blueVal, 1.0) * currentPixel.a * u_opacity; +} +}` } }, stencil: { "stencil.frag": `void main() { +gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); +}`, "stencil.vert": `attribute vec2 a_pos; +uniform mat3 u_worldExtent; +void main() { +gl_Position = vec4(u_worldExtent * vec3(a_pos, 1.0), 1.0); +}` }, tileInfo: { "tileInfo.frag": `uniform mediump sampler2D u_texture; +varying mediump vec2 v_tex; +void main(void) { +lowp vec4 color = texture2D(u_texture, v_tex); +gl_FragColor = 0.75 * color; +}`, "tileInfo.vert": `attribute vec2 a_pos; +uniform highp mat3 u_dvsMat3; +uniform mediump float u_depth; +uniform mediump vec2 u_coord_ratio; +uniform mediump vec2 u_delta; +uniform mediump vec2 u_dimensions; +varying mediump vec2 v_tex; +void main() { +mediump vec2 offset = u_coord_ratio * vec2(u_delta + a_pos * u_dimensions); +vec3 v_pos = u_dvsMat3 * vec3(offset, 1.0); +gl_Position = vec4(v_pos.xy, 0.0, 1.0); +v_tex = a_pos; +}` }, util: { "atan2.glsl": `float atan2(in float y, in float x) { +float t0, t1, t2, t3, t4; +t3 = abs(x); +t1 = abs(y); +t0 = max(t3, t1); +t1 = min(t3, t1); +t3 = 1.0 / t0; +t3 = t1 * t3; +t4 = t3 * t3; +t0 = - 0.013480470; +t0 = t0 * t4 + 0.057477314; +t0 = t0 * t4 - 0.121239071; +t0 = t0 * t4 + 0.195635925; +t0 = t0 * t4 - 0.332994597; +t0 = t0 * t4 + 0.999995630; +t3 = t0 * t3; +t3 = (abs(y) > abs(x)) ? 1.570796327 - t3 : t3; +t3 = x < 0.0 ? 3.141592654 - t3 : t3; +t3 = y < 0.0 ? -t3 : t3; +return t3; +}`, "encoding.glsl": `const vec4 rgba2float_factors = vec4( +255.0 / (256.0), +255.0 / (256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0 * 256.0) +); +float rgba2float(vec4 rgba) { +return dot(rgba, rgba2float_factors); +}` } }; +function Inr(t) { + let e = Enr; + return t.split("/").forEach((i) => { + e && (e = e[i]); + }), e; +} +const Anr = new D9e(Inr); +function Vg(t) { + return Anr.resolveIncludes(t); +} +const pte = { shaders: { vertexShader: Vg("background/background.vert"), fragmentShader: Vg("background/background.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }, Pnr = () => E3("clip", { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }] }); +let Onr = class extends A1 { + constructor() { + super(...arguments), this._color = HI(0, 1, 0, 1); + } + dispose() { + this._program && this._program.dispose(); + } + prepareState({ context: e }) { + e.setStencilTestEnabled(!0), e.setBlendingEnabled(!1), e.setFaceCullingEnabled(!1), e.setColorMask(!1, !1, !1, !1), e.setStencilOp(su.KEEP, su.KEEP, su.REPLACE), e.setStencilWriteMask(255), e.setStencilFunction(Ll.ALWAYS, 0, 255); + } + draw(e, i) { + const { context: r, state: n, requestRender: s, allowDelayedRender: o } = e, a = Pnr(), l = i.getVAO(r, n, a.attributes, a.bufferLayouts); + ut(l.indexBuffer) || (this._program || (this._program = SI(r, pte)), o && _e(s) && !this._program.compiled ? s() : (r.useProgram(this._program), this._program.setUniform2fv("u_coord_range", [1, 1]), this._program.setUniform4fv("u_color", this._color), this._program.setUniformMatrix3fv("u_dvsMat3", n.displayMat3), r.bindVAO(l), r.drawElements(ps.TRIANGLES, l.indexBuffer.size, Fi.UNSIGNED_INT, 0), r.bindVAO())); + } +}; +const Rnr = () => E3("overlay", { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.FLOAT }], tex: [{ location: 1, name: "a_uv", count: 2, type: Fi.UNSIGNED_SHORT }] }); +let Mnr = class extends A1 { + constructor() { + super(...arguments), this._desc = { vsPath: "overlay/overlay", fsPath: "overlay/overlay", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_uv", 1]]) }; + } + dispose() { + } + prepareState({ context: e }) { + e.setBlendingEnabled(!0), e.setColorMask(!0, !0, !0, !0), e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.setStencilWriteMask(0), e.setStencilTestEnabled(!0), e.setStencilFunction(Ll.GREATER, 255, 255); + } + draw(e, i) { + const { context: r, painter: n, requestRender: s, allowDelayedRender: o } = e; + if (!i.isReady) + return; + const { computedOpacity: a, dvsMat3: l, isWrapAround: c, perspectiveTransform: h, texture: p } = i; + e.timeline.begin(this.name); + const y = n.materialManager.getProgram(this._desc); + if (o && _e(s) && !y.compiled) + return void s(); + const v = Rnr(), x = i.getVAO(r, v.bufferLayouts, v.attributes); + if (!x) + return; + r.bindVAO(x), r.useProgram(y), r.bindTexture(p, lfe), y.setUniformMatrix3fv("u_dvsMat3", l), y.setUniform1i("u_texture", lfe), y.setUniform1f("u_opacity", a), y.setUniform2fv("u_perspective", h); + const I = c ? 10 : 4; + r.drawArrays(ps.TRIANGLE_STRIP, 0, I), r.bindVAO(), e.timeline.end(this.name); + } +}; +function Dnr(t, e, i) { + const r = sd.SIZE_FIELD_STOPS | sd.SIZE_MINMAX_VALUE | sd.SIZE_SCALE_STOPS | sd.SIZE_UNIT_VALUE, n = (e & (gG.FIELD_TARGETS_OUTLINE | gG.MINMAX_TARGETS_OUTLINE | gG.SCALE_TARGETS_OUTLINE | gG.UNIT_TARGETS_OUTLINE)) >>> 4; + return t === En.LINE && i.isOutline || t === En.FILL && Mve(i.symbologyType) ? r & n : r & ~n; +} +const Jrt = 0, Zrt = 8, Fnr = 7, Qrt = 8, ent = 11, tnt = 11, int = 12, rnt = 13, nnt = 14, snt = 15, ont = 16, ant = 17, lnt = 18, unt = 19, cnt = 20, hnt = 21, dnt = 26, Lnr = Object.keys(Zo).filter((t) => typeof Zo[t] == "number").reduce((t, e) => ({ ...t, [e]: Zo[e] }), {}); +function Nnr(t) { + return t === Zo.SIMPLE || t === Zo.OUTLINE_FILL_SIMPLE; +} +function Mve(t) { + return t === Zo.OUTLINE_FILL || t === Zo.OUTLINE_FILL_SIMPLE; +} +function BMt(t) { + return Nnr(t.symbologyType); +} +function Qfe(t) { + return Mve(t.symbologyType); +} +function rC(t, e) { + switch (t) { + case En.FILL: + return nC.from(e); + case En.LINE: + return a3.from(e); + case En.MARKER: + return d4.from(e); + case En.TEXT: + return nz.from(e); + case En.LABEL: + return _F.from(e); + default: + throw new Error(`Unable to createMaterialKey for unknown geometryType ${t}`); + } +} +function knr(t) { + switch (_1.load(t).geometryType) { + case En.MARKER: + return new d4(t); + case En.FILL: + return new nC(t); + case En.LINE: + return new a3(t); + case En.TEXT: + return new nz(t); + case En.LABEL: + return new _F(t); + } +} +let _1 = class { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + constructor(e) { + this._data = 0, this._data = e; + } + set data(e) { + this._data = e ?? 0; + } + get data() { + return this._data; + } + get geometryType() { + return this.bits(Qrt, ent); + } + set geometryType(e) { + this.setBits(e, Qrt, ent); + } + get mapAligned() { + return !!this.bit(cnt); + } + set mapAligned(e) { + this.setBit(cnt, e); + } + get sdf() { + return !!this.bit(tnt); + } + set sdf(e) { + this.setBit(tnt, e ?? !1); + } + get pattern() { + return !!this.bit(int); + } + set pattern(e) { + this.setBit(int, e); + } + get textureBinding() { + return this.bits(Jrt, Zrt); + } + set textureBinding(e) { + this.setBits(e, Jrt, Zrt); + } + get symbologyType() { + return this.bits(hnt, dnt); + } + set symbologyType(e) { + this.setBits(e, hnt, dnt); + } + get geometryTypeString() { + switch (this.geometryType) { + case En.FILL: + return "fill"; + case En.MARKER: + return "marker"; + case En.LINE: + return "line"; + case En.TEXT: + return "text"; + case En.LABEL: + return "label"; + default: + throw new ot(`Unable to handle unknown geometryType: ${this.geometryType}`); + } + } + setBit(e, i) { + const r = 1 << e; + i ? this._data |= r : this._data &= ~r; + } + bit(e) { + return (this._data & 1 << e) >> e; + } + setBits(e, i, r) { + for (let n = i, s = 0; n < r; n++, s++) + this.setBit(n, (e & 1 << s) != 0); + } + bits(e, i) { + let r = 0; + for (let n = e, s = 0; n < i; n++, s++) + r |= this.bit(n) << s; + return r; + } + hasVV() { + return !1; + } + setVV(e, i) { + } + getVariation() { + return { mapAligned: this.mapAligned, pattern: this.pattern, sdf: this.sdf, symbologyType: { value: Zo[this.symbologyType], options: Lnr, namespace: "SYMBOLOGY_TYPE" } }; + } + getVariationHash() { + return this._data & ~(Fnr & this.textureBinding); + } +}; +_1.shared = new _1(0); +const rre = (t) => class extends t { + get vvSizeMinMaxValue() { + return this.bit(ont) !== 0; + } + set vvSizeMinMaxValue(e) { + this.setBit(ont, e); + } + get vvSizeScaleStops() { + return this.bit(ant) !== 0; + } + set vvSizeScaleStops(e) { + this.setBit(ant, e); + } + get vvSizeFieldStops() { + return this.bit(lnt) !== 0; + } + set vvSizeFieldStops(e) { + this.setBit(lnt, e); + } + get vvSizeUnitValue() { + return this.bit(unt) !== 0; + } + set vvSizeUnitValue(e) { + this.setBit(unt, e); + } + hasVV() { + return super.hasVV() || this.vvSizeMinMaxValue || this.vvSizeScaleStops || this.vvSizeFieldStops || this.vvSizeUnitValue; + } + setVV(e, i) { + super.setVV(e, i); + const r = Dnr(this.geometryType, e, i) & e; + this.vvSizeMinMaxValue = !!(r & sd.SIZE_MINMAX_VALUE), this.vvSizeFieldStops = !!(r & sd.SIZE_FIELD_STOPS), this.vvSizeUnitValue = !!(r & sd.SIZE_UNIT_VALUE), this.vvSizeScaleStops = !!(r & sd.SIZE_SCALE_STOPS); + } +}, VMt = (t) => class extends t { + get vvRotation() { + return this.bit(snt) !== 0; + } + set vvRotation(e) { + this.setBit(snt, e); + } + hasVV() { + return super.hasVV() || this.vvRotation; + } + setVV(e, i) { + super.setVV(e, i), this.vvRotation = !i.isOutline && !!(e & sd.ROTATION); + } +}, Dve = (t) => class extends t { + get vvColor() { + return this.bit(rnt) !== 0; + } + set vvColor(e) { + this.setBit(rnt, e); + } + hasVV() { + return super.hasVV() || this.vvColor; + } + setVV(e, i) { + super.setVV(e, i), this.vvColor = !i.isOutline && !!(e & sd.COLOR); + } +}, Fve = (t) => class extends t { + get vvOpacity() { + return this.bit(nnt) !== 0; + } + set vvOpacity(e) { + this.setBit(nnt, e); + } + hasVV() { + return super.hasVV() || this.vvOpacity; + } + setVV(e, i) { + super.setVV(e, i), this.vvOpacity = !i.isOutline && !!(e & sd.OPACITY); + } +}; +let nC = class extends Dve(Fve(rre(_1))) { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + static from(e) { + const { symbologyType: i, vvFlags: r } = e, n = this.load(0); + return n.geometryType = En.FILL, n.symbologyType = i, i !== Zo.DOT_DENSITY && n.setVV(r, e), n.data; + } + getVariation() { + return { ...super.getVariation(), vvColor: this.vvColor, vvOpacity: this.vvOpacity, vvSizeFieldStops: this.vvSizeFieldStops, vvSizeMinMaxValue: this.vvSizeMinMaxValue, vvSizeScaleStops: this.vvSizeScaleStops, vvSizeUnitValue: this.vvSizeUnitValue }; + } +}; +nC.shared = new nC(0); +let d4 = class extends Dve(Fve(VMt(rre(_1)))) { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + static from(e) { + const { symbologyType: i, vvFlags: r } = e, n = this.load(0); + return n.geometryType = En.MARKER, n.symbologyType = i, i !== Zo.HEATMAP && n.setVV(r, e), n.data; + } + getVariation() { + return { ...super.getVariation(), vvColor: this.vvColor, vvRotation: this.vvRotation, vvOpacity: this.vvOpacity, vvSizeFieldStops: this.vvSizeFieldStops, vvSizeMinMaxValue: this.vvSizeMinMaxValue, vvSizeScaleStops: this.vvSizeScaleStops, vvSizeUnitValue: this.vvSizeUnitValue }; + } +}; +d4.shared = new d4(0); +let a3 = class extends Dve(Fve(rre(_1))) { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + static from(e) { + const i = this.load(0); + return i.geometryType = En.LINE, i.symbologyType = e.symbologyType, i.setVV(e.vvFlags, e), i.data; + } + getVariation() { + return { ...super.getVariation(), vvColor: this.vvColor, vvOpacity: this.vvOpacity, vvSizeFieldStops: this.vvSizeFieldStops, vvSizeMinMaxValue: this.vvSizeMinMaxValue, vvSizeScaleStops: this.vvSizeScaleStops, vvSizeUnitValue: this.vvSizeUnitValue }; + } +}; +a3.shared = new a3(0); +let nz = class extends Dve(Fve(VMt(rre(_1)))) { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + static from(e) { + const i = this.load(0); + return i.geometryType = En.TEXT, i.symbologyType = e.symbologyType, i.setVV(e.vvFlags, e), i.data; + } + getVariation() { + return { ...super.getVariation(), vvColor: this.vvColor, vvOpacity: this.vvOpacity, vvRotation: this.vvRotation, vvSizeFieldStops: this.vvSizeFieldStops, vvSizeMinMaxValue: this.vvSizeMinMaxValue, vvSizeScaleStops: this.vvSizeScaleStops, vvSizeUnitValue: this.vvSizeUnitValue }; + } +}; +nz.shared = new nz(0); +let _F = class extends rre(_1) { + static load(e) { + const i = this.shared; + return i.data = e, i; + } + static from(e) { + const i = this.load(0); + return i.geometryType = En.LABEL, i.symbologyType = e.symbologyType, i.setVV(e.vvFlags, e), i.mapAligned = IRt(e.placement), i.data; + } + getVariation() { + return { ...super.getVariation(), vvSizeFieldStops: this.vvSizeFieldStops, vvSizeMinMaxValue: this.vvSizeMinMaxValue, vvSizeScaleStops: this.vvSizeScaleStops, vvSizeUnitValue: this.vvSizeUnitValue }; + } +}; +_F.shared = new _F(0); +let nre = class extends A1 { + constructor() { + super(...arguments), this._computeDesc = /* @__PURE__ */ new Map(); + } + prepareState({ context: e }, i) { + i && i.includes("hittest") ? e.setBlendFunctionSeparate(gn.ONE, gn.ONE, gn.ONE, gn.ONE) : e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.setBlendingEnabled(!0), e.setColorMask(!0, !0, !0, !0), e.setStencilWriteMask(0), e.setStencilTestEnabled(!0); + } + draw(e, i, r) { + const n = this.getGeometryType(); + i.commit(e); + const s = i.getGeometry(n); + ut(s) || (e.timeline.begin(this.name), e.attributeView.bindTextures(e.context), e.context.setStencilFunction(Ll.EQUAL, i.stencilRef, 255), s.forEachCommand((o) => { + const a = _1.load(o.materialKey).symbologyType; + this.supportsSymbology(a) && this.drawGeometry(e, i, o, r); + })); + } + _setSharedUniforms(e, i, r) { + const { displayLevel: n, pixelRatio: s, state: o, passOptions: a } = i; + _e(a) && a.type === "hittest" && (e.setUniform2fv("u_hittestPos", a.position), e.setUniform1f("u_hittestDist", a.distance)), e.setUniform1f("u_pixelRatio", s), e.setUniformMatrix3fv("u_tileMat3", r.transforms.tileMat3), e.setUniformMatrix3fv("u_viewMat3", o.viewMat3), e.setUniformMatrix3fv("u_dvsMat3", r.transforms.dvs), e.setUniformMatrix3fv("u_displayViewMat3", o.displayViewMat3), e.setUniform1f("u_currentZoom", Math.round(n * Dy)), e.setUniform1i("u_attributeTextureSize", i.attributeView.size), e.setUniform1i("u_attributeData0", ufe), e.setUniform1i("u_attributeData1", cfe), e.setUniform1i("u_attributeData2", aRe), e.setUniform1i("u_attributeData3", lRe), e.setUniform1i("u_attributeData4", ice), e.setUniform1i("u_attributeData5", rce); + } + _setSizeVVUniforms(e, i, r, n) { + if (e.vvSizeMinMaxValue && i.setUniform4fv("u_vvSizeMinMaxValue", r.vvSizeMinMaxValue), e.vvSizeScaleStops && i.setUniform1f("u_vvSizeScaleStopsValue", r.vvSizeScaleStopsValue), e.vvSizeFieldStops) { + const s = r.getSizeVVFieldStops(n.key.level); + s != null && (i.setUniform1fv("u_vvSizeFieldStopsValues", s.values), i.setUniform1fv("u_vvSizeFieldStopsSizes", s.sizes)); + } + e.vvSizeUnitValue && i.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio", r.vvSizeUnitValueToPixelsRatio); + } + _setColorAndOpacityVVUniforms(e, i, r) { + e.vvColor && (i.setUniform1fv("u_vvColorValues", r.vvColorValues), i.setUniform4fv("u_vvColors", r.vvColors)), e.vvOpacity && (i.setUniform1fv("u_vvOpacityValues", r.vvOpacityValues), i.setUniform1fv("u_vvOpacities", r.vvOpacities)); + } + _setRotationVVUniforms(e, i, r) { + e.vvRotation && i.setUniform1f("u_vvRotationType", r.vvMaterialParameters.vvRotationType === "geographic" ? 0 : 1); + } + _getTriangleDesc(e, i, r = ["a_pos"]) { + const n = i.bufferLayouts.geometry, s = r.map((l) => n.findIndex((c) => c.name === l)), o = `${e}-${s.join("-")}`; + let a = this._computeDesc.get(o); + if (!a) { + const l = i.strides, c = i.strides.geometry, h = new Map(i.attributes), p = n.map((I) => ({ ...I })), y = Math.max(...i.attributes.values()), v = { geometry: p }; + let x = 0; + for (const I of s) { + const P = n[I]; + v.geometry.push({ count: P.count, name: P.name + "1", divisor: P.divisor, normalized: P.normalized, offset: c + P.offset, stride: c, type: P.type }), v.geometry.push({ count: P.count, name: P.name + "2", divisor: P.divisor, normalized: P.normalized, offset: 2 * c + P.offset, stride: c, type: P.type }), h.set(P.name + "1", y + ++x), h.set(P.name + "2", y + ++x); + } + a = { bufferLayouts: v, attributes: h, strides: l }, this._computeDesc.set(o, a); + } + return a; + } +}, p4 = class { + static getStorageSpec(e) { + return null; + } + static createOrUpdateRendererSchema(e, i) { + return _e(e) && e.type === "default" ? e : { type: "default" }; + } + static getVariation(e) { + return {}; + } + static getVariationHash(e) { + return 0; + } +}; +p4.type = "default", p4.programSpec = null; +let eme = class extends p4 { + static getStorageSpec({ attributes: e }) { + return { visualVariables: !1, attributes: e ?? null }; + } + static _createRendererSchema() { + return { type: "dot-density", colors: new Float32Array(32), dotValue: -1, dotSize: -1, dotScale: -1, dotBlending: !1, backgroundColor: new Float32Array(4), activeDots: new Float32Array(8), seed: -1 }; + } + static createOrUpdateRendererSchema(e, i) { + const { attributes: r, dotValue: n, referenceScale: s, dotSize: o, dotBlendingEnabled: a, seed: l, backgroundColor: c } = i, h = _e(e) && e.type === "dot-density" ? e : this._createRendererSchema(); + h.dotValue = n, h.dotSize = o, h.dotScale = s, h.dotBlending = a, h.seed = l; + const { colors: p, activeDots: y, backgroundColor: v } = h; + for (let x = 0; x < N8i; x++) { + const I = x >= r.length ? null : r[x].color; + vG(p, I, 4 * x); + } + for (let x = 0; x < 8; x++) + y[x] = x < i.attributes.length ? 1 : 0; + return vG(v, c), h; + } + static getVariation(e) { + return { ddDotBlending: e.dotBlending }; + } + static getVariationHash(e) { + return e.dotBlending ? 1 : 0; + } +}; +eme.type = "dot-density", eme.programSpec = { shader: "materials/fill", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_id", count: 3, type: Fi.UNSIGNED_BYTE }, { location: 2, name: "a_bitset", count: 1, type: Fi.UNSIGNED_BYTE }, { location: 3, name: "a_inverseArea", count: 1, type: Fi.FLOAT }] } }; +let tme = class extends p4 { + static getStorageSpec({ field: e, valueExpression: i }) { + return { visualVariables: !1, attributes: e || i ? [{ field: e, valueExpression: i }] : null }; + } + static _createRendererSchema() { + return { type: "heatmap", radius: -1, referenceScale: -1, isFieldActive: 0, minDensity: -1, densityRange: -1, kernel: null, gradient: null, gradientHash: "invalid" }; + } + static createOrUpdateRendererSchema(e, i) { + const { radius: r, minDensity: n, maxDensity: s, referenceScale: o, field: a, valueExpression: l, colorStops: c } = i, h = s - n, p = a || l ? 1 : 0, y = c.map(({ color: I, ratio: P }) => `${P}:${I.toString()}`).join(); + let v, x = !0; + return _e(e) && e.type === "heatmap" ? (v = e, x = y !== e.gradientHash) : v = this._createRendererSchema(), v.radius = dn(r), v.minDensity = n, v.densityRange = h, v.referenceScale = o, v.isFieldActive = p, x && (v.gradient = gpt(c), v.gradientHash = y), v; + } +}; +tme.type = "heatmap", tme.programSpec = { shader: "materials/icon/heatmapAccumulate", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_vertexOffset", count: 2, type: Fi.SHORT }, { location: 4, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }] } }; +let ime = class extends p4 { + static getStorageSpec({ attributes: e }) { + return { visualVariables: !0, attributes: e ?? null }; + } + static _createRendererSchema() { + return { type: "pie-chart", colors: new Float32Array(4 * XJe), defaultColor: new Float32Array(4), othersColor: new Float32Array(4), outlineColor: new Float32Array(4), holePercentage: 0, sectorThreshold: 0, outlineWidth: 1, numberOfFields: 10 }; + } + static createOrUpdateRendererSchema(e, i) { + const { attributes: r, defaultColor: n, holePercentage: s, othersCategory: o, outline: a } = i, l = _e(e) && e.type === "pie-chart" ? e : this._createRendererSchema(); + for (let c = 0; c < XJe; c++) { + const h = c >= r.length ? new Wr([0, 0, 0, 0]) : r[c].color; + vG(l.colors, h, 4 * c); + } + return vG(l.defaultColor, n), vG(l.othersColor, o?.color), vG(l.outlineColor, a?.color), l.outlineWidth = dn(a?.width || 0), l.holePercentage = s, l.sectorThreshold = o?.threshold || 0, l.numberOfFields = r.length, l; + } + static getVariation(e) { + return { numberOfFields: e.numberOfFields }; + } + static getVariationHash(e) { + return e.numberOfFields; + } +}; +ime.type = "pie-chart", ime.programSpec = { shader: "materials/pie", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_vertexOffset", count: 2, type: Fi.SHORT }, { location: 2, name: "a_texCoords", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 3, name: "a_bitSetAndDistRatio", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 4, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 5, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 6, name: "a_outlineColor", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 7, name: "a_sizeAndOutlineWidth", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 8, name: "a_zoomRange", count: 2, type: Fi.UNSIGNED_SHORT }] }, hittestAttributes: ["a_vertexOffset", "a_texCoords"] }; +function I7(t, e) { + if (t.type !== e) + throw new ot("material-view-model:unexpected-renderer-schema", `expected to find renderer schema of type "${e}" but found type "${t.type}"`); +} +function jMt(t) { + switch (t?.type) { + case "dot-density": + return eme; + case "heatmap": + return tme; + case "pie-chart": + return ime; + default: + return p4; + } +} +function GMt(t) { + const { geometryType: e, symbologyType: i } = _1.load(t); + switch (e) { + case En.FILL: + if (i === Zo.DOT_DENSITY) + return eme; + break; + case En.MARKER: + switch (i) { + case Zo.HEATMAP: + return tme; + case Zo.PIE_CHART: + return ime; + } + } + return p4; +} +function $nr(t) { + const e = { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_id", count: 3, type: Fi.UNSIGNED_BYTE }, { location: 2, name: "a_bitset", count: 1, type: Fi.UNSIGNED_BYTE }, { location: 3, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 4, name: "a_aux1", count: 4, type: Fi.UNSIGNED_SHORT }, { location: 5, name: "a_aux2", count: 4, type: Fi.SHORT }, { location: 6, name: "a_aux3", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 7, name: "a_zoomRange", count: 2, type: Fi.UNSIGNED_SHORT }] }; + switch (t.symbologyType) { + case Zo.SIMPLE: + case Zo.OUTLINE_FILL_SIMPLE: + e.geometry.splice(7, 1), e.geometry.splice(4, 1); + } + return { shader: "materials/fill", vertexLayout: e }; +} +let UMt = class extends nre { + dispose() { + } + getGeometryType() { + return En.FILL; + } + supportsSymbology(e) { + return e !== Zo.DOT_DENSITY; + } + drawGeometry(e, i, r, n) { + const { context: s, painter: o, rendererInfo: a, requiredLevel: l, passOptions: c, requestRender: h, allowDelayedRender: p } = e, y = nC.load(r.materialKey), v = GMt(y.data), x = _e(c) && c.type === "hittest", I = o.materialManager, { shader: P, vertexLayout: F, hittestAttributes: k } = Gu(v.programSpec, $nr(y)); + let V = ps.TRIANGLES, j = E3(y.data, F); + x && (j = this._getTriangleDesc(r.materialKey, j, k), V = ps.POINTS); + const { attributes: Y, bufferLayouts: X } = j, Q = I.getMaterialProgram(e, y, P, Y, n); + if (p && _e(h) && !Q.compiled) + return void h(); + if (s.useProgram(Q), this._setSharedUniforms(Q, e, i), Q.setUniform2f("u_tileOffset", 512 * i.key.col, 512 * i.key.row), y.textureBinding) { + o.textureManager.bindTextures(s, Q, y); + const Se = 1 / 2 ** (l - i.key.level); + Q.setUniform1f("u_zoomFactor", Se); + } + const re = 1 / e.pixelRatio; + Q.setUniform1f("u_blur", re), Q.setUniform1f("u_antialiasing", re), this._setSizeVVUniforms(y, Q, a, i), this._setColorAndOpacityVVUniforms(y, Q, a); + const he = r.target.getVAO(s, X, Y, x); + let fe = r.indexCount, be = r.indexFrom * Uint32Array.BYTES_PER_ELEMENT; + x && (fe /= 3, be /= 3), s.bindVAO(he), this._drawFills(e, i, Q, V, fe, be); + } + _drawFills(e, i, r, n, s, o) { + e.context.drawElements(n, s, Fi.UNSIGNED_INT, o); + } +}, Bnr = class extends UMt { + constructor() { + super(...arguments), this._dotTextureSize = 0, this._dotTextures = null, this._dotSamplers = new Int32Array([$8i, B8i]), this._dotVAO = null, this._dotDesc = { vsPath: "dot/dot", fsPath: "dot/dot", attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }; + } + dispose() { + super.dispose(), this._disposeTextures(), this._dotFBO = Ua(this._dotFBO), this._dotVAO = Ua(this._dotVAO); + } + getGeometryType() { + return En.FILL; + } + supportsSymbology(e) { + return e === Zo.DOT_DENSITY; + } + _drawFills(e, i, r, n, s, o) { + const { passOptions: a } = e; + if (_e(a) && a.type === "hittest") + super._drawFills(e, i, r, n, s, o); + else { + const l = this._drawDotLocations(e, i, r, s, o); + this._drawDotDensity(e, i, l); + } + } + _drawDotDensity(e, i, r) { + const { context: n, painter: s, rendererInfo: o, requestRender: a, allowDelayedRender: l } = e, c = s.materialManager.getProgram(this._dotDesc); + if (l && _e(a) && !c.compiled) + return void a(); + const { rendererSchema: h } = o; + I7(h, "dot-density"); + const p = this._createDotDensityMesh(n, this._dotDesc.attributes, { geometry: [{ name: "a_pos", count: 2, type: Fi.SHORT, divisor: 0, normalized: !1, offset: 0, stride: 4 }] }); + n.setStencilTestEnabled(!0), n.useProgram(c), c.setUniform1f("u_tileZoomFactor", 1), c.setUniform1i("u_texture", this._dotSamplers[0]), c.setUniform1f("u_dotSize", Math.max(h.dotSize, 1)), c.setUniform1f("u_pixelRatio", window.devicePixelRatio), this._setSharedUniforms(c, e, i), n.bindTexture(r, this._dotSamplers[0]), n.bindVAO(p), n.drawArrays(ps.POINTS, 0, 262144); + } + _drawDotLocations(e, i, r, n, s) { + const { context: o, rendererInfo: a, requiredLevel: l } = e, c = o.getViewport(), { rendererSchema: h } = a; + I7(h, "dot-density"); + const { dotScale: p, colors: y, activeDots: v, backgroundColor: x, dotValue: I } = h; + o.setViewport(0, 0, 512, 512); + const P = o.getBoundFramebufferObject(), F = this._createFBO(o); + o.bindFramebuffer(F), o.setClearColor(0, 0, 0, 0), o.clear(o.gl.COLOR_BUFFER_BIT | o.gl.STENCIL_BUFFER_BIT), o.setStencilTestEnabled(!1); + const k = 1 / 2 ** (l - i.key.level), V = Sc, j = V * window.devicePixelRatio * V * window.devicePixelRatio, Y = 1 / k * (1 / k), X = p ? e.state.scale / p : 1; + return r.setUniform1f("u_tileZoomFactor", k), r.setUniform1f("u_tileDotsOverArea", j / (Sc * window.devicePixelRatio * Sc * window.devicePixelRatio)), r.setUniformMatrix4fv("u_dotColors", y), r.setUniform4fv("u_isActive", v), r.setUniform4fv("u_dotBackgroundColor", x), r.setUniform1f("u_dotValue", Math.max(1, I * X * Y)), this._bindDotDensityTextures(o, r, a, V), o.drawElements(ps.TRIANGLES, n, Fi.UNSIGNED_INT, s), o.setViewport(c.x, c.y, c.width, c.height), o.bindFramebuffer(P), F.colorTexture; + } + _createFBO(e) { + if (ut(this._dotFBO)) { + const n = { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, width: 512, height: 512 }, s = { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.DEPTH_STENCIL_RENDER_BUFFER }, o = new nO(e, { width: 512, height: 512, internalFormat: Ag.DEPTH_STENCIL }); + this._dotFBO = new cd(e, s, n, o); + } + return this._dotFBO; + } + _disposeTextures() { + if (this._dotTextures) { + for (let e = 0; e < this._dotTextures.length; e++) + this._dotTextures[e].dispose(); + this._dotTextures = null; + } + } + _bindDotDensityTextures(e, i, r, n) { + const { rendererSchema: s } = r; + I7(s, "dot-density"); + const o = this._createDotDensityTextures(e, n, s.seed); + i.setUniform1iv("u_dotTextures", this._dotSamplers); + for (let a = 0; a < o.length; a++) + e.bindTexture(o[a], this._dotSamplers[a]); + } + _createDotDensityMesh(e, i, r) { + if (ut(this._dotVAO)) { + const s = new Int16Array(524288); + for (let a = 0; a < 512; a++) + for (let l = 0; l < 512; l++) + s[2 * (l + 512 * a)] = l, s[2 * (l + 512 * a) + 1] = a; + const o = Qo.createVertex(e, Vo.STATIC_DRAW, s); + this._dotVAO = new Ac(e, i, r, { geometry: o }, null); + } + return this._dotVAO; + } + _createDotDensityTextures(e, i, r) { + if (this._dotTextureSize === i && this._seed === r || (this._disposeTextures(), this._dotTextureSize = i, this._seed = r), this._dotTextures === null) { + const n = new VE(r); + this._dotTextures = [this._allocDotDensityTexture(e, i, n), this._allocDotDensityTexture(e, i, n)]; + } + return this._dotTextures; + } + _allocDotDensityTexture(e, i, r) { + const n = new Float32Array(i * i * 4); + for (let s = 0; s < n.length; s++) + n[s] = r.getFloat(); + return new Ts(e, { wrapMode: ds.REPEAT, pixelFormat: cn.RGBA, dataType: rs.FLOAT, samplingMode: _n.NEAREST, width: i, height: i }, n); + } +}; +const Vnr = { shader: "materials/icon", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_vertexOffset", count: 2, type: Fi.SHORT }, { location: 2, name: "a_texCoords", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 3, name: "a_bitSetAndDistRatio", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 4, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 5, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 6, name: "a_outlineColor", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 7, name: "a_sizeAndOutlineWidth", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 8, name: "a_zoomRange", count: 2, type: Fi.UNSIGNED_SHORT }] }, hittestAttributes: ["a_vertexOffset", "a_texCoords"] }; +let F9e = class extends nre { + dispose() { + } + getGeometryType() { + return En.MARKER; + } + supportsSymbology(e) { + return e !== Zo.HEATMAP && e !== Zo.PIE_CHART; + } + drawGeometry(e, i, r, n) { + const { context: s, painter: o, rendererInfo: a, state: l, passOptions: c, requestRender: h, allowDelayedRender: p } = e, y = d4.load(r.materialKey), v = GMt(y.data), x = _e(c) && c.type === "hittest", { shader: I, vertexLayout: P, hittestAttributes: F } = Gu(v.programSpec, Vnr); + let k = ps.TRIANGLES, V = E3(y.data, P); + x && (V = this._getTriangleDesc(r.materialKey, V, F), k = ps.POINTS); + const { attributes: j, bufferLayouts: Y } = V, X = o.materialManager.getMaterialProgram(e, y, I, j, n); + if (p && _e(h) && !X.compiled) + return void h(); + s.useProgram(X), y.textureBinding && o.textureManager.bindTextures(s, X, y, !0), this._setSharedUniforms(X, e, i); + const Q = y.vvRotation ? l.displayViewMat3 : l.displayMat3; + X.setUniformMatrix3fv("u_displayMat3", Q), this._setSizeVVUniforms(y, X, a, i), this._setColorAndOpacityVVUniforms(y, X, a), this._setRotationVVUniforms(y, X, a); + const re = r.target.getVAO(s, Y, j, x); + let he = r.indexCount, fe = r.indexFrom * Uint32Array.BYTES_PER_ELEMENT; + x && (he /= 3, fe /= 3), s.bindVAO(re), this._drawMarkers(e, i, X, k, he, fe, x), s.bindVAO(null); + } + _drawMarkers(e, i, r, n, s, o, a) { + e.context.drawElements(n, s, Fi.UNSIGNED_INT, o); + } +}, uH = class { + constructor() { + this.name = this.constructor.name; + } + createOptions(e, i) { + return null; + } +}; +function jnr(t, e) { + const { textureFloat: i, colorBufferFloat: r } = t.capabilities, n = i?.textureFloat, s = i?.textureFloatLinear, o = i?.textureHalfFloat, a = i?.textureHalfFloatLinear, l = i?.HALF_FLOAT, c = r?.textureFloat, h = r?.textureHalfFloat, p = r?.floatBlend, y = Ru(t.driverTest).floatBufferBlend.result; + if (!n && !o) + throw new ot("heatmap:missing-texture-float", "HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float or OES_texture_half_float."); + if (!c && !h) + throw new ot("heatmap:missing-color-buffer-float", "HeatmapRenderer requires the WebGL extension EXT_color_buffer_float or EXT_color_buffer_half_float or WEBGL_color_buffer_float."); + if (!(p && y || h)) + throw new ot("heatmap:missing-float-blend", "HeatmapRenderer requires the WebGL extension EXT_float_blend or EXT_color_buffer_half_float." + (y ? "" : " This device claims support for EXT_float_blend, but does not actually support it.")); + const v = n && c && p && y, x = o && h, I = s, P = a, F = !!r?.R32F, k = !!r?.R16F; + if (v && (I || !P)) + return I || e.warnOnce("Missing WebGL extension OES_texture_float_linear. Heatmap quality may be reduced."), { dataType: rs.FLOAT, samplingMode: I ? _n.LINEAR : _n.NEAREST, pixelFormat: F ? cn.RED : cn.RGBA, internalFormat: F ? Vs.R32F : cn.RGBA }; + if (x) + return P || e.warnOnce("Missing WebGL extension OES_texture_half_float_linear. Heatmap quality may be reduced."), { dataType: l, samplingMode: P ? _n.LINEAR : _n.NEAREST, pixelFormat: k ? cn.RED : cn.RGBA, internalFormat: k ? Vs.R16F : cn.RGBA }; + throw new ot("heatmap:missing-hardware-support", "HeatmapRenderer requires WebGL extensions that allow it to render and blend to float or half float textures."); +} +const pnt = Ei.getLogger("esri.views.2d.engine.webgl.brushes.WGLBrushHeatmap"); +function fnt(t) { + return t.type === "heatmap"; +} +let Gnr = class extends F9e { + constructor() { + super(...arguments), this.brushEffect = new znr(); + } + supportsSymbology(e) { + return e === Zo.HEATMAP; + } + dispose() { + super.dispose(), this.brushEffect.dispose(), this.brushEffect = null; + } + prepareState() { + } + drawGeometry(e, i, r, n) { + const { defines: s } = this.brushEffect.loadQualityProfile(e.context); + super.drawGeometry(e, i, r, n ? [...n, ...s] : s); + } + _drawMarkers(e, i, r, n, s, o, a) { + const { context: l, rendererInfo: c, state: h } = e, { rendererSchema: p } = c; + I7(p, "heatmap"); + const { referenceScale: y, radius: v, isFieldActive: x } = p, I = v * (y !== 0 ? y / h.scale : 1); + r.setUniform1f("u_radius", I), a || (r.setUniform1f("u_isFieldActive", x), l.setStencilFunction(Ll.GEQUAL, i.stencilRef, 255)), l.drawElements(n, s, Fi.UNSIGNED_INT, o); + } +}; +const Unr = { vsPath: "heatmap/heatmapResolve", fsPath: "heatmap/heatmapResolve", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }; +let znr = class extends uH { + constructor() { + super(...arguments), this.name = this.constructor.name; + } + createOptions({ passOptions: e }) { + return e; + } + dispose() { + this._prevFBO = null, this._accumulateOutputTexture = Ua(this._accumulateOutputTexture), _e(this._accumulateFramebuffer) && this._accumulateFramebuffer.detachDepthStencilBuffer(), this._accumulateOutputStencilBuffer = Ua(this._accumulateOutputStencilBuffer), this._accumulateFramebuffer = Ua(this._accumulateFramebuffer), this._resolveGradientTexture = Ua(this._resolveGradientTexture), this._tileQuad = Ua(this._tileQuad); + } + bind(e) { + const { context: i, rendererInfo: r, passOptions: n } = e, { rendererSchema: s } = r; + !(_e(n) && n.type === "hittest") && fnt(s) && (this._prevFBO = i.getBoundFramebufferObject(), this._prevViewport = i.getViewport(), I7(s, "heatmap"), this._loadResources(e), this._updateResources(i, s), i.bindFramebuffer(this._accumulateFramebuffer), i.setViewport(0, 0, this._accumulateFramebuffer.width, this._accumulateFramebuffer.height), i.setStencilTestEnabled(!0), i.setBlendingEnabled(!0), i.setBlendFunction(gn.ONE, gn.ONE), i.setClearColor(0, 0, 0, 0), i.clear(NE.COLOR_BUFFER_BIT)); + } + unbind() { + this._prevFBO = null, this._prevViewport = null; + } + draw(e) { + const { context: i, painter: r, rendererInfo: n, passOptions: s } = e, { rendererSchema: o } = n; + if (_e(s) && s.type === "hittest" || !fnt(o)) + return; + const { defines: a } = this.loadQualityProfile(i), l = r.materialManager.getProgram(Unr, a); + i.useProgram(l), i.bindFramebuffer(this._prevFBO), i.setViewport(0, 0, this._prevViewport.width, this._prevViewport.height), i.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), i.setStencilTestEnabled(!1); + const { radius: c, minDensity: h, densityRange: p } = o; + i.bindTexture(this._accumulateOutputTexture, 8), i.bindTexture(this._resolveGradientTexture, 9), l.setUniform1i("u_texture", 8), l.setUniform1i("u_gradient", 9), l.setUniform2f("u_densityMinAndInvRange", h, 1 / p), l.setUniform1f("u_densityNormalization", 3 / (c * c * Math.PI)), this._tileQuad.draw(); + } + _loadResources({ context: e, painter: i }) { + const { dataType: r, samplingMode: n, pixelFormat: s, internalFormat: o, shadingRate: a, requiresSharedStencilBuffer: l } = this.loadQualityProfile(e), { width: c, height: h } = this._prevViewport, p = c * a, y = h * a; + this._accumulateOutputTexture ?? (this._accumulateOutputTexture = new Ts(e, { target: io.TEXTURE_2D, pixelFormat: s, internalFormat: o, dataType: r, samplingMode: n, wrapMode: ds.CLAMP_TO_EDGE, width: p, height: y })), l || (this._accumulateOutputStencilBuffer ?? (this._accumulateOutputStencilBuffer = new nO(e, { width: p, height: y, internalFormat: Ag.DEPTH_STENCIL }))), this._accumulateFramebuffer ?? (this._accumulateFramebuffer = new cd(e, {}, this._accumulateOutputTexture, l ? i.getSharedStencilBuffer() : this._accumulateOutputStencilBuffer)), this._resolveGradientTexture ?? (this._resolveGradientTexture = new Ts(e, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.LINEAR, wrapMode: ds.CLAMP_TO_EDGE })), this._tileQuad ?? (this._tileQuad = new kx(e, [0, 0, 1, 0, 0, 1, 1, 1])); + } + _updateResources(e, i) { + const { gradientHash: r, gradient: n } = i; + this._prevGradientHash !== r && (this._resolveGradientTexture.resize(n.length / 4, 1), this._resolveGradientTexture.setData(n), this._prevGradientHash = r); + const { shadingRate: s, requiresSharedStencilBuffer: o } = this.loadQualityProfile(e), { width: a, height: l } = this._prevViewport, c = a * s, h = l * s, { width: p, height: y } = this._accumulateFramebuffer; + if (p !== c || y !== h) { + const v = this._accumulateFramebuffer.depthStencilAttachment; + if (o && _e(v)) { + const { width: x, height: I } = v.descriptor; + x === c && I === h || (pnt.errorOnce("Attempted to resize shared stencil buffer! Detaching instead."), this._accumulateFramebuffer.detachDepthStencilBuffer()); + } + this._accumulateFramebuffer.resize(c, h); + } + o || e.blitFramebuffer(this._prevFBO, this._accumulateFramebuffer, 0, 0, this._prevFBO.width, this._prevFBO.height, 0, 0, this._accumulateFramebuffer.width, this._accumulateFramebuffer.height, NE.STENCIL_BUFFER_BIT, _n.NEAREST); + } + loadQualityProfile(e) { + if (ut(this._qualityProfile)) { + const i = jnr(e, pnt), r = e.type === go.WEBGL1; + this._qualityProfile = { ...i, requiresSharedStencilBuffer: r, shadingRate: r ? 1 : 0.25, defines: i.dataType !== rs.FLOAT ? ["heatmapPrecisionHalfFloat"] : [] }; + } + return this._qualityProfile; + } +}; +const JMe = { geometry: [new ea("a_pos", 2, Fi.BYTE, 0, 2)] }, Hnr = { geometry: [new ea("a_pos", 2, Fi.BYTE, 0, 4), new ea("a_tex", 2, Fi.BYTE, 2, 4)] }, zMt = { geometry: [new ea("a_pos", 2, Fi.UNSIGNED_SHORT, 0, 4)] }, mnt = { shaders: { vertexShader: Vg("tileInfo/tileInfo.vert"), fragmentShader: Vg("tileInfo/tileInfo.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }, Qoe = 300, eae = 32; +let HMt = class extends A1 { + constructor() { + super(...arguments), this._color = HI(1, 0, 0, 1); + } + dispose() { + this._outlineProgram?.dispose(), this._outlineProgram = null, this._tileInfoProgram?.dispose(), this._tileInfoProgram = null, this._outlineVertexArrayObject?.dispose(), this._outlineVertexArrayObject = null, this._tileInfoVertexArrayObject?.dispose(), this._tileInfoVertexArrayObject = null, this._canvas = null; + } + prepareState({ context: e }) { + e.setBlendingEnabled(!0), e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.setColorMask(!0, !0, !0, !0), e.setStencilWriteMask(0), e.setStencilTestEnabled(!1); + } + draw(e, i) { + const { context: r, requestRender: n, allowDelayedRender: s } = e; + if (!i.isReady) + return; + if (this._loadWGLResources(r), s && _e(n) && (!this._outlineProgram.compiled || !this._tileInfoProgram.compiled)) + return void n(); + r.bindVAO(this._outlineVertexArrayObject), r.useProgram(this._outlineProgram), this._outlineProgram.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs), this._outlineProgram.setUniform2f("u_coord_range", i.rangeX, i.rangeY), this._outlineProgram.setUniform1f("u_depth", 0), this._outlineProgram.setUniform4fv("u_color", this._color), r.drawArrays(ps.LINE_STRIP, 0, 4); + const o = this._getTexture(r, i); + o && (r.bindVAO(this._tileInfoVertexArrayObject), r.useProgram(this._tileInfoProgram), r.bindTexture(o, 0), this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs), this._tileInfoProgram.setUniform1f("u_depth", 0), this._tileInfoProgram.setUniform2f("u_coord_ratio", i.rangeX / i.width, i.rangeY / i.height), this._tileInfoProgram.setUniform2f("u_delta", 8, 8), this._tileInfoProgram.setUniform2f("u_dimensions", o.descriptor.width, o.descriptor.height), r.drawArrays(ps.TRIANGLE_STRIP, 0, 4)), r.bindVAO(); + } + _loadWGLResources(e) { + if (this._outlineProgram && this._tileInfoProgram) + return; + const i = SI(e, pte), r = SI(e, mnt), n = new Int8Array([0, 0, 1, 0, 1, 1, 0, 1]), s = Qo.createVertex(e, Vo.STATIC_DRAW, n), o = new Ac(e, pte.attributes, JMe, { geometry: s }), a = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), l = Qo.createVertex(e, Vo.STATIC_DRAW, a), c = new Ac(e, mnt.attributes, JMe, { geometry: l }); + this._outlineProgram = i, this._tileInfoProgram = r, this._outlineVertexArrayObject = o, this._tileInfoVertexArrayObject = c; + } + _getTexture(e, i) { + if (i.texture && i.triangleCountReportedInDebug === i.triangleCount) + return i.texture; + i.triangleCountReportedInDebug = i.triangleCount, this._canvas || (this._canvas = document.createElement("canvas"), this._canvas.setAttribute("id", "canvas2d"), this._canvas.setAttribute("width", `${Qoe}`), this._canvas.setAttribute("height", `${eae}`), this._canvas.setAttribute("style", "display:none")); + const r = i.triangleCount; + let n = i.key.id; + i.triangleCount > 0 && (n += `, ${r}`); + const s = this._canvas, o = s.getContext("2d"); + return o.font = "24px sans-serif", o.textAlign = "left", o.textBaseline = "top", o.clearRect(0, 0, Qoe, eae), r > 1e5 ? (o.fillStyle = "red", o.fillRect(0, 0, Qoe, eae), o.fillStyle = "black") : (o.clearRect(0, 0, Qoe, eae), o.fillStyle = "blue"), o.fillText(n, 0, 0), i.texture = new Ts(e, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE }, s), i.texture; + } +}, Wnr = class extends F9e { + supportsSymbology(e) { + return e === Zo.PIE_CHART; + } + _drawMarkers(e, i, r, n, s, o, a) { + const { context: l } = e, { rendererInfo: c } = e, { rendererSchema: h } = c; + I7(h, "pie-chart"), r.setUniform4fv("u_colors", h.colors), r.setUniform4fv("u_defaultColor", h.defaultColor), r.setUniform4fv("u_othersColor", h.othersColor), r.setUniform4fv("u_outlineColor", h.outlineColor), r.setUniform1f("u_donutRatio", h.holePercentage), r.setUniform1f("u_sectorThreshold", h.sectorThreshold), r.setUniform1f("u_outlineWidth", h.outlineWidth), l.drawElements(n, s, Fi.UNSIGNED_INT, o); + } +}, WMt = class extends A1 { + constructor() { + super(...arguments), this._color = HI(1, 0, 0, 1), this._initialized = !1; + } + dispose() { + this._solidProgram && (this._solidProgram.dispose(), this._solidProgram = null), this._solidVertexArrayObject && (this._solidVertexArrayObject.dispose(), this._solidVertexArrayObject = null); + } + prepareState({ context: e }) { + e.setDepthWriteEnabled(!1), e.setDepthTestEnabled(!1), e.setStencilTestEnabled(!0), e.setBlendingEnabled(!1), e.setColorMask(!1, !1, !1, !1), e.setStencilOp(su.KEEP, su.KEEP, su.REPLACE), e.setStencilWriteMask(255); + } + draw(e, i) { + const { context: r, requestRender: n, allowDelayedRender: s } = e; + this._initialized || this._initialize(r), s && _e(n) && !this._solidProgram.compiled ? n() : (r.setStencilFunctionSeparate(ax.FRONT_AND_BACK, Ll.GREATER, i.stencilRef, 255), r.bindVAO(this._solidVertexArrayObject), r.useProgram(this._solidProgram), this._solidProgram.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs), this._solidProgram.setUniform2fv("u_coord_range", [i.rangeX, i.rangeY]), this._solidProgram.setUniform1f("u_depth", 0), this._solidProgram.setUniform4fv("u_color", this._color), r.drawArrays(ps.TRIANGLE_STRIP, 0, 4), r.bindVAO()); + } + _initialize(e) { + if (this._initialized) + return !0; + const i = SI(e, pte); + if (!i) + return !1; + const r = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), n = Qo.createVertex(e, Vo.STATIC_DRAW, r), s = new Ac(e, pte.attributes, JMe, { geometry: n }); + return this._solidProgram = i, this._solidVertexArrayObject = s, this._initialized = !0, !0; + } +}, qnr = class extends A1 { + constructor() { + super(...arguments), this._color = HI(1, 0, 0, 1), this._patternMatrix = Ml(), this._programOptions = { id: !1, pattern: !1 }; + } + dispose() { + this._vao && (this._vao.dispose(), this._vao = null); + } + drawMany(e, i) { + const { context: r, painter: n, styleLayerUID: s, requestRender: o, allowDelayedRender: a } = e; + this._loadWGLResources(e); + const l = e.displayLevel, c = e.styleLayer, h = c.backgroundMaterial, p = n.vectorTilesMaterialManager, y = c.getPaintValue("background-color", l), v = c.getPaintValue("background-opacity", l), x = c.getPaintValue("background-pattern", l), I = x !== void 0, P = y[3] * v, F = 1 | window.devicePixelRatio, k = e.spriteMosaic; + let V, j; + const Y = F > zAt ? 2 : 1, X = e.drawPhase === lo.HITTEST, Q = this._programOptions; + Q.id = X, Q.pattern = I; + const re = p.getMaterialProgram(r, h, Q); + if (a && _e(o) && !re.compiled) + o(); + else { + if (r.bindVAO(this._vao), r.useProgram(re), I) { + const he = k.getMosaicItemPosition(x, !0); + if (_e(he)) { + const { tl: fe, br: be, page: Se } = he; + V = be[0] - fe[0], j = be[1] - fe[1]; + const Me = k.getPageSize(Se); + _e(Me) && (k.bind(r, _n.LINEAR, Se, lx), re.setUniform4f("u_tlbr", fe[0], fe[1], be[0], be[1]), re.setUniform2fv("u_mosaicSize", Me), re.setUniform1i("u_texture", lx)); + } + re.setUniform1f("u_opacity", v); + } else + this._color[0] = P * y[0], this._color[1] = P * y[1], this._color[2] = P * y[2], this._color[3] = P, re.setUniform4fv("u_color", this._color); + if (re.setUniform1f("u_depth", c.z || 0), X) { + const he = Yie(s + 1); + re.setUniform4fv("u_id", he); + } + for (const he of i) { + if (re.setUniform1f("u_coord_range", he.rangeX), re.setUniformMatrix3fv("u_dvsMat3", he.transforms.dvs), I) { + const fe = Math.max(2 ** (Math.round(l) - he.key.level), 1), be = Y * he.width * fe, Se = be / U7(V), Me = be / U7(j); + this._patternMatrix[0] = Se, this._patternMatrix[4] = Me, re.setUniformMatrix3fv("u_pattern_matrix", this._patternMatrix); + } + r.setStencilFunction(Ll.EQUAL, 0, 255), r.drawArrays(ps.TRIANGLE_STRIP, 0, 4); + } + } + } + _loadWGLResources(e) { + if (this._vao) + return; + const { context: i, styleLayer: r } = e, n = r.backgroundMaterial, s = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), o = Qo.createVertex(i, Vo.STATIC_DRAW, s), a = new Ac(i, n.getAttributeLocations(), n.getLayoutInfo(), { geometry: o }); + this._vao = a; + } +}, Ynr = class extends A1 { + constructor() { + super(...arguments), this._programOptions = { id: !1 }; + } + dispose() { + } + drawMany(e, i) { + const { context: r, displayLevel: n, requiredLevel: s, state: o, drawPhase: a, painter: l, spriteMosaic: c, styleLayerUID: h, requestRender: p, allowDelayedRender: y } = e; + if (!i.some((Q) => Q.layerData.get(h)?.circleIndexCount ?? !1)) + return; + const v = e.styleLayer, x = v.circleMaterial, I = l.vectorTilesMaterialManager, P = 1.2, F = v.getPaintValue("circle-translate", n), k = v.getPaintValue("circle-translate-anchor", n), V = a === lo.HITTEST, j = this._programOptions; + j.id = V; + const Y = I.getMaterialProgram(r, x, j); + if (y && _e(p) && !Y.compiled) + return void p(); + r.useProgram(Y), Y.setUniformMatrix3fv("u_displayMat3", k === U_.VIEWPORT ? o.displayMat3 : o.displayViewMat3), Y.setUniform2fv("u_circleTranslation", F), Y.setUniform1f("u_depth", v.z), Y.setUniform1f("u_antialiasingWidth", P); + let X = -1; + if (V) { + const Q = Yie(h + 1); + Y.setUniform4fv("u_id", Q); + } + for (const Q of i) { + if (!Q.layerData.has(h)) + continue; + Q.key.level !== X && (X = Q.key.level, x.setDataUniforms(Y, n, v, X, c)); + const re = Q.layerData.get(h); + if (!re.circleIndexCount) + continue; + re.prepareForRendering(r); + const he = re.circleVertexArrayObject; + ut(he) || (r.bindVAO(he), Y.setUniformMatrix3fv("u_dvsMat3", Q.transforms.dvs), s !== Q.key.level ? r.setStencilFunction(Ll.EQUAL, Q.stencilRef, 255) : r.setStencilFunction(Ll.GREATER, 255, 255), r.drawElements(ps.TRIANGLES, re.circleIndexCount, Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * re.circleIndexStart), Q.triangleCount += re.circleIndexCount / 3); + } + } +}; +const gnt = 1 / 65536; +let Xnr = class extends A1 { + constructor() { + super(...arguments), this._fillProgramOptions = { id: !1, pattern: !1 }, this._outlineProgramOptions = { id: !1 }; + } + dispose() { + } + drawMany(e, i) { + const { displayLevel: r, drawPhase: n, renderPass: s, spriteMosaic: o, styleLayerUID: a } = e; + let l = !1; + for (const Y of i) + if (Y.layerData.has(a)) { + const X = Y.layerData.get(a); + if (X.fillIndexCount > 0 || X.outlineIndexCount > 0) { + l = !0; + break; + } + } + if (!l) + return; + const c = e.styleLayer, h = c.getPaintProperty("fill-pattern"), p = h !== void 0, y = p && h.isDataDriven; + let v; + if (p && !y) { + const Y = h.getValue(r); + v = o.getMosaicItemPosition(Y, !0); + } + const x = !p && c.getPaintValue("fill-antialias", r); + let I = !0, P = 1; + if (!p) { + const Y = c.getPaintProperty("fill-color"), X = c.getPaintProperty("fill-opacity"); + if (!Y?.isDataDriven && !X?.isDataDriven) { + const Q = c.getPaintValue("fill-color", r); + P = c.getPaintValue("fill-opacity", r) * Q[3], P >= 1 && (I = !1); + } + } + if (I && s === "opaque") + return; + let F; + n === lo.HITTEST && (F = Yie(a + 1)); + const k = c.getPaintValue("fill-translate", r), V = c.getPaintValue("fill-translate-anchor", r); + (I || s !== "translucent") && this._drawFill(e, a, c, i, k, V, p, v, y, F); + const j = !c.hasDataDrivenOutlineColor && c.outlineUsesFillColor && P < 1; + x && s !== "opaque" && !j && this._drawOutline(e, a, c, i, k, V, F); + } + _drawFill(e, i, r, n, s, o, a, l, c, h) { + if (a && !c && ut(l)) + return; + const { context: p, displayLevel: y, state: v, drawPhase: x, painter: I, pixelRatio: P, spriteMosaic: F, requestRender: k, allowDelayedRender: V } = e, j = r.fillMaterial, Y = I.vectorTilesMaterialManager, X = P > zAt ? 2 : 1, Q = x === lo.HITTEST, re = this._fillProgramOptions; + re.id = Q, re.pattern = a; + const he = Y.getMaterialProgram(p, j, re); + if (V && _e(k) && !he.compiled) + return void k(); + if (p.useProgram(he), _e(l)) { + const { page: be } = l, Se = F.getPageSize(be); + _e(Se) && (F.bind(p, _n.LINEAR, be, lx), he.setUniform2fv("u_mosaicSize", Se), he.setUniform1i("u_texture", lx)); + } + he.setUniformMatrix3fv("u_displayMat3", o === U_.VIEWPORT ? v.displayMat3 : v.displayViewMat3), he.setUniform2fv("u_fillTranslation", s), he.setUniform1f("u_depth", r.z + gnt), Q && he.setUniform4fv("u_id", h); + let fe = -1; + for (const be of n) { + if (!be.layerData.has(i)) + continue; + be.key.level !== fe && (fe = be.key.level, j.setDataUniforms(he, y, r, fe, F)); + const Se = be.layerData.get(i); + if (!Se.fillIndexCount) + continue; + Se.prepareForRendering(p); + const Me = Se.fillVertexArrayObject; + if (!ut(Me)) { + if (p.bindVAO(Me), he.setUniformMatrix3fv("u_dvsMat3", be.transforms.dvs), p.setStencilFunction(Ll.EQUAL, be.stencilRef, 255), a) { + const ke = Math.max(2 ** (Math.round(y) - be.key.level), 1), J = be.rangeX / (X * be.width * ke); + he.setUniform1f("u_patternFactor", J); + } + if (c) { + const ke = Se.patternMap; + if (!ke) + continue; + for (const [J, ce] of ke) { + const xe = F.getPageSize(J); + _e(xe) && (F.bind(p, _n.LINEAR, J, lx), he.setUniform2fv("u_mosaicSize", xe), he.setUniform1i("u_texture", lx), p.drawElements(ps.TRIANGLES, ce[1], Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * ce[0])); + } + } else + p.drawElements(ps.TRIANGLES, Se.fillIndexCount, Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * Se.fillIndexStart); + be.triangleCount += Se.fillIndexCount / 3; + } + } + } + _drawOutline(e, i, r, n, s, o, a) { + const { context: l, displayLevel: c, state: h, drawPhase: p, painter: y, pixelRatio: v, spriteMosaic: x, requestRender: I, allowDelayedRender: P } = e, F = r.outlineMaterial, k = y.vectorTilesMaterialManager, V = 0.75 / v, j = p === lo.HITTEST, Y = this._outlineProgramOptions; + Y.id = j; + const X = k.getMaterialProgram(l, F, Y); + if (P && _e(I) && !X.compiled) + return void I(); + l.useProgram(X), X.setUniformMatrix3fv("u_displayMat3", o === U_.VIEWPORT ? h.displayMat3 : h.displayViewMat3), X.setUniform2fv("u_fillTranslation", s), X.setUniform1f("u_depth", r.z + gnt), X.setUniform1f("u_outline_width", V), j && X.setUniform4fv("u_id", a); + let Q = -1; + for (const re of n) { + if (!re.layerData.has(i)) + continue; + re.key.level !== Q && (Q = re.key.level, F.setDataUniforms(X, c, r, Q, x)); + const he = re.layerData.get(i); + if (he.prepareForRendering(l), !he.outlineIndexCount) + continue; + const fe = he.outlineVertexArrayObject; + ut(fe) || (l.bindVAO(fe), X.setUniformMatrix3fv("u_dvsMat3", re.transforms.dvs), l.setStencilFunction(Ll.EQUAL, re.stencilRef, 255), l.drawElements(ps.TRIANGLES, he.outlineIndexCount, Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * he.outlineIndexStart), re.triangleCount += he.outlineIndexCount / 3); + } + } +}, Knr = class extends A1 { + constructor() { + super(...arguments), this._programOptions = { id: !1, pattern: !1, sdf: !1 }; + } + dispose() { + } + drawMany(e, i) { + const { context: r, displayLevel: n, state: s, drawPhase: o, painter: a, pixelRatio: l, spriteMosaic: c, styleLayerUID: h, requestRender: p, allowDelayedRender: y } = e; + if (!i.some((Me) => Me.layerData.get(h)?.lineIndexCount ?? !1)) + return; + const v = e.styleLayer, x = v.lineMaterial, I = a.vectorTilesMaterialManager, P = v.getPaintValue("line-translate", n), F = v.getPaintValue("line-translate-anchor", n), k = v.getPaintProperty("line-pattern"), V = k !== void 0, j = V && k.isDataDriven; + let Y, X; + if (V && !j) { + const Me = k.getValue(n); + Y = c.getMosaicItemPosition(Me); + } + let Q = !1; + if (!V) { + const Me = v.getPaintProperty("line-dasharray"); + if (X = Me !== void 0, Q = X && Me.isDataDriven, X && !Q) { + const ke = Me.getValue(n), J = v.getDashKey(ke, v.getLayoutValue("line-cap", n)); + Y = c.getMosaicItemPosition(J); + } + } + const re = 1 / l, he = o === lo.HITTEST, fe = this._programOptions; + fe.id = he, fe.pattern = V, fe.sdf = X; + const be = I.getMaterialProgram(r, x, fe); + if (y && _e(p) && !be.compiled) + return void p(); + if (r.useProgram(be), be.setUniformMatrix3fv("u_displayViewMat3", s.displayViewMat3), be.setUniformMatrix3fv("u_displayMat3", F === U_.VIEWPORT ? s.displayMat3 : s.displayViewMat3), be.setUniform2fv("u_lineTranslation", P), be.setUniform1f("u_depth", v.z), be.setUniform1f("u_antialiasing", re), he) { + const Me = Yie(h + 1); + be.setUniform4fv("u_id", Me); + } + if (Y && _e(Y)) { + const { page: Me } = Y, ke = c.getPageSize(Me); + _e(ke) && (c.bind(r, _n.LINEAR, Me, lx), be.setUniform2fv("u_mosaicSize", ke), be.setUniform1i("u_texture", lx)); + } + let Se = -1; + for (const Me of i) { + if (!Me.layerData.has(h)) + continue; + Me.key.level !== Se && (Se = Me.key.level, x.setDataUniforms(be, n, v, Se, c)); + const ke = 2 ** (n - Se) / l; + be.setUniform1f("u_zoomFactor", ke); + const J = Me.layerData.get(h); + if (!J.lineIndexCount) + continue; + J.prepareForRendering(r); + const ce = J.lineVertexArrayObject; + if (!ut(ce)) { + if (r.bindVAO(ce), be.setUniformMatrix3fv("u_dvsMat3", Me.transforms.dvs), r.setStencilFunction(Ll.EQUAL, Me.stencilRef, 255), j || Q) { + const xe = J.patternMap; + if (!xe) + continue; + for (const [Pe, Oe] of xe) { + const Re = c.getPageSize(Pe); + _e(Re) && (c.bind(r, _n.LINEAR, Pe, lx), be.setUniform2fv("u_mosaicSize", Re), be.setUniform1i("u_texture", lx), r.drawElements(ps.TRIANGLES, Oe[1], Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * Oe[0])); + } + } else + r.drawElements(ps.TRIANGLES, J.lineIndexCount, Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * J.lineIndexStart); + Me.triangleCount += J.lineIndexCount / 3; + } + } + } +}; +const Jnr = 256 / 360, Znr = 1 / Math.LN2; +function Qnr(t, e) { + return (t %= e) >= 0 ? t : t + e; +} +function fte(t) { + return Qnr(t * Jnr, 256); +} +function ynt(t) { + return Math.log(t) * Znr; +} +const esr = 1 / 65536; +let tsr = class extends A1 { + constructor() { + super(...arguments), this._iconProgramOptions = { id: !1, sdf: !1 }, this._sdfProgramOptions = { id: !1 }, this._spritesTextureSize = cI(); + } + dispose() { + } + drawMany(e, i) { + const { drawPhase: r, styleLayerUID: n } = e, s = e.styleLayer; + let o; + r === lo.HITTEST && (o = Yie(n + 1)), this._drawIcons(e, s, i, o), this._drawText(e, s, i, o); + } + _drawIcons(e, i, r, n) { + const { context: s, displayLevel: o, drawPhase: a, painter: l, spriteMosaic: c, state: h, styleLayerUID: p, requestRender: y, allowDelayedRender: v } = e, x = i.iconMaterial, I = l.vectorTilesMaterialManager; + let P, F = !1; + for (const Se of r) + if (Se.layerData.has(p) && (P = Se.layerData.get(p), P.iconPerPageElementsMap.size > 0)) { + F = !0; + break; + } + if (!F) + return; + const k = i.getPaintValue("icon-translate", o), V = i.getPaintValue("icon-translate-anchor", o); + let j = i.getLayoutValue("icon-rotation-alignment", o); + j === nc.AUTO && (j = i.getLayoutValue("symbol-placement", o) === NO.POINT ? nc.VIEWPORT : nc.MAP); + const Y = j === nc.MAP, X = i.getLayoutValue("icon-keep-upright", o) && Y, Q = P.isIconSDF, re = a === lo.HITTEST, he = this._iconProgramOptions; + he.id = re, he.sdf = Q; + const fe = I.getMaterialProgram(s, x, he); + if (v && _e(y) && !fe.compiled) + return void y(); + s.useProgram(fe), fe.setUniformMatrix3fv("u_displayViewMat3", j === nc.MAP ? h.displayViewMat3 : h.displayMat3), fe.setUniformMatrix3fv("u_displayMat3", V === U_.VIEWPORT ? h.displayMat3 : h.displayViewMat3), fe.setUniform2fv("u_iconTranslation", k), fe.setUniform1f("u_depth", i.z), fe.setUniform1f("u_mapRotation", fte(h.rotation)), fe.setUniform1f("u_keepUpright", X ? 1 : 0), fe.setUniform1f("u_level", 10 * o), fe.setUniform1i("u_texture", lx), fe.setUniform1f("u_fadeDuration", JU / 1e3), re && fe.setUniform4fv("u_id", n); + let be = -1; + for (const Se of r) { + if (!Se.layerData.has(p) || (Se.key.level !== be && (be = Se.key.level, x.setDataUniforms(fe, o, i, be, c)), P = Se.layerData.get(p), P.iconPerPageElementsMap.size === 0)) + continue; + P.prepareForRendering(s), P.updateOpacityInfo(); + const Me = P.iconVertexArrayObject; + if (!ut(Me)) { + s.bindVAO(Me), fe.setUniformMatrix3fv("u_dvsMat3", Se.transforms.dvs), fe.setUniform1f("u_time", (performance.now() - P.lastOpacityUpdate) / 1e3); + for (const [ke, J] of P.iconPerPageElementsMap) + this._renderIconRange(e, fe, J, ke, Se); + } + } + } + _renderIconRange(e, i, r, n, s) { + const { context: o, spriteMosaic: a } = e; + this._spritesTextureSize[0] = a.getWidth(n) / 4, this._spritesTextureSize[1] = a.getHeight(n) / 4, i.setUniform2fv("u_mosaicSize", this._spritesTextureSize), a.bind(o, _n.LINEAR, n, lx), o.setStencilTestEnabled(!0), o.setStencilFunction(Ll.GREATER, 255, 255), o.setStencilWriteMask(0), o.drawElements(ps.TRIANGLES, r[1], Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * r[0]), s.triangleCount += r[1] / 3; + } + _drawText(e, i, r, n) { + const { context: s, displayLevel: o, drawPhase: a, glyphMosaic: l, painter: c, pixelRatio: h, spriteMosaic: p, state: y, styleLayerUID: v, requestRender: x, allowDelayedRender: I } = e, P = i.textMaterial, F = c.vectorTilesMaterialManager; + let k, V = !1; + for (const Ge of r) + if (Ge.layerData.has(v) && (k = Ge.layerData.get(v), k.glyphPerPageElementsMap.size > 0)) { + V = !0; + break; + } + if (!V) + return; + const j = i.getPaintProperty("text-opacity"); + if (j && !j.isDataDriven && j.getValue(o) === 0) + return; + const Y = i.getPaintProperty("text-color"), X = !Y || Y.isDataDriven || Y.getValue(o)[3] > 0, Q = i.getPaintProperty("text-halo-width"), re = i.getPaintProperty("text-halo-color"), he = (!Q || Q.isDataDriven || Q.getValue(o) > 0) && (!re || re.isDataDriven || re.getValue(o)[3] > 0); + if (!X && !he) + return; + const fe = 24 / 8; + let be = i.getLayoutValue("text-rotation-alignment", o); + be === nc.AUTO && (be = i.getLayoutValue("symbol-placement", o) === NO.POINT ? nc.VIEWPORT : nc.MAP); + const Se = be === nc.MAP, Me = i.getLayoutValue("text-keep-upright", o) && Se, ke = a === lo.HITTEST, J = 0.8 * fe / h; + this._glyphTextureSize || (this._glyphTextureSize = Tp(l.width / 4, l.height / 4)); + const ce = i.getPaintValue("text-translate", o), xe = i.getPaintValue("text-translate-anchor", o), Pe = this._sdfProgramOptions; + Pe.id = ke; + const Oe = F.getMaterialProgram(s, P, Pe); + if (I && _e(x) && !Oe.compiled) + return void x(); + s.useProgram(Oe), Oe.setUniformMatrix3fv("u_displayViewMat3", be === nc.MAP ? y.displayViewMat3 : y.displayMat3), Oe.setUniformMatrix3fv("u_displayMat3", xe === U_.VIEWPORT ? y.displayMat3 : y.displayViewMat3), Oe.setUniform2fv("u_textTranslation", ce), Oe.setUniform1f("u_depth", i.z + esr), Oe.setUniform2fv("u_mosaicSize", this._glyphTextureSize), Oe.setUniform1f("u_mapRotation", fte(y.rotation)), Oe.setUniform1f("u_keepUpright", Me ? 1 : 0), Oe.setUniform1f("u_level", 10 * o), Oe.setUniform1i("u_texture", QJe), Oe.setUniform1f("u_antialiasingWidth", J), Oe.setUniform1f("u_fadeDuration", JU / 1e3), ke && Oe.setUniform4fv("u_id", n); + let Re = -1; + for (const Ge of r) { + if (!Ge.layerData.has(v) || (Ge.key.level !== Re && (Re = Ge.key.level, P.setDataUniforms(Oe, o, i, Re, p)), k = Ge.layerData.get(v), k.glyphPerPageElementsMap.size === 0)) + continue; + k.prepareForRendering(s), k.updateOpacityInfo(); + const je = k.textVertexArrayObject; + if (ut(je)) + continue; + s.bindVAO(je), Oe.setUniformMatrix3fv("u_dvsMat3", Ge.transforms.dvs), s.setStencilTestEnabled(!0), s.setStencilFunction(Ll.GREATER, 255, 255), s.setStencilWriteMask(0); + const et = (performance.now() - k.lastOpacityUpdate) / 1e3; + Oe.setUniform1f("u_time", et), k.glyphPerPageElementsMap.forEach((Qe, tt) => { + this._renderGlyphRange(s, Qe, tt, l, Oe, he, X, Ge); + }); + } + } + _renderGlyphRange(e, i, r, n, s, o, a, l) { + n.bind(e, _n.LINEAR, r, QJe), o && (s.setUniform1f("u_halo", 1), e.drawElements(ps.TRIANGLES, i[1], Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i[0]), l.triangleCount += i[1] / 3), a && (s.setUniform1f("u_halo", 0), e.drawElements(ps.TRIANGLES, i[1], Fi.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i[0]), l.triangleCount += i[1] / 3); + } +}; +const isr = (t) => E3(t.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 3, name: "a_haloColor", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 4, name: "a_texAndSize", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 5, name: "a_refSymbolAndPlacementOffset", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 6, name: "a_glyphData", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 7, name: "a_vertexOffset", count: 2, type: Fi.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: Fi.UNSIGNED_SHORT }] }); +let rsr = class extends nre { + dispose() { + } + getGeometryType() { + return En.LABEL; + } + supportsSymbology(e) { + return !0; + } + drawGeometry(e, i, r, n) { + const { context: s, painter: o, state: a, rendererInfo: l, requestRender: c, allowDelayedRender: h } = e, p = _F.load(r.materialKey), y = p.mapAligned ? 1 : 0; + if (!y && Math.abs(i.key.level - Math.round(100 * e.displayLevel) / 100) >= 1) + return; + const { bufferLayouts: v, attributes: x } = isr(p), I = o.materialManager.getMaterialProgram(e, p, "materials/label", x, n); + if (h && _e(c) && !I.compiled) + return void c(); + e.context.setStencilFunction(Ll.EQUAL, 0, 255), s.useProgram(I), this._setSharedUniforms(I, e, i), o.textureManager.bindTextures(s, I, p); + const P = y === 1 ? a.displayViewMat3 : a.displayMat3; + this._setSizeVVUniforms(p, I, l, i), I.setUniform1f("u_mapRotation", Math.floor(a.rotation / 360 * 254)), I.setUniform1f("u_mapAligned", y), I.setUniformMatrix3fv("u_displayMat3", P), I.setUniform1f("u_opacity", 1), I.setUniform2fv("u_screenSize", e.state.size); + const F = r.target.getVAO(s, v, x), k = r.indexFrom * Uint32Array.BYTES_PER_ELEMENT; + s.bindVAO(F), I.setUniform1f("u_isHaloPass", 0), I.setUniform1f("u_isBackgroundPass", 1), s.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, k), I.setUniform1f("u_isHaloPass", 1), I.setUniform1f("u_isBackgroundPass", 0), s.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, k), I.setUniform1f("u_isHaloPass", 0), I.setUniform1f("u_isBackgroundPass", 0), s.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, k), s.setStencilTestEnabled(!0), s.setBlendingEnabled(!0); + } +}; +const nsr = (t) => E3(t.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 3, name: "a_offsetAndNormal", count: 4, type: Fi.BYTE }, { location: 4, name: "a_accumulatedDistanceAndHalfWidth", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 5, name: "a_tlbr", count: 4, type: Fi.UNSIGNED_SHORT }, { location: 6, name: "a_segmentDirection", count: 4, type: Fi.BYTE }, { location: 7, name: "a_aux", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 8, name: "a_zoomRange", count: 2, type: Fi.UNSIGNED_SHORT }] }); +let ssr = class extends nre { + dispose() { + } + getGeometryType() { + return En.LINE; + } + supportsSymbology(e) { + return !0; + } + drawGeometry(e, i, r, n) { + const { context: s, painter: o, rendererInfo: a, displayLevel: l, passOptions: c, requestRender: h, allowDelayedRender: p } = e, y = a3.load(r.materialKey), v = _e(c) && c.type === "hittest"; + let x = nsr(y), I = ps.TRIANGLES; + v && (x = this._getTriangleDesc(r.materialKey, x), I = ps.POINTS); + const { attributes: P, bufferLayouts: F } = x, k = o.materialManager.getMaterialProgram(e, y, "materials/line", P, n); + if (p && _e(h) && !k.compiled) + return void h(); + const V = 1 / e.pixelRatio, j = 0; + s.useProgram(k), this._setSharedUniforms(k, e, i), y.textureBinding && o.textureManager.bindTextures(s, k, y); + const Y = 2 ** (l - i.key.level); + k.setUniform1f("u_zoomFactor", Y), k.setUniform1f("u_blur", j + V), k.setUniform1f("u_antialiasing", V), this._setSizeVVUniforms(y, k, a, i), this._setColorAndOpacityVVUniforms(y, k, a), s.setFaceCullingEnabled(!1); + const X = r.target.getVAO(s, F, P, v); + let Q = r.indexCount, re = r.indexFrom * Uint32Array.BYTES_PER_ELEMENT; + v && (Q /= 3, re /= 3), s.bindVAO(X), s.drawElements(I, Q, Fi.UNSIGNED_INT, re); + } +}; +const osr = (t) => E3(t.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.SHORT }, { location: 1, name: "a_id", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 3, name: "a_haloColor", count: 4, type: Fi.UNSIGNED_BYTE, normalized: !0 }, { location: 4, name: "a_texFontSize", count: 4, type: Fi.UNSIGNED_BYTE }, { location: 5, name: "a_aux", count: 4, type: Fi.BYTE }, { location: 6, name: "a_zoomRange", count: 2, type: Fi.UNSIGNED_SHORT }, { location: 7, name: "a_vertexOffset", count: 2, type: Fi.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: Fi.UNSIGNED_SHORT }] }); +let asr = class extends nre { + dispose() { + } + getGeometryType() { + return En.TEXT; + } + supportsSymbology(e) { + return !0; + } + drawGeometry(e, i, r, n) { + const { context: s, painter: o, rendererInfo: a, state: l, passOptions: c, requestRender: h, allowDelayedRender: p } = e, y = nz.load(r.materialKey), v = _e(c) && c.type === "hittest", { bufferLayouts: x, attributes: I } = osr(y), P = o.materialManager.getMaterialProgram(e, y, "materials/text", I, n); + if (p && _e(h) && !P.compiled) + return void h(); + s.useProgram(P); + let F = ps.TRIANGLES; + v && (F = ps.POINTS), this._setSharedUniforms(P, e, i), o.textureManager.bindTextures(s, P, y), P.setUniformMatrix3fv("u_displayMat3", l.displayMat3), P.setUniformMatrix3fv("u_displayViewMat3", l.displayViewMat3), this._setSizeVVUniforms(y, P, a, i), this._setColorAndOpacityVVUniforms(y, P, a), this._setRotationVVUniforms(y, P, a); + const k = r.target.getVAO(s, x, I), V = r.indexFrom * Uint32Array.BYTES_PER_ELEMENT; + P.setUniform1f("u_isHaloPass", 0), P.setUniform1f("u_isBackgroundPass", 1), s.bindVAO(k), s.drawElements(F, r.indexCount, Fi.UNSIGNED_INT, V), P.setUniform1f("u_isHaloPass", 1), P.setUniform1f("u_isBackgroundPass", 0), s.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, V), P.setUniform1f("u_isHaloPass", 0), P.setUniform1f("u_isBackgroundPass", 0), s.drawElements(F, r.indexCount, Fi.UNSIGNED_INT, V); + } +}; +const fh = { marker: F9e, line: ssr, fill: UMt, text: asr, label: rsr, clip: Onr, stencil: WMt, bitmap: ynr, overlay: Mnr, tileInfo: HMt, vtlBackground: qnr, vtlFill: Xnr, vtlLine: Knr, vtlCircle: Ynr, vtlSymbol: tsr, dotDensity: Bnr, heatmap: Gnr, pieChart: Wnr }, lsr = { background: { "background.frag": `#ifdef PATTERN +uniform lowp float u_opacity; +uniform lowp sampler2D u_texture; +varying mediump vec4 v_tlbr; +varying mediump vec2 v_tileTextureCoord; +#else +uniform lowp vec4 u_color; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() { +#ifdef PATTERN +mediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0); +mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); +lowp vec4 color = texture2D(u_texture, samplePos); +gl_FragColor = u_opacity * color; +#else +gl_FragColor = u_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "background.vert": `precision mediump float; +attribute vec2 a_pos; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform mediump float u_coord_range; +uniform mediump float u_depth; +#ifdef PATTERN +uniform mediump mat3 u_pattern_matrix; +varying mediump vec2 v_tileTextureCoord; +uniform mediump vec4 u_tlbr; +uniform mediump vec2 u_mosaicSize; +varying mediump vec4 v_tlbr; +#endif +void main() { +gl_Position = vec4((u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0)).xy, u_depth, 1.0); +#ifdef PATTERN +v_tileTextureCoord = (u_pattern_matrix * vec3(a_pos, 1.0)).xy; +v_tlbr = u_tlbr / u_mosaicSize.xyxy; +#endif +#ifdef ID +v_id = u_id / 255.0; +#endif +}` }, circle: { "circle.frag": `precision lowp float; +varying lowp vec4 v_color; +varying lowp vec4 v_stroke_color; +varying mediump float v_blur; +varying mediump float v_stroke_width; +varying mediump float v_radius; +varying mediump vec2 v_offset; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +mediump float dist = length(v_offset); +mediump float alpha = smoothstep(0.0, -v_blur, dist - 1.0); +lowp float color_mix_ratio = v_stroke_width < 0.01 ? 0.0 : smoothstep(-v_blur, 0.0, dist - v_radius / (v_radius + v_stroke_width)); +gl_FragColor = alpha * mix(v_color, v_stroke_color, color_mix_ratio); +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "circle.vert": `precision mediump float; +attribute vec2 a_pos; +#pragma header +varying lowp vec4 v_color; +varying lowp vec4 v_stroke_color; +varying mediump float v_blur; +varying mediump float v_stroke_width; +varying mediump float v_radius; +varying mediump vec2 v_offset; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump vec2 u_circleTranslation; +uniform mediump float u_depth; +uniform mediump float u_antialiasingWidth; +void main() +{ +#pragma main +v_color = color * opacity; +v_stroke_color = stroke_color * stroke_opacity; +v_stroke_width = stroke_width; +v_radius = radius; +v_blur = max(blur, u_antialiasingWidth / (radius + stroke_width)); +mediump vec2 offset = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); +v_offset = offset; +#ifdef ID +v_id = u_id / 255.0; +#endif +mediump vec3 pos = u_dvsMat3 * vec3(a_pos * 0.5, 1.0) + u_displayMat3 * vec3((v_radius + v_stroke_width) * offset + u_circleTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}` }, fill: { "fill.frag": `precision lowp float; +#ifdef PATTERN +uniform lowp sampler2D u_texture; +varying mediump vec2 v_tileTextureCoord; +varying mediump vec4 v_tlbr; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +vec4 mixColors(vec4 color1, vec4 color2) { +float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); +vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); +return vec4(compositeColor, compositeAlpha); +} +void main() +{ +#ifdef PATTERN +mediump vec2 normalizedTextureCoord = fract(v_tileTextureCoord); +mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); +lowp vec4 color = texture2D(u_texture, samplePos); +gl_FragColor = v_color[3] * color; +#else +gl_FragColor = v_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "fill.vert": `precision mediump float; +attribute vec2 a_pos; +#pragma header +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump float u_depth; +uniform mediump vec2 u_fillTranslation; +#ifdef PATTERN +#include +uniform mediump vec2 u_mosaicSize; +uniform mediump float u_patternFactor; +varying mediump vec2 v_tileTextureCoord; +varying mediump vec4 v_tlbr; +#endif +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +void main() +{ +#pragma main +v_color = color * opacity; +#ifdef ID +v_id = u_id / 255.0; +#endif +#ifdef PATTERN +float patternWidth = nextPOT(tlbr.z - tlbr.x); +float patternHeight = nextPOT(tlbr.w - tlbr.y); +float scaleX = 1.0 / (patternWidth * u_patternFactor); +float scaleY = 1.0 / (patternHeight * u_patternFactor); +mat3 patterMat = mat3(scaleX, 0.0, 0.0, +0.0, -scaleY, 0.0, +0.0, 0.0, 1.0); +v_tileTextureCoord = (patterMat * vec3(a_pos, 1.0)).xy; +v_tlbr = tlbr / u_mosaicSize.xyxy; +#endif +vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(u_fillTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}` }, icon: { "icon.frag": `precision mediump float; +uniform lowp sampler2D u_texture; +#ifdef SDF +uniform lowp vec4 u_color; +uniform lowp vec4 u_outlineColor; +#endif +varying mediump vec2 v_tex; +varying lowp float v_opacity; +varying mediump vec2 v_size; +varying lowp vec4 v_color; +#ifdef SDF +varying mediump flaot v_halo_width; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +#include +vec4 mixColors(vec4 color1, vec4 color2) { +float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); +vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); +return vec4(compositeColor, compositeAlpha); +} +void main() +{ +#ifdef SDF +lowp vec4 fillPixelColor = v_color; +float d = rgba2float(texture2D(u_texture, v_tex)) - 0.5; +const float softEdgeRatio = 0.248062016; +float size = max(v_size.x, v_size.y); +float dist = d * softEdgeRatio * size; +fillPixelColor *= clamp(0.5 - dist, 0.0, 1.0); +if (v_halo_width > 0.25) { +lowp vec4 outlinePixelColor = u_outlineColor; +const float outlineLimitRatio = (16.0 / 86.0); +float clampedOutlineSize = softEdgeRatio * min(v_halo_width, outlineLimitRatio * max(v_size.x, v_size.y)); +outlinePixelColor *= clamp(0.5 - (abs(dist) - clampedOutlineSize), 0.0, 1.0); +gl_FragColor = v_opacity * mixColors(fillPixelColor, outlinePixelColor); +} +else { +gl_FragColor = v_opacity * fillPixelColor; +} +#else +lowp vec4 texColor = texture2D(u_texture, v_tex); +gl_FragColor = v_opacity * texColor; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "icon.vert": `attribute vec2 a_pos; +attribute vec2 a_vertexOffset; +attribute vec4 a_texAngleRange; +attribute vec4 a_levelInfo; +attribute float a_opacityInfo; +#pragma header +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +#ifdef SDF +varying mediump float v_halo_width; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump vec2 u_iconTranslation; +uniform vec2 u_mosaicSize; +uniform mediump float u_depth; +uniform mediump float u_mapRotation; +uniform mediump float u_level; +uniform lowp float u_keepUpright; +uniform mediump float u_fadeDuration; +varying mediump vec2 v_tex; +varying lowp float v_opacity; +varying mediump vec2 v_size; +const float C_OFFSET_PRECISION = 1.0 / 8.0; +const float C_256_TO_RAD = 3.14159265359 / 128.0; +const float C_DEG_TO_RAD = 3.14159265359 / 180.0; +const float tileCoordRatio = 1.0 / 8.0; +uniform highp float u_time; +void main() +{ +#pragma main +v_color = color; +v_opacity = opacity; +#ifdef SDF +v_halo_width = halo_width; +#endif +float modded = mod(a_opacityInfo, 128.0); +float targetOpacity = (a_opacityInfo - modded) / 128.0; +float startOpacity = modded / 127.0; +float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); +v_opacity *= interpolatedOpacity; +mediump float a_angle = a_levelInfo[1]; +mediump float a_minLevel = a_levelInfo[2]; +mediump float a_maxLevel = a_levelInfo[3]; +mediump vec2 a_tex = a_texAngleRange.xy; +mediump float delta_z = 0.0; +mediump float rotated = mod(a_angle + u_mapRotation, 256.0); +delta_z += (1.0 - step(u_keepUpright, 0.0)) * step(64.0, rotated) * (1.0 - step(192.0, rotated)); +delta_z += 1.0 - step(a_minLevel, u_level); +delta_z += step(a_maxLevel, u_level); +delta_z += step(v_opacity, 0.0); +vec2 offset = C_OFFSET_PRECISION * a_vertexOffset; +v_size = abs(offset); +#ifdef SDF +offset = (120.0 / 86.0) * offset; +#endif +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayViewMat3 * vec3(size * offset, 0.0) + u_displayMat3 * vec3(u_iconTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); +#ifdef ID +v_id = u_id / 255.0; +#endif +v_tex = a_tex.xy / u_mosaicSize; +}` }, line: { "line.frag": `precision lowp float; +varying mediump vec2 v_normal; +varying highp float v_accumulatedDistance; +varying mediump float v_lineHalfWidth; +varying lowp vec4 v_color; +varying mediump float v_blur; +#if defined (PATTERN) || defined(SDF) +varying mediump vec4 v_tlbr; +varying mediump vec2 v_patternSize; +varying mediump float v_widthRatio; +uniform sampler2D u_texture; +uniform mediump float u_antialiasing; +#endif +#ifdef SDF +#include +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +mediump float fragDist = length(v_normal) * v_lineHalfWidth; +lowp float alpha = clamp((v_lineHalfWidth - fragDist) / v_blur, 0.0, 1.0); +#ifdef PATTERN +mediump float relativeTexX = fract(v_accumulatedDistance / (v_patternSize.x * v_widthRatio)); +mediump float relativeTexY = 0.5 + v_normal.y * v_lineHalfWidth / (v_patternSize.y * v_widthRatio); +mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); +lowp vec4 color = texture2D(u_texture, texCoord); +gl_FragColor = alpha * v_color[3] * color; +#elif defined(SDF) +mediump float relativeTexX = fract((v_accumulatedDistance * 0.5) / (v_patternSize.x * v_widthRatio)); +mediump float relativeTexY = 0.5 + 0.25 * v_normal.y; +mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); +mediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5; +float dist = d * (v_lineHalfWidth + u_antialiasing / 2.0); +gl_FragColor = alpha * clamp(0.5 - dist, 0.0, 1.0) * v_color; +#else +gl_FragColor = alpha * v_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "line.vert": `precision mediump float; +attribute vec2 a_pos; +attribute vec4 a_extrude_offset; +attribute vec4 a_dir_normal; +attribute vec2 a_accumulatedDistance; +#pragma header +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump float u_zoomFactor; +uniform mediump vec2 u_lineTranslation; +uniform mediump float u_antialiasing; +uniform mediump float u_depth; +varying mediump vec2 v_normal; +varying highp float v_accumulatedDistance; +const float scale = 1.0 / 31.0; +const mediump float tileCoordRatio = 8.0; +#if defined (SDF) +const mediump float sdfPatternHalfWidth = 15.5; +#endif +#if defined (PATTERN) || defined(SDF) +uniform mediump vec2 u_mosaicSize; +varying mediump vec4 v_tlbr; +varying mediump vec2 v_patternSize; +varying mediump float v_widthRatio; +#endif +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +varying mediump float v_lineHalfWidth; +varying mediump float v_blur; +void main() +{ +#pragma main +v_color = color * opacity; +v_blur = blur + u_antialiasing; +v_normal = a_dir_normal.zw * scale; +#if defined (PATTERN) || defined(SDF) +v_tlbr = tlbr / u_mosaicSize.xyxy; +v_patternSize = vec2(tlbr.z - tlbr.x, tlbr.y - tlbr.w); +#if defined (PATTERN) +v_widthRatio = width / v_patternSize.y; +#else +v_widthRatio = width / sdfPatternHalfWidth / 2.0; +#endif +#endif +v_lineHalfWidth = (width + u_antialiasing) * 0.5; +mediump vec2 dir = a_dir_normal.xy * scale; +mediump vec2 offset_ = a_extrude_offset.zw * scale * offset; +mediump vec2 dist = v_lineHalfWidth * scale * a_extrude_offset.xy; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos + offset_ * tileCoordRatio / u_zoomFactor, 1.0) + u_displayViewMat3 * vec3(dist, 0.0) + u_displayMat3 * vec3(u_lineTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +#if defined (PATTERN) || defined(SDF) +v_accumulatedDistance = a_accumulatedDistance.x * u_zoomFactor / tileCoordRatio + dot(dir, dist + offset_); +#endif +#ifdef ID +v_id = u_id / 255.0; +#endif +}` }, outline: { "outline.frag": `varying lowp vec4 v_color; +varying mediump vec2 v_normal; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +lowp float dist = abs(v_normal.y); +lowp float alpha = smoothstep(1.0, 0.0, dist); +gl_FragColor = alpha * v_color; +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "outline.vert": `attribute vec2 a_pos; +attribute vec2 a_offset; +attribute vec2 a_xnormal; +#pragma header +varying lowp vec4 v_color; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump vec2 u_fillTranslation; +uniform mediump float u_depth; +uniform mediump float u_outline_width; +varying lowp vec2 v_normal; +const float scale = 1.0 / 15.0; +void main() +{ +#pragma main +v_color = color * opacity; +#ifdef ID +v_id = u_id / 255.0; +#endif +v_normal = a_xnormal; +mediump vec2 dist = u_outline_width * scale * a_offset; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(dist + u_fillTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}` }, text: { "text.frag": `uniform lowp sampler2D u_texture; +varying lowp vec2 v_tex; +varying lowp vec4 v_color; +varying mediump float v_edgeWidth; +varying mediump float v_edgeDistance; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +lowp float dist = texture2D(u_texture, v_tex).a; +mediump float alpha = smoothstep(v_edgeDistance - v_edgeWidth, v_edgeDistance + v_edgeWidth, dist); +gl_FragColor = alpha * v_color; +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`, "text.vert": `attribute vec2 a_pos; +attribute vec2 a_vertexOffset; +attribute vec4 a_texAngleRange; +attribute vec4 a_levelInfo; +attribute float a_opacityInfo; +#pragma header +varying lowp vec4 v_color; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump vec2 u_textTranslation; +uniform vec2 u_mosaicSize; +uniform mediump float u_depth; +uniform mediump float u_mapRotation; +uniform mediump float u_level; +uniform lowp float u_keepUpright; +uniform mediump float u_fadeDuration; +varying lowp vec2 v_tex; +const float offsetPrecision = 1.0 / 8.0; +const mediump float edgePos = 0.75; +uniform mediump float u_antialiasingWidth; +varying mediump float v_edgeDistance; +varying mediump float v_edgeWidth; +uniform lowp float u_halo; +const float sdfFontScale = 1.0 / 24.0; +const float sdfPixel = 3.0; +uniform highp float u_time; +void main() +{ +#pragma main +if (u_halo > 0.5) +{ +v_color = halo_color * opacity; +halo_width *= sdfPixel; +halo_blur *= sdfPixel; +} +else +{ +v_color = color * opacity; +halo_width = 0.0; +halo_blur = 0.0; +} +float modded = mod(a_opacityInfo, 128.0); +float targetOpacity = (a_opacityInfo - modded) / 128.0; +float startOpacity = modded / 127.0; +float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); +v_color *= interpolatedOpacity; +mediump float a_angle = a_levelInfo[1]; +mediump float a_minLevel = a_levelInfo[2]; +mediump float a_maxLevel = a_levelInfo[3]; +mediump vec2 a_tex = a_texAngleRange.xy; +mediump float a_visMinAngle = a_texAngleRange.z; +mediump float a_visMaxAngle = a_texAngleRange.w; +mediump float delta_z = 0.0; +mediump float angle = mod(a_angle + u_mapRotation, 256.0); +if (a_visMinAngle < a_visMaxAngle) +{ +delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) + (1.0 - step(a_visMinAngle, angle))); +} +else +{ +delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) * (1.0 - step(a_visMinAngle, angle))); +} +delta_z += 1.0 - step(a_minLevel, u_level); +delta_z += step(a_maxLevel, u_level); +delta_z += step(v_color[3], 0.0); +v_tex = a_tex.xy / u_mosaicSize; +#ifdef ID +v_id = u_id / 255.0; +#endif +v_edgeDistance = edgePos - halo_width / size; +v_edgeWidth = (u_antialiasingWidth + halo_blur) / size; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + sdfFontScale * u_displayViewMat3 * vec3(offsetPrecision * size * a_vertexOffset, 0.0) + u_displayMat3 * vec3(u_textTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); +}` }, util: { "encoding.glsl": `const vec4 rgba2float_factors = vec4( +255.0 / (256.0), +255.0 / (256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0 * 256.0) +); +float rgba2float(vec4 rgba) { +return dot(rgba, rgba2float_factors); +}`, "util.glsl": `float nextPOT(in float x) { +return pow(2.0, ceil(log2(abs(x)))); +}` } }; +function usr(t) { + let e = lsr; + return t.split("/").forEach((i) => { + e && (e = e[i]); + }), e; +} +const csr = new D9e(usr); +function b1(t) { + return csr.resolveIncludes(t); +} +const vnt = (t) => P3({ ID: t.id, PATTERN: t.pattern }), hsr = { shaders: (t) => ({ vertexShader: vnt(t) + b1("background/background.vert"), fragmentShader: vnt(t) + b1("background/background.frag") }) }, _nt = (t) => P3({ ID: t.id }), dsr = { shaders: (t) => ({ vertexShader: _nt(t) + b1("circle/circle.vert"), fragmentShader: _nt(t) + b1("circle/circle.frag") }) }, bnt = (t) => P3({ ID: t.id, PATTERN: t.pattern }), psr = { shaders: (t) => ({ vertexShader: bnt(t) + b1("fill/fill.vert"), fragmentShader: bnt(t) + b1("fill/fill.frag") }) }, wnt = (t) => P3({ ID: t.id }), fsr = { shaders: (t) => ({ vertexShader: wnt(t) + b1("outline/outline.vert"), fragmentShader: wnt(t) + b1("outline/outline.frag") }) }, xnt = (t) => P3({ ID: t.id, SDF: t.sdf }), msr = { shaders: (t) => ({ vertexShader: xnt(t) + b1("icon/icon.vert"), fragmentShader: xnt(t) + b1("icon/icon.frag") }) }, Snt = (t) => P3({ ID: t.id, PATTERN: t.pattern, SDF: t.sdf }), gsr = { shaders: (t) => ({ vertexShader: Snt(t) + b1("line/line.vert"), fragmentShader: Snt(t) + b1("line/line.frag") }) }, Cnt = (t) => P3({ ID: t.id }), ysr = { shaders: (t) => ({ vertexShader: Cnt(t) + b1("text/text.vert"), fragmentShader: Cnt(t) + b1("text/text.frag") }) }; +let vsr = class { + constructor() { + this._programByKey = /* @__PURE__ */ new Map(); + } + dispose() { + this._programByKey.forEach((e) => e.dispose()), this._programByKey.clear(); + } + getMaterialProgram(e, i, r) { + const n = i.key << 3 | this._getMaterialOptionsValue(i.type, r); + if (this._programByKey.has(n)) + return this._programByKey.get(n); + const s = this._getProgramTemplate(i.type), { shaders: o } = s, { vertexShader: a, fragmentShader: l } = o(r), c = i.getShaderHeader(), h = i.getShaderMain(), p = a.replace("#pragma header", c).replace("#pragma main", h), y = e.programCache.acquire(p, l, i.getAttributeLocations()); + return this._programByKey.set(n, y), y; + } + _getMaterialOptionsValue(e, i) { + switch (e) { + case _p.BACKGROUND: { + const r = i; + return (r.pattern ? 1 : 0) << 1 | (r.id ? 1 : 0); + } + case _p.FILL: { + const r = i; + return (r.pattern ? 1 : 0) << 1 | (r.id ? 1 : 0); + } + case _p.OUTLINE: + return i.id ? 1 : 0; + case _p.LINE: { + const r = i; + return (r.sdf ? 1 : 0) << 2 | (r.pattern ? 1 : 0) << 1 | (r.id ? 1 : 0); + } + case _p.ICON: { + const r = i; + return (r.sdf ? 1 : 0) << 1 | (r.id ? 1 : 0); + } + case _p.CIRCLE: + return i.id ? 1 : 0; + case _p.TEXT: + return i.id ? 1 : 0; + default: + return 0; + } + } + _getProgramTemplate(e) { + switch (e) { + case _p.BACKGROUND: + return hsr; + case _p.CIRCLE: + return dsr; + case _p.FILL: + return psr; + case _p.ICON: + return msr; + case _p.LINE: + return gsr; + case _p.OUTLINE: + return fsr; + case _p.TEXT: + return ysr; + default: + return null; + } + } +}; +const Tnt = { shaders: { vertexShader: Vg("bitBlit/bitBlit.vert"), fragmentShader: Vg("bitBlit/bitBlit.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_tex", 1]]) }; +let qMt = class { + constructor() { + this._initialized = !1; + } + dispose() { + this._program = Ua(this._program), this._vertexArrayObject = Ua(this._vertexArrayObject); + } + render(e, i, r, n) { + e && (this._initialized || this._initialize(e), e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.bindVAO(this._vertexArrayObject), e.useProgram(this._program), i.setSamplingMode(r), e.bindTexture(i, 0), this._program.setUniform1i("u_tex", 0), this._program.setUniform1f("u_opacity", n), e.drawArrays(ps.TRIANGLE_STRIP, 0, 4), e.bindTexture(null, 0), e.bindVAO()); + } + _initialize(e) { + if (this._initialized) + return !0; + const i = SI(e, Tnt); + if (!i) + return !1; + const r = new Int8Array(16); + r[0] = -1, r[1] = -1, r[2] = 0, r[3] = 0, r[4] = 1, r[5] = -1, r[6] = 1, r[7] = 0, r[8] = -1, r[9] = 1, r[10] = 0, r[11] = 1, r[12] = 1, r[13] = 1, r[14] = 1, r[15] = 1; + const n = Tnt.attributes, s = new Ac(e, n, Hnr, { geometry: Qo.createVertex(e, Vo.STATIC_DRAW, r) }); + return this._program = i, this._vertexArrayObject = s, this._initialized = !0, !0; + } +}; +const _sr = (t) => { + let e = ""; + e += t[0].toUpperCase(); + for (let i = 1; i < t.length; i++) { + const r = t[i]; + r === r.toUpperCase() ? (e += "_", e += r) : e += r.toUpperCase(); + } + return e; +}, bsr = (t) => { + const e = {}; + for (const i in t) + e[_sr(i)] = t[i]; + return P3(e); +}, ZMe = (t, e, i, r) => { + const n = t + t.substring(t.lastIndexOf("/")), s = e + e.substring(e.lastIndexOf("/")), o = bsr(r); + return { attributes: i, shaders: { vertexShader: o + Vg(`${n}.vert`), fragmentShader: o + Vg(`${s}.frag`) } }; +}, YMt = (t) => t === lo.HITTEST || t === lo.LABEL_ALPHA, wsr = (t) => (YMt(t) ? 1 : 0) | (t === lo.HIGHLIGHT ? 2 : 0), xsr = ({ rendererInfo: t, drawPhase: e }, i, r) => `${i.getVariationHash()}-${wsr(e)}-${t.getVariationHash()}-${_e(r) && r.join(".")}`, Ssr = (t, e, i, r = {}) => { + if (r = { ...r, ...e.getVariation(), ...t.rendererInfo.getVariation(), highlight: t.drawPhase === lo.HIGHLIGHT, id: YMt(t.drawPhase) }, _e(i)) + for (const n of i) + r[n] = !0; + return r; +}; +let Csr = class { + constructor(e) { + this._rctx = e, this._programByKey = /* @__PURE__ */ new Map(); + } + dispose() { + this._programByKey.forEach((e) => e.dispose()), this._programByKey.clear(); + } + getProgram(e, i = []) { + const r = e.vsPath + "." + e.fsPath + JSON.stringify(i); + if (this._programByKey.has(r)) + return this._programByKey.get(r); + const n = { ...i.map((h) => typeof h == "string" ? { name: h, value: !0 } : h).reduce((h, p) => ({ ...h, [p.name]: p.value }), {}) }, { vsPath: s, fsPath: o, attributes: a } = e, l = ZMe(s, o, a, n), c = this._rctx.programCache.acquire(l.shaders.vertexShader, l.shaders.fragmentShader, l.attributes); + if (!c) + throw new Error("Unable to get program for key: ${key}"); + return this._programByKey.set(r, c), c; + } + getMaterialProgram(e, i, r, n, s) { + const o = xsr(e, i, s); + if (this._programByKey.has(o)) + return this._programByKey.get(o); + const a = Ssr(e, i, s, { ignoresSamplerPrecision: e.context.driverTest.ignoresSamplerPrecision.result }), l = ZMe(r, r, n, a), c = this._rctx.programCache.acquire(l.shaders.vertexShader, l.shaders.fragmentShader, l.attributes); + if (!c) + throw new Error("Unable to get program for key: ${key}"); + return this._programByKey.set(o, c), c; + } +}, rme = class { + constructor(e, i) { + this._width = 0, this._height = 0, this._free = [], this._width = e, this._height = i, this._free.push(new Od(0, 0, e, i)); + } + get width() { + return this._width; + } + get height() { + return this._height; + } + allocate(e, i) { + if (e > this._width || i > this._height) + return new Od(); + let r = null, n = -1; + for (let s = 0; s < this._free.length; ++s) { + const o = this._free[s]; + e <= o.width && i <= o.height && (r === null || o.y <= r.y && o.x <= r.x) && (r = o, n = s); + } + return r === null ? new Od() : (this._free.splice(n, 1), r.width < r.height ? (r.width > e && this._free.push(new Od(r.x + e, r.y, r.width - e, i)), r.height > i && this._free.push(new Od(r.x, r.y + i, r.width, r.height - i))) : (r.width > e && this._free.push(new Od(r.x + e, r.y, r.width - e, r.height)), r.height > i && this._free.push(new Od(r.x, r.y + i, e, r.height - i))), new Od(r.x, r.y, e, i)); + } + release(e) { + for (let i = 0; i < this._free.length; ++i) { + const r = this._free[i]; + if (r.y === e.y && r.height === e.height && r.x + r.width === e.x) + r.width += e.width; + else if (r.x === e.x && r.width === e.width && r.y + r.height === e.y) + r.height += e.height; + else if (e.y === r.y && e.height === r.height && e.x + e.width === r.x) + r.x = e.x, r.width += e.width; + else { + if (e.x !== r.x || e.width !== r.width || e.y + e.height !== r.y) + continue; + r.y = e.y, r.height += e.height; + } + this._free.splice(i, 1), this.release(e); + } + this._free.push(e); + } +}; +const Tsr = 256, Esr = (t) => Math.floor(t / 256); +function Isr(t) { + const e = /* @__PURE__ */ new Set(); + for (const i of t) + e.add(Esr(i)); + return e; +} +function Asr(t, e, i) { + return t.has(e) || t.set(e, i().then(() => { + t.delete(e); + }).catch((r) => { + t.delete(e), eI(r); + })), t.get(e); +} +const Psr = (t) => ({ rect: new Od(0, 0, 0, 0), page: 0, metrics: { left: 0, width: 0, height: 0, advance: 0, top: 0 }, code: t, sdf: !0 }); +let Osr = class { + constructor(e, i, r) { + this.width = 0, this.height = 0, this._dirties = [], this._glyphData = [], this._currentPage = 0, this._glyphCache = {}, this._textures = [], this._rangePromises = /* @__PURE__ */ new Map(), this.width = e, this.height = i, this._glyphSource = r, this._binPack = new rme(e - 4, i - 4), this._glyphData.push(new Uint8Array(e * i)), this._dirties.push(!0), this._textures.push(null), this._initDecorationGlyph(); + } + dispose() { + this._binPack = null; + for (const e of this._textures) + e && e.dispose(); + this._textures.length = 0, this._glyphData.length = 0; + } + _initDecorationGlyph() { + const e = [117, 149, 181, 207, 207, 181, 149, 117], i = []; + for (let n = 0; n < e.length; n++) { + const s = e[n]; + for (let o = 0; o < 11; o++) + i.push(s); + } + const r = { metrics: { width: 5, height: 2, left: 0, top: 0, advance: 0 }, bitmap: new Uint8Array(i) }; + this._recordGlyph(r); + } + async getGlyphItems(e, i, r) { + const n = this._getGlyphCache(e); + return await this._fetchRanges(e, i, r), i.map((s) => this._getMosaicItem(n, e, s)); + } + bind(e, i, r, n) { + const s = this._getTexture(e, r); + s.setSamplingMode(i), this._dirties[r] && (s.setData(this._glyphData[r]), this._dirties[r] = !1), e.bindTexture(s, n); + } + _getGlyphCache(e) { + return this._glyphCache[e] || (this._glyphCache[e] = {}), this._glyphCache[e]; + } + _getTexture(e, i) { + return this._textures[i] || (this._textures[i] = new Ts(e, { pixelFormat: cn.ALPHA, dataType: rs.UNSIGNED_BYTE, width: this.width, height: this.height }, new Uint8Array(this.width * this.height))), this._textures[i]; + } + _invalidate() { + this._dirties[this._currentPage] = !0; + } + async _fetchRanges(e, i, r) { + const n = Isr(i), s = []; + n.forEach((o) => { + s.push(this._fetchRange(e, o, r)); + }), await Promise.all(s); + } + async _fetchRange(e, i, r) { + if (i > Tsr) + return; + const n = e + i; + return Asr(this._rangePromises, n, () => this._glyphSource.getRange(e, i, r)); + } + _getMosaicItem(e, i, r) { + if (!e[r]) { + const n = this._glyphSource.getGlyph(i, r); + if (!n || !n.metrics) + return Psr(r); + const s = this._recordGlyph(n), o = this._currentPage, a = n.metrics; + e[r] = { rect: s, page: o, metrics: a, code: r, sdf: !0 }, this._invalidate(); + } + return e[r]; + } + _recordGlyph(e) { + const i = e.metrics; + let r; + if (i.width === 0) + r = new Od(0, 0, 0, 0); + else { + const s = i.width + 6, o = i.height + 2 * 3; + r = this._binPack.allocate(s, o), r.isEmpty && (this._dirties[this._currentPage] || (this._glyphData[this._currentPage] = null), this._currentPage = this._glyphData.length, this._glyphData.push(new Uint8Array(this.width * this.height)), this._dirties.push(!0), this._textures.push(null), this._initDecorationGlyph(), this._binPack = new rme(this.width - 4, this.height - 4), r = this._binPack.allocate(s, o)); + const a = this._glyphData[this._currentPage], l = e.bitmap; + let c, h; + if (l) + for (let p = 0; p < o; p++) { + c = s * p, h = this.width * (r.y + p) + r.x; + for (let y = 0; y < s; y++) + a[h + y] = l[c + y]; + } + Vi("esri-glyph-debug") && this._showDebugPage(a); + } + return r; + } + _showDebugPage(e) { + const i = document.createElement("canvas"), r = i.getContext("2d"), n = new ImageData(this.width, this.height), s = n.data; + i.width = this.width, i.height = this.height, i.style.border = "1px solid black"; + for (let o = 0; o < e.length; ++o) + s[4 * o + 0] = e[o], s[4 * o + 1] = 0, s[4 * o + 2] = 0, s[4 * o + 3] = 255; + r.putImageData(n, 0, 0), document.body.appendChild(i); + } +}, Rsr = class { + constructor(e) { + for (this._metrics = [], this._bitmaps = []; e.next(); ) + switch (e.tag()) { + case 1: { + const i = e.getMessage(); + for (; i.next(); ) + switch (i.tag()) { + case 3: { + const r = i.getMessage(); + let n, s, o, a, l, c, h; + for (; r.next(); ) + switch (r.tag()) { + case 1: + n = r.getUInt32(); + break; + case 2: + s = r.getBytes(); + break; + case 3: + o = r.getUInt32(); + break; + case 4: + a = r.getUInt32(); + break; + case 5: + l = r.getSInt32(); + break; + case 6: + c = r.getSInt32(); + break; + case 7: + h = r.getUInt32(); + break; + default: + r.skip(); + } + r.release(), n && (this._metrics[n] = { width: o, height: a, left: l, top: c, advance: h }, this._bitmaps[n] = s); + break; + } + default: + i.skip(); + } + i.release(); + break; + } + default: + e.skip(); + } + } + getMetrics(e) { + return this._metrics[e]; + } + getBitmap(e) { + return this._bitmaps[e]; + } +}, Msr = class { + constructor() { + this._ranges = []; + } + getRange(e) { + return this._ranges[e]; + } + addRange(e, i) { + this._ranges[e] = i; + } +}, Dsr = class { + constructor(e) { + this._glyphInfo = {}, this._baseURL = e; + } + getRange(e, i, r) { + const n = this._getFontStack(e); + if (n.getRange(i)) + return Promise.resolve(); + const s = 256 * i, o = s + 255, a = this._baseURL.replace("{fontstack}", e).replace("{range}", s + "-" + o); + return ir(a, { responseType: "array-buffer", ...r }).then((l) => { + n.addRange(i, new Rsr(new f$(new Uint8Array(l.data), new DataView(l.data)))); + }); + } + getGlyph(e, i) { + const r = this._getFontStack(e); + if (!r) + return; + const n = Math.floor(i / 256); + if (n > 256) + return; + const s = r.getRange(n); + return s ? { metrics: s.getMetrics(i), bitmap: s.getBitmap(i) } : void 0; + } + _getFontStack(e) { + let i = this._glyphInfo[e]; + return i || (i = this._glyphInfo[e] = new Msr()), i; + } +}; +const xq = 1e20; +let Fsr = class { + constructor(e) { + this._svg = null, this.size = e; + const i = document.createElement("canvas"); + i.width = i.height = e, this._context = i.getContext("2d"), this._gridOuter = new Float64Array(e * e), this._gridInner = new Float64Array(e * e), this._f = new Float64Array(e), this._d = new Float64Array(e), this._z = new Float64Array(e + 1), this._v = new Int16Array(e); + } + dispose() { + this._context = this._gridOuter = this._gridInner = this._f = this._d = this._z = this._v = null, this._svg && (document.body.removeChild(this._svg), this._svg = null); + } + draw(e, i, r = 31) { + this._initSVG(); + const n = this.createSVGString(e); + return new Promise((s, o) => { + const a = new Image(); + a.src = "data:image/svg+xml; charset=utf8, " + encodeURIComponent(n), a.onload = () => { + a.onload = null, this._context.clearRect(0, 0, this.size, this.size), this._context.drawImage(a, 0, 0, this.size, this.size); + const c = this._context.getImageData(0, 0, this.size, this.size), h = new Uint8Array(this.size * this.size * 4); + for (let p = 0; p < this.size * this.size; p++) { + const y = c.data[4 * p + 3] / 255; + this._gridOuter[p] = y === 1 ? 0 : y === 0 ? xq : Math.max(0, 0.5 - y) ** 2, this._gridInner[p] = y === 1 ? xq : y === 0 ? 0 : Math.max(0, y - 0.5) ** 2; + } + this._edt(this._gridOuter, this.size, this.size), this._edt(this._gridInner, this.size, this.size); + for (let p = 0; p < this.size * this.size; p++) { + const y = this._gridOuter[p] - this._gridInner[p]; + y9e(0.5 - y / (2 * r), h, 4 * p); + } + s(h); + }; + const l = i && i.signal; + l && Sp(l, () => o(Tc())); + }); + } + _initSVG() { + if (!this._svg) { + const e = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + e.setAttribute("style", "position: absolute;"), e.setAttribute("width", "0"), e.setAttribute("height", "0"), e.setAttribute("aria-hidden", "true"), e.setAttribute("role", "presentation"), document.body.appendChild(e), this._svg = e; + } + return this._svg; + } + createSVGString(e) { + const i = this._initSVG(), r = document.createElementNS("http://www.w3.org/2000/svg", "path"); + r.setAttribute("d", e), i.appendChild(r); + const n = r.getBBox(), s = n.width / n.height, o = this.size / 2; + let a, l, c, h; + if (s > 1) { + l = a = o / n.width; + const x = o * (1 / s); + c = this.size / 4, h = o - x / 2; + } else + a = l = o / n.height, c = o - o * s / 2, h = this.size / 4; + const p = -n.x * a + c, y = -n.y * l + h; + r.setAttribute("style", `transform: matrix(${a}, 0, 0, ${l}, ${p}, ${y})`); + const v = `${i.innerHTML}`; + return i.removeChild(r), v; + } + _edt(e, i, r) { + const n = this._f, s = this._d, o = this._v, a = this._z; + for (let l = 0; l < i; l++) { + for (let c = 0; c < r; c++) + n[c] = e[c * i + l]; + this._edt1d(n, s, o, a, r); + for (let c = 0; c < r; c++) + e[c * i + l] = s[c]; + } + for (let l = 0; l < r; l++) { + for (let c = 0; c < i; c++) + n[c] = e[l * i + c]; + this._edt1d(n, s, o, a, i); + for (let c = 0; c < i; c++) + e[l * i + c] = Math.sqrt(s[c]); + } + } + _edt1d(e, i, r, n, s) { + r[0] = 0, n[0] = -xq, n[1] = +xq; + for (let o = 1, a = 0; o < s; o++) { + let l = (e[o] + o * o - (e[r[a]] + r[a] * r[a])) / (2 * o - 2 * r[a]); + for (; l <= n[a]; ) + a--, l = (e[o] + o * o - (e[r[a]] + r[a] * r[a])) / (2 * o - 2 * r[a]); + a++, r[a] = o, n[a] = l, n[a + 1] = +xq; + } + for (let o = 0, a = 0; o < s; o++) { + for (; n[a + 1] < o; ) + a++; + i[o] = (o - r[a]) * (o - r[a]) + e[r[a]]; + } + } +}; +function EB(t) { + return t && t.type === "static"; +} +let Lsr = class XMt { + constructor(e, i, r = 0) { + this._mosaicPages = [], this._maxItemSize = 0, this._currentPage = 0, this._pageWidth = 0, this._pageHeight = 0, this._mosaicRects = /* @__PURE__ */ new Map(), this._spriteCopyQueue = [], this.pixelRatio = 1, (e <= 0 || i <= 0) && console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"), this._pageWidth = e, this._pageHeight = i, r > 0 && (this._maxItemSize = r), this.pixelRatio = window.devicePixelRatio || 1, this._binPack = new rme(this._pageWidth, this._pageHeight); + const n = Math.floor(this._pageWidth), s = Math.floor(this._pageHeight); + this._mosaicPages.push({ mosaicsData: { type: "static", data: new Uint32Array(n * s) }, size: [this._pageWidth, this._pageHeight], dirty: !0, texture: void 0 }); + } + getWidth(e) { + return e >= this._mosaicPages.length ? -1 : this._mosaicPages[e].size[0]; + } + getHeight(e) { + return e >= this._mosaicPages.length ? -1 : this._mosaicPages[e].size[1]; + } + getPageTexture(e) { + return e < this._mosaicPages.length ? this._mosaicPages[e].texture : null; + } + has(e) { + return this._mosaicRects.has(e); + } + get itemCount() { + return this._mosaicRects.size; + } + getSpriteItem(e) { + return this._mosaicRects.get(e); + } + addSpriteItem(e, i, r, n, s, o, a = 1) { + if (this._mosaicRects.has(e)) + return this._mosaicRects.get(e); + let l, c, h; + if (EB(r)) + [l, c, h] = this._allocateImage(i[0], i[1]); + else { + l = new Od(0, 0, i[0], i[1]), c = this._mosaicPages.length; + const y = void 0; + this._mosaicPages.push({ mosaicsData: r, size: [i[0] + 2 * Cc, i[1] + 2 * Cc], dirty: !0, texture: y }); + } + if (l.width <= 0 || l.height <= 0) + return null; + const p = { rect: l, width: i[0], height: i[1], sdf: s, simplePattern: o, pixelRatio: a, page: c }; + return this._mosaicRects.set(e, p), EB(r) && this._copy({ rect: l, spriteSize: i, spriteData: r.data, page: c, pageSize: h, repeat: n, sdf: s }), p; + } + hasItemsToProcess() { + return this._spriteCopyQueue.length !== 0; + } + processNextItem() { + const e = this._spriteCopyQueue.pop(); + e && this._copy(e); + } + getSpriteItems(e) { + const i = {}; + for (const r of e) + i[r] = this.getSpriteItem(r); + return i; + } + getMosaicItemPosition(e) { + const i = this.getSpriteItem(e), r = i && i.rect; + if (!r) + return null; + r.width = i.width, r.height = i.height; + const n = i.width, s = i.height, o = Cc, a = this._mosaicPages[i.page]; + return { size: [i.width, i.height], tl: [(r.x + o) / a[0], (r.y + o) / a[1]], br: [(r.x + o + n) / a[0], (r.y + o + s) / a[1]], page: i.page }; + } + bind(e, i, r = 0, n = 0) { + const s = this._mosaicPages[r], o = s.mosaicsData; + let a = s.texture; + a || (a = Nsr(e, s.size), s.texture = a), a.setSamplingMode(i), EB(o) ? (e.bindTexture(a, n), s.dirty && (a.setData(new Uint8Array(o.data.buffer)), a.generateMipmap())) : (o.data.bindFrame(e, a, n), a.generateMipmap()), s.dirty = !1; + } + static _copyBits(e, i, r, n, s, o, a, l, c, h, p) { + let y = n * i + r, v = l * o + a; + if (p) { + v -= o; + for (let x = -1; x <= h; x++, y = ((x + h) % h + n) * i + r, v += o) + for (let I = -1; I <= c; I++) + s[v + I] = e[y + (I + c) % c]; + } else + for (let x = 0; x < h; x++) { + for (let I = 0; I < c; I++) + s[v + I] = e[y + I]; + y += i, v += o; + } + } + _copy(e) { + if (e.page >= this._mosaicPages.length) + return; + const i = this._mosaicPages[e.page], r = i.mosaicsData; + if (!EB(i.mosaicsData)) + throw new ot("mapview-invalid-resource", "unsuitable data type!"); + const n = e.spriteData, s = r.data; + s && n || console.error("Source or target images are uninitialized!"), XMt._copyBits(n, e.spriteSize[0], 0, 0, s, e.pageSize[0], e.rect.x + Cc, e.rect.y + Cc, e.spriteSize[0], e.spriteSize[1], e.repeat), i.dirty = !0; + } + _allocateImage(e, i) { + e += 2 * Cc, i += 2 * Cc; + const r = Math.max(e, i); + if (this._maxItemSize && this._maxItemSize < r) { + const s = 2 ** Math.ceil(ynt(e)), o = 2 ** Math.ceil(ynt(i)), a = new Od(0, 0, e, i); + return this._mosaicPages.push({ mosaicsData: { type: "static", data: new Uint32Array(s * o) }, size: [s, o], dirty: !0, texture: void 0 }), [a, this._mosaicPages.length - 1, [s, o]]; + } + const n = this._binPack.allocate(e, i); + if (n.width <= 0) { + const s = this._mosaicPages[this._currentPage]; + return !s.dirty && EB(s.mosaicsData) && (s.mosaicsData.data = null), this._currentPage = this._mosaicPages.length, this._mosaicPages.push({ mosaicsData: { type: "static", data: new Uint32Array(this._pageWidth * this._pageHeight) }, size: [this._pageWidth, this._pageHeight], dirty: !0, texture: void 0 }), this._binPack = new rme(this._pageWidth, this._pageHeight), this._allocateImage(e, i); + } + return [n, this._currentPage, [this._pageWidth, this._pageHeight]]; + } + dispose() { + this._binPack = null; + for (const e of this._mosaicPages) { + const i = e.texture; + i && i.dispose(); + const r = e.mosaicsData; + EB(r) || r.data.destroy(); + } + this._mosaicPages = null, this._mosaicRects.clear(); + } +}; +function Nsr(t, e) { + return new Ts(t, { pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, width: e[0], height: e[1] }, null); +} +function KMt(t) { + return t.frameDurations.reduce((e, i) => e + i, 0); +} +function ksr(t) { + const { width: e, height: i } = t; + return { frameDurations: t.frameDurations.reverse(), getFrame: (r) => { + const n = t.frameDurations.length - 1 - r; + return t.getFrame(n); + }, width: e, height: i }; +} +function $sr(t, e) { + const { width: i, height: r, getFrame: n } = t, s = e / KMt(t); + return { frameDurations: t.frameDurations.map((o) => o * s), getFrame: n, width: i, height: r }; +} +function Bsr(t, e) { + const { width: i, height: r, getFrame: n } = t, s = t.frameDurations.slice(), o = s.shift(); + return s.unshift(o + e), { frameDurations: s, getFrame: n, width: i, height: r }; +} +function Ent(t, e) { + const { width: i, height: r, getFrame: n } = t, s = t.frameDurations.slice(), o = s.pop(); + return s.push(o + e), { frameDurations: s, getFrame: n, width: i, height: r }; +} +let Vsr = class { + constructor(e, i, r, n) { + this._animation = e, this._repeatType = r, this._onFrameData = n, this._direction = 1, this._currentFrame = 0, this.timeToFrame = this._animation.frameDurations[this._currentFrame]; + let s = 0; + for (; i > s; ) + s += this.timeToFrame, this.nextFrame(); + const o = this._animation.getFrame(this._currentFrame); + this._onFrameData(o); + } + nextFrame() { + if (this._currentFrame += this._direction, this._direction > 0) { + if (this._currentFrame === this._animation.frameDurations.length) + switch (this._repeatType) { + case uS.None: + this._currentFrame -= this._direction; + break; + case uS.Loop: + this._currentFrame = 0; + break; + case uS.Oscillate: + this._currentFrame -= this._direction, this._direction = -1; + } + } else if (this._currentFrame === -1) + switch (this._repeatType) { + case uS.None: + this._currentFrame -= this._direction; + break; + case uS.Loop: + this._currentFrame = this._animation.frameDurations.length - 1; + break; + case uS.Oscillate: + this._currentFrame -= this._direction, this._direction = 1; + } + this.timeToFrame = this._animation.frameDurations[this._currentFrame]; + const e = this._animation.getFrame(this._currentFrame); + this._onFrameData(e); + } +}; +function jsr(t, e, i, r) { + let n, { repeatType: s } = e; + if (s == null && (s = uS.Loop), e.reverseAnimation === !0 && (t = ksr(t)), e.duration != null && (t = $sr(t, 1e3 * e.duration)), e.repeatDelay != null) { + const o = 1e3 * e.repeatDelay; + s === uS.Loop ? t = Ent(t, o) : s === uS.Oscillate && (t = Bsr(Ent(t, o / 2), o / 2)); + } + if (e.startTimeOffset != null) + n = 1e3 * e.startTimeOffset; + else if (e.randomizeStartTime != null) { + const o = VRt(i), a = 82749913, l = e.randomizeStartSeed != null ? e.randomizeStartSeed : a, c = BRt(o, l); + n = c * KMt(t); + } else + n = 0; + return new Vsr(t, n, s, r); +} +function Gsr(t, e, i, r) { + const n = e.playAnimation == null || e.playAnimation, s = jsr(t, e, i, r); + let o, a = s.timeToFrame; + function l() { + o = n ? setTimeout(() => { + s.nextFrame(), a = s.timeToFrame, l(); + }, a) : void 0; + } + return l(), { remove: () => { + n && clearTimeout(o); + } }; +} +const QMe = document.createElement("canvas"), tae = QMe.getContext("2d"); +function Usr(t, e, i) { + QMe.width = e, QMe.height = i; + const r = [], n = t.frameDurations.length; + for (let s = 0; s < n; s++) { + const o = t.getFrame(s); + tae.clearRect(0, 0, e, i), o instanceof ImageData ? tae.drawImage(Ive(o), 0, 0, e, i) : tae.drawImage(o, 0, 0, e, i), r.push(tae.getImageData(0, 0, e, i)); + } + return { width: e, height: i, frameDurations: t.frameDurations, getFrame: (s) => r[s] }; +} +let zsr = class { + constructor(e, i, r, n) { + this._animation = e, this._frameData = null; + const s = (o) => { + this._frameData = o, i.requestRender(); + }; + this.frameCount = this._animation.frameDurations.length, this.width = this._animation.width, this.height = this._animation.height, this._playHandle = Gsr(this._animation, r, n, s); + } + destroy() { + this._playHandle.remove(); + } + bindFrame(e, i, r) { + e.bindTexture(i, r), ut(this._frameData) || (i.updateData(0, Cc, Cc, this._frameData.width, this._frameData.height, this._frameData), this._frameData = null); + } +}; +function L_(t, e) { + if (t && "name" in t) { + const i = t; + return e && e.error(new ot(i.name, i.message, i.details)), !1; + } + return !0; +} +function Hsr(t) { + switch (t.type) { + case "esriSMS": + return `${t.style}.${t.path}`; + case "esriSLS": + return `${t.style}.${t.cap}`; + case "esriSFS": + return `${t.style}`; + case "esriPFS": + case "esriPMS": + return t.imageData ? `${t.imageData}${t.width}${t.height}` : `${t.url}${t.width}${t.height}`; + default: + return "mosaicHash" in t ? t.mosaicHash : JSON.stringify(t); + } +} +const Int = cI(), Ant = "arial-unicode-ms-regular", c2e = 126, JMt = Ei.getLogger("esri.views.2d.engine.webgl.TextureManager"); +function Pnt(t, e) { + const i = Math.round(dn(e) * window.devicePixelRatio), r = i >= 128 ? 2 : 4; + return Math.min(t, i * r); +} +const h2e = (t, e, i) => JMt.error(new ot(t, e, i)); +let Wsr = class ZMt { + static fromMosaic(e, i) { + return new ZMt(e, i.page, i.sdf); + } + constructor(e, i, r) { + this.mosaicType = e, this.page = i, this.sdf = r; + } +}, qsr = class { + constructor(e, i, r) { + this._requestRender = e, this.resourceManager = i, this._allowNonPowerOfTwo = r, this._invalidFontsMap = /* @__PURE__ */ new Map(), this._sdfConverter = new Fsr(c2e), this._bindingInfos = new Array(), this._hashToBindingIndex = /* @__PURE__ */ new Map(), this._ongoingRasterizations = /* @__PURE__ */ new Map(), this._imageRequestQueue = new S$({ concurrency: 10, process: async (n, s) => { + hn(s); + try { + return await ir(n, { responseType: "image", signal: s }); + } catch (o) { + throw us(o) ? o : new ot("mapview-invalid-resource", `Could not fetch requested resource at ${n}`, o); + } + } }), this._spriteMosaic = new Lsr(2048, 2048, 500), this._glyphSource = new Dsr(`${ua.fontsUrl}/{fontstack}/{range}.pbf`), this._glyphMosaic = new Osr(1024, 1024, this._glyphSource), this._rasterizer = new Utr(i); + } + dispose() { + this._spriteMosaic.dispose(), this._glyphMosaic.dispose(), this._rasterizer.dispose(), this._sdfConverter.dispose(), this._spriteMosaic = null, this._glyphMosaic = null, this._sdfConverter = null, this._hashToBindingIndex.clear(), this._hashToBindingIndex = null, this._bindingInfos = null, this._ongoingRasterizations.clear(), this._ongoingRasterizations = null, this._imageRequestQueue.clear(), this._imageRequestQueue = null; + } + get sprites() { + return this._spriteMosaic; + } + get glyphs() { + return this._glyphMosaic; + } + async rasterizeItem(e, i, r, n) { + if (ut(e)) + return h2e("mapview-null-resource", "Unable to rasterize null resource"), null; + switch (e.type) { + case "text": + case "esriTS": { + const s = await this._rasterizeText(e, r, n); + return s.forEach((o) => this._setTextureBinding(yG.GLYPH, o)), { glyphMosaicItems: s }; + } + default: { + if (k9i(e)) + return h2e("mapview-invalid-type", `MapView does not support symbol type: ${e.type}`, e), null; + const s = await this._rasterizeSpriteSymbol(e, i, n); + return L_(s) && s && this._setTextureBinding(yG.SPRITE, s), { spriteMosaicItem: s }; + } + } + } + bindTextures(e, i, r, n = !1) { + if (r.textureBinding === 0) + return; + const s = this._bindingInfos[r.textureBinding - 1], o = s.page, a = n ? _n.LINEAR_MIPMAP_LINEAR : _n.LINEAR; + switch (s.mosaicType) { + case yG.SPRITE: { + const l = this.sprites.getWidth(o), c = this.sprites.getHeight(o), h = aa(Int, l, c); + return this._spriteMosaic.bind(e, a, o, KJe), i.setUniform1i("u_texture", KJe), void i.setUniform2fv("u_mosaicSize", h); + } + case yG.GLYPH: { + const l = this.glyphs.width, c = this.glyphs.height, h = aa(Int, l, c); + return this._glyphMosaic.bind(e, a, o, JJe), i.setUniform1i("u_texture", JJe), void i.setUniform2fv("u_mosaicSize", h); + } + default: + JMt.error("mapview-texture-manager", `Cannot handle unknown type ${s.mosaicType}`); + } + } + _hashMosaic(e, i) { + return 1 | e << 1 | (i.sdf ? 1 : 0) << 2 | i.page << 3; + } + _setTextureBinding(e, i) { + const r = this._hashMosaic(e, i); + if (!this._hashToBindingIndex.has(r)) { + const n = Wsr.fromMosaic(e, i), s = this._bindingInfos.length + 1; + this._hashToBindingIndex.set(r, s), this._bindingInfos.push(n); + } + i.textureBinding = this._hashToBindingIndex.get(r); + } + async _rasterizeText(e, i, r) { + let n, s; + if ("cim" in e) { + const l = e; + n = l.fontName, s = l.text; + } else { + const l = e; + n = jZi(l.font), s = l.text; + } + const o = this._invalidFontsMap.has(n), a = i || V9i(c4(s)[0]); + try { + return await this._glyphMosaic.getGlyphItems(o ? Ant : n, a, r); + } catch { + return h2e("mapview-invalid-resource", `Couldn't find font ${n}. Falling back to Arial Unicode MS Regular`), this._invalidFontsMap.set(n, !0), this._glyphMosaic.getGlyphItems(Ant, a, r); + } + } + async _rasterizeSpriteSymbol(e, i, r) { + if ($9i(e)) + return; + const n = Hsr(e); + if (this._spriteMosaic.has(n)) + return this._spriteMosaic.getSpriteItem(n); + if (NZe(e) || F9i(e) && !JAt(e)) + return this._handleAsyncResource(n, e, r); + const s = Z8i, o = this._rasterizer.rasterizeJSONResource(e, s); + if (o) { + const { size: a, image: l, sdf: c, simplePattern: h, rasterizationScale: p } = o; + return this._addItemToMosaic(n, a, { type: "static", data: l }, Toe(e), c, h, p); + } + return new ot("TextureManager", "unrecognized or null rasterized image"); + } + async _handleAsyncResource(e, i, r) { + if (this._ongoingRasterizations.has(e)) + return this._ongoingRasterizations.get(e); + let n; + n = NZe(i) ? this._handleSVG(i, e, r) : this._handleImage(i, e, r), this._ongoingRasterizations.set(e, n); + try { + await n, this._ongoingRasterizations.delete(e); + } catch { + this._ongoingRasterizations.delete(e); + } + return n; + } + async _handleSVG(e, i, r) { + const n = [c2e, c2e], s = await this._sdfConverter.draw(e.path, r); + return this._addItemToMosaic(i, n, { type: "static", data: new Uint32Array(s.buffer) }, !1, !0, !0); + } + async _handleGIFOrPNG(e, i, r) { + const n = kZe(e); + await this.resourceManager.fetchResource(n, r); + let s = this.resourceManager.getResource(n); + if (ut(s)) + return new ot("mapview-invalid-resource", `Could not fetch requested resource at ${n}.`); + let o = s.width, a = s.height; + if (s instanceof HTMLImageElement) { + e.type === "esriPMS" && (o = Math.round(Pnt(s.width, VZe(e))), a = Math.round(s.height * (o / s.width))); + const p = "cim" in e ? e.cim.colorSubstitutions : void 0, { size: y, sdf: v, image: x } = this._rasterizer.rasterizeImageResource(o, a, s, p); + return this._addItemToMosaic(i, y, { type: "static", data: x }, Toe(e), v, !1); + } + this._allowNonPowerOfTwo || (o = U7(s.width + 2 * Cc) - 2 * Cc, a = U7(s.height + 2 * Cc) - 2 * Cc), o === s.width && a === s.height || (s = Usr(s, o, a)); + const l = e.animatedSymbolProperties || {}, c = e.objectId, h = new zsr(s, this._requestRender, l, c); + return this._addItemToMosaic(i, [h.width, h.height], { type: "animated", data: h }, Toe(e), !1, !1); + } + async _handleImage(e, i, r) { + if (L9i(e) || N9i(e)) + return this._handleGIFOrPNG(e, i, r); + const n = kZe(e); + try { + let s; + const o = this.resourceManager.getResource(n); + if (_e(o) && o instanceof HTMLImageElement) + s = o; + else { + const { data: v } = await this._imageRequestQueue.push(n, { ...r }); + s = v; + } + if (B9i(n)) { + if ("width" in e && "height" in e) + s.width = dn(e.width), s.height = dn(e.height); + else if ("cim" in e) { + const v = e.cim; + s.width = dn(v.width ?? v.scaleX * v.size), s.height = dn(v.size); + } + } + if (!s.width || !s.height) + return null; + let a = s.width, l = s.height; + e.type === "esriPMS" && (a = Math.round(Pnt(s.width, VZe(e))), l = Math.round(s.height * (a / s.width))); + const c = "cim" in e ? e.cim.colorSubstitutions : void 0, { size: h, sdf: p, image: y } = this._rasterizer.rasterizeImageResource(a, l, s, c); + return this._addItemToMosaic(i, h, { type: "static", data: y }, Toe(e), p, !1); + } catch (s) { + if (!us(s)) + return new ot("mapview-invalid-resource", `Could not fetch requested resource at ${n}. ${s.message}`); + } + } + _addItemToMosaic(e, i, r, n, s, o, a) { + return this._spriteMosaic.addSpriteItem(e, i, r, n, s, o, a); + } +}, Ysr = class { + constructor(e, i) { + this._queue = [], this._context = e, this._refreshable = i; + } + destroy() { + this._queue = []; + } + enqueueTextureUpdate(e, i) { + const r = mm(), n = e, s = K8i, o = Math.ceil(n.height / s); + if (hn(i), this._context.type === go.WEBGL1) + this._queue.push({ type: "no-chunk", request: e, resolver: r, options: i }); + else + for (let a = 0; a < o; a++) { + const l = a * s, c = a === o - 1, h = c ? n.height - s * a : s; + this._queue.push({ type: "chunk", request: e, resolver: r, chunk: a, chunkOffset: l, destHeight: h, chunkIsLast: c, options: i }); + } + return k7(i, (a) => r.reject(a)), r.promise; + } + upload() { + let e = 0; + for (; this._queue.length; ) { + const i = performance.now(), r = this._queue.shift(); + if (r) { + if (_e(r.options.signal) && r.options.signal.aborted) + continue; + switch (r.type) { + case "chunk": + this._uploadChunk(r); + break; + case "no-chunk": + this._uploadNoChunk(r); + } + const n = performance.now() - i; + if (e += n, e + n >= J8i) + break; + } + } + this._queue.length && this._refreshable.requestRender(); + } + _uploadChunk(e) { + const { request: i, resolver: r, chunkOffset: n, chunkIsLast: s, destHeight: o } = e, { data: a, texture: l, width: c } = i; + _e(a) && (l.updateData(0, 0, n, c, o, a, n), s && r.resolve()); + } + _uploadNoChunk(e) { + const { request: i, resolver: r } = e, { data: n, texture: s } = i; + s.setData(n), r.resolve(); + } +}; +const Xsr = { shaders: { vertexShader: Vg("stencil/stencil.vert"), fragmentShader: Vg("stencil/stencil.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }, Ksr = OE(-0.5, -0.5); +let Jsr = class { + constructor() { + this._centerNdc = sn(), this._pxToNdc = sn(), this._worldDimensionsPx = sn(), this._mat3 = Ml(), this._initialized = !1; + } + dispose() { + this._program = Ua(this._program), this._quad = Ua(this._quad); + } + render(e, i) { + const { context: r } = e; + return !!this._updateGeometry(e, i) && (this._initialized || this._initialize(r), r.setDepthWriteEnabled(!1), r.setDepthTestEnabled(!1), r.setColorMask(!1, !1, !1, !1), r.setBlendingEnabled(!1), r.setStencilOp(su.KEEP, su.KEEP, su.REPLACE), r.setStencilFunction(Ll.ALWAYS, 1, 255), r.setStencilTestEnabled(!0), r.useProgram(this._program), this._program.setUniformMatrix3fv("u_worldExtent", this._mat3), this._quad.draw(), this._quad.unbind(), !0); + } + _initialize(e) { + if (this._initialized) + return; + const i = SI(e, Xsr); + i && (this._program = i, this._quad = new kx(e, [0, 0, 1, 0, 0, 1, 1, 1]), this._initialized = !0); + } + _updateGeometry(e, i) { + const { state: r, pixelRatio: n } = e, { size: s, rotation: o } = r, a = Math.round(s[0] * n), l = Math.round(s[1] * n); + if (!r.spatialReference.isWrappable) + return !1; + const c = o$(o), h = Math.abs(Math.cos(c)), p = Math.abs(Math.sin(c)), y = Math.round(a * h + l * p), v = Math.round(r.worldScreenWidth); + if (y <= v) + return !1; + const x = a * p + l * h, I = v * n, P = (i.left - i.right) * n / a, F = (i.bottom - i.top) * n / l; + Ol(this._worldDimensionsPx, I, x, 1), Ol(this._pxToNdc, 2 / a, -2 / l, 1), Ol(this._centerNdc, P, F, 1); + const k = this._mat3; + return zNe(k, this._centerNdc), KO(k, k, this._pxToNdc), o !== 0 && BI(k, k, c), KO(k, k, this._worldDimensionsPx), Ng(k, k, Ksr), !0; + } +}, Zsr = class extends uH { + constructor() { + super(...arguments), this.defines = [], this._desc = { vsPath: "fx/integrate", fsPath: "fx/integrate", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }; + } + dispose() { + this._quad && this._quad.dispose(); + } + bind() { + } + unbind() { + } + draw(e, i) { + if (!i?.size) + return; + const { context: r, renderingOptions: n } = e; + this._quad || (this._quad = new kx(r, [0, 0, 1, 0, 0, 1, 1, 1])); + const s = r.getBoundFramebufferObject(), { x: o, y: a, width: l, height: c } = r.getViewport(); + i.bindTextures(r); + const h = i.getBlock(A8e); + if (ut(h)) + return; + const p = h.getFBO(r), y = h.getFBO(r, 1); + r.setViewport(0, 0, i.size, i.size), this._computeDelta(e, y, n.labelsAnimationTime), this._updateAnimationState(e, y, p), r.bindFramebuffer(s), r.setViewport(o, a, l, c); + } + _computeDelta(e, i, r) { + const { context: n, painter: s, displayLevel: o } = e, a = s.materialManager.getProgram(this._desc, ["delta"]); + n.bindFramebuffer(i), n.setClearColor(0, 0, 0, 0), n.clear(n.gl.COLOR_BUFFER_BIT), n.useProgram(a), a.setUniform1i("u_maskTexture", ufe), a.setUniform1i("u_sourceTexture", cfe), a.setUniform1f("u_timeDelta", e.deltaTime), a.setUniform1f("u_animationTime", r), a.setUniform1f("u_zoomLevel", Math.round(10 * o)), this._quad.draw(); + } + _updateAnimationState(e, i, r) { + const { context: n, painter: s } = e, o = s.materialManager.getProgram(this._desc, ["update"]); + n.bindTexture(i.colorTexture, 1), n.useProgram(o), o.setUniform1i("u_sourceTexture", 1), n.bindFramebuffer(r), n.setClearColor(0, 0, 0, 0), n.clear(n.gl.COLOR_BUFFER_BIT), this._quad.draw(); + } +}; +const Qsr = (t) => t.replace("-", "_").toUpperCase(), Ont = (t) => `#define ${Qsr(t)} +`; +function Rnt(t) { + return { attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_tex", 1]]), shaders: { vertexShader: Ont(t) + Vg("blend/blend.vert"), fragmentShader: Ont(t) + Vg("blend/blend.frag") } }; +} +const Mnt = Ei.getLogger("esri.views.2d.engine.webgl.effects.blendEffects.BlendEffect"); +let eor = class { + constructor() { + this._size = [0, 0]; + } + dispose(e) { + this._backBufferTexture = Ua(this._backBufferTexture), this._quad = Ua(this._quad); + } + draw(e, i, r, n, s) { + const { context: o, drawPhase: a } = e; + if (this._setupShader(o), n && n !== "normal" && a !== lo.LABEL) + return void this._drawBlended(e, i, r, n, s); + const l = Rnt("normal"), c = o.programCache.acquire(l.shaders.vertexShader, l.shaders.fragmentShader, l.attributes); + if (!c) + return void Mnt.error(new ot("mapview-BlendEffect", 'Error creating shader program for blend mode "normal"')); + o.useProgram(c), i.setSamplingMode(r), o.bindTexture(i, 0), c.setUniform1i("u_layerTexture", 0), c.setUniform1f("u_opacity", s), o.setBlendingEnabled(!0), o.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA); + const h = this._quad; + h.draw(), h.unbind(), c.dispose(); + } + _drawBlended(e, i, r, n, s) { + const { context: o, state: a, pixelRatio: l, inFadeTransition: c } = e, { size: h } = a, p = o.getBoundFramebufferObject(); + let y, v; + if (_e(p)) { + const k = p.descriptor; + y = k.width, v = k.height; + } else + y = Math.round(l * h[0]), v = Math.round(l * h[1]); + this._createOrResizeTexture(e, y, v); + const x = this._backBufferTexture; + p.copyToTexture(0, 0, y, v, 0, 0, x), o.setStencilTestEnabled(!1), o.setStencilWriteMask(0), o.setBlendingEnabled(!0), o.setDepthTestEnabled(!1), o.setDepthWriteEnabled(!1); + const I = Rnt(n), P = o.programCache.acquire(I.shaders.vertexShader, I.shaders.fragmentShader, I.attributes); + if (!P) + return void Mnt.error(new ot("mapview-BlendEffect", `Error creating shader program for blend mode ${n}`)); + o.useProgram(P), x.setSamplingMode(r), o.bindTexture(x, 0), P.setUniform1i("u_backbufferTexture", 0), i.setSamplingMode(r), o.bindTexture(i, 1), P.setUniform1i("u_layerTexture", 1), P.setUniform1f("u_opacity", s), P.setUniform1f("u_inFadeOpacity", c ? 1 : 0), o.setBlendFunction(gn.ONE, gn.ZERO); + const F = this._quad; + F.draw(), F.unbind(), P.dispose(), o.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA); + } + _setupShader(e) { + this._quad || (this._quad = new kx(e, [-1, -1, 1, -1, -1, 1, 1, 1])); + } + _createOrResizeTexture(e, i, r) { + const { context: n } = e; + this._backBufferTexture !== null && i === this._size[0] && r === this._size[1] || (this._backBufferTexture ? this._backBufferTexture.resize(i, r) : this._backBufferTexture = new Ts(n, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: i, height: r }), this._size[0] = i, this._size[1] = r); + } +}, Dnt = class extends uH { + constructor(e) { + super(), this.name = this.constructor.name, this.defines = [e]; + } + dispose() { + } + bind({ context: e, painter: i }) { + this._prev = e.getBoundFramebufferObject(); + const { width: r, height: n } = e.getViewport(), s = i.getFbos(r, n).effect0; + e.bindFramebuffer(s), e.setColorMask(!0, !0, !0, !0), e.setClearColor(0, 0, 0, 0), e.clear(e.gl.COLOR_BUFFER_BIT); + } + unbind() { + } + draw(e, i) { + const { context: r, painter: n } = e, s = n.getPostProcessingEffects(i), o = r.getBoundFramebufferObject(); + for (const { postProcessingEffect: a, effect: l } of s) + a.draw(e, o, l); + r.bindFramebuffer(this._prev), r.setStencilTestEnabled(!1), n.blitTexture(r, o.colorTexture, _n.NEAREST), r.setStencilTestEnabled(!0); + } +}; +const tor = { shaders: { vertexShader: Vg("highlight/textured.vert"), fragmentShader: Vg("highlight/highlight.frag") }, attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }, ior = { shaders: { vertexShader: Vg("highlight/textured.vert"), fragmentShader: Vg("highlight/blur.frag") }, attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +let ror = class { + constructor() { + this._width = void 0, this._height = void 0, this._resources = null; + } + dispose() { + this._resources && (this._resources.quadGeometry.dispose(), this._resources.quadVAO.dispose(), this._resources.highlightProgram.dispose(), this._resources.blurProgram.dispose(), this._resources = null); + } + preBlur(e, i) { + e.bindTexture(i, lq), e.useProgram(this._resources.blurProgram), this._resources.blurProgram.setUniform4fv("u_direction", [1, 0, 1 / this._width, 0]), this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector", unr), e.bindVAO(this._resources.quadVAO), e.drawArrays(ps.TRIANGLE_STRIP, 0, 4), e.bindVAO(); + } + finalBlur(e, i) { + e.bindTexture(i, lq), e.useProgram(this._resources.blurProgram), this._resources.blurProgram.setUniform4fv("u_direction", [0, 1, 0, 1 / this._height]), this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector", cnr), e.bindVAO(this._resources.quadVAO), e.drawArrays(ps.TRIANGLE_STRIP, 0, 4), e.bindVAO(); + } + renderHighlight(e, i, r) { + e.bindTexture(i, lq), e.useProgram(this._resources.highlightProgram), r.applyHighlightOptions(e, this._resources.highlightProgram), e.bindVAO(this._resources.quadVAO), e.setBlendingEnabled(!0), e.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.drawArrays(ps.TRIANGLE_STRIP, 0, 4), e.bindVAO(); + } + _initialize(e, i, r) { + this._width = i, this._height = r; + const n = Qo.createVertex(e, Vo.STATIC_DRAW, new Int8Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]).buffer), s = new Ac(e, /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]), { geometry: [new ea("a_position", 2, Fi.BYTE, 0, 4), new ea("a_texcoord", 2, Fi.UNSIGNED_BYTE, 2, 4)] }, { geometry: n }), o = SI(e, tor), a = SI(e, ior); + e.useProgram(o), o.setUniform1i("u_texture", lq), o.setUniform1i("u_shade", VAt), o.setUniform1f("u_sigma", XMe), e.useProgram(a), a.setUniform1i("u_texture", lq), a.setUniform1f("u_sigma", XMe), this._resources = { quadGeometry: n, quadVAO: s, highlightProgram: o, blurProgram: a }; + } + setup(e, i, r) { + this._resources ? (this._width = i, this._height = r) : this._initialize(e, i, r); + } +}; +function Fnt(t, e, i) { + const r = new Ts(t, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, width: e, height: i, samplingMode: _n.LINEAR }); + return [r, new cd(t, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.STENCIL_RENDER_BUFFER }, r)]; +} +let nor = class { + constructor() { + this._width = void 0, this._height = void 0, this._resources = null; + } + dispose() { + this._resources && (this._resources.sharedBlur1Tex.dispose(), this._resources.sharedBlur1Fbo.dispose(), this._resources.sharedBlur2Tex.dispose(), this._resources.sharedBlur2Fbo.dispose(), this._resources = Tte(this._resources)); + } + _initialize(e, i, r) { + this._width = i, this._height = r; + const [n, s] = Fnt(e, i, r), [o, a] = Fnt(e, i, r); + this._resources = { sharedBlur1Tex: n, sharedBlur1Fbo: s, sharedBlur2Tex: o, sharedBlur2Fbo: a }; + } + setup(e, i, r) { + !this._resources || this._width === i && this._height === r || this.dispose(), this._resources || this._initialize(e, i, r); + } + get sharedBlur1Tex() { + return this._resources.sharedBlur1Tex; + } + get sharedBlur1Fbo() { + return this._resources.sharedBlur1Fbo; + } + get sharedBlur2Tex() { + return this._resources.sharedBlur2Tex; + } + get sharedBlur2Fbo() { + return this._resources.sharedBlur2Fbo; + } +}; +const XN = 4, iae = 4 / XN; +let sor = class extends uH { + constructor() { + super(...arguments), this.defines = ["highlight"], this._hlRenderer = new ror(), this._width = void 0, this._height = void 0, this._boundFBO = null, this._hlSurfaces = new nor(), this._adjustedWidth = void 0, this._adjustedHeight = void 0, this._blitRenderer = new qMt(); + } + dispose() { + this._hlSurfaces?.dispose(), this._hlRenderer?.dispose(), this._boundFBO = null; + } + bind(e) { + const { context: i, painter: r } = e, { width: n, height: s } = i.getViewport(), o = r.getFbos(n, s).effect0; + this.setup(e, n, s), i.bindFramebuffer(o), i.setColorMask(!0, !0, !0, !0), i.setClearColor(0, 0, 0, 0), i.clear(i.gl.COLOR_BUFFER_BIT); + } + unbind() { + } + setup({ context: e }, i, r) { + this._width = i, this._height = r; + const n = i % XN, s = r % XN; + i += n < XN / 2 ? -n : XN - n, r += s < XN / 2 ? -s : XN - s, this._adjustedWidth = i, this._adjustedHeight = r, this._boundFBO = e.getBoundFramebufferObject(); + const o = Math.round(i * iae), a = Math.round(r * iae); + this._hlRenderer.setup(e, o, a), this._hlSurfaces.setup(e, o, a); + } + draw(e) { + const { context: i, highlightGradient: r } = e; + if (!r) + return; + const n = i.getBoundFramebufferObject(); + i.setViewport(0, 0, this._adjustedWidth * iae, this._adjustedHeight * iae), i.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo), i.setStencilTestEnabled(!1), i.setClearColor(0, 0, 0, 0), i.clear(i.gl.COLOR_BUFFER_BIT), this._blitRenderer.render(i, n.colorTexture, _n.NEAREST, 1), i.setStencilTestEnabled(!1), i.setBlendingEnabled(!1), i.setColorMask(!1, !1, !1, !0), i.bindFramebuffer(this._hlSurfaces.sharedBlur2Fbo), i.setClearColor(0, 0, 0, 0), i.clear(i.gl.COLOR_BUFFER_BIT), this._hlRenderer.preBlur(i, this._hlSurfaces.sharedBlur1Tex), i.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo), i.setClearColor(0, 0, 0, 0), i.clear(i.gl.COLOR_BUFFER_BIT), this._hlRenderer.finalBlur(i, this._hlSurfaces.sharedBlur2Tex), i.bindFramebuffer(this._boundFBO), i.setBlendingEnabled(!0), i.setColorMask(!0, !0, !0, !0), i.setViewport(0, 0, this._width, this._height), this._hlRenderer.renderHighlight(i, this._hlSurfaces.sharedBlur1Tex, r), this._boundFBO = null; + } +}, oor = class extends uH { + constructor() { + super(...arguments), this.name = this.constructor.name, this.defines = ["hittest"]; + } + dispose() { + _e(this._fbo) && this._fbo.dispose(); + } + createOptions({ pixelRatio: e }, i, r = UAt) { + if (!i.length) + return null; + const n = i.shift(), s = n.x, o = n.y; + return this._outstanding = n, { type: "hittest", distance: r * e, position: [s, o] }; + } + bind(e) { + const { context: i, attributeView: r } = e; + if (!r.size) + return; + const n = r.getBlock(hfe); + if (ut(n)) + return; + const s = n.getFBO(i); + i.setViewport(0, 0, r.size, r.size), i.bindFramebuffer(s), i.setColorMask(!0, !0, !0, !0), i.setClearColor(0, 0, 0, 0), i.clear(i.gl.COLOR_BUFFER_BIT | i.gl.DEPTH_BUFFER_BIT); + } + unbind(e) { + } + draw(e) { + if (ut(this._outstanding)) + return; + const i = this._outstanding; + this._outstanding = null, this._resolve(e, i.resolvers); + } + async _resolve(e, i) { + const { context: r, attributeView: n } = e, s = n.getBlock(hfe); + if (ut(s)) + return void i.forEach((h) => h.resolve([])); + const o = s.getFBO(r), a = new Uint8Array(o.width * o.height * 4); + try { + await o.readPixelsAsync(0, 0, o.width, o.height, cn.RGBA, rs.UNSIGNED_BYTE, a); + } catch { + return void i.forEach((p) => p.resolve([])); + } + const l = []; + for (let h = 0; h < a.length; h += 4) { + const p = a[h], y = a[h + 3]; + p && l.push({ id: h / 4, directHits: y }); + } + l.sort((h, p) => p.directHits === h.directHits ? p.id - h.id : p.directHits - h.directHits); + const c = l.map((h) => h.id); + i.forEach((h) => h.resolve(c)); + } +}, aor = class extends uH { + constructor() { + super(...arguments), this.name = this.constructor.name, this.defines = ["id"], this._lastSize = 0, this._boundFBO = null; + } + dispose() { + _e(this._fbo) && this._fbo.dispose(); + } + bind({ context: e, painter: i }) { + const { width: r, height: n } = e.getViewport(); + this._boundFBO = e.getBoundFramebufferObject(); + const s = i.getFbos(r, n).effect0; + e.bindFramebuffer(s), e.setColorMask(!0, !0, !0, !0), e.setClearColor(0, 0, 0, 0), e.clear(e.gl.COLOR_BUFFER_BIT); + } + unbind({ context: e }) { + e.bindFramebuffer(this._boundFBO), this._boundFBO = null; + } + draw(e, i, r = 2 * UAt) { + this._resolve(e, i, r); + } + async _resolve({ context: e, state: i, pixelRatio: r }, n, s) { + const o = e.getBoundFramebufferObject(), a = i.size[1] * r, l = Math.round(s * r), c = l / 2, h = l / 2; + this._ensureBuffer(l), n.forEach(async (p, y) => { + const v = /* @__PURE__ */ new Map(), x = Math.floor(y.x * r - l / 2), I = Math.floor(a - y.y * r - l / 2); + await o.readPixelsAsync(x, I, l, l, cn.RGBA, rs.UNSIGNED_BYTE, this._buf); + for (let F = 0; F < this._buf32.length; F++) { + const k = this._buf32[F]; + if (k !== 4294967295 && k !== 0) { + const V = F % l, j = l - Math.floor(F / l), Y = (c - V) * (c - V) + (h - j) * (h - j), X = v.has(k) ? v.get(k) : 4294967295; + v.set(k, Math.min(Y, X)); + } + } + const P = Array.from(v).sort((F, k) => F[1] - k[1]).map((F) => F[0]); + p.resolve(P), n.delete(y); + }); + } + _ensureBuffer(e) { + this._lastSize !== e && (this._lastSize = e, this._buf = new Uint8Array(4 * e * e), this._buf32 = new Uint32Array(this._buf.buffer)); + } +}; +const d2e = 5, lor = [1, 0], uor = [0, 1], cor = [1, 0.8, 0.6, 0.4, 0.2], hor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; +let dor = class { + constructor() { + this._intensityFBO = null, this._compositeFBO = null, this._mipsFBOs = new Array(d2e), this._nMips = d2e, this._kernelSizeArray = [3, 5, 7, 9, 11], this._size = [0, 0], this._programDesc = { luminosityHighPass: { vsPath: "post-processing/pp", fsPath: "post-processing/bloom/luminosityHighPass", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, gaussianBlur: { vsPath: "post-processing/pp", fsPath: "post-processing/bloom/gaussianBlur", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, composite: { vsPath: "post-processing/pp", fsPath: "post-processing/bloom/composite", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, blit: { vsPath: "post-processing/pp", fsPath: "post-processing/blit", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) } }; + } + dispose() { + if (this._quad = Ua(this._quad), this._intensityFBO = Ua(this._intensityFBO), this._compositeFBO = Ua(this._compositeFBO), this._mipsFBOs) { + for (let e = 0; e < this._nMips; e++) + this._mipsFBOs[e] && (this._mipsFBOs[e].horizontal.dispose(), this._mipsFBOs[e].vertical.dispose()); + this._mipsFBOs = null; + } + } + draw(e, i, r) { + const { width: n, height: s } = i, { context: o, painter: a } = e, { materialManager: l } = a, c = o.gl, h = this._programDesc, { strength: p, radius: y, threshold: v } = r; + this._quad || (this._quad = new kx(o, [-1, -1, 1, -1, -1, 1, 1, 1])), this._createOrResizeResources(e, n, s), o.setStencilTestEnabled(!1), o.setBlendingEnabled(!0), o.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), o.setStencilWriteMask(0); + const x = this._quad; + x.bind(), o.bindFramebuffer(this._intensityFBO); + const I = l.getProgram(h.luminosityHighPass); + o.useProgram(I), o.bindTexture(i.colorTexture, 0), I.setUniform1i("u_texture", 0), I.setUniform3fv("u_defaultColor", [0, 0, 0]), I.setUniform1f("u_defaultOpacity", 0), I.setUniform1f("u_luminosityThreshold", v), I.setUniform1f("u_smoothWidth", 0.01); + const P = [Math.round(n / 2), Math.round(s / 2)]; + o.setViewport(0, 0, P[0], P[1]), o.setClearColor(0, 0, 0, 0), o.clear(c.COLOR_BUFFER_BIT), x.draw(), o.setBlendingEnabled(!1); + let F = this._intensityFBO.colorTexture; + for (let j = 0; j < this._nMips; j++) { + const Y = l.getProgram(h.gaussianBlur, [{ name: "radius", value: this._kernelSizeArray[j] }]); + o.useProgram(Y), o.bindTexture(F, j + 1), Y.setUniform1i("u_colorTexture", j + 1), Y.setUniform2fv("u_texSize", P), Y.setUniform2fv("u_direction", lor), o.setViewport(0, 0, P[0], P[1]); + const X = this._mipsFBOs[j]; + o.bindFramebuffer(X.horizontal), x.draw(), F = X.horizontal.colorTexture, o.bindFramebuffer(X.vertical), o.bindTexture(F, j + 1), Y.setUniform2fv("u_direction", uor), x.draw(), F = X.vertical.colorTexture, P[0] = Math.round(P[0] / 2), P[1] = Math.round(P[1] / 2); + } + o.setViewport(0, 0, n, s); + const k = l.getProgram(h.composite, [{ name: "nummips", value: d2e }]); + o.bindFramebuffer(this._compositeFBO), o.useProgram(k), k.setUniform1f("u_bloomStrength", p), k.setUniform1f("u_bloomRadius", y), k.setUniform1fv("u_bloomFactors", cor), k.setUniform3fv("u_bloomTintColors", hor), o.bindTexture(this._mipsFBOs[0].vertical.colorTexture, 1), k.setUniform1i("u_blurTexture1", 1), o.bindTexture(this._mipsFBOs[1].vertical.colorTexture, 2), k.setUniform1i("u_blurTexture2", 2), o.bindTexture(this._mipsFBOs[2].vertical.colorTexture, 3), k.setUniform1i("u_blurTexture3", 3), o.bindTexture(this._mipsFBOs[3].vertical.colorTexture, 4), k.setUniform1i("u_blurTexture4", 4), o.bindTexture(this._mipsFBOs[4].vertical.colorTexture, 5), k.setUniform1i("u_blurTexture5", 5), x.draw(), o.bindFramebuffer(i), o.setBlendingEnabled(!0); + const V = l.getProgram(h.blit); + o.useProgram(V), o.bindTexture(this._compositeFBO.colorTexture, 6), V.setUniform1i("u_texture", 6), o.setBlendFunction(gn.ONE, gn.ONE), x.draw(), x.unbind(), o.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), o.setStencilTestEnabled(!0); + } + _createOrResizeResources(e, i, r) { + const { context: n } = e; + if (this._compositeFBO && this._size[0] === i && this._size[1] === r) + return; + this._size[0] = i, this._size[1] = r; + const s = [Math.round(i / 2), Math.round(r / 2)]; + this._compositeFBO ? this._compositeFBO.resize(i, r) : this._compositeFBO = new cd(n, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: i, height: r }), this._intensityFBO ? this._intensityFBO.resize(s[0], s[1]) : this._intensityFBO = new cd(n, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: s[0], height: s[1] }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: s[0], height: s[1] }); + for (let o = 0; o < this._nMips; o++) + this._mipsFBOs[o] ? (this._mipsFBOs[o].horizontal.resize(s[0], s[1]), this._mipsFBOs[o].vertical.resize(s[0], s[1])) : this._mipsFBOs[o] = { horizontal: new cd(n, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: s[0], height: s[1] }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: s[0], height: s[1] }), vertical: new cd(n, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: s[0], height: s[1] }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: s[0], height: s[1] }) }, s[0] = Math.round(s[0] / 2), s[1] = Math.round(s[1] / 2); + } +}; +const por = [1, 0], mor = [0, 1]; +let gor = class { + constructor() { + this._blurFBO = null, this._size = [0, 0], this._programDesc = { gaussianBlur: { vsPath: "post-processing/pp", fsPath: "post-processing/blur/gaussianBlur", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, radialBlur: { vsPath: "post-processing/pp", fsPath: "post-processing/blur/radial-blur", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, blit: { vsPath: "post-processing/pp", fsPath: "post-processing/blit", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) } }; + } + dispose() { + this._blurFBO && (this._blurFBO.dispose(), this._blurFBO = null); + } + draw(e, i, r) { + const { context: n } = e, { type: s, radius: o } = r; + if (o === 0) + return; + this._createOrResizeResources(e), this._quad || (this._quad = new kx(n, [-1, -1, 1, -1, -1, 1, 1, 1])); + const a = this._quad; + a.bind(), s === "blur" ? this._gaussianBlur(e, i, o) : this._radialBlur(e, i), a.unbind(); + } + _gaussianBlur(e, i, r) { + const { context: n, state: s, painter: o, pixelRatio: a } = e, { size: l } = s, { materialManager: c } = o, h = this._programDesc, p = this._quad, y = [Math.round(a * l[0]), Math.round(a * l[1])], v = this._blurFBO, x = c.getProgram(h.gaussianBlur, [{ name: "radius", value: Math.ceil(r) }]); + n.useProgram(x), n.setBlendingEnabled(!1), n.bindFramebuffer(v), n.bindTexture(i.colorTexture, 4), x.setUniform1i("u_colorTexture", 4), x.setUniform2fv("u_texSize", y), x.setUniform2fv("u_direction", por), x.setUniform1f("u_sigma", r), p.draw(), n.bindFramebuffer(i), n.setStencilWriteMask(0), n.setStencilTestEnabled(!1), n.setDepthWriteEnabled(!1), n.setDepthTestEnabled(!1), n.bindTexture(v?.colorTexture, 5), x.setUniform1i("u_colorTexture", 5), x.setUniform2fv("u_direction", mor), p.draw(), n.setBlendingEnabled(!0), n.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), n.setStencilTestEnabled(!0); + } + _radialBlur(e, i) { + const { context: r, painter: n } = e, { materialManager: s } = n, o = this._programDesc, a = this._quad, l = this._blurFBO; + r.bindFramebuffer(l); + const c = s.getProgram(o.radialBlur); + r.useProgram(c), r.setBlendingEnabled(!1), r.bindTexture(i.colorTexture, 4), c.setUniform1i("u_colorTexture", 4), a.draw(), r.bindFramebuffer(i), r.setStencilWriteMask(0), r.setStencilTestEnabled(!1), r.setDepthWriteEnabled(!1), r.setDepthTestEnabled(!1), r.setBlendingEnabled(!0); + const h = s.getProgram(o.blit); + r.useProgram(h), r.bindTexture(l?.colorTexture, 5), h.setUniform1i("u_texture", 5), r.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), a.draw(); + } + _createOrResizeResources(e) { + const { context: i, state: r, pixelRatio: n } = e, { size: s } = r, o = Math.round(n * s[0]), a = Math.round(n * s[1]); + this._blurFBO && this._size[0] === o && this._size[1] === a || (this._size[0] = o, this._size[1] = a, this._blurFBO ? this._blurFBO.resize(o, a) : this._blurFBO = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: o, height: a }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: o, height: a })); + } +}, yor = class { + constructor() { + this._layerFBOTexture = null, this._size = [0, 0], this._programDesc = { vsPath: "post-processing/pp", fsPath: "post-processing/filterEffect", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }; + } + dispose() { + this._layerFBOTexture = Ua(this._layerFBOTexture); + } + draw(e, i, r) { + const { width: n, height: s } = i; + this._createOrResizeResources(e, n, s); + const { context: o, painter: a } = e, { materialManager: l } = a, c = this._programDesc, h = this._quad, p = r.colorMatrix; + h.bind(); + const y = this._layerFBOTexture; + o.bindFramebuffer(i), i.copyToTexture(0, 0, n, s, 0, 0, y), o.setBlendingEnabled(!1), o.setStencilTestEnabled(!1); + const v = l.getProgram(c); + o.useProgram(v), o.bindTexture(y, 2), v.setUniformMatrix4fv("u_coefficients", p), v.setUniform1i("u_colorTexture", 2), h.draw(), o.setBlendingEnabled(!0), o.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), o.setStencilTestEnabled(!0), h.unbind(); + } + _createOrResizeResources(e, i, r) { + const { context: n } = e; + this._layerFBOTexture && this._size[0] === i && this._size[1] === r || (this._size[0] = i, this._size[1] = r, this._layerFBOTexture ? this._layerFBOTexture.resize(i, r) : this._layerFBOTexture = new Ts(n, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: i, height: r }), this._quad || (this._quad = new kx(n, [-1, -1, 1, -1, -1, 1, 1, 1]))); + } +}; +const vor = [1, 0], _or = [0, 1]; +let bor = class { + constructor() { + this._layerFBOTexture = null, this._horizontalBlurFBO = null, this._verticalBlurFBO = null, this._size = [0, 0], this._quad = null, this._programDesc = { blur: { vsPath: "post-processing/pp", fsPath: "post-processing/blur/gaussianBlur", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, composite: { vsPath: "post-processing/pp", fsPath: "post-processing/drop-shadow/composite", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) }, blit: { vsPath: "post-processing/pp", fsPath: "post-processing/blit", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) } }; + } + dispose() { + this._layerFBOTexture = Ua(this._layerFBOTexture), this._horizontalBlurFBO = Ua(this._horizontalBlurFBO), this._verticalBlurFBO = Ua(this._verticalBlurFBO); + } + draw(e, i, r) { + const { context: n, state: s, painter: o } = e, { materialManager: a } = o, l = this._programDesc, c = i.width, h = i.height, p = [Math.round(c), Math.round(h)], { blurRadius: y, offsetX: v, offsetY: x, color: I } = r, P = [dn(v), dn(x)]; + this._createOrResizeResources(e, c, h, p); + const F = this._horizontalBlurFBO, k = this._verticalBlurFBO; + n.setStencilWriteMask(0), n.setStencilTestEnabled(!1), n.setDepthWriteEnabled(!1), n.setDepthTestEnabled(!1); + const V = this._layerFBOTexture; + i.copyToTexture(0, 0, c, h, 0, 0, V), this._quad || (this._quad = new kx(n, [-1, -1, 1, -1, -1, 1, 1, 1])), n.setViewport(0, 0, p[0], p[1]); + const j = this._quad; + j.bind(), n.setBlendingEnabled(!1); + const Y = a.getProgram(l.blur, [{ name: "radius", value: Math.ceil(y) }]); + n.useProgram(Y), n.bindFramebuffer(F), n.bindTexture(i.colorTexture, 4), Y.setUniform1i("u_colorTexture", 4), Y.setUniform2fv("u_texSize", p), Y.setUniform2fv("u_direction", vor), Y.setUniform1f("u_sigma", y), j.draw(), n.bindFramebuffer(k), n.bindTexture(F?.colorTexture, 5), Y.setUniform1i("u_colorTexture", 5), Y.setUniform2fv("u_direction", _or), j.draw(), n.bindFramebuffer(i), n.setViewport(0, 0, c, h); + const X = a.getProgram(l.composite); + n.useProgram(X), n.bindTexture(k?.colorTexture, 2), X.setUniform1i("u_blurTexture", 2), n.bindTexture(V, 3), X.setUniform1i("u_layerFBOTexture", 3), X.setUniform4fv("u_shadowColor", [I[3] * (I[0] / 255), I[3] * (I[1] / 255), I[3] * (I[2] / 255), I[3]]), X.setUniformMatrix3fv("u_displayViewMat3", s.displayMat3), X.setUniform2fv("u_shadowOffset", P), j.draw(), n.setBlendingEnabled(!0), n.setStencilTestEnabled(!0), n.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), j.unbind(); + } + _createOrResizeResources(e, i, r, n) { + const { context: s } = e; + this._horizontalBlurFBO && this._size[0] === i && this._size[1] === r || (this._size[0] = i, this._size[1] = r, this._horizontalBlurFBO ? this._horizontalBlurFBO.resize(n[0], n[1]) : this._horizontalBlurFBO = new cd(s, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: n[0], height: n[1] }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: n[0], height: n[1] }), this._verticalBlurFBO ? this._verticalBlurFBO.resize(n[0], n[1]) : this._verticalBlurFBO = new cd(s, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: n[0], height: n[1] }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: n[0], height: n[1] }), this._layerFBOTexture ? this._layerFBOTexture.resize(i, r) : this._layerFBOTexture = new Ts(s, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: i, height: r })); + } +}, wor = class { + constructor() { + this._size = [0, 0], this._layerFBOTexture = null; + } + dispose() { + this._layerFBOTexture = Ua(this._layerFBOTexture); + } + draw(e, i, r) { + const { width: n, height: s } = i; + this._createOrResizeResources(e, n, s); + const { context: o, painter: a } = e, { amount: l } = r, c = o.gl, h = this._layerFBOTexture; + o.bindFramebuffer(i), i.copyToTexture(0, 0, n, s, 0, 0, h), o.setBlendingEnabled(!0), o.setStencilTestEnabled(!1), o.setDepthTestEnabled(!1), o.setClearColor(0, 0, 0, 0), o.clear(c.COLOR_BUFFER_BIT), a.blitTexture(o, h, _n.NEAREST, l); + } + _createOrResizeResources(e, i, r) { + const { context: n } = e; + this._layerFBOTexture && this._size[0] === i && this._size[1] === r || (this._size[0] = i, this._size[1] = r, this._layerFBOTexture ? this._layerFBOTexture.resize(i, r) : this._layerFBOTexture = new Ts(n, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.NEAREST, flipped: !1, width: i, height: r })); + } +}; +function xor(t) { + switch (t) { + case "bloom": + case "blur": + case "opacity": + case "drop-shadow": + return t; + default: + return "colorize"; + } +} +const Sor = { colorize: () => new yor(), blur: () => new gor(), bloom: () => new dor(), opacity: () => new wor(), "drop-shadow": () => new bor() }; +let Cor = class { + constructor() { + this._effectMap = /* @__PURE__ */ new Map(); + } + dispose() { + this._effectMap.forEach((e) => e.dispose()), this._effectMap.clear(); + } + getPostProcessingEffects(e) { + if (!e || e.length === 0) + return []; + const i = []; + for (const r of e) { + const n = xor(r.type); + let s = this._effectMap.get(n); + s || (s = Sor[n](), this._effectMap.set(n, s)), i.push({ postProcessingEffect: s, effect: r }); + } + return i; + } +}, Tor = class { + constructor(e, i) { + this.brushes = e, this.name = i.name, this.drawPhase = i.drawPhase || lo.MAP, this._targetFn = i.target, this.effects = i.effects || [], this.enableDefaultDraw = i.enableDefaultDraw ?? (() => !0); + } + render(e) { + const { context: i, profiler: r } = e, n = this._targetFn(), s = this.drawPhase & e.drawPhase; + if (r.recordPassStart(this.name), s) { + this.enableDefaultDraw() && this._doRender(e, n), r.recordPassEnd(); + for (const o of this.effects) { + if (!o.enable()) + continue; + const a = o.apply, l = o.args && o.args(), c = i.getViewport(), h = i.getBoundFramebufferObject(), p = e.passOptions; + this._bindEffect(e, a, l), this._doRender(e, n, a.defines), this._drawAndUnbindEffect(e, a, c, h, p, l); + } + } + } + _doRender(e, i, r) { + if (ut(i)) + return; + const { profiler: n, context: s } = e; + for (const o of this.brushes) { + if (n.recordBrushStart(o.name), _e(o.brushEffect)) { + const a = s.getViewport(), l = s.getBoundFramebufferObject(), c = e.passOptions; + this._bindEffect(e, o.brushEffect), this._drawWithBrush(o, e, i, r), this._drawAndUnbindEffect(e, o.brushEffect, a, l, c); + } else + this._drawWithBrush(o, e, i, r); + n.recordBrushEnd(); + } + } + _drawWithBrush(e, i, r, n) { + Zlt(r) ? (e.prepareState(i, n), e.drawMany(i, r, n)) : r.visible && (e.prepareState(i, n), e.draw(i, r, n)); + } + _bindEffect(e, i, r) { + const { profiler: n } = e; + n.recordPassStart(this.name + "." + i.name), i.bind(e, r); + const s = i.createOptions(e, r); + e.passOptions = s; + } + _drawAndUnbindEffect(e, i, r, n, s, o) { + const { profiler: a, context: l } = e; + e.passOptions = s, a.recordBrushStart(i.name), i.draw(e, o), i.unbind(e, o), l.bindFramebuffer(n); + const { x: c, y: h, width: p, height: y } = r; + l.setViewport(c, h, p, y), a.recordBrushEnd(), a.recordPassEnd(); + } +}; +function Eor(t, e) { + switch (t) { + case En.LINE: + return fh.line; + case En.TEXT: + return fh.text; + case En.LABEL: + return fh.label; + case En.FILL: + return e === Zo.DOT_DENSITY ? fh.dotDensity : fh.fill; + case En.MARKER: + switch (e) { + case Zo.HEATMAP: + return fh.heatmap; + case Zo.PIE_CHART: + return fh.pieChart; + default: + return fh.marker; + } + } +} +let Ior = class { + constructor(e, i, r) { + this.context = e, this._blitRenderer = new qMt(), this._worldExtentClipRenderer = new Jsr(), this._isClippedToWorldExtent = !1, this._brushCache = /* @__PURE__ */ new Map(), this._lastWidth = null, this._lastHeight = null, this._prevFBO = null, this._vtlMaterialManager = new vsr(), this._blendEffect = new eor(), this._stencilBuf = null, this._fbos = null, this._fboPool = [], this._renderTarget = null, this.effects = { highlight: new sor(), hittest: new oor(), hittestVTL: new aor(), integrate: new Zsr(), insideEffect: new Dnt("inside"), outsideEffect: new Dnt("outside") }, this.materialManager = new Csr(e), this.textureManager = new qsr(i, r, e.type === go.WEBGL2), this.textureUploadManager = new Ysr(e, i), this._effectsManager = new Cor(); + } + get vectorTilesMaterialManager() { + return this._vtlMaterialManager; + } + getRenderTarget() { + return this._renderTarget; + } + setRenderTarget(e) { + this._renderTarget = e; + } + getFbos(e, i) { + if (e !== this._lastWidth || i !== this._lastHeight) { + if (this._lastWidth = e, this._lastHeight = i, this._fbos) { + for (const o in this._fbos) + this._fbos[o].resize(e, i); + return this._fbos; + } + const r = { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, width: e, height: i }, n = { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.DEPTH_STENCIL_RENDER_BUFFER }, s = new nO(this.context, { width: e, height: i, internalFormat: Ag.DEPTH_STENCIL }); + this._stencilBuf = s, this._fbos = { output: new cd(this.context, n, r, s), blend: new cd(this.context, n, r, s), effect0: new cd(this.context, n, r, s) }; + } + return this._fbos; + } + acquireFbo(e, i) { + let r; + r = this._fboPool.length > 0 ? this._fboPool.pop() : new cd(this.context, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.DEPTH_STENCIL_RENDER_BUFFER }, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, width: e, height: i }, this._stencilBuf); + const n = r.descriptor; + return n.width === e && n.height === i || r.resize(e, i), r; + } + releaseFbo(e) { + this._fboPool.push(e); + } + getSharedStencilBuffer() { + return this._stencilBuf; + } + beforeRenderLayers(e, i = null) { + const { width: r, height: n } = e.getViewport(); + this._prevFBO = e.getBoundFramebufferObject(); + const s = this.getFbos(r, n); + if (e.bindFramebuffer(s?.output), e.setColorMask(!0, !0, !0, !0), _e(i)) { + const { r: o, g: a, b: l, a: c } = i.color; + e.setClearColor(c * o / 255, c * a / 255, c * l / 255, c); + } else + e.setClearColor(0, 0, 0, 0); + e.setDepthWriteEnabled(!0), e.setClearDepth(1), e.clear(e.gl.COLOR_BUFFER_BIT | e.gl.DEPTH_BUFFER_BIT), e.setDepthWriteEnabled(!1); + } + beforeRenderLayer(e, i, r) { + const { context: n, blendMode: s, effects: o, requireFBO: a, drawPhase: l } = e; + if (a || Lnt(l, s, o, r)) + n.bindFramebuffer(this._fbos?.blend), n.setColorMask(!0, !0, !0, !0), n.setClearColor(0, 0, 0, 0), n.setDepthWriteEnabled(!0), n.setClearDepth(1), n.clear(n.gl.COLOR_BUFFER_BIT | n.gl.DEPTH_BUFFER_BIT), n.setDepthWriteEnabled(!1); + else { + const c = this._getOutputFBO(); + n.bindFramebuffer(c); + } + n.setDepthWriteEnabled(!1), n.setDepthTestEnabled(!1), n.setStencilTestEnabled(!0), n.setClearStencil(i), n.setStencilWriteMask(255), n.clear(n.gl.STENCIL_BUFFER_BIT); + } + compositeLayer(e, i) { + const { context: r, blendMode: n, effects: s, requireFBO: o, drawPhase: a } = e; + if (o || Lnt(a, n, s, i)) { + _e(s) && s.length > 0 && a === lo.MAP && this._applyEffects(e, s); + const l = this._getOutputFBO(); + r.bindFramebuffer(l), r.setStencilTestEnabled(!1), r.setStencilWriteMask(0), r.setBlendingEnabled(!0), r.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), r.setColorMask(!0, !0, !0, !0); + const c = ut(n) || a === lo.HIGHLIGHT ? "normal" : n, h = this._fbos; + h?.blend.colorTexture && this._blendEffect.draw(e, h.blend.colorTexture, _n.NEAREST, c, i); + } + } + renderLayers(e) { + e.bindFramebuffer(this._prevFBO); + const i = this._getOutputFBO(); + i && (e.setDepthTestEnabled(!1), e.setStencilWriteMask(0), this._isClippedToWorldExtent ? (e.setStencilTestEnabled(!0), e.setStencilFunction(Ll.EQUAL, 1, 255)) : e.setStencilTestEnabled(!1), this.blitTexture(e, i.colorTexture, _n.NEAREST)); + } + prepareDisplay(e, i, r) { + const { context: n } = e; + if (n.bindFramebuffer(this._prevFBO), n.setColorMask(!0, !0, !0, !0), _e(i)) { + const { r: s, g: o, b: a, a: l } = i.color; + n.setClearColor(l * s / 255, l * o / 255, l * a / 255, l); + } else + n.setClearColor(0, 0, 0, 0); + n.setStencilWriteMask(255), n.setClearStencil(0), n.clear(n.gl.COLOR_BUFFER_BIT | n.gl.STENCIL_BUFFER_BIT), this._isClippedToWorldExtent = this._worldExtentClipRenderer.render(e, r); + } + dispose() { + if (this.materialManager.dispose(), this.textureManager.dispose(), this.textureUploadManager.destroy(), this._blitRenderer = Ua(this._blitRenderer), this._worldExtentClipRenderer = Ua(this._worldExtentClipRenderer), this._brushCache && (this._brushCache.forEach((e) => e.dispose()), this._brushCache.clear(), this._brushCache = null), this._fbos) + for (const e in this._fbos) + this._fbos[e] && this._fbos[e].dispose(); + for (const e of this._fboPool) + e.dispose(); + if (this._fboPool.length = 0, this.effects) + for (const e in this.effects) + this.effects[e] && this.effects[e].dispose(); + this._effectsManager.dispose(), this._vtlMaterialManager = Ua(this._vtlMaterialManager), this._prevFBO = null; + } + getBrush(e, i) { + const r = Eor(e, i); + let n = this._brushCache.get(r); + return n === void 0 && (n = new r(), this._brushCache.set(r, n)), n; + } + renderObject(e, i, r, n) { + const s = fh[r]; + if (!s) + return; + let o = this._brushCache.get(s); + o === void 0 && (o = new s(), this._brushCache.set(s, o)), o.prepareState(e, n), o.draw(e, i, n); + } + renderObjects(e, i, r, n) { + const s = fh[r]; + if (!s) + return; + let o = this._brushCache.get(s); + o === void 0 && (o = new s(), this._brushCache.set(s, o)), o.drawMany(e, i, n); + } + registerRenderPass(e) { + const i = e.brushes.map((r) => (this._brushCache.has(r) || this._brushCache.set(r, new r()), this._brushCache.get(r))); + return new Tor(i, e); + } + blitTexture(e, i, r, n = 1) { + e.setBlendingEnabled(!0), e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.setColorMask(!0, !0, !0, !0), this._blitRenderer.render(e, i, r, n); + } + getPostProcessingEffects(e) { + return this._effectsManager.getPostProcessingEffects(e); + } + _getOutputFBO() { + return this._renderTarget != null ? this._renderTarget : this._fbos?.output ?? null; + } + _applyEffects(e, i) { + const r = this._fbos?.blend; + if (!r) + return; + const { context: n } = e, s = this._effectsManager.getPostProcessingEffects(i); + for (const { postProcessingEffect: o, effect: a } of s) + n.bindFramebuffer(r), o.draw(e, r, a); + } +}; +function Lnt(t, e, i, r) { + return t !== lo.HIGHLIGHT && (r !== 1 || _e(e) && e !== "normal" || _e(i) && i.length > 0); +} +function WI(t) { + return window.WebGL2RenderingContext && t instanceof window.WebGL2RenderingContext; +} +let Nnt = class { + constructor(e, i, r, n, s, o, a, l, c) { + this.createQuery = e, this.deleteQuery = i, this.resultAvailable = r, this.getResult = n, this.disjoint = s, this.beginTimeElapsed = o, this.endTimeElapsed = a, this.createTimestamp = l, this.timestampBits = c; + } +}, YR = !1; +function QMt(t, e) { + if (e.disjointTimerQuery) + return null; + let i = t.getExtension("EXT_disjoint_timer_query_webgl2"); + return i && WI(t) ? new Nnt(() => t.createQuery(), (r) => { + t.deleteQuery(r), YR = !1; + }, (r) => t.getQueryParameter(r, t.QUERY_RESULT_AVAILABLE), (r) => t.getQueryParameter(r, t.QUERY_RESULT), () => t.getParameter(i.GPU_DISJOINT_EXT), (r) => { + YR || (YR = !0, t.beginQuery(i.TIME_ELAPSED_EXT, r)); + }, () => { + t.endQuery(i.TIME_ELAPSED_EXT), YR = !1; + }, (r) => i.queryCounterEXT(r, i.TIMESTAMP_EXT), () => t.getQuery(i.TIMESTAMP_EXT, i.QUERY_COUNTER_BITS_EXT)) : (i = t.getExtension("EXT_disjoint_timer_query"), i ? new Nnt(() => i.createQueryEXT(), (r) => { + i.deleteQueryEXT(r), YR = !1; + }, (r) => i.getQueryObjectEXT(r, i.QUERY_RESULT_AVAILABLE_EXT), (r) => i.getQueryObjectEXT(r, i.QUERY_RESULT_EXT), () => t.getParameter(i.GPU_DISJOINT_EXT), (r) => { + YR || (YR = !0, i.beginQueryEXT(i.TIME_ELAPSED_EXT, r)); + }, () => { + i.endQueryEXT(i.TIME_ELAPSED_EXT), YR = !1; + }, (r) => i.queryCounterEXT(r, i.TIMESTAMP_EXT), () => i.getQueryEXT(i.TIMESTAMP_EXT, i.QUERY_COUNTER_BITS_EXT)) : null); +} +const x2 = Vi("esri-2d-profiler"); +let Aor = class { + constructor(e, i) { + if (this._events = new Bd(), this._entries = /* @__PURE__ */ new Map(), this._timings = new o4(10), this._currentContainer = null, this._currentPass = null, this._currentBrush = null, this._currentSummary = null, !x2) + return; + this._ext = QMt(e.gl, {}), this._debugOutput = i; + const r = e.gl; + if (this.enableCommandLogging) { + for (const n in r) + if (typeof r[n] == "function") { + const s = r[n], o = n.includes("draw"); + r[n] = (...a) => (this._events.emit("command", { container: this._currentContainer, pass: this._currentPass, brush: this._currentBrush, method: n, args: a, isDrawCommand: o }), this._currentSummary && (this._currentSummary.commands++, o && this._currentSummary.drawCommands++), s.apply(r, a)); + } + } + } + get enableCommandLogging() { + return !(typeof x2 == "object" && x2.disableCommands); + } + recordContainerStart(e) { + x2 && (this._currentContainer = e); + } + recordContainerEnd() { + x2 && (this._currentContainer = null); + } + recordPassStart(e) { + x2 && (this._currentPass = e, this._initSummary()); + } + recordPassEnd() { + x2 && (this._currentPass = null, this._emitSummary()); + } + recordBrushStart(e) { + x2 && (this._currentBrush = e); + } + recordBrushEnd() { + x2 && (this._currentBrush = null); + } + recordStart(e) { + if (x2 && _e(this._ext)) { + if (this._entries.has(e)) { + const r = this._entries.get(e), n = this._ext.resultAvailable(r.query), s = this._ext.disjoint(); + if (n && !s) { + const o = this._ext.getResult(r.query) / 1e6; + let a = 0; + if (_e(this._timings.enqueue(o))) { + const h = this._timings.entries, p = h.length; + let y = 0; + for (const v of h) + y += v; + a = y / p; + } + const l = o.toFixed(2), c = a ? a.toFixed(2) : "--"; + this.enableCommandLogging ? (console.groupCollapsed(`Frame report for ${e}, ${l} ms (${c} last 10 avg) +${r.commandsLen} Commands (${r.drawCommands} draw)`), console.log("RenderPass breakdown: "), console.table(r.summaries), console.log("Commands: ", r.commands), console.groupEnd()) : console.log(`Frame report for ${e}, ${l} ms (${c} last 10 avg)`), this._debugOutput.innerHTML = `${l} (${c})`; + } + for (const o of r.handles) + o.remove(); + this._ext.deleteQuery(r.query), this._entries.delete(e); + } + const i = { name: e, query: this._ext.createQuery(), commands: [], commandsLen: 0, drawCommands: 0, summaries: [], handles: [] }; + this.enableCommandLogging && (i.handles.push(this._events.on("command", (r) => { + i.commandsLen++, i.commands.push(r), r.isDrawCommand && i.drawCommands++; + })), i.handles.push(this._events.on("summary", (r) => { + i.summaries.push(r); + }))), this._ext.beginTimeElapsed(i.query), this._entries.set(e, i); + } + } + recordEnd(e) { + x2 && _e(this._ext) && this._entries.has(e) && this._ext.endTimeElapsed(); + } + _initSummary() { + this.enableCommandLogging && (this._currentSummary = { container: this._currentContainer, pass: this._currentPass, drawCommands: 0, commands: 0 }); + } + _emitSummary() { + this.enableCommandLogging && this._currentSummary && this._events.emit("summary", this._currentSummary); + } +}, knt = class { + constructor() { + this.blend = !1, this.blendColor = { r: 0, g: 0, b: 0, a: 0 }, this.blendFunction = { srcRGB: gn.ONE, dstRGB: gn.ZERO, srcAlpha: gn.ONE, dstAlpha: gn.ZERO }, this.blendEquation = { mode: r4.ADD, modeAlpha: r4.ADD }, this.colorMask = { r: !0, g: !0, b: !0, a: !0 }, this.faceCulling = !1, this.cullFace = ax.BACK, this.frontFace = qU.CCW, this.scissorTest = !1, this.scissorRect = { x: 0, y: 0, width: 0, height: 0 }, this.depthTest = !1, this.depthFunction = Ll.LESS, this.clearDepth = 1, this.depthWrite = !0, this.depthRange = { zNear: 0, zFar: 1 }, this.viewport = null, this.stencilTest = !1, this.polygonOffsetFill = !1, this.polygonOffset = [0, 0], this.stencilFunction = { face: ax.FRONT_AND_BACK, func: Ll.ALWAYS, ref: 0, mask: 1 }, this.clearStencil = 0, this.stencilWriteMask = 1, this.stencilOperation = { face: ax.FRONT_AND_BACK, fail: su.KEEP, zFail: su.KEEP, zPass: su.KEEP }, this.clearColor = { r: 0, g: 0, b: 0, a: 0 }, this.program = null, this.vertexBuffer = null, this.indexBuffer = null, this.uniformBuffer = null, this.pixelPackBuffer = null, this.pixelUnpackBuffer = null, this.copyReadBuffer = null, this.copyWriteBuffer = null, this.uniformBufferBindingPoints = new Array(), this.readFramebuffer = null, this.drawFramebuffer = null, this.renderbuffer = null, this.activeTexture = 0, this.textureUnitMap = new Array(), this.vertexArrayObject = null; + } +}, Por = class { + constructor(e) { + this._allocations = /* @__PURE__ */ new Map(), e ? Error.stackTraceLimit = 1 / 0 : (this.add = () => { + }, this.remove = () => { + }); + } + add(e) { + this._allocations.set(e, new Error().stack); + } + remove(e) { + this._allocations.delete(e); + } + get information() { + let e = ""; + if (this._allocations.size > 0) { + e += `${this._allocations.size} live object allocations: +`; + const i = /* @__PURE__ */ new Map(); + this._allocations.forEach((r) => { + i.set(r, (i.get(r) ?? 0) + 1); + }), i.forEach((r, n) => { + const s = n.split(` +`); + s.shift(), s.shift(), e += `${r}: ${s.shift()} +`, s.forEach((o) => e += ` ${o} +`); + }); + } + return e; + } +}; +const Oor = { RECORD_ALLOCATIONS: !1 }; +let Ror = class { + constructor() { + for (this._current = new Array(), this._max = new Array(), this._allocations = new Por(Oor.RECORD_ALLOCATIONS); this._current.length < Df.COUNT; ) + this._current.push(0), this._max.push(0); + } + resetMax() { + for (this._max.length = 0; this._max.length < this._current.length; ) + this._max.push(0); + } + increment(e, i) { + const r = ++this._current[e]; + this._max[e] = Math.max(r, this._max[e]), this._allocations.add(i); + } + decrement(e, i) { + --this._current[e], this._allocations.remove(i); + } + get max() { + return this._max; + } + get current() { + return this._current; + } + get total() { + return this.current.reduce((e, i) => e + i, 0); + } + get resourceInformation() { + let e = ""; + if (this.total > 0) { + e += `Live objects: +`; + for (let i = 0; i < Df.COUNT; ++i) { + const r = this._current[i]; + r > 0 && (e += `${Df[i]}: ${r} +`); + } + } + return e += this._allocations.information, e; + } +}; +var $x, W$, $nt, mte, CI, eDe, aZ, Bnt, nf, Vnt, sO; +(function(t) { + t[t.None = 0] = "None", t[t.Front = 1] = "Front", t[t.Back = 2] = "Back", t[t.COUNT = 3] = "COUNT"; +})($x || ($x = {})), function(t) { + t[t.Less = 0] = "Less", t[t.Lequal = 1] = "Lequal", t[t.COUNT = 2] = "COUNT"; +}(W$ || (W$ = {})), function(t) { + t[t.BACKGROUND = 0] = "BACKGROUND", t[t.UPDATE = 1] = "UPDATE"; +}($nt || ($nt = {})), function(t) { + t[t.NOT_LOADED = 0] = "NOT_LOADED", t[t.LOADING = 1] = "LOADING", t[t.LOADED = 2] = "LOADED"; +}(mte || (mte = {})), function(t) { + t[t.IntegratedMeshMaskExcluded = 1] = "IntegratedMeshMaskExcluded", t[t.OutlineVisualElementMask = 2] = "OutlineVisualElementMask"; +}(CI || (CI = {})), function(t) { + t[t.Highlight = 0] = "Highlight", t[t.MaskOccludee = 1] = "MaskOccludee", t[t.COUNT = 2] = "COUNT"; +}(eDe || (eDe = {})), function(t) { + t[t.STRETCH = 1] = "STRETCH", t[t.PAD = 2] = "PAD"; +}(aZ || (aZ = {})), function(t) { + t[t.CHANGED = 0] = "CHANGED", t[t.UNCHANGED = 1] = "UNCHANGED"; +}(Bnt || (Bnt = {})), function(t) { + t[t.Blend = 0] = "Blend", t[t.Opaque = 1] = "Opaque", t[t.Mask = 2] = "Mask", t[t.MaskBlend = 3] = "MaskBlend", t[t.COUNT = 4] = "COUNT"; +}(nf || (nf = {})), function(t) { + t[t.OFF = 0] = "OFF", t[t.ON = 1] = "ON"; +}(Vnt || (Vnt = {})), function(t) { + t.DDS_ENCODING = "image/vnd-ms.dds", t.KTX2_ENCODING = "image/ktx2", t.BASIS_ENCODING = "image/x.basis"; +}(sO || (sO = {})); +function eDt(t, e, i = r4.ADD, r = [0, 0, 0, 0]) { + return { srcRgb: t, srcAlpha: t, dstRgb: e, dstAlpha: e, opRgb: i, opAlpha: i, color: { r: r[0], g: r[1], b: r[2], a: r[3] } }; +} +function Mor(t, e, i, r, n = r4.ADD, s = r4.ADD, o = [0, 0, 0, 0]) { + return { srcRgb: t, srcAlpha: e, dstRgb: i, dstAlpha: r, opRgb: n, opAlpha: s, color: { r: o[0], g: o[1], b: o[2], a: o[3] } }; +} +const Dor = { face: ax.BACK, mode: qU.CCW }, For = { face: ax.FRONT, mode: qU.CCW }, Lor = (t) => t === $x.Back ? Dor : t === $x.Front ? For : null, Nor = { zNear: 0, zFar: 1 }, L9e = { r: !0, g: !0, b: !0, a: !0 }; +function kor(t) { + return Hor.intern(t); +} +function $or(t) { + return Wor.intern(t); +} +function Bor(t) { + return qor.intern(t); +} +function Vor(t) { + return Yor.intern(t); +} +function jor(t) { + return Xor.intern(t); +} +function Gor(t) { + return Kor.intern(t); +} +function Uor(t) { + return Jor.intern(t); +} +function zor(t) { + return Zor.intern(t); +} +function Lve(t) { + return Qor.intern(t); +} +let O3 = class { + constructor(e, i) { + this._makeKey = e, this._makeRef = i, this._interns = /* @__PURE__ */ new Map(); + } + intern(e) { + if (!e) + return null; + const i = this._makeKey(e), r = this._interns; + return r.has(i) || r.set(i, this._makeRef(e)), r.get(i) ?? null; + } +}; +function R3(t) { + return "[" + t.join(",") + "]"; +} +const Hor = new O3(tDt, (t) => ({ __tag: "Blending", ...t })); +function tDt(t) { + return t ? R3([t.srcRgb, t.srcAlpha, t.dstRgb, t.dstAlpha, t.opRgb, t.opAlpha, t.color.r, t.color.g, t.color.b, t.color.a]) : null; +} +const Wor = new O3(iDt, (t) => ({ __tag: "Culling", ...t })); +function iDt(t) { + return t ? R3([t.face, t.mode]) : null; +} +const qor = new O3(rDt, (t) => ({ __tag: "PolygonOffset", ...t })); +function rDt(t) { + return t ? R3([t.factor, t.units]) : null; +} +const Yor = new O3(nDt, (t) => ({ __tag: "DepthTest", ...t })); +function nDt(t) { + return t ? R3([t.func]) : null; +} +const Xor = new O3(sDt, (t) => ({ __tag: "StencilTest", ...t })); +function sDt(t) { + return t ? R3([t.function.func, t.function.ref, t.function.mask, t.operation.fail, t.operation.zFail, t.operation.zPass]) : null; +} +const Kor = new O3(oDt, (t) => ({ __tag: "DepthWrite", ...t })); +function oDt(t) { + return t ? R3([t.zNear, t.zFar]) : null; +} +const Jor = new O3(aDt, (t) => ({ __tag: "ColorWrite", ...t })); +function aDt(t) { + return t ? R3([t.r, t.g, t.b, t.a]) : null; +} +const Zor = new O3(lDt, (t) => ({ __tag: "StencilWrite", ...t })); +function lDt(t) { + return t ? R3([t.mask]) : null; +} +const Qor = new O3(ear, (t) => ({ blending: kor(t.blending), culling: $or(t.culling), polygonOffset: Bor(t.polygonOffset), depthTest: Vor(t.depthTest), stencilTest: jor(t.stencilTest), depthWrite: Gor(t.depthWrite), colorWrite: Uor(t.colorWrite), stencilWrite: zor(t.stencilWrite) })); +function ear(t) { + return t ? R3([tDt(t.blending), iDt(t.culling), rDt(t.polygonOffset), nDt(t.depthTest), sDt(t.stencilTest), oDt(t.depthWrite), aDt(t.colorWrite), lDt(t.stencilWrite)]) : null; +} +let tar = class { + constructor(e) { + this._pipelineInvalid = !0, this._blendingInvalid = !0, this._cullingInvalid = !0, this._polygonOffsetInvalid = !0, this._depthTestInvalid = !0, this._stencilTestInvalid = !0, this._depthWriteInvalid = !0, this._colorWriteInvalid = !0, this._stencilWriteInvalid = !0, this._stateSetters = e; + } + setPipeline(e) { + (this._pipelineInvalid || e !== this._pipeline) && (this._setBlending(e.blending), this._setCulling(e.culling), this._setPolygonOffset(e.polygonOffset), this._setDepthTest(e.depthTest), this._setStencilTest(e.stencilTest), this._setDepthWrite(e.depthWrite), this._setColorWrite(e.colorWrite), this._setStencilWrite(e.stencilWrite), this._pipeline = e), this._pipelineInvalid = !1; + } + invalidateBlending() { + this._blendingInvalid = !0, this._pipelineInvalid = !0; + } + invalidateCulling() { + this._cullingInvalid = !0, this._pipelineInvalid = !0; + } + invalidatePolygonOffset() { + this._polygonOffsetInvalid = !0, this._pipelineInvalid = !0; + } + invalidateDepthTest() { + this._depthTestInvalid = !0, this._pipelineInvalid = !0; + } + invalidateStencilTest() { + this._stencilTestInvalid = !0, this._pipelineInvalid = !0; + } + invalidateDepthWrite() { + this._depthWriteInvalid = !0, this._pipelineInvalid = !0; + } + invalidateColorWrite() { + this._colorWriteInvalid = !0, this._pipelineInvalid = !0; + } + invalidateStencilWrite() { + this._stencilTestInvalid = !0, this._pipelineInvalid = !0; + } + _setBlending(e) { + this._blending = this._setSubState(e, this._blending, this._blendingInvalid, this._stateSetters.setBlending), this._blendingInvalid = !1; + } + _setCulling(e) { + this._culling = this._setSubState(e, this._culling, this._cullingInvalid, this._stateSetters.setCulling), this._cullingInvalid = !1; + } + _setPolygonOffset(e) { + this._polygonOffset = this._setSubState(e, this._polygonOffset, this._polygonOffsetInvalid, this._stateSetters.setPolygonOffset), this._polygonOffsetInvalid = !1; + } + _setDepthTest(e) { + this._depthTest = this._setSubState(e, this._depthTest, this._depthTestInvalid, this._stateSetters.setDepthTest), this._depthTestInvalid = !1; + } + _setStencilTest(e) { + this._stencilTest = this._setSubState(e, this._stencilTest, this._stencilTestInvalid, this._stateSetters.setStencilTest), this._stencilTestInvalid = !1; + } + _setDepthWrite(e) { + this._depthWrite = this._setSubState(e, this._depthWrite, this._depthWriteInvalid, this._stateSetters.setDepthWrite), this._depthWriteInvalid = !1; + } + _setColorWrite(e) { + this._colorWrite = this._setSubState(e, this._colorWrite, this._colorWriteInvalid, this._stateSetters.setColorWrite), this._colorWriteInvalid = !1; + } + _setStencilWrite(e) { + this._stencilWrite = this._setSubState(e, this._stencilWrite, this._stencilWriteInvalid, this._stateSetters.setStencilWrite), this._stencilTestInvalid = !1; + } + _setSubState(e, i, r, n) { + return (r || e !== i) && (n(e), this._pipelineInvalid = !0), e; + } +}, iar = class { +}; +const Nve = iar; +function Ii(t, ...e) { + let i = ""; + for (let r = 0; r < e.length; r++) + i += t[r] + e[r]; + return i += t[t.length - 1], i; +} +(function(t) { + function e(r) { + return Math.round(r).toString(); + } + function i(r) { + return r.toPrecision(8); + } + t.int = e, t.float = i; +})(Ii || (Ii = {})); +let sre = class { + constructor() { + this._result = !1; + } + dispose() { + this._program = Ua(this._program); + } + get result() { + return _e(this._program) && (this._result = this._test(this._program), this.dispose()), this._result; + } +}, rar = class extends sre { + constructor(e) { + super(), this._rctx = e, this._dummyProgram = null, this._rctx.type === go.WEBGL2 && Vi("mac") && Vi("chrome") && (this._program = this._prepareProgram(), this._dummyProgram = this._prepareDummyProgram()); + } + dispose() { + super.dispose(), this._dummyProgram?.dispose(), this._dummyProgram = null; + } + _test(e) { + const i = this._rctx; + i.resetState(); + const r = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }), n = Qo.createIndex(this._rctx, Vo.STATIC_DRAW, new Uint8Array([0])); + i.bindFramebuffer(r), i.setViewport(0, 0, 1, 1), i.useProgram(this._dummyProgram), i.bindBuffer(n, ao.ELEMENT_ARRAY_BUFFER), i.drawElements(ps.POINTS, 1, Fi.UNSIGNED_BYTE, 0), i.useProgram(e), i.bindVAO(null), i.drawArrays(ps.TRIANGLES, 0, 258); + const s = new Uint8Array(4); + return r.readPixels(0, 0, 1, 1, cn.RGBA, rs.UNSIGNED_BYTE, s), r.dispose(), n.dispose(), s[0] === 255; + } + _prepareProgram() { + const i = ` + precision highp float; + + varying float triangleId; + + const vec3 triangleVertices[3] = vec3[3](vec3(-0.5, -0.5, 0.0), vec3(0.5, -0.5, 0.0), vec3(0.0, 0.5, 0.0)); + + void main(void) { + triangleId = floor(float(gl_VertexID)/3.0); + + vec3 position = triangleVertices[gl_VertexID % 3]; + float offset = triangleId / ${Ii.float(85)}; + position.z = 0.5 - offset; + + gl_Position = vec4(position, 1.0); + } + `, r = ` + precision highp float; + + varying float triangleId; + + void main(void) { + gl_FragColor = triangleId == ${Ii.float(85)} ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); + } + `; + return this._rctx.programCache.acquire(i, r, /* @__PURE__ */ new Map([])); + } + _prepareDummyProgram() { + const e = ` + void main(void) { + gl_Position = vec4(0.0, 0.0, float(gl_VertexID)-2.0, 1.0); + }`, i = ` + void main(void) { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + }`; + return this._rctx.programCache.acquire(e, i, /* @__PURE__ */ new Map([])); + } +}; +function jnt(t, e, i) { + for (let r = 0; r < i; ++r) + e[2 * r] = t[r], e[2 * r + 1] = t[r] - e[2 * r]; +} +function nar(t, e) { + const i = t.length; + for (let r = 0; r < i; ++r) + CG[0] = t[r], e[r] = CG[0]; + return e; +} +function sar(t, e) { + const i = t.length; + for (let r = 0; r < i; ++r) + CG[0] = t[r], CG[1] = t[r] - CG[0], e[r] = CG[1]; + return e; +} +const CG = new Float32Array(2); +let oar = class extends sre { + constructor(e) { + super(), this._rctx = e, this._program = Gnt(this._rctx, !1), this._obfuscated = Gnt(this._rctx, !0); + } + dispose() { + super.dispose(), this._obfuscated = Ua(this._obfuscated); + } + _test(e) { + if (Vi("force-double-precision-obfuscation")) + return !0; + if (ut(this._obfuscated)) + return !1; + const i = this._runProgram(e), r = this._runProgram(this._obfuscated); + return i !== 0 && (r === 0 || i / r > 5); + } + _runProgram(e) { + const i = this._rctx; + i.resetState(); + const r = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }), n = Qo.createVertex(i, Vo.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), s = new Ac(i, /* @__PURE__ */ new Map([["position", 0]]), { geometry: [new ea("position", 2, Fi.UNSIGNED_SHORT, 0, 4)] }, { geometry: n }), o = Na(5633261287538229e-9, 2626832878767164e-9, 1.4349880495278358e6), a = Na(563327146742708e-8, 2.6268736381334523e6, 1434963231608387e-9), l = new Float32Array(6); + jnt(o, l, 3); + const c = new Float32Array(6); + jnt(a, c, 3), i.useProgram(e), e.setUniform3f("u_highA", l[0], l[2], l[4]), e.setUniform3f("u_lowA", l[1], l[3], l[5]), e.setUniform3f("u_highB", c[0], c[2], c[4]), e.setUniform3f("u_lowB", c[1], c[3], c[5]), i.bindFramebuffer(r), i.setViewport(0, 0, 1, 1), i.bindVAO(s), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4); + const h = new Uint8Array(4); + r.readPixels(0, 0, 1, 1, cn.RGBA, rs.UNSIGNED_BYTE, h), s.dispose(!1), n.dispose(), r.dispose(); + const p = (o[2] - a[2]) / 25, y = NRt(h); + return Math.abs(p - y); + } +}; +function Gnt(t, e) { + const i = ` + + precision highp float; + + attribute vec2 position; + + uniform vec3 u_highA; + uniform vec3 u_lowA; + uniform vec3 u_highB; + uniform vec3 u_lowB; + + varying vec4 v_color; + + ${e ? "#define DOUBLE_PRECISION_REQUIRES_OBFUSCATION" : ""} + + #ifdef DOUBLE_PRECISION_REQUIRES_OBFUSCATION + + vec3 dpPlusFrc(vec3 a, vec3 b) { + return mix(a, a + b, vec3(notEqual(b, vec3(0)))); + } + + vec3 dpMinusFrc(vec3 a, vec3 b) { + return mix(vec3(0), a - b, vec3(notEqual(a, b))); + } + + vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) { + vec3 t1 = dpPlusFrc(hiA, hiB); + vec3 e = dpMinusFrc(t1, hiA); + vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB; + return t1 + t2; + } + + #else + + vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) { + vec3 t1 = hiA + hiB; + vec3 e = t1 - hiA; + vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB; + return t1 + t2; + } + + #endif + + const float MAX_RGBA_FLOAT = + 255.0 / 256.0 + + 255.0 / 256.0 / 256.0 + + 255.0 / 256.0 / 256.0 / 256.0 + + 255.0 / 256.0 / 256.0 / 256.0 / 256.0; + + const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0); + + vec4 float2rgba(const float value) { + // Make sure value is in the domain we can represent + float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT); + + // Decompose value in 32bit fixed point parts represented as + // uint8 rgba components. Decomposition uses the fractional part after multiplying + // by a power of 256 (this removes the bits that are represented in the previous + // component) and then converts the fractional part to 8bits. + vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0); + + // Convert uint8 values (from 0 to 255) to floating point representation for + // the shader + const float toU8AsFloat = 1.0 / 255.0; + + return fixedPointU8 * toU8AsFloat; + } + + void main() { + vec3 val = dpAdd(u_highA, u_lowA, -u_highB, -u_lowB); + + v_color = float2rgba(val.z / 25.0); + + gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0); + } + `, r = ` + precision highp float; + + varying vec4 v_color; + + void main() { + gl_FragColor = v_color; + } + `; + return t.programCache.acquire(i, r, /* @__PURE__ */ new Map([["position", 0]])); +} +var Bx; +(function(t) { + t[t.Color = 0] = "Color", t[t.Alpha = 1] = "Alpha", t[t.FrontFace = 2] = "FrontFace", t[t.NONE = 3] = "NONE", t[t.COUNT = 4] = "COUNT"; +})(Bx || (Bx = {})); +const aar = Mor(gn.SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE_MINUS_SRC_ALPHA), lar = eDt(gn.ONE, gn.ONE), uDt = eDt(gn.ZERO, gn.ONE_MINUS_SRC_ALPHA); +function uar(t) { + return t === Bx.FrontFace ? null : t === Bx.Alpha ? uDt : lar; +} +const car = 5e5, har = { factor: -1, units: -2 }; +function dar(t) { + return t ? har : null; +} +function par(t, e = Ll.LESS) { + return t === Bx.NONE || t === Bx.FrontFace ? e : Ll.LEQUAL; +} +var Unt, znt, tDe = {}, far = { get exports() { + return tDe; +}, set exports(t) { + tDe = t; +} }; +Unt = far, (znt = function() { + var t = function(I) { + window.console && window.console.log && window.console.log(I); + }, e = function(I) { + window.console && window.console.error ? window.console.error(I) : t(I); + }, i = { enable: { 1: { 0: !0 } }, disable: { 1: { 0: !0 } }, getParameter: { 1: { 0: !0 } }, drawArrays: { 3: { 0: !0 } }, drawElements: { 4: { 0: !0, 2: !0 } }, createShader: { 1: { 0: !0 } }, getShaderParameter: { 2: { 1: !0 } }, getProgramParameter: { 2: { 1: !0 } }, getShaderPrecisionFormat: { 2: { 0: !0, 1: !0 } }, getVertexAttrib: { 2: { 1: !0 } }, vertexAttribPointer: { 6: { 2: !0 } }, bindTexture: { 2: { 0: !0 } }, activeTexture: { 1: { 0: !0 } }, getTexParameter: { 2: { 0: !0, 1: !0 } }, texParameterf: { 3: { 0: !0, 1: !0 } }, texParameteri: { 3: { 0: !0, 1: !0, 2: !0 } }, texImage2D: { 9: { 0: !0, 2: !0, 6: !0, 7: !0 }, 6: { 0: !0, 2: !0, 3: !0, 4: !0 } }, texSubImage2D: { 9: { 0: !0, 6: !0, 7: !0 }, 7: { 0: !0, 4: !0, 5: !0 } }, copyTexImage2D: { 8: { 0: !0, 2: !0 } }, copyTexSubImage2D: { 8: { 0: !0 } }, generateMipmap: { 1: { 0: !0 } }, compressedTexImage2D: { 7: { 0: !0, 2: !0 } }, compressedTexSubImage2D: { 8: { 0: !0, 6: !0 } }, bindBuffer: { 2: { 0: !0 } }, bufferData: { 3: { 0: !0, 2: !0 } }, bufferSubData: { 3: { 0: !0 } }, getBufferParameter: { 2: { 0: !0, 1: !0 } }, pixelStorei: { 2: { 0: !0, 1: !0 } }, readPixels: { 7: { 4: !0, 5: !0 } }, bindRenderbuffer: { 2: { 0: !0 } }, bindFramebuffer: { 2: { 0: !0 } }, checkFramebufferStatus: { 1: { 0: !0 } }, framebufferRenderbuffer: { 4: { 0: !0, 1: !0, 2: !0 } }, framebufferTexture2D: { 5: { 0: !0, 1: !0, 2: !0 } }, getFramebufferAttachmentParameter: { 3: { 0: !0, 1: !0, 2: !0 } }, getRenderbufferParameter: { 2: { 0: !0, 1: !0 } }, renderbufferStorage: { 4: { 0: !0, 1: !0 } }, clear: { 1: { 0: { enumBitwiseOr: ["COLOR_BUFFER_BIT", "DEPTH_BUFFER_BIT", "STENCIL_BUFFER_BIT"] } } }, depthFunc: { 1: { 0: !0 } }, blendFunc: { 2: { 0: !0, 1: !0 } }, blendFuncSeparate: { 4: { 0: !0, 1: !0, 2: !0, 3: !0 } }, blendEquation: { 1: { 0: !0 } }, blendEquationSeparate: { 2: { 0: !0, 1: !0 } }, stencilFunc: { 3: { 0: !0 } }, stencilFuncSeparate: { 4: { 0: !0, 1: !0 } }, stencilMaskSeparate: { 2: { 0: !0 } }, stencilOp: { 3: { 0: !0, 1: !0, 2: !0 } }, stencilOpSeparate: { 4: { 0: !0, 1: !0, 2: !0, 3: !0 } }, cullFace: { 1: { 0: !0 } }, frontFace: { 1: { 0: !0 } }, drawArraysInstancedANGLE: { 4: { 0: !0 } }, drawElementsInstancedANGLE: { 5: { 0: !0, 2: !0 } }, blendEquationEXT: { 1: { 0: !0 } } }, r = null, n = null; + function s(I) { + if (r == null) + for (var P in r = {}, n = {}, I) + typeof I[P] == "number" && (r[I[P]] = P, n[P] = I[P]); + } + function o() { + if (r == null) + throw "WebGLDebugUtils.init(ctx) not called"; + } + function a(I) { + return o(), r[I] !== void 0; + } + function l(I) { + o(); + var P = r[I]; + return P !== void 0 ? "gl." + P : "/*UNKNOWN WebGL ENUM*/ 0x" + I.toString(16); + } + function c(I, P, F, k) { + var V; + if ((V = i[I]) !== void 0 && (V = V[P]) !== void 0 && V[F]) { + if (typeof V[F] == "object" && V[F].enumBitwiseOr !== void 0) { + for (var j = V[F].enumBitwiseOr, Y = 0, X = [], Q = 0; Q < j.length; ++Q) { + var re = n[j[Q]]; + k & re && (Y |= re, X.push(l(re))); + } + return Y === k ? X.join(" | ") : l(k); + } + return l(k); + } + return k === null ? "null" : k === void 0 ? "undefined" : k.toString(); + } + function h(I, P) { + for (var F = "", k = P.length, V = 0; V < k; ++V) + F += (V == 0 ? "" : ", ") + c(I, k, V, P[V]); + return F; + } + function p(I, P, F) { + I.__defineGetter__(F, function() { + return P[F]; + }), I.__defineSetter__(F, function(k) { + P[F] = k; + }); + } + function y(I, P, F, k) { + k = k || I, s(I), P = P || function(re, he, fe) { + for (var be = "", Se = fe.length, Me = 0; Me < Se; ++Me) + be += (Me == 0 ? "" : ", ") + c(he, Se, Me, fe[Me]); + e("WebGL error " + l(re) + " in " + he + "(" + be + ")"); + }; + var V = {}; + function j(re, he) { + return function() { + F && F(he, arguments); + var fe = re[he].apply(re, arguments), be = k.getError(); + return be != 0 && (V[be] = !0, P(be, he, arguments)), fe; + }; + } + var Y = {}; + for (var X in I) + if (typeof I[X] == "function") + if (X != "getExtension") + Y[X] = j(I, X); + else { + var Q = j(I, X); + Y[X] = function() { + return y(Q.apply(I, arguments), P, F, k); + }; + } + else + p(Y, I, X); + return Y.getError = function() { + for (var re in V) + if (V.hasOwnProperty(re) && V[re]) + return V[re] = !1, re; + return I.NO_ERROR; + }, Y; + } + function v(I) { + var P = I.getParameter(I.MAX_VERTEX_ATTRIBS), F = I.createBuffer(); + I.bindBuffer(I.ARRAY_BUFFER, F); + for (var k = 0; k < P; ++k) + I.disableVertexAttribArray(k), I.vertexAttribPointer(k, 4, I.FLOAT, !1, 0, 0), I.vertexAttrib1f(k, 0); + I.deleteBuffer(F); + var V = I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS); + for (k = 0; k < V; ++k) + I.activeTexture(I.TEXTURE0 + k), I.bindTexture(I.TEXTURE_CUBE_MAP, null), I.bindTexture(I.TEXTURE_2D, null); + for (I.activeTexture(I.TEXTURE0), I.useProgram(null), I.bindBuffer(I.ARRAY_BUFFER, null), I.bindBuffer(I.ELEMENT_ARRAY_BUFFER, null), I.bindFramebuffer(I.FRAMEBUFFER, null), I.bindRenderbuffer(I.RENDERBUFFER, null), I.disable(I.BLEND), I.disable(I.CULL_FACE), I.disable(I.DEPTH_TEST), I.disable(I.DITHER), I.disable(I.SCISSOR_TEST), I.blendColor(0, 0, 0, 0), I.blendEquation(I.FUNC_ADD), I.blendFunc(I.ONE, I.ZERO), I.clearColor(0, 0, 0, 0), I.clearDepth(1), I.clearStencil(-1), I.colorMask(!0, !0, !0, !0), I.cullFace(I.BACK), I.depthFunc(I.LESS), I.depthMask(!0), I.depthRange(0, 1), I.frontFace(I.CCW), I.hint(I.GENERATE_MIPMAP_HINT, I.DONT_CARE), I.lineWidth(1), I.pixelStorei(I.PACK_ALIGNMENT, 4), I.pixelStorei(I.UNPACK_ALIGNMENT, 4), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, !1), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), I.UNPACK_COLORSPACE_CONVERSION_WEBGL && I.pixelStorei(I.UNPACK_COLORSPACE_CONVERSION_WEBGL, I.BROWSER_DEFAULT_WEBGL), I.polygonOffset(0, 0), I.sampleCoverage(1, !1), I.scissor(0, 0, I.canvas.width, I.canvas.height), I.stencilFunc(I.ALWAYS, 0, 4294967295), I.stencilMask(4294967295), I.stencilOp(I.KEEP, I.KEEP, I.KEEP), I.viewport(0, 0, I.canvas.width, I.canvas.height), I.clear(I.COLOR_BUFFER_BIT | I.DEPTH_BUFFER_BIT | I.STENCIL_BUFFER_BIT); I.getError(); ) + ; + } + function x(I) { + var P, F, k = [], V = [], j = {}, Y = 1, X = !1, Q = [], re = 0, he = 0, fe = !1, be = 0, Se = {}; + function Me(et) { + return typeof et == "function" ? et : function(Qe) { + et.handleEvent(Qe); + }; + } + I.getContext = (F = I.getContext, function() { + var et = F.apply(I, arguments); + if (et instanceof WebGLRenderingContext) { + if (et != P) { + if (P) + throw "got different context"; + j = je(P = et); + } + return j; + } + return et; + }); + var ke = function(et) { + k.push(Me(et)); + }, J = function(et) { + V.push(Me(et)); + }; + function ce(et) { + var Qe = et.addEventListener; + et.addEventListener = function(tt, ft, Mt) { + switch (tt) { + case "webglcontextlost": + ke(ft); + break; + case "webglcontextrestored": + J(ft); + break; + default: + Qe.apply(et, arguments); + } + }; + } + function xe() { + for (var et = Object.keys(Se), Qe = 0; Qe < et.length; ++Qe) + delete Se[et]; + } + function Pe() { + ++he, X || re == he && I.loseContext(); + } + function Oe(et, Qe) { + var tt = et[Qe]; + return function() { + if (Pe(), !X) + return tt.apply(et, arguments); + }; + } + function Re() { + for (var et = 0; et < Q.length; ++et) { + var Qe = Q[et]; + Qe instanceof WebGLBuffer ? P.deleteBuffer(Qe) : Qe instanceof WebGLFramebuffer ? P.deleteFramebuffer(Qe) : Qe instanceof WebGLProgram ? P.deleteProgram(Qe) : Qe instanceof WebGLRenderbuffer ? P.deleteRenderbuffer(Qe) : Qe instanceof WebGLShader ? P.deleteShader(Qe) : Qe instanceof WebGLTexture && P.deleteTexture(Qe); + } + } + function Ge(et) { + return { statusMessage: et, preventDefault: function() { + fe = !0; + } }; + } + return ce(I), I.loseContext = function() { + if (!X) { + for (X = !0, re = 0, ++Y; P.getError(); ) + ; + xe(), Se[P.CONTEXT_LOST_WEBGL] = !0; + var et = Ge("context lost"), Qe = k.slice(); + setTimeout(function() { + for (var tt = 0; tt < Qe.length; ++tt) + Qe[tt](et); + be >= 0 && setTimeout(function() { + I.restoreContext(); + }, be); + }, 0); + } + }, I.restoreContext = function() { + X && V.length && setTimeout(function() { + if (!fe) + throw "can not restore. webglcontestlost listener did not call event.preventDefault"; + Re(), v(P), X = !1, he = 0, fe = !1; + for (var et = V.slice(), Qe = Ge("context restored"), tt = 0; tt < et.length; ++tt) + et[tt](Qe); + }, 0); + }, I.loseContextInNCalls = function(et) { + if (X) + throw "You can not ask a lost contet to be lost"; + re = he + et; + }, I.getNumCalls = function() { + return he; + }, I.setRestoreTimeout = function(et) { + be = et; + }, I; + function je(et) { + for (var Qe in et) + typeof et[Qe] == "function" ? j[Qe] = Oe(et, Qe) : p(j, et, Qe); + j.getError = function() { + if (Pe(), !X) + for (; It = P.getError(); ) + Se[It] = !0; + for (var It in Se) + if (Se[It]) + return delete Se[It], It; + return j.NO_ERROR; + }; + for (var tt = ["createBuffer", "createFramebuffer", "createProgram", "createRenderbuffer", "createShader", "createTexture"], ft = 0; ft < tt.length; ++ft) { + var Mt = tt[ft]; + j[Mt] = function(It) { + return function() { + if (Pe(), X) + return null; + var Nt = It.apply(et, arguments); + return Nt.__webglDebugContextLostId__ = Y, Q.push(Nt), Nt; + }; + }(et[Mt]); + } + var kt = ["getActiveAttrib", "getActiveUniform", "getBufferParameter", "getContextAttributes", "getAttachedShaders", "getFramebufferAttachmentParameter", "getParameter", "getProgramParameter", "getProgramInfoLog", "getRenderbufferParameter", "getShaderParameter", "getShaderInfoLog", "getShaderSource", "getTexParameter", "getUniform", "getUniformLocation", "getVertexAttrib"]; + for (ft = 0; ft < kt.length; ++ft) + Mt = kt[ft], j[Mt] = function(It) { + return function() { + return Pe(), X ? null : It.apply(et, arguments); + }; + }(j[Mt]); + var Tt = ["isBuffer", "isEnabled", "isFramebuffer", "isProgram", "isRenderbuffer", "isShader", "isTexture"]; + for (ft = 0; ft < Tt.length; ++ft) + Mt = Tt[ft], j[Mt] = function(It) { + return function() { + return Pe(), !X && It.apply(et, arguments); + }; + }(j[Mt]); + return j.checkFramebufferStatus = function(It) { + return function() { + return Pe(), X ? j.FRAMEBUFFER_UNSUPPORTED : It.apply(et, arguments); + }; + }(j.checkFramebufferStatus), j.getAttribLocation = function(It) { + return function() { + return Pe(), X ? -1 : It.apply(et, arguments); + }; + }(j.getAttribLocation), j.getVertexAttribOffset = function(It) { + return function() { + return Pe(), X ? 0 : It.apply(et, arguments); + }; + }(j.getVertexAttribOffset), j.isContextLost = function() { + return X; + }, j; + } + } + return { init: s, mightBeEnum: a, glEnumToString: l, glFunctionArgToString: c, glFunctionArgsToString: h, makeDebugContext: y, makeLostContextSimulatingCanvas: x, resetToInitialState: v }; +}()) !== void 0 && (Unt.exports = znt); +let mar = class extends sre { + constructor(e) { + if (super(), this._rctx = e, !e.gl) + return; + if (e.type === go.WEBGL1) + return void (this._result = !(!e.capabilities.textureFloat?.textureFloat || !e.capabilities.colorBufferFloat?.textureFloat)); + if (!(e.capabilities.textureFloat?.textureFloat && e.capabilities.colorBufferFloat?.textureFloat && e.capabilities.colorBufferFloat?.floatBlend)) + return; + const i = ` + precision highp float; + attribute vec2 a_pos; + + void main() { + gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0); + } + `, r = ` + precision highp float; + + void main() { + gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5); + } + `; + this._program = e.programCache.acquire(i, r, /* @__PURE__ */ new Map([["a_pos", 0]])); + } + _test(e) { + const i = this._rctx, r = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.FLOAT, internalFormat: Vs.RGBA32F, samplingMode: _n.NEAREST, width: 1, height: 1 }), n = Qo.createVertex(i, Vo.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), s = new Ac(i, /* @__PURE__ */ new Map([["a_pos", 0]]), { geometry: [new ea("a_pos", 2, Fi.UNSIGNED_SHORT, 0, 4)] }, { geometry: n }); + i.useProgram(e); + const o = i.getBoundFramebufferObject(), { x: a, y: l, width: c, height: h } = i.getViewport(); + i.bindFramebuffer(r), i.setViewport(0, 0, 1, 1), i.bindVAO(s), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4); + const p = Lve({ blending: uDt }); + i.setPipelineState(p), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4), tDe.init(i); + const y = i.gl.getError(); + return i.setViewport(a, l, c, h), i.bindFramebuffer(o), s.dispose(!1), n.dispose(), r.dispose(), y !== 1282 || (console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."), !1); + } +}, gar = class extends sre { + constructor(e) { + super(), this._rctx = e; + const i = ` + precision highp float; + attribute vec2 a_pos; + uniform highp sampler2D u_texture; + varying vec4 v_color; + + float getBit(in float bitset, in int bitIndex) { + float offset = pow(2.0, float(bitIndex)); + return mod(floor(bitset / offset), 2.0); + } + + void main() { + vec4 value = texture2D(u_texture, vec2(0.0)); + float bit = getBit(value.x * 255.0, 1); + + v_color = bit * vec4(1.0); + gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0); + } + `, r = ` + precision highp float; + varying vec4 v_color; + + void main() { + gl_FragColor = v_color; + } + `; + this._program = e.programCache.acquire(i, r, /* @__PURE__ */ new Map([["a_pos", 0]])); + } + _test(e) { + const i = this._rctx, r = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }), n = new Uint8Array(4), s = Qo.createVertex(i, Vo.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), o = new Ac(i, /* @__PURE__ */ new Map([["a_position", 0]]), { geometry: [new ea("a_position", 2, Fi.SHORT, 0, 4)] }, { geometry: s }); + i.useProgram(e); + const a = new Ts(i, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }, new Uint8Array([2, 255, 0, 0])); + e.setUniform1i("u_texture", 0), i.bindTexture(a, 0); + const l = i.getBoundFramebufferObject(); + i.bindFramebuffer(r), i.useProgram(e); + const { x: c, y: h, width: p, height: y } = i.getViewport(); + i.setViewport(0, 0, 1, 1), i.bindVAO(o), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4), i.setViewport(c, h, p, y), r.readPixels(0, 0, 1, 1, cn.RGBA, rs.UNSIGNED_BYTE, n), o.dispose(!1), s.dispose(), r.dispose(); + const v = n[0] !== 255 || n[1] !== 255 || n[2] !== 255 || n[3] !== 255; + return v && Ei.getLogger("esri.views.webgl.testSamplerPrecision").warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${n[0]}.${n[1]}.${n[2]}.${n[3]}]`), i.bindFramebuffer(l), v; + } +}, yar = class extends sre { + constructor(e) { + super(), this._rctx = e, this._image = new Image(), this._image.src = "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A", this._image.width = 5, this._image.height = 5, this._image.decode(); + const i = ` + precision highp float; + + attribute vec2 a_pos; + varying vec2 v_uv; + + void main() { + v_uv = a_pos; + gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0); + } + `, r = ` + precision highp float; + + varying vec2 v_uv; + uniform sampler2D u_texture; + + void main() { + gl_FragColor = texture2D(u_texture, v_uv); + } + `; + this._program = e.programCache.acquire(i, r, /* @__PURE__ */ new Map([["a_pos", 0]])); + } + dispose() { + super.dispose(), this._image.src = ""; + } + _test(e) { + const i = this._rctx; + if (!i.gl) + return e.dispose(), !0; + const r = new cd(i, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }), n = Qo.createVertex(i, Vo.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), s = new Ac(i, /* @__PURE__ */ new Map([["a_pos", 0]]), zMt, { geometry: n }), o = new Ts(i, { dataType: rs.UNSIGNED_BYTE, pixelFormat: cn.RGBA, preMultiplyAlpha: !1, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR }, this._image); + i.useProgram(e), i.bindTexture(o, 0), e.setUniform1i("u_texture", 0); + const a = i.getBoundFramebufferObject(), { x: l, y: c, width: h, height: p } = i.getViewport(); + i.bindFramebuffer(r), i.setViewport(0, 0, 1, 1), i.setClearColor(0, 0, 0, 0), i.setBlendingEnabled(!1), i.clearSafe(NE.COLOR_BUFFER_BIT), i.bindVAO(s), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4); + const y = new Uint8Array(4); + return r.readPixels(0, 0, 1, 1, cn.RGBA, rs.UNSIGNED_BYTE, y), s.dispose(!1), n.dispose(), r.dispose(), o.dispose(), i.setViewport(l, c, h, p), i.bindFramebuffer(a), y[0] !== 255; + } +}, _ar = class { + constructor(e) { + this.rctx = e, this.floatBufferBlend = new mar(e), this.svgPremultipliesAlpha = new yar(e), this.doublePrecisionRequiresObfuscation = new oar(e), this.ignoresSamplerPrecision = new gar(e), this.drawArraysRequiresIndicesTypeReset = new rar(e); + } + dispose() { + this.ignoresSamplerPrecision.dispose(), this.doublePrecisionRequiresObfuscation.dispose(), this.svgPremultipliesAlpha.dispose(), this.floatBufferBlend.dispose(), this.drawArraysRequiresIndicesTypeReset.dispose(); + } +}; +function bar(t, e) { + if (e.disjointTimerQuery) + return null; + if (WI(t)) + return { drawBuffers: t.drawBuffers.bind(t), MAX_DRAW_BUFFERS: t.MAX_DRAW_BUFFERS, MAX_COLOR_ATTACHMENTS: t.MAX_COLOR_ATTACHMENTS }; + if (e.drawBuffers) + return null; + const i = t.getExtension("WEBGL_draw_buffers"); + return i ? { drawBuffers: i.drawBuffersWEBGL.bind(i), MAX_DRAW_BUFFERS: i.MAX_DRAW_BUFFERS_WEBGL, MAX_COLOR_ATTACHMENTS: i.MAX_COLOR_ATTACHMENTS_WEBGL } : null; +} +function war(t) { + if (WI(t)) + return t; + const e = t.getExtension("ANGLE_instanced_arrays"); + return e ? { drawArraysInstanced: e.drawArraysInstancedANGLE.bind(e), drawElementsInstanced: e.drawElementsInstancedANGLE.bind(e), vertexAttribDivisor: e.vertexAttribDivisorANGLE.bind(e) } : null; +} +function xar(t, e) { + if (e.compressedTextureETC) + return null; + const i = t.getExtension("WEBGL_compressed_texture_etc"); + return i ? { COMPRESSED_R11_EAC: i.COMPRESSED_R11_EAC, COMPRESSED_SIGNED_R11_EAC: i.COMPRESSED_SIGNED_R11_EAC, COMPRESSED_RG11_EAC: i.COMPRESSED_RG11_EAC, COMPRESSED_SIGNED_RG11_EAC: i.COMPRESSED_SIGNED_RG11_EAC, COMPRESSED_RGB8_ETC2: i.COMPRESSED_RGB8_ETC2, COMPRESSED_SRGB8_ETC2: i.COMPRESSED_SRGB8_ETC2, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, COMPRESSED_RGBA8_ETC2_EAC: i.COMPRESSED_RGBA8_ETC2_EAC, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC } : null; +} +function Sar(t, e) { + if (e.compressedTextureS3TC) + return null; + const i = t.getExtension("WEBGL_compressed_texture_s3tc"); + return i ? { COMPRESSED_RGB_S3TC_DXT1: i.COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1: i.COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3: i.COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5: i.COMPRESSED_RGBA_S3TC_DXT5_EXT } : null; +} +function Car(t, e) { + if (WI(t)) + return { MIN: t.MIN, MAX: t.MAX }; + if (e.blendMinMax) + return null; + { + const i = t.getExtension("EXT_blend_minmax"); + return i ? { MIN: i.MIN_EXT, MAX: i.MAX_EXT } : null; + } +} +function Tar(t, e) { + if (e.textureFilterAnisotropic) + return null; + const i = t.getExtension("EXT_texture_filter_anisotropic") || t.getExtension("MOZ_EXT_texture_filter_anisotropic") || t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); + return i ? { MAX_TEXTURE_MAX_ANISOTROPY: i.MAX_TEXTURE_MAX_ANISOTROPY_EXT, TEXTURE_MAX_ANISOTROPY: i.TEXTURE_MAX_ANISOTROPY_EXT } : null; +} +function Ear(t, e) { + if (WI(t)) + return { textureFloat: !0, textureFloatLinear: !e.textureFloatLinear && !!t.getExtension("OES_texture_float_linear"), textureHalfFloat: !0, textureHalfFloatLinear: !0, HALF_FLOAT: t.HALF_FLOAT, R16F: t.R16F, RG16F: t.RG16F, RGBA16F: t.RGBA16F, R32F: t.R32F, RG32F: t.RG32F, RGBA32F: t.RGBA32F, R11F_G11F_B10F: t.R11F_G11F_B10F, RGB16F: t.RGB16F }; + if (t instanceof WebGLRenderingContext) { + const i = !e.textureHalfFloat && t.getExtension("OES_texture_half_float"); + return { textureFloat: !e.textureFloat && !!t.getExtension("OES_texture_float"), textureFloatLinear: !e.textureFloatLinear && !!t.getExtension("OES_texture_float_linear"), textureHalfFloat: !!i, textureHalfFloatLinear: !e.textureHalfFloatLinear && !!t.getExtension("OES_texture_half_float_linear"), HALF_FLOAT: i ? i.HALF_FLOAT_OES : void 0 }; + } + return null; +} +function Iar(t, e) { + if (WI(t)) { + const i = !e.colorBufferHalfFloat && t.getExtension("EXT_color_buffer_half_float") || !e.colorBufferFloat && t.getExtension("EXT_color_buffer_float"), r = !e.colorBufferFloat && t.getExtension("EXT_color_buffer_float"), n = !e.floatBlend && !e.colorBufferFloat && t.getExtension("EXT_float_blend"); + return i || r || n ? { textureFloat: !!r, textureHalfFloat: !!i, floatBlend: !!n, R16F: t.R16F, RG16F: t.RG16F, RGBA16F: t.RGBA16F, R32F: t.R32F, RG32F: t.RG32F, RGBA32F: t.RGBA32F, R11F_G11F_B10F: t.R11F_G11F_B10F, RGB16F: t.RGB16F } : null; + } + if (t instanceof WebGLRenderingContext) { + const i = !e.colorBufferHalfFloat && t.getExtension("EXT_color_buffer_half_float"), r = !e.colorBufferFloat && t.getExtension("WEBGL_color_buffer_float"), n = !e.floatBlend && !e.colorBufferFloat && t.getExtension("EXT_float_blend"); + return i || r || n ? { textureFloat: !!r, textureHalfFloat: !!i, floatBlend: !!n, RGBA16F: i ? i.RGBA16F_EXT : void 0, RGB16F: i ? i.RGB16F_EXT : void 0, RGBA32F: r ? r.RGBA32F_EXT : void 0 } : null; + } + return null; +} +function Sq(t, e, i, r, n) { + if (r && WI(t)) + return !0; + if (e[i]) + return !1; + for (const s of n) + if (t.getExtension(s)) + return !0; + return !1; +} +function Aar(t, e) { + if (!WI(t) || e.textureNorm16) + return null; + const i = t.getExtension("EXT_texture_norm16"); + return i ? { R16: i.R16_EXT, RG16: i.RG16_EXT, RGB16: i.RGB16_EXT, RGBA16: i.RGBA16_EXT, R16_SNORM: i.R16_SNORM_EXT, RG16_SNORM: i.RG16_SNORM_EXT, RGB16_SNORM: i.RGB16_SNORM_EXT, RGBA16_SNORM: i.RGBA16_SNORM_EXT } : null; +} +function Par(t, e) { + const i = e.loseContext && t.getExtension("WEBGL_lose_context"); + return i ? { loseRenderingContext: () => i.loseContext() } : null; +} +function Oar(t, e) { + if (WI(t)) + return { createVertexArray: t.createVertexArray.bind(t), deleteVertexArray: t.deleteVertexArray.bind(t), bindVertexArray: t.bindVertexArray.bind(t) }; + if (e.vao) + return null; + const i = t.getExtension("OES_vertex_array_object") || t.getExtension("MOZ_OES_vertex_array_object") || t.getExtension("WEBKIT_OES_vertex_array_object"); + return i ? { createVertexArray: i.createVertexArrayOES.bind(i), deleteVertexArray: i.deleteVertexArrayOES.bind(i), bindVertexArray: i.bindVertexArrayOES.bind(i) } : null; +} +let Rar = class { + constructor(e, i) { + this._gl = e, this._instancing = null, this._vertexArrayObject = null, this._compressedTextureETC = null, this._compressedTextureS3TC = null, this._textureFilterAnisotropic = null, this._textureFloat = null, this._colorBufferFloat = null, this._minMaxBlending = null, this._loseContext = null, this._drawBuffers = null, this._textureNorm16 = null, this._depthTexture = null, this._standardDerivatives = null, this._shaderTextureLOD = null, this._fragDepth = null, this._textureFloatLinear = null, this._disabledExtensions = i.disabledExtensions || {}, this._debugWebGLExtensions = i.debugWebGLExtensions || {}; + } + get drawBuffers() { + return this._drawBuffers || (this._drawBuffers = bar(this._gl, this._disabledExtensions)), this._drawBuffers; + } + get instancing() { + return this._instancing || (this._instancing = war(this._gl)), this._instancing; + } + get vao() { + return this._vertexArrayObject || (this._vertexArrayObject = Oar(this._gl, this._disabledExtensions)), this._vertexArrayObject; + } + get compressedTextureETC() { + return this._compressedTextureETC || (this._compressedTextureETC = xar(this._gl, this._disabledExtensions)), this._compressedTextureETC; + } + get compressedTextureS3TC() { + return this._compressedTextureS3TC || (this._compressedTextureS3TC = Sar(this._gl, this._disabledExtensions)), this._compressedTextureS3TC; + } + get textureFilterAnisotropic() { + return this._textureFilterAnisotropic || (this._textureFilterAnisotropic = Tar(this._gl, this._disabledExtensions)), this._textureFilterAnisotropic; + } + get disjointTimerQuery() { + return this._disjointTimerQuery || (this._disjointTimerQuery = QMt(this._gl, this._disabledExtensions)), this._disjointTimerQuery; + } + get textureFloat() { + return this._textureFloat || (this._textureFloat = Ear(this._gl, this._disabledExtensions)), this._textureFloat; + } + get colorBufferFloat() { + return this._colorBufferFloat || (this._colorBufferFloat = Iar(this._gl, this._disabledExtensions)), this._colorBufferFloat; + } + get blendMinMax() { + return this._minMaxBlending || (this._minMaxBlending = Car(this._gl, this._disabledExtensions)), this._minMaxBlending; + } + get depthTexture() { + return this._depthTexture === null && (this._depthTexture = Sq(this._gl, this._disabledExtensions, "depthTexture", !0, ["WEBGL_depth_texture", "MOZ_WEBGL_depth_texture", "WEBKIT_WEBGL_depth_texture"])), this._depthTexture; + } + get standardDerivatives() { + return this._standardDerivatives === null && (this._standardDerivatives = Sq(this._gl, this._disabledExtensions, "standardDerivatives", !0, ["OES_standard_derivatives"])), this._standardDerivatives; + } + get shaderTextureLOD() { + return this._shaderTextureLOD === null && (this._shaderTextureLOD = Sq(this._gl, this._disabledExtensions, "shaderTextureLOD", !0, ["EXT_shader_texture_lod"])), this._shaderTextureLOD; + } + get fragDepth() { + return this._fragDepth === null && (this._fragDepth = Sq(this._gl, this._disabledExtensions, "fragDepth", !0, ["EXT_frag_depth"])), this._fragDepth; + } + get loseContext() { + return this._loseContext || (this._loseContext = Par(this._gl, this._debugWebGLExtensions)), this._loseContext; + } + get textureNorm16() { + return this._textureNorm16 || (this._textureNorm16 = Aar(this._gl, this._disabledExtensions)), this._textureNorm16; + } + get textureFloatLinear() { + return this._textureFloatLinear === null && (this._textureFloatLinear = Sq(this._gl, this._disabledExtensions, "textureFloatLinear", !1, ["OES_texture_float_linear"])), this._textureFloatLinear; + } + enable(e) { + return this[e]; + } +}, cDt = class { + constructor(e, i) { + this.gl = e, this.instanceCounter = new Ror(), this.programCache = new IMt(this), this._state = new knt(), this._numOfDrawCalls = 0, this._numOfTriangles = 0, this.type = WI(e) ? go.WEBGL2 : go.WEBGL1, this._loadExtensions(), this.configure(i); + } + get gl2() { + return this.type === go.WEBGL1 ? null : this.gl; + } + configure(e) { + this._capabilities = new Rar(this.gl, e), this._parameters = this._loadParameters(e); + const i = this.gl.getParameter(this.gl.VIEWPORT); + this._state = new knt(), this._state.viewport = { x: i[0], y: i[1], width: i[2], height: i[3] }, this._stateTracker = new tar({ setBlending: (r) => { + if (r) { + this.setBlendingEnabled(!0), this.setBlendEquationSeparate(r.opRgb, r.opAlpha), this.setBlendFunctionSeparate(r.srcRgb, r.dstRgb, r.srcAlpha, r.dstAlpha); + const n = r.color; + this.setBlendColor(n.r, n.g, n.b, n.a); + } else + this.setBlendingEnabled(!1); + }, setCulling: (r) => { + r ? (this.setFaceCullingEnabled(!0), this.setCullFace(r.face), this.setFrontFace(r.mode)) : this.setFaceCullingEnabled(!1); + }, setPolygonOffset: (r) => { + r ? (this.setPolygonOffsetFillEnabled(!0), this.setPolygonOffset(r.factor, r.units)) : this.setPolygonOffsetFillEnabled(!1); + }, setDepthTest: (r) => { + r ? (this.setDepthTestEnabled(!0), this.setDepthFunction(r.func)) : this.setDepthTestEnabled(!1); + }, setStencilTest: (r) => { + if (r) { + this.setStencilTestEnabled(!0); + const n = r.function; + this.setStencilFunction(n.func, n.ref, n.mask); + const s = r.operation; + this.setStencilOp(s.fail, s.zFail, s.zPass); + } else + this.setStencilTestEnabled(!1); + }, setDepthWrite: (r) => { + r ? (this.setDepthWriteEnabled(!0), this.setDepthRange(r.zNear, r.zFar)) : this.setDepthWriteEnabled(!1); + }, setColorWrite: (r) => { + r ? this.setColorMask(r.r, r.g, r.b, r.a) : this.setColorMask(!1, !1, !1, !1); + }, setStencilWrite: (r) => { + r ? this.setStencilWriteMask(r.mask) : this.setStencilWriteMask(0); + } }), this.enforceState(), Ua(this._driverTest), this._driverTest = new _ar(this); + } + dispose() { + Ua(this._driverTest), this.programCache.dispose(), this.bindVAO(null), this.unbindBuffer(ao.ARRAY_BUFFER), this.unbindBuffer(ao.ELEMENT_ARRAY_BUFFER), this.type === go.WEBGL2 && (this.unbindBuffer(ao.UNIFORM_BUFFER), this._state.uniformBufferBindingPoints.length = 0, this.unbindBuffer(ao.PIXEL_PACK_BUFFER), this.unbindBuffer(ao.PIXEL_UNPACK_BUFFER), this.unbindBuffer(ao.COPY_READ_BUFFER), this.unbindBuffer(ao.COPY_WRITE_BUFFER)), this._state.textureUnitMap.length = 0, db() && console.log(this.instanceCounter.resourceInformation); + } + get driverTest() { + return this._driverTest; + } + get contextAttributes() { + return this.gl.getContextAttributes(); + } + get parameters() { + return this._parameters; + } + setPipelineState(e) { + this._stateTracker.setPipeline(e); + } + setBlendingEnabled(e) { + this._state.blend !== e && (e === !0 ? this.gl.enable(this.gl.BLEND) : this.gl.disable(this.gl.BLEND), this._state.blend = e, this._stateTracker.invalidateBlending()); + } + externalProgramUpdate() { + this._state.program?.stop(), this._state.program = null; + } + externalTextureUnitUpdate(e, i) { + for (let r = 0; r < e.length; ++r) + this._state.textureUnitMap[e[r]] = null; + i >= 0 && (this._state.activeTexture = i); + } + externalVertexArrayObjectUpdate() { + const e = this.capabilities.vao; + e && (e.bindVertexArray(null), this._state.vertexArrayObject = null), this._state.vertexBuffer = null, this._state.indexBuffer = null; + } + externalVertexBufferUpdate() { + this._state.vertexBuffer = null; + } + externalIndexBufferUpdate() { + this._state.indexBuffer = null; + } + setBlendColor(e, i, r, n) { + e === this._state.blendColor.r && i === this._state.blendColor.g && r === this._state.blendColor.b && n === this._state.blendColor.a || (this.gl.blendColor(e, i, r, n), this._state.blendColor.r = e, this._state.blendColor.g = i, this._state.blendColor.b = r, this._state.blendColor.a = n, this._stateTracker.invalidateBlending()); + } + setBlendFunction(e, i) { + e === this._state.blendFunction.srcRGB && i === this._state.blendFunction.dstRGB || (this.gl.blendFunc(e, i), this._state.blendFunction.srcRGB = e, this._state.blendFunction.srcAlpha = e, this._state.blendFunction.dstRGB = i, this._state.blendFunction.dstAlpha = i, this._stateTracker.invalidateBlending()); + } + setBlendFunctionSeparate(e, i, r, n) { + this._state.blendFunction.srcRGB === e && this._state.blendFunction.srcAlpha === r && this._state.blendFunction.dstRGB === i && this._state.blendFunction.dstAlpha === n || (this.gl.blendFuncSeparate(e, i, r, n), this._state.blendFunction.srcRGB = e, this._state.blendFunction.srcAlpha = r, this._state.blendFunction.dstRGB = i, this._state.blendFunction.dstAlpha = n, this._stateTracker.invalidateBlending()); + } + setBlendEquation(e) { + this._state.blendEquation.mode !== e && (this.gl.blendEquation(e), this._state.blendEquation.mode = e, this._state.blendEquation.modeAlpha = e, this._stateTracker.invalidateBlending()); + } + setBlendEquationSeparate(e, i) { + this._state.blendEquation.mode === e && this._state.blendEquation.modeAlpha === i || (this.gl.blendEquationSeparate(e, i), this._state.blendEquation.mode = e, this._state.blendEquation.modeAlpha = i, this._stateTracker.invalidateBlending()); + } + setColorMask(e, i, r, n) { + this._state.colorMask.r === e && this._state.colorMask.g === i && this._state.colorMask.b === r && this._state.colorMask.a === n || (this.gl.colorMask(e, i, r, n), this._state.colorMask.r = e, this._state.colorMask.g = i, this._state.colorMask.b = r, this._state.colorMask.a = n, this._stateTracker.invalidateColorWrite()); + } + setClearColor(e, i, r, n) { + this._state.clearColor.r === e && this._state.clearColor.g === i && this._state.clearColor.b === r && this._state.clearColor.a === n || (this.gl.clearColor(e, i, r, n), this._state.clearColor.r = e, this._state.clearColor.g = i, this._state.clearColor.b = r, this._state.clearColor.a = n); + } + setFaceCullingEnabled(e) { + this._state.faceCulling !== e && (e === !0 ? this.gl.enable(this.gl.CULL_FACE) : this.gl.disable(this.gl.CULL_FACE), this._state.faceCulling = e, this._stateTracker.invalidateCulling()); + } + setPolygonOffsetFillEnabled(e) { + this._state.polygonOffsetFill !== e && (e === !0 ? this.gl.enable(this.gl.POLYGON_OFFSET_FILL) : this.gl.disable(this.gl.POLYGON_OFFSET_FILL), this._state.polygonOffsetFill = e, this._stateTracker.invalidatePolygonOffset()); + } + setPolygonOffset(e, i) { + this._state.polygonOffset[0] === e && this._state.polygonOffset[1] === i || (this._state.polygonOffset[0] = e, this._state.polygonOffset[1] = i, this.gl.polygonOffset(e, i), this._stateTracker.invalidatePolygonOffset()); + } + setCullFace(e) { + this._state.cullFace !== e && (this.gl.cullFace(e), this._state.cullFace = e, this._stateTracker.invalidateCulling()); + } + setFrontFace(e) { + this._state.frontFace !== e && (this.gl.frontFace(e), this._state.frontFace = e, this._stateTracker.invalidateCulling()); + } + setScissorTestEnabled(e) { + this._state.scissorTest !== e && (e === !0 ? this.gl.enable(this.gl.SCISSOR_TEST) : this.gl.disable(this.gl.SCISSOR_TEST), this._state.scissorTest = e); + } + setScissorRect(e, i, r, n) { + this._state.scissorRect.x === e && this._state.scissorRect.y === i && this._state.scissorRect.width === r && this._state.scissorRect.height === n || (this.gl.scissor(e, i, r, n), this._state.scissorRect.x = e, this._state.scissorRect.y = i, this._state.scissorRect.width = r, this._state.scissorRect.height = n); + } + setDepthTestEnabled(e) { + this._state.depthTest !== e && (e === !0 ? this.gl.enable(this.gl.DEPTH_TEST) : this.gl.disable(this.gl.DEPTH_TEST), this._state.depthTest = e, this._stateTracker.invalidateDepthTest()); + } + setClearDepth(e) { + this._state.clearDepth !== e && (this.gl.clearDepth(e), this._state.clearDepth = e); + } + setDepthFunction(e) { + this._state.depthFunction !== e && (this.gl.depthFunc(e), this._state.depthFunction = e, this._stateTracker.invalidateDepthTest()); + } + setDepthWriteEnabled(e) { + this._state.depthWrite !== e && (this.gl.depthMask(e), this._state.depthWrite = e, this._stateTracker.invalidateDepthWrite()); + } + setDepthRange(e, i) { + this._state.depthRange.zNear === e && this._state.depthRange.zFar === i || (this.gl.depthRange(e, i), this._state.depthRange.zNear = e, this._state.depthRange.zFar = i, this._stateTracker.invalidateDepthWrite()); + } + setStencilTestEnabled(e) { + this._state.stencilTest !== e && (e === !0 ? this.gl.enable(this.gl.STENCIL_TEST) : this.gl.disable(this.gl.STENCIL_TEST), this._state.stencilTest = e, this._stateTracker.invalidateStencilTest()); + } + setClearStencil(e) { + e !== this._state.clearStencil && (this.gl.clearStencil(e), this._state.clearStencil = e); + } + setStencilFunction(e, i, r) { + this._state.stencilFunction.func === e && this._state.stencilFunction.ref === i && this._state.stencilFunction.mask === r || (this.gl.stencilFunc(e, i, r), this._state.stencilFunction.face = ax.FRONT_AND_BACK, this._state.stencilFunction.func = e, this._state.stencilFunction.ref = i, this._state.stencilFunction.mask = r, this._stateTracker.invalidateStencilTest()); + } + setStencilFunctionSeparate(e, i, r, n) { + this._state.stencilFunction.face === e && this._state.stencilFunction.func === i && this._state.stencilFunction.ref === r && this._state.stencilFunction.mask === n || (this.gl.stencilFuncSeparate(e, i, r, n), this._state.stencilFunction.face = e, this._state.stencilFunction.func = i, this._state.stencilFunction.ref = r, this._state.stencilFunction.mask = n, this._stateTracker.invalidateStencilTest()); + } + setStencilWriteMask(e) { + this._state.stencilWriteMask !== e && (this.gl.stencilMask(e), this._state.stencilWriteMask = e, this._stateTracker.invalidateStencilWrite()); + } + setStencilOp(e, i, r) { + this._state.stencilOperation.face === ax.FRONT_AND_BACK && this._state.stencilOperation.fail === e && this._state.stencilOperation.zFail === i && this._state.stencilOperation.zPass === r || (this.gl.stencilOp(e, i, r), this._state.stencilOperation.face = ax.FRONT_AND_BACK, this._state.stencilOperation.fail = e, this._state.stencilOperation.zFail = i, this._state.stencilOperation.zPass = r, this._stateTracker.invalidateStencilTest()); + } + setStencilOpSeparate(e, i, r, n) { + this._state.stencilOperation.face === e && this._state.stencilOperation.fail === i && this._state.stencilOperation.zFail === r && this._state.stencilOperation.zPass === n || (this.gl.stencilOpSeparate(e, i, r, n), this._state.stencilOperation.face = e, this._state.stencilOperation.fail = i, this._state.stencilOperation.zFail = r, this._state.stencilOperation.zPass = n, this._stateTracker.invalidateStencilTest()); + } + setActiveTexture(e, i = !1) { + const r = this._state.activeTexture; + return e >= 0 && (i || e !== this._state.activeTexture) && (this.gl.activeTexture(exe + e), this._state.activeTexture = e), r; + } + clear(e) { + e && this.gl.clear(e); + } + clearSafe(e, i = 255) { + e && (e & NE.COLOR_BUFFER_BIT && this.setColorMask(!0, !0, !0, !0), e & NE.DEPTH_BUFFER_BIT && this.setDepthWriteEnabled(!0), e & NE.STENCIL_BUFFER_BIT && this.setStencilWriteMask(i), this.gl.clear(e)); + } + drawArrays(e, i, r) { + if (db() && (this._numOfDrawCalls++, this._numOfTriangles += Hnt(e, r)), this.gl.drawArrays(e, i, r), db()) { + const n = Drt(this); + n && console.error("drawArrays:", n); + } + } + drawElements(e, i, r, n) { + if (db() && (this._numOfDrawCalls++, this._numOfTriangles += Hnt(e, i)), this.gl.drawElements(e, i, r, n), db()) { + const s = Drt(this); + if (s) { + const o = this.getBoundVAO(), a = o?.indexBuffer, l = o?.vertexBuffers, c = { indexBuffer: a, vertexBuffers: l }, h = { mode: e, count: i, type: r, offset: n }, p = Sa(a, (x) => x.size) ?? 0, y = n + i, v = p < y ? `. Buffer is too small. Attempted to draw index ${y} of ${p}` : ""; + console.error(`drawElements: ${s}${v}`, { args: h, vao: c }); + } + } + } + logInfo() { + db() && console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`); + } + resetInfo() { + db() && (this._numOfDrawCalls = 0, this._numOfTriangles = 0); + } + get capabilities() { + return this._capabilities; + } + setViewport(e, i, r, n) { + r = Math.max(Math.round(r), 1), n = Math.max(Math.round(n), 1); + const s = this._state.viewport; + s.x === e && s.y === i && s.width === r && s.height === n || (s.x = e, s.y = i, s.width = r, s.height = n, this.gl.viewport(e, i, r, n)); + } + getViewport() { + const e = this._state.viewport; + return { x: e.x, y: e.y, width: e.width, height: e.height }; + } + useProgram(e) { + this._state.program !== e && (this._state.program?.stop(), this._state.program = e, this.gl.useProgram(e?.glName ?? null)); + } + bindTexture(e, i, r = !1) { + (i >= this.parameters.maxTextureImageUnits || i < 0) && console.error("Input texture unit is out of range of available units!"); + const n = this._state.textureUnitMap[i]; + return ut(e) || e.glName == null ? (_e(n) && (this.setActiveTexture(i, r), this.gl.bindTexture(n.descriptor.target, null)), this._state.textureUnitMap[i] = null, n) : r || n !== e ? (this.setActiveTexture(i, r), this.gl.bindTexture(e.descriptor.target, e.glName), e.applyChanges(), this._state.textureUnitMap[i] = e, n) : (e.isDirty && (this.setActiveTexture(i, r), e.applyChanges()), n); + } + unbindTexture(e) { + if (!ut(e)) + for (let i = 0; i < this.parameters.maxTextureImageUnits; i++) + this._state.textureUnitMap[i] === e && (this.bindTexture(null, i), this._state.textureUnitMap[i] = null); + } + bindFramebuffer(e, i = !1) { + if (i || this._state.readFramebuffer !== e || this._state.drawFramebuffer !== e) { + if (ut(e)) + return this.gl.bindFramebuffer(nm.FRAMEBUFFER, null), this._state.readFramebuffer = null, void (this._state.drawFramebuffer = null); + e.initializeAndBind(nm.FRAMEBUFFER), this._state.readFramebuffer = e, this._state.drawFramebuffer = e; + } + } + bindFramebufferSeparate(e, i, r = !1) { + const n = i === nm.READ_FRAMEBUFFER, s = n ? this._state.readFramebuffer : this._state.drawFramebuffer; + (r || s !== e) && (ut(e) ? this.gl.bindFramebuffer(i, null) : e.initializeAndBind(i), n ? this._state.readFramebuffer = Gu(e, null) : this._state.drawFramebuffer = Gu(e, null)); + } + blitFramebuffer(e, i, r = 0, n = 0, s = e.width, o = e.height, a = 0, l = 0, c = i.width, h = i.height, p = NE.COLOR_BUFFER_BIT, y = _n.NEAREST) { + this.bindFramebufferSeparate(e, nm.READ_FRAMEBUFFER), this.bindFramebufferSeparate(i, nm.DRAW_FRAMEBUFFER), this.gl.blitFramebuffer(r, n, s, o, a, l, c, h, p, y); + } + bindBuffer(e, i) { + if (e) + switch (i ?? (i = e.bufferType), i) { + case ao.ARRAY_BUFFER: + this._state.vertexBuffer = s_(this.gl, e, i, this._state.vertexBuffer); + break; + case ao.ELEMENT_ARRAY_BUFFER: + this._state.indexBuffer = s_(this.gl, e, i, this._state.indexBuffer); + break; + case ao.UNIFORM_BUFFER: + this._state.uniformBuffer = s_(this.gl, e, i, this._state.uniformBuffer); + break; + case ao.PIXEL_PACK_BUFFER: + this._state.pixelPackBuffer = s_(this.gl, e, i, this._state.pixelPackBuffer); + break; + case ao.PIXEL_UNPACK_BUFFER: + this._state.pixelUnpackBuffer = s_(this.gl, e, i, this._state.pixelUnpackBuffer); + break; + case ao.COPY_READ_BUFFER: + this._state.copyReadBuffer = s_(this.gl, e, i, this._state.copyReadBuffer); + break; + case ao.COPY_WRITE_BUFFER: + this._state.copyWriteBuffer = s_(this.gl, e, i, this._state.copyWriteBuffer); + } + } + bindRenderbuffer(e) { + const i = this.gl; + e || (i.bindRenderbuffer(i.RENDERBUFFER, null), this._state.renderbuffer = null), this._state.renderbuffer !== e && (i.bindRenderbuffer(i.RENDERBUFFER, e.glName), this._state.renderbuffer = e); + } + _getBufferBinding(e, i) { + if (i >= this.parameters.maxUniformBufferBindings || i < 0) + return console.error("Uniform buffer binding point is out of range!"), null; + const r = this._state.uniformBufferBindingPoints; + let n = r[i]; + return ut(n) && (n = { buffer: null, offset: 0, size: 0 }, r[i] = n), n; + } + bindBufferBase(e, i, r) { + const n = this._getBufferBinding(e, i); + ut(n) || n.buffer === r && n.offset === 0 && n.size === 0 || (this.gl.bindBufferBase(e, i, r ? r.glName : null), n.buffer = r, n.offset = 0, n.size = 0); + } + bindBufferRange(e, i, r, n, s) { + const o = this._getBufferBinding(e, i); + if (!ut(o) && !(o.buffer === r && o.offset === n && o.size === s)) { + if (n % this._parameters.uniformBufferOffsetAlignment != 0) + return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment"); + this.gl.bindBufferRange(e, i, r.glName, n, s), o.buffer = r, o.offset = n, o.size = s; + } + } + bindUBO(e, i, r, n) { + ut(i) ? this.bindBufferBase(ao.UNIFORM_BUFFER, e, null) : (db() && (n ?? i.byteLength) > this._parameters.maxUniformBlockSize && console.error("Attempting to bind more data than the maximum uniform block size"), i.initialize(), r !== void 0 && n !== void 0 ? this.bindBufferRange(ao.UNIFORM_BUFFER, e, i.buffer, r, n) : this.bindBufferBase(ao.UNIFORM_BUFFER, e, i.buffer)); + } + unbindUBO(e) { + for (let i = 0, r = this._state.uniformBufferBindingPoints.length; i < r; i++) { + const n = this._state.uniformBufferBindingPoints[i]; + _e(n) && n.buffer === e.buffer && this.bindBufferBase(ao.UNIFORM_BUFFER, i, null); + } + } + unbindBuffer(e) { + switch (e) { + case ao.ARRAY_BUFFER: + this._state.vertexBuffer = s_(this.gl, null, e, this._state.vertexBuffer); + break; + case ao.ELEMENT_ARRAY_BUFFER: + this._state.indexBuffer = s_(this.gl, null, e, this._state.indexBuffer); + break; + case ao.UNIFORM_BUFFER: + this._state.uniformBuffer = s_(this.gl, null, e, this._state.uniformBuffer); + break; + case ao.PIXEL_PACK_BUFFER: + this._state.pixelPackBuffer = s_(this.gl, null, e, this._state.pixelPackBuffer); + break; + case ao.PIXEL_UNPACK_BUFFER: + this._state.pixelUnpackBuffer = s_(this.gl, null, e, this._state.pixelUnpackBuffer); + break; + case ao.COPY_READ_BUFFER: + this._state.copyReadBuffer = s_(this.gl, null, e, this._state.copyReadBuffer); + break; + case ao.COPY_WRITE_BUFFER: + this._state.copyWriteBuffer = s_(this.gl, null, e, this._state.copyWriteBuffer); + } + } + bindVAO(e = null) { + ut(e) ? this._state.vertexArrayObject && (this._state.vertexArrayObject.unbind(), this._state.vertexArrayObject = null) : this._state.vertexArrayObject !== e && (e.bind(), this._state.vertexArrayObject = e); + } + async clientWaitAsync(e = 10) { + const i = this.gl, r = i.fenceSync(V3e.SYNC_GPU_COMMANDS_COMPLETE, 0); + if (!r) + throw new Error("Client wait failed, could not create sync object"); + let n; + this.instanceCounter.increment(Df.Sync, r), i.flush(); + do + await _4(e), n = i.clientWaitSync(r, 0, 0); + while (n === ife.TIMEOUT_EXPIRED); + if (this.instanceCounter.decrement(Df.Sync, r), i.deleteSync(r), n === ife.WAIT_FAILED) + throw new Error("Client wait failed"); + } + getBoundFramebufferObject(e = nm.FRAMEBUFFER) { + return e === nm.READ_FRAMEBUFFER ? this._state.readFramebuffer : this._state.drawFramebuffer; + } + getBoundVAO() { + return this._state.vertexArrayObject; + } + resetState() { + this.useProgram(null), this.bindVAO(null), this.bindFramebuffer(null, !0), this.unbindBuffer(ao.ARRAY_BUFFER), this.unbindBuffer(ao.ELEMENT_ARRAY_BUFFER), this.type === go.WEBGL2 && (this.unbindBuffer(ao.UNIFORM_BUFFER), this._state.uniformBufferBindingPoints.length = 0, this.unbindBuffer(ao.PIXEL_PACK_BUFFER), this.unbindBuffer(ao.PIXEL_UNPACK_BUFFER), this.unbindBuffer(ao.COPY_READ_BUFFER), this.unbindBuffer(ao.COPY_WRITE_BUFFER)); + for (let e = 0; e < this.parameters.maxTextureImageUnits; ++e) + this.bindTexture(null, e); + this.setBlendingEnabled(!1), this.setBlendFunction(gn.ONE, gn.ZERO), this.setBlendEquation(r4.ADD), this.setBlendColor(0, 0, 0, 0), this.setFaceCullingEnabled(!1), this.setCullFace(ax.BACK), this.setFrontFace(qU.CCW), this.setPolygonOffsetFillEnabled(!1), this.setPolygonOffset(0, 0), this.setScissorTestEnabled(!1), this.setScissorRect(0, 0, this.gl.canvas.width, this.gl.canvas.height), this.setDepthTestEnabled(!1), this.setDepthFunction(Ll.LESS), this.setDepthRange(0, 1), this.setStencilTestEnabled(!1), this.setStencilFunction(Ll.ALWAYS, 0, 0), this.setStencilOp(su.KEEP, su.KEEP, su.KEEP), this.setClearColor(0, 0, 0, 0), this.setClearDepth(1), this.setClearStencil(0), this.setColorMask(!0, !0, !0, !0), this.setStencilWriteMask(4294967295), this.setDepthWriteEnabled(!0), this.setViewport(0, 0, this.gl.canvas.width, this.gl.canvas.height); + } + enforceState() { + const e = this.capabilities.vao; + e && e.bindVertexArray(null); + const { gl: i, gl2: r } = this; + for (let s = 0; s < this.parameters.maxVertexAttributes; s++) + i.disableVertexAttribArray(s); + if (this._state.vertexBuffer ? i.bindBuffer(this._state.vertexBuffer.bufferType, this._state.vertexBuffer.glName) : i.bindBuffer(ao.ARRAY_BUFFER, null), this._state.indexBuffer ? i.bindBuffer(this._state.indexBuffer.bufferType, this._state.indexBuffer.glName) : i.bindBuffer(ao.ELEMENT_ARRAY_BUFFER, null), _e(r)) { + this._state.uniformBuffer ? r.bindBuffer(this._state.uniformBuffer.bufferType, this._state.uniformBuffer.glName) : r.bindBuffer(ao.UNIFORM_BUFFER, null); + for (let s = 0; s < this._parameters.maxUniformBufferBindings; s++) { + const o = this._state.uniformBufferBindingPoints[s]; + if (_e(o)) { + const { buffer: a, offset: l, size: c } = o; + a !== null ? l === 0 && c === 0 ? r.bindBufferBase(ao.UNIFORM_BUFFER, s, a.glName) : r.bindBufferRange(ao.UNIFORM_BUFFER, s, a.glName, l, c) : r.bindBufferBase(ao.UNIFORM_BUFFER, s, null); + } + } + this._state.pixelPackBuffer ? r.bindBuffer(this._state.pixelPackBuffer.bufferType, this._state.pixelPackBuffer.glName) : r.bindBuffer(ao.PIXEL_PACK_BUFFER, null), this._state.pixelUnpackBuffer ? r.bindBuffer(this._state.pixelUnpackBuffer.bufferType, this._state.pixelUnpackBuffer.glName) : r.bindBuffer(ao.PIXEL_UNPACK_BUFFER, null), this._state.copyReadBuffer ? r.bindBuffer(this._state.copyReadBuffer.bufferType, this._state.copyReadBuffer.glName) : r.bindBuffer(ao.COPY_READ_BUFFER, null), this._state.copyWriteBuffer ? r.bindBuffer(this._state.copyWriteBuffer.bufferType, this._state.copyWriteBuffer.glName) : r.bindBuffer(ao.COPY_WRITE_BUFFER, null), r.bindFramebuffer(nm.READ_FRAMEBUFFER, null), r.readBuffer(r.BACK), this._state.readFramebuffer && (r.bindFramebuffer(nm.READ_FRAMEBUFFER, this._state.readFramebuffer.glName), r.readBuffer(xv.COLOR_ATTACHMENT0)), r.bindFramebuffer(nm.DRAW_FRAMEBUFFER, this._state.drawFramebuffer?.glName ?? null); + } else + this._state.readFramebuffer = this._state.drawFramebuffer, i.bindFramebuffer(nm.FRAMEBUFFER, this._state.drawFramebuffer?.glName ?? null); + if (e && this._state.vertexArrayObject) { + const s = this._state.vertexArrayObject; + this._state.vertexArrayObject && (this._state.vertexArrayObject.unbind(), this._state.vertexArrayObject = null), this.bindVAO(s); + } + i.useProgram(this._state.program?.glName ?? null), i.blendColor(this._state.blendColor.r, this._state.blendColor.g, this._state.blendColor.b, this._state.blendColor.a), i.bindRenderbuffer(i.RENDERBUFFER, this._state.renderbuffer ? this._state.renderbuffer.glName : null), this._state.blend === !0 ? i.enable(this.gl.BLEND) : i.disable(this.gl.BLEND), i.blendEquationSeparate(this._state.blendEquation.mode, this._state.blendEquation.modeAlpha), i.blendFuncSeparate(this._state.blendFunction.srcRGB, this._state.blendFunction.dstRGB, this._state.blendFunction.srcAlpha, this._state.blendFunction.dstAlpha), i.clearColor(this._state.clearColor.r, this._state.clearColor.g, this._state.clearColor.b, this._state.clearColor.a), i.clearDepth(this._state.clearDepth), i.clearStencil(this._state.clearStencil), i.colorMask(this._state.colorMask.r, this._state.colorMask.g, this._state.colorMask.b, this._state.colorMask.a), i.cullFace(this._state.cullFace), i.depthFunc(this._state.depthFunction), i.depthRange(this._state.depthRange.zNear, this._state.depthRange.zFar), this._state.depthTest === !0 ? i.enable(i.DEPTH_TEST) : i.disable(i.DEPTH_TEST), i.depthMask(this._state.depthWrite), i.frontFace(this._state.frontFace), i.lineWidth(1), this._state.faceCulling === !0 ? i.enable(i.CULL_FACE) : i.disable(i.CULL_FACE), i.polygonOffset(this._state.polygonOffset[0], this._state.polygonOffset[1]), this._state.polygonOffsetFill === !0 ? i.enable(i.POLYGON_OFFSET_FILL) : i.disable(i.POLYGON_OFFSET_FILL), i.scissor(this._state.scissorRect.x, this._state.scissorRect.y, this._state.scissorRect.width, this._state.scissorRect.height), this._state.scissorTest === !0 ? i.enable(i.SCISSOR_TEST) : i.disable(i.SCISSOR_TEST), i.stencilFunc(this._state.stencilFunction.func, this._state.stencilFunction.ref, this._state.stencilFunction.mask), i.stencilOpSeparate(this._state.stencilOperation.face, this._state.stencilOperation.fail, this._state.stencilOperation.zFail, this._state.stencilOperation.zPass), this._state.stencilTest === !0 ? i.enable(i.STENCIL_TEST) : i.disable(i.STENCIL_TEST), i.stencilMask(this._state.stencilWriteMask); + for (let s = 0; s < this.parameters.maxTextureImageUnits; s++) { + i.activeTexture(exe + s), i.bindTexture(io.TEXTURE_2D, null), i.bindTexture(io.TEXTURE_CUBE_MAP, null), this.type === go.WEBGL2 && (i.bindTexture(io.TEXTURE_3D, null), i.bindTexture(io.TEXTURE_2D_ARRAY, null)); + const o = this._state.textureUnitMap[s]; + _e(o) && i.bindTexture(o.descriptor.target, o.glName); + } + i.activeTexture(exe + this._state.activeTexture); + const n = this._state.viewport; + i.viewport(n.x, n.y, n.width, n.height), this.resetInfo(); + } + _loadExtensions() { + this.type === go.WEBGL1 && this.gl.getExtension("OES_element_index_uint"), this.gl.getExtension("KHR_parallel_shader_compile"); + } + _loadParameters(e) { + const i = this.capabilities.textureFilterAnisotropic, r = e.maxAnisotropy ?? 1 / 0, n = this.type === go.WEBGL2, s = this.gl, o = { versionString: this.gl.getParameter(this.gl.VERSION), maxVertexTextureImageUnits: this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS), maxVertexAttributes: this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS), maxMaxAnisotropy: i ? Math.min(this.gl.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY), r) : 1, maxTextureImageUnits: this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS), maxTextureSize: this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE), maxUniformBufferBindings: n ? s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS) : 0, maxVertexUniformBlocks: n ? s.getParameter(s.MAX_VERTEX_UNIFORM_BLOCKS) : 0, maxFragmentUniformBlocks: n ? s.getParameter(s.MAX_FRAGMENT_UNIFORM_BLOCKS) : 0, maxUniformBlockSize: n ? s.getParameter(s.MAX_UNIFORM_BLOCK_SIZE) : 0, uniformBufferOffsetAlignment: n ? s.getParameter(s.UNIFORM_BUFFER_OFFSET_ALIGNMENT) : 1, maxArrayTextureLayers: n ? s.getParameter(s.MAX_ARRAY_TEXTURE_LAYERS) : 1, maxSamples: n ? s.getParameter(s.MAX_SAMPLES) : 1 }; + return Ts.TEXTURE_UNIT_FOR_UPDATES = o.maxTextureImageUnits - 1, o; + } +}; +function s_(t, e, i, r) { + return e ? r !== e && t.bindBuffer(i, e.glName) : t.bindBuffer(i, null), e; +} +function Hnt(t, e) { + switch (t) { + case ps.POINTS: + return 2 * e; + case ps.TRIANGLES: + return e / 3; + case ps.TRIANGLE_STRIP: + case ps.TRIANGLE_FAN: + return e - 2; + default: + return 0; + } +} +const Mar = 2e3; +let Dar = class extends rz { + constructor(e, i) { + super(), this._trash = /* @__PURE__ */ new Set(), this._renderRemainingTime = 0, this._lastFrameRenderTime = 0, this.renderRequested = !1, this.stage = this, this._stationary = !0; + const { canvas: r = document.createElement("canvas"), alpha: n = !0, stencil: s = !0, contextOptions: o = {} } = i; + this._canvas = r; + const a = D1t("2d", r, { alpha: n, antialias: !1, depth: !0, stencil: s }); + this.context = new cDt(a ?? null, o), this.resourceManager = new Ntr(), this.painter = new Ior(this.context, this, this.resourceManager), Vi("esri-2d-profiler") && (this._debugOutput = document.createElement("div"), this._debugOutput.setAttribute("style", "margin: 24px 64px; position: absolute; color: red;"), e.appendChild(this._debugOutput)); + const l = () => this._highlightGradient; + this._renderParameters = { drawPhase: 0, state: this.state, pixelRatio: window.devicePixelRatio, stationary: !1, globalOpacity: 1, blendMode: null, deltaTime: -1, time: 0, inFadeTransition: !1, effects: null, context: this.context, painter: this.painter, timeline: i.timeline || new XNe(), renderingOptions: i.renderingOptions, requestRender: () => this.requestRender(), allowDelayedRender: !1, requireFBO: !1, profiler: new Aor(this.context, this._debugOutput), dataUploadCounter: 0, get highlightGradient() { + return l(); + } }, this._taskHandle = e$({ render: (c) => this.renderFrame(c) }), this._taskHandle.pause(), this._lostWebGLContextHandle = CO(r, "webglcontextlost", () => { + this.emit("webgl-error", { error: new ot("webgl-context-lost") }); + }), this._bufferPool = new mnr(), r.setAttribute("style", "width: 100%; height:100%; display:block;"), e.appendChild(r); + } + destroy() { + this.removeAllChildren(), this._emptyTrash(), this._taskHandle = eh(this._taskHandle), this._lostWebGLContextHandle = eh(this._lostWebGLContextHandle), this._canvas.parentNode?.removeChild(this._canvas), this._debugOutput?.parentNode?.removeChild(this._debugOutput), this._bufferPool.destroy(), this.resourceManager.destroy(), this.painter.dispose(), this.context.dispose(), this._canvas = null; + } + get background() { + return this._background; + } + set background(e) { + this._background = e, this.requestRender(); + } + get bufferPool() { + return this._bufferPool; + } + get renderingOptions() { + return this._renderingOptions; + } + set renderingOptions(e) { + this._renderingOptions = e, this.requestRender(); + } + get state() { + return this._state; + } + set state(e) { + this._state = e, this.requestRender(); + } + get stationary() { + return this._stationary; + } + set stationary(e) { + this._stationary !== e && (this._stationary = e, this.requestRender()); + } + trashDisplayObject(e) { + this._trash.add(e), this.requestRender(); + } + untrashDisplayObject(e) { + return this._trash.delete(e); + } + requestRender() { + this._renderRemainingTime = Mar, this.renderRequested || (this.renderRequested = !0, this.emit("will-render"), this._taskHandle.resume()); + } + renderFrame(e) { + const i = this._lastFrameRenderTime ? e.time - this._lastFrameRenderTime : 0; + this._renderRemainingTime -= i, this._renderRemainingTime <= 0 && this._taskHandle.pause(), this._lastFrameRenderTime = e.time, this.renderRequested = !1, this._renderParameters.state = this._state, this._renderParameters.stationary = this.stationary, this._renderParameters.pixelRatio = window.devicePixelRatio, this._renderParameters.globalOpacity = 1, this._renderParameters.time = e.time, this._renderParameters.deltaTime = e.deltaTime, this._renderParameters.effects = null, this.processRender(this._renderParameters), this._emptyTrash(), this.emit("post-render"); + } + _createTransforms() { + return { dvs: Ml() }; + } + renderChildren(e) { + for (const i of this.children) + i.beforeRender(e); + this._renderChildren(this.children, e); + for (const i of this.children) + i.afterRender(e); + } + _renderChildren(e, i) { + const r = this.context; + this.painter.textureUploadManager.upload(), r.resetInfo(), i.profiler.recordStart("drawLayers"), i.dataUploadCounter = 0, i.drawPhase = lo.MAP, this.painter.beforeRenderLayers(r, this.background); + for (const n of e) + n.processRender(i); + this.painter.prepareDisplay(i, this.background, this.state.padding), this.painter.renderLayers(r), i.drawPhase = lo.HIGHLIGHT, this.painter.beforeRenderLayers(r); + for (const n of e) + n.processRender(i); + if (this.painter.renderLayers(r), this._isLabelDrawPhaseRequired(e)) { + i.drawPhase = lo.LABEL, this.painter.beforeRenderLayers(r); + for (const n of e) + n.processRender(i); + this.painter.renderLayers(r); + } + if (Vi("esri-tiles-debug")) { + i.drawPhase = lo.DEBUG, this.painter.beforeRenderLayers(r); + for (const n of e) + n.processRender(i); + this.painter.renderLayers(r); + } + i.profiler.recordEnd("drawLayers"), r.logInfo(); + } + doRender(e) { + const i = this.context, { state: r, pixelRatio: n } = e; + this._resizeCanvas(e), i.setViewport(0, 0, n * r.size[0], n * r.size[1]), i.setDepthWriteEnabled(!0), i.setStencilWriteMask(255), super.doRender(e); + } + async takeScreenshot(e) { + const { framebufferWidth: i, framebufferHeight: r } = { framebufferWidth: Math.round(this.state.size[0] * e.resolutionScale), framebufferHeight: Math.round(this.state.size[1] * e.resolutionScale) }, n = e.resolutionScale, s = this.context, o = this._state.clone(); + if (e.rotation != null) { + const x = o.viewpoint; + o.viewpoint.rotation = e.rotation, o.viewpoint = x; + } + const a = { ...this._renderParameters, drawPhase: null, globalOpacity: 1, stationary: !0, state: o, pixelRatio: n, time: performance.now(), deltaTime: 0, blendMode: null, effects: null, inFadeTransition: !1 }, l = new cd(s, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.DEPTH_STENCIL_RENDER_BUFFER, width: i, height: r }), c = s.getBoundFramebufferObject(), h = s.getViewport(); + s.bindFramebuffer(l), s.setViewport(0, 0, i, r), this._renderChildren(e.children, a); + const p = this._readbackScreenshot(l, { ...e.cropArea, y: r - (e.cropArea.y + e.cropArea.height) }); + s.bindFramebuffer(c), s.setViewport(h.x, h.y, h.width, h.height), this.requestRender(); + const y = await p; + let v; + return e.outputScale === 1 ? v = y : (v = new ImageData(Math.round(y.width * e.outputScale), Math.round(y.height * e.outputScale)), jhi(y, v, !0)), v; + } + async _readbackScreenshot(e, i) { + const r = Mhi(i.width, i.height, document.createElement("canvas")); + return await e.readPixelsAsync(i.x, i.y, i.width, i.height, cn.RGBA, rs.UNSIGNED_BYTE, new Uint8Array(r.data.buffer)), r; + } + _resizeCanvas(e) { + const i = this._canvas, r = i.style, { state: { size: n }, pixelRatio: s } = e, o = n[0], a = n[1], l = Math.round(o * s), c = Math.round(a * s); + i.width === l && i.height === c || (i.width = l, i.height = c), r.width = o + "px", r.height = a + "px"; + } + _emptyTrash() { + for (; this._trash.size > 0; ) { + const e = Array.from(this._trash); + this._trash.clear(); + for (const i of e) + i.processDetach(); + } + } + _isLabelDrawPhaseRequired(e) { + let i = !1; + for (const r of e) { + if (!(r instanceof rz)) { + i = i || !1; + break; + } + if (r.hasLabels) + return !0; + i = i || this._isLabelDrawPhaseRequired(r.children); + } + return i; + } +}; +const rae = 2, cT = 1, lZ = 0, uZ = 1, cZ = 2; +let Far = class { + constructor(e, i, r) { + this._debugMap = /* @__PURE__ */ new Map(), this._width = e * r, this._height = i * r, this._pixelRatio = r; + const n = Math.ceil(this._width / cT), s = Math.ceil(this._height / cT); + this._cols = n, this._rows = s, this._cells = S8e.create(n * s); + } + insertMetrics(e) { + const i = this._hasCollision(e); + return i === lZ && this._markMetrics(e), i; + } + getCellId(e, i) { + return e + i * this._cols; + } + has(e) { + return this._cells.has(e); + } + hasRange(e, i) { + return this._cells.hasRange(e, i); + } + set(e) { + this._cells.set(e); + } + setRange(e, i) { + this._cells.setRange(e, i); + } + _collide(e, i, r, n) { + const s = e - r / 2, o = i - n / 2, a = s + r, l = o + n; + if (a < 0 || l < 0 || s > this._width || o > this._height) + return uZ; + const c = ru(Math.floor(s / cT), 0, this._cols), h = ru(Math.floor(o / cT), 0, this._rows), p = ru(Math.ceil(a / cT), 0, this._cols), y = ru(Math.ceil(l / cT), 0, this._rows); + for (let v = h; v <= y; v++) + for (let x = c; x <= p; x++) { + const I = this.getCellId(x, v); + if (this.has(I)) + return cZ; + } + return lZ; + } + _mark(e, i, r, n, s) { + const o = e - r / 2, a = i - n / 2, l = o + r, c = a + n, h = ru(Math.floor(o / cT), 0, this._cols), p = ru(Math.floor(a / cT), 0, this._rows), y = ru(Math.ceil(l / cT), 0, this._cols), v = ru(Math.ceil(c / cT), 0, this._rows); + for (let x = p; x <= v; x++) + for (let I = h; I <= y; I++) { + const P = this.getCellId(I, x); + this._debugMap.set(P, s), this.set(P); + } + return !1; + } + _hasCollision(e) { + const i = e.id; + let r = 0, n = 0; + e.save(); + do { + const s = e.boundsCount; + r += s; + for (let o = 0; o < s; o++) { + const a = e.boundsComputedAnchorX(o), l = e.boundsComputedAnchorY(o), c = (e.boundsWidth(o) + rae) * this._pixelRatio, h = (e.boundsHeight(o) + rae) * this._pixelRatio; + switch (this._collide(a, l, c, h)) { + case cZ: + return cZ; + case uZ: + n++; + } + } + } while (e.peekId() === i && e.next()); + return e.restore(), r === n ? uZ : lZ; + } + _markMetrics(e) { + const i = e.id; + e.save(); + do { + const r = e.boundsCount; + for (let n = 0; n < r; n++) { + const s = e.boundsComputedAnchorX(n), o = e.boundsComputedAnchorY(n), a = (e.boundsWidth(n) + rae) * this._pixelRatio, l = (e.boundsHeight(n) + rae) * this._pixelRatio; + this._mark(s, o, a, l, e.id); + } + } while (e.peekId() === i && e.next()); + e.restore(); + } +}; +const Lar = Math.PI; +function hDt(t, e) { + switch (e.transformationType) { + case Rh.Additive: + return Nar(t, e); + case Rh.Constant: + return kar(e, t); + case Rh.ClampedLinear: + return $ar(t, e); + case Rh.Proportional: + return Bar(t, e); + case Rh.Stops: + return Var(t, e); + case Rh.RealWorldSize: + return jar(t, e); + case Rh.Identity: + return t; + case Rh.Unknown: + return null; + } +} +function FS(t, e) { + return typeof t == "number" ? t : hDt(e, t); +} +function Nar(t, e) { + return t + (FS(e.minSize, t) || e.minDataValue); +} +function kar(t, e) { + const i = t.stops; + let r = i && i.length && i[0].size; + return r == null && (r = t.minSize), FS(r, e); +} +function $ar(t, e) { + const i = e.minDataValue, r = e.maxDataValue, n = (t - i) / (r - i), s = FS(e.minSize, t), o = FS(e.maxSize, t); + return t <= i ? s : t >= r ? o : s + n * (o - s); +} +function Bar(t, e) { + const i = t / e.minDataValue, r = FS(e.minSize, t), n = FS(e.maxSize, t); + let s = null; + return s = i * r, ru(s, r, n); +} +function Var(t, e) { + const [i, r, n] = Gar(t, e.cache.ipData); + if (i === r) + return FS(e.stops[i].size, t); + { + const s = FS(e.stops[i].size, t); + return s + (FS(e.stops[r].size, t) - s) * n; + } +} +function jar(t, e) { + const i = Wte[e.valueUnit], r = FS(e.minSize, t), n = FS(e.maxSize, t), { valueRepresentation: s } = e; + let o = null; + return o = s === "area" ? 2 * Math.sqrt(t / Lar) / i : s === "radius" || s === "distance" ? 2 * t / i : t / i, ru(o, r, n); +} +function Gar(t, e) { + if (!e) + return; + let i = 0, r = e.length - 1; + return e.some((n, s) => t < n ? (r = s, !0) : (i = s, !1)), [i, r, (t - e[i]) / (e[r] - e[i])]; +} +const p2e = 254, nae = 255, Cq = 0; +function IB(t, e) { + const i = []; + t.forEachTile((r) => i.push(r)), i.sort((r, n) => r.instanceId - n.instanceId), i.forEach((r) => { + _e(r.labelMetrics) && r.isReady && e(r, r.labelMetrics.getCursor()); + }); +} +function Uar(t) { + return t.layer && (t.layer.type === "feature" || t.layer.type === "csv" || t.layer.type === "geojson" || t.layer.type === "ogc-feature" || t.layer.type === "stream" || t.layer.type === "subtype-group" || t.layer.type === "wfs"); +} +function zar(t) { + return (e) => dn(hDt(e, t)); +} +function Har(t) { + const e = t != null && "visualVariables" in t && t.visualVariables; + if (!e) + return null; + for (const i of e) + if (i.type === "size") + return zar(i); + return null; +} +function War(t) { + for (const e of t) { + const i = "featureReduction" in e && e.featureReduction && "labelingInfo" in e.featureReduction ? e.featureReduction : void 0, r = [...e.labelingInfo || [], ...i?.labelingInfo || []]; + if (!(!e.labelsVisible || !r.length) && r.some((n) => n.deconflictionStrategy === "none")) + return !0; + } + return !1; +} +function qar(t, e) { + if (!Uar(e)) + return; + const i = e.layer.type === "subtype-group" ? e.layer.sublayers.items : [e.layer], r = e.layer.geometryType, n = !War(i), s = {}; + if (e.layer.type !== "subtype-group") { + if (e.tileRenderer?.type === "heatmap") + return; + const l = Har(e.layer.renderer); + s[0] = l; + } + const o = e.tileRenderer; + if (ut(o)) + return; + const a = e.layer.visible && !e.suspended; + t.push({ tileRenderer: o, vvEvaluators: s, deconflictionEnabled: n, geometryType: r, visible: a }); +} +let Yar = class { + run(e, i, r) { + const n = []; + for (let s = e.length - 1; s >= 0; s--) + qar(n, e[s]); + this._transformMetrics(n), this._runCollision(n, i, r); + } + _runCollision(e, i, r) { + const [n, s] = i.state.size, o = new Far(n, s, i.pixelRatio); + for (const { tileRenderer: a, deconflictionEnabled: l, visible: c } of e) { + const h = a.featuresView.attributeView; + l ? c ? (this._prepare(a), this._collideVisible(o, a, r), this._collideInvisible(o, a)) : IB(a, (p, y) => { + for (; y.nextId(); ) + h.setLabelMinZoom(y.id, nae); + }) : IB(a, (p, y) => { + for (; y.nextId(); ) + h.setLabelMinZoom(y.id, Cq), c && o.insertMetrics(y); + }); + } + } + _isFiltered(e, i, r) { + const n = i.getFilterFlags(e), s = !r.hasFilter || !!(n & GAt), o = ut(r.featureEffect) || r.featureEffect.excludedLabelsVisible || !!(n & U8i); + return !(s && o); + } + _prepare(e) { + const i = e.featuresView.attributeView, r = /* @__PURE__ */ new Set(); + IB(e, (n, s) => { + for (; s.nextId(); ) + if (!r.has(s.id)) { + if (r.add(s.id), this._isFiltered(s.id, i, e.layerView)) { + i.setLabelMinZoom(s.id, p2e); + continue; + } + i.getLabelMinZoom(s.id) !== Cq ? i.setLabelMinZoom(s.id, nae) : i.setLabelMinZoom(s.id, Cq); + } + }); + } + _collideVisible(e, i, r) { + const n = i.featuresView.attributeView, s = /* @__PURE__ */ new Set(); + IB(i, (o, a) => { + for (; a.nextId(); ) + if (!s.has(a.id)) + if (o.key.level === r) { + if (n.getLabelMinZoom(a.id) === 0) + switch (e.insertMetrics(a)) { + case uZ: + break; + case cZ: + n.setLabelMinZoom(a.id, p2e), s.add(a.id); + break; + case lZ: + n.setLabelMinZoom(a.id, Cq), s.add(a.id); + } + } else + n.setLabelMinZoom(a.id, p2e); + }); + } + _collideInvisible(e, i) { + const r = i.featuresView.attributeView, n = /* @__PURE__ */ new Set(); + IB(i, (s, o) => { + for (; o.nextId(); ) + if (!n.has(o.id) && r.getLabelMinZoom(o.id) === nae) + switch (e.insertMetrics(o)) { + case uZ: + break; + case cZ: + r.setLabelMinZoom(o.id, nae), n.add(o.id); + break; + case lZ: + r.setLabelMinZoom(o.id, Cq), n.add(o.id); + } + }); + } + _transformMetrics(e) { + for (const { tileRenderer: i, geometryType: r, vvEvaluators: n } of e) + IB(i, (s, o) => { + const a = i.featuresView.attributeView, l = s.transforms.labelMat2d; + l[4] = Math.round(l[4]), l[5] = Math.round(l[5]); + const c = r === "polyline"; + for (; o.next(); ) { + const h = o.boundsCount, p = o.anchorX, y = o.anchorY; + let v = o.size; + const x = n[0]; + if (_e(x)) { + const F = x(a.getVVSize(o.id)); + v = isNaN(F) || F == null || F === 1 / 0 ? v : F; + } + const I = o.directionX * (v / 2), P = o.directionY * (v / 2); + for (let F = 0; F < h; F++) { + let k = p, V = o.anchorY; + if (c) { + let j = k + o.boundsX(F) + I, Y = V + o.boundsY(F) + P; + j = l[0] * j + l[2] * Y + l[4], Y = l[1] * j + l[3] * Y + l[5], o.setBoundsComputedAnchorX(F, Math.floor(j)), o.setBoundsComputedAnchorY(F, Math.floor(Y)); + } else { + k = l[0] * p + l[2] * y + l[4], V = l[1] * p + l[3] * y + l[5]; + const j = k + o.boundsX(F) + I, Y = V + o.boundsY(F) + P; + o.setBoundsComputedAnchorX(F, j), o.setBoundsComputedAnchorY(F, Y); + } + } + } + }); + } +}; +const Xar = 32; +let KN = class extends ap(vn) { + constructor(e) { + super(e), this._applyVisibilityPassThrottled = C6(this._applyVisibilityPass, Xar, this), this.lastUpdateId = -1, this.updateRequested = !1, this.view = null; + } + initialize() { + this.collisionEngine = new Yar(); + } + destroy() { + this.collisionEngine = null, this._applyVisibilityPassThrottled = eh(this._applyVisibilityPassThrottled); + } + get updating() { + return Vi("esri-2d-log-updating") && console.log(`Updating LabelManager ${this.updateRequested}: +-> updateRequested: ${this.updateRequested}`), this.updateRequested; + } + update(e) { + this._applyVisibilityPassThrottled(e); + } + viewChange() { + this.requestUpdate(); + } + requestUpdate() { + this.updateRequested || (this.updateRequested = !0, this.view?.requestUpdate()); + } + processUpdate(e) { + this._set("updateParameters", e), this.updateRequested && (this.updateRequested = !1, this.update(e)); + } + _applyVisibilityPass(e) { + const i = this.view; + if (i) + try { + const r = i.featuresTilingScheme.getClosestInfoForScale(e.state.scale).level; + this.collisionEngine.run(i.allLayerViews.items, e, r); + } catch { + } + } +}; +E([N()], KN.prototype, "updateRequested", void 0), E([N({ readOnly: !0 })], KN.prototype, "updateParameters", void 0), E([N()], KN.prototype, "updating", null), E([N()], KN.prototype, "view", void 0), KN = E([dt("esri.views.2d.layers.labels.LabelManager")], KN); +const Kar = KN; +function Jar(t) { + return dDt(t, !0); +} +function Zar(t) { + return dDt(t, !1); +} +function dDt(t, e) { + if (ut(t)) + return null; + const i = t.spatialReference, r = Ld(i), n = "toJSON" in t ? t.toJSON() : t; + if (!r) + return n; + const s = wx(i) ? 102100 : 4326, o = zj[s].maxX, a = zj[s].minX; + if (B0(n)) + return Wnt(n, o, a); + if (Lg(n)) + return n.points = n.points.map((l) => Wnt(l, o, a)), n; + if (gc(n)) + return Qar(n, r); + if (za(n) || ju(n)) { + const l = OI(tlr, n), c = { xmin: l[0], ymin: l[1], xmax: l[2], ymax: l[3] }, h = ix(c.xmin, a) * (2 * o), p = h === 0 ? n : b5e(n, h); + return c.xmin += h, c.xmax += h, c.xmax > o ? Ynt(p, o, e) : c.xmin < a ? Ynt(p, a, e) : p; + } + return n; +} +function Qar(t, e) { + if (!e) + return t; + const i = elr(t, e).map((r) => r.extent); + return i.length < 2 ? i[0] || t : i.length > 2 ? (t.xmin = e.valid[0], t.xmax = e.valid[1], t) : { rings: i.map((r) => [[r.xmin, r.ymin], [r.xmin, r.ymax], [r.xmax, r.ymax], [r.xmax, r.ymin], [r.xmin, r.ymin]]) }; +} +function Wnt(t, e, i) { + if (Array.isArray(t)) { + const r = t[0]; + if (r > e) { + const n = ix(r, e); + t[0] = r + n * (-2 * e); + } else if (r < i) { + const n = ix(r, i); + t[0] = r + n * (-2 * i); + } + } else { + const r = t.x; + if (r > e) { + const n = ix(r, e); + t.x += n * (-2 * e); + } else if (r < i) { + const n = ix(r, i); + t.x += n * (-2 * i); + } + } + return t; +} +function elr(t, e) { + const i = [], { ymin: r, ymax: n, xmin: s, xmax: o } = t, a = t.xmax - t.xmin, [l, c] = e.valid, { x: h, frameId: p } = qnt(t.xmin, e), { x: y, frameId: v } = qnt(t.xmax, e), x = h === y && a > 0; + if (a > 2 * c) { + const I = { xmin: s < o ? h : y, ymin: r, xmax: c, ymax: n }, P = { xmin: l, ymin: r, xmax: s < o ? y : h, ymax: n }, F = { xmin: 0, ymin: r, xmax: c, ymax: n }, k = { xmin: l, ymin: r, xmax: 0, ymax: n }, V = [], j = []; + sae(I, F) && V.push(p), sae(I, k) && j.push(p), sae(P, F) && V.push(v), sae(P, k) && j.push(v); + for (let Y = p + 1; Y < v; Y++) + V.push(Y), j.push(Y); + i.push(new b5(I, [p]), new b5(P, [v]), new b5(F, V), new b5(k, j)); + } else + h > y || x ? i.push(new b5({ xmin: h, ymin: r, xmax: c, ymax: n }, [p]), new b5({ xmin: l, ymin: r, xmax: y, ymax: n }, [v])) : i.push(new b5({ xmin: h, ymin: r, xmax: y, ymax: n }, [p])); + return i; +} +function qnt(t, e) { + const [i, r] = e.valid, n = 2 * r; + let s, o = 0; + return t > r ? (s = Math.ceil(Math.abs(t - r) / n), t -= s * n, o = s) : t < i && (s = Math.ceil(Math.abs(t - i) / n), t += s * n, o = -s), { x: t, frameId: o }; +} +function sae(t, e) { + const { xmin: i, ymin: r, xmax: n, ymax: s } = e; + return oae(t, i, r) && oae(t, i, s) && oae(t, n, s) && oae(t, n, r); +} +function oae(t, e, i) { + return e >= t.xmin && e <= t.xmax && i >= t.ymin && i <= t.ymax; +} +function Ynt(t, e, i = !0) { + const r = !ju(t); + if (r && Cht(t), i) + return new ilr().cut(t, e); + const n = r ? t.rings : t.paths, s = r ? 4 : 2, o = n.length, a = -2 * e; + for (let l = 0; l < o; l++) { + const c = n[l]; + if (c && c.length >= s) { + const h = []; + for (const p of c) + h.push([p[0] + a, p[1]]); + n.push(h); + } + } + return r ? t.rings = n : t.paths = n, t; +} +let b5 = class { + constructor(e, i) { + this.extent = e, this.frameIds = i; + } +}; +const tlr = Eo(); +let ilr = class { + constructor() { + this._linesIn = [], this._linesOut = []; + } + cut(e, i) { + let r; + if (this._xCut = i, e.rings) + this._closed = !0, r = e.rings, this._minPts = 4; + else { + if (!e.paths) + return null; + this._closed = !1, r = e.paths, this._minPts = 2; + } + for (const s of r) { + if (!s || s.length < this._minPts) + continue; + let o = !0; + for (const a of s) + o ? (this.moveTo(a), o = !1) : this.lineTo(a); + this._closed && this.close(); + } + this._pushLineIn(), this._pushLineOut(), r = []; + for (const s of this._linesIn) + s && s.length >= this._minPts && r.push(s); + const n = -2 * this._xCut; + for (const s of this._linesOut) + if (s && s.length >= this._minPts) { + for (const o of s) + o[0] += n; + r.push(s); + } + return this._closed ? e.rings = r : e.paths = r, e; + } + moveTo(e) { + this._pushLineIn(), this._pushLineOut(), this._prevSide = this._side(e[0]), this._moveTo(e[0], e[1], this._prevSide), this._prevPt = e, this._firstPt = e; + } + lineTo(e) { + const i = this._side(e[0]); + if (i * this._prevSide == -1) { + const r = this._intersect(this._prevPt, e); + this._lineTo(this._xCut, r, 0), this._prevSide = 0, this._lineTo(e[0], e[1], i); + } else + this._lineTo(e[0], e[1], i); + this._prevSide = i, this._prevPt = e; + } + close() { + const e = this._firstPt, i = this._prevPt; + e[0] === i[0] && e[1] === i[1] || this.lineTo(e), this._checkClosingPt(this._lineIn), this._checkClosingPt(this._lineOut); + } + _moveTo(e, i, r) { + this._closed ? (this._lineIn.push([r <= 0 ? e : this._xCut, i]), this._lineOut.push([r >= 0 ? e : this._xCut, i])) : (r <= 0 && this._lineIn.push([e, i]), r >= 0 && this._lineOut.push([e, i])); + } + _lineTo(e, i, r) { + this._closed ? (this._addPolyVertex(this._lineIn, r <= 0 ? e : this._xCut, i), this._addPolyVertex(this._lineOut, r >= 0 ? e : this._xCut, i)) : r < 0 ? (this._prevSide === 0 && this._pushLineOut(), this._lineIn.push([e, i])) : r > 0 ? (this._prevSide === 0 && this._pushLineIn(), this._lineOut.push([e, i])) : this._prevSide < 0 ? (this._lineIn.push([e, i]), this._lineOut.push([e, i])) : this._prevSide > 0 && (this._lineOut.push([e, i]), this._lineIn.push([e, i])); + } + _addPolyVertex(e, i, r) { + const n = e.length; + n > 1 && e[n - 1][0] === i && e[n - 2][0] === i ? e[n - 1][1] = r : e.push([i, r]); + } + _checkClosingPt(e) { + const i = e.length; + i > 3 && e[0][0] === this._xCut && e[i - 2][0] === this._xCut && e[1][0] === this._xCut && (e[0][1] = e[i - 2][1], e.pop()); + } + _side(e) { + return e < this._xCut ? -1 : e > this._xCut ? 1 : 0; + } + _intersect(e, i) { + const r = (this._xCut - e[0]) / (i[0] - e[0]); + return e[1] + r * (i[1] - e[1]); + } + _pushLineIn() { + this._lineIn && this._lineIn.length >= this._minPts && this._linesIn.push(this._lineIn), this._lineIn = []; + } + _pushLineOut() { + this._lineOut && this._lineOut.length >= this._minPts && this._linesOut.push(this._lineOut), this._lineOut = []; + } +}; +const Hc = -1; +let Xnt = class { + constructor() { + this._dirties = [{ vertexFrom: Hc, vertexCount: Hc, indexFrom: Hc, indexCount: Hc, allDirty: !1 }, { vertexFrom: Hc, vertexCount: Hc, indexFrom: Hc, indexCount: Hc, allDirty: !1 }, { vertexFrom: Hc, vertexCount: Hc, indexFrom: Hc, indexCount: Hc, allDirty: !1 }, { vertexFrom: Hc, vertexCount: Hc, indexFrom: Hc, indexCount: Hc, allDirty: !1 }, { vertexFrom: Hc, vertexCount: Hc, indexFrom: Hc, indexCount: Hc, allDirty: !1 }]; + } + hasDirty() { + return this._dirties.some((e) => e.indexCount !== Hc || e.allDirty); + } + markAllClean() { + for (const e of this._dirties) + e.indexFrom = Hc, e.indexCount = Hc, e.vertexFrom = Hc, e.vertexCount = Hc, e.allDirty = !1; + } + markAllDirty() { + for (const e of this._dirties) + e.allDirty = !0; + } + forEach(e) { + for (let i = 0; i < this._dirties.length; ++i) { + const { indexCount: r, indexFrom: n, vertexCount: s, vertexFrom: o, allDirty: a } = this._dirties[i], l = {}; + let c, h = !1; + (a || o !== Hc && s > 0) && (l.geometry = { count: s, from: o, allDirty: a }, h = !0), (a || n !== Hc && r > 0) && (c = { count: r, from: n, allDirty: a }, h = !0), h && e({ indices: c, vertices: l }, i); + } + } + markDirtyIndices(e, i, r) { + const n = this._dirties[e], s = i, o = r; + if (!n.allDirty) + if (n.indexCount !== Hc) { + const a = Math.min(n.indexFrom, s), l = Math.max(n.indexFrom + n.indexCount, s + o) - a; + n.indexFrom = a, n.indexCount = l; + } else + n.indexFrom = s, n.indexCount = o; + } + markDirtyVertices(e, i, r, n) { + const s = this._dirties[e], o = r, a = n; + if (!s.allDirty) + if (s.vertexCount !== Hc) { + const l = Math.min(s.vertexFrom, o), c = Math.max(s.vertexFrom + s.vertexCount, o + a) - l; + s.vertexFrom = l, s.vertexCount = c; + } else + s.vertexFrom = o, s.vertexCount = a; + } +}, rlr = class { + get largestRange() { + return this._largestRange; + } + constructor(e) { + this._largestRange = null, this._parent = e, this._updateLargestRange(); + } + rangeCreated(e) { + (!this._largestRange || e.count > this._largestRange.count) && (this._largestRange = e); + } + rangeResized(e, i) { + e === this._largestRange ? e.count < i && this._updateLargestRange() : (!this._largestRange || e.count > this._largestRange.count) && (this._largestRange = e); + } + findBestRange(e) { + let i = this._parent._freeHead, r = null; + for (; i !== null; ) + i.count >= e && (!r || i.count - e < r.count - e) && (r = i), i = i.next; + return r; + } + findAdjacentRanges(e, i) { + let r = !0, n = !1, s = null, o = this._parent._freeHead; + for (; r && !n; ) { + const a = s !== null ? s.from + s.count : 0, l = o !== null ? o.from : this._parent._size; + e >= a && e + i <= l ? (r = !1, n = !0) : o !== null ? (s = o, o = o.next) : r = !1; + } + return [s, o]; + } + _updateLargestRange() { + let e = null, i = this._parent._freeHead; + for (; i !== null; ) + (!e || i.count > e.count) && (e = i), i = i.next; + this._largestRange = e; + } +}, aae = class rj { + constructor(e, i) { + this._allocated = 0, this._size = e, this._freeHead = e > 0 ? { from: 0, count: e, prev: null, next: null } : null, this._bookKeeper = i || new rlr(this), this._freeHead && this._bookKeeper.rangeCreated(this._freeHead); + } + allocate(e) { + const i = this._bookKeeper.findBestRange(e); + if (i == null) + return -1; + const r = i.from, n = i.count; + if (i.from += e, i.count -= e, this._bookKeeper.rangeResized(i, r, n), this._allocated += e, i.count === 0) { + const s = i.prev !== null ? this._freeHead : i.next; + rj._removeRange(i), this._freeHead = s; + } + return r; + } + free(e, i) { + const [r, n] = this._bookKeeper.findAdjacentRanges(e, i), s = { from: e, count: i, prev: r ?? null, next: n ?? null }; + if (r != null && (r.next = s), n != null && (n.prev = s), this._bookKeeper.rangeCreated(s), this._allocated -= i, n != null && s.from + s.count === n.from) { + const o = s.from, a = s.count; + rj._fuse(s, n), rj._removeRange(n), this._bookKeeper.rangeResized(s, o, a), this._bookKeeper.rangeResized(n, void 0, 0); + } + if (r != null && r.from + r.count === s.from) { + const o = r.from, a = r.count; + rj._fuse(r, s), rj._removeRange(s), this._bookKeeper.rangeResized(r, o, a), this._bookKeeper.rangeResized(s, void 0, 0); + } + this._freeHead = s.prev !== null ? this._freeHead : s; + } + get fragmentation() { + const e = this._size - this._allocated; + return e === 0 ? 0 : 1 - this._bookKeeper.largestRange.count / e; + } + static _removeRange(e) { + e.prev !== null ? e.next !== null ? (e.prev.next = e.next, e.next.prev = e.prev) : e.prev.next = null : e.next !== null && (e.next.prev = null); + } + static _fuse(e, i) { + e.count += i.count, e.next = i.next, i.from += i.count, i.count = 0, i.next !== null && (i.next.prev = e); + } +}; +const ZX = ["FILL", "LINE", "MARKER", "TEXT", "LABEL"]; +function nlr(t) { + const e = t.getStrides(), i = {}; + for (let r = 0; r < e.length; r++) + i[ZX[r]] = e[r]; + return i; +} +const Knt = 0.5; +let Jnt = class pDt { + constructor(e, i, r, n) { + this._strides = e, this._displayList = i, this._freeListsAndStorage = {}, this._dirtyMap = null, this._dirtyMap = r; + for (const s in e) { + this._freeListsAndStorage[s] = { vtxFreeList: n ? new aae(n) : null, idxFreeList: n ? new aae(n) : null, vertexBuffers: {}, indexBuffer: n ? new Uint32Array(n) : null }; + for (const o in e[s]) + this._freeListsAndStorage[s].vertexBuffers[o] = { data: n ? D8e(n, e[s][o]) : null, stride: e[s][o] }; + } + } + static fromTileData(e, i) { + const r = nlr(e), n = [0, 0, 0, 0, 0], s = [0, 0, 0, 0, 0]; + for (const l of e.tileDisplayData.displayObjects) + for (const c of l.displayRecords) + n[c.geometryType] = Math.max(n[c.geometryType], c.vertexFrom + c.vertexCount), s[c.geometryType] = Math.max(s[c.geometryType], c.indexFrom + c.indexCount); + const o = new pDt(r, e.tileDisplayData.displayList, i, void 0), a = e.tileBufferData?.geometries ?? []; + for (let l = 0; l < a.length; ++l) { + const c = n[l], h = s[l], p = a[l], y = ZX[l], v = o._storageFor(y), x = a[l].indexBuffer; + v.indexBuffer = x, v.idxFreeList = new aae(x.length), v.idxFreeList.allocate(h); + let I = 0; + for (const P in p.vertexBuffer) { + const F = a[l].vertexBuffer[P]; + v.vertexBuffers[P].data = F.data, v.vertexBuffers[P].stride = F.stride; + const k = KJ(F.stride), V = F.data.length * k / F.stride; + I || (I = V); + } + v.vtxFreeList = new aae(I), v.vtxFreeList.allocate(c); + } + return o; + } + delete(e) { + const i = ZX[e.geometryType]; + this._freeVertices(i, e.vertexFrom, e.vertexCount), this._freeIndices(i, e.indexFrom, e.indexCount), this._displayList.removeFromList(e), e.vertexFrom = void 0, e.indexFrom = void 0; + } + setMeshData(e, i, r, n, s) { + const o = ZX[e.geometryType]; + let a, l; + e.meshData = null, e.vertexFrom === void 0 ? (l = i.vertexCount, a = this._allocateVertices(o, l)) : i.vertexCount > e.vertexCount ? (this._freeVertices(o, e.vertexFrom, e.vertexCount), l = i.vertexCount, a = this._allocateVertices(o, l)) : i.vertexCount === e.vertexCount ? (a = e.vertexFrom, l = e.vertexCount) : (this._freeVertices(o, e.vertexFrom + i.vertexCount, e.vertexCount - i.vertexCount), a = e.vertexFrom, l = i.vertexCount); + let c, h, p, y = !0; + if (e.indexFrom === void 0 ? (c = s, p = i.indexCount, h = this._allocateIndices(o, p)) : i.indexCount > e.indexCount ? (c = this._displayList.removeFromList(e), this._freeIndices(o, e.indexFrom, e.indexCount), p = i.indexCount, h = this._allocateIndices(o, p)) : i.indexCount === e.indexCount ? (y = !1, h = e.indexFrom, p = e.indexCount) : (c = this._displayList.removeFromList(e), this._freeIndices(o, e.indexFrom + i.indexCount, e.indexCount - i.indexCount), h = e.indexFrom, p = i.indexCount), a !== -1 && h !== -1) { + const v = this._storageFor(o); + if (yRe(a, h, v.vertexBuffers, v.indexBuffer, i, r, n), e.vertexFrom = a, e.indexFrom = h, e.vertexCount = i.vertexCount, e.indexCount = i.indexCount, this._dirtyMap) { + this._dirtyMap.markDirtyIndices(e.geometryType, e.indexFrom, e.indexCount); + for (const x in r) + this._dirtyMap.markDirtyVertices(e.geometryType, x, e.vertexFrom, e.vertexCount); + } + return y && this._displayList.addToList(e, c), !0; + } + return a !== -1 && this._freeVertices(o, a, l), h !== -1 && this._freeIndices(o, h, p), e.setMeshDataFromBuffers(i, r, n), e.vertexFrom = void 0, e.vertexCount = 0, e.indexFrom = void 0, e.indexCount = 0, !1; + } + tryAddMeshData(e, i) { + const r = i.vertexBuffer, n = i.indexBuffer, s = ZX[e.geometryType], o = this._allocateVertices(s, e.vertexCount); + if (o === -1) + return this._freeVertices(s, o, e.vertexCount), !1; + const a = this._allocateIndices(s, e.indexCount); + if (a === -1) + return this._freeVertices(s, o, e.vertexCount), this._freeIndices(s, a, e.indexCount), !1; + const l = this._storageFor(s); + if (yRe(o, a, l.vertexBuffers, l.indexBuffer, e, r, n), e.vertexFrom = o, e.indexFrom = a, this._dirtyMap) { + this._dirtyMap.markDirtyIndices(e.geometryType, e.indexFrom, e.indexCount); + for (const c in r) + this._dirtyMap.markDirtyVertices(e.geometryType, c, o, e.vertexCount); + } + return this._displayList.addToList(e), !0; + } + _allocateVertices(e, i) { + const r = this._storageFor(e), n = r.vtxFreeList?.allocate(i); + if (n == null || n === -1) + return -1; + const s = r.vtxFreeList?.fragmentation; + return s == null || s > Knt ? -1 : n; + } + _freeVertices(e, i, r) { + this._storageFor(e).vtxFreeList?.free(i, r); + } + _freeIndices(e, i, r) { + this._storageFor(e).idxFreeList?.free(i, r); + } + _allocateIndices(e, i) { + const r = this._storageFor(e), n = r.idxFreeList?.allocate(i); + if (n == null || n === -1) + return -1; + const s = r.idxFreeList?.fragmentation; + return s == null || s > Knt ? -1 : n; + } + _storageFor(e) { + return this._freeListsAndStorage[e]; + } + _stridesFor(e, i) { + return this._strides[e][i]; + } +}, slr = class { + constructor(e) { + this.geometryMap = A9i(() => ({ indexBuffer: Qo.createIndex(e, Vo.STATIC_DRAW), vao: null }), (i, r) => ({ vertexBuffer: Qo.createVertex(e, I9i[r]) })); + } + dispose() { + for (let e = 0; e < 5; e++) { + const i = this.geometryMap[e]; + if (i) { + i.data.vao && i.data.vao.dispose(!1), i.data.indexBuffer && i.data.indexBuffer.dispose(); + for (const r in i.buffers) + i.buffers[r] && i.buffers[r].data.vertexBuffer.dispose(); + } + } + } + get(e) { + const i = this.geometryMap[e]; + return { getVAO(r, n, s) { + if (!i.data.vao) { + const o = {}; + for (const a in i.buffers) + o[a] = i.buffers[a].data.vertexBuffer; + i.data.vao = new Ac(r, s, n, o, i.data.indexBuffer); + } + return i.data.vao; + } }; + } + has(e) { + return this.geometryMap[e] != null; + } + upload(e, i) { + i.forEach((r, n) => { + this._upload(r, n, e); + }); + } + _upload(e, i, r) { + if (e.indices && (e.indices.allDirty ? this._uploadIndices(r, i) : e.indices.from != null && e.indices.count != null && this._uploadIndices(r, i, e.indices.from, e.indices.count)), e.vertices) { + const n = e.vertices; + for (const s in n) { + const o = n[s]; + o.allDirty ? this._uploadVertices(r, i, s) : o.from != null && o.count != null && this._uploadVertices(r, i, s, o.from, o.count); + } + } + } + _uploadVertices(e, i, r, n, s) { + const o = this.geometryMap[i]; + if (!o) + return; + const a = e.geometries[i].vertexBuffer[r]; + if (!a) + return; + const { data: l, stride: c } = a; + if (o.buffers[r] && l.length > 0) { + const h = c / l.BYTES_PER_ELEMENT; + n != null && s != null ? o.buffers[r].data.vertexBuffer.setSubData(l, n * h, n * h, (n + s) * h) : o.buffers[r].data.vertexBuffer.setData(l); + } + } + _uploadIndices(e, i, r, n) { + const s = this.geometryMap[i]; + if (!s) + return; + const o = e.geometries[i].indexBuffer; + s.data.indexBuffer && o.length > 0 && (r != null && n != null ? s.data.indexBuffer.setSubData(o, r, r, r + n) : s.data.indexBuffer.setData(o)); + } +}, cH = class extends pC { + constructor(e, i, r, n, s, o, a = s, l = o) { + super(), this.triangleCountReportedInDebug = 0, this.triangleCount = 0, this.texture = null, this.key = new Lh(e), this.resolution = i, this.x = r, this.y = n, this.width = s, this.height = o, this.rangeX = a, this.rangeY = l; + } + destroy() { + this.texture && (this.texture.dispose(), this.texture = null); + } + setTransform(e) { + const i = this.resolution / (e.resolution * e.pixelRatio), r = this.transforms.tileMat3, [n, s] = e.toScreenNoRotation([0, 0], [this.x, this.y]), o = this.width / this.rangeX * i, a = this.height / this.rangeY * i; + x$(r, o, 0, 0, 0, a, 0, n, s, 1), kv(this.transforms.dvs, e.displayViewMat3, r); + } +}, olr = class { + acquire(e) { + return { refCount: 1, version: -1, labelMat2d: e1(), tileMat3: Ml(), dvs: Ml() }; + } + release(e) { + } +}, N9e = class iDe extends cH { + constructor(e, i, r, n) { + super(e, i, r, n, Sc, Sc); + } + destroy() { + super.destroy(), this._transforms && iDe.TransformCache.release(this.key.hash); + } + setTransform(e) { + const i = this.resolution / e.resolution, r = this.transforms.tileMat3, [n, s] = e.toScreenNoRotation([0, 0], [this.x, this.y]), o = this.width / this.rangeX * i, a = this.height / this.rangeY * i; + x$(r, o, 0, 0, 0, a, 0, n, s, 1), kv(this.transforms.dvs, e.displayViewMat3, r); + const l = this.transforms.labelMat2d, c = window.devicePixelRatio, h = x_t(e1(), o * c, 0, 0, a * c, n * c, s * c); + dU(l, e.viewMat2d, h); + } + _createTransforms() { + return iDe.TransformCache.acquire(this.key.hash); + } +}; +N9e.TransformCache = new olr(); +let alr = class extends N9e { + constructor() { + super(...arguments), this._data = null, this._displayList = null, this._lastCommitTime = 0, this._hasData = !1, this._invalidated = !1, this._wglBuffers = null, this._dirtyMap = new Xnt(); + } + destroy() { + super.destroy(), this.clear(); + } + get hasData() { + return !!this._hasData; + } + get displayObjects() { + return this._displayObjects ?? []; + } + getGeometry(e) { + return this._wglBuffers && this._wglBuffers.has(e) ? this._wglBuffers.get(e) : null; + } + getDisplayList() { + return this._displayList; + } + patch(e) { + if (e.clear === !0) + return this.clear(), void (this._hasData = !1); + const i = e.addOrUpdate, r = e.remove; + !this._data && i && i.tileDisplayData?.displayObjects.length ? (i.tileDisplayData.computeDisplayList(), this._dirtyMap = new Xnt(), this._dispRecStore = Jnt.fromTileData(i, this._dirtyMap), this._data = i, this._dirtyMap.markAllDirty(), this._hasData = !0, e.end && this.ready()) : this._data && (i && i.tileDisplayData?.displayObjects.length || r.length) ? this._doPatchData(e) : e.end && this.ready(), e.end && !this._data && this.clear(), this.requestRender(), this.emit("change"); + } + commit(e) { + e.time && e.time === this._lastCommitTime || (this._lastCommitTime = e.time, this.visible && this._data && (this._wglBuffers || (this._wglBuffers = new slr(e.context)), (this._dirtyMap.hasDirty() || this._invalidated) && (this._invalidated = !1, this._wglBuffers.upload(this._data.tileBufferData, this._dirtyMap), this._displayList = this._data.tileDisplayData.displayList.clone(), this._displayObjects = this._data.tileDisplayData.displayObjects.slice(), this._dirtyMap.markAllClean()))); + } + clear() { + this._data = null, this._displayList = null, this._dispRecStore = null, this._wglBuffers && (this._wglBuffers.dispose(), this._wglBuffers = null); + } + _doPatchData(e) { + this._invalidated = !0, this._patchData(e) || (this._dirtyMap.markAllDirty(), this._data.reshuffle(), this._dispRecStore = Jnt.fromTileData(this._data, this._dirtyMap)), this.requestRender(); + } + _patchData(e) { + let i = !0; + const r = e.addOrUpdate && e.addOrUpdate.tileDisplayData && e.addOrUpdate.tileDisplayData.displayObjects || [], n = (e.remove || []).slice(); + for (const a of r) + a.insertAfter != null && n.push(a.id); + let s; + n.length > 0 && (s = new Set(n)); + const o = this._data.tileDisplayData; + for (const a of n) { + const l = o.displayObjectRegistry.get(a); + if (l) { + o.displayList.removeFromList(l.displayRecords); + for (const c of l.displayRecords) + this._dispRecStore.delete(c); + o.displayObjectRegistry.delete(a); + } + } + s?.size && (o.displayObjects = o.displayObjects.filter((a) => !s.has(a.id))); + for (const a of r) { + let l, c = o.displayObjectRegistry.get(a.id); + if (c) { + const p = c.displayRecords; + c.set(a), c.displayRecords = p; + const y = c.displayRecords.length; + for (let v = 0; v < y; ++v) { + const x = c.displayRecords[v], I = a.displayRecords[v]; + (v >= a.displayRecords.length || x.geometryType !== I.geometryType || x.symbolLevel !== I.symbolLevel || x.zOrder !== I.zOrder || x.materialKey !== I.materialKey) && (this._dispRecStore.delete(c.displayRecords[v]), v < a.displayRecords.length && (c.displayRecords[v] = void 0)); + } + c.displayRecords.length = a.displayRecords.length; + } else { + let p; + c = a.copy(), c.displayRecords = [], o.displayObjectRegistry.set(a.id, c); + const y = o.displayObjects; + if (c.insertAfter != null) + if (l = {}, c.insertAfter >= 0) { + const v = o.displayObjectRegistry.get(c.insertAfter); + v ? (p = y.indexOf(v) + 1, p < y.length ? y.splice(p, 0, c) : (y.push(c), p = y.length)) : (y.push(c), p = y.length); + } else + y.unshift(c), p = 0; + else + y.push(c), p = y.length; + if (l) { + const v = a.displayRecords.length > 0 ? 1 : 0; + let x = 0; + for (let I = p - 1; I >= 0 && x < v; --I) + for (let P = y[I].displayRecords.length - 1; P >= 0 && x < v; --P) { + const F = y[I].displayRecords[P], k = o.displayList.getDPInfoType(); + l[k] || (l[k] = F, ++x); + } + } + } + const h = a.displayRecords.length; + for (let p = 0; p < h; ++p) { + const y = a.displayRecords[p]; + let v = c.displayRecords[p]; + v ? (v.meshData = y.meshData, v.materialKey = y.materialKey) : (v = y.copy(), v.vertexFrom = void 0, v.indexFrom = void 0, c.displayRecords[p] = v); + const x = y.geometryType, I = o.displayList.getDPInfoType(), P = e.addOrUpdate.tileBufferData.geometries[x], F = P.vertexBuffer, k = P.indexBuffer; + let V; + l && (V = l[I] ? o.displayList.splitAfter(l[I]) : -1), i = this._dispRecStore.setMeshData(v, y, F, k, V) && i, l && v.indexFrom != null && v.indexFrom != null && (l[I] = v); + } + } + return i; + } +}, fDt = class { + constructor() { + this._byGeometryType = null; + } + get satisfied() { + return !this._byGeometryType; + } + reset() { + this._byGeometryType = null; + } + verticesFor(e) { + return this._byGeometryType ? this._byGeometryType[e].vertices : 0; + } + indicesFor(e) { + return this._byGeometryType ? this._byGeometryType[e].indices : 0; + } + needMore(e, i, r) { + if (!i && !r) + return; + this._byGeometryType || (this._byGeometryType = [{ vertices: 0, indices: 0 }, { vertices: 0, indices: 0 }, { vertices: 0, indices: 0 }, { vertices: 0, indices: 0 }, { vertices: 0, indices: 0 }]); + const n = this._byGeometryType[e]; + n.vertices += i, n.indices += r; + } +}; +const f2e = 5; +let m2e = class rDe { + constructor() { + this.geometries = [{ indexBuffer: void 0, vertexBuffer: {} }, { indexBuffer: void 0, vertexBuffer: {} }, { indexBuffer: void 0, vertexBuffer: {} }, { indexBuffer: void 0, vertexBuffer: {} }, { indexBuffer: void 0, vertexBuffer: {} }]; + } + clone() { + const e = new rDe(); + for (let i = 0; i < this.geometries.length; i++) { + const r = this.geometries[i], n = e.geometries[i]; + n.indexBuffer = r.indexBuffer.slice(), n.vertexBuffer = {}; + for (const s in r.vertexBuffer) { + const { data: o, stride: a } = r.vertexBuffer[s]; + n.vertexBuffer[s] = { data: o.slice(), stride: a }; + } + } + return e; + } + static deserialize(e) { + const i = new rDe(); + for (let r = 0; r < f2e; ++r) { + i.geometries[r].indexBuffer = new Uint32Array(e.geometries[r].indexBuffer), i.geometries[r].vertexBuffer = {}; + for (const n in e.geometries[r].vertexBuffer) + i.geometries[r].vertexBuffer[n] = { data: mfe(e.geometries[r].vertexBuffer[n].data, e.geometries[r].vertexBuffer[n].stride), stride: e.geometries[r].vertexBuffer[n].stride }; + } + return i; + } + serialize() { + const e = { geometries: [{ indexBuffer: this.geometries[0].indexBuffer.buffer, vertexBuffer: {} }, { indexBuffer: this.geometries[1].indexBuffer.buffer, vertexBuffer: {} }, { indexBuffer: this.geometries[2].indexBuffer.buffer, vertexBuffer: {} }, { indexBuffer: this.geometries[3].indexBuffer.buffer, vertexBuffer: {} }, { indexBuffer: this.geometries[4].indexBuffer.buffer, vertexBuffer: {} }] }; + for (let i = 0; i < f2e; ++i) + for (const r in this.geometries[i].vertexBuffer) + e.geometries[i].vertexBuffer[r] = { data: this.geometries[i].vertexBuffer[r].data.buffer, stride: this.geometries[i].vertexBuffer[r].stride }; + return e; + } + getBuffers() { + const e = []; + for (let i = 0; i < f2e; ++i) { + e.push(this.geometries[i].indexBuffer.buffer); + for (const r in this.geometries[i].vertexBuffer) + e.push(this.geometries[i].vertexBuffer[r].data.buffer); + } + return e; + } +}; +function lae(t, e, i, ...r) { + e < t.length ? t.splice(e, i, ...r) : t.push(...r); +} +let llr = class mDt { + constructor() { + this.symbolLevels = []; + } + replay(e, i, r) { + for (const n of this.symbolLevels) + for (const s of n.zLevels) { + const o = s.geometryDPInfo.unified; + if (o) + for (const a of o) { + const { geometryType: l, materialKey: c, indexFrom: h, indexCount: p } = a, y = _1.load(c).symbologyType, v = e.painter.getBrush(l, y), x = { geometryType: l, materialKey: c, indexFrom: h, indexCount: p, target: i.getGeometry(l) }; + v.prepareState(e), v.drawGeometry(e, i, x, r); + } + } + } + get empty() { + return !this.symbolLevels || this.symbolLevels.length === 0; + } + clear() { + this.symbolLevels.length = 0; + } + addToList(e, i) { + if (Array.isArray(e)) + for (const r of e) + this._addToList(r, i); + else + this._addToList(e, i); + } + removeFromList(e) { + Array.isArray(e) || (e = [e]); + let i = null; + for (const r of e) + i = this._removeFromList(r); + return i; + } + clone() { + const e = new mDt(); + for (const i of this.symbolLevels) + e.symbolLevels.push(i.clone()); + return e; + } + splitAfter(e) { + const i = this._getDisplayList(e.symbolLevel, e.zOrder), r = i.length, n = e.indexFrom + e.indexCount; + for (let s = 0; s < r; ++s) { + const o = i[s]; + if (o.geometryType === e.geometryType && n > o.indexFrom && n <= o.indexFrom + o.indexCount) { + if (n < o.indexFrom + o.indexCount) { + const a = new g2e(); + a.geometryType = o.geometryType, a.materialKey = o.materialKey, a.indexFrom = n, a.indexCount = o.indexFrom + o.indexCount - n, i.splice(s + 1, 0, a), o.indexCount = n - o.indexFrom; + } + return s; + } + } + } + _addToList(e, i) { + const r = e.symbolLevel, n = e.zOrder, s = this._getDisplayList(r, n), o = i ?? s.length - 1, a = o >= 0 && o < s.length ? s[o] : null; + if (a !== null && a.materialKey === e.materialKey && a.indexFrom + a.indexCount === e.indexFrom && a.geometryType === e.geometryType) + a.indexCount += e.indexCount; + else { + const l = new g2e(); + l.indexFrom = e.indexFrom, l.indexCount = e.indexCount, l.materialKey = e.materialKey, l.geometryType = e.geometryType, lae(s, o + 1, 0, l); + } + } + _removeFromList(e) { + const i = e.symbolLevel, r = e.zOrder, n = this._getDisplayList(i, r), s = n.length; + let o; + for (let a = 0; a < s; ++a) { + const l = n[a]; + if (e.indexFrom + e.indexCount > l.indexFrom && e.indexFrom < l.indexFrom + l.indexCount && l.geometryType === e.geometryType) { + o = a; + break; + } + } + if (o !== void 0) { + const a = n[o]; + if (e.indexFrom === a.indexFrom) + return a.indexCount -= e.indexCount, a.indexFrom += e.indexCount, a.indexCount === 0 && lae(n, o, 1), o - 1; + if (e.indexFrom + e.indexCount === a.indexFrom + a.indexCount) + return a.indexCount -= e.indexCount, a.indexCount === 0 ? (lae(n, o, 1), o - 1) : o; + { + const l = a.indexFrom, c = e.indexFrom - a.indexFrom, h = e.indexCount, p = a.indexFrom + a.indexCount - (e.indexFrom + e.indexCount); + a.indexCount = c; + const y = new g2e(); + return y.geometryType = a.geometryType, y.materialKey = a.materialKey, y.indexFrom = l + c + h, y.indexCount = p, lae(n, o + 1, 0, y), o; + } + } + return null; + } + _getDisplayList(e, i) { + let r; + const n = this.symbolLevels.length; + for (let a = 0; a < n; a++) + if (this.symbolLevels[a].symbolLevel === e) { + r = this.symbolLevels[a]; + break; + } + let s; + r || (r = new clr(), r.symbolLevel = e, this.symbolLevels.push(r)); + const o = r.zLevels.length; + for (let a = 0; a < o; a++) + if (r.zLevels[a].zLevel === i) { + s = r.zLevels[a]; + break; + } + return s || (s = new ulr(), s.geometryDPInfo = new yDt(), s.zLevel = i, r.zLevels.push(s)), s.geometryDPInfo.unified || (s.geometryDPInfo.unified = []), s.geometryDPInfo.unified; + } + getDPInfoType() { + return "unified"; + } +}, g2e = class gDt { + constructor() { + this.materialKey = null, this.indexFrom = 0, this.indexCount = 0; + } + clone() { + const e = new gDt(); + return e.geometryType = this.geometryType, e.materialKey = this.materialKey, e.indexFrom = this.indexFrom, e.indexCount = this.indexCount, e; + } +}, yDt = class vDt { + constructor() { + this.fill = null, this.line = null, this.marker = null, this.text = null, this.label = null, this.unified = null; + } + clone() { + const e = new vDt(); + return e.fill = this.fill && this.fill.map((i) => i.clone()), e.line = this.line && this.line.map((i) => i.clone()), e.marker = this.marker && this.marker.map((i) => i.clone()), e.text = this.text && this.text.map((i) => i.clone()), e.label = this.label && this.label.map((i) => i.clone()), e.unified = this.unified && this.unified.map((i) => i.clone()), e; + } +}, ulr = class _Dt { + constructor() { + this.geometryDPInfo = new yDt(); + } + clone() { + const e = new _Dt(); + return e.zLevel = this.zLevel, e.geometryDPInfo = this.geometryDPInfo.clone(), e; + } +}, clr = class bDt { + constructor() { + this.zLevels = []; + } + clone() { + const e = new bDt(); + e.symbolLevel = this.symbolLevel; + for (const i of this.zLevels) + e.zLevels.push(i.clone()); + return e; + } +}, Znt = class { + constructor() { + this.vertexData = /* @__PURE__ */ new Map(), this.vertexCount = 0, this.indexData = []; + } + clear() { + this.vertexData.clear(), this.vertexCount = 0, this.indexData = []; + } + update(e, i, r) { + for (const n in e) + this.vertexData.set(n, e[n]); + for (const n in this.vertexData) + e[n] === null && this.vertexData.delete(n); + this.vertexCount = i, this.indexData = r; + } +}, nDe = class sDe { + constructor(e, i, r, n = 0, s = 0) { + this.id = e, this.geometryType = i, this.materialKey = r, this.minZoom = n, this.maxZoom = s, this.meshData = null, this.symbolLevel = 0, this.zOrder = 0, this.vertexFrom = 0, this.vertexCount = 0, this.indexFrom = 0, this.indexCount = 0, this._sortKey = null; + } + get sortKey() { + return this._sortKey == null && this._computeSortKey(), this._sortKey; + } + clone() { + return this.copy(); + } + copy() { + const e = new sDe(this.id, this.geometryType, this.materialKey); + return e.vertexFrom = this.vertexFrom, e.vertexCount = this.vertexCount, e.indexFrom = this.indexFrom, e.indexCount = this.indexCount, e.zOrder = this.zOrder, e.symbolLevel = this.symbolLevel, e.meshData = this.meshData, e.minZoom = this.minZoom, e.maxZoom = this.maxZoom, e; + } + setMeshDataFromBuffers(e, i, r) { + const n = new Znt(); + for (const s in i) { + const o = i[s].stride, a = i[s].data; + if (!a) + continue; + const l = [], c = KJ(o); + for (let h = 0; h < o * e.vertexCount / c; ++h) + l[h] = a[h + o * e.vertexFrom / c]; + n.vertexData.set(s, l); + } + n.indexData.length = 0; + for (let s = 0; s < e.indexCount; ++s) + n.indexData[s] = r[s + e.indexFrom] - e.vertexFrom; + n.vertexCount = e.vertexCount, this.meshData = n; + } + readMeshDataFromBuffers(e, i) { + this.meshData ? this.meshData.clear() : this.meshData = new Znt(); + for (const r in e) { + const n = e[r].stride, s = e[r].data, o = [], a = KJ(n); + for (let l = 0; l < n * this.vertexCount / a; ++l) + o[l] = s[l + n * this.vertexFrom / a]; + this.meshData.vertexData.set(r, o); + } + this.meshData.indexData.length = 0; + for (let r = 0; r < this.indexCount; ++r) + this.meshData.indexData[r] = i[r + this.indexFrom] - this.vertexFrom; + this.meshData.vertexCount = this.vertexCount; + } + writeMeshDataToBuffers(e, i, r, n) { + if (this.meshData) { + for (const s in i) { + const o = i[s].stride, a = this.meshData.vertexData.get(s), l = i[s].data, c = KJ(o); + for (let h = 0; h < o * this.meshData.vertexCount / c; ++h) + l[h + o * e / c] = a[h]; + } + for (let s = 0; s < this.meshData.indexData.length; ++s) + n[s + r] = this.meshData.indexData[s] + e; + this.vertexFrom = e, this.vertexCount = this.meshData.vertexCount, this.indexFrom = r, this.indexCount = this.meshData.indexData.length; + } + } + static writeAllMeshDataToBuffers(e, i, r) { + let n = 0, s = 0; + for (const o of e) + o.writeMeshDataToBuffers(n, i, s, r), n += o.vertexCount, s += o.indexCount; + } + _computeSortKey() { + this._sortKey = (31 & this.symbolLevel) << 12 | (127 & this.zOrder) << 4 | 7 & this.geometryType; + } + serialize(e) { + return e.push(this.geometryType), e.push(this.materialKey), e.push(this.vertexFrom), e.push(this.vertexCount), e.push(this.indexFrom), e.push(this.indexCount), e.push(this.minZoom), e.push(this.maxZoom), e; + } + static deserialize(e, i) { + const r = e.readInt32(), n = e.readInt32(), s = new sDe(i.id, r, n); + return s.vertexFrom = e.readInt32(), s.vertexCount = e.readInt32(), s.indexFrom = e.readInt32(), s.indexCount = e.readInt32(), s.minZoom = e.readInt32(), s.maxZoom = e.readInt32(), s; + } +}; +function wDt(t, e) { + if (e !== null) { + t.push(e.length); + for (const i of e) + i.serialize(t); + return t; + } + t.push(0); +} +function hlr(t, e, i) { + const r = t.readInt32(), n = new Array(r); + for (let s = 0; s < n.length; s++) + n[s] = e.deserialize(t, i); + return n; +} +let xDt = class Sce { + constructor(e) { + this.insertAfter = null, this.id = e, this.displayRecords = []; + } + copy() { + const e = new Sce(this.id); + return e.set(this), e; + } + clone() { + const e = new Sce(this.id); + return e.displayRecords = this.displayRecords.map((i) => i.clone()), e.insertAfter = this.insertAfter, e; + } + set(e) { + this.id = e.id, this.displayRecords = e.displayRecords, this.insertAfter = e.insertAfter; + } + serialize(e) { + return e.push(this.id), wDt(e, this.displayRecords), e; + } + static deserialize(e) { + const i = e.readInt32(), r = new Sce(i), n = { id: i }; + return r.displayRecords = hlr(e, nDe, n) ?? [], r; + } +}, Qnt = class oDe { + constructor() { + this.displayObjects = [], this._displayList = null; + } + get displayObjectRegistry() { + if (!this._displayObjectRegistry) { + this._displayObjectRegistry = /* @__PURE__ */ new Map(); + for (const e of this.displayObjects) + this._displayObjectRegistry.set(e.id, e); + } + return this._displayObjectRegistry; + } + get displayList() { + return this._displayList; + } + computeDisplayList() { + this._displayList = new llr(); + for (const e of this.displayObjects) + for (const i of e.displayRecords) + this._displayList.addToList(i); + } + clone() { + const e = new oDe(); + return this.displayObjects && (e.displayObjects = this.displayObjects.map((i) => i.clone())), e; + } + serialize(e) { + return wDt(e, this.displayObjects), e; + } + _deserializeObjects(e) { + const i = e.readInt32(), r = new Array(i), n = /* @__PURE__ */ new Map(); + for (let s = 0; s < r.length; ++s) { + const o = xDt.deserialize(e); + r[s] = o, n.set(o.id, o); + } + this.displayObjects = r, this._displayList = null, this._displayObjectRegistry = n; + } + static deserialize(e) { + const i = new oDe(); + return i._deserializeObjects(e), i; + } +}; +const uae = 2147483647; +let A7 = class aDe { + constructor(e) { + this._head = e, this._cursor = e; + } + static from(e, i = 0, r = e.byteLength / s6.BYTES_PER_RECORD - i) { + const n = new s6(new Int32Array(e, i * s6.BYTES_PER_RECORD, r * s6.ELEMENTS_PER_RECORD)); + return new aDe(n); + } + size() { + let e = this._cursor, i = 0; + for (; e; ) + i += e.size(), e = e._link; + return i; + } + get id() { + return this._cursor.id; + } + set id(e) { + this._cursor.id = e; + } + get materialKey() { + return this._cursor.materialKey; + } + set materialKey(e) { + this._cursor.materialKey = e; + } + get insertAfter() { + return this._cursor.insertAfter; + } + get indexFrom() { + return this._cursor.indexFrom; + } + set indexFrom(e) { + this._cursor.indexFrom = e; + } + get indexCount() { + return this._cursor.indexCount; + } + set indexCount(e) { + this._cursor.indexCount = e; + } + get vertexFrom() { + return this._cursor.vertexFrom; + } + set vertexFrom(e) { + this._cursor.vertexFrom = e; + } + get vertexCount() { + return this._cursor.vertexCount; + } + set vertexCount(e) { + this._cursor.vertexCount = e; + } + get sortKey() { + return this._cursor.sortKey; + } + set sortKey(e) { + this._cursor.sortKey = e; + } + get index() { + return this._cursor._indexStart + this._cursor._index; + } + seekIndex(e) { + let i = e; + for (this._cursor = this._head; this._cursor; ) { + const r = this._cursor.size(); + if (i < r) + return this._cursor._index = i, !0; + i -= r, this._cursor = this._cursor._link; + } + return !1; + } + forEach(e) { + const i = this.getCursor(); + for (; i.next(); ) + e(i); + } + link(e) { + if (!this._head) + return void (this._head = e._head); + let i = this._head; + for (; i._link; ) + i = i._link; + i._link = e._head, i._link._indexStart = i._indexStart + i.size(); + } + getCursor() { + return this.copy(); + } + lookup(e) { + for (this._cursor = this._head; this._cursor && !this._cursor.lookup(e); ) { + if (!this._cursor._link) + return !1; + this._cursor = this._cursor._link; + } + return !!this._cursor; + } + copy() { + const e = new aDe(this._head?.copy()); + if (!e._head) + return e; + let i = e._head, r = e._head._link; + for (; r; ) + i._link = r.copy(), i = r, r = i._link; + return e; + } + next() { + return !!this._cursor && (!!this._cursor.next() || !!this._cursor._link && (this._cursor = this._cursor._link, this.next())); + } + peekId() { + return this._cursor.peekId() ?? this._cursor._link.peekId(); + } + delete(e) { + let i = this._head, r = null; + for (; i; ) { + if (i.delete(e)) + return i.isEmpty() && (_e(r) && (r._link = i._link), i === this._head && (this._head = i._link), i === this._cursor && (this._cursor = i._link)), !0; + r = i, i = i._link; + } + return !1; + } +}; +A7.ELEMENTS_PER_RECORD = lee, A7.BYTES_PER_RECORD = A7.ELEMENTS_PER_RECORD * Int32Array.BYTES_PER_ELEMENT; +let s6 = class Xf { + constructor(e) { + this._link = null, this._index = -1, this._indexStart = 0, this._packedRecordsF32 = null, this._deletedCount = 0, this._offsets = { instance: null }, this._packedRecords = e; + } + static from(e, i = 0, r = e.byteLength / this.BYTES_PER_RECORD - i) { + return new Xf(new Int32Array(e, i * this.BYTES_PER_RECORD, r * this.ELEMENTS_PER_RECORD)); + } + delete(e) { + const i = this._index, r = this.lookup(e); + if (r) + for (this.id = uae, ++this._deletedCount; this.next() && this.id === e; ) + this.id = uae, ++this._deletedCount; + return this._index = i, r; + } + isEmpty() { + return this._deletedCount === this.size(); + } + link(e) { + this._link ? this._link.link(e) : this._link = e; + } + lookup(e) { + if (ut(this._offsets.instance)) { + this._offsets.instance = /* @__PURE__ */ new Map(); + const r = this.copy(); + r._index = -1; + let n = 0; + for (; r.next(); ) + r.id !== n && (this._offsets.instance.set(r.id, r._index), n = r.id); + } + if (!this._offsets.instance.has(e)) + return !1; + const i = this._index; + return this._index = this._offsets.instance.get(e), this.id !== uae || (this._index = i, !1); + } + get id() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD]; + } + set id(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD] = e; + } + get materialKey() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 1]; + } + set materialKey(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 1] = e; + } + get insertAfter() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 2]; + } + get indexFrom() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 3]; + } + set indexFrom(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 3] = e; + } + get indexCount() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 4]; + } + set indexCount(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 4] = e; + } + get vertexFrom() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 5]; + } + set vertexFrom(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 5] = e; + } + get vertexCount() { + return this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 6]; + } + set vertexCount(e) { + this._packedRecords[this._index * Xf.ELEMENTS_PER_RECORD + 6] = e; + } + get sortKey() { + return this._packedRecordsF32 || (this._packedRecordsF32 = new Float32Array(this._packedRecords.buffer)), this._packedRecordsF32[this._index * Xf.ELEMENTS_PER_RECORD + 7]; + } + set sortKey(e) { + this._packedRecordsF32 || (this._packedRecordsF32 = new Float32Array(this._packedRecords.buffer)), this._packedRecordsF32[this._index * Xf.ELEMENTS_PER_RECORD + 7] = e; + } + get index() { + return this._index; + } + size() { + return this._packedRecords.length / Xf.ELEMENTS_PER_RECORD; + } + next() { + for (; ++this._index < this.size() && this.id === uae; ) + ; + return this._index < this.size(); + } + peekId() { + const e = (this._index + 1) * Xf.ELEMENTS_PER_RECORD; + return e >= this._packedRecords.length ? 0 : this._packedRecords[e]; + } + getCursor() { + return this.copy(); + } + copy() { + const e = new Xf(this._packedRecords); + return e._indexStart = this._indexStart, e._link = this._link, e._index = this._index, e._offsets = this._offsets, e._deletedCount = this._deletedCount, e; + } +}; +s6.ELEMENTS_PER_RECORD = lee, s6.BYTES_PER_RECORD = s6.ELEMENTS_PER_RECORD * Int32Array.BYTES_PER_ELEMENT; +let y2e = class lDe { + constructor(e, i) { + this.data = e, this.stride = i; + } + static decode(e) { + const i = mfe(e.data, e.stride), r = e.stride; + return new lDe(i, r); + } + static fromVertexVector(e) { + const i = mfe(e.data.buffer(), e.stride), r = e.stride; + return new lDe(i, r); + } +}, SDt = class Cce { + constructor(e, i, r) { + this.geometryType = e, this.indexBuffer = new Uint32Array(i), this.namedBuffers = r; + } + static decode(e) { + const i = e.geometryType, r = e.indexBuffer, n = {}; + for (const s in e.namedBuffers) + n[s] = y2e.decode(e.namedBuffers[s]); + return new Cce(i, r, n); + } + static fromVertexData(e, i) { + const r = e.indices, n = mfe(e.vertices, e.stride), s = e.stride, o = { geometry: new y2e(n, s) }; + return new Cce(i, r, o); + } + static fromVertexVectors(e) { + const i = e.geometryType, r = e.indexVector.buffer(), n = {}; + for (const s in e.namedVectors) + n[s] = y2e.fromVertexVector(e.namedVectors[s]); + return new Cce(i, r, n); + } +}; +const dlr = 1.25; +let XD = class { + get length() { + return this._pos; + } + constructor(e, i) { + this._pos = 0; + const r = i ? this._roundToNearest(i, e.BYTES_PER_ELEMENT) : 40; + this._array = new ArrayBuffer(r), this._buffer = new e(this._array), this._ctor = e, this._i16View = new Int16Array(this._array); + } + _roundToNearest(e, i) { + const r = Math.round(e); + return r + (i - r % i); + } + _ensureSize(e) { + if (this._pos + e >= this._buffer.length) { + const i = this._roundToNearest((this._array.byteLength + e * this._buffer.BYTES_PER_ELEMENT) * dlr, this._buffer.BYTES_PER_ELEMENT), r = new ArrayBuffer(i), n = new this._ctor(r); + n.set(this._buffer, 0), this._array = r, this._buffer = n, this._i16View = new Int16Array(this._array); + } + } + ensureSize(e) { + this._ensureSize(e); + } + writeF32(e) { + this._ensureSize(1); + const i = this._pos; + return new Float32Array(this._array, 4 * this._pos, 1)[0] = e, this._pos++, i; + } + push(e) { + this._ensureSize(1); + const i = this._pos; + return this._buffer[this._pos++] = e, i; + } + writeFixed(e) { + this._buffer[this._pos++] = e; + } + setValue(e, i) { + this._buffer[e] = i; + } + i1616Add(e, i, r) { + this._i16View[2 * e] += i, this._i16View[2 * e + 1] += r; + } + getValue(e) { + return this._buffer[e]; + } + incr(e) { + if (this._buffer.length < e) + throw new Error("Increment index overflows the target buffer"); + this._buffer[e]++; + } + decr(e) { + this._buffer[e]--; + } + writeRegion(e) { + this._ensureSize(e.length); + const i = this._pos; + return this._buffer.set(e, this._pos), this._pos += e.length, i; + } + writeManyFrom(e, i, r) { + this._ensureSize(r - i); + for (let n = i; n !== r; n++) + this.writeFixed(e._buffer[n]); + } + buffer() { + const e = this._array.slice(0, 4 * this._pos); + return this.destroy(), e; + } + toArray() { + const e = this._array, i = []; + for (let r = 0; r < e.byteLength / 4; r++) + i.push(e[r]); + return i; + } + seek(e) { + this._pos = e; + } + destroy() { + this._array = null, this._buffer = null; + } +}, plr = class { + get vertexCount() { + const e = this.stride / 4, i = this.data.length / e; + return i !== (0 | i) && console.debug("Corrupted stride"), i; + } + constructor(e, i) { + this.data = e, this.stride = i; + } + transfer(e, i) { + const r = this.data.buffer(); + e.vertexCount = this.vertexCount, e.data = r, e.stride = this.stride, i.push(r); + } +}, flr = class { + constructor(e, i, r) { + this.geometryType = e, this.indexVector = new XD(Uint32Array, 6 * i), this.namedVectors = {}; + const n = ffe(e, r); + for (const s in n) { + const o = n[s]; + let a; + switch (o % 4) { + case 0: + case 2: + a = new XD(Uint32Array, o * i); + break; + case 1: + case 3: + a = new XD(Uint8Array, o * i); + } + this.namedVectors[s] = new plr(a, o); + } + } + get(e) { + return this.namedVectors[e].data; + } + getVector(e) { + return this.namedVectors[e]; + } + transfer(e, i) { + const r = this.indexVector.buffer(), n = {}; + i.push(r); + for (const s in this.namedVectors) { + const o = this.namedVectors[s]; + n[s] = {}, o.transfer(n[s], i); + } + e.geometryType = this.geometryType, e.indexBuffer = r, e.namedBuffers = n, this.destroy(); + } + intoBuffers() { + const e = SDt.fromVertexVectors(this); + return this.destroy(), e; + } + destroy() { + this.indexVector = null, this.namedVectors = null; + } +}; +const cae = new fDt(), AB = new fDt(), est = 1.5, mlr = 5; +function glr(t, e) { + const i = {}; + for (const r in t) { + const n = { data: D8e(e, t[r]), stride: t[r] }; + i[r] = n; + } + return i; +} +function ylr(t) { + return [t.fill || {}, t.line || {}, t.icon || {}, t.text || {}, t.label || {}]; +} +function vlr(t) { + const e = [[], [], [], [], []], i = t; + for (const r of i) + for (const n of r.displayRecords) + e[n.geometryType].push(n); + return e; +} +let tst = class BM { + constructor() { + this.tileDisplayData = null, this.tileBufferData = null; + } + reshuffle() { + if (cae.reset(), !this.tileDisplayData) + return; + const e = vlr(this.tileDisplayData.displayObjects); + for (const o of e) + for (const a of o) + a && cae.needMore(a.geometryType, a.meshData ? a.meshData.vertexCount : a.vertexCount, a.meshData ? a.meshData.indexData.length : a.indexCount); + const i = e.length, r = new m2e(); + for (let o = 0; o < i; ++o) { + r.geometries[o].indexBuffer = new Uint32Array(Math.round(est * cae.indicesFor(o))); + const a = [], l = this.tileBufferData?.geometries[o].vertexBuffer; + if (!l) + continue; + for (const y in l) + a.push(l[y].stride); + const c = BM._computeVertexAlignment(a), h = Math.round(est * cae.verticesFor(o)), p = BM._align(h, c); + for (const y in l) { + const v = l[y].stride; + r.geometries[o].vertexBuffer[y] = { stride: v, data: D8e(p, v) }; + } + } + AB.reset(), this.tileDisplayData.displayList?.clear(); + for (let o = 0; o < i; ++o) { + const a = e[o]; + for (const l of a) { + if (l.meshData) + l.writeMeshDataToBuffers(AB.verticesFor(o), r.geometries[o].vertexBuffer, AB.indicesFor(o), r.geometries[o].indexBuffer), l.meshData = null; + else { + const c = this.tileBufferData?.geometries[o]; + if (c) { + const h = c.vertexBuffer, p = c.indexBuffer, y = r.geometries[o].vertexBuffer, v = r.geometries[o].indexBuffer, x = AB.verticesFor(o), I = AB.indicesFor(o); + yRe(x, I, y, v, l, h, p), l.vertexFrom = x, l.indexFrom = I; + } + } + AB.needMore(o, l.vertexCount, l.indexCount); + } + } + const { displayList: n, displayObjects: s } = this.tileDisplayData; + if (n) + for (const o of s) + n.addToList(o.displayRecords); + this.tileBufferData = r; + } + getStrides() { + const e = [], i = this.tileBufferData?.geometries; + if (!i) + return e; + for (let r = 0; r < i.length; ++r) { + const n = i[r]; + e[r] = {}; + for (const s in n.vertexBuffer) + e[r][s] = n.vertexBuffer[s].stride; + } + return e; + } + clone() { + const e = new BM(); + return e.tileBufferData = this.tileBufferData?.clone() ?? null, e.tileDisplayData = this.tileDisplayData?.clone() ?? null, e; + } + _guessSize() { + const e = this.tileDisplayData?.displayObjects ?? [], i = Math.min(e.length, 4), r = 12, n = 40; + let s = 0; + for (let o = 0; o < i; o++) + s = Math.max(s, e[o].displayRecords.length); + return 2 * (e.length * r + e.length * s * n); + } + serialize() { + const e = this.tileBufferData.serialize(), i = this.tileBufferData.getBuffers(), r = this.tileDisplayData.serialize(new XD(Int32Array, this._guessSize())).buffer(); + return i.push(r), { result: { displayData: r, bufferData: e }, transferList: i }; + } + static fromVertexData(e, i) { + const r = {}, n = /* @__PURE__ */ new Map(); + for (const s of i) + n.set(s.id, s); + return vRe((s) => { + const o = e.data[s]; + if (_e(o)) { + const a = A7.from(o.records).getCursor(); + for (; a.next(); ) { + const l = a.id, c = a.materialKey, h = a.indexFrom, p = a.indexCount, y = a.vertexFrom, v = a.vertexCount, x = n.get(l), I = new nDe(l, s, c); + I.indexFrom = h, I.indexCount = p, I.vertexFrom = y, I.vertexCount = v, x.displayRecords.push(I); + } + r[s] = SDt.fromVertexData(o, s); + } else + r[s] = new flr(s, 0, Zo.DEFAULT).intoBuffers(); + }), BM.fromMeshData({ displayObjects: i, vertexBuffersMap: r }); + } + static fromMeshData(e) { + const i = new BM(), r = new Qnt(), n = new m2e(); + r.displayObjects = e.displayObjects; + for (const s in e.vertexBuffersMap) { + const o = e.vertexBuffersMap[s]; + n.geometries[s].indexBuffer = o.indexBuffer, n.geometries[s].vertexBuffer = o.namedBuffers; + } + return i.tileDisplayData = r, i.tileBufferData = n, i; + } + static bind(e, i) { + const r = new BM(); + return r.tileDisplayData = e, r.tileBufferData = i, r; + } + static create(e, i) { + const r = new BM(); + r.tileDisplayData = new Qnt(), r.tileDisplayData.displayObjects = e; + const n = [0, 0, 0, 0, 0], s = [0, 0, 0, 0, 0], o = [[], [], [], [], []]; + for (const c of e) + for (const h of c.displayRecords) + o[h.geometryType].push(h), n[h.geometryType] += h.meshData.vertexCount, s[h.geometryType] += h.meshData.indexData.length; + const a = new m2e(), l = ylr(i); + for (let c = 0; c < mlr; c++) { + const h = new Uint32Array(s[c]), p = glr(l[c], n[c]); + nDe.writeAllMeshDataToBuffers(o[c], p, h), a.geometries[c] = { indexBuffer: h, vertexBuffer: p }; + } + return r.tileBufferData = a, r; + } + static _align(e, i) { + const r = e % i; + return r === 0 ? e : e + (i - r); + } + static _computeVertexAlignment(e) { + let i = !1, r = !1; + for (const n of e) + n % 4 == 2 ? i = !0 : n % 4 != 0 && (r = !0); + return r ? 4 : i ? 2 : 1; + } +}; +const nj = /* @__PURE__ */ new Map(); +function _lr(t, e, i) { + const { indicesPerRecord: r, multiplier: n, verticesPerRecord: s } = nj.get(t); + return { recordBytes: i * lee * Uint32Array.BYTES_PER_ELEMENT, indexBytes: n * r * i * Uint32Array.BYTES_PER_ELEMENT, vertexBytes: n * s * i * e }; +} +nj.set(En.MARKER, { multiplier: 1, indicesPerRecord: 6, verticesPerRecord: 4 }), nj.set(En.LINE, { multiplier: 1, indicesPerRecord: 24, verticesPerRecord: 8 }), nj.set(En.FILL, { multiplier: 1, indicesPerRecord: 10, verticesPerRecord: 10 }), nj.set(En.TEXT, { multiplier: 8, indicesPerRecord: 6, verticesPerRecord: 4 }), nj.set(En.LABEL, { multiplier: 8, indicesPerRecord: 6, verticesPerRecord: 4 }); +let ist = class { + constructor(e, i, r) { + this._start = { index: 0, vertex: 0 }; + const n = _lr(e, i, r), s = i / 4; + this.geometryType = e, this._records = new XD(Int32Array, n.recordBytes), this._indices = new XD(Uint32Array, n.indexBytes), this._vertices = new XD(Uint32Array, n.vertexBytes), this._metrics = new XD(Float32Array, 0), this._strideInt = s; + } + serialize(e) { + const i = this._records.buffer(), r = this._indices.buffer(), n = this._vertices.buffer(), s = this._metrics.length ? this._metrics.buffer() : null, o = 4 * this._strideInt; + return e.push(i, r, n), { stride: o, records: i, indices: r, vertices: n, metrics: s }; + } + get strideInt() { + return this._strideInt; + } + get recordCount() { + return this._records.length / lee; + } + get vertexCount() { + return this._vertices.length / this._strideInt; + } + get indexCount() { + return this._indices.length; + } + get indexWriter() { + return this._indices; + } + get vertexWriter() { + return this._vertices; + } + get metricWriter() { + return this._metrics; + } + vertexEnsureSize(e) { + this._vertices.ensureSize(e); + } + indexEnsureSize(e) { + this._indices.ensureSize(e); + } + recordStart() { + this._start.index = this._indices.length, this._start.vertex = this._vertices.length; + } + recordEnd(e, i, r, n, s, o, a, l) { + this._records.push(e), this._records.push(i ?? 0), this._records.push(r), this._records.push(n), this._records.push(s), this._records.push(o), this._records.push(a), this._records.writeF32(l); + } + writeIndex(e) { + this._indices.push(e); + } + writeVertex(e) { + this._vertices.push(e); + } + writeVertexF32(e) { + this._vertices.writeF32(e); + } + copyLastFrom(e, i, r) { + const n = e._records.length - lee, s = e._records.getValue(n), o = e._records.getValue(n + 1), a = e._records.getValue(n + 2), l = e._records.getValue(n + 4), c = e._records.getValue(n + 6), h = e._records.getValue(n + 7), p = this._vertices.length, y = (e._start.vertex - this._vertices.length) / this._strideInt, v = this._indices.length, x = this.vertexCount; + for (let I = e._start.index; I !== e._indices.length; I++) { + const P = e._indices.getValue(I); + this._indices.push(P - y); + } + for (let I = e._start.vertex; I !== e._vertices.length; I++) { + const P = e._vertices.getValue(I); + this._vertices.push(P); + } + for (let I = p; I <= this._vertices.length; I += this._strideInt) + this._vertices.i1616Add(I, i, r); + this._records.push(s), this._records.push(o), this._records.push(a), this._records.push(v), this._records.push(l), this._records.push(x), this._records.push(c), this._records.push(h); + } +}; +function mP(t, e, i, r) { + const n = t.clone(), s = 1 << n.level, o = n.col + e, a = n.row + i; + return r && o < 0 ? (n.col = o + s, n.world -= 1) : o >= s ? (n.col = o - s, n.world += 1) : n.col = o, n.row = a, n; +} +const kve = 1, k9e = 2, $ve = 4, $9e = 8, B9e = 16, Bve = 32, V9e = 64, Vve = 128; +function rst(t) { + switch (t) { + case kve: + case $9e: + case Bve: + return -1; + case k9e: + case V9e: + return 0; + case $ve: + case B9e: + case Vve: + return 1; + } +} +function nst(t) { + switch (t) { + case kve: + case k9e: + case $ve: + return -1; + case $9e: + case B9e: + return 0; + case Bve: + case V9e: + case Vve: + return 1; + } +} +const sst = kve | $9e | Bve, ost = $ve | B9e | Vve, ast = kve | k9e | $ve, lst = Bve | V9e | Vve; +let CDt = class { + constructor(e, i, r, n, s, o = 0) { + this._hasAggregate = !1, this.hasRecords = !1, this._data = { self: /* @__PURE__ */ new Map(), neighbors: new Array() }, this._version = 0, this._current = { geometryType: 0, writer: null, overlaps: 0, start: 0, insertAfter: 0, sortKey: 0, id: 0, materialKey: 0, indexStart: 0, vertStart: 0, isDotDensity: !1, bufferingEnabled: !1, metricBoxLenPointer: 0 }, this.hint = i, this.tileKey = e, this._hasAggregate = n, this._pixelBufferEnabled = s, this._version = o, this._symbologyType = r; + } + get hasAggregates() { + return this._hasAggregate; + } + get hasPixelBufferEnabled() { + return this._pixelBufferEnabled; + } + serialize(e) { + const i = []; + return i.push(this._serializeTileVertexData(this.tileKey, this.tileKey, this._data.self)), this._data.neighbors.forEach((r, n) => { + const s = 1 << n, o = rst(s), a = nst(s), l = mP(new Lh(this.tileKey), o, a, e), c = this._serializeTileVertexData(this.tileKey, l.id, r.vertexData); + c.message.bufferIds = r.displayIds, i.push(c); + }), i; + } + _serializeTileVertexData(e, i, r) { + const n = new Array(); + return { message: { tileKeyOrigin: e, tileKey: i, data: { [En.MARKER]: r.get(En.MARKER)?.serialize(n), [En.FILL]: r.get(En.FILL)?.serialize(n), [En.LINE]: r.get(En.LINE)?.serialize(n), [En.TEXT]: r.get(En.TEXT)?.serialize(n), [En.LABEL]: r.get(En.LABEL)?.serialize(n) }, version: this._version }, transferList: n }; + } + featureStart(e, i) { + this._current.insertAfter = e, this._current.sortKey = i; + } + featureEnd() { + } + recordStart(e, i, r, n) { + this._current.writer = this._getVertexWriter(r), this._current.overlaps = 0, this._current.indexStart = this._current.writer.indexCount, this._current.vertStart = this._current.writer.vertexCount, this._current.bufferingEnabled = n, this._current.id = e, this._current.materialKey = i, this._current.geometryType = r, this._current.isDotDensity = !1, this._current.writer.recordStart(); + } + recordCount() { + return this._current.writer.recordCount; + } + vertexCount() { + return this._current.writer.vertexCount; + } + indexCount() { + return this._current.writer.indexCount; + } + vertexEnsureSize(e) { + this._current.writer.vertexEnsureSize(e); + } + indexEnsureSize(e) { + this._current.writer.indexEnsureSize(e); + } + vertexBounds(e, i, r, n) { + this._current.bufferingEnabled && this._addOverlap(e, i, r, n); + } + vertexWrite(e) { + this._current.writer.writeVertex(e); + } + vertexWriteF32(e) { + this._current.writer.writeVertexF32(e); + } + vertexEnd() { + } + vertexWriter() { + return this._current.writer.vertexWriter; + } + indexWrite(e) { + this._current.writer.writeIndex(e); + } + indexWriter() { + return this._current.writer.indexWriter; + } + metricWriter() { + return this._current.writer.metricWriter; + } + metricStart(e, i, r, n, s, o, a, l) { + this._current.writer = this._getVertexWriter(En.LABEL); + const c = this._current.writer.metricWriter; + c.push(pO(e)), c.push(i), c.push(r), c.push(n), c.push(s), c.push(o), c.push(a), c.push(l), c.push(255), this._current.metricBoxLenPointer = c.push(0); + } + metricEnd() { + const e = this._current.writer.metricWriter; + e.getValue(this._current.metricBoxLenPointer) === 0 && e.seek(e.length - 10); + } + metricBoxWrite(e, i, r, n) { + const s = this._current.writer.metricWriter; + s.incr(this._current.metricBoxLenPointer), s.push(0), s.push(0), s.push(e), s.push(i), s.push(r), s.push(n); + } + recordEnd() { + const e = this._current.vertStart, i = this._current.writer.vertexCount - e; + if (!i) + return !1; + this.hasRecords = !0; + const r = this._current.indexStart, n = this._current.writer.indexCount - r; + if (this._current.writer.recordEnd(this._current.id, this._current.materialKey, this._current.insertAfter, r, n, e, i, this._current.sortKey), !this._pixelBufferEnabled || this._hasAggregate || this._current.overlaps === 0 || this._current.geometryType === En.LABEL) + return !0; + const s = this._current.writer; + for (let o = 0; o < 8; o++) { + const a = 1 << o; + if (this._current.overlaps & a) { + this._data.neighbors[o] || (this._data.neighbors[o] = { vertexData: /* @__PURE__ */ new Map(), displayIds: /* @__PURE__ */ new Set() }); + const l = this._data.neighbors[o], c = this._current.geometryType; + if (!l.vertexData.has(c)) { + const x = ffe(c, this._symbologyType).geometry, I = new ist(c, x, z8i); + l.vertexData.set(c, I); + } + const h = l.vertexData.get(this._current.geometryType), p = 8, y = 512 * -rst(a) * p, v = 512 * -nst(a) * p; + h?.copyLastFrom(s, y, v), l.displayIds.add(this._current.id); + } + } + return !0; + } + _addOverlap(e, i, r, n) { + const s = 255 ^ ((e < 0 + r ? ost : e >= Sc - r ? sst : ost | sst) | (i < 0 + n ? lst : i >= Sc - n ? ast : lst | ast)); + this._current.overlaps |= s; + } + _getVertexWriter(e) { + if (!this._data.self.has(e)) { + const i = this._data.self, r = ffe(e, this._symbologyType).geometry; + i.set(e, new ist(e, r, this.hint.records)); + } + return this._data.self.get(e); + } +}; +const JE = 0, ZE = 100; +function ust(t, e, i) { + return t[0] = e[0] - i[0], t[1] = e[1] - i[1], t; +} +function TDt(t, e) { + return Math.sqrt(t * t + e * e); +} +function cst(t) { + const e = TDt(t[0], t[1]); + t[0] /= e, t[1] /= e; +} +function blr(t, e) { + return TDt(t[0] - e[0], t[1] - e[1]); +} +function zl(t) { + return typeof t == "function"; +} +function uDe(t = 2) { + return 1 / Math.max(t, 1); +} +function Q4(t, e) { + return [!!t?.minScale && e.scaleToZoom(t.minScale) || JE, !!t?.maxScale && e.scaleToZoom(t.maxScale) || ZE]; +} +function wlr(t, e) { + return t[e + 1]; +} +function EDt(t) { + return t.length - 1; +} +function xlr(t) { + let e = 0; + for (let i = 0; i < EDt(t); i++) + e += Slr(t, i); + return e; +} +function Slr(t, e, i = 1) { + const [r, n] = wlr(t, e); + return Math.sqrt(r * r + n * n) * i; +} +let Clr = class cDe { + constructor(e, i, r, n, s) { + this._segments = e, this._index = i, this._distance = r, this._xStart = n, this._yStart = s, this._done = !1; + } + static create(e) { + return new cDe(e, 0, 0, e[0][0], e[0][1]); + } + clone() { + return new cDe(this._segments, this._index, this._distance, this.xStart, this.yStart); + } + equals(e) { + return this._index === e._index || e._index === this._index - 1 && (this._distance === 0 || e._distance === 1) || e._index === this._index + 1 && (this._distance === 1 || e._distance === 0); + } + leq(e) { + return this._index < e._index || this._index === e._index && this._distance <= e._distance; + } + geq(e) { + return this._index > e._index || this._index === e._index && this._distance >= e._distance; + } + get _segment() { + return this._segments[this._index + 1]; + } + get angle() { + const e = this.dy, i = (0 * e + -1 * -this.dx) / (1 * this.length); + let r = Math.acos(i); + return e > 0 && (r = 2 * Math.PI - r), r; + } + get xStart() { + return this._xStart; + } + get yStart() { + return this._yStart; + } + get x() { + return this.xStart + this.distance * this.dx; + } + get y() { + return this.yStart + this.distance * this.dy; + } + get dx() { + return this._segment[0]; + } + get dy() { + return this._segment[1]; + } + get xMidpoint() { + return this.xStart + 0.5 * this.dx; + } + get yMidpoint() { + return this.yStart + 0.5 * this.dy; + } + get xEnd() { + return this.xStart + this.dx; + } + get yEnd() { + return this.yStart + this.dy; + } + get length() { + const { dx: e, dy: i } = this; + return Math.sqrt(e * e + i * i); + } + get remainingLength() { + return this.length * (1 - this._distance); + } + get backwardLength() { + return this.length * this._distance; + } + get distance() { + return this._distance; + } + get done() { + return this._done; + } + hasPrev() { + return this._index - 1 >= 0; + } + hasNext() { + return this._index + 1 < EDt(this._segments); + } + next() { + return this.hasNext() ? (this._xStart += this.dx, this._yStart += this.dy, this._distance = 0, this._index += 1, this) : null; + } + prev() { + return this.hasPrev() ? (this._index -= 1, this._xStart -= this.dx, this._yStart -= this.dy, this._distance = 1, this) : (this._done = !0, null); + } + _seekBackwards(e, i) { + const r = this.backwardLength; + if (e <= r) + return this._distance = (r - e) / this.length, this; + let n = this.backwardLength; + for (; this.prev(); ) { + if (n + this.length > e) + return this._seekBackwards(e - n); + n += this.length; + } + return this._distance = 0, i ? this : null; + } + seek(e, i = !1) { + if (e < 0) + return this._seekBackwards(Math.abs(e), i); + if (e <= this.remainingLength) + return this._distance = (this.backwardLength + e) / this.length, this; + let r = this.remainingLength; + for (; this.next(); ) { + if (r + this.length > e) + return this.seek(e - r, i); + r += this.length; + } + return this._distance = 1, i ? this : null; + } +}; +function Tlr(t, e, i, r = !0) { + const n = xlr(t), s = Clr.create(t), o = n / 2; + if (!r) + return s.seek(o), void i(s.clone(), 0, o + 0 * e, n); + const a = Math.max((n - e) / 2, 0), l = Math.floor(a / e), c = o - l * e; + s.seek(c); + for (let h = -l; h <= l; h++) + s.x < 512 && s.x >= 0 && s.y < 512 && s.y >= 0 && i(s.clone(), h, o + h * e, n), s.seek(e); +} +function Elr(t, e) { + const i = e; + for (let r = 0; r < t.length; r++) { + let n = t[r]; + const s = []; + s.push(n[0]); + for (let a = 1; a < n.length; a++) { + let [l, c] = s[a - 1]; + l += n[a][0], c += n[a][1], s.push([l, c]); + } + Ilr(s, i); + const o = []; + o.push(s[0]); + for (let a = 1; a < s.length; a++) { + const [l, c] = s[a - 1], [h, p] = s[a], y = Math.round(h - l), v = Math.round(p - c); + o.push([y, v]); + } + t[r] = o, n = o; + } + return t; +} +function Ilr(t, e) { + if (e <= 0) + return; + const r = t.length; + if (r < 3) + return; + const n = []; + let s = 0; + n.push(0); + for (let p = 1; p < r; p++) + s += blr(t[p], t[p - 1]), n.push(s); + e = Math.min(e, 0.2 * s); + const o = []; + o.push(t[0][0]), o.push(t[0][1]); + const a = t[r - 1][0], l = t[r - 1][1], c = ust([0, 0], t[0], t[1]); + cst(c), t[0][0] += e * c[0], t[0][1] += e * c[1], ust(c, t[r - 1], t[r - 2]), cst(c), t[r - 1][0] += e * c[0], t[r - 1][1] += e * c[1]; + for (let p = 1; p < r; p++) + n[p] += e; + n[r - 1] += e; + const h = 0.5 * e; + for (let p = 1; p < r - 1; p++) { + let y = 0, v = 0, x = 0; + for (let I = p - 1; I >= 0 && !(n[I + 1] < n[p] - h); I--) { + const P = h + n[I + 1] - n[p], F = n[I + 1] - n[I], k = n[p] - n[I] < h ? 1 : P / F; + if (Math.abs(k) < 1e-6) + break; + const V = k * k, j = k * P - 0.5 * V * F, Y = k * F / e, X = t[I + 1], Q = t[I][0] - X[0], re = t[I][1] - X[1]; + y += Y / j * (X[0] * k * P + 0.5 * V * (P * Q - F * X[0]) - V * k * F * Q / 3), v += Y / j * (X[1] * k * P + 0.5 * V * (P * re - F * X[1]) - V * k * F * re / 3), x += Y; + } + for (let I = p + 1; I < r && !(n[I - 1] > n[p] + h); I++) { + const P = h - n[I - 1] + n[p], F = n[I] - n[I - 1], k = n[I] - n[p] < h ? 1 : P / F; + if (Math.abs(k) < 1e-6) + break; + const V = k * k, j = k * P - 0.5 * V * F, Y = k * F / e, X = t[I - 1], Q = t[I][0] - X[0], re = t[I][1] - X[1]; + y += Y / j * (X[0] * k * P + 0.5 * V * (P * Q - F * X[0]) - V * k * F * Q / 3), v += Y / j * (X[1] * k * P + 0.5 * V * (P * re - F * X[1]) - V * k * F * re / 3), x += Y; + } + o.push(y / x), o.push(v / x); + } + o.push(a), o.push(l); + for (let p = 0, y = 0; p < r; p++) + t[p][0] = o[y++], t[p][1] = o[y++]; +} +let IDt = class { + static getPlacement(e, i, r, n, s) { + const o = SRt(i); + if (!o) + return null; + const a = K3t(e); + return o.execute(a, i, r, n, s); + } +}; +const PB = 8, hx = Vn(4, 4), nme = Vn(4, 2), Vx = Vn(4, 6), hst = [nme, nme, Vx, Vx], dst = [nme, Vx, nme, Vx], Alr = [Vx, Vx, hx, hx], Plr = [hx, hx, Vx, Vx], Olr = [Vx, hx, Vx, hx], Rlr = [hx, Vx, hx, Vx], ADt = (t) => class extends t { + constructor(...e) { + super(...e), this._isCIM = !1, this._vertexBoundsScale = 1, this.geometryType = En.TEXT, this._aux = tf(0, 0, this._referenceSize, this._bitset); + } + bindTextInfo(e, i) { + e && e.length ? this._shapingInfo = Sa(e, (r) => m9e(r, i, { scale: this._scale, angle: this._angle, xOffset: this._xOffset, yOffset: this._yOffset, hAlign: this._xAlignD, vAlign: this._yAlignD, maxLineWidth: Math.max(32, Math.min(this._lineWidth, 512)), lineHeight: I8e * Math.max(0.25, Math.min(this._lineHeight, 4)), decoration: this._decoration, isCIM: this._isCIM, hasBackground: !!this._backgroundColor, borderLineSize: this._borderLineSize })) : this._shapingInfo = null; + } + _write(e, i, r, n) { + const s = i.getDisplayId(); + this._writeGeometry(e, i, s, r, n); + } + _writeGeometry(e, i, r, n, s) { + const o = this._shapingInfo; + if (ut(o)) + return; + if (_e(this._textPlacement)) { + const l = s ?? i.readLegacyGeometryForDisplay(); + return this._writePlacedText(e, r, l, o, n); + } + const a = s ? K5e(d8(s), 2) : i.geometryType === "esriGeometryPolygon" ? i.readCentroid() : i.readGeometryForDisplay(); + if (!ut(a)) { + if (a.isPoint) { + const [l, c] = a.coords; + return !e.hasAggregates && e.hasPixelBufferEnabled && (l < 0 || l >= 512 || c < 0 || c >= 512) ? void 0 : this._writeGlyphs(e, r, { x: l, y: c }, o); + } + a.forEachVertex((l, c) => this._writeGlyphs(e, r, { x: l, y: c }, o)); + } + } + _writePlacedText(e, i, r, n, s) { + const o = this._textPlacement, a = IDt.getPlacement(r, o, dn(1), e.tileKey, s.geometryEngine); + if (!a) + return; + let l = a.next(); + for (; l != null; ) { + const c = -l.getAngle(); + n.setRotation(c); + const h = l.tx, p = -l.ty; + h < 0 || h >= 512 || p < 0 || p >= 512 || (this._writeGlyphs(e, i, { x: h, y: p }, n), n.setRotation(-c)), l = a.next(); + } + } + _writeGlyphs(e, i, r, n) { + const s = _1.load(this._materialKey), o = Vn(Math.round(PB * r.x), Math.round(PB * r.y)), a = this._vertexBoundsScale, { bounds: l, background: c, glyphs: h } = n; + h.length > 0 && (this._borderLineColor || this._backgroundColor) && (s.textureBinding = h[0].textureBinding, e.recordStart(i, s.data, this.geometryType, !0), this._writeBackgroundGeometry(e, i, r, l, c), e.recordEnd()); + const p = 2 * Math.max(l.width, l.height); + for (const y of n.glyphs) + s.textureBinding = y.textureBinding, e.recordStart(i, s.data, this.geometryType, !0), e.vertexBounds(r.x + l.x + this._xOffset, r.y + l.y - this._yOffset, p * a, p * a), this._writeVertices(e, i, o, y), e.recordEnd(); + } + _writeGlyph(e, i, r, n, s) { + const o = _1.load(this._materialKey), a = Vn(Math.round(PB * r), Math.round(PB * n)); + o.textureBinding = s.textureBinding, e.recordStart(i, o.data, this.geometryType, !0); + const l = s.bounds, c = this._vertexBoundsScale; + e.vertexBounds(r + l.x * c, n + l.y * c, l.width * c, l.height * c), this._writeVertices(e, i, a, s), e.recordEnd(); + } + _writeVertices(e, i, r, n) { + const s = e.vertexCount(); + this._writeVertexCommon(e, i, r, n), e.vertexWrite(n.offsets.upperLeft), e.vertexWrite(n.texcoords.upperLeft), e.vertexEnd(), this._writeVertexCommon(e, i, r, n), e.vertexWrite(n.offsets.upperRight), e.vertexWrite(n.texcoords.upperRight), e.vertexEnd(), this._writeVertexCommon(e, i, r, n), e.vertexWrite(n.offsets.lowerLeft), e.vertexWrite(n.texcoords.lowerLeft), e.vertexEnd(), this._writeVertexCommon(e, i, r, n), e.vertexWrite(n.offsets.lowerRight), e.vertexWrite(n.texcoords.lowerRight), e.vertexEnd(), e.indexWrite(s + 0), e.indexWrite(s + 1), e.indexWrite(s + 2), e.indexWrite(s + 1), e.indexWrite(s + 3), e.indexWrite(s + 2); + } + _writeVertexCommon(e, i, r, n) { + const s = this._color, o = this._haloColor, a = tf(0, 0, this._referenceSize, this._bitset), l = tf(0, 0, this._size, this._haloSize); + e.vertexWrite(r), e.vertexWrite(i), e.vertexWrite(s), e.vertexWrite(o), e.vertexWrite(l), e.vertexWrite(a), e.vertexWrite(this._minMaxZoom); + } + _writeBackgroundVertex(e, i, r, n, s, o) { + const a = tf(0, 1, this._referenceSize, this._bitset), l = tf(0, 0, this._size, this._haloSize), c = tf(0, 0, 0, 0); + e.vertexWrite(r), e.vertexWrite(i), e.vertexWrite(n), e.vertexWrite(c), e.vertexWrite(l), e.vertexWrite(a), e.vertexWrite(this._minMaxZoom), e.vertexWrite(s), e.vertexWrite(o), e.vertexEnd(); + } + _writeBackgroundQuad(e, i, r, n, s, o) { + const a = e.vertexCount(); + this._writeBackgroundVertex(e, i, r, n, s.upperLeft, o[0]), this._writeBackgroundVertex(e, i, r, n, s.upperRight, o[1]), this._writeBackgroundVertex(e, i, r, n, s.lowerLeft, o[2]), this._writeBackgroundVertex(e, i, r, n, s.lowerRight, o[3]), e.indexWrite(a + 0), e.indexWrite(a + 1), e.indexWrite(a + 2), e.indexWrite(a + 1), e.indexWrite(a + 3), e.indexWrite(a + 2); + } + _writeBackgroundGeometry(e, i, r, n, s) { + const o = Vn(Math.round(PB * r.x), Math.round(PB * r.y)), { x: a, y: l, width: c, height: h } = n, p = 2 * Math.max(c, h); + if (e.vertexBounds(r.x + a + this._xOffset, r.y + l - this._yOffset, p * this._vertexBoundsScale, p * this._vertexBoundsScale), this._backgroundColor) { + const y = [hx, hx, hx, hx]; + this._writeBackgroundQuad(e, i, o, this._backgroundColor, s.main, y); + } + if (this._borderLineColor || this._backgroundColor) { + const y = !!this._borderLineColor && !!this._borderLineSize && this._borderLineSize > 0, [v, x, I, P, F] = y ? [hst, hst, dst, dst, this._borderLineColor] : [Alr, Plr, Olr, Rlr, this._backgroundColor]; + this._writeBackgroundQuad(e, i, o, F, s.top, v), this._writeBackgroundQuad(e, i, o, F, s.bot, x), this._writeBackgroundQuad(e, i, o, F, s.left, I), this._writeBackgroundQuad(e, i, o, F, s.right, P); + } + } +}; +let ore = class { + constructor() { + this._materialKey = null; + } + bindFeature(e, i, r) { + } + write(e, i, r, n) { + if (ut(this._effects) || this._effects?.length === 0) + return this._write(e, i, n); + const s = rZ.executeEffects(this._effects, i.readLegacyGeometryForDisplay(), e.tileKey, n.geometryEngine); + let o = rZ.next(s); + for (; o; ) + this._write(e, i, n, o), o = rZ.next(s); + } + _write(e, i, r, n) { + } +}; +const Mlr = 5; +let hDe = class dDe extends ADt(ore) { + constructor(e, i, r, n, s, o, a, l, c, h, p, y, v, x, I, P, F, k, V, j, Y, X, Q, re) { + super(), this._xOffset = dn(v), this._yOffset = dn(x), this._decoration = h || "none", this._backgroundColor = X, this._borderLineColor = Q, this._borderLineSize = re, this._color = s, this._haloColor = o, this._haloSize = Math.min(Math.floor(Mlr * dn($a(r))), 127), this._size = Math.min(Math.round(dn(i)), 127); + const he = Math.min(Math.round(dn(n || i)), 127); + this._referenceSize = Math.round(Math.sqrt(256 * he)), this._scale = this._size / hve, this._angle = y, this._justify = jQi(a || "center"), this._xAlignD = TRt(a || "center"), this._yAlignD = ERt(l || "baseline"), this._baseline = (l || "baseline") === "baseline", this._bitset = (c === vy.MAP ? 1 : 0) | (p ? 1 : 0) << 1; + const fe = _1.load(e); + fe.sdf = !0, this._materialKey = fe.data, this._lineWidth = dn(I) || 512, this._lineHeight = P || 1, this._textPlacement = F, this._effects = k, this._isCIM = V ?? !1, this._minMaxZoom = Vn(Math.round(j * Dy), Math.round(Y * Dy)); + } + static fromText(e, i) { + const r = e.font?.size, n = new dDe(e.materialKey, r, e.haloSize || 0, r, e.color && Eb(e.color) || 0, e.haloColor && Eb(e.haloColor) || 0, e.horizontalAlignment, e.verticalAlignment, vy.SCREEN, e.font?.decoration, !1, e.angle || 0, e.xoffset || 0, e.yoffset || 0, e.lineWidth || 0, e.lineHeight || 0, null, null, !1, JE, ZE, e.backgroundColor && Eb(e.backgroundColor), e.borderLineColor && Eb(e.borderLineColor), e.borderLineSize), [, s] = c4(e.text); + return n.bindTextInfo(i ?? [], s), n._vertexBoundsScale = e.maxVVSize && r ? e.maxVVSize / r : 1, n; + } + static fromCIMText(e, i, r) { + const n = e.scaleFactor || 1, s = e.size * e.sizeRatio * n, [o, a] = Q4(e.scaleInfo, r), l = new dDe(e.materialKey, s, e.outlineSize * e.sizeRatio, e.referenceSize, rf(e.color), rf(e.outlineColor), e.horizontalAlignment, e.verticalAlignment, e.alignment, e.decoration, e.colorLocked ?? !1, e.angle, e.offsetX * e.sizeRatio * n, e.offsetY * e.sizeRatio * n, 512, 1, e.markerPlacement, e.effects, !0, o, a, e.backgroundColor ? rf(e.backgroundColor) : void 0, e.borderLineColor ? rf(e.borderLineColor) : void 0, e.borderLineWidth), [, c] = c4(e.text); + return l.bindTextInfo(i, c), l._vertexBoundsScale = e.maxVVSize ? e.maxVVSize / s : 1, l; + } +}; +const PDt = Ei.getLogger("esri.views.2d.engine.webgl.WGLLabelTemplate"), Dlr = (t, e = "mapview-labeling") => PDt.error(new ot(e, t)), hae = 1, OB = 0, Flr = 4, v2e = 25; +function Llr(t, e) { + const i = !!t.minScale && e.scaleToZoom(t.minScale) || 0; + return ru(i, 0, 25.5); +} +function Nlr(t, e) { + const i = !!t.maxScale && e.scaleToZoom(t.maxScale) || 255; + return ru(i, 0, 25.5); +} +function klr(t) { + const e = /* @__PURE__ */ new Map(); + return (i) => (e.has(i) || e.set(i, t(i)), e.get(i)); +} +const $lr = klr((t) => { + let e = 0; + if (t === 0) + return 1 / 0; + for (; !(t % 2); ) + e++, t /= 2; + return e; +}), dae = (t) => Math.floor(127 * t + 127), w5 = (t) => Math.floor(10 * t), XR = (t) => Math.round(t * (254 / 360)); +let pst = class ODt extends hDe { + constructor(e, i, r, n) { + super(e, r.font?.size, r.haloSize || 0, r.font?.size, r.color && Eb(r.color) || 0, r.haloColor && Eb(r.haloColor) || 0, r.horizontalAlignment, r.verticalAlignment, IRt(i.labelPlacement) ? vy.MAP : vy.SCREEN, r.font?.decoration, !1, r.angle || 0, r.xoffset, r.yoffset, r.lineWidth, r.lineHeight, null, null, !1, null, null, r.backgroundColor && Eb(r.backgroundColor), r.borderLineColor && Eb(r.borderLineColor), r.borderLineSize), this._outLineLabelAngle = 0, this._refPlacementPadding = 0, this._refPlacementDirX = 0, this._refPlacementDirY = 0, this._refOffsetX = 0, this._refOffsetY = 0, this._zoomLevel = 0, this.geometryType = En.LABEL, this._allowOverrun = i.allowOverrun ?? !1, this._repeatLabel = i.repeatLabel ?? !0, this._labelPosition = i.labelPosition ?? "curved"; + const s = Llr(i, n), o = Nlr(i, n), a = i.labelPlacement, [l, c] = $Qi(a); + this._xAlignD = l, this._yAlignD = c, this._minZoom = s, this._maxZoom = o, this._minBackgroundZoom = s, this._maxBackgroundZoom = o, this._refPlacementPadding = dn(r.haloSize) + k8i, this._repeatLabelDistance = i.repeatLabelDistance ? dn(i.repeatLabelDistance) : 128; + const h = _F.load(e); + h.sdf = !0, this._materialKey = h.data; + } + static fromLabelClass(e, i) { + if (e.labelPlacement === "esriServerLinePlacementCenterAlong") { + const r = e.symbol; + r.xoffset = 0, r.yoffset = 0, r.angle = 0, r.font.decoration = "none"; + } + return new ODt(e.materialKey, e, e.symbol, i); + } + get _shapedBox() { + return this._shapingInfo.bounds; + } + setZoomLevel(e) { + this._zoomLevel = e; + } + bindReferenceTemplate(e) { + let i = BQi(this._xAlignD), r = VQi(this._yAlignD); + if (this._refOffsetX = 0, this._refOffsetY = 0, ut(e)) + return void (this._refSymbolAndPlacementOffset = tf(0, 0, dae(i), dae(r))); + if (e.boundsType === "circle" && (i || r)) { + const o = Math.sqrt(i * i + r * r); + i /= o, r /= o; + } + const n = Math.max(e.height, e.width), s = this._refPlacementPadding * Flr; + this._refSymbolAndPlacementOffset = tf(s, n, dae(i), dae(r)), this._referenceSize = n, this._refPlacementDirX = i, this._refPlacementDirY = r, this._refOffsetX = e.xOffset, this._refOffsetY = e.yOffset; + } + _write(e, i) { + if (ut(this._shapingInfo)) + return; + const r = this._shapingInfo, n = i.getDisplayId(), s = i.geometryType === "esriGeometryPolygon" ? i.readLegacyCentroid() : i.readLegacyGeometry(); + if (s) + switch (this._current = { out: e, inId: n, inShaping: r, zoomLevel: this._zoomLevel }, i.geometryType === "esriGeometryPolyline" && this._labelPosition === "curved" && (this._borderLineColor || this._backgroundColor) && PDt.warnOnce("TextSymbol properties 'borderLineColor', 'borderLineSize', and 'backgroundColor' are not supported in curved labels"), i.geometryType) { + case "esriGeometryPolyline": + this._placeLineLabels(s); + break; + case "esriGeometryPoint": + case "esriGeometryPolygon": + this._placePointLabels(s); + break; + default: + Dlr(`Geometry of type ${i.geometryType} is not supported`); + } + } + _isVisible(e, i) { + const r = w5(this._current.zoomLevel); + return w5(e) <= r && r <= w5(i); + } + _placePointLabels(e) { + const { out: i, inId: r, inShaping: n } = this._current; + this._writeGlyphs(i, r, e, n); + } + _placeLineLabels(e) { + const i = Elr(e.paths, this._current.inShaping.bounds.width), r = this._placeSubdivGlyphs.bind(this), n = (this._shapedBox.width + this._repeatLabelDistance) / (1 << hae); + for (const s of i) + Tlr(s, n, r, this._repeatLabel); + } + _placeSubdivGlyphs(e, i, r, n) { + const s = $lr(i), o = this._shapedBox.width / (1 << hae), a = Math.sqrt(this._repeatLabelDistance) / (1 << hae), l = Math.min(r, n - r), c = this._current.inShaping.isMultiline ? v2e : Math.log2(l / (a + o / 2)), h = i === 0 ? c : Math.min(s, c), p = Math.max(this._minZoom, this._current.zoomLevel + hae - h), y = this._current.zoomLevel - p, v = this._shapedBox.width / 2 * 2 ** y; + this._current.inShaping.isMultiline ? i === 0 && this._placeStraight(e, p) : this._allowOverrun && y < 0 ? this._placeStraightAlong(e, this._minZoom) : this._labelPosition === "parallel" ? this._placeStraightAlong(e, p) : this._labelPosition === "curved" && this._placeCurved(e, p, v); + } + _placeStraight(e, i) { + const { out: r, inId: n, inShaping: s } = this._current, o = Math.ceil(e.angle * (180 / Math.PI) % 360), a = Math.ceil((e.angle * (180 / Math.PI) + 180) % 360); + this._outLineLabelAngle = XR(o), this._writeGlyphs(r, n, e, s, i), this._outLineLabelAngle = XR(a), this._writeGlyphs(r, n, e, s, i); + } + _placeCurved(e, i, r) { + const { out: n, inId: s } = this._current; + n.metricStart(s, i, e.x, e.y, 0, 0, 0, 0); + const o = e.clone(), a = e.angle * (180 / Math.PI) % 360, l = (e.angle * (180 / Math.PI) + 180) % 360; + this._outLineLabelAngle = XR(a), this._placeFirst(o, i, 1), this._placeBack(e, o, i, r, 1), this._placeForward(e, o, i, r, 1), this._outLineLabelAngle = XR(l), this._placeFirst(o, i, 0), this._placeBack(e, o, i, r, 0), this._placeForward(e, o, i, r, 0), n.metricEnd(); + } + _placeStraightAlong(e, i) { + const { out: r, inId: n, inShaping: s } = this._current; + r.metricStart(n, i, e.x, e.y, 0, 0, 0, 0); + const o = e.clone(), a = e.angle * (180 / Math.PI) % 360, l = (e.angle * (180 / Math.PI) + 180) % 360, c = s.glyphs.length > 0 && (this._borderLineColor || this._backgroundColor); + if (this._maxBackgroundZoom = v2e, this._minBackgroundZoom = Math.max(i, 0), c) { + const h = _F.load(this._materialKey); + h.textureBinding = s.glyphs[0].textureBinding; + const p = yie(e1(), -e.angle), [y, v] = s.shapeBackground(p); + this._outLineLabelAngle = XR(a), r.recordStart(n, h.data, this.geometryType, !0), this._writeBackgroundGeometry(r, n, e, y, v), r.recordEnd(), this._outLineLabelAngle = XR(l), r.recordStart(n, h.data, this.geometryType, !0), this._writeBackgroundGeometry(r, n, e, y, v), r.recordEnd(); + } + this._outLineLabelAngle = XR(a), this._placeFirst(o, i, 1, !0), this._outLineLabelAngle = XR(l), this._placeFirst(o, i, 0, !0), r.metricEnd(); + } + _placeBack(e, i, r, n, s) { + const o = e.clone(); + let a = e.backwardLength + OB; + for (; o.prev() && !(a >= n); ) + this._placeOnSegment(o, i, a, r, -1, s), a += o.length + OB; + } + _placeForward(e, i, r, n, s) { + const o = e.clone(); + let a = e.remainingLength + OB; + for (; o.next() && !(a >= n); ) + this._placeOnSegment(o, i, a, r, 1, s), a += o.length + OB; + } + _placeFirst(e, i, r, n = !1) { + const s = e, o = this._current.inShaping, a = o.glyphs, l = this._current.zoomLevel, { out: c, inId: h } = this._current; + for (const p of a) { + const y = p.x > o.bounds.x ? r : 1 - r, v = y * e.remainingLength + (1 - y) * e.backwardLength, x = Math.abs(p.x + p.width / 2 - o.bounds.x), I = Math.max(0, l + Math.log2(x / (v + OB))), P = Math.max(i, n ? 0 : I); + if (p.maxZoom = v2e, p.angle = e.angle + (1 - r) * Math.PI, p.minZoom = P, this._writeGlyph(c, h, s.x, s.y, p), r && this._isVisible(p.minZoom, p.maxZoom)) { + const F = p.bounds; + c.metricBoxWrite(F.center[0], F.center[1], F.width, F.height); + } + } + } + _placeOnSegment(e, i, r, n, s, o) { + const a = this._current.inShaping.glyphs, { out: l, inId: c } = this._current, h = this._current.inShaping, p = this._current.zoomLevel, y = e.dx / e.length, v = e.dy / e.length, x = { x: e.x + r * -s * y, y: e.y + r * -s * v }; + for (const I of a) { + const P = I.x > h.bounds.x ? o : 1 - o; + if (!(P && s === 1 || !P && s === -1)) + continue; + const F = Math.abs(I.x + I.width / 2 - h.bounds.x), k = Math.max(0, p + Math.log2(F / r) - 0.1), V = Math.max(n, p + Math.log2(F / (r + e.length + OB))); + if (k !== 0 && (I.angle = e.angle + (1 - o) * Math.PI, I.minZoom = V, I.maxZoom = k, this._writeGlyph(l, c, x.x, x.y, I), o && this._isVisible(I.minZoom, I.maxZoom))) { + const j = I.bounds, Y = e.x - i.x, X = e.y - i.y; + l.metricBoxWrite(j.center[0] + Y, j.center[1] + X, j.width, j.height); + } + } + } + _writeGlyphs(e, i, r, n, s = this._minZoom) { + if (r.x < 0 || r.x >= 512 || r.y < 0 || r.y >= 512) + return; + if (n.glyphs.length > 0 && (this._borderLineColor || this._backgroundColor)) { + const p = _F.load(this._materialKey); + p.textureBinding = n.glyphs[0].textureBinding, e.recordStart(i, p.data, this.geometryType, !0), this._writeBackgroundGeometry(e, i, r, n.bounds, n.background), e.recordEnd(); + } + const o = r.x + this._refOffsetX, a = r.y - this._refOffsetY; + for (const p of n.glyphs) + p.minZoom = s, p.maxZoom = this._maxZoom, this._writeGlyph(e, i, o, a, p); + const l = this._refPlacementDirX, c = this._refPlacementDirY, h = n.boundsT; + e.metricStart(i, s, o, a, l, c, this._referenceSize, this._materialKey), e.metricBoxWrite(h.center[0], h.center[1], h.width, h.height), e.metricEnd(); + } + _writeVertexCommon(e, i, r, n) { + const s = this._color, o = this._haloColor, a = tf(0, 0, this._size, this._haloSize), l = Math.max(n.minZoom, this._minZoom), c = Math.min(n.maxZoom, this._maxZoom), h = tf(w5(l), w5(c), this._outLineLabelAngle, 0); + e.vertexWrite(r), e.vertexWrite(i), e.vertexWrite(s), e.vertexWrite(o), e.vertexWrite(a), e.vertexWrite(this._refSymbolAndPlacementOffset), e.vertexWrite(h); + } + _writeBackgroundVertex(e, i, r, n, s, o) { + const a = tf(0, 0, this._size, this._haloSize), l = tf(0, 0, 0, 0), c = tf(w5(this._minBackgroundZoom), w5(this._maxBackgroundZoom), this._outLineLabelAngle, 1); + e.vertexWrite(r), e.vertexWrite(i), e.vertexWrite(n), e.vertexWrite(l), e.vertexWrite(a), e.vertexWrite(this._refSymbolAndPlacementOffset), e.vertexWrite(c), e.vertexWrite(s), e.vertexWrite(o), e.vertexEnd(); + } +}; +const fst = 3.14159265359 / 180, mst = 8, RDt = (t) => class extends t { + constructor(...e) { + super(...e), this.angle = 0, this.xOffset = 0, this.yOffset = 0, this.width = 0, this.height = 0, this.boundsType = "square", this._anchorX = 0, this._anchorY = 0, this._computedWidth = 0, this._computedHeight = 0, this._allowBorrowing = !0, this._vertexBoundsScaleX = 1, this._vertexBoundsScaleY = 1, this._offsets = { xUpperLeft: 0, yUpperLeft: 0, xUpperRight: 0, yUpperRight: 0, xBottomLeft: 0, yBottomLeft: 0, xBottomRight: 0, yBottomRight: 0 }, this.geometryType = En.MARKER; + } + _write(e, i, r, n) { + const s = i.getDisplayId(); + e.recordStart(s, this._materialKey, this.geometryType, !0), this._writeGeometry(e, i, s, r, n), e.recordEnd(); + } + _writeGeometry(e, i, r, n, s) { + if (_e(this._markerPlacement)) + return this._writePlacedMarkers(e, i, n, s); + if (this._allowBorrowing = !0, !s && i.geometryType === "esriGeometryPoint") { + const a = i.getX(), l = i.getY(); + return !e.hasAggregates && e.hasPixelBufferEnabled && (a < 0 || a >= 513 || l < 0 || l >= 513) ? void 0 : this._writeVertices(e, r, this._getPos(a, l), a, l); + } + const o = s ? K5e(d8(s), 2) : i.geometryType === "esriGeometryPolygon" ? i.readCentroid() : i.readGeometryForDisplay(); + if (!ut(o)) { + if (o.isPoint) { + const [a, l] = o.coords; + return !e.hasAggregates && e.hasPixelBufferEnabled && (a < 0 || a >= 512 || l < 0 || l >= 512) ? void 0 : this._writeVertices(e, r, this._getPos(a, l), a, l); + } + o.forEachVertex((a, l) => { + const c = 2 * Sc; + a < -c || a >= c || l < -c || l >= c || this._writeVertices(e, r, this._getPos(a, l), a, l); + }); + } + } + _writePlacedMarkers(e, i, r, n) { + const s = n ?? i.readLegacyGeometryForDisplay(), o = IDt.getPlacement(s, this._markerPlacement, dn(1), e.tileKey, r.geometryEngine); + if (!o) + return; + this._allowBorrowing = i.geometryType !== "esriGeometryPolygon"; + const a = i.getDisplayId(), l = cI(), c = e1(), h = -128, p = 640; + let y = o.next(); + for (; y != null; ) { + const v = y.tx, x = -y.ty; + v >= h && v <= p && x >= h && x <= p && (this._applyTransformation(c, l, -y.getAngle() / fst), this._writeVertices(e, a, this._getPos(v, x), v, x)), y = o.next(); + } + } + _writeVertices(e, i, r, n, s) { + const o = d4.load(this._materialKey); + return o.symbologyType === Zo.HEATMAP ? this._writeHeatmapVertices(e, i, r) : this._writeMarkerVertices(e, i, o, r, n, s); + } + _writeMarkerVertices(e, i, r, n, s, o) { + const a = r.vvRotation, l = e.vertexCount(); + let c = this._computedWidth * this._vertexBoundsScaleX, h = this._computedHeight * this._vertexBoundsScaleY; + if (this.angle) { + const p = Math.max(c, h); + c = p, h = p; + } + if (a) { + const p = Math.max(this.xOffset, this.yOffset); + c += p, h += p; + } + this._allowBorrowing && e.vertexBounds(s + this.xOffset, o - this.yOffset, c, h), e.vertexWrite(n), e.vertexWrite(this._offsetUpperLeft), e.vertexWrite(this._texUpperLeft), e.vertexWrite(this._bitestAndDistRatio), e.vertexWrite(i), e.vertexWrite(this._fillColor), e.vertexWrite(this._outlineColor), e.vertexWrite(this._sizeOutlineWidth), e.vertexWrite(this._minMaxZoom), e.vertexEnd(), e.vertexWrite(n), e.vertexWrite(this._offsetUpperRight), e.vertexWrite(this._texUpperRight), e.vertexWrite(this._bitestAndDistRatio), e.vertexWrite(i), e.vertexWrite(this._fillColor), e.vertexWrite(this._outlineColor), e.vertexWrite(this._sizeOutlineWidth), e.vertexWrite(this._minMaxZoom), e.vertexEnd(), e.vertexWrite(n), e.vertexWrite(this._offsetBottomLeft), e.vertexWrite(this._texBottomLeft), e.vertexWrite(this._bitestAndDistRatio), e.vertexWrite(i), e.vertexWrite(this._fillColor), e.vertexWrite(this._outlineColor), e.vertexWrite(this._sizeOutlineWidth), e.vertexWrite(this._minMaxZoom), e.vertexEnd(), e.vertexWrite(n), e.vertexWrite(this._offsetBottomRight), e.vertexWrite(this._texBottomRight), e.vertexWrite(this._bitestAndDistRatio), e.vertexWrite(i), e.vertexWrite(this._fillColor), e.vertexWrite(this._outlineColor), e.vertexWrite(this._sizeOutlineWidth), e.vertexWrite(this._minMaxZoom), e.vertexEnd(), this._writeIndices(e, l); + } + _writeHeatmapVertices(e, i, r) { + const n = e.vertexCount(); + e.vertexWrite(r), e.vertexWrite(this._offsetUpperLeft), e.vertexWrite(i), e.vertexEnd(), e.vertexWrite(r), e.vertexWrite(this._offsetUpperRight), e.vertexWrite(i), e.vertexEnd(), e.vertexWrite(r), e.vertexWrite(this._offsetBottomLeft), e.vertexWrite(i), e.vertexEnd(), e.vertexWrite(r), e.vertexWrite(this._offsetBottomRight), e.vertexWrite(i), e.vertexEnd(), this._writeIndices(e, n); + } + _writeIndices(e, i) { + e.indexWrite(i + 0), e.indexWrite(i + 1), e.indexWrite(i + 2), e.indexWrite(i + 1), e.indexWrite(i + 3), e.indexWrite(i + 2); + } + _applyTransformation(e, i, r = 0) { + vye(e, Tp(this.xOffset, -this.yOffset)), this.angle != null && this.angle + r !== 0 && w$(e, e, fst * (this.angle + r)); + const n = this._computedWidth, s = this._computedHeight, o = -(0.5 + this._anchorX) * n, a = -(0.5 - this._anchorY) * s; + aa(i, o, a), x0(i, i, e), this._offsetUpperLeft = Vn(16 * i[0], 16 * i[1]), this._offsets.xUpperLeft = i[0], this._offsets.yUpperLeft = i[1], aa(i, o + n, a), x0(i, i, e), this._offsetUpperRight = Vn(16 * i[0], 16 * i[1]), this._offsets.xUpperRight = i[0], this._offsets.yUpperRight = i[1], aa(i, o, a + s), x0(i, i, e), this._offsetBottomLeft = Vn(16 * i[0], 16 * i[1]), this._offsets.xBottomLeft = i[0], this._offsets.yBottomLeft = i[1], aa(i, o + n, a + s), x0(i, i, e), this._offsetBottomRight = Vn(16 * i[0], 16 * i[1]), this._offsets.xBottomRight = i[0], this._offsets.yBottomRight = i[1]; + } + _getPos(e, i) { + return Vn(Math.round(mst * e), Math.round(mst * i)); + } +}; +let QX = class eK extends RDt(ore) { + constructor(e, i, r, n, s, o, a, l, c, h, p, y, v, x, I, P, F, k, V, j, Y, X, Q) { + super(), this.angle = n, this.height = a, this.width = o, this.xOffset = i * V, this.yOffset = r * V, this._markerPlacement = j, this._effects = Y, this._anchorX = P, this._anchorY = F, this._minMaxZoom = Vn(Math.round(X * Dy), Math.round(Q * Dy)); + const re = (x === vy.MAP ? W8i : H8i) | (p ? V6 : 0) | (v ? q8i : 0) | (y ? Y8i : 0), he = I && I.sdf, fe = d4.load(e); + fe.sdf = he, fe.pattern = !0, fe.textureBinding = I.textureBinding, this._materialKey = fe.data, this._fillColor = s, this._outlineColor = c, this._sizeOutlineWidth = tf(Math.round(Math.min(Math.sqrt(128 * o), 255)), Math.round(Math.min(Math.sqrt(128 * a), 255)), Math.round(Math.min(Math.sqrt(128 * h), 255)), Math.round(Math.min(Math.sqrt(128 * l), 255))); + const be = I.rect.x + Cc, Se = I.rect.y + Cc, Me = be + I.width, ke = Se + I.height; + this._offsets.xUpperLeft = be, this._offsets.yUpperLeft = Se, this._offsets.xUpperRight = Me, this._offsets.yUpperRight = Se, this._offsets.xBottomLeft = be, this._offsets.yBottomLeft = ke, this._offsets.xBottomRight = Me, this._offsets.yBottomRight = ke, fe.symbologyType === Zo.PIE_CHART ? (this._texUpperLeft = Vn(0, 1), this._texUpperRight = Vn(1, 1), this._texBottomLeft = Vn(0, 0), this._texBottomRight = Vn(1, 0)) : (this._texUpperLeft = Vn(be, Se), this._texUpperRight = Vn(Me, Se), this._texBottomLeft = Vn(be, ke), this._texBottomRight = Vn(Me, ke)), o *= k, a *= k, o *= V, a *= V; + const J = Math.round(64 * k); + this._bitestAndDistRatio = Vn(re, J), this._computedWidth = o, this._computedHeight = a; + const ce = cI(), xe = e1(); + this._applyTransformation(xe, ce); + } + static fromCIMMarker(e, i, r) { + const n = i && i.width || 1, s = i && i.height || 1, o = e.size, a = n / s * e.scaleX, l = e.scaleSymbolsProportionally && e.frameHeight ? o / e.frameHeight : 1, c = rf(e.color), h = rf(e.outlineColor), p = dn(o), y = p * a, v = dn(e.offsetX || 0), x = dn(e.offsetY || 0), I = dn(e.outlineWidth || 0) * l, P = e.alignment || vy.SCREEN, F = dn(e.referenceSize), [k, V] = Q4(e.scaleInfo, r); + let j = e.rotation || 0; + e.rotateClockwise || (j = -j); + let Y = 0, X = 0; + const Q = e.anchorPoint; + Q && (e.isAbsoluteAnchorPoint ? o && (Y = Q.x / (o * a), X = Q.y / o) : (Y = Q.x, X = Q.y)); + const re = new eK(e.materialKey, v, x, j, c, y, p, F, h, I, e.colorLocked, e.scaleSymbolsProportionally, !1, P, i, Y, X, e.sizeRatio, Gu(e.scaleFactor, 1), e.markerPlacement, e.effects, k, V); + return re._vertexBoundsScaleX = e.maxVVSize ? e.maxVVSize / y : 1, re._vertexBoundsScaleY = e.maxVVSize ? e.maxVVSize / p : 1, re; + } + static fromPictureMarker(e, i) { + const r = Math.round(dn(e.width)), n = Math.round(dn(e.height)), s = BAt, o = Math.round(dn(e.xoffset || 0)), a = Math.round(dn(e.yoffset || 0)), l = new eK(e.materialKey, o, a, e.angle, s, r, n, n, 0, 0, !1, !1, !1, vy.SCREEN, i, 0, 0, 1, 1, null, null, JE, ZE); + return l._vertexBoundsScaleX = e.maxVVSize ? e.maxVVSize / e.width : 1, l._vertexBoundsScaleY = e.maxVVSize ? e.maxVVSize / e.height : 1, l; + } + static fromSimpleMarker(e, i) { + const r = Eb(e.color), n = Math.round(dn(e.size)), s = n, o = Math.round(dn(e.xoffset || 0)), a = Math.round(dn(e.yoffset || 0)), l = e.style, c = e.outline, h = 0 | (c?.color && Eb(c.color)), p = 0 | (c?.width && Math.round(dn(c.width))), y = new eK(e.materialKey, o, a, e.angle, r, n, s, s, h, p, !1, !1, l === "esriSMSCross" || l === "esriSMSX", vy.SCREEN, i, 0, 0, 126 / 64, 1, null, null, JE, ZE); + return y.boundsType = l === "esriSMSCircle" ? "circle" : "square", y._vertexBoundsScaleX = e.maxVVSize ? e.maxVVSize / e.size : 1, y._vertexBoundsScaleY = e.maxVVSize ? e.maxVVSize / e.size : 1, y; + } + static fromLineSymbolMarker(e, i) { + const r = Eb(e.color), n = 6, s = Math.round(dn(n * e.lineWidth)), o = s, a = e.style === "cross" || e.style === "x"; + let l; + switch (e.placement) { + case "begin-end": + l = X_.Both; + break; + case "begin": + l = X_.JustBegin; + break; + case "end": + l = X_.JustEnd; + break; + default: + l = X_.None; + } + const c = { type: "CIMMarkerPlacementAtExtremities", angleToLine: !0, offset: 0, extremityPlacement: l, offsetAlongLine: 0 }, h = new eK(e.materialKey, 0, 0, 0, r, s, o, o / n, r, a ? Math.round(dn(e.lineWidth)) : 0, !1, !1, a, vy.MAP, i, 0, 0, 126 / 64, 1, c, null, JE, ZE); + return h.boundsType = e.style === "circle" ? "circle" : "square", h; + } +}; +function Blr(t, e, i, r, n, s, o) { + mDe = 0; + const a = (r - i) * s, l = n && n.length, c = l ? (n[0] - i) * s : a; + let h, p, y, v, x, I = MDt(e, i, r, 0, c, s, !0); + if (I && I.next !== I.prev) { + if (l && (I = Ulr(e, i, r, n, I, s)), a > 80 * s) { + h = y = e[0 + i * s], p = v = e[1 + i * s]; + for (let P = s; P < c; P += s) { + const F = e[P + i * s], k = e[P + 1 + i * s]; + h = Math.min(h, F), p = Math.min(p, k), y = Math.max(y, F), v = Math.max(v, k); + } + x = Math.max(y - h, v - p), x = x !== 0 ? 1 / x : 0; + } + yte(I, t, s, h, p, x, o, 0); + } +} +function MDt(t, e, i, r, n, s, o) { + let a; + if (o === Ylr(t, e, i, r, n, s) > 0) + for (let l = r; l < n; l += s) + a = gst(l + e * s, t[l + e * s], t[l + 1 + e * s], a); + else + for (let l = n - s; l >= r; l -= s) + a = gst(l + e * s, t[l + e * s], t[l + 1 + e * s], a); + return a && o6(a, a.next) && (vte(a), a = a.next), a; +} +function gte(t, e = t) { + if (!t) + return t; + let i, r = t; + do + if (i = !1, r.steiner || !o6(r, r.next) && _y(r.prev, r, r.next) !== 0) + r = r.next; + else { + if (vte(r), r = e = r.prev, r === r.next) + break; + i = !0; + } + while (i || r !== e); + return e; +} +function yte(t, e, i, r, n, s, o, a) { + if (!t) + return; + !a && s && (t = DDt(t, r, n, s)); + let l = t; + for (; t.prev !== t.next; ) { + const c = t.prev, h = t.next; + if (s ? jlr(t, r, n, s) : Vlr(t)) + e.push(c.index / i + o), e.push(t.index / i + o), e.push(h.index / i + o), vte(t), t = h.next, l = h.next; + else if ((t = h) === l) { + a ? a === 1 ? yte(t = Klr(t, e, i, o), e, i, r, n, s, o, 2) : a === 2 && Jlr(t, e, i, r, n, s, o) : yte(gte(t), e, i, r, n, s, o, 1); + break; + } + } +} +function Vlr(t) { + const e = t.prev, i = t, r = t.next; + if (_y(e, i, r) >= 0) + return !1; + let n = t.next.next; + const s = n; + let o = 0; + for (; n !== t.prev && (o === 0 || n !== s); ) { + if (o++, TG(e.x, e.y, i.x, i.y, r.x, r.y, n.x, n.y) && _y(n.prev, n, n.next) >= 0) + return !1; + n = n.next; + } + return !0; +} +function jlr(t, e, i, r) { + const n = t.prev, s = t, o = t.next; + if (_y(n, s, o) >= 0) + return !1; + const a = n.x < s.x ? n.x < o.x ? n.x : o.x : s.x < o.x ? s.x : o.x, l = n.y < s.y ? n.y < o.y ? n.y : o.y : s.y < o.y ? s.y : o.y, c = n.x > s.x ? n.x > o.x ? n.x : o.x : s.x > o.x ? s.x : o.x, h = n.y > s.y ? n.y > o.y ? n.y : o.y : s.y > o.y ? s.y : o.y, p = pDe(a, l, e, i, r), y = pDe(c, h, e, i, r); + let v = t.prevZ, x = t.nextZ; + for (; v && v.z >= p && x && x.z <= y; ) { + if (v !== t.prev && v !== t.next && TG(n.x, n.y, s.x, s.y, o.x, o.y, v.x, v.y) && _y(v.prev, v, v.next) >= 0 || (v = v.prevZ, x !== t.prev && x !== t.next && TG(n.x, n.y, s.x, s.y, o.x, o.y, x.x, x.y) && _y(x.prev, x, x.next) >= 0)) + return !1; + x = x.nextZ; + } + for (; v && v.z >= p; ) { + if (v !== t.prev && v !== t.next && TG(n.x, n.y, s.x, s.y, o.x, o.y, v.x, v.y) && _y(v.prev, v, v.next) >= 0) + return !1; + v = v.prevZ; + } + for (; x && x.z <= y; ) { + if (x !== t.prev && x !== t.next && TG(n.x, n.y, s.x, s.y, o.x, o.y, x.x, x.y) && _y(x.prev, x, x.next) >= 0) + return !1; + x = x.nextZ; + } + return !0; +} +function gst(t, e, i, r) { + const n = sme.create(t, e, i); + return r ? (n.next = r.next, n.prev = r, r.next.prev = n, r.next = n) : (n.prev = n, n.next = n), n; +} +function vte(t) { + t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ); +} +function Glr(t) { + let e = t, i = t; + do + (e.x < i.x || e.x === i.x && e.y < i.y) && (i = e), e = e.next; + while (e !== t); + return i; +} +function Ulr(t, e, i, r, n, s) { + const o = new Array(); + for (let a = 0, l = r.length; a < l; a++) { + const c = MDt(t, e, i, r[a] * s, a < l - 1 ? r[a + 1] * s : i * s, s, !1); + c === c.next && (c.steiner = !0), o.push(Glr(c)); + } + o.sort(Xlr); + for (const a of o) + n = zlr(a, n); + return n; +} +function zlr(t, e) { + const i = Hlr(t, e); + if (!i) + return e; + const r = LDt(i, t); + return gte(r, r.next), gte(i, i.next); +} +function Hlr(t, e) { + let i = e; + const r = t.x, n = t.y; + let s, o = -1 / 0; + do { + if (n <= i.y && n >= i.next.y && i.next.y !== i.y) { + const y = i.x + (n - i.y) * (i.next.x - i.x) / (i.next.y - i.y); + if (y <= r && y > o) { + if (o = y, y === r) { + if (n === i.y) + return i; + if (n === i.next.y) + return i.next; + } + s = i.x < i.next.x ? i : i.next; + } + } + i = i.next; + } while (i !== e); + if (!s) + return null; + if (r === o) + return s.prev; + const a = s, l = s.x, c = s.y; + let h, p = 1 / 0; + for (i = s.next; i !== a; ) + r >= i.x && i.x >= l && r !== i.x && TG(n < c ? r : o, n, l, c, n < c ? o : r, n, i.x, i.y) && (h = Math.abs(n - i.y) / (r - i.x), (h < p || h === p && i.x > s.x) && _te(i, t) && (s = i, p = h)), i = i.next; + return s; +} +function DDt(t, e, i, r) { + let n; + for (; n !== t; n = n.next) { + if (n = n || t, n.z === null && (n.z = pDe(n.x, n.y, e, i, r)), n.prev.next !== n || n.next.prev !== n) + return n.prev.next = n, n.next.prev = n, DDt(t, e, i, r); + n.prevZ = n.prev, n.nextZ = n.next; + } + return t.prevZ.nextZ = null, t.prevZ = null, Wlr(t); +} +function Wlr(t) { + let e, i = 1; + for (; ; ) { + let r, n = t; + t = null, e = null; + let s = 0; + for (; n; ) { + s++, r = n; + let o = 0; + for (; o < i && r; o++) + r = r.nextZ; + let a = i; + for (; o > 0 || a > 0 && r; ) { + let l; + o === 0 ? (l = r, r = r.nextZ, a--) : a !== 0 && r ? n.z <= r.z ? (l = n, n = n.nextZ, o--) : (l = r, r = r.nextZ, a--) : (l = n, n = n.nextZ, o--), e ? e.nextZ = l : t = l, l.prevZ = e, e = l; + } + n = r; + } + if (e.nextZ = null, i *= 2, s < 2) + return t; + } +} +function _y(t, e, i) { + return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y); +} +function FDt(t, e, i, r) { + return !!(o6(t, e) && o6(i, r) || o6(t, r) && o6(i, e)) || _y(t, e, i) > 0 != _y(t, e, r) > 0 && _y(i, r, t) > 0 != _y(i, r, e) > 0; +} +function qlr(t, e) { + let i = t; + do { + if (i.index !== t.index && i.next.index !== t.index && i.index !== e.index && i.next.index !== e.index && FDt(i, i.next, t, e)) + return !0; + i = i.next; + } while (i !== t); + return !1; +} +function Ylr(t, e, i, r, n, s) { + let o = 0; + for (let a = r, l = n - s; a < n; a += s) + o += (t[l + e * s] - t[a + e * s]) * (t[a + 1 + e * s] + t[l + 1 + e * s]), l = a; + return o; +} +function TG(t, e, i, r, n, s, o, a) { + return (n - o) * (e - a) - (t - o) * (s - a) >= 0 && (t - o) * (r - a) - (i - o) * (e - a) >= 0 && (i - o) * (s - a) - (n - o) * (r - a) >= 0; +} +function _te(t, e) { + return _y(t.prev, t, t.next) < 0 ? _y(t, e, t.next) >= 0 && _y(t, t.prev, e) >= 0 : _y(t, e, t.prev) < 0 || _y(t, t.next, e) < 0; +} +function pDe(t, e, i, r, n) { + return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) * n) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - r) * n) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1; +} +function o6(t, e) { + return t.x === e.x && t.y === e.y; +} +function Xlr(t, e) { + return t.x - e.x; +} +function Klr(t, e, i, r) { + let n = t; + do { + const s = n.prev, o = n.next.next; + !o6(s, o) && FDt(s, n, n.next, o) && _te(s, o) && _te(o, s) && (e.push(s.index / i + r), e.push(n.index / i + r), e.push(o.index / i + r), vte(n), vte(n.next), n = t = o), n = n.next; + } while (n !== t); + return n; +} +function Jlr(t, e, i, r, n, s, o) { + let a = t; + do { + let l = a.next.next; + for (; l !== a.prev; ) { + if (a.index !== l.index && Zlr(a, l)) { + let c = LDt(a, l); + return a = gte(a, a.next), c = gte(c, c.next), yte(a, e, i, r, n, s, o, 0), void yte(c, e, i, r, n, s, o, 0); + } + l = l.next; + } + a = a.next; + } while (a !== t); +} +function Zlr(t, e) { + return t.next.index !== e.index && t.prev.index !== e.index && !qlr(t, e) && _te(t, e) && _te(e, t) && Qlr(t, e); +} +function Qlr(t, e) { + let i = t, r = !1; + const n = (t.x + e.x) / 2, s = (t.y + e.y) / 2; + do + i.y > s != i.next.y > s && i.next.y !== i.y && n < (i.next.x - i.x) * (s - i.y) / (i.next.y - i.y) + i.x && (r = !r), i = i.next; + while (i !== t); + return r; +} +function LDt(t, e) { + const i = sme.create(t.index, t.x, t.y), r = sme.create(e.index, e.x, e.y), n = t.next, s = e.prev; + return t.next = e, e.prev = t, i.next = n, n.prev = i, r.next = i, i.prev = r, s.next = r, r.prev = s, r; +} +let sme = class NDt { + constructor() { + this.index = 0, this.x = 0, this.y = 0, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1; + } + static create(e, i, r) { + const n = mDe < fDe.length ? fDe[mDe++] : new NDt(); + return n.index = e, n.x = i, n.y = r, n.prev = null, n.next = null, n.z = null, n.prevZ = null, n.nextZ = null, n.steiner = !1, n; + } +}; +const fDe = new Array(), eur = 8096; +let mDe = 0; +for (let t = 0; t < eur; t++) + fDe.push(new sme()); +const tur = 1e-5, JN = new Xie(0, 0, 0, 1, 0), gDe = new Xie(0, 0, 0, 1, 0); +function yst(t, e, i) { + let r = 0; + for (let n = 1; n < i; n++) { + const s = t[2 * (e + n - 1)], o = t[2 * (e + n - 1) + 1]; + r += (t[2 * (e + n)] - s) * (t[2 * (e + n) + 1] + o); + } + return r; +} +function iur(t, e, i, r, n) { + let s = 0; + const o = 2; + for (let a = i; a < r; a += 3) { + const l = (t[a] - n) * o, c = (t[a + 1] - n) * o, h = (t[a + 2] - n) * o; + s += Math.abs((e[l] - e[h]) * (e[c + 1] - e[l + 1]) - (e[l] - e[c]) * (e[h + 1] - e[l + 1])); + } + return s; +} +function rur(t, e) { + const { coords: i, lengths: r, hasIndeterminateRingOrder: n } = e, s = 0, o = t; + if (n) + return !1; + let a = 0; + for (let l = 0; l < r.length; ) { + let c = l, h = r[l], p = yst(i, a, h); + const y = []; + for (; ++c < r.length; ) { + const P = r[c], F = yst(i, a + h, P); + if (!(F > 0)) + break; + p += F, y.push(a + h), h += P; + } + const v = o.length; + Blr(o, i, a, a + h, y, 2, s); + const x = iur(o, i, v, o.length, s), I = Math.abs(p); + if (Math.abs((x - I) / Math.max(1e-7, I)) > tur) + return o.length = 0, !1; + l = c, a += h; + } + return !0; +} +function nur(t) { + const { coords: e, lengths: i } = t, { buffer: r } = oOt(e, i); + return r; +} +function sur(t, e, i) { + let r = 0; + for (let n = 0; n < t.lengths.length; n++) { + const s = t.lengths[n]; + for (let o = 0; o < s; o++) { + const a = t.coords[2 * (o + r)], l = t.coords[2 * (o + r) + 1]; + if (a < e || a > i || l < e || l > i) + return !0; + } + r += s; + } + return !1; +} +function our(t, e) { + if (ut(t)) + return null; + if (!sur(t, -128, Sc + 128)) + return t; + JN.setPixelMargin(e), JN.reset(py.Polygon); + let i = 0; + for (let o = 0; o < t.lengths.length; o++) { + const a = t.lengths[o]; + let l = t.coords[2 * (0 + i)], c = t.coords[2 * (0 + i) + 1]; + JN.moveTo(l, c); + for (let h = 1; h < a; h++) + l = t.coords[2 * (h + i)], c = t.coords[2 * (h + i) + 1], JN.lineTo(l, c); + JN.close(), i += a; + } + const r = JN.result(!1); + if (!r) + return null; + const n = [], s = []; + for (const o of r) { + let a = 0; + for (const l of o) + s.push(l.x), s.push(l.y), a++; + n.push(a); + } + return new Rl(n, s); +} +function aur(t, e) { + gDe.setPixelMargin(e); + const i = gDe, r = -e, n = Sc + e; + let s = [], o = !1, a = 0; + for (; a < t.length; ) { + const l = [], c = t[a]; + if (!c) + return null; + i.reset(py.LineString); + let [h, p] = c[0]; + if (o) + i.moveTo(h, p); + else { + if (h < r || h > n || p < r || p > n) { + o = !0; + continue; + } + l.push({ x: h, y: p }); + } + let y = !1; + const v = c.length; + for (let x = 1; x < v; ++x) + if (h += c[x][0], p += c[x][1], o) + i.lineTo(h, p); + else { + if (h < r || h > n || p < r || p > n) { + y = !0; + break; + } + l.push({ x: h, y: p }); + } + if (y) + o = !0; + else { + if (o) { + const x = i.resultWithStarts(); + if (x) + for (const I of x) + s.push(I); + } else + s.push({ line: l, start: 0 }); + a++, o = !1; + } + } + return s = s.filter((l) => l.line.length > 1), s.length === 0 ? null : s; +} +JN.setExtent(Sc), gDe.setExtent(Sc); +const ome = 8, N_ = 16, vst = 65535, kDt = (t) => class extends t { + constructor(...e) { + super(...e), this.tessellationProperties = {}, this._tessellationOptions = { halfWidth: 0, pixelCoordRatio: 1, offset: 0 }, this.geometryType = En.LINE; + } + writeGeometry(e, i, r, n) { + this._writeGeometry(e, i, r, n); + } + _initializeTessellator(e) { + const i = a3.load(this._materialKey), r = nC.load(this._materialKey), n = this._tessellationOptions, s = i.vvSizeFieldStops || i.vvSizeMinMaxValue || i.vvSizeScaleStops || i.vvSizeUnitValue, o = this.tessellationProperties._halfWidth < P8e && !e && !s; + this.tessellationProperties.minMaxZoom = this._minMaxZoom, n.wrapDistance = vst, n.textured = this._isDashed || this._hasPattern, n.offset = this.tessellationProperties.offset, n.halfWidth = this.tessellationProperties._halfWidth; + const a = o ? 0 : 1, l = Qfe(r) ? uur : lur; + this._lineTessellator = new cOt(l(this.tessellationProperties, a, a), cur(this.tessellationProperties), o); + } + _write(e, i, r, n) { + const s = i.geometryType === "esriGeometryPoint"; + e.recordStart(i.getDisplayId(), this._materialKey, this.geometryType, s), this._writeGeometry(e, i, n, s), e.recordEnd(); + } + _writeGeometry(e, i, r, n) { + const s = r ?? i.readLegacyGeometryForDisplay(), o = this._getLines(s, n); + ut(o) || this._writeVertices(e, i, o); + } + _getLines(e, i) { + if (ut(e)) + return null; + const r = e.paths || e.rings; + return ut(r) ? null : aur(r, i ? 256 : 16); + } + _writeVertices(e, i, r) { + const n = i.getDisplayId(), s = e.vertexCount(), o = this.tessellationProperties, a = this._tessellationOptions; + o.out = e, o.id = n, o.indexCount = 0, o.vertexCount = 0, o.offset = s, a.capType = this._capType, a.joinType = this._joinType; + const l = nC.load(this._materialKey); + this.tessellationProperties.key = Qfe(l) ? l : a3.load(this._materialKey); + for (const { line: c, start: h } of r) + a.initialDistance = h % vst, this._lineTessellator.tessellate(c, a); + } +}, lur = (t, e, i) => (r, n, s, o, a, l, c, h, p, y, v) => { + const x = Vn(v, Math.ceil(N_ * t._halfWidth)), I = tf(Math.round(N_ * c), Math.round(N_ * h), Math.round(N_ * p), Math.round(N_ * y)), P = tf(N_ * a, N_ * l, 0, t._bitset), F = t.out; + return F.vertexBounds(r, n, e, i), F.vertexWrite(Vn(ome * r, ome * n)), F.vertexWrite(t.id), F.vertexWrite(t._fillColor), F.vertexWrite(I), F.vertexWrite(x), F.vertexWrite(t._tl), F.vertexWrite(t._br), F.vertexWrite(P), F.vertexWrite(Vn(Math.ceil(N_ * t._halfReferenceWidth), 0)), F.vertexWrite(t.minMaxZoom), F.vertexEnd(), t.offset + t.vertexCount++; +}, uur = (t, e, i) => (r, n, s, o, a, l, c, h, p, y, v) => { + const x = Vn(N_ * t._halfWidth, N_ * t._halfReferenceWidth), I = tf(N_ * c + 128, N_ * h + 128, N_ * p + 128, N_ * y + 128), P = t.out, F = t._bitset << 24 | t.id; + P.vertexBounds(r, n, e, i), P.vertexWrite(Vn(ome * r, ome * n)), P.vertexWrite(F), P.vertexWrite(t._fillColor); + const k = BMt(t.key); + return k || (P.vertexWrite(0), P.vertexWrite(0)), P.vertexWrite(0), P.vertexWrite(x), P.vertexWrite(I), k || P.vertexWrite(t.minMaxZoom), P.vertexEnd(), t.offset + t.vertexCount++; +}, cur = (t) => (e, i, r) => { + const n = t.out; + n.indexWrite(e), n.indexWrite(i), n.indexWrite(r), t.indexCount += 3; +}; +let yDe = class sj extends kDt(ore) { + constructor(e, i, r, n, s, o, a, l, c, h, p, y, v, x, I, P, F, k, V, j) { + super(); + const Y = a3.load(e); + i && (Y.sdf = i.sdf, Y.pattern = !0, Y.textureBinding = i.textureBinding), this._capType = n, this._joinType = s, this._miterLimitCosine = uDe(o), this.tessellationProperties._fillColor = a, this.tessellationProperties._tl = l, this.tessellationProperties._br = c, this._hasPattern = h, this._isDashed = p, this._zOrder = F, this._effects = k, this._minMaxZoom = Vn(Math.round(V * Dy), Math.round(j * Dy)), this._materialKey = Y.data; + const X = (v ? V6 : 0) | (x ? X8i : 0) | (y ? WAt : 0) | (I ? dve : 0); + this.tessellationProperties._bitset = X, this.tessellationProperties._halfWidth = 0.5 * r, this.tessellationProperties._halfReferenceWidth = 0.5 * P, this.tessellationProperties.offset = 0, this._initializeTessellator(!1); + } + static fromCIMLine(e, i, r) { + const n = e.color, s = e.scaleFactor || 1, o = !!e.dashTemplate; + let a = e.cap; + o && a === Pf.ROUND && (a = Pf.SQUARE); + const l = e.join, c = dn(e.width) * s, h = dn(e.referenceWidth), p = dn(e.miterLimit), y = n && rf(n) || 0, [v, x] = Q4(e.scaleInfo, r), I = !1; + if (!i) + return new sj(e.materialKey, i, c, a, l, p, y, 0, 0, !1, o, e.scaleDash ?? !1, e.colorLocked ?? !1, I, e.sampleAlphaOnly, h, e.zOrder, e.effects, v, x); + const { rect: P, width: F, height: k } = i, V = P.x + Cc, j = P.y + Cc, Y = V + F, X = j + k, Q = Vn(V, j), re = Vn(Y, X), he = !1; + return new sj(e.materialKey, i, c, a, l, p, y, Q, re, !0, o, e.scaleDash ?? !1, e.colorLocked ?? !1, he, e.sampleAlphaOnly, h, e.zOrder, e.effects, v, x); + } + static fromFillOutline(e) { + const i = nC.load(e.materialKey); + return Qfe(i) && e.outline && e.outline?.style === "esriSLSSolid" ? sj.fromSimpleLine({ hash: "", materialKey: e.materialKey, ...e.outline }, null, !0) : null; + } + static fromSimpleLine(e, i, r = !1) { + const { color: n } = e, s = e.style !== "esriSLSSolid" && e.style !== "esriSLSNull", o = C9i(e.cap || "round"), a = T9i(e.join || "round"); + let l = n && e.style !== "esriSLSNull" && Eb(n) || 0; + e.style === "esriSLSNull" && (l = 0); + const c = dn(e.width), h = e.miterLimit; + if (!i) + return new sj(e.materialKey, i, c, o, a, h, l, 0, 0, !1, s, !0, !1, r, !1, c, 0, null, JE, ZE); + const { rect: p, width: y, height: v } = i, x = p.x + Cc, I = p.y + Cc, P = x + y, F = I + v, k = Vn(x, I), V = Vn(P, F); + return new sj(e.materialKey, i, c, o, a, h, l, k, V, !0, s, !0, !1, r, !1, c, 0, null, JE, ZE); + } + static fromPictureLineSymbol(e, i, r, n) { + return Ei.getLogger("esri.views.2d.engine.webgl.WGLLineTemplate").error("PictureLineSymbol support does not exist!"), null; + } +}; +const hur = 100, _st = 1, $Dt = (t) => class extends t { + constructor(...e) { + super(...e), this.forceLibtess = !1, this._bitset = 0, this._lineTemplate = null, this.geometryType = En.FILL; + } + _maybeAddLineTemplate(e) { + this._lineTemplate = yDe.fromFillOutline(e); + } + _write(e, i, r, n) { + const s = i.geometryType === "esriGeometryPoint", o = nC.load(this._materialKey); + e.recordStart(i.getDisplayId(), this._materialKey, this.geometryType, s), this._writeGeometry(e, i, o, n, s), Qfe(o) && _e(this._lineTemplate) && this._lineTemplate.writeGeometry(e, i, n, s), e.recordEnd(); + } + _writeGeometry(e, i, r, n, s) { + const o = this._getGeometry(i, n, s); + if (ut(o)) + return; + const a = []; + if (!(o.maxLength > hur) && !this.forceLibtess && rur(a, o)) + return void (a.length && this._writeVertices(e, i, o.coords, o.lengths, r, a)); + const l = nur(o); + this._writeVertices(e, i, l, [l.length / 2], r); + } + _writeVertex(e, i, r, n, s, o) { + const a = Vn(_st * n, _st * s); + if (e.vertexBounds(n, s, 0, 0), e.vertexWrite(a), e.vertexWrite(i), r.symbologyType === Zo.DOT_DENSITY) + e.vertexWriteF32(1 / Math.abs(o.readGeometryArea())); + else { + e.vertexWrite(this.fillColor); + const l = BMt(r); + l || (e.vertexWrite(this.tl), e.vertexWrite(this.br)), e.vertexWrite(this.aux21), e.vertexWrite(this.aux22), e.vertexWrite(this.aux3), l || e.vertexWrite(this._minMaxZoom); + } + } + _writeVertices(e, i, r, n, s, o) { + const a = i.getDisplayId(), l = this._bitset << 24 | a, c = n.reduce((v, x) => v + x), h = ffe(s.geometryType, s.symbologyType).geometry / 4, p = e.vertexCount(); + e.vertexEnsureSize(h * c); + let y = 0; + if (o) + for (const v of o) { + const x = r[2 * v], I = r[2 * v + 1]; + this._writeVertex(e, l, s, x, I, i), y++; + } + else + for (let v = 0; v < r.length; v += 2) { + const x = Math.round(r[v]), I = Math.round(r[v + 1]); + this._writeVertex(e, l, s, x, I, i), y++; + } + e.indexEnsureSize(y); + for (let v = 0; v < y; v++) + e.indexWrite(v + p); + } + _getGeometry(e, i, r) { + const n = i ? K5e(d8(i), 2) : e.readGeometryForDisplay(); + return n ? our(n, r ? 256 : 8) : null; + } +}, bst = Ei.getLogger("esri.views.2d.engine.webgl.WGLDynamicMeshTemplate"); +let jve = class extends ore { + constructor(e) { + super(), this._ongoingMaterialRequestMap = /* @__PURE__ */ new Map(), this._materialCache = /* @__PURE__ */ new Map(), this._dynamicPropertyMap = /* @__PURE__ */ new Map(), this._cimLayer = e; + } + analyze(e, i, r, n, s) { + if (s && s.length === 0) + return null; + const o = s && s.length > 0, a = i.readLegacyFeature(), l = i.getObjectId(), c = this._materialCache, h = this._cimLayer.materialHash; + if (!h) + return bst.error("A Dynamic mesh template must have a material hash value or function!"), Promise.reject(null); + const p = typeof h == "function" ? h(a, r, n, l) : h, y = c.get(p); + if (y != null) + return Promise.resolve(y); + const v = this._ongoingMaterialRequestMap.get(p); + if (v) + return v; + const x = this._cimLayer, I = Qer(x.cim, this._cimLayer.materialOverrides); + I.mosaicHash = p; + const { type: P, url: F } = x, k = { cim: I, type: P, mosaicHash: p, url: F, size: null, dashTemplate: null, text: null, fontName: null, objectId: l, animatedSymbolProperties: null }; + switch (P) { + case "marker": + k.size = Hj(x.size, a, r, n), k.animatedSymbolProperties = Hj(x.animatedSymbolProperties, a, r, n); + break; + case "line": + k.dashTemplate = x.dashTemplate; + break; + case "text": + k.text = Hj(x.text, a, r, n), k.fontName = Hj(x.fontName, a, r, n); + } + const V = e.getMosaicItem(k, s).then((j) => (o || (this._ongoingMaterialRequestMap.delete(p), c.set(p, j)), j)).catch((j) => (this._ongoingMaterialRequestMap.delete(p), bst.error(".analyze()", j.message), null)); + return o || this._ongoingMaterialRequestMap.set(p, V), V; + } +}; +const wst = 128; +let dur = class BDt extends $Dt(jve) { + constructor(e, i, r) { + if (super(e), this._minMaxZoom = Vn(Math.round(i * Dy), Math.round(r * Dy)), zl(e.color)) { + const h = (p, y, v) => { + const x = e.color(p, y, v); + return x && rf(x) || 0; + }; + this._dynamicPropertyMap.set("fillColor", h); + } else { + const h = e.color; + this.fillColor = h && rf(h) || 0; + } + const n = e.cim.placement?.type === "CIMMarkerPlacementInsidePolygon" && e.cim.placement.shiftOddRows ? 2 : 1, s = e.height; + if (zl(s)) { + const h = (p, y, v) => s(p, y, v) * n; + this._dynamicPropertyMap.set("_height", h); + } else + this._height = (s || 0) * n; + const o = e.offsetX; + if (zl(o)) { + const h = (p, y, v) => dn(o(p, y, v)); + this._dynamicPropertyMap.set("_offsetX", h); + } else + this._offsetX = dn(o || 0); + const a = e.offsetY; + if (zl(a)) { + const h = (p, y, v) => dn(-a(p, y, v)); + this._dynamicPropertyMap.set("_offsetY", h); + } else + this._offsetY = dn(-a || 0); + const l = e.scaleX; + zl(l) ? this._dynamicPropertyMap.set("_scaleX", l) : this._scaleX = l || 1; + const c = e.angle; + if (zl(c)) { + const h = (p, y, v) => fte(c(p, y, v)); + this._dynamicPropertyMap.set("_angle", h); + } else + this._angle = fte(c) || 0; + if (_e(e.effects)) { + const h = e.effects; + zl(h) ? this._dynamicPropertyMap.set("_effects", h) : this._effects = h; + } + this._cimFillLayer = e, this._bitset = (e.colorLocked ? V6 : 0) | (e.applyRandomOffset ? qAt : 0) | (e.sampleAlphaOnly ? dve : 0) | (e.hasUnresolvedReplacementColor ? YAt : 0), this._fillMaterialKey = e.materialKey; + } + static fromCIMFill(e, i) { + const [r, n] = Q4(e.scaleInfo, i); + return new BDt(e, r, n); + } + bindFeature(e, i, r) { + const n = e.readLegacyFeature(); + this._dynamicPropertyMap.forEach((h, p) => { + this[p] = h(n, i, r); + }); + const s = nC.load(this._fillMaterialKey), o = this._materialCache, a = (0, this._cimFillLayer.materialHash)(n, i, r), l = o.get(a); + let c = null; + if (l && L_(l.spriteMosaicItem) && (c = l.spriteMosaicItem), c) { + const { rect: h, width: p, height: y } = c, v = h.x + Cc, x = h.y + Cc, I = v + p, P = x + y; + let F = Math.round(dn(this._height)); + F <= 0 && (F = P - x); + let k = Math.round(dn(this._height / y * p || 0)); + k <= 0 && (k = I - v); + const V = this._scaleX, j = 1; + this.tl = Vn(v, x), this.br = Vn(I, P), this.aux21 = Vn(k, F), this.aux22 = Vn(this._offsetX, this._offsetY), this.aux3 = tf(V * wst, j * wst, this._angle, 0), s.sdf = c.sdf, s.pattern = !0, s.textureBinding = c.textureBinding; + } else + this.tl = 0, this.br = 0, this.aux21 = 0, this.aux22 = 0, this.aux3 = 0, s.sdf = !1, s.pattern = !1, s.textureBinding = 0; + this._materialKey = s.data; + } +}, pur = class VDt extends kDt(jve) { + constructor(e, i, r) { + super(e), this._minMaxZoom = Vn(Math.round(i * Dy), Math.round(r * Dy)), this._cimLineLayer = e; + let n = 0; + zl(e.width) || (n = 0.5 * dn(e.width)); + const s = (p, y, v) => zl(e.width) ? 0.5 * dn(e.width(p, y, v)) : n; + this._dynamicPropertyMap.set("_halfWidth", s), zl(e.cap) ? this._dynamicPropertyMap.set("_capType", e.cap) : this._capType = e.cap, zl(e.join) ? this._dynamicPropertyMap.set("_joinType", e.join) : this._joinType = e.join; + const o = e.color; + if (zl(o)) { + const p = (y, v, x) => rf(o(y, v, x)); + this._dynamicPropertyMap.set("_fillColor", p); + } else + this._fillColor = o && rf(o) || 0; + const a = e.miterLimit; + if (zl(a)) { + const p = (y, v, x) => uDe(a(y, v, x)); + this._dynamicPropertyMap.set("_miterLimitCosine", p); + } else + this._miterLimitCosine = uDe(a); + if (_e(e.effects)) { + const p = e.effects; + zl(p) ? this._dynamicPropertyMap.set("_effects", p) : this._effects = p; + } + this._scaleFactor = e.scaleFactor || 1, this._isDashed = e.dashTemplate != null; + const l = e.colorLocked ? V6 : 0, c = e.scaleDash ? WAt : 0, h = e.sampleAlphaOnly ? dve : 0; + this.tessellationProperties._bitset = l | c | h, this._materialKey = e.materialKey, this._initializeTessellator(!0); + } + static fromCIMLine(e, i) { + const [r, n] = Q4(e.scaleInfo, i); + return new VDt(e, r, n); + } + bindFeature(e, i, r) { + const n = e.readLegacyFeature(); + this._dynamicPropertyMap.forEach((h, p) => { + this[p] = h(n, i, r); + }), this._halfWidth *= this._scaleFactor; + const s = this._materialCache, o = (0, this._cimLineLayer.materialHash)(n, i, r), a = s.get(o); + let l = null; + if (a && L_(a.spriteMosaicItem) && (l = a.spriteMosaicItem), l) { + this._hasPattern = !0; + const { rect: h, width: p, height: y } = l, v = h.x + Cc, x = h.y + Cc, I = v + p, P = x + y; + this.tessellationProperties._tl = Vn(v, x), this.tessellationProperties._br = Vn(I, P); + } else + this._hasPattern = !1, this.tessellationProperties._tl = 0, this.tessellationProperties._br = 0; + this.tessellationProperties._fillColor = this._fillColor, this.tessellationProperties._halfWidth = this._halfWidth, this.tessellationProperties.offset = 0, this.tessellationProperties._halfReferenceWidth = this.tessellationProperties._halfWidth; + const c = a3.load(this._materialKey); + l && (c.sdf = l.sdf, c.pattern = !0, c.textureBinding = l.textureBinding), this._materialKey = c.data; + } +}; +const fur = cI(), mur = e1(); +let gur = class jDt extends RDt(jve) { + constructor(e, i, r) { + super(e), this._cimMarkerLayer = e, this._minMaxZoom = Vn(Math.round(i * Dy), Math.round(r * Dy)); + const n = e.color; + if (zl(n)) { + const y = (v, x, I) => rf(n(v, x, I)); + this._dynamicPropertyMap.set("_fillColor", y); + } else + this._fillColor = rf(n); + const s = e.outlineColor; + if (zl(s)) { + const y = (v, x, I) => rf(s(v, x, I)); + this._dynamicPropertyMap.set("_outlineColor", y); + } else + this._outlineColor = rf(s); + const o = e.size; + if (zl(o)) { + const y = (v, x, I) => dn(o(v, x, I)); + this._dynamicPropertyMap.set("_size", y); + } else + this._size = dn(o) || 0; + const a = e.scaleX; + zl(a) ? this._dynamicPropertyMap.set("_scaleX", a) : this._scaleX = a; + const l = e.offsetX; + if (zl(l)) { + const y = (v, x, I) => dn(l(v, x, I)); + this._dynamicPropertyMap.set("xOffset", y); + } else + this.xOffset = dn(l) || 0; + const c = e.offsetY; + if (zl(c)) { + const y = (v, x, I) => dn(c(v, x, I)); + this._dynamicPropertyMap.set("yOffset", y); + } else + this.yOffset = dn(c) || 0; + const h = e.outlineWidth; + if (zl(h)) { + const y = (v, x, I) => dn(h(v, x, I)); + this._dynamicPropertyMap.set("_outlineWidth", y); + } else + this._outlineWidth = dn(h) || 0; + const p = e.rotation; + if (zl(p) ? this._dynamicPropertyMap.set("_angle", p) : this._angle = p || 0, _e(e.effects)) { + const y = e.effects; + zl(y) ? this._dynamicPropertyMap.set("_effects", y) : this._effects = y; + } + if (_e(e.markerPlacement)) { + const y = e.markerPlacement; + zl(y) ? this._dynamicPropertyMap.set("_markerPlacement", y) : this._markerPlacement = y; + } + this._scaleFactor = Gu(e.scaleFactor, 1), this._bitSet = (e.alignment === vy.MAP ? 1 : 0) | (e.colorLocked ? 1 : 0) << 1 | (e.scaleSymbolsProportionally ? 1 : 0) << 3, this._materialKey = e.materialKey; + } + static fromCIMMarker(e, i) { + const [r, n] = Q4(e.scaleInfo, i); + return new jDt(e, r, n); + } + bindFeature(e, i, r) { + const n = e.readLegacyFeature(), s = e.getObjectId(); + this._dynamicPropertyMap.forEach((Me, ke) => { + this[ke] = Me(n, i, r); + }); + const o = this._cimMarkerLayer.materialHash, a = typeof o == "function" ? o(n, i, r, s) : o, l = this._materialCache.get(a); + if (!l || !L_(l.spriteMosaicItem) || !l.spriteMosaicItem) + return void Ei.getLogger("esri.views.2d.engine.webgl.WGLDynamicMarkerTemplate").error(new ot("mapview-cim", "Encountered an error when binding feature")); + const c = l.spriteMosaicItem, h = this._cimMarkerLayer.sizeRatio, p = c.width / c.height * this._scaleX, y = this._cimMarkerLayer.rotateClockwise ? this._angle : -this._angle; + let v = this._size, x = v * p; + const I = this.xOffset, P = this.yOffset; + this.xOffset *= this._scaleFactor, this.yOffset *= this._scaleFactor; + const F = this._cimMarkerLayer.scaleSymbolsProportionally && this._cimMarkerLayer.frameHeight ? this._size / dn(this._cimMarkerLayer.frameHeight) : 1, k = this._outlineWidth * F, V = dn(this._cimMarkerLayer.referenceSize); + let j = 0, Y = 0; + const X = this._cimMarkerLayer.anchorPoint; + X && (this._cimMarkerLayer.isAbsoluteAnchorPoint ? this._size && (j = dn(X.x) / (this._size * p), Y = dn(X.y) / this._size) : (j = X.x, Y = X.y)), this._anchorX = j, this._anchorY = Y, this._sizeOutlineWidth = tf(Math.round(Math.min(Math.sqrt(128 * x), 255)), Math.round(Math.min(Math.sqrt(128 * v), 255)), Math.round(Math.min(Math.sqrt(128 * k), 255)), Math.round(Math.min(Math.sqrt(128 * V), 255))), this.angle = y; + const Q = Math.round(64 * h); + this._bitestAndDistRatio = Vn(this._bitSet, Q); + const re = c.rect.x + Cc, he = c.rect.y + Cc, fe = re + c.width, be = he + c.height; + this._texUpperLeft = Vn(re, he), this._texUpperRight = Vn(fe, he), this._texBottomLeft = Vn(re, be), this._texBottomRight = Vn(fe, be); + const Se = d4.load(this._materialKey); + Se.sdf = c.sdf, Se.pattern = !0, Se.textureBinding = c.textureBinding, this._materialKey = Se.data, x *= h, v *= h, x *= this._scaleFactor, v *= this._scaleFactor, x *= c.rect.width / c.width, v *= c.rect.height / c.height, this._computedWidth = x, this._computedHeight = v, this._applyTransformation(mur, fur), this.xOffset = I, this.yOffset = P; + } +}; +function j9e(t) { + if (t == null) + return []; + const e = new Array(t.length); + for (let i = 0; i < t.length; i++) + e[i] = t.charCodeAt(i); + return e; +} +const xst = 5; +function yur(t, e, i, r) { + return typeof t.text == "string" ? t.text : typeof t.text == "function" ? t.text(e, i, r) ?? "" : ""; +} +let vur = class GDt extends ADt(jve) { + constructor(e, i, r) { + super(e), this._horizontalAlignment = "center", this._verticalAlignment = "middle", this._textToGlyphs = /* @__PURE__ */ new Map(), this._minMaxZoom = Vn(Math.round(i * Dy), Math.round(r * Dy)); + const n = e.scaleFactor || 1; + this._cimTextLayer = e; + const s = e.color; + if (zl(s)) { + const I = (P, F, k) => rf(s(P, F, k)); + this._dynamicPropertyMap.set("_color", I); + } else + this._color = rf(s); + const o = e.outlineColor; + if (zl(o)) { + const I = (P, F, k) => rf(o(P, F, k)); + this._dynamicPropertyMap.set("_haloColor", I); + } else + this._haloColor = rf(o); + let a; + zl(e.size) || (a = Math.min(Math.round(dn(e.size * e.sizeRatio)), 127)); + const l = (I, P, F) => zl(e.size) ? Math.min(Math.round(dn(e.size(I, P, F) * e.sizeRatio)), 127) : a; + if (this._dynamicPropertyMap.set("_size", l), zl(e.outlineSize)) { + const I = (P, F, k) => Math.min(Math.floor(xst * dn(e.outlineSize(P, F, k) * e.sizeRatio)), 127); + this._dynamicPropertyMap.set("_haloSize", I); + } else + this._haloSize = Math.min(Math.floor(xst * dn(e.outlineSize * e.sizeRatio)), 127); + let c; + zl(e.offsetX) || (c = Math.round(dn(e.offsetX * e.sizeRatio))); + const h = (I, P, F) => zl(e.offsetX) ? Math.round(dn(e.offsetX(I, P, F) * e.sizeRatio)) : c; + let p; + this._dynamicPropertyMap.set("_xOffset", h), zl(e.offsetY) || (p = Math.round(dn(e.offsetY * e.sizeRatio))); + const y = (I, P, F) => zl(e.offsetY) ? Math.round(dn(e.offsetY(I, P, F) * e.sizeRatio)) : p; + if (this._dynamicPropertyMap.set("_yOffset", y), zl(e.angle) ? this._dynamicPropertyMap.set("_angle", e.angle) : this._angle = e.angle, zl(e.horizontalAlignment) ? this._dynamicPropertyMap.set("_horizontalAlignment", e.horizontalAlignment) : this._horizontalAlignment = e.horizontalAlignment, zl(e.verticalAlignment) ? this._dynamicPropertyMap.set("_verticalAlignment", e.verticalAlignment) : this._verticalAlignment = e.verticalAlignment, _e(e.effects)) { + const I = e.effects; + zl(I) ? this._dynamicPropertyMap.set("_effects", I) : this._effects = I; + } + if (_e(e.markerPlacement)) { + const I = e.markerPlacement; + zl(I) ? this._dynamicPropertyMap.set("_markerPlacement", I) : this._textPlacement = I; + } + zl(e.text) ? this._dynamicPropertyMap.set("_text", e.text) : this._text = e.text, this._backgroundColor = e.backgroundColor && rf(e.backgroundColor), this._borderLineColor = e.borderLineColor && rf(e.borderLineColor), this._borderLineSize = e.borderLineWidth, this._scaleFactor = n; + const v = Math.min(Math.round(dn(e.referenceSize * e.sizeRatio)), 127); + this._referenceSize = Math.round(Math.sqrt(256 * v)), this._materialKey = e.materialKey; + const x = nz.load(this._materialKey); + x.sdf = !0, this._bitset = (e.alignment === vy.MAP ? 1 : 0) | (e.colorLocked ? 1 : 0) << 1, this._materialKey = x.data, this._decoration = "none", this._lineHeight = 1, this._lineWidth = 512, this._isCIM = !0; + } + static fromCIMText(e, i) { + const [r, n] = Q4(e.scaleInfo, i); + return new GDt(e, r, n); + } + async analyze(e, i, r, n) { + const s = i.readLegacyFeature(), o = yur(this._cimTextLayer, s, r, n), a = await super.analyze(e, i, r, n, j9e(o)); + return a && a.glyphMosaicItems && this._textToGlyphs.set(o, a.glyphMosaicItems), a; + } + bindFeature(e, i, r) { + const n = e.readLegacyFeature(); + if (this._dynamicPropertyMap.forEach((o, a) => { + this[a] = o(n, i, r); + }), !this._text || this._text.length === 0) + return void (this._shapingInfo = null); + this._size *= this._scaleFactor, this._scale = this._size / hve, this._xOffset *= this._scaleFactor, this._yOffset *= this._scaleFactor, this._xAlignD = TRt(Gu(this._horizontalAlignment, "center")), this._yAlignD = ERt(Gu(this._verticalAlignment, "baseline")); + const s = this._textToGlyphs.get(this._text) ?? []; + this.bindTextInfo(s, !1); + } +}; +const RB = 128; +let _2e = class oj extends $Dt(ore) { + constructor(e, i, r, n, s, o, a, l, c, h, p, y, v, x, I, P) { + super(), this._effects = x; + const F = nC.load(e); + i && (F.sdf = i.sdf, F.pattern = !0, F.textureBinding = i.textureBinding), this.fillColor = r, this.tl = n, this.br = s, this.aux21 = Vn(o, a), this.aux22 = Vn(l, c), this.aux3 = tf(h, p, y, 0), this._bitset = v, this._minMaxZoom = Vn(Math.round(I * Dy), Math.round(P * Dy)), this._materialKey = F.data; + } + static fromCIMFill(e, i, r) { + const n = e.color, s = n && rf(n) || 0, o = e.materialKey, [a, l] = Q4(e.scaleInfo, r), c = (e.colorLocked ? V6 : 0) | (e.applyRandomOffset ? qAt : 0) | (e.sampleAlphaOnly ? dve : 0) | (e.hasUnresolvedReplacementColor ? YAt : 0); + if (!i) + return new oj(o, null, s, 0, 0, 0, 0, 0, 0, 0, 0, 0, c, e.effects, a, l); + const { rect: h, width: p, height: y } = i, v = e.scaleX || 1, x = h.x + Cc, I = h.y + Cc, P = x + p, F = I + y, k = dn(e.height); + let V = v * k; + e.cim.type === "CIMHatchFill" && (V *= p / y); + let j = Math.round(k); + j <= 0 && (j = F - I); + let Y = Math.round(V); + Y <= 0 && (Y = P - x); + const X = dn(e.offsetX || 0), Q = dn(-e.offsetY || 0), re = Vn(x, I), he = Vn(P, F); + return new oj(o, i, s, re, he, Y, j, X, Q, RB, RB, fte(e.angle), c, e.effects, a, l); + } + static fromSimpleFill(e, i, r = !1) { + const { color: n } = e, s = n && e.style !== "esriSFSNull" && Eb(n) || 0, o = r ? V6 : 0, a = e.materialKey; + let l; + if (i) { + const { rect: c, width: h, height: p, pixelRatio: y } = i, v = c.x + Cc, x = c.y + Cc, I = v + h, P = x + p, F = Vn(v, x), k = Vn(I, P); + l = new oj(a, i, s, F, k, h / y, p / y, 0, 0, RB, RB, 0, o, null, JE, ZE); + } else + l = new oj(a, null, s, 0, 0, 0, 0, 0, 0, 0, 0, 0, o, null, JE, ZE); + return l._maybeAddLineTemplate(e), l; + } + static fromPictureFill(e, i, r = !1) { + const n = BAt, { rect: s, width: o, height: a } = i, l = s.x + Cc, c = s.y + Cc, h = l + o, p = c + a, y = Vn(l, c), v = Vn(h, p), x = Math.round(dn(e.width)), I = Math.round(dn(e.height)), P = dn(e.xoffset), F = dn(-e.yoffset), k = e.materialKey, V = r ? V6 : 0, j = new oj(k, i, n, y, v, x, I, P, F, RB * e.xscale, RB * e.yscale, 0, V, null, JE, ZE); + return j._maybeAddLineTemplate(e), j; + } +}, _ur = class { + constructor() { + this._resolver = null; + } + isHeld() { + return !!this._resolver; + } + async acquire() { + this._resolver ? (await this._resolver.promise, await this.acquire()) : this._resolver = mm(); + } + release() { + const e = this._resolver; + this._resolver = null, e?.resolve(); + } +}; +async function bur(t, e, i) { + try { + await t.acquire(), await e(i), t.release(); + } catch (r) { + throw t.release(), r; + } +} +const wur = { marker: En.MARKER, fill: En.FILL, line: En.LINE, text: En.TEXT }; +let xur = class { + constructor(e, i, r, n) { + const s = { minScale: i?.minScale, maxScale: i?.maxScale }, o = Sur(s); + this.layers = e, this.data = i, this.hash = this._createHash() + o, this.rendererKey = r; + const a = { isOutline: !1, placement: null, symbologyType: Zo.DEFAULT, vvFlags: r }; + for (const l of e) { + const c = wur[l.type]; + a.isOutline = l.type === "line" && l.isOutline, l.materialKey = rC(c, a), l.maxVVSize = n, l.scaleInfo = s, l.templateHash += o; + } + } + get type() { + return "expanded-cim"; + } + _createHash() { + let e = ""; + for (const i of this.layers) + e += i.templateHash; + return e; + } +}; +function Sur(t) { + return t.minScale || t.maxScale ? t.minScale + "-" + t.maxScale : ""; +} +async function Cur(t, e, i) { + if (!t.name) + throw new ot("style-symbol-reference-name-missing", "Missing name in style symbol reference"); + if (t.styleName && t.styleName === "Esri2DPointSymbolsStyle") + return Tur(t, i); + try { + return Eur(await TLe(t, e, i), t.name, e, i); + } catch (r) { + return hn(r), null; + } +} +async function Tur(t, e) { + const i = Tpt.replace(/\{SymbolName\}/gi, t.name); + try { + const r = await Yte(i, e); + return Dge(r.data); + } catch (r) { + return hn(r), null; + } +} +async function Eur(t, e, i, r) { + const n = t.data, s = { portal: i && _e(i.portal) ? i.portal : Ic.getDefault(), url: ca(t.baseUrl), origin: "portal-item" }, o = n.items.find((l) => l.name === e); + if (!o) + throw new ot("symbolstyleutils:symbol-name-not-found", `The symbol name '${e}' could not be found`, { symbolName: e }); + let a = Cx(Cpt(o, "cimRef"), s); + T_t() && (a = Ode(a)); + try { + const l = await Yte(a, r); + return Dge(l.data); + } catch (l) { + return hn(l), null; + } +} +const Sst = async (t, e, i) => new xur(await Ner(t.data, e, i), t.data, t.rendererKey, t.maxVVSize); +async function LS(t, e, i, r) { + if (!t) + return null; + if (t.type === "cim") + return Sst(t, e, i); + if (t.type === "web-style") { + const n = { type: "cim", data: await Cur(t, null, r) ?? void 0, rendererKey: t.rendererKey, maxVVSize: t.maxVVSize }; + return Sst(n, e, i); + } + return t; +} +function pae(t) { + if (!t) + return null; + const { avoidSDFRasterization: e, type: i, cim: r, url: n, materialHash: s } = t, o = { cim: r, type: i, mosaicHash: s, url: n, size: null, dashTemplate: null, path: null, text: null, fontName: null, animatedSymbolProperties: null, avoidSDFRasterization: e }; + switch (i) { + case "marker": + o.size = t.size, o.path = t.path, o.animatedSymbolProperties = t.animatedSymbolProperties; + break; + case "line": + o.dashTemplate = t.dashTemplate; + break; + case "text": + o.text = t.text, o.fontName = t.fontName; + } + return o; +} +const o_ = Ei.getLogger("esri.views.2d.engine.webgl.mesh.templates.WGLTemplateStore"), Cst = { sortKey: null, templates: new Array() }, G9e = { isOutline: !1, placement: null, symbologyType: Zo.DEFAULT, vvFlags: 0 }, Iur = { ...CIe, hash: JSON.stringify(CIe), materialKey: rC(En.MARKER, G9e) }, Aur = { ...TIe, hash: JSON.stringify(TIe), materialKey: rC(En.LINE, G9e) }, Pur = { ...EIe, hash: JSON.stringify(EIe), materialKey: rC(En.FILL, G9e) }; +function DA(t, e) { + const i = t.length; + return t.push(null), e.then((r) => t[i] = r), t; +} +function tK(t) { + return t != null && !!(1 & t); +} +function Our(t) { + return t.name === "worker:port-closed"; +} +let UDt = class { + constructor(e, i) { + this._idCounter = 1, this._templateIdCounter = 1, this._idToTemplateGroup = /* @__PURE__ */ new Map(), this._symbolToTemplate = /* @__PURE__ */ new Map(), this._fetchQueue = [], this._idToResolver = /* @__PURE__ */ new Map(), this._cimTemplateCache = /* @__PURE__ */ new Map(), this._cimAnalyses = [], this._lock = new _ur(), this._fetchResource = e, this._tileInfo = i; + } + get _markerError() { + return this._errorTemplates.marker[0]; + } + get _fillError() { + return this._errorTemplates.fill[0]; + } + get _lineError() { + return this._errorTemplates.line[0]; + } + get _textError() { + return this._errorTemplates.line[0]; + } + createTemplateGroup(e, i, r = null) { + this._initErrorTemplates(); + const n = e.hash, s = this._symbolToTemplate.get(n); + if (s != null) + return s; + const o = new Array(), a = { sortKey: r, templates: o }; + i && this._createMeshTemplates(o, i, !0), this._createMeshTemplates(o, e, !1); + const l = this._createGroupId(e.type === "expanded-cim" && Rur(e)); + return this._idToTemplateGroup.set(l, a), this._symbolToTemplate.set(n, l), l; + } + getTemplateGroup(e) { + return this._idToTemplateGroup.get(e) ?? Cst; + } + getDynamicTemplateGroup(e) { + return this._idToTemplateGroup.has(e) ? (tK(e) || o_.error("mapview-template-store", `Id ${e} does not refer to a dynamic template`), this._idToTemplateGroup.get(e)) : Cst; + } + getMosaicItem(e, i) { + const r = this._createTemplateId(), n = new Promise((s) => this._idToResolver.set(r, s)); + return this._fetchQueue.push({ symbol: e, id: r, glyphIds: i }), n; + } + finalize(e) { + return this._fetchQueue.length || this._lock.isHeld() ? bur(this._lock, this._fetchAllQueuedResources.bind(this), e) : Promise.resolve(); + } + _initErrorTemplates() { + this._errorTemplates || (this._errorTemplates = { fill: this._createMeshTemplates([], Pur, !1), marker: this._createMeshTemplates([], Iur, !1), line: this._createMeshTemplates([], Aur, !1) }); + } + _fetchAllQueuedResources(e) { + if (!this._fetchQueue.length) + return Promise.resolve(); + const i = this._fetchQueue, r = this._cimAnalyses; + return this._fetchQueue = [], this._cimAnalyses = [], Promise.all(r).then(() => this._fetchResource(i, e).then((n) => { + for (const { id: s, mosaicItem: o } of n) + this._idToResolver.get(s)(o), this._idToResolver.delete(s); + })).catch((n) => { + us(n) ? this._fetchQueue = this._fetchQueue.concat(i) : Our(n) || o_.error(new ot("mapview-template-store", "Unable to fetch requested texture resources", n)); + }); + } + _createGroupId(e) { + return this._idCounter++ << 1 | (e ? 1 : 0); + } + _createTemplateId() { + return this._templateIdCounter++; + } + async _createSMS(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(e); + return L_(i, o_) ? QX.fromSimpleMarker(e, i) : this._markerError; + } + async _createPMS(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(e); + return L_(i, o_) ? QX.fromPictureMarker(e, i) : this._markerError; + } + async _createSFS(e, i) { + const { spriteMosaicItem: r } = await this.getMosaicItem(e); + return L_(r, o_) ? _2e.fromSimpleFill(e, r, i) : this._fillError; + } + async _createPFS(e, i) { + const { spriteMosaicItem: r } = await this.getMosaicItem(e); + return L_(r, o_) ? _2e.fromPictureFill(e, r, i) : this._fillError; + } + async _createSLS(e, i) { + const { spriteMosaicItem: r } = await this.getMosaicItem(e); + return L_(r, o_) ? yDe.fromSimpleLine(e, r) : this._lineError; + } + async _createLMS(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(e); + return L_(i, o_) ? QX.fromLineSymbolMarker(e, i) : this._markerError; + } + async _createTS(e) { + const { glyphMosaicItems: i } = await this.getMosaicItem(e); + return hDe.fromText(e, i ?? []); + } + async _createCIMText(e) { + const { glyphMosaicItems: i } = await this.getMosaicItem(pae(e), j9e(e.text)); + return L_(i, o_) ? hDe.fromCIMText(e, i, this._tileInfo) : this._textError; + } + async _createCIMFill(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(pae(e)); + return L_(i, o_) ? _2e.fromCIMFill(e, i, this._tileInfo) : this._fillError; + } + async _createCIMLine(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(pae(e)); + return L_(i, o_) ? yDe.fromCIMLine(e, i, this._tileInfo) : this._lineError; + } + async _createCIMMarker(e) { + const { spriteMosaicItem: i } = await this.getMosaicItem(pae(e)); + return L_(i, o_) ? QX.fromCIMMarker(e, i, this._tileInfo) : this._markerError; + } + async _createCIM(e) { + const i = e.templateHash; + let r = this._cimTemplateCache.get(i); + if (r != null) + return r; + switch (e.type) { + case "marker": + r = await this._createCIMMarker(e); + break; + case "line": + r = await this._createCIMLine(e); + break; + case "fill": + r = await this._createCIMFill(e); + break; + case "text": + r = await this._createCIMText(e); + } + return this._cimTemplateCache.set(i, r), r; + } + async _createDynamicCIM(e) { + const i = e.templateHash; + let r = this._cimTemplateCache.get(i); + if (r != null) + return r; + switch (e.type) { + case "marker": + r = gur.fromCIMMarker(e, this._tileInfo); + break; + case "line": + r = pur.fromCIMLine(e, this._tileInfo); + break; + case "fill": + r = dur.fromCIMFill(e, this._tileInfo); + break; + case "text": + r = vur.fromCIMText(e, this._tileInfo); + } + return this._cimTemplateCache.set(i, r), r; + } + _createPrimitiveMeshTemplates(e, i, r) { + switch (i.type) { + case "esriSMS": + return DA(e, this._createSMS(i)); + case "esriPMS": + return DA(e, this._createPMS(i)); + case "esriSFS": + return DA(e, this._createSFS(i, r)); + case "line-marker": + return DA(e, this._createLMS(i)); + case "esriPFS": + return DA(e, this._createPFS(i, r)); + case "esriSLS": + return DA(e, this._createSLS(i, !1)); + case "esriTS": + return DA(e, this._createTS(i)); + default: + return o_.error("Unable to create mesh template for unknown symbol type {: $ }{symbol.type}"), e; + } + } + _createMeshTemplates(e, i, r) { + if (i.type.includes("3d")) + return o_.error("3D symbols are not supported with MapView"), e; + if (i.type === "expanded-cim") { + for (const n of i.layers) + typeof n.materialHash == "function" ? DA(e, this._createDynamicCIM(n)) : DA(e, this._createCIM(n)); + return e; + } + if (i.type === "composite-symbol") { + for (const n of i.layers) + this._createPrimitiveMeshTemplates(e, n, r); + return e; + } + return i.type === "cim" || i.type === "label" || i.type === "web-style" ? e : this._createPrimitiveMeshTemplates(e, i, r); + } +}; +const Rur = (t) => { + if (!t.layers) + return !1; + for (const e of t.layers) + if (typeof e.materialHash == "function") + return !0; + return !1; +}; +let zDt = class { + constructor(e, i, r) { + this._loadPromise = sOt(), this._geometryType = e, this._idField = i, this._templateStore = r; + } + update(e, i) { + _e(e.mesh.labels) && (this._labelTemplates = this._createLabelTemplates(e.mesh.labels, i)), this._schema = e; + } + _createLabelTemplates(e, i) { + const r = /* @__PURE__ */ new Map(); + if (e.type === "simple") { + for (const n of e.classes) { + const s = pst.fromLabelClass(n, i); + r.set(n.index, s); + } + return r; + } + for (const n in e.classes) { + const s = e.classes[n]; + for (const o of s) { + const a = pst.fromLabelClass(o, i); + r.set(o.index, a); + } + } + return r; + } + get templates() { + return this._templateStore; + } + async analyze(e, i, r, n, s, o, a) { + if (rg(a)) + return; + let l; + r?.type === "dictionary" && (l = await r.analyze(this._idField, e.copy(), i, s, o, a)); + let c = 0; + for (; e.next(); ) { + let h = null; + if (h = l ? l[c++] : _e(n) && KAt(e.getDisplayId()) && e.readAttribute("cluster_count") !== 1 ? n.match(this._idField, e, this._geometryType, s, o) : r.match(this._idField, e, this._geometryType, s, o), e.setGroupId(h), tK(h)) { + const p = this._templateStore.getDynamicTemplateGroup(h).templates; + for (const y of p) + y && y.analyze && y.analyze(this._templateStore, e, s, o); + } + } + return await this._loadPromise, this._templateStore.finalize(a); + } + async analyzeGraphics(e, i, r, n, s, o) { + if (rg(o)) + return; + const a = e.getCursor(); + for (r && await r.analyze(this._idField, a.copy(), i, n, s, o); a.next(); ) { + let l = a.getGroupId(); + if (l != null && l !== -1 || (l = r?.match(this._idField, a, a.geometryType, n, s), a.setGroupId(l)), tK(l)) { + const c = this._templateStore.getDynamicTemplateGroup(l).templates; + for (const h of c) + h && h.analyze && h.analyze(this._templateStore, a, n, s); + } + a.setGroupId(l); + } + return await this._loadPromise, this._templateStore.finalize(o); + } + writeGraphic(e, i, r, n) { + const s = i.getGroupId(), o = i.getDisplayId(), a = this._templateStore.getTemplateGroup(s); + if (e.featureStart(i.insertAfter, 0), o != null) { + if (tK(s)) + for (const l of a.templates) + l && l.bindFeature(i, null, null); + if (a) { + for (const l of a.templates) + l && l.write(e, i, r, n); + e.featureEnd(); + } + } + } + writeCursor(e, i, r, n, s, o, a) { + const l = i.getGroupId(), c = i.getDisplayId(), h = this._templateStore.getTemplateGroup(l), p = h.templates, y = this._getSortKeyValue(i, h); + if (e.featureStart(0, y), c != null && p) { + if (tK(l)) + for (const v of p) + v.bindFeature(i, r, n); + for (const v of p) + v.write(e, i, s, a); + if (_e(o) && e.hasRecords) { + const v = o && this._findLabelRef(p); + this._writeLabels(e, i, o, v, s, a); + } + e.featureEnd(); + } + } + _getSortKeyValue(e, i) { + const r = this._schema.mesh.sortKey; + if (ut(r)) + return 0; + let n = 0; + return n = r.byRenderer === !0 && i.sortKey != null ? i.sortKey : r.fieldIndex != null ? e.getComputedNumericAtIndex(r.fieldIndex) : r.field != null ? e.readAttribute(r.field) : e.readAttribute(this._idField), n *= r.order === "asc" ? 1 : -1, n == null || isNaN(n) ? 0 : n; + } + _findLabelRef(e) { + for (const i of e) + if (i instanceof QX) + return i; + return null; + } + _writeLabels(e, i, r, n, s, o) { + for (const a of r) + if (_e(a) && a) { + const { glyphs: l, rtl: c, index: h } = a, p = this._labelTemplates.get(h); + if (!p) + continue; + p.setZoomLevel(s), p.bindReferenceTemplate(n), p.bindTextInfo(l, c), p.write(e, i, null, o); + } + } +}; +const vDe = Ei.getLogger("esri/views/2d/engine/webgl/util/Matcher"); +async function ame(t, e, i, r) { + switch (t.type) { + case "simple": + case "heatmap": + return are.fromBasicRenderer(t, e, i, r); + case "map": + return Dur.fromUVRenderer(t, e, i, r); + case "interval": + return Mur.fromCBRenderer(t, e, i, r); + case "dictionary": + return Nur.fromDictionaryRenderer(t, e, i, r); + case "pie-chart": + return Tst.fromPieChartRenderer(t, e, i, r); + case "subtype": + return Tst.fromSubtypes(t, e, i, r); + } +} +let are = class _De { + constructor() { + this.type = "feature", this._defaultResult = null; + } + static async fromBasicRenderer(e, i, r, n) { + const s = new _De(); + if (e.symbol) { + const o = await LS(e.symbol, r, n), a = i.createTemplateGroup(o, null); + s.setDefault(a); + } + return s; + } + static async fromPieChartRenderer(e, i, r, n) { + const s = new _De(); + if (e.markerSymbol) { + const o = await LS(e.markerSymbol, r, n); + let a; + e.fillSymbol && (a = await LS(e.fillSymbol, r, n)); + const l = i.createTemplateGroup(o, a); + s.setDefault(l); + } + return s; + } + size() { + return 1; + } + getDefault() { + return this._defaultResult; + } + setDefault(e) { + this._defaultResult = e; + } + match(e, i, r, n, s) { + return this.getDefault(); + } + async analyze(e, i, r, n, s, o) { + return null; + } +}, Tst = class HDt extends are { + constructor(e, i) { + super(), this._subMatchers = e, this._subtypeField = i; + } + static async fromSubtypes(e, i, r, n) { + const s = /* @__PURE__ */ new Map(), o = []; + for (const a in e.renderers) { + const l = parseInt(a, 10), c = ame(e.renderers[a], i, r, n).then((h) => s.set(l, h)); + o.push(c); + } + return await Promise.all(o), new HDt(s, e.subtypeField); + } + match(e, i, r, n, s) { + const o = i.readAttribute(this._subtypeField), a = this._subMatchers.get(o); + return a ? a.match(e, i, r, n, s) : null; + } +}, Mur = class WDt extends are { + constructor(e, i, r, n) { + super(), this.type = "interval", this._intervals = [], this._isMaxInclusive = i, this._fieldIndex = n, this._field = e, this._normalizationInfo = r; + } + static async fromCBRenderer(e, i, r, n) { + const { isMaxInclusive: s, normalizationField: o, normalizationTotal: a, normalizationType: l } = e, c = e.field, h = new WDt(c, s, { normalizationField: o, normalizationTotal: a, normalizationType: l }, e.fieldIndex), p = await LS(e.backgroundFillSymbol, r, n); + await Promise.all(e.intervals.map(async (v) => { + const x = await LS(v.symbol, r, n), I = await i.createTemplateGroup(x, p), P = { min: v.min, max: v.max }; + h.add(P, I); + })); + const y = await LS(e.defaultSymbol, r, n); + if (y) { + const v = await i.createTemplateGroup(y, p); + h.setDefault(v); + } + return h; + } + add(e, i) { + this._intervals.push({ interval: e, result: i }), this._intervals.sort((r, n) => r.interval.min - n.interval.min); + } + size() { + return super.size() + this._intervals.length; + } + match(e, i, r, n, s) { + if (this._fieldIndex == null && !this._field) + return this.getDefault(); + const o = this._fieldIndex != null ? i.getComputedNumericAtIndex(this._fieldIndex) : this._getValueFromField(i); + if (o == null || isNaN(o) || o === 1 / 0 || o === -1 / 0) + return this.getDefault(); + for (let a = 0; a < this._intervals.length; a++) { + const { interval: l, result: c } = this._intervals[a], h = o >= l.min, p = this._isMaxInclusive ? o <= l.max : o < l.max; + if (h && p) + return c; + } + return this.getDefault(); + } + _needsNormalization() { + const e = this._normalizationInfo; + return e && (e.normalizationField || e.normalizationTotal || e.normalizationType); + } + _getValueFromField(e) { + const i = e.readAttribute(this._field); + if (!this._needsNormalization() || i == null) + return i; + const { normalizationField: r, normalizationTotal: n, normalizationType: s } = this._normalizationInfo, o = e.readAttribute(r) ?? 1; + if (s) + switch (s) { + case "esriNormalizeByField": + return o ? i / o : void 0; + case "esriNormalizeByLog": + return Math.log(i) * Math.LOG10E; + case "esriNormalizeByPercentOfTotal": + return i / n * 100; + default: + return void vDe.error(`Found unknown normalization type: ${s}`); + } + else + vDe.error("Normalization is required, but no type was set!"); + } +}, Dur = class qDt extends are { + constructor(e, i, r) { + super(), this.type = "map", this._nullResult = null, this._resultsMap = /* @__PURE__ */ new Map(), this._fields = [], this._fieldsIndex = r, this._fields = e, this._seperator = i || ""; + } + static async fromUVRenderer(e, i, r, n) { + const s = e.fieldDelimiter, o = [e.field]; + e.field2 && o.push(e.field2), e.field3 && o.push(e.field3); + const a = await LS(e.backgroundFillSymbol, r, n), l = new qDt(o, s, e.fieldIndex); + await Promise.all(e.map.map(async (h, p) => { + const y = await LS(h.symbol, r, n), v = p + 1, x = await i.createTemplateGroup(y, a, v); + h.value === "" ? l.setNullResult(x) : l.add(h.value, x); + })); + const c = await LS(e.defaultSymbol, r, n); + if (c) { + const h = Number.MAX_SAFE_INTEGER, p = await i.createTemplateGroup(c, a, h); + l.setDefault(p); + } + return l; + } + setNullResult(e) { + this._nullResult = e; + } + add(e, i) { + this._resultsMap.set(e.toString(), i); + } + size() { + return super.size() + this._resultsMap.size; + } + match(e, i, r, n, s) { + if (this._fieldsIndex == null && !this._fields) + return this.getDefault(); + const o = this._fieldsIndex != null ? i.getComputedStringAtIndex(this._fieldsIndex) : this._getValueFromFields(i); + if (this._nullResult !== null && (o == null || o === "" || o === "")) + return this._nullResult; + if (o == null) + return this.getDefault(); + const a = o.toString(); + return this._resultsMap.has(a) ? this._resultsMap.get(a) : this.getDefault(); + } + _getValueFromFields(e) { + const i = []; + for (const r of this._fields) { + const n = e.readAttribute(r); + n == null || n === "" ? i.push("") : i.push(n); + } + return i.join(this._seperator); + } +}; +async function Fur(t, e) { + const i = t || 1; + if (typeof i == "number") + return (n, s, o) => i; + const r = await dge(i, e.spatialReference, e.fields); + return (n, s, o) => T8(r, n, { $view: o }, e.geometryType, s) || 1; +} +let b2e; +async function Lur() { + return b2e || (b2e = Promise.resolve().then(() => Gur)), b2e; +} +let Nur = class YDt extends are { + constructor(e, i, r, n, s, o) { + super(), this.type = "dictionary", this._groupIdCache = new xz(100), this._loader = e, this._fieldMap = e.fieldMap, this._symbolFields = e.getSymbolFields(), this._templates = i, this._info = r, this._scaleFn = n, this._schemaUtilsModule = s, this._symbolOptions = o; + } + static async fromDictionaryRenderer(e, i, r, n) { + const [{ DictionaryLoader: s }, o] = await Promise.all([Promise.resolve().then(() => BUt), Lur()]), a = new s(e.url, e.config, e.fieldMap); + await a.fetchResources({ spatialReference: r.spatialReference, fields: r.fields }); + const l = await Fur(e.scaleExpression, r); + return new YDt(a, i, r, l, o, e.symbolOptions); + } + async _analyzeFeature(e, i, r, n, s) { + const o = e.readLegacyFeature(), a = this._scaleFn(o, r, n), l = this._attributeHash(o) + "-" + a, c = this._groupIdCache.get(l); + if (c) + return c; + const h = { ...n, spatialReference: this._info.spatialReference, abortOptions: s, fields: this._info.fields }, p = await this._loader.getSymbolAsync(o, h), y = this._schemaUtilsModule.createSymbolSchema(p, this._symbolOptions), v = LS(y, this._info, i, s).then((x) => { + if (x?.type !== "expanded-cim") + return vDe.error(new ot("mapview-bad-type", `Found unexpected type ${x?.type} in dictionary response`)), null; + x.hash += "-" + a; + for (const I of x.layers) + I.scaleFactor = a, I.templateHash += "-" + a; + return this._templates.createTemplateGroup(x, null); + }); + return this._groupIdCache.put(l, v, 1), v; + } + async analyze(e, i, r, n, s, o) { + const a = i.getCursor(), l = []; + for (; a.next(); ) + l.push(this._analyzeFeature(a, r, n, s, o)); + return Promise.all(l).then((c) => c.filter(_e)); + } + match(e, i, r, n, s) { + return null; + } + _attributeHash(e) { + let i = ""; + for (const r of this._symbolFields) { + const n = this._fieldMap?.[r]; + n && (i += e.attributes[n] + "-"); + } + return i; + } +}; +function XDt(t) { + if (!t) + return sd.NONE; + let e = 0; + for (const i of t) + if (i.type === "size") { + const r = ePt(i); + e |= r, i.target === "outline" && (e |= r << 4); + } else + i.type === "color" ? e |= sd.COLOR : i.type === "opacity" ? e |= sd.OPACITY : i.type === "rotation" && (e |= sd.ROTATION); + return e; +} +function q$(t) { + return t.type === "line-marker" ? { type: "line-marker", color: t.color?.toJSON(), placement: t.placement, style: t.style } : t.constructor.fromJSON(t.toJSON()).toJSON(); +} +function Y$(t) { + return knr(t); +} +function a1(t, e, i = !1) { + if (!t) + return null; + switch (t.type) { + case "simple-fill": + case "picture-fill": + return $ur(t, e, i); + case "simple-marker": + case "picture-marker": + return Vur(t, e, i); + case "simple-line": + return Bur(t, e, i); + case "text": + return jur(t, e, i); + case "label": + return kur(t, e, i); + case "cim": + return { type: "cim", rendererKey: e.vvFlags, data: t.data, maxVVSize: e.maxVVSize }; + case "CIMSymbolReference": + return { type: "cim", rendererKey: e.vvFlags, data: t, maxVVSize: e.maxVVSize }; + case "web-style": + return { ...q$(t), type: "web-style", hash: t.hash(), rendererKey: e.vvFlags, maxVVSize: e.maxVVSize }; + default: + throw new Error(`symbol not supported ${t.type}`); + } +} +function kur(t, e, i) { + const r = t.toJSON(), n = rC(En.LABEL, { ...e, placement: r.labelPlacement }); + return { materialKey: i ? Y$(n) : n, hash: t.hash(), ...r, labelPlacement: r.labelPlacement }; +} +function $ur(t, e, i) { + const r = rC(En.FILL, e), n = i ? Y$(r) : r, s = t.clone(), o = s.outline, a = Mve(e.symbologyType); + a || (s.outline = null); + const l = { materialKey: n, hash: s.hash(), ...q$(s) }; + if (a) + return l; + const c = []; + if (c.push(l), o) { + const h = rC(En.LINE, { ...e, isOutline: !0 }), p = { materialKey: i ? Y$(h) : h, hash: o.hash(), ...q$(o) }; + c.push(p); + } + return { type: "composite-symbol", layers: c, hash: c.reduce((h, p) => p.hash + h, "") }; +} +function Bur(t, e, i) { + const r = Mve(e.symbologyType) ? Zo.DEFAULT : e.symbologyType, n = rC(En.LINE, { ...e, symbologyType: r }), s = i ? Y$(n) : n, o = t.clone(), a = o.marker; + o.marker = null; + const l = []; + if (l.push({ materialKey: s, hash: o.hash(), ...q$(o) }), a) { + const c = rC(En.MARKER, e), h = i ? Y$(c) : c; + a.color = a.color ?? o.color, l.push({ materialKey: h, hash: a.hash(), lineWidth: o.width, ...q$(a) }); + } + return { type: "composite-symbol", layers: l, hash: l.reduce((c, h) => h.hash + c, "") }; +} +function Vur(t, e, i) { + const r = rC(En.MARKER, e), n = i ? Y$(r) : r, s = q$(t); + return { materialKey: n, hash: t.hash(), ...s, angle: t.angle, maxVVSize: e.maxVVSize }; +} +function jur(t, e, i) { + const r = rC(En.TEXT, e), n = i ? Y$(r) : r, s = q$(t); + return { materialKey: n, hash: t.hash(), ...s, angle: t.angle, maxVVSize: e.maxVVSize }; +} +const Gur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createSymbolSchema: a1 +}, Symbol.toStringTag, { value: "Module" })), MB = 512, KP = 50; +function Uur(t, e) { + const i = Ld(e); + if (!i) + return null; + const [r, n] = i.valid; + return t[2] > n ? [Eo([t[0], t[1], n, t[3]]), Eo([r, t[1], r + t[2] - n, t[3]])] : t[0] < r ? [Eo([r, t[1], t[2], t[3]]), Eo([n - (r - t[0]), t[1], n, t[3]])] : null; +} +function zur(t) { + return t === "text" || t === "esriTS"; +} +function Hur(t) { + return t === "simple-marker" || t === "picture-marker" || t === "esriSMS" || t === "esriPMS"; +} +function Est(t) { + switch (t.geometry.type) { + case "point": + case "multipoint": + return 0; + case "polyline": + return 1; + case "polygon": + case "extent": + return 2; + } + return 0; +} +function Wur(t) { + if (!t) + return null; + const { xmin: e, ymin: i, xmax: r, ymax: n, spatialReference: s } = t; + return new xo({ rings: [[[e, i], [e, n], [r, n], [r, i], [e, i]]], spatialReference: s }); +} +function qur(t, e) { + if (!("visualVariables" in t) || !t.hasVisualVariables("size")) + return 0; + const i = t.getVisualVariablesForType("size"); + if (!i[0]) + return 0; + const r = i[0]; + if (e && r.field === "cluster_count" && e.type === "cluster") + return e.clusterMaxSize; + if (r.target === "outline") + return 0; + if (r.transformationType === "stops") + return r.stops.map((n) => n.size).reduce(w2e, 0); + if (r.transformationType === "clamped-linear") { + let n = -1 / 0, s = -1 / 0; + return n = typeof r.maxSize == "number" ? r.maxSize : r.maxSize.stops.map((o) => o.size).reduce(w2e, 0), s = typeof r.minSize == "number" ? r.minSize : r.minSize.stops.map((o) => o.size).reduce(w2e, 0), Math.max(n, s); + } + return r.transformationType === "real-world-size" ? 30 : void 0; +} +function w2e(t, e) { + return Math.max(t, e); +} +const Tce = 8, KDt = Tce - 2, Ece = Ei.getLogger("esri.views.2d.layers.features.support.rendererUtils"), Yur = (t) => { + if (!("visualVariables" in t) || !t.visualVariables || !t.visualVariables.length) + return t; + const e = t.clone(), i = e.visualVariables.map((r) => JDt(r) ? ZDt(r) : r); + return e.visualVariables = i, e; +}; +function Xur(t) { + return t.map((e) => JDt(e) ? ZDt(e.clone()) : e); +} +function JDt(t) { + return (t.type === "size" || t.type === "color" || t.type === "opacity") && t.stops != null; +} +function ZDt(t) { + return t.stops = Zur(t.type, t.stops ?? []), t; +} +function DB(t, e, i) { + return (1 - i) * t + i * e; +} +function Kur(t, e) { + const [i, ...r] = e, n = r.pop(), s = r[0].value, o = r[r.length - 1].value, a = (o - s) / KDt, l = []; + for (let c = s; c < o; c += a) { + let h = 0; + for (; c >= r[h].value; ) + h++; + const p = r[h], y = e[h - 1], v = c - y.value, x = p.value === y.value ? 1 : v / (p.value - y.value); + if (t === "color") { + const I = r[h], P = e[h - 1], F = I.color.clone(); + F.r = DB(P.color.r, F.r, x), F.g = DB(P.color.g, F.g, x), F.b = DB(P.color.b, F.b, x), F.a = DB(P.color.a, F.a, x), l.push({ value: c, color: F, label: I.label }); + } else if (t === "size") { + const I = r[h], P = e[h - 1], F = $a(I.size), k = DB($a(P.size), F, x); + l.push({ value: c, size: k, label: I.label }); + } else { + const I = r[h], P = DB(e[h - 1].opacity, I.opacity, x); + l.push({ value: c, opacity: P, label: I.label }); + } + } + return [i, ...l, n]; +} +function Jur(t) { + const [e, ...i] = t, r = i.pop(); + for (; i.length > KDt; ) { + let n = 0, s = 0; + for (let o = 1; o < i.length; o++) { + const a = i[o - 1], l = i[o], c = Math.abs(l.value - a.value); + c > s && (s = c, n = o); + } + i.splice(n, 1); + } + return [e, ...i, r]; +} +function Zur(t, e) { + return e.length <= Tce ? e : (Ece.warn(`Found ${e.length} Visual Variable stops, but MapView only supports ${Tce}. Displayed stops will be simplified.`), e.length > 2 * Tce ? Kur(t, e) : Jur(e)); +} +function U9e() { + if (Vi("heatmap-force-raster")) + return "raster"; + const { supportsTextureFloat: t, supportsTextureHalfFloat: e, supportsColorBufferFloat: i, supportsColorBufferFloatBlend: r, supportsColorBufferHalfFloat: n } = hI("2d"); + return t && i && r || e && n ? "symbol" : Vi("heatmap-allow-raster-fallback") ? "raster" : "none"; +} +function Qur(t) { + if (!t) + return !0; + switch (t.type) { + case "dot-density": + if (!hI("2d").supportsTextureFloat) + return Ece.error(new ot("webgl-missing-extension", "Missing WebGL extension OES_Texture_Float which is required for DotDensity")), !1; + break; + case "heatmap": { + const e = U9e(); + if (e === "none" || e === "raster" && !Vi("heatmap-force-raster")) { + const i = hI("2d"), r = ["supportsTextureFloat", "supportsTextureHalfFloat", "supportsColorBufferFloat", "supportsColorBufferFloatBlend", "supportsColorBufferHalfFloat"].filter((n) => !i[n]).join(", "); + if (e === "none") + return Ece.errorOnce(new ot("webgl-missing-extension", `Missing WebGL${i.type} requirements for Heatmap: ${r}`)), !1; + e === "raster" && Ece.warnOnce(`Missing WebGL${i.type} requirements for accelerated Heatmap: ${r}. Feature support may be limited.`); + } + break; + } + } + return !0; +} +const ecr = new zs({ esriGeometryPoint: "point", esriGeometryMultipoint: "multipoint", esriGeometryPolyline: "polyline", esriGeometryPolygon: "polygon", esriGeometryMultiPatch: "multipatch", mesh: "mesh" }); +function Gve(t) { + return ecr.toJSON(t); +} +function QDt(t) { + const { bandCount: e, attributeTable: i, colormap: r, pixelType: n } = t.raster.rasterInfo; + return e === 1 && (i != null || r != null || n === "u8" || n === "s8"); +} +const X$ = Ei.getLogger("esri.views.2d.layers.features.schemaUtils"), j_ = "ValidationError"; +function bte(t, e) { + let i = 0, r = 0, n = Zo.DEFAULT; + if (_e(t)) { + if (r = qur(t, e), "visualVariables" in t && (i = XDt(t.visualVariables || []), t.type === "dot-density" && (n = Zo.DOT_DENSITY)), t.type === "heatmap" && (n = Zo.HEATMAP), t.type === "dictionary") + return { maxVVSize: r, vvFlags: i, symbologyType: Zo.DEFAULT }; + if (t.type === "pie-chart") + return { maxVVSize: r, vvFlags: i, symbologyType: Zo.PIE_CHART }; + if (n !== Zo.DOT_DENSITY && n !== Zo.HEATMAP) { + const s = t.getSymbols(); + "backgroundFillSymbol" in t && t.backgroundFillSymbol && s.push(t.backgroundFillSymbol); + let o = !0, a = !0; + for (const l of s) + if (l.type === "cim" && (a = !1), l.type === "simple-fill" || l.type === "picture-fill") { + const c = l.outline, h = c && c.style !== "none" && c.style !== "solid", p = l.type === "simple-fill" && l.style !== "none" && l.style !== "solid"; + h && (o = !1), (l.type === "picture-fill" || p || h) && (a = !1); + } + o ? n = a ? Zo.OUTLINE_FILL_SIMPLE : Zo.OUTLINE_FILL : a && (n = Zo.SIMPLE); + } + } + return { vvFlags: i, maxVVSize: r, symbologyType: n }; +} +let Ist = null; +function tcr(t) { + if (Vi("esri-2d-update-debug")) { + const e = Ast(t, !0); + console.debug("Created new schema", e), console.debug("Schema diff", zS(Ist, e)), Ist = e; + } + return Ast(t); +} +function Ast(t, e = !1) { + try { + const i = scr(t, e), r = lcr(t), n = {}; + i.map((a) => icr(n, t, a)); + const s = _e(t.subtypeCode) ? `${t.subtypeField} = ${t.subtypeCode}` : null; + return { source: { definitionExpression: E4(t.definitionExpression, s), fields: t.fields.map((a) => a.toJSON()), gdbVersion: t.gdbVersion, historicMoment: t.historicMoment?.getTime(), outFields: t.availableFields, pixelBuffer: t.pixelBuffer, spatialReference: t.spatialReference.toJSON(), timeExtent: t.timeExtent?.toJSON(), customParameters: t.customParameters }, attributes: { fields: {}, indexCount: 0 }, processors: i, tileRenderer: r, targets: n }; + } catch (i) { + if (i.fieldName === j_) + return X$.error(i), null; + throw i; + } +} +function icr(t, e, i) { + switch (i.target) { + case "feature": + return void S2e(t, x2e(e), i); + case "aggregate": { + if (!("featureReduction" in e)) + return; + const r = e.featureReduction; + switch (r?.type) { + case "selection": + throw new ot(j_, "Mapview does not support `selection` reduction type", r); + case "binning": + return S2e(t, x2e(e), i), void rcr(t, r, e.fields.map((n) => n.toJSON()), i); + case "cluster": + return S2e(t, x2e(e), i), void ncr(t, r, e.fields.map((n) => n.toJSON()), i); + } + } + } +} +function z9e(t, e) { + for (const i in e) { + const r = e[i]; + if (r.target !== t.name) + continue; + const n = t.attributes[i]; + if (n?.context) { + const s = n.context; + s.mesh = s.mesh || r.context?.mesh, s.storage = s.storage || r.context?.storage; + } else + t.attributes[i] = r; + } + return t; +} +function x2e(t) { + return [t.filter?.toJSON() ?? null, t.featureEffect?.filter?.toJSON() ?? null]; +} +function S2e(t, e, i) { + return t.feature || (t.feature = { name: "feature", input: "source", filters: e, attributes: {} }), z9e(t.feature, i.attributes.fields), t; +} +function eFt(t, e) { + const { onStatisticExpression: i, onStatisticField: r, statisticType: n } = t; + switch (n) { + case "min": + case "max": + case "avg": + case "avg_angle": + case "sum": + case "count": + return "esriFieldTypeDouble"; + case "mode": { + if (i) { + const { returnType: o } = i; + return o ? o === "string" ? "esriFieldTypeString" : "esriFieldTypeDouble" : (X$.error(new ot(j_, "Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined", t)), "esriFieldTypeString"); + } + const s = e.find((o) => o.name === r); + return s ? s.type : (X$.error(new ot(j_, "Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined", t)), "esriFieldTypeString"); + } + } +} +function rcr(t, e, i, r) { + return t.aggregate || (t.aggregate = { name: "aggregate", type: "bin", filters: null, input: "feature", params: { fixedBinLevel: e.fixedBinLevel, fields: (e.fields ?? []).map((n) => ({ ...n.toJSON(), type: eFt(n, i) })) }, attributes: {} }), z9e(t.aggregate, r.attributes.fields), t; +} +function ncr(t, e, i, r) { + return t.aggregate || (t.aggregate = { name: "aggregate", type: "cluster", input: "feature", filters: null, attributes: {}, params: { clusterRadius: dn(e.clusterRadius / 2), clusterPixelBuffer: 64 * Math.ceil(dn(e.clusterMaxSize) / 64), fields: (e.fields ?? [])?.map((n) => ({ ...n.toJSON(), type: eFt(n, i) })) } }), z9e(t.aggregate, r.attributes.fields), t; +} +function kE(t, e) { + return e.field ? U6(t, { ...e, type: "field", field: e.field }) : e.valueExpression ? U6(t, { ...e, type: "expression", valueExpression: e.valueExpression }) : { field: void 0, fieldIndex: void 0 }; +} +function U6(t, e) { + switch (e.type) { + case "expression": { + const i = e.valueExpression; + if (!t.fields[i]) { + const r = t.indexCount++; + t.fields[i] = { ...e, name: i, fieldIndex: r }; + } + return { fieldIndex: t.fields[i].fieldIndex }; + } + case "label-expression": { + const i = JSON.stringify(e.label); + if (!t.fields[i]) { + const r = t.indexCount++; + t.fields[i] = { ...e, name: i, fieldIndex: r }; + } + return { fieldIndex: t.fields[i].fieldIndex }; + } + case "field": { + const i = e.field; + return e.target === "aggregate" && t.fields[i] || (t.fields[i] = { ...e, name: i }), { field: i }; + } + case "statistic": + return t.fields[e.name] = { ...e }, { field: e.name }; + } +} +function scr(t, e = !1) { + const i = new Array(); + let r = 0; + return i.push(acr(t, r++, e)), i; +} +function C2e(t, e, i, r, n, s = !1) { + const o = U6(t, { type: "label-expression", target: i, context: { mesh: !0 }, resultType: "string", label: { labelExpression: e.labelExpression, labelExpressionInfo: e.labelExpressionInfo ? { expression: e.labelExpressionInfo.expression } : null, symbol: !!e.symbol, where: e.where } }), { fieldIndex: a } = o; + return { ...a1(e, n, s), fieldIndex: a, target: i, index: r }; +} +function ocr(t, e, i) { + const r = "featureReduction" in e && e.featureReduction; + if (!r) + return { fields: [], labels: [], matcher: void 0, rendererOverride: void 0 }; + const n = "aggregate", s = []; + let o = null, a = Gve(e.geometryType), l = [], c = null; + if (r) + switch (r.type) { + case "selection": + return X$.error(new ot(j_, "Mapview does not support `selection` reduction type", r)), { fields: [], labels: [], matcher: void 0, rendererOverride: void 0 }; + case "cluster": + case "binning": + if (s.push(...r.fields ?? []), r.type === "cluster" ? a = "esriGeometryPoint" : r.type === "binning" && (a = "esriGeometryPolygon"), r.renderer && !r.renderer.authoringInfo?.isAutoGenerated) { + if (r.type === "cluster") { + const { renderer: p } = rgt(r.renderer, r, null); + c = p; + } else + c = r.renderer; + const h = bte(r.renderer, r); + o = lme(t, n, r.renderer, h, i), l = r && r.labelsVisible && r.labelingInfo || []; + } else if (r.type === "cluster") { + if (c = n5e(s, e.renderer, r, null, !0), r.symbol) { + const h = bte(c, r); + o = { type: "simple", symbol: a1(r.symbol, h, i), symbologyType: h.symbologyType }; + } + l = r && r.labelsVisible && r.labelingInfo || []; + } + } + return ccr(t, s), { labels: p5e(l, r.type === "binning" ? "esriGeometryPolygon" : a), matcher: o, fields: s, rendererOverride: c }; +} +function acr(t, e, i = !1) { + const r = { indexCount: 0, fields: {} }, n = "featureReduction" in t ? t.featureReduction ?? void 0 : void 0, s = n ? "aggregate" : "feature"; + if ("sublayers" in t) { + const F = { type: "subtype", subtypeField: t.subtypeField, renderers: {}, symbologyType: Zo.DEFAULT }, k = { type: "subtype", mapping: {}, target: "feature", subtypeField: t.subtypeField }, V = { type: "subtype", classes: {} }, j = { type: "symbol", target: "feature", aggregateFields: [], attributes: r, storage: k, mesh: { matcher: F, aggregateMatcher: null, labels: V, sortKey: null } }, Y = /* @__PURE__ */ new Set(); + let X = 0; + for (const { renderer: Q, subtypeCode: re, labelingInfo: he, labelsVisible: fe } of t.sublayers) { + let be = 0; + "visualVariables" in Q && Q.visualVariables && (Q.visualVariables.some((ce) => ce.type !== "rotation") && X$.warnOnce("SubtypeGroupLayer currently only supports rotation visualVariables. All other visualVariable types will be ignored."), be = XDt(Q.visualVariables.filter((ce) => ce.type !== "size"))); + const Se = { symbologyType: Zo.DEFAULT, vvFlags: be, maxVVSize: 0 }, Me = lme(r, s, Q, Se, i), ke = Pst(r, s, Q), J = fe && he; + if (Me.type === "dictionary") + throw new ot(j_, "Dictionary renderer is not supported in subtype layers"); + if (Me.type === "subtype") + throw new ot(j_, "Nested subtype renderers is not supported"); + if (_e(ke) && ke.type === "subtype") + throw new ot(j_, "Nested subtype storage is not supported"); + if (_e(ke) && _e(ke.attributeMapping)) + throw new ot(j_, "Non-visual-variable attributes are not supported in subtype layers"); + if (Me.type === "heatmap") + throw new ot(j_, "Heatmaps are not supported in subtype layers"); + if (Me.type === "pie-chart") + throw new ot(j_, "Pie-charts are not supported in subtype layers"); + if (Y.has(re)) + throw new ot(j_, "Subtype codes for sublayers must be unique"); + Y.add(re), F.renderers[re] = Me, k.mapping[re] = ke, J && (V.classes[re] = J.map((ce) => C2e(r, ce, "feature", X++, Se, i))); + } + return j; + } + if (t.renderer?.type === "heatmap" && U9e() === "raster") { + const { radius: F, fieldOffset: k, field: V } = t.renderer; + return { type: "heatmap", aggregateFields: [], attributes: r, target: s, storage: null, mesh: { radius: F, fieldOffset: k, field: kE(r, { target: s, field: V, resultType: "numeric" }).field } }; + } + const o = ocr(r, t, i), a = Gve(t.geometryType), l = o.rendererOverride ?? t.renderer, c = bte(l, n), h = lme(r, s, l, c, i), p = Pst(r, s, l), y = ucr(r, t.orderBy, t.renderer, n), v = t.labelsVisible && t.labelingInfo || [], x = p5e(v, a); + let I = 0; + const P = [...x.map((F) => C2e(r, F, "feature", I++, c, i)), ...o.labels.map((F) => C2e(r, F, "aggregate", I++, c, i))]; + return { type: "symbol", target: s, attributes: r, aggregateFields: o.fields, storage: p, mesh: { matcher: h, labels: { type: "simple", classes: P }, aggregateMatcher: o.matcher, sortKey: y } }; +} +function lcr(t) { + return t.renderer?.type === "heatmap" && U9e() === "raster" ? { type: "heatmap" } : { type: "symbol" }; +} +function ucr(t, e, i, r) { + if (_e(r)) + return null; + if (_e(e) && e.length) { + e.length > 1 && X$.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${e.length}. All but the first will be discarded`); + const n = e[0], s = n.order === "ascending" ? "asc" : "desc"; + return n.field ? { field: n.field, order: s } : n.valueExpression ? { fieldIndex: U6(t, { type: "expression", target: "feature", valueExpression: n.valueExpression, resultType: "numeric" }).fieldIndex, order: s } : (X$.error(new ot(j_, "Expected to find a field or valueExpression for OrderByInfo", n)), null); + } + return _e(i) && i.type === "unique-value" && i.orderByClassesEnabled ? { byRenderer: !0, order: "asc" } : null; +} +function ccr(t, e) { + const i = { mesh: !0, storage: !0 }; + for (const r of e) { + const { name: n, onStatisticField: s, onStatisticExpression: o, statisticType: a } = r; + let l, c; + const h = "numeric", p = "feature"; + o ? c = U6(t, { type: "expression", target: p, valueExpression: o.expression, resultType: h }).fieldIndex : l = U6(t, { type: "field", target: p, field: s, resultType: h }).field, U6(t, { type: "statistic", target: "aggregate", name: n, context: i, inField: l, inFieldIndex: c, statisticType: a }); + } +} +function Pst(t, e, i) { + let r; + switch (i.type) { + case "simple": + case "class-breaks": + case "unique-value": + case "dictionary": + r = { visualVariables: !0, attributes: null }; + break; + default: + r = jMt(i).getStorageSpec(i); + } + return hcr(t, e, r, i); +} +function hcr(t, e, i, r) { + if (ut(i)) + return null; + const { visualVariables: n, attributes: s } = i; + let o = null; + n && "visualVariables" in r && (o = dcr(t, e, r.visualVariables)); + const a = _e(o) ? 4 : 0; + let l = null; + return _e(s) && (l = s.map((c, h) => { + const { field: p, fieldIndex: y } = kE(t, { valueExpression: c.valueExpression, field: c.field, resultType: "numeric", target: e }); + return { binding: h + a, field: p, fieldIndex: y }; + })), { type: "simple", target: e, attributeMapping: l, vvMapping: o }; +} +function dcr(t, e, i) { + if (!i || !i.length) + return []; + const r = { storage: !0 }, n = "numeric"; + return Xur(i).map((s) => { + const o = E9i(s.type), { field: a, fieldIndex: l } = kE(t, { target: e, valueExpression: s.valueExpression, field: s.field, context: r, resultType: n }); + switch (s.type) { + case "size": + return s.valueExpression === "$view.scale" ? null : { type: "size", binding: o, field: a, fieldIndex: l, normalizationField: kE(t, { target: e, field: s.normalizationField, context: r, resultType: n }).field, valueRepresentation: s.valueRepresentation ?? null }; + case "color": + return { type: "color", binding: o, field: a, fieldIndex: l, normalizationField: kE(t, { target: e, field: s.normalizationField, context: r, resultType: n }).field }; + case "opacity": + return { type: "opacity", binding: o, field: a, fieldIndex: l, normalizationField: kE(t, { target: e, field: s.normalizationField, context: r, resultType: n }).field }; + case "rotation": + return { type: "rotation", binding: o, field: a, fieldIndex: l }; + } + }).filter(_e); +} +function lme(t, e, i, r, n = !1) { + const s = Gu(t, { indexCount: 0, fields: {} }); + switch (i.type) { + case "simple": + case "dot-density": + return pcr(s, i, r, n); + case "class-breaks": + return mcr(s, e, i, r, n); + case "unique-value": + return gcr(s, e, i, r, n); + case "dictionary": + return ycr(s, i, r, n); + case "heatmap": + return vcr(s, i, r, n); + case "pie-chart": + return fcr(s, i, r, n); + } +} +function pcr(t, e, i, r = !1) { + const n = e.getSymbols(), s = n.length ? n[0] : null; + return { type: "simple", symbol: a1(s, i, r), symbologyType: i.symbologyType }; +} +function fcr(t, e, i, r = !1) { + const n = e.getSymbols(), s = n[0], o = n.length > 1 ? n[1] : null; + return { type: "pie-chart", markerSymbol: a1(s, i, r), fillSymbol: a1(o, i, r), symbologyType: i.symbologyType }; +} +function mcr(t, e, i, r, n = !1) { + const s = { mesh: !0, use: "renderer.field" }, o = i.backgroundFillSymbol, { field: a, fieldIndex: l } = kE(t, { target: e, field: i.field, valueExpression: i.valueExpression, resultType: "numeric", context: s }), c = i.normalizationType, h = c === "log" ? "esriNormalizeByLog" : c === "percent-of-total" ? "esriNormalizeByPercentOfTotal" : c === "field" ? "esriNormalizeByField" : null, p = i.classBreakInfos.map((y) => ({ symbol: a1(y.symbol, r, n), min: y.minValue, max: y.maxValue })).sort((y, v) => y.min - v.min); + return { type: "interval", attributes: t.fields, field: a, fieldIndex: l, backgroundFillSymbol: a1(o, r, n), defaultSymbol: a1(i.defaultSymbol, r, n), intervals: p, normalizationField: i.normalizationField, normalizationTotal: i.normalizationTotal, normalizationType: h, isMaxInclusive: i.isMaxInclusive, symbologyType: r.symbologyType }; +} +function gcr(t, e, i, r, n = !1) { + const s = [], o = i.backgroundFillSymbol, a = { target: e, context: { mesh: !0 }, resultType: "string" }; + if (i.field && typeof i.field != "string") + throw new ot(j_, "Expected renderer.field to be a string", i); + const { field: l, fieldIndex: c } = kE(t, { ...a, field: i.field, valueExpression: i.valueExpression }); + for (const h of i.uniqueValueInfos ?? []) + s.push({ value: "" + h.value, symbol: a1(h.symbol, r, n) }); + return { type: "map", attributes: t.fields, field: l, fieldIndex: c, field2: kE(t, { ...a, field: i.field2 }).field, field3: kE(t, { ...a, field: i.field3 }).field, fieldDelimiter: i.fieldDelimiter ?? void 0, backgroundFillSymbol: a1(o, r), defaultSymbol: a1(i.defaultSymbol, r), map: s, symbologyType: r.symbologyType }; +} +function ycr(t, e, i, r = !1) { + return { type: "dictionary", config: e.config, fieldMap: e.fieldMap, scaleExpression: e.scaleExpression, url: e.url, symbolOptions: i, symbologyType: i.symbologyType }; +} +function vcr(t, e, i, r = !1) { + const n = e.getSymbols(), s = n.length ? n[0] : null; + return { type: "heatmap", symbol: a1(s, i, r), symbologyType: i.symbologyType }; +} +let _cr = class bDe extends Vv { + static from(e, i, r) { + const n = j$.createInstance(), s = [], o = e.filter((a) => !!a.geometry); + for (const a of o) { + const l = Fd(a.geometry); + cti(s, [a], l, !1, !1, i); + } + return new bDe(n, s, r); + } + constructor(e, i, r) { + super(e, i, null), this._transform = r; + } + get geometryType() { + const e = this._current; + return e ? e.geometryType : null; + } + get insertAfter() { + return this._current.insertAfter; + } + readGraphic() { + return this._current; + } + getCursor() { + return this.copy(); + } + copy() { + const e = new bDe(this.instance, this._features, this._transform); + return this.copyInto(e), e; + } +}; +const Tq = new Rl(), T2e = new Rl(), Ost = "esriGeometryPolyline"; +function Rst(t) { + t.coords.length = 0, t.lengths.length = 0; +} +let hZ = class Ice { + constructor() { + this.bounds = Eo(), this.graphic = null; + } + static acquire(e = null, i, r, n, s) { + let o; + return Ice._pool.length === 0 ? o = new Ice() : (o = Ice._pool.pop(), this._set.delete(o)), o.acquire(e, i, r, n, s), o; + } + static release(e) { + e && !this._set.has(e) && (e.release(), this._pool.push(e), this._set.add(e)); + } + static getCentroidQuantized(e, i) { + if (za(e.geometry)) { + const r = e.symbol; + if (ut(r)) + return null; + if (r?.layers.length > 0 && r.layers.some((n) => n.type === "text" || n.type === "marker")) { + const n = hge(e.geometry); + return n !== null ? G$e(i, {}, { x: n[0], y: n[1] }, !1, !1) : null; + } + } + return null; + } + acquire(e = null, i, r, n, s) { + e && this.set(e, i, r, n, s); + } + release() { + this.graphic = null, this.symbolResource = null, this.geometry = null; + } + get symbol() { + return this.symbolResource.symbol; + } + set(e, i, r, n, s) { + this.graphic = e, this.geometry = r, this.symbolResource = i, this.bounds = n, s && (this.size = s); + } + getGeometryQuantized(e, i, r, n) { + const s = this.geometry, o = Fd(s); + if (ut(o)) + return null; + switch (o) { + case "esriGeometryPolygon": { + const a = s, { rings: l } = a; + if (!l || l.length === 0) + return null; + let c; + if (c = l.length === 1 && l[0].length === 2 ? nq(e, { paths: [[l[0][0], l[0][1]]] }) : nq(e, this.geometry), !c) { + const h = { x: l[0][0][0], y: l[0][0][1] }; + if (c = nq(e, h), c) { + const { x: p, y } = c; + return { rings: [[[p - 1, y], [1, -1], [1, 1], [-1, 1], [-1, -1]]] }; + } + } + return c; + } + case "esriGeometryPolyline": { + const a = s; + Rst(Tq), Rst(T2e); + const l = a.hasZ ?? !1, c = a.hasM ?? !1; + return H5e(Tq, a), p0t(T2e, Tq, l, c, Ost, e.scale[0]), YO(Tq, T2e, l, c, Ost, e), oye(Tq, a.hasZ ?? !1, a.hasM ?? !1); + } + case "esriGeometryMultipoint": { + const a = s, l = 0.5 * n * Math.max(Math.abs(this.size[0]) + this.size[2] - this.size[0], Math.abs(this.size[1]) + this.size[3] - this.size[1]), c = Ld(r); + let h = a.points; + if (c) { + const [p, y] = c.valid, v = y - p; + h = h.filter((x) => { + if (x[0] + l > y || x[0] - l < p) { + const I = [...x]; + return x[0] + l > y ? I[0] -= v : I[0] += v, ble(i, x, l) || ble(i, I, l); + } + return ble(i, x, l); + }); + } + return h.length === 0 ? { points: h } : nq(e, { points: h }); + } + } + return nq(e, this.geometry); + } +}; +hZ._pool = [], hZ._set = /* @__PURE__ */ new Set(); +const Eq = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, FB = Eo(), Mst = 1e-5; +function fae(t, e, i, r, n) { + return Eq.minX = e, Eq.minY = i, Eq.maxX = r, Eq.maxY = n, t.search(Eq); +} +function bcr(t) { + return { minX: t.bounds[0], minY: t.bounds[1], maxX: t.bounds[2], maxY: t.bounds[3] }; +} +let wcr = class { + constructor(e, i, r, n, s, o, a) { + this._graphics = n, this._onAdd = s, this._onRemove = o, this._hashToCIM = a, this._index = C$(9, bcr), this._itemByGraphic = /* @__PURE__ */ new Map(), this._inflatedSizeHelper = new qit(), this._tileInfoView = e, this._uidFieldName = r; + const l = e.getClosestInfoForScale(i); + l && (this._resolution = this._tileInfoView.getTileResolution(l.level)); + } + setResourceManager(e) { + this._cimResourceManager = e, this._hittestDrawHelper = new ZQi(e); + } + hitTest(e, i, r, n, s) { + e = w5e(e, this._tileInfoView.spatialReference); + const o = 0.5 * n * window.devicePixelRatio * r; + FB[0] = e - o, FB[1] = i - o, FB[2] = e + o, FB[3] = i + o; + const a = 0.5 * n * (r + KP), l = fae(this._index, e - a, i - a, e + a, i + a); + if (!l || l.length === 0) + return []; + const c = [], h = Eo(), p = Eo(); + for (const x of l) { + const { geometry: I, symbolResource: P } = x; + this._getSymbolBounds(h, P, I, p, s), p[3] = p[2] = p[1] = p[0] = 0, bge(h, FB) && x.graphic?.visible && c.push(x); + } + if (c.length === 0) + return []; + const y = this._hittestDrawHelper, v = []; + for (const x of c) { + const { geometry: I, symbolResource: P } = x, { hash: F, textInfo: k } = P, V = this._hashToCIM.get(F); + V && y.hitTest(FB, V.symbol, I, k, s, n) && v.push(x); + } + return v.sort(xcr), v.map((x) => x.graphic); + } + getGraphicsData(e, i, r) { + const n = this._searchForItems(i); + if (n.length === 0 || r.length === 0) + return []; + n.sort((p, y) => p.zorder - y.zorder), n[0].insertAfter = -1; + for (let p = 1; p < n.length; p++) + n[p].insertAfter = n[p - 1].graphic.uid; + n.sort((p, y) => p.graphic.uid - y.graphic.uid), r.sort((p, y) => p.uid - y.uid); + let s, o = 0, a = 0; + const l = i.resolution, c = [], h = { originPosition: "upperLeft", scale: [l, l], translate: [i.bounds[0], i.bounds[3]] }; + for (const p of r) { + for (a = -2; o < n.length; ) + if (s = n[o], o++, p.uid === s.graphic.uid) { + a = s.insertAfter; + break; + } + if (!s?.geometry || a === -2) + continue; + const y = s.getGeometryQuantized(h, i.bounds, this._tileInfoView.spatialReference, l), v = { ...s.graphic.attributes }; + v[this._uidFieldName] = p.uid, s.groupId == null && (s.groupId = e.createTemplateGroup(s.symbol, null)), c.push({ centroid: hZ.getCentroidQuantized(s, h), geometry: y, attributes: v, symbol: s.symbol, groupId: s.groupId, insertAfter: a, zorder: s.zorder }); + } + return c.sort((p, y) => p.zorder - y.zorder), c; + } + queryTileData(e, i) { + if (this._graphics.length === 0) + return []; + const { bounds: r, resolution: n } = i, s = this._searchForItems(i), o = []; + return s.length === 0 || this._createTileGraphics(o, e, s, { originPosition: "upperLeft", scale: [n, n], translate: [r[0], r[3]] }, i), o; + } + has(e) { + return this._itemByGraphic.has(e); + } + getBounds(e) { + const i = this._itemByGraphic.get(e); + return i ? i.bounds : null; + } + getAllBounds() { + return Array.from(this._itemByGraphic.values()).filter((e) => e.graphic.visible).map((e) => e.bounds); + } + addOrModify(e, i, r) { + if (!e || ut(i)) + return; + this.has(e) && this.remove(e), this._onAdd(e); + const n = [0, 0, 0, 0], s = this._getSymbolBounds(null, i, r, n, 0), o = hZ.acquire(e, i, r, _e(s) ? s : null, n); + return this._itemByGraphic.set(e, o), r && this._index.insert(o), o.bounds; + } + remove(e) { + if (!this._itemByGraphic.has(e)) + return; + this._onRemove(e); + const i = this._itemByGraphic.get(e); + i?.bounds && this._index.remove(i), this._itemByGraphic.delete(e); + } + updateZ() { + const e = this._graphics.items; + let i, r; + for (let n = 0; n < e.length; n++) + r = e[n], i = this._itemByGraphic.get(r), i && (i.zorder = n); + } + update(e, i, r) { + const n = this._itemByGraphic.get(e); + n.groupId = null; + const s = v7t(n.bounds); + this._index.remove(n); + const o = this._getSymbolBounds(n.bounds, i, r, n.size, 0); + return _e(o) && n.set(e, i, r, o, n.size), r && this._index.insert(n), { oldBounds: s, newBounds: n.bounds }; + } + updateLevel(e) { + if (this._resolution === e) + return; + this._resolution = e, this._index.clear(); + const i = this._itemByGraphic, r = []; + for (const [n, s] of i) { + const o = this._getSymbolBounds(s.bounds, s.symbolResource, s.geometry, s.size, 0); + s.geometry && _e(o) && (s.bounds = o, r.push(s)); + } + this._index.load(r); + } + clear() { + this._itemByGraphic.clear(), this._index.clear(); + } + _createTileGraphics(e, i, r, n, s) { + const o = this._uidFieldName, a = this._tileInfoView.spatialReference, { bounds: l, resolution: c } = s; + let h, p, y, v; + r.sort((x, I) => x.zorder - I.zorder); + for (let x = 0; x < r.length; x++) { + y = r[x], h = y.graphic, p = y.getGeometryQuantized(n, l, a, c), v = x === 0 ? -1 : r[x - 1].graphic.uid; + const I = { ...y.graphic.attributes }; + I[o] = h.uid, y.groupId == null && (y.groupId = i.createTemplateGroup(y.symbol, null)), e.push({ centroid: hZ.getCentroidQuantized(y, n), geometry: p, attributes: I, symbol: y.symbol, groupId: y.groupId, insertAfter: v, zorder: y.zorder }); + } + } + _searchForItems(e) { + const i = this._tileInfoView.spatialReference, r = e.bounds, n = Ld(i); + if (n && i.isWrappable) { + const [s, o] = n.valid, a = Math.abs(r[2] - o) < Mst, l = Math.abs(r[0] - s) < Mst; + if ((!a || !l) && (a || l)) { + const c = e.resolution; + let h; + h = Eo(a ? [s, r[1], s + c * KP, r[3]] : [o - c * KP, r[1], o, r[3]]); + const p = fae(this._index, r[0], r[1], r[2], r[3]), y = fae(this._index, h[0], h[1], h[2], h[3]); + return [.../* @__PURE__ */ new Set([...p, ...y])]; + } + } + return fae(this._index, r[0], r[1], r[2], r[3]); + } + _getSymbolBounds(e, i, r, n, s) { + if (!i || !i.symbol || !r) + return null; + if (e || (e = Eo()), OI(e, r), !n || n[0] === 0 && n[1] === 0 && n[2] === 0 && n[3] === 0) { + const { hash: l, textInfo: c } = i, h = this._hashToCIM.get(l); + if (!h) + return null; + n || (n = [0, 0, 0, 0]); + const p = this._inflatedSizeHelper.getSymbolInflateSize(n, h.symbol, this._cimResourceManager, s, c); + n[0] = dn(p[0]), n[1] = dn(p[1]), n[2] = dn(p[2]), n[3] = dn(p[3]); + } + const o = this._resolution, a = qit.safeSize(n); + return e[0] -= a * o, e[1] -= a * o, e[2] += a * o, e[3] += a * o, e; + } +}; +const xcr = (t, e) => { + const i = Est(t.graphic), r = Est(e.graphic); + return i === r ? e.zorder - t.zorder : i - r; +}, Scr = (t) => { + let e = class extends Vb(t) { + constructor() { + super(...arguments), this.graphics = null, this.renderer = null; + } + }; + return E([N()], e.prototype, "graphics", void 0), E([N()], e.prototype, "renderer", void 0), E([N()], e.prototype, "updating", void 0), E([N()], e.prototype, "view", void 0), e = E([dt("esri.views.layers.GraphicsView")], e), e; +}, Ccr = Vi("esri-2d-graphic-debug"); +function E2e(t, e, i) { + let r = i.get(t); + return r || (r = { tile: e, addedOrModified: [], removed: [] }, i.set(t, r)), r; +} +let zT = class extends Scr(ap(vn)) { + constructor(e) { + super(e), this._storage = new nPt(), this._displayIds = /* @__PURE__ */ new Map(), this._controller = new AbortController(), this._tiles = /* @__PURE__ */ new Map(), this._graphicStoreUpdate = !1, this._graphicsSet = /* @__PURE__ */ new Set(), this._matcher = Promise.resolve(null), this._tileUpdateSet = /* @__PURE__ */ new Set(), this._tilesToUpdate = /* @__PURE__ */ new Map(), this._graphicIdToAbortController = /* @__PURE__ */ new Map(), this._attached = !1, this._updatingGraphicsTimer = null, this._hashToExpandedSymbol = /* @__PURE__ */ new Map(), this._hashToExpandedSymbolPromise = /* @__PURE__ */ new Map(), this._hashToCIMSymbolPromise = /* @__PURE__ */ new Map(), this._hashToCIM = /* @__PURE__ */ new Map(), this._processing = !1, this._needsProcessing = !1, this._pendingUpdate = { added: /* @__PURE__ */ new Set(), updated: /* @__PURE__ */ new Set(), removed: /* @__PURE__ */ new Set() }, this.lastUpdateId = -1, this.updateRequested = !1, this.defaultPointSymbolEnabled = !0, this.graphicUpdateHandler = this.graphicUpdateHandler.bind(this); + } + destroy() { + this._updatingGraphicsTimer && (clearTimeout(this._updatingGraphicsTimer), this._updatingGraphicsTimer = null, this.notifyChange("updating")), this._controller.abort(), this.container.destroy(), this._set("graphics", null), this._graphicStore.clear(), this._attributeStore = null, this._hashToExpandedSymbol.clear(), this.view = null, this.renderer = null, this._hashToCIM.clear(), this._hashToCIMSymbolPromise.clear(), this._hashToExpandedSymbolPromise.clear(); + } + _createMatcher(e, i, r) { + if (e) { + const n = bte(e), s = lme({ indexCount: 0, fields: {} }, "feature", e, n); + this._matcher = ame(s, i, null, r); + } + } + _createDisplayId(e) { + let i = this._displayIds.get(e); + return i || (i = this._storage.createDisplayId(), this._displayIds.set(e, i)), i; + } + initialize() { + this._attributeStore = new tPt({ type: "local", initialize: (s) => Promise.resolve(this.container.attributeView.initialize(s)), update: (s) => this.container.attributeView.requestUpdate(s), render: () => this.container.requestRender() }, hI("2d"), () => this.notifyChange("updating")), this.container.hasHighlight = () => this._attributeStore.hasHighlight; + const e = (s) => { + this._createDisplayId(s.uid), this._setFilterState(s.uid, s.visible); + }, i = (s) => { + const o = this._displayIds.get(s.uid); + this._displayIds.delete(s.uid), this._storage.releaseDisplayId(o); + }, r = new UDt(this.container.getMaterialItems.bind(this.container), this.view.featuresTilingScheme.tileInfo); + this._graphicStore = new wcr(this.view.featuresTilingScheme, this.view.state.scale, this.uid, this.graphics, e, i, this._hashToCIM), this._meshFactory = new zDt(null, this.uid, r), this._templateStore = r, this.handles.add([Qi(() => this.renderer, (s) => { + this._createMatcher(s, r, this.container.stage.resourceManager); + for (const o of this.graphics) + this._pendingUpdate.updated.add(o); + this.requestUpdate(); + }), this.view.graphicsTileStore.on("update", this._onTileUpdate.bind(this)), this.container.on("attach", () => { + Ccr && this.container.enableRenderingBounds(() => this._graphicStore.getAllBounds()), this.graphics.items.length > 0 && this._graphicsChangeHandler({ target: this.graphics, added: this.graphics.items, removed: [], moved: [] }), this.handles.add(this.graphics.on("change", (o) => this._graphicsChangeHandler(o)), "graphics"); + const s = this.container.stage.resourceManager; + this._createMatcher(this.renderer, r, s), this._graphicStore.setResourceManager(s), this._attached = !0, this.notifyChange("updating"); + })]); + const n = this.view.graphicsTileStore.tiles; + this._onTileUpdate({ added: n, removed: [] }); + } + get updating() { + return !this._attached || this._updatingGraphicsTimer !== null || this._tileUpdateSet.size > 0 || this._tilesToUpdate.size > 0 || this._attributeStore.isUpdating(); + } + hitTest(e) { + if (!this.view || !this.view.position) + return []; + const { resolution: i, rotation: r } = this.view.state; + return this._graphicStore.hitTest(e.x, e.y, 2, i, r); + } + update(e) { + hn(this._controller.signal); + const i = e.state, { resolution: r } = i; + if (this._graphicStore.updateLevel(r), this._graphicStoreUpdate = !0, this.updateRequested = !1, this._pendingUpdate.updated.size > 0) { + if (!this._processing) + return void this._updateGraphics(); + this._needsProcessing = !0; + } + } + viewChange() { + this.requestUpdate(); + } + requestUpdate() { + this.updateRequested || (this.updateRequested = !0, this.requestUpdateCallback()); + } + processUpdate(e) { + this.updateRequested && (this.updateRequested = !1, this.update(e)); + } + graphicUpdateHandler(e) { + const { graphic: i, property: r } = e; + switch (r) { + case "attributes": + case "geometry": + case "symbol": + this._pendingUpdate.updated.add(i), this.requestUpdate(); + break; + case "visible": + this._setFilterState(i.uid, i.visible), this._attributeStore.sendUpdates(); + } + } + setHighlight(e) { + const i = e.map((r) => this._displayIds.get(r)).filter(_e); + this._attributeStore.setHighlight(e, i); + } + _getIntersectingTiles(e) { + const i = this._graphicStore.getBounds(e); + if (!i || fdt(i) === 0 || mdt(i) === 0) + return []; + const r = Uur(i, this.view.spatialReference); + return _e(r) ? [.../* @__PURE__ */ new Set([...this.view.graphicsTileStore.boundsIntersections(r[0]), ...this.view.graphicsTileStore.boundsIntersections(r[1])])] : this.view.graphicsTileStore.boundsIntersections(i); + } + async _updateTile(e) { + hn(this._controller.signal); + const i = e.tile, r = this._getGraphicsData(this._templateStore, i, e.addedOrModified), n = await this._processGraphics(i, r); + return hn(this._controller.signal), this._patchTile(i.key, { type: "update", addOrUpdate: n, remove: e.removed, end: !0, clear: !1, sort: !1 }), n; + } + _patchTile(e, i) { + const r = this._tiles.get(e); + r && (this.container.onTileData(r, i), this.container.requestRender()); + } + _graphicsChangeHandler(e) { + const i = this._pendingUpdate; + for (const r of e.added) + i.added.add(r); + for (const r of e.moved) + i.updated.add(r); + for (const r of e.removed) + this._pendingUpdate.added.has(r) ? i.added.delete(r) : i.removed.add(r); + this._processing ? this._needsProcessing = !0 : this._updateGraphics(); + } + _getGraphicsToUpdate() { + const e = { added: [], removed: [], updated: [] }; + if (!this.graphics) + return e; + const i = this._pendingUpdate; + for (const r of this.graphics.items) + i.added.has(r) ? e.added.push(r) : i.updated.has(r) && e.updated.push(r); + for (const r of i.removed) + this._graphicStore.has(r) && e.removed.push(r); + return i.added.clear(), i.removed.clear(), i.updated.clear(), e; + } + async _updateGraphics() { + this._processing = !0; + const { added: e, removed: i, updated: r } = this._getGraphicsToUpdate(), n = this._tilesToUpdate; + let s; + try { + if (!this._graphicStoreUpdate) { + const p = this.view.state, { resolution: y } = p; + this._graphicStore.updateLevel(y); + } + const o = [], a = new Array(e.length + i.length); + for (let p = 0; p < r.length; p++) { + const y = r[p], v = this._getIntersectingTiles(y); + for (const x of v) + s = x.id, E2e(s, x, n).removed.push(this._displayIds.get(y.uid)); + o.push(this._updateGraphic(y, null)), a[p] = y; + } + const l = r.length; + for (let p = 0; p < e.length; p++) { + const y = e[p]; + a[l + p] = y, this._graphicsSet.add(y), o.push(this._addGraphic(y)); + } + for (const p of i) { + this._abortProcessingGraphic(p.uid); + const y = this._getIntersectingTiles(p); + for (const v of y) + s = v.id, E2e(s, v, n).removed.push(this._displayIds.get(p.uid)); + this._graphicsSet.delete(p), this._graphicStore.remove(p); + } + let c; + this._flipUpdatingGraphics(), await Promise.all(o); + for (let p = 0; p < a.length; p++) { + c = a[p]; + const y = this._getIntersectingTiles(c); + for (const v of y) + s = v.id, E2e(s, v, n).addedOrModified.push(c); + } + this._graphicStore.updateZ(); + const h = []; + for (const [p, y] of n) + h.push(this._updateTile(y)); + await Promise.all(h); + } catch (o) { + us(o); + } + for (const o of i) + try { + const a = await this._getSymbolForGraphic(o, null); + if (a) { + const l = a.hash(); + this._hashToExpandedSymbol.delete(l); + } + } catch (a) { + us(a); + } + n.clear(), this.notifyChange("updating"), this._processing = !1, this._needsProcessing && (this._needsProcessing = !1, this._updateGraphics()); + } + _getArcadeInfo(e) { + const i = (e.attributes ? Object.keys(e.attributes) : []).map((r) => ({ name: r, alias: r, type: typeof e.attributes[r] == "string" ? "esriFieldTypeString" : "esriFieldTypeDouble" })); + return ut(e.geometry) ? null : { geometryType: Fd(e.geometry), spatialReference: or.fromJSON(e.geometry.spatialReference), fields: i }; + } + _getSymbolForGraphic(e, i) { + return hn(this._controller.signal), _e(e.symbol) ? Promise.resolve(e.symbol) : _e(this.renderer) ? this.renderer.getSymbolAsync(e, { scale: this.view.scale, signal: _e(i) ? i.signal : null }) : Promise.resolve(this._getNullSymbol(e)); + } + _getCIMSymbol(e, i, r) { + let n = this._hashToCIM.get(i); + if (n) + return Promise.resolve(n); + const s = ler(e); + if (_e(s)) { + if (s.type === "CIMSymbolReference") + return n = s, this._hashToCIM.set(i, n), Promise.resolve(n); + let o = this._hashToCIMSymbolPromise.get(i); + return o || (o = s.fetchCIMSymbol(r).then((a) => (this._hashToCIM.set(i, a.data), this._hashToCIMSymbolPromise.delete(i), a)).catch((a) => (this._hashToCIMSymbolPromise.delete(i), ja(a), null)), this._hashToCIMSymbolPromise.set(i, o), o); + } + return Promise.resolve(null); + } + _expandCIMSymbol(e, i, r, n) { + const s = this._hashToExpandedSymbol.get(r); + if (s) + return Promise.resolve(s); + let o = this._hashToExpandedSymbolPromise.get(r); + if (o) + return o; + const a = this.container.stage, l = this._getArcadeInfo(i), c = bte(null), h = a1(e, c); + return o = LS(h, l, a.resourceManager, n), this._hashToExpandedSymbolPromise.set(r, o), o.then((p) => (this._hashToExpandedSymbol.set(r, p), this._hashToExpandedSymbolPromise.delete(r), p)), o; + } + async _getSymbolResources(e, i) { + return hn(this._controller.signal), this.container.stage ? this._getSymbolForGraphic(e, i).then((r) => { + if (!r) + return null; + const n = r.hash(); + return this._getCIMSymbol(r, n, i).then((s) => ut(s) ? null : this._expandCIMSymbol(s, e, n, i).then((o) => { + const a = o.layers.filter((l) => l.type === "text" && typeof l.text == "string"); + if (a && a.length > 0) { + const l = new Array(a.length); + for (let h = 0; h < a.length; h++) { + const p = a[h], y = [], [v] = c4(p.text); + p.text = v; + for (let x = 0; x < v.length; x++) + y.push(v.charCodeAt(x)); + l[h] = { symbol: p, id: h, glyphIds: y }; + } + const c = /* @__PURE__ */ new Map(); + return this.container.getMaterialItems(l).then((h) => { + Fg(h); + for (let p = 0; p < a.length; p++) { + const y = a[p]; + c.set(y.cim, { text: y.text, mosaicItem: h[p].mosaicItem }); + } + return { symbol: o, textInfo: c, hash: n }; + }); + } + return { symbol: o, hash: n }; + })); + }).catch((r) => (ja(r), null)) : null; + } + async _projectAndNormalizeGeometry(e, i) { + if (hn(this._controller.signal), ut(e.geometry) || e.geometry.type === "mesh") + return null; + let r = e.geometry; + if (za(r)) { + const o = r.rings; + r.rings = o; + } else if (ju(r)) { + const o = r.paths; + r.paths = o; + } else if (gc(r)) { + const o = await this._getSymbolForGraphic(e, i); + hn(this._controller.signal), o && (Hur(o.type) || zur(o.type)) ? r = r.center : r = Wur(r); + } + await Py(r.spatialReference, this.view.spatialReference); + const n = Zar(r), s = Cp(n, r.spatialReference, this.view.spatialReference); + return s && jjt(s), s; + } + _onTileUpdate(e) { + const i = Ld(this.view.spatialReference); + if (e.added && e.added.length > 0) + for (const r of e.added) + this._addNewTile(r, i); + if (e.removed && e.removed.length > 0) + for (const r of e.removed) + this._removeTile(r.key); + } + async _addGraphic(e) { + this._abortProcessingGraphic(e.uid), hn(this._controller.signal); + const i = new AbortController(); + this._graphicIdToAbortController.set(e.uid, i); + const r = { signal: i.signal }; + try { + await this._addOrUpdateGraphic(e, r), hn(this._controller.signal), this._graphicIdToAbortController.delete(e.uid); + } catch (n) { + if (this._graphicIdToAbortController.delete(e.uid), !us(n)) + throw n; + } + } + _updateGraphic(e, i) { + hn(this._controller.signal); + const r = this._projectAndNormalizeGeometry(e, i), n = this._getSymbolResources(e, i); + return Promise.all([r, n]).then(([s, o]) => { + hn(this._controller.signal), this._graphicStore.addOrModify(e, o, s); + }); + } + _addOrUpdateGraphic(e, i) { + hn(this._controller.signal); + const r = this._projectAndNormalizeGeometry(e, i), n = this._getSymbolResources(e, i); + return Promise.all([r, n]).then(([s, o]) => { + hn(this._controller.signal), this._graphicsSet.has(e) && this._graphicStore.addOrModify(e, o, s); + }); + } + _addTile(e) { + const i = this.view.featuresTilingScheme.getTileBounds(Eo(), e), r = this.view.featuresTilingScheme.getTileResolution(e.level), n = new alr(e, r, i[0], i[3]); + return this._tiles.set(e, n), this.container.addChild(n), n; + } + async _addNewTile(e, i) { + const r = this._addTile(e.key), n = this._graphicStore.queryTileData(this._templateStore, e); + if (n.length === 0) + return; + if (i) { + const o = Math.round((i.valid[1] - i.valid[0]) / e.resolution); + for (const a of n) + a.geometry && (B0(a.geometry) || Lg(a.geometry)) && this._wrapPoints(a, o); + } + const s = e.key; + this._tileUpdateSet.add(e.key), this.notifyChange("updating"); + try { + const o = { type: "update", clear: !1, addOrUpdate: await this._processGraphics(e, n), remove: [], end: !0, sort: !1 }; + r.patch(o), this._tileUpdateSet.delete(s), this.notifyChange("updating"); + } catch (o) { + if (this._tileUpdateSet.delete(s), this.notifyChange("updating"), !us(o)) + throw o; + } + } + _removeTile(e) { + if (!this._tiles.has(e)) + return; + const i = this._tiles.get(e); + this.container.removeChild(i), i.destroy(), this._tiles.delete(e); + } + _setFilterState(e, i) { + const r = this._displayIds.get(e), n = this._attributeStore.getHighlightFlag(e); + this._attributeStore.setData(r, 0, 0, n | (i ? GAt : 0)); + } + _getGraphicsData(e, i, r) { + const n = this.view, s = Ld(n.spatialReference), o = this._graphicStore.getGraphicsData(e, i, r); + if (s) { + const a = Math.round((s.valid[1] - s.valid[0]) / i.resolution); + for (const l of o) + l.geometry && (B0(l.geometry) || Lg(l.geometry)) && this._wrapPoints(l, a); + } + return o; + } + _wrapPoints(e, i) { + const r = e.geometry; + Lg(r) ? this._wrapMultipoint(r, i) : this._wrapPoint(e, i); + } + _wrapMultipoint(e, i) { + const r = e.points, n = []; + let s = 0, o = 0; + for (const [a, l] of r) { + if (n.push([a + s, l]), s = 0, i === MB) { + const c = 5 * KP; + a + o < c ? (n.push([i, 0]), s = -i) : a + o > MB - c && (n.push([-i, 0]), s = i); + } else + a + o < -KP ? (n.push([i, 0]), s = -i) : a + o > MB + KP && (n.push([-i, 0]), s = i); + o += a; + } + e.points = n; + } + _wrapPoint(e, i) { + const r = e.geometry; + if (i === MB) { + const n = 5 * KP; + r.x < n ? e.geometry = { points: [[r.x, r.y], [i, 0]] } : r.x > MB - n && (e.geometry = { points: [[r.x, r.y], [-i, 0]] }); + } else + r.x < -KP ? e.geometry = { points: [[r.x, r.y], [i, 0]] } : r.x > MB + KP && (e.geometry = { points: [[r.x, r.y], [-i, 0]] }); + } + _processGraphics(e, i, r) { + if (!(i && i.length) || !this._meshFactory) + return Promise.resolve(null); + const n = _cr.from(i, this.uid, e.transform), s = this._meshFactory; + return this._matcher.then((o) => s.analyzeGraphics(n, this.container.stage.resourceManager, o, null, null, r).then(() => (this._attributeStore.sendUpdates(), this._processAnalyzedGraphics(e, n)))); + } + _processAnalyzedGraphics(e, i) { + const r = this._meshFactory, n = i.getSize(), s = i.getCursor(), o = { features: n, records: n, metrics: 0 }, a = new CDt(e.key.id, o, Zo.DEFAULT, !1, !1), l = []; + for (; s.next(); ) { + const y = s.readGraphic(); + y.insertAfter = y.insertAfter === -1 ? -1 : this._displayIds.get(y.insertAfter), y.displayId = this._displayIds.get(y.attributes[this.uid]); + const v = new xDt(y.displayId); + v.insertAfter = y.insertAfter, l.push(v), r.writeGraphic(a, s, e.level, this.container.stage.resourceManager); + } + const c = e.tileInfoView.tileInfo.isWrappable, h = a.serialize(c); + if (h.length !== 1) + return new tst(); + const p = h[0].message; + return tst.fromVertexData(p, l); + } + _abortProcessingGraphic(e) { + this._graphicIdToAbortController.get(e)?.abort(); + } + _getNullSymbol(e) { + const i = e.geometry; + return ju(i) ? OXt : za(i) || gc(i) ? RXt : this.defaultPointSymbolEnabled ? PXt : null; + } + _flipUpdatingGraphics() { + this._updatingGraphicsTimer && clearTimeout(this._updatingGraphicsTimer), this._updatingGraphicsTimer = setTimeout(() => { + this._updatingGraphicsTimer = null, this.notifyChange("updating"); + }, 160), this.notifyChange("updating"); + } +}; +E([N({ constructOnly: !0 })], zT.prototype, "requestUpdateCallback", void 0), E([N()], zT.prototype, "container", void 0), E([N({ constructOnly: !0 })], zT.prototype, "graphics", void 0), E([N()], zT.prototype, "updating", null), E([N()], zT.prototype, "view", void 0), E([N()], zT.prototype, "updateRequested", void 0), E([N()], zT.prototype, "defaultPointSymbolEnabled", void 0), zT = E([dt("esri.views.2d.layers.support.GraphicsView2D")], zT); +const _x = zT, H9e = Ei.getLogger("esri.views.2d.engine.webgl.AttributeStoreView"), I2e = ZAt(QAt, H9e); +let Dst = class { + constructor(e, i, r) { + this._texture = null, this._lastTexture = null, this._fbos = {}, this.texelSize = 4; + const { buffer: n, pixelType: s, textureOnly: o } = e, a = mX(s); + this.shared = r, this.pixelType = s, this.size = i, this.textureOnly = o, o || (this.data = new a(n)), this._resetRange(); + } + destroy() { + Sa(this._texture, (e) => e.dispose()); + for (const e in this._fbos) + Sa(this._fbos[e], (i) => { + e === "0" && i.detachColorTexture(), i.dispose(); + }), this._fbos[e] = null; + this._texture = null; + } + get _textureDesc() { + return { target: io.TEXTURE_2D, wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: this.pixelType, samplingMode: _n.NEAREST, width: this.size, height: this.size }; + } + setData(e, i, r) { + const n = pO(e), s = this.data, o = n * this.texelSize + i; + !s || o >= s.length || (s[o] = r, this.dirtyStart = Math.min(this.dirtyStart, n), this.dirtyEnd = Math.max(this.dirtyEnd, n)); + } + getData(e, i) { + if (ut(this.data)) + return null; + const r = pO(e) * this.texelSize + i; + return !this.data || r >= this.data.length ? null : this.data[r]; + } + getTexture(e) { + return Gu(this._texture, () => this._initTexture(e)); + } + getFBO(e, i = 0) { + if (ut(this._fbos[i])) { + const r = { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE }, n = i === 0 ? this.getTexture(e) : this._textureDesc; + this._fbos[i] = new cd(e, r, n); + } + return this._fbos[i]; + } + get locked() { + return !(this.pixelType !== rs.UNSIGNED_BYTE || !this.shared || this.textureOnly || !Vi("esri-atomics") || !this.data) && Atomics.load(this.data, 0) === 1; + } + get hasDirty() { + const e = this.dirtyStart; + return this.dirtyEnd >= e; + } + updateTexture(e, i) { + if (!this.locked) { + try { + const r = this.dirtyStart, n = this.dirtyEnd; + if (!this.hasDirty) + return; + this._resetRange(); + const s = this.data.buffer, o = this.getTexture(e), a = 4, l = (r - r % this.size) / this.size, c = (n - n % this.size) / this.size, h = l, p = this.size, y = c, v = l * this.size * a, x = (p + y * this.size) * a - v, I = mX(this.pixelType), P = new I(s, v * I.BYTES_PER_ELEMENT, x), F = this.size, k = y - h + 1; + if (k > this.size) + return void H9e.error(new ot("mapview-webgl", "Out-of-bounds index when updating AttributeData")); + o.updateData(0, 0, h, F, k, P); + } catch { + } + i(); + } + } + update(e) { + const { data: i, start: r, end: n } = e; + if (_e(i) && _e(this.data)) { + const s = this.data, o = r * this.texelSize; + for (let a = 0; a < i.length; a++) { + const l = 1 << a % this.texelSize; + e.layout & l && (s[o + a] = i[a]); + } + } + this.dirtyStart = Math.min(this.dirtyStart, r), this.dirtyEnd = Math.max(this.dirtyEnd, n); + } + resize(e, i) { + const r = this.size; + if (this.size = i, this.textureOnly) + return void (r !== this.size && (this._lastTexture = this._texture, this._texture = null)); + const n = mX(this.pixelType); + this.destroy(), this.data = new n(e.buffer); + } + _resetRange() { + this.dirtyStart = 2147483647, this.dirtyEnd = 0; + } + _initTexture(e) { + const i = new Ts(e, this._textureDesc, Gu(this.data, void 0)); + if (_e(this._lastTexture) && this._fbos[0]) { + const r = this._lastTexture.descriptor.width, n = this._lastTexture.descriptor.height, s = this._lastTexture.descriptor.dataType, o = this._lastTexture.descriptor.pixelFormat, a = this.getFBO(e), l = O9i(s), c = new (mX(s))(new ArrayBuffer(r * n * l * this.texelSize)), h = e.getBoundFramebufferObject(), { x: p, y, width: v, height: x } = e.getViewport(); + e.bindFramebuffer(a), a.readPixels(0, 0, r, n, o, s, c), i.updateData(0, 0, 0, 2 * r, n / 2, c), e.setViewport(p, y, v, x), e.bindFramebuffer(h); + } + return this.destroy(), this._texture = i, this._texture; + } +}, Tcr = class { + constructor(e) { + this._onUpdate = e, this._initialized = !1, this._forceNextUpload = !1, this._locked = !1; + } + initialize(e) { + const { blocks: i, shared: r, size: n } = e; + if (this.shared = r, this.size = n, I2e("Initializing AttributeStoreView", e), ut(this._data)) + this._data = tCe(i, (s) => new Dst(s, n, r)); + else + for (let s = 0; s < this._data.length; s++) { + const o = this._data[s], a = i[s]; + _e(a) && (ut(o) ? this._data[s] = new Dst(a, n, r) : o.resize(a, n)); + } + this._initialized = !0; + } + destroy() { + Sa(this._data, (e) => tCe(e, (i) => i.destroy())), Sa(this._defaultTexture, (e) => e.dispose()); + } + isEmpty() { + const e = this._data; + return ut(e); + } + isUpdating() { + const e = _e(this._pendingAttributeUpdate), i = e; + return Vi("esri-2d-log-updating") && console.log(`Updating AttributeStoreView ${i} + -> hasPendingUpdate ${e}`), i; + } + getBlock(e) { + return ut(this._data) ? null : this._data[e]; + } + setLabelMinZoom(e, i) { + this.setData(e, 0, 1, i); + } + getLabelMinZoom(e) { + return this.getData(e, 0, 1, 255); + } + getFilterFlags(e) { + return this.getData(e, 0, 0, 0); + } + getVVSize(e) { + return this.getData(e, uRe, 0, 0); + } + getData(e, i, r, n) { + if (!this._data) + return 0; + const s = this._data[i]; + if (ut(s)) + return 0; + const o = s.getData(e, r); + return _e(o) ? o : n; + } + setData(e, i, r, n) { + const s = this._data[i]; + s.setData(e, r, n); + } + lockTextureUpload() { + this._locked = !0; + } + unlockTextureUpload() { + this._locked = !1; + } + forceTextureUpload() { + this._forceNextUpload = !0; + } + async requestUpdate(e) { + if (this._pendingAttributeUpdate) + return void H9e.error(new ot("mapview-webgl", "Tried to update attribute data with a pending update")); + const i = mm(); + return I2e("AttributeStoreView Update Requested", e), this._pendingAttributeUpdate = { data: e, resolver: i }, this._onUpdate(), i.promise; + } + update() { + if (this._initialized && _e(this._pendingAttributeUpdate)) { + Vi("esri-2d-update-debug") && console.debug("AttributeStoreView::update"); + const { data: e, resolver: i } = this._pendingAttributeUpdate, r = this._data; + for (let n = 0; n < e.blocks.length; n++) { + const s = e.blocks[n], o = r[n]; + Sa(o, (a) => Sa(s, (l) => { + I2e(`Updating block ${n}`, l), a.update(l); + })); + } + this._pendingAttributeUpdate = null, i(), this._onUpdate(); + } + } + bindTextures(e, i = !0) { + const r = this._getDefaultTexture(e); + if (!this._initialized) + return e.bindTexture(r, ufe), void (i && (e.bindTexture(r, cfe), e.bindTexture(r, aRe), e.bindTexture(r, lRe), e.bindTexture(r, ice), e.bindTexture(r, rce), e.bindTexture(r, ZJe))); + const n = this._data; + this._locked && !this._forceNextUpload || (Xlt(n, (s) => s.updateTexture(e, () => this._onUpdate())), this._forceNextUpload = !1), e.bindTexture($_(n[V8i], r, (s) => s.getTexture(e)), ufe), i && (e.bindTexture($_(n[hfe], r, (s) => s.getTexture(e)), ZJe), e.bindTexture($_(n[A8e], r, (s) => s.getTexture(e)), cfe), e.bindTexture($_(n[uRe], r, (s) => s.getTexture(e)), aRe), e.bindTexture($_(n[j8i], r, (s) => s.getTexture(e)), lRe), e.bindTexture($_(n[ice], r, (s) => s.getTexture(e)), ice), e.bindTexture($_(n[rce], r, (s) => s.getTexture(e)), rce)); + } + _getDefaultTexture(e) { + if (ut(this._defaultTexture)) { + const i = { wrapMode: ds.CLAMP_TO_EDGE, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, width: 1, height: 1 }; + this._defaultTexture = new Ts(e, i, new Uint8Array(4)); + } + return this._defaultTexture; + } +}; +const Ecr = (t) => { + switch (t.BYTES_PER_ELEMENT) { + case 1: + return Fi.UNSIGNED_BYTE; + case 2: + return Fi.UNSIGNED_SHORT; + case 4: + return Fi.UNSIGNED_INT; + default: + throw new ot("Cannot get DataType of array"); + } +}, Icr = (t, e, i, r) => { + let n = 0; + for (let s = 1; s < i; s++) { + const o = t[2 * (e + s - 1)], a = t[2 * (e + s - 1) + 1]; + n += (t[2 * (e + s)] - o) * (t[2 * (e + s) + 1] + a); + } + return r ? n > 0 : n < 0; +}, Fst = ({ coords: t, lengths: e }, i) => { + const r = []; + for (let n = 0, s = 0; n < e.length; s += e[n], n += 1) { + const o = s, a = []; + for (; n < e.length - 1 && Icr(t, s + e[n], e[n + 1], i); n += 1, s += e[n]) + a.push(s + e[n] - o); + const l = t.slice(2 * o, 2 * (s + e[n])), c = ZU(l, a, 2); + for (const h of c) + r.push(h + o); + } + return r; +}; +let mae = class gP { + constructor(e, i, r, n = !1) { + this._cache = {}, this.vertices = e, this.indices = i, this.primitiveType = r, this.isMapSpace = n; + } + static fromRect({ x: e, y: i, width: r, height: n }) { + const s = e, o = i, a = s + r, l = o + n; + return gP.fromScreenExtent({ xmin: s, ymin: o, xmax: a, ymax: l }); + } + static fromPath(e) { + const i = u0t(new Rl(), e.path, !1, !1), r = i.coords, n = new Uint32Array(Fst(i, !0)), s = new Uint32Array(r.length / 2); + for (let o = 0; o < s.length; o++) + s[o] = Vn(Math.floor(r[2 * o]), Math.floor(r[2 * o + 1])); + return new gP({ geometry: s }, n, ps.TRIANGLES); + } + static fromGeometry(e, i) { + const r = i.geometry?.type; + switch (r) { + case "polygon": + return gP.fromPolygon(e, i.geometry); + case "extent": + return gP.fromMapExtent(e, i.geometry); + default: + return Ei.getLogger("esri.views.2d.engine.webgl.Mesh2D").error(new ot("mapview-bad-type", `Unable to create a mesh from type ${r}`, i)), gP.fromRect({ x: 0, y: 0, width: 1, height: 1 }); + } + } + static fromPolygon(e, i) { + const r = VF(new Rl(), i, !1, !1), n = r.coords, s = new Uint32Array(Fst(r, !1)), o = new Uint32Array(n.length / 2), a = rl(), l = rl(); + for (let c = 0; c < o.length; c++) + aa(a, n[2 * c], n[2 * c + 1]), e.toScreen(l, a), o[c] = Vn(Math.floor(l[0]), Math.floor(l[1])); + return new gP({ geometry: o }, s, ps.TRIANGLES, !0); + } + static fromScreenExtent({ xmin: e, xmax: i, ymin: r, ymax: n }) { + const s = { geometry: new Uint32Array([Vn(e, r), Vn(i, r), Vn(e, n), Vn(e, n), Vn(i, r), Vn(i, n)]) }, o = new Uint32Array([0, 1, 2, 3, 4, 5]); + return new gP(s, o, ps.TRIANGLES); + } + static fromMapExtent(e, i) { + const [r, n] = e.toScreen([0, 0], [i.xmin, i.ymin]), [s, o] = e.toScreen([0, 0], [i.xmax, i.ymax]), a = { geometry: new Uint32Array([Vn(r, n), Vn(s, n), Vn(r, o), Vn(r, o), Vn(s, n), Vn(s, o)]) }, l = new Uint32Array([0, 1, 2, 3, 4, 5]); + return new gP(a, l, ps.TRIANGLES); + } + destroy() { + _e(this._cache.indexBuffer) && this._cache.indexBuffer.dispose(); + for (const e in this._cache.vertexBuffers) + _e(this._cache.vertexBuffers[e]) && this._cache.vertexBuffers[e].dispose(); + } + get elementType() { + return Ecr(this.indices); + } + getIndexBuffer(e, i = Vo.STATIC_DRAW) { + return this._cache.indexBuffer || (this._cache.indexBuffer = Qo.createIndex(e, i, this.indices)), this._cache.indexBuffer; + } + getVertexBuffers(e, i = Vo.STATIC_DRAW) { + return this._cache.vertexBuffers || (this._cache.vertexBuffers = Object.keys(this.vertices).reduce((r, n) => ({ ...r, [n]: Qo.createVertex(e, i, this.vertices[n]) }), {})), this._cache.vertexBuffers; + } +}; +const gae = (t) => parseFloat(t) / 100; +let Acr = class tFt extends pC { + constructor(e, i) { + super(), this._clip = i, this._cache = {}, this.stage = e, this._handle = Qi(() => i.version, () => this._invalidate()), this.ready(); + } + static fromClipArea(e, i) { + return new tFt(e, i); + } + _destroyGL() { + _e(this._cache.mesh) && (this._cache.mesh.destroy(), this._cache.mesh = null), _e(this._cache.vao) && (this._cache.vao.dispose(), this._cache.vao = null); + } + destroy() { + this._destroyGL(), this._handle.remove(); + } + getVAO(e, i, r, n) { + const [s, o] = i.size; + if (this._clip.type !== "geometry" && this._lastWidth === s && this._lastHeight === o || (this._lastWidth = s, this._lastHeight = o, this._destroyGL()), ut(this._cache.vao)) { + const a = this._createMesh(i, this._clip), l = a.getIndexBuffer(e), c = a.getVertexBuffers(e); + this._cache.mesh = a, this._cache.vao = new Ac(e, r, n, c, l); + } + return this._cache.vao; + } + _createTransforms() { + return { dvs: Ml() }; + } + _invalidate() { + this._destroyGL(), this.requestRender(); + } + _createScreenRect(e, i) { + const [r, n] = e.size, s = typeof i.left == "string" ? gae(i.left) * r : i.left, o = typeof i.right == "string" ? gae(i.right) * r : i.right, a = typeof i.top == "string" ? gae(i.top) * n : i.top, l = typeof i.bottom == "string" ? gae(i.bottom) * n : i.bottom, c = s, h = a; + return { x: c, y: h, width: Math.max(r - o - c, 0), height: Math.max(n - l - h, 0) }; + } + _createMesh(e, i) { + switch (i.type) { + case "rect": + return mae.fromRect(this._createScreenRect(e, i)); + case "path": + return mae.fromPath(i); + case "geometry": + return mae.fromGeometry(e, i); + default: + return Ei.getLogger("esri.views.2d.engine.webgl.ClippingInfo").error(new ot("mapview-bad-type", "Unable to create ClippingInfo mesh from clip of type: ${clip.type}")), mae.fromRect({ x: 0, y: 0, width: 1, height: 1 }); + } + } +}, hH = class extends rz { + constructor() { + super(...arguments), this.name = this.constructor.name; + } + set clips(e) { + this._clips = e, this.children.forEach((i) => i.clips = e), this._updateClippingInfo(); + } + beforeRender(e) { + super.beforeRender(e), this.updateTransforms(e.state); + } + _createTransforms() { + return { dvs: Ml() }; + } + doRender(e) { + const i = this.createRenderParams(e), { painter: r, globalOpacity: n, profiler: s, drawPhase: o } = i, a = o === lo.LABEL || o === lo.HIGHLIGHT ? 1 : n * this.computedOpacity; + s.recordContainerStart(this.name), r.beforeRenderLayer(i, this._clippingInfos ? 255 : 0, a), this.renderChildren(i), r.compositeLayer(i, a), s.recordContainerEnd(); + } + renderChildren(e) { + ut(this._renderPasses) && (this._renderPasses = this.prepareRenderPasses(e.painter)); + for (const i of this._renderPasses) + try { + i.render(e); + } catch { + } + } + createRenderParams(e) { + return e.requireFBO = this.requiresDedicatedFBO, e; + } + prepareRenderPasses(e) { + return [e.registerRenderPass({ name: "clip", brushes: [fh.clip], target: () => this._clippingInfos, drawPhase: lo.MAP | lo.LABEL | lo.LABEL_ALPHA | lo.DEBUG | lo.HIGHLIGHT })]; + } + updateTransforms(e) { + for (const i of this.children) + i.setTransform(e); + } + onAttach() { + super.onAttach(), this._updateClippingInfo(); + } + onDetach() { + super.onDetach(), this._updateClippingInfo(); + } + _updateClippingInfo() { + _e(this._clippingInfos) && (this._clippingInfos.forEach((r) => r.destroy()), this._clippingInfos = null); + const e = this.stage; + if (!e) + return; + const i = this._clips; + _e(i) && i.length && (this._clippingInfos = i.items.map((r) => Acr.fromClipArea(e, r))), this.requestRender(); + } +}; +const Pcr = (t, e) => t.key.level - e.key.level != 0 ? t.key.level - e.key.level : t.key.row - e.key.row != 0 ? t.key.row - e.key.row : t.key.col - e.key.col; +let lre = class extends hH { + constructor(e) { + super(), this._tileInfoView = e; + } + get requiresDedicatedFBO() { + return !1; + } + renderChildren(e) { + this.sortChildren(Pcr), this.setStencilReference(e), super.renderChildren(e); + } + createRenderParams(e) { + const { state: i } = e, r = super.createRenderParams(e); + return r.requiredLevel = this._tileInfoView.getClosestInfoForScale(i.scale).level, r.displayLevel = this._tileInfoView.tileInfo.scaleToZoom(i.scale), r; + } + prepareRenderPasses(e) { + const i = super.prepareRenderPasses(e); + return i.push(e.registerRenderPass({ name: "stencil", brushes: [WMt], drawPhase: lo.DEBUG | lo.MAP | lo.HIGHLIGHT, target: () => this.getStencilTarget() })), Vi("esri-tiles-debug") && i.push(e.registerRenderPass({ name: "tileInfo", brushes: [HMt], drawPhase: lo.DEBUG, target: () => this.children })), i; + } + getStencilTarget() { + return this.children; + } + setStencilReference(e) { + let i = 1; + for (const r of this.children) + r.stencilRef = i++; + } +}; +function A2e(t, e) { + const i = e.length; + if (t < e[0].value || i === 1) + return e[0].size; + for (let r = 1; r < i; r++) + if (t < e[r].value) { + const n = (t - e[r - 1].value) / (e[r].value - e[r - 1].value); + return e[r - 1].size + n * (e[r].size - e[r - 1].size); + } + return e[i - 1].size; +} +let Ocr = class { + constructor() { + this.symbolLevels = [], this.vvColorValues = new Float32Array(8), this.vvColors = new Float32Array(32), this.vvOpacityValues = new Float32Array(8), this.vvOpacities = new Float32Array(8), this.vvSizeMinMaxValue = new Float32Array(4), this.outsideLabelsVisible = !1, this._vvMaterialParameters = { vvSizeEnabled: !1, vvColorEnabled: !1, vvRotationEnabled: !1, vvRotationType: "geographic", vvOpacityEnabled: !1 }, this._technique = p4; + } + getSizeVVFieldStops(e) { + const i = this._vvSizeFieldStops; + if (i) + switch (i.type) { + case "static": + return i; + case "level-dependent": + return Gu(i.levels[e], () => { + let r = 1 / 0, n = 0; + for (const l in i.levels) { + const c = parseFloat(l), h = Math.abs(e - c); + h < r && (r = h, n = c); + } + if (r === 1 / 0) + return { sizes: new Float32Array([0, 0, 0, 0, 0, 0]), values: new Float32Array([0, 0, 0, 0, 0, 0]) }; + const s = 2 ** ((e - n) / 2), o = i.levels[n], a = new Float32Array(o.values); + return a[2] *= s, a[3] *= s, { sizes: o.sizes, values: a }; + }); + default: + return; + } + } + get vvMaterialParameters() { + return this._vvMaterialParameters; + } + update(e) { + _e(this._vvInfo) && this._updateVisualVariables(this._vvInfo.vvRanges, e); + } + setInfo(e, i, r) { + this._updateEffects(r), this._vvInfo = i, this._technique = jMt(e), this.rendererSchema = this._technique.createOrUpdateRendererSchema(this.rendererSchema, e); + } + getVariation() { + return { ...this._technique.getVariation(this.rendererSchema), outsideLabelsVisible: this.outsideLabelsVisible, supportsTextureFloat: hI("2d").supportsTextureFloat }; + } + getVariationHash() { + return this._technique.getVariationHash(this.rendererSchema) << 1 | (this.outsideLabelsVisible ? 1 : 0); + } + _updateEffects(e) { + _e(e) ? this.outsideLabelsVisible = e.excludedLabelsVisible : this.outsideLabelsVisible = !1; + } + _updateVisualVariables(e, i) { + const r = this._vvMaterialParameters; + if (r.vvOpacityEnabled = !1, r.vvSizeEnabled = !1, r.vvColorEnabled = !1, r.vvRotationEnabled = !1, !e) + return; + const n = e.size; + if (n) { + if (r.vvSizeEnabled = !0, n.minMaxValue) { + const l = n.minMaxValue; + let c, h; + if (LZe(l.minSize) && LZe(l.maxSize)) + if (gfe(l.minSize) && gfe(l.maxSize)) + c = dn(l.minSize), h = dn(l.maxSize); + else { + const p = i.scale; + c = dn(A2e(p, l.minSize.stops)), h = dn(A2e(p, l.maxSize.stops)); + } + this.vvSizeMinMaxValue.set([l.minDataValue, l.maxDataValue, c, h]); + } + if (n.scaleStops && (this.vvSizeScaleStopsValue = dn(A2e(i.scale, n.scaleStops.stops))), n.unitValue) { + const l = th(i.spatialReference) / Wte[n.unitValue.unit]; + this.vvSizeUnitValueToPixelsRatio = l / i.resolution; + } + n.fieldStops && (this._vvSizeFieldStops = n.fieldStops); + } + const s = e.color; + s && (r.vvColorEnabled = !0, this.vvColorValues.set(s.values), this.vvColors.set(s.colors)); + const o = e.opacity; + o && (r.vvOpacityEnabled = !0, this.vvOpacityValues.set(o.values), this.vvOpacities.set(o.opacities)); + const a = e.rotation; + a && (r.vvRotationEnabled = !0, r.vvRotationType = a.type); + } +}, iFt = class extends lre { + constructor(e) { + super(e), this._rendererInfo = new Ocr(), this._materialItemsRequestQueue = new JZ(), this.attributeView = new Tcr(() => this.onAttributeStoreUpdate()); + } + destroy() { + this.children.forEach((e) => e.destroy()), this.removeAllChildren(), this.attributeView.destroy(), this._materialItemsRequestQueue.clear(); + } + setRendererInfo(e, i, r) { + this._rendererInfo.setInfo(e, i, r), this.requestRender(); + } + async getMaterialItems(e, i) { + if (!e || e.length === 0) + return []; + const r = mm(); + return this._materialItemsRequestQueue.push({ items: e, abortOptions: i, resolver: r }), this.requestRender(), r.promise; + } + doRender(e) { + if (e.context.capabilities.enable("textureFloat"), e.context.capabilities.enable("vao"), this._materialItemsRequestQueue.length > 0) { + let i = this._materialItemsRequestQueue.pop(); + for (; i; ) + this._processMaterialItemRequest(e, i), i = this._materialItemsRequestQueue.pop(); + } + super.doRender(e); + } + renderChildren(e) { + for (const i of this.children) + i.commit(e); + this._rendererInfo.update(e.state), super.renderChildren(e); + } + updateTransforms(e) { + if (this.children.some((i) => i.hasData)) + for (const i of this.children) + i.setTransform(e); + } + createRenderParams(e) { + const i = super.createRenderParams(e); + return i.rendererInfo = this._rendererInfo, i.attributeView = this.attributeView, i; + } + onAttributeStoreUpdate() { + } + _processMaterialItemRequest(e, { items: i, abortOptions: r, resolver: n }) { + const { painter: s, pixelRatio: o } = e, a = i.map((l) => s.textureManager.rasterizeItem(l.symbol, o, l.glyphIds, r)); + Promise.all(a).then((l) => { + if (!this.stage) + return void n.reject(); + const c = l.map((h, p) => ({ id: i[p].id, mosaicItem: h })); + n.resolve(c); + }, n.reject); + } +}; +const Rcr = Math.PI / 180, Mcr = 4; +let Dcr = class extends pC { + constructor(e) { + super(), this._program = null, this._vao = null, this._vertexBuffer = null, this._indexBuffer = null, this._dvsMat3 = Ml(), this._localOrigin = { x: 0, y: 0 }, this._getBounds = e; + } + destroy() { + this._vao && (this._vao.dispose(!0), this._vao = null, this._vertexBuffer = null, this._indexBuffer = null), this._program = Ua(this._program); + } + doRender(e) { + const { context: i } = e, r = this._getBounds(); + if (r.length < 1) + return; + this._createShaderProgram(i), this._updateMatricesAndLocalOrigin(e), this._updateBufferData(i, r), i.setBlendingEnabled(!0), i.setDepthTestEnabled(!1), i.setStencilWriteMask(0), i.setStencilTestEnabled(!1), i.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), i.setColorMask(!0, !0, !0, !0); + const n = this._program; + i.bindVAO(this._vao), i.useProgram(n), n.setUniformMatrix3fv("u_dvsMat3", this._dvsMat3), i.gl.lineWidth(1), i.drawElements(ps.LINES, 8 * r.length, Fi.UNSIGNED_INT, 0), i.bindVAO(); + } + _createTransforms() { + return { dvs: Ml() }; + } + _createShaderProgram(e) { + if (this._program) + return; + const i = `precision highp float; + uniform mat3 u_dvsMat3; + + attribute vec2 a_position; + + void main() { + mediump vec3 pos = u_dvsMat3 * vec3(a_position, 1.0); + gl_Position = vec4(pos.xy, 0.0, 1.0); + }`, r = `precision mediump float; + void main() { + gl_FragColor = vec4(0.75, 0.0, 0.0, 0.75); + }`; + this._program = e.programCache.acquire(i, r, Lst().attributes); + } + _updateMatricesAndLocalOrigin(e) { + const { state: i } = e, { displayMat3: r, size: n, resolution: s, pixelRatio: o, rotation: a, viewpoint: l } = i, c = Rcr * a, { x: h, y: p } = l.targetGeometry, y = w5e(h, i.spatialReference); + this._localOrigin.x = y, this._localOrigin.y = p; + const v = o * n[0], x = o * n[1], I = s * v, P = s * x, F = v3(this._dvsMat3); + kv(F, F, r), Ng(F, F, Tp(v / 2, x / 2)), KO(F, F, I3(n[0] / I, -x / P, 1)), BI(F, F, -c); + } + _updateBufferData(e, i) { + const { x: r, y: n } = this._localOrigin, s = 2 * Mcr * i.length, o = new Float32Array(s), a = new Uint32Array(8 * i.length); + let l = 0, c = 0; + for (const h of i) + h && (o[2 * l + 0] = h[0] - r, o[2 * l + 1] = h[1] - n, o[2 * l + 2] = h[0] - r, o[2 * l + 3] = h[3] - n, o[2 * l + 4] = h[2] - r, o[2 * l + 5] = h[3] - n, o[2 * l + 6] = h[2] - r, o[2 * l + 7] = h[1] - n, a[c + 0] = l + 0, a[c + 1] = l + 3, a[c + 2] = l + 3, a[c + 3] = l + 2, a[c + 4] = l + 2, a[c + 5] = l + 1, a[c + 6] = l + 1, a[c + 7] = l + 0, l += 4, c += 8); + if (this._vertexBuffer ? this._vertexBuffer.setData(o.buffer) : this._vertexBuffer = Qo.createVertex(e, Vo.DYNAMIC_DRAW, o.buffer), this._indexBuffer ? this._indexBuffer.setData(a) : this._indexBuffer = Qo.createIndex(e, Vo.DYNAMIC_DRAW, a), !this._vao) { + const h = Lst(); + this._vao = new Ac(e, h.attributes, h.bufferLayouts, { geometry: this._vertexBuffer }, this._indexBuffer); + } + } +}; +const Lst = () => E3("bounds", { geometry: [{ location: 0, name: "a_position", count: 2, type: Fi.FLOAT }] }); +let rFt = class extends iFt { + constructor(e) { + super(e), this.hasHighlight = () => !0; + } + destroy() { + super.destroy(), this._boundsRenderer = la(this._boundsRenderer); + } + enableRenderingBounds(e) { + this._boundsRenderer = new Dcr(e), this.requestRender(); + } + get hasLabels() { + return !1; + } + onTileData(e, i) { + e.patch(i), this.contains(e) || this.addChild(e), this.requestRender(); + } + onTileError(e) { + e.clear(), this.contains(e) || this.addChild(e); + } + _renderChildren(e, i) { + for (const r of this.children) + r.isReady && r.hasData && (r.commit(e), e.context.setStencilFunction(Ll.EQUAL, r.stencilRef, 255), r.getDisplayList().replay(e, r, i)); + } +}, $O = class extends rFt { + renderChildren(e) { + this.attributeView.update(), this.children.some((i) => i.hasData) && (this.attributeView.bindTextures(e.context, !1), super.renderChildren(e), e.drawPhase === lo.MAP && this._renderChildren(e), this.hasHighlight() && e.drawPhase === lo.HIGHLIGHT && this._renderHighlight(e), this._boundsRenderer && this._boundsRenderer.doRender(e)); + } + _renderHighlight(e) { + const { painter: i } = e, r = i.effects.highlight; + r.bind(e), this._renderChildren(e, r.defines), r.draw(e), r.unbind(); + } +}; +const yae = "esri-zoom-box", vae = { container: `${yae}__container`, overlay: `${yae}__overlay`, background: `${yae}__overlay-background`, box: `${yae}__outline` }, P2e = { zoom: "Shift", counter: "Ctrl" }; +let iK = class extends vn { + constructor(e) { + super(e), this._container = null, this._overlay = null, this._backgroundShape = null, this._boxShape = null, this._box = { x: 0, y: 0, width: 0, height: 0 }, this._rafId = null, this._handles = null, this._redraw = this._redraw.bind(this); + } + destroy() { + this.view = null; + } + set view(e) { + this._handles && this._handles.forEach((i) => { + i.remove(); + }), this._handles = null, this._destroyOverlay(), this._set("view", e), e && (e.on("drag", [P2e.zoom], (i) => this._handleDrag(i, 1), UE.INTERNAL), e.on("drag", [P2e.zoom, P2e.counter], (i) => this._handleDrag(i, -1), UE.INTERNAL)); + } + _start() { + this._createContainer(), this._createOverlay(), this.navigation.begin(); + } + _update(e, i, r, n) { + this._box.x = e, this._box.y = i, this._box.width = r, this._box.height = n, this._rafId || (this._rafId = requestAnimationFrame(this._redraw)); + } + _end(e, i, r, n, s) { + const o = this.view, a = o.toMap(nd(e + 0.5 * r, i + 0.5 * n)); + let l = Math.max(r / o.width, n / o.height); + s === -1 && (l = 1 / l), this._destroyOverlay(), this.navigation.end(), o.goTo({ center: a, scale: o.scale * l }); + } + _updateBox(e, i, r, n) { + const s = this._boxShape; + s.setAttributeNS(null, "x", "" + e), s.setAttributeNS(null, "y", "" + i), s.setAttributeNS(null, "width", "" + r), s.setAttributeNS(null, "height", "" + n), s.setAttributeNS(null, "class", vae.box); + } + _updateBackground(e, i, r, n) { + this._backgroundShape.setAttributeNS(null, "d", this._toSVGPath(e, i, r, n, this.view.width, this.view.height)); + } + _createContainer() { + const e = document.createElement("div"); + e.className = vae.container, this.view.root.appendChild(e), this._container = e; + } + _createOverlay() { + const e = this.view.width, i = this.view.height, r = document.createElementNS("http://www.w3.org/2000/svg", "path"); + r.setAttributeNS(null, "d", "M 0 0 L " + e + " 0 L " + e + " " + i + " L 0 " + i + " Z"), r.setAttributeNS(null, "class", vae.background); + const n = document.createElementNS("http://www.w3.org/2000/svg", "rect"), s = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + s.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"), s.setAttributeNS(null, "class", vae.overlay), s.appendChild(r), s.appendChild(n), this._container.appendChild(s), this._backgroundShape = r, this._boxShape = n, this._overlay = s; + } + _destroyOverlay() { + this._container && this._container.parentNode && this._container.parentNode.removeChild(this._container), this._container = this._backgroundShape = this._boxShape = this._overlay = null; + } + _toSVGPath(e, i, r, n, s, o) { + const a = e + r, l = i + n; + return "M 0 0 L " + s + " 0 L " + s + " " + o + " L 0 " + o + " ZM " + e + " " + i + " L " + e + " " + l + " L " + a + " " + l + " L " + a + " " + i + " Z"; + } + _handleDrag(e, i) { + const r = e.x, n = e.y, s = e.origin.x, o = e.origin.y; + let a, l, c, h; + switch (r > s ? (a = s, c = r - s) : (a = r, c = s - r), n > o ? (l = o, h = n - o) : (l = n, h = o - n), e.action) { + case "start": + this._start(); + break; + case "update": + this._update(a, l, c, h); + break; + case "end": + this._end(a, l, c, h, i); + } + e.stopPropagation(); + } + _redraw() { + if (!this._rafId || (this._rafId = null, !this._overlay)) + return; + const { x: e, y: i, width: r, height: n } = this._box; + this._updateBox(e, i, r, n), this._updateBackground(e, i, r, n), this._rafId = requestAnimationFrame(this._redraw); + } +}; +E([N()], iK.prototype, "navigation", void 0), E([N()], iK.prototype, "view", null), iK = E([dt("esri.views.2d.navigation.ZoomBox")], iK); +const Fcr = iK; +let yD = class { + constructor(e) { + this._gain = e, this.lastValue = void 0, this.filteredDelta = void 0; + } + update(e) { + if (this.hasLastValue()) { + const i = this.computeDelta(e); + this._updateDelta(i); + } + this.lastValue = e; + } + reset() { + this.lastValue = void 0, this.filteredDelta = void 0; + } + hasLastValue() { + return this.lastValue !== void 0; + } + hasFilteredDelta() { + return this.filteredDelta !== void 0; + } + computeDelta(e) { + return this.lastValue === void 0 ? NaN : e - this.lastValue; + } + _updateDelta(e) { + this.filteredDelta !== void 0 ? this.filteredDelta = (1 - this._gain) * this.filteredDelta + this._gain * e : this.filteredDelta = e; + } +}, W9e = class { + constructor(e, i, r) { + this._initialVelocity = e, this._stopVelocity = i, this._friction = r, this._duration = Math.abs(Math.log(Math.abs(this._initialVelocity) / this._stopVelocity) / Math.log(1 - this._friction)); + } + get duration() { + return this._duration; + } + isFinished(e) { + return e > this.duration; + } + get friction() { + return this._friction; + } + value(e) { + return this.valueFromInitialVelocity(this._initialVelocity, e); + } + valueDelta(e, i) { + const r = this.value(e); + return this.value(e + i) - r; + } + valueFromInitialVelocity(e, i) { + i = Math.min(i, this.duration); + const r = 1 - this.friction; + return e * (r ** i - 1) / Math.log(r); + } +}, Lcr = class extends W9e { + constructor(e, i, r, n, s) { + super(e, i, r), this._sceneVelocity = n, this.direction = s; + } + value(e) { + return super.valueFromInitialVelocity(this._sceneVelocity, e); + } +}, Ncr = class { + constructor(e = 300, i = 12, r = 0.84) { + this._minimumInitialVelocity = e, this._stopVelocity = i, this._friction = r, this.enabled = !0, this._time = new yD(0.6), this._screen = [new yD(0.4), new yD(0.4)], this._scene = [new yD(0.6), new yD(0.6), new yD(0.6)], this._tmpDirection = sn(); + } + add(e, i, r) { + if (this.enabled) { + if (this._time.hasLastValue() && this._time.computeDelta(r) < 0.015) + return; + this._screen[0].update(e[0]), this._screen[1].update(e[1]), this._scene[0].update(i[0]), this._scene[1].update(i[1]), this._scene[2].update(i[2]), this._time.update(r); + } + } + reset() { + this._screen[0].reset(), this._screen[1].reset(), this._scene[0].reset(), this._scene[1].reset(), this._scene[2].reset(), this._time.reset(); + } + evaluateMomentum() { + if (!this.enabled || !this._screen[0].hasFilteredDelta() || !this._time.hasFilteredDelta()) + return null; + const e = this._screen[0].filteredDelta, i = this._screen[1].filteredDelta, r = e == null || i == null ? 0 : Math.sqrt(e * e + i * i), n = this._time.filteredDelta, s = n == null || r == null ? 0 : r / n; + return Math.abs(s) < this._minimumInitialVelocity ? null : this.createMomentum(s, this._stopVelocity, this._friction); + } + createMomentum(e, i, r) { + Ol(this._tmpDirection, this._scene[0].filteredDelta ?? 0, this._scene[1].filteredDelta ?? 0, this._scene[2].filteredDelta ?? 0); + const n = h1(this._tmpDirection); + n > 0 && od(this._tmpDirection, this._tmpDirection, 1 / n); + const s = this._time.filteredDelta; + return new Lcr(e, i, r, s == null ? 0 : n / s, this._tmpDirection); + } +}, aj = class extends vn { + constructor(e) { + super(e), this.animationTime = 0, this.momentumEstimator = new Ncr(500, 6, 0.92), this.momentum = null, this.tmpMomentum = sn(), this.momentumFinished = !1, this.viewpoint = new Q_({ targetGeometry: new Xi(), scale: 0, rotation: 0 }), this._previousDrag = null, Oy(() => this.momentumFinished, () => this.navigation.stop()); + } + begin(e, i) { + this.navigation.begin(), this.momentumEstimator.reset(), this.addToEstimator(i), this._previousDrag = i; + } + update(e, i) { + this.addToEstimator(i); + let r = i.center.x, n = i.center.y; + const s = this._previousDrag; + r = s ? s.center.x - r : -r, n = s ? n - s.center.y : n, e.viewpoint = jF(this.viewpoint, e.viewpoint, [r || 0, n || 0]), this._previousDrag = i; + } + end(e, i) { + this.addToEstimator(i); + const r = e.navigation.momentumEnabled; + this.momentum = r ? this.momentumEstimator.evaluateMomentum() : null, this.animationTime = 0, this.momentum && this.onAnimationUpdate(e), this._previousDrag = null, this.navigation.end(); + } + addToEstimator(e) { + const i = e.center.x, r = e.center.y, n = n7t(-i, r), s = Na(-i, r, 0); + this.momentumEstimator.add(n, s, 1e-3 * e.timestamp); + } + onAnimationUpdate(e) { + this.navigation.animationManager?.animateContinous(e.viewpoint, (i, r) => { + const { momentum: n, animationTime: s, tmpMomentum: o } = this, a = 1e-3 * r; + if (!(this.momentumFinished = !n || n.isFinished(s))) { + const l = n.valueDelta(s, a); + od(o, n.direction, l), jF(i, i, o), e.constraints.constrainByGeometry(i); + } + this.animationTime += a; + }); + } + stopMomentumNavigation() { + this.momentum && (this.momentumEstimator.reset(), this.momentum = null, this.navigation.stop()); + } +}; +E([N()], aj.prototype, "momentumFinished", void 0), E([N()], aj.prototype, "viewpoint", void 0), E([N()], aj.prototype, "navigation", void 0), aj = E([dt("esri.views.2d.navigation.actions.Pan")], aj); +const kcr = aj; +let nFt = class { + constructor(e = 2.5, i = 0.01, r = 0.95, n = 12) { + this._minimumInitialVelocity = e, this._stopVelocity = i, this._friction = r, this._maxVelocity = n, this.enabled = !0, this.value = new yD(0.8), this.time = new yD(0.3); + } + add(e, i) { + if (this.enabled && i != null) { + if (this.time.hasLastValue()) { + if (this.time.computeDelta(i) < 0.01) + return; + if (this.value.hasFilteredDelta()) { + const r = this.value.computeDelta(e); + this.value.filteredDelta * r < 0 && this.value.reset(); + } + } + this.time.update(i), this.value.update(e); + } + } + reset() { + this.value.reset(), this.time.reset(); + } + evaluateMomentum() { + if (!this.enabled || !this.value.hasFilteredDelta() || !this.time.hasFilteredDelta()) + return null; + let e = this.value.filteredDelta / this.time.filteredDelta; + return e = ru(e, -this._maxVelocity, this._maxVelocity), Math.abs(e) < this._minimumInitialVelocity ? null : this.createMomentum(e, this._stopVelocity, this._friction); + } + createMomentum(e, i, r) { + return new W9e(e, i, r); + } +}, $cr = class extends nFt { + constructor(e = 3, i = 0.01, r = 0.95, n = 12) { + super(e, i, r, n); + } + add(e, i) { + const r = this.value.lastValue; + if (r != null) { + let n = e - r; + for (; n > Math.PI; ) + n -= 2 * Math.PI; + for (; n < -Math.PI; ) + n += 2 * Math.PI; + e = r + n; + } + super.add(e, i); + } +}, Bcr = class extends W9e { + constructor(e, i, r) { + super(e, i, r); + } + value(e) { + const i = super.value(e); + return Math.exp(i); + } + valueDelta(e, i) { + const r = super.value(e), n = super.value(e + i) - r; + return Math.exp(n); + } +}, Vcr = class extends nFt { + constructor(e = 2.5, i = 0.01, r = 0.95, n = 12) { + super(e, i, r, n); + } + add(e, i) { + super.add(Math.log(e), i); + } + createMomentum(e, i, r) { + return new Bcr(e, i, r); + } +}, lj = class extends vn { + constructor(e) { + super(e), this._animationTime = 0, this._momentumFinished = !1, this._previousAngle = 0, this._previousRadius = 0, this._previousCenter = null, this._rotationMomentumEstimator = new $cr(0.6, 0.15, 0.95), this._rotationDirection = 1, this._startAngle = 0, this._startRadius = 0, this._updateTimestamp = null, this._zoomDirection = 1, this._zoomMomentumEstimator = new Vcr(), this._zoomOnly = null, this.zoomMomentum = null, this.rotateMomentum = null, this.viewpoint = new Q_({ targetGeometry: new Xi(), scale: 0, rotation: 0 }), this.addHandles(Oy(() => this._momentumFinished, () => this.navigation.stop())); + } + begin(e, i) { + this.navigation.begin(), this._rotationMomentumEstimator.reset(), this._zoomMomentumEstimator.reset(), this._zoomOnly = null, this._previousAngle = this._startAngle = i.angle, this._previousRadius = this._startRadius = i.radius, this._previousCenter = i.center, this._updateTimestamp = null, e.constraints.rotationEnabled && this.addToRotateEstimator(0, i.timestamp), this.addToZoomEstimator(i, 1); + } + update(e, i) { + this._updateTimestamp === null && (this._updateTimestamp = i.timestamp); + const r = i.angle, n = i.radius, s = i.center, o = Math.abs(180 * (r - this._startAngle) / Math.PI), a = Math.abs(n - this._startRadius), l = this._startRadius / n; + if (this._previousRadius && this._previousCenter) { + const c = n / this._previousRadius; + let h = 180 * (r - this._previousAngle) / Math.PI; + this._rotationDirection = h >= 0 ? 1 : -1, this._zoomDirection = c >= 1 ? 1 : -1, e.constraints.rotationEnabled ? (this._zoomOnly === null && i.timestamp - this._updateTimestamp > 200 && (this._zoomOnly = a - o > 0), this._zoomOnly === null || this._zoomOnly ? h = 0 : this.addToRotateEstimator(r - this._startAngle, i.timestamp)) : h = 0, this.addToZoomEstimator(i, l), this.navigation.setViewpoint([s.x, s.y], 1 / c, h, [this._previousCenter.x - s.x, s.y - this._previousCenter.y]); + } + this._previousAngle = r, this._previousRadius = n, this._previousCenter = s; + } + end(e) { + this.rotateMomentum = this._rotationMomentumEstimator.evaluateMomentum(), this.zoomMomentum = this._zoomMomentumEstimator.evaluateMomentum(), this._animationTime = 0, (this.rotateMomentum || this.zoomMomentum) && this.onAnimationUpdate(e), this.navigation.end(); + } + addToRotateEstimator(e, i) { + this._rotationMomentumEstimator.add(e, 1e-3 * i); + } + addToZoomEstimator(e, i) { + this._zoomMomentumEstimator.add(i, 1e-3 * e.timestamp); + } + canZoomIn(e) { + const i = e.scale, r = e.constraints.effectiveMaxScale; + return r === 0 || i > r; + } + canZoomOut(e) { + const i = e.scale, r = e.constraints.effectiveMinScale; + return r === 0 || i < r; + } + onAnimationUpdate(e) { + this.navigation.animationManager?.animateContinous(e.viewpoint, (i, r) => { + const n = !this.canZoomIn(e) && this._zoomDirection > 1 || !this.canZoomOut(e) && this._zoomDirection < 1, s = !this.rotateMomentum || this.rotateMomentum.isFinished(this._animationTime), o = n || !this.zoomMomentum || this.zoomMomentum.isFinished(this._animationTime), a = 1e-3 * r; + if (this._momentumFinished = s && o, !this._momentumFinished) { + const l = this.rotateMomentum ? Math.abs(this.rotateMomentum.valueDelta(this._animationTime, a)) * this._rotationDirection * 180 / Math.PI : 0; + let c = this.zoomMomentum ? Math.abs(this.zoomMomentum.valueDelta(this._animationTime, a)) : 1; + const h = rl(), p = rl(); + if (this._previousCenter) { + aa(h, this._previousCenter.x, this._previousCenter.y), kNe(p, e.size, e.padding), FNe(h, h, p); + const { constraints: y, scale: v } = e, x = v * c; + c < 1 && !y.canZoomInTo(x) ? (c = v / y.effectiveMaxScale, this.zoomMomentum = null, this.rotateMomentum = null) : c > 1 && !y.canZoomOutTo(x) && (c = v / y.effectiveMinScale, this.zoomMomentum = null, this.rotateMomentum = null), GNe(i, e.viewpoint, c, l, h, e.size), e.constraints.constrainByGeometry(i); + } + } + this._animationTime += a; + }); + } + stopMomentumNavigation() { + (this.rotateMomentum || this.zoomMomentum) && (this.rotateMomentum && (this._rotationMomentumEstimator.reset(), this.rotateMomentum = null), this.zoomMomentum && (this._zoomMomentumEstimator.reset(), this.zoomMomentum = null), this.navigation.stop()); + } +}; +E([N()], lj.prototype, "_momentumFinished", void 0), E([N()], lj.prototype, "viewpoint", void 0), E([N()], lj.prototype, "navigation", void 0), lj = E([dt("esri.views.2d.navigation.actions.Pinch")], lj); +const jcr = lj, O2e = rl(), Nst = rl(); +let rK = class extends vn { + constructor(e) { + super(e), this._previousCenter = rl(), this.viewpoint = new Q_({ targetGeometry: new Xi(), scale: 0, rotation: 0 }); + } + begin(e, i) { + this.navigation.begin(), aa(this._previousCenter, i.center.x, i.center.y); + } + update(e, i) { + const { state: { size: r, padding: n } } = e; + aa(O2e, i.center.x, i.center.y), o1t(Nst, r, n), e.viewpoint = oPe(this.viewpoint, e.state.paddedViewState.viewpoint, a1t(Nst, this._previousCenter, O2e)), pU(this._previousCenter, O2e); + } + end() { + this.navigation.end(); + } +}; +E([N()], rK.prototype, "viewpoint", void 0), E([N()], rK.prototype, "navigation", void 0), rK = E([dt("esri.views.2d.actions.Rotate")], rK); +const Gcr = rK, _ae = 10, kst = 1, R2e = new Q_({ targetGeometry: new Xi() }), M2e = [0, 0], $st = 250; +let HT = class extends vn { + constructor(e) { + super(e), this._endTimer = null, this._lastEventTimestamp = null, this.animationManager = null, this.interacting = !1; + } + initialize() { + this.pan = new kcr({ navigation: this }), this.rotate = new Gcr({ navigation: this }), this.pinch = new jcr({ navigation: this }), this.zoomBox = new Fcr({ view: this.view, navigation: this }); + } + destroy() { + this.pan = la(this.pan), this.rotate = la(this.rotate), this.pinch = la(this.pinch), this.zoomBox = la(this.zoomBox), this.animationManager = null; + } + begin() { + this._set("interacting", !0); + } + end() { + this._lastEventTimestamp = performance.now(), this._startTimer($st); + } + async zoom(e, i = this._getDefaultAnchor()) { + if (this.stop(), this.begin(), this.view.constraints.snapToZoom && this.view.constraints.effectiveLODs) + return e < 1 ? this.zoomIn(i) : this.zoomOut(i); + this.setViewpoint(i, e, 0, [0, 0]); + } + async zoomIn(e) { + const i = this.view, r = i.constraints.snapToNextScale(i.scale); + return this._zoomToScale(r, e); + } + async zoomOut(e) { + const i = this.view, r = i.constraints.snapToPreviousScale(i.scale); + return this._zoomToScale(r, e); + } + setViewpoint(e, i, r, n) { + this.begin(), this.view.state.viewpoint = this._scaleRotateTranslateViewpoint(this.view.viewpoint, e, i, r, n), this.end(); + } + setViewpointImmediate(e, i = 0, r = [0, 0], n = this._getDefaultAnchor()) { + this.view.state.viewpoint = this._scaleRotateTranslateViewpoint(this.view.viewpoint, n, e, i, r); + } + continousRotateClockwise() { + const e = this.get("view.viewpoint"); + this.animationManager?.animateContinous(e, (i) => { + oPe(i, i, -kst); + }); + } + continousRotateCounterclockwise() { + const e = this.get("view.viewpoint"); + this.animationManager?.animateContinous(e, (i) => { + oPe(i, i, kst); + }); + } + resetRotation() { + this.view.rotation = 0; + } + continousPanLeft() { + this._continuousPan([-_ae, 0]); + } + continousPanRight() { + this._continuousPan([_ae, 0]); + } + continousPanUp() { + this._continuousPan([0, _ae]); + } + continousPanDown() { + this._continuousPan([0, -_ae]); + } + stop() { + this.pan.stopMomentumNavigation(), this.animationManager?.stop(), this.end(), this._endTimer !== null && (clearTimeout(this._endTimer), this._endTimer = null, this._set("interacting", !1)); + } + _continuousPan(e) { + const i = this.view.viewpoint; + this.animationManager?.animateContinous(i, (r) => { + jF(r, r, e), this.view.constraints.constrainByGeometry(r); + }); + } + _startTimer(e) { + return this._endTimer !== null || (this._endTimer = setTimeout(() => { + this._endTimer = null; + const i = performance.now() - (this._lastEventTimestamp ?? 0); + i < $st ? this._endTimer = this._startTimer(i) : this._set("interacting", !1); + }, e)), this._endTimer; + } + _getDefaultAnchor() { + const { size: e, padding: { left: i, right: r, top: n, bottom: s } } = this.view; + return M2e[0] = 0.5 * (e[0] - r + i), M2e[1] = 0.5 * (e[1] - s + n), M2e; + } + async _zoomToScale(e, i = this._getDefaultAnchor()) { + const { view: r } = this, { constraints: n, scale: s, viewpoint: o, size: a, padding: l } = r, c = n.canZoomInTo(e), h = n.canZoomOutTo(e); + if (!(e < s && !c || e > s && !h)) + return eWe(R2e, o, e / s, 0, i, a, l), n.constrainByGeometry(R2e), r.goTo(R2e, { animate: !0 }); + } + _scaleRotateTranslateViewpoint(e, i, r, n, s) { + const { view: o } = this, { size: a, padding: l, constraints: c, scale: h, viewpoint: p } = o, y = h * r, v = c.canZoomInTo(y), x = c.canZoomOutTo(y); + return (r < 1 && !v || r > 1 && !x) && (r = 1), jF(p, p, s), eWe(e, p, r, n, i, a, l), c.constrainByGeometry(e); + } +}; +E([N()], HT.prototype, "animationManager", void 0), E([N({ type: Boolean, readOnly: !0 })], HT.prototype, "interacting", void 0), E([N()], HT.prototype, "pan", void 0), E([N()], HT.prototype, "pinch", void 0), E([N()], HT.prototype, "rotate", void 0), E([N()], HT.prototype, "view", void 0), E([N()], HT.prototype, "zoomBox", void 0), HT = E([dt("esri.views.2d.navigation.MapViewNavigation")], HT); +const Ucr = HT, sFt = { shaders: { vertexShader: Vg("magnifier/magnifier.vert"), fragmentShader: Vg("magnifier/magnifier.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) }; +function zcr(t) { + return SI(t, sFt); +} +async function ume(t, e) { + const { data: i } = await ir(t, { responseType: "image", ...e }); + return i; +} +async function Hcr(t) { + const e = Promise.resolve().then(() => ALr), i = Promise.resolve().then(() => OLr), r = ume((await e).default, { signal: t }), n = ume((await i).default, { signal: t }), s = { mask: await r, overlay: await n }; + return hn(t), s; +} +let Wcr = class extends pC { + constructor() { + super(), this._handles = new Lf(), this._resourcePixelRatio = 1, this.visible = !1; + } + destroy() { + this._handles = la(this._handles), this._disposeRenderResources(), this._resourcesTask = J6(this._resourcesTask); + } + get background() { + return this._background; + } + set background(e) { + this._background = e, this.requestRender(); + } + get magnifier() { + return this._magnifier; + } + set magnifier(e) { + this._magnifier = e, this._handles.removeAll(), this._handles.add([Qi(() => e.version, () => { + this.visible = e.visible && _e(e.position) && e.size > 0, this.requestRender(); + }, jo), Qi(() => [e.maskUrl, e.overlayUrl], () => this._reloadResources()), Qi(() => e.size, () => { + this._disposeRenderResources(), this.requestRender(); + })]); + } + _createTransforms() { + return { dvs: Ml() }; + } + doRender(e) { + const i = e.context; + if (!this._resourcesTask) + return void this._reloadResources(); + if (e.drawPhase !== lo.MAP || !this._canRender()) + return; + this._updateResources(e); + const r = this._magnifier; + if (ut(r.position)) + return; + const n = e.pixelRatio, s = r.size * n, o = 1 / r.factor, a = Math.ceil(o * s); + this._readbackTexture.resize(a, a); + const { size: l } = e.state, c = n * l[0], h = n * l[1], p = 0.5 * a, y = 0.5 * a, v = ru(n * r.position.x, p, c - p - 1), x = ru(h - n * r.position.y, y, h - y - 1); + i.setBlendingEnabled(!0); + const I = v - p, P = x - y, F = this._readbackTexture; + i.bindTexture(F, 0), i.gl.copyTexImage2D(F.descriptor.target, 0, F.descriptor.pixelFormat, I, P, a, a, 0); + const k = this.background?.color, V = k ? [k.a * k.r / 255, k.a * k.g / 255, k.a * k.b / 255, k.a] : [1, 1, 1, 1], j = (v + r.offset.x * n) / c * 2 - 1, Y = (x - r.offset.y * n) / h * 2 - 1, X = s / c * 2, Q = s / h * 2, re = this._program; + i.bindVAO(this._vertexArrayObject), i.bindTexture(this._overlayTexture, 6), i.bindTexture(this._maskTexture, 7), i.useProgram(re), re.setUniform4fv("u_background", V), re.setUniform1i("u_readbackTexture", 0), re.setUniform1i("u_overlayTexture", 6), re.setUniform1i("u_maskTexture", 7), re.setUniform4f("u_drawPos", j, Y, X, Q), re.setUniform1i("u_maskEnabled", r.maskEnabled ? 1 : 0), re.setUniform1i("u_overlayEnabled", r.overlayEnabled ? 1 : 0), i.setStencilTestEnabled(!1), i.setColorMask(!0, !0, !0, !0), i.drawArrays(ps.TRIANGLE_STRIP, 0, 4), i.bindVAO(); + } + _canRender() { + return this.mask && this.overlay && this._magnifier != null; + } + _reloadResources() { + this._resourcesTask && this._resourcesTask.abort(); + const e = _e(this._magnifier) ? this._magnifier.maskUrl : null, i = _e(this._magnifier) ? this._magnifier.overlayUrl : null; + this._resourcesTask = iI(async (r) => { + const n = ut(e) || ut(i) ? Hcr(r) : null, s = _e(e) ? ir(e, { responseType: "image", signal: r }).then((c) => c.data) : n.then((c) => c.mask), o = _e(i) ? ir(i, { responseType: "image", signal: r }).then((c) => c.data) : n.then((c) => c.overlay), [a, l] = await Promise.all([s, o]); + this.mask = a, this.overlay = l, this._disposeRenderResources(), this.requestRender(); + }); + } + _disposeRenderResources() { + this._readbackTexture = Ua(this._readbackTexture), this._overlayTexture = Ua(this._overlayTexture), this._maskTexture = Ua(this._maskTexture), this._vertexArrayObject = Ua(this._vertexArrayObject), this._program = Ua(this._program); + } + _updateResources(e) { + if (e.pixelRatio !== this._resourcePixelRatio && this._disposeRenderResources(), this._readbackTexture) + return; + const i = e.context; + this._resourcePixelRatio = e.pixelRatio; + const r = Math.ceil(this._magnifier.size * e.pixelRatio); + this._program = zcr(i); + const n = new Uint16Array([0, 1, 0, 0, 1, 1, 1, 0]), s = sFt.attributes; + this._vertexArrayObject = new Ac(i, s, zMt, { geometry: Qo.createVertex(i, Vo.STATIC_DRAW, n) }), this.overlay.width = r, this.overlay.height = r, this._overlayTexture = new Ts(i, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.NEAREST, flipped: !0, preMultiplyAlpha: !K9t(this.overlay.src) || !e.context.driverTest.svgPremultipliesAlpha.result }, this.overlay), this.mask.width = r, this.mask.height = r, this._maskTexture = new Ts(i, { target: io.TEXTURE_2D, pixelFormat: cn.ALPHA, internalFormat: cn.ALPHA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.NEAREST, flipped: !0 }, this.mask); + const o = 1 / this._magnifier.factor; + this._readbackTexture = new Ts(i, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, flipped: !1, width: Math.ceil(o * r), height: Math.ceil(o * r) }); + } +}; +const oFt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + GraphicContainer: $O, + GraphicsView2D: _x, + LabelManager: Kar, + MagnifierView2D: Wcr, + MapViewNavigation: Ucr, + Stage: Dar +}, Symbol.toStringTag, { value: "Module" })); +let aFt = class { + constructor(e, i, r) { + this.pixelBlock = e, this.extent = i, this.originalPixelBlock = r; + } + get width() { + return _e(this.pixelBlock) ? this.pixelBlock.width : 0; + } + get height() { + return _e(this.pixelBlock) ? this.pixelBlock.height : 0; + } + render(e) { + const i = this.pixelBlock; + if (ut(i)) + return; + const r = this.filter({ extent: this.extent, pixelBlock: this.originalPixelBlock ?? i }); + if (ut(r.pixelBlock)) + return; + r.pixelBlock.maskIsAlpha && (r.pixelBlock.premultiplyAlpha = !0); + const n = r.pixelBlock.getAsRGBA(), s = e.createImageData(r.pixelBlock.width, r.pixelBlock.height); + s.data.set(n), e.putImageData(s, 0, 0); + } + getRenderedRasterPixels() { + const e = this.filter({ extent: this.extent, pixelBlock: this.pixelBlock }); + return ut(e.pixelBlock) ? null : (e.pixelBlock.maskIsAlpha && (e.pixelBlock.premultiplyAlpha = !0), { width: e.pixelBlock.width, height: e.pixelBlock.height, renderedRasterPixels: new Uint8Array(e.pixelBlock.getAsRGBA().buffer) }); + } +}; +function lFt(t) { + return t && "render" in t; +} +function uFt(t) { + const e = document.createElement("canvas"); + return e.width = t.width, e.height = t.height, t.render(e.getContext("2d")), e; +} +function qcr(t) { + return lFt(t) ? t instanceof aFt ? Sa(t.getRenderedRasterPixels(), (e) => e.renderedRasterPixels) : uFt(t) : t; +} +let q9e = class extends pC { + constructor(e = null, i) { + super(), this.blendFunction = "standard", this._sourceWidth = 0, this._sourceHeight = 0, this._textureInvalidated = !1, this._texture = null, this.stencilRef = 0, this.coordScale = [1, 1], this._height = void 0, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this._width = void 0, this.x = 0, this.y = 0, this.immutable = i.immutable ?? !1, this.requestRenderOnSourceChangedEnabled = i.requestRenderOnSourceChangedEnabled ?? !0, this.source = e, this.requestRender = this.requestRender.bind(this); + } + destroy() { + this._texture && (this._texture.dispose(), this._texture = null), _e(this._uploadStatus) && (this._uploadStatus.controller.abort(), this._uploadStatus = null); + } + get isSourceScaled() { + return this.width !== this._sourceWidth || this.height !== this._sourceHeight; + } + get height() { + return this._height !== void 0 ? this._height : this._sourceHeight; + } + set height(e) { + this._height = e; + } + get source() { + return this._source; + } + set source(e) { + e == null && this._source == null || (this._source = e, this._source instanceof HTMLImageElement ? (this._sourceHeight = this._source.naturalHeight, this._sourceWidth = this._source.naturalWidth) : this._source && (this._sourceHeight = this._source.height, this._sourceWidth = this._source.width), this.invalidateTexture()); + } + get width() { + return this._width !== void 0 ? this._width : this._sourceWidth; + } + set width(e) { + this._width = e; + } + beforeRender(e) { + super.beforeRender(e), this.updateTexture(e); + } + async setSourceAsync(e, i) { + _e(this._uploadStatus) && this._uploadStatus.controller.abort(); + const r = new AbortController(), n = mm(); + return k7(i, () => r.abort()), k7(r, (s) => n.reject(s)), this._uploadStatus = { controller: r, resolver: n }, this.source = e, n.promise; + } + invalidateTexture() { + this._textureInvalidated || (this._textureInvalidated = !0, this.requestRenderOnSourceChangedEnabled && this.requestRender()); + } + updateTransitionProperties(e, i) { + e >= 64 && (this.fadeTransitionEnabled = !1, this.inFadeTransition = !1), super.updateTransitionProperties(e, i); + } + setTransform(e) { + const i = v3(this.transforms.dvs), [r, n] = e.toScreenNoRotation([0, 0], [this.x, this.y]), s = this.resolution / this.pixelRatio / e.resolution, o = s * this.width, a = s * this.height, l = Math.PI * this.rotation / 180; + Ng(i, i, Tp(r, n)), Ng(i, i, Tp(o / 2, a / 2)), BI(i, i, -l), Ng(i, i, Tp(-o / 2, -a / 2)), bye(i, i, Tp(o, a)), kv(this.transforms.dvs, e.displayViewMat3, i); + } + setSamplingProfile(e) { + this._texture && (e.mips && !this._texture.descriptor.hasMipmap && this._texture.generateMipmap(), this._texture.setSamplingMode(e.samplingMode)); + } + bind(e, i) { + this._texture && e.bindTexture(this._texture, i); + } + async updateTexture({ context: e, painter: i }) { + if (!this._textureInvalidated) + return; + if (this._textureInvalidated = !1, this._texture || (this._texture = this._createTexture(e)), !this.source) + return void this._texture.setData(null); + this._texture.resize(this._sourceWidth, this._sourceHeight); + const r = qcr(this.source); + try { + if (_e(this._uploadStatus)) { + const { controller: n, resolver: s } = this._uploadStatus, o = { signal: n.signal }, { width: a, height: l } = this, c = this._texture; + await i.textureUploadManager.enqueueTextureUpdate({ data: r, texture: c, width: a, height: l }, o), s.resolve(), this._uploadStatus = null; + } else + this._texture.setData(r); + this.ready(); + } catch (n) { + eI(n); + } + } + onDetach() { + this.destroy(); + } + _createTransforms() { + return { dvs: Ml() }; + } + _createTexture(e) { + const i = this.immutable && e.type === go.WEBGL2; + return new Ts(e, { target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: i ? Vs.RGBA8 : cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, isImmutable: i, width: this._sourceWidth, height: this._sourceHeight }); + } +}, Ycr = class extends cH { + constructor(e, i, r, n, s, o, a = null) { + super(e, i, r, n, s, o), this.bitmap = new q9e(a, { immutable: !1, requestRenderOnSourceChangedEnabled: !1 }), this.bitmap.coordScale = [s, o], this.bitmap.once("isReady", () => this.ready()); + } + destroy() { + super.destroy(), this.bitmap.destroy(); + } + beforeRender(e) { + super.beforeRender(e), this.bitmap.beforeRender(e); + } + afterRender(e) { + super.afterRender(e), this.bitmap.afterRender(e); + } + set stencilRef(e) { + this.bitmap.stencilRef = e; + } + get stencilRef() { + return this.bitmap.stencilRef; + } + _createTransforms() { + return { dvs: Ml(), tileMat3: Ml() }; + } + setTransform(e) { + super.setTransform(e), this.bitmap.transforms.dvs = this.transforms.dvs; + } + onAttach() { + this.bitmap.stage = this.stage; + } + onDetach() { + this.bitmap && (this.bitmap.stage = null); + } +}, cFt = class extends lre { + get requiresDedicatedFBO() { + return this.children.some((e) => e.bitmap.blendFunction === "additive"); + } + createTile(e) { + const i = this._tileInfoView.getTileBounds(Eo(), e), r = this._tileInfoView.getTileResolution(e.level), [n, s] = this._tileInfoView.tileInfo.size; + return new Ycr(e, r, i[0], i[3], n, s); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "bitmap (tile)", brushes: [fh.bitmap], target: () => this.children.map((r) => r.bitmap), drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + doRender(e) { + this.visible && e.drawPhase === lo.MAP && super.doRender(e); + } +}; +const hFt = (t) => { + let e = class extends t { + attach() { + this.view.timeline.record(`${this.layer.title} (BitmapTileLayer) Attach`), this._bitmapView = new cFt(this._tileInfoView), this.container.addChild(this._bitmapView); + } + detach() { + this.container.removeChild(this._bitmapView), this._bitmapView?.removeAllChildren(); + } + }; + return e = E([dt("esri.views.2d.layers.BitmapTileLayerView2D")], e), e; +}; +let Ace = class extends $i { + get version() { + return this.commitVersionProperties(), (this._get("version") || 0) + 1; + } +}; +E([N({ readOnly: !0 })], Ace.prototype, "version", null), Ace = E([dt("esri.views.layers.support.ClipArea")], Ace); +const Y9e = Ace; +var wDe; +let ZN = wDe = class extends Y9e { + constructor(t) { + super(t), this.type = "rect", this.left = null, this.right = null, this.top = null, this.bottom = null; + } + clone() { + return new wDe({ left: this.left, right: this.right, top: this.top, bottom: this.bottom }); + } + commitVersionProperties() { + this.commitProperty("left"), this.commitProperty("right"), this.commitProperty("top"), this.commitProperty("bottom"); + } +}; +E([N({ type: [Number, String], json: { write: !0 } })], ZN.prototype, "left", void 0), E([N({ type: [Number, String], json: { write: !0 } })], ZN.prototype, "right", void 0), E([N({ type: [Number, String], json: { write: !0 } })], ZN.prototype, "top", void 0), E([N({ type: [Number, String], json: { write: !0 } })], ZN.prototype, "bottom", void 0), ZN = wDe = E([dt("esri.views.layers.support.ClipRect")], ZN); +const Xcr = ZN; +var xDe; +const Kcr = { base: tn, key: "type", typeMap: { extent: br, polygon: xo } }; +let Pce = xDe = class extends Y9e { + constructor(t) { + super(t), this.type = "geometry", this.geometry = null; + } + clone() { + return new xDe({ geometry: this.geometry?.clone() ?? null }); + } + commitVersionProperties() { + this.commitProperty("geometry"); + } +}; +E([N({ types: Kcr, json: { read: Sl, write: !0 } })], Pce.prototype, "geometry", void 0), Pce = xDe = E([dt("esri.views.layers.support.Geometry")], Pce); +const Jcr = Pce; +let Oce = class extends Y9e { + constructor(e) { + super(e), this.type = "path", this.path = []; + } + commitVersionProperties() { + this.commitProperty("path"); + } +}; +E([N({ type: [[[Number]]], json: { write: !0 } })], Oce.prototype, "path", void 0), Oce = E([dt("esri.views.layers.support.Path")], Oce); +const Zcr = Oce, D2e = gr.ofType({ key: "type", base: null, typeMap: { rect: Xcr, path: Zcr, geometry: Jcr } }), ky = (t) => { + let e = class extends t { + constructor() { + super(...arguments), this.attached = !1, this.clips = new D2e(), this.lastUpdateId = -1, this.moving = !1, this.updateRequested = !1, this.visibleAtCurrentScale = !1, this.highlightOptions = null; + } + initialize() { + const i = this.view?.spatialReferenceLocked ?? !0; + this.view?.spatialReference && i && !this.spatialReferenceSupported ? this.addResolvingPromise(Promise.reject(new ot("layerview:spatial-reference-incompatible", "The spatial reference of this layer does not meet the requirements of the view", { layer: this.layer }))) : (this.container || (this.container = new rz()), this.container.fadeTransitionEnabled = !0, this.container.visible = !1, this.container.endTransitions(), this.addHandles([Qi(() => this.suspended, (n) => { + this.container && (this.container.visible = !n), this.view && !n && this.updateRequested && this.view.requestUpdate(); + }, id), Qi(() => this.layer?.opacity ?? 1, (n) => { + this.container && (this.container.opacity = n); + }, id), Qi(() => this.layer && "blendMode" in this.layer ? this.layer.blendMode : "normal", (n) => { + this.container && (this.container.blendMode = n); + }, id), Qi(() => this.layer && "effect" in this.layer ? this.layer.effect : null, (n) => { + this.container && (this.container.effect = n); + }, id), Qi(() => this.highlightOptions, (n) => this.container.highlightOptions = n, id), zu(() => this.clips, "change", () => { + this.container && (this.container.clips = this.clips); + }, id), Qi(() => ({ scale: this.view?.scale, scaleRange: this.layer && "effectiveScaleRange" in this.layer ? this.layer.effectiveScaleRange : null }), ({ scale: n }) => { + const s = n != null && this.isVisibleAtScale(n); + s !== this.visibleAtCurrentScale && this._set("visibleAtCurrentScale", s); + }, id)], "constructor"), this.view?.whenLayerView ? this.view.whenLayerView(this.layer).then((n) => { + n === this && this.processAttach(); + }, () => { + }) : this.when().then(() => { + this.processAttach(); + }, () => { + })); + } + destroy() { + this.processDetach(), this.updateRequested = !1; + } + get spatialReferenceSupported() { + const i = this.view?.spatialReference; + return i == null || this.supportsSpatialReference(i); + } + get updating() { + return this.spatialReferenceSupported && (!this.attached || !this.suspended && (this.updateRequested || this.isUpdating()) || !!this.updatingHandles?.updating); + } + processAttach() { + this.isResolved() && !this.attached && !this.destroyed && this.spatialReferenceSupported && (this.attach(), this.attached = !0, this.requestUpdate()); + } + processDetach() { + this.attached && (this.attached = !1, this.removeHandles("attach"), this.detach(), this.updateRequested = !1); + } + isVisibleAtScale(i) { + const r = this.layer && "effectiveScaleRange" in this.layer ? this.layer.effectiveScaleRange : null; + if (!r) + return !0; + const { minScale: n, maxScale: s } = r; + return (n === 0 || i <= n) && (s === 0 || i >= s); + } + requestUpdate() { + this.destroyed || this.updateRequested || (this.updateRequested = !0, this.suspended || this.view.requestUpdate()); + } + processUpdate(i) { + !this.isFulfilled() || this.isResolved() ? (this._set("updateParameters", i), this.updateRequested && !this.suspended && (this.updateRequested = !1, this.update(i))) : this.updateRequested = !1; + } + hitTest(i, r) { + return Promise.resolve(null); + } + supportsSpatialReference(i) { + return !0; + } + canResume() { + return !!this.spatialReferenceSupported && !!super.canResume() && this.visibleAtCurrentScale; + } + getSuspendInfo() { + const i = super.getSuspendInfo(), r = !this.spatialReferenceSupported, n = this.visibleAtCurrentScale; + return r && (i.spatialReferenceNotSupported = r), n && (i.outsideScaleRange = n), i; + } + addAttachHandles(i) { + this.addHandles(i, "attach"); + } + }; + return E([N()], e.prototype, "attached", void 0), E([N({ type: D2e, set(i) { + const r = $g(i, this._get("clips"), D2e); + this._set("clips", r); + } })], e.prototype, "clips", void 0), E([N()], e.prototype, "container", void 0), E([N()], e.prototype, "moving", void 0), E([N({ readOnly: !0 })], e.prototype, "spatialReferenceSupported", null), E([N({ readOnly: !0 })], e.prototype, "updateParameters", void 0), E([N()], e.prototype, "updateRequested", void 0), E([N()], e.prototype, "updating", null), E([N()], e.prototype, "view", void 0), E([N({ readOnly: !0 })], e.prototype, "visibleAtCurrentScale", void 0), E([N({ type: YNe })], e.prototype, "highlightOptions", void 0), e = E([dt("esri.views.2d.layers.LayerView2D")], e), e; +}; +let SDe = class extends rFt { + doRender(e) { + e.drawPhase === lo.HIGHLIGHT && super.doRender(e); + } + renderChildren(e) { + if (this.attributeView.update(), !this.children.some((n) => n.hasData)) + return; + this.attributeView.bindTextures(e.context), super.renderChildren(e); + const { painter: i } = e, r = i.effects.highlight; + r.bind(e), e.context.setColorMask(!0, !0, !0, !0), e.context.clear(NE.COLOR_BUFFER_BIT), this._renderChildren(e, r.defines.concat(["highlightAll"])), r.draw(e), r.unbind(); + } +}; +SDe = E([dt("esri.views.2d.layers.support.HighlightGraphicContainer")], SDe); +const X9e = SDe; +function Qcr(t) { + return t instanceof HTMLImageElement ? t.naturalWidth : t.width; +} +function ehr(t) { + return t instanceof HTMLImageElement ? t.naturalHeight : t.height; +} +function cme(t, e, i, r) { + if (i.level === r.level) + return e; + const n = t.tileInfo.size, s = t.getTileResolution(i.level), o = t.getTileResolution(r.level); + let a = t.getLODInfoAt(r.level); + const l = a.getXForColumn(r.col), c = a.getYForRow(r.row); + a = t.getLODInfoAt(i.level); + const h = a.getXForColumn(i.col), p = a.getYForRow(i.row), y = Qcr(e) / n[0], v = ehr(e) / n[1], x = Math.round(y * ((l - h) / s)), I = Math.round(v * (-(c - p) / s)), P = Math.round(y * n[0] * (o / s)), F = Math.round(v * n[1] * (o / s)), k = CDe(n); + return k.getContext("2d").drawImage(e, x, I, P, F, 0, 0, n[0], n[1]), k; +} +function CDe(t) { + const e = document.createElement("canvas"); + return [e.width, e.height] = t, e; +} +let J1 = class extends ap(Vb(oC(Bd.EventedMixin(vn)))) { + constructor(e) { + super(e), this.layer = null, this.parent = null; + } + initialize() { + this.when().catch((e) => { + if (e.name !== "layerview:create-error") { + const i = this.layer && this.layer.id || "no id", r = this.layer && this.layer.title || "no title"; + Ei.getLogger(this.declaredClass).error("#resolve()", `Failed to resolve layer view (layer title: '${r}', id: '${i}')`, e); + } + }); + } + get fullOpacity() { + return Gu(this.get("layer.opacity"), 1) * Gu(this.get("parent.fullOpacity"), 1); + } + get suspended() { + return !this.canResume(); + } + get suspendInfo() { + return this.getSuspendInfo(); + } + get legendEnabled() { + return !this.suspended && this.layer?.legendEnabled === !0; + } + get updating() { + return !(!this.updatingHandles?.updating && !this.isUpdating()); + } + get updatingProgress() { + return this.updating ? 0 : 1; + } + get visible() { + return this.layer?.visible === !0; + } + set visible(e) { + this._overrideIfSome("visible", e); + } + canResume() { + return this.visible && this.layer?.loaded && !this.parent?.suspended && this.view?.ready || !1; + } + getSuspendInfo() { + const e = this.parent && this.parent.suspended ? this.parent.suspendInfo : {}, i = this; + return i.view && i.view.ready || (e.viewNotReady = !0), this.layer && this.layer.loaded || (e.layerNotLoaded = !0), this.visible || (e.layerInvisible = !0), e; + } + isUpdating() { + return !1; + } +}; +E([N()], J1.prototype, "fullOpacity", null), E([N()], J1.prototype, "layer", void 0), E([N()], J1.prototype, "parent", void 0), E([N({ readOnly: !0 })], J1.prototype, "suspended", null), E([N({ readOnly: !0 })], J1.prototype, "suspendInfo", null), E([N({ readOnly: !0 })], J1.prototype, "legendEnabled", null), E([N({ type: Boolean, readOnly: !0 })], J1.prototype, "updating", null), E([N({ readOnly: !0 })], J1.prototype, "updatingProgress", null), E([N()], J1.prototype, "visible", null), E([N()], J1.prototype, "view", void 0), J1 = E([dt("esri.views.layers.LayerView")], J1); +const $y = J1, eL = (t) => { + let e = class extends t { + initialize() { + this.handles.add(zu(() => this.layer, "refresh", (i) => { + this.doRefresh(i.dataChanged).catch((r) => { + us(r) || Ei.getLogger(this.declaredClass).error(r); + }); + }), "RefreshableLayerView"); + } + }; + return E([N()], e.prototype, "layer", void 0), e = E([dt("esri.layers.mixins.RefreshableLayerView")], e), e; +}; +function F2e(t, e) { + return e ? "xoffset" in e && e.xoffset ? Math.max(t, Math.abs(e.xoffset)) : "yoffset" in e && e.yoffset ? Math.max(t, Math.abs(e.yoffset || 0)) : t : t; +} +function thr(t) { + let e = 0, i = 0; + for (let r = 0; r < t.length; r++) { + const n = t[r].size; + typeof n == "number" && (e += n, i++); + } + return e / i; +} +function Bst(t, e) { + return typeof t == "number" ? t : t && t.stops && t.stops.length ? thr(t.stops) : e; +} +function ihr(t, e) { + if (!e) + return t; + const i = e.filter((o) => o.type === "size").map((o) => { + const { maxSize: a, minSize: l } = o; + return (Bst(a, t) + Bst(l, t)) / 2; + }); + let r = 0; + const n = i.length; + if (n === 0) + return t; + for (let o = 0; o < n; o++) + r += i[o]; + const s = Math.floor(r / n); + return Math.max(s, t); +} +function Vst(t) { + const e = t && t.renderer, i = (t && t.event && t.event.pointerType) === "touch" ? 9 : 6; + if (!e) + return i; + const r = "visualVariables" in e ? ihr(i, e.visualVariables) : i; + if (e.type === "simple") + return F2e(r, e.symbol); + if (e.type === "unique-value") { + let n = r; + return e.uniqueValueInfos?.forEach((s) => { + n = F2e(n, s.symbol); + }), n; + } + if (e.type === "class-breaks") { + let n = r; + return e.classBreakInfos.forEach((s) => { + n = F2e(n, s.symbol); + }), n; + } + return e.type === "dot-density" || e.type, r; +} +const jst = (t) => t.spatialReference.wkid || JSON.stringify(t.spatialReference); +function rhr(t, e) { + const { dpi: i, gdbVersion: r, geometry: n, geometryPrecision: s, height: o, layerOption: a, mapExtent: l, maxAllowableOffset: c, returnFieldName: h, returnGeometry: p, returnUnformattedValues: y, returnZ: v, spatialReference: x, timeExtent: I, tolerance: P, width: F } = t.toJSON(), { dynamicLayers: k, layerDefs: V, layerIds: j } = nhr(t), Y = e && _e(e.geometry) ? e.geometry : null, X = { geometryPrecision: s, maxAllowableOffset: c, returnFieldName: h, returnGeometry: p, returnUnformattedValues: y, returnZ: v, tolerance: P }, Q = Y && Y.toJSON() || n; + if (X.imageDisplay = `${F},${o},${i}`, r && (X.gdbVersion = r), Q && (delete Q.spatialReference, X.geometry = JSON.stringify(Q), X.geometryType = Fd(Q)), x ? X.sr = x.wkid || JSON.stringify(x) : Q && Q.spatialReference ? X.sr = jst(Q) : l && l.spatialReference && (X.sr = jst(l)), X.time = I ? [I.start, I.end].join(",") : null, l) { + const { xmin: re, ymin: he, xmax: fe, ymax: be } = l; + X.mapExtent = `${re},${he},${fe},${be}`; + } + return V && (X.layerDefs = V), k && !V && (X.dynamicLayers = k), X.layers = a === "popup" ? "visible" : a, j && !k && (X.layers += `:${j.join(",")}`), X; +} +function nhr(t) { + const { mapExtent: e, floors: i, width: r, sublayers: n, layerIds: s, layerOption: o, gdbVersion: a } = t, l = n?.find((x) => x.layer != null)?.layer?.serviceSublayers, c = o === "popup", h = {}, p = pde({ extent: e, width: r, spatialReference: e?.spatialReference }), y = [], v = (x) => { + const I = p === 0, P = x.minScale === 0 || p <= x.minScale, F = x.maxScale === 0 || p >= x.maxScale; + if (x.visible && (I || P && F)) + if (x.sublayers) + x.sublayers.forEach(v); + else { + if (s?.includes(x.id) === !1 || c && (!x.popupTemplate || !x.popupEnabled)) + return; + y.unshift(x); + } + }; + if (n?.forEach(v), n && !y.length) + h.layerIds = []; + else { + const x = x0t(y, l, a), I = y.map((P) => { + const F = fQ(i, P); + return P.toExportImageJSON(F); + }); + if (x) + h.dynamicLayers = JSON.stringify(I); + else { + if (n) { + let F = y.map(({ id: k }) => k); + s && (F = F.filter((k) => s.includes(k))), h.layerIds = F; + } else + s?.length && (h.layerIds = s); + const P = shr(i, y); + if (_e(P) && P.length) { + const F = {}; + for (const k of P) + k.definitionExpression && (F[k.id] = k.definitionExpression); + Object.keys(F).length && (h.layerDefs = JSON.stringify(F)); + } + } + } + return h; +} +function shr(t, e) { + const i = !!t?.length, r = e.filter((n) => n.definitionExpression != null || i && n.floorInfo != null); + return r.length ? r.map((n) => { + const s = fQ(t, n), o = E4(s, n.definitionExpression); + return { id: n.id, definitionExpression: Gu(o, void 0) }; + }) : null; +} +var TDe; +let gp = TDe = class extends $i { + static from(t) { + return Qd(TDe, t); + } + constructor(t) { + super(t), this.dpi = 96, this.floors = null, this.gdbVersion = null, this.geometry = null, this.geometryPrecision = null, this.height = 400, this.layerIds = null, this.layerOption = "top", this.mapExtent = null, this.maxAllowableOffset = null, this.returnFieldName = !0, this.returnGeometry = !1, this.returnM = !1, this.returnUnformattedValues = !0, this.returnZ = !1, this.spatialReference = null, this.sublayers = null, this.timeExtent = null, this.tolerance = null, this.width = 400; + } +}; +E([N({ type: Number, json: { write: !0 } })], gp.prototype, "dpi", void 0), E([N()], gp.prototype, "floors", void 0), E([N({ type: String, json: { write: !0 } })], gp.prototype, "gdbVersion", void 0), E([N({ types: Bb, json: { read: Sl, write: !0 } })], gp.prototype, "geometry", void 0), E([N({ type: Number, json: { write: !0 } })], gp.prototype, "geometryPrecision", void 0), E([N({ type: Number, json: { write: !0 } })], gp.prototype, "height", void 0), E([N({ type: [Number], json: { write: !0 } })], gp.prototype, "layerIds", void 0), E([N({ type: ["top", "visible", "all", "popup"], json: { write: !0 } })], gp.prototype, "layerOption", void 0), E([N({ type: br, json: { write: !0 } })], gp.prototype, "mapExtent", void 0), E([N({ type: Number, json: { write: !0 } })], gp.prototype, "maxAllowableOffset", void 0), E([N({ type: Boolean, json: { write: !0 } })], gp.prototype, "returnFieldName", void 0), E([N({ type: Boolean, json: { write: !0 } })], gp.prototype, "returnGeometry", void 0), E([N({ type: Boolean, json: { write: !0 } })], gp.prototype, "returnM", void 0), E([N({ type: Boolean, json: { write: !0 } })], gp.prototype, "returnUnformattedValues", void 0), E([N({ type: Boolean, json: { write: !0 } })], gp.prototype, "returnZ", void 0), E([N({ type: or, json: { write: !0 } })], gp.prototype, "spatialReference", void 0), E([N()], gp.prototype, "sublayers", void 0), E([N({ type: Ny, json: { write: !0 } })], gp.prototype, "timeExtent", void 0), E([N({ type: Number, json: { write: !0 } })], gp.prototype, "tolerance", void 0), E([N({ type: Number, json: { write: !0 } })], gp.prototype, "width", void 0), gp = TDe = E([dt("esri.rest.support.IdentifyParameters")], gp); +const dFt = gp; +let yP = class extends $i { + constructor(e) { + super(e), this.displayFieldName = null, this.feature = null, this.layerId = null, this.layerName = null; + } + readFeature(e, i) { + return ro.fromJSON({ attributes: { ...i.attributes }, geometry: { ...i.geometry } }); + } + writeFeature(e, i) { + if (!e) + return; + const { attributes: r, geometry: n } = e; + r && (i.attributes = { ...r }), _e(n) && (i.geometry = n.toJSON(), i.geometryType = Phe.toJSON(n.type)); + } +}; +E([N({ type: String, json: { write: !0 } })], yP.prototype, "displayFieldName", void 0), E([N({ type: ro })], yP.prototype, "feature", void 0), E([Li("feature", ["attributes", "geometry"])], yP.prototype, "readFeature", null), E([mr("feature")], yP.prototype, "writeFeature", null), E([N({ type: Number, json: { write: !0 } })], yP.prototype, "layerId", void 0), E([N({ type: String, json: { write: !0 } })], yP.prototype, "layerName", void 0), yP = E([dt("esri.rest.support.IdentifyResult")], yP); +const ohr = yP; +async function ahr(t, e, i) { + const r = (e = uhr(e)).geometry ? [e.geometry] : [], n = mh(t); + return n.path += "/identify", Nv(r).then((s) => { + const o = rhr(e, { geometry: s && s[0] }), a = kI({ ...n.query, f: "json", ...o }), l = m1(a, i); + return ir(n.path, l).then(lhr).then((c) => chr(c, e.sublayers)); + }); +} +function lhr(t) { + const e = t.data; + return e.results = e.results || [], e.exceededTransferLimit = !!e.exceededTransferLimit, e.results = e.results.map((i) => ohr.fromJSON(i)), e; +} +function uhr(t) { + return t = dFt.from(t); +} +function chr(t, e) { + if (!e?.length) + return t; + const i = /* @__PURE__ */ new Map(); + function r(n) { + i.set(n.id, n), n.sublayers && n.sublayers.forEach(r); + } + e.forEach(r); + for (const n of t.results) + n.feature.sourceLayer = i.get(n.layerId); + return t; +} +async function Uve(t, e = t.popupTemplate) { + if (ut(e)) + return []; + const i = await e.getRequiredFields(t.fieldsIndex), { lastEditInfoEnabled: r } = e, { objectIdField: n, typeIdField: s, globalIdField: o, relationships: a } = t; + if (i.includes("*")) + return ["*"]; + const l = r ? await SGt(t) : [], c = UZ(t.fieldsIndex, [...i, ...l]); + return s && c.push(s), c && n && t.fieldsIndex?.has(n) && !c.includes(n) && c.push(n), c && o && t.fieldsIndex?.has(o) && !c.includes(o) && c.push(o), a && a.forEach((h) => { + const { keyField: p } = h; + c && p && t.fieldsIndex?.has(p) && !c.includes(p) && c.push(p); + }), c; +} +function bF(t, e) { + return t.popupTemplate ? t.popupTemplate : _e(e) && e.defaultPopupTemplateEnabled && _e(t.defaultPopupTemplate) ? t.defaultPopupTemplate : null; +} +let L2e = null; +function hhr(t, e) { + return e.type === "tile" || e.type === "map-image"; +} +let GP = class extends vn { + constructor(e) { + super(e), this._featuresResolutions = /* @__PURE__ */ new WeakMap(), this.highlightGraphics = null, this.highlightGraphicUpdated = null, this.updateHighlightedFeatures = Fv(async (i) => { + this.destroyed || this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(i).catch(() => { + })); + }); + } + initialize() { + const e = (i) => { + this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(i).catch(() => { + })), this.updateHighlightedFeatures(this._highlightGeometriesResolution); + }; + this.addHandles([zu(() => this.highlightGraphics, "change", (i) => e(i.added), { onListenerAdd: (i) => e(i) })]); + } + async fetchPopupFeatures(e, i) { + const { layerView: { layer: r, view: { scale: n } } } = this; + if (!e) + throw new ot("fetchPopupFeatures:invalid-area", "Nothing to fetch without area", { layer: r }); + const s = dhr(r.sublayers, n, i); + if (!s.length) + return []; + const o = await fhr(r, s); + if (!((r.capabilities?.operations?.supportsIdentify ?? !0) && r.version >= 10.5) && !o) + throw new ot("fetchPopupFeatures:not-supported", "query operation is disabled for this service", { layer: r }); + return o ? this._fetchPopupFeaturesUsingQueries(e, s, i) : this._fetchPopupFeaturesUsingIdentify(e, s, i); + } + clearHighlights() { + this.highlightGraphics?.removeAll(); + } + highlight(e) { + const i = this.highlightGraphics; + if (!i) + return { remove() { + } }; + let r = null; + if (e instanceof ro ? r = [e] : gr.isCollection(e) && e.length > 0 ? r = e.toArray() : Array.isArray(e) && e.length > 0 && (r = e), r = r?.filter(_e), !r || !r.length) + return { remove: () => { + } }; + for (const n of r) { + const s = n.sourceLayer; + s != null && "geometryType" in s && s.geometryType === "point" && (n.visible = !1); + } + return i.addMany(r), { remove: () => { + i.removeMany(r ?? []); + } }; + } + async _updateHighlightedFeaturesSymbols(e) { + const { layerView: { view: i }, highlightGraphics: r, highlightGraphicUpdated: n } = this; + if (r && n) + for (const s of e) { + const o = s.sourceLayer && "renderer" in s.sourceLayer && s.sourceLayer.renderer; + s.sourceLayer && "geometryType" in s.sourceLayer && s.sourceLayer.geometryType === "point" && o && "getSymbolAsync" in o && o.getSymbolAsync(s).then(async (a) => { + a || (a = new Md()); + let l = null; + const c = "visualVariables" in o ? o.visualVariables?.find((h) => h.type === "size") : void 0; + c && (L2e || (L2e = (await Promise.resolve().then(() => Mge)).getSize), l = L2e(c, s, { view: i.type, scale: i.scale, shape: a.type === "simple-marker" ? a.style : null })), l || (l = "width" in a && "height" in a && a.width != null && a.height != null ? Math.max(a.width, a.height) : "size" in a ? a.size : 16), r.includes(s) && (s.symbol = new Md({ style: "square", size: l, xoffset: "xoffset" in a ? a.xoffset : 0, yoffset: "yoffset" in a ? a.yoffset : 0 }), n(s, "symbol"), s.visible = !0); + }); + } + } + async _updateHighlightedFeaturesGeometries(e) { + const { layerView: { layer: i, view: r }, highlightGraphics: n, highlightGraphicUpdated: s } = this; + if (this._highlightGeometriesResolution = e, !s || !n?.length || !i.capabilities.operations.supportsQuery) + return; + const o = this._getTargetResolution(e), a = /* @__PURE__ */ new Map(); + for (const h of n) + if (!this._featuresResolutions.has(h) || this._featuresResolutions.get(h) > o) { + const p = h.sourceLayer; + II(a, p, () => /* @__PURE__ */ new Map()).set(h.getObjectId(), h); + } + const l = Array.from(a, ([h, p]) => { + const y = h.createQuery(); + return y.objectIds = [...p.keys()], y.outFields = [h.objectIdField], y.returnGeometry = !0, y.maxAllowableOffset = o, y.outSpatialReference = r.spatialReference, h.queryFeatures(y); + }), c = await Promise.all(l); + if (!this.destroyed) + for (const { features: h } of c) + for (const p of h) { + const y = p.sourceLayer, v = a.get(y).get(p.getObjectId()); + v && n.includes(v) && (v.geometry = p.geometry, s(v, "geometry"), this._featuresResolutions.set(v, o)); + } + } + _getTargetResolution(e) { + const i = e * th(this.layerView.view.spatialReference), r = i / 16; + return r <= 10 ? 0 : e / i * r; + } + async _fetchPopupFeaturesUsingIdentify(e, i, r) { + const n = await this._createIdentifyParameters(e, i, r); + if (ut(n)) + return []; + const { results: s } = await ahr(this.layerView.layer.parsedUrl, n); + return s.map((o) => o.feature); + } + async _createIdentifyParameters(e, i, r) { + const { floors: n, layer: s, timeExtent: o, view: { spatialReference: a, scale: l } } = this.layerView, c = _e(r) ? r.event : null; + if (!i.length) + return null; + await Promise.all(i.map(({ sublayer: I }) => I.load().catch(() => { + }))); + const h = Math.min(Vi("mapservice-popup-identify-max-tolerance"), s.allSublayers.reduce((I, P) => P.renderer ? Vst({ renderer: P.renderer, event: c }) : I, 2)), p = this.createFetchPopupFeaturesQueryGeometry(e, h), y = Uti(l, a), v = Math.round(p.width / y), x = new br({ xmin: p.center.x - y * v, ymin: p.center.y - y * v, xmax: p.center.x + y * v, ymax: p.center.y + y * v, spatialReference: p.spatialReference }); + return new dFt({ floors: n, gdbVersion: "gdbVersion" in s ? s.gdbVersion : void 0, geometry: e, height: v, layerOption: "popup", mapExtent: x, returnGeometry: !0, spatialReference: a, sublayers: s.sublayers, timeExtent: o, tolerance: h, width: v }); + } + async _fetchPopupFeaturesUsingQueries(e, i, r) { + const { layerView: { floors: n, timeExtent: s } } = this, o = _e(r) ? r.event : null, a = i.map(async ({ sublayer: l, popupTemplate: c }) => { + if (await l.load().catch(() => { + }), l.capabilities && !l.capabilities.operations.supportsQuery) + return []; + const h = l.createQuery(), p = Vst({ renderer: l.renderer, event: o }), y = this.createFetchPopupFeaturesQueryGeometry(e, p); + if (h.geometry = y, h.outFields = await Uve(l, c), h.timeExtent = s, n) { + const k = n.clone(), V = fQ(k, l); + _e(V) && (h.where = h.where ? `(${h.where}) AND (${V})` : V); + } + const v = this._getTargetResolution(y.width / p), x = await phr(c), I = l.geometryType === "point" || x && x.arcadeUtils.hasGeometryOperations(c); + I || (h.maxAllowableOffset = v); + let { features: P } = await l.queryFeatures(h); + const F = I ? 0 : v; + P = await mhr(l, P); + for (const k of P) + this._featuresResolutions.set(k, F); + return P; + }); + return (await Nu(a)).reverse().reduce((l, c) => c.value ? [...l, ...c.value] : l, []).filter((l) => l != null); + } +}; +function dhr(t, e, i) { + const r = [], n = (s) => { + const o = s.minScale === 0 || e <= s.minScale, a = s.maxScale === 0 || e >= s.maxScale; + if (s.visible && o && a) { + if (s.sublayers) + s.sublayers.forEach(n); + else if (s.popupEnabled) { + const l = bF(s, { ...i, defaultPopupTemplateEnabled: !1 }); + _e(l) && r.unshift({ sublayer: s, popupTemplate: l }); + } + } + }; + return (t?.toArray() ?? []).reverse().map(n), r; +} +function phr(t) { + return t.expressionInfos?.length || Array.isArray(t.content) && t.content.some((e) => e.type === "expression") ? p1() : Promise.resolve(); +} +async function fhr(t, e) { + if (t.capabilities?.operations?.supportsQuery) + return !0; + try { + return await Promise.any(e.map(({ sublayer: i }) => i.load().then(() => i.capabilities.operations.supportsQuery))); + } catch { + return !1; + } +} +async function mhr(t, e) { + const i = t.renderer; + return i && "defaultSymbol" in i && !i.defaultSymbol && (e = i.valueExpression ? await Promise.all(e.map((r) => i.getSymbolAsync(r).then((n) => n ? r : null))).then((r) => r.filter((n) => n != null)) : e.filter((r) => i.getSymbol(r) != null)), e; +} +E([N({ constructOnly: !0 })], GP.prototype, "createFetchPopupFeaturesQueryGeometry", void 0), E([N({ constructOnly: !0 })], GP.prototype, "layerView", void 0), E([N({ constructOnly: !0 })], GP.prototype, "highlightGraphics", void 0), E([N({ constructOnly: !0 })], GP.prototype, "highlightGraphicUpdated", void 0), E([N({ constructOnly: !0 })], GP.prototype, "updatingHandles", void 0), GP = E([dt("esri.views.layers.support.MapService")], GP); +function pFt(t, e, i, r = new br()) { + let n = 0; + if (i.type === "2d") + n = e * (i.resolution ?? 0); + else if (i.type === "3d") { + const h = i.overlayPixelSizeInMapUnits(t), p = i.basemapSpatialReference; + n = _e(p) && !p.equals(i.spatialReference) ? th(p) / th(i.spatialReference) : e * h; + } + const s = t.x - n, o = t.y - n, a = t.x + n, l = t.y + n, { spatialReference: c } = i; + return r.xmin = Math.min(s, a), r.ymin = Math.min(o, l), r.xmax = Math.max(s, a), r.ymax = Math.max(o, l), r.spatialReference = c, r; +} +new br(); +const ghr = [0, 0]; +let nK = class extends eL(hFt(ky($y))) { + constructor() { + super(...arguments), this._fetchQueue = null, this._highlightGraphics = new Ob(), this._highlightView = null, this._popupHighlightHelper = null, this._tileStrategy = null, this.layer = null; + } + get resampling() { + return !("resampling" in this.layer) || this.layer.resampling !== !1; + } + update(e) { + this._fetchQueue.pause(), this._fetchQueue.state = e.state, this._tileStrategy.update(e), this._fetchQueue.resume(), this._highlightView?.processUpdate(e); + } + attach() { + const e = "tileServers" in this.layer ? this.layer.tileServers : null; + if (this._tileInfoView = new f8(this.layer.tileInfo, this.layer.fullExtent), this._fetchQueue = new fU({ tileInfoView: this._tileInfoView, concurrency: e && 10 * e.length || 10, process: (i, r) => this.fetchTile(i, r) }), this._tileStrategy = new CQ({ cachePolicy: "keep", resampling: this.resampling, acquireTile: (i) => this.acquireTile(i), releaseTile: (i) => this.releaseTile(i), tileInfoView: this._tileInfoView }), hhr(this, this.layer)) { + const i = this._highlightView = new _x({ view: this.view, graphics: this._highlightGraphics, requestUpdateCallback: () => this.requestUpdate(), container: new X9e(this.view.featuresTilingScheme), defaultPointSymbolEnabled: !1 }); + this.container.addChild(this._highlightView.container), this._popupHighlightHelper = new GP({ createFetchPopupFeaturesQueryGeometry: (r, n) => pFt(r, n, this.view), highlightGraphics: this._highlightGraphics, highlightGraphicUpdated: (r, n) => { + i.graphicUpdateHandler({ graphic: r, property: n }); + }, layerView: this, updatingHandles: this.updatingHandles }); + } + this.requestUpdate(), this.addAttachHandles(Qi(() => this.resampling, () => { + this.doRefresh(); + })), super.attach(); + } + detach() { + super.detach(), this._tileStrategy.destroy(), this._fetchQueue.clear(), this.container.removeAllChildren(), this._popupHighlightHelper?.destroy(), this._fetchQueue = this._tileStrategy = this._tileInfoView = this._popupHighlightHelper = null; + } + async fetchPopupFeatures(e, i) { + return this._popupHighlightHelper ? this._popupHighlightHelper.fetchPopupFeatures(e, i) : []; + } + highlight(e) { + return this._popupHighlightHelper ? this._popupHighlightHelper.highlight(e) : { remove() { + } }; + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this.requestUpdate(); + } + supportsSpatialReference(e) { + return Ea(this.layer.tileInfo?.spatialReference, e); + } + async doRefresh() { + !this.attached || this.updateRequested || this.suspended || (this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e) => this._enqueueTileFetch(e))); + } + isUpdating() { + return this._fetchQueue?.updating ?? !1; + } + acquireTile(e) { + const i = this._bitmapView.createTile(e), r = i.bitmap; + return [r.x, r.y] = this._tileInfoView.getTileCoords(ghr, i.key), r.resolution = this._tileInfoView.getTileResolution(i.key), [r.width, r.height] = this._tileInfoView.tileInfo.size, this._enqueueTileFetch(i), this._bitmapView.addChild(i), this.requestUpdate(), i; + } + releaseTile(e) { + this._fetchQueue.abort(e.key.id), this._bitmapView.removeChild(e), e.once("detach", () => e.destroy()), this.requestUpdate(); + } + async fetchTile(e, i = {}) { + const r = "tilemapCache" in this.layer ? this.layer.tilemapCache : null, { signal: n, resamplingLevel: s = 0 } = i; + if (!r) + try { + return await this._fetchImage(e, n); + } catch (l) { + if (!us(l) && !this.resampling) + return CDe(this._tileInfoView.tileInfo.size); + if (s < 3) { + const c = this._tileInfoView.getTileParentId(e.id); + if (c) { + const h = new Lh(c), p = await this.fetchTile(h, { ...i, resamplingLevel: s + 1 }); + return cme(this._tileInfoView, p, h, e); + } + } + throw l; + } + const o = new Lh(0, 0, 0, 0); + let a; + try { + if (await r.fetchAvailabilityUpsample(e.level, e.row, e.col, o, { signal: n }), o.level !== e.level && !this.resampling) + return CDe(this._tileInfoView.tileInfo.size); + a = await this._fetchImage(o, n); + } catch (l) { + if (us(l)) + throw l; + a = await this._fetchImage(e, n); + } + return this.resampling ? cme(this._tileInfoView, a, o, e) : a; + } + async _enqueueTileFetch(e) { + if (!this._fetchQueue.has(e.key.id)) { + try { + const i = await this._fetchQueue.push(e.key); + e.bitmap.source = i, e.bitmap.width = this._tileInfoView.tileInfo.size[0], e.bitmap.height = this._tileInfoView.tileInfo.size[1], e.once("attach", () => this.requestUpdate()); + } catch (i) { + us(i) || Ei.getLogger(this.declaredClass).error(i); + } + this.requestUpdate(); + } + } + async _fetchImage(e, i) { + return this.layer.fetchImageBitmapTile(e.level, e.row, e.col, { signal: i }); + } +}; +E([N()], nK.prototype, "_fetchQueue", void 0), E([N()], nK.prototype, "resampling", null), nK = E([dt("esri.views.2d.layers.TileLayerView2D")], nK); +const yhr = nK, vhr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: yhr +}, Symbol.toStringTag, { value: "Module" })); +let Rce = class extends ro { + constructor() { + super(...arguments), this.isAggregate = !0; + } + getEffectivePopupTemplate(e = !1) { + if (this.popupTemplate) + return this.popupTemplate; + const i = this.sourceLayer && this.sourceLayer.featureReduction; + return i && "popupTemplate" in i && i.popupEnabled ? i.popupTemplate : null; + } + getObjectId() { + return this.attributes.aggregateId; + } +}; +E([N({ type: Boolean })], Rce.prototype, "isAggregate", void 0), Rce = E([dt("esri.AggregateGraphic")], Rce); +const K9e = Rce; +let b_ = class extends vn { + constructor(e) { + super(e), this._filter = null, this.duration = Vi("mapview-transitions-duration"), this._excludedEffectView = new Uw(e), this._includedEffectView = new Uw(e); + } + get excludedEffects() { + return this._excludedEffectView.effects; + } + set featureEffect(e) { + this._get("featureEffect") !== e && this._transitionTo(e); + } + get filter() { + return this._filter || this.featureEffect?.filter || null; + } + get hasEffects() { + return this._excludedEffectView.hasEffects || this._includedEffectView.hasEffects; + } + get includedEffects() { + return this._includedEffectView.effects; + } + set scale(e) { + this._set("scale", e), this._excludedEffectView.scale = e, this._includedEffectView.scale = e; + } + get transitioning() { + return this._excludedEffectView.transitioning || this._includedEffectView.transitioning; + } + transitionStep(e, i) { + this._set("scale", i), this.transitioning ? (this._includedEffectView.transitionStep(e, i), this._excludedEffectView.transitionStep(e, i), this.transitioning || (this._filter = null)) : (this._excludedEffectView.scale = i, this._includedEffectView.scale = i); + } + endTransitions() { + this._includedEffectView.endTransitions(), this._excludedEffectView.endTransitions(), this._filter = null; + } + _transitionTo(e) { + const i = this._get("featureEffect"), r = e, n = r?.includedEffect, s = r?.excludedEffect, o = this._includedEffectView.canTransitionTo(n) && this._excludedEffectView.canTransitionTo(s); + this._includedEffectView.effect = n, this._excludedEffectView.effect = s, this._set("featureEffect", r), this._filter = r?.filter || i?.filter || null, o || this.endTransitions(); + } +}; +E([N()], b_.prototype, "_filter", void 0), E([N()], b_.prototype, "_excludedEffectView", void 0), E([N()], b_.prototype, "_includedEffectView", void 0), E([N()], b_.prototype, "duration", void 0), E([N()], b_.prototype, "excludedEffects", null), E([N()], b_.prototype, "featureEffect", null), E([N()], b_.prototype, "filter", null), E([N()], b_.prototype, "hasEffects", null), E([N()], b_.prototype, "includedEffects", null), E([N({ value: 0 })], b_.prototype, "scale", null), E([N()], b_.prototype, "transitioning", null), b_ = E([dt("esri.layers.effects.FeatureEffectView")], b_); +const _hr = b_; +let sK = class extends sc { + constructor() { + super(...arguments), this.features = []; + } + readFeatures(e, i) { + const r = or.fromJSON(i.spatialReference), n = []; + for (let s = 0; s < e.length; s++) { + const o = e[s], a = K9e.fromJSON(o), l = o.geometry && o.geometry.spatialReference; + _e(a.geometry) && !l && (a.geometry.spatialReference = r); + const c = o.aggregateGeometries, h = a.aggregateGeometries; + if (c && _e(h)) + for (const p in h) { + const y = h[p], v = c[p]?.spatialReference; + _e(y) && !v && (y.spatialReference = r); + } + n.push(a); + } + return n; + } +}; +E([N({ type: [K9e], json: { write: !0 } })], sK.prototype, "features", void 0), E([Li("features")], sK.prototype, "readFeatures", null), sK = E([dt("esri.rest.support.AggregateFeatureSet")], sK); +const bhr = sK; +async function whr(t, e) { + if (!t) + return null; + switch (t.type) { + case "symbol": + return new (await Promise.resolve().then(() => WLr)).default(e); + case "heatmap": + return new (await Promise.resolve().then(() => XLr)).default(e); + } +} +function N2e(t) { + return t.some((e) => e.globalId); +} +function Iq(t) { + return t.filter((e) => !e.error).map((e) => e.objectId ?? e.globalId).filter((e) => e != null); +} +function Gst(t, e) { + const i = new Set(t); + for (const r of e.values()) + i.add(r); + return i; +} +function Ust(t, e) { + const i = new Set(t); + for (const r of e.values()) + i.delete(r); + return i; +} +let oK = class extends vn { + constructor(e) { + super(e), this._hasGlobalIds = !1, this._notifyUpdating = () => { + this.notifyChange("updating"); + }; + } + normalizeCtorArgs(e) { + return this._queueProcessor = new S$({ concurrency: 1, process: e.process }), {}; + } + destroy() { + this.clear(); + } + get updating() { + return this._queueProcessor.length > 0; + } + clear() { + this._queueProcessor.clear(); + } + push(e) { + const i = this._queueProcessor, r = i.last(); + switch (e.type) { + case "update": + case "refresh": + if (r?.type === e.type) + return; + i.push(e).then(this._notifyUpdating, this._notifyUpdating); + break; + case "edit": { + const n = r?.type === "processed-edit" ? r : null; + n && i.popLast(); + const s = this._mergeEdits(n, e); + for (const o of s) + o && i.push(o).then(this._notifyUpdating, this._notifyUpdating); + break; + } + } + this.notifyChange("updating"); + } + _mergeEdits(e, i) { + const { addedFeatures: r, deletedFeatures: n, updatedFeatures: s } = i.edits; + if (this._hasGlobalIds = this._hasGlobalIds || N2e(r) || N2e(s) || N2e(n), this._hasGlobalIds) + return [e, { type: "processed-edit", edits: { addOrModified: [...r, ...s], removed: n } }]; + const o = new Set(Iq(e?.edits.addOrModified ?? [])), a = new Set(Iq(e?.edits.removed ?? [])), l = /* @__PURE__ */ new Set([...Iq(r), ...Iq(s)]), c = new Set(Iq(n)); + return [{ type: "processed-edit", edits: { addOrModified: Array.from(Gst(Ust(o, c), l)).map((h) => ({ objectId: h })), removed: Array.from(Gst(Ust(a, l), c)).map((h) => ({ objectId: h })) } }]; + } +}; +E([N({ readOnly: !0 })], oK.prototype, "updating", null), E([N()], oK.prototype, "process", void 0), oK = E([dt("esri.views.2d.layers.support.FeatureCommandQueue")], oK); +const xhr = oK; +function Shr(t) { + return Array.isArray(t); +} +let uj = class extends kZ { + constructor(e) { + super(e), this._startupResolver = mm(), this.isReady = !1; + } + initialize() { + this._controller = new AbortController(), this.addResolvingPromise(this._startWorker(this._controller.signal)); + } + destroy() { + this._controller.abort(), this._connection && this._connection.close(); + } + set tileRenderer(e) { + this.client.tileRenderer = e; + } + get closed() { + return this._connection.closed; + } + async startup(e, i, r, n) { + await this.when(); + const s = this._controller.signal, o = Shr(r.source) ? { transferList: r.source, signal: s } : void 0, a = { service: r, config: i, tileInfo: e.tileInfo.toJSON(), tiles: n }; + await this._connection.invoke("startup", a, o), this._startupResolver.resolve(), this._set("isReady", !0); + } + async updateTiles(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("updateTiles", e)); + } + async update(e) { + const i = { config: e }; + return await this._startupResolver.promise, this._connection.invoke("update", i); + } + async applyUpdate(e) { + return await this._startupResolver.promise, this._connection.invoke("applyUpdate", e); + } + async setHighlight(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.setHighlight", e)); + } + async stop() { + if (await this._startupResolver.promise, !this.closed) + return Ef(this._connection.invoke("stop")); + } + async refresh(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.refresh", e)); + } + async querySummaryStatistics(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.querySummaryStatistics", { query: e.toJSON(), params: i }, r); + } + async queryAggregateSummaryStatistics(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateSummaryStatistics", { query: e.toJSON(), params: i }, r); + } + async queryUniqueValues(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryUniqueValues", { query: e.toJSON(), params: i }, r); + } + async queryAggregateUniqueValues(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateUniqueValues", { query: e.toJSON(), params: i }, r); + } + async queryClassBreaks(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryClassBreaks", { query: e.toJSON(), params: i }, r); + } + async queryAggregateClassBreaks(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateClassBreaks", { query: e.toJSON(), params: i }, r); + } + async queryHistogram(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryHistogram", { query: e.toJSON(), params: i }, r); + } + async queryAggregateHistogram(e, i, r) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateHistogram", { query: e.toJSON(), params: i }, r); + } + async queryFeatures(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatures", e?.toJSON(), i); + } + async queryVisibleFeatures(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryVisibleFeatures", e?.toJSON(), i); + } + async queryObjectIds(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryObjectIds", e?.toJSON(), i); + } + async queryFeatureCount(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatureCount", e?.toJSON(), i); + } + async queryExtent(e, i) { + return this._connection.invoke("controller.queryExtent", e.toJSON(), i); + } + async queryLatestObservations(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryLatestObservations", e.toJSON(), i); + } + async queryStatistics(e) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryStatistics", e); + } + async queryAggregates(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregates", e?.toJSON(), i); + } + async queryAggregateCount(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateCount", e?.toJSON(), i); + } + async queryAggregateIds(e, i) { + return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateIds", e?.toJSON(), i); + } + async getObjectId(e) { + return await this._startupResolver.promise, this._connection.invoke("controller.getObjectId", e); + } + async getDisplayId(e) { + return await this._startupResolver.promise, this._connection.invoke("controller.getDisplayId", e); + } + async getFeatures(e) { + return await this._startupResolver.promise, this._connection.invoke("controller.getFeatures", e); + } + async getAggregates() { + return await this._startupResolver.promise, this._connection.invoke("controller.getAggregates"); + } + async getAggregateValueRanges() { + return await this._startupResolver.promise, this._connection.invoke("controller.getAggregateValueRanges"); + } + async mapValidDisplayIds(e) { + return await this._startupResolver.promise, this._connection.invoke("controller.mapValidDisplayIds", e); + } + async onEdits(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.onEdits", e)); + } + async enableEvent(e, i) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.enableEvent", { name: e, value: i })); + } + async pauseStream() { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.pauseStream")); + } + async resumeStream() { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.resumeStream")); + } + async sendMessageToSocket(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.sendMessageToSocket", e)); + } + async sendMessageToClient(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.sendMessageToClient", e)); + } + async updateCustomParameters(e) { + return await this._startupResolver.promise, Ef(this._connection.invoke("controller.updateCustomParameters", e)); + } + async _startWorker(e) { + try { + this._connection = await p3("Pipeline", { client: this.client, strategy: "dedicated", signal: e }); + } catch (i) { + eI(i); + } + } +}; +E([N()], uj.prototype, "isReady", void 0), E([N({ constructOnly: !0 })], uj.prototype, "client", void 0), E([N()], uj.prototype, "tileRenderer", null), uj = E([dt("esri.views.2d.layers.support.FeatureLayerProxy")], uj); +const Chr = uj, Thr = 1e-6; +let Ehr = class { + constructor(e) { + this._tiles = /* @__PURE__ */ new Map(), this.buffer = 0, this.acquireTile = e.acquireTile, this.releaseTile = e.releaseTile, this.tileInfoView = e.tileInfoView, this.buffer = e.buffer; + } + destroy() { + } + clear() { + this._tiles.forEach((e) => this._releaseTile(e)); + } + tileKeys() { + const e = []; + return this._tiles.forEach((i, r) => e.push(r)), e; + } + update(e) { + const i = this.tileInfoView.getTileCoverage(e.state, this.buffer, "closest"), { spans: r, lodInfo: n } = i, { level: s } = n, o = [], a = [], l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(); + for (const { row: h, colFrom: p, colTo: y } of r) + for (let v = p; v <= y; v++) { + const x = Lh.getId(s, h, n.normalizeCol(v), n.getWorldForColumn(v)), I = this._getOrAcquireTile(o, x); + l.add(x), I.isReady ? I.visible = !0 : c.add(I.key); + } + return c.forEach((h) => this._addPlaceholders(l, h)), this._tiles.forEach((h) => { + l.has(h.key.id) || (a.push(h.key.id), this._releaseTile(h)); + }), ZO.pool.release(i), { hasMissingTiles: c.size > 0, added: o, removed: a }; + } + _getOrAcquireTile(e, i) { + if (!this._tiles.has(i)) { + const r = this.acquireTile(new Lh(i)); + e.push(i), this._tiles.set(i, r), r.visible = !1; + } + return this._tiles.get(i); + } + _getTile(e) { + return this._tiles.get(e); + } + _releaseTile(e) { + this._tiles.delete(e.key.id), this.releaseTile(e); + } + _addPlaceholders(e, i) { + const r = this._addPlaceholderChildren(e, i); + Math.abs(1 - r) < Thr || this._addPlaceholderParent(e, i) || (this._getTile(i.id).visible = !0); + } + _addPlaceholderChildren(e, i) { + let r = 0; + return this._tiles.forEach((n) => { + r += this._addPlaceholderChild(e, n, i); + }), r; + } + _addPlaceholderChild(e, i, r) { + return i.key.level <= r.level || !i.hasData || !r.contains(i.key) ? 0 : (i.visible = !0, e.add(i.key.id), 1 / (1 << 2 * (i.key.level - r.level))); + } + _addPlaceholderParent(e, i) { + let r = i.getParentKey(), n = 0, s = null; + for (; _e(r); ) { + if (e.has(r.id)) + return !0; + const o = this._getTile(r.id); + if (o?.isReady) { + for (const a of e) { + const l = this._getTile(a); + l && r.contains(l.key) && (l.visible = !1); + } + return o.visible = !0, e.add(o.key.id), !0; + } + o?.hasData && o.patchCount > n && (n = o.patchCount, s = o), r = r.getParentKey(); + } + return !!s && (s.visible = !0, e.add(s.key.id), !0); + } +}; +const fFt = "esri.views.layers.FeatureLayerView", k2e = Ei.getLogger(fFt), Ihr = (t) => { + let e = class extends t { + constructor(...i) { + super(...i), this._updatingRequiredFieldsPromise = null, this.filter = null, this.timeExtent = null, this.layer = null, this.requiredFields = [], this.view = null; + } + initialize() { + this.handles.add([Qi(() => { + const i = this.layer; + return [i?.elevationInfo?.featureExpressionInfo, i && "displayField" in i ? i.displayField : null, i && "timeInfo" in i && i.timeInfo, i && "renderer" in i && i.renderer, i && "labelingInfo" in i && i.labelingInfo, i && "floorInfo" in i && i.floorInfo, this.filter, this.featureEffect, this.timeExtent]; + }, () => this._handleRequiredFieldsChange(), id), zu(() => this.view?.floors, "change", () => this._handleRequiredFieldsChange()), zu(() => { + const i = this.layer; + return i && "sublayers" in i ? i.sublayers : null; + }, "change", () => this._handleRequiredFieldsChange())]); + } + get availableFields() { + const { layer: i, layer: { fieldsIndex: r }, requiredFields: n } = this; + return "outFields" in i && i.outFields ? UZ(r, [...Ohe(r, i.outFields), ...n]) : UZ(r, n); + } + get featureEffect() { + return this.layer && "featureEffect" in this.layer ? this.layer.featureEffect : null; + } + set featureEffect(i) { + this._override("featureEffect", i); + } + get maximumNumberOfFeatures() { + return 0; + } + set maximumNumberOfFeatures(i) { + k2e.error("#maximumNumberOfFeatures=", "Setting maximum number of features is not supported"); + } + get maximumNumberOfFeaturesExceeded() { + return !1; + } + highlight(i) { + throw new Error("missing implementation"); + } + createQuery() { + const i = { outFields: ["*"], returnGeometry: !0, outSpatialReference: this.view.spatialReference }, r = _e(this.filter) ? this.filter.createQuery(i) : new Os(i); + if (this.layer.type === "feature") { + const n = tze(this); + _e(n) && (r.where = r.where ? `(${r.where}) AND (${n})` : n); + } + return _e(this.timeExtent) && (r.timeExtent = _e(r.timeExtent) ? r.timeExtent.intersection(this.timeExtent) : this.timeExtent.clone()), r; + } + createAggregateQuery() { + const i = { outFields: ["*"], returnGeometry: !0, outSpatialReference: this.view.spatialReference }; + return new Os(i); + } + queryFeatures(i, r) { + throw new Error("missing implementation"); + } + queryObjectIds(i, r) { + throw new Error("missing implementation"); + } + queryFeatureCount(i, r) { + throw new Error("missing implementation"); + } + queryExtent(i, r) { + throw new Error("missing implementation"); + } + async fetchPopupFeatures(i, r) { + const n = this.validateFetchPopupFeatures(r); + if (n) + throw n; + return this.fetchClientPopupFeatures(r); + } + _loadArcadeModules(i) { + return i.get("expressionInfos.length") || Array.isArray(i.content) && i.content.some((r) => r.type === "expression") ? p1() : Promise.resolve(); + } + _handleRequiredFieldsChange() { + const i = this._updateRequiredFields(); + this._set("_updatingRequiredFieldsPromise", i), i.then(() => { + this._updatingRequiredFieldsPromise === i && this._set("_updatingRequiredFieldsPromise", null); + }); + } + async _updateRequiredFields() { + if (!this.layer || !this.view) + return; + const i = this.view.type === "3d", { layer: r, layer: { fieldsIndex: n, objectIdField: s } } = this, o = "renderer" in r && r.renderer, a = "orderBy" in r && r.orderBy, l = "featureReduction" in r ? r.featureReduction : null, c = /* @__PURE__ */ new Set(), h = await Nu([o ? o.collectRequiredFields(c, n) : null, eGe(c, r), i ? yGt(c, r) : null, _e(this.filter) ? Qje(c, r, this.filter) : null, _e(this.featureEffect) ? Qje(c, r, this.featureEffect.filter) : null, l ? _Gt(c, r, l) : null, a ? wGt(c, r, a) : null]); + if ("timeInfo" in r && r.timeInfo && this.timeExtent && sF(c, r.fieldsIndex, [r.timeInfo.startField, r.timeInfo.endField]), r.type === "feature" && (r.floorInfo && sF(c, r.fieldsIndex, [r.floorInfo.floorField]), i && _e(r.infoFor3D) && (r.globalIdField == null && k2e.error("globalIdField missing on 3DObjectFeatureLayer"), sF(c, r.fieldsIndex, [r.globalIdField]))), r.type === "subtype-group") { + F0(c, n, r.subtypeField); + const y = r.sublayers.map((v) => Promise.all([v.renderer?.collectRequiredFields(c, n), eGe(c, v)])); + await Nu(y); + } + for (const y of h) + y.error && k2e.error(y.error); + F0(c, n, s), i && "displayField" in r && r.displayField && F0(c, n, r.displayField); + const p = Array.from(c).sort(); + this._set("requiredFields", p); + } + validateFetchPopupFeatures(i) { + if (ut(i)) + return null; + for (const r of i.clientGraphics ?? []) { + const n = r.layer; + if ("popupEnabled" in n && !n.popupEnabled) + return new ot("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: n }); + if (r.isAggregate) { + const s = "featureReduction" in n ? n.featureReduction : null; + if (!(s && "popupTemplate" in s && s.popupEnabled && s.popupTemplate)) + return new ot("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: n }); + } else if ("popupTemplate" in n && !bF(n, i)) + return new ot("featurelayerview:fetchPopupFeatures", "Layer does not define a popup template", { layer: n }); + } + } + async fetchClientPopupFeatures(i) { + const r = _e(i) ? i.clientGraphics : null; + if (!r || r.length === 0) + return []; + const n = new Array(r.length), s = /* @__PURE__ */ new Map(), o = await this.createPopupQuery(i); + for (let a = 0; a < r.length; a++) { + const l = r[a]; + if (l.isAggregate) { + n[a] = l; + continue; + } + const c = l.layer; + if (!("popupEnabled" in c)) + continue; + const h = Ohe(this.layer.fieldsIndex, o.outFields), p = bF(c, i); + if (ut(p)) + continue; + const y = await this._loadArcadeModules(p); + y && y.arcadeUtils.hasGeometryOperations(p) || !zht(h, l) ? s.set(l.getObjectId(), { graphic: l, index: a }) : n[a] = l; + } + if (this.layer.type === "stream" || s.size === 0) + return n.filter(Boolean); + o.objectIds = Array.from(s.keys()); + try { + const a = await this.layer.queryFeatures(o); + for (const l of a.features) { + const { graphic: { geometry: c }, index: h } = s.get(l.getObjectId()); + l.geometry || (l.geometry = c), n[h] = l; + } + } catch { + } + return n.filter(Boolean); + } + async createPopupQuery(i) { + const r = this.layer.createQuery(), n = /* @__PURE__ */ new Set(); + let s = !1; + const o = _e(i) && i.clientGraphics ? i.clientGraphics.map((a) => a.layer) : [this.layer]; + for (const a of o) { + if (!("popupEnabled" in a)) + continue; + const l = bF(a, i); + if (ut(l)) + continue; + const c = await this._loadArcadeModules(l), h = c && c.arcadeUtils.hasGeometryOperations(l); + s = !(this.layer.geometryType !== "point" && !h); + const p = await Uve(this.layer, l); + for (const y of p) + n.add(y); + } + if (r.returnGeometry = s, r.returnZ = s, r.returnM = s, r.outFields = Array.from(n), r.outSpatialReference = this.view.spatialReference, this.layer.type === "feature") { + const a = tze(this); + _e(a) && (r.where = r.where ? `(${r.where}) AND (${a})` : a); + } + return r; + } + canResume() { + return !!super.canResume() && (!_e(this.timeExtent) || !this.timeExtent.isEmpty); + } + }; + return E([N()], e.prototype, "_updatingRequiredFieldsPromise", void 0), E([N({ readOnly: !0 })], e.prototype, "availableFields", null), E([N({ type: Tft })], e.prototype, "featureEffect", null), E([N({ type: eie })], e.prototype, "filter", void 0), E([N(Pz)], e.prototype, "timeExtent", void 0), E([N()], e.prototype, "layer", void 0), E([N({ type: Number })], e.prototype, "maximumNumberOfFeatures", null), E([N({ readOnly: !0, type: Boolean })], e.prototype, "maximumNumberOfFeaturesExceeded", null), E([N({ readOnly: !0 })], e.prototype, "requiredFields", void 0), E([N()], e.prototype, "suspended", void 0), E([N()], e.prototype, "view", void 0), e = E([dt(fFt)], e), e; +}; +function zst(t) { + return t && "openPorts" in t; +} +let c0 = class extends Ihr(eL(ky($y))) { + constructor() { + super(...arguments), this._pipelineIsUpdating = !0, this._commandsQueue = new xhr({ process: (e) => { + switch (e.type) { + case "processed-edit": + return this._doEdit(e); + case "refresh": + return this._doRefresh(e.dataChanged); + case "update": + return this._doUpdate(); + } + } }), this._visibilityOverrides = /* @__PURE__ */ new Set(), this._highlightIds = /* @__PURE__ */ new Map(), this._updateHighlight = Fv(async () => this._proxy.setHighlight(Array.from(this._highlightIds.keys()))), this._uploadsLocked = !1, this._needsClusterSizeUpdate = !1, this.featureEffectView = new _hr(), this._lastDefinitionExpression = null; + } + destroy() { + Sa(this._updateClusterSizeTask, (e) => e.remove()), this._proxy?.destroy(), this._commandsQueue.destroy(); + } + initialize() { + this.addResolvingPromise(Promise.all([this._initProxy(), this._initServiceOptions()])), this.addHandles([this.on("valueRangesChanged", (e) => { + this._set("_aggregateValueRanges", e.valueRanges); + }), Qi(() => this.featureEffect, (e) => { + this.featureEffectView.featureEffect = e; + }, id)], "constructor"), this.featureEffectView.endTransitions(); + } + async _initProxy() { + const e = this.layer; + if ("isTable" in e && e.isTable) + throw new ot("featurelayerview:table-not-supported", "table feature layer can't be displayed", { layer: this.layer }); + if ((e.type === "feature" || e.type === "subtype-group") && !v6(e)?.operations.supportsQuery) + throw new ot("featurelayerview:query-not-supported", "layer view requires a layer with query capability", { layer: e }); + this._proxy && this._proxy.destroy(); + const i = this._createClientOptions(); + return this._set("_proxy", new Chr({ client: i })), this._proxy.when(); + } + async _initServiceOptions() { + return this._set("_serviceOptions", await this._createServiceOptions()), this._serviceOptions; + } + get _effectiveFeatureReduction() { + if (!("featureReduction" in this.layer)) + return null; + const e = this.layer.featureReduction; + return e && (!("maxScale" in e) || !e.maxScale || e.maxScale < this.view.scale) ? e : null; + } + get orderByFields() { + return this._serviceOptions?.type !== "stream" ? this._serviceOptions?.orderByFields : void 0; + } + get labelsVisible() { + const e = this.layer.type === "subtype-group" ? this.layer.sublayers.items : [this.layer]; + return !this.suspended && e.some((i) => i.labelingInfo && i.labelsVisible); + } + get queryMode() { + return this._serviceOptions?.type; + } + get renderingConfigHash() { + if (!this.layer) + return null; + const e = this.availableFields, i = this.layer, r = this.view.floors, { definitionExpression: n } = i, s = this.layer.type !== "subtype-group" && this.layer.labelsVisible && this.layer.labelingInfo, o = "renderer" in i && i.renderer, a = "gdbVersion" in i ? i.gdbVersion : void 0, l = "historicMoment" in i ? i.historicMoment?.getTime() : void 0, { timeExtent: c } = this, h = "customParameters" in i ? JSON.stringify(i.customParameters) : void 0, p = "apiKey" in i ? i.apiKey : void 0, y = i.type === "stream" ? `${JSON.stringify(i.geometryDefinition)}${i.definitionExpression}` : null, v = JSON.stringify(this.clips), x = this._effectiveFeatureReduction?.toJSON(), I = "orderBy" in this.layer && JSON.stringify(this.layer.orderBy), P = "sublayers" in this.layer && this.layer.sublayers.items.reduce((k, V) => k + `${V.visible ? 1 : 0}.${JSON.stringify(V.renderer)}.${V.labelsVisible} +.${JSON.stringify(V.labelingInfo)}`, ""), F = "subtypeCode" in this.layer && this.layer.subtypeCode; + return JSON.stringify({ orderBy: I, sublayerHash: P, subtypeCode: F, filterHash: _e(this.filter) && this.filter.toJSON(), effectHash: _e(this.featureEffect) && this.featureEffect.toJSON(), streamFilter: y, gdbVersion: a, definitionExpression: n, historicMoment: l, availableFields: e, renderer: o, labelingInfo: s, timeExtent: c, floors: r, clipsHash: v, featureReduction: x, customParameters: h, apiKey: p }); + } + highlight(e) { + let i; + e instanceof ro ? i = [e.getObjectId()] : typeof e == "number" || typeof e == "string" ? i = [e] : gr.isCollection(e) && e.length > 0 ? i = e.map((n) => n?.getObjectId()).toArray() : Array.isArray(e) && e.length > 0 && (i = typeof e[0] == "number" || typeof e[0] == "string" ? e : e.map((n) => n?.getObjectId())); + const r = i?.filter(_e); + return r && r.length ? (this._addHighlight(r), { remove: () => this._removeHighlight(r) }) : { remove: () => { + } }; + } + hasHighlight() { + return !!this._highlightIds.size; + } + async hitTest(e, i) { + if (!this.tileRenderer) + return null; + const r = await this.tileRenderer.hitTest(i); + if (r.length === 0) + return null; + const { features: n, aggregates: s } = await this._proxy.getFeatures(r); + return [...s.map((o) => this._createGraphicHit(e, K9e.fromJSON(o))), ...n.map((o) => this._createGraphicHit(e, ro.fromJSON(o)))]; + } + queryStatistics() { + return this._proxy.queryStatistics(); + } + async querySummaryStatistics(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.querySummaryStatistics(this._cleanUpQuery(e), n, r); + } + async queryAggregateSummaryStatistics(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e), n, r); + } + async queryUniqueValues(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryUniqueValues(this._cleanUpQuery(e), n, r); + } + async queryAggregateUniqueValues(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e), n, r); + } + async queryClassBreaks(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryClassBreaks(this._cleanUpQuery(e), n, r); + } + async queryAggregateClassBreaks(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e), n, r); + } + async queryHistogram(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryHistogram(this._cleanUpQuery(e), n, r); + } + async queryAggregateHistogram(e, i, r) { + const n = { ...i, scale: this.view.scale }; + return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e), n, r); + } + queryFeatures(e, i) { + return this.queryFeaturesJSON(e, i).then((r) => { + const n = sc.fromJSON(r); + return n.features.forEach((s) => this._setLayersForFeature(s)), n; + }); + } + queryVisibleFeatures(e, i) { + return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e), i).then((r) => { + const n = sc.fromJSON(r); + return n.features.forEach((s) => this._setLayersForFeature(s)), n; + }); + } + async queryAggregates(e, i) { + const r = await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e), i), n = bhr.fromJSON(r); + return n.features.forEach((s) => this._setLayersForFeature(s)), n; + } + queryAggregateIds(e, i) { + return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e), i); + } + queryAggregateCount(e, i) { + return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e), i); + } + queryAggregateJSON(e, i) { + return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e), i); + } + queryFeaturesJSON(e, i) { + return this._proxy.queryFeatures(this._cleanUpQuery(e), i); + } + queryObjectIds(e, i) { + return this._proxy.queryObjectIds(this._cleanUpQuery(e), i); + } + queryFeatureCount(e, i) { + return this._proxy.queryFeatureCount(this._cleanUpQuery(e), i); + } + queryExtent(e, i) { + return this._proxy.queryExtent(this._cleanUpQuery(e), i).then((r) => ({ count: r.count, extent: br.fromJSON(r.extent) })); + } + setVisibility(e, i) { + i ? this._visibilityOverrides.delete(e) : this._visibilityOverrides.add(e), this._update(); + } + update(e) { + if (!this._tileStrategy || !this.tileRenderer) + return; + const { hasMissingTiles: i, added: r, removed: n } = this._tileStrategy.update(e); + (r.length || n.length) && this._proxy.updateTiles({ added: r, removed: n }), i && this.requestUpdate(), this.notifyChange("updating"); + } + attach() { + this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`), this._tileStrategy = new Ehr({ acquireTile: (e) => this._acquireTile(e), releaseTile: (e) => this._releaseTile(e), tileInfoView: this.view.featuresTilingScheme, buffer: 0 }), this.addAttachHandles(Qi(() => this.renderingConfigHash, () => this._update(), jo)), this.layer.type !== "stream" && this.addAttachHandles(this.layer.on("edits", (e) => this._edit(e))); + } + detach() { + this._commandsQueue.clear(), this._proxy?.stop(), this.container.removeAllChildren(), this.tileRenderer?.uninstall(this.container), this.tileRenderer = null, this._tileStrategy = la(this._tileStrategy), this._tileRendererHash = null; + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this.requestUpdate(); + } + isUpdating() { + const e = "renderer" in this.layer && this.layer.renderer != null, i = this._commandsQueue.updating, r = this._updatingRequiredFieldsPromise != null, n = !this._proxy || !this._proxy.isReady, s = this._pipelineIsUpdating, o = this.tileRenderer == null || this.tileRenderer?.updating, a = e && (i || r || n || s || o); + return Vi("esri-2d-log-updating") && console.log(`Updating FLV2D: ${a} + -> hasRenderer ${e} + -> hasPendingCommand ${i} + -> updatingRequiredFields ${r} + -> updatingProxy ${n} + -> updatingPipeline ${s} + -> updatingTileRenderer ${o} +`), a; + } + _createClientOptions() { + return { setUpdating: (e) => { + this._set("_pipelineIsUpdating", e); + }, emitEvent: (e) => { + this.emit(e.name, e.event); + } }; + } + async _detectQueryMode(e) { + const i = "path" in e, { layer: r } = this, n = "editingInfo" in r && r.editingInfo?.lastEditDate, s = "refreshInterval" in r && !!r.refreshInterval, o = !n && s, a = v6(r); + if (i && (r.type === "feature" || r.type === "subtype-group") && r.geometryType === "point" && a?.query.supportsPagination && !a?.operations.supportsEditing && !o && Vi("featurelayer-snapshot-enabled")) + try { + const l = await r.queryFeatureCount(); + if (l <= Vi("featurelayer-snapshot-point-min-threshold")) + return { mode: "snapshot", featureCount: l }; + const c = Vi("featurelayer-snapshot-point-max-threshold"), h = Vi("featurelayer-snapshot-point-coverage"), p = this.view.extent, y = r.fullExtent, v = y?.clone().intersection(p), x = _e(v) ? v.width * v.height : 0, I = y?.width * y?.height; + if (l <= c && (I === 0 ? 0 : x / I) >= h) + return { mode: "snapshot", featureCount: l }; + } catch (l) { + Ei.getLogger(this.declaredClass).warn("mapview-feature-layer", "Encountered an error when querying for featureCount", { error: l }); + } + return { mode: "on-demand" }; + } + async _createServiceOptions() { + const e = this.layer; + if (e.type === "stream") + return null; + const i = v6(e), { capabilities: r, objectIdField: n } = e, s = e.fields.map((F) => F.toJSON()), o = _e(e.fullExtent) ? e.fullExtent.toJSON() : null, a = Gve(e.geometryType), l = "timeInfo" in e && e.timeInfo && e.timeInfo.toJSON() || null, c = e.spatialReference ? e.spatialReference.toJSON() : null, h = e.type === "feature" ? e.globalIdField : null; + let p; + e.type === "ogc-feature" ? p = e.source.getSource() : zst(e.source) ? p = await e.source.openPorts() : e.parsedUrl && (p = fi(e.parsedUrl), "dynamicDataSource" in e && e.dynamicDataSource && (p.query = { layer: JSON.stringify({ source: e.dynamicDataSource }) })); + const y = "datesInUnknownTimezone" in this.layer && this.layer.datesInUnknownTimezone, v = ("subtypeField" in this.layer ? this.layer.subtypeField : null) ?? null, { mode: x, featureCount: I } = await this._detectQueryMode(p); + let P = this.layer.objectIdField; + if (this.layer.type === "feature" && _e(this.layer.orderBy) && this.layer.orderBy.length) { + const F = !this.layer.orderBy[0].valueExpression && this.layer.orderBy[0].field; + F && (P = F); + } + return { type: x, timeReferenceUnknownClient: y, subtypeField: v, featureCount: I, globalIdField: h, maxRecordCount: r.query.maxRecordCount, tileMaxRecordCount: r.query.tileMaxRecordCount, capabilities: r, effectiveCapabilities: i, fields: s, fullExtent: o, geometryType: a, objectIdField: n, source: p, timeInfo: l, spatialReference: c, orderByFields: P, datesInUnknownTimezone: y, dateFieldsTimeReference: ("dateFieldsTimeReference" in this.layer ? this.layer.dateFieldsTimeReference?.toJSON() : null) || null, preferredTimeReference: ("preferredTimeReference" in this.layer ? this.layer.preferredTimeReference?.toJSON() : null) || null, editFieldsInfo: "editFieldsInfo" in this.layer ? this.layer.editFieldsInfo?.toJSON() : null }; + } + async _createMemoryServiceOptions(e) { + const i = await e.openPorts(); + return { ...this._createServiceOptions(), type: "memory", source: i }; + } + _cleanUpQuery(e) { + const i = Os.from(e) || this.createQuery(); + return i.outSpatialReference || (i.outSpatialReference = this.view.spatialReference), i; + } + _cleanUpAggregateQuery(e) { + const i = Os.from(e) || this.createAggregateQuery(); + return i.outSpatialReference || (i.outSpatialReference = this.view.spatialReference), i; + } + async _update() { + return this._commandsQueue.push({ type: "update" }); + } + async _edit(e) { + return this.suspended ? void this._clearTiles() : this._validateEdit(e) ? this._commandsQueue.push({ type: "edit", edits: e }) : void 0; + } + async doRefresh(e) { + if (this.attached && this._tileStrategy.tileKeys().length) + return this.suspended && e ? void this._clearTiles() : this._commandsQueue.push({ type: "refresh", dataChanged: e }); + } + _clearTiles() { + this._tileStrategy.tileKeys().length && (this._proxy.updateTiles({ added: [], removed: this._tileStrategy.tileKeys() }), this._tileStrategy.clear(), this.requestUpdate(), this._commandsQueue.clear(), this._update()); + } + _validateEdit(e) { + const i = "globalIdField" in this.layer && this.layer.globalIdField, r = e.deletedFeatures.some((s) => s.objectId === -1 || !s.objectId), n = i && this.availableFields.includes(i); + return r && !n ? (Ei.getLogger(this.declaredClass).error(new ot("mapview-apply-edits", `Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)), null) : e; + } + async _doUpdate() { + try { + if (this.destroyed || !this._hasRequiredSupport(this.layer) || !this._tileStrategy) + return; + const { featureEffectView: e, filter: i } = this; + if (await this._updateRequiredFields(), this.destroyed) + return; + const { renderer: r } = this._getEffectiveRenderer(); + this._set("_effectiveRenderer", r); + const n = this._createSchemaConfig(), s = this._createConfiguration(n, i, e.filter), o = this._lastDefinitionExpression !== s.schema.source.definitionExpression; + this._lastDefinitionExpression = s.schema.source.definitionExpression; + const a = s.schema.tileRenderer, l = this._createTileRendererHash(a); + if (this._serviceOptions.type === "snapshot" && (s.schema.source.initialFeatureCount = this._serviceOptions.featureCount), l !== this._tileRendererHash) { + await this._initTileRenderer(a, r); + const c = this.layer, h = c.type === "stream" ? await this._initServiceOptions() : this._serviceOptions; + this.tileRenderer.onConfigUpdate(r), c.type !== "stream" && zst(c.source) && (h.source = await c.source.openPorts()); + const p = { added: this._tileStrategy.tileKeys(), removed: [] }; + await this._proxy.startup(this.view.featuresTilingScheme, s, h, p), this.hasHighlight() && await this._proxy.setHighlight(Array.from(this._highlightIds.keys())), await this._onceTilesUpdated(), this.tileRenderer.onConfigUpdate(r); + } else { + this._serviceOptions.type === "snapshot" && o && (s.schema.source.changedFeatureCount = await this.layer.queryFeatureCount()); + const c = await this._proxy.update(s); + (c.mesh || c.targets?.aggregate) && this._lockGPUUploads(); + try { + await this._proxy.applyUpdate(c); + } catch (h) { + us(h) || Ei.getLogger(this.declaredClass).error(h); + } + (c.mesh || c.targets?.aggregate) && this._unlockGPUUploads(), this.tileRenderer.onConfigUpdate(r), this._updateClusterSizeVariable(), this._forceAttributeTextureUpload(); + } + this._tileRendererHash = l, this.tileRenderer.invalidateLabels(), this.requestUpdate(); + } catch { + } + } + async _doEdit(e) { + try { + await this._proxy.onEdits(e); + } catch (i) { + us(i); + } + } + async _doRefresh(e) { + this._lockGPUUploads(); + try { + let i; + e && this.queryMode === "snapshot" && "queryFeatureCount" in this.layer && (i = await this.layer.queryFeatureCount()), await this._proxy.refresh({ dataChanged: e, featureCount: i }); + } catch (i) { + us(i); + } + this._unlockGPUUploads(), this._effectiveFeatureReduction && this._updateClusterSizeVariable(); + } + _updateClusterSizeVariable() { + this._needsClusterSizeUpdate && (this.tileRenderer.onConfigUpdate(this._effectiveRenderer), this._needsClusterSizeUpdate = !1); + } + _createUpdateClusterSizeTask(e, i) { + return Qi(() => this._aggregateValueRanges, (r) => { + this._updateClusterEffectiveRendererSizeVariable(e, i, r), this._needsClusterSizeUpdate = !0, this._uploadsLocked || this._updateClusterSizeVariable(); + }); + } + async _updateClusterEffectiveRendererSizeVariable(e, i, r) { + if (e.dynamicClusterSize && "visualVariables" in e && e.visualVariables) { + const n = s5e(e.visualVariables); + if (_e(n) && n.field === "cluster_count") { + const s = e.visualVariables.indexOf(n); + e.visualVariables[s] = o5e(i, r); + const o = e.clone(); + o.dynamicClusterSize = !0, this._set("_effectiveRenderer", o); + } + } + } + _getEffectiveRenderer() { + const e = this.layer, i = "renderer" in e ? e.renderer : null, r = this._effectiveFeatureReduction; + if (this._updateClusterSizeTask = eh(this._updateClusterSizeTask), r && "renderer" in r && r.renderer && !r.renderer.authoringInfo?.isAutoGenerated) { + const n = r.fields; + if (r.type === "cluster") { + const { renderer: s, didInject: o } = rgt(r.renderer, r, this._aggregateValueRanges); + return o && (this._updateClusterSizeTask = this._createUpdateClusterSizeTask(s, r)), { renderer: s, aggregateFields: n, featureReduction: r }; + } + return { renderer: r.renderer, aggregateFields: n, featureReduction: r }; + } + if (r && r.type === "cluster" && i && ngt(i)) { + const n = r, s = [], o = n5e(s, i, n, this._aggregateValueRanges, !0); + return this._updateClusterSizeTask = this._createUpdateClusterSizeTask(o, n), { renderer: o, aggregateFields: s, featureReduction: r }; + } + return { renderer: i, aggregateFields: [], featureReduction: null }; + } + _acquireTile(e) { + const i = this.tileRenderer.acquireTile(e); + return i.once("attach", () => { + this.requestUpdate(); + }), i; + } + _releaseTile(e) { + this.tileRenderer.releaseTile(e); + } + async _initTileRenderer(e, i) { + const r = await whr(e, { layerView: this, tileInfoView: this.view.featuresTilingScheme, layer: this.layer }); + return this.tileRenderer && (this._tileStrategy.clear(), this.tileRenderer.uninstall(this.container), this.tileRenderer = la(this.tileRenderer)), this.destroyed ? null : (this._proxy.tileRenderer = r, this._set("tileRenderer", r), this.tileRenderer.install(this.container), this.tileRenderer.onConfigUpdate(i), this.requestUpdate(), this.tileRenderer); + } + _createTileRendererHash(e) { + return `${e.type}`; + } + get hasFilter() { + const e = !!("floorInfo" in this.layer && this.layer.floorInfo && this.view.floors && this.view.floors.length); + return !!this.filter || e || !!this._visibilityOverrides.size || !!this.timeExtent; + } + _injectOverrides(e) { + const i = _e(e) ? e.timeExtent : null, r = _e(this.timeExtent) && _e(i) ? this.timeExtent.intersection(i) : this.timeExtent || i; + let n = null; + const s = "floorInfo" in this.layer && this.layer.floorInfo; + if (s) { + const a = _e(e) ? e.where : null; + n = this._addFloorFilterClause(a); + } + if (!this._visibilityOverrides.size && !r && !s) + return _e(e) ? e.toJSON() : null; + (e = _e(e) && e.clone() || new eie()).timeExtent = r, n && (e.where = n); + const o = e.toJSON(); + return o.hiddenIds = Array.from(this._visibilityOverrides), o; + } + _addFloorFilterClause(e) { + const i = this.layer; + let r = e || ""; + if ("floorInfo" in i && i.floorInfo) { + let n = this.view.floors; + if (!n || !n.length) + return r; + i.floorInfo.viewAllLevelIds?.length && (n = i.floorInfo.viewAllLevelIds); + const s = n.filter((l) => l !== "").map((l) => "'" + l + "'"); + s.push("''"); + const o = i.floorInfo.floorField; + let a = "(" + o + " IN ({ids}) OR " + o + " IS NULL)"; + if (a = a.replace("{ids}", s.join(", ")), _e(r) && r.includes(o)) { + let l = new RegExp("AND \\(" + o + ".*NULL\\)", "g"); + r = r.replace(l, ""), l = new RegExp("\\(" + o + ".*NULL\\)", "g"), r = r.replace(l, ""), r = r.replace(/\s+/g, " ").trim(); + } + r = r !== "" ? "(" + r + ") AND " + a : a; + } + return r !== "" ? r : null; + } + _createConfiguration(e, i, r) { + const n = this.layer.type === "feature" && this.layer.historicMoment ? this.layer.historicMoment.getTime() : void 0, s = this.layer.type === "feature" ? this.layer.gdbVersion ?? void 0 : void 0, o = new Array(jAt), a = this._injectOverrides(i); + o[0] = a, o[1] = _e(r) ? r.toJSON() : null; + const l = tcr(e); + if (ut(l)) + return null; + const c = hI("2d"); + return { availableFields: this.availableFields, gdbVersion: s, historicMoment: n, devicePixelRatio: window.devicePixelRatio || 1, filters: o, schema: l, supportsTextureFloat: c.supportsTextureFloat, maxTextureSize: c.maxTextureSize }; + } + _hasRequiredSupport(e) { + return !("renderer" in e) || Qur(e.renderer); + } + _onceTilesUpdated() { + return this.requestUpdate(), Tb(() => !this._pipelineIsUpdating); + } + _lockGPUUploads() { + this.tileRenderer && (this._uploadsLocked = !0, this.tileRenderer.lockGPUUploads()); + } + _unlockGPUUploads() { + this.tileRenderer && (this._uploadsLocked = !1, this.tileRenderer.unlockGPUUploads()); + } + _forceAttributeTextureUpload() { + this.tileRenderer && this.tileRenderer.forceAttributeTextureUpload(); + } + _createSchemaConfig() { + const e = this.layer; + return { renderer: "renderer" in e ? e.renderer : null, spatialReference: e.spatialReference, timeExtent: "timeExtent" in e ? e.timeExtent : null, definitionExpression: e.definitionExpression, featureReduction: this._effectiveFeatureReduction, fields: e.fields, geometryType: e.geometryType, historicMoment: "historicMoment" in e ? e.historicMoment : null, labelsVisible: "labelsVisible" in e && e.labelsVisible, labelingInfo: "labelingInfo" in e ? e.labelingInfo : null, availableFields: this.availableFields, featureEffect: this.featureEffect, filter: this.filter, gdbVersion: "gdbVersion" in e ? e.gdbVersion : null, pixelBuffer: 0, orderBy: "orderBy" in e && e.orderBy ? e.orderBy : null, customParameters: { ..."customParameters" in e ? e.customParameters : void 0, token: "apiKey" in e ? e.apiKey ?? void 0 : void 0 }, subtypeCode: "subtypeCode" in e ? e.subtypeCode : void 0, subtypeField: "subtypeField" in e ? e.subtypeField : void 0 }; + } + _addHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i); + this._highlightIds.set(i, r + 1); + } else + this._highlightIds.set(i, 1); + this._updateHighlight().catch((i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + }); + } + _removeHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i) - 1; + r === 0 ? this._highlightIds.delete(i) : this._highlightIds.set(i, r); + } + this._updateHighlight().catch((i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + }); + } + _setLayersForFeature(e) { + const i = this.layer; + e.layer = i, e.sourceLayer = i; + } + _createGraphicHit(e, i) { + return this._setLayersForFeature(i), _e(i.geometry) && (i.geometry.spatialReference = this.view.spatialReference), { type: "graphic", graphic: i, layer: this.layer, mapPoint: e }; + } +}; +E([N()], c0.prototype, "_serviceOptions", void 0), E([N()], c0.prototype, "_proxy", void 0), E([N()], c0.prototype, "_pipelineIsUpdating", void 0), E([N()], c0.prototype, "_effectiveRenderer", void 0), E([N()], c0.prototype, "_effectiveFeatureReduction", null), E([N()], c0.prototype, "_aggregateValueRanges", void 0), E([N()], c0.prototype, "_commandsQueue", void 0), E([N()], c0.prototype, "featureEffectView", void 0), E([N()], c0.prototype, "labelsVisible", null), E([N({ readOnly: !0 })], c0.prototype, "queryMode", null), E([N()], c0.prototype, "renderingConfigHash", null), E([N()], c0.prototype, "tileRenderer", void 0), E([N()], c0.prototype, "updating", void 0), c0 = E([dt("esri.views.2d.layers.FeatureLayerView2D")], c0); +const zve = c0, Ahr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: zve +}, Symbol.toStringTag, { value: "Module" })); +let sz = class extends hH { + constructor() { + super(...arguments), this._hasCrossfade = !1; + } + get requiresDedicatedFBO() { + return this._hasCrossfade; + } + beforeRender(e) { + super.beforeRender(e), this._manageFade(); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "bitmap", brushes: [fh.bitmap], target: () => this.children, drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + _manageFade() { + this.children.reduce((e, i) => e + (i.inFadeTransition ? 1 : 0), 0) >= 2 ? (this.children.forEach((e) => e.blendFunction = "additive"), this._hasCrossfade = !0) : (this.children.forEach((e) => e.blendFunction = "standard"), this._hasCrossfade = !1); + } +}; +const Phr = Math.PI / 180; +function Ohr(t) { + return t * Phr; +} +function Rhr(t, e) { + const i = Ohr(e.rotation), r = Math.abs(Math.cos(i)), n = Math.abs(Math.sin(i)), [s, o] = e.size; + return t[0] = Math.round(o * n + s * r), t[1] = Math.round(o * r + s * n), t; +} +function Mhr(t, e, i, r) { + const [n, s] = e, [o, a] = r, l = 0.5 * i; + return t[0] = n - l * o, t[1] = s - l * a, t[2] = n + l * o, t[3] = s + l * a, t; +} +const x5 = Eo(), KR = [0, 0], bae = new Lh(0, 0, 0, 0), Aq = { container: null, fetchSource: null, requestUpdate: null, imageMaxWidth: 2048, imageMaxHeight: 2048, imageRotationSupported: !1, imageNormalizationSupported: !1, hidpi: !1 }; +let w_ = class extends vn { + constructor(e) { + super(e), this._imagePromise = null, this.bitmaps = [], this.hidpi = Aq.hidpi, this.imageMaxWidth = Aq.imageMaxWidth, this.imageMaxHeight = Aq.imageMaxHeight, this.imageRotationSupported = Aq.imageRotationSupported, this.imageNormalizationSupported = Aq.imageNormalizationSupported, this.update = Fv(async (i, r) => { + if (hn(r), !i.stationary || this.destroyed) + return; + const n = i.state, s = Ld(n.spatialReference), o = this.hidpi ? i.pixelRatio : 1, a = this.imageNormalizationSupported && n.worldScreenWidth && n.worldScreenWidth < n.size[0], l = this.imageMaxWidth ?? 0, c = this.imageMaxHeight ?? 0; + a ? (KR[0] = n.worldScreenWidth, KR[1] = n.size[1]) : this.imageRotationSupported ? (KR[0] = n.size[0], KR[1] = n.size[1]) : Rhr(KR, n); + const h = Math.floor(KR[0] * o) > l || Math.floor(KR[1] * o) > c, p = s && (n.extent.xmin < s.valid[0] || n.extent.xmax > s.valid[1]), y = !this.imageNormalizationSupported && p, v = !h && !y, x = this.imageRotationSupported ? n.rotation : 0, I = this.container.children.slice(); + if (v) { + const P = a ? n.paddedViewState.center : n.center; + this._imagePromise && console.error("Image promise was not defined!"), this._imagePromise = this._singleExport(n, KR, P, n.resolution, x, o, r); + } else { + let P = Math.min(l, c); + y && (P = Math.min(n.worldScreenWidth, P)), this._imagePromise = this._tiledExport(n, P, o, r); + } + try { + const P = await this._imagePromise ?? []; + hn(r); + const F = []; + if (this._imagePromise = null, this.destroyed) + return; + this.bitmaps = P; + for (const k of I) + P.includes(k) || F.push(k.fadeOut().then(() => { + k.remove(), k.destroy(); + })); + for (const k of P) + F.push(k.fadeIn()); + await Promise.all(F); + } catch (P) { + this._imagePromise = null, ja(P); + } + }, 5e3), this.updateExports = Fv(async (i) => { + const r = []; + for (const n of this.container.children) { + if (!n.visible || !n.stage) + return; + r.push(i(n).then(() => { + n.invalidateTexture(), n.requestRender(); + })); + } + this._imagePromise = Nu(r).then(() => this._imagePromise = null), await this._imagePromise; + }); + } + destroy() { + this.bitmaps.forEach((e) => e.destroy()), this.bitmaps = []; + } + get updating() { + return !this.destroyed && this._imagePromise !== null; + } + async _export(e, i, r, n, s, o) { + const a = await this.fetchSource(e, Math.floor(i * s), Math.floor(r * s), { rotation: n, pixelRatio: s, signal: o }); + hn(o); + const l = new q9e(null, { immutable: !0, requestRenderOnSourceChangedEnabled: !0 }); + return l.x = e.xmin, l.y = e.ymax, l.resolution = e.width / i, l.rotation = n, l.pixelRatio = s, l.opacity = 0, this.container.addChild(l), await l.setSourceAsync(a, o), hn(o), l; + } + async _singleExport(e, i, r, n, s, o, a) { + Mhr(x5, r, n, i); + const l = a$(x5, e.spatialReference); + return [await this._export(l, i[0], i[1], s, o, a)]; + } + _tiledExport(e, i, r, n) { + const s = Wl.create({ size: i, spatialReference: e.spatialReference, scales: [e.scale] }), o = new f8(s), a = o.getTileCoverage(e); + if (!a) + return null; + const l = []; + return a.forEach((c, h, p, y) => { + bae.set(c, h, p, 0), o.getTileBounds(x5, bae); + const v = a$(x5, e.spatialReference); + l.push(this._export(v, i, i, 0, r, n).then((x) => (y !== 0 && (bae.set(c, h, p, y), o.getTileBounds(x5, bae), x.x = x5[0], x.y = x5[3]), x))); + }), Promise.all(l); + } +}; +E([N()], w_.prototype, "_imagePromise", void 0), E([N()], w_.prototype, "bitmaps", void 0), E([N()], w_.prototype, "container", void 0), E([N()], w_.prototype, "fetchSource", void 0), E([N()], w_.prototype, "hidpi", void 0), E([N()], w_.prototype, "imageMaxWidth", void 0), E([N()], w_.prototype, "imageMaxHeight", void 0), E([N()], w_.prototype, "imageRotationSupported", void 0), E([N()], w_.prototype, "imageNormalizationSupported", void 0), E([N()], w_.prototype, "requestUpdate", void 0), E([N()], w_.prototype, "updating", null), w_ = E([dt("esri.views.2d.layers.support.ExportStrategy")], w_); +const Hve = w_; +let aK = class extends eL(ky($y)) { + update(e) { + this._strategy.update(e).catch((i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + }), this.notifyChange("updating"); + } + attach() { + this._bitmapContainer = new sz(), this.container.addChild(this._bitmapContainer), this._strategy = new Hve({ container: this._bitmapContainer, fetchSource: this.fetchBitmapData.bind(this), requestUpdate: this.requestUpdate.bind(this) }); + } + detach() { + this._strategy.destroy(), this._strategy = null, this.container.removeChild(this._bitmapContainer), this._bitmapContainer.removeAllChildren(); + } + moveStart() { + } + viewChange() { + } + moveEnd() { + this.requestUpdate(); + } + fetchBitmapData(e, i, r) { + return this.layer.fetchImageBitmap(e, i, r); + } + async doRefresh() { + this.requestUpdate(); + } + isUpdating() { + return this._strategy.updating || this.updateRequested; + } +}; +E([N()], aK.prototype, "_strategy", void 0), E([N()], aK.prototype, "updating", void 0), aK = E([dt("esri.views.2d.layers.BaseDynamicLayerView2D")], aK); +const Dhr = aK, Fhr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Dhr +}, Symbol.toStringTag, { value: "Module" })); +let EDe = class extends ky($y) { + constructor() { + super(...arguments), this._graphicsViewMap = {}, this._popupTemplates = /* @__PURE__ */ new Map(), this.graphicsViews = []; + } + async hitTest(e, i) { + if (!this.graphicsViews.length) + return null; + const r = this.layer; + return this.graphicsViews.reverse().map((n) => { + const s = this._popupTemplates.get(n), o = n.hitTest(e); + for (const a of o) + a.layer = r, a.sourceLayer = r, a.popupTemplate = s; + return o; + }).flat().map((n) => ({ type: "graphic", graphic: n, layer: r, mapPoint: e })); + } + update(e) { + if (this.graphicsViews) + for (const i of this.graphicsViews) + i.processUpdate(e); + } + attach() { + this.addAttachHandles([Qi(() => this.layer?.featureCollections, (e) => { + this._clear(); + for (const { popupInfo: i, featureSet: r, layerDefinition: n } of e) { + const s = sc.fromJSON(r), o = new gr(s.features), a = n.drawingInfo, l = i ? $h.fromJSON(i) : null, c = MF(a.renderer), h = new _x({ requestUpdateCallback: () => this.requestUpdate(), view: this.view, graphics: o, renderer: c, container: new $O(this.view.featuresTilingScheme) }); + this._graphicsViewMap[s.geometryType] = h, this._popupTemplates.set(h, l), s.geometryType !== "polygon" || this.layer.polygonSymbol ? s.geometryType !== "polyline" || this.layer.lineSymbol ? s.geometryType !== "point" || this.layer.pointSymbol || (this.layer.pointSymbol = c.symbol) : this.layer.lineSymbol = c.symbol : this.layer.polygonSymbol = c.symbol, this.graphicsViews.push(h), this.container.addChild(h.container); + } + }, jo), Qi(() => this.layer?.polygonSymbol, (e) => { + this._graphicsViewMap.polygon.renderer = new Z_({ symbol: e }); + }, jo), Qi(() => this.layer?.lineSymbol, (e) => { + this._graphicsViewMap.polyline.renderer = new Z_({ symbol: e }); + }, jo), Qi(() => this.layer?.pointSymbol, (e) => { + this._graphicsViewMap.point.renderer = new Z_({ symbol: e }); + }, jo)]); + } + detach() { + this._clear(); + } + moveStart() { + } + moveEnd() { + } + viewChange() { + for (const e of this.graphicsViews) + e.viewChange(); + } + _clear() { + this.container.removeAllChildren(); + for (const e of this.graphicsViews) + e.destroy(); + this._graphicsViewMap = {}, this._popupTemplates.clear(), this.graphicsViews.length = 0; + } +}; +EDe = E([dt("esri.views.2d.layers.GeoRSSLayerView2D")], EDe); +const Lhr = EDe, Nhr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Lhr +}, Symbol.toStringTag, { value: "Module" })), khr = { remove() { +}, pause() { +}, resume() { +} }; +let Mce = class extends ky($y) { + constructor() { + super(...arguments), this._highlightIds = /* @__PURE__ */ new Map(); + } + attach() { + this.graphicsView = new _x({ requestUpdateCallback: () => this.requestUpdate(), view: this.view, graphics: this.layer.graphics, container: new $O(this.view.featuresTilingScheme) }), this._updateHighlight(), this.container.addChild(this.graphicsView.container), this.addAttachHandles(this.layer.on("graphic-update", this.graphicsView.graphicUpdateHandler)); + } + detach() { + this.container.removeAllChildren(), this.graphicsView = la(this.graphicsView); + } + async hitTest(e) { + return this.graphicsView ? this.graphicsView.hitTest(e).map((i) => ({ type: "graphic", graphic: i, mapPoint: e, layer: this.layer })) : null; + } + async fetchPopupFeatures(e) { + return this.graphicsView ? this.graphicsView.hitTest(e).filter((i) => !!i.popupTemplate) : []; + } + queryGraphics() { + return Promise.resolve(this.graphicsView.graphics); + } + update(e) { + this.graphicsView.processUpdate(e); + } + moveStart() { + } + viewChange() { + this.graphicsView.viewChange(); + } + moveEnd() { + } + isUpdating() { + return !this.graphicsView || this.graphicsView.updating; + } + highlight(e) { + let i; + typeof e == "number" ? i = [e] : e instanceof ro ? i = [e.uid] : Array.isArray(e) && e.length > 0 ? i = typeof e[0] == "number" ? e : e.map((n) => n && n.uid) : gr.isCollection(e) && e.length > 0 && (i = e.map((n) => n && n.uid).toArray()); + const r = i?.filter(_e); + return r?.length ? (this._addHighlight(r), { remove: () => this._removeHighlight(r) }) : khr; + } + _addHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i); + this._highlightIds.set(i, r + 1); + } else + this._highlightIds.set(i, 1); + this._updateHighlight(); + } + _removeHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i) - 1; + r === 0 ? this._highlightIds.delete(i) : this._highlightIds.set(i, r); + } + this._updateHighlight(); + } + _updateHighlight() { + this.graphicsView?.setHighlight(Array.from(this._highlightIds.keys())); + } +}; +E([N()], Mce.prototype, "graphicsView", void 0), Mce = E([dt("esri.views.2d.layers.GraphicsLayerView2D")], Mce); +const $hr = Mce, Bhr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: $hr +}, Symbol.toStringTag, { value: "Module" })); +let mFt = class extends hH { + constructor() { + super(...arguments), this._prevFBO = void 0, this.requiresDedicatedFBO = !1; + } + dispose() { + } + doRender(e) { + const i = this.createRenderParams(e), { context: r, painter: n, profiler: s } = i; + this._prevFBO = r.getBoundFramebufferObject(), s.recordContainerStart(this.name); + const o = this._getFbo(i), a = n.getRenderTarget(); + r.bindFramebuffer(o), n.setRenderTarget(o), r.setDepthWriteEnabled(!0), r.setColorMask(!0, !0, !0, !0), r.setClearColor(0, 0, 0, 0), r.setClearDepth(1), r.clear(r.gl.COLOR_BUFFER_BIT | r.gl.DEPTH_BUFFER_BIT), r.setDepthWriteEnabled(!1); + for (const l of this.children) + l.beforeRender(e); + for (const l of this.children) + l.processRender(i); + for (const l of this.children) + l.afterRender(e); + n.setRenderTarget(a), n.releaseFbo(o), r.bindFramebuffer(this._prevFBO), n.beforeRenderLayer(i, this._clippingInfos ? 255 : 0, this.computedOpacity), o.colorTexture && (r.setStencilTestEnabled(!1), r.setStencilWriteMask(0), n.blitTexture(r, o.colorTexture, _n.NEAREST)), n.compositeLayer(i, this.computedOpacity), s.recordContainerEnd(); + } + createRenderParams(e) { + return { ...super.createRenderParams(e), blendMode: this.blendMode, effects: this.computedEffects, globalOpacity: 1 }; + } + _getFbo(e) { + const { context: i, painter: r } = e, { width: n, height: s } = i.getViewport(); + return r.acquireFbo(n, s); + } +}, cj = class extends $y { + constructor(e) { + super(e), this.type = "group", this.layerViews = new gr(); + } + _allLayerViewVisibility(e) { + this.layerViews.forEach((i) => { + i.visible = e; + }); + } + initialize() { + this.handles.add([this.layerViews.on("change", (e) => this._layerViewsChangeHandler(e)), Qi(() => this.layer.visibilityMode, () => this._applyVisibility(() => this._allLayerViewVisibility(this.visible), () => this._applyExclusiveVisibility(null)), Uu), Qi(() => this.visible, (e) => { + this._applyVisibility(() => this._allLayerViewVisibility(e), () => { + }); + }, Uu)], "grouplayerview"), this._layerViewsChangeHandler({ target: null, added: this.layerViews.toArray(), removed: [], moved: [] }); + } + set layerViews(e) { + this._set("layerViews", $g(e, this._get("layerViews"))); + } + get updatingProgress() { + return this.layerViews.length === 0 ? 1 : this.layerViews.reduce((e, i) => e + i.updatingProgress, 0) / this.layerViews.length; + } + isUpdating() { + return this.layerViews.some((e) => e.updating); + } + _hasLayerViewVisibleOverrides() { + return this.layerViews.some((e) => e._isOverridden("visible")); + } + _findLayerViewForLayer(e) { + return e && this.layerViews.find((i) => i.layer === e); + } + _firstVisibleOnLayerOrder() { + const e = this.layer.layers.find((i) => !!this._findLayerViewForLayer(i)?.visible); + return e && this._findLayerViewForLayer(e); + } + _applyExclusiveVisibility(e) { + ut(e) && (e = this._firstVisibleOnLayerOrder(), ut(e) && this.layerViews.length > 0 && (e = this._findLayerViewForLayer(this.layer.layers.getItemAt(0)))), this.layerViews.forEach((i) => { + i.visible = i === e; + }); + } + _layerViewsChangeHandler(e) { + this.handles.remove("grouplayerview:visible"), this.handles.add(this.layerViews.map((r) => Qi(() => r.visible, (n) => this._applyVisibility(() => { + n !== this.visible && (r.visible = this.visible); + }, () => this._applyExclusiveVisibility(n ? r : null)), Uu)).toArray(), "grouplayerview:visible"); + const i = e.added[e.added.length - 1]; + this._applyVisibility(() => this._allLayerViewVisibility(this.visible), () => this._applyExclusiveVisibility(i?.visible ? i : null)); + } + _applyVisibility(e, i) { + this._hasLayerViewVisibleOverrides() && (this.layer?.visibilityMode === "inherited" ? e() : this.layer?.visibilityMode === "exclusive" && i()); + } +}; +E([N({ cast: fz })], cj.prototype, "layerViews", null), E([N({ readOnly: !0 })], cj.prototype, "updatingProgress", null), E([N()], cj.prototype, "view", void 0), cj = E([dt("esri.views.layers.GroupLayerView")], cj); +const Vhr = cj; +let IDe = class extends ky(Vhr) { + constructor() { + super(...arguments), this.container = new mFt(); + } + attach() { + this._updateStageChildren(), this.addAttachHandles(this.layerViews.on("after-changes", () => this._updateStageChildren())); + } + detach() { + this.container.removeAllChildren(); + } + update(e) { + } + moveStart() { + } + viewChange() { + } + moveEnd() { + } + _updateStageChildren() { + this.container.removeAllChildren(), this.layerViews.forEach((e, i) => this.container.addChildAt(e.container, i)); + } +}; +IDe = E([dt("esri.views.2d.layers.GroupLayerView2D")], IDe); +const jhr = IDe, Ghr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: jhr +}, Symbol.toStringTag, { value: "Module" })); +function Uhr(t) { + const e = gFt(ADe(t)), i = e, r = !0, n = Math.max(e / 2, 5), s = Math.round(dn(t.maxPathLength) / n) + 1, o = 10, { density: a } = t; + return { smoothing: dn(t.smoothing), interpolate: !0, velocityScale: t.flowRepresentation === "flow-from" ? 1 : -1, verticesPerLine: s, minSpeedThreshold: 1e-3, segmentLength: n, maxTurnAngle: 1, collisions: r, lineCollisionWidth: i, lineSpacing: o, density: a }; +} +function gFt(t) { + return t.kind === "constant" ? t.value[0] : t.values[t.values.length - 1]; +} +function Hst(t) { + const e = t.toRgba(); + return [e[0] / 255, e[1] / 255, e[2] / 255, e[3]]; +} +function zhr(t) { + return { kind: "constant", value: [0.1, 0.1, 0.1, 1] }; +} +function ADe(t) { + if (!t.hasVisualVariables("size")) + return { kind: "constant", value: [dn(t.trailWidth)] }; + const e = t.getVisualVariablesForType("size")[0], i = [], r = []; + let n; + if (e.stops) { + for (const s of e.stops) + i.push(s.value), r.push(dn(s.size)); + n = e.stops.length; + } else + i.push(e.minDataValue, e.maxDataValue), r.push(dn(e.minSize), dn(e.maxSize)), n = 2; + return { kind: "ramp", stops: i, values: r, count: n }; +} +function Hhr(t) { + if (!t.hasVisualVariables("color")) + return { kind: "constant", value: Hst(t.color) }; + const e = t.getVisualVariablesForType("color")[0], i = [], r = []; + for (const n of e.stops) + i.push(n.value), Array.prototype.push.apply(r, Hst(n.color)); + return { kind: "ramp", stops: i, values: r, count: e.stops.length }; +} +function Whr(t) { + if (!t.hasVisualVariables("opacity")) + return { kind: "constant", value: [1] }; + const e = t.getVisualVariablesForType("opacity")[0], i = [], r = []; + for (const n of e.stops) + i.push(n.value), r.push(n.opacity); + return { kind: "ramp", stops: i, values: r, count: e.stops.length }; +} +function $2e(t, e, i, r) { + switch (e) { + case "int": + t.setUniform1iv(i, r); + break; + case "float": + t.setUniform1fv(i, r); + break; + case "vec2": + t.setUniform2fv(i, r); + break; + case "vec3": + t.setUniform3fv(i, r); + break; + case "vec4": + t.setUniform4fv(i, r); + } +} +function wF(t, e, i, r) { + r.kind === "constant" ? $2e(t, i, `u_${e}`, r.value) : ($2e(t, "float", `u_${e}_stops`, r.stops), $2e(t, i, `u_${e}_values`, r.values), t.setUniform1i(`u_${e}_count`, r.count)); +} +function qhr(t, e) { + let i = !0; + return i = i && t.collisions === e.collisions, i = i && t.density === e.density, i = i && t.interpolate === e.interpolate, i = i && t.lineCollisionWidth === e.lineCollisionWidth, i = i && t.lineSpacing === e.lineSpacing, i = i && t.maxTurnAngle === e.maxTurnAngle, i = i && t.minSpeedThreshold === e.minSpeedThreshold, i = i && t.segmentLength === e.segmentLength, i = i && t.smoothing === e.smoothing, i = i && t.velocityScale === e.velocityScale, i = i && t.verticesPerLine === e.verticesPerLine, i; +} +function yFt(t, e) { + return t === e || !(!_e(t) || !_e(e)) && t.equals(e); +} +function vFt(t, e) { + if (!qhr(t.simulationSettings, e.simulationSettings) || !yFt(t.timeExtent, e.timeExtent)) + return !1; + let i = !0; + return i = i && t.loadImagery === e.loadImagery, i = i && t.createFlowMesh === e.createFlowMesh, i = i && t.color.kind === e.color.kind, i = i && t.opacity.kind === e.opacity.kind, i = i && t.size.kind === e.size.kind, i; +} +let Yhr = class _Ft { + constructor(e) { + this._params = e, this.animated = !1; + } + isCompatible(e) { + if (!(e instanceof _Ft) || !yFt(this._params.timeExtent, e._params.timeExtent)) + return !1; + let i = !0; + return i = i && this._params.loadImagery === e._params.loadImagery, i = i && this._params.color.kind === e._params.color.kind, i = i && this._params.opacity.kind === e._params.opacity.kind, i; + } + async load(e, i) { + const { extent: r, size: n } = e; + hn(i); + const s = await this._params.loadImagery(r, n[0], n[1], this._params.timeExtent, i); + return new Jhr(s, { color: this._params.color, opacity: this._params.opacity }); + } + render(e, i, r) { + const { context: n } = e, { program: s } = r; + n.setFaceCullingEnabled(!1), n.setBlendingEnabled(!0), n.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), n.useProgram(s), s.setUniformMatrix3fv("u_dvsMat3", i.dvsMat3), n.bindTexture(r.texture, 0), s.setUniform1i("u_texture", 0), s.setUniform1f("u_Min", r.min), s.setUniform1f("u_Max", r.max), wF(s, "color", "vec4", this._params.color), wF(s, "opacity", "float", this._params.opacity), n.bindVAO(r.vertexArray), n.drawArrays(ps.TRIANGLE_STRIP, 0, 4); + } +}; +const hme = /* @__PURE__ */ new Map(); +hme.set("a_position", 0), hme.set("a_texcoord", 1); +const Xhr = { geometry: [new ea("a_position", 2, Fi.UNSIGNED_SHORT, 0, 8), new ea("a_texcoord", 2, Fi.UNSIGNED_SHORT, 4, 8)] }, Khr = { vsPath: "raster/flow/imagery", fsPath: "raster/flow/imagery", attributes: hme }; +let Jhr = class { + constructor(e, i) { + this._flowData = e, this._values = i; + } + attach(e) { + const { context: i } = e, { width: r, height: n } = this._flowData, s = Qo.createVertex(i, Vo.STATIC_DRAW, new Uint16Array([0, 0, 0, 1, r, 0, 1, 1, 0, n, 0, 0, r, n, 1, 0])), o = new Ac(i, hme, Xhr, { geometry: s }), a = []; + this._values.color.kind === "ramp" && a.push("vvColor"), this._values.opacity.kind === "ramp" && a.push("vvOpacity"); + const l = e.painter.materialManager.getProgram(Khr, a); + let c = 1e6, h = -1e6; + for (let v = 0; v < n; v++) + for (let x = 0; x < r; x++) + if (this._flowData.mask[v * r + x] !== 0) { + const I = this._flowData.data[2 * (v * r + x) + 0], P = this._flowData.data[2 * (v * r + x) + 1], F = Math.sqrt(I * I + P * P); + c = Math.min(c, F), h = Math.max(h, F); + } + const p = new Uint8Array(4 * r * n); + for (let v = 0; v < n; v++) + for (let x = 0; x < r; x++) + if (this._flowData.mask[v * r + x] !== 0) { + const I = this._flowData.data[2 * (v * r + x) + 0], P = this._flowData.data[2 * (v * r + x) + 1], F = (Math.sqrt(I * I + P * P) - c) / (h - c); + p[4 * (v * r + x) + 0] = 255 * F, p[4 * (v * r + x) + 1] = 0, p[4 * (v * r + x) + 2] = 0, p[4 * (v * r + x) + 3] = 255; + } else + p[4 * (v * r + x) + 0] = 0, p[4 * (v * r + x) + 1] = 0, p[4 * (v * r + x) + 2] = 0, p[4 * (v * r + x) + 3] = 0; + const y = new Ts(i, { pixelFormat: cn.RGBA, internalFormat: cn.RGBA, samplingMode: _n.LINEAR, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, flipped: !0, width: r, height: n }, p); + this.vertexArray = o, this.program = l, this.texture = y, this.min = c, this.max = h, this._flowData = null; + } + detach() { + this.vertexArray.dispose(), this.texture.dispose(); + } + get ready() { + return this.program.compiled; + } +}, Zhr = class bFt { + constructor(e) { + this._params = e; + } + get animated() { + return this._params.flowSpeed > 0; + } + isCompatible(e) { + return e instanceof bFt && vFt(this._params, e._params); + } + async load(e, i) { + const { extent: r, size: n } = e; + hn(i); + const s = await this._params.loadImagery(r, n[0], n[1], this._params.timeExtent, i), { vertexData: o, indexData: a } = await this._params.createFlowMesh("Particles", this._params.simulationSettings, s, i); + return new tdr(o, a, { color: this._params.color, opacity: this._params.opacity, size: this._params.size }); + } + render(e, i, r) { + const { context: n } = e, { program: s } = r; + n.setFaceCullingEnabled(!1), n.setBlendingEnabled(!0), n.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), n.useProgram(s), s.setUniform1f("u_time", i.time), s.setUniform1f("u_trailLength", this._params.trailLength), s.setUniform1f("u_flowSpeed", this._params.flowSpeed), s.setUniform1f("u_featheringSize", this._params.featheringSize), s.setUniform1f("u_featheringOffset", this._params.featheringOffset), s.setUniform1f("u_introFade", this._params.introFade ? 1 : 0), s.setUniform1f("u_fadeToZero", this._params.fadeToZero ? 1 : 0), s.setUniform1f("u_decayRate", this._params.decayRate), s.setUniformMatrix3fv("u_dvsMat3", i.dvsMat3), s.setUniformMatrix3fv("u_displayViewMat3", i.displayViewMat3), wF(s, "color", "vec4", this._params.color), wF(s, "opacity", "float", this._params.opacity), wF(s, "size", "float", this._params.size), n.bindVAO(r.vertexArray), n.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, 0); + } +}; +const EG = /* @__PURE__ */ new Map(); +EG.set("a_xyts0", 0), EG.set("a_xyts1", 1), EG.set("a_typeIdDurationSeed", 2), EG.set("a_extrudeInfo", 3); +const Qhr = { geometry: [new ea("a_xyts0", 4, Fi.FLOAT, 0, 64), new ea("a_xyts1", 4, Fi.FLOAT, 16, 64), new ea("a_typeIdDurationSeed", 4, Fi.FLOAT, 32, 64), new ea("a_extrudeInfo", 4, Fi.FLOAT, 48, 64)] }, edr = { vsPath: "raster/flow/particles", fsPath: "raster/flow/particles", attributes: EG }; +let tdr = class { + constructor(e, i, r) { + this._vertexData = e, this._indexData = i, this._values = r; + } + attach(e) { + const { context: i } = e, r = Qo.createVertex(i, Vo.STATIC_DRAW, this._vertexData), n = Qo.createIndex(i, Vo.STATIC_DRAW, this._indexData), s = new Ac(i, EG, Qhr, { geometry: r }, n), o = []; + this._values.color.kind === "ramp" && o.push("vvColor"), this._values.opacity.kind === "ramp" && o.push("vvOpacity"), this._values.size.kind === "ramp" && o.push("vvSize"); + const a = e.painter.materialManager.getProgram(edr, o); + this.vertexArray = s, this.program = a, this.indexCount = this._indexData.length, this._vertexData = null, this._indexData = null; + } + detach() { + this.vertexArray.dispose(); + } + get ready() { + return this.program.compiled; + } +}, idr = class wFt { + constructor(e) { + this._styles = e; + } + get animated() { + return this._styles.reduce((e, i) => e || i.animated, !1); + } + isCompatible(e) { + if (!(e instanceof wFt) || this._styles.length !== e._styles.length) + return !1; + const i = this._styles.length; + for (let r = 0; r < i; r++) + if (!this._styles[r].isCompatible(e._styles[r])) + return !1; + return !0; + } + async load(e, i) { + const r = await Promise.all(this._styles.map((n) => n.load(e, i))); + return new rdr(r); + } + render(e, i, r) { + for (let n = 0; n < this._styles.length; n++) + this._styles[n].render(e, i, r.resources[n]); + } +}, rdr = class { + constructor(e) { + this.resources = e; + } + attach(e) { + for (const i of this.resources) + i.attach(e); + } + detach() { + for (const e of this.resources) + e.detach(); + } + get ready() { + return this.resources.reduce((e, i) => e && i.ready, !0); + } +}, ndr = class xFt { + constructor(e) { + this._params = e; + } + get animated() { + return this._params.flowSpeed > 0; + } + isCompatible(e) { + return e instanceof xFt && vFt(this._params, e._params); + } + async load(e, i) { + const { extent: r, size: n } = e; + hn(i); + const s = await this._params.loadImagery(r, n[0], n[1], this._params.timeExtent, i), { vertexData: o, indexData: a } = await this._params.createFlowMesh("Streamlines", this._params.simulationSettings, s, i); + return new adr(o, a, { color: this._params.color, opacity: this._params.opacity, size: this._params.size }); + } + render(e, i, r) { + const { context: n } = e, { program: s } = r; + n.setFaceCullingEnabled(!1), n.setBlendingEnabled(!0), n.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), n.useProgram(s), s.setUniform1f("u_time", i.time), s.setUniform1f("u_trailLength", this._params.trailLength), s.setUniform1f("u_flowSpeed", this._params.flowSpeed), s.setUniform1f("u_featheringSize", this._params.featheringSize), s.setUniform1f("u_featheringOffset", this._params.featheringOffset), s.setUniform1f("u_introFade", this._params.introFade ? 1 : 0), s.setUniform1f("u_fadeToZero", this._params.fadeToZero ? 1 : 0), s.setUniform1f("u_decayRate", this._params.decayRate), s.setUniformMatrix3fv("u_dvsMat3", i.dvsMat3), s.setUniformMatrix3fv("u_displayViewMat3", i.displayViewMat3), wF(s, "color", "vec4", this._params.color), wF(s, "opacity", "float", this._params.opacity), wF(s, "size", "float", this._params.size), n.bindVAO(r.vertexArray), n.drawElements(ps.TRIANGLES, r.indexCount, Fi.UNSIGNED_INT, 0); + } +}; +const IG = /* @__PURE__ */ new Map(); +IG.set("a_positionAndSide", 0), IG.set("a_timeInfo", 1), IG.set("a_extrude", 2), IG.set("a_speed", 3); +const sdr = { geometry: [new ea("a_positionAndSide", 3, Fi.FLOAT, 0, 36), new ea("a_timeInfo", 3, Fi.FLOAT, 12, 36), new ea("a_extrude", 2, Fi.FLOAT, 24, 36), new ea("a_speed", 1, Fi.FLOAT, 32, 36)] }, odr = { vsPath: "raster/flow/streamlines", fsPath: "raster/flow/streamlines", attributes: IG }; +let adr = class { + constructor(e, i, r) { + this._vertexData = e, this._indexData = i, this._values = r; + } + attach(e) { + const { context: i } = e, r = Qo.createVertex(i, Vo.STATIC_DRAW, this._vertexData), n = Qo.createIndex(i, Vo.STATIC_DRAW, this._indexData), s = new Ac(i, IG, sdr, { geometry: r }, n), o = []; + this._values.color.kind === "ramp" && o.push("vvColor"), this._values.opacity.kind === "ramp" && o.push("vvOpacity"), this._values.size.kind === "ramp" && o.push("vvSize"); + const a = e.painter.materialManager.getProgram(odr, o); + this.vertexArray = s, this.program = a, this.indexCount = this._indexData.length, this._vertexData = null, this._indexData = null; + } + detach() { + this.vertexArray.dispose(); + } + get ready() { + return this.program.compiled; + } +}; +const ldr = 4, udr = 1, cdr = 0.5, hdr = !0, ddr = !0, pdr = 2.3; +function fdr(t, e) { + const { flowSpeed: i, trailLength: r } = t, n = Uhr(t); + let s = null; + const o = { opacity: Whr(t), size: ADe(t) }; + let a = Hhr(t); + if (t.background === "none") + o.color = a; + else { + a.kind === "constant" && (a = { kind: "ramp", stops: [0, 1], values: [0, 0, 0, 1, a.value[0], a.value[1], a.value[2], a.value[3]], count: 2 }); + const h = { loadImagery: e.loadImagery, timeExtent: e.timeExtent, color: a, opacity: { kind: "constant", value: [1] } }; + s = new Yhr(h), o.color = zhr(); + } + const l = { loadImagery: e.loadImagery, createFlowMesh: e.createFlowMesh, simulationSettings: n, timeExtent: e.timeExtent, trailLength: r, flowSpeed: i, featheringSize: udr, featheringOffset: cdr, introFade: hdr, fadeToZero: ddr, decayRate: pdr, color: o.color, opacity: o.opacity, size: o.size }, c = t.trailCap === "butt" || gFt(ADe(t)) <= ldr ? new ndr(l) : new Zhr(l); + return _e(s) ? new idr([s, c]) : c; +} +let mdr = class extends A1 { + constructor() { + super(...arguments), this._visualState = { time: 0, dvsMat3: Ml(), displayViewMat3: Ml() }; + } + dispose() { + } + prepareState(e) { + const { context: i } = e; + i.setColorMask(!0, !0, !0, !0), i.setStencilFunction(Ll.EQUAL, 0, 255); + } + draw(e, i) { + const { requestRender: r, allowDelayedRender: n } = e, { displayData: s } = i; + if (ut(s) || (s.state.name === "loaded" && s.attach(e), s.state.name !== "attached")) + return; + const o = s.state.resources; + n && !o.ready && _e(r) ? r() : (this._visualState.time = e.time / 1e3, this._visualState.dvsMat3 = i.transforms.dvs, this._visualState.displayViewMat3 = e.state.displayViewMat3, s.flowStyle.render(e, this._visualState, o), s.flowStyle.animated && _e(r) && r()); + } +}, gdr = class extends hH { + constructor() { + super(...arguments), this.flowStyle = null; + } + get requiresDedicatedFBO() { + return !1; + } + doRender(e) { + super.doRender(e); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "flow", brushes: [mdr], target: () => this.children, drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } +}, ydr = class { + constructor(e, i, r, n) { + this.state = { name: "created" }, this.flowStyle = e, this.extent = i, this.size = r, this.pixelRatio = n; + } + async load() { + const e = new AbortController(); + this.state = { name: "loading", abortController: e }; + const i = { extent: this.extent, size: this.size, pixelRatio: this.pixelRatio }, r = await this.flowStyle.load(i, e.signal); + this.state = { name: "loaded", resources: r }; + } + attach(e) { + if (this.state.name !== "loaded") + return void Ei.getLogger("esri.views.2d.engine.flow.FlowDisplayData").error("Only loaded resources can be attached."); + const i = this.state.resources; + i.attach(e), this.state = { name: "attached", resources: i }; + } + detach() { + if (this.state.name === "loading") + return this.state.abortController.abort(), void (this.state = { name: "detached" }); + this.state.name === "attached" && (this.state.resources.detach(), this.state = { name: "detached" }); + } + update(e) { + return this.flowStyle.isCompatible(e.flowStyle) ? !(!this.extent.equals(e.extent) || this.size[0] !== e.size[0] || this.size[1] !== e.size[1] || this.pixelRatio !== e.pixelRatio) && (this.flowStyle = e.flowStyle, !0) : !1; + } +}, vdr = class extends pC { + constructor() { + super(...arguments), this._displayData = null; + } + get displayData() { + return this._displayData; + } + set displayData(e) { + this._displayData = e, this.requestRender(); + } + clear() { + _e(this._displayData) && (this._displayData.detach(), this._displayData = null, this.requestRender()); + } + setTransform(e) { + const { displayData: i } = this; + if (ut(i)) + return; + const r = i.extent.xmin, n = i.extent.ymax, s = [0, 0]; + e.toScreen(s, [r, n]); + const o = (i.extent.xmax - i.extent.xmin) / i.size[0] / e.resolution, a = ex(e.rotation), { dvs: l } = this.transforms; + zNe(l, [-1, 1, 0]), KO(l, l, [2 / (e.size[0] * e.pixelRatio), -2 / (e.size[1] * e.pixelRatio), 1]), Ng(l, l, [s[0], s[1], 0]), BI(l, l, a), KO(l, l, [o * e.pixelRatio, o * e.pixelRatio, 1]); + } + _createTransforms() { + return { dvs: Ml() }; + } +}; +const _dr = 1.15; +let hj = class extends vn { + constructor(e) { + super(e), this._flowDisplayObject = new vdr(), this._loading = null; + } + initialize() { + this.flowContainer.addChild(this._flowDisplayObject); + } + destroy() { + this._clear(), this.flowContainer.removeAllChildren(); + } + get updating() { + return this._loading != null; + } + update(e) { + const { flowStyle: i } = this.flowContainer; + if (ut(i)) + return void this._clear(); + const { extent: r, rotation: n, resolution: s, pixelRatio: o } = e.state, a = wdr(r, n); + a.expand(_dr); + const l = [Math.round((a.xmax - a.xmin) / s), Math.round((a.ymax - a.ymin) / s)], c = new ydr(i, a, l, o); + if (_e(this._loading)) { + if (this._loading.update(c)) + return; + this._loading.detach(), this._loading = null; + } + !ut(this._flowDisplayObject.displayData) && this._flowDisplayObject.displayData.update(c) || (c.load().then(() => { + this._flowDisplayObject.clear(), this._flowDisplayObject.displayData = this._loading, this._loading = null; + }, (h) => { + us(h) || (Ei.getLogger(this.declaredClass).error("A resource failed to load.", h), this._loading = null); + }), this._loading = c); + } + _clear() { + this._flowDisplayObject.clear(), _e(this._loading) && (this._loading.detach(), this._loading = null); + } +}; +E([N()], hj.prototype, "_loading", void 0), E([N()], hj.prototype, "flowContainer", void 0), E([N()], hj.prototype, "updating", null), hj = E([dt("esri.views.2d.engine.flow.FlowStrategy")], hj); +const bdr = hj; +function wdr(t, e) { + const i = new Xi({ x: (t.xmax + t.xmin) / 2, y: (t.ymax + t.ymin) / 2, spatialReference: t.spatialReference }), r = t.xmax - t.xmin, n = t.ymax - t.ymin, s = Math.abs(Math.cos(ex(e))), o = Math.abs(Math.sin(ex(e))), a = s * r + o * n, l = o * r + s * n, c = new br({ xmin: i.x - a / 2, ymin: i.y - l / 2, xmax: i.x + a / 2, ymax: i.y + l / 2, spatialReference: t.spatialReference }); + return c.centerAt(i), c; +} +let W2 = class extends vn { + constructor() { + super(...arguments), this._loadImagery = (e, i, r, n, s) => JUe(this.layer, e, i, r, n, s), this._createFlowMesh = (e, i, r, n) => this.layer.createFlowMesh({ meshType: e, flowData: r, simulationSettings: i }, { signal: n }), this.attached = !1, this.type = "flow", this.timeExtent = null, this.redrawOrRefetch = async () => { + this._updateVisualization(); + }; + } + get updating() { + return !this.attached || this._strategy.updating; + } + attach() { + const { layer: e } = this, i = () => { + this._loadImagery = (r, n, s, o, a) => JUe(e, r, n, s, o, a), this._updateVisualization(); + }; + "multidimensionalDefinition" in e ? this.addHandles(Qi(() => e.multidimensionalDefinition, i)) : this.addHandles([Qi(() => e.mosaicRule, i), Qi(() => e.renderingRule, i), Qi(() => e.definitionExpression, i)]), this.container = new gdr(), this._strategy = new bdr({ flowContainer: this.container }), this._updateVisualization(); + } + detach() { + this._strategy.destroy(), this.container?.removeAllChildren(), this.container = null, this.removeHandles(); + } + update(e) { + e.stationary ? this._strategy.update(e) : this.layerView.requestUpdate(); + } + hitTest(e) { + return new ro({ attributes: {}, geometry: e.clone(), layer: this.layer }); + } + moveEnd() { + } + async doRefresh() { + } + _updateVisualization() { + const e = this.layer.renderer; + if (e == null || e.type !== "flow") + return; + const i = fdr(e, { loadImagery: this._loadImagery, createFlowMesh: this._createFlowMesh, timeExtent: this.timeExtent }); + this.container.flowStyle = i, this.layerView.requestUpdate(); + } +}; +E([N()], W2.prototype, "_strategy", void 0), E([N()], W2.prototype, "attached", void 0), E([N()], W2.prototype, "container", void 0), E([N()], W2.prototype, "layer", void 0), E([N()], W2.prototype, "layerView", void 0), E([N()], W2.prototype, "type", void 0), E([N()], W2.prototype, "updating", null), E([N()], W2.prototype, "timeExtent", void 0), W2 = E([dt("esri.views.2d.engine.flow.FlowView2D")], W2); +const SFt = W2; +let Mw = class extends vn { + constructor() { + super(...arguments), this.attached = !1, this.container = new rz(), this.updateRequested = !1, this.type = "imagery", this._bitmapView = new sz(); + } + destroy() { + this.attached && (this.detach(), this.attached = !1), this.updateRequested = !1; + } + get updating() { + return !this.attached || this.isUpdating(); + } + update(e) { + this.strategy.update(e).catch((i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + }); + } + hitTest(e) { + return new ro({ attributes: {}, geometry: e.clone(), layer: this.layer }); + } + attach() { + this.container.addChild(this._bitmapView); + const e = this.layer.version >= 10, i = this.layer.version >= 10.1 ? this.layer.imageMaxHeight : 2048, r = this.layer.version >= 10.1 ? this.layer.imageMaxWidth : 2048; + this.strategy = new Hve({ container: this._bitmapView, imageNormalizationSupported: e, imageMaxHeight: i, imageMaxWidth: r, fetchSource: this._fetchImage.bind(this), requestUpdate: () => this.requestUpdate() }); + } + detach() { + this.strategy.destroy(), this._bitmapView.removeAllChildren(), this.container.removeAllChildren(), this.updateRequested = !1; + } + redraw() { + this.strategy.updateExports(async (e) => { + const { source: i } = e; + if (!i || i instanceof ImageBitmap) + return; + const r = await this.layer.applyRenderer({ extent: i.extent, pixelBlock: i.originalPixelBlock ?? i.pixelBlock }); + i.filter = (n) => this.layer.pixelFilter ? this.layer.applyFilter(n) : { ...r, extent: i.extent }; + }).catch((e) => { + us(e) || Ei.getLogger(this.declaredClass).error(e); + }); + } + requestUpdate() { + this.updateRequested || (this.updateRequested = !0, this.view.requestUpdate()); + } + isUpdating() { + return this.strategy.updating || this.updateRequested; + } + getPixelData() { + if (this.updating) + return null; + const e = this.strategy.bitmaps; + if (e.length === 1 && e[0].source) + return { extent: e[0].source.extent, pixelBlock: e[0].source.originalPixelBlock }; + if (e.length > 1) { + const i = this.view.extent, r = e.map((s) => s.source).filter((s) => s.extent && s.extent.intersects(i)).map((s) => ({ extent: s.extent, pixelBlock: s.originalPixelBlock })), n = LJt(r, i); + return _e(n) ? { extent: n.extent, pixelBlock: n.pixelBlock } : null; + } + return null; + } + async _fetchImage(e, i, r, n) { + (n = n || {}).timeExtent = this.timeExtent, n.requestAsImageElement = !0, n.returnImageBitmap = !0; + const s = await this.layer.fetchImage(e, i, r, n); + if (s.imageBitmap) + return s.imageBitmap; + const o = await this.layer.applyRenderer(s.pixelData, { signal: n.signal }), a = new aFt(o.pixelBlock, o.extent?.clone(), s.pixelData.pixelBlock); + return a.filter = (l) => this.layer.applyFilter(l), a; + } +}; +E([N()], Mw.prototype, "attached", void 0), E([N()], Mw.prototype, "container", void 0), E([N()], Mw.prototype, "layer", void 0), E([N()], Mw.prototype, "strategy", void 0), E([N()], Mw.prototype, "timeExtent", void 0), E([N()], Mw.prototype, "view", void 0), E([N()], Mw.prototype, "updateRequested", void 0), E([N()], Mw.prototype, "updating", null), E([N()], Mw.prototype, "type", void 0), Mw = E([dt("esri.views.2d.layers.imagery.ImageryView2D")], Mw); +const xdr = Mw, wae = new Float32Array([0.27058823529411763, 0.4588235294117647, 0.7098039215686275, 1, 0.396078431372549, 0.5372549019607843, 0.7215686274509804, 1, 0.5176470588235295, 0.6196078431372549, 0.7294117647058823, 1, 0.6352941176470588, 0.7058823529411765, 0.7411764705882353, 1, 0.7529411764705882, 0.8, 0.7450980392156863, 1, 0.8705882352941177, 0.8901960784313725, 0.7490196078431373, 1, 1, 1, 0.7490196078431373, 1, 1, 0.8627450980392157, 0.6313725490196078, 1, 0.9803921568627451, 0.7254901960784313, 0.5176470588235295, 1, 0.9607843137254902, 0.596078431372549, 0.4117647058823529, 1, 0.9294117647058824, 0.4588235294117647, 0.3176470588235294, 1, 0.9098039215686274, 0.08235294117647059, 0.08235294117647059, 1]), Wst = { beaufort_ft: wae, beaufort_m: wae, beaufort_km: wae, beaufort_mi: wae, beaufort_kn: new Float32Array([0.1568627450980392, 0.5725490196078431, 0.7803921568627451, 1, 0.34901960784313724, 0.6352941176470588, 0.7294117647058823, 1, 0.5058823529411764, 0.7019607843137254, 0.6705882352941176, 1, 0.6274509803921569, 0.7607843137254902, 0.6078431372549019, 1, 0.7490196078431373, 0.8313725490196079, 0.5411764705882353, 1, 0.8549019607843137, 0.9019607843137255, 0.4666666666666667, 1, 0.9803921568627451, 0.9803921568627451, 0.39215686274509803, 1, 0.9882352941176471, 0.8352941176470589, 0.3254901960784314, 1, 0.9882352941176471, 0.7019607843137254, 0.4, 1, 0.9803921568627451, 0.5529411764705883, 0.20392156862745098, 1, 0.9686274509803922, 0.43137254901960786, 0.16470588235294117, 1, 0.9411764705882353, 0.2784313725490196, 0.11372549019607843, 1]), classified_arrow: new Float32Array([0.2196078431372549, 0.6588235294117647, 0, 1, 0.5450980392156862, 1.2117647058823529, 0, 1, 1, 1, 0, 1, 1, 0.5019607843137255, 0, 1, 1, 0, 0, 1]), ocean_current_m: new Float32Array([0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), ocean_current_kn: new Float32Array([0, 0, 0, 1, 0, 0.1450980392156863, 0.39215686274509803, 1, 0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.592156862745098, 0, 0.39215686274509803, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.6941176470588235, 0.3058823529411765, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.7019607843137254, 0.20392156862745098, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), single_arrow: new Float32Array([0, 92 / 255, 230 / 255, 1]), wind_speed: new Float32Array([0, 0, 0, 1]) }, qst = [0, 20]; +let CFt = class extends A1 { + constructor() { + super(...arguments), this._desc = { magdir: { vsPath: "raster/magdir", fsPath: "raster/magdir", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) }, scalar: { vsPath: "raster/scalar", fsPath: "raster/scalar", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) } }; + } + dispose() { + } + prepareState({ context: e }) { + e.setBlendingEnabled(!0), e.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.setColorMask(!0, !0, !0, !0), e.setStencilWriteMask(0), e.setStencilTestEnabled(!0), e.setStencilOp(su.KEEP, su.KEEP, su.REPLACE); + } + draw(e, i) { + if (ut(i.source) || i.source.validPixelCount === 0) + return; + const { context: r, timeline: n } = e; + if (n.begin(this.name), r.setStencilFunction(Ll.EQUAL, i.stencilRef, 255), i.updateVectorFieldVAO(e), e.renderPass === "scalar") { + const s = i.vaoData.scalar; + s && this._drawScalars(e, i, s.vao, s.elementCount); + } else { + const s = i.vaoData.magdir; + s && this._drawTriangles(e, i, s.vao, s.elementCount); + } + n.end(this.name); + } + _drawTriangles(e, i, r, n) { + const { context: s, painter: o, requestRender: a, allowDelayedRender: l } = e, { symbolizerParameters: c } = i, h = c.dataRange ? ["dataRange"] : []; + c.rotationType === "geographic" && h.push("rotationGeographic"); + const p = o.materialManager.getProgram(this._desc.magdir, h); + if (l && _e(a) && !p.compiled) + return void a(); + s.useProgram(p); + const { coordScale: y, opacity: v, transforms: x } = i; + p.setUniform2fv("u_coordScale", y), p.setUniform1f("u_opacity", v), p.setUniformMatrix3fv("u_dvsMat3", x.dvs); + const { style: I, dataRange: P, rotation: F, symbolPercentRange: k } = c; + p.setUniform4fv("u_colors", Wst[I] || Wst.single_arrow), p.setUniform2fv("u_dataRange", P || qst), p.setUniform1f("u_rotation", F), p.setUniform2fv("u_symbolPercentRange", k); + const V = this._getSymbolSize(e, i); + p.setUniform2fv("u_symbolSize", V), s.bindVAO(r), s.drawElements(ps.TRIANGLES, n, Fi.UNSIGNED_INT, 0); + } + _drawScalars(e, i, r, n) { + const { context: s, painter: o, requestRender: a, allowDelayedRender: l } = e, { symbolizerParameters: c } = i, h = []; + c.style === "wind_speed" ? h.push("innerCircle") : c.dataRange && h.push("dataRange"), c.rotationType === "geographic" && h.push("rotationGeographic"); + const p = o.materialManager.getProgram(this._desc.scalar, h); + if (l && _e(a) && !p.compiled) + return void a(); + s.useProgram(p); + const { coordScale: y, opacity: v, transforms: x } = i; + p.setUniform2fv("u_coordScale", y), p.setUniform1f("u_opacity", v), p.setUniformMatrix3fv("u_dvsMat3", x.dvs); + const { dataRange: I, symbolPercentRange: P } = c; + p.setUniform2fv("u_dataRange", I || qst), p.setUniform2fv("u_symbolPercentRange", P); + const F = this._getSymbolSize(e, i); + p.setUniform2fv("u_symbolSize", F), s.bindVAO(r), s.drawElements(ps.TRIANGLES, n, Fi.UNSIGNED_INT, 0); + } + _getSymbolSize(e, i) { + const r = i.key ? 2 ** (e.displayLevel - i.key.level) : i.resolution / e.state.resolution, { symbolTileSize: n } = i.symbolizerParameters; + return [n / (Math.round((i.width - i.offset[0]) / n) * n) / r, n / (Math.round((i.height - i.offset[1]) / n) * n) / r]; + } +}, Sdr = class extends hH { + constructor() { + super(...arguments), this.symbolTypes = ["triangle"]; + } + get requiresDedicatedFBO() { + return !1; + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "imagery (vf)", brushes: [CFt], target: () => this.children, drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + doRender(e) { + this.visible && e.drawPhase === lo.MAP && this.symbolTypes.forEach((i) => { + e.renderPass = i, super.doRender(e); + }); + } +}, TFt = class extends pC { + constructor(e = null) { + super(), this._source = null, this._symbolizerParameters = null, this._vaoInvalidated = !0, this.coordScale = [1, 1], this.height = null, this.key = null, this.offset = null, this.stencilRef = 0, this.resolution = null, this.pixelRatio = 1, this.x = 0, this.y = 0, this.rotation = 0, this.rawPixelData = null, this.vaoData = null, this.width = null, this.source = e; + } + destroy() { + _e(this.vaoData) && (this.vaoData.magdir?.vao.dispose(), this.vaoData.scalar?.vao.dispose(), this.vaoData = null); + } + get symbolizerParameters() { + return this._symbolizerParameters; + } + set symbolizerParameters(e) { + JSON.stringify(this._symbolizerParameters) !== JSON.stringify(e) && (this._symbolizerParameters = e, this.invalidateVAO()); + } + get source() { + return this._source; + } + set source(e) { + this._source = e, this.invalidateVAO(); + } + invalidateVAO() { + !this._vaoInvalidated && _e(this.vaoData) && (this.vaoData.magdir?.vao.dispose(), this.vaoData.scalar?.vao.dispose(), this.vaoData = null, this._vaoInvalidated = !0, this.requestRender()); + } + updateVectorFieldVAO(e) { + if (this._vaoInvalidated) { + if (this._vaoInvalidated = !1, _e(this.source) && ut(this.vaoData)) { + const { style: i } = this.symbolizerParameters; + switch (i) { + case "beaufort_ft": + case "beaufort_km": + case "beaufort_kn": + case "beaufort_m": + case "beaufort_mi": + case "classified_arrow": + case "ocean_current_kn": + case "ocean_current_m": + case "single_arrow": + { + const r = gUe(this.source, this.symbolizerParameters), n = this._createVectorFieldVAO(e.context, r); + this.vaoData = { magdir: n }; + } + break; + case "simple_scalar": + { + const r = YIe(this.source, this.symbolizerParameters), n = this._createVectorFieldVAO(e.context, r); + this.vaoData = { scalar: n }; + } + break; + case "wind_speed": { + const r = gUe(this.source, this.symbolizerParameters), n = this._createVectorFieldVAO(e.context, r), s = YIe(this.source, this.symbolizerParameters), o = this._createVectorFieldVAO(e.context, s); + this.vaoData = { magdir: n, scalar: o }; + } + } + } + this.ready(), this.requestRender(); + } + } + _createTransforms() { + return { dvs: Ml() }; + } + setTransform(e) { + const i = v3(this.transforms.dvs), [r, n] = e.toScreenNoRotation([0, 0], [this.x, this.y]), s = this.resolution / this.pixelRatio / e.resolution, o = s * this.width, a = s * this.height, l = Math.PI * this.rotation / 180; + Ng(i, i, Tp(r, n)), Ng(i, i, Tp(o / 2, a / 2)), BI(i, i, -l), Ng(i, i, Tp(-o / 2, -a / 2)), bye(i, i, Tp(o, a)), kv(this.transforms.dvs, e.displayViewMat3, i); + } + onAttach() { + this.invalidateVAO(); + } + onDetach() { + this.invalidateVAO(); + } + _createVectorFieldVAO(e, i) { + const { vertexData: r, indexData: n } = i, s = Qo.createVertex(e, Vo.STATIC_DRAW, new Float32Array(r)), o = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n)), a = E3("vector-field", { geometry: [{ location: 0, name: "a_pos", count: 2, type: Fi.FLOAT, normalized: !1 }, { location: 1, name: "a_offset", count: 2, type: Fi.FLOAT, normalized: !1 }, { location: 2, name: "a_vv", count: 2, type: Fi.FLOAT, normalized: !1 }] }); + return { vao: new Ac(e, a.attributes, a.bufferLayouts, { geometry: s }, o), elementCount: n.length }; + } +}, QN = class extends vn { + constructor(e) { + super(e), this._loading = null, this.update = Fv((i, r) => this._update(i, r).catch((n) => { + us(n) || Ei.getLogger(this.declaredClass).error(n); + })); + } + get updating() { + return !!this._loading; + } + redraw(e) { + if (!this.container.children.length) + return; + const i = this.container.children[0]; + i.symbolizerParameters = e, i.invalidateVAO(), this.container.symbolTypes = e.style === "wind_speed" ? ["scalar", "triangle"] : e.style === "simple_scalar" ? ["scalar"] : ["triangle"], this.container.requestRender(); + } + async _update(e, i, r) { + if (!e.stationary) + return; + const { extent: n, spatialReference: s } = e.state, o = new br({ xmin: n.xmin, ymin: n.ymin, xmax: n.xmax, ymax: n.ymax, spatialReference: s }), [a, l] = e.state.size; + this._loading = this.fetchPixels(o, a, l, r); + const c = await this._loading; + this._addToDisplay(c, i, e.state), this._loading = null; + } + _addToDisplay(e, i, r) { + if (ut(e.pixelBlock)) + return this.container.children.forEach((a) => a.destroy()), void this.container.removeAllChildren(); + const { extent: n, pixelBlock: s } = e, o = new TFt(s); + o.offset = [0, 0], o.symbolizerParameters = i, o.rawPixelData = e, o.invalidateVAO(), o.x = n.xmin, o.y = n.ymax, o.pixelRatio = r.pixelRatio, o.rotation = r.rotation, o.resolution = r.resolution, o.width = s.width * i.symbolTileSize, o.height = s.height * i.symbolTileSize, this.container.children.forEach((a) => a.destroy()), this.container.removeAllChildren(), this.container.symbolTypes = i.style === "wind_speed" ? ["scalar", "triangle"] : i.style === "simple_scalar" ? ["scalar"] : ["triangle"], this.container.addChild(o); + } +}; +E([N()], QN.prototype, "fetchPixels", void 0), E([N()], QN.prototype, "container", void 0), E([N()], QN.prototype, "_loading", void 0), E([N()], QN.prototype, "updating", null), QN = E([dt("esri.views.2d.layers.imagery.ImageryVFStrategy")], QN); +const Cdr = QN; +let WT = class extends aI { + constructor() { + super(...arguments), this.attached = !1, this.container = new Sdr(), this.type = "imageryVF", this._dataParameters = { exportParametersVersion: 0, bbox: "", symbolTileSize: 0, time: "" }, this._fetchpixels = async (e, i, r, n) => { + const s = await this._projectFullExtentPromise, { symbolTileSize: o } = this.layer.renderer, { extent: a, width: l, height: c } = GJt(e, i, r, o, s); + if (_e(s) && !s.intersects(e)) + return { extent: a, pixelBlock: null }; + const h = { bbox: `${a.xmin}, ${a.ymin}, ${a.xmax}, ${a.ymax}`, exportParametersVersion: this.layer.exportImageServiceParameters.version, symbolTileSize: o, time: JSON.stringify(this.timeExtent || "") }; + if (this._canReuseVectorFieldData(h)) { + const v = this.getPixelData(); + if (_e(v) && `${v.extent.xmin}, ${v.extent.ymin}, ${v.extent.xmax}, ${v.extent.ymax}` === h.bbox) + return v; + } + const { pixelData: p } = await this.layer.fetchImage(a, l, c, { timeExtent: this.timeExtent, requestAsImageElement: !1, signal: n }); + this._dataParameters = h; + const y = p?.pixelBlock; + return ut(y) ? { extent: a, pixelBlock: null } : { extent: a, pixelBlock: this.layer.rasterInfo.dataType === "vector-uv" ? nU(y, "vector-uv") : y }; + }; + } + get updating() { + return !this.attached || this._strategy.updating; + } + attach() { + this._projectFullExtentPromise = this._getProjectedFullExtent(this.view.spatialReference), this._strategy = new Cdr({ container: this.container, fetchPixels: this._fetchpixels }), this.handles.add(Qi(() => this.layer.renderer, (e) => this._updateSymbolizerParams(e), id), "attach"); + } + detach() { + this._strategy.destroy(), this.container.children.forEach((e) => e.destroy()), this.container.removeAllChildren(), this.handles.remove("attach"), this._strategy = this.container = this._projectFullExtentPromise = null; + } + getPixelData() { + const e = this.container.children[0]?.rawPixelData; + if (this.updating || !e) + return null; + const { extent: i, pixelBlock: r } = e; + return { extent: i, pixelBlock: r }; + } + hitTest(e) { + return new ro({ attributes: {}, geometry: e.clone(), layer: this.layer }); + } + update(e) { + this._strategy.update(e, this._symbolizerParams); + } + redraw() { + const { renderer: e } = this.layer; + e && (this._updateSymbolizerParams(e), this._strategy.redraw(this._symbolizerParams)); + } + _canReuseVectorFieldData(e) { + const i = this._dataParameters.exportParametersVersion === e.exportParametersVersion, r = this._dataParameters.time === e.time, n = this._dataParameters.symbolTileSize === e.symbolTileSize, s = this._dataParameters.bbox === e.bbox; + return i && r && n && s; + } + async _getProjectedFullExtent(e) { + try { + return await vF(this.layer.fullExtent, e); + } catch { + try { + const r = (await ir(this.layer.url, { query: { option: "footprints", outSR: e.wkid || JSON.stringify(e.toJSON()), f: "json" } })).data.featureCollection.layers[0].layerDefinition.extent; + return r ? br.fromJSON(r) : null; + } catch { + return null; + } + } + } + _updateSymbolizerParams(e) { + e.type === "vector-field" && (this._symbolizerParams = this.layer.symbolizer.generateWebGLParameters({ pixelBlock: null })); + } +}; +E([N()], WT.prototype, "attached", void 0), E([N()], WT.prototype, "container", void 0), E([N()], WT.prototype, "layer", void 0), E([N()], WT.prototype, "timeExtent", void 0), E([N()], WT.prototype, "type", void 0), E([N()], WT.prototype, "view", void 0), E([N()], WT.prototype, "updating", null), WT = E([dt("esri.views.2d.layers.imagery.VectorFieldView2D")], WT); +const Tdr = WT, Edr = (t) => { + let e = class extends t { + constructor() { + super(...arguments), this.view = null; + } + async fetchPopupFeatures(i, r) { + const { layer: n } = this; + if (!i) + throw new ot("imagerylayerview:fetchPopupFeatures", "Nothing to fetch without area", { layer: n }); + const { popupEnabled: s } = n, o = bF(n, r); + if (!s || ut(o)) + throw new ot("imagerylayerview:fetchPopupFeatures", "Missing required popupTemplate or popupEnabled", { popupEnabled: s, popupTemplate: o }); + const a = await o.getRequiredFields(), l = new Os(); + l.timeExtent = this.timeExtent, l.geometry = i, l.outFields = a, l.outSpatialReference = i.spatialReference; + const { resolution: c, spatialReference: h } = this.view, p = this.view.type === "2d" ? new Xi(c, c, h) : new Xi(0.5 * c, 0.5 * c, h), { returnTopmostRaster: y, showNoDataRecords: v } = o.layerOptions || { returnTopmostRaster: !0, showNoDataRecords: !1 }, x = { returnDomainValues: !0, returnTopmostRaster: y, pixelSize: p, showNoDataRecords: v, signal: _e(r) ? r.signal : null }; + return n.queryVisibleRasters(l, x).then((I) => I); + } + canResume() { + return !!super.canResume() && !this.timeExtent?.isEmpty; + } + }; + return E([N()], e.prototype, "layer", void 0), E([N()], e.prototype, "suspended", void 0), E([N(Pz)], e.prototype, "timeExtent", void 0), E([N()], e.prototype, "view", void 0), e = E([dt("esri.views.layers.ImageryLayerView")], e), e; +}; +let lK = class extends Edr(eL(ky($y))) { + constructor() { + super(...arguments), this._exportImageVersion = -1, this._highlightGraphics = new Ob(), this._highlightView = void 0, this.layer = null, this.subview = null; + } + get pixelData() { + const { subview: e } = this; + return this.updating || !e ? null : "getPixelData" in e ? e.getPixelData() : null; + } + async hitTest(e, i) { + return this.subview ? [{ type: "graphic", graphic: this.subview.hitTest(e), layer: this.layer, mapPoint: e }] : null; + } + update(e) { + this.subview?.update(e); + } + attach() { + this.layer.increaseRasterJobHandlerUsage(), this._setSubView(), this.view && (this._highlightView = new _x({ view: this.view, graphics: this._highlightGraphics, requestUpdateCallback: () => this.requestUpdate(), container: new X9e(this.view.featuresTilingScheme) }), this.container.addChild(this._highlightView.container)), this.addAttachHandles([Qi(() => this.layer.blendMode ?? "normal", (e) => this.subview && (this.subview.container.blendMode = e), id), Qi(() => this.layer.effect ?? null, (e) => this.subview && (this.subview.container.effect = e), id), Qi(() => this.layer.exportImageServiceParameters.version, (e) => { + e && this._exportImageVersion !== e && (this._exportImageVersion = e, this.requestUpdate()); + }, Uu), Qi(() => this.timeExtent, (e) => { + const { subview: i } = this; + i && (i.timeExtent = e, "redraw" in i ? this.requestUpdate() : i.redrawOrRefetch()); + }, Uu), this.layer.on("redraw", () => { + const { subview: e } = this; + e && ("redraw" in e ? e.redraw() : e.redrawOrRefetch()); + }), Qi(() => this.layer.renderer, () => this._setSubView())]); + } + detach() { + this.layer.decreaseRasterJobHandlerUsage(), this.container.removeAllChildren(), this._detachSubview(this.subview), this.subview?.destroy(), this.subview = null, this._highlightView?.destroy(), this._exportImageVersion = -1; + } + moveStart() { + } + viewChange() { + } + moveEnd() { + this.requestUpdate(); + } + highlight(e, i) { + if (!((Array.isArray(e) ? e[0] : gr.isCollection(e) ? e.getItemAt(0) : e) instanceof ro)) + return { remove: () => { + } }; + let r = []; + return Array.isArray(e) || gr.isCollection(e) ? r = e.map((n) => n.clone()) : e instanceof ro && (r = [e.clone()]), this._highlightGraphics.addMany(r), { remove: () => { + this._highlightGraphics.removeMany(r); + } }; + } + async doRefresh() { + this.requestUpdate(); + } + isUpdating() { + return !this.subview || this.subview.updating; + } + _setSubView() { + if (!this.view) + return; + const e = this.layer.renderer?.type; + let i = "imagery"; + if (e === "vector-field" ? i = "imageryVF" : e === "flow" && (i = "flow"), this.subview) { + const { type: r } = this.subview; + if (r === i) + return this._attachSubview(this.subview), void (r === "flow" ? this.subview.redrawOrRefetch() : r === "imagery" && this.layer.format === "lerc" ? this.subview.redraw() : this.requestUpdate()); + this._detachSubview(this.subview), this.subview?.destroy(); + } + this.subview = i === "imagery" ? new xdr({ layer: this.layer, view: this.view, timeExtent: this.timeExtent }) : i === "imageryVF" ? new Tdr({ layer: this.layer, view: this.view, timeExtent: this.timeExtent }) : new SFt({ layer: this.layer, layerView: this }), this._attachSubview(this.subview), this.requestUpdate(); + } + _attachSubview(e) { + e && !e.attached && (e.attach(), e.attached = !0, this.container.addChildAt(e.container, 0), e.container.blendMode = this.layer.blendMode, e.container.effect = this.layer.effect); + } + _detachSubview(e) { + e?.attached && (this.container.removeChild(e.container), e.detach(), e.attached = !1); + } +}; +E([N()], lK.prototype, "pixelData", null), E([N()], lK.prototype, "subview", void 0), lK = E([dt("esri.views.2d.layers.ImageryLayerView2D")], lK); +const Idr = lK, Adr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Idr +}, Symbol.toStringTag, { value: "Module" })); +function Pdr(t, e, i = "nearest", r = !1) { + const n = !(r && e.pixelType === "u8"), s = n ? rs.FLOAT : rs.UNSIGNED_BYTE, o = e.pixels == null || e.pixels.length === 0 ? null : n ? e.getAsRGBAFloat() : e.getAsRGBA(), a = t.capabilities.textureFloat?.textureFloatLinear, l = { width: e.width, height: e.height, target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: t.type === go.WEBGL2 && n ? Vs.RGBA32F : cn.RGBA, samplingMode: !a || i !== "bilinear" && i !== "cubic" ? _n.NEAREST : _n.LINEAR, dataType: s, wrapMode: ds.CLAMP_TO_EDGE, flipped: !1 }; + return new Ts(t, l, o); +} +function EFt(t, e) { + const { spacing: i, offsets: r, coefficients: n, size: [s, o] } = e, a = i[0] > 1, l = { width: a ? 4 * s : s, height: o, target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: t.type === go.WEBGL2 ? Vs.RGBA32F : cn.RGBA, dataType: rs.FLOAT, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, flipped: !1 }, c = new Float32Array(a ? s * o * 16 : 2 * r.length); + if (a && n != null) + for (let h = 0, p = 0; h < n.length; h++) + c[p++] = n[h], h % 3 == 2 && (c[p++] = 1); + else + for (let h = 0; h < o; h++) + for (let p = 0; p < s; p++) { + const y = 4 * (h * s + p), v = 2 * (p * o + h); + c[y] = r[v], c[y + 1] = r[v + 1], c[y + 3] = r[v] === -1 ? 0 : 1; + } + return new Ts(t, l, c); +} +function Yst(t, e) { + const i = { width: e.length / 4, height: 1, target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.NEAREST, wrapMode: ds.CLAMP_TO_EDGE, flipped: !1 }; + return new Ts(t, i, e); +} +function Odr(t, e, i, r = 1, n = !0) { + return { u_flipY: n, u_applyTransform: !!t, u_opacity: r, u_transformSpacing: t ? t.spacing : XO, u_transformGridSize: t ? t.size : XO, u_targetImageSize: e, u_srcImageSize: i }; +} +function J9e(t, e) { + return { u_colormapOffset: e || 0, u_colormapMaxIndex: t ? t.length / 4 - 1 : 0 }; +} +function Rdr(t, e) { + return { u_scale: t, u_offset: e }; +} +function Mdr(t) { + return { u_bandCount: t.bandCount, u_minOutput: t.outMin, u_maxOutput: t.outMax, u_minCutOff: t.minCutOff, u_maxCutOff: t.maxCutOff, u_factor: t.factor, u_useGamma: t.useGamma, u_gamma: t.gamma, u_gammaCorrection: t.gammaCorrection }; +} +function Ddr(t) { + return { u_hillshadeType: t.hillshadeType, u_sinZcosAs: t.sinZcosAs, u_sinZsinAs: t.sinZsinAs, u_cosZs: t.cosZs, u_weights: t.weights, u_factor: t.factor, u_minValue: t.minValue, u_maxValue: t.maxValue }; +} +function Fdr(t, e) { + const i = t.gl, r = e.glName, n = /* @__PURE__ */ new Map(); + if (ut(r)) + return n; + const s = i.getProgramParameter(r, i.ACTIVE_UNIFORMS); + let o; + for (let a = 0; a < s; a++) + o = i.getActiveUniform(r, a), o && n.set(o.name, { location: i.getUniformLocation(r, o.name), info: o }); + return n; +} +function xF(t, e, i) { + Object.keys(i).forEach((r) => { + const n = e.get(r) || e.get(r + "[0]"); + n && Ldr(t, r, i[r], n); + }); +} +function dH(t, e, i, r) { + i.length === r.length && (r.some((n) => n == null) || i.some((n) => n == null) || i.forEach((n, s) => { + e.setUniform1i(n, s), t.bindTexture(r[s], s); + })); +} +function Ldr(t, e, i, r) { + if (r === null || i == null) + return !1; + const { info: n } = r; + switch (n.type) { + case f0.FLOAT: + n.size > 1 ? t.setUniform1fv(e, i) : t.setUniform1f(e, i); + break; + case f0.FLOAT_VEC2: + t.setUniform2fv(e, i); + break; + case f0.FLOAT_VEC3: + t.setUniform3fv(e, i); + break; + case f0.FLOAT_VEC4: + t.setUniform4fv(e, i); + break; + case f0.FLOAT_MAT3: + t.setUniformMatrix3fv(e, i); + break; + case f0.FLOAT_MAT4: + t.setUniformMatrix4fv(e, i); + break; + case f0.INT: + n.size > 1 ? t.setUniform1iv(e, i) : t.setUniform1i(e, i); + break; + case f0.BOOL: + t.setUniform1i(e, i ? 1 : 0); + break; + case f0.INT_VEC2: + case f0.BOOL_VEC2: + t.setUniform2iv(e, i); + break; + case f0.INT_VEC3: + case f0.BOOL_VEC3: + t.setUniform3iv(e, i); + break; + case f0.INT_VEC4: + case f0.BOOL_VEC4: + t.setUniform4iv(e, i); + break; + default: + return !1; + } + return !0; +} +const Ndr = { bandCount: 3, outMin: 0, outMax: 1, minCutOff: [0, 0, 0], maxCutOff: [255, 255, 255], factor: [1 / 255, 1 / 255, 1 / 255], useGamma: !1, gamma: [1, 1, 1], gammaCorrection: [1, 1, 1], colormap: null, colormapOffset: null, stretchType: "none", type: "stretch" }; +let kdr = class extends pC { + constructor(e = null, i = null, r = null) { + super(), this._textureInvalidated = !0, this._colormapTextureInvalidated = !0, this._rasterTexture = null, this._rasterTextureBandIds = null, this._transformGridTexture = null, this._colormapTexture = null, this._colormap = null, this._supportsBilinearTexture = !0, this._processedTexture = null, this.functionTextures = [], this.projected = !1, this.stencilRef = 0, this.coordScale = [1, 1], this._processed = !1, this._symbolizerParameters = null, this.height = null, this.isRendereredSource = !1, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this.rawPixelData = null, this._suspended = !1, this._bandIds = null, this._interpolation = null, this._transformGrid = null, this.width = null, this.x = 0, this.y = 0, this.source = e, this.transformGrid = i, this.interpolation = r; + } + destroy() { + this._disposeTextures(); + } + get processedTexture() { + return this._processedTexture; + } + set processedTexture(e) { + this._processedTexture !== e && (this._disposeTextures(!0), this._processedTexture = e); + } + get rasterTexture() { + return this._rasterTexture; + } + set rasterTexture(e) { + this._rasterTexture !== e && (this._rasterTexture?.dispose(), this._rasterTexture = e); + } + get processed() { + return this._processed; + } + set processed(e) { + this._processed = e, e || (Ua(this.processedTexture), this.invalidateTexture()); + } + get symbolizerParameters() { + return this._symbolizerParameters || Ndr; + } + set symbolizerParameters(e) { + this._symbolizerParameters !== e && (this._symbolizerParameters = e, this._colormapTextureInvalidated = !0, this.commonUniforms = null); + } + get source() { + return this._source; + } + set source(e) { + this._source !== e && (this._source = e, this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null), this.projected = !1, this.invalidateTexture()); + } + get suspended() { + return this._suspended; + } + set suspended(e) { + this._suspended && !e && this.stage && (this.ready(), this.requestRender()), this._suspended = e; + } + get bandIds() { + return this._bandIds; + } + set bandIds(e) { + this._bandIds = e, this._isBandIdschanged(e) && (this.projected = !1, this.invalidateTexture()); + } + get interpolation() { + return this._interpolation || "nearest"; + } + set interpolation(e) { + this._interpolation = e, this._rasterTexture && this._rasterTexture.setSamplingMode(this._getTextureSamplingMethod(e || "nearest") === "bilinear" ? _n.LINEAR : _n.NEAREST); + } + get transformGrid() { + return this._transformGrid; + } + set transformGrid(e) { + this._transformGrid = e, this._transformGridTexture = Ua(this._transformGridTexture); + } + invalidateTexture() { + this._textureInvalidated || (this._textureInvalidated = !0, this.requestRender()); + } + _createTransforms() { + return { dvs: Ml() }; + } + setTransform(e) { + const i = v3(this.transforms.dvs), [r, n] = e.toScreenNoRotation([0, 0], [this.x, this.y]), s = this.resolution / this.pixelRatio / e.resolution, o = s * this.width, a = s * this.height, l = Math.PI * this.rotation / 180; + Ng(i, i, Tp(r, n)), Ng(i, i, Tp(o / 2, a / 2)), BI(i, i, -l), Ng(i, i, Tp(-o / 2, -a / 2)), bye(i, i, Tp(o, a)), kv(this.transforms.dvs, e.displayViewMat3, i); + } + getTextures({ forProcessing: e = !1, useProcessedTexture: i = !1 } = {}) { + const r = i ? this._processedTexture ?? this._rasterTexture : this._rasterTexture, n = [], s = []; + return r ? i ? (s.push(r), n.push("u_image"), this._colormapTexture && (s.push(this._colormapTexture), n.push("u_colormap")), { names: n, textures: s }) : (this._transformGridTexture && (s.push(this._transformGridTexture), n.push("u_transformGrid")), s.push(r), n.push("u_image"), this._colormapTexture && !e && (s.push(this._colormapTexture), n.push("u_colormap")), { names: n, textures: s }) : { names: n, textures: s }; + } + onAttach() { + this.invalidateTexture(); + } + onDetach() { + this.invalidateTexture(); + } + updateTexture({ context: e }) { + if (!this.stage) + return void this._disposeTextures(); + const i = this._isValidSource(this.source); + i && this._colormapTextureInvalidated && (this._colormapTextureInvalidated = !1, this._updateColormapTexture(e)), this._textureInvalidated && (this._textureInvalidated = !1, this._createOrDestroyRasterTexture(e), this._rasterTexture && (i ? this.transformGrid && !this._transformGridTexture && (this._transformGridTexture = EFt(e, this.transformGrid)) : this._rasterTexture.setData(null)), this.suspended || (this.ready(), this.requestRender())); + } + updateProcessedTexture() { + const { functionTextures: e } = this; + e.length !== 0 && (this.processedTexture = e.shift(), e.forEach((i) => i?.dispose()), e.length = 0); + } + _createOrDestroyRasterTexture(e) { + const i = _e(this.source) ? sde(this.source, this.bandIds) : null; + if (!this._isValidSource(i)) + return void (this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null)); + const r = !this._isBandIdschanged(this.bandIds); + if (this._rasterTexture) { + if (r) + return; + this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null; + } + this._supportsBilinearTexture = !!e.capabilities.textureFloat?.textureFloatLinear; + const n = this._getTextureSamplingMethod(this.interpolation), s = this.isRendereredSource || !e.capabilities.textureFloat?.textureFloat; + this._rasterTexture = Pdr(e, i, n, s), this.projected = !1, this._processed = !1, this._rasterTextureBandIds = this.bandIds ? [...this.bandIds] : null; + } + _isBandIdschanged(e) { + const i = this._rasterTextureBandIds; + return !(i == null && e == null || i && e && i.join("") === e.join("")); + } + _isValidSource(e) { + return _e(e) && e.pixels?.length > 0; + } + _getTextureSamplingMethod(e) { + const { type: i, colormap: r } = this.symbolizerParameters, n = i === "lut" || i === "stretch" && _e(r); + return !this._supportsBilinearTexture || n || e !== "bilinear" && e !== "cubic" ? "nearest" : "bilinear"; + } + _updateColormapTexture(e) { + const i = this._colormap, r = this.symbolizerParameters.colormap; + return r ? i ? r.length !== i.length || r.some((n, s) => n !== i[s]) ? (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), this._colormapTexture = Yst(e, r), void (this._colormap = r)) : void 0 : (this._colormapTexture = Yst(e, r), void (this._colormap = r)) : (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), void (this._colormap = null)); + } + _disposeTextures(e = !1) { + this._transformGridTexture && (this._transformGridTexture.dispose(), this._transformGridTexture = null), !e && this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null, this._colormap = null, this._colormapTextureInvalidated = !0), !e && this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null), this._processedTexture && (this._processedTexture.dispose(), this._processedTexture = null); + } +}; +function $dr(t) { + return _e(t.source); +} +function Z9e(t) { + const e = []; + return t && (e.push("applyProjection"), t.spacing[0] === 1 && e.push("lookupProjection")), e; +} +function IFt(t, e, i) { + const r = !i.capabilities.textureFloat?.textureFloatLinear, n = []; + return t === "cubic" ? n.push("bicubic") : t === "bilinear" && (e ? (n.push("bilinear"), n.push("nnedge")) : r && n.push("bilinear")), n; +} +const Bdr = { vsPath: "raster/common", fsPath: "raster/lut", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Vdr(t, e, i) { + const r = i ? [] : Z9e(e.transformGrid); + return { defines: r, program: t.painter.materialManager.getProgram(Bdr, r) }; +} +function jdr(t, e, i, r, n = !1) { + const { names: s, textures: o } = i.getTextures({ useProcessedTexture: n }); + dH(t.context, e, s, o), xF(e, r, i.commonUniforms), e.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs); + const { colormap: a, colormapOffset: l } = i.symbolizerParameters, c = J9e(a, l); + xF(e, r, c); +} +const Gdr = { createProgram: Vdr, bindTextureAndUniforms: jdr }, Udr = { vsPath: "raster/common", fsPath: "raster/hillshade", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function zdr(t, e, i) { + const { colormap: r } = e.symbolizerParameters, n = [...i ? [] : Z9e(e.transformGrid), ...IFt(e.interpolation, r != null, t.context)]; + return r != null && n.push("applyColormap"), { defines: n, program: t.painter.materialManager.getProgram(Udr, n) }; +} +function Hdr(t, e, i, r, n = !1) { + const { names: s, textures: o } = i.getTextures({ useProcessedTexture: n }); + dH(t.context, e, s, o), xF(e, r, i.commonUniforms), e.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs); + const a = i.symbolizerParameters, { colormap: l, colormapOffset: c } = a; + if (l != null) { + const p = J9e(l, c); + xF(e, r, p); + } + const h = Ddr(a); + xF(e, r, h); +} +const Wdr = { createProgram: zdr, bindTextureAndUniforms: Hdr }, qdr = { vsPath: "raster/common", fsPath: "raster/stretch", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Ydr(t, e, i) { + const { colormap: r } = e.symbolizerParameters, n = [...i ? [] : Z9e(e.transformGrid), ...IFt(e.interpolation, r != null, t.context)]; + return e.isRendereredSource && !i ? n.push("noop") : r != null && n.push("applyColormap"), { defines: n, program: t.painter.materialManager.getProgram(qdr, n) }; +} +function Xdr(t, e, i, r, n = !1) { + const { names: s, textures: o } = i.getTextures({ useProcessedTexture: n }); + dH(t.context, e, s, o), xF(e, r, i.commonUniforms), e.setUniformMatrix3fv("u_dvsMat3", i.transforms.dvs); + const a = i.symbolizerParameters, { colormap: l, colormapOffset: c } = a; + if (l != null) { + const p = J9e(l, c); + xF(e, r, p); + } + const h = Mdr(a); + xF(e, r, h); +} +const Kdr = { createProgram: Ydr, bindTextureAndUniforms: Xdr }, Dce = /* @__PURE__ */ new Map(); +function Jdr(t) { + return Dce.get(t); +} +Dce.set("lut", Gdr), Dce.set("hillshade", Wdr), Dce.set("stretch", Kdr); +const Zdr = [1, 1], Qdr = [2, 0, 0, 0, 2, 0, -1, -1, 0]; +function qI(t, e, i) { + const { context: r, rasterFunction: n, hasBranches: s } = t, { raster: o } = n.parameters, a = s ? o?.id ?? -1 : 0, l = i.functionTextures[a] ?? i.rasterTexture; + dH(r, e, ["u_image"], [l]); +} +function AFt(t, e, i) { + const { rasters: r } = t.rasterFunction.parameters; + if (!r) + return; + if (r.length < 2) + return qI(t, e, i); + const n = r.filter((s) => s.name !== "Constant").map((s) => s.id != null && s.name !== "Identity" ? i.functionTextures[s.id] : i.rasterTexture); + if (dH(t.context, e, ["u_image", "u_image1", "u_image2"].slice(0, n.length), n), n.length !== r.length) { + if (r.length === 2) { + const s = r.findIndex((l) => l.name === "Constant"), o = s === 0 ? [0, 1, 0, 1, 0, 0, 0, 0, 0] : [1, 0, 0, 0, 1, 0, 0, 0, 0], { value: a } = r[s].parameters; + e.setUniform1f("u_image1Const", a), e.setUniformMatrix3fv("u_imageSwap", o); + } else if (r.length === 3) { + const s = []; + if (r.forEach((o, a) => o.name === "Constant" && s.push(a)), s.length === 1) { + const { value: o } = r[s[0]].parameters; + e.setUniform1f("u_image1Const", o); + const a = s[0] === 0 ? [0, 1, 0, 0, 0, 1, 1, 0, 0] : s[0] === 1 ? [1, 0, 0, 0, 0, 1, 0, 1, 0] : [1, 0, 0, 0, 1, 0, 0, 0, 1]; + e.setUniformMatrix3fv("u_imageSwap", a); + } else if (s.length === 2) { + const { value: o } = r[s[0]].parameters; + e.setUniform1f("u_image1Const", o); + const { value: a } = r[s[1]].parameters; + e.setUniform1f("u_image2Const", a); + const l = r.findIndex((h) => h.name !== "Constant"), c = l === 0 ? [1, 0, 0, 0, 1, 0, 0, 0, 1] : l === 1 ? [0, 1, 0, 1, 0, 0, 0, 0, 1] : [0, 0, 1, 1, 0, 0, 0, 1, 0]; + e.setUniformMatrix3fv("u_imageSwap", c); + } + } + } +} +function fC(t) { + t.setUniform2fv("u_coordScale", Zdr), t.setUniformMatrix3fv("u_dvsMat3", Qdr); +} +const epr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/aspect", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function tpr(t, e) { + return t.painter.materialManager.getProgram(epr, []); +} +function ipr(t, e, i) { + qI(t, e, i), fC(e); + const { width: r, height: n, resolution: s } = i; + e.setUniform2fv("u_srcImageSize", [r, n]), e.setUniform2fv("u_cellSize", [s, s]); +} +const rpr = { createProgram: tpr, bindTextureAndUniforms: ipr }, npr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/bandarithmetic", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function spr(t, e) { + const { painter: i, rasterFunction: r } = t, { indexType: n } = r.parameters; + return i.materialManager.getProgram(npr, [n]); +} +function opr(t, e, i) { + qI(t, e, i), fC(e); + const { bandIndexMat3: r } = t.rasterFunction.parameters; + e.setUniformMatrix3fv("u_bandIndexMat3", r); +} +const apr = { createProgram: spr, bindTextureAndUniforms: opr }, lpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/compositeband", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function upr(t, e) { + return t.painter.materialManager.getProgram(lpr, []); +} +function cpr(t, e, i) { + AFt(t, e, i), fC(e); +} +const hpr = { createProgram: upr, bindTextureAndUniforms: cpr }, dpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/convolution", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function ppr(t, e) { + const { painter: i, rasterFunction: r } = t, { kernelRows: n, kernelCols: s } = r.parameters, o = [{ name: "rows", value: n }, { name: "cols", value: s }]; + return i.materialManager.getProgram(dpr, o); +} +function fpr(t, e, i) { + qI(t, e, i), fC(e), e.setUniform2fv("u_srcImageSize", [i.width, i.height]); + const { kernel: r, clampRange: n } = t.rasterFunction.parameters; + e.setUniform1fv("u_kernel", r), e.setUniform2fv("u_clampRange", n); +} +const mpr = { createProgram: ppr, bindTextureAndUniforms: fpr }, gpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/extractband", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function ypr(t, e) { + return t.painter.materialManager.getProgram(gpr, []); +} +function vpr(t, e, i) { + qI(t, e, i), fC(e); + const { bandIndexMat3: r } = t.rasterFunction.parameters; + e.setUniformMatrix3fv("u_bandIndexMat3", r); +} +const _pr = { createProgram: ypr, bindTextureAndUniforms: vpr }, bpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/local", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }, wpr = /* @__PURE__ */ new Set(["sinh", "cosh", "tanh", "asinh", "acosh", "atanh"]); +function xpr(t) { + const { painter: e, rasterFunction: i } = t, { imageCount: r, operationName: n, rasters: s, isOutputRounded: o } = i.parameters; + let a = n.toLowerCase(); + t.context.type === go.WEBGL1 && wpr.has(a) && (a = `polyfill${a}`); + const l = [a]; + r === 2 && l.push("twoImages"); + const c = s.filter((h) => h.name === "Constant"); + return c.length && (l.push("oneConstant"), c.length === 2 && l.push("twoConstant")), o && l.push("roundOutput"), e.materialManager.getProgram(bpr, l); +} +function Spr(t, e, i) { + AFt(t, e, i), fC(e); + const { domainRange: r } = t.rasterFunction.parameters; + e.setUniform2fv("u_domainRange", r); +} +const Cpr = { createProgram: xpr, bindTextureAndUniforms: Spr }, Tpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/mask", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Epr(t, e) { + const { painter: i, rasterFunction: r } = t, n = r.parameters.bandCount > 1 ? ["multiBand"] : []; + return i.materialManager.getProgram(Tpr, n); +} +function Ipr(t, e, i) { + qI(t, e, i), fC(e); + const { includedRanges: r, noDataValues: n } = t.rasterFunction.parameters; + e.setUniform1fv("u_includedRanges", r), e.setUniform1fv("u_noDataValues", n); +} +const Apr = { createProgram: Epr, bindTextureAndUniforms: Ipr }, Ppr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/ndvi", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Opr(t, e) { + const { painter: i, rasterFunction: r } = t, n = r.parameters.scaled ? ["scaled"] : []; + return i.materialManager.getProgram(Ppr, n); +} +function Rpr(t, e, i) { + qI(t, e, i), fC(e); + const { bandIndexMat3: r } = t.rasterFunction.parameters; + e.setUniformMatrix3fv("u_bandIndexMat3", r); +} +const Mpr = { createProgram: Opr, bindTextureAndUniforms: Rpr }, Dpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/remap", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Fpr(t, e) { + return t.painter.materialManager.getProgram(Dpr, []); +} +function Lpr(t, e, i) { + qI(t, e, i), fC(e); + const { noDataRanges: r, rangeMaps: n, allowUnmatched: s, clampRange: o } = t.rasterFunction.parameters; + e.setUniform1fv("u_noDataRanges", r), e.setUniform1fv("u_rangeMaps", n), e.setUniform1f("u_unmatchMask", s ? 1 : 0), e.setUniform2fv("u_clampRange", o); +} +const Npr = { createProgram: Fpr, bindTextureAndUniforms: Lpr }, kpr = { vsPath: "raster/common", fsPath: "raster/reproject", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function $pr(t, e) { + const { painter: i } = t, r = [], n = !t.context.capabilities.textureFloat?.textureFloatLinear, { interpolation: s, transformGrid: o } = e; + return s === "cubic" ? r.push("bicubic") : s === "bilinear" && n && r.push("bilinear"), o && (r.push("applyProjection"), o.spacing[0] === 1 && r.push("lookupProjection")), i.materialManager.getProgram(kpr, r); +} +function Bpr(t, e, i) { + const { names: r, textures: n } = i.getTextures({ forProcessing: !0 }); + dH(t.context, e, r, n), e.setUniform1f("u_scale", 1), e.setUniform2fv("u_offset", [0, 0]), e.setUniform2fv("u_coordScale", [1, 1]), e.setUniformMatrix3fv("u_dvsMat3", [2, 0, 0, 0, 2, 0, -1, -1, 0]), e.setUniform1i("u_flipY", 0), e.setUniform1f("u_opacity", 1); + const { width: s, height: o, source: a, transformGrid: l } = i; + e.setUniform2fv("u_srcImageSize", [a.width, a.height]), e.setUniform2fv("u_targetImageSize", [s, o]), e.setUniform2fv("u_transformSpacing", l ? l.spacing : XO), e.setUniform2fv("u_transformGridSize", l ? l.size : XO); +} +const Vpr = { createProgram: $pr, bindTextureAndUniforms: Bpr }, jpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/slope", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Gpr(t, e) { + const { painter: i, rasterFunction: r } = t, { slopeType: n } = r.parameters, s = n === "percent-rise" ? ["percentRise"] : []; + return i.materialManager.getProgram(jpr, s); +} +function Upr(t, e, i) { + qI(t, e, i), fC(e); + const { width: r, height: n, resolution: s } = i, { zFactor: o, slopeType: a, pixelSizePower: l, pixelSizeFactor: c } = t.rasterFunction.parameters; + e.setUniform2fv("u_srcImageSize", [r, n]), e.setUniform2fv("u_cellSize", [s, s]), e.setUniform1f("u_zFactor", o), e.setUniform1f("u_pixelSizePower", a === "adjusted" ? l : 0), e.setUniform1f("u_pixelSizeFactor", a === "adjusted" ? c : 0); +} +const zpr = { createProgram: Gpr, bindTextureAndUniforms: Upr }, Hpr = { vsPath: "raster/rfx/vs", fsPath: "raster/rfx/stretch", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }; +function Wpr(t, e) { + const { useGamma: i, bandCount: r, isOutputRounded: n } = t.rasterFunction.parameters, s = []; + return i && s.push("useGamma"), r > 1 && s.push("multiBand"), n && s.push("roundOutput"), t.painter.materialManager.getProgram(Hpr, s); +} +function qpr(t, e, i) { + qI(t, e, i), fC(e); + const { width: r, height: n } = i, s = t.rasterFunction.parameters; + e.setUniform2fv("u_srcImageSize", [r, n]), e.setUniform1f("u_minOutput", s.outMin), e.setUniform1f("u_maxOutput", s.outMax), e.setUniform1fv("u_factor", s.factor), e.setUniform1fv("u_minCutOff", s.minCutOff), e.setUniform1fv("u_maxCutOff", s.maxCutOff), e.setUniform1fv("u_gamma", s.gamma), e.setUniform1fv("u_gammaCorrection", s.gammaCorrection); +} +const Ypr = { createProgram: Wpr, bindTextureAndUniforms: qpr }, Dw = /* @__PURE__ */ new Map(); +function PFt(t, e, i) { + const r = { width: e, height: i, target: io.TEXTURE_2D, pixelFormat: cn.RGBA, internalFormat: t.type === go.WEBGL2 ? Vs.RGBA32F : cn.RGBA, samplingMode: _n.NEAREST, dataType: rs.FLOAT, isImmutable: t.type === go.WEBGL2, wrapMode: ds.CLAMP_TO_EDGE, flipped: !1 }; + return new Ts(t, r); +} +function Xpr(t, e, i, r) { + const { context: n, requestRender: s, allowDelayedRender: o } = t, a = r.createProgram(t, i); + if (o && _e(s) && !a.compiled) + return s(), null; + const { width: l, height: c } = i; + return n.bindFramebuffer(e), n.setViewport(0, 0, l, c), n.useProgram(a), a; +} +function Kpr(t) { + return Dw.get(t.toLowerCase()); +} +function Jpr(t, e, i, r) { + const n = t.rasterFunction.name.toLowerCase(), s = n === "reproject" ? Vpr : Kpr(n); + if (s == null) + return; + const o = Xpr(t, i, r, s); + if (!o) + return; + s.bindTextureAndUniforms(t, o, r), e.draw(); + const { width: a, height: l } = r, c = PFt(t.context, a, l); + if (i.copyToTexture(0, 0, a, l, 0, 0, c), n === "reproject") + r.rasterTexture = c, r.projected = !0; + else { + const h = t.hasBranches ? t.rasterFunction.id : 0; + r.functionTextures[h] = c; + } +} +Dw.set("aspect", rpr), Dw.set("bandarithmetic", apr), Dw.set("compositeband", hpr), Dw.set("convolution", mpr), Dw.set("extractband", _pr), Dw.set("local", Cpr), Dw.set("mask", Apr), Dw.set("ndvi", Mpr), Dw.set("remap", Npr), Dw.set("slope", zpr), Dw.set("stretch", Ypr); +let Zpr = class extends A1 { + constructor() { + super(...arguments), this.name = "raster", this._quad = null, this._rendererUniformInfos = /* @__PURE__ */ new Map(), this._fbo = null; + } + dispose() { + Ua(this._quad), Ua(this._fbo); + } + prepareState(e) { + const { context: i, renderPass: r } = e, n = r === "raster"; + i.setBlendingEnabled(!n), i.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), i.setColorMask(!0, !0, !0, !0), i.setStencilWriteMask(0), i.setStencilTestEnabled(!n); + } + draw(e, i) { + if (!$dr(i) || i.suspended) + return; + const { renderPass: r } = e; + if (r !== "raster-bitmap") + return r === "raster" ? this._process(e, i) : void this._drawBitmap(e, i, !0); + this._drawBitmap(e, i); + } + _process(e, i) { + const { rasterFunction: r } = e, n = r.name === "Reproject"; + if (!(n ? !(i.rasterTexture && i.projected) : !i.processed)) + return; + const { timeline: s, context: o } = e; + s.begin(this.name); + const a = o.getBoundFramebufferObject(), l = o.getViewport(); + n || (i.processedTexture = Ua(i.processedTexture)), o.setStencilFunction(Ll.EQUAL, i.stencilRef, 255), i.updateTexture(e), this._initQuad(o); + const { isStandardRasterTileSize: c, fbo: h } = this._getRasterFBO(o, i.width, i.height); + Jpr(e, this._quad, h, i), c || h.dispose(), o.bindFramebuffer(a), o.setViewport(l.x, l.y, l.width, l.height), s.end(this.name); + } + _drawBitmap(e, i, r = !1) { + const { timeline: n, context: s } = e; + if (n.begin(this.name), s.setStencilFunction(Ll.EQUAL, i.stencilRef, 255), i.updateTexture(e), r && !i.processedTexture) { + if (i.updateProcessedTexture(), !i.processedTexture) + return void n.end(this.name); + i.processed = !0; + } + this._initBitmapCommonUniforms(i); + const o = i.symbolizerParameters.type, a = Jdr(o), { requestRender: l, allowDelayedRender: c } = e, { defines: h, program: p } = a.createProgram(e, i, r); + if (c && _e(l) && !p.compiled) + return void l(); + s.useProgram(p); + const y = this._getUniformInfos(o, s, p, h); + this._quad || (this._quad = new kx(s, [0, 0, 1, 0, 0, 1, 1, 1])), a.bindTextureAndUniforms(e, p, i, y, r), this._quad.draw(), n.end(this.name); + } + _initBitmapCommonUniforms(e) { + if (!e.commonUniforms) { + const i = Rdr(1, [0, 0]), { transformGrid: r, width: n, height: s } = e, o = Odr(r, [n, s], [e.source.width, e.source.height], 1, !1); + e.commonUniforms = { ...i, ...o, u_coordScale: e.coordScale }; + } + } + _getRasterFBO(e, i, r) { + const n = i === Sc || r === Sc; + return n ? (this._fbo || (this._fbo = this._createNewFBO(e, i, r)), { isStandardRasterTileSize: n, fbo: this._fbo }) : { isStandardRasterTileSize: n, fbo: this._createNewFBO(e, i, r) }; + } + _createNewFBO(e, i, r) { + const n = PFt(e, i, r); + return new cd(e, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: i, height: r }, n); + } + _initQuad(e) { + this._quad || (this._quad = new kx(e, [0, 0, 1, 0, 0, 1, 1, 1])); + } + _getUniformInfos(e, i, r, n) { + const s = n.length > 0 ? e + "-" + n.join("-") : e; + if (this._rendererUniformInfos.has(s)) + return this._rendererUniformInfos.get(s); + const o = Fdr(i, r); + return this._rendererUniformInfos.set(s, o), o; + } +}, Qpr = class extends cH { + constructor(e, i, r, n, s, o, a = null) { + super(e, i, r, n, s, o), this.bitmap = null, this.bitmap = new kdr(a, null, null), this.bitmap.coordScale = [s, o], this.bitmap.once("isReady", () => this.ready()); + } + destroy() { + super.destroy(), this.bitmap.destroy(), this.bitmap = null, this.stage = null; + } + set stencilRef(e) { + this.bitmap.stencilRef = e; + } + get stencilRef() { + return this.bitmap.stencilRef; + } + setTransform(e) { + super.setTransform(e), this.bitmap.transforms.dvs = this.transforms.dvs; + } + _createTransforms() { + return { dvs: Ml(), tileMat3: Ml() }; + } + onAttach() { + this.bitmap.stage = this.stage; + } + onDetach() { + this.bitmap.stage = null; + } +}, efr = class extends lre { + constructor() { + super(...arguments), this.isCustomTilingScheme = !1; + } + createTile(e) { + const i = this._getTileBounds(e), [r, n] = this._tileInfoView.tileInfo.size, s = this._tileInfoView.getTileResolution(e.level); + return new Qpr(e, s, i[0], i[3], r, n); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "imagery (tile)", brushes: [Zpr], target: () => this.children.map((r) => r.bitmap), drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + doRender(e) { + if (!this.visible || e.drawPhase !== lo.MAP) + return; + const { rasterFunctionChain: i } = this; + if (!i) + return e.renderPass = "raster-bitmap", void super.doRender(e); + const [r, n] = this._tileInfoView.tileInfo.size; + if (e.renderPass = "raster", e.rasterFunction = { name: "Reproject", parameters: { targetImageSize: [r, n] }, pixelType: "f32", id: 0, isNoopProcess: !1 }, super.doRender(e), i?.functions.length) { + const { functions: s, hasBranches: o } = i; + for (let a = 0; a < s.length; a++) { + const l = s[a]; + l.name !== "Constant" && l.name !== "Identity" && (e.renderPass = "raster", e.rasterFunction = l, e.hasBranches = o, super.doRender(e)); + } + } + e.rasterFunction = null, e.renderPass = "bitmap", super.doRender(e); + } + _getTileBounds(e) { + const i = this._tileInfoView.getTileBounds(Eo(), e); + if (this.isCustomTilingScheme && e.world) { + const { tileInfo: r } = this._tileInfoView, n = jNe(r.spatialReference); + if (n) { + const s = r.lodAt(e.level); + if (!s) + return i; + const { resolution: o } = s, a = n / o % r.size[0], l = a ? (r.size[0] - a) * o : 0; + i[0] -= l * e.world, i[2] -= l * e.world; + } + } + return i; + } +}, tfr = class { + constructor(e = 15e3, i = 5e3) { + this._timer = null, this._cachedBlocks = /* @__PURE__ */ new Map(), this._size = -1, this._duration = e, this._interval = Math.min(e, i); + } + decreaseRefCount(e, i) { + const r = e + "/" + i, n = this._cachedBlocks; + if (n.has(r)) { + const s = n.get(r); + return s.refCount--, s.refCount <= 0 && (n.delete(r), s.controller && s.controller.abort()), s.refCount; + } + return 0; + } + getBlock(e, i) { + const r = e + "/" + i, n = this._cachedBlocks; + if (n.has(r)) { + const s = n.get(r); + return s.ts = Date.now(), s.refCount++, n.delete(r), n.set(r, s), s.block; + } + return null; + } + putBlock(e, i, r, n) { + const s = this._cachedBlocks, o = e + "/" + i; + if (s.has(o)) { + const a = s.get(o); + a.ts = Date.now(), a.refCount++; + } else + s.set(o, { block: r, ts: Date.now(), refCount: 1, controller: n }); + this._trim(), this._updateTimer(); + } + deleteBlock(e, i) { + const r = this._cachedBlocks, n = e + "/" + i; + r.has(n) && r.delete(n); + } + updateMaxSize(e) { + this._size = e, this._trim(); + } + empty() { + this._cachedBlocks.clear(), this._clearTimer(); + } + getCurrentSize() { + return this._cachedBlocks.size; + } + _updateTimer() { + if (this._timer != null) + return; + const e = this._cachedBlocks; + this._timer = setInterval(() => { + const i = Array.from(e), r = Date.now(); + for (let n = 0; n < i.length && i[n][1].ts <= r - this._duration; n++) + e.delete(i[n][0]); + e.size === 0 && this._clearTimer(); + }, this._interval); + } + _trim() { + const e = this._cachedBlocks; + if (this._size === -1 || this._size >= e.size) + return; + const i = Array.from(e); + for (let r = 0; r < i.length - this._size; r++) + e.delete(i[r][0]); + } + _clearTimer() { + this._timer != null && (clearInterval(this._timer), this._timer = null); + } +}; +const l3 = /* @__PURE__ */ new Map(), f4 = new tfr(); +function PDe(t, e) { + return e == null ? t : `${t}?sliceId=${e}`; +} +function ifr(t, e) { + const i = { extent: null, rasterInfo: e, cache: /* @__PURE__ */ new Map() }, r = l3.get(t); + return r ? (r.push(i), r.length - 1) : (l3.set(t, [i]), 0); +} +function Xst(t, e) { + const i = l3.get(t); + i && (i[e] = null, i.some((r) => r != null) || l3.delete(t)); +} +function rfr(t, e, i) { + const r = l3.get(t); + if (!r) + return e == null ? f4.decreaseRefCount(t, i) : 0; + if (e == null || r[e] == null) + return f4.decreaseRefCount(t, i); + const n = r[e]?.cache, s = n?.get(i); + if (n && s) { + if (s.refCount--, s.refCount === 0) { + n.delete(i); + for (let o = 0; o < r.length; o++) + r[o]?.cache.delete(i); + s.controller && s.controller.abort(); + } + return s.refCount; + } + return 0; +} +function Kst(t, e, i) { + const r = l3.get(t); + if (!r) + return e == null ? f4.getBlock(t, i) : null; + if (e == null || r[e] == null) { + for (let s = 0; s < r.length; s++) { + const o = r[s]?.cache.get(i); + if (o) + return o.refCount++, o.block; + } + return f4.getBlock(t, i); + } + const n = r[e]?.cache.get(i); + if (n) + return n.refCount++, n.block; + for (let s = 0; s < r.length; s++) { + if (s === e || !r[s]) + continue; + const o = r[s]?.cache, a = o?.get(i); + if (o && a) + return a.refCount++, o.set(i, a), a.block; + } + return null; +} +function Jst(t, e, i, r, n = null) { + const s = l3.get(t); + if (!s) + return void (e == null && f4.putBlock(t, i, r, n)); + if (e == null || s[e] == null) + return void f4.putBlock(t, i, r, n); + const o = { refCount: 1, block: r, isResolved: !1, isRejected: !1, controller: n }; + r.then(() => o.isResolved = !0).catch(() => o.isRejected = !0), s[e]?.cache.set(i, o); +} +function nfr(t, e, i) { + const r = l3.get(t); + r ? e != null && r[e] != null ? r[e]?.cache.delete(i) : f4.deleteBlock(t, i) : e == null && f4.deleteBlock(t, i); +} +function sfr(t, e) { + const i = l3.get(t); + return i ? i[e] ?? null : null; +} +function Zst(t, e, i, r, n, s, o = null) { + const a = sfr(t, e); + if (!a) + return; + const l = a.extent, { cache: c, rasterInfo: h } = a; + if (l && l.xmin === i.xmin && l.xmax === i.xmax && l.ymin === i.ymin && l.ymax === i.ymax) + return; + r = r ?? 0; + const p = i.clone().normalize(), { spatialReference: y, transform: v } = h, x = /* @__PURE__ */ new Set(); + for (let I = 0; I < p.length; I++) { + const P = p[I]; + if (P.xmax - P.xmin <= r || P.ymax - P.ymin <= r) + continue; + let F = vF(P, y, o); + _e(v) && (F = v.inverseTransform(F)); + const k = new Xi({ x: r, y: r, spatialReference: P.spatialReference }); + if (n == null && !(n = cee(k, y, P, o))) + return; + const { pyramidLevel: V, pyramidResolution: j, excessiveReading: Y } = YRe(n, h, s || "closest"); + if (Y) + return; + const { storageInfo: X } = h, { origin: Q } = X, re = { x: Math.max(0, Math.floor((F.xmin - Q.x) / j.x)), y: Math.max(0, Math.floor((Q.y - F.ymax) / j.y)) }, he = Math.ceil((F.xmax - F.xmin) / j.x - 0.1), fe = Math.ceil((F.ymax - F.ymin) / j.y - 0.1), be = V > 0 ? X.pyramidBlockWidth : X.blockWidth, Se = V > 0 ? X.pyramidBlockHeight : X.blockHeight, Me = 1, ke = Math.max(0, Math.floor(re.x / be) - Me), J = Math.max(0, Math.floor(re.y / Se) - Me), ce = Math.floor((re.x + he - 1) / be) + Me, xe = Math.floor((re.y + fe - 1) / Se) + Me; + for (let Pe = J; Pe <= xe; Pe++) + for (let Oe = ke; Oe <= ce; Oe++) + x.add(`${V}/${Pe}/${Oe}`); + } + c.forEach((I, P) => { + if (!x.has(P)) { + const F = c.get(P); + (F == null || F.isResolved || F.isRejected) && c.delete(P); + } + }), a.extent = { xmin: i.xmin, ymin: i.ymin, xmax: i.xmax, ymax: i.ymax }; +} +const ofr = [0, 0]; +let mv = class extends aI { + constructor() { + super(...arguments), this._emptyTilePixelBlock = null, this._tileStrategy = null, this._tileInfoView = null, this._fetchQueue = null, this._blockCacheRegistryUrl = null, this._blockCacheRegistryId = null, this._srcResolutions = [], this.previousLOD = null, this._needBlockCacheUpdate = !1, this._globalSymbolizerParams = null, this._symbolizerParams = null, this._abortController = null, this._isCustomTilingScheme = !1, this._rasterFunctionState = "na", this._globalUpdateRequested = !1, this.attached = !1, this.timeExtent = null, this.redrawOrRefetch = Fv(async (e = {}) => { + if (!this.previousLOD || this.layerView.suspended) + return; + const i = this._rasterFunctionState; + e.reprocess && (await this.updatingHandles.addPromise(this.layer.updateRasterFunction()), this.updateRasterFunctionParameters()); + const r = this._rasterFunctionState, { type: n } = this; + return e.refetch || n !== "raster" && e.reprocess || r === "cpu" || i === "cpu" ? this.updatingHandles.addPromise(this.doRefresh()) : this.updatingHandles.addPromise(this._redrawImage(e.signal)); + }); + } + get useWebGLForProcessing() { + return this._get("useWebGLForProcessing") ?? !0; + } + set useWebGLForProcessing(e) { + this._set("useWebGLForProcessing", e); + } + get useProgressiveUpdate() { + return this._get("useProgressiveUpdate") == null || this._get("useProgressiveUpdate"); + } + set useProgressiveUpdate(e) { + if (this._tileStrategy && this.useProgressiveUpdate !== e) { + this._tileStrategy.destroy(), this.container.removeAllChildren(); + const i = this._getCacheSize(e); + this._tileStrategy = new CQ({ cachePolicy: "purge", acquireTile: (r) => this.acquireTile(r), releaseTile: (r) => this.releaseTile(r), cacheSize: i, tileInfoView: this._tileInfoView }), this._set("useProgressiveUpdate", e), this.layerView.requestUpdate(); + } + } + update(e) { + this._fetchQueue.pause(), this._fetchQueue.state = e.state, this._tileStrategy.update(e), this._fetchQueue.resume(); + const { extent: i, resolution: r, scale: n } = e.state, s = this._tileInfoView.getClosestInfoForScale(n); + if (this.layer.raster) { + if (!this.useProgressiveUpdate || this._needBlockCacheUpdate) { + const o = this._srcResolutions[s.level], a = i.toJSON ? i : br.fromJSON(i); + Zst(this._blockCacheRegistryUrl, this._blockCacheRegistryId, a, r, o, this.layer.raster.ioConfig.sampling); + } + this._needBlockCacheUpdate = !1, this.previousLOD?.level !== s.level && (this.previousLOD = s, this._symbolizerParams == null || this.layerView.hasTilingEffects || this._updateSymbolizerParams(), this._tileStrategy.updateCacheSize(0)); + } + } + moveEnd() { + !this.layerView.hasTilingEffects && this.useProgressiveUpdate || (this._abortController && this._abortController.abort(), this._abortController = new AbortController(), this._fetchQueue.length === 0 && this._redrawImage(this._abortController.signal).then(() => { + this._globalUpdateRequested = !1, this.layerView.requestUpdate(); + })); + const e = this._getCacheSize(this.useProgressiveUpdate); + this._tileStrategy.updateCacheSize(e), this.layerView.requestUpdate(); + } + get updating() { + return this._fetchQueue?.updating || this._globalUpdateRequested || !(!this.updatingHandles || !this.updatingHandles.updating); + } + attach() { + hI("2d").supportsTextureFloat || (this.useWebGLForProcessing = !1), this._initializeTileInfo(), this._tileInfoView = new f8(this.layerView.tileInfo, this.layerView.fullExtent); + const e = this._computeFetchConcurrency(); + this._fetchQueue = new fU({ tileInfoView: this._tileInfoView, concurrency: e, process: (r, n) => this._fetchTile1(r, n) }); + const i = this._getCacheSize(this.useProgressiveUpdate); + this._tileStrategy = new CQ({ cachePolicy: "purge", acquireTile: (r) => this.acquireTile(r), releaseTile: (r) => this.releaseTile(r), cacheSize: i, tileInfoView: this._tileInfoView }), this._updateBlockCacheRegistry(); + } + detach() { + this._tileStrategy.destroy(), this._fetchQueue.clear(), this.container.removeAllChildren(), this._fetchQueue = this._tileStrategy = this._tileInfoView = null, Xst(this._blockCacheRegistryUrl, this._blockCacheRegistryId), this._blockCacheRegistryUrl = this._blockCacheRegistryId = null; + } + acquireTile(e) { + const i = this.container.createTile(e); + return this._enqueueTileFetch(i), this.layerView.requestUpdate(), this._needBlockCacheUpdate = !0, this._globalUpdateRequested = this.layerView.hasTilingEffects || !this.useProgressiveUpdate, i; + } + releaseTile(e) { + this._fetchQueue.abort(e.key.id), this.container.removeChild(e), e.once("detach", () => { + e.destroy(), this.layerView.requestUpdate(); + }), this.layerView.requestUpdate(); + } + createEmptyTilePixelBlock(e = null) { + const i = e == null || e.join(",") === this._tileInfoView.tileInfo.size.join(","); + if (i && _e(this._emptyTilePixelBlock)) + return this._emptyTilePixelBlock; + e = e || this._tileInfoView.tileInfo.size; + const [r, n] = e, s = new nn({ width: r, height: n, pixels: [new Uint8Array(r * n)], mask: new Uint8Array(r * n), pixelType: "u8" }); + return i && (this._emptyTilePixelBlock = s), s; + } + _getBandIds() { + if (!("rasterFunctionChain" in this.container) || !this.container.rasterFunctionChain) + return this.layer.bandIds; + const { bandIds: e, raster: i } = this.layer, r = "rasterFunction" in i ? i.rasterFunction.rawInputBandIds : null; + return e?.length && r?.length && i.rasterInfo.bandCount !== 1 ? e.map((n) => r[Math.min(n, r.length - 1)]) : e || r; + } + updateRasterFunctionParameters() { + } + _fetchTile1(e, i) { + const r = _e(i) ? i.signal : null, n = this.canUseWebGLForProcessing(), { layerView: s } = this, { tileInfo: o } = s, a = !o.isWrappable && _e(Av(s.view.spatialReference)), l = n && this.layer.raster.hasUniqueSourceStorageInfo, c = { allowPartialFill: !0, datumTransformation: s.datumTransformation, interpolation: n ? "nearest" : this.layer.interpolation, registryId: this._blockCacheRegistryId, requestRawData: l, skipRasterFunction: this.type === "raster" && this.container.rasterFunctionChain != null, signal: r, srcResolution: this._srcResolutions[e.level], timeExtent: s.timeExtent, tileInfo: o, disableWrapAround: a }; + return this.fetchTile(e, c); + } + _getCacheSize(e) { + return e ? 40 : 0; + } + _initializeTileInfo() { + const { layerView: e } = this, i = e.view.spatialReference, r = new Xi({ x: e.fullExtent.xmin, y: e.fullExtent.ymax, spatialReference: i }); + if (this._canUseLayerLODs()) { + const { lods: l } = this.layer.tileInfo, c = l.map(({ scale: y }) => y), h = Wl.create({ spatialReference: i, size: Sc, scales: c }), p = i.isGeographic ? 0.01 * 1e-5 : 0.01; + if (this._isCustomTilingScheme = Math.abs(h.origin.x - r.x) > p, (h.origin.x === 0 || h.origin.x > r.x) && (h.origin = r), !this._isCustomTilingScheme) { + const y = Wl.create({ spatialReference: i, size: Sc }).lods.map(({ scale: v }) => v); + this._isCustomTilingScheme = c.some((v) => !y.some((x) => Math.abs(x - v) < 1e-3)); + } + return e.set("tileInfo", h), void (this._srcResolutions = l.map(({ resolution: y }) => ({ x: y, y }))); + } + const { scales: n, srcResolutions: s, isCustomTilingScheme: o } = uGi(this.layer.rasterInfo, i, Sc), a = Wl.create({ spatialReference: i, size: Sc, scales: n }); + (a.origin.x === 0 || a.origin.x > r.x) && (a.origin = r), this._isCustomTilingScheme = o, e.set("tileInfo", a), this._srcResolutions = s ?? []; + } + _canUseLayerLODs() { + const { layer: e, layerView: i } = this; + if (e.raster.tileType !== "Map") + return !1; + const { lods: r } = e.tileInfo, n = i.view.constraints?.effectiveLODs; + if (!(n?.length === r.length && n.every(({ scale: o }, a) => Math.abs(o - r[a].scale) < 1e-3))) + return !1; + const s = []; + for (let o = 0; o < r.length - 1; o++) + s.push(Math.round(10 * r[o].resolution / r[o + 1].resolution) / 10); + return s.some((o) => o !== o[0]); + } + _computeFetchConcurrency() { + const { blockBoundary: e } = this.layer.rasterInfo.storageInfo, i = e[e.length - 1]; + return (i.maxCol - i.minCol + 1) * (i.maxRow - i.minRow + 1) > 64 ? 2 : 10; + } + async _enqueueTileFetch(e, i) { + this.updatingHandles.addPromise(this._enqueueTileFetch1(e, i)); + } + async _enqueueTileFetch1(e, i) { + if (!this._fetchQueue.has(e.key.id)) { + try { + const r = await this._fetchQueue.push(e.key), n = this._getBandIds(); + let s = !this.useProgressiveUpdate || this.layerView.hasTilingEffects && !this._globalSymbolizerParams; + if (this._globalUpdateRequested && !this.layerView.moving && this._fetchQueue.length === 0) { + s = !1; + try { + await this._redrawImage(this._abortController?.signal); + } catch (l) { + us(l) && Ei.getLogger(this.declaredClass).error(l); + } + this._globalUpdateRequested = !1; + } + !this.canUseWebGLForProcessing() && this.type !== "rasterVF" || this.layerView.hasTilingEffects || this._symbolizerParams != null || this._updateSymbolizerParams(); + const o = this._tileInfoView.getTileCoords(ofr, e.key), a = this._tileInfoView.getTileResolution(e.key); + await this.updateTileSource(e, { source: r, symbolizerParams: this._symbolizerParams, globalSymbolizerParams: this._globalSymbolizerParams, suspended: s, bandIds: n, coords: o, resolution: a }), e.once("attach", () => this.layerView.requestUpdate()), this.container.addChild(e); + } catch (r) { + us(r) || Ei.getLogger(this.declaredClass).error(r); + } + this.layerView.requestUpdate(); + } + } + async _redrawImage(e) { + if (this.container.children.length === 0) + return; + await this.layer.updateRenderer(), this.layerView.hasTilingEffects ? await this._updateGlobalSymbolizerParams(e) : (this._updateSymbolizerParams(), this._globalSymbolizerParams = null); + const i = this.container.children.map(async (r) => this.updateTileSymbolizerParameters(r, { local: this._symbolizerParams, global: this._globalSymbolizerParams })); + await Nu(i), this.container.requestRender(); + } + async _updateGlobalSymbolizerParams(e) { + const i = { srcResolution: this._srcResolutions[this.previousLOD.level], registryId: this._blockCacheRegistryId, signal: e }, r = await this.layer.fetchPixels(this.layerView.view.extent, this.layerView.view.width, this.layerView.view.height, i); + if (!r || !r.pixelBlock) + return; + const { resolution: n } = this.previousLOD, s = this._getBandIds(), o = this.layer.symbolizer.generateWebGLParameters({ pixelBlock: sde(r.pixelBlock, s), isGCS: this.layerView.view.spatialReference.isGeographic, resolution: { x: n, y: n }, bandIds: s }); + !this.canUseWebGLForProcessing() && o && o.type === "stretch" && this.layer.renderer && this.layer.renderer.type === "raster-stretch" && (o.factor = o.factor.map((a) => 255 * a), o.outMin = Math.round(255 * o.outMin), o.outMax = Math.round(255 * o.outMax)), this._globalSymbolizerParams = o; + } + _updateSymbolizerParams() { + const { resolution: e } = this.previousLOD, i = this._getBandIds(); + this._symbolizerParams = this.layer.symbolizer.generateWebGLParameters({ pixelBlock: null, isGCS: this.layerView.view.spatialReference.isGeographic, resolution: { x: e, y: e }, bandIds: i }); + } + _updateBlockCacheRegistry(e = !1) { + const { layer: i, layerView: r } = this, { url: n, raster: s } = i, { multidimensionalDefinition: o } = i.normalizeRasterFetchOptions({ multidimensionalDefinition: i.multidimensionalDefinition, timeExtent: r.timeExtent }), a = s.rasterInfo.multidimensionalInfo ? s.getSliceIndex(o) : null, l = PDe(n, a); + if (l !== this._blockCacheRegistryUrl) { + if (this._blockCacheRegistryUrl != null && Xst(this._blockCacheRegistryUrl, this._blockCacheRegistryId), this._blockCacheRegistryId = ifr(l, s.rasterInfo), e) { + const { view: c } = r, h = this._tileInfoView.getClosestInfoForScale(c.scale), p = this._srcResolutions[h.level]; + Zst(l, this._blockCacheRegistryId, c.extent, c.resolution, p, s.ioConfig.sampling); + } + this._blockCacheRegistryUrl = l; + } + } + async doRefresh() { + if (!this.attached) + return; + await this.layer.updateRenderer(), this.layerView.hasTilingEffects || this._updateSymbolizerParams(), this._updateBlockCacheRegistry(!0), this._fetchQueue.reset(); + const e = []; + this._globalUpdateRequested = this.layerView.hasTilingEffects || !this.useProgressiveUpdate, this._tileStrategy.tiles.forEach((i) => e.push(this._enqueueTileFetch(i))), await Nu(e); + } +}; +E([N()], mv.prototype, "_fetchQueue", void 0), E([N()], mv.prototype, "_globalUpdateRequested", void 0), E([N()], mv.prototype, "attached", void 0), E([N()], mv.prototype, "container", void 0), E([N()], mv.prototype, "layer", void 0), E([N()], mv.prototype, "layerView", void 0), E([N()], mv.prototype, "type", void 0), E([N()], mv.prototype, "useWebGLForProcessing", null), E([N()], mv.prototype, "useProgressiveUpdate", null), E([N()], mv.prototype, "timeExtent", void 0), E([N()], mv.prototype, "updating", null), mv = E([dt("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")], mv); +let dj = class extends mv { + constructor() { + super(...arguments), this.type = "raster"; + } + attach() { + super.attach(), this.container = new efr(this._tileInfoView), this.container.isCustomTilingScheme = this._isCustomTilingScheme, this.updateRasterFunctionParameters(); + } + detach() { + super.detach(), this.container.removeAllChildren(), this.container = null; + } + canUseWebGLForProcessing() { + return this.useWebGLForProcessing && this.layer.symbolizer.canRenderInWebGL && !(this.layer.interpolation === "majority" && QDt(this.layer)); + } + fetchTile(e, i) { + return this.layer.fetchTile(e.level, e.row, e.col, i); + } + updateRasterFunctionParameters() { + const { raster: e, type: i } = this.layer, { container: r } = this; + if (e.datasetFormat !== "Function" || i === "wcs") + return r.rasterFunctionChain = null, r.children.forEach((y) => { + const { bitmap: v } = y; + v && (v.suspended = !0, v.processed = !1, v.projected && (v.invalidateTexture(), v.rasterTexture = null)); + }), void (this._rasterFunctionState = "na"); + const n = this._rasterFunctionState, { rasterFunction: s, primaryRasters: o } = e, a = s.supportsGPU && (!o || o.rasters.length <= 1), l = a ? s.getFlatWebGLFunctionChain() : null, { renderer: c } = this.layer, h = !a || !l?.functions.length || c.type === "raster-stretch" && c.dynamicRangeAdjustment || !this.canUseWebGLForProcessing(); + r.rasterFunctionChain = h ? null : l; + const p = s == null ? "na" : r.rasterFunctionChain ? "gpu" : "cpu"; + r.children.forEach((y) => { + const { bitmap: v } = y; + v && (v.suspended = n !== p, v.processed = !1, v.processedTexture = null); + }), this._rasterFunctionState = p; + } + async updateTileSource(e, i) { + const r = this._getBandIds(), n = this._getLayerInterpolation(), s = this.canUseWebGLForProcessing(), { source: o, globalSymbolizerParams: a, suspended: l, coords: c, resolution: h } = i, p = this.layerView.hasTilingEffects ? a : i.symbolizerParams, { bitmap: y } = e; + if ([y.x, y.y] = c, y.resolution = h, o && _e(o) && _e(o.pixelBlock)) { + const v = { extent: o.extent, pixelBlock: o.pixelBlock }; + if (y.rawPixelData = v, s) + y.source = o.pixelBlock, y.isRendereredSource = !1; + else { + const x = await this.layer.applyRenderer(v, a?.type === "stretch" ? a : void 0); + y.source = x, y.isRendereredSource = !0; + } + y.symbolizerParameters = s ? p : null, s ? y.transformGrid || (y.transformGrid = o.transformGrid) : y.transformGrid = null; + } else { + const v = this.createEmptyTilePixelBlock(); + y.source = v, y.symbolizerParameters = s ? p : null, y.transformGrid = null; + } + y.bandIds = s ? r : null, y.width = this._tileInfoView.tileInfo.size[0], y.height = this._tileInfoView.tileInfo.size[1], y.interpolation = n, y.suspended = l, y.invalidateTexture(); + } + async updateTileSymbolizerParameters(e, i) { + const { local: r, global: n } = i, s = this._getBandIds(), o = this._getLayerInterpolation(), a = this.canUseWebGLForProcessing(), { bitmap: l } = e, { rawPixelData: c } = l; + !a && _e(c) ? (l.source = await this.layer.applyRenderer(c, n?.type === "stretch" ? n : void 0), l.isRendereredSource = !0) : (l.isRendereredSource && _e(c) && (l.source = c.pixelBlock), l.isRendereredSource = !1), l.symbolizerParameters = a ? this.layerView.hasTilingEffects ? n : r : null, l.bandIds = a ? s : null, l.interpolation = o, l.suspended = !1; + } + _getLayerInterpolation() { + const e = this.layer.renderer.type; + if (e === "raster-colormap" || e === "unique-value" || e === "class-breaks") + return "nearest"; + const { interpolation: i } = this.layer, { renderer: r } = this.layer; + return r.type === "raster-stretch" && r.colorRamp != null ? i === "bilinear" || i === "cubic" ? "bilinear" : "nearest" : i; + } +}; +E([N()], dj.prototype, "container", void 0), E([N()], dj.prototype, "layer", void 0), E([N()], dj.prototype, "type", void 0), dj = E([dt("esri.views.2d.layers.imagery.ImageryTileView2D")], dj); +const afr = dj; +let lfr = class extends cH { + constructor(e, i, r, n, s, o, a = null) { + super(e, i, r, n, s, o), this.tileData = new TFt(a), this.tileData.coordScale = [s, o], this.tileData.once("isReady", () => this.ready()); + } + destroy() { + super.destroy(), this.tileData.destroy(), this.tileData = null, this.stage = null; + } + set stencilRef(e) { + this.tileData.stencilRef = e; + } + get stencilRef() { + return this.tileData.stencilRef; + } + _createTransforms() { + return { dvs: Ml(), tileMat3: Ml() }; + } + setTransform(e) { + super.setTransform(e); + const i = this.resolution / (e.resolution * e.pixelRatio), r = this.transforms.tileMat3, [n, s] = this.tileData.offset, o = [this.x + n * this.resolution, this.y - s * this.resolution], [a, l] = e.toScreenNoRotation([0, 0], o), { symbolTileSize: c } = this.tileData.symbolizerParameters, h = Math.round((this.width - this.tileData.offset[0]) / c) * c, p = Math.round((this.height - this.tileData.offset[1]) / c) * c, y = h / this.rangeX * i, v = p / this.rangeY * i; + x$(r, y, 0, 0, 0, v, 0, a, l, 1), kv(this.transforms.dvs, e.displayViewMat3, r), this.tileData.transforms.dvs = this.transforms.dvs; + } + onAttach() { + this.tileData.stage = this.stage; + } + onDetach() { + this.tileData.stage = null; + } +}, ufr = class extends lre { + constructor() { + super(...arguments), this.isCustomTilingScheme = !1, this.symbolTypes = ["triangle"]; + } + createTile(e) { + const i = this._tileInfoView.getTileBounds(Eo(), e), [r, n] = this._tileInfoView.tileInfo.size, s = this._tileInfoView.getTileResolution(e.level); + return new lfr(e, s, i[0], i[3], r, n); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "imagery (vf tile)", brushes: [CFt], target: () => this.children.map((r) => r.tileData), drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + doRender(e) { + this.visible && e.drawPhase === lo.MAP && this.symbolTypes.forEach((i) => { + e.renderPass = i, super.doRender(e); + }); + } +}, pj = class extends mv { + constructor() { + super(...arguments), this._handle = null, this.type = "rasterVF"; + } + canUseWebGLForProcessing() { + return !1; + } + async fetchTile(e, i) { + i = { ...i, interpolation: "nearest", requestProjectedLocalDirections: !0 }; + const r = await this.layer.fetchTile(e.level, e.row, e.col, i); + return this.layer.rasterInfo.dataType === "vector-magdir" && r?.pixelBlock && (r.pixelBlock = await this.layer.convertVectorFieldData(r.pixelBlock, i)), r; + } + updateTileSource(e, i) { + const r = i.symbolizerParams, { tileData: n } = e; + n.key = e.key, n.width = this._tileInfoView.tileInfo.size[0], n.height = this._tileInfoView.tileInfo.size[1]; + const { symbolTileSize: s } = r, { source: o } = i; + if (n.offset = this._getTileSymbolOffset(n.key, s), _e(o) && _e(o.pixelBlock)) { + const a = { extent: o.extent, pixelBlock: o.pixelBlock }; + n.rawPixelData = a, n.symbolizerParameters = r, n.source = this._sampleVectorFieldData(o.pixelBlock, r, n.offset); + } else { + const a = [Math.round((this._tileInfoView.tileInfo[0] - n.offset[0]) / s), Math.round((this._tileInfoView.tileInfo[1] - n.offset[1]) / s)], l = this.createEmptyTilePixelBlock(a); + n.source = l, n.symbolizerParameters = r; + } + return n.invalidateVAO(), Promise.resolve(); + } + updateTileSymbolizerParameters(e, i) { + const r = i.local, { symbolTileSize: n } = r, { tileData: s } = e; + s.offset = this._getTileSymbolOffset(s.key, n); + const o = s.symbolizerParameters.symbolTileSize; + s.symbolizerParameters = r; + const a = s.rawPixelData?.pixelBlock; + return _e(a) && o !== n && (s.source = this._sampleVectorFieldData(a, s.symbolizerParameters, s.offset)), Promise.resolve(); + } + attach() { + super.attach(), this.container = new ufr(this._tileInfoView), this.container.isCustomTilingScheme = this._isCustomTilingScheme, this._updateSymbolType(this.layer.renderer), this._handle = Qi(() => this.layer.renderer, (e) => this._updateSymbolType(e)); + } + detach() { + super.detach(), this.container.removeAllChildren(), this._handle?.remove(), this._handle = null, this.container = null; + } + _getTileSymbolOffset(e, i) { + const r = e.col * this._tileInfoView.tileInfo.size[0] % i, n = e.row * this._tileInfoView.tileInfo.size[1] % i; + return [r > i / 2 ? i - r : -r, n > i / 2 ? i - n : -n]; + } + _sampleVectorFieldData(e, i, r) { + const { symbolTileSize: n } = i; + return KJt(e, "vector-uv", n, r); + } + _updateSymbolType(e) { + e.type === "vector-field" && (this.container.symbolTypes = e.style === "wind-barb" ? ["scalar", "triangle"] : e.style === "simple-scalar" ? ["scalar"] : ["triangle"]); + } +}; +E([N()], pj.prototype, "container", void 0), E([N()], pj.prototype, "layer", void 0), E([N()], pj.prototype, "type", void 0), pj = E([dt("esri.views.2d.layers.imagery.VectorFieldTileView2D")], pj); +const cfr = pj, hfr = (t) => { + let e = class extends t { + constructor() { + super(...arguments), this._rasterFieldPrefix = "Raster.", this.layer = null, this.view = null, this.tileInfo = null; + } + get fullExtent() { + return this._getfullExtent(); + } + _getfullExtent() { + return this.projectFullExtent(this.view.spatialReference); + } + get hasTilingEffects() { + return this.layer.renderer && "dynamicRangeAdjustment" in this.layer.renderer && this.layer.renderer.dynamicRangeAdjustment; + } + get datumTransformation() { + return yQe(this.layer.fullExtent, this.view.spatialReference, !0); + } + supportsSpatialReference(i) { + return !!this.projectFullExtent(i); + } + projectFullExtent(i) { + const r = this.layer.fullExtent, n = yQe(r, i, !1); + return vF(r, i, n); + } + async fetchPopupFeatures(i, r) { + const { layer: n } = this; + if (!i) + throw new ot("imageryTileLayerView:fetchPopupFeatures", "Nothing to fetch without area", { layer: n }); + const { popupEnabled: s } = n, o = bF(n, r); + if (!s || ut(o)) + throw new ot("imageryTileLayerView:fetchPopupFeatures", "Missing required popupTemplate or popupEnabled", { popupEnabled: s, popupTemplate: o }); + const a = [], { value: l, magdirValue: c } = await n.identify(i, { timeExtent: this.timeExtent }); + let h = ""; + if (l && l.length) { + h = n.type === "imagery-tile" && n.hasStandardTime() && l[0] != null ? l.map((I) => n.getStandardTimeValue(I)).join(", ") : l.join(", "); + const p = { ObjectId: 0 }; + p["Raster.ServicePixelValue"] = h; + const y = n.rasterInfo.attributeTable; + if (_e(y)) { + const { fields: I, features: P } = y, F = I.find(({ name: V }) => V.toLowerCase() === "value"), k = F ? P.find((V) => String(V.attributes[F.name]) === h) : null; + if (k) + for (const V in k.attributes) + k.attributes.hasOwnProperty(V) && (p[this._rasterFieldPrefix + V] = k.attributes[V]); + } + const v = n.rasterInfo.dataType; + v !== "vector-magdir" && v !== "vector-uv" || (p["Raster.Magnitude"] = c?.[0], p["Raster.Direction"] = c?.[1]); + const x = new ro(this.fullExtent.clone(), null, p); + x.layer = n, x.sourceLayer = x.layer, a.push(x); + } + return a; + } + }; + return E([N()], e.prototype, "layer", void 0), E([N(Pz)], e.prototype, "timeExtent", void 0), E([N()], e.prototype, "view", void 0), E([N()], e.prototype, "fullExtent", null), E([N()], e.prototype, "tileInfo", void 0), E([N({ readOnly: !0 })], e.prototype, "hasTilingEffects", null), E([N()], e.prototype, "datumTransformation", null), e = E([dt("esri.views.layers.ImageryTileLayerView")], e), e; +}; +let fj = class extends hfr(eL(ky($y))) { + constructor() { + super(...arguments), this._useWebGLForProcessing = !0, this._useProgressiveUpdate = !0, this.subview = null; + } + get useWebGLForProcessing() { + return this._useWebGLForProcessing; + } + set useWebGLForProcessing(e) { + this._useWebGLForProcessing = e, this.subview && "useWebGLForProcessing" in this.subview && (this.subview.useWebGLForProcessing = e); + } + get useProgressiveUpdate() { + return this._useWebGLForProcessing; + } + set useProgressiveUpdate(e) { + this._useProgressiveUpdate = e, this.subview && "useProgressiveUpdate" in this.subview && (this.subview.useProgressiveUpdate = e); + } + update(e) { + this.subview?.update(e), this.notifyChange("updating"); + } + isUpdating() { + return !this.subview || this.subview.updating; + } + attach() { + this.layer.increaseRasterJobHandlerUsage(), this._updateSubview(), this.addAttachHandles([Qi(() => { + const { layer: e } = this; + return { bandIds: e.bandIds, renderer: e.renderer, interpolation: e.interpolation, multidimensionalDefinition: e.multidimensionalDefinition, rasterFunction: e.type === "imagery-tile" ? e.rasterFunction : null }; + }, (e, i) => { + const r = e.interpolation !== i?.interpolation && (e.interpolation === "majority" || i?.interpolation === "majority") && QDt(this.layer), n = e.renderer !== i?.renderer && i?.renderer?.type !== e.renderer?.type; + n && this._updateSubview(); + const s = e.multidimensionalDefinition !== i?.multidimensionalDefinition, o = e.rasterFunction !== i?.rasterFunction, a = o && !this._useWebGLForProcessing, l = s || r || n || a; + this.subview.redrawOrRefetch({ refetch: l, reprocess: o }).catch((c) => { + us(c) || Ei.getLogger(this.declaredClass).error(c); + }), this.notifyChange("updating"); + }), Qi(() => this.layer.blendMode ?? "normal", (e) => { + this.subview.container.blendMode = e; + }, id), Qi(() => this.layer.effect ?? null, (e) => { + this.subview.container.effect = e; + }, id), Qi(() => this.layer.multidimensionalSubset ?? null, (e, i) => { + const { multidimensionalDefinition: r } = this.layer; + _e(r) && dQ(r, e) !== dQ(r, i) && (this.subview.redrawOrRefetch({ refetch: !0 }).catch((n) => { + us(n) || Ei.getLogger(this.declaredClass).error(n); + }), this.notifyChange("updating")); + }, Uu), Qi(() => this.timeExtent, () => { + this.subview.timeExtent = this.timeExtent, this.subview.redrawOrRefetch({ refetch: !0 }).catch((e) => { + us(e) || Ei.getLogger(this.declaredClass).error(e); + }); + }, jo)]); + } + detach() { + this.layer.decreaseRasterJobHandlerUsage(), this._detachSubview(this.subview), this.subview?.destroy(), this.subview = null; + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this.subview.moveEnd(); + } + async hitTest(e, i) { + return [{ type: "graphic", layer: this.layer, mapPoint: e, graphic: new ro({ attributes: {}, geometry: e.clone() }) }]; + } + doRefresh() { + return this.subview ? this.subview.doRefresh() : Promise.resolve(); + } + _updateSubview() { + const e = this.layer.renderer.type === "vector-field" ? "rasterVF" : this.layer.renderer.type === "flow" ? "flow" : "raster"; + if (this.subview) { + if (this.subview.type === e) + return void this._attachSubview(this.subview); + this._detachSubview(this.subview), this.subview?.destroy(), this.subview = null; + } + const { layer: i } = this; + let r; + if (r = e === "rasterVF" ? new cfr({ layer: i, layerView: this }) : e === "flow" ? new SFt({ layer: i, layerView: this }) : new afr({ layer: i, layerView: this }), "useWebGLForProcessing" in r && (r.useWebGLForProcessing = this._useWebGLForProcessing), "useProgressiveUpdate" in r && (r.useProgressiveUpdate = this._useProgressiveUpdate), "previousLOD" in r) { + const { subview: n } = this; + r.previousLOD = n && "previousLOD" in n ? n.previousLOD : null; + } + this._attachSubview(r), this.subview = r, this.requestUpdate(); + } + _attachSubview(e) { + e && !e.attached && (e.attach(), e.attached = !0, this.container.addChildAt(e.container, 0), e.container.blendMode = this.layer.blendMode, e.container.effect = this.layer.effect); + } + _detachSubview(e) { + e?.attached && (this.container.removeChild(e.container), e.detach(), e.attached = !1); + } +}; +E([N()], fj.prototype, "subview", void 0), E([N()], fj.prototype, "useWebGLForProcessing", null), E([N()], fj.prototype, "useProgressiveUpdate", null), fj = E([dt("esri.views.2d.layers.ImageryTileLayerView2D")], fj); +const dfr = fj, Qst = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: dfr +}, Symbol.toStringTag, { value: "Module" })), pfr = { esriGeometryPoint: "points", esriGeometryPolyline: "polylines", esriGeometryPolygon: "polygons" }; +function Q9e(t) { + const e = t.folders || [], i = e.slice(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = { esriGeometryPoint: n, esriGeometryPolyline: s, esriGeometryPolygon: o }; + (t.featureCollection && t.featureCollection.layers || []).forEach((h) => { + const p = fi(h); + p.featureSet.features = []; + const y = h.featureSet.geometryType; + r.set(y, p); + const v = h.layerDefinition.objectIdField; + y === "esriGeometryPoint" ? B2e(n, v, h.featureSet.features) : y === "esriGeometryPolyline" ? B2e(s, v, h.featureSet.features) : y === "esriGeometryPolygon" && B2e(o, v, h.featureSet.features); + }), t.groundOverlays && t.groundOverlays.forEach((h) => { + a.set(h.id, h); + }), e.forEach((h) => { + h.networkLinkIds.forEach((p) => { + const y = mfr(p, h.id, t.networkLinks); + y && i.push(y); + }); + }), i.forEach((h) => { + if (h.featureInfos) { + h.points = fi(r.get("esriGeometryPoint")), h.polylines = fi(r.get("esriGeometryPolyline")), h.polygons = fi(r.get("esriGeometryPolygon")), h.mapImages = []; + for (const p of h.featureInfos) + switch (p.type) { + case "esriGeometryPoint": + case "esriGeometryPolyline": + case "esriGeometryPolygon": { + const y = l[p.type].get(p.id); + y && h[pfr[p.type]].featureSet.features.push(y); + break; + } + case "GroundOverlay": { + const y = a.get(p.id); + y && h.mapImages.push(y); + break; + } + } + h.fullExtent = ODe([h]); + } + }); + const c = ODe(i); + return { folders: e, sublayers: i, extent: c }; +} +function eBe(t, e, i, r) { + const n = $o && $o.findCredential(t); + t = M0(t, { token: n && n.token }); + const s = ua.kmlServiceUrl; + return ir(s, { query: { url: t, model: "simple", folders: "", refresh: i !== 0 || void 0, outSR: JSON.stringify(e) }, responseType: "json", signal: r }); +} +function OFt(t, e, i = null, r = []) { + const n = [], s = {}, o = e.sublayers, a = e.folders.map((l) => l.id); + return o.forEach((l) => { + const c = new t(); + if (i ? c.read(l, i) : c.read(l), r.length && a.includes(c.id) && (c.visible = r.includes(c.id)), s[l.id] = c, l.parentFolderId != null && l.parentFolderId !== -1) { + const h = s[l.parentFolderId]; + h.sublayers || (h.sublayers = []), h.sublayers?.unshift(c); + } else + n.unshift(c); + }), n; +} +function B2e(t, e, i) { + i.forEach((r) => { + t.set(r.attributes[e], r); + }); +} +function ffr(t, e) { + let i; + return e.some((r) => r.id === t && (i = r, !0)), i; +} +function mfr(t, e, i) { + const r = ffr(t, i); + return r && (r.parentFolderId = e, r.networkLink = r), r; +} +async function V2e(t) { + const e = sc.fromJSON(t.featureSet).features, i = t.layerDefinition, r = MF(i.drawingInfo.renderer), n = $h.fromJSON(t.popupInfo), s = []; + for (const o of e) { + const a = await r.getSymbolAsync(o); + o.symbol = a, o.popupTemplate = n, o.visible = !0, s.push(o); + } + return s; +} +function ODe(t) { + const e = Sx(VG), i = Sx(VG); + for (const r of t) { + if (r.polygons && r.polygons.featureSet && r.polygons.featureSet.features) + for (const n of r.polygons.featureSet.features) + Nne(e, n.geometry), cY(i, e); + if (r.polylines && r.polylines.featureSet && r.polylines.featureSet.features) + for (const n of r.polylines.featureSet.features) + Nne(e, n.geometry), cY(i, e); + if (r.points && r.points.featureSet && r.points.featureSet.features) + for (const n of r.points.featureSet.features) + Nne(e, n.geometry), cY(i, e); + if (r.mapImages) + for (const n of r.mapImages) + Nne(e, n.extent), cY(i, e); + } + return P7t(i, VG) ? void 0 : { xmin: i[0], ymin: i[1], zmin: i[2], xmax: i[3], ymax: i[4], zmax: i[5], spatialReference: or.WGS84 }; +} +let RFt = class vP { + constructor(e) { + if (this._ownsRctx = !1, e) + this._ownsRctx = !1, this._rctx = e; + else { + if (vP._instance) + return vP._instanceRefCount++, vP._instance; + vP._instanceRefCount = 1, vP._instance = this, this._ownsRctx = !0; + const n = document.createElement("canvas").getContext("webgl"); + n.getExtension("OES_texture_float"), this._rctx = new cDt(n, {}); + } + const i = { applyProjection: !0, bilinear: !1, bicubic: !1 }, r = ZMe("raster/reproject", "raster/reproject", /* @__PURE__ */ new Map([["a_position", 0]]), i); + this._program = this._rctx.programCache.acquire(r.shaders.vertexShader, r.shaders.fragmentShader, r.attributes), this._rctx.useProgram(this._program), this._program.setUniform1f("u_opacity", 1), this._program.setUniform1i("u_image", 0), this._program.setUniform1i("u_flipY", 0), this._program.setUniform1i("u_transformGrid", 1), this._quad = new kx(this._rctx, [0, 0, 1, 0, 0, 1, 1, 1]); + } + reprojectTexture(e, i, r = !1) { + const n = Ip(e.extent, i), s = new Xi({ x: (e.extent.xmax - e.extent.xmin) / e.texture.descriptor.width, y: (e.extent.ymax - e.extent.ymin) / e.texture.descriptor.height, spatialReference: e.extent.spatialReference }), { x: o, y: a } = cee(s, i, e.extent); + let l = (o + a) / 2; + const c = Math.round((n.xmax - n.xmin) / l), h = Math.round((n.ymax - n.ymin) / l); + l = (n.width / c + n.height / h) / 2; + const p = new Xi({ x: l, y: l, spatialReference: n.spatialReference }), y = U8e({ projectedExtent: n, srcBufferExtent: e.extent, pixelSize: p, hasWrapAround: !0, spacing: [16, 16] }), v = EFt(this._rctx, y), x = new Ts(this._rctx, { width: c, height: h, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, hasMipmap: !1 }), I = new cd(this._rctx, { colorTarget: Fh.TEXTURE, depthStencilTarget: xl.NONE, width: c, height: h }, x); + this._rctx.bindFramebuffer(I), this._rctx.setViewport(0, 0, c, h), this._rctx.useProgram(this._program), this._rctx.bindTexture(e.texture, 0), this._rctx.bindTexture(v, 1), this._quad.bind(); + const { width: P = 0, height: F = 0 } = e.texture.descriptor; + if (this._program.setUniform2f("u_srcImageSize", P, F), this._program.setUniform2fv("u_transformSpacing", y.spacing), this._program.setUniform2fv("u_transformGridSize", y.size), this._program.setUniform2f("u_targetImageSize", c, h), this._quad.draw(), this._quad.unbind(), this._rctx.useProgram(null), this._rctx.bindFramebuffer(null), v.dispose(), r) { + const { width: k = 0, height: V = 0 } = I.descriptor, j = new ImageData(k, V); + return I.readPixels(0, 0, k, V, cn.RGBA, rs.UNSIGNED_BYTE, j.data), I.detachColorTexture(xv.COLOR_ATTACHMENT0), I.dispose(), { texture: x, extent: n, imageData: j }; + } + return I.detachColorTexture(xv.COLOR_ATTACHMENT0), I.dispose(), { texture: x, extent: n }; + } + reprojectBitmapData(e, i) { + const r = lFt(e.bitmapData) ? uFt(e.bitmapData) : e.bitmapData, n = new Ts(this._rctx, { width: e.bitmapData.width, height: e.bitmapData.height, pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, samplingMode: _n.LINEAR, hasMipmap: !1 }, r), s = this.reprojectTexture({ texture: n, extent: e.extent }, i, !0); + s.texture.dispose(); + const o = document.createElement("canvas"), a = s.imageData; + return o.width = a.width, o.height = a.height, o.getContext("2d").putImageData(a, 0, 0), { bitmapData: o, extent: s.extent }; + } + async loadAndReprojectBitmapData(e, i, r) { + const n = (await ir(e, { responseType: "image" })).data, s = document.createElement("canvas"); + s.width = n.width, s.height = n.height; + const o = s.getContext("2d"); + o.drawImage(n, 0, 0); + const a = o.getImageData(0, 0, s.width, s.height); + if (i.spatialReference.equals(r)) + return { bitmapData: a, extent: i }; + const l = this.reprojectBitmapData({ bitmapData: a, extent: i }, r); + return { bitmapData: l.bitmapData, extent: l.extent }; + } + destroy() { + this._ownsRctx ? (vP._instanceRefCount--, vP._instanceRefCount === 0 && (this._quad.dispose(), this._program.dispose(), this._rctx.dispose(), vP._instance = null)) : (this._quad.dispose(), this._program.dispose()); + } +}; +RFt._instanceRefCount = 0; +let eot = class { + constructor() { + this.allSublayers = /* @__PURE__ */ new Map(), this.allPoints = [], this.allPolylines = [], this.allPolygons = [], this.allMapImages = []; + } +}, ek = class extends ky($y) { + constructor() { + super(...arguments), this._bitmapIndex = /* @__PURE__ */ new Map(), this._mapImageContainer = new sz(), this._kmlVisualData = new eot(), this._fetchController = null, this.allVisiblePoints = new Ob(), this.allVisiblePolylines = new Ob(), this.allVisiblePolygons = new Ob(), this.allVisibleMapImages = new gr(); + } + async hitTest(e, i) { + const r = this.layer; + return [this._pointsView?.hitTest(e), this._polylinesView?.hitTest(e), this._polygonsView?.hitTest(e)].flat().filter(Boolean).map((n) => (n.layer = r, n.sourceLayer = r, { type: "graphic", graphic: n, layer: r, mapPoint: e })); + } + update(e) { + this._polygonsView && this._polygonsView.processUpdate(e), this._polylinesView && this._polylinesView.processUpdate(e), this._pointsView && this._pointsView.processUpdate(e); + } + attach() { + this._fetchController = new AbortController(), this.container.addChild(this._mapImageContainer), this._polygonsView = new _x({ view: this.view, graphics: this.allVisiblePolygons, requestUpdateCallback: () => this.requestUpdate(), container: new $O(this.view.featuresTilingScheme) }), this.container.addChild(this._polygonsView.container), this._polylinesView = new _x({ view: this.view, graphics: this.allVisiblePolylines, requestUpdateCallback: () => this.requestUpdate(), container: new $O(this.view.featuresTilingScheme) }), this.container.addChild(this._polylinesView.container), this._pointsView = new _x({ view: this.view, graphics: this.allVisiblePoints, requestUpdateCallback: () => this.requestUpdate(), container: new $O(this.view.featuresTilingScheme) }), this.container.addChild(this._pointsView.container), this.addAttachHandles([this.allVisibleMapImages.on("change", (e) => { + e.added.forEach((i) => this._addMapImage(i)), e.removed.forEach((i) => this._removeMapImage(i)); + }), Qi(() => this.layer.visibleSublayers, (e) => { + for (const [i, r] of this._kmlVisualData.allSublayers) + r.visibility = 0; + for (const i of e) { + const r = this._kmlVisualData.allSublayers.get(i.id); + r && (r.visibility = 1); + } + this._refreshCollections(); + })]), this.updatingHandles.addPromise(this._fetchService(this._fetchController.signal)), this._imageReprojector = new RFt(); + } + detach() { + this._fetchController = J6(this._fetchController), this._mapImageContainer.removeAllChildren(), this.container.removeAllChildren(), this._bitmapIndex.clear(), this._polygonsView = la(this._polygonsView), this._polylinesView = la(this._polylinesView), this._pointsView = la(this._pointsView), this._imageReprojector = la(this._imageReprojector); + } + moveStart() { + } + viewChange() { + this._polygonsView.viewChange(), this._polylinesView.viewChange(), this._pointsView.viewChange(); + } + moveEnd() { + } + isUpdating() { + return this._pointsView.updating || this._polygonsView.updating || this._polylinesView.updating; + } + _addMapImage(e) { + (this.view.spatialReference?.isWGS84 || this.view.spatialReference?.isWebMercator) && this._imageReprojector.loadAndReprojectBitmapData(e.href, br.fromJSON(e.extent), this.view.spatialReference).then((i) => { + const r = new q9e(i.bitmapData, { immutable: !1, requestRenderOnSourceChangedEnabled: !0 }); + r.x = i.extent.xmin, r.y = i.extent.ymax, r.resolution = i.extent.width / i.bitmapData.width, r.rotation = e.rotation, this._mapImageContainer.addChild(r), this._bitmapIndex.set(e, r); + }); + } + async _getViewDependentUrl(e, i) { + const { viewFormat: r, viewBoundScale: n, httpQuery: s } = e; + if (_e(r)) { + if (ut(i)) + throw new Error("Loading this network link requires a view state."); + let o; + if (await qS(), _e(n) && n !== 1) { + const j = new br(i.extent); + j.expand(n), o = j; + } else + o = i.extent; + o = Ip(o, or.WGS84); + const a = Ip(o, or.WebMercator), l = o.xmin, c = o.xmax, h = o.ymin, p = o.ymax, y = i.size[0] * i.pixelRatio, v = i.size[1] * i.pixelRatio, x = Math.max(a.width, a.height), I = { "[bboxWest]": l.toString(), "[bboxEast]": c.toString(), "[bboxSouth]": h.toString(), "[bboxNorth]": p.toString(), "[lookatLon]": o.center.x.toString(), "[lookatLat]": o.center.y.toString(), "[lookatRange]": x.toString(), "[lookatTilt]": "0", "[lookatHeading]": i.rotation.toString(), "[lookatTerrainLon]": o.center.x.toString(), "[lookatTerrainLat]": o.center.y.toString(), "[lookatTerrainAlt]": "0", "[cameraLon]": o.center.x.toString(), "[cameraLat]": o.center.y.toString(), "[cameraAlt]": x.toString(), "[horizFov]": "60", "[vertFov]": "60", "[horizPixels]": y.toString(), "[vertPixels]": v.toString(), "[terrainEnabled]": "0", "[clientVersion]": Fte, "[kmlVersion]": "2.2", "[clientName]": "ArcGIS API for JavaScript", "[language]": "en-US" }, P = (j) => { + for (const Y in j) + for (const X in I) + j[Y] = j[Y].replace(X, I[X]); + }, F = LD(r); + P(F); + let k = {}; + _e(s) && (k = LD(s), P(k)); + const V = mh(e.href); + return V.query = { ...V.query, ...F, ...k }, `${V.path}?${c1(F)}`; + } + return e.href; + } + async _fetchService(e) { + const i = new eot(); + await this._loadVisualData(this.layer.url, i, e), this._kmlVisualData = i, this._refreshCollections(); + } + _refreshCollections() { + this.allVisiblePoints.removeAll(), this.allVisiblePolylines.removeAll(), this.allVisiblePolygons.removeAll(), this.allVisibleMapImages.removeAll(), this.allVisiblePoints.addMany(this._kmlVisualData.allPoints.filter((e) => this._isSublayerVisible(e.sublayerId)).map(({ item: e }) => e)), this.allVisiblePolylines.addMany(this._kmlVisualData.allPolylines.filter((e) => this._isSublayerVisible(e.sublayerId)).map(({ item: e }) => e)), this.allVisiblePolygons.addMany(this._kmlVisualData.allPolygons.filter((e) => this._isSublayerVisible(e.sublayerId)).map(({ item: e }) => e)), this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter((e) => this._isSublayerVisible(e.sublayerId)).map(({ item: e }) => e)); + } + _isSublayerVisible(e) { + const i = this._kmlVisualData.allSublayers.get(e); + return !!i?.visibility && (i.parentFolderId === -1 || this._isSublayerVisible(i.parentFolderId)); + } + _loadVisualData(e, i, r) { + return this._fetchParsedKML(e, r).then(async (n) => { + for (const s of n.sublayers) { + i.allSublayers.set(s.id, s); + const o = s.points ? await V2e(s.points) : [], a = s.polylines ? await V2e(s.polylines) : [], l = s.polygons ? await V2e(s.polygons) : [], c = s.mapImages || []; + if (i.allPoints.push(...o.map((h) => ({ item: h, sublayerId: s.id }))), i.allPolylines.push(...a.map((h) => ({ item: h, sublayerId: s.id }))), i.allPolygons.push(...l.map((h) => ({ item: h, sublayerId: s.id }))), i.allMapImages.push(...c.map((h) => ({ item: h, sublayerId: s.id }))), s.networkLink) { + const h = await this._getViewDependentUrl(s.networkLink, this.view.state); + await this._loadVisualData(h, i, r); + } + } + }); + } + _fetchParsedKML(e, i) { + return eBe(e, this.layer.spatialReference, this.layer.refreshInterval, i).then((r) => Q9e(r.data)); + } + _removeMapImage(e) { + const i = this._bitmapIndex.get(e); + i && (this._mapImageContainer.removeChild(i), this._bitmapIndex.delete(e)); + } +}; +E([N()], ek.prototype, "_pointsView", void 0), E([N()], ek.prototype, "_polylinesView", void 0), E([N()], ek.prototype, "_polygonsView", void 0), E([N()], ek.prototype, "updating", void 0), ek = E([dt("esri.views.2d.layers.KMLLayerView2D")], ek); +const gfr = ek, yfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: gfr +}, Symbol.toStringTag, { value: "Module" })); +let uK = class extends ky($y) { + constructor(e) { + super(e), this.layerViews = new gr(); + } + set layerViews(e) { + this._set("layerViews", $g(e, this._get("layerViews"))); + } + get updatingProgress() { + return this.layerViews.length === 0 ? 1 : this.layerViews.reduce((e, i) => e + i.updatingProgress, 0) / this.layerViews.length; + } + attach() { + this._updateStageChildren(), this.addAttachHandles(this.layerViews.on("after-changes", () => this._updateStageChildren())); + } + detach() { + this.container.removeAllChildren(); + } + update(e) { + } + moveStart() { + } + viewChange() { + } + moveEnd() { + } + _updateStageChildren() { + this.container.removeAllChildren(), this.layerViews.forEach((e, i) => this.container.addChildAt(e.container, i)); + } +}; +E([N({ cast: fz })], uK.prototype, "layerViews", null), E([N({ readOnly: !0 })], uK.prototype, "updatingProgress", null), uK = E([dt("esri.views.2d.layers.KnowledgeGraphLayerView2D")], uK); +const vfr = uK, tot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: vfr +}, Symbol.toStringTag, { value: "Module" })), _fr = (t) => { + let e = class extends t { + initialize() { + this.exportImageParameters = new A_({ layer: this.layer }); + } + destroy() { + this.exportImageParameters.destroy(), this.exportImageParameters = null; + } + get floors() { + return this.view?.floors ?? null; + } + get exportImageVersion() { + return this.exportImageParameters?.commitProperty("version"), this.commitProperty("timeExtent"), this.commitProperty("floors"), (this._get("exportImageVersion") || 0) + 1; + } + canResume() { + return !!super.canResume() && !this.timeExtent?.isEmpty; + } + }; + return E([N()], e.prototype, "exportImageParameters", void 0), E([N({ readOnly: !0 })], e.prototype, "floors", null), E([N({ readOnly: !0 })], e.prototype, "exportImageVersion", null), E([N()], e.prototype, "layer", void 0), E([N()], e.prototype, "suspended", void 0), E([N(Pz)], e.prototype, "timeExtent", void 0), e = E([dt("esri.views.layers.MapImageLayerView")], e), e; +}; +let cK = class extends _fr(eL(ky($y))) { + constructor() { + super(...arguments), this._highlightGraphics = new Ob(), this._updateHash = ""; + } + fetchPopupFeatures(e, i) { + return this._popupHighlightHelper.fetchPopupFeatures(e, i); + } + update(e) { + const i = `${this.exportImageVersion}/${e.state.id}/${e.pixelRatio}/${e.stationary}`; + this._updateHash !== i && (this._updateHash = i, this.strategy.update(e).catch((r) => { + us(r) || Ei.getLogger(this.declaredClass).error(r); + }), e.stationary && this._popupHighlightHelper.updateHighlightedFeatures(e.state.resolution)), this._highlightView.processUpdate(e); + } + attach() { + const { imageMaxWidth: e, imageMaxHeight: i, version: r } = this.layer, n = r >= 10.3, s = r >= 10; + this._bitmapContainer = new sz(), this.container.addChild(this._bitmapContainer), this._highlightView = new _x({ view: this.view, graphics: this._highlightGraphics, requestUpdateCallback: () => this.requestUpdate(), container: new X9e(this.view.featuresTilingScheme), defaultPointSymbolEnabled: !1 }), this.container.addChild(this._highlightView.container), this._popupHighlightHelper = new GP({ createFetchPopupFeaturesQueryGeometry: (o, a) => pFt(o, a, this.view), highlightGraphics: this._highlightGraphics, highlightGraphicUpdated: (o, a) => { + this._highlightView.graphicUpdateHandler({ graphic: o, property: a }); + }, layerView: this, updatingHandles: this.updatingHandles }), this.strategy = new Hve({ container: this._bitmapContainer, fetchSource: this.fetchImageBitmap.bind(this), requestUpdate: this.requestUpdate.bind(this), imageMaxWidth: e, imageMaxHeight: i, imageRotationSupported: n, imageNormalizationSupported: s, hidpi: !0 }), this.addAttachHandles(Qi(() => this.exportImageVersion, () => this.requestUpdate())), this.requestUpdate(); + } + detach() { + this.strategy.destroy(), this.container.removeAllChildren(), this._bitmapContainer.removeAllChildren(), this._highlightView.destroy(), this._popupHighlightHelper.destroy(); + } + moveStart() { + } + viewChange() { + } + moveEnd() { + this.requestUpdate(); + } + supportsSpatialReference(e) { + return this.layer.serviceSupportsSpatialReference(e); + } + async doRefresh() { + this._updateHash = "", this.requestUpdate(); + } + isUpdating() { + return this.strategy.updating || this.updateRequested; + } + fetchImage(e, i, r, n) { + return this.layer.fetchImage(e, i, r, { timeExtent: this.timeExtent, floors: this.floors, ...n }); + } + fetchImageBitmap(e, i, r, n) { + return this.layer.fetchImageBitmap(e, i, r, { timeExtent: this.timeExtent, floors: this.floors, ...n }); + } + highlight(e) { + return this._popupHighlightHelper.highlight(e); + } +}; +E([N()], cK.prototype, "strategy", void 0), E([N()], cK.prototype, "updating", void 0), cK = E([dt("esri.views.2d.layers.MapImageLayerView2D")], cK); +const bfr = cK, wfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: bfr +}, Symbol.toStringTag, { value: "Module" })), iot = "sublayers", j2e = "layerView", xfr = Object.freeze({ remove() { +}, pause() { +}, resume() { +} }); +let RDe = class extends ky($y) { + constructor() { + super(...arguments), this._highlightIds = /* @__PURE__ */ new Map(), this.container = new mFt(); + } + async fetchPopupFeatures(e) { + return Array.from(this.graphicsViews(), (i) => i.hitTest(e).filter((r) => !!r.popupTemplate)).flat(); + } + *graphicsViews() { + _e(this._graphicsViewsFeatureCollectionMap) ? yield* this._graphicsViewsFeatureCollectionMap.keys() : _e(this._graphicsViews) ? yield* this._graphicsViews : yield* []; + } + async hitTest(e, i) { + return Array.from(this.graphicsViews(), (r) => { + const n = r.hitTest(e); + if (_e(this._graphicsViewsFeatureCollectionMap)) { + const s = this._graphicsViewsFeatureCollectionMap.get(r); + for (const o of n) + !o.popupTemplate && s.popupTemplate && (o.popupTemplate = s.popupTemplate), o.sourceLayer = o.layer = this.layer; + } + return n; + }).flat().map((r) => ({ type: "graphic", graphic: r, layer: this.layer, mapPoint: e })); + } + highlight(e) { + let i; + typeof e == "number" ? i = [e] : e instanceof ro ? i = [e.uid] : Array.isArray(e) && e.length > 0 ? i = typeof e[0] == "number" ? e : e.map((n) => n && n.uid) : gr.isCollection(e) && (i = e.map((n) => n && n.uid).toArray()); + const r = i?.filter(_e); + return r?.length ? (this._addHighlight(r), { remove: () => { + this._removeHighlight(r); + } }) : xfr; + } + update(e) { + for (const i of this.graphicsViews()) + i.processUpdate(e); + } + attach() { + const e = this.view, i = () => this.requestUpdate(), r = this.layer.featureCollections; + if (_e(r) && r.length) { + this._graphicsViewsFeatureCollectionMap = /* @__PURE__ */ new Map(); + for (const n of r) { + const s = new $O(this.view.featuresTilingScheme), o = new _x({ view: e, graphics: n.source, renderer: n.renderer, requestUpdateCallback: i, container: s }); + this._graphicsViewsFeatureCollectionMap.set(o, n), this.container.addChild(o.container), this.addHandles([Qi(() => n.visible, (a) => o.container.visible = a, jo), Qi(() => o.updating, () => this.notifyChange("updating"), jo)], j2e); + } + this._updateHighlight(); + } else + _e(this.layer.sublayers) && this.addHandles(zu(() => this.layer.sublayers, "change", () => this._createGraphicsViews(), { onListenerAdd: () => this._createGraphicsViews(), onListenerRemove: () => this._destroyGraphicsViews() }), iot); + } + detach() { + this._destroyGraphicsViews(), this.removeHandles(iot); + } + moveStart() { + } + moveEnd() { + } + viewChange() { + for (const e of this.graphicsViews()) + e.viewChange(); + } + isUpdating() { + for (const e of this.graphicsViews()) + if (e.updating) + return !0; + return !1; + } + _destroyGraphicsViews() { + this.container.removeAllChildren(), this.removeHandles(j2e); + for (const e of this.graphicsViews()) + e.destroy(); + this._graphicsViews = null, this._graphicsViewsFeatureCollectionMap = null; + } + _createGraphicsViews() { + if (this._destroyGraphicsViews(), ut(this.layer.sublayers)) + return; + const e = [], i = this.view, r = () => this.requestUpdate(); + for (const n of this.layer.sublayers) { + const s = new rz(), o = new $O(this.view.featuresTilingScheme); + o.fadeTransitionEnabled = !0; + const a = new _x({ view: i, graphics: n.graphics, requestUpdateCallback: r, container: o }); + this.addHandles([n.on("graphic-update", a.graphicUpdateHandler), Qi(() => n.visible, (l) => a.container.visible = l, jo), Qi(() => a.updating, () => this.notifyChange("updating"), jo)], j2e), s.addChild(a.container), this.container.addChild(s), e.push(a); + } + this._graphicsViews = e, this._updateHighlight(); + } + _addHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i); + this._highlightIds.set(i, r + 1); + } else + this._highlightIds.set(i, 1); + this._updateHighlight(); + } + _removeHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i) - 1; + r === 0 ? this._highlightIds.delete(i) : this._highlightIds.set(i, r); + } + this._updateHighlight(); + } + _updateHighlight() { + const e = Array.from(this._highlightIds.keys()); + for (const i of this.graphicsViews()) + i.setHighlight(e); + } +}; +RDe = E([dt("esri.views.2d.layers.MapNotesLayerView2D")], RDe); +const Sfr = RDe, Cfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Sfr +}, Symbol.toStringTag, { value: "Module" })); +let iS = class extends vn { + constructor(e) { + super(e); + } + get bounds() { + const e = this.coords; + return ut(e) || ut(e.extent) ? null : PF(e.extent); + } + get coords() { + const e = this.element.georeference?.coords; + return HO(e, this.spatialReference).geometry; + } + get normalizedCoords() { + return xo.fromJSON(Jar(this.coords)); + } + get normalizedBounds() { + const e = _e(this.normalizedCoords) ? this.normalizedCoords.extent : null; + return _e(e) ? PF(e) : null; + } +}; +E([N()], iS.prototype, "spatialReference", void 0), E([N()], iS.prototype, "element", void 0), E([N()], iS.prototype, "bounds", null), E([N()], iS.prototype, "coords", null), E([N()], iS.prototype, "normalizedCoords", null), E([N()], iS.prototype, "normalizedBounds", null), iS = E([dt("esri.layers.support.MediaElementView")], iS); +const ob = sn(), mj = Tm(), G2e = Tm(), rot = Tm(); +function KD(t, e, i) { + return Ol(ob, e[0], e[1], 1), nI(ob, ob, SQ(mj, i)), ob[2] === 0 ? aa(t, ob[0], ob[1]) : aa(t, ob[0] / ob[2], ob[1] / ob[2]); +} +function MFt(t, e, i) { + return not(G2e, e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7]), not(rot, i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]), kv(t, UNe(G2e, G2e), rot), t[8] !== 0 && (t[0] /= t[8], t[1] /= t[8], t[2] /= t[8], t[3] /= t[8], t[4] /= t[8], t[5] /= t[8], t[6] /= t[8], t[7] /= t[8], t[8] /= t[8]), t; +} +function not(t, e, i, r, n, s, o, a, l) { + x$(t, e, r, s, i, n, o, 1, 1, 1), Ol(ob, a, l, 1), UNe(mj, t); + const [c, h, p] = nI(ob, ob, SQ(mj, mj)); + return x$(mj, c, 0, 0, 0, h, 0, 0, 0, p), kv(t, mj, t); +} +const Pq = Tm(); +let Tfr = class extends pC { + constructor(e) { + super(), this.elementView = e, this.isWrapAround = !1, this.perspectiveTransform = rl(), this._vertices = new Float32Array(20), this._handles = [], this._handles.push(Qi(() => this.elementView.element.opacity, (i) => this.opacity = i, jo), Qi(() => [this.elementView.coords], () => { + this.requestRender(); + }, jo), Oy(() => this.elementView.element.loaded, () => { + const i = this.elementView.element; + this.ready(), i.type === "video" && _e(i.content) && this._handles.push(CO(i.content, "play", () => this.requestRender())); + }, jo)), e.element.load().catch((i) => { + Ei.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new ot("element-load-error", "Element cannot be displayed", { element: e, error: i })); + }); + } + destroy() { + this._handles.forEach((e) => e.remove()), this.texture = Ua(this.texture); + } + get dvsMat3() { + return this.parent.dvsMat3; + } + beforeRender(e) { + const { context: i } = e, r = this.elementView.element.content; + if (_e(r)) { + const n = r instanceof HTMLImageElement, s = r instanceof HTMLVideoElement, o = n ? r.naturalWidth : s ? r.videoWidth : r.width, a = n ? r.naturalHeight : s ? r.videoHeight : r.height; + this._updatePerspectiveTransform(o, a), this.texture ? s && !r.paused && (this.texture.setData(r), this.requestRender(), (i.type === go.WEBGL2 || TE(o) && TE(a)) && this.texture.generateMipmap()) : (this.texture = new Ts(i, { pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, samplingMode: _n.LINEAR, wrapMode: ds.CLAMP_TO_EDGE, width: o, height: a, preMultiplyAlpha: !0 }, r), (i.type === go.WEBGL2 || TE(o) && TE(a)) && this.texture.generateMipmap(), s && !r.paused && this.requestRender()); + } + super.beforeRender(e); + } + _createTransforms() { + return null; + } + updateDrawCoords(e, i) { + const r = this.elementView.coords; + if (ut(r)) + return; + const [n, s, o, a] = r.rings[0], l = this._vertices, { x: c, y: h } = e, p = i !== 0; + p ? l.set([s[0] - c, s[1] - h, n[0] - c, n[1] - h, o[0] - c, o[1] - h, a[0] - c, a[1] - h, a[0] - c, a[1] - h, s[0] + i - c, s[1] - h, s[0] + i - c, s[1] - h, n[0] + i - c, n[1] - h, o[0] + i - c, o[1] - h, a[0] + i - c, a[1] - h]) : l.set([s[0] - c, s[1] - h, n[0] - c, n[1] - h, o[0] - c, o[1] - h, a[0] - c, a[1] - h]), this.isWrapAround = p; + } + getVAO(e, i, r) { + if (ut(this.elementView.coords)) + return null; + const n = this._vertices; + if (this._vao) + this._geometryVbo.setData(n); + else { + this._geometryVbo = Qo.createVertex(e, Vo.DYNAMIC_DRAW, n); + const s = Qo.createVertex(e, Vo.STATIC_DRAW, new Uint16Array([0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1])); + this._vao = new Ac(e, r, i, { geometry: this._geometryVbo, tex: s }); + } + return this._vao; + } + _updatePerspectiveTransform(e, i) { + const r = this._vertices; + MFt(Pq, [0, 0, e, 0, 0, i, e, i], [r[0], r[1], r[4], r[5], r[2], r[3], r[6], r[7]]), aa(this.perspectiveTransform, Pq[6] / Pq[8] * e, Pq[7] / Pq[8] * i); + } +}, Efr = class extends hH { + constructor() { + super(...arguments), this._localOrigin = nd(0, 0), this._viewStateId = -1, this._dvsMat3 = Ml(), this.requiresDedicatedFBO = !1; + } + get dvsMat3() { + return this._dvsMat3; + } + beforeRender(e) { + this._updateMatrices(e), this._updateOverlays(e, this.children); + for (const i of this.children) + i.beforeRender(e); + } + prepareRenderPasses(e) { + const i = e.registerRenderPass({ name: "overlay", brushes: [fh.overlay], target: () => this.children, drawPhase: lo.MAP }); + return [...super.prepareRenderPasses(e), i]; + } + _updateMatrices(e) { + const { state: i } = e, { id: r, size: n, pixelRatio: s, resolution: o, rotation: a, viewpoint: l, displayMat3: c } = i; + if (this._viewStateId === r) + return; + const h = Math.PI / 180 * a, p = s * n[0], y = s * n[1], { x: v, y: x } = l.targetGeometry, I = w5e(v, i.spatialReference); + this._localOrigin.x = I, this._localOrigin.y = x; + const P = o * p, F = o * y, k = v3(this._dvsMat3); + kv(k, k, c), Ng(k, k, Tp(p / 2, y / 2)), KO(k, k, I3(p / P, -y / F, 1)), BI(k, k, -h), this._viewStateId = r; + } + _updateOverlays(e, i) { + const { state: r } = e, { rotation: n, spatialReference: s, worldScreenWidth: o, size: a, viewpoint: l } = r, c = this._localOrigin; + let h = 0; + const p = Ld(s); + if (p && s.isWrappable) { + const y = a[0], v = a[1], x = 180 / Math.PI * n, I = Math.abs(Math.cos(x)), P = Math.abs(Math.sin(x)), F = Math.round(y * I + v * P), [k, V] = p.valid, j = jNe(s), { x: Y, y: X } = l.targetGeometry, Q = [Y, X], re = [0, 0]; + r.toScreen(re, Q); + const he = [0, 0]; + let fe; + fe = F > o ? 0.5 * o : 0.5 * F; + const be = Math.floor((Y + 0.5 * j) / j), Se = k + be * j, Me = V + be * j, ke = [re[0] + fe, 0]; + r.toMap(he, ke), he[0] > Me && (h = j), ke[0] = re[0] - fe, r.toMap(he, ke), he[0] < Se && (h = -j); + for (const J of i) { + const ce = J.elementView.bounds; + if (ut(ce)) + continue; + const [xe, , Pe] = ce; + xe < k && Pe > k ? J.updateDrawCoords(c, j) : Pe > V && xe < V ? J.updateDrawCoords(c, -j) : J.updateDrawCoords(c, h); + } + } else + for (const y of i) + y.updateDrawCoords(c, h); + } +}, gj = class extends ky($y) { + constructor() { + super(...arguments), this._overlayContainer = null, this._fetchQueue = null, this._tileStrategy = null, this._elementReferences = /* @__PURE__ */ new Map(), this._debugGraphicsView = null, this.layer = null, this.elements = new gr(); + } + attach() { + this.addAttachHandles([zu(() => this.layer.effectiveSource, "refresh", () => { + for (const e of this._tileStrategy.tiles) + this._updateTile(e); + this.requestUpdate(); + }), zu(() => this.layer.effectiveSource, "change", ({ element: e }) => this._elementUpdateHandler(e))]), this._overlayContainer = new Efr(), this.container.addChild(this._overlayContainer), this._fetchQueue = new fU({ tileInfoView: this.view.featuresTilingScheme, concurrency: 10, process: (e, i) => this._queryElements(e, i) }), this._tileStrategy = new CQ({ cachePolicy: "purge", resampling: !0, acquireTile: (e) => this._acquireTile(e), releaseTile: (e) => this._releaseTile(e), tileInfoView: this.view.featuresTilingScheme }), this.requestUpdate(); + } + detach() { + this.elements.removeAll(), this._tileStrategy.destroy(), this._fetchQueue.destroy(), this._overlayContainer.removeAllChildren(), this.container.removeAllChildren(), this._elementReferences.clear(), this._debugGraphicsView?.destroy(); + } + supportsSpatialReference(e) { + return !0; + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this.requestUpdate(); + } + update(e) { + this._tileStrategy.update(e), this._debugGraphicsView?.update(e); + } + async hitTest(e, i) { + const r = [], n = e.normalize(), s = [n.x, n.y]; + for (const { projectedElement: { normalizedCoords: o, element: a } } of this._elementReferences.values()) + _e(o) && B4e(o.rings, s) && r.push({ type: "media", element: a, layer: this.layer, mapPoint: e }); + return r.reverse(); + } + canResume() { + return this.layer.source != null && super.canResume(); + } + async doRefresh() { + this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e) => this._updateTile(e)); + } + _acquireTile(e) { + const i = new Ifr(e.clone()); + return this._updateTile(i), i; + } + _updateTile(e) { + this.updatingHandles.addPromise(this._fetchQueue.push(e.key).then((i) => { + const [r, n] = e.setElements(i); + this._referenceElements(e, r), this._dereferenceElements(e, n), this.requestUpdate(); + }, (i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + })); + } + _releaseTile(e) { + this._fetchQueue.abort(e.key.id), e.elements && this._dereferenceElements(e, e.elements), this.requestUpdate(); + } + async _queryElements(e, i) { + const r = this.layer.effectiveSource; + if (ut(r)) + return []; + this.view.featuresTilingScheme.getTileBounds(SE, e, !0); + const n = new br({ xmin: SE[0], ymin: SE[1], xmax: SE[2], ymax: SE[3], spatialReference: this.view.spatialReference }); + return r.queryElements(n, i); + } + _referenceElements(e, i) { + const r = this.layer.source; + if (!ut(r)) + for (const n of i) + this._referenceElement(e, n); + } + _referenceElement(e, i) { + II(this._elementReferences, i.uid, () => { + const r = new iS({ element: i, spatialReference: this.view.spatialReference }), n = new Tfr(r); + return this._overlayContainer.addChild(n), this.elements.add(i), { tiles: /* @__PURE__ */ new Set(), projectedElement: r, overlay: n, debugGraphic: null }; + }).tiles.add(e); + } + _dereferenceElements(e, i) { + for (const r of i) + this._dereferenceElement(e, r); + } + _dereferenceElement(e, i) { + const r = this._elementReferences.get(i.uid); + r.tiles.delete(e), r.tiles.size || (this._overlayContainer.removeChild(r.overlay), r.overlay.destroy(), r.projectedElement.destroy(), this._elementReferences.delete(i.uid), this.elements.remove(i), this._debugGraphicsView?.graphics.remove(r.debugGraphic)); + } + _elementUpdateHandler(e) { + let i = this._elementReferences.get(e.uid); + if (i) { + const n = i.projectedElement.normalizedCoords; + if (ut(n)) + return this._overlayContainer.removeChild(i.overlay), i.overlay.destroy(), i.projectedElement.destroy(), this._elementReferences.delete(e.uid), this.elements.remove(e), void this._debugGraphicsView?.graphics.remove(i.debugGraphic); + const s = [], o = []; + for (const a of this._tileStrategy.tiles) { + const l = sot(this.view.featuresTilingScheme, a, n); + i.tiles.has(a) ? l || o.push(a) : l && s.push(a); + } + for (const a of s) + this._referenceElement(a, e); + for (const a of o) + this._dereferenceElement(a, e); + return i = this._elementReferences.get(e.uid), void (i?.debugGraphic && (i.debugGraphic.geometry = i.projectedElement.normalizedCoords, this._debugGraphicsView.graphicUpdateHandler({ graphic: i.debugGraphic, property: "geometry" }))); + } + const r = new iS({ element: e, spatialReference: this.view.spatialReference }).normalizedCoords; + if (_e(r)) + for (const n of this._tileStrategy.tiles) + sot(this.view.featuresTilingScheme, n, r) && this._referenceElement(n, e); + } +}; +E([N()], gj.prototype, "_fetchQueue", void 0), E([N()], gj.prototype, "layer", void 0), E([N({ readOnly: !0 })], gj.prototype, "elements", void 0), gj = E([dt("esri.views.2d.layers.MediaLayerView2D")], gj); +const SE = Eo(), Oq = { xmin: 0, ymin: 0, xmax: 0, ymax: 0 }; +function sot(t, e, i) { + return t.getTileBounds(SE, e.key, !0), Oq.xmin = SE[0], Oq.ymin = SE[1], Oq.xmax = SE[2], Oq.ymax = SE[3], V4e(Oq, i); +} +let Ifr = class { + constructor(e) { + this.key = e, this.elements = null, this.isReady = !1, this.visible = !0; + } + setElements(e) { + const i = [], r = new Set(this.elements); + this.elements = e; + for (const n of e) + r.has(n) ? r.delete(n) : i.push(n); + return this.isReady = !0, [i, Array.from(r)]; + } + destroy() { + } +}; +const Afr = gj, Pfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Afr +}, Symbol.toStringTag, { value: "Module" })), Ofr = (t) => { + let e = class extends t { + get availableFields() { + return this.layer.fieldsIndex.fields.map((i) => i.name); + } + }; + return E([N()], e.prototype, "layer", void 0), E([N({ readOnly: !0 })], e.prototype, "availableFields", null), e = E([dt("esri.views.layers.OGCFeatureLayerView")], e), e; +}; +let MDe = class extends Ofr(zve) { + supportsSpatialReference(e) { + return this.layer.serviceSupportsSpatialReference(e); + } +}; +MDe = E([dt("esri.views.2d.layers.OGCFeatureLayerView2D")], MDe); +const Rfr = MDe, Mfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Rfr +}, Symbol.toStringTag, { value: "Module" })), DFt = ta()({ esriCentimeters: "centimeters", esriDecimalDegrees: "decimal-degrees", esriDecimeters: "decimeters", esriFeet: "feet", esriInches: "inches", esriKilometers: "kilometers", esriMeters: "meters", esriMiles: "miles", esriMillimeters: "millimeters", esriNauticalMiles: "nautical-miles", esriPoints: "points", esriUnknownUnits: "unknown", esriYards: "yards" }), FFt = ta()({ esriNAUCentimeters: "centimeters", esriNAUDecimalDegrees: "decimal-degrees", esriNAUDecimeters: "decimeters", esriNAUFeet: "feet", esriNAUInches: "inches", esriNAUKilometers: "kilometers", esriNAUMeters: "meters", esriNAUMiles: "miles", esriNAUMillimeters: "millimeters", esriNAUNauticalMiles: "nautical-miles", esriNAUPoints: "points", esriNAUYards: "yards" }); +ta()({ esriNAUDays: "days", esriNAUHours: "hours", esriNAUMinutes: "minutes", esriNAUSeconds: "seconds" }); +const Dfr = ta()({ esriNAUCentimeters: "centimeters", esriNAUDecimalDegrees: "decimal-degrees", esriNAUDecimeters: "decimeters", esriNAUFeet: "feet", esriNAUInches: "inches", esriNAUKilometers: "kilometers", esriNAUMeters: "meters", esriNAUMiles: "miles", esriNAUMillimeters: "millimeters", esriNAUNauticalMiles: "nautical-miles", esriNAUPoints: "points", esriNAUYards: "yards", esriNAUDays: "days", esriNAUHours: "hours", esriNAUMinutes: "minutes", esriNAUSeconds: "seconds", esriNAUKilometersPerHour: "kilometers-per-hour", esriNAUMilesPerHour: "miles-per-hour", esriNAUUnknown: "unknown" }), Ffr = ta()({ esriDOTComplete: "complete", esriDOTCompleteNoEvents: "complete-no-events", esriDOTFeatureSets: "featuresets", esriDOTInstructionsOnly: "instructions-only", esriDOTStandard: "standard", esriDOTSummaryOnly: "summary-only" }), Lfr = ta()({ esriNAOutputLineNone: "none", esriNAOutputLineStraight: "straight", esriNAOutputLineTrueShape: "true-shape", esriNAOutputLineTrueShapeWithMeasure: "true-shape-with-measure" }); +ta()({ esriNAOutputPolygonNone: "none", esriNAOutputPolygonSimplified: "simplified", esriNAOutputPolygonDetailed: "detailed" }); +const LFt = ta()({ esriNFSBAllowBacktrack: "allow-backtrack", esriNFSBAtDeadEndsOnly: "at-dead-ends-only", esriNFSBNoBacktrack: "no-backtrack", esriNFSBAtDeadEndsAndIntersections: "at-dead-ends-and-intersections" }); +ta()({ esriNATravelDirectionFromFacility: "from-facility", esriNATravelDirectionToFacility: "to-facility" }); +ta()({ esriNATimeOfDayNotUsed: "not-used", esriNATimeOfDayUseAsStartTime: "start", esriNATimeOfDayUseAsEndTime: "end" }); +const Nfr = ta()({ AUTOMOBILE: "automobile", TRUCK: "truck", WALK: "walk", OTHER: "other" }), fy = ta()({ 0: "either-side-of-vehicle", 1: "right-side-of-vehicle", 2: "left-side-of-vehicle", 3: "no-u-turn" }, { useNumericKeys: !0 }), dZ = ta()({ 0: "stop", 1: "waypoint", 2: "break" }, { useNumericKeys: !0 }), m4 = ta()({ 0: "ok", 1: "not-located", 2: "network-element-not-located", 3: "element-not-traversable", 4: "invalid-field-values", 5: "not-reached", 6: "time-window-violation", 7: "not-located-on-closest" }, { useNumericKeys: !0 }), dme = ta()({ 1: "right", 2: "left" }, { useNumericKeys: !0 }), l1 = ta()({ 0: "restriction", 1: "added-cost" }, { useNumericKeys: !0 }), pZ = ta()({ 0: "permit", 1: "restrict" }, { useNumericKeys: !0 }), pme = ta()({ 1: "header", 50: "arrive", 51: "depart", 52: "straight", 100: "on-ferry", 101: "off-ferry", 102: "central-fork", 103: "roundabout", 104: "u-turn", 150: "door", 151: "stairs", 152: "elevator", 153: "escalator", 154: "pedestrian-ramp", 200: "left-fork", 201: "left-ramp", 202: "clockwise-roundabout", 203: "left-handed-u-turn", 204: "bear-left", 205: "left-turn", 206: "sharp-left", 207: "left-turn-and-immediate-left-turn", 208: "left-turn-and-immediate-right-turn", 300: "right-fork", 301: "right-ramp", 302: "counter-clockwise-roundabout", 303: "right-handed-u-turn", 304: "bear-right", 305: "right-turn", 306: "sharp-right", 307: "right-turn-and-immediate-left-turn", 308: "right-turn-and-immediate-right-turn", 400: "up-elevator", 401: "up-escalator", 402: "up-stairs", 500: "down-elevator", 501: "down-escalator", 502: "down-stairs", 1e3: "general-event", 1001: "landmark", 1002: "time-zone-change", 1003: "traffic-event", 1004: "scaled-cost-barrier-event", 1005: "boundary-crossing", 1006: "restriction-violation" }, { useNumericKeys: !0 }), fme = ta()({ 0: "unknown", 1: "segment", 2: "maneuver-segment", 3: "restriction-violation", 4: "scaled-cost-barrier", 5: "heavy-traffic", 6: "slow-traffic", 7: "moderate-traffic" }, { useNumericKeys: !0 }), kfr = ta()({ "NA Campus": "campus", "NA Desktop": "desktop", "NA Navigation": "navigation" }), $fr = ta()({ Kilometers: "kilometers", Miles: "miles", Meters: "meters" }, { ignoreUnknown: !1 }), Wve = ta()({ Minutes: "minutes", TimeAt1KPH: "time-at-1-kph", TravelTime: "travel-time", TruckMinutes: "truck-minutes", TruckTravelTime: "truck-travel-time", WalkTime: "walk-time" }, { ignoreUnknown: !1 }), w1 = ta()({ Kilometers: "kilometers", Miles: "miles", Meters: "meters", Minutes: "minutes", TimeAt1KPH: "time-at-1-kph", TravelTime: "travel-time", TruckMinutes: "truck-minutes", TruckTravelTime: "truck-travel-time", WalkTime: "walk-time" }, { ignoreUnknown: !1 }), mme = ta()({ "Any Hazmat Prohibited": "any-hazmat-prohibited", "Avoid Carpool Roads": "avoid-carpool-roads", "Avoid Express Lanes": "avoid-express-lanes", "Avoid Ferries": "avoid-ferries", "Avoid Gates": "avoid-gates", "Avoid Limited Access Roads": "avoid-limited-access-roads", "Avoid Private Roads": "avoid-private-roads", "Avoid Roads Unsuitable for Pedestrians": "avoid-roads-unsuitable-for-pedestrians", "Avoid Stairways": "avoid-stairways", "Avoid Toll Roads": "avoid-toll-roads", "Avoid Toll Roads for Trucks": "avoid-toll-roads-for-trucks", "Avoid Truck Restricted Roads": "avoid-truck-restricted-roads", "Avoid Unpaved Roads": "avoid-unpaved-roads", "Axle Count Restriction": "axle-count-restriction", "Driving a Bus": "driving-a-bus", "Driving a Taxi": "driving-a-taxi", "Driving a Truck": "driving-a-truck", "Driving an Automobile": "driving-an-automobile", "Driving an Emergency Vehicle": "driving-an-emergency-vehicle", "Height Restriction": "height-restriction", "Kingpin to Rear Axle Length Restriction": "kingpin-to-rear-axle-length-restriction", "Length Restriction": "length-restriction", "Preferred for Pedestrians": "preferred-for-pedestrians", "Riding a Motorcycle": "riding-a-motorcycle", "Roads Under Construction Prohibited": "roads-under-construction-prohibited", "Semi or Tractor with One or More Trailers Prohibited": "semi-or-tractor-with-one-or-more-trailers-prohibited", "Single Axle Vehicles Prohibited": "single-axle-vehicles-prohibited", "Tandem Axle Vehicles Prohibited": "tandem-axle-vehicles-prohibited", "Through Traffic Prohibited": "through-traffic-prohibited", "Truck with Trailers Restriction": "truck-with-trailers-restriction", "Use Preferred Hazmat Routes": "use-preferred-hazmat-routes", "Use Preferred Truck Routes": "use-preferred-truck-routes", Walking: "walking", "Weight Restriction": "weight-restriction" }, { ignoreUnknown: !1 }), Bfr = ta()({ esriSpatialRelIntersects: "intersects", esriSpatialRelContains: "contains", esriSpatialRelCrosses: "crosses", esriSpatialRelEnvelopeIntersects: "envelope-intersects", esriSpatialRelIndexIntersects: "index-intersects", esriSpatialRelOverlaps: "overlaps", esriSpatialRelTouches: "touches", esriSpatialRelWithin: "within", esriSpatialRelRelation: "relation" }), Vfr = ta()({ esriGeometryPoint: "point", esriGeometryPolyline: "polyline", esriGeometryPolygon: "polygon", esriGeometryEnvelope: "envelope", esriGeometryMultipoint: "multipoint" }), jfr = ta()({ esriNAUTCost: "cost", esriNAUTDescriptor: "descriptor", esriNAUTRestriction: "restriction", esriNAUTHierarchy: "hierarchy" }), Gfr = ta()({ esriDSTAltName: "alt-name", esriDSTArrive: "arrive", esriDSTBranch: "branch", esriDSTCrossStreet: "cross-street", esriDSTCumulativeLength: "cumulative-length", esriDSTDepart: "depart", esriDSTEstimatedArrivalTime: "estimated-arrival-time", esriDSTExit: "exit", esriDSTGeneral: "general", esriDSTLength: "length", esriDSTServiceTime: "service-time", esriDSTStreetName: "street-name", esriDSTSummary: "summary", esriDSTTime: "time", esriDSTTimeWindow: "time-window", esriDSTToward: "toward", esriDSTViolationTime: "violation-time", esriDSTWaitTime: "wait-time" }); +var DDe; +let h0 = DDe = class extends _a($i) { + constructor(t) { + super(t), this.directionLineType = null, this.directionPointId = null, this.distance = null, this.duration = null, this.fromLevel = null, this.geometry = null, this.objectId = null, this.popupTemplate = null, this.symbol = null, this.toLevel = null, this.type = "direction-line"; + } + static fromGraphic(t) { + return new DDe({ directionLineType: fme.fromJSON(t.attributes.DirectionLineType), directionPointId: t.attributes.DirectionPointID, distance: t.attributes.Meters, duration: t.attributes.Minutes, fromLevel: t.attributes.FromLevel ?? null, geometry: t.geometry, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, symbol: t.symbol, toLevel: t.attributes.ToLevel ?? null }); + } + toGraphic() { + const t = { ObjectID: this.objectId, DirectionLineType: _e(this.directionLineType) ? fme.toJSON(this.directionLineType) : null, DirectionPointID: this.directionPointId, Meters: this.distance, Minutes: this.duration }; + return _e(this.fromLevel) && (t.FromLevel = this.fromLevel), _e(this.toLevel) && (t.ToLevel = this.toLevel), new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +h0.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "DirectionLineType", alias: "Line Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriDirectionsLineType", codedValues: [{ name: "Unknown", code: 0 }, { name: "Segment", code: 1 }, { name: "Maneuver Segment", code: 2 }, { name: "Restriction violation", code: 3 }, { name: "Scale cost barrier crossing", code: 4 }, { name: "Heavy Traffic", code: 5 }, { name: "Slow Traffic", code: 6 }, { name: "Moderate Traffic", code: 7 }] } }, { name: "DirectionPointID", alias: "Direction Point ID", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !1 }, { name: "FromLevel", alias: "Start from 3D Level", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !1 }, { name: "Meters", alias: "Length in Meters", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "Minutes", alias: "Duration in Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "ToLevel", alias: "End at 3D Level", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !1 }], h0.popupInfo = { title: "Direction Lines", fieldInfos: [{ fieldName: "DirectionLineType", label: "Line Type", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "Meters", label: "Length in Meters", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Minutes", label: "Duration in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "DirectionPointID", label: "Direction Point ID", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "FromLevel", label: "Start from 3D Level", isEditable: !1, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ToLevel", label: "End at 3D Level", isEditable: !1, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N({ type: fme.apiValues, json: { read: { source: "attributes.DirectionLineType", reader: fme.read } } })], h0.prototype, "directionLineType", void 0), E([N({ json: { read: { source: "attributes.DirectionPointID" } } })], h0.prototype, "directionPointId", void 0), E([N({ json: { read: { source: "attributes.Meters" } } })], h0.prototype, "distance", void 0), E([N({ json: { read: { source: "attributes.Minutes" } } })], h0.prototype, "duration", void 0), E([N({ json: { read: { source: "attributes.FromLevel" } } })], h0.prototype, "fromLevel", void 0), E([N({ type: xa })], h0.prototype, "geometry", void 0), E([N({ json: { read: { source: "attributes.ObjectID" } } })], h0.prototype, "objectId", void 0), E([N({ type: $h })], h0.prototype, "popupTemplate", void 0), E([N({ types: rd })], h0.prototype, "symbol", void 0), E([N({ json: { read: { source: "attributes.ToLevel" } } })], h0.prototype, "toLevel", void 0), E([N({ readOnly: !0, json: { read: !1 } })], h0.prototype, "type", void 0), h0 = DDe = E([dt("esri.rest.support.DirectionLine")], h0); +const AG = h0; +var FDe; +let Ih = FDe = class extends _a($i) { + constructor(t) { + super(t), this.alternateName = null, this.arrivalTime = null, this.arrivalTimeOffset = null, this.azimuth = null, this.branchName = null, this.directionPointType = null, this.displayText = null, this.exitName = null, this.geometry = null, this.intersectingName = null, this.level = null, this.name = null, this.objectId = null, this.popupTemplate = null, this.sequence = null, this.shortVoiceInstruction = null, this.stopId = null, this.symbol = null, this.towardName = null, this.type = "direction-point", this.voiceInstruction = null; + } + readArrivalTime(t, e) { + return _e(e.attributes.ArrivalTime) ? new Date(e.attributes.ArrivalTime) : null; + } + static fromGraphic(t) { + return new FDe({ alternateName: t.attributes.AlternateName ?? null, arrivalTime: _e(t.attributes.ArrivalTime) ? new Date(t.attributes.ArrivalTime) : null, arrivalTimeOffset: t.attributes.ArrivalUTCOffset ?? null, azimuth: t.attributes.Azimuth ?? null, branchName: t.attributes.BranchName ?? null, directionPointType: pme.fromJSON(t.attributes.DirectionPointType), displayText: t.attributes.DisplayText ?? null, exitName: t.attributes.ExitName ?? null, geometry: t.geometry, intersectingName: t.attributes.IntersectingName ?? null, level: t.attributes.Level ?? null, name: t.attributes.Name ?? null, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, sequence: t.attributes.Sequence, shortVoiceInstruction: t.attributes.ShortVoiceInstruction ?? null, stopId: t.attributes.StopID ?? null, symbol: t.symbol, towardName: t.attributes.TowardName ?? null, voiceInstruction: t.attributes.VoiceInstruction ?? null }); + } + toGraphic() { + const t = { ObjectID: this.objectId, DirectionPointType: _e(this.directionPointType) ? pme.toJSON(this.directionPointType) : null, Sequence: this.sequence, StopID: this.stopId }; + return _e(this.alternateName) && (t.AlternateName = this.alternateName), _e(this.arrivalTime) && (t.ArrivalTime = this.arrivalTime.getTime()), _e(this.arrivalTimeOffset) && (t.ArrivalUTCOffset = this.arrivalTimeOffset), _e(this.azimuth) && (t.Azimuth = this.azimuth), _e(this.branchName) && (t.BranchName = this.branchName), _e(this.displayText) && (t.DisplayText = this.displayText), _e(this.exitName) && (t.ExitName = this.exitName), _e(this.intersectingName) && (t.IntersectingName = this.intersectingName), _e(this.level) && (t.Level = this.level), _e(this.name) && (t.Name = this.name), _e(this.shortVoiceInstruction) && (t.ShortVoiceInstruction = this.shortVoiceInstruction), _e(this.towardName) && (t.TowardName = this.towardName), _e(this.voiceInstruction) && (t.VoiceInstruction = this.voiceInstruction), new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +Ih.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "AlternateName", alias: "Alternative Feature Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "ArrivalTime", alias: "Maneuver Starts at", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !0 }, { name: "ArrivalUTCOffset", alias: "Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "Azimuth", alias: "Azimuth", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "BranchName", alias: "Signpost Branch Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "DirectionPointType", alias: "Directions Item Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriDirectionPointType", codedValues: [{ name: "Unknown", code: 0 }, { name: "", code: 1 }, { name: "Arrive at stop", code: 50 }, { name: "Depart at stop", code: 51 }, { name: "Go straight", code: 52 }, { name: "Take ferry", code: 100 }, { name: "Take off ferry", code: 101 }, { name: "Keep center at fork", code: 102 }, { name: "Take roundabout", code: 103 }, { name: "Make U-Turn", code: 104 }, { name: "Pass the door", code: 150 }, { name: "Take stairs", code: 151 }, { name: "", code: 152 }, { name: "Take escalator", code: 153 }, { name: "Take pedestrian ramp", code: 154 }, { name: "Keep left at fork", code: 200 }, { name: "Ramp left", code: 201 }, { name: "Take left-handed roundabout", code: 202 }, { name: "Make left-handed U-Turn", code: 203 }, { name: "Bear left", code: 204 }, { name: "Turn left", code: 205 }, { name: "Make sharp left", code: 206 }, { name: "Turn left, followed by turn left", code: 207 }, { name: "Turn left, followed by turn right", code: 208 }, { name: "Keep right at fork", code: 300 }, { name: "Ramp right", code: 301 }, { name: "Take right-handed roundabout", code: 302 }, { name: "Make right-handed U-Turn", code: 303 }, { name: "Bear right", code: 304 }, { name: "Turn right", code: 305 }, { name: "Make sharp right", code: 306 }, { name: "Turn right, followed by turn left", code: 307 }, { name: "Turn right, followed by turn right", code: 308 }, { name: "Indicates up direction of elevator", code: 400 }, { name: "Indicates up direction of escalator", code: 401 }, { name: "Take up-stairs", code: 402 }, { name: "Indicates down direction of elevator", code: 500 }, { name: "Indicates down direction of escalator", code: 501 }, { name: "Take down-stairs", code: 502 }, { name: "General event", code: 1e3 }, { name: "Landmark", code: 1001 }, { name: "Time zone change", code: 1002 }, { name: "Heavy traffic segment", code: 1003 }, { name: "Scale cost barrier crossing", code: 1004 }, { name: "Administrative Border crossing", code: 1005 }, { name: "Restriction violation", code: 1006 }] } }, { name: "DisplayText", alias: "Text to Display", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "ExitName", alias: "Highway Exit Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "IntersectingName", alias: "Intersecting Feature Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "Level", alias: "3D Logical Level", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "Name", alias: "Primary Feature Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "Sequence", alias: "Sequence", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "ShortVoiceInstruction", alias: "Voice Instruction", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "StopID", alias: "Stop ID", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "TowardName", alias: "Signpost Toward Name", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "VoiceInstruction", alias: "Voice Full Instruction", type: "esriFieldTypeString", length: 2048, editable: !0, nullable: !0, visible: !0, domain: null }], Ih.popupInfo = { title: "{DisplayText}", fieldInfos: [{ fieldName: "DirectionPointType", label: "Directions Item Type", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "DisplayText", label: "Text to Display", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "Sequence", label: "Sequence", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "StopID", label: "Stop ID", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ArrivalTime", label: "Maneuver Starts at", isEditable: !0, tooltip: "", visible: !0, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "ArrivalUTCOffset", label: "Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Azimuth", label: "Azimuth", isEditable: !1, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Name", label: "Primary Feature Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "AlternateName", label: "Alternative Feature Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "ExitName", label: "Highway Exit Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "IntersectingName", label: "Intersecting Feature Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "BranchName", label: "Signpost Branch Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "TowardName", label: "Signpost Toward Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "ShortVoiceInstruction", label: "Voice Instruction", isEditable: !1, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "VoiceInstruction", label: "Voice Full Instruction", isEditable: !1, tooltip: "", visible: !1, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N()], Ih.prototype, "alternateName", void 0), E([N()], Ih.prototype, "arrivalTime", void 0), E([Li("arrivalTime", ["attributes.ArrivalTime"])], Ih.prototype, "readArrivalTime", null), E([N({ json: { read: { source: "attributes.ArrivalUTCOffset" } } })], Ih.prototype, "arrivalTimeOffset", void 0), E([N({ json: { read: { source: "attributes.Azimuth" } } })], Ih.prototype, "azimuth", void 0), E([N({ json: { read: { source: "attributes.BranchName" } } })], Ih.prototype, "branchName", void 0), E([N({ type: pme.apiValues, json: { read: { source: "attributes.DirectionPointType", reader: pme.read } } })], Ih.prototype, "directionPointType", void 0), E([N({ json: { read: { source: "attributes.DisplayText" } } })], Ih.prototype, "displayText", void 0), E([N({ json: { read: { source: "attributes.ExitName" } } })], Ih.prototype, "exitName", void 0), E([N({ type: Xi })], Ih.prototype, "geometry", void 0), E([N()], Ih.prototype, "intersectingName", void 0), E([N()], Ih.prototype, "level", void 0), E([N({ json: { read: { source: "attributes.Name" } } })], Ih.prototype, "name", void 0), E([N({ json: { read: { source: "attributes.ObjectID" } } })], Ih.prototype, "objectId", void 0), E([N({ type: $h })], Ih.prototype, "popupTemplate", void 0), E([N({ json: { read: { source: "attributes.Sequence" } } })], Ih.prototype, "sequence", void 0), E([N()], Ih.prototype, "shortVoiceInstruction", void 0), E([N({ json: { read: { source: "attributes.StopID" } } })], Ih.prototype, "stopId", void 0), E([N({ types: rd })], Ih.prototype, "symbol", void 0), E([N({ json: { read: { source: "attributes.TowardName" } } })], Ih.prototype, "towardName", void 0), E([N({ readOnly: !0, json: { read: !1 } })], Ih.prototype, "type", void 0), E([N()], Ih.prototype, "voiceInstruction", void 0), Ih = FDe = E([dt("esri.rest.support.DirectionPoint")], Ih); +const PG = Ih; +function $E(t, e) { + if (ut(t)) + return null; + const i = {}, r = new RegExp(`^${e}`, "i"); + for (const n of Object.keys(t)) + if (r.test(n)) { + const s = n.substring(e.length); + i[w1.fromJSON(s)] = t[n]; + } + return i; +} +function tBe(t, e, i) { + if (!ut(t)) { + e.attributes || (e.attributes = {}); + for (const r in t) { + const n = w1.toJSON(r); + e.attributes[`${i}${n}`] = t[r]; + } + } +} +function oz(t) { + const e = {}; + for (const i of Object.keys(t)) { + const r = i; + e[w1.fromJSON(r)] = t[i]; + } + return e; +} +function az(t) { + const e = {}; + for (const i of Object.keys(t)) { + const r = i; + e[w1.toJSON(r)] = t[i]; + } + return e; +} +function wte(t, e) { + return ut(t) || ut(e) ? null : Math.round((t - e) / 6e4); +} +function Ufr(t) { + const e = t.toJSON(), i = e; + return i.accumulateAttributeNames && (i.accumulateAttributeNames = e.accumulateAttributeNames?.join()), i.attributeParameterValues && (i.attributeParameterValues = JSON.stringify(e.attributeParameterValues)), i.barriers && (i.barriers = JSON.stringify(e.barriers)), i.outSR && (i.outSR = e.outSR?.wkid), i.overrides && (i.overrides = JSON.stringify(e.overrides)), i.polygonBarriers && (i.polygonBarriers = JSON.stringify(e.polygonBarriers)), i.polylineBarriers && (i.polylineBarriers = JSON.stringify(e.polylineBarriers)), i.restrictionAttributeNames && (i.restrictionAttributeNames = e.restrictionAttributeNames?.join()), i.stops && (i.stops = JSON.stringify(e.stops)), i.travelMode && (i.travelMode = JSON.stringify(e.travelMode)), i; +} +var LDe; +let Up = LDe = class extends _a($i) { + constructor(t) { + super(t), this.addedCost = null, this.barrierType = null, this.costs = null, this.curbApproach = null, this.fullEdge = null, this.geometry = null, this.name = null, this.objectId = null, this.popupTemplate = null, this.sideOfEdge = null, this.sourceId = null, this.sourceOid = null, this.status = null, this.symbol = null, this.type = "point-barrier"; + } + readCosts(t, e) { + return $E(e.attributes, "Attr_"); + } + writeCosts(t, e) { + tBe(t, e, "Attr_"); + } + static fromGraphic(t) { + return new LDe({ addedCost: t.attributes.AddedCost ?? null, barrierType: _e(t.attributes.BarrierType) ? l1.fromJSON(t.attributes.BarrierType) : null, costs: _e(t.attributes.Costs) ? oz(JSON.parse(t.attributes.Costs)) : null, curbApproach: _e(t.attributes.CurbApproach) ? fy.fromJSON(t.attributes.CurbApproach) : null, fullEdge: _e(t.attributes.FullEdge) ? pZ.fromJSON(t.attributes.FullEdge) : null, geometry: t.geometry, name: t.attributes.Name ?? null, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, status: _e(t.attributes.Status) ? m4.fromJSON(t.attributes.Status) : null, symbol: t.symbol }); + } + toGraphic() { + const t = { ObjectID: this.objectId, AddedCost: this.addedCost, BarrierType: _e(this.barrierType) ? l1.toJSON(this.barrierType) : null, Costs: _e(this.costs) ? JSON.stringify(az(this.costs)) : null, CurbApproach: _e(this.curbApproach) ? fy.toJSON(this.curbApproach) : null, FullEdge: _e(this.fullEdge) ? pZ.toJSON(this.fullEdge) : null, Name: this.name, Status: _e(this.status) ? m4.toJSON(this.status) : null }; + return new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +Up.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "AddedCost", alias: "Added Cost", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0, domain: null }, { name: "BarrierType", alias: "Barrier Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNABarrierType", codedValues: [{ name: "Restriction", code: 0 }, { name: "Scaled Cost", code: 1 }, { name: "Added Cost", code: 2 }] } }, { name: "Costs", alias: "Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "CurbApproach", alias: "Curb Approach", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !1, domain: { type: "codedValue", name: "esriNACurbApproachType", codedValues: [{ name: "Either side", code: 0 }, { name: "From the right", code: 1 }, { name: "From the left", code: 2 }, { name: "Depart in the same direction", code: 3 }] } }, { name: "FullEdge", alias: "Full Edge", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNAIntYesNo", codedValues: [{ name: "No", code: 0 }, { name: "Yes", code: 1 }] } }, { name: "Name", alias: "Name", type: "esriFieldTypeString", length: 255, editable: !0, nullable: !0, visible: !0 }, { name: "Status", alias: "Status", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNAObjectStatus", codedValues: [{ name: "OK", code: 0 }, { name: "Not Located on Network", code: 1 }, { name: "Network Unbuilt", code: 2 }, { name: "Prohibited Street", code: 3 }, { name: "Invalid Field Values", code: 4 }, { name: "Cannot Reach", code: 5 }, { name: "Time Window Violation", code: 6 }] } }], Up.popupInfo = { title: "Point Barriers", fieldInfos: [{ fieldName: "Name", label: "Name", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "BarrierType", label: "Barrier Type", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "AddedCost", label: "Added Cost", isEditable: !0, tooltip: "", visible: !0, format: { places: 3, digitSeparator: !0 }, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N()], Up.prototype, "addedCost", void 0), E([N({ type: l1.apiValues, json: { name: "attributes.BarrierType", read: { reader: l1.read }, write: { writer: l1.write } } })], Up.prototype, "barrierType", void 0), E([N()], Up.prototype, "costs", void 0), E([Li("costs", ["attributes"])], Up.prototype, "readCosts", null), E([mr("costs")], Up.prototype, "writeCosts", null), E([N({ type: fy.apiValues, json: { read: { source: "attributes.CurbApproach", reader: fy.read } } })], Up.prototype, "curbApproach", void 0), E([N({ type: pZ.apiValues, json: { name: "attributes.FullEdge", read: { reader: pZ.read }, write: { writer: pZ.write } } })], Up.prototype, "fullEdge", void 0), E([N({ type: Xi, json: { write: !0 } })], Up.prototype, "geometry", void 0), E([N({ json: { name: "attributes.Name" } })], Up.prototype, "name", void 0), E([N({ json: { name: "attributes.ObjectID" } })], Up.prototype, "objectId", void 0), E([N({ type: $h })], Up.prototype, "popupTemplate", void 0), E([N({ type: dme.apiValues, json: { read: { source: "attributes.SideOfEdge", reader: dme.read } } })], Up.prototype, "sideOfEdge", void 0), E([N({ json: { read: { source: "attributes.SourceID" } } })], Up.prototype, "sourceId", void 0), E([N({ json: { read: { source: "attributes.SourceOID" } } })], Up.prototype, "sourceOid", void 0), E([N({ type: m4.apiValues, json: { read: { source: "attributes.Status", reader: m4.read } } })], Up.prototype, "status", void 0), E([N({ types: rd })], Up.prototype, "symbol", void 0), E([N({ readOnly: !0, json: { read: !1 } })], Up.prototype, "type", void 0), Up = LDe = E([dt("esri.rest.support.PointBarrier")], Up); +const a6 = Up; +var NDe; +let d0 = NDe = class extends _a($i) { + constructor(t) { + super(t), this.barrierType = null, this.costs = null, this.geometry = null, this.name = null, this.objectId = null, this.popupTemplate = null, this.scaleFactor = null, this.symbol = null, this.type = "polygon-barrier"; + } + readCosts(t, e) { + return $E(e.attributes, "Attr_"); + } + writeCosts(t, e) { + tBe(t, e, "Attr_"); + } + static fromGraphic(t) { + return new NDe({ barrierType: _e(t.attributes.BarrierType) ? l1.fromJSON(t.attributes.BarrierType) : null, costs: _e(t.attributes.Costs) ? oz(JSON.parse(t.attributes.Costs)) : null, geometry: t.geometry, name: t.attributes.Name ?? null, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, scaleFactor: t.attributes.ScaleFactor ?? null, symbol: t.symbol }); + } + toGraphic() { + const t = { ObjectID: this.objectId, BarrierType: _e(this.barrierType) ? l1.toJSON(this.barrierType) : null, Costs: _e(this.costs) ? JSON.stringify(az(this.costs)) : null, Name: this.name ?? null, ScaleFactor: this.scaleFactor ?? null }; + return new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +d0.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "BarrierType", alias: "Barrier Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNABarrierType", codedValues: [{ name: "Restriction", code: 0 }, { name: "Scaled Cost", code: 1 }, { name: "Added Cost", code: 2 }] } }, { name: "Costs", alias: "Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "Name", alias: "Name", type: "esriFieldTypeString", length: 255, editable: !0, nullable: !0, visible: !0 }, { name: "ScaleFactor", alias: "Scale Factor", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }], d0.popupInfo = { title: "Polygon Barriers", fieldInfos: [{ fieldName: "Name", label: "Name", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "BarrierType", label: "Barrier Type", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "ScaleFactor", isEditable: !0, tooltip: "", visible: !0, format: { places: 3, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Costs", label: "Costs", isEditable: !0, tooltip: "", visible: !1, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N({ type: l1.apiValues, json: { name: "attributes.BarrierType", read: { reader: l1.read }, write: { writer: l1.write } } })], d0.prototype, "barrierType", void 0), E([N()], d0.prototype, "costs", void 0), E([Li("costs", ["attributes"])], d0.prototype, "readCosts", null), E([mr("costs")], d0.prototype, "writeCosts", null), E([N({ type: xo, json: { write: !0 } })], d0.prototype, "geometry", void 0), E([N({ json: { name: "attributes.Name" } })], d0.prototype, "name", void 0), E([N({ json: { name: "attributes.ObjectID" } })], d0.prototype, "objectId", void 0), E([N({ type: $h })], d0.prototype, "popupTemplate", void 0), E([N()], d0.prototype, "scaleFactor", void 0), E([N({ types: rd })], d0.prototype, "symbol", void 0), E([N({ readOnly: !0, json: { read: !1 } })], d0.prototype, "type", void 0), d0 = NDe = E([dt("esri.rest.support.PolygonBarrier")], d0); +const l6 = d0; +var kDe; +let uv = kDe = class extends _a($i) { + constructor(t) { + super(t), this.barrierType = null, this.costs = null, this.geometry = null, this.name = null, this.objectId = null, this.popupTemplate = null, this.scaleFactor = null, this.symbol = null, this.type = "polyline-barrier"; + } + readCosts(t, e) { + return $E(e.attributes, "Attr_"); + } + static fromGraphic(t) { + return new kDe({ barrierType: _e(t.attributes.BarrierType) ? l1.fromJSON(t.attributes.BarrierType) : null, costs: _e(t.attributes.Costs) ? oz(JSON.parse(t.attributes.Costs)) : null, geometry: t.geometry, name: t.attributes.Name ?? null, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, scaleFactor: t.attributes.ScaleFactor ?? null, symbol: t.symbol }); + } + toGraphic() { + const t = { ObjectID: this.objectId, BarrierType: _e(this.barrierType) ? l1.toJSON(this.barrierType) : null, Costs: _e(this.costs) ? JSON.stringify(az(this.costs)) : null, Name: this.name, ScaleFactor: this.scaleFactor }; + return new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +uv.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "BarrierType", alias: "Barrier Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNABarrierType", codedValues: [{ name: "Restriction", code: 0 }, { name: "Scaled Cost", code: 1 }, { name: "Added Cost", code: 2 }] } }, { name: "Costs", alias: "Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "Name", alias: "Name", type: "esriFieldTypeString", length: 255, editable: !0, nullable: !0, visible: !0 }, { name: "ScaleFactor", alias: "Scale Factor", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }], uv.popupInfo = { title: "Line Barriers", fieldInfos: [{ fieldName: "Name", label: "Name", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "BarrierType", label: "Barrier Type", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "ScaleFactor", isEditable: !0, tooltip: "", visible: !0, format: { places: 3, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Costs", label: "Costs", isEditable: !0, tooltip: "", visible: !1, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N({ type: l1.apiValues, json: { read: { source: "attributes.BarrierType", reader: l1.read } } })], uv.prototype, "barrierType", void 0), E([N()], uv.prototype, "costs", void 0), E([Li("costs", ["attributes"])], uv.prototype, "readCosts", null), E([N({ type: xa, json: { write: !0 } })], uv.prototype, "geometry", void 0), E([N({ json: { name: "attributes.Name" } })], uv.prototype, "name", void 0), E([N({ json: { name: "attributes.ObjectID" } })], uv.prototype, "objectId", void 0), E([N({ type: $h })], uv.prototype, "popupTemplate", void 0), E([N()], uv.prototype, "scaleFactor", void 0), E([N({ types: rd })], uv.prototype, "symbol", void 0), E([N({ readOnly: !0, json: { read: !1 } })], uv.prototype, "type", void 0), uv = kDe = E([dt("esri.rest.support.PolylineBarrier")], uv); +const u6 = uv; +let Hm = class extends _a($i) { + constructor(e) { + super(e), this.attributeParameterValues = null, this.description = null, this.distanceAttributeName = null, this.id = null, this.impedanceAttributeName = null, this.name = null, this.restrictionAttributeNames = null, this.simplificationTolerance = null, this.simplificationToleranceUnits = null, this.timeAttributeName = null, this.type = null, this.useHierarchy = null, this.uturnAtJunctions = null; + } + readId(e, i) { + return i.id ?? i.itemId ?? null; + } + readRestrictionAttributes(e, i) { + const { restrictionAttributeNames: r } = i; + return ut(r) ? null : r.map((n) => mme.fromJSON(n)); + } + writeRestrictionAttributes(e, i, r) { + ut(e) || (i[r] = e.map((n) => mme.toJSON(n))); + } +}; +E([N({ type: [Object], json: { write: !0 } })], Hm.prototype, "attributeParameterValues", void 0), E([N({ type: String, json: { write: !0 } })], Hm.prototype, "description", void 0), E([Yr($fr, { ignoreUnknown: !1 })], Hm.prototype, "distanceAttributeName", void 0), E([N({ type: String, json: { write: !0 } })], Hm.prototype, "id", void 0), E([Li("id", ["id", "itemId"])], Hm.prototype, "readId", null), E([Yr(w1, { ignoreUnknown: !1 })], Hm.prototype, "impedanceAttributeName", void 0), E([N({ type: String, json: { write: !0 } })], Hm.prototype, "name", void 0), E([N({ type: [String], json: { write: !0 } })], Hm.prototype, "restrictionAttributeNames", void 0), E([Li("restrictionAttributeNames")], Hm.prototype, "readRestrictionAttributes", null), E([mr("restrictionAttributeNames")], Hm.prototype, "writeRestrictionAttributes", null), E([N({ type: Number, json: { write: { allowNull: !0 } } })], Hm.prototype, "simplificationTolerance", void 0), E([Yr(DFt)], Hm.prototype, "simplificationToleranceUnits", void 0), E([Yr(Wve, { ignoreUnknown: !1 })], Hm.prototype, "timeAttributeName", void 0), E([Yr(Nfr)], Hm.prototype, "type", void 0), E([N({ type: Boolean, json: { write: !0 } })], Hm.prototype, "useHierarchy", void 0), E([Yr(LFt)], Hm.prototype, "uturnAtJunctions", void 0), Hm = E([dt("esri.rest.support.TravelMode")], Hm); +const qve = Hm; +let Z1 = class extends $i { + constructor(e) { + super(e), this.accumulateAttributes = null, this.directionsLanguage = null, this.findBestSequence = null, this.preserveFirstStop = null, this.preserveLastStop = null, this.startTimeIsUTC = null, this.timeWindowsAreUTC = null, this.travelMode = null; + } + readAccumulateAttributes(e) { + return ut(e) ? null : e.map((i) => w1.fromJSON(i)); + } + writeAccumulateAttributes(e, i, r) { + !ut(e) && e.length && (i[r] = e.map((n) => w1.toJSON(n))); + } +}; +E([N({ type: [String], json: { name: "accumulateAttributeNames", write: !0 } })], Z1.prototype, "accumulateAttributes", void 0), E([Li("accumulateAttributes")], Z1.prototype, "readAccumulateAttributes", null), E([mr("accumulateAttributes")], Z1.prototype, "writeAccumulateAttributes", null), E([N({ type: String, json: { write: !0 } })], Z1.prototype, "directionsLanguage", void 0), E([N({ type: Boolean, json: { write: !0 } })], Z1.prototype, "findBestSequence", void 0), E([N({ type: Boolean, json: { write: !0 } })], Z1.prototype, "preserveFirstStop", void 0), E([N({ type: Boolean, json: { write: !0 } })], Z1.prototype, "preserveLastStop", void 0), E([N({ type: Boolean, json: { write: !0 } })], Z1.prototype, "startTimeIsUTC", void 0), E([N({ type: Boolean, json: { write: !0 } })], Z1.prototype, "timeWindowsAreUTC", void 0), E([N({ type: qve, json: { write: !0 } })], Z1.prototype, "travelMode", void 0), Z1 = E([dt("esri.layers.support.RouteSettings")], Z1); +const NFt = Z1; +var $De; +let Iu = $De = class extends _a($i) { + constructor(t) { + super(t), this.analysisSettings = null, this.endTime = null, this.endTimeOffset = null, this.firstStopId = null, this.geometry = null, this.lastStopId = null, this.messages = null, this.name = null, this.objectId = null, this.popupTemplate = null, this.startTime = null, this.startTimeOffset = null, this.stopCount = null, this.symbol = null, this.totalCosts = null, this.totalDistance = null, this.totalDuration = null, this.totalLateDuration = null, this.totalViolations = null, this.totalWait = null, this.totalWaitDuration = null, this.type = "route-info", this.version = "1.0.0"; + } + readEndTime(t, e) { + return _e(e.attributes.EndTimeUTC) ? new Date(e.attributes.EndTimeUTC) : null; + } + readEndTimeOffset(t, e) { + return wte(e.attributes.EndTime, e.attributes.EndTimeUTC); + } + readStartTime(t, e) { + return _e(e.attributes.StartTimeUTC) ? new Date(e.attributes.StartTimeUTC) : null; + } + readStartTimeOffset(t, e) { + return wte(e.attributes.StartTime, e.attributes.StartTimeUTC); + } + readTotalCosts(t, e) { + return $E(e.attributes, "Total_"); + } + readTotalViolations(t, e) { + return $E(e.attributes, "TotalViolation_"); + } + readTotalWait(t, e) { + return $E(e.attributes, "TotalWait_"); + } + static fromGraphic(t) { + return new $De({ analysisSettings: _e(t.attributes.AnalysisSettings) ? NFt.fromJSON(JSON.parse(t.attributes.AnalysisSettings)) : null, endTime: _e(t.attributes.EndTime) ? new Date(t.attributes.EndTime) : null, endTimeOffset: t.attributes.EndUTCOffset ?? null, geometry: t.geometry, messages: _e(t.attributes.Messages) ? JSON.parse(t.attributes.Messages) : null, name: t.attributes.RouteName, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, startTime: _e(t.attributes.StartTime) ? new Date(t.attributes.StartTime) : null, startTimeOffset: t.attributes.StartUTCOffset ?? null, symbol: t.symbol, totalCosts: _e(t.attributes.TotalCosts) ? oz(JSON.parse(t.attributes.TotalCosts)) : null, totalDistance: t.attributes.TotalMeters ?? null, totalDuration: t.attributes.TotalMinutes ?? null, totalLateDuration: t.attributes.TotalLateMinutes ?? null, totalWaitDuration: t.attributes.TotalWaitMinutes ?? null, version: t.attributes.Version }); + } + toGraphic() { + const t = { ObjectID: this.objectId, AnalysisSettings: _e(this.analysisSettings) ? JSON.stringify(this.analysisSettings.toJSON()) : null, EndTime: _e(this.endTime) ? this.endTime.getTime() : null, EndUTCOffset: this.endTimeOffset, Messages: _e(this.messages) ? JSON.stringify(this.messages) : null, RouteName: this.name, StartTime: _e(this.startTime) ? this.startTime.getTime() : null, StartUTCOffset: this.startTimeOffset, TotalCosts: _e(this.totalCosts) ? JSON.stringify(az(this.totalCosts)) : null, TotalLateMinutes: this.totalLateDuration, TotalMeters: this.totalDistance, TotalMinutes: this.totalDuration, TotalWaitMinutes: this.totalWaitDuration, Version: this.version }; + return new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +Iu.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "AnalysisSettings", alias: "Analysis Settings", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "EndTime", alias: "End Time", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !0 }, { name: "EndUTCOffset", alias: "End Time: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "Messages", alias: "Analysis Messages", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "RouteName", alias: "Route Name", type: "esriFieldTypeString", length: 1024, editable: !0, nullable: !0, visible: !0, domain: null }, { name: "StartTime", alias: "Start Time", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !0 }, { name: "StartUTCOffset", alias: "Start Time: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "TotalCosts", alias: "Total Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "TotalLateMinutes", alias: "Total Late Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }, { name: "TotalMeters", alias: "Total Meters", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "TotalMinutes", alias: "Total Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "TotalWaitMinutes", alias: "Total Wait Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }, { name: "Version", alias: "Version", type: "esriFieldTypeString", length: 16, editable: !0, nullable: !0, visible: !0, domain: null }], Iu.popupInfo = { title: "Route Details", fieldInfos: [{ fieldName: "RouteName", label: "Route Name", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "TotalMinutes", label: "Total Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TotalMeters", label: "Total Meters", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TotalLateMinutes", label: "Total Late Minutes", isEditable: !1, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TotalWaitMinutes", label: "Total Wait Minutes", isEditable: !1, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TotalCosts", label: "Total Costs", isEditable: !1, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "StartTime", label: "Start Time", isEditable: !1, tooltip: "", visible: !0, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "StartUTCOffset", label: "Start Time: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "EndTime", label: "End Time", isEditable: !1, tooltip: "", visible: !0, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "EndUTCOffset", label: "End Time: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Messages", label: "Analysis Messages", isEditable: !1, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "AnalysisSettings", isEditable: !1, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "Version", label: "Version", isEditable: !1, tooltip: "", visible: !0, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N()], Iu.prototype, "analysisSettings", void 0), E([N()], Iu.prototype, "endTime", void 0), E([Li("endTime", ["attributes.EndTimeUTC"])], Iu.prototype, "readEndTime", null), E([N()], Iu.prototype, "endTimeOffset", void 0), E([Li("endTimeOffset", ["attributes.EndTime", "attributes.EndTimeUTC"])], Iu.prototype, "readEndTimeOffset", null), E([N({ json: { read: { source: "attributes.FirstStopID" } } })], Iu.prototype, "firstStopId", void 0), E([N({ type: xa })], Iu.prototype, "geometry", void 0), E([N({ json: { read: { source: "attributes.LastStopID" } } })], Iu.prototype, "lastStopId", void 0), E([N()], Iu.prototype, "messages", void 0), E([N({ json: { read: { source: "attributes.Name" } } })], Iu.prototype, "name", void 0), E([N({ json: { read: { source: "attributes.ObjectID" } } })], Iu.prototype, "objectId", void 0), E([N({ type: $h })], Iu.prototype, "popupTemplate", void 0), E([N()], Iu.prototype, "startTime", void 0), E([Li("startTime", ["attributes.StartTimeUTC"])], Iu.prototype, "readStartTime", null), E([N()], Iu.prototype, "startTimeOffset", void 0), E([Li("startTimeOffset", ["attributes.StartTime", "attributes.StartTimeUTC"])], Iu.prototype, "readStartTimeOffset", null), E([N({ json: { read: { source: "attributes.StopCount" } } })], Iu.prototype, "stopCount", void 0), E([N({ types: rd })], Iu.prototype, "symbol", void 0), E([N()], Iu.prototype, "totalCosts", void 0), E([Li("totalCosts", ["attributes"])], Iu.prototype, "readTotalCosts", null), E([N()], Iu.prototype, "totalDistance", void 0), E([N()], Iu.prototype, "totalDuration", void 0), E([N()], Iu.prototype, "totalLateDuration", void 0), E([N()], Iu.prototype, "totalViolations", void 0), E([Li("totalViolations", ["attributes"])], Iu.prototype, "readTotalViolations", null), E([N()], Iu.prototype, "totalWait", void 0), E([Li("totalWait", ["attributes"])], Iu.prototype, "readTotalWait", null), E([N()], Iu.prototype, "totalWaitDuration", void 0), E([N({ readOnly: !0, json: { read: !1 } })], Iu.prototype, "type", void 0), E([N()], Iu.prototype, "version", void 0), Iu = $De = E([dt("esri.rest.support.RouteInfo")], Iu); +const hK = Iu; +var BDe; +let Oo = BDe = class extends _a($i) { + constructor(t) { + super(t), this.arriveCurbApproach = null, this.arriveTime = null, this.arriveTimeOffset = null, this.bearing = null, this.bearingTol = null, this.cumulativeCosts = null, this.cumulativeDistance = null, this.cumulativeDuration = null, this.curbApproach = null, this.departCurbApproach = null, this.departTime = null, this.departTimeOffset = null, this.distanceToNetworkInMeters = null, this.geometry = null, this.lateDuration = null, this.locationType = null, this.name = null, this.navLatency = null, this.objectId = null, this.popupTemplate = null, this.posAlong = null, this.routeName = null, this.serviceCosts = null, this.serviceDistance = null, this.serviceDuration = null, this.sequence = null, this.sideOfEdge = null, this.snapX = null, this.snapY = null, this.snapZ = null, this.sourceId = null, this.sourceOid = null, this.status = null, this.symbol = null, this.timeWindowEnd = null, this.timeWindowEndOffset = null, this.timeWindowStart = null, this.timeWindowStartOffset = null, this.type = "stop", this.violations = null, this.waitDuration = null, this.wait = null; + } + readArriveTimeOffset(t, e) { + return wte(e.attributes.ArriveTime, e.attributes.ArriveTimeUTC); + } + readCumulativeCosts(t, e) { + return $E(e.attributes, "Cumul_"); + } + readDepartTimeOffset(t, e) { + return wte(e.attributes.DepartTime, e.attributes.DepartTimeUTC); + } + readServiceCosts(t, e) { + return $E(e.attributes, "Attr_"); + } + writeServiceCosts(t, e) { + tBe(t, e, "Attr_"); + } + writeTimeWindowEnd(t, e) { + ut(t) || (e.attributes || (e.attributes = {}), e.attributes.TimeWindowEnd = t.getTime()); + } + writeTimeWindowStart(t, e) { + ut(t) || (e.attributes || (e.attributes = {}), e.attributes.TimeWindowStart = t.getTime()); + } + readViolations(t, e) { + return $E(e.attributes, "Violation_"); + } + readWait(t, e) { + return $E(e.attributes, "Wait_"); + } + static fromGraphic(t) { + return new BDe({ arriveCurbApproach: _e(t.attributes.ArrivalCurbApproach) ? fy.fromJSON(t.attributes.ArrivalCurbApproach) : null, arriveTime: _e(t.attributes.ArrivalTime) ? new Date(t.attributes.ArrivalTime) : null, arriveTimeOffset: t.attributes.ArrivalUTCOffset, cumulativeCosts: _e(t.attributes.CumulativeCosts) ? oz(JSON.parse(t.attributes.CumulativeCosts)) : null, cumulativeDistance: t.attributes.CumulativeMeters ?? null, cumulativeDuration: t.attributes.CumulativeMinutes ?? null, curbApproach: _e(t.attributes.CurbApproach) ? fy.fromJSON(t.attributes.CurbApproach) : null, departCurbApproach: _e(t.attributes.DepartureCurbApproach) ? fy.fromJSON(t.attributes.DepartureCurbApproach) : null, departTime: _e(t.attributes.DepartureTime) ? new Date(t.attributes.DepartureTime) : null, departTimeOffset: t.attributes.DepartureUTCOffset ?? null, geometry: t.geometry, lateDuration: t.attributes.LateMinutes ?? null, locationType: _e(t.attributes.LocationType) ? dZ.fromJSON(t.attributes.LocationType) : null, name: t.attributes.Name, objectId: t.attributes.ObjectID ?? t.attributes.__OBJECTID, popupTemplate: t.popupTemplate, routeName: t.attributes.RouteName, sequence: t.attributes.Sequence ?? null, serviceCosts: _e(t.attributes.ServiceCosts) ? oz(JSON.parse(t.attributes.ServiceCosts)) : null, serviceDistance: t.attributes.ServiceMeters ?? null, serviceDuration: t.attributes.ServiceMinutes ?? null, status: _e(t.attributes.Status) ? m4.fromJSON(t.attributes.Status) : null, symbol: t.symbol, timeWindowEnd: _e(t.attributes.TimeWindowEnd) ? new Date(t.attributes.TimeWindowEnd) : null, timeWindowEndOffset: t.attributes.TimeWindowEndUTCOffset ?? null, timeWindowStart: _e(t.attributes.TimeWindowStart) ? new Date(t.attributes.TimeWindowStart) : null, timeWindowStartOffset: t.attributes.TimeWindowStartUTCOffset ?? null, waitDuration: t.attributes.WaitMinutes ?? null }); + } + toGraphic() { + const t = { ObjectID: this.objectId, ArrivalCurbApproach: _e(this.arriveCurbApproach) ? fy.toJSON(this.arriveCurbApproach) : null, ArrivalTime: _e(this.arriveTime) ? this.arriveTime.getTime() : null, ArrivalUTCOffset: this.arriveTimeOffset, CumulativeCosts: _e(this.cumulativeCosts) ? JSON.stringify(az(this.cumulativeCosts)) : null, CumulativeMeters: this.cumulativeDistance, CumulativeMinutes: this.cumulativeDuration, CurbApproach: _e(this.curbApproach) ? fy.toJSON(this.curbApproach) : null, DepartureCurbApproach: _e(this.departCurbApproach) ? fy.toJSON(this.departCurbApproach) : null, DepartureTime: _e(this.departTime) ? this.departTime.getTime() : null, DepartureUTCOffset: this.departTimeOffset, LateMinutes: this.lateDuration, LocationType: _e(this.locationType) ? dZ.toJSON(this.locationType) : null, Name: this.name, RouteName: this.routeName, Sequence: this.sequence, ServiceCosts: _e(this.serviceCosts) ? JSON.stringify(az(this.serviceCosts)) : null, ServiceMeters: this.serviceDistance, ServiceMinutes: this.serviceDuration, Status: _e(this.status) ? m4.toJSON(this.status) : null, TimeWindowEnd: _e(this.timeWindowEnd) ? this.timeWindowEnd.getTime() : null, TimeWindowEndUTCOffset: this.timeWindowEndOffset ?? this.arriveTimeOffset, TimeWindowStart: _e(this.timeWindowStart) ? this.timeWindowStart.getTime() : null, TimeWindowStartUTCOffset: this.timeWindowStartOffset ?? this.arriveTimeOffset, WaitMinutes: this.waitDuration }; + return new ro({ geometry: this.geometry, attributes: t, symbol: this.symbol, popupTemplate: this.popupTemplate }); + } +}; +Oo.fields = [{ name: "ObjectID", alias: "ObjectID", type: "esriFieldTypeOID", editable: !1, nullable: !1, domain: null }, { name: "ArrivalCurbApproach", alias: "Arrival Curb Approach", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNACurbApproachType", codedValues: [{ name: "Either side", code: 0 }, { name: "From the right", code: 1 }, { name: "From the left", code: 2 }, { name: "Depart in the same direction", code: 3 }] } }, { name: "ArrivalTime", alias: "Arrival Time", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !0 }, { name: "ArrivalUTCOffset", alias: "Arrival Time: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "CumulativeCosts", alias: "Cumulative Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "CumulativeMeters", alias: "Cumulative Meters", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "CumulativeMinutes", alias: "Cumulative Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !0 }, { name: "CurbApproach", alias: "Curb Approach", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !1, domain: { type: "codedValue", name: "esriNACurbApproachType", codedValues: [{ name: "Either side", code: 0 }, { name: "From the right", code: 1 }, { name: "From the left", code: 2 }, { name: "Depart in the same direction", code: 3 }] } }, { name: "DepartureCurbApproach", alias: "Departure Curb Approach", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNACurbApproachType", codedValues: [{ name: "Either side", code: 0 }, { name: "From the right", code: 1 }, { name: "From the left", code: 2 }, { name: "Depart in the same direction", code: 3 }] } }, { name: "DepartureTime", alias: "Departure Time", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !0 }, { name: "DepartureUTCOffset", alias: "Departure Time: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "LateMinutes", alias: "Minutes Late", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }, { name: "LocationType", alias: "Location Type", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNALocationType", codedValues: [{ name: "Stop", code: 0 }, { name: "Waypoint", code: 1 }] } }, { name: "Name", alias: "Name", type: "esriFieldTypeString", length: 255, editable: !0, nullable: !0, visible: !0 }, { name: "RouteName", alias: "Route Name", type: "esriFieldTypeString", length: 255, editable: !0, nullable: !0, visible: !0 }, { name: "Sequence", alias: "Sequence", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "ServiceCosts", alias: "Service Costs", type: "esriFieldTypeString", length: 1048576, editable: !0, nullable: !0, visible: !1, domain: null }, { name: "ServiceMeters", alias: "Service Meters", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }, { name: "ServiceMinutes", alias: "Service Minutes", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }, { name: "Status", alias: "Status", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0, domain: { type: "codedValue", name: "esriNAObjectStatus", codedValues: [{ name: "OK", code: 0 }, { name: "Not Located on Network", code: 1 }, { name: "Network Unbuilt", code: 2 }, { name: "Prohibited Street", code: 3 }, { name: "Invalid Field Values", code: 4 }, { name: "Cannot Reach", code: 5 }, { name: "Time Window Violation", code: 6 }] } }, { name: "TimeWindowEnd", alias: "Time Window End", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !1 }, { name: "TimeWindowEndUTCOffset", alias: "Time Window End: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "TimeWindowStart", alias: "Time Window Start", type: "esriFieldTypeDate", length: 36, editable: !0, nullable: !0, visible: !1 }, { name: "TimeWindowStartUTCOffset", alias: "Time Window Start: Offset from UTC in Minutes", type: "esriFieldTypeInteger", editable: !0, nullable: !0, visible: !0 }, { name: "WaitMinutes", alias: "Minutes Early", type: "esriFieldTypeDouble", editable: !0, nullable: !0, visible: !1 }], Oo.popupInfo = { title: "{Name}", fieldInfos: [{ fieldName: "Name", label: "Name", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "RouteName", label: "Route Name", isEditable: !0, tooltip: "", visible: !0, stringFieldOption: "textbox" }, { fieldName: "Sequence", label: "Sequence", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ArrivalTime", label: "Arrival Time", isEditable: !0, tooltip: "", visible: !0, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "ArrivalUTCOffset", label: "Arrival Time: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "DepartureTime", label: "Departure Time", isEditable: !0, tooltip: "", visible: !0, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "DepartureUTCOffset", label: "Departure Time: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "CurbApproach", label: "Curb Approach", isEditable: !0, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ArrivalCurbApproach", label: "Arrival Curb Approach", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "DepartureCurbApproach", label: "Departure Curb Approach", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "Status", label: "Status", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "LocationType", label: "Location Type", isEditable: !1, tooltip: "", visible: !0, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TimeWindowStart", label: "Time Window Start", isEditable: !0, tooltip: "", visible: !1, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "TimeWindowStartUTCOffset", label: "Time Window Start: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "TimeWindowEnd", label: "Time Window End", isEditable: !0, tooltip: "", visible: !1, format: { dateFormat: "shortDateShortTime24" }, stringFieldOption: "textbox" }, { fieldName: "TimeWindowEndUTCOffset", label: "Time Window End: Offset from UTC in Minutes", isEditable: !1, tooltip: "", visible: !1, format: { places: 0, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ServiceMinutes", label: "Service Minutes", isEditable: !0, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ServiceMeters", label: "Service Meters", isEditable: !0, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "ServiceCosts", label: "Service Costs", isEditable: !0, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "CumulativeMinutes", label: "Cumulative Minutes", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "CumulativeMeters", label: "Cumulative Meters", isEditable: !1, tooltip: "", visible: !0, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "CumulativeCosts", label: "Cumulative Costs", isEditable: !0, tooltip: "", visible: !1, stringFieldOption: "textbox" }, { fieldName: "LateMinutes", label: "Minutes Late", isEditable: !1, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }, { fieldName: "WaitMinutes", label: "Minutes Early", isEditable: !1, tooltip: "", visible: !1, format: { places: 2, digitSeparator: !0 }, stringFieldOption: "textbox" }], description: null, showAttachments: !1, mediaInfos: [] }, E([N({ type: fy.apiValues, json: { read: { source: "attributes.ArrivalCurbApproach", reader: fy.read } } })], Oo.prototype, "arriveCurbApproach", void 0), E([N({ type: Date, json: { read: { source: "attributes.ArriveTimeUTC" } } })], Oo.prototype, "arriveTime", void 0), E([N()], Oo.prototype, "arriveTimeOffset", void 0), E([Li("arriveTimeOffset", ["attributes.ArriveTime", "attributes.ArriveTimeUTC"])], Oo.prototype, "readArriveTimeOffset", null), E([N({ json: { name: "attributes.Bearing", read: !1, write: !0 } })], Oo.prototype, "bearing", void 0), E([N({ json: { name: "attributes.BearingTol", read: !1, write: !0 } })], Oo.prototype, "bearingTol", void 0), E([N()], Oo.prototype, "cumulativeCosts", void 0), E([Li("cumulativeCosts", ["attributes"])], Oo.prototype, "readCumulativeCosts", null), E([N()], Oo.prototype, "cumulativeDistance", void 0), E([N()], Oo.prototype, "cumulativeDuration", void 0), E([N({ type: fy.apiValues, json: { name: "attributes.CurbApproach", read: { reader: fy.read }, write: { writer: fy.write } } })], Oo.prototype, "curbApproach", void 0), E([N({ type: fy.apiValues, json: { read: { source: "attributes.DepartCurbApproach", reader: fy.read } } })], Oo.prototype, "departCurbApproach", void 0), E([N({ type: Date, json: { read: { source: "attributes.DepartTimeUTC" } } })], Oo.prototype, "departTime", void 0), E([N()], Oo.prototype, "departTimeOffset", void 0), E([Li("departTimeOffset", ["attributes.DepartTime", "attributes.DepartTimeUTC"])], Oo.prototype, "readDepartTimeOffset", null), E([N({ json: { read: { source: "attributes.DistanceToNetworkInMeters" } } })], Oo.prototype, "distanceToNetworkInMeters", void 0), E([N({ type: Xi, json: { write: !0 } })], Oo.prototype, "geometry", void 0), E([N()], Oo.prototype, "lateDuration", void 0), E([N({ type: dZ.apiValues, json: { name: "attributes.LocationType", read: { reader: dZ.read }, write: { writer: dZ.write } } })], Oo.prototype, "locationType", void 0), E([N({ json: { name: "attributes.Name" } })], Oo.prototype, "name", void 0), E([N({ json: { name: "attributes.NavLatency", read: !1, write: !0 } })], Oo.prototype, "navLatency", void 0), E([N({ json: { name: "attributes.ObjectID" } })], Oo.prototype, "objectId", void 0), E([N({ type: $h })], Oo.prototype, "popupTemplate", void 0), E([N({ json: { read: { source: "attributes.PosAlong" } } })], Oo.prototype, "posAlong", void 0), E([N({ json: { name: "attributes.RouteName" } })], Oo.prototype, "routeName", void 0), E([N()], Oo.prototype, "serviceCosts", void 0), E([Li("serviceCosts", ["attributes"])], Oo.prototype, "readServiceCosts", null), E([mr("serviceCosts")], Oo.prototype, "writeServiceCosts", null), E([N()], Oo.prototype, "serviceDistance", void 0), E([N()], Oo.prototype, "serviceDuration", void 0), E([N({ json: { name: "attributes.Sequence" } })], Oo.prototype, "sequence", void 0), E([N({ type: dme.apiValues, json: { read: { source: "attributes.SideOfEdge", reader: dme.read } } })], Oo.prototype, "sideOfEdge", void 0), E([N({ json: { read: { source: "attributes.SnapX" } } })], Oo.prototype, "snapX", void 0), E([N({ json: { read: { source: "attributes.SnapY" } } })], Oo.prototype, "snapY", void 0), E([N({ json: { read: { source: "attributes.SnapZ" } } })], Oo.prototype, "snapZ", void 0), E([N({ json: { read: { source: "attributes.SourceID" } } })], Oo.prototype, "sourceId", void 0), E([N({ json: { read: { source: "attributes.SourceOID" } } })], Oo.prototype, "sourceOid", void 0), E([N({ type: m4.apiValues, json: { read: { source: "attributes.Status", reader: m4.read } } })], Oo.prototype, "status", void 0), E([N({ types: rd })], Oo.prototype, "symbol", void 0), E([N({ type: Date, json: { name: "attributes.TimeWindowEnd" } })], Oo.prototype, "timeWindowEnd", void 0), E([mr("timeWindowEnd")], Oo.prototype, "writeTimeWindowEnd", null), E([N()], Oo.prototype, "timeWindowEndOffset", void 0), E([N({ type: Date, json: { name: "attributes.TimeWindowStart" } })], Oo.prototype, "timeWindowStart", void 0), E([mr("timeWindowStart")], Oo.prototype, "writeTimeWindowStart", null), E([N()], Oo.prototype, "timeWindowStartOffset", void 0), E([N({ readOnly: !0, json: { read: !1 } })], Oo.prototype, "type", void 0), E([N()], Oo.prototype, "violations", void 0), E([Li("violations", ["attributes"])], Oo.prototype, "readViolations", null), E([N()], Oo.prototype, "waitDuration", void 0), E([N()], Oo.prototype, "wait", void 0), E([Li("wait", ["attributes"])], Oo.prototype, "readWait", null), Oo = BDe = E([dt("esri.rest.support.Stop")], Oo); +const c6 = Oo, zfr = Object.freeze({ remove() { +}, pause() { +}, resume() { +} }), Hfr = ["route-info", "direction-line", "direction-point", "polygon-barrier", "polyline-barrier", "point-barrier", "stop"], Rq = { graphic: null, property: null, oldValue: null, newValue: null }; +function iBe(t) { + return t instanceof AG || t instanceof PG || t instanceof a6 || t instanceof l6 || t instanceof u6 || t instanceof hK || t instanceof c6; +} +function Wfr(t) { + return gr.isCollection(t) && t.length && iBe(t.getItemAt(0)); +} +function qfr(t) { + return Array.isArray(t) && t.length > 0 && iBe(t[0]); +} +let dK = class extends ky($y) { + constructor() { + super(...arguments), this._graphics = new gr(), this._highlightIds = /* @__PURE__ */ new Map(), this._networkFeatureMap = /* @__PURE__ */ new Map(), this._networkGraphicMap = /* @__PURE__ */ new Map(); + } + get _routeItems() { + return new XS({ getCollections: () => _e(this.layer) && !this.destroyed ? [_e(this.layer.routeInfo) ? new gr([this.layer.routeInfo]) : null, this.layer.directionLines, this.layer.directionPoints, this.layer.polygonBarriers, this.layer.polylineBarriers, this.layer.pointBarriers, this.layer.stops] : [] }); + } + initialize() { + this.updatingHandles.addOnCollectionChange(() => this._routeItems, (e) => this._routeItemsChanged(e), jo); + } + destroy() { + this._networkFeatureMap.clear(), this._networkGraphicMap.clear(), this._graphics.removeAll(), this._get("_routeItems")?.destroy(); + } + attach() { + this._createGraphicsView(); + } + detach() { + this._destroyGraphicsView(); + } + async fetchPopupFeatures(e) { + return this._graphicsView.hitTest(e).filter((i) => !!i.popupTemplate); + } + highlight(e) { + let i; + i = iBe(e) ? [this._getNetworkFeatureUid(e)] : qfr(e) ? e.map((n) => this._getNetworkFeatureUid(n)) : Wfr(e) ? e.map((n) => this._getNetworkFeatureUid(n)).toArray() : [e.uid]; + const r = i.filter(_e); + return r.length ? (this._addHighlight(r), { remove: () => this._removeHighlight(r) }) : zfr; + } + async hitTest(e, i) { + if (this.suspended) + return null; + const r = this._graphicsView.hitTest(e).filter(_e).map((s) => this._networkGraphicMap.get(s)); + if (!r.length) + return null; + const { layer: n } = this; + return r.reverse().map((s) => ({ type: "route", layer: n, mapPoint: e, networkFeature: s })); + } + isUpdating() { + return this._graphicsView.updating; + } + moveStart() { + } + moveEnd() { + } + update(e) { + this._graphicsView.processUpdate(e); + } + viewChange() { + this._graphicsView.viewChange(); + } + _addHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i); + this._highlightIds.set(i, r + 1); + } else + this._highlightIds.set(i, 1); + this._updateHighlight(); + } + _createGraphic(e) { + const i = e.toGraphic(); + return i.layer = this.layer, i.sourceLayer = this.layer, i; + } + _createGraphicsView() { + const e = this.view, i = () => this.requestUpdate(), r = new $O(e.featuresTilingScheme); + this._graphicsView = new _x({ container: r, graphics: this._graphics, requestUpdateCallback: i, view: e }), this.container.addChild(r), this._updateHighlight(); + } + _destroyGraphicsView() { + this.container.removeChild(this._graphicsView.container), this._graphicsView.destroy(); + } + _getDrawOrder(e) { + const i = this._networkGraphicMap.get(e); + return Hfr.indexOf(i.type); + } + _getNetworkFeatureUid(e) { + return this._networkFeatureMap.has(e) ? this._networkFeatureMap.get(e).uid : null; + } + _removeHighlight(e) { + for (const i of e) + if (this._highlightIds.has(i)) { + const r = this._highlightIds.get(i) - 1; + r === 0 ? this._highlightIds.delete(i) : this._highlightIds.set(i, r); + } + this._updateHighlight(); + } + _routeItemsChanged(e) { + if (e.removed.length) { + this._graphics.removeMany(e.removed.map((i) => { + const r = this._networkFeatureMap.get(i); + return this._networkFeatureMap.delete(i), this._networkGraphicMap.delete(r), r; + })); + for (const i of e.removed) + this.removeHandles(i); + } + if (e.added.length) { + this._graphics.addMany(e.added.map((i) => { + const r = this._createGraphic(i); + return ut(r.symbol) ? null : (this._networkFeatureMap.set(i, r), this._networkGraphicMap.set(r, i), r); + }).filter(_e)); + for (const i of e.added) + this.addHandles([Qi(() => i.geometry, (r, n) => { + this._updateGraphic(i, "geometry", r, n); + }), Qi(() => i.symbol, (r, n) => { + this._updateGraphic(i, "symbol", r, n); + })], i); + this._graphics.sort((i, r) => this._getDrawOrder(i) - this._getDrawOrder(r)); + } + } + _updateGraphic(e, i, r, n) { + if (!this._networkFeatureMap.has(e)) { + const o = this._createGraphic(e); + return this._networkFeatureMap.set(e, o), this._networkGraphicMap.set(o, e), void this._graphics.add(o); + } + const s = this._networkFeatureMap.get(e); + s[i] = r, Rq.graphic = s, Rq.property = i, Rq.oldValue = n, Rq.newValue = r, this._graphicsView.graphicUpdateHandler(Rq); + } + _updateHighlight() { + const e = Array.from(this._highlightIds.keys()); + this._graphicsView.setHighlight(e); + } +}; +E([N()], dK.prototype, "_graphics", void 0), E([N()], dK.prototype, "_routeItems", null), dK = E([dt("esri.views.2d.layers.RouteLayerView2D")], dK); +const Yfr = dK, Xfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Yfr +}, Symbol.toStringTag, { value: "Module" })); +function oot(t, e) { + if (ut(t) && ut(e)) + return null; + const i = {}; + return _e(e) && (i.geometry = e.toJSON()), _e(t) && (i.where = t), i; +} +let yj = class extends zve { + constructor() { + super(...arguments), this._enabledEventTypes = /* @__PURE__ */ new Set(), this._isUserPaused = !1, this.errorString = null, this.connectionStatus = "disconnected"; + } + initialize() { + this.addHandles([Qi(() => this.layer.customParameters, (e) => this._proxy.updateCustomParameters(e)), this.layer.on("send-message-to-socket", (e) => this._proxy.sendMessageToSocket(e)), this.layer.on("send-message-to-client", (e) => this._proxy.sendMessageToClient(e)), Qi(() => this.layer.purgeOptions, () => this._update()), Qi(() => this.suspended, (e) => { + e ? this._proxy.pauseStream() : this._isUserPaused || this._proxy.resumeStream(); + })], "constructor"); + } + get connectionError() { + if (this.errorString) + return new ot("stream-controller", this.errorString); + } + pause() { + this._isUserPaused = !0, this._proxy.pauseStream(); + } + resume() { + this._isUserPaused = !1, this._proxy.resumeStream(); + } + on(e, i) { + if (Array.isArray(e)) + return pz(e.map((o) => this.on(o, i))); + const r = ["data-received", "message-received"].includes(e); + r && (this._enabledEventTypes.add(e), this._proxy.enableEvent(e, !0)); + const n = super.on(e, i), s = this; + return { remove() { + n.remove(), r && (s._proxy.closed || s.hasEventListener(e) || s._proxy.enableEvent(e, !1)); + } }; + } + queryLatestObservations(e, i) { + if (!(this.layer.timeInfo?.endField || this.layer.timeInfo?.startField || this.layer.timeInfo?.trackIdField)) + throw new ot("streamlayer-no-timeField", "queryLatestObservation can only be used with services that define a TrackIdField"); + return this._proxy.queryLatestObservations(this._cleanUpQuery(e), i).then((r) => { + const n = sc.fromJSON(r); + return n.features.forEach((s) => { + s.layer = this.layer, s.sourceLayer = this.layer; + }), n; + }); + } + detach() { + super.detach(), this.connectionStatus = "disconnected"; + } + _createClientOptions() { + return { ...super._createClientOptions(), setProperty: (e) => { + this.set(e.propertyName, e.value); + } }; + } + _createTileRendererHash(e) { + const i = `${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(oot(this.layer.definitionExpression, this.layer.geometryDefinition))})`; + return super._createTileRendererHash(e) + i; + } + async _createServiceOptions() { + const e = this.layer, { objectIdField: i } = e, r = e.fields.map((a) => a.toJSON()), n = Gve(e.geometryType), s = e.timeInfo && e.timeInfo.toJSON() || null, o = e.spatialReference ? e.spatialReference.toJSON() : null; + return { type: "stream", fields: r, geometryType: n, objectIdField: i, timeInfo: s, source: this.layer.parsedUrl, serviceFilter: oot(this.layer.definitionExpression, this.layer.geometryDefinition), purgeOptions: this.layer.purgeOptions.toJSON(), enabledEventTypes: Array.from(this._enabledEventTypes.values()), spatialReference: o, maxReconnectionAttempts: this.layer.maxReconnectionAttempts, maxReconnectionInterval: this.layer.maxReconnectionInterval, updateInterval: this.layer.updateInterval, customParameters: e.customParameters }; + } +}; +E([N()], yj.prototype, "errorString", void 0), E([N({ readOnly: !0 })], yj.prototype, "connectionError", null), E([N()], yj.prototype, "connectionStatus", void 0), yj = E([dt("esri.views.2d.layers.StreamLayerView2D")], yj); +const Kfr = yj, Jfr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Kfr +}, Symbol.toStringTag, { value: "Module" })); +function Zfr(t, e) { + return !t.visible || t.minScale !== 0 && e > t.minScale || t.maxScale !== 0 && e < t.maxScale; +} +let VDe = class extends zve { + initialize() { + this.addHandles([Qi(() => this.view.scale, () => this._update(), jo)], "constructor"); + } + isUpdating() { + const e = this.layer.sublayers.some((l) => l.renderer != null), i = this._commandsQueue.updating, r = this._updatingRequiredFieldsPromise != null, n = !this._proxy || !this._proxy.isReady, s = this._pipelineIsUpdating, o = this.tileRenderer == null || this.tileRenderer?.updating, a = e && (i || r || n || s || o); + return Vi("esri-2d-log-updating") && console.log(`Updating FLV2D: ${a} + -> hasRenderer ${e} + -> hasPendingCommand ${i} + -> updatingRequiredFields ${r} + -> updatingProxy ${n} + -> updatingPipeline ${s} + -> updatingTileRenderer ${o} +`), a; + } + _injectOverrides(e) { + let i = super._injectOverrides(e); + const r = this.view.scale, n = this.layer.sublayers.filter((o) => Zfr(o, r)).map((o) => o.subtypeCode); + if (!n.length) + return i; + i = _e(i) ? i : new eie().toJSON(); + const s = `NOT ${this.layer.subtypeField} IN (${n.join(",")})`; + return i.where = i.where ? `(${i.where}) AND (${s})` : s, i; + } + _setLayersForFeature(e) { + const i = this.layer.fieldsIndex.get(this.layer.subtypeField), r = e.attributes[i.name], n = this.layer.sublayers.find((s) => s.subtypeCode === r); + e.layer = e.sourceLayer = n; + } + _createSchemaConfig() { + const e = { subtypeField: this.layer.subtypeField, sublayers: Array.from(this.layer.sublayers).map((s) => ({ featureReduction: null, geometryType: this.layer.geometryType, labelingInfo: s.labelingInfo, labelsVisible: s.labelsVisible, renderer: s.renderer, subtypeCode: s.subtypeCode, orderBy: null })) }, i = this.layer.sublayers.map((s) => s.subtypeCode).join(","), r = this.layer.sublayers.length ? `${this.layer.subtypeField} IN (${i})` : "1=2"; + let n = this.layer.definitionExpression ? this.layer.definitionExpression + " AND " : ""; + return n += r, { ...super._createSchemaConfig(), ...e, definitionExpression: n }; + } +}; +VDe = E([dt("esri.views.2d.layers.SubtypeGroupLayerView2D")], VDe); +const Qfr = VDe, emr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Qfr +}, Symbol.toStringTag, { value: "Module" })); +let fZ = class { + constructor(e, i) { + this._width = 0, this._height = 0, this._free = [], this._width = e, this._height = i, this._free.push(new Od(0, 0, e, i)); + } + get width() { + return this._width; + } + get height() { + return this._height; + } + allocate(e, i) { + if (e > this._width || i > this._height) + return new Od(); + let r = null, n = -1; + for (let s = 0; s < this._free.length; ++s) { + const o = this._free[s]; + e <= o.width && i <= o.height && (r === null || o.y <= r.y && o.x <= r.x) && (r = o, n = s); + } + return r === null ? new Od() : (this._free.splice(n, 1), r.width < r.height ? (r.width > e && this._free.push(new Od(r.x + e, r.y, r.width - e, i)), r.height > i && this._free.push(new Od(r.x, r.y + i, r.width, r.height - i))) : (r.width > e && this._free.push(new Od(r.x + e, r.y, r.width - e, r.height)), r.height > i && this._free.push(new Od(r.x, r.y + i, e, r.height - i))), new Od(r.x, r.y, e, i)); + } + release(e) { + for (let i = 0; i < this._free.length; ++i) { + const r = this._free[i]; + if (r.y === e.y && r.height === e.height && r.x + r.width === e.x) + r.width += e.width; + else if (r.x === e.x && r.width === e.width && r.y + r.height === e.y) + r.height += e.height; + else if (e.y === r.y && e.height === r.height && e.x + e.width === r.x) + r.x = e.x, r.width += e.width; + else { + if (e.x !== r.x || e.width !== r.width || e.y + e.height !== r.y) + continue; + r.y = e.y, r.height += e.height; + } + this._free.splice(i, 1), this.release(e); + } + this._free.push(e); + } +}, aot = class { + constructor(e, i, r) { + this.width = 0, this.height = 0, this._dirties = [], this._glyphData = [], this._currentPage = 0, this._glyphIndex = {}, this._textures = [], this._rangePromises = /* @__PURE__ */ new Map(), this.width = e, this.height = i, this._glyphSource = r, this._binPack = new fZ(e - 4, i - 4), this._glyphData.push(new Uint8Array(e * i)), this._dirties.push(!0), this._textures.push(void 0); + } + getGlyphItems(e, i) { + const r = [], n = this._glyphSource, s = /* @__PURE__ */ new Set(), o = 1 / 256; + for (const l of i) { + const c = Math.floor(l * o); + s.add(c); + } + const a = []; + return s.forEach((l) => { + if (l <= 256) { + const c = e + l; + if (this._rangePromises.has(c)) + a.push(this._rangePromises.get(c)); + else { + const h = n.getRange(e, l).then(() => { + this._rangePromises.delete(c); + }, () => { + this._rangePromises.delete(c); + }); + this._rangePromises.set(c, h), a.push(h); + } + } + }), Promise.all(a).then(() => { + let l = this._glyphIndex[e]; + l || (l = {}, this._glyphIndex[e] = l); + for (const c of i) { + const h = l[c]; + if (h) { + r[c] = { sdf: !0, rect: h.rect, metrics: h.metrics, page: h.page, code: c }; + continue; + } + const p = n.getGlyph(e, c); + if (!p || !p.metrics) + continue; + const y = p.metrics; + let v; + if (y.width === 0) + v = new Od(0, 0, 0, 0); + else { + const I = y.width + 6, P = y.height + 2 * 3; + let F = I % 4 ? 4 - I % 4 : 4, k = P % 4 ? 4 - P % 4 : 4; + F === 1 && (F = 5), k === 1 && (k = 5), v = this._binPack.allocate(I + F, P + k), v.isEmpty && (this._dirties[this._currentPage] || (this._glyphData[this._currentPage] = null), this._currentPage = this._glyphData.length, this._glyphData.push(new Uint8Array(this.width * this.height)), this._dirties.push(!0), this._textures.push(void 0), this._binPack = new fZ(this.width - 4, this.height - 4), v = this._binPack.allocate(I + F, P + k)); + const V = this._glyphData[this._currentPage], j = p.bitmap; + let Y, X; + if (j) + for (let Q = 0; Q < P; Q++) { + Y = I * Q, X = this.width * (v.y + Q + 1) + v.x; + for (let re = 0; re < I; re++) + V[X + re + 1] = j[Y + re]; + } + } + l[c] = { rect: v, metrics: y, tileIDs: null, page: this._currentPage }, r[c] = { sdf: !0, rect: v, metrics: y, page: this._currentPage, code: c }, this._dirties[this._currentPage] = !0; + } + return r; + }); + } + removeGlyphs(e) { + for (const i in this._glyphIndex) { + const r = this._glyphIndex[i]; + if (!r) + continue; + let n; + for (const s in r) + if (n = r[s], n.tileIDs.delete(e), n.tileIDs.size === 0) { + const o = this._glyphData[n.page], a = n.rect; + let l, c; + for (let h = 0; h < a.height; h++) + for (l = this.width * (a.y + h) + a.x, c = 0; c < a.width; c++) + o[l + c] = 0; + delete r[s], this._dirties[n.page] = !0; + } + } + } + bind(e, i, r, n = 0) { + this._textures[r] || (this._textures[r] = new Ts(e, { pixelFormat: cn.ALPHA, dataType: rs.UNSIGNED_BYTE, width: this.width, height: this.height }, new Uint8Array(this.width * this.height))); + const s = this._textures[r]; + s.setSamplingMode(i), this._dirties[r] && s.setData(this._glyphData[r]), e.bindTexture(s, n), this._dirties[r] = !1; + } + dispose() { + this._binPack = null; + for (const e of this._textures) + e && e.dispose(); + this._textures.length = 0; + } +}, U2e = class { + constructor(e) { + if (this._metrics = [], this._bitmaps = [], e) + for (; e.next(); ) + switch (e.tag()) { + case 1: { + const i = e.getMessage(); + for (; i.next(); ) + switch (i.tag()) { + case 3: { + const r = i.getMessage(); + let n, s, o, a, l, c, h; + for (; r.next(); ) + switch (r.tag()) { + case 1: + n = r.getUInt32(); + break; + case 2: + s = r.getBytes(); + break; + case 3: + o = r.getUInt32(); + break; + case 4: + a = r.getUInt32(); + break; + case 5: + l = r.getSInt32(); + break; + case 6: + c = r.getSInt32(); + break; + case 7: + h = r.getUInt32(); + break; + default: + r.skip(); + } + r.release(), n && (this._metrics[n] = { width: o, height: a, left: l, top: c, advance: h }, this._bitmaps[n] = s); + break; + } + default: + i.skip(); + } + i.release(); + break; + } + default: + e.skip(); + } + } + getMetrics(e) { + return this._metrics[e]; + } + getBitmap(e) { + return this._bitmaps[e]; + } +}, tmr = class { + constructor() { + this._ranges = []; + } + getRange(e) { + return this._ranges[e]; + } + addRange(e, i) { + this._ranges[e] = i; + } +}, lot = class { + constructor(e) { + this._glyphInfo = {}, this._baseURL = e; + } + getRange(e, i) { + const r = this._getFontStack(e); + if (r.getRange(i)) + return Promise.resolve(); + const n = 256 * i, s = n + 255; + if (this._baseURL) { + const o = this._baseURL.replace("{fontstack}", e).replace("{range}", n + "-" + s); + return ir(o, { responseType: "array-buffer" }).then((a) => { + r.addRange(i, new U2e(new f$(new Uint8Array(a.data), new DataView(a.data)))); + }).catch(() => { + r.addRange(i, new U2e()); + }); + } + return r.addRange(i, new U2e()), Promise.resolve(); + } + getGlyph(e, i) { + const r = this._getFontStack(e); + if (!r) + return; + const n = Math.floor(i / 256); + if (n > 256) + return; + const s = r.getRange(n); + return s ? { metrics: s.getMetrics(i), bitmap: s.getBitmap(i) } : void 0; + } + _getFontStack(e) { + let i = this._glyphInfo[e]; + return i || (i = this._glyphInfo[e] = new tmr()), i; + } +}; +const imr = "dasharray-"; +let z2e = class kFt { + constructor(e, i, r = 0) { + this._size = [], this._mosaicsData = [], this._textures = [], this._dirties = [], this._maxItemSize = 0, this._currentPage = 0, this._pageWidth = 0, this._pageHeight = 0, this._mosaicRects = {}, this.pixelRatio = 1, (e <= 0 || i <= 0) && console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"), this._pageWidth = e, this._pageHeight = i, r > 0 && (this._maxItemSize = r), this._binPack = new fZ(e - 4, i - 4); + } + dispose() { + this._binPack = null, this._mosaicRects = {}; + for (const e of this._textures) + e && e.dispose(); + this._textures.length = 0; + } + getWidth(e) { + return e >= this._size.length ? -1 : this._size[e][0]; + } + getHeight(e) { + return e >= this._size.length ? -1 : this._size[e][1]; + } + getPageSize(e) { + return e >= this._size.length ? null : this._size[e]; + } + setSpriteSource(e) { + if (this.dispose(), this.pixelRatio = e.devicePixelRatio, this._mosaicsData.length === 0) { + this._binPack = new fZ(this._pageWidth - 4, this._pageHeight - 4); + const i = Math.floor(this._pageWidth), r = Math.floor(this._pageHeight), n = new Uint32Array(i * r); + this._mosaicsData[0] = n, this._dirties.push(!0), this._size.push([this._pageWidth, this._pageHeight]), this._textures.push(void 0); + } + this._sprites = e; + } + getSpriteItem(e, i = !1) { + let r, n, s = this._mosaicRects[e]; + if (s) + return s; + if (!this._sprites || this._sprites.loadStatus !== "loaded" || (e && e.startsWith(imr) ? ([r, n] = this._rasterizeDash(e), i = !0) : r = this._sprites.getSpriteInfo(e), !r || !r.width || !r.height || r.width < 0 || r.height < 0)) + return null; + const o = r.width, a = r.height, [l, c, h] = this._allocateImage(o, a); + return l.width <= 0 ? null : (this._copy(l, r, c, h, i, n), s = { rect: l, width: o, height: a, sdf: r.sdf, simplePattern: !1, pixelRatio: r.pixelRatio, page: c }, this._mosaicRects[e] = s, s); + } + getSpriteItems(e) { + const i = {}; + for (const r of e) + i[r.name] = this.getSpriteItem(r.name, r.repeat); + return i; + } + getMosaicItemPosition(e, i) { + const r = this.getSpriteItem(e, i), n = r && r.rect; + if (!n) + return null; + n.width = r.width, n.height = r.height; + const s = r.width, o = r.height, a = 2; + return { tl: [n.x + a, n.y + a], br: [n.x + a + s, n.y + a + o], page: r.page }; + } + bind(e, i, r = 0, n = 0) { + if (r >= this._size.length || r >= this._mosaicsData.length) + return; + this._textures[r] || (this._textures[r] = new Ts(e, { pixelFormat: cn.RGBA, dataType: rs.UNSIGNED_BYTE, wrapMode: ds.CLAMP_TO_EDGE, width: this._size[r][0], height: this._size[r][1] }, new Uint8Array(this._mosaicsData[r].buffer))); + const s = this._textures[r]; + s.setSamplingMode(i), this._dirties[r] && s.setData(new Uint8Array(this._mosaicsData[r].buffer)), e.bindTexture(s, n), this._dirties[r] = !1; + } + static _copyBits(e, i, r, n, s, o, a, l, c, h, p) { + let y = n * i + r, v = l * o + a; + if (p) { + v -= o; + for (let x = -1; x <= h; x++, y = ((x + h) % h + n) * i + r, v += o) + for (let I = -1; I <= c; I++) + s[v + I] = e[y + (I + c) % c]; + } else + for (let x = 0; x < h; x++) { + for (let I = 0; I < c; I++) + s[v + I] = e[y + I]; + y += i, v += o; + } + } + _copy(e, i, r, n, s, o) { + if (!this._sprites || this._sprites.loadStatus !== "loaded" || r >= this._mosaicsData.length) + return; + const a = new Uint32Array(o ? o.buffer : this._sprites.image.buffer), l = this._mosaicsData[r]; + l && a || console.error("Source or target images are uninitialized!"); + const c = 2, h = o ? i.width : this._sprites.width; + kFt._copyBits(a, h, i.x, i.y, l, n[0], e.x + c, e.y + c, i.width, i.height, s), this._dirties[r] = !0; + } + _allocateImage(e, i) { + e += 2, i += 2; + const r = Math.max(e, i); + if (this._maxItemSize && this._maxItemSize < r) { + const a = new Od(0, 0, e, i); + return this._mosaicsData.push(new Uint32Array(e * i)), this._dirties.push(!0), this._size.push([e, i]), this._textures.push(void 0), [a, this._mosaicsData.length - 1, [e, i]]; + } + let n = e % 4 ? 4 - e % 4 : 4, s = i % 4 ? 4 - i % 4 : 4; + n === 1 && (n = 5), s === 1 && (s = 5); + const o = this._binPack.allocate(e + n, i + s); + return o.width <= 0 ? (this._dirties[this._currentPage] || (this._mosaicsData[this._currentPage] = null), this._currentPage = this._mosaicsData.length, this._mosaicsData.push(new Uint32Array(this._pageWidth * this._pageHeight)), this._dirties.push(!0), this._size.push([this._pageWidth, this._pageHeight]), this._textures.push(void 0), this._binPack = new fZ(this._pageWidth - 4, this._pageHeight - 4), this._allocateImage(e, i)) : [o, this._currentPage, [this._pageWidth, this._pageHeight]]; + } + _rasterizeDash(e) { + const i = /\[(.*?)\]/, r = e.match(i); + if (!r) + return null; + const n = r[1].split(",").map(Number), s = e.slice(e.lastIndexOf("-") + 1), [o, a, l] = YRt(n, s); + return [{ x: 0, y: 0, width: a, height: l, sdf: !0, pixelRatio: 1 }, new Uint8Array(o.buffer)]; + } +}, rmr = class { + constructor(e, i, r) { + this._layer = e, this._styleRepository = i, this.devicePixelRatio = r, this._spriteMosaic = null, this._glyphMosaic = null, this._connection = null; + } + destroy() { + this._connection?.close(), this._connection = null, this._styleRepository = null, this._layer = null, this._spriteMosaic = null, this._glyphMosaic = null; + } + get spriteMosaic() { + return this._spriteSourcePromise.then(() => this._spriteMosaic); + } + get glyphMosaic() { + return this._glyphMosaic; + } + async start(e) { + this._spriteSourcePromise = this._layer.loadSpriteSource(this.devicePixelRatio, e), this._spriteSourcePromise.then((n) => { + this._spriteMosaic = new z2e(1024, 1024, 250), this._spriteMosaic.setSpriteSource(n); + }); + const i = this._layer.currentStyleInfo.glyphsUrl, r = new lot(i ? M0(i, { ...this._layer.customParameters, token: this._layer.apiKey }) : null); + this._glyphMosaic = new aot(1024, 1024, r), this._broadcastPromise = p3("WorkerTileHandler", { client: this, schedule: e.schedule, signal: e.signal }).then((n) => { + if (this._connection = n, this._layer && !this._connection.closed) { + const s = n.broadcast("setStyle", this._layer.currentStyleInfo.style, e); + Promise.all(s).catch((o) => eI(o)); + } + }); + } + async updateStyle(e) { + return await this._broadcastPromise, this._broadcastPromise = Promise.all(this._connection.broadcast("updateStyle", e)), this._broadcastPromise; + } + setSpriteSource(e) { + const i = new z2e(1024, 1024, 250); + return i.setSpriteSource(e), this._spriteMosaic = i, this._spriteSourcePromise = Promise.resolve(e), i; + } + async setStyle(e, i) { + await this._broadcastPromise, this._styleRepository = e, this._spriteSourcePromise = this._layer.loadSpriteSource(this.devicePixelRatio, null), this._spriteSourcePromise.then((n) => { + this._spriteMosaic = new z2e(1024, 1024, 250), this._spriteMosaic.setSpriteSource(n); + }); + const r = new lot(this._layer.currentStyleInfo.glyphsUrl ? M0(this._layer.currentStyleInfo.glyphsUrl, { ...this._layer.customParameters, token: this._layer.apiKey }) : null); + return this._glyphMosaic = new aot(1024, 1024, r), this._broadcastPromise = Promise.all(this._connection.broadcast("setStyle", i)), this._broadcastPromise; + } + fetchTileData(e, i) { + return this._getRefKeys(e, i).then((r) => { + const n = this._layer.sourceNameToSource, s = []; + for (const o in n) + s.push(o); + return this._getSourcesData(s, r, i); + }); + } + parseTileData(e, i) { + const r = e && e.data; + if (!r) + return Promise.resolve(null); + const { sourceName2DataAndRefKey: n, transferList: s } = r; + return Object.keys(n).length === 0 ? Promise.resolve(null) : this._broadcastPromise.then(() => this._connection.invoke("createTileAndParse", { key: e.key.id, sourceName2DataAndRefKey: n, styleLayerUIDs: e.styleLayerUIDs }, { ...i, transferList: s })); + } + async getSprites(e) { + return await this._spriteSourcePromise, this._spriteMosaic.getSpriteItems(e); + } + getGlyphs(e) { + return this._glyphMosaic.getGlyphItems(e.font, e.codePoints); + } + async _getTilePayload(e, i, r) { + const n = Lh.pool.acquire(e.id), s = this._layer.sourceNameToSource[i], { level: o, row: a, col: l } = n; + Lh.pool.release(n); + try { + return { protobuff: await s.requestTile(o, a, l, r), sourceName: i }; + } catch (c) { + if (us(c)) + throw c; + return { protobuff: null, sourceName: i }; + } + } + _getRefKeys(e, i) { + const r = this._layer.sourceNameToSource, n = new Array(); + for (const s in r) { + const o = r[s].getRefKey(e, i); + n.push(o); + } + return Nu(n); + } + _getSourcesData(e, i, r) { + const n = []; + for (let s = 0; s < i.length; s++) + if (i[s].value == null || e[s] == null) + n.push(null); + else { + const o = this._getTilePayload(i[s].value, e[s], r); + n.push(o); + } + return Nu(n).then((s) => { + const o = {}, a = []; + for (let l = 0; l < s.length; l++) { + const c = s[l].value; + if (c && c.protobuff && c.protobuff.byteLength > 0) { + const h = i[l].value.id; + o[c.sourceName] = { refKey: h, protobuff: c.protobuff }, a.push(c.protobuff); + } + } + return { sourceName2DataAndRefKey: o, transferList: a }; + }); + } +}; +const uot = 512, nmr = 1e-6, smr = (t, e) => t + 1 / (1 << 2 * e); +let omr = class { + constructor(e, i) { + this._tiles = /* @__PURE__ */ new Map(), this._tileCache = new xz(40, (r) => r.dispose()), this._viewSize = [0, 0], this._visibleTiles = /* @__PURE__ */ new Map(), this.acquireTile = e.acquireTile, this.releaseTile = e.releaseTile, this.tileInfoView = e.tileInfoView, this._container = i; + } + destroy() { + for (const [e, i] of this._tiles) + i.dispose(); + this._tiles = null, this._tileCache.clear(), this._tileCache = null; + } + update(e) { + this._updateCacheSize(e); + const i = this.tileInfoView, r = i.getTileCoverage(e.state, 0, "smallest"), { spans: n, lodInfo: s } = r, { level: o } = s, a = this._tiles, l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(); + for (const { row: p, colFrom: y, colTo: v } of n) + for (let x = y; x <= v; x++) { + const I = Lh.getId(o, p, s.normalizeCol(x), s.getWorldForColumn(x)), P = this._getOrAcquireTile(I); + l.add(I), P.processed() ? this._addToContainer(P) : c.add(new Lh(I)); + } + for (const [p, y] of a) + y.isCoverage = l.has(p); + for (const p of c) + this._findPlaceholdersForMissingTiles(p, l); + let h = !1; + for (const [p, y] of a) + y.neededForCoverage = l.has(p), y.neededForCoverage || y.isHoldingForFade && i.intersects(r, y.key) && l.add(p), y.isFading && (h = !0); + for (const [p, y] of this._tiles) + l.has(p) || this._releaseTile(p); + return ZO.pool.release(r), !h; + } + clear() { + this._tiles.clear(), this._tileCache.clear(), this._visibleTiles.clear(); + } + clearCache() { + this._tileCache.clear(); + } + _findPlaceholdersForMissingTiles(e, i) { + const r = []; + for (const [s, o] of this._tiles) + this._addPlaceholderChild(r, o, e, i); + const n = r.reduce(smr, 0); + Math.abs(1 - n) < nmr || this._addPlaceholderParent(e.id, i); + } + _addPlaceholderChild(e, i, r, n) { + i.key.level <= r.level || !i.hasData() || lmr(r, i.key) && (this._addToContainer(i), n.add(i.id), e.push(i.key.level - r.level)); + } + _addPlaceholderParent(e, i) { + const r = this._tiles; + let n = e; + for (; ; ) { + if (n = amr(n), !n || i.has(n)) + return; + const s = r.get(n); + if (s && s.hasData()) + return this._addToContainer(s), void i.add(s.id); + } + } + _getOrAcquireTile(e) { + let i = this._tiles.get(e); + return i || (i = this._tileCache.pop(e), i || (i = this.acquireTile(new Lh(e))), this._tiles.set(e, i), i); + } + _releaseTile(e) { + const i = this._tiles.get(e); + this.releaseTile(i), this._removeFromContainer(i), this._tiles.delete(e), i.hasData() ? this._tileCache.put(e, i, 1) : i.dispose(); + } + _addToContainer(e) { + let i; + const r = [], n = this._container; + if (n.contains(e)) + return; + const s = this._visibleTiles; + for (const [o, a] of s) + this._canConnectDirectly(e, a) && r.push(a), ut(i) && this._canConnectDirectly(a, e) && (i = a); + if (_e(i)) { + for (const o of r) + i.childrenTiles.delete(o), e.childrenTiles.add(o), o.parentTile = e; + i.childrenTiles.add(e), e.parentTile = i; + } else + for (const o of r) + e.childrenTiles.add(o), o.parentTile = e; + s.set(e.id, e), n.addChild(e); + } + _removeFromContainer(e) { + if (this._visibleTiles.delete(e.id), this._container.removeChild(e), _e(e.parentTile)) { + e.parentTile.childrenTiles.delete(e); + for (const i of e.childrenTiles) + _e(e.parentTile) && e.parentTile.childrenTiles.add(i); + } + for (const i of e.childrenTiles) + i.parentTile = e.parentTile; + e.parentTile = null, e.childrenTiles.clear(); + } + _canConnectDirectly(e, i) { + const r = e.key; + let { level: n, row: s, col: o, world: a } = i.key; + const l = this._visibleTiles; + for (; n > 0; ) { + if (n--, s >>= 1, o >>= 1, r.level === n && r.row === s && r.col === o && r.world === a) + return !0; + if (l.has(`${n}/${s}/${o}/${a}`)) + return !1; + } + return !1; + } + _updateCacheSize(e) { + const i = e.state.size; + if (i[0] === this._viewSize[0] && i[1] === this._viewSize[1]) + return; + const r = Math.ceil(i[0] / uot) + 1, n = Math.ceil(i[1] / uot) + 1; + this._viewSize[0] = i[0], this._viewSize[1] = i[1], this._tileCache.maxSize = 5 * r * n; + } +}; +function amr(t) { + const [e, i, r, n] = t.split("/"), s = parseInt(e, 10); + return s === 0 ? null : `${s - 1}/${parseInt(i, 10) >> 1}/${parseInt(r, 10) >> 1}/${parseInt(n, 10)}`; +} +function lmr(t, e) { + const i = e.level - t.level; + return t.row === e.row >> i && t.col === e.col >> i && t.world === e.world; +} +let umr = class { + constructor(e) { + this.xTile = 0, this.yTile = 0, this.hash = 0, this.priority = 1, this.colliders = [], this.textVertexRanges = [], this.iconVertexRanges = [], this.tile = e; + } +}, cmr = class { + constructor() { + this.tileSymbols = [], this.parts = [{ startTime: 0, startOpacity: 0, targetOpacity: 0, show: !1 }, { startTime: 0, startOpacity: 0, targetOpacity: 0, show: !1 }], this.show = !1; + } +}; +function cot(t, e, i, r, n, s) { + const o = i - n; + if (o >= 0) + return (e >> o) + (r - (s << o)) * (t >> o); + const a = -o; + return e - (s - (r << a)) * (t >> a) << a; +} +let $Ft = class { + constructor(e, i, r) { + this._rows = Math.ceil(i / r), this._columns = Math.ceil(e / r), this._cellSize = r, this.cells = new Array(this._rows); + for (let n = 0; n < this._rows; n++) { + this.cells[n] = new Array(this._columns); + for (let s = 0; s < this._columns; s++) + this.cells[n][s] = []; + } + } + getCell(e, i) { + const r = Math.min(Math.max(Math.floor(i / this._cellSize), 0), this._rows - 1), n = Math.min(Math.max(Math.floor(e / this._cellSize), 0), this._columns - 1); + return this.cells[r] && this.cells[r][n] || null; + } + getCellSpan(e, i, r, n) { + return [Math.min(Math.max(Math.floor(e / this._cellSize), 0), this.columns - 1), Math.min(Math.max(Math.floor(i / this._cellSize), 0), this.rows - 1), Math.min(Math.max(Math.floor(r / this._cellSize), 0), this.columns - 1), Math.min(Math.max(Math.floor(n / this._cellSize), 0), this.rows - 1)]; + } + get cellSize() { + return this._cellSize; + } + get columns() { + return this._columns; + } + get rows() { + return this._rows; + } +}; +function hmr(t, e, i, r, n, s) { + const o = e[r++]; + for (let a = 0; a < o; a++) { + const l = new umr(s); + l.xTile = e[r++], l.yTile = e[r++], l.hash = e[r++], l.priority = e[r++]; + const c = e[r++]; + for (let y = 0; y < c; y++) { + const v = e[r++], x = e[r++], I = e[r++], P = e[r++], F = !!e[r++], k = e[r++], V = i[r++], j = i[r++], Y = e[r++], X = e[r++]; + l.colliders.push({ xTile: v, yTile: x, dxPixels: I, dyPixels: P, hard: F, partIndex: k, width: Y, height: X, minLod: V, maxLod: j }); + } + const h = t[r++]; + for (let y = 0; y < h; y++) + l.textVertexRanges.push([t[r++], t[r++]]); + const p = t[r++]; + for (let y = 0; y < p; y++) + l.iconVertexRanges.push([t[r++], t[r++]]); + n.push(l); + } + return r; +} +function dmr(t, e, i) { + for (const [r, n] of t.symbols) + pmr(t, e, i, n, r); +} +function pmr(t, e, i, r, n) { + const s = t.layerData.get(n); + if (s.type === Pg.SYMBOL) { + for (const o of r) { + const a = o.unique; + let l; + if (o.selectedForRendering) { + const c = a.parts[0], h = c.startOpacity, p = c.targetOpacity; + t.allSymbolsFadingOut = t.allSymbolsFadingOut && p === 0; + const y = i ? Math.floor(127 * h) | p << 7 : p ? 255 : 0; + l = y << 24 | y << 16 | y << 8 | y; + } else + l = 0; + for (const [c, h] of o.iconVertexRanges) + for (let p = c; p < c + h; p += 4) + s.iconOpacity[p / 4] = l; + if (o.selectedForRendering) { + const c = a.parts[1], h = c.startOpacity, p = c.targetOpacity; + t.allSymbolsFadingOut = t.allSymbolsFadingOut && p === 0; + const y = i ? Math.floor(127 * h) | p << 7 : p ? 255 : 0; + l = y << 24 | y << 16 | y << 8 | y; + } else + l = 0; + for (const [c, h] of o.textVertexRanges) + for (let p = c; p < c + h; p += 4) + s.textOpacity[p / 4] = l; + } + s.lastOpacityUpdate = e, s.opacityChanged = !0; + } +} +let Yve = class { + constructor(e, i) { + this.layerUIDs = [], this.isDestroyed = !1, this._data = e, this.memoryUsed = e.byteLength; + let r = 1; + const n = new Uint32Array(e); + this.layerUIDs = []; + const s = n[r++]; + for (let o = 0; o < s; o++) + this.layerUIDs[o] = n[r++]; + this.bufferDataOffset = r, i && (this.layer = i.getStyleLayerByUID(this.layerUIDs[0])); + } + get isPreparedForRendering() { + return ut(this._data); + } + get offset() { + return this.bufferDataOffset; + } + destroy() { + this.isDestroyed || (this.doDestroy(), this.isDestroyed = !0); + } + prepareForRendering(e) { + ut(this._data) || (this.doPrepareForRendering(e, this._data, this.bufferDataOffset), this._data = null); + } +}, fmr = class extends Yve { + constructor(e, i) { + super(e, i), this.type = Pg.LINE, this.lineIndexStart = 0, this.lineIndexCount = 0; + const r = new Uint32Array(e); + let n = this.bufferDataOffset; + this.lineIndexStart = r[n++], this.lineIndexCount = r[n++]; + const s = r[n++]; + if (s > 0) { + const o = /* @__PURE__ */ new Map(); + for (let a = 0; a < s; a++) { + const l = r[n++], c = r[n++], h = r[n++]; + o.set(l, [c, h]); + } + this.patternMap = o; + } + this.bufferDataOffset = n; + } + hasData() { + return this.lineIndexCount > 0; + } + triangleCount() { + return this.lineIndexCount / 3; + } + doDestroy() { + _e(this.lineVertexArrayObject) && this.lineVertexArrayObject.dispose(), _e(this.lineVertexBuffer) && this.lineVertexBuffer.dispose(), _e(this.lineIndexBuffer) && this.lineIndexBuffer.dispose(), this.lineVertexArrayObject = null, this.lineVertexBuffer = null, this.lineIndexBuffer = null, this.memoryUsed = 0; + } + doPrepareForRendering(e, i, r) { + const n = new Uint32Array(i), s = new Int32Array(n.buffer), o = n[r++]; + this.lineVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, o)), r += o; + const a = n[r++]; + this.lineIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, a)), r += a; + const l = this.layer.lineMaterial; + this.lineVertexArrayObject = new Ac(e, l.getAttributeLocations(), l.getLayoutInfo(), { geometry: this.lineVertexBuffer }, this.lineIndexBuffer); + } +}, mmr = class extends Yve { + constructor(e, i) { + super(e, i), this.type = Pg.FILL, this.fillIndexStart = 0, this.fillIndexCount = 0, this.outlineIndexStart = 0, this.outlineIndexCount = 0; + const r = new Uint32Array(e); + let n = this.bufferDataOffset; + this.fillIndexStart = r[n++], this.fillIndexCount = r[n++], this.outlineIndexStart = r[n++], this.outlineIndexCount = r[n++]; + const s = r[n++]; + if (s > 0) { + const o = /* @__PURE__ */ new Map(); + for (let a = 0; a < s; a++) { + const l = r[n++], c = r[n++], h = r[n++]; + o.set(l, [c, h]); + } + this.patternMap = o; + } + this.bufferDataOffset = n; + } + hasData() { + return this.fillIndexCount > 0 || this.outlineIndexCount > 0; + } + triangleCount() { + return (this.fillIndexCount + this.outlineIndexCount) / 3; + } + doDestroy() { + _e(this.fillVertexArrayObject) && this.fillVertexArrayObject.dispose(), _e(this.fillVertexBuffer) && this.fillVertexBuffer.dispose(), _e(this.fillIndexBuffer) && this.fillIndexBuffer.dispose(), this.fillVertexArrayObject = null, this.fillVertexBuffer = null, this.fillIndexBuffer = null, _e(this.outlineVertexArrayObject) && this.outlineVertexArrayObject.dispose(), _e(this.outlineVertexBuffer) && this.outlineVertexBuffer.dispose(), _e(this.outlineIndexBuffer) && this.outlineIndexBuffer.dispose(), this.outlineVertexArrayObject = null, this.outlineVertexBuffer = null, this.outlineIndexBuffer = null, this.memoryUsed = 0; + } + doPrepareForRendering(e, i, r) { + const n = new Uint32Array(i), s = new Int32Array(n.buffer), o = n[r++]; + this.fillVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, o)), r += o; + const a = n[r++]; + this.fillIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, a)), r += a; + const l = n[r++]; + this.outlineVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, l)), r += l; + const c = n[r++]; + this.outlineIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, c)), r += c; + const h = this.layer, p = h.fillMaterial, y = h.outlineMaterial; + this.fillVertexArrayObject = new Ac(e, p.getAttributeLocations(), p.getLayoutInfo(), { geometry: this.fillVertexBuffer }, this.fillIndexBuffer), this.outlineVertexArrayObject = new Ac(e, y.getAttributeLocations(), y.getLayoutInfo(), { geometry: this.outlineVertexBuffer }, this.outlineIndexBuffer); + } +}, gmr = class extends Yve { + constructor(e, i, r) { + super(e, i), this.type = Pg.SYMBOL, this.iconPerPageElementsMap = /* @__PURE__ */ new Map(), this.glyphPerPageElementsMap = /* @__PURE__ */ new Map(), this.symbolInstances = [], this.isIconSDF = !1, this.opacityChanged = !1, this.lastOpacityUpdate = 0, this.symbols = []; + const n = new Uint32Array(e), s = new Int32Array(e), o = new Float32Array(e); + let a = this.bufferDataOffset; + this.isIconSDF = !!n[a++]; + const l = n[a++]; + for (let y = 0; y < l; y++) { + const v = n[a++], x = n[a++], I = n[a++]; + this.iconPerPageElementsMap.set(v, [x, I]); + } + const c = n[a++]; + for (let y = 0; y < c; y++) { + const v = n[a++], x = n[a++], I = n[a++]; + this.glyphPerPageElementsMap.set(v, [x, I]); + } + const h = n[a++], p = n[a++]; + this.iconOpacity = new Int32Array(h), this.textOpacity = new Int32Array(p), a = hmr(n, s, o, a, this.symbols, r), this.bufferDataOffset = a; + } + hasData() { + return this.iconPerPageElementsMap.size > 0 || this.glyphPerPageElementsMap.size > 0; + } + triangleCount() { + let e = 0; + for (const [i, r] of this.iconPerPageElementsMap) + e += r[1]; + for (const [i, r] of this.glyphPerPageElementsMap) + e += r[1]; + return e / 3; + } + doDestroy() { + _e(this.iconVertexArrayObject) && this.iconVertexArrayObject.dispose(), _e(this.iconVertexBuffer) && this.iconVertexBuffer.dispose(), _e(this.iconOpacityBuffer) && this.iconOpacityBuffer.dispose(), _e(this.iconIndexBuffer) && this.iconIndexBuffer.dispose(), this.iconVertexArrayObject = null, this.iconVertexBuffer = null, this.iconOpacityBuffer = null, this.iconIndexBuffer = null, _e(this.textVertexArrayObject) && this.textVertexArrayObject.dispose(), _e(this.textVertexBuffer) && this.textVertexBuffer.dispose(), _e(this.textOpacityBuffer) && this.textOpacityBuffer.dispose(), _e(this.textIndexBuffer) && this.textIndexBuffer.dispose(), this.textVertexArrayObject = null, this.textVertexBuffer = null, this.textOpacityBuffer = null, this.textIndexBuffer = null, this.memoryUsed = 0; + } + updateOpacityInfo() { + if (!this.opacityChanged) + return; + this.opacityChanged = !1; + const e = this.iconOpacity, i = this.iconOpacityBuffer; + e.length > 0 && e.byteLength === i.size && i.setSubData(e, 0, 0, e.length); + const r = this.textOpacity, n = this.textOpacityBuffer; + r.length > 0 && r.byteLength === n.size && n.setSubData(r, 0, 0, r.length); + } + doPrepareForRendering(e, i, r) { + const n = new Uint32Array(i), s = new Int32Array(n.buffer), o = n[r++]; + this.iconVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, o)), r += o; + const a = n[r++]; + this.iconIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, a)), r += a; + const l = n[r++]; + this.textVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, l)), r += l; + const c = n[r++]; + this.textIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, c)), r += c, this.iconOpacityBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, this.iconOpacity.buffer), this.textOpacityBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, this.textOpacity.buffer); + const h = this.layer, p = h.iconMaterial, y = h.textMaterial; + this.iconVertexArrayObject = new Ac(e, p.getAttributeLocations(), p.getLayoutInfo(), { geometry: this.iconVertexBuffer, opacity: this.iconOpacityBuffer }, this.iconIndexBuffer), this.textVertexArrayObject = new Ac(e, y.getAttributeLocations(), y.getLayoutInfo(), { geometry: this.textVertexBuffer, opacity: this.textOpacityBuffer }, this.textIndexBuffer); + } +}, ymr = class extends Yve { + constructor(e, i) { + super(e, i), this.type = Pg.CIRCLE, this.circleIndexStart = 0, this.circleIndexCount = 0; + const r = new Uint32Array(e); + let n = this.bufferDataOffset; + this.circleIndexStart = r[n++], this.circleIndexCount = r[n++], this.bufferDataOffset = n; + } + hasData() { + return this.circleIndexCount > 0; + } + triangleCount() { + return this.circleIndexCount / 3; + } + doDestroy() { + _e(this.circleVertexArrayObject) && this.circleVertexArrayObject.dispose(), _e(this.circleVertexBuffer) && this.circleVertexBuffer.dispose(), _e(this.circleIndexBuffer) && this.circleIndexBuffer.dispose(), this.circleVertexArrayObject = null, this.circleVertexBuffer = null, this.circleIndexBuffer = null, this.memoryUsed = 0; + } + doPrepareForRendering(e, i, r) { + const n = new Uint32Array(i), s = new Int32Array(n.buffer), o = n[r++]; + this.circleVertexBuffer = Qo.createVertex(e, Vo.STATIC_DRAW, new Int32Array(s.buffer, 4 * r, o)), r += o; + const a = n[r++]; + this.circleIndexBuffer = Qo.createIndex(e, Vo.STATIC_DRAW, new Uint32Array(n.buffer, 4 * r, a)), r += a; + const l = this.layer.circleMaterial; + this.circleVertexArrayObject = new Ac(e, l.getAttributeLocations(), l.getLayoutInfo(), { geometry: this.circleVertexBuffer }, this.circleIndexBuffer); + } +}, vmr = class BFt extends cH { + constructor(e, i, r, n, s, o, a, l = null) { + super(e, i, r, n, s, o, 4096, 4096), this._memCache = l, this.type = "vector-tile", this._referenced = 0, this._hasSymbolBuckets = !1, this._memoryUsedByLayerData = 0, this.layerData = /* @__PURE__ */ new Map(), this.layerCount = 0, this.status = "loading", this.allSymbolsFadingOut = !1, this.lastOpacityUpdate = 0, this.symbols = /* @__PURE__ */ new Map(), this.isCoverage = !1, this.neededForCoverage = !1, this.decluttered = !1, this.invalidating = !1, this.parentTile = null, this.childrenTiles = /* @__PURE__ */ new Set(), this._processed = !1, this._referenced = 1, this.styleRepository = a, this.id = e.id; + } + get hasSymbolBuckets() { + return this._hasSymbolBuckets; + } + get isFading() { + return this._hasSymbolBuckets && performance.now() - this.lastOpacityUpdate < JU; + } + get isHoldingForFade() { + return this._hasSymbolBuckets && (!this.allSymbolsFadingOut || performance.now() - this.lastOpacityUpdate < JU); + } + get wasRequested() { + return this.status === "errored" || this.status === "loaded" || this.status === "reloading"; + } + setData(e) { + this.changeDataImpl(e), this.requestRender(), this.ready(), this.invalidating = !1, this._processed = !0; + } + deleteLayerData(e) { + let i = !1; + for (const r of e) + if (this.layerData.has(r)) { + const n = this.layerData.get(r); + this._memoryUsedByLayerData -= n.memoryUsed, n.type === Pg.SYMBOL && this.symbols.has(r) && (this.symbols.delete(r), i = !0), n.destroy(), this.layerData.delete(r), this.layerCount--; + } + _e(this._memCache) && this._memCache.updateSize(this.key.id, this, this._memoryUsedByLayerData), i && this.emit("symbols-changed"), this.requestRender(); + } + processed() { + return this._processed; + } + hasData() { + return this.layerCount > 0; + } + dispose() { + this.status !== "unloaded" && (_mr.delete(this), BFt._destroyRenderBuckets(this.layerData), this.layerData = null, this.layerCount = 0, this._memoryUsedByLayerData = 0, this.destroy(), this.status = "unloaded"); + } + release() { + return --this._referenced == 0 && (this.dispose(), this.stage = null, !0); + } + retain() { + ++this._referenced; + } + get referenced() { + return this._referenced; + } + get memoryUsage() { + return (this._memoryUsedByLayerData + 256) / (this._referenced || 1); + } + changeDataImpl(e) { + let i = !1; + if (e) { + const { bucketsWithData: r, emptyBuckets: n } = e, s = this._createRenderBuckets(r); + if (n && n.byteLength > 0) { + const o = new Uint32Array(n); + for (const a of o) + this._deleteLayerData(a); + } + for (const [o, a] of s) + this._deleteLayerData(o), a.type === Pg.SYMBOL && (this.symbols.set(o, a.symbols), i = !0), this._memoryUsedByLayerData += a.memoryUsed, this.layerData.set(o, a), this.layerCount++; + _e(this._memCache) && this._memCache.updateSize(this.key.id, this, this._memoryUsedByLayerData); + } + this._hasSymbolBuckets = !1; + for (const [r, n] of this.layerData) + n.type === Pg.SYMBOL && (this._hasSymbolBuckets = !0); + i && this.emit("symbols-changed"); + } + attachWithContext(e) { + this.stage = { context: e, trashDisplayObject(i) { + i.processDetach(); + }, untrashDisplayObject: () => !1 }; + } + setTransform(e) { + super.setTransform(e); + const i = this.resolution / (e.resolution * e.pixelRatio), r = this.width / this.rangeX * i, n = this.height / this.rangeY * i, s = [0, 0]; + e.toScreen(s, [this.x, this.y]); + const o = this.transforms.tileUnitsToPixels; + v3(o), Ng(o, o, s), BI(o, o, Math.PI * e.rotation / 180), KO(o, o, [r, n, 1]); + } + _createTransforms() { + return { dvs: Ml(), tileMat3: Ml(), tileUnitsToPixels: Ml() }; + } + static _destroyRenderBuckets(e) { + if (!e) + return; + const i = /* @__PURE__ */ new Set(); + e.forEach((r) => { + i.has(r) || (r.destroy(), i.add(r)); + }), e.clear(); + } + _createRenderBuckets(e) { + const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(); + for (const n of e) { + const s = this._deserializeBucket(n, r); + for (const o of s.layerUIDs) + i.set(o, s); + } + return i; + } + _deserializeBucket(e, i) { + let r = i.get(e); + if (r) + return r; + switch (new Uint32Array(e)[0]) { + case Pg.FILL: + r = new mmr(e, this.styleRepository); + break; + case Pg.LINE: + r = new fmr(e, this.styleRepository); + break; + case Pg.SYMBOL: + r = new gmr(e, this.styleRepository, this); + break; + case Pg.CIRCLE: + r = new ymr(e, this.styleRepository); + } + return i.set(e, r), r; + } + _deleteLayerData(e) { + if (!this.layerData.has(e)) + return; + const i = this.layerData.get(e); + this._memoryUsedByLayerData -= i.memoryUsed, i.destroy(), this.layerData.delete(e), this.layerCount--; + } +}; +const _mr = /* @__PURE__ */ new Map(); +function bmr(t, e, i, r, n, s) { + const { iconRotationAlignment: o, textRotationAlignment: a, iconTranslate: l, iconTranslateAnchor: c, textTranslate: h, textTranslateAnchor: p } = r; + let y = 0; + for (const v of t.colliders) { + const [x, I] = v.partIndex === 0 ? l : h, P = v.partIndex === 0 ? c : p, F = v.minLod <= s && s <= v.maxLod; + y += F ? 0 : 1, v.enabled = F, v.xScreen = v.xTile * n[0] + v.yTile * n[3] + n[6], v.yScreen = v.xTile * n[1] + v.yTile * n[4] + n[7], P === U_.MAP ? (v.xScreen += i * x - e * I, v.yScreen += e * x + i * I) : (v.xScreen += x, v.yScreen += I), nc.VIEWPORT === (v.partIndex === 0 ? o : a) ? (v.dxScreen = v.dxPixels, v.dyScreen = v.dyPixels) : (v.dxScreen = i * (v.dxPixels + v.width / 2) - e * (v.dyPixels + v.height / 2) - v.width / 2, v.dyScreen = e * (v.dxPixels + v.width / 2) + i * (v.dyPixels + v.height / 2) - v.height / 2); + } + t.colliders.length > 0 && y === t.colliders.length && (t.unique.show = !1); +} +let wmr = class { + constructor(e, i, r, n, s, o) { + this._symbols = e, this._styleRepository = n, this._zoom = s, this._currentLayerCursor = 0, this._currentSymbolCursor = 0, this._styleProps = /* @__PURE__ */ new Map(), this._allNeededMatrices = /* @__PURE__ */ new Map(), this._gridIndex = new $Ft(i, r, G7i), this._si = Math.sin(Math.PI * o / 180), this._co = Math.cos(Math.PI * o / 180); + for (const a of e) + for (const l of a.symbols) + this._allNeededMatrices.has(l.tile) || this._allNeededMatrices.set(l.tile, m1t(l.tile.transforms.tileUnitsToPixels)); + } + work(e) { + const i = this._gridIndex; + function r(s) { + const o = s.xScreen + s.dxScreen, a = s.yScreen + s.dyScreen, l = o + s.width, c = a + s.height, [h, p, y, v] = i.getCellSpan(o, a, l, c); + for (let x = p; x <= v; x++) + for (let I = h; I <= y; I++) { + const P = i.cells[x][I]; + for (const F of P) { + const k = F.xScreen + F.dxScreen, V = F.yScreen + F.dyScreen, j = k + F.width, Y = V + F.height; + if (!(l < k || o > j || c < V || a > Y)) + return !0; + } + } + return !1; + } + const n = performance.now(); + for (; this._currentLayerCursor < this._symbols.length; this._currentLayerCursor++, this._currentSymbolCursor = 0) { + const s = this._symbols[this._currentLayerCursor], o = this._getProperties(s.styleLayerUID); + for (; this._currentSymbolCursor < s.symbols.length; this._currentSymbolCursor++) { + if (this._currentSymbolCursor % 100 == 99 && performance.now() - n > e) + return !1; + const a = s.symbols[this._currentSymbolCursor]; + if (!a.unique.show) + continue; + bmr(a, this._si, this._co, o, this._allNeededMatrices.get(a.tile), this._zoom); + const l = a.unique; + if (!l.show) + continue; + const { iconAllowOverlap: c, iconIgnorePlacement: h, textAllowOverlap: p, textIgnorePlacement: y } = o; + for (const v of a.colliders) { + if (!v.enabled) + continue; + const x = l.parts[v.partIndex]; + x.show && !(v.partIndex ? p : c) && r(v) && (v.hard ? l.show = !1 : x.show = !1); + } + if (l.show) + for (const v of a.colliders) { + if (!v.enabled || (v.partIndex ? y : h) || !l.parts[v.partIndex].show) + continue; + const x = v.xScreen + v.dxScreen, I = v.yScreen + v.dyScreen, P = x + v.width, F = I + v.height, [k, V, j, Y] = this._gridIndex.getCellSpan(x, I, P, F); + for (let X = V; X <= Y; X++) + for (let Q = k; Q <= j; Q++) + this._gridIndex.cells[X][Q].push(v); + } + } + } + return !0; + } + _getProperties(e) { + const i = this._styleProps.get(e); + if (i) + return i; + const r = this._zoom, n = this._styleRepository.getStyleLayerByUID(e), s = n.getLayoutValue("symbol-placement", r) !== NO.POINT; + let o = n.getLayoutValue("icon-rotation-alignment", r); + o === nc.AUTO && (o = s ? nc.MAP : nc.VIEWPORT); + let a = n.getLayoutValue("text-rotation-alignment", r); + a === nc.AUTO && (a = s ? nc.MAP : nc.VIEWPORT); + const l = n.getPaintValue("icon-translate", r), c = n.getPaintValue("icon-translate-anchor", r), h = n.getPaintValue("text-translate", r), p = n.getPaintValue("text-translate-anchor", r), y = { iconAllowOverlap: n.getLayoutValue("icon-allow-overlap", r), iconIgnorePlacement: n.getLayoutValue("icon-ignore-placement", r), textAllowOverlap: n.getLayoutValue("text-allow-overlap", r), textIgnorePlacement: n.getLayoutValue("text-ignore-placement", r), iconRotationAlignment: o, textRotationAlignment: a, iconTranslateAnchor: c, iconTranslate: l, textTranslateAnchor: p, textTranslate: h }; + return this._styleProps.set(e, y), y; + } +}; +function xmr(t, e) { + if (t.priority - e.priority) + return t.priority - e.priority; + const i = t.tile.key, r = e.tile.key; + return i.world - r.world ? i.world - r.world : i.level - r.level ? i.level - r.level : i.row - r.row ? i.row - r.row : i.col - r.col ? i.col - r.col : t.xTile - e.xTile ? t.xTile - e.xTile : t.yTile - e.yTile; +} +let Smr = class { + get running() { + return this._running; + } + constructor(e, i, r, n, s, o) { + this._visibleTiles = e, this._symbolRepository = i, this._createCollisionJob = r, this._assignTileSymbolsOpacity = n, this._symbolLayerSorter = s, this._isLayerVisible = o, this._selectionJob = null, this._selectionJobCompleted = !1, this._collisionJob = null, this._collisionJobCompleted = !1, this._opacityJob = null, this._opacityJobCompleted = !1, this._running = !0; + } + setScreenSize(e, i) { + this._screenWidth === e && this._screenHeight === i || this.restart(), this._screenWidth = e, this._screenHeight = i; + } + restart() { + this._selectionJob = null, this._selectionJobCompleted = !1, this._collisionJob = null, this._collisionJobCompleted = !1, this._opacityJob = null, this._opacityJobCompleted = !1, this._running = !0; + } + continue(e) { + if (this._selectionJob || (this._selectionJob = this._createSelectionJob()), !this._selectionJobCompleted) { + const i = performance.now(); + if (!this._selectionJob.work(e) || (this._selectionJobCompleted = !0, (e = Math.max(0, e - (performance.now() - i))) === 0)) + return !1; + } + if (this._collisionJob || (this._collisionJob = this._createCollisionJob(this._selectionJob.sortedSymbols, this._screenWidth, this._screenHeight)), !this._collisionJobCompleted) { + const i = performance.now(); + if (!this._collisionJob.work(e) || (this._collisionJobCompleted = !0, (e = Math.max(0, e - (performance.now() - i))) === 0)) + return !1; + } + if (this._opacityJob || (this._opacityJob = this._createOpacityJob()), !this._opacityJobCompleted) { + const i = performance.now(); + if (!this._opacityJob.work(e) || (this._opacityJobCompleted = !0, (e = Math.max(0, e - (performance.now() - i))) === 0)) + return !1; + } + return this._running = !1, !0; + } + _createSelectionJob() { + const e = this._symbolRepository.uniqueSymbols; + for (let l = 0; l < e.length; l++) { + const c = e[l]; + for (let h = 0; h < c.uniqueSymbols.length; h++) { + const p = c.uniqueSymbols[h]; + for (const y of p.tileSymbols) + y.selectedForRendering = !1; + } + } + const i = []; + let r = 0, n = 0; + const s = this._isLayerVisible; + function o(l) { + let c; + const h = performance.now(); + for (; n < e.length; n++, r = 0) { + const p = e[n], y = p.styleLayerUID; + if (!s(y)) { + i[n] || (i[n] = { styleLayerUID: y, symbols: [] }); + continue; + } + i[n] = i[n] || { styleLayerUID: y, symbols: [] }; + const v = i[n]; + for (; r < p.uniqueSymbols.length; r++) { + if (c = p.uniqueSymbols[r], r % 100 == 99 && performance.now() - h > l) + return !1; + let x = null, I = !1, P = !1; + for (const F of c.tileSymbols) + if (!P || !I) { + const k = F.tile; + (!x || k.isCoverage || k.neededForCoverage && !I) && (x = F, (k.neededForCoverage || k.isCoverage) && (P = !0), k.isCoverage && (I = !0)); + } + if (x.selectedForRendering = !0, P) { + v.symbols.push(x), c.show = !0; + for (const F of c.parts) + F.show = !0; + } else + c.show = !1; + } + } + for (const p of i) + p.symbols.sort(xmr); + return !0; + } + const a = this._symbolLayerSorter; + return { work: o, get sortedSymbols() { + return i.sort(a); + } }; + } + _createOpacityJob() { + const e = this._assignTileSymbolsOpacity, i = this._visibleTiles; + let r = 0; + function n(s, o) { + const a = s.symbols; + for (const [l, c] of a) + Cmr(c, o); + e(s, o); + for (const l of s.childrenTiles) + n(l, o); + } + return { work(s) { + const o = performance.now(); + for (; r < i.length; r++) { + if (performance.now() - o > s) + return !1; + const a = i[r]; + _e(a.parentTile) || n(a, performance.now()); + } + return !0; + } }; + } +}; +function Cmr(t, e) { + for (const i of t) { + const r = i.unique; + for (const n of r.parts) { + const s = n.targetOpacity > 0.5 ? 1 : -1; + n.startOpacity += s * ((e - n.startTime) / JU), n.startOpacity = Math.min(Math.max(n.startOpacity, 0), 1), n.startTime = e, n.targetOpacity = r.show && n.show ? 1 : 0; + } + } +} +const Tmr = 32, Emr = 8, Imr = 64; +let Amr = class { + constructor(e, i, r) { + this.tileCoordRange = e, this._visibleTiles = i, this._createUnique = r, this._tiles = /* @__PURE__ */ new Map(), this._uniqueSymbolsReferences = /* @__PURE__ */ new Map(); + } + get uniqueSymbols() { + return ut(this._uniqueSymbolLayerArray) && (this._uniqueSymbolLayerArray = this._createUniqueSymbolLayerArray()), this._uniqueSymbolLayerArray; + } + add(e, i) { + this._uniqueSymbolLayerArray = null; + let r = this._tiles.get(e.id); + r || (r = { symbols: /* @__PURE__ */ new Map() }, this._tiles.set(e.id, r)); + const n = /* @__PURE__ */ new Map(); + if (i) + for (const a of i) + r.symbols.has(a) && (n.set(a, r.symbols.get(a)), r.symbols.delete(a)); + else + for (const [a, l] of e.layerData) + r.symbols.has(a) && (n.set(a, r.symbols.get(a)), r.symbols.delete(a)); + this._removeSymbols(n); + const s = e.symbols, o = /* @__PURE__ */ new Map(); + for (const [a, l] of s) { + let c = l.length; + if (c >= Tmr) { + let h = this.tileCoordRange; + do + h /= 2, c /= 4; + while (c > Emr && h > Imr); + const p = new $Ft(this.tileCoordRange, this.tileCoordRange, h); + o.set(a, { flat: l, index: p }), r.symbols.set(a, { flat: l, index: p }); + for (const y of l) + p.getCell(y.xTile, y.yTile).push(y); + } else + o.set(a, { flat: l }), r.symbols.set(a, { flat: l }); + } + this._addSymbols(e.key, s); + } + deleteStyleLayers(e) { + this._uniqueSymbolLayerArray = null; + for (const [i, r] of this._tiles) { + const n = /* @__PURE__ */ new Map(); + for (const s of e) + r.symbols.has(s) && (n.set(s, r.symbols.get(s)), r.symbols.delete(s)); + this._removeSymbols(n), r.symbols.size === 0 && this._tiles.delete(i); + } + } + removeTile(e) { + this._uniqueSymbolLayerArray = null; + const i = this._tiles.get(e.id); + if (!i) + return; + const r = /* @__PURE__ */ new Map(); + for (const [n, s] of e.symbols) + i.symbols.has(n) && (r.set(n, i.symbols.get(n)), i.symbols.delete(n)); + this._removeSymbols(r), i.symbols.size === 0 && this._tiles.delete(e.id); + } + _removeSymbols(e) { + for (const [i, { flat: r }] of e) + for (const n of r) { + const s = n.unique, o = s.tileSymbols, a = o.length - 1; + for (let l = 0; l < a; l++) + if (o[l] === n) { + o[l] = o[a]; + break; + } + if (o.length = a, a === 0) { + const l = this._uniqueSymbolsReferences.get(i); + l.delete(s), l.size === 0 && this._uniqueSymbolsReferences.delete(i); + } + n.unique = null; + } + } + _addSymbols(e, i) { + if (i.size === 0) + return; + const r = this._visibleTiles; + for (const n of r) + n.parentTile || n.key.world !== e.world || n.key.level === e.level && !n.key.equals(e) || this._matchSymbols(n, e, i); + for (const [n, s] of i) + for (const o of s) + if (ut(o.unique)) { + const a = this._createUnique(); + o.unique = a, a.tileSymbols.push(o); + let l = this._uniqueSymbolsReferences.get(n); + l || (l = /* @__PURE__ */ new Set(), this._uniqueSymbolsReferences.set(n, l)), l.add(a); + } + } + _matchSymbols(e, i, r) { + if (e.key.level > i.level) { + const s = e.key.level - i.level; + if (e.key.row >> s !== i.row || e.key.col >> s !== i.col) + return; + } + if (i.level > e.key.level) { + const s = i.level - e.key.level; + if (i.row >> s !== e.key.row || i.col >> s !== e.key.col) + return; + } + if (i.equals(e.key)) { + for (const s of e.childrenTiles) + this._matchSymbols(s, i, r); + return; + } + const n = /* @__PURE__ */ new Map(); + for (const [s, o] of r) { + const a = []; + for (const p of o) { + const y = cot(this.tileCoordRange, p.xTile, i.level, i.col, e.key.level, e.key.col), v = cot(this.tileCoordRange, p.yTile, i.level, i.row, e.key.level, e.key.row); + y >= 0 && y < this.tileCoordRange && v >= 0 && v < this.tileCoordRange && a.push({ symbol: p, xTransformed: y, yTransformed: v }); + } + const l = [], c = e.key.level < i.level ? 1 : 1 << e.key.level - i.level, h = this._tiles.get(e.id).symbols.get(s); + if (h) { + const p = h.flat; + for (const y of a) { + let v, x = !1; + const I = y.xTransformed, P = y.yTransformed; + v = _e(h.index) ? h.index.getCell(I, P) : p; + const F = y.symbol, k = F.hash; + for (const V of v) + if (k === V.hash && Math.abs(I - V.xTile) <= c && Math.abs(P - V.yTile) <= c) { + const j = V.unique; + F.unique = j, j.tileSymbols.push(F), x = !0; + break; + } + x || l.push(F); + } + } + l.length > 0 && n.set(s, l); + } + for (const s of e.childrenTiles) + this._matchSymbols(s, i, n); + } + _createUniqueSymbolLayerArray() { + const e = this._uniqueSymbolsReferences, i = new Array(e.size); + let r, n = 0; + for (const [s, o] of e) { + const a = new Array(o.size); + r = 0; + for (const l of o) + a[r++] = l; + i[n] = { styleLayerUID: s, uniqueSymbols: a }, n++; + } + return i; + } +}; +const Pmr = 0.5, hot = 1e-6; +let Omr = class extends Bd { + constructor(e, i) { + super(), this.styleRepository = e, this._tileToHandle = /* @__PURE__ */ new Map(), this._viewState = { scale: 0, rotation: 0, center: [0, 0], size: [0, 0] }, this._declutterViewState = { scale: 0, rotation: 0, center: [0, 0], size: [0, 0] }, this._completed = !1, this._symbolRepository = new Amr(4096, i, () => new cmr()), this._symbolDeclutterer = new Smr(i, this._symbolRepository, (r, n, s) => new wmr(r, n, s, this.styleRepository, this._zoom, this._viewState.rotation), (r, n) => { + r.allSymbolsFadingOut = !0, r.lastOpacityUpdate = n, dmr(r, n, !0), r.decluttered = !0, r.requestRender(); + }, (r, n) => this.styleRepository.getStyleLayerByUID(r.styleLayerUID).z - this.styleRepository.getStyleLayerByUID(n.styleLayerUID).z, (r) => { + const n = this.styleRepository.getStyleLayerByUID(r); + if (this._zoom + hot < n.minzoom || this._zoom - hot >= n.maxzoom) + return !1; + const s = n.getLayoutProperty("visibility"); + return !s || s.getValue() !== _E.NONE; + }); + } + addTile(e) { + e.decluttered = !1, this._tileToHandle.set(e, e.on("symbols-changed", () => { + this._symbolRepository.add(e), this.restartDeclutter(); + })), this._symbolRepository.add(e), this.restartDeclutter(); + } + removeTile(e) { + const i = this._tileToHandle.get(e); + i && (this._symbolRepository.removeTile(e), this.restartDeclutter(), i.remove(), this._tileToHandle.delete(e)); + } + update(e, i) { + return this._zoom = e, this._viewState = { scale: i.scale, rotation: i.rotation, center: [i.center[0], i.center[1]], size: [i.size[0], i.size[1]] }, this._continueDeclutter(), this._completed; + } + restartDeclutter() { + this._completed = !1, this._symbolDeclutterer.restart(), this._notifyUnstable(); + } + clear() { + this._completed = !1, this._symbolRepository = null, this._symbolDeclutterer.restart(), this._tileToHandle.forEach((e) => e.remove()), this._tileToHandle.clear(); + } + get stale() { + return this._zoom !== this._declutterZoom || this._viewState.size[0] !== this._declutterViewState.size[0] || this._viewState.size[1] !== this._declutterViewState.size[1] || this._viewState.scale !== this._declutterViewState.scale || this._viewState.rotation !== this._declutterViewState.rotation; + } + deleteStyleLayers(e) { + this._symbolRepository.deleteStyleLayers(e); + } + _continueDeclutter() { + this._completed && !this.stale || (this._symbolDeclutterer.running || (this._declutterZoom = this._zoom, this._declutterViewState.center[0] = this._viewState.center[0], this._declutterViewState.center[1] = this._viewState.center[1], this._declutterViewState.rotation = this._viewState.rotation, this._declutterViewState.scale = this._viewState.scale, this._declutterViewState.size[0] = this._viewState.size[0], this._declutterViewState.size[1] = this._viewState.size[1], this._symbolDeclutterer.restart()), this._symbolDeclutterer.setScreenSize(this._viewState.size[0], this._viewState.size[1]), this._completed = this._symbolDeclutterer.continue(U7i), this._completed && this._scheduleNotifyStable()); + } + _scheduleNotifyStable() { + _e(this._stableNotificationHandle) && clearTimeout(this._stableNotificationHandle), this._stableNotificationHandle = setTimeout(() => { + this._stableNotificationHandle = null, this.emit("fade-complete"); + }, (1 + Pmr) * JU); + } + _notifyUnstable() { + _e(this._stableNotificationHandle) && (clearTimeout(this._stableNotificationHandle), this._stableNotificationHandle = null), this.emit("fade-start"); + } +}, Rmr = class extends cH { + _createTransforms() { + return { dvs: Ml(), tileMat3: Ml() }; + } +}; +const gme = 1e-6; +function dot(t, e) { + if (t) { + const i = t.getLayoutProperty("visibility"); + if (!i || i.getValue() !== _E.NONE && (t.minzoom === void 0 || t.minzoom < e + gme) && (t.maxzoom === void 0 || t.maxzoom >= e - gme)) + return !0; + } + return !1; +} +let Mmr = class extends lre { + constructor(e) { + super(e), this._backgroundTiles = [], this._pointToCallbacks = /* @__PURE__ */ new Map(); + } + destroy() { + this.removeAllChildren(), this._spriteMosaic?.dispose(), this._spriteMosaic = null, this._glyphMosaic?.dispose(), this._glyphMosaic = null, _e(this._symbolFader) && (this._symbolFader.clear(), this._symbolFader = null), this._styleRepository = null, this._backgroundTiles = [], this._pointToCallbacks.clear(); + } + setStyleResources(e, i, r) { + if (this._spriteMosaic = e, this._glyphMosaic = i, this._styleRepository = r, ut(this._symbolFader)) { + const n = new Omr(this._styleRepository, this.children); + n.on("fade-start", () => { + this.emit("fade-start"), this.requestRender(); + }), n.on("fade-complete", () => { + this.emit("fade-complete"), this.requestRender(); + }), this._symbolFader = n; + } + this._symbolFader.styleRepository = r; + } + setSpriteMosaic(e) { + this._spriteMosaic?.dispose(), this._spriteMosaic = e; + } + deleteStyleLayers(e) { + _e(this._symbolFader) && this._symbolFader.deleteStyleLayers(e); + } + async hitTest(e) { + const i = mm(); + return this._pointToCallbacks.set(e, i), this.requestRender(), i.promise; + } + enterTileInvalidation() { + for (const e of this.children) + e.invalidating = !0; + } + createRenderParams(e) { + return { ...super.createRenderParams(e), renderPass: null, styleLayer: null, styleLayerUID: -1, glyphMosaic: this._glyphMosaic, spriteMosaic: this._spriteMosaic, hasClipping: !!this._clippingInfos }; + } + doRender(e) { + !this.visible || e.drawPhase !== lo.MAP && e.drawPhase !== lo.DEBUG || this._spriteMosaic === void 0 || super.doRender(e); + } + addChild(e) { + return super.addChild(e), _e(this._symbolFader) ? this._symbolFader.addTile(e) : e.decluttered = !0, this.requestRender(), e; + } + removeChild(e) { + return _e(this._symbolFader) && this._symbolFader.removeTile(e), this.requestRender(), super.removeChild(e); + } + renderChildren(e) { + const { drawPhase: i } = e; + if (i !== lo.DEBUG) { + if (this._doRender(e), this._pointToCallbacks.size > 0) { + e.drawPhase = lo.HITTEST; + const r = e.painter.effects.hittestVTL; + r.bind(e), this._doRender(e), r.draw(e, this._pointToCallbacks), r.unbind(e), e.drawPhase = i; + } + } else + super.renderChildren(e); + } + removeAllChildren() { + for (let e = 0; e < this.children.length; e++) { + const i = this.children[e]; + _e(this._symbolFader) && this._symbolFader.removeTile(i), i.dispose(); + } + super.removeAllChildren(); + } + getStencilTarget() { + return this.children.filter((e) => e.neededForCoverage && e.hasData()); + } + restartDeclutter() { + _e(this._symbolFader) && this._symbolFader.restartDeclutter(); + } + _doRender(e) { + const { context: i } = e, r = this._styleRepository; + if (!r) + return; + const n = r.layers; + let s = !0; + e.drawPhase === lo.HITTEST && (s = !1), r.backgroundBucketIds.length > 0 && (e.renderPass = "background", this._renderBackgroundLayers(e, r.backgroundBucketIds)), super.renderChildren(e), e.drawPhase === lo.MAP && this._fade(e.displayLevel, e.state); + const o = this.children.filter((a) => a.visible && a.hasData()); + if (!o || o.length === 0) + return i.bindVAO(), i.setStencilTestEnabled(!0), void i.setBlendingEnabled(!0); + for (const a of o) + a.triangleCount = 0; + i.setStencilWriteMask(0), i.setColorMask(!0, !0, !0, !0), i.setStencilOp(su.KEEP, su.KEEP, su.REPLACE), i.setStencilTestEnabled(!0), i.setBlendingEnabled(!1), i.setDepthTestEnabled(!0), i.setDepthWriteEnabled(!0), i.setDepthFunction(Ll.LEQUAL), i.setClearDepth(1), i.clear(i.gl.DEPTH_BUFFER_BIT), e.renderPass = "opaque"; + for (let a = n.length - 1; a >= 0; a--) + this._renderStyleLayer(n[a], e, o); + i.setDepthWriteEnabled(!1), i.setBlendingEnabled(s), i.setBlendFunctionSeparate(gn.ONE, gn.ONE_MINUS_SRC_ALPHA, gn.ONE, gn.ONE_MINUS_SRC_ALPHA), e.renderPass = "translucent"; + for (let a = 0; a < n.length; a++) + this._renderStyleLayer(n[a], e, o); + i.bindVAO(), i.setStencilTestEnabled(!0), i.setBlendingEnabled(!0); + } + _fade(e, i) { + _e(this._symbolFader) && (this._symbolFader.update(e, i) || this.requestRender()); + } + _renderStyleLayer(e, i, r) { + const { painter: n, renderPass: s } = i; + if (e === void 0) + return; + const o = e.getLayoutProperty("visibility"); + if (o && o.getValue() === _E.NONE) + return; + let a; + switch (e.type) { + case dl.BACKGROUND: + return; + case dl.FILL: + if (s !== "opaque" && i.renderPass !== "translucent") + return; + a = "vtlFill"; + break; + case dl.LINE: + if (s !== "translucent") + return; + a = "vtlLine"; + break; + case dl.CIRCLE: + if (s !== "translucent") + return; + a = "vtlCircle"; + break; + case dl.SYMBOL: + if (s !== "translucent") + return; + a = "vtlSymbol"; + } + if (r = e.type === dl.SYMBOL ? r.filter((c) => c.decluttered) : r.filter((c) => c.neededForCoverage), a !== "vtlSymbol") { + const c = i.displayLevel; + if (r.length === 0 || e.minzoom !== void 0 && e.minzoom >= c + gme || e.maxzoom !== void 0 && e.maxzoom < c - gme) + return; + } + const l = e.uid; + i.styleLayerUID = l, i.styleLayer = e; + for (const c of r) + if (c.layerData.has(l)) { + n.renderObjects(i, r, a); + break; + } + } + _renderBackgroundLayers(e, i) { + const { context: r, displayLevel: n, painter: s, state: o } = e, a = this._styleRepository; + let l = !1; + for (const V of i) + if (a.getLayerById(V).type === dl.BACKGROUND && dot(a.getLayerById(V), n)) { + l = !0; + break; + } + if (!l) + return; + const c = this._tileInfoView.getTileCoverage(e.state, 0, "smallest"), { spans: h, lodInfo: p } = c, { level: y } = p, v = Eo(), x = []; + if (this._renderPasses) { + const V = this._renderPasses[0]; + _e(this._clippingInfos) && (V.brushes[0].prepareState(e), V.brushes[0].drawMany(e, this._clippingInfos)); + } + const I = this._backgroundTiles; + let P, F = 0; + for (const { row: V, colFrom: j, colTo: Y } of h) + for (let X = j; X <= Y; X++) { + if (F < I.length) + P = I[F], P.key.set(y, V, p.normalizeCol(X), p.getWorldForColumn(X)), this._tileInfoView.getTileBounds(v, P.key, !1), P.x = v[0], P.y = v[3], P.resolution = this._tileInfoView.getTileResolution(y); + else { + const Q = new Lh(y, V, p.normalizeCol(X), p.getWorldForColumn(X)), re = this._tileInfoView.getTileBounds(Eo(), Q), he = this._tileInfoView.getTileResolution(y); + P = new Rmr(Q, he, re[0], re[3], 512, 512, 4096, 4096), I.push(P); + } + P.setTransform(o), x.push(P), F++; + } + r.setStencilWriteMask(0), r.setColorMask(!0, !0, !0, !0), r.setStencilOp(su.KEEP, su.KEEP, su.REPLACE), r.setStencilFunction(Ll.EQUAL, 0, 255); + let k = !0; + e.drawPhase === lo.HITTEST && (k = !1), r.setStencilTestEnabled(k); + for (const V of i) { + const j = a.getLayerById(V); + j.type === dl.BACKGROUND && dot(j, n) && (e.styleLayerUID = j.uid, e.styleLayer = j, s.renderObjects(e, x, "vtlBackground")); + } + ZO.pool.release(c); + } +}; +const Dmr = { geometry: [new ea("a_PositionAndFlags", 3, Fi.SHORT, 0, 6)] }, rBe = /* @__PURE__ */ new Map(); +rBe.set("a_PositionAndFlags", 0); +const Fmr = { vsPath: "debug/overlay", fsPath: "debug/overlay", attributes: rBe }; +let H2e = class extends pC { + constructor(e) { + super(), this._conf = e; + } + static makeFlags(e, i) { + return e | i << 2; + } + _createTransforms() { + return { dvs: Ml() }; + } + doRender(e) { + this._updateTransforms(e), this._ensureResources(e); + const { context: i } = e; + i.useProgram(this._program), this._program.setUniformMatrix3fv("u_dvsMat3", this.transforms.dvs), this._program.setUniform4fv("u_colors", this._conf.getColors(e)), this._program.setUniform1fv("u_opacities", this._conf.getOpacities(e)); + const { vertexData: r, indexData: n } = this._conf.getMesh(e); + this._vertexBuffer.setData(r), this._indexBuffer.setData(n), i.bindVAO(this._vertexArray), i.setBlendingEnabled(!0), i.setBlendFunction(gn.ONE, gn.ONE_MINUS_SRC_ALPHA), i.setDepthTestEnabled(!1), i.setStencilTestEnabled(!1), i.setColorMask(!0, !0, !0, !0), i.drawElements(ps.TRIANGLES, n.length, Fi.UNSIGNED_INT, 0); + } + onDetach() { + this._vertexArray = Ua(this._vertexArray); + } + _updateTransforms(e) { + v3(this.transforms.dvs), Ng(this.transforms.dvs, this.transforms.dvs, [-1, 1]), KO(this.transforms.dvs, this.transforms.dvs, [2 / e.state.size[0], -2 / e.state.size[1], 1]); + } + _ensureResources(e) { + const { context: i } = e; + this._program || (this._program = e.painter.materialManager.getProgram(Fmr)), this._vertexBuffer || (this._vertexBuffer = Qo.createVertex(i, Vo.STREAM_DRAW)), this._indexBuffer || (this._indexBuffer = Qo.createIndex(i, Vo.STREAM_DRAW)), this._vertexArray || (this._vertexArray = new Ac(i, rBe, Dmr, { geometry: this._vertexBuffer }, this._indexBuffer)); + } +}, Lmr = class extends f8 { + constructor() { + super(...arguments), this._fullCacheLodInfos = null, this._levelByScale = {}; + } + getTileParentId(e) { + const i = Lh.pool.acquire(e), r = i.level === 0 ? null : Lh.getId(i.level - 1, i.row >> 1, i.col >> 1, i.world); + return Lh.pool.release(i), r; + } + getTileCoverage(e, i, r) { + const n = super.getTileCoverage(e, i, r); + if (!n) + return n; + const s = 1 << n.lodInfo.level; + return n.spans = n.spans.filter((o) => o.row >= 0 && o.row < s), n; + } + scaleToLevel(e) { + if (this._fullCacheLodInfos || this._initializeFullCacheLODs(this._lodInfos), this._levelByScale[e]) + return this._levelByScale[e]; + { + const i = this._fullCacheLodInfos; + if (e > i[0].scale) + return i[0].level; + let r, n; + for (let s = 0; s < i.length - 1; s++) + if (n = i[s + 1], e > n.scale) + return r = i[s], r.level + (r.scale - e) / (r.scale - n.scale); + return i[i.length - 1].level; + } + } + _initializeFullCacheLODs(e) { + let i; + if (e[0].level === 0) + i = e.map((r) => ({ level: r.level, resolution: r.resolution, scale: r.scale })); + else { + const r = this.tileInfo.size[0], n = this.tileInfo.spatialReference; + i = Wl.create({ size: r, spatialReference: n }).lods.map((s) => ({ level: s.level, resolution: s.resolution, scale: s.scale })); + } + for (let r = 0; r < i.length; r++) + this._levelByScale[i[r].scale] = i[r].level; + this._fullCacheLodInfos = i; + } +}, tk = class extends ky($y) { + constructor() { + super(...arguments), this._styleChanges = [], this._fetchQueue = null, this._parseQueue = null, this._tileHandlerPromise = null, this._isTileHandlerReady = !1, this._collisionOverlay = null, this.fading = !1, this._getCollidersMesh = (e) => { + const { pixelRatio: i } = e.state; + let r = 0; + const n = [], s = []; + for (const o of this._vectorTileContainer.children) + if (o.symbols) + for (const [a, l] of o.symbols) + for (const c of l) + for (const h of c.colliders) { + const p = (h.xScreen + h.dxScreen) * i, y = (h.yScreen + h.dyScreen) * i, v = h.width * i, x = h.height * i, I = c.unique.parts[h.partIndex].targetOpacity > 0.5; + if (!I && this.layer.showCollisionBoxes !== "all") + continue; + const P = 3, F = 1, k = 3, V = 0, j = I ? 2 : 0, Y = I ? 3 : 0, X = H2e.makeFlags(j, Y); + n.push(p, y, X, p + v, y, X, p, y + x, X, p + v, y + x, X), s.push(r + 0, r + 1, r + 2, r + 1, r + 3, r + 2), r += 4; + const Q = I ? P : F, re = I ? k : V, he = H2e.makeFlags(Q, re); + n.push(p, y, he, p + v, y, he, p, y + 1, he, p + v, y + 1, he), s.push(r + 0, r + 1, r + 2, r + 1, r + 3, r + 2), r += 4, n.push(p, y + x - 1, he, p + v, y + x - 1, he, p, y + x, he, p + v, y + x, he), s.push(r + 0, r + 1, r + 2, r + 1, r + 3, r + 2), r += 4, n.push(p, y, he, p + 1, y, he, p, y + x, he, p + 1, y + x, he), s.push(r + 0, r + 1, r + 2, r + 1, r + 3, r + 2), r += 4, n.push(p + v - 1, y, he, p + v, y, he, p + v - 1, y + x, he, p + v, y + x, he), s.push(r + 0, r + 1, r + 2, r + 1, r + 3, r + 2), r += 4; + } + return { vertexData: new Int16Array(n), indexData: new Uint32Array(s) }; + }, this._getCollidersColors = () => [1, 0.5, 0, 1, 1, 0, 0, 1, 0, 1, 0.5, 1, 0, 0.5, 0, 1], this._getCollidersOpacities = () => [0.05, 0.01, 0.15, 0.2]; + } + async hitTest(e, i) { + if (!this._tileHandlerPromise) + return null; + await this._tileHandlerPromise; + const r = await this._vectorTileContainer.hitTest(i); + if (!r || r.length === 0) + return null; + const n = r[0] - 1, s = this._styleRepository, o = s.getStyleLayerByUID(n); + if (!o) + return null; + const a = s.getStyleLayerIndex(o.id); + return [{ type: "graphic", mapPoint: e, layer: this.layer, graphic: new ro({ attributes: { layerId: a, layerName: o.id, layerUID: n }, layer: this.layer, sourceLayer: this.layer }) }]; + } + update(e) { + if (this._tileHandlerPromise && this._isTileHandlerReady) + return e.pixelRatio !== this._tileHandler.devicePixelRatio ? (this._start(), void (this._tileHandler.devicePixelRatio = e.pixelRatio)) : void (this._styleChanges.length > 0 ? this._tileHandlerPromise = this._applyStyleChanges() : (this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.state = e.state, this._parseQueue.state = e.state, this._tileManager.update(e) || this.requestUpdate(), this._parseQueue.resume(), this._fetchQueue.resume())); + } + attach() { + const { style: e } = this.layer.currentStyleInfo; + this._styleRepository = new Ofe(e), this._tileInfoView = new Lmr(this.layer.tileInfo, this.layer.fullExtent), this._vectorTileContainer = new Mmr(this._tileInfoView), this._tileHandler = new rmr(this.layer, this._styleRepository, window.devicePixelRatio || 1), this.container.addChild(this._vectorTileContainer), this._start(), this.addAttachHandles([this._vectorTileContainer.on("fade-start", () => { + this.fading = !0, this.notifyChange("updating"), this.requestUpdate(); + }), this._vectorTileContainer.on("fade-complete", () => { + this._collisionOverlay?.requestRender(), this.fading = !1, this.notifyChange("updating"), this.requestUpdate(); + }), Qi(() => this.layer.showCollisionBoxes, (i) => { + i !== "none" ? this._collisionOverlay || (this._collisionOverlay = new H2e({ getMesh: this._getCollidersMesh, getColors: this._getCollidersColors, getOpacities: this._getCollidersOpacities }), this.container.addChild(this._collisionOverlay)) : this._collisionOverlay && (this.container.removeChild(this._collisionOverlay), this._collisionOverlay = null), this.container.requestRender(); + }, jo), this.layer.on("paint-change", (i) => { + if (i.isDataDriven) + this._styleChanges.push({ type: Tf.PAINTER_CHANGED, data: i }), this.notifyChange("updating"), this.requestUpdate(); + else { + const r = this._styleRepository, n = r.getLayerById(i.layer); + if (!n) + return; + const s = n.type === dl.SYMBOL; + r.setPaintProperties(i.layer, i.paint), s && this._vectorTileContainer.restartDeclutter(), this._vectorTileContainer.requestRender(); + } + }), this.layer.on("layout-change", (i) => { + const r = this._styleRepository, n = r.getLayerById(i.layer); + if (!n) + return; + const s = zS(n.layout, i.layout); + if (!ut(s)) { + if (zO(s, "visibility") && Nmr(s) === 1) + return r.setLayoutProperties(i.layer, i.layout), n.type === dl.SYMBOL && this._vectorTileContainer.restartDeclutter(), void this._vectorTileContainer.requestRender(); + this._styleChanges.push({ type: Tf.LAYOUT_CHANGED, data: i }), this.notifyChange("updating"), this.requestUpdate(); + } + }), this.layer.on("style-layer-visibility-change", (i) => { + const r = this._styleRepository, n = r.getLayerById(i.layer); + n && (r.setStyleLayerVisibility(i.layer, i.visibility), n.type === dl.SYMBOL && this._vectorTileContainer.restartDeclutter(), this._vectorTileContainer.requestRender()); + }), this.layer.on("style-layer-change", (i) => { + this._styleChanges.push({ type: Tf.LAYER_CHANGED, data: i }), this.notifyChange("updating"), this.requestUpdate(); + }), this.layer.on("delete-style-layer", (i) => { + this._styleChanges.push({ type: Tf.LAYER_REMOVED, data: i }), this.notifyChange("updating"), this.requestUpdate(); + }), this.layer.on("load-style", () => this._loadStyle()), this.layer.on("spriteSource-change", (i) => { + this._newSpriteSource = i.spriteSource, this._styleChanges.push({ type: Tf.SPRITES_CHANGED, data: null }); + const r = this._styleRepository.layers; + for (const n of r) + switch (n.type) { + case dl.SYMBOL: + n.getLayoutProperty("icon-image") && this._styleChanges.push({ type: Tf.LAYOUT_CHANGED, data: { layer: n.id, layout: n.layout } }); + break; + case dl.LINE: + n.getPaintProperty("line-pattern") && this._styleChanges.push({ type: Tf.PAINTER_CHANGED, data: { layer: n.id, paint: n.paint, isDataDriven: n.isPainterDataDriven() } }); + break; + case dl.FILL: + n.getLayoutProperty("fill-pattern") && this._styleChanges.push({ type: Tf.PAINTER_CHANGED, data: { layer: n.id, paint: n.paint, isDataDriven: n.isPainterDataDriven() } }); + } + this.notifyChange("updating"), this.requestUpdate(); + })]); + } + detach() { + this._stop(), this.container.removeAllChildren(), this._vectorTileContainer = la(this._vectorTileContainer), this._tileHandler = la(this._tileHandler); + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this._collisionOverlay && this._vectorTileContainer.restartDeclutter(), this.requestUpdate(); + } + supportsSpatialReference(e) { + return Ea(this.layer.tileInfo?.spatialReference, e); + } + canResume() { + let e = super.canResume(); + const { currentStyleInfo: i } = this.layer; + if (e && i?.layerDefinition) { + const r = this.view.scale, { minScale: n, maxScale: s } = i.layerDefinition; + i && i.layerDefinition && (n && n < r && (e = !1), s && s > r && (e = !1)); + } + return e; + } + isUpdating() { + const e = this._vectorTileContainer.children; + return !this._isTileHandlerReady || !this._fetchQueue || !this._parseQueue || this._fetchQueue.updating || this._parseQueue.updating || e.length > 0 && e.some((i) => i.invalidating) || this.fading; + } + acquireTile(e) { + const i = this._createVectorTile(e); + return this._tileHandlerPromise?.then(() => { + this._fetchQueue.push(i.key).then((r) => this._parseQueue.push({ key: i.key, data: r })).then((r) => { + i.once("attach", () => this.requestUpdate()), i.setData(r), this.requestUpdate(), this.notifyChange("updating"); + }).catch((r) => { + this.notifyChange("updating"), us(r) || Ei.getLogger(this.declaredClass).error(r); + }); + }), i; + } + releaseTile(e) { + const i = e.key.id; + this._fetchQueue.abort(i), this._parseQueue.abort(i), this.requestUpdate(); + } + _start() { + if (this._stop(), this._tileManager = new omr({ acquireTile: (r) => this.acquireTile(r), releaseTile: (r) => this.releaseTile(r), tileInfoView: this._tileInfoView }, this._vectorTileContainer), !this.layer.currentStyleInfo) + return; + const e = new AbortController(), i = this._tileHandler.start({ signal: e.signal }).then(() => { + this._fetchQueue = new fU({ tileInfoView: this._tileInfoView, process: (r, n) => this._getTileData(r, n), concurrency: 15 }), this._parseQueue = new fU({ tileInfoView: this._tileInfoView, process: (r, n) => this._parseTileData(r, n), concurrency: 8 }), this.requestUpdate(), this._isTileHandlerReady = !0; + }); + this._tileHandler.spriteMosaic.then((r) => { + this._vectorTileContainer.setStyleResources(r, this._tileHandler.glyphMosaic, this._styleRepository), this.requestUpdate(); + }), this._tileHandlerAbortController = e, this._tileHandlerPromise = i; + } + _stop() { + if (!this._tileHandlerAbortController || !this._vectorTileContainer) + return; + const e = this._tileHandlerAbortController; + e && e.abort(), this._tileHandlerPromise = null, this._isTileHandlerReady = !1, this._fetchQueue = la(this._fetchQueue), this._parseQueue = la(this._parseQueue), this._tileManager = la(this._tileManager), this._vectorTileContainer.removeAllChildren(); + } + async _getTileData(e, i) { + const r = await this._tileHandler.fetchTileData(e, i); + return this.notifyChange("updating"), r; + } + async _parseTileData(e, i) { + return this._tileHandler.parseTileData(e, i); + } + async _applyStyleChanges() { + this._isTileHandlerReady = !1, this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.clear(), this._parseQueue.clear(), this._tileManager.clearCache(); + const e = this._styleChanges; + try { + await this._tileHandler.updateStyle(e); + } catch (a) { + Ei.getLogger(this.declaredClass).error("error applying vector-tiles style update", a.message), this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = !0; + } + const i = this._styleRepository, r = []; + e.forEach((a) => { + if (a.type !== Tf.LAYER_REMOVED) + return; + const l = a.data, c = i.getLayerById(l.layer); + c && r.push(c.uid); + }); + const n = []; + let s; + e.forEach((a) => { + const l = a.type, c = a.data; + switch (l) { + case Tf.PAINTER_CHANGED: + i.setPaintProperties(c.layer, c.paint), s = c.layer; + break; + case Tf.LAYOUT_CHANGED: + i.setLayoutProperties(c.layer, c.layout), s = c.layer; + break; + case Tf.LAYER_REMOVED: + return void i.deleteStyleLayer(c.layer); + case Tf.LAYER_CHANGED: + i.setStyleLayer(c.layer, c.index), s = c.layer.id; + break; + case Tf.SPRITES_CHANGED: + this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(this._newSpriteSource)), this._newSpriteSource = null, s = null; + } + const h = i.getLayerById(s); + h && n.push(h.uid); + }); + const o = this._vectorTileContainer.children; + if (r.length > 0) { + this._vectorTileContainer.deleteStyleLayers(r); + for (const a of o) + a.deleteLayerData(r); + } + if (this._fetchQueue.resume(), this._parseQueue.resume(), n.length > 0) { + const a = []; + for (const l of o) { + const c = this._fetchQueue.push(l.key).then((h) => this._parseQueue.push({ key: l.key, data: h, styleLayerUIDs: n })).then((h) => l.setData(h)); + a.push(c); + } + await Promise.all(a); + } + this._styleChanges = [], this._isTileHandlerReady = !0, this.notifyChange("updating"), this.requestUpdate(); + } + async _loadStyle() { + const { style: e } = this.layer.currentStyleInfo, i = fi(e); + this._isTileHandlerReady = !1, this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.clear(), this._parseQueue.clear(), this.notifyChange("updating"), this._styleRepository = new Ofe(i), this._vectorTileContainer.destroy(), this._tileManager.clear(), this._tileHandlerAbortController.abort(), this._tileHandlerAbortController = new AbortController(); + const { signal: r } = this._tileHandlerAbortController; + try { + this._tileHandlerPromise = this._tileHandler.setStyle(this._styleRepository, i), await this._tileHandlerPromise; + } catch (s) { + if (!us(s)) + throw s; + } + if (r.aborted) + return this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = !0, this.notifyChange("updating"), void this.requestUpdate(); + const n = await this._tileHandler.spriteMosaic; + this._vectorTileContainer.setStyleResources(n, this._tileHandler.glyphMosaic, this._styleRepository), this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = !0, this.notifyChange("updating"), this.requestUpdate(); + } + _createVectorTile(e) { + const i = this._tileInfoView.getTileBounds(Eo(), e), r = this._tileInfoView.getTileResolution(e.level); + return new vmr(e, r, i[0], i[3], 512, 512, this._styleRepository); + } +}; +function Nmr(t) { + if (ut(t)) + return 0; + switch (t.type) { + case "partial": + return Object.keys(t.diff).length; + case "complete": + return Math.max(Object.keys(t.oldValue).length, Object.keys(t.newValue).length); + case "collection": + return Object.keys(t.added).length + Object.keys(t.changed).length + Object.keys(t.removed).length; + } +} +E([N()], tk.prototype, "_fetchQueue", void 0), E([N()], tk.prototype, "_parseQueue", void 0), E([N()], tk.prototype, "_isTileHandlerReady", void 0), E([N()], tk.prototype, "fading", void 0), tk = E([dt("esri.views.2d.layers.VectorTileLayerView2D")], tk); +const kmr = tk, $mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: kmr +}, Symbol.toStringTag, { value: "Module" })), Bmr = (t) => { + let e = class extends t { + initialize() { + this.exportImageParameters = new sE({ layer: this.layer }); + } + destroy() { + this.exportImageParameters = la(this.exportImageParameters); + } + get exportImageVersion() { + return this.exportImageParameters?.commitProperty("version"), this.commitProperty("timeExtent"), (this._get("exportImageVersion") || 0) + 1; + } + fetchPopupFeatures(i) { + const { layer: r } = this; + if (!i) + return Promise.reject(new ot("wmslayerview:fetchPopupFeatures", "Nothing to fetch without area", { layer: r })); + const { popupEnabled: n } = r; + if (!n) + return Promise.reject(new ot("wmslayerview:fetchPopupFeatures", "popupEnabled should be true", { popupEnabled: n })); + const s = this.createFetchPopupFeaturesQuery(i); + if (!s) + return Promise.resolve([]); + const { extent: o, width: a, height: l, x: c, y: h } = s; + if (!(o && a && l)) + throw new ot("wmslayerview:fetchPopupFeatures", "WMSLayer does not support fetching features.", { extent: o, width: a, height: l }); + return r.fetchFeatureInfo(o, a, l, c, h); + } + }; + return E([N()], e.prototype, "exportImageParameters", void 0), E([N({ readOnly: !0 })], e.prototype, "exportImageVersion", null), E([N()], e.prototype, "layer", void 0), E([N(Pz)], e.prototype, "timeExtent", void 0), e = E([dt("esri.layers.mixins.WMSLayerView")], e), e; +}; +let pK = class extends Bmr(eL(ky($y))) { + constructor() { + super(...arguments), this.bitmapContainer = new sz(); + } + supportsSpatialReference(e) { + return this.layer.serviceSupportsSpatialReference(e); + } + update(e) { + this.strategy.update(e).catch((i) => { + us(i) || Ei.getLogger(this.declaredClass).error(i); + }); + } + attach() { + const { layer: e } = this, { imageMaxHeight: i, imageMaxWidth: r } = e; + this.bitmapContainer = new sz(), this.container.addChild(this.bitmapContainer), this.strategy = new Hve({ container: this.bitmapContainer, fetchSource: this.fetchImage.bind(this), requestUpdate: this.requestUpdate.bind(this), imageMaxHeight: i, imageMaxWidth: r, imageRotationSupported: !1, imageNormalizationSupported: !1, hidpi: !1 }), this.addAttachHandles(Qi(() => this.exportImageVersion, () => this.requestUpdate())); + } + detach() { + this.strategy = la(this.strategy), this.container.removeAllChildren(); + } + moveStart() { + } + viewChange() { + } + moveEnd() { + this.requestUpdate(); + } + createFetchPopupFeaturesQuery(e) { + const { view: i, bitmapContainer: r } = this, { x: n, y: s } = e, { spatialReference: o } = i; + let a, l = 0, c = 0; + if (r.children.some((v) => { + const { width: x, height: I, resolution: P, x: F, y: k } = v, V = F + P * x, j = k - P * I; + return n >= F && n <= V && s <= k && s >= j && (a = new br({ xmin: F, ymin: j, xmax: V, ymax: k, spatialReference: o }), l = x, c = I, !0); + }), !a) + return null; + const h = a.width / l, p = Math.round((n - a.xmin) / h), y = Math.round((a.ymax - s) / h); + return { extent: a, width: l, height: c, x: p, y }; + } + async doRefresh() { + this.requestUpdate(); + } + isUpdating() { + return this.strategy.updating || this.updateRequested; + } + fetchImage(e, i, r, n) { + return this.layer.fetchImageBitmap(e, i, r, { timeExtent: this.timeExtent, ...n }); + } +}; +E([N()], pK.prototype, "strategy", void 0), E([N()], pK.prototype, "updating", void 0), pK = E([dt("esri.views.2d.layers.WMSLayerView2D")], pK); +const Vmr = pK, jmr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Vmr +}, Symbol.toStringTag, { value: "Module" })), Gmr = [102113, 102100, 3857, 3785, 900913], Umr = [0, 0]; +let fK = class extends eL(hFt(ky($y))) { + constructor() { + super(...arguments), this._tileStrategy = null, this._fetchQueue = null, this._tileRequests = /* @__PURE__ */ new Map(), this.layer = null; + } + get tileMatrixSet() { + const e = this._getTileMatrixSetBySpatialReference(this.layer.activeLayer); + return e ? (e.id !== this.layer.activeLayer.tileMatrixSetId && (this.layer.activeLayer.tileMatrixSetId = e.id), e) : null; + } + update(e) { + this._fetchQueue.pause(), this._fetchQueue.state = e.state, this._tileStrategy.update(e), this._fetchQueue.resume(); + } + attach() { + const e = this.tileMatrixSet?.tileInfo; + e && (this._tileInfoView = new f8(e), this._fetchQueue = new fU({ tileInfoView: this._tileInfoView, concurrency: 16, process: (i, r) => this.fetchTile(i, r) }), this._tileStrategy = new CQ({ cachePolicy: "keep", resampling: !0, acquireTile: (i) => this.acquireTile(i), releaseTile: (i) => this.releaseTile(i), tileInfoView: this._tileInfoView }), this.addAttachHandles(Qi(() => [this.layer?.activeLayer?.styleId, this.tileMatrixSet], () => this._refresh())), super.attach()); + } + detach() { + super.detach(), this._tileStrategy?.destroy(), this._fetchQueue?.destroy(), this._fetchQueue = this._tileStrategy = this._tileInfoView = null; + } + moveStart() { + this.requestUpdate(); + } + viewChange() { + this.requestUpdate(); + } + moveEnd() { + this.requestUpdate(); + } + releaseTile(e) { + this._fetchQueue.abort(e.key.id), this._bitmapView.removeChild(e), e.once("detach", () => e.destroy()), this.requestUpdate(); + } + acquireTile(e) { + const i = this._bitmapView.createTile(e), r = i.bitmap; + return [r.x, r.y] = this._tileInfoView.getTileCoords(Umr, i.key), r.resolution = this._tileInfoView.getTileResolution(i.key), [r.width, r.height] = this._tileInfoView.tileInfo.size, this._enqueueTileFetch(i), this._bitmapView.addChild(i), this.requestUpdate(), i; + } + async doRefresh() { + !this.attached || this.updateRequested || this.suspended || this._refresh(); + } + isUpdating() { + return this._fetchQueue?.updating ?? !1; + } + async fetchTile(e, i = {}) { + const r = "tilemapCache" in this.layer ? this.layer.tilemapCache : null, { signal: n, resamplingLevel: s = 0 } = i; + if (!r) + return this._fetchImage(e, n); + const o = new Lh(0, 0, 0, 0); + let a; + try { + await r.fetchAvailabilityUpsample(e.level, e.row, e.col, o, { signal: n }), a = await this._fetchImage(o, n); + } catch (l) { + if (us(l)) + throw l; + if (s < 3) { + const c = this._tileInfoView.getTileParentId(e.id); + if (c) { + const h = new Lh(c), p = await this.fetchTile(h, { ...i, resamplingLevel: s + 1 }); + return cme(this._tileInfoView, p, h, e); + } + } + throw l; + } + return cme(this._tileInfoView, a, o, e); + } + canResume() { + const e = super.canResume(); + return e && this.tileMatrixSet !== null; + } + supportsSpatialReference(e) { + return this.layer.activeLayer.tileMatrixSets?.some((i) => Ea(i.tileInfo?.spatialReference, e)) ?? !1; + } + async _enqueueTileFetch(e) { + if (!this._fetchQueue.has(e.key.id)) { + try { + const i = await this._fetchQueue.push(e.key); + e.bitmap.source = i, e.bitmap.width = this._tileInfoView.tileInfo.size[0], e.bitmap.height = this._tileInfoView.tileInfo.size[1], e.once("attach", () => this.requestUpdate()); + } catch (i) { + us(i) || Ei.getLogger(this.declaredClass).error(i); + } + this.requestUpdate(); + } + } + async _fetchImage(e, i) { + return this.layer.fetchImageBitmapTile(e.level, e.row, e.col, { signal: i }); + } + _refresh() { + this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e) => { + if (!e.bitmap.source) + return; + const i = { id: e.key.id, fulfilled: !1, promise: this._fetchQueue.push(e.key).then((r) => { + e.bitmap.source = r; + }).catch((r) => { + us(r) || (e.bitmap.source = null); + }).finally(() => { + e.requestRender(), i.fulfilled = !0; + }) }; + this._tileRequests.set(e, i); + }); + } + _getTileMatrixSetBySpatialReference(e) { + const i = this.view.spatialReference; + if (!e.tileMatrixSets) + return null; + let r = e.tileMatrixSets.find((n) => Ea(n.tileInfo?.spatialReference, i)); + return !r && i.isWebMercator && (r = e.tileMatrixSets.find((n) => Gmr.includes(n.tileInfo?.spatialReference.wkid ?? -1))), r; + } +}; +E([N()], fK.prototype, "_fetchQueue", void 0), E([N({ readOnly: !0 })], fK.prototype, "tileMatrixSet", null), fK = E([dt("esri.views.2d.layers.WMTSLayerView2D")], fK); +const zmr = fK, Hmr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: zmr +}, Symbol.toStringTag, { value: "Module" })); +/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. + * v1.0.8-next.4 + */ +const Wmr = $3t, qmr = Qie, Ymr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + CalciteScrim: Wmr, + defineCustomElement: qmr +}, Symbol.toStringTag, { value: "Module" })), Xmr = ["innerHTML"], xae = /* @__PURE__ */ Kr({ + __name: "default-button", + props: { + panelId: { + type: String, + required: !0 + }, + minimize: { + type: Boolean, + default: !1 + }, + overflow: { + type: Boolean + } + }, + setup(t) { + const e = t, { t: i } = Xn(), r = Ys("iApi"), n = zr(() => r?.panel.get(e.panelId)?.button), s = () => { + e.minimize ? r?.panel.toggleMinimize(e.panelId) : r?.panel.toggle(e.panelId); + }; + return (o, a) => { + const l = Bo("appbar-button"); + return n.value ? (qt(), In(l, { + key: 0, + onClickFunction: s, + tooltip: gi(i)(n.value.tooltip), + id: t.panelId + }, { + default: Sn(() => [ + Dt("div", { + class: Gn(["default fill-current w-24 h-24 ml-8 sm:ml-20", { "ml-20": t.overflow }]), + innerHTML: n.value.icon + }, null, 10, Xmr) + ]), + _: 1 + }, 8, ["tooltip", "id"])) : Xr("", !0); + }; + } +}); +const Kmr = {}, Jmr = { class: "border-b p-0 self-center w-2/3" }; +function Zmr(t, e) { + return qt(), li("span", Jmr); +} +const pot = /* @__PURE__ */ ol(Kmr, [["render", Zmr], ["__scopeId", "data-v-5d32b715"]]); +var Qmr = { + name: "maxSize", + enabled: !0, + phase: "main", + requiresIfExists: ["offset", "preventOverflow", "flip"], + fn: function(e) { + var i = e.state, r = e.name, n = e.options, s = M$(i, n), o = i.modifiersData.preventOverflow || { + x: 0, + y: 0 + }, a = o.x, l = o.y, c = i.rects.popper, h = c.width, p = c.height, y = i.placement.split("-"), v = y[0], x = v === "left" ? "left" : "right", I = v === "top" ? "top" : "bottom"; + i.modifiersData[r] = { + width: h - s[x] - a, + height: p - s[I] - l + }; + } +}; +const egr = (t) => (Pc("data-v-dff908d7"), t = t(), Oc(), t), tgr = ["content"], igr = /* @__PURE__ */ egr(() => /* @__PURE__ */ Dt("svg", { + class: "fill-current w-24 h-24 m-auto", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) +], -1)), rgr = [ + igr +], ngr = /* @__PURE__ */ Kr({ + __name: "more-button", + props: { + position: { + type: String, + default: "right-end" + }, + popperOptions: { + type: Object, + default() { + return {}; + } + } + }, + setup(t) { + const e = t, { t: i } = Xn(), r = Ys("iApi"), n = Si(!1), s = Si(), o = Si(), a = Si(), l = () => { + n.value = !n.value; + const c = { + name: "applyMaxSize", + enabled: !0, + phase: "beforeWrite", + requires: ["maxSize"], + fn({ state: p }) { + const { width: y, height: v } = p.modifiersData.maxSize; + p.styles.popper = { + ...p.styles.popper, + maxWidth: `${y}px`, + maxHeight: `${Math.max(80, v) - 38}px` + }, p.styles.popper.overflowY = "auto", p.styles.popper.overflowX = "hidden"; + } + }, h = r.$vApp.$el.querySelector(".inner-shell"); + o.value && a.value && dSt( + o.value, + a.value, + { + placement: e.position || "right-end", + modifiers: [ + { + ...Qmr, + options: { + boundary: h + } + }, + c, + { + name: "offset", + options: { + offset: [0, 5] + } + } + ], + ...e.popperOptions + } + ); + }; + return sl(() => { + window.addEventListener( + "click", + (c) => { + c.target instanceof HTMLElement && !s.value?.contains(c.target) && (n.value = !1); + }, + { capture: !0 } + ); + }), gl(() => { + window.removeEventListener( + "click", + (c) => { + c.target instanceof HTMLElement && !s.value?.contains(c.target) && (n.value = !1); + }, + { capture: !0 } + ); + }), (c, h) => { + const p = qn("focus-item"), y = qn("tippy"); + return qt(), li("div", { + class: "appbar-item relative inset-x-0 w-full text-center", + ref_key: "el", + ref: s + }, [ + Gr((qt(), li("button", { + type: "button", + class: "text-gray-400 w-full h-48 focus:outline-none hover:text-white", + onClick: h[0] || (h[0] = (v) => l()), + content: gi(i)("appbar.more"), + ref_key: "dropdownTrigger", + ref: o + }, rgr, 8, tgr)), [ + [p], + [y, { placement: "right-end" }] + ]), + Gr(Dt("div", { + id: "dropdown", + class: "dropdown shadow-md border border-gray:200 absolute w-64 flex flex-col bg-white rounded", + ref_key: "dropdown", + ref: a + }, [ + _m(c.$slots, "default", {}, void 0, !0) + ], 512), [ + [Rf, n.value] + ]) + ], 512); + }; + } +}); +const sgr = /* @__PURE__ */ ol(ngr, [["__scopeId", "data-v-dff908d7"]]), ogr = (t) => (Pc("data-v-f2294fce"), t = t(), Oc(), t), agr = /* @__PURE__ */ ogr(() => /* @__PURE__ */ Dt("svg", { + class: "fill-current w-24 h-24 mx-8 sm:mx-20", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { d: "M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" }) +], -1)), lgr = { + key: 0, + class: "number absolute top-1 right-2 text-white w-18 rounded-full" +}, ugr = /* @__PURE__ */ Kr({ + __name: "appbar-button", + setup(t) { + const e = mI(), { t: i } = Xn(), r = Ys("iApi"), n = zr(() => e.notificationNumber), s = () => { + r.panel.toggle("notifications"); + }; + return (o, a) => { + const l = Bo("appbar-button", !0); + return qt(), In(l, { + onClickFunction: s, + tooltip: gi(i)("notifications.title"), + class: "notification-button", + id: "" + }, { + default: Sn(() => [ + agr, + n.value && n.value > 0 ? (qt(), li("span", lgr, vr(n.value), 1)) : Xr("", !0) + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}); +const cgr = /* @__PURE__ */ ol(ugr, [["__scopeId", "data-v-f2294fce"]]), hgr = /* @__PURE__ */ Kr({ + __name: "appbar", + setup(t) { + const e = V0(), i = Bg(), r = zr(() => i.visible), n = zr( + () => i.temporary + ), s = Si(!1), o = Si({}), a = Si(); + return H0(() => { + const l = uf(); + window.addEventListener("resize", () => l?.proxy?.$forceUpdate()); + }), gl(() => { + const l = uf(); + window.removeEventListener("resize", () => l?.proxy?.$forceUpdate()); + }), _8(() => { + L0(() => { + const l = a.value; + let c, h = [...l.children], p = h[h.length - 2].getBoundingClientRect().top; + e.mobileView || (p = l.getBoundingClientRect().bottom - 38); + let y = l.querySelector("#dropdown"); + for (let I = h.length - 4; I >= 0; I--) { + let P = h[I].getBoundingClientRect().bottom; + if (p && y && (P > p || s.value && P + 56 > p)) + h[I].classList.forEach((F) => { + F.includes("identifier") && (c = F.slice(11)); + }), c && (o.value[c] = !0), s.value || (s.value = !0); + else if (P !== 0) + break; + } + let v = l.querySelector("#more"), x = v.getBoundingClientRect().bottom; + if (c = void 0, s.value && p && v && y && x !== 0 && (x <= p - 56 || y.childElementCount == 1 && x <= p)) { + let I = y.childElementCount, P = 0; + for (; x <= p - 56 || I == 1; ) { + let F = y.children[P]; + if (F && (F.classList.forEach((k) => { + k.includes("identifier") && (c = k.slice(11)); + }), c && (o.value[c] = !1), x += 48, I -= 1, P += 1), I === 0) { + s.value = !1; + break; + } + } + } + Object.keys(o.value).forEach((I) => { + l.querySelector(`.identifier-${I}`) || delete o.value[I]; + }); + }); + }), (l, c) => { + const h = qn("focus-list"); + return Gr((qt(), li("div", { + class: "absolute top-0 left-0 bottom-28 flex flex-col w-40 pointer-events-auto appbar z-50 sm:z-20 bg-black-75 sm:w-64 sm:bottom-38", + ref_key: "el", + ref: a + }, [ + (qt(!0), li(Ws, null, nu(r.value, (p, y) => (qt(), li(Ws, null, [ + (qt(!0), li(Ws, null, nu(p, (v, x) => (qt(), li(Ws, null, [ + typeof v == "string" && o.value[`${v}-${x}`] !== !0 ? (qt(), In(xae, { + key: `${v}-${x}-default`, + panelId: v, + class: Gn(["appbar-item h-48", `identifier-${v}-${x}`]) + }, null, 8, ["panelId", "class"])) : o.value[`${v}-${x}`] !== !0 ? (qt(), In(t3(v.componentId), { + key: `${v}-${x}-custom`, + options: v.options, + class: Gn(["appbar-item h-48", `identifier-${v}-${x}`]), + id: v.id + }, null, 8, ["options", "id", "class"])) : Xr("", !0) + ], 64))), 256)), + o.value[`divider-${y}`] !== !0 ? (qt(), In(pot, { + class: Gn(["appbar-item", `identifier-divider-${y}`]), + key: `${p}-${y}-default` + }, null, 8, ["class"])) : Xr("", !0) + ], 64))), 256)), + (qt(!0), li(Ws, null, nu(n.value?.filter( + (p) => o.value[`${p}-temp`] !== !0 + ), (p) => (qt(), In(xae, { + panelId: p, + minimize: !0, + key: `${p}-temp`, + class: Gn([`identifier-${p}-temp`, "appbar-item h-48"]) + }, null, 8, ["panelId", "class"]))), 128)), + Gr(Dn(sgr, { id: "more" }, { + default: Sn(() => [ + (qt(!0), li(Ws, null, nu(r.value, (p, y) => (qt(), li(Ws, { key: y }, [ + (qt(!0), li(Ws, null, nu(p, (v, x) => (qt(), li(Ws, null, [ + typeof v == "string" && o.value[`${v}-${x}`] ? (qt(), In(xae, { + key: `${v}-${x}-default`, + panelId: v, + class: Gn(["text-black hover:bg-gray my-4 h-36", `identifier-${v}-${x}`]), + overflow: "" + }, null, 8, ["panelId", "class"])) : o.value[`${v}-${x}`] ? (qt(), In(t3(v.componentId), { + key: `${v}-${x}-custom`, + options: v.options, + id: v.id, + class: Gn(["appbar-item h-48", `identifier-${v}-${x}`]) + }, null, 8, ["options", "id", "class"])) : Xr("", !0) + ], 64))), 256)), + o.value[`divider-${y}`] ? (qt(), In(pot, { + key: 0, + class: Gn(["border-black my-4", `identifier-divider-${y}`]) + }, null, 8, ["class"])) : Xr("", !0) + ], 64))), 128)), + (qt(!0), li(Ws, null, nu(n.value?.filter( + (p) => o.value[`${p}-temp`] + ), (p) => (qt(), In(xae, { + panelId: p, + minimize: !0, + key: `${p}-temp`, + class: Gn([`identifier-${p}-temp`, "text-black hover:bg-gray my-4 h-36"]), + overflow: "" + }, null, 8, ["panelId", "class"]))), 128)) + ]), + _: 1 + }, 512), [ + [Rf, s.value] + ]), + Dn(cgr, { class: "appbar-item bottom-48 h-48 sm:display-none" }), + Dn(ySt, { + class: "absolute bottom-0 h-40 sm:display-none w-full text-center", + position: "right-start" + }) + ])), [ + [h] + ]); + }; + } +}); +class dgr extends oc { + /** + * Returns `AppbarFixtureConfig` section of the global config file. + * + * @readonly + * @type {AppbarFixtureConfig} + * @memberof AppbarFixture + */ + get config() { + return super.config; + } + /** + * Parses the appbar config JSON snippet from the config file and save resulting objects to the fixture store. + * + * @param {AppbarFixtureConfig} [appbarConfig] + * @returns + * @memberof AppbarAPI + */ + _parseConfig(e) { + if (!e) + return; + const i = Bg(this.$vApp.$pinia); + let r; + Array.isArray(e.items[0]) ? r = e.items : r = [e.items]; + const n = []; + r.forEach((s) => { + n.push( + s.map((o) => typeof o == "string" ? o : new Zbe(o)) + ); + }), i.items = n.flat().reduce((s, o) => (s[o instanceof Zbe ? o.id : o] = o, s), {}), i.order = n.map( + (s) => s.map( + (o) => o instanceof Zbe ? o.id : o + ) + ), this._validateItems(); + } + /** + * Checks if components specified as appbar items are registered or not. + * + * @memberof AppbarAPI + */ + _validateItems() { + const e = Bg(this.$vApp.$pinia); + e.order.flat().forEach((i) => { + typeof e.items[i] != "string" && [i].some((r) => { + this.$iApi.fixture.get(r) && !e.items[i] && (e.items[i].componentId = `${r}-appbar-button`); + }); + }); + } +} +const pgr = { en: { "appbar.navigation": "Navigation", "appbar.more": "More", "navigation.export": "Export", "navigation.map.export": "Export Map" }, fr: { "appbar.navigation": "Navigation", "appbar.more": "Plus", "navigation.export": "Exporter", "navigation.map.export": "Exporter la Carte" } }; +class fgr extends dgr { + initialized() { + } + async added() { + Object.entries(pgr).forEach( + (o) => this.$iApi.$i18n.mergeLocaleMessage(...o) + ); + const { destroy: e, el: i } = this.mount(hgr, { + app: this.$element + }), r = this.$vApp.$el.getElementsByClassName("inner-shell")[0]; + r.insertBefore( + i.childNodes[0], + r.querySelector(".panel-stack") + ), this._parseConfig(this.config); + const n = this.$vApp.$watch( + () => this.config, + (o) => this._parseConfig(o) + ), s = []; + s.push( + this.$iApi.event.on(an.COMPONENT, () => { + this._parseConfig(this.config); + }) + ), this.removed = () => { + const o = Bg(this.$vApp.$pinia); + n(), s.forEach((c) => this.$iApi.event.off(c)); + const a = { ...o.items }, l = [...o.temporary]; + Object.keys(a).forEach((c) => o.removeButton(c)), l.forEach((c) => o.removeButton(c)), e(), o.$reset(); + }; + } +} +const mgr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: fgr +}, Symbol.toStringTag, { value: "Module" })), ggr = (t) => (Pc("data-v-74cdad7d"), t = t(), Oc(), t), ygr = { class: "mt-10" }, vgr = ["aria-label"], _gr = ["alt", "src"], bgr = ["alt"], wgr = { class: "absolute flex w-full bg-black opacity-75 text-white h-30 bottom-6 items-center" }, xgr = { class: "pl-5" }, Sgr = { class: "ml-auto pr-5" }, Cgr = ["content"], Tgr = /* @__PURE__ */ ggr(() => /* @__PURE__ */ Dt("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) +], -1)), Egr = [ + Tgr +], Igr = /* @__PURE__ */ Kr({ + __name: "item", + props: { + area: { + type: Object, + required: !0 + }, + showThumbnail: { + type: Boolean + } + }, + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = (n) => { + if (!n.extent) { + console.error( + "selected area of interest doesn't have an extent specified." + ); + return; + } + i?.geo.map.zoomMapTo( + Rd.fromConfig("area-of-interest-extent", n.extent) + ); + }; + return (n, s) => { + const o = qn("truncate"), a = qn("tippy"), l = qn("focus-item"); + return qt(), li("div", ygr, [ + Gr((qt(), li("button", { + type: "button", + class: Gn(["area-of-interest-item-button bg-gray-300 w-full", { "border border-gray-300": t.showThumbnail }]), + "aria-label": gi(e)("areas-of-interest.select"), + onClick: s[2] || (s[2] = (c) => r(t.area)) + }, [ + Dt("div", null, [ + Dt("div", { + class: Gn(["flex hover:opacity-50 area-of-interest-item-image", t.showThumbnail ? "h-180" : "h-30"]) + }, [ + t.area.thumbnail ? (qt(), li("img", { + key: 0, + class: "w-full bg-white object-contain", + alt: t.area.altText || t.area.title, + src: t.area.thumbnail + }, null, 8, _gr)) : t.showThumbnail ? (qt(), li("img", { + key: 1, + class: "w-full bg-white object-contain py-30", + alt: t.area.altText || t.area.title, + src: "https://openclipart.org/image/800px/160615" + }, null, 8, bgr)) : Xr("", !0) + ], 2) + ]), + Dt("div", wgr, [ + Gr((qt(), li("div", xgr, [ + Dt("span", null, vr(t.area.title), 1) + ])), [ + [o] + ]), + Gr(Dt("div", Sgr, [ + Gr((qt(), li("a", { + onClick: s[0] || (s[0] = Go(() => { + }, ["stop"])), + onKeydown: s[1] || (s[1] = Dh(Go(() => { + }, ["prevent"]), ["enter", "space"])), + content: t.area.description + }, Egr, 40, Cgr)), [ + [a, { + placement: "bottom", + trigger: "click focus" + }] + ]) + ], 512), [ + [Rf, t.area.description] + ]) + ]) + ], 10, vgr)), [ + [l] + ]) + ]); + }; + } +}); +const Agr = /* @__PURE__ */ ol(Igr, [["__scopeId", "data-v-74cdad7d"]]), Pgr = { class: "h-600 overflow-y-auto" }, Ogr = { class: "mx-5" }, Rgr = { key: 0 }, VFt = /* @__PURE__ */ Kr({ + __name: "screen", + props: { + panel: { + type: Object + } + }, + setup(t) { + const { t: e } = Xn(), i = _0e(), r = zr( + () => i.areas + ); + let n = Si(!1); + return sl(() => { + n.value = !!r.value?.some( + (s) => s.thumbnail + ); + }), (s, o) => { + const a = Bo("panel-screen"), l = qn("focus-list"); + return qt(), In(a, { panel: t.panel }, { + header: Sn(() => [ + qs(vr(gi(e)("areas-of-interest.title")), 1) + ]), + content: Sn(() => [ + Dt("div", Pgr, [ + Dt("div", Ogr, [ + r.value.length > 0 ? Gr((qt(), li("ul", Rgr, [ + (qt(!0), li(Ws, null, nu(r.value, (c, h) => (qt(), li("li", { key: h }, [ + Dn(Agr, { + area: c, + "show-thumbnail": gi(n), + class: "block relative overflow-hidden" + }, null, 8, ["area", "show-thumbnail"]) + ]))), 128)) + ])), [ + [l] + ]) : Xr("", !0) + ]) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), Mgr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: VFt +}, Symbol.toStringTag, { value: "Module" })), Dgr = { en: { "areas-of-interest.title": "Areas of Interest", "areas-of-interest.select": "Select area of interest" }, fr: { "areas-of-interest.title": "Zones d'intérêt", "areas-of-interest.select": "Sélectionner la zone d'intérêt" } }; +class Fgr extends oc { + /** + * Get the current areas of interest config + */ + get config() { + return super.config; + } + /** + * Parses the areas of interest config snippet from the config json + */ + _parseConfig(e) { + if (!e) + return; + const i = _0e(this.$vApp.$pinia); + i.areas = e.areas, this.handlePanelTeleports(["areas-of-interest"]); + } +} +class Lgr extends Fgr { + added() { + this.$iApi.panel.register( + { + "areas-of-interest": { + screens: { + "areas-of-interest-screen": ya( + VFt + ) + }, + style: { + width: "350px" + }, + button: { + tooltip: "areas-of-interest.title", + icon: '' + }, + alertName: "areas-of-interest.title" + } + }, + { + i18n: { messages: Dgr } + } + ), this._parseConfig(this.config); + const e = this.$vApp.$watch( + () => this.config, + (i) => this._parseConfig(i) + ); + this.removed = () => { + e(), this.$iApi.fixture.get("appbar") && Bg(this.$vApp.$pinia).removeButton("areas-of-interest"), this.$iApi.panel.remove("areas-of-interest"), _0e( + this.$vApp.$pinia + ).$reset(); + }; + } +} +const Ngr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Lgr +}, Symbol.toStringTag, { value: "Module" })), jFt = (t) => (Pc("data-v-dbfed424"), t = t(), Oc(), t), kgr = { class: "mb-10" }, $gr = ["aria-label"], Bgr = { + key: 0, + class: "w-full h-30" +}, Vgr = ["alt", "src"], jgr = ["alt", "src"], Ggr = ["alt"], Ugr = { class: "pl-5" }, zgr = { class: "ml-auto pr-5" }, Hgr = ["content"], Wgr = /* @__PURE__ */ jFt(() => /* @__PURE__ */ Dt("svg", { + class: "fill-current w-16 h-16", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) +], -1)), qgr = [ + Wgr +], Ygr = { + key: 0, + class: "rv-basemap-check absolute top-0 right-0" +}, Xgr = /* @__PURE__ */ jFt(() => /* @__PURE__ */ Dt("svg", { + class: "fill-current w-25 h-25 relative", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" }) +], -1)), Kgr = [ + Xgr +], Jgr = /* @__PURE__ */ Kr({ + __name: "item", + props: { + basemap: { + type: Object, + required: !0 + }, + tileSchema: { + type: Object, + required: !0 + } + }, + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = fm(), n = zr( + () => r.activeBasemapConfig + ), s = (o) => { + o.id !== n.value.id && i?.geo.map.setBasemap(o.id); + }; + return (o, a) => { + const l = qn("truncate"), c = qn("tippy"), h = qn("focus-item"); + return qt(), li("div", kgr, [ + Gr((qt(), li("button", { + class: "basemap-item-button bg-gray-300 w-full h-full", + type: "button", + "aria-label": gi(e)("basemap.select"), + onClick: a[2] || (a[2] = (p) => s(t.basemap)) + }, [ + Dt("div", null, [ + Dt("div", { + class: Gn(["flex hover:opacity-50 basemap-item-image basemap-item-container", t.basemap.hideThumbnail ? "h-30" : "h-180"]) + }, [ + t.basemap.hideThumbnail ? (qt(), li("img", Bgr)) : t.basemap.thumbnailUrl ? (qt(), li("img", { + key: 1, + class: "w-full h-180", + alt: t.basemap.altText, + src: t.basemap.thumbnailUrl + }, null, 8, Vgr)) : t.tileSchema.thumbnailTileUrls && t.tileSchema.thumbnailTileUrls.length > 0 && t.basemap.layers.every( + (p) => p.layerType === "esri-tile" + ) ? (qt(!0), li(Ws, { key: 2 }, nu(t.basemap.layers, (p) => (qt(), li("div", { + key: p.id, + class: "flex basemap-item-inner h-180" + }, [ + (qt(!0), li(Ws, null, nu(t.tileSchema.thumbnailTileUrls, (y, v) => (qt(), li("img", { + class: "w-full", + alt: t.basemap.altText, + src: p.url + y, + key: v + }, null, 8, jgr))), 128)) + ]))), 128)) : (qt(), li("img", { + key: 3, + class: "w-full bg-white h-180", + alt: t.basemap.altText, + src: "https://openclipart.org/image/800px/275366" + }, null, 8, Ggr)) + ], 2) + ]), + Dt("div", { + class: Gn([ + "absolute flex w-full bg-black text-white h-30 bottom-6 items-center", + t.basemap.hideThumbnail && t.basemap.id === n.value.id ? "opacity-85" : "opacity-75" + ]) + }, [ + Gr((qt(), li("div", Ugr, [ + Dt("span", null, vr(t.basemap.name), 1) + ])), [ + [l] + ]), + Dt("div", zgr, [ + Gr((qt(), li("a", { + onClick: a[0] || (a[0] = Go(() => { + }, ["stop"])), + onKeydown: a[1] || (a[1] = Dh(Go(() => { + }, ["prevent"]), ["enter", "space"])), + content: t.basemap.description + }, qgr, 40, Hgr)), [ + [c, { + placement: "bottom", + trigger: "click focus" + }] + ]) + ]) + ], 2), + t.basemap.id === n.value.id && !t.basemap.hideThumbnail ? (qt(), li("div", Ygr, Kgr)) : Xr("", !0) + ], 8, $gr)), [ + [h] + ]) + ]); + }; + } +}); +const Zgr = /* @__PURE__ */ ol(Jgr, [["__scopeId", "data-v-dbfed424"]]), Qgr = { class: "h-600 overflow-y-auto" }, eyr = { class: "font-bold text-xl" }, tyr = { + key: 0, + class: "border-t border-b border-gray-600" +}, GFt = /* @__PURE__ */ Kr({ + __name: "screen", + props: { + panel: { + type: Object + } + }, + setup(t) { + const { t: e } = Xn(), i = fm(), r = Si([]), n = Si([]); + sl(() => { + const o = i.config.map; + r.value = o.tileSchemas, n.value = o.basemaps; + }); + const s = (o) => n.value.filter( + (a) => a.tileSchemaId === o + ); + return (o, a) => { + const l = Bo("panel-screen"), c = qn("truncate"), h = qn("focus-list"); + return qt(), In(l, { panel: t.panel }, { + header: Sn(() => [ + qs(vr(gi(e)("basemap.title")), 1) + ]), + content: Sn(() => [ + Dt("div", Qgr, [ + (qt(!0), li(Ws, null, nu(r.value, (p, y) => (qt(), li("div", { + class: "mx-5", + key: p.id + }, [ + Dt("div", { + class: Gn((y === 0 ? "mt-5" : "mt-36") + " flex mb-5") + }, [ + Gr((qt(), li("h3", eyr, [ + qs(vr(p.name), 1) + ])), [ + [c] + ]) + ], 2), + n.value.length > 0 ? Gr((qt(), li("ul", tyr, [ + (qt(!0), li(Ws, null, nu(s(p.id), (v) => (qt(), li("li", { + key: v.id + }, [ + Dn(Zgr, { + basemap: v, + tileSchema: p, + class: "block relative overflow-hidden" + }, null, 8, ["basemap", "tileSchema"]) + ]))), 128)) + ])), [ + [h] + ]) : Xr("", !0) + ]))), 128)) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), iyr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: GFt +}, Symbol.toStringTag, { value: "Module" })), ryr = /* @__PURE__ */ Dt("svg", { + class: "fill-current w-32 h-20", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z" }) +], -1), nyr = /* @__PURE__ */ Kr({ + __name: "nav-button", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = () => i?.panel.toggle("basemap"); + return (n, s) => { + const o = Bo("mapnav-button"); + return qt(), In(o, { + onClickFunction: r, + tooltip: gi(e)("basemap.title") + }, { + default: Sn(() => [ + ryr + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}), syr = { en: { "basemap.select": "Select basemap", "basemap.title": "Basemap" }, fr: { "basemap.select": "Sélectionner la carte de base", "basemap.title": "Carte de base" } }; +class oyr extends oc { + added() { + this.$iApi.component("basemap-nav-button", nyr), this.$iApi.panel.register( + { + id: "basemap", + config: { + screens: { "basemap-component": ya(GFt) }, + button: { + tooltip: "basemap.title", + icon: '' + }, + alertName: "basemap.title" + } + }, + { i18n: { messages: syr } } + ), this.handlePanelTeleports(["basemap"]); + } + removed() { + this.$iApi.fixture.get("appbar") && Bg(this.$vApp.$pinia).removeButton("basemap"), this.$iApi.fixture.get("mapnav") && $4(this.$vApp.$pinia).removeItem("basemap"), this.$iApi.panel.remove("basemap"); + } +} +const ayr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: oyr +}, Symbol.toStringTag, { value: "Module" })), lyr = (t) => (Pc("data-v-495353cf"), t = t(), Oc(), t), uyr = /* @__PURE__ */ lyr(() => /* @__PURE__ */ Dt("svg", { + xmlns: "http://www.w3.org/2000/svg", + fit: "", + height: "100%", + width: "100%", + preserveAspectRatio: "xMidYMid meet", + viewBox: "0 0 24 24", + focusable: "false" +}, [ + /* @__PURE__ */ Dt("g", { + fill: "#545353", + stroke: "#fff", + id: "crosshairs" + }, [ + /* @__PURE__ */ Dt("ellipse", { + ry: ".254", + rx: ".262", + id: "path3808", + cx: "12", + cy: "12", + "stroke-width": ".076" + }), + /* @__PURE__ */ Dt("path", { + d: "M.045 12.047l6.093.051 4.264.068v-.332l-4.264.067-6.093.064v.039z", + id: "rect4632-6", + "stroke-width": ".09" + }), + /* @__PURE__ */ Dt("path", { + d: "M12.047 23.955l.051-6.093.068-4.264h-.332l.067 4.264.064 6.093h.039z", + id: "rect4632-6-0", + "stroke-width": ".09" + }), + /* @__PURE__ */ Dt("path", { + d: "M23.955 11.953l-6.093-.051-4.264-.068v.332l4.264-.067 6.093-.064v-.039z", + id: "rect4632-6-4", + "stroke-width": ".09" + }), + /* @__PURE__ */ Dt("path", { + d: "M11.953.045l-.051 6.093-.068 4.264h.332l-.067-4.264-.064-6.093h-.039z", + id: "rect4632-6-9", + "stroke-width": ".09" + }) + ]) +], -1)), cyr = [ + uyr +], hyr = /* @__PURE__ */ Kr({ + __name: "crosshairs", + setup(t) { + const e = Ys("iApi"), i = Si(!1), r = Si([]); + return sl(() => { + r.value.push( + e.event.on(an.MAP_EXTENTCHANGE, () => { + e.geo.map.keysActive && (i.value = !0); + }) + ), r.value.push( + e.event.on(an.MAP_FOCUS, () => { + e.geo.map.mouseFocus || (i.value = !0); + }) + ), r.value.push( + e.event.on(an.MAP_MOUSEDOWN, () => { + i.value = !1; + }) + ), r.value.push( + e.event.on(an.MAP_BLUR, () => { + i.value = !1; + }) + ); + }), gl(() => { + r.value.forEach((n) => e.event.off(n)); + }), (n, s) => (qt(), li("div", { + class: Gn(["crosshairs absolute duration-150 top-1/2 left-1/2 h-230 w-230", { "opacity-0": !i.value }]) + }, cyr, 2)); + } +}); +const dyr = /* @__PURE__ */ ol(hyr, [["__scopeId", "data-v-495353cf"]]); +class pyr extends oc { + added() { + const { destroy: e, el: i } = this.mount(dyr, { + app: this.$element + }); + this.$vApp.$el.getElementsByClassName("inner-shell")[0].appendChild(i.childNodes[0]), this.removed = () => { + e(); + }; + } +} +const fyr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: pyr +}, Symbol.toStringTag, { value: "Module" })), yme = "Ramp-Hilight", W2e = "Ramp-Hilight-Fog-Basemap", myr = { + mode: "glow", + options: { + haloColor: [0, 255, 0], + // lime green + haloOpacity: 0.8 + } +}; +var h6 = /* @__PURE__ */ ((t) => (t.NONE = "none", t.GLOW = "glow", t.LIFT = "lift", t.FOG = "fog", t))(h6 || {}); +const q2e = "details"; +class gyr extends oc { + detailsStore = D4(this.$vApp.$pinia); + get config() { + return super.config; + } + /** + * Updates the identify result in the store, and then opens the details panel. + * + * @param {IdentifyResult[]} payload + * @memberof DetailsAPI + */ + openDetails(e) { + this.detailsStore.payload = e, e.forEach((r) => { + const n = this.$iApi.useStore("layer").getLayerByUid(r.uid); + this._loadDetailsConfig(n); + }), this.$iApi.panel.get("details-panel").isOpen || this.$iApi.panel.open({ + id: "details-panel" + }); + } + /** + * Provided with the data for a single feature, toggles the details panel directly with the feature screen. + * + * @param {{data: any, uid: string, format: string}} featureData + * @param {boolean | undefined} open + * @memberof DetailsAPI + */ + toggleFeature(e, i) { + const r = this.$iApi.panel.get("details-panel"); + r.isOpen && this.$iApi.panel.close(r); + const n = { + result: { + items: [ + { + data: e.data, + format: e.format, + loaded: !0, + loading: Promise.resolve() + } + ], + uid: e.uid, + loading: Promise.resolve(), + loaded: !0, + requestTime: Date.now() + } + }, s = this.$iApi.geo.layer.getLayer( + e.uid + ), o = `${e.uid}-${// see https://github.com/ramp4-pcar4/ramp4-pcar4/issues/1767 for the reasoning behind this + s?.supportsFeatures ? e.data[s?.oidField ?? ""] : JSON.stringify(e.data)}`; + this.detailsStore.currentFeatureId = e.data ? o : void 0, this._loadDetailsConfig(s), i === !1 ? this.$iApi.panel.close(r) : r.isOpen ? this.$iApi.panel.close(r) : (this.detailsStore.payload = [n.result], this.$iApi.panel.open({ + id: "details-panel", + screen: "details-screen", + props: n + })); + } + /** + * Read the details section of the layers' fixture config + * + * @param {DetailsConfig} [config] + * @memberof DetailsAPI + */ + _parseConfig(e) { + e && e.templates && (this.detailsStore.defaultTemplates = e.templates), this.handlePanelWidths(["details-panel"]), this.handlePanelTeleports(["details-panel"]); + const i = this.getLayerFixtureConfigs(), r = []; + Object.keys(i).forEach((s) => { + r.push({ + id: s, + name: i[s].name, + template: i[s].template, + fields: i[s].fields + }); + }); + const n = r.map( + (s) => new Lbi(s) + ); + this.detailsStore.properties = n.reduce( + (s, o) => (s[o.id] = o, s), + {} + ), this._validateItems(); + } + _loadDetailsConfig(e) { + if (e && this.detailsStore.properties[e.id] === void 0) { + const r = this.getLayerFixtureConfigs(); + r[e.id] !== void 0 && this.detailsStore.addConfigProperty({ + id: e.id, + name: r[e.id].name, + template: r[e.id].template, + fields: r[e.id].fields + }); + } + } + /** + * Check to see if the stored components are registered properly. + * + * @memberof DetailsAPI + */ + _validateItems() { + Object.values(this.detailsStore.properties).forEach((e) => { + e.template in this.$vApp.$options.components && (this.detailsStore.properties[e.id].componentId = e.template); + }); + } + /** + * Highlight identified items + * @param items items to add + * @param layerUid uid of layer the items belong to + */ + async hilightDetailsItems(e, i) { + const r = e instanceof Array ? e : [e], n = this.$iApi.fixture.get("hilight"); + if (n) { + const s = await n.getGraphicsByKey(q2e); + await n.removeHilight(s); + const o = Date.now(); + this.detailsStore.lastHilight = o; + const a = await this.getHilightGraphics( + r, + i + ); + this.detailsStore.lastHilight === o && await n.addHilight(a); + } + } + /** + * Remove all details panel map hilights. + */ + async removeDetailsHilight() { + const e = this.$iApi.fixture.get("hilight"); + if (e) { + this.detailsStore.lastHilight = Date.now(); + const i = await e.getGraphicsByKey(q2e); + await e.removeHilight(i); + } + } + /** + * Reload map elements of the hilighter. + * @param items items to reload + * @param layerUid uid of layer the items belong to + */ + async reloadDetailsHilight(e, i) { + const r = e instanceof Array ? e : [e], n = this.$iApi.fixture.get("hilight"); + if (n) { + const s = await this.getHilightGraphics( + r, + i + ); + n.reloadHilight(s); + } + } + /** + * Return the graphics of the given IdentifyItems. + * @param items items to hilight + * @param layerUid uid of layer the items belong to + */ + async getHilightGraphics(e, i) { + const r = this.$iApi.geo.layer.getLayer(i), n = this.$iApi.fixture.get("hilight"), s = []; + return r && await Promise.all( + e.map(async (o) => { + const a = o.data[r.oidField], l = await r.getGraphic( + a, + { + getGeom: !0, + getAttribs: !0, + getStyle: !0 + } + ); + l.id = n.constructGraphicKey( + q2e, + i, + a + ), s.push(l); + }) + ), s; + } + /** + * Updates hilighted graphics when the hilight toggler is toggled. + * + * @param hilightOn Whether the toggler has been turned on/off + * @param items The items that are affected by the toggle + * @param layerUid the layer UID + */ + onHilightToggle(e, i, r) { + e ? (this.hilightDetailsItems(i, r), this.detailsStore.hilightToggle = !0) : (this.removeDetailsHilight(), this.detailsStore.hilightToggle = !1); + } + /** + * Return whether or not a HilightMode has been defined (other than NONE) + */ + hasHilighter() { + const e = this.$iApi.fixture.get("hilight"); + return e && e.hilightMode.mode !== h6.NONE; + } +} +const yyr = (t) => (Pc("data-v-8107dadc"), t = t(), Oc(), t), vyr = { + key: 0, + class: "relative" +}, _yr = { + key: 0, + class: "relative" +}, byr = ["innerHTML"], wyr = ["src"], xyr = { + key: 1, + class: "w-32 h-32" +}, Syr = { class: "symbologyIcon" }, Cyr = ["innerHTML"], Tyr = ["src"], Eyr = { class: "badge z-50 rounded-full text-white absolute h-10 w-10 p-8 inline-flex items-center justify-center" }, Iyr = { + key: 0, + class: "px-5" +}, Ayr = { + key: 1, + class: "inline-flex justify-center items-center relative" +}, Pyr = /* @__PURE__ */ yyr(() => /* @__PURE__ */ Dt("div", { class: "symbologyIcon h-32 w-32" }, [ + /* @__PURE__ */ Dt("div", { class: "relative animate-spin spinner h-24 w-24" }) +], -1)), Oyr = [ + Pyr +], Ryr = /* @__PURE__ */ Kr({ + __name: "symbology-stack", + props: { + layer: { type: Object, required: !0 }, + result: { type: Object, required: !0 } + }, + setup(t) { + const e = t, i = Si([]); + return sl(() => { + i.value = e.layer.legend; + }), (r, n) => t.result.loaded ? (qt(), li("div", vyr, [ + Dt("div", { + class: Gn(t.result.items.length === 0 ? "opacity-50" : "") + }, [ + i.value.length > 1 ? (qt(), li("div", _yr, [ + (qt(!0), li(Ws, null, nu(i.value.slice(0, 3).reverse(), (s, o) => (qt(), li("div", { + class: Gn(["absolute", [ + o == 0 ? "symbol-0" : o == 1 ? "left-3" : "left-6" + ]]), + style: $v({ "z-index": 3 - o }), + key: o + }, [ + i.value[o].svgcode ? (qt(), li("span", { + key: 0, + class: "symbologyIcon w-28 h-28", + innerHTML: i.value[o].svgcode + }, null, 8, byr)) : i.value[o].imgUrl ? (qt(), li("img", { + key: 1, + class: "symbologyIcon w-28 h-28", + src: i.value[o].imgUrl + }, null, 8, wyr)) : Xr("", !0) + ], 6))), 128)) + ])) : i.value.length > 0 ? (qt(), li("div", xyr, [ + Dt("div", Syr, [ + i.value[0].svgcode ? (qt(), li("span", { + key: 0, + innerHTML: i.value[0].svgcode + }, null, 8, Cyr)) : i.value[0].imgUrl ? (qt(), li("img", { + key: 1, + class: "symbologyIcon w-full h-full", + src: i.value[0].imgUrl + }, null, 8, Tyr)) : Xr("", !0) + ]) + ])) : Xr("", !0) + ], 2), + Dt("div", Eyr, [ + t.result.loaded ? (qt(), li("div", Iyr, vr(t.result.items.length), 1)) : Xr("", !0) + ]) + ])) : (qt(), li("div", Ayr, Oyr)); + } +}); +const Myr = /* @__PURE__ */ ol(Ryr, [["__scopeId", "data-v-8107dadc"]]), Dyr = ["content"], Fyr = { class: "symbologyLayerName truncate" }, Lyr = /* @__PURE__ */ Kr({ + __name: "symbology-item", + props: { + layer: { type: Object, required: !0 }, + result: { type: Object, required: !0 }, + selected: { type: Boolean, required: !0 } + }, + setup(t) { + const e = t, i = D4(), r = zr( + () => i.properties + ), n = () => { + const s = e.layer; + return s && r.value[s.id] && r.value[s.id].name ? r.value[s.id].name : s?.name ?? ""; + }; + return (s, o) => { + const a = qn("tippy"); + return Gr((qt(), li("button", { + class: Gn(["flex flex-grow justify-start items-center px-7 py-10 default-focus-style symbologyStackButton truncate", t.selected ? "detailsButtonSelected" : "px-11"]), + onClick: o[0] || (o[0] = Go(() => { + }, ["stop"])), + content: n() + }, [ + Dn(Myr, { + class: "symbStack w-32 h-32 mr-10", + layer: t.layer, + result: t.result + }, null, 8, ["layer", "result"]), + Dt("div", Fyr, vr(n()), 1) + ], 10, Dyr)), [ + [a, { placement: "right", sticky: !0 }] + ]); + }; + } +}); +const Nyr = ["onBlur"], kyr = /* @__PURE__ */ Kr({ + __name: "symbology-list", + props: { + results: { type: Object, required: !0 }, + selected: { type: String, required: !0 } + }, + emits: ["selection-changed"], + setup(t, { emit: e }) { + const i = t, r = i1(), n = Si(""), s = Si([]), o = Si(!1), a = Si(!1), l = (x) => r.getLayerByUid(x), c = (x) => { + n.value = x, e("selection-changed", x), o.value = !1; + }, h = () => { + a.value || setTimeout(() => { + o.value = a.value; + }, 500), a.value = !0; + }, p = () => { + o.value = a.value = !1; + }, y = () => { + a.value || (o.value = !0), a.value = !0; + }, v = () => { + o.value = a.value = !1; + }; + return H0(() => { + s.value.push( + Fl(i, () => { + n.value = i.selected; + }) + ); + }), gl(() => { + s.value.forEach((x) => x()); + }), (x, I) => { + const P = qn("focus-item"), F = qn("focus-list"); + return Gr((qt(), li("div", { + class: Gn(["symbology-list absolute overflow-hidden z-50 p-0 w-48 bg-white text-sm inline-flex flex-col", { "symbology-list-expanded": o.value }]), + onMouseover: h, + onMouseleave: p, + onFocus: y, + onBlur: Go(v, ["self"]) + }, [ + (qt(!0), li(Ws, null, nu(i.results, (k, V) => (qt(), li("div", { + class: "flex justify-start relative", + key: V + }, [ + Gr((qt(), In(Lyr, { + key: k.uid, + layer: l(k.uid), + result: k, + selected: k.uid === n.value, + onClick: (j) => c(k.uid) + }, null, 8, ["layer", "result", "selected", "onClick"])), [ + [P] + ]) + ]))), 128)) + ], 42, Nyr)), [ + [F] + ]); + }; + } +}); +const $yr = { class: "inline font-bold" }, Byr = /* @__PURE__ */ Dt("span", { class: "flex-auto" }, null, -1), Vyr = ["innerHTML"], jyr = /* @__PURE__ */ Kr({ + __name: "esri-default", + props: { + fixtureFields: { + type: Object, + required: !1 + }, + fields: { + type: Object, + required: !0 + }, + identifyData: { + type: Object, + required: !0 + } + }, + setup(t) { + const e = t, { t: i } = Xn(), r = Ys("iApi"), n = (c, h, p, y) => { + const v = c.find( + (x) => x[h].toLowerCase() === p.toLowerCase() + ); + v && delete y[v.name]; + }, s = () => { + const c = {}; + Object.assign(c, e.identifyData.data), n(e.fields, "type", "geometry", c), r?.ui.exposeOids || n(e.fields, "type", "oid", c), r?.ui.exposeMeasurements || (n(e.fields, "name", "shape_length", c), n(e.fields, "name", "shape_area", c)); + let h = {}; + return e.fields.forEach((p) => { + const y = e.fixtureFields?.find( + (v) => p.name == v.field + ); + h[p.name] = { + name: y?.alias || p.alias || p.name, + type: p.type, + visible: y?.visible ?? !0 + }; + }), Object.keys(c).map((p) => { + c[p] = { + value: typeof c[p] == "number" ? r?.ui.formatNumber(c[p]) : c[p], + alias: h[p].name || p, + // use the key name if alias is undefined + type: h[p].type + }, h[p].visible || delete c[p]; + }), c; + }, o = (c, h, p) => { + switch (p) { + case "date": + return l(c); + default: + return a(c, h); + } + }, a = (c, h) => { + if (!c) + return c; + if (c.trim().match(/\.(jpeg|jpg|gif|png)$/) || c.trim().match( + /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i + //eslint-disable-line + )) + return `${i(
+          `; + const p = "underline text-blue-600 break-all", y = document.createElement("div"); + return y.innerHTML = c.trim(), y.firstElementChild?.tagName == "A" ? (y.firstElementChild.className = p, y.innerHTML) : v0e(c, { + className: p, + target: "_blank", + validate: { + url: (x) => /^https?:\/\//.test(x) + // only links that begin with a protocol will be hyperlinked + } + }); + }, l = (c) => { + const h = parseInt(c); + return isNaN(h) ? c : new Date(h).toISOString().split("T")[0]; + }; + return (c, h) => (qt(), li("div", null, [ + (qt(!0), li(Ws, null, nu(s(), (p, y, v) => (qt(), li("div", { + class: "p-5 pl-3 flex justify-end flex-wrap even:bg-gray-300", + key: v + }, [ + Dt("span", $yr, vr(p.alias), 1), + Byr, + Dt("span", { + class: "inline", + innerHTML: o(p.value, p.alias, p.type) + }, null, 8, Vyr) + ]))), 128)) + ])); + } +}), Gyr = ["innerHTML"], Uyr = { key: 1 }, zyr = /* @__PURE__ */ Kr({ + __name: "html-default", + props: { + identifyData: { + type: Object, + required: !0 + } + }, + setup(t) { + const { t: e } = Xn(); + return (i, r) => t.identifyData ? (qt(), li("div", { + key: 0, + class: "whitespace-pre-wrap break-words h-full overflow-auto", + innerHTML: t.identifyData.data.data ?? t.identifyData.data + }, null, 8, Gyr)) : (qt(), li("div", Uyr, vr(gi(e)("details.layers.results.empty")), 1)); + } +}), Hyr = { class: "relative flex flex-grow truncate" }, Wyr = { + key: 0, + class: "flex flex-grow items-center truncate" +}, qyr = { class: "flex p-8 items-center" }, Yyr = ["innerHTML"], Xyr = { + key: 1, + class: "symbologyIcon p-6" +}, Kyr = /* @__PURE__ */ Dt("div", { class: "animate-spin spinner h-20 w-20" }, null, -1), Jyr = [ + Kyr +], Zyr = ["content"], Qyr = { class: "zoomButton text-center p-3" }, e0r = ["content", "aria-label"], t0r = { + key: 0, + class: "m-auto animate-spin spinner h-20 w-20" +}, i0r = { + key: 1, + xmlns: "http://www.w3.org/2000/svg", + fill: "none", + viewBox: "0 0 24 24", + "stroke-width": "1.5", + stroke: "green", + class: "m-auto w-20 h-20" +}, r0r = /* @__PURE__ */ Dt("path", { + "stroke-linecap": "round", + "stroke-linejoin": "round", + d: "M4.5 12.75l6 6 9-13.5" +}, null, -1), n0r = [ + r0r +], s0r = { + key: 2, + xmlns: "http://www.w3.org/2000/svg", + fill: "none", + viewBox: "0 0 24 24", + "stroke-width": "1.5", + stroke: "red", + class: "m-auto w-20 h-20" +}, o0r = /* @__PURE__ */ Dt("path", { + "stroke-linecap": "round", + "stroke-linejoin": "round", + d: "M6 18L18 6M6 6l12 12" +}, null, -1), a0r = [ + o0r +], l0r = ["innerHTML"], fot = /* @__PURE__ */ Kr({ + __name: "result-item", + props: { + uid: { type: String, required: !0 }, + data: { type: Object, required: !0 }, + open: { type: Boolean, required: !1 } + }, + setup(t) { + const e = t, i = i1(), r = Ys("iApi"), n = Si([]), s = D4(), { t: o } = Xn(), a = Si(""), l = Si("none"), c = Si(), h = () => i.getLayerByUid(e.uid), p = zr( + () => s.properties + ), y = zr( + () => s.defaultTemplates + ), v = zr(() => h()?.supportsFeatures ?? !1), x = zr(() => h()?.mapLayer ?? !1), I = zr(() => { + const re = h()?.nameField; + return re && e.data.loaded ? e.data.data[re] : r.$i18n.t("details.items.title"); + }), P = (re) => { + if (typeof re == "string") { + const he = "underline text-blue-600 break-all", fe = document.createElement("div"); + return fe.innerHTML = re.trim(), fe.firstElementChild?.tagName == "A" ? (fe.firstElementChild.className = he, fe.innerHTML) : v0e(re, { + className: he, + target: "_blank", + validate: { + url: (Se) => /^https?:\/\//.test(Se) + // only links that begin with a protocol will be hyperlinked + } + }); + } + return re; + }, F = () => { + X("none"), e.data.loaded ? k() : e.data.loading.then(() => { + F(); + }); + }, k = () => { + if (a.value = "", !(e.data && e.data.loaded)) + return; + const re = h(); + if (re === void 0) { + console.warn( + `could not find layer for uid ${e.uid} during icon lookup` + ); + return; + } + if (re.supportsFeatures) { + const he = re.oidField; + re.getIcon(e.data.data[he]).then((fe) => { + a.value = fe; + }); + } + }, V = zr(() => { + const re = h(); + return re && p.value[re.id] && p.value[re.id].template ? p.value[re.id].template : y.value && y.value[e.data.format] ? y.value[e.data.format] : v.value ? jyr : zyr; + }), j = zr(() => v.value ? h()?.fields || [] : []), Y = zr(() => { + const re = h(); + if (re && p.value[re.id] && p.value[re.id].fields) + return p.value[re.id].fields; + }), X = (re) => { + re === "zoomed" || re === "error" ? setTimeout(() => { + l.value = re, c.value?._tippy.show(), setTimeout(() => { + c.value?._tippy.hide(), l.value = "none"; + }, 3e3); + }, 300) : l.value = re; + }, Q = () => { + if (l.value !== "none") + return; + X("zooming"); + const re = h(); + if (re === void 0 || !re.isLoaded) { + console.warn( + `Could not find layer for uid ${e.uid} during zoom geometry lookup` + ), X("error"); + return; + } + if (!e.data.loaded) { + console.warn( + "Details zoomToFeature call on item that is still loading. Should be impossible, alert the devs." + ), X("error"); + return; + } + const he = e.data.data[re.oidField], fe = () => { + const be = { getGeom: !0 }; + re.getGraphic(he, be).then((Se) => { + Se.geometry.invalid() ? (console.error(`Could not find graphic for objectid ${he}`), X("error")) : (r.geo.map.zoomMapTo(Se.geometry), X("zoomed"), r.updateAlert(r.$i18n.t("details.item.alert.zoom"))); + }).catch(() => { + X("error"); + }); + }; + re.layerType === rn.FEATURE && re.geomType !== el.POINT ? re.getGraphicExtent(he).then((be) => { + r.geo.map.zoomMapTo(be), X("zoomed"), r.updateAlert(r.$i18n.t("details.item.alert.zoom")); + }).catch(() => { + fe(); + }) : fe(); + }; + return H0(() => { + n.value.push( + Fl( + e, + () => { + F(); + }, + { + deep: !1, + immediate: !0 + } + ) + ); + }), gl(() => { + n.value.forEach((re) => re()); + }), (re, he) => { + const fe = qn("tippy"); + return qt(), li(Ws, null, [ + Dt("div", Hyr, [ + t.data.loaded && v.value ? (qt(), li("div", Wyr, [ + Dt("div", qyr, [ + a.value ? (qt(), li("span", { + key: 0, + class: "flex-none symbologyIcon", + innerHTML: a.value + }, null, 8, Yyr)) : (qt(), li("div", Xyr, Jyr)) + ]), + Gr((qt(), li("span", { + class: "itemName pl-3 text-left flex-grow truncate", + content: I.value + }, [ + qs(vr(P(I.value)), 1) + ], 8, Zyr)), [ + [fe, { placement: "right" }] + ]), + Dt("span", Qyr, [ + x.value ? Gr((qt(), li("button", { + key: 0, + type: "button", + content: gi(o)( + `details.item.zoom${l.value === "none" ? "" : `.${l.value}`}` + ), + "aria-label": gi(o)( + `grid.cells.zoom${l.value === "none" ? "" : `.${l.value}`}` + ), + ref_key: "zoomButton", + ref: c, + onClick: he[0] || (he[0] = (be) => { + be.stopPropagation(), Q(); + }), + class: "text-gray-600 w-24 h-24 p-2" + }, [ + l.value === "zooming" ? (qt(), li("div", t0r)) : l.value === "zoomed" ? (qt(), li("svg", i0r, n0r)) : l.value === "error" ? (qt(), li("svg", s0r, a0r)) : (qt(), li("span", { + key: 3, + innerHTML: gi(r).ui.getZoomIcon() + }, null, 8, l0r)) + ], 8, e0r)), [ + [fe, { placement: "bottom" }] + ]) : Xr("", !0) + ]) + ])) : Xr("", !0) + ]), + t.open ? (qt(), In(t3(V.value), { + key: 0, + identifyData: t.data, + fields: j.value, + fixtureFields: Y.value, + class: "p-8" + }, null, 8, ["identifyData", "fields", "fixtureFields"])) : Xr("", !0) + ], 64); + }; + } +}); +var jDe = { name: "Toggle", emits: ["input", "update:modelValue", "change"], props: { value: { validator: function(t) { + return (e) => ["number", "string", "boolean"].indexOf(typeof e) !== -1 || e == null; +}, required: !1 }, modelValue: { validator: function(t) { + return (e) => ["number", "string", "boolean"].indexOf(typeof e) !== -1 || e == null; +}, required: !1 }, id: { type: [String, Number], required: !1, default: "toggle" }, name: { type: [String, Number], required: !1, default: "toggle" }, disabled: { type: Boolean, required: !1, default: !1 }, required: { type: Boolean, required: !1, default: !1 }, falseValue: { type: [String, Number, Boolean], required: !1, default: !1 }, trueValue: { type: [String, Number, Boolean], required: !1, default: !0 }, onLabel: { type: [String, Object], required: !1, default: "" }, offLabel: { type: [String, Object], required: !1, default: "" }, classes: { type: Object, required: !1, default: () => ({}) }, labelledby: { type: String, required: !1 }, describedby: { type: String, required: !1 }, aria: { required: !1, type: Object, default: () => ({}) } }, setup(t, e) { + const i = function(o, a, l) { + const { value: c, modelValue: h, falseValue: p, trueValue: y, disabled: v } = Qk(o), x = h && h.value !== void 0 ? h : c, I = zr(() => x.value === y.value), P = (V) => { + a.emit("input", V), a.emit("update:modelValue", V), a.emit("change", V); + }, F = () => { + P(y.value); + }, k = () => { + P(p.value); + }; + return [null, void 0, !1, 0, "0", "off"].indexOf(x.value) !== -1 && [p.value, y.value].indexOf(x.value) === -1 && k(), [!0, 1, "1", "on"].indexOf(x.value) !== -1 && [p.value, y.value].indexOf(x.value) === -1 && F(), { externalValue: x, checked: I, update: P, check: F, uncheck: k, handleInput: (V) => { + P(V.target.checked ? y.value : p.value); + }, handleClick: () => { + v.value || (I.value ? k() : F()); + } }; + }(t, e), r = function(o, a, l) { + const { trueValue: c, falseValue: h, onLabel: p, offLabel: y } = Qk(o), v = l.checked, x = l.update; + return { label: zr(() => { + let I = v.value ? p.value : y.value; + return I || (I = " "), I; + }), toggle: () => { + x(v.value ? h.value : c.value); + }, on: () => { + x(c.value); + }, off: () => { + x(h.value); + } }; + }(t, 0, { checked: i.checked, update: i.update }), n = function(o, a, l) { + const c = Qk(o), h = c.disabled, p = l.checked, y = zr(() => ({ container: "toggle-container", toggle: "toggle", toggleOn: "toggle-on", toggleOff: "toggle-off", toggleOnDisabled: "toggle-on-disabled", toggleOffDisabled: "toggle-off-disabled", handle: "toggle-handle", handleOn: "toggle-handle-on", handleOff: "toggle-handle-off", handleOnDisabled: "toggle-handle-on-disabled", handleOffDisabled: "toggle-handle-off-disabled", label: "toggle-label", ...c.classes.value })); + return { classList: zr(() => ({ container: y.value.container, toggle: [y.value.toggle, h.value ? p.value ? y.value.toggleOnDisabled : y.value.toggleOffDisabled : p.value ? y.value.toggleOn : y.value.toggleOff], handle: [y.value.handle, h.value ? p.value ? y.value.handleOnDisabled : y.value.handleOffDisabled : p.value ? y.value.handleOn : y.value.handleOff], label: y.value.label })) }; + }(t, 0, { checked: i.checked }), s = function(o, a, l) { + const { disabled: c } = Qk(o), h = l.check, p = l.uncheck, y = l.checked; + return { handleSpace: () => { + c.value || (y.value ? p() : h()); + } }; + }(t, 0, { check: i.check, uncheck: i.uncheck, checked: i.checked }); + return { ...i, ...n, ...r, ...s }; +} }; +const u0r = ["tabindex", "aria-checked", "aria-describedby", "aria-labelledby"], c0r = ["id", "name", "value", "checked", "disabled"], h0r = ["innerHTML"], d0r = ["checked"]; +jDe.render = function(t, e, i, r, n, s) { + return qt(), li("div", Pie({ class: t.classList.container, tabindex: i.disabled ? void 0 : 0, "aria-checked": t.checked, "aria-describedby": i.describedby, "aria-labelledby": i.labelledby, role: "switch" }, i.aria, { onKeypress: e[1] || (e[1] = Dh(Go((...o) => t.handleSpace && t.handleSpace(...o), ["prevent"]), ["space"])) }), [Gr(Dt("input", { type: "checkbox", id: i.id, name: i.name, value: i.trueValue, checked: t.checked, disabled: i.disabled }, null, 8, c0r), [[Rf, !1]]), Dt("div", { class: Gn(t.classList.toggle), onClick: e[0] || (e[0] = (...o) => t.handleClick && t.handleClick(...o)) }, [Dt("span", { class: Gn(t.classList.handle) }, null, 2), _m(t.$slots, "label", { checked: t.checked, classList: t.classList }, () => [Dt("span", { class: Gn(t.classList.label), innerHTML: t.label }, null, 10, h0r)]), i.required ? (qt(), li("input", { key: 0, type: "checkbox", style: { appearance: "none", height: "1px", margin: "0", padding: "0", fontSize: "0", background: "transparent", position: "absolute", width: "100%", bottom: "0", outline: "none" }, checked: t.checked, "aria-hidden": "true", tabindex: "-1", required: "" }, null, 8, d0r)) : Xr("v-if", !0)], 2)], 16, u0r); +}, jDe.__file = "src/Toggle.vue"; +const p0r = (t) => (Pc("data-v-ecf1417a"), t = t(), Oc(), t), f0r = { class: "flex flex-row rv-label" }, m0r = { class: "flex items-center" }, g0r = ["innerHTML"], y0r = /* @__PURE__ */ p0r(() => /* @__PURE__ */ Dt("div", { class: "flex-1" }, null, -1)), v0r = /* @__PURE__ */ Kr({ + __name: "toggle-switch-control", + props: { + config: { + type: Object, + required: !0 + }, + name: String, + icon: String + }, + emits: ["toggled"], + setup(t, { emit: e }) { + const i = t, r = Si(i.config.value), n = Si(!!i.config.disabled), s = Si(0), o = Dl([]); + o.push( + Fl( + kye(i, "config"), + (l, c) => { + r.value = l.value, n.value = !!l.disabled, s.value += n.value !== c.disabled ? 1 : 0; + }, + { deep: !0 } + ) + ); + const a = () => { + n.value || (r.value = !r.value, e("toggled", r.value)); + }; + return gl(() => { + o.forEach((l) => l()); + }), (l, c) => (qt(), li("div", f0r, [ + Dt("div", m0r, [ + Dt("div", { + innerHTML: t.icon, + class: "p-8 pl-0" + }, null, 8, g0r), + qs(" " + vr(t.name), 1) + ]), + y0r, + (qt(), In(gi(jDe), { + onChange: c[0] || (c[0] = (h) => e("toggled", h)), + onKeyupCapture: [ + Dh(Go(a, ["stop"]), ["enter"]), + Dh(Go(a, ["stop"]), ["space"]) + ], + disabled: n.value, + key: s.value, + modelValue: r.value, + "onUpdate:modelValue": c[1] || (c[1] = (h) => r.value = h), + classes: { + container: "inline-block rounded-full outline-none focus:ring focus:ring-blue-500 focus:ring-opacity-30", + toggle: "flex w-40 h-15 rounded-full relative cursor-pointer transition items-center box-content border-2 text-xs leading-none", + toggleOn: "bg-blue-500 border-blue-500 justify-start text-white", + toggleOff: "bg-gray-200 border-gray-200 justify-end text-gray-700", + toggleOnDisabled: "bg-gray-300 border-gray-300 justify-start text-gray-400 cursor-not-allowed", + toggleOffDisabled: "bg-gray-200 border-gray-200 justify-end text-gray-400 cursor-not-allowed", + handle: "inline-block bg-white w-15 h-15 top-0 rounded-full absolute transition-all", + handleOn: "left-full transform -translate-x-full", + handleOff: "left-0", + handleOnDisabled: "bg-gray-100 left-full transform -translate-x-full", + handleOffDisabled: "bg-gray-100 left-0", + label: "text-center w-8 border-box whitespace-nowrap select-none" + } + }, null, 8, ["onKeyupCapture", "disabled", "modelValue"])) + ])); + } +}); +const UFt = /* @__PURE__ */ ol(v0r, [["__scopeId", "data-v-ecf1417a"]]), nBe = (t) => (Pc("data-v-fbb74ffd"), t = t(), Oc(), t), _0r = { + key: 0, + class: "layerName w-full flex-grow p-5 pb-8 font-bold truncate" +}, b0r = { + key: 1, + class: "p-8 mb-8 bg-gray-100 flex justify-between" +}, w0r = { for: "toggle" }, x0r = { + key: 2, + class: "flex flex-col justify-between p-8 mb-8 bg-gray-100" +}, S0r = { class: "flex justify-between" }, C0r = ["aria-label"], T0r = { class: "flex bg-gray-200 py-8 items-center" }, E0r = ["content", "aria-label", "disabled"], I0r = /* @__PURE__ */ nBe(() => /* @__PURE__ */ Dt("svg", { + height: "24", + width: "24", + viewBox: "0 0 23 23" +}, [ + /* @__PURE__ */ Dt("g", null, [ + /* @__PURE__ */ Dt("path", { d: "M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z" }) + ]) +], -1)), A0r = [ + I0r +], P0r = { class: "px-8" }, O0r = ["content", "aria-label", "disabled"], R0r = /* @__PURE__ */ nBe(() => /* @__PURE__ */ Dt("svg", { + height: "24", + width: "24", + viewBox: "0 0 23 23" +}, [ + /* @__PURE__ */ Dt("g", null, [ + /* @__PURE__ */ Dt("path", { d: "M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z" }) + ]) +], -1)), M0r = [ + R0r +], D0r = { key: 3 }, F0r = { key: 0 }, L0r = { + key: 0, + class: "flex flex-col" +}, N0r = ["onClick"], k0r = { + key: 1, + class: "ml-42 text-center" +}, $0r = { + key: 4, + class: "p-5" +}, B0r = /* @__PURE__ */ nBe(() => /* @__PURE__ */ Dt("span", { class: "animate-spin spinner h-20 w-20 px-5 mr-8" }, null, -1)), V0r = /* @__PURE__ */ Kr({ + __name: "result-list", + props: { + uid: { type: String, required: !0 }, + results: { type: Object, required: !0 } + }, + setup(t) { + const e = t, i = Ys("iApi"), r = D4(), n = i1(), { t: s } = Xn(), o = Si(!1), a = Si(i.fixture.get("details")), l = Si(!0), c = Si(!1), h = Si(0), p = Si([]), y = Si([]), v = zr(() => r.activeGreedy), x = zr( + () => r.properties + ), I = () => n.getLayerByUid(e.uid), P = zr(() => e.results.find((ce) => ce.uid === e.uid)?.loaded ?? !1), F = zr(() => I()?.supportsFeatures ?? !1), k = zr(() => e.results.find((ce) => ce.uid === e.uid)?.requestTime), V = zr(() => { + const J = I(); + return J && x.value[J.id] && x.value[J.id].name ? x.value[J.id].name : J?.name ?? ""; + }), j = () => { + const J = e.results.find((ce) => ce.uid === e.uid); + return J ? J.items : []; + }, Y = zr(() => j()[h.value]), X = zr(() => I()?.mapLayer ?? !1), Q = (J) => { + l.value = J, a.value.onHilightToggle( + J, + c.value ? j() : j()[h.value], + e.uid + ); + }, re = () => { + const J = i.geo.layer.getLayer(e.uid); + h.value = h.value ?? 0, l.value = r.hilightToggle ?? l.value, c.value = !1, o.value = !!J, fe(); + }, he = (J) => { + h.value += J; + }, fe = () => { + if (Y.value) + if (P.value && Y.value.loaded) + l.value && F.value && X.value ? a.value.hilightDetailsItems( + c.value ? j() : j()[h.value], + e.uid + ) : (!F.value || !X.value) && a.value.removeDetailsHilight(); + else { + const J = h.value; + Y.value.loading.then(() => { + J === h.value && fe(); + }); + } + }, be = () => { + c.value = !0, fe(); + }, Se = () => { + a.value.removeDetailsHilight(), r.hilightToggle = !0; + }, Me = () => { + a.value.removeDetailsHilight(); + }, ke = (J) => { + h.value = J, c.value = !1; + }; + return sl(() => { + p.value.push( + i.event.on( + an.LAYER_REMOVE, + (J) => { + const ce = i.panel.get("details-panel"); + e.uid === J.uid && ce && ce.close(); + } + ) + ), p.value.push( + i.event.on(an.PANEL_CLOSED, (J) => { + J.id == "details-panel" && Se(); + }) + ), p.value.push( + i.event.on(an.PANEL_MINIMIZED, (J) => { + J.id == "details-panel" && Me(); + }) + ), p.value.push( + i.event.on(an.MAP_BASEMAPCHANGE, () => { + l.value && a.value.reloadDetailsHilight( + c.value ? j() : j()[h.value], + e.uid + ); + }) + ); + }), H0(() => { + y.value.push( + Fl( + Y, + () => { + re(), Y.value === void 0 && a.value.removeDetailsHilight(); + }, + { + deep: !1, + immediate: !0 + } + ) + ), y.value.push( + Fl(k, () => { + h.value = 0; + }) + ), y.value.push( + Fl( + () => e.uid, + () => { + h.value = 0; + } + ) + ); + }), gl(() => { + y.value.forEach((J) => J()), p.value.forEach((J) => i.event.off(J)); + }), (J, ce) => { + const xe = qn("tippy"), Pe = qn("focus-item"), Oe = qn("focus-list"); + return P.value && v.value === 0 ? (qt(), li("div", { + key: 0, + class: "detailsContent relative flex flex-col flex-grow pl-5", + style: $v(t.results.length > 1 ? { "margin-left": "42px" } : "") + }, [ + o.value ? (qt(), li("h1", _0r, vr(V.value), 1)) : Xr("", !0), + a.value.hasHilighter() && F.value && X.value ? (qt(), li("div", b0r, [ + Dt("label", w0r, vr(gi(s)("details.togglehilight.title")), 1), + Dn(UFt, { + config: { + value: l.value, + disabled: !1 + }, + onToggled: Q + }, null, 8, ["config"]) + ])) : Xr("", !0), + o.value && j().length > 1 && !c.value ? (qt(), li("div", x0r, [ + Dt("div", S0r, [ + Dt("button", { + type: "button", + class: "px-8 font-bold hover:bg-gray-200 focus:bg-gray-200", + "aria-label": gi(s)("details.item.see.list"), + onClick: ce[0] || (ce[0] = (Re) => be()) + }, vr(gi(s)("details.item.see.list")), 9, C0r), + Dt("div", T0r, [ + Gr((qt(), li("button", { + type: "button", + content: gi(s)("details.item.previous.item"), + onClick: ce[1] || (ce[1] = (Re) => he(-1)), + class: "mx-2 opacity-60 hover:opacity-90 disabled:opacity-30 disabled:cursor-default", + "aria-label": gi(s)("details.item.previous.item"), + disabled: h.value === 0 + }, A0r, 8, E0r)), [ + [xe, { placement: "top" }] + ]), + Dt("span", P0r, vr(gi(s)("details.item.count", [ + h.value + 1, + j().length + ])), 1), + Gr((qt(), li("button", { + type: "button", + content: gi(s)("details.item.next.item"), + onClick: ce[2] || (ce[2] = (Re) => he(1)), + class: "mx-2 rotate-180 opacity-60 hover:opacity-90 disabled:opacity-30 disabled:cursor-default", + "aria-label": gi(s)("details.item.next.item"), + disabled: h.value === j().length - 1 + }, M0r, 8, O0r)), [ + [xe, { placement: "top" }] + ]) + ]) + ]) + ])) : Xr("", !0), + o.value ? (qt(), li("div", D0r, [ + j().length > 0 ? (qt(), li("div", F0r, [ + c.value ? Gr((qt(), li("div", L0r, [ + (qt(!0), li(Ws, null, nu(j(), (Re, Ge) => Gr((qt(), li("button", { + class: "flex flex-grow truncate default-focus-style hover:bg-gray-200", + key: Ge, + onClick: (je) => ke(Ge) + }, [ + Dn(fot, { + data: Re, + uid: t.uid, + open: !1 + }, null, 8, ["data", "uid"]) + ], 8, N0r)), [ + [Pe] + ])), 128)) + ])), [ + [Oe] + ]) : (qt(), In(fot, { + key: 1, + data: Y.value, + uid: t.uid, + open: !0 + }, null, 8, ["data", "uid"])) + ])) : (qt(), li("div", k0r, vr(gi(s)("details.layers.results.empty")), 1)) + ])) : (qt(), li("div", $0r, vr(gi(s)("details.item.no.data")), 1)) + ], 4)) : (qt(), li("div", { + key: 1, + class: Gn(["flex justify-center py-10 items-center", t.results.length > 1 ? "ml-42" : ""]) + }, [ + B0r, + qs(" " + vr(gi(s)("details.item.loading")), 1) + ], 2)); + }; + } +}); +const j0r = /* @__PURE__ */ ol(V0r, [["__scopeId", "data-v-fbb74ffd"]]), G0r = { class: "relative h-full" }, U0r = { class: "detailsContentSection overflow-y-auto h-full" }, z0r = { + key: 1, + class: "ml-42 text-center" +}, H0r = /* @__PURE__ */ Kr({ + __name: "details-screen", + props: { + panel: { + type: Object + } + }, + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = D4(), n = Si([]), s = Si([]), o = Si([]), a = Si(!1), l = Si(""), c = Si(!1), h = zr(() => r.activeGreedy), p = zr(() => r.payload), y = zr( + () => r.properties + ), v = (F) => { + l.value = F, c.value = !0; + }, x = (F) => { + if (F === void 0) + return; + const k = F.length === 0 ? 0 : F[0].requestTime; + r.activeGreedy = k, r.slowLoadingFlag = !1, o.value = F, I(F); + }, I = (F) => { + if (c.value) { + const k = o.value.findIndex( + (V) => V.uid === l.value + ); + if (k !== -1) { + const V = o.value[k]; + V.loading.then(() => { + V.requestTime === h.value && (V.items.length > 0 ? (r.activeGreedy = 0, c.value = !1, a.value = !1) : P(F)); + }); + } else + P(F); + } else + P(F); + setTimeout(() => { + h.value !== 0 && F[0].requestTime === h.value && (r.slowLoadingFlag = !0); + }, 500); + }, P = (F) => { + const k = F.map( + (j) => j.loading.then( + () => j.items.length > 0 ? Promise.resolve(j) : Promise.reject() + ) + ), V = F.length === 0 ? 0 : F[0].requestTime; + Promise.any(k).then((j) => { + if (j.requestTime !== h.value) + return; + const Y = o.value.find( + (X) => X.uid === j.uid + ); + r.activeGreedy = 0, Y !== void 0 && (l.value = Y.uid, a.value = !1); + }).catch(() => { + V === h.value && (r.activeGreedy = 0, a.value = !0); + }); + }; + return H0(() => { + s.value.push( + Fl( + p, + (F) => { + x(F); + }, + { + deep: !1, + // was true when our array had undefineds. now that objects arrive intact, we dont want this triggering when innards update + immediate: !0 + } + ) + ), s.value.push( + Fl(h, (F) => { + F === 0 && (r.slowLoadingFlag = !1); + }) + ); + }), gl(() => { + n.value.forEach((F) => i.event.off(F)), s.value.forEach((F) => F()); + }), (F, k) => { + const V = Bo("panel-screen"); + return qt(), In(V, { panel: t.panel }, { + header: Sn(() => [ + qs(vr(gi(e)("details.layers.title")), 1) + ]), + content: Sn(() => [ + Dt("div", G0r, [ + o.value.length > 1 ? (qt(), In(kyr, { + key: 0, + results: o.value, + detailsProperties: y.value, + selected: l.value, + onSelectionChanged: v + }, null, 8, ["results", "detailsProperties", "selected"])) : Xr("", !0), + Dt("div", U0r, [ + a.value ? (qt(), li("div", z0r, vr(gi(e)("details.layers.results.empty")), 1)) : (qt(), In(j0r, { + key: 0, + uid: l.value, + results: o.value + }, null, 8, ["uid", "results"])) + ]) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}); +const W0r = /* @__PURE__ */ ol(H0r, [["__scopeId", "data-v-cba1a81a"]]), q0r = { en: { "details.layers.title": "Identified Layers", "details.layers.found": "Found {numResults} results in {numLayers} layers", "details.layers.loading": "The layer is loading...", "details.layers.error": "Error", "details.layers.results.empty": "No results found for the selected layer.", "details.result.default.name": "Identify Item {0}", "details.items.title": "Details", "details.item.see.list": "See List", "details.item.zoom": "Zoom to feature", "details.item.zoom.zooming": "Zooming...", "details.item.zoom.error": "Zoom failed", "details.item.zoom.zoomed": "Zoomed", "details.item.previous.item": "Previous item", "details.item.next.item": "Next item", "details.item.count": "{0} of {1}", "details.item.loading": "Loading results...", "details.item.no.data": "No data to show because the layer has been removed", "details.item.alert.zoom": "Zoomed into feature", "details.item.alert.show.item": "Showing result {itemName}", "details.item.alert.show.list": "Showing all results for {layerName}", "details.item.alert.defaultAltText": "Image associated with {alias} field", "details.togglehilight.title": "Toggle Highlight", "details.item.open": "Expand", "details.item.collapse": "Collapse" }, fr: { "details.layers.title": "Couches désignées", "details.layers.found": "{numResults} résultats trouvés dans {numLayers} couches", "details.layers.loading": "La couche est en cours de chargement...", "details.layers.error": "Erreur", "details.layers.results.empty": "Aucun résultat trouvé pour la couche sélectionnée.", "details.result.default.name": "Désigner l'élément {0}", "details.items.title": "Détails", "details.item.see.list": "Voir la liste", "details.item.zoom": "Zoom à l'élément", "details.item.zoom.zooming": "Zoom...", "details.item.zoom.error": "Échec du zoom", "details.item.zoom.zoomed": "Zoomé", "details.item.previous.item": "Élément précédent", "details.item.next.item": "Élément suivant", "details.item.count": "{0} de {1}", "details.item.loading": "Chargement des résultats...", "details.item.no.data": "Aucune donnée à afficher", "details.item.alert.zoom": "Zoom sur la caractéristique", "details.item.alert.show.item": "Affichage du résultat {itemName}", "details.item.alert.show.list": "Affichage de tous les résultats pour {layerName}", "details.item.alert.defaultAltText": "Image associée au champ {alias}", "details.togglehilight.title": "Basculer vers l'élément principal", "details.item.open": "Développer", "details.item.collapse": "Réduire" } }; +class Y0r extends gyr { + async added() { + this.$iApi.panel.register( + { + "details-panel": { + screens: { + "details-screen": ya(W0r) + }, + style: { + width: "425px" + }, + button: { + tooltip: "details.items.title", + // https://fonts.google.com/icons?selected=Material%20Icons%3Aarticle%3A + icon: '' + }, + alertName: "details.items.title" + } + }, + { i18n: { messages: q0r } } + ), this._parseConfig(this.config); + const e = this.$vApp.$watch( + () => this.config, + (i) => this._parseConfig(i) + ); + this.removed = () => { + e(), this.$iApi.panel.remove("details-panel"), this.$iApi.fixture.get("appbar") && Bg(this.$vApp.$pinia).removeButton("details-panel"), D4(this.$vApp.$pinia).$reset(); + }; + } +} +const X0r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Y0r +}, Symbol.toStringTag, { value: "Module" })); +var Oh = {}; +const K0r = {}, J0r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: K0r +}, Symbol.toStringTag, { value: "Module" })), Y2e = /* @__PURE__ */ xye(J0r); +(function(t) { + /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */ + var e = e || { version: "5.3.0" }; + if (t.fabric = e, typeof document < "u" && typeof window < "u") + document instanceof (typeof HTMLDocument < "u" ? HTMLDocument : Document) ? e.document = document : e.document = document.implementation.createHTMLDocument(""), e.window = window; + else { + var i = Y2e, r = new i.JSDOM( + decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"), + { + features: { + FetchExternalResources: ["img"] + }, + resources: "usable" + } + ).window; + e.document = r.document, e.jsdomImplForWrapper = Y2e.implForWrapper, e.nodeCanvas = Y2e.Canvas, e.window = r, DOMParser = e.window.DOMParser; + } + e.isTouchSupported = "ontouchstart" in e.window || "ontouchstart" in e.document || e.window && e.window.navigator && e.window.navigator.maxTouchPoints > 0, e.isLikelyNode = typeof Buffer < "u" && typeof window > "u", e.SHARED_ATTRIBUTES = [ + "display", + "transform", + "fill", + "fill-opacity", + "fill-rule", + "opacity", + "stroke", + "stroke-dasharray", + "stroke-linecap", + "stroke-dashoffset", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + "id", + "paint-order", + "vector-effect", + "instantiated_by_use", + "clip-path" + ], e.DPI = 96, e.reNum = "(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)", e.commaWsp = "(?:\\s+,?\\s*|,\\s*)", e.rePathCommand = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig, e.reNonWord = /[ \n\.,;!\?\-]/, e.fontPaths = {}, e.iMatrix = [1, 0, 0, 1, 0, 0], e.svgNS = "http://www.w3.org/2000/svg", e.perfLimitSizeTotal = 2097152, e.maxCacheSideLimit = 4096, e.minCacheSideLimit = 256, e.charWidthsCache = {}, e.textureSize = 2048, e.disableStyleCopyPaste = !1, e.enableGLFiltering = !0, e.devicePixelRatio = e.window.devicePixelRatio || e.window.webkitDevicePixelRatio || e.window.mozDevicePixelRatio || 1, e.browserShadowBlurConstant = 1, e.arcToSegmentsCache = {}, e.boundsOfCurveCache = {}, e.cachesBoundsOfCurve = !0, e.forceGLPutImageData = !1, e.initFilterBackend = function() { + if (e.enableGLFiltering && e.isWebglSupported && e.isWebglSupported(e.textureSize)) + return console.log("max texture size: " + e.maxTextureSize), new e.WebglFilterBackend({ tileSize: e.textureSize }); + if (e.Canvas2dFilterBackend) + return new e.Canvas2dFilterBackend(); + }, typeof document < "u" && typeof window < "u" && (window.fabric = e), function() { + function a(v, x) { + if (this.__eventListeners[v]) { + var I = this.__eventListeners[v]; + x ? I[I.indexOf(x)] = !1 : e.util.array.fill(I, !1); + } + } + function l(v, x) { + if (this.__eventListeners || (this.__eventListeners = {}), arguments.length === 1) + for (var I in v) + this.on(I, v[I]); + else + this.__eventListeners[v] || (this.__eventListeners[v] = []), this.__eventListeners[v].push(x); + return this; + } + function c(v, x) { + var I = function() { + x.apply(this, arguments), this.off(v, I); + }.bind(this); + this.on(v, I); + } + function h(v, x) { + if (arguments.length === 1) + for (var I in v) + c.call(this, I, v[I]); + else + c.call(this, v, x); + return this; + } + function p(v, x) { + if (!this.__eventListeners) + return this; + if (arguments.length === 0) + for (v in this.__eventListeners) + a.call(this, v); + else if (arguments.length === 1 && typeof arguments[0] == "object") + for (var I in v) + a.call(this, I, v[I]); + else + a.call(this, v, x); + return this; + } + function y(v, x) { + if (!this.__eventListeners) + return this; + var I = this.__eventListeners[v]; + if (!I) + return this; + for (var P = 0, F = I.length; P < F; P++) + I[P] && I[P].call(this, x || {}); + return this.__eventListeners[v] = I.filter(function(k) { + return k !== !1; + }), this; + } + e.Observable = { + fire: y, + on: l, + once: h, + off: p + }; + }(), e.Collection = { + _objects: [], + /** + * Adds objects to collection, Canvas or Group, then renders canvas + * (if `renderOnAddRemove` is not `false`). + * in case of Group no changes to bounding box are made. + * Objects should be instances of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the add method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + add: function() { + if (this._objects.push.apply(this._objects, arguments), this._onObjectAdded) + for (var a = 0, l = arguments.length; a < l; a++) + this._onObjectAdded(arguments[a]); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the insertAt method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ + insertAt: function(a, l, c) { + var h = this._objects; + return c ? h[l] = a : h.splice(l, 0, a), this._onObjectAdded && this._onObjectAdded(a), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove: function() { + for (var a = this._objects, l, c = !1, h = 0, p = arguments.length; h < p; h++) + l = a.indexOf(arguments[h]), l !== -1 && (c = !0, a.splice(l, 1), this._onObjectRemoved && this._onObjectRemoved(arguments[h])); + return this.renderOnAddRemove && c && this.requestRenderAll(), this; + }, + /** + * Executes given function for each object in this group + * @param {Function} callback + * Callback invoked with current object as first argument, + * index - as second and an array of all objects - as third. + * Callback is invoked in a context of Global Object (e.g. `window`) + * when no `context` argument is given + * + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + * @chainable + */ + forEachObject: function(a, l) { + for (var c = this.getObjects(), h = 0, p = c.length; h < p; h++) + a.call(l, c[h], h, c); + return this; + }, + /** + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * since 2.3.5 this method return always a COPY of the array; + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ + getObjects: function(a) { + return typeof a > "u" ? this._objects.concat() : this._objects.filter(function(l) { + return l.type === a; + }); + }, + /** + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ + item: function(a) { + return this._objects[a]; + }, + /** + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ + isEmpty: function() { + return this._objects.length === 0; + }, + /** + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ + size: function() { + return this._objects.length; + }, + /** + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @param {Boolean} [deep=false] `true` to check all descendants, `false` to check only `_objects` + * @return {Boolean} `true` if collection contains an object + */ + contains: function(a, l) { + return this._objects.indexOf(a) > -1 ? !0 : l ? this._objects.some(function(c) { + return typeof c.contains == "function" && c.contains(a, !0); + }) : !1; + }, + /** + * Returns number representation of a collection complexity + * @return {Number} complexity + */ + complexity: function() { + return this._objects.reduce(function(a, l) { + return a += l.complexity ? l.complexity() : 0, a; + }, 0); + } + }, e.CommonMethods = { + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ + _setOptions: function(a) { + for (var l in a) + this.set(l, a[l]); + }, + /** + * @private + * @param {Object} [filler] Options object + * @param {String} [property] property to set the Gradient to + */ + _initGradient: function(a, l) { + a && a.colorStops && !(a instanceof e.Gradient) && this.set(l, new e.Gradient(a)); + }, + /** + * @private + * @param {Object} [filler] Options object + * @param {String} [property] property to set the Pattern to + * @param {Function} [callback] callback to invoke after pattern load + */ + _initPattern: function(a, l, c) { + a && a.source && !(a instanceof e.Pattern) ? this.set(l, new e.Pattern(a, c)) : c && c(); + }, + /** + * @private + */ + _setObject: function(a) { + for (var l in a) + this._set(l, a[l]); + }, + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + * @return {fabric.Object} thisArg + * @chainable + */ + set: function(a, l) { + return typeof a == "object" ? this._setObject(a) : this._set(a, l), this; + }, + _set: function(a, l) { + this[a] = l; + }, + /** + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + * @return {fabric.Object} thisArg + * @chainable + */ + toggle: function(a) { + var l = this.get(a); + return typeof l == "boolean" && this.set(a, !l), this; + }, + /** + * Basic getter + * @param {String} property Property name + * @return {*} value of a property + */ + get: function(a) { + return this[a]; + } + }, function(a) { + var l = Math.sqrt, c = Math.atan2, h = Math.pow, p = Math.PI / 180, y = Math.PI / 2; + e.util = { + /** + * Calculate the cos of an angle, avoiding returning floats for known results + * @static + * @memberOf fabric.util + * @param {Number} angle the angle in radians or in degree + * @return {Number} + */ + cos: function(v) { + if (v === 0) + return 1; + v < 0 && (v = -v); + var x = v / y; + switch (x) { + case 1: + case 3: + return 0; + case 2: + return -1; + } + return Math.cos(v); + }, + /** + * Calculate the sin of an angle, avoiding returning floats for known results + * @static + * @memberOf fabric.util + * @param {Number} angle the angle in radians or in degree + * @return {Number} + */ + sin: function(v) { + if (v === 0) + return 0; + var x = v / y, I = 1; + switch (v < 0 && (I = -1), x) { + case 1: + return I; + case 2: + return 0; + case 3: + return -I; + } + return Math.sin(v); + }, + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @static + * @memberOf fabric.util + * @param {Array} array + * @param {*} value + * @return {Array} original array + */ + removeFromArray: function(v, x) { + var I = v.indexOf(x); + return I !== -1 && v.splice(I, 1), v; + }, + /** + * Returns random number between 2 specified ones. + * @static + * @memberOf fabric.util + * @param {Number} min lower limit + * @param {Number} max upper limit + * @return {Number} random value (between min and max) + */ + getRandomInt: function(v, x) { + return Math.floor(Math.random() * (x - v + 1)) + v; + }, + /** + * Transforms degrees to radians. + * @static + * @memberOf fabric.util + * @param {Number} degrees value in degrees + * @return {Number} value in radians + */ + degreesToRadians: function(v) { + return v * p; + }, + /** + * Transforms radians to degrees. + * @static + * @memberOf fabric.util + * @param {Number} radians value in radians + * @return {Number} value in degrees + */ + radiansToDegrees: function(v) { + return v / p; + }, + /** + * Rotates `point` around `origin` with `radians` + * @static + * @memberOf fabric.util + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + * @return {fabric.Point} The new rotated point + */ + rotatePoint: function(v, x, I) { + var P = new e.Point(v.x - x.x, v.y - x.y), F = e.util.rotateVector(P, I); + return new e.Point(F.x, F.y).addEquals(x); + }, + /** + * Rotates `vector` with `radians` + * @static + * @memberOf fabric.util + * @param {Object} vector The vector to rotate (x and y) + * @param {Number} radians The radians of the angle for the rotation + * @return {Object} The new rotated point + */ + rotateVector: function(v, x) { + var I = e.util.sin(x), P = e.util.cos(x), F = v.x * P - v.y * I, k = v.x * I + v.y * P; + return { + x: F, + y: k + }; + }, + /** + * Creates a vetor from points represented as a point + * @static + * @memberOf fabric.util + * + * @typedef {Object} Point + * @property {number} x + * @property {number} y + * + * @param {Point} from + * @param {Point} to + * @returns {Point} vector + */ + createVector: function(v, x) { + return new e.Point(x.x - v.x, x.y - v.y); + }, + /** + * Calculates angle between 2 vectors using dot product + * @static + * @memberOf fabric.util + * @param {Point} a + * @param {Point} b + * @returns the angle in radian between the vectors + */ + calcAngleBetweenVectors: function(v, x) { + return Math.acos((v.x * x.x + v.y * x.y) / (Math.hypot(v.x, v.y) * Math.hypot(x.x, x.y))); + }, + /** + * @static + * @memberOf fabric.util + * @param {Point} v + * @returns {Point} vector representing the unit vector of pointing to the direction of `v` + */ + getHatVector: function(v) { + return new e.Point(v.x, v.y).multiply(1 / Math.hypot(v.x, v.y)); + }, + /** + * @static + * @memberOf fabric.util + * @param {Point} A + * @param {Point} B + * @param {Point} C + * @returns {{ vector: Point, angle: number }} vector representing the bisector of A and A's angle + */ + getBisector: function(v, x, I) { + var P = e.util.createVector(v, x), F = e.util.createVector(v, I), k = e.util.calcAngleBetweenVectors(P, F), V = e.util.calcAngleBetweenVectors(e.util.rotateVector(P, k), F), j = k * (V === 0 ? 1 : -1) / 2; + return { + vector: e.util.getHatVector(e.util.rotateVector(P, j)), + angle: k + }; + }, + /** + * Project stroke width on points returning 2 projections for each point as follows: + * - `miter`: 2 points corresponding to the outer boundary and the inner boundary of stroke. + * - `bevel`: 2 points corresponding to the bevel boundaries, tangent to the bisector. + * - `round`: same as `bevel` + * Used to calculate object's bounding box + * @static + * @memberOf fabric.util + * @param {Point[]} points + * @param {Object} options + * @param {number} options.strokeWidth + * @param {'miter'|'bevel'|'round'} options.strokeLineJoin + * @param {number} options.strokeMiterLimit https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit + * @param {boolean} options.strokeUniform + * @param {number} options.scaleX + * @param {number} options.scaleY + * @param {boolean} [openPath] whether the shape is open or not, affects the calculations of the first and last points + * @returns {fabric.Point[]} array of size 2n/4n of all suspected points + */ + projectStrokeOnPoints: function(v, x, I) { + var P = [], F = x.strokeWidth / 2, k = x.strokeUniform ? new e.Point(1 / x.scaleX, 1 / x.scaleY) : new e.Point(1, 1), V = function(j) { + var Y = F / Math.hypot(j.x, j.y); + return new e.Point(j.x * Y * k.x, j.y * Y * k.y); + }; + return v.length <= 1 || v.forEach(function(j, Y) { + var X = new e.Point(j.x, j.y), Q, re; + Y === 0 ? (re = v[Y + 1], Q = I ? V(e.util.createVector(re, X)).addEquals(X) : v[v.length - 1]) : Y === v.length - 1 ? (Q = v[Y - 1], re = I ? V(e.util.createVector(Q, X)).addEquals(X) : v[0]) : (Q = v[Y - 1], re = v[Y + 1]); + var he = e.util.getBisector(X, Q, re), fe = he.vector, be = he.angle, Se, Me; + if (x.strokeLineJoin === "miter" && (Se = -F / Math.sin(be / 2), Me = new e.Point( + fe.x * Se * k.x, + fe.y * Se * k.y + ), Math.hypot(Me.x, Me.y) / F <= x.strokeMiterLimit)) { + P.push(X.add(Me)), P.push(X.subtract(Me)); + return; + } + Se = -F * Math.SQRT2, Me = new e.Point( + fe.x * Se * k.x, + fe.y * Se * k.y + ), P.push(X.add(Me)), P.push(X.subtract(Me)); + }), P; + }, + /** + * Apply transform t to point p + * @static + * @memberOf fabric.util + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + * @return {fabric.Point} The transformed point + */ + transformPoint: function(v, x, I) { + return I ? new e.Point( + x[0] * v.x + x[2] * v.y, + x[1] * v.x + x[3] * v.y + ) : new e.Point( + x[0] * v.x + x[2] * v.y + x[4], + x[1] * v.x + x[3] * v.y + x[5] + ); + }, + /** + * Returns coordinates of points's bounding rectangle (left, top, width, height) + * @param {Array} points 4 points array + * @param {Array} [transform] an array of 6 numbers representing a 2x3 transform matrix + * @return {Object} Object with left, top, width, height properties + */ + makeBoundingBoxFromPoints: function(v, x) { + if (x) + for (var I = 0; I < v.length; I++) + v[I] = e.util.transformPoint(v[I], x); + var P = [v[0].x, v[1].x, v[2].x, v[3].x], F = e.util.array.min(P), k = e.util.array.max(P), V = k - F, j = [v[0].y, v[1].y, v[2].y, v[3].y], Y = e.util.array.min(j), X = e.util.array.max(j), Q = X - Y; + return { + left: F, + top: Y, + width: V, + height: Q + }; + }, + /** + * Invert transformation t + * @static + * @memberOf fabric.util + * @param {Array} t The transform + * @return {Array} The inverted transform + */ + invertTransform: function(v) { + var x = 1 / (v[0] * v[3] - v[1] * v[2]), I = [x * v[3], -x * v[1], -x * v[2], x * v[0]], P = e.util.transformPoint({ x: v[4], y: v[5] }, I, !0); + return I[4] = -P.x, I[5] = -P.y, I; + }, + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @static + * @memberOf fabric.util + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + * @return {Number} + */ + toFixed: function(v, x) { + return parseFloat(Number(v).toFixed(x)); + }, + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + * @param {Number} fontSize + * @return {Number|String} + */ + parseUnit: function(v, x) { + var I = /\D{0,2}$/.exec(v), P = parseFloat(v); + switch (x || (x = e.Text.DEFAULT_SVG_FONT_SIZE), I[0]) { + case "mm": + return P * e.DPI / 25.4; + case "cm": + return P * e.DPI / 2.54; + case "in": + return P * e.DPI; + case "pt": + return P * e.DPI / 72; + case "pc": + return P * e.DPI / 72 * 12; + case "em": + return P * x; + default: + return P; + } + }, + /** + * Function which always returns `false`. + * @static + * @memberOf fabric.util + * @return {Boolean} + */ + falseFunction: function() { + return !1; + }, + /** + * Returns klass "Class" object of given namespace + * @memberOf fabric.util + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + * @return {Object} klass "Class" + */ + getKlass: function(v, x) { + return v = e.util.string.camelize(v.charAt(0).toUpperCase() + v.slice(1)), e.util.resolveNamespace(x)[v]; + }, + /** + * Returns array of attributes for given svg that fabric parses + * @memberOf fabric.util + * @param {String} type Type of svg element (eg. 'circle') + * @return {Array} string names of supported attributes + */ + getSvgAttributes: function(v) { + var x = [ + "instantiated_by_use", + "style", + "id", + "class" + ]; + switch (v) { + case "linearGradient": + x = x.concat(["x1", "y1", "x2", "y2", "gradientUnits", "gradientTransform"]); + break; + case "radialGradient": + x = x.concat(["gradientUnits", "gradientTransform", "cx", "cy", "r", "fx", "fy", "fr"]); + break; + case "stop": + x = x.concat(["offset", "stop-color", "stop-opacity"]); + break; + } + return x; + }, + /** + * Returns object of given namespace + * @memberOf fabric.util + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + * @return {Object} Object for given namespace (default fabric) + */ + resolveNamespace: function(v) { + if (!v) + return e; + var x = v.split("."), I = x.length, P, F = a || e.window; + for (P = 0; P < I; ++P) + F = F[x[P]]; + return F; + }, + /** + * Loads image element from given url and passes it to a callback + * @memberOf fabric.util + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {*} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage: function(v, x, I, P) { + if (!v) { + x && x.call(I, v); + return; + } + var F = e.util.createImage(), k = function() { + x && x.call(I, F, !1), F = F.onload = F.onerror = null; + }; + F.onload = k, F.onerror = function() { + e.log("Error loading " + F.src), x && x.call(I, null, !0), F = F.onload = F.onerror = null; + }, v.indexOf("data") !== 0 && P !== void 0 && P !== null && (F.crossOrigin = P), v.substring(0, 14) === "data:image/svg" && (F.onload = null, e.util.loadImageInDom(F, k)), F.src = v; + }, + /** + * Attaches SVG image with data: URL to the dom + * @memberOf fabric.util + * @param {Object} img Image object with data:image/svg src + * @param {Function} callback Callback; invoked with loaded image + * @return {Object} DOM element (div containing the SVG image) + */ + loadImageInDom: function(v, x) { + var I = e.document.createElement("div"); + I.style.width = I.style.height = "1px", I.style.left = I.style.top = "-100%", I.style.position = "absolute", I.appendChild(v), e.document.querySelector("body").appendChild(I), v.onload = function() { + x(), I.parentNode.removeChild(I), I = null; + }; + }, + /** + * Creates corresponding fabric instances from their object representations + * @static + * @memberOf fabric.util + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, + * called after each fabric object created. + */ + enlivenObjects: function(v, x, I, P) { + v = v || []; + var F = [], k = 0, V = v.length; + function j() { + ++k === V && x && x(F.filter(function(Y) { + return Y; + })); + } + if (!V) { + x && x(F); + return; + } + v.forEach(function(Y, X) { + if (!Y || !Y.type) { + j(); + return; + } + var Q = e.util.getKlass(Y.type, I); + Q.fromObject(Y, function(re, he) { + he || (F[X] = re), P && P(Y, re, he), j(); + }); + }); + }, + /** + * Creates corresponding fabric instances residing in an object, e.g. `clipPath` + * @see {@link fabric.Object.ENLIVEN_PROPS} + * @param {Object} object + * @param {Object} [context] assign enlived props to this object (pass null to skip this) + * @param {(objects:fabric.Object[]) => void} callback + */ + enlivenObjectEnlivables: function(v, x, I) { + var P = e.Object.ENLIVEN_PROPS.filter(function(F) { + return !!v[F]; + }); + e.util.enlivenObjects(P.map(function(F) { + return v[F]; + }), function(F) { + var k = {}; + P.forEach(function(V, j) { + k[V] = F[j], x && (x[V] = F[j]); + }), I && I(k); + }); + }, + /** + * Create and wait for loading of patterns + * @static + * @memberOf fabric.util + * @param {Array} patterns Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * called after each fabric object created. + */ + enlivenPatterns: function(v, x) { + v = v || []; + function I() { + ++F === k && x && x(P); + } + var P = [], F = 0, k = v.length; + if (!k) { + x && x(P); + return; + } + v.forEach(function(V, j) { + V && V.source ? new e.Pattern(V, function(Y) { + P[j] = Y, I(); + }) : (P[j] = V, I()); + }); + }, + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @static + * @memberOf fabric.util + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + * @param {String} path Value to set sourcePath to + * @return {fabric.Object|fabric.Group} + */ + groupSVGElements: function(v, x, I) { + var P; + return v && v.length === 1 ? (typeof I < "u" && (v[0].sourcePath = I), v[0]) : (x && (x.width && x.height ? x.centerPoint = { + x: x.width / 2, + y: x.height / 2 + } : (delete x.width, delete x.height)), P = new e.Group(v, x), typeof I < "u" && (P.sourcePath = I), P); + }, + /** + * Populates an object with properties of another object + * @static + * @memberOf fabric.util + * @param {Object} source Source object + * @param {Object} destination Destination object + * @return {Array} properties Properties names to include + */ + populateWithProperties: function(v, x, I) { + if (I && Array.isArray(I)) + for (var P = 0, F = I.length; P < F; P++) + I[P] in v && (x[I[P]] = v[I[P]]); + }, + /** + * Creates canvas element + * @static + * @memberOf fabric.util + * @return {CanvasElement} initialized canvas element + */ + createCanvasElement: function() { + return e.document.createElement("canvas"); + }, + /** + * Creates a canvas element that is a copy of another and is also painted + * @param {CanvasElement} canvas to copy size and content of + * @static + * @memberOf fabric.util + * @return {CanvasElement} initialized canvas element + */ + copyCanvasElement: function(v) { + var x = e.util.createCanvasElement(); + return x.width = v.width, x.height = v.height, x.getContext("2d").drawImage(v, 0, 0), x; + }, + /** + * since 2.6.0 moved from canvas instance to utility. + * @param {CanvasElement} canvasEl to copy size and content of + * @param {String} format 'jpeg' or 'png', in some browsers 'webp' is ok too + * @param {Number} quality <= 1 and > 0 + * @static + * @memberOf fabric.util + * @return {String} data url + */ + toDataURL: function(v, x, I) { + return v.toDataURL("image/" + x, I); + }, + /** + * Creates image element (works on client and node) + * @static + * @memberOf fabric.util + * @return {HTMLImageElement} HTML image element + */ + createImage: function() { + return e.document.createElement("img"); + }, + /** + * Multiply matrix A by matrix B to nest transformations + * @static + * @memberOf fabric.util + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + * @param {Boolean} is2x2 flag to multiply matrices as 2x2 matrices + * @return {Array} The product of the two transform matrices + */ + multiplyTransformMatrices: function(v, x, I) { + return [ + v[0] * x[0] + v[2] * x[1], + v[1] * x[0] + v[3] * x[1], + v[0] * x[2] + v[2] * x[3], + v[1] * x[2] + v[3] * x[3], + I ? 0 : v[0] * x[4] + v[2] * x[5] + v[4], + I ? 0 : v[1] * x[4] + v[3] * x[5] + v[5] + ]; + }, + /** + * Decomposes standard 2x3 matrix into transform components + * @static + * @memberOf fabric.util + * @param {Array} a transformMatrix + * @return {Object} Components of transform + */ + qrDecompose: function(v) { + var x = c(v[1], v[0]), I = h(v[0], 2) + h(v[1], 2), P = l(I), F = (v[0] * v[3] - v[2] * v[1]) / P, k = c(v[0] * v[2] + v[1] * v[3], I); + return { + angle: x / p, + scaleX: P, + scaleY: F, + skewX: k / p, + skewY: 0, + translateX: v[4], + translateY: v[5] + }; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.angle] angle in degrees + * @return {Number[]} transform matrix + */ + calcRotateMatrix: function(v) { + if (!v.angle) + return e.iMatrix.concat(); + var x = e.util.degreesToRadians(v.angle), I = e.util.cos(x), P = e.util.sin(x); + return [I, P, -P, I, 0, 0]; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet. + * is called DimensionsTransformMatrix because those properties are the one that influence + * the size of the resulting box of the object. + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.scaleX] + * @param {Number} [options.scaleY] + * @param {Boolean} [options.flipX] + * @param {Boolean} [options.flipY] + * @param {Number} [options.skewX] + * @param {Number} [options.skewY] + * @return {Number[]} transform matrix + */ + calcDimensionsMatrix: function(v) { + var x = typeof v.scaleX > "u" ? 1 : v.scaleX, I = typeof v.scaleY > "u" ? 1 : v.scaleY, P = [ + v.flipX ? -x : x, + 0, + 0, + v.flipY ? -I : I, + 0, + 0 + ], F = e.util.multiplyTransformMatrices, k = e.util.degreesToRadians; + return v.skewX && (P = F( + P, + [1, 0, Math.tan(k(v.skewX)), 1], + !0 + )), v.skewY && (P = F( + P, + [1, Math.tan(k(v.skewY)), 0, 1], + !0 + )), P; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.angle] + * @param {Number} [options.scaleX] + * @param {Number} [options.scaleY] + * @param {Boolean} [options.flipX] + * @param {Boolean} [options.flipY] + * @param {Number} [options.skewX] + * @param {Number} [options.skewX] + * @param {Number} [options.translateX] + * @param {Number} [options.translateY] + * @return {Number[]} transform matrix + */ + composeMatrix: function(v) { + var x = [1, 0, 0, 1, v.translateX || 0, v.translateY || 0], I = e.util.multiplyTransformMatrices; + return v.angle && (x = I(x, e.util.calcRotateMatrix(v))), (v.scaleX !== 1 || v.scaleY !== 1 || v.skewX || v.skewY || v.flipX || v.flipY) && (x = I(x, e.util.calcDimensionsMatrix(v))), x; + }, + /** + * reset an object transform state to neutral. Top and left are not accounted for + * @static + * @memberOf fabric.util + * @param {fabric.Object} target object to transform + */ + resetObjectTransform: function(v) { + v.scaleX = 1, v.scaleY = 1, v.skewX = 0, v.skewY = 0, v.flipX = !1, v.flipY = !1, v.rotate(0); + }, + /** + * Extract Object transform values + * @static + * @memberOf fabric.util + * @param {fabric.Object} target object to read from + * @return {Object} Components of transform + */ + saveObjectTransform: function(v) { + return { + scaleX: v.scaleX, + scaleY: v.scaleY, + skewX: v.skewX, + skewY: v.skewY, + angle: v.angle, + left: v.left, + flipX: v.flipX, + flipY: v.flipY, + top: v.top + }; + }, + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent: function(v, x, I, P) { + P > 0 && (x > P ? x -= P : x = 0, I > P ? I -= P : I = 0); + var F = !0, k, V, j = v.getImageData(x, I, P * 2 || 1, P * 2 || 1), Y = j.data.length; + for (k = 3; k < Y && (V = j.data[k], F = V <= 0, F !== !1); k += 4) + ; + return j = null, F; + }, + /** + * Parse preserveAspectRatio attribute from element + * @param {string} attribute to be parsed + * @return {Object} an object containing align and meetOrSlice attribute + */ + parsePreserveAspectRatioAttribute: function(v) { + var x = "meet", I = "Mid", P = "Mid", F = v.split(" "), k; + return F && F.length && (x = F.pop(), x !== "meet" && x !== "slice" ? (k = x, x = "meet") : F.length && (k = F.pop())), I = k !== "none" ? k.slice(1, 4) : "none", P = k !== "none" ? k.slice(5, 8) : "none", { + meetOrSlice: x, + alignX: I, + alignY: P + }; + }, + /** + * Clear char widths cache for the given font family or all the cache if no + * fontFamily is specified. + * Use it if you know you are loading fonts in a lazy way and you are not waiting + * for custom fonts to load properly when adding text objects to the canvas. + * If a text object is added when its own font is not loaded yet, you will get wrong + * measurement and so wrong bounding boxes. + * After the font cache is cleared, either change the textObject text content or call + * initDimensions() to trigger a recalculation + * @memberOf fabric.util + * @param {String} [fontFamily] font family to clear + */ + clearFabricFontCache: function(v) { + v = (v || "").toLowerCase(), v ? e.charWidthsCache[v] && delete e.charWidthsCache[v] : e.charWidthsCache = {}; + }, + /** + * Given current aspect ratio, determines the max width and height that can + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Number} ar aspect ratio + * @param {Number} maximumArea Maximum area you want to achieve + * @return {Object.x} Limited dimensions by X + * @return {Object.y} Limited dimensions by Y + */ + limitDimsByArea: function(v, x) { + var I = Math.sqrt(x * v), P = Math.floor(x / I); + return { x: Math.floor(I), y: P }; + }, + capValue: function(v, x, I) { + return Math.max(v, Math.min(x, I)); + }, + /** + * Finds the scale for the object source to fit inside the object destination, + * keeping aspect ratio intact. + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Object | fabric.Object} source + * @param {Number} source.height natural unscaled height of the object + * @param {Number} source.width natural unscaled width of the object + * @param {Object | fabric.Object} destination + * @param {Number} destination.height natural unscaled height of the object + * @param {Number} destination.width natural unscaled width of the object + * @return {Number} scale factor to apply to source to fit into destination + */ + findScaleToFit: function(v, x) { + return Math.min(x.width / v.width, x.height / v.height); + }, + /** + * Finds the scale for the object source to cover entirely the object destination, + * keeping aspect ratio intact. + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Object | fabric.Object} source + * @param {Number} source.height natural unscaled height of the object + * @param {Number} source.width natural unscaled width of the object + * @param {Object | fabric.Object} destination + * @param {Number} destination.height natural unscaled height of the object + * @param {Number} destination.width natural unscaled width of the object + * @return {Number} scale factor to apply to source to cover destination + */ + findScaleToCover: function(v, x) { + return Math.max(x.width / v.width, x.height / v.height); + }, + /** + * given an array of 6 number returns something like `"matrix(...numbers)"` + * @memberOf fabric.util + * @param {Array} transform an array with 6 numbers + * @return {String} transform matrix for svg + * @return {Object.y} Limited dimensions by Y + */ + matrixToSVG: function(v) { + return "matrix(" + v.map(function(x) { + return e.util.toFixed(x, e.Object.NUM_FRACTION_DIGITS); + }).join(" ") + ")"; + }, + /** + * given an object and a transform, apply the inverse transform to the object, + * this is equivalent to remove from that object that transformation, so that + * added in a space with the removed transform, the object will be the same as before. + * Removing from an object a transform that scale by 2 is like scaling it by 1/2. + * Removing from an object a transfrom that rotate by 30deg is like rotating by 30deg + * in the opposite direction. + * This util is used to add objects inside transformed groups or nested groups. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + removeTransformFromObject: function(v, x) { + var I = e.util.invertTransform(x), P = e.util.multiplyTransformMatrices(I, v.calcOwnMatrix()); + e.util.applyTransformToObject(v, P); + }, + /** + * given an object and a transform, apply the transform to the object. + * this is equivalent to change the space where the object is drawn. + * Adding to an object a transform that scale by 2 is like scaling it by 2. + * This is used when removing an object from an active selection for example. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + addTransformToObject: function(v, x) { + e.util.applyTransformToObject( + v, + e.util.multiplyTransformMatrices(x, v.calcOwnMatrix()) + ); + }, + /** + * discard an object transform state and apply the one from the matrix. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + applyTransformToObject: function(v, x) { + var I = e.util.qrDecompose(x), P = new e.Point(I.translateX, I.translateY); + v.flipX = !1, v.flipY = !1, v.set("scaleX", I.scaleX), v.set("scaleY", I.scaleY), v.skewX = I.skewX, v.skewY = I.skewY, v.angle = I.angle, v.setPositionByOrigin(P, "center", "center"); + }, + /** + * given a width and height, return the size of the bounding box + * that can contains the box with width/height with applied transform + * described in options. + * Use to calculate the boxes around objects for controls. + * @memberOf fabric.util + * @param {Number} width + * @param {Number} height + * @param {Object} options + * @param {Number} options.scaleX + * @param {Number} options.scaleY + * @param {Number} options.skewX + * @param {Number} options.skewY + * @return {Object.x} width of containing + * @return {Object.y} height of containing + */ + sizeAfterTransform: function(v, x, I) { + var P = v / 2, F = x / 2, k = [ + { + x: -P, + y: -F + }, + { + x: P, + y: -F + }, + { + x: -P, + y: F + }, + { + x: P, + y: F + } + ], V = e.util.calcDimensionsMatrix(I), j = e.util.makeBoundingBoxFromPoints(k, V); + return { + x: j.width, + y: j.height + }; + }, + /** + * Merges 2 clip paths into one visually equal clip path + * + * **IMPORTANT**:\ + * Does **NOT** clone the arguments, clone them proir if necessary. + * + * Creates a wrapper (group) that contains one clip path and is clipped by the other so content is kept where both overlap. + * Use this method if both the clip paths may have nested clip paths of their own, so assigning one to the other's clip path property is not possible. + * + * In order to handle the `inverted` property we follow logic described in the following cases:\ + * **(1)** both clip paths are inverted - the clip paths pass the inverted prop to the wrapper and loose it themselves.\ + * **(2)** one is inverted and the other isn't - the wrapper shouldn't become inverted and the inverted clip path must clip the non inverted one to produce an identical visual effect.\ + * **(3)** both clip paths are not inverted - wrapper and clip paths remain unchanged. + * + * @memberOf fabric.util + * @param {fabric.Object} c1 + * @param {fabric.Object} c2 + * @returns {fabric.Object} merged clip path + */ + mergeClipPaths: function(v, x) { + var I = v, P = x; + I.inverted && !P.inverted && (I = x, P = v), e.util.applyTransformToObject( + P, + e.util.multiplyTransformMatrices( + e.util.invertTransform(I.calcTransformMatrix()), + P.calcTransformMatrix() + ) + ); + var F = I.inverted && P.inverted; + return F && (I.inverted = P.inverted = !1), new e.Group([I], { clipPath: P, inverted: F }); + }, + /** + * @memberOf fabric.util + * @param {Object} prevStyle first style to compare + * @param {Object} thisStyle second style to compare + * @param {boolean} forTextSpans whether to check overline, underline, and line-through properties + * @return {boolean} true if the style changed + */ + hasStyleChanged: function(v, x, I) { + return I = I || !1, v.fill !== x.fill || v.stroke !== x.stroke || v.strokeWidth !== x.strokeWidth || v.fontSize !== x.fontSize || v.fontFamily !== x.fontFamily || v.fontWeight !== x.fontWeight || v.fontStyle !== x.fontStyle || v.textBackgroundColor !== x.textBackgroundColor || v.deltaY !== x.deltaY || I && (v.overline !== x.overline || v.underline !== x.underline || v.linethrough !== x.linethrough); + }, + /** + * Returns the array form of a text object's inline styles property with styles grouped in ranges + * rather than per character. This format is less verbose, and is better suited for storage + * so it is used in serialization (not during runtime). + * @memberOf fabric.util + * @param {object} styles per character styles for a text object + * @param {String} text the text string that the styles are applied to + * @return {{start: number, end: number, style: object}[]} + */ + stylesToArray: function(I, x) { + for (var I = e.util.object.clone(I, !0), P = x.split(` +`), F = -1, k = {}, V = [], j = 0; j < P.length; j++) { + if (!I[j]) { + F += P[j].length; + continue; + } + for (var Y = 0; Y < P[j].length; Y++) { + F++; + var X = I[j][Y]; + if (X && Object.keys(X).length > 0) { + var Q = e.util.hasStyleChanged(k, X, !0); + Q ? V.push({ + start: F, + end: F + 1, + style: X + }) : V[V.length - 1].end++; + } + k = X || {}; + } + } + return V; + }, + /** + * Returns the object form of the styles property with styles that are assigned per + * character rather than grouped by range. This format is more verbose, and is + * only used during runtime (not for serialization/storage) + * @memberOf fabric.util + * @param {Array} styles the serialized form of a text object's styles + * @param {String} text the text string that the styles are applied to + * @return {Object} + */ + stylesFromArray: function(v, x) { + if (!Array.isArray(v)) + return v; + for (var I = x.split(` +`), P = -1, F = 0, k = {}, V = 0; V < I.length; V++) + for (var j = 0; j < I[V].length; j++) + P++, v[F] && v[F].start <= P && P < v[F].end && (k[V] = k[V] || {}, k[V][j] = Object.assign({}, v[F].style), P === v[F].end - 1 && F++); + return k; + } + }; + }(t), function() { + var a = Array.prototype.join, l = { + m: 2, + l: 2, + h: 1, + v: 1, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }, c = { + m: "l", + M: "L" + }; + function h(Oe, Re, Ge, je, et, Qe, tt, ft, Mt, kt, Tt) { + var It = e.util.cos(Oe), Nt = e.util.sin(Oe), nt = e.util.cos(Re), Ee = e.util.sin(Re), Be = Ge * et * nt - je * Qe * Ee + tt, at = je * et * nt + Ge * Qe * Ee + ft, wt = kt + Mt * (-Ge * et * Nt - je * Qe * It), st = Tt + Mt * (-je * et * Nt + Ge * Qe * It), le = Be + Mt * (Ge * et * Ee + je * Qe * nt), ct = at + Mt * (je * et * Ee - Ge * Qe * nt); + return [ + "C", + wt, + st, + le, + ct, + Be, + at + ]; + } + function p(Oe, Re, Ge, je, et, Qe, tt) { + var ft = Math.PI, Mt = tt * ft / 180, kt = e.util.sin(Mt), Tt = e.util.cos(Mt), It = 0, Nt = 0; + Ge = Math.abs(Ge), je = Math.abs(je); + var nt = -Tt * Oe * 0.5 - kt * Re * 0.5, Ee = -Tt * Re * 0.5 + kt * Oe * 0.5, Be = Ge * Ge, at = je * je, wt = Ee * Ee, st = nt * nt, le = Be * at - Be * wt - at * st, ct = 0; + if (le < 0) { + var gt = Math.sqrt(1 - le / (Be * at)); + Ge *= gt, je *= gt; + } else + ct = (et === Qe ? -1 : 1) * Math.sqrt(le / (Be * wt + at * st)); + var Ne = ct * Ge * Ee / je, pe = -ct * je * nt / Ge, Ae = Tt * Ne - kt * pe + Oe * 0.5, it = kt * Ne + Tt * pe + Re * 0.5, yt = y(1, 0, (nt - Ne) / Ge, (Ee - pe) / je), He = y((nt - Ne) / Ge, (Ee - pe) / je, (-nt - Ne) / Ge, (-Ee - pe) / je); + Qe === 0 && He > 0 ? He -= 2 * ft : Qe === 1 && He < 0 && (He += 2 * ft); + for (var Ft = Math.ceil(Math.abs(He / ft * 2)), ei = [], mt = He / Ft, Ue = 8 / 3 * Math.sin(mt / 4) * Math.sin(mt / 4) / Math.sin(mt / 2), si = yt + mt, A = 0; A < Ft; A++) + ei[A] = h(yt, si, Tt, kt, Ge, je, Ae, it, Ue, It, Nt), It = ei[A][5], Nt = ei[A][6], yt = si, si += mt; + return ei; + } + function y(Oe, Re, Ge, je) { + var et = Math.atan2(Re, Oe), Qe = Math.atan2(je, Ge); + return Qe >= et ? Qe - et : 2 * Math.PI - (et - Qe); + } + function v(Oe, Re, Ge, je, et, Qe, tt, ft) { + var Mt; + if (e.cachesBoundsOfCurve && (Mt = a.call(arguments), e.boundsOfCurveCache[Mt])) + return e.boundsOfCurveCache[Mt]; + var kt = Math.sqrt, Tt = Math.min, It = Math.max, Nt = Math.abs, nt = [], Ee = [[], []], Be, at, wt, st, le, ct, gt, Ne; + at = 6 * Oe - 12 * Ge + 6 * et, Be = -3 * Oe + 9 * Ge - 9 * et + 3 * tt, wt = 3 * Ge - 3 * Oe; + for (var pe = 0; pe < 2; ++pe) { + if (pe > 0 && (at = 6 * Re - 12 * je + 6 * Qe, Be = -3 * Re + 9 * je - 9 * Qe + 3 * ft, wt = 3 * je - 3 * Re), Nt(Be) < 1e-12) { + if (Nt(at) < 1e-12) + continue; + st = -wt / at, 0 < st && st < 1 && nt.push(st); + continue; + } + gt = at * at - 4 * wt * Be, !(gt < 0) && (Ne = kt(gt), le = (-at + Ne) / (2 * Be), 0 < le && le < 1 && nt.push(le), ct = (-at - Ne) / (2 * Be), 0 < ct && ct < 1 && nt.push(ct)); + } + for (var Ae, it, yt = nt.length, He = yt, Ft; yt--; ) + st = nt[yt], Ft = 1 - st, Ae = Ft * Ft * Ft * Oe + 3 * Ft * Ft * st * Ge + 3 * Ft * st * st * et + st * st * st * tt, Ee[0][yt] = Ae, it = Ft * Ft * Ft * Re + 3 * Ft * Ft * st * je + 3 * Ft * st * st * Qe + st * st * st * ft, Ee[1][yt] = it; + Ee[0][He] = Oe, Ee[1][He] = Re, Ee[0][He + 1] = tt, Ee[1][He + 1] = ft; + var ei = [ + { + x: Tt.apply(null, Ee[0]), + y: Tt.apply(null, Ee[1]) + }, + { + x: It.apply(null, Ee[0]), + y: It.apply(null, Ee[1]) + } + ]; + return e.cachesBoundsOfCurve && (e.boundsOfCurveCache[Mt] = ei), ei; + } + function x(Oe, Re, Ge) { + for (var je = Ge[1], et = Ge[2], Qe = Ge[3], tt = Ge[4], ft = Ge[5], Mt = Ge[6], kt = Ge[7], Tt = p(Mt - Oe, kt - Re, je, et, tt, ft, Qe), It = 0, Nt = Tt.length; It < Nt; It++) + Tt[It][1] += Oe, Tt[It][2] += Re, Tt[It][3] += Oe, Tt[It][4] += Re, Tt[It][5] += Oe, Tt[It][6] += Re; + return Tt; + } + function I(Oe) { + var Re = 0, Ge = 0, je = Oe.length, et = 0, Qe = 0, tt, ft, Mt, kt = [], Tt, It, Nt; + for (ft = 0; ft < je; ++ft) { + switch (Mt = !1, tt = Oe[ft].slice(0), tt[0]) { + case "l": + tt[0] = "L", tt[1] += Re, tt[2] += Ge; + case "L": + Re = tt[1], Ge = tt[2]; + break; + case "h": + tt[1] += Re; + case "H": + tt[0] = "L", tt[2] = Ge, Re = tt[1]; + break; + case "v": + tt[1] += Ge; + case "V": + tt[0] = "L", Ge = tt[1], tt[1] = Re, tt[2] = Ge; + break; + case "m": + tt[0] = "M", tt[1] += Re, tt[2] += Ge; + case "M": + Re = tt[1], Ge = tt[2], et = tt[1], Qe = tt[2]; + break; + case "c": + tt[0] = "C", tt[1] += Re, tt[2] += Ge, tt[3] += Re, tt[4] += Ge, tt[5] += Re, tt[6] += Ge; + case "C": + It = tt[3], Nt = tt[4], Re = tt[5], Ge = tt[6]; + break; + case "s": + tt[0] = "S", tt[1] += Re, tt[2] += Ge, tt[3] += Re, tt[4] += Ge; + case "S": + Tt === "C" ? (It = 2 * Re - It, Nt = 2 * Ge - Nt) : (It = Re, Nt = Ge), Re = tt[3], Ge = tt[4], tt[0] = "C", tt[5] = tt[3], tt[6] = tt[4], tt[3] = tt[1], tt[4] = tt[2], tt[1] = It, tt[2] = Nt, It = tt[3], Nt = tt[4]; + break; + case "q": + tt[0] = "Q", tt[1] += Re, tt[2] += Ge, tt[3] += Re, tt[4] += Ge; + case "Q": + It = tt[1], Nt = tt[2], Re = tt[3], Ge = tt[4]; + break; + case "t": + tt[0] = "T", tt[1] += Re, tt[2] += Ge; + case "T": + Tt === "Q" ? (It = 2 * Re - It, Nt = 2 * Ge - Nt) : (It = Re, Nt = Ge), tt[0] = "Q", Re = tt[1], Ge = tt[2], tt[1] = It, tt[2] = Nt, tt[3] = Re, tt[4] = Ge; + break; + case "a": + tt[0] = "A", tt[6] += Re, tt[7] += Ge; + case "A": + Mt = !0, kt = kt.concat(x(Re, Ge, tt)), Re = tt[6], Ge = tt[7]; + break; + case "z": + case "Z": + Re = et, Ge = Qe; + break; + } + Mt || kt.push(tt), Tt = tt[0]; + } + return kt; + } + function P(Oe, Re, Ge, je) { + return Math.sqrt((Ge - Oe) * (Ge - Oe) + (je - Re) * (je - Re)); + } + function F(Oe) { + return Oe * Oe * Oe; + } + function k(Oe) { + return 3 * Oe * Oe * (1 - Oe); + } + function V(Oe) { + return 3 * Oe * (1 - Oe) * (1 - Oe); + } + function j(Oe) { + return (1 - Oe) * (1 - Oe) * (1 - Oe); + } + function Y(Oe, Re, Ge, je, et, Qe, tt, ft) { + return function(Mt) { + var kt = F(Mt), Tt = k(Mt), It = V(Mt), Nt = j(Mt); + return { + x: tt * kt + et * Tt + Ge * It + Oe * Nt, + y: ft * kt + Qe * Tt + je * It + Re * Nt + }; + }; + } + function X(Oe, Re, Ge, je, et, Qe, tt, ft) { + return function(Mt) { + var kt = 1 - Mt, Tt = 3 * kt * kt * (Ge - Oe) + 6 * kt * Mt * (et - Ge) + 3 * Mt * Mt * (tt - et), It = 3 * kt * kt * (je - Re) + 6 * kt * Mt * (Qe - je) + 3 * Mt * Mt * (ft - Qe); + return Math.atan2(It, Tt); + }; + } + function Q(Oe) { + return Oe * Oe; + } + function re(Oe) { + return 2 * Oe * (1 - Oe); + } + function he(Oe) { + return (1 - Oe) * (1 - Oe); + } + function fe(Oe, Re, Ge, je, et, Qe) { + return function(tt) { + var ft = Q(tt), Mt = re(tt), kt = he(tt); + return { + x: et * ft + Ge * Mt + Oe * kt, + y: Qe * ft + je * Mt + Re * kt + }; + }; + } + function be(Oe, Re, Ge, je, et, Qe) { + return function(tt) { + var ft = 1 - tt, Mt = 2 * ft * (Ge - Oe) + 2 * tt * (et - Ge), kt = 2 * ft * (je - Re) + 2 * tt * (Qe - je); + return Math.atan2(kt, Mt); + }; + } + function Se(Oe, Re, Ge) { + var je = { x: Re, y: Ge }, et, Qe = 0, tt; + for (tt = 1; tt <= 100; tt += 1) + et = Oe(tt / 100), Qe += P(je.x, je.y, et.x, et.y), je = et; + return Qe; + } + function Me(Oe, Re) { + for (var Ge = 0, je = 0, et = Oe.iterator, Qe = { x: Oe.x, y: Oe.y }, tt, ft, Mt = 0.01, kt = Oe.angleFinder, Tt; je < Re && Mt > 1e-4; ) + tt = et(Ge), Tt = Ge, ft = P(Qe.x, Qe.y, tt.x, tt.y), ft + je > Re ? (Ge -= Mt, Mt /= 2) : (Qe = tt, Ge += Mt, je += ft); + return tt.angle = kt(Tt), tt; + } + function ke(Oe) { + for (var Re = 0, Ge = Oe.length, je, et = 0, Qe = 0, tt = 0, ft = 0, Mt = [], kt, Tt, It, Nt = 0; Nt < Ge; Nt++) { + switch (je = Oe[Nt], Tt = { + x: et, + y: Qe, + command: je[0] + }, je[0]) { + case "M": + Tt.length = 0, tt = et = je[1], ft = Qe = je[2]; + break; + case "L": + Tt.length = P(et, Qe, je[1], je[2]), et = je[1], Qe = je[2]; + break; + case "C": + kt = Y( + et, + Qe, + je[1], + je[2], + je[3], + je[4], + je[5], + je[6] + ), It = X( + et, + Qe, + je[1], + je[2], + je[3], + je[4], + je[5], + je[6] + ), Tt.iterator = kt, Tt.angleFinder = It, Tt.length = Se(kt, et, Qe), et = je[5], Qe = je[6]; + break; + case "Q": + kt = fe( + et, + Qe, + je[1], + je[2], + je[3], + je[4] + ), It = be( + et, + Qe, + je[1], + je[2], + je[3], + je[4] + ), Tt.iterator = kt, Tt.angleFinder = It, Tt.length = Se(kt, et, Qe), et = je[3], Qe = je[4]; + break; + case "Z": + case "z": + Tt.destX = tt, Tt.destY = ft, Tt.length = P(et, Qe, tt, ft), et = tt, Qe = ft; + break; + } + Re += Tt.length, Mt.push(Tt); + } + return Mt.push({ length: Re, x: et, y: Qe }), Mt; + } + function J(Oe, Re, Ge) { + Ge || (Ge = ke(Oe)); + for (var je = 0; Re - Ge[je].length > 0 && je < Ge.length - 2; ) + Re -= Ge[je].length, je++; + var et = Ge[je], Qe = Re / et.length, tt = et.command, ft = Oe[je], Mt; + switch (tt) { + case "M": + return { x: et.x, y: et.y, angle: 0 }; + case "Z": + case "z": + return Mt = new e.Point(et.x, et.y).lerp( + new e.Point(et.destX, et.destY), + Qe + ), Mt.angle = Math.atan2(et.destY - et.y, et.destX - et.x), Mt; + case "L": + return Mt = new e.Point(et.x, et.y).lerp( + new e.Point(ft[1], ft[2]), + Qe + ), Mt.angle = Math.atan2(ft[2] - et.y, ft[1] - et.x), Mt; + case "C": + return Me(et, Re); + case "Q": + return Me(et, Re); + } + } + function ce(Oe) { + var Re = [], Ge = [], je, et, Qe = e.rePathCommand, tt = "[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*", ft = "(" + tt + ")" + e.commaWsp, Mt = "([01])" + e.commaWsp + "?", kt = ft + "?" + ft + "?" + ft + Mt + Mt + ft + "?(" + tt + ")", Tt = new RegExp(kt, "g"), It, Nt, nt; + if (!Oe || !Oe.match) + return Re; + nt = Oe.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi); + for (var Ee = 0, Be, at = nt.length; Ee < at; Ee++) { + je = nt[Ee], Nt = je.slice(1).trim(), Ge.length = 0; + var wt = je.charAt(0); + if (Be = [wt], wt.toLowerCase() === "a") + for (var st; st = Tt.exec(Nt); ) + for (var le = 1; le < st.length; le++) + Ge.push(st[le]); + else + for (; It = Qe.exec(Nt); ) + Ge.push(It[0]); + for (var le = 0, ct = Ge.length; le < ct; le++) + et = parseFloat(Ge[le]), isNaN(et) || Be.push(et); + var gt = l[wt.toLowerCase()], Ne = c[wt] || wt; + if (Be.length - 1 > gt) + for (var pe = 1, Ae = Be.length; pe < Ae; pe += gt) + Re.push([wt].concat(Be.slice(pe, pe + gt))), wt = Ne; + else + Re.push(Be); + } + return Re; + } + function xe(Oe, Re) { + var Ge = [], je, et = new e.Point(Oe[0].x, Oe[0].y), Qe = new e.Point(Oe[1].x, Oe[1].y), tt = Oe.length, ft = 1, Mt = 0, kt = tt > 2; + for (Re = Re || 0, kt && (ft = Oe[2].x < Qe.x ? -1 : Oe[2].x === Qe.x ? 0 : 1, Mt = Oe[2].y < Qe.y ? -1 : Oe[2].y === Qe.y ? 0 : 1), Ge.push(["M", et.x - ft * Re, et.y - Mt * Re]), je = 1; je < tt; je++) { + if (!et.eq(Qe)) { + var Tt = et.midPointFrom(Qe); + Ge.push(["Q", et.x, et.y, Tt.x, Tt.y]); + } + et = Oe[je], je + 1 < Oe.length && (Qe = Oe[je + 1]); + } + return kt && (ft = et.x > Oe[je - 2].x ? 1 : et.x === Oe[je - 2].x ? 0 : -1, Mt = et.y > Oe[je - 2].y ? 1 : et.y === Oe[je - 2].y ? 0 : -1), Ge.push(["L", et.x + ft * Re, et.y + Mt * Re]), Ge; + } + function Pe(Oe, Re, Ge) { + return Ge && (Re = e.util.multiplyTransformMatrices( + Re, + [1, 0, 0, 1, -Ge.x, -Ge.y] + )), Oe.map(function(je) { + for (var et = je.slice(0), Qe = {}, tt = 1; tt < je.length - 1; tt += 2) + Qe.x = je[tt], Qe.y = je[tt + 1], Qe = e.util.transformPoint(Qe, Re), et[tt] = Qe.x, et[tt + 1] = Qe.y; + return et; + }); + } + e.util.joinPath = function(Oe) { + return Oe.map(function(Re) { + return Re.join(" "); + }).join(" "); + }, e.util.parsePath = ce, e.util.makePathSimpler = I, e.util.getSmoothPathFromPoints = xe, e.util.getPathSegmentsInfo = ke, e.util.getBoundsOfCurve = v, e.util.getPointOnPath = J, e.util.transformPath = Pe; + }(), function() { + var a = Array.prototype.slice; + function l(v, x) { + for (var I = a.call(arguments, 2), P = [], F = 0, k = v.length; F < k; F++) + P[F] = I.length ? v[F][x].apply(v[F], I) : v[F][x].call(v[F]); + return P; + } + function c(v, x) { + return y(v, x, function(I, P) { + return I >= P; + }); + } + function h(v, x) { + return y(v, x, function(I, P) { + return I < P; + }); + } + function p(v, x) { + for (var I = v.length; I--; ) + v[I] = x; + return v; + } + function y(v, x, I) { + if (!(!v || v.length === 0)) { + var P = v.length - 1, F = x ? v[P][x] : v[P]; + if (x) + for (; P--; ) + I(v[P][x], F) && (F = v[P][x]); + else + for (; P--; ) + I(v[P], F) && (F = v[P]); + return F; + } + } + e.util.array = { + fill: p, + invoke: l, + min: h, + max: c + }; + }(), function() { + function a(c, h, p) { + if (p) + if (!e.isLikelyNode && h instanceof Element) + c = h; + else if (h instanceof Array) { + c = []; + for (var y = 0, v = h.length; y < v; y++) + c[y] = a({}, h[y], p); + } else if (h && typeof h == "object") + for (var x in h) + x === "canvas" || x === "group" ? c[x] = null : h.hasOwnProperty(x) && (c[x] = a({}, h[x], p)); + else + c = h; + else + for (var x in h) + c[x] = h[x]; + return c; + } + function l(c, h) { + return a({}, c, h); + } + e.util.object = { + extend: a, + clone: l + }, e.util.object.extend(e.util, e.Observable); + }(), function() { + function a(y) { + return y.replace(/-+(.)?/g, function(v, x) { + return x ? x.toUpperCase() : ""; + }); + } + function l(y, v) { + return y.charAt(0).toUpperCase() + (v ? y.slice(1) : y.slice(1).toLowerCase()); + } + function c(y) { + return y.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"); + } + function h(y) { + var v = 0, x, I = []; + for (v = 0, x; v < y.length; v++) + (x = p(y, v)) !== !1 && I.push(x); + return I; + } + function p(y, v) { + var x = y.charCodeAt(v); + if (isNaN(x)) + return ""; + if (x < 55296 || x > 57343) + return y.charAt(v); + if (55296 <= x && x <= 56319) { + if (y.length <= v + 1) + throw "High surrogate without following low surrogate"; + var I = y.charCodeAt(v + 1); + if (56320 > I || I > 57343) + throw "High surrogate without following low surrogate"; + return y.charAt(v) + y.charAt(v + 1); + } + if (v === 0) + throw "Low surrogate without preceding high surrogate"; + var P = y.charCodeAt(v - 1); + if (55296 > P || P > 56319) + throw "Low surrogate without preceding high surrogate"; + return !1; + } + e.util.string = { + camelize: a, + capitalize: l, + escapeXml: c, + graphemeSplit: h + }; + }(), function() { + var a = Array.prototype.slice, l = function() { + }, c = function() { + for (var x in { toString: 1 }) + if (x === "toString") + return !1; + return !0; + }(), h = function(x, I, P) { + for (var F in I) + F in x.prototype && typeof x.prototype[F] == "function" && (I[F] + "").indexOf("callSuper") > -1 ? x.prototype[F] = function(k) { + return function() { + var V = this.constructor.superclass; + this.constructor.superclass = P; + var j = I[k].apply(this, arguments); + if (this.constructor.superclass = V, k !== "initialize") + return j; + }; + }(F) : x.prototype[F] = I[F], c && (I.toString !== Object.prototype.toString && (x.prototype.toString = I.toString), I.valueOf !== Object.prototype.valueOf && (x.prototype.valueOf = I.valueOf)); + }; + function p() { + } + function y(x) { + for (var I = null, P = this; P.constructor.superclass; ) { + var F = P.constructor.superclass.prototype[x]; + if (P[x] !== F) { + I = F; + break; + } + P = P.constructor.superclass.prototype; + } + return I ? arguments.length > 1 ? I.apply(this, a.call(arguments, 1)) : I.call(this) : console.log("tried to callSuper " + x + ", method not found in prototype chain", this); + } + function v() { + var x = null, I = a.call(arguments, 0); + typeof I[0] == "function" && (x = I.shift()); + function P() { + this.initialize.apply(this, arguments); + } + P.superclass = x, P.subclasses = [], x && (p.prototype = x.prototype, P.prototype = new p(), x.subclasses.push(P)); + for (var F = 0, k = I.length; F < k; F++) + h(P, I[F], x); + return P.prototype.initialize || (P.prototype.initialize = l), P.prototype.constructor = P, P.prototype.callSuper = y, P; + } + e.util.createClass = v; + }(), function() { + var a = !!e.document.createElement("div").attachEvent, l = ["touchstart", "touchmove", "touchend"]; + e.util.addListener = function(h, p, y, v) { + h && h.addEventListener(p, y, a ? !1 : v); + }, e.util.removeListener = function(h, p, y, v) { + h && h.removeEventListener(p, y, a ? !1 : v); + }; + function c(h) { + var p = h.changedTouches; + return p && p[0] ? p[0] : h; + } + e.util.getPointer = function(h) { + var p = h.target, y = e.util.getScrollLeftTop(p), v = c(h); + return { + x: v.clientX + y.left, + y: v.clientY + y.top + }; + }, e.util.isTouchEvent = function(h) { + return l.indexOf(h.type) > -1 || h.pointerType === "touch"; + }; + }(), function() { + function a(v, x) { + var I = v.style; + if (!I) + return v; + if (typeof x == "string") + return v.style.cssText += ";" + x, x.indexOf("opacity") > -1 ? y(v, x.match(/opacity:\s*(\d?\.?\d*)/)[1]) : v; + for (var P in x) + if (P === "opacity") + y(v, x[P]); + else { + var F = P === "float" || P === "cssFloat" ? typeof I.styleFloat > "u" ? "cssFloat" : "styleFloat" : P; + I.setProperty(F, x[P]); + } + return v; + } + var l = e.document.createElement("div"), c = typeof l.style.opacity == "string", h = typeof l.style.filter == "string", p = /alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/, y = function(v) { + return v; + }; + c ? y = function(v, x) { + return v.style.opacity = x, v; + } : h && (y = function(v, x) { + var I = v.style; + return v.currentStyle && !v.currentStyle.hasLayout && (I.zoom = 1), p.test(I.filter) ? (x = x >= 0.9999 ? "" : "alpha(opacity=" + x * 100 + ")", I.filter = I.filter.replace(p, x)) : I.filter += " alpha(opacity=" + x * 100 + ")", v; + }), e.util.setStyle = a; + }(), function() { + var a = Array.prototype.slice; + function l(j) { + return typeof j == "string" ? e.document.getElementById(j) : j; + } + var c, h = function(j) { + return a.call(j, 0); + }; + try { + c = h(e.document.childNodes) instanceof Array; + } catch { + } + c || (h = function(j) { + for (var Y = new Array(j.length), X = j.length; X--; ) + Y[X] = j[X]; + return Y; + }); + function p(j, Y) { + var X = e.document.createElement(j); + for (var Q in Y) + Q === "class" ? X.className = Y[Q] : Q === "for" ? X.htmlFor = Y[Q] : X.setAttribute(Q, Y[Q]); + return X; + } + function y(j, Y) { + j && (" " + j.className + " ").indexOf(" " + Y + " ") === -1 && (j.className += (j.className ? " " : "") + Y); + } + function v(j, Y, X) { + return typeof Y == "string" && (Y = p(Y, X)), j.parentNode && j.parentNode.replaceChild(Y, j), Y.appendChild(j), Y; + } + function x(j) { + for (var Y = 0, X = 0, Q = e.document.documentElement, re = e.document.body || { + scrollLeft: 0, + scrollTop: 0 + }; j && (j.parentNode || j.host) && (j = j.parentNode || j.host, j === e.document ? (Y = re.scrollLeft || Q.scrollLeft || 0, X = re.scrollTop || Q.scrollTop || 0) : (Y += j.scrollLeft || 0, X += j.scrollTop || 0), !(j.nodeType === 1 && j.style.position === "fixed")); ) + ; + return { left: Y, top: X }; + } + function I(j) { + var Y, X = j && j.ownerDocument, Q = { left: 0, top: 0 }, re = { left: 0, top: 0 }, he, fe = { + borderLeftWidth: "left", + borderTopWidth: "top", + paddingLeft: "left", + paddingTop: "top" + }; + if (!X) + return re; + for (var be in fe) + re[fe[be]] += parseInt(P(j, be), 10) || 0; + return Y = X.documentElement, typeof j.getBoundingClientRect < "u" && (Q = j.getBoundingClientRect()), he = x(j), { + left: Q.left + he.left - (Y.clientLeft || 0) + re.left, + top: Q.top + he.top - (Y.clientTop || 0) + re.top + }; + } + var P; + e.document.defaultView && e.document.defaultView.getComputedStyle ? P = function(j, Y) { + var X = e.document.defaultView.getComputedStyle(j, null); + return X ? X[Y] : void 0; + } : P = function(j, Y) { + var X = j.style[Y]; + return !X && j.currentStyle && (X = j.currentStyle[Y]), X; + }, function() { + var j = e.document.documentElement.style, Y = "userSelect" in j ? "userSelect" : "MozUserSelect" in j ? "MozUserSelect" : "WebkitUserSelect" in j ? "WebkitUserSelect" : "KhtmlUserSelect" in j ? "KhtmlUserSelect" : ""; + function X(re) { + return typeof re.onselectstart < "u" && (re.onselectstart = e.util.falseFunction), Y ? re.style[Y] = "none" : typeof re.unselectable == "string" && (re.unselectable = "on"), re; + } + function Q(re) { + return typeof re.onselectstart < "u" && (re.onselectstart = null), Y ? re.style[Y] = "" : typeof re.unselectable == "string" && (re.unselectable = ""), re; + } + e.util.makeElementUnselectable = X, e.util.makeElementSelectable = Q; + }(); + function F(j) { + var Y = e.jsdomImplForWrapper(j); + return Y._canvas || Y._image; + } + function k(j) { + if (e.isLikelyNode) { + var Y = e.jsdomImplForWrapper(j); + Y && (Y._image = null, Y._canvas = null, Y._currentSrc = null, Y._attributes = null, Y._classList = null); + } + } + function V(j, Y) { + j.imageSmoothingEnabled = j.imageSmoothingEnabled || j.webkitImageSmoothingEnabled || j.mozImageSmoothingEnabled || j.msImageSmoothingEnabled || j.oImageSmoothingEnabled, j.imageSmoothingEnabled = Y; + } + e.util.setImageSmoothing = V, e.util.getById = l, e.util.toArray = h, e.util.addClass = y, e.util.makeElement = p, e.util.wrapElement = v, e.util.getScrollLeftTop = x, e.util.getElementOffset = I, e.util.getNodeCanvas = F, e.util.cleanUpJsdomNode = k; + }(), function() { + function a(h, p) { + return h + (/\?/.test(h) ? "&" : "?") + p; + } + function l() { + } + function c(h, p) { + p || (p = {}); + var y = p.method ? p.method.toUpperCase() : "GET", v = p.onComplete || function() { + }, x = new e.window.XMLHttpRequest(), I = p.body || p.parameters; + return x.onreadystatechange = function() { + x.readyState === 4 && (v(x), x.onreadystatechange = l); + }, y === "GET" && (I = null, typeof p.parameters == "string" && (h = a(h, p.parameters))), x.open(y, h, !0), (y === "POST" || y === "PUT") && x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), x.send(I), x; + } + e.util.request = c; + }(), e.log = console.log, e.warn = console.warn, function() { + var a = e.util.object.extend, l = e.util.object.clone, c = []; + e.util.object.extend(c, { + /** + * cancel all running animations at the next requestAnimFrame + * @returns {AnimationContext[]} + */ + cancelAll: function() { + var F = this.splice(0); + return F.forEach(function(k) { + k.cancel(); + }), F; + }, + /** + * cancel all running animations attached to canvas at the next requestAnimFrame + * @param {fabric.Canvas} canvas + * @returns {AnimationContext[]} + */ + cancelByCanvas: function(F) { + if (!F) + return []; + var k = this.filter(function(V) { + return typeof V.target == "object" && V.target.canvas === F; + }); + return k.forEach(function(V) { + V.cancel(); + }), k; + }, + /** + * cancel all running animations for target at the next requestAnimFrame + * @param {*} target + * @returns {AnimationContext[]} + */ + cancelByTarget: function(F) { + var k = this.findAnimationsByTarget(F); + return k.forEach(function(V) { + V.cancel(); + }), k; + }, + /** + * + * @param {CancelFunction} cancelFunc the function returned by animate + * @returns {number} + */ + findAnimationIndex: function(F) { + return this.indexOf(this.findAnimation(F)); + }, + /** + * + * @param {CancelFunction} cancelFunc the function returned by animate + * @returns {AnimationContext | undefined} animation's options object + */ + findAnimation: function(F) { + return this.find(function(k) { + return k.cancel === F; + }); + }, + /** + * + * @param {*} target the object that is assigned to the target property of the animation context + * @returns {AnimationContext[]} array of animation options object associated with target + */ + findAnimationsByTarget: function(F) { + return F ? this.filter(function(k) { + return k.target === F; + }) : []; + } + }); + function h() { + return !1; + } + function p(F, k, V, j) { + return -V * Math.cos(F / j * (Math.PI / 2)) + V + k; + } + function y(F) { + F || (F = {}); + var k = !1, V, j = function() { + var Y = e.runningAnimations.indexOf(V); + return Y > -1 && e.runningAnimations.splice(Y, 1)[0]; + }; + return V = a(l(F), { + cancel: function() { + return k = !0, j(); + }, + currentValue: "startValue" in F ? F.startValue : 0, + completionRate: 0, + durationRate: 0 + }), e.runningAnimations.push(V), I(function(Y) { + var X = Y || +/* @__PURE__ */ new Date(), Q = F.duration || 500, re = X + Q, he, fe = F.onChange || h, be = F.abort || h, Se = F.onComplete || h, Me = F.easing || p, ke = "startValue" in F ? F.startValue.length > 0 : !1, J = "startValue" in F ? F.startValue : 0, ce = "endValue" in F ? F.endValue : 100, xe = F.byValue || (ke ? J.map(function(Pe, Oe) { + return ce[Oe] - J[Oe]; + }) : ce - J); + F.onStart && F.onStart(), function Pe(Oe) { + he = Oe || +/* @__PURE__ */ new Date(); + var Re = he > re ? Q : he - X, Ge = Re / Q, je = ke ? J.map(function(Qe, tt) { + return Me(Re, J[tt], xe[tt], Q); + }) : Me(Re, J, xe, Q), et = Math.abs(ke ? (je[0] - J[0]) / xe[0] : (je - J) / xe); + if (V.currentValue = ke ? je.slice() : je, V.completionRate = et, V.durationRate = Ge, !k) { + if (be(je, et, Ge)) { + j(); + return; + } + if (he > re) { + V.currentValue = ke ? ce.slice() : ce, V.completionRate = 1, V.durationRate = 1, fe(ke ? ce.slice() : ce, 1, 1), Se(ce, 1, 1), j(); + return; + } else + fe(je, et, Ge), I(Pe); + } + }(X); + }), V.cancel; + } + var v = e.window.requestAnimationFrame || e.window.webkitRequestAnimationFrame || e.window.mozRequestAnimationFrame || e.window.oRequestAnimationFrame || e.window.msRequestAnimationFrame || function(F) { + return e.window.setTimeout(F, 1e3 / 60); + }, x = e.window.cancelAnimationFrame || e.window.clearTimeout; + function I() { + return v.apply(e.window, arguments); + } + function P() { + return x.apply(e.window, arguments); + } + e.util.animate = y, e.util.requestAnimFrame = I, e.util.cancelAnimFrame = P, e.runningAnimations = c; + }(), function() { + function a(c, h, p) { + var y = "rgba(" + parseInt(c[0] + p * (h[0] - c[0]), 10) + "," + parseInt(c[1] + p * (h[1] - c[1]), 10) + "," + parseInt(c[2] + p * (h[2] - c[2]), 10); + return y += "," + (c && h ? parseFloat(c[3] + p * (h[3] - c[3])) : 1), y += ")", y; + } + function l(c, h, p, y) { + var v = new e.Color(c).getSource(), x = new e.Color(h).getSource(), I = y.onComplete, P = y.onChange; + return y = y || {}, e.util.animate(e.util.object.extend(y, { + duration: p || 500, + startValue: v, + endValue: x, + byValue: x, + easing: function(F, k, V, j) { + var Y = y.colorEasing ? y.colorEasing(F, j) : 1 - Math.cos(F / j * (Math.PI / 2)); + return a(k, V, Y); + }, + // has to take in account for color restoring; + onComplete: function(F, k, V) { + if (I) + return I( + a(x, x, 0), + k, + V + ); + }, + onChange: function(F, k, V) { + if (P) { + if (Array.isArray(F)) + return P( + a(F, F, 0), + k, + V + ); + P(F, k, V); + } + } + })); + } + e.util.animateColor = l; + }(), function() { + function a(Oe, Re, Ge, je) { + return Oe < Math.abs(Re) ? (Oe = Re, je = Ge / 4) : Re === 0 && Oe === 0 ? je = Ge / (2 * Math.PI) * Math.asin(1) : je = Ge / (2 * Math.PI) * Math.asin(Re / Oe), { a: Oe, c: Re, p: Ge, s: je }; + } + function l(Oe, Re, Ge) { + return Oe.a * Math.pow(2, 10 * (Re -= 1)) * Math.sin((Re * Ge - Oe.s) * (2 * Math.PI) / Oe.p); + } + function c(Oe, Re, Ge, je) { + return Ge * ((Oe = Oe / je - 1) * Oe * Oe + 1) + Re; + } + function h(Oe, Re, Ge, je) { + return Oe /= je / 2, Oe < 1 ? Ge / 2 * Oe * Oe * Oe + Re : Ge / 2 * ((Oe -= 2) * Oe * Oe + 2) + Re; + } + function p(Oe, Re, Ge, je) { + return Ge * (Oe /= je) * Oe * Oe * Oe + Re; + } + function y(Oe, Re, Ge, je) { + return -Ge * ((Oe = Oe / je - 1) * Oe * Oe * Oe - 1) + Re; + } + function v(Oe, Re, Ge, je) { + return Oe /= je / 2, Oe < 1 ? Ge / 2 * Oe * Oe * Oe * Oe + Re : -Ge / 2 * ((Oe -= 2) * Oe * Oe * Oe - 2) + Re; + } + function x(Oe, Re, Ge, je) { + return Ge * (Oe /= je) * Oe * Oe * Oe * Oe + Re; + } + function I(Oe, Re, Ge, je) { + return Ge * ((Oe = Oe / je - 1) * Oe * Oe * Oe * Oe + 1) + Re; + } + function P(Oe, Re, Ge, je) { + return Oe /= je / 2, Oe < 1 ? Ge / 2 * Oe * Oe * Oe * Oe * Oe + Re : Ge / 2 * ((Oe -= 2) * Oe * Oe * Oe * Oe + 2) + Re; + } + function F(Oe, Re, Ge, je) { + return -Ge * Math.cos(Oe / je * (Math.PI / 2)) + Ge + Re; + } + function k(Oe, Re, Ge, je) { + return Ge * Math.sin(Oe / je * (Math.PI / 2)) + Re; + } + function V(Oe, Re, Ge, je) { + return -Ge / 2 * (Math.cos(Math.PI * Oe / je) - 1) + Re; + } + function j(Oe, Re, Ge, je) { + return Oe === 0 ? Re : Ge * Math.pow(2, 10 * (Oe / je - 1)) + Re; + } + function Y(Oe, Re, Ge, je) { + return Oe === je ? Re + Ge : Ge * (-Math.pow(2, -10 * Oe / je) + 1) + Re; + } + function X(Oe, Re, Ge, je) { + return Oe === 0 ? Re : Oe === je ? Re + Ge : (Oe /= je / 2, Oe < 1 ? Ge / 2 * Math.pow(2, 10 * (Oe - 1)) + Re : Ge / 2 * (-Math.pow(2, -10 * --Oe) + 2) + Re); + } + function Q(Oe, Re, Ge, je) { + return -Ge * (Math.sqrt(1 - (Oe /= je) * Oe) - 1) + Re; + } + function re(Oe, Re, Ge, je) { + return Ge * Math.sqrt(1 - (Oe = Oe / je - 1) * Oe) + Re; + } + function he(Oe, Re, Ge, je) { + return Oe /= je / 2, Oe < 1 ? -Ge / 2 * (Math.sqrt(1 - Oe * Oe) - 1) + Re : Ge / 2 * (Math.sqrt(1 - (Oe -= 2) * Oe) + 1) + Re; + } + function fe(Oe, Re, Ge, je) { + var et = 1.70158, Qe = 0, tt = Ge; + if (Oe === 0) + return Re; + if (Oe /= je, Oe === 1) + return Re + Ge; + Qe || (Qe = je * 0.3); + var ft = a(tt, Ge, Qe, et); + return -l(ft, Oe, je) + Re; + } + function be(Oe, Re, Ge, je) { + var et = 1.70158, Qe = 0, tt = Ge; + if (Oe === 0) + return Re; + if (Oe /= je, Oe === 1) + return Re + Ge; + Qe || (Qe = je * 0.3); + var ft = a(tt, Ge, Qe, et); + return ft.a * Math.pow(2, -10 * Oe) * Math.sin((Oe * je - ft.s) * (2 * Math.PI) / ft.p) + ft.c + Re; + } + function Se(Oe, Re, Ge, je) { + var et = 1.70158, Qe = 0, tt = Ge; + if (Oe === 0) + return Re; + if (Oe /= je / 2, Oe === 2) + return Re + Ge; + Qe || (Qe = je * (0.3 * 1.5)); + var ft = a(tt, Ge, Qe, et); + return Oe < 1 ? -0.5 * l(ft, Oe, je) + Re : ft.a * Math.pow(2, -10 * (Oe -= 1)) * Math.sin((Oe * je - ft.s) * (2 * Math.PI) / ft.p) * 0.5 + ft.c + Re; + } + function Me(Oe, Re, Ge, je, et) { + return et === void 0 && (et = 1.70158), Ge * (Oe /= je) * Oe * ((et + 1) * Oe - et) + Re; + } + function ke(Oe, Re, Ge, je, et) { + return et === void 0 && (et = 1.70158), Ge * ((Oe = Oe / je - 1) * Oe * ((et + 1) * Oe + et) + 1) + Re; + } + function J(Oe, Re, Ge, je, et) { + return et === void 0 && (et = 1.70158), Oe /= je / 2, Oe < 1 ? Ge / 2 * (Oe * Oe * (((et *= 1.525) + 1) * Oe - et)) + Re : Ge / 2 * ((Oe -= 2) * Oe * (((et *= 1.525) + 1) * Oe + et) + 2) + Re; + } + function ce(Oe, Re, Ge, je) { + return Ge - xe(je - Oe, 0, Ge, je) + Re; + } + function xe(Oe, Re, Ge, je) { + return (Oe /= je) < 1 / 2.75 ? Ge * (7.5625 * Oe * Oe) + Re : Oe < 2 / 2.75 ? Ge * (7.5625 * (Oe -= 1.5 / 2.75) * Oe + 0.75) + Re : Oe < 2.5 / 2.75 ? Ge * (7.5625 * (Oe -= 2.25 / 2.75) * Oe + 0.9375) + Re : Ge * (7.5625 * (Oe -= 2.625 / 2.75) * Oe + 0.984375) + Re; + } + function Pe(Oe, Re, Ge, je) { + return Oe < je / 2 ? ce(Oe * 2, 0, Ge, je) * 0.5 + Re : xe(Oe * 2 - je, 0, Ge, je) * 0.5 + Ge * 0.5 + Re; + } + e.util.ease = { + /** + * Quadratic easing in + * @memberOf fabric.util.ease + */ + easeInQuad: function(Oe, Re, Ge, je) { + return Ge * (Oe /= je) * Oe + Re; + }, + /** + * Quadratic easing out + * @memberOf fabric.util.ease + */ + easeOutQuad: function(Oe, Re, Ge, je) { + return -Ge * (Oe /= je) * (Oe - 2) + Re; + }, + /** + * Quadratic easing in and out + * @memberOf fabric.util.ease + */ + easeInOutQuad: function(Oe, Re, Ge, je) { + return Oe /= je / 2, Oe < 1 ? Ge / 2 * Oe * Oe + Re : -Ge / 2 * (--Oe * (Oe - 2) - 1) + Re; + }, + /** + * Cubic easing in + * @memberOf fabric.util.ease + */ + easeInCubic: function(Oe, Re, Ge, je) { + return Ge * (Oe /= je) * Oe * Oe + Re; + }, + easeOutCubic: c, + easeInOutCubic: h, + easeInQuart: p, + easeOutQuart: y, + easeInOutQuart: v, + easeInQuint: x, + easeOutQuint: I, + easeInOutQuint: P, + easeInSine: F, + easeOutSine: k, + easeInOutSine: V, + easeInExpo: j, + easeOutExpo: Y, + easeInOutExpo: X, + easeInCirc: Q, + easeOutCirc: re, + easeInOutCirc: he, + easeInElastic: fe, + easeOutElastic: be, + easeInOutElastic: Se, + easeInBack: Me, + easeOutBack: ke, + easeInOutBack: J, + easeInBounce: ce, + easeOutBounce: xe, + easeInOutBounce: Pe + }; + }(), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.util.object.clone, p = l.util.toFixed, y = l.util.parseUnit, v = l.util.multiplyTransformMatrices, x = [ + "path", + "circle", + "polygon", + "polyline", + "ellipse", + "rect", + "line", + "image", + "text" + ], I = ["symbol", "image", "marker", "pattern", "view", "svg"], P = ["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"], F = ["symbol", "g", "a", "svg", "clipPath", "defs"], k = { + cx: "left", + x: "left", + r: "radius", + cy: "top", + y: "top", + display: "visible", + visibility: "visible", + transform: "transformMatrix", + "fill-opacity": "fillOpacity", + "fill-rule": "fillRule", + "font-family": "fontFamily", + "font-size": "fontSize", + "font-style": "fontStyle", + "font-weight": "fontWeight", + "letter-spacing": "charSpacing", + "paint-order": "paintFirst", + "stroke-dasharray": "strokeDashArray", + "stroke-dashoffset": "strokeDashOffset", + "stroke-linecap": "strokeLineCap", + "stroke-linejoin": "strokeLineJoin", + "stroke-miterlimit": "strokeMiterLimit", + "stroke-opacity": "strokeOpacity", + "stroke-width": "strokeWidth", + "text-decoration": "textDecoration", + "text-anchor": "textAnchor", + opacity: "opacity", + "clip-path": "clipPath", + "clip-rule": "clipRule", + "vector-effect": "strokeUniform", + "image-rendering": "imageSmoothing" + }, V = { + stroke: "strokeOpacity", + fill: "fillOpacity" + }, j = "font-size", Y = "clip-path"; + l.svgValidTagNamesRegEx = re(x), l.svgViewBoxElementsRegEx = re(I), l.svgInvalidAncestorsRegEx = re(P), l.svgValidParentsRegEx = re(F), l.cssRules = {}, l.gradientDefs = {}, l.clipPaths = {}; + function X(Qe) { + return Qe in k ? k[Qe] : Qe; + } + function Q(Qe, tt, ft, Mt) { + var kt = Array.isArray(tt), Tt; + if ((Qe === "fill" || Qe === "stroke") && tt === "none") + tt = ""; + else { + if (Qe === "strokeUniform") + return tt === "non-scaling-stroke"; + if (Qe === "strokeDashArray") + tt === "none" ? tt = null : tt = tt.replace(/,/g, " ").split(/\s+/).map(parseFloat); + else if (Qe === "transformMatrix") + ft && ft.transformMatrix ? tt = v( + ft.transformMatrix, + l.parseTransformAttribute(tt) + ) : tt = l.parseTransformAttribute(tt); + else if (Qe === "visible") + tt = tt !== "none" && tt !== "hidden", ft && ft.visible === !1 && (tt = !1); + else if (Qe === "opacity") + tt = parseFloat(tt), ft && typeof ft.opacity < "u" && (tt *= ft.opacity); + else if (Qe === "textAnchor") + tt = tt === "start" ? "left" : tt === "end" ? "right" : "center"; + else if (Qe === "charSpacing") + Tt = y(tt, Mt) / Mt * 1e3; + else if (Qe === "paintFirst") { + var It = tt.indexOf("fill"), Nt = tt.indexOf("stroke"), tt = "fill"; + (It > -1 && Nt > -1 && Nt < It || It === -1 && Nt > -1) && (tt = "stroke"); + } else { + if (Qe === "href" || Qe === "xlink:href" || Qe === "font") + return tt; + if (Qe === "imageSmoothing") + return tt === "optimizeQuality"; + Tt = kt ? tt.map(y) : y(tt, Mt); + } + } + return !kt && isNaN(Tt) ? tt : Tt; + } + function re(Qe) { + return new RegExp("^(" + Qe.join("|") + ")\\b", "i"); + } + function he(Qe) { + for (var tt in V) + if (!(typeof Qe[V[tt]] > "u" || Qe[tt] === "")) { + if (typeof Qe[tt] > "u") { + if (!l.Object.prototype[tt]) + continue; + Qe[tt] = l.Object.prototype[tt]; + } + if (Qe[tt].indexOf("url(") !== 0) { + var ft = new l.Color(Qe[tt]); + Qe[tt] = ft.setAlpha(p(ft.getAlpha() * Qe[V[tt]], 2)).toRgba(); + } + } + return Qe; + } + function fe(Qe, tt) { + var ft, Mt = [], kt, Tt, It; + for (Tt = 0, It = tt.length; Tt < It; Tt++) + ft = tt[Tt], kt = Qe.getElementsByTagName(ft), Mt = Mt.concat(Array.prototype.slice.call(kt)); + return Mt; + } + l.parseTransformAttribute = function() { + function Qe(pe, Ae) { + var it = l.util.cos(Ae[0]), yt = l.util.sin(Ae[0]), He = 0, Ft = 0; + Ae.length === 3 && (He = Ae[1], Ft = Ae[2]), pe[0] = it, pe[1] = yt, pe[2] = -yt, pe[3] = it, pe[4] = He - (it * He - yt * Ft), pe[5] = Ft - (yt * He + it * Ft); + } + function tt(pe, Ae) { + var it = Ae[0], yt = Ae.length === 2 ? Ae[1] : Ae[0]; + pe[0] = it, pe[3] = yt; + } + function ft(pe, Ae, it) { + pe[it] = Math.tan(l.util.degreesToRadians(Ae[0])); + } + function Mt(pe, Ae) { + pe[4] = Ae[0], Ae.length === 2 && (pe[5] = Ae[1]); + } + var kt = l.iMatrix, Tt = l.reNum, It = l.commaWsp, Nt = "(?:(skewX)\\s*\\(\\s*(" + Tt + ")\\s*\\))", nt = "(?:(skewY)\\s*\\(\\s*(" + Tt + ")\\s*\\))", Ee = "(?:(rotate)\\s*\\(\\s*(" + Tt + ")(?:" + It + "(" + Tt + ")" + It + "(" + Tt + "))?\\s*\\))", Be = "(?:(scale)\\s*\\(\\s*(" + Tt + ")(?:" + It + "(" + Tt + "))?\\s*\\))", at = "(?:(translate)\\s*\\(\\s*(" + Tt + ")(?:" + It + "(" + Tt + "))?\\s*\\))", wt = "(?:(matrix)\\s*\\(\\s*(" + Tt + ")" + It + "(" + Tt + ")" + It + "(" + Tt + ")" + It + "(" + Tt + ")" + It + "(" + Tt + ")" + It + "(" + Tt + ")\\s*\\))", st = "(?:" + wt + "|" + at + "|" + Be + "|" + Ee + "|" + Nt + "|" + nt + ")", le = "(?:" + st + "(?:" + It + "*" + st + ")*)", ct = "^\\s*(?:" + le + "?)\\s*$", gt = new RegExp(ct), Ne = new RegExp(st, "g"); + return function(pe) { + var Ae = kt.concat(), it = []; + if (!pe || pe && !gt.test(pe)) + return Ae; + pe.replace(Ne, function(He) { + var Ft = new RegExp(st).exec(He).filter(function(Ue) { + return !!Ue; + }), ei = Ft[1], mt = Ft.slice(2).map(parseFloat); + switch (ei) { + case "translate": + Mt(Ae, mt); + break; + case "rotate": + mt[0] = l.util.degreesToRadians(mt[0]), Qe(Ae, mt); + break; + case "scale": + tt(Ae, mt); + break; + case "skewX": + ft(Ae, mt, 2); + break; + case "skewY": + ft(Ae, mt, 1); + break; + case "matrix": + Ae = mt; + break; + } + it.push(Ae.concat()), Ae = kt.concat(); + }); + for (var yt = it[0]; it.length > 1; ) + it.shift(), yt = l.util.multiplyTransformMatrices(yt, it[0]); + return yt; + }; + }(); + function be(Qe, tt) { + var ft, Mt; + Qe.replace(/;\s*$/, "").split(";").forEach(function(kt) { + var Tt = kt.split(":"); + ft = Tt[0].trim().toLowerCase(), Mt = Tt[1].trim(), tt[ft] = Mt; + }); + } + function Se(Qe, tt) { + var ft, Mt; + for (var kt in Qe) + typeof Qe[kt] > "u" || (ft = kt.toLowerCase(), Mt = Qe[kt], tt[ft] = Mt); + } + function Me(Qe, tt) { + var ft = {}; + for (var Mt in l.cssRules[tt]) + if (ke(Qe, Mt.split(" "))) + for (var kt in l.cssRules[tt][Mt]) + ft[kt] = l.cssRules[tt][Mt][kt]; + return ft; + } + function ke(Qe, tt) { + var ft, Mt = !0; + return ft = ce(Qe, tt.pop()), ft && tt.length && (Mt = J(Qe, tt)), ft && Mt && tt.length === 0; + } + function J(Qe, tt) { + for (var ft, Mt = !0; Qe.parentNode && Qe.parentNode.nodeType === 1 && tt.length; ) + Mt && (ft = tt.pop()), Qe = Qe.parentNode, Mt = ce(Qe, ft); + return tt.length === 0; + } + function ce(Qe, tt) { + var ft = Qe.nodeName, Mt = Qe.getAttribute("class"), kt = Qe.getAttribute("id"), Tt, It; + if (Tt = new RegExp("^" + ft, "i"), tt = tt.replace(Tt, ""), kt && tt.length && (Tt = new RegExp("#" + kt + "(?![a-zA-Z\\-]+)", "i"), tt = tt.replace(Tt, "")), Mt && tt.length) + for (Mt = Mt.split(" "), It = Mt.length; It--; ) + Tt = new RegExp("\\." + Mt[It] + "(?![a-zA-Z\\-]+)", "i"), tt = tt.replace(Tt, ""); + return tt.length === 0; + } + function xe(Qe, tt) { + var ft; + if (Qe.getElementById && (ft = Qe.getElementById(tt)), ft) + return ft; + var Mt, kt, Tt, It = Qe.getElementsByTagName("*"); + for (kt = 0, Tt = It.length; kt < Tt; kt++) + if (Mt = It[kt], tt === Mt.getAttribute("id")) + return Mt; + } + function Pe(Qe) { + for (var tt = fe(Qe, ["use", "svg:use"]), ft = 0; tt.length && ft < tt.length; ) { + var Mt = tt[ft], kt = Mt.getAttribute("xlink:href") || Mt.getAttribute("href"); + if (kt === null) + return; + var Tt = kt.slice(1), It = Mt.getAttribute("x") || 0, Nt = Mt.getAttribute("y") || 0, nt = xe(Qe, Tt).cloneNode(!0), Ee = (nt.getAttribute("transform") || "") + " translate(" + It + ", " + Nt + ")", Be, at = tt.length, wt, st, le, ct, gt = l.svgNS; + if (Re(nt), /^svg$/i.test(nt.nodeName)) { + var Ne = nt.ownerDocument.createElementNS(gt, "g"); + for (st = 0, le = nt.attributes, ct = le.length; st < ct; st++) + wt = le.item(st), Ne.setAttributeNS(gt, wt.nodeName, wt.nodeValue); + for (; nt.firstChild; ) + Ne.appendChild(nt.firstChild); + nt = Ne; + } + for (st = 0, le = Mt.attributes, ct = le.length; st < ct; st++) + wt = le.item(st), !(wt.nodeName === "x" || wt.nodeName === "y" || wt.nodeName === "xlink:href" || wt.nodeName === "href") && (wt.nodeName === "transform" ? Ee = wt.nodeValue + " " + Ee : nt.setAttribute(wt.nodeName, wt.nodeValue)); + nt.setAttribute("transform", Ee), nt.setAttribute("instantiated_by_use", "1"), nt.removeAttribute("id"), Be = Mt.parentNode, Be.replaceChild(nt, Mt), tt.length === at && ft++; + } + } + var Oe = new RegExp( + "^\\s*(" + l.reNum + "+)\\s*,?\\s*(" + l.reNum + "+)\\s*,?\\s*(" + l.reNum + "+)\\s*,?\\s*(" + l.reNum + "+)\\s*$" + ); + function Re(Qe) { + if (!l.svgViewBoxElementsRegEx.test(Qe.nodeName)) + return {}; + var tt = Qe.getAttribute("viewBox"), ft = 1, Mt = 1, kt = 0, Tt = 0, It, Nt, nt, Ee, Be = Qe.getAttribute("width"), at = Qe.getAttribute("height"), wt = Qe.getAttribute("x") || 0, st = Qe.getAttribute("y") || 0, le = Qe.getAttribute("preserveAspectRatio") || "", ct = !tt || !(tt = tt.match(Oe)), gt = !Be || !at || Be === "100%" || at === "100%", Ne = ct && gt, pe = {}, Ae = "", it = 0, yt = 0; + if (pe.width = 0, pe.height = 0, pe.toBeParsed = Ne, ct && (wt || st) && Qe.parentNode && Qe.parentNode.nodeName !== "#document" && (Ae = " translate(" + y(wt) + " " + y(st) + ") ", nt = (Qe.getAttribute("transform") || "") + Ae, Qe.setAttribute("transform", nt), Qe.removeAttribute("x"), Qe.removeAttribute("y")), Ne) + return pe; + if (ct) + return pe.width = y(Be), pe.height = y(at), pe; + if (kt = -parseFloat(tt[1]), Tt = -parseFloat(tt[2]), It = parseFloat(tt[3]), Nt = parseFloat(tt[4]), pe.minX = kt, pe.minY = Tt, pe.viewBoxWidth = It, pe.viewBoxHeight = Nt, gt ? (pe.width = It, pe.height = Nt) : (pe.width = y(Be), pe.height = y(at), ft = pe.width / It, Mt = pe.height / Nt), le = l.util.parsePreserveAspectRatioAttribute(le), le.alignX !== "none" && (le.meetOrSlice === "meet" && (Mt = ft = ft > Mt ? Mt : ft), le.meetOrSlice === "slice" && (Mt = ft = ft > Mt ? ft : Mt), it = pe.width - It * ft, yt = pe.height - Nt * ft, le.alignX === "Mid" && (it /= 2), le.alignY === "Mid" && (yt /= 2), le.alignX === "Min" && (it = 0), le.alignY === "Min" && (yt = 0)), ft === 1 && Mt === 1 && kt === 0 && Tt === 0 && wt === 0 && st === 0) + return pe; + if ((wt || st) && Qe.parentNode.nodeName !== "#document" && (Ae = " translate(" + y(wt) + " " + y(st) + ") "), nt = Ae + " matrix(" + ft + " 0 0 " + Mt + " " + (kt * ft + it) + " " + (Tt * Mt + yt) + ") ", Qe.nodeName === "svg") { + for (Ee = Qe.ownerDocument.createElementNS(l.svgNS, "g"); Qe.firstChild; ) + Ee.appendChild(Qe.firstChild); + Qe.appendChild(Ee); + } else + Ee = Qe, Ee.removeAttribute("x"), Ee.removeAttribute("y"), nt = Ee.getAttribute("transform") + nt; + return Ee.setAttribute("transform", nt), pe; + } + function Ge(Qe, tt) { + for (; Qe && (Qe = Qe.parentNode); ) + if (Qe.nodeName && tt.test(Qe.nodeName.replace("svg:", "")) && !Qe.getAttribute("instantiated_by_use")) + return !0; + return !1; + } + l.parseSVGDocument = function(Qe, tt, ft, Mt) { + if (Qe) { + Pe(Qe); + var kt = l.Object.__uid++, Tt, It, Nt = Re(Qe), nt = l.util.toArray(Qe.getElementsByTagName("*")); + if (Nt.crossOrigin = Mt && Mt.crossOrigin, Nt.svgUid = kt, nt.length === 0 && l.isLikelyNode) { + nt = Qe.selectNodes('//*[name(.)!="svg"]'); + var Ee = []; + for (Tt = 0, It = nt.length; Tt < It; Tt++) + Ee[Tt] = nt[Tt]; + nt = Ee; + } + var Be = nt.filter(function(wt) { + return Re(wt), l.svgValidTagNamesRegEx.test(wt.nodeName.replace("svg:", "")) && !Ge(wt, l.svgInvalidAncestorsRegEx); + }); + if (!Be || Be && !Be.length) { + tt && tt([], {}); + return; + } + var at = {}; + nt.filter(function(wt) { + return wt.nodeName.replace("svg:", "") === "clipPath"; + }).forEach(function(wt) { + var st = wt.getAttribute("id"); + at[st] = l.util.toArray(wt.getElementsByTagName("*")).filter(function(le) { + return l.svgValidTagNamesRegEx.test(le.nodeName.replace("svg:", "")); + }); + }), l.gradientDefs[kt] = l.getGradientDefs(Qe), l.cssRules[kt] = l.getCSSRules(Qe), l.clipPaths[kt] = at, l.parseElements(Be, function(wt, st) { + tt && (tt(wt, Nt, st, nt), delete l.gradientDefs[kt], delete l.cssRules[kt], delete l.clipPaths[kt]); + }, h(Nt), ft, Mt); + } + }; + function je(Qe, tt) { + var ft = ["gradientTransform", "x1", "x2", "y1", "y2", "gradientUnits", "cx", "cy", "r", "fx", "fy"], Mt = "xlink:href", kt = tt.getAttribute(Mt).slice(1), Tt = xe(Qe, kt); + if (Tt && Tt.getAttribute(Mt) && je(Qe, Tt), ft.forEach(function(Nt) { + Tt && !tt.hasAttribute(Nt) && Tt.hasAttribute(Nt) && tt.setAttribute(Nt, Tt.getAttribute(Nt)); + }), !tt.children.length) + for (var It = Tt.cloneNode(!0); It.firstChild; ) + tt.appendChild(It.firstChild); + tt.removeAttribute(Mt); + } + var et = new RegExp( + "(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + l.reNum + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + l.reNum + "))?\\s+(.*)" + ); + c(l, { + /** + * Parses a short font declaration, building adding its properties to a style object + * @static + * @function + * @memberOf fabric + * @param {String} value font declaration + * @param {Object} oStyle definition + */ + parseFontDeclaration: function(Qe, tt) { + var ft = Qe.match(et); + if (ft) { + var Mt = ft[1], kt = ft[3], Tt = ft[4], It = ft[5], Nt = ft[6]; + Mt && (tt.fontStyle = Mt), kt && (tt.fontWeight = isNaN(parseFloat(kt)) ? kt : parseFloat(kt)), Tt && (tt.fontSize = y(Tt)), Nt && (tt.fontFamily = Nt), It && (tt.lineHeight = It === "normal" ? 1 : It); + } + }, + /** + * Parses an SVG document, returning all of the gradient declarations found in it + * @static + * @function + * @memberOf fabric + * @param {SVGDocument} doc SVG document to parse + * @return {Object} Gradient definitions; key corresponds to element id, value -- to gradient definition element + */ + getGradientDefs: function(Qe) { + var tt = [ + "linearGradient", + "radialGradient", + "svg:linearGradient", + "svg:radialGradient" + ], ft = fe(Qe, tt), Mt, kt = 0, Tt = {}; + for (kt = ft.length; kt--; ) + Mt = ft[kt], Mt.getAttribute("xlink:href") && je(Qe, Mt), Tt[Mt.getAttribute("id")] = Mt; + return Tt; + }, + /** + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @static + * @memberOf fabric + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + * @return {Object} object containing parsed attributes' names/values + */ + parseAttributes: function(Qe, tt, ft) { + if (Qe) { + var Mt, kt = {}, Tt, It; + typeof ft > "u" && (ft = Qe.getAttribute("svgUid")), Qe.parentNode && l.svgValidParentsRegEx.test(Qe.parentNode.nodeName) && (kt = l.parseAttributes(Qe.parentNode, tt, ft)); + var Nt = tt.reduce(function(le, ct) { + return Mt = Qe.getAttribute(ct), Mt && (le[ct] = Mt), le; + }, {}), nt = c( + Me(Qe, ft), + l.parseStyleAttribute(Qe) + ); + Nt = c( + Nt, + nt + ), nt[Y] && Qe.setAttribute(Y, nt[Y]), Tt = It = kt.fontSize || l.Text.DEFAULT_SVG_FONT_SIZE, Nt[j] && (Nt[j] = Tt = y(Nt[j], It)); + var Ee, Be, at = {}; + for (var wt in Nt) + Ee = X(wt), Be = Q(Ee, Nt[wt], kt, Tt), at[Ee] = Be; + at && at.font && l.parseFontDeclaration(at.font, at); + var st = c(kt, at); + return l.svgValidParentsRegEx.test(Qe.nodeName) ? st : he(st); + } + }, + /** + * Transforms an array of svg elements to corresponding fabric.* instances + * @static + * @memberOf fabric + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + parseElements: function(Qe, tt, ft, Mt, kt) { + new l.ElementsParser(Qe, tt, ft, Mt, kt).parse(); + }, + /** + * Parses "style" attribute, retuning an object with values + * @static + * @memberOf fabric + * @param {SVGElement} element Element to parse + * @return {Object} Objects with values parsed from style attribute of an element + */ + parseStyleAttribute: function(Qe) { + var tt = {}, ft = Qe.getAttribute("style"); + return ft && (typeof ft == "string" ? be(ft, tt) : Se(ft, tt)), tt; + }, + /** + * Parses "points" attribute, returning an array of values + * @static + * @memberOf fabric + * @param {String} points points attribute string + * @return {Array} array of points + */ + parsePointsAttribute: function(Qe) { + if (!Qe) + return null; + Qe = Qe.replace(/,/g, " ").trim(), Qe = Qe.split(/\s+/); + var tt = [], ft, Mt; + for (ft = 0, Mt = Qe.length; ft < Mt; ft += 2) + tt.push({ + x: parseFloat(Qe[ft]), + y: parseFloat(Qe[ft + 1]) + }); + return tt; + }, + /** + * Returns CSS rules for a given SVG document + * @static + * @function + * @memberOf fabric + * @param {SVGDocument} doc SVG document to parse + * @return {Object} CSS rules of this document + */ + getCSSRules: function(Qe) { + var tt = Qe.getElementsByTagName("style"), ft, Mt, kt = {}, Tt; + for (ft = 0, Mt = tt.length; ft < Mt; ft++) { + var It = tt[ft].textContent; + It = It.replace(/\/\*[\s\S]*?\*\//g, ""), It.trim() !== "" && (Tt = It.split("}"), Tt = Tt.filter(function(Nt) { + return Nt.trim(); + }), Tt.forEach(function(Nt) { + var nt = Nt.split("{"), Ee = {}, Be = nt[1].trim(), at = Be.split(";").filter(function(ct) { + return ct.trim(); + }); + for (ft = 0, Mt = at.length; ft < Mt; ft++) { + var wt = at[ft].split(":"), st = wt[0].trim(), le = wt[1].trim(); + Ee[st] = le; + } + Nt = nt[0].trim(), Nt.split(",").forEach(function(ct) { + ct = ct.replace(/^svg/i, "").trim(), ct !== "" && (kt[ct] ? l.util.object.extend(kt[ct], Ee) : kt[ct] = l.util.object.clone(Ee)); + }); + })); + } + return kt; + }, + /** + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. + * Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @memberOf fabric + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + * @param {Object} [options] Object containing options for parsing + * @param {String} [options.crossOrigin] crossOrigin crossOrigin setting to use for external resources + */ + loadSVGFromURL: function(Qe, tt, ft, Mt) { + Qe = Qe.replace(/^\n\s*/, "").trim(), new l.util.request(Qe, { + method: "get", + onComplete: kt + }); + function kt(Tt) { + var It = Tt.responseXML; + if (!It || !It.documentElement) + return tt && tt(null), !1; + l.parseSVGDocument(It.documentElement, function(Nt, nt, Ee, Be) { + tt && tt(Nt, nt, Ee, Be); + }, ft, Mt); + } + }, + /** + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @memberOf fabric + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + * @param {Object} [options] Object containing options for parsing + * @param {String} [options.crossOrigin] crossOrigin crossOrigin setting to use for external resources + */ + loadSVGFromString: function(Qe, tt, ft, Mt) { + var kt = new l.window.DOMParser(), Tt = kt.parseFromString(Qe.trim(), "text/xml"); + l.parseSVGDocument(Tt.documentElement, function(It, Nt, nt, Ee) { + tt(It, Nt, nt, Ee); + }, ft, Mt); + } + }); + }(t), e.ElementsParser = function(a, l, c, h, p, y) { + this.elements = a, this.callback = l, this.options = c, this.reviver = h, this.svgUid = c && c.svgUid || 0, this.parsingOptions = p, this.regexUrl = /^url\(['"]?#([^'"]+)['"]?\)/g, this.doc = y; + }, function(a) { + a.parse = function() { + this.instances = new Array(this.elements.length), this.numElements = this.elements.length, this.createObjects(); + }, a.createObjects = function() { + var l = this; + this.elements.forEach(function(c, h) { + c.setAttribute("svgUid", l.svgUid), l.createObject(c, h); + }); + }, a.findTag = function(l) { + return e[e.util.string.capitalize(l.tagName.replace("svg:", ""))]; + }, a.createObject = function(l, c) { + var h = this.findTag(l); + if (h && h.fromElement) + try { + h.fromElement(l, this.createCallback(c, l), this.options); + } catch (p) { + e.log(p); + } + else + this.checkIfDone(); + }, a.createCallback = function(l, c) { + var h = this; + return function(p) { + var y; + h.resolveGradient(p, c, "fill"), h.resolveGradient(p, c, "stroke"), p instanceof e.Image && p._originalElement && (y = p.parsePreserveAspectRatioAttribute(c)), p._removeTransformMatrix(y), h.resolveClipPath(p, c), h.reviver && h.reviver(c, p), h.instances[l] = p, h.checkIfDone(); + }; + }, a.extractPropertyDefinition = function(l, c, h) { + var p = l[c], y = this.regexUrl; + if (y.test(p)) { + y.lastIndex = 0; + var v = y.exec(p)[1]; + return y.lastIndex = 0, e[h][this.svgUid][v]; + } + }, a.resolveGradient = function(l, c, h) { + var p = this.extractPropertyDefinition(l, h, "gradientDefs"); + if (p) { + var y = c.getAttribute(h + "-opacity"), v = e.Gradient.fromElement(p, l, y, this.options); + l.set(h, v); + } + }, a.createClipPathCallback = function(l, c) { + return function(h) { + h._removeTransformMatrix(), h.fillRule = h.clipRule, c.push(h); + }; + }, a.resolveClipPath = function(l, c) { + var h = this.extractPropertyDefinition(l, "clipPath", "clipPaths"), p, y, v, x, I, P; + if (h) { + x = [], v = e.util.invertTransform(l.calcTransformMatrix()); + for (var F = h[0].parentNode, k = c; k.parentNode && k.getAttribute("clip-path") !== l.clipPath; ) + k = k.parentNode; + k.parentNode.appendChild(F); + for (var V = 0; V < h.length; V++) + p = h[V], y = this.findTag(p), y.fromElement( + p, + this.createClipPathCallback(l, x), + this.options + ); + x.length === 1 ? h = x[0] : h = new e.Group(x), I = e.util.multiplyTransformMatrices( + v, + h.calcTransformMatrix() + ), h.clipPath && this.resolveClipPath(h, k); + var P = e.util.qrDecompose(I); + h.flipX = !1, h.flipY = !1, h.set("scaleX", P.scaleX), h.set("scaleY", P.scaleY), h.angle = P.angle, h.skewX = P.skewX, h.skewY = 0, h.setPositionByOrigin({ x: P.translateX, y: P.translateY }, "center", "center"), l.clipPath = h; + } else + delete l.clipPath; + }, a.checkIfDone = function() { + --this.numElements === 0 && (this.instances = this.instances.filter(function(l) { + return l != null; + }), this.callback(this.instances, this.elements)); + }; + }(e.ElementsParser.prototype), function(a) { + var l = a.fabric || (a.fabric = {}); + if (l.Point) { + l.warn("fabric.Point is already defined"); + return; + } + l.Point = c; + function c(h, p) { + this.x = h, this.y = p; + } + c.prototype = /** @lends fabric.Point.prototype */ + { + type: "point", + constructor: c, + /** + * Adds another point to this one and returns another one + * @param {fabric.Point} that + * @return {fabric.Point} new Point instance with added values + */ + add: function(h) { + return new c(this.x + h.x, this.y + h.y); + }, + /** + * Adds another point to this one + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + * @chainable + */ + addEquals: function(h) { + return this.x += h.x, this.y += h.y, this; + }, + /** + * Adds value to this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} new Point with added value + */ + scalarAdd: function(h) { + return new c(this.x + h, this.y + h); + }, + /** + * Adds value to this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + scalarAddEquals: function(h) { + return this.x += h, this.y += h, this; + }, + /** + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + * @return {fabric.Point} new Point object with subtracted values + */ + subtract: function(h) { + return new c(this.x - h.x, this.y - h.y); + }, + /** + * Subtracts another point from this point + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + * @chainable + */ + subtractEquals: function(h) { + return this.x -= h.x, this.y -= h.y, this; + }, + /** + * Subtracts value from this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + scalarSubtract: function(h) { + return new c(this.x - h, this.y - h); + }, + /** + * Subtracts value from this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + scalarSubtractEquals: function(h) { + return this.x -= h, this.y -= h, this; + }, + /** + * Multiplies this point by a value and returns a new one + * TODO: rename in scalarMultiply in 2.0 + * @param {Number} scalar + * @return {fabric.Point} + */ + multiply: function(h) { + return new c(this.x * h, this.y * h); + }, + /** + * Multiplies this point by a value + * TODO: rename in scalarMultiplyEquals in 2.0 + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + multiplyEquals: function(h) { + return this.x *= h, this.y *= h, this; + }, + /** + * Divides this point by a value and returns a new one + * TODO: rename in scalarDivide in 2.0 + * @param {Number} scalar + * @return {fabric.Point} + */ + divide: function(h) { + return new c(this.x / h, this.y / h); + }, + /** + * Divides this point by a value + * TODO: rename in scalarDivideEquals in 2.0 + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + divideEquals: function(h) { + return this.x /= h, this.y /= h, this; + }, + /** + * Returns true if this point is equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + eq: function(h) { + return this.x === h.x && this.y === h.y; + }, + /** + * Returns true if this point is less than another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lt: function(h) { + return this.x < h.x && this.y < h.y; + }, + /** + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lte: function(h) { + return this.x <= h.x && this.y <= h.y; + }, + /** + + * Returns true if this point is greater another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gt: function(h) { + return this.x > h.x && this.y > h.y; + }, + /** + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gte: function(h) { + return this.x >= h.x && this.y >= h.y; + }, + /** + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t , position of interpolation, between 0 and 1 default 0.5 + * @return {fabric.Point} + */ + lerp: function(h, p) { + return typeof p > "u" && (p = 0.5), p = Math.max(Math.min(1, p), 0), new c(this.x + (h.x - this.x) * p, this.y + (h.y - this.y) * p); + }, + /** + * Returns distance from this point and another one + * @param {fabric.Point} that + * @return {Number} + */ + distanceFrom: function(h) { + var p = this.x - h.x, y = this.y - h.y; + return Math.sqrt(p * p + y * y); + }, + /** + * Returns the point between this point and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + midPointFrom: function(h) { + return this.lerp(h); + }, + /** + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + min: function(h) { + return new c(Math.min(this.x, h.x), Math.min(this.y, h.y)); + }, + /** + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + max: function(h) { + return new c(Math.max(this.x, h.x), Math.max(this.y, h.y)); + }, + /** + * Returns string representation of this point + * @return {String} + */ + toString: function() { + return this.x + "," + this.y; + }, + /** + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + * @chainable + */ + setXY: function(h, p) { + return this.x = h, this.y = p, this; + }, + /** + * Sets x of this point + * @param {Number} x + * @chainable + */ + setX: function(h) { + return this.x = h, this; + }, + /** + * Sets y of this point + * @param {Number} y + * @chainable + */ + setY: function(h) { + return this.y = h, this; + }, + /** + * Sets x/y of this point from another point + * @param {fabric.Point} that + * @chainable + */ + setFromPoint: function(h) { + return this.x = h.x, this.y = h.y, this; + }, + /** + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ + swap: function(h) { + var p = this.x, y = this.y; + this.x = h.x, this.y = h.y, h.x = p, h.y = y; + }, + /** + * return a cloned instance of the point + * @return {fabric.Point} + */ + clone: function() { + return new c(this.x, this.y); + } + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}); + if (l.Intersection) { + l.warn("fabric.Intersection is already defined"); + return; + } + function c(h) { + this.status = h, this.points = []; + } + l.Intersection = c, l.Intersection.prototype = /** @lends fabric.Intersection.prototype */ + { + constructor: c, + /** + * Appends a point to intersection + * @param {fabric.Point} point + * @return {fabric.Intersection} thisArg + * @chainable + */ + appendPoint: function(h) { + return this.points.push(h), this; + }, + /** + * Appends points to intersection + * @param {Array} points + * @return {fabric.Intersection} thisArg + * @chainable + */ + appendPoints: function(h) { + return this.points = this.points.concat(h), this; + } + }, l.Intersection.intersectLineLine = function(h, p, y, v) { + var x, I = (v.x - y.x) * (h.y - y.y) - (v.y - y.y) * (h.x - y.x), P = (p.x - h.x) * (h.y - y.y) - (p.y - h.y) * (h.x - y.x), F = (v.y - y.y) * (p.x - h.x) - (v.x - y.x) * (p.y - h.y); + if (F !== 0) { + var k = I / F, V = P / F; + 0 <= k && k <= 1 && 0 <= V && V <= 1 ? (x = new c("Intersection"), x.appendPoint(new l.Point(h.x + k * (p.x - h.x), h.y + k * (p.y - h.y)))) : x = new c(); + } else + I === 0 || P === 0 ? x = new c("Coincident") : x = new c("Parallel"); + return x; + }, l.Intersection.intersectLinePolygon = function(h, p, y) { + var v = new c(), x = y.length, I, P, F, k; + for (k = 0; k < x; k++) + I = y[k], P = y[(k + 1) % x], F = c.intersectLineLine(h, p, I, P), v.appendPoints(F.points); + return v.points.length > 0 && (v.status = "Intersection"), v; + }, l.Intersection.intersectPolygonPolygon = function(h, p) { + var y = new c(), v = h.length, x; + for (x = 0; x < v; x++) { + var I = h[x], P = h[(x + 1) % v], F = c.intersectLinePolygon(I, P, p); + y.appendPoints(F.points); + } + return y.points.length > 0 && (y.status = "Intersection"), y; + }, l.Intersection.intersectPolygonRectangle = function(h, p, y) { + var v = p.min(y), x = p.max(y), I = new l.Point(x.x, v.y), P = new l.Point(v.x, x.y), F = c.intersectLinePolygon(v, I, h), k = c.intersectLinePolygon(I, x, h), V = c.intersectLinePolygon(x, P, h), j = c.intersectLinePolygon(P, v, h), Y = new c(); + return Y.appendPoints(F.points), Y.appendPoints(k.points), Y.appendPoints(V.points), Y.appendPoints(j.points), Y.points.length > 0 && (Y.status = "Intersection"), Y; + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}); + if (l.Color) { + l.warn("fabric.Color is already defined."); + return; + } + function c(p) { + p ? this._tryParsingColor(p) : this.setSource([0, 0, 0, 1]); + } + l.Color = c, l.Color.prototype = /** @lends fabric.Color.prototype */ + { + /** + * @private + * @param {String|Array} color Color value to parse + */ + _tryParsingColor: function(p) { + var y; + p in c.colorNameMap && (p = c.colorNameMap[p]), p === "transparent" && (y = [255, 255, 255, 0]), y || (y = c.sourceFromHex(p)), y || (y = c.sourceFromRgb(p)), y || (y = c.sourceFromHsl(p)), y || (y = [0, 0, 0, 1]), y && this.setSource(y); + }, + /** + * Adapted from https://github.com/mjijackson + * @private + * @param {Number} r Red color value + * @param {Number} g Green color value + * @param {Number} b Blue color value + * @return {Array} Hsl color + */ + _rgbToHsl: function(p, y, v) { + p /= 255, y /= 255, v /= 255; + var x, I, P, F = l.util.array.max([p, y, v]), k = l.util.array.min([p, y, v]); + if (P = (F + k) / 2, F === k) + x = I = 0; + else { + var V = F - k; + switch (I = P > 0.5 ? V / (2 - F - k) : V / (F + k), F) { + case p: + x = (y - v) / V + (y < v ? 6 : 0); + break; + case y: + x = (v - p) / V + 2; + break; + case v: + x = (p - y) / V + 4; + break; + } + x /= 6; + } + return [ + Math.round(x * 360), + Math.round(I * 100), + Math.round(P * 100) + ]; + }, + /** + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + * @return {Array} + */ + getSource: function() { + return this._source; + }, + /** + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + * @param {Array} source + */ + setSource: function(p) { + this._source = p; + }, + /** + * Returns color representation in RGB format + * @return {String} ex: rgb(0-255,0-255,0-255) + */ + toRgb: function() { + var p = this.getSource(); + return "rgb(" + p[0] + "," + p[1] + "," + p[2] + ")"; + }, + /** + * Returns color representation in RGBA format + * @return {String} ex: rgba(0-255,0-255,0-255,0-1) + */ + toRgba: function() { + var p = this.getSource(); + return "rgba(" + p[0] + "," + p[1] + "," + p[2] + "," + p[3] + ")"; + }, + /** + * Returns color representation in HSL format + * @return {String} ex: hsl(0-360,0%-100%,0%-100%) + */ + toHsl: function() { + var p = this.getSource(), y = this._rgbToHsl(p[0], p[1], p[2]); + return "hsl(" + y[0] + "," + y[1] + "%," + y[2] + "%)"; + }, + /** + * Returns color representation in HSLA format + * @return {String} ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ + toHsla: function() { + var p = this.getSource(), y = this._rgbToHsl(p[0], p[1], p[2]); + return "hsla(" + y[0] + "," + y[1] + "%," + y[2] + "%," + p[3] + ")"; + }, + /** + * Returns color representation in HEX format + * @return {String} ex: FF5555 + */ + toHex: function() { + var p = this.getSource(), y, v, x; + return y = p[0].toString(16), y = y.length === 1 ? "0" + y : y, v = p[1].toString(16), v = v.length === 1 ? "0" + v : v, x = p[2].toString(16), x = x.length === 1 ? "0" + x : x, y.toUpperCase() + v.toUpperCase() + x.toUpperCase(); + }, + /** + * Returns color representation in HEXA format + * @return {String} ex: FF5555CC + */ + toHexa: function() { + var p = this.getSource(), y; + return y = Math.round(p[3] * 255), y = y.toString(16), y = y.length === 1 ? "0" + y : y, this.toHex() + y.toUpperCase(); + }, + /** + * Gets value of alpha channel for this color + * @return {Number} 0-1 + */ + getAlpha: function() { + return this.getSource()[3]; + }, + /** + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + * @return {fabric.Color} thisArg + */ + setAlpha: function(p) { + var y = this.getSource(); + return y[3] = p, this.setSource(y), this; + }, + /** + * Transforms color to its grayscale representation + * @return {fabric.Color} thisArg + */ + toGrayscale: function() { + var p = this.getSource(), y = parseInt((p[0] * 0.3 + p[1] * 0.59 + p[2] * 0.11).toFixed(0), 10), v = p[3]; + return this.setSource([y, y, y, v]), this; + }, + /** + * Transforms color to its black and white representation + * @param {Number} threshold + * @return {fabric.Color} thisArg + */ + toBlackWhite: function(p) { + var y = this.getSource(), v = (y[0] * 0.3 + y[1] * 0.59 + y[2] * 0.11).toFixed(0), x = y[3]; + return p = p || 127, v = Number(v) < Number(p) ? 0 : 255, this.setSource([v, v, v, x]), this; + }, + /** + * Overlays color with another color + * @param {String|fabric.Color} otherColor + * @return {fabric.Color} thisArg + */ + overlayWith: function(p) { + p instanceof c || (p = new c(p)); + var y = [], v = this.getAlpha(), x = 0.5, I = this.getSource(), P = p.getSource(), F; + for (F = 0; F < 3; F++) + y.push(Math.round(I[F] * (1 - x) + P[F] * x)); + return y[3] = v, this.setSource(y), this; + } + }, l.Color.reRGBa = /^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i, l.Color.reHSLa = /^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i, l.Color.reHex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, l.Color.colorNameMap = { + aliceblue: "#F0F8FF", + antiquewhite: "#FAEBD7", + aqua: "#00FFFF", + aquamarine: "#7FFFD4", + azure: "#F0FFFF", + beige: "#F5F5DC", + bisque: "#FFE4C4", + black: "#000000", + blanchedalmond: "#FFEBCD", + blue: "#0000FF", + blueviolet: "#8A2BE2", + brown: "#A52A2A", + burlywood: "#DEB887", + cadetblue: "#5F9EA0", + chartreuse: "#7FFF00", + chocolate: "#D2691E", + coral: "#FF7F50", + cornflowerblue: "#6495ED", + cornsilk: "#FFF8DC", + crimson: "#DC143C", + cyan: "#00FFFF", + darkblue: "#00008B", + darkcyan: "#008B8B", + darkgoldenrod: "#B8860B", + darkgray: "#A9A9A9", + darkgrey: "#A9A9A9", + darkgreen: "#006400", + darkkhaki: "#BDB76B", + darkmagenta: "#8B008B", + darkolivegreen: "#556B2F", + darkorange: "#FF8C00", + darkorchid: "#9932CC", + darkred: "#8B0000", + darksalmon: "#E9967A", + darkseagreen: "#8FBC8F", + darkslateblue: "#483D8B", + darkslategray: "#2F4F4F", + darkslategrey: "#2F4F4F", + darkturquoise: "#00CED1", + darkviolet: "#9400D3", + deeppink: "#FF1493", + deepskyblue: "#00BFFF", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1E90FF", + firebrick: "#B22222", + floralwhite: "#FFFAF0", + forestgreen: "#228B22", + fuchsia: "#FF00FF", + gainsboro: "#DCDCDC", + ghostwhite: "#F8F8FF", + gold: "#FFD700", + goldenrod: "#DAA520", + gray: "#808080", + grey: "#808080", + green: "#008000", + greenyellow: "#ADFF2F", + honeydew: "#F0FFF0", + hotpink: "#FF69B4", + indianred: "#CD5C5C", + indigo: "#4B0082", + ivory: "#FFFFF0", + khaki: "#F0E68C", + lavender: "#E6E6FA", + lavenderblush: "#FFF0F5", + lawngreen: "#7CFC00", + lemonchiffon: "#FFFACD", + lightblue: "#ADD8E6", + lightcoral: "#F08080", + lightcyan: "#E0FFFF", + lightgoldenrodyellow: "#FAFAD2", + lightgray: "#D3D3D3", + lightgrey: "#D3D3D3", + lightgreen: "#90EE90", + lightpink: "#FFB6C1", + lightsalmon: "#FFA07A", + lightseagreen: "#20B2AA", + lightskyblue: "#87CEFA", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#B0C4DE", + lightyellow: "#FFFFE0", + lime: "#00FF00", + limegreen: "#32CD32", + linen: "#FAF0E6", + magenta: "#FF00FF", + maroon: "#800000", + mediumaquamarine: "#66CDAA", + mediumblue: "#0000CD", + mediumorchid: "#BA55D3", + mediumpurple: "#9370DB", + mediumseagreen: "#3CB371", + mediumslateblue: "#7B68EE", + mediumspringgreen: "#00FA9A", + mediumturquoise: "#48D1CC", + mediumvioletred: "#C71585", + midnightblue: "#191970", + mintcream: "#F5FFFA", + mistyrose: "#FFE4E1", + moccasin: "#FFE4B5", + navajowhite: "#FFDEAD", + navy: "#000080", + oldlace: "#FDF5E6", + olive: "#808000", + olivedrab: "#6B8E23", + orange: "#FFA500", + orangered: "#FF4500", + orchid: "#DA70D6", + palegoldenrod: "#EEE8AA", + palegreen: "#98FB98", + paleturquoise: "#AFEEEE", + palevioletred: "#DB7093", + papayawhip: "#FFEFD5", + peachpuff: "#FFDAB9", + peru: "#CD853F", + pink: "#FFC0CB", + plum: "#DDA0DD", + powderblue: "#B0E0E6", + purple: "#800080", + rebeccapurple: "#663399", + red: "#FF0000", + rosybrown: "#BC8F8F", + royalblue: "#4169E1", + saddlebrown: "#8B4513", + salmon: "#FA8072", + sandybrown: "#F4A460", + seagreen: "#2E8B57", + seashell: "#FFF5EE", + sienna: "#A0522D", + silver: "#C0C0C0", + skyblue: "#87CEEB", + slateblue: "#6A5ACD", + slategray: "#708090", + slategrey: "#708090", + snow: "#FFFAFA", + springgreen: "#00FF7F", + steelblue: "#4682B4", + tan: "#D2B48C", + teal: "#008080", + thistle: "#D8BFD8", + tomato: "#FF6347", + turquoise: "#40E0D0", + violet: "#EE82EE", + wheat: "#F5DEB3", + white: "#FFFFFF", + whitesmoke: "#F5F5F5", + yellow: "#FFFF00", + yellowgreen: "#9ACD32" + }; + function h(p, y, v) { + return v < 0 && (v += 1), v > 1 && (v -= 1), v < 1 / 6 ? p + (y - p) * 6 * v : v < 1 / 2 ? y : v < 2 / 3 ? p + (y - p) * (2 / 3 - v) * 6 : p; + } + l.Color.fromRgb = function(p) { + return c.fromSource(c.sourceFromRgb(p)); + }, l.Color.sourceFromRgb = function(p) { + var y = p.match(c.reRGBa); + if (y) { + var v = parseInt(y[1], 10) / (/%$/.test(y[1]) ? 100 : 1) * (/%$/.test(y[1]) ? 255 : 1), x = parseInt(y[2], 10) / (/%$/.test(y[2]) ? 100 : 1) * (/%$/.test(y[2]) ? 255 : 1), I = parseInt(y[3], 10) / (/%$/.test(y[3]) ? 100 : 1) * (/%$/.test(y[3]) ? 255 : 1); + return [ + parseInt(v, 10), + parseInt(x, 10), + parseInt(I, 10), + y[4] ? parseFloat(y[4]) : 1 + ]; + } + }, l.Color.fromRgba = c.fromRgb, l.Color.fromHsl = function(p) { + return c.fromSource(c.sourceFromHsl(p)); + }, l.Color.sourceFromHsl = function(p) { + var y = p.match(c.reHSLa); + if (y) { + var v = (parseFloat(y[1]) % 360 + 360) % 360 / 360, x = parseFloat(y[2]) / (/%$/.test(y[2]) ? 100 : 1), I = parseFloat(y[3]) / (/%$/.test(y[3]) ? 100 : 1), P, F, k; + if (x === 0) + P = F = k = I; + else { + var V = I <= 0.5 ? I * (x + 1) : I + x - I * x, j = I * 2 - V; + P = h(j, V, v + 1 / 3), F = h(j, V, v), k = h(j, V, v - 1 / 3); + } + return [ + Math.round(P * 255), + Math.round(F * 255), + Math.round(k * 255), + y[4] ? parseFloat(y[4]) : 1 + ]; + } + }, l.Color.fromHsla = c.fromHsl, l.Color.fromHex = function(p) { + return c.fromSource(c.sourceFromHex(p)); + }, l.Color.sourceFromHex = function(p) { + if (p.match(c.reHex)) { + var y = p.slice(p.indexOf("#") + 1), v = y.length === 3 || y.length === 4, x = y.length === 8 || y.length === 4, I = v ? y.charAt(0) + y.charAt(0) : y.substring(0, 2), P = v ? y.charAt(1) + y.charAt(1) : y.substring(2, 4), F = v ? y.charAt(2) + y.charAt(2) : y.substring(4, 6), k = x ? v ? y.charAt(3) + y.charAt(3) : y.substring(6, 8) : "FF"; + return [ + parseInt(I, 16), + parseInt(P, 16), + parseInt(F, 16), + parseFloat((parseInt(k, 16) / 255).toFixed(2)) + ]; + } + }, l.Color.fromSource = function(p) { + var y = new c(); + return y.setSource(p), y; + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], h = ["ns", "nesw", "ew", "nwse"], p = {}, y = "left", v = "top", x = "right", I = "bottom", P = "center", F = { + top: I, + bottom: v, + left: x, + right: y, + center: P + }, k = l.util.radiansToDegrees, V = Math.sign || function(Ee) { + return (Ee > 0) - (Ee < 0) || +Ee; + }; + function j(Ee, Be) { + var at = Ee.angle + k(Math.atan2(Be.y, Be.x)) + 360; + return Math.round(at % 360 / 45); + } + function Y(Ee, Be) { + var at = Be.transform.target, wt = at.canvas, st = l.util.object.clone(Be); + st.target = at, wt && wt.fire("object:" + Ee, st), at.fire(Ee, Be); + } + function X(Ee, Be) { + var at = Be.canvas, wt = at.uniScaleKey, st = Ee[wt]; + return at.uniformScaling && !st || !at.uniformScaling && st; + } + function Q(Ee) { + return Ee.originX === P && Ee.originY === P; + } + function re(Ee, Be, at) { + var wt = Ee.lockScalingX, st = Ee.lockScalingY; + return !!(wt && st || !Be && (wt || st) && at || wt && Be === "x" || st && Be === "y"); + } + function he(Ee, Be, at) { + var wt = "not-allowed", st = X(Ee, at), le = ""; + if (Be.x !== 0 && Be.y === 0 ? le = "x" : Be.x === 0 && Be.y !== 0 && (le = "y"), re(at, le, st)) + return wt; + var ct = j(at, Be); + return c[ct] + "-resize"; + } + function fe(Ee, Be, at) { + var wt = "not-allowed"; + if (Be.x !== 0 && at.lockSkewingY || Be.y !== 0 && at.lockSkewingX) + return wt; + var st = j(at, Be) % 4; + return h[st] + "-resize"; + } + function be(Ee, Be, at) { + return Ee[at.canvas.altActionKey] ? p.skewCursorStyleHandler(Ee, Be, at) : p.scaleCursorStyleHandler(Ee, Be, at); + } + function Se(Ee, Be, at) { + var wt = Ee[at.canvas.altActionKey]; + if (Be.x === 0) + return wt ? "skewX" : "scaleY"; + if (Be.y === 0) + return wt ? "skewY" : "scaleX"; + } + function Me(Ee, Be, at) { + return at.lockRotation ? "not-allowed" : Be.cursorStyle; + } + function ke(Ee, Be, at, wt) { + return { + e: Ee, + transform: Be, + pointer: { + x: at, + y: wt + } + }; + } + function J(Ee) { + return function(Be, at, wt, st) { + var le = at.target, ct = le.getCenterPoint(), gt = le.translateToOriginPoint(ct, at.originX, at.originY), Ne = Ee(Be, at, wt, st); + return le.setPositionByOrigin(gt, at.originX, at.originY), Ne; + }; + } + function ce(Ee, Be) { + return function(at, wt, st, le) { + var ct = Be(at, wt, st, le); + return ct && Y(Ee, ke(at, wt, st, le)), ct; + }; + } + function xe(Ee, Be, at, wt, st) { + var le = Ee.target, ct = le.controls[Ee.corner], gt = le.canvas.getZoom(), Ne = le.padding / gt, pe = le.toLocalPoint(new l.Point(wt, st), Be, at); + return pe.x >= Ne && (pe.x -= Ne), pe.x <= -Ne && (pe.x += Ne), pe.y >= Ne && (pe.y -= Ne), pe.y <= Ne && (pe.y += Ne), pe.x -= ct.offsetX, pe.y -= ct.offsetY, pe; + } + function Pe(Ee) { + return Ee.flipX !== Ee.flipY; + } + function Oe(Ee, Be, at, wt, st) { + if (Ee[Be] !== 0) { + var le = Ee._getTransformedDimensions()[wt], ct = st / le * Ee[at]; + Ee.set(at, ct); + } + } + function Re(Ee, Be, at, wt) { + var st = Be.target, le = st._getTransformedDimensions(0, st.skewY), ct = xe(Be, Be.originX, Be.originY, at, wt), gt = Math.abs(ct.x * 2) - le.x, Ne = st.skewX, pe; + gt < 2 ? pe = 0 : (pe = k( + Math.atan2(gt / st.scaleX, le.y / st.scaleY) + ), Be.originX === y && Be.originY === I && (pe = -pe), Be.originX === x && Be.originY === v && (pe = -pe), Pe(st) && (pe = -pe)); + var Ae = Ne !== pe; + if (Ae) { + var it = st._getTransformedDimensions().y; + st.set("skewX", pe), Oe(st, "skewY", "scaleY", "y", it); + } + return Ae; + } + function Ge(Ee, Be, at, wt) { + var st = Be.target, le = st._getTransformedDimensions(st.skewX, 0), ct = xe(Be, Be.originX, Be.originY, at, wt), gt = Math.abs(ct.y * 2) - le.y, Ne = st.skewY, pe; + gt < 2 ? pe = 0 : (pe = k( + Math.atan2(gt / st.scaleY, le.x / st.scaleX) + ), Be.originX === y && Be.originY === I && (pe = -pe), Be.originX === x && Be.originY === v && (pe = -pe), Pe(st) && (pe = -pe)); + var Ae = Ne !== pe; + if (Ae) { + var it = st._getTransformedDimensions().x; + st.set("skewY", pe), Oe(st, "skewX", "scaleX", "x", it); + } + return Ae; + } + function je(Ee, Be, at, wt) { + var st = Be.target, le = st.skewX, ct, gt = Be.originY; + if (st.lockSkewingX) + return !1; + if (le === 0) { + var Ne = xe(Be, P, P, at, wt); + Ne.x > 0 ? ct = y : ct = x; + } else + le > 0 && (ct = gt === v ? y : x), le < 0 && (ct = gt === v ? x : y), Pe(st) && (ct = ct === y ? x : y); + Be.originX = ct; + var pe = ce("skewing", J(Re)); + return pe(Ee, Be, at, wt); + } + function et(Ee, Be, at, wt) { + var st = Be.target, le = st.skewY, ct, gt = Be.originX; + if (st.lockSkewingY) + return !1; + if (le === 0) { + var Ne = xe(Be, P, P, at, wt); + Ne.y > 0 ? ct = v : ct = I; + } else + le > 0 && (ct = gt === y ? v : I), le < 0 && (ct = gt === y ? I : v), Pe(st) && (ct = ct === v ? I : v); + Be.originY = ct; + var pe = ce("skewing", J(Ge)); + return pe(Ee, Be, at, wt); + } + function Qe(Ee, Be, at, wt) { + var st = Be, le = st.target, ct = le.translateToOriginPoint(le.getCenterPoint(), st.originX, st.originY); + if (le.lockRotation) + return !1; + var gt = Math.atan2(st.ey - ct.y, st.ex - ct.x), Ne = Math.atan2(wt - ct.y, at - ct.x), pe = k(Ne - gt + st.theta), Ae = !0; + if (le.snapAngle > 0) { + var it = le.snapAngle, yt = le.snapThreshold || it, He = Math.ceil(pe / it) * it, Ft = Math.floor(pe / it) * it; + Math.abs(pe - Ft) < yt ? pe = Ft : Math.abs(pe - He) < yt && (pe = He); + } + return pe < 0 && (pe = 360 + pe), pe %= 360, Ae = le.angle !== pe, le.angle = pe, Ae; + } + function tt(Ee, Be, at, wt, st) { + st = st || {}; + var le = Be.target, ct = le.lockScalingX, gt = le.lockScalingY, Ne = st.by, pe, Ae, it, yt, He = X(Ee, le), Ft = re(le, Ne, He), ei, mt, Ue = Be.gestureScale; + if (Ft) + return !1; + if (Ue) + Ae = Be.scaleX * Ue, it = Be.scaleY * Ue; + else { + if (pe = xe(Be, Be.originX, Be.originY, at, wt), ei = Ne !== "y" ? V(pe.x) : 1, mt = Ne !== "x" ? V(pe.y) : 1, Be.signX || (Be.signX = ei), Be.signY || (Be.signY = mt), le.lockScalingFlip && (Be.signX !== ei || Be.signY !== mt)) + return !1; + if (yt = le._getTransformedDimensions(), He && !Ne) { + var si = Math.abs(pe.x) + Math.abs(pe.y), A = Be.original, ve = Math.abs(yt.x * A.scaleX / le.scaleX) + Math.abs(yt.y * A.scaleY / le.scaleY), H = si / ve; + Ae = A.scaleX * H, it = A.scaleY * H; + } else + Ae = Math.abs(pe.x * le.scaleX / yt.x), it = Math.abs(pe.y * le.scaleY / yt.y); + Q(Be) && (Ae *= 2, it *= 2), Be.signX !== ei && Ne !== "y" && (Be.originX = F[Be.originX], Ae *= -1, Be.signX = ei), Be.signY !== mt && Ne !== "x" && (Be.originY = F[Be.originY], it *= -1, Be.signY = mt); + } + var T = le.scaleX, b = le.scaleY; + return Ne ? (Ne === "x" && le.set("scaleX", Ae), Ne === "y" && le.set("scaleY", it)) : (!ct && le.set("scaleX", Ae), !gt && le.set("scaleY", it)), T !== le.scaleX || b !== le.scaleY; + } + function ft(Ee, Be, at, wt) { + return tt(Ee, Be, at, wt); + } + function Mt(Ee, Be, at, wt) { + return tt(Ee, Be, at, wt, { by: "x" }); + } + function kt(Ee, Be, at, wt) { + return tt(Ee, Be, at, wt, { by: "y" }); + } + function Tt(Ee, Be, at, wt) { + return Ee[Be.target.canvas.altActionKey] ? p.skewHandlerX(Ee, Be, at, wt) : p.scalingY(Ee, Be, at, wt); + } + function It(Ee, Be, at, wt) { + return Ee[Be.target.canvas.altActionKey] ? p.skewHandlerY(Ee, Be, at, wt) : p.scalingX(Ee, Be, at, wt); + } + function Nt(Ee, Be, at, wt) { + var st = Be.target, le = xe(Be, Be.originX, Be.originY, at, wt), ct = st.strokeWidth / (st.strokeUniform ? st.scaleX : 1), gt = Q(Be) ? 2 : 1, Ne = st.width, pe = Math.abs(le.x * gt / st.scaleX) - ct; + return st.set("width", Math.max(pe, 0)), Ne !== pe; + } + function nt(Ee, Be, at, wt) { + var st = Be.target, le = at - Be.offsetX, ct = wt - Be.offsetY, gt = !st.get("lockMovementX") && st.left !== le, Ne = !st.get("lockMovementY") && st.top !== ct; + return gt && st.set("left", le), Ne && st.set("top", ct), (gt || Ne) && Y("moving", ke(Ee, Be, at, wt)), gt || Ne; + } + p.scaleCursorStyleHandler = he, p.skewCursorStyleHandler = fe, p.scaleSkewCursorStyleHandler = be, p.rotationWithSnapping = ce("rotating", J(Qe)), p.scalingEqually = ce("scaling", J(ft)), p.scalingX = ce("scaling", J(Mt)), p.scalingY = ce("scaling", J(kt)), p.scalingYOrSkewingX = Tt, p.scalingXOrSkewingY = It, p.changeWidth = ce("resizing", J(Nt)), p.skewHandlerX = je, p.skewHandlerY = et, p.dragHandler = nt, p.scaleOrSkewActionName = Se, p.rotationStyleHandler = Me, p.fireEvent = Y, p.wrapWithFixedAnchor = J, p.wrapWithFireEvent = ce, p.getLocalPoint = xe, l.controlsUtils = p; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.degreesToRadians, h = l.controlsUtils; + function p(v, x, I, P, F) { + P = P || {}; + var k = this.sizeX || P.cornerSize || F.cornerSize, V = this.sizeY || P.cornerSize || F.cornerSize, j = typeof P.transparentCorners < "u" ? P.transparentCorners : F.transparentCorners, Y = j ? "stroke" : "fill", X = !j && (P.cornerStrokeColor || F.cornerStrokeColor), Q = x, re = I, he; + v.save(), v.fillStyle = P.cornerColor || F.cornerColor, v.strokeStyle = P.cornerStrokeColor || F.cornerStrokeColor, k > V ? (he = k, v.scale(1, V / k), re = I * k / V) : V > k ? (he = V, v.scale(k / V, 1), Q = x * V / k) : he = k, v.lineWidth = 1, v.beginPath(), v.arc(Q, re, he / 2, 0, 2 * Math.PI, !1), v[Y](), X && v.stroke(), v.restore(); + } + function y(v, x, I, P, F) { + P = P || {}; + var k = this.sizeX || P.cornerSize || F.cornerSize, V = this.sizeY || P.cornerSize || F.cornerSize, j = typeof P.transparentCorners < "u" ? P.transparentCorners : F.transparentCorners, Y = j ? "stroke" : "fill", X = !j && (P.cornerStrokeColor || F.cornerStrokeColor), Q = k / 2, re = V / 2; + v.save(), v.fillStyle = P.cornerColor || F.cornerColor, v.strokeStyle = P.cornerStrokeColor || F.cornerStrokeColor, v.lineWidth = 1, v.translate(x, I), v.rotate(c(F.angle)), v[Y + "Rect"](-Q, -re, k, V), X && v.strokeRect(-Q, -re, k, V), v.restore(); + } + h.renderCircleControl = p, h.renderSquareControl = y; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}); + function c(h) { + for (var p in h) + this[p] = h[p]; + } + l.Control = c, l.Control.prototype = /** @lends fabric.Control.prototype */ + { + /** + * keep track of control visibility. + * mainly for backward compatibility. + * if you do not want to see a control, you can remove it + * from the controlset. + * @type {Boolean} + * @default true + */ + visible: !0, + /** + * Name of the action that the control will likely execute. + * This is optional. FabricJS uses to identify what the user is doing for some + * extra optimizations. If you are writing a custom control and you want to know + * somewhere else in the code what is going on, you can use this string here. + * you can also provide a custom getActionName if your control run multiple actions + * depending on some external state. + * default to scale since is the most common, used on 4 corners by default + * @type {String} + * @default 'scale' + */ + actionName: "scale", + /** + * Drawing angle of the control. + * NOT used for now, but name marked as needed for internal logic + * example: to reuse the same drawing function for different rotated controls + * @type {Number} + * @default 0 + */ + angle: 0, + /** + * Relative position of the control. X + * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities + * of the bounding box. + * @type {Number} + * @default 0 + */ + x: 0, + /** + * Relative position of the control. Y + * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities + * of the bounding box. + * @type {Number} + * @default 0 + */ + y: 0, + /** + * Horizontal offset of the control from the defined position. In pixels + * Positive offset moves the control to the right, negative to the left. + * It used when you want to have position of control that does not scale with + * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on + * the boundindbox, with an offset of 30 pixels vertically. Those 30 pixels will + * stay 30 pixels no matter how the object is big. Another example is having 2 + * controls in the corner, that stay in the same position when the object scale. + * of the bounding box. + * @type {Number} + * @default 0 + */ + offsetX: 0, + /** + * Vertical offset of the control from the defined position. In pixels + * Positive offset moves the control to the bottom, negative to the top. + * @type {Number} + * @default 0 + */ + offsetY: 0, + /** + * Sets the length of the control. If null, defaults to object's cornerSize. + * Expects both sizeX and sizeY to be set when set. + * @type {?Number} + * @default null + */ + sizeX: null, + /** + * Sets the height of the control. If null, defaults to object's cornerSize. + * Expects both sizeX and sizeY to be set when set. + * @type {?Number} + * @default null + */ + sizeY: null, + /** + * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize. + * Expects both touchSizeX and touchSizeY to be set when set. + * @type {?Number} + * @default null + */ + touchSizeX: null, + /** + * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize. + * Expects both touchSizeX and touchSizeY to be set when set. + * @type {?Number} + * @default null + */ + touchSizeY: null, + /** + * Css cursor style to display when the control is hovered. + * if the method `cursorStyleHandler` is provided, this property is ignored. + * @type {String} + * @default 'crosshair' + */ + cursorStyle: "crosshair", + /** + * If controls has an offsetY or offsetX, draw a line that connects + * the control to the bounding box + * @type {Boolean} + * @default false + */ + withConnection: !1, + /** + * The control actionHandler, provide one to handle action ( control being moved ) + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + actionHandler: function() { + }, + /** + * The control handler for mouse down, provide one to handle mouse down on control + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + mouseDownHandler: function() { + }, + /** + * The control mouseUpHandler, provide one to handle an effect on mouse up. + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + mouseUpHandler: function() { + }, + /** + * Returns control actionHandler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getActionHandler: function() { + return this.actionHandler; + }, + /** + * Returns control mouseDown handler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getMouseDownHandler: function() { + return this.mouseDownHandler; + }, + /** + * Returns control mouseUp handler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getMouseUpHandler: function() { + return this.mouseUpHandler; + }, + /** + * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate + * function you can pass one in the constructor + * the cursorStyle property + * @param {Event} eventData the native mouse event + * @param {fabric.Control} control the current control ( likely this) + * @param {fabric.Object} object on which the control is displayed + * @return {String} + */ + cursorStyleHandler: function(h, p) { + return p.cursorStyle; + }, + /** + * Returns the action name. The basic implementation just return the actionName property. + * @param {Event} eventData the native mouse event + * @param {fabric.Control} control the current control ( likely this) + * @param {fabric.Object} object on which the control is displayed + * @return {String} + */ + getActionName: function(h, p) { + return p.actionName; + }, + /** + * Returns controls visibility + * @param {fabric.Object} object on which the control is displayed + * @param {String} controlKey key where the control is memorized on the + * @return {Boolean} + */ + getVisibility: function(h, p) { + var y = h._controlsVisibility; + return y && typeof y[p] < "u" ? y[p] : this.visible; + }, + /** + * Sets controls visibility + * @param {Boolean} visibility for the object + * @return {Void} + */ + setVisibility: function(h) { + this.visible = h; + }, + positionHandler: function(h, p) { + var y = l.util.transformPoint({ + x: this.x * h.x + this.offsetX, + y: this.y * h.y + this.offsetY + }, p); + return y; + }, + /** + * Returns the coords for this control based on object values. + * @param {Number} objectAngle angle from the fabric object holding the control + * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if + * isTouch is true) + * @param {Number} centerX x coordinate where the control center should be + * @param {Number} centerY y coordinate where the control center should be + * @param {boolean} isTouch true if touch corner, false if normal corner + */ + calcCornerCoords: function(h, p, y, v, x) { + var I, P, F, k, V = x ? this.touchSizeX : this.sizeX, j = x ? this.touchSizeY : this.sizeY; + if (V && j && V !== j) { + var Y = Math.atan2(j, V), X = Math.sqrt(V * V + j * j) / 2, Q = Y - l.util.degreesToRadians(h), re = Math.PI / 2 - Y - l.util.degreesToRadians(h); + I = X * l.util.cos(Q), P = X * l.util.sin(Q), F = X * l.util.cos(re), k = X * l.util.sin(re); + } else { + var he = V && j ? V : p; + X = he * 0.7071067812; + var Q = l.util.degreesToRadians(45 - h); + I = F = X * l.util.cos(Q), P = k = X * l.util.sin(Q); + } + return { + tl: { + x: y - k, + y: v - F + }, + tr: { + x: y + I, + y: v - P + }, + bl: { + x: y - I, + y: v + P + }, + br: { + x: y + k, + y: v + F + } + }; + }, + /** + * Render function for the control. + * When this function runs the context is unscaled. unrotate. Just retina scaled. + * all the functions will have to translate to the point left,top before starting Drawing + * if they want to draw a control where the position is detected. + * left and top are the result of the positionHandler function + * @param {RenderingContext2D} ctx the context where the control will be drawn + * @param {Number} left position of the canvas where we are about to render the control. + * @param {Number} top position of the canvas where we are about to render the control. + * @param {Object} styleOverride + * @param {fabric.Object} fabricObject the object where the control is about to be rendered + */ + render: function(h, p, y, v, x) { + switch (v = v || {}, v.cornerStyle || x.cornerStyle) { + case "circle": + l.controlsUtils.renderCircleControl.call(this, h, p, y, v, x); + break; + default: + l.controlsUtils.renderSquareControl.call(this, h, p, y, v, x); + } + } + }; + }(t), function() { + function a(y, v) { + var x = y.getAttribute("style"), I = y.getAttribute("offset") || 0, P, F, k, V; + if (I = parseFloat(I) / (/%$/.test(I) ? 100 : 1), I = I < 0 ? 0 : I > 1 ? 1 : I, x) { + var j = x.split(/\s*;\s*/); + for (j[j.length - 1] === "" && j.pop(), V = j.length; V--; ) { + var Y = j[V].split(/\s*:\s*/), X = Y[0].trim(), Q = Y[1].trim(); + X === "stop-color" ? P = Q : X === "stop-opacity" && (k = Q); + } + } + return P || (P = y.getAttribute("stop-color") || "rgb(0,0,0)"), k || (k = y.getAttribute("stop-opacity")), P = new e.Color(P), F = P.getAlpha(), k = isNaN(parseFloat(k)) ? 1 : parseFloat(k), k *= F * v, { + offset: I, + color: P.toRgb(), + opacity: k + }; + } + function l(y) { + return { + x1: y.getAttribute("x1") || 0, + y1: y.getAttribute("y1") || 0, + x2: y.getAttribute("x2") || "100%", + y2: y.getAttribute("y2") || 0 + }; + } + function c(y) { + return { + x1: y.getAttribute("fx") || y.getAttribute("cx") || "50%", + y1: y.getAttribute("fy") || y.getAttribute("cy") || "50%", + r1: 0, + x2: y.getAttribute("cx") || "50%", + y2: y.getAttribute("cy") || "50%", + r2: y.getAttribute("r") || "50%" + }; + } + var h = e.util.object.clone; + e.Gradient = e.util.createClass( + /** @lends fabric.Gradient.prototype */ + { + /** + * Horizontal offset for aligning gradients coming from SVG when outside pathgroups + * @type Number + * @default 0 + */ + offsetX: 0, + /** + * Vertical offset for aligning gradients coming from SVG when outside pathgroups + * @type Number + * @default 0 + */ + offsetY: 0, + /** + * A transform matrix to apply to the gradient before painting. + * Imported from svg gradients, is not applied with the current transform in the center. + * Before this transform is applied, the origin point is at the top left corner of the object + * plus the addition of offsetY and offsetX. + * @type Number[] + * @default null + */ + gradientTransform: null, + /** + * coordinates units for coords. + * If `pixels`, the number of coords are in the same unit of width / height. + * If set as `percentage` the coords are still a number, but 1 means 100% of width + * for the X and 100% of the height for the y. It can be bigger than 1 and negative. + * allowed values pixels or percentage. + * @type String + * @default 'pixels' + */ + gradientUnits: "pixels", + /** + * Gradient type linear or radial + * @type String + * @default 'pixels' + */ + type: "linear", + /** + * Constructor + * @param {Object} options Options object with type, coords, gradientUnits and colorStops + * @param {Object} [options.type] gradient type linear or radial + * @param {Object} [options.gradientUnits] gradient units + * @param {Object} [options.offsetX] SVG import compatibility + * @param {Object} [options.offsetY] SVG import compatibility + * @param {Object[]} options.colorStops contains the colorstops. + * @param {Object} options.coords contains the coords of the gradient + * @param {Number} [options.coords.x1] X coordiante of the first point for linear or of the focal point for radial + * @param {Number} [options.coords.y1] Y coordiante of the first point for linear or of the focal point for radial + * @param {Number} [options.coords.x2] X coordiante of the second point for linear or of the center point for radial + * @param {Number} [options.coords.y2] Y coordiante of the second point for linear or of the center point for radial + * @param {Number} [options.coords.r1] only for radial gradient, radius of the inner circle + * @param {Number} [options.coords.r2] only for radial gradient, radius of the external circle + * @return {fabric.Gradient} thisArg + */ + initialize: function(y) { + y || (y = {}), y.coords || (y.coords = {}); + var v, x = this; + Object.keys(y).forEach(function(I) { + x[I] = y[I]; + }), this.id ? this.id += "_" + e.Object.__uid++ : this.id = e.Object.__uid++, v = { + x1: y.coords.x1 || 0, + y1: y.coords.y1 || 0, + x2: y.coords.x2 || 0, + y2: y.coords.y2 || 0 + }, this.type === "radial" && (v.r1 = y.coords.r1 || 0, v.r2 = y.coords.r2 || 0), this.coords = v, this.colorStops = y.colorStops.slice(); + }, + /** + * Adds another colorStop + * @param {Object} colorStop Object with offset and color + * @return {fabric.Gradient} thisArg + */ + addColorStop: function(y) { + for (var v in y) { + var x = new e.Color(y[v]); + this.colorStops.push({ + offset: parseFloat(v), + color: x.toRgb(), + opacity: x.getAlpha() + }); + } + return this; + }, + /** + * Returns object representation of a gradient + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} + */ + toObject: function(y) { + var v = { + type: this.type, + coords: this.coords, + colorStops: this.colorStops, + offsetX: this.offsetX, + offsetY: this.offsetY, + gradientUnits: this.gradientUnits, + gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform + }; + return e.util.populateWithProperties(this, v, y), v; + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of an gradient + * @param {Object} object Object to create a gradient for + * @return {String} SVG representation of an gradient (linear/radial) + */ + toSVG: function(y, F) { + var x = h(this.coords, !0), I, P, F = F || {}, k, V, j = h(this.colorStops, !0), Y = x.r1 > x.r2, X = this.gradientTransform ? this.gradientTransform.concat() : e.iMatrix.concat(), Q = -this.offsetX, re = -this.offsetY, he = !!F.additionalTransform, fe = this.gradientUnits === "pixels" ? "userSpaceOnUse" : "objectBoundingBox"; + if (j.sort(function(J, ce) { + return J.offset - ce.offset; + }), fe === "objectBoundingBox" ? (Q /= y.width, re /= y.height) : (Q += y.width / 2, re += y.height / 2), y.type === "path" && this.gradientUnits !== "percentage" && (Q -= y.pathOffset.x, re -= y.pathOffset.y), X[4] -= Q, X[5] -= re, V = 'id="SVGID_' + this.id + '" gradientUnits="' + fe + '"', V += ' gradientTransform="' + (he ? F.additionalTransform + " " : "") + e.util.matrixToSVG(X) + '" ', this.type === "linear" ? k = [ + " +` + ] : this.type === "radial" && (k = [ + " +` + ]), this.type === "radial") { + if (Y) + for (j = j.concat(), j.reverse(), I = 0, P = j.length; I < P; I++) + j[I].offset = 1 - j[I].offset; + var be = Math.min(x.r1, x.r2); + if (be > 0) { + var Se = Math.max(x.r1, x.r2), Me = be / Se; + for (I = 0, P = j.length; I < P; I++) + j[I].offset += Me * (1 - j[I].offset); + } + } + for (I = 0, P = j.length; I < P; I++) { + var ke = j[I]; + k.push( + " +` + ); + } + return k.push(this.type === "linear" ? ` +` : ` +`), k.join(""); + }, + /* _TO_SVG_END_ */ + /** + * Returns an instance of CanvasGradient + * @param {CanvasRenderingContext2D} ctx Context to render on + * @return {CanvasGradient} + */ + toLive: function(y) { + var v, x = e.util.object.clone(this.coords), I, P; + if (this.type) { + for (this.type === "linear" ? v = y.createLinearGradient( + x.x1, + x.y1, + x.x2, + x.y2 + ) : this.type === "radial" && (v = y.createRadialGradient( + x.x1, + x.y1, + x.r1, + x.x2, + x.y2, + x.r2 + )), I = 0, P = this.colorStops.length; I < P; I++) { + var F = this.colorStops[I].color, k = this.colorStops[I].opacity, V = this.colorStops[I].offset; + typeof k < "u" && (F = new e.Color(F).setAlpha(k).toRgba()), v.addColorStop(V, F); + } + return v; + } + } + } + ), e.util.object.extend(e.Gradient, { + /* _FROM_SVG_START_ */ + /** + * Returns {@link fabric.Gradient} instance from an SVG element + * @static + * @memberOf fabric.Gradient + * @param {SVGGradientElement} el SVG gradient element + * @param {fabric.Object} instance + * @param {String} opacityAttr A fill-opacity or stroke-opacity attribute to multiply to each stop's opacity. + * @param {Object} svgOptions an object containing the size of the SVG in order to parse correctly gradients + * that uses gradientUnits as 'userSpaceOnUse' and percentages. + * @param {Object.number} viewBoxWidth width part of the viewBox attribute on svg + * @param {Object.number} viewBoxHeight height part of the viewBox attribute on svg + * @param {Object.number} width width part of the svg tag if viewBox is not specified + * @param {Object.number} height height part of the svg tag if viewBox is not specified + * @return {fabric.Gradient} Gradient instance + * @see http://www.w3.org/TR/SVG/pservers.html#LinearGradientElement + * @see http://www.w3.org/TR/SVG/pservers.html#RadialGradientElement + */ + fromElement: function(y, v, x, I) { + var P = parseFloat(x) / (/%$/.test(x) ? 100 : 1); + P = P < 0 ? 0 : P > 1 ? 1 : P, isNaN(P) && (P = 1); + var F = y.getElementsByTagName("stop"), k, V = y.getAttribute("gradientUnits") === "userSpaceOnUse" ? "pixels" : "percentage", j = y.getAttribute("gradientTransform") || "", Y = [], X, Q, re = 0, he = 0, fe; + for (y.nodeName === "linearGradient" || y.nodeName === "LINEARGRADIENT" ? (k = "linear", X = l(y)) : (k = "radial", X = c(y)), Q = F.length; Q--; ) + Y.push(a(F[Q], P)); + fe = e.parseTransformAttribute(j), p(v, X, I, V), V === "pixels" && (re = -v.left, he = -v.top); + var be = new e.Gradient({ + id: y.getAttribute("id"), + type: k, + coords: X, + colorStops: Y, + gradientUnits: V, + gradientTransform: fe, + offsetX: re, + offsetY: he + }); + return be; + } + /* _FROM_SVG_END_ */ + }); + function p(y, v, x, I) { + var P, F; + Object.keys(v).forEach(function(k) { + P = v[k], P === "Infinity" ? F = 1 : P === "-Infinity" ? F = 0 : (F = parseFloat(v[k], 10), typeof P == "string" && /^(\d+\.\d+)%|(\d+)%$/.test(P) && (F *= 0.01, I === "pixels" && ((k === "x1" || k === "x2" || k === "r2") && (F *= x.viewBoxWidth || x.width), (k === "y1" || k === "y2") && (F *= x.viewBoxHeight || x.height)))), v[k] = F; + }); + } + }(), function() { + var a = e.util.toFixed; + e.Pattern = e.util.createClass( + /** @lends fabric.Pattern.prototype */ + { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + * @type String + * @default + */ + repeat: "repeat", + /** + * Pattern horizontal offset from object's left/top corner + * @type Number + * @default + */ + offsetX: 0, + /** + * Pattern vertical offset from object's left/top corner + * @type Number + * @default + */ + offsetY: 0, + /** + * crossOrigin value (one of "", "anonymous", "use-credentials") + * @see https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes + * @type String + * @default + */ + crossOrigin: "", + /** + * transform matrix to change the pattern, imported from svgs. + * @type Array + * @default + */ + patternTransform: null, + /** + * Constructor + * @param {Object} [options] Options object + * @param {Function} [callback] function to invoke after callback init. + * @return {fabric.Pattern} thisArg + */ + initialize: function(l, c) { + if (l || (l = {}), this.id = e.Object.__uid++, this.setOptions(l), !l.source || l.source && typeof l.source != "string") { + c && c(this); + return; + } else { + var h = this; + this.source = e.util.createImage(), e.util.loadImage(l.source, function(p, y) { + h.source = p, c && c(h, y); + }, null, this.crossOrigin); + } + }, + /** + * Returns object representation of a pattern + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of a pattern instance + */ + toObject: function(l) { + var c = e.Object.NUM_FRACTION_DIGITS, h, p; + return typeof this.source.src == "string" ? h = this.source.src : typeof this.source == "object" && this.source.toDataURL && (h = this.source.toDataURL()), p = { + type: "pattern", + source: h, + repeat: this.repeat, + crossOrigin: this.crossOrigin, + offsetX: a(this.offsetX, c), + offsetY: a(this.offsetY, c), + patternTransform: this.patternTransform ? this.patternTransform.concat() : null + }, e.util.populateWithProperties(this, p, l), p; + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + * @return {String} SVG representation of a pattern + */ + toSVG: function(l) { + var c = typeof this.source == "function" ? this.source() : this.source, h = c.width / l.width, p = c.height / l.height, y = this.offsetX / l.width, v = this.offsetY / l.height, x = ""; + return (this.repeat === "repeat-x" || this.repeat === "no-repeat") && (p = 1, v && (p += Math.abs(v))), (this.repeat === "repeat-y" || this.repeat === "no-repeat") && (h = 1, y && (h += Math.abs(y))), c.src ? x = c.src : c.toDataURL && (x = c.toDataURL()), ' + + +`; + }, + /* _TO_SVG_END_ */ + setOptions: function(l) { + for (var c in l) + this[c] = l[c]; + }, + /** + * Returns an instance of CanvasPattern + * @param {CanvasRenderingContext2D} ctx Context to create pattern + * @return {CanvasPattern} + */ + toLive: function(l) { + var c = this.source; + return !c || typeof c.src < "u" && (!c.complete || c.naturalWidth === 0 || c.naturalHeight === 0) ? "" : l.createPattern(c, this.repeat); + } + } + ); + }(), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.toFixed; + if (l.Shadow) { + l.warn("fabric.Shadow is already defined."); + return; + } + l.Shadow = l.util.createClass( + /** @lends fabric.Shadow.prototype */ + { + /** + * Shadow color + * @type String + * @default + */ + color: "rgb(0,0,0)", + /** + * Shadow blur + * @type Number + */ + blur: 0, + /** + * Shadow horizontal offset + * @type Number + * @default + */ + offsetX: 0, + /** + * Shadow vertical offset + * @type Number + * @default + */ + offsetY: 0, + /** + * Whether the shadow should affect stroke operations + * @type Boolean + * @default + */ + affectStroke: !1, + /** + * Indicates whether toObject should include default values + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * When `false`, the shadow will scale with the object. + * When `true`, the shadow's offsetX, offsetY, and blur will not be affected by the object's scale. + * default to false + * @type Boolean + * @default + */ + nonScaling: !1, + /** + * Constructor + * @param {Object|String} [options] Options object with any of color, blur, offsetX, offsetY properties or string (e.g. "rgba(0,0,0,0.2) 2px 2px 10px") + * @return {fabric.Shadow} thisArg + */ + initialize: function(h) { + typeof h == "string" && (h = this._parseShadow(h)); + for (var p in h) + this[p] = h[p]; + this.id = l.Object.__uid++; + }, + /** + * @private + * @param {String} shadow Shadow value to parse + * @return {Object} Shadow object with color, offsetX, offsetY and blur + */ + _parseShadow: function(h) { + var p = h.trim(), y = l.Shadow.reOffsetsAndBlur.exec(p) || [], v = p.replace(l.Shadow.reOffsetsAndBlur, "") || "rgb(0,0,0)"; + return { + color: v.trim(), + offsetX: parseFloat(y[1], 10) || 0, + offsetY: parseFloat(y[2], 10) || 0, + blur: parseFloat(y[3], 10) || 0 + }; + }, + /** + * Returns a string representation of an instance + * @see http://www.w3.org/TR/css-text-decor-3/#text-shadow + * @return {String} Returns CSS3 text-shadow declaration + */ + toString: function() { + return [this.offsetX, this.offsetY, this.blur, this.color].join("px "); + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of a shadow + * @param {fabric.Object} object + * @return {String} SVG representation of a shadow + */ + toSVG: function(h) { + var p = 40, y = 40, v = l.Object.NUM_FRACTION_DIGITS, x = l.util.rotateVector( + { x: this.offsetX, y: this.offsetY }, + l.util.degreesToRadians(-h.angle) + ), I = 20, P = new l.Color(this.color); + return h.width && h.height && (p = c((Math.abs(x.x) + this.blur) / h.width, v) * 100 + I, y = c((Math.abs(x.y) + this.blur) / h.height, v) * 100 + I), h.flipX && (x.x *= -1), h.flipY && (x.y *= -1), ' + + + + + + + + + +`; + }, + /* _TO_SVG_END_ */ + /** + * Returns object representation of a shadow + * @return {Object} Object representation of a shadow instance + */ + toObject: function() { + if (this.includeDefaultValues) + return { + color: this.color, + blur: this.blur, + offsetX: this.offsetX, + offsetY: this.offsetY, + affectStroke: this.affectStroke, + nonScaling: this.nonScaling + }; + var h = {}, p = l.Shadow.prototype; + return ["color", "blur", "offsetX", "offsetY", "affectStroke", "nonScaling"].forEach(function(y) { + this[y] !== p[y] && (h[y] = this[y]); + }, this), h; + } + } + ), l.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/; + }(t), function() { + if (e.StaticCanvas) { + e.warn("fabric.StaticCanvas is already defined."); + return; + } + var a = e.util.object.extend, l = e.util.getElementOffset, c = e.util.removeFromArray, h = e.util.toFixed, p = e.util.transformPoint, y = e.util.invertTransform, v = e.util.getNodeCanvas, x = e.util.createCanvasElement, I = new Error("Could not initialize `canvas` element"); + e.StaticCanvas = e.util.createClass( + e.CommonMethods, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Constructor + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(P, F) { + F || (F = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(P, F); + }, + /** + * Background color of canvas instance. + * Should be set via {@link fabric.StaticCanvas#setBackgroundColor}. + * @type {(String|fabric.Pattern)} + * @default + */ + backgroundColor: "", + /** + * Background image of canvas instance. + * since 2.4.0 image caching is active, please when putting an image as background, add to the + * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom + * vale. As an alternative you can disable image objectCaching + * @type fabric.Image + * @default + */ + backgroundImage: null, + /** + * Overlay color of canvas instance. + * Should be set via {@link fabric.StaticCanvas#setOverlayColor} + * @since 1.3.9 + * @type {(String|fabric.Pattern)} + * @default + */ + overlayColor: "", + /** + * Overlay image of canvas instance. + * since 2.4.0 image caching is active, please when putting an image as overlay, add to the + * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom + * vale. As an alternative you can disable image objectCaching + * @type fabric.Image + * @default + */ + overlayImage: null, + /** + * Indicates whether toObject/toDatalessObject should include default values + * if set to false, takes precedence over the object value. + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * Indicates whether objects' state should be saved + * @type Boolean + * @default + */ + stateful: !1, + /** + * Indicates whether {@link fabric.Collection.add}, {@link fabric.Collection.insertAt} and {@link fabric.Collection.remove}, + * {@link fabric.StaticCanvas.moveTo}, {@link fabric.StaticCanvas.clear} and many more, should also re-render canvas. + * Disabling this option will not give a performance boost when adding/removing a lot of objects to/from canvas at once + * since the renders are quequed and executed one per frame. + * Disabling is suggested anyway and managing the renders of the app manually is not a big effort ( canvas.requestRenderAll() ) + * Left default to true to do not break documentation and old app, fiddles. + * @type Boolean + * @default + */ + renderOnAddRemove: !0, + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + * @type Boolean + * @default + */ + controlsAboveOverlay: !1, + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + * @type Boolean + * @default + */ + allowTouchScrolling: !1, + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + * @type Boolean + * @default + */ + imageSmoothingEnabled: !0, + /** + * The transformation (a Canvas 2D API transform matrix) which focuses the viewport + * @type Array + * @example Default transform + * canvas.viewportTransform = [1, 0, 0, 1, 0, 0]; + * @example Scale by 70% and translate toward bottom-right by 50, without skewing + * canvas.viewportTransform = [0.7, 0, 0, 0.7, 50, 50]; + * @default + */ + viewportTransform: e.iMatrix.concat(), + /** + * if set to false background image is not affected by viewport transform + * @since 1.6.3 + * @type Boolean + * @default + */ + backgroundVpt: !0, + /** + * if set to false overlya image is not affected by viewport transform + * @since 1.6.3 + * @type Boolean + * @default + */ + overlayVpt: !0, + /** + * When true, canvas is scaled by devicePixelRatio for better rendering on retina screens + * @type Boolean + * @default + */ + enableRetinaScaling: !0, + /** + * Describe canvas element extension over design + * properties are tl,tr,bl,br. + * if canvas is not zoomed/panned those points are the four corner of canvas + * if canvas is viewportTransformed you those points indicate the extension + * of canvas element in plain untrasformed coordinates + * The coordinates get updated with @method calcViewportBoundaries. + * @memberOf fabric.StaticCanvas.prototype + */ + vptCoords: {}, + /** + * Based on vptCoords and object.aCoords, skip rendering of objects that + * are not included in current viewport. + * May greatly help in applications with crowded canvas and use of zoom/pan + * If One of the corner of the bounding box of the object is on the canvas + * the objects get rendered. + * @memberOf fabric.StaticCanvas.prototype + * @type Boolean + * @default + */ + skipOffscreen: !0, + /** + * a fabricObject that, without stroke define a clipping area with their shape. filled in black + * the clipPath object gets used when the canvas has rendered, and the context is placed in the + * top left corner of the canvas. + * clipPath will clip away controls, if you do not want this to happen use controlsAboveOverlay = true + * @type fabric.Object + */ + clipPath: void 0, + /** + * @private + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + */ + _initStatic: function(P, F) { + var k = this.requestRenderAllBound; + this._objects = [], this._createLowerCanvas(P), this._initOptions(F), this.interactive || this._initRetinaScaling(), F.overlayImage && this.setOverlayImage(F.overlayImage, k), F.backgroundImage && this.setBackgroundImage(F.backgroundImage, k), F.backgroundColor && this.setBackgroundColor(F.backgroundColor, k), F.overlayColor && this.setOverlayColor(F.overlayColor, k), this.calcOffset(); + }, + /** + * @private + */ + _isRetinaScaling: function() { + return e.devicePixelRatio > 1 && this.enableRetinaScaling; + }, + /** + * @private + * @return {Number} retinaScaling if applied, otherwise 1; + */ + getRetinaScaling: function() { + return this._isRetinaScaling() ? Math.max(1, e.devicePixelRatio) : 1; + }, + /** + * @private + */ + _initRetinaScaling: function() { + if (this._isRetinaScaling()) { + var P = e.devicePixelRatio; + this.__initRetinaScaling(P, this.lowerCanvasEl, this.contextContainer), this.upperCanvasEl && this.__initRetinaScaling(P, this.upperCanvasEl, this.contextTop); + } + }, + __initRetinaScaling: function(P, F, k) { + F.setAttribute("width", this.width * P), F.setAttribute("height", this.height * P), k.scale(P, P); + }, + /** + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + * @return {fabric.Canvas} instance + * @chainable + */ + calcOffset: function() { + return this._offset = l(this.lowerCanvasEl), this; + }, + /** + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/MnzHT/|jsFiddle demo} + * @example Normal overlayImage with left/top = 0 + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * // Needed to position overlayImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example overlayImage with different properties + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top' + * }); + * @example Stretched overlayImage #1 - width/height correspond to canvas width/height + * fabric.Image.fromURL('http://fabricjs.com/assets/jail_cell_bars.png', function(img, isError) { + * img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'}); + * canvas.setOverlayImage(img, canvas.renderAll.bind(canvas)); + * }); + * @example Stretched overlayImage #2 - width/height correspond to canvas width/height + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * width: canvas.width, + * height: canvas.height, + * // Needed to position overlayImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example overlayImage loaded from cross-origin + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top', + * crossOrigin: 'anonymous' + * }); + */ + setOverlayImage: function(P, F, k) { + return this.__setBgOverlayImage("overlayImage", P, F, k); + }, + /** + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/djnr8o7a/28/|jsFiddle demo} + * @example Normal backgroundImage with left/top = 0 + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * // Needed to position backgroundImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example backgroundImage with different properties + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top' + * }); + * @example Stretched backgroundImage #1 - width/height correspond to canvas width/height + * fabric.Image.fromURL('http://fabricjs.com/assets/honey_im_subtle.png', function(img, isError) { + * img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'}); + * canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas)); + * }); + * @example Stretched backgroundImage #2 - width/height correspond to canvas width/height + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * width: canvas.width, + * height: canvas.height, + * // Needed to position backgroundImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example backgroundImage loaded from cross-origin + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top', + * crossOrigin: 'anonymous' + * }); + */ + // TODO: fix stretched examples + setBackgroundImage: function(P, F, k) { + return this.__setBgOverlayImage("backgroundImage", P, F, k); + }, + /** + * Sets {@link fabric.StaticCanvas#overlayColor|foreground color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set foreground color to + * @param {Function} callback Callback to invoke when foreground color is set + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/pB55h/|jsFiddle demo} + * @example Normal overlayColor - color value + * canvas.setOverlayColor('rgba(255, 73, 64, 0.6)', canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as overlayColor + * canvas.setOverlayColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png' + * }, canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as overlayColor with repeat and offset + * canvas.setOverlayColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png', + * repeat: 'repeat', + * offsetX: 200, + * offsetY: 100 + * }, canvas.renderAll.bind(canvas)); + */ + setOverlayColor: function(P, F) { + return this.__setBgOverlayColor("overlayColor", P, F); + }, + /** + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/hXzvk/|jsFiddle demo} + * @example Normal backgroundColor - color value + * canvas.setBackgroundColor('rgba(255, 73, 64, 0.6)', canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as backgroundColor + * canvas.setBackgroundColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png' + * }, canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as backgroundColor with repeat and offset + * canvas.setBackgroundColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png', + * repeat: 'repeat', + * offsetX: 200, + * offsetY: 100 + * }, canvas.renderAll.bind(canvas)); + */ + setBackgroundColor: function(P, F) { + return this.__setBgOverlayColor("backgroundColor", P, F); + }, + /** + * @private + * @param {String} property Property to set ({@link fabric.StaticCanvas#backgroundImage|backgroundImage} + * or {@link fabric.StaticCanvas#overlayImage|overlayImage}) + * @param {(fabric.Image|String|null)} image fabric.Image instance, URL of an image or null to set background or overlay to + * @param {Function} callback Callback to invoke when image is loaded and set as background or overlay. The first argument is the created image, the second argument is a flag indicating whether an error occurred or not. + * @param {Object} [options] Optional options to set for the {@link fabric.Image|image}. + */ + __setBgOverlayImage: function(P, F, k, V) { + return typeof F == "string" ? e.util.loadImage(F, function(j, Y) { + if (j) { + var X = new e.Image(j, V); + this[P] = X, X.canvas = this; + } + k && k(j, Y); + }, this, V && V.crossOrigin) : (V && F.setOptions(V), this[P] = F, F && (F.canvas = this), k && k(F, !1)), this; + }, + /** + * @private + * @param {String} property Property to set ({@link fabric.StaticCanvas#backgroundColor|backgroundColor} + * or {@link fabric.StaticCanvas#overlayColor|overlayColor}) + * @param {(Object|String|null)} color Object with pattern information, color value or null + * @param {Function} [callback] Callback is invoked when color is set + */ + __setBgOverlayColor: function(P, F, k) { + return this[P] = F, this._initGradient(F, P), this._initPattern(F, P, k), this; + }, + /** + * @private + */ + _createCanvasElement: function() { + var P = x(); + if (!P || (P.style || (P.style = {}), typeof P.getContext > "u")) + throw I; + return P; + }, + /** + * @private + * @param {Object} [options] Options object + */ + _initOptions: function(P) { + var F = this.lowerCanvasEl; + this._setOptions(P), this.width = this.width || parseInt(F.width, 10) || 0, this.height = this.height || parseInt(F.height, 10) || 0, this.lowerCanvasEl.style && (F.width = this.width, F.height = this.height, F.style.width = this.width + "px", F.style.height = this.height + "px", this.viewportTransform = this.viewportTransform.slice()); + }, + /** + * Creates a bottom canvas + * @private + * @param {HTMLElement} [canvasEl] + */ + _createLowerCanvas: function(P) { + P && P.getContext ? this.lowerCanvasEl = P : this.lowerCanvasEl = e.util.getById(P) || this._createCanvasElement(), e.util.addClass(this.lowerCanvasEl, "lower-canvas"), this._originalCanvasStyle = this.lowerCanvasEl.style, this.interactive && this._applyCanvasStyle(this.lowerCanvasEl), this.contextContainer = this.lowerCanvasEl.getContext("2d"); + }, + /** + * Returns canvas width (in px) + * @return {Number} + */ + getWidth: function() { + return this.width; + }, + /** + * Returns canvas height (in px) + * @return {Number} + */ + getHeight: function() { + return this.height; + }, + /** + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} instance + * @chainable true + */ + setWidth: function(P, F) { + return this.setDimensions({ width: P }, F); + }, + /** + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} instance + * @chainable true + */ + setHeight: function(P, F) { + return this.setDimensions({ height: P }, F); + }, + /** + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Number|String} [dimensions.width] Width of canvas element + * @param {Number|String} [dimensions.height] Height of canvas element + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} thisArg + * @chainable + */ + setDimensions: function(P, F) { + var k; + F = F || {}; + for (var V in P) + k = P[V], F.cssOnly || (this._setBackstoreDimension(V, P[V]), k += "px", this.hasLostContext = !0), F.backstoreOnly || this._setCssDimension(V, k); + return this._isCurrentlyDrawing && this.freeDrawingBrush && this.freeDrawingBrush._setBrushStyles(this.contextTop), this._initRetinaScaling(), this.calcOffset(), F.cssOnly || this.requestRenderAll(), this; + }, + /** + * Helper for setting width/height + * @private + * @param {String} prop property (width|height) + * @param {Number} value value to set property to + * @return {fabric.Canvas} instance + * @chainable true + */ + _setBackstoreDimension: function(P, F) { + return this.lowerCanvasEl[P] = F, this.upperCanvasEl && (this.upperCanvasEl[P] = F), this.cacheCanvasEl && (this.cacheCanvasEl[P] = F), this[P] = F, this; + }, + /** + * Helper for setting css width/height + * @private + * @param {String} prop property (width|height) + * @param {String} value value to set property to + * @return {fabric.Canvas} instance + * @chainable true + */ + _setCssDimension: function(P, F) { + return this.lowerCanvasEl.style[P] = F, this.upperCanvasEl && (this.upperCanvasEl.style[P] = F), this.wrapperEl && (this.wrapperEl.style[P] = F), this; + }, + /** + * Returns canvas zoom level + * @return {Number} + */ + getZoom: function() { + return this.viewportTransform[0]; + }, + /** + * Sets viewport transformation of this canvas instance + * @param {Array} vpt a Canvas 2D API transform matrix + * @return {fabric.Canvas} instance + * @chainable true + */ + setViewportTransform: function(P) { + var F = this._activeObject, k = this.backgroundImage, V = this.overlayImage, j, Y, X; + for (this.viewportTransform = P, Y = 0, X = this._objects.length; Y < X; Y++) + j = this._objects[Y], j.group || j.setCoords(!0); + return F && F.setCoords(), k && k.setCoords(!0), V && V.setCoords(!0), this.calcViewportBoundaries(), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Sets zoom level of this canvas instance, the zoom centered around point + * meaning that following zoom to point with the same point will have the visual + * effect of the zoom originating from that point. The point won't move. + * It has nothing to do with canvas center or visual center of the viewport. + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + * @return {fabric.Canvas} instance + * @chainable true + */ + zoomToPoint: function(P, F) { + var k = P, V = this.viewportTransform.slice(0); + P = p(P, y(this.viewportTransform)), V[0] = F, V[3] = F; + var j = p(P, V); + return V[4] += k.x - j.x, V[5] += k.y - j.y, this.setViewportTransform(V); + }, + /** + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + * @return {fabric.Canvas} instance + * @chainable true + */ + setZoom: function(P) { + return this.zoomToPoint(new e.Point(0, 0), P), this; + }, + /** + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + * @return {fabric.Canvas} instance + * @chainable true + */ + absolutePan: function(P) { + var F = this.viewportTransform.slice(0); + return F[4] = -P.x, F[5] = -P.y, this.setViewportTransform(F); + }, + /** + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + * @return {fabric.Canvas} instance + * @chainable true + */ + relativePan: function(P) { + return this.absolutePan(new e.Point( + -P.x - this.viewportTransform[4], + -P.y - this.viewportTransform[5] + )); + }, + /** + * Returns <canvas> element corresponding to this instance + * @return {HTMLCanvasElement} + */ + getElement: function() { + return this.lowerCanvasEl; + }, + /** + * @private + * @param {fabric.Object} obj Object that was added + */ + _onObjectAdded: function(P) { + this.stateful && P.setupState(), P._set("canvas", this), P.setCoords(), this.fire("object:added", { target: P }), P.fire("added"); + }, + /** + * @private + * @param {fabric.Object} obj Object that was removed + */ + _onObjectRemoved: function(P) { + this.fire("object:removed", { target: P }), P.fire("removed"), delete P.canvas; + }, + /** + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @return {fabric.Canvas} thisArg + * @chainable + */ + clearContext: function(P) { + return P.clearRect(0, 0, this.width, this.height), this; + }, + /** + * Returns context of canvas where objects are drawn + * @return {CanvasRenderingContext2D} + */ + getContext: function() { + return this.contextContainer; + }, + /** + * Clears all contexts (background, main, top) of an instance + * @return {fabric.Canvas} thisArg + * @chainable + */ + clear: function() { + return this.remove.apply(this, this.getObjects()), this.backgroundImage = null, this.overlayImage = null, this.backgroundColor = "", this.overlayColor = "", this._hasITextHandlers && (this.off("mouse:up", this._mouseUpITextHandler), this._iTextInstances = null, this._hasITextHandlers = !1), this.clearContext(this.contextContainer), this.fire("canvas:cleared"), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Renders the canvas + * @return {fabric.Canvas} instance + * @chainable + */ + renderAll: function() { + var P = this.contextContainer; + return this.renderCanvas(P, this._objects), this; + }, + /** + * Function created to be instance bound at initialization + * used in requestAnimationFrame rendering + * Let the fabricJS call it. If you call it manually you could have more + * animationFrame stacking on to of each other + * for an imperative rendering, use canvas.renderAll + * @private + * @return {fabric.Canvas} instance + * @chainable + */ + renderAndReset: function() { + this.isRendering = 0, this.renderAll(); + }, + /** + * Append a renderAll request to next animation frame. + * unless one is already in progress, in that case nothing is done + * a boolean flag will avoid appending more. + * @return {fabric.Canvas} instance + * @chainable + */ + requestRenderAll: function() { + return this.isRendering || (this.isRendering = e.util.requestAnimFrame(this.renderAndResetBound)), this; + }, + /** + * Calculate the position of the 4 corner of canvas with current viewportTransform. + * helps to determinate when an object is in the current rendering viewport using + * object absolute coordinates ( aCoords ) + * @return {Object} points.tl + * @chainable + */ + calcViewportBoundaries: function() { + var P = {}, F = this.width, k = this.height, V = y(this.viewportTransform); + return P.tl = p({ x: 0, y: 0 }, V), P.br = p({ x: F, y: k }, V), P.tr = new e.Point(P.br.x, P.tl.y), P.bl = new e.Point(P.tl.x, P.br.y), this.vptCoords = P, P; + }, + cancelRequestedRender: function() { + this.isRendering && (e.util.cancelAnimFrame(this.isRendering), this.isRendering = 0); + }, + /** + * Renders background, objects, overlay and controls. + * @param {CanvasRenderingContext2D} ctx + * @param {Array} objects to render + * @return {fabric.Canvas} instance + * @chainable + */ + renderCanvas: function(P, F) { + var k = this.viewportTransform, V = this.clipPath; + this.cancelRequestedRender(), this.calcViewportBoundaries(), this.clearContext(P), e.util.setImageSmoothing(P, this.imageSmoothingEnabled), this.fire("before:render", { ctx: P }), this._renderBackground(P), P.save(), P.transform(k[0], k[1], k[2], k[3], k[4], k[5]), this._renderObjects(P, F), P.restore(), !this.controlsAboveOverlay && this.interactive && this.drawControls(P), V && (V.canvas = this, V.shouldCache(), V._transformDone = !0, V.renderCache({ forClipping: !0 }), this.drawClipPathOnCanvas(P)), this._renderOverlay(P), this.controlsAboveOverlay && this.interactive && this.drawControls(P), this.fire("after:render", { ctx: P }); + }, + /** + * Paint the cached clipPath on the lowerCanvasEl + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawClipPathOnCanvas: function(P) { + var F = this.viewportTransform, k = this.clipPath; + P.save(), P.transform(F[0], F[1], F[2], F[3], F[4], F[5]), P.globalCompositeOperation = "destination-in", k.transform(P), P.scale(1 / k.zoomX, 1 / k.zoomY), P.drawImage(k._cacheCanvas, -k.cacheTranslationX, -k.cacheTranslationY), P.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Array} objects to render + */ + _renderObjects: function(P, F) { + var k, V; + for (k = 0, V = F.length; k < V; ++k) + F[k] && F[k].render(P); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {string} property 'background' or 'overlay' + */ + _renderBackgroundOrOverlay: function(P, F) { + var k = this[F + "Color"], V = this[F + "Image"], j = this.viewportTransform, Y = this[F + "Vpt"]; + if (!(!k && !V)) { + if (k) { + P.save(), P.beginPath(), P.moveTo(0, 0), P.lineTo(this.width, 0), P.lineTo(this.width, this.height), P.lineTo(0, this.height), P.closePath(), P.fillStyle = k.toLive ? k.toLive(P, this) : k, Y && P.transform(j[0], j[1], j[2], j[3], j[4], j[5]), P.transform(1, 0, 0, 1, k.offsetX || 0, k.offsetY || 0); + var X = k.gradientTransform || k.patternTransform; + X && P.transform(X[0], X[1], X[2], X[3], X[4], X[5]), P.fill(), P.restore(); + } + V && (P.save(), Y && P.transform(j[0], j[1], j[2], j[3], j[4], j[5]), V.render(P), P.restore()); + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderBackground: function(P) { + this._renderBackgroundOrOverlay(P, "background"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderOverlay: function(P) { + this._renderBackgroundOrOverlay(P, "overlay"); + }, + /** + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + * @return {Object} object with "top" and "left" number values + * @deprecated migrate to `getCenterPoint` + */ + getCenter: function() { + return { + top: this.height / 2, + left: this.width / 2 + }; + }, + /** + * Returns coordinates of a center of canvas. + * @return {fabric.Point} + */ + getCenterPoint: function() { + return new e.Point(this.width / 2, this.height / 2); + }, + /** + * Centers object horizontally in the canvas + * @param {fabric.Object} object Object to center horizontally + * @return {fabric.Canvas} thisArg + */ + centerObjectH: function(P) { + return this._centerObject(P, new e.Point(this.getCenterPoint().x, P.getCenterPoint().y)); + }, + /** + * Centers object vertically in the canvas + * @param {fabric.Object} object Object to center vertically + * @return {fabric.Canvas} thisArg + * @chainable + */ + centerObjectV: function(P) { + return this._centerObject(P, new e.Point(P.getCenterPoint().x, this.getCenterPoint().y)); + }, + /** + * Centers object vertically and horizontally in the canvas + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + centerObject: function(P) { + var F = this.getCenterPoint(); + return this._centerObject(P, F); + }, + /** + * Centers object vertically and horizontally in the viewport + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObject: function(P) { + var F = this.getVpCenter(); + return this._centerObject(P, F); + }, + /** + * Centers object horizontally in the viewport, object.top is unchanged + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObjectH: function(P) { + var F = this.getVpCenter(); + return this._centerObject(P, new e.Point(F.x, P.getCenterPoint().y)), this; + }, + /** + * Centers object Vertically in the viewport, object.top is unchanged + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObjectV: function(P) { + var F = this.getVpCenter(); + return this._centerObject(P, new e.Point(P.getCenterPoint().x, F.y)); + }, + /** + * Calculate the point in canvas that correspond to the center of actual viewport. + * @return {fabric.Point} vpCenter, viewport center + * @chainable + */ + getVpCenter: function() { + var P = this.getCenterPoint(), F = y(this.viewportTransform); + return p(P, F); + }, + /** + * @private + * @param {fabric.Object} object Object to center + * @param {fabric.Point} center Center point + * @return {fabric.Canvas} thisArg + * @chainable + */ + _centerObject: function(P, F) { + return P.setPositionByOrigin(F, "center", "center"), P.setCoords(), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Returns dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {String} json string + */ + toDatalessJSON: function(P) { + return this.toDatalessObject(P); + }, + /** + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(P) { + return this._toObjectMethod("toObject", P); + }, + /** + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(P) { + return this._toObjectMethod("toDatalessObject", P); + }, + /** + * @private + */ + _toObjectMethod: function(P, F) { + var k = this.clipPath, V = { + version: e.version, + objects: this._toObjects(P, F) + }; + return k && !k.excludeFromExport && (V.clipPath = this._toObject(this.clipPath, P, F)), a(V, this.__serializeBgOverlay(P, F)), e.util.populateWithProperties(this, V, F), V; + }, + /** + * @private + */ + _toObjects: function(P, F) { + return this._objects.filter(function(k) { + return !k.excludeFromExport; + }).map(function(k) { + return this._toObject(k, P, F); + }, this); + }, + /** + * @private + */ + _toObject: function(P, F, k) { + var V; + this.includeDefaultValues || (V = P.includeDefaultValues, P.includeDefaultValues = !1); + var j = P[F](k); + return this.includeDefaultValues || (P.includeDefaultValues = V), j; + }, + /** + * @private + */ + __serializeBgOverlay: function(P, F) { + var k = {}, V = this.backgroundImage, j = this.overlayImage, Y = this.backgroundColor, X = this.overlayColor; + return Y && Y.toObject ? Y.excludeFromExport || (k.background = Y.toObject(F)) : Y && (k.background = Y), X && X.toObject ? X.excludeFromExport || (k.overlay = X.toObject(F)) : X && (k.overlay = X), V && !V.excludeFromExport && (k.backgroundImage = this._toObject(V, P, F)), j && !j.excludeFromExport && (k.overlayImage = this._toObject(j, P, F)), k; + }, + /* _TO_SVG_START_ */ + /** + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + * @type Boolean + * @default + */ + svgViewportTransformation: !0, + /** + * Returns SVG representation of canvas + * @function + * @param {Object} [options] Options object for SVG output + * @param {Boolean} [options.suppressPreamble=false] If true xml tag is not included + * @param {Object} [options.viewBox] SVG viewbox object + * @param {Number} [options.viewBox.x] x-coordinate of viewbox + * @param {Number} [options.viewBox.y] y-coordinate of viewbox + * @param {Number} [options.viewBox.width] Width of viewbox + * @param {Number} [options.viewBox.height] Height of viewbox + * @param {String} [options.encoding=UTF-8] Encoding of SVG output + * @param {String} [options.width] desired width of svg with or without units + * @param {String} [options.height] desired height of svg with or without units + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + * @return {String} SVG string + * @tutorial {@link http://fabricjs.com/fabric-intro-part-3#serialization} + * @see {@link http://jsfiddle.net/fabricjs/jQ3ZZ/|jsFiddle demo} + * @example Normal SVG output + * var svg = canvas.toSVG(); + * @example SVG output without preamble (without <?xml ../>) + * var svg = canvas.toSVG({suppressPreamble: true}); + * @example SVG output with viewBox attribute + * var svg = canvas.toSVG({ + * viewBox: { + * x: 100, + * y: 100, + * width: 200, + * height: 300 + * } + * }); + * @example SVG output with different encoding (default: UTF-8) + * var svg = canvas.toSVG({encoding: 'ISO-8859-1'}); + * @example Modify SVG output with reviver function + * var svg = canvas.toSVG(null, function(svg) { + * return svg.replace('stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; ', ''); + * }); + */ + toSVG: function(P, F) { + P || (P = {}), P.reviver = F; + var k = []; + return this._setSVGPreamble(k, P), this._setSVGHeader(k, P), this.clipPath && k.push(' +`), this._setSVGBgOverlayColor(k, "background"), this._setSVGBgOverlayImage(k, "backgroundImage", F), this._setSVGObjects(k, F), this.clipPath && k.push(` +`), this._setSVGBgOverlayColor(k, "overlay"), this._setSVGBgOverlayImage(k, "overlayImage", F), k.push(""), k.join(""); + }, + /** + * @private + */ + _setSVGPreamble: function(P, F) { + F.suppressPreamble || P.push( + ' +`, + ' +` + ); + }, + /** + * @private + */ + _setSVGHeader: function(P, F) { + var k = F.width || this.width, V = F.height || this.height, j, Y = 'viewBox="0 0 ' + this.width + " " + this.height + '" ', X = e.Object.NUM_FRACTION_DIGITS; + F.viewBox ? Y = 'viewBox="' + F.viewBox.x + " " + F.viewBox.y + " " + F.viewBox.width + " " + F.viewBox.height + '" ' : this.svgViewportTransformation && (j = this.viewportTransform, Y = 'viewBox="' + h(-j[4] / j[0], X) + " " + h(-j[5] / j[3], X) + " " + h(this.width / j[0], X) + " " + h(this.height / j[3], X) + '" '), P.push( + " +`, + "Created with Fabric.js ", + e.version, + ` +`, + ` +`, + this.createSVGFontFacesMarkup(), + this.createSVGRefElementsMarkup(), + this.createSVGClipPathMarkup(F), + ` +` + ); + }, + createSVGClipPathMarkup: function(P) { + var F = this.clipPath; + return F ? (F.clipPathId = "CLIPPATH_" + e.Object.__uid++, ' +` + this.clipPath.toClipPathSVG(P.reviver) + ` +`) : ""; + }, + /** + * Creates markup containing SVG referenced elements like patterns, gradients etc. + * @return {String} + */ + createSVGRefElementsMarkup: function() { + var P = this, F = ["background", "overlay"].map(function(k) { + var V = P[k + "Color"]; + if (V && V.toLive) { + var j = P[k + "Vpt"], Y = P.viewportTransform, X = { + width: P.width / (j ? Y[0] : 1), + height: P.height / (j ? Y[3] : 1) + }; + return V.toSVG( + X, + { additionalTransform: j ? e.util.matrixToSVG(Y) : "" } + ); + } + }); + return F.join(""); + }, + /** + * Creates markup containing SVG font faces, + * font URLs for font faces must be collected by developers + * and are not extracted from the DOM by fabricjs + * @param {Array} objects Array of fabric objects + * @return {String} + */ + createSVGFontFacesMarkup: function() { + var P = "", F = {}, k, V, j, Y, X, Q, re, he, fe, be = e.fontPaths, Se = []; + for (this._objects.forEach(function ke(J) { + Se.push(J), J._objects && J._objects.forEach(ke); + }), he = 0, fe = Se.length; he < fe; he++) + if (k = Se[he], V = k.fontFamily, !(k.type.indexOf("text") === -1 || F[V] || !be[V]) && (F[V] = !0, !!k.styles)) { + j = k.styles; + for (X in j) { + Y = j[X]; + for (re in Y) + Q = Y[re], V = Q.fontFamily, !F[V] && be[V] && (F[V] = !0); + } + } + for (var Me in F) + P += [ + ` @font-face { +`, + " font-family: '", + Me, + `'; +`, + " src: url('", + be[Me], + `'); +`, + ` } +` + ].join(""); + return P && (P = [ + ' +` + ].join("")), P; + }, + /** + * @private + */ + _setSVGObjects: function(P, F) { + var k, V, j, Y = this._objects; + for (V = 0, j = Y.length; V < j; V++) + k = Y[V], !k.excludeFromExport && this._setSVGObject(P, k, F); + }, + /** + * @private + */ + _setSVGObject: function(P, F, k) { + P.push(F.toSVG(k)); + }, + /** + * @private + */ + _setSVGBgOverlayImage: function(P, F, k) { + this[F] && !this[F].excludeFromExport && this[F].toSVG && P.push(this[F].toSVG(k)); + }, + /** + * @private + */ + _setSVGBgOverlayColor: function(P, F) { + var k = this[F + "Color"], V = this.viewportTransform, j = this.width, Y = this.height; + if (k) + if (k.toLive) { + var X = k.repeat, Q = e.util.invertTransform(V), re = this[F + "Vpt"], he = re ? e.util.matrixToSVG(Q) : ""; + P.push( + ' +` + ); + } else + P.push( + ' +` + ); + }, + /* _TO_SVG_END_ */ + /** + * Moves an object or the objects of a multiple selection + * to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @return {fabric.Canvas} thisArg + * @chainable + */ + sendToBack: function(P) { + if (!P) + return this; + var F = this._activeObject, k, V, j; + if (P === F && P.type === "activeSelection") + for (j = F._objects, k = j.length; k--; ) + V = j[k], c(this._objects, V), this._objects.unshift(V); + else + c(this._objects, P), this._objects.unshift(P); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Moves an object or the objects of a multiple selection + * to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @return {fabric.Canvas} thisArg + * @chainable + */ + bringToFront: function(P) { + if (!P) + return this; + var F = this._activeObject, k, V, j; + if (P === F && P.type === "activeSelection") + for (j = F._objects, k = 0; k < j.length; k++) + V = j[k], c(this._objects, V), this._objects.push(V); + else + c(this._objects, P), this._objects.push(P); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Moves an object or a selection down in stack of drawn objects + * An optional parameter, intersecting allows to move the object in behind + * the first intersecting object. Where intersection is calculated with + * bounding box. If no intersection is found, there will not be change in the + * stack. + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @return {fabric.Canvas} thisArg + * @chainable + */ + sendBackwards: function(P, F) { + if (!P) + return this; + var k = this._activeObject, V, j, Y, X, Q, re = 0; + if (P === k && P.type === "activeSelection") + for (Q = k._objects, V = 0; V < Q.length; V++) + j = Q[V], Y = this._objects.indexOf(j), Y > 0 + re && (X = Y - 1, c(this._objects, j), this._objects.splice(X, 0, j)), re++; + else + Y = this._objects.indexOf(P), Y !== 0 && (X = this._findNewLowerIndex(P, Y, F), c(this._objects, P), this._objects.splice(X, 0, P)); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * @private + */ + _findNewLowerIndex: function(P, F, k) { + var V, j; + if (k) + for (V = F, j = F - 1; j >= 0; --j) { + var Y = P.intersectsWithObject(this._objects[j]) || P.isContainedWithinObject(this._objects[j]) || this._objects[j].isContainedWithinObject(P); + if (Y) { + V = j; + break; + } + } + else + V = F - 1; + return V; + }, + /** + * Moves an object or a selection up in stack of drawn objects + * An optional parameter, intersecting allows to move the object in front + * of the first intersecting object. Where intersection is calculated with + * bounding box. If no intersection is found, there will not be change in the + * stack. + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @return {fabric.Canvas} thisArg + * @chainable + */ + bringForward: function(P, F) { + if (!P) + return this; + var k = this._activeObject, V, j, Y, X, Q, re = 0; + if (P === k && P.type === "activeSelection") + for (Q = k._objects, V = Q.length; V--; ) + j = Q[V], Y = this._objects.indexOf(j), Y < this._objects.length - 1 - re && (X = Y + 1, c(this._objects, j), this._objects.splice(X, 0, j)), re++; + else + Y = this._objects.indexOf(P), Y !== this._objects.length - 1 && (X = this._findNewUpperIndex(P, Y, F), c(this._objects, P), this._objects.splice(X, 0, P)); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * @private + */ + _findNewUpperIndex: function(P, F, k) { + var V, j, Y; + if (k) + for (V = F, j = F + 1, Y = this._objects.length; j < Y; ++j) { + var X = P.intersectsWithObject(this._objects[j]) || P.isContainedWithinObject(this._objects[j]) || this._objects[j].isContainedWithinObject(P); + if (X) { + V = j; + break; + } + } + else + V = F + 1; + return V; + }, + /** + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @return {fabric.Canvas} thisArg + * @chainable + */ + moveTo: function(P, F) { + return c(this._objects, P), this._objects.splice(F, 0, P), this.renderOnAddRemove && this.requestRenderAll(); + }, + /** + * Clears a canvas element and dispose objects + * @return {fabric.Canvas} thisArg + * @chainable + */ + dispose: function() { + return this.isRendering && (e.util.cancelAnimFrame(this.isRendering), this.isRendering = 0), this.forEachObject(function(P) { + P.dispose && P.dispose(); + }), this._objects = [], this.backgroundImage && this.backgroundImage.dispose && this.backgroundImage.dispose(), this.backgroundImage = null, this.overlayImage && this.overlayImage.dispose && this.overlayImage.dispose(), this.overlayImage = null, this._iTextInstances = null, this.contextContainer = null, this.lowerCanvasEl.classList.remove("lower-canvas"), e.util.setStyle(this.lowerCanvasEl, this._originalCanvasStyle), delete this._originalCanvasStyle, this.lowerCanvasEl.setAttribute("width", this.width), this.lowerCanvasEl.setAttribute("height", this.height), e.util.cleanUpJsdomNode(this.lowerCanvasEl), this.lowerCanvasEl = void 0, this; + }, + /** + * Returns a string representation of an instance + * @return {String} string representation of an instance + */ + toString: function() { + return "#"; + } + } + ), a(e.StaticCanvas.prototype, e.Observable), a(e.StaticCanvas.prototype, e.Collection), a(e.StaticCanvas.prototype, e.DataURLExporter), a( + e.StaticCanvas, + /** @lends fabric.StaticCanvas */ + { + /** + * @static + * @type String + * @default + */ + EMPTY_JSON: '{"objects": [], "background": "white"}', + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * + * @param {String} methodName Method to check support for; + * Could be one of "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), + * `null` if canvas element or context can not be initialized + */ + supports: function(P) { + var F = x(); + if (!F || !F.getContext) + return null; + var k = F.getContext("2d"); + if (!k) + return null; + switch (P) { + case "setLineDash": + return typeof k.setLineDash < "u"; + default: + return null; + } + } + } + ), e.StaticCanvas.prototype.toJSON = e.StaticCanvas.prototype.toObject, e.isLikelyNode && (e.StaticCanvas.prototype.createPNGStream = function() { + var P = v(this.lowerCanvasEl); + return P && P.createPNGStream(); + }, e.StaticCanvas.prototype.createJPEGStream = function(P) { + var F = v(this.lowerCanvasEl); + return F && F.createJPEGStream(P); + }); + }(), e.BaseBrush = e.util.createClass( + /** @lends fabric.BaseBrush.prototype */ + { + /** + * Color of a brush + * @type String + * @default + */ + color: "rgb(0, 0, 0)", + /** + * Width of a brush, has to be a Number, no string literals + * @type Number + * @default + */ + width: 1, + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), + * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * Line endings style of a brush (one of "butt", "round", "square") + * @type String + * @default + */ + strokeLineCap: "round", + /** + * Corner style of a brush (one of "bevel", "round", "miter") + * @type String + * @default + */ + strokeLineJoin: "round", + /** + * Maximum miter length (used for strokeLineJoin = "miter") of a brush's + * @type Number + * @default + */ + strokeMiterLimit: 10, + /** + * Stroke Dash Array. + * @type Array + * @default + */ + strokeDashArray: null, + /** + * When `true`, the free drawing is limited to the whiteboard size. Default to false. + * @type Boolean + * @default false + */ + limitedToCanvasSize: !1, + /** + * Sets brush styles + * @private + * @param {CanvasRenderingContext2D} ctx + */ + _setBrushStyles: function(a) { + a.strokeStyle = this.color, a.lineWidth = this.width, a.lineCap = this.strokeLineCap, a.miterLimit = this.strokeMiterLimit, a.lineJoin = this.strokeLineJoin, a.setLineDash(this.strokeDashArray || []); + }, + /** + * Sets the transformation on given context + * @param {RenderingContext2d} ctx context to render on + * @private + */ + _saveAndTransform: function(a) { + var l = this.canvas.viewportTransform; + a.save(), a.transform(l[0], l[1], l[2], l[3], l[4], l[5]); + }, + /** + * Sets brush shadow styles + * @private + */ + _setShadow: function() { + if (this.shadow) { + var a = this.canvas, l = this.shadow, c = a.contextTop, h = a.getZoom(); + a && a._isRetinaScaling() && (h *= e.devicePixelRatio), c.shadowColor = l.color, c.shadowBlur = l.blur * h, c.shadowOffsetX = l.offsetX * h, c.shadowOffsetY = l.offsetY * h; + } + }, + needsFullRender: function() { + var a = new e.Color(this.color); + return a.getAlpha() < 1 || !!this.shadow; + }, + /** + * Removes brush shadow styles + * @private + */ + _resetShadow: function() { + var a = this.canvas.contextTop; + a.shadowColor = "", a.shadowBlur = a.shadowOffsetX = a.shadowOffsetY = 0; + }, + /** + * Check is pointer is outside canvas boundaries + * @param {Object} pointer + * @private + */ + _isOutSideCanvas: function(a) { + return a.x < 0 || a.x > this.canvas.getWidth() || a.y < 0 || a.y > this.canvas.getHeight(); + } + } + ), function() { + e.PencilBrush = e.util.createClass( + e.BaseBrush, + /** @lends fabric.PencilBrush.prototype */ + { + /** + * Discard points that are less than `decimate` pixel distant from each other + * @type Number + * @default 0.4 + */ + decimate: 0.4, + /** + * Draws a straight line between last recorded point to current pointer + * Used for `shift` functionality + * + * @type boolean + * @default false + */ + drawStraightLine: !1, + /** + * The event modifier key that makes the brush draw a straight line. + * If `null` or 'none' or any other string that is not a modifier key the feature is disabled. + * @type {'altKey' | 'shiftKey' | 'ctrlKey' | 'none' | undefined | null} + */ + straightLineKey: "shiftKey", + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.PencilBrush} Instance of a pencil brush + */ + initialize: function(a) { + this.canvas = a, this._points = []; + }, + needsFullRender: function() { + return this.callSuper("needsFullRender") || this._hasStraightLine; + }, + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + _drawSegment: function(a, l, c) { + var h = l.midPointFrom(c); + return a.quadraticCurveTo(l.x, l.y, h.x, h.y), h; + }, + /** + * Invoked on mouse down + * @param {Object} pointer + */ + onMouseDown: function(a, l) { + this.canvas._isMainEvent(l.e) && (this.drawStraightLine = l.e[this.straightLineKey], this._prepareForDrawing(a), this._captureDrawingPath(a), this._render()); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(a, l) { + if (this.canvas._isMainEvent(l.e) && (this.drawStraightLine = l.e[this.straightLineKey], !(this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a)) && this._captureDrawingPath(a) && this._points.length > 1)) + if (this.needsFullRender()) + this.canvas.clearContext(this.canvas.contextTop), this._render(); + else { + var c = this._points, h = c.length, p = this.canvas.contextTop; + this._saveAndTransform(p), this.oldEnd && (p.beginPath(), p.moveTo(this.oldEnd.x, this.oldEnd.y)), this.oldEnd = this._drawSegment(p, c[h - 2], c[h - 1], !0), p.stroke(), p.restore(); + } + }, + /** + * Invoked on mouse up + */ + onMouseUp: function(a) { + return this.canvas._isMainEvent(a.e) ? (this.drawStraightLine = !1, this.oldEnd = void 0, this._finalizeAndAddPath(), !1) : !0; + }, + /** + * @private + * @param {Object} pointer Actual mouse position related to the canvas. + */ + _prepareForDrawing: function(a) { + var l = new e.Point(a.x, a.y); + this._reset(), this._addPoint(l), this.canvas.contextTop.moveTo(l.x, l.y); + }, + /** + * @private + * @param {fabric.Point} point Point to be added to points array + */ + _addPoint: function(a) { + return this._points.length > 1 && a.eq(this._points[this._points.length - 1]) ? !1 : (this.drawStraightLine && this._points.length > 1 && (this._hasStraightLine = !0, this._points.pop()), this._points.push(a), !0); + }, + /** + * Clear points array and set contextTop canvas style. + * @private + */ + _reset: function() { + this._points = [], this._setBrushStyles(this.canvas.contextTop), this._setShadow(), this._hasStraightLine = !1; + }, + /** + * @private + * @param {Object} pointer Actual mouse position related to the canvas. + */ + _captureDrawingPath: function(a) { + var l = new e.Point(a.x, a.y); + return this._addPoint(l); + }, + /** + * Draw a smooth path on the topCanvas using quadraticCurveTo + * @private + * @param {CanvasRenderingContext2D} [ctx] + */ + _render: function(a) { + var l, c, h = this._points[0], p = this._points[1]; + if (a = a || this.canvas.contextTop, this._saveAndTransform(a), a.beginPath(), this._points.length === 2 && h.x === p.x && h.y === p.y) { + var y = this.width / 1e3; + h = new e.Point(h.x, h.y), p = new e.Point(p.x, p.y), h.x -= y, p.x += y; + } + for (a.moveTo(h.x, h.y), l = 1, c = this._points.length; l < c; l++) + this._drawSegment(a, h, p), h = this._points[l], p = this._points[l + 1]; + a.lineTo(h.x, h.y), a.stroke(), a.restore(); + }, + /** + * Converts points to SVG path + * @param {Array} points Array of points + * @return {(string|number)[][]} SVG path commands + */ + convertPointsToSVGPath: function(a) { + var l = this.width / 1e3; + return e.util.getSmoothPathFromPoints(a, l); + }, + /** + * @private + * @param {(string|number)[][]} pathData SVG path commands + * @returns {boolean} + */ + _isEmptySVGPath: function(a) { + var l = e.util.joinPath(a); + return l === "M 0 0 Q 0 0 0 0 L 0 0"; + }, + /** + * Creates fabric.Path object to add on canvas + * @param {(string|number)[][]} pathData Path data + * @return {fabric.Path} Path to add on canvas + */ + createPath: function(a) { + var l = new e.Path(a, { + fill: null, + stroke: this.color, + strokeWidth: this.width, + strokeLineCap: this.strokeLineCap, + strokeMiterLimit: this.strokeMiterLimit, + strokeLineJoin: this.strokeLineJoin, + strokeDashArray: this.strokeDashArray + }); + return this.shadow && (this.shadow.affectStroke = !0, l.shadow = new e.Shadow(this.shadow)), l; + }, + /** + * Decimate points array with the decimate value + */ + decimatePoints: function(a, l) { + if (a.length <= 2) + return a; + var c = this.canvas.getZoom(), h = Math.pow(l / c, 2), p, y = a.length - 1, v = a[0], x = [v], I; + for (p = 1; p < y - 1; p++) + I = Math.pow(v.x - a[p].x, 2) + Math.pow(v.y - a[p].y, 2), I >= h && (v = a[p], x.push(v)); + return x.push(a[y]), x; + }, + /** + * On mouseup after drawing the path on contextTop canvas + * we use the points captured to create an new fabric path object + * and add it to the fabric canvas. + */ + _finalizeAndAddPath: function() { + var a = this.canvas.contextTop; + a.closePath(), this.decimate && (this._points = this.decimatePoints(this._points, this.decimate)); + var l = this.convertPointsToSVGPath(this._points); + if (this._isEmptySVGPath(l)) { + this.canvas.requestRenderAll(); + return; + } + var c = this.createPath(l); + this.canvas.clearContext(this.canvas.contextTop), this.canvas.fire("before:path:created", { path: c }), this.canvas.add(c), this.canvas.requestRenderAll(), c.setCoords(), this._resetShadow(), this.canvas.fire("path:created", { path: c }); + } + } + ); + }(), e.CircleBrush = e.util.createClass( + e.BaseBrush, + /** @lends fabric.CircleBrush.prototype */ + { + /** + * Width of a brush + * @type Number + * @default + */ + width: 10, + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.CircleBrush} Instance of a circle brush + */ + initialize: function(a) { + this.canvas = a, this.points = []; + }, + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + drawDot: function(a) { + var l = this.addPoint(a), c = this.canvas.contextTop; + this._saveAndTransform(c), this.dot(c, l), c.restore(); + }, + dot: function(a, l) { + a.fillStyle = l.fill, a.beginPath(), a.arc(l.x, l.y, l.radius, 0, Math.PI * 2, !1), a.closePath(), a.fill(); + }, + /** + * Invoked on mouse down + */ + onMouseDown: function(a) { + this.points.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.drawDot(a); + }, + /** + * Render the full state of the brush + * @private + */ + _render: function() { + var a = this.canvas.contextTop, l, c, h = this.points; + for (this._saveAndTransform(a), l = 0, c = h.length; l < c; l++) + this.dot(a, h[l]); + a.restore(); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(a) { + this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a) || (this.needsFullRender() ? (this.canvas.clearContext(this.canvas.contextTop), this.addPoint(a), this._render()) : this.drawDot(a)); + }, + /** + * Invoked on mouse up + */ + onMouseUp: function() { + var a = this.canvas.renderOnAddRemove, l, c; + this.canvas.renderOnAddRemove = !1; + var h = []; + for (l = 0, c = this.points.length; l < c; l++) { + var p = this.points[l], y = new e.Circle({ + radius: p.radius, + left: p.x, + top: p.y, + originX: "center", + originY: "center", + fill: p.fill + }); + this.shadow && (y.shadow = new e.Shadow(this.shadow)), h.push(y); + } + var v = new e.Group(h); + v.canvas = this.canvas, this.canvas.fire("before:path:created", { path: v }), this.canvas.add(v), this.canvas.fire("path:created", { path: v }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = a, this.canvas.requestRenderAll(); + }, + /** + * @param {Object} pointer + * @return {fabric.Point} Just added pointer point + */ + addPoint: function(a) { + var l = new e.Point(a.x, a.y), c = e.util.getRandomInt( + Math.max(0, this.width - 20), + this.width + 20 + ) / 2, h = new e.Color(this.color).setAlpha(e.util.getRandomInt(0, 100) / 100).toRgba(); + return l.radius = c, l.fill = h, this.points.push(l), l; + } + } + ), e.SprayBrush = e.util.createClass( + e.BaseBrush, + /** @lends fabric.SprayBrush.prototype */ + { + /** + * Width of a spray + * @type Number + * @default + */ + width: 10, + /** + * Density of a spray (number of dots per chunk) + * @type Number + * @default + */ + density: 20, + /** + * Width of spray dots + * @type Number + * @default + */ + dotWidth: 1, + /** + * Width variance of spray dots + * @type Number + * @default + */ + dotWidthVariance: 1, + /** + * Whether opacity of a dot should be random + * @type Boolean + * @default + */ + randomOpacity: !1, + /** + * Whether overlapping dots (rectangles) should be removed (for performance reasons) + * @type Boolean + * @default + */ + optimizeOverlapping: !0, + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.SprayBrush} Instance of a spray brush + */ + initialize: function(a) { + this.canvas = a, this.sprayChunks = []; + }, + /** + * Invoked on mouse down + * @param {Object} pointer + */ + onMouseDown: function(a) { + this.sprayChunks.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.addSprayChunk(a), this.render(this.sprayChunkPoints); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(a) { + this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a) || (this.addSprayChunk(a), this.render(this.sprayChunkPoints)); + }, + /** + * Invoked on mouse up + */ + onMouseUp: function() { + var a = this.canvas.renderOnAddRemove; + this.canvas.renderOnAddRemove = !1; + for (var l = [], c = 0, h = this.sprayChunks.length; c < h; c++) + for (var p = this.sprayChunks[c], y = 0, v = p.length; y < v; y++) { + var x = new e.Rect({ + width: p[y].width, + height: p[y].width, + left: p[y].x + 1, + top: p[y].y + 1, + originX: "center", + originY: "center", + fill: this.color + }); + l.push(x); + } + this.optimizeOverlapping && (l = this._getOptimizedRects(l)); + var I = new e.Group(l); + this.shadow && I.set("shadow", new e.Shadow(this.shadow)), this.canvas.fire("before:path:created", { path: I }), this.canvas.add(I), this.canvas.fire("path:created", { path: I }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = a, this.canvas.requestRenderAll(); + }, + /** + * @private + * @param {Array} rects + */ + _getOptimizedRects: function(a) { + var l = {}, c, h, p; + for (h = 0, p = a.length; h < p; h++) + c = a[h].left + "" + a[h].top, l[c] || (l[c] = a[h]); + var y = []; + for (c in l) + y.push(l[c]); + return y; + }, + /** + * Render new chunk of spray brush + */ + render: function(a) { + var l = this.canvas.contextTop, c, h; + for (l.fillStyle = this.color, this._saveAndTransform(l), c = 0, h = a.length; c < h; c++) { + var p = a[c]; + typeof p.opacity < "u" && (l.globalAlpha = p.opacity), l.fillRect(p.x, p.y, p.width, p.width); + } + l.restore(); + }, + /** + * Render all spray chunks + */ + _render: function() { + var a = this.canvas.contextTop, l, c; + for (a.fillStyle = this.color, this._saveAndTransform(a), l = 0, c = this.sprayChunks.length; l < c; l++) + this.render(this.sprayChunks[l]); + a.restore(); + }, + /** + * @param {Object} pointer + */ + addSprayChunk: function(a) { + this.sprayChunkPoints = []; + var l, c, h, p = this.width / 2, y; + for (y = 0; y < this.density; y++) { + l = e.util.getRandomInt(a.x - p, a.x + p), c = e.util.getRandomInt(a.y - p, a.y + p), this.dotWidthVariance ? h = e.util.getRandomInt( + // bottom clamp width to 1 + Math.max(1, this.dotWidth - this.dotWidthVariance), + this.dotWidth + this.dotWidthVariance + ) : h = this.dotWidth; + var v = new e.Point(l, c); + v.width = h, this.randomOpacity && (v.opacity = e.util.getRandomInt(0, 100) / 100), this.sprayChunkPoints.push(v); + } + this.sprayChunks.push(this.sprayChunkPoints); + } + } + ), e.PatternBrush = e.util.createClass( + e.PencilBrush, + /** @lends fabric.PatternBrush.prototype */ + { + getPatternSrc: function() { + var a = 20, l = 5, c = e.util.createCanvasElement(), h = c.getContext("2d"); + return c.width = c.height = a + l, h.fillStyle = this.color, h.beginPath(), h.arc(a / 2, a / 2, a / 2, 0, Math.PI * 2, !1), h.closePath(), h.fill(), c; + }, + getPatternSrcFunction: function() { + return String(this.getPatternSrc).replace("this.color", '"' + this.color + '"'); + }, + /** + * Creates "pattern" instance property + * @param {CanvasRenderingContext2D} ctx + */ + getPattern: function(a) { + return a.createPattern(this.source || this.getPatternSrc(), "repeat"); + }, + /** + * Sets brush styles + * @param {CanvasRenderingContext2D} ctx + */ + _setBrushStyles: function(a) { + this.callSuper("_setBrushStyles", a), a.strokeStyle = this.getPattern(a); + }, + /** + * Creates path + */ + createPath: function(a) { + var l = this.callSuper("createPath", a), c = l._getLeftTopCoords().scalarAdd(l.strokeWidth / 2); + return l.stroke = new e.Pattern({ + source: this.source || this.getPatternSrcFunction(), + offsetX: -c.x, + offsetY: -c.y + }), l; + } + } + ), function() { + var a = e.util.getPointer, l = e.util.degreesToRadians, c = e.util.isTouchEvent; + e.Canvas = e.util.createClass( + e.StaticCanvas, + /** @lends fabric.Canvas.prototype */ + { + /** + * Constructor + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(p, y) { + y || (y = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(p, y), this._initInteractive(), this._createCacheCanvas(); + }, + /** + * When true, objects can be transformed by one side (unproportionally) + * when dragged on the corners that normally would not do that. + * @type Boolean + * @default + * @since fabric 4.0 // changed name and default value + */ + uniformScaling: !0, + /** + * Indicates which key switches uniform scaling. + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled. + * totally wrong named. this sounds like `uniform scaling` + * if Canvas.uniformScaling is true, pressing this will set it to false + * and viceversa. + * @since 1.6.2 + * @type String + * @default + */ + uniScaleKey: "shiftKey", + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredScaling: !1, + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredRotation: !1, + /** + * Indicates which key enable centered Transform + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled feature disabled. + * @since 1.6.2 + * @type String + * @default + */ + centeredKey: "altKey", + /** + * Indicates which key enable alternate action on corner + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled feature disabled. + * @since 1.6.2 + * @type String + * @default + */ + altActionKey: "shiftKey", + /** + * Indicates that canvas is interactive. This property should not be changed. + * @type Boolean + * @default + */ + interactive: !0, + /** + * Indicates whether group selection should be enabled + * @type Boolean + * @default + */ + selection: !0, + /** + * Indicates which key or keys enable multiple click selection + * Pass value as a string or array of strings + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or empty or containing any other string that is not a modifier key + * feature is disabled. + * @since 1.6.2 + * @type String|Array + * @default + */ + selectionKey: "shiftKey", + /** + * Indicates which key enable alternative selection + * in case of target overlapping with active object + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * For a series of reason that come from the general expectations on how + * things should work, this feature works only for preserveObjectStacking true. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled. + * @since 1.6.5 + * @type null|String + * @default + */ + altSelectionKey: null, + /** + * Color of selection + * @type String + * @default + */ + selectionColor: "rgba(100, 100, 255, 0.3)", + // blue + /** + * Default dash array pattern + * If not empty the selection border is dashed + * @type Array + */ + selectionDashArray: [], + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + * @type String + * @default + */ + selectionBorderColor: "rgba(255, 255, 255, 0.3)", + /** + * Width of a line used in object/group selection + * @type Number + * @default + */ + selectionLineWidth: 1, + /** + * Select only shapes that are fully contained in the dragged selection rectangle. + * @type Boolean + * @default + */ + selectionFullyContained: !1, + /** + * Default cursor value used when hovering over an object on canvas + * @type String + * @default + */ + hoverCursor: "move", + /** + * Default cursor value used when moving an object on canvas + * @type String + * @default + */ + moveCursor: "move", + /** + * Default cursor value used for the entire canvas + * @type String + * @default + */ + defaultCursor: "default", + /** + * Cursor value used during free drawing + * @type String + * @default + */ + freeDrawingCursor: "crosshair", + /** + * Cursor value used for disabled elements ( corners with disabled action ) + * @type String + * @since 2.0.0 + * @default + */ + notAllowedCursor: "not-allowed", + /** + * Default element class that's given to wrapper (div) element of canvas + * @type String + * @default + */ + containerClass: "canvas-container", + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + * @type Boolean + * @default + */ + perPixelTargetFind: !1, + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + * @type Number + * @default + */ + targetFindTolerance: 0, + /** + * When true, target detection is skipped. Target detection will return always undefined. + * click selection won't work anymore, events will fire with no targets. + * if something is selected before setting it to true, it will be deselected at the first click. + * area selection will still work. check the `selection` property too. + * if you deactivate both, you should look into staticCanvas. + * @type Boolean + * @default + */ + skipTargetFind: !1, + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + * @tutorial {@link http://fabricjs.com/fabric-intro-part-4#free_drawing} + * @type Boolean + * @default + */ + isDrawingMode: !1, + /** + * Indicates whether objects should remain in current stack position when selected. + * When false objects are brought to top and rendered as part of the selection group + * @type Boolean + * @default + */ + preserveObjectStacking: !1, + /** + * Indicates the angle that an object will lock to while rotating. + * @type Number + * @since 1.6.7 + * @default + */ + snapAngle: 0, + /** + * Indicates the distance from the snapAngle the rotation will lock to the snapAngle. + * When `null`, the snapThreshold will default to the snapAngle. + * @type null|Number + * @since 1.6.7 + * @default + */ + snapThreshold: null, + /** + * Indicates if the right click on canvas can output the context menu or not + * @type Boolean + * @since 1.6.5 + * @default + */ + stopContextMenu: !1, + /** + * Indicates if the canvas can fire right click events + * @type Boolean + * @since 1.6.5 + * @default + */ + fireRightClick: !1, + /** + * Indicates if the canvas can fire middle click events + * @type Boolean + * @since 1.7.8 + * @default + */ + fireMiddleClick: !1, + /** + * Keep track of the subTargets for Mouse Events + * @type fabric.Object[] + */ + targets: [], + /** + * When the option is enabled, PointerEvent is used instead of MouseEvent. + * @type Boolean + * @default + */ + enablePointerEvents: !1, + /** + * Keep track of the hovered target + * @type fabric.Object + * @private + */ + _hoveredTarget: null, + /** + * hold the list of nested targets hovered + * @type fabric.Object[] + * @private + */ + _hoveredTargets: [], + /** + * @private + */ + _initInteractive: function() { + this._currentTransform = null, this._groupSelector = null, this._initWrapperElement(), this._createUpperCanvas(), this._initEventListeners(), this._initRetinaScaling(), this.freeDrawingBrush = e.PencilBrush && new e.PencilBrush(this), this.calcOffset(); + }, + /** + * Divides objects in two groups, one to render immediately + * and one to render as activeGroup. + * @return {Array} objects to render immediately and pushes the other in the activeGroup. + */ + _chooseObjectsToRender: function() { + var p = this.getActiveObjects(), y, v, x; + if (p.length > 0 && !this.preserveObjectStacking) { + v = [], x = []; + for (var I = 0, P = this._objects.length; I < P; I++) + y = this._objects[I], p.indexOf(y) === -1 ? v.push(y) : x.push(y); + p.length > 1 && (this._activeObject._objects = x), v.push.apply(v, x); + } else + v = this._objects; + return v; + }, + /** + * Renders both the top canvas and the secondary container canvas. + * @return {fabric.Canvas} instance + * @chainable + */ + renderAll: function() { + this.contextTopDirty && !this._groupSelector && !this.isDrawingMode && (this.clearContext(this.contextTop), this.contextTopDirty = !1), this.hasLostContext && (this.renderTopLayer(this.contextTop), this.hasLostContext = !1); + var p = this.contextContainer; + return this.renderCanvas(p, this._chooseObjectsToRender()), this; + }, + renderTopLayer: function(p) { + p.save(), this.isDrawingMode && this._isCurrentlyDrawing && (this.freeDrawingBrush && this.freeDrawingBrush._render(), this.contextTopDirty = !0), this.selection && this._groupSelector && (this._drawSelection(p), this.contextTopDirty = !0), p.restore(); + }, + /** + * Method to render only the top canvas. + * Also used to render the group selection box. + * @return {fabric.Canvas} thisArg + * @chainable + */ + renderTop: function() { + var p = this.contextTop; + return this.clearContext(p), this.renderTopLayer(p), this.fire("after:render"), this; + }, + /** + * @private + */ + _normalizePointer: function(p, y) { + var v = p.calcTransformMatrix(), x = e.util.invertTransform(v), I = this.restorePointerVpt(y); + return e.util.transformPoint(I, x); + }, + /** + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + * @return {Boolean} + */ + isTargetTransparent: function(p, y, v) { + if (p.shouldCache() && p._cacheCanvas && p !== this._activeObject) { + var x = this._normalizePointer(p, { x: y, y: v }), I = Math.max(p.cacheTranslationX + x.x * p.zoomX, 0), P = Math.max(p.cacheTranslationY + x.y * p.zoomY, 0), j = e.util.isTransparent( + p._cacheContext, + Math.round(I), + Math.round(P), + this.targetFindTolerance + ); + return j; + } + var F = this.contextCache, k = p.selectionBackgroundColor, V = this.viewportTransform; + p.selectionBackgroundColor = "", this.clearContext(F), F.save(), F.transform(V[0], V[1], V[2], V[3], V[4], V[5]), p.render(F), F.restore(), p.selectionBackgroundColor = k; + var j = e.util.isTransparent( + F, + y, + v, + this.targetFindTolerance + ); + return j; + }, + /** + * takes an event and determines if selection key has been pressed + * @private + * @param {Event} e Event object + */ + _isSelectionKeyPressed: function(p) { + var y = !1; + return Array.isArray(this.selectionKey) ? y = !!this.selectionKey.find(function(v) { + return p[v] === !0; + }) : y = p[this.selectionKey], y; + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _shouldClearSelection: function(p, y) { + var v = this.getActiveObjects(), x = this._activeObject; + return !y || y && x && v.length > 1 && v.indexOf(y) === -1 && x !== y && !this._isSelectionKeyPressed(p) || y && !y.evented || y && !y.selectable && x && x !== y; + }, + /** + * centeredScaling from object can't override centeredScaling from canvas. + * this should be fixed, since object setting should take precedence over canvas. + * also this should be something that will be migrated in the control properties. + * as ability to define the origin of the transformation that the control provide. + * @private + * @param {fabric.Object} target + * @param {String} action + * @param {Boolean} altKey + */ + _shouldCenterTransform: function(p, y, v) { + if (p) { + var x; + return y === "scale" || y === "scaleX" || y === "scaleY" || y === "resizing" ? x = this.centeredScaling || p.centeredScaling : y === "rotate" && (x = this.centeredRotation || p.centeredRotation), x ? !v : v; + } + }, + /** + * should disappear before release 4.0 + * @private + */ + _getOriginFromCorner: function(p, y) { + var v = { + x: p.originX, + y: p.originY + }; + return y === "ml" || y === "tl" || y === "bl" ? v.x = "right" : (y === "mr" || y === "tr" || y === "br") && (v.x = "left"), y === "tl" || y === "mt" || y === "tr" ? v.y = "bottom" : (y === "bl" || y === "mb" || y === "br") && (v.y = "top"), v; + }, + /** + * @private + * @param {Boolean} alreadySelected true if target is already selected + * @param {String} corner a string representing the corner ml, mr, tl ... + * @param {Event} e Event object + * @param {fabric.Object} [target] inserted back to help overriding. Unused + */ + _getActionFromCorner: function(p, y, v, x) { + if (!y || !p) + return "drag"; + var I = x.controls[y]; + return I.getActionName(v, I, x); + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _setupCurrentTransform: function(p, y, v) { + if (y) { + var x = this.getPointer(p), I = y.__corner, P = y.controls[I], F = v && I ? P.getActionHandler(p, y, P) : e.controlsUtils.dragHandler, k = this._getActionFromCorner(v, I, p, y), V = this._getOriginFromCorner(y, I), j = p[this.centeredKey], Y = { + target: y, + action: k, + actionHandler: F, + corner: I, + scaleX: y.scaleX, + scaleY: y.scaleY, + skewX: y.skewX, + skewY: y.skewY, + // used by transation + offsetX: x.x - y.left, + offsetY: x.y - y.top, + originX: V.x, + originY: V.y, + ex: x.x, + ey: x.y, + lastX: x.x, + lastY: x.y, + // unsure they are useful anymore. + // left: target.left, + // top: target.top, + theta: l(y.angle), + // end of unsure + width: y.width * y.scaleX, + shiftKey: p.shiftKey, + altKey: j, + original: e.util.saveObjectTransform(y) + }; + this._shouldCenterTransform(y, k, j) && (Y.originX = "center", Y.originY = "center"), Y.original.originX = V.x, Y.original.originY = V.y, this._currentTransform = Y, this._beforeTransform(p); + } + }, + /** + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ + setCursor: function(p) { + this.upperCanvasEl.style.cursor = p; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx to draw the selection on + */ + _drawSelection: function(p) { + var y = this._groupSelector, v = new e.Point(y.ex, y.ey), x = e.util.transformPoint(v, this.viewportTransform), I = new e.Point(y.ex + y.left, y.ey + y.top), P = e.util.transformPoint(I, this.viewportTransform), F = Math.min(x.x, P.x), k = Math.min(x.y, P.y), V = Math.max(x.x, P.x), j = Math.max(x.y, P.y), Y = this.selectionLineWidth / 2; + this.selectionColor && (p.fillStyle = this.selectionColor, p.fillRect(F, k, V - F, j - k)), !(!this.selectionLineWidth || !this.selectionBorderColor) && (p.lineWidth = this.selectionLineWidth, p.strokeStyle = this.selectionBorderColor, F += Y, k += Y, V -= Y, j -= Y, e.Object.prototype._setLineDash.call(this, p, this.selectionDashArray), p.strokeRect(F, k, V - F, j - k)); + }, + /** + * Method that determines what object we are clicking on + * the skipGroup parameter is for internal use, is needed for shift+click action + * 11/09/2018 TODO: would be cool if findTarget could discern between being a full target + * or the outside part of the corner. + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, activeGroup is skipped and only objects are traversed through + * @return {fabric.Object} the target found + */ + findTarget: function(p, y) { + if (!this.skipTargetFind) { + var v = !0, x = this.getPointer(p, v), I = this._activeObject, P = this.getActiveObjects(), F, k, V = c(p), j = P.length > 1 && !y || P.length === 1; + if (this.targets = [], j && I._findTargetCorner(x, V) || P.length > 1 && !y && I === this._searchPossibleTargets([I], x)) + return I; + if (P.length === 1 && I === this._searchPossibleTargets([I], x)) + if (this.preserveObjectStacking) + F = I, k = this.targets, this.targets = []; + else + return I; + var Y = this._searchPossibleTargets(this._objects, x); + return p[this.altSelectionKey] && Y && F && Y !== F && (Y = F, this.targets = k), Y; + } + }, + /** + * Checks point is inside the object. + * @param {Object} [pointer] x,y object of point coordinates we want to check. + * @param {fabric.Object} obj Object to test against + * @param {Object} [globalPointer] x,y object of point coordinates relative to canvas used to search per pixel target. + * @return {Boolean} true if point is contained within an area of given object + * @private + */ + _checkTarget: function(p, y, v) { + if (y && y.visible && y.evented && // http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html + // http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html + y.containsPoint(p)) + if ((this.perPixelTargetFind || y.perPixelTargetFind) && !y.isEditing) { + var x = this.isTargetTransparent(y, v.x, v.y); + if (!x) + return !0; + } else + return !0; + }, + /** + * Function used to search inside objects an object that contains pointer in bounding box or that contains pointerOnCanvas when painted + * @param {Array} [objects] objects array to look into + * @param {Object} [pointer] x,y object of point coordinates we want to check. + * @return {fabric.Object} object that contains pointer + * @private + */ + _searchPossibleTargets: function(p, y) { + for (var v, x = p.length, I; x--; ) { + var P = p[x], F = P.group ? this._normalizePointer(P.group, y) : y; + if (this._checkTarget(F, P, y)) { + v = p[x], v.subTargetCheck && v instanceof e.Group && (I = this._searchPossibleTargets(v._objects, y), I && this.targets.push(I)); + break; + } + } + return v; + }, + /** + * Returns pointer coordinates without the effect of the viewport + * @param {Object} pointer with "x" and "y" number values + * @return {Object} object with "x" and "y" number values + */ + restorePointerVpt: function(p) { + return e.util.transformPoint( + p, + e.util.invertTransform(this.viewportTransform) + ); + }, + /** + * Returns pointer coordinates relative to canvas. + * Can return coordinates with or without viewportTransform. + * ignoreZoom false gives back coordinates that represent + * the point clicked on canvas element. + * ignoreZoom true gives back coordinates after being processed + * by the viewportTransform ( sort of coordinates of what is displayed + * on the canvas where you are clicking. + * ignoreZoom true = HTMLElement coordinates relative to top,left + * ignoreZoom false, default = fabric space coordinates, the same used for shape position + * To interact with your shapes top and left you want to use ignoreZoom true + * most of the time, while ignoreZoom false will give you coordinates + * compatible with the object.oCoords system. + * of the time. + * @param {Event} e + * @param {Boolean} ignoreZoom + * @return {Object} object with "x" and "y" number values + */ + getPointer: function(p, y) { + if (this._absolutePointer && !y) + return this._absolutePointer; + if (this._pointer && y) + return this._pointer; + var v = a(p), x = this.upperCanvasEl, I = x.getBoundingClientRect(), P = I.width || 0, F = I.height || 0, k; + (!P || !F) && ("top" in I && "bottom" in I && (F = Math.abs(I.top - I.bottom)), "right" in I && "left" in I && (P = Math.abs(I.right - I.left))), this.calcOffset(), v.x = v.x - this._offset.left, v.y = v.y - this._offset.top, y || (v = this.restorePointerVpt(v)); + var V = this.getRetinaScaling(); + return V !== 1 && (v.x /= V, v.y /= V), P === 0 || F === 0 ? k = { width: 1, height: 1 } : k = { + width: x.width / P, + height: x.height / F + }, { + x: v.x * k.width, + y: v.y * k.height + }; + }, + /** + * @private + * @throws {CANVAS_INIT_ERROR} If canvas can not be initialized + */ + _createUpperCanvas: function() { + var p = this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/, ""), y = this.lowerCanvasEl, v = this.upperCanvasEl; + v ? v.className = "" : (v = this._createCanvasElement(), this.upperCanvasEl = v), e.util.addClass(v, "upper-canvas " + p), this.wrapperEl.appendChild(v), this._copyCanvasStyle(y, v), this._applyCanvasStyle(v), this.contextTop = v.getContext("2d"); + }, + /** + * Returns context of top canvas where interactions are drawn + * @returns {CanvasRenderingContext2D} + */ + getTopContext: function() { + return this.contextTop; + }, + /** + * @private + */ + _createCacheCanvas: function() { + this.cacheCanvasEl = this._createCanvasElement(), this.cacheCanvasEl.setAttribute("width", this.width), this.cacheCanvasEl.setAttribute("height", this.height), this.contextCache = this.cacheCanvasEl.getContext("2d"); + }, + /** + * @private + */ + _initWrapperElement: function() { + this.wrapperEl = e.util.wrapElement(this.lowerCanvasEl, "div", { + class: this.containerClass + }), e.util.setStyle(this.wrapperEl, { + width: this.width + "px", + height: this.height + "px", + position: "relative" + }), e.util.makeElementUnselectable(this.wrapperEl); + }, + /** + * @private + * @param {HTMLElement} element canvas element to apply styles on + */ + _applyCanvasStyle: function(p) { + var y = this.width || p.width, v = this.height || p.height; + e.util.setStyle(p, { + position: "absolute", + width: y + "px", + height: v + "px", + left: 0, + top: 0, + "touch-action": this.allowTouchScrolling ? "manipulation" : "none", + "-ms-touch-action": this.allowTouchScrolling ? "manipulation" : "none" + }), p.width = y, p.height = v, e.util.makeElementUnselectable(p); + }, + /** + * Copy the entire inline style from one element (fromEl) to another (toEl) + * @private + * @param {Element} fromEl Element style is copied from + * @param {Element} toEl Element copied style is applied to + */ + _copyCanvasStyle: function(p, y) { + y.style.cssText = p.style.cssText; + }, + /** + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ + getSelectionContext: function() { + return this.contextTop; + }, + /** + * Returns <canvas> element on which object selection is drawn + * @return {HTMLCanvasElement} + */ + getSelectionElement: function() { + return this.upperCanvasEl; + }, + /** + * Returns currently active object + * @return {fabric.Object} active object + */ + getActiveObject: function() { + return this._activeObject; + }, + /** + * Returns an array with the current selected objects + * @return {fabric.Object} active object + */ + getActiveObjects: function() { + var p = this._activeObject; + return p ? p.type === "activeSelection" && p._objects ? p._objects.slice(0) : [p] : []; + }, + /** + * @private + * @param {fabric.Object} obj Object that was removed + */ + _onObjectRemoved: function(p) { + p === this._activeObject && (this.fire("before:selection:cleared", { target: p }), this._discardActiveObject(), this.fire("selection:cleared", { target: p }), p.fire("deselected")), p === this._hoveredTarget && (this._hoveredTarget = null, this._hoveredTargets = []), this.callSuper("_onObjectRemoved", p); + }, + /** + * @private + * Compares the old activeObject with the current one and fires correct events + * @param {fabric.Object} obj old activeObject + */ + _fireSelectionEvents: function(p, y) { + var v = !1, x = this.getActiveObjects(), I = [], P = []; + p.forEach(function(F) { + x.indexOf(F) === -1 && (v = !0, F.fire("deselected", { + e: y, + target: F + }), P.push(F)); + }), x.forEach(function(F) { + p.indexOf(F) === -1 && (v = !0, F.fire("selected", { + e: y, + target: F + }), I.push(F)); + }), p.length > 0 && x.length > 0 ? v && this.fire("selection:updated", { + e: y, + selected: I, + deselected: P + }) : x.length > 0 ? this.fire("selection:created", { + e: y, + selected: I + }) : p.length > 0 && this.fire("selection:cleared", { + e: y, + deselected: P + }); + }, + /** + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + * @return {fabric.Canvas} thisArg + * @chainable + */ + setActiveObject: function(p, y) { + var v = this.getActiveObjects(); + return this._setActiveObject(p, y), this._fireSelectionEvents(v, y), this; + }, + /** + * This is a private method for now. + * This is supposed to be equivalent to setActiveObject but without firing + * any event. There is commitment to have this stay this way. + * This is the functional part of setActiveObject. + * @private + * @param {Object} object to set as active + * @param {Event} [e] Event (passed along when firing "object:selected") + * @return {Boolean} true if the selection happened + */ + _setActiveObject: function(p, y) { + return this._activeObject === p || !this._discardActiveObject(y, p) || p.onSelect({ e: y }) ? !1 : (this._activeObject = p, !0); + }, + /** + * This is a private method for now. + * This is supposed to be equivalent to discardActiveObject but without firing + * any events. There is commitment to have this stay this way. + * This is the functional part of discardActiveObject. + * @param {Event} [e] Event (passed along when firing "object:deselected") + * @param {Object} object to set as active + * @return {Boolean} true if the selection happened + * @private + */ + _discardActiveObject: function(p, y) { + var v = this._activeObject; + if (v) { + if (v.onDeselect({ e: p, object: y })) + return !1; + this._activeObject = null; + } + return !0; + }, + /** + * Discards currently active object and fire events. If the function is called by fabric + * as a consequence of a mouse event, the event is passed as a parameter and + * sent to the fire function for the custom events. When used as a method the + * e param does not have any application. + * @param {event} e + * @return {fabric.Canvas} thisArg + * @chainable + */ + discardActiveObject: function(p) { + var y = this.getActiveObjects(), v = this.getActiveObject(); + return y.length && this.fire("before:selection:cleared", { target: v, e: p }), this._discardActiveObject(p), this._fireSelectionEvents(y, p), this; + }, + /** + * Clears a canvas element and removes all event listeners + * @return {fabric.Canvas} thisArg + * @chainable + */ + dispose: function() { + var p = this.wrapperEl; + return this.removeListeners(), p.removeChild(this.upperCanvasEl), p.removeChild(this.lowerCanvasEl), this.contextCache = null, this.contextTop = null, ["upperCanvasEl", "cacheCanvasEl"].forEach(function(y) { + e.util.cleanUpJsdomNode(this[y]), this[y] = void 0; + }.bind(this)), p.parentNode && p.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl), delete this.wrapperEl, e.StaticCanvas.prototype.dispose.call(this), this; + }, + /** + * Clears all contexts (background, main, top) of an instance + * @return {fabric.Canvas} thisArg + * @chainable + */ + clear: function() { + return this.discardActiveObject(), this.clearContext(this.contextTop), this.callSuper("clear"); + }, + /** + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ + drawControls: function(p) { + var y = this._activeObject; + y && y._renderControls(p); + }, + /** + * @private + */ + _toObject: function(p, y, v) { + var x = this._realizeGroupTransformOnObject(p), I = this.callSuper("_toObject", p, y, v); + return this._unwindGroupTransformOnObject(p, x), I; + }, + /** + * Realises an object's group transformation on it + * @private + * @param {fabric.Object} [instance] the object to transform (gets mutated) + * @returns the original values of instance which were changed + */ + _realizeGroupTransformOnObject: function(p) { + if (p.group && p.group.type === "activeSelection" && this._activeObject === p.group) { + var y = ["angle", "flipX", "flipY", "left", "scaleX", "scaleY", "skewX", "skewY", "top"], v = {}; + return y.forEach(function(x) { + v[x] = p[x]; + }), e.util.addTransformToObject(p, this._activeObject.calcOwnMatrix()), v; + } else + return null; + }, + /** + * Restores the changed properties of instance + * @private + * @param {fabric.Object} [instance] the object to un-transform (gets mutated) + * @param {Object} [originalValues] the original values of instance, as returned by _realizeGroupTransformOnObject + */ + _unwindGroupTransformOnObject: function(p, y) { + y && p.set(y); + }, + /** + * @private + */ + _setSVGObject: function(p, y, v) { + var x = this._realizeGroupTransformOnObject(y); + this.callSuper("_setSVGObject", p, y, v), this._unwindGroupTransformOnObject(y, x); + }, + setViewportTransform: function(p) { + this.renderOnAddRemove && this._activeObject && this._activeObject.isEditing && this._activeObject.clearContextTop(), e.StaticCanvas.prototype.setViewportTransform.call(this, p); + } + } + ); + for (var h in e.StaticCanvas) + h !== "prototype" && (e.Canvas[h] = e.StaticCanvas[h]); + }(), function() { + var a = e.util.addListener, l = e.util.removeListener, c = 3, h = 2, p = 1, y = { passive: !1 }; + function v(x, I) { + return x.button && x.button === I - 1; + } + e.util.object.extend( + e.Canvas.prototype, + /** @lends fabric.Canvas.prototype */ + { + /** + * Contains the id of the touch event that owns the fabric transform + * @type Number + * @private + */ + mainTouchId: null, + /** + * Adds mouse listeners to canvas + * @private + */ + _initEventListeners: function() { + this.removeListeners(), this._bindEvents(), this.addOrRemove(a, "add"); + }, + /** + * return an event prefix pointer or mouse. + * @private + */ + _getEventPrefix: function() { + return this.enablePointerEvents ? "pointer" : "mouse"; + }, + addOrRemove: function(x, I) { + var P = this.upperCanvasEl, F = this._getEventPrefix(); + x(e.window, "resize", this._onResize), x(P, F + "down", this._onMouseDown), x(P, F + "move", this._onMouseMove, y), x(P, F + "out", this._onMouseOut), x(P, F + "enter", this._onMouseEnter), x(P, "wheel", this._onMouseWheel), x(P, "contextmenu", this._onContextMenu), x(P, "dblclick", this._onDoubleClick), x(P, "dragover", this._onDragOver), x(P, "dragenter", this._onDragEnter), x(P, "dragleave", this._onDragLeave), x(P, "drop", this._onDrop), this.enablePointerEvents || x(P, "touchstart", this._onTouchStart, y), typeof eventjs < "u" && I in eventjs && (eventjs[I](P, "gesture", this._onGesture), eventjs[I](P, "drag", this._onDrag), eventjs[I](P, "orientation", this._onOrientationChange), eventjs[I](P, "shake", this._onShake), eventjs[I](P, "longpress", this._onLongPress)); + }, + /** + * Removes all event listeners + */ + removeListeners: function() { + this.addOrRemove(l, "remove"); + var x = this._getEventPrefix(); + l(e.document, x + "up", this._onMouseUp), l(e.document, "touchend", this._onTouchEnd, y), l(e.document, x + "move", this._onMouseMove, y), l(e.document, "touchmove", this._onMouseMove, y); + }, + /** + * @private + */ + _bindEvents: function() { + this.eventsBound || (this._onMouseDown = this._onMouseDown.bind(this), this._onTouchStart = this._onTouchStart.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this), this._onTouchEnd = this._onTouchEnd.bind(this), this._onResize = this._onResize.bind(this), this._onGesture = this._onGesture.bind(this), this._onDrag = this._onDrag.bind(this), this._onShake = this._onShake.bind(this), this._onLongPress = this._onLongPress.bind(this), this._onOrientationChange = this._onOrientationChange.bind(this), this._onMouseWheel = this._onMouseWheel.bind(this), this._onMouseOut = this._onMouseOut.bind(this), this._onMouseEnter = this._onMouseEnter.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDoubleClick = this._onDoubleClick.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDragEnter = this._simpleEventHandler.bind(this, "dragenter"), this._onDragLeave = this._simpleEventHandler.bind(this, "dragleave"), this._onDrop = this._onDrop.bind(this), this.eventsBound = !0); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js gesture + * @param {Event} [self] Inner Event object + */ + _onGesture: function(x, I) { + this.__onTransformGesture && this.__onTransformGesture(x, I); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js drag + * @param {Event} [self] Inner Event object + */ + _onDrag: function(x, I) { + this.__onDrag && this.__onDrag(x, I); + }, + /** + * @private + * @param {Event} [e] Event object fired on wheel event + */ + _onMouseWheel: function(x) { + this.__onMouseWheel(x); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseOut: function(x) { + var I = this._hoveredTarget; + this.fire("mouse:out", { target: I, e: x }), this._hoveredTarget = null, I && I.fire("mouseout", { e: x }); + var P = this; + this._hoveredTargets.forEach(function(F) { + P.fire("mouse:out", { target: I, e: x }), F && I.fire("mouseout", { e: x }); + }), this._hoveredTargets = []; + }, + /** + * @private + * @param {Event} e Event object fired on mouseenter + */ + _onMouseEnter: function(x) { + !this._currentTransform && !this.findTarget(x) && (this.fire("mouse:over", { target: null, e: x }), this._hoveredTarget = null, this._hoveredTargets = []); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js orientation change + * @param {Event} [self] Inner Event object + */ + _onOrientationChange: function(x, I) { + this.__onOrientationChange && this.__onOrientationChange(x, I); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js shake + * @param {Event} [self] Inner Event object + */ + _onShake: function(x, I) { + this.__onShake && this.__onShake(x, I); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js shake + * @param {Event} [self] Inner Event object + */ + _onLongPress: function(x, I) { + this.__onLongPress && this.__onLongPress(x, I); + }, + /** + * prevent default to allow drop event to be fired + * @private + * @param {Event} [e] Event object fired on Event.js shake + */ + _onDragOver: function(x) { + x.preventDefault(); + var I = this._simpleEventHandler("dragover", x); + this._fireEnterLeaveEvents(I, x); + }, + /** + * `drop:before` is a an event that allow you to schedule logic + * before the `drop` event. Prefer `drop` event always, but if you need + * to run some drop-disabling logic on an event, since there is no way + * to handle event handlers ordering, use `drop:before` + * @param {Event} e + */ + _onDrop: function(x) { + return this._simpleEventHandler("drop:before", x), this._simpleEventHandler("drop", x); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onContextMenu: function(x) { + return this.stopContextMenu && (x.stopPropagation(), x.preventDefault()), !1; + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onDoubleClick: function(x) { + this._cacheTransformEventData(x), this._handleEvent(x, "dblclick"), this._resetTransformEventData(x); + }, + /** + * Return a the id of an event. + * returns either the pointerId or the identifier or 0 for the mouse event + * @private + * @param {Event} evt Event object + */ + getPointerId: function(x) { + var I = x.changedTouches; + return I ? I[0] && I[0].identifier : this.enablePointerEvents ? x.pointerId : -1; + }, + /** + * Determines if an event has the id of the event that is considered main + * @private + * @param {evt} event Event object + */ + _isMainEvent: function(x) { + return x.isPrimary === !0 ? !0 : x.isPrimary === !1 ? !1 : x.type === "touchend" && x.touches.length === 0 ? !0 : x.changedTouches ? x.changedTouches[0].identifier === this.mainTouchId : !0; + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onTouchStart: function(x) { + x.preventDefault(), this.mainTouchId === null && (this.mainTouchId = this.getPointerId(x)), this.__onMouseDown(x), this._resetTransformEventData(); + var I = this.upperCanvasEl, P = this._getEventPrefix(); + a(e.document, "touchend", this._onTouchEnd, y), a(e.document, "touchmove", this._onMouseMove, y), l(I, P + "down", this._onMouseDown); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseDown: function(x) { + this.__onMouseDown(x), this._resetTransformEventData(); + var I = this.upperCanvasEl, P = this._getEventPrefix(); + l(I, P + "move", this._onMouseMove, y), a(e.document, P + "up", this._onMouseUp), a(e.document, P + "move", this._onMouseMove, y); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onTouchEnd: function(x) { + if (!(x.touches.length > 0)) { + this.__onMouseUp(x), this._resetTransformEventData(), this.mainTouchId = null; + var I = this._getEventPrefix(); + l(e.document, "touchend", this._onTouchEnd, y), l(e.document, "touchmove", this._onMouseMove, y); + var P = this; + this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(function() { + a(P.upperCanvasEl, I + "down", P._onMouseDown), P._willAddMouseDown = 0; + }, 400); + } + }, + /** + * @private + * @param {Event} e Event object fired on mouseup + */ + _onMouseUp: function(x) { + this.__onMouseUp(x), this._resetTransformEventData(); + var I = this.upperCanvasEl, P = this._getEventPrefix(); + this._isMainEvent(x) && (l(e.document, P + "up", this._onMouseUp), l(e.document, P + "move", this._onMouseMove, y), a(I, P + "move", this._onMouseMove, y)); + }, + /** + * @private + * @param {Event} e Event object fired on mousemove + */ + _onMouseMove: function(x) { + !this.allowTouchScrolling && x.preventDefault && x.preventDefault(), this.__onMouseMove(x); + }, + /** + * @private + */ + _onResize: function() { + this.calcOffset(); + }, + /** + * Decides whether the canvas should be redrawn in mouseup and mousedown events. + * @private + * @param {Object} target + */ + _shouldRender: function(x) { + var I = this._activeObject; + return !!I != !!x || I && x && I !== x ? !0 : (I && I.isEditing, !1); + }, + /** + * Method that defines the actions when mouse is released on canvas. + * The method resets the currentTransform parameters, store the image corner + * position in the image object and render the canvas on top. + * @private + * @param {Event} e Event object fired on mouseup + */ + __onMouseUp: function(x) { + var I, P = this._currentTransform, F = this._groupSelector, k = !1, V = !F || F.left === 0 && F.top === 0; + if (this._cacheTransformEventData(x), I = this._target, this._handleEvent(x, "up:before"), v(x, c)) { + this.fireRightClick && this._handleEvent(x, "up", c, V); + return; + } + if (v(x, h)) { + this.fireMiddleClick && this._handleEvent(x, "up", h, V), this._resetTransformEventData(); + return; + } + if (this.isDrawingMode && this._isCurrentlyDrawing) { + this._onMouseUpInDrawingMode(x); + return; + } + if (this._isMainEvent(x)) { + if (P && (this._finalizeCurrentTransform(x), k = P.actionPerformed), !V) { + var j = I === this._activeObject; + this._maybeGroupObjects(x), k || (k = this._shouldRender(I) || !j && I === this._activeObject); + } + var Y, X; + if (I) { + if (Y = I._findTargetCorner( + this.getPointer(x, !0), + e.util.isTouchEvent(x) + ), I.selectable && I !== this._activeObject && I.activeOn === "up") + this.setActiveObject(I, x), k = !0; + else { + var Q = I.controls[Y], re = Q && Q.getMouseUpHandler(x, I, Q); + re && (X = this.getPointer(x), re(x, P, X.x, X.y)); + } + I.isMoving = !1; + } + if (P && (P.target !== I || P.corner !== Y)) { + var he = P.target && P.target.controls[P.corner], fe = he && he.getMouseUpHandler(x, I, Q); + X = X || this.getPointer(x), fe && fe(x, P, X.x, X.y); + } + this._setCursorFromEvent(x, I), this._handleEvent(x, "up", p, V), this._groupSelector = null, this._currentTransform = null, I && (I.__corner = 0), k ? this.requestRenderAll() : V || this.renderTop(); + } + }, + /** + * @private + * Handle event firing for target and subtargets + * @param {Event} e event from mouse + * @param {String} eventType event to fire (up, down or move) + * @return {Fabric.Object} target return the the target found, for internal reasons. + */ + _simpleEventHandler: function(x, I) { + var P = this.findTarget(I), F = this.targets, k = { + e: I, + target: P, + subTargets: F + }; + if (this.fire(x, k), P && P.fire(x, k), !F) + return P; + for (var V = 0; V < F.length; V++) + F[V].fire(x, k); + return P; + }, + /** + * @private + * Handle event firing for target and subtargets + * @param {Event} e event from mouse + * @param {String} eventType event to fire (up, down or move) + * @param {fabric.Object} targetObj receiving event + * @param {Number} [button] button used in the event 1 = left, 2 = middle, 3 = right + * @param {Boolean} isClick for left button only, indicates that the mouse up happened without move. + */ + _handleEvent: function(x, I, P, F) { + var k = this._target, V = this.targets || [], j = { + e: x, + target: k, + subTargets: V, + button: P || p, + isClick: F || !1, + pointer: this._pointer, + absolutePointer: this._absolutePointer, + transform: this._currentTransform + }; + I === "up" && (j.currentTarget = this.findTarget(x), j.currentSubTargets = this.targets), this.fire("mouse:" + I, j), k && k.fire("mouse" + I, j); + for (var Y = 0; Y < V.length; Y++) + V[Y].fire("mouse" + I, j); + }, + /** + * @private + * @param {Event} e send the mouse event that generate the finalize down, so it can be used in the event + */ + _finalizeCurrentTransform: function(x) { + var I = this._currentTransform, P = I.target, F = { + e: x, + target: P, + transform: I, + action: I.action + }; + P._scaling && (P._scaling = !1), P.setCoords(), (I.actionPerformed || this.stateful && P.hasStateChanged()) && this._fire("modified", F); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseDownInDrawingMode: function(x) { + this._isCurrentlyDrawing = !0, this.getActiveObject() && this.discardActiveObject(x).requestRenderAll(); + var I = this.getPointer(x); + this.freeDrawingBrush.onMouseDown(I, { e: x, pointer: I }), this._handleEvent(x, "down"); + }, + /** + * @private + * @param {Event} e Event object fired on mousemove + */ + _onMouseMoveInDrawingMode: function(x) { + if (this._isCurrentlyDrawing) { + var I = this.getPointer(x); + this.freeDrawingBrush.onMouseMove(I, { e: x, pointer: I }); + } + this.setCursor(this.freeDrawingCursor), this._handleEvent(x, "move"); + }, + /** + * @private + * @param {Event} e Event object fired on mouseup + */ + _onMouseUpInDrawingMode: function(x) { + var I = this.getPointer(x); + this._isCurrentlyDrawing = this.freeDrawingBrush.onMouseUp({ e: x, pointer: I }), this._handleEvent(x, "up"); + }, + /** + * Method that defines the actions when mouse is clicked on canvas. + * The method inits the currentTransform parameters and renders all the + * canvas so the current image can be placed on the top canvas and the rest + * in on the container one. + * @private + * @param {Event} e Event object fired on mousedown + */ + __onMouseDown: function(x) { + this._cacheTransformEventData(x), this._handleEvent(x, "down:before"); + var I = this._target; + if (v(x, c)) { + this.fireRightClick && this._handleEvent(x, "down", c); + return; + } + if (v(x, h)) { + this.fireMiddleClick && this._handleEvent(x, "down", h); + return; + } + if (this.isDrawingMode) { + this._onMouseDownInDrawingMode(x); + return; + } + if (this._isMainEvent(x) && !this._currentTransform) { + var P = this._pointer; + this._previousPointer = P; + var F = this._shouldRender(I), k = this._shouldGroup(x, I); + if (this._shouldClearSelection(x, I) ? this.discardActiveObject(x) : k && (this._handleGrouping(x, I), I = this._activeObject), this.selection && (!I || !I.selectable && !I.isEditing && I !== this._activeObject) && (this._groupSelector = { + ex: this._absolutePointer.x, + ey: this._absolutePointer.y, + top: 0, + left: 0 + }), I) { + var V = I === this._activeObject; + I.selectable && I.activeOn === "down" && this.setActiveObject(I, x); + var j = I._findTargetCorner( + this.getPointer(x, !0), + e.util.isTouchEvent(x) + ); + if (I.__corner = j, I === this._activeObject && (j || !k)) { + this._setupCurrentTransform(x, I, V); + var Y = I.controls[j], P = this.getPointer(x), X = Y && Y.getMouseDownHandler(x, I, Y); + X && X(x, this._currentTransform, P.x, P.y); + } + } + this._handleEvent(x, "down"), (F || k) && this.requestRenderAll(); + } + }, + /** + * reset cache form common information needed during event processing + * @private + */ + _resetTransformEventData: function() { + this._target = null, this._pointer = null, this._absolutePointer = null; + }, + /** + * Cache common information needed during event processing + * @private + * @param {Event} e Event object fired on event + */ + _cacheTransformEventData: function(x) { + this._resetTransformEventData(), this._pointer = this.getPointer(x, !0), this._absolutePointer = this.restorePointerVpt(this._pointer), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(x) || null; + }, + /** + * @private + */ + _beforeTransform: function(x) { + var I = this._currentTransform; + this.stateful && I.target.saveState(), this.fire("before:transform", { + e: x, + transform: I + }); + }, + /** + * Method that defines the actions when mouse is hovering the canvas. + * The currentTransform parameter will define whether the user is rotating/scaling/translating + * an image or neither of them (only hovering). A group selection is also possible and would cancel + * all any other type of action. + * In case of an image transformation only the top canvas will be rendered. + * @private + * @param {Event} e Event object fired on mousemove + */ + __onMouseMove: function(x) { + this._handleEvent(x, "move:before"), this._cacheTransformEventData(x); + var I, P; + if (this.isDrawingMode) { + this._onMouseMoveInDrawingMode(x); + return; + } + if (this._isMainEvent(x)) { + var F = this._groupSelector; + F ? (P = this._absolutePointer, F.left = P.x - F.ex, F.top = P.y - F.ey, this.renderTop()) : this._currentTransform ? this._transformObject(x) : (I = this.findTarget(x) || null, this._setCursorFromEvent(x, I), this._fireOverOutEvents(I, x)), this._handleEvent(x, "move"), this._resetTransformEventData(); + } + }, + /** + * Manage the mouseout, mouseover events for the fabric object on the canvas + * @param {Fabric.Object} target the target where the target from the mousemove event + * @param {Event} e Event object fired on mousemove + * @private + */ + _fireOverOutEvents: function(x, I) { + var P = this._hoveredTarget, F = this._hoveredTargets, k = this.targets, V = Math.max(F.length, k.length); + this.fireSyntheticInOutEvents(x, I, { + oldTarget: P, + evtOut: "mouseout", + canvasEvtOut: "mouse:out", + evtIn: "mouseover", + canvasEvtIn: "mouse:over" + }); + for (var j = 0; j < V; j++) + this.fireSyntheticInOutEvents(k[j], I, { + oldTarget: F[j], + evtOut: "mouseout", + evtIn: "mouseover" + }); + this._hoveredTarget = x, this._hoveredTargets = this.targets.concat(); + }, + /** + * Manage the dragEnter, dragLeave events for the fabric objects on the canvas + * @param {Fabric.Object} target the target where the target from the onDrag event + * @param {Event} e Event object fired on ondrag + * @private + */ + _fireEnterLeaveEvents: function(x, I) { + var P = this._draggedoverTarget, F = this._hoveredTargets, k = this.targets, V = Math.max(F.length, k.length); + this.fireSyntheticInOutEvents(x, I, { + oldTarget: P, + evtOut: "dragleave", + evtIn: "dragenter" + }); + for (var j = 0; j < V; j++) + this.fireSyntheticInOutEvents(k[j], I, { + oldTarget: F[j], + evtOut: "dragleave", + evtIn: "dragenter" + }); + this._draggedoverTarget = x; + }, + /** + * Manage the synthetic in/out events for the fabric objects on the canvas + * @param {Fabric.Object} target the target where the target from the supported events + * @param {Event} e Event object fired + * @param {Object} config configuration for the function to work + * @param {String} config.targetName property on the canvas where the old target is stored + * @param {String} [config.canvasEvtOut] name of the event to fire at canvas level for out + * @param {String} config.evtOut name of the event to fire for out + * @param {String} [config.canvasEvtIn] name of the event to fire at canvas level for in + * @param {String} config.evtIn name of the event to fire for in + * @private + */ + fireSyntheticInOutEvents: function(x, I, P) { + var F, k, V = P.oldTarget, j, Y, X = V !== x, Q = P.canvasEvtIn, re = P.canvasEvtOut; + X && (F = { e: I, target: x, previousTarget: V }, k = { e: I, target: V, nextTarget: x }), Y = x && X, j = V && X, j && (re && this.fire(re, k), V.fire(P.evtOut, k)), Y && (Q && this.fire(Q, F), x.fire(P.evtIn, F)); + }, + /** + * Method that defines actions when an Event Mouse Wheel + * @param {Event} e Event object fired on mouseup + */ + __onMouseWheel: function(x) { + this._cacheTransformEventData(x), this._handleEvent(x, "wheel"), this._resetTransformEventData(); + }, + /** + * @private + * @param {Event} e Event fired on mousemove + */ + _transformObject: function(x) { + var I = this.getPointer(x), P = this._currentTransform; + P.reset = !1, P.shiftKey = x.shiftKey, P.altKey = x[this.centeredKey], this._performTransformAction(x, P, I), P.actionPerformed && this.requestRenderAll(); + }, + /** + * @private + */ + _performTransformAction: function(x, I, P) { + var F = P.x, k = P.y, V = I.action, j = !1, Y = I.actionHandler; + Y && (j = Y(x, I, F, k)), V === "drag" && j && (I.target.isMoving = !0, this.setCursor(I.target.moveCursor || this.moveCursor)), I.actionPerformed = I.actionPerformed || j; + }, + /** + * @private + */ + _fire: e.controlsUtils.fireEvent, + /** + * Sets the cursor depending on where the canvas is being hovered. + * Note: very buggy in Opera + * @param {Event} e Event object + * @param {Object} target Object that the mouse is hovering, if so. + */ + _setCursorFromEvent: function(x, I) { + if (!I) + return this.setCursor(this.defaultCursor), !1; + var P = I.hoverCursor || this.hoverCursor, F = this._activeObject && this._activeObject.type === "activeSelection" ? this._activeObject : null, k = (!F || !F.contains(I)) && I._findTargetCorner(this.getPointer(x, !0)); + k ? this.setCursor(this.getCornerCursor(k, I, x)) : (I.subTargetCheck && this.targets.concat().reverse().map(function(V) { + P = V.hoverCursor || P; + }), this.setCursor(P)); + }, + /** + * @private + */ + getCornerCursor: function(x, I, P) { + var F = I.controls[x]; + return F.cursorStyleHandler(P, F, I); + } + } + ); + }(), function() { + var a = Math.min, l = Math.max; + e.util.object.extend( + e.Canvas.prototype, + /** @lends fabric.Canvas.prototype */ + { + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + * @return {Boolean} + */ + _shouldGroup: function(c, h) { + var p = this._activeObject; + return p && this._isSelectionKeyPressed(c) && h && h.selectable && this.selection && (p !== h || p.type === "activeSelection") && !h.onSelect({ e: c }); + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _handleGrouping: function(c, h) { + var p = this._activeObject; + p.__corner || h === p && (h = this.findTarget(c, !0), !h || !h.selectable) || (p && p.type === "activeSelection" ? this._updateActiveSelection(h, c) : this._createActiveSelection(h, c)); + }, + /** + * @private + */ + _updateActiveSelection: function(c, h) { + var p = this._activeObject, y = p._objects.slice(0); + p.contains(c) ? (p.removeWithUpdate(c), this._hoveredTarget = c, this._hoveredTargets = this.targets.concat(), p.size() === 1 && this._setActiveObject(p.item(0), h)) : (p.addWithUpdate(c), this._hoveredTarget = p, this._hoveredTargets = this.targets.concat()), this._fireSelectionEvents(y, h); + }, + /** + * @private + */ + _createActiveSelection: function(c, h) { + var p = this.getActiveObjects(), y = this._createGroup(c); + this._hoveredTarget = y, this._setActiveObject(y, h), this._fireSelectionEvents(p, h); + }, + /** + * @private + * @param {Object} target + */ + _createGroup: function(c) { + var h = this._objects, p = h.indexOf(this._activeObject) < h.indexOf(c), y = p ? [this._activeObject, c] : [c, this._activeObject]; + return this._activeObject.isEditing && this._activeObject.exitEditing(), new e.ActiveSelection(y, { + canvas: this + }); + }, + /** + * @private + * @param {Event} e mouse event + */ + _groupSelectedObjects: function(c) { + var h = this._collectObjects(c), p; + h.length === 1 ? this.setActiveObject(h[0], c) : h.length > 1 && (p = new e.ActiveSelection(h.reverse(), { + canvas: this + }), this.setActiveObject(p, c)); + }, + /** + * @private + */ + _collectObjects: function(c) { + for (var h = [], p, y = this._groupSelector.ex, v = this._groupSelector.ey, x = y + this._groupSelector.left, I = v + this._groupSelector.top, P = new e.Point(a(y, x), a(v, I)), F = new e.Point(l(y, x), l(v, I)), k = !this.selectionFullyContained, V = y === x && v === I, j = this._objects.length; j-- && (p = this._objects[j], !(!(!p || !p.selectable || !p.visible) && (k && p.intersectsWithRect(P, F, !0) || p.isContainedWithinRect(P, F, !0) || k && p.containsPoint(P, null, !0) || k && p.containsPoint(F, null, !0)) && (h.push(p), V))); ) + ; + return h.length > 1 && (h = h.filter(function(Y) { + return !Y.onSelect({ e: c }); + })), h; + }, + /** + * @private + */ + _maybeGroupObjects: function(c) { + this.selection && this._groupSelector && this._groupSelectedObjects(c), this.setCursor(this.defaultCursor), this._groupSelector = null; + } + } + ); + }(), function() { + e.util.object.extend( + e.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately + * @param {Object} [options] Options object + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by, to have consistent + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 2.0.0 + * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format + * @see {@link http://jsfiddle.net/fabricjs/NfZVb/|jsFiddle demo} + * @example Generate jpeg dataURL with lower quality + * var dataURL = canvas.toDataURL({ + * format: 'jpeg', + * quality: 0.8 + * }); + * @example Generate cropped png dataURL (clipping of canvas) + * var dataURL = canvas.toDataURL({ + * format: 'png', + * left: 100, + * top: 100, + * width: 200, + * height: 200 + * }); + * @example Generate double scaled png dataURL + * var dataURL = canvas.toDataURL({ + * format: 'png', + * multiplier: 2 + * }); + */ + toDataURL: function(a) { + a || (a = {}); + var l = a.format || "png", c = a.quality || 1, h = (a.multiplier || 1) * (a.enableRetinaScaling ? this.getRetinaScaling() : 1), p = this.toCanvasElement(h, a); + return e.util.toDataURL(p, l, c); + }, + /** + * Create a new HTMLCanvas element painted with the current canvas content. + * No need to resize the actual one or repaint it. + * Will transfer object ownership to a new canvas, paint it, and set everything back. + * This is an intermediary step used to get to a dataUrl but also it is useful to + * create quick image copies of a canvas without passing for the dataUrl string + * @param {Number} [multiplier] a zoom factor. + * @param {Object} [cropping] Cropping informations + * @param {Number} [cropping.left] Cropping left offset. + * @param {Number} [cropping.top] Cropping top offset. + * @param {Number} [cropping.width] Cropping width. + * @param {Number} [cropping.height] Cropping height. + */ + toCanvasElement: function(a, l) { + a = a || 1, l = l || {}; + var c = (l.width || this.width) * a, h = (l.height || this.height) * a, p = this.getZoom(), y = this.width, v = this.height, x = p * a, I = this.viewportTransform, P = (I[4] - (l.left || 0)) * a, F = (I[5] - (l.top || 0)) * a, k = this.interactive, V = [x, 0, 0, x, P, F], j = this.enableRetinaScaling, Y = e.util.createCanvasElement(), X = this.contextTop; + return Y.width = c, Y.height = h, this.contextTop = null, this.enableRetinaScaling = !1, this.interactive = !1, this.viewportTransform = V, this.width = c, this.height = h, this.calcViewportBoundaries(), this.renderCanvas(Y.getContext("2d"), this._objects), this.viewportTransform = I, this.width = y, this.height = v, this.calcViewportBoundaries(), this.interactive = k, this.enableRetinaScaling = j, this.contextTop = X, Y; + } + } + ); + }(), e.util.object.extend( + e.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Populates canvas with data from the specified JSON. + * JSON format must conform to the one of {@link fabric.Canvas#toJSON} + * @param {String|Object} json JSON string or object + * @param {Function} callback Callback, invoked when json is parsed + * and corresponding objects (e.g: {@link fabric.Image}) + * are initialized + * @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created. + * @return {fabric.Canvas} instance + * @chainable + * @tutorial {@link http://fabricjs.com/fabric-intro-part-3#deserialization} + * @see {@link http://jsfiddle.net/fabricjs/fmgXt/|jsFiddle demo} + * @example loadFromJSON + * canvas.loadFromJSON(json, canvas.renderAll.bind(canvas)); + * @example loadFromJSON with reviver + * canvas.loadFromJSON(json, canvas.renderAll.bind(canvas), function(o, object) { + * // `o` = json object + * // `object` = fabric.Object instance + * // ... do some stuff ... + * }); + */ + loadFromJSON: function(a, l, c) { + if (a) { + var h = typeof a == "string" ? JSON.parse(a) : e.util.object.clone(a), p = this, y = h.clipPath, v = this.renderOnAddRemove; + return this.renderOnAddRemove = !1, delete h.clipPath, this._enlivenObjects(h.objects, function(x) { + p.clear(), p._setBgOverlay(h, function() { + y ? p._enlivenObjects([y], function(I) { + p.clipPath = I[0], p.__setupCanvas.call(p, h, x, v, l); + }) : p.__setupCanvas.call(p, h, x, v, l); + }); + }, c), this; + } + }, + /** + * @private + * @param {Object} serialized Object with background and overlay information + * @param {Array} restored canvas objects + * @param {Function} cached renderOnAddRemove callback + * @param {Function} callback Invoked after all background and overlay images/patterns loaded + */ + __setupCanvas: function(a, l, c, h) { + var p = this; + l.forEach(function(y, v) { + p.insertAt(y, v); + }), this.renderOnAddRemove = c, delete a.objects, delete a.backgroundImage, delete a.overlayImage, delete a.background, delete a.overlay, this._setOptions(a), this.renderAll(), h && h(); + }, + /** + * @private + * @param {Object} serialized Object with background and overlay information + * @param {Function} callback Invoked after all background and overlay images/patterns loaded + */ + _setBgOverlay: function(a, l) { + var c = { + backgroundColor: !1, + overlayColor: !1, + backgroundImage: !1, + overlayImage: !1 + }; + if (!a.backgroundImage && !a.overlayImage && !a.background && !a.overlay) { + l && l(); + return; + } + var h = function() { + c.backgroundImage && c.overlayImage && c.backgroundColor && c.overlayColor && l && l(); + }; + this.__setBgOverlay("backgroundImage", a.backgroundImage, c, h), this.__setBgOverlay("overlayImage", a.overlayImage, c, h), this.__setBgOverlay("backgroundColor", a.background, c, h), this.__setBgOverlay("overlayColor", a.overlay, c, h); + }, + /** + * @private + * @param {String} property Property to set (backgroundImage, overlayImage, backgroundColor, overlayColor) + * @param {(Object|String)} value Value to set + * @param {Object} loaded Set loaded property to true if property is set + * @param {Object} callback Callback function to invoke after property is set + */ + __setBgOverlay: function(a, l, c, h) { + var p = this; + if (!l) { + c[a] = !0, h && h(); + return; + } + a === "backgroundImage" || a === "overlayImage" ? e.util.enlivenObjects([l], function(y) { + p[a] = y[0], c[a] = !0, h && h(); + }) : this["set" + e.util.string.capitalize(a, !0)](l, function() { + c[a] = !0, h && h(); + }); + }, + /** + * @private + * @param {Array} objects + * @param {Function} callback + * @param {Function} [reviver] + */ + _enlivenObjects: function(a, l, c) { + if (!a || a.length === 0) { + l && l([]); + return; + } + e.util.enlivenObjects(a, function(h) { + l && l(h); + }, null, c); + }, + /** + * @private + * @param {String} format + * @param {Function} callback + */ + _toDataURL: function(a, l) { + this.clone(function(c) { + l(c.toDataURL(a)); + }); + }, + /** + * @private + * @param {String} format + * @param {Number} multiplier + * @param {Function} callback + */ + _toDataURLWithMultiplier: function(a, l, c) { + this.clone(function(h) { + c(h.toDataURLWithMultiplier(a, l)); + }); + }, + /** + * Clones canvas instance + * @param {Object} [callback] Receives cloned instance as a first argument + * @param {Array} [properties] Array of properties to include in the cloned canvas and children + */ + clone: function(a, l) { + var c = JSON.stringify(this.toJSON(l)); + this.cloneWithoutData(function(h) { + h.loadFromJSON(c, function() { + a && a(h); + }); + }); + }, + /** + * Clones canvas instance without cloning existing data. + * This essentially copies canvas dimensions, clipping properties, etc. + * but leaves data empty (so that you can populate it with your own) + * @param {Object} [callback] Receives cloned instance as a first argument + */ + cloneWithoutData: function(a) { + var l = e.util.createCanvasElement(); + l.width = this.width, l.height = this.height; + var c = new e.Canvas(l); + this.backgroundImage ? (c.setBackgroundImage(this.backgroundImage.src, function() { + c.renderAll(), a && a(c); + }), c.backgroundImageOpacity = this.backgroundImageOpacity, c.backgroundImageStretch = this.backgroundImageStretch) : a && a(c); + } + } + ), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.util.object.clone, p = l.util.toFixed, y = l.util.string.capitalize, v = l.util.degreesToRadians, x = !l.isLikelyNode, I = 2; + l.Object || (l.Object = l.util.createClass( + l.CommonMethods, + /** @lends fabric.Object.prototype */ + { + /** + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + * @type String + * @default + */ + type: "object", + /** + * Horizontal origin of transformation of an object (one of "left", "right", "center") + * See http://jsfiddle.net/1ow02gea/244/ on how originX/originY affect objects in groups + * @type String + * @default + */ + originX: "left", + /** + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + * See http://jsfiddle.net/1ow02gea/244/ on how originX/originY affect objects in groups + * @type String + * @default + */ + originY: "top", + /** + * Top position of an object. Note that by default it's relative to object top. You can change this by setting originY={top/center/bottom} + * @type Number + * @default + */ + top: 0, + /** + * Left position of an object. Note that by default it's relative to object left. You can change this by setting originX={left/center/right} + * @type Number + * @default + */ + left: 0, + /** + * Object width + * @type Number + * @default + */ + width: 0, + /** + * Object height + * @type Number + * @default + */ + height: 0, + /** + * Object scale factor (horizontal) + * @type Number + * @default + */ + scaleX: 1, + /** + * Object scale factor (vertical) + * @type Number + * @default + */ + scaleY: 1, + /** + * When true, an object is rendered as flipped horizontally + * @type Boolean + * @default + */ + flipX: !1, + /** + * When true, an object is rendered as flipped vertically + * @type Boolean + * @default + */ + flipY: !1, + /** + * Opacity of an object + * @type Number + * @default + */ + opacity: 1, + /** + * Angle of rotation of an object (in degrees) + * @type Number + * @default + */ + angle: 0, + /** + * Angle of skew on x axes of an object (in degrees) + * @type Number + * @default + */ + skewX: 0, + /** + * Angle of skew on y axes of an object (in degrees) + * @type Number + * @default + */ + skewY: 0, + /** + * Size of object's controlling corners (in pixels) + * @type Number + * @default + */ + cornerSize: 13, + /** + * Size of object's controlling corners when touch interaction is detected + * @type Number + * @default + */ + touchCornerSize: 24, + /** + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + * @type Boolean + * @default + */ + transparentCorners: !0, + /** + * Default cursor value used when hovering over this object on canvas + * @type String + * @default + */ + hoverCursor: null, + /** + * Default cursor value used when moving this object on canvas + * @type String + * @default + */ + moveCursor: null, + /** + * Padding between object and its controlling borders (in pixels) + * @type Number + * @default + */ + padding: 0, + /** + * Color of controlling borders of an object (when it's active) + * @type String + * @default + */ + borderColor: "rgb(178,204,255)", + /** + * Array specifying dash pattern of an object's borders (hasBorder must be true) + * @since 1.6.2 + * @type Array + */ + borderDashArray: null, + /** + * Color of controlling corners of an object (when it's active) + * @type String + * @default + */ + cornerColor: "rgb(178,204,255)", + /** + * Color of controlling corners of an object (when it's active and transparentCorners false) + * @since 1.6.2 + * @type String + * @default + */ + cornerStrokeColor: null, + /** + * Specify style of control, 'rect' or 'circle' + * @since 1.6.2 + * @type String + */ + cornerStyle: "rect", + /** + * Array specifying dash pattern of an object's control (hasBorder must be true) + * @since 1.6.2 + * @type Array + */ + cornerDashArray: null, + /** + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredScaling: !1, + /** + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredRotation: !0, + /** + * Color of object's fill + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + fill: "rgb(0,0,0)", + /** + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) + * @type String + * @default + */ + fillRule: "nonzero", + /** + * Composite rule used for canvas globalCompositeOperation + * @type String + * @default + */ + globalCompositeOperation: "source-over", + /** + * Background color of an object. + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + backgroundColor: "", + /** + * Selection Background color of an object. colored layer behind the object when it is active. + * does not mix good with globalCompositeOperation methods. + * @type String + * @default + */ + selectionBackgroundColor: "", + /** + * When defined, an object is rendered via stroke and this property specifies its color + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + stroke: null, + /** + * Width of a stroke used to render this object + * @type Number + * @default + */ + strokeWidth: 1, + /** + * Array specifying dash pattern of an object's stroke (stroke must be defined) + * @type Array + */ + strokeDashArray: null, + /** + * Line offset of an object's stroke + * @type Number + * @default + */ + strokeDashOffset: 0, + /** + * Line endings style of an object's stroke (one of "butt", "round", "square") + * @type String + * @default + */ + strokeLineCap: "butt", + /** + * Corner style of an object's stroke (one of "bevel", "round", "miter") + * @type String + * @default + */ + strokeLineJoin: "miter", + /** + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + * @type Number + * @default + */ + strokeMiterLimit: 4, + /** + * Shadow object representing shadow of this shape + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * Opacity of object's controlling borders when object is active and moving + * @type Number + * @default + */ + borderOpacityWhenMoving: 0.4, + /** + * Scale factor of object's controlling borders + * bigger number will make a thicker border + * border is 1, so this is basically a border thickness + * since there is no way to change the border itself. + * @type Number + * @default + */ + borderScaleFactor: 1, + /** + * Minimum allowed scale value of an object + * @type Number + * @default + */ + minScaleLimit: 0, + /** + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + * @type Boolean + * @default + */ + selectable: !0, + /** + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + * @type Boolean + * @default + */ + evented: !0, + /** + * When set to `false`, an object is not rendered on canvas + * @type Boolean + * @default + */ + visible: !0, + /** + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + * @type Boolean + * @default + */ + hasControls: !0, + /** + * When set to `false`, object's controlling borders are not rendered + * @type Boolean + * @default + */ + hasBorders: !0, + /** + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + * @type Boolean + * @default + */ + perPixelTargetFind: !1, + /** + * When `false`, default object's values are not included in its serialization + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * When `true`, object horizontal movement is locked + * @type Boolean + * @default + */ + lockMovementX: !1, + /** + * When `true`, object vertical movement is locked + * @type Boolean + * @default + */ + lockMovementY: !1, + /** + * When `true`, object rotation is locked + * @type Boolean + * @default + */ + lockRotation: !1, + /** + * When `true`, object horizontal scaling is locked + * @type Boolean + * @default + */ + lockScalingX: !1, + /** + * When `true`, object vertical scaling is locked + * @type Boolean + * @default + */ + lockScalingY: !1, + /** + * When `true`, object horizontal skewing is locked + * @type Boolean + * @default + */ + lockSkewingX: !1, + /** + * When `true`, object vertical skewing is locked + * @type Boolean + * @default + */ + lockSkewingY: !1, + /** + * When `true`, object cannot be flipped by scaling into negative values + * @type Boolean + * @default + */ + lockScalingFlip: !1, + /** + * When `true`, object is not exported in OBJECT/JSON + * @since 1.6.3 + * @type Boolean + * @default + */ + excludeFromExport: !1, + /** + * When `true`, object is cached on an additional canvas. + * When `false`, object is not cached unless necessary ( clipPath ) + * default to true + * @since 1.7.0 + * @type Boolean + * @default true + */ + objectCaching: x, + /** + * When `true`, object properties are checked for cache invalidation. In some particular + * situation you may want this to be disabled ( spray brush, very big, groups) + * or if your application does not allow you to modify properties for groups child you want + * to disable it for groups. + * default to false + * since 1.7.0 + * @type Boolean + * @default false + */ + statefullCache: !1, + /** + * When `true`, cache does not get updated during scaling. The picture will get blocky if scaled + * too much and will be redrawn with correct details at the end of scaling. + * this setting is performance and application dependant. + * default to true + * since 1.7.0 + * @type Boolean + * @default true + */ + noScaleCache: !0, + /** + * When `false`, the stoke width will scale with the object. + * When `true`, the stroke will always match the exact pixel size entered for stroke width. + * this Property does not work on Text classes or drawing call that uses strokeText,fillText methods + * default to false + * @since 2.6.0 + * @type Boolean + * @default false + * @type Boolean + * @default false + */ + strokeUniform: !1, + /** + * When set to `true`, object's cache will be rerendered next render call. + * since 1.7.0 + * @type Boolean + * @default true + */ + dirty: !0, + /** + * keeps the value of the last hovered corner during mouse move. + * 0 is no corner, or 'mt', 'ml', 'mtr' etc.. + * It should be private, but there is no harm in using it as + * a read-only property. + * @type number|string|any + * @default 0 + */ + __corner: 0, + /** + * Determines if the fill or the stroke is drawn first (one of "fill" or "stroke") + * @type String + * @default + */ + paintFirst: "fill", + /** + * When 'down', object is set to active on mousedown/touchstart + * When 'up', object is set to active on mouseup/touchend + * Experimental. Let's see if this breaks anything before supporting officially + * @private + * since 4.4.0 + * @type String + * @default 'down' + */ + activeOn: "down", + /** + * List of properties to consider when checking if state + * of an object is changed (fabric.Object#hasStateChanged) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: "top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "), + /** + * List of properties to consider when checking if cache needs refresh + * Those properties are checked by statefullCache ON ( or lazy mode if we want ) or from single + * calls to Object.set(key, value). If the key is in this list, the object is marked as dirty + * and refreshed at the next render + * @type Array + */ + cacheProperties: "fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "), + /** + * List of properties to consider for animating colors. + * @type Array + */ + colorProperties: "fill stroke backgroundColor".split(" "), + /** + * a fabricObject that, without stroke define a clipping area with their shape. filled in black + * the clipPath object gets used when the object has rendered, and the context is placed in the center + * of the object cacheCanvas. + * If you want 0,0 of a clipPath to align with an object center, use clipPath.originX/Y to 'center' + * @type fabric.Object + */ + clipPath: void 0, + /** + * Meaningful ONLY when the object is used as clipPath. + * if true, the clipPath will make the object clip to the outside of the clipPath + * since 2.4.0 + * @type boolean + * @default false + */ + inverted: !1, + /** + * Meaningful ONLY when the object is used as clipPath. + * if true, the clipPath will have its top and left relative to canvas, and will + * not be influenced by the object transform. This will make the clipPath relative + * to the canvas, but clipping just a particular object. + * WARNING this is beta, this feature may change or be renamed. + * since 2.4.0 + * @type boolean + * @default false + */ + absolutePositioned: !1, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(P) { + P && this.setOptions(P); + }, + /** + * Create a the canvas used to keep the cached copy of the object + * @private + */ + _createCacheCanvas: function() { + this._cacheProperties = {}, this._cacheCanvas = l.util.createCanvasElement(), this._cacheContext = this._cacheCanvas.getContext("2d"), this._updateCacheCanvas(), this.dirty = !0; + }, + /** + * Limit the cache dimensions so that X * Y do not cross fabric.perfLimitSizeTotal + * and each side do not cross fabric.cacheSideLimit + * those numbers are configurable so that you can get as much detail as you want + * making bargain with performances. + * @param {Object} dims + * @param {Object} dims.width width of canvas + * @param {Object} dims.height height of canvas + * @param {Object} dims.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @param {Object} dims.zoomY zoomY zoom value to unscale the canvas before drawing cache + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _limitCacheSize: function(P) { + var F = l.perfLimitSizeTotal, k = P.width, V = P.height, j = l.maxCacheSideLimit, Y = l.minCacheSideLimit; + if (k <= j && V <= j && k * V <= F) + return k < Y && (P.width = Y), V < Y && (P.height = Y), P; + var X = k / V, Q = l.util.limitDimsByArea(X, F), re = l.util.capValue, he = re(Y, Q.x, j), fe = re(Y, Q.y, j); + return k > he && (P.zoomX /= k / he, P.width = he, P.capped = !0), V > fe && (P.zoomY /= V / fe, P.height = fe, P.capped = !0), P; + }, + /** + * Return the dimension and the zoom level needed to create a cache canvas + * big enough to host the object to be cached. + * @private + * @return {Object}.x width of object to be cached + * @return {Object}.y height of object to be cached + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _getCacheCanvasDimensions: function() { + var P = this.getTotalObjectScaling(), F = this._getTransformedDimensions(0, 0), k = F.x * P.scaleX / this.scaleX, V = F.y * P.scaleY / this.scaleY; + return { + // for sure this ALIASING_LIMIT is slightly creating problem + // in situation in which the cache canvas gets an upper limit + // also objectScale contains already scaleX and scaleY + width: k + I, + height: V + I, + zoomX: P.scaleX, + zoomY: P.scaleY, + x: k, + y: V + }; + }, + /** + * Update width and height of the canvas for cache + * returns true or false if canvas needed resize. + * @private + * @return {Boolean} true if the canvas has been resized + */ + _updateCacheCanvas: function() { + var P = this.canvas; + if (this.noScaleCache && P && P._currentTransform) { + var F = P._currentTransform.target, k = P._currentTransform.action; + if (this === F && k.slice && k.slice(0, 5) === "scale") + return !1; + } + var V = this._cacheCanvas, j = this._limitCacheSize(this._getCacheCanvasDimensions()), Y = l.minCacheSideLimit, X = j.width, Q = j.height, re, he, fe = j.zoomX, be = j.zoomY, Se = X !== this.cacheWidth || Q !== this.cacheHeight, Me = this.zoomX !== fe || this.zoomY !== be, ke = Se || Me, J = 0, ce = 0, xe = !1; + if (Se) { + var Pe = this._cacheCanvas.width, Oe = this._cacheCanvas.height, Re = X > Pe || Q > Oe, Ge = (X < Pe * 0.9 || Q < Oe * 0.9) && Pe > Y && Oe > Y; + xe = Re || Ge, Re && !j.capped && (X > Y || Q > Y) && (J = X * 0.1, ce = Q * 0.1); + } + return this instanceof l.Text && this.path && (ke = !0, xe = !0, J += this.getHeightOfLine(0) * this.zoomX, ce += this.getHeightOfLine(0) * this.zoomY), ke ? (xe ? (V.width = Math.ceil(X + J), V.height = Math.ceil(Q + ce)) : (this._cacheContext.setTransform(1, 0, 0, 1, 0, 0), this._cacheContext.clearRect(0, 0, V.width, V.height)), re = j.x / 2, he = j.y / 2, this.cacheTranslationX = Math.round(V.width / 2 - re) + re, this.cacheTranslationY = Math.round(V.height / 2 - he) + he, this.cacheWidth = X, this.cacheHeight = Q, this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY), this._cacheContext.scale(fe, be), this.zoomX = fe, this.zoomY = be, !0) : !1; + }, + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions: function(P) { + this._setOptions(P), this._initGradient(P.fill, "fill"), this._initGradient(P.stroke, "stroke"), this._initPattern(P.fill, "fill"), this._initPattern(P.stroke, "stroke"); + }, + /** + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + */ + transform: function(P) { + var F = this.group && !this.group._transformDone || this.group && this.canvas && P === this.canvas.contextTop, k = this.calcTransformMatrix(!F); + P.transform(k[0], k[1], k[2], k[3], k[4], k[5]); + }, + /** + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(P) { + var F = l.Object.NUM_FRACTION_DIGITS, k = { + type: this.type, + version: l.version, + originX: this.originX, + originY: this.originY, + left: p(this.left, F), + top: p(this.top, F), + width: p(this.width, F), + height: p(this.height, F), + fill: this.fill && this.fill.toObject ? this.fill.toObject() : this.fill, + stroke: this.stroke && this.stroke.toObject ? this.stroke.toObject() : this.stroke, + strokeWidth: p(this.strokeWidth, F), + strokeDashArray: this.strokeDashArray ? this.strokeDashArray.concat() : this.strokeDashArray, + strokeLineCap: this.strokeLineCap, + strokeDashOffset: this.strokeDashOffset, + strokeLineJoin: this.strokeLineJoin, + strokeUniform: this.strokeUniform, + strokeMiterLimit: p(this.strokeMiterLimit, F), + scaleX: p(this.scaleX, F), + scaleY: p(this.scaleY, F), + angle: p(this.angle, F), + flipX: this.flipX, + flipY: this.flipY, + opacity: p(this.opacity, F), + shadow: this.shadow && this.shadow.toObject ? this.shadow.toObject() : this.shadow, + visible: this.visible, + backgroundColor: this.backgroundColor, + fillRule: this.fillRule, + paintFirst: this.paintFirst, + globalCompositeOperation: this.globalCompositeOperation, + skewX: p(this.skewX, F), + skewY: p(this.skewY, F) + }; + return this.clipPath && !this.clipPath.excludeFromExport && (k.clipPath = this.clipPath.toObject(P), k.clipPath.inverted = this.clipPath.inverted, k.clipPath.absolutePositioned = this.clipPath.absolutePositioned), l.util.populateWithProperties(this, k, P), this.includeDefaultValues || (k = this._removeDefaultValues(k)), k; + }, + /** + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toDatalessObject: function(P) { + return this.toObject(P); + }, + /** + * @private + * @param {Object} object + */ + _removeDefaultValues: function(P) { + var F = l.util.getKlass(P.type).prototype, k = F.stateProperties; + return k.forEach(function(V) { + V === "left" || V === "top" || (P[V] === F[V] && delete P[V], Array.isArray(P[V]) && Array.isArray(F[V]) && P[V].length === 0 && F[V].length === 0 && delete P[V]); + }), P; + }, + /** + * Returns a string representation of an instance + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Return the object scale factor counting also the group scaling + * @return {Object} object with scaleX and scaleY properties + */ + getObjectScaling: function() { + if (!this.group) + return { + scaleX: this.scaleX, + scaleY: this.scaleY + }; + var P = l.util.qrDecompose(this.calcTransformMatrix()); + return { scaleX: Math.abs(P.scaleX), scaleY: Math.abs(P.scaleY) }; + }, + /** + * Return the object scale factor counting also the group scaling, zoom and retina + * @return {Object} object with scaleX and scaleY properties + */ + getTotalObjectScaling: function() { + var P = this.getObjectScaling(), F = P.scaleX, k = P.scaleY; + if (this.canvas) { + var V = this.canvas.getZoom(), j = this.canvas.getRetinaScaling(); + F *= V * j, k *= V * j; + } + return { scaleX: F, scaleY: k }; + }, + /** + * Return the object opacity counting also the group property + * @return {Number} + */ + getObjectOpacity: function() { + var P = this.opacity; + return this.group && (P *= this.group.getObjectOpacity()), P; + }, + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Object} thisArg + */ + _set: function(P, F) { + var k = P === "scaleX" || P === "scaleY", V = this[P] !== F, j = !1; + return k && (F = this._constrainScale(F)), P === "scaleX" && F < 0 ? (this.flipX = !this.flipX, F *= -1) : P === "scaleY" && F < 0 ? (this.flipY = !this.flipY, F *= -1) : P === "shadow" && F && !(F instanceof l.Shadow) ? F = new l.Shadow(F) : P === "dirty" && this.group && this.group.set("dirty", F), this[P] = F, V && (j = this.group && this.group.isOnACache(), this.cacheProperties.indexOf(P) > -1 ? (this.dirty = !0, j && this.group.set("dirty", !0)) : j && this.stateProperties.indexOf(P) > -1 && this.group.set("dirty", !0)), this; + }, + /** + * This callback function is called by the parent group of an object every + * time a non-delegated property changes on the group. It is passed the key + * and value as parameters. Not adding in this function's signature to avoid + * Travis build error about unused variables. + */ + setOnGroup: function() { + }, + /** + * Retrieves viewportTransform from Object's canvas if possible + * @method getViewportTransform + * @memberOf fabric.Object.prototype + * @return {Array} + */ + getViewportTransform: function() { + return this.canvas && this.canvas.viewportTransform ? this.canvas.viewportTransform : l.iMatrix.concat(); + }, + /* + * @private + * return if the object would be visible in rendering + * @memberOf fabric.Object.prototype + * @return {Boolean} + */ + isNotVisible: function() { + return this.opacity === 0 || !this.width && !this.height && this.strokeWidth === 0 || !this.visible; + }, + /** + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(P) { + this.isNotVisible() || this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (P.save(), this._setupCompositeOperation(P), this.drawSelectionBackground(P), this.transform(P), this._setOpacity(P), this._setShadow(P, this), this.shouldCache() ? (this.renderCache(), this.drawCacheOnCanvas(P)) : (this._removeCacheCanvas(), this.dirty = !1, this.drawObject(P), this.objectCaching && this.statefullCache && this.saveState({ propertySet: "cacheProperties" })), P.restore()); + }, + renderCache: function(P) { + P = P || {}, (!this._cacheCanvas || !this._cacheContext) && this._createCacheCanvas(), this.isCacheDirty() && (this.statefullCache && this.saveState({ propertySet: "cacheProperties" }), this.drawObject(this._cacheContext, P.forClipping), this.dirty = !1); + }, + /** + * Remove cacheCanvas and its dimensions from the objects + */ + _removeCacheCanvas: function() { + this._cacheCanvas = null, this._cacheContext = null, this.cacheWidth = 0, this.cacheHeight = 0; + }, + /** + * return true if the object will draw a stroke + * Does not consider text styles. This is just a shortcut used at rendering time + * We want it to be an approximation and be fast. + * wrote to avoid extra caching, it has to return true when stroke happens, + * can guess when it will not happen at 100% chance, does not matter if it misses + * some use case where the stroke is invisible. + * @since 3.0.0 + * @returns Boolean + */ + hasStroke: function() { + return this.stroke && this.stroke !== "transparent" && this.strokeWidth !== 0; + }, + /** + * return true if the object will draw a fill + * Does not consider text styles. This is just a shortcut used at rendering time + * We want it to be an approximation and be fast. + * wrote to avoid extra caching, it has to return true when fill happens, + * can guess when it will not happen at 100% chance, does not matter if it misses + * some use case where the fill is invisible. + * @since 3.0.0 + * @returns Boolean + */ + hasFill: function() { + return this.fill && this.fill !== "transparent"; + }, + /** + * When set to `true`, force the object to have its own cache, even if it is inside a group + * it may be needed when your object behave in a particular way on the cache and always needs + * its own isolated canvas to render correctly. + * Created to be overridden + * since 1.7.12 + * @returns Boolean + */ + needsItsOwnCache: function() { + return !!(this.paintFirst === "stroke" && this.hasFill() && this.hasStroke() && typeof this.shadow == "object" || this.clipPath); + }, + /** + * Decide if the object should cache or not. Create its own cache level + * objectCaching is a global flag, wins over everything + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * Read as: cache if is needed, or if the feature is enabled but we are not already caching. + * @return {Boolean} + */ + shouldCache: function() { + return this.ownCaching = this.needsItsOwnCache() || this.objectCaching && (!this.group || !this.group.isOnACache()), this.ownCaching; + }, + /** + * Check if this object or a child object will cast a shadow + * used by Group.shouldCache to know if child has a shadow recursively + * @return {Boolean} + */ + willDrawShadow: function() { + return !!this.shadow && (this.shadow.offsetX !== 0 || this.shadow.offsetY !== 0); + }, + /** + * Execute the drawing operation for an object clipPath + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {fabric.Object} clipPath + */ + drawClipPathOnCache: function(P, F) { + if (P.save(), F.inverted ? P.globalCompositeOperation = "destination-out" : P.globalCompositeOperation = "destination-in", F.absolutePositioned) { + var k = l.util.invertTransform(this.calcTransformMatrix()); + P.transform(k[0], k[1], k[2], k[3], k[4], k[5]); + } + F.transform(P), P.scale(1 / F.zoomX, 1 / F.zoomY), P.drawImage(F._cacheCanvas, -F.cacheTranslationX, -F.cacheTranslationY), P.restore(); + }, + /** + * Execute the drawing operation for an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawObject: function(P, F) { + var k = this.fill, V = this.stroke; + F ? (this.fill = "black", this.stroke = "", this._setClippingProperties(P)) : this._renderBackground(P), this._render(P), this._drawClipPath(P, this.clipPath), this.fill = k, this.stroke = V; + }, + /** + * Prepare clipPath state and cache and draw it on instance's cache + * @param {CanvasRenderingContext2D} ctx + * @param {fabric.Object} clipPath + */ + _drawClipPath: function(P, F) { + F && (F.canvas = this.canvas, F.shouldCache(), F._transformDone = !0, F.renderCache({ forClipping: !0 }), this.drawClipPathOnCache(P, F)); + }, + /** + * Paint the cached copy of the object on the target context. + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawCacheOnCanvas: function(P) { + P.scale(1 / this.zoomX, 1 / this.zoomY), P.drawImage(this._cacheCanvas, -this.cacheTranslationX, -this.cacheTranslationY); + }, + /** + * Check if cache is dirty + * @param {Boolean} skipCanvas skip canvas checks because this object is painted + * on parent canvas. + */ + isCacheDirty: function(P) { + if (this.isNotVisible()) + return !1; + if (this._cacheCanvas && this._cacheContext && !P && this._updateCacheCanvas()) + return !0; + if (this.dirty || this.clipPath && this.clipPath.absolutePositioned || this.statefullCache && this.hasStateChanged("cacheProperties")) { + if (this._cacheCanvas && this._cacheContext && !P) { + var F = this.cacheWidth / this.zoomX, k = this.cacheHeight / this.zoomY; + this._cacheContext.clearRect(-F / 2, -k / 2, F, k); + } + return !0; + } + return !1; + }, + /** + * Draws a background for the object big as its untransformed dimensions + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderBackground: function(P) { + if (this.backgroundColor) { + var F = this._getNonTransformedDimensions(); + P.fillStyle = this.backgroundColor, P.fillRect( + -F.x / 2, + -F.y / 2, + F.x, + F.y + ), this._removeShadow(P); + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _setOpacity: function(P) { + this.group && !this.group._transformDone ? P.globalAlpha = this.getObjectOpacity() : P.globalAlpha *= this.opacity; + }, + _setStrokeStyles: function(P, F) { + var k = F.stroke; + k && (P.lineWidth = F.strokeWidth, P.lineCap = F.strokeLineCap, P.lineDashOffset = F.strokeDashOffset, P.lineJoin = F.strokeLineJoin, P.miterLimit = F.strokeMiterLimit, k.toLive ? k.gradientUnits === "percentage" || k.gradientTransform || k.patternTransform ? this._applyPatternForTransformedGradient(P, k) : (P.strokeStyle = k.toLive(P, this), this._applyPatternGradientTransform(P, k)) : P.strokeStyle = F.stroke); + }, + _setFillStyles: function(P, F) { + var k = F.fill; + k && (k.toLive ? (P.fillStyle = k.toLive(P, this), this._applyPatternGradientTransform(P, F.fill)) : P.fillStyle = k); + }, + _setClippingProperties: function(P) { + P.globalAlpha = 1, P.strokeStyle = "transparent", P.fillStyle = "#000000"; + }, + /** + * @private + * Sets line dash + * @param {CanvasRenderingContext2D} ctx Context to set the dash line on + * @param {Array} dashArray array representing dashes + */ + _setLineDash: function(P, F) { + !F || F.length === 0 || (1 & F.length && F.push.apply(F, F), P.setLineDash(F)); + }, + /** + * Renders controls and borders for the object + * the context here is not transformed + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [styleOverride] properties to override the object style + */ + _renderControls: function(P, F) { + var k = this.getViewportTransform(), V = this.calcTransformMatrix(), j, Y, X; + F = F || {}, Y = typeof F.hasBorders < "u" ? F.hasBorders : this.hasBorders, X = typeof F.hasControls < "u" ? F.hasControls : this.hasControls, V = l.util.multiplyTransformMatrices(k, V), j = l.util.qrDecompose(V), P.save(), P.translate(j.translateX, j.translateY), P.lineWidth = 1 * this.borderScaleFactor, this.group || (P.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1), this.flipX && (j.angle -= 180), P.rotate(v(this.group ? j.angle : this.angle)), F.forActiveSelection || this.group ? Y && this.drawBordersInGroup(P, j, F) : Y && this.drawBorders(P, F), X && this.drawControls(P, F), P.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _setShadow: function(P) { + if (this.shadow) { + var F = this.shadow, k = this.canvas, V, j = k && k.viewportTransform[0] || 1, Y = k && k.viewportTransform[3] || 1; + F.nonScaling ? V = { scaleX: 1, scaleY: 1 } : V = this.getObjectScaling(), k && k._isRetinaScaling() && (j *= l.devicePixelRatio, Y *= l.devicePixelRatio), P.shadowColor = F.color, P.shadowBlur = F.blur * l.browserShadowBlurConstant * (j + Y) * (V.scaleX + V.scaleY) / 4, P.shadowOffsetX = F.offsetX * j * V.scaleX, P.shadowOffsetY = F.offsetY * Y * V.scaleY; + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _removeShadow: function(P) { + this.shadow && (P.shadowColor = "", P.shadowBlur = P.shadowOffsetX = P.shadowOffsetY = 0); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} filler fabric.Pattern or fabric.Gradient + * @return {Object} offset.offsetX offset for text rendering + * @return {Object} offset.offsetY offset for text rendering + */ + _applyPatternGradientTransform: function(P, F) { + if (!F || !F.toLive) + return { offsetX: 0, offsetY: 0 }; + var k = F.gradientTransform || F.patternTransform, V = -this.width / 2 + F.offsetX || 0, j = -this.height / 2 + F.offsetY || 0; + return F.gradientUnits === "percentage" ? P.transform(this.width, 0, 0, this.height, V, j) : P.transform(1, 0, 0, 1, V, j), k && P.transform(k[0], k[1], k[2], k[3], k[4], k[5]), { offsetX: V, offsetY: j }; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderPaintInOrder: function(P) { + this.paintFirst === "stroke" ? (this._renderStroke(P), this._renderFill(P)) : (this._renderFill(P), this._renderStroke(P)); + }, + /** + * @private + * function that actually render something on the context. + * empty here to allow Obects to work on tests to benchmark fabric functionalites + * not related to rendering + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function() { + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderFill: function(P) { + this.fill && (P.save(), this._setFillStyles(P, this), this.fillRule === "evenodd" ? P.fill("evenodd") : P.fill(), P.restore()); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderStroke: function(P) { + if (!(!this.stroke || this.strokeWidth === 0)) { + if (this.shadow && !this.shadow.affectStroke && this._removeShadow(P), P.save(), this.strokeUniform && this.group) { + var F = this.getObjectScaling(); + P.scale(1 / F.scaleX, 1 / F.scaleY); + } else + this.strokeUniform && P.scale(1 / this.scaleX, 1 / this.scaleY); + this._setLineDash(P, this.strokeDashArray), this._setStrokeStyles(P, this), P.stroke(), P.restore(); + } + }, + /** + * This function try to patch the missing gradientTransform on canvas gradients. + * transforming a context to transform the gradient, is going to transform the stroke too. + * we want to transform the gradient but not the stroke operation, so we create + * a transformed gradient on a pattern and then we use the pattern instead of the gradient. + * this method has drwabacks: is slow, is in low resolution, needs a patch for when the size + * is limited. + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {fabric.Gradient} filler a fabric gradient instance + */ + _applyPatternForTransformedGradient: function(P, F) { + var k = this._limitCacheSize(this._getCacheCanvasDimensions()), V = l.util.createCanvasElement(), j, Y = this.canvas.getRetinaScaling(), X = k.x / this.scaleX / Y, Q = k.y / this.scaleY / Y; + V.width = X, V.height = Q, j = V.getContext("2d"), j.beginPath(), j.moveTo(0, 0), j.lineTo(X, 0), j.lineTo(X, Q), j.lineTo(0, Q), j.closePath(), j.translate(X / 2, Q / 2), j.scale( + k.zoomX / this.scaleX / Y, + k.zoomY / this.scaleY / Y + ), this._applyPatternGradientTransform(j, F), j.fillStyle = F.toLive(P), j.fill(), P.translate(-this.width / 2 - this.strokeWidth / 2, -this.height / 2 - this.strokeWidth / 2), P.scale( + Y * this.scaleX / k.zoomX, + Y * this.scaleY / k.zoomY + ), P.strokeStyle = j.createPattern(V, "no-repeat"); + }, + /** + * This function is an helper for svg import. it returns the center of the object in the svg + * untransformed coordinates + * @private + * @return {Object} center point from element coordinates + */ + _findCenterFromElement: function() { + return { x: this.left + this.width / 2, y: this.top + this.height / 2 }; + }, + /** + * This function is an helper for svg import. it decompose the transformMatrix + * and assign properties to object. + * untransformed coordinates + * @private + * @chainable + */ + _assignTransformMatrixProps: function() { + if (this.transformMatrix) { + var P = l.util.qrDecompose(this.transformMatrix); + this.flipX = !1, this.flipY = !1, this.set("scaleX", P.scaleX), this.set("scaleY", P.scaleY), this.angle = P.angle, this.skewX = P.skewX, this.skewY = 0; + } + }, + /** + * This function is an helper for svg import. it removes the transform matrix + * and set to object properties that fabricjs can handle + * @private + * @param {Object} preserveAspectRatioOptions + * @return {thisArg} + */ + _removeTransformMatrix: function(P) { + var F = this._findCenterFromElement(); + this.transformMatrix && (this._assignTransformMatrixProps(), F = l.util.transformPoint(F, this.transformMatrix)), this.transformMatrix = null, P && (this.scaleX *= P.scaleX, this.scaleY *= P.scaleY, this.cropX = P.cropX, this.cropY = P.cropY, F.x += P.offsetLeft, F.y += P.offsetTop, this.width = P.width, this.height = P.height), this.setPositionByOrigin(F, "center", "center"); + }, + /** + * Clones an instance, using a callback method will work for every object. + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone: function(P, F) { + var k = this.toObject(F); + this.constructor.fromObject ? this.constructor.fromObject(k, P) : l.Object._fromObject("Object", k, P); + }, + /** + * Creates an instance of fabric.Image out of an object + * makes use of toCanvasElement. + * Once this method was based on toDataUrl and loadImage, so it also had a quality + * and format option. toCanvasElement is faster and produce no loss of quality. + * If you need to get a real Jpeg or Png from an object, using toDataURL is the right way to do it. + * toCanvasElement and then toBlob from the obtained canvas is also a good option. + * This method is sync now, but still support the callback because we did not want to break. + * When fabricJS 5.0 will be planned, this will probably be changed to not have a callback. + * @param {Function} callback callback, invoked with an instance as a first argument + * @param {Object} [options] for clone as image, passed to toDataURL + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {fabric.Object} thisArg + */ + cloneAsImage: function(P, F) { + var k = this.toCanvasElement(F); + return P && P(new l.Image(k)), this; + }, + /** + * Converts an object into a HTMLCanvas element + * @param {Object} options Options object + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {HTMLCanvasElement} Returns DOM element with the fabric.Object + */ + toCanvasElement: function(P) { + P || (P = {}); + var F = l.util, k = F.saveObjectTransform(this), V = this.group, j = this.shadow, Y = Math.abs, X = (P.multiplier || 1) * (P.enableRetinaScaling ? l.devicePixelRatio : 1); + delete this.group, P.withoutTransform && F.resetObjectTransform(this), P.withoutShadow && (this.shadow = null); + var Q = l.util.createCanvasElement(), re = this.getBoundingRect(!0, !0), he = this.shadow, fe, be = { x: 0, y: 0 }, Se, Me, ke; + he && (Se = he.blur, he.nonScaling ? fe = { scaleX: 1, scaleY: 1 } : fe = this.getObjectScaling(), be.x = 2 * Math.round(Y(he.offsetX) + Se) * Y(fe.scaleX), be.y = 2 * Math.round(Y(he.offsetY) + Se) * Y(fe.scaleY)), Me = re.width + be.x, ke = re.height + be.y, Q.width = Math.ceil(Me), Q.height = Math.ceil(ke); + var J = new l.StaticCanvas(Q, { + enableRetinaScaling: !1, + renderOnAddRemove: !1, + skipOffscreen: !1 + }); + P.format === "jpeg" && (J.backgroundColor = "#fff"), this.setPositionByOrigin(new l.Point(J.width / 2, J.height / 2), "center", "center"); + var ce = this.canvas; + J.add(this); + var xe = J.toCanvasElement(X || 1, P); + return this.shadow = j, this.set("canvas", ce), V && (this.group = V), this.set(k).setCoords(), J._objects = [], J.dispose(), J = null, xe; + }, + /** + * Converts an object into a data-url-like string + * @param {Object} options Options object + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format + */ + toDataURL: function(P) { + return P || (P = {}), l.util.toDataURL(this.toCanvasElement(P), P.format || "png", P.quality || 1); + }, + /** + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + * @return {Boolean} + */ + isType: function(P) { + return arguments.length > 1 ? Array.from(arguments).includes(this.type) : this.type === P; + }, + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance (is 1 unless subclassed) + */ + complexity: function() { + return 1; + }, + /** + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} JSON + */ + toJSON: function(P) { + return this.toObject(P); + }, + /** + * Sets "angle" of an instance with centered rotation + * @param {Number} angle Angle value (in degrees) + * @return {fabric.Object} thisArg + * @chainable + */ + rotate: function(P) { + var F = (this.originX !== "center" || this.originY !== "center") && this.centeredRotation; + return F && this._setOriginToCenter(), this.set("angle", P), F && this._resetOrigin(), this; + }, + /** + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + centerH: function() { + return this.canvas && this.canvas.centerObjectH(this), this; + }, + /** + * Centers object horizontally on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenterH: function() { + return this.canvas && this.canvas.viewportCenterObjectH(this), this; + }, + /** + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + centerV: function() { + return this.canvas && this.canvas.centerObjectV(this), this; + }, + /** + * Centers object vertically on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenterV: function() { + return this.canvas && this.canvas.viewportCenterObjectV(this), this; + }, + /** + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + center: function() { + return this.canvas && this.canvas.centerObject(this), this; + }, + /** + * Centers object on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenter: function() { + return this.canvas && this.canvas.viewportCenterObject(this), this; + }, + /** + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + * @return {Object} Coordinates of a pointer (x, y) + */ + getLocalPointer: function(P, F) { + F = F || this.canvas.getPointer(P); + var k = new l.Point(F.x, F.y), V = this._getLeftTopCoords(); + return this.angle && (k = l.util.rotatePoint( + k, + V, + v(-this.angle) + )), { + x: k.x - V.x, + y: k.y - V.y + }; + }, + /** + * Sets canvas globalCompositeOperation for specific object + * custom composition operation for the particular object can be specified using globalCompositeOperation property + * @param {CanvasRenderingContext2D} ctx Rendering canvas context + */ + _setupCompositeOperation: function(P) { + this.globalCompositeOperation && (P.globalCompositeOperation = this.globalCompositeOperation); + }, + /** + * cancel instance's running animations + * override if necessary to dispose artifacts such as `clipPath` + */ + dispose: function() { + l.runningAnimations && l.runningAnimations.cancelByTarget(this); + } + } + ), l.util.createAccessors && l.util.createAccessors(l.Object), c(l.Object.prototype, l.Observable), l.Object.NUM_FRACTION_DIGITS = 2, l.Object.ENLIVEN_PROPS = ["clipPath"], l.Object._fromObject = function(P, F, k, V) { + var j = l[P]; + F = h(F, !0), l.util.enlivenPatterns([F.fill, F.stroke], function(Y) { + typeof Y[0] < "u" && (F.fill = Y[0]), typeof Y[1] < "u" && (F.stroke = Y[1]), l.util.enlivenObjectEnlivables(F, F, function() { + var X = V ? new j(F[V], F) : new j(F); + k && k(X); + }); + }); + }, l.Object.__uid = 0); + }(t), function() { + var a = e.util.degreesToRadians, l = { + left: -0.5, + center: 0, + right: 0.5 + }, c = { + top: -0.5, + center: 0, + bottom: 0.5 + }; + e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Translates the coordinates from a set of origin to another (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} fromOriginX Horizontal origin: 'left', 'center' or 'right' + * @param {String} fromOriginY Vertical origin: 'top', 'center' or 'bottom' + * @param {String} toOriginX Horizontal origin: 'left', 'center' or 'right' + * @param {String} toOriginY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToGivenOrigin: function(h, p, y, v, x) { + var I = h.x, P = h.y, F, k, V; + return typeof p == "string" ? p = l[p] : p -= 0.5, typeof v == "string" ? v = l[v] : v -= 0.5, F = v - p, typeof y == "string" ? y = c[y] : y -= 0.5, typeof x == "string" ? x = c[x] : x -= 0.5, k = x - y, (F || k) && (V = this._getTransformedDimensions(), I = h.x + F * V.x, P = h.y + k * V.y), new e.Point(I, P); + }, + /** + * Translates the coordinates from origin to center coordinates (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToCenterPoint: function(h, p, y) { + var v = this.translateToGivenOrigin(h, p, y, "center", "center"); + return this.angle ? e.util.rotatePoint(v, h, a(this.angle)) : v; + }, + /** + * Translates the coordinates from center to origin coordinates (based on the object's dimensions) + * @param {fabric.Point} center The point which corresponds to center of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToOriginPoint: function(h, p, y) { + var v = this.translateToGivenOrigin(h, "center", "center", p, y); + return this.angle ? e.util.rotatePoint(v, h, a(this.angle)) : v; + }, + /** + * Returns the real center coordinates of the object + * @return {fabric.Point} + */ + getCenterPoint: function() { + var h = new e.Point(this.left, this.top); + return this.translateToCenterPoint(h, this.originX, this.originY); + }, + /** + * Returns the coordinates of the object based on center coordinates + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @return {fabric.Point} + */ + // getOriginPoint: function(center) { + // return this.translateToOriginPoint(center, this.originX, this.originY); + // }, + /** + * Returns the coordinates of the object as if it has a different origin + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + getPointByOrigin: function(h, p) { + var y = this.getCenterPoint(); + return this.translateToOriginPoint(y, h, p); + }, + /** + * Returns the point in local coordinates + * @param {fabric.Point} point The point relative to the global coordinate system + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + toLocalPoint: function(h, p, y) { + var v = this.getCenterPoint(), x, I; + return typeof p < "u" && typeof y < "u" ? x = this.translateToGivenOrigin(v, "center", "center", p, y) : x = new e.Point(this.left, this.top), I = new e.Point(h.x, h.y), this.angle && (I = e.util.rotatePoint(I, v, -a(this.angle))), I.subtractEquals(x); + }, + /** + * Returns the point in global coordinates + * @param {fabric.Point} The point relative to the local coordinate system + * @return {fabric.Point} + */ + // toGlobalPoint: function(point) { + // return fabric.util.rotatePoint(point, this.getCenterPoint(), degreesToRadians(this.angle)).addEquals(new fabric.Point(this.left, this.top)); + // }, + /** + * Sets the position of the object taking into consideration the object's origin + * @param {fabric.Point} pos The new position of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {void} + */ + setPositionByOrigin: function(h, p, y) { + var v = this.translateToCenterPoint(h, p, y), x = this.translateToOriginPoint(v, this.originX, this.originY); + this.set("left", x.x), this.set("top", x.y); + }, + /** + * @param {String} to One of 'left', 'center', 'right' + */ + adjustPosition: function(h) { + var p = a(this.angle), y = this.getScaledWidth(), v = e.util.cos(p) * y, x = e.util.sin(p) * y, I, P; + typeof this.originX == "string" ? I = l[this.originX] : I = this.originX - 0.5, typeof h == "string" ? P = l[h] : P = h - 0.5, this.left += v * (P - I), this.top += x * (P - I), this.setCoords(), this.originX = h; + }, + /** + * Sets the origin/position of the object to it's center point + * @private + * @return {void} + */ + _setOriginToCenter: function() { + this._originalOriginX = this.originX, this._originalOriginY = this.originY; + var h = this.getCenterPoint(); + this.originX = "center", this.originY = "center", this.left = h.x, this.top = h.y; + }, + /** + * Resets the origin/position of the object to it's original origin + * @private + * @return {void} + */ + _resetOrigin: function() { + var h = this.translateToOriginPoint( + this.getCenterPoint(), + this._originalOriginX, + this._originalOriginY + ); + this.originX = this._originalOriginX, this.originY = this._originalOriginY, this.left = h.x, this.top = h.y, this._originalOriginX = null, this._originalOriginY = null; + }, + /** + * @private + */ + _getLeftTopCoords: function() { + return this.translateToOriginPoint(this.getCenterPoint(), "left", "top"); + } + } + ); + }(), function() { + function a(y) { + return [ + new e.Point(y.tl.x, y.tl.y), + new e.Point(y.tr.x, y.tr.y), + new e.Point(y.br.x, y.br.y), + new e.Point(y.bl.x, y.bl.y) + ]; + } + var l = e.util, c = l.degreesToRadians, h = l.multiplyTransformMatrices, p = l.transformPoint; + l.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Describe object's corner position in canvas element coordinates. + * properties are depending on control keys and padding the main controls. + * each property is an object with x, y and corner. + * The `corner` property contains in a similar manner the 4 points of the + * interactive area of the corner. + * The coordinates depends from the controls positionHandler and are used + * to draw and locate controls + * @memberOf fabric.Object.prototype + */ + oCoords: null, + /** + * Describe object's corner position in canvas object absolute coordinates + * properties are tl,tr,bl,br and describe the four main corner. + * each property is an object with x, y, instance of Fabric.Point. + * The coordinates depends from this properties: width, height, scaleX, scaleY + * skewX, skewY, angle, strokeWidth, top, left. + * Those coordinates are useful to understand where an object is. They get updated + * with oCoords but they do not need to be updated when zoom or panning change. + * The coordinates get updated with @method setCoords. + * You can calculate them without updating with @method calcACoords(); + * @memberOf fabric.Object.prototype + */ + aCoords: null, + /** + * Describe object's corner position in canvas element coordinates. + * includes padding. Used of object detection. + * set and refreshed with setCoords. + * @memberOf fabric.Object.prototype + */ + lineCoords: null, + /** + * storage for object transform matrix + */ + ownMatrixCache: null, + /** + * storage for object full transform matrix + */ + matrixCache: null, + /** + * custom controls interface + * controls are added by default_controls.js + */ + controls: {}, + /** + * return correct set of coordinates for intersection + * this will return either aCoords or lineCoords. + * @param {Boolean} absolute will return aCoords if true or lineCoords + * @return {Object} {tl, tr, br, bl} points + */ + _getCoords: function(y, v) { + return v ? y ? this.calcACoords() : this.calcLineCoords() : ((!this.aCoords || !this.lineCoords) && this.setCoords(!0), y ? this.aCoords : this.lineCoords); + }, + /** + * return correct set of coordinates for intersection + * this will return either aCoords or lineCoords. + * The coords are returned in an array. + * @return {Array} [tl, tr, br, bl] of points + */ + getCoords: function(y, v) { + return a(this._getCoords(y, v)); + }, + /** + * Checks if object intersects with an area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object intersects with an area formed by 2 points + */ + intersectsWithRect: function(y, v, x, I) { + var P = this.getCoords(x, I), F = e.Intersection.intersectPolygonRectangle( + P, + y, + v + ); + return F.status === "Intersection"; + }, + /** + * Checks if object intersects with another object + * @param {Object} other Object to test + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object intersects with another object + */ + intersectsWithObject: function(y, v, x) { + var I = e.Intersection.intersectPolygonPolygon( + this.getCoords(v, x), + y.getCoords(v, x) + ); + return I.status === "Intersection" || y.isContainedWithinObject(this, v, x) || this.isContainedWithinObject(y, v, x); + }, + /** + * Checks if object is fully contained within area of another object + * @param {Object} other Object to test + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is fully contained within area of another object + */ + isContainedWithinObject: function(y, v, x) { + for (var I = this.getCoords(v, x), P = v ? y.aCoords : y.lineCoords, F = 0, k = y._getImageLines(P); F < 4; F++) + if (!y.containsPoint(I[F], k)) + return !1; + return !0; + }, + /** + * Checks if object is fully contained within area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is fully contained within area formed by 2 points + */ + isContainedWithinRect: function(y, v, x, I) { + var P = this.getBoundingRect(x, I); + return P.left >= y.x && P.left + P.width <= v.x && P.top >= y.y && P.top + P.height <= v.y; + }, + /** + * Checks if point is inside the object + * @param {fabric.Point} point Point to check against + * @param {Object} [lines] object returned from @method _getImageLines + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if point is inside the object + */ + containsPoint: function(y, F, x, I) { + var P = this._getCoords(x, I), F = F || this._getImageLines(P), k = this._findCrossPoints(y, F); + return k !== 0 && k % 2 === 1; + }, + /** + * Checks if object is contained within the canvas with current viewportTransform + * the check is done stopping at first point that appears on screen + * @param {Boolean} [calculate] use coordinates of current position instead of .aCoords + * @return {Boolean} true if object is fully or partially contained within canvas + */ + isOnScreen: function(y) { + if (!this.canvas) + return !1; + var v = this.canvas.vptCoords.tl, x = this.canvas.vptCoords.br, I = this.getCoords(!0, y); + return I.some(function(P) { + return P.x <= x.x && P.x >= v.x && P.y <= x.y && P.y >= v.y; + }) || this.intersectsWithRect(v, x, !0, y) ? !0 : this._containsCenterOfCanvas(v, x, y); + }, + /** + * Checks if the object contains the midpoint between canvas extremities + * Does not make sense outside the context of isOnScreen and isPartiallyOnScreen + * @private + * @param {Fabric.Point} pointTL Top Left point + * @param {Fabric.Point} pointBR Top Right point + * @param {Boolean} calculate use coordinates of current position instead of .oCoords + * @return {Boolean} true if the object contains the point + */ + _containsCenterOfCanvas: function(y, v, x) { + var I = { x: (y.x + v.x) / 2, y: (y.y + v.y) / 2 }; + return !!this.containsPoint(I, null, !0, x); + }, + /** + * Checks if object is partially contained within the canvas with current viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is partially contained within canvas + */ + isPartiallyOnScreen: function(y) { + if (!this.canvas) + return !1; + var v = this.canvas.vptCoords.tl, x = this.canvas.vptCoords.br; + if (this.intersectsWithRect(v, x, !0, y)) + return !0; + var I = this.getCoords(!0, y).every(function(P) { + return (P.x >= x.x || P.x <= v.x) && (P.y >= x.y || P.y <= v.y); + }); + return I && this._containsCenterOfCanvas(v, x, y); + }, + /** + * Method that returns an object with the object edges in it, given the coordinates of the corners + * @private + * @param {Object} oCoords Coordinates of the object corners + */ + _getImageLines: function(y) { + var v = { + topline: { + o: y.tl, + d: y.tr + }, + rightline: { + o: y.tr, + d: y.br + }, + bottomline: { + o: y.br, + d: y.bl + }, + leftline: { + o: y.bl, + d: y.tl + } + }; + return v; + }, + /** + * Helper method to determine how many cross points are between the 4 object edges + * and the horizontal line determined by a point on canvas + * @private + * @param {fabric.Point} point Point to check + * @param {Object} lines Coordinates of the object being evaluated + */ + // remove yi, not used but left code here just in case. + _findCrossPoints: function(y, v) { + var x, I, P, F, k, V = 0, j; + for (var Y in v) + if (j = v[Y], !(j.o.y < y.y && j.d.y < y.y) && !(j.o.y >= y.y && j.d.y >= y.y) && (j.o.x === j.d.x && j.o.x >= y.x ? k = j.o.x : (x = 0, I = (j.d.y - j.o.y) / (j.d.x - j.o.x), P = y.y - x * y.x, F = j.o.y - I * j.o.x, k = -(P - F) / (x - I)), k >= y.x && (V += 1), V === 2)) + break; + return V; + }, + /** + * Returns coordinates of object's bounding rectangle (left, top, width, height) + * the box is intended as aligned to axis of canvas. + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords / .aCoords + * @return {Object} Object with left, top, width, height properties + */ + getBoundingRect: function(y, v) { + var x = this.getCoords(y, v); + return l.makeBoundingBoxFromPoints(x); + }, + /** + * Returns width of an object's bounding box counting transformations + * before 2.0 it was named getWidth(); + * @return {Number} width value + */ + getScaledWidth: function() { + return this._getTransformedDimensions().x; + }, + /** + * Returns height of an object bounding box counting transformations + * before 2.0 it was named getHeight(); + * @return {Number} height value + */ + getScaledHeight: function() { + return this._getTransformedDimensions().y; + }, + /** + * Makes sure the scale is valid and modifies it if necessary + * @private + * @param {Number} value + * @return {Number} + */ + _constrainScale: function(y) { + return Math.abs(y) < this.minScaleLimit ? y < 0 ? -this.minScaleLimit : this.minScaleLimit : y === 0 ? 1e-4 : y; + }, + /** + * Scales an object (equally by x and y) + * @param {Number} value Scale factor + * @return {fabric.Object} thisArg + * @chainable + */ + scale: function(y) { + return this._set("scaleX", y), this._set("scaleY", y), this.setCoords(); + }, + /** + * Scales an object to a given width, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New width value + * @param {Boolean} absolute ignore viewport + * @return {fabric.Object} thisArg + * @chainable + */ + scaleToWidth: function(y, v) { + var x = this.getBoundingRect(v).width / this.getScaledWidth(); + return this.scale(y / this.width / x); + }, + /** + * Scales an object to a given height, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New height value + * @param {Boolean} absolute ignore viewport + * @return {fabric.Object} thisArg + * @chainable + */ + scaleToHeight: function(y, v) { + var x = this.getBoundingRect(v).height / this.getScaledHeight(); + return this.scale(y / this.height / x); + }, + calcLineCoords: function() { + var y = this.getViewportTransform(), v = this.padding, x = c(this.angle), I = l.cos(x), P = l.sin(x), F = I * v, k = P * v, V = F + k, j = F - k, Y = this.calcACoords(), X = { + tl: p(Y.tl, y), + tr: p(Y.tr, y), + bl: p(Y.bl, y), + br: p(Y.br, y) + }; + return v && (X.tl.x -= j, X.tl.y -= V, X.tr.x += V, X.tr.y -= j, X.bl.x -= V, X.bl.y += j, X.br.x += j, X.br.y += V), X; + }, + calcOCoords: function() { + var y = this._calcRotateMatrix(), v = this._calcTranslateMatrix(), x = this.getViewportTransform(), I = h(x, v), P = h(I, y), P = h(P, [1 / x[0], 0, 0, 1 / x[3], 0, 0]), F = this._calculateCurrentDimensions(), k = {}; + return this.forEachControl(function(V, j, Y) { + k[j] = V.positionHandler(F, P, Y); + }), k; + }, + calcACoords: function() { + var y = this._calcRotateMatrix(), v = this._calcTranslateMatrix(), x = h(v, y), I = this._getTransformedDimensions(), P = I.x / 2, F = I.y / 2; + return { + // corners + tl: p({ x: -P, y: -F }, x), + tr: p({ x: P, y: -F }, x), + bl: p({ x: -P, y: F }, x), + br: p({ x: P, y: F }, x) + }; + }, + /** + * Sets corner and controls position coordinates based on current angle, width and height, left and top. + * oCoords are used to find the corners + * aCoords are used to quickly find an object on the canvas + * lineCoords are used to quickly find object during pointer events. + * See {@link https://github.com/fabricjs/fabric.js/wiki/When-to-call-setCoords} and {@link http://fabricjs.com/fabric-gotchas} + * + * @param {Boolean} [skipCorners] skip calculation of oCoords. + * @return {fabric.Object} thisArg + * @chainable + */ + setCoords: function(y) { + return this.aCoords = this.calcACoords(), this.lineCoords = this.group ? this.aCoords : this.calcLineCoords(), y ? this : (this.oCoords = this.calcOCoords(), this._setCornerCoords && this._setCornerCoords(), this); + }, + /** + * calculate rotation matrix of an object + * @return {Array} rotation matrix for the object + */ + _calcRotateMatrix: function() { + return l.calcRotateMatrix(this); + }, + /** + * calculate the translation matrix for an object transform + * @return {Array} rotation matrix for the object + */ + _calcTranslateMatrix: function() { + var y = this.getCenterPoint(); + return [1, 0, 0, 1, y.x, y.y]; + }, + transformMatrixKey: function(y) { + var v = "_", x = ""; + return !y && this.group && (x = this.group.transformMatrixKey(y) + v), x + this.top + v + this.left + v + this.scaleX + v + this.scaleY + v + this.skewX + v + this.skewY + v + this.angle + v + this.originX + v + this.originY + v + this.width + v + this.height + v + this.strokeWidth + this.flipX + this.flipY; + }, + /** + * calculate transform matrix that represents the current transformations from the + * object's properties. + * @param {Boolean} [skipGroup] return transform matrix for object not counting parent transformations + * There are some situation in which this is useful to avoid the fake rotation. + * @return {Array} transform matrix for the object + */ + calcTransformMatrix: function(y) { + var v = this.calcOwnMatrix(); + if (y || !this.group) + return v; + var x = this.transformMatrixKey(y), I = this.matrixCache || (this.matrixCache = {}); + return I.key === x ? I.value : (this.group && (v = h(this.group.calcTransformMatrix(!1), v)), I.key = x, I.value = v, v); + }, + /** + * calculate transform matrix that represents the current transformations from the + * object's properties, this matrix does not include the group transformation + * @return {Array} transform matrix for the object + */ + calcOwnMatrix: function() { + var y = this.transformMatrixKey(!0), v = this.ownMatrixCache || (this.ownMatrixCache = {}); + if (v.key === y) + return v.value; + var x = this._calcTranslateMatrix(), I = { + angle: this.angle, + translateX: x[4], + translateY: x[5], + scaleX: this.scaleX, + scaleY: this.scaleY, + skewX: this.skewX, + skewY: this.skewY, + flipX: this.flipX, + flipY: this.flipY + }; + return v.key = y, v.value = l.composeMatrix(I), v.value; + }, + /* + * Calculate object dimensions from its properties + * @private + * @return {Object} .x width dimension + * @return {Object} .y height dimension + */ + _getNonTransformedDimensions: function() { + var y = this.strokeWidth, v = this.width + y, x = this.height + y; + return { x: v, y: x }; + }, + /* + * Calculate object bounding box dimensions from its properties scale, skew. + * @param {Number} skewX, a value to override current skewX + * @param {Number} skewY, a value to override current skewY + * @private + * @return {Object} .x width dimension + * @return {Object} .y height dimension + */ + _getTransformedDimensions: function(y, v) { + typeof y > "u" && (y = this.skewX), typeof v > "u" && (v = this.skewY); + var x, I, P, F = y === 0 && v === 0; + if (this.strokeUniform ? (I = this.width, P = this.height) : (x = this._getNonTransformedDimensions(), I = x.x, P = x.y), F) + return this._finalizeDimensions(I * this.scaleX, P * this.scaleY); + var k = l.sizeAfterTransform(I, P, { + scaleX: this.scaleX, + scaleY: this.scaleY, + skewX: y, + skewY: v + }); + return this._finalizeDimensions(k.x, k.y); + }, + /* + * Calculate object bounding box dimensions from its properties scale, skew. + * @param Number width width of the bbox + * @param Number height height of the bbox + * @private + * @return {Object} .x finalized width dimension + * @return {Object} .y finalized height dimension + */ + _finalizeDimensions: function(y, v) { + return this.strokeUniform ? { x: y + this.strokeWidth, y: v + this.strokeWidth } : { x: y, y: v }; + }, + /* + * Calculate object dimensions for controls box, including padding and canvas zoom. + * and active selection + * private + */ + _calculateCurrentDimensions: function() { + var y = this.getViewportTransform(), v = this._getTransformedDimensions(), x = p(v, y, !0); + return x.scalarAdd(2 * this.padding); + } + } + ); + }(), e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Moves an object to the bottom of the stack of drawn objects + * @return {fabric.Object} thisArg + * @chainable + */ + sendToBack: function() { + return this.group ? e.StaticCanvas.prototype.sendToBack.call(this.group, this) : this.canvas && this.canvas.sendToBack(this), this; + }, + /** + * Moves an object to the top of the stack of drawn objects + * @return {fabric.Object} thisArg + * @chainable + */ + bringToFront: function() { + return this.group ? e.StaticCanvas.prototype.bringToFront.call(this.group, this) : this.canvas && this.canvas.bringToFront(this), this; + }, + /** + * Moves an object down in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @return {fabric.Object} thisArg + * @chainable + */ + sendBackwards: function(a) { + return this.group ? e.StaticCanvas.prototype.sendBackwards.call(this.group, this, a) : this.canvas && this.canvas.sendBackwards(this, a), this; + }, + /** + * Moves an object up in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @return {fabric.Object} thisArg + * @chainable + */ + bringForward: function(a) { + return this.group ? e.StaticCanvas.prototype.bringForward.call(this.group, this, a) : this.canvas && this.canvas.bringForward(this, a), this; + }, + /** + * Moves an object to specified level in stack of drawn objects + * @param {Number} index New position of object + * @return {fabric.Object} thisArg + * @chainable + */ + moveTo: function(a) { + return this.group && this.group.type !== "activeSelection" ? e.StaticCanvas.prototype.moveTo.call(this.group, this, a) : this.canvas && this.canvas.moveTo(this, a), this; + } + } + ), function() { + function a(c, h) { + if (h) { + if (h.toLive) + return c + ": url(#SVGID_" + h.id + "); "; + var p = new e.Color(h), y = c + ": " + p.toRgb() + "; ", v = p.getAlpha(); + return v !== 1 && (y += c + "-opacity: " + v.toString() + "; "), y; + } else + return c + ": none; "; + } + var l = e.util.toFixed; + e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Returns styles-string for svg-export + * @param {Boolean} skipShadow a boolean to skip shadow filter output + * @return {String} + */ + getSvgStyles: function(c) { + var h = this.fillRule ? this.fillRule : "nonzero", p = this.strokeWidth ? this.strokeWidth : "0", y = this.strokeDashArray ? this.strokeDashArray.join(" ") : "none", v = this.strokeDashOffset ? this.strokeDashOffset : "0", x = this.strokeLineCap ? this.strokeLineCap : "butt", I = this.strokeLineJoin ? this.strokeLineJoin : "miter", P = this.strokeMiterLimit ? this.strokeMiterLimit : "4", F = typeof this.opacity < "u" ? this.opacity : "1", k = this.visible ? "" : " visibility: hidden;", V = c ? "" : this.getSvgFilter(), j = a("fill", this.fill), Y = a("stroke", this.stroke); + return [ + Y, + "stroke-width: ", + p, + "; ", + "stroke-dasharray: ", + y, + "; ", + "stroke-linecap: ", + x, + "; ", + "stroke-dashoffset: ", + v, + "; ", + "stroke-linejoin: ", + I, + "; ", + "stroke-miterlimit: ", + P, + "; ", + j, + "fill-rule: ", + h, + "; ", + "opacity: ", + F, + ";", + V, + k + ].join(""); + }, + /** + * Returns styles-string for svg-export + * @param {Object} style the object from which to retrieve style properties + * @param {Boolean} useWhiteSpace a boolean to include an additional attribute in the style. + * @return {String} + */ + getSvgSpanStyles: function(c, h) { + var p = "; ", v = c.fontFamily ? "font-family: " + (c.fontFamily.indexOf("'") === -1 && c.fontFamily.indexOf('"') === -1 ? "'" + c.fontFamily + "'" : c.fontFamily) + p : "", y = c.strokeWidth ? "stroke-width: " + c.strokeWidth + p : "", v = v, x = c.fontSize ? "font-size: " + c.fontSize + "px" + p : "", I = c.fontStyle ? "font-style: " + c.fontStyle + p : "", P = c.fontWeight ? "font-weight: " + c.fontWeight + p : "", F = c.fill ? a("fill", c.fill) : "", k = c.stroke ? a("stroke", c.stroke) : "", V = this.getSvgTextDecoration(c), j = c.deltaY ? "baseline-shift: " + -c.deltaY + "; " : ""; + return V && (V = "text-decoration: " + V + p), [ + k, + y, + v, + x, + I, + P, + V, + F, + j, + h ? "white-space: pre; " : "" + ].join(""); + }, + /** + * Returns text-decoration property for svg-export + * @param {Object} style the object from which to retrieve style properties + * @return {String} + */ + getSvgTextDecoration: function(c) { + return ["overline", "underline", "line-through"].filter(function(h) { + return c[h.replace("-", "")]; + }).join(" "); + }, + /** + * Returns filter for svg shadow + * @return {String} + */ + getSvgFilter: function() { + return this.shadow ? "filter: url(#SVGID_" + this.shadow.id + ");" : ""; + }, + /** + * Returns id attribute for svg output + * @return {String} + */ + getSvgCommons: function() { + return [ + this.id ? 'id="' + this.id + '" ' : "", + this.clipPath ? 'clip-path="url(#' + this.clipPath.clipPathId + ')" ' : "" + ].join(""); + }, + /** + * Returns transform-string for svg-export + * @param {Boolean} use the full transform or the single object one. + * @return {String} + */ + getSvgTransform: function(c, h) { + var p = c ? this.calcTransformMatrix() : this.calcOwnMatrix(), y = 'transform="' + e.util.matrixToSVG(p); + return y + (h || "") + '" '; + }, + _setSVGBg: function(c) { + if (this.backgroundColor) { + var h = e.Object.NUM_FRACTION_DIGITS; + c.push( + " +` + ); + } + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(c) { + return this._createBaseSVGMarkup(this._toSVG(c), { reviver: c }); + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(c) { + return " " + this._createBaseClipPathSVGMarkup(this._toSVG(c), { reviver: c }); + }, + /** + * @private + */ + _createBaseClipPathSVGMarkup: function(c, h) { + h = h || {}; + var p = h.reviver, y = h.additionalTransform || "", v = [ + this.getSvgTransform(!0, y), + this.getSvgCommons() + ].join(""), x = c.indexOf("COMMON_PARTS"); + return c[x] = v, p ? p(c.join("")) : c.join(""); + }, + /** + * @private + */ + _createBaseSVGMarkup: function(c, h) { + h = h || {}; + var p = h.noStyle, y = h.reviver, v = p ? "" : 'style="' + this.getSvgStyles() + '" ', x = h.withShadow ? 'style="' + this.getSvgFilter() + '" ' : "", I = this.clipPath, P = this.strokeUniform ? 'vector-effect="non-scaling-stroke" ' : "", F = I && I.absolutePositioned, k = this.stroke, V = this.fill, j = this.shadow, Y, X = [], Q, re = c.indexOf("COMMON_PARTS"), he = h.additionalTransform; + return I && (I.clipPathId = "CLIPPATH_" + e.Object.__uid++, Q = ' +` + I.toClipPathSVG(y) + ` +`), F && X.push( + " +` + ), X.push( + " +` + ), Y = [ + v, + P, + p ? "" : this.addPaintOrder(), + " ", + he ? 'transform="' + he + '" ' : "" + ].join(""), c[re] = Y, V && V.toLive && X.push(V.toSVG(this)), k && k.toLive && X.push(k.toSVG(this)), j && X.push(j.toSVG(this)), I && X.push(Q), X.push(c.join("")), X.push(` +`), F && X.push(` +`), y ? y(X.join("")) : X.join(""); + }, + addPaintOrder: function() { + return this.paintFirst !== "fill" ? ' paint-order="' + this.paintFirst + '" ' : ""; + } + } + ); + }(), function() { + var a = e.util.object.extend, l = "stateProperties"; + function c(p, y, v) { + var x = {}, I = !0; + v.forEach(function(P) { + x[P] = p[P]; + }), a(p[y], x, I); + } + function h(p, y, v) { + if (p === y) + return !0; + if (Array.isArray(p)) { + if (!Array.isArray(y) || p.length !== y.length) + return !1; + for (var x = 0, I = p.length; x < I; x++) + if (!h(p[x], y[x])) + return !1; + return !0; + } else if (p && typeof p == "object") { + var P = Object.keys(p), F; + if (!y || typeof y != "object" || !v && P.length !== Object.keys(y).length) + return !1; + for (var x = 0, I = P.length; x < I; x++) + if (F = P[x], !(F === "canvas" || F === "group") && !h(p[F], y[F])) + return !1; + return !0; + } + } + e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Returns true if object state (one of its state properties) was changed + * @param {String} [propertySet] optional name for the set of property we want to save + * @return {Boolean} true if instance' state has changed since `{@link fabric.Object#saveState}` was called + */ + hasStateChanged: function(p) { + p = p || l; + var y = "_" + p; + return Object.keys(this[y]).length < this[p].length ? !0 : !h(this[y], this, !0); + }, + /** + * Saves state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + saveState: function(p) { + var y = p && p.propertySet || l, v = "_" + y; + return this[v] ? (c(this, v, this[y]), p && p.stateProperties && c(this, v, p.stateProperties), this) : this.setupState(p); + }, + /** + * Setups state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + setupState: function(p) { + p = p || {}; + var y = p.propertySet || l; + return p.propertySet = y, this["_" + y] = {}, this.saveState(p), this; + } + } + ); + }(), function() { + var a = e.util.degreesToRadians; + e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Determines which corner has been clicked + * @private + * @param {Object} pointer The pointer indicating the mouse position + * @return {String|Boolean} corner code (tl, tr, bl, br, etc.), or false if nothing is found + */ + _findTargetCorner: function(l, c) { + if (!this.hasControls || this.group || !this.canvas || this.canvas._activeObject !== this) + return !1; + var h = l.x, p = l.y, y, v, x = Object.keys(this.oCoords), I = x.length - 1, P; + for (this.__corner = 0; I >= 0; I--) + if (P = x[I], !!this.isControlVisible(P) && (v = this._getImageLines(c ? this.oCoords[P].touchCorner : this.oCoords[P].corner), y = this._findCrossPoints({ x: h, y: p }, v), y !== 0 && y % 2 === 1)) + return this.__corner = P, P; + return !1; + }, + /** + * Calls a function for each control. The function gets called, + * with the control, the object that is calling the iterator and the control's key + * @param {Function} fn function to iterate over the controls over + */ + forEachControl: function(l) { + for (var c in this.controls) + l(this.controls[c], c, this); + }, + /** + * Sets the coordinates of the draggable boxes in the corners of + * the image used to scale/rotate it. + * note: if we would switch to ROUND corner area, all of this would disappear. + * everything would resolve to a single point and a pythagorean theorem for the distance + * @private + */ + _setCornerCoords: function() { + var l = this.oCoords; + for (var c in l) { + var h = this.controls[c]; + l[c].corner = h.calcCornerCoords( + this.angle, + this.cornerSize, + l[c].x, + l[c].y, + !1 + ), l[c].touchCorner = h.calcCornerCoords( + this.angle, + this.touchCornerSize, + l[c].x, + l[c].y, + !0 + ); + } + }, + /** + * Draws a colored layer behind the object, inside its selection borders. + * Requires public options: padding, selectionBackgroundColor + * this function is called when the context is transformed + * has checks to be skipped when the object is on a staticCanvas + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @return {fabric.Object} thisArg + * @chainable + */ + drawSelectionBackground: function(l) { + if (!this.selectionBackgroundColor || this.canvas && !this.canvas.interactive || this.canvas && this.canvas._activeObject !== this) + return this; + l.save(); + var c = this.getCenterPoint(), h = this._calculateCurrentDimensions(), p = this.canvas.viewportTransform; + return l.translate(c.x, c.y), l.scale(1 / p[0], 1 / p[3]), l.rotate(a(this.angle)), l.fillStyle = this.selectionBackgroundColor, l.fillRect(-h.x / 2, -h.y / 2, h.x, h.y), l.restore(), this; + }, + /** + * Draws borders of an object's bounding box. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawBorders: function(l, c) { + c = c || {}; + var h = this._calculateCurrentDimensions(), p = this.borderScaleFactor, y = h.x + p, v = h.y + p, x = typeof c.hasControls < "u" ? c.hasControls : this.hasControls, I = !1; + return l.save(), l.strokeStyle = c.borderColor || this.borderColor, this._setLineDash(l, c.borderDashArray || this.borderDashArray), l.strokeRect( + -y / 2, + -v / 2, + y, + v + ), x && (l.beginPath(), this.forEachControl(function(P, F, k) { + P.withConnection && P.getVisibility(k, F) && (I = !0, l.moveTo(P.x * y, P.y * v), l.lineTo( + P.x * y + P.offsetX, + P.y * v + P.offsetY + )); + }), I && l.stroke()), l.restore(), this; + }, + /** + * Draws borders of an object's bounding box when it is inside a group. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {object} options object representing current object parameters + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawBordersInGroup: function(l, c, h) { + h = h || {}; + var p = e.util.sizeAfterTransform(this.width, this.height, c), y = this.strokeWidth, v = this.strokeUniform, x = this.borderScaleFactor, I = p.x + y * (v ? this.canvas.getZoom() : c.scaleX) + x, P = p.y + y * (v ? this.canvas.getZoom() : c.scaleY) + x; + return l.save(), this._setLineDash(l, h.borderDashArray || this.borderDashArray), l.strokeStyle = h.borderColor || this.borderColor, l.strokeRect( + -I / 2, + -P / 2, + I, + P + ), l.restore(), this; + }, + /** + * Draws corners of an object's bounding box. + * Requires public properties: width, height + * Requires public options: cornerSize, padding + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawControls: function(l, c) { + c = c || {}, l.save(); + var h = this.canvas.getRetinaScaling(), p, y; + return l.setTransform(h, 0, 0, h, 0, 0), l.strokeStyle = l.fillStyle = c.cornerColor || this.cornerColor, this.transparentCorners || (l.strokeStyle = c.cornerStrokeColor || this.cornerStrokeColor), this._setLineDash(l, c.cornerDashArray || this.cornerDashArray), this.setCoords(), this.group && (p = this.group.calcTransformMatrix()), this.forEachControl(function(v, x, I) { + y = I.oCoords[x], v.getVisibility(I, x) && (p && (y = e.util.transformPoint(y, p)), v.render(l, y.x, y.y, c, I)); + }), l.restore(), this; + }, + /** + * Returns true if the specified control is visible, false otherwise. + * @param {String} controlKey The key of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @returns {Boolean} true if the specified control is visible, false otherwise + */ + isControlVisible: function(l) { + return this.controls[l] && this.controls[l].getVisibility(this, l); + }, + /** + * Sets the visibility of the specified control. + * @param {String} controlKey The key of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @param {Boolean} visible true to set the specified control visible, false otherwise + * @return {fabric.Object} thisArg + * @chainable + */ + setControlVisible: function(l, c) { + return this._controlsVisibility || (this._controlsVisibility = {}), this._controlsVisibility[l] = c, this; + }, + /** + * Sets the visibility state of object controls. + * @param {Object} [options] Options object + * @param {Boolean} [options.bl] true to enable the bottom-left control, false to disable it + * @param {Boolean} [options.br] true to enable the bottom-right control, false to disable it + * @param {Boolean} [options.mb] true to enable the middle-bottom control, false to disable it + * @param {Boolean} [options.ml] true to enable the middle-left control, false to disable it + * @param {Boolean} [options.mr] true to enable the middle-right control, false to disable it + * @param {Boolean} [options.mt] true to enable the middle-top control, false to disable it + * @param {Boolean} [options.tl] true to enable the top-left control, false to disable it + * @param {Boolean} [options.tr] true to enable the top-right control, false to disable it + * @param {Boolean} [options.mtr] true to enable the middle-top-rotate control, false to disable it + * @return {fabric.Object} thisArg + * @chainable + */ + setControlsVisibility: function(l) { + l || (l = {}); + for (var c in l) + this.setControlVisible(c, l[c]); + return this; + }, + /** + * This callback function is called every time _discardActiveObject or _setActiveObject + * try to to deselect this object. If the function returns true, the process is cancelled + * @param {Object} [options] options sent from the upper functions + * @param {Event} [options.e] event if the process is generated by an event + */ + onDeselect: function() { + }, + /** + * This callback function is called every time _discardActiveObject or _setActiveObject + * try to to select this object. If the function returns true, the process is cancelled + * @param {Object} [options] options sent from the upper functions + * @param {Event} [options.e] event if the process is generated by an event + */ + onSelect: function() { + } + } + ); + }(), e.util.object.extend( + e.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Animation duration (in ms) for fx* methods + * @type Number + * @default + */ + FX_DURATION: 500, + /** + * Centers object horizontally with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.AnimationContext} context + */ + fxCenterObjectH: function(a, l) { + l = l || {}; + var c = function() { + }, h = l.onComplete || c, p = l.onChange || c, y = this; + return e.util.animate({ + target: this, + startValue: a.left, + endValue: this.getCenterPoint().x, + duration: this.FX_DURATION, + onChange: function(v) { + a.set("left", v), y.requestRenderAll(), p(); + }, + onComplete: function() { + a.setCoords(), h(); + } + }); + }, + /** + * Centers object vertically with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.AnimationContext} context + */ + fxCenterObjectV: function(a, l) { + l = l || {}; + var c = function() { + }, h = l.onComplete || c, p = l.onChange || c, y = this; + return e.util.animate({ + target: this, + startValue: a.top, + endValue: this.getCenterPoint().y, + duration: this.FX_DURATION, + onChange: function(v) { + a.set("top", v), y.requestRenderAll(), p(); + }, + onComplete: function() { + a.setCoords(), h(); + } + }); + }, + /** + * Same as `fabric.Canvas#remove` but animated + * @param {fabric.Object} object Object to remove + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.AnimationContext} context + */ + fxRemove: function(a, l) { + l = l || {}; + var c = function() { + }, h = l.onComplete || c, p = l.onChange || c, y = this; + return e.util.animate({ + target: this, + startValue: a.opacity, + endValue: 0, + duration: this.FX_DURATION, + onChange: function(v) { + a.set("opacity", v), y.requestRenderAll(), p(); + }, + onComplete: function() { + y.remove(a), h(); + } + }); + } + } + ), e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Animates object's properties + * @param {String|Object} property Property to animate (if string) or properties to animate (if object) + * @param {Number|Object} value Value to animate property to (if string was given first) or options object + * @return {fabric.Object} thisArg + * @tutorial {@link http://fabricjs.com/fabric-intro-part-2#animation} + * @return {fabric.AnimationContext | fabric.AnimationContext[]} animation context (or an array if passed multiple properties) + * + * As object — multiple properties + * + * object.animate({ left: ..., top: ... }); + * object.animate({ left: ..., top: ... }, { duration: ... }); + * + * As string — one property + * + * object.animate('left', ...); + * object.animate('left', { duration: ... }); + * + */ + animate: function() { + if (arguments[0] && typeof arguments[0] == "object") { + var a = [], l, c, h = []; + for (l in arguments[0]) + a.push(l); + for (var p = 0, y = a.length; p < y; p++) + l = a[p], c = p !== y - 1, h.push(this._animate(l, arguments[0][l], arguments[1], c)); + return h; + } else + return this._animate.apply(this, arguments); + }, + /** + * @private + * @param {String} property Property to animate + * @param {String} to Value to animate to + * @param {Object} [options] Options object + * @param {Boolean} [skipCallbacks] When true, callbacks like onchange and oncomplete are not invoked + */ + _animate: function(a, l, c, h) { + var p = this, y; + l = l.toString(), c ? c = e.util.object.clone(c) : c = {}, ~a.indexOf(".") && (y = a.split(".")); + var v = p.colorProperties.indexOf(a) > -1 || y && p.colorProperties.indexOf(y[1]) > -1, x = y ? this.get(y[0])[y[1]] : this.get(a); + "from" in c || (c.from = x), v || (~l.indexOf("=") ? l = x + parseFloat(l.replace("=", "")) : l = parseFloat(l)); + var I = { + target: this, + startValue: c.from, + endValue: l, + byValue: c.by, + easing: c.easing, + duration: c.duration, + abort: c.abort && function(P, F, k) { + return c.abort.call(p, P, F, k); + }, + onChange: function(P, F, k) { + y ? p[y[0]][y[1]] = P : p.set(a, P), !h && c.onChange && c.onChange(P, F, k); + }, + onComplete: function(P, F, k) { + h || (p.setCoords(), c.onComplete && c.onComplete(P, F, k)); + } + }; + return v ? e.util.animateColor(I.startValue, I.endValue, I.duration, I) : e.util.animate(I); + } + } + ), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.util.object.clone, p = { x1: 1, x2: 1, y1: 1, y2: 1 }; + if (l.Line) { + l.warn("fabric.Line is already defined"); + return; + } + l.Line = l.util.createClass( + l.Object, + /** @lends fabric.Line.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "line", + /** + * x value or first line edge + * @type Number + * @default + */ + x1: 0, + /** + * y value or first line edge + * @type Number + * @default + */ + y1: 0, + /** + * x value or second line edge + * @type Number + * @default + */ + x2: 0, + /** + * y value or second line edge + * @type Number + * @default + */ + y2: 0, + cacheProperties: l.Object.prototype.cacheProperties.concat("x1", "x2", "y1", "y2"), + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + * @return {fabric.Line} thisArg + */ + initialize: function(v, x) { + v || (v = [0, 0, 0, 0]), this.callSuper("initialize", x), this.set("x1", v[0]), this.set("y1", v[1]), this.set("x2", v[2]), this.set("y2", v[3]), this._setWidthHeight(x); + }, + /** + * @private + * @param {Object} [options] Options + */ + _setWidthHeight: function(v) { + v || (v = {}), this.width = Math.abs(this.x2 - this.x1), this.height = Math.abs(this.y2 - this.y1), this.left = "left" in v ? v.left : this._getLeftToOriginX(), this.top = "top" in v ? v.top : this._getTopToOriginY(); + }, + /** + * @private + * @param {String} key + * @param {*} value + */ + _set: function(v, x) { + return this.callSuper("_set", v, x), typeof p[v] < "u" && this._setWidthHeight(), this; + }, + /** + * @private + * @return {Number} leftToOriginX Distance from left edge of canvas to originX of Line. + */ + _getLeftToOriginX: y( + { + // property names + origin: "originX", + axis1: "x1", + axis2: "x2", + dimension: "width" + }, + { + // possible values of origin + nearest: "left", + center: "center", + farthest: "right" + } + ), + /** + * @private + * @return {Number} topToOriginY Distance from top edge of canvas to originY of Line. + */ + _getTopToOriginY: y( + { + // property names + origin: "originY", + axis1: "y1", + axis2: "y2", + dimension: "height" + }, + { + // possible values of origin + nearest: "top", + center: "center", + farthest: "bottom" + } + ), + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(v) { + v.beginPath(); + var x = this.calcLinePoints(); + v.moveTo(x.x1, x.y1), v.lineTo(x.x2, x.y2), v.lineWidth = this.strokeWidth; + var I = v.strokeStyle; + v.strokeStyle = this.stroke || v.fillStyle, this.stroke && this._renderStroke(v), v.strokeStyle = I; + }, + /** + * This function is an helper for svg import. it returns the center of the object in the svg + * untransformed coordinates + * @private + * @return {Object} center point from element coordinates + */ + _findCenterFromElement: function() { + return { + x: (this.x1 + this.x2) / 2, + y: (this.y1 + this.y2) / 2 + }; + }, + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(v) { + return c(this.callSuper("toObject", v), this.calcLinePoints()); + }, + /* + * Calculate object dimensions from its properties + * @private + */ + _getNonTransformedDimensions: function() { + var v = this.callSuper("_getNonTransformedDimensions"); + return this.strokeLineCap === "butt" && (this.width === 0 && (v.y -= this.strokeWidth), this.height === 0 && (v.x -= this.strokeWidth)), v; + }, + /** + * Recalculates line points given width and height + * @private + */ + calcLinePoints: function() { + var v = this.x1 <= this.x2 ? -1 : 1, x = this.y1 <= this.y2 ? -1 : 1, I = v * this.width * 0.5, P = x * this.height * 0.5, F = v * this.width * -0.5, k = x * this.height * -0.5; + return { + x1: I, + x2: F, + y1: P, + y2: k + }; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var v = this.calcLinePoints(); + return [ + " +` + ]; + } + /* _TO_SVG_END_ */ + } + ), l.Line.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")), l.Line.fromElement = function(v, x, I) { + I = I || {}; + var P = l.parseAttributes(v, l.Line.ATTRIBUTE_NAMES), F = [ + P.x1 || 0, + P.y1 || 0, + P.x2 || 0, + P.y2 || 0 + ]; + x(new l.Line(F, c(P, I))); + }, l.Line.fromObject = function(v, x) { + function I(F) { + delete F.points, x && x(F); + } + var P = h(v, !0); + P.points = [v.x1, v.y1, v.x2, v.y2], l.Object._fromObject("Line", P, I, "points"); + }; + function y(v, x) { + var I = v.origin, P = v.axis1, F = v.axis2, k = v.dimension, V = x.nearest, j = x.center, Y = x.farthest; + return function() { + switch (this.get(I)) { + case V: + return Math.min(this.get(P), this.get(F)); + case j: + return Math.min(this.get(P), this.get(F)) + 0.5 * this.get(k); + case Y: + return Math.max(this.get(P), this.get(F)); + } + }; + } + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.degreesToRadians; + if (l.Circle) { + l.warn("fabric.Circle is already defined."); + return; + } + l.Circle = l.util.createClass( + l.Object, + /** @lends fabric.Circle.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "circle", + /** + * Radius of this circle + * @type Number + * @default + */ + radius: 0, + /** + * degrees of start of the circle. + * probably will change to degrees in next major version + * @type Number 0 - 359 + * @default 0 + */ + startAngle: 0, + /** + * End angle of the circle + * probably will change to degrees in next major version + * @type Number 1 - 360 + * @default 360 + */ + endAngle: 360, + cacheProperties: l.Object.prototype.cacheProperties.concat("radius", "startAngle", "endAngle"), + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Circle} thisArg + */ + _set: function(p, y) { + return this.callSuper("_set", p, y), p === "radius" && this.setRadius(y), this; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(p) { + return this.callSuper("toObject", ["radius", "startAngle", "endAngle"].concat(p)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var p, y = 0, v = 0, x = (this.endAngle - this.startAngle) % 360; + if (x === 0) + p = [ + " +` + ]; + else { + var I = c(this.startAngle), P = c(this.endAngle), F = this.radius, k = l.util.cos(I) * F, V = l.util.sin(I) * F, j = l.util.cos(P) * F, Y = l.util.sin(P) * F, X = x > 180 ? "1" : "0"; + p = [ + ' +` + ]; + } + return p; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render on + */ + _render: function(p) { + p.beginPath(), p.arc( + 0, + 0, + this.radius, + c(this.startAngle), + c(this.endAngle), + !1 + ), this._renderPaintInOrder(p); + }, + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusX: function() { + return this.get("radius") * this.get("scaleX"); + }, + /** + * Returns vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusY: function() { + return this.get("radius") * this.get("scaleY"); + }, + /** + * Sets radius of an object (and updates width accordingly) + * @return {fabric.Circle} thisArg + */ + setRadius: function(p) { + return this.radius = p, this.set("width", p * 2).set("height", p * 2); + } + } + ), l.Circle.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")), l.Circle.fromElement = function(p, y) { + var v = l.parseAttributes(p, l.Circle.ATTRIBUTE_NAMES); + if (!h(v)) + throw new Error("value of `r` attribute is required and can not be negative"); + v.left = (v.left || 0) - v.radius, v.top = (v.top || 0) - v.radius, y(new l.Circle(v)); + }; + function h(p) { + return "radius" in p && p.radius >= 0; + } + l.Circle.fromObject = function(p, y) { + l.Object._fromObject("Circle", p, y); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}); + if (l.Triangle) { + l.warn("fabric.Triangle is already defined"); + return; + } + l.Triangle = l.util.createClass( + l.Object, + /** @lends fabric.Triangle.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "triangle", + /** + * Width is set to 100 to compensate the old initialize code that was setting it to 100 + * @type Number + * @default + */ + width: 100, + /** + * Height is set to 100 to compensate the old initialize code that was setting it to 100 + * @type Number + * @default + */ + height: 100, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(c) { + var h = this.width / 2, p = this.height / 2; + c.beginPath(), c.moveTo(-h, p), c.lineTo(0, -p), c.lineTo(h, p), c.closePath(), this._renderPaintInOrder(c); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var c = this.width / 2, h = this.height / 2, p = [ + -c + " " + h, + "0 " + -h, + c + " " + h + ].join(","); + return [ + "' + ]; + } + /* _TO_SVG_END_ */ + } + ), l.Triangle.fromObject = function(c, h) { + return l.Object._fromObject("Triangle", c, h); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = Math.PI * 2; + if (l.Ellipse) { + l.warn("fabric.Ellipse is already defined."); + return; + } + l.Ellipse = l.util.createClass( + l.Object, + /** @lends fabric.Ellipse.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "ellipse", + /** + * Horizontal radius + * @type Number + * @default + */ + rx: 0, + /** + * Vertical radius + * @type Number + * @default + */ + ry: 0, + cacheProperties: l.Object.prototype.cacheProperties.concat("rx", "ry"), + /** + * Constructor + * @param {Object} [options] Options object + * @return {fabric.Ellipse} thisArg + */ + initialize: function(h) { + this.callSuper("initialize", h), this.set("rx", h && h.rx || 0), this.set("ry", h && h.ry || 0); + }, + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Ellipse} thisArg + */ + _set: function(h, p) { + switch (this.callSuper("_set", h, p), h) { + case "rx": + this.rx = p, this.set("width", p * 2); + break; + case "ry": + this.ry = p, this.set("height", p * 2); + break; + } + return this; + }, + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRx: function() { + return this.get("rx") * this.get("scaleX"); + }, + /** + * Returns Vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRy: function() { + return this.get("ry") * this.get("scaleY"); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(h) { + return this.callSuper("toObject", ["rx", "ry"].concat(h)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + return [ + " +` + ]; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render on + */ + _render: function(h) { + h.beginPath(), h.save(), h.transform(1, 0, 0, this.ry / this.rx, 0, 0), h.arc( + 0, + 0, + this.rx, + 0, + c, + !1 + ), h.restore(), this._renderPaintInOrder(h); + } + } + ), l.Ellipse.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")), l.Ellipse.fromElement = function(h, p) { + var y = l.parseAttributes(h, l.Ellipse.ATTRIBUTE_NAMES); + y.left = (y.left || 0) - y.rx, y.top = (y.top || 0) - y.ry, p(new l.Ellipse(y)); + }, l.Ellipse.fromObject = function(h, p) { + l.Object._fromObject("Ellipse", h, p); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend; + if (l.Rect) { + l.warn("fabric.Rect is already defined"); + return; + } + l.Rect = l.util.createClass( + l.Object, + /** @lends fabric.Rect.prototype */ + { + /** + * List of properties to consider when checking if state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: l.Object.prototype.stateProperties.concat("rx", "ry"), + /** + * Type of an object + * @type String + * @default + */ + type: "rect", + /** + * Horizontal border radius + * @type Number + * @default + */ + rx: 0, + /** + * Vertical border radius + * @type Number + * @default + */ + ry: 0, + cacheProperties: l.Object.prototype.cacheProperties.concat("rx", "ry"), + /** + * Constructor + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(h) { + this.callSuper("initialize", h), this._initRxRy(); + }, + /** + * Initializes rx/ry attributes + * @private + */ + _initRxRy: function() { + this.rx && !this.ry ? this.ry = this.rx : this.ry && !this.rx && (this.rx = this.ry); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(h) { + var p = this.rx ? Math.min(this.rx, this.width / 2) : 0, y = this.ry ? Math.min(this.ry, this.height / 2) : 0, v = this.width, x = this.height, I = -this.width / 2, P = -this.height / 2, F = p !== 0 || y !== 0, k = 1 - 0.5522847498; + h.beginPath(), h.moveTo(I + p, P), h.lineTo(I + v - p, P), F && h.bezierCurveTo(I + v - k * p, P, I + v, P + k * y, I + v, P + y), h.lineTo(I + v, P + x - y), F && h.bezierCurveTo(I + v, P + x - k * y, I + v - k * p, P + x, I + v - p, P + x), h.lineTo(I + p, P + x), F && h.bezierCurveTo(I + k * p, P + x, I, P + x - k * y, I, P + x - y), h.lineTo(I, P + y), F && h.bezierCurveTo(I, P + k * y, I + k * p, P, I + p, P), h.closePath(), this._renderPaintInOrder(h); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(h) { + return this.callSuper("toObject", ["rx", "ry"].concat(h)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var h = -this.width / 2, p = -this.height / 2; + return [ + " +` + ]; + } + /* _TO_SVG_END_ */ + } + ), l.Rect.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")), l.Rect.fromElement = function(h, p, y) { + if (!h) + return p(null); + y = y || {}; + var v = l.parseAttributes(h, l.Rect.ATTRIBUTE_NAMES); + v.left = v.left || 0, v.top = v.top || 0, v.height = v.height || 0, v.width = v.width || 0; + var x = new l.Rect(c(y ? l.util.object.clone(y) : {}, v)); + x.visible = x.visible && x.width > 0 && x.height > 0, p(x); + }, l.Rect.fromObject = function(h, p) { + return l.Object._fromObject("Rect", h, p); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.util.array.min, p = l.util.array.max, y = l.util.toFixed, v = l.util.projectStrokeOnPoints; + if (l.Polyline) { + l.warn("fabric.Polyline is already defined"); + return; + } + l.Polyline = l.util.createClass( + l.Object, + /** @lends fabric.Polyline.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "polyline", + /** + * Points array + * @type Array + * @default + */ + points: null, + /** + * WARNING: Feature in progress + * Calculate the exact bounding box taking in account strokeWidth on acute angles + * this will be turned to true by default on fabric 6.0 + * maybe will be left in as an optimization since calculations may be slow + * @deprecated + * @type Boolean + * @default false + */ + exactBoundingBox: !1, + cacheProperties: l.Object.prototype.cacheProperties.concat("points"), + /** + * Constructor + * @param {Array} points Array of points (where each point is an object with x and y) + * @param {Object} [options] Options object + * @return {fabric.Polyline} thisArg + * @example + * var poly = new fabric.Polyline([ + * { x: 10, y: 10 }, + * { x: 50, y: 30 }, + * { x: 40, y: 70 }, + * { x: 60, y: 50 }, + * { x: 100, y: 150 }, + * { x: 40, y: 100 } + * ], { + * stroke: 'red', + * left: 100, + * top: 100 + * }); + */ + initialize: function(x, I) { + I = I || {}, this.points = x || [], this.callSuper("initialize", I), this._setPositionDimensions(I); + }, + /** + * @private + */ + _projectStrokeOnPoints: function() { + return v(this.points, this, !0); + }, + _setPositionDimensions: function(x) { + var I = this._calcDimensions(x), P, F = this.exactBoundingBox ? this.strokeWidth : 0; + this.width = I.width - F, this.height = I.height - F, x.fromSVG || (P = this.translateToGivenOrigin( + { + // this looks bad, but is one way to keep it optional for now. + x: I.left - this.strokeWidth / 2 + F / 2, + y: I.top - this.strokeWidth / 2 + F / 2 + }, + "left", + "top", + this.originX, + this.originY + )), typeof x.left > "u" && (this.left = x.fromSVG ? I.left : P.x), typeof x.top > "u" && (this.top = x.fromSVG ? I.top : P.y), this.pathOffset = { + x: I.left + this.width / 2 + F / 2, + y: I.top + this.height / 2 + F / 2 + }; + }, + /** + * Calculate the polygon min and max point from points array, + * returning an object with left, top, width, height to measure the + * polygon size + * @return {Object} object.left X coordinate of the polygon leftmost point + * @return {Object} object.top Y coordinate of the polygon topmost point + * @return {Object} object.width distance between X coordinates of the polygon leftmost and rightmost point + * @return {Object} object.height distance between Y coordinates of the polygon topmost and bottommost point + * @private + */ + _calcDimensions: function() { + var x = this.exactBoundingBox ? this._projectStrokeOnPoints() : this.points, I = h(x, "x") || 0, P = h(x, "y") || 0, F = p(x, "x") || 0, k = p(x, "y") || 0, V = F - I, j = k - P; + return { + left: I, + top: P, + width: V, + height: j + }; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(x) { + return c(this.callSuper("toObject", x), { + points: this.points.concat() + }); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + for (var x = [], I = this.pathOffset.x, P = this.pathOffset.y, F = l.Object.NUM_FRACTION_DIGITS, k = 0, V = this.points.length; k < V; k++) + x.push( + y(this.points[k].x - I, F), + ",", + y(this.points[k].y - P, F), + " " + ); + return [ + "<" + this.type + " ", + "COMMON_PARTS", + 'points="', + x.join(""), + `" /> +` + ]; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + commonRender: function(x) { + var I, P = this.points.length, F = this.pathOffset.x, k = this.pathOffset.y; + if (!P || isNaN(this.points[P - 1].y)) + return !1; + x.beginPath(), x.moveTo(this.points[0].x - F, this.points[0].y - k); + for (var V = 0; V < P; V++) + I = this.points[V], x.lineTo(I.x - F, I.y - k); + return !0; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(x) { + this.commonRender(x) && this._renderPaintInOrder(x); + }, + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity: function() { + return this.get("points").length; + } + } + ), l.Polyline.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat(), l.Polyline.fromElementGenerator = function(x) { + return function(I, P, F) { + if (!I) + return P(null); + F || (F = {}); + var k = l.parsePointsAttribute(I.getAttribute("points")), V = l.parseAttributes(I, l[x].ATTRIBUTE_NAMES); + V.fromSVG = !0, P(new l[x](k, c(V, F))); + }; + }, l.Polyline.fromElement = l.Polyline.fromElementGenerator("Polyline"), l.Polyline.fromObject = function(x, I) { + return l.Object._fromObject("Polyline", x, I, "points"); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.projectStrokeOnPoints; + if (l.Polygon) { + l.warn("fabric.Polygon is already defined"); + return; + } + l.Polygon = l.util.createClass( + l.Polyline, + /** @lends fabric.Polygon.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "polygon", + /** + * @private + */ + _projectStrokeOnPoints: function() { + return c(this.points, this); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(h) { + this.commonRender(h) && (h.closePath(), this._renderPaintInOrder(h)); + } + } + ), l.Polygon.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat(), l.Polygon.fromElement = l.Polyline.fromElementGenerator("Polygon"), l.Polygon.fromObject = function(h, p) { + l.Object._fromObject("Polygon", h, p, "points"); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.array.min, h = l.util.array.max, p = l.util.object.extend, y = l.util.object.clone, v = l.util.toFixed; + if (l.Path) { + l.warn("fabric.Path is already defined"); + return; + } + l.Path = l.util.createClass( + l.Object, + /** @lends fabric.Path.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "path", + /** + * Array of path points + * @type Array + * @default + */ + path: null, + cacheProperties: l.Object.prototype.cacheProperties.concat("path", "fillRule"), + stateProperties: l.Object.prototype.stateProperties.concat("path"), + /** + * Constructor + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + * @return {fabric.Path} thisArg + */ + initialize: function(x, I) { + I = y(I || {}), delete I.path, this.callSuper("initialize", I), this._setPath(x || [], I); + }, + /** + * @private + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + */ + _setPath: function(x, I) { + this.path = l.util.makePathSimpler( + Array.isArray(x) ? x : l.util.parsePath(x) + ), l.Polyline.prototype._setPositionDimensions.call(this, I || {}); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render path on + */ + _renderPathCommands: function(x) { + var I, P = 0, F = 0, k = 0, V = 0, j = 0, Y = 0, X = -this.pathOffset.x, Q = -this.pathOffset.y; + x.beginPath(); + for (var re = 0, he = this.path.length; re < he; ++re) + switch (I = this.path[re], I[0]) { + case "L": + k = I[1], V = I[2], x.lineTo(k + X, V + Q); + break; + case "M": + k = I[1], V = I[2], P = k, F = V, x.moveTo(k + X, V + Q); + break; + case "C": + k = I[5], V = I[6], j = I[3], Y = I[4], x.bezierCurveTo( + I[1] + X, + I[2] + Q, + j + X, + Y + Q, + k + X, + V + Q + ); + break; + case "Q": + x.quadraticCurveTo( + I[1] + X, + I[2] + Q, + I[3] + X, + I[4] + Q + ), k = I[3], V = I[4], j = I[1], Y = I[2]; + break; + case "z": + case "Z": + k = P, V = F, x.closePath(); + break; + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render path on + */ + _render: function(x) { + this._renderPathCommands(x), this._renderPaintInOrder(x); + }, + /** + * Returns string representation of an instance + * @return {String} string representation of an instance + */ + toString: function() { + return "#"; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(x) { + return p(this.callSuper("toObject", x), { + path: this.path.map(function(I) { + return I.slice(); + }) + }); + }, + /** + * Returns dataless object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(x) { + var I = this.toObject(["sourcePath"].concat(x)); + return I.sourcePath && delete I.path, I; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var x = l.util.joinPath(this.path); + return [ + " +` + ]; + }, + _getOffsetTransform: function() { + var x = l.Object.NUM_FRACTION_DIGITS; + return " translate(" + v(-this.pathOffset.x, x) + ", " + v(-this.pathOffset.y, x) + ")"; + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(x) { + var I = this._getOffsetTransform(); + return " " + this._createBaseClipPathSVGMarkup( + this._toSVG(), + { reviver: x, additionalTransform: I } + ); + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(x) { + var I = this._getOffsetTransform(); + return this._createBaseSVGMarkup(this._toSVG(), { reviver: x, additionalTransform: I }); + }, + /* _TO_SVG_END_ */ + /** + * Returns number representation of an instance complexity + * @return {Number} complexity of this instance + */ + complexity: function() { + return this.path.length; + }, + /** + * @private + */ + _calcDimensions: function() { + for (var x = [], I = [], P, F = 0, k = 0, V = 0, j = 0, Y, X = 0, Q = this.path.length; X < Q; ++X) { + switch (P = this.path[X], P[0]) { + case "L": + V = P[1], j = P[2], Y = []; + break; + case "M": + V = P[1], j = P[2], F = V, k = j, Y = []; + break; + case "C": + Y = l.util.getBoundsOfCurve( + V, + j, + P[1], + P[2], + P[3], + P[4], + P[5], + P[6] + ), V = P[5], j = P[6]; + break; + case "Q": + Y = l.util.getBoundsOfCurve( + V, + j, + P[1], + P[2], + P[1], + P[2], + P[3], + P[4] + ), V = P[3], j = P[4]; + break; + case "z": + case "Z": + V = F, j = k; + break; + } + Y.forEach(function(ke) { + x.push(ke.x), I.push(ke.y); + }), x.push(V), I.push(j); + } + var re = c(x) || 0, he = c(I) || 0, fe = h(x) || 0, be = h(I) || 0, Se = fe - re, Me = be - he; + return { + left: re, + top: he, + width: Se, + height: Me + }; + } + } + ), l.Path.fromObject = function(x, I) { + if (typeof x.sourcePath == "string") { + var P = x.sourcePath; + l.loadSVGFromURL(P, function(F) { + var k = F[0]; + k.setOptions(x), x.clipPath ? l.util.enlivenObjects([x.clipPath], function(V) { + k.clipPath = V[0], I && I(k); + }) : I && I(k); + }); + } else + l.Object._fromObject("Path", x, I, "path"); + }, l.Path.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat(["d"]), l.Path.fromElement = function(x, I, P) { + var F = l.parseAttributes(x, l.Path.ATTRIBUTE_NAMES); + F.fromSVG = !0, I(new l.Path(F.d, p(F, P))); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.array.min, h = l.util.array.max; + l.Group || (l.Group = l.util.createClass( + l.Object, + l.Collection, + /** @lends fabric.Group.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "group", + /** + * Width of stroke + * @type Number + * @default + */ + strokeWidth: 0, + /** + * Indicates if click, mouseover, mouseout events & hoverCursor should also check for subtargets + * @type Boolean + * @default + */ + subTargetCheck: !1, + /** + * Groups are container, do not render anything on theyr own, ence no cache properties + * @type Array + * @default + */ + cacheProperties: [], + /** + * setOnGroup is a method used for TextBox that is no more used since 2.0.0 The behavior is still + * available setting this boolean to true. + * @type Boolean + * @since 2.0.0 + * @default + */ + useSetOnGroup: !1, + /** + * Constructor + * @param {Object} objects Group objects + * @param {Object} [options] Options object + * @param {Boolean} [isAlreadyGrouped] if true, objects have been grouped already. + * @return {Object} thisArg + */ + initialize: function(p, y, v) { + y = y || {}, this._objects = [], v && this.callSuper("initialize", y), this._objects = p || []; + for (var x = this._objects.length; x--; ) + this._objects[x].group = this; + if (v) + this._updateObjectsACoords(); + else { + var I = y && y.centerPoint; + y.originX !== void 0 && (this.originX = y.originX), y.originY !== void 0 && (this.originY = y.originY), I || this._calcBounds(), this._updateObjectsCoords(I), delete y.centerPoint, this.callSuper("initialize", y); + } + this.setCoords(); + }, + /** + * @private + */ + _updateObjectsACoords: function() { + for (var p = !0, y = this._objects.length; y--; ) + this._objects[y].setCoords(p); + }, + /** + * @private + * @param {Boolean} [skipCoordsChange] if true, coordinates of objects enclosed in a group do not change + */ + _updateObjectsCoords: function(y) { + for (var y = y || this.getCenterPoint(), v = this._objects.length; v--; ) + this._updateObjectCoords(this._objects[v], y); + }, + /** + * @private + * @param {Object} object + * @param {fabric.Point} center, current center of group. + */ + _updateObjectCoords: function(p, y) { + var v = p.left, x = p.top, I = !0; + p.set({ + left: v - y.x, + top: x - y.y + }), p.group = this, p.setCoords(I); + }, + /** + * Returns string represenation of a group + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Adds an object to a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + addWithUpdate: function(p) { + var y = !!this.group; + return this._restoreObjectsState(), l.util.resetObjectTransform(this), p && (y && l.util.removeTransformFromObject(p, this.group.calcTransformMatrix()), this._objects.push(p), p.group = this, p._set("canvas", this.canvas)), this._calcBounds(), this._updateObjectsCoords(), this.dirty = !0, y ? this.group.addWithUpdate() : this.setCoords(), this; + }, + /** + * Removes an object from a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + removeWithUpdate: function(p) { + return this._restoreObjectsState(), l.util.resetObjectTransform(this), this.remove(p), this._calcBounds(), this._updateObjectsCoords(), this.setCoords(), this.dirty = !0, this; + }, + /** + * @private + */ + _onObjectAdded: function(p) { + this.dirty = !0, p.group = this, p._set("canvas", this.canvas); + }, + /** + * @private + */ + _onObjectRemoved: function(p) { + this.dirty = !0, delete p.group; + }, + /** + * @private + */ + _set: function(p, y) { + var v = this._objects.length; + if (this.useSetOnGroup) + for (; v--; ) + this._objects[v].setOnGroup(p, y); + if (p === "canvas") + for (; v--; ) + this._objects[v]._set(p, y); + l.Object.prototype._set.call(this, p, y); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(p) { + var y = this.includeDefaultValues, v = this._objects.filter(function(I) { + return !I.excludeFromExport; + }).map(function(I) { + var P = I.includeDefaultValues; + I.includeDefaultValues = y; + var F = I.toObject(p); + return I.includeDefaultValues = P, F; + }), x = l.Object.prototype.toObject.call(this, p); + return x.objects = v, x; + }, + /** + * Returns object representation of an instance, in dataless mode. + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(p) { + var y, v = this.sourcePath; + if (v) + y = v; + else { + var x = this.includeDefaultValues; + y = this._objects.map(function(P) { + var F = P.includeDefaultValues; + P.includeDefaultValues = x; + var k = P.toDatalessObject(p); + return P.includeDefaultValues = F, k; + }); + } + var I = l.Object.prototype.toDatalessObject.call(this, p); + return I.objects = y, I; + }, + /** + * Renders instance on a given context + * @param {CanvasRenderingContext2D} ctx context to render instance on + */ + render: function(p) { + this._transformDone = !0, this.callSuper("render", p), this._transformDone = !1; + }, + /** + * Decide if the object should cache or not. Create its own cache level + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group is already cached. + * @return {Boolean} + */ + shouldCache: function() { + var p = l.Object.prototype.shouldCache.call(this); + if (p) { + for (var y = 0, v = this._objects.length; y < v; y++) + if (this._objects[y].willDrawShadow()) + return this.ownCaching = !1, !1; + } + return p; + }, + /** + * Check if this object or a child object will cast a shadow + * @return {Boolean} + */ + willDrawShadow: function() { + if (l.Object.prototype.willDrawShadow.call(this)) + return !0; + for (var p = 0, y = this._objects.length; p < y; p++) + if (this._objects[p].willDrawShadow()) + return !0; + return !1; + }, + /** + * Check if this group or its parent group are caching, recursively up + * @return {Boolean} + */ + isOnACache: function() { + return this.ownCaching || this.group && this.group.isOnACache(); + }, + /** + * Execute the drawing operation for an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawObject: function(p) { + for (var y = 0, v = this._objects.length; y < v; y++) + this._objects[y].render(p); + this._drawClipPath(p, this.clipPath); + }, + /** + * Check if cache is dirty + */ + isCacheDirty: function(p) { + if (this.callSuper("isCacheDirty", p)) + return !0; + if (!this.statefullCache) + return !1; + for (var y = 0, v = this._objects.length; y < v; y++) + if (this._objects[y].isCacheDirty(!0)) { + if (this._cacheCanvas) { + var x = this.cacheWidth / this.zoomX, I = this.cacheHeight / this.zoomY; + this._cacheContext.clearRect(-x / 2, -I / 2, x, I); + } + return !0; + } + return !1; + }, + /** + * Restores original state of each of group objects (original state is that which was before group was created). + * if the nested boolean is true, the original state will be restored just for the + * first group and not for all the group chain + * @private + * @param {Boolean} nested tell the function to restore object state up to the parent group and not more + * @return {fabric.Group} thisArg + * @chainable + */ + _restoreObjectsState: function() { + var p = this.calcOwnMatrix(); + return this._objects.forEach(function(y) { + l.util.addTransformToObject(y, p), delete y.group, y.setCoords(); + }), this; + }, + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + destroy: function() { + return this._objects.forEach(function(p) { + p.set("dirty", !0); + }), this._restoreObjectsState(); + }, + dispose: function() { + this.callSuper("dispose"), this.forEachObject(function(p) { + p.dispose && p.dispose(); + }), this._objects = []; + }, + /** + * make a group an active selection, remove the group from canvas + * the group has to be on canvas for this to work. + * @return {fabric.ActiveSelection} thisArg + * @chainable + */ + toActiveSelection: function() { + if (this.canvas) { + var p = this._objects, y = this.canvas; + this._objects = []; + var v = this.toObject(); + delete v.objects; + var x = new l.ActiveSelection([]); + return x.set(v), x.type = "activeSelection", y.remove(this), p.forEach(function(I) { + I.group = x, I.dirty = !0, y.add(I); + }), x.canvas = y, x._objects = p, y._activeObject = x, x.setCoords(), x; + } + }, + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + ungroupOnCanvas: function() { + return this._restoreObjectsState(); + }, + /** + * Sets coordinates of all objects inside group + * @return {fabric.Group} thisArg + * @chainable + */ + setObjectsCoords: function() { + var p = !0; + return this.forEachObject(function(y) { + y.setCoords(p); + }), this; + }, + /** + * @private + */ + _calcBounds: function(p) { + for (var y = [], v = [], x, I, P, F = ["tr", "br", "bl", "tl"], k = 0, V = this._objects.length, j, Y = F.length; k < V; ++k) { + for (x = this._objects[k], P = x.calcACoords(), j = 0; j < Y; j++) + I = F[j], y.push(P[I].x), v.push(P[I].y); + x.aCoords = P; + } + this._getBounds(y, v, p); + }, + /** + * @private + */ + _getBounds: function(p, y, v) { + var x = new l.Point(c(p), c(y)), I = new l.Point(h(p), h(y)), P = x.y || 0, F = x.x || 0, k = I.x - x.x || 0, V = I.y - x.y || 0; + this.width = k, this.height = V, v || this.setPositionByOrigin({ x: F, y: P }, "left", "top"); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + _toSVG: function(p) { + for (var y = [" +`], v = 0, x = this._objects.length; v < x; v++) + y.push(" ", this._objects[v].toSVG(p)); + return y.push(` +`), y; + }, + /** + * Returns styles-string for svg-export, specific version for group + * @return {String} + */ + getSvgStyles: function() { + var p = typeof this.opacity < "u" && this.opacity !== 1 ? "opacity: " + this.opacity + ";" : "", y = this.visible ? "" : " visibility: hidden;"; + return [ + p, + this.getSvgFilter(), + y + ].join(""); + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(p) { + for (var y = [], v = 0, x = this._objects.length; v < x; v++) + y.push(" ", this._objects[v].toClipPathSVG(p)); + return this._createBaseClipPathSVGMarkup(y, { reviver: p }); + } + /* _TO_SVG_END_ */ + } + ), l.Group.fromObject = function(p, y) { + var v = p.objects, x = l.util.object.clone(p, !0); + if (delete x.objects, typeof v == "string") { + l.loadSVGFromURL(v, function(I) { + var P = l.util.groupSVGElements(I, p, v), F = x.clipPath; + delete x.clipPath, P.set(x), F ? l.util.enlivenObjects([F], function(k) { + P.clipPath = k[0], y && y(P); + }) : y && y(P); + }); + return; + } + l.util.enlivenObjects(v, function(I) { + l.util.enlivenObjectEnlivables(p, x, function() { + y && y(new l.Group(I, x, !0)); + }); + }); + }); + }(t), function(a) { + var l = a.fabric || (a.fabric = {}); + l.ActiveSelection || (l.ActiveSelection = l.util.createClass( + l.Group, + /** @lends fabric.ActiveSelection.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "activeSelection", + /** + * Constructor + * @param {Object} objects ActiveSelection objects + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(c, h) { + h = h || {}, this._objects = c || []; + for (var p = this._objects.length; p--; ) + this._objects[p].group = this; + h.originX && (this.originX = h.originX), h.originY && (this.originY = h.originY), this._calcBounds(), this._updateObjectsCoords(), l.Object.prototype.initialize.call(this, h), this.setCoords(); + }, + /** + * Change te activeSelection to a normal group, + * High level function that automatically adds it to canvas as + * active object. no events fired. + * @since 2.0.0 + * @return {fabric.Group} + */ + toGroup: function() { + var c = this._objects.concat(); + this._objects = []; + var h = l.Object.prototype.toObject.call(this), p = new l.Group([]); + if (delete h.type, p.set(h), c.forEach(function(v) { + v.canvas.remove(v), v.group = p; + }), p._objects = c, !this.canvas) + return p; + var y = this.canvas; + return y.add(p), y._activeObject = p, p.setCoords(), p; + }, + /** + * If returns true, deselection is cancelled. + * @since 2.0.0 + * @return {Boolean} [cancel] + */ + onDeselect: function() { + return this.destroy(), !1; + }, + /** + * Returns string representation of a group + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Decide if the object should cache or not. Create its own cache level + * objectCaching is a global flag, wins over everything + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * @return {Boolean} + */ + shouldCache: function() { + return !1; + }, + /** + * Check if this group or its parent group are caching, recursively up + * @return {Boolean} + */ + isOnACache: function() { + return !1; + }, + /** + * Renders controls and borders for the object + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [styleOverride] properties to override the object style + * @param {Object} [childrenOverride] properties to override the children overrides + */ + _renderControls: function(c, h, p) { + c.save(), c.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1, this.callSuper("_renderControls", c, h), p = p || {}, typeof p.hasControls > "u" && (p.hasControls = !1), p.forActiveSelection = !0; + for (var y = 0, v = this._objects.length; y < v; y++) + this._objects[y]._renderControls(c, p); + c.restore(); + } + } + ), l.ActiveSelection.fromObject = function(c, h) { + l.util.enlivenObjects(c.objects, function(p) { + delete c.objects, h && h(new l.ActiveSelection(p, c, !0)); + }); + }); + }(t), function(a) { + var l = e.util.object.extend; + if (a.fabric || (a.fabric = {}), a.fabric.Image) { + e.warn("fabric.Image is already defined."); + return; + } + e.Image = e.util.createClass( + e.Object, + /** @lends fabric.Image.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "image", + /** + * Width of a stroke. + * For image quality a stroke multiple of 2 gives better results. + * @type Number + * @default + */ + strokeWidth: 0, + /** + * When calling {@link fabric.Image.getSrc}, return value from element src with `element.getAttribute('src')`. + * This allows for relative urls as image src. + * @since 2.7.0 + * @type Boolean + * @default + */ + srcFromAttribute: !1, + /** + * private + * contains last value of scaleX to detect + * if the Image got resized after the last Render + * @type Number + */ + _lastScaleX: 1, + /** + * private + * contains last value of scaleY to detect + * if the Image got resized after the last Render + * @type Number + */ + _lastScaleY: 1, + /** + * private + * contains last value of scaling applied by the apply filter chain + * @type Number + */ + _filterScalingX: 1, + /** + * private + * contains last value of scaling applied by the apply filter chain + * @type Number + */ + _filterScalingY: 1, + /** + * minimum scale factor under which any resizeFilter is triggered to resize the image + * 0 will disable the automatic resize. 1 will trigger automatically always. + * number bigger than 1 are not implemented yet. + * @type Number + */ + minimumScaleTrigger: 0.5, + /** + * List of properties to consider when checking if + * state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: e.Object.prototype.stateProperties.concat("cropX", "cropY"), + /** + * List of properties to consider when checking if cache needs refresh + * Those properties are checked by statefullCache ON ( or lazy mode if we want ) or from single + * calls to Object.set(key, value). If the key is in this list, the object is marked as dirty + * and refreshed at the next render + * @type Array + */ + cacheProperties: e.Object.prototype.cacheProperties.concat("cropX", "cropY"), + /** + * key used to retrieve the texture representing this image + * @since 2.0.0 + * @type String + * @default + */ + cacheKey: "", + /** + * Image crop in pixels from original image size. + * @since 2.0.0 + * @type Number + * @default + */ + cropX: 0, + /** + * Image crop in pixels from original image size. + * @since 2.0.0 + * @type Number + * @default + */ + cropY: 0, + /** + * Indicates whether this canvas will use image smoothing when painting this image. + * Also influence if the cacheCanvas for this image uses imageSmoothing + * @since 4.0.0-beta.11 + * @type Boolean + * @default + */ + imageSmoothing: !0, + /** + * Constructor + * Image can be initialized with any canvas drawable or a string. + * The string should be a url and will be loaded as an image. + * Canvas and Image element work out of the box, while videos require extra code to work. + * Please check video element events for seeking. + * @param {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String} element Image element + * @param {Object} [options] Options object + * @param {function} [callback] callback function to call after eventual filters applied. + * @return {fabric.Image} thisArg + */ + initialize: function(c, h) { + h || (h = {}), this.filters = [], this.cacheKey = "texture" + e.Object.__uid++, this.callSuper("initialize", h), this._initElement(c, h); + }, + /** + * Returns image element which this instance if based on + * @return {HTMLImageElement} Image element + */ + getElement: function() { + return this._element || {}; + }, + /** + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Object} [options] Options object + * @return {fabric.Image} thisArg + * @chainable + */ + setElement: function(c, h) { + return this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._element = c, this._originalElement = c, this._initConfig(h), this.filters.length !== 0 && this.applyFilters(), this.resizeFilter && this.applyResizeFilters(), this; + }, + /** + * Delete a single texture if in webgl mode + */ + removeTexture: function(c) { + var h = e.filterBackend; + h && h.evictCachesForKey && h.evictCachesForKey(c); + }, + /** + * Delete textures, reference to elements and eventually JSDOM cleanup + */ + dispose: function() { + this.callSuper("dispose"), this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._cacheContext = void 0, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach(function(c) { + e.util.cleanUpJsdomNode(this[c]), this[c] = void 0; + }.bind(this)); + }, + /** + * Get the crossOrigin value (of the corresponding image element) + */ + getCrossOrigin: function() { + return this._originalElement && (this._originalElement.crossOrigin || null); + }, + /** + * Returns original size of an image + * @return {Object} Object with "width" and "height" properties + */ + getOriginalSize: function() { + var c = this.getElement(); + return { + width: c.naturalWidth || c.width, + height: c.naturalHeight || c.height + }; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _stroke: function(c) { + if (!(!this.stroke || this.strokeWidth === 0)) { + var h = this.width / 2, p = this.height / 2; + c.beginPath(), c.moveTo(-h, -p), c.lineTo(h, -p), c.lineTo(h, p), c.lineTo(-h, p), c.lineTo(-h, -p), c.closePath(); + } + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(c) { + var h = []; + this.filters.forEach(function(y) { + y && h.push(y.toObject()); + }); + var p = l( + this.callSuper( + "toObject", + ["cropX", "cropY"].concat(c) + ), + { + src: this.getSrc(), + crossOrigin: this.getCrossOrigin(), + filters: h + } + ); + return this.resizeFilter && (p.resizeFilter = this.resizeFilter.toObject()), p; + }, + /** + * Returns true if an image has crop applied, inspecting values of cropX,cropY,width,height. + * @return {Boolean} + */ + hasCrop: function() { + return this.cropX || this.cropY || this.width < this._element.width || this.height < this._element.height; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var c = [], h = [], p, y = this._element, v = -this.width / 2, x = -this.height / 2, I = "", P = ""; + if (!y) + return []; + if (this.hasCrop()) { + var F = e.Object.__uid++; + c.push( + ' +`, + ' +`, + ` +` + ), I = ' clip-path="url(#imageCrop_' + F + ')" '; + } + if (this.imageSmoothing || (P = '" image-rendering="optimizeSpeed'), h.push( + " +` + ), this.stroke || this.strokeDashArray) { + var k = this.fill; + this.fill = null, p = [ + " +` + ], this.fill = k; + } + return this.paintFirst !== "fill" ? c = c.concat(p, h) : c = c.concat(h, p), c; + }, + /* _TO_SVG_END_ */ + /** + * Returns source of an image + * @param {Boolean} filtered indicates if the src is needed for svg + * @return {String} Source of an image + */ + getSrc: function(c) { + var h = c ? this._element : this._originalElement; + return h ? h.toDataURL ? h.toDataURL() : this.srcFromAttribute ? h.getAttribute("src") : h.src : this.src || ""; + }, + /** + * Sets source of an image + * @param {String} src Source string (URL) + * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) + * @param {Object} [options] Options object + * @param {String} [options.crossOrigin] crossOrigin value (one of "", "anonymous", "use-credentials") + * @see https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes + * @return {fabric.Image} thisArg + * @chainable + */ + setSrc: function(c, h, p) { + return e.util.loadImage(c, function(y, v) { + this.setElement(y, p), this._setWidthHeight(), h && h(this, v); + }, this, p && p.crossOrigin), this; + }, + /** + * Returns string representation of an instance + * @return {String} String representation of an instance + */ + toString: function() { + return '#'; + }, + applyResizeFilters: function() { + var c = this.resizeFilter, h = this.minimumScaleTrigger, p = this.getTotalObjectScaling(), y = p.scaleX, v = p.scaleY, x = this._filteredEl || this._originalElement; + if (this.group && this.set("dirty", !0), !c || y > h && v > h) { + this._element = x, this._filterScalingX = 1, this._filterScalingY = 1, this._lastScaleX = y, this._lastScaleY = v; + return; + } + e.filterBackend || (e.filterBackend = e.initFilterBackend()); + var I = e.util.createCanvasElement(), P = this._filteredEl ? this.cacheKey + "_filtered" : this.cacheKey, F = x.width, k = x.height; + I.width = F, I.height = k, this._element = I, this._lastScaleX = c.scaleX = y, this._lastScaleY = c.scaleY = v, e.filterBackend.applyFilters( + [c], + x, + F, + k, + this._element, + P + ), this._filterScalingX = I.width / this._originalElement.width, this._filterScalingY = I.height / this._originalElement.height; + }, + /** + * Applies filters assigned to this image (from "filters" array) or from filter param + * @method applyFilters + * @param {Array} filters to be applied + * @param {Boolean} forResizing specify if the filter operation is a resize operation + * @return {thisArg} return the fabric.Image object + * @chainable + */ + applyFilters: function(c) { + if (c = c || this.filters || [], c = c.filter(function(x) { + return x && !x.isNeutralState(); + }), this.set("dirty", !0), this.removeTexture(this.cacheKey + "_filtered"), c.length === 0) + return this._element = this._originalElement, this._filteredEl = null, this._filterScalingX = 1, this._filterScalingY = 1, this; + var h = this._originalElement, p = h.naturalWidth || h.width, y = h.naturalHeight || h.height; + if (this._element === this._originalElement) { + var v = e.util.createCanvasElement(); + v.width = p, v.height = y, this._element = v, this._filteredEl = v; + } else + this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, p, y), this._lastScaleX = 1, this._lastScaleY = 1; + return e.filterBackend || (e.filterBackend = e.initFilterBackend()), e.filterBackend.applyFilters( + c, + this._originalElement, + p, + y, + this._element, + this.cacheKey + ), (this._originalElement.width !== this._element.width || this._originalElement.height !== this._element.height) && (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height), this; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(c) { + e.util.setImageSmoothing(c, this.imageSmoothing), this.isMoving !== !0 && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(c), this._renderPaintInOrder(c); + }, + /** + * Paint the cached copy of the object on the target context. + * it will set the imageSmoothing for the draw operation + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawCacheOnCanvas: function(c) { + e.util.setImageSmoothing(c, this.imageSmoothing), e.Object.prototype.drawCacheOnCanvas.call(this, c); + }, + /** + * Decide if the object should cache or not. Create its own cache level + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * This is the special image version where we would like to avoid caching where possible. + * Essentially images do not benefit from caching. They may require caching, and in that + * case we do it. Also caching an image usually ends in a loss of details. + * A full performance audit should be done. + * @return {Boolean} + */ + shouldCache: function() { + return this.needsItsOwnCache(); + }, + _renderFill: function(c) { + var h = this._element; + if (h) { + var p = this._filterScalingX, y = this._filterScalingY, v = this.width, x = this.height, I = Math.min, P = Math.max, F = P(this.cropX, 0), k = P(this.cropY, 0), V = h.naturalWidth || h.width, j = h.naturalHeight || h.height, Y = F * p, X = k * y, Q = I(v * p, V - Y), re = I(x * y, j - X), he = -v / 2, fe = -x / 2, be = I(v, V / p - F), Se = I(x, j / y - k); + h && c.drawImage(h, Y, X, Q, re, he, fe, be, Se); + } + }, + /** + * needed to check if image needs resize + * @private + */ + _needsResize: function() { + var c = this.getTotalObjectScaling(); + return c.scaleX !== this._lastScaleX || c.scaleY !== this._lastScaleY; + }, + /** + * @private + */ + _resetWidthHeight: function() { + this.set(this.getOriginalSize()); + }, + /** + * The Image class's initialization method. This method is automatically + * called by the constructor. + * @private + * @param {HTMLImageElement|String} element The element representing the image + * @param {Object} [options] Options object + */ + _initElement: function(c, h) { + this.setElement(e.util.getById(c), h), e.util.addClass(this.getElement(), e.Image.CSS_CANVAS); + }, + /** + * @private + * @param {Object} [options] Options object + */ + _initConfig: function(c) { + c || (c = {}), this.setOptions(c), this._setWidthHeight(c); + }, + /** + * @private + * @param {Array} filters to be initialized + * @param {Function} callback Callback to invoke when all fabric.Image.filters instances are created + */ + _initFilters: function(c, h) { + c && c.length ? e.util.enlivenObjects(c, function(p) { + h && h(p); + }, "fabric.Image.filters") : h && h(); + }, + /** + * @private + * Set the width and the height of the image object, using the element or the + * options. + * @param {Object} [options] Object with width/height properties + */ + _setWidthHeight: function(c) { + c || (c = {}); + var h = this.getElement(); + this.width = c.width || h.naturalWidth || h.width || 0, this.height = c.height || h.naturalHeight || h.height || 0; + }, + /** + * Calculate offset for center and scale factor for the image in order to respect + * the preserveAspectRatio attribute + * @private + * @return {Object} + */ + parsePreserveAspectRatioAttribute: function() { + var c = e.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio || ""), h = this._element.width, p = this._element.height, y = 1, v = 1, x = 0, I = 0, P = 0, F = 0, k, V = this.width, j = this.height, Y = { width: V, height: j }; + return c && (c.alignX !== "none" || c.alignY !== "none") ? (c.meetOrSlice === "meet" && (y = v = e.util.findScaleToFit(this._element, Y), k = (V - h * y) / 2, c.alignX === "Min" && (x = -k), c.alignX === "Max" && (x = k), k = (j - p * v) / 2, c.alignY === "Min" && (I = -k), c.alignY === "Max" && (I = k)), c.meetOrSlice === "slice" && (y = v = e.util.findScaleToCover(this._element, Y), k = h - V / y, c.alignX === "Mid" && (P = k / 2), c.alignX === "Max" && (P = k), k = p - j / v, c.alignY === "Mid" && (F = k / 2), c.alignY === "Max" && (F = k), h = V / y, p = j / v)) : (y = V / h, v = j / p), { + width: h, + height: p, + scaleX: y, + scaleY: v, + offsetLeft: x, + offsetTop: I, + cropX: P, + cropY: F + }; + } + } + ), e.Image.CSS_CANVAS = "canvas-img", e.Image.prototype.getSvgSrc = e.Image.prototype.getSrc, e.Image.fromObject = function(c, h) { + var p = e.util.object.clone(c); + e.util.loadImage(p.src, function(y, v) { + if (v) { + h && h(null, !0); + return; + } + e.Image.prototype._initFilters.call(p, p.filters, function(x) { + p.filters = x || [], e.Image.prototype._initFilters.call(p, [p.resizeFilter], function(I) { + p.resizeFilter = I[0], e.util.enlivenObjectEnlivables(p, p, function() { + var P = new e.Image(y, p); + h(P, !1); + }); + }); + }); + }, null, p.crossOrigin); + }, e.Image.fromURL = function(c, h, p) { + e.util.loadImage(c, function(y, v) { + h && h(new e.Image(y, p), v); + }, null, p && p.crossOrigin); + }, e.Image.ATTRIBUTE_NAMES = e.SHARED_ATTRIBUTES.concat( + "x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ") + ), e.Image.fromElement = function(c, h, p) { + var y = e.parseAttributes(c, e.Image.ATTRIBUTE_NAMES); + e.Image.fromURL( + y["xlink:href"], + h, + l(p ? e.util.object.clone(p) : {}, y) + ); + }; + }(t), e.util.object.extend( + e.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * @private + * @return {Number} angle value + */ + _getAngleValueForStraighten: function() { + var a = this.angle % 360; + return a > 0 ? Math.round((a - 1) / 90) * 90 : Math.round(a / 90) * 90; + }, + /** + * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) + * @return {fabric.Object} thisArg + * @chainable + */ + straighten: function() { + return this.rotate(this._getAngleValueForStraighten()); + }, + /** + * Same as {@link fabric.Object.prototype.straighten} but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Object} thisArg + */ + fxStraighten: function(a) { + a = a || {}; + var l = function() { + }, c = a.onComplete || l, h = a.onChange || l, p = this; + return e.util.animate({ + target: this, + startValue: this.get("angle"), + endValue: this._getAngleValueForStraighten(), + duration: this.FX_DURATION, + onChange: function(y) { + p.rotate(y), h(); + }, + onComplete: function() { + p.setCoords(), c(); + } + }); + } + } + ), e.util.object.extend( + e.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Straightens object, then rerenders canvas + * @param {fabric.Object} object Object to straighten + * @return {fabric.Canvas} thisArg + * @chainable + */ + straightenObject: function(a) { + return a.straighten(), this.requestRenderAll(), this; + }, + /** + * Same as {@link fabric.Canvas.prototype.straightenObject}, but animated + * @param {fabric.Object} object Object to straighten + * @return {fabric.Canvas} thisArg + */ + fxStraightenObject: function(a) { + return a.fxStraighten({ + onChange: this.requestRenderAllBound + }); + } + } + ), function() { + function a(c, h) { + var p = "precision " + h + ` float; +void main(){}`, y = c.createShader(c.FRAGMENT_SHADER); + return c.shaderSource(y, p), c.compileShader(y), !!c.getShaderParameter(y, c.COMPILE_STATUS); + } + e.isWebglSupported = function(c) { + if (e.isLikelyNode) + return !1; + c = c || e.WebglFilterBackend.prototype.tileSize; + var h = document.createElement("canvas"), p = h.getContext("webgl") || h.getContext("experimental-webgl"), y = !1; + if (p) { + e.maxTextureSize = p.getParameter(p.MAX_TEXTURE_SIZE), y = e.maxTextureSize >= c; + for (var v = ["highp", "mediump", "lowp"], x = 0; x < 3; x++) + if (a(p, v[x])) { + e.webGlPrecision = v[x]; + break; + } + } + return this.isSupported = y, y; + }, e.WebglFilterBackend = l; + function l(c) { + c && c.tileSize && (this.tileSize = c.tileSize), this.setupGLContext(this.tileSize, this.tileSize), this.captureGPUInfo(); + } + l.prototype = /** @lends fabric.WebglFilterBackend.prototype */ + { + tileSize: 2048, + /** + * Experimental. This object is a sort of repository of help layers used to avoid + * of recreating them during frequent filtering. If you are previewing a filter with + * a slider you probably do not want to create help layers every filter step. + * in this object there will be appended some canvases, created once, resized sometimes + * cleared never. Clearing is left to the developer. + **/ + resources: {}, + /** + * Setup a WebGL context suitable for filtering, and bind any needed event handlers. + */ + setupGLContext: function(c, h) { + this.dispose(), this.createWebGLCanvas(c, h), this.aPosition = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]), this.chooseFastestCopyGLTo2DMethod(c, h); + }, + /** + * Pick a method to copy data from GL context to 2d canvas. In some browsers using + * putImageData is faster than drawImage for that specific operation. + */ + chooseFastestCopyGLTo2DMethod: function(c, h) { + var p = typeof window.performance < "u", y; + try { + new ImageData(1, 1), y = !0; + } catch { + y = !1; + } + var v = typeof ArrayBuffer < "u", x = typeof Uint8ClampedArray < "u"; + if (p && y && v && x) { + var I = e.util.createCanvasElement(), P = new ArrayBuffer(c * h * 4); + if (e.forceGLPutImageData) { + this.imageBuffer = P, this.copyGLTo2D = o; + return; + } + var F = { + imageBuffer: P, + destinationWidth: c, + destinationHeight: h, + targetCanvas: I + }, k, V, j; + I.width = c, I.height = h, k = window.performance.now(), s.call(F, this.gl, F), V = window.performance.now() - k, k = window.performance.now(), o.call(F, this.gl, F), j = window.performance.now() - k, V > j ? (this.imageBuffer = P, this.copyGLTo2D = o) : this.copyGLTo2D = s; + } + }, + /** + * Create a canvas element and associated WebGL context and attaches them as + * class properties to the GLFilterBackend class. + */ + createWebGLCanvas: function(c, h) { + var p = e.util.createCanvasElement(); + p.width = c, p.height = h; + var y = { + alpha: !0, + premultipliedAlpha: !1, + depth: !1, + stencil: !1, + antialias: !1 + }, v = p.getContext("webgl", y); + v || (v = p.getContext("experimental-webgl", y)), v && (v.clearColor(0, 0, 0, 0), this.canvas = p, this.gl = v); + }, + /** + * Attempts to apply the requested filters to the source provided, drawing the filtered output + * to the provided target canvas. + * + * @param {Array} filters The filters to apply. + * @param {HTMLImageElement|HTMLCanvasElement} source The source to be filtered. + * @param {Number} width The width of the source input. + * @param {Number} height The height of the source input. + * @param {HTMLCanvasElement} targetCanvas The destination for filtered output to be drawn. + * @param {String|undefined} cacheKey A key used to cache resources related to the source. If + * omitted, caching will be skipped. + */ + applyFilters: function(c, h, p, y, v, x) { + var I = this.gl, P; + x && (P = this.getCachedTexture(x, h)); + var F = { + originalWidth: h.width || h.originalWidth, + originalHeight: h.height || h.originalHeight, + sourceWidth: p, + sourceHeight: y, + destinationWidth: p, + destinationHeight: y, + context: I, + sourceTexture: this.createTexture(I, p, y, !P && h), + targetTexture: this.createTexture(I, p, y), + originalTexture: P || this.createTexture(I, p, y, !P && h), + passes: c.length, + webgl: !0, + aPosition: this.aPosition, + programCache: this.programCache, + pass: 0, + filterBackend: this, + targetCanvas: v + }, k = I.createFramebuffer(); + return I.bindFramebuffer(I.FRAMEBUFFER, k), c.forEach(function(V) { + V && V.applyTo(F); + }), n(F), this.copyGLTo2D(I, F), I.bindTexture(I.TEXTURE_2D, null), I.deleteTexture(F.sourceTexture), I.deleteTexture(F.targetTexture), I.deleteFramebuffer(k), v.getContext("2d").setTransform(1, 0, 0, 1, 0, 0), F; + }, + /** + * Detach event listeners, remove references, and clean up caches. + */ + dispose: function() { + this.canvas && (this.canvas = null, this.gl = null), this.clearWebGLCaches(); + }, + /** + * Wipe out WebGL-related caches. + */ + clearWebGLCaches: function() { + this.programCache = {}, this.textureCache = {}; + }, + /** + * Create a WebGL texture object. + * + * Accepts specific dimensions to initialize the texture to or a source image. + * + * @param {WebGLRenderingContext} gl The GL context to use for creating the texture. + * @param {Number} width The width to initialize the texture at. + * @param {Number} height The height to initialize the texture. + * @param {HTMLImageElement|HTMLCanvasElement} textureImageSource A source for the texture data. + * @param {Number} filterType gl.NEAREST or gl.LINEAR usually, webgl numeri constants + * @returns {WebGLTexture} + */ + createTexture: function(c, h, p, y, v) { + var x = c.createTexture(); + return c.bindTexture(c.TEXTURE_2D, x), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MAG_FILTER, v || c.NEAREST), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MIN_FILTER, v || c.NEAREST), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), y ? c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, c.RGBA, c.UNSIGNED_BYTE, y) : c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, h, p, 0, c.RGBA, c.UNSIGNED_BYTE, null), x; + }, + /** + * Can be optionally used to get a texture from the cache array + * + * If an existing texture is not found, a new texture is created and cached. + * + * @param {String} uniqueId A cache key to use to find an existing texture. + * @param {HTMLImageElement|HTMLCanvasElement} textureImageSource A source to use to create the + * texture cache entry if one does not already exist. + */ + getCachedTexture: function(c, h) { + if (this.textureCache[c]) + return this.textureCache[c]; + var p = this.createTexture( + this.gl, + h.width, + h.height, + h + ); + return this.textureCache[c] = p, p; + }, + /** + * Clear out cached resources related to a source image that has been + * filtered previously. + * + * @param {String} cacheKey The cache key provided when the source image was filtered. + */ + evictCachesForKey: function(c) { + this.textureCache[c] && (this.gl.deleteTexture(this.textureCache[c]), delete this.textureCache[c]); + }, + copyGLTo2D: s, + /** + * Attempt to extract GPU information strings from a WebGL context. + * + * Useful information when debugging or blacklisting specific GPUs. + * + * @returns {Object} A GPU info object with renderer and vendor strings. + */ + captureGPUInfo: function() { + if (this.gpuInfo) + return this.gpuInfo; + var c = this.gl, h = { renderer: "", vendor: "" }; + if (!c) + return h; + var p = c.getExtension("WEBGL_debug_renderer_info"); + if (p) { + var y = c.getParameter(p.UNMASKED_RENDERER_WEBGL), v = c.getParameter(p.UNMASKED_VENDOR_WEBGL); + y && (h.renderer = y.toLowerCase()), v && (h.vendor = v.toLowerCase()); + } + return this.gpuInfo = h, h; + } + }; + }(); + function n(a) { + var l = a.targetCanvas, c = l.width, h = l.height, p = a.destinationWidth, y = a.destinationHeight; + (c !== p || h !== y) && (l.width = p, l.height = y); + } + function s(a, l) { + var c = a.canvas, h = l.targetCanvas, p = h.getContext("2d"); + p.translate(0, h.height), p.scale(1, -1); + var y = c.height - h.height; + p.drawImage( + c, + 0, + y, + h.width, + h.height, + 0, + 0, + h.width, + h.height + ); + } + function o(a, l) { + var c = l.targetCanvas, h = c.getContext("2d"), p = l.destinationWidth, y = l.destinationHeight, v = p * y * 4, x = new Uint8Array(this.imageBuffer, 0, v), I = new Uint8ClampedArray(this.imageBuffer, 0, v); + a.readPixels(0, 0, p, y, a.RGBA, a.UNSIGNED_BYTE, x); + var P = new ImageData(I, p, y); + h.putImageData(P, 0, 0); + } + (function() { + var a = function() { + }; + e.Canvas2dFilterBackend = l; + function l() { + } + l.prototype = /** @lends fabric.Canvas2dFilterBackend.prototype */ + { + evictCachesForKey: a, + dispose: a, + clearWebGLCaches: a, + /** + * Experimental. This object is a sort of repository of help layers used to avoid + * of recreating them during frequent filtering. If you are previewing a filter with + * a slider you probably do not want to create help layers every filter step. + * in this object there will be appended some canvases, created once, resized sometimes + * cleared never. Clearing is left to the developer. + **/ + resources: {}, + /** + * Apply a set of filters against a source image and draw the filtered output + * to the provided destination canvas. + * + * @param {EnhancedFilter} filters The filter to apply. + * @param {HTMLImageElement|HTMLCanvasElement} sourceElement The source to be filtered. + * @param {Number} sourceWidth The width of the source input. + * @param {Number} sourceHeight The height of the source input. + * @param {HTMLCanvasElement} targetCanvas The destination for filtered output to be drawn. + */ + applyFilters: function(c, h, p, y, v) { + var x = v.getContext("2d"); + x.drawImage(h, 0, 0, p, y); + var I = x.getImageData(0, 0, p, y), P = x.getImageData(0, 0, p, y), F = { + sourceWidth: p, + sourceHeight: y, + imageData: I, + originalEl: h, + originalImageData: P, + canvasEl: v, + ctx: x, + filterBackend: this + }; + return c.forEach(function(k) { + k.applyTo(F); + }), (F.imageData.width !== p || F.imageData.height !== y) && (v.width = F.imageData.width, v.height = F.imageData.height), x.putImageData(F.imageData, 0, 0), F; + } + }; + })(), e.Image = e.Image || {}, e.Image.filters = e.Image.filters || {}, e.Image.filters.BaseFilter = e.util.createClass( + /** @lends fabric.Image.filters.BaseFilter.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "BaseFilter", + /** + * Array of attributes to send with buffers. do not modify + * @private + */ + vertexSource: `attribute vec2 aPosition; +varying vec2 vTexCoord; +void main() { +vTexCoord = aPosition; +gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0); +}`, + fragmentSource: `precision highp float; +varying vec2 vTexCoord; +uniform sampler2D uTexture; +void main() { +gl_FragColor = texture2D(uTexture, vTexCoord); +}`, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(a) { + a && this.setOptions(a); + }, + /** + * Sets filter's properties from options + * @param {Object} [options] Options object + */ + setOptions: function(a) { + for (var l in a) + this[l] = a[l]; + }, + /** + * Compile this filter's shader program. + * + * @param {WebGLRenderingContext} gl The GL canvas context to use for shader compilation. + * @param {String} fragmentSource fragmentShader source for compilation + * @param {String} vertexSource vertexShader source for compilation + */ + createProgram: function(a, l, c) { + l = l || this.fragmentSource, c = c || this.vertexSource, e.webGlPrecision !== "highp" && (l = l.replace( + /precision highp float/g, + "precision " + e.webGlPrecision + " float" + )); + var h = a.createShader(a.VERTEX_SHADER); + if (a.shaderSource(h, c), a.compileShader(h), !a.getShaderParameter(h, a.COMPILE_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + "Vertex shader compile error for " + this.type + ": " + a.getShaderInfoLog(h) + ); + var p = a.createShader(a.FRAGMENT_SHADER); + if (a.shaderSource(p, l), a.compileShader(p), !a.getShaderParameter(p, a.COMPILE_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + "Fragment shader compile error for " + this.type + ": " + a.getShaderInfoLog(p) + ); + var y = a.createProgram(); + if (a.attachShader(y, h), a.attachShader(y, p), a.linkProgram(y), !a.getProgramParameter(y, a.LINK_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + 'Shader link error for "${this.type}" ' + a.getProgramInfoLog(y) + ); + var v = this.getAttributeLocations(a, y), x = this.getUniformLocations(a, y) || {}; + return x.uStepW = a.getUniformLocation(y, "uStepW"), x.uStepH = a.getUniformLocation(y, "uStepH"), { + program: y, + attributeLocations: v, + uniformLocations: x + }; + }, + /** + * Return a map of attribute names to WebGLAttributeLocation objects. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {WebGLShaderProgram} program The shader program from which to take attribute locations. + * @returns {Object} A map of attribute names to attribute locations. + */ + getAttributeLocations: function(a, l) { + return { + aPosition: a.getAttribLocation(l, "aPosition") + }; + }, + /** + * Return a map of uniform names to WebGLUniformLocation objects. + * + * Intended to be overridden by subclasses. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {WebGLShaderProgram} program The shader program from which to take uniform locations. + * @returns {Object} A map of uniform names to uniform locations. + */ + getUniformLocations: function() { + return {}; + }, + /** + * Send attribute data from this filter to its shader program on the GPU. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {Object} attributeLocations A map of shader attribute names to their locations. + */ + sendAttributeData: function(a, l, c) { + var h = l.aPosition, p = a.createBuffer(); + a.bindBuffer(a.ARRAY_BUFFER, p), a.enableVertexAttribArray(h), a.vertexAttribPointer(h, 2, a.FLOAT, !1, 0, 0), a.bufferData(a.ARRAY_BUFFER, c, a.STATIC_DRAW); + }, + _setupFrameBuffer: function(a) { + var l = a.context, c, h; + a.passes > 1 ? (c = a.destinationWidth, h = a.destinationHeight, (a.sourceWidth !== c || a.sourceHeight !== h) && (l.deleteTexture(a.targetTexture), a.targetTexture = a.filterBackend.createTexture(l, c, h)), l.framebufferTexture2D( + l.FRAMEBUFFER, + l.COLOR_ATTACHMENT0, + l.TEXTURE_2D, + a.targetTexture, + 0 + )) : (l.bindFramebuffer(l.FRAMEBUFFER, null), l.finish()); + }, + _swapTextures: function(a) { + a.passes--, a.pass++; + var l = a.targetTexture; + a.targetTexture = a.sourceTexture, a.sourceTexture = l; + }, + /** + * Generic isNeutral implementation for one parameter based filters. + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * Other filters may need their own version ( ColorMatrix, HueRotation, gamma, ComposedFilter ) + * @param {Object} options + **/ + isNeutralState: function() { + var a = this.mainParameter, l = e.Image.filters[this.type].prototype; + if (a) + if (Array.isArray(l[a])) { + for (var c = l[a].length; c--; ) + if (this[a][c] !== l[a][c]) + return !1; + return !0; + } else + return l[a] === this[a]; + else + return !1; + }, + /** + * Apply this filter to the input image data provided. + * + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(a) { + a.webgl ? (this._setupFrameBuffer(a), this.applyToWebGL(a), this._swapTextures(a)) : this.applyTo2d(a); + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(a) { + return a.programCache.hasOwnProperty(this.type) || (a.programCache[this.type] = this.createProgram(a.context)), a.programCache[this.type]; + }, + /** + * Apply this filter using webgl. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.originalTexture The texture of the original input image. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyToWebGL: function(a) { + var l = a.context, c = this.retrieveShader(a); + a.pass === 0 && a.originalTexture ? l.bindTexture(l.TEXTURE_2D, a.originalTexture) : l.bindTexture(l.TEXTURE_2D, a.sourceTexture), l.useProgram(c.program), this.sendAttributeData(l, c.attributeLocations, a.aPosition), l.uniform1f(c.uniformLocations.uStepW, 1 / a.sourceWidth), l.uniform1f(c.uniformLocations.uStepH, 1 / a.sourceHeight), this.sendUniformData(l, c.uniformLocations), l.viewport(0, 0, a.destinationWidth, a.destinationHeight), l.drawArrays(l.TRIANGLE_STRIP, 0, 4); + }, + bindAdditionalTexture: function(a, l, c) { + a.activeTexture(c), a.bindTexture(a.TEXTURE_2D, l), a.activeTexture(a.TEXTURE0); + }, + unbindAdditionalTexture: function(a, l) { + a.activeTexture(l), a.bindTexture(a.TEXTURE_2D, null), a.activeTexture(a.TEXTURE0); + }, + getMainParameter: function() { + return this[this.mainParameter]; + }, + setMainParameter: function(a) { + this[this.mainParameter] = a; + }, + /** + * Send uniform data from this filter to its shader program on the GPU. + * + * Intended to be overridden by subclasses. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {Object} uniformLocations A map of shader uniform names to their locations. + */ + sendUniformData: function() { + }, + /** + * If needed by a 2d filter, this functions can create an helper canvas to be used + * remember that options.targetCanvas is available for use till end of chain. + */ + createHelpLayer: function(a) { + if (!a.helpLayer) { + var l = document.createElement("canvas"); + l.width = a.sourceWidth, l.height = a.sourceHeight, a.helpLayer = l; + } + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + var a = { type: this.type }, l = this.mainParameter; + return l && (a[l] = this[l]), a; + }, + /** + * Returns a JSON representation of an instance + * @return {Object} JSON + */ + toJSON: function() { + return this.toObject(); + } + } + ), e.Image.filters.BaseFilter.fromObject = function(a, l) { + var c = new e.Image.filters[a.type](a); + return l && l(c), c; + }, function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.ColorMatrix = h( + c.BaseFilter, + /** @lends fabric.Image.filters.ColorMatrix.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "ColorMatrix", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +varying vec2 vTexCoord; +uniform mat4 uColorMatrix; +uniform vec4 uConstants; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color *= uColorMatrix; +color += uConstants; +gl_FragColor = color; +}`, + /** + * Colormatrix for pixels. + * array of 20 floats. Numbers in positions 4, 9, 14, 19 loose meaning + * outside the -1, 1 range. + * 0.0039215686 is the part of 1 that get translated to 1 in 2d + * @param {Array} matrix array of 20 numbers. + * @default + */ + matrix: [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + mainParameter: "matrix", + /** + * Lock the colormatrix on the color part, skipping alpha, mainly for non webgl scenario + * to save some calculation + * @type Boolean + * @default true + */ + colorsOnly: !0, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(p) { + this.callSuper("initialize", p), this.matrix = this.matrix.slice(0); + }, + /** + * Apply the ColorMatrix operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x = v.length, I = this.matrix, P, F, k, V, j, Y = this.colorsOnly; + for (j = 0; j < x; j += 4) + P = v[j], F = v[j + 1], k = v[j + 2], Y ? (v[j] = P * I[0] + F * I[1] + k * I[2] + I[4] * 255, v[j + 1] = P * I[5] + F * I[6] + k * I[7] + I[9] * 255, v[j + 2] = P * I[10] + F * I[11] + k * I[12] + I[14] * 255) : (V = v[j + 3], v[j] = P * I[0] + F * I[1] + k * I[2] + V * I[3] + I[4] * 255, v[j + 1] = P * I[5] + F * I[6] + k * I[7] + V * I[8] + I[9] * 255, v[j + 2] = P * I[10] + F * I[11] + k * I[12] + V * I[13] + I[14] * 255, v[j + 3] = P * I[15] + F * I[16] + k * I[17] + V * I[18] + I[19] * 255); + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uColorMatrix: p.getUniformLocation(y, "uColorMatrix"), + uConstants: p.getUniformLocation(y, "uConstants") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + var v = this.matrix, x = [ + v[0], + v[1], + v[2], + v[3], + v[5], + v[6], + v[7], + v[8], + v[10], + v[11], + v[12], + v[13], + v[15], + v[16], + v[17], + v[18] + ], I = [v[4], v[9], v[14], v[19]]; + p.uniformMatrix4fv(y.uColorMatrix, !1, x), p.uniform4fv(y.uConstants, I); + } + } + ), l.Image.filters.ColorMatrix.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Brightness = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Brightness.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Brightness", + /** + * Fragment source for the brightness program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uBrightness; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color.rgb += uBrightness; +gl_FragColor = color; +}`, + /** + * Brightness value, from -1 to 1. + * translated to -255 to 255 for 2d + * 0.0039215686 is the part of 1 that get translated to 1 in 2d + * @param {Number} brightness + * @default + */ + brightness: 0, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "brightness", + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + if (this.brightness !== 0) { + var y = p.imageData, v = y.data, x, I = v.length, P = Math.round(this.brightness * 255); + for (x = 0; x < I; x += 4) + v[x] = v[x] + P, v[x + 1] = v[x + 1] + P, v[x + 2] = v[x + 2] + P; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uBrightness: p.getUniformLocation(y, "uBrightness") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1f(y.uBrightness, this.brightness); + } + } + ), l.Image.filters.Brightness.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.Image.filters, p = l.util.createClass; + h.Convolute = p( + h.BaseFilter, + /** @lends fabric.Image.filters.Convolute.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Convolute", + /* + * Opaque value (true/false) + */ + opaque: !1, + /* + * matrix for the filter, max 9x9 + */ + matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0], + /** + * Fragment source for the brightness program + */ + fragmentSource: { + Convolute_3_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[9]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 3.0; h+=1.0) { +for (float w = 0.0; w < 3.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_3_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[9]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 3.0; h+=1.0) { +for (float w = 0.0; w < 3.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_5_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[25]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 5.0; h+=1.0) { +for (float w = 0.0; w < 5.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_5_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[25]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 5.0; h+=1.0) { +for (float w = 0.0; w < 5.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_7_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[49]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 7.0; h+=1.0) { +for (float w = 0.0; w < 7.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_7_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[49]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 7.0; h+=1.0) { +for (float w = 0.0; w < 7.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_9_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[81]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 9.0; h+=1.0) { +for (float w = 0.0; w < 9.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_9_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[81]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 9.0; h+=1.0) { +for (float w = 0.0; w < 9.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}` + }, + /** + * Constructor + * @memberOf fabric.Image.filters.Convolute.prototype + * @param {Object} [options] Options object + * @param {Boolean} [options.opaque=false] Opaque value (true/false) + * @param {Array} [options.matrix] Filter matrix + */ + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(y) { + var v = Math.sqrt(this.matrix.length), x = this.type + "_" + v + "_" + (this.opaque ? 1 : 0), I = this.fragmentSource[x]; + return y.programCache.hasOwnProperty(x) || (y.programCache[x] = this.createProgram(y.context, I)), y.programCache[x]; + }, + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + var v = y.imageData, x = v.data, I = this.matrix, P = Math.round(Math.sqrt(I.length)), F = Math.floor(P / 2), k = v.width, V = v.height, j = y.ctx.createImageData(k, V), Y = j.data, X = this.opaque ? 1 : 0, Q, re, he, fe, be, Se, Me, ke, J, ce, xe, Pe, Oe; + for (xe = 0; xe < V; xe++) + for (ce = 0; ce < k; ce++) { + for (be = (xe * k + ce) * 4, Q = 0, re = 0, he = 0, fe = 0, Oe = 0; Oe < P; Oe++) + for (Pe = 0; Pe < P; Pe++) + Me = xe + Oe - F, Se = ce + Pe - F, !(Me < 0 || Me >= V || Se < 0 || Se >= k) && (ke = (Me * k + Se) * 4, J = I[Oe * P + Pe], Q += x[ke] * J, re += x[ke + 1] * J, he += x[ke + 2] * J, X || (fe += x[ke + 3] * J)); + Y[be] = Q, Y[be + 1] = re, Y[be + 2] = he, X ? Y[be + 3] = x[be + 3] : Y[be + 3] = fe; + } + y.imageData = j; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, v) { + return { + uMatrix: y.getUniformLocation(v, "uMatrix"), + uOpaque: y.getUniformLocation(v, "uOpaque"), + uHalfSize: y.getUniformLocation(v, "uHalfSize"), + uSize: y.getUniformLocation(v, "uSize") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, v) { + y.uniform1fv(v.uMatrix, this.matrix); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return c(this.callSuper("toObject"), { + opaque: this.opaque, + matrix: this.matrix + }); + } + } + ), l.Image.filters.Convolute.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Grayscale = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Grayscale.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Grayscale", + fragmentSource: { + average: `precision highp float; +uniform sampler2D uTexture; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float average = (color.r + color.b + color.g) / 3.0; +gl_FragColor = vec4(average, average, average, color.a); +}`, + lightness: `precision highp float; +uniform sampler2D uTexture; +uniform int uMode; +varying vec2 vTexCoord; +void main() { +vec4 col = texture2D(uTexture, vTexCoord); +float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0; +gl_FragColor = vec4(average, average, average, col.a); +}`, + luminosity: `precision highp float; +uniform sampler2D uTexture; +uniform int uMode; +varying vec2 vTexCoord; +void main() { +vec4 col = texture2D(uTexture, vTexCoord); +float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b; +gl_FragColor = vec4(average, average, average, col.a); +}` + }, + /** + * Grayscale mode, between 'average', 'lightness', 'luminosity' + * @param {String} type + * @default + */ + mode: "average", + mainParameter: "mode", + /** + * Apply the Grayscale operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x, I = v.length, P, F = this.mode; + for (x = 0; x < I; x += 4) + F === "average" ? P = (v[x] + v[x + 1] + v[x + 2]) / 3 : F === "lightness" ? P = (Math.min(v[x], v[x + 1], v[x + 2]) + Math.max(v[x], v[x + 1], v[x + 2])) / 2 : F === "luminosity" && (P = 0.21 * v[x] + 0.72 * v[x + 1] + 0.07 * v[x + 2]), v[x] = P, v[x + 1] = P, v[x + 2] = P; + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(p) { + var y = this.type + "_" + this.mode; + if (!p.programCache.hasOwnProperty(y)) { + var v = this.fragmentSource[this.mode]; + p.programCache[y] = this.createProgram(p.context, v); + } + return p.programCache[y]; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uMode: p.getUniformLocation(y, "uMode") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + var v = 1; + p.uniform1i(y.uMode, v); + }, + /** + * Grayscale filter isNeutralState implementation + * The filter is never neutral + * on the image + **/ + isNeutralState: function() { + return !1; + } + } + ), l.Image.filters.Grayscale.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Invert = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Invert.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Invert", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform int uInvert; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +if (uInvert == 1) { +gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a); +} else { +gl_FragColor = color; +} +}`, + /** + * Filter invert. if false, does nothing + * @param {Boolean} invert + * @default + */ + invert: !0, + mainParameter: "invert", + /** + * Apply the Invert operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x, I = v.length; + for (x = 0; x < I; x += 4) + v[x] = 255 - v[x], v[x + 1] = 255 - v[x + 1], v[x + 2] = 255 - v[x + 2]; + }, + /** + * Invert filter isNeutralState implementation + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * @param {Object} options + **/ + isNeutralState: function() { + return !this.invert; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uInvert: p.getUniformLocation(y, "uInvert") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1i(y.uInvert, this.invert); + } + } + ), l.Image.filters.Invert.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.Image.filters, p = l.util.createClass; + h.Noise = p( + h.BaseFilter, + /** @lends fabric.Image.filters.Noise.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Noise", + /** + * Fragment source for the noise program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uStepH; +uniform float uNoise; +uniform float uSeed; +varying vec2 vTexCoord; +float rand(vec2 co, float seed, float vScale) { +return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0); +} +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise; +gl_FragColor = color; +}`, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "noise", + /** + * Noise value, from + * @param {Number} noise + * @default + */ + noise: 0, + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + if (this.noise !== 0) { + var v = y.imageData, x = v.data, I, P = x.length, F = this.noise, k; + for (I = 0, P = x.length; I < P; I += 4) + k = (0.5 - Math.random()) * F, x[I] += k, x[I + 1] += k, x[I + 2] += k; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, v) { + return { + uNoise: y.getUniformLocation(v, "uNoise"), + uSeed: y.getUniformLocation(v, "uSeed") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, v) { + y.uniform1f(v.uNoise, this.noise / 255), y.uniform1f(v.uSeed, Math.random()); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return c(this.callSuper("toObject"), { + noise: this.noise + }); + } + } + ), l.Image.filters.Noise.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Pixelate = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Pixelate.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Pixelate", + blocksize: 4, + mainParameter: "blocksize", + /** + * Fragment source for the Pixelate program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uBlocksize; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +float blockW = uBlocksize * uStepW; +float blockH = uBlocksize * uStepW; +int posX = int(vTexCoord.x / blockW); +int posY = int(vTexCoord.y / blockH); +float fposX = float(posX); +float fposY = float(posY); +vec2 squareCoords = vec2(fposX * blockW, fposY * blockH); +vec4 color = texture2D(uTexture, squareCoords); +gl_FragColor = color; +}`, + /** + * Apply the Pixelate operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x = y.height, I = y.width, P, F, k, V, j, Y, X, Q, re, he, fe; + for (F = 0; F < x; F += this.blocksize) + for (k = 0; k < I; k += this.blocksize) + for (P = F * 4 * I + k * 4, V = v[P], j = v[P + 1], Y = v[P + 2], X = v[P + 3], he = Math.min(F + this.blocksize, x), fe = Math.min(k + this.blocksize, I), Q = F; Q < he; Q++) + for (re = k; re < fe; re++) + P = Q * 4 * I + re * 4, v[P] = V, v[P + 1] = j, v[P + 2] = Y, v[P + 3] = X; + }, + /** + * Indicate when the filter is not gonna apply changes to the image + **/ + isNeutralState: function() { + return this.blocksize === 1; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uBlocksize: p.getUniformLocation(y, "uBlocksize"), + uStepW: p.getUniformLocation(y, "uStepW"), + uStepH: p.getUniformLocation(y, "uStepH") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1f(y.uBlocksize, this.blocksize); + } + } + ), l.Image.filters.Pixelate.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.extend, h = l.Image.filters, p = l.util.createClass; + h.RemoveColor = p( + h.BaseFilter, + /** @lends fabric.Image.filters.RemoveColor.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "RemoveColor", + /** + * Color to remove, in any format understood by fabric.Color. + * @param {String} type + * @default + */ + color: "#FFFFFF", + /** + * Fragment source for the brightness program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec4 uLow; +uniform vec4 uHigh; +varying vec2 vTexCoord; +void main() { +gl_FragColor = texture2D(uTexture, vTexCoord); +if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) { +gl_FragColor.a = 0.0; +} +}`, + /** + * distance to actual color, as value up or down from each r,g,b + * between 0 and 1 + **/ + distance: 0.02, + /** + * For color to remove inside distance, use alpha channel for a smoother deletion + * NOT IMPLEMENTED YET + **/ + useAlpha: !1, + /** + * Constructor + * @memberOf fabric.Image.filters.RemoveWhite.prototype + * @param {Object} [options] Options object + * @param {Number} [options.color=#RRGGBB] Threshold value + * @param {Number} [options.distance=10] Distance value + */ + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo2d: function(y) { + var v = y.imageData, x = v.data, I, P = this.distance * 255, F, k, V, j = new l.Color(this.color).getSource(), Y = [ + j[0] - P, + j[1] - P, + j[2] - P + ], X = [ + j[0] + P, + j[1] + P, + j[2] + P + ]; + for (I = 0; I < x.length; I += 4) + F = x[I], k = x[I + 1], V = x[I + 2], F > Y[0] && k > Y[1] && V > Y[2] && F < X[0] && k < X[1] && V < X[2] && (x[I + 3] = 0); + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, v) { + return { + uLow: y.getUniformLocation(v, "uLow"), + uHigh: y.getUniformLocation(v, "uHigh") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, v) { + var x = new l.Color(this.color).getSource(), I = parseFloat(this.distance), P = [ + 0 + x[0] / 255 - I, + 0 + x[1] / 255 - I, + 0 + x[2] / 255 - I, + 1 + ], F = [ + x[0] / 255 + I, + x[1] / 255 + I, + x[2] / 255 + I, + 1 + ]; + y.uniform4fv(v.uLow, P), y.uniform4fv(v.uHigh, F); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return c(this.callSuper("toObject"), { + color: this.color, + distance: this.distance + }); + } + } + ), l.Image.filters.RemoveColor.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass, p = { + Brownie: [ + 0.5997, + 0.34553, + -0.27082, + 0, + 0.186, + -0.0377, + 0.86095, + 0.15059, + 0, + -0.1449, + 0.24113, + -0.07441, + 0.44972, + 0, + -0.02965, + 0, + 0, + 0, + 1, + 0 + ], + Vintage: [ + 0.62793, + 0.32021, + -0.03965, + 0, + 0.03784, + 0.02578, + 0.64411, + 0.03259, + 0, + 0.02926, + 0.0466, + -0.08512, + 0.52416, + 0, + 0.02023, + 0, + 0, + 0, + 1, + 0 + ], + Kodachrome: [ + 1.12855, + -0.39673, + -0.03992, + 0, + 0.24991, + -0.16404, + 1.08352, + -0.05498, + 0, + 0.09698, + -0.16786, + -0.56034, + 1.60148, + 0, + 0.13972, + 0, + 0, + 0, + 1, + 0 + ], + Technicolor: [ + 1.91252, + -0.85453, + -0.09155, + 0, + 0.04624, + -0.30878, + 1.76589, + -0.10601, + 0, + -0.27589, + -0.2311, + -0.75018, + 1.84759, + 0, + 0.12137, + 0, + 0, + 0, + 1, + 0 + ], + Polaroid: [ + 1.438, + -0.062, + -0.062, + 0, + 0, + -0.122, + 1.378, + -0.122, + 0, + 0, + -0.016, + -0.016, + 1.483, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + Sepia: [ + 0.393, + 0.769, + 0.189, + 0, + 0, + 0.349, + 0.686, + 0.168, + 0, + 0, + 0.272, + 0.534, + 0.131, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + BlackWhite: [ + 1.5, + 1.5, + 1.5, + 0, + -1, + 1.5, + 1.5, + 1.5, + 0, + -1, + 1.5, + 1.5, + 1.5, + 0, + -1, + 0, + 0, + 0, + 1, + 0 + ] + }; + for (var y in p) + c[y] = h( + c.ColorMatrix, + /** @lends fabric.Image.filters.Sepia.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: y, + /** + * Colormatrix for the effect + * array of 20 floats. Numbers in positions 4, 9, 14, 19 loose meaning + * outside the -1, 1 range. + * @param {Array} matrix array of 20 numbers. + * @default + */ + matrix: p[y], + /** + * Lock the matrix export for this kind of static, parameter less filters. + */ + mainParameter: !1, + /** + * Lock the colormatrix on the color part, skipping alpha + */ + colorsOnly: !0 + } + ), l.Image.filters[y].fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric, c = l.Image.filters, h = l.util.createClass; + c.BlendColor = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Blend.prototype */ + { + type: "BlendColor", + /** + * Color to make the blend operation with. default to a reddish color since black or white + * gives always strong result. + * @type String + * @default + **/ + color: "#F95C63", + /** + * Blend mode for the filter: one of multiply, add, diff, screen, subtract, + * darken, lighten, overlay, exclusion, tint. + * @type String + * @default + **/ + mode: "multiply", + /** + * alpha value. represent the strength of the blend color operation. + * @type Number + * @default + **/ + alpha: 1, + /** + * Fragment source for the Multiply program + */ + fragmentSource: { + multiply: `gl_FragColor.rgb *= uColor.rgb; +`, + screen: `gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb); +`, + add: `gl_FragColor.rgb += uColor.rgb; +`, + diff: `gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb); +`, + subtract: `gl_FragColor.rgb -= uColor.rgb; +`, + lighten: `gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb); +`, + darken: `gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb); +`, + exclusion: `gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb); +`, + overlay: `if (uColor.r < 0.5) { +gl_FragColor.r *= 2.0 * uColor.r; +} else { +gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r); +} +if (uColor.g < 0.5) { +gl_FragColor.g *= 2.0 * uColor.g; +} else { +gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g); +} +if (uColor.b < 0.5) { +gl_FragColor.b *= 2.0 * uColor.b; +} else { +gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b); +} +`, + tint: `gl_FragColor.rgb *= (1.0 - uColor.a); +gl_FragColor.rgb += uColor.rgb; +` + }, + /** + * build the fragment source for the filters, joining the common part with + * the specific one. + * @param {String} mode the mode of the filter, a key of this.fragmentSource + * @return {String} the source to be compiled + * @private + */ + buildSource: function(p) { + return `precision highp float; +uniform sampler2D uTexture; +uniform vec4 uColor; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +gl_FragColor = color; +if (color.a > 0.0) { +` + this.fragmentSource[p] + `} +}`; + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(p) { + var y = this.type + "_" + this.mode, v; + return p.programCache.hasOwnProperty(y) || (v = this.buildSource(this.mode), p.programCache[y] = this.createProgram(p.context, v)), p.programCache[y]; + }, + /** + * Apply the Blend operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x = v.length, I, P, F, k, V, j, Y, X = 1 - this.alpha; + Y = new l.Color(this.color).getSource(), I = Y[0] * this.alpha, P = Y[1] * this.alpha, F = Y[2] * this.alpha; + for (var Q = 0; Q < x; Q += 4) + switch (k = v[Q], V = v[Q + 1], j = v[Q + 2], this.mode) { + case "multiply": + v[Q] = k * I / 255, v[Q + 1] = V * P / 255, v[Q + 2] = j * F / 255; + break; + case "screen": + v[Q] = 255 - (255 - k) * (255 - I) / 255, v[Q + 1] = 255 - (255 - V) * (255 - P) / 255, v[Q + 2] = 255 - (255 - j) * (255 - F) / 255; + break; + case "add": + v[Q] = k + I, v[Q + 1] = V + P, v[Q + 2] = j + F; + break; + case "diff": + case "difference": + v[Q] = Math.abs(k - I), v[Q + 1] = Math.abs(V - P), v[Q + 2] = Math.abs(j - F); + break; + case "subtract": + v[Q] = k - I, v[Q + 1] = V - P, v[Q + 2] = j - F; + break; + case "darken": + v[Q] = Math.min(k, I), v[Q + 1] = Math.min(V, P), v[Q + 2] = Math.min(j, F); + break; + case "lighten": + v[Q] = Math.max(k, I), v[Q + 1] = Math.max(V, P), v[Q + 2] = Math.max(j, F); + break; + case "overlay": + v[Q] = I < 128 ? 2 * k * I / 255 : 255 - 2 * (255 - k) * (255 - I) / 255, v[Q + 1] = P < 128 ? 2 * V * P / 255 : 255 - 2 * (255 - V) * (255 - P) / 255, v[Q + 2] = F < 128 ? 2 * j * F / 255 : 255 - 2 * (255 - j) * (255 - F) / 255; + break; + case "exclusion": + v[Q] = I + k - 2 * I * k / 255, v[Q + 1] = P + V - 2 * P * V / 255, v[Q + 2] = F + j - 2 * F * j / 255; + break; + case "tint": + v[Q] = I + k * X, v[Q + 1] = P + V * X, v[Q + 2] = F + j * X; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uColor: p.getUniformLocation(y, "uColor") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + var v = new l.Color(this.color).getSource(); + v[0] = this.alpha * v[0] / 255, v[1] = this.alpha * v[1] / 255, v[2] = this.alpha * v[2] / 255, v[3] = this.alpha, p.uniform4fv(y.uColor, v); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + color: this.color, + mode: this.mode, + alpha: this.alpha + }; + } + } + ), l.Image.filters.BlendColor.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric, c = l.Image.filters, h = l.util.createClass; + c.BlendImage = h( + c.BaseFilter, + /** @lends fabric.Image.filters.BlendImage.prototype */ + { + type: "BlendImage", + /** + * Color to make the blend operation with. default to a reddish color since black or white + * gives always strong result. + **/ + image: null, + /** + * Blend mode for the filter (one of "multiply", "mask") + * @type String + * @default + **/ + mode: "multiply", + /** + * alpha value. represent the strength of the blend image operation. + * not implemented. + **/ + alpha: 1, + vertexSource: `attribute vec2 aPosition; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +uniform mat3 uTransformMatrix; +void main() { +vTexCoord = aPosition; +vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy; +gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0); +}`, + /** + * Fragment source for the Multiply program + */ + fragmentSource: { + multiply: `precision highp float; +uniform sampler2D uTexture; +uniform sampler2D uImage; +uniform vec4 uColor; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec4 color2 = texture2D(uImage, vTexCoord2); +color.rgba *= color2.rgba; +gl_FragColor = color; +}`, + mask: `precision highp float; +uniform sampler2D uTexture; +uniform sampler2D uImage; +uniform vec4 uColor; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec4 color2 = texture2D(uImage, vTexCoord2); +color.a = color2.a; +gl_FragColor = color; +}` + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(p) { + var y = this.type + "_" + this.mode, v = this.fragmentSource[this.mode]; + return p.programCache.hasOwnProperty(y) || (p.programCache[y] = this.createProgram(p.context, v)), p.programCache[y]; + }, + applyToWebGL: function(p) { + var y = p.context, v = this.createTexture(p.filterBackend, this.image); + this.bindAdditionalTexture(y, v, y.TEXTURE1), this.callSuper("applyToWebGL", p), this.unbindAdditionalTexture(y, y.TEXTURE1); + }, + createTexture: function(p, y) { + return p.getCachedTexture(y.cacheKey, y._element); + }, + /** + * Calculate a transformMatrix to adapt the image to blend over + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + calculateMatrix: function() { + var p = this.image, y = p._element.width, v = p._element.height; + return [ + 1 / p.scaleX, + 0, + 0, + 0, + 1 / p.scaleY, + 0, + -p.left / y, + -p.top / v, + 1 + ]; + }, + /** + * Apply the Blend operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = p.filterBackend.resources, x = y.data, I = x.length, P = y.width, F = y.height, k, V, j, Y, X, Q, re, he, fe, be, Se = this.image, Me; + v.blendImage || (v.blendImage = l.util.createCanvasElement()), fe = v.blendImage, be = fe.getContext("2d"), fe.width !== P || fe.height !== F ? (fe.width = P, fe.height = F) : be.clearRect(0, 0, P, F), be.setTransform(Se.scaleX, 0, 0, Se.scaleY, Se.left, Se.top), be.drawImage(Se._element, 0, 0, P, F), Me = be.getImageData(0, 0, P, F).data; + for (var ke = 0; ke < I; ke += 4) + switch (X = x[ke], Q = x[ke + 1], re = x[ke + 2], he = x[ke + 3], k = Me[ke], V = Me[ke + 1], j = Me[ke + 2], Y = Me[ke + 3], this.mode) { + case "multiply": + x[ke] = X * k / 255, x[ke + 1] = Q * V / 255, x[ke + 2] = re * j / 255, x[ke + 3] = he * Y / 255; + break; + case "mask": + x[ke + 3] = Y; + break; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uTransformMatrix: p.getUniformLocation(y, "uTransformMatrix"), + uImage: p.getUniformLocation(y, "uImage") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + var v = this.calculateMatrix(); + p.uniform1i(y.uImage, 1), p.uniformMatrix3fv(y.uTransformMatrix, !1, v); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + image: this.image && this.image.toObject(), + mode: this.mode, + alpha: this.alpha + }; + } + } + ), l.Image.filters.BlendImage.fromObject = function(p, y) { + l.Image.fromObject(p.image, function(v) { + var x = l.util.object.clone(p); + x.image = v, y(new l.Image.filters.BlendImage(x)); + }); + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = Math.pow, h = Math.floor, p = Math.sqrt, y = Math.abs, v = Math.round, x = Math.sin, I = Math.ceil, P = l.Image.filters, F = l.util.createClass; + P.Resize = F( + P.BaseFilter, + /** @lends fabric.Image.filters.Resize.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Resize", + /** + * Resize type + * for webgl resizeType is just lanczos, for canvas2d can be: + * bilinear, hermite, sliceHack, lanczos. + * @param {String} resizeType + * @default + */ + resizeType: "hermite", + /** + * Scale factor for resizing, x axis + * @param {Number} scaleX + * @default + */ + scaleX: 1, + /** + * Scale factor for resizing, y axis + * @param {Number} scaleY + * @default + */ + scaleY: 1, + /** + * LanczosLobes parameter for lanczos filter, valid for resizeType lanczos + * @param {Number} lanczosLobes + * @default + */ + lanczosLobes: 3, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(k, V) { + return { + uDelta: k.getUniformLocation(V, "uDelta"), + uTaps: k.getUniformLocation(V, "uTaps") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(k, V) { + k.uniform2fv(V.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), k.uniform1fv(V.uTaps, this.taps); + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(k) { + var V = this.getFilterWindow(), j = this.type + "_" + V; + if (!k.programCache.hasOwnProperty(j)) { + var Y = this.generateShader(V); + k.programCache[j] = this.createProgram(k.context, Y); + } + return k.programCache[j]; + }, + getFilterWindow: function() { + var k = this.tempScale; + return Math.ceil(this.lanczosLobes / k); + }, + getTaps: function() { + for (var k = this.lanczosCreate(this.lanczosLobes), V = this.tempScale, j = this.getFilterWindow(), Y = new Array(j), X = 1; X <= j; X++) + Y[X - 1] = k(X * V); + return Y; + }, + /** + * Generate vertex and shader sources from the necessary steps numbers + * @param {Number} filterWindow + */ + generateShader: function(Y) { + for (var V = new Array(Y), j = this.fragmentSourceTOP, Y, X = 1; X <= Y; X++) + V[X - 1] = X + ".0 * uDelta"; + return j += "uniform float uTaps[" + Y + `]; +`, j += `void main() { +`, j += ` vec4 color = texture2D(uTexture, vTexCoord); +`, j += ` float sum = 1.0; +`, V.forEach(function(Q, re) { + j += " color += texture2D(uTexture, vTexCoord + " + Q + ") * uTaps[" + re + `]; +`, j += " color += texture2D(uTexture, vTexCoord - " + Q + ") * uTaps[" + re + `]; +`, j += " sum += 2.0 * uTaps[" + re + `]; +`; + }), j += ` gl_FragColor = color / sum; +`, j += "}", j; + }, + fragmentSourceTOP: `precision highp float; +uniform sampler2D uTexture; +uniform vec2 uDelta; +varying vec2 vTexCoord; +`, + /** + * Apply the resize filter to the image + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(k) { + k.webgl ? (k.passes++, this.width = k.sourceWidth, this.horizontal = !0, this.dW = Math.round(this.width * this.scaleX), this.dH = k.sourceHeight, this.tempScale = this.dW / this.width, this.taps = this.getTaps(), k.destinationWidth = this.dW, this._setupFrameBuffer(k), this.applyToWebGL(k), this._swapTextures(k), k.sourceWidth = k.destinationWidth, this.height = k.sourceHeight, this.horizontal = !1, this.dH = Math.round(this.height * this.scaleY), this.tempScale = this.dH / this.height, this.taps = this.getTaps(), k.destinationHeight = this.dH, this._setupFrameBuffer(k), this.applyToWebGL(k), this._swapTextures(k), k.sourceHeight = k.destinationHeight) : this.applyTo2d(k); + }, + isNeutralState: function() { + return this.scaleX === 1 && this.scaleY === 1; + }, + lanczosCreate: function(k) { + return function(V) { + if (V >= k || V <= -k) + return 0; + if (V < 11920929e-14 && V > -11920929e-14) + return 1; + V *= Math.PI; + var j = V / k; + return x(V) / V * x(j) / j; + }; + }, + /** + * Applies filter to canvas element + * @memberOf fabric.Image.filters.Resize.prototype + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} scaleX + * @param {Number} scaleY + */ + applyTo2d: function(k) { + var V = k.imageData, j = this.scaleX, Y = this.scaleY; + this.rcpScaleX = 1 / j, this.rcpScaleY = 1 / Y; + var X = V.width, Q = V.height, re = v(X * j), he = v(Q * Y), fe; + this.resizeType === "sliceHack" ? fe = this.sliceByTwo(k, X, Q, re, he) : this.resizeType === "hermite" ? fe = this.hermiteFastResize(k, X, Q, re, he) : this.resizeType === "bilinear" ? fe = this.bilinearFiltering(k, X, Q, re, he) : this.resizeType === "lanczos" && (fe = this.lanczosResize(k, X, Q, re, he)), k.imageData = fe; + }, + /** + * Filter sliceByTwo + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + sliceByTwo: function(k, V, j, Y, X) { + var Q = k.imageData, re = 0.5, he = !1, fe = !1, be = V * re, Se = j * re, Me = l.filterBackend.resources, ke, J, ce = 0, xe = 0, Pe = V, Oe = 0; + for (Me.sliceByTwo || (Me.sliceByTwo = document.createElement("canvas")), ke = Me.sliceByTwo, (ke.width < V * 1.5 || ke.height < j) && (ke.width = V * 1.5, ke.height = j), J = ke.getContext("2d"), J.clearRect(0, 0, V * 1.5, j), J.putImageData(Q, 0, 0), Y = h(Y), X = h(X); !he || !fe; ) + V = be, j = Se, Y < h(be * re) ? be = h(be * re) : (be = Y, he = !0), X < h(Se * re) ? Se = h(Se * re) : (Se = X, fe = !0), J.drawImage(ke, ce, xe, V, j, Pe, Oe, be, Se), ce = Pe, xe = Oe, Oe += Se; + return J.getImageData(ce, xe, Y, X); + }, + /** + * Filter lanczosResize + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + lanczosResize: function(k, V, j, Y, X) { + function Q(Ge) { + var je, et, Qe, tt, ft, Mt, kt, Tt, It, Nt, nt; + for (Oe.x = (Ge + 0.5) * Se, Re.x = h(Oe.x), je = 0; je < X; je++) { + for (Oe.y = (je + 0.5) * Me, Re.y = h(Oe.y), ft = 0, Mt = 0, kt = 0, Tt = 0, It = 0, et = Re.x - ce; et <= Re.x + ce; et++) + if (!(et < 0 || et >= V)) { + Nt = h(1e3 * y(et - Oe.x)), Pe[Nt] || (Pe[Nt] = {}); + for (var Ee = Re.y - xe; Ee <= Re.y + xe; Ee++) + Ee < 0 || Ee >= j || (nt = h(1e3 * y(Ee - Oe.y)), Pe[Nt][nt] || (Pe[Nt][nt] = be(p(c(Nt * ke, 2) + c(nt * J, 2)) / 1e3)), Qe = Pe[Nt][nt], Qe > 0 && (tt = (Ee * V + et) * 4, ft += Qe, Mt += Qe * re[tt], kt += Qe * re[tt + 1], Tt += Qe * re[tt + 2], It += Qe * re[tt + 3])); + } + tt = (je * Y + Ge) * 4, fe[tt] = Mt / ft, fe[tt + 1] = kt / ft, fe[tt + 2] = Tt / ft, fe[tt + 3] = It / ft; + } + return ++Ge < Y ? Q(Ge) : he; + } + var re = k.imageData.data, he = k.ctx.createImageData(Y, X), fe = he.data, be = this.lanczosCreate(this.lanczosLobes), Se = this.rcpScaleX, Me = this.rcpScaleY, ke = 2 / this.rcpScaleX, J = 2 / this.rcpScaleY, ce = I(Se * this.lanczosLobes / 2), xe = I(Me * this.lanczosLobes / 2), Pe = {}, Oe = {}, Re = {}; + return Q(0); + }, + /** + * bilinearFiltering + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + bilinearFiltering: function(k, V, j, Y, X) { + var Q, re, he, fe, be, Se, Me, ke, J, ce, xe, Pe, Oe = 0, Re, Ge = this.rcpScaleX, je = this.rcpScaleY, et = 4 * (V - 1), Qe = k.imageData, tt = Qe.data, ft = k.ctx.createImageData(Y, X), Mt = ft.data; + for (Me = 0; Me < X; Me++) + for (ke = 0; ke < Y; ke++) + for (be = h(Ge * ke), Se = h(je * Me), J = Ge * ke - be, ce = je * Me - Se, Re = 4 * (Se * V + be), xe = 0; xe < 4; xe++) + Q = tt[Re + xe], re = tt[Re + 4 + xe], he = tt[Re + et + xe], fe = tt[Re + et + 4 + xe], Pe = Q * (1 - J) * (1 - ce) + re * J * (1 - ce) + he * ce * (1 - J) + fe * J * ce, Mt[Oe++] = Pe; + return ft; + }, + /** + * hermiteFastResize + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + hermiteFastResize: function(k, V, j, Y, X) { + for (var Q = this.rcpScaleX, re = this.rcpScaleY, he = I(Q / 2), fe = I(re / 2), be = k.imageData, Se = be.data, Me = k.ctx.createImageData(Y, X), ke = Me.data, J = 0; J < X; J++) + for (var ce = 0; ce < Y; ce++) { + for (var xe = (ce + J * Y) * 4, Pe = 0, Oe = 0, Re = 0, Ge = 0, je = 0, et = 0, Qe = 0, tt = (J + 0.5) * re, ft = h(J * re); ft < (J + 1) * re; ft++) + for (var Mt = y(tt - (ft + 0.5)) / fe, kt = (ce + 0.5) * Q, Tt = Mt * Mt, It = h(ce * Q); It < (ce + 1) * Q; It++) { + var Nt = y(kt - (It + 0.5)) / he, nt = p(Tt + Nt * Nt); + nt > 1 && nt < -1 || (Pe = 2 * nt * nt * nt - 3 * nt * nt + 1, Pe > 0 && (Nt = 4 * (It + ft * V), Qe += Pe * Se[Nt + 3], Re += Pe, Se[Nt + 3] < 255 && (Pe = Pe * Se[Nt + 3] / 250), Ge += Pe * Se[Nt], je += Pe * Se[Nt + 1], et += Pe * Se[Nt + 2], Oe += Pe)); + } + ke[xe] = Ge / Oe, ke[xe + 1] = je / Oe, ke[xe + 2] = et / Oe, ke[xe + 3] = Qe / Re; + } + return Me; + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + scaleX: this.scaleX, + scaleY: this.scaleY, + resizeType: this.resizeType, + lanczosLobes: this.lanczosLobes + }; + } + } + ), l.Image.filters.Resize.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Contrast = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Contrast.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Contrast", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uContrast; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast)); +color.rgb = contrastF * (color.rgb - 0.5) + 0.5; +gl_FragColor = color; +}`, + /** + * contrast value, range from -1 to 1. + * @param {Number} contrast + * @default 0 + */ + contrast: 0, + mainParameter: "contrast", + /** + * Constructor + * @memberOf fabric.Image.filters.Contrast.prototype + * @param {Object} [options] Options object + * @param {Number} [options.contrast=0] Value to contrast the image up (-1...1) + */ + /** + * Apply the Contrast operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(p) { + if (this.contrast !== 0) { + var y = p.imageData, v, I, x = y.data, I = x.length, P = Math.floor(this.contrast * 255), F = 259 * (P + 255) / (255 * (259 - P)); + for (v = 0; v < I; v += 4) + x[v] = F * (x[v] - 128) + 128, x[v + 1] = F * (x[v + 1] - 128) + 128, x[v + 2] = F * (x[v + 2] - 128) + 128; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uContrast: p.getUniformLocation(y, "uContrast") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1f(y.uContrast, this.contrast); + } + } + ), l.Image.filters.Contrast.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Saturation = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Saturation.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Saturation", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uSaturation; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float rgMax = max(color.r, color.g); +float rgbMax = max(rgMax, color.b); +color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00; +color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00; +color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00; +gl_FragColor = color; +}`, + /** + * Saturation value, from -1 to 1. + * Increases/decreases the color saturation. + * A value of 0 has no effect. + * + * @param {Number} saturation + * @default + */ + saturation: 0, + mainParameter: "saturation", + /** + * Constructor + * @memberOf fabric.Image.filters.Saturate.prototype + * @param {Object} [options] Options object + * @param {Number} [options.saturate=0] Value to saturate the image (-1...1) + */ + /** + * Apply the Saturation operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + if (this.saturation !== 0) { + var y = p.imageData, v = y.data, x = v.length, I = -this.saturation, P, F; + for (P = 0; P < x; P += 4) + F = Math.max(v[P], v[P + 1], v[P + 2]), v[P] += F !== v[P] ? (F - v[P]) * I : 0, v[P + 1] += F !== v[P + 1] ? (F - v[P + 1]) * I : 0, v[P + 2] += F !== v[P + 2] ? (F - v[P + 2]) * I : 0; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uSaturation: p.getUniformLocation(y, "uSaturation") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1f(y.uSaturation, -this.saturation); + } + } + ), l.Image.filters.Saturation.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Vibrance = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Vibrance.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Vibrance", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uVibrance; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float max = max(color.r, max(color.g, color.b)); +float avg = (color.r + color.g + color.b) / 3.0; +float amt = (abs(max - avg) * 2.0) * uVibrance; +color.r += max != color.r ? (max - color.r) * amt : 0.00; +color.g += max != color.g ? (max - color.g) * amt : 0.00; +color.b += max != color.b ? (max - color.b) * amt : 0.00; +gl_FragColor = color; +}`, + /** + * Vibrance value, from -1 to 1. + * Increases/decreases the saturation of more muted colors with less effect on saturated colors. + * A value of 0 has no effect. + * + * @param {Number} vibrance + * @default + */ + vibrance: 0, + mainParameter: "vibrance", + /** + * Constructor + * @memberOf fabric.Image.filters.Vibrance.prototype + * @param {Object} [options] Options object + * @param {Number} [options.vibrance=0] Vibrance value for the image (between -1 and 1) + */ + /** + * Apply the Vibrance operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(p) { + if (this.vibrance !== 0) { + var y = p.imageData, v = y.data, x = v.length, I = -this.vibrance, P, F, k, V; + for (P = 0; P < x; P += 4) + F = Math.max(v[P], v[P + 1], v[P + 2]), k = (v[P] + v[P + 1] + v[P + 2]) / 3, V = Math.abs(F - k) * 2 / 255 * I, v[P] += F !== v[P] ? (F - v[P]) * V : 0, v[P + 1] += F !== v[P + 1] ? (F - v[P + 1]) * V : 0, v[P + 2] += F !== v[P + 2] ? (F - v[P + 2]) * V : 0; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uVibrance: p.getUniformLocation(y, "uVibrance") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform1f(y.uVibrance, -this.vibrance); + } + } + ), l.Image.filters.Vibrance.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Blur = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Blur.prototype */ + { + type: "Blur", + /* + 'gl_FragColor = vec4(0.0);', + 'gl_FragColor += texture2D(texture, vTexCoord + -7 * uDelta)*0.0044299121055113265;', + 'gl_FragColor += texture2D(texture, vTexCoord + -6 * uDelta)*0.00895781211794;', + 'gl_FragColor += texture2D(texture, vTexCoord + -5 * uDelta)*0.0215963866053;', + 'gl_FragColor += texture2D(texture, vTexCoord + -4 * uDelta)*0.0443683338718;', + 'gl_FragColor += texture2D(texture, vTexCoord + -3 * uDelta)*0.0776744219933;', + 'gl_FragColor += texture2D(texture, vTexCoord + -2 * uDelta)*0.115876621105;', + 'gl_FragColor += texture2D(texture, vTexCoord + -1 * uDelta)*0.147308056121;', + 'gl_FragColor += texture2D(texture, vTexCoord )*0.159576912161;', + 'gl_FragColor += texture2D(texture, vTexCoord + 1 * uDelta)*0.147308056121;', + 'gl_FragColor += texture2D(texture, vTexCoord + 2 * uDelta)*0.115876621105;', + 'gl_FragColor += texture2D(texture, vTexCoord + 3 * uDelta)*0.0776744219933;', + 'gl_FragColor += texture2D(texture, vTexCoord + 4 * uDelta)*0.0443683338718;', + 'gl_FragColor += texture2D(texture, vTexCoord + 5 * uDelta)*0.0215963866053;', + 'gl_FragColor += texture2D(texture, vTexCoord + 6 * uDelta)*0.00895781211794;', + 'gl_FragColor += texture2D(texture, vTexCoord + 7 * uDelta)*0.0044299121055113265;', + */ + /* eslint-disable max-len */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec2 uDelta; +varying vec2 vTexCoord; +const float nSamples = 15.0; +vec3 v3offset = vec3(12.9898, 78.233, 151.7182); +float random(vec3 scale) { +return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453); +} +void main() { +vec4 color = vec4(0.0); +float total = 0.0; +float offset = random(v3offset); +for (float t = -nSamples; t <= nSamples; t++) { +float percent = (t + offset - 0.5) / nSamples; +float weight = 1.0 - abs(percent); +color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight; +total += weight; +} +gl_FragColor = color / total; +}`, + /* eslint-enable max-len */ + /** + * blur value, in percentage of image dimensions. + * specific to keep the image blur constant at different resolutions + * range between 0 and 1. + * @type Number + * @default + */ + blur: 0, + mainParameter: "blur", + applyTo: function(p) { + p.webgl ? (this.aspectRatio = p.sourceWidth / p.sourceHeight, p.passes++, this._setupFrameBuffer(p), this.horizontal = !0, this.applyToWebGL(p), this._swapTextures(p), this._setupFrameBuffer(p), this.horizontal = !1, this.applyToWebGL(p), this._swapTextures(p)) : this.applyTo2d(p); + }, + applyTo2d: function(p) { + p.imageData = this.simpleBlur(p); + }, + simpleBlur: function(p) { + var y = p.filterBackend.resources, v, x, I = p.imageData.width, P = p.imageData.height; + y.blurLayer1 || (y.blurLayer1 = l.util.createCanvasElement(), y.blurLayer2 = l.util.createCanvasElement()), v = y.blurLayer1, x = y.blurLayer2, (v.width !== I || v.height !== P) && (x.width = v.width = I, x.height = v.height = P); + var F = v.getContext("2d"), k = x.getContext("2d"), V = 15, j, Y, X, Q, re = this.blur * 0.06 * 0.5; + for (F.putImageData(p.imageData, 0, 0), k.clearRect(0, 0, I, P), Q = -V; Q <= V; Q++) + j = (Math.random() - 0.5) / 4, Y = Q / V, X = re * Y * I + j, k.globalAlpha = 1 - Math.abs(Y), k.drawImage(v, X, j), F.drawImage(x, 0, 0), k.globalAlpha = 1, k.clearRect(0, 0, x.width, x.height); + for (Q = -V; Q <= V; Q++) + j = (Math.random() - 0.5) / 4, Y = Q / V, X = re * Y * P + j, k.globalAlpha = 1 - Math.abs(Y), k.drawImage(v, j, X), F.drawImage(x, 0, 0), k.globalAlpha = 1, k.clearRect(0, 0, x.width, x.height); + p.ctx.drawImage(v, 0, 0); + var he = p.ctx.getImageData(0, 0, v.width, v.height); + return F.globalAlpha = 1, F.clearRect(0, 0, v.width, v.height), he; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + delta: p.getUniformLocation(y, "uDelta") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + var v = this.chooseRightDelta(); + p.uniform2fv(y.delta, v); + }, + /** + * choose right value of image percentage to blur with + * @returns {Array} a numeric array with delta values + */ + chooseRightDelta: function() { + var p = 1, y = [0, 0], v; + return this.horizontal ? this.aspectRatio > 1 && (p = 1 / this.aspectRatio) : this.aspectRatio < 1 && (p = this.aspectRatio), v = p * this.blur * 0.12, this.horizontal ? y[0] = v : y[1] = v, y; + } + } + ), c.Blur.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Gamma = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Gamma.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Gamma", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec3 uGamma; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec3 correction = (1.0 / uGamma); +color.r = pow(color.r, correction.r); +color.g = pow(color.g, correction.g); +color.b = pow(color.b, correction.b); +gl_FragColor = color; +gl_FragColor.rgb *= color.a; +}`, + /** + * Gamma array value, from 0.01 to 2.2. + * @param {Array} gamma + * @default + */ + gamma: [1, 1, 1], + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "gamma", + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(p) { + this.gamma = [1, 1, 1], c.BaseFilter.prototype.initialize.call(this, p); + }, + /** + * Apply the Gamma operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(p) { + var y = p.imageData, v = y.data, x = this.gamma, I = v.length, P = 1 / x[0], F = 1 / x[1], k = 1 / x[2], V; + for (this.rVals || (this.rVals = new Uint8Array(256), this.gVals = new Uint8Array(256), this.bVals = new Uint8Array(256)), V = 0, I = 256; V < I; V++) + this.rVals[V] = Math.pow(V / 255, P) * 255, this.gVals[V] = Math.pow(V / 255, F) * 255, this.bVals[V] = Math.pow(V / 255, k) * 255; + for (V = 0, I = v.length; V < I; V += 4) + v[V] = this.rVals[v[V]], v[V + 1] = this.gVals[v[V + 1]], v[V + 2] = this.bVals[v[V + 2]]; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(p, y) { + return { + uGamma: p.getUniformLocation(y, "uGamma") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(p, y) { + p.uniform3fv(y.uGamma, this.gamma); + } + } + ), l.Image.filters.Gamma.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.Composed = h( + c.BaseFilter, + /** @lends fabric.Image.filters.Composed.prototype */ + { + type: "Composed", + /** + * A non sparse array of filters to apply + */ + subFilters: [], + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(p) { + this.callSuper("initialize", p), this.subFilters = this.subFilters.slice(0); + }, + /** + * Apply this container's filters to the input image provided. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be applied. + */ + applyTo: function(p) { + p.passes += this.subFilters.length - 1, this.subFilters.forEach(function(y) { + y.applyTo(p); + }); + }, + /** + * Serialize this filter into JSON. + * + * @returns {Object} A JSON representation of this filter. + */ + toObject: function() { + return l.util.object.extend(this.callSuper("toObject"), { + subFilters: this.subFilters.map(function(p) { + return p.toObject(); + }) + }); + }, + isNeutralState: function() { + return !this.subFilters.some(function(p) { + return !p.isNeutralState(); + }); + } + } + ), l.Image.filters.Composed.fromObject = function(p, y) { + var v = p.subFilters || [], x = v.map(function(P) { + return new l.Image.filters[P.type](P); + }), I = new l.Image.filters.Composed({ subFilters: x }); + return y && y(I), I; + }; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.Image.filters, h = l.util.createClass; + c.HueRotation = h( + c.ColorMatrix, + /** @lends fabric.Image.filters.HueRotation.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "HueRotation", + /** + * HueRotation value, from -1 to 1. + * the unit is radians + * @param {Number} myParameter + * @default + */ + rotation: 0, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "rotation", + calculateMatrix: function() { + var p = this.rotation * Math.PI, y = l.util.cos(p), v = l.util.sin(p), x = 1 / 3, I = Math.sqrt(x) * v, P = 1 - y; + this.matrix = [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], this.matrix[0] = y + P / 3, this.matrix[1] = x * P - I, this.matrix[2] = x * P + I, this.matrix[5] = x * P + I, this.matrix[6] = y + x * P, this.matrix[7] = x * P - I, this.matrix[10] = x * P - I, this.matrix[11] = x * P + I, this.matrix[12] = y + x * P; + }, + /** + * HueRotation isNeutralState implementation + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * @param {Object} options + **/ + isNeutralState: function(p) { + return this.calculateMatrix(), c.BaseFilter.prototype.isNeutralState.call(this, p); + }, + /** + * Apply this filter to the input image data provided. + * + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(p) { + this.calculateMatrix(), c.BaseFilter.prototype.applyTo.call(this, p); + } + } + ), l.Image.filters.HueRotation.fromObject = l.Image.filters.BaseFilter.fromObject; + }(t), function(a) { + var l = a.fabric || (a.fabric = {}), c = l.util.object.clone; + if (l.Text) { + l.warn("fabric.Text is already defined"); + return; + } + var h = "fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" "); + l.Text = l.util.createClass( + l.Object, + /** @lends fabric.Text.prototype */ + { + /** + * Properties which when set cause object to change dimensions + * @type Array + * @private + */ + _dimensionAffectingProps: [ + "fontSize", + "fontWeight", + "fontFamily", + "fontStyle", + "lineHeight", + "text", + "charSpacing", + "textAlign", + "styles", + "path", + "pathStartOffset", + "pathSide", + "pathAlign" + ], + /** + * @private + */ + _reNewline: /\r?\n/, + /** + * Use this regular expression to filter for whitespaces that is not a new line. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reSpacesAndTabs: /[ \t\r]/g, + /** + * Use this regular expression to filter for whitespace that is not a new line. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reSpaceAndTab: /[ \t\r]/, + /** + * Use this regular expression to filter consecutive groups of non spaces. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reWords: /\S+/g, + /** + * Type of an object + * @type String + * @default + */ + type: "text", + /** + * Font size (in pixels) + * @type Number + * @default + */ + fontSize: 40, + /** + * Font weight (e.g. bold, normal, 400, 600, 800) + * @type {(Number|String)} + * @default + */ + fontWeight: "normal", + /** + * Font family + * @type String + * @default + */ + fontFamily: "Times New Roman", + /** + * Text decoration underline. + * @type Boolean + * @default + */ + underline: !1, + /** + * Text decoration overline. + * @type Boolean + * @default + */ + overline: !1, + /** + * Text decoration linethrough. + * @type Boolean + * @default + */ + linethrough: !1, + /** + * Text alignment. Possible values: "left", "center", "right", "justify", + * "justify-left", "justify-center" or "justify-right". + * @type String + * @default + */ + textAlign: "left", + /** + * Font style . Possible values: "", "normal", "italic" or "oblique". + * @type String + * @default + */ + fontStyle: "normal", + /** + * Line height + * @type Number + * @default + */ + lineHeight: 1.16, + /** + * Superscript schema object (minimum overlap) + * @type {Object} + * @default + */ + superscript: { + size: 0.6, + // fontSize factor + baseline: -0.35 + // baseline-shift factor (upwards) + }, + /** + * Subscript schema object (minimum overlap) + * @type {Object} + * @default + */ + subscript: { + size: 0.6, + // fontSize factor + baseline: 0.11 + // baseline-shift factor (downwards) + }, + /** + * Background color of text lines + * @type String + * @default + */ + textBackgroundColor: "", + /** + * List of properties to consider when checking if + * state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: l.Object.prototype.stateProperties.concat(h), + /** + * List of properties to consider when checking if cache needs refresh + * @type Array + */ + cacheProperties: l.Object.prototype.cacheProperties.concat(h), + /** + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note: This property was named "strokeStyle" until v1.1.6 + * @type String + * @default + */ + stroke: null, + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property was named "textShadow" (String) until v1.2.11 + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * fabric.Path that the text should follow. + * since 4.6.0 the path will be drawn automatically. + * if you want to make the path visible, give it a stroke and strokeWidth or fill value + * if you want it to be hidden, assign visible = false to the path. + * This feature is in BETA, and SVG import/export is not yet supported. + * @type fabric.Path + * @example + * var textPath = new fabric.Text('Text on a path', { + * top: 150, + * left: 150, + * textAlign: 'center', + * charSpacing: -50, + * path: new fabric.Path('M 0 0 C 50 -100 150 -100 200 0', { + * strokeWidth: 1, + * visible: false + * }), + * pathSide: 'left', + * pathStartOffset: 0 + * }); + * @default + */ + path: null, + /** + * Offset amount for text path starting position + * Only used when text has a path + * @type Number + * @default + */ + pathStartOffset: 0, + /** + * Which side of the path the text should be drawn on. + * Only used when text has a path + * @type {String} 'left|right' + * @default + */ + pathSide: "left", + /** + * How text is aligned to the path. This property determines + * the perpendicular position of each character relative to the path. + * (one of "baseline", "center", "ascender", "descender") + * This feature is in BETA, and its behavior may change + * @type String + * @default + */ + pathAlign: "baseline", + /** + * @private + */ + _fontSizeFraction: 0.222, + /** + * @private + */ + offsets: { + underline: 0.1, + linethrough: -0.315, + overline: -0.88 + }, + /** + * Text Line proportion to font Size (in pixels) + * @type Number + * @default + */ + _fontSizeMult: 1.13, + /** + * additional space between characters + * expressed in thousands of em unit + * @type Number + * @default + */ + charSpacing: 0, + /** + * Object containing character styles - top-level properties -> line numbers, + * 2nd-level properties - character numbers + * @type Object + * @default + */ + styles: null, + /** + * Reference to a context to measure text char or couple of chars + * the cacheContext of the canvas will be used or a freshly created one if the object is not on canvas + * once created it will be referenced on fabric._measuringContext to avoid creating a canvas for every + * text object created. + * @type {CanvasRenderingContext2D} + * @default + */ + _measuringContext: null, + /** + * Baseline shift, styles only, keep at 0 for the main text object + * @type {Number} + * @default + */ + deltaY: 0, + /** + * WARNING: EXPERIMENTAL. NOT SUPPORTED YET + * determine the direction of the text. + * This has to be set manually together with textAlign and originX for proper + * experience. + * some interesting link for the future + * https://www.w3.org/International/questions/qa-bidi-unicode-controls + * @since 4.5.0 + * @type {String} 'ltr|rtl' + * @default + */ + direction: "ltr", + /** + * Array of properties that define a style unit (of 'styles'). + * @type {Array} + * @default + */ + _styleProperties: [ + "stroke", + "strokeWidth", + "fill", + "fontFamily", + "fontSize", + "fontWeight", + "fontStyle", + "underline", + "overline", + "linethrough", + "deltaY", + "textBackgroundColor" + ], + /** + * contains characters bounding boxes + */ + __charBounds: [], + /** + * use this size when measuring text. To avoid IE11 rounding errors + * @type {Number} + * @default + * @readonly + * @private + */ + CACHE_FONT_SIZE: 400, + /** + * contains the min text width to avoid getting 0 + * @type {Number} + * @default + */ + MIN_TEXT_WIDTH: 2, + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.Text} thisArg + */ + initialize: function(p, y) { + this.styles = y ? y.styles || {} : {}, this.text = p, this.__skipDimension = !0, this.callSuper("initialize", y), this.path && this.setPathInfo(), this.__skipDimension = !1, this.initDimensions(), this.setCoords(), this.setupState({ propertySet: "_dimensionAffectingProps" }); + }, + /** + * If text has a path, it will add the extra information needed + * for path and text calculations + * @return {fabric.Text} thisArg + */ + setPathInfo: function() { + var p = this.path; + p && (p.segmentsInfo = l.util.getPathSegmentsInfo(p.path)); + }, + /** + * Return a context for measurement of text string. + * if created it gets stored for reuse + * this is for internal use, please do not use it + * @private + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.Text} thisArg + */ + getMeasuringContext: function() { + return l._measuringContext || (l._measuringContext = this.canvas && this.canvas.contextCache || l.util.createCanvasElement().getContext("2d")), l._measuringContext; + }, + /** + * @private + * Divides text into lines of text and lines of graphemes. + */ + _splitText: function() { + var p = this._splitTextIntoLines(this.text); + return this.textLines = p.lines, this._textLines = p.graphemeLines, this._unwrappedTextLines = p._unwrappedLines, this._text = p.graphemeText, p; + }, + /** + * Initialize or update text dimensions. + * Updates this.width and this.height with the proper values. + * Does not return dimensions. + */ + initDimensions: function() { + this.__skipDimension || (this._splitText(), this._clearCache(), this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.saveState({ propertySet: "_dimensionAffectingProps" })); + }, + /** + * Enlarge space boxes and shift the others + */ + enlargeSpaces: function() { + for (var p, y, v, x, I, P, F, k = 0, V = this._textLines.length; k < V; k++) + if (!(this.textAlign !== "justify" && (k === V - 1 || this.isEndOfWrapping(k))) && (x = 0, I = this._textLines[k], y = this.getLineWidth(k), y < this.width && (F = this.textLines[k].match(this._reSpacesAndTabs)))) { + v = F.length, p = (this.width - y) / v; + for (var j = 0, Y = I.length; j <= Y; j++) + P = this.__charBounds[k][j], this._reSpaceAndTab.test(I[j]) ? (P.width += p, P.kernedWidth += p, P.left += x, x += p) : P.left += x; + } + }, + /** + * Detect if the text line is ended with an hard break + * text and itext do not have wrapping, return false + * @return {Boolean} + */ + isEndOfWrapping: function(p) { + return p === this._textLines.length - 1; + }, + /** + * Detect if a line has a linebreak and so we need to account for it when moving + * and counting style. + * It return always for text and Itext. + * @return Number + */ + missingNewlineOffset: function() { + return 1; + }, + /** + * Returns string representation of an instance + * @return {String} String representation of text object + */ + toString: function() { + return "#'; + }, + /** + * Return the dimension and the zoom level needed to create a cache canvas + * big enough to host the object to be cached. + * @private + * @param {Object} dim.x width of object to be cached + * @param {Object} dim.y height of object to be cached + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _getCacheCanvasDimensions: function() { + var p = this.callSuper("_getCacheCanvasDimensions"), y = this.fontSize; + return p.width += y * p.zoomX, p.height += y * p.zoomY, p; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(p) { + var y = this.path; + y && !y.isNotVisible() && y._render(p), this._setTextStyles(p), this._renderTextLinesBackground(p), this._renderTextDecoration(p, "underline"), this._renderText(p), this._renderTextDecoration(p, "overline"), this._renderTextDecoration(p, "linethrough"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderText: function(p) { + this.paintFirst === "stroke" ? (this._renderTextStroke(p), this._renderTextFill(p)) : (this._renderTextFill(p), this._renderTextStroke(p)); + }, + /** + * Set the font parameter of the context with the object properties or with charStyle + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [charStyle] object with font style properties + * @param {String} [charStyle.fontFamily] Font Family + * @param {Number} [charStyle.fontSize] Font size in pixels. ( without px suffix ) + * @param {String} [charStyle.fontWeight] Font weight + * @param {String} [charStyle.fontStyle] Font style (italic|normal) + */ + _setTextStyles: function(p, y, v) { + if (p.textBaseline = "alphabetical", this.path) + switch (this.pathAlign) { + case "center": + p.textBaseline = "middle"; + break; + case "ascender": + p.textBaseline = "top"; + break; + case "descender": + p.textBaseline = "bottom"; + break; + } + p.font = this._getFontDeclaration(y, v); + }, + /** + * calculate and return the text Width measuring each line. + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @return {Number} Maximum width of fabric.Text object + */ + calcTextWidth: function() { + for (var p = this.getLineWidth(0), y = 1, v = this._textLines.length; y < v; y++) { + var x = this.getLineWidth(y); + x > p && (p = x); + } + return p; + }, + /** + * @private + * @param {String} method Method name ("fillText" or "strokeText") + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {String} line Text to render + * @param {Number} left Left position of text + * @param {Number} top Top position of text + * @param {Number} lineIndex Index of a line in a text + */ + _renderTextLine: function(p, y, v, x, I, P) { + this._renderChars(p, y, v, x, I, P); + }, + /** + * Renders the text background for lines, taking care of style + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextLinesBackground: function(p) { + if (!(!this.textBackgroundColor && !this.styleHas("textBackgroundColor"))) { + for (var y, v, x = p.fillStyle, I, P, F = this._getLeftOffset(), k = this._getTopOffset(), V = 0, j = 0, Y, X, Q = this.path, re, he = 0, fe = this._textLines.length; he < fe; he++) { + if (y = this.getHeightOfLine(he), !this.textBackgroundColor && !this.styleHas("textBackgroundColor", he)) { + k += y; + continue; + } + I = this._textLines[he], v = this._getLineLeftOffset(he), j = 0, V = 0, P = this.getValueOfPropertyAt(he, 0, "textBackgroundColor"); + for (var be = 0, Se = I.length; be < Se; be++) + Y = this.__charBounds[he][be], X = this.getValueOfPropertyAt(he, be, "textBackgroundColor"), Q ? (p.save(), p.translate(Y.renderLeft, Y.renderTop), p.rotate(Y.angle), p.fillStyle = X, X && p.fillRect( + -Y.width / 2, + -y / this.lineHeight * (1 - this._fontSizeFraction), + Y.width, + y / this.lineHeight + ), p.restore()) : X !== P ? (re = F + v + V, this.direction === "rtl" && (re = this.width - re - j), p.fillStyle = P, P && p.fillRect( + re, + k, + j, + y / this.lineHeight + ), V = Y.left, j = Y.width, P = X) : j += Y.kernedWidth; + X && !Q && (re = F + v + V, this.direction === "rtl" && (re = this.width - re - j), p.fillStyle = X, p.fillRect( + re, + k, + j, + y / this.lineHeight + )), k += y; + } + p.fillStyle = x, this._removeShadow(p); + } + }, + /** + * @private + * @param {Object} decl style declaration for cache + * @param {String} decl.fontFamily fontFamily + * @param {String} decl.fontStyle fontStyle + * @param {String} decl.fontWeight fontWeight + * @return {Object} reference to cache + */ + getFontCache: function(p) { + var y = p.fontFamily.toLowerCase(); + l.charWidthsCache[y] || (l.charWidthsCache[y] = {}); + var v = l.charWidthsCache[y], x = p.fontStyle.toLowerCase() + "_" + (p.fontWeight + "").toLowerCase(); + return v[x] || (v[x] = {}), v[x]; + }, + /** + * measure and return the width of a single character. + * possibly overridden to accommodate different measure logic or + * to hook some external lib for character measurement + * @private + * @param {String} _char, char to be measured + * @param {Object} charStyle style of char to be measured + * @param {String} [previousChar] previous char + * @param {Object} [prevCharStyle] style of previous char + */ + _measureChar: function(p, y, v, x) { + var I = this.getFontCache(y), P = this._getFontDeclaration(y), F = this._getFontDeclaration(x), k = v + p, V = P === F, j, Y, X, Q = y.fontSize / this.CACHE_FONT_SIZE, re; + if (v && I[v] !== void 0 && (X = I[v]), I[p] !== void 0 && (re = j = I[p]), V && I[k] !== void 0 && (Y = I[k], re = Y - X), j === void 0 || X === void 0 || Y === void 0) { + var he = this.getMeasuringContext(); + this._setTextStyles(he, y, !0); + } + return j === void 0 && (re = j = he.measureText(p).width, I[p] = j), X === void 0 && V && v && (X = he.measureText(v).width, I[v] = X), V && Y === void 0 && (Y = he.measureText(k).width, I[k] = Y, re = Y - X), { width: j * Q, kernedWidth: re * Q }; + }, + /** + * Computes height of character at given position + * @param {Number} line the line index number + * @param {Number} _char the character index number + * @return {Number} fontSize of the character + */ + getHeightOfChar: function(p, y) { + return this.getValueOfPropertyAt(p, y, "fontSize"); + }, + /** + * measure a text line measuring all characters. + * @param {Number} lineIndex line number + * @return {Number} Line width + */ + measureLine: function(p) { + var y = this._measureLine(p); + return this.charSpacing !== 0 && (y.width -= this._getWidthOfCharSpacing()), y.width < 0 && (y.width = 0), y; + }, + /** + * measure every grapheme of a line, populating __charBounds + * @param {Number} lineIndex + * @return {Object} object.width total width of characters + * @return {Object} object.widthOfSpaces length of chars that match this._reSpacesAndTabs + */ + _measureLine: function(p) { + var y = 0, v, x, I = this._textLines[p], P, F, k = 0, V = new Array(I.length), j = 0, Y, X, Q = this.path, re = this.pathSide === "right"; + for (this.__charBounds[p] = V, v = 0; v < I.length; v++) + x = I[v], F = this._getGraphemeBox(x, p, v, P), V[v] = F, y += F.kernedWidth, P = x; + if (V[v] = { + left: F ? F.left + F.width : 0, + width: 0, + kernedWidth: 0, + height: this.fontSize + }, Q) { + switch (X = Q.segmentsInfo[Q.segmentsInfo.length - 1].length, Y = l.util.getPointOnPath(Q.path, 0, Q.segmentsInfo), Y.x += Q.pathOffset.x, Y.y += Q.pathOffset.y, this.textAlign) { + case "left": + j = re ? X - y : 0; + break; + case "center": + j = (X - y) / 2; + break; + case "right": + j = re ? 0 : X - y; + break; + } + for (j += this.pathStartOffset * (re ? -1 : 1), v = re ? I.length - 1 : 0; re ? v >= 0 : v < I.length; re ? v-- : v++) + F = V[v], j > X ? j %= X : j < 0 && (j += X), this._setGraphemeOnPath(j, F, Y), j += F.kernedWidth; + } + return { width: y, numOfSpaces: k }; + }, + /** + * Calculate the angle and the left,top position of the char that follow a path. + * It appends it to graphemeInfo to be reused later at rendering + * @private + * @param {Number} positionInPath to be measured + * @param {Object} graphemeInfo current grapheme box information + * @param {Object} startingPoint position of the point + */ + _setGraphemeOnPath: function(p, y, v) { + var x = p + y.kernedWidth / 2, I = this.path, P = l.util.getPointOnPath(I.path, x, I.segmentsInfo); + y.renderLeft = P.x - v.x, y.renderTop = P.y - v.y, y.angle = P.angle + (this.pathSide === "right" ? Math.PI : 0); + }, + /** + * Measure and return the info of a single grapheme. + * needs the the info of previous graphemes already filled + * @private + * @param {String} grapheme to be measured + * @param {Number} lineIndex index of the line where the char is + * @param {Number} charIndex position in the line + * @param {String} [prevGrapheme] character preceding the one to be measured + */ + _getGraphemeBox: function(p, y, v, x, I) { + var P = this.getCompleteStyleDeclaration(y, v), F = x ? this.getCompleteStyleDeclaration(y, v - 1) : {}, k = this._measureChar(p, P, x, F), V = k.kernedWidth, j = k.width, Y; + this.charSpacing !== 0 && (Y = this._getWidthOfCharSpacing(), j += Y, V += Y); + var X = { + width: j, + left: 0, + height: P.fontSize, + kernedWidth: V, + deltaY: P.deltaY + }; + if (v > 0 && !I) { + var Q = this.__charBounds[y][v - 1]; + X.left = Q.left + Q.width + k.kernedWidth - k.width; + } + return X; + }, + /** + * Calculate height of line at 'lineIndex' + * @param {Number} lineIndex index of line to calculate + * @return {Number} + */ + getHeightOfLine: function(p) { + if (this.__lineHeights[p]) + return this.__lineHeights[p]; + for (var y = this._textLines[p], v = this.getHeightOfChar(p, 0), x = 1, I = y.length; x < I; x++) + v = Math.max(this.getHeightOfChar(p, x), v); + return this.__lineHeights[p] = v * this.lineHeight * this._fontSizeMult; + }, + /** + * Calculate text box height + */ + calcTextHeight: function() { + for (var p, y = 0, v = 0, x = this._textLines.length; v < x; v++) + p = this.getHeightOfLine(v), y += v === x - 1 ? p / this.lineHeight : p; + return y; + }, + /** + * @private + * @return {Number} Left offset + */ + _getLeftOffset: function() { + return this.direction === "ltr" ? -this.width / 2 : this.width / 2; + }, + /** + * @private + * @return {Number} Top offset + */ + _getTopOffset: function() { + return -this.height / 2; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {String} method Method name ("fillText" or "strokeText") + */ + _renderTextCommon: function(p, y) { + p.save(); + for (var v = 0, x = this._getLeftOffset(), I = this._getTopOffset(), P = 0, F = this._textLines.length; P < F; P++) { + var k = this.getHeightOfLine(P), V = k / this.lineHeight, j = this._getLineLeftOffset(P); + this._renderTextLine( + y, + p, + this._textLines[P], + x + j, + I + v + V, + P + ), v += k; + } + p.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextFill: function(p) { + !this.fill && !this.styleHas("fill") || this._renderTextCommon(p, "fillText"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextStroke: function(p) { + (!this.stroke || this.strokeWidth === 0) && this.isEmptyStyles() || (this.shadow && !this.shadow.affectStroke && this._removeShadow(p), p.save(), this._setLineDash(p, this.strokeDashArray), p.beginPath(), this._renderTextCommon(p, "strokeText"), p.closePath(), p.restore()); + }, + /** + * @private + * @param {String} method fillText or strokeText. + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Array} line Content of the line, splitted in an array by grapheme + * @param {Number} left + * @param {Number} top + * @param {Number} lineIndex + */ + _renderChars: function(p, y, v, x, I, P) { + var F = this.getHeightOfLine(P), k = this.textAlign.indexOf("justify") !== -1, V, j, Y = "", X, Q = 0, re, he = this.path, fe = !k && this.charSpacing === 0 && this.isEmptyStyles(P) && !he, be = this.direction === "ltr", Se = this.direction === "ltr" ? 1 : -1, Me, ke = y.canvas.getAttribute("dir"); + if (y.save(), ke !== this.direction && (y.canvas.setAttribute("dir", be ? "ltr" : "rtl"), y.direction = be ? "ltr" : "rtl", y.textAlign = be ? "left" : "right"), I -= F * this._fontSizeFraction / this.lineHeight, fe) { + this._renderChar(p, y, P, 0, v.join(""), x, I, F), y.restore(); + return; + } + for (var J = 0, ce = v.length - 1; J <= ce; J++) + re = J === ce || this.charSpacing || he, Y += v[J], X = this.__charBounds[P][J], Q === 0 ? (x += Se * (X.kernedWidth - X.width), Q += X.width) : Q += X.kernedWidth, k && !re && this._reSpaceAndTab.test(v[J]) && (re = !0), re || (V = V || this.getCompleteStyleDeclaration(P, J), j = this.getCompleteStyleDeclaration(P, J + 1), re = l.util.hasStyleChanged(V, j, !1)), re && (he ? (y.save(), y.translate(X.renderLeft, X.renderTop), y.rotate(X.angle), this._renderChar(p, y, P, J, Y, -Q / 2, 0, F), y.restore()) : (Me = x, this._renderChar(p, y, P, J, Y, Me, I, F)), Y = "", V = j, x += Se * Q, Q = 0); + y.restore(); + }, + /** + * This function try to patch the missing gradientTransform on canvas gradients. + * transforming a context to transform the gradient, is going to transform the stroke too. + * we want to transform the gradient but not the stroke operation, so we create + * a transformed gradient on a pattern and then we use the pattern instead of the gradient. + * this method has drawbacks: is slow, is in low resolution, needs a patch for when the size + * is limited. + * @private + * @param {fabric.Gradient} filler a fabric gradient instance + * @return {CanvasPattern} a pattern to use as fill/stroke style + */ + _applyPatternGradientTransformText: function(p) { + var y = l.util.createCanvasElement(), v, x = this.width + this.strokeWidth, I = this.height + this.strokeWidth; + return y.width = x, y.height = I, v = y.getContext("2d"), v.beginPath(), v.moveTo(0, 0), v.lineTo(x, 0), v.lineTo(x, I), v.lineTo(0, I), v.closePath(), v.translate(x / 2, I / 2), v.fillStyle = p.toLive(v), this._applyPatternGradientTransform(v, p), v.fill(), v.createPattern(y, "no-repeat"); + }, + handleFiller: function(p, y, v) { + var x, I; + return v.toLive ? v.gradientUnits === "percentage" || v.gradientTransform || v.patternTransform ? (x = -this.width / 2, I = -this.height / 2, p.translate(x, I), p[y] = this._applyPatternGradientTransformText(v), { offsetX: x, offsetY: I }) : (p[y] = v.toLive(p, this), this._applyPatternGradientTransform(p, v)) : (p[y] = v, { offsetX: 0, offsetY: 0 }); + }, + _setStrokeStyles: function(p, y) { + return p.lineWidth = y.strokeWidth, p.lineCap = this.strokeLineCap, p.lineDashOffset = this.strokeDashOffset, p.lineJoin = this.strokeLineJoin, p.miterLimit = this.strokeMiterLimit, this.handleFiller(p, "strokeStyle", y.stroke); + }, + _setFillStyles: function(p, y) { + return this.handleFiller(p, "fillStyle", y.fill); + }, + /** + * @private + * @param {String} method + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {String} _char + * @param {Number} left Left coordinate + * @param {Number} top Top coordinate + * @param {Number} lineHeight Height of the line + */ + _renderChar: function(p, y, v, x, I, P, F) { + var k = this._getStyleDeclaration(v, x), V = this.getCompleteStyleDeclaration(v, x), j = p === "fillText" && V.fill, Y = p === "strokeText" && V.stroke && V.strokeWidth, X, Q; + !Y && !j || (y.save(), j && (X = this._setFillStyles(y, V)), Y && (Q = this._setStrokeStyles(y, V)), y.font = this._getFontDeclaration(V), k && k.textBackgroundColor && this._removeShadow(y), k && k.deltaY && (F += k.deltaY), j && y.fillText(I, P - X.offsetX, F - X.offsetY), Y && y.strokeText(I, P - Q.offsetX, F - Q.offsetY), y.restore()); + }, + /** + * Turns the character into a 'superior figure' (i.e. 'superscript') + * @param {Number} start selection start + * @param {Number} end selection end + * @returns {fabric.Text} thisArg + * @chainable + */ + setSuperscript: function(p, y) { + return this._setScript(p, y, this.superscript); + }, + /** + * Turns the character into an 'inferior figure' (i.e. 'subscript') + * @param {Number} start selection start + * @param {Number} end selection end + * @returns {fabric.Text} thisArg + * @chainable + */ + setSubscript: function(p, y) { + return this._setScript(p, y, this.subscript); + }, + /** + * Applies 'schema' at given position + * @private + * @param {Number} start selection start + * @param {Number} end selection end + * @param {Number} schema + * @returns {fabric.Text} thisArg + * @chainable + */ + _setScript: function(p, y, v) { + var x = this.get2DCursorLocation(p, !0), I = this.getValueOfPropertyAt(x.lineIndex, x.charIndex, "fontSize"), P = this.getValueOfPropertyAt(x.lineIndex, x.charIndex, "deltaY"), F = { fontSize: I * v.size, deltaY: P + I * v.baseline }; + return this.setSelectionStyles(F, p, y), this; + }, + /** + * @private + * @param {Number} lineIndex index text line + * @return {Number} Line left offset + */ + _getLineLeftOffset: function(p) { + var y = this.getLineWidth(p), v = this.width - y, x = this.textAlign, I = this.direction, F, P = 0, F = this.isEndOfWrapping(p); + return x === "justify" || x === "justify-center" && !F || x === "justify-right" && !F || x === "justify-left" && !F ? 0 : (x === "center" && (P = v / 2), x === "right" && (P = v), x === "justify-center" && (P = v / 2), x === "justify-right" && (P = v), I === "rtl" && (P -= v), P); + }, + /** + * @private + */ + _clearCache: function() { + this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = []; + }, + /** + * @private + */ + _shouldClearDimensionCache: function() { + var p = this._forceClearCache; + return p || (p = this.hasStateChanged("_dimensionAffectingProps")), p && (this.dirty = !0, this._forceClearCache = !1), p; + }, + /** + * Measure a single line given its index. Used to calculate the initial + * text bounding box. The values are calculated and stored in __lineWidths cache. + * @private + * @param {Number} lineIndex line number + * @return {Number} Line width + */ + getLineWidth: function(p) { + if (this.__lineWidths[p] !== void 0) + return this.__lineWidths[p]; + var y = this.measureLine(p), v = y.width; + return this.__lineWidths[p] = v, v; + }, + _getWidthOfCharSpacing: function() { + return this.charSpacing !== 0 ? this.fontSize * this.charSpacing / 1e3 : 0; + }, + /** + * Retrieves the value of property at given character position + * @param {Number} lineIndex the line number + * @param {Number} charIndex the character number + * @param {String} property the property name + * @returns the value of 'property' + */ + getValueOfPropertyAt: function(p, y, v) { + var x = this._getStyleDeclaration(p, y); + return x && typeof x[v] < "u" ? x[v] : this[v]; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextDecoration: function(p, y) { + if (!(!this[y] && !this.styleHas(y))) { + for (var v, x, I, P, F, k, V, j, Y = this._getLeftOffset(), X = this._getTopOffset(), Q, re, he, fe, be, Se, Me, ke, J = this.path, ce = this._getWidthOfCharSpacing(), xe = this.offsets[y], Pe = 0, Oe = this._textLines.length; Pe < Oe; Pe++) { + if (v = this.getHeightOfLine(Pe), !this[y] && !this.styleHas(y, Pe)) { + X += v; + continue; + } + V = this._textLines[Pe], Se = v / this.lineHeight, P = this._getLineLeftOffset(Pe), re = 0, he = 0, j = this.getValueOfPropertyAt(Pe, 0, y), ke = this.getValueOfPropertyAt(Pe, 0, "fill"), Q = X + Se * (1 - this._fontSizeFraction), x = this.getHeightOfChar(Pe, 0), F = this.getValueOfPropertyAt(Pe, 0, "deltaY"); + for (var Re = 0, Ge = V.length; Re < Ge; Re++) + if (fe = this.__charBounds[Pe][Re], be = this.getValueOfPropertyAt(Pe, Re, y), Me = this.getValueOfPropertyAt(Pe, Re, "fill"), I = this.getHeightOfChar(Pe, Re), k = this.getValueOfPropertyAt(Pe, Re, "deltaY"), J && be && Me) + p.save(), p.fillStyle = ke, p.translate(fe.renderLeft, fe.renderTop), p.rotate(fe.angle), p.fillRect( + -fe.kernedWidth / 2, + xe * I + k, + fe.kernedWidth, + this.fontSize / 15 + ), p.restore(); + else if ((be !== j || Me !== ke || I !== x || k !== F) && he > 0) { + var je = Y + P + re; + this.direction === "rtl" && (je = this.width - je - he), j && ke && (p.fillStyle = ke, p.fillRect( + je, + Q + xe * x + F, + he, + this.fontSize / 15 + )), re = fe.left, he = fe.width, j = be, ke = Me, x = I, F = k; + } else + he += fe.kernedWidth; + var je = Y + P + re; + this.direction === "rtl" && (je = this.width - je - he), p.fillStyle = Me, be && Me && p.fillRect( + je, + Q + xe * x + F, + he - ce, + this.fontSize / 15 + ), X += v; + } + this._removeShadow(p); + } + }, + /** + * return font declaration string for canvas context + * @param {Object} [styleObject] object + * @returns {String} font declaration formatted for canvas context. + */ + _getFontDeclaration: function(p, y) { + var v = p || this, x = this.fontFamily, I = l.Text.genericFonts.indexOf(x.toLowerCase()) > -1, P = x === void 0 || x.indexOf("'") > -1 || x.indexOf(",") > -1 || x.indexOf('"') > -1 || I ? v.fontFamily : '"' + v.fontFamily + '"'; + return [ + // node-canvas needs "weight style", while browsers need "style weight" + // verify if this can be fixed in JSDOM + l.isLikelyNode ? v.fontWeight : v.fontStyle, + l.isLikelyNode ? v.fontStyle : v.fontWeight, + y ? this.CACHE_FONT_SIZE + "px" : v.fontSize + "px", + P + ].join(" "); + }, + /** + * Renders text instance on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(p) { + this.visible && (this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._shouldClearDimensionCache() && this.initDimensions(), this.callSuper("render", p))); + }, + /** + * Returns the text as an array of lines. + * @param {String} text text to split + * @returns {Array} Lines in the text + */ + _splitTextIntoLines: function(p) { + for (var y = p.split(this._reNewline), v = new Array(y.length), x = [` +`], I = [], P = 0; P < y.length; P++) + v[P] = l.util.string.graphemeSplit(y[P]), I = I.concat(v[P], x); + return I.pop(), { _unwrappedLines: v, lines: y, graphemeText: I, graphemeLines: v }; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(p) { + var y = h.concat(p), v = this.callSuper("toObject", y); + return v.styles = l.util.stylesToArray(this.styles, this.text), v.path && (v.path = this.path.toObject()), v; + }, + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + * @return {fabric.Object} thisArg + * @chainable + */ + set: function(p, y) { + this.callSuper("set", p, y); + var v = !1, x = !1; + if (typeof p == "object") + for (var I in p) + I === "path" && this.setPathInfo(), v = v || this._dimensionAffectingProps.indexOf(I) !== -1, x = x || I === "path"; + else + v = this._dimensionAffectingProps.indexOf(p) !== -1, x = p === "path"; + return x && this.setPathInfo(), v && (this.initDimensions(), this.setCoords()), this; + }, + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity: function() { + return 1; + } + } + ), l.Text.ATTRIBUTE_NAMES = l.SHARED_ATTRIBUTES.concat( + "x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ") + ), l.Text.DEFAULT_SVG_FONT_SIZE = 16, l.Text.fromElement = function(p, y, v) { + if (!p) + return y(null); + var x = l.parseAttributes(p, l.Text.ATTRIBUTE_NAMES), I = x.textAnchor || "left"; + if (v = l.util.object.extend(v ? c(v) : {}, x), v.top = v.top || 0, v.left = v.left || 0, x.textDecoration) { + var P = x.textDecoration; + P.indexOf("underline") !== -1 && (v.underline = !0), P.indexOf("overline") !== -1 && (v.overline = !0), P.indexOf("line-through") !== -1 && (v.linethrough = !0), delete v.textDecoration; + } + "dx" in x && (v.left += x.dx), "dy" in x && (v.top += x.dy), "fontSize" in v || (v.fontSize = l.Text.DEFAULT_SVG_FONT_SIZE); + var F = ""; + "textContent" in p ? F = p.textContent : "firstChild" in p && p.firstChild !== null && "data" in p.firstChild && p.firstChild.data !== null && (F = p.firstChild.data), F = F.replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " "); + var k = v.strokeWidth; + v.strokeWidth = 0; + var V = new l.Text(F, v), j = V.getScaledHeight() / V.height, Y = (V.height + V.strokeWidth) * V.lineHeight - V.height, X = Y * j, Q = V.getScaledHeight() + X, re = 0; + I === "center" && (re = V.getScaledWidth() / 2), I === "right" && (re = V.getScaledWidth()), V.set({ + left: V.left - re, + top: V.top - (Q - V.fontSize * (0.07 + V._fontSizeFraction)) / V.lineHeight, + strokeWidth: typeof k < "u" ? k : 1 + }), y(V); + }, l.Text.fromObject = function(p, y) { + var v = c(p), x = p.path; + return delete v.path, l.Object._fromObject("Text", v, function(I) { + I.styles = l.util.stylesFromArray(p.styles, p.text), x ? l.Object._fromObject("Path", x, function(P) { + I.set("path", P), y(I); + }, "path") : y(I); + }, "text"); + }, l.Text.genericFonts = ["sans-serif", "serif", "cursive", "fantasy", "monospace"], l.util.createAccessors && l.util.createAccessors(l.Text); + }(t), function() { + e.util.object.extend( + e.Text.prototype, + /** @lends fabric.Text.prototype */ + { + /** + * Returns true if object has no styling or no styling in a line + * @param {Number} lineIndex , lineIndex is on wrapped lines. + * @return {Boolean} + */ + isEmptyStyles: function(a) { + if (!this.styles || typeof a < "u" && !this.styles[a]) + return !0; + var l = typeof a > "u" ? this.styles : { line: this.styles[a] }; + for (var c in l) + for (var h in l[c]) + for (var p in l[c][h]) + return !1; + return !0; + }, + /** + * Returns true if object has a style property or has it ina specified line + * This function is used to detect if a text will use a particular property or not. + * @param {String} property to check for + * @param {Number} lineIndex to check the style on + * @return {Boolean} + */ + styleHas: function(a, l) { + if (!this.styles || !a || a === "" || typeof l < "u" && !this.styles[l]) + return !1; + var c = typeof l > "u" ? this.styles : { 0: this.styles[l] }; + for (var h in c) + for (var p in c[h]) + if (typeof c[h][p][a] < "u") + return !0; + return !1; + }, + /** + * Check if characters in a text have a value for a property + * whose value matches the textbox's value for that property. If so, + * the character-level property is deleted. If the character + * has no other properties, then it is also deleted. Finally, + * if the line containing that character has no other characters + * then it also is deleted. + * + * @param {string} property The property to compare between characters and text. + */ + cleanStyle: function(a) { + if (!this.styles || !a || a === "") + return !1; + var l = this.styles, c = 0, h, p, y = !0, v = 0, x; + for (var I in l) { + h = 0; + for (var P in l[I]) { + var x = l[I][P], F = x.hasOwnProperty(a); + c++, F ? (p ? x[a] !== p && (y = !1) : p = x[a], x[a] === this[a] && delete x[a]) : y = !1, Object.keys(x).length !== 0 ? h++ : delete l[I][P]; + } + h === 0 && delete l[I]; + } + for (var k = 0; k < this._textLines.length; k++) + v += this._textLines[k].length; + y && c === v && (this[a] = p, this.removeStyle(a)); + }, + /** + * Remove a style property or properties from all individual character styles + * in a text object. Deletes the character style object if it contains no other style + * props. Deletes a line style object if it contains no other character styles. + * + * @param {String} props The property to remove from character styles. + */ + removeStyle: function(a) { + if (!(!this.styles || !a || a === "")) { + var l = this.styles, c, h, p; + for (h in l) { + c = l[h]; + for (p in c) + delete c[p][a], Object.keys(c[p]).length === 0 && delete c[p]; + Object.keys(c).length === 0 && delete l[h]; + } + } + }, + /** + * @private + */ + _extendStyles: function(a, l) { + var c = this.get2DCursorLocation(a); + this._getLineStyle(c.lineIndex) || this._setLineStyle(c.lineIndex), this._getStyleDeclaration(c.lineIndex, c.charIndex) || this._setStyleDeclaration(c.lineIndex, c.charIndex, {}), e.util.object.extend(this._getStyleDeclaration(c.lineIndex, c.charIndex), l); + }, + /** + * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start) + * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used. + * @param {Boolean} [skipWrapping] consider the location for unwrapped lines. useful to manage styles. + */ + get2DCursorLocation: function(a, l) { + typeof a > "u" && (a = this.selectionStart); + for (var c = l ? this._unwrappedTextLines : this._textLines, h = c.length, p = 0; p < h; p++) { + if (a <= c[p].length) + return { + lineIndex: p, + charIndex: a + }; + a -= c[p].length + this.missingNewlineOffset(p); + } + return { + lineIndex: p - 1, + charIndex: c[p - 1].length < a ? c[p - 1].length : a + }; + }, + /** + * Gets style of a current selection/cursor (at the start position) + * if startIndex or endIndex are not provided, selectionStart or selectionEnd will be used. + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1 + * @param {Boolean} [complete] get full style or not + * @return {Array} styles an array with one, zero or more Style objects + */ + getSelectionStyles: function(a, l, c) { + typeof a > "u" && (a = this.selectionStart || 0), typeof l > "u" && (l = this.selectionEnd || a); + for (var h = [], p = a; p < l; p++) + h.push(this.getStyleAtPosition(p, c)); + return h; + }, + /** + * Gets style of a current selection/cursor position + * @param {Number} position to get styles at + * @param {Boolean} [complete] full style if true + * @return {Object} style Style object at a specified index + * @private + */ + getStyleAtPosition: function(a, l) { + var c = this.get2DCursorLocation(a), h = l ? this.getCompleteStyleDeclaration(c.lineIndex, c.charIndex) : this._getStyleDeclaration(c.lineIndex, c.charIndex); + return h || {}; + }, + /** + * Sets style of a current selection, if no selection exist, do not set anything. + * @param {Object} [styles] Styles object + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1 + * @return {fabric.IText} thisArg + * @chainable + */ + setSelectionStyles: function(a, l, c) { + typeof l > "u" && (l = this.selectionStart || 0), typeof c > "u" && (c = this.selectionEnd || l); + for (var h = l; h < c; h++) + this._extendStyles(h, a); + return this._forceClearCache = !0, this; + }, + /** + * get the reference, not a clone, of the style object for a given character + * @param {Number} lineIndex + * @param {Number} charIndex + * @return {Object} style object + */ + _getStyleDeclaration: function(a, l) { + var c = this.styles && this.styles[a]; + return c ? c[l] : null; + }, + /** + * return a new object that contains all the style property for a character + * the object returned is newly created + * @param {Number} lineIndex of the line where the character is + * @param {Number} charIndex position of the character on the line + * @return {Object} style object + */ + getCompleteStyleDeclaration: function(a, l) { + for (var c = this._getStyleDeclaration(a, l) || {}, h = {}, p, y = 0; y < this._styleProperties.length; y++) + p = this._styleProperties[y], h[p] = typeof c[p] > "u" ? this[p] : c[p]; + return h; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {Object} style + * @private + */ + _setStyleDeclaration: function(a, l, c) { + this.styles[a][l] = c; + }, + /** + * + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _deleteStyleDeclaration: function(a, l) { + delete this.styles[a][l]; + }, + /** + * @param {Number} lineIndex + * @return {Boolean} if the line exists or not + * @private + */ + _getLineStyle: function(a) { + return !!this.styles[a]; + }, + /** + * Set the line style to an empty object so that is initialized + * @param {Number} lineIndex + * @private + */ + _setLineStyle: function(a) { + this.styles[a] = {}; + }, + /** + * @param {Number} lineIndex + * @private + */ + _deleteLineStyle: function(a) { + delete this.styles[a]; + } + } + ); + }(), function() { + function a(l) { + l.textDecoration && (l.textDecoration.indexOf("underline") > -1 && (l.underline = !0), l.textDecoration.indexOf("line-through") > -1 && (l.linethrough = !0), l.textDecoration.indexOf("overline") > -1 && (l.overline = !0), delete l.textDecoration); + } + e.IText = e.util.createClass( + e.Text, + e.Observable, + /** @lends fabric.IText.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "i-text", + /** + * Index where text selection starts (or where cursor is when there is no selection) + * @type Number + * @default + */ + selectionStart: 0, + /** + * Index where text selection ends + * @type Number + * @default + */ + selectionEnd: 0, + /** + * Color of text selection + * @type String + * @default + */ + selectionColor: "rgba(17,119,255,0.3)", + /** + * Indicates whether text is in editing mode + * @type Boolean + * @default + */ + isEditing: !1, + /** + * Indicates whether a text can be edited + * @type Boolean + * @default + */ + editable: !0, + /** + * Border color of text object while it's in editing mode + * @type String + * @default + */ + editingBorderColor: "rgba(102,153,255,0.25)", + /** + * Width of cursor (in px) + * @type Number + * @default + */ + cursorWidth: 2, + /** + * Color of text cursor color in editing mode. + * if not set (default) will take color from the text. + * if set to a color value that fabric can understand, it will + * be used instead of the color of the text at the current position. + * @type String + * @default + */ + cursorColor: "", + /** + * Delay between cursor blink (in ms) + * @type Number + * @default + */ + cursorDelay: 1e3, + /** + * Duration of cursor fadein (in ms) + * @type Number + * @default + */ + cursorDuration: 600, + /** + * Indicates whether internal text char widths can be cached + * @type Boolean + * @default + */ + caching: !0, + /** + * DOM container to append the hiddenTextarea. + * An alternative to attaching to the document.body. + * Useful to reduce laggish redraw of the full document.body tree and + * also with modals event capturing that won't let the textarea take focus. + * @type HTMLElement + * @default + */ + hiddenTextareaContainer: null, + /** + * @private + */ + _reSpace: /\s|\n/, + /** + * @private + */ + _currentCursorOpacity: 0, + /** + * @private + */ + _selectionDirection: null, + /** + * @private + */ + _abortCursorAnimation: !1, + /** + * @private + */ + __widthOfSpace: [], + /** + * Helps determining when the text is in composition, so that the cursor + * rendering is altered. + */ + inCompositionMode: !1, + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.IText} thisArg + */ + initialize: function(l, c) { + this.callSuper("initialize", l, c), this.initBehavior(); + }, + /** + * Sets selection start (left boundary of a selection) + * @param {Number} index Index to set selection start to + */ + setSelectionStart: function(l) { + l = Math.max(l, 0), this._updateAndFire("selectionStart", l); + }, + /** + * Sets selection end (right boundary of a selection) + * @param {Number} index Index to set selection end to + */ + setSelectionEnd: function(l) { + l = Math.min(l, this.text.length), this._updateAndFire("selectionEnd", l); + }, + /** + * @private + * @param {String} property 'selectionStart' or 'selectionEnd' + * @param {Number} index new position of property + */ + _updateAndFire: function(l, c) { + this[l] !== c && (this._fireSelectionChanged(), this[l] = c), this._updateTextarea(); + }, + /** + * Fires the even of selection changed + * @private + */ + _fireSelectionChanged: function() { + this.fire("selection:changed"), this.canvas && this.canvas.fire("text:selection:changed", { target: this }); + }, + /** + * Initialize text dimensions. Render all text on given context + * or on a offscreen canvas to get the text width with measureText. + * Updates this.width and this.height with the proper values. + * Does not return dimensions. + * @private + */ + initDimensions: function() { + this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this.callSuper("initDimensions"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(l) { + this.clearContextTop(), this.callSuper("render", l), this.cursorOffsetCache = {}, this.renderCursorOrSelection(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(l) { + this.callSuper("_render", l); + }, + /** + * Prepare and clean the contextTop + */ + clearContextTop: function(l) { + if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) { + var c = this.canvas.contextTop, h = this.canvas.viewportTransform; + c.save(), c.transform(h[0], h[1], h[2], h[3], h[4], h[5]), this.transform(c), this._clearTextArea(c), l || c.restore(); + } + }, + /** + * Renders cursor or selection (depending on what exists) + * it does on the contextTop. If contextTop is not available, do nothing. + */ + renderCursorOrSelection: function() { + if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) { + var l = this._getCursorBoundaries(), c = this.canvas.contextTop; + this.clearContextTop(!0), this.selectionStart === this.selectionEnd ? this.renderCursor(l, c) : this.renderSelection(l, c), c.restore(); + } + }, + _clearTextArea: function(l) { + var c = this.width + 4, h = this.height + 4; + l.clearRect(-c / 2, -h / 2, c, h); + }, + /** + * Returns cursor boundaries (left, top, leftOffset, topOffset) + * @private + * @param {Array} chars Array of characters + * @param {String} typeOfBoundaries + */ + _getCursorBoundaries: function(l) { + typeof l > "u" && (l = this.selectionStart); + var c = this._getLeftOffset(), h = this._getTopOffset(), p = this._getCursorBoundariesOffsets(l); + return { + left: c, + top: h, + leftOffset: p.left, + topOffset: p.top + }; + }, + /** + * @private + */ + _getCursorBoundariesOffsets: function(l) { + if (this.cursorOffsetCache && "top" in this.cursorOffsetCache) + return this.cursorOffsetCache; + var c, h, p, y = 0, v = 0, x, I = this.get2DCursorLocation(l); + p = I.charIndex, h = I.lineIndex; + for (var P = 0; P < h; P++) + y += this.getHeightOfLine(P); + c = this._getLineLeftOffset(h); + var F = this.__charBounds[h][p]; + return F && (v = F.left), this.charSpacing !== 0 && p === this._textLines[h].length && (v -= this._getWidthOfCharSpacing()), x = { + top: y, + left: c + (v > 0 ? v : 0) + }, this.direction === "rtl" && (x.left *= -1), this.cursorOffsetCache = x, this.cursorOffsetCache; + }, + /** + * Renders cursor + * @param {Object} boundaries + * @param {CanvasRenderingContext2D} ctx transformed context to draw on + */ + renderCursor: function(l, c) { + var h = this.get2DCursorLocation(), p = h.lineIndex, y = h.charIndex > 0 ? h.charIndex - 1 : 0, v = this.getValueOfPropertyAt(p, y, "fontSize"), x = this.scaleX * this.canvas.getZoom(), I = this.cursorWidth / x, P = l.topOffset, F = this.getValueOfPropertyAt(p, y, "deltaY"); + P += (1 - this._fontSizeFraction) * this.getHeightOfLine(p) / this.lineHeight - v * (1 - this._fontSizeFraction), this.inCompositionMode && this.renderSelection(l, c), c.fillStyle = this.cursorColor || this.getValueOfPropertyAt(p, y, "fill"), c.globalAlpha = this.__isMousedown ? 1 : this._currentCursorOpacity, c.fillRect( + l.left + l.leftOffset - I / 2, + P + l.top + F, + I, + v + ); + }, + /** + * Renders text selection + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + * @param {CanvasRenderingContext2D} ctx transformed context to draw on + */ + renderSelection: function(l, c) { + for (var h = this.inCompositionMode ? this.hiddenTextarea.selectionStart : this.selectionStart, p = this.inCompositionMode ? this.hiddenTextarea.selectionEnd : this.selectionEnd, y = this.textAlign.indexOf("justify") !== -1, v = this.get2DCursorLocation(h), x = this.get2DCursorLocation(p), I = v.lineIndex, P = x.lineIndex, F = v.charIndex < 0 ? 0 : v.charIndex, k = x.charIndex < 0 ? 0 : x.charIndex, V = I; V <= P; V++) { + var j = this._getLineLeftOffset(V) || 0, Y = this.getHeightOfLine(V), X = 0, Q = 0, re = 0; + if (V === I && (Q = this.__charBounds[I][F].left), V >= I && V < P) + re = y && !this.isEndOfWrapping(V) ? this.width : this.getLineWidth(V) || 5; + else if (V === P) + if (k === 0) + re = this.__charBounds[P][k].left; + else { + var he = this._getWidthOfCharSpacing(); + re = this.__charBounds[P][k - 1].left + this.__charBounds[P][k - 1].width - he; + } + X = Y, (this.lineHeight < 1 || V === P && this.lineHeight > 1) && (Y /= this.lineHeight); + var fe = l.left + j + Q, be = re - Q, Se = Y, Me = 0; + this.inCompositionMode ? (c.fillStyle = this.compositionColor || "black", Se = 1, Me = Y) : c.fillStyle = this.selectionColor, this.direction === "rtl" && (fe = this.width - fe - be), c.fillRect( + fe, + l.top + l.topOffset + Me, + be, + Se + ), l.topOffset += X; + } + }, + /** + * High level function to know the height of the cursor. + * the currentChar is the one that precedes the cursor + * Returns fontSize of char at the current cursor + * Unused from the library, is for the end user + * @return {Number} Character font size + */ + getCurrentCharFontSize: function() { + var l = this._getCurrentCharIndex(); + return this.getValueOfPropertyAt(l.l, l.c, "fontSize"); + }, + /** + * High level function to know the color of the cursor. + * the currentChar is the one that precedes the cursor + * Returns color (fill) of char at the current cursor + * if the text object has a pattern or gradient for filler, it will return that. + * Unused by the library, is for the end user + * @return {String | fabric.Gradient | fabric.Pattern} Character color (fill) + */ + getCurrentCharColor: function() { + var l = this._getCurrentCharIndex(); + return this.getValueOfPropertyAt(l.l, l.c, "fill"); + }, + /** + * Returns the cursor position for the getCurrent.. functions + * @private + */ + _getCurrentCharIndex: function() { + var l = this.get2DCursorLocation(this.selectionStart, !0), c = l.charIndex > 0 ? l.charIndex - 1 : 0; + return { l: l.lineIndex, c }; + } + } + ), e.IText.fromObject = function(l, c) { + var h = e.util.stylesFromArray(l.styles, l.text), p = Object.assign({}, l, { styles: h }); + if (a(p), p.styles) + for (var y in p.styles) + for (var v in p.styles[y]) + a(p.styles[y][v]); + e.Object._fromObject("IText", p, c, "text"); + }; + }(), function() { + var a = e.util.object.clone; + e.util.object.extend( + e.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes all the interactive behavior of IText + */ + initBehavior: function() { + this.initAddedHandler(), this.initRemovedHandler(), this.initCursorSelectionHandlers(), this.initDoubleClickSimulation(), this.mouseMoveHandler = this.mouseMoveHandler.bind(this); + }, + onDeselect: function() { + this.isEditing && this.exitEditing(), this.selected = !1; + }, + /** + * Initializes "added" event handler + */ + initAddedHandler: function() { + var l = this; + this.on("added", function() { + var c = l.canvas; + c && (c._hasITextHandlers || (c._hasITextHandlers = !0, l._initCanvasHandlers(c)), c._iTextInstances = c._iTextInstances || [], c._iTextInstances.push(l)); + }); + }, + initRemovedHandler: function() { + var l = this; + this.on("removed", function() { + var c = l.canvas; + c && (c._iTextInstances = c._iTextInstances || [], e.util.removeFromArray(c._iTextInstances, l), c._iTextInstances.length === 0 && (c._hasITextHandlers = !1, l._removeCanvasHandlers(c))); + }); + }, + /** + * register canvas event to manage exiting on other instances + * @private + */ + _initCanvasHandlers: function(l) { + l._mouseUpITextHandler = function() { + l._iTextInstances && l._iTextInstances.forEach(function(c) { + c.__isMousedown = !1; + }); + }, l.on("mouse:up", l._mouseUpITextHandler); + }, + /** + * remove canvas event to manage exiting on other instances + * @private + */ + _removeCanvasHandlers: function(l) { + l.off("mouse:up", l._mouseUpITextHandler); + }, + /** + * @private + */ + _tick: function() { + this._currentTickState = this._animateCursor(this, 1, this.cursorDuration, "_onTickComplete"); + }, + /** + * @private + */ + _animateCursor: function(l, c, h, p) { + var y; + return y = { + isAborted: !1, + abort: function() { + this.isAborted = !0; + } + }, l.animate("_currentCursorOpacity", c, { + duration: h, + onComplete: function() { + y.isAborted || l[p](); + }, + onChange: function() { + l.canvas && l.selectionStart === l.selectionEnd && l.renderCursorOrSelection(); + }, + abort: function() { + return y.isAborted; + } + }), y; + }, + /** + * @private + */ + _onTickComplete: function() { + var l = this; + this._cursorTimeout1 && clearTimeout(this._cursorTimeout1), this._cursorTimeout1 = setTimeout(function() { + l._currentTickCompleteState = l._animateCursor(l, 0, this.cursorDuration / 2, "_tick"); + }, 100); + }, + /** + * Initializes delayed cursor + */ + initDelayedCursor: function(l) { + var c = this, h = l ? 0 : this.cursorDelay; + this.abortCursorAnimation(), this._currentCursorOpacity = 1, this._cursorTimeout2 = setTimeout(function() { + c._tick(); + }, h); + }, + /** + * Aborts cursor animation and clears all timeouts + */ + abortCursorAnimation: function() { + var l = this._currentTickState || this._currentTickCompleteState, c = this.canvas; + this._currentTickState && this._currentTickState.abort(), this._currentTickCompleteState && this._currentTickCompleteState.abort(), clearTimeout(this._cursorTimeout1), clearTimeout(this._cursorTimeout2), this._currentCursorOpacity = 0, l && c && c.clearContext(c.contextTop || c.contextContainer); + }, + /** + * Selects entire text + * @return {fabric.IText} thisArg + * @chainable + */ + selectAll: function() { + return this.selectionStart = 0, this.selectionEnd = this._text.length, this._fireSelectionChanged(), this._updateTextarea(), this; + }, + /** + * Returns selected text + * @return {String} + */ + getSelectedText: function() { + return this._text.slice(this.selectionStart, this.selectionEnd).join(""); + }, + /** + * Find new selection index representing start of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryLeft: function(l) { + var c = 0, h = l - 1; + if (this._reSpace.test(this._text[h])) + for (; this._reSpace.test(this._text[h]); ) + c++, h--; + for (; /\S/.test(this._text[h]) && h > -1; ) + c++, h--; + return l - c; + }, + /** + * Find new selection index representing end of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryRight: function(l) { + var c = 0, h = l; + if (this._reSpace.test(this._text[h])) + for (; this._reSpace.test(this._text[h]); ) + c++, h++; + for (; /\S/.test(this._text[h]) && h < this._text.length; ) + c++, h++; + return l + c; + }, + /** + * Find new selection index representing start of current line according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findLineBoundaryLeft: function(l) { + for (var c = 0, h = l - 1; !/\n/.test(this._text[h]) && h > -1; ) + c++, h--; + return l - c; + }, + /** + * Find new selection index representing end of current line according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findLineBoundaryRight: function(l) { + for (var c = 0, h = l; !/\n/.test(this._text[h]) && h < this._text.length; ) + c++, h++; + return l + c; + }, + /** + * Finds index corresponding to beginning or end of a word + * @param {Number} selectionStart Index of a character + * @param {Number} direction 1 or -1 + * @return {Number} Index of the beginning or end of a word + */ + searchWordBoundary: function(l, c) { + for (var h = this._text, p = this._reSpace.test(h[l]) ? l - 1 : l, y = h[p], v = e.reNonWord; !v.test(y) && p > 0 && p < h.length; ) + p += c, y = h[p]; + return v.test(y) && (p += c === 1 ? 0 : 1), p; + }, + /** + * Selects a word based on the index + * @param {Number} selectionStart Index of a character + */ + selectWord: function(l) { + l = l || this.selectionStart; + var c = this.searchWordBoundary(l, -1), h = this.searchWordBoundary(l, 1); + this.selectionStart = c, this.selectionEnd = h, this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection(); + }, + /** + * Selects a line based on the index + * @param {Number} selectionStart Index of a character + * @return {fabric.IText} thisArg + * @chainable + */ + selectLine: function(l) { + l = l || this.selectionStart; + var c = this.findLineBoundaryLeft(l), h = this.findLineBoundaryRight(l); + return this.selectionStart = c, this.selectionEnd = h, this._fireSelectionChanged(), this._updateTextarea(), this; + }, + /** + * Enters editing state + * @return {fabric.IText} thisArg + * @chainable + */ + enterEditing: function(l) { + if (!(this.isEditing || !this.editable)) + return this.canvas && (this.canvas.calcOffset(), this.exitEditingOnOthers(this.canvas)), this.isEditing = !0, this.initHiddenTextarea(l), this.hiddenTextarea.focus(), this.hiddenTextarea.value = this.text, this._updateTextarea(), this._saveEditingProps(), this._setEditingProps(), this._textBeforeEdit = this.text, this._tick(), this.fire("editing:entered"), this._fireSelectionChanged(), this.canvas ? (this.canvas.fire("text:editing:entered", { target: this }), this.initMouseMoveHandler(), this.canvas.requestRenderAll(), this) : this; + }, + exitEditingOnOthers: function(l) { + l._iTextInstances && l._iTextInstances.forEach(function(c) { + c.selected = !1, c.isEditing && c.exitEditing(); + }); + }, + /** + * Initializes "mousemove" event handler + */ + initMouseMoveHandler: function() { + this.canvas.on("mouse:move", this.mouseMoveHandler); + }, + /** + * @private + */ + mouseMoveHandler: function(l) { + if (!(!this.__isMousedown || !this.isEditing)) { + document.activeElement !== this.hiddenTextarea && this.hiddenTextarea.focus(); + var c = this.getSelectionStartFromPointer(l.e), h = this.selectionStart, p = this.selectionEnd; + (c !== this.__selectionStartOnMouseDown || h === p) && (h === c || p === c) || (c > this.__selectionStartOnMouseDown ? (this.selectionStart = this.__selectionStartOnMouseDown, this.selectionEnd = c) : (this.selectionStart = c, this.selectionEnd = this.__selectionStartOnMouseDown), (this.selectionStart !== h || this.selectionEnd !== p) && (this.restartCursorIfNeeded(), this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection())); + } + }, + /** + * @private + */ + _setEditingProps: function() { + this.hoverCursor = "text", this.canvas && (this.canvas.defaultCursor = this.canvas.moveCursor = "text"), this.borderColor = this.editingBorderColor, this.hasControls = this.selectable = !1, this.lockMovementX = this.lockMovementY = !0; + }, + /** + * convert from textarea to grapheme indexes + */ + fromStringToGraphemeSelection: function(l, c, h) { + var p = h.slice(0, l), y = e.util.string.graphemeSplit(p).length; + if (l === c) + return { selectionStart: y, selectionEnd: y }; + var v = h.slice(l, c), x = e.util.string.graphemeSplit(v).length; + return { selectionStart: y, selectionEnd: y + x }; + }, + /** + * convert from fabric to textarea values + */ + fromGraphemeToStringSelection: function(l, c, h) { + var p = h.slice(0, l), y = p.join("").length; + if (l === c) + return { selectionStart: y, selectionEnd: y }; + var v = h.slice(l, c), x = v.join("").length; + return { selectionStart: y, selectionEnd: y + x }; + }, + /** + * @private + */ + _updateTextarea: function() { + if (this.cursorOffsetCache = {}, !!this.hiddenTextarea) { + if (!this.inCompositionMode) { + var l = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text); + this.hiddenTextarea.selectionStart = l.selectionStart, this.hiddenTextarea.selectionEnd = l.selectionEnd; + } + this.updateTextareaPosition(); + } + }, + /** + * @private + */ + updateFromTextArea: function() { + if (this.hiddenTextarea) { + this.cursorOffsetCache = {}, this.text = this.hiddenTextarea.value, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()); + var l = this.fromStringToGraphemeSelection( + this.hiddenTextarea.selectionStart, + this.hiddenTextarea.selectionEnd, + this.hiddenTextarea.value + ); + this.selectionEnd = this.selectionStart = l.selectionEnd, this.inCompositionMode || (this.selectionStart = l.selectionStart), this.updateTextareaPosition(); + } + }, + /** + * @private + */ + updateTextareaPosition: function() { + if (this.selectionStart === this.selectionEnd) { + var l = this._calcTextareaPosition(); + this.hiddenTextarea.style.left = l.left, this.hiddenTextarea.style.top = l.top; + } + }, + /** + * @private + * @return {Object} style contains style for hiddenTextarea + */ + _calcTextareaPosition: function() { + if (!this.canvas) + return { x: 1, y: 1 }; + var l = this.inCompositionMode ? this.compositionStart : this.selectionStart, c = this._getCursorBoundaries(l), h = this.get2DCursorLocation(l), p = h.lineIndex, y = h.charIndex, v = this.getValueOfPropertyAt(p, y, "fontSize") * this.lineHeight, x = c.leftOffset, I = this.calcTransformMatrix(), P = { + x: c.left + x, + y: c.top + c.topOffset + v + }, F = this.canvas.getRetinaScaling(), k = this.canvas.upperCanvasEl, V = k.width / F, j = k.height / F, Y = V - v, X = j - v, Q = k.clientWidth / V, re = k.clientHeight / j; + return P = e.util.transformPoint(P, I), P = e.util.transformPoint(P, this.canvas.viewportTransform), P.x *= Q, P.y *= re, P.x < 0 && (P.x = 0), P.x > Y && (P.x = Y), P.y < 0 && (P.y = 0), P.y > X && (P.y = X), P.x += this.canvas._offset.left, P.y += this.canvas._offset.top, { left: P.x + "px", top: P.y + "px", fontSize: v + "px", charHeight: v }; + }, + /** + * @private + */ + _saveEditingProps: function() { + this._savedProps = { + hasControls: this.hasControls, + borderColor: this.borderColor, + lockMovementX: this.lockMovementX, + lockMovementY: this.lockMovementY, + hoverCursor: this.hoverCursor, + selectable: this.selectable, + defaultCursor: this.canvas && this.canvas.defaultCursor, + moveCursor: this.canvas && this.canvas.moveCursor + }; + }, + /** + * @private + */ + _restoreEditingProps: function() { + this._savedProps && (this.hoverCursor = this._savedProps.hoverCursor, this.hasControls = this._savedProps.hasControls, this.borderColor = this._savedProps.borderColor, this.selectable = this._savedProps.selectable, this.lockMovementX = this._savedProps.lockMovementX, this.lockMovementY = this._savedProps.lockMovementY, this.canvas && (this.canvas.defaultCursor = this._savedProps.defaultCursor, this.canvas.moveCursor = this._savedProps.moveCursor)); + }, + /** + * Exits from editing state + * @return {fabric.IText} thisArg + * @chainable + */ + exitEditing: function() { + var l = this._textBeforeEdit !== this.text, c = this.hiddenTextarea; + return this.selected = !1, this.isEditing = !1, this.selectionEnd = this.selectionStart, c && (c.blur && c.blur(), c.parentNode && c.parentNode.removeChild(c)), this.hiddenTextarea = null, this.abortCursorAnimation(), this._restoreEditingProps(), this._currentCursorOpacity = 0, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this.fire("editing:exited"), l && this.fire("modified"), this.canvas && (this.canvas.off("mouse:move", this.mouseMoveHandler), this.canvas.fire("text:editing:exited", { target: this }), l && this.canvas.fire("object:modified", { target: this })), this; + }, + /** + * @private + */ + _removeExtraneousStyles: function() { + for (var l in this.styles) + this._textLines[l] || delete this.styles[l]; + }, + /** + * remove and reflow a style block from start to end. + * @param {Number} start linear start position for removal (included in removal) + * @param {Number} end linear end position for removal ( excluded from removal ) + */ + removeStyleFromTo: function(l, c) { + var h = this.get2DCursorLocation(l, !0), p = this.get2DCursorLocation(c, !0), y = h.lineIndex, v = h.charIndex, x = p.lineIndex, I = p.charIndex, P, F; + if (y !== x) { + if (this.styles[y]) + for (P = v; P < this._unwrappedTextLines[y].length; P++) + delete this.styles[y][P]; + if (this.styles[x]) + for (P = I; P < this._unwrappedTextLines[x].length; P++) + F = this.styles[x][P], F && (this.styles[y] || (this.styles[y] = {}), this.styles[y][v + P - I] = F); + for (P = y + 1; P <= x; P++) + delete this.styles[P]; + this.shiftLineStyles(x, y - x); + } else if (this.styles[y]) { + F = this.styles[y]; + var k = I - v, V, j; + for (P = v; P < I; P++) + delete F[P]; + for (j in this.styles[y]) + V = parseInt(j, 10), V >= I && (F[V - k] = F[j], delete F[j]); + } + }, + /** + * Shifts line styles up or down + * @param {Number} lineIndex Index of a line + * @param {Number} offset Can any number? + */ + shiftLineStyles: function(l, c) { + var h = a(this.styles); + for (var p in this.styles) { + var y = parseInt(p, 10); + y > l && (this.styles[y + c] = h[y], h[y - c] || delete this.styles[y]); + } + }, + restartCursorIfNeeded: function() { + (!this._currentTickState || this._currentTickState.isAborted || !this._currentTickCompleteState || this._currentTickCompleteState.isAborted) && this.initDelayedCursor(); + }, + /** + * Handle insertion of more consecutive style lines for when one or more + * newlines gets added to the text. Since current style needs to be shifted + * first we shift the current style of the number lines needed, then we add + * new lines from the last to the first. + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Number} qty number of lines to add + * @param {Array} copiedStyle Array of objects styles + */ + insertNewlineStyleObject: function(l, c, h, p) { + var y, v = {}, x = !1, I = this._unwrappedTextLines[l].length === c; + h || (h = 1), this.shiftLineStyles(l, h), this.styles[l] && (y = this.styles[l][c === 0 ? c : c - 1]); + for (var P in this.styles[l]) { + var F = parseInt(P, 10); + F >= c && (x = !0, v[F - c] = this.styles[l][P], I && c === 0 || delete this.styles[l][P]); + } + var k = !1; + for (x && !I && (this.styles[l + h] = v, k = !0), k && h--; h > 0; ) + p && p[h - 1] ? this.styles[l + h] = { 0: a(p[h - 1]) } : y ? this.styles[l + h] = { 0: a(y) } : delete this.styles[l + h], h--; + this._forceClearCache = !0; + }, + /** + * Inserts style object for a given line/char index + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Number} quantity number Style object to insert, if given + * @param {Array} copiedStyle array of style objects + */ + insertCharStyleObject: function(l, c, h, p) { + this.styles || (this.styles = {}); + var y = this.styles[l], v = y ? a(y) : {}; + h || (h = 1); + for (var x in v) { + var I = parseInt(x, 10); + I >= c && (y[I + h] = v[I], v[I - h] || delete y[I]); + } + if (this._forceClearCache = !0, p) { + for (; h--; ) + Object.keys(p[h]).length && (this.styles[l] || (this.styles[l] = {}), this.styles[l][c + h] = a(p[h])); + return; + } + if (y) + for (var P = y[c ? c - 1 : 1]; P && h--; ) + this.styles[l][c + h] = a(P); + }, + /** + * Inserts style object(s) + * @param {Array} insertedText Characters at the location where style is inserted + * @param {Number} start cursor index for inserting style + * @param {Array} [copiedStyle] array of style objects to insert. + */ + insertNewStyleBlock: function(l, c, h) { + for (var p = this.get2DCursorLocation(c, !0), y = [0], v = 0, x = 0; x < l.length; x++) + l[x] === ` +` ? (v++, y[v] = 0) : y[v]++; + y[0] > 0 && (this.insertCharStyleObject(p.lineIndex, p.charIndex, y[0], h), h = h && h.slice(y[0] + 1)), v && this.insertNewlineStyleObject( + p.lineIndex, + p.charIndex + y[0], + v + ); + for (var x = 1; x < v; x++) + y[x] > 0 ? this.insertCharStyleObject(p.lineIndex + x, 0, y[x], h) : h && this.styles[p.lineIndex + x] && h[0] && (this.styles[p.lineIndex + x][0] = h[0]), h = h && h.slice(y[x] + 1); + y[x] > 0 && this.insertCharStyleObject(p.lineIndex + x, 0, y[x], h); + }, + /** + * Set the selectionStart and selectionEnd according to the new position of cursor + * mimic the key - mouse navigation when shift is pressed. + */ + setSelectionStartEndWithShift: function(l, c, h) { + h <= l ? (c === l ? this._selectionDirection = "left" : this._selectionDirection === "right" && (this._selectionDirection = "left", this.selectionEnd = l), this.selectionStart = h) : h > l && h < c ? this._selectionDirection === "right" ? this.selectionEnd = h : this.selectionStart = h : (c === l ? this._selectionDirection = "right" : this._selectionDirection === "left" && (this._selectionDirection = "right", this.selectionStart = c), this.selectionEnd = h); + }, + setSelectionInBoundaries: function() { + var l = this.text.length; + this.selectionStart > l ? this.selectionStart = l : this.selectionStart < 0 && (this.selectionStart = 0), this.selectionEnd > l ? this.selectionEnd = l : this.selectionEnd < 0 && (this.selectionEnd = 0); + } + } + ); + }(), e.util.object.extend( + e.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes "dbclick" event handler + */ + initDoubleClickSimulation: function() { + this.__lastClickTime = +/* @__PURE__ */ new Date(), this.__lastLastClickTime = +/* @__PURE__ */ new Date(), this.__lastPointer = {}, this.on("mousedown", this.onMouseDown); + }, + /** + * Default event handler to simulate triple click + * @private + */ + onMouseDown: function(a) { + if (this.canvas) { + this.__newClickTime = +/* @__PURE__ */ new Date(); + var l = a.pointer; + this.isTripleClick(l) && (this.fire("tripleclick", a), this._stopEvent(a.e)), this.__lastLastClickTime = this.__lastClickTime, this.__lastClickTime = this.__newClickTime, this.__lastPointer = l, this.__lastIsEditing = this.isEditing, this.__lastSelected = this.selected; + } + }, + isTripleClick: function(a) { + return this.__newClickTime - this.__lastClickTime < 500 && this.__lastClickTime - this.__lastLastClickTime < 500 && this.__lastPointer.x === a.x && this.__lastPointer.y === a.y; + }, + /** + * @private + */ + _stopEvent: function(a) { + a.preventDefault && a.preventDefault(), a.stopPropagation && a.stopPropagation(); + }, + /** + * Initializes event handlers related to cursor or selection + */ + initCursorSelectionHandlers: function() { + this.initMousedownHandler(), this.initMouseupHandler(), this.initClicks(); + }, + /** + * Default handler for double click, select a word + */ + doubleClickHandler: function(a) { + this.isEditing && this.selectWord(this.getSelectionStartFromPointer(a.e)); + }, + /** + * Default handler for triple click, select a line + */ + tripleClickHandler: function(a) { + this.isEditing && this.selectLine(this.getSelectionStartFromPointer(a.e)); + }, + /** + * Initializes double and triple click event handlers + */ + initClicks: function() { + this.on("mousedblclick", this.doubleClickHandler), this.on("tripleclick", this.tripleClickHandler); + }, + /** + * Default event handler for the basic functionalities needed on _mouseDown + * can be overridden to do something different. + * Scope of this implementation is: find the click position, set selectionStart + * find selectionEnd, initialize the drawing of either cursor or selection area + * initializing a mousedDown on a text area will cancel fabricjs knowledge of + * current compositionMode. It will be set to false. + */ + _mouseDownHandler: function(a) { + !this.canvas || !this.editable || a.e.button && a.e.button !== 1 || (this.__isMousedown = !0, this.selected && (this.inCompositionMode = !1, this.setCursorByClick(a.e)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection())); + }, + /** + * Default event handler for the basic functionalities needed on mousedown:before + * can be overridden to do something different. + * Scope of this implementation is: verify the object is already selected when mousing down + */ + _mouseDownHandlerBefore: function(a) { + !this.canvas || !this.editable || a.e.button && a.e.button !== 1 || (this.selected = this === this.canvas._activeObject); + }, + /** + * Initializes "mousedown" event handler + */ + initMousedownHandler: function() { + this.on("mousedown", this._mouseDownHandler), this.on("mousedown:before", this._mouseDownHandlerBefore); + }, + /** + * Initializes "mouseup" event handler + */ + initMouseupHandler: function() { + this.on("mouseup", this.mouseUpHandler); + }, + /** + * standard handler for mouse up, overridable + * @private + */ + mouseUpHandler: function(a) { + if (this.__isMousedown = !1, !(!this.editable || this.group || a.transform && a.transform.actionPerformed || a.e.button && a.e.button !== 1)) { + if (this.canvas) { + var l = this.canvas._activeObject; + if (l && l !== this) + return; + } + this.__lastSelected && !this.__corner ? (this.selected = !1, this.__lastSelected = !1, this.enterEditing(a.e), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(!0) : this.renderCursorOrSelection()) : this.selected = !0; + } + }, + /** + * Changes cursor location in a text depending on passed pointer (x/y) object + * @param {Event} e Event object + */ + setCursorByClick: function(a) { + var l = this.getSelectionStartFromPointer(a), c = this.selectionStart, h = this.selectionEnd; + a.shiftKey ? this.setSelectionStartEndWithShift(c, h, l) : (this.selectionStart = l, this.selectionEnd = l), this.isEditing && (this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Returns index of a character corresponding to where an object was clicked + * @param {Event} e Event object + * @return {Number} Index of a character + */ + getSelectionStartFromPointer: function(a) { + for (var l = this.getLocalPointer(a), c = 0, h = 0, p = 0, y = 0, v = 0, x, I, P = 0, F = this._textLines.length; P < F && p <= l.y; P++) + p += this.getHeightOfLine(P) * this.scaleY, v = P, P > 0 && (y += this._textLines[P - 1].length + this.missingNewlineOffset(P - 1)); + x = this._getLineLeftOffset(v), h = x * this.scaleX, I = this._textLines[v], this.direction === "rtl" && (l.x = this.width * this.scaleX - l.x + h); + for (var k = 0, V = I.length; k < V && (c = h, h += this.__charBounds[v][k].kernedWidth * this.scaleX, h <= l.x); k++) + y++; + return this._getNewSelectionStartFromOffset(l, c, h, y, V); + }, + /** + * @private + */ + _getNewSelectionStartFromOffset: function(a, l, c, h, p) { + var y = a.x - l, v = c - a.x, x = v > y || v < 0 ? 0 : 1, I = h + x; + return this.flipX && (I = p - I), I > this._text.length && (I = this._text.length), I; + } + } + ), e.util.object.extend( + e.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes hidden textarea (needed to bring up keyboard in iOS) + */ + initHiddenTextarea: function() { + this.hiddenTextarea = e.document.createElement("textarea"), this.hiddenTextarea.setAttribute("autocapitalize", "off"), this.hiddenTextarea.setAttribute("autocorrect", "off"), this.hiddenTextarea.setAttribute("autocomplete", "off"), this.hiddenTextarea.setAttribute("spellcheck", "false"), this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea", ""), this.hiddenTextarea.setAttribute("wrap", "off"); + var a = this._calcTextareaPosition(); + this.hiddenTextarea.style.cssText = "position: absolute; top: " + a.top + "; left: " + a.left + "; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: " + a.fontSize + ";", this.hiddenTextareaContainer ? this.hiddenTextareaContainer.appendChild(this.hiddenTextarea) : e.document.body.appendChild(this.hiddenTextarea), e.util.addListener(this.hiddenTextarea, "keydown", this.onKeyDown.bind(this)), e.util.addListener(this.hiddenTextarea, "keyup", this.onKeyUp.bind(this)), e.util.addListener(this.hiddenTextarea, "input", this.onInput.bind(this)), e.util.addListener(this.hiddenTextarea, "copy", this.copy.bind(this)), e.util.addListener(this.hiddenTextarea, "cut", this.copy.bind(this)), e.util.addListener(this.hiddenTextarea, "paste", this.paste.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionstart", this.onCompositionStart.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionupdate", this.onCompositionUpdate.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionend", this.onCompositionEnd.bind(this)), !this._clickHandlerInitialized && this.canvas && (e.util.addListener(this.canvas.upperCanvasEl, "click", this.onClick.bind(this)), this._clickHandlerInitialized = !0); + }, + /** + * For functionalities on keyDown + * Map a special key to a function of the instance/prototype + * If you need different behaviour for ESC or TAB or arrows, you have to change + * this map setting the name of a function that you build on the fabric.Itext or + * your prototype. + * the map change will affect all Instances unless you need for only some text Instances + * in that case you have to clone this object and assign your Instance. + * this.keysMap = fabric.util.object.clone(this.keysMap); + * The function must be in fabric.Itext.prototype.myFunction And will receive event as args[0] + */ + keysMap: { + 9: "exitEditing", + 27: "exitEditing", + 33: "moveCursorUp", + 34: "moveCursorDown", + 35: "moveCursorRight", + 36: "moveCursorLeft", + 37: "moveCursorLeft", + 38: "moveCursorUp", + 39: "moveCursorRight", + 40: "moveCursorDown" + }, + keysMapRtl: { + 9: "exitEditing", + 27: "exitEditing", + 33: "moveCursorUp", + 34: "moveCursorDown", + 35: "moveCursorLeft", + 36: "moveCursorRight", + 37: "moveCursorRight", + 38: "moveCursorUp", + 39: "moveCursorLeft", + 40: "moveCursorDown" + }, + /** + * For functionalities on keyUp + ctrl || cmd + */ + ctrlKeysMapUp: { + 67: "copy", + 88: "cut" + }, + /** + * For functionalities on keyDown + ctrl || cmd + */ + ctrlKeysMapDown: { + 65: "selectAll" + }, + onClick: function() { + this.hiddenTextarea && this.hiddenTextarea.focus(); + }, + /** + * Handles keydown event + * only used for arrows and combination of modifier keys. + * @param {Event} e Event object + */ + onKeyDown: function(a) { + if (this.isEditing) { + var l = this.direction === "rtl" ? this.keysMapRtl : this.keysMap; + if (a.keyCode in l) + this[l[a.keyCode]](a); + else if (a.keyCode in this.ctrlKeysMapDown && (a.ctrlKey || a.metaKey)) + this[this.ctrlKeysMapDown[a.keyCode]](a); + else + return; + a.stopImmediatePropagation(), a.preventDefault(), a.keyCode >= 33 && a.keyCode <= 40 ? (this.inCompositionMode = !1, this.clearContextTop(), this.renderCursorOrSelection()) : this.canvas && this.canvas.requestRenderAll(); + } + }, + /** + * Handles keyup event + * We handle KeyUp because ie11 and edge have difficulties copy/pasting + * if a copy/cut event fired, keyup is dismissed + * @param {Event} e Event object + */ + onKeyUp: function(a) { + if (!this.isEditing || this._copyDone || this.inCompositionMode) { + this._copyDone = !1; + return; + } + if (a.keyCode in this.ctrlKeysMapUp && (a.ctrlKey || a.metaKey)) + this[this.ctrlKeysMapUp[a.keyCode]](a); + else + return; + a.stopImmediatePropagation(), a.preventDefault(), this.canvas && this.canvas.requestRenderAll(); + }, + /** + * Handles onInput event + * @param {Event} e Event object + */ + onInput: function(a) { + var l = this.fromPaste; + if (this.fromPaste = !1, a && a.stopPropagation(), !!this.isEditing) { + var c = this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText, h = this._text.length, p = c.length, y, v, x = p - h, I = this.selectionStart, P = this.selectionEnd, F = I !== P, k, V, j; + if (this.hiddenTextarea.value === "") { + this.styles = {}, this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll()); + return; + } + var Y = this.fromStringToGraphemeSelection( + this.hiddenTextarea.selectionStart, + this.hiddenTextarea.selectionEnd, + this.hiddenTextarea.value + ), X = I > Y.selectionStart; + F ? (y = this._text.slice(I, P), x += P - I) : p < h && (X ? y = this._text.slice(P + x, P) : y = this._text.slice(I, I - x)), v = c.slice(Y.selectionEnd - x, Y.selectionEnd), y && y.length && (v.length && (k = this.getSelectionStyles(I, I + 1, !1), k = v.map(function() { + return k[0]; + })), F ? (V = I, j = P) : X ? (V = P - y.length, j = P) : (V = P, j = P + y.length), this.removeStyleFromTo(V, j)), v.length && (l && v.join("") === e.copiedText && !e.disableStyleCopyPaste && (k = e.copiedTextStyle), this.insertNewStyleBlock(v, I, k)), this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll()); + } + }, + /** + * Composition start + */ + onCompositionStart: function() { + this.inCompositionMode = !0; + }, + /** + * Composition end + */ + onCompositionEnd: function() { + this.inCompositionMode = !1; + }, + // /** + // * Composition update + // */ + onCompositionUpdate: function(a) { + this.compositionStart = a.target.selectionStart, this.compositionEnd = a.target.selectionEnd, this.updateTextareaPosition(); + }, + /** + * Copies selected text + * @param {Event} e Event object + */ + copy: function() { + this.selectionStart !== this.selectionEnd && (e.copiedText = this.getSelectedText(), e.disableStyleCopyPaste ? e.copiedTextStyle = null : e.copiedTextStyle = this.getSelectionStyles(this.selectionStart, this.selectionEnd, !0), this._copyDone = !0); + }, + /** + * Pastes text + * @param {Event} e Event object + */ + paste: function() { + this.fromPaste = !0; + }, + /** + * @private + * @param {Event} e Event object + * @return {Object} Clipboard data object + */ + _getClipboardData: function(a) { + return a && a.clipboardData || e.window.clipboardData; + }, + /** + * Finds the width in pixels before the cursor on the same line + * @private + * @param {Number} lineIndex + * @param {Number} charIndex + * @return {Number} widthBeforeCursor width before cursor + */ + _getWidthBeforeCursor: function(a, l) { + var c = this._getLineLeftOffset(a), h; + return l > 0 && (h = this.__charBounds[a][l - 1], c += h.left + h.width), c; + }, + /** + * Gets start offset of a selection + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + getDownCursorOffset: function(a, l) { + var c = this._getSelectionForOffset(a, l), h = this.get2DCursorLocation(c), p = h.lineIndex; + if (p === this._textLines.length - 1 || a.metaKey || a.keyCode === 34) + return this._text.length - c; + var y = h.charIndex, v = this._getWidthBeforeCursor(p, y), x = this._getIndexOnLine(p + 1, v), I = this._textLines[p].slice(y); + return I.length + x + 1 + this.missingNewlineOffset(p); + }, + /** + * private + * Helps finding if the offset should be counted from Start or End + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + _getSelectionForOffset: function(a, l) { + return a.shiftKey && this.selectionStart !== this.selectionEnd && l ? this.selectionEnd : this.selectionStart; + }, + /** + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + getUpCursorOffset: function(a, l) { + var c = this._getSelectionForOffset(a, l), h = this.get2DCursorLocation(c), p = h.lineIndex; + if (p === 0 || a.metaKey || a.keyCode === 33) + return -c; + var y = h.charIndex, v = this._getWidthBeforeCursor(p, y), x = this._getIndexOnLine(p - 1, v), I = this._textLines[p].slice(0, y), P = this.missingNewlineOffset(p - 1); + return -this._textLines[p - 1].length + x - I.length + (1 - P); + }, + /** + * for a given width it founds the matching character. + * @private + */ + _getIndexOnLine: function(a, l) { + for (var c = this._textLines[a], h = this._getLineLeftOffset(a), p = h, y = 0, v, x, I = 0, P = c.length; I < P; I++) + if (v = this.__charBounds[a][I].width, p += v, p > l) { + x = !0; + var F = p - v, k = p, V = Math.abs(F - l), j = Math.abs(k - l); + y = j < V ? I : I - 1; + break; + } + return x || (y = c.length - 1), y; + }, + /** + * Moves cursor down + * @param {Event} e Event object + */ + moveCursorDown: function(a) { + this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorUpOrDown("Down", a); + }, + /** + * Moves cursor up + * @param {Event} e Event object + */ + moveCursorUp: function(a) { + this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorUpOrDown("Up", a); + }, + /** + * Moves cursor up or down, fires the events + * @param {String} direction 'Up' or 'Down' + * @param {Event} e Event object + */ + _moveCursorUpOrDown: function(a, l) { + var c = "get" + a + "CursorOffset", h = this[c](l, this._selectionDirection === "right"); + l.shiftKey ? this.moveCursorWithShift(h) : this.moveCursorWithoutShift(h), h !== 0 && (this.setSelectionInBoundaries(), this.abortCursorAnimation(), this._currentCursorOpacity = 1, this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Moves cursor with shift + * @param {Number} offset + */ + moveCursorWithShift: function(a) { + var l = this._selectionDirection === "left" ? this.selectionStart + a : this.selectionEnd + a; + return this.setSelectionStartEndWithShift(this.selectionStart, this.selectionEnd, l), a !== 0; + }, + /** + * Moves cursor up without shift + * @param {Number} offset + */ + moveCursorWithoutShift: function(a) { + return a < 0 ? (this.selectionStart += a, this.selectionEnd = this.selectionStart) : (this.selectionEnd += a, this.selectionStart = this.selectionEnd), a !== 0; + }, + /** + * Moves cursor left + * @param {Event} e Event object + */ + moveCursorLeft: function(a) { + this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorLeftOrRight("Left", a); + }, + /** + * @private + * @return {Boolean} true if a change happened + */ + _move: function(a, l, c) { + var h; + if (a.altKey) + h = this["findWordBoundary" + c](this[l]); + else if (a.metaKey || a.keyCode === 35 || a.keyCode === 36) + h = this["findLineBoundary" + c](this[l]); + else + return this[l] += c === "Left" ? -1 : 1, !0; + if (typeof h < "u" && this[l] !== h) + return this[l] = h, !0; + }, + /** + * @private + */ + _moveLeft: function(a, l) { + return this._move(a, l, "Left"); + }, + /** + * @private + */ + _moveRight: function(a, l) { + return this._move(a, l, "Right"); + }, + /** + * Moves cursor left without keeping selection + * @param {Event} e + */ + moveCursorLeftWithoutShift: function(a) { + var l = !0; + return this._selectionDirection = "left", this.selectionEnd === this.selectionStart && this.selectionStart !== 0 && (l = this._moveLeft(a, "selectionStart")), this.selectionEnd = this.selectionStart, l; + }, + /** + * Moves cursor left while keeping selection + * @param {Event} e + */ + moveCursorLeftWithShift: function(a) { + if (this._selectionDirection === "right" && this.selectionStart !== this.selectionEnd) + return this._moveLeft(a, "selectionEnd"); + if (this.selectionStart !== 0) + return this._selectionDirection = "left", this._moveLeft(a, "selectionStart"); + }, + /** + * Moves cursor right + * @param {Event} e Event object + */ + moveCursorRight: function(a) { + this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorLeftOrRight("Right", a); + }, + /** + * Moves cursor right or Left, fires event + * @param {String} direction 'Left', 'Right' + * @param {Event} e Event object + */ + _moveCursorLeftOrRight: function(a, l) { + var c = "moveCursor" + a + "With"; + this._currentCursorOpacity = 1, l.shiftKey ? c += "Shift" : c += "outShift", this[c](l) && (this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Moves cursor right while keeping selection + * @param {Event} e + */ + moveCursorRightWithShift: function(a) { + if (this._selectionDirection === "left" && this.selectionStart !== this.selectionEnd) + return this._moveRight(a, "selectionStart"); + if (this.selectionEnd !== this._text.length) + return this._selectionDirection = "right", this._moveRight(a, "selectionEnd"); + }, + /** + * Moves cursor right without keeping selection + * @param {Event} e Event object + */ + moveCursorRightWithoutShift: function(a) { + var l = !0; + return this._selectionDirection = "right", this.selectionStart === this.selectionEnd ? (l = this._moveRight(a, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, l; + }, + /** + * Removes characters from start/end + * start/end ar per grapheme position in _text array. + * + * @param {Number} start + * @param {Number} end default to start + 1 + */ + removeChars: function(a, l) { + typeof l > "u" && (l = a + 1), this.removeStyleFromTo(a, l), this._text.splice(a, l - a), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles(); + }, + /** + * insert characters at start position, before start position. + * start equal 1 it means the text get inserted between actual grapheme 0 and 1 + * if style array is provided, it must be as the same length of text in graphemes + * if end is provided and is bigger than start, old text is replaced. + * start/end ar per grapheme position in _text array. + * + * @param {String} text text to insert + * @param {Array} style array of style objects + * @param {Number} start + * @param {Number} end default to start + 1 + */ + insertChars: function(a, l, c, h) { + typeof h > "u" && (h = c), h > c && this.removeStyleFromTo(c, h); + var p = e.util.string.graphemeSplit(a); + this.insertNewStyleBlock(p, c, l), this._text = [].concat(this._text.slice(0, c), p, this._text.slice(h)), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles(); + } + } + ), function() { + var a = e.util.toFixed, l = / +/g; + e.util.object.extend( + e.Text.prototype, + /** @lends fabric.Text.prototype */ + { + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + _toSVG: function() { + var c = this._getSVGLeftTopOffsets(), h = this._getSVGTextAndBg(c.textTop, c.textLeft); + return this._wrapSVGTextAndBg(h); + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(c) { + return this._createBaseSVGMarkup( + this._toSVG(), + { reviver: c, noStyle: !0, withShadow: !0 } + ); + }, + /** + * @private + */ + _getSVGLeftTopOffsets: function() { + return { + textLeft: -this.width / 2, + textTop: -this.height / 2, + lineTop: this.getHeightOfLine(0) + }; + }, + /** + * @private + */ + _wrapSVGTextAndBg: function(c) { + var h = !0, p = this.getSvgTextDecoration(this); + return [ + c.textBgRects.join(""), + ' ", + c.textSpans.join(""), + ` +` + ]; + }, + /** + * @private + * @param {Number} textTopOffset Text top offset + * @param {Number} textLeftOffset Text left offset + * @return {Object} + */ + _getSVGTextAndBg: function(c, h) { + var p = [], y = [], v = c, x; + this._setSVGBg(y); + for (var I = 0, P = this._textLines.length; I < P; I++) + x = this._getLineLeftOffset(I), (this.textBackgroundColor || this.styleHas("textBackgroundColor", I)) && this._setSVGTextLineBg(y, I, h + x, v), this._setSVGTextLineText(p, I, h + x, v), v += this.getHeightOfLine(I); + return { + textSpans: p, + textBgRects: y + }; + }, + /** + * @private + */ + _createTextCharSpan: function(c, h, p, y) { + var v = c !== c.trim() || c.match(l), x = this.getSvgSpanStyles(h, v), I = x ? 'style="' + x + '"' : "", P = h.deltaY, F = "", k = e.Object.NUM_FRACTION_DIGITS; + return P && (F = ' dy="' + a(P, k) + '" '), [ + '", + e.util.string.escapeXml(c), + "" + ].join(""); + }, + _setSVGTextLineText: function(c, h, p, y) { + var v = this.getHeightOfLine(h), x = this.textAlign.indexOf("justify") !== -1, I, P, F = "", k, V, j = 0, Y = this._textLines[h], X; + y += v * (1 - this._fontSizeFraction) / this.lineHeight; + for (var Q = 0, re = Y.length - 1; Q <= re; Q++) + X = Q === re || this.charSpacing, F += Y[Q], k = this.__charBounds[h][Q], j === 0 ? (p += k.kernedWidth - k.width, j += k.width) : j += k.kernedWidth, x && !X && this._reSpaceAndTab.test(Y[Q]) && (X = !0), X || (I = I || this.getCompleteStyleDeclaration(h, Q), P = this.getCompleteStyleDeclaration(h, Q + 1), X = e.util.hasStyleChanged(I, P, !0)), X && (V = this._getStyleDeclaration(h, Q) || {}, c.push(this._createTextCharSpan(F, V, p, y)), F = "", I = P, p += j, j = 0); + }, + _pushTextBgRect: function(c, h, p, y, v, x) { + var I = e.Object.NUM_FRACTION_DIGITS; + c.push( + " +` + ); + }, + _setSVGTextLineBg: function(c, h, p, y) { + for (var v = this._textLines[h], x = this.getHeightOfLine(h) / this.lineHeight, I = 0, P = 0, F, k, V = this.getValueOfPropertyAt(h, 0, "textBackgroundColor"), j = 0, Y = v.length; j < Y; j++) + F = this.__charBounds[h][j], k = this.getValueOfPropertyAt(h, j, "textBackgroundColor"), k !== V ? (V && this._pushTextBgRect( + c, + V, + p + P, + y, + I, + x + ), P = F.left, I = F.width, V = k) : I += F.kernedWidth; + k && this._pushTextBgRect( + c, + k, + p + P, + y, + I, + x + ); + }, + /** + * Adobe Illustrator (at least CS5) is unable to render rgba()-based fill values + * we work around it by "moving" alpha channel into opacity attribute and setting fill's alpha to 1 + * + * @private + * @param {*} value + * @return {String} + */ + _getFillAttributes: function(c) { + var h = c && typeof c == "string" ? new e.Color(c) : ""; + return !h || !h.getSource() || h.getAlpha() === 1 ? 'fill="' + c + '"' : 'opacity="' + h.getAlpha() + '" fill="' + h.setAlpha(1).toRgb() + '"'; + }, + /** + * @private + */ + _getSVGLineTopOffset: function(c) { + for (var h = 0, p = 0, y = 0; y < c; y++) + h += this.getHeightOfLine(y); + return p = this.getHeightOfLine(y), { + lineTop: h, + offset: (this._fontSizeMult - this._fontSizeFraction) * p / (this.lineHeight * this._fontSizeMult) + }; + }, + /** + * Returns styles-string for svg-export + * @param {Boolean} skipShadow a boolean to skip shadow filter output + * @return {String} + */ + getSvgStyles: function(c) { + var h = e.Object.prototype.getSvgStyles.call(this, c); + return h + " white-space: pre;"; + } + } + ); + }(), function(a) { + var l = a.fabric || (a.fabric = {}); + l.Textbox = l.util.createClass(l.IText, l.Observable, { + /** + * Type of an object + * @type String + * @default + */ + type: "textbox", + /** + * Minimum width of textbox, in pixels. + * @type Number + * @default + */ + minWidth: 20, + /** + * Minimum calculated width of a textbox, in pixels. + * fixed to 2 so that an empty textbox cannot go to 0 + * and is still selectable without text. + * @type Number + * @default + */ + dynamicMinWidth: 2, + /** + * Cached array of text wrapping. + * @type Array + */ + __cachedLines: null, + /** + * Override standard Object class values + */ + lockScalingFlip: !0, + /** + * Override standard Object class values + * Textbox needs this on false + */ + noScaleCache: !1, + /** + * Properties which when set cause object to change dimensions + * @type Object + * @private + */ + _dimensionAffectingProps: l.Text.prototype._dimensionAffectingProps.concat("width"), + /** + * Use this regular expression to split strings in breakable lines + * @private + */ + _wordJoiners: /[ \t\r]/, + /** + * Use this boolean property in order to split strings that have no white space concept. + * this is a cheap way to help with chinese/japanese + * @type Boolean + * @since 2.6.0 + */ + splitByGrapheme: !1, + /** + * Unlike superclass's version of this function, Textbox does not update + * its width. + * @private + * @override + */ + initDimensions: function() { + this.__skipDimension || (this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.height = this.calcTextHeight(), this.saveState({ propertySet: "_dimensionAffectingProps" })); + }, + /** + * Generate an object that translates the style object so that it is + * broken up by visual lines (new lines and automatic wrapping). + * The original text styles object is broken up by actual lines (new lines only), + * which is only sufficient for Text / IText + * @private + */ + _generateStyleMap: function(c) { + for (var h = 0, p = 0, y = 0, v = {}, x = 0; x < c.graphemeLines.length; x++) + c.graphemeText[y] === ` +` && x > 0 ? (p = 0, y++, h++) : !this.splitByGrapheme && this._reSpaceAndTab.test(c.graphemeText[y]) && x > 0 && (p++, y++), v[x] = { line: h, offset: p }, y += c.graphemeLines[x].length, p += c.graphemeLines[x].length; + return v; + }, + /** + * Returns true if object has a style property or has it on a specified line + * @param {Number} lineIndex + * @return {Boolean} + */ + styleHas: function(c, h) { + if (this._styleMap && !this.isWrapping) { + var p = this._styleMap[h]; + p && (h = p.line); + } + return l.Text.prototype.styleHas.call(this, c, h); + }, + /** + * Returns true if object has no styling or no styling in a line + * @param {Number} lineIndex , lineIndex is on wrapped lines. + * @return {Boolean} + */ + isEmptyStyles: function(c) { + if (!this.styles) + return !0; + var h = 0, p = c + 1, y, v, x = !1, I = this._styleMap[c], P = this._styleMap[c + 1]; + I && (c = I.line, h = I.offset), P && (p = P.line, x = p === c, y = P.offset), v = typeof c > "u" ? this.styles : { line: this.styles[c] }; + for (var F in v) + for (var k in v[F]) + if (k >= h && (!x || k < y)) + for (var V in v[F][k]) + return !1; + return !0; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _getStyleDeclaration: function(c, h) { + if (this._styleMap && !this.isWrapping) { + var p = this._styleMap[c]; + if (!p) + return null; + c = p.line, h = p.offset + h; + } + return this.callSuper("_getStyleDeclaration", c, h); + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {Object} style + * @private + */ + _setStyleDeclaration: function(c, h, p) { + var y = this._styleMap[c]; + c = y.line, h = y.offset + h, this.styles[c][h] = p; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _deleteStyleDeclaration: function(c, h) { + var p = this._styleMap[c]; + c = p.line, h = p.offset + h, delete this.styles[c][h]; + }, + /** + * probably broken need a fix + * Returns the real style line that correspond to the wrapped lineIndex line + * Used just to verify if the line does exist or not. + * @param {Number} lineIndex + * @returns {Boolean} if the line exists or not + * @private + */ + _getLineStyle: function(c) { + var h = this._styleMap[c]; + return !!this.styles[h.line]; + }, + /** + * Set the line style to an empty object so that is initialized + * @param {Number} lineIndex + * @param {Object} style + * @private + */ + _setLineStyle: function(c) { + var h = this._styleMap[c]; + this.styles[h.line] = {}; + }, + /** + * Wraps text using the 'width' property of Textbox. First this function + * splits text on newlines, so we preserve newlines entered by the user. + * Then it wraps each line using the width of the Textbox by calling + * _wrapLine(). + * @param {Array} lines The string array of text that is split into lines + * @param {Number} desiredWidth width you want to wrap to + * @returns {Array} Array of lines + */ + _wrapText: function(c, h) { + var p = [], y; + for (this.isWrapping = !0, y = 0; y < c.length; y++) + p = p.concat(this._wrapLine(c[y], y, h)); + return this.isWrapping = !1, p; + }, + /** + * Helper function to measure a string of text, given its lineIndex and charIndex offset + * it gets called when charBounds are not available yet. + * @param {CanvasRenderingContext2D} ctx + * @param {String} text + * @param {number} lineIndex + * @param {number} charOffset + * @returns {number} + * @private + */ + _measureWord: function(c, h, p) { + var y = 0, v, x = !0; + p = p || 0; + for (var I = 0, P = c.length; I < P; I++) { + var F = this._getGraphemeBox(c[I], h, I + p, v, x); + y += F.kernedWidth, v = c[I]; + } + return y; + }, + /** + * Wraps a line of text using the width of the Textbox and a context. + * @param {Array} line The grapheme array that represent the line + * @param {Number} lineIndex + * @param {Number} desiredWidth width you want to wrap the line to + * @param {Number} reservedSpace space to remove from wrapping for custom functionalities + * @returns {Array} Array of line(s) into which the given text is wrapped + * to. + */ + _wrapLine: function(c, h, p, fe) { + var v = 0, x = this.splitByGrapheme, I = [], P = [], F = x ? l.util.string.graphemeSplit(c) : c.split(this._wordJoiners), k = "", V = 0, j = x ? "" : " ", Y = 0, X = 0, Q = 0, re = !0, he = this._getWidthOfCharSpacing(), fe = fe || 0; + F.length === 0 && F.push([]), p -= fe; + for (var be = 0; be < F.length; be++) + k = x ? F[be] : l.util.string.graphemeSplit(F[be]), Y = this._measureWord(k, h, V), V += k.length, v += X + Y - he, v > p && !re ? (I.push(P), P = [], v = Y, re = !0) : v += he, !re && !x && P.push(j), P = P.concat(k), X = x ? 0 : this._measureWord([j], h, V), V++, re = !1, Y > Q && (Q = Y); + return be && I.push(P), Q + fe > this.dynamicMinWidth && (this.dynamicMinWidth = Q - he + fe), I; + }, + /** + * Detect if the text line is ended with an hard break + * text and itext do not have wrapping, return false + * @param {Number} lineIndex text to split + * @return {Boolean} + */ + isEndOfWrapping: function(c) { + return !this._styleMap[c + 1] || this._styleMap[c + 1].line !== this._styleMap[c].line; + }, + /** + * Detect if a line has a linebreak and so we need to account for it when moving + * and counting style. + * @return Number + */ + missingNewlineOffset: function(c) { + return this.splitByGrapheme ? this.isEndOfWrapping(c) ? 1 : 0 : 1; + }, + /** + * Gets lines of text to render in the Textbox. This function calculates + * text wrapping on the fly every time it is called. + * @param {String} text text to split + * @returns {Array} Array of lines in the Textbox. + * @override + */ + _splitTextIntoLines: function(c) { + for (var h = l.Text.prototype._splitTextIntoLines.call(this, c), p = this._wrapText(h.lines, this.width), y = new Array(p.length), v = 0; v < p.length; v++) + y[v] = p[v].join(""); + return h.lines = y, h.graphemeLines = p, h; + }, + getMinWidth: function() { + return Math.max(this.minWidth, this.dynamicMinWidth); + }, + _removeExtraneousStyles: function() { + var c = {}; + for (var h in this._styleMap) + this._textLines[h] && (c[this._styleMap[h].line] = 1); + for (var h in this.styles) + c[h] || delete this.styles[h]; + }, + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(c) { + return this.callSuper("toObject", ["minWidth", "splitByGrapheme"].concat(c)); + } + }), l.Textbox.fromObject = function(c, h) { + var p = l.util.stylesFromArray(c.styles, c.text), y = Object.assign({}, c, { styles: p }); + return l.Object._fromObject("Textbox", y, h, "text"); + }; + }(t), function() { + var a = e.controlsUtils, l = a.scaleSkewCursorStyleHandler, c = a.scaleCursorStyleHandler, h = a.scalingEqually, p = a.scalingYOrSkewingX, y = a.scalingXOrSkewingY, v = a.scaleOrSkewActionName, x = e.Object.prototype.controls; + if (x.ml = new e.Control({ + x: -0.5, + y: 0, + cursorStyleHandler: l, + actionHandler: y, + getActionName: v + }), x.mr = new e.Control({ + x: 0.5, + y: 0, + cursorStyleHandler: l, + actionHandler: y, + getActionName: v + }), x.mb = new e.Control({ + x: 0, + y: 0.5, + cursorStyleHandler: l, + actionHandler: p, + getActionName: v + }), x.mt = new e.Control({ + x: 0, + y: -0.5, + cursorStyleHandler: l, + actionHandler: p, + getActionName: v + }), x.tl = new e.Control({ + x: -0.5, + y: -0.5, + cursorStyleHandler: c, + actionHandler: h + }), x.tr = new e.Control({ + x: 0.5, + y: -0.5, + cursorStyleHandler: c, + actionHandler: h + }), x.bl = new e.Control({ + x: -0.5, + y: 0.5, + cursorStyleHandler: c, + actionHandler: h + }), x.br = new e.Control({ + x: 0.5, + y: 0.5, + cursorStyleHandler: c, + actionHandler: h + }), x.mtr = new e.Control({ + x: 0, + y: -0.5, + actionHandler: a.rotationWithSnapping, + cursorStyleHandler: a.rotationStyleHandler, + offsetY: -40, + withConnection: !0, + actionName: "rotate" + }), e.Textbox) { + var I = e.Textbox.prototype.controls = {}; + I.mtr = x.mtr, I.tr = x.tr, I.br = x.br, I.tl = x.tl, I.bl = x.bl, I.mt = x.mt, I.mb = x.mb, I.mr = new e.Control({ + x: 0.5, + y: 0, + actionHandler: a.changeWidth, + cursorStyleHandler: l, + actionName: "resizing" + }), I.ml = new e.Control({ + x: -0.5, + y: 0, + actionHandler: a.changeWidth, + cursorStyleHandler: l, + actionName: "resizing" + }); + } + }(); +})(Oh); +class Z0r extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.footnote; + } + make(e) { + const i = this.config, r = { + text: "RAMP-PCAR", + fontFamily: "Montserrat, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif", + fill: "#000", + fontSize: 20, + top: 0 + }; + i && (r.text = i.value); + const n = Uz(r, e || {}), s = new Oh.fabric.Textbox(n.text, n); + return Promise.resolve(s); + } +} +const Q0r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Z0r +}, Symbol.toStringTag, { value: "Module" })), evr = 30, tvr = 20, ivr = 16, rvr = 12, nvr = 8, LB = 32, mot = 32, svr = 350, X2e = 20, Mq = "Montserrat, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif"; +class ovr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.legend; + } + async make(e) { + const i = this.$iApi.geo.layer.allLayersOnMap().filter((c) => !c.isCosmetic); + if (i.length === 0) + return new Oh.fabric.Group([], { + originX: "left" + }); + const r = Math.min( + i.length, + Math.floor(e.width / (svr + X2e)) || 1 + // round to 1 if floor is 0 + ), n = (e.width - (r - 1) * X2e) / r; + let s = 0; + const a = (await Promise.all( + this._makeSegments( + i, + n + ) + )).map(({ title: c, items: h }, p) => { + p > 0 && (s += evr), c.top = s, s += c.height + tvr; + const y = h.map( + ({ title: v, items: x }, I) => { + const P = []; + return v && !(h.length === 1 && v.text === c.text) && (I > 0 && (s += ivr), v.top = s, s += v.height + rvr, P.push(v)), x.forEach((F) => { + F.top = s, s += F.height + nvr; + }), [...P, ...x].filter((F) => F); + } + ); + return new Oh.fabric.Group([ + c, + ...y.flat() + ]); + }).flat(), l = this._makeColumns(a, n, r); + return Promise.resolve(l); + } + /** + * Breaks up legend layers into columns + * + * @private + * @param {fabric.Group[]} items + * @param {number} columnWidth + * @param {number} columns + * @returns {fabric.Group} + * @memberof ExportLegendFixture + */ + _makeColumns(e, i, r) { + let n = 0, s = 0, o = 0; + const a = e[e.length - 1].aCoords.bl.y / r; + return e.forEach((l, c) => { + const h = c !== e.length - 1 ? e[c + 1].top - l.top : l.height, p = o > a * (n + 1), y = s !== 0 && h > a, v = r - n > e.length - c; + (p || y || v) && n < r && (++n, s = 0), l.left = n * (i + X2e), l.top = s, s += h, o += h; + }), new Oh.fabric.Group(e, { + originX: "left" + }); + } + /** + * Create segments of the export image based on the provided layers and layer configs. + * + * @private + * @param {LayerInstance[]} layers + * @param {RampLayerConfig[]} layerConfigs + * @returns {Promise[]} + * @memberof ExportLegendFixture + */ + _makeSegments(e, i) { + return e.map(async (r) => { + const n = new Oh.fabric.Textbox(r.name, { + fontSize: 24, + fontFamily: Mq, + width: i + }), s = this._getLayerTreeIds(r); + let o = []; + return o = r.supportsSublayers ? await Promise.all( + this._makeSegmentChunks(s, r, i) + // pass list of flatenned sublayer ids + ) : await Promise.all( + this._makeSegmentChunks([-1], r, i) + // pass single -1 id so the root gets processed + ), { title: n, items: o }; + }); + } + /** + * Creates segment chunks based on the provided layer and layer entry id. + * + * Used for layers that support sublayers (e.g. MapImageLayers) + * + * @private + * @param {(number[] | string[])} ids + * @param {LayerInstance} layer + * @returns {Promise[]} + * @memberof ExportLegendFixture + */ + _makeSegmentChunks(e, i, r) { + const n = i; + return e.map(async (s) => { + const o = s === -1 ? n : n.getSublayer(s); + if (!o) + return { + title: new Oh.fabric.Textbox("ERROR", { + fontSize: 20, + fontFamily: Mq, + width: r + }), + items: [] + }; + await Promise.all(o.legend.map((h) => h.drawPromise)); + const a = o.legend, l = new Oh.fabric.Textbox(o.name, { + fontSize: 20, + fontFamily: Mq, + width: r + }), c = await Promise.all( + this._makeChunkItems(a, r) + ); + return { + title: l, + items: c + }; + }); + } + /** + * Creates layer entry symbology based on the provided symbology stack. + * + * @private + * @param {LegendSymbology[]} symbologyStack + * @returns {Promise[]} + * @memberof ExportLegendFixture + */ + _makeChunkItems(e, i) { + return e.map(async (r) => { + const n = (await avr(Oh.fabric.loadSVGFromString)(r.svgcode))[0]; + if (r.esriStandard) { + n.originY = "center", n.top = LB / 2; + const s = new Oh.fabric.Textbox(r.label, { + fontSize: 12, + fontFamily: Mq, + originY: "center", + left: mot + 20, + top: LB / 2, + width: i - mot - 20 + }); + return new Oh.fabric.Group([n, s], { + height: LB + }); + } else { + const s = new Oh.fabric.Textbox(r.label, { + fontSize: 12, + fontFamily: Mq, + originY: "center", + left: 0, + top: LB / 2, + width: i + }), o = Number(r.imgWidth), a = Number(r.imgHeight), l = Math.min(1, i / o); + return n && (n.originY = "center", n.top = a * l / 2 + LB, n.scaleToHeight(a * l), n.scaleToWidth(o * l)), new Oh.fabric.Group([s, n].filter(Boolean), { + height: a * l + LB + }); + } + }); + } + /** + * Gets flattened array of ids from layer tree + * + * @private + * @param {TreeNode} node + * @returns {number[]} + * @memberof ExportLegendFixture + */ + _getLayerTreeIds(e) { + const i = [], r = [...e.sublayers]; + for (; r.length > 0; ) { + const n = r.shift(); + n && (n.visibility && i.push(n.layerIdx), r.push(...n.sublayers)); + } + return i; + } +} +const avr = (t) => (e) => new Promise((i) => { + t(e, (r) => { + i(r); + }); +}), lvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: ovr +}, Symbol.toStringTag, { value: "Module" })); +class uvr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.map; + } + async make(e) { + const i = await this.$iApi.geo.map.takeScreenshot({ + quality: 1, + format: "png" + }), r = new Image(); + r.src = i.dataUrl; + const n = await new Promise( + (s) => r.onload = () => s(r) + ); + return new Oh.fabric.Image(n, e); + } +} +const cvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: uvr +}, Symbol.toStringTag, { value: "Module" })); +class hvr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.mapElements; + } + async make(e) { + const i = 'N', r = document.querySelector(".inner-shell"), n = this.$iApi.geo.map.getSR(); + let s = 0; + if (n.isWebMercator()) + s = 0; + else { + const c = new Sy("pole", { x: -96, y: 90 }), h = await this.$iApi.geo.proj.projectGeometry( + n, + c + ), p = this.$iApi.geo.map.mapPointToScreenPoint(h), y = { + screenX: r.clientWidth / 2, + screenY: r.clientHeight + }; + s = Math.atan( + (p.screenX - y.screenX) / (y.screenY - p.screenY) + ) * 180 / Math.PI; + } + const o = { + top: 0, + left: 0, + originX: "center", + originY: "center", + angle: s + }, a = []; + let l = new Oh.fabric.Group(); + return Oh.fabric.loadSVGFromString( + i, + () => { + l = new Oh.fabric.Group(a); + }, + (c, h) => { + a.push(h); + } + ), l.set(Uz(o, e || {})), Promise.resolve(l); + } +} +const dvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: hvr +}, Symbol.toStringTag, { value: "Module" })); +class pvr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.mapElements; + } + make(e) { + const i = this.$iApi.geo.map.caption.scaleHelper(), r = []; + for (let n = 0; n < 2; n++) { + const s = new Oh.fabric.Text( + this.$iApi.$i18n.t("export.scaleBar.approx", [ + `${this.$iApi.$i18n.n(i[n].distance, "number")}${i[n].units}` + ]), + { + fontFamily: "Montserrat, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif", + fill: "#000", + fontSize: 16, + top: n * 50, + left: 0, + originX: "left", + originY: "top" + } + ), o = new Oh.fabric.Line( + [0, n === 0 ? 30 : 40, i[n].pixels, n === 0 ? 30 : 40], + { + stroke: "black", + strokeWidth: 3 + } + ); + r.push(new Oh.fabric.Group([o, s])); + } + return Promise.resolve(new Oh.fabric.Group(r, e)); + } +} +const fvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: pvr +}, Symbol.toStringTag, { value: "Module" })); +class mvr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.timestamp; + } + make(e) { + const i = this.config, r = { + text: (/* @__PURE__ */ new Date()).toLocaleString("en-CA"), + fontFamily: "Montserrat, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif", + fill: "#000", + fontSize: 20, + top: 0, + left: 0, + originX: "left" + }; + i && (r.text = i.value); + const n = Uz(r, e || {}), s = new Oh.fabric.Textbox(n.text, n); + return Promise.resolve(s); + } +} +const gvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: mvr +}, Symbol.toStringTag, { value: "Module" })); +class yvr extends oc { + get config() { + return this.$iApi.fixture.get("export").config?.title; + } + make(e) { + const i = this.config, r = { + text: "RAMP-Map / PCAR-Carte", + // default name + fontFamily: "Montserrat, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif", + fill: "#000", + fontSize: 30, + top: 0, + left: 0, + originX: "center", + originY: "top" + }; + i && (r.text = i.value); + const n = Uz(r, e || {}), s = new Oh.fabric.Textbox(n.text, n); + return Promise.resolve(s); + } +} +const vvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: yvr +}, Symbol.toStringTag, { value: "Module" })); +var zFt = { exports: {} }; +(function(t, e) { + (function(i, r) { + r(); + })(td, function() { + function i(c, h) { + return typeof h > "u" ? h = { autoBom: !1 } : typeof h != "object" && (console.warn("Deprecated: Expected third argument to be a object"), h = { autoBom: !h }), h.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type) ? new Blob(["\uFEFF", c], { type: c.type }) : c; + } + function r(c, h, p) { + var y = new XMLHttpRequest(); + y.open("GET", c), y.responseType = "blob", y.onload = function() { + l(y.response, h, p); + }, y.onerror = function() { + console.error("could not download file"); + }, y.send(); + } + function n(c) { + var h = new XMLHttpRequest(); + h.open("HEAD", c, !1); + try { + h.send(); + } catch { + } + return 200 <= h.status && 299 >= h.status; + } + function s(c) { + try { + c.dispatchEvent(new MouseEvent("click")); + } catch { + var h = document.createEvent("MouseEvents"); + h.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), c.dispatchEvent(h); + } + } + var o = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof td == "object" && td.global === td ? td : void 0, a = o.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), l = o.saveAs || (typeof window != "object" || window !== o ? function() { + } : "download" in HTMLAnchorElement.prototype && !a ? function(c, h, p) { + var y = o.URL || o.webkitURL, v = document.createElement("a"); + h = h || c.name || "download", v.download = h, v.rel = "noopener", typeof c == "string" ? (v.href = c, v.origin === location.origin ? s(v) : n(v.href) ? r(c, h, p) : s(v, v.target = "_blank")) : (v.href = y.createObjectURL(c), setTimeout(function() { + y.revokeObjectURL(v.href); + }, 4e4), setTimeout(function() { + s(v); + }, 0)); + } : "msSaveOrOpenBlob" in navigator ? function(c, h, p) { + if (h = h || c.name || "download", typeof c != "string") + navigator.msSaveOrOpenBlob(i(c, p), h); + else if (n(c)) + r(c, h, p); + else { + var y = document.createElement("a"); + y.href = c, y.target = "_blank", setTimeout(function() { + s(y); + }); + } + } : function(c, h, p, y) { + if (y = y || open("", "_blank"), y && (y.document.title = y.document.body.innerText = "downloading..."), typeof c == "string") + return r(c, h, p); + var v = c.type === "application/octet-stream", x = /constructor/i.test(o.HTMLElement) || o.safari, I = /CriOS\/[\d]+/.test(navigator.userAgent); + if ((I || v && x || a) && typeof FileReader < "u") { + var P = new FileReader(); + P.onloadend = function() { + var V = P.result; + V = I ? V : V.replace(/^data:[^;]*;/, "data:attachment/file;"), y ? y.location.href = V : location = V, y = null; + }, P.readAsDataURL(c); + } else { + var F = o.URL || o.webkitURL, k = F.createObjectURL(c); + y ? y.location = k : location.href = k, y = null, setTimeout(function() { + F.revokeObjectURL(k); + }, 4e4); + } + }); + o.saveAs = l.saveAs = l, t.exports = l; + }); +})(zFt); +var _vr = zFt.exports; +const bvr = /* @__PURE__ */ VI(_vr); +Oh.fabric.Object.prototype.objectCaching = !1; +const Sae = 1200, gw = { + TOP: 40, + RIGHT: 40, + BOTTOM: 40, + LEFT: 40 +}; +class wvr extends oc { + fcFabric; + // download canvas will remain unscaled and only be used for download + fcFabricDownload; + options = { + runningHeight: 0, + scale: 1 + }; + /** + * Returns `ExportConfig` section of the global config file. + * + * @readonly + * @type {ExportConfig} + * @memberof ExportAPI + */ + get config() { + return super.config; + } + /** + * Parses the export config JSON snippet from the config file and save to the fixture store. + * + * @param {ExportConfig} [exportConfig] + * @memberof ExportAPI + */ + _parseConfig(e) { + if (!e) + return; + const i = BU(this.$vApp.$pinia); + i.componentSelectedState = { + title: e.title?.selected ?? !0, + map: e.map?.selected ?? !0, + mapElements: e.mapElements?.selected ?? !0, + legend: e.legend?.selected ?? !0, + footnote: e.footnote?.selected ?? !0, + timestamp: e.timestamp?.selected ?? !0 + }, i.fileName = e.fileName || "", this.handlePanelWidths(["export"]), this.handlePanelTeleports(["export"]); + } + /** + * Fetches an Export sub fixture + * + * @private + * @param {string} name + * @returns {ExportSubFixture | undefined} + * @memberof ExportAPI + */ + getSubFixture(e) { + return this.$iApi.fixture.get(e); + } + /** + * Creates an export canvas. + * + * @param {HTMLCanvasElement} canvas + * @param {number} panelWidth + * @returns {Promise} + * @memberof ExportAPI + */ + async make(e, i) { + const r = BU(this.$vApp.$pinia); + this.fcFabric = new Oh.fabric.StaticCanvas(e, { + backgroundColor: "#fff" + }), this.fcFabricDownload = new Oh.fabric.StaticCanvas(null, { + backgroundColor: "#fff" + }), this.options.runningHeight = 0; + const n = r.componentSelectedState, s = this.getSubFixture("export-title"), o = this.getSubFixture("export-map"), a = this.getSubFixture("export-scalebar"), l = this.getSubFixture("export-northarrow"), c = this.getSubFixture("export-legend"), h = this.getSubFixture("export-footnote"), p = this.getSubFixture("export-timestamp"); + let y, v, x, I, P, F, k; + const V = []; + n.title && s && (y = await s.make({ + /* text: '😸🤖🧙‍♂️🤦‍♀️🎶', */ + top: this.options.runningHeight, + left: 0, + originX: "left", + width: i, + textAlign: "center" + }), this.options.runningHeight += y.height + 40, V.push(y)), n.map && o && (v = await o.make({ + top: this.options.runningHeight + }), y && (y.left = v.width / 2, y.originX = "center"), this.options.runningHeight += v.height + 40, V.push(v)), !v && y && (y.width = Sae), this.options.scale = i / ((v?.width ?? Sae) + gw.LEFT + gw.RIGHT), n.mapElements && a && (x = await a.make({ + top: this.options.runningHeight, + left: 0 + }), this.options.runningHeight += x.height + 40, V.push(x), l && (I = await l.make({ + top: x.top, + left: i / this.options.scale + }), I.top += I.height / 2 - 20, I.left += -I.width * 2, V.push(I))), n.legend && c && (P = await c.make({ + width: c.config?.columnWidth ?? v?.width ?? Sae + }), P.top = this.options.runningHeight, this.options.runningHeight += P.height, V.push(P)), n.timestamp && p && (k = await p.make({ + top: this.options.runningHeight + 20, + width: i + }), this.options.runningHeight += k.height, V.push(k)), n.footnote && h && (F = await h.make({ + top: this.options.runningHeight, + left: i / this.options.scale + 40 + }), F.left += -F.width * 2, this.options.runningHeight += F.height + 20, V.push(F)); + const j = new Oh.fabric.Group(V, { + top: gw.TOP * this.options.scale, + left: gw.LEFT * this.options.scale + }), Y = await new Promise((X) => { + j.clone((Q) => { + X(Q); + }); + }); + Y.top = gw.TOP, Y.left = gw.LEFT, this.fcFabricDownload.add(Y), j.scale(this.options.scale), this.fcFabric.add(j), this.fcFabric.setDimensions({ + width: i, + height: (this.options.runningHeight + gw.TOP + gw.BOTTOM) * this.options.scale + }), this.fcFabric.renderAll(), this.fcFabricDownload.setDimensions({ + width: (v?.width ?? Sae) + gw.LEFT + gw.RIGHT, + height: this.options.runningHeight + gw.TOP + gw.BOTTOM + }), this.fcFabricDownload.renderAll(); + } + export() { + if (!this.fcFabric) + return; + const e = /* @__PURE__ */ new Date(), i = this.config?.fileName || `map-carte - ${e.getFullYear()}-${e.getMonth()}-${e.getDay()}, ${e.getHours()}_${e.getMinutes()}`; + bvr.saveAs( + this.fcFabricDownload.toDataURL({ + format: "png", + quality: 1 + }), + `${i}.png` + ); + } +} +const xvr = /* @__PURE__ */ Dt("div", { class: "flex items-center text-gray-400 w-full h-full hover:text-black p-4 sm:p-8" }, [ + /* @__PURE__ */ Dt("svg", { + class: "fill-current w-24 h-24 m-auto", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, [ + /* @__PURE__ */ Dt("g", null, [ + /* @__PURE__ */ Dt("path", { + d: "M0,0h24v24H0V0z", + fill: "none" + }), + /* @__PURE__ */ Dt("path", { d: "M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z" }) + ]) + ]) +], -1), Svr = ["onClick", "aria-label"], Cvr = { class: "md-icon-small inline" }, Tvr = /* @__PURE__ */ Dt("g", null, [ + /* @__PURE__ */ Dt("path", { d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" }) +], -1), Evr = [ + Tvr +], Ivr = /* @__PURE__ */ Kr({ + __name: "settings-button", + props: { + componentSelectedState: { + type: Object, + required: !0 + } + }, + emits: ["onComponentToggle"], + setup(t, { emit: e }) { + const { t: i } = Xn(), r = V0(), n = BU(), s = zr( + () => r.mobileView ? "top-end" : "left-end" + ), o = (a) => { + a.selectable && (n.toggleSelected({ + name: a.name + }), e("onComponentToggle")); + }; + return (a, l) => { + const c = Bo("dropdown-menu"), h = qn("focus-item"); + return Gr((qt(), In(c, { + position: s.value, + tooltip: gi(i)("export.menu"), + "tooltip-placement": "top" + }, { + header: Sn(() => [ + xvr + ]), + default: Sn(() => [ + (qt(!0), li(Ws, null, nu(t.componentSelectedState, (p) => (qt(), li("a", { + key: p.name, + onClick: (y) => o(p), + href: "javascript:;", + class: Gn(`text-left text-sm sm:text-base ${p.selectable ? "cursor-pointer" : "cursor-default"}`), + "aria-label": p.name + }, [ + Dt("div", Cvr, [ + (qt(), li("svg", { + height: "20", + width: "20", + viewBox: "0 0 24 24", + class: Gn(`inline mx-8 ${p.selected ? "" : "invisible"}`) + }, Evr, 2)), + Dt("span", { + class: Gn(`inline ${p.selectable ? "" : "text-gray-300"} + `) + }, vr(gi(i)(`export.menu.component.${p.name}`)), 3) + ]) + ], 10, Svr))), 128)) + ]), + _: 1 + }, 8, ["position", "tooltip"])), [ + [h] + ]); + }; + } +}), Avr = /* @__PURE__ */ Dt("div", { class: "overflow-hidden border border-gray-200" }, [ + /* @__PURE__ */ Dt("canvas", { class: "export-canvas !w-[100%]" }) +], -1), Pvr = { class: "flex" }, Ovr = ["aria-label"], Rvr = ["aria-label"], HFt = /* @__PURE__ */ Kr({ + __name: "screen", + props: { + panel: { + type: Object, + required: !0 + } + }, + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = BU(), n = Si(), s = Si(void 0), o = zr(() => uf()?.proxy?.$el), a = zr( + () => r.componentSelectedState + ), l = zr(() => { + let h = {}; + return n.value && Object.keys(a.value).forEach( + (p) => { + h[p] = { + name: p, + selected: a.value[p] ?? !1, + selectable: (n.value?.config)[p]?.selectable ?? !0 + }; + } + ), h; + }), c = ZS(300, () => { + if (!n.value) + return; + const h = o.value.querySelector( + ".export-canvas" + ); + n.value.make(h, o.value.clientWidth); + }); + return sl(() => { + n.value = i.fixture.get("export"), s.value = new ResizeObserver(() => { + c(); + }), s.value.observe(o.value); + }), gl(() => { + s.value.disconnect(); + }), (h, p) => { + const y = Bo("panel-screen"); + return qt(), In(y, { + panel: t.panel, + footer: !0 + }, { + header: Sn(() => [ + qs(vr(gi(e)("export.title")), 1) + ]), + content: Sn(() => [ + Avr + ]), + footer: Sn(() => [ + Dt("div", Pvr, [ + Dt("button", { + type: "button", + onClick: p[0] || (p[0] = (v) => n.value?.export()), + class: "bg-green-500 hover:bg-green-700 text-white font-bold py-8 px-8 sm:px-16 mr-8 sm:mr-16", + "aria-label": gi(e)("export.download") + }, vr(gi(e)("export.download")), 9, Ovr), + Dt("button", { + type: "button", + onClick: p[1] || (p[1] = (v) => gi(c)()), + class: "py-8 px-4 sm:px-16", + "aria-label": gi(e)("export.refresh") + }, vr(gi(e)("export.refresh")), 9, Rvr), + Dn(Ivr, { + componentSelectedState: l.value, + onComponentToggle: gi(c)(), + class: "ml-auto flex px-4 sm:px-8" + }, null, 8, ["componentSelectedState", "onComponentToggle"]) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), Mvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: HFt +}, Symbol.toStringTag, { value: "Module" })), Dvr = { en: { "export.title": "Export", "export.alertName": "Export", "export.download": "Download image", "export.refresh": "Refresh", "export.scaleBar.approx": "{0} approx.", "export.menu": "Settings Menu", "export.menu.component.title": "Title", "export.menu.component.map": "Map", "export.menu.component.mapElements": "North arrow and scalebar", "export.menu.component.legend": "Legend", "export.menu.component.footnote": "Footnote", "export.menu.component.timestamp": "Timestamp" }, fr: { "export.title": "Exporter", "export.alertName": "Exporter", "export.download": "Télécharger l'image", "export.refresh": "Rafraîchir", "export.scaleBar.approx": "Environ {0}", "export.menu": "Menu des paramètres", "export.menu.component.title": "Titre", "export.menu.component.map": "Carte", "export.menu.component.mapElements": "Flèche du nord et échelle graphique", "export.menu.component.legend": "Légende", "export.menu.component.footnote": "Référence", "export.menu.component.timestamp": "Horodatage" } }; +class Fvr extends wvr { + initialized() { + this.$iApi.fixture.add("export-title"), this.$iApi.fixture.add("export-map"), this.$iApi.fixture.add("export-legend"), this.$iApi.fixture.add("export-northarrow"), this.$iApi.fixture.add("export-scalebar"), this.$iApi.fixture.add("export-timestamp"), this.$iApi.fixture.add("export-footnote"); + } + added() { + this.$iApi.panel.register( + { + id: "export", + config: { + screens: { + "export-screen": ya(HFt) + }, + style: { + "flex-grow": "1", + "max-width": "800px" + }, + button: { + tooltip: "export.title", + // https://fonts.google.com/icons?selected=Material+Icons:layers&icon.query=export + icon: '' + }, + alertName: "export.alertName" + } + }, + { i18n: { messages: Dvr } } + ), this._parseConfig(this.config); + const e = this.$vApp.$watch( + () => this.config, + (i) => this._parseConfig(i) + ); + this.removed = () => { + e(), this.$iApi.fixture.get("export-title")?.remove(), this.$iApi.fixture.get("export-map")?.remove(), this.$iApi.fixture.get("export-legend")?.remove(), this.$iApi.fixture.get("export-northarrow")?.remove(), this.$iApi.fixture.get("export-scalebar")?.remove(), this.$iApi.fixture.get("export-timestamp")?.remove(), this.$iApi.fixture.get("export-footnote")?.remove(), this.$iApi.fixture.get("appbar") && Bg(this.$vApp.$pinia).removeButton("export"), BU(this.$vApp.$pinia).$reset(), this.$iApi.panel.remove("export"); + }; + } +} +const Lvr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Fvr +}, Symbol.toStringTag, { value: "Module" })), Nvr = /* @__PURE__ */ Kr({ + __name: "appbar-button", + props: { + options: { + type: Object + } + }, + setup(t) { + const e = Ys("iApi"), i = () => { + e.panel.toggle({ id: "p2", screen: "p-2-screen-2" }); + }; + return (r, n) => { + const s = Bo("appbar-button", !0); + return qt(), In(s, { + onClickFunction: i, + tooltip: "Gazebo" + }, { + default: Sn(() => [ + Dt("span", { + style: $v({ color: t.options?.colour ?? "#BDBDBD" }) + }, "G ", 4) + ]), + _: 1 + }); + }; + } +}), kvr = /* @__PURE__ */ Dt("a", { href: "javascript:;" }, "Option 1", -1), $vr = /* @__PURE__ */ Dt("a", { href: "javascript:;" }, "Option 2", -1), Bvr = /* @__PURE__ */ Dt("a", { href: "javascript:;" }, "Option 3", -1), Vvr = { class: "flex flex-col items-center" }, jvr = /* @__PURE__ */ Dt("br", null, null, -1), Gvr = /* @__PURE__ */ Dt("img", { + src: "https://c.tenor.com/RJ3ZG5beDhIAAAAC/napoleon-dynamite-napoleon.gif", + alt: "Gazebo1" +}, null, -1), Uvr = /* @__PURE__ */ Kr({ + __name: "p1-screen-1", + props: { + panel: { + type: Object, + required: !0 + } + }, + setup(t) { + return (e, i) => { + const r = Bo("panel-screen"); + return qt(), In(r, { panel: t.panel }, { + header: Sn(() => [ + qs(" Gazebo/Panel 1/Screen A ") + ]), + controls: Sn(() => [ + kvr, + $vr, + Bvr + ]), + content: Sn(() => [ + Dt("div", Vvr, [ + Dt("button", { + type: "button", + onClick: i[0] || (i[0] = (n) => t.panel.show({ screen: "p-1-screen-2" })), + class: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-8 px-16" + }, " See Gazebo 2 "), + jvr, + Gvr + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), zvr = { class: "flex flex-col items-center" }, Hvr = /* @__PURE__ */ Dt("br", null, null, -1), Wvr = /* @__PURE__ */ Dt("img", { + src: "http://nesn.com/wp-content/uploads/2014/09/jeternephew.gif", + alt: "Gazebo2" +}, null, -1), qvr = /* @__PURE__ */ Kr({ + __name: "p1-screen-2", + props: { + panel: { + type: Object, + required: !0 + } + }, + setup(t) { + return (e, i) => { + const r = Bo("panel-screen"); + return qt(), In(r, { panel: t.panel }, { + header: Sn(() => [ + qs(" Gazebo/Panel 1/Screen B ") + ]), + content: Sn(() => [ + Dt("div", zvr, [ + Dt("button", { + type: "button", + onClick: i[0] || (i[0] = (n) => t.panel.show({ screen: "p-1-screen-1" })), + class: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-8 px-16" + }, " See Gazebo 1 "), + Hvr, + Wvr + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), Yvr = { class: "flex flex-row justify-center items-center mt-16" }, Xvr = { class: "mt-16" }, Kvr = /* @__PURE__ */ Kr({ + __name: "p2-screen-2", + props: { + panel: { type: Object, required: !0 }, + greeting: { type: String } + }, + setup(t) { + const e = t, { t: i } = Xn(), r = Ys("iApi"), n = () => { + e.panel.show("p-2-screen-3"), r.event.emit("gazebo/beholdMyText", "I am a cat"); + }; + return (s, o) => { + const a = Bo("panel-screen"); + return qt(), In(a, { panel: t.panel }, { + header: Sn(() => [ + qs(" Gazebo/Panel 2/Screen B ") + ]), + content: Sn(() => [ + qs(vr(gi(i)("gz.hello2")) + " ", 1), + Dt("div", Yvr, [ + Dt("button", { + type: "button", + onClick: o[0] || (o[0] = (l) => t.panel.show({ + screen: "p-2-screen-1", + props: { greeting: "Greeting from Screen B" } + })), + class: "bg-green-500 hover:bg-green-700 text-white font-bold py-8 px-16" + }, " Switch to Screen A "), + Dt("button", { + type: "button", + onClick: o[1] || (o[1] = (l) => n()), + class: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-8 px-16 m-2" + }, " See a cat ") + ]), + Dt("p", Xvr, vr(t.greeting), 1) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), Jvr = { class: "flex flex-col items-center mt-16" }, Zvr = /* @__PURE__ */ Dt("img", { + class: "my-16", + src: "https://media.giphy.com/media/iWkHDNtcHpB5e/giphy.gif", + alt: "", + srcset: "" +}, null, -1), Qvr = /* @__PURE__ */ Dt("p", null, "Locale merging:", -1), e_r = /* @__PURE__ */ Dt("dt", null, "global locale:", -1), t_r = { class: "ml-32 font-bold" }, i_r = /* @__PURE__ */ Dt("dt", null, "fixture locale:", -1), r_r = { class: "ml-32 font-bold" }, n_r = /* @__PURE__ */ Dt("dt", null, "common panels locale:", -1), s_r = { class: "ml-32 font-bold" }, o_r = /* @__PURE__ */ Kr({ + __name: "p2-screen-3", + props: { + panel: { type: Object, required: !0 } + }, + setup(t) { + const { t: e } = Xn({ + messages: { + en: { + lang_native: "En", + who: "[me cat]" + }, + fr: { + lang_native: "Fr", + who: "[moi chat]" + } + } + }); + return (i, r) => { + const n = Bo("panel-screen"); + return qt(), In(n, { panel: t.panel }, { + header: Sn(() => [ + qs(" Gazebo/Panel 2/Screen C ") + ]), + content: Sn(() => [ + Dt("div", Jvr, [ + Dt("button", { + type: "button", + onClick: r[0] || (r[0] = (s) => t.panel.show({ + screen: "p-2-screen-1", + props: { greeting: "Greeting from Screen C" } + })), + class: "bg-green-500 hover:bg-green-700 text-white font-bold py-8 px-16" + }, " Switch to Screen A "), + Zvr, + Qvr, + Dt("dl", null, [ + e_r, + Dt("dd", t_r, vr(gi(e)("lang_native")), 1), + i_r, + Dt("dd", r_r, vr(gi(e)("gz.hello")), 1), + n_r, + Dt("dd", s_r, vr(gi(e)("who")), 1) + ]) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), got = { en: { "gz.hello": "I'm a simple panel - but from a locale file", "gz.hello2": "I'm a simple panel", "gz.alert1": "Gazebo", "gz.alert2": "Gazebo two" }, fr: { "gz.hello": 'Bonjour. Je suis un panel\\"', "gz.hello2": 'Bonjour. Je suis un panel\\"', "gz.alert1": "Gazebo", "gz.alert2": "Gazebo deux" } }, a_r = "gazebo/beholdMyText"; +class l_r extends oc { + added() { + this.$iApi.event.registerEventName(a_r), this.$iApi.component("gazebo-appbar-button", Nvr), this.$iApi.panel.register( + { + // panel-1 has examples of how not to bind things and interact with stuff; bad panel ❌ + // it generally avoids using API and goes straight to the store; fixtures/panels/screens should not do that; + id: "p1", + config: { + screens: { + "p-1-screen-1": ya(Uvr), + "p-1-screen-2": ya(qvr) + }, + style: { + "flex-grow": "1", + "max-width": "500px" + }, + alertName: "gz.alert1" + } + }, + { i18n: { messages: got } } + ), this.$iApi.panel.register( + { + // panel-2 has examples of how properly bind things and interact with stuff; good panel ✔ + // use API functions; underlying store structure might change and all the code accessing the store directly will break + id: "p2", + config: { + screens: { + /** + * // This should work: + * manually lazy-loading a screen component + */ + //'p-2-screen-1': () => import(/* webpackChunkName: "p-2-screen-1" */ `./p2-screen-1.vue`), + /** + * // This should work: + * for the demo purposes, delay resolution of a component by 2 seconds + */ + "p-2-screen-1": () => new Promise( + (e) => setTimeout( + () => Promise.resolve().then(() => QLr).then( + (i) => { + e(i); + } + ), + 2e3 + ) + ), + /** + * // This should work: + * letting the core to lazy-load a screen component; need to provide a path relative to the fixtures home folder + */ + "p-2-screen-2": ya(Kvr), + /** + * // This should work: + * returning a `VueConstructor` in a promise + */ + "p-2-screen-3": () => new Promise( + (e) => e(ya(o_r)) + ) + }, + style: { + "flex-grow": "1", + "max-width": "500px" + }, + alertName: "gz.alert2" + } + }, + { i18n: { messages: got } } + ), this.handlePanelTeleports(["p1", "p2"]); + } +} +const u_r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: l_r +}, Symbol.toStringTag, { value: "Module" })), c_r = { class: "rv-geosearch-bar h-26 mb-8 mx-8" }, h_r = ["placeholder", "value", "aria-label"], d_r = /* @__PURE__ */ Kr({ + __name: "search-bar", + setup(t) { + const { t: e } = Xn(), i = D$(), r = V0(), n = zr(() => i.searchVal), s = (a) => i.setSearchTerm(a), o = ZS(500, (a) => { + s(a); + }); + return (a, l) => (qt(), li("div", c_r, [ + Dt("input", { + type: "search", + class: "border-b w-full text-base py-8 outline-none focus:shadow-outline border-gray-600 h-full min-w-0", + placeholder: gi(e)("geosearch.searchText"), + value: n.value, + onInput: l[0] || (l[0] = (c) => gi(o)(c.target.value)), + onKeyup: l[1] || (l[1] = Dh((c) => { + gi(r).mobileView && c.target.blur(); + }, ["enter"])), + "aria-label": gi(e)("geosearch.searchText"), + onKeypress: l[2] || (l[2] = Dh(Go(() => { + }, ["prevent"]), ["enter"])), + enterkeyhint: "done" + }, null, 40, h_r) + ])); + } +}), p_r = { class: "rv-geosearch-top-filters sm:flex items-center w-full ml-8 mb-14" }, f_r = { class: "w-fit inline-block sm:w-1/2 h-26 mb-8 sm:mb-0 pr-16 sm:pr-0" }, m_r = ["value"], g_r = { + value: "", + disabled: "", + hidden: "" +}, y_r = { class: "sm:w-1/2 h-26 sm:mx-16 flex" }, v_r = ["value"], __r = { + value: "", + disabled: "", + hidden: "" +}, b_r = ["disabled", "content"], w_r = /* @__PURE__ */ Dt("div", { class: "rv-geosearch-icon" }, [ + /* @__PURE__ */ Dt("svg", { + class: "fill-current w-18 h-18", + viewBox: "0 0 23 21" + }, [ + /* @__PURE__ */ Dt("path", { d: "M 14.7574,20.8284L 17.6036,17.9822L 14.7574,15.1716L 16.1716,13.7574L 19.0178,16.568L 21.8284,13.7574L 23.2426,15.1716L 20.432,17.9822L 23.2426,20.8284L 21.8284,22.2426L 19.0178,19.3964L 16.1716,22.2426L 14.7574,20.8284 Z M 2,2L 19.9888,2.00001L 20,2.00001L 20,2.01122L 20,3.99999L 19.9207,3.99999L 13,10.9207L 13,22.909L 8.99999,18.909L 8.99999,10.906L 2.09405,3.99999L 2,3.99999L 2,2 Z " }) + ]) +], -1), x_r = [ + w_r +], S_r = /* @__PURE__ */ Kr({ + __name: "top-filters", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = D$(), n = Si([]), s = Si([]), o = Si([]), a = zr( + () => r.queryParams + ), l = zr(() => i.language), c = (v) => r.setProvince(v), h = (v) => r.setType(v), p = () => { + c({}), h({}); + }, y = () => { + r.initService( + i.language, + i.fixture.get("geosearch").config + ); + const v = n.value.find( + (I) => a.value.province === I.name + )?.code, x = s.value.find( + (I) => a.value.type === I.name + )?.code; + r.getProvinces.then((I) => { + n.value = I, c({ + province: I.find((P) => P.code === v)?.name, + forceReRun: !0 + }); + }), r.getTypes.then((I) => { + s.value = I, h({ + type: I.find((P) => P.code === x)?.name, + forceReRun: !0 + }); + }); + }; + return H0(() => { + y(), o.value.push(Fl(l, y)); + }), gl(() => { + o.value.forEach((v) => v()); + }), (v, x) => { + const I = qn("truncate"), P = qn("tippy"); + return qt(), li("div", p_r, [ + Dt("div", f_r, [ + Gr((qt(), li("select", { + class: "border-b border-b-gray-600 w-full h-full py-0 cursor-pointer", + value: a.value.province, + onChange: x[0] || (x[0] = (F) => c({ + province: F.target.value + })) + }, [ + Gr((qt(), li("option", g_r, [ + qs(vr(gi(e)("geosearch.filters.province")), 1) + ])), [ + [I] + ]), + (qt(!0), li(Ws, null, nu(n.value, (F) => Gr((qt(), li("option", { + key: F.code + }, [ + qs(vr(F.name), 1) + ])), [ + [I] + ])), 128)) + ], 40, m_r)), [ + [I] + ]) + ]), + Dt("div", y_r, [ + Gr((qt(), li("select", { + class: "border-b border-b-gray-600 w-full h-full py-0 cursor-pointer max-w-150", + value: a.value.type, + onChange: x[1] || (x[1] = (F) => h({ + type: F.target.value + })) + }, [ + Dt("option", __r, vr(gi(e)("geosearch.filters.type")), 1), + (qt(!0), li(Ws, null, nu(s.value, (F) => (qt(), li("option", { + key: F.code + }, vr(F.name), 1))), 128)) + ], 40, v_r)), [ + [I] + ]), + Gr((qt(), li("button", { + type: "button", + class: "text-gray-500 w-1/8 h-24 pl-8 pr-16 sm:pr-8 hover:text-black disabled:cursor-default disabled:text-gray-300", + disabled: !a.value.type && !a.value.province, + onClick: p, + content: gi(e)("geosearch.filters.clear") + }, x_r, 8, b_r)), [ + [P, { placement: "bottom" }] + ]) + ]) + ]); + }; + } +}), C_r = { class: "rv-geosearch-bottom-filters" }, T_r = { class: "bg-white" }, E_r = { class: "ml-8 cursor-pointer font-normal" }, I_r = ["checked"], A_r = /* @__PURE__ */ Kr({ + __name: "bottom-filters", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = D$(), n = zr(() => r.resultsVisible), s = ZS(300, (c) => { + a(c).then((h) => { + o({ + extent: h, + visible: n.value + }); + }); + }), o = (c) => { + r.setMapExtent(c); + }, a = async (c) => c.sr.wkid === 4326 ? c : await i.geo.proj.projectGeometry(4326, c), l = (c) => { + a(i.geo.map.getExtent()).then((h) => { + o({ + extent: h, + visible: c + }); + }); + }; + return sl(() => { + i.event.on( + an.MAP_EXTENTCHANGE, + s, + "geosearch_map_extent" + ); + }), gl(() => { + i.event.off("geosearch_map_extent"); + }), (c, h) => (qt(), li("div", C_r, [ + Dt("div", T_r, [ + Dt("label", E_r, [ + Dt("input", { + type: "checkbox", + class: "border-2 mx-8 border-gray-600 cursor-pointer", + checked: n.value, + onChange: h[0] || (h[0] = (p) => l( + p.target.checked + )), + onKeypress: h[1] || (h[1] = Dh(Go(() => { + }, ["prevent"]), ["enter"])) + }, null, 40, I_r), + qs(vr(gi(e)("geosearch.visible")), 1) + ]) + ]) + ])); + } +}); +const P_r = {}, O_r = { class: "w-full h-6 relative overflow-hidden rounded-full indeterminate mb-14" }, R_r = { + class: "h-full progressbar bg-blue-800 rounded-full top-0", + "aria-valuemin": "0", + "aria-valuemax": "100" +}, M_r = { class: "flex items-center h-full" }; +function D_r(t, e) { + return qt(), li("div", O_r, [ + Dt("div", R_r, [ + Dt("span", M_r, [ + _m(t.$slots, "default", {}, void 0, !0) + ]) + ]) + ]); +} +const F_r = /* @__PURE__ */ ol(P_r, [["render", D_r], ["__scopeId", "data-v-343c5c69"]]), L_r = { class: "flex flex-col h-full" }, N_r = { + key: 1, + class: "text-red-900 text-xs px-8 mb-10" +}, k_r = { + key: 2, + class: "px-8 mb-10 truncate" +}, $_r = { class: "relative h-48" }, B_r = { class: "font-bold text-blue-600" }, V_r = { + key: 3, + class: "rv-results-list flex-grow mb-5 border-t border-b border-gray-600 overflow-y-auto" +}, j_r = ["onClick"], G_r = { class: "rv-result-description px-8" }, U_r = { class: "flex-1 text-left truncate font-bold" }, z_r = ["innerHTML"], H_r = { + key: 0, + class: "text-gray-600 text-sm" +}, W_r = { + key: 0, + class: "flex-1 text-left truncate text-sm" +}, WFt = /* @__PURE__ */ Kr({ + __name: "screen", + props: { + panel: { + type: Object + } + }, + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = D$(), n = zr(() => r.searchVal), s = zr(() => r.searchResults), o = zr(() => r.loadingResults), a = zr(() => r.failedServices), l = (h) => { + let p = new gy( + "zoomies", + [ + [ + [h.bbox[0], h.bbox[1]], + [h.bbox[0], h.bbox[3]], + [h.bbox[2], h.bbox[3]], + [h.bbox[2], h.bbox[1]], + [h.bbox[0], h.bbox[1]] + ] + ], + pl.latLongSR(), + !0 + ); + i.geo.map.zoomMapTo(p); + }, c = (h, p) => { + const y = h.replace( + new RegExp(`${n.value}`, "gi"), + (v) => '' + v + "" + ); + return p ? y + "," : y; + }; + return (h, p) => { + const y = Bo("panel-screen"), v = qn("truncate"), x = qn("focus-item"), I = qn("focus-list"); + return qt(), In(y, { panel: t.panel }, { + header: Sn(() => [ + qs(vr(gi(e)("geosearch.title")), 1) + ]), + content: Sn(() => [ + Dt("div", L_r, [ + Dn(d_r), + Dn(S_r), + o.value ? (qt(), In(F_r, { + key: 0, + class: "flex-none" + })) : Xr("", !0), + a.value.length > 0 && !o.value ? (qt(), li("div", N_r, vr(gi(e)("geosearch.serviceError", { + services: a.value.join(", ") + })), 1)) : Xr("", !0), + n.value && s.value.length === 0 && !o.value ? (qt(), li("div", k_r, [ + Dt("span", $_r, [ + qs(vr(gi(e)("geosearch.noResults")), 1), + Dt("span", B_r, '"' + vr(n.value) + '"', 1) + ]) + ])) : Xr("", !0), + s.value.length > 0 ? Gr((qt(), li("ul", V_r, [ + (qt(!0), li(Ws, null, nu(s.value, (P, F) => (qt(), li("li", { + class: "relative h-56", + key: F + }, [ + Gr((qt(), li("button", { + type: "button", + class: "absolute inset-0 h-full w-full hover:bg-gray-300 default-focus-style", + onClick: (k) => l(P), + style: { "border-bottom": "1px solid lightgray" } + }, [ + Gr((qt(), li("div", G_r, [ + Dt("div", U_r, [ + Dt("span", { + innerHTML: c( + P.name, + P.location.province + ) + }, null, 8, z_r), + P.location.province ? (qt(), li("span", H_r, vr(P.location.city ? " " + P.location.city + ", " + P.location.province.abbr : " " + P.location.province.abbr), 1)) : Xr("", !0) + ]), + P.type ? (qt(), li("div", W_r, vr(P.type), 1)) : Xr("", !0) + ])), [ + [v] + ]) + ], 8, j_r)), [ + [x, "show-truncate"] + ]) + ]))), 128)) + ])), [ + [I] + ]) : Xr("", !0), + Dn(A_r, { class: "mt-auto" }) + ]) + ]), + _: 1 + }, 8, ["panel"]); + }; + } +}), q_r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: WFt +}, Symbol.toStringTag, { value: "Module" })); +class Y_r extends oc { +} +const X_r = /* @__PURE__ */ Dt("svg", { + class: "fill-current w-32 h-20", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, [ + /* @__PURE__ */ Dt("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }), + /* @__PURE__ */ Dt("path", { + d: "M0 0h24v24H0z", + fill: "none" + }) +], -1), K_r = /* @__PURE__ */ Kr({ + __name: "nav-button", + setup(t) { + const { t: e } = Xn(), i = Ys("iApi"), r = () => { + i?.panel.toggle("geosearch"); + }; + return (n, s) => { + const o = Bo("mapnav-button"); + return qt(), In(o, { + onClickFunction: r, + tooltip: gi(e)("geosearch.title") + }, { + default: Sn(() => [ + X_r + ]), + _: 1 + }, 8, ["tooltip"]); + }; + } +}), J_r = { en: { "geosearch.title": "Geolocation Search", "geosearch.noResults": "No results to show for ", "geosearch.searchText": "Search for a location...", "geosearch.visible": "Visible on map", "geosearch.filters.province": "Province", "geosearch.filters.type": "Type", "geosearch.filters.clear": "Clear filters", "geosearch.serviceError": "No response from {services} service(s)" }, fr: { "geosearch.title": "Recherche géolocalisée", "geosearch.noResults": "Aucun résultat à afficher pour ", "geosearch.searchText": "Rechercher un emplacement...", "geosearch.visible": "Visible sur la carte", "geosearch.filters.province": "Province", "geosearch.filters.type": "Type", "geosearch.filters.clear": "Effacer les filtres", "geosearch.serviceError": "Pas de réponse de la part des services de {services}" } }; +class Z_r extends Y_r { + async added() { + D$(this.$vApp.$pinia).initService(this.$iApi.language, this.config), this.$iApi.component("geosearch-nav-button", K_r), this.$iApi.panel.register( + { + id: "geosearch", + config: { + screens: { + "geosearch-component": ya(WFt) + }, + button: { + tooltip: "geosearch.title", + icon: '' + }, + alertName: "geosearch.title" + } + }, + { i18n: { messages: J_r } } + ), this.handlePanelTeleports(["geosearch"]); + } + removed() { + this.$iApi.fixture.get("appbar") && Bg(this.$vApp.$pinia).removeButton("geosearch"), this.$iApi.fixture.get("mapnav") && $4(this.$vApp.$pinia).removeItem("geosearch"), D$(this.$vApp.$pinia).$reset(), this.$iApi.panel.remove("geosearch"); + } +} +const Q_r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: Z_r +}, Symbol.toStringTag, { value: "Module" })); +class qFt { + constructor(e) { + this.columnConfig = e, this._field = e?.field, this._title = e?.title, this._visible = e.visible ?? !0, this._width = e?.width, this._sort = e.sort ?? "none", this._searchable = e.searchable ?? !0, this._filter = { + type: e?.filter?.type ?? "string", + value: e?.filter?.value ?? "", + min: e?.filter?.min ?? null, + max: e?.filter?.max ?? null, + static: e?.filter?.static ?? !1 + }, this._template = e.template ?? ""; + } + /** + * Returns the field of the column. + * + * @memberof ColumnStateManager + */ + get field() { + return this._field; + } + /** + * Returns the title of the column. + * + * @memberof ColumnStateManager + */ + get title() { + return this._title; + } + /** + * Sets the title of the column. + * + * @memberof ColumnStateManager + */ + set title(e) { + this._title = e; + } + /** + * Returns whether column is visible. + * + * @memberof ColumnStateManager + */ + get visible() { + return this._visible; + } + /** + * Sets column visibility. + * + * @memberof ColumnStateManager + */ + set visible(e) { + this._visible = e; + } + /** + * Returns the column width. + * + * @memberof ColumnStateManager + */ + get width() { + return this._width; + } + /** + * Sets the column width. + * + * @memberof ColumnStateManager + */ + set width(e) { + this._width = e; + } + /** + * Returns whether the column is sorted. + * + * @memberof ColumnStateManager + */ + get sort() { + return this._sort; + } + /** + * Sets the column to be sorted. + * + * @memberof ColumnStateManager + */ + set sort(e) { + this._sort = e; + } + /** + * Returns whether the column search is currently enabled. + * + * @memberof ColumnStateManager + */ + get searchable() { + return this._searchable; + } + /** + * Sets the column search to enabled or disabled. + * + * @memberof ColumnStateManager + */ + set searchable(e) { + this._searchable = e; + } + /** + * Returns the filter configuration of the column. + * + * @memberof ColumnStateManager + */ + get filter() { + return this._filter; + } + /** + * Sets the filter configuration of the column. + * + * @memberof ColumnStateManager + */ + set filter(e) { + this._filter = e; + } + /** + * Sets the vue template of the column + * @memberof ColumnStateManager + */ + set template(e) { + this._template = e; + } + get template() { + return this._template; + } +} +class Fce { + constructor(e) { + this.state = e ?? {}, this._title = e?.title ?? "", this._showFilter = e?.showFilter ?? !0, this._filterByExtent = e?.filterByExtent ?? !1, this._columns = {}, this._open = !0, this._filtered = !0, this._search = e?.search ?? !0, this._searchFilter = e?.searchFilter ?? "", this._applyToMap = e?.applyToMap ?? !1, this._controls = e?.controls ?? ["zoom", "details"], this.parsecolumns(); + } + /** + * Parses any given configurations of columns. + * + * @memberof TableStateManager + */ + parsecolumns() { + this.state.columns && this.state.columns.forEach((e) => { + this._columns[e.field] = new qFt( + e + ); + }); + } + /** + * Returns the stored filter value for the given column field. + * + * @param {*} colDefField + * @param {string} range + * @returns {string | number} + * @memberof TableStateManager + */ + getColumnFilterValue(e, i) { + const r = this._columns[e].filter; + return i === "min" ? r.min : i === "max" ? r.max : r.value; + } + /** + * Saves the current value of the filter for the given column field. + * + * @param {*} colDefField + * @param {(string | number)} filterValue + * @param {string} range + * @memberof TableStateManager + */ + setColumnFilterValue(e, i, r) { + let n = i; + if (i && typeof i == "string") { + const s = /[(!"#$%&'+,.\\/:;<=>?@[\]^`{|}~)]/g; + n = i.replace(s, "\\$&"); + } + r === "min" ? this._columns[e].filter.min = n : r === "max" ? this._columns[e].filter.max = n : this._columns[e].filter.value = n, this._columns[e].filter.value !== "" ? this._filtered = !0 : this._checkFilters(); + } + /** + * Clears all saved filters. + * + * @memberof TableStateManager + */ + clearFilters() { + Object.entries(this._columns).forEach(([, e]) => { + e.filter.static || (e.filter.min = null, e.filter.max = null, e.filter.value = ""); + }), this._filterByExtent = !1, this._filtered = !1, this._searchFilter = ""; + } + _checkFilters() { + this._filtered = Object.values(this._columns).some((e) => e.filter.value !== "" || e.filter.min || e.filter.max); + } + get filtered() { + return this._filtered; + } + /** + * Returns the title of the datatable. + * + * @memberof TableStateManager + */ + get title() { + return this._title; + } + /** + * Sets the title of the datatable. + * + * @memberof TableStateManager + */ + set title(e) { + this._title = e; + } + /** + * Returns whether column filters are enabled for the table. + * + * @memberof TableStateManager + */ + get colFilter() { + return this._showFilter; + } + /** + * Sets column filters to on or off. + * + * @memberof TableStateManager + */ + set colFilter(e) { + this._showFilter = e; + } + /** + * Returns whether the grid is filtering by map extent. + * + * @memberof TableStateManager + */ + get filterByExtent() { + return this._filterByExtent; + } + /** + * Sets the extent filter to on or off. + * + * @memberof TableStateManager + */ + set filterByExtent(e) { + this._filterByExtent = e; + } + /** + * Returns whether the grid is currently open. + * + * @memberof TableStateManager + */ + get open() { + return this._open; + } + /** + * Sets the grid status to open or closed. + * + * @memberof TableStateManager + */ + set open(e) { + this._open = e; + } + /** + * Returns whether the global search is currently enabled. + * + * @memberof TableStateManager + */ + get search() { + return this._search; + } + /** + * Sets the global search to enabled or disabled. + * + * @memberof TableStateManager + */ + set search(e) { + this._search = e; + } + /** + * Returns the value of the global search. + * + * @memberof TableStateManager + */ + get searchFilter() { + return this._searchFilter; + } + /** + * Sets the value of the global search. + * + * @memberof TableStateManager + */ + set searchFilter(e) { + this._searchFilter = e; + } + /** + * Returns whether grid filters should apply to the map. + * + * @memberof TableStateManager + */ + get applyToMap() { + return this._applyToMap; + } + /** + * Sets the grid to enable or disable filtering results on the map. + * + * @memberof TableStateManager + */ + set applyToMap(e) { + this._applyToMap = e; + } + /** + * Returns an array of column configs. + * + * @memberof TableStateManager + */ + get columns() { + return this._columns; + } + /** + * Sets column configs + * + * @memberof TableStateManager + */ + set columns(e) { + this._columns = e; + } + /** + * Returns an array of grid action buttons. + * + * @memberof TableStateManager + */ + get controls() { + return this._controls; + } +} +class e1r extends oc { + gridStore = O$(this.$vApp.$pinia); + /** + * Open the grid with the given id. + * + * @param {string} id + * @param {boolean} [open] force panel open or closed + * @memberof GridAPI + */ + toggleGrid(e, i) { + const r = this.gridStore.getGridId(e); + if (!r) { + const o = this.getLayerFixtureConfigs(); + this.gridStore.addGrid({ + id: e, + layerIds: [e], + state: new Fce(o[e]), + fieldMap: {} + }); + } + const n = this.gridStore.currentId; + this.gridStore.currentId = r ?? e; + const s = this.$iApi.panel.get("grid"); + if (i === !1) { + s.close(); + return; + } + !s.isOpen || !s.isVisible ? this.$iApi.panel.open("grid") : n !== e || i === !0 ? s.show({ screen: "grid-screen", props: { key: e } }) : s.close(); + } + /** + * Parses the grid config JSON snippet from the config file. + * + * @param {any} config + * @memberof GridAPI + */ + _parseConfig(e) { + this.handlePanelWidths(["grid"]), this.handlePanelTeleports(["grid"]); + const i = this.getLayerFixtureConfigs(); + e && e.mergeGrids && e.mergeGrids.forEach((r) => { + const n = [], { gridId: s, layers: o, fieldMap: a, options: l } = r; + o.forEach((p) => { + p.sublayers ? p.sublayers?.forEach((y) => { + n.push(`${p.layerId}-${y}`), delete i[`${p.layerId}-${y}`]; + }) : (n.push(p.layerId), delete i[p.layerId]); + }); + const c = {}; + a?.forEach((p) => { + p.sources.forEach((y) => { + c[y] = p.field; + }); + }); + const h = { + id: s, + layerIds: n, + state: new Fce(l), + fieldMap: c + }; + this.gridStore.addGrid(h); + }), Object.keys(i).forEach((r) => { + const n = { + id: r, + layerIds: [r], + state: new Fce(i[r]), + fieldMap: {} + }; + this.gridStore.addGrid(n); + }); + } +} +var NS = {}; +/** + * ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v27.3.0 + * @link https://www.ag-grid.com/ +' * @license MIT + */ +(function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function e(M) { + return M == null || M === "" ? null : M; + } + function i(M, f) { + return f === void 0 && (f = !1), M != null && (M !== "" || f); + } + function r(M) { + return !i(M); + } + function n(M) { + return M == null || M.length === 0; + } + function s(M) { + return M != null && typeof M.toString == "function" ? M.toString() : null; + } + function o(M) { + if (M !== void 0) { + if (M === null || M === "") + return null; + if (typeof M == "number") + return isNaN(M) ? void 0 : M; + var f = parseInt(M, 10); + return isNaN(f) ? void 0 : f; + } + } + function a(M) { + if (M !== void 0) + return M === null || M === "" ? !1 : typeof M == "boolean" ? M : /true/i.test(M); + } + function l(M) { + if (!(M == null || M === "")) + return M; + } + function c(M, f) { + return M == null && f == null ? !0 : M == null && f != null || M != null && f == null ? !1 : M === f; + } + function h(M, f) { + var d = M ? JSON.stringify(M) : null, g = f ? JSON.stringify(f) : null; + return d === g; + } + function p(M, f, d) { + d === void 0 && (d = !1); + var g = M == null, S = f == null; + if (M && M.toNumber && (M = M.toNumber()), f && f.toNumber && (f = f.toNumber()), g && S) + return 0; + if (g) + return -1; + if (S) + return 1; + function O(z, te) { + return z > te ? 1 : z < te ? -1 : 0; + } + if (typeof M != "string" || !d) + return O(M, f); + try { + return M.localeCompare(f); + } catch { + return O(M, f); + } + } + function y(M) { + if (M instanceof Set || M instanceof Map) { + var f = []; + return M.forEach(function(d) { + return f.push(d); + }), f; + } + return Object.values(M); + } + var v = /* @__PURE__ */ Object.freeze({ + makeNull: e, + exists: i, + missing: r, + missingOrEmpty: n, + toStringOrNull: s, + attrToNumber: o, + attrToBoolean: a, + attrToString: l, + referenceCompare: c, + jsonEquals: h, + defaultComparator: p, + values: y + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var x = ( + /** @class */ + function() { + function M() { + this.existingKeys = {}; + } + return M.prototype.addExistingKeys = function(f) { + for (var d = 0; d < f.length; d++) + this.existingKeys[f[d]] = !0; + }, M.prototype.getUniqueKey = function(f, d) { + f = s(f); + for (var g = 0; ; ) { + var S = void 0; + if (f ? (S = f, g !== 0 && (S += "_" + g)) : d ? (S = d, g !== 0 && (S += "_" + g)) : S = "" + g, !this.existingKeys[S]) + return this.existingKeys[S] = !0, S; + g++; + } + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function I(M, f) { + M != null && (Array.isArray(M) ? M.forEach(function(d, g) { + return f("" + g, d); + }) : Object.keys(M).forEach(function(d) { + return f(d, M[d]); + })); + } + function P(M) { + for (var f = {}, d = Object.keys(M), g = 0; g < d.length; g++) { + var S = d[g], O = M[S]; + f[S] = O; + } + return f; + } + function F(M) { + return JSON.parse(JSON.stringify(M)); + } + function k(M, f) { + if (M) { + var d = M, g = {}; + return Object.keys(d).forEach(function(S) { + if (!(f && f.indexOf(S) >= 0)) { + var O = d[S], z = ce(O) && O.constructor === Object; + z ? g[S] = k(O) : g[S] = O; + } + }), g; + } + } + function V(M, f) { + return M[f]; + } + function j(M, f, d) { + M[f] = d; + } + function Y(M, f) { + for (var d = [], g = 2; g < arguments.length; g++) + d[g - 2] = arguments[g]; + d.forEach(function(S) { + return X(M, f, S); + }); + } + function X(M, f, d, g) { + var S = V(M, d); + S !== void 0 && j(f, d, g ? g(S) : S); + } + function Q(M) { + var f = {}; + return M.filter(function(d) { + return d != null; + }).forEach(function(d) { + Object.keys(d).forEach(function(g) { + return f[g] = null; + }); + }), Object.keys(f); + } + function re(M) { + if (!M) + return []; + var f = Object; + if (typeof f.values == "function") + return f.values(M); + var d = []; + for (var g in M) + M.hasOwnProperty(g) && M.propertyIsEnumerable(g) && d.push(M[g]); + return d; + } + function he(M, f, d, g) { + d === void 0 && (d = !0), g === void 0 && (g = !1), i(f) && I(f, function(S, O) { + var z = M[S]; + if (z !== O) { + if (g) { + var te = z == null && O != null; + if (te) { + var Fe = typeof O == "object" && O.constructor === Object, ze = Fe; + ze && (z = {}, M[S] = z); + } + } + ce(O) && ce(z) && !Array.isArray(z) ? he(z, O, d, g) : (d || O !== void 0) && (M[S] = O); + } + }); + } + function fe(M) { + return r(M) || Object.keys(M).length === 0; + } + function be(M, f, d) { + if (M == null) + return d; + for (var g = f.split("."), S = M; g.length > 1; ) + if (S = S[g.shift()], S == null) + return d; + var O = S[g[0]]; + return O ?? d; + } + function Se(M, f, d) { + if (M != null) { + for (var g = f.split("."), S = M; g.length > 1; ) + if (S = S[g.shift()], S == null) + return; + S[g[0]] = d; + } + } + function Me(M) { + return Object.freeze(M), y(M).forEach(function(f) { + (ce(f) || typeof f == "function") && Me(f); + }), M; + } + function ke(M, f, d) { + if (!(!f || !M)) { + if (!d) + return M[f]; + for (var g = f.split("."), S = M, O = 0; O < g.length; O++) { + if (S == null) + return; + S = S[g[O]]; + } + return S; + } + } + function J(M, f) { + Object.keys(M).forEach(function(S) { + var O = M[S]; + typeof O == "object" && (M[S] = void 0); + }); + var d = Object.getPrototypeOf(M), g = {}; + Object.keys(d).forEach(function(S) { + var O = d[S]; + if (typeof O == "function") { + var z = function() { + console.warn("AG Grid: " + f + " function " + S + `() cannot be called as the grid has been destroyed. + Please don't call grid API functions on destroyed grids - as a matter of fact you shouldn't + be keeping the API reference, your application has a memory leak! Remove the API reference + when the grid is destroyed.`); + }; + g[S] = { value: z, writable: !0 }; + } + }), Object.defineProperties(M, g); + } + function ce(M) { + return typeof M == "object" && M !== null; + } + var xe = /* @__PURE__ */ Object.freeze({ + iterateObject: I, + cloneObject: P, + deepCloneObject: F, + deepCloneDefinition: k, + getProperty: V, + setProperty: j, + copyPropertiesIfPresent: Y, + copyPropertyIfPresent: X, + getAllKeysInObjects: Q, + getAllValuesInObject: re, + mergeDeep: he, + missingOrEmptyObject: fe, + get: be, + set: Se, + deepFreeze: Me, + getValueUsingField: ke, + removeAllReferences: J, + isNonNullObject: ce + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Pe = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, Oe = /([^\s,]+)/g, Re = {}; + function Ge(M, f) { + Re[f] || (M(), Re[f] = !0); + } + function je(M) { + if (M.name) + return M.name; + var f = /function\s+([^\(]+)/.exec(M.toString()); + return f && f.length === 2 ? f[1].trim() : null; + } + function et(M) { + var f = M.toString().replace(Pe, ""); + return f.slice(f.indexOf("(") + 1, f.indexOf(")")).match(Oe) || []; + } + function Qe(M) { + return !!(M && M.constructor && M.call && M.apply); + } + function tt(M) { + Tt(M, 400); + } + var ft = [], Mt = !1; + function kt(M) { + ft.push(M), !Mt && (Mt = !0, window.setTimeout(function() { + var f = ft.slice(); + ft.length = 0, Mt = !1, f.forEach(function(d) { + return d(); + }); + }, 0)); + } + function Tt(M, f) { + f === void 0 && (f = 0), M.length > 0 && window.setTimeout(function() { + return M.forEach(function(d) { + return d(); + }); + }, f); + } + function It(M, f, d) { + d === void 0 && (d = !1); + var g; + return function() { + for (var S = [], O = 0; O < arguments.length; O++) + S[O] = arguments[O]; + var z = this, te = d && !g; + window.clearTimeout(g), g = window.setTimeout(function() { + g = null, d || M.apply(z, S); + }, f), te && M.apply(z, S); + }; + } + function Nt(M, f) { + var d = 0; + return function() { + for (var g = [], S = 0; S < arguments.length; S++) + g[S] = arguments[S]; + var O = this, z = (/* @__PURE__ */ new Date()).getTime(); + z - d < f || (d = z, M.apply(O, g)); + }; + } + function nt(M, f, d, g) { + d === void 0 && (d = 100); + var S = (/* @__PURE__ */ new Date()).getTime(), O = null, z = !1, te = function() { + var Fe = (/* @__PURE__ */ new Date()).getTime() - S > d; + (M() || Fe) && (f(), z = !0, O != null && (window.clearInterval(O), O = null), Fe && g && console.warn(g)); + }; + te(), z || (O = window.setInterval(te, 10)); + } + function Ee() { + for (var M = [], f = 0; f < arguments.length; f++) + M[f] = arguments[f]; + return function(d) { + return M.reduce(function(g, S) { + return S(g); + }, d); + }; + } + function Be(M) { + M && M(); + } + var at = /* @__PURE__ */ Object.freeze({ + doOnce: Ge, + getFunctionName: je, + getFunctionParameters: et, + isFunction: Qe, + executeInAWhile: tt, + executeNextVMTurn: kt, + executeAfter: Tt, + debounce: It, + throttle: Nt, + waitUntil: nt, + compose: Ee, + callIfPresent: Be + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var wt = ( + /** @class */ + function() { + function M(f, d) { + if (this.beanWrappers = {}, this.destroyed = !1, !(!f || !f.beanClasses)) { + this.contextParams = f, this.logger = d, this.logger.log(">> creating ag-Application Context"), this.createBeans(); + var g = this.getBeanInstances(); + this.wireBeans(g), this.logger.log(">> ag-Application Context ready - component is alive"); + } + } + return M.prototype.getBeanInstances = function() { + return y(this.beanWrappers).map(function(f) { + return f.beanInstance; + }); + }, M.prototype.createBean = function(f, d) { + if (!f) + throw Error("Can't wire to bean since it is null"); + return this.wireBeans([f], d), f; + }, M.prototype.wireBeans = function(f, d) { + this.autoWireBeans(f), this.methodWireBeans(f), this.callLifeCycleMethods(f, "preConstructMethods"), i(d) && f.forEach(d), this.callLifeCycleMethods(f, "postConstructMethods"); + }, M.prototype.createBeans = function() { + var f = this; + this.contextParams.beanClasses.forEach(this.createBeanWrapper.bind(this)), I(this.beanWrappers, function(g, S) { + var O; + S.bean.__agBeanMetaData && S.bean.__agBeanMetaData.autowireMethods && S.bean.__agBeanMetaData.autowireMethods.agConstructor && (O = S.bean.__agBeanMetaData.autowireMethods.agConstructor); + var z = f.getBeansForParameters(O, S.bean.name), te = st(S.bean, z); + S.beanInstance = te; + }); + var d = Object.keys(this.beanWrappers).join(", "); + this.logger.log("created beans: " + d); + }, M.prototype.createBeanWrapper = function(f) { + var d = f.__agBeanMetaData; + if (!d) { + var g = void 0; + f.prototype.constructor ? g = je(f.prototype.constructor) : g = "" + f, console.error("Context item " + g + " is not a bean"); + return; + } + var S = { + bean: f, + beanInstance: null, + beanName: d.beanName + }; + this.beanWrappers[d.beanName] = S; + }, M.prototype.autoWireBeans = function(f) { + var d = this; + f.forEach(function(g) { + d.forEachMetaDataInHierarchy(g, function(S, O) { + var z = S.agClassAttributes; + z && z.forEach(function(te) { + var Fe = d.lookupBeanInstance(O, te.beanName, te.optional); + g[te.attributeName] = Fe; + }); + }); + }); + }, M.prototype.methodWireBeans = function(f) { + var d = this; + f.forEach(function(g) { + d.forEachMetaDataInHierarchy(g, function(S, O) { + I(S.autowireMethods, function(z, te) { + if (z !== "agConstructor") { + var Fe = d.getBeansForParameters(te, O); + g[z].apply(g, Fe); + } + }); + }); + }); + }, M.prototype.forEachMetaDataInHierarchy = function(f, d) { + for (var g = Object.getPrototypeOf(f); g != null; ) { + var S = g.constructor; + if (S.hasOwnProperty("__agBeanMetaData")) { + var O = S.__agBeanMetaData, z = this.getBeanName(S); + d(O, z); + } + g = Object.getPrototypeOf(g); + } + }, M.prototype.getBeanName = function(f) { + if (f.__agBeanMetaData && f.__agBeanMetaData.beanName) + return f.__agBeanMetaData.beanName; + var d = f.toString(), g = d.substring(9, d.indexOf("(")); + return g; + }, M.prototype.getBeansForParameters = function(f, d) { + var g = this, S = []; + return f && I(f, function(O, z) { + var te = g.lookupBeanInstance(d, z); + S[Number(O)] = te; + }), S; + }, M.prototype.lookupBeanInstance = function(f, d, g) { + if (g === void 0 && (g = !1), d === "context") + return this; + if (this.contextParams.providedBeanInstances && this.contextParams.providedBeanInstances.hasOwnProperty(d)) + return this.contextParams.providedBeanInstances[d]; + var S = this.beanWrappers[d]; + return S ? S.beanInstance : (g || console.error("AG Grid: unable to find bean reference " + d + " while initialising " + f), null); + }, M.prototype.callLifeCycleMethods = function(f, d) { + var g = this; + f.forEach(function(S) { + return g.callLifeCycleMethodsOnBean(S, d); + }); + }, M.prototype.callLifeCycleMethodsOnBean = function(f, d, g) { + var S = {}; + this.forEachMetaDataInHierarchy(f, function(z) { + var te = z[d]; + te && te.forEach(function(Fe) { + Fe != g && (S[Fe] = !0); + }); + }); + var O = Object.keys(S); + O.forEach(function(z) { + return f[z](); + }); + }, M.prototype.getBean = function(f) { + return this.lookupBeanInstance("getBean", f, !0); + }, M.prototype.destroy = function() { + if (!this.destroyed) { + this.logger.log(">> Shutting down ag-Application Context"); + var f = this.getBeanInstances(); + this.destroyBeans(f), this.contextParams.providedBeanInstances = null, this.destroyed = !0, this.logger.log(">> ag-Application Context shut down - component is dead"); + } + }, M.prototype.destroyBean = function(f) { + f && this.destroyBeans([f]); + }, M.prototype.destroyBeans = function(f) { + var d = this; + return f ? (f.forEach(function(g) { + d.callLifeCycleMethodsOnBean(g, "preDestroyMethods", "destroy"); + var S = g; + typeof S.destroy == "function" && S.destroy(); + }), []) : []; + }, M; + }() + ); + function st(M, f) { + var d = [null].concat(f), g = M.bind.apply(M, d); + return new g(); + } + function le(M, f, d) { + var g = He(M.constructor); + g.preConstructMethods || (g.preConstructMethods = []), g.preConstructMethods.push(f); + } + function ct(M, f, d) { + var g = He(M.constructor); + g.postConstructMethods || (g.postConstructMethods = []), g.postConstructMethods.push(f); + } + function gt(M, f, d) { + var g = He(M.constructor); + g.preDestroyMethods || (g.preDestroyMethods = []), g.preDestroyMethods.push(f); + } + function Ne(M) { + return function(f) { + var d = He(f); + d.beanName = M; + }; + } + function pe(M) { + return function(f, d, g) { + it(f, M, !1, f, d, null); + }; + } + function Ae(M) { + return function(f, d, g) { + it(f, M, !0, f, d, null); + }; + } + function it(M, f, d, g, S, O) { + if (f === null) { + console.error("AG Grid: Autowired name should not be null"); + return; + } + if (typeof O == "number") { + console.error("AG Grid: Autowired should be on an attribute"); + return; + } + var z = He(M.constructor); + z.agClassAttributes || (z.agClassAttributes = []), z.agClassAttributes.push({ + attributeName: S, + beanName: f, + optional: d + }); + } + function yt(M) { + return function(f, d, g) { + var S = typeof f == "function" ? f : f.constructor, O; + if (typeof g == "number") { + var z = void 0; + d ? (O = He(S), z = d) : (O = He(S), z = "agConstructor"), O.autowireMethods || (O.autowireMethods = {}), O.autowireMethods[z] || (O.autowireMethods[z] = {}), O.autowireMethods[z][g] = M; + } + }; + } + function He(M) { + return M.hasOwnProperty("__agBeanMetaData") || (M.__agBeanMetaData = {}), M.__agBeanMetaData; + } + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Ft = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ei = function(M, f) { + return function(d, g) { + f(d, g, M); + }; + }, mt = ( + /** @class */ + function() { + function M() { + this.allSyncListeners = /* @__PURE__ */ new Map(), this.allAsyncListeners = /* @__PURE__ */ new Map(), this.globalSyncListeners = /* @__PURE__ */ new Set(), this.globalAsyncListeners = /* @__PURE__ */ new Set(), this.asyncFunctionsQueue = [], this.scheduled = !1, this.firedEvents = {}; + } + return M.prototype.setBeans = function(f, d, g, S) { + if (S === void 0 && (S = null), this.frameworkOverrides = g, S) { + var O = d.useAsyncEvents(); + this.addGlobalListener(S, O); + } + }, M.prototype.getListeners = function(f, d, g) { + var S = d ? this.allAsyncListeners : this.allSyncListeners, O = S.get(f); + return !O && g && (O = /* @__PURE__ */ new Set(), S.set(f, O)), O; + }, M.prototype.noRegisteredListenersExist = function() { + return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 && this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0; + }, M.prototype.addEventListener = function(f, d, g) { + g === void 0 && (g = !1), this.getListeners(f, g, !0).add(d); + }, M.prototype.removeEventListener = function(f, d, g) { + g === void 0 && (g = !1); + var S = this.getListeners(f, g, !1); + if (S && (S.delete(d), S.size === 0)) { + var O = g ? this.allAsyncListeners : this.allSyncListeners; + O.delete(f); + } + }, M.prototype.addGlobalListener = function(f, d) { + d === void 0 && (d = !1), (d ? this.globalAsyncListeners : this.globalSyncListeners).add(f); + }, M.prototype.removeGlobalListener = function(f, d) { + d === void 0 && (d = !1), (d ? this.globalAsyncListeners : this.globalSyncListeners).delete(f); + }, M.prototype.dispatchEvent = function(f) { + this.dispatchToListeners(f, !0), this.dispatchToListeners(f, !1), this.firedEvents[f.type] = !0; + }, M.prototype.dispatchEventOnce = function(f) { + this.firedEvents[f.type] || this.dispatchEvent(f); + }, M.prototype.dispatchToListeners = function(f, d) { + var g = this, S = f.type, O = function(Fe) { + return Fe.forEach(function(ze) { + d ? g.dispatchAsync(function() { + return ze(f); + }) : ze(f); + }); + }, z = this.getListeners(S, d, !1); + z && O(z); + var te = d ? this.globalAsyncListeners : this.globalSyncListeners; + te.forEach(function(Fe) { + d ? g.dispatchAsync(function() { + return g.frameworkOverrides.dispatchEvent(S, function() { + return Fe(S, f); + }, !0); + }) : g.frameworkOverrides.dispatchEvent(S, function() { + return Fe(S, f); + }, !0); + }); + }, M.prototype.dispatchAsync = function(f) { + this.asyncFunctionsQueue.push(f), this.scheduled || (window.setTimeout(this.flushAsyncQueue.bind(this), 0), this.scheduled = !0); + }, M.prototype.flushAsyncQueue = function() { + this.scheduled = !1; + var f = this.asyncFunctionsQueue.slice(); + this.asyncFunctionsQueue = [], f.forEach(function(d) { + return d(); + }); + }, Ft([ + ei(0, yt("loggerFactory")), + ei(1, yt("gridOptionsWrapper")), + ei(2, yt("frameworkOverrides")), + ei(3, yt("globalEventListener")) + ], M.prototype, "setBeans", null), M = Ft([ + Ne("eventService") + ], M), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Ue = ( + /** @class */ + function() { + function M() { + } + return M.ROW_BUFFER_SIZE = 10, M.LAYOUT_INTERVAL = 500, M.BATCH_WAIT_MILLIS = 50, M.EXPORT_TYPE_DRAG_COPY = "dragCopy", M.EXPORT_TYPE_CLIPBOARD = "clipboard", M.EXPORT_TYPE_EXCEL = "excel", M.EXPORT_TYPE_CSV = "csv", M.ROW_MODEL_TYPE_INFINITE = "infinite", M.ROW_MODEL_TYPE_VIEWPORT = "viewport", M.ROW_MODEL_TYPE_CLIENT_SIDE = "clientSide", M.ROW_MODEL_TYPE_SERVER_SIDE = "serverSide", M.ALWAYS = "always", M.ONLY_WHEN_GROUPING = "onlyWhenGrouping", M.PINNED_TOP = "top", M.PINNED_BOTTOM = "bottom", M.DOM_LAYOUT_NORMAL = "normal", M.DOM_LAYOUT_PRINT = "print", M.DOM_LAYOUT_AUTO_HEIGHT = "autoHeight", M.GROUP_AUTO_COLUMN_ID = "ag-Grid-AutoColumn", M.SOURCE_PASTE = "paste", M.PINNED_RIGHT = "right", M.PINNED_LEFT = "left", M.SORT_ASC = "asc", M.SORT_DESC = "desc", M.INPUT_SELECTOR = "input, select, button, textarea", M.FOCUSABLE_SELECTOR = "[tabindex], input, select, button, textarea", M.FOCUSABLE_EXCLUDE = ".ag-hidden, .ag-hidden *, [disabled], .ag-disabled, .ag-disabled *", M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M.CommunityCoreModule = "@ag-grid-community/core", M.CommunityAllModules = "@ag-grid-community/all", M.InfiniteRowModelModule = "@ag-grid-community/infinite-row-model", M.ClientSideRowModelModule = "@ag-grid-community/client-side-row-model", M.CsvExportModule = "@ag-grid-community/csv-export", M.EnterpriseCoreModule = "@ag-grid-enterprise/core", M.EnterpriseAllModules = "@ag-grid-enterprise/all", M.RowGroupingModule = "@ag-grid-enterprise/row-grouping", M.ColumnToolPanelModule = "@ag-grid-enterprise/column-tool-panel", M.FiltersToolPanelModule = "@ag-grid-enterprise/filter-tool-panel", M.MenuModule = "@ag-grid-enterprise/menu", M.SetFilterModule = "@ag-grid-enterprise/set-filter", M.MultiFilterModule = "@ag-grid-enterprise/multi-filter", M.StatusBarModule = "@ag-grid-enterprise/status-bar", M.SideBarModule = "@ag-grid-enterprise/side-bar", M.RangeSelectionModule = "@ag-grid-enterprise/range-selection", M.MasterDetailModule = "@ag-grid-enterprise/master-detail", M.RichSelectModule = "@ag-grid-enterprise/rich-select", M.GridChartsModule = "@ag-grid-enterprise/charts", M.ViewportRowModelModule = "@ag-grid-enterprise/viewport-row-model", M.ServerSideRowModelModule = "@ag-grid-enterprise/server-side-row-model", M.ExcelExportModule = "@ag-grid-enterprise/excel-export", M.ClipboardModule = "@ag-grid-enterprise/clipboard", M.SparklinesModule = "@ag-grid-enterprise/sparklines", M.AngularModule = "@ag-grid-community/angular", M.ReactModule = "@ag-grid-community/react", M.VueModule = "@ag-grid-community/vue", M.PolymerModule = "@ag-grid-community/polymer"; + })(t.ModuleNames || (t.ModuleNames = {})); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var si = ( + /** @class */ + function() { + function M() { + } + return M.register = function(f, d) { + d === void 0 && (d = !0), M.modulesMap[f.moduleName] = f, M.moduleBased === void 0 ? M.moduleBased = d : M.moduleBased !== d && Ge(function() { + console.warn("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms."), console.warn("Please see https://www.ag-grid.com/javascript-grid/packages-modules/ for more information."); + }, "ModulePackageCheck"); + }, M.registerModules = function(f, d) { + d === void 0 && (d = !0), f && f.forEach(function(g) { + return M.register(g, d); + }); + }, M.assertRegistered = function(f, d) { + if (this.isRegistered(f)) + return !0; + var g = d + f, S; + return M.moduleBased ? S = "AG Grid: unable to use " + d + " as module " + f + " is not present. Please see: https://www.ag-grid.com/javascript-grid/modules/" : S = "AG Grid: unable to use " + d + " as package 'ag-grid-enterprise' is not present. Please see: https://www.ag-grid.com/javascript-grid/packages/", Ge(function() { + console.warn(S); + }, g), !1; + }, M.isRegistered = function(f) { + return !!M.modulesMap[f]; + }, M.getRegisteredModules = function() { + return y(M.modulesMap); + }, M.isPackageBased = function() { + return !M.moduleBased; + }, M.modulesMap = {}, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var A = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ve = 0, H = ( + /** @class */ + function() { + function M(f, d, g, S) { + this.instanceId = ve++, this.moving = !1, this.menuVisible = !1, this.filterActive = !1, this.eventService = new mt(), this.rowGroupActive = !1, this.pivotActive = !1, this.aggregationActive = !1, this.colDef = f, this.userProvidedColDef = d, this.colId = g, this.primary = S, this.setState(f); + } + return M.prototype.getInstanceId = function() { + return this.instanceId; + }, M.prototype.setState = function(f) { + f.sort !== void 0 ? (f.sort === Ue.SORT_ASC || f.sort === Ue.SORT_DESC) && (this.sort = f.sort) : (f.initialSort === Ue.SORT_ASC || f.initialSort === Ue.SORT_DESC) && (this.sort = f.initialSort); + var d = o(f.sortIndex), g = o(f.initialSortIndex); + d !== void 0 ? d !== null && (this.sortIndex = d) : g !== null && (this.sortIndex = g); + var S = a(f.hide), O = a(f.initialHide); + S !== void 0 ? this.visible = !S : this.visible = !O, f.pinned !== void 0 ? this.setPinned(f.pinned) : this.setPinned(f.initialPinned); + var z = o(f.flex), te = o(f.initialFlex); + z !== void 0 ? this.flex = z : te !== void 0 && (this.flex = te); + }, M.prototype.setColDef = function(f, d) { + this.colDef = f, this.userProvidedColDef = d, this.initMinAndMaxWidths(), this.initDotNotation(); + }, M.prototype.getUserProvidedColDef = function() { + return this.userProvidedColDef; + }, M.prototype.setParent = function(f) { + this.parent = f; + }, M.prototype.getParent = function() { + return this.parent; + }, M.prototype.setOriginalParent = function(f) { + this.originalParent = f; + }, M.prototype.getOriginalParent = function() { + return this.originalParent; + }, M.prototype.initialise = function() { + this.initMinAndMaxWidths(), this.resetActualWidth("gridInitializing"), this.initDotNotation(), this.validate(); + }, M.prototype.initDotNotation = function() { + var f = this.gridOptionsWrapper.isSuppressFieldDotNotation(); + this.fieldContainsDots = i(this.colDef.field) && this.colDef.field.indexOf(".") >= 0 && !f, this.tooltipFieldContainsDots = i(this.colDef.tooltipField) && this.colDef.tooltipField.indexOf(".") >= 0 && !f; + }, M.prototype.initMinAndMaxWidths = function() { + var f = this.colDef; + this.minWidth = this.columnUtils.calculateColMinWidth(f), this.maxWidth = this.columnUtils.calculateColMaxWidth(f); + }, M.prototype.resetActualWidth = function(f) { + f === void 0 && (f = "api"); + var d = this.columnUtils.calculateColInitialWidth(this.colDef); + this.setActualWidth(d, f, !0); + }, M.prototype.isEmptyGroup = function() { + return !1; + }, M.prototype.isRowGroupDisplayed = function(f) { + if (r(this.colDef) || r(this.colDef.showRowGroup)) + return !1; + var d = this.colDef.showRowGroup === !0, g = this.colDef.showRowGroup === f; + return d || g; + }, M.prototype.isPrimary = function() { + return this.primary; + }, M.prototype.isFilterAllowed = function() { + var f = !!this.colDef.filter || !!this.colDef.filterFramework; + return f; + }, M.prototype.isFieldContainsDots = function() { + return this.fieldContainsDots; + }, M.prototype.isTooltipFieldContainsDots = function() { + return this.tooltipFieldContainsDots; + }, M.prototype.validate = function() { + var f = this.colDef; + function d(z, te, Fe) { + Ge(function() { + Fe ? console.warn(z, Fe) : Ge(function() { + return console.warn(z); + }, te); + }, te); + } + var g = this.gridOptionsWrapper.isRowModelDefault(); + if (g && !si.isRegistered(t.ModuleNames.RowGroupingModule)) { + var S = ["enableRowGroup", "rowGroup", "rowGroupIndex", "enablePivot", "enableValue", "pivot", "pivotIndex", "aggFunc"]; + S.forEach(function(z) { + i(f[z]) && (si.isPackageBased() ? d("AG Grid: " + z + " is only valid in ag-grid-enterprise, your column definition should not have " + z, "ColumnRowGroupingMissing" + z) : d("AG Grid: " + z + " is only valid with AG Grid Enterprise Module " + t.ModuleNames.RowGroupingModule + " - your column definition should not have " + z, "ColumnRowGroupingMissing" + z)); + }); + } + if (si.isRegistered(t.ModuleNames.RichSelectModule) || this.colDef.cellEditor === "agRichSelect" && (si.isPackageBased() ? d("AG Grid: " + this.colDef.cellEditor + " can only be used with ag-grid-enterprise", "ColumnRichSelectMissing") : d("AG Grid: " + this.colDef.cellEditor + " can only be used with AG Grid Enterprise Module " + t.ModuleNames.RichSelectModule, "ColumnRichSelectMissing")), this.gridOptionsWrapper.isTreeData()) { + var O = ["rowGroup", "rowGroupIndex", "pivot", "pivotIndex"]; + O.forEach(function(z) { + i(f[z]) && d("AG Grid: " + z + " is not possible when doing tree data, your column definition should not have " + z, "TreeDataCannotRowGroup"); + }); + } + i(this.colDef.width) && typeof this.colDef.width != "number" && d("AG Grid: colDef.width should be a number, not " + typeof this.colDef.width, "ColumnCheck_asdfawef"), f.pinnedRowCellRenderer && d("AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column", "colDef.pinnedRowCellRenderer-deprecated"), f.pinnedRowCellRendererParams && d("AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column", "colDef.pinnedRowCellRenderer-deprecated"), f.pinnedRowCellRendererFramework && d("AG Grid: pinnedRowCellRenderer no longer exists, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue. See https://www.ag-grid.com/javascript-grid/cell-rendering/#many-renderers-one-column", "colDef.pinnedRowCellRenderer-deprecated"), f.pinnedRowValueGetter && d("AG Grid: pinnedRowCellRenderer is deprecated, use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. This was an unfortunate (but necessary) change we had to do to allow future plans we have of re-skinng the data grid in frameworks such as React, Angular and Vue.", "colDef.pinnedRowCellRenderer-deprecated"); + }, M.prototype.addEventListener = function(f, d) { + this.eventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.eventService.removeEventListener(f, d); + }, M.prototype.createColumnFunctionCallbackParams = function(f) { + return { + node: f, + data: f.data, + column: this, + colDef: this.colDef, + context: this.gridOptionsWrapper.getContext(), + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi() + }; + }, M.prototype.isSuppressNavigable = function(f) { + if (typeof this.colDef.suppressNavigable == "boolean") + return this.colDef.suppressNavigable; + if (typeof this.colDef.suppressNavigable == "function") { + var d = this.createColumnFunctionCallbackParams(f), g = this.colDef.suppressNavigable; + return g(d); + } + return !1; + }, M.prototype.isCellEditable = function(f) { + return f.group && !this.gridOptionsWrapper.isEnableGroupEdit() ? !1 : this.isColumnFunc(f, this.colDef.editable); + }, M.prototype.isSuppressFillHandle = function() { + return !!a(this.colDef.suppressFillHandle); + }, M.prototype.isAutoHeight = function() { + return !!a(this.colDef.autoHeight); + }, M.prototype.isRowDrag = function(f) { + return this.isColumnFunc(f, this.colDef.rowDrag); + }, M.prototype.isDndSource = function(f) { + return this.isColumnFunc(f, this.colDef.dndSource); + }, M.prototype.isCellCheckboxSelection = function(f) { + return this.isColumnFunc(f, this.colDef.checkboxSelection); + }, M.prototype.isSuppressPaste = function(f) { + return this.isColumnFunc(f, this.colDef ? this.colDef.suppressPaste : null); + }, M.prototype.isResizable = function() { + return !!a(this.colDef.resizable); + }, M.prototype.isColumnFunc = function(f, d) { + if (typeof d == "boolean") + return d; + if (typeof d == "function") { + var g = this.createColumnFunctionCallbackParams(f), S = d; + return S(g); + } + return !1; + }, M.prototype.setMoving = function(f, d) { + d === void 0 && (d = "api"), this.moving = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_MOVING_CHANGED, d)); + }, M.prototype.createColumnEvent = function(f, d) { + return { + api: this.gridApi, + columnApi: this.columnApi, + type: f, + column: this, + columns: [this], + source: d + }; + }, M.prototype.isMoving = function() { + return this.moving; + }, M.prototype.getSort = function() { + return this.sort; + }, M.prototype.setSort = function(f, d) { + d === void 0 && (d = "api"), this.sort !== f && (this.sort = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_SORT_CHANGED, d))); + }, M.prototype.setMenuVisible = function(f, d) { + d === void 0 && (d = "api"), this.menuVisible !== f && (this.menuVisible = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_MENU_VISIBLE_CHANGED, d))); + }, M.prototype.isMenuVisible = function() { + return this.menuVisible; + }, M.prototype.isSortAscending = function() { + return this.sort === Ue.SORT_ASC; + }, M.prototype.isSortDescending = function() { + return this.sort === Ue.SORT_DESC; + }, M.prototype.isSortNone = function() { + return r(this.sort); + }, M.prototype.isSorting = function() { + return i(this.sort); + }, M.prototype.getSortIndex = function() { + return this.sortIndex; + }, M.prototype.setSortIndex = function(f) { + this.sortIndex = f; + }, M.prototype.setAggFunc = function(f) { + this.aggFunc = f; + }, M.prototype.getAggFunc = function() { + return this.aggFunc; + }, M.prototype.getLeft = function() { + return this.left; + }, M.prototype.getOldLeft = function() { + return this.oldLeft; + }, M.prototype.getRight = function() { + return this.left + this.actualWidth; + }, M.prototype.setLeft = function(f, d) { + d === void 0 && (d = "api"), this.oldLeft = this.left, this.left !== f && (this.left = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_LEFT_CHANGED, d))); + }, M.prototype.isFilterActive = function() { + return this.filterActive; + }, M.prototype.setFilterActive = function(f, d, g) { + d === void 0 && (d = "api"), this.filterActive !== f && (this.filterActive = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_FILTER_ACTIVE_CHANGED, d))); + var S = this.createColumnEvent(M.EVENT_FILTER_CHANGED, d); + g && he(S, g), this.eventService.dispatchEvent(S); + }, M.prototype.setPinned = function(f) { + f === !0 || f === Ue.PINNED_LEFT ? this.pinned = Ue.PINNED_LEFT : f === Ue.PINNED_RIGHT ? this.pinned = Ue.PINNED_RIGHT : this.pinned = null; + }, M.prototype.setFirstRightPinned = function(f, d) { + d === void 0 && (d = "api"), this.firstRightPinned !== f && (this.firstRightPinned = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_FIRST_RIGHT_PINNED_CHANGED, d))); + }, M.prototype.setLastLeftPinned = function(f, d) { + d === void 0 && (d = "api"), this.lastLeftPinned !== f && (this.lastLeftPinned = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_LAST_LEFT_PINNED_CHANGED, d))); + }, M.prototype.isFirstRightPinned = function() { + return this.firstRightPinned; + }, M.prototype.isLastLeftPinned = function() { + return this.lastLeftPinned; + }, M.prototype.isPinned = function() { + return this.pinned === Ue.PINNED_LEFT || this.pinned === Ue.PINNED_RIGHT; + }, M.prototype.isPinnedLeft = function() { + return this.pinned === Ue.PINNED_LEFT; + }, M.prototype.isPinnedRight = function() { + return this.pinned === Ue.PINNED_RIGHT; + }, M.prototype.getPinned = function() { + return this.pinned; + }, M.prototype.setVisible = function(f, d) { + d === void 0 && (d = "api"); + var g = f === !0; + this.visible !== g && (this.visible = g, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_VISIBLE_CHANGED, d))); + }, M.prototype.isVisible = function() { + return this.visible; + }, M.prototype.getColDef = function() { + return this.colDef; + }, M.prototype.getColumnGroupShow = function() { + return this.colDef.columnGroupShow; + }, M.prototype.getColId = function() { + return this.colId; + }, M.prototype.getId = function() { + return this.getColId(); + }, M.prototype.getUniqueId = function() { + return this.getId(); + }, M.prototype.getDefinition = function() { + return this.colDef; + }, M.prototype.getActualWidth = function() { + return this.actualWidth; + }, M.prototype.createBaseColDefParams = function(f) { + var d = { + node: f, + data: f.data, + colDef: this.colDef, + column: this, + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + context: this.gridOptionsWrapper.getContext() + }; + return d; + }, M.prototype.getColSpan = function(f) { + if (r(this.colDef.colSpan)) + return 1; + var d = this.createBaseColDefParams(f), g = this.colDef.colSpan(d); + return Math.max(g, 1); + }, M.prototype.getRowSpan = function(f) { + if (r(this.colDef.rowSpan)) + return 1; + var d = this.createBaseColDefParams(f), g = this.colDef.rowSpan(d); + return Math.max(g, 1); + }, M.prototype.setActualWidth = function(f, d, g) { + d === void 0 && (d = "api"), g === void 0 && (g = !1), this.minWidth != null && (f = Math.max(f, this.minWidth)), this.maxWidth != null && (f = Math.min(f, this.maxWidth)), this.actualWidth !== f && (this.actualWidth = f, this.flex && d !== "flex" && d !== "gridInitializing" && (this.flex = null), g || this.fireColumnWidthChangedEvent(d)); + }, M.prototype.fireColumnWidthChangedEvent = function(f) { + this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_WIDTH_CHANGED, f)); + }, M.prototype.isGreaterThanMax = function(f) { + return this.maxWidth != null ? f > this.maxWidth : !1; + }, M.prototype.getMinWidth = function() { + return this.minWidth; + }, M.prototype.getMaxWidth = function() { + return this.maxWidth; + }, M.prototype.getFlex = function() { + return this.flex || 0; + }, M.prototype.setFlex = function(f) { + this.flex !== f && (this.flex = f); + }, M.prototype.setMinimum = function(f) { + f === void 0 && (f = "api"), i(this.minWidth) && this.setActualWidth(this.minWidth, f); + }, M.prototype.setRowGroupActive = function(f, d) { + d === void 0 && (d = "api"), this.rowGroupActive !== f && (this.rowGroupActive = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_ROW_GROUP_CHANGED, d))); + }, M.prototype.isRowGroupActive = function() { + return this.rowGroupActive; + }, M.prototype.setPivotActive = function(f, d) { + d === void 0 && (d = "api"), this.pivotActive !== f && (this.pivotActive = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_PIVOT_CHANGED, d))); + }, M.prototype.isPivotActive = function() { + return this.pivotActive; + }, M.prototype.isAnyFunctionActive = function() { + return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive(); + }, M.prototype.isAnyFunctionAllowed = function() { + return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue(); + }, M.prototype.setValueActive = function(f, d) { + d === void 0 && (d = "api"), this.aggregationActive !== f && (this.aggregationActive = f, this.eventService.dispatchEvent(this.createColumnEvent(M.EVENT_VALUE_CHANGED, d))); + }, M.prototype.isValueActive = function() { + return this.aggregationActive; + }, M.prototype.isAllowPivot = function() { + return this.colDef.enablePivot === !0; + }, M.prototype.isAllowValue = function() { + return this.colDef.enableValue === !0; + }, M.prototype.isAllowRowGroup = function() { + return this.colDef.enableRowGroup === !0; + }, M.prototype.getMenuTabs = function(f) { + var d = this.getColDef().menuTabs; + return d == null && (d = f), d; + }, M.prototype.isLockPosition = function() { + return console.warn("AG Grid: since v21, col.isLockPosition() should not be used, please use col.getColDef().lockPosition instead."), this.colDef ? !!this.colDef.lockPosition : !1; + }, M.prototype.isLockVisible = function() { + return console.warn("AG Grid: since v21, col.isLockVisible() should not be used, please use col.getColDef().lockVisible instead."), this.colDef ? !!this.colDef.lockVisible : !1; + }, M.prototype.isLockPinned = function() { + return console.warn("AG Grid: since v21, col.isLockPinned() should not be used, please use col.getColDef().lockPinned instead."), this.colDef ? !!this.colDef.lockPinned : !1; + }, M.EVENT_MOVING_CHANGED = "movingChanged", M.EVENT_LEFT_CHANGED = "leftChanged", M.EVENT_WIDTH_CHANGED = "widthChanged", M.EVENT_LAST_LEFT_PINNED_CHANGED = "lastLeftPinnedChanged", M.EVENT_FIRST_RIGHT_PINNED_CHANGED = "firstRightPinnedChanged", M.EVENT_VISIBLE_CHANGED = "visibleChanged", M.EVENT_FILTER_CHANGED = "filterChanged", M.EVENT_FILTER_ACTIVE_CHANGED = "filterActiveChanged", M.EVENT_SORT_CHANGED = "sortChanged", M.EVENT_MENU_VISIBLE_CHANGED = "menuVisibleChanged", M.EVENT_ROW_GROUP_CHANGED = "columnRowGroupChanged", M.EVENT_PIVOT_CHANGED = "columnPivotChanged", M.EVENT_VALUE_CHANGED = "columnValueChanged", A([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), A([ + pe("columnUtils") + ], M.prototype, "columnUtils", void 0), A([ + pe("columnApi") + ], M.prototype, "columnApi", void 0), A([ + pe("gridApi") + ], M.prototype, "gridApi", void 0), A([ + pe("context") + ], M.prototype, "context", void 0), A([ + ct + ], M.prototype, "initialise", null), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function T() { + for (var M = [], f = 0; f < arguments.length; f++) + M[f] = arguments[f]; + for (var d = 0; d < M.length; d++) { + var g = M[d]; + if (i(g)) + return g; + } + return null; + } + function b(M) { + return M != null && M.length > 0; + } + function m(M) { + if (!(!M || !M.length)) + return M[M.length - 1]; + } + function _(M, f, d) { + return M == null && f == null ? !0 : M != null && f != null && M.length === f.length && M.every(function(g, S) { + return d ? d(g, f[S]) : f[S] === g; + }); + } + function C(M, f) { + return _(M, f); + } + function D(M, f) { + return _(M, f); + } + function L(M) { + return M.sort(function(f, d) { + return f - d; + }); + } + function B(M, f) { + if (M) + for (var d = M.length - 2; d >= 0; d--) { + var g = M[d] === f, S = M[d + 1] === f; + g && S && M.splice(d + 1, 1); + } + } + function q(M, f) { + var d = M.indexOf(f); + d >= 0 && M.splice(d, 1); + } + function Z(M, f) { + f.forEach(function(d) { + return q(M, d); + }); + } + function ie(M, f, d) { + M.splice(d, 0, f); + } + function se(M, f, d) { + if (!(M == null || f == null)) + for (var g = f.length - 1; g >= 0; g--) { + var S = f[g]; + ie(M, S, d); + } + } + function de(M, f, d) { + Z(M, f), f.slice().reverse().forEach(function(g) { + return ie(M, g, d); + }); + } + function Ce(M, f) { + return M.indexOf(f) > -1; + } + function Ve(M) { + return [].concat.apply([], M); + } + function Je(M, f) { + f == null || M == null || f.forEach(function(d) { + return M.push(d); + }); + } + function Pt(M) { + return M.map(s); + } + function $t(M, f) { + if (M != null) + for (var d = M.length - 1; d >= 0; d--) + f(M[d], d); + } + var qe = /* @__PURE__ */ Object.freeze({ + firstExistingValue: T, + existsAndNotEmpty: b, + last: m, + areEqual: _, + compareArrays: C, + shallowCompare: D, + sortNumerically: L, + removeRepeatsFromArray: B, + removeFromArray: q, + removeAllFromArray: Z, + insertIntoArray: ie, + insertArrayIntoArray: se, + moveInArray: de, + includes: Ce, + flatten: Ve, + pushAll: Je, + toStrings: Pt, + forEachReverse: $t + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Rt = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Zt = ( + /** @class */ + function() { + function M(f, d, g, S) { + this.displayedChildren = [], this.localEventService = new mt(), this.groupId = d, this.instanceId = g, this.providedColumnGroup = f, this.pinned = S; + } + return M.createUniqueId = function(f, d) { + return f + "_" + d; + }, M.prototype.reset = function() { + this.parent = null, this.children = null, this.displayedChildren = null; + }, M.prototype.getParent = function() { + return this.parent; + }, M.prototype.setParent = function(f) { + this.parent = f; + }, M.prototype.getUniqueId = function() { + return M.createUniqueId(this.groupId, this.instanceId); + }, M.prototype.isEmptyGroup = function() { + return this.displayedChildren.length === 0; + }, M.prototype.isMoving = function() { + var f = this.getProvidedColumnGroup().getLeafColumns(); + return !f || f.length === 0 ? !1 : f.every(function(d) { + return d.isMoving(); + }); + }, M.prototype.checkLeft = function() { + if (this.displayedChildren.forEach(function(S) { + S instanceof M && S.checkLeft(); + }), this.displayedChildren.length > 0) + if (this.gridOptionsWrapper.isEnableRtl()) { + var f = m(this.displayedChildren), d = f.getLeft(); + this.setLeft(d); + } else { + var g = this.displayedChildren[0].getLeft(); + this.setLeft(g); + } + else + this.setLeft(null); + }, M.prototype.getLeft = function() { + return this.left; + }, M.prototype.getOldLeft = function() { + return this.oldLeft; + }, M.prototype.setLeft = function(f) { + this.oldLeft = f, this.left !== f && (this.left = f, this.localEventService.dispatchEvent(this.createAgEvent(M.EVENT_LEFT_CHANGED))); + }, M.prototype.getPinned = function() { + return this.pinned; + }, M.prototype.createAgEvent = function(f) { + return { type: f }; + }, M.prototype.addEventListener = function(f, d) { + this.localEventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.localEventService.removeEventListener(f, d); + }, M.prototype.getGroupId = function() { + return this.groupId; + }, M.prototype.getInstanceId = function() { + return this.instanceId; + }, M.prototype.isChildInThisGroupDeepSearch = function(f) { + var d = !1; + return this.children.forEach(function(g) { + f === g && (d = !0), g instanceof M && g.isChildInThisGroupDeepSearch(f) && (d = !0); + }), d; + }, M.prototype.getActualWidth = function() { + var f = 0; + return this.displayedChildren && this.displayedChildren.forEach(function(d) { + f += d.getActualWidth(); + }), f; + }, M.prototype.isResizable = function() { + if (!this.displayedChildren) + return !1; + var f = !1; + return this.displayedChildren.forEach(function(d) { + d.isResizable() && (f = !0); + }), f; + }, M.prototype.getMinWidth = function() { + var f = 0; + return this.displayedChildren.forEach(function(d) { + f += d.getMinWidth() || 0; + }), f; + }, M.prototype.addChild = function(f) { + this.children || (this.children = []), this.children.push(f); + }, M.prototype.getDisplayedChildren = function() { + return this.displayedChildren; + }, M.prototype.getLeafColumns = function() { + var f = []; + return this.addLeafColumns(f), f; + }, M.prototype.getDisplayedLeafColumns = function() { + var f = []; + return this.addDisplayedLeafColumns(f), f; + }, M.prototype.getDefinition = function() { + return this.providedColumnGroup.getColGroupDef(); + }, M.prototype.getColGroupDef = function() { + return this.providedColumnGroup.getColGroupDef(); + }, M.prototype.isPadding = function() { + return this.providedColumnGroup.isPadding(); + }, M.prototype.isExpandable = function() { + return this.providedColumnGroup.isExpandable(); + }, M.prototype.isExpanded = function() { + return this.providedColumnGroup.isExpanded(); + }, M.prototype.setExpanded = function(f) { + this.providedColumnGroup.setExpanded(f); + }, M.prototype.addDisplayedLeafColumns = function(f) { + this.displayedChildren.forEach(function(d) { + d instanceof H ? f.push(d) : d instanceof M && d.addDisplayedLeafColumns(f); + }); + }, M.prototype.addLeafColumns = function(f) { + this.children.forEach(function(d) { + d instanceof H ? f.push(d) : d instanceof M && d.addLeafColumns(f); + }); + }, M.prototype.getChildren = function() { + return this.children; + }, M.prototype.getColumnGroupShow = function() { + return this.providedColumnGroup.getColumnGroupShow(); + }, M.prototype.getProvidedColumnGroup = function() { + return this.providedColumnGroup; + }, M.prototype.getOriginalColumnGroup = function() { + return console.warn("AG Grid: columnGroup.getOriginalColumnGroup() is deprecated due to a method rename, use columnGroup.getProvidedColumnGroup() instead"), this.getProvidedColumnGroup(); + }, M.prototype.getPaddingLevel = function() { + var f = this.getParent(); + return !this.isPadding() || !f || !f.isPadding() ? 0 : 1 + f.getPaddingLevel(); + }, M.prototype.calculateDisplayedColumns = function() { + var f = this; + this.displayedChildren = []; + for (var d = this; d != null && d.isPadding(); ) + d = d.getParent(); + var g = d ? d.providedColumnGroup.isExpandable() : !1; + if (!g) { + this.displayedChildren = this.children, this.localEventService.dispatchEvent(this.createAgEvent(M.EVENT_DISPLAYED_CHILDREN_CHANGED)); + return; + } + this.children.forEach(function(S) { + var O = S instanceof M && (!S.displayedChildren || !S.displayedChildren.length); + if (!O) { + var z = S.getColumnGroupShow(); + switch (z) { + case M.HEADER_GROUP_SHOW_OPEN: + d.providedColumnGroup.isExpanded() && f.displayedChildren.push(S); + break; + case M.HEADER_GROUP_SHOW_CLOSED: + d.providedColumnGroup.isExpanded() || f.displayedChildren.push(S); + break; + default: + f.displayedChildren.push(S); + break; + } + } + }), this.localEventService.dispatchEvent(this.createAgEvent(M.EVENT_DISPLAYED_CHILDREN_CHANGED)); + }, M.HEADER_GROUP_SHOW_OPEN = "open", M.HEADER_GROUP_SHOW_CLOSED = "closed", M.EVENT_LEFT_CHANGED = "leftChanged", M.EVENT_DISPLAYED_CHILDREN_CHANGED = "displayedChildrenChanged", Rt([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Jt = ( + /** @class */ + function() { + function M(f, d, g, S) { + this.localEventService = new mt(), this.expandable = !1, this.colGroupDef = f, this.groupId = d, this.expanded = !!f && !!f.openByDefault, this.padding = g, this.level = S; + } + return M.prototype.setOriginalParent = function(f) { + this.originalParent = f; + }, M.prototype.getOriginalParent = function() { + return this.originalParent; + }, M.prototype.getLevel = function() { + return this.level; + }, M.prototype.isVisible = function() { + return this.children ? this.children.some(function(f) { + return f.isVisible(); + }) : !1; + }, M.prototype.isPadding = function() { + return this.padding; + }, M.prototype.setExpanded = function(f) { + this.expanded = f === void 0 ? !1 : f; + var d = { + type: M.EVENT_EXPANDED_CHANGED + }; + this.localEventService.dispatchEvent(d); + }, M.prototype.isExpandable = function() { + return this.expandable; + }, M.prototype.isExpanded = function() { + return this.expanded; + }, M.prototype.getGroupId = function() { + return this.groupId; + }, M.prototype.getId = function() { + return this.getGroupId(); + }, M.prototype.setChildren = function(f) { + this.children = f; + }, M.prototype.getChildren = function() { + return this.children; + }, M.prototype.getColGroupDef = function() { + return this.colGroupDef; + }, M.prototype.getLeafColumns = function() { + var f = []; + return this.addLeafColumns(f), f; + }, M.prototype.addLeafColumns = function(f) { + this.children && this.children.forEach(function(d) { + d instanceof H ? f.push(d) : d instanceof M && d.addLeafColumns(f); + }); + }, M.prototype.getColumnGroupShow = function() { + var f = this.colGroupDef; + if (f) + return f.columnGroupShow; + }, M.prototype.setupExpandable = function() { + var f = this; + this.setExpandable(), this.getLeafColumns().forEach(function(d) { + return d.addEventListener(H.EVENT_VISIBLE_CHANGED, f.onColumnVisibilityChanged.bind(f)); + }); + }, M.prototype.setExpandable = function() { + if (!this.isPadding()) { + for (var f = !1, d = !1, g = !1, S = this.findChildrenRemovingPadding(), O = 0, z = S.length; O < z; O++) { + var te = S[O]; + if (te.isVisible()) { + var Fe = te.getColumnGroupShow(); + Fe === Zt.HEADER_GROUP_SHOW_OPEN ? (f = !0, g = !0) : Fe === Zt.HEADER_GROUP_SHOW_CLOSED ? (d = !0, g = !0) : (f = !0, d = !0); + } + } + var ze = f && d && g; + if (this.expandable !== ze) { + this.expandable = ze; + var ht = { + type: M.EVENT_EXPANDABLE_CHANGED + }; + this.localEventService.dispatchEvent(ht); + } + } + }, M.prototype.findChildrenRemovingPadding = function() { + var f = [], d = function(g) { + g.forEach(function(S) { + var O = S instanceof M && S.isPadding(); + O ? d(S.children) : f.push(S); + }); + }; + return d(this.children), f; + }, M.prototype.onColumnVisibilityChanged = function() { + this.setExpandable(); + }, M.prototype.addEventListener = function(f, d) { + this.localEventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.localEventService.removeEventListener(f, d); + }, M.EVENT_EXPANDED_CHANGED = "expandedChanged", M.EVENT_EXPANDABLE_CHANGED = "expandableChanged", M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Xt = { + numericColumn: { + headerClass: "ag-right-aligned-header", + cellClass: "ag-right-aligned-cell" + }, + rightAligned: { + headerClass: "ag-right-aligned-header", + cellClass: "ag-right-aligned-cell" + } + }; + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Qt = "__ag_Grid_Stop_Propagation", bi = ["touchstart", "touchend", "touchmove", "touchcancel"], Mi = {}; + function Ri(M) { + M[Qt] = !0; + } + function Yi(M) { + return M[Qt] === !0; + } + var rr = function() { + var M = { + select: "input", + change: "input", + submit: "form", + reset: "form", + error: "img", + load: "img", + abort: "img" + }, f = function(d) { + if (typeof Mi[d] == "boolean") + return Mi[d]; + var g = document.createElement(M[d] || "div"); + return d = "on" + d, Mi[d] = d in g; + }; + return f; + }(); + function _i(M, f, d) { + for (var g = f.target; g; ) { + var S = M.getDomData(g, d); + if (S) + return S; + g = g.parentElement; + } + return null; + } + function fn(M, f) { + M.addEventListener("changed", f), M.addEventListener("paste", f), M.addEventListener("input", f); + } + function jr(M, f) { + return !f || !M ? !1 : Zn(f).indexOf(M) >= 0; + } + function no(M) { + for (var f = [], d = M.target; d; ) + f.push(d), d = d.parentElement; + return f; + } + function $r(M) { + M.__agGridEventPath = Zn(M); + } + function Zn(M) { + var f = M; + return f.path ? f.path : f.composedPath ? f.composedPath() : f.__agGridEventPath ? f.__agGridEventPath : no(M); + } + function bs(M, f, d, g) { + var S = Ce(bi, d), O = S ? { passive: !0 } : void 0; + M && M.addEventListener && M.addEventListener(f, d, g, O); + } + var On = /* @__PURE__ */ Object.freeze({ + stopPropagationForAgGrid: Ri, + isStopPropagationForAgGrid: Yi, + isEventSupported: rr, + getCtrlForEvent: _i, + addChangeListener: fn, + isElementInEventPath: jr, + createEventPath: no, + addAgGridEventPath: $r, + getEventPath: Zn, + addSafePassiveEventListener: bs + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Jn = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ki = ( + /** @class */ + function() { + function M() { + var f = this; + this.destroyFunctions = [], this.destroyed = !1, this.__v_skip = !0, this.isAlive = function() { + return !f.destroyed; + }; + } + return M.prototype.getFrameworkOverrides = function() { + return this.frameworkOverrides; + }, M.prototype.getContext = function() { + return this.context; + }, M.prototype.destroy = function() { + this.destroyFunctions.forEach(function(f) { + return f(); + }), this.destroyFunctions.length = 0, this.destroyed = !0, this.dispatchEvent({ type: M.EVENT_DESTROYED }); + }, M.prototype.addEventListener = function(f, d) { + this.localEventService || (this.localEventService = new mt()), this.localEventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.localEventService && this.localEventService.removeEventListener(f, d); + }, M.prototype.dispatchEventAsync = function(f) { + var d = this; + window.setTimeout(function() { + return d.dispatchEvent(f); + }, 0); + }, M.prototype.dispatchEvent = function(f) { + this.localEventService && this.localEventService.dispatchEvent(f); + }, M.prototype.addManagedListener = function(f, d, g) { + var S = this; + if (!this.destroyed) { + f instanceof HTMLElement ? bs(this.getFrameworkOverrides(), f, d, g) : f.addEventListener(d, g); + var O = function() { + return f.removeEventListener(d, g), S.destroyFunctions = S.destroyFunctions.filter(function(z) { + return z !== O; + }), null; + }; + return this.destroyFunctions.push(O), O; + } + }, M.prototype.addDestroyFunc = function(f) { + this.isAlive() ? this.destroyFunctions.push(f) : f(); + }, M.prototype.createManagedBean = function(f, d) { + var g = this.createBean(f, d); + return this.addDestroyFunc(this.destroyBean.bind(this, f, d)), g; + }, M.prototype.createBean = function(f, d, g) { + return (d || this.getContext()).createBean(f, g); + }, M.prototype.destroyBean = function(f, d) { + return (d || this.getContext()).destroyBean(f); + }, M.prototype.destroyBeans = function(f, d) { + var g = this; + return f && f.forEach(function(S) { + return g.destroyBean(S, d); + }), []; + }, M.EVENT_DESTROYED = "destroyed", Jn([ + pe("frameworkOverrides") + ], M.prototype, "frameworkOverrides", void 0), Jn([ + pe("context") + ], M.prototype, "context", void 0), Jn([ + pe("eventService") + ], M.prototype, "eventService", void 0), Jn([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), Jn([ + gt + ], M.prototype, "destroy", null), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Ur = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), So = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Cn = function(M, f) { + return function(d, g) { + f(d, g, M); + }; + }, Ki = ( + /** @class */ + function(M) { + Ur(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.setBeans = function(d) { + this.logger = d.create("ColumnFactory"); + }, f.prototype.createColumnTree = function(d, g, S) { + var O = new x(), z = this.extractExistingTreeData(S), te = z.existingCols, Fe = z.existingGroups, ze = z.existingColKeys; + O.addExistingKeys(ze); + var ht = this.recursivelyCreateColumns(d, 0, g, te, O, Fe), Lt = this.findMaxDept(ht, 0); + this.logger.log("Number of levels for grouped columns is " + Lt); + var ti = this.balanceColumnTree(ht, 0, Lt, O), wi = function(Ti, qi) { + Ti instanceof Jt && Ti.setupExpandable(), Ti.setOriginalParent(qi); + }; + return this.columnUtils.depthFirstOriginalTreeSearch(null, ti, wi), { + columnTree: ti, + treeDept: Lt + }; + }, f.prototype.extractExistingTreeData = function(d) { + var g = [], S = [], O = []; + return d && this.columnUtils.depthFirstOriginalTreeSearch(null, d, function(z) { + if (z instanceof Jt) { + var te = z; + S.push(te); + } else { + var Fe = z; + O.push(Fe.getId()), g.push(Fe); + } + }), { existingCols: g, existingGroups: S, existingColKeys: O }; + }, f.prototype.createForAutoGroups = function(d, g) { + var S = this; + return d.map(function(O) { + return S.createAutoGroupTreeItem(g, O); + }); + }, f.prototype.createAutoGroupTreeItem = function(d, g) { + for (var S = this.findDepth(d), O = g, z = S - 1; z >= 0; z--) { + var te = new Jt(null, "FAKE_PATH_" + g.getId() + "}_" + z, !0, z); + this.context.createBean(te), te.setChildren([O]), O.setOriginalParent(te), O = te; + } + return O; + }, f.prototype.findDepth = function(d) { + for (var g = 0, S = d; S && S[0] && S[0] instanceof Jt; ) + g++, S = S[0].getChildren(); + return g; + }, f.prototype.balanceColumnTree = function(d, g, S, O) { + for (var z = [], te = 0; te < d.length; te++) { + var Fe = d[te]; + if (Fe instanceof Jt) { + var ze = Fe, ht = this.balanceColumnTree(ze.getChildren(), g + 1, S, O); + ze.setChildren(ht), z.push(ze); + } else { + for (var Lt = void 0, ti = void 0, wi = S - 1; wi >= g; wi--) { + var Ti = O.getUniqueKey(null, null), qi = this.createMergedColGroupDef(null), dr = new Jt(qi, Ti, !0, g); + this.context.createBean(dr), ti && ti.setChildren([dr]), ti = dr, Lt || (Lt = ti); + } + if (Lt && ti) { + z.push(Lt); + var kr = d.some(function(Rr) { + return Rr instanceof Jt; + }); + if (kr) { + ti.setChildren([Fe]); + continue; + } else { + ti.setChildren(d); + break; + } + } + z.push(Fe); + } + } + return z; + }, f.prototype.findMaxDept = function(d, g) { + for (var S = g, O = 0; O < d.length; O++) { + var z = d[O]; + if (z instanceof Jt) { + var te = z, Fe = this.findMaxDept(te.getChildren(), g + 1); + S < Fe && (S = Fe); + } + } + return S; + }, f.prototype.recursivelyCreateColumns = function(d, g, S, O, z, te) { + var Fe = this; + return (d || []).map(function(ze) { + return Fe.isColumnGroup(ze) ? Fe.createColumnGroup(S, ze, g, O, z, te) : Fe.createColumn(S, ze, O, z); + }); + }, f.prototype.createColumnGroup = function(d, g, S, O, z, te) { + var Fe = this.createMergedColGroupDef(g), ze = z.getUniqueKey(Fe.groupId || null, null), ht = new Jt(Fe, ze, !1, S); + this.context.createBean(ht); + var Lt = this.findExistingGroup(g, te); + Lt && q(te, Lt), Lt && Lt.isExpanded() && ht.setExpanded(!0); + var ti = this.recursivelyCreateColumns(Fe.children, S + 1, d, O, z, te); + return ht.setChildren(ti), ht; + }, f.prototype.createMergedColGroupDef = function(d) { + var g = {}; + return Object.assign(g, this.gridOptionsWrapper.getDefaultColGroupDef()), Object.assign(g, d), this.checkForDeprecatedItems(g), g; + }, f.prototype.createColumn = function(d, g, S, O) { + var z = this.mergeColDefs(g); + this.checkForDeprecatedItems(z); + var te = this.findExistingColumn(g, S); + if (S && te && q(S, te), te) + te.setColDef(z, g), this.applyColumnState(te, z); + else { + var Fe = O.getUniqueKey(z.colId, z.field); + te = new H(z, g, Fe, d), this.context.createBean(te); + } + return te; + }, f.prototype.applyColumnState = function(d, g) { + var S = o(g.flex); + S !== void 0 && d.setFlex(S); + var O = d.getFlex() <= 0; + if (O) { + var z = o(g.width); + if (z != null) + d.setActualWidth(z); + else { + var te = d.getActualWidth(); + d.setActualWidth(te); + } + } + g.sort !== void 0 && (g.sort == Ue.SORT_ASC || g.sort == Ue.SORT_DESC ? d.setSort(g.sort) : d.setSort(void 0)); + var Fe = o(g.sortIndex); + Fe !== void 0 && d.setSortIndex(Fe); + var ze = a(g.hide); + ze !== void 0 && d.setVisible(!ze), g.pinned !== void 0 && d.setPinned(g.pinned); + }, f.prototype.findExistingColumn = function(d, g) { + return (g || []).find(function(S) { + var O = S.getUserProvidedColDef(); + if (!O) + return !1; + var z = d.colId != null, te = d.field != null; + return z ? S.getId() === d.colId : te ? O.field === d.field : O === d; + }); + }, f.prototype.findExistingGroup = function(d, g) { + return g.find(function(S) { + var O = S.getColGroupDef(); + if (!O) + return !1; + var z = d.groupId != null; + return z ? S.getId() === d.groupId : !1; + }); + }, f.prototype.mergeColDefs = function(d) { + var g = {}, S = this.gridOptionsWrapper.getDefaultColDef(); + he(g, S, !1, !0); + var O = d.type; + return O || (O = S && S.type), O && this.assignColumnTypes(O, g), he(g, d, !1, !0), g; + }, f.prototype.assignColumnTypes = function(d, g) { + var S = []; + if (d instanceof Array) { + var O = d.some(function(Fe) { + return typeof Fe != "string"; + }); + O ? console.warn("AG Grid: if colDef.type is supplied an array it should be of type 'string[]'") : S = d; + } else if (typeof d == "string") + S = d.split(","); + else { + console.warn("AG Grid: colDef.type should be of type 'string' | 'string[]'"); + return; + } + var z = Object.assign({}, Xt), te = this.gridOptionsWrapper.getColumnTypes() || {}; + I(te, function(Fe, ze) { + Fe in z ? console.warn("AG Grid: the column type '" + Fe + "' is a default column type and cannot be overridden.") : z[Fe] = ze; + }), S.forEach(function(Fe) { + var ze = z[Fe.trim()]; + ze ? he(g, ze, !1, !0) : console.warn("AG Grid: colDef.type '" + Fe + "' does not correspond to defined gridOptions.columnTypes"); + }); + }, f.prototype.checkForDeprecatedItems = function(d) { + if (d) { + var g = d; + g.group !== void 0 && console.warn("AG Grid: colDef.group is invalid, please check documentation on how to do grouping as it changed in version 3"), g.headerGroup !== void 0 && console.warn("AG Grid: colDef.headerGroup is invalid, please check documentation on how to do grouping as it changed in version 3"), g.headerGroupShow !== void 0 && console.warn("AG Grid: colDef.headerGroupShow is invalid, should be columnGroupShow, please check documentation on how to do grouping as it changed in version 3"), g.suppressRowGroup !== void 0 && console.warn("AG Grid: colDef.suppressRowGroup is deprecated, please use colDef.type instead"), g.suppressAggregation !== void 0 && console.warn("AG Grid: colDef.suppressAggregation is deprecated, please use colDef.type instead"), (g.suppressRowGroup || g.suppressAggregation) && console.warn("AG Grid: colDef.suppressAggregation and colDef.suppressRowGroup are deprecated, use allowRowGroup, allowPivot and allowValue instead"), g.displayName && (console.warn("AG Grid: Found displayName " + g.displayName + ", please use headerName instead, displayName is deprecated."), g.headerName = g.displayName); + } + }, f.prototype.isColumnGroup = function(d) { + return d.children !== void 0; + }, So([ + pe("columnUtils") + ], f.prototype, "columnUtils", void 0), So([ + Cn(0, yt("loggerFactory")) + ], f.prototype, "setBeans", null), f = So([ + Ne("columnFactory") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var ui = ( + /** @class */ + function() { + function M() { + } + return M.EVENT_COLUMN_EVERYTHING_CHANGED = "columnEverythingChanged", M.EVENT_NEW_COLUMNS_LOADED = "newColumnsLoaded", M.EVENT_COLUMN_PIVOT_MODE_CHANGED = "columnPivotModeChanged", M.EVENT_COLUMN_ROW_GROUP_CHANGED = "columnRowGroupChanged", M.EVENT_EXPAND_COLLAPSE_ALL = "expandOrCollapseAll", M.EVENT_COLUMN_PIVOT_CHANGED = "columnPivotChanged", M.EVENT_GRID_COLUMNS_CHANGED = "gridColumnsChanged", M.EVENT_COLUMN_VALUE_CHANGED = "columnValueChanged", M.EVENT_COLUMN_MOVED = "columnMoved", M.EVENT_COLUMN_VISIBLE = "columnVisible", M.EVENT_COLUMN_PINNED = "columnPinned", M.EVENT_COLUMN_GROUP_OPENED = "columnGroupOpened", M.EVENT_COLUMN_RESIZED = "columnResized", M.EVENT_DISPLAYED_COLUMNS_CHANGED = "displayedColumnsChanged", M.EVENT_VIRTUAL_COLUMNS_CHANGED = "virtualColumnsChanged", M.EVENT_ASYNC_TRANSACTIONS_FLUSHED = "asyncTransactionsFlushed", M.EVENT_ROW_GROUP_OPENED = "rowGroupOpened", M.EVENT_ROW_DATA_CHANGED = "rowDataChanged", M.EVENT_ROW_DATA_UPDATED = "rowDataUpdated", M.EVENT_PINNED_ROW_DATA_CHANGED = "pinnedRowDataChanged", M.EVENT_RANGE_SELECTION_CHANGED = "rangeSelectionChanged", M.EVENT_CHART_CREATED = "chartCreated", M.EVENT_CHART_RANGE_SELECTION_CHANGED = "chartRangeSelectionChanged", M.EVENT_CHART_OPTIONS_CHANGED = "chartOptionsChanged", M.EVENT_CHART_DESTROYED = "chartDestroyed", M.EVENT_TOOL_PANEL_VISIBLE_CHANGED = "toolPanelVisibleChanged", M.EVENT_COLUMN_PANEL_ITEM_DRAG_START = "columnPanelItemDragStart", M.EVENT_COLUMN_PANEL_ITEM_DRAG_END = "columnPanelItemDragEnd", M.EVENT_MODEL_UPDATED = "modelUpdated", M.EVENT_PASTE_START = "pasteStart", M.EVENT_PASTE_END = "pasteEnd", M.EVENT_FILL_START = "fillStart", M.EVENT_FILL_END = "fillEnd", M.EVENT_CELL_CLICKED = "cellClicked", M.EVENT_CELL_DOUBLE_CLICKED = "cellDoubleClicked", M.EVENT_CELL_MOUSE_DOWN = "cellMouseDown", M.EVENT_CELL_CONTEXT_MENU = "cellContextMenu", M.EVENT_CELL_VALUE_CHANGED = "cellValueChanged", M.EVENT_CELL_EDIT_REQUEST = "cellEditRequest", M.EVENT_ROW_VALUE_CHANGED = "rowValueChanged", M.EVENT_CELL_FOCUSED = "cellFocused", M.EVENT_FULL_WIDTH_ROW_FOCUSED = "fullWidthRowFocused", M.EVENT_ROW_SELECTED = "rowSelected", M.EVENT_SELECTION_CHANGED = "selectionChanged", M.EVENT_CELL_KEY_DOWN = "cellKeyDown", M.EVENT_CELL_KEY_PRESS = "cellKeyPress", M.EVENT_CELL_MOUSE_OVER = "cellMouseOver", M.EVENT_CELL_MOUSE_OUT = "cellMouseOut", M.EVENT_FILTER_CHANGED = "filterChanged", M.EVENT_FILTER_MODIFIED = "filterModified", M.EVENT_FILTER_OPENED = "filterOpened", M.EVENT_SORT_CHANGED = "sortChanged", M.EVENT_VIRTUAL_ROW_REMOVED = "virtualRowRemoved", M.EVENT_ROW_CLICKED = "rowClicked", M.EVENT_ROW_DOUBLE_CLICKED = "rowDoubleClicked", M.EVENT_GRID_READY = "gridReady", M.EVENT_GRID_SIZE_CHANGED = "gridSizeChanged", M.EVENT_VIEWPORT_CHANGED = "viewportChanged", M.EVENT_SCROLLBAR_WIDTH_CHANGED = "scrollbarWidthChanged", M.EVENT_FIRST_DATA_RENDERED = "firstDataRendered", M.EVENT_DRAG_STARTED = "dragStarted", M.EVENT_DRAG_STOPPED = "dragStopped", M.EVENT_CHECKBOX_CHANGED = "checkboxChanged", M.EVENT_ROW_EDITING_STARTED = "rowEditingStarted", M.EVENT_ROW_EDITING_STOPPED = "rowEditingStopped", M.EVENT_CELL_EDITING_STARTED = "cellEditingStarted", M.EVENT_CELL_EDITING_STOPPED = "cellEditingStopped", M.EVENT_BODY_SCROLL = "bodyScroll", M.EVENT_BODY_SCROLL_END = "bodyScrollEnd", M.EVENT_HEIGHT_SCALE_CHANGED = "heightScaleChanged", M.EVENT_PAGINATION_CHANGED = "paginationChanged", M.EVENT_COMPONENT_STATE_CHANGED = "componentStateChanged", M.EVENT_BODY_HEIGHT_CHANGED = "bodyHeightChanged", M.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED = "displayedColumnsWidthChanged", M.EVENT_SCROLL_VISIBILITY_CHANGED = "scrollVisibilityChanged", M.EVENT_COLUMN_HOVER_CHANGED = "columnHoverChanged", M.EVENT_FLASH_CELLS = "flashCells", M.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED = "paginationPixelOffsetChanged", M.EVENT_DISPLAYED_ROWS_CHANGED = "displayedRowsChanged", M.EVENT_LEFT_PINNED_WIDTH_CHANGED = "leftPinnedWidthChanged", M.EVENT_RIGHT_PINNED_WIDTH_CHANGED = "rightPinnedWidthChanged", M.EVENT_ROW_CONTAINER_HEIGHT_CHANGED = "rowContainerHeightChanged", M.EVENT_ROW_DRAG_ENTER = "rowDragEnter", M.EVENT_ROW_DRAG_MOVE = "rowDragMove", M.EVENT_ROW_DRAG_LEAVE = "rowDragLeave", M.EVENT_ROW_DRAG_END = "rowDragEnd", M.EVENT_POPUP_TO_FRONT = "popupToFront", M.EVENT_COLUMN_ROW_GROUP_CHANGE_REQUEST = "columnRowGroupChangeRequest", M.EVENT_COLUMN_PIVOT_CHANGE_REQUEST = "columnPivotChangeRequest", M.EVENT_COLUMN_VALUE_CHANGE_REQUEST = "columnValueChangeRequest", M.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST = "columnAggFuncChangeRequest", M.EVENT_KEYBOARD_FOCUS = "keyboardFocus", M.EVENT_MOUSE_FOCUS = "mouseFocus", M.EVENT_STORE_UPDATED = "storeUpdated", M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var W = ( + /** @class */ + function() { + function M() { + this.existingIds = {}; + } + return M.prototype.getInstanceIdForKey = function(f) { + var d = this.existingIds[f], g; + return typeof d != "number" ? g = 0 : g = d + 1, this.existingIds[f] = g, g; + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Cr = /[&<>"']/g, ia = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" + }; + function Ho(M) { + var f = String.fromCharCode; + function d(Lt) { + var ti = []; + if (!Lt) + return []; + for (var wi = Lt.length, Ti = 0, qi, dr; Ti < wi; ) + qi = Lt.charCodeAt(Ti++), qi >= 55296 && qi <= 56319 && Ti < wi ? (dr = Lt.charCodeAt(Ti++), (dr & 64512) == 56320 ? ti.push(((qi & 1023) << 10) + (dr & 1023) + 65536) : (ti.push(qi), Ti--)) : ti.push(qi); + return ti; + } + function g(Lt) { + if (Lt >= 55296 && Lt <= 57343) + throw Error("Lone surrogate U+" + Lt.toString(16).toUpperCase() + " is not a scalar value"); + } + function S(Lt, ti) { + return f(Lt >> ti & 63 | 128); + } + function O(Lt) { + if (Lt >= 0 && Lt <= 31 && Lt !== 10) { + var ti = Lt.toString(16).toUpperCase(), wi = ti.padStart(4, "0"); + return "_x" + wi + "_"; + } + if (!(Lt & 4294967168)) + return f(Lt); + var Ti = ""; + return Lt & 4294965248 ? Lt & 4294901760 ? Lt & 4292870144 || (Ti = f(Lt >> 18 & 7 | 240), Ti += S(Lt, 12), Ti += S(Lt, 6)) : (g(Lt), Ti = f(Lt >> 12 & 15 | 224), Ti += S(Lt, 6)) : Ti = f(Lt >> 6 & 31 | 192), Ti += f(Lt & 63 | 128), Ti; + } + for (var z = d(M), te = z.length, Fe = -1, ze, ht = ""; ++Fe < te; ) + ze = z[Fe], ht += O(ze); + return ht; + } + function Ut(M) { + return M == null ? null : M.replace(/([A-Z])/g, function(f) { + return "-" + f[0].toLowerCase(); + }); + } + function Ca(M) { + return M == null ? null : M.replace(/-([a-z])/g, function(f) { + return f[1].toUpperCase(); + }); + } + function xi(M) { + return M[0].toUpperCase() + M.substr(1).toLowerCase(); + } + function _t(M) { + return M == null ? null : M.toString().toString().replace(Cr, function(f) { + return ia[f]; + }); + } + function Fr(M) { + if (!M || M == null) + return null; + var f = /([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g, d = M.replace(f, "$1$4 $2$3$5").replace(".", " ").split(" "); + return d.map(function(g) { + return g.substring(0, 1).toUpperCase() + (g.length > 1 ? g.substring(1, g.length) : ""); + }).join(" "); + } + var ln = /* @__PURE__ */ Object.freeze({ + utf8_encode: Ho, + camelCaseToHyphen: Ut, + hyphenToCamelCase: Ca, + capitalise: xi, + escapeString: _t, + camelCaseToHumanText: Fr + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function kn(M) { + var f = /* @__PURE__ */ new Map(); + return M.forEach(function(d) { + return f.set(d[0], d[1]); + }), f; + } + function Un(M, f) { + var d = /* @__PURE__ */ new Map(); + return M.forEach(function(g) { + return d.set(f(g), g); + }), d; + } + function Cs(M) { + var f = []; + return M.forEach(function(d, g) { + return f.push(g); + }), f; + } + var ra = /* @__PURE__ */ Object.freeze({ + convertToMap: kn, + mapById: Un, + keys: Cs + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var yn = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Io = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, oh = function(M, f) { + return function(d, g) { + f(d, g, M); + }; + }, gh = function(M) { + var f = typeof Symbol == "function" && Symbol.iterator, d = f && M[f], g = 0; + if (d) + return d.call(M); + if (M && typeof M.length == "number") + return { + next: function() { + return M && g >= M.length && (M = void 0), { value: M && M[g++], done: !M }; + } + }; + throw new TypeError(f ? "Object is not iterable." : "Symbol.iterator is not defined."); + }, vc = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, qu = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(vc(arguments[f])); + return M; + }, ss = ( + /** @class */ + function(M) { + yn(f, M); + function f() { + var d = M !== null && M.apply(this, arguments) || this; + return d.primaryHeaderRowCount = 0, d.secondaryHeaderRowCount = 0, d.gridHeaderRowCount = 0, d.displayedColumnsLeft = [], d.displayedColumnsRight = [], d.displayedColumnsCenter = [], d.displayedColumns = [], d.displayedColumnsAndGroupsMap = {}, d.viewportColumns = [], d.viewportColumnsCenter = [], d.autoHeightActiveAtLeastOnce = !1, d.rowGroupColumns = [], d.valueColumns = [], d.pivotColumns = [], d.ready = !1, d.autoGroupsNeedBuilding = !1, d.forceRecreateAutoGroups = !1, d.pivotMode = !1, d.bodyWidth = 0, d.leftWidth = 0, d.rightWidth = 0, d.bodyWidthDirty = !0, d.colDefVersion = 0, d.flexColsCalculatedAtLestOnce = !1, d; + } + return f.prototype.init = function() { + var d = this; + this.suppressColumnVirtualisation = this.gridOptionsWrapper.isSuppressColumnVirtualisation(); + var g = this.gridOptionsWrapper.isPivotMode(); + this.isPivotSettingAllowed(g) && (this.pivotMode = g), this.usingTreeData = this.gridOptionsWrapper.isTreeData(), this.addManagedListener(this.gridOptionsWrapper, "autoGroupColumnDef", function() { + return d.onAutoGroupColumnDefChanged(); + }), this.addManagedListener(this.gridOptionsWrapper, "defaultColDef", function() { + return d.onDefaultColDefChanged(); + }); + }, f.prototype.onAutoGroupColumnDefChanged = function() { + this.autoGroupsNeedBuilding = !0, this.forceRecreateAutoGroups = !0, this.updateGridColumns(), this.updateDisplayedColumns("gridOptionsChanged"); + }, f.prototype.onDefaultColDefChanged = function() { + this.colDefVersion++, this.forceRecreateAutoGroups = !0, this.createColumnsFromColumnDefs(!0); + }, f.prototype.getColDefVersion = function() { + return this.colDefVersion; + }, f.prototype.setColumnDefs = function(d, g) { + g === void 0 && (g = "api"); + var S = !!this.columnDefs; + this.colDefVersion++, this.columnDefs = d, this.createColumnsFromColumnDefs(S, g); + }, f.prototype.createColumnsFromColumnDefs = function(d, g) { + var S = this; + g === void 0 && (g = "api"); + var O = d ? this.compareColumnStatesAndRaiseEvents(g) : void 0; + this.valueCache.expire(), this.autoGroupsNeedBuilding = !0; + var z = this.primaryColumns, te = this.primaryColumnTree, Fe = this.columnFactory.createColumnTree(this.columnDefs, !0, te); + this.primaryColumnTree = Fe.columnTree, this.primaryHeaderRowCount = Fe.treeDept + 1, this.primaryColumns = this.getColumnsFromTree(this.primaryColumnTree), this.primaryColumnsMap = {}, this.primaryColumns.forEach(function(Lt) { + return S.primaryColumnsMap[Lt.getId()] = Lt; + }), this.extractRowGroupColumns(g, z), this.extractPivotColumns(g, z), this.extractValueColumns(g, z), this.ready = !0; + var ze = this.gridColsArePrimary === void 0, ht = this.gridColsArePrimary || ze; + ht && (this.updateGridColumns(), d && !this.gridOptionsWrapper.isMaintainColumnOrder() && this.orderGridColumnsLikePrimary(), this.updateDisplayedColumns(g), this.checkViewportColumns()), this.dispatchEverythingChanged(g), O && O(), this.dispatchNewColumnsLoaded(); + }, f.prototype.dispatchNewColumnsLoaded = function() { + var d = { + type: ui.EVENT_NEW_COLUMNS_LOADED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(d); + }, f.prototype.dispatchEverythingChanged = function(d) { + d === void 0 && (d = "api"); + var g = { + type: ui.EVENT_COLUMN_EVERYTHING_CHANGED, + api: this.gridApi, + columnApi: this.columnApi, + source: d + }; + this.eventService.dispatchEvent(g); + }, f.prototype.orderGridColumnsLikePrimary = function() { + var d = this, g = this.primaryColumns; + g && this.gridColumns.sort(function(S, O) { + var z = g.indexOf(S), te = g.indexOf(O), Fe = z >= 0, ze = te >= 0; + if (Fe && ze) + return z - te; + if (Fe) + return 1; + if (ze) + return -1; + var ht = d.gridColumns.indexOf(S), Lt = d.gridColumns.indexOf(O); + return ht - Lt; + }); + }, f.prototype.getAllDisplayedAutoHeightCols = function() { + return this.displayedAutoHeightCols; + }, f.prototype.setViewport = function() { + this.gridOptionsWrapper.isEnableRtl() ? (this.viewportLeft = this.bodyWidth - this.scrollPosition - this.scrollWidth, this.viewportRight = this.bodyWidth - this.scrollPosition) : (this.viewportLeft = this.scrollPosition, this.viewportRight = this.scrollWidth + this.scrollPosition); + }, f.prototype.getDisplayedColumnsStartingAt = function(d) { + for (var g = d, S = []; g != null; ) + S.push(g), g = this.getDisplayedColAfter(g); + return S; + }, f.prototype.checkViewportColumns = function() { + if (this.displayedColumnsCenter != null) { + var d = this.viewportColumns.map(function(O) { + return O.getId(); + }).join("#"); + this.extractViewport(); + var g = this.viewportColumns.map(function(O) { + return O.getId(); + }).join("#"); + if (d !== g) { + var S = { + type: ui.EVENT_VIRTUAL_COLUMNS_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(S); + } + } + }, f.prototype.setViewportPosition = function(d, g) { + (d !== this.scrollWidth || g !== this.scrollPosition || this.bodyWidthDirty) && (this.scrollWidth = d, this.scrollPosition = g, this.bodyWidthDirty = !0, this.setViewport(), this.ready && this.checkViewportColumns()); + }, f.prototype.isPivotMode = function() { + return this.pivotMode; + }, f.prototype.isPivotSettingAllowed = function(d) { + return d && this.gridOptionsWrapper.isTreeData() ? (console.warn("AG Grid: Pivot mode not available in conjunction Tree Data i.e. 'gridOptions.treeData: true'"), !1) : !0; + }, f.prototype.setPivotMode = function(d, g) { + if (g === void 0 && (g = "api"), !(d === this.pivotMode || !this.isPivotSettingAllowed(this.pivotMode))) { + this.pivotMode = d, this.autoGroupsNeedBuilding = !0, this.updateGridColumns(), this.updateDisplayedColumns(g); + var S = { + type: ui.EVENT_COLUMN_PIVOT_MODE_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(S); + } + }, f.prototype.getSecondaryPivotColumn = function(d, g) { + if (r(this.secondaryColumns)) + return null; + var S = this.getPrimaryColumn(g), O = null; + return this.secondaryColumns.forEach(function(z) { + var te = z.getColDef().pivotKeys, Fe = z.getColDef().pivotValueColumn, ze = _(te, d), ht = Fe === S; + ze && ht && (O = z); + }), O; + }, f.prototype.setBeans = function(d) { + this.logger = d.create("columnModel"); + }, f.prototype.setFirstRightAndLastLeftPinned = function(d) { + var g, S; + this.gridOptionsWrapper.isEnableRtl() ? (g = this.displayedColumnsLeft ? this.displayedColumnsLeft[0] : null, S = this.displayedColumnsRight ? m(this.displayedColumnsRight) : null) : (g = this.displayedColumnsLeft ? m(this.displayedColumnsLeft) : null, S = this.displayedColumnsRight ? this.displayedColumnsRight[0] : null), this.gridColumns.forEach(function(O) { + O.setLastLeftPinned(O === g, d), O.setFirstRightPinned(O === S, d); + }); + }, f.prototype.autoSizeColumns = function(d) { + var g = this, S = d.columns, O = d.skipHeader, z = d.skipHeaderGroups, te = d.stopAtGroup, Fe = d.source, ze = Fe === void 0 ? "api" : Fe; + this.animationFrameService.flushAllFrames(); + for (var ht = [], Lt = -1, ti = O ?? this.gridOptionsWrapper.isSkipHeaderOnAutoSize(), wi = z ?? ti; Lt !== 0; ) + Lt = 0, this.actionOnGridColumns(S, function(Ti) { + if (ht.indexOf(Ti) >= 0) + return !1; + var qi = g.autoWidthCalculator.getPreferredWidthForColumn(Ti, ti); + if (qi > 0) { + var dr = g.normaliseColumnWidth(Ti, qi); + Ti.setActualWidth(dr, ze), ht.push(Ti), Lt++; + } + return !0; + }, ze); + wi || this.autoSizeColumnGroupsByColumns(S, te), this.fireColumnResizedEvent(ht, !0, "autosizeColumns"); + }, f.prototype.fireColumnResizedEvent = function(d, g, S, O) { + if (O === void 0 && (O = null), d && d.length) { + var z = { + type: ui.EVENT_COLUMN_RESIZED, + columns: d, + column: d.length === 1 ? d[0] : null, + flexColumns: O, + finished: g, + api: this.gridApi, + columnApi: this.columnApi, + source: S + }; + this.eventService.dispatchEvent(z); + } + }, f.prototype.autoSizeColumn = function(d, g, S) { + S === void 0 && (S = "api"), d && this.autoSizeColumns({ columns: [d], skipHeader: g, skipHeaderGroups: !0, source: S }); + }, f.prototype.autoSizeColumnGroupsByColumns = function(d, g) { + var S, O, z, te, Fe = /* @__PURE__ */ new Set(), ze = this.getGridColumns(d); + ze.forEach(function(Rr) { + for (var Vr = Rr.getParent(); Vr && Vr != g; ) + Vr.isPadding() || Fe.add(Vr), Vr = Vr.getParent(); + }); + var ht, Lt = []; + try { + for (var ti = gh(Fe), wi = ti.next(); !wi.done; wi = ti.next()) { + var Ti = wi.value; + try { + for (var qi = (z = void 0, gh(this.ctrlsService.getHeaderRowContainerCtrls())), dr = qi.next(); !dr.done; dr = qi.next()) { + var kr = dr.value; + if (ht = kr.getHeaderCtrlForColumn(Ti), ht) + break; + } + } catch (Rr) { + z = { error: Rr }; + } finally { + try { + dr && !dr.done && (te = qi.return) && te.call(qi); + } finally { + if (z) + throw z.error; + } + } + ht && ht.resizeLeafColumnsToFit(); + } + } catch (Rr) { + S = { error: Rr }; + } finally { + try { + wi && !wi.done && (O = ti.return) && O.call(ti); + } finally { + if (S) + throw S.error; + } + } + return Lt; + }, f.prototype.autoSizeAllColumns = function(d, g) { + g === void 0 && (g = "api"); + var S = this.getAllDisplayedColumns(); + this.autoSizeColumns({ columns: S, skipHeader: d, source: g }); + }, f.prototype.getColumnsFromTree = function(d) { + var g = [], S = function(O) { + for (var z = 0; z < O.length; z++) { + var te = O[z]; + te instanceof H ? g.push(te) : te instanceof Jt && S(te.getChildren()); + } + }; + return S(d), g; + }, f.prototype.getAllDisplayedTrees = function() { + return this.displayedTreeLeft && this.displayedTreeRight && this.displayedTreeCentre ? this.displayedTreeLeft.concat(this.displayedTreeCentre).concat(this.displayedTreeRight) : null; + }, f.prototype.getPrimaryColumnTree = function() { + return this.primaryColumnTree; + }, f.prototype.getHeaderRowCount = function() { + return this.gridHeaderRowCount; + }, f.prototype.getDisplayedTreeLeft = function() { + return this.displayedTreeLeft; + }, f.prototype.getDisplayedTreeRight = function() { + return this.displayedTreeRight; + }, f.prototype.getDisplayedTreeCentre = function() { + return this.displayedTreeCentre; + }, f.prototype.isColumnDisplayed = function(d) { + return this.getAllDisplayedColumns().indexOf(d) >= 0; + }, f.prototype.getAllDisplayedColumns = function() { + return this.displayedColumns; + }, f.prototype.getViewportColumns = function() { + return this.viewportColumns; + }, f.prototype.getDisplayedLeftColumnsForRow = function(d) { + return this.colSpanActive ? this.getDisplayedColumnsForRow(d, this.displayedColumnsLeft) : this.displayedColumnsLeft; + }, f.prototype.getDisplayedRightColumnsForRow = function(d) { + return this.colSpanActive ? this.getDisplayedColumnsForRow(d, this.displayedColumnsRight) : this.displayedColumnsRight; + }, f.prototype.getDisplayedColumnsForRow = function(d, g, S, O) { + for (var z = [], te = null, Fe = function(Lt) { + var ti = g[Lt], wi = g.length - Lt, Ti = Math.min(ti.getColSpan(d), wi), qi = [ti]; + if (Ti > 1) { + for (var dr = Ti - 1, kr = 1; kr <= dr; kr++) + qi.push(g[Lt + kr]); + Lt += dr; + } + var Rr; + if (S ? (Rr = !1, qi.forEach(function(An) { + S(An) && (Rr = !0); + })) : Rr = !0, Rr) { + if (z.length === 0 && te) { + var Vr = O ? O(ti) : !1; + Vr && z.push(te); + } + z.push(ti); + } + te = ti, ze = Lt; + }, ze, ht = 0; ht < g.length; ht++) + Fe(ht), ht = ze; + return z; + }, f.prototype.getViewportCenterColumnsForRow = function(d) { + var g = this; + if (!this.colSpanActive) + return this.viewportColumnsCenter; + var S = function(z) { + var te = z.getLeft(); + return i(te) && te > g.viewportLeft; + }, O = this.suppressColumnVirtualisation ? null : this.isColumnInViewport.bind(this); + return this.getDisplayedColumnsForRow(d, this.displayedColumnsCenter, O, S); + }, f.prototype.getAriaColumnIndex = function(d) { + return this.getAllGridColumns().indexOf(d) + 1; + }, f.prototype.isColumnInViewport = function(d) { + if (d.isAutoHeight()) + return !0; + var g = d.getLeft() || 0, S = g + d.getActualWidth(), O = this.viewportLeft - 200, z = this.viewportRight + 200, te = g < O && S < O, Fe = g > z && S > z; + return !te && !Fe; + }, f.prototype.getDisplayedColumnsLeftWidth = function() { + return this.getWidthOfColsInList(this.displayedColumnsLeft); + }, f.prototype.getDisplayedColumnsRightWidth = function() { + return this.getWidthOfColsInList(this.displayedColumnsRight); + }, f.prototype.updatePrimaryColumnList = function(d, g, S, O, z, te) { + var Fe = this; + if (te === void 0 && (te = "api"), !(!d || n(d))) { + var ze = !1; + if (d.forEach(function(Lt) { + var ti = Fe.getPrimaryColumn(Lt); + if (ti) { + if (S) { + if (g.indexOf(ti) >= 0) + return; + g.push(ti); + } else { + if (g.indexOf(ti) < 0) + return; + q(g, ti); + } + O(ti), ze = !0; + } + }), !!ze) { + this.autoGroupsNeedBuilding && this.updateGridColumns(), this.updateDisplayedColumns(te); + var ht = { + type: z, + columns: g, + column: g.length === 1 ? g[0] : null, + api: this.gridApi, + columnApi: this.columnApi, + source: te + }; + this.eventService.dispatchEvent(ht); + } + } + }, f.prototype.setRowGroupColumns = function(d, g) { + g === void 0 && (g = "api"), this.autoGroupsNeedBuilding = !0, this.setPrimaryColumnList(d, this.rowGroupColumns, ui.EVENT_COLUMN_ROW_GROUP_CHANGED, this.setRowGroupActive.bind(this), g); + }, f.prototype.setRowGroupActive = function(d, g, S) { + d !== g.isRowGroupActive() && (g.setRowGroupActive(d, S), !d && !this.gridOptionsWrapper.isSuppressMakeColumnVisibleAfterUnGroup() && g.setVisible(!0, S)); + }, f.prototype.addRowGroupColumn = function(d, g) { + g === void 0 && (g = "api"), d && this.addRowGroupColumns([d], g); + }, f.prototype.addRowGroupColumns = function(d, g) { + g === void 0 && (g = "api"), this.autoGroupsNeedBuilding = !0, this.updatePrimaryColumnList(d, this.rowGroupColumns, !0, this.setRowGroupActive.bind(this, !0), ui.EVENT_COLUMN_ROW_GROUP_CHANGED, g); + }, f.prototype.removeRowGroupColumns = function(d, g) { + g === void 0 && (g = "api"), this.autoGroupsNeedBuilding = !0, this.updatePrimaryColumnList(d, this.rowGroupColumns, !1, this.setRowGroupActive.bind(this, !1), ui.EVENT_COLUMN_ROW_GROUP_CHANGED, g); + }, f.prototype.removeRowGroupColumn = function(d, g) { + g === void 0 && (g = "api"), d && this.removeRowGroupColumns([d], g); + }, f.prototype.addPivotColumns = function(d, g) { + g === void 0 && (g = "api"), this.updatePrimaryColumnList(d, this.pivotColumns, !0, function(S) { + return S.setPivotActive(!0, g); + }, ui.EVENT_COLUMN_PIVOT_CHANGED, g); + }, f.prototype.setPivotColumns = function(d, g) { + g === void 0 && (g = "api"), this.setPrimaryColumnList(d, this.pivotColumns, ui.EVENT_COLUMN_PIVOT_CHANGED, function(S, O) { + O.setPivotActive(S, g); + }, g); + }, f.prototype.addPivotColumn = function(d, g) { + g === void 0 && (g = "api"), this.addPivotColumns([d], g); + }, f.prototype.removePivotColumns = function(d, g) { + g === void 0 && (g = "api"), this.updatePrimaryColumnList(d, this.pivotColumns, !1, function(S) { + return S.setPivotActive(!1, g); + }, ui.EVENT_COLUMN_PIVOT_CHANGED, g); + }, f.prototype.removePivotColumn = function(d, g) { + g === void 0 && (g = "api"), this.removePivotColumns([d], g); + }, f.prototype.setPrimaryColumnList = function(d, g, S, O, z) { + var te = this; + g.length = 0, i(d) && d.forEach(function(Fe) { + var ze = te.getPrimaryColumn(Fe); + ze && g.push(ze); + }), (this.primaryColumns || []).forEach(function(Fe) { + var ze = g.indexOf(Fe) >= 0; + O(ze, Fe); + }), this.autoGroupsNeedBuilding && this.updateGridColumns(), this.updateDisplayedColumns(z), this.fireColumnEvent(S, g, z); + }, f.prototype.setValueColumns = function(d, g) { + g === void 0 && (g = "api"), this.setPrimaryColumnList(d, this.valueColumns, ui.EVENT_COLUMN_VALUE_CHANGED, this.setValueActive.bind(this), g); + }, f.prototype.setValueActive = function(d, g, S) { + if (d !== g.isValueActive() && (g.setValueActive(d, S), d && !g.getAggFunc())) { + var O = this.aggFuncService.getDefaultAggFunc(g); + g.setAggFunc(O); + } + }, f.prototype.addValueColumns = function(d, g) { + g === void 0 && (g = "api"), this.updatePrimaryColumnList(d, this.valueColumns, !0, this.setValueActive.bind(this, !0), ui.EVENT_COLUMN_VALUE_CHANGED, g); + }, f.prototype.addValueColumn = function(d, g) { + g === void 0 && (g = "api"), d && this.addValueColumns([d], g); + }, f.prototype.removeValueColumn = function(d, g) { + g === void 0 && (g = "api"), this.removeValueColumns([d], g); + }, f.prototype.removeValueColumns = function(d, g) { + g === void 0 && (g = "api"), this.updatePrimaryColumnList(d, this.valueColumns, !1, this.setValueActive.bind(this, !1), ui.EVENT_COLUMN_VALUE_CHANGED, g); + }, f.prototype.normaliseColumnWidth = function(d, g) { + var S = d.getMinWidth(); + i(S) && g < S && (g = S); + var O = d.getMaxWidth(); + return i(O) && d.isGreaterThanMax(g) && (g = O), g; + }, f.prototype.getPrimaryOrGridColumn = function(d) { + var g = this.getPrimaryColumn(d); + return g || this.getGridColumn(d); + }, f.prototype.setColumnWidths = function(d, g, S, O) { + var z = this; + O === void 0 && (O = "api"); + var te = []; + d.forEach(function(Fe) { + var ze = z.getPrimaryOrGridColumn(Fe.key); + if (ze) { + te.push({ + width: Fe.newWidth, + ratios: [1], + columns: [ze] + }); + var ht = z.gridOptionsWrapper.getColResizeDefault() === "shift"; + if (ht && (g = !g), g) { + var Lt = z.getDisplayedColAfter(ze); + if (!Lt) + return; + var ti = ze.getActualWidth() - Fe.newWidth, wi = Lt.getActualWidth() + ti; + te.push({ + width: wi, + ratios: [1], + columns: [Lt] + }); + } + } + }), te.length !== 0 && this.resizeColumnSets({ + resizeSets: te, + finished: S, + source: O + }); + }, f.prototype.checkMinAndMaxWidthsForSet = function(d) { + var g = d.columns, S = d.width, O = 0, z = 0, te = !0; + g.forEach(function(ht) { + var Lt = ht.getMinWidth(); + O += Lt || 0; + var ti = ht.getMaxWidth(); + i(ti) && ti > 0 ? z += ti : te = !1; + }); + var Fe = S >= O, ze = !te || S <= z; + return Fe && ze; + }, f.prototype.resizeColumnSets = function(d) { + var g = this, S = d.resizeSets, O = d.finished, z = d.source, te = !S || S.every(function(Ti) { + return g.checkMinAndMaxWidthsForSet(Ti); + }); + if (!te) { + if (O) { + var Fe = S && S.length > 0 ? S[0].columns : null; + this.fireColumnResizedEvent(Fe, O, z); + } + return; + } + var ze = [], ht = []; + S.forEach(function(Ti) { + var qi = Ti.width, dr = Ti.columns, kr = Ti.ratios, Rr = {}, Vr = {}; + dr.forEach(function(po) { + return ht.push(po); + }); + for (var An = !0, Js = 0, Ya = function() { + if (Js++, Js > 1e3) + return console.error("AG Grid: infinite loop in resizeColumnSets"), "break"; + An = !1; + var po = [], El = 0, Il = qi; + dr.forEach(function($p, c2) { + var h2 = Vr[$p.getId()]; + if (h2) + Il -= Rr[$p.getId()]; + else { + po.push($p); + var $1 = kr[c2]; + El += $1; + } + }); + var kp = 1 / El; + po.forEach(function($p, c2) { + var h2 = c2 === po.length - 1, $1; + h2 ? $1 = Il : ($1 = Math.round(kr[c2] * qi * kp), Il -= $1); + var L9 = $p.getMinWidth(), XL = $p.getMaxWidth(); + i(L9) && $1 < L9 ? ($1 = L9, Vr[$p.getId()] = !0, An = !0) : i(XL) && XL > 0 && $1 > XL && ($1 = XL, Vr[$p.getId()] = !0, An = !0), Rr[$p.getId()] = $1; + }); + }; An; ) { + var Xa = Ya(); + if (Xa === "break") + break; + } + dr.forEach(function(po) { + var El = Rr[po.getId()], Il = po.getActualWidth(); + Il !== El && (po.setActualWidth(El, z), ze.push(po)); + }); + }); + var Lt = ze.length > 0, ti = []; + Lt && (ti = this.refreshFlexedColumns({ resizingCols: ht, skipSetLeft: !0 }), this.setLeftValues(z), this.updateBodyWidths(), this.checkViewportColumns()); + var wi = ht.concat(ti); + (Lt || O) && this.fireColumnResizedEvent(wi, O, z, ti); + }, f.prototype.setColumnAggFunc = function(d, g, S) { + if (S === void 0 && (S = "api"), !!d) { + var O = this.getPrimaryColumn(d); + O && (O.setAggFunc(g), this.fireColumnEvent(ui.EVENT_COLUMN_VALUE_CHANGED, [O], S)); + } + }, f.prototype.fireColumnEvent = function(d, g, S) { + var O = { + type: d, + columns: g, + column: g && g.length == 1 ? g[0] : null, + api: this.gridApi, + columnApi: this.columnApi, + source: S + }; + this.eventService.dispatchEvent(O); + }, f.prototype.moveRowGroupColumn = function(d, g, S) { + S === void 0 && (S = "api"); + var O = this.rowGroupColumns[d]; + this.rowGroupColumns.splice(d, 1), this.rowGroupColumns.splice(g, 0, O); + var z = { + type: ui.EVENT_COLUMN_ROW_GROUP_CHANGED, + columns: this.rowGroupColumns, + column: this.rowGroupColumns.length === 1 ? this.rowGroupColumns[0] : null, + api: this.gridApi, + columnApi: this.columnApi, + source: S + }; + this.eventService.dispatchEvent(z); + }, f.prototype.moveColumns = function(d, g, S) { + if (S === void 0 && (S = "api"), this.columnAnimationService.start(), g > this.gridColumns.length - d.length) { + console.warn("AG Grid: tried to insert columns in invalid location, toIndex = " + g), console.warn("AG Grid: remember that you should not count the moving columns when calculating the new index"); + return; + } + var O = this.getGridColumns(d), z = !this.doesMovePassRules(O, g); + if (!z) { + de(this.gridColumns, O, g), this.updateDisplayedColumns(S); + var te = { + type: ui.EVENT_COLUMN_MOVED, + columns: O, + column: O.length === 1 ? O[0] : null, + toIndex: g, + api: this.gridApi, + columnApi: this.columnApi, + source: S + }; + this.eventService.dispatchEvent(te), this.columnAnimationService.finish(); + } + }, f.prototype.doesMovePassRules = function(d, g) { + var S = this.gridColumns.slice(); + return de(S, d, g), !(!this.doesMovePassMarryChildren(S) || !this.doesMovePassLockedPositions(S)); + }, f.prototype.sortColumnsLikeGridColumns = function(d) { + var g = this; + if (!(!d || d.length <= 1)) { + var S = d.filter(function(O) { + return g.gridColumns.indexOf(O) < 0; + }).length > 0; + S || d.sort(function(O, z) { + var te = g.gridColumns.indexOf(O), Fe = g.gridColumns.indexOf(z); + return te - Fe; + }); + } + }, f.prototype.doesMovePassLockedPositions = function(d) { + var g = 0, S = !0, O = function(z) { + return z ? z === !0 || z === "left" ? 0 : 2 : 1; + }; + return d.forEach(function(z) { + var te = O(z.getColDef().lockPosition); + te < g && (S = !1), g = te; + }), S; + }, f.prototype.doesMovePassMarryChildren = function(d) { + var g = !0; + return this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function(S) { + if (S instanceof Jt) { + var O = S, z = O.getColGroupDef(), te = z && z.marryChildren; + if (te) { + var Fe = []; + O.getLeafColumns().forEach(function(wi) { + var Ti = d.indexOf(wi); + Fe.push(Ti); + }); + var ze = Math.max.apply(Math, Fe), ht = Math.min.apply(Math, Fe), Lt = ze - ht, ti = O.getLeafColumns().length - 1; + Lt > ti && (g = !1); + } + } + }), g; + }, f.prototype.moveColumn = function(d, g, S) { + S === void 0 && (S = "api"), this.moveColumns([d], g, S); + }, f.prototype.moveColumnByIndex = function(d, g, S) { + S === void 0 && (S = "api"); + var O = this.gridColumns[d]; + this.moveColumn(O, g, S); + }, f.prototype.getColumnDefs = function() { + var d = this; + if (this.primaryColumns) { + var g = this.primaryColumns.slice(); + return this.gridColsArePrimary ? g.sort(function(S, O) { + return d.gridColumns.indexOf(S) - d.gridColumns.indexOf(O); + }) : this.lastPrimaryOrder && g.sort(function(S, O) { + return d.lastPrimaryOrder.indexOf(S) - d.lastPrimaryOrder.indexOf(O); + }), this.columnDefFactory.buildColumnDefs(g, this.rowGroupColumns, this.pivotColumns); + } + }, f.prototype.getBodyContainerWidth = function() { + return this.bodyWidth; + }, f.prototype.getContainerWidth = function(d) { + switch (d) { + case Ue.PINNED_LEFT: + return this.leftWidth; + case Ue.PINNED_RIGHT: + return this.rightWidth; + default: + return this.bodyWidth; + } + }, f.prototype.updateBodyWidths = function() { + var d = this.getWidthOfColsInList(this.displayedColumnsCenter), g = this.getWidthOfColsInList(this.displayedColumnsLeft), S = this.getWidthOfColsInList(this.displayedColumnsRight); + this.bodyWidthDirty = this.bodyWidth !== d; + var O = this.bodyWidth !== d || this.leftWidth !== g || this.rightWidth !== S; + if (O) { + this.bodyWidth = d, this.leftWidth = g, this.rightWidth = S; + var z = { + type: ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(z); + } + }, f.prototype.getValueColumns = function() { + return this.valueColumns ? this.valueColumns : []; + }, f.prototype.getPivotColumns = function() { + return this.pivotColumns ? this.pivotColumns : []; + }, f.prototype.isPivotActive = function() { + return this.pivotColumns && this.pivotColumns.length > 0 && this.pivotMode; + }, f.prototype.getRowGroupColumns = function() { + return this.rowGroupColumns ? this.rowGroupColumns : []; + }, f.prototype.getDisplayedCenterColumns = function() { + return this.displayedColumnsCenter; + }, f.prototype.getDisplayedLeftColumns = function() { + return this.displayedColumnsLeft; + }, f.prototype.getDisplayedRightColumns = function() { + return this.displayedColumnsRight; + }, f.prototype.getDisplayedColumns = function(d) { + switch (d) { + case Ue.PINNED_LEFT: + return this.getDisplayedLeftColumns(); + case Ue.PINNED_RIGHT: + return this.getDisplayedRightColumns(); + default: + return this.getDisplayedCenterColumns(); + } + }, f.prototype.getAllPrimaryColumns = function() { + return this.primaryColumns ? this.primaryColumns.slice() : null; + }, f.prototype.getSecondaryColumns = function() { + return this.secondaryColumns ? this.secondaryColumns.slice() : null; + }, f.prototype.getAllColumnsForQuickFilter = function() { + return this.columnsForQuickFilter; + }, f.prototype.getAllGridColumns = function() { + return this.gridColumns; + }, f.prototype.isEmpty = function() { + return n(this.gridColumns); + }, f.prototype.isRowGroupEmpty = function() { + return n(this.rowGroupColumns); + }, f.prototype.setColumnVisible = function(d, g, S) { + S === void 0 && (S = "api"), this.setColumnsVisible([d], g, S); + }, f.prototype.setColumnsVisible = function(d, g, S) { + var O = this; + g === void 0 && (g = !1), S === void 0 && (S = "api"), this.columnAnimationService.start(), this.actionOnGridColumns(d, function(z) { + return z.isVisible() !== g ? (z.setVisible(g, S), !0) : !1; + }, S, function() { + var z = { + type: ui.EVENT_COLUMN_VISIBLE, + visible: g, + column: null, + columns: null, + api: O.gridApi, + columnApi: O.columnApi, + source: S + }; + return z; + }), this.columnAnimationService.finish(); + }, f.prototype.setColumnPinned = function(d, g, S) { + S === void 0 && (S = "api"), d && this.setColumnsPinned([d], g, S); + }, f.prototype.setColumnsPinned = function(d, g, S) { + var O = this; + if (S === void 0 && (S = "api"), this.gridOptionsWrapper.getDomLayout() === "print") { + console.warn("Changing the column pinning status is not allowed with domLayout='print'"); + return; + } + this.columnAnimationService.start(); + var z; + g === !0 || g === Ue.PINNED_LEFT ? z = Ue.PINNED_LEFT : g === Ue.PINNED_RIGHT ? z = Ue.PINNED_RIGHT : z = null, this.actionOnGridColumns(d, function(te) { + return te.getPinned() !== z ? (te.setPinned(z), !0) : !1; + }, S, function() { + var te = { + type: ui.EVENT_COLUMN_PINNED, + pinned: z, + column: null, + columns: null, + api: O.gridApi, + columnApi: O.columnApi, + source: S + }; + return te; + }), this.columnAnimationService.finish(); + }, f.prototype.actionOnGridColumns = function(d, g, S, O) { + var z = this; + if (!n(d)) { + var te = []; + if (d.forEach(function(ze) { + var ht = z.getGridColumn(ze); + if (ht) { + var Lt = g(ht); + Lt !== !1 && te.push(ht); + } + }), !!te.length && (this.updateDisplayedColumns(S), i(O) && O)) { + var Fe = O(); + Fe.columns = te, Fe.column = te.length === 1 ? te[0] : null, this.eventService.dispatchEvent(Fe); + } + } + }, f.prototype.getDisplayedColBefore = function(d) { + var g = this.getAllDisplayedColumns(), S = g.indexOf(d); + return S > 0 ? g[S - 1] : null; + }, f.prototype.getDisplayedColAfter = function(d) { + var g = this.getAllDisplayedColumns(), S = g.indexOf(d); + return S < g.length - 1 ? g[S + 1] : null; + }, f.prototype.getDisplayedGroupAfter = function(d) { + return this.getDisplayedGroupAtDirection(d, "After"); + }, f.prototype.getDisplayedGroupBefore = function(d) { + return this.getDisplayedGroupAtDirection(d, "Before"); + }, f.prototype.getDisplayedGroupAtDirection = function(d, g) { + for (var S = d.getProvidedColumnGroup().getLevel() + d.getPaddingLevel(), O = d.getDisplayedLeafColumns(), z = g === "After" ? m(O) : O[0], te = "getDisplayedCol" + g; ; ) { + var Fe = this[te](z); + if (!Fe) + return null; + var ze = this.getColumnGroupAtLevel(Fe, S); + if (ze !== d) + return ze; + } + }, f.prototype.getColumnGroupAtLevel = function(d, g) { + for (var S = d.getParent(), O, z; ; ) { + var te = S.getProvidedColumnGroup(); + if (O = te.getLevel(), z = S.getPaddingLevel(), O + z <= g) + break; + S = S.getParent(); + } + return S; + }, f.prototype.isPinningLeft = function() { + return this.displayedColumnsLeft.length > 0; + }, f.prototype.isPinningRight = function() { + return this.displayedColumnsRight.length > 0; + }, f.prototype.getPrimaryAndSecondaryAndAutoColumns = function() { + var d; + return (d = []).concat.apply(d, qu([ + this.primaryColumns || [], + this.groupAutoColumns || [], + this.secondaryColumns || [] + ])); + }, f.prototype.getPrimaryAndAutoGroupCols = function() { + var d; + return (d = []).concat.apply(d, qu([ + this.primaryColumns || [], + this.groupAutoColumns || [] + ])); + }, f.prototype.getPrimaryAndSecondaryColumns = function() { + var d; + return (d = []).concat.apply(d, qu([ + this.primaryColumns || [], + this.secondaryColumns || [] + ])); + }, f.prototype.createStateItemFromColumn = function(d) { + var g = d.isRowGroupActive() ? this.rowGroupColumns.indexOf(d) : null, S = d.isPivotActive() ? this.pivotColumns.indexOf(d) : null, O = d.isValueActive() ? d.getAggFunc() : null, z = d.getSort() != null ? d.getSort() : null, te = d.getSortIndex() != null ? d.getSortIndex() : null, Fe = d.getFlex() != null && d.getFlex() > 0 ? d.getFlex() : null, ze = { + colId: d.getColId(), + width: d.getActualWidth(), + hide: !d.isVisible(), + pinned: d.getPinned(), + sort: z, + sortIndex: te, + aggFunc: O, + rowGroup: d.isRowGroupActive(), + rowGroupIndex: g, + pivot: d.isPivotActive(), + pivotIndex: S, + flex: Fe + }; + return ze; + }, f.prototype.getColumnState = function() { + if (r(this.primaryColumns) || !this.isAlive()) + return []; + var d = this.getPrimaryAndSecondaryAndAutoColumns(), g = d.map(this.createStateItemFromColumn.bind(this)); + return this.orderColumnStateList(g), g; + }, f.prototype.orderColumnStateList = function(d) { + var g = kn(this.gridColumns.map(function(S, O) { + return [S.getColId(), O]; + })); + d.sort(function(S, O) { + var z = g.has(S.colId) ? g.get(S.colId) : -1, te = g.has(O.colId) ? g.get(O.colId) : -1; + return z - te; + }); + }, f.prototype.resetColumnState = function(d) { + d === void 0 && (d = "api"); + var g = this.getColumnsFromTree(this.primaryColumnTree), S = [], O = 1e3, z = 1e3, te = []; + this.groupAutoColumns && (te = te.concat(this.groupAutoColumns)), g && (te = te.concat(g)), te.forEach(function(Fe) { + var ze = function(Xa, po) { + return Xa ?? po ?? null; + }, ht = Fe.getColDef(), Lt = ze(ht.sort, ht.initialSort), ti = ze(ht.sortIndex, ht.initialSortIndex), wi = ze(ht.hide, ht.initialHide), Ti = ze(ht.pinned, ht.initialPinned), qi = ze(ht.width, ht.initialWidth), dr = ze(ht.flex, ht.initialFlex), kr = ze(ht.rowGroupIndex, ht.initialRowGroupIndex), Rr = ze(ht.rowGroup, ht.initialRowGroup); + kr == null && (Rr == null || Rr == !1) && (kr = null, Rr = null); + var Vr = ze(ht.pivotIndex, ht.initialPivotIndex), An = ze(ht.pivot, ht.initialPivot); + Vr == null && (An == null || An == !1) && (Vr = null, An = null); + var Js = ze(ht.aggFunc, ht.initialAggFunc), Ya = { + colId: Fe.getColId(), + sort: Lt, + sortIndex: ti, + hide: wi, + pinned: Ti, + width: qi, + flex: dr, + rowGroup: Rr, + rowGroupIndex: kr, + pivot: An, + pivotIndex: Vr, + aggFunc: Js + }; + r(kr) && Rr && (Ya.rowGroupIndex = O++), r(Vr) && An && (Ya.pivotIndex = z++), S.push(Ya); + }), this.applyColumnState({ state: S, applyOrder: !0 }, d); + }, f.prototype.applyColumnState = function(d, g) { + var S = this; + if (g === void 0 && (g = "api"), n(this.primaryColumns)) + return !1; + if (d && d.state && !d.state.forEach) + return console.warn("AG Grid: applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state."), !1; + var O = function(ze, ht, Lt) { + var ti = S.compareColumnStatesAndRaiseEvents(g); + S.autoGroupsNeedBuilding = !0; + var wi = ht.slice(), Ti = {}, qi = {}, dr = [], kr = [], Rr = 0, Vr = S.rowGroupColumns.slice(), An = S.pivotColumns.slice(); + ze.forEach(function(po) { + var El = po.colId || "", Il = El.startsWith(Ue.GROUP_AUTO_COLUMN_ID); + if (Il) { + dr.push(po), kr.push(po); + return; + } + var kp = Lt(El); + kp ? (S.syncColumnWithStateItem(kp, po, d.defaultState, Ti, qi, !1, g), q(wi, kp)) : (kr.push(po), Rr += 1); + }); + var Js = function(po) { + return S.syncColumnWithStateItem(po, null, d.defaultState, Ti, qi, !1, g); + }; + wi.forEach(Js); + var Ya = function(po, El, Il, kp) { + var $p = po[Il.getId()], c2 = po[kp.getId()], h2 = $p != null, $1 = c2 != null; + if (h2 && $1) + return $p - c2; + if (h2) + return -1; + if ($1) + return 1; + var L9 = El.indexOf(Il), XL = El.indexOf(kp), rje = L9 >= 0, l$t = XL >= 0; + return rje && l$t ? L9 - XL : rje ? -1 : 1; + }; + S.rowGroupColumns.sort(Ya.bind(S, Ti, Vr)), S.pivotColumns.sort(Ya.bind(S, qi, An)), S.updateGridColumns(); + var Xa = S.groupAutoColumns ? S.groupAutoColumns.slice() : []; + return dr.forEach(function(po) { + var El = S.getAutoColumn(po.colId); + q(Xa, El), S.syncColumnWithStateItem(El, po, d.defaultState, null, null, !0, g); + }), Xa.forEach(Js), S.applyOrderAfterApplyState(d), S.updateDisplayedColumns(g), S.dispatchEverythingChanged(g), ti(), { unmatchedAndAutoStates: kr, unmatchedCount: Rr }; + }; + this.columnAnimationService.start(); + var z = O(d.state || [], this.primaryColumns || [], function(ze) { + return S.getPrimaryColumn(ze); + }), te = z.unmatchedAndAutoStates, Fe = z.unmatchedCount; + return (te.length > 0 || i(d.defaultState)) && (Fe = O(te, this.secondaryColumns || [], function(ze) { + return S.getSecondaryColumn(ze); + }).unmatchedCount), this.columnAnimationService.finish(), Fe === 0; + }, f.prototype.applyOrderAfterApplyState = function(d) { + var g = this; + if (!(!d.applyOrder || !d.state)) { + var S = [], O = {}; + d.state.forEach(function(te) { + if (!(!te.colId || O[te.colId])) { + var Fe = g.gridColumnsMap[te.colId]; + Fe && (S.push(Fe), O[te.colId] = !0); + } + }); + var z = 0; + if (this.gridColumns.forEach(function(te) { + var Fe = te.getColId(), ze = O[Fe] != null; + if (!ze) { + var ht = Fe.startsWith(Ue.GROUP_AUTO_COLUMN_ID); + ht ? ie(S, te, z++) : S.push(te); + } + }), S = this.placeLockedColumns(S), !this.doesMovePassMarryChildren(S)) { + console.warn("AG Grid: Applying column order broke a group where columns should be married together. Applying new order has been discarded."); + return; + } + this.gridColumns = S; + } + }, f.prototype.compareColumnStatesAndRaiseEvents = function(d) { + var g = this, S = { + rowGroupColumns: this.rowGroupColumns.slice(), + pivotColumns: this.pivotColumns.slice(), + valueColumns: this.valueColumns.slice() + }, O = this.getColumnState(), z = {}; + return O.forEach(function(te) { + z[te.colId] = te; + }), function() { + if (!g.gridOptionsWrapper.isSuppressColumnStateEvents()) { + var te = g.getPrimaryAndSecondaryAndAutoColumns(), Fe = function(kr, Rr, Vr, An) { + var Js = Rr.map(An), Ya = Vr.map(An), Xa = _(Js, Ya); + if (!Xa) { + var po = { + type: kr, + columns: Vr, + column: Vr.length === 1 ? Vr[0] : null, + api: g.gridApi, + columnApi: g.columnApi, + source: d + }; + g.eventService.dispatchEvent(po); + } + }, ze = function(kr) { + var Rr = []; + return te.forEach(function(Vr) { + var An = z[Vr.getColId()]; + An && kr(An, Vr) && Rr.push(Vr); + }), Rr; + }, ht = function(kr) { + return kr.getColId(); + }; + Fe(ui.EVENT_COLUMN_ROW_GROUP_CHANGED, S.rowGroupColumns, g.rowGroupColumns, ht), Fe(ui.EVENT_COLUMN_PIVOT_CHANGED, S.pivotColumns, g.pivotColumns, ht); + var Lt = function(kr, Rr) { + var Vr = kr.aggFunc != null, An = Vr != Rr.isValueActive(), Js = Vr && kr.aggFunc != Rr.getAggFunc(); + return An || Js; + }, ti = ze(Lt); + ti.length > 0 && g.fireColumnEvent(ui.EVENT_COLUMN_VALUE_CHANGED, g.valueColumns, d); + var wi = function(kr, Rr) { + return kr.width != Rr.getActualWidth(); + }; + g.fireColumnResizedEvent(ze(wi), !0, d); + var Ti = function(kr, Rr) { + return kr.pinned != Rr.getPinned(); + }; + g.raiseColumnPinnedEvent(ze(Ti), d); + var qi = function(kr, Rr) { + return kr.hide == Rr.isVisible(); + }; + g.raiseColumnVisibleEvent(ze(qi), d); + var dr = function(kr, Rr) { + return kr.sort != Rr.getSort() || kr.sortIndex != Rr.getSortIndex(); + }; + ze(dr).length > 0 && g.sortController.dispatchSortChangedEvents(d), g.raiseColumnMovedEvent(O, d); + } + }; + }, f.prototype.raiseColumnPinnedEvent = function(d, g) { + if (d.length) { + var S = d.length === 1 ? d[0] : null, O = this.getCommonValue(d, function(te) { + return te.getPinned(); + }), z = { + type: ui.EVENT_COLUMN_PINNED, + // mistake in typing, 'undefined' should be allowed, as 'null' means 'not pinned' + pinned: O ?? null, + columns: d, + column: S, + api: this.gridApi, + columnApi: this.columnApi, + source: g + }; + this.eventService.dispatchEvent(z); + } + }, f.prototype.getCommonValue = function(d, g) { + if (!(!d || d.length == 0)) { + for (var S = g(d[0]), O = 1; O < d.length; O++) + if (S !== g(d[O])) + return; + return S; + } + }, f.prototype.raiseColumnVisibleEvent = function(d, g) { + if (d.length) { + var S = d.length === 1 ? d[0] : null, O = this.getCommonValue(d, function(te) { + return te.isVisible(); + }), z = { + type: ui.EVENT_COLUMN_VISIBLE, + visible: O, + columns: d, + column: S, + api: this.gridApi, + columnApi: this.columnApi, + source: g + }; + this.eventService.dispatchEvent(z); + } + }, f.prototype.raiseColumnMovedEvent = function(d, g) { + var S = this, O = this.getColumnState(), z = {}; + O.forEach(function(ti) { + return z[ti.colId] = ti; + }); + var te = {}; + d.forEach(function(ti) { + z[ti.colId] && (te[ti.colId] = !0); + }); + var Fe = d.filter(function(ti) { + return te[ti.colId]; + }), ze = O.filter(function(ti) { + return te[ti.colId]; + }), ht = []; + if (ze.forEach(function(ti, wi) { + var Ti = Fe && Fe[wi]; + if (Ti && Ti.colId !== ti.colId) { + var qi = S.getGridColumn(Ti.colId); + qi && ht.push(qi); + } + }), !!ht.length) { + var Lt = { + type: ui.EVENT_COLUMN_MOVED, + columns: ht, + column: null, + api: this.gridApi, + columnApi: this.columnApi, + source: g + }; + this.eventService.dispatchEvent(Lt); + } + }, f.prototype.syncColumnWithStateItem = function(d, g, S, O, z, te, Fe) { + if (d) { + var ze = function(El, Il) { + var kp = { value1: void 0, value2: void 0 }, $p = !1; + return g && (g[El] !== void 0 && (kp.value1 = g[El], $p = !0), i(Il) && g[Il] !== void 0 && (kp.value2 = g[Il], $p = !0)), !$p && S && (S[El] !== void 0 && (kp.value1 = S[El]), i(Il) && S[Il] !== void 0 && (kp.value2 = S[Il])), kp; + }, ht = ze("hide").value1; + ht !== void 0 && d.setVisible(!ht, Fe); + var Lt = ze("pinned").value1; + Lt !== void 0 && d.setPinned(Lt); + var ti = this.columnUtils.calculateColMinWidth(d.getColDef()), wi = ze("flex").value1; + wi !== void 0 && d.setFlex(wi); + var Ti = d.getFlex() <= 0; + if (Ti) { + var qi = ze("width").value1; + qi != null && ti != null && qi >= ti && d.setActualWidth(qi, Fe); + } + var dr = ze("sort").value1; + dr !== void 0 && (dr === Ue.SORT_DESC || dr === Ue.SORT_ASC ? d.setSort(dr, Fe) : d.setSort(void 0, Fe)); + var kr = ze("sortIndex").value1; + if (kr !== void 0 && d.setSortIndex(kr), !(te || !d.isPrimary())) { + var Rr = ze("aggFunc").value1; + Rr !== void 0 && (typeof Rr == "string" ? (d.setAggFunc(Rr), d.isValueActive() || (d.setValueActive(!0, Fe), this.valueColumns.push(d))) : (i(Rr) && console.warn("AG Grid: stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON."), d.isValueActive() && (d.setValueActive(!1, Fe), q(this.valueColumns, d)))); + var Vr = ze("rowGroup", "rowGroupIndex"), An = Vr.value1, Js = Vr.value2; + (An !== void 0 || Js !== void 0) && (typeof Js == "number" || An ? (d.isRowGroupActive() || (d.setRowGroupActive(!0, Fe), this.rowGroupColumns.push(d)), O && typeof Js == "number" && (O[d.getId()] = Js)) : d.isRowGroupActive() && (d.setRowGroupActive(!1, Fe), q(this.rowGroupColumns, d))); + var Ya = ze("pivot", "pivotIndex"), Xa = Ya.value1, po = Ya.value2; + (Xa !== void 0 || po !== void 0) && (typeof po == "number" || Xa ? (d.isPivotActive() || (d.setPivotActive(!0, Fe), this.pivotColumns.push(d)), z && typeof po == "number" && (z[d.getId()] = po)) : d.isPivotActive() && (d.setPivotActive(!1, Fe), q(this.pivotColumns, d))); + } + } + }, f.prototype.getGridColumns = function(d) { + return this.getColumns(d, this.getGridColumn.bind(this)); + }, f.prototype.getColumns = function(d, g) { + var S = []; + return d && d.forEach(function(O) { + var z = g(O); + z && S.push(z); + }), S; + }, f.prototype.getColumnWithValidation = function(d) { + if (d == null) + return null; + var g = this.getGridColumn(d); + return g || console.warn("AG Grid: could not find column " + d), g; + }, f.prototype.getPrimaryColumn = function(d) { + return this.primaryColumns ? this.getColumn(d, this.primaryColumns, this.primaryColumnsMap) : null; + }, f.prototype.getGridColumn = function(d) { + return this.getColumn(d, this.gridColumns, this.gridColumnsMap); + }, f.prototype.getSecondaryColumn = function(d) { + return this.secondaryColumns ? this.getColumn(d, this.secondaryColumns, this.secondaryColumnsMap) : null; + }, f.prototype.getColumn = function(d, g, S) { + if (!d) + return null; + if (typeof d == "string" && S[d]) + return S[d]; + for (var O = 0; O < g.length; O++) + if (this.columnsMatch(g[O], d)) + return g[O]; + return this.getAutoColumn(d); + }, f.prototype.getAutoColumn = function(d) { + var g = this; + return !this.groupAutoColumns || !i(this.groupAutoColumns) || r(this.groupAutoColumns) ? null : this.groupAutoColumns.find(function(S) { + return g.columnsMatch(S, d); + }) || null; + }, f.prototype.columnsMatch = function(d, g) { + var S = d === g, O = d.getColDef() === g, z = d.getColId() == g; + return S || O || z; + }, f.prototype.getDisplayNameForColumn = function(d, g, S) { + if (S === void 0 && (S = !1), !d) + return null; + var O = this.getHeaderName(d.getColDef(), d, null, null, g); + return S ? this.wrapHeaderNameWithAggFunc(d, O) : O; + }, f.prototype.getDisplayNameForProvidedColumnGroup = function(d, g, S) { + var O = g ? g.getColGroupDef() : null; + return O ? this.getHeaderName(O, null, d, g, S) : null; + }, f.prototype.getDisplayNameForColumnGroup = function(d, g) { + return this.getDisplayNameForProvidedColumnGroup(d, d.getProvidedColumnGroup(), g); + }, f.prototype.getHeaderName = function(d, g, S, O, z) { + var te = d.headerValueGetter; + if (te) { + var Fe = { + colDef: d, + column: g, + columnGroup: S, + providedColumnGroup: O, + location: z, + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + context: this.gridOptionsWrapper.getContext() + }; + return typeof te == "function" ? te(Fe) : typeof te == "string" ? this.expressionService.evaluate(te, Fe) : (console.warn("ag-grid: headerValueGetter must be a function or a string"), ""); + } else { + if (d.headerName != null) + return d.headerName; + if (d.field) + return Fr(d.field); + } + return ""; + }, f.prototype.wrapHeaderNameWithAggFunc = function(d, g) { + if (this.gridOptionsWrapper.isSuppressAggFuncInHeader()) + return g; + var S = d.getColDef().pivotValueColumn, O = i(S), z = null, te; + if (O) { + var Fe = this.gridOptionsWrapper.isRemovePivotHeaderRowWhenSingleValueColumn() && this.valueColumns.length === 1, ze = d.getColDef().pivotTotalColumnIds !== void 0; + if (Fe && !ze) + return g; + z = S ? S.getAggFunc() : null, te = !0; + } else { + var ht = d.isValueActive(), Lt = this.pivotMode || !this.isRowGroupEmpty(); + ht && Lt ? (z = d.getAggFunc(), te = !0) : te = !1; + } + if (te) { + var ti = typeof z == "string" ? z : "func", wi = this.gridOptionsWrapper.getLocaleTextFunc(), Ti = wi(ti, ti); + return Ti + "(" + g + ")"; + } + return g; + }, f.prototype.getColumnGroup = function(d, g) { + if (!d) + return null; + if (d instanceof Zt) + return d; + var S = this.getAllDisplayedTrees(), O = typeof g == "number", z = null; + return this.columnUtils.depthFirstAllColumnTreeSearch(S, function(te) { + if (te instanceof Zt) { + var Fe = te, ze = void 0; + O ? ze = d === Fe.getGroupId() && g === Fe.getInstanceId() : ze = d === Fe.getGroupId(), ze && (z = Fe); + } + }), z; + }, f.prototype.isReady = function() { + return this.ready; + }, f.prototype.extractValueColumns = function(d, g) { + this.valueColumns = this.extractColumns( + g, + this.valueColumns, + function(S, O) { + return S.setValueActive(O, d); + }, + // aggFunc doesn't have index variant, cos order of value cols doesn't matter, so always return null + function() { + }, + function() { + }, + // aggFunc is a string, so return it's existence + function(S) { + var O = S.aggFunc; + if (O === null || O === "") + return null; + if (O !== void 0) + return !!O; + }, + function(S) { + return S.initialAggFunc != null && S.initialAggFunc != ""; + } + ), this.valueColumns.forEach(function(S) { + var O = S.getColDef(); + O.aggFunc != null && O.aggFunc != "" ? S.setAggFunc(O.aggFunc) : S.getAggFunc() || S.setAggFunc(O.initialAggFunc); + }); + }, f.prototype.extractRowGroupColumns = function(d, g) { + this.rowGroupColumns = this.extractColumns(g, this.rowGroupColumns, function(S, O) { + return S.setRowGroupActive(O, d); + }, function(S) { + return S.rowGroupIndex; + }, function(S) { + return S.initialRowGroupIndex; + }, function(S) { + return S.rowGroup; + }, function(S) { + return S.initialRowGroup; + }); + }, f.prototype.extractColumns = function(d, g, S, O, z, te, Fe) { + d === void 0 && (d = []), g === void 0 && (g = []); + var ze = [], ht = []; + (this.primaryColumns || []).forEach(function(wi) { + var Ti = d.indexOf(wi) < 0, qi = wi.getColDef(), dr = a(te(qi)), kr = a(Fe(qi)), Rr = o(O(qi)), Vr = o(z(qi)), An, Js = dr !== void 0, Ya = Rr !== void 0, Xa = kr !== void 0, po = Vr !== void 0; + if (Js ? An = dr : Ya ? Rr === null ? An = !1 : An = Rr >= 0 : Ti ? Xa ? An = kr : po ? An = Vr != null && Vr >= 0 : An = !1 : An = g.indexOf(wi) >= 0, An) { + var El = Ti ? Rr != null || Vr != null : Rr != null; + El ? ze.push(wi) : ht.push(wi); + } + }); + var Lt = function(wi) { + var Ti = O(wi.getColDef()), qi = z(wi.getColDef()); + return Ti ?? qi; + }; + ze.sort(function(wi, Ti) { + var qi = Lt(wi), dr = Lt(Ti); + return qi === dr ? 0 : qi < dr ? -1 : 1; + }); + var ti = [].concat(ze); + return g.forEach(function(wi) { + ht.indexOf(wi) >= 0 && ti.push(wi); + }), ht.forEach(function(wi) { + ti.indexOf(wi) < 0 && ti.push(wi); + }), g.forEach(function(wi) { + ti.indexOf(wi) < 0 && S(wi, !1); + }), ti.forEach(function(wi) { + g.indexOf(wi) < 0 && S(wi, !0); + }), ti; + }, f.prototype.extractPivotColumns = function(d, g) { + this.pivotColumns = this.extractColumns(g, this.pivotColumns, function(S, O) { + return S.setPivotActive(O, d); + }, function(S) { + return S.pivotIndex; + }, function(S) { + return S.initialPivotIndex; + }, function(S) { + return S.pivot; + }, function(S) { + return S.initialPivot; + }); + }, f.prototype.resetColumnGroupState = function(d) { + d === void 0 && (d = "api"); + var g = []; + this.columnUtils.depthFirstOriginalTreeSearch(null, this.primaryColumnTree, function(S) { + if (S instanceof Jt) { + var O = S.getColGroupDef(), z = { + groupId: S.getGroupId(), + open: O ? O.openByDefault : void 0 + }; + g.push(z); + } + }), this.setColumnGroupState(g, d); + }, f.prototype.getColumnGroupState = function() { + var d = []; + return this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function(g) { + g instanceof Jt && d.push({ + groupId: g.getGroupId(), + open: g.isExpanded() + }); + }), d; + }, f.prototype.setColumnGroupState = function(d, g) { + var S = this; + g === void 0 && (g = "api"), this.columnAnimationService.start(); + var O = []; + d.forEach(function(z) { + var te = z.groupId, Fe = z.open, ze = S.getProvidedColumnGroup(te); + ze && ze.isExpanded() !== Fe && (S.logger.log("columnGroupOpened(" + ze.getGroupId() + "," + Fe + ")"), ze.setExpanded(Fe), O.push(ze)); + }), this.updateGroupsAndDisplayedColumns(g), this.setFirstRightAndLastLeftPinned(g), O.forEach(function(z) { + var te = { + type: ui.EVENT_COLUMN_GROUP_OPENED, + columnGroup: z, + api: S.gridApi, + columnApi: S.columnApi + }; + S.eventService.dispatchEvent(te); + }), this.columnAnimationService.finish(); + }, f.prototype.setColumnGroupOpened = function(d, g, S) { + S === void 0 && (S = "api"); + var O; + d instanceof Jt ? O = d.getId() : O = d || "", this.setColumnGroupState([{ groupId: O, open: g }], S); + }, f.prototype.getProvidedColumnGroup = function(d) { + typeof d != "string" && console.error("AG Grid: group key must be a string"); + var g = null; + return this.columnUtils.depthFirstOriginalTreeSearch(null, this.gridBalancedTree, function(S) { + S instanceof Jt && S.getId() === d && (g = S); + }), g; + }, f.prototype.calculateColumnsForDisplay = function() { + var d = this, g; + return this.pivotMode && r(this.secondaryColumns) ? g = this.gridColumns.filter(function(S) { + var O = d.groupAutoColumns && Ce(d.groupAutoColumns, S), z = d.valueColumns && Ce(d.valueColumns, S); + return O || z; + }) : g = this.gridColumns.filter(function(S) { + var O = d.groupAutoColumns && Ce(d.groupAutoColumns, S); + return O || S.isVisible(); + }), g; + }, f.prototype.checkColSpanActiveInCols = function(d) { + var g = !1; + return d.forEach(function(S) { + i(S.getColDef().colSpan) && (g = !0); + }), g; + }, f.prototype.calculateColumnsForGroupDisplay = function() { + var d = this; + this.groupDisplayColumns = []; + var g = function(S) { + var O = S.getColDef(); + O && i(O.showRowGroup) && d.groupDisplayColumns.push(S); + }; + this.gridColumns.forEach(g), this.groupAutoColumns && this.groupAutoColumns.forEach(g); + }, f.prototype.getGroupDisplayColumns = function() { + return this.groupDisplayColumns; + }, f.prototype.updateDisplayedColumns = function(d) { + var g = this.calculateColumnsForDisplay(); + this.buildDisplayedTrees(g), this.calculateColumnsForGroupDisplay(), this.updateGroupsAndDisplayedColumns(d), this.setFirstRightAndLastLeftPinned(d); + }, f.prototype.isSecondaryColumnsPresent = function() { + return i(this.secondaryColumns); + }, f.prototype.setSecondaryColumns = function(d, g) { + var S = this; + g === void 0 && (g = "api"); + var O = d && d.length > 0; + if (!(!O && r(this.secondaryColumns))) { + if (O) { + this.processSecondaryColumnDefinitions(d); + var z = this.columnFactory.createColumnTree(d, !1, this.secondaryBalancedTree || this.previousSecondaryColumns || void 0); + this.secondaryBalancedTree = z.columnTree, this.secondaryHeaderRowCount = z.treeDept + 1, this.secondaryColumns = this.getColumnsFromTree(this.secondaryBalancedTree), this.secondaryColumnsMap = {}, this.secondaryColumns.forEach(function(te) { + return S.secondaryColumnsMap[te.getId()] = te; + }), this.previousSecondaryColumns = null; + } else + this.previousSecondaryColumns = this.secondaryBalancedTree, this.secondaryBalancedTree = null, this.secondaryHeaderRowCount = -1, this.secondaryColumns = null, this.secondaryColumnsMap = {}; + this.updateGridColumns(), this.updateDisplayedColumns(g); + } + }, f.prototype.processSecondaryColumnDefinitions = function(d) { + var g = this.gridOptionsWrapper.getProcessSecondaryColDefFunc(), S = this.gridOptionsWrapper.getProcessSecondaryColGroupDefFunc(); + if (!(!g && !S)) { + var O = function(z) { + z.forEach(function(te) { + var Fe = i(te.children); + if (Fe) { + var ze = te; + S && S(ze), O(ze.children); + } else { + var ht = te; + g && g(ht); + } + }); + }; + d && O(d); + } + }, f.prototype.updateGridColumns = function() { + var d = this; + if (this.gridColsArePrimary ? this.lastPrimaryOrder = this.gridColumns : this.lastSecondaryOrder = this.gridColumns, this.secondaryColumns && this.secondaryBalancedTree) { + var g = this.secondaryColumns.every(function(O) { + return d.gridColumnsMap[O.getColId()] !== void 0; + }); + this.gridBalancedTree = this.secondaryBalancedTree.slice(), this.gridHeaderRowCount = this.secondaryHeaderRowCount, this.gridColumns = this.secondaryColumns.slice(), this.gridColsArePrimary = !1, g && this.orderGridColsLike(this.lastSecondaryOrder); + } else + this.primaryColumns && (this.gridBalancedTree = this.primaryColumnTree.slice(), this.gridHeaderRowCount = this.primaryHeaderRowCount, this.gridColumns = this.primaryColumns.slice(), this.gridColsArePrimary = !0, this.orderGridColsLike(this.lastPrimaryOrder)); + this.addAutoGroupToGridColumns(), this.gridColumns = this.placeLockedColumns(this.gridColumns), this.setupQuickFilterColumns(), this.clearDisplayedAndViewportColumns(), this.colSpanActive = this.checkColSpanActiveInCols(this.gridColumns), this.gridColumnsMap = {}, this.gridColumns.forEach(function(O) { + return d.gridColumnsMap[O.getId()] = O; + }), this.setAutoHeightActive(); + var S = { + type: ui.EVENT_GRID_COLUMNS_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(S); + }, f.prototype.setAutoHeightActive = function() { + if (this.autoHeightActive = this.gridColumns.filter(function(O) { + return O.isAutoHeight(); + }).length > 0, this.autoHeightActive) { + this.autoHeightActiveAtLeastOnce = !0; + var d = this.rowModel.getType(), g = d === Ue.ROW_MODEL_TYPE_CLIENT_SIDE || d === Ue.ROW_MODEL_TYPE_SERVER_SIDE; + if (!g) { + var S = "AG Grid - autoHeight columns only work with Client Side Row Model and Server Side Row Model."; + Ge(function() { + return console.warn(S); + }, "autoHeightActive.wrongRowModel"); + } + } + }, f.prototype.orderGridColsLike = function(d) { + if (!r(d)) { + var g = kn(d.map(function(ht, Lt) { + return [ht, Lt]; + })), S = !0; + if (this.gridColumns.forEach(function(ht) { + g.has(ht) && (S = !1); + }), !S) { + var O = kn(this.gridColumns.map(function(ht) { + return [ht, !0]; + })), z = d.filter(function(ht) { + return O.has(ht); + }), te = kn(z.map(function(ht) { + return [ht, !0]; + })), Fe = this.gridColumns.filter(function(ht) { + return !te.has(ht); + }), ze = z.slice(); + Fe.forEach(function(ht) { + var Lt = ht.getOriginalParent(); + if (!Lt) { + ze.push(ht); + return; + } + for (var ti = []; !ti.length && Lt; ) { + var wi = Lt.getLeafColumns(); + wi.forEach(function(dr) { + var kr = ze.indexOf(dr) >= 0, Rr = ti.indexOf(dr) < 0; + kr && Rr && ti.push(dr); + }), Lt = Lt.getOriginalParent(); + } + if (!ti.length) { + ze.push(ht); + return; + } + var Ti = ti.map(function(dr) { + return ze.indexOf(dr); + }), qi = Math.max.apply(Math, qu(Ti)); + ie(ze, ht, qi + 1); + }), this.gridColumns = ze; + } + } + }, f.prototype.isPrimaryColumnGroupsPresent = function() { + return this.primaryHeaderRowCount > 1; + }, f.prototype.setupQuickFilterColumns = function() { + this.groupAutoColumns ? this.columnsForQuickFilter = (this.primaryColumns || []).concat(this.groupAutoColumns) : this.primaryColumns && (this.columnsForQuickFilter = this.primaryColumns); + }, f.prototype.placeLockedColumns = function(d) { + var g = [], S = [], O = []; + return d.forEach(function(z) { + var te = z.getColDef().lockPosition; + te === "right" ? O.push(z) : te === "left" || te === !0 ? g.push(z) : S.push(z); + }), qu(g, S, O); + }, f.prototype.addAutoGroupToGridColumns = function() { + if (this.createGroupAutoColumnsIfNeeded(), !r(this.groupAutoColumns)) { + this.gridColumns = this.groupAutoColumns ? this.groupAutoColumns.concat(this.gridColumns) : this.gridColumns; + var d = this.columnFactory.createForAutoGroups(this.groupAutoColumns, this.gridBalancedTree); + this.gridBalancedTree = d.concat(this.gridBalancedTree); + } + }, f.prototype.clearDisplayedAndViewportColumns = function() { + this.displayedTreeLeft = [], this.displayedTreeRight = [], this.displayedTreeCentre = [], this.viewportRowLeft = {}, this.viewportRowRight = {}, this.viewportRowCenter = {}, this.displayedColumnsLeft = [], this.displayedColumnsRight = [], this.displayedColumnsCenter = [], this.displayedColumns = [], this.viewportColumns = []; + }, f.prototype.updateGroupsAndDisplayedColumns = function(d) { + this.updateOpenClosedVisibilityInColumnGroups(), this.deriveDisplayedColumns(d), this.refreshFlexedColumns(), this.extractViewport(), this.updateBodyWidths(); + var g = { + type: ui.EVENT_DISPLAYED_COLUMNS_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(g); + }, f.prototype.deriveDisplayedColumns = function(d) { + this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeLeft, this.displayedColumnsLeft), this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeCentre, this.displayedColumnsCenter), this.derivedDisplayedColumnsFromDisplayedTree(this.displayedTreeRight, this.displayedColumnsRight), this.joinDisplayedColumns(), this.setLeftValues(d), this.displayedAutoHeightCols = this.displayedColumns.filter(function(g) { + return g.isAutoHeight(); + }); + }, f.prototype.isAutoRowHeightActive = function() { + return this.autoHeightActive; + }, f.prototype.wasAutoRowHeightEverActive = function() { + return this.autoHeightActiveAtLeastOnce; + }, f.prototype.joinDisplayedColumns = function() { + this.gridOptionsWrapper.isEnableRtl() ? this.displayedColumns = this.displayedColumnsRight.concat(this.displayedColumnsCenter).concat(this.displayedColumnsLeft) : this.displayedColumns = this.displayedColumnsLeft.concat(this.displayedColumnsCenter).concat(this.displayedColumnsRight); + }, f.prototype.setLeftValues = function(d) { + this.setLeftValuesOfColumns(d), this.setLeftValuesOfGroups(); + }, f.prototype.setLeftValuesOfColumns = function(d) { + var g = this; + if (this.primaryColumns) { + var S = this.primaryColumns.slice(0), O = this.gridOptionsWrapper.isEnableRtl(); + [ + this.displayedColumnsLeft, + this.displayedColumnsRight, + this.displayedColumnsCenter + ].forEach(function(z) { + if (O) { + var te = g.getWidthOfColsInList(z); + z.forEach(function(ze) { + te -= ze.getActualWidth(), ze.setLeft(te, d); + }); + } else { + var Fe = 0; + z.forEach(function(ze) { + ze.setLeft(Fe, d), Fe += ze.getActualWidth(); + }); + } + Z(S, z); + }), S.forEach(function(z) { + z.setLeft(null, d); + }); + } + }, f.prototype.setLeftValuesOfGroups = function() { + [ + this.displayedTreeLeft, + this.displayedTreeRight, + this.displayedTreeCentre + ].forEach(function(d) { + d.forEach(function(g) { + if (g instanceof Zt) { + var S = g; + S.checkLeft(); + } + }); + }); + }, f.prototype.derivedDisplayedColumnsFromDisplayedTree = function(d, g) { + g.length = 0, this.columnUtils.depthFirstDisplayedColumnTreeSearch(d, function(S) { + S instanceof H && g.push(S); + }); + }, f.prototype.extractViewportColumns = function() { + this.suppressColumnVirtualisation ? this.viewportColumnsCenter = this.displayedColumnsCenter : this.viewportColumnsCenter = this.filterOutColumnsWithinViewport(), this.viewportColumns = this.viewportColumnsCenter.concat(this.displayedColumnsLeft).concat(this.displayedColumnsRight); + }, f.prototype.getVirtualHeaderGroupRow = function(d, g) { + var S; + switch (d) { + case Ue.PINNED_LEFT: + S = this.viewportRowLeft[g]; + break; + case Ue.PINNED_RIGHT: + S = this.viewportRowRight[g]; + break; + default: + S = this.viewportRowCenter[g]; + break; + } + return r(S) && (S = []), S; + }, f.prototype.extractViewportRows = function() { + this.viewportRowLeft = {}, this.viewportRowRight = {}, this.viewportRowCenter = {}; + var d = {}; + this.viewportColumns.forEach(function(S) { + return d[S.getId()] = !0; + }); + var g = function(S, O, z) { + for (var te = !1, Fe = 0; Fe < S.length; Fe++) { + var ze = S[Fe], ht = !1; + if (ze instanceof H) + ht = d[ze.getId()] === !0; + else { + var Lt = ze, ti = Lt.getDisplayedChildren(); + ti && (ht = g(ti, O, z + 1)); + } + ht && (te = !0, O[z] || (O[z] = []), O[z].push(ze)); + } + return te; + }; + g(this.displayedTreeLeft, this.viewportRowLeft, 0), g(this.displayedTreeRight, this.viewportRowRight, 0), g(this.displayedTreeCentre, this.viewportRowCenter, 0); + }, f.prototype.extractViewport = function() { + this.extractViewportColumns(), this.extractViewportRows(); + }, f.prototype.filterOutColumnsWithinViewport = function() { + return this.displayedColumnsCenter.filter(this.isColumnInViewport.bind(this)); + }, f.prototype.refreshFlexedColumns = function(d) { + var g = this; + d === void 0 && (d = {}); + var S = d.source ? d.source : "flex"; + if (d.viewportWidth != null && (this.flexViewportWidth = d.viewportWidth), !this.flexViewportWidth) + return []; + var O = -1; + d.resizingCols && d.resizingCols.forEach(function(An) { + var Js = g.displayedColumnsCenter.indexOf(An); + O < Js && (O = Js); + }); + var z = function(An) { + var Js = g.displayedColumnsCenter.indexOf(An) > O; + return An.getFlex() && Js; + }, te = this.displayedColumnsCenter.filter(function(An) { + return !z(An); + }), Fe = this.displayedColumnsCenter.filter(function(An) { + return z(An); + }), ze = []; + if (!Fe.length) + return []; + var ht = [], Lt; + e: + for (; ; ) { + var ti = Fe.reduce(function(An, Js) { + return An + Js.getFlex(); + }, 0); + Lt = this.flexViewportWidth - this.getWidthOfColsInList(te); + for (var wi = 0; wi < Fe.length; wi++) { + var Ti = Fe[wi], qi = Lt * Ti.getFlex() / ti, dr = 0, kr = Ti.getMinWidth(), Rr = Ti.getMaxWidth(); + if (i(kr) && qi < kr ? dr = kr : i(Rr) && qi > Rr && (dr = Rr), dr) { + Ti.setActualWidth(dr, S), q(Fe, Ti), ze.push(Ti), te.push(Ti); + continue e; + } + ht[wi] = Math.round(qi); + } + break; + } + var Vr = Lt; + return Fe.forEach(function(An, Js) { + An.setActualWidth(Math.min(ht[Js], Vr), S), ze.push(An), Vr -= ht[Js]; + }), d.skipSetLeft || this.setLeftValues(S), d.updateBodyWidths && this.updateBodyWidths(), d.fireResizedEvent && this.fireColumnResizedEvent(ze, !0, S, Fe), this.flexColsCalculatedAtLestOnce || (this.gridOptionsWrapper.isRowModelDefault() && this.rowModel.resetRowHeights(), this.flexColsCalculatedAtLestOnce = !0), Fe; + }, f.prototype.sizeColumnsToFit = function(d, g, S) { + g === void 0 && (g = "sizeColumnsToFit"); + var O = this.getAllDisplayedColumns(); + if (!(d <= 0 || !O.length)) { + var z = [], te = []; + O.forEach(function(Vr) { + Vr.getColDef().suppressSizeToFit === !0 ? te.push(Vr) : z.push(Vr); + }); + var Fe = z.slice(0), ze = !1, ht = function(Vr) { + q(z, Vr), te.push(Vr); + }; + for (z.forEach(function(Vr) { + return Vr.resetActualWidth(g); + }); !ze; ) { + ze = !0; + var Lt = d - this.getWidthOfColsInList(te); + if (Lt <= 0) + z.forEach(function(Vr) { + Vr.setMinimum(g); + }); + else + for (var ti = Lt / this.getWidthOfColsInList(z), wi = Lt, Ti = z.length - 1; Ti >= 0; Ti--) { + var qi = z[Ti], dr = qi.getMinWidth(), kr = qi.getMaxWidth(), Rr = Math.round(qi.getActualWidth() * ti); + i(dr) && Rr < dr ? (Rr = dr, ht(qi), ze = !1) : i(kr) && qi.isGreaterThanMax(Rr) ? (Rr = kr, ht(qi), ze = !1) : Ti === 0 && (Rr = wi), qi.setActualWidth(Rr, g, !0), wi -= Rr; + } + } + Fe.forEach(function(Vr) { + Vr.fireColumnWidthChangedEvent(g); + }), this.setLeftValues(g), this.updateBodyWidths(), !S && this.fireColumnResizedEvent(Fe, !0, g); + } + }, f.prototype.buildDisplayedTrees = function(d) { + var g = [], S = [], O = []; + d.forEach(function(te) { + switch (te.getPinned()) { + case "left": + g.push(te); + break; + case "right": + S.push(te); + break; + default: + O.push(te); + break; + } + }); + var z = new W(); + this.displayedTreeLeft = this.displayedGroupCreator.createDisplayedGroups(g, this.gridBalancedTree, z, Ue.PINNED_LEFT, this.displayedTreeLeft), this.displayedTreeRight = this.displayedGroupCreator.createDisplayedGroups(S, this.gridBalancedTree, z, Ue.PINNED_RIGHT, this.displayedTreeRight), this.displayedTreeCentre = this.displayedGroupCreator.createDisplayedGroups(O, this.gridBalancedTree, z, null, this.displayedTreeCentre), this.updateDisplayedMap(); + }, f.prototype.updateDisplayedMap = function() { + var d = this; + this.displayedColumnsAndGroupsMap = {}; + var g = function(S) { + d.displayedColumnsAndGroupsMap[S.getUniqueId()] = S; + }; + this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeCentre, g), this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeLeft, g), this.columnUtils.depthFirstAllColumnTreeSearch(this.displayedTreeRight, g); + }, f.prototype.isDisplayed = function(d) { + var g = this.displayedColumnsAndGroupsMap[d.getUniqueId()]; + return g === d; + }, f.prototype.updateOpenClosedVisibilityInColumnGroups = function() { + var d = this.getAllDisplayedTrees(); + this.columnUtils.depthFirstAllColumnTreeSearch(d, function(g) { + if (g instanceof Zt) { + var S = g; + S.calculateDisplayedColumns(); + } + }); + }, f.prototype.getGroupAutoColumns = function() { + return this.groupAutoColumns; + }, f.prototype.createGroupAutoColumnsIfNeeded = function() { + if (this.autoGroupsNeedBuilding) { + this.autoGroupsNeedBuilding = !1; + var d = this.gridOptionsWrapper.isGroupUseEntireRow(this.pivotMode), g = this.pivotMode ? this.gridOptionsWrapper.isPivotSuppressAutoColumn() : this.gridOptionsWrapper.isGroupSuppressAutoColumn(), S = this.rowGroupColumns.length > 0 || this.usingTreeData, O = S && !g && !d; + if (O) { + var z = this.groupAutoColumns || [], te = this.autoGroupColService.createAutoGroupColumns(z, this.rowGroupColumns), Fe = !this.autoColsEqual(te, this.groupAutoColumns); + (Fe || this.forceRecreateAutoGroups) && (this.groupAutoColumns = te); + } else + this.groupAutoColumns = null; + } + }, f.prototype.autoColsEqual = function(d, g) { + return _(d, g, function(S, O) { + return S.getColId() === O.getColId(); + }); + }, f.prototype.getWidthOfColsInList = function(d) { + return d.reduce(function(g, S) { + return g + S.getActualWidth(); + }, 0); + }, f.prototype.getGridBalancedTree = function() { + return this.gridBalancedTree; + }, f.prototype.hasFloatingFilters = function() { + if (!this.gridColumns) + return !1; + var d = this.gridColumns.some(function(g) { + return g.getColDef().floatingFilter; + }); + return d; + }, f.prototype.getFirstDisplayedColumn = function() { + var d = this.gridOptionsWrapper.isEnableRtl(), g = [ + "getDisplayedLeftColumns", + "getDisplayedCenterColumns", + "getDisplayedRightColumns" + ]; + d && g.reverse(); + for (var S = 0; S < g.length; S++) { + var O = this[g[S]](); + if (O.length) + return d ? m(O) : O[0]; + } + return null; + }, Io([ + pe("expressionService") + ], f.prototype, "expressionService", void 0), Io([ + pe("columnFactory") + ], f.prototype, "columnFactory", void 0), Io([ + pe("displayedGroupCreator") + ], f.prototype, "displayedGroupCreator", void 0), Io([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Io([ + pe("autoWidthCalculator") + ], f.prototype, "autoWidthCalculator", void 0), Io([ + pe("columnUtils") + ], f.prototype, "columnUtils", void 0), Io([ + pe("columnAnimationService") + ], f.prototype, "columnAnimationService", void 0), Io([ + pe("autoGroupColService") + ], f.prototype, "autoGroupColService", void 0), Io([ + Ae("aggFuncService") + ], f.prototype, "aggFuncService", void 0), Io([ + Ae("valueCache") + ], f.prototype, "valueCache", void 0), Io([ + Ae("animationFrameService") + ], f.prototype, "animationFrameService", void 0), Io([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), Io([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), Io([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), Io([ + pe("sortController") + ], f.prototype, "sortController", void 0), Io([ + pe("columnDefFactory") + ], f.prototype, "columnDefFactory", void 0), Io([ + ct + ], f.prototype, "init", null), Io([ + oh(0, yt("loggerFactory")) + ], f.prototype, "setBeans", null), f = Io([ + Ne("columnModel") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var dd = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Vd = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, pd = ( + /** @class */ + function(M) { + dd(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.calculateColMinWidth = function(d) { + return d.minWidth != null ? d.minWidth : this.gridOptionsWrapper.getMinColWidth(); + }, f.prototype.calculateColMaxWidth = function(d) { + return d.maxWidth != null ? d.maxWidth : this.gridOptionsWrapper.getMaxColWidth() || Number.MAX_SAFE_INTEGER; + }, f.prototype.calculateColInitialWidth = function(d) { + var g = this.calculateColMinWidth(d), S = this.calculateColMaxWidth(d), O, z = o(d.width), te = o(d.initialWidth); + return z != null ? O = z : te != null ? O = te : O = this.gridOptionsWrapper.getColWidth(), Math.max(Math.min(O, S), g); + }, f.prototype.getOriginalPathForColumn = function(d, g) { + var S = [], O = !1, z = function(te, Fe) { + for (var ze = 0; ze < te.length; ze++) { + if (O) + return; + var ht = te[ze]; + if (ht instanceof Jt) { + var Lt = ht; + z(Lt.getChildren(), Fe + 1), S[Fe] = ht; + } else + ht === d && (O = !0); + } + }; + return z(g, 0), O ? S : null; + }, f.prototype.depthFirstOriginalTreeSearch = function(d, g, S) { + var O = this; + g && g.forEach(function(z) { + z instanceof Jt && O.depthFirstOriginalTreeSearch(z, z.getChildren(), S), S(z, d); + }); + }, f.prototype.depthFirstAllColumnTreeSearch = function(d, g) { + var S = this; + d && d.forEach(function(O) { + O instanceof Zt && S.depthFirstAllColumnTreeSearch(O.getChildren(), g), g(O); + }); + }, f.prototype.depthFirstDisplayedColumnTreeSearch = function(d, g) { + var S = this; + d && d.forEach(function(O) { + O instanceof Zt && S.depthFirstDisplayedColumnTreeSearch(O.getDisplayedChildren(), g), g(O); + }); + }, f = Vd([ + Ne("columnUtils") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var cs = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Nl = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ii = ( + /** @class */ + function(M) { + cs(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.createDisplayedGroups = function(d, g, S, O, z) { + var te = this, Fe = [], ze, ht, Lt = this.mapOldGroupsById(z); + return d.forEach(function(ti) { + for (var wi = te.getOriginalPathForColumn(g, ti), Ti = [], qi = !ht, dr = 0; dr < wi.length; dr++) + if (qi || wi[dr] !== ht[dr]) { + var kr = te.createColumnGroup(wi[dr], S, Lt, O); + Ti[dr] = kr, dr == 0 ? Fe.push(kr) : Ti[dr - 1].addChild(kr); + } else + Ti[dr] = ze[dr]; + var Rr = Ti.length === 0; + if (Rr) + Fe.push(ti); + else { + var Vr = m(Ti); + Vr.addChild(ti); + } + ze = Ti, ht = wi; + }), this.setupParentsIntoColumns(Fe, null), Fe; + }, f.prototype.createColumnGroup = function(d, g, S, O) { + var z = d.getGroupId(), te = g.getInstanceIdForKey(z), Fe = Zt.createUniqueId(z, te), ze = S[Fe]; + return ze && ze.getProvidedColumnGroup() !== d && (ze = null), i(ze) ? ze.reset() : (ze = new Zt(d, z, te, O), this.context.createBean(ze)), ze; + }, f.prototype.mapOldGroupsById = function(d) { + var g = {}, S = function(O) { + O.forEach(function(z) { + if (z instanceof Zt) { + var te = z; + g[z.getUniqueId()] = te, S(te.getChildren()); + } + }); + }; + return d && S(d), g; + }, f.prototype.setupParentsIntoColumns = function(d, g) { + var S = this; + d.forEach(function(O) { + if (O.setParent(g), O instanceof Zt) { + var z = O; + S.setupParentsIntoColumns(z.getChildren(), z); + } + }); + }, f.prototype.getOriginalPathForColumn = function(d, g) { + var S = [], O = !1, z = function(te, Fe) { + for (var ze = 0; ze < te.length; ze++) { + if (O) + return; + var ht = te[ze]; + ht instanceof Jt ? (z(ht.getChildren(), Fe + 1), S[Fe] = ht) : ht === g && (O = !0); + } + }; + return z(d, 0), O ? S : (console.warn("AG Grid: could not get path"), null); + }, f = Nl([ + Ne("displayedGroupCreator") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var bt = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, Kt = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(bt(arguments[f])); + return M; + }, Pi = ( + /** @class */ + function() { + function M() { + } + return M.STRING_PROPERTIES = [ + "sortingOrder", + "rowClass", + "rowSelection", + "overlayLoadingTemplate", + "overlayNoRowsTemplate", + "quickFilterText", + "rowModelType", + "editType", + "domLayout", + "clipboardDelimiter", + "rowGroupPanelShow", + "multiSortKey", + "pivotColumnGroupTotals", + "pivotRowTotals", + "pivotPanelShow", + "fillHandleDirection", + "serverSideStoreType", + "groupDisplayType", + "treeDataDisplayType" + ], M.OBJECT_PROPERTIES = [ + "components", + "frameworkComponents", + "rowStyle", + "context", + "autoGroupColumnDef", + "localeText", + "icons", + "datasource", + "serverSideDatasource", + "viewportDatasource", + "groupRowRendererParams", + "aggFuncs", + "fullWidthCellRendererParams", + "defaultColGroupDef", + "defaultColDef", + "defaultExportParams", + "defaultCsvExportParams", + "defaultExcelExportParams", + "columnTypes", + "rowClassRules", + "detailCellRendererParams", + "loadingCellRendererParams", + "loadingOverlayComponentParams", + "noRowsOverlayComponentParams", + "popupParent", + "colResizeDefault", + "statusBar", + "sideBar", + "chartThemeOverrides", + "customChartThemes" + ], M.ARRAY_PROPERTIES = [ + "alignedGrids", + "rowData", + "columnDefs", + "excelStyles", + "pinnedTopRowData", + "pinnedBottomRowData", + "chartThemes" + ], M.NUMBER_PROPERTIES = [ + "rowHeight", + "detailRowHeight", + "rowBuffer", + "colWidth", + "headerHeight", + "groupHeaderHeight", + "floatingFiltersHeight", + "pivotHeaderHeight", + "pivotGroupHeaderHeight", + "groupDefaultExpanded", + "minColWidth", + "maxColWidth", + "viewportRowModelPageSize", + "viewportRowModelBufferSize", + "autoSizePadding", + "maxBlocksInCache", + "maxConcurrentDatasourceRequests", + "tooltipShowDelay", + "tooltipHideDelay", + "cacheOverflowSize", + "paginationPageSize", + "cacheBlockSize", + "infiniteInitialRowCount", + "scrollbarWidth", + "batchUpdateWaitMillis", + "asyncTransactionWaitMillis", + "blockLoadDebounceMillis", + "keepDetailRowsCount", + "undoRedoCellEditingLimit", + "cellFlashDelay", + "cellFadeDelay", + "tabIndex" + ], M.BOOLEAN_PROPERTIES = [ + "suppressMakeColumnVisibleAfterUnGroup", + "suppressRowClickSelection", + "suppressCellSelection", + "suppressCellFocus", + "suppressHorizontalScroll", + "alwaysShowHorizontalScroll", + "alwaysShowVerticalScroll", + "debug", + "enableBrowserTooltips", + "enableCellExpressions", + "angularCompileRows", + "angularCompileFilters", + "groupSuppressAutoColumn", + "groupSelectsChildren", + "groupIncludeFooter", + "groupIncludeTotalFooter", + "groupUseEntireRow", + "groupSuppressBlankHeader", + "suppressMenuHide", + "suppressRowDeselection", + "unSortIcon", + "suppressMultiSort", + "alwaysMultiSort", + "singleClickEdit", + "suppressLoadingOverlay", + "suppressNoRowsOverlay", + "suppressAutoSize", + "skipHeaderOnAutoSize", + "suppressParentsInRowNodes", + "suppressColumnMoveAnimation", + "suppressMovableColumns", + "suppressFieldDotNotation", + "enableRangeSelection", + "enableRangeHandle", + "enableFillHandle", + "suppressClearOnFillReduction", + "deltaSort", + "suppressTouch", + "suppressAsyncEvents", + "allowContextMenuWithControlKey", + "suppressContextMenu", + "rememberGroupStateWhenNewData", + "enableCellChangeFlash", + "suppressDragLeaveHidesColumns", + "suppressMiddleClickScrolls", + "suppressPreventDefaultOnMouseWheel", + "suppressCopyRowsToClipboard", + "copyHeadersToClipboard", + "copyGroupHeadersToClipboard", + "pivotMode", + "suppressAggFuncInHeader", + "suppressColumnVirtualisation", + "suppressAggAtRootLevel", + "suppressFocusAfterRefresh", + "functionsPassive", + "functionsReadOnly", + "animateRows", + "groupSelectsFiltered", + "groupRemoveSingleChildren", + "groupRemoveLowestSingleChildren", + "enableRtl", + "suppressClickEdit", + "rowDragEntireRow", + "rowDragManaged", + "suppressRowDrag", + "suppressMoveWhenRowDragging", + "rowDragMultiRow", + "enableGroupEdit", + "embedFullWidthRows", + "deprecatedEmbedFullWidthRows", + "suppressPaginationPanel", + "groupHideOpenParents", + "groupMultiAutoColumn", + "pagination", + "stopEditingWhenGridLosesFocus", + "paginationAutoPageSize", + "suppressScrollOnNewData", + "suppressScrollWhenPopupsAreOpen", + "purgeClosedRowNodes", + "cacheQuickFilter", + "deltaRowDataMode", + "ensureDomOrder", + "accentedSort", + "suppressChangeDetection", + "valueCache", + "valueCacheNeverExpires", + "aggregateOnlyChangedColumns", + "suppressAnimationFrame", + "suppressExcelExport", + "suppressCsvExport", + "treeData", + "masterDetail", + "suppressMultiRangeSelection", + "enterMovesDownAfterEdit", + "enterMovesDown", + "suppressPropertyNamesCheck", + "rowMultiSelectWithClick", + "suppressEnterpriseResetOnNewColumns", + "suppressRowHoverHighlight", + "suppressRowTransform", + "suppressClipboardPaste", + "suppressLastEmptyLineOnPaste", + "serverSideSortingAlwaysResets", + "suppressSetColumnStateEvents", + "suppressColumnStateEvents", + "enableCharts", + "deltaColumnMode", + "suppressMaintainUnsortedOrder", + "enableCellTextSelection", + "suppressBrowserResizeObserver", + "suppressMaxRenderedRowRestriction", + "excludeChildrenWhenTreeDataFiltering", + "tooltipMouseTrack", + "keepDetailRows", + "paginateChildRows", + "preventDefaultOnContextMenu", + "undoRedoCellEditing", + "allowDragFromColumnsToolPanel", + "immutableData", + "immutableColumns", + "pivotSuppressAutoColumn", + "suppressExpandablePivotGroups", + "applyColumnDefOrder", + "debounceVerticalScrollbar", + "detailRowAutoHeight", + "serverSideFilteringAlwaysResets", + "suppressAggFilteredOnly", + "showOpenedGroup", + "suppressClipboardApi", + "suppressModelUpdateAfterUpdateTransaction", + "stopEditingWhenCellsLoseFocus", + "maintainColumnOrder", + "groupMaintainOrder", + "columnHoverHighlight", + "reactUi", + "suppressReactUi", + "readOnlyEdit", + "suppressRowVirtualisation", + "resetRowDataOnUpdate", + "removePivotHeaderRowWhenSingleValueColumn", + "suppressCopySingleCellRanges" + ], M.FUNCTION_PROPERTIES = [ + "localeTextFunc", + "getLocaleText", + "groupRowInnerRenderer", + "groupRowInnerRendererFramework", + "groupRowRenderer", + "groupRowRendererFramework", + "isExternalFilterPresent", + "getRowHeight", + "doesExternalFilterPass", + "getRowClass", + "getRowStyle", + "getContextMenuItems", + "getMainMenuItems", + "processRowPostCreate", + "processCellForClipboard", + "groupRowAggNodes", + "getGroupRowAgg", + "getRowNodeId", + "isFullWidthCell", + "isFullWidthRow", + "fullWidthCellRenderer", + "fullWidthCellRendererFramework", + "processSecondaryColDef", + "processSecondaryColGroupDef", + "getBusinessKeyForNode", + "sendToClipboard", + "navigateToNextHeader", + "tabToNextHeader", + "navigateToNextCell", + "tabToNextCell", + "processCellFromClipboard", + "getDocument", + "postProcessPopup", + "getChildCount", + "getDataPath", + "loadingCellRenderer", + "loadingCellRendererFramework", + "loadingOverlayComponent", + "loadingOverlayComponentFramework", + "noRowsOverlayComponent", + "noRowsOverlayComponentFramework", + "detailCellRenderer", + "detailCellRendererFramework", + "isRowMaster", + "isRowSelectable", + "postSort", + "postSortRows", + "processHeaderForClipboard", + "processGroupHeaderForClipboard", + "paginationNumberFormatter", + "processDataFromClipboard", + "getServerSideGroupKey", + "isServerSideGroup", + "suppressKeyboardEvent", + "createChartContainer", + "getChartToolbarItems", + "fillOperation", + "isApplyServerSideTransaction", + "getServerSideStoreParams", + "isServerSideGroupOpenByDefault", + "isGroupOpenByDefault", + "defaultGroupSortComparator", + "defaultGroupOrderComparator", + "initialGroupOrderComparator", + "loadingCellRendererSelector", + "getRowId", + "groupAggFiltering" + ], M.ALL_PROPERTIES = Kt(M.ARRAY_PROPERTIES, M.OBJECT_PROPERTIES, M.STRING_PROPERTIES, M.NUMBER_PROPERTIES, M.FUNCTION_PROPERTIES, M.BOOLEAN_PROPERTIES), M.FRAMEWORK_PROPERTIES = [ + "__ob__", + "__v_skip", + "__metadata__", + "mappedColumnProperties", + "hasChildColumns", + "toColDef", + "createColDefFromGridColumn" + ], M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Sr = function() { + return Sr = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, Sr.apply(this, arguments); + }, Tr = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, ri = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(Tr(arguments[f])); + return M; + }, pi = ( + /** @class */ + function() { + function M() { + } + return M.getEventCallbacks = function() { + return M.EVENT_CALLBACKS || (M.EVENT_CALLBACKS = M.EVENTS.map(function(f) { + return M.getCallbackForEvent(f); + })), M.EVENT_CALLBACKS; + }, M.copyAttributesToGridOptions = function(f, d, g) { + typeof f != "object" && (f = {}); + var S = f, O = function(z) { + return typeof d[z] < "u"; + }; + return O("groupAggFiltering") && typeof d.groupAggFiltering != "function" && (S.groupAggFiltering = M.toBoolean(d.groupAggFiltering), delete d.groupAggFiltering), ri(M.ARRAY_PROPERTIES, M.STRING_PROPERTIES, M.OBJECT_PROPERTIES, M.FUNCTION_PROPERTIES, M.getEventCallbacks()).filter(O).forEach(function(z) { + return S[z] = d[z]; + }), M.BOOLEAN_PROPERTIES.filter(O).forEach(function(z) { + return S[z] = M.toBoolean(d[z]); + }), M.NUMBER_PROPERTIES.filter(O).forEach(function(z) { + return S[z] = M.toNumber(d[z]); + }), f; + }, M.getCallbackForEvent = function(f) { + return !f || f.length < 2 ? f : "on" + f[0].toUpperCase() + f.substr(1); + }, M.processOnChange = function(f, d, g, S) { + if (f) { + var O = Sr({}, f), z = d, te = function(ht) { + return O[ht]; + }; + te("groupAggFiltering") && (typeof O.groupAggFiltering == "function" ? z.groupAggFiltering = O.groupAggFiltering : z.groupAggFiltering = M.toBoolean(O.groupAggFiltering), delete O.groupAggFiltering), O.rowClass && (g.setRowClass(O.rowClass.currentValue), delete O.rowClass), ri(M.ARRAY_PROPERTIES, M.OBJECT_PROPERTIES, M.STRING_PROPERTIES, M.getEventCallbacks()).filter(te).forEach(function(ht) { + return z[ht] = O[ht].currentValue; + }), M.BOOLEAN_PROPERTIES.filter(te).forEach(function(ht) { + return z[ht] = M.toBoolean(O[ht].currentValue); + }), M.NUMBER_PROPERTIES.filter(te).forEach(function(ht) { + return z[ht] = M.toNumber(O[ht].currentValue); + }), O.enableCellTextSelection && (g.setEnableCellTextSelection(M.toBoolean(O.enableCellTextSelection.currentValue)), delete O.enableCellTextSelection), O.quickFilterText && (g.setQuickFilter(O.quickFilterText.currentValue), delete O.quickFilterText), O.autoGroupColumnDef && (g.setAutoGroupColumnDef(O.autoGroupColumnDef.currentValue, "gridOptionsChanged"), delete O.autoGroupColumnDef), O.columnDefs && (g.setColumnDefs(O.columnDefs.currentValue, "gridOptionsChanged"), delete O.columnDefs), O.defaultColDef && (g.setDefaultColDef(O.defaultColDef.currentValue, "gridOptionsChanged"), delete O.defaultColDef), O.paginationPageSize && (g.paginationSetPageSize(M.toNumber(O.paginationPageSize.currentValue)), delete O.paginationPageSize), O.pivotMode && (S.setPivotMode(M.toBoolean(O.pivotMode.currentValue)), delete O.pivotMode), O.groupRemoveSingleChildren && (g.setGroupRemoveSingleChildren(M.toBoolean(O.groupRemoveSingleChildren.currentValue)), delete O.groupRemoveSingleChildren), O.suppressRowDrag && (g.setSuppressRowDrag(M.toBoolean(O.suppressRowDrag.currentValue)), delete O.suppressRowDrag), O.suppressMoveWhenRowDragging && (g.setSuppressMoveWhenRowDragging(M.toBoolean(O.suppressMoveWhenRowDragging.currentValue)), delete O.suppressMoveWhenRowDragging), O.suppressRowClickSelection && (g.setSuppressRowClickSelection(M.toBoolean(O.suppressRowClickSelection.currentValue)), delete O.suppressRowClickSelection), O.suppressClipboardPaste && (g.setSuppressClipboardPaste(M.toBoolean(O.suppressClipboardPaste.currentValue)), delete O.suppressClipboardPaste), O.headerHeight && (g.setHeaderHeight(M.toNumber(O.headerHeight.currentValue)), delete O.headerHeight); + var Fe = g; + Object.keys(O).forEach(function(ht) { + var Lt = "set" + ht.charAt(0).toUpperCase() + ht.substring(1); + Fe[Lt] && Fe[Lt](f[ht].currentValue); + }); + var ze = { + type: ui.EVENT_COMPONENT_STATE_CHANGED, + api: d.api, + columnApi: d.columnApi + }; + I(f, function(ht, Lt) { + ze[ht] = Lt; + }), g.dispatchEvent(ze); + } + }, M.toBoolean = function(f) { + return typeof f == "boolean" ? f : typeof f == "string" ? f.toUpperCase() === "TRUE" || f == "" : !1; + }, M.toNumber = function(f) { + if (typeof f == "number") + return f; + if (typeof f == "string") + return Number(f); + }, M.EVENTS = [], M.PUBLIC_EVENTS = [], M.EXCLUDED_INTERNAL_EVENTS = [], M.STRING_PROPERTIES = Pi.STRING_PROPERTIES, M.OBJECT_PROPERTIES = Pi.OBJECT_PROPERTIES, M.ARRAY_PROPERTIES = Pi.ARRAY_PROPERTIES, M.NUMBER_PROPERTIES = Pi.NUMBER_PROPERTIES, M.BOOLEAN_PROPERTIES = Pi.BOOLEAN_PROPERTIES, M.FUNCTION_PROPERTIES = Pi.FUNCTION_PROPERTIES, M.ALL_PROPERTIES = Pi.ALL_PROPERTIES, M; + }() + ); + pi.EVENTS = y(ui), pi.EXCLUDED_INTERNAL_EVENTS = [ + ui.EVENT_SCROLLBAR_WIDTH_CHANGED, + ui.EVENT_CHECKBOX_CHANGED, + ui.EVENT_HEIGHT_SCALE_CHANGED, + ui.EVENT_BODY_HEIGHT_CHANGED, + ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, + ui.EVENT_SCROLL_VISIBILITY_CHANGED, + ui.EVENT_COLUMN_HOVER_CHANGED, + ui.EVENT_FLASH_CELLS, + ui.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, + ui.EVENT_DISPLAYED_ROWS_CHANGED, + ui.EVENT_LEFT_PINNED_WIDTH_CHANGED, + ui.EVENT_RIGHT_PINNED_WIDTH_CHANGED, + ui.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, + ui.EVENT_POPUP_TO_FRONT, + ui.EVENT_KEYBOARD_FOCUS, + ui.EVENT_MOUSE_FOCUS, + ui.EVENT_STORE_UPDATED, + ui.EVENT_COLUMN_PANEL_ITEM_DRAG_START, + ui.EVENT_COLUMN_PANEL_ITEM_DRAG_END, + ui.EVENT_FILL_START, + ui.EVENT_FILL_END, + ui.EVENT_FULL_WIDTH_ROW_FOCUSED + ], pi.PUBLIC_EVENTS = pi.EVENTS.filter(function(M) { + return !Ce(pi.EXCLUDED_INTERNAL_EVENTS, M); + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var mi = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), hr = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Lr = ( + /** @class */ + function(M) { + mi(f, M); + function f() { + var d = M !== null && M.apply(this, arguments) || this; + return d.componentsMappedByName = {}, d; + } + return f.prototype.setupComponents = function(d) { + var g = this; + d && d.forEach(function(S) { + return g.addComponent(S); + }); + }, f.prototype.addComponent = function(d) { + var g = d.componentName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), S = g.toUpperCase(); + this.componentsMappedByName[S] = d.componentClass; + }, f.prototype.getComponentClass = function(d) { + return this.componentsMappedByName[d]; + }, f = hr([ + Ne("agStackComponentsRegistry") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var wr = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, Nr = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(wr(arguments[f])); + return M; + }, _r = ( + /** @class */ + function() { + function M() { + } + return M.STRING_PROPERTIES = [ + "headerName", + "columnGroupShow", + "headerClass", + "toolPanelClass", + "headerValueGetter", + "pivotKeys", + "groupId", + "colId", + "sort", + "initialSort", + "field", + "type", + "tooltipComponent", + "tooltipField", + "headerTooltip", + "cellClass", + "showRowGroup", + "filter", + "initialAggFunc", + "defaultAggFunc", + "aggFunc", + "pinned", + "initialPinned", + "chartDataType", + "cellEditorPopupPosition" + ], M.OBJECT_PROPERTIES = [ + "headerGroupComponent", + "headerGroupComponentFramework", + "headerGroupComponentParams", + "cellStyle", + "cellRenderer", + "cellRendererParams", + "cellRendererFramework", + "cellEditor", + "cellEditorFramework", + "cellEditorParams", + "pinnedRowCellRendererFramework", + "pinnedRowCellRendererParams", + "filterFramework", + "filterParams", + "pivotValueColumn", + "headerComponent", + "headerComponentFramework", + "headerComponentParams", + "floatingFilterComponent", + "floatingFilterComponentParams", + "floatingFilterComponentFramework", + "floatingFilterFramework", + "tooltipComponent", + "tooltipComponentParams", + "tooltipComponentFramework", + "refData", + "columnsMenuParams" + ], M.ARRAY_PROPERTIES = [ + "children", + "sortingOrder", + "allowedAggFuncs", + "menuTabs", + "pivotTotalColumnIds", + "cellClassRules", + "icons" + ], M.NUMBER_PROPERTIES = [ + "sortedAt", + "sortIndex", + "initialSortIndex", + "flex", + "initialFlex", + "width", + "initialWidth", + "minWidth", + "maxWidth", + "rowGroupIndex", + "initialRowGroupIndex", + "pivotIndex", + "initialPivotIndex" + ], M.BOOLEAN_PROPERTIES = [ + "suppressCellFlash", + "suppressColumnsToolPanel", + "suppressFiltersToolPanel", + "openByDefault", + "marryChildren", + "hide", + "initialHide", + "rowGroup", + "initialRowGroup", + "pivot", + "initialPivot", + "checkboxSelection", + "headerCheckboxSelection", + "headerCheckboxSelectionFilteredOnly", + "suppressMenu", + "suppressMovable", + "lockPosition", + "lockVisible", + "lockPinned", + "unSortIcon", + "suppressSizeToFit", + "suppressAutoSize", + "enableRowGroup", + "enablePivot", + "enableValue", + "editable", + "suppressPaste", + "suppressNavigable", + "enableCellChangeFlash", + "rowDrag", + "dndSource", + "autoHeight", + "wrapText", + "sortable", + "resizable", + "singleClickEdit", + "floatingFilter", + "cellEditorPopup", + "suppressFillHandle" + ], M.FUNCTION_PROPERTIES = [ + "dndSourceOnRowDrag", + "valueGetter", + "valueSetter", + "filterValueGetter", + "keyCreator", + "pinnedRowCellRenderer", + "valueFormatter", + "pinnedRowValueFormatter", + "valueParser", + "comparator", + "equals", + "pivotComparator", + "suppressKeyboardEvent", + "suppressHeaderKeyboardEvent", + "colSpan", + "rowSpan", + "getQuickFilterText", + "newValueHandler", + "onCellValueChanged", + "onCellClicked", + "onCellDoubleClicked", + "onCellContextMenu", + "rowDragText", + "tooltipValueGetter", + "tooltipComponent", + "tooltipComponentFramework", + "cellRendererSelector", + "cellEditorSelector" + ], M.ALL_PROPERTIES = Nr(M.ARRAY_PROPERTIES, M.OBJECT_PROPERTIES, M.STRING_PROPERTIES, M.NUMBER_PROPERTIES, M.FUNCTION_PROPERTIES, M.BOOLEAN_PROPERTIES), M.FRAMEWORK_PROPERTIES = [ + "__ob__", + "__v_skip", + "__metadata__", + "mappedColumnProperties", + "hasChildColumns", + "toColDef", + "createColDefFromGridColumn" + ], M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Tn = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, os = ( + /** @class */ + function() { + function M(f, d, g, S) { + S === void 0 && (S = 1), this.r = Math.min(1, Math.max(0, f || 0)), this.g = Math.min(1, Math.max(0, d || 0)), this.b = Math.min(1, Math.max(0, g || 0)), this.a = Math.min(1, Math.max(0, S || 0)); + } + return M.fromString = function(f) { + if (f.indexOf("#") >= 0) + return M.fromHexString(f); + var d = M.nameToHex[f]; + if (d) + return M.fromHexString(d); + if (f.indexOf("rgb") >= 0) + return M.fromRgbaString(f); + throw new Error("Invalid color string: '" + f + "'"); + }, M.parseHex = function(f) { + f = f.replace(/ /g, "").slice(1); + var d; + switch (f.length) { + case 6: + case 8: + d = []; + for (var g = 0; g < f.length; g += 2) + d.push(parseInt("" + f[g] + f[g + 1], 16)); + break; + case 3: + case 4: + d = f.split("").map(function(S) { + return parseInt(S, 16); + }).map(function(S) { + return S + S * 16; + }); + break; + } + if (d.length >= 3 && d.every(function(S) { + return S >= 0; + })) + return d.length === 3 && d.push(255), d; + }, M.fromHexString = function(f) { + var d = M.parseHex(f); + if (d) { + var g = Tn(d, 4), S = g[0], O = g[1], z = g[2], te = g[3]; + return new M(S / 255, O / 255, z / 255, te / 255); + } + throw new Error("Malformed hexadecimal color string: '" + f + "'"); + }, M.stringToRgba = function(f) { + for (var d = Tn([NaN, NaN], 2), g = d[0], S = d[1], O = 0; O < f.length; O++) { + var z = f[O]; + if (!g && z === "(") + g = O; + else if (z === ")") { + S = O; + break; + } + } + var te = g && S && f.substring(g + 1, S); + if (te) { + for (var Fe = te.split(","), ze = [], O = 0; O < Fe.length; O++) { + var ht = Fe[O], Lt = parseFloat(ht); + if (isNaN(Lt)) + return; + ht.indexOf("%") >= 0 ? (Lt = Math.max(0, Math.min(100, Lt)), Lt /= 100) : O === 3 ? Lt = Math.max(0, Math.min(1, Lt)) : (Lt = Math.max(0, Math.min(255, Lt)), Lt /= 255), ze.push(Lt); + } + return ze; + } + }, M.fromRgbaString = function(f) { + var d = M.stringToRgba(f); + if (d) { + if (d.length === 3) + return new M(d[0], d[1], d[2]); + if (d.length === 4) + return new M(d[0], d[1], d[2], d[3]); + } + throw new Error("Malformed rgb/rgba color string: '" + f + "'"); + }, M.fromArray = function(f) { + if (f.length === 4) + return new M(f[0], f[1], f[2], f[3]); + if (f.length === 3) + return new M(f[0], f[1], f[2]); + throw new Error("The given array should contain 3 or 4 color components (numbers)."); + }, M.fromHSB = function(f, d, g, S) { + S === void 0 && (S = 1); + var O = M.HSBtoRGB(f, d, g); + return new M(O[0], O[1], O[2], S); + }, M.padHex = function(f) { + return f.length === 1 ? "0" + f : f; + }, M.prototype.toHexString = function() { + var f = "#" + M.padHex(Math.round(this.r * 255).toString(16)) + M.padHex(Math.round(this.g * 255).toString(16)) + M.padHex(Math.round(this.b * 255).toString(16)); + return this.a < 1 && (f += M.padHex(Math.round(this.a * 255).toString(16))), f; + }, M.prototype.toRgbaString = function(f) { + f === void 0 && (f = 3); + var d = [ + Math.round(this.r * 255), + Math.round(this.g * 255), + Math.round(this.b * 255) + ], g = Math.pow(10, f); + return this.a !== 1 ? (d.push(Math.round(this.a * g) / g), "rgba(" + d.join(", ") + ")") : "rgb(" + d.join(", ") + ")"; + }, M.prototype.toString = function() { + return this.a === 1 ? this.toHexString() : this.toRgbaString(); + }, M.prototype.toHSB = function() { + return M.RGBtoHSB(this.r, this.g, this.b); + }, M.RGBtoHSB = function(f, d, g) { + var S = Math.min(f, d, g), O = Math.max(f, d, g), z = O !== 0 ? (O - S) / O : 0, te = NaN; + if (S !== O) { + var Fe = O - S, ze = (O - f) / Fe, ht = (O - d) / Fe, Lt = (O - g) / Fe; + f === O ? te = Lt - ht : d === O ? te = 2 + ze - Lt : te = 4 + ht - ze, te /= 6, te < 0 && (te = te + 1); + } + return [te * 360, z, O]; + }, M.HSBtoRGB = function(f, d, g) { + isNaN(f) && (f = 0), f = (f % 360 + 360) % 360 / 360; + var S = 0, O = 0, z = 0; + if (d === 0) + S = O = z = g; + else { + var te = (f - Math.floor(f)) * 6, Fe = te - Math.floor(te), ze = g * (1 - d), ht = g * (1 - d * Fe), Lt = g * (1 - d * (1 - Fe)); + switch (te >> 0) { + case 0: + S = g, O = Lt, z = ze; + break; + case 1: + S = ht, O = g, z = ze; + break; + case 2: + S = ze, O = g, z = Lt; + break; + case 3: + S = ze, O = ht, z = g; + break; + case 4: + S = Lt, O = ze, z = g; + break; + case 5: + S = g, O = ze, z = ht; + break; + } + } + return [S, O, z]; + }, M.prototype.derive = function(f, d, g, S) { + var O = M.RGBtoHSB(this.r, this.g, this.b), z = O[2]; + z == 0 && g > 1 && (z = 0.05); + var te = ((O[0] + f) % 360 + 360) % 360, Fe = Math.max(Math.min(O[1] * d, 1), 0); + z = Math.max(Math.min(z * g, 1), 0); + var ze = Math.max(Math.min(this.a * S, 1), 0), ht = M.HSBtoRGB(te, Fe, z); + return ht.push(ze), M.fromArray(ht); + }, M.prototype.brighter = function() { + return this.derive(0, 1, 1 / 0.7, 1); + }, M.prototype.darker = function() { + return this.derive(0, 1, 0.7, 1); + }, M.nameToHex = Object.freeze({ + aliceblue: "#F0F8FF", + antiquewhite: "#FAEBD7", + aqua: "#00FFFF", + aquamarine: "#7FFFD4", + azure: "#F0FFFF", + beige: "#F5F5DC", + bisque: "#FFE4C4", + black: "#000000", + blanchedalmond: "#FFEBCD", + blue: "#0000FF", + blueviolet: "#8A2BE2", + brown: "#A52A2A", + burlywood: "#DEB887", + cadetblue: "#5F9EA0", + chartreuse: "#7FFF00", + chocolate: "#D2691E", + coral: "#FF7F50", + cornflowerblue: "#6495ED", + cornsilk: "#FFF8DC", + crimson: "#DC143C", + cyan: "#00FFFF", + darkblue: "#00008B", + darkcyan: "#008B8B", + darkgoldenrod: "#B8860B", + darkgray: "#A9A9A9", + darkgreen: "#006400", + darkgrey: "#A9A9A9", + darkkhaki: "#BDB76B", + darkmagenta: "#8B008B", + darkolivegreen: "#556B2F", + darkorange: "#FF8C00", + darkorchid: "#9932CC", + darkred: "#8B0000", + darksalmon: "#E9967A", + darkseagreen: "#8FBC8F", + darkslateblue: "#483D8B", + darkslategray: "#2F4F4F", + darkslategrey: "#2F4F4F", + darkturquoise: "#00CED1", + darkviolet: "#9400D3", + deeppink: "#FF1493", + deepskyblue: "#00BFFF", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1E90FF", + firebrick: "#B22222", + floralwhite: "#FFFAF0", + forestgreen: "#228B22", + fuchsia: "#FF00FF", + gainsboro: "#DCDCDC", + ghostwhite: "#F8F8FF", + gold: "#FFD700", + goldenrod: "#DAA520", + gray: "#808080", + green: "#008000", + greenyellow: "#ADFF2F", + grey: "#808080", + honeydew: "#F0FFF0", + hotpink: "#FF69B4", + indianred: "#CD5C5C", + indigo: "#4B0082", + ivory: "#FFFFF0", + khaki: "#F0E68C", + lavender: "#E6E6FA", + lavenderblush: "#FFF0F5", + lawngreen: "#7CFC00", + lemonchiffon: "#FFFACD", + lightblue: "#ADD8E6", + lightcoral: "#F08080", + lightcyan: "#E0FFFF", + lightgoldenrodyellow: "#FAFAD2", + lightgray: "#D3D3D3", + lightgreen: "#90EE90", + lightgrey: "#D3D3D3", + lightpink: "#FFB6C1", + lightsalmon: "#FFA07A", + lightseagreen: "#20B2AA", + lightskyblue: "#87CEFA", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#B0C4DE", + lightyellow: "#FFFFE0", + lime: "#00FF00", + limegreen: "#32CD32", + linen: "#FAF0E6", + magenta: "#FF00FF", + maroon: "#800000", + mediumaquamarine: "#66CDAA", + mediumblue: "#0000CD", + mediumorchid: "#BA55D3", + mediumpurple: "#9370DB", + mediumseagreen: "#3CB371", + mediumslateblue: "#7B68EE", + mediumspringgreen: "#00FA9A", + mediumturquoise: "#48D1CC", + mediumvioletred: "#C71585", + midnightblue: "#191970", + mintcream: "#F5FFFA", + mistyrose: "#FFE4E1", + moccasin: "#FFE4B5", + navajowhite: "#FFDEAD", + navy: "#000080", + oldlace: "#FDF5E6", + olive: "#808000", + olivedrab: "#6B8E23", + orange: "#FFA500", + orangered: "#FF4500", + orchid: "#DA70D6", + palegoldenrod: "#EEE8AA", + palegreen: "#98FB98", + paleturquoise: "#AFEEEE", + palevioletred: "#DB7093", + papayawhip: "#FFEFD5", + peachpuff: "#FFDAB9", + peru: "#CD853F", + pink: "#FFC0CB", + plum: "#DDA0DD", + powderblue: "#B0E0E6", + purple: "#800080", + rebeccapurple: "#663399", + red: "#FF0000", + rosybrown: "#BC8F8F", + royalblue: "#4169E1", + saddlebrown: "#8B4513", + salmon: "#FA8072", + sandybrown: "#F4A460", + seagreen: "#2E8B57", + seashell: "#FFF5EE", + sienna: "#A0522D", + silver: "#C0C0C0", + skyblue: "#87CEEB", + slateblue: "#6A5ACD", + slategray: "#708090", + slategrey: "#708090", + snow: "#FFFAFA", + springgreen: "#00FF7F", + steelblue: "#4682B4", + tan: "#D2B48C", + teal: "#008080", + thistle: "#D8BFD8", + tomato: "#FF6347", + turquoise: "#40E0D0", + violet: "#EE82EE", + wheat: "#F5DEB3", + white: "#FFFFFF", + whitesmoke: "#F5F5F5", + yellow: "#FFFF00", + yellowgreen: "#9ACD32" + }), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function fs(M, f) { + f === void 0 && (f = ","); + var d = [], g = function(ti) { + return ti === "\r" || ti === ` +`; + }, S = !1; + if (M === "") + return [[""]]; + for (var O = function(ti, wi, Ti) { + var qi = M[Ti - 1], dr = M[Ti], kr = M[Ti + 1], Rr = function() { + d[ti] || (d[ti] = []), d[ti][wi] || (d[ti][wi] = ""); + }; + if (Rr(), dr === '"') { + if (S) + return kr === '"' ? (d[ti][wi] += '"', Ti++) : S = !1, z = ti, te = wi, Fe = Ti, "continue"; + if (qi === void 0 || qi === f || g(qi)) + return S = !0, z = ti, te = wi, Fe = Ti, "continue"; + } + if (!S) { + if (dr === f) + return wi++, Rr(), z = ti, te = wi, Fe = Ti, "continue"; + if (g(dr)) + return wi = 0, ti++, Rr(), dr === "\r" && kr === ` +` && Ti++, z = ti, te = wi, Fe = Ti, "continue"; + } + d[ti][wi] += dr, z = ti, te = wi, Fe = Ti; + }, z, te, Fe, ze = 0, ht = 0, Lt = 0; Lt < M.length; Lt++) + O(ze, ht, Lt), ze = z, ht = te, Lt = Fe; + return d; + } + var di = /* @__PURE__ */ Object.freeze({ + stringToArray: fs + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var nr = function(M) { + var f = typeof Symbol == "function" && Symbol.iterator, d = f && M[f], g = 0; + if (d) + return d.call(M); + if (M && typeof M.length == "number") + return { + next: function() { + return M && g >= M.length && (M = void 0), { value: M && M[g++], done: !M }; + } + }; + throw new TypeError(f ? "Object is not iterable." : "Symbol.iterator is not defined."); + }, fr, Zr, er, ys, Da, Ta, Ds, fu; + function mu() { + return Zr === void 0 && (Zr = /*@cc_on!@*/ + !!document.documentMode), Zr; + } + function Rc() { + return er === void 0 && (er = !mu() && !!window.StyleMedia), er; + } + function Mc() { + return fr === void 0 && (fr = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), fr; + } + function Tl() { + if (ys === void 0) { + var M = window; + ys = !!M.chrome && (!!M.chrome.webstore || !!M.chrome.runtime) || /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); + } + return ys; + } + function ah() { + if (Da === void 0) { + var M = window; + Da = typeof M.InstallTrigger < "u"; + } + return Da; + } + function jh() { + return Ta === void 0 && (Ta = (/iPad|iPhone|iPod/.test(navigator.platform) || // eslint-disable-next-line + navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && // @ts-ignore + !window.MSStream), Ta; + } + function Rp(M) { + if (!M) + return null; + var f = M.tabIndex, d = M.getAttribute("tabIndex"); + return f === -1 && (d === null || d === "" && !ah()) ? null : f.toString(); + } + function kl() { + if (!document.body) + return -1; + var M = 1e6, f = navigator.userAgent.toLowerCase().match(/firefox/) ? 6e6 : 1e9, d = document.createElement("div"); + for (document.body.appendChild(d); ; ) { + var g = M * 2; + if (d.style.height = g + "px", g > f || d.clientHeight !== g) + break; + M = g; + } + return document.body.removeChild(d), M; + } + function lh() { + return fu == null && Gh(), fu; + } + function Gh() { + var M = document.body, f = document.createElement("div"); + f.style.width = f.style.height = "100px", f.style.opacity = "0", f.style.overflow = "scroll", f.style.msOverflowStyle = "scrollbar", f.style.position = "absolute", M.appendChild(f); + var d = f.offsetWidth - f.clientWidth; + d === 0 && f.clientWidth === 0 && (d = null), f.parentNode && f.parentNode.removeChild(f), d != null && (fu = d, Ds = d === 0); + } + function ou() { + return Ds == null && Gh(), Ds; + } + function Mp() { + var M, f, d = ["webkit", "moz", "o", "ms"], g = document.createElement("div"), S = document.getElementsByTagName("body")[0], O = !1, z; + S.appendChild(g), g.setAttribute("style", d.map(function(ht) { + return "-" + ht + "-overflow-scrolling: touch"; + }).concat("overflow-scrolling: touch").join(";")); + var te = window.getComputedStyle(g); + if (te.overflowScrolling === "touch" && (O = !0), !O) + try { + for (var Fe = nr(d), ze = Fe.next(); !ze.done; ze = Fe.next()) + if (z = ze.value, te[z + "OverflowScrolling"] === "touch") { + O = !0; + break; + } + } catch (ht) { + M = { error: ht }; + } finally { + try { + ze && !ze.done && (f = Fe.return) && f.call(Fe); + } finally { + if (M) + throw M.error; + } + } + return g.parentNode && g.parentNode.removeChild(g), O; + } + function yh() { + return document.body ? document.body.clientWidth : window.innerHeight ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : -1; + } + function ag() { + return document.body ? document.body.clientHeight : window.innerHeight ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : -1; + } + var lg = /* @__PURE__ */ Object.freeze({ + isBrowserEdge: Rc, + isBrowserSafari: Mc, + isBrowserChrome: Tl, + isBrowserFirefox: ah, + isIOSUserAgent: jh, + getTabIndex: Rp, + getMaxDivHeight: kl, + getScrollbarWidth: lh, + isInvisibleScrollbar: ou, + hasOverflowScrolling: Mp, + getBodyWidth: yh, + getBodyHeight: ag + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var jd; + function ha(M, f, d) { + for (var g = M.parentElement, S = g && g.firstChild; S; ) + f && S.classList.toggle(f, S === M), d && S.classList.toggle(d, S !== M), S = S.nextSibling; + } + function Nf(M) { + var f = Element.prototype.matches || Element.prototype.msMatchesSelector, d = f.call(M, Ue.INPUT_SELECTOR), g = f.call(M, Ue.FOCUSABLE_EXCLUDE), S = jc(M), O = d && !g && S; + return O; + } + function al(M, f) { + M.classList.toggle("ag-hidden", !f); + } + function Dp(M, f) { + M.classList.toggle("ag-invisible", !f); + } + function uh(M, f) { + var d = "disabled", g = f ? function(S) { + return S.setAttribute(d, ""); + } : function(S) { + return S.removeAttribute(d); + }; + g(M), Ie(M.querySelectorAll("input"), function(S) { + return g(S); + }); + } + function hi(M, f, d) { + for (var g = 0; M; ) { + if (M.classList.contains(f)) + return !0; + if (M = M.parentElement, d && ++g > d) + break; + } + return !1; + } + function ll(M) { + var f = window.getComputedStyle(M), d = f.height, g = f.width, S = f.paddingTop, O = f.paddingRight, z = f.paddingBottom, te = f.paddingLeft, Fe = f.marginTop, ze = f.marginRight, ht = f.marginBottom, Lt = f.marginLeft, ti = f.boxSizing; + return { + height: parseFloat(d), + width: parseFloat(g), + paddingTop: parseFloat(S), + paddingRight: parseFloat(O), + paddingBottom: parseFloat(z), + paddingLeft: parseFloat(te), + marginTop: parseFloat(Fe), + marginRight: parseFloat(ze), + marginBottom: parseFloat(ht), + marginLeft: parseFloat(Lt), + boxSizing: ti + }; + } + function Fp(M) { + var f = ll(M); + return f.boxSizing === "border-box" ? f.height - f.paddingTop - f.paddingBottom : f.height; + } + function ug(M) { + var f = ll(M); + return f.boxSizing === "border-box" ? f.width - f.paddingLeft - f.paddingRight : f.width; + } + function Wo(M) { + var f = ll(M), d = f.marginBottom + f.marginTop; + return Math.ceil(M.offsetHeight + d); + } + function lp(M) { + var f = ll(M), d = f.marginLeft + f.marginRight; + return Math.ceil(M.offsetWidth + d); + } + function Hs() { + if (typeof jd == "boolean") + return jd; + var M = document.createElement("div"); + return M.style.direction = "rtl", M.style.width = "1px", M.style.height = "1px", M.style.position = "fixed", M.style.top = "0px", M.style.overflow = "hidden", M.dir = "rtl", M.innerHTML = /* html */ + `
+ + +
`, document.body.appendChild(M), M.scrollLeft = 1, jd = Math.floor(M.scrollLeft) === 0, document.body.removeChild(M), jd; + } + function Xs(M, f) { + var d = M.scrollLeft; + return f && (d = Math.abs(d), Tl() && !Hs() && (d = M.scrollWidth - M.clientWidth - d)), d; + } + function ql(M, f, d) { + d && (Hs() ? f *= -1 : (Mc() || Tl()) && (f = M.scrollWidth - M.clientWidth - f)), M.scrollLeft = f; + } + function Su(M) { + for (; M && M.firstChild; ) + M.removeChild(M.firstChild); + } + function Im(M, f) { + Vc(M.querySelector(f)); + } + function Vc(M) { + M && M.parentNode && M.parentNode.removeChild(M); + } + function jc(M) { + return M.offsetParent !== null; + } + function gu(M) { + if (DOMParser !== null) { + var f = new DOMParser(), d = f.parseFromString(M, "text/html"); + return d.body.firstChild; + } + var g = document.createElement("div"); + return g.innerHTML = (M || "").trim(), g.firstChild; + } + function Yl(M, f) { + M.lastChild ? M.insertAdjacentHTML("afterbegin", f) : M.innerHTML = f; + } + function Ba(M, f) { + if (M.attributes && M.attributes[f]) { + var d = M.attributes[f]; + return d.value; + } + return null; + } + function vh(M) { + return M && M.clientHeight ? M.clientHeight : 0; + } + function Yu(M) { + return M && M.clientWidth ? M.clientWidth : 0; + } + function $l(M, f, d) { + d && d.nextSibling === f || (d ? d.nextSibling ? M.insertBefore(f, d.nextSibling) : M.appendChild(f) : M.firstChild && M.firstChild !== f && M.insertAdjacentElement("afterbegin", f)); + } + function _c(M, f) { + for (var d = 0; d < f.length; d++) { + var g = f[d], S = M.children[d]; + S !== g && M.insertBefore(g, S); + } + } + function Am(M, f, d) { + d ? d.insertAdjacentElement("afterend", f) : M.firstChild ? M.insertAdjacentElement("afterbegin", f) : M.appendChild(f); + } + function Gd(M, f) { + i(M.firstChild) ? M.insertBefore(f, M.firstChild) : M.appendChild(f); + } + function df(M, f) { + f && Object.keys(f).forEach(function(d) { + var g = Ca(d); + g && (M.style[g] = f[d]); + }); + } + function Ug(M) { + return M.clientWidth < M.scrollWidth; + } + function cg(M) { + return M.clientHeight < M.scrollHeight; + } + function zt(M, f) { + f === "flex" ? (M.style.removeProperty("width"), M.style.removeProperty("minWidth"), M.style.removeProperty("maxWidth"), M.style.flex = "1 1 auto") : Wt(M, f); + } + function Wt(M, f) { + f = ge(f), M.style.width = f.toString(), M.style.maxWidth = f.toString(), M.style.minWidth = f.toString(); + } + function Ai(M, f) { + f === "flex" ? (M.style.removeProperty("height"), M.style.removeProperty("minHeight"), M.style.removeProperty("maxHeight"), M.style.flex = "1 1 auto") : Ui(M, f); + } + function Ui(M, f) { + f = ge(f), M.style.height = f.toString(), M.style.maxHeight = f.toString(), M.style.minHeight = f.toString(); + } + function ge(M) { + return typeof M == "number" ? M + "px" : M; + } + function Le(M) { + return typeof Node == "function" ? M instanceof Node : M && typeof M == "object" && typeof M.nodeType == "number" && typeof M.nodeName == "string"; + } + function Ye(M) { + return typeof HTMLElement == "function" ? M instanceof HTMLElement : M && ce(M) && M.nodeType === 1 && typeof M.nodeName == "string"; + } + function xt(M) { + return Le(M) || Ye(M); + } + function oe(M) { + if (M == null) + return []; + var f = []; + return Ie(M, function(d) { + return f.push(d); + }), f; + } + function ee(M, f) { + if (M) + for (var d = 0; d < M.length; d++) { + var g = M[d]; + f(g.name, g.value); + } + } + function ae(M, f) { + typeof f == "boolean" ? (M.checked = f, M.indeterminate = !1) : M.indeterminate = !0; + } + function ye(M, f, d) { + d == null ? M.removeAttribute(f) : M.setAttribute(f, d.toString()); + } + function Ie(M, f) { + if (M != null) + for (var d = 0; d < M.length; d++) + f(M[d]); + } + var We = /* @__PURE__ */ Object.freeze({ + radioCssClass: ha, + isFocusableFormField: Nf, + setDisplayed: al, + setVisible: Dp, + setDisabled: uh, + isElementChildOfClass: hi, + getElementSize: ll, + getInnerHeight: Fp, + getInnerWidth: ug, + getAbsoluteHeight: Wo, + getAbsoluteWidth: lp, + isRtlNegativeScroll: Hs, + getScrollLeft: Xs, + setScrollLeft: ql, + clearElement: Su, + removeElement: Im, + removeFromParent: Vc, + isVisible: jc, + loadTemplate: gu, + appendHtml: Yl, + getElementAttribute: Ba, + offsetHeight: vh, + offsetWidth: Yu, + ensureDomOrder: $l, + setDomChildOrder: _c, + insertWithDomOrder: Am, + prependDC: Gd, + addStylesToElement: df, + isHorizontalScrollShowing: Ug, + isVerticalScrollShowing: cg, + setElementWidth: zt, + setFixedWidth: Wt, + setElementHeight: Ai, + setFixedHeight: Ui, + formatSize: ge, + isNode: Le, + isElement: Ye, + isNodeOrElement: xt, + copyNodeList: oe, + iterateNamedNodeMap: ee, + setCheckboxState: ae, + addOrRemoveAttribute: ye, + nodeListForEach: Ie + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function Xe(M) { + var f = /function (.{1,})\(/, d = M.toString(), g = f.exec(d); + return g && g.length > 1 ? g[1] : ""; + } + function lt(M) { + var f = M.length, d = 0; + if (f <= 1) + return M; + for (var g = 0; g < M.length; g++) { + var S = M[g], O = S.toString().split("e-"); + if (O.length > 1) { + d = Math.max(d, parseInt(O[1], 10)); + continue; + } + Math.floor(S) !== S && (d = Math.max(d, S.toString().split(".")[1].length)); + } + for (var z = 0, te = 0, Fe = 0, ze = 0, ht = 0, Lt = 0; Lt < f; Lt++) + ht = M[Lt], z += Lt, te += ht, ze += Lt * Lt, Fe += Lt * ht; + for (var ti = (f * Fe - z * te) / (f * ze - z * z), wi = te / f - ti * z / f, Ti = [], Lt = 0; Lt <= f; Lt++) + Ti.push(parseFloat((Lt * ti + wi).toFixed(d))); + return Ti; + } + function Et(M) { + if (!M) + return ""; + var f = []; + return I(M, function(d, g) { + var S = Ut(d); + f.push(S + ": " + g + ";"); + }), f.join(" "); + } + function Ht(M) { + var f = document.createElement("div"), d = document.querySelector("#__ag__message"); + if (f.innerHTML = M, !d) { + var g = '
'; + d = gu(g), document.body && document.body.appendChild(d); + } + d.insertBefore(f, d.children[0]); + } + function vi(M, f) { + M.then(function(d) { + var g = d.getGui(); + g != null && (typeof g == "object" ? f.appendChild(g) : f.innerHTML = g); + }); + } + var yi = /* @__PURE__ */ Object.freeze({ + getNameOfClass: Xe, + findLineByLeastSquares: lt, + cssStyleObjectToMarkup: Et, + message: Ht, + bindCellRendererToHtmlElement: vi + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function Oi(M, f, d) { + M.setAttribute(ar(f), d.toString()); + } + function zi(M, f) { + M.removeAttribute(ar(f)); + } + function ar(M) { + return "aria-" + M; + } + function tr(M, f) { + f ? M.setAttribute("role", f) : M.removeAttribute("role"); + } + function Ir(M) { + var f; + return M.isSortAscending() ? f = "ascending" : M.isSortDescending() ? f = "descending" : f = "none", f; + } + function ur(M) { + return parseInt(M.getAttribute("aria-level"), 10); + } + function Jr(M) { + return parseInt(M.getAttribute("aria-posinset"), 10); + } + function on(M) { + return M.getAttribute("aria-describedby") || ""; + } + function $n(M, f) { + var d = "label"; + f ? Oi(M, d, f) : zi(M, d); + } + function Fs(M, f) { + var d = "labelledby"; + f ? Oi(M, d, f) : zi(M, d); + } + function Ro(M, f) { + var d = "description"; + f ? Oi(M, d, f) : zi(M, d); + } + function Wa(M, f) { + var d = "describedby"; + f ? Oi(M, d, f) : zi(M, d); + } + function Ks(M, f) { + Oi(M, "level", f); + } + function vs(M, f) { + Oi(M, "disabled", f); + } + function yo(M, f) { + Oi(M, "expanded", f); + } + function Gc(M) { + zi(M, "expanded"); + } + function Pr(M, f) { + Oi(M, "setsize", f); + } + function _h(M, f) { + Oi(M, "posinset", f); + } + function Xu(M, f) { + Oi(M, "multiselectable", f); + } + function Cu(M, f) { + Oi(M, "rowcount", f); + } + function Bl(M, f) { + Oi(M, "rowindex", f); + } + function bh(M, f) { + Oi(M, "colcount", f); + } + function fd(M, f) { + Oi(M, "colindex", f); + } + function pf(M, f) { + Oi(M, "colspan", f); + } + function wh(M, f) { + Oi(M, "sort", f); + } + function md(M) { + zi(M, "sort"); + } + function yl(M, f) { + var d = "selected"; + f ? Oi(M, d, f) : zi(M, d); + } + function Dc(M, f) { + Oi(M, "checked", f === void 0 ? "mixed" : f); + } + var Vl = /* @__PURE__ */ Object.freeze({ + setAriaRole: tr, + getAriaSortState: Ir, + getAriaLevel: ur, + getAriaPosInSet: Jr, + getAriaDescribedBy: on, + setAriaLabel: $n, + setAriaLabelledBy: Fs, + setAriaDescription: Ro, + setAriaDescribedBy: Wa, + setAriaLevel: Ks, + setAriaDisabled: vs, + setAriaExpanded: yo, + removeAriaExpanded: Gc, + setAriaSetSize: Pr, + setAriaPosInSet: _h, + setAriaMultiSelectable: Xu, + setAriaRowCount: Cu, + setAriaRowIndex: Bl, + setAriaColCount: bh, + setAriaColIndex: fd, + setAriaColSpan: pf, + setAriaSort: wh, + removeAriaSort: md, + setAriaSelected: yl, + setAriaChecked: Dc + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function co(M, f) { + return M.toString().padStart(f, "0"); + } + function xh(M, f) { + for (var d = [], g = M; g <= f; g++) + d.push(g); + return d; + } + function yu(M) { + return M !== "" && !isNaN(parseFloat(M)) && isFinite(M); + } + function Sh(M) { + return typeof M == "string" && (M = parseInt(M, 10)), typeof M == "number" ? Math.floor(M) : null; + } + function Ud(M, f) { + for (var d = "", g = 0; g < f; g++) + d += String.fromCharCode(M & 255), M >>>= 8; + return d; + } + function zg(M, f, d) { + return typeof M != "number" ? "" : Ot(Math.round(M * 100) / 100, f, d); + } + function Ot(M, f, d) { + return typeof M != "number" ? "" : M.toString().replace(".", d).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + f); + } + function Bi(M) { + return M == null ? null : M.reduce(function(f, d) { + return f + d; + }, 0); + } + var Mr = /* @__PURE__ */ Object.freeze({ + padStartWidthZeros: co, + createArrayOfNumbers: xh, + isNumeric: yu, + cleanNumber: Sh, + decToHex: Ud, + formatNumberTwoDecimalPlacesAndCommas: zg, + formatNumberCommas: Ot, + sum: Bi + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var zn = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }; + function xs(M, f, d) { + if (f === void 0 && (f = !0), d === void 0 && (d = "-"), !M) + return null; + var g = [M.getFullYear(), M.getMonth() + 1, M.getDate()].map(function(S) { + return co(S, 2); + }).join(d); + return f && (g += " " + [M.getHours(), M.getMinutes(), M.getSeconds()].map(function(S) { + return co(S, 2); + }).join(":")), g; + } + function Ss(M) { + if (!M) + return null; + var f = zn(M.split(" "), 2), d = f[0], g = f[1]; + if (!d) + return null; + var S = d.split("-").map(function(Ti) { + return parseInt(Ti, 10); + }); + if (S.filter(function(Ti) { + return !isNaN(Ti); + }).length !== 3) + return null; + var O = zn(S, 3), z = O[0], te = O[1], Fe = O[2], ze = new Date(z, te - 1, Fe); + if (ze.getFullYear() !== z || ze.getMonth() !== te - 1 || ze.getDate() !== Fe) + return null; + if (!g || g === "00:00:00") + return ze; + var ht = zn(g.split(":").map(function(Ti) { + return parseInt(Ti, 10); + }), 3), Lt = ht[0], ti = ht[1], wi = ht[2]; + return Lt >= 0 && Lt < 24 && ze.setHours(Lt), ti >= 0 && ti < 60 && ze.setMinutes(ti), wi >= 0 && wi < 60 && ze.setSeconds(wi), ze; + } + var da = /* @__PURE__ */ Object.freeze({ + serialiseDate: xs, + parseDateTimeFromString: Ss + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function qa(M, f, d) { + var g = {}, S = M.filter(function(O) { + return !f.some(function(z) { + return z === O; + }); + }); + return S.length > 0 && S.forEach(function(O) { + return g[O] = hg(O, d); + }), g; + } + function hg(M, f, d, g) { + var S = g ? kf : ff, O = f.map(function(z) { + return { + value: z, + relevance: S(M.toLowerCase(), z.toLocaleLowerCase()) + }; + }); + return O.sort(function(z, te) { + return te.relevance - z.relevance; + }), d && (O = O.filter(function(z) { + return z.relevance !== 0; + })), O.map(function(z) { + return z.value; + }); + } + function By(M) { + var f = M.toLowerCase(), d = new Array(f.length - 1), g, S, O; + for (g = S = 0, O = d.length; S <= O; g = S += 1) + d[g] = f.slice(g, g + 2); + return d; + } + function ff(M, f) { + if (M.length === 0 && f.length === 0) + return 0; + var d = By(M), g = By(f), S = d.length + g.length, O = 0, z, te; + for (z = 0, te = d.length; z < te; z++) { + var Fe = d[z], ze = void 0, ht = void 0; + for (ze = 0, ht = g.length; ze < ht; ze++) { + var Lt = g[ze]; + Fe === Lt && O++; + } + } + return O > 0 ? 2 * O / S : 0; + } + function kf(M, f) { + for (var d = M.replace(/\s/g, ""), g = f.replace(/\s/g, ""), S = 0, O = 0, z = 0; z < d.length; z++) { + var te = g.indexOf(d[z], O); + te !== -1 && (O = te, S += 100 - O * 100 / 1e4 * 100); + } + return S; + } + var up = /* @__PURE__ */ Object.freeze({ + fuzzyCheckStrings: qa, + fuzzySuggestions: hg, + get_bigrams: By, + string_distances: ff, + string_weighted_distances: kf + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var YI = { + // header column group shown when expanded (click to contract) + columnGroupOpened: "expanded", + // header column group shown when contracted (click to expand) + columnGroupClosed: "contracted", + // tool panel column group contracted (click to expand) + columnSelectClosed: "tree-closed", + // tool panel column group expanded (click to contract) + columnSelectOpen: "tree-open", + // column tool panel header expand/collapse all button, shown when some children are expanded and + // others are collapsed + columnSelectIndeterminate: "tree-indeterminate", + // shown on ghost icon while dragging column to the side of the grid to pin + columnMovePin: "pin", + // shown on ghost icon while dragging over part of the page that is not a drop zone + columnMoveHide: "eye-slash", + // shown on ghost icon while dragging columns to reorder + columnMoveMove: "arrows", + // animating icon shown when dragging a column to the right of the grid causes horizontal scrolling + columnMoveLeft: "left", + // animating icon shown when dragging a column to the left of the grid causes horizontal scrolling + columnMoveRight: "right", + // shown on ghost icon while dragging over Row Groups drop zone + columnMoveGroup: "group", + // shown on ghost icon while dragging over Values drop zone + columnMoveValue: "aggregation", + // shown on ghost icon while dragging over pivot drop zone + columnMovePivot: "pivot", + // shown on ghost icon while dragging over drop zone that doesn't support it, e.g. + // string column over aggregation drop zone + dropNotAllowed: "not-allowed", + // shown on row group when contracted (click to expand) + groupContracted: "tree-closed", + // shown on row group when expanded (click to contract) + groupExpanded: "tree-open", + // context menu chart item + chart: "chart", + // chart window title bar + close: "cross", + // X (remove) on column 'pill' after adding it to a drop zone list + cancel: "cancel", + // indicates the currently active pin state in the "Pin column" sub-menu of the column menu + check: "tick", + // "go to first" button in pagination controls + first: "first", + // "go to previous" button in pagination controls + previous: "previous", + // "go to next" button in pagination controls + next: "next", + // "go to last" button in pagination controls + last: "last", + // shown on top right of chart when chart is linked to range data (click to unlink) + linked: "linked", + // shown on top right of chart when chart is not linked to range data (click to link) + unlinked: "unlinked", + // "Choose colour" button on chart settings tab + colorPicker: "color-picker", + // rotating spinner shown by the loading cell renderer + groupLoading: "loading", + // button to launch enterprise column menu + menu: "menu", + // filter tool panel tab + filter: "filter", + // column tool panel tab + columns: "columns", + // button in chart regular size window title bar (click to maximise) + maximize: "maximize", + // button in chart maximised window title bar (click to make regular size) + minimize: "minimize", + // "Pin column" item in column header menu + menuPin: "pin", + // "Value aggregation" column menu item (shown on numeric columns when grouping is active)" + menuValue: "aggregation", + // "Group by {column-name}" item in column header menu + menuAddRowGroup: "group", + // "Un-Group by {column-name}" item in column header menu + menuRemoveRowGroup: "group", + // context menu copy item + clipboardCopy: "copy", + // context menu paste item + clipboardPaste: "paste", + // identifies the pivot drop zone + pivotPanel: "pivot", + // "Row groups" drop zone in column tool panel + rowGroupPanel: "group", + // columns tool panel Values drop zone + valuePanel: "aggregation", + // drag handle used to pick up draggable columns + columnDrag: "grip", + // drag handle used to pick up draggable rows + rowDrag: "grip", + // context menu export item + save: "save", + // csv export + csvExport: "csv", + // excel export, + excelExport: "excel", + // icon on dropdown editors + smallDown: "small-down", + // version of small-right used in RTL mode + smallLeft: "small-left", + // separater between column 'pills' when you add multiple columns to the header drop zone + smallRight: "small-right", + smallUp: "small-up", + // show on column header when column is sorted ascending + sortAscending: "asc", + // show on column header when column is sorted descending + sortDescending: "desc", + // show on column header when column has no sort, only when enabled with gridOptions.unSortIcon=true + sortUnSort: "none" + }; + function rt(M, f, d) { + var g = Xl(M, f, d); + if (g && g.className.indexOf("ag-icon") > -1) + return g; + var S = document.createElement("span"); + return S.appendChild(g), S; + } + function Xl(M, f, d, g) { + var S = null, O = d && d.getColDef().icons; + if (O && (S = O[M]), f && !S) { + var z = f.getIcons(); + z && (S = z[M]); + } + if (S) { + var te = void 0; + if (typeof S == "function") + te = S(); + else if (typeof S == "string") + te = S; + else + throw new Error("icon from grid options needs to be a string or a function"); + if (typeof te == "string") + return gu(te); + if (xt(te)) + return te; + console.warn("AG Grid: iconRenderer should return back a string or a dom object"); + } else { + var Fe = document.createElement("span"), ze = YI[M]; + return ze || (g ? ze = M : (console.warn("AG Grid: Did not find icon " + M), ze = "")), Fe.setAttribute("class", "ag-icon ag-icon-" + ze), Fe.setAttribute("unselectable", "on"), tr(Fe, "presentation"), Fe; + } + } + var Vy = /* @__PURE__ */ Object.freeze({ + iconNameClassMap: YI, + createIcon: rt, + createIconNoSpan: Xl + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var O1 = "Del", cr = 46; + function _s(M) { + if (M.altKey || M.ctrlKey || M.metaKey) + return !1; + var f = M.key.length === 1, d = A8(M); + return f || d; + } + function Hg(M, f, d, g, S) { + var O = M.getSuppressKeyboardEventFunc(), z = g ? g.getColDef().suppressKeyboardEvent : void 0; + if (!O && !z) + return !1; + var te = { + event: f, + editing: S, + column: g, + api: M.getApi(), + node: d, + data: d.data, + colDef: g.getColDef(), + context: M.getContext(), + columnApi: M.getColumnApi() + }; + if (z) { + var Fe = z(te); + if (Fe) + return !0; + } + return O ? O(te) : !1; + } + function nL(M, f, d, g) { + var S = g.getDefinition(), O = S && S.suppressHeaderKeyboardEvent; + if (!i(O)) + return !1; + var z = { + api: M.getApi(), + columnApi: M.getColumnApi(), + context: M.getContext(), + colDef: S, + column: g, + headerRowIndex: d, + event: f + }; + return !!O(z); + } + function A8(M) { + return Rc() && M.key === O1 && M.charCode === cr; + } + var D3 = /* @__PURE__ */ Object.freeze({ + isEventFromPrintableCharacter: _s, + isUserSuppressingKeyboardEvent: Hg, + isUserSuppressingHeaderKeyboardEvent: nL + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function xn(M, f, d) { + if (d === 0) + return !1; + var g = Math.abs(M.clientX - f.clientX), S = Math.abs(M.clientY - f.clientY); + return Math.max(g, S) <= d; + } + var P8 = /* @__PURE__ */ Object.freeze({ + areEventsNear: xn + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function XI(M, f) { + if (M) { + for (var d = function(te, Fe) { + var ze = f[te.id], ht = f[Fe.id], Lt = ze !== void 0, ti = ht !== void 0, wi = Lt && ti, Ti = !Lt && !ti; + return wi ? ze - ht : Ti ? te.__objectId - Fe.__objectId : Lt ? 1 : -1; + }, g, S, O = !1, z = 0; z < M.length - 1; z++) + if (g = M[z], S = M[z + 1], d(g, S) > 0) { + O = !0; + break; + } + O && M.sort(d); + } + } + function Yx(M, f) { + var d = []; + g(M); + function g(S) { + S && S.forEach(function(O) { + if (O.group || O.hasChildren()) { + d.push(O.key); + var z = d.join("|"); + f(O, z), g(O.childrenAfterGroup), d.pop(); + } + }); + } + } + var ch = /* @__PURE__ */ Object.freeze({ + sortRowNodesByOrder: XI, + traverseNodesWithKey: Yx + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function mC(M) { + var f = /* @__PURE__ */ new Set(); + return M.forEach(function(d) { + return f.add(d); + }), f; + } + var KI = /* @__PURE__ */ Object.freeze({ + convertToSet: mC + }); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Ch = function() { + return Ch = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, Ch.apply(this, arguments); + }, sL = Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch(Ch({}, yi), Vl), qe), lg), di), da), We), On), at), up), v), Vy), D3), ra), P8), Mr), xe), ch), KI), ln), ho = sL; + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Hv = ( + /** @class */ + function() { + function M(f, d) { + f === void 0 && (f = 0), d === void 0 && (d = 1), this.nextValue = f, this.step = d; + } + return M.prototype.next = function() { + var f = this.nextValue; + return this.nextValue += this.step, f; + }, M.prototype.peek = function() { + return this.nextValue; + }, M.prototype.skip = function(f) { + this.nextValue += f; + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M[M.IN_PROGRESS = 0] = "IN_PROGRESS", M[M.RESOLVED = 1] = "RESOLVED"; + })(t.AgPromiseStatus || (t.AgPromiseStatus = {})); + var Pm = ( + /** @class */ + function() { + function M(f) { + var d = this; + this.status = t.AgPromiseStatus.IN_PROGRESS, this.resolution = null, this.waiters = [], f(function(g) { + return d.onDone(g); + }, function(g) { + return d.onReject(g); + }); + } + return M.all = function(f) { + return new M(function(d) { + var g = f.length, S = new Array(g); + f.forEach(function(O, z) { + O.then(function(te) { + S[z] = te, g--, g === 0 && d(S); + }); + }); + }); + }, M.resolve = function(f) { + return f === void 0 && (f = null), new M(function(d) { + return d(f); + }); + }, M.prototype.then = function(f) { + var d = this; + return new M(function(g) { + d.status === t.AgPromiseStatus.RESOLVED ? g(f(d.resolution)) : d.waiters.push(function(S) { + return g(f(S)); + }); + }); + }, M.prototype.resolveNow = function(f, d) { + return this.status === t.AgPromiseStatus.RESOLVED ? d(this.resolution) : f; + }, M.prototype.onDone = function(f) { + this.status = t.AgPromiseStatus.RESOLVED, this.resolution = f, this.waiters.forEach(function(d) { + return d(f); + }); + }, M.prototype.onReject = function(f) { + console.warn("TBI"); + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var F3 = ( + /** @class */ + function() { + function M() { + this.timestamp = (/* @__PURE__ */ new Date()).getTime(); + } + return M.prototype.print = function(f) { + var d = (/* @__PURE__ */ new Date()).getTime() - this.timestamp; + console.info(f + " = " + d), this.timestamp = (/* @__PURE__ */ new Date()).getTime(); + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var oL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), gC = function() { + return gC = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, gC.apply(this, arguments); + }, yC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, jy; + (function(M) { + M[M.NOTHING = 0] = "NOTHING", M[M.WAITING_TO_SHOW = 1] = "WAITING_TO_SHOW", M[M.SHOWING = 2] = "SHOWING"; + })(jy || (jy = {})); + var Wg = ( + /** @class */ + function(M) { + oL(f, M); + function f(d) { + var g = M.call(this) || this; + return g.DEFAULT_SHOW_TOOLTIP_DELAY = 2e3, g.DEFAULT_HIDE_TOOLTIP_DELAY = 1e4, g.SHOW_QUICK_TOOLTIP_DIFF = 1e3, g.FADE_OUT_TOOLTIP_TIMEOUT = 1e3, g.state = jy.NOTHING, g.tooltipInstanceCount = 0, g.tooltipMouseTrack = !1, g.parentComp = d, g; + } + return f.prototype.postConstruct = function() { + this.tooltipShowDelay = this.gridOptionsWrapper.getTooltipDelay("show") || this.DEFAULT_SHOW_TOOLTIP_DELAY, this.tooltipHideDelay = this.gridOptionsWrapper.getTooltipDelay("hide") || this.DEFAULT_HIDE_TOOLTIP_DELAY, this.tooltipMouseTrack = this.gridOptionsWrapper.isTooltipMouseTrack(); + var d = this.parentComp.getGui(); + this.addManagedListener(d, "mouseenter", this.onMouseEnter.bind(this)), this.addManagedListener(d, "mouseleave", this.onMouseLeave.bind(this)), this.addManagedListener(d, "mousemove", this.onMouseMove.bind(this)), this.addManagedListener(d, "mousedown", this.onMouseDown.bind(this)), this.addManagedListener(d, "keydown", this.onKeyDown.bind(this)); + }, f.prototype.destroy = function() { + this.setToDoNothing(), M.prototype.destroy.call(this); + }, f.prototype.onMouseEnter = function(d) { + if (!jh() && this.state == jy.NOTHING) { + var g = this.isLastTooltipHiddenRecently() ? 200 : this.tooltipShowDelay; + this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), g), this.lastMouseEvent = d, this.state = jy.WAITING_TO_SHOW; + } + }, f.prototype.onMouseLeave = function() { + this.setToDoNothing(); + }, f.prototype.onKeyDown = function() { + this.setToDoNothing(); + }, f.prototype.setToDoNothing = function() { + this.state === jy.SHOWING && this.hideTooltip(), this.clearTimeouts(), this.state = jy.NOTHING; + }, f.prototype.onMouseMove = function(d) { + this.lastMouseEvent = d, this.tooltipMouseTrack && this.state === jy.SHOWING && this.tooltipComp && this.positionTooltipUnderLastMouseEvent(); + }, f.prototype.onMouseDown = function() { + this.setToDoNothing(); + }, f.prototype.hideTooltip = function() { + this.tooltipComp && (this.destroyTooltipComp(), f.lastTooltipHideTime = (/* @__PURE__ */ new Date()).getTime()), this.state = jy.NOTHING; + }, f.prototype.destroyTooltipComp = function() { + var d = this; + this.tooltipComp.getGui().classList.add("ag-tooltip-hiding"); + var g = this.tooltipPopupDestroyFunc, S = this.tooltipComp; + window.setTimeout(function() { + g(), d.getContext().destroyBean(S); + }, this.FADE_OUT_TOOLTIP_TIMEOUT), this.tooltipPopupDestroyFunc = void 0, this.tooltipComp = void 0; + }, f.prototype.isLastTooltipHiddenRecently = function() { + var d = (/* @__PURE__ */ new Date()).getTime(), g = f.lastTooltipHideTime; + return d - g < this.SHOW_QUICK_TOOLTIP_DIFF; + }, f.prototype.showTooltip = function() { + var d = gC({}, this.parentComp.getTooltipParams()); + if (!i(d.value)) { + this.setToDoNothing(); + return; + } + this.state = jy.SHOWING, this.tooltipInstanceCount++; + var g = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount), S = this.userComponentFactory.getTooltipCompDetails(d); + S.newAgStackInstance().then(g); + }, f.prototype.newTooltipComponentCallback = function(d, g) { + var S = this.state !== jy.SHOWING || this.tooltipInstanceCount !== d; + if (S) { + this.getContext().destroyBean(g); + return; + } + var O = g.getGui(); + this.tooltipComp = g, O.classList.contains("ag-tooltip") || O.classList.add("ag-tooltip-custom"); + var z = this.gridOptionsWrapper.getLocaleTextFunc(), te = this.popupService.addPopup({ + eChild: O, + ariaLabel: z("ariaLabelTooltip", "Tooltip") + }); + te && (this.tooltipPopupDestroyFunc = te.hideFunc), this.positionTooltipUnderLastMouseEvent(), this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.tooltipHideDelay); + }, f.prototype.positionTooltipUnderLastMouseEvent = function() { + this.popupService.positionPopupUnderMouseEvent({ + type: "tooltip", + mouseEvent: this.lastMouseEvent, + ePopup: this.tooltipComp.getGui(), + nudgeY: 18 + }); + }, f.prototype.clearTimeouts = function() { + this.showTooltipTimeoutId && (window.clearTimeout(this.showTooltipTimeoutId), this.showTooltipTimeoutId = void 0), this.hideTooltipTimeoutId && (window.clearTimeout(this.hideTooltipTimeoutId), this.hideTooltipTimeoutId = void 0); + }, yC([ + pe("popupService") + ], f.prototype, "popupService", void 0), yC([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), yC([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), yC([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), yC([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var L3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), vC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, N3 = new Hv(), W0 = ( + /** @class */ + function() { + function M(f) { + this.cssClassStates = {}, this.getGui = f; + } + return M.prototype.addCssClass = function(f) { + var d = this, g = (f || "").split(" "); + if (g.length > 1) { + g.forEach(function(O) { + return d.addCssClass(O); + }); + return; + } + var S = this.cssClassStates[f] !== !0; + S && f.length && (this.getGui().classList.add(f), this.cssClassStates[f] = !0); + }, M.prototype.removeCssClass = function(f) { + var d = this, g = (f || "").split(" "); + if (g.length > 1) { + g.forEach(function(O) { + return d.removeCssClass(O); + }); + return; + } + var S = this.cssClassStates[f] !== !1; + S && f.length && (this.getGui().classList.remove(f), this.cssClassStates[f] = !1); + }, M.prototype.containsCssClass = function(f) { + return this.getGui().classList.contains(f); + }, M.prototype.addOrRemoveCssClass = function(f, d) { + var g = this, S = (f || "").split(" "); + if (S.length > 1) { + S.forEach(function(z) { + return g.addOrRemoveCssClass(z, d); + }); + return; + } + var O = this.cssClassStates[f] !== d; + O && f.length && (this.getGui().classList.toggle(f, d), this.cssClassStates[f] = d); + }, M; + }() + ), ba = ( + /** @class */ + function(M) { + L3(f, M); + function f(d) { + var g = M.call(this) || this; + return g.displayed = !0, g.visible = !0, g.compId = N3.next(), g.cssClassManager = new W0(function() { + return g.eGui; + }), d && g.setTemplate(d), g; + } + return f.prototype.preConstructOnComponent = function() { + this.usingBrowserTooltips = this.gridOptionsWrapper.isEnableBrowserTooltips(); + }, f.prototype.getCompId = function() { + return this.compId; + }, f.prototype.getTooltipParams = function() { + return { + value: this.tooltipText, + location: "UNKNOWN" + }; + }, f.prototype.setTooltip = function(d) { + var g = this, S = function() { + g.usingBrowserTooltips ? g.getGui().removeAttribute("title") : g.tooltipFeature = g.destroyBean(g.tooltipFeature); + }, O = function() { + g.usingBrowserTooltips ? g.getGui().setAttribute("title", g.tooltipText) : g.tooltipFeature = g.createBean(new Wg(g)); + }; + this.tooltipText != d && (this.tooltipText && S(), d != null && (this.tooltipText = d, this.tooltipText && O())); + }, f.prototype.createChildComponentsFromTags = function(d, g) { + var S = this, O = oe(d.childNodes); + O.forEach(function(z) { + if (z instanceof HTMLElement) { + var te = S.createComponentFromElement(z, function(ze) { + var ht = ze.getGui(); + ht && S.copyAttributesFromNode(z, ze.getGui()); + }, g); + if (te) { + if (te.addItems && z.children.length) { + S.createChildComponentsFromTags(z, g); + var Fe = Array.prototype.slice.call(z.children); + te.addItems(Fe); + } + S.swapComponentForNode(te, d, z); + } else + z.childNodes && S.createChildComponentsFromTags(z, g); + } + }); + }, f.prototype.createComponentFromElement = function(d, g, S) { + var O = d.nodeName, z = S ? S[d.getAttribute("ref")] : void 0, te = this.agStackComponentsRegistry.getComponentClass(O); + if (te) { + f.elementGettingCreated = d; + var Fe = new te(z); + return Fe.setParentComponent(this), this.createBean(Fe, null, g), Fe; + } + return null; + }, f.prototype.copyAttributesFromNode = function(d, g) { + ee(d.attributes, function(S, O) { + return g.setAttribute(S, O); + }); + }, f.prototype.swapComponentForNode = function(d, g, S) { + var O = d.getGui(); + g.replaceChild(O, S), g.insertBefore(document.createComment(S.nodeName), O), this.addDestroyFunc(this.destroyBean.bind(this, d)), this.swapInComponentForQuerySelectors(d, S); + }, f.prototype.swapInComponentForQuerySelectors = function(d, g) { + var S = this; + this.iterateOverQuerySelectors(function(O) { + S[O.attributeName] === g && (S[O.attributeName] = d); + }); + }, f.prototype.iterateOverQuerySelectors = function(d) { + for (var g = Object.getPrototypeOf(this); g != null; ) { + var S = g.__agComponentMetaData, O = je(g.constructor); + S && S[O] && S[O].querySelectors && S[O].querySelectors.forEach(function(z) { + return d(z); + }), g = Object.getPrototypeOf(g); + } + }, f.prototype.setTemplate = function(d, g) { + var S = gu(d); + this.setTemplateFromElement(S, g); + }, f.prototype.setTemplateFromElement = function(d, g) { + this.eGui = d, this.eGui.__agComponent = this, this.wireQuerySelectors(), this.getContext() && this.createChildComponentsFromTags(this.getGui(), g); + }, f.prototype.createChildComponentsPreConstruct = function() { + this.getGui() && this.createChildComponentsFromTags(this.getGui()); + }, f.prototype.wireQuerySelectors = function() { + var d = this; + if (this.eGui) { + var g = this; + this.iterateOverQuerySelectors(function(S) { + var O = function(Fe) { + return g[S.attributeName] = Fe; + }, z = S.refSelector && d.eGui.getAttribute("ref") === S.refSelector; + if (z) + O(d.eGui); + else { + var te = d.eGui.querySelector(S.querySelector); + te && O(te.__agComponent || te); + } + }); + } + }, f.prototype.getGui = function() { + return this.eGui; + }, f.prototype.getFocusableElement = function() { + return this.eGui; + }, f.prototype.setParentComponent = function(d) { + this.parentComponent = d; + }, f.prototype.getParentComponent = function() { + return this.parentComponent; + }, f.prototype.setGui = function(d) { + this.eGui = d; + }, f.prototype.queryForHtmlElement = function(d) { + return this.eGui.querySelector(d); + }, f.prototype.queryForHtmlInputElement = function(d) { + return this.eGui.querySelector(d); + }, f.prototype.appendChild = function(d, g) { + if (g || (g = this.eGui), d != null) + if (xt(d)) + g.appendChild(d); + else { + var S = d; + g.appendChild(S.getGui()), this.addDestroyFunc(this.destroyBean.bind(this, S)); + } + }, f.prototype.isDisplayed = function() { + return this.displayed; + }, f.prototype.setVisible = function(d) { + d !== this.visible && (this.visible = d, Dp(this.eGui, d)); + }, f.prototype.setDisplayed = function(d) { + if (d !== this.displayed) { + this.displayed = d, al(this.eGui, d); + var g = { + type: f.EVENT_DISPLAYED_CHANGED, + visible: this.displayed + }; + this.dispatchEvent(g); + } + }, f.prototype.destroy = function() { + this.tooltipFeature && (this.tooltipFeature = this.destroyBean(this.tooltipFeature)), M.prototype.destroy.call(this); + }, f.prototype.addGuiEventListener = function(d, g) { + var S = this; + this.eGui.addEventListener(d, g), this.addDestroyFunc(function() { + return S.eGui.removeEventListener(d, g); + }); + }, f.prototype.addCssClass = function(d) { + this.cssClassManager.addCssClass(d); + }, f.prototype.removeCssClass = function(d) { + this.cssClassManager.removeCssClass(d); + }, f.prototype.containsCssClass = function(d) { + return this.cssClassManager.containsCssClass(d); + }, f.prototype.addOrRemoveCssClass = function(d, g) { + this.cssClassManager.addOrRemoveCssClass(d, g); + }, f.prototype.getAttribute = function(d) { + var g = this.eGui; + return g ? g.getAttribute(d) : null; + }, f.prototype.getRefElement = function(d) { + return this.queryForHtmlElement('[ref="' + d + '"]'); + }, f.EVENT_DISPLAYED_CHANGED = "displayedChanged", vC([ + pe("agStackComponentsRegistry") + ], f.prototype, "agStackComponentsRegistry", void 0), vC([ + le + ], f.prototype, "preConstructOnComponent", null), vC([ + le + ], f.prototype, "createChildComponentsPreConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + function O8(M) { + return k3.bind(this, M, void 0); + } + function qr(M) { + return k3.bind(this, "[ref=" + M + "]", M); + } + function k3(M, f, d, g, S) { + if (M === null) { + console.error("AG Grid: QuerySelector selector should not be null"); + return; + } + if (typeof S == "number") { + console.error("AG Grid: QuerySelector should be on an attribute"); + return; + } + _C(d, "querySelectors", { + attributeName: g, + querySelector: M, + refSelector: f + }); + } + function _C(M, f, d) { + var g = pa(M, je(M.constructor)); + g[f] || (g[f] = []), g[f].push(d); + } + function pa(M, f) { + return M.__agComponentMetaData || (M.__agComponentMetaData = {}), M.__agComponentMetaData[f] || (M.__agComponentMetaData[f] = {}), M.__agComponentMetaData[f]; + } + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var bC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), JI = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ZI = ( + /** @class */ + function(M) { + bC(f, M); + function f() { + return M.call( + this, + /* html */ + ` + ` + ) || this; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.init = function(d) { + this.params = d; + var g = this.columnModel.getDisplayNameForColumn(d.column, "header", !0), S = this.gridOptionsWrapper.getLocaleTextFunc(); + this.eFloatingFilterText.setDisabled(!0).setInputAriaLabel(g + " " + S("ariaFilterInput", "Filter Input")); + }, f.prototype.onParentModelChanged = function(d) { + var g = this; + if (!d) { + this.eFloatingFilterText.setValue(""); + return; + } + this.params.parentFilterInstance(function(S) { + if (S.getModelAsString) { + var O = S.getModelAsString(d); + g.eFloatingFilterText.setValue(O); + } + }); + }, JI([ + qr("eFloatingFilterText") + ], f.prototype, "eFloatingFilterText", void 0), JI([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var QI = ( + /** @class */ + function() { + function M(f, d, g, S) { + var O = this; + this.alive = !0, this.context = f, this.eParent = S; + var z = d.getDateCompDetails(g), te = z.newAgStackInstance(); + te.then(function(Fe) { + if (!O.alive) { + f.destroyBean(Fe); + return; + } + O.dateComp = Fe, Fe && (S.appendChild(Fe.getGui()), Fe.afterGuiAttached && Fe.afterGuiAttached(), O.tempValue && Fe.setDate(O.tempValue), O.disabled != null && O.setDateCompDisabled(O.disabled)); + }); + } + return M.prototype.destroy = function() { + this.alive = !1, this.dateComp = this.context.destroyBean(this.dateComp); + }, M.prototype.getDate = function() { + return this.dateComp ? this.dateComp.getDate() : this.tempValue; + }, M.prototype.setDate = function(f) { + this.dateComp ? this.dateComp.setDate(f) : this.tempValue = f; + }, M.prototype.setDisabled = function(f) { + this.dateComp ? this.setDateCompDisabled(f) : this.disabled = f; + }, M.prototype.setDisplayed = function(f) { + al(this.eParent, f); + }, M.prototype.setInputPlaceholder = function(f) { + this.dateComp && this.dateComp.setInputPlaceholder && this.dateComp.setInputPlaceholder(f); + }, M.prototype.setInputAriaLabel = function(f) { + this.dateComp && this.dateComp.setInputAriaLabel && this.dateComp.setInputAriaLabel(f); + }, M.prototype.afterGuiAttached = function(f) { + this.dateComp && typeof this.dateComp.afterGuiAttached == "function" && this.dateComp.afterGuiAttached(f); + }, M.prototype.setDateCompDisabled = function(f) { + this.dateComp != null && this.dateComp.setDisabled != null && this.dateComp.setDisabled(f); + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $3 = function() { + return $3 = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, $3.apply(this, arguments); + }, aL = ( + /** @class */ + function() { + function M() { + this.customFilterOptions = {}; + } + return M.prototype.init = function(f, d) { + this.filterOptions = f.filterOptions || d, this.mapCustomOptions(), this.selectDefaultItem(f), this.checkForDeprecatedParams(); + }, M.prototype.checkForDeprecatedParams = function() { + this.filterOptions.some(function(f) { + return typeof f != "string" && f.test != null; + }) && console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, test() has been replaced with predicate()."), this.filterOptions.some(function(f) { + return typeof f != "string" && f.hideFilterInput != null; + }) && console.warn("AG Grid: [IFilterOptionDef] since v26.2.0, useOfHideFilterInput has been replaced with numberOfInputs."); + }, M.prototype.getFilterOptions = function() { + return this.filterOptions; + }, M.prototype.mapCustomOptions = function() { + var f = this; + this.filterOptions && this.filterOptions.forEach(function(d) { + if (typeof d != "string") { + var g = [["displayKey"], ["displayName"], ["predicate", "test"]], S = function(te) { + return te.some(function(Fe) { + return d[Fe] != null; + }) ? !0 : (console.warn("AG Grid: ignoring FilterOptionDef as it doesn't contain one of '" + te + "'"), !1); + }; + if (!g.every(S)) { + f.filterOptions = f.filterOptions.filter(function(te) { + return te === d; + }) || []; + return; + } + var O = d.test, z = $3({}, d); + O != null && d.predicate == null && (z.predicate = function(te, Fe) { + return O(te[0], Fe); + }, delete z.test), z.hideFilterInput && z.numberOfInputs == null && (z.numberOfInputs = 0, delete z.hideFilterInput), f.customFilterOptions[d.displayKey] = z; + } + }); + }, M.prototype.selectDefaultItem = function(f) { + if (f.defaultOption) + this.defaultOption = f.defaultOption; + else if (this.filterOptions.length >= 1) { + var d = this.filterOptions[0]; + typeof d == "string" ? this.defaultOption = d : d.displayKey ? this.defaultOption = d.displayKey : console.warn("AG Grid: invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'"); + } else + console.warn("AG Grid: no filter options for filter"); + }, M.prototype.getDefaultOption = function() { + return this.defaultOption; + }, M.prototype.getCustomOption = function(f) { + return this.customFilterOptions[f]; + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var R8 = { + applyFilter: "Apply", + clearFilter: "Clear", + resetFilter: "Reset", + cancelFilter: "Cancel", + textFilter: "Text Filter", + numberFilter: "Number Filter", + dateFilter: "Date Filter", + setFilter: "Set Filter", + filterOoo: "Filter...", + empty: "Choose One", + equals: "Equals", + notEqual: "Not equal", + lessThan: "Less than", + greaterThan: "Greater than", + inRange: "In range", + inRangeStart: "From", + inRangeEnd: "To", + lessThanOrEqual: "Less than or equals", + greaterThanOrEqual: "Greater than or equals", + contains: "Contains", + notContains: "Not contains", + startsWith: "Starts with", + endsWith: "Ends with", + blank: "Blank", + notBlank: "Not blank", + andCondition: "AND", + orCondition: "OR", + dateFormatOoo: "yyyy-mm-dd" + }; + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Hr = ( + /** @class */ + function() { + function M() { + } + return M.BACKSPACE = "Backspace", M.TAB = "Tab", M.ENTER = "Enter", M.ESCAPE = "Escape", M.SPACE = " ", M.LEFT = "ArrowLeft", M.UP = "ArrowUp", M.RIGHT = "ArrowRight", M.DOWN = "ArrowDown", M.DELETE = "Delete", M.F2 = "F2", M.PAGE_UP = "PageUp", M.PAGE_DOWN = "PageDown", M.PAGE_HOME = "Home", M.PAGE_END = "End", M.A = "KeyA", M.C = "KeyC", M.V = "KeyV", M.D = "KeyD", M.Z = "KeyZ", M.Y = "KeyY", M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var M8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), B3 = function() { + return B3 = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, B3.apply(this, arguments); + }, zd = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, R1 = ( + /** @class */ + function(M) { + M8(f, M); + function f(d, g) { + g === void 0 && (g = {}); + var S = M.call(this) || this; + return S.eFocusableElement = d, S.callbacks = g, S.callbacks = B3({ shouldStopEventPropagation: function() { + return !1; + }, onTabKeyDown: function(O) { + if (!O.defaultPrevented) { + var z = S.focusService.findNextFocusableElement(S.eFocusableElement, !1, O.shiftKey); + z && (z.focus(), O.preventDefault()); + } + } }, g), S; + } + return f.prototype.postConstruct = function() { + this.eFocusableElement.classList.add(f.FOCUS_MANAGED_CLASS), this.addKeyDownListeners(this.eFocusableElement), this.callbacks.onFocusIn && this.addManagedListener(this.eFocusableElement, "focusin", this.callbacks.onFocusIn), this.callbacks.onFocusOut && this.addManagedListener(this.eFocusableElement, "focusout", this.callbacks.onFocusOut); + }, f.prototype.addKeyDownListeners = function(d) { + var g = this; + this.addManagedListener(d, "keydown", function(S) { + if (!(S.defaultPrevented || Yi(S))) { + if (g.callbacks.shouldStopEventPropagation(S)) { + Ri(S); + return; + } + S.key === Hr.TAB ? g.callbacks.onTabKeyDown(S) : g.callbacks.handleKeyDown && g.callbacks.handleKeyDown(S); + } + }); + }, f.FOCUS_MANAGED_CLASS = "ag-focus-managed", zd([ + pe("focusService") + ], f.prototype, "focusService", void 0), zd([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var D8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), lL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, wC = ( + /** @class */ + function(M) { + D8(f, M); + function f(d) { + var g = M.call(this) || this; + return g.filterNameKey = d, g.applyActive = !1, g.hidePopup = null, g.appliedModel = null, g; + } + return f.prototype.postConstruct = function() { + this.resetTemplate(), this.createManagedBean(new R1(this.getFocusableElement(), { + handleKeyDown: this.handleKeyDown.bind(this) + })); + }, f.prototype.handleKeyDown = function(d) { + }, f.prototype.getFilterTitle = function() { + return this.translate(this.filterNameKey); + }, f.prototype.isFilterActive = function() { + return !!this.appliedModel; + }, f.prototype.resetTemplate = function(d) { + var g = ( + /* html */ + ` +
+
+ ` + this.createBodyTemplate() + ` +
+
` + ); + this.setTemplate(g, d); + }, f.prototype.isReadOnly = function() { + return !!this.providedFilterParams.readOnly; + }, f.prototype.init = function(d) { + var g = this; + this.setParams(d), this.resetUiToDefaults(!0).then(function() { + g.updateUiVisibility(), g.setupOnBtApplyDebounce(); + }); + }, f.prototype.setParams = function(d) { + this.providedFilterParams = d, this.applyActive = f.isUseApplyButton(d), this.createButtonPanel(); + }, f.prototype.createButtonPanel = function() { + var d = this, g = this.providedFilterParams.buttons; + if (!(!g || g.length < 1 || this.isReadOnly())) { + var S = document.createElement("div"); + S.classList.add("ag-filter-apply-panel"); + var O = function(z) { + var te, Fe; + switch (z) { + case "apply": + te = d.translate("applyFilter"), Fe = function(ht) { + return d.onBtApply(!1, !1, ht); + }; + break; + case "clear": + te = d.translate("clearFilter"), Fe = function() { + return d.onBtClear(); + }; + break; + case "reset": + te = d.translate("resetFilter"), Fe = function() { + return d.onBtReset(); + }; + break; + case "cancel": + te = d.translate("cancelFilter"), Fe = function(ht) { + d.onBtCancel(ht); + }; + break; + default: + console.warn("AG Grid: Unknown button type specified"); + return; + } + var ze = gu( + /* html */ + `` + ); + S.appendChild(ze), d.addManagedListener(ze, "click", Fe); + }; + mC(g).forEach(function(z) { + return O(z); + }), this.getGui().appendChild(S); + } + }, f.prototype.getDefaultDebounceMs = function() { + return 0; + }, f.prototype.setupOnBtApplyDebounce = function() { + var d = f.getDebounceMs(this.providedFilterParams, this.getDefaultDebounceMs()); + this.onBtApplyDebounce = It(this.onBtApply.bind(this), d); + }, f.prototype.getModel = function() { + return this.appliedModel ? this.appliedModel : null; + }, f.prototype.setModel = function(d) { + var g = this, S = d != null ? this.setModelIntoUi(d) : this.resetUiToDefaults(); + return S.then(function() { + g.updateUiVisibility(), g.applyModel(); + }); + }, f.prototype.onBtCancel = function(d) { + var g = this, S = this.getModel(), O = function() { + g.onUiChanged(!1, "prevent"), g.providedFilterParams.closeOnApply && g.close(d); + }; + S != null ? this.setModelIntoUi(S).then(O) : this.resetUiToDefaults().then(O); + }, f.prototype.onBtClear = function() { + var d = this; + this.resetUiToDefaults().then(function() { + return d.onUiChanged(); + }); + }, f.prototype.onBtReset = function() { + this.onBtClear(), this.onBtApply(); + }, f.prototype.applyModel = function() { + var d = this.getModelFromUi(); + if (!this.isModelValid(d)) + return !1; + var g = this.appliedModel; + return this.appliedModel = d, !this.areModelsEqual(g, d); + }, f.prototype.isModelValid = function(d) { + return !0; + }, f.prototype.onBtApply = function(d, g, S) { + d === void 0 && (d = !1), g === void 0 && (g = !1), this.applyModel() && this.providedFilterParams.filterChangedCallback({ afterFloatingFilter: d, afterDataChange: g }); + var O = this.providedFilterParams.closeOnApply; + O && this.applyActive && !d && !g && this.close(S); + }, f.prototype.onNewRowsLoaded = function() { + }, f.prototype.close = function(d) { + if (this.hidePopup) { + var g = d, S = g && g.key, O; + (S === "Enter" || S === "Space") && (O = { keyboardEvent: g }), this.hidePopup(O), this.hidePopup = null; + } + }, f.prototype.onUiChanged = function(d, g) { + if (d === void 0 && (d = !1), this.updateUiVisibility(), this.providedFilterParams.filterModifiedCallback(), this.applyActive && !this.isReadOnly) { + var S = this.isModelValid(this.getModelFromUi()); + uh(this.getRefElement("applyFilterButton"), !S); + } + d && !g || g === "immediately" ? this.onBtApply(d) : (!this.applyActive && !g || g === "debounce") && this.onBtApplyDebounce(); + }, f.prototype.afterGuiAttached = function(d) { + d != null && (this.hidePopup = d.hidePopup); + }, f.getDebounceMs = function(d, g) { + return f.isUseApplyButton(d) ? (d.debounceMs != null && console.warn("AG Grid: debounceMs is ignored when apply button is present"), 0) : d.debounceMs != null ? d.debounceMs : g; + }, f.isUseApplyButton = function(d) { + return !!d.buttons && d.buttons.indexOf("apply") >= 0; + }, f.prototype.destroy = function() { + this.hidePopup = null, M.prototype.destroy.call(this); + }, f.prototype.translate = function(d) { + var g = this.gridOptionsWrapper.getLocaleTextFunc(); + return g(d, R8[d]); + }, f.prototype.getCellValue = function(d) { + var g = this.providedFilterParams, S = g.api, O = g.colDef, z = g.column, te = g.columnApi, Fe = g.context; + return this.providedFilterParams.valueGetter({ + api: S, + colDef: O, + column: z, + columnApi: te, + context: Fe, + data: d.data, + getValue: function(ze) { + return d.data[ze]; + }, + node: d + }); + }, lL([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), lL([ + pe("valueService") + ], f.prototype, "valueService", void 0), lL([ + ct + ], f.prototype, "postConstruct", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var F8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), uL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Wb = ( + /** @class */ + function(M) { + F8(f, M); + function f(d, g) { + var S = M.call(this, g) || this; + return S.labelSeparator = "", S.labelAlignment = "left", S.label = "", S.config = d || {}, S; + } + return f.prototype.postConstruct = function() { + this.addCssClass("ag-labeled"), this.eLabel.classList.add("ag-label"); + var d = this.config, g = d.labelSeparator, S = d.label, O = d.labelWidth, z = d.labelAlignment; + g != null && this.setLabelSeparator(g), S != null && this.setLabel(S), O != null && this.setLabelWidth(O), this.setLabelAlignment(z || this.labelAlignment), this.refreshLabel(); + }, f.prototype.refreshLabel = function() { + Su(this.eLabel), typeof this.label == "string" ? this.eLabel.innerText = this.label + this.labelSeparator : this.label && this.eLabel.appendChild(this.label), this.label === "" ? (this.eLabel.classList.add("ag-hidden"), tr(this.eLabel, "presentation")) : (this.eLabel.classList.remove("ag-hidden"), tr(this.eLabel, null)); + }, f.prototype.setLabelSeparator = function(d) { + return this.labelSeparator === d ? this : (this.labelSeparator = d, this.label != null && this.refreshLabel(), this); + }, f.prototype.getLabelId = function() { + return this.eLabel.id = this.eLabel.id || "ag-" + this.getCompId() + "-label", this.eLabel.id; + }, f.prototype.getLabel = function() { + return this.label; + }, f.prototype.setLabel = function(d) { + return this.label === d ? this : (this.label = d, this.refreshLabel(), this); + }, f.prototype.setLabelAlignment = function(d) { + var g = this.getGui(), S = g.classList; + return S.toggle("ag-label-align-left", d === "left"), S.toggle("ag-label-align-right", d === "right"), S.toggle("ag-label-align-top", d === "top"), this; + }, f.prototype.setLabelWidth = function(d) { + return this.label == null ? this : (zt(this.eLabel, d), this); + }, uL([ + ct + ], f.prototype, "postConstruct", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $f = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), mf = ( + /** @class */ + function(M) { + $f(f, M); + function f(d, g, S) { + var O = M.call(this, d, g) || this; + return O.className = S, O.disabled = !1, O; + } + return f.prototype.postConstruct = function() { + M.prototype.postConstruct.call(this), this.className && this.addCssClass(this.className); + }, f.prototype.onValueChange = function(d) { + var g = this; + return this.addManagedListener(this, f.EVENT_CHANGED, function() { + return d(g.getValue()); + }), this; + }, f.prototype.getWidth = function() { + return this.getGui().clientWidth; + }, f.prototype.setWidth = function(d) { + return Wt(this.getGui(), d), this; + }, f.prototype.getPreviousValue = function() { + return this.previousValue; + }, f.prototype.getValue = function() { + return this.value; + }, f.prototype.setValue = function(d, g) { + return this.value === d ? this : (this.previousValue = this.value, this.value = d, g || this.dispatchEvent({ type: f.EVENT_CHANGED }), this); + }, f.prototype.setDisabled = function(d) { + d = !!d; + var g = this.getGui(); + return uh(g, d), g.classList.toggle("ag-disabled", d), this.disabled = d, this; + }, f.prototype.isDisabled = function() { + return !!this.disabled; + }, f.EVENT_CHANGED = "valueChange", f; + }(Wb) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var eA = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), xC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Uc = ( + /** @class */ + function(M) { + eA(f, M); + function f(d, g, S, O) { + var z = M.call( + this, + d, + /* html */ + ``, + g + ) || this; + return z.pickerIcon = S, z.isPickerDisplayed = !1, z.isDestroyingPicker = !1, z.skipClick = !1, z; + } + return f.prototype.postConstruct = function() { + var d = this; + M.prototype.postConstruct.call(this); + var g = this.getCompId() + "-display"; + this.eDisplayField.setAttribute("id", g), Wa(this.eWrapper, g); + var S = function() { + if (d.skipClick) { + d.skipClick = !1; + return; + } + d.isDisabled() || (d.pickerComponent = d.showPicker()); + }, O = this.getGui(); + if (this.addManagedListener(O, "mousedown", function(te) { + !d.skipClick && d.pickerComponent && d.pickerComponent.isAlive() && jc(d.pickerComponent.getGui()) && O.contains(te.target) && (d.skipClick = !0); + }), this.addManagedListener(O, "keydown", function(te) { + switch (te.key) { + case Hr.UP: + case Hr.DOWN: + case Hr.ENTER: + case Hr.SPACE: + S(); + case Hr.ESCAPE: + d.isPickerDisplayed && te.preventDefault(); + break; + } + }), this.addManagedListener(this.eWrapper, "click", S), this.addManagedListener(this.eLabel, "click", S), this.pickerIcon) { + var z = Xl(this.pickerIcon, this.gridOptionsWrapper); + z && this.eIcon.appendChild(z); + } + }, f.prototype.refreshLabel = function() { + i(this.getLabel()) ? Fs(this.eWrapper, this.getLabelId()) : this.eWrapper.removeAttribute("aria-labelledby"), M.prototype.refreshLabel.call(this); + }, f.prototype.setAriaLabel = function(d) { + return $n(this.eWrapper, d), this; + }, f.prototype.setInputWidth = function(d) { + return zt(this.eWrapper, d), this; + }, f.prototype.getFocusableElement = function() { + return this.eWrapper; + }, xC([ + qr("eLabel") + ], f.prototype, "eLabel", void 0), xC([ + qr("eWrapper") + ], f.prototype, "eWrapper", void 0), xC([ + qr("eDisplayField") + ], f.prototype, "eDisplayField", void 0), xC([ + qr("eIcon") + ], f.prototype, "eIcon", void 0), f; + }(mf) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var cL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), M1 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Xx = ( + /** @class */ + function(M) { + cL(f, M); + function f(d) { + d === void 0 && (d = "default"); + var g = M.call( + this, + /* html */ + '
' + ) || this; + return g.cssIdentifier = d, g.options = [], g.itemEls = [], g; + } + return f.prototype.init = function() { + this.addManagedListener(this.getGui(), "keydown", this.handleKeyDown.bind(this)); + }, f.prototype.handleKeyDown = function(d) { + var g = d.key; + switch (g) { + case Hr.ENTER: + if (!this.highlightedEl) + this.setValue(this.getValue()); + else { + var S = this.itemEls.indexOf(this.highlightedEl); + this.setValueByIndex(S); + } + break; + case Hr.DOWN: + case Hr.UP: + var O = g === Hr.DOWN, z = void 0; + if (d.preventDefault(), !this.highlightedEl) + z = this.itemEls[O ? 0 : this.itemEls.length - 1]; + else { + var te = this.itemEls.indexOf(this.highlightedEl), Fe = te + (O ? 1 : -1); + Fe = Math.min(Math.max(Fe, 0), this.itemEls.length - 1), z = this.itemEls[Fe]; + } + this.highlightItem(z); + break; + } + }, f.prototype.addOptions = function(d) { + var g = this; + return d.forEach(function(S) { + return g.addOption(S); + }), this; + }, f.prototype.addOption = function(d) { + var g = d.value, S = d.text, O = _t(S || g); + return this.options.push({ value: g, text: O }), this.renderOption(g, O), this.updateIndices(), this; + }, f.prototype.updateIndices = function() { + var d = this.getGui().querySelectorAll(".ag-list-item"); + d.forEach(function(g, S) { + _h(g, S + 1), Pr(g, d.length); + }); + }, f.prototype.renderOption = function(d, g) { + var S = this, O = document.createElement("div"); + tr(O, "option"), O.classList.add("ag-list-item", "ag-" + this.cssIdentifier + "-list-item"), O.innerHTML = "" + g + "", O.tabIndex = -1, this.itemEls.push(O), this.addManagedListener(O, "mouseover", function() { + return S.highlightItem(O); + }), this.addManagedListener(O, "mouseleave", function() { + return S.clearHighlighted(); + }), this.addManagedListener(O, "click", function() { + return S.setValue(d); + }), this.getGui().appendChild(O); + }, f.prototype.setValue = function(d, g) { + if (this.value === d) + return this.fireItemSelected(), this; + if (d == null) + return this.reset(), this; + var S = this.options.findIndex(function(z) { + return z.value === d; + }); + if (S !== -1) { + var O = this.options[S]; + this.value = O.value, this.displayValue = O.text != null ? O.text : O.value, this.highlightItem(this.itemEls[S]), g || this.fireChangeEvent(); + } + return this; + }, f.prototype.setValueByIndex = function(d) { + return this.setValue(this.options[d].value); + }, f.prototype.getValue = function() { + return this.value; + }, f.prototype.getDisplayValue = function() { + return this.displayValue; + }, f.prototype.refreshHighlighted = function() { + var d = this; + this.clearHighlighted(); + var g = this.options.findIndex(function(S) { + return S.value === d.value; + }); + g !== -1 && this.highlightItem(this.itemEls[g]); + }, f.prototype.reset = function() { + this.value = null, this.displayValue = null, this.clearHighlighted(), this.fireChangeEvent(); + }, f.prototype.highlightItem = function(d) { + d.offsetParent && (this.clearHighlighted(), this.highlightedEl = d, this.highlightedEl.classList.add(f.ACTIVE_CLASS), yl(this.highlightedEl, !0), this.highlightedEl.focus()); + }, f.prototype.clearHighlighted = function() { + !this.highlightedEl || !this.highlightedEl.offsetParent || (this.highlightedEl.classList.remove(f.ACTIVE_CLASS), yl(this.highlightedEl, !1), this.highlightedEl = null); + }, f.prototype.fireChangeEvent = function() { + this.dispatchEvent({ type: mf.EVENT_CHANGED }), this.fireItemSelected(); + }, f.prototype.fireItemSelected = function() { + this.dispatchEvent({ type: f.EVENT_ITEM_SELECTED }); + }, f.EVENT_ITEM_SELECTED = "selectedItem", f.ACTIVE_CLASS = "ag-active-item", M1([ + ct + ], f.prototype, "init", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var L8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), V3 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Kx = ( + /** @class */ + function(M) { + L8(f, M); + function f(d) { + return M.call(this, d, "ag-select", "smallDown", "listbox") || this; + } + return f.prototype.init = function() { + var d = this; + this.listComponent = this.createBean(new Xx("select")), this.listComponent.setParentComponent(this), this.eWrapper.tabIndex = 0, this.listComponent.addManagedListener(this.listComponent, Xx.EVENT_ITEM_SELECTED, function() { + d.hideList && d.hideList(); + }), this.listComponent.addManagedListener(this.listComponent, mf.EVENT_CHANGED, function() { + d.setValue(d.listComponent.getValue(), !1, !0), d.hideList && d.hideList(); + }); + }, f.prototype.showPicker = function() { + var d = this, g = this.listComponent.getGui(), S = this.gridOptionsWrapper.getDocument(), O = this.addManagedListener(S.body, "wheel", function(ze) { + !g.contains(ze.target) && d.hideList && d.hideList(); + }), z = this.addManagedListener(g, "focusout", function(ze) { + !g.contains(ze.relatedTarget) && d.hideList && d.hideList(); + }), te = this.gridOptionsWrapper.getLocaleTextFunc(), Fe = this.popupService.addPopup({ + modal: !0, + eChild: g, + closeOnEsc: !0, + closedCallback: function() { + d.hideList = null, d.isPickerDisplayed = !1, z(), O(), d.isAlive() && (yo(d.eWrapper, !1), d.getFocusableElement().focus()); + }, + ariaLabel: te("ariaLabelSelectField", "Select Field") + }); + return Fe && (this.hideList = Fe.hideFunc), this.isPickerDisplayed = !0, zt(g, lp(this.eWrapper)), yo(this.eWrapper, !0), g.style.maxHeight = Fp(this.popupService.getPopupParent()) + "px", g.style.position = "absolute", this.popupService.positionPopupUnderComponent({ + type: "ag-list", + eventSource: this.eWrapper, + ePopup: g, + keepWithinBounds: !0 + }), this.listComponent.refreshHighlighted(), this.listComponent; + }, f.prototype.addOptions = function(d) { + var g = this; + return d.forEach(function(S) { + return g.addOption(S); + }), this; + }, f.prototype.addOption = function(d) { + return this.listComponent.addOption(d), this; + }, f.prototype.setValue = function(d, g, S) { + if (this.value === d) + return this; + S || this.listComponent.setValue(d, !0); + var O = this.listComponent.getValue(); + return O === this.getValue() ? this : (this.eDisplayField.innerHTML = this.listComponent.getDisplayValue(), M.prototype.setValue.call(this, d, g)); + }, f.prototype.destroy = function() { + this.hideList && this.hideList(), this.destroyBean(this.listComponent), M.prototype.destroy.call(this); + }, V3([ + pe("popupService") + ], f.prototype, "popupService", void 0), V3([ + ct + ], f.prototype, "init", null), f; + }(Uc) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var j3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), SC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Wv = ( + /** @class */ + function(M) { + j3(f, M); + function f(d, g, S, O) { + S === void 0 && (S = "text"), O === void 0 && (O = "input"); + var z = M.call( + this, + d, + /* html */ + ` +
+
+ +
`, + g + ) || this; + return z.inputType = S, z.displayFieldTag = O, z; + } + return f.prototype.postConstruct = function() { + M.prototype.postConstruct.call(this), this.setInputType(), this.eLabel.classList.add(this.className + "-label"), this.eWrapper.classList.add(this.className + "-input-wrapper"), this.eInput.classList.add(this.className + "-input"), this.addCssClass("ag-input-field"), this.eInput.id = this.eInput.id || "ag-" + this.getCompId() + "-input"; + var d = this.config, g = d.width, S = d.value; + g != null && this.setWidth(g), S != null && this.setValue(S), this.addInputListeners(); + }, f.prototype.refreshLabel = function() { + i(this.getLabel()) ? Fs(this.eInput, this.getLabelId()) : this.eInput.removeAttribute("aria-labelledby"), M.prototype.refreshLabel.call(this); + }, f.prototype.addInputListeners = function() { + var d = this; + this.addManagedListener(this.eInput, "input", function(g) { + return d.setValue(g.target.value); + }); + }, f.prototype.setInputType = function() { + this.displayFieldTag === "input" && this.eInput.setAttribute("type", this.inputType); + }, f.prototype.getInputElement = function() { + return this.eInput; + }, f.prototype.setInputWidth = function(d) { + return zt(this.eWrapper, d), this; + }, f.prototype.setInputName = function(d) { + return this.getInputElement().setAttribute("name", d), this; + }, f.prototype.getFocusableElement = function() { + return this.eInput; + }, f.prototype.setMaxLength = function(d) { + var g = this.eInput; + return g.maxLength = d, this; + }, f.prototype.setInputPlaceholder = function(d) { + return ye(this.eInput, "placeholder", d), this; + }, f.prototype.setInputAriaLabel = function(d) { + return $n(this.eInput, d), this; + }, f.prototype.setDisabled = function(d) { + return uh(this.eInput, d), M.prototype.setDisabled.call(this, d); + }, SC([ + qr("eLabel") + ], f.prototype, "eLabel", void 0), SC([ + qr("eWrapper") + ], f.prototype, "eWrapper", void 0), SC([ + qr("eInput") + ], f.prototype, "eInput", void 0), f; + }(mf) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var N8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), D1 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Hd; + (function(M) { + M[M.One = 0] = "One", M[M.Two = 1] = "Two"; + })(Hd || (Hd = {})); + var Th = ( + /** @class */ + function(M) { + N8(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getNumberOfInputs = function(d) { + var g = this.optionsFactory.getCustomOption(d); + if (g) { + var S = g.numberOfInputs; + return S ?? 1; + } + var O = [ + f.EMPTY, + f.NOT_BLANK, + f.BLANK + ]; + return d && O.indexOf(d) >= 0 ? 0 : d === f.IN_RANGE ? 2 : 1; + }, f.prototype.onFloatingFilterChanged = function(d, g) { + this.setTypeFromFloatingFilter(d), this.setValueFromFloatingFilter(g), this.onUiChanged(!0); + }, f.prototype.setTypeFromFloatingFilter = function(d) { + this.eType1.setValue(d), this.eType2.setValue(this.optionsFactory.getDefaultOption()), (this.isDefaultOperator("AND") ? this.eJoinOperatorAnd : this.eJoinOperatorOr).setValue(!0); + }, f.prototype.getModelFromUi = function() { + return this.isConditionUiComplete(Hd.One) ? this.isAllowTwoConditions() && this.isConditionUiComplete(Hd.Two) ? { + filterType: this.getFilterType(), + operator: this.getJoinOperator(), + condition1: this.createCondition(Hd.One), + condition2: this.createCondition(Hd.Two) + } : this.createCondition(Hd.One) : null; + }, f.prototype.getConditionTypes = function() { + return [ + this.eType1.getValue(), + this.eType2.getValue() + ]; + }, f.prototype.getJoinOperator = function() { + return this.eJoinOperatorOr.getValue() === !0 ? "OR" : "AND"; + }, f.prototype.areModelsEqual = function(d, g) { + if (!d && !g) + return !0; + if (!d && g || d && !g) + return !1; + var S = !d.operator, O = !g.operator, z = !S && O || S && !O; + if (z) + return !1; + var te; + if (S) { + var Fe = d, ze = g; + te = this.areSimpleModelsEqual(Fe, ze); + } else { + var ht = d, Lt = g; + te = ht.operator === Lt.operator && this.areSimpleModelsEqual(ht.condition1, Lt.condition1) && this.areSimpleModelsEqual(ht.condition2, Lt.condition2); + } + return te; + }, f.prototype.setModelIntoUi = function(d) { + var g = d.operator; + if (g) { + var S = d, O = S.operator === "OR"; + this.eJoinOperatorAnd.setValue(!O), this.eJoinOperatorOr.setValue(O), this.eType1.setValue(S.condition1.type), this.eType2.setValue(S.condition2.type), this.setConditionIntoUi(S.condition1, Hd.One), this.setConditionIntoUi(S.condition2, Hd.Two); + } else { + var z = d; + this.eJoinOperatorAnd.setValue(this.isDefaultOperator("AND")), this.eJoinOperatorOr.setValue(this.isDefaultOperator("OR")), this.eType1.setValue(z.type), this.eType2.setValue(this.optionsFactory.getDefaultOption()), this.setConditionIntoUi(z, Hd.One), this.setConditionIntoUi(null, Hd.Two); + } + return Pm.resolve(); + }, f.prototype.doesFilterPass = function(d) { + var g = this, S = this.getModel(); + if (S == null) + return !0; + var O = S.operator, z = []; + if (O) { + var te = S; + z.push(te.condition1, te.condition2); + } else + z.push(S); + var Fe = O && O === "OR" ? "some" : "every"; + return z[Fe](function(ze) { + return g.individualConditionPasses(d, ze); + }); + }, f.prototype.setParams = function(d) { + M.prototype.setParams.call(this, d), this.optionsFactory = new aL(), this.optionsFactory.init(d, this.getDefaultFilterOptions()), this.allowTwoConditions = !d.suppressAndOrCondition, this.alwaysShowBothConditions = !!d.alwaysShowBothConditions, this.defaultJoinOperator = this.getDefaultJoinOperator(d.defaultJoinOperator), this.putOptionsIntoDropdown(), this.addChangedListeners(); + }, f.prototype.getDefaultJoinOperator = function(d) { + return Ce(["AND", "OR"], d) ? d : "AND"; + }, f.prototype.putOptionsIntoDropdown = function() { + var d = this, g = this.optionsFactory.getFilterOptions(), S = [this.eType1, this.eType2]; + g.forEach(function(O) { + var z = typeof O == "string" ? d.createBoilerplateListOption(O) : d.createCustomListOption(O); + S.forEach(function(te) { + return te.addOption(z); + }); + }), S.forEach(function(O) { + return O.setDisabled(g.length <= 1); + }); + }, f.prototype.createBoilerplateListOption = function(d) { + return { value: d, text: this.translate(d) }; + }, f.prototype.createCustomListOption = function(d) { + var g = d.displayKey, S = this.optionsFactory.getCustomOption(d.displayKey); + return { + value: g, + text: S ? this.gridOptionsWrapper.getLocaleTextFunc()(S.displayKey, S.displayName) : this.translate(g) + }; + }, f.prototype.isAllowTwoConditions = function() { + return this.allowTwoConditions; + }, f.prototype.createBodyTemplate = function() { + return ( + /* html */ + ` + + ` + this.createValueTemplate(Hd.One) + ` +
+ + +
+ + ` + this.createValueTemplate(Hd.Two) + ); + }, f.prototype.getCssIdentifier = function() { + return "simple-filter"; + }, f.prototype.updateUiVisibility = function() { + var d = this, g = [ + [this.eType1], + [this.eType2, this.eJoinOperatorPanel, this.eJoinOperatorAnd, this.eJoinOperatorOr] + ], S = [this.eCondition1Body, this.eCondition2Body]; + g.forEach(function(O, z) { + var te = d.isConditionVisible(z), Fe = d.isConditionDisabled(z); + O.forEach(function(ze) { + ze instanceof Wv || ze instanceof Kx ? (ze.setDisabled(Fe), ze.setDisplayed(te)) : (uh(ze, Fe), al(ze, te)); + }); + }), S.forEach(function(O, z) { + al(O, d.isConditionBodyVisible(z)); + }), this.forEachInput(function(O, z, te, Fe) { + d.setElementDisplayed(O, z < Fe), d.setElementDisabled(O, d.isConditionDisabled(te)); + }), this.resetPlaceholder(); + }, f.prototype.afterGuiAttached = function(d) { + if (M.prototype.afterGuiAttached.call(this, d), this.resetPlaceholder(), !d || !d.suppressFocus && !this.isReadOnly()) { + var g = this.getInputs()[0][0]; + if (!g) + return; + g instanceof Wv && g.getInputElement().focus(); + } + }, f.prototype.resetPlaceholder = function() { + var d = this, g = this.gridOptionsWrapper.getLocaleTextFunc(); + this.forEachInput(function(S, O, z, te) { + if (S instanceof Wv) { + var Fe = O === 0 && te > 1 ? "inRangeStart" : O === 0 ? "filterOoo" : "inRangeEnd", ze = O === 0 && te > 1 ? g("ariaFilterFromValue", "Filter from value") : O === 0 ? g("ariaFilterValue", "Filter Value") : g("ariaFilterToValue", "Filter to Value"); + S.setInputPlaceholder(d.translate(Fe)), S.setInputAriaLabel(ze); + } + }); + }, f.prototype.setElementValue = function(d, g, S) { + d instanceof Wv && d.setValue(g != null ? String(g) : null, S); + }, f.prototype.setElementDisplayed = function(d, g) { + d instanceof ba && al(d.getGui(), g); + }, f.prototype.setElementDisabled = function(d, g) { + d instanceof ba && uh(d.getGui(), g); + }, f.prototype.attachElementOnChange = function(d, g) { + d instanceof Wv && d.onValueChange(g); + }, f.prototype.forEachInput = function(d) { + var g = this, S = this.getInputs(); + this.getConditionTypes().forEach(function(O, z) { + for (var te = g.getNumberOfInputs(O), Fe = 0; Fe < S[z].length; Fe++) { + var ze = S[z][Fe]; + ze != null && d(ze, Fe, z, te); + } + }); + }, f.prototype.isConditionVisible = function(d) { + return d === 0 ? !0 : this.allowTwoConditions ? this.isReadOnly() ? this.isConditionUiComplete(d) : this.alwaysShowBothConditions ? !0 : this.isConditionUiComplete(d - 1) : !1; + }, f.prototype.isConditionDisabled = function(d) { + return this.isReadOnly() || !this.isConditionVisible(d) ? !0 : d === 0 ? !1 : !this.isConditionUiComplete(d - 1); + }, f.prototype.isConditionBodyVisible = function(d) { + if (!this.isConditionVisible(d)) + return !1; + var g = this.getConditionTypes()[d], S = this.getNumberOfInputs(g); + return S > 0; + }, f.prototype.isConditionUiComplete = function(d) { + var g = this.getConditionTypes()[d]; + return !(g === f.EMPTY || this.getValues(d).some(function(S) { + return S == null; + })); + }, f.prototype.resetUiToDefaults = function(d) { + var g = this, S = this.gridOptionsWrapper.getLocaleTextFunc(), O = S("ariaFilteringOperator", "Filtering operator"), z = "ag-simple-filter-and-or-" + this.getCompId(), te = this.optionsFactory.getDefaultOption(); + return this.eType1.setValue(te, d).setAriaLabel(O).setDisabled(this.isReadOnly()), this.eType2.setValue(this.optionsFactory.getDefaultOption(), d).setAriaLabel(O).setDisabled(this.isReadOnly()), this.eJoinOperatorAnd.setValue(this.isDefaultOperator("AND"), d).setName(z).setLabel(this.translate("andCondition")).setDisabled(this.isReadOnly()), this.eJoinOperatorOr.setValue(this.isDefaultOperator("OR"), d).setName(z).setLabel(this.translate("orCondition")).setDisabled(this.isReadOnly()), this.forEachInput(function(Fe) { + g.setElementValue(Fe, null, d), g.setElementDisabled(Fe, g.isReadOnly()); + }), this.resetPlaceholder(), Pm.resolve(); + }, f.prototype.setConditionIntoUi = function(d, g) { + var S = this, O = this.mapValuesFromModel(d); + this.forEachInput(function(z, te, Fe, ze) { + Fe === g && S.setElementValue(z, O[te] != null ? O[te] : null); + }); + }, f.prototype.setValueFromFloatingFilter = function(d) { + var g = this; + this.forEachInput(function(S, O, z, te) { + g.setElementValue(S, O === 0 && z === 0 ? d : null); + }); + }, f.prototype.isDefaultOperator = function(d) { + return d === this.defaultJoinOperator; + }, f.prototype.addChangedListeners = function() { + var d = this; + if (!this.isReadOnly()) { + var g = function() { + return d.onUiChanged(); + }; + this.eType1.onValueChange(g), this.eType2.onValueChange(g), this.eJoinOperatorOr.onValueChange(g), this.eJoinOperatorAnd.onValueChange(g), this.forEachInput(function(S) { + d.attachElementOnChange(S, g); + }); + } + }, f.prototype.individualConditionPasses = function(d, g) { + var S = this.getCellValue(d.node), O = this.mapValuesFromModel(g), z = this.optionsFactory.getCustomOption(g.type), te = this.evaluateCustomFilter(z, O, S); + return te ?? (S == null ? this.evaluateNullValue(g.type) : this.evaluateNonNullValue(O, S, g, d)); + }, f.prototype.evaluateCustomFilter = function(d, g, S) { + if (d != null) { + var O = d.predicate; + if (O != null && !g.some(function(z) { + return z == null; + })) + return O(g, S); + } + }, f.prototype.isBlank = function(d) { + return d == null || typeof d == "string" && d.trim().length === 0; + }, f.EMPTY = "empty", f.BLANK = "blank", f.NOT_BLANK = "notBlank", f.EQUALS = "equals", f.NOT_EQUAL = "notEqual", f.LESS_THAN = "lessThan", f.LESS_THAN_OR_EQUAL = "lessThanOrEqual", f.GREATER_THAN = "greaterThan", f.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", f.IN_RANGE = "inRange", f.CONTAINS = "contains", f.NOT_CONTAINS = "notContains", f.STARTS_WITH = "startsWith", f.ENDS_WITH = "endsWith", D1([ + qr("eOptions1") + ], f.prototype, "eType1", void 0), D1([ + qr("eOptions2") + ], f.prototype, "eType2", void 0), D1([ + qr("eJoinOperatorPanel") + ], f.prototype, "eJoinOperatorPanel", void 0), D1([ + qr("eJoinOperatorAnd") + ], f.prototype, "eJoinOperatorAnd", void 0), D1([ + qr("eJoinOperatorOr") + ], f.prototype, "eJoinOperatorOr", void 0), D1([ + qr("eCondition1Body") + ], f.prototype, "eCondition1Body", void 0), D1([ + qr("eCondition2Body") + ], f.prototype, "eCondition2Body", void 0), f; + }(wC) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var hL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), $s = ( + /** @class */ + function(M) { + hL(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.setParams = function(d) { + M.prototype.setParams.call(this, d), this.scalarFilterParams = d; + }, f.prototype.evaluateNullValue = function(d) { + switch (d) { + case f.EQUALS: + case f.NOT_EQUAL: + if (this.scalarFilterParams.includeBlanksInEquals) + return !0; + break; + case f.GREATER_THAN: + case f.GREATER_THAN_OR_EQUAL: + if (this.scalarFilterParams.includeBlanksInGreaterThan) + return !0; + break; + case f.LESS_THAN: + case f.LESS_THAN_OR_EQUAL: + if (this.scalarFilterParams.includeBlanksInLessThan) + return !0; + break; + case f.IN_RANGE: + if (this.scalarFilterParams.includeBlanksInRange) + return !0; + break; + case f.BLANK: + return !0; + case f.NOT_BLANK: + return !1; + } + return !1; + }, f.prototype.evaluateNonNullValue = function(d, g, S) { + var O = this.comparator(), z = d[0] != null ? O(d[0], g) : 0; + switch (S.type) { + case f.EQUALS: + return z === 0; + case f.NOT_EQUAL: + return z !== 0; + case f.GREATER_THAN: + return z > 0; + case f.GREATER_THAN_OR_EQUAL: + return z >= 0; + case f.LESS_THAN: + return z < 0; + case f.LESS_THAN_OR_EQUAL: + return z <= 0; + case f.IN_RANGE: { + var te = O(d[1], g); + return this.scalarFilterParams.inRangeInclusive ? z >= 0 && te <= 0 : z > 0 && te < 0; + } + case f.BLANK: + return this.isBlank(g); + case f.NOT_BLANK: + return !this.isBlank(g); + default: + return console.warn('AG Grid: Unexpected type of filter "' + S.type + '", it looks like the filter was configured with incorrect Filter Options'), !0; + } + }, f; + }(Th) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var k8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), dL = function() { + return dL = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, dL.apply(this, arguments); + }, CC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, tA = 1e3, iA = 1 / 0, TC = ( + /** @class */ + function(M) { + k8(f, M); + function f() { + var d = M.call(this, "dateFilter") || this; + return d.minValidYear = tA, d.maxValidYear = iA, d; + } + return f.prototype.afterGuiAttached = function(d) { + M.prototype.afterGuiAttached.call(this, d), this.dateCondition1FromComp.afterGuiAttached(d); + }, f.prototype.mapValuesFromModel = function(d) { + var g = d || {}, S = g.dateFrom, O = g.dateTo, z = g.type; + return [ + S && Ss(S) || null, + O && Ss(O) || null + ].slice(0, this.getNumberOfInputs(z)); + }, f.prototype.comparator = function() { + return this.dateFilterParams.comparator ? this.dateFilterParams.comparator : this.defaultComparator.bind(this); + }, f.prototype.defaultComparator = function(d, g) { + var S = g; + return g == null || S < d ? -1 : S > d ? 1 : 0; + }, f.prototype.setParams = function(d) { + M.prototype.setParams.call(this, d), this.dateFilterParams = d; + var g = function(S, O) { + if (d[S] != null) + if (isNaN(d[S])) + console.warn("AG Grid: DateFilter " + S + " is not a number"); + else + return d[S] == null ? O : Number(d[S]); + return O; + }; + this.minValidYear = g("minValidYear", tA), this.maxValidYear = g("maxValidYear", iA), this.minValidYear > this.maxValidYear && console.warn("AG Grid: DateFilter minValidYear should be <= maxValidYear"), this.createDateComponents(); + }, f.prototype.createDateComponents = function() { + var d = this, g = function(S) { + return new QI(d.getContext(), d.userComponentFactory, { + onDateChanged: function() { + return d.onUiChanged(); + }, + filterParams: d.dateFilterParams + }, S); + }; + this.dateCondition1FromComp = g(this.eCondition1PanelFrom), this.dateCondition1ToComp = g(this.eCondition1PanelTo), this.dateCondition2FromComp = g(this.eCondition2PanelFrom), this.dateCondition2ToComp = g(this.eCondition2PanelTo), this.addDestroyFunc(function() { + d.forEachInput(function(S) { + return S.destroy(); + }); + }); + }, f.prototype.setElementValue = function(d, g, S) { + d.setDate(g); + }, f.prototype.setElementDisplayed = function(d, g) { + d.setDisplayed(g); + }, f.prototype.setElementDisabled = function(d, g) { + d.setDisabled(g); + }, f.prototype.getDefaultFilterOptions = function() { + return f.DEFAULT_FILTER_OPTIONS; + }, f.prototype.createValueTemplate = function(d) { + var g = d === Hd.One ? "1" : "2"; + return ( + /* html */ + ` +
+
+
+
` + ); + }, f.prototype.isConditionUiComplete = function(d) { + var g = this; + if (!M.prototype.isConditionUiComplete.call(this, d)) + return !1; + var S = function(z) { + return z != null && z.getUTCFullYear() >= g.minValidYear && z.getUTCFullYear() <= g.maxValidYear; + }, O = !0; + return this.forEachInput(function(z, te, Fe, ze) { + Fe !== d || !O || te >= ze || (O = O && S(z.getDate())); + }), O; + }, f.prototype.areSimpleModelsEqual = function(d, g) { + return d.dateFrom === g.dateFrom && d.dateTo === g.dateTo && d.type === g.type; + }, f.prototype.getFilterType = function() { + return "date"; + }, f.prototype.createCondition = function(d) { + var g = this.getConditionTypes()[d], S = {}, O = this.getValues(d); + return O.length > 0 && (S.dateFrom = xs(O[0])), O.length > 1 && (S.dateTo = xs(O[1])), dL({ dateFrom: null, dateTo: null, filterType: this.getFilterType(), type: g }, S); + }, f.prototype.resetPlaceholder = function() { + var d = this.gridOptionsWrapper.getLocaleTextFunc(), g = this.translate("dateFormatOoo"), S = d("ariaFilterValue", "Filter Value"); + this.forEachInput(function(O) { + O.setInputPlaceholder(g), O.setInputAriaLabel(S); + }); + }, f.prototype.getInputs = function() { + return [ + [this.dateCondition1FromComp, this.dateCondition1ToComp], + [this.dateCondition2FromComp, this.dateCondition2ToComp] + ]; + }, f.prototype.getValues = function(d) { + var g = []; + return this.forEachInput(function(S, O, z, te) { + d === z && O < te && g.push(S.getDate()); + }), g; + }, f.DEFAULT_FILTER_OPTIONS = [ + $s.EQUALS, + $s.GREATER_THAN, + $s.LESS_THAN, + $s.NOT_EQUAL, + $s.IN_RANGE, + $s.BLANK, + $s.NOT_BLANK + ], CC([ + qr("eCondition1PanelFrom") + ], f.prototype, "eCondition1PanelFrom", void 0), CC([ + qr("eCondition1PanelTo") + ], f.prototype, "eCondition1PanelTo", void 0), CC([ + qr("eCondition2PanelFrom") + ], f.prototype, "eCondition2PanelFrom", void 0), CC([ + qr("eCondition2PanelTo") + ], f.prototype, "eCondition2PanelTo", void 0), CC([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), f; + }($s) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var EC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), G3 = ( + /** @class */ + function(M) { + EC(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getDefaultDebounceMs = function() { + return 0; + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.getTextFromModel = function(d) { + if (!d) + return null; + var g = d.operator != null; + if (g) { + var S = d, O = S || {}, z = O.condition1, te = O.condition2, Fe = this.optionsFactory.getCustomOption(z.type), ze = this.optionsFactory.getCustomOption(te.type); + return [ + this.conditionToString(z, Fe), + S.operator, + this.conditionToString(te, ze) + ].join(" "); + } else { + var ht = d, Lt = this.optionsFactory.getCustomOption(ht.type), ti = Lt || {}, wi = ti.displayKey, Ti = ti.displayName, qi = ti.numberOfInputs; + return wi && Ti && qi === 0 ? (this.gridOptionsWrapper.getLocaleTextFunc()(wi, Ti), Ti) : this.conditionToString(ht, Lt); + } + }, f.prototype.isEventFromFloatingFilter = function(d) { + return d && d.afterFloatingFilter; + }, f.prototype.getLastType = function() { + return this.lastType; + }, f.prototype.isReadOnly = function() { + return this.readOnly; + }, f.prototype.setLastTypeFromModel = function(d) { + if (!d) { + this.lastType = this.optionsFactory.getDefaultOption(); + return; + } + var g = d.operator, S; + if (g) { + var O = d; + S = O.condition1; + } else + S = d; + this.lastType = S.type; + }, f.prototype.canWeEditAfterModelFromParentFilter = function(d) { + if (!d) + return this.isTypeEditable(this.lastType); + var g = d.operator; + if (g) + return !1; + var S = d; + return this.isTypeEditable(S.type); + }, f.prototype.init = function(d) { + this.optionsFactory = new aL(), this.optionsFactory.init(d.filterParams, this.getDefaultFilterOptions()), this.lastType = this.optionsFactory.getDefaultOption(), this.readOnly = !!d.filterParams.readOnly; + var g = this.isTypeEditable(this.lastType); + this.setEditable(g); + }, f.prototype.doesFilterHaveSingleInput = function(d) { + var g = this.optionsFactory.getCustomOption(d), S = (g || {}).numberOfInputs; + return S == null || S == 1; + }, f.prototype.isTypeEditable = function(d) { + var g = [ + Th.IN_RANGE, + Th.EMPTY, + Th.BLANK, + Th.NOT_BLANK + ]; + return !!d && !this.isReadOnly() && this.doesFilterHaveSingleInput(d) && g.indexOf(d) < 0; + }, f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Fa = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), qb = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, rA = ( + /** @class */ + function(M) { + Fa(f, M); + function f() { + return M.call( + this, + /* html */ + ` + ` + ) || this; + } + return f.prototype.getDefaultFilterOptions = function() { + return TC.DEFAULT_FILTER_OPTIONS; + }, f.prototype.conditionToString = function(d, g) { + var S = d.type, O = (g || {}).numberOfInputs, z = S == Th.IN_RANGE || O === 2, te = Ss(d.dateFrom), Fe = Ss(d.dateTo); + return z ? xs(te, !1) + "-" + xs(Fe, !1) : te != null ? "" + xs(te, !1) : "" + S; + }, f.prototype.init = function(d) { + M.prototype.init.call(this, d), this.params = d, this.createDateComponent(); + var g = this.gridOptionsWrapper.getLocaleTextFunc(); + this.eReadOnlyText.setDisabled(!0).setInputAriaLabel(g("ariaDateFilterInput", "Date Filter Input")); + }, f.prototype.setEditable = function(d) { + al(this.eDateWrapper, d), al(this.eReadOnlyText.getGui(), !d); + }, f.prototype.onParentModelChanged = function(d, g) { + if (!this.isEventFromFloatingFilter(g)) { + M.prototype.setLastTypeFromModel.call(this, d); + var S = !this.isReadOnly() && this.canWeEditAfterModelFromParentFilter(d); + if (this.setEditable(S), S) { + if (d) { + var O = d; + this.dateComp.setDate(Ss(O.dateFrom)); + } else + this.dateComp.setDate(null); + this.eReadOnlyText.setValue(""); + } else + this.eReadOnlyText.setValue(this.getTextFromModel(d)), this.dateComp.setDate(null); + } + }, f.prototype.onDateChanged = function() { + var d = this, g = this.dateComp.getDate(), S = xs(g); + this.params.parentFilterInstance(function(O) { + if (O) { + var z = Ss(S); + O.onFloatingFilterChanged(d.getLastType() || null, z); + } + }); + }, f.prototype.createDateComponent = function() { + var d = this, g = wC.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs()), S = { + onDateChanged: It(this.onDateChanged.bind(this), g), + filterParams: this.params.column.getColDef().filterParams + }; + this.dateComp = new QI(this.getContext(), this.userComponentFactory, S, this.eDateWrapper), this.addDestroyFunc(function() { + return d.dateComp.destroy(); + }); + }, qb([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), qb([ + qr("eReadOnlyText") + ], f.prototype, "eReadOnlyText", void 0), qb([ + qr("eDateWrapper") + ], f.prototype, "eDateWrapper", void 0), f; + }(G3) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var pL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), fL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, U3 = ( + /** @class */ + function(M) { + pL(f, M); + function f() { + return M.call( + this, + /* html */ + ` +
+ +
` + ) || this; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.init = function(d) { + var g = this, S = this.gridOptionsWrapper.getDocument(), O = this.eDateInput.getInputElement(); + this.shouldUseBrowserDatePicker(d) && (O.type = "date"), this.addManagedListener(O, "mousedown", function() { + g.eDateInput.isDisabled() || O.focus(); + }), this.addManagedListener(O, "input", function(ze) { + ze.target === S.activeElement && (g.eDateInput.isDisabled() || d.onDateChanged()); + }); + var z = d.filterParams || {}, te = z.minValidYear, Fe = z.maxValidYear; + te && (O.min = te + "-01-01"), Fe && (O.max = Fe + "-12-31"); + }, f.prototype.getDate = function() { + return Ss(this.eDateInput.getValue()); + }, f.prototype.setDate = function(d) { + this.eDateInput.setValue(xs(d, !1)); + }, f.prototype.setInputPlaceholder = function(d) { + this.eDateInput.setInputPlaceholder(d); + }, f.prototype.setDisabled = function(d) { + this.eDateInput.setDisabled(d); + }, f.prototype.afterGuiAttached = function(d) { + (!d || !d.suppressFocus) && this.eDateInput.getInputElement().focus(); + }, f.prototype.shouldUseBrowserDatePicker = function(d) { + return d.filterParams && d.filterParams.browserDatePicker != null ? d.filterParams.browserDatePicker : Tl() || ah(); + }, fL([ + qr("eDateInput") + ], f.prototype, "eDateInput", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), dg = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, z3 = ( + /** @class */ + function(M) { + $8(f, M); + function f() { + return M.call(this, "numberFilter") || this; + } + return f.prototype.mapValuesFromModel = function(d) { + var g = d || {}, S = g.filter, O = g.filterTo, z = g.type; + return [ + S ?? null, + O ?? null + ].slice(0, this.getNumberOfInputs(z)); + }, f.prototype.getDefaultDebounceMs = function() { + return 500; + }, f.prototype.comparator = function() { + return function(d, g) { + return d === g ? 0 : d < g ? 1 : -1; + }; + }, f.prototype.setParams = function(d) { + this.numberFilterParams = d; + var g = this.getAllowedCharPattern(); + if (g) { + var S = { allowedCharPattern: g }; + this.resetTemplate({ + "eValue-index0-1": S, + "eValue-index1-1": S, + "eValue-index0-2": S, + "eValue-index1-2": S + }); + } + M.prototype.setParams.call(this, d); + }, f.prototype.getDefaultFilterOptions = function() { + return f.DEFAULT_FILTER_OPTIONS; + }, f.prototype.createValueTemplate = function(d) { + var g = d === Hd.One ? "1" : "2", S = this.getAllowedCharPattern(), O = S ? "ag-input-text-field" : "ag-input-number-field"; + return ( + /* html */ + ` + ` + ); + }, f.prototype.getValues = function(d) { + var g = this, S = []; + return this.forEachInput(function(O, z, te, Fe) { + d === te && z < Fe && S.push(g.stringToFloat(O.getValue())); + }), S; + }, f.prototype.areSimpleModelsEqual = function(d, g) { + return d.filter === g.filter && d.filterTo === g.filterTo && d.type === g.type; + }, f.prototype.getFilterType = function() { + return "number"; + }, f.prototype.stringToFloat = function(d) { + if (typeof d == "number") + return d; + var g = e(d); + return g != null && g.trim() === "" && (g = null), this.numberFilterParams.numberParser ? this.numberFilterParams.numberParser(g) : g == null || g.trim() === "-" ? null : parseFloat(g); + }, f.prototype.createCondition = function(d) { + var g = this.getConditionTypes()[d], S = { + filterType: this.getFilterType(), + type: g + }, O = this.getValues(d); + return O.length > 0 && (S.filter = O[0]), O.length > 1 && (S.filterTo = O[1]), S; + }, f.prototype.getInputs = function() { + return [ + [this.eValueFrom1, this.eValueTo1], + [this.eValueFrom2, this.eValueTo2] + ]; + }, f.prototype.getAllowedCharPattern = function() { + var d = (this.numberFilterParams || {}).allowedCharPattern; + return d || (!Tl() && !Rc() ? "\\d\\-\\." : null); + }, f.DEFAULT_FILTER_OPTIONS = [ + $s.EQUALS, + $s.NOT_EQUAL, + $s.LESS_THAN, + $s.LESS_THAN_OR_EQUAL, + $s.GREATER_THAN, + $s.GREATER_THAN_OR_EQUAL, + $s.IN_RANGE, + $s.BLANK, + $s.NOT_BLANK + ], dg([ + qr("eValue-index0-1") + ], f.prototype, "eValueFrom1", void 0), dg([ + qr("eValue-index1-1") + ], f.prototype, "eValueTo1", void 0), dg([ + qr("eValue-index0-2") + ], f.prototype, "eValueFrom2", void 0), dg([ + qr("eValue-index1-2") + ], f.prototype, "eValueTo2", void 0), f; + }($s) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var H3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Tu = function() { + return Tu = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, Tu.apply(this, arguments); + }, IC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Om = ( + /** @class */ + function(M) { + H3(f, M); + function f() { + return M.call(this, "textFilter") || this; + } + return f.trimInput = function(d) { + var g = d && d.trim(); + return g === "" ? d : g; + }, f.prototype.getDefaultDebounceMs = function() { + return 500; + }, f.prototype.setParams = function(d) { + M.prototype.setParams.call(this, d), this.textFilterParams = d, this.matcher = this.getTextMatcher(), this.formatter = this.textFilterParams.textFormatter || (this.textFilterParams.caseSensitive ? f.DEFAULT_FORMATTER : f.DEFAULT_LOWERCASE_FORMATTER); + }, f.prototype.getTextMatcher = function() { + var d = this.textFilterParams.textCustomComparator; + return d ? (ho.doOnce(function() { + return console.warn("AG Grid - textCustomComparator is deprecated, use textMatcher instead."); + }, "textCustomComparator.deprecated"), function(g) { + var S = g.filterOption, O = g.value, z = g.filterText; + return d(S, O, z); + }) : this.textFilterParams.textMatcher || f.DEFAULT_MATCHER; + }, f.prototype.createCondition = function(d) { + var g = this.getConditionTypes()[d], S = { + filterType: this.getFilterType(), + type: g + }, O = this.getValues(d); + return O.length > 0 && (S.filter = O[0]), O.length > 1 && (S.filterTo = O[1]), S; + }, f.prototype.getFilterType = function() { + return "text"; + }, f.prototype.areSimpleModelsEqual = function(d, g) { + return d.filter === g.filter && d.filterTo === g.filterTo && d.type === g.type; + }, f.prototype.getInputs = function() { + return [ + [this.eValueFrom1, this.eValueTo1], + [this.eValueFrom2, this.eValueTo2] + ]; + }, f.prototype.getValues = function(d) { + var g = this, S = []; + return this.forEachInput(function(O, z, te, Fe) { + if (d === te && z < Fe) { + var ze = e(O.getValue()), ht = (g.textFilterParams.trimInput ? f.trimInput(ze) : ze) || null; + S.push(ht), O.setValue(ht, !0); + } + }), S; + }, f.prototype.getDefaultFilterOptions = function() { + return f.DEFAULT_FILTER_OPTIONS; + }, f.prototype.createValueTemplate = function(d) { + var g = d === Hd.One ? "1" : "2"; + return ( + /* html */ + ` + ` + ); + }, f.prototype.mapValuesFromModel = function(d) { + var g = d || {}, S = g.filter, O = g.filterTo, z = g.type; + return [ + S || null, + O || null + ].slice(0, this.getNumberOfInputs(z)); + }, f.prototype.evaluateNullValue = function(d) { + var g = [ + Th.NOT_EQUAL, + Th.NOT_CONTAINS, + Th.BLANK + ]; + return d ? g.indexOf(d) >= 0 : !1; + }, f.prototype.evaluateNonNullValue = function(d, g, S, O) { + var z = this, te = d.map(function(kr) { + return z.formatter(kr); + }) || [], Fe = this.formatter(g), ze = this.textFilterParams, ht = ze.api, Lt = ze.colDef, ti = ze.column, wi = ze.columnApi, Ti = ze.context, qi = ze.textFormatter; + if (S.type === Th.BLANK) + return this.isBlank(g); + if (S.type === Th.NOT_BLANK) + return !this.isBlank(g); + var dr = { + api: ht, + colDef: Lt, + column: ti, + columnApi: wi, + context: Ti, + node: O.node, + data: O.data, + filterOption: S.type, + value: Fe, + textFormatter: qi + }; + return te.some(function(kr) { + return z.matcher(Tu(Tu({}, dr), { filterText: kr })); + }); + }, f.DEFAULT_FILTER_OPTIONS = [ + Th.CONTAINS, + Th.NOT_CONTAINS, + Th.EQUALS, + Th.NOT_EQUAL, + Th.STARTS_WITH, + Th.ENDS_WITH, + Th.BLANK, + Th.NOT_BLANK + ], f.DEFAULT_FORMATTER = function(d) { + return d; + }, f.DEFAULT_LOWERCASE_FORMATTER = function(d) { + return d == null ? null : d.toString().toLowerCase(); + }, f.DEFAULT_MATCHER = function(d) { + var g = d.filterOption, S = d.value, O = d.filterText; + if (O == null) + return !1; + switch (g) { + case f.CONTAINS: + return S.indexOf(O) >= 0; + case f.NOT_CONTAINS: + return S.indexOf(O) < 0; + case f.EQUALS: + return S === O; + case f.NOT_EQUAL: + return S != O; + case f.STARTS_WITH: + return S.indexOf(O) === 0; + case f.ENDS_WITH: + var z = S.lastIndexOf(O); + return z >= 0 && z === S.length - O.length; + default: + return !1; + } + }, IC([ + qr("eValue-index0-1") + ], f.prototype, "eValueFrom1", void 0), IC([ + qr("eValue-index1-1") + ], f.prototype, "eValueTo1", void 0), IC([ + qr("eValue-index0-2") + ], f.prototype, "eValueFrom2", void 0), IC([ + qr("eValue-index1-2") + ], f.prototype, "eValueTo2", void 0), f; + }(Th) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Jx = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), AC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, cp = ( + /** @class */ + function(M) { + Jx(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.postConstruct = function() { + this.resetTemplate(); + }, f.prototype.resetTemplate = function(d) { + this.setTemplate( + /* html */ + ` + + `, + d + ); + }, f.prototype.getDefaultDebounceMs = function() { + return 500; + }, f.prototype.onParentModelChanged = function(d, g) { + this.isEventFromFloatingFilter(g) || (this.setLastTypeFromModel(d), this.eFloatingFilterInput.setValue(this.getTextFromModel(d)), this.setEditable(this.canWeEditAfterModelFromParentFilter(d))); + }, f.prototype.init = function(d) { + M.prototype.init.call(this, d), this.params = d, this.applyActive = wC.isUseApplyButton(this.params.filterParams); + var g = this.params.filterParams.allowedCharPattern; + if (g != null && this.resetTemplate({ eFloatingFilterInput: { allowedCharPattern: g } }), !this.isReadOnly()) { + var S = wC.getDebounceMs(this.params.filterParams, this.getDefaultDebounceMs()), O = It(this.syncUpWithParentFilter.bind(this), S), z = this.eFloatingFilterInput.getGui(); + this.addManagedListener(z, "input", O), this.addManagedListener(z, "keypress", O), this.addManagedListener(z, "keydown", O); + } + var te = d.column.getDefinition(); + (this.isReadOnly() || te.filterParams && te.filterParams.filterOptions && te.filterParams.filterOptions.length === 1 && te.filterParams.filterOptions[0] === "inRange") && this.eFloatingFilterInput.setDisabled(!0); + var Fe = this.columnModel.getDisplayNameForColumn(d.column, "header", !0), ze = this.gridOptionsWrapper.getLocaleTextFunc(); + this.eFloatingFilterInput.setInputAriaLabel(Fe + " " + ze("ariaFilterInput", "Filter Input")); + }, f.prototype.syncUpWithParentFilter = function(d) { + var g = this, S = d.key === Hr.ENTER; + if (!(this.applyActive && !S)) { + var O = this.eFloatingFilterInput.getValue(); + this.params.filterParams.trimInput && (O = Om.trimInput(O), this.eFloatingFilterInput.setValue(O, !0)), this.params.parentFilterInstance(function(z) { + z && z.onFloatingFilterChanged(g.getLastType() || null, O || null); + }); + } + }, f.prototype.conditionToString = function(d, g) { + var S = (g || {}).numberOfInputs, O = d.type == Th.IN_RANGE || S === 2; + return O ? d.filter + "-" + d.filterTo : d.filter != null ? "" + d.filter : "" + d.type; + }, f.prototype.setEditable = function(d) { + this.eFloatingFilterInput.setDisabled(!d); + }, AC([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), AC([ + qr("eFloatingFilterInput") + ], f.prototype, "eFloatingFilterInput", void 0), AC([ + ct + ], f.prototype, "postConstruct", null), f; + }(G3) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Uh = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), nA = ( + /** @class */ + function(M) { + Uh(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getDefaultFilterOptions = function() { + return z3.DEFAULT_FILTER_OPTIONS; + }, f; + }(cp) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var B8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), mL = ( + /** @class */ + function(M) { + B8(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getDefaultFilterOptions = function() { + return Om.DEFAULT_FILTER_OPTIONS; + }, f; + }(cp) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var pg = ( + /** @class */ + function() { + function M(f, d) { + var g = this; + d === void 0 && (d = !1), this.destroyFuncs = [], this.touching = !1, this.eventService = new mt(), this.eElement = f, this.preventMouseClick = d; + var S = this.onTouchStart.bind(this), O = this.onTouchMove.bind(this), z = this.onTouchEnd.bind(this); + this.eElement.addEventListener("touchstart", S, { passive: !0 }), this.eElement.addEventListener("touchmove", O, { passive: !0 }), this.eElement.addEventListener("touchend", z, { passive: !1 }), this.destroyFuncs.push(function() { + g.eElement.removeEventListener("touchstart", S, { passive: !0 }), g.eElement.removeEventListener("touchmove", O, { passive: !0 }), g.eElement.removeEventListener("touchend", z, { passive: !1 }); + }); + } + return M.prototype.getActiveTouch = function(f) { + for (var d = 0; d < f.length; d++) { + var g = f[d].identifier === this.touchStart.identifier; + if (g) + return f[d]; + } + return null; + }, M.prototype.addEventListener = function(f, d) { + this.eventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.eventService.removeEventListener(f, d); + }, M.prototype.onTouchStart = function(f) { + var d = this; + if (!this.touching) { + this.touchStart = f.touches[0], this.touching = !0, this.moved = !1; + var g = this.touchStart; + window.setTimeout(function() { + var S = d.touchStart === g; + if (d.touching && S && !d.moved) { + d.moved = !0; + var O = { + type: M.EVENT_LONG_TAP, + touchStart: d.touchStart, + touchEvent: f + }; + d.eventService.dispatchEvent(O); + } + }, 500); + } + }, M.prototype.onTouchMove = function(f) { + if (this.touching) { + var d = this.getActiveTouch(f.touches); + if (d) { + var g = !xn(d, this.touchStart, 4); + g && (this.moved = !0); + } + } + }, M.prototype.onTouchEnd = function(f) { + if (this.touching) { + if (!this.moved) { + var d = { + type: M.EVENT_TAP, + touchStart: this.touchStart + }; + this.eventService.dispatchEvent(d), this.checkForDoubleTap(); + } + this.preventMouseClick && f.preventDefault(), this.touching = !1; + } + }, M.prototype.checkForDoubleTap = function() { + var f = (/* @__PURE__ */ new Date()).getTime(); + if (this.lastTapTime && this.lastTapTime > 0) { + var d = f - this.lastTapTime; + if (d > M.DOUBLE_TAP_MILLIS) { + var g = { + type: M.EVENT_DOUBLE_TAP, + touchStart: this.touchStart + }; + this.eventService.dispatchEvent(g), this.lastTapTime = null; + } else + this.lastTapTime = f; + } else + this.lastTapTime = f; + }, M.prototype.destroy = function() { + this.destroyFuncs.forEach(function(f) { + return f(); + }); + }, M.EVENT_TAP = "tap", M.EVENT_DOUBLE_TAP = "doubleTap", M.EVENT_LONG_TAP = "longTap", M.DOUBLE_TAP_MILLIS = 500, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Gs = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Gy = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, gL = ( + /** @class */ + function(M) { + Gs(f, M); + function f() { + var d = M !== null && M.apply(this, arguments) || this; + return d.lastMovingChanged = 0, d; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.refresh = function(d) { + return this.params = d, this.workOutTemplate() != this.currentTemplate || this.workOutShowMenu() != this.currentShowMenu || this.workOutSort() != this.currentSort ? !1 : (this.setDisplayName(d), !0); + }, f.prototype.workOutTemplate = function() { + var d = T(this.params.template, f.TEMPLATE); + return d = d && d.trim ? d.trim() : d, d; + }, f.prototype.init = function(d) { + this.params = d, this.currentTemplate = this.workOutTemplate(), this.setTemplate(this.currentTemplate), this.setupTap(), this.setupIcons(d.column), this.setMenu(), this.setupSort(), this.setupFilterIcon(), this.setDisplayName(d); + }, f.prototype.setDisplayName = function(d) { + if (this.currentDisplayName != d.displayName) { + this.currentDisplayName = d.displayName; + var g = _t(this.currentDisplayName); + this.eText && (this.eText.innerHTML = g); + } + }, f.prototype.setupIcons = function(d) { + this.addInIcon("sortAscending", this.eSortAsc, d), this.addInIcon("sortDescending", this.eSortDesc, d), this.addInIcon("sortUnSort", this.eSortNone, d), this.addInIcon("menu", this.eMenu, d), this.addInIcon("filter", this.eFilter, d); + }, f.prototype.addInIcon = function(d, g, S) { + if (g != null) { + var O = Xl(d, this.gridOptionsWrapper, S); + O && g.appendChild(O); + } + }, f.prototype.setupTap = function() { + var d = this, g = this.gridOptionsWrapper; + if (!g.isSuppressTouch()) { + var S = new pg(this.getGui(), !0), O = g.isSuppressMenuHide(), z = O && i(this.eMenu), te = z ? new pg(this.eMenu, !0) : S; + if (this.params.enableMenu) { + var Fe = z ? "EVENT_TAP" : "EVENT_LONG_TAP", ze = function(Lt) { + g.getApi().showColumnMenuAfterMouseClick(d.params.column, Lt.touchStart); + }; + this.addManagedListener(te, pg[Fe], ze); + } + if (this.params.enableSorting) { + var ht = function(Lt) { + var ti = Lt.touchStart.target; + O && d.eMenu.contains(ti) || d.sortController.progressSort(d.params.column, !1, "uiColumnSorted"); + }; + this.addManagedListener(S, pg.EVENT_TAP, ht); + } + this.addDestroyFunc(function() { + return S.destroy(); + }), z && this.addDestroyFunc(function() { + return te.destroy(); + }); + } + }, f.prototype.workOutShowMenu = function() { + var d = !this.gridOptionsWrapper.isSuppressMenuHide(), g = jh() && d, S = this.params.enableMenu && !g; + return S; + }, f.prototype.setMenu = function() { + var d = this; + if (this.eMenu) { + if (this.currentShowMenu = this.workOutShowMenu(), !this.currentShowMenu) { + Vc(this.eMenu); + return; + } + var g = this.gridOptionsWrapper.isSuppressMenuHide(); + this.addManagedListener(this.eMenu, "click", function() { + return d.showMenu(d.eMenu); + }), this.eMenu.classList.toggle("ag-header-menu-always-show", g); + } + }, f.prototype.showMenu = function(d) { + d || (d = this.eMenu), this.menuFactory.showMenuAfterButtonClick(this.params.column, d, "columnMenu"); + }, f.prototype.removeSortIcons = function() { + Vc(this.eSortAsc), Vc(this.eSortDesc), Vc(this.eSortNone), Vc(this.eSortOrder); + }, f.prototype.workOutSort = function() { + return this.params.enableSorting; + }, f.prototype.setupSort = function() { + var d = this; + if (this.currentSort = this.params.enableSorting, !this.currentSort) { + this.removeSortIcons(); + return; + } + var g = this.gridOptionsWrapper.isMultiSortKeyCtrl(); + this.addManagedListener(this.params.column, H.EVENT_MOVING_CHANGED, function() { + d.lastMovingChanged = (/* @__PURE__ */ new Date()).getTime(); + }), this.eLabel && this.addManagedListener(this.eLabel, "click", function(S) { + var O = d.params.column.isMoving(), z = (/* @__PURE__ */ new Date()).getTime(), te = z - d.lastMovingChanged < 50, Fe = O || te; + if (!Fe) { + var ze = g ? S.ctrlKey || S.metaKey : S.shiftKey; + d.params.progressSort(ze); + } + }), this.addManagedListener(this.params.column, H.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)), this.onSortChanged(), this.addManagedListener(this.eventService, ui.EVENT_SORT_CHANGED, this.setMultiSortOrder.bind(this)), this.setMultiSortOrder(); + }, f.prototype.onSortChanged = function() { + if (this.addOrRemoveCssClass("ag-header-cell-sorted-asc", this.params.column.isSortAscending()), this.addOrRemoveCssClass("ag-header-cell-sorted-desc", this.params.column.isSortDescending()), this.addOrRemoveCssClass("ag-header-cell-sorted-none", this.params.column.isSortNone()), this.eSortAsc && this.eSortAsc.classList.toggle("ag-hidden", !this.params.column.isSortAscending()), this.eSortDesc && this.eSortDesc.classList.toggle("ag-hidden", !this.params.column.isSortDescending()), this.eSortNone) { + var d = !this.params.column.getColDef().unSortIcon && !this.gridOptionsWrapper.isUnSortIcon(); + this.eSortNone.classList.toggle("ag-hidden", d || !this.params.column.isSortNone()); + } + }, f.prototype.setMultiSortOrder = function() { + if (this.eSortOrder) { + var d = this.params.column, g = this.sortController.getColumnsWithSortingOrdered(), S = g.indexOf(d), O = g.length > 1, z = d.isSorting() && O; + al(this.eSortOrder, z), S >= 0 ? this.eSortOrder.innerHTML = (S + 1).toString() : Su(this.eSortOrder); + } + }, f.prototype.setupFilterIcon = function() { + this.eFilter && (this.addManagedListener(this.params.column, H.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)), this.onFilterChanged()); + }, f.prototype.onFilterChanged = function() { + var d = this.params.column.isFilterActive(); + this.eFilter.classList.toggle("ag-hidden", !d); + }, f.TEMPLATE = ``, Gy([ + pe("sortController") + ], f.prototype, "sortController", void 0), Gy([ + pe("menuFactory") + ], f.prototype, "menuFactory", void 0), Gy([ + qr("eFilter") + ], f.prototype, "eFilter", void 0), Gy([ + qr("eSortAsc") + ], f.prototype, "eSortAsc", void 0), Gy([ + qr("eSortDesc") + ], f.prototype, "eSortDesc", void 0), Gy([ + qr("eSortNone") + ], f.prototype, "eSortNone", void 0), Gy([ + qr("eSortOrder") + ], f.prototype, "eSortOrder", void 0), Gy([ + qr("eMenu") + ], f.prototype, "eMenu", void 0), Gy([ + qr("eLabel") + ], f.prototype, "eLabel", void 0), Gy([ + qr("eText") + ], f.prototype, "eText", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var W3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), q3 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, V8 = ( + /** @class */ + function(M) { + W3(f, M); + function f() { + return M.call(this, f.TEMPLATE) || this; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.init = function(d) { + this.params = d, this.checkWarnings(), this.setupLabel(), this.addGroupExpandIcon(), this.setupExpandIcons(); + }, f.prototype.checkWarnings = function() { + var d = this.params; + if (d.template) { + var g = "AG Grid: A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)"; + Ge(function() { + return console.warn(g); + }, "HeaderGroupComp.templateNotSupported"); + } + }, f.prototype.setupExpandIcons = function() { + var d = this; + this.addInIcon("columnGroupOpened", "agOpened"), this.addInIcon("columnGroupClosed", "agClosed"); + var g = function(z) { + if (!Yi(z)) { + var te = !d.params.columnGroup.isExpanded(); + d.columnModel.setColumnGroupOpened(d.params.columnGroup.getProvidedColumnGroup(), te, "uiColumnExpanded"); + } + }; + this.addTouchAndClickListeners(this.eCloseIcon, g), this.addTouchAndClickListeners(this.eOpenIcon, g); + var S = function(z) { + Ri(z); + }; + this.addManagedListener(this.eCloseIcon, "dblclick", S), this.addManagedListener(this.eOpenIcon, "dblclick", S), this.addManagedListener(this.getGui(), "dblclick", g), this.updateIconVisibility(); + var O = this.params.columnGroup.getProvidedColumnGroup(); + this.addManagedListener(O, Jt.EVENT_EXPANDED_CHANGED, this.updateIconVisibility.bind(this)), this.addManagedListener(O, Jt.EVENT_EXPANDABLE_CHANGED, this.updateIconVisibility.bind(this)); + }, f.prototype.addTouchAndClickListeners = function(d, g) { + var S = new pg(d, !0); + this.addManagedListener(S, pg.EVENT_TAP, g), this.addDestroyFunc(function() { + return S.destroy(); + }), this.addManagedListener(d, "click", g); + }, f.prototype.updateIconVisibility = function() { + var d = this.params.columnGroup; + if (d.isExpandable()) { + var g = this.params.columnGroup.isExpanded(); + al(this.eOpenIcon, g), al(this.eCloseIcon, !g); + } else + al(this.eOpenIcon, !1), al(this.eCloseIcon, !1); + }, f.prototype.addInIcon = function(d, g) { + var S = Xl(d, this.gridOptionsWrapper, null); + S && this.getRefElement(g).appendChild(S); + }, f.prototype.addGroupExpandIcon = function() { + if (!this.params.columnGroup.isExpandable()) { + al(this.eOpenIcon, !1), al(this.eCloseIcon, !1); + return; + } + }, f.prototype.setupLabel = function() { + var d = this.params.displayName; + if (i(d)) { + var g = _t(d); + this.getRefElement("agLabel").innerHTML = g; + } + }, f.TEMPLATE = ``, q3([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), q3([ + qr("agOpened") + ], f.prototype, "eOpenIcon", void 0), q3([ + qr("agClosed") + ], f.prototype, "eCloseIcon", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Y3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Zx = ( + /** @class */ + function(M) { + Y3(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.isPopup = function() { + return !0; + }, f.prototype.setParentComponent = function(d) { + d.addCssClass("ag-has-popup"), M.prototype.setParentComponent.call(this, d); + }, f.prototype.destroy = function() { + var d = this.parentComponent, g = d && d.isAlive(); + g && d.getGui().classList.remove("ag-has-popup"), M.prototype.destroy.call(this); + }, f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var X3 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), F1 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Qx = ( + /** @class */ + function(M) { + X3(f, M); + function f() { + return M.call(this, f.TEMPLATE) || this; + } + return f.prototype.init = function(d) { + this.params = d, this.focusAfterAttached = d.cellStartedEdit, this.eTextArea.setMaxLength(d.maxLength || 200).setCols(d.cols || 60).setRows(d.rows || 10), i(d.value) && this.eTextArea.setValue(d.value.toString(), !0), this.addGuiEventListener("keydown", this.onKeyDown.bind(this)); + }, f.prototype.onKeyDown = function(d) { + var g = d.key; + (g === Hr.LEFT || g === Hr.UP || g === Hr.RIGHT || g === Hr.DOWN || d.shiftKey && g === Hr.ENTER) && d.stopPropagation(); + }, f.prototype.afterGuiAttached = function() { + var d = this.gridOptionsWrapper.getLocaleTextFunc(); + this.eTextArea.setInputAriaLabel(d("ariaInputEditor", "Input Editor")), this.focusAfterAttached && this.eTextArea.getFocusableElement().focus(); + }, f.prototype.getValue = function() { + return this.params.parseValue(this.eTextArea.getValue()); + }, f.TEMPLATE = `
+ +
`, F1([ + qr("eTextArea") + ], f.prototype, "eTextArea", void 0), f; + }(Zx) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var PC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Yb = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, qv = ( + /** @class */ + function(M) { + PC(f, M); + function f() { + var d = M.call(this, '
') || this; + return d.startedByEnter = !1, d; + } + return f.prototype.init = function(d) { + var g = this; + if (this.focusAfterAttached = d.cellStartedEdit, r(d.values)) { + console.warn("AG Grid: no values found for select cellEditor"); + return; + } + this.startedByEnter = d.eventKey != null ? d.eventKey === Hr.ENTER : !1; + var S = !1; + d.values.forEach(function(O) { + var z = { value: O }, te = g.valueFormatterService.formatValue(d.column, null, null, O), Fe = te != null; + z.text = Fe ? te : O, g.eSelect.addOption(z), S = S || d.value === O; + }), S ? this.eSelect.setValue(d.value, !0) : d.values.length && this.eSelect.setValue(d.values[0], !0), this.gridOptionsWrapper.isFullRowEdit() || this.eSelect.onValueChange(function() { + return d.stopEditing(); + }); + }, f.prototype.afterGuiAttached = function() { + this.focusAfterAttached && this.eSelect.getFocusableElement().focus(), this.startedByEnter && this.eSelect.showPicker(); + }, f.prototype.focusIn = function() { + this.eSelect.getFocusableElement().focus(); + }, f.prototype.getValue = function() { + return this.eSelect.getValue(); + }, f.prototype.isPopup = function() { + return !1; + }, Yb([ + pe("valueFormatterService") + ], f.prototype, "valueFormatterService", void 0), Yb([ + qr("eSelect") + ], f.prototype, "eSelect", void 0), f; + }(Zx) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var qg = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Yg = ( + /** @class */ + function(M) { + qg(f, M); + function f() { + var d = M.call(this) || this; + return Ge(function() { + return console.warn('AG Grid: The PopupSelectCellEditor (agPopupSelectCellEditor) is deprecated. Instead use {cellEditor: "agSelectCellEditor", cellEditorPopup: true} '); + }, "PopupSelectCellEditor.deprecated"), d; + } + return f.prototype.isPopup = function() { + return !0; + }, f; + }(qv) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var vl = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Lp = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Er = ( + /** @class */ + function(M) { + vl(f, M); + function f() { + return M.call(this, f.TEMPLATE) || this; + } + return f.prototype.init = function(d) { + this.params = d; + var g = this.eInput, S; + d.cellStartedEdit ? (this.focusAfterAttached = !0, d.eventKey === Hr.BACKSPACE || d.eventKey === Hr.DELETE ? S = "" : d.charPress ? S = d.charPress : (S = this.getStartValue(d), d.eventKey !== Hr.F2 && (this.highlightAllOnFocus = !0))) : (this.focusAfterAttached = !1, S = this.getStartValue(d)), S != null && g.setValue(S, !0), this.addManagedListener(g.getGui(), "keydown", function(O) { + var z = O.key; + (z === Hr.PAGE_UP || z === Hr.PAGE_DOWN) && O.preventDefault(); + }); + }, f.prototype.afterGuiAttached = function() { + var d = this.gridOptionsWrapper.getLocaleTextFunc(), g = this.eInput; + if (g.setInputAriaLabel(d("ariaInputEditor", "Input Editor")), !!this.focusAfterAttached) { + Mc() || g.getFocusableElement().focus(); + var S = g.getInputElement(); + if (this.highlightAllOnFocus) + S.select(); + else { + var O = g.getValue(), z = i(O) && O.length || 0; + z && S.setSelectionRange(z, z); + } + } + }, f.prototype.focusIn = function() { + var d = this.eInput, g = d.getFocusableElement(), S = d.getInputElement(); + g.focus(), S.select(); + }, f.prototype.getValue = function() { + var d = this.eInput; + return this.params.parseValue(d.getValue()); + }, f.prototype.getStartValue = function(d) { + var g = d.useFormatter || d.column.getColDef().refData; + return g ? d.formatValue(d.value) : d.value; + }, f.prototype.isPopup = function() { + return !1; + }, f.TEMPLATE = '
', Lp([ + qr("eInput") + ], f.prototype, "eInput", void 0), f; + }(Zx) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Yv = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), K3 = ( + /** @class */ + function(M) { + Yv(f, M); + function f() { + var d = M.call(this) || this; + return Ge(function() { + return console.warn('AG Grid: The PopupTextCellEditor (agPopupTextCellEditor) is deprecated. Instead use {cellEditor: "agTextCellEditor", cellEditorPopup: true} '); + }, "PopupTextCellEditor.deprecated"), d; + } + return f.prototype.isPopup = function() { + return !0; + }, f; + }(Er) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Xv = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), sA = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, OC = "↑", J3 = "↓", Xb = ( + /** @class */ + function(M) { + Xv(f, M); + function f() { + var d = M.call(this, f.TEMPLATE) || this; + return d.refreshCount = 0, d; + } + return f.prototype.init = function(d) { + this.eValue = this.queryForHtmlElement(".ag-value-change-value"), this.eDelta = this.queryForHtmlElement(".ag-value-change-delta"), this.refresh(d); + }, f.prototype.showDelta = function(d, g) { + var S = Math.abs(g), O = d.formatValue(S), z = i(O) ? O : S, te = g >= 0; + te ? this.eDelta.innerHTML = OC + z : this.eDelta.innerHTML = J3 + z, this.eDelta.classList.toggle("ag-value-change-delta-up", te), this.eDelta.classList.toggle("ag-value-change-delta-down", !te); + }, f.prototype.setTimerToRemoveDelta = function() { + var d = this; + this.refreshCount++; + var g = this.refreshCount; + window.setTimeout(function() { + g === d.refreshCount && d.hideDeltaValue(); + }, 2e3); + }, f.prototype.hideDeltaValue = function() { + this.eValue.classList.remove("ag-value-change-value-highlight"), Su(this.eDelta); + }, f.prototype.refresh = function(d) { + var g = d.value; + if (g === this.lastValue || (i(d.valueFormatted) ? this.eValue.innerHTML = d.valueFormatted : i(d.value) ? this.eValue.innerHTML = g : Su(this.eValue), this.filterManager.isSuppressFlashingCellsBecauseFiltering())) + return !1; + if (typeof g == "number" && typeof this.lastValue == "number") { + var S = g - this.lastValue; + this.showDelta(d, S); + } + return this.lastValue && this.eValue.classList.add("ag-value-change-value-highlight"), this.setTimerToRemoveDelta(), this.lastValue = g, !0; + }, f.TEMPLATE = '', sA([ + pe("filterManager") + ], f.prototype, "filterManager", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Te = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Ct = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Gt = ( + /** @class */ + function(M) { + Te(f, M); + function f() { + var d = M.call(this, f.TEMPLATE) || this; + return d.refreshCount = 0, d.eCurrent = d.queryForHtmlElement(".ag-value-slide-current"), d; + } + return f.prototype.init = function(d) { + this.refresh(d); + }, f.prototype.addSlideAnimation = function() { + var d = this; + this.refreshCount++; + var g = this.refreshCount; + this.ePrevious && this.getGui().removeChild(this.ePrevious), this.ePrevious = gu(''), this.ePrevious.innerHTML = this.eCurrent.innerHTML, this.getGui().insertBefore(this.ePrevious, this.eCurrent), window.setTimeout(function() { + g === d.refreshCount && d.ePrevious.classList.add("ag-value-slide-out-end"); + }, 50), window.setTimeout(function() { + g === d.refreshCount && (d.getGui().removeChild(d.ePrevious), d.ePrevious = null); + }, 3e3); + }, f.prototype.refresh = function(d) { + var g = d.value; + return r(g) && (g = ""), g === this.lastValue || this.filterManager.isSuppressFlashingCellsBecauseFiltering() ? !1 : (this.addSlideAnimation(), this.lastValue = g, i(d.valueFormatted) ? this.eCurrent.innerHTML = d.valueFormatted : i(d.value) ? this.eCurrent.innerHTML = g : Su(this.eCurrent), !0); + }, f.TEMPLATE = ` + + `, Ct([ + pe("filterManager") + ], f.prototype, "filterManager", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M[M.Above = 0] = "Above", M[M.Below = 1] = "Below"; + })(t.RowHighlightPosition || (t.RowHighlightPosition = {})); + var oi = ( + /** @class */ + function() { + function M(f) { + this.rowIndex = null, this.key = null, this.childrenMapped = {}, this.displayed = !1, this.rowTop = null, this.oldRowTop = null, this.selectable = !0, this.__objectId = M.OBJECT_ID_SEQUENCE++, this.__autoHeights = {}, this.alreadyRendered = !1, this.highlighted = null, this.selected = !1, this.onRowHeightChangedDebounced = It(this.onRowHeightChanged.bind(this), 100), this.beans = f; + } + return M.prototype.setData = function(f) { + this.setDataCommon(f, !1); + }, M.prototype.updateData = function(f) { + this.setDataCommon(f, !0); + }, M.prototype.setDataCommon = function(f, d) { + var g = this.data; + this.data = f, this.beans.valueCache.onDataChanged(), this.updateDataOnDetailNode(), this.checkRowSelectable(); + var S = this.createDataChangedEvent(f, g, d); + this.dispatchLocalEvent(S); + }, M.prototype.updateDataOnDetailNode = function() { + this.detailNode && (this.detailNode.data = this.data); + }, M.prototype.createDataChangedEvent = function(f, d, g) { + return { + type: M.EVENT_DATA_CHANGED, + node: this, + oldData: d, + newData: f, + update: g + }; + }, M.prototype.createLocalRowEvent = function(f) { + return { + type: f, + node: this + }; + }, M.prototype.getRowIndexString = function() { + return this.rowPinned === Ue.PINNED_TOP ? "t-" + this.rowIndex : this.rowPinned === Ue.PINNED_BOTTOM ? "b-" + this.rowIndex : this.rowIndex.toString(); + }, M.prototype.createDaemonNode = function() { + var f = new M(this.beans); + return f.id = this.id, f.data = this.data, f.daemon = !0, f.selected = this.selected, f.level = this.level, f; + }, M.prototype.setDataAndId = function(f, d) { + var g = i(this.id) ? this.createDaemonNode() : null, S = this.data; + this.data = f, this.updateDataOnDetailNode(), this.setId(d), this.beans.selectionService.syncInRowNode(this, g), this.checkRowSelectable(); + var O = this.createDataChangedEvent(f, S, !1); + this.dispatchLocalEvent(O); + }, M.prototype.checkRowSelectable = function() { + var f = this.beans.gridOptionsWrapper.getIsRowSelectableFunc(); + this.setRowSelectable(f ? f(this) : !0); + }, M.prototype.setRowSelectable = function(f) { + this.selectable !== f && (this.selectable = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_SELECTABLE_CHANGED))); + }, M.prototype.setId = function(f) { + var d = this.beans.gridOptionsWrapper.getRowIdFunc(); + if (d) + if (this.data) { + var g = this.getGroupKeys(!0); + this.id = d({ + data: this.data, + parentKeys: g.length > 0 ? g : void 0, + level: this.level + }), this.id !== null && typeof this.id == "string" && this.id.startsWith(M.ID_PREFIX_ROW_GROUP) && console.error("AG Grid: Row IDs cannot start with " + M.ID_PREFIX_ROW_GROUP + ", this is a reserved prefix for AG Grid's row grouping feature."), this.id !== null && typeof this.id != "string" && (this.id = "" + this.id); + } else + this.id = void 0; + else + this.id = f; + }, M.prototype.getGroupKeys = function(f) { + f === void 0 && (f = !1); + var d = [], g = this; + for (f && (g = g.parent); g && g.level >= 0; ) + d.push(g.key), g = g.parent; + return d.reverse(), d; + }, M.prototype.isPixelInRange = function(f) { + return !i(this.rowTop) || !i(this.rowHeight) ? !1 : f >= this.rowTop && f < this.rowTop + this.rowHeight; + }, M.prototype.setFirstChild = function(f) { + this.firstChild !== f && (this.firstChild = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_FIRST_CHILD_CHANGED))); + }, M.prototype.setLastChild = function(f) { + this.lastChild !== f && (this.lastChild = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_LAST_CHILD_CHANGED))); + }, M.prototype.setChildIndex = function(f) { + this.childIndex !== f && (this.childIndex = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_CHILD_INDEX_CHANGED))); + }, M.prototype.setRowTop = function(f) { + this.oldRowTop = this.rowTop, this.rowTop !== f && (this.rowTop = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_TOP_CHANGED)), this.setDisplayed(f !== null)); + }, M.prototype.clearRowTopAndRowIndex = function() { + this.oldRowTop = null, this.setRowTop(null), this.setRowIndex(null); + }, M.prototype.setDisplayed = function(f) { + this.displayed !== f && (this.displayed = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_DISPLAYED_CHANGED))); + }, M.prototype.setDragging = function(f) { + this.dragging !== f && (this.dragging = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_DRAGGING_CHANGED))); + }, M.prototype.setHighlighted = function(f) { + f !== this.highlighted && (this.highlighted = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_HIGHLIGHT_CHANGED))); + }, M.prototype.setAllChildrenCount = function(f) { + this.allChildrenCount !== f && (this.allChildrenCount = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_ALL_CHILDREN_COUNT_CHANGED))); + }, M.prototype.setMaster = function(f) { + this.master !== f && (this.master && !f && (this.expanded = !1), this.master = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_MASTER_CHANGED))); + }, M.prototype.setGroup = function(f) { + this.group !== f && (this.group && !f && (this.expanded = !1), this.group = f, this.updateHasChildren(), this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_GROUP_CHANGED))); + }, M.prototype.setRowHeight = function(f, d) { + d === void 0 && (d = !1), this.rowHeight = f, this.rowHeightEstimated = d, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_HEIGHT_CHANGED)); + }, M.prototype.setRowAutoHeight = function(f, d) { + this.__autoHeights || (this.__autoHeights = {}); + var g = this.__autoHeights; + g[d.getId()] = f, f != null && (this.checkAutoHeightsDebounced == null && (this.checkAutoHeightsDebounced = It(this.checkAutoHeights.bind(this), 1)), this.checkAutoHeightsDebounced()); + }, M.prototype.checkAutoHeights = function() { + var f = !1, d = !0, g = 0, S = this.__autoHeights; + if (S != null) { + var O = this.beans.columnModel.getAllDisplayedAutoHeightCols(); + O.forEach(function(z) { + var te = S[z.getId()]; + if (te == null) { + f = !0; + return; + } + d = !1, te > g && (g = te); + }), !f && ((d || g < 10) && (g = this.beans.gridOptionsWrapper.getRowHeightForNode(this).height), g != this.rowHeight && (this.setRowHeight(g), this.onRowHeightChangedDebounced())); + } + }, M.prototype.onRowHeightChanged = function() { + var f = this.beans.rowModel; + f.onRowHeightChanged && f.onRowHeightChanged(); + }, M.prototype.setRowIndex = function(f) { + this.rowIndex !== f && (this.rowIndex = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_ROW_INDEX_CHANGED))); + }, M.prototype.setUiLevel = function(f) { + this.uiLevel !== f && (this.uiLevel = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_UI_LEVEL_CHANGED))); + }, M.prototype.setExpanded = function(f, d) { + if (this.expanded !== f) { + this.expanded = f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_EXPANDED_CHANGED)); + var g = Object.assign({}, this.createGlobalRowEvent(ui.EVENT_ROW_GROUP_OPENED), { + expanded: f, + event: d || null + }); + this.beans.rowNodeEventThrottle.dispatchExpanded(g), this.beans.gridOptionsWrapper.isGroupIncludeFooter() && this.beans.rowRenderer.refreshCells({ rowNodes: [this] }); + } + }, M.prototype.createGlobalRowEvent = function(f) { + return { + type: f, + node: this, + data: this.data, + rowIndex: this.rowIndex, + rowPinned: this.rowPinned, + context: this.beans.gridOptionsWrapper.getContext(), + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi() + }; + }, M.prototype.dispatchLocalEvent = function(f) { + this.eventService && this.eventService.dispatchEvent(f); + }, M.prototype.setDataValue = function(f, d, g) { + var S = this.beans.columnModel.getPrimaryColumn(f), O = this.beans.valueService.getValue(S, this), z = this.beans.valueService.setValue(this, S, d, g); + return this.dispatchCellChangedEvent(S, d, O), z; + }, M.prototype.setGroupValue = function(f, d) { + var g = this.beans.columnModel.getGridColumn(f); + r(this.groupData) && (this.groupData = {}); + var S = g.getColId(), O = this.groupData[S]; + O !== d && (this.groupData[S] = d, this.dispatchCellChangedEvent(g, d, O)); + }, M.prototype.setAggData = function(f) { + var d = this, g = Q([this.aggData, f]), S = this.aggData; + this.aggData = f, this.eventService && g.forEach(function(O) { + var z = d.beans.columnModel.getGridColumn(O), te = d.aggData ? d.aggData[O] : void 0, Fe = S ? S[O] : void 0; + d.dispatchCellChangedEvent(z, te, Fe); + }); + }, M.prototype.updateHasChildren = function() { + var f = this.group && !this.footer || this.childrenAfterGroup && this.childrenAfterGroup.length > 0; + f !== this.__hasChildren && (this.__hasChildren = !!f, this.eventService && this.eventService.dispatchEvent(this.createLocalRowEvent(M.EVENT_HAS_CHILDREN_CHANGED))); + }, M.prototype.hasChildren = function() { + return this.__hasChildren == null && this.updateHasChildren(), this.__hasChildren; + }, M.prototype.isEmptyRowGroupNode = function() { + return this.group && n(this.childrenAfterGroup); + }, M.prototype.dispatchCellChangedEvent = function(f, d, g) { + var S = { + type: M.EVENT_CELL_CHANGED, + node: this, + column: f, + newValue: d, + oldValue: g + }; + this.dispatchLocalEvent(S); + }, M.prototype.resetQuickFilterAggregateText = function() { + this.quickFilterAggregateText = null; + }, M.prototype.isExpandable = function() { + return !!(this.hasChildren() && !this.footer || this.master); + }, M.prototype.isSelected = function() { + return this.footer ? this.sibling.isSelected() : this.selected; + }, M.prototype.depthFirstSearch = function(f) { + this.childrenAfterGroup && this.childrenAfterGroup.forEach(function(d) { + return d.depthFirstSearch(f); + }), f(this); + }, M.prototype.calculateSelectedFromChildren = function() { + var f, d = !1, g = !1, S = !1, O; + if (!((f = this.childrenAfterGroup) === null || f === void 0) && f.length) { + for (var z = 0; z < this.childrenAfterGroup.length; z++) { + var te = this.childrenAfterGroup[z]; + if (te.selectable) { + var Fe = te.isSelected(); + switch (Fe) { + case !0: + d = !0; + break; + case !1: + g = !0; + break; + default: + S = !0; + break; + } + } + } + S ? O = void 0 : d && !g ? O = !0 : !d && g ? O = !1 : O = void 0, this.selectThisNode(O); + } + }, M.prototype.setSelectedInitialValue = function(f) { + this.selected = f; + }, M.prototype.setSelected = function(f, d, g) { + d === void 0 && (d = !1), g === void 0 && (g = !1), this.setSelectedParams({ + newValue: f, + clearSelection: d, + suppressFinishActions: g, + rangeSelect: !1 + }); + }, M.prototype.isRowPinned = function() { + return this.rowPinned === Ue.PINNED_TOP || this.rowPinned === Ue.PINNED_BOTTOM; + }, M.prototype.setSelectedParams = function(f) { + var d, g = this.beans.gridOptionsWrapper.isGroupSelectsChildren(), S = f.newValue === !0, O = f.clearSelection === !0, z = f.suppressFinishActions === !0, te = f.rangeSelect === !0, Fe = g && f.groupSelectsFiltered === !0; + if (this.id === void 0) + return console.warn("AG Grid: cannot select node until id for node is known"), 0; + if (this.rowPinned) + return console.warn("AG Grid: cannot select pinned rows"), 0; + if (this.footer) + return this.sibling.setSelectedParams(f); + if (te && this.beans.selectionService.getLastSelectedNode()) { + var ze = this.beans.selectionService.getLastSelectedNode() !== this, ht = this.beans.gridOptionsWrapper.isRowSelectionMulti(); + if (ze && ht) { + var Lt = this.doRowRangeSelection(f.newValue); + return this.beans.selectionService.setLastSelectedNode(this), Lt; + } + } + var ti = 0, wi = Fe && this.group; + if (!wi) { + var Ti = this.selectThisNode(S); + Ti && ti++; + } + if (g && (!((d = this.childrenAfterGroup) === null || d === void 0) && d.length) && (ti += this.selectChildNodes(S, Fe)), !z) { + var qi = S && (O || !this.beans.gridOptionsWrapper.isRowSelectionMulti()); + if (qi && (ti += this.beans.selectionService.clearOtherNodes(this)), ti > 0) { + this.beans.selectionService.updateGroupsFromChildrenSelections(); + var dr = { + type: ui.EVENT_SELECTION_CHANGED, + api: this.beans.gridApi, + columnApi: this.beans.columnApi + }; + this.beans.eventService.dispatchEvent(dr); + } + S && this.beans.selectionService.setLastSelectedNode(this); + } + return ti; + }, M.prototype.doRowRangeSelection = function(f) { + var d = this; + f === void 0 && (f = !0); + var g = this.beans.gridOptionsWrapper.isGroupSelectsChildren(), S = this.beans.selectionService.getLastSelectedNode(), O = this.beans.rowModel.getNodesInRangeForSelection(this, S), z = 0; + O.forEach(function(Fe) { + if (!(Fe.group && g || f === !1 && d === Fe)) { + var ze = Fe.selectThisNode(f); + ze && z++; + } + }), this.beans.selectionService.updateGroupsFromChildrenSelections(); + var te = { + type: ui.EVENT_SELECTION_CHANGED, + api: this.beans.gridApi, + columnApi: this.beans.columnApi + }; + return this.beans.eventService.dispatchEvent(te), z; + }, M.prototype.isParentOfNode = function(f) { + for (var d = this.parent; d; ) { + if (d === f) + return !0; + d = d.parent; + } + return !1; + }, M.prototype.selectThisNode = function(f) { + var d = !this.selectable && f, g = this.selected === f; + if (d || g) + return !1; + this.selected = f, this.eventService && this.dispatchLocalEvent(this.createLocalRowEvent(M.EVENT_ROW_SELECTED)); + var S = this.createGlobalRowEvent(ui.EVENT_ROW_SELECTED); + return this.beans.eventService.dispatchEvent(S), !0; + }, M.prototype.selectChildNodes = function(f, d) { + var g = d ? this.childrenAfterAggFilter : this.childrenAfterGroup; + if (r(g)) + return 0; + for (var S = 0, O = 0; O < g.length; O++) + S += g[O].setSelectedParams({ + newValue: f, + clearSelection: !1, + suppressFinishActions: !0, + groupSelectsFiltered: d + }); + return S; + }, M.prototype.addEventListener = function(f, d) { + this.eventService || (this.eventService = new mt()), this.eventService.addEventListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + this.eventService && (this.eventService.removeEventListener(f, d), this.eventService.noRegisteredListenersExist() && (this.eventService = null)); + }, M.prototype.onMouseEnter = function() { + this.dispatchLocalEvent(this.createLocalRowEvent(M.EVENT_MOUSE_ENTER)); + }, M.prototype.onMouseLeave = function() { + this.dispatchLocalEvent(this.createLocalRowEvent(M.EVENT_MOUSE_LEAVE)); + }, M.prototype.getFirstChildOfFirstChild = function(f) { + for (var d = this, g = !0, S = !1, O = null; g && !S; ) { + var z = d.parent, te = i(z) && d.firstChild; + te ? z.rowGroupColumn === f && (S = !0, O = z) : g = !1, d = z; + } + return S ? O : null; + }, M.prototype.isFullWidthCell = function() { + var f = this.beans.gridOptionsWrapper.getIsFullWidthCellFunc(); + return f ? f({ rowNode: this }) : !1; + }, M.prototype.getRoute = function() { + if (this.key != null) { + for (var f = [], d = this; d.key != null; ) + f.push(d.key), d = d.parent; + return f.reverse(); + } + }, M.ID_PREFIX_ROW_GROUP = "row-group-", M.ID_PREFIX_TOP_PINNED = "t-", M.ID_PREFIX_BOTTOM_PINNED = "b-", M.OBJECT_ID_SEQUENCE = 0, M.EVENT_ROW_SELECTED = "rowSelected", M.EVENT_DATA_CHANGED = "dataChanged", M.EVENT_CELL_CHANGED = "cellChanged", M.EVENT_ALL_CHILDREN_COUNT_CHANGED = "allChildrenCountChanged", M.EVENT_MASTER_CHANGED = "masterChanged", M.EVENT_GROUP_CHANGED = "groupChanged", M.EVENT_MOUSE_ENTER = "mouseEnter", M.EVENT_MOUSE_LEAVE = "mouseLeave", M.EVENT_HEIGHT_CHANGED = "heightChanged", M.EVENT_TOP_CHANGED = "topChanged", M.EVENT_DISPLAYED_CHANGED = "displayedChanged", M.EVENT_FIRST_CHILD_CHANGED = "firstChildChanged", M.EVENT_LAST_CHILD_CHANGED = "lastChildChanged", M.EVENT_CHILD_INDEX_CHANGED = "childIndexChanged", M.EVENT_ROW_INDEX_CHANGED = "rowIndexChanged", M.EVENT_EXPANDED_CHANGED = "expandedChanged", M.EVENT_HAS_CHILDREN_CHANGED = "hasChildrenChanged", M.EVENT_SELECTABLE_CHANGED = "selectableChanged", M.EVENT_UI_LEVEL_CHANGED = "uiLevelChanged", M.EVENT_HIGHLIGHT_CHANGED = "rowHighlightChanged", M.EVENT_DRAGGING_CHANGED = "draggingChanged", M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Hn = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), _l = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Ku = ( + /** @class */ + function(M) { + Hn(f, M); + function f() { + return M.call( + this, + /* html*/ + ` + ` + ) || this; + } + return f.prototype.postConstruct = function() { + this.eCheckbox.setPassive(!0); + }, f.prototype.getCheckboxId = function() { + return this.eCheckbox.getInputElement().id; + }, f.prototype.onDataChanged = function() { + this.onSelectionChanged(); + }, f.prototype.onSelectableChanged = function() { + this.showOrHideSelect(); + }, f.prototype.onSelectionChanged = function() { + var d = this.gridOptionsWrapper.getLocaleTextFunc(), g = this.rowNode.isSelected(), S = g === void 0 ? d("ariaIndeterminate", "indeterminate") : g === !0 ? d("ariaChecked", "checked") : d("ariaUnchecked", "unchecked"), O = d("ariaRowToggleSelection", "Press Space to toggle row selection"); + this.eCheckbox.setValue(g, !0), this.eCheckbox.setInputAriaLabel(O + " (" + S + ")"); + }, f.prototype.onCheckedClicked = function(d) { + var g = this.gridOptionsWrapper.isGroupSelectsFiltered(), S = this.rowNode.setSelectedParams({ newValue: !1, rangeSelect: d.shiftKey, groupSelectsFiltered: g }); + return S; + }, f.prototype.onUncheckedClicked = function(d) { + var g = this.gridOptionsWrapper.isGroupSelectsFiltered(), S = this.rowNode.setSelectedParams({ newValue: !0, rangeSelect: d.shiftKey, groupSelectsFiltered: g }); + return S; + }, f.prototype.init = function(d) { + var g = this; + this.rowNode = d.rowNode, this.column = d.column, this.onSelectionChanged(), this.addGuiEventListener("click", function(te) { + return Ri(te); + }), this.addGuiEventListener("dblclick", function(te) { + return Ri(te); + }), this.addManagedListener(this.eCheckbox.getInputElement(), "click", function(te) { + var Fe = g.eCheckbox.getValue(), ze = g.eCheckbox.getPreviousValue(); + if (ze === void 0 || Fe === void 0) { + var ht = g.onUncheckedClicked(te || {}); + ht === 0 && g.onCheckedClicked(te); + } else + Fe ? g.onCheckedClicked(te) : g.onUncheckedClicked(te || {}); + }), this.addManagedListener(this.rowNode, oi.EVENT_ROW_SELECTED, this.onSelectionChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_DATA_CHANGED, this.onDataChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_SELECTABLE_CHANGED, this.onSelectableChanged.bind(this)); + var S = this.gridOptionsWrapper.getIsRowSelectableFunc(), O = S || this.checkboxCallbackExists(); + if (O) { + var z = this.showOrHideSelect.bind(this); + this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, z), this.addManagedListener(this.rowNode, oi.EVENT_DATA_CHANGED, z), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, z), this.showOrHideSelect(); + } + this.eCheckbox.getInputElement().setAttribute("tabindex", "-1"); + }, f.prototype.showOrHideSelect = function() { + var d = this.rowNode.selectable; + d && this.checkboxCallbackExists() && (d = this.column.isCellCheckboxSelection(this.rowNode)), this.setVisible(d); + }, f.prototype.checkboxCallbackExists = function() { + var d = this.column ? this.column.getColDef() : null; + return !!d && typeof d.checkboxSelection == "function"; + }, _l([ + qr("eCheckbox") + ], f.prototype, "eCheckbox", void 0), _l([ + ct + ], f.prototype, "postConstruct", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var zc = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), RC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, yre = function(M) { + var f = typeof Symbol == "function" && Symbol.iterator, d = f && M[f], g = 0; + if (d) + return d.call(M); + if (M && typeof M.length == "number") + return { + next: function() { + return M && g >= M.length && (M = void 0), { value: M && M[g++], done: !M }; + } + }; + throw new TypeError(f ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + (function(M) { + M[M.ToolPanel = 0] = "ToolPanel", M[M.HeaderCell = 1] = "HeaderCell", M[M.RowDrag = 2] = "RowDrag", M[M.ChartPanel = 3] = "ChartPanel"; + })(t.DragSourceType || (t.DragSourceType = {})), function(M) { + M[M.Up = 0] = "Up", M[M.Down = 1] = "Down"; + }(t.VerticalDirection || (t.VerticalDirection = {})), function(M) { + M[M.Left = 0] = "Left", M[M.Right = 1] = "Right"; + }(t.HorizontalDirection || (t.HorizontalDirection = {})); + var fg = ( + /** @class */ + function(M) { + zc(f, M); + function f() { + var g = M !== null && M.apply(this, arguments) || this; + return g.dragSourceAndParamsList = [], g.dropTargets = [], g; + } + d = f, f.prototype.init = function() { + this.ePinnedIcon = rt("columnMovePin", this.gridOptionsWrapper, null), this.eHideIcon = rt("columnMoveHide", this.gridOptionsWrapper, null), this.eMoveIcon = rt("columnMoveMove", this.gridOptionsWrapper, null), this.eLeftIcon = rt("columnMoveLeft", this.gridOptionsWrapper, null), this.eRightIcon = rt("columnMoveRight", this.gridOptionsWrapper, null), this.eGroupIcon = rt("columnMoveGroup", this.gridOptionsWrapper, null), this.eAggregateIcon = rt("columnMoveValue", this.gridOptionsWrapper, null), this.ePivotIcon = rt("columnMovePivot", this.gridOptionsWrapper, null), this.eDropNotAllowedIcon = rt("dropNotAllowed", this.gridOptionsWrapper, null); + }, f.prototype.addDragSource = function(g, S) { + S === void 0 && (S = !1); + var O = { + eElement: g.eElement, + dragStartPixels: g.dragStartPixels, + onDragStart: this.onDragStart.bind(this, g), + onDragStop: this.onDragStop.bind(this), + onDragging: this.onDragging.bind(this) + }; + this.dragSourceAndParamsList.push({ params: O, dragSource: g }), this.dragService.addDragSource(O, S); + }, f.prototype.removeDragSource = function(g) { + var S = this.dragSourceAndParamsList.find(function(O) { + return O.dragSource === g; + }); + S && (this.dragService.removeDragSource(S.params), q(this.dragSourceAndParamsList, S)); + }, f.prototype.clearDragSourceParamsList = function() { + var g = this; + this.dragSourceAndParamsList.forEach(function(S) { + return g.dragService.removeDragSource(S.params); + }), this.dragSourceAndParamsList.length = 0; + }, f.prototype.nudge = function() { + this.dragging && this.onDragging(this.eventLastTime, !0); + }, f.prototype.onDragStart = function(g, S) { + this.dragging = !0, this.dragSource = g, this.eventLastTime = S, this.dragItem = this.dragSource.getDragItem(), this.lastDropTarget = this.dragSource.dragSourceDropTarget, this.dragSource.onDragStarted && this.dragSource.onDragStarted(), this.createGhost(); + }, f.prototype.onDragStop = function(g) { + if (this.eventLastTime = null, this.dragging = !1, this.dragSource.onDragStopped && this.dragSource.onDragStopped(), this.lastDropTarget && this.lastDropTarget.onDragStop) { + var S = this.createDropTargetEvent(this.lastDropTarget, g, null, null, !1); + this.lastDropTarget.onDragStop(S); + } + this.lastDropTarget = null, this.dragItem = null, this.removeGhost(); + }, f.prototype.onDragging = function(g, S) { + var O = this, z = this.getHorizontalDirection(g), te = this.getVerticalDirection(g); + this.eventLastTime = g, this.positionGhost(g); + var Fe = this.dropTargets.filter(function(ti) { + return O.isMouseOnDropTarget(g, ti); + }), ze = Fe.length, ht = null; + if (ze > 0 && (ht = ze === 1 ? Fe[0] : Fe.reduce(function(ti, wi) { + if (!ti) + return wi; + var Ti = ti.getContainer(), qi = wi.getContainer(); + return Ti.contains(qi) ? wi : ti; + })), ht !== this.lastDropTarget) + this.leaveLastTargetIfExists(g, z, te, S), this.enterDragTargetIfExists(ht, g, z, te, S), this.lastDropTarget = ht; + else if (ht && ht.onDragging) { + var Lt = this.createDropTargetEvent(ht, g, z, te, S); + ht.onDragging(Lt); + } + }, f.prototype.enterDragTargetIfExists = function(g, S, O, z, te) { + if (g) { + if (g.onDragEnter) { + var Fe = this.createDropTargetEvent(g, S, O, z, te); + g.onDragEnter(Fe); + } + this.setGhostIcon(g.getIconName ? g.getIconName() : null); + } + }, f.prototype.leaveLastTargetIfExists = function(g, S, O, z) { + if (this.lastDropTarget) { + if (this.lastDropTarget.onDragLeave) { + var te = this.createDropTargetEvent(this.lastDropTarget, g, S, O, z); + this.lastDropTarget.onDragLeave(te); + } + this.setGhostIcon(null); + } + }, f.prototype.getAllContainersFromDropTarget = function(g) { + var S = g.getSecondaryContainers ? g.getSecondaryContainers() : null, O = [[g.getContainer()]]; + return S ? O.concat(S) : O; + }, f.prototype.allContainersIntersect = function(g, S) { + var O, z; + try { + for (var te = yre(S), Fe = te.next(); !Fe.done; Fe = te.next()) { + var ze = Fe.value, ht = ze.getBoundingClientRect(); + if (ht.width === 0 || ht.height === 0) + return !1; + var Lt = g.clientX >= ht.left && g.clientX < ht.right, ti = g.clientY >= ht.top && g.clientY < ht.bottom; + if (!Lt || !ti) + return !1; + } + } catch (wi) { + O = { error: wi }; + } finally { + try { + Fe && !Fe.done && (z = te.return) && z.call(te); + } finally { + if (O) + throw O.error; + } + } + return !0; + }, f.prototype.isMouseOnDropTarget = function(g, S) { + var O, z, te = this.getAllContainersFromDropTarget(S), Fe = !1; + try { + for (var ze = yre(te), ht = ze.next(); !ht.done; ht = ze.next()) { + var Lt = ht.value; + if (this.allContainersIntersect(g, Lt)) { + Fe = !0; + break; + } + } + } catch (ti) { + O = { error: ti }; + } finally { + try { + ht && !ht.done && (z = ze.return) && z.call(ze); + } finally { + if (O) + throw O.error; + } + } + return S.targetContainsSource && !S.getContainer().contains(this.dragSource.eElement) ? !1 : Fe && S.isInterestedIn(this.dragSource.type, this.dragSource.eElement); + }, f.prototype.addDropTarget = function(g) { + this.dropTargets.push(g); + }, f.prototype.removeDropTarget = function(g) { + this.dropTargets = this.dropTargets.filter(function(S) { + return S.getContainer() !== g.getContainer(); + }); + }, f.prototype.hasExternalDropZones = function() { + return this.dropTargets.some(function(g) { + return g.external; + }); + }, f.prototype.findExternalZone = function(g) { + var S = this.dropTargets.filter(function(O) { + return O.external; + }); + return S.find(function(O) { + return O.getContainer() === g.getContainer(); + }) || null; + }, f.prototype.getHorizontalDirection = function(g) { + var S = this.eventLastTime && this.eventLastTime.clientX, O = g.clientX; + return S === O ? null : S > O ? t.HorizontalDirection.Left : t.HorizontalDirection.Right; + }, f.prototype.getVerticalDirection = function(g) { + var S = this.eventLastTime && this.eventLastTime.clientY, O = g.clientY; + return S === O ? null : S > O ? t.VerticalDirection.Up : t.VerticalDirection.Down; + }, f.prototype.createDropTargetEvent = function(g, S, O, z, te) { + var Fe = g.getContainer(), ze = Fe.getBoundingClientRect(), ht = this, Lt = ht.gridApi, ti = ht.columnApi, wi = ht.dragItem, Ti = ht.dragSource, qi = S.clientX - ze.left, dr = S.clientY - ze.top; + return { event: S, x: qi, y: dr, vDirection: z, hDirection: O, dragSource: Ti, fromNudge: te, dragItem: wi, api: Lt, columnApi: ti, dropZoneTarget: Fe }; + }, f.prototype.positionGhost = function(g) { + var S = this.eGhost; + if (S) { + var O = S.getBoundingClientRect(), z = O.height, te = yh() - 2, Fe = ag() - 2, ze = g.pageY - z / 2, ht = g.pageX - 10, Lt = this.gridOptionsWrapper.getDocument(), ti = Lt.defaultView || window, wi = ti.pageYOffset || Lt.documentElement.scrollTop, Ti = ti.pageXOffset || Lt.documentElement.scrollLeft; + te > 0 && ht + S.clientWidth > te + Ti && (ht = te + Ti - S.clientWidth), ht < 0 && (ht = 0), Fe > 0 && ze + S.clientHeight > Fe + wi && (ze = Fe + wi - S.clientHeight), ze < 0 && (ze = 0), S.style.left = ht + "px", S.style.top = ze + "px"; + } + }, f.prototype.removeGhost = function() { + this.eGhost && this.eGhostParent && this.eGhostParent.removeChild(this.eGhost), this.eGhost = null; + }, f.prototype.createGhost = function() { + this.eGhost = gu(d.GHOST_TEMPLATE); + var g = this.environment.getTheme().theme; + g && this.eGhost.classList.add(g), this.eGhostIcon = this.eGhost.querySelector(".ag-dnd-ghost-icon"), this.setGhostIcon(null); + var S = this.eGhost.querySelector(".ag-dnd-ghost-label"), O = this.dragSource.dragItemName; + Qe(O) && (O = O()), S.innerHTML = _t(O) || "", this.eGhost.style.height = "25px", this.eGhost.style.top = "20px", this.eGhost.style.left = "20px"; + var z = this.gridOptionsWrapper.getDocument(), te = null; + try { + te = z.fullscreenElement; + } catch { + } finally { + te || (te = z.querySelector("body")); + } + this.eGhostParent = te, this.eGhostParent ? this.eGhostParent.appendChild(this.eGhost) : console.warn("AG Grid: could not find document body, it is needed for dragging columns"); + }, f.prototype.setGhostIcon = function(g, S) { + S === void 0 && (S = !1), Su(this.eGhostIcon); + var O = null; + switch (g || (g = this.dragSource.defaultIconName || d.ICON_NOT_ALLOWED), g) { + case d.ICON_PINNED: + O = this.ePinnedIcon; + break; + case d.ICON_MOVE: + O = this.eMoveIcon; + break; + case d.ICON_LEFT: + O = this.eLeftIcon; + break; + case d.ICON_RIGHT: + O = this.eRightIcon; + break; + case d.ICON_GROUP: + O = this.eGroupIcon; + break; + case d.ICON_AGGREGATE: + O = this.eAggregateIcon; + break; + case d.ICON_PIVOT: + O = this.ePivotIcon; + break; + case d.ICON_NOT_ALLOWED: + O = this.eDropNotAllowedIcon; + break; + case d.ICON_HIDE: + O = this.eHideIcon; + break; + } + this.eGhostIcon.classList.toggle("ag-shake-left-to-right", S), !(O === this.eHideIcon && this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns()) && O && this.eGhostIcon.appendChild(O); + }; + var d; + return f.ICON_PINNED = "pinned", f.ICON_MOVE = "move", f.ICON_LEFT = "left", f.ICON_RIGHT = "right", f.ICON_GROUP = "group", f.ICON_AGGREGATE = "aggregate", f.ICON_PIVOT = "pivot", f.ICON_NOT_ALLOWED = "notAllowed", f.ICON_HIDE = "hide", f.GHOST_TEMPLATE = `
+ +
+
`, RC([ + pe("dragService") + ], f.prototype, "dragService", void 0), RC([ + pe("environment") + ], f.prototype, "environment", void 0), RC([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), RC([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), RC([ + ct + ], f.prototype, "init", null), RC([ + gt + ], f.prototype, "clearDragSourceParamsList", null), f = d = RC([ + Ne("dragAndDropService") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var lc = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), so = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, MC = ( + /** @class */ + function(M) { + lc(f, M); + function f(d, g, S, O, z, te) { + var Fe = M.call(this) || this; + return Fe.cellValueFn = d, Fe.rowNode = g, Fe.column = S, Fe.customGui = O, Fe.dragStartPixels = z, Fe.suppressVisibilityChange = te, Fe.dragSource = null, Fe; + } + return f.prototype.isCustomGui = function() { + return this.customGui != null; + }, f.prototype.postConstruct = function() { + if (this.customGui ? this.setDragElement(this.customGui, this.dragStartPixels) : (this.setTemplate( + /* html */ + '' + ), this.getGui().appendChild(Xl("rowDrag", this.beans.gridOptionsWrapper, null)), this.addDragSource()), this.checkCompatibility(), !this.suppressVisibilityChange) { + var d = this.beans.gridOptionsWrapper.isRowDragManaged() ? new qo(this, this.beans, this.rowNode, this.column) : new vre(this, this.beans, this.rowNode, this.column); + this.createManagedBean(d, this.beans.context); + } + }, f.prototype.setDragElement = function(d, g) { + this.setTemplateFromElement(d), this.addDragSource(g); + }, f.prototype.getSelectedCount = function() { + var d = this.beans.gridOptionsWrapper.isRowDragMultiRow(); + if (!d) + return 1; + var g = this.beans.selectionService.getSelectedNodes(); + return g.indexOf(this.rowNode) !== -1 ? g.length : 1; + }, f.prototype.checkCompatibility = function() { + var d = this.beans.gridOptionsWrapper.isRowDragManaged(), g = this.beans.gridOptionsWrapper.isTreeData(); + g && d && Ge(function() { + return console.warn("AG Grid: If using row drag with tree data, you cannot have rowDragManaged=true"); + }, "RowDragComp.managedAndTreeData"); + }, f.prototype.addDragSource = function(d) { + var g = this; + d === void 0 && (d = 4), this.dragSource && this.removeDragSource(); + var S = { + rowNode: this.rowNode, + columns: this.column ? [this.column] : void 0, + defaultTextValue: this.cellValueFn() + }, O = this.column && this.column.getColDef().rowDragText, z = this.gridOptionsWrapper.getLocaleTextFunc(); + this.dragSource = { + type: t.DragSourceType.RowDrag, + eElement: this.getGui(), + dragItemName: function() { + var te = g.getSelectedCount(); + return O ? O(S, te) : te === 1 ? g.cellValueFn() : te + " " + z("rowDragRows", "rows"); + }, + getDragItem: function() { + return S; + }, + dragStartPixels: d, + dragSourceDomDataKey: this.beans.gridOptionsWrapper.getDomDataKey() + }, this.beans.dragAndDropService.addDragSource(this.dragSource, !0); + }, f.prototype.removeDragSource = function() { + this.dragSource && this.beans.dragAndDropService.removeDragSource(this.dragSource), this.dragSource = null; + }, so([ + pe("beans") + ], f.prototype, "beans", void 0), so([ + ct + ], f.prototype, "postConstruct", null), so([ + gt + ], f.prototype, "removeDragSource", null), f; + }(ba) + ), Qn = ( + /** @class */ + function(M) { + lc(f, M); + function f(d, g, S) { + var O = M.call(this) || this; + return O.parent = d, O.rowNode = g, O.column = S, O; + } + return f.prototype.setDisplayedOrVisible = function(d) { + if (d) + this.parent.setDisplayed(!1); + else { + var g = !0, S = !1; + this.column && (g = this.column.isRowDrag(this.rowNode) || this.parent.isCustomGui(), S = Qe(this.column.getColDef().rowDrag)), S ? (this.parent.setDisplayed(!0), this.parent.setVisible(g)) : (this.parent.setDisplayed(g), this.parent.setVisible(!0)); + } + }, f; + }(ki) + ), vre = ( + /** @class */ + function(M) { + lc(f, M); + function f(d, g, S, O) { + var z = M.call(this, d, S, O) || this; + return z.beans = g, z; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.beans.gridOptionsWrapper, "suppressRowDrag", this.onSuppressRowDrag.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.beans.eventService, ui.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this)), this.workOutVisibility(); + }, f.prototype.onSuppressRowDrag = function() { + this.workOutVisibility(); + }, f.prototype.workOutVisibility = function() { + var d = this.beans.gridOptionsWrapper.isSuppressRowDrag(); + this.setDisplayedOrVisible(d); + }, so([ + ct + ], f.prototype, "postConstruct", null), f; + }(Qn) + ), qo = ( + /** @class */ + function(M) { + lc(f, M); + function f(d, g, S, O) { + var z = M.call(this, d, S, O) || this; + return z.beans = g, z; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.beans.eventService, ui.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.beans.eventService, ui.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.beans.eventService, ui.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.beans.eventService, ui.EVENT_NEW_COLUMNS_LOADED, this.workOutVisibility.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this)), this.addManagedListener(this.beans.gridOptionsWrapper, "suppressRowDrag", this.onSuppressRowDrag.bind(this)), this.workOutVisibility(); + }, f.prototype.onSuppressRowDrag = function() { + this.workOutVisibility(); + }, f.prototype.workOutVisibility = function() { + var d = this.beans.ctrlsService.getGridBodyCtrl(), g = d.getRowDragFeature(), S = g && g.shouldPreventRowMove(), O = this.beans.gridOptionsWrapper.isSuppressRowDrag(), z = this.beans.dragAndDropService.hasExternalDropZones(), te = S && !z || O; + this.setDisplayedOrVisible(te); + }, so([ + ct + ], f.prototype, "postConstruct", null), f; + }(Qn) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var fH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), j8 = function() { + return j8 = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, j8.apply(this, arguments); + }, e2 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, oA = ( + /** @class */ + function(M) { + fH(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.init = function(d, g, S, O, z, te, Fe) { + this.params = Fe, this.eGui = g, this.eCheckbox = S, this.eExpanded = O, this.eContracted = z, this.comp = d, this.compClass = te; + var ze = this.isTopLevelFooter(), ht = this.isEmbeddedRowMismatch(), Lt = Fe.value == null, ti = !1; + if (this.gridOptionsWrapper.isGroupIncludeFooter() && this.gridOptionsWrapper.isGroupHideOpenParents()) { + var wi = Fe.node; + if (wi.footer) { + var Ti = Fe.colDef && Fe.colDef.showRowGroup, qi = wi.rowGroupColumn && wi.rowGroupColumn.getColId(); + ti = Ti !== qi; + } + } + this.cellIsBlank = ze ? !1 : ht || Lt || ti, !this.cellIsBlank && (this.setupShowingValueForOpenedParent(), this.findDisplayedGroupNode(), this.addFullWidthRowDraggerIfNeeded(), this.addExpandAndContract(), this.addCheckboxIfNeeded(), this.addValueElement(), this.setupIndent(), this.refreshAriaExpanded()); + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this), this.expandListener = null; + }, f.prototype.refreshAriaExpanded = function() { + var d = this.params, g = d.node, S = d.eParentOfValue; + if (this.expandListener && (this.expandListener = this.expandListener()), !this.isExpandable()) { + Gc(S); + return; + } + var O = function() { + yo(S, !!g.expanded); + }; + this.expandListener = this.addManagedListener(g, oi.EVENT_EXPANDED_CHANGED, O) || null, O(); + }, f.prototype.isTopLevelFooter = function() { + if (!this.gridOptionsWrapper.isGroupIncludeTotalFooter() || this.params.value != null || this.params.node.level != -1) + return !1; + var d = this.params.colDef, g = d == null; + if (g || d.showRowGroup === !0) + return !0; + var S = this.columnModel.getRowGroupColumns(); + if (!S || S.length === 0) + return !0; + var O = S[0]; + return O.getId() === d.showRowGroup; + }, f.prototype.isEmbeddedRowMismatch = function() { + if (!this.params.fullWidth || !this.gridOptionsWrapper.isEmbedFullWidthRows()) + return !1; + var d = this.params.pinned === Ue.PINNED_LEFT, g = this.params.pinned === Ue.PINNED_RIGHT, S = !d && !g; + return this.gridOptionsWrapper.isEnableRtl() ? this.columnModel.isPinningLeft() ? !g : !S : this.columnModel.isPinningLeft() ? !d : !S; + }, f.prototype.findDisplayedGroupNode = function() { + var d = this.params.column, g = this.params.node; + if (this.showingValueForOpenedParent) + for (var S = g.parent; S != null; ) { + if (S.rowGroupColumn && d.isRowGroupDisplayed(S.rowGroupColumn.getId())) { + this.displayedGroupNode = S; + break; + } + S = S.parent; + } + r(this.displayedGroupNode) && (this.displayedGroupNode = g); + }, f.prototype.setupShowingValueForOpenedParent = function() { + var d = this.params.node, g = this.params.column; + if (!this.gridOptionsWrapper.isGroupHideOpenParents()) { + this.showingValueForOpenedParent = !1; + return; + } + if (!d.groupData) { + this.showingValueForOpenedParent = !1; + return; + } + var S = d.rowGroupColumn != null; + if (S) { + var O = d.rowGroupColumn.getId(), z = g.isRowGroupDisplayed(O); + if (z) { + this.showingValueForOpenedParent = !1; + return; + } + } + var te = d.groupData[g.getId()] != null; + this.showingValueForOpenedParent = te; + }, f.prototype.addValueElement = function() { + this.displayedGroupNode.footer ? this.addFooterValue() : (this.addGroupValue(), this.addChildCount()); + }, f.prototype.addGroupValue = function() { + var d = this.adjustParamsWithDetailsFromRelatedColumn(), g = this.getInnerCompDetails(d), S = d.valueFormatted, O = d.value, z = S ?? O; + this.comp.setInnerRenderer(g, z); + }, f.prototype.adjustParamsWithDetailsFromRelatedColumn = function() { + var d = this.displayedGroupNode.rowGroupColumn, g = this.params.column; + if (!d) + return this.params; + var S = g != null; + if (S) { + var O = g.isRowGroupDisplayed(d.getId()); + if (!O) + return this.params; + } + var z = this.params, te = this.params, Fe = te.value, ze = te.node, ht = this.valueFormatterService.formatValue(d, ze, Fe), Lt = j8(j8({}, z), { valueFormatted: ht }); + return Lt; + }, f.prototype.addFooterValue = function() { + var d = this.params.footerValueGetter, g = ""; + if (d) { + var S = P(this.params); + S.value = this.params.value, typeof d == "function" ? g = d(S) : typeof d == "string" ? g = this.expressionService.evaluate(d, S) : console.warn("AG Grid: footerValueGetter should be either a function or a string (expression)"); + } else + g = "Total " + (this.params.value != null ? this.params.value : ""); + var O = this.getInnerCompDetails(this.params); + this.comp.setInnerRenderer(O, g); + }, f.prototype.getInnerCompDetails = function(d) { + var g = this; + if (d.fullWidth) + return this.userComponentFactory.getFullWidthGroupRowInnerCellRenderer(this.gridOptions.groupRowRendererParams, d); + var S = this.userComponentFactory.getInnerRendererDetails(d, d), O = function(ht) { + return ht && ht.componentClass == g.compClass; + }; + if (S && !O(S)) + return S; + var z = this.displayedGroupNode.rowGroupColumn, te = z ? z.getColDef() : void 0; + if (te) { + var Fe = this.userComponentFactory.getCellRendererDetails(te, d); + if (Fe && !O(Fe)) + return Fe; + if (O(Fe) && te.cellRendererParams && te.cellRendererParams.innerRenderer) { + var ze = this.userComponentFactory.getInnerRendererDetails(te.cellRendererParams, d); + return ze; + } + } + }, f.prototype.addChildCount = function() { + this.params.suppressCount || (this.addManagedListener(this.displayedGroupNode, oi.EVENT_ALL_CHILDREN_COUNT_CHANGED, this.updateChildCount.bind(this)), this.updateChildCount()); + }, f.prototype.updateChildCount = function() { + var d = this.displayedGroupNode.allChildrenCount, g = this.isShowRowGroupForThisRow(), S = g && d != null && d >= 0, O = S ? "(" + d + ")" : ""; + this.comp.setChildCount(O); + }, f.prototype.isShowRowGroupForThisRow = function() { + if (this.gridOptionsWrapper.isTreeData()) + return !0; + var d = this.displayedGroupNode.rowGroupColumn; + if (!d) + return !1; + var g = this.params.column, S = g == null || g.isRowGroupDisplayed(d.getId()); + return S; + }, f.prototype.addExpandAndContract = function() { + var d = this.params, g = Xl("groupExpanded", this.gridOptionsWrapper, null), S = Xl("groupContracted", this.gridOptionsWrapper, null); + g && this.eExpanded.appendChild(g), S && this.eContracted.appendChild(S); + var O = d.eGridCell; + !this.gridOptionsWrapper.isEnableGroupEdit() && this.isExpandable() && !d.suppressDoubleClickExpand && this.addManagedListener(O, "dblclick", this.onCellDblClicked.bind(this)), this.addManagedListener(this.eExpanded, "click", this.onExpandClicked.bind(this)), this.addManagedListener(this.eContracted, "click", this.onExpandClicked.bind(this)), this.addManagedListener(O, "keydown", this.onKeyDown.bind(this)), this.addManagedListener(d.node, oi.EVENT_EXPANDED_CHANGED, this.showExpandAndContractIcons.bind(this)), this.showExpandAndContractIcons(); + var z = this.onRowNodeIsExpandableChanged.bind(this); + this.addManagedListener(this.displayedGroupNode, oi.EVENT_ALL_CHILDREN_COUNT_CHANGED, z), this.addManagedListener(this.displayedGroupNode, oi.EVENT_MASTER_CHANGED, z), this.addManagedListener(this.displayedGroupNode, oi.EVENT_GROUP_CHANGED, z), this.addManagedListener(this.displayedGroupNode, oi.EVENT_HAS_CHILDREN_CHANGED, z); + }, f.prototype.onExpandClicked = function(d) { + Yi(d) || (Ri(d), this.onExpandOrContract(d)); + }, f.prototype.onExpandOrContract = function(d) { + var g = this.displayedGroupNode, S = !g.expanded; + g.setExpanded(S, d); + }, f.prototype.isExpandable = function() { + if (this.showingValueForOpenedParent) + return !0; + var d = this.displayedGroupNode, g = this.columnModel.isPivotMode() && d.leafGroup, S = d.isExpandable() && !d.footer && !g; + if (!S) + return !1; + var O = this.params.column, z = O != null && typeof O.getColDef().showRowGroup == "string"; + if (z) { + var te = this.isShowRowGroupForThisRow(); + return te; + } + return !0; + }, f.prototype.showExpandAndContractIcons = function() { + var d = this, g = d.params, S = d.displayedGroupNode, O = d.columnModel, z = g.node, te = this.isExpandable(); + if (te) { + var Fe = this.showingValueForOpenedParent ? !0 : z.expanded; + this.comp.setExpandedDisplayed(Fe), this.comp.setContractedDisplayed(!Fe); + } else + this.comp.setExpandedDisplayed(!1), this.comp.setContractedDisplayed(!1); + var ze = O.isPivotMode(), ht = ze && S.leafGroup, Lt = te && !ht, ti = z.footer && z.level === -1; + this.comp.addOrRemoveCssClass("ag-cell-expandable", Lt), this.comp.addOrRemoveCssClass("ag-row-group", Lt), ze ? this.comp.addOrRemoveCssClass("ag-pivot-leaf-group", ht) : ti || this.comp.addOrRemoveCssClass("ag-row-group-leaf-indent", !Lt); + }, f.prototype.onRowNodeIsExpandableChanged = function() { + this.showExpandAndContractIcons(), this.setIndent(), this.refreshAriaExpanded(); + }, f.prototype.setupIndent = function() { + var d = this.params.node, g = this.params.suppressPadding; + g || (this.addManagedListener(d, oi.EVENT_UI_LEVEL_CHANGED, this.setIndent.bind(this)), this.setIndent()); + }, f.prototype.setIndent = function() { + if (!this.gridOptionsWrapper.isGroupHideOpenParents()) { + var d = this.params, g = d.node, S = !!d.colDef, O = this.gridOptionsWrapper.isTreeData(), z = !S || O || d.colDef.showRowGroup === !0, te = z ? g.uiLevel : 0, Fe = d.padding >= 0; + Fe && Ge(function() { + return console.warn("AG Grid: cellRendererParams.padding no longer works, it was deprecated in since v14.2 and removed in v26, configuring padding for groupCellRenderer should be done with Sass variables and themes. Please see the AG Grid documentation page for Themes, in particular the property $row-group-indent-size."); + }, "groupCellRenderer->doDeprecatedWay"), this.indentClass && this.comp.addOrRemoveCssClass(this.indentClass, !1), this.indentClass = "ag-row-group-indent-" + te, this.comp.addOrRemoveCssClass(this.indentClass, !0); + } + }, f.prototype.addFullWidthRowDraggerIfNeeded = function() { + var d = this; + if (!(!this.params.fullWidth || !this.params.rowDrag)) { + var g = new MC(function() { + return d.params.value; + }, this.params.node); + this.createManagedBean(g, this.context), this.eGui.insertAdjacentElement("afterbegin", g.getGui()); + } + }, f.prototype.isUserWantsSelected = function() { + var d = this.params.checkbox; + return typeof d == "function" ? d(this.params) : d === !0; + }, f.prototype.addCheckboxIfNeeded = function() { + var d = this, g = this.displayedGroupNode, S = this.isUserWantsSelected() && // footers cannot be selected + !g.footer && // pinned rows cannot be selected + !g.rowPinned && // details cannot be selected + !g.detail; + if (S) { + var O = new Ku(); + this.getContext().createBean(O), O.init({ rowNode: g, column: this.params.column }), this.eCheckbox.appendChild(O.getGui()), this.addDestroyFunc(function() { + return d.getContext().destroyBean(O); + }); + } + this.comp.setCheckboxVisible(S); + }, f.prototype.onKeyDown = function(d) { + var g = d.key === Hr.ENTER; + if (!(!g || this.params.suppressEnterExpand)) { + var S = this.params.column && this.params.column.isCellEditable(this.params.node); + S || this.onExpandOrContract(d); + } + }, f.prototype.onCellDblClicked = function(d) { + if (!Yi(d)) { + var g = jr(this.eExpanded, d) || jr(this.eContracted, d); + g || this.onExpandOrContract(d); + } + }, e2([ + pe("expressionService") + ], f.prototype, "expressionService", void 0), e2([ + pe("valueFormatterService") + ], f.prototype, "valueFormatterService", void 0), e2([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), e2([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), e2([ + pe("gridOptions") + ], f.prototype, "gridOptions", void 0), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var _re = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), DC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, G8 = ( + /** @class */ + function(M) { + _re(f, M); + function f() { + return M.call(this, f.TEMPLATE) || this; + } + return f.prototype.init = function(d) { + var g = this, S = { + setInnerRenderer: function(Fe, ze) { + return g.setRenderDetails(Fe, ze); + }, + setChildCount: function(Fe) { + return g.eChildCount.innerHTML = Fe; + }, + addOrRemoveCssClass: function(Fe, ze) { + return g.addOrRemoveCssClass(Fe, ze); + }, + setContractedDisplayed: function(Fe) { + return al(g.eContracted, Fe); + }, + setExpandedDisplayed: function(Fe) { + return al(g.eExpanded, Fe); + }, + setCheckboxVisible: function(Fe) { + return g.eCheckbox.classList.toggle("ag-invisible", !Fe); + } + }, O = this.createManagedBean(new oA()), z = !d.colDef, te = this.getGui(); + O.init(S, te, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, d), z && tr(te, "gridcell"); + }, f.prototype.setRenderDetails = function(d, g) { + var S = this; + if (d) { + var O = d.newAgStackInstance(); + if (!O) + return; + O.then(function(z) { + if (z) { + var te = function() { + return S.context.destroyBean(z); + }; + S.isAlive() ? (S.eValue.appendChild(z.getGui()), S.addDestroyFunc(te)) : te(); + } + }); + } else + this.eValue.innerText = g; + }, f.prototype.destroy = function() { + this.getContext().destroyBean(this.innerCellRenderer), M.prototype.destroy.call(this); + }, f.prototype.refresh = function() { + return !1; + }, f.TEMPLATE = ` + + + + + + `, DC([ + qr("eExpanded") + ], f.prototype, "eExpanded", void 0), DC([ + qr("eContracted") + ], f.prototype, "eContracted", void 0), DC([ + qr("eCheckbox") + ], f.prototype, "eCheckbox", void 0), DC([ + qr("eValue") + ], f.prototype, "eValue", void 0), DC([ + qr("eChildCount") + ], f.prototype, "eChildCount", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var bre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Wd = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, gf = ( + /** @class */ + function(M) { + bre(f, M); + function f() { + return M.call(this, f.TEMPLATE) || this; + } + return f.prototype.init = function(d) { + d.node.failedLoad ? this.setupFailed() : this.setupLoading(); + }, f.prototype.setupFailed = function() { + this.eLoadingText.innerText = "ERR"; + }, f.prototype.setupLoading = function() { + var d = Xl("groupLoading", this.gridOptionsWrapper, null); + d && this.eLoadingIcon.appendChild(d); + var g = this.gridOptionsWrapper.getLocaleTextFunc(); + this.eLoadingText.innerText = g("loadingOoo", "Loading"); + }, f.prototype.refresh = function(d) { + return !1; + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.TEMPLATE = `
+ + +
`, Wd([ + qr("eLoadingIcon") + ], f.prototype, "eLoadingIcon", void 0), Wd([ + qr("eLoadingText") + ], f.prototype, "eLoadingText", void 0), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var FC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), LC = ( + /** @class */ + function(M) { + FC(f, M); + function f() { + return M.call(this) || this; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.init = function(d) { + var g = this.gridOptionsWrapper.getOverlayLoadingTemplate() ? this.gridOptionsWrapper.getOverlayLoadingTemplate() : f.DEFAULT_LOADING_OVERLAY_TEMPLATE, S = this.gridOptionsWrapper.getLocaleTextFunc(), O = g.replace("[LOADING...]", S("loadingOoo", "Loading...")); + this.setTemplate(O); + }, f.DEFAULT_LOADING_OVERLAY_TEMPLATE = '[LOADING...]', f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Rm = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), L1 = ( + /** @class */ + function(M) { + Rm(f, M); + function f() { + return M.call(this) || this; + } + return f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.init = function(d) { + var g = this.gridOptionsWrapper.getOverlayNoRowsTemplate() ? this.gridOptionsWrapper.getOverlayNoRowsTemplate() : f.DEFAULT_NO_ROWS_TEMPLATE, S = this.gridOptionsWrapper.getLocaleTextFunc(), O = g.replace("[NO_ROWS_TO_SHOW]", S("noRowsToShow", "No Rows To Show")); + this.setTemplate(O); + }, f.DEFAULT_NO_ROWS_TEMPLATE = '[NO_ROWS_TO_SHOW]', f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var t2 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), NC = ( + /** @class */ + function(M) { + t2(f, M); + function f() { + return M.call( + this, + /* html */ + '
' + ) || this; + } + return f.prototype.init = function(d) { + var g = d.value; + this.getGui().innerHTML = _t(g); + }, f; + }(Zx) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var U8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), yL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, q0 = ( + /** @class */ + function(M) { + U8(f, M); + function f() { + var d = M !== null && M.apply(this, arguments) || this; + return d.agGridDefaults = { + //date + agDateInput: U3, + //header + agColumnHeader: gL, + agColumnGroupHeader: V8, + //floating filters + agTextColumnFloatingFilter: mL, + agNumberColumnFloatingFilter: nA, + agDateColumnFloatingFilter: rA, + agReadOnlyFloatingFilter: ZI, + // renderers + agAnimateShowChangeCellRenderer: Xb, + agAnimateSlideCellRenderer: Gt, + agGroupCellRenderer: G8, + agGroupRowRenderer: G8, + agLoadingCellRenderer: gf, + //editors + agCellEditor: Er, + agTextCellEditor: Er, + agSelectCellEditor: qv, + agPopupTextCellEditor: K3, + agPopupSelectCellEditor: Yg, + agLargeTextCellEditor: Qx, + //filter + agTextColumnFilter: Om, + agNumberColumnFilter: z3, + agDateColumnFilter: TC, + //overlays + agLoadingOverlay: LC, + agNoRowsOverlay: L1, + // tooltips + agTooltipComponent: NC + }, d.agDeprecatedNames = { + set: { + newComponentName: "agSetColumnFilter", + propertyHolder: "filter" + }, + text: { + newComponentName: "agTextColumnFilter", + propertyHolder: "filter" + }, + number: { + newComponentName: "agNumberColumnFilter", + propertyHolder: "filter" + }, + date: { + newComponentName: "agDateColumnFilter", + propertyHolder: "filter" + }, + group: { + newComponentName: "agGroupCellRenderer", + propertyHolder: "cellRenderer" + }, + animateShowChange: { + newComponentName: "agAnimateShowChangeCellRenderer", + propertyHolder: "cellRenderer" + }, + animateSlide: { + newComponentName: "agAnimateSlideCellRenderer", + propertyHolder: "cellRenderer" + }, + select: { + newComponentName: "agSelectCellEditor", + propertyHolder: "cellEditor" + }, + largeText: { + newComponentName: "agLargeTextCellEditor", + propertyHolder: "cellEditor" + }, + popupSelect: { + newComponentName: "agPopupSelectCellEditor", + propertyHolder: "cellEditor" + }, + popupText: { + newComponentName: "agPopupTextCellEditor", + propertyHolder: "cellEditor" + }, + richSelect: { + newComponentName: "agRichSelectCellEditor", + propertyHolder: "cellEditor" + }, + headerComponent: { + newComponentName: "agColumnHeader", + propertyHolder: "headerComponent" + } + }, d.jsComps = {}, d.fwComps = {}, d; + } + return f.prototype.init = function() { + var d = this; + this.gridOptions.components != null && I(this.gridOptions.components, function(g, S) { + return d.registerJsComponent(g, S); + }), this.gridOptions.frameworkComponents != null && I(this.gridOptions.frameworkComponents, function(g, S) { + return d.registerFwComponent(g, S); + }); + }, f.prototype.registerDefaultComponent = function(d, g) { + var S = this.translateIfDeprecated(d); + if (this.agGridDefaults[S]) { + console.error("Trying to overwrite a default component. You should call registerComponent"); + return; + } + this.agGridDefaults[S] = g; + }, f.prototype.registerJsComponent = function(d, g) { + var S = this.translateIfDeprecated(d); + if (this.fwComps[S]) { + console.error("Trying to register a component that you have already registered for frameworks: " + S); + return; + } + this.jsComps[S] = g; + }, f.prototype.registerFwComponent = function(d, g) { + var S = "AG Grid: As of v27, registering components via grid property frameworkComponents is deprecated. Instead register both JavaScript AND Framework Components via the components property."; + Ge(function() { + return console.warn(S); + }, "UserComponentRegistry.frameworkComponentsDeprecated"); + var O = this.translateIfDeprecated(d); + this.fwComps[O] = g; + }, f.prototype.retrieve = function(d) { + var g = this.translateIfDeprecated(d), S = function(ht, Lt) { + return { componentFromFramework: Lt, component: ht }; + }, O = this.getFrameworkOverrides().frameworkComponent(g); + if (O != null) + return S(O, !0); + var z = this.fwComps[g]; + if (z) + return S(z, !0); + var te = this.jsComps[g]; + if (te) { + var Fe = this.getFrameworkOverrides().isFrameworkComponent(te); + return S(te, Fe); + } + var ze = this.agGridDefaults[g]; + return ze ? S(ze, !1) : (Object.keys(this.agGridDefaults).indexOf(g) < 0 && console.warn("AG Grid: Looking for component [" + g + "] but it wasn't found."), null); + }, f.prototype.translateIfDeprecated = function(d) { + var g = this.agDeprecatedNames[d]; + return g != null ? (Ge(function() { + console.warn("ag-grid. Since v15.0 component names have been renamed to be namespaced. You should rename " + g.propertyHolder + ":" + d + " to " + g.propertyHolder + ":" + g.newComponentName); + }, "DEPRECATE_COMPONENT_" + d), g.newComponentName) : d; + }, yL([ + pe("gridOptions") + ], f.prototype, "gridOptions", void 0), yL([ + pe("agComponentUtils") + ], f.prototype, "agComponentUtils", void 0), yL([ + ct + ], f.prototype, "init", null), f = yL([ + Ne("userComponentRegistry") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var wre = { + propertyName: "dateComponent", + cellRenderer: !1 + }, xre = { + propertyName: "headerComponent", + cellRenderer: !1 + }, Z3 = { + propertyName: "headerGroupComponent", + cellRenderer: !1 + }, pn = { + propertyName: "cellRenderer", + cellRenderer: !0 + }, xr = { + propertyName: "cellEditor", + cellRenderer: !1 + }, i2 = { + propertyName: "innerRenderer", + cellRenderer: !0 + }, aA = { + propertyName: "loadingOverlayComponent", + cellRenderer: !1 + }, l_e = { + propertyName: "noRowsOverlayComponent", + cellRenderer: !1 + }, gd = { + propertyName: "tooltipComponent", + cellRenderer: !1 + }, r2 = { + propertyName: "filter", + cellRenderer: !1 + }, Uy = { + propertyName: "floatingFilterComponent", + cellRenderer: !1 + }, z8 = { + propertyName: "toolPanel", + cellRenderer: !1 + }, n2 = { + propertyName: "statusPanel", + cellRenderer: !1 + }, u_e = { + propertyName: "fullWidthCellRenderer", + cellRenderer: !0 + }, c_e = { + propertyName: "loadingCellRenderer", + cellRenderer: !0 + }, h_e = { + propertyName: "groupRowRenderer", + cellRenderer: !0 + }, Q3 = { + propertyName: "detailCellRenderer", + cellRenderer: !0 + }; + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var mH = ( + /** @class */ + function() { + function M() { + } + return M.getFloatingFilterType = function(f) { + return this.filterToFloatingFilterMapping[f]; + }, M.filterToFloatingFilterMapping = { + set: "agSetColumnFloatingFilter", + agSetColumnFilter: "agSetColumnFloatingFilter", + multi: "agMultiColumnFloatingFilter", + agMultiColumnFilter: "agMultiColumnFloatingFilter", + number: "agNumberColumnFloatingFilter", + agNumberColumnFilter: "agNumberColumnFloatingFilter", + date: "agDateColumnFloatingFilter", + agDateColumnFilter: "agDateColumnFloatingFilter", + text: "agTextColumnFloatingFilter", + agTextColumnFilter: "agTextColumnFloatingFilter" + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Sre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), lA = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, eR = ( + /** @class */ + function(M) { + Sre(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getHeaderCompDetails = function(d, g) { + return this.getCompDetails(d, xre, "agColumnHeader", g); + }, f.prototype.getHeaderGroupCompDetails = function(d) { + var g = d.columnGroup.getColGroupDef(); + return this.getCompDetails(g, Z3, "agColumnGroupHeader", d); + }, f.prototype.getFullWidthCellRendererDetails = function(d) { + return this.getCompDetails(this.gridOptions, u_e, null, d, !0); + }, f.prototype.getFullWidthLoadingCellRendererDetails = function(d) { + return this.getCompDetails(this.gridOptions, c_e, "agLoadingCellRenderer", d, !0); + }, f.prototype.getFullWidthGroupCellRendererDetails = function(d) { + return this.getCompDetails(this.gridOptions, h_e, "agGroupRowRenderer", d, !0); + }, f.prototype.getFullWidthDetailCellRendererDetails = function(d) { + return this.getCompDetails(this.gridOptions, Q3, "agDetailCellRenderer", d, !0); + }, f.prototype.getInnerRendererDetails = function(d, g) { + return this.getCompDetails(d, i2, null, g); + }, f.prototype.getFullWidthGroupRowInnerCellRenderer = function(d, g) { + return this.getCompDetails(d, i2, null, g); + }, f.prototype.getCellRendererDetails = function(d, g) { + return this.getCompDetails(d, pn, null, g); + }, f.prototype.getCellEditorDetails = function(d, g) { + return this.getCompDetails(d, xr, "agCellEditor", g, !0); + }, f.prototype.getFilterDetails = function(d, g, S) { + return this.getCompDetails(d, r2, S, g, !0); + }, f.prototype.getDateCompDetails = function(d) { + return this.getCompDetails(this.gridOptions, wre, "agDateInput", d, !0); + }, f.prototype.getLoadingOverlayCompDetails = function(d) { + return this.getCompDetails(this.gridOptions, aA, "agLoadingOverlay", d, !0); + }, f.prototype.getNoRowsOverlayCompDetails = function(d) { + return this.getCompDetails(this.gridOptions, l_e, "agNoRowsOverlay", d, !0); + }, f.prototype.getTooltipCompDetails = function(d) { + return this.getCompDetails(d.colDef, gd, "agTooltipComponent", d, !0); + }, f.prototype.getSetFilterCellRendererDetails = function(d, g) { + return this.getCompDetails(d, pn, null, g); + }, f.prototype.getFloatingFilterCompDetails = function(d, g, S) { + return this.getCompDetails(d, Uy, S, g); + }, f.prototype.getToolPanelCompDetails = function(d, g) { + return this.getCompDetails(d, z8, null, g, !0); + }, f.prototype.getStatusPanelCompDetails = function(d, g) { + return this.getCompDetails(d, n2, null, g, !0); + }, f.prototype.getCompDetails = function(d, g, S, O, z) { + var te = this; + z === void 0 && (z = !1); + var Fe = g.propertyName, ze = g.cellRenderer, ht = this.getCompKeys(d, g, O), Lt = ht.compName, ti = ht.jsComp, wi = ht.fwComp, Ti = ht.paramsFromSelector, qi = ht.popupFromSelector, dr = ht.popupPositionFromSelector, kr = function(Js) { + var Ya = te.userComponentRegistry.retrieve(Js); + Ya && (ti = Ya.componentFromFramework ? void 0 : Ya.component, wi = Ya.componentFromFramework ? Ya.component : void 0); + }; + if (Lt != null && kr(Lt), ti == null && wi == null && S != null && kr(S), ti && ze && !this.agComponentUtils.doesImplementIComponent(ti) && (ti = this.agComponentUtils.adaptFunction(Fe, ti)), !ti && !wi) { + z && console.error("Could not find component " + Lt + ", did you forget to configure this component?"); + return; + } + var Rr = this.mergeParamsWithApplicationProvidedParams(d, g, O, Ti), Vr = ti == null, An = ti || wi; + return { + componentFromFramework: Vr, + componentClass: An, + params: Rr, + type: g, + popupFromSelector: qi, + popupPositionFromSelector: dr, + newAgStackInstance: function() { + return te.newAgStackInstance(An, Vr, Rr, g); + } + }; + }, f.prototype.getCompKeys = function(d, g, S) { + var O = this, z = g.propertyName, te, Fe, ze, ht, Lt, ti; + if (d) { + var wi = d, Ti = wi[z + "Selector"], qi = Ti ? Ti(S) : null, dr = function(Rr, Vr) { + var An = function() { + var Ya = "AG Grid: As of v27, the property " + z + "Framework is deprecated. The property " + z + " can now be used for JavaScript AND Framework Components."; + Ge(function() { + return console.warn(Ya); + }, "UserComponentFactory." + z + "FrameworkDeprecated"); + }; + if (typeof Rr == "string") + te = Rr; + else if (typeof Vr == "string") + An(), te = Vr; + else if (Rr != null && Rr !== !0) { + var Js = O.getFrameworkOverrides().isFrameworkComponent(Rr); + Js ? ze = Rr : Fe = Rr; + } else + Vr != null && (An(), ze = Vr); + }; + if (qi) { + if (qi.frameworkComponent != null) { + var kr = "AG Grid: As of v27, the return for " + z + "Selector has attributes [component, params] only. The attribute frameworkComponent is deprecated. You should now return back Framework Components using the 'component' attribute and the grid works out if it's a framework component or not."; + Ge(function() { + return console.warn(kr); + }, "UserComponentFactory." + z + "FrameworkSelectorDeprecated"), dr(qi.frameworkComponent, void 0); + } else + dr(qi.component, void 0); + ht = qi.params, Lt = qi.popup, ti = qi.popupPosition; + } else + dr(wi[z], wi[z + "Framework"]); + } + return { compName: te, jsComp: Fe, fwComp: ze, paramsFromSelector: ht, popupFromSelector: Lt, popupPositionFromSelector: ti }; + }, f.prototype.newAgStackInstance = function(d, g, S, O) { + var z = O.propertyName, te = !g, Fe; + if (te) + Fe = new d(); + else { + var ze = this.componentMetadataProvider.retrieve(z); + Fe = this.frameworkComponentWrapper.wrap(d, ze.mandatoryMethodList, ze.optionalMethodList, O); + } + var ht = this.initComponent(Fe, S); + return ht == null ? Pm.resolve(Fe) : ht.then(function() { + return Fe; + }); + }, f.prototype.mergeParamsWithApplicationProvidedParams = function(d, g, S, O) { + O === void 0 && (O = null); + var z = { + context: this.gridOptionsWrapper.getContext(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + api: this.gridOptionsWrapper.getApi() + }; + he(z, S); + var te = d, Fe = te && te[g.propertyName + "Params"]; + if (typeof Fe == "function") { + var ze = Fe(S); + he(z, ze); + } else + typeof Fe == "object" && he(z, Fe); + return he(z, O), z; + }, f.prototype.initComponent = function(d, g) { + if (this.context.createBean(d), d.init != null) + return d.init(g); + }, f.prototype.getDefaultFloatingFilterType = function(d) { + if (d == null) + return null; + var g = null, S = this.getCompKeys(d, r2), O = S.compName, z = S.jsComp, te = S.fwComp; + if (O) + g = mH.getFloatingFilterType(O); + else { + var Fe = z == null && te == null && d.filter === !0; + if (Fe) { + var ze = si.isRegistered(t.ModuleNames.SetFilterModule); + g = ze ? "agSetColumnFloatingFilter" : "agTextColumnFloatingFilter"; + } + } + return g; + }, lA([ + pe("gridOptions") + ], f.prototype, "gridOptions", void 0), lA([ + pe("agComponentUtils") + ], f.prototype, "agComponentUtils", void 0), lA([ + pe("componentMetadataProvider") + ], f.prototype, "componentMetadataProvider", void 0), lA([ + pe("userComponentRegistry") + ], f.prototype, "userComponentRegistry", void 0), lA([ + Ae("frameworkComponentWrapper") + ], f.prototype, "frameworkComponentWrapper", void 0), f = lA([ + Ne("userComponentFactory") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M[M.SINGLE_SHEET = 0] = "SINGLE_SHEET", M[M.MULTI_SHEET = 1] = "MULTI_SHEET"; + })(t.ExcelFactoryMode || (t.ExcelFactoryMode = {})); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var kC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), s2 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, vL = ( + /** @class */ + function(M) { + kC(f, M); + function f() { + var d = M !== null && M.apply(this, arguments) || this; + return d.dragEndFunctions = [], d.dragSources = [], d; + } + return f.prototype.init = function() { + this.logger = this.loggerFactory.create("DragService"); + }, f.prototype.removeAllListeners = function() { + this.dragSources.forEach(this.removeListener.bind(this)), this.dragSources.length = 0; + }, f.prototype.removeListener = function(d) { + var g = d.dragSource.eElement, S = d.mouseDownListener; + if (g.removeEventListener("mousedown", S), d.touchEnabled) { + var O = d.touchStartListener; + g.removeEventListener("touchstart", O, { passive: !0 }); + } + }, f.prototype.removeDragSource = function(d) { + var g = this.dragSources.find(function(S) { + return S.dragSource === d; + }); + g && (this.removeListener(g), q(this.dragSources, g)); + }, f.prototype.isDragging = function() { + return this.dragging; + }, f.prototype.addDragSource = function(d, g) { + var S = this; + g === void 0 && (g = !1); + var O = this.onMouseDown.bind(this, d); + d.eElement.addEventListener("mousedown", O); + var z = null, te = this.gridOptionsWrapper.isSuppressTouch(); + g && !te && (z = function(Fe) { + Fe.cancelable && Fe.preventDefault(), S.onTouchStart(d, Fe); + }, d.eElement.addEventListener("touchstart", z, { passive: !0 })), this.dragSources.push({ + dragSource: d, + mouseDownListener: O, + touchStartListener: z, + touchEnabled: g + }); + }, f.prototype.onTouchStart = function(d, g) { + var S = this; + this.currentDragParams = d, this.dragging = !1; + var O = g.touches[0]; + this.touchLastTime = O, this.touchStart = O; + var z = function(Lt) { + return S.onTouchMove(Lt, d.eElement); + }, te = function(Lt) { + return S.onTouchUp(Lt, d.eElement); + }, Fe = function(Lt) { + Lt.cancelable && Lt.preventDefault(); + }, ze = d.eElement, ht = [ + // Prevents the page document from moving while we are dragging items around. + // preventDefault needs to be called in the touchmove listener and never inside the + // touchstart, because using touchstart causes the click event to be cancelled on touch devices. + { target: document, type: "touchmove", listener: Fe, options: { passive: !1 } }, + { target: ze, type: "touchmove", listener: z, options: { passive: !0 } }, + { target: ze, type: "touchend", listener: te, options: { passive: !0 } }, + { target: ze, type: "touchcancel", listener: te, options: { passive: !0 } } + ]; + this.addTemporaryEvents(ht), d.dragStartPixels === 0 && this.onCommonMove(O, this.touchStart, d.eElement); + }, f.prototype.onMouseDown = function(d, g) { + var S = this, O = g; + if (!(d.skipMouseEvent && d.skipMouseEvent(g)) && !O._alreadyProcessedByDragService && (O._alreadyProcessedByDragService = !0, g.button === 0)) { + this.currentDragParams = d, this.dragging = !1, this.mouseStartEvent = g; + var z = this.gridOptionsWrapper.getDocument(), te = function(ti) { + return S.onMouseMove(ti, d.eElement); + }, Fe = function(ti) { + return S.onMouseUp(ti, d.eElement); + }, ze = function(ti) { + return ti.preventDefault(); + }, ht = z, Lt = [ + { target: ht, type: "mousemove", listener: te }, + { target: ht, type: "mouseup", listener: Fe }, + { target: ht, type: "contextmenu", listener: ze } + ]; + this.addTemporaryEvents(Lt), d.dragStartPixels === 0 && this.onMouseMove(g, d.eElement); + } + }, f.prototype.addTemporaryEvents = function(d) { + d.forEach(function(g) { + var S = g.target, O = g.type, z = g.listener, te = g.options; + S.addEventListener(O, z, te); + }), this.dragEndFunctions.push(function() { + d.forEach(function(g) { + var S = g.target, O = g.type, z = g.listener, te = g.options; + S.removeEventListener(O, z, te); + }); + }); + }, f.prototype.isEventNearStartEvent = function(d, g) { + var S = this.currentDragParams.dragStartPixels, O = i(S) ? S : 4; + return xn(d, g, O); + }, f.prototype.getFirstActiveTouch = function(d) { + for (var g = 0; g < d.length; g++) + if (d[g].identifier === this.touchStart.identifier) + return d[g]; + return null; + }, f.prototype.onCommonMove = function(d, g, S) { + if (!this.dragging) { + if (!this.dragging && this.isEventNearStartEvent(d, g)) + return; + this.dragging = !0; + var O = { + type: ui.EVENT_DRAG_STARTED, + api: this.gridApi, + columnApi: this.columnApi, + target: S + }; + this.eventService.dispatchEvent(O), this.currentDragParams.onDragStart(g), this.currentDragParams.onDragging(g); + } + this.currentDragParams.onDragging(d); + }, f.prototype.onTouchMove = function(d, g) { + var S = this.getFirstActiveTouch(d.touches); + S && this.onCommonMove(S, this.touchStart, g); + }, f.prototype.onMouseMove = function(d, g) { + Mc() && d.type === "mousemove" && d.cancelable && this.mouseEventService.isEventFromThisGrid(d) && !this.isOverFormFieldElement(d) && d.preventDefault(), this.onCommonMove(d, this.mouseStartEvent, g); + }, f.prototype.isOverFormFieldElement = function(d) { + var g, S, O = d.target, z = (g = O) === null || g === void 0 ? void 0 : g.tagName.toLocaleLowerCase(); + return !!(!((S = z) === null || S === void 0) && S.match("^a$|textarea|input|select|button")); + }, f.prototype.onTouchUp = function(d, g) { + var S = this.getFirstActiveTouch(d.changedTouches); + S || (S = this.touchLastTime), this.onUpCommon(S, g); + }, f.prototype.onMouseUp = function(d, g) { + this.onUpCommon(d, g); + }, f.prototype.onUpCommon = function(d, g) { + if (this.dragging) { + this.dragging = !1, this.currentDragParams.onDragStop(d); + var S = { + type: ui.EVENT_DRAG_STOPPED, + api: this.gridApi, + columnApi: this.columnApi, + target: g + }; + this.eventService.dispatchEvent(S); + } + this.mouseStartEvent = null, this.touchStart = null, this.touchLastTime = null, this.currentDragParams = null, this.dragEndFunctions.forEach(function(O) { + return O(); + }), this.dragEndFunctions.length = 0; + }, s2([ + pe("loggerFactory") + ], f.prototype, "loggerFactory", void 0), s2([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), s2([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), s2([ + pe("mouseEventService") + ], f.prototype, "mouseEventService", void 0), s2([ + ct + ], f.prototype, "init", null), s2([ + gt + ], f.prototype, "removeAllListeners", null), f = s2([ + Ne("dragService") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Cre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), _L = function() { + return _L = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, _L.apply(this, arguments); + }, zy = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, gH = ( + /** @class */ + function(M) { + Cre(f, M); + function f() { + var g = M !== null && M.apply(this, arguments) || this; + return g.allColumnFilters = /* @__PURE__ */ new Map(), g.activeAggregateFilters = [], g.activeColumnFilters = [], g.quickFilter = null, g.quickFilterParts = null, g.processingFilterChange = !1, g; + } + d = f, f.prototype.init = function() { + var g = this; + this.addManagedListener(this.eventService, ui.EVENT_GRID_COLUMNS_CHANGED, function() { + return g.onColumnsChanged(); + }), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_VALUE_CHANGED, function() { + return g.refreshFiltersForAggregations(); + }), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_PIVOT_CHANGED, function() { + return g.refreshFiltersForAggregations(); + }), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_PIVOT_MODE_CHANGED, function() { + return g.refreshFiltersForAggregations(); + }), this.quickFilter = this.parseQuickFilter(this.gridOptionsWrapper.getQuickFilterText()), this.setQuickFilterParts(), this.allowShowChangeAfterFilter = this.gridOptionsWrapper.isAllowShowChangeAfterFilter(); + }, f.prototype.setQuickFilterParts = function() { + this.quickFilterParts = this.quickFilter ? this.quickFilter.split(" ") : null; + }, f.prototype.setFilterModel = function(g) { + var S = this, O = [], z = this.getFilterModel(); + if (g) { + var te = mC(Object.keys(g)); + this.allColumnFilters.forEach(function(Fe, ze) { + var ht = g[ze]; + O.push(S.setModelOnFilterWrapper(Fe.filterPromise, ht)), te.delete(ze); + }), te.forEach(function(Fe) { + var ze = S.columnModel.getPrimaryColumn(Fe) || S.columnModel.getGridColumn(Fe); + if (!ze) { + console.warn("AG Grid: setFilterModel() - no column found for colId: " + Fe); + return; + } + if (!ze.isFilterAllowed()) { + console.warn("AG Grid: setFilterModel() - unable to fully apply model, filtering disabled for colId: " + Fe); + return; + } + var ht = S.getOrCreateFilterWrapper(ze, "NO_UI"); + if (!ht) { + console.warn("AG-Grid: setFilterModel() - unable to fully apply model, unable to create filter for colId: " + Fe); + return; + } + O.push(S.setModelOnFilterWrapper(ht.filterPromise, g[Fe])); + }); + } else + this.allColumnFilters.forEach(function(Fe) { + O.push(S.setModelOnFilterWrapper(Fe.filterPromise, null)); + }); + Pm.all(O).then(function() { + var Fe = S.getFilterModel(), ze = []; + S.allColumnFilters.forEach(function(ht, Lt) { + var ti = z ? z[Lt] : null, wi = Fe ? Fe[Lt] : null; + ho.jsonEquals(ti, wi) || ze.push(ht.column); + }), ze.length > 0 && S.onFilterChanged({ columns: ze }); + }); + }, f.prototype.setModelOnFilterWrapper = function(g, S) { + return new Pm(function(O) { + g.then(function(z) { + typeof z.setModel != "function" && (console.warn("AG Grid: filter missing setModel method, which is needed for setFilterModel"), O()), (z.setModel(S) || Pm.resolve()).then(function() { + return O(); + }); + }); + }); + }, f.prototype.getFilterModel = function() { + var g = {}; + return this.allColumnFilters.forEach(function(S, O) { + var z = S.filterPromise, te = z.resolveNow(null, function(ze) { + return ze; + }); + if (te == null) + return null; + if (typeof te.getModel != "function") { + console.warn("AG Grid: filter API missing getModel method, which is needed for getFilterModel"); + return; + } + var Fe = te.getModel(); + i(Fe) && (g[O] = Fe); + }), g; + }, f.prototype.isColumnFilterPresent = function() { + return this.activeColumnFilters.length > 0; + }, f.prototype.isAggregateFilterPresent = function() { + return !!this.activeAggregateFilters.length; + }, f.prototype.doAggregateFiltersPass = function(g, S) { + return this.doColumnFiltersPass(g, S, !0); + }, f.prototype.updateActiveFilters = function() { + var g = this; + this.activeColumnFilters.length = 0, this.activeAggregateFilters.length = 0; + var S = function(te) { + return te ? te.isFilterActive ? te.isFilterActive() : (console.warn("AG Grid: Filter is missing isFilterActive() method"), !1) : !1; + }, O = !!this.gridOptionsWrapper.getGroupAggFiltering(), z = function(te) { + var Fe = !te.isPrimary(); + if (Fe) + return !0; + var ze = !g.columnModel.isPivotActive(), ht = te.isValueActive(); + return !ht || !ze ? !1 : g.columnModel.isPivotMode() ? !0 : O; + }; + this.allColumnFilters.forEach(function(te) { + if (te.filterPromise.resolveNow(!1, S)) { + var Fe = te.filterPromise.resolveNow(null, function(ze) { + return ze; + }); + z(te.column) ? g.activeAggregateFilters.push(Fe) : g.activeColumnFilters.push(Fe); + } + }); + }, f.prototype.updateFilterFlagInColumns = function(g, S) { + this.allColumnFilters.forEach(function(O) { + var z = O.filterPromise.resolveNow(!1, function(te) { + return te.isFilterActive(); + }); + O.column.setFilterActive(z, g, S); + }); + }, f.prototype.isAnyFilterPresent = function() { + return this.isQuickFilterPresent() || this.isColumnFilterPresent() || this.isAggregateFilterPresent() || this.gridOptionsWrapper.isExternalFilterPresent(); + }, f.prototype.doColumnFiltersPass = function(g, S, O) { + for (var z = g.data, te = g.aggData, Fe = O ? this.activeAggregateFilters : this.activeColumnFilters, ze = O ? te : z, ht = 0; ht < Fe.length; ht++) { + var Lt = Fe[ht]; + if (!(Lt == null || Lt === S)) { + if (typeof Lt.doesFilterPass != "function") + throw new Error("Filter is missing method doesFilterPass"); + if (!Lt.doesFilterPass({ node: g, data: ze })) + return !1; + } + } + return !0; + }, f.prototype.parseQuickFilter = function(g) { + return i(g) ? this.gridOptionsWrapper.isRowModelDefault() ? g.toUpperCase() : (console.warn("AG Grid - Quick filtering only works with the Client-Side Row Model"), null) : null; + }, f.prototype.setQuickFilter = function(g) { + if (g != null && typeof g != "string") { + console.warn("AG Grid - setQuickFilter() only supports string inputs, received: " + typeof g); + return; + } + var S = this.parseQuickFilter(g); + this.quickFilter !== S && (this.quickFilter = S, this.setQuickFilterParts(), this.onFilterChanged()); + }, f.prototype.refreshFiltersForAggregations = function() { + var g = this.gridOptionsWrapper.getGroupAggFiltering(); + g && this.onFilterChanged(); + }, f.prototype.callOnFilterChangedOutsideRenderCycle = function(g) { + var S = this; + g === void 0 && (g = {}); + var O = function() { + return S.onFilterChanged(g); + }; + this.rowRenderer.isRefreshInProgress() ? setTimeout(O, 0) : O(); + }, f.prototype.onFilterChanged = function(g) { + g === void 0 && (g = {}); + var S = g.filterInstance, O = g.additionalEventAttributes, z = g.columns; + this.updateActiveFilters(), this.updateFilterFlagInColumns("filterChanged", O), this.allColumnFilters.forEach(function(Fe) { + Fe.filterPromise && Fe.filterPromise.then(function(ze) { + ze && ze !== S && ze.onAnyFilterChanged && ze.onAnyFilterChanged(); + }); + }); + var te = { + type: ui.EVENT_FILTER_CHANGED, + api: this.gridApi, + columnApi: this.columnApi, + columns: z || [] + }; + O && he(te, O), this.processingFilterChange = !0, this.eventService.dispatchEvent(te), this.processingFilterChange = !1; + }, f.prototype.isSuppressFlashingCellsBecauseFiltering = function() { + return !this.allowShowChangeAfterFilter && this.processingFilterChange; + }, f.prototype.isQuickFilterPresent = function() { + return this.quickFilter !== null; + }, f.prototype.doesRowPassOtherFilters = function(g, S) { + return this.doesRowPassFilter({ rowNode: S, filterInstanceToSkip: g }); + }, f.prototype.doesRowPassQuickFilterNoCache = function(g, S) { + var O = this, z = this.columnModel.getAllColumnsForQuickFilter(); + return z.some(function(te) { + var Fe = O.getQuickFilterTextForColumn(te, g); + return i(Fe) && Fe.indexOf(S) >= 0; + }); + }, f.prototype.doesRowPassQuickFilterCache = function(g, S) { + return g.quickFilterAggregateText || this.aggregateRowForQuickFilter(g), g.quickFilterAggregateText.indexOf(S) >= 0; + }, f.prototype.doesRowPassQuickFilter = function(g) { + var S = this, O = this.gridOptionsWrapper.isCacheQuickFilter(); + return this.quickFilterParts.every(function(z) { + return O ? S.doesRowPassQuickFilterCache(g, z) : S.doesRowPassQuickFilterNoCache(g, z); + }); + }, f.prototype.doesRowPassAggregateFilters = function(g) { + return !(this.isAggregateFilterPresent() && !this.doAggregateFiltersPass(g.rowNode, g.filterInstanceToSkip)); + }, f.prototype.doesRowPassFilter = function(g) { + return !(this.isQuickFilterPresent() && !this.doesRowPassQuickFilter(g.rowNode) || this.gridOptionsWrapper.isExternalFilterPresent() && !this.gridOptionsWrapper.doesExternalFilterPass(g.rowNode) || this.isColumnFilterPresent() && !this.doColumnFiltersPass(g.rowNode, g.filterInstanceToSkip)); + }, f.prototype.getQuickFilterTextForColumn = function(g, S) { + var O = this.valueService.getValue(g, S, !0), z = g.getColDef(); + if (z.getQuickFilterText) { + var te = { + value: O, + node: S, + data: S.data, + column: g, + colDef: z, + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + context: this.gridOptionsWrapper.getContext() + }; + O = z.getQuickFilterText(te); + } + return i(O) ? O.toString().toUpperCase() : null; + }, f.prototype.aggregateRowForQuickFilter = function(g) { + var S = this, O = [], z = this.columnModel.getAllColumnsForQuickFilter(); + z.forEach(function(te) { + var Fe = S.getQuickFilterTextForColumn(te, g); + i(Fe) && O.push(Fe); + }), g.quickFilterAggregateText = O.join(d.QUICK_FILTER_SEPARATOR); + }, f.prototype.onNewRowsLoaded = function(g) { + this.allColumnFilters.forEach(function(S) { + S.filterPromise.then(function(O) { + O.onNewRowsLoaded && O.onNewRowsLoaded(); + }); + }), this.updateFilterFlagInColumns(g), this.updateActiveFilters(); + }, f.prototype.createValueGetter = function(g) { + var S = this; + return function(O) { + var z = O.node; + return S.valueService.getValue(g, z, !0); + }; + }, f.prototype.getFilterComponent = function(g, S, O) { + O === void 0 && (O = !0); + var z; + if (O) + return ((z = this.getOrCreateFilterWrapper(g, S)) === null || z === void 0 ? void 0 : z.filterPromise) || null; + var te = this.cachedFilter(g); + return te ? te.filterPromise : null; + }, f.prototype.isFilterActive = function(g) { + var S = this.cachedFilter(g); + return !!S && S.filterPromise.resolveNow(!1, function(O) { + return O.isFilterActive(); + }); + }, f.prototype.getOrCreateFilterWrapper = function(g, S) { + if (!g.isFilterAllowed()) + return null; + var O = this.cachedFilter(g); + return O ? S !== "NO_UI" && this.putIntoGui(O, S) : (O = this.createFilterWrapper(g, S), this.allColumnFilters.set(g.getColId(), O)), O; + }, f.prototype.cachedFilter = function(g) { + return this.allColumnFilters.get(g.getColId()); + }, f.prototype.createFilterInstance = function(g) { + var S = this, O = si.isRegistered(t.ModuleNames.SetFilterModule) ? "agSetColumnFilter" : "agTextColumnFilter", z = g.getColDef(), te, Fe = _L(_L({}, this.createFilterParams(g, z)), { filterModifiedCallback: function() { + var Lt = { + type: ui.EVENT_FILTER_MODIFIED, + api: S.gridApi, + columnApi: S.columnApi, + column: g, + filterInstance: te + }; + S.eventService.dispatchEvent(Lt); + }, filterChangedCallback: function(Lt) { + var ti = { filterInstance: te, additionalEventAttributes: Lt, columns: [g] }; + S.callOnFilterChangedOutsideRenderCycle(ti); + }, doesRowPassOtherFilter: function(Lt) { + return S.doesRowPassOtherFilters(te, Lt); + } }), ze = this.userComponentFactory.getFilterDetails(z, Fe, O); + if (!ze) + return null; + var ht = ze.newAgStackInstance(); + return ht && ht.then(function(Lt) { + return te = Lt; + }), ht; + }, f.prototype.createFilterParams = function(g, S) { + var O = { + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + column: g, + colDef: P(S), + rowModel: this.rowModel, + filterChangedCallback: function() { + }, + filterModifiedCallback: function() { + }, + valueGetter: this.createValueGetter(g), + context: this.gridOptionsWrapper.getContext(), + doesRowPassOtherFilter: function() { + return !0; + } + }; + return O; + }, f.prototype.createFilterWrapper = function(g, S) { + var O = { + column: g, + filterPromise: null, + compiledElement: null, + guiPromise: Pm.resolve(null) + }; + return O.filterPromise = this.createFilterInstance(g), O.filterPromise && this.putIntoGui(O, S), O; + }, f.prototype.putIntoGui = function(g, S) { + var O = this, z = document.createElement("div"); + z.className = "ag-filter", g.guiPromise = new Pm(function(te) { + g.filterPromise.then(function(Fe) { + var ze = Fe.getGui(); + i(ze) || console.warn("AG Grid: getGui method from filter returned " + ze + ", it should be a DOM element or an HTML template string."), typeof ze == "string" && (ze = gu(ze)), z.appendChild(ze), te(z), O.eventService.dispatchEvent({ + type: ui.EVENT_FILTER_OPENED, + column: g.column, + source: S, + eGui: z, + api: O.gridApi, + columnApi: O.columnApi + }); + }); + }); + }, f.prototype.onColumnsChanged = function() { + var g = this, S = []; + this.allColumnFilters.forEach(function(O, z) { + var te; + O.column.isPrimary() ? te = g.columnModel.getPrimaryColumn(z) : te = g.columnModel.getGridColumn(z), !te && (S.push(O.column), g.disposeFilterWrapper(O, "filterDestroyed")); + }), S.length > 0 && this.onFilterChanged({ columns: S }); + }, f.prototype.destroyFilter = function(g, S) { + S === void 0 && (S = "api"); + var O = this.allColumnFilters.get(g.getColId()); + O && (this.disposeFilterWrapper(O, S), this.onFilterChanged({ columns: [g] })); + }, f.prototype.disposeFilterWrapper = function(g, S) { + var O = this; + g.filterPromise.then(function(z) { + (z.setModel(null) || Pm.resolve()).then(function() { + O.getContext().destroyBean(z), g.column.setFilterActive(!1, S), O.allColumnFilters.delete(g.column.getColId()); + }); + }); + }, f.prototype.destroy = function() { + var g = this; + M.prototype.destroy.call(this), this.allColumnFilters.forEach(function(S) { + return g.disposeFilterWrapper(S, "filterDestroyed"); + }); + }; + var d; + return f.QUICK_FILTER_SEPARATOR = ` +`, zy([ + pe("valueService") + ], f.prototype, "valueService", void 0), zy([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), zy([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), zy([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), zy([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), zy([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), zy([ + pe("rowRenderer") + ], f.prototype, "rowRenderer", void 0), zy([ + ct + ], f.prototype, "init", null), zy([ + gt + ], f.prototype, "destroy", null), f = d = zy([ + Ne("filterManager") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var H8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), o2 = ( + /** @class */ + function(M) { + H8(f, M); + function f(d, g) { + var S = M.call(this, d) || this; + return S.ctrl = g, S; + } + return f.prototype.getCtrl = function() { + return this.ctrl; + }, f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var yH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), $C = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, W8 = ( + /** @class */ + function(M) { + yH(f, M); + function f(d) { + return M.call(this, f.TEMPLATE, d) || this; + } + return f.prototype.postConstruct = function() { + var d = this, g = this.getGui(), S = { + addOrRemoveCssClass: function(O, z) { + return d.addOrRemoveCssClass(O, z); + }, + addOrRemoveBodyCssClass: function(O, z) { + return d.eFloatingFilterBody.classList.toggle(O, z); + }, + addOrRemoveButtonWrapperCssClass: function(O, z) { + return d.eButtonWrapper.classList.toggle(O, z); + }, + setCompDetails: function(O) { + return d.setCompDetails(O); + }, + getFloatingFilterComp: function() { + return d.compPromise; + }, + setWidth: function(O) { + return g.style.width = O; + }, + setMenuIcon: function(O) { + return d.eButtonShowMainFilter.appendChild(O); + } + }; + this.ctrl.setComp(S, g, this.eButtonShowMainFilter, this.eFloatingFilterBody); + }, f.prototype.setCompDetails = function(d) { + var g = this; + this.compPromise = d.newAgStackInstance(), this.compPromise.then(function(S) { + return g.afterCompCreated(S); + }); + }, f.prototype.afterCompCreated = function(d) { + var g = this; + d && (this.addDestroyFunc(function() { + return g.context.destroyBean(d); + }), this.isAlive() && (this.eFloatingFilterBody.appendChild(d.getGui()), d.afterGuiAttached && d.afterGuiAttached())); + }, f.TEMPLATE = `
+
+ +
`, $C([ + qr("eFloatingFilterBody") + ], f.prototype, "eFloatingFilterBody", void 0), $C([ + qr("eButtonWrapper") + ], f.prototype, "eButtonWrapper", void 0), $C([ + qr("eButtonShowMainFilter") + ], f.prototype, "eButtonShowMainFilter", void 0), $C([ + ct + ], f.prototype, "postConstruct", null), f; + }(o2) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var bL = ( + /** @class */ + function() { + function M() { + } + return M.parse = function(f) { + if (!f) + return null; + if (f === !0) + return { + toolPanels: [ + M.DEFAULT_COLUMN_COMP, + M.DEFAULT_FILTER_COMP + ], + defaultToolPanel: "columns" + }; + if (typeof f == "string") + return M.parse([f]); + if (Array.isArray(f)) { + var d = []; + return f.forEach(function(S) { + var O = M.DEFAULT_BY_KEY[S]; + if (!O) { + console.warn("AG Grid: the key " + S + " is not a valid key for specifying a tool panel, valid keys are: " + Object.keys(M.DEFAULT_BY_KEY).join(",")); + return; + } + d.push(O); + }), d.length === 0 ? null : { + toolPanels: d, + defaultToolPanel: d[0].id + }; + } + var g = { + toolPanels: M.parseComponents(f.toolPanels), + defaultToolPanel: f.defaultToolPanel, + hiddenByDefault: f.hiddenByDefault, + position: f.position + }; + return g; + }, M.parseComponents = function(f) { + var d = []; + return f && f.forEach(function(g) { + var S = null; + if (typeof g == "string") { + var O = M.DEFAULT_BY_KEY[g]; + if (!O) { + console.warn("AG Grid: the key " + g + " is not a valid key for specifying a tool panel, valid keys are: " + Object.keys(M.DEFAULT_BY_KEY).join(",")); + return; + } + S = O; + } else + S = g; + d.push(S); + }), d; + }, M.DEFAULT_COLUMN_COMP = { + id: "columns", + labelDefault: "Columns", + labelKey: "columns", + iconKey: "columns", + toolPanel: "agColumnsToolPanel" + }, M.DEFAULT_FILTER_COMP = { + id: "filters", + labelDefault: "Filters", + labelKey: "filters", + iconKey: "filter", + toolPanel: "agFiltersToolPanel" + }, M.DEFAULT_BY_KEY = { + columns: M.DEFAULT_COLUMN_COMP, + filters: M.DEFAULT_FILTER_COMP + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Kv = function() { + return Kv = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, Kv.apply(this, arguments); + }, Jv = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, vH = function(M, f) { + return function(d, g) { + f(d, g, M); + }; + }, Tre = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, q8 = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(Tre(arguments[f])); + return M; + }, Ere = 25, Ire = 300, Are = 5, d_e = 5, wL = 10; + function Ar(M) { + return M === !0 || M === "true"; + } + function xL(M) { + if (typeof M == "number") + return M; + if (typeof M == "string") + return parseInt(M, 10); + } + function _H(M, f) { + return M >= 0 ? M : f; + } + function bH(M, f) { + var d = parseInt(M, 10); + return yu(d) && d > 0 ? d : f; + } + var jn = ( + /** @class */ + function() { + function M() { + this.propertyEventService = new mt(), this.domDataKey = "__AG_" + Math.random().toString(), this.destroyed = !1; + } + f = M, M.prototype.agWire = function(d, g) { + this.gridOptions.api = d, this.gridOptions.columnApi = g, this.checkForDeprecated(), this.checkForViolations(); + }, M.prototype.destroy = function() { + this.gridOptions.api = null, this.gridOptions.columnApi = null, this.destroyed = !0; + }, M.prototype.init = function() { + var d = this; + this.gridOptions.suppressPropertyNamesCheck !== !0 && (this.checkGridOptionsProperties(), this.checkColumnDefProperties()), this.gridOptions.sideBar != null && (this.gridOptions.sideBar = bL.parse(this.gridOptions.sideBar)); + var g = this.useAsyncEvents(); + if (this.eventService.addGlobalListener(this.globalEventHandler.bind(this), g), this.isGroupSelectsChildren() && this.isSuppressParentsInRowNodes() && console.warn("AG Grid: 'groupSelectsChildren' does not work with 'suppressParentsInRowNodes', this selection method needs the part in rowNode to work"), this.isGroupSelectsChildren() && (this.isRowSelectionMulti() || console.warn("AG Grid: rowSelection must be 'multiple' for groupSelectsChildren to make sense"), this.isRowModelServerSide() && console.warn("AG Grid: group selects children is NOT support for Server Side Row Model. This is because the rows are lazy loaded, so selecting a group is not possible asthe grid has no way of knowing what the children are.")), this.isGroupRemoveSingleChildren() && this.isGroupHideOpenParents() && console.warn("AG Grid: groupRemoveSingleChildren and groupHideOpenParents do not work with each other, you need to pick one. And don't ask us how to us these together on our support forum either you will get the same answer!"), this.isRowModelServerSide()) { + var S = function(z) { + return "AG Grid: '" + z + "' is not supported on the Server-Side Row Model"; + }; + i(this.gridOptions.groupDefaultExpanded) && console.warn(S("groupDefaultExpanded")), i(this.gridOptions.groupDefaultExpanded) && console.warn(S("groupIncludeFooter")), i(this.gridOptions.groupDefaultExpanded) && console.warn(S("groupIncludeTotalFooter")); + } + this.isEnableRangeSelection() && si.assertRegistered(t.ModuleNames.RangeSelectionModule, "enableRangeSelection"), !this.isEnableRangeSelection() && (this.isEnableRangeHandle() || this.isEnableFillHandle()) && console.warn("AG Grid: 'enableRangeHandle' and 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true"); + var O = function(z) { + d.gridOptions.icons && d.gridOptions.icons[z] && console.warn("gridOptions.icons." + z + " is no longer supported. For information on how to style checkboxes and radio buttons, see https://www.ag-grid.com/javascript-grid-icons/"); + }; + O("radioButtonOff"), O("radioButtonOn"), O("checkboxChecked"), O("checkboxUnchecked"), O("checkboxIndeterminate"), this.getScrollbarWidth(); + }, M.prototype.checkColumnDefProperties = function() { + var d = this; + this.gridOptions.columnDefs != null && this.gridOptions.columnDefs.forEach(function(g) { + var S = Object.getOwnPropertyNames(g), O = q8(_r.ALL_PROPERTIES, _r.FRAMEWORK_PROPERTIES); + d.checkProperties(S, O, O, "colDef", "https://www.ag-grid.com/javascript-grid-column-properties/"); + }); + }, M.prototype.checkGridOptionsProperties = function() { + var d = Object.getOwnPropertyNames(this.gridOptions), g = q8(Pi.ALL_PROPERTIES, Pi.FRAMEWORK_PROPERTIES, y(ui).map(function(O) { + return pi.getCallbackForEvent(O); + })), S = q8(g, ["api", "columnApi"]); + this.checkProperties(d, S, g, "gridOptions", "https://www.ag-grid.com/javascript-data-grid/grid-options/"); + }, M.prototype.checkProperties = function(d, g, S, O, z) { + var te = qa(d, g, S); + I(te, function(Fe, ze) { + console.warn("ag-grid: invalid " + O + " property '" + Fe + "' did you mean any of these: " + ze.slice(0, 8).join(", ")); + }), Object.keys(te).length > 0 && console.warn("ag-grid: to see all the valid " + O + " properties please check: " + z); + }, M.prototype.mergeGridCommonParams = function(d) { + var g = this; + if (d) { + var S = function(O) { + var z = Kv(Kv({}, O), { api: g.getApi(), columnApi: g.getColumnApi(), context: g.getContext() }); + return d(z); + }; + return S; + } + return d; + }, M.prototype.getDomDataKey = function() { + return this.domDataKey; + }, M.prototype.getDomData = function(d, g) { + var S = d[this.getDomDataKey()]; + return S ? S[g] : void 0; + }, M.prototype.setDomData = function(d, g, S) { + var O = this.getDomDataKey(), z = d[O]; + r(z) && (z = {}, d[O] = z), z[g] = S; + }, M.prototype.isRowSelection = function() { + return this.gridOptions.rowSelection === "single" || this.gridOptions.rowSelection === "multiple"; + }, M.prototype.isSuppressRowDeselection = function() { + return Ar(this.gridOptions.suppressRowDeselection); + }, M.prototype.isRowSelectionMulti = function() { + return this.gridOptions.rowSelection === "multiple"; + }, M.prototype.isRowMultiSelectWithClick = function() { + return Ar(this.gridOptions.rowMultiSelectWithClick); + }, M.prototype.getContext = function() { + return this.gridOptions.context; + }, M.prototype.isPivotMode = function() { + return Ar(this.gridOptions.pivotMode); + }, M.prototype.isSuppressExpandablePivotGroups = function() { + return Ar(this.gridOptions.suppressExpandablePivotGroups); + }, M.prototype.getPivotColumnGroupTotals = function() { + return this.gridOptions.pivotColumnGroupTotals; + }, M.prototype.getPivotRowTotals = function() { + return this.gridOptions.pivotRowTotals; + }, M.prototype.isRowModelInfinite = function() { + return this.gridOptions.rowModelType === Ue.ROW_MODEL_TYPE_INFINITE; + }, M.prototype.isRowModelViewport = function() { + return this.gridOptions.rowModelType === Ue.ROW_MODEL_TYPE_VIEWPORT; + }, M.prototype.isRowModelServerSide = function() { + return this.gridOptions.rowModelType === Ue.ROW_MODEL_TYPE_SERVER_SIDE; + }, M.prototype.isRowModelDefault = function() { + return r(this.gridOptions.rowModelType) || this.gridOptions.rowModelType === Ue.ROW_MODEL_TYPE_CLIENT_SIDE; + }, M.prototype.isFullRowEdit = function() { + return this.gridOptions.editType === "fullRow"; + }, M.prototype.isSuppressFocusAfterRefresh = function() { + return Ar(this.gridOptions.suppressFocusAfterRefresh); + }, M.prototype.isSuppressBrowserResizeObserver = function() { + return Ar(this.gridOptions.suppressBrowserResizeObserver); + }, M.prototype.isSuppressMaintainUnsortedOrder = function() { + return Ar(this.gridOptions.suppressMaintainUnsortedOrder); + }, M.prototype.isSuppressClearOnFillReduction = function() { + return Ar(this.gridOptions.suppressClearOnFillReduction); + }, M.prototype.isShowToolPanel = function() { + return Ar(this.gridOptions.sideBar && Array.isArray(this.getSideBar().toolPanels)); + }, M.prototype.getSideBar = function() { + return this.gridOptions.sideBar; + }, M.prototype.isSuppressTouch = function() { + return Ar(this.gridOptions.suppressTouch); + }, M.prototype.isMaintainColumnOrder = function() { + return Ar(this.gridOptions.maintainColumnOrder); + }, M.prototype.isSuppressRowTransform = function() { + return Ar(this.gridOptions.suppressRowTransform); + }, M.prototype.isSuppressColumnStateEvents = function() { + return Ar(this.gridOptions.suppressColumnStateEvents); + }, M.prototype.isAllowDragFromColumnsToolPanel = function() { + return Ar(this.gridOptions.allowDragFromColumnsToolPanel); + }, M.prototype.useAsyncEvents = function() { + return !Ar(this.gridOptions.suppressAsyncEvents); + }, M.prototype.isEnableCellChangeFlash = function() { + return Ar(this.gridOptions.enableCellChangeFlash); + }, M.prototype.getCellFlashDelay = function() { + return this.gridOptions.cellFlashDelay || 500; + }, M.prototype.getCellFadeDelay = function() { + return this.gridOptions.cellFadeDelay || 1e3; + }, M.prototype.isGroupSelectsChildren = function() { + return Ar(this.gridOptions.groupSelectsChildren); + }, M.prototype.isSuppressRowHoverHighlight = function() { + return Ar(this.gridOptions.suppressRowHoverHighlight); + }, M.prototype.isColumnHoverHighlight = function() { + return Ar(this.gridOptions.columnHoverHighlight); + }, M.prototype.isGroupSelectsFiltered = function() { + return Ar(this.gridOptions.groupSelectsFiltered); + }, M.prototype.isGroupHideOpenParents = function() { + return Ar(this.gridOptions.groupHideOpenParents); + }, M.prototype.isGroupMaintainOrder = function() { + return Ar(this.gridOptions.groupMaintainOrder); + }, M.prototype.getAutoGroupColumnDef = function() { + return this.gridOptions.autoGroupColumnDef; + }, M.prototype.isGroupMultiAutoColumn = function() { + return this.gridOptions.groupDisplayType ? this.matchesGroupDisplayType("multipleColumns", this.gridOptions.groupDisplayType) : Ar(this.gridOptions.groupHideOpenParents); + }, M.prototype.isGroupUseEntireRow = function(d) { + return d ? !1 : this.gridOptions.groupDisplayType ? this.matchesGroupDisplayType("groupRows", this.gridOptions.groupDisplayType) : !1; + }, M.prototype.isGroupSuppressAutoColumn = function() { + var d = this.gridOptions.groupDisplayType ? this.matchesGroupDisplayType("custom", this.gridOptions.groupDisplayType) : !1; + return d ? !0 : this.gridOptions.treeDataDisplayType ? this.matchesTreeDataDisplayType("custom", this.gridOptions.treeDataDisplayType) : !1; + }, M.prototype.isGroupRemoveSingleChildren = function() { + return Ar(this.gridOptions.groupRemoveSingleChildren); + }, M.prototype.isGroupRemoveLowestSingleChildren = function() { + return Ar(this.gridOptions.groupRemoveLowestSingleChildren); + }, M.prototype.isGroupIncludeFooter = function() { + return Ar(this.gridOptions.groupIncludeFooter); + }, M.prototype.isGroupIncludeTotalFooter = function() { + return Ar(this.gridOptions.groupIncludeTotalFooter); + }, M.prototype.isGroupSuppressBlankHeader = function() { + return Ar(this.gridOptions.groupSuppressBlankHeader); + }, M.prototype.isSuppressRowClickSelection = function() { + return Ar(this.gridOptions.suppressRowClickSelection); + }, M.prototype.isSuppressCellFocus = function() { + return Ar(this.gridOptions.suppressCellFocus); + }, M.prototype.isSuppressMultiSort = function() { + return Ar(this.gridOptions.suppressMultiSort); + }, M.prototype.isAlwaysMultiSort = function() { + return Ar(this.gridOptions.alwaysMultiSort); + }, M.prototype.isMultiSortKeyCtrl = function() { + return this.gridOptions.multiSortKey === "ctrl"; + }, M.prototype.isPivotSuppressAutoColumn = function() { + return Ar(this.gridOptions.pivotSuppressAutoColumn); + }, M.prototype.isSuppressDragLeaveHidesColumns = function() { + return Ar(this.gridOptions.suppressDragLeaveHidesColumns); + }, M.prototype.isSuppressScrollOnNewData = function() { + return Ar(this.gridOptions.suppressScrollOnNewData); + }, M.prototype.isSuppressScrollWhenPopupsAreOpen = function() { + return Ar(this.gridOptions.suppressScrollWhenPopupsAreOpen); + }, M.prototype.isRowDragEntireRow = function() { + return Ar(this.gridOptions.rowDragEntireRow); + }, M.prototype.isSuppressRowDrag = function() { + return Ar(this.gridOptions.suppressRowDrag); + }, M.prototype.isRowDragManaged = function() { + return Ar(this.gridOptions.rowDragManaged); + }, M.prototype.isSuppressMoveWhenRowDragging = function() { + return Ar(this.gridOptions.suppressMoveWhenRowDragging); + }, M.prototype.isRowDragMultiRow = function() { + return Ar(this.gridOptions.rowDragMultiRow); + }, M.prototype.getDomLayout = function() { + var d = this.gridOptions.domLayout || Ue.DOM_LAYOUT_NORMAL, g = [ + Ue.DOM_LAYOUT_PRINT, + Ue.DOM_LAYOUT_AUTO_HEIGHT, + Ue.DOM_LAYOUT_NORMAL + ]; + return g.indexOf(d) === -1 ? (Ge(function() { + return console.warn("AG Grid: " + d + " is not valid for DOM Layout, valid values are " + Ue.DOM_LAYOUT_NORMAL + ", " + Ue.DOM_LAYOUT_AUTO_HEIGHT + " and " + Ue.DOM_LAYOUT_PRINT); + }, "warn about dom layout values"), Ue.DOM_LAYOUT_NORMAL) : d; + }, M.prototype.isSuppressHorizontalScroll = function() { + return Ar(this.gridOptions.suppressHorizontalScroll); + }, M.prototype.isSuppressMaxRenderedRowRestriction = function() { + return Ar(this.gridOptions.suppressMaxRenderedRowRestriction); + }, M.prototype.isExcludeChildrenWhenTreeDataFiltering = function() { + return Ar(this.gridOptions.excludeChildrenWhenTreeDataFiltering); + }, M.prototype.isAlwaysShowHorizontalScroll = function() { + return Ar(this.gridOptions.alwaysShowHorizontalScroll); + }, M.prototype.isAlwaysShowVerticalScroll = function() { + return Ar(this.gridOptions.alwaysShowVerticalScroll); + }, M.prototype.isDebounceVerticalScrollbar = function() { + return Ar(this.gridOptions.debounceVerticalScrollbar); + }, M.prototype.isSuppressLoadingOverlay = function() { + return Ar(this.gridOptions.suppressLoadingOverlay); + }, M.prototype.isSuppressNoRowsOverlay = function() { + return Ar(this.gridOptions.suppressNoRowsOverlay); + }, M.prototype.isSuppressFieldDotNotation = function() { + return Ar(this.gridOptions.suppressFieldDotNotation); + }, M.prototype.getPinnedTopRowData = function() { + return this.gridOptions.pinnedTopRowData; + }, M.prototype.getPinnedBottomRowData = function() { + return this.gridOptions.pinnedBottomRowData; + }, M.prototype.isFunctionsPassive = function() { + return Ar(this.gridOptions.functionsPassive); + }, M.prototype.isSuppressChangeDetection = function() { + return Ar(this.gridOptions.suppressChangeDetection); + }, M.prototype.isSuppressAnimationFrame = function() { + return Ar(this.gridOptions.suppressAnimationFrame); + }, M.prototype.getQuickFilterText = function() { + return this.gridOptions.quickFilterText; + }, M.prototype.isCacheQuickFilter = function() { + return Ar(this.gridOptions.cacheQuickFilter); + }, M.prototype.isUnSortIcon = function() { + return Ar(this.gridOptions.unSortIcon); + }, M.prototype.isSuppressMenuHide = function() { + return Ar(this.gridOptions.suppressMenuHide); + }, M.prototype.isEnterMovesDownAfterEdit = function() { + return Ar(this.gridOptions.enterMovesDownAfterEdit); + }, M.prototype.isEnterMovesDown = function() { + return Ar(this.gridOptions.enterMovesDown); + }, M.prototype.isUndoRedoCellEditing = function() { + return Ar(this.gridOptions.undoRedoCellEditing); + }, M.prototype.getUndoRedoCellEditingLimit = function() { + return xL(this.gridOptions.undoRedoCellEditingLimit); + }, M.prototype.getRowStyle = function() { + return this.gridOptions.rowStyle; + }, M.prototype.getRowClass = function() { + return this.gridOptions.rowClass; + }, M.prototype.getRowStyleFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getRowStyle); + }, M.prototype.getRowClassFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getRowClass); + }, M.prototype.rowClassRules = function() { + return this.gridOptions.rowClassRules; + }, M.prototype.getServerSideStoreType = function() { + return this.gridOptions.serverSideStoreType; + }, M.prototype.getServerSideStoreParamsFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getServerSideStoreParams); + }, M.prototype.getCreateChartContainerFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.createChartContainer); + }, M.prototype.getPopupParent = function() { + return this.gridOptions.popupParent; + }, M.prototype.getBlockLoadDebounceMillis = function() { + return this.gridOptions.blockLoadDebounceMillis; + }, M.prototype.getPostProcessPopupFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.postProcessPopup); + }, M.prototype.getPaginationNumberFormatterFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.paginationNumberFormatter); + }, M.prototype.getChildCountFunc = function() { + return this.gridOptions.getChildCount; + }, M.prototype.getIsApplyServerSideTransactionFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.isApplyServerSideTransaction); + }, M.prototype.getInitialGroupOrderComparator = function() { + var d = this.gridOptions, g = d.initialGroupOrderComparator, S = d.defaultGroupOrderComparator; + if (g) + return this.mergeGridCommonParams(g); + if (S) + return function(O) { + return S(O.nodeA, O.nodeB); + }; + }, M.prototype.getIsFullWidthCellFunc = function() { + var d = this.gridOptions, g = d.isFullWidthRow, S = d.isFullWidthCell; + if (g) + return this.mergeGridCommonParams(g); + if (S) + return function(O) { + return S(O.rowNode); + }; + }, M.prototype.getFullWidthCellRendererParams = function() { + return this.gridOptions.fullWidthCellRendererParams; + }, M.prototype.isEmbedFullWidthRows = function() { + return Ar(this.gridOptions.embedFullWidthRows) || Ar(this.gridOptions.deprecatedEmbedFullWidthRows); + }, M.prototype.isDetailRowAutoHeight = function() { + return Ar(this.gridOptions.detailRowAutoHeight); + }, M.prototype.getSuppressKeyboardEventFunc = function() { + return this.gridOptions.suppressKeyboardEvent; + }, M.prototype.getBusinessKeyForNodeFunc = function() { + return this.gridOptions.getBusinessKeyForNode; + }, M.prototype.getApi = function() { + return this.gridOptions.api; + }, M.prototype.getColumnApi = function() { + return this.gridOptions.columnApi; + }, M.prototype.isReadOnlyEdit = function() { + return Ar(this.gridOptions.readOnlyEdit); + }, M.prototype.isImmutableData = function() { + var d = this.gridOptions.getRowId != null, g = Ar(this.gridOptions.immutableData), S = Ar(this.gridOptions.resetRowDataOnUpdate); + return S ? !1 : d || g; + }, M.prototype.isEnsureDomOrder = function() { + return Ar(this.gridOptions.ensureDomOrder); + }, M.prototype.isEnableCharts = function() { + return Ar(this.gridOptions.enableCharts) ? si.assertRegistered(t.ModuleNames.GridChartsModule, "enableCharts") : !1; + }, M.prototype.getColResizeDefault = function() { + return this.gridOptions.colResizeDefault; + }, M.prototype.isSingleClickEdit = function() { + return Ar(this.gridOptions.singleClickEdit); + }, M.prototype.isSuppressClickEdit = function() { + return Ar(this.gridOptions.suppressClickEdit); + }, M.prototype.isStopEditingWhenCellsLoseFocus = function() { + return Ar(this.gridOptions.stopEditingWhenCellsLoseFocus); + }, M.prototype.getGroupDefaultExpanded = function() { + return this.gridOptions.groupDefaultExpanded; + }, M.prototype.getMaxConcurrentDatasourceRequests = function() { + var d = xL(this.gridOptions.maxConcurrentDatasourceRequests); + if (d == null) + return 2; + if (!(d <= 0)) + return d; + }, M.prototype.getMaxBlocksInCache = function() { + return this.gridOptions.maxBlocksInCache; + }, M.prototype.getCacheOverflowSize = function() { + return this.gridOptions.cacheOverflowSize; + }, M.prototype.getPaginationPageSize = function() { + return xL(this.gridOptions.paginationPageSize); + }, M.prototype.isPaginateChildRows = function() { + var d = this.isGroupRemoveSingleChildren() || this.isGroupRemoveLowestSingleChildren(); + return d ? !0 : Ar(this.gridOptions.paginateChildRows); + }, M.prototype.getCacheBlockSize = function() { + return bH(this.gridOptions.cacheBlockSize); + }, M.prototype.getInfiniteInitialRowCount = function() { + return this.gridOptions.infiniteInitialRowCount; + }, M.prototype.isPurgeClosedRowNodes = function() { + return Ar(this.gridOptions.purgeClosedRowNodes); + }, M.prototype.isSuppressPaginationPanel = function() { + return Ar(this.gridOptions.suppressPaginationPanel); + }, M.prototype.getRowData = function() { + return this.gridOptions.rowData; + }, M.prototype.isEnableRtl = function() { + return Ar(this.gridOptions.enableRtl); + }, M.prototype.getRowGroupPanelShow = function() { + return this.gridOptions.rowGroupPanelShow; + }, M.prototype.getPivotPanelShow = function() { + return this.gridOptions.pivotPanelShow; + }, M.prototype.isAngularCompileRows = function() { + return Ar(this.gridOptions.angularCompileRows); + }, M.prototype.isAngularCompileFilters = function() { + return Ar(this.gridOptions.angularCompileFilters); + }, M.prototype.isDebug = function() { + return Ar(this.gridOptions.debug); + }, M.prototype.getColumnDefs = function() { + return this.gridOptions.columnDefs; + }, M.prototype.getColumnTypes = function() { + return this.gridOptions.columnTypes; + }, M.prototype.getDatasource = function() { + return this.gridOptions.datasource; + }, M.prototype.getViewportDatasource = function() { + return this.gridOptions.viewportDatasource; + }, M.prototype.getServerSideDatasource = function() { + return this.gridOptions.serverSideDatasource; + }, M.prototype.isAccentedSort = function() { + return Ar(this.gridOptions.accentedSort); + }, M.prototype.isEnableBrowserTooltips = function() { + return Ar(this.gridOptions.enableBrowserTooltips); + }, M.prototype.isEnableCellExpressions = function() { + return Ar(this.gridOptions.enableCellExpressions); + }, M.prototype.isEnableGroupEdit = function() { + return Ar(this.gridOptions.enableGroupEdit); + }, M.prototype.isSuppressMiddleClickScrolls = function() { + return Ar(this.gridOptions.suppressMiddleClickScrolls); + }, M.prototype.isPreventDefaultOnContextMenu = function() { + return Ar(this.gridOptions.preventDefaultOnContextMenu); + }, M.prototype.isSuppressPreventDefaultOnMouseWheel = function() { + return Ar(this.gridOptions.suppressPreventDefaultOnMouseWheel); + }, M.prototype.isSuppressColumnVirtualisation = function() { + return Ar(this.gridOptions.suppressColumnVirtualisation); + }, M.prototype.isSuppressRowVirtualisation = function() { + return Ar(this.gridOptions.suppressRowVirtualisation); + }, M.prototype.isSuppressContextMenu = function() { + return Ar(this.gridOptions.suppressContextMenu); + }, M.prototype.isAllowContextMenuWithControlKey = function() { + return Ar(this.gridOptions.allowContextMenuWithControlKey); + }, M.prototype.isSuppressCopyRowsToClipboard = function() { + return Ar(this.gridOptions.suppressCopyRowsToClipboard); + }, M.prototype.isSuppressCopySingleCellRanges = function() { + return Ar(this.gridOptions.suppressCopySingleCellRanges); + }, M.prototype.isCopyHeadersToClipboard = function() { + return Ar(this.gridOptions.copyHeadersToClipboard); + }, M.prototype.isCopyGroupHeadersToClipboard = function() { + return Ar(this.gridOptions.copyGroupHeadersToClipboard); + }, M.prototype.isSuppressClipboardPaste = function() { + return Ar(this.gridOptions.suppressClipboardPaste); + }, M.prototype.isSuppressLastEmptyLineOnPaste = function() { + return Ar(this.gridOptions.suppressLastEmptyLineOnPaste); + }, M.prototype.isPagination = function() { + return Ar(this.gridOptions.pagination); + }, M.prototype.isSuppressEnterpriseResetOnNewColumns = function() { + return Ar(this.gridOptions.suppressEnterpriseResetOnNewColumns); + }, M.prototype.getProcessDataFromClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processDataFromClipboard); + }, M.prototype.getAsyncTransactionWaitMillis = function() { + return i(this.gridOptions.asyncTransactionWaitMillis) ? this.gridOptions.asyncTransactionWaitMillis : Ue.BATCH_WAIT_MILLIS; + }, M.prototype.isSuppressMovableColumns = function() { + return Ar(this.gridOptions.suppressMovableColumns); + }, M.prototype.isAnimateRows = function() { + return this.isEnsureDomOrder() ? !1 : Ar(this.gridOptions.animateRows); + }, M.prototype.isSuppressColumnMoveAnimation = function() { + return Ar(this.gridOptions.suppressColumnMoveAnimation); + }, M.prototype.isSuppressAggFuncInHeader = function() { + return Ar(this.gridOptions.suppressAggFuncInHeader); + }, M.prototype.isSuppressAggAtRootLevel = function() { + return Ar(this.gridOptions.suppressAggAtRootLevel); + }, M.prototype.isSuppressAggFilteredOnly = function() { + var d = this.getGroupAggFiltering() !== void 0; + return d || Ar(this.gridOptions.suppressAggFilteredOnly); + }, M.prototype.isRemovePivotHeaderRowWhenSingleValueColumn = function() { + return Ar(this.gridOptions.removePivotHeaderRowWhenSingleValueColumn); + }, M.prototype.isShowOpenedGroup = function() { + return Ar(this.gridOptions.showOpenedGroup); + }, M.prototype.isReactUi = function() { + return Ar(this.gridOptions.reactUi); + }, M.prototype.isSuppressReactUi = function() { + return Ar(this.gridOptions.suppressReactUi); + }, M.prototype.isEnableRangeSelection = function() { + return si.isRegistered(t.ModuleNames.RangeSelectionModule) && Ar(this.gridOptions.enableRangeSelection); + }, M.prototype.isEnableRangeHandle = function() { + return Ar(this.gridOptions.enableRangeHandle); + }, M.prototype.isEnableFillHandle = function() { + return Ar(this.gridOptions.enableFillHandle); + }, M.prototype.getFillHandleDirection = function() { + var d = this.gridOptions.fillHandleDirection; + return d ? d !== "x" && d !== "y" && d !== "xy" ? (Ge(function() { + return console.warn("AG Grid: valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."); + }, "warn invalid fill direction"), "xy") : d : "xy"; + }, M.prototype.getFillOperation = function() { + return this.mergeGridCommonParams(this.gridOptions.fillOperation); + }, M.prototype.isSuppressMultiRangeSelection = function() { + return Ar(this.gridOptions.suppressMultiRangeSelection); + }, M.prototype.isPaginationAutoPageSize = function() { + return Ar(this.gridOptions.paginationAutoPageSize); + }, M.prototype.isRememberGroupStateWhenNewData = function() { + return Ar(this.gridOptions.rememberGroupStateWhenNewData); + }, M.prototype.getIcons = function() { + return this.gridOptions.icons; + }, M.prototype.getGroupAggFiltering = function() { + var d = this.gridOptions.groupAggFiltering; + if (typeof d == "function") + return this.mergeGridCommonParams(d); + if (Ar(d)) + return function() { + return !0; + }; + }, M.prototype.getAggFuncs = function() { + return this.gridOptions.aggFuncs; + }, M.prototype.getSortingOrder = function() { + return this.gridOptions.sortingOrder; + }, M.prototype.getAlignedGrids = function() { + return this.gridOptions.alignedGrids; + }, M.prototype.isMasterDetail = function() { + var d = Ar(this.gridOptions.masterDetail); + return d ? si.assertRegistered(t.ModuleNames.MasterDetailModule, "masterDetail") : !1; + }, M.prototype.isKeepDetailRows = function() { + return Ar(this.gridOptions.keepDetailRows); + }, M.prototype.getKeepDetailRowsCount = function() { + var d = this.gridOptions.keepDetailRowsCount; + return i(d) && d > 0 ? this.gridOptions.keepDetailRowsCount : wL; + }, M.prototype.getIsRowMasterFunc = function() { + return this.gridOptions.isRowMaster; + }, M.prototype.getIsRowSelectableFunc = function() { + return this.gridOptions.isRowSelectable; + }, M.prototype.getGroupRowRendererParams = function() { + return this.gridOptions.groupRowRendererParams; + }, M.prototype.getOverlayLoadingTemplate = function() { + return this.gridOptions.overlayLoadingTemplate; + }, M.prototype.getOverlayNoRowsTemplate = function() { + return this.gridOptions.overlayNoRowsTemplate; + }, M.prototype.isSuppressAutoSize = function() { + return Ar(this.gridOptions.suppressAutoSize); + }, M.prototype.isEnableCellTextSelection = function() { + return Ar(this.gridOptions.enableCellTextSelection); + }, M.prototype.isSuppressParentsInRowNodes = function() { + return Ar(this.gridOptions.suppressParentsInRowNodes); + }, M.prototype.isSuppressClipboardApi = function() { + return Ar(this.gridOptions.suppressClipboardApi); + }, M.prototype.isFunctionsReadOnly = function() { + return Ar(this.gridOptions.functionsReadOnly); + }, M.prototype.isEnableCellTextSelect = function() { + return Ar(this.gridOptions.enableCellTextSelection); + }, M.prototype.getDefaultColDef = function() { + return this.gridOptions.defaultColDef; + }, M.prototype.getDefaultColGroupDef = function() { + return this.gridOptions.defaultColGroupDef; + }, M.prototype.getDefaultExportParams = function(d) { + if (this.gridOptions.defaultExportParams) + return console.warn("AG Grid: Since v25.2 `defaultExportParams` has been replaced by `default" + xi(d) + "ExportParams`'"), d === "csv" ? this.gridOptions.defaultExportParams : this.gridOptions.defaultExportParams; + if (d === "csv" && this.gridOptions.defaultCsvExportParams) + return this.gridOptions.defaultCsvExportParams; + if (d === "excel" && this.gridOptions.defaultExcelExportParams) + return this.gridOptions.defaultExcelExportParams; + }, M.prototype.isSuppressCsvExport = function() { + return Ar(this.gridOptions.suppressCsvExport); + }, M.prototype.isAllowShowChangeAfterFilter = function() { + return Ar(this.gridOptions.allowShowChangeAfterFilter); + }, M.prototype.isSuppressExcelExport = function() { + return Ar(this.gridOptions.suppressExcelExport); + }, M.prototype.isSuppressMakeColumnVisibleAfterUnGroup = function() { + return Ar(this.gridOptions.suppressMakeColumnVisibleAfterUnGroup); + }, M.prototype.getDataPathFunc = function() { + return this.gridOptions.getDataPath; + }, M.prototype.getIsServerSideGroupFunc = function() { + return this.gridOptions.isServerSideGroup; + }, M.prototype.getIsServerSideGroupOpenByDefaultFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.isServerSideGroupOpenByDefault); + }, M.prototype.getIsGroupOpenByDefaultFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.isGroupOpenByDefault); + }, M.prototype.getServerSideGroupKeyFunc = function() { + return this.gridOptions.getServerSideGroupKey; + }, M.prototype.getGroupRowAggFunc = function() { + var d = this.gridOptions, g = d.getGroupRowAgg, S = d.groupRowAggNodes; + if (g) + return this.mergeGridCommonParams(g); + if (S) + return function(O) { + return S(O.nodes); + }; + }, M.prototype.getContextMenuItemsFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getContextMenuItems); + }, M.prototype.getMainMenuItemsFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getMainMenuItems); + }, M.prototype.getRowIdFunc = function() { + var d = this.gridOptions, g = d.getRowId, S = d.getRowNodeId; + if (g) + return this.mergeGridCommonParams(g); + if (S) + return function(O) { + return S(O.data); + }; + }, M.prototype.getNavigateToNextHeaderFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.navigateToNextHeader); + }, M.prototype.getTabToNextHeaderFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.tabToNextHeader); + }, M.prototype.getNavigateToNextCellFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.navigateToNextCell); + }, M.prototype.getTabToNextCellFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.tabToNextCell); + }, M.prototype.getGridTabIndex = function() { + return (this.gridOptions.tabIndex || 0).toString(); + }, M.prototype.isTreeData = function() { + var d = Ar(this.gridOptions.treeData); + return d ? si.assertRegistered(t.ModuleNames.RowGroupingModule, "Tree Data") : !1; + }, M.prototype.isValueCache = function() { + return Ar(this.gridOptions.valueCache); + }, M.prototype.isValueCacheNeverExpires = function() { + return Ar(this.gridOptions.valueCacheNeverExpires); + }, M.prototype.isDeltaSort = function() { + return Ar(this.gridOptions.deltaSort); + }, M.prototype.isAggregateOnlyChangedColumns = function() { + return Ar(this.gridOptions.aggregateOnlyChangedColumns); + }, M.prototype.getProcessSecondaryColDefFunc = function() { + return this.gridOptions.processSecondaryColDef; + }, M.prototype.getProcessSecondaryColGroupDefFunc = function() { + return this.gridOptions.processSecondaryColGroupDef; + }, M.prototype.getSendToClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.sendToClipboard); + }, M.prototype.getProcessRowPostCreateFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processRowPostCreate); + }, M.prototype.getProcessCellForClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processCellForClipboard); + }, M.prototype.getProcessHeaderForClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processHeaderForClipboard); + }, M.prototype.getProcessGroupHeaderForClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processGroupHeaderForClipboard); + }, M.prototype.getProcessCellFromClipboardFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.processCellFromClipboard); + }, M.prototype.getViewportRowModelPageSize = function() { + return bH(this.gridOptions.viewportRowModelPageSize, Are); + }, M.prototype.getViewportRowModelBufferSize = function() { + return _H(this.gridOptions.viewportRowModelBufferSize, d_e); + }, M.prototype.isServerSideSortingAlwaysResets = function() { + return Ar(this.gridOptions.serverSideSortingAlwaysResets); + }, M.prototype.isServerSideFilteringAlwaysResets = function() { + return Ar(this.gridOptions.serverSideFilteringAlwaysResets); + }, M.prototype.getPostSortFunc = function() { + var d = this.gridOptions, g = d.postSortRows, S = d.postSort; + if (g) + return this.mergeGridCommonParams(g); + if (S) + return function(O) { + return S(O.nodes); + }; + }, M.prototype.getChartToolbarItemsFunc = function() { + return this.mergeGridCommonParams(this.gridOptions.getChartToolbarItems); + }, M.prototype.getChartThemeOverrides = function() { + return this.gridOptions.chartThemeOverrides; + }, M.prototype.getCustomChartThemes = function() { + return this.gridOptions.customChartThemes; + }, M.prototype.getChartThemes = function() { + return this.gridOptions.chartThemes || ["ag-default", "ag-material", "ag-pastel", "ag-vivid", "ag-solar"]; + }, M.prototype.getClipboardDelimiter = function() { + return i(this.gridOptions.clipboardDelimiter) ? this.gridOptions.clipboardDelimiter : " "; + }, M.prototype.setProperty = function(d, g, S) { + S === void 0 && (S = !1); + var O = this.gridOptions, z = O[d]; + if (S || z !== g) { + O[d] = g; + var te = { + type: d, + currentValue: g, + previousValue: z + }; + this.propertyEventService.dispatchEvent(te); + } + }, M.prototype.addEventListener = function(d, g) { + this.propertyEventService.addEventListener(d, g); + }, M.prototype.removeEventListener = function(d, g) { + this.propertyEventService.removeEventListener(d, g); + }, M.prototype.isSkipHeaderOnAutoSize = function() { + return !!this.gridOptions.skipHeaderOnAutoSize; + }, M.prototype.getAutoSizePadding = function() { + var d = this.gridOptions.autoSizePadding; + return d != null && d >= 0 ? d : 20; + }, M.prototype.getHeaderHeight = function() { + return typeof this.gridOptions.headerHeight == "number" ? this.gridOptions.headerHeight : this.getFromTheme(25, "headerHeight"); + }, M.prototype.getFloatingFiltersHeight = function() { + return typeof this.gridOptions.floatingFiltersHeight == "number" ? this.gridOptions.floatingFiltersHeight : this.getFromTheme(25, "headerHeight"); + }, M.prototype.getGroupHeaderHeight = function() { + return typeof this.gridOptions.groupHeaderHeight == "number" ? this.gridOptions.groupHeaderHeight : this.getHeaderHeight(); + }, M.prototype.getPivotHeaderHeight = function() { + return typeof this.gridOptions.pivotHeaderHeight == "number" ? this.gridOptions.pivotHeaderHeight : this.getHeaderHeight(); + }, M.prototype.getPivotGroupHeaderHeight = function() { + return typeof this.gridOptions.pivotGroupHeaderHeight == "number" ? this.gridOptions.pivotGroupHeaderHeight : this.getGroupHeaderHeight(); + }, M.prototype.isExternalFilterPresent = function() { + return typeof this.gridOptions.isExternalFilterPresent == "function" ? this.gridOptions.isExternalFilterPresent({ api: this.getApi(), columnApi: this.getColumnApi(), context: this.getContext() }) : !1; + }, M.prototype.doesExternalFilterPass = function(d) { + return typeof this.gridOptions.doesExternalFilterPass == "function" ? this.gridOptions.doesExternalFilterPass(d) : !1; + }, M.prototype.getTooltipDelay = function(d) { + var g = this.gridOptions, S = g.tooltipShowDelay, O = g.tooltipHideDelay, z = d === "show" ? S : O, te = xi(d); + return i(z) ? (z < 0 && Ge(function() { + return console.warn("ag-grid: tooltip" + te + "Delay should not be lower than 0"); + }, "tooltip" + te + "DelayWarn"), Math.max(200, z)) : null; + }, M.prototype.isTooltipMouseTrack = function() { + return Ar(this.gridOptions.tooltipMouseTrack); + }, M.prototype.isSuppressModelUpdateAfterUpdateTransaction = function() { + return Ar(this.gridOptions.suppressModelUpdateAfterUpdateTransaction); + }, M.prototype.getDocument = function() { + var d = null; + return this.gridOptions.getDocument && i(this.gridOptions.getDocument) ? d = this.gridOptions.getDocument() : this.eGridDiv && (d = this.eGridDiv.ownerDocument), d && i(d) ? d : document; + }, M.prototype.getMinColWidth = function() { + var d = this.gridOptions.minColWidth; + if (i(d) && d > f.MIN_COL_WIDTH) + return this.gridOptions.minColWidth; + var g = this.getFromTheme(null, "headerCellMinWidth"); + return i(g) ? Math.max(g, f.MIN_COL_WIDTH) : f.MIN_COL_WIDTH; + }, M.prototype.getMaxColWidth = function() { + return this.gridOptions.maxColWidth && this.gridOptions.maxColWidth > f.MIN_COL_WIDTH ? this.gridOptions.maxColWidth : null; + }, M.prototype.getColWidth = function() { + return typeof this.gridOptions.colWidth != "number" || this.gridOptions.colWidth < f.MIN_COL_WIDTH ? 200 : this.gridOptions.colWidth; + }, M.prototype.getRowBuffer = function() { + var d = this.gridOptions.rowBuffer; + return typeof d == "number" ? d < 0 && (Ge(function() { + return console.warn("AG Grid: rowBuffer should not be negative"); + }, "warn rowBuffer negative"), this.gridOptions.rowBuffer = d = 0) : d = Ue.ROW_BUFFER_SIZE, d; + }, M.prototype.getRowBufferInPixels = function() { + var d = this.getRowBuffer(), g = this.getRowHeightAsNumber(); + return d * g; + }, M.prototype.getScrollbarWidth = function() { + if (this.scrollbarWidth == null) { + var d = typeof this.gridOptions.scrollbarWidth == "number" && this.gridOptions.scrollbarWidth >= 0, g = d ? this.gridOptions.scrollbarWidth : lh(); + g != null && (this.scrollbarWidth = g, this.eventService.dispatchEvent({ + type: ui.EVENT_SCROLLBAR_WIDTH_CHANGED + })); + } + return this.scrollbarWidth; + }, M.prototype.checkForDeprecated = function() { + var d = this.gridOptions; + d.deprecatedEmbedFullWidthRows && console.warn("AG Grid: since v21.2, deprecatedEmbedFullWidthRows has been replaced with embedFullWidthRows."), d.rowDeselection && console.warn("AG Grid: since v24.x, rowDeselection is deprecated and the behaviour is true by default. Please use `suppressRowDeselection` to prevent rows from being deselected."), d.enableMultiRowDragging && (d.rowDragMultiRow = !0, delete d.enableMultiRowDragging, console.warn("AG Grid: since v26.1, `enableMultiRowDragging` is deprecated. Please use `rowDragMultiRow`.")); + var g = function(z, te, Fe) { + d[z] != null && (console.warn("AG Grid: since version " + Fe + ", '" + z + "' is deprecated / renamed, please use the new property name '" + te + "' instead."), d[te] == null && (d[te] = d[z])); + }; + if (g("batchUpdateWaitMillis", "asyncTransactionWaitMillis", "23.1.x"), g("deltaRowDataMode", "immutableData", "23.1.x"), (d.immutableColumns || d.deltaColumnMode) && console.warn("AG Grid: since v24.0, immutableColumns and deltaColumnMode properties are gone. The grid now works like this as default. To keep column order maintained, set grid property applyColumnDefOrder=true"), g("suppressSetColumnStateEvents", "suppressColumnStateEvents", "24.0.x"), d.groupRowInnerRenderer || d.groupRowInnerRendererParams || d.groupRowInnerRendererFramework) { + console.warn("AG Grid: since v24.0, grid properties groupRowInnerRenderer, groupRowInnerRendererFramework and groupRowInnerRendererParams are no longer used."), console.warn(" Instead use the grid properties groupRowRendererParams.innerRenderer, groupRowRendererParams.innerRendererFramework and groupRowRendererParams.innerRendererParams."), console.warn(" For example instead of this:"), console.warn(' groupRowInnerRenderer: "myRenderer"'), console.warn(" groupRowInnerRendererParams: {x: a}"), console.warn(" Replace with this:"), console.warn(" groupRowRendererParams: {"), console.warn(' innerRenderer: "myRenderer",'), console.warn(" innerRendererParams: {x: a}"), console.warn(" }"), console.warn(" We have copied the properties over for you. However to stop this error message, please change your application code."), d.groupRowRendererParams || (d.groupRowRendererParams = {}); + var S = d.groupRowRendererParams; + d.groupRowInnerRenderer && (S.innerRenderer = d.groupRowInnerRenderer), d.groupRowInnerRendererParams && (S.innerRendererParams = d.groupRowInnerRendererParams), d.groupRowInnerRendererFramework && (S.innerRendererFramework = d.groupRowInnerRendererFramework); + } + if (d.rememberGroupStateWhenNewData && console.warn("AG Grid: since v24.0, grid property rememberGroupStateWhenNewData is deprecated. This feature was provided before Transaction Updates worked (which keep group state). Now that transaction updates are possible and they keep group state, this feature is no longer needed."), d.detailCellRendererParams && d.detailCellRendererParams.autoHeight && (console.warn("AG Grid: since v24.1, grid property detailCellRendererParams.autoHeight is replaced with grid property detailRowAutoHeight. This allows this feature to work when you provide a custom DetailCellRenderer"), d.detailRowAutoHeight = !0), d.suppressKeyboardEvent && console.warn(`AG Grid: since v24.1 suppressKeyboardEvent in the gridOptions has been deprecated and will be removed in + future versions of AG Grid. If you need this to be set for every column use the defaultColDef property.`), d.suppressEnterpriseResetOnNewColumns && console.warn("AG Grid: since v25, grid property suppressEnterpriseResetOnNewColumns is deprecated. This was a temporary property to allow changing columns in Server Side Row Model without triggering a reload. Now that it is possible to dynamically change columns in the grid, this is no longer needed."), d.suppressColumnStateEvents && console.warn('AG Grid: since v25, grid property suppressColumnStateEvents no longer works due to a refactor that we did. It should be possible to achieve similar using event.source, which would be "api" if the event was due to setting column state via the API'), d.defaultExportParams && console.warn("AG Grid: since v25.2, the grid property `defaultExportParams` has been replaced by `defaultCsvExportParams` and `defaultExcelExportParams`."), d.stopEditingWhenGridLosesFocus && (console.warn("AG Grid: since v25.2.2, the grid property `stopEditingWhenGridLosesFocus` has been replaced by `stopEditingWhenCellsLoseFocus`."), d.stopEditingWhenCellsLoseFocus = !0), d.applyColumnDefOrder && console.warn("AG Grid: since v26.0, the grid property `applyColumnDefOrder` is no longer needed, as this is the default behaviour. To turn this behaviour off, set maintainColumnOrder=true"), d.groupMultiAutoColumn && (console.warn("AG Grid: since v26.0, the grid property `groupMultiAutoColumn` has been replaced by `groupDisplayType = 'multipleColumns'`"), d.groupDisplayType = "multipleColumns"), d.groupUseEntireRow && (console.warn("AG Grid: since v26.0, the grid property `groupUseEntireRow` has been replaced by `groupDisplayType = 'groupRows'`"), d.groupDisplayType = "groupRows"), d.groupSuppressAutoColumn) { + var O = d.treeData ? "treeDataDisplayType" : "groupDisplayType"; + console.warn("AG Grid: since v26.0, the grid property `groupSuppressAutoColumn` has been replaced by `" + O + " = 'custom'`"), d.groupDisplayType = "custom"; + } + d.defaultGroupOrderComparator && console.warn("AG Grid: since v27.2, the grid property `defaultGroupOrderComparator` is deprecated and has been replaced by `initialGroupOrderComparator` and now receives a single params object."), d.defaultGroupSortComparator && (console.warn("AG Grid: since v26.0, the grid property `defaultGroupSortComparator` has been replaced by `initialGroupOrderComparator`"), d.defaultGroupOrderComparator = d.defaultGroupSortComparator), d.groupRowAggNodes && console.warn("AG Grid: since v27.2, the grid property `groupRowAggNodes` is deprecated and has been replaced by `getGroupRowAgg` and now receives a single params object."), d.postSort && console.warn("AG Grid: since v27.2, the grid property `postSort` is deprecated and has been replaced by `postSortRows` and now receives a single params object."), d.isFullWidthCell && console.warn("AG Grid: since v27.2, the grid property `isFullWidthCell` is deprecated and has been replaced by `isFullWidthRow` and now receives a single params object."), d.localeTextFunc && console.warn("AG Grid: since v27.2, the grid property `localeTextFunc` is deprecated and has been replaced by `getLocaleText` and now receives a single params object."), d.colWidth && console.warn("AG Grid: since v26.1, the grid property `colWidth` is deprecated and should be set via `defaultColDef.width`."), d.minColWidth && console.warn("AG Grid: since v26.1, the grid property `minColWidth` is deprecated and should be set via `defaultColDef.minWidth`."), d.maxColWidth && console.warn("AG Grid: since v26.1, the grid property `maxColWidth` is deprecated and should be set via `defaultColDef.maxWidth`."), d.reactUi && console.warn("AG Grid: since v27.0, React UI is on by default, so no need for reactUi=true. To turn it off, set suppressReactUi=true."), d.suppressReactUi && console.warn("AG Grid: The legacy React rendering engine is deprecated and will be removed in the next major version of the grid."), d.suppressCellSelection && (console.warn("AG Grid: since v27.0, `suppressCellSelection` has been replaced by `suppressCellFocus`."), d.suppressCellFocus = d.suppressCellSelection), d.getRowNodeId && console.warn("AG Grid: since v27.1, `getRowNodeId` is deprecated and has been replaced by `getRowId`. The difference: if getRowId() is implemented then immutable data is enabled by default."), d.immutableData && (d.getRowId ? console.warn("AG Grid: since v27.1, `immutableData` is deprecated. With the `getRowId` callback implemented, immutable data is enabled by default so you can remove `immutableData=true`.") : console.warn("AG Grid: since v27.1, `immutableData` is deprecated. To enable immutable data you must implement the `getRowId()` callback.")), d.clipboardDeliminator && (console.warn("AG Grid: since v27.1, `clipboardDeliminator` has been replaced by `clipboardDelimiter`."), d.clipboardDelimiter = d.clipboardDeliminator); + }, M.prototype.checkForViolations = function() { + this.isTreeData() && this.treeDataViolations(); + }, M.prototype.treeDataViolations = function() { + this.isRowModelDefault() && r(this.getDataPathFunc()) && console.warn("AG Grid: property usingTreeData=true with rowModel=clientSide, but you did not provide getDataPath function, please provide getDataPath function if using tree data."), this.isRowModelServerSide() && (r(this.getIsServerSideGroupFunc()) && console.warn("AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not provide isServerSideGroup function, please provide isServerSideGroup function if using tree data."), r(this.getServerSideGroupKeyFunc()) && console.warn("AG Grid: property usingTreeData=true with rowModel=serverSide, but you did not provide getServerSideGroupKey function, please provide getServerSideGroupKey function if using tree data.")); + }, M.prototype.getLocaleTextFunc = function() { + var d = this, g = this.gridOptions, S = g.localeText, O = g.getLocaleText, z = g.localeTextFunc; + return O ? function(te, Fe, ze) { + var ht = { + key: te, + defaultValue: Fe, + variableValues: ze, + api: d.getApi(), + columnApi: d.getColumnApi(), + context: d.getContext() + }; + return O(ht); + } : z || function(te, Fe, ze) { + var ht = S && S[te]; + if (ht && ze && ze.length) + for (var Lt = 0; !(Lt >= ze.length); ) { + var ti = ht.indexOf("${variable}"); + if (ti === -1) + break; + ht = ht.replace("${variable}", ze[Lt++]); + } + return ht ?? Fe; + }; + }, M.prototype.globalEventHandler = function(d, g) { + if (!this.destroyed) { + var S = pi.getCallbackForEvent(d); + typeof this.gridOptions[S] == "function" && this.gridOptions[S](g); + } + }, M.prototype.setRowHeightVariable = function(d) { + var g = this.eGridDiv.style.getPropertyValue("--ag-line-height").trim(), S = d + "px"; + g != S && this.eGridDiv.style.setProperty("--ag-line-height", S); + }, M.prototype.getRowHeightAsNumber = function() { + if (!this.gridOptions.rowHeight || r(this.gridOptions.rowHeight)) + return this.getDefaultRowHeight(); + var d = this.gridOptions.rowHeight; + return d && this.isNumeric(d) ? (this.setRowHeightVariable(d), d) : (console.warn("AG Grid row height must be a number if not using standard row model"), this.getDefaultRowHeight()); + }, M.prototype.isGetRowHeightFunction = function() { + return typeof this.gridOptions.getRowHeight == "function"; + }, M.prototype.getRowHeightForNode = function(d, g, S) { + if (g === void 0 && (g = !1), S == null && (S = this.getDefaultRowHeight()), this.isGetRowHeightFunction()) { + if (g) + return { height: S, estimated: !0 }; + var O = { + node: d, + data: d.data + }, z = this.mergeGridCommonParams(this.gridOptions.getRowHeight)(O); + if (this.isNumeric(z)) + return z === 0 && Ge(function() { + return console.warn("AG Grid: The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead."); + }, "invalidRowHeight"), { height: Math.max(1, z), estimated: !1 }; + } + if (d.detail && this.isMasterDetail()) + return this.isDetailRowAutoHeight() ? { height: 1, estimated: !1 } : this.isNumeric(this.gridOptions.detailRowHeight) ? { height: this.gridOptions.detailRowHeight, estimated: !1 } : { height: Ire, estimated: !1 }; + var te = this.gridOptions.rowHeight && this.isNumeric(this.gridOptions.rowHeight) ? this.gridOptions.rowHeight : S; + return { height: te, estimated: !1 }; + }, M.prototype.isDynamicRowHeight = function() { + return typeof this.gridOptions.getRowHeight == "function"; + }, M.prototype.getListItemHeight = function() { + return this.getFromTheme(20, "listItemHeight"); + }, M.prototype.chartMenuPanelWidth = function() { + return this.environment.chartMenuPanelWidth(); + }, M.prototype.isNumeric = function(d) { + return !isNaN(d) && typeof d == "number" && isFinite(d); + }, M.prototype.getFromTheme = function(d, g) { + var S = this.environment.getTheme().theme; + return S && S.indexOf("ag-theme") === 0 ? this.environment.getSassVariable(S, g) : d; + }, M.prototype.getDefaultRowHeight = function() { + return this.getFromTheme(Ere, "rowHeight"); + }, M.prototype.matchesGroupDisplayType = function(d, g) { + var S = ["groupRows", "multipleColumns", "custom", "singleColumn"]; + return S.indexOf(g) < 0 ? (console.warn("AG Grid: '" + g + "' is not a valid groupDisplayType value - possible values are: '" + S.join("', '") + "'"), !1) : g === d; + }, M.prototype.matchesTreeDataDisplayType = function(d, g) { + var S = ["auto", "custom"]; + return S.indexOf(g) < 0 ? (console.warn("AG Grid: '" + g + "' is not a valid treeDataDisplayType value - possible values are: '" + S.join("', '") + "'"), !1) : g === d; + }; + var f; + return M.MIN_COL_WIDTH = 10, M.PROP_HEADER_HEIGHT = "headerHeight", M.PROP_GROUP_REMOVE_SINGLE_CHILDREN = "groupRemoveSingleChildren", M.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN = "groupRemoveLowestSingleChildren", M.PROP_PIVOT_HEADER_HEIGHT = "pivotHeaderHeight", M.PROP_SUPPRESS_CLIPBOARD_PASTE = "suppressClipboardPaste", M.PROP_GROUP_HEADER_HEIGHT = "groupHeaderHeight", M.PROP_PIVOT_GROUP_HEADER_HEIGHT = "pivotGroupHeaderHeight", M.PROP_NAVIGATE_TO_NEXT_CELL = "navigateToNextCell", M.PROP_TAB_TO_NEXT_CELL = "tabToNextCell", M.PROP_NAVIGATE_TO_NEXT_HEADER = "navigateToNextHeader", M.PROP_TAB_TO_NEXT_HEADER = "tabToNextHeader", M.PROP_IS_EXTERNAL_FILTER_PRESENT = "isExternalFilterPresent", M.PROP_DOES_EXTERNAL_FILTER_PASS = "doesExternalFilterPass", M.PROP_FLOATING_FILTERS_HEIGHT = "floatingFiltersHeight", M.PROP_SUPPRESS_ROW_CLICK_SELECTION = "suppressRowClickSelection", M.PROP_SUPPRESS_ROW_DRAG = "suppressRowDrag", M.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG = "suppressMoveWhenRowDragging", M.PROP_GET_ROW_CLASS = "getRowClass", M.PROP_GET_ROW_STYLE = "getRowStyle", M.PROP_GET_ROW_HEIGHT = "getRowHeight", M.PROP_POPUP_PARENT = "popupParent", M.PROP_DOM_LAYOUT = "domLayout", M.PROP_ROW_CLASS = "rowClass", M.PROP_FILL_HANDLE_DIRECTION = "fillHandleDirection", M.PROP_GROUP_ROW_AGG_NODES = "groupRowAggNodes", M.PROP_GET_GROUP_ROW_AGG = "getGroupRowAgg", M.PROP_GET_BUSINESS_KEY_FOR_NODE = "getBusinessKeyForNode", M.PROP_GET_CHILD_COUNT = "getChildCount", M.PROP_PROCESS_ROW_POST_CREATE = "processRowPostCreate", M.PROP_GET_ROW_NODE_ID = "getRowNodeId", M.PROP_GET_ROW_ID = "getRowId", M.PROP_IS_FULL_WIDTH_CELL = "isFullWidthCell", M.PROP_IS_FULL_WIDTH_ROW = "isFullWidthRow", M.PROP_IS_ROW_SELECTABLE = "isRowSelectable", M.PROP_IS_ROW_MASTER = "isRowMaster", M.PROP_POST_SORT = "postSort", M.PROP_POST_SORT_ROWS = "postSortRows", M.PROP_GET_DOCUMENT = "getDocument", M.PROP_POST_PROCESS_POPUP = "postProcessPopup", M.PROP_DEFAULT_GROUP_ORDER_COMPARATOR = "defaultGroupOrderComparator", M.PROP_INITIAL_GROUP_ORDER_COMPARATOR = "initialGroupOrderComparator", M.PROP_PAGINATION_NUMBER_FORMATTER = "paginationNumberFormatter", M.PROP_GET_CONTEXT_MENU_ITEMS = "getContextMenuItems", M.PROP_GET_MAIN_MENU_ITEMS = "getMainMenuItems", M.PROP_PROCESS_CELL_FOR_CLIPBOARD = "processCellForClipboard", M.PROP_PROCESS_CELL_FROM_CLIPBOARD = "processCellFromClipboard", M.PROP_SEND_TO_CLIPBOARD = "sendToClipboard", M.PROP_PROCESS_TO_SECONDARY_COLDEF = "processSecondaryColDef", M.PROP_PROCESS_SECONDARY_COL_GROUP_DEF = "processSecondaryColGroupDef", M.PROP_GET_CHART_TOOLBAR_ITEMS = "getChartToolbarItems", M.PROP_GET_SERVER_SIDE_STORE_PARAMS = "getServerSideStoreParams", M.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT = "isServerSideGroupOpenByDefault", M.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION = "isApplyServerSideTransaction", M.PROP_IS_SERVER_SIDE_GROUP = "isServerSideGroup", M.PROP_GET_SERVER_SIDE_GROUP_KEY = "getServerSideGroupKey", Jv([ + pe("gridOptions") + ], M.prototype, "gridOptions", void 0), Jv([ + pe("eventService") + ], M.prototype, "eventService", void 0), Jv([ + pe("environment") + ], M.prototype, "environment", void 0), Jv([ + pe("eGridDiv") + ], M.prototype, "eGridDiv", void 0), Jv([ + vH(0, yt("gridApi")), + vH(1, yt("columnApi")) + ], M.prototype, "agWire", null), Jv([ + gt + ], M.prototype, "destroy", null), Jv([ + ct + ], M.prototype, "init", null), M = f = Jv([ + Ne("gridOptionsWrapper") + ], M), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var wH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), tR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }; + (function(M) { + M.AUTO_HEIGHT = "ag-layout-auto-height", M.NORMAL = "ag-layout-normal", M.PRINT = "ag-layout-print"; + })(t.LayoutCssClasses || (t.LayoutCssClasses = {})); + var Y8 = ( + /** @class */ + function(M) { + wH(f, M); + function f(d) { + var g = M.call(this) || this; + return g.view = d, g; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.gridOptionsWrapper, jn.PROP_DOM_LAYOUT, this.updateLayoutClasses.bind(this)), this.updateLayoutClasses(); + }, f.prototype.updateLayoutClasses = function() { + var d = this.gridOptionsWrapper.getDomLayout(), g = { + autoHeight: d === Ue.DOM_LAYOUT_AUTO_HEIGHT, + normal: d === Ue.DOM_LAYOUT_NORMAL, + print: d === Ue.DOM_LAYOUT_PRINT + }, S = g.autoHeight ? t.LayoutCssClasses.AUTO_HEIGHT : g.print ? t.LayoutCssClasses.PRINT : t.LayoutCssClasses.NORMAL; + this.view.updateLayoutClasses(S, g); + }, tR([ + pe("gridOptionsWrapper") + ], f.prototype, "gridOptionsWrapper", void 0), tR([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var X8 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), N1 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Pre = ( + /** @class */ + function(M) { + X8(f, M); + function f(d) { + var g = M.call(this) || this; + return g.scrollLeft = -1, g.nextScrollTop = -1, g.scrollTop = -1, g.eBodyViewport = d, g.resetLastHorizontalScrollElementDebounced = It(g.resetLastHorizontalScrollElement.bind(g), 500), g; + } + return f.prototype.postConstruct = function() { + var d = this; + this.enableRtl = this.gridOptionsWrapper.isEnableRtl(), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this)), this.ctrlsService.whenReady(function(g) { + d.centerRowContainerCtrl = g.centerRowContainerCtrl, d.onDisplayedColumnsWidthChanged(), d.addScrollListener(); + }); + }, f.prototype.addScrollListener = function() { + var d = this.ctrlsService.getFakeHScrollCtrl(); + this.addManagedListener(this.centerRowContainerCtrl.getViewportElement(), "scroll", this.onCenterViewportScroll.bind(this)), this.addManagedListener(d.getViewport(), "scroll", this.onFakeHorizontalScroll.bind(this)); + var g = this.gridOptionsWrapper.isDebounceVerticalScrollbar() ? It(this.onVerticalScroll.bind(this), 100) : this.onVerticalScroll.bind(this); + this.addManagedListener(this.eBodyViewport, "scroll", g); + }, f.prototype.onDisplayedColumnsWidthChanged = function() { + this.enableRtl && this.horizontallyScrollHeaderCenterAndFloatingCenter(); + }, f.prototype.horizontallyScrollHeaderCenterAndFloatingCenter = function(d) { + var g = this.centerRowContainerCtrl == null; + if (!g) { + d === void 0 && (d = this.centerRowContainerCtrl.getCenterViewportScrollLeft()); + var S = this.enableRtl ? d : -d, O = this.ctrlsService.getTopCenterRowContainerCtrl(), z = this.ctrlsService.getBottomCenterRowContainerCtrl(), te = this.ctrlsService.getFakeHScrollCtrl(), Fe = this.ctrlsService.getHeaderRowContainerCtrl(); + Fe.setHorizontalScroll(S), z.setContainerTranslateX(S), O.setContainerTranslateX(S); + var ze = this.lastHorizontalScrollElement === this.centerRowContainerCtrl.getViewportElement() ? te.getViewport() : this.centerRowContainerCtrl.getViewportElement(); + ql(ze, Math.abs(d), this.enableRtl); + } + }, f.prototype.isControllingScroll = function(d) { + return this.lastHorizontalScrollElement ? d === this.lastHorizontalScrollElement : (this.lastHorizontalScrollElement = d, !0); + }, f.prototype.onFakeHorizontalScroll = function() { + var d = this.ctrlsService.getFakeHScrollCtrl().getViewport(); + this.isControllingScroll(d) && this.onBodyHorizontalScroll(d); + }, f.prototype.onCenterViewportScroll = function() { + var d = this.centerRowContainerCtrl.getViewportElement(); + this.isControllingScroll(d) && this.onBodyHorizontalScroll(d); + }, f.prototype.onBodyHorizontalScroll = function(d) { + var g = this.centerRowContainerCtrl.getViewportElement(), S = g.scrollLeft; + this.shouldBlockScrollUpdate("horizontal", S, !0) || (this.doHorizontalScroll(Math.round(Xs(d, this.enableRtl))), this.resetLastHorizontalScrollElementDebounced()); + }, f.prototype.onVerticalScroll = function() { + var d = this.eBodyViewport.scrollTop; + this.shouldBlockScrollUpdate("vertical", d, !0) || (this.animationFrameService.setScrollTop(d), this.nextScrollTop = d, this.gridOptionsWrapper.isSuppressAnimationFrame() ? (this.scrollTop = this.nextScrollTop, this.redrawRowsAfterScroll()) : this.animationFrameService.schedule()); + }, f.prototype.resetLastHorizontalScrollElement = function() { + this.lastHorizontalScrollElement = null; + }, f.prototype.doHorizontalScroll = function(d) { + var g = this.ctrlsService.getFakeHScrollCtrl().getViewport(), S = Xs(g, this.enableRtl); + this.scrollLeft === d && d === S || (this.scrollLeft = d, this.fireScrollEvent("horizontal"), this.horizontallyScrollHeaderCenterAndFloatingCenter(d), this.onHorizontalViewportChanged()); + }, f.prototype.fireScrollEvent = function(d) { + var g = this, S = { + type: ui.EVENT_BODY_SCROLL, + api: this.gridApi, + columnApi: this.columnApi, + direction: d, + left: this.scrollLeft, + top: this.scrollTop + }; + this.eventService.dispatchEvent(S), window.clearTimeout(this.scrollTimer), this.scrollTimer = void 0, this.scrollTimer = window.setTimeout(function() { + var O = Object.assign({}, S, { + type: ui.EVENT_BODY_SCROLL_END + }); + g.eventService.dispatchEvent(O); + }, 100); + }, f.prototype.shouldBlockScrollUpdate = function(d, g, S) { + if (S === void 0 && (S = !1), S && !jh()) + return !1; + if (d === "vertical") { + var O = Fp(this.eBodyViewport), z = this.eBodyViewport.scrollHeight; + if (g < 0 || g + O > z) + return !0; + } + if (d === "horizontal") { + var te = this.centerRowContainerCtrl.getCenterWidth(), Fe = this.centerRowContainerCtrl.getViewportElement().scrollWidth; + if (this.enableRtl && Hs()) { + if (g > 0) + return !0; + } else if (g < 0) + return !0; + if (Math.abs(g) + te > Fe) + return !0; + } + return !1; + }, f.prototype.redrawRowsAfterScroll = function() { + this.fireScrollEvent("vertical"); + }, f.prototype.onHorizontalViewportChanged = function() { + this.centerRowContainerCtrl.onHorizontalViewportChanged(); + }, f.prototype.checkScrollLeft = function() { + this.scrollLeft !== this.centerRowContainerCtrl.getCenterViewportScrollLeft() && this.onBodyHorizontalScroll(this.centerRowContainerCtrl.getViewportElement()); + }, f.prototype.executeAnimationFrameScroll = function() { + var d = this.scrollTop != this.nextScrollTop; + return d && (this.scrollTop = this.nextScrollTop, this.redrawRowsAfterScroll()), d; + }, f.prototype.setHorizontalScrollPosition = function(d) { + var g = 0, S = this.centerRowContainerCtrl.getViewportElement().scrollWidth - this.centerRowContainerCtrl.getCenterWidth(); + this.shouldBlockScrollUpdate("horizontal", d) && (this.enableRtl && Hs() ? d = d > 0 ? 0 : S : d = Math.min(Math.max(d, g), S)), ql(this.centerRowContainerCtrl.getViewportElement(), Math.abs(d), this.enableRtl), this.doHorizontalScroll(d); + }, f.prototype.setVerticalScrollPosition = function(d) { + this.eBodyViewport.scrollTop = d; + }, f.prototype.getVScrollPosition = function() { + var d = { + top: this.eBodyViewport.scrollTop, + bottom: this.eBodyViewport.scrollTop + this.eBodyViewport.offsetHeight + }; + return d; + }, f.prototype.getHScrollPosition = function() { + return this.centerRowContainerCtrl.getHScrollPosition(); + }, f.prototype.isHorizontalScrollShowing = function() { + return this.centerRowContainerCtrl.isHorizontalScrollShowing(); + }, f.prototype.scrollHorizontally = function(d) { + var g = this.centerRowContainerCtrl.getViewportElement().scrollLeft; + return this.setHorizontalScrollPosition(g + d), this.centerRowContainerCtrl.getViewportElement().scrollLeft - g; + }, f.prototype.scrollToTop = function() { + this.eBodyViewport.scrollTop = 0; + }, f.prototype.ensureNodeVisible = function(d, g) { + g === void 0 && (g = null); + for (var S = this.rowModel.getRowCount(), O = typeof d == "function", z = -1, te = 0; te < S; te++) { + var Fe = this.rowModel.getRow(te); + if (O) { + if (d(Fe)) { + z = te; + break; + } + } else if (d === Fe || d === Fe.data) { + z = te; + break; + } + } + z >= 0 && this.ensureIndexVisible(z, g); + }, f.prototype.ensureIndexVisible = function(d, g) { + if (this.gridOptionsWrapper.getDomLayout() !== Ue.DOM_LAYOUT_PRINT) { + var S = this.paginationProxy.getRowCount(); + if (typeof d != "number" || d < 0 || d >= S) { + console.warn("invalid row index for ensureIndexVisible: " + d); + return; + } + var O = this.gridOptionsWrapper.isPagination(), z = O && !this.gridOptionsWrapper.isSuppressPaginationPanel(); + z || this.paginationProxy.goToPageWithIndex(d); + var te = this.paginationProxy.getRow(d), Fe; + do { + var ze = te.rowTop, ht = te.rowHeight, Lt = this.paginationProxy.getPixelOffset(), ti = te.rowTop - Lt, wi = ti + te.rowHeight, Ti = this.getVScrollPosition(), qi = this.heightScaler.getDivStretchOffset(), dr = Ti.top + qi, kr = Ti.bottom + qi, Rr = kr - dr, Vr = this.heightScaler.getScrollPositionForPixel(ti), An = this.heightScaler.getScrollPositionForPixel(wi - Rr), Js = Math.min((Vr + An) / 2, ti), Ya = dr > ti, Xa = kr < wi, po = null; + g === "top" ? po = Vr : g === "bottom" ? po = An : g === "middle" ? po = Js : Ya ? po = Vr : Xa && (po = An), po !== null && (this.eBodyViewport.scrollTop = po, this.rowRenderer.redrawAfterScroll()), Fe = ze !== te.rowTop || ht !== te.rowHeight; + } while (Fe); + this.animationFrameService.flushAllFrames(); + } + }, f.prototype.ensureColumnVisible = function(d, g) { + g === void 0 && (g = "auto"); + var S = this.columnModel.getGridColumn(d); + if (S && !S.isPinned() && this.columnModel.isColumnDisplayed(S)) { + var O = this.getPositionedHorizontalScroll(S, g); + O !== null && this.centerRowContainerCtrl.setCenterViewportScrollLeft(O), this.centerRowContainerCtrl.onHorizontalViewportChanged(), this.animationFrameService.flushAllFrames(); + } + }, f.prototype.getPositionedHorizontalScroll = function(d, g) { + var S = this.isColumnOutsideViewport(d), O = S.columnBeforeStart, z = S.columnAfterEnd, te = this.centerRowContainerCtrl.getCenterWidth() < d.getActualWidth(), Fe = this.centerRowContainerCtrl.getCenterWidth(), ze = this.enableRtl, ht = (ze ? O : z) || te, Lt = ze ? z : O; + g !== "auto" && (ht = g === "start", Lt = g === "end"); + var ti = g === "middle"; + if (ht || Lt || ti) { + var wi = this.getColumnBounds(d), Ti = wi.colLeft, qi = wi.colMiddle, dr = wi.colRight; + return ti ? qi - Fe / 2 : ht ? ze ? dr : Ti : ze ? Ti - Fe : dr - Fe; + } + return null; + }, f.prototype.isColumnOutsideViewport = function(d) { + var g = this.getViewportBounds(), S = g.start, O = g.end, z = this.getColumnBounds(d), te = z.colLeft, Fe = z.colRight, ze = this.enableRtl, ht = ze ? S > Fe : O < Fe, Lt = ze ? O < te : S > te; + return { columnBeforeStart: ht, columnAfterEnd: Lt }; + }, f.prototype.getColumnBounds = function(d) { + var g = this.enableRtl, S = this.columnModel.getBodyContainerWidth(), O = d.getActualWidth(), z = d.getLeft(), te = g ? -1 : 1, Fe = g ? S - z : z, ze = Fe + O * te, ht = Fe + O / 2 * te; + return { colLeft: Fe, colMiddle: ht, colRight: ze }; + }, f.prototype.getViewportBounds = function() { + var d = this.centerRowContainerCtrl.getCenterWidth(), g = this.centerRowContainerCtrl.getCenterViewportScrollLeft(), S = g, O = d + g; + return { start: S, end: O, width: d }; + }, N1([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), N1([ + pe("animationFrameService") + ], f.prototype, "animationFrameService", void 0), N1([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), N1([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), N1([ + pe("paginationProxy") + ], f.prototype, "paginationProxy", void 0), N1([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), N1([ + pe("rowContainerHeightService") + ], f.prototype, "heightScaler", void 0), N1([ + pe("rowRenderer") + ], f.prototype, "rowRenderer", void 0), N1([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), N1([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var xH = ( + /** @class */ + function() { + function M(f) { + this.tickingInterval = null, this.onScrollCallback = null, this.scrollContainer = f.scrollContainer, this.scrollHorizontally = f.scrollAxis.indexOf("x") !== -1, this.scrollVertically = f.scrollAxis.indexOf("y") !== -1, this.scrollByTick = f.scrollByTick != null ? f.scrollByTick : 20, f.onScrollCallback && (this.onScrollCallback = f.onScrollCallback), this.scrollVertically && (this.getVerticalPosition = f.getVerticalPosition, this.setVerticalPosition = f.setVerticalPosition), this.scrollHorizontally && (this.getHorizontalPosition = f.getHorizontalPosition, this.setHorizontalPosition = f.setHorizontalPosition), this.shouldSkipVerticalScroll = f.shouldSkipVerticalScroll || function() { + return !1; + }, this.shouldSkipHorizontalScroll = f.shouldSkipHorizontalScroll || function() { + return !1; + }; + } + return M.prototype.check = function(f, d) { + d === void 0 && (d = !1); + var g = d || this.shouldSkipVerticalScroll(); + if (!(g && this.shouldSkipHorizontalScroll())) { + var S = this.scrollContainer.getBoundingClientRect(), O = this.scrollByTick; + this.tickLeft = f.clientX < S.left + O, this.tickRight = f.clientX > S.right - O, this.tickUp = f.clientY < S.top + O && !g, this.tickDown = f.clientY > S.bottom - O && !g, this.tickLeft || this.tickRight || this.tickUp || this.tickDown ? this.ensureTickingStarted() : this.ensureCleared(); + } + }, M.prototype.ensureTickingStarted = function() { + this.tickingInterval === null && (this.tickingInterval = window.setInterval(this.doTick.bind(this), 100), this.tickCount = 0); + }, M.prototype.doTick = function() { + this.tickCount++; + var f; + if (f = this.tickCount > 20 ? 200 : this.tickCount > 10 ? 80 : 40, this.scrollVertically) { + var d = this.getVerticalPosition(); + this.tickUp && this.setVerticalPosition(d - f), this.tickDown && this.setVerticalPosition(d + f); + } + if (this.scrollHorizontally) { + var g = this.getHorizontalPosition(); + this.tickLeft && this.setHorizontalPosition(g - f), this.tickRight && this.setHorizontalPosition(g + f); + } + this.onScrollCallback && this.onScrollCallback(); + }, M.prototype.ensureCleared = function() { + this.tickingInterval && (window.clearInterval(this.tickingInterval), this.tickingInterval = null); + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var SH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), SL = function() { + return SL = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, SL.apply(this, arguments); + }, mg = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Ore = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, CL = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(Ore(arguments[f])); + return M; + }, Rre = ( + /** @class */ + function(M) { + SH(f, M); + function f(d) { + var g = M.call(this) || this; + return g.isMultiRowDrag = !1, g.isGridSorted = !1, g.isGridFiltered = !1, g.isRowGroupActive = !1, g.eContainer = d, g; + } + return f.prototype.postConstruct = function() { + var d = this; + this.gridOptionsWrapper.isRowModelDefault() && (this.clientSideRowModel = this.rowModel); + var g = function() { + d.onSortChanged(), d.onFilterChanged(), d.onRowGroupChanged(); + }; + this.addManagedListener(this.eventService, ui.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onRowGroupChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_MODEL_UPDATED, function() { + g(); + }), g(), this.ctrlsService.whenReady(function() { + var S = d.ctrlsService.getGridBodyCtrl(); + d.autoScrollService = new xH({ + scrollContainer: S.getBodyViewportElement(), + scrollAxis: "y", + getVerticalPosition: function() { + return S.getScrollFeature().getVScrollPosition().top; + }, + setVerticalPosition: function(O) { + return S.getScrollFeature().setVerticalScrollPosition(O); + }, + onScrollCallback: function() { + d.onDragging(d.lastDraggingEvent); + } + }); + }); + }, f.prototype.onSortChanged = function() { + this.isGridSorted = this.sortController.isSortActive(); + }, f.prototype.onFilterChanged = function() { + this.isGridFiltered = this.filterManager.isAnyFilterPresent(); + }, f.prototype.onRowGroupChanged = function() { + var d = this.columnModel.getRowGroupColumns(); + this.isRowGroupActive = !n(d); + }, f.prototype.getContainer = function() { + return this.eContainer; + }, f.prototype.isInterestedIn = function(d) { + return d === t.DragSourceType.RowDrag; + }, f.prototype.getIconName = function() { + var d = this.gridOptionsWrapper.isRowDragManaged(); + return d && this.shouldPreventRowMove() ? fg.ICON_NOT_ALLOWED : fg.ICON_MOVE; + }, f.prototype.shouldPreventRowMove = function() { + return this.isGridSorted || this.isGridFiltered || this.isRowGroupActive; + }, f.prototype.getRowNodes = function(d) { + var g = this; + if (!this.isFromThisGrid(d)) + return d.dragItem.rowNodes || []; + var S = this.gridOptionsWrapper.isRowDragMultiRow(), O = CL(this.selectionService.getSelectedNodes()).sort(function(te, Fe) { + return g.getRowIndexNumber(te) - g.getRowIndexNumber(Fe); + }), z = d.dragItem.rowNode; + return S && O.indexOf(z) !== -1 ? (this.isMultiRowDrag = !0, O) : (this.isMultiRowDrag = !1, [z]); + }, f.prototype.onDragEnter = function(d) { + d.dragItem.rowNodes = this.getRowNodes(d), this.dispatchGridEvent(ui.EVENT_ROW_DRAG_ENTER, d), this.getRowNodes(d).forEach(function(g) { + g.setDragging(!0); + }), this.onEnterOrDragging(d); + }, f.prototype.onDragging = function(d) { + this.onEnterOrDragging(d); + }, f.prototype.isFromThisGrid = function(d) { + var g = d.dragSource.dragSourceDomDataKey; + return g === this.gridOptionsWrapper.getDomDataKey(); + }, f.prototype.isDropZoneWithinThisGrid = function(d) { + var g = this.ctrlsService.getGridBodyCtrl(), S = g.getGui(), O = d.dropZoneTarget; + return !S.contains(O); + }, f.prototype.onEnterOrDragging = function(d) { + this.dispatchGridEvent(ui.EVENT_ROW_DRAG_MOVE, d), this.lastDraggingEvent = d; + var g = this.mouseEventService.getNormalisedPosition(d).y, S = this.gridOptionsWrapper.isRowDragManaged(); + S && this.doManagedDrag(d, g), this.autoScrollService.check(d.event); + }, f.prototype.doManagedDrag = function(d, g) { + var S = this.isFromThisGrid(d), O = this.gridOptionsWrapper.isRowDragManaged(), z = d.dragItem.rowNodes; + O && this.shouldPreventRowMove() || (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !S ? this.isDropZoneWithinThisGrid(d) || this.clientSideRowModel.highlightRowAtPixel(z[0], g) : this.moveRows(z, g)); + }, f.prototype.getRowIndexNumber = function(d) { + return parseInt(m(d.getRowIndexString().split("-")), 10); + }, f.prototype.moveRowAndClearHighlight = function(d) { + var g = this, S = this.clientSideRowModel.getLastHighlightedRowNode(), O = S && S.highlighted === t.RowHighlightPosition.Below, z = this.mouseEventService.getNormalisedPosition(d).y, te = d.dragItem.rowNodes, Fe = O ? 1 : 0; + if (this.isFromThisGrid(d)) + te.forEach(function(Lt) { + Lt.rowTop < z && (Fe -= 1); + }), this.moveRows(te, z, Fe); + else { + var ze = this.gridOptionsWrapper.getRowIdFunc(), ht = this.clientSideRowModel.getRowIndexAtPixel(z) + 1; + this.clientSideRowModel.getHighlightPosition(z) === t.RowHighlightPosition.Above && ht--, this.clientSideRowModel.updateRowData({ + add: te.map(function(Lt) { + return Lt.data; + }).filter(function(Lt) { + return !g.clientSideRowModel.getRowNode(ze ? ze({ data: Lt, level: 0 }) : Lt.id); + }), + addIndex: ht + }); + } + this.clearRowHighlight(); + }, f.prototype.clearRowHighlight = function() { + this.clientSideRowModel.highlightRowAtPixel(null); + }, f.prototype.moveRows = function(d, g, S) { + S === void 0 && (S = 0); + var O = this.clientSideRowModel.ensureRowsAtPixel(d, g, S); + O && (this.focusService.clearFocusedCell(), this.rangeService && this.rangeService.removeAllCellRanges()); + }, f.prototype.addRowDropZone = function(d) { + var g = this; + if (!d.getContainer()) { + Ge(function() { + return console.warn("AG Grid: addRowDropZone - A container target needs to be provided"); + }, "add-drop-zone-empty-target"); + return; + } + if (this.dragAndDropService.findExternalZone(d)) { + console.warn("AG Grid: addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again."); + return; + } + var S = { + getContainer: d.getContainer + }; + d.fromGrid ? (d.fromGrid = void 0, S = d) : (d.onDragEnter && (S.onDragEnter = function(O) { + d.onDragEnter(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_ENTER, O)); + }), d.onDragLeave && (S.onDragLeave = function(O) { + d.onDragLeave(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_LEAVE, O)); + }), d.onDragging && (S.onDragging = function(O) { + d.onDragging(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_MOVE, O)); + }), d.onDragStop && (S.onDragStop = function(O) { + d.onDragStop(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_END, O)); + })), this.dragAndDropService.addDropTarget(SL({ isInterestedIn: function(O) { + return O === t.DragSourceType.RowDrag; + }, getIconName: function() { + return fg.ICON_MOVE; + }, external: !0 }, S)); + }, f.prototype.getRowDropZone = function(d) { + var g = this, S = this.getContainer.bind(this), O = this.onDragEnter.bind(this), z = this.onDragLeave.bind(this), te = this.onDragging.bind(this), Fe = this.onDragStop.bind(this); + return d ? { + getContainer: S, + onDragEnter: d.onDragEnter ? function(ze) { + O(ze), d.onDragEnter(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_ENTER, ze)); + } : O, + onDragLeave: d.onDragLeave ? function(ze) { + z(ze), d.onDragLeave(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_LEAVE, ze)); + } : z, + onDragging: d.onDragging ? function(ze) { + te(ze), d.onDragging(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_MOVE, ze)); + } : te, + onDragStop: d.onDragStop ? function(ze) { + Fe(ze), d.onDragStop(g.draggingToRowDragEvent(ui.EVENT_ROW_DRAG_END, ze)); + } : Fe, + fromGrid: !0 + /* @private */ + } : { + getContainer: S, + onDragEnter: O, + onDragLeave: z, + onDragging: te, + onDragStop: Fe, + /* @private */ + fromGrid: !0 + }; + }, f.prototype.draggingToRowDragEvent = function(d, g) { + var S = this.mouseEventService.getNormalisedPosition(g).y, O = S > this.paginationProxy.getCurrentPageHeight(), z = -1, te; + O || (z = this.rowModel.getRowIndexAtPixel(S), te = this.rowModel.getRow(z)); + var Fe; + switch (g.vDirection) { + case t.VerticalDirection.Down: + Fe = "down"; + break; + case t.VerticalDirection.Up: + Fe = "up"; + break; + default: + Fe = null; + break; + } + var ze = { + type: d, + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + event: g.event, + node: g.dragItem.rowNode, + nodes: g.dragItem.rowNodes, + overIndex: z, + overNode: te, + y: S, + vDirection: Fe + }; + return ze; + }, f.prototype.dispatchGridEvent = function(d, g) { + var S = this.draggingToRowDragEvent(d, g); + this.eventService.dispatchEvent(S); + }, f.prototype.onDragLeave = function(d) { + this.dispatchGridEvent(ui.EVENT_ROW_DRAG_LEAVE, d), this.stopDragging(d), this.gridOptionsWrapper.isRowDragManaged() && this.clearRowHighlight(), this.isFromThisGrid(d) && (this.isMultiRowDrag = !1); + }, f.prototype.onDragStop = function(d) { + this.dispatchGridEvent(ui.EVENT_ROW_DRAG_END, d), this.stopDragging(d), this.gridOptionsWrapper.isRowDragManaged() && (this.gridOptionsWrapper.isSuppressMoveWhenRowDragging() || !this.isFromThisGrid(d)) && !this.isDropZoneWithinThisGrid(d) && this.moveRowAndClearHighlight(d); + }, f.prototype.stopDragging = function(d) { + this.autoScrollService.ensureCleared(), this.getRowNodes(d).forEach(function(g) { + g.setDragging(!1); + }); + }, mg([ + pe("dragAndDropService") + ], f.prototype, "dragAndDropService", void 0), mg([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), mg([ + pe("paginationProxy") + ], f.prototype, "paginationProxy", void 0), mg([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), mg([ + pe("focusService") + ], f.prototype, "focusService", void 0), mg([ + pe("sortController") + ], f.prototype, "sortController", void 0), mg([ + pe("filterManager") + ], f.prototype, "filterManager", void 0), mg([ + pe("selectionService") + ], f.prototype, "selectionService", void 0), mg([ + pe("mouseEventService") + ], f.prototype, "mouseEventService", void 0), mg([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), mg([ + Ae("rangeService") + ], f.prototype, "rangeService", void 0), mg([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), mg([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), mg([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Mre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Mm = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }; + (function(M) { + M.ANIMATION_ON = "ag-row-animation", M.ANIMATION_OFF = "ag-row-no-animation"; + })(t.RowAnimationCssClasses || (t.RowAnimationCssClasses = {})); + var CH = "ag-selectable", Dre = "ag-force-vertical-scroll", Fre = "ag-column-moving", TH = ( + /** @class */ + function(M) { + Mre(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.getScrollFeature = function() { + return this.bodyScrollFeature; + }, f.prototype.getBodyViewportElement = function() { + return this.eBodyViewport; + }, f.prototype.setComp = function(d, g, S, O, z) { + this.comp = d, this.eGridBody = g, this.eBodyViewport = S, this.eTop = O, this.eBottom = z, this.setCellTextSelection(this.gridOptionsWrapper.isEnableCellTextSelect()), this.createManagedBean(new Y8(this.comp)), this.bodyScrollFeature = this.createManagedBean(new Pre(this.eBodyViewport)), this.addRowDragListener(), this.setupRowAnimationCssClass(), this.addEventListeners(), this.addFocusListeners([O, S, z]), this.onGridColumnsChanged(), this.addBodyViewportListener(), this.setFloatingHeights(), this.disableBrowserDragging(), this.addStopEditingWhenGridLosesFocus(), this.ctrlsService.registerGridBodyCtrl(this); + }, f.prototype.getComp = function() { + return this.comp; + }, f.prototype.addEventListeners = function() { + this.addManagedListener(this.eventService, ui.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_SCROLL_VISIBILITY_CHANGED, this.onScrollVisibilityChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_PINNED_ROW_DATA_CHANGED, this.setFloatingHeights.bind(this)); + }, f.prototype.addFocusListeners = function(d) { + var g = this; + d.forEach(function(S) { + g.addManagedListener(S, "focusin", function() { + S.classList.add("ag-has-focus"); + }), g.addManagedListener(S, "focusout", function(O) { + S.contains(O.relatedTarget) || S.classList.remove("ag-has-focus"); + }); + }); + }, f.prototype.setColumnMovingCss = function(d) { + this.comp.setColumnMovingCss(d ? Fre : null, d); + }, f.prototype.setCellTextSelection = function(d) { + d === void 0 && (d = !1); + var g = d ? CH : null; + this.comp.setCellSelectableCss(g, d); + }, f.prototype.onScrollVisibilityChanged = function() { + var d = this.scrollVisibleService.isVerticalScrollShowing(); + this.setVerticalScrollPaddingVisible(d); + }, f.prototype.onGridColumnsChanged = function() { + var d = this.columnModel.getAllGridColumns(); + this.comp.setColumnCount(d ? d.length : 0); + }, f.prototype.disableBrowserDragging = function() { + this.addManagedListener(this.eGridBody, "dragstart", function(d) { + if (d.target instanceof HTMLImageElement) + return d.preventDefault(), !1; + }); + }, f.prototype.addStopEditingWhenGridLosesFocus = function() { + var d = this; + if (this.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus()) { + var g = function(O) { + var z = O.relatedTarget; + if (Rp(z) === null) { + d.rowRenderer.stopEditing(); + return; + } + var te = ( + // see if click came from inside the viewports + S.some(function(ze) { + return ze.contains(z); + }) && d.mouseEventService.isElementInThisGrid(z) + ); + if (!te) { + var Fe = d.popupService; + te = Fe.getActivePopups().some(function(ze) { + return ze.contains(z); + }) || Fe.isElementWithinCustomPopup(z); + } + te || d.rowRenderer.stopEditing(); + }, S = [this.eBodyViewport, this.eBottom, this.eTop]; + S.forEach(function(O) { + return d.addManagedListener(O, "focusout", g); + }); + } + }, f.prototype.updateRowCount = function() { + var d = this.headerNavigationService.getHeaderRowCount(), g = this.paginationProxy.getType(), S = -1; + g === Ue.ROW_MODEL_TYPE_CLIENT_SIDE && (S = 0, this.paginationProxy.forEachNode(function(z) { + z.group || S++; + })); + var O = S === -1 ? -1 : d + S; + this.comp.setRowCount(O); + }, f.prototype.registerBodyViewportResizeListener = function(d) { + this.comp.registerBodyViewportResizeListener(d); + }, f.prototype.setVerticalScrollPaddingVisible = function(d) { + var g = d ? "scroll" : "hidden"; + this.comp.setPinnedTopBottomOverflowY(g); + }, f.prototype.isVerticalScrollShowing = function() { + var d = this.gridOptionsWrapper.isAlwaysShowVerticalScroll(), g = d ? Dre : null; + return this.comp.setAlwaysVerticalScrollClass(g, d), d || cg(this.eBodyViewport); + }, f.prototype.setupRowAnimationCssClass = function() { + var d = this, g = function() { + var S = d.gridOptionsWrapper.isAnimateRows() && !d.rowContainerHeightService.isStretching(), O = S ? t.RowAnimationCssClasses.ANIMATION_ON : t.RowAnimationCssClasses.ANIMATION_OFF; + d.comp.setRowAnimationCssOnBodyViewport(O, S); + }; + g(), this.addManagedListener(this.eventService, ui.EVENT_HEIGHT_SCALE_CHANGED, g); + }, f.prototype.getGridBodyElement = function() { + return this.eGridBody; + }, f.prototype.addBodyViewportListener = function() { + var d = this, g = function(S) { + d.gridOptionsWrapper.isPreventDefaultOnContextMenu() && S.preventDefault(); + var O = S.target; + (O === d.eBodyViewport || O === d.ctrlsService.getCenterRowContainerCtrl().getViewportElement()) && d.contextMenuFactory && d.contextMenuFactory.onContextMenu(S, null, null, null, null, d.eGridBody); + }; + this.addManagedListener(this.eBodyViewport, "contextmenu", g), this.addManagedListener(this.eBodyViewport, "wheel", this.onWheel.bind(this)); + }, f.prototype.onWheel = function(d) { + this.gridOptionsWrapper.isSuppressScrollWhenPopupsAreOpen() && this.popupService.hasAnchoredPopup() && d.preventDefault(); + }, f.prototype.getGui = function() { + return this.eGridBody; + }, f.prototype.scrollVertically = function(d) { + var g = this.eBodyViewport.scrollTop; + return this.bodyScrollFeature.setVerticalScrollPosition(g + d), this.eBodyViewport.scrollTop - g; + }, f.prototype.addRowDragListener = function() { + this.rowDragFeature = this.createManagedBean(new Rre(this.eBodyViewport)), this.dragAndDropService.addDropTarget(this.rowDragFeature); + }, f.prototype.getRowDragFeature = function() { + return this.rowDragFeature; + }, f.prototype.setFloatingHeights = function() { + var d = this.pinnedRowModel, g = d.getPinnedTopTotalHeight(); + g && (g += 1); + var S = d.getPinnedBottomTotalHeight(); + S && (S += 1), this.comp.setTopHeight(g), this.comp.setBottomHeight(S), this.comp.setTopDisplay(g ? "inherit" : "none"), this.comp.setBottomDisplay(S ? "inherit" : "none"); + }, f.prototype.sizeColumnsToFit = function(d) { + var g = this, S = this.isVerticalScrollShowing(), O = S ? this.gridOptionsWrapper.getScrollbarWidth() : 0, z = ug(this.eBodyViewport), te = z - O; + if (te > 0) { + this.columnModel.sizeColumnsToFit(te, "sizeColumnsToFit"); + return; + } + d === void 0 ? window.setTimeout(function() { + g.sizeColumnsToFit(100); + }, 0) : d === 100 ? window.setTimeout(function() { + g.sizeColumnsToFit(500); + }, 100) : d === 500 ? window.setTimeout(function() { + g.sizeColumnsToFit(-1); + }, 500) : console.warn("AG Grid: tried to call sizeColumnsToFit() but the grid is coming back with zero width, maybe the grid is not visible yet on the screen?"); + }, f.prototype.addScrollEventListener = function(d) { + this.eBodyViewport.addEventListener("scroll", d); + }, f.prototype.removeScrollEventListener = function(d) { + this.eBodyViewport.removeEventListener("scroll", d); + }, Mm([ + pe("rowContainerHeightService") + ], f.prototype, "rowContainerHeightService", void 0), Mm([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Mm([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Mm([ + pe("scrollVisibleService") + ], f.prototype, "scrollVisibleService", void 0), Mm([ + Ae("contextMenuFactory") + ], f.prototype, "contextMenuFactory", void 0), Mm([ + pe("headerNavigationService") + ], f.prototype, "headerNavigationService", void 0), Mm([ + pe("paginationProxy") + ], f.prototype, "paginationProxy", void 0), Mm([ + pe("dragAndDropService") + ], f.prototype, "dragAndDropService", void 0), Mm([ + pe("pinnedRowModel") + ], f.prototype, "pinnedRowModel", void 0), Mm([ + pe("rowRenderer") + ], f.prototype, "rowRenderer", void 0), Mm([ + pe("popupService") + ], f.prototype, "popupService", void 0), Mm([ + pe("mouseEventService") + ], f.prototype, "mouseEventService", void 0), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M[M.FILL = 0] = "FILL", M[M.RANGE = 1] = "RANGE"; + })(t.SelectionHandleType || (t.SelectionHandleType = {})), function(M) { + M[M.VALUE = 0] = "VALUE", M[M.DIMENSION = 1] = "DIMENSION"; + }(t.CellRangeType || (t.CellRangeType = {})); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var TL = "ag-cell-range-selected", p_e = "ag-cell-range-chart", K8 = "ag-cell-range-single-cell", f_e = "ag-cell-range-chart-category", Lre = "ag-cell-range-handle", m_e = "ag-cell-range-top", g_e = "ag-cell-range-right", y_e = "ag-cell-range-bottom", Nre = "ag-cell-range-left", v_e = ( + /** @class */ + function() { + function M(f, d) { + this.beans = f, this.cellCtrl = d; + } + return M.prototype.setComp = function(f, d) { + this.cellComp = f, this.eGui = d, this.onRangeSelectionChanged(); + }, M.prototype.onRangeSelectionChanged = function() { + this.cellComp && (this.rangeCount = this.beans.rangeService.getCellRangeCount(this.cellCtrl.getCellPosition()), this.hasChartRange = this.getHasChartRange(), this.cellComp.addOrRemoveCssClass(TL, this.rangeCount !== 0), this.cellComp.addOrRemoveCssClass(TL + "-1", this.rangeCount === 1), this.cellComp.addOrRemoveCssClass(TL + "-2", this.rangeCount === 2), this.cellComp.addOrRemoveCssClass(TL + "-3", this.rangeCount === 3), this.cellComp.addOrRemoveCssClass(TL + "-4", this.rangeCount >= 4), this.cellComp.addOrRemoveCssClass(p_e, this.hasChartRange), yl(this.eGui, this.rangeCount > 0 ? !0 : void 0), this.cellComp.addOrRemoveCssClass(K8, this.isSingleCell()), this.updateRangeBorders(), this.refreshHandle()); + }, M.prototype.updateRangeBorders = function() { + var f = this.getRangeBorders(), d = this.isSingleCell(), g = !d && f.top, S = !d && f.right, O = !d && f.bottom, z = !d && f.left; + this.cellComp.addOrRemoveCssClass(m_e, g), this.cellComp.addOrRemoveCssClass(g_e, S), this.cellComp.addOrRemoveCssClass(y_e, O), this.cellComp.addOrRemoveCssClass(Nre, z); + }, M.prototype.isSingleCell = function() { + var f = this.beans.rangeService; + return this.rangeCount === 1 && f && !f.isMoreThanOneCell(); + }, M.prototype.getHasChartRange = function() { + var f = this.beans.rangeService; + if (!this.rangeCount || !f) + return !1; + var d = f.getCellRanges(); + return d.length > 0 && d.every(function(g) { + return Ce([t.CellRangeType.DIMENSION, t.CellRangeType.VALUE], g.type); + }); + }, M.prototype.updateRangeBordersIfRangeCount = function() { + this.rangeCount > 0 && (this.updateRangeBorders(), this.refreshHandle()); + }, M.prototype.getRangeBorders = function() { + var f = this, d = this.beans.gridOptionsWrapper.isEnableRtl(), g = !1, S = !1, O = !1, z = !1, te = this.cellCtrl.getCellPosition().column, Fe = this.beans, ze = Fe.rangeService, ht = Fe.columnModel, Lt, ti; + d ? (Lt = ht.getDisplayedColAfter(te), ti = ht.getDisplayedColBefore(te)) : (Lt = ht.getDisplayedColBefore(te), ti = ht.getDisplayedColAfter(te)); + var wi = ze.getCellRanges().filter(function(Rr) { + return ze.isCellInSpecificRange(f.cellCtrl.getCellPosition(), Rr); + }); + Lt || (z = !0), ti || (S = !0); + for (var Ti = 0; Ti < wi.length && !(g && S && O && z); Ti++) { + var qi = wi[Ti], dr = ze.getRangeStartRow(qi), kr = ze.getRangeEndRow(qi); + !g && this.beans.rowPositionUtils.sameRow(dr, this.cellCtrl.getCellPosition()) && (g = !0), !O && this.beans.rowPositionUtils.sameRow(kr, this.cellCtrl.getCellPosition()) && (O = !0), !z && Lt && qi.columns.indexOf(Lt) < 0 && (z = !0), !S && ti && qi.columns.indexOf(ti) < 0 && (S = !0); + } + return { top: g, right: S, bottom: O, left: z }; + }, M.prototype.refreshHandle = function() { + if (this.beans.rangeService) { + var f = this.shouldHaveSelectionHandle(); + this.selectionHandle && !f && (this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle)), f && this.addSelectionHandle(), this.cellComp.addOrRemoveCssClass(Lre, !!this.selectionHandle); + } + }, M.prototype.shouldHaveSelectionHandle = function() { + var f = this.beans, d = f.gridOptionsWrapper, g = f.rangeService, S = g.getCellRanges(), O = S.length; + if (this.rangeCount < 1 || O < 1) + return !1; + var z = m(S), te = this.cellCtrl.getCellPosition(), Fe = d.isEnableFillHandle() && !this.cellCtrl.isSuppressFillHandle(), ze = d.isEnableRangeHandle(), ht = O === 1 && !this.cellCtrl.isEditing() && (Fe || ze); + if (this.hasChartRange) { + var Lt = S[0].type === t.CellRangeType.DIMENSION, ti = Lt && g.isCellInSpecificRange(te, S[0]); + this.cellComp.addOrRemoveCssClass(f_e, ti), ht = z.type === t.CellRangeType.VALUE; + } + return ht && z.endRow != null && g.isContiguousRange(z) && g.isBottomRightCell(z, te); + }, M.prototype.addSelectionHandle = function() { + var f = this.beans, d = f.gridOptionsWrapper, g = f.rangeService, S = m(g.getCellRanges()).type, O = d.isEnableFillHandle() && r(S), z = O ? t.SelectionHandleType.FILL : t.SelectionHandleType.RANGE; + this.selectionHandle && this.selectionHandle.getType() !== z && (this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle)), this.selectionHandle || (this.selectionHandle = this.beans.selectionHandleFactory.createSelectionHandle(z)), this.selectionHandle.refresh(this.cellCtrl); + }, M.prototype.destroy = function() { + this.beans.context.destroyBean(this.selectionHandle); + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var __e = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), b_e = ( + /** @class */ + function(M) { + __e(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.cellCtrl = d, S.beans = g, S.column = d.getColumn(), S.rowNode = d.getRowNode(), S.setupColSpan(), S.setupRowSpan(), S; + } + return f.prototype.setupRowSpan = function() { + this.rowSpan = this.column.getRowSpan(this.rowNode); + }, f.prototype.setComp = function(d) { + this.eGui = d, this.onLeftChanged(), this.onWidthChanged(), this.applyRowSpan(); + }, f.prototype.onDisplayColumnsChanged = function() { + var d = this.getColSpanningList(); + _(this.colsSpanning, d) || (this.colsSpanning = d, this.onWidthChanged(), this.onLeftChanged()); + }, f.prototype.setupColSpan = function() { + this.column.getColDef().colSpan != null && (this.colsSpanning = this.getColSpanningList(), this.addManagedListener(this.beans.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayColumnsChanged.bind(this)), this.addManagedListener(this.beans.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onWidthChanged.bind(this))); + }, f.prototype.onWidthChanged = function() { + if (this.eGui) { + var d = this.getCellWidth(); + this.eGui.style.width = d + "px"; + } + }, f.prototype.getCellWidth = function() { + return this.colsSpanning ? this.colsSpanning.reduce(function(d, g) { + return d + g.getActualWidth(); + }, 0) : this.column.getActualWidth(); + }, f.prototype.getColSpanningList = function() { + var d = this.column.getColSpan(this.rowNode), g = []; + if (d === 1) + g.push(this.column); + else + for (var S = this.column, O = this.column.getPinned(), z = 0; S && z < d && (g.push(S), S = this.beans.columnModel.getDisplayedColAfter(S), !(!S || r(S) || O !== S.getPinned())); z++) + ; + return g; + }, f.prototype.onLeftChanged = function() { + if (this.eGui) { + var d = this.modifyLeftForPrintLayout(this.getCellLeft()); + this.eGui.style.left = d + "px"; + } + }, f.prototype.getCellLeft = function() { + var d; + return this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning ? d = m(this.colsSpanning) : d = this.column, d.getLeft(); + }, f.prototype.modifyLeftForPrintLayout = function(d) { + if (!this.cellCtrl.isPrintLayout() || this.column.getPinned() === Ue.PINNED_LEFT) + return d; + var g = this.beans.columnModel.getDisplayedColumnsLeftWidth(); + if (this.column.getPinned() === Ue.PINNED_RIGHT) { + var S = this.beans.columnModel.getBodyContainerWidth(); + return g + S + (d || 0); + } + return g + (d || 0); + }, f.prototype.applyRowSpan = function() { + if (this.rowSpan !== 1) { + var d = this.beans.gridOptionsWrapper.getRowHeightAsNumber(), g = d * this.rowSpan; + this.eGui.style.height = g + "px", this.eGui.style.zIndex = "1"; + } + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var w_e = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), kre = ( + /** @class */ + function(M) { + w_e(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.staticClasses = [], S.cellCtrl = d, S.beans = g, S.column = d.getColumn(), S.rowNode = d.getRowNode(), S; + } + return f.prototype.setComp = function(d) { + this.cellComp = d, this.applyUserStyles(), this.applyCellClassRules(), this.applyClassesFromColDef(); + }, f.prototype.applyCellClassRules = function() { + var d = this, g = this.column.getColDef(), S = { + value: this.cellCtrl.getValue(), + data: this.rowNode.data, + node: this.rowNode, + colDef: g, + rowIndex: this.rowNode.rowIndex, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext() + }; + this.beans.stylingService.processClassRules(g.cellClassRules, S, function(O) { + return d.cellComp.addOrRemoveCssClass(O, !0); + }, function(O) { + return d.cellComp.addOrRemoveCssClass(O, !1); + }); + }, f.prototype.applyUserStyles = function() { + var d = this.column.getColDef(); + if (d.cellStyle) { + var g; + if (typeof d.cellStyle == "function") { + var S = { + column: this.column, + value: this.cellCtrl.getValue(), + colDef: d, + data: this.rowNode.data, + node: this.rowNode, + rowIndex: this.rowNode.rowIndex, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext() + }, O = d.cellStyle; + g = O(S); + } else + g = d.cellStyle; + this.cellComp.setUserStyles(g); + } + }, f.prototype.applyClassesFromColDef = function() { + var d = this, g = this.column.getColDef(), S = { + value: this.cellCtrl.getValue(), + data: this.rowNode.data, + node: this.rowNode, + colDef: g, + rowIndex: this.rowNode.rowIndex, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext() + }; + this.staticClasses.length && this.staticClasses.forEach(function(O) { + return d.cellComp.addOrRemoveCssClass(O, !1); + }), this.staticClasses = this.beans.stylingService.getStaticCellClasses(g, S), this.staticClasses.length && this.staticClasses.forEach(function(O) { + return d.cellComp.addOrRemoveCssClass(O, !0); + }); + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var EH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Kb = ( + /** @class */ + function(M) { + EH(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.ctrl = d, S.beans = g, S; + } + return f.prototype.setComp = function(d) { + this.comp = d, this.setupTooltip(); + }, f.prototype.setupTooltip = function() { + this.browserTooltips = this.beans.gridOptionsWrapper.isEnableBrowserTooltips(), this.updateTooltipText(), this.browserTooltips ? this.comp.setTitle(this.tooltip != null ? this.tooltip : void 0) : this.createTooltipFeatureIfNeeded(); + }, f.prototype.updateTooltipText = function() { + this.tooltip = this.ctrl.getTooltipValue(); + }, f.prototype.createTooltipFeatureIfNeeded = function() { + var d = this; + if (this.genericTooltipFeature == null) { + var g = { + getTooltipParams: function() { + return d.getTooltipParams(); + }, + getGui: function() { + return d.ctrl.getGui(); + } + }; + this.genericTooltipFeature = this.createManagedBean(new Wg(g), this.beans.context); + } + }, f.prototype.refreshToolTip = function() { + this.updateTooltipText(), this.browserTooltips && this.comp.setTitle(this.tooltip != null ? this.tooltip : void 0); + }, f.prototype.getTooltipParams = function() { + var d = this.ctrl, g = d.getColumn ? d.getColumn() : void 0, S = d.getColDef ? d.getColDef() : void 0, O = d.getRowNode ? d.getRowNode() : void 0; + return { + location: d.getLocation(), + colDef: S, + column: g, + rowIndex: d.getRowIndex ? d.getRowIndex() : void 0, + node: O, + data: O ? O.data : void 0, + value: this.getTooltipText(), + valueFormatted: d.getValueFormatted ? d.getValueFormatted() : void 0 + }; + }, f.prototype.getTooltipText = function() { + return this.tooltip; + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Mo = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, J8 = ( + /** @class */ + function() { + function M() { + } + return M.prototype.postConstruct = function() { + this.doingMasterDetail = this.gridOptionsWrapper.isMasterDetail(), this.gridOptionsWrapper.isRowModelDefault() && (this.clientSideRowModel = this.rowModel), this.gridOptionsWrapper.isRowModelServerSide() && (this.serverSideRowModel = this.rowModel); + }, Mo([ + pe("resizeObserverService") + ], M.prototype, "resizeObserverService", void 0), Mo([ + pe("paginationProxy") + ], M.prototype, "paginationProxy", void 0), Mo([ + pe("context") + ], M.prototype, "context", void 0), Mo([ + pe("columnApi") + ], M.prototype, "columnApi", void 0), Mo([ + pe("gridApi") + ], M.prototype, "gridApi", void 0), Mo([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), Mo([ + pe("expressionService") + ], M.prototype, "expressionService", void 0), Mo([ + pe("rowRenderer") + ], M.prototype, "rowRenderer", void 0), Mo([ + pe("templateService") + ], M.prototype, "templateService", void 0), Mo([ + pe("valueService") + ], M.prototype, "valueService", void 0), Mo([ + pe("eventService") + ], M.prototype, "eventService", void 0), Mo([ + pe("columnModel") + ], M.prototype, "columnModel", void 0), Mo([ + pe("headerNavigationService") + ], M.prototype, "headerNavigationService", void 0), Mo([ + pe("navigationService") + ], M.prototype, "navigationService", void 0), Mo([ + pe("columnAnimationService") + ], M.prototype, "columnAnimationService", void 0), Mo([ + Ae("rangeService") + ], M.prototype, "rangeService", void 0), Mo([ + pe("focusService") + ], M.prototype, "focusService", void 0), Mo([ + Ae("contextMenuFactory") + ], M.prototype, "contextMenuFactory", void 0), Mo([ + pe("popupService") + ], M.prototype, "popupService", void 0), Mo([ + pe("valueFormatterService") + ], M.prototype, "valueFormatterService", void 0), Mo([ + pe("stylingService") + ], M.prototype, "stylingService", void 0), Mo([ + pe("columnHoverService") + ], M.prototype, "columnHoverService", void 0), Mo([ + pe("userComponentFactory") + ], M.prototype, "userComponentFactory", void 0), Mo([ + pe("userComponentRegistry") + ], M.prototype, "userComponentRegistry", void 0), Mo([ + pe("animationFrameService") + ], M.prototype, "animationFrameService", void 0), Mo([ + pe("dragAndDropService") + ], M.prototype, "dragAndDropService", void 0), Mo([ + pe("sortController") + ], M.prototype, "sortController", void 0), Mo([ + pe("filterManager") + ], M.prototype, "filterManager", void 0), Mo([ + pe("rowContainerHeightService") + ], M.prototype, "rowContainerHeightService", void 0), Mo([ + pe("frameworkOverrides") + ], M.prototype, "frameworkOverrides", void 0), Mo([ + pe("cellPositionUtils") + ], M.prototype, "cellPositionUtils", void 0), Mo([ + pe("rowPositionUtils") + ], M.prototype, "rowPositionUtils", void 0), Mo([ + pe("selectionService") + ], M.prototype, "selectionService", void 0), Mo([ + Ae("selectionHandleFactory") + ], M.prototype, "selectionHandleFactory", void 0), Mo([ + pe("rowCssClassCalculator") + ], M.prototype, "rowCssClassCalculator", void 0), Mo([ + pe("rowModel") + ], M.prototype, "rowModel", void 0), Mo([ + pe("ctrlsService") + ], M.prototype, "ctrlsService", void 0), Mo([ + pe("ctrlsFactory") + ], M.prototype, "ctrlsFactory", void 0), Mo([ + pe("agStackComponentsRegistry") + ], M.prototype, "agStackComponentsRegistry", void 0), Mo([ + pe("valueCache") + ], M.prototype, "valueCache", void 0), Mo([ + pe("rowNodeEventThrottle") + ], M.prototype, "rowNodeEventThrottle", void 0), Mo([ + ct + ], M.prototype, "postConstruct", null), M = Mo([ + Ne("beans") + ], M), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var IH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), EL = ( + /** @class */ + function(M) { + IH(f, M); + function f(d, g, S) { + var O = M.call(this) || this; + return O.cellCtrl = d, O.beans = g, O.column = S, O; + } + return f.prototype.onMouseEvent = function(d, g) { + if (!Yi(g)) + switch (d) { + case "click": + this.onCellClicked(g); + break; + case "mousedown": + case "touchstart": + this.onMouseDown(g); + break; + case "dblclick": + this.onCellDoubleClicked(g); + break; + case "mouseout": + this.onMouseOut(g); + break; + case "mouseover": + this.onMouseOver(g); + break; + } + }, f.prototype.onCellClicked = function(d) { + if (this.isDoubleClickOnIPad()) { + this.onCellDoubleClicked(d), d.preventDefault(); + return; + } + var g = this.beans, S = g.eventService, O = g.gridOptionsWrapper, z = this.cellCtrl.createEvent(d, ui.EVENT_CELL_CLICKED); + S.dispatchEvent(z); + var te = this.column.getColDef(); + te.onCellClicked && window.setTimeout(function() { + return te.onCellClicked(z); + }, 0); + var Fe = (O.isSingleClickEdit() || te.singleClickEdit) && !O.isSuppressClickEdit(); + Fe && this.cellCtrl.startRowOrCellEdit(); + }, f.prototype.isDoubleClickOnIPad = function() { + if (!jh() || rr("dblclick")) + return !1; + var d = (/* @__PURE__ */ new Date()).getTime(), g = d - this.lastIPadMouseClickEvent < 200; + return this.lastIPadMouseClickEvent = d, g; + }, f.prototype.onCellDoubleClicked = function(d) { + var g = this.column.getColDef(), S = this.cellCtrl.createEvent(d, ui.EVENT_CELL_DOUBLE_CLICKED); + this.beans.eventService.dispatchEvent(S), typeof g.onCellDoubleClicked == "function" && window.setTimeout(function() { + return g.onCellDoubleClicked(S); + }, 0); + var O = !this.beans.gridOptionsWrapper.isSingleClickEdit() && !this.beans.gridOptionsWrapper.isSuppressClickEdit(); + O && this.cellCtrl.startRowOrCellEdit(null, null, d); + }, f.prototype.onMouseDown = function(d) { + var g = d.ctrlKey, S = d.metaKey, O = d.shiftKey, z = d.target, te = this.beans, Fe = te.eventService, ze = te.rangeService; + if (!this.isRightClickInExistingRange(d)) { + var ht = ze && ze.getCellRanges().length != 0; + if (!O || !ht) { + var Lt = Rc() && !this.cellCtrl.isEditing() && !Nf(z); + this.cellCtrl.focusCell(Lt); + } + if (O && ht && d.preventDefault(), !this.containsWidget(z)) { + if (ze) { + var ti = this.cellCtrl.getCellPosition(); + if (O) + ze.extendLatestRangeToCell(ti); + else { + var wi = g || S; + ze.setRangeToCell(ti, wi); + } + } + Fe.dispatchEvent(this.cellCtrl.createEvent(d, ui.EVENT_CELL_MOUSE_DOWN)); + } + } + }, f.prototype.isRightClickInExistingRange = function(d) { + var g = this.beans.rangeService; + if (g) { + var S = g.isCellInAnyRange(this.cellCtrl.getCellPosition()); + if (S && d.button === 2) + return !0; + } + return !1; + }, f.prototype.containsWidget = function(d) { + return hi(d, "ag-selection-checkbox", 3); + }, f.prototype.onMouseOut = function(d) { + if (!this.mouseStayingInsideCell(d)) { + var g = this.cellCtrl.createEvent(d, ui.EVENT_CELL_MOUSE_OUT); + this.beans.eventService.dispatchEvent(g), this.beans.columnHoverService.clearMouseOver(); + } + }, f.prototype.onMouseOver = function(d) { + if (!this.mouseStayingInsideCell(d)) { + var g = this.cellCtrl.createEvent(d, ui.EVENT_CELL_MOUSE_OVER); + this.beans.eventService.dispatchEvent(g), this.beans.columnHoverService.setMouseOver([this.column]); + } + }, f.prototype.mouseStayingInsideCell = function(d) { + if (!d.target || !d.relatedTarget) + return !1; + var g = this.cellCtrl.getGui(), S = g.contains(d.target), O = g.contains(d.relatedTarget); + return S && O; + }, f.prototype.destroy = function() { + }, f; + }(J8) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var IL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), AL = ( + /** @class */ + function(M) { + IL(f, M); + function f(d, g, S, O, z) { + var te = M.call(this) || this; + return te.cellCtrl = d, te.beans = g, te.rowNode = O, te.rowCtrl = z, te; + } + return f.prototype.setComp = function(d) { + this.eGui = d; + }, f.prototype.onKeyDown = function(d) { + var g = d.key; + switch (g) { + case Hr.ENTER: + this.onEnterKeyDown(d); + break; + case Hr.F2: + this.onF2KeyDown(d); + break; + case Hr.ESCAPE: + this.onEscapeKeyDown(d); + break; + case Hr.TAB: + this.onTabKeyDown(d); + break; + case Hr.BACKSPACE: + case Hr.DELETE: + this.onBackspaceOrDeleteKeyPressed(g, d); + break; + case Hr.DOWN: + case Hr.UP: + case Hr.RIGHT: + case Hr.LEFT: + this.onNavigationKeyPressed(d, g); + break; + } + }, f.prototype.onNavigationKeyPressed = function(d, g) { + this.cellCtrl.isEditing() || (d.shiftKey && this.cellCtrl.isRangeSelectionEnabled() ? this.onShiftRangeSelect(d) : this.beans.navigationService.navigateToNextCell(d, g, this.cellCtrl.getCellPosition(), !0), d.preventDefault()); + }, f.prototype.onShiftRangeSelect = function(d) { + if (this.beans.rangeService) { + var g = this.beans.rangeService.extendLatestRangeInDirection(d); + g && this.beans.navigationService.ensureCellVisible(g); + } + }, f.prototype.onTabKeyDown = function(d) { + this.beans.navigationService.onTabKeyDown(this.cellCtrl, d); + }, f.prototype.onBackspaceOrDeleteKeyPressed = function(d, g) { + this.cellCtrl.isEditing() || this.cellCtrl.startRowOrCellEdit(d, void 0, g); + }, f.prototype.onEnterKeyDown = function(d) { + this.cellCtrl.isEditing() || this.rowCtrl.isEditing() ? this.cellCtrl.stopEditingAndFocus() : this.beans.gridOptionsWrapper.isEnterMovesDown() ? this.beans.navigationService.navigateToNextCell(null, Hr.DOWN, this.cellCtrl.getCellPosition(), !1) : (this.cellCtrl.startRowOrCellEdit(Hr.ENTER, void 0, d), this.cellCtrl.isEditing() && d.preventDefault()); + }, f.prototype.onF2KeyDown = function(d) { + this.cellCtrl.isEditing() || this.cellCtrl.startRowOrCellEdit(Hr.F2, void 0, d); + }, f.prototype.onEscapeKeyDown = function(d) { + this.cellCtrl.isEditing() && (this.cellCtrl.stopRowOrCellEdit(!0), this.cellCtrl.focusCell(!0)); + }, f.prototype.onKeyPress = function(d) { + var g = d.target, S = g !== this.eGui; + if (!(S || this.cellCtrl.isEditing())) { + var O = String.fromCharCode(d.charCode); + O === " " ? this.onSpaceKeyPressed(d) : _s(d) && (this.cellCtrl.startRowOrCellEdit(null, O, d), d.preventDefault()); + } + }, f.prototype.onSpaceKeyPressed = function(d) { + var g = this.beans.gridOptionsWrapper; + if (!this.cellCtrl.isEditing() && g.isRowSelection()) { + var S = this.rowNode.isSelected(), O = !S; + if (O || !g.isSuppressRowDeselection()) { + var z = this.beans.gridOptionsWrapper.isGroupSelectsFiltered(), te = this.rowNode.setSelectedParams({ + newValue: O, + rangeSelect: d.shiftKey, + groupSelectsFiltered: z + }); + S === void 0 && te === 0 && this.rowNode.setSelectedParams({ + newValue: !1, + rangeSelect: d.shiftKey, + groupSelectsFiltered: z + }); + } + } + d.preventDefault(); + }, f.prototype.destroy = function() { + }, f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var AH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Z8 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, PL = ( + /** @class */ + function(M) { + AH(f, M); + function f(d, g, S, O) { + var z = M.call(this, '
') || this; + return z.rowNode = d, z.column = g, z.beans = S, z.eCell = O, z; + } + return f.prototype.postConstruct = function() { + var d = this.getGui(); + d.appendChild(Xl("rowDrag", this.beans.gridOptionsWrapper, null)), this.addGuiEventListener("mousedown", function(g) { + g.stopPropagation(); + }), this.addDragSource(), this.checkVisibility(); + }, f.prototype.addDragSource = function() { + this.addGuiEventListener("dragstart", this.onDragStart.bind(this)); + }, f.prototype.onDragStart = function(d) { + var g = this, S = this.column.getColDef().dndSourceOnRowDrag; + d.dataTransfer.setDragImage(this.eCell, 0, 0); + var O = function() { + try { + var te = JSON.stringify(g.rowNode.data); + d.dataTransfer.setData("application/json", te), d.dataTransfer.setData("text/plain", te); + } catch { + } + }; + if (S) { + var z = { + rowNode: this.rowNode, + dragEvent: d, + api: this.gridOptionsWrapper.getApi(), + columnApi: this.gridOptionsWrapper.getColumnApi(), + context: this.gridOptionsWrapper.getContext() + }; + S(z); + } else + O(); + }, f.prototype.checkVisibility = function() { + var d = this.column.isDndSource(this.rowNode); + this.setDisplayed(d); + }, Z8([ + ct + ], f.prototype, "postConstruct", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $re = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), a2 = function() { + return a2 = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, a2.apply(this, arguments); + }, OL = "ag-cell", PH = "ag-cell-auto-height", Q8 = "ag-cell-normal-height", iR = "ag-cell-focus", e9 = "ag-cell-first-right-pinned", rR = "ag-cell-last-left-pinned", t9 = "ag-cell-not-inline-editing", RL = "ag-cell-inline-editing", nR = "ag-cell-popup-editing", Zv = "ag-column-hover", i9 = "ag-cell-wrap-text", ML = 0, vo = ( + /** @class */ + function(M) { + $re(f, M); + function f(d, g, S, O) { + var z = M.call(this) || this; + return z.suppressRefreshCell = !1, z.column = d, z.rowNode = g, z.beans = S, z.rowCtrl = O, z.instanceId = d.getId() + "-" + ML++, z.createCellPosition(), z.addFeatures(), z; + } + return f.prototype.addFeatures = function() { + var d = this; + this.cellPositionFeature = new b_e(this, this.beans), this.addDestroyFunc(function() { + return d.cellPositionFeature.destroy(); + }), this.cellCustomStyleFeature = new kre(this, this.beans), this.addDestroyFunc(function() { + return d.cellCustomStyleFeature.destroy(); + }), this.cellMouseListenerFeature = new EL(this, this.beans, this.column), this.addDestroyFunc(function() { + return d.cellMouseListenerFeature.destroy(); + }), this.cellKeyboardListenerFeature = new AL(this, this.beans, this.column, this.rowNode, this.rowCtrl), this.addDestroyFunc(function() { + return d.cellKeyboardListenerFeature.destroy(); + }); + var g = this.beans.rangeService && this.beans.gridOptionsWrapper.isEnableRangeSelection(); + g && (this.cellRangeFeature = new v_e(this.beans, this), this.addDestroyFunc(function() { + return d.cellRangeFeature.destroy(); + })), this.addTooltipFeature(); + }, f.prototype.addTooltipFeature = function() { + var d = this, g = function() { + var O = d.column.getColDef(), z = d.rowNode.data; + if (O.tooltipField && i(z)) + return ke(z, O.tooltipField, d.column.isTooltipFieldContainsDots()); + var te = O.tooltipValueGetter; + return te ? te({ + location: "cell", + api: d.beans.gridOptionsWrapper.getApi(), + columnApi: d.beans.gridOptionsWrapper.getColumnApi(), + context: d.beans.gridOptionsWrapper.getContext(), + colDef: d.column.getColDef(), + column: d.column, + rowIndex: d.cellPosition.rowIndex, + node: d.rowNode, + data: d.rowNode.data, + value: d.value, + valueFormatted: d.valueFormatted + }) : null; + }, S = { + getColumn: function() { + return d.column; + }, + getColDef: function() { + return d.column.getColDef(); + }, + getRowIndex: function() { + return d.cellPosition.rowIndex; + }, + getRowNode: function() { + return d.rowNode; + }, + getGui: function() { + return d.getGui(); + }, + getLocation: function() { + return "cell"; + }, + getTooltipValue: g, + // this makes no sense, why is the cell formatted value passed to the tooltip??? + getValueFormatted: function() { + return d.valueFormatted; + } + }; + this.tooltipFeature = new Kb(S, this.beans), this.addDestroyFunc(function() { + return d.tooltipFeature.destroy(); + }); + }, f.prototype.setComp = function(d, g, S, O, z) { + this.cellComp = d, this.gow = this.beans.gridOptionsWrapper, this.eGui = g, this.eCellWrapper = S, this.printLayout = O, this.updateAndFormatValue(!0), this.addDomData(), this.onCellFocused(), this.applyStaticCssClasses(), this.setWrapText(), this.onFirstRightPinnedChanged(), this.onLastLeftPinnedChanged(), this.onColumnHover(), this.setupControlComps(), this.setupAutoHeight(), this.setAriaColIndex(), this.gow.isSuppressCellFocus() || this.cellComp.setTabIndex(-1); + var te = _t(this.column.getId()); + this.cellComp.setColId(te), this.cellComp.setRole("gridcell"), this.cellPositionFeature.setComp(g), this.cellCustomStyleFeature.setComp(d), this.tooltipFeature.setComp(d), this.cellKeyboardListenerFeature.setComp(this.eGui), this.cellRangeFeature && this.cellRangeFeature.setComp(d, g), z && this.isCellEditable() ? this.startEditing() : this.showValue(); + }, f.prototype.setupAutoHeight = function() { + var d = this; + if (this.column.isAutoHeight()) { + var g = this.eCellWrapper, S = g.parentElement, O = this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height, z = function(ze) { + if (!d.editing && d.isAlive()) { + var ht = ll(S), Lt = ht.paddingTop, ti = ht.paddingBottom, wi = g.offsetHeight, Ti = wi + Lt + ti; + if (ze < 5) { + var qi = d.beans.gridOptionsWrapper.getDocument(), dr = !qi || !qi.contains(g), kr = Ti == 0; + if (dr || kr) { + d.beans.frameworkOverrides.setTimeout(function() { + return z(ze + 1); + }, 0); + return; + } + } + var Rr = Math.max(Ti, O); + d.rowNode.setRowAutoHeight(Rr, d.column); + } + }, te = function() { + return z(0); + }; + te(); + var Fe = this.beans.resizeObserverService.observeResize(g, te); + this.addDestroyFunc(function() { + Fe(), d.rowNode.setRowAutoHeight(void 0, d.column); + }); + } + }, f.prototype.getInstanceId = function() { + return this.instanceId; + }, f.prototype.showValue = function(d) { + d === void 0 && (d = !1); + var g = this.valueFormatted != null ? this.valueFormatted : this.value, S = this.createCellRendererParams(), O = this.beans.userComponentFactory.getCellRendererDetails(this.column.getColDef(), S); + this.cellComp.setRenderDetails(O, g, d), this.refreshHandle(); + }, f.prototype.setupControlComps = function() { + var d = this.column.getColDef(); + this.includeSelection = this.isIncludeControl(d.checkboxSelection), this.includeRowDrag = this.isIncludeControl(d.rowDrag), this.includeDndSource = this.isIncludeControl(d.dndSource), this.cellComp.setIncludeSelection(this.includeSelection), this.cellComp.setIncludeDndSource(this.includeDndSource), this.cellComp.setIncludeRowDrag(this.includeRowDrag); + }, f.prototype.isForceWrapper = function() { + var d = this.beans.gridOptionsWrapper.isEnableCellTextSelection() || this.column.isAutoHeight(); + return d; + }, f.prototype.isIncludeControl = function(d) { + var g = this.rowNode.rowPinned != null, S = typeof d == "function", O = g ? !1 : S || d === !0; + return O; + }, f.prototype.refreshShouldDestroy = function() { + var d = this.column.getColDef(), g = this.includeSelection != this.isIncludeControl(d.checkboxSelection), S = this.includeRowDrag != this.isIncludeControl(d.rowDrag), O = this.includeDndSource != this.isIncludeControl(d.dndSource); + return g || S || O; + }, f.prototype.startEditing = function(d, g, S, O) { + d === void 0 && (d = null), g === void 0 && (g = null), S === void 0 && (S = !1), O === void 0 && (O = null); + var z, te; + if (!(!this.isCellEditable() || this.editing)) { + var Fe = this.createCellEditorParams(d, g, S), ze = this.column.getColDef(), ht = this.beans.userComponentFactory.getCellEditorDetails(ze, Fe), Lt = ((z = ht) === null || z === void 0 ? void 0 : z.popupFromSelector) != null ? ht.popupFromSelector : !!ze.cellEditorPopup, ti = ((te = ht) === null || te === void 0 ? void 0 : te.popupPositionFromSelector) != null ? ht.popupPositionFromSelector : ze.cellEditorPopupPosition; + this.setEditing(!0, Lt), this.cellComp.setEditDetails(ht, Lt, ti); + var wi = this.createEvent(O, ui.EVENT_CELL_EDITING_STARTED); + this.beans.eventService.dispatchEvent(wi); + } + }, f.prototype.setEditing = function(d, g) { + g === void 0 && (g = !1), this.editing !== d && (this.editing = d, this.editingInPopup = g, this.setInlineEditingClass()); + }, f.prototype.stopRowOrCellEdit = function(d) { + d === void 0 && (d = !1), this.beans.gridOptionsWrapper.isFullRowEdit() ? this.rowCtrl.stopRowEditing(d) : this.stopEditing(d); + }, f.prototype.onPopupEditorClosed = function() { + this.isEditing() && this.stopEditingAndFocus(); + }, f.prototype.takeValueFromCellEditor = function(d) { + var g = { newValueExists: !1 }; + if (d) + return g; + var S = this.cellComp.getCellEditor(); + if (!S) + return g; + var O = S.isCancelAfterEnd && S.isCancelAfterEnd(); + if (O) + return g; + var z = S.getValue(); + return { + newValue: z, + newValueExists: !0 + }; + }, f.prototype.saveNewValue = function(d, g) { + if (g === d) + return !1; + if (this.beans.gridOptionsWrapper.isReadOnlyEdit()) + return this.dispatchEventForSaveValueReadOnly(d, g), !1; + this.suppressRefreshCell = !0; + var S = this.rowNode.setDataValue(this.column, g); + return this.suppressRefreshCell = !1, S; + }, f.prototype.dispatchEventForSaveValueReadOnly = function(d, g) { + var S = this.rowNode, O = { + type: ui.EVENT_CELL_EDIT_REQUEST, + event: null, + rowIndex: S.rowIndex, + rowPinned: S.rowPinned, + column: this.column, + api: this.beans.gridApi, + columnApi: this.beans.columnApi, + colDef: this.column.getColDef(), + context: this.beans.gridOptionsWrapper.getContext(), + data: S.data, + node: S, + oldValue: d, + newValue: g, + value: g, + source: void 0 + }; + this.beans.eventService.dispatchEvent(O); + }, f.prototype.stopEditing = function(d) { + if (d === void 0 && (d = !1), !this.editing) + return !1; + var g = this.takeValueFromCellEditor(d), S = g.newValue, O = g.newValueExists, z = this.getValueFromValueService(), te = !1; + return O && (te = this.saveNewValue(z, S)), this.setEditing(!1), this.cellComp.setEditDetails(), this.updateAndFormatValue(), this.refreshCell({ forceRefresh: !0, suppressFlash: !0 }), this.dispatchEditingStoppedEvent(z, S), te; + }, f.prototype.dispatchEditingStoppedEvent = function(d, g) { + var S = a2(a2({}, this.createEvent(null, ui.EVENT_CELL_EDITING_STOPPED)), { + oldValue: d, + newValue: g + }); + this.beans.eventService.dispatchEvent(S); + }, f.prototype.setInlineEditingClass = function() { + if (this.isAlive()) { + var d = this.editing && !this.editingInPopup, g = this.editing && this.editingInPopup; + this.cellComp.addOrRemoveCssClass(RL, d), this.cellComp.addOrRemoveCssClass(t9, !d), this.cellComp.addOrRemoveCssClass(nR, g), this.rowCtrl.setInlineEditingCss(this.editing); + } + }, f.prototype.hackSayEditingInPopup = function() { + this.editingInPopup || (this.editingInPopup = !0, this.setInlineEditingClass()); + }, f.prototype.createCellEditorParams = function(d, g, S) { + var O = { + value: this.getValueFromValueService(), + key: d, + eventKey: d, + charPress: g, + column: this.column, + colDef: this.column.getColDef(), + rowIndex: this.getCellPosition().rowIndex, + node: this.rowNode, + data: this.rowNode.data, + api: this.beans.gridOptionsWrapper.getApi(), + cellStartedEdit: S, + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext(), + onKeyDown: this.onKeyDown.bind(this), + stopEditing: this.stopEditingAndFocus.bind(this), + eGridCell: this.getGui(), + parseValue: this.parseValue.bind(this), + formatValue: this.formatValue.bind(this) + }; + return O; + }, f.prototype.createCellRendererParams = function() { + var d = this, g = function(O, z) { + console.warn("AG Grid: since AG Grid v26, params.addRowCompListener() is deprecated. If you need this functionality, please contact AG Grid support and advise why so that we can revert with an appropriate workaround, as we dont have any valid use cases for it. This method was originally provided as a work around to know when cells were destroyed in AG Grid before custom Cell Renderers could be provided."), d.rowCtrl.addEventListener(O, z); + }, S = { + value: this.value, + valueFormatted: this.valueFormatted, + getValue: this.getValueFromValueService.bind(this), + setValue: function(O) { + return d.beans.valueService.setValue(d.rowNode, d.column, O); + }, + formatValue: this.formatValue.bind(this), + data: this.rowNode.data, + node: this.rowNode, + colDef: this.column.getColDef(), + column: this.column, + rowIndex: this.getCellPosition().rowIndex, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext(), + refreshCell: this.refreshCell.bind(this), + eGridCell: this.getGui(), + eParentOfValue: this.cellComp.getParentOfValue(), + registerRowDragger: function(O, z, te, Fe) { + return d.registerRowDragger(O, z, Fe); + }, + // this function is not documented anywhere, so we could drop it + // it was in the olden days to allow user to register for when rendered + // row was removed (the row comp was removed), however now that the user + // can provide components for cells, the destroy method gets call when this + // happens so no longer need to fire event. + addRowCompListener: g + }; + return S; + }, f.prototype.parseValue = function(d) { + var g = this.column.getColDef(), S = { + node: this.rowNode, + data: this.rowNode.data, + oldValue: this.getValue(), + newValue: d, + colDef: g, + column: this.column, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext() + }, O = g.valueParser; + return i(O) ? this.beans.expressionService.evaluate(O, S) : d; + }, f.prototype.setFocusOutOnEditor = function() { + if (this.editing) { + var d = this.cellComp.getCellEditor(); + d && d.focusOut && d.focusOut(); + } + }, f.prototype.setFocusInOnEditor = function() { + if (this.editing) { + var d = this.cellComp.getCellEditor(); + d && d.focusIn ? d.focusIn() : this.focusCell(!0); + } + }, f.prototype.onCellChanged = function(d) { + if (this.cellComp) { + var g = d.column === this.column; + g && this.refreshCell({}); + } + }, f.prototype.refreshCell = function(d) { + if (!(this.suppressRefreshCell || this.editing) && this.cellComp) { + var g = this.column.getColDef(), S = d != null && !!d.newData, O = d != null && !!d.suppressFlash || !!g.suppressCellFlash, z = g.field == null && g.valueGetter == null && g.showRowGroup == null, te = d && d.forceRefresh || z || S, Fe = this.updateAndFormatValue(), ze = te || Fe; + if (ze) { + this.showValue(S); + var ht = this.beans.filterManager.isSuppressFlashingCellsBecauseFiltering(), Lt = !O && !ht && (this.beans.gridOptionsWrapper.isEnableCellChangeFlash() || g.enableCellChangeFlash); + Lt && this.flashCell(), this.cellCustomStyleFeature.applyUserStyles(), this.cellCustomStyleFeature.applyClassesFromColDef(); + } + this.refreshToolTip(), this.cellCustomStyleFeature.applyCellClassRules(); + } + }, f.prototype.stopEditingAndFocus = function(d) { + d === void 0 && (d = !1), this.stopRowOrCellEdit(), this.focusCell(!0), d || this.navigateAfterEdit(); + }, f.prototype.navigateAfterEdit = function() { + var d = this.beans.gridOptionsWrapper.isFullRowEdit(); + if (!d) { + var g = this.beans.gridOptionsWrapper.isEnterMovesDownAfterEdit(); + g && this.beans.navigationService.navigateToNextCell(null, Hr.DOWN, this.getCellPosition(), !1); + } + }, f.prototype.flashCell = function(d) { + var g = d && d.flashDelay, S = d && d.fadeDelay; + this.animateCell("data-changed", g, S); + }, f.prototype.animateCell = function(d, g, S) { + var O = this, z = "ag-cell-" + d, te = "ag-cell-" + d + "-animation", Fe = this.beans.gridOptionsWrapper; + g || (g = Fe.getCellFlashDelay()), i(S) || (S = Fe.getCellFadeDelay()), this.cellComp.addOrRemoveCssClass(z, !0), this.cellComp.addOrRemoveCssClass(te, !1), window.setTimeout(function() { + O.cellComp.addOrRemoveCssClass(z, !1), O.cellComp.addOrRemoveCssClass(te, !0), O.eGui.style.transition = "background-color " + S + "ms", window.setTimeout(function() { + O.cellComp.addOrRemoveCssClass(te, !1), O.eGui.style.transition = ""; + }, S); + }, g); + }, f.prototype.onFlashCells = function(d) { + if (this.cellComp) { + var g = this.beans.cellPositionUtils.createId(this.getCellPosition()), S = d.cells[g]; + S && this.animateCell("highlight"); + } + }, f.prototype.isCellEditable = function() { + return this.column.isCellEditable(this.rowNode); + }, f.prototype.isSuppressFillHandle = function() { + return this.column.isSuppressFillHandle(); + }, f.prototype.formatValue = function(d) { + var g = this.callValueFormatter(d); + return g ?? d; + }, f.prototype.callValueFormatter = function(d) { + return this.beans.valueFormatterService.formatValue(this.column, this.rowNode, d); + }, f.prototype.updateAndFormatValue = function(d) { + d === void 0 && (d = !1); + var g = this.value, S = this.valueFormatted; + this.value = this.getValueFromValueService(), this.valueFormatted = this.callValueFormatter(this.value); + var O = d ? !0 : !this.valuesAreEqual(g, this.value) || this.valueFormatted != S; + return O; + }, f.prototype.valuesAreEqual = function(d, g) { + var S = this.column.getColDef(); + return S.equals ? S.equals(d, g) : d === g; + }, f.prototype.getComp = function() { + return this.cellComp; + }, f.prototype.getValueFromValueService = function() { + var d = this.rowNode.leafGroup && this.beans.columnModel.isPivotMode(), g = this.rowNode.group && this.rowNode.expanded && !this.rowNode.footer && !d, S = this.beans.gridOptionsWrapper.isGroupIncludeFooter(), O = this.beans.gridOptionsWrapper.isGroupSuppressBlankHeader(), z = g && S && !O, te = this.beans.valueService.getValue(this.column, this.rowNode, !1, z); + return te; + }, f.prototype.getValue = function() { + return this.value; + }, f.prototype.getValueFormatted = function() { + return this.valueFormatted; + }, f.prototype.addDomData = function() { + var d = this, g = this.getGui(); + this.beans.gridOptionsWrapper.setDomData(g, f.DOM_DATA_KEY_CELL_CTRL, this), this.addDestroyFunc(function() { + return d.beans.gridOptionsWrapper.setDomData(g, f.DOM_DATA_KEY_CELL_CTRL, null); + }); + }, f.prototype.createEvent = function(d, g) { + var S = { + type: g, + node: this.rowNode, + data: this.rowNode.data, + value: this.value, + column: this.column, + colDef: this.column.getColDef(), + context: this.beans.gridOptionsWrapper.getContext(), + api: this.beans.gridApi, + columnApi: this.beans.columnApi, + rowPinned: this.rowNode.rowPinned, + event: d, + rowIndex: this.rowNode.rowIndex + }; + return S; + }, f.prototype.onKeyPress = function(d) { + this.cellKeyboardListenerFeature.onKeyPress(d); + }, f.prototype.onKeyDown = function(d) { + this.cellKeyboardListenerFeature.onKeyDown(d); + }, f.prototype.onMouseEvent = function(d, g) { + this.cellMouseListenerFeature.onMouseEvent(d, g); + }, f.prototype.getGui = function() { + return this.eGui; + }, f.prototype.refreshToolTip = function() { + this.tooltipFeature.refreshToolTip(); + }, f.prototype.getColSpanningList = function() { + return this.cellPositionFeature.getColSpanningList(); + }, f.prototype.onLeftChanged = function() { + this.cellComp && this.cellPositionFeature.onLeftChanged(); + }, f.prototype.onDisplayedColumnsChanged = function() { + this.eGui && this.setAriaColIndex(); + }, f.prototype.setAriaColIndex = function() { + var d = this.beans.columnModel.getAriaColumnIndex(this.column); + fd(this.getGui(), d); + }, f.prototype.isSuppressNavigable = function() { + return this.column.isSuppressNavigable(this.rowNode); + }, f.prototype.onWidthChanged = function() { + return this.cellPositionFeature.onWidthChanged(); + }, f.prototype.getColumn = function() { + return this.column; + }, f.prototype.getRowNode = function() { + return this.rowNode; + }, f.prototype.getBeans = function() { + return this.beans; + }, f.prototype.isPrintLayout = function() { + return this.printLayout; + }, f.prototype.appendChild = function(d) { + this.eGui.appendChild(d); + }, f.prototype.refreshHandle = function() { + this.editing || this.cellRangeFeature && this.cellRangeFeature.refreshHandle(); + }, f.prototype.getCellPosition = function() { + return this.cellPosition; + }, f.prototype.isEditing = function() { + return this.editing; + }, f.prototype.startRowOrCellEdit = function(d, g, S) { + S === void 0 && (S = null), this.beans.gridOptionsWrapper.isFullRowEdit() ? this.rowCtrl.startRowEditing(d, g, this) : this.startEditing(d, g, !0, S); + }, f.prototype.getRowCtrl = function() { + return this.rowCtrl; + }, f.prototype.getRowPosition = function() { + return { + rowIndex: this.cellPosition.rowIndex, + rowPinned: this.cellPosition.rowPinned + }; + }, f.prototype.updateRangeBordersIfRangeCount = function() { + this.cellComp && this.cellRangeFeature && this.cellRangeFeature.updateRangeBordersIfRangeCount(); + }, f.prototype.onRangeSelectionChanged = function() { + this.cellComp && this.cellRangeFeature && this.cellRangeFeature.onRangeSelectionChanged(); + }, f.prototype.isRangeSelectionEnabled = function() { + return this.cellRangeFeature != null; + }, f.prototype.focusCell = function(d) { + d === void 0 && (d = !1), this.beans.focusService.setFocusedCell(this.getCellPosition().rowIndex, this.column, this.rowNode.rowPinned, d); + }, f.prototype.onRowIndexChanged = function() { + this.createCellPosition(), this.onCellFocused(), this.cellRangeFeature && this.cellRangeFeature.onRangeSelectionChanged(); + }, f.prototype.onFirstRightPinnedChanged = function() { + if (this.cellComp) { + var d = this.column.isFirstRightPinned(); + this.cellComp.addOrRemoveCssClass(e9, d); + } + }, f.prototype.onLastLeftPinnedChanged = function() { + if (this.cellComp) { + var d = this.column.isLastLeftPinned(); + this.cellComp.addOrRemoveCssClass(rR, d); + } + }, f.prototype.onCellFocused = function(d) { + if (!(!this.cellComp || this.gow.isSuppressCellFocus())) { + var g = this.beans.focusService.isCellFocused(this.cellPosition); + if (this.cellComp.addOrRemoveCssClass(iR, g), g && d && d.forceBrowserFocus) { + var S = this.cellComp.getFocusableElement(); + S.focus(); + } + var O = this.beans.gridOptionsWrapper.isFullRowEdit(); + !g && !O && this.editing && this.stopRowOrCellEdit(); + } + }, f.prototype.createCellPosition = function() { + this.cellPosition = { + rowIndex: this.rowNode.rowIndex, + rowPinned: e(this.rowNode.rowPinned), + column: this.column + }; + }, f.prototype.applyStaticCssClasses = function() { + this.cellComp.addOrRemoveCssClass(OL, !0), this.cellComp.addOrRemoveCssClass(t9, !0); + var d = this.column.isAutoHeight() == !0; + this.cellComp.addOrRemoveCssClass(PH, d), this.cellComp.addOrRemoveCssClass(Q8, !d); + }, f.prototype.onColumnHover = function() { + if (this.cellComp && this.beans.gridOptionsWrapper.isColumnHoverHighlight()) { + var d = this.beans.columnHoverService.isHovered(this.column); + this.cellComp.addOrRemoveCssClass(Zv, d); + } + }, f.prototype.onNewColumnsLoaded = function() { + this.cellComp && (this.setWrapText(), this.editing || this.refreshCell({ forceRefresh: !0, suppressFlash: !0 })); + }, f.prototype.setWrapText = function() { + var d = this.column.getColDef().wrapText == !0; + this.cellComp.addOrRemoveCssClass(i9, d); + }, f.prototype.dispatchCellContextMenuEvent = function(d) { + var g = this.column.getColDef(), S = this.createEvent(d, ui.EVENT_CELL_CONTEXT_MENU); + this.beans.eventService.dispatchEvent(S), g.onCellContextMenu && window.setTimeout(function() { + return g.onCellContextMenu(S); + }, 0); + }, f.prototype.getCellRenderer = function() { + return this.cellComp ? this.cellComp.getCellRenderer() : null; + }, f.prototype.getCellEditor = function() { + return this.cellComp ? this.cellComp.getCellEditor() : null; + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this); + }, f.prototype.createSelectionCheckbox = function() { + var d = new Ku(); + return this.beans.context.createBean(d), d.init({ rowNode: this.rowNode, column: this.column }), d; + }, f.prototype.createDndSource = function() { + var d = new PL(this.rowNode, this.column, this.beans, this.eGui); + return this.beans.context.createBean(d), d; + }, f.prototype.registerRowDragger = function(d, g, S) { + var O = this; + if (this.customRowDragComp) { + this.customRowDragComp.setDragElement(d, g); + return; + } + var z = this.createRowDragComp(d, g, S); + z && (this.customRowDragComp = z, this.addDestroyFunc(function() { + return O.beans.context.destroyBean(z); + })); + }, f.prototype.createRowDragComp = function(d, g, S) { + var O = this, z = this.beans.gridOptionsWrapper.isPagination(), te = this.beans.gridOptionsWrapper.isRowDragManaged(), Fe = this.beans.gridOptionsWrapper.isRowModelDefault(); + if (te) { + if (!Fe) { + Ge(function() { + return console.warn("AG Grid: managed row dragging is only allowed in the Client Side Row Model"); + }, "CellComp.addRowDragging"); + return; + } + if (z) { + Ge(function() { + return console.warn("AG Grid: managed row dragging is not possible when doing pagination"); + }, "CellComp.addRowDragging"); + return; + } + } + var ze = new MC(function() { + return O.value; + }, this.rowNode, this.column, d, g, S); + return this.beans.context.createBean(ze), ze; + }, f.DOM_DATA_KEY_CELL_CTRL = "cellCtrl", f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var OH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), RH = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, Ju = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(RH(arguments[f])); + return M; + }, yd; + (function(M) { + M.Normal = "Normal", M.FullWidth = "FullWidth", M.FullWidthLoading = "FullWidthLoading", M.FullWidthGroup = "FullWidthGroup", M.FullWidthDetail = "FullWidthDetail"; + })(yd || (yd = {})); + var MH = 0, Jb = ( + /** @class */ + function(M) { + OH(f, M); + function f(d, g, S, O, z) { + var te = M.call(this) || this; + return te.allRowGuis = [], te.active = !0, te.centerCellCtrls = { list: [], map: {} }, te.leftCellCtrls = { list: [], map: {} }, te.rightCellCtrls = { list: [], map: {} }, te.lastMouseDownOnDragger = !1, te.updateColumnListsPending = !1, te.beans = g, te.rowNode = d, te.paginationPage = te.beans.paginationProxy.getCurrentPage(), te.useAnimationFrameForCreate = O, te.printLayout = z, te.instanceId = d.id + "-" + MH++, te.setAnimateFlags(S), te.rowFocused = te.beans.focusService.isRowFocused(te.rowNode.rowIndex, te.rowNode.rowPinned), te.rowLevel = te.beans.rowCssClassCalculator.calculateRowLevel(te.rowNode), te.setRowType(), te.addListeners(), te.setInitialRowTop(), te; + } + return f.prototype.getBeans = function() { + return this.beans; + }, f.prototype.getInstanceId = function() { + return this.instanceId; + }, f.prototype.setComp = function(d, g, S) { + var O = { rowComp: d, element: g, containerType: S }; + this.allRowGuis.push(O), S === t.RowContainerType.LEFT ? this.leftGui = O : S === t.RowContainerType.RIGHT ? this.rightGui = O : S === t.RowContainerType.FULL_WIDTH ? this.fullWidthGui = O : this.centerGui = O; + var z = this.leftGui != null && this.rightGui != null && this.centerGui != null, te = this.fullWidthGui != null; + (z || te) && this.initialiseRowComps(); + }, f.prototype.isCacheable = function() { + return this.rowType === yd.FullWidthDetail && this.beans.gridOptionsWrapper.isKeepDetailRows(); + }, f.prototype.setCached = function(d) { + var g = d ? "none" : ""; + this.allRowGuis.forEach(function(S) { + return S.element.style.display = g; + }); + }, f.prototype.initialiseRowComps = function() { + var d = this, g = this.beans.gridOptionsWrapper; + this.onRowHeightChanged(), this.updateRowIndexes(), this.setFocusedClasses(), this.setStylesFromGridOptions(), g.isRowSelection() && this.rowNode.selectable && this.onRowSelected(), this.updateColumnLists(!this.useAnimationFrameForCreate), this.slideRowIn && kt(this.onTopChanged.bind(this)), this.fadeRowIn && kt(function() { + d.allRowGuis.forEach(function(te) { + return te.rowComp.addOrRemoveCssClass("ag-opacity-zero", !1); + }); + }); + var S = this.getRowBusinessKey(), O = _t(this.rowNode.id), z = _t(S); + this.allRowGuis.forEach(function(te) { + var Fe = te.rowComp; + Fe.setRole("row"); + var ze = d.getInitialRowClasses(te.containerType); + ze.forEach(function(ht) { + return Fe.addOrRemoveCssClass(ht, !0); + }), d.rowNode.group && yo(te.element, d.rowNode.expanded == !0), O != null && Fe.setRowId(O), z != null && Fe.setRowBusinessKey(z), d.isFullWidth() && !d.beans.gridOptionsWrapper.isSuppressCellFocus() && Fe.setTabIndex(-1), g.setDomData(te.element, f.DOM_DATA_KEY_ROW_CTRL, d), d.addDestroyFunc(function() { + return g.setDomData(te.element, f.DOM_DATA_KEY_ROW_CTRL, null); + }), d.useAnimationFrameForCreate ? d.beans.animationFrameService.createTask(d.addHoverFunctionality.bind(d, te.element), d.rowNode.rowIndex, "createTasksP2") : d.addHoverFunctionality(te.element), d.isFullWidth() && d.setupFullWidth(te), g.isRowDragEntireRow() && d.addRowDraggerToRow(te), d.useAnimationFrameForCreate && d.beans.animationFrameService.addDestroyTask(function() { + d.isAlive() && te.rowComp.addOrRemoveCssClass("ag-after-created", !0); + }); + }), this.executeProcessRowPostCreateFunc(); + }, f.prototype.addRowDraggerToRow = function(d) { + var g = this.beans.gridOptionsWrapper; + if (g.isEnableRangeSelection()) { + Ge(function() { + console.warn("AG Grid: Setting `rowDragEntireRow: true` in the gridOptions doesn't work with `enableRangeSelection: true`"); + }, "rowDragAndRangeSelectionEnabled"); + return; + } + var S = new MC(function() { + return "1 row"; + }, this.rowNode, void 0, d.element, void 0, !0); + this.createManagedBean(S, this.beans.context); + }, f.prototype.setupFullWidth = function(d) { + var g = this.getPinnedForContainer(d.containerType), S = this.createFullWidthParams(d.element, g), O = si.isRegistered(t.ModuleNames.MasterDetailModule); + if (this.rowType == yd.FullWidthDetail && !O) { + si.isPackageBased() ? console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with ag-grid-enterprise package.") : console.warn("AG Grid: cell renderer 'agDetailCellRenderer' (for master detail) not found. Can only be used with AG Grid Enterprise Module " + t.ModuleNames.MasterDetailModule); + return; + } + var z; + switch (this.rowType) { + case yd.FullWidthDetail: + z = this.beans.userComponentFactory.getFullWidthDetailCellRendererDetails(S); + break; + case yd.FullWidthGroup: + z = this.beans.userComponentFactory.getFullWidthGroupCellRendererDetails(S); + break; + case yd.FullWidthLoading: + z = this.beans.userComponentFactory.getFullWidthLoadingCellRendererDetails(S); + break; + default: + z = this.beans.userComponentFactory.getFullWidthCellRendererDetails(S); + break; + } + d.rowComp.showFullWidth(z); + }, f.prototype.isPrintLayout = function() { + return this.printLayout; + }, f.prototype.getCellElement = function(d) { + var g = this.getCellCtrl(d); + return g ? g.getGui() : null; + }, f.prototype.executeProcessRowPostCreateFunc = function() { + var d = this.beans.gridOptionsWrapper.getProcessRowPostCreateFunc(); + if (d) { + var g = { + eRow: this.centerGui ? this.centerGui.element : void 0, + ePinnedLeftRow: this.leftGui ? this.leftGui.element : void 0, + ePinnedRightRow: this.rightGui ? this.rightGui.element : void 0, + node: this.rowNode, + rowIndex: this.rowNode.rowIndex, + addRenderedRowListener: this.addEventListener.bind(this) + }; + d(g); + } + }, f.prototype.setRowType = function() { + var d = this.rowNode.stub, g = this.rowNode.isFullWidthCell(), S = this.beans.doingMasterDetail && this.rowNode.detail, O = this.beans.columnModel.isPivotMode(), z = !!this.rowNode.group && !this.rowNode.footer, te = z && this.beans.gridOptionsWrapper.isGroupUseEntireRow(O); + d ? this.rowType = yd.FullWidthLoading : S ? this.rowType = yd.FullWidthDetail : g ? this.rowType = yd.FullWidth : te ? this.rowType = yd.FullWidthGroup : this.rowType = yd.Normal; + }, f.prototype.updateColumnLists = function(d) { + var g = this; + if (d === void 0 && (d = !1), !this.isFullWidth()) { + var S = d || this.beans.gridOptionsWrapper.isSuppressAnimationFrame() || this.printLayout; + if (S) { + this.updateColumnListsImpl(); + return; + } + this.updateColumnListsPending || (this.beans.animationFrameService.createTask(function() { + g.active && g.updateColumnListsImpl(); + }, this.rowNode.rowIndex, "createTasksP1"), this.updateColumnListsPending = !0); + } + }, f.prototype.createCellCtrls = function(d, g, S) { + var O = this; + S === void 0 && (S = null); + var z = { + list: [], + map: {} + }, te = function(Fe, ze) { + z.list.push(ze), z.map[Fe] = ze; + }; + return g.forEach(function(Fe) { + var ze = Fe.getInstanceId(), ht = d.map[ze]; + ht || (ht = new vo(Fe, O.rowNode, O.beans, O)), te(ze, ht); + }), d.list.forEach(function(Fe) { + var ze = z.map[Fe.getColumn().getInstanceId()] != null; + if (!ze) { + var ht = !O.isCellEligibleToBeRemoved(Fe, S); + if (ht) { + te(Fe.getColumn().getInstanceId(), Fe); + return; + } + Fe.destroy(); + } + }), z; + }, f.prototype.updateColumnListsImpl = function() { + var d = this; + this.updateColumnListsPending = !1; + var g = this.beans.columnModel; + if (this.printLayout) + this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, g.getAllDisplayedColumns()), this.leftCellCtrls = { list: [], map: {} }, this.rightCellCtrls = { list: [], map: {} }; + else { + var S = g.getViewportCenterColumnsForRow(this.rowNode); + this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, S); + var O = g.getDisplayedLeftColumnsForRow(this.rowNode); + this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, O, Ue.PINNED_LEFT); + var z = g.getDisplayedRightColumnsForRow(this.rowNode); + this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, z, Ue.PINNED_RIGHT); + } + this.allRowGuis.forEach(function(te) { + var Fe = te.containerType === t.RowContainerType.LEFT ? d.leftCellCtrls : te.containerType === t.RowContainerType.RIGHT ? d.rightCellCtrls : d.centerCellCtrls; + te.rowComp.setCellCtrls(Fe.list); + }); + }, f.prototype.isCellEligibleToBeRemoved = function(d, g) { + var S = !0, O = !1, z = d.getColumn(); + if (z.getPinned() != g) + return S; + var te = d.isEditing(), Fe = this.beans.focusService.isCellFocused(d.getCellPosition()), ze = te || Fe; + if (ze) { + var ht = d.getColumn(), Lt = this.beans.columnModel.getAllDisplayedColumns(), ti = Lt.indexOf(ht) >= 0; + return ti ? O : S; + } + return S; + }, f.prototype.setAnimateFlags = function(d) { + if (d) { + var g = i(this.rowNode.oldRowTop); + this.slideRowIn = g, this.fadeRowIn = !g; + } else + this.slideRowIn = !1, this.fadeRowIn = !1; + }, f.prototype.isEditing = function() { + return this.editingRow; + }, f.prototype.stopRowEditing = function(d) { + this.stopEditing(d); + }, f.prototype.isFullWidth = function() { + return this.rowType !== yd.Normal; + }, f.prototype.getRowType = function() { + return this.rowType; + }, f.prototype.refreshFullWidth = function() { + var d = this, g = function(ze, ht) { + if (!ze) + return !0; + var Lt = ze.rowComp.getFullWidthCellRenderer(); + if (!Lt || !Lt.refresh) + return !1; + var ti = d.createFullWidthParams(ze.element, ht), wi = Lt.refresh(ti); + return wi; + }, S = g(this.fullWidthGui, null), O = g(this.centerGui, null), z = g(this.leftGui, Ue.PINNED_LEFT), te = g(this.rightGui, Ue.PINNED_RIGHT), Fe = S && O && z && te; + return Fe; + }, f.prototype.addListeners = function() { + this.addManagedListener(this.rowNode, oi.EVENT_HEIGHT_CHANGED, this.onRowHeightChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_ROW_SELECTED, this.onRowSelected.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_ROW_INDEX_CHANGED, this.onRowIndexChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_TOP_CHANGED, this.onTopChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_EXPANDED_CHANGED, this.updateExpandedCss.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_HAS_CHILDREN_CHANGED, this.updateExpandedCss.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_DATA_CHANGED, this.onRowNodeDataChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, this.onRowNodeCellChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_HIGHLIGHT_CHANGED, this.onRowNodeHighlightChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_DRAGGING_CHANGED, this.onRowNodeDraggingChanged.bind(this)), this.addManagedListener(this.rowNode, oi.EVENT_UI_LEVEL_CHANGED, this.onUiLevelChanged.bind(this)); + var d = this.beans.eventService; + this.addManagedListener(d, ui.EVENT_PAGINATION_PIXEL_OFFSET_CHANGED, this.onPaginationPixelOffsetChanged.bind(this)), this.addManagedListener(d, ui.EVENT_HEIGHT_SCALE_CHANGED, this.onTopChanged.bind(this)), this.addManagedListener(d, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this)), this.addManagedListener(d, ui.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this)), this.addManagedListener(d, ui.EVENT_CELL_FOCUSED, this.onCellFocusChanged.bind(this)), this.addManagedListener(d, ui.EVENT_PAGINATION_CHANGED, this.onPaginationChanged.bind(this)), this.addManagedListener(d, ui.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this)), this.addManagedListener(d, ui.EVENT_COLUMN_MOVED, this.onColumnMoved.bind(this)), this.addListenersForCellComps(); + }, f.prototype.onColumnMoved = function() { + this.updateColumnLists(); + }, f.prototype.addListenersForCellComps = function() { + var d = this; + this.addManagedListener(this.rowNode, oi.EVENT_ROW_INDEX_CHANGED, function() { + d.getAllCellCtrls().forEach(function(g) { + return g.onRowIndexChanged(); + }); + }), this.addManagedListener(this.rowNode, oi.EVENT_CELL_CHANGED, function(g) { + d.getAllCellCtrls().forEach(function(S) { + return S.onCellChanged(g); + }); + }); + }, f.prototype.onRowNodeDataChanged = function(d) { + this.getAllCellCtrls().forEach(function(g) { + return g.refreshCell({ + suppressFlash: !d.update, + newData: !d.update + }); + }), this.onRowSelected(), this.postProcessCss(); + }, f.prototype.onRowNodeCellChanged = function() { + this.postProcessCss(); + }, f.prototype.postProcessCss = function() { + this.setStylesFromGridOptions(), this.postProcessClassesFromGridOptions(), this.postProcessRowClassRules(), this.postProcessRowDragging(); + }, f.prototype.onRowNodeHighlightChanged = function() { + var d = this.rowNode.highlighted; + this.allRowGuis.forEach(function(g) { + var S = d === t.RowHighlightPosition.Above, O = d === t.RowHighlightPosition.Below; + g.rowComp.addOrRemoveCssClass("ag-row-highlight-above", S), g.rowComp.addOrRemoveCssClass("ag-row-highlight-below", O); + }); + }, f.prototype.onRowNodeDraggingChanged = function() { + this.postProcessRowDragging(); + }, f.prototype.postProcessRowDragging = function() { + var d = this.rowNode.dragging; + this.allRowGuis.forEach(function(g) { + return g.rowComp.addOrRemoveCssClass("ag-row-dragging", d); + }); + }, f.prototype.updateExpandedCss = function() { + var d = this.rowNode.isExpandable(), g = this.rowNode.expanded == !0; + this.allRowGuis.forEach(function(S) { + S.rowComp.addOrRemoveCssClass("ag-row-group", d), S.rowComp.addOrRemoveCssClass("ag-row-group-expanded", d && g), S.rowComp.addOrRemoveCssClass("ag-row-group-contracted", d && !g), yo(S.element, d && g); + }); + }, f.prototype.onDisplayedColumnsChanged = function() { + this.updateColumnLists(!0), this.beans.columnModel.wasAutoRowHeightEverActive() && this.rowNode.checkAutoHeights(); + }, f.prototype.onVirtualColumnsChanged = function() { + this.updateColumnLists(); + }, f.prototype.getRowPosition = function() { + return { + rowPinned: e(this.rowNode.rowPinned), + rowIndex: this.rowNode.rowIndex + }; + }, f.prototype.onKeyboardNavigate = function(d) { + var g = this.allRowGuis.find(function(ze) { + return ze.element.contains(d.target); + }), S = g ? g.element : null, O = S === d.target; + if (O) { + var z = this.rowNode, te = this.beans.focusService.getFocusedCell(), Fe = { + rowIndex: z.rowIndex, + rowPinned: z.rowPinned, + column: te && te.column + }; + this.beans.navigationService.navigateToNextCell(d, d.key, Fe, !0), d.preventDefault(); + } + }, f.prototype.onTabKeyDown = function(d) { + if (!(d.defaultPrevented || Yi(d))) { + var g = this.allRowGuis.find(function(te) { + return te.element.contains(d.target); + }), S = g ? g.element : null, O = S === d.target, z = null; + O || (z = this.beans.focusService.findNextFocusableElement(S, !1, d.shiftKey)), (this.isFullWidth() && O || !z) && this.beans.navigationService.onTabKeyDown(this, d); + } + }, f.prototype.onFullWidthRowFocused = function(d) { + var g, S = this.rowNode, O = this.isFullWidth() && d.rowIndex === S.rowIndex && d.rowPinned == S.rowPinned, z = this.fullWidthGui ? this.fullWidthGui.element : (g = this.centerGui) === null || g === void 0 ? void 0 : g.element; + z && (z.classList.toggle("ag-full-width-focus", O), O && z.focus({ preventScroll: !0 })); + }, f.prototype.refreshCell = function(d) { + this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, d), this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, d), this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, d), this.updateColumnLists(); + }, f.prototype.removeCellCtrl = function(d, g) { + var S = { + list: [], + map: {} + }; + return d.list.forEach(function(O) { + O !== g && (S.list.push(O), S.map[O.getInstanceId()] = O); + }), S; + }, f.prototype.onMouseEvent = function(d, g) { + switch (d) { + case "dblclick": + this.onRowDblClick(g); + break; + case "click": + this.onRowClick(g); + break; + case "touchstart": + case "mousedown": + this.onRowMouseDown(g); + break; + } + }, f.prototype.createRowEvent = function(d, g) { + return { + type: d, + node: this.rowNode, + data: this.rowNode.data, + rowIndex: this.rowNode.rowIndex, + rowPinned: this.rowNode.rowPinned, + context: this.beans.gridOptionsWrapper.getContext(), + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + event: g + }; + }, f.prototype.createRowEventWithSource = function(d, g) { + var S = this.createRowEvent(d, g); + return S.source = this, S; + }, f.prototype.onRowDblClick = function(d) { + if (!Yi(d)) { + var g = this.createRowEventWithSource(ui.EVENT_ROW_DOUBLE_CLICKED, d); + this.beans.eventService.dispatchEvent(g); + } + }, f.prototype.onRowMouseDown = function(d) { + if (this.lastMouseDownOnDragger = hi(d.target, "ag-row-drag", 3), !!this.isFullWidth()) { + var g = this.rowNode, S = this.beans.columnModel; + this.beans.focusService.setFocusedCell(g.rowIndex, S.getAllDisplayedColumns()[0], g.rowPinned, !0); + } + }, f.prototype.onRowClick = function(d) { + var g = Yi(d) || this.lastMouseDownOnDragger; + if (!g) { + var S = this.createRowEventWithSource(ui.EVENT_ROW_CLICKED, d); + this.beans.eventService.dispatchEvent(S); + var O = d.ctrlKey || d.metaKey, z = d.shiftKey, te = this.beans.gridOptionsWrapper.isGroupSelectsChildren(); + if ( + // we do not allow selecting groups by clicking (as the click here expands the group), or if it's a detail row, + // so return if it's a group row + !(te && this.rowNode.group || // this is needed so we don't unselect other rows when we click this row, eg if this row is not selectable, + // and we click it, the selection should not change (ie any currently selected row should stay selected) + !this.rowNode.selectable || // we also don't allow selection of pinned rows + this.rowNode.rowPinned || // if no selection method enabled, do nothing + !this.beans.gridOptionsWrapper.isRowSelection() || // if click selection suppressed, do nothing + this.beans.gridOptionsWrapper.isSuppressRowClickSelection()) + ) { + var Fe = this.beans.gridOptionsWrapper.isRowMultiSelectWithClick(), ze = !this.beans.gridOptionsWrapper.isSuppressRowDeselection(); + if (this.rowNode.isSelected()) + Fe ? this.rowNode.setSelectedParams({ newValue: !1 }) : O ? ze && this.rowNode.setSelectedParams({ newValue: !1 }) : this.rowNode.setSelectedParams({ newValue: !0, clearSelection: !z, rangeSelect: z }); + else { + var ht = Fe ? !1 : !O; + this.rowNode.setSelectedParams({ newValue: !0, clearSelection: ht, rangeSelect: z }); + } + } + } + }, f.prototype.setupDetailRowAutoHeight = function(d) { + var g = this; + if (this.rowType === yd.FullWidthDetail && this.beans.gridOptionsWrapper.isDetailRowAutoHeight()) { + var S = function() { + var z = d.clientHeight; + if (z != null && z > 0) { + var te = function() { + g.rowNode.setRowHeight(z), g.beans.clientSideRowModel ? g.beans.clientSideRowModel.onRowHeightChanged() : g.beans.serverSideRowModel && g.beans.serverSideRowModel.onRowHeightChanged(); + }; + g.beans.frameworkOverrides.setTimeout(te, 0); + } + }, O = this.beans.resizeObserverService.observeResize(d, S); + this.addDestroyFunc(O), S(); + } + }, f.prototype.createFullWidthParams = function(d, g) { + var S = this, O = { + fullWidth: !0, + data: this.rowNode.data, + node: this.rowNode, + value: this.rowNode.key, + valueFormatted: this.rowNode.key, + rowIndex: this.rowNode.rowIndex, + api: this.beans.gridOptionsWrapper.getApi(), + columnApi: this.beans.gridOptionsWrapper.getColumnApi(), + context: this.beans.gridOptionsWrapper.getContext(), + // these need to be taken out, as part of 'afterAttached' now + eGridCell: d, + eParentOfValue: d, + pinned: g, + addRenderedRowListener: this.addEventListener.bind(this), + registerRowDragger: function(z, te, Fe, ze) { + return S.addFullWidthRowDragging(z, te, Fe, ze); + } + }; + return O; + }, f.prototype.addFullWidthRowDragging = function(d, g, S, O) { + if (S === void 0 && (S = ""), !!this.isFullWidth()) { + var z = new MC(function() { + return S; + }, this.rowNode, void 0, d, g, O); + this.createManagedBean(z, this.beans.context); + } + }, f.prototype.onUiLevelChanged = function() { + var d = this.beans.rowCssClassCalculator.calculateRowLevel(this.rowNode); + if (this.rowLevel != d) { + var g = "ag-row-level-" + d, S = "ag-row-level-" + this.rowLevel; + this.allRowGuis.forEach(function(O) { + O.rowComp.addOrRemoveCssClass(g, !0), O.rowComp.addOrRemoveCssClass(S, !1); + }); + } + this.rowLevel = d; + }, f.prototype.isFirstRowOnPage = function() { + return this.rowNode.rowIndex === this.beans.paginationProxy.getPageFirstRow(); + }, f.prototype.isLastRowOnPage = function() { + return this.rowNode.rowIndex === this.beans.paginationProxy.getPageLastRow(); + }, f.prototype.onModelUpdated = function() { + this.refreshFirstAndLastRowStyles(); + }, f.prototype.refreshFirstAndLastRowStyles = function() { + var d = this.isFirstRowOnPage(), g = this.isLastRowOnPage(); + this.firstRowOnPage !== d && (this.firstRowOnPage = d, this.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass("ag-row-first", d); + })), this.lastRowOnPage !== g && (this.lastRowOnPage = g, this.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass("ag-row-last", g); + })); + }, f.prototype.stopEditing = function(d) { + d === void 0 && (d = !1); + var g = this.getAllCellCtrls().map(function(O) { + return O.stopEditing(d); + }); + if (this.editingRow) { + if (!d && g.some(function(O) { + return O; + })) { + var S = this.createRowEvent(ui.EVENT_ROW_VALUE_CHANGED); + this.beans.eventService.dispatchEvent(S); + } + this.setEditingRow(!1); + } + }, f.prototype.setInlineEditingCss = function(d) { + this.allRowGuis.forEach(function(g) { + g.rowComp.addOrRemoveCssClass("ag-row-inline-editing", d), g.rowComp.addOrRemoveCssClass("ag-row-not-inline-editing", !d); + }); + }, f.prototype.setEditingRow = function(d) { + this.editingRow = d, this.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass("ag-row-editing", d); + }); + var g = d ? this.createRowEvent(ui.EVENT_ROW_EDITING_STARTED) : this.createRowEvent(ui.EVENT_ROW_EDITING_STOPPED); + this.beans.eventService.dispatchEvent(g); + }, f.prototype.startRowEditing = function(d, g, S, O) { + d === void 0 && (d = null), g === void 0 && (g = null), S === void 0 && (S = null), O === void 0 && (O = null), !this.editingRow && (this.getAllCellCtrls().forEach(function(z) { + var te = z === S; + te ? z.startEditing(d, g, te, O) : z.startEditing(null, null, te, O); + }), this.setEditingRow(!0)); + }, f.prototype.getAllCellCtrls = function() { + var d = Ju(this.centerCellCtrls.list, this.leftCellCtrls.list, this.rightCellCtrls.list); + return d; + }, f.prototype.postProcessClassesFromGridOptions = function() { + var d = this, g = this.beans.rowCssClassCalculator.processClassesFromGridOptions(this.rowNode); + !g || !g.length || g.forEach(function(S) { + d.allRowGuis.forEach(function(O) { + return O.rowComp.addOrRemoveCssClass(S, !0); + }); + }); + }, f.prototype.postProcessRowClassRules = function() { + var d = this; + this.beans.rowCssClassCalculator.processRowClassRules(this.rowNode, function(g) { + d.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass(g, !0); + }); + }, function(g) { + d.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass(g, !1); + }); + }); + }, f.prototype.setStylesFromGridOptions = function() { + var d = this.processStylesFromGridOptions(); + this.allRowGuis.forEach(function(g) { + return g.rowComp.setUserStyles(d); + }); + }, f.prototype.getRowBusinessKey = function() { + var d = this.beans.gridOptionsWrapper.getBusinessKeyForNodeFunc(); + if (typeof d == "function") + return d(this.rowNode); + }, f.prototype.getPinnedForContainer = function(d) { + var g = d === t.RowContainerType.LEFT ? Ue.PINNED_LEFT : d === t.RowContainerType.RIGHT ? Ue.PINNED_RIGHT : null; + return g; + }, f.prototype.getInitialRowClasses = function(d) { + var g = this.getPinnedForContainer(d), S = { + rowNode: this.rowNode, + rowFocused: this.rowFocused, + fadeRowIn: this.fadeRowIn, + rowIsEven: this.rowNode.rowIndex % 2 === 0, + rowLevel: this.rowLevel, + fullWidthRow: this.isFullWidth(), + firstRowOnPage: this.isFirstRowOnPage(), + lastRowOnPage: this.isLastRowOnPage(), + printLayout: this.printLayout, + expandable: this.rowNode.isExpandable(), + pinned: g + }; + return this.beans.rowCssClassCalculator.getInitialRowClasses(S); + }, f.prototype.processStylesFromGridOptions = function() { + var d = this.beans.gridOptionsWrapper.getRowStyle(); + if (d && typeof d == "function") { + console.warn("AG Grid: rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead"); + return; + } + var g = this.beans.gridOptionsWrapper.getRowStyleFunc(), S; + if (g) { + var O = { + data: this.rowNode.data, + node: this.rowNode, + rowIndex: this.rowNode.rowIndex + }; + S = g(O); + } + return Object.assign({}, d, S); + }, f.prototype.onRowSelected = function() { + var d = this, g = !!this.rowNode.isSelected(); + this.allRowGuis.forEach(function(S) { + S.rowComp.addOrRemoveCssClass("ag-row-selected", g), yl(S.element, g ? !0 : void 0); + var O = d.createAriaLabel(); + $n(S.element, O ?? ""); + }); + }, f.prototype.createAriaLabel = function() { + var d = this.rowNode.isSelected(); + if (!(d && this.beans.gridOptionsWrapper.isSuppressRowDeselection())) { + var g = this.beans.gridOptionsWrapper.getLocaleTextFunc(), S = g(d ? "ariaRowDeselect" : "ariaRowSelect", "Press SPACE to " + (d ? "deselect" : "select") + " this row."); + return S; + } + }, f.prototype.isUseAnimationFrameForCreate = function() { + return this.useAnimationFrameForCreate; + }, f.prototype.addHoverFunctionality = function(d) { + var g = this; + this.active && (this.addManagedListener(d, "mouseenter", function() { + return g.rowNode.onMouseEnter(); + }), this.addManagedListener(d, "mouseleave", function() { + return g.rowNode.onMouseLeave(); + }), this.addManagedListener(this.rowNode, oi.EVENT_MOUSE_ENTER, function() { + g.beans.gridOptionsWrapper.isSuppressRowHoverHighlight() || d.classList.add("ag-row-hover"); + }), this.addManagedListener(this.rowNode, oi.EVENT_MOUSE_LEAVE, function() { + d.classList.remove("ag-row-hover"); + })); + }, f.prototype.roundRowTopToBounds = function(d) { + var g = this.beans.ctrlsService.getGridBodyCtrl(), S = g.getScrollFeature().getVScrollPosition(), O = this.applyPaginationOffset(S.top, !0) - 100, z = this.applyPaginationOffset(S.bottom, !0) + 100; + return Math.min(Math.max(O, d), z); + }, f.prototype.getFrameworkOverrides = function() { + return this.beans.frameworkOverrides; + }, f.prototype.onRowHeightChanged = function() { + if (this.rowNode.rowHeight != null) { + var d = this.rowNode.rowHeight, g = this.beans.gridOptionsWrapper.getDefaultRowHeight(), S = this.beans.gridOptionsWrapper.isGetRowHeightFunction(), O = S ? this.beans.gridOptionsWrapper.getRowHeightForNode(this.rowNode).height : void 0, z = O ? Math.min(g, O) - 2 + "px" : void 0; + this.allRowGuis.forEach(function(te) { + te.element.style.height = d + "px", z && te.element.style.setProperty("--ag-line-height", z); + }); + } + }, f.prototype.addEventListener = function(d, g) { + (d === "renderedRowRemoved" || d === "rowRemoved") && (d = ui.EVENT_VIRTUAL_ROW_REMOVED, console.warn("AG Grid: Since version 11, event renderedRowRemoved is now called " + ui.EVENT_VIRTUAL_ROW_REMOVED)), M.prototype.addEventListener.call(this, d, g); + }, f.prototype.removeEventListener = function(d, g) { + (d === "renderedRowRemoved" || d === "rowRemoved") && (d = ui.EVENT_VIRTUAL_ROW_REMOVED, console.warn("AG Grid: Since version 11, event renderedRowRemoved and rowRemoved is now called " + ui.EVENT_VIRTUAL_ROW_REMOVED)), M.prototype.removeEventListener.call(this, d, g); + }, f.prototype.destroyFirstPass = function() { + this.active = !1, this.setupRemoveAnimation(); + var d = this.createRowEvent(ui.EVENT_VIRTUAL_ROW_REMOVED); + this.dispatchEvent(d), this.beans.eventService.dispatchEvent(d), M.prototype.destroy.call(this); + }, f.prototype.setupRemoveAnimation = function() { + var d = this.rowNode.rowTop != null; + if (d) { + var g = this.roundRowTopToBounds(this.rowNode.rowTop); + this.setRowTop(g); + } else + this.allRowGuis.forEach(function(S) { + return S.rowComp.addOrRemoveCssClass("ag-opacity-zero", !0); + }); + }, f.prototype.destroySecondPass = function() { + this.allRowGuis.length = 0; + var d = function(g) { + return g.list.forEach(function(S) { + return S.destroy(); + }), { list: [], map: {} }; + }; + this.centerCellCtrls = d(this.centerCellCtrls), this.leftCellCtrls = d(this.leftCellCtrls), this.rightCellCtrls = d(this.rightCellCtrls); + }, f.prototype.setFocusedClasses = function() { + var d = this; + this.allRowGuis.forEach(function(g) { + g.rowComp.addOrRemoveCssClass("ag-row-focus", d.rowFocused), g.rowComp.addOrRemoveCssClass("ag-row-no-focus", !d.rowFocused); + }); + }, f.prototype.onCellFocusChanged = function() { + var d = this.beans.focusService.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned); + d !== this.rowFocused && (this.rowFocused = d, this.setFocusedClasses()), !d && this.editingRow && this.stopEditing(!1); + }, f.prototype.onPaginationChanged = function() { + var d = this.beans.paginationProxy.getCurrentPage(); + this.paginationPage !== d && (this.paginationPage = d, this.onTopChanged()), this.refreshFirstAndLastRowStyles(); + }, f.prototype.onTopChanged = function() { + this.setRowTop(this.rowNode.rowTop); + }, f.prototype.onPaginationPixelOffsetChanged = function() { + this.onTopChanged(); + }, f.prototype.applyPaginationOffset = function(d, g) { + if (g === void 0 && (g = !1), this.rowNode.isRowPinned()) + return d; + var S = this.beans.paginationProxy.getPixelOffset(), O = g ? 1 : -1; + return d + S * O; + }, f.prototype.setRowTop = function(d) { + if (!this.printLayout && i(d)) { + var g = this.applyPaginationOffset(d), S = this.rowNode.isRowPinned() ? g : this.beans.rowContainerHeightService.getRealPixelPosition(g), O = S + "px"; + this.setRowTopStyle(O); + } + }, f.prototype.getInitialRowTop = function() { + return this.initialTop; + }, f.prototype.getInitialTransform = function() { + return this.initialTransform; + }, f.prototype.setInitialRowTop = function() { + if (this.printLayout) + return ""; + var d = this.slideRowIn ? this.roundRowTopToBounds(this.rowNode.oldRowTop) : this.rowNode.rowTop, g = this.applyPaginationOffset(d), S = this.rowNode.isRowPinned() ? g : this.beans.rowContainerHeightService.getRealPixelPosition(g), O = S + "px", z = this.beans.gridOptionsWrapper.isSuppressRowTransform(); + z ? this.initialTop = O : this.initialTransform = "translateY(" + O + ")"; + }, f.prototype.setRowTopStyle = function(d) { + var g = this.beans.gridOptionsWrapper.isSuppressRowTransform(); + this.allRowGuis.forEach(function(S) { + return g ? S.rowComp.setTop(d) : S.rowComp.setTransform("translateY(" + d + ")"); + }); + }, f.prototype.getRowNode = function() { + return this.rowNode; + }, f.prototype.getCellCtrl = function(d) { + var g = null; + return this.getAllCellCtrls().forEach(function(S) { + S.getColumn() == d && (g = S); + }), g != null || this.getAllCellCtrls().forEach(function(S) { + S.getColSpanningList().indexOf(d) >= 0 && (g = S); + }), g; + }, f.prototype.onRowIndexChanged = function() { + this.rowNode.rowIndex != null && (this.onCellFocusChanged(), this.updateRowIndexes(), this.postProcessCss()); + }, f.prototype.updateRowIndexes = function() { + var d = this.rowNode.getRowIndexString(), g = this.beans.headerNavigationService.getHeaderRowCount(), S = this.rowNode.rowIndex % 2 === 0, O = g + this.rowNode.rowIndex + 1; + this.allRowGuis.forEach(function(z) { + z.rowComp.setRowIndex(d), z.rowComp.addOrRemoveCssClass("ag-row-even", S), z.rowComp.addOrRemoveCssClass("ag-row-odd", !S), Bl(z.element, O); + }); + }, f.prototype.getPinnedLeftRowElement = function() { + return this.leftGui ? this.leftGui.element : void 0; + }, f.prototype.getPinnedRightRowElement = function() { + return this.rightGui ? this.rightGui.element : void 0; + }, f.prototype.getBodyRowElement = function() { + return this.centerGui ? this.centerGui.element : void 0; + }, f.prototype.getFullWidthRowElement = function() { + return this.fullWidthGui ? this.fullWidthGui.element : void 0; + }, f.DOM_DATA_KEY_ROW_CTRL = "renderedRow", f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Eh = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Dm = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, BC = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, VC = ( + /** @class */ + function(M) { + Eh(f, M); + function f(d) { + var g = M.call(this) || this; + return g.element = d, g; + } + return f.prototype.postConstruct = function() { + this.addMouseListeners(), this.mockContextMenuForIPad(), this.addKeyboardEvents(); + }, f.prototype.addKeyboardEvents = function() { + var d = this, g = ["keydown", "keypress"]; + g.forEach(function(S) { + var O = d.processKeyboardEvent.bind(d, S); + d.addManagedListener(d.element, S, O); + }); + }, f.prototype.addMouseListeners = function() { + var d = this, g = rr("touchstart") ? "touchstart" : "mousedown", S = ["dblclick", "contextmenu", "mouseover", "mouseout", "click", g]; + S.forEach(function(O) { + var z = d.processMouseEvent.bind(d, O); + d.addManagedListener(d.element, O, z); + }); + }, f.prototype.processMouseEvent = function(d, g) { + if (!(!this.mouseEventService.isEventFromThisGrid(g) || Yi(g))) { + var S = this.getRowForEvent(g), O = this.mouseEventService.getRenderedCellForEvent(g); + d === "contextmenu" ? this.handleContextMenuMouseEvent(g, null, S, O) : (O && O.onMouseEvent(d, g), S && S.onMouseEvent(d, g)); + } + }, f.prototype.mockContextMenuForIPad = function() { + var d = this; + if (jh()) { + var g = new pg(this.element), S = function(O) { + var z = d.getRowForEvent(O.touchEvent), te = d.mouseEventService.getRenderedCellForEvent(O.touchEvent); + d.handleContextMenuMouseEvent(null, O.touchEvent, z, te); + }; + this.addManagedListener(g, pg.EVENT_LONG_TAP, S), this.addDestroyFunc(function() { + return g.destroy(); + }); + } + }, f.prototype.getRowForEvent = function(d) { + for (var g = d.target; g; ) { + var S = this.gridOptionsWrapper.getDomData(g, Jb.DOM_DATA_KEY_ROW_CTRL); + if (S) + return S; + g = g.parentElement; + } + return null; + }, f.prototype.handleContextMenuMouseEvent = function(d, g, S, O) { + var z = S ? S.getRowNode() : null, te = O ? O.getColumn() : null, Fe = null; + if (te) { + var ze = d || g; + O.dispatchCellContextMenuEvent(ze), Fe = this.valueService.getValue(te, z); + } + var ht = this.ctrlsService.getGridBodyCtrl(), Lt = O ? O.getGui() : ht.getGridBodyElement(); + this.contextMenuFactory && this.contextMenuFactory.onContextMenu(d, g, z, te, Fe, Lt); + }, f.prototype.processKeyboardEvent = function(d, g) { + var S = _i(this.gridOptionsWrapper, g, vo.DOM_DATA_KEY_CELL_CTRL), O = _i(this.gridOptionsWrapper, g, Jb.DOM_DATA_KEY_ROW_CTRL); + g.defaultPrevented || (S ? this.processCellKeyboardEvent(S, d, g) : O && O.isFullWidth() && this.processFullWidthRowKeyboardEvent(O, d, g)); + }, f.prototype.processCellKeyboardEvent = function(d, g, S) { + var O = d.getRowNode(), z = d.getColumn(), te = d.isEditing(), Fe = !Hg(this.gridOptionsWrapper, S, O, z, te); + if (Fe) + switch (g) { + case "keydown": + var ze = !te && this.navigationService.handlePageScrollingKey(S); + ze || d.onKeyDown(S), this.doGridOperations(S, d.isEditing()); + break; + case "keypress": + d.onKeyPress(S); + break; + } + if (g === "keydown") { + var ht = d.createEvent(S, ui.EVENT_CELL_KEY_DOWN); + this.eventService.dispatchEvent(ht); + } + if (g === "keypress") { + var Lt = d.createEvent(S, ui.EVENT_CELL_KEY_PRESS); + this.eventService.dispatchEvent(Lt); + } + }, f.prototype.processFullWidthRowKeyboardEvent = function(d, g, S) { + var O = d.getRowNode(), z = this.focusService.getFocusedCell(), te = z && z.column, Fe = !Hg(this.gridOptionsWrapper, S, O, te, !1); + if (Fe) { + var ze = S.key; + if (g === "keydown") + switch (ze) { + case Hr.UP: + case Hr.DOWN: + d.onKeyboardNavigate(S); + break; + case Hr.TAB: + d.onTabKeyDown(S); + } + } + if (g === "keydown") { + var ht = d.createRowEvent(ui.EVENT_CELL_KEY_DOWN, S); + this.eventService.dispatchEvent(ht); + } + if (g === "keypress") { + var Lt = d.createRowEvent(ui.EVENT_CELL_KEY_PRESS, S); + this.eventService.dispatchEvent(Lt); + } + }, f.prototype.doGridOperations = function(d, g) { + if (!(!d.ctrlKey && !d.metaKey) && !g && this.mouseEventService.isEventFromThisGrid(d)) + switch (d.code) { + case Hr.A: + return this.onCtrlAndA(d); + case Hr.C: + return this.onCtrlAndC(d); + case Hr.V: + return this.onCtrlAndV(); + case Hr.D: + return this.onCtrlAndD(d); + case Hr.Z: + return d.shiftKey ? this.undoRedoService.redo() : this.undoRedoService.undo(); + case Hr.Y: + return this.undoRedoService.redo(); + } + }, f.prototype.onCtrlAndA = function(d) { + var g = this, S = g.pinnedRowModel, O = g.paginationProxy, z = g.rangeService, te = Ue.PINNED_BOTTOM, Fe = Ue.PINNED_TOP; + if (z && O.isRowsToRender()) { + var ze = BC([ + S.isEmpty(Fe), + S.isEmpty(te) + ], 2), ht = ze[0], Lt = ze[1], ti = ht ? null : Fe, wi = void 0, Ti = void 0; + Lt ? (wi = null, Ti = this.paginationProxy.getRowCount() - 1) : (wi = te, Ti = S.getPinnedBottomRowData().length - 1); + var qi = this.columnModel.getAllDisplayedColumns(); + if (n(qi)) + return; + z.setCellRange({ + rowStartIndex: 0, + rowStartPinned: ti, + rowEndIndex: Ti, + rowEndPinned: wi, + columnStart: qi[0], + columnEnd: m(qi) + }); + } + d.preventDefault(); + }, f.prototype.onCtrlAndC = function(d) { + !this.clipboardService || this.gridOptionsWrapper.isEnableCellTextSelection() || (this.clipboardService.copyToClipboard(), d.preventDefault()); + }, f.prototype.onCtrlAndV = function() { + si.isRegistered(t.ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste() && this.clipboardService.pasteFromClipboard(); + }, f.prototype.onCtrlAndD = function(d) { + si.isRegistered(t.ModuleNames.ClipboardModule) && !this.gridOptionsWrapper.isSuppressClipboardPaste() && this.clipboardService.copyRangeDown(), d.preventDefault(); + }, Dm([ + pe("mouseEventService") + ], f.prototype, "mouseEventService", void 0), Dm([ + pe("valueService") + ], f.prototype, "valueService", void 0), Dm([ + Ae("contextMenuFactory") + ], f.prototype, "contextMenuFactory", void 0), Dm([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Dm([ + pe("navigationService") + ], f.prototype, "navigationService", void 0), Dm([ + pe("focusService") + ], f.prototype, "focusService", void 0), Dm([ + pe("undoRedoService") + ], f.prototype, "undoRedoService", void 0), Dm([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Dm([ + pe("paginationProxy") + ], f.prototype, "paginationProxy", void 0), Dm([ + pe("pinnedRowModel") + ], f.prototype, "pinnedRowModel", void 0), Dm([ + Ae("rangeService") + ], f.prototype, "rangeService", void 0), Dm([ + Ae("clipboardService") + ], f.prototype, "clipboardService", void 0), Dm([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var r9 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Hy = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, n9 = ( + /** @class */ + function(M) { + r9(f, M); + function f(d) { + var g = M.call(this) || this; + return g.centerContainerCtrl = d, g; + } + return f.prototype.postConstruct = function() { + var d = this; + this.ctrlsService.whenReady(function() { + d.gridBodyCtrl = d.ctrlsService.getGridBodyCtrl(), d.listenForResize(); + }), this.addManagedListener(this.eventService, ui.EVENT_SCROLLBAR_WIDTH_CHANGED, this.onScrollbarWidthChanged.bind(this)); + }, f.prototype.listenForResize = function() { + var d = this, g = function() { + return d.onCenterViewportResized(); + }; + this.centerContainerCtrl.registerViewportResizeListener(g), this.gridBodyCtrl.registerBodyViewportResizeListener(g); + }, f.prototype.onScrollbarWidthChanged = function() { + this.checkViewportAndScrolls(); + }, f.prototype.onCenterViewportResized = function() { + if (this.centerContainerCtrl.isViewportVisible()) { + this.checkViewportAndScrolls(); + var d = this.centerContainerCtrl.getCenterWidth(); + d !== this.centerWidth && (this.centerWidth = d, this.columnModel.refreshFlexedColumns({ viewportWidth: this.centerWidth, updateBodyWidths: !0, fireResizedEvent: !0 })); + } else + this.bodyHeight = 0; + }, f.prototype.checkViewportAndScrolls = function() { + this.updateScrollVisibleService(), this.checkBodyHeight(), this.onHorizontalViewportChanged(), this.gridBodyCtrl.getScrollFeature().checkScrollLeft(); + }, f.prototype.getBodyHeight = function() { + return this.bodyHeight; + }, f.prototype.checkBodyHeight = function() { + var d = this.gridBodyCtrl.getBodyViewportElement(), g = Fp(d); + if (this.bodyHeight !== g) { + this.bodyHeight = g; + var S = { + type: ui.EVENT_BODY_HEIGHT_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(S); + } + }, f.prototype.updateScrollVisibleService = function() { + this.updateScrollVisibleServiceImpl(), setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500); + }, f.prototype.updateScrollVisibleServiceImpl = function() { + var d = { + horizontalScrollShowing: this.isHorizontalScrollShowing(), + verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing() + }; + this.scrollVisibleService.setScrollsVisible(d), this.gridBodyCtrl.setVerticalScrollPaddingVisible(d.verticalScrollShowing); + }, f.prototype.isHorizontalScrollShowing = function() { + var d = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll(); + return d || this.centerContainerCtrl.isViewportHScrollShowing(); + }, f.prototype.onHorizontalViewportChanged = function() { + var d = this.centerContainerCtrl.getCenterWidth(), g = this.centerContainerCtrl.getViewportScrollLeft(); + this.columnModel.setViewportPosition(d, g); + }, Hy([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Hy([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Hy([ + pe("scrollVisibleService") + ], f.prototype, "scrollVisibleService", void 0), Hy([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), Hy([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), Hy([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Bre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), DL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, FL = ( + /** @class */ + function(M) { + Bre(f, M); + function f(d) { + var g = M.call(this) || this; + return g.element = d, g; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.eventService, ui.EVENT_LEFT_PINNED_WIDTH_CHANGED, this.onPinnedLeftWidthChanged.bind(this)); + }, f.prototype.onPinnedLeftWidthChanged = function() { + var d = this.pinnedWidthService.getPinnedLeftWidth(), g = d > 0; + al(this.element, g), g && Wt(this.element, d); + }, DL([ + pe("pinnedWidthService") + ], f.prototype, "pinnedWidthService", void 0), DL([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var s9 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), o9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, DH = ( + /** @class */ + function(M) { + s9(f, M); + function f(d) { + var g = M.call(this) || this; + return g.element = d, g; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.eventService, ui.EVENT_RIGHT_PINNED_WIDTH_CHANGED, this.onPinnedRightWidthChanged.bind(this)); + }, f.prototype.onPinnedRightWidthChanged = function() { + var d = this.pinnedWidthService.getPinnedRightWidth(), g = d > 0; + al(this.element, g), g && Wt(this.element, d); + }, o9([ + pe("pinnedWidthService") + ], f.prototype, "pinnedWidthService", void 0), o9([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var FH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), a9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, LL = ( + /** @class */ + function(M) { + FH(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.eContainer = d, S.eWrapper = g, S; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.eventService, ui.EVENT_ROW_CONTAINER_HEIGHT_CHANGED, this.onHeightChanged.bind(this)); + }, f.prototype.onHeightChanged = function() { + var d = this.maxDivHeightScaler.getUiContainerHeight(), g = d != null ? d + "px" : ""; + this.eContainer.style.height = g, this.eWrapper && (this.eWrapper.style.height = g); + }, a9([ + pe("rowContainerHeightService") + ], f.prototype, "maxDivHeightScaler", void 0), a9([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var LH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), NL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Vre = ( + /** @class */ + function(M) { + LH(f, M); + function f(d) { + var g = M.call(this) || this; + return g.eContainer = d, g; + } + return f.prototype.postConstruct = function() { + var d = this; + if (!(!this.gridOptionsWrapper.isEnableRangeSelection() || // no range selection if no property + r(this.rangeService))) { + var g = { + dragStartPixels: 0, + eElement: this.eContainer, + onDragStart: this.rangeService.onDragStart.bind(this.rangeService), + onDragStop: this.rangeService.onDragStop.bind(this.rangeService), + onDragging: this.rangeService.onDragging.bind(this.rangeService) + }; + this.dragService.addDragSource(g), this.addDestroyFunc(function() { + return d.dragService.removeDragSource(g); + }); + } + }, NL([ + Ae("rangeService") + ], f.prototype, "rangeService", void 0), NL([ + pe("dragService") + ], f.prototype, "dragService", void 0), NL([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var NH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), l9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, kH = ( + /** @class */ + function(M) { + NH(f, M); + function f(d) { + var g = M.call(this) || this; + return g.callback = d, g; + } + return f.prototype.postConstruct = function() { + var d = this.setWidth.bind(this); + this.addManagedListener(this.gridOptionsWrapper, jn.PROP_DOM_LAYOUT, d), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, d), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, d), this.setWidth(); + }, f.prototype.setWidth = function() { + var d = this.columnModel, g = this.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_PRINT, S = d.getBodyContainerWidth(), O = d.getDisplayedColumnsLeftWidth(), z = d.getDisplayedColumnsRightWidth(), te = g ? S + O + z : S; + this.callback(te); + }, l9([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), l9([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var jre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Zb = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, kL = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, $H = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(kL(arguments[f])); + return M; + }; + (function(M) { + M.LEFT = "left", M.RIGHT = "right", M.CENTER = "center", M.FULL_WIDTH = "fullWidth", M.TOP_LEFT = "topLeft", M.TOP_RIGHT = "topRight", M.TOP_CENTER = "topCenter", M.TOP_FULL_WIDTH = "topFullWidth", M.BOTTOM_LEFT = "bottomLeft", M.BOTTOM_RIGHT = "bottomRight", M.BOTTOM_CENTER = "bottomCenter", M.BOTTOM_FULL_WIDTH = "bottomFullWidth"; + })(t.RowContainerName || (t.RowContainerName = {})), function(M) { + M.LEFT = "left", M.RIGHT = "right", M.CENTER = "center", M.FULL_WIDTH = "fullWidth"; + }(t.RowContainerType || (t.RowContainerType = {})); + function u9(M) { + switch (M) { + case t.RowContainerName.CENTER: + case t.RowContainerName.TOP_CENTER: + case t.RowContainerName.BOTTOM_CENTER: + return t.RowContainerType.CENTER; + case t.RowContainerName.LEFT: + case t.RowContainerName.TOP_LEFT: + case t.RowContainerName.BOTTOM_LEFT: + return t.RowContainerType.LEFT; + case t.RowContainerName.RIGHT: + case t.RowContainerName.TOP_RIGHT: + case t.RowContainerName.BOTTOM_RIGHT: + return t.RowContainerType.RIGHT; + case t.RowContainerName.FULL_WIDTH: + case t.RowContainerName.TOP_FULL_WIDTH: + case t.RowContainerName.BOTTOM_FULL_WIDTH: + return t.RowContainerType.FULL_WIDTH; + default: + throw Error("Invalid Row Container Type"); + } + } + var BH = kn([ + [t.RowContainerName.CENTER, "ag-center-cols-container"], + [t.RowContainerName.LEFT, "ag-pinned-left-cols-container"], + [t.RowContainerName.RIGHT, "ag-pinned-right-cols-container"], + [t.RowContainerName.FULL_WIDTH, "ag-full-width-container"], + [t.RowContainerName.TOP_CENTER, "ag-floating-top-container"], + [t.RowContainerName.TOP_LEFT, "ag-pinned-left-floating-top"], + [t.RowContainerName.TOP_RIGHT, "ag-pinned-right-floating-top"], + [t.RowContainerName.TOP_FULL_WIDTH, "ag-floating-top-full-width-container"], + [t.RowContainerName.BOTTOM_CENTER, "ag-floating-bottom-container"], + [t.RowContainerName.BOTTOM_LEFT, "ag-pinned-left-floating-bottom"], + [t.RowContainerName.BOTTOM_RIGHT, "ag-pinned-right-floating-bottom"], + [t.RowContainerName.BOTTOM_FULL_WIDTH, "ag-floating-bottom-full-width-container"] + ]), c9 = kn([ + [t.RowContainerName.CENTER, "ag-center-cols-viewport"], + [t.RowContainerName.TOP_CENTER, "ag-floating-top-viewport"], + [t.RowContainerName.BOTTOM_CENTER, "ag-floating-bottom-viewport"] + ]), h9 = kn([ + [t.RowContainerName.CENTER, "ag-center-cols-clipper"] + ]), sR = ( + /** @class */ + function(M) { + jre(f, M); + function f(d) { + var g = M.call(this) || this; + return g.name = d, g; + } + return f.getRowContainerCssClasses = function(d) { + var g = BH.get(d), S = c9.get(d), O = h9.get(d); + return { container: g, viewport: S, wrapper: O }; + }, f.getPinned = function(d) { + switch (d) { + case t.RowContainerName.BOTTOM_LEFT: + case t.RowContainerName.TOP_LEFT: + case t.RowContainerName.LEFT: + return Ue.PINNED_LEFT; + case t.RowContainerName.BOTTOM_RIGHT: + case t.RowContainerName.TOP_RIGHT: + case t.RowContainerName.RIGHT: + return Ue.PINNED_RIGHT; + default: + return null; + } + }, f.prototype.postConstruct = function() { + var d = this; + this.enableRtl = this.gridOptionsWrapper.isEnableRtl(), this.embedFullWidthRows = this.gridOptionsWrapper.isEmbedFullWidthRows(), this.forContainers([t.RowContainerName.CENTER], function() { + return d.viewportSizeFeature = d.createManagedBean(new n9(d)); + }); + }, f.prototype.registerWithCtrlsService = function() { + switch (this.name) { + case t.RowContainerName.CENTER: + this.ctrlsService.registerCenterRowContainerCtrl(this); + break; + case t.RowContainerName.LEFT: + this.ctrlsService.registerLeftRowContainerCtrl(this); + break; + case t.RowContainerName.RIGHT: + this.ctrlsService.registerRightRowContainerCtrl(this); + break; + case t.RowContainerName.TOP_CENTER: + this.ctrlsService.registerTopCenterRowContainerCtrl(this); + break; + case t.RowContainerName.TOP_LEFT: + this.ctrlsService.registerTopLeftRowContainerCon(this); + break; + case t.RowContainerName.TOP_RIGHT: + this.ctrlsService.registerTopRightRowContainerCtrl(this); + break; + case t.RowContainerName.BOTTOM_CENTER: + this.ctrlsService.registerBottomCenterRowContainerCtrl(this); + break; + case t.RowContainerName.BOTTOM_LEFT: + this.ctrlsService.registerBottomLeftRowContainerCtrl(this); + break; + case t.RowContainerName.BOTTOM_RIGHT: + this.ctrlsService.registerBottomRightRowContainerCtrl(this); + break; + } + }, f.prototype.forContainers = function(d, g) { + d.indexOf(this.name) >= 0 && g(); + }, f.prototype.getContainerElement = function() { + return this.eContainer; + }, f.prototype.getViewportSizeFeature = function() { + return this.viewportSizeFeature; + }, f.prototype.setComp = function(d, g, S, O) { + var z = this; + this.comp = d, this.eContainer = g, this.eViewport = S, this.eWrapper = O, this.createManagedBean(new VC(this.eContainer)), this.addPreventScrollWhileDragging(), this.listenOnDomOrder(), this.stopHScrollOnPinnedRows(); + var te = [t.RowContainerName.TOP_CENTER, t.RowContainerName.TOP_LEFT, t.RowContainerName.TOP_RIGHT], Fe = [t.RowContainerName.BOTTOM_CENTER, t.RowContainerName.BOTTOM_LEFT, t.RowContainerName.BOTTOM_RIGHT], ze = [t.RowContainerName.CENTER, t.RowContainerName.LEFT, t.RowContainerName.RIGHT], ht = $H(te, Fe, ze), Lt = [t.RowContainerName.CENTER, t.RowContainerName.LEFT, t.RowContainerName.RIGHT, t.RowContainerName.FULL_WIDTH], ti = [t.RowContainerName.CENTER, t.RowContainerName.TOP_CENTER, t.RowContainerName.BOTTOM_CENTER], wi = [t.RowContainerName.LEFT, t.RowContainerName.BOTTOM_LEFT, t.RowContainerName.TOP_LEFT], Ti = [t.RowContainerName.RIGHT, t.RowContainerName.BOTTOM_RIGHT, t.RowContainerName.TOP_RIGHT]; + this.forContainers(wi, function() { + return z.createManagedBean(new FL(z.eContainer)); + }), this.forContainers(Ti, function() { + return z.createManagedBean(new DH(z.eContainer)); + }), this.forContainers(Lt, function() { + return z.createManagedBean(new LL(z.eContainer, z.eWrapper)); + }), this.forContainers(ht, function() { + return z.createManagedBean(new Vre(z.eContainer)); + }), this.forContainers(ti, function() { + return z.createManagedBean(new kH(function(qi) { + return z.comp.setContainerWidth(qi + "px"); + })); + }), this.addListeners(), this.registerWithCtrlsService(); + }, f.prototype.addListeners = function() { + var d = this; + this.addManagedListener(this.eventService, ui.EVENT_SCROLL_VISIBILITY_CHANGED, function() { + return d.onScrollVisibilityChanged(); + }), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, function() { + return d.onDisplayedColumnsChanged(); + }), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, function() { + return d.onDisplayedColumnsWidthChanged(); + }), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_ROWS_CHANGED, function() { + return d.onDisplayedRowsChanged(); + }), this.onScrollVisibilityChanged(), this.onDisplayedColumnsChanged(), this.onDisplayedColumnsWidthChanged(), this.onDisplayedRowsChanged(); + }, f.prototype.listenOnDomOrder = function() { + var d = this, g = function() { + return d.comp.setDomOrder(d.gridOptionsWrapper.isEnsureDomOrder()); + }; + this.addManagedListener(this.gridOptionsWrapper, jn.PROP_DOM_LAYOUT, g), g(); + }, f.prototype.stopHScrollOnPinnedRows = function() { + var d = this; + this.forContainers([t.RowContainerName.TOP_CENTER, t.RowContainerName.BOTTOM_CENTER], function() { + var g = function() { + return d.eViewport.scrollLeft = 0; + }; + d.addManagedListener(d.eViewport, "scroll", g); + }); + }, f.prototype.onDisplayedColumnsChanged = function() { + var d = this; + this.forContainers([t.RowContainerName.CENTER], function() { + return d.onHorizontalViewportChanged(); + }); + }, f.prototype.onDisplayedColumnsWidthChanged = function() { + var d = this; + this.forContainers([t.RowContainerName.CENTER], function() { + return d.onHorizontalViewportChanged(); + }); + }, f.prototype.onScrollVisibilityChanged = function() { + if (this.name === t.RowContainerName.CENTER) { + var d = this.scrollVisibleService.isHorizontalScrollShowing(), g = d && this.gridOptionsWrapper.getScrollbarWidth() || 0, S = g == 0 ? "100%" : "calc(100% + " + g + "px)"; + this.comp.setViewportHeight(S); + } + }, f.prototype.addPreventScrollWhileDragging = function() { + var d = this, g = function(S) { + d.dragService.isDragging() && S.cancelable && S.preventDefault(); + }; + this.eContainer.addEventListener("touchmove", g, { passive: !1 }), this.addDestroyFunc(function() { + return d.eContainer.removeEventListener("touchmove", g); + }); + }, f.prototype.onHorizontalViewportChanged = function() { + var d = this.getCenterWidth(), g = this.getCenterViewportScrollLeft(); + this.columnModel.setViewportPosition(d, g); + }, f.prototype.getCenterWidth = function() { + return ug(this.eViewport); + }, f.prototype.getCenterViewportScrollLeft = function() { + return Xs(this.eViewport, this.enableRtl); + }, f.prototype.registerViewportResizeListener = function(d) { + var g = this.resizeObserverService.observeResize(this.eViewport, d); + this.addDestroyFunc(function() { + return g(); + }); + }, f.prototype.isViewportVisible = function() { + return jc(this.eViewport); + }, f.prototype.isViewportHScrollShowing = function() { + return Ug(this.eViewport); + }, f.prototype.getViewportScrollLeft = function() { + return Xs(this.eViewport, this.enableRtl); + }, f.prototype.isHorizontalScrollShowing = function() { + var d = this.gridOptionsWrapper.isAlwaysShowHorizontalScroll(); + return d || Ug(this.eViewport); + }, f.prototype.getViewportElement = function() { + return this.eViewport; + }, f.prototype.setContainerTranslateX = function(d) { + this.eContainer.style.transform = "translateX(" + d + "px)"; + }, f.prototype.getHScrollPosition = function() { + var d = { + left: this.eViewport.scrollLeft, + right: this.eViewport.scrollLeft + this.eViewport.offsetWidth + }; + return d; + }, f.prototype.setCenterViewportScrollLeft = function(d) { + ql(this.eViewport, d, this.enableRtl); + }, f.prototype.onDisplayedRowsChanged = function() { + var d = this, g = this.name === t.RowContainerName.TOP_FULL_WIDTH || this.name === t.RowContainerName.BOTTOM_FULL_WIDTH || this.name === t.RowContainerName.FULL_WIDTH, S = function(te) { + var Fe = te.isFullWidth(), ze = d.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_PRINT, ht = d.embedFullWidthRows || ze, Lt = g ? !ht && Fe : ht || !Fe; + return Lt; + }, O = this.getRowCtrls(), z = O.filter(S); + this.comp.setRowCtrls(z); + }, f.prototype.getRowCtrls = function() { + switch (this.name) { + case t.RowContainerName.TOP_CENTER: + case t.RowContainerName.TOP_LEFT: + case t.RowContainerName.TOP_RIGHT: + case t.RowContainerName.TOP_FULL_WIDTH: + return this.rowRenderer.getTopRowCtrls(); + case t.RowContainerName.BOTTOM_CENTER: + case t.RowContainerName.BOTTOM_LEFT: + case t.RowContainerName.BOTTOM_RIGHT: + case t.RowContainerName.BOTTOM_FULL_WIDTH: + return this.rowRenderer.getBottomRowCtrls(); + default: + return this.rowRenderer.getRowCtrls(); + } + }, Zb([ + pe("scrollVisibleService") + ], f.prototype, "scrollVisibleService", void 0), Zb([ + pe("dragService") + ], f.prototype, "dragService", void 0), Zb([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Zb([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Zb([ + pe("resizeObserverService") + ], f.prototype, "resizeObserverService", void 0), Zb([ + pe("rowRenderer") + ], f.prototype, "rowRenderer", void 0), Zb([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var VH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), l2 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, jH = ( + /* html */ + `
+ + + + + + +
` + ), Gre = ( + /** @class */ + function(M) { + VH(f, M); + function f() { + return M.call(this, jH) || this; + } + return f.prototype.init = function() { + var d = this, g = function(O, z) { + var te = O + "px"; + z.style.minHeight = te, z.style.height = te; + }, S = { + setRowAnimationCssOnBodyViewport: function(O, z) { + return d.setRowAnimationCssOnBodyViewport(O, z); + }, + setColumnCount: function(O) { + return bh(d.getGui(), O); + }, + setRowCount: function(O) { + return Cu(d.getGui(), O); + }, + setTopHeight: function(O) { + return g(O, d.eTop); + }, + setBottomHeight: function(O) { + return g(O, d.eBottom); + }, + setTopDisplay: function(O) { + return d.eTop.style.display = O; + }, + setBottomDisplay: function(O) { + return d.eBottom.style.display = O; + }, + setColumnMovingCss: function(O, z) { + return d.addOrRemoveCssClass(Fre, z); + }, + updateLayoutClasses: function(O, z) { + var te = d.eBodyViewport.classList; + te.toggle(t.LayoutCssClasses.AUTO_HEIGHT, z.autoHeight), te.toggle(t.LayoutCssClasses.NORMAL, z.normal), te.toggle(t.LayoutCssClasses.PRINT, z.print), d.addOrRemoveCssClass(t.LayoutCssClasses.AUTO_HEIGHT, z.autoHeight), d.addOrRemoveCssClass(t.LayoutCssClasses.NORMAL, z.normal), d.addOrRemoveCssClass(t.LayoutCssClasses.PRINT, z.print); + }, + setAlwaysVerticalScrollClass: function(O, z) { + return d.eBodyViewport.classList.toggle(Dre, z); + }, + registerBodyViewportResizeListener: function(O) { + var z = d.resizeObserverService.observeResize(d.eBodyViewport, O); + d.addDestroyFunc(function() { + return z(); + }); + }, + setPinnedTopBottomOverflowY: function(O) { + return d.eTop.style.overflowY = d.eBottom.style.overflowY = O; + }, + setCellSelectableCss: function(O, z) { + [d.eTop, d.eBodyViewport, d.eBottom].forEach(function(te) { + return te.classList.toggle(CH, z); + }); + } + }; + this.ctrl = this.createManagedBean(new TH()), this.ctrl.setComp(S, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom), (this.rangeService || this.gridOptionsWrapper.isRowSelectionMulti()) && Xu(this.getGui(), !0); + }, f.prototype.setRowAnimationCssOnBodyViewport = function(d, g) { + var S = this.eBodyViewport.classList; + S.toggle(t.RowAnimationCssClasses.ANIMATION_ON, g), S.toggle(t.RowAnimationCssClasses.ANIMATION_OFF, !g); + }, f.prototype.getFloatingTopBottom = function() { + return [this.eTop, this.eBottom]; + }, l2([ + pe("resizeObserverService") + ], f.prototype, "resizeObserverService", void 0), l2([ + Ae("rangeService") + ], f.prototype, "rangeService", void 0), l2([ + qr("eBodyViewport") + ], f.prototype, "eBodyViewport", void 0), l2([ + qr("eTop") + ], f.prototype, "eTop", void 0), l2([ + qr("eBottom") + ], f.prototype, "eBottom", void 0), l2([ + qr("gridHeader") + ], f.prototype, "headerRootComp", void 0), l2([ + ct + ], f.prototype, "init", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Ure = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), oR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, GH = ( + /** @class */ + function(M) { + Ure(f, M); + function f() { + return M !== null && M.apply(this, arguments) || this; + } + return f.prototype.postConstruct = function() { + this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onDisplayedColumnsWidthChanged.bind(this)); + }, f.prototype.onDisplayedColumnsChanged = function() { + this.update(); + }, f.prototype.onDisplayedColumnsWidthChanged = function() { + this.update(); + }, f.prototype.update = function() { + this.updateImpl(), setTimeout(this.updateImpl.bind(this), 500); + }, f.prototype.updateImpl = function() { + var d = this.ctrlsService.getCenterRowContainerCtrl(); + if (d) { + var g = { + horizontalScrollShowing: d.isHorizontalScrollShowing(), + verticalScrollShowing: this.isVerticalScrollShowing() + }; + this.setScrollsVisible(g); + } + }, f.prototype.setScrollsVisible = function(d) { + var g = this.horizontalScrollShowing !== d.horizontalScrollShowing || this.verticalScrollShowing !== d.verticalScrollShowing; + if (g) { + this.horizontalScrollShowing = d.horizontalScrollShowing, this.verticalScrollShowing = d.verticalScrollShowing; + var S = { + type: ui.EVENT_SCROLL_VISIBILITY_CHANGED, + api: this.gridApi, + columnApi: this.columnApi + }; + this.eventService.dispatchEvent(S); + } + }, f.prototype.isHorizontalScrollShowing = function() { + return this.horizontalScrollShowing; + }, f.prototype.isVerticalScrollShowing = function() { + return this.verticalScrollShowing; + }, oR([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), oR([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), oR([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), oR([ + ct + ], f.prototype, "postConstruct", null), f = oR([ + Ne("scrollVisibleService") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $L = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), aR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, BL = ( + /** @class */ + function(M) { + $L(f, M); + function f() { + var g = M !== null && M.apply(this, arguments) || this; + return g.gridInstanceId = d.gridInstanceSequence.next(), g; + } + d = f, f.prototype.stampTopLevelGridCompWithGridInstance = function(g) { + g[d.GRID_DOM_KEY] = this.gridInstanceId; + }, f.prototype.getRenderedCellForEvent = function(g) { + return _i(this.gridOptionsWrapper, g, vo.DOM_DATA_KEY_CELL_CTRL); + }, f.prototype.isEventFromThisGrid = function(g) { + var S = this.isElementInThisGrid(g.target); + return S; + }, f.prototype.isElementInThisGrid = function(g) { + for (var S = g; S; ) { + var O = S[d.GRID_DOM_KEY]; + if (i(O)) { + var z = O === this.gridInstanceId; + return z; + } + S = S.parentElement; + } + return !1; + }, f.prototype.getCellPositionForEvent = function(g) { + var S = this.getRenderedCellForEvent(g); + return S ? S.getCellPosition() : null; + }, f.prototype.getNormalisedPosition = function(g) { + var S = this.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_NORMAL, O = g, z, te; + if (O.clientX != null || O.clientY != null ? (z = O.clientX, te = O.clientY) : (z = O.x, te = O.y), S) { + var Fe = this.ctrlsService.getGridBodyCtrl(), ze = Fe.getScrollFeature().getVScrollPosition(), ht = Fe.getScrollFeature().getHScrollPosition(); + z += ht.left, te += ze.top; + } + return { x: z, y: te }; + }; + var d; + return f.gridInstanceSequence = new Hv(), f.GRID_DOM_KEY = "__ag_grid_instance", aR([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), f = d = aR([ + Ne("mouseEventService") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var d9 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), uA = function() { + return uA = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, uA.apply(this, arguments); + }, Bf = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, p9 = ( + /** @class */ + function(M) { + d9(f, M); + function f() { + var d = M.call(this) || this; + return d.onPageDown = Nt(d.onPageDown, 100), d.onPageUp = Nt(d.onPageUp, 100), d; + } + return f.prototype.postConstruct = function() { + var d = this; + this.ctrlsService.whenReady(function(g) { + d.gridBodyCon = g.gridBodyCtrl; + }); + }, f.prototype.handlePageScrollingKey = function(d) { + var g = d.key, S = d.altKey, O = d.ctrlKey || d.metaKey, z = !!this.rangeService && d.shiftKey, te = this.mouseEventService.getCellPositionForEvent(d); + if (!te) + return !1; + var Fe = !1; + switch (g) { + case Hr.PAGE_HOME: + case Hr.PAGE_END: + !O && !S && (this.onHomeOrEndKey(g), Fe = !0); + break; + case Hr.LEFT: + case Hr.RIGHT: + case Hr.UP: + case Hr.DOWN: + O && !S && !z && (this.onCtrlUpDownLeftRight(g, te), Fe = !0); + break; + case Hr.PAGE_DOWN: + !O && !S && (this.onPageDown(te), Fe = !0); + break; + case Hr.PAGE_UP: + !O && !S && (this.onPageUp(te), Fe = !0); + break; + } + return Fe && d.preventDefault(), Fe; + }, f.prototype.navigateTo = function(d) { + var g = d.scrollIndex, S = d.scrollType, O = d.scrollColumn, z = d.focusIndex, te = d.focusColumn; + if (i(O) && !O.isPinned() && this.gridBodyCon.getScrollFeature().ensureColumnVisible(O), i(g) && this.gridBodyCon.getScrollFeature().ensureIndexVisible(g, S), this.animationFrameService.flushAllFrames(), this.focusService.setFocusedCell(z, te, null, !0), this.rangeService) { + var Fe = { rowIndex: z, rowPinned: null, column: te }; + this.rangeService.setRangeToCell(Fe); + } + }, f.prototype.onPageDown = function(d) { + var g = this.ctrlsService.getGridBodyCtrl(), S = g.getScrollFeature().getVScrollPosition(), O = this.getViewportHeight(), z = this.paginationProxy.getPixelOffset(), te = S.top + O, Fe = this.paginationProxy.getRowIndexAtPixel(te + z); + this.columnModel.isAutoRowHeightActive() ? this.navigateToNextPageWithAutoHeight(d, Fe) : this.navigateToNextPage(d, Fe); + }, f.prototype.onPageUp = function(d) { + var g = this.ctrlsService.getGridBodyCtrl(), S = g.getScrollFeature().getVScrollPosition(), O = this.paginationProxy.getPixelOffset(), z = S.top, te = this.paginationProxy.getRowIndexAtPixel(z + O); + this.columnModel.isAutoRowHeightActive() ? this.navigateToNextPageWithAutoHeight(d, te, !0) : this.navigateToNextPage(d, te, !0); + }, f.prototype.navigateToNextPage = function(d, g, S) { + S === void 0 && (S = !1); + var O, z, te = this.getViewportHeight(), Fe = this.paginationProxy.getPageFirstRow(), ze = this.paginationProxy.getPageLastRow(), ht = this.paginationProxy.getPixelOffset(), Lt = this.paginationProxy.getRow(d.rowIndex), ti = S ? ((O = Lt) === null || O === void 0 ? void 0 : O.rowHeight) - te - ht : te - ht, wi = ((z = Lt) === null || z === void 0 ? void 0 : z.rowTop) + ti, Ti = this.paginationProxy.getRowIndexAtPixel(wi + ht); + if (Ti === d.rowIndex) { + var qi = S ? -1 : 1; + g = Ti = d.rowIndex + qi; + } + var dr; + S ? (dr = "bottom", Ti < Fe && (Ti = Fe), g < Fe && (g = Fe)) : (dr = "top", Ti > ze && (Ti = ze), g > ze && (g = ze)), this.isRowTallerThanView(Ti) && (g = Ti, dr = "top"), this.navigateTo({ + scrollIndex: g, + scrollType: dr, + scrollColumn: null, + focusIndex: Ti, + focusColumn: d.column + }); + }, f.prototype.navigateToNextPageWithAutoHeight = function(d, g, S) { + var O = this; + S === void 0 && (S = !1), this.navigateTo({ + scrollIndex: g, + scrollType: S ? "bottom" : "top", + scrollColumn: null, + focusIndex: g, + focusColumn: d.column + }), setTimeout(function() { + var z = O.getNextFocusIndexForAutoHeight(d, S); + O.navigateTo({ + scrollIndex: g, + scrollType: S ? "bottom" : "top", + scrollColumn: null, + focusIndex: z, + focusColumn: d.column + }); + }, 50); + }, f.prototype.getNextFocusIndexForAutoHeight = function(d, g) { + g === void 0 && (g = !1); + for (var S, O = g ? -1 : 1, z = this.getViewportHeight(), te = this.paginationProxy.getPageLastRow(), Fe = 0, ze = d.rowIndex; ze >= 0 && ze <= te; ) { + var ht = this.paginationProxy.getRow(ze); + if (ht) { + var Lt = (S = ht.rowHeight, S ?? 0); + if (Fe + Lt > z) + break; + Fe += Lt; + } + ze += O; + } + return Math.max(0, Math.min(ze, te)); + }, f.prototype.getViewportHeight = function() { + var d = this.ctrlsService.getGridBodyCtrl(), g = d.getScrollFeature().getVScrollPosition(), S = this.gridOptionsWrapper.getScrollbarWidth(), O = g.bottom - g.top; + return this.ctrlsService.getCenterRowContainerCtrl().isHorizontalScrollShowing() && (O -= S), O; + }, f.prototype.isRowTallerThanView = function(d) { + var g = this.paginationProxy.getRow(d); + if (!g) + return !1; + var S = g.rowHeight; + return typeof S != "number" ? !1 : S > this.getViewportHeight(); + }, f.prototype.onCtrlUpDownLeftRight = function(d, g) { + var S = this.cellNavigationService.getNextCellToFocus(d, g, !0), O = S.rowIndex, z = S.column; + this.navigateTo({ + scrollIndex: O, + scrollType: null, + scrollColumn: z, + focusIndex: O, + focusColumn: z + }); + }, f.prototype.onHomeOrEndKey = function(d) { + var g = d === Hr.PAGE_HOME, S = this.columnModel.getAllDisplayedColumns(), O = g ? S[0] : m(S), z = g ? this.paginationProxy.getPageFirstRow() : this.paginationProxy.getPageLastRow(); + this.navigateTo({ + scrollIndex: z, + scrollType: null, + scrollColumn: O, + focusIndex: z, + focusColumn: O + }); + }, f.prototype.onTabKeyDown = function(d, g) { + var S = g.shiftKey, O = this.tabToNextCellCommon(d, S, g); + if (O) { + g.preventDefault(); + return; + } + if (S) { + var z = d.getRowPosition(), te = z.rowIndex, Fe = z.rowPinned, ze = Fe ? te === 0 : te === this.paginationProxy.getPageFirstRow(); + ze && (g.preventDefault(), this.focusService.focusLastHeader(g)); + } else + d instanceof vo && d.focusCell(!0), this.focusService.focusNextGridCoreContainer(S) && g.preventDefault(); + }, f.prototype.tabToNextCell = function(d, g) { + var S = this.focusService.getFocusedCell(); + if (!S) + return !1; + var O = this.getCellByPosition(S); + return !O && (O = this.rowRenderer.getRowByPosition(S), !O || !O.isFullWidth()) ? !1 : this.tabToNextCellCommon(O, d, g); + }, f.prototype.tabToNextCellCommon = function(d, g, S) { + var O = d.isEditing(); + if (!O && d instanceof vo) { + var z = d, te = z.getRowCtrl(); + te && (O = te.isEditing()); + } + var Fe; + return O ? this.gridOptionsWrapper.isFullRowEdit() ? Fe = this.moveToNextEditingRow(d, g, S) : Fe = this.moveToNextEditingCell(d, g, S) : Fe = this.moveToNextCellNotEditing(d, g), Fe || !!this.focusService.getFocusedHeader(); + }, f.prototype.moveToNextEditingCell = function(d, g, S) { + S === void 0 && (S = null); + var O = d.getCellPosition(); + d.stopEditing(); + var z = this.findNextCellToFocusOn(O, g, !0); + return z == null ? !1 : (z.startEditing(null, null, !0, S), z.focusCell(!1), !0); + }, f.prototype.moveToNextEditingRow = function(d, g, S) { + S === void 0 && (S = null); + var O = d.getCellPosition(), z = this.findNextCellToFocusOn(O, g, !0); + if (z == null) + return !1; + var te = z.getCellPosition(), Fe = this.isCellEditable(O), ze = this.isCellEditable(te), ht = te && O.rowIndex === te.rowIndex && O.rowPinned === te.rowPinned; + if (Fe && d.setFocusOutOnEditor(), !ht) { + var Lt = d.getRowCtrl(); + Lt.stopEditing(); + var ti = z.getRowCtrl(); + ti.startRowEditing(void 0, void 0, void 0, S); + } + return ze ? (z.setFocusInOnEditor(), z.focusCell()) : z.focusCell(!0), !0; + }, f.prototype.moveToNextCellNotEditing = function(d, g) { + var S = this.columnModel.getAllDisplayedColumns(), O; + d instanceof Jb ? O = uA(uA({}, d.getRowPosition()), { column: g ? S[0] : m(S) }) : O = d.getCellPosition(); + var z = this.findNextCellToFocusOn(O, g, !1); + if (z instanceof vo) + z.focusCell(!0); + else if (z) + return this.tryToFocusFullWidthRow(z.getRowPosition(), g); + return i(z); + }, f.prototype.findNextCellToFocusOn = function(d, g, S) { + for (var O = d; ; ) { + d !== O && (d = O), g || (O = this.getLastCellOfColSpan(O)), O = this.cellNavigationService.getNextTabbedCell(O, g); + var z = this.gridOptionsWrapper.getTabToNextCellFunc(); + if (i(z)) { + var te = { + backwards: g, + editing: S, + previousCellPosition: d, + nextCellPosition: O || null + }, Fe = z(te); + i(Fe) ? (Fe.floating && (Ge(function() { + console.warn("AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?"); + }, "no floating in userCell"), Fe.rowPinned = Fe.floating), O = { + rowIndex: Fe.rowIndex, + column: Fe.column, + rowPinned: Fe.rowPinned + }) : O = null; + } + if (!O) + return null; + if (O.rowIndex < 0) { + var ze = this.headerNavigationService.getHeaderRowCount(); + return this.focusService.focusHeaderPosition({ + headerPosition: { + headerRowIndex: ze + O.rowIndex, + column: O.column + } + }), null; + } + var ht = this.gridOptionsWrapper.isFullRowEdit(); + if (S && !ht) { + var Lt = this.isCellEditable(O); + if (!Lt) + continue; + } + this.ensureCellVisible(O); + var ti = this.getCellByPosition(O); + if (!ti) { + var wi = this.rowRenderer.getRowByPosition(O); + if (!wi || !wi.isFullWidth()) + continue; + return wi; + } + if (!ti.isSuppressNavigable()) + return this.rangeService && this.rangeService.setRangeToCell(O), ti; + } + }, f.prototype.isCellEditable = function(d) { + var g = this.lookupRowNodeForCell(d); + return g ? d.column.isCellEditable(g) : !1; + }, f.prototype.getCellByPosition = function(d) { + var g = this.rowRenderer.getRowByPosition(d); + return g ? g.getCellCtrl(d.column) : null; + }, f.prototype.lookupRowNodeForCell = function(d) { + return d.rowPinned === Ue.PINNED_TOP ? this.pinnedRowModel.getPinnedTopRow(d.rowIndex) : d.rowPinned === Ue.PINNED_BOTTOM ? this.pinnedRowModel.getPinnedBottomRow(d.rowIndex) : this.paginationProxy.getRow(d.rowIndex); + }, f.prototype.navigateToNextCell = function(d, g, S, O) { + for (var z = S, te = !1; z && (z === S || !this.isValidNavigateCell(z)); ) + this.gridOptionsWrapper.isEnableRtl() ? g === Hr.LEFT && (z = this.getLastCellOfColSpan(z)) : g === Hr.RIGHT && (z = this.getLastCellOfColSpan(z)), z = this.cellNavigationService.getNextCellToFocus(g, z), te = r(z); + if (te && d && d.key === Hr.UP && (z = { + rowIndex: -1, + rowPinned: null, + column: S.column + }), O) { + var Fe = this.gridOptionsWrapper.getNavigateToNextCellFunc(); + if (i(Fe)) { + var ze = { + key: g, + previousCellPosition: S, + nextCellPosition: z || null, + event: d + }, ht = Fe(ze); + i(ht) ? (ht.floating && (Ge(function() { + console.warn("AG Grid: tabToNextCellFunc return type should have attributes: rowIndex, rowPinned, column. However you had 'floating', maybe you meant 'rowPinned'?"); + }, "no floating in userCell"), ht.rowPinned = ht.floating), z = { + rowPinned: ht.rowPinned, + rowIndex: ht.rowIndex, + column: ht.column + }) : z = null; + } + } + if (z) { + if (z.rowIndex < 0) { + var Lt = this.headerNavigationService.getHeaderRowCount(); + this.focusService.focusHeaderPosition({ + headerPosition: { headerRowIndex: Lt + z.rowIndex, column: S.column }, + event: d || void 0 + }); + return; + } + var ti = this.getNormalisedPosition(z); + ti ? this.focusPosition(ti) : this.tryToFocusFullWidthRow(z); + } + }, f.prototype.getNormalisedPosition = function(d) { + this.ensureCellVisible(d); + var g = this.getCellByPosition(d); + return g ? (d = g.getCellPosition(), this.ensureCellVisible(d), d) : null; + }, f.prototype.tryToFocusFullWidthRow = function(d, g) { + g === void 0 && (g = !1); + var S = this.columnModel.getAllDisplayedColumns(), O = this.rowRenderer.getRowByPosition(d); + if (!O || !O.isFullWidth()) + return !1; + var z = this.focusService.getFocusedCell(), te = { + rowIndex: d.rowIndex, + rowPinned: d.rowPinned, + column: d.column || (g ? m(S) : S[0]) + }; + this.focusPosition(te); + var Fe = z != null ? this.rowPositionUtils.before(te, z) : !1, ze = { + type: ui.EVENT_FULL_WIDTH_ROW_FOCUSED, + api: this.gridApi, + columnApi: this.columnApi, + rowIndex: te.rowIndex, + rowPinned: te.rowPinned, + column: te.column, + isFullWidthCell: !0, + floating: te.rowPinned, + fromBelow: Fe + }; + return this.eventService.dispatchEvent(ze), !0; + }, f.prototype.focusPosition = function(d) { + this.focusService.setFocusedCell(d.rowIndex, d.column, d.rowPinned, !0), this.rangeService && this.rangeService.setRangeToCell(d); + }, f.prototype.isValidNavigateCell = function(d) { + var g = this.rowPositionUtils.getRowNode(d); + return !!g; + }, f.prototype.getLastCellOfColSpan = function(d) { + var g = this.getCellByPosition(d); + if (!g) + return d; + var S = g.getColSpanningList(); + return S.length === 1 ? d : { + rowIndex: d.rowIndex, + column: m(S), + rowPinned: d.rowPinned + }; + }, f.prototype.ensureCellVisible = function(d) { + r(d.rowPinned) && this.gridBodyCon.getScrollFeature().ensureIndexVisible(d.rowIndex), d.column.isPinned() || this.gridBodyCon.getScrollFeature().ensureColumnVisible(d.column), this.gridBodyCon.getScrollFeature().horizontallyScrollHeaderCenterAndFloatingCenter(), this.animationFrameService.flushAllFrames(); + }, Bf([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), Bf([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), Bf([ + pe("mouseEventService") + ], f.prototype, "mouseEventService", void 0), Bf([ + pe("paginationProxy") + ], f.prototype, "paginationProxy", void 0), Bf([ + pe("focusService") + ], f.prototype, "focusService", void 0), Bf([ + pe("animationFrameService") + ], f.prototype, "animationFrameService", void 0), Bf([ + Ae("rangeService") + ], f.prototype, "rangeService", void 0), Bf([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Bf([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Bf([ + pe("rowRenderer") + ], f.prototype, "rowRenderer", void 0), Bf([ + pe("headerNavigationService") + ], f.prototype, "headerNavigationService", void 0), Bf([ + pe("rowPositionUtils") + ], f.prototype, "rowPositionUtils", void 0), Bf([ + pe("cellNavigationService") + ], f.prototype, "cellNavigationService", void 0), Bf([ + pe("pinnedRowModel") + ], f.prototype, "pinnedRowModel", void 0), Bf([ + ct + ], f.prototype, "postConstruct", null), f = Bf([ + Ne("navigationService") + ], f), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var zre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Hre = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, f9 = ( + /** @class */ + function(M) { + zre(f, M); + function f(d) { + var g = M.call( + this, + /* html */ + '
' + ) || this; + return g.params = d, g; + } + return f.prototype.postConstruct = function() { + this.gridOptionsWrapper.setDomData(this.getGui(), f.DOM_KEY_POPUP_EDITOR_WRAPPER, !0), this.addKeyDownListener(); + }, f.prototype.addKeyDownListener = function() { + var d = this, g = this.getGui(), S = this.params, O = function(z) { + Hg(d.gridOptionsWrapper, z, S.node, S.column, !0) || S.onKeyDown(z); + }; + this.addManagedListener(g, "keydown", O); + }, f.DOM_KEY_POPUP_EDITOR_WRAPPER = "popupEditorWrapper", Hre([ + ct + ], f.prototype, "postConstruct", null), f; + }(Zx) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var x_e = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), m9 = ( + /** @class */ + function(M) { + x_e(f, M); + function f(d, g, S, O, z) { + var te = M.call(this) || this; + te.rendererVersion = 0, te.editorVersion = 0, te.beans = d, te.column = g.getColumn(), te.rowNode = g.getRowNode(), te.rowCtrl = g.getRowCtrl(), te.eRow = O, te.setTemplate( + /* html */ + '
' + ); + var Fe = te.getGui(); + te.forceWrapper = g.isForceWrapper(), te.refreshWrapper(!1); + var ze = function(Lt, ti, wi) { + var Ti = wi || Fe; + ti != null && ti != "" ? Ti.setAttribute(Lt, ti) : Ti.removeAttribute(Lt); + }, ht = { + addOrRemoveCssClass: function(Lt, ti) { + return te.addOrRemoveCssClass(Lt, ti); + }, + setUserStyles: function(Lt) { + return df(Fe, Lt); + }, + getFocusableElement: function() { + return te.getFocusableElement(); + }, + setTabIndex: function(Lt) { + return ze("tabindex", Lt.toString()); + }, + setRole: function(Lt) { + return tr(Fe, Lt); + }, + setColId: function(Lt) { + return ze("col-id", Lt); + }, + setTitle: function(Lt) { + return ze("title", Lt); + }, + setIncludeSelection: function(Lt) { + return te.includeSelection = Lt; + }, + setIncludeRowDrag: function(Lt) { + return te.includeRowDrag = Lt; + }, + setIncludeDndSource: function(Lt) { + return te.includeDndSource = Lt; + }, + setRenderDetails: function(Lt, ti, wi) { + return te.setRenderDetails(Lt, ti, wi); + }, + setEditDetails: function(Lt, ti, wi) { + return te.setEditDetails(Lt, ti, wi); + }, + getCellEditor: function() { + return te.cellEditor || null; + }, + getCellRenderer: function() { + return te.cellRenderer || null; + }, + getParentOfValue: function() { + return te.getParentOfValue(); + } + }; + return te.cellCtrl = g, g.setComp(ht, te.getGui(), te.eCellWrapper, S, z), te; + } + return f.prototype.getParentOfValue = function() { + return this.eCellValue ? this.eCellValue : this.eCellWrapper ? this.eCellWrapper : this.getGui(); + }, f.prototype.setRenderDetails = function(d, g, S) { + var O = this.cellEditor && !this.cellEditorPopupWrapper; + if (!O) { + this.firstRender = this.firstRender == null; + var z = this.refreshWrapper(!1); + if (d) { + var te = S || z, Fe = te ? !1 : this.refreshCellRenderer(d); + Fe || (this.destroyRenderer(), this.createCellRendererInstance(d)); + } else + this.destroyRenderer(), this.insertValueWithoutCellRenderer(g); + } + }, f.prototype.setEditDetails = function(d, g, S) { + d ? this.createCellEditorInstance(d, g, S) : this.destroyEditor(); + }, f.prototype.removeControls = function() { + this.checkboxSelectionComp = this.beans.context.destroyBean(this.checkboxSelectionComp), this.dndSourceComp = this.beans.context.destroyBean(this.dndSourceComp), this.rowDraggingComp = this.beans.context.destroyBean(this.rowDraggingComp); + }, f.prototype.refreshWrapper = function(d) { + var g = this.includeRowDrag || this.includeDndSource || this.includeSelection, S = g || this.forceWrapper, O = S && this.eCellWrapper == null; + O && (this.eCellWrapper = gu(''), this.getGui().appendChild(this.eCellWrapper)); + var z = !S && this.eCellWrapper != null; + z && (Vc(this.eCellWrapper), this.eCellWrapper = void 0), this.addOrRemoveCssClass("ag-cell-value", !S); + var te = !d && S, Fe = te && this.eCellValue == null; + Fe && (this.eCellValue = gu(''), this.eCellWrapper.appendChild(this.eCellValue)); + var ze = !te && this.eCellValue != null; + ze && (Vc(this.eCellValue), this.eCellValue = void 0); + var ht = O || z || Fe || ze; + return ht && this.removeControls(), !d && g && this.addControls(), ht; + }, f.prototype.addControls = function() { + var d = this.eCellValue.id = "cell-" + this.getCompId(), g = []; + this.includeRowDrag && this.rowDraggingComp == null && (this.rowDraggingComp = this.cellCtrl.createRowDragComp(), this.rowDraggingComp && this.eCellWrapper.insertBefore(this.rowDraggingComp.getGui(), this.eCellValue)), this.includeDndSource && this.dndSourceComp == null && (this.dndSourceComp = this.cellCtrl.createDndSource(), this.eCellWrapper.insertBefore(this.dndSourceComp.getGui(), this.eCellValue)), this.includeSelection && (this.checkboxSelectionComp == null && (this.checkboxSelectionComp = this.cellCtrl.createSelectionCheckbox(), this.eCellWrapper.insertBefore(this.checkboxSelectionComp.getGui(), this.eCellValue)), g.push(this.checkboxSelectionComp.getCheckboxId())), g.push(d), Wa(this.getGui(), g.join(" ")); + }, f.prototype.createCellEditorInstance = function(d, g, S) { + var O = this, z = this.editorVersion, te = d.newAgStackInstance(); + if (te) { + var Fe = d.params; + te.then(function(ht) { + return O.afterCellEditorCreated(z, ht, Fe, g, S); + }); + var ze = r(this.cellEditor); + ze && Fe.cellStartedEdit && this.cellCtrl.focusCell(!0); + } + }, f.prototype.insertValueWithoutCellRenderer = function(d) { + var g = this.getParentOfValue(); + Su(g); + var S = d != null ? _t(d) : null; + S != null && (g.innerHTML = S); + }, f.prototype.destroyEditorAndRenderer = function() { + this.destroyRenderer(), this.destroyEditor(); + }, f.prototype.destroyRenderer = function() { + var d = this.beans.context; + this.cellRenderer = d.destroyBean(this.cellRenderer), Vc(this.cellRendererGui), this.cellRendererGui = null, this.rendererVersion++; + }, f.prototype.destroyEditor = function() { + var d = this.beans.context; + this.hideEditorPopup && this.hideEditorPopup(), this.hideEditorPopup = void 0, this.cellEditor = d.destroyBean(this.cellEditor), this.cellEditorPopupWrapper = d.destroyBean(this.cellEditorPopupWrapper), Vc(this.cellEditorGui), this.cellEditorGui = null, this.editorVersion++; + }, f.prototype.refreshCellRenderer = function(d) { + if (this.cellRenderer == null || this.cellRenderer.refresh == null || this.cellRendererClass !== d.componentClass) + return !1; + var g = this.cellRenderer.refresh(d.params); + return g === !0 || g === void 0; + }, f.prototype.createCellRendererInstance = function(d) { + var g = this, S = this.beans.gridOptionsWrapper.isAngularCompileRows(), O = this.beans.gridOptionsWrapper.isSuppressAnimationFrame(), z = !S && !O, te = this.rendererVersion, Fe = d.componentClass, ze = function() { + var ht = g.rendererVersion !== te || !g.isAlive(); + if (!ht) { + var Lt = d.newAgStackInstance(), ti = g.afterCellRendererCreated.bind(g, te, Fe); + Lt && Lt.then(ti); + } + }; + z && this.firstRender ? this.beans.animationFrameService.createTask(ze, this.rowNode.rowIndex, "createTasksP2") : ze(); + }, f.prototype.getCtrl = function() { + return this.cellCtrl; + }, f.prototype.getRowCtrl = function() { + return this.rowCtrl; + }, f.prototype.getCellRenderer = function() { + return this.cellRenderer; + }, f.prototype.getCellEditor = function() { + return this.cellEditor; + }, f.prototype.afterCellRendererCreated = function(d, g, S) { + var O = !this.isAlive() || d !== this.rendererVersion; + if (O) { + this.beans.context.destroyBean(S); + return; + } + if (this.cellRenderer = S, this.cellRendererClass = g, this.cellRendererGui = this.cellRenderer.getGui(), this.cellRendererGui != null) { + var z = this.getParentOfValue(); + Su(z), z.appendChild(this.cellRendererGui); + } + }, f.prototype.afterCellEditorCreated = function(d, g, S, O, z) { + var te = d !== this.editorVersion; + if (te) { + this.beans.context.destroyBean(g); + return; + } + var Fe = g.isCancelBeforeStart && g.isCancelBeforeStart(); + if (Fe) { + this.beans.context.destroyBean(g), this.cellCtrl.stopEditing(); + return; + } + if (!g.getGui) { + console.warn("AG Grid: cellEditor for column " + this.column.getId() + " is missing getGui() method"), this.beans.context.destroyBean(g); + return; + } + this.cellEditor = g, this.cellEditorGui = g.getGui(); + var ze = O || g.isPopup !== void 0 && g.isPopup(); + ze ? (O || this.cellCtrl.hackSayEditingInPopup(), this.addPopupCellEditor(S, z)) : this.addInCellEditor(), g.afterGuiAttached && g.afterGuiAttached(); + }, f.prototype.addInCellEditor = function() { + var d = this.getGui(), g = this.beans.gridOptionsWrapper.getDocument(); + if (d.contains(g.activeElement) && d.focus(), this.destroyRenderer(), this.refreshWrapper(!0), this.clearParentOfValue(), this.cellEditorGui) { + var S = this.getParentOfValue(); + S.appendChild(this.cellEditorGui); + } + }, f.prototype.addPopupCellEditor = function(d, g) { + var S = this; + this.beans.gridOptionsWrapper.isFullRowEdit() && console.warn("AG Grid: popup cellEditor does not work with fullRowEdit - you cannot use them both - either turn off fullRowEdit, or stop using popup editors."); + var O = this.cellEditor; + this.cellEditorPopupWrapper = this.beans.context.createBean(new f9(d)); + var z = this.cellEditorPopupWrapper.getGui(); + this.cellEditorGui && z.appendChild(this.cellEditorGui); + var te = this.beans.popupService, Fe = this.beans.gridOptionsWrapper.isStopEditingWhenCellsLoseFocus(), ze = g ?? (O.getPopupPosition ? O.getPopupPosition() : "over"), ht = { + column: this.column, + rowNode: this.rowNode, + type: "popupCellEditor", + eventSource: this.getGui(), + ePopup: z, + keepWithinBounds: !0 + }, Lt = ze === "under" ? te.positionPopupUnderComponent.bind(te, ht) : te.positionPopupOverComponent.bind(te, ht), ti = this.beans.gridOptionsWrapper.getLocaleTextFunc(), wi = te.addPopup({ + modal: Fe, + eChild: z, + closeOnEsc: !0, + closedCallback: function() { + S.cellCtrl.onPopupEditorClosed(); + }, + anchorToElement: this.getGui(), + positionCallback: Lt, + ariaLabel: ti("ariaLabelCellEditor", "Cell Editor") + }); + wi && (this.hideEditorPopup = wi.hideFunc); + }, f.prototype.detach = function() { + this.eRow.removeChild(this.getGui()); + }, f.prototype.destroy = function() { + this.cellCtrl.stopEditing(), this.destroyEditorAndRenderer(), this.removeControls(), M.prototype.destroy.call(this); + }, f.prototype.clearParentOfValue = function() { + var d = this.getGui(), g = this.beans.gridOptionsWrapper.getDocument(); + d.contains(g.activeElement) && d.focus({ + preventScroll: !0 + }), Su(this.getParentOfValue()); + }, f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Wre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), qre = ( + /** @class */ + function(M) { + Wre(f, M); + function f(d, g, S) { + var O = M.call(this) || this; + O.cellComps = {}, O.beans = g, O.rowCtrl = d, O.setTemplate( + /* html */ + '
' + ); + var z = O.getGui(), te = z.style, Fe = { + setDomOrder: function(ze) { + return O.domOrder = ze; + }, + setCellCtrls: function(ze) { + return O.setCellCtrls(ze); + }, + showFullWidth: function(ze) { + return O.showFullWidth(ze); + }, + getFullWidthCellRenderer: function() { + return O.getFullWidthCellRenderer(); + }, + addOrRemoveCssClass: function(ze, ht) { + return O.addOrRemoveCssClass(ze, ht); + }, + setUserStyles: function(ze) { + return df(z, ze); + }, + setTop: function(ze) { + return te.top = ze; + }, + setTransform: function(ze) { + return te.transform = ze; + }, + setRowIndex: function(ze) { + return z.setAttribute("row-index", ze); + }, + setRole: function(ze) { + return tr(z, ze); + }, + setRowId: function(ze) { + return z.setAttribute("row-id", ze); + }, + setRowBusinessKey: function(ze) { + return z.setAttribute("row-business-key", ze); + }, + setTabIndex: function(ze) { + return z.setAttribute("tabindex", ze.toString()); + } + }; + return d.setComp(Fe, O.getGui(), S), O; + } + return f.prototype.getInitialStyle = function() { + var d = this.rowCtrl.getInitialTransform(), g = this.rowCtrl.getInitialRowTop(); + return d ? "transform: " + d : "top: " + g; + }, f.prototype.showFullWidth = function(d) { + var g = this, S = function(z) { + if (g.isAlive()) { + var te = z.getGui(); + g.getGui().appendChild(te), g.rowCtrl.setupDetailRowAutoHeight(te), g.setFullWidthRowComp(z); + } else + g.beans.context.destroyBean(z); + }, O = d.newAgStackInstance(); + O && O.then(S); + }, f.prototype.setCellCtrls = function(d) { + var g = this, S = Object.assign({}, this.cellComps); + d.forEach(function(z) { + var te = z.getInstanceId(), Fe = g.cellComps[te]; + Fe == null ? g.newCellComp(z) : S[te] = null; + }); + var O = re(S).filter(function(z) { + return z != null; + }); + this.destroyCells(O), this.ensureDomOrder(d); + }, f.prototype.ensureDomOrder = function(d) { + var g = this; + if (this.domOrder) { + var S = []; + d.forEach(function(O) { + var z = g.cellComps[O.getInstanceId()]; + z && S.push(z.getGui()); + }), _c(this.getGui(), S); + } + }, f.prototype.newCellComp = function(d) { + var g = new m9(this.beans, d, this.rowCtrl.isPrintLayout(), this.getGui(), this.rowCtrl.isEditing()); + this.cellComps[d.getInstanceId()] = g, this.getGui().appendChild(g.getGui()); + }, f.prototype.destroy = function() { + M.prototype.destroy.call(this), this.destroyAllCells(); + }, f.prototype.destroyAllCells = function() { + var d = re(this.cellComps).filter(function(g) { + return g != null; + }); + this.destroyCells(d); + }, f.prototype.setFullWidthRowComp = function(d) { + var g = this; + this.fullWidthCellRenderer && console.error("AG Grid - should not be setting fullWidthRowComponent twice"), this.fullWidthCellRenderer = d, this.addDestroyFunc(function() { + g.fullWidthCellRenderer = g.beans.context.destroyBean(g.fullWidthCellRenderer); + }); + }, f.prototype.getFullWidthCellRenderer = function() { + return this.fullWidthCellRenderer; + }, f.prototype.destroyCells = function(d) { + var g = this; + d.forEach(function(S) { + if (S) { + var O = S.getCtrl().getInstanceId(); + g.cellComps[O] === S && (S.detach(), S.destroy(), g.cellComps[O] = null); + } + }); + }, f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var jC = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), k1 = function() { + return k1 = Object.assign || function(M) { + for (var f, d = 1, g = arguments.length; d < g; d++) { + f = arguments[d]; + for (var S in f) + Object.prototype.hasOwnProperty.call(f, S) && (M[S] = f[S]); + } + return M; + }, k1.apply(this, arguments); + }, Y0 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }; + function UH() { + var M = ba.elementGettingCreated.getAttribute("name"), f = sR.getRowContainerCssClasses(M), d, g = M === t.RowContainerName.CENTER, S = M === t.RowContainerName.TOP_CENTER || M === t.RowContainerName.BOTTOM_CENTER; + return g ? d = /* html */ + '` : S ? d = /* html */ + '` : d = /* html */ + '
', d; + } + var VL = ( + /** @class */ + function(M) { + jC(f, M); + function f() { + var d = M.call(this, UH()) || this; + return d.rowComps = {}, d.name = ba.elementGettingCreated.getAttribute("name"), d.type = u9(d.name), d; + } + return f.prototype.postConstruct = function() { + var d = this, g = { + setViewportHeight: function(O) { + return d.eViewport.style.height = O; + }, + setRowCtrls: function(O) { + return d.setRowCtrls(O); + }, + setDomOrder: function(O) { + d.domOrder = O; + }, + setContainerWidth: function(O) { + return d.eContainer.style.width = O; + } + }, S = this.createManagedBean(new sR(this.name)); + S.setComp(g, this.eContainer, this.eViewport, this.eWrapper); + }, f.prototype.preDestroy = function() { + this.setRowCtrls([]); + }, f.prototype.setRowCtrls = function(d) { + var g = this, S = k1({}, this.rowComps); + this.rowComps = {}, this.lastPlacedElement = null; + var O = function(z) { + var te = z.getInstanceId(), Fe = S[te]; + if (Fe) + g.rowComps[te] = Fe, delete S[te], g.ensureDomOrder(Fe.getGui()); + else { + var ze = g.newRowComp(z); + g.rowComps[te] = ze, g.appendRow(ze.getGui()); + } + }; + d.forEach(O), re(S).forEach(function(z) { + g.eContainer.removeChild(z.getGui()), z.destroy(); + }), tr(this.eContainer, d.length ? "rowgroup" : "presentation"); + }, f.prototype.appendRow = function(d) { + this.domOrder ? Am(this.eContainer, d, this.lastPlacedElement) : this.eContainer.appendChild(d), this.lastPlacedElement = d; + }, f.prototype.ensureDomOrder = function(d) { + this.domOrder && ($l(this.eContainer, d, this.lastPlacedElement), this.lastPlacedElement = d); + }, f.prototype.newRowComp = function(d) { + sR.getPinned(this.name); + var g = new qre(d, this.beans, this.type); + return g; + }, Y0([ + pe("beans") + ], f.prototype, "beans", void 0), Y0([ + qr("eViewport") + ], f.prototype, "eViewport", void 0), Y0([ + qr("eContainer") + ], f.prototype, "eContainer", void 0), Y0([ + qr("eWrapper") + ], f.prototype, "eWrapper", void 0), Y0([ + ct + ], f.prototype, "postConstruct", null), Y0([ + gt + ], f.prototype, "preDestroy", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var zH = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, HH = ( + /** @class */ + function() { + function M(f) { + this.columnsToAggregate = [], this.columnsToGroup = [], this.columnsToPivot = [], this.pinned = f; + } + return M.prototype.onDragEnter = function(f) { + var d = this; + if (this.clearColumnsList(), !this.gridOptionsWrapper.isFunctionsReadOnly()) { + var g = f.dragItem.columns; + g && g.forEach(function(S) { + S.isPrimary() && (S.isAnyFunctionActive() || (S.isAllowValue() ? d.columnsToAggregate.push(S) : S.isAllowRowGroup() ? d.columnsToGroup.push(S) : S.isAllowPivot() && d.columnsToPivot.push(S))); + }); + } + }, M.prototype.getIconName = function() { + var f = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length; + return f > 0 ? this.pinned ? fg.ICON_PINNED : fg.ICON_MOVE : null; + }, M.prototype.onDragLeave = function(f) { + this.clearColumnsList(); + }, M.prototype.clearColumnsList = function() { + this.columnsToAggregate.length = 0, this.columnsToGroup.length = 0, this.columnsToPivot.length = 0; + }, M.prototype.onDragging = function(f) { + }, M.prototype.onDragStop = function(f) { + this.columnsToAggregate.length > 0 && this.columnModel.addValueColumns(this.columnsToAggregate, "toolPanelDragAndDrop"), this.columnsToGroup.length > 0 && this.columnModel.addRowGroupColumns(this.columnsToGroup, "toolPanelDragAndDrop"), this.columnsToPivot.length > 0 && this.columnModel.addPivotColumns(this.columnsToPivot, "toolPanelDragAndDrop"); + }, zH([ + pe("columnModel") + ], M.prototype, "columnModel", void 0), zH([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var cA = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, WH = ( + /** @class */ + function() { + function M(f, d) { + this.needToMoveLeft = !1, this.needToMoveRight = !1, this.pinned = f, this.eContainer = d, this.centerContainer = !i(f); + } + return M.prototype.init = function() { + var f = this; + this.ctrlsService.whenReady(function() { + f.gridBodyCon = f.ctrlsService.getGridBodyCtrl(); + }); + }, M.prototype.getIconName = function() { + return this.pinned ? fg.ICON_PINNED : fg.ICON_MOVE; + }, M.prototype.onDragEnter = function(f) { + var d = f.dragItem.columns, g = f.dragSource.type === t.DragSourceType.ToolPanel; + if (g) + this.setColumnsVisible(d, !0, "uiColumnDragged"); + else { + var S = f.dragItem.visibleState, O = (d || []).filter(function(z) { + return S[z.getId()]; + }); + this.setColumnsVisible(O, !0, "uiColumnDragged"); + } + this.setColumnsPinned(d, this.pinned, "uiColumnDragged"), this.onDragging(f, !0); + }, M.prototype.onDragLeave = function(f) { + var d = !this.gridOptionsWrapper.isSuppressDragLeaveHidesColumns() && !f.fromNudge; + if (d) { + var g = f.dragSource.getDragItem(), S = g.columns; + this.setColumnsVisible(S, !1, "uiColumnDragged"); + } + this.ensureIntervalCleared(); + }, M.prototype.setColumnsVisible = function(f, d, g) { + if (g === void 0 && (g = "api"), f) { + var S = f.filter(function(O) { + return !O.getColDef().lockVisible; + }); + this.columnModel.setColumnsVisible(S, d, g); + } + }, M.prototype.setColumnsPinned = function(f, d, g) { + if (g === void 0 && (g = "api"), f) { + var S = f.filter(function(O) { + return !O.getColDef().lockPinned; + }); + this.columnModel.setColumnsPinned(S, d, g); + } + }, M.prototype.onDragStop = function() { + this.ensureIntervalCleared(); + }, M.prototype.normaliseX = function(f) { + if (this.gridOptionsWrapper.isEnableRtl()) { + var d = this.eContainer.clientWidth; + f = d - f; + } + return this.centerContainer && (f += this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft()), f; + }, M.prototype.checkCenterForScrolling = function(f) { + if (this.centerContainer) { + var d = this.ctrlsService.getCenterRowContainerCtrl().getCenterViewportScrollLeft(), g = d + this.ctrlsService.getCenterRowContainerCtrl().getCenterWidth(); + this.gridOptionsWrapper.isEnableRtl() ? (this.needToMoveRight = f < d + 50, this.needToMoveLeft = f > g - 50) : (this.needToMoveLeft = f < d + 50, this.needToMoveRight = f > g - 50), this.needToMoveLeft || this.needToMoveRight ? this.ensureIntervalStarted() : this.ensureIntervalCleared(); + } + }, M.prototype.onDragging = function(f, d) { + var g = this; + if (d === void 0 && (d = !1), this.lastDraggingEvent = f, !r(f.hDirection)) { + var S = this.normaliseX(f.x); + d || this.checkCenterForScrolling(S); + var O = this.normaliseDirection(f.hDirection), z = f.dragSource.type, te = f.dragSource.getDragItem().columns; + te = te.filter(function(Fe) { + return Fe.getColDef().lockPinned ? Fe.getPinned() == g.pinned : !0; + }), this.attemptMoveColumns(z, te, O, S, d); + } + }, M.prototype.normaliseDirection = function(f) { + if (this.gridOptionsWrapper.isEnableRtl()) + switch (f) { + case t.HorizontalDirection.Left: + return t.HorizontalDirection.Right; + case t.HorizontalDirection.Right: + return t.HorizontalDirection.Left; + default: + console.error("AG Grid: Unknown direction " + f); + } + else + return f; + }, M.prototype.calculateOldIndex = function(f) { + var d = this.columnModel.getAllGridColumns(), g = L(f.map(function(Fe) { + return d.indexOf(Fe); + })), S = g[0], O = m(g), z = O - S, te = z !== g.length - 1; + return te ? null : S; + }, M.prototype.attemptMoveColumns = function(f, d, g, S, O) { + var z = g === t.HorizontalDirection.Left, te = g === t.HorizontalDirection.Right, Fe = d.slice(); + this.columnModel.sortColumnsLikeGridColumns(Fe); + var ze = this.calculateValidMoves(Fe, te, S), ht = this.calculateOldIndex(Fe); + if (ze.length !== 0) { + var Lt = ze[0], ti = ht !== null && !O; + if (f == t.DragSourceType.HeaderCell && (ti = ht !== null), !(ti && (z && Lt >= ht || te && Lt <= ht))) + for (var wi = 0; wi < ze.length; wi++) { + var Ti = ze[wi]; + if (this.columnModel.doesMovePassRules(Fe, Ti)) { + this.columnModel.moveColumns(Fe, Ti, "uiColumnDragged"); + return; + } + } + } + }, M.prototype.calculateValidMoves = function(f, d, g) { + var S = this.gridOptionsWrapper.isSuppressMovableColumns() || f.some(function(Xa) { + return Xa.getColDef().suppressMovable; + }); + if (S) + return []; + var O = this.columnModel.getDisplayedColumns(this.pinned), z = this.columnModel.getAllGridColumns(), te = O.filter(function(Xa) { + return Ce(f, Xa); + }), Fe = O.filter(function(Xa) { + return !Ce(f, Xa); + }), ze = z.filter(function(Xa) { + return !Ce(f, Xa); + }), ht = 0, Lt = g; + if (d) { + var ti = 0; + te.forEach(function(Xa) { + return ti += Xa.getActualWidth(); + }), Lt -= ti; + } + if (Lt > 0) { + for (var wi = 0; wi < Fe.length; wi++) { + var Ti = Fe[wi]; + if (Lt -= Ti.getActualWidth(), Lt < 0) + break; + ht++; + } + d && ht++; + } + var qi; + if (ht > 0) { + var dr = Fe[ht - 1]; + qi = ze.indexOf(dr) + 1; + } else + qi = ze.indexOf(Fe[0]), qi === -1 && (qi = 0); + var kr = [qi], Rr = function(Xa, po) { + return Xa - po; + }; + if (d) { + for (var Vr = qi + 1, An = z.length - 1; Vr <= An; ) + kr.push(Vr), Vr++; + kr.sort(Rr); + } else { + for (var Vr = qi, An = z.length - 1, Js = z[Vr]; Vr <= An && this.isColumnHidden(O, Js); ) + Vr++, kr.push(Vr), Js = z[Vr]; + Vr = qi - 1; + for (var Ya = 0; Vr >= Ya; ) + kr.push(Vr), Vr--; + kr.sort(Rr).reverse(); + } + return kr; + }, M.prototype.isColumnHidden = function(f, d) { + return f.indexOf(d) < 0; + }, M.prototype.ensureIntervalStarted = function() { + this.movingIntervalId || (this.intervalCount = 0, this.failedMoveAttempts = 0, this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), 100), this.needToMoveLeft ? this.dragAndDropService.setGhostIcon(fg.ICON_LEFT, !0) : this.dragAndDropService.setGhostIcon(fg.ICON_RIGHT, !0)); + }, M.prototype.ensureIntervalCleared = function() { + this.movingIntervalId && (window.clearInterval(this.movingIntervalId), this.movingIntervalId = null, this.dragAndDropService.setGhostIcon(fg.ICON_MOVE)); + }, M.prototype.moveInterval = function() { + var f; + this.intervalCount++, f = 10 + this.intervalCount * 5, f > 100 && (f = 100); + var d = null, g = this.gridBodyCon.getScrollFeature(); + if (this.needToMoveLeft ? d = g.scrollHorizontally(-f) : this.needToMoveRight && (d = g.scrollHorizontally(f)), d !== 0) + this.onDragging(this.lastDraggingEvent), this.failedMoveAttempts = 0; + else { + this.failedMoveAttempts++; + var S = this.lastDraggingEvent.dragItem.columns, O = S.filter(function(te) { + return !te.getColDef().lockPinned; + }); + if (O.length > 0 && (this.dragAndDropService.setGhostIcon(fg.ICON_PINNED), this.failedMoveAttempts > 7)) { + var z = this.needToMoveLeft ? Ue.PINNED_LEFT : Ue.PINNED_RIGHT; + this.setColumnsPinned(O, z, "uiColumnDragged"), this.dragAndDropService.nudge(); + } + } + }, cA([ + pe("columnModel") + ], M.prototype, "columnModel", void 0), cA([ + pe("dragAndDropService") + ], M.prototype, "dragAndDropService", void 0), cA([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), cA([ + pe("ctrlsService") + ], M.prototype, "ctrlsService", void 0), cA([ + ct + ], M.prototype, "init", null), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var qH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), lR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, jL = ( + /** @class */ + function(M) { + qH(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.pinned = d, S.eContainer = g, S; + } + return f.prototype.postConstruct = function() { + var d = this; + this.ctrlsService.whenReady(function(g) { + switch (d.pinned) { + case Ue.PINNED_LEFT: + d.eSecondaryContainers = [ + [g.gridBodyCtrl.getBodyViewportElement(), g.leftRowContainerCtrl.getContainerElement()], + [g.bottomLeftRowContainerCtrl.getContainerElement()], + [g.topLeftRowContainerCtrl.getContainerElement()] + ]; + break; + case Ue.PINNED_RIGHT: + d.eSecondaryContainers = [ + [g.gridBodyCtrl.getBodyViewportElement(), g.rightRowContainerCtrl.getContainerElement()], + [g.bottomRightRowContainerCtrl.getContainerElement()], + [g.topRightRowContainerCtrl.getContainerElement()] + ]; + break; + default: + d.eSecondaryContainers = [ + [g.gridBodyCtrl.getBodyViewportElement(), g.centerRowContainerCtrl.getViewportElement()], + [g.bottomCenterRowContainerCtrl.getViewportElement()], + [g.topCenterRowContainerCtrl.getViewportElement()] + ]; + break; + } + }); + }, f.prototype.isInterestedIn = function(d) { + return d === t.DragSourceType.HeaderCell || d === t.DragSourceType.ToolPanel && this.gridOptionsWrapper.isAllowDragFromColumnsToolPanel(); + }, f.prototype.getSecondaryContainers = function() { + return this.eSecondaryContainers; + }, f.prototype.getContainer = function() { + return this.eContainer; + }, f.prototype.init = function() { + this.moveColumnFeature = this.createManagedBean(new WH(this.pinned, this.eContainer)), this.bodyDropPivotTarget = this.createManagedBean(new HH(this.pinned)), this.dragAndDropService.addDropTarget(this); + }, f.prototype.getIconName = function() { + return this.currentDropListener.getIconName(); + }, f.prototype.isDropColumnInPivotMode = function(d) { + return this.columnModel.isPivotMode() && d.dragSource.type === t.DragSourceType.ToolPanel; + }, f.prototype.onDragEnter = function(d) { + this.currentDropListener = this.isDropColumnInPivotMode(d) ? this.bodyDropPivotTarget : this.moveColumnFeature, this.currentDropListener.onDragEnter(d); + }, f.prototype.onDragLeave = function(d) { + this.currentDropListener.onDragLeave(d); + }, f.prototype.onDragging = function(d) { + this.currentDropListener.onDragging(d); + }, f.prototype.onDragStop = function(d) { + this.currentDropListener.onDragStop(d); + }, lR([ + pe("dragAndDropService") + ], f.prototype, "dragAndDropService", void 0), lR([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), lR([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), lR([ + ct + ], f.prototype, "postConstruct", null), lR([ + ct + ], f.prototype, "init", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var S_e = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, Yre = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(S_e(arguments[f])); + return M; + }, g9 = ( + /** @class */ + function() { + function M() { + } + return M.getHeaderClassesFromColDef = function(f, d, g, S) { + return r(f) ? [] : this.getColumnClassesFromCollDef(f.headerClass, f, d, g, S); + }, M.getToolPanelClassesFromColDef = function(f, d, g, S) { + return r(f) ? [] : this.getColumnClassesFromCollDef(f.toolPanelClass, f, d, g, S); + }, M.getClassParams = function(f, d, g, S) { + return { + // bad naming, as colDef here can be a group or a column, + // however most people won't appreciate the difference, + // so keeping it as colDef to avoid confusion. + colDef: f, + column: g, + columnGroup: S, + api: d.getApi(), + columnApi: d.getColumnApi(), + context: d.getContext() + }; + }, M.getColumnClassesFromCollDef = function(f, d, g, S, O) { + if (r(f)) + return []; + var z; + if (typeof f == "function") { + var te = this.getClassParams(d, g, S, O); + z = f(te); + } else + z = f; + return typeof z == "string" ? [z] : Array.isArray(z) ? Yre(z) : []; + }, M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var GL = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), uR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, YH = ( + /** @class */ + function(M) { + GL(f, M); + function f(d) { + var g = M.call(this, f.TEMPLATE, d) || this; + return g.headerCompVersion = 0, g.column = d.getColumnGroupChild(), g.pinned = d.getPinned(), g; + } + return f.prototype.postConstruct = function() { + var d = this, g = this.getGui(), S = function(te, Fe, ze) { + var ht = ze || g; + Fe != null && Fe != "" ? ht.setAttribute(te, Fe) : ht.removeAttribute(te); + }, O = { + setWidth: function(te) { + return g.style.width = te; + }, + addOrRemoveCssClass: function(te, Fe) { + return d.addOrRemoveCssClass(te, Fe); + }, + setColId: function(te) { + return S("col-id", te); + }, + setTitle: function(te) { + return S("title", te); + }, + setAriaDescription: function(te) { + return Ro(g, te); + }, + setAriaSort: function(te) { + return te ? wh(g, te) : md(g); + }, + setUserCompDetails: function(te) { + return d.setUserCompDetails(te); + }, + getUserCompInstance: function() { + return d.headerComp; + } + }; + this.ctrl.setComp(O, this.getGui(), this.eResize); + var z = this.ctrl.getSelectAllGui(); + this.eResize.insertAdjacentElement("afterend", z); + }, f.prototype.destroyHeaderComp = function() { + this.headerComp && (this.getGui().removeChild(this.headerCompGui), this.headerComp = this.destroyBean(this.headerComp), this.headerCompGui = void 0); + }, f.prototype.setUserCompDetails = function(d) { + var g = this; + this.headerCompVersion++; + var S = this.headerCompVersion; + d.newAgStackInstance().then(function(O) { + return g.afterCompCreated(S, O); + }); + }, f.prototype.afterCompCreated = function(d, g) { + if (d != this.headerCompVersion || !this.isAlive()) { + this.destroyBean(g); + return; + } + this.destroyHeaderComp(), this.headerComp = g, this.headerCompGui = g.getGui(), this.getGui().appendChild(this.headerCompGui), this.ctrl.setDragSource(this.headerCompGui); + }, f.TEMPLATE = `
+ +
`, uR([ + qr("eResize") + ], f.prototype, "eResize", void 0), uR([ + ct + ], f.prototype, "postConstruct", null), uR([ + gt + ], f.prototype, "destroyHeaderComp", null), f; + }(o2) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var y9 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), UL = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Xre = ( + /** @class */ + function(M) { + y9(f, M); + function f(d) { + return M.call(this, f.TEMPLATE, d) || this; + } + return f.prototype.postConstruct = function() { + var d = this, g = this.getGui(), S = function(z, te) { + return te != null ? g.setAttribute(z, te) : g.removeAttribute(z); + }, O = { + addOrRemoveCssClass: function(z, te) { + return d.addOrRemoveCssClass(z, te); + }, + addOrRemoveResizableCssClass: function(z, te) { + return d.eResize.classList.toggle(z, te); + }, + setWidth: function(z) { + return g.style.width = z; + }, + setColId: function(z) { + return g.setAttribute("col-id", z); + }, + setAriaExpanded: function(z) { + return S("aria-expanded", z); + }, + setTitle: function(z) { + return S("title", z); + }, + setUserCompDetails: function(z) { + return d.setUserCompDetails(z); + } + }; + this.ctrl.setComp(O, g, this.eResize); + }, f.prototype.setUserCompDetails = function(d) { + var g = this; + d.newAgStackInstance().then(function(S) { + return g.afterHeaderCompCreated(S); + }); + }, f.prototype.afterHeaderCompCreated = function(d) { + var g = this, S = function() { + return g.destroyBean(d); + }; + if (!this.isAlive()) { + S(); + return; + } + this.getGui().appendChild(d.getGui()), this.addDestroyFunc(S), this.ctrl.setDragSource(d.getGui()); + }, f.TEMPLATE = `
+ +
`, UL([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), UL([ + qr("eResize") + ], f.prototype, "eResize", void 0), UL([ + ct + ], f.prototype, "postConstruct", null), f; + }(o2) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Kre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), v9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }; + (function(M) { + M.COLUMN_GROUP = "group", M.COLUMN = "column", M.FLOATING_FILTER = "filter"; + })(t.HeaderRowType || (t.HeaderRowType = {})); + var XH = ( + /** @class */ + function(M) { + Kre(f, M); + function f(d) { + var g = M.call(this) || this; + g.headerComps = {}; + var S = d.getType() == t.HeaderRowType.COLUMN_GROUP ? "ag-header-row-column-group" : d.getType() == t.HeaderRowType.FLOATING_FILTER ? "ag-header-row-column-filter" : "ag-header-row-column"; + return g.setTemplate( + /* html */ + '
' + ), g.ctrl = d, g; + } + return f.prototype.init = function() { + var d = this, g = { + setTransform: function(S) { + return d.getGui().style.transform = S; + }, + setHeight: function(S) { + return d.getGui().style.height = S; + }, + setTop: function(S) { + return d.getGui().style.top = S; + }, + setHeaderCtrls: function(S) { + return d.setHeaderCtrls(S); + }, + setWidth: function(S) { + return d.getGui().style.width = S; + }, + setAriaRowIndex: function(S) { + return Bl(d.getGui(), S); + } + }; + this.ctrl.setComp(g); + }, f.prototype.destroyHeaderCtrls = function() { + this.setHeaderCtrls([]); + }, f.prototype.setHeaderCtrls = function(d) { + var g = this; + if (this.isAlive()) { + var S = this.headerComps; + this.headerComps = {}, d.forEach(function(Fe) { + var ze = Fe.getInstanceId(), ht = S[ze]; + delete S[ze], ht == null && (ht = g.createHeaderComp(Fe), g.getGui().appendChild(ht.getGui())), g.headerComps[ze] = ht; + }), I(S, function(Fe, ze) { + g.getGui().removeChild(ze.getGui()), g.destroyBean(ze); + }); + var O = this.gridOptionsWrapper.isEnsureDomOrder(); + if (O) { + var z = re(this.headerComps); + z.sort(function(Fe, ze) { + var ht = Fe.getCtrl().getColumnGroupChild().getLeft(), Lt = ze.getCtrl().getColumnGroupChild().getLeft(); + return ht - Lt; + }); + var te = z.map(function(Fe) { + return Fe.getGui(); + }); + _c(this.getGui(), te); + } + } + }, f.prototype.createHeaderComp = function(d) { + var g; + switch (this.ctrl.getType()) { + case t.HeaderRowType.COLUMN_GROUP: + g = new Xre(d); + break; + case t.HeaderRowType.FLOATING_FILTER: + g = new W8(d); + break; + default: + g = new YH(d); + break; + } + return this.createBean(g), g.setParentComponent(this), g; + }, v9([ + ct + ], f.prototype, "init", null), v9([ + gt + ], f.prototype, "destroyHeaderCtrls", null), f; + }(ba) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var KH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Jre = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Zre = 0, GC = ( + /** @class */ + function(M) { + KH(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.lastFocusEvent = null, S.columnGroupChild = d, S.parentRowCtrl = g, S.instanceId = d.getUniqueId() + "-" + Zre++, S; + } + return f.prototype.shouldStopEventPropagation = function(d) { + var g = this.focusService.getFocusedHeader(), S = g.headerRowIndex, O = g.column; + return nL(this.gridOptionsWrapper, d, S, O); + }, f.prototype.setGui = function(d) { + this.eGui = d, this.addDomData(); + }, f.prototype.addDomData = function() { + var d = this, g = f.DOM_DATA_KEY_HEADER_CTRL; + this.gridOptionsWrapper.setDomData(this.eGui, g, this), this.addDestroyFunc(function() { + return d.gridOptionsWrapper.setDomData(d.eGui, g, null); + }); + }, f.prototype.getGui = function() { + return this.eGui; + }, f.prototype.focus = function(d) { + return this.eGui ? (this.lastFocusEvent = d || null, this.eGui.focus(), !0) : !1; + }, f.prototype.getRowIndex = function() { + return this.parentRowCtrl.getRowIndex(); + }, f.prototype.getParentRowCtrl = function() { + return this.parentRowCtrl; + }, f.prototype.getPinned = function() { + return this.parentRowCtrl.getPinned(); + }, f.prototype.getInstanceId = function() { + return this.instanceId; + }, f.prototype.getColumnGroupChild = function() { + return this.columnGroupChild; + }, f.DOM_DATA_KEY_HEADER_CTRL = "headerCtrl", Jre([ + pe("focusService") + ], f.prototype, "focusService", void 0), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + (function(M) { + M.EVERYTHING = "group", M.FILTER = "filter", M.SORT = "sort", M.MAP = "map", M.AGGREGATE = "aggregate", M.FILTER_AGGREGATES = "filter_aggregates", M.PIVOT = "pivot", M.NOTHING = "nothing"; + })(t.ClientSideRowModelSteps || (t.ClientSideRowModelSteps = {})); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var jl = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }; + function Qb(M) { + var f = M, d = f != null && f.getFrameworkComponentInstance != null; + return d ? f.getFrameworkComponentInstance() : M; + } + var _9 = ( + /** @class */ + function() { + function M() { + this.detailGridInfoMap = {}, this.destroyCalled = !1; + } + return M.prototype.registerOverlayWrapperComp = function(f) { + this.overlayWrapperComp = f; + }, M.prototype.registerSideBarComp = function(f) { + this.sideBarComp = f; + }, M.prototype.init = function() { + var f = this; + switch (this.rowModel.getType()) { + case Ue.ROW_MODEL_TYPE_CLIENT_SIDE: + this.clientSideRowModel = this.rowModel; + break; + case Ue.ROW_MODEL_TYPE_INFINITE: + this.infiniteRowModel = this.rowModel; + break; + case Ue.ROW_MODEL_TYPE_SERVER_SIDE: + this.serverSideRowModel = this.rowModel; + break; + } + this.ctrlsService.whenReady(function() { + f.gridBodyCtrl = f.ctrlsService.getGridBodyCtrl(); + }); + }, M.prototype.__getAlignedGridService = function() { + return this.alignedGridsService; + }, M.prototype.__getContext = function() { + return this.context; + }, M.prototype.addDetailGridInfo = function(f, d) { + this.detailGridInfoMap[f] = d; + }, M.prototype.removeDetailGridInfo = function(f) { + this.detailGridInfoMap[f] = void 0; + }, M.prototype.getDetailGridInfo = function(f) { + return this.detailGridInfoMap[f]; + }, M.prototype.forEachDetailGridInfo = function(f) { + var d = 0; + I(this.detailGridInfoMap, function(g, S) { + i(S) && (f(S, d), d++); + }); + }, M.prototype.getDataAsCsv = function(f) { + if (si.assertRegistered(t.ModuleNames.CsvExportModule, "api.getDataAsCsv")) + return this.csvCreator.getDataAsCsv(f); + }, M.prototype.exportDataAsCsv = function(f) { + si.assertRegistered(t.ModuleNames.CsvExportModule, "api.exportDataAsCSv") && this.csvCreator.exportDataAsCsv(f); + }, M.prototype.getExcelExportMode = function(f) { + var d = this.gridOptionsWrapper.getDefaultExportParams("excel"), g = Object.assign({ exportMode: "xlsx" }, d, f); + return g.exportMode; + }, M.prototype.getDataAsExcel = function(f) { + if (si.assertRegistered(t.ModuleNames.ExcelExportModule, "api.getDataAsExcel")) { + var d = this.getExcelExportMode(f); + if (this.excelCreator.getFactoryMode(d) === t.ExcelFactoryMode.MULTI_SHEET) { + console.warn("AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`"); + return; + } + return this.excelCreator.getDataAsExcel(f); + } + }, M.prototype.exportDataAsExcel = function(f) { + if (si.assertRegistered(t.ModuleNames.ExcelExportModule, "api.exportDataAsExcel")) { + var d = this.getExcelExportMode(f); + if (this.excelCreator.getFactoryMode(d) === t.ExcelFactoryMode.MULTI_SHEET) { + console.warn("AG Grid: The Excel Exporter is currently on Multi Sheet mode. End that operation by calling `api.getMultipleSheetAsExcel()` or `api.exportMultipleSheetsAsExcel()`"); + return; + } + this.excelCreator.exportDataAsExcel(f); + } + }, M.prototype.getSheetDataForExcel = function(f) { + if (si.assertRegistered(t.ModuleNames.ExcelExportModule, "api.getSheetDataForExcel")) { + var d = this.getExcelExportMode(f); + return this.excelCreator.setFactoryMode(t.ExcelFactoryMode.MULTI_SHEET, d), this.excelCreator.getSheetDataForExcel(f); + } + }, M.prototype.getMultipleSheetsAsExcel = function(f) { + if (si.assertRegistered(t.ModuleNames.ExcelExportModule, "api.getMultipleSheetsAsExcel")) + return this.excelCreator.getMultipleSheetsAsExcel(f); + }, M.prototype.exportMultipleSheetsAsExcel = function(f) { + if (si.assertRegistered(t.ModuleNames.ExcelExportModule, "api.exportMultipleSheetsAsExcel")) + return this.excelCreator.exportMultipleSheetsAsExcel(f); + }, M.prototype.setEnterpriseDatasource = function(f) { + console.warn("AG Grid: since version 18.x, api.setEnterpriseDatasource() should be replaced with api.setServerSideDatasource()"), this.setServerSideDatasource(f); + }, M.prototype.setGridAriaProperty = function(f, d) { + if (f) { + var g = this.ctrlsService.getGridBodyCtrl().getGui(), S = "aria-" + f; + d === null ? g.removeAttribute(S) : g.setAttribute(S, d); + } + }, M.prototype.setServerSideDatasource = function(f) { + this.serverSideRowModel ? this.serverSideRowModel.setDatasource(f) : console.warn("AG Grid: you can only use an enterprise datasource when gridOptions.rowModelType is '" + Ue.ROW_MODEL_TYPE_SERVER_SIDE + "'"); + }, M.prototype.setDatasource = function(f) { + this.gridOptionsWrapper.isRowModelInfinite() ? this.rowModel.setDatasource(f) : console.warn("AG Grid: you can only use a datasource when gridOptions.rowModelType is '" + Ue.ROW_MODEL_TYPE_INFINITE + "'"); + }, M.prototype.setViewportDatasource = function(f) { + this.gridOptionsWrapper.isRowModelViewport() ? this.rowModel.setViewportDatasource(f) : console.warn("AG Grid: you can only use a viewport datasource when gridOptions.rowModelType is '" + Ue.ROW_MODEL_TYPE_VIEWPORT + "'"); + }, M.prototype.setRowData = function(f) { + var d = this.immutableService == null; + if (d) { + console.warn("AG Grid: you can only set rowData when using the Client Side Row Model"); + return; + } + this.immutableService.isActive() ? this.immutableService.setRowData(f) : (this.selectionService.reset(), this.clientSideRowModel.setRowData(f)); + }, M.prototype.setFloatingTopRowData = function(f) { + console.warn("AG Grid: since v12, api.setFloatingTopRowData() is now api.setPinnedTopRowData()"), this.setPinnedTopRowData(f); + }, M.prototype.setFloatingBottomRowData = function(f) { + console.warn("AG Grid: since v12, api.setFloatingBottomRowData() is now api.setPinnedBottomRowData()"), this.setPinnedBottomRowData(f); + }, M.prototype.getFloatingTopRowCount = function() { + return console.warn("AG Grid: since v12, api.getFloatingTopRowCount() is now api.getPinnedTopRowCount()"), this.getPinnedTopRowCount(); + }, M.prototype.getFloatingBottomRowCount = function() { + return console.warn("AG Grid: since v12, api.getFloatingBottomRowCount() is now api.getPinnedBottomRowCount()"), this.getPinnedBottomRowCount(); + }, M.prototype.getFloatingTopRow = function(f) { + return console.warn("AG Grid: since v12, api.getFloatingTopRow() is now api.getPinnedTopRow()"), this.getPinnedTopRow(f); + }, M.prototype.getFloatingBottomRow = function(f) { + return console.warn("AG Grid: since v12, api.getFloatingBottomRow() is now api.getPinnedBottomRow()"), this.getPinnedBottomRow(f); + }, M.prototype.setPinnedTopRowData = function(f) { + this.pinnedRowModel.setPinnedTopRowData(f); + }, M.prototype.setPinnedBottomRowData = function(f) { + this.pinnedRowModel.setPinnedBottomRowData(f); + }, M.prototype.getPinnedTopRowCount = function() { + return this.pinnedRowModel.getPinnedTopRowCount(); + }, M.prototype.getPinnedBottomRowCount = function() { + return this.pinnedRowModel.getPinnedBottomRowCount(); + }, M.prototype.getPinnedTopRow = function(f) { + return this.pinnedRowModel.getPinnedTopRow(f); + }, M.prototype.getPinnedBottomRow = function(f) { + return this.pinnedRowModel.getPinnedBottomRow(f); + }, M.prototype.setColumnDefs = function(f, d) { + d === void 0 && (d = "api"), this.columnModel.setColumnDefs(f, d); + }, M.prototype.setAutoGroupColumnDef = function(f, d) { + this.gridOptionsWrapper.setProperty("autoGroupColumnDef", f, !0); + }, M.prototype.setDefaultColDef = function(f, d) { + this.gridOptionsWrapper.setProperty("defaultColDef", f, !0); + }, M.prototype.expireValueCache = function() { + this.valueCache.expire(); + }, M.prototype.getVerticalPixelRange = function() { + return this.gridBodyCtrl.getScrollFeature().getVScrollPosition(); + }, M.prototype.getHorizontalPixelRange = function() { + return this.gridBodyCtrl.getScrollFeature().getHScrollPosition(); + }, M.prototype.setAlwaysShowHorizontalScroll = function(f) { + this.gridOptionsWrapper.setProperty("alwaysShowHorizontalScroll", f); + }, M.prototype.setAlwaysShowVerticalScroll = function(f) { + this.gridOptionsWrapper.setProperty("alwaysShowVerticalScroll", f); + }, M.prototype.refreshToolPanel = function() { + this.sideBarComp && this.sideBarComp.refresh(); + }, M.prototype.refreshCells = function(f) { + if (f === void 0 && (f = {}), Array.isArray(f)) { + console.warn("since AG Grid v11.1, refreshCells() now takes parameters, please see the documentation."); + return; + } + this.rowRenderer.refreshCells(f); + }, M.prototype.flashCells = function(f) { + f === void 0 && (f = {}), this.rowRenderer.flashCells(f); + }, M.prototype.redrawRows = function(f) { + f === void 0 && (f = {}); + var d = f ? f.rowNodes : void 0; + this.rowRenderer.redrawRows(d); + }, M.prototype.setFunctionsReadOnly = function(f) { + this.gridOptionsWrapper.setProperty("functionsReadOnly", f); + }, M.prototype.refreshHeader = function() { + this.ctrlsService.getHeaderRowContainerCtrls().forEach(function(f) { + return f.refresh(); + }); + }, M.prototype.isAnyFilterPresent = function() { + return this.filterManager.isAnyFilterPresent(); + }, M.prototype.isColumnFilterPresent = function() { + return this.filterManager.isColumnFilterPresent() || this.filterManager.isAggregateFilterPresent(); + }, M.prototype.isQuickFilterPresent = function() { + return this.filterManager.isQuickFilterPresent(); + }, M.prototype.getModel = function() { + return this.rowModel; + }, M.prototype.setRowNodeExpanded = function(f, d) { + f && f.setExpanded(d); + }, M.prototype.onGroupExpandedOrCollapsed = function(f) { + r(this.clientSideRowModel) && console.warn("AG Grid: cannot call onGroupExpandedOrCollapsed unless using normal row model"), i(f) && console.warn("AG Grid: api.onGroupExpandedOrCollapsed - refreshFromIndex parameter is no longer used, the grid will refresh all rows"), this.clientSideRowModel.refreshModel({ step: t.ClientSideRowModelSteps.MAP }); + }, M.prototype.refreshInMemoryRowModel = function(f) { + console.warn("ag-grid: since version 18.x, api.refreshInMemoryRowModel() should be replaced with api.refreshClientSideRowModel()"), this.refreshClientSideRowModel(f); + }, M.prototype.refreshClientSideRowModel = function(f) { + r(this.clientSideRowModel) && console.warn("cannot call refreshClientSideRowModel unless using normal row model"); + var d = t.ClientSideRowModelSteps.EVERYTHING, g = { + group: t.ClientSideRowModelSteps.EVERYTHING, + filter: t.ClientSideRowModelSteps.FILTER, + map: t.ClientSideRowModelSteps.MAP, + aggregate: t.ClientSideRowModelSteps.AGGREGATE, + sort: t.ClientSideRowModelSteps.SORT, + pivot: t.ClientSideRowModelSteps.PIVOT + }; + if (i(f) && (d = g[f]), r(d)) { + console.error("AG Grid: invalid step " + f + ", available steps are " + Object.keys(g).join(", ")); + return; + } + var S = !this.gridOptionsWrapper.isSuppressAnimationFrame(), O = { + step: d, + keepRenderedRows: !0, + keepEditingRows: !0, + animate: S + }; + this.clientSideRowModel.refreshModel(O); + }, M.prototype.isAnimationFrameQueueEmpty = function() { + return this.animationFrameService.isQueueEmpty(); + }, M.prototype.flushAllAnimationFrames = function() { + this.animationFrameService.flushAllFrames(); + }, M.prototype.getRowNode = function(f) { + return this.rowModel.getRowNode(f); + }, M.prototype.getSizesForCurrentTheme = function() { + return { + rowHeight: this.gridOptionsWrapper.getRowHeightAsNumber(), + headerHeight: this.gridOptionsWrapper.getHeaderHeight() + }; + }, M.prototype.expandAll = function() { + this.clientSideRowModel ? this.clientSideRowModel.expandOrCollapseAll(!0) : this.serverSideRowModel ? this.serverSideRowModel.expandAll(!0) : console.warn("AG Grid: expandAll only works with Client Side Row Model and Server Side Row Model"); + }, M.prototype.collapseAll = function() { + this.clientSideRowModel ? this.clientSideRowModel.expandOrCollapseAll(!1) : this.serverSideRowModel ? this.serverSideRowModel.expandAll(!1) : console.warn("AG Grid: collapseAll only works with Client Side Row Model and Server Side Row Model"); + }, M.prototype.getToolPanelInstance = function(f) { + if (!this.sideBarComp) { + console.warn("AG Grid: toolPanel is only available in AG Grid Enterprise"); + return; + } + var d = this.sideBarComp.getToolPanelInstance(f); + return Qb(d); + }, M.prototype.addVirtualRowListener = function(f, d, g) { + typeof f != "string" && console.warn("AG Grid: addVirtualRowListener is deprecated, please use addRenderedRowListener."), this.addRenderedRowListener(f, d, g); + }, M.prototype.addRenderedRowListener = function(f, d, g) { + f === "virtualRowSelected" && console.warn(`AG Grid: event virtualRowSelected is deprecated, to register for individual row + selection events, add a listener directly to the row node.`), this.rowRenderer.addRenderedRowListener(f, d, g); + }, M.prototype.setQuickFilter = function(f) { + this.filterManager.setQuickFilter(f); + }, M.prototype.selectIndex = function(f, d, g) { + console.warn("AG Grid: do not use api for selection, call node.setSelected(value) instead"), g && console.warn("AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it"), this.selectionService.selectIndex(f, d); + }, M.prototype.deselectIndex = function(f, d) { + d === void 0 && (d = !1), console.warn("AG Grid: do not use api for selection, call node.setSelected(value) instead"), d && console.warn("AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it"), this.selectionService.deselectIndex(f); + }, M.prototype.selectNode = function(f, d, g) { + d === void 0 && (d = !1), g === void 0 && (g = !1), console.warn("AG Grid: API for selection is deprecated, call node.setSelected(value) instead"), g && console.warn("AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it"), f.setSelectedParams({ newValue: !0, clearSelection: !d }); + }, M.prototype.deselectNode = function(f, d) { + d === void 0 && (d = !1), console.warn("AG Grid: API for selection is deprecated, call node.setSelected(value) instead"), d && console.warn("AG Grid: suppressEvents is no longer supported, stop listening for the event if you no longer want it"), f.setSelectedParams({ newValue: !1 }); + }, M.prototype.selectAll = function() { + this.selectionService.selectAllRowNodes(); + }, M.prototype.deselectAll = function() { + this.selectionService.deselectAllRowNodes(); + }, M.prototype.selectAllFiltered = function() { + this.selectionService.selectAllRowNodes(!0); + }, M.prototype.deselectAllFiltered = function() { + this.selectionService.deselectAllRowNodes(!0); + }, M.prototype.recomputeAggregates = function() { + r(this.clientSideRowModel) && console.warn("cannot call recomputeAggregates unless using normal row model"), console.warn("recomputeAggregates is deprecated, please call api.refreshClientSideRowModel('aggregate') instead"), this.clientSideRowModel.refreshModel({ step: t.ClientSideRowModelSteps.AGGREGATE }); + }, M.prototype.sizeColumnsToFit = function() { + this.gridBodyCtrl.sizeColumnsToFit(); + }, M.prototype.showLoadingOverlay = function() { + this.overlayWrapperComp.showLoadingOverlay(); + }, M.prototype.showNoRowsOverlay = function() { + this.overlayWrapperComp.showNoRowsOverlay(); + }, M.prototype.hideOverlay = function() { + this.overlayWrapperComp.hideOverlay(); + }, M.prototype.isNodeSelected = function(f) { + return console.warn("AG Grid: no need to call api.isNodeSelected(), just call node.isSelected() instead"), f.isSelected(); + }, M.prototype.getSelectedNodesById = function() { + return console.error("AG Grid: since version 3.4, getSelectedNodesById no longer exists, use getSelectedNodes() instead"), null; + }, M.prototype.getSelectedNodes = function() { + return this.selectionService.getSelectedNodes(); + }, M.prototype.getSelectedRows = function() { + return this.selectionService.getSelectedRows(); + }, M.prototype.getBestCostNodeSelection = function() { + return this.selectionService.getBestCostNodeSelection(); + }, M.prototype.getRenderedNodes = function() { + return this.rowRenderer.getRenderedNodes(); + }, M.prototype.ensureColIndexVisible = function(f) { + console.warn("AG Grid: ensureColIndexVisible(index) no longer supported, use ensureColumnVisible(colKey) instead."); + }, M.prototype.ensureColumnVisible = function(f, d) { + d === void 0 && (d = "auto"), this.gridBodyCtrl.getScrollFeature().ensureColumnVisible(f, d); + }, M.prototype.ensureIndexVisible = function(f, d) { + this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(f, d); + }, M.prototype.ensureNodeVisible = function(f, d) { + d === void 0 && (d = null), this.gridBodyCtrl.getScrollFeature().ensureNodeVisible(f, d); + }, M.prototype.forEachLeafNode = function(f) { + r(this.clientSideRowModel) && console.warn("cannot call forEachNode unless using normal row model"), this.clientSideRowModel.forEachLeafNode(f); + }, M.prototype.forEachNode = function(f) { + this.rowModel.forEachNode(f); + }, M.prototype.forEachNodeAfterFilter = function(f) { + r(this.clientSideRowModel) && console.warn("cannot call forEachNodeAfterFilter unless using normal row model"), this.clientSideRowModel.forEachNodeAfterFilter(f); + }, M.prototype.forEachNodeAfterFilterAndSort = function(f) { + r(this.clientSideRowModel) && console.warn("cannot call forEachNodeAfterFilterAndSort unless using normal row model"), this.clientSideRowModel.forEachNodeAfterFilterAndSort(f); + }, M.prototype.getFilterInstance = function(f, d) { + var g = this.getFilterInstanceImpl(f, function(O) { + if (d) { + var z = Qb(O); + d(z); + } + }), S = Qb(g); + return S; + }, M.prototype.getFilterInstanceImpl = function(f, d) { + var g = this.columnModel.getPrimaryColumn(f); + if (g) { + var S = this.filterManager.getFilterComponent(g, "NO_UI"), O = S && S.resolveNow(null, function(z) { + return z; + }); + return O ? setTimeout(d, 0, O) : S && S.then(function(z) { + d(z); + }), O; + } + }, M.prototype.destroyFilter = function(f) { + var d = this.columnModel.getPrimaryColumn(f); + if (d) + return this.filterManager.destroyFilter(d, "filterDestroyed"); + }, M.prototype.getStatusPanel = function(f) { + if (this.statusBarService) { + var d = this.statusBarService.getStatusPanel(f); + return Qb(d); + } + }, M.prototype.getColumnDef = function(f) { + var d = this.columnModel.getPrimaryColumn(f); + return d ? d.getColDef() : null; + }, M.prototype.getColumnDefs = function() { + return this.columnModel.getColumnDefs(); + }, M.prototype.onFilterChanged = function() { + this.filterManager.onFilterChanged(); + }, M.prototype.onSortChanged = function() { + this.sortController.onSortChanged("api"); + }, M.prototype.setFilterModel = function(f) { + this.filterManager.setFilterModel(f); + }, M.prototype.getFilterModel = function() { + return this.filterManager.getFilterModel(); + }, M.prototype.getFocusedCell = function() { + return this.focusService.getFocusedCell(); + }, M.prototype.clearFocusedCell = function() { + return this.focusService.clearFocusedCell(); + }, M.prototype.setFocusedCell = function(f, d, g) { + this.focusService.setFocusedCell(f, d, g, !0); + }, M.prototype.setSuppressRowDrag = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_SUPPRESS_ROW_DRAG, f); + }, M.prototype.setSuppressMoveWhenRowDragging = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_SUPPRESS_MOVE_WHEN_ROW_DRAG, f); + }, M.prototype.setSuppressRowClickSelection = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_SUPPRESS_ROW_CLICK_SELECTION, f); + }, M.prototype.addRowDropZone = function(f) { + this.gridBodyCtrl.getRowDragFeature().addRowDropZone(f); + }, M.prototype.removeRowDropZone = function(f) { + var d = this.dragAndDropService.findExternalZone(f); + d && this.dragAndDropService.removeDropTarget(d); + }, M.prototype.getRowDropZoneParams = function(f) { + return this.gridBodyCtrl.getRowDragFeature().getRowDropZone(f); + }, M.prototype.setHeaderHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_HEADER_HEIGHT, f); + }, M.prototype.setDomLayout = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_DOM_LAYOUT, f); + }, M.prototype.setEnableCellTextSelection = function(f) { + this.gridBodyCtrl.setCellTextSelection(f); + }, M.prototype.setFillHandleDirection = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_FILL_HANDLE_DIRECTION, f); + }, M.prototype.setGroupHeaderHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GROUP_HEADER_HEIGHT, f); + }, M.prototype.setFloatingFiltersHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_FLOATING_FILTERS_HEIGHT, f); + }, M.prototype.setPivotHeaderHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PIVOT_HEADER_HEIGHT, f); + }, M.prototype.setPivotGroupHeaderHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PIVOT_GROUP_HEADER_HEIGHT, f); + }, M.prototype.setIsExternalFilterPresent = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_EXTERNAL_FILTER_PRESENT, f); + }, M.prototype.setDoesExternalFilterPass = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_DOES_EXTERNAL_FILTER_PASS, f); + }, M.prototype.setNavigateToNextCell = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_NAVIGATE_TO_NEXT_CELL, f); + }, M.prototype.setTabToNextCell = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_TAB_TO_NEXT_CELL, f); + }, M.prototype.setTabToNextHeader = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_TAB_TO_NEXT_HEADER, f); + }, M.prototype.setNavigateToNextHeader = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_NAVIGATE_TO_NEXT_HEADER, f); + }, M.prototype.setGroupRowAggNodes = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GROUP_ROW_AGG_NODES, f); + }, M.prototype.setGetGroupRowAgg = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_GROUP_ROW_AGG, f); + }, M.prototype.setGetBusinessKeyForNode = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_BUSINESS_KEY_FOR_NODE, f); + }, M.prototype.setGetChildCount = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_CHILD_COUNT, f); + }, M.prototype.setProcessRowPostCreate = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PROCESS_ROW_POST_CREATE, f); + }, M.prototype.setGetRowNodeId = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_ROW_NODE_ID, f); + }, M.prototype.setGetRowId = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_ROW_ID, f); + }, M.prototype.setGetRowClass = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_ROW_CLASS, f); + }, M.prototype.setIsFullWidthCell = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_FULL_WIDTH_CELL, f); + }, M.prototype.setIsFullWidthRow = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_FULL_WIDTH_ROW, f); + }, M.prototype.setIsRowSelectable = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_ROW_SELECTABLE, f); + }, M.prototype.setIsRowMaster = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_ROW_MASTER, f); + }, M.prototype.setPostSort = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_POST_SORT, f); + }, M.prototype.setPostSortRows = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_POST_SORT_ROWS, f); + }, M.prototype.setGetDocument = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_DOCUMENT, f); + }, M.prototype.setGetContextMenuItems = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_CONTEXT_MENU_ITEMS, f); + }, M.prototype.setGetMainMenuItems = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_MAIN_MENU_ITEMS, f); + }, M.prototype.setProcessCellForClipboard = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PROCESS_CELL_FOR_CLIPBOARD, f); + }, M.prototype.setSendToClipboard = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_SEND_TO_CLIPBOARD, f); + }, M.prototype.setProcessCellFromClipboard = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PROCESS_CELL_FROM_CLIPBOARD, f); + }, M.prototype.setProcessSecondaryColDef = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PROCESS_TO_SECONDARY_COLDEF, f); + }, M.prototype.setProcessSecondaryColGroupDef = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PROCESS_SECONDARY_COL_GROUP_DEF, f); + }, M.prototype.setPostProcessPopup = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_POST_PROCESS_POPUP, f); + }, M.prototype.setDefaultGroupOrderComparator = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_DEFAULT_GROUP_ORDER_COMPARATOR, f); + }, M.prototype.setInitialGroupOrderComparator = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_INITIAL_GROUP_ORDER_COMPARATOR, f); + }, M.prototype.setGetChartToolbarItems = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_CHART_TOOLBAR_ITEMS, f); + }, M.prototype.setPaginationNumberFormatter = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_PAGINATION_NUMBER_FORMATTER, f); + }, M.prototype.setGetServerSideStoreParams = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_SERVER_SIDE_STORE_PARAMS, f); + }, M.prototype.setIsServerSideGroupOpenByDefault = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_SERVER_SIDE_GROUPS_OPEN_BY_DEFAULT, f); + }, M.prototype.setIsApplyServerSideTransaction = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_APPLY_SERVER_SIDE_TRANSACTION, f); + }, M.prototype.setIsServerSideGroup = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_IS_SERVER_SIDE_GROUP, f); + }, M.prototype.setGetServerSideGroupKey = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_SERVER_SIDE_GROUP_KEY, f); + }, M.prototype.setGetRowStyle = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_ROW_STYLE, f); + }, M.prototype.setGetRowHeight = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GET_ROW_HEIGHT, f); + }, M.prototype.isSideBarVisible = function() { + return this.sideBarComp ? this.sideBarComp.isDisplayed() : !1; + }, M.prototype.setSideBarVisible = function(f) { + if (!this.sideBarComp) { + f && console.warn("AG Grid: sideBar is not loaded"); + return; + } + this.sideBarComp.setDisplayed(f); + }, M.prototype.setSideBarPosition = function(f) { + if (!this.sideBarComp) { + console.warn("AG Grid: sideBar is not loaded"); + return; + } + this.sideBarComp.setSideBarPosition(f); + }, M.prototype.openToolPanel = function(f) { + if (!this.sideBarComp) { + console.warn("AG Grid: toolPanel is only available in AG Grid Enterprise"); + return; + } + this.sideBarComp.openToolPanel(f); + }, M.prototype.closeToolPanel = function() { + if (!this.sideBarComp) { + console.warn("AG Grid: toolPanel is only available in AG Grid Enterprise"); + return; + } + this.sideBarComp.close(); + }, M.prototype.getOpenedToolPanel = function() { + return this.sideBarComp ? this.sideBarComp.openedItem() : null; + }, M.prototype.getSideBar = function() { + return this.gridOptionsWrapper.getSideBar(); + }, M.prototype.setSideBar = function(f) { + this.gridOptionsWrapper.setProperty("sideBar", bL.parse(f)); + }, M.prototype.setSuppressClipboardPaste = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_SUPPRESS_CLIPBOARD_PASTE, f); + }, M.prototype.isToolPanelShowing = function() { + return this.sideBarComp.isToolPanelShowing(); + }, M.prototype.doLayout = function() { + var f = "AG Grid - since version 25.1, doLayout was taken out, as it's not needed. The grid responds to grid size changes automatically"; + Ge(function() { + return console.warn(f); + }, "doLayoutDeprecated"); + }, M.prototype.resetRowHeights = function() { + if (i(this.clientSideRowModel)) { + if (this.columnModel.isAutoRowHeightActive()) { + console.warn("AG Grid: calling gridApi.resetRowHeights() makes no sense when using Auto Row Height."); + return; + } + this.clientSideRowModel.resetRowHeights(); + } + }, M.prototype.setGroupRemoveSingleChildren = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GROUP_REMOVE_SINGLE_CHILDREN, f); + }, M.prototype.setGroupRemoveLowestSingleChildren = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, f); + }, M.prototype.onRowHeightChanged = function() { + this.clientSideRowModel ? this.clientSideRowModel.onRowHeightChanged() : this.serverSideRowModel && this.serverSideRowModel.onRowHeightChanged(); + }, M.prototype.getValue = function(f, d) { + var g = this.columnModel.getPrimaryColumn(f); + return r(g) && (g = this.columnModel.getGridColumn(f)), r(g) ? null : this.valueService.getValue(g, d); + }, M.prototype.addEventListener = function(f, d) { + var g = this.gridOptionsWrapper.useAsyncEvents(); + this.eventService.addEventListener(f, d, g); + }, M.prototype.addGlobalListener = function(f) { + var d = this.gridOptionsWrapper.useAsyncEvents(); + this.eventService.addGlobalListener(f, d); + }, M.prototype.removeEventListener = function(f, d) { + var g = this.gridOptionsWrapper.useAsyncEvents(); + this.eventService.removeEventListener(f, d, g); + }, M.prototype.removeGlobalListener = function(f) { + var d = this.gridOptionsWrapper.useAsyncEvents(); + this.eventService.removeGlobalListener(f, d); + }, M.prototype.dispatchEvent = function(f) { + this.eventService.dispatchEvent(f); + }, M.prototype.destroy = function() { + if (!this.destroyCalled) { + this.destroyCalled = !0; + var f = this.ctrlsService.getGridCtrl(); + f && f.destroyGridUi(), this.context.destroy(); + } + }, M.prototype.cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid = function() { + setTimeout(J.bind(window, this, "Grid API"), 100); + }, M.prototype.warnIfDestroyed = function(f) { + return this.destroyCalled && console.warn("AG Grid: Grid API method " + f + " was called on a grid that was destroyed."), this.destroyCalled; + }, M.prototype.resetQuickFilter = function() { + this.warnIfDestroyed("resetQuickFilter") || this.rowModel.forEachNode(function(f) { + return f.quickFilterAggregateText = null; + }); + }, M.prototype.getRangeSelections = function() { + return console.warn(`AG Grid: in v20.1.x, api.getRangeSelections() is gone, please use getCellRanges() instead. + We had to change how cell selections works a small bit to allow charting to integrate. The return type of + getCellRanges() is a bit different, please check the AG Grid documentation.`), null; + }, M.prototype.getCellRanges = function() { + return this.rangeService ? this.rangeService.getCellRanges() : (console.warn("AG Grid: cell range selection is only available in AG Grid Enterprise"), null); + }, M.prototype.camelCaseToHumanReadable = function(f) { + return Fr(f); + }, M.prototype.addRangeSelection = function(f) { + console.warn("AG Grid: As of version 21.x, range selection changed slightly to allow charting integration. Please call api.addCellRange() instead of api.addRangeSelection()"); + }, M.prototype.addCellRange = function(f) { + this.rangeService || console.warn("AG Grid: cell range selection is only available in AG Grid Enterprise"), this.rangeService.addCellRange(f); + }, M.prototype.clearRangeSelection = function() { + this.rangeService || console.warn("AG Grid: cell range selection is only available in AG Grid Enterprise"), this.rangeService.removeAllCellRanges(); + }, M.prototype.undoCellEditing = function() { + this.undoRedoService.undo(); + }, M.prototype.redoCellEditing = function() { + this.undoRedoService.redo(); + }, M.prototype.getCurrentUndoSize = function() { + return this.undoRedoService.getCurrentUndoStackSize(); + }, M.prototype.getCurrentRedoSize = function() { + return this.undoRedoService.getCurrentRedoStackSize(); + }, M.prototype.getChartModels = function() { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.getChartModels") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.getChartModels")) + return this.chartService.getChartModels(); + }, M.prototype.getChartRef = function(f) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.getChartRef") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.getChartRef")) + return this.chartService.getChartRef(f); + }, M.prototype.getChartImageDataURL = function(f) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.getChartImageDataURL") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.getChartImageDataURL")) + return this.chartService.getChartImageDataURL(f); + }, M.prototype.createRangeChart = function(f) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.createRangeChart") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.createRangeChart")) + return this.chartService.createRangeChart(f); + }, M.prototype.createCrossFilterChart = function(f) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.createCrossFilterChart") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.createCrossFilterChart")) + return this.chartService.createCrossFilterChart(f); + }, M.prototype.restoreChart = function(f, d) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.restoreChart") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.restoreChart")) + return this.chartService.restoreChart(f, d); + }, M.prototype.createPivotChart = function(f) { + if (si.assertRegistered(t.ModuleNames.RangeSelectionModule, "api.createPivotChart") && si.assertRegistered(t.ModuleNames.GridChartsModule, "api.createPivotChart")) + return this.chartService.createPivotChart(f); + }, M.prototype.copySelectedRowsToClipboard = function(f) { + this.clipboardService || console.warn("AG Grid: clipboard is only available in AG Grid Enterprise"), this.clipboardService.copySelectedRowsToClipboard(f); + }, M.prototype.copySelectedRangeToClipboard = function(f) { + this.clipboardService || console.warn("AG Grid: clipboard is only available in AG Grid Enterprise"), this.clipboardService.copySelectedRangeToClipboard(f); + }, M.prototype.copySelectedRangeDown = function() { + this.clipboardService || console.warn("AG Grid: clipboard is only available in AG Grid Enterprise"), this.clipboardService.copyRangeDown(); + }, M.prototype.showColumnMenuAfterButtonClick = function(f, d) { + var g = this.columnModel.getGridColumn(f); + this.menuFactory.showMenuAfterButtonClick(g, d, "columnMenu"); + }, M.prototype.showColumnMenuAfterMouseClick = function(f, d) { + var g = this.columnModel.getGridColumn(f); + if (g || (g = this.columnModel.getPrimaryColumn(f)), !g) { + console.error("AG Grid: column '" + f + "' not found"); + return; + } + this.menuFactory.showMenuAfterMouseEvent(g, d); + }, M.prototype.hidePopupMenu = function() { + this.contextMenuFactory && this.contextMenuFactory.hideActiveMenu(), this.menuFactory.hideActiveMenu(); + }, M.prototype.setPopupParent = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_POPUP_PARENT, f); + }, M.prototype.tabToNextCell = function(f) { + return this.navigationService.tabToNextCell(!1, f); + }, M.prototype.tabToPreviousCell = function(f) { + return this.navigationService.tabToNextCell(!0, f); + }, M.prototype.getCellRendererInstances = function(f) { + f === void 0 && (f = {}); + var d = this.rowRenderer.getCellRendererInstances(f), g = d.map(Qb); + return g; + }, M.prototype.getCellEditorInstances = function(f) { + f === void 0 && (f = {}); + var d = this.rowRenderer.getCellEditorInstances(f), g = d.map(Qb); + return g; + }, M.prototype.getEditingCells = function() { + return this.rowRenderer.getEditingCells(); + }, M.prototype.stopEditing = function(f) { + f === void 0 && (f = !1), this.rowRenderer.stopEditing(f); + }, M.prototype.startEditingCell = function(f) { + var d = this.columnModel.getGridColumn(f.colKey); + if (!d) { + console.warn("AG Grid: no column found for " + f.colKey); + return; + } + var g = { + rowIndex: f.rowIndex, + rowPinned: f.rowPinned || null, + column: d + }, S = f.rowPinned == null; + S && this.gridBodyCtrl.getScrollFeature().ensureIndexVisible(f.rowIndex); + var O = this.navigationService.getCellByPosition(g); + O && O.startRowOrCellEdit(f.key, f.charPress); + }, M.prototype.addAggFunc = function(f, d) { + this.aggFuncService && this.aggFuncService.addAggFunc(f, d); + }, M.prototype.addAggFuncs = function(f) { + this.aggFuncService && this.aggFuncService.addAggFuncs(f); + }, M.prototype.clearAggFuncs = function() { + this.aggFuncService && this.aggFuncService.clear(); + }, M.prototype.applyServerSideTransaction = function(f) { + if (!this.serverSideTransactionManager) { + console.warn("AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model."); + return; + } + return this.serverSideTransactionManager.applyTransaction(f); + }, M.prototype.applyServerSideTransactionAsync = function(f, d) { + if (!this.serverSideTransactionManager) { + console.warn("AG Grid: Cannot apply Server Side Transaction if not using the Server Side Row Model."); + return; + } + return this.serverSideTransactionManager.applyTransactionAsync(f, d); + }, M.prototype.retryServerSideLoads = function() { + if (!this.serverSideRowModel) { + console.warn("AG Grid: API retryServerSideLoads() can only be used when using Server-Side Row Model."); + return; + } + this.serverSideRowModel.retryLoads(); + }, M.prototype.flushServerSideAsyncTransactions = function() { + if (!this.serverSideTransactionManager) { + console.warn("AG Grid: Cannot flush Server Side Transaction if not using the Server Side Row Model."); + return; + } + return this.serverSideTransactionManager.flushAsyncTransactions(); + }, M.prototype.applyTransaction = function(f) { + if (!this.clientSideRowModel) { + console.error("AG Grid: updateRowData() only works with ClientSideRowModel. Working with InfiniteRowModel was deprecated in v23.1 and removed in v24.1"); + return; + } + var d = this.clientSideRowModel.updateRowData(f); + return this.rowRenderer.refreshFullWidthRows(d.update), this.gridOptionsWrapper.isSuppressChangeDetection() || this.rowRenderer.refreshCells(), d; + }, M.prototype.setDeltaSort = function(f) { + this.gridOptionsWrapper.setProperty("deltaSort", f); + }, M.prototype.updateRowData = function(f) { + var d = "AG Grid: as of v23.1, grid API updateRowData(transaction) is now called applyTransaction(transaction). updateRowData is deprecated and will be removed in a future major release."; + return Ge(function() { + return console.warn(d); + }, "updateRowData deprecated"), this.applyTransaction(f); + }, M.prototype.applyTransactionAsync = function(f, d) { + if (!this.clientSideRowModel) { + console.error("AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel."); + return; + } + this.clientSideRowModel.batchUpdateRowData(f, d); + }, M.prototype.flushAsyncTransactions = function() { + if (!this.clientSideRowModel) { + console.error("AG Grid: api.applyTransactionAsync() only works with ClientSideRowModel."); + return; + } + this.clientSideRowModel.flushAsyncTransactions(); + }, M.prototype.batchUpdateRowData = function(f, d) { + var g = "AG Grid: as of v23.1, grid API batchUpdateRowData(transaction, callback) is now called applyTransactionAsync(transaction, callback). batchUpdateRowData is deprecated and will be removed in a future major release."; + Ge(function() { + return console.warn(g); + }, "batchUpdateRowData deprecated"), this.applyTransactionAsync(f, d); + }, M.prototype.insertItemsAtIndex = function(f, d, g) { + console.warn("AG Grid: insertItemsAtIndex() is deprecated, use updateRowData(transaction) instead."), this.updateRowData({ add: d, addIndex: f, update: null, remove: null }); + }, M.prototype.removeItems = function(f, d) { + console.warn("AG Grid: removeItems() is deprecated, use updateRowData(transaction) instead."); + var g = f.map(function(S) { + return S.data; + }); + this.updateRowData({ add: null, addIndex: null, update: null, remove: g }); + }, M.prototype.addItems = function(f, d) { + console.warn("AG Grid: addItems() is deprecated, use updateRowData(transaction) instead."), this.updateRowData({ add: f, addIndex: null, update: null, remove: null }); + }, M.prototype.refreshVirtualPageCache = function() { + console.warn("AG Grid: refreshVirtualPageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead"), this.refreshInfiniteCache(); + }, M.prototype.refreshInfinitePageCache = function() { + console.warn("AG Grid: refreshInfinitePageCache() is now called refreshInfiniteCache(), please call refreshInfiniteCache() instead"), this.refreshInfiniteCache(); + }, M.prototype.refreshInfiniteCache = function() { + this.infiniteRowModel ? this.infiniteRowModel.refreshCache() : console.warn("AG Grid: api.refreshInfiniteCache is only available when rowModelType='infinite'."); + }, M.prototype.purgeVirtualPageCache = function() { + console.warn("AG Grid: purgeVirtualPageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead"), this.purgeInfinitePageCache(); + }, M.prototype.purgeInfinitePageCache = function() { + console.warn("AG Grid: purgeInfinitePageCache() is now called purgeInfiniteCache(), please call purgeInfiniteCache() instead"), this.purgeInfiniteCache(); + }, M.prototype.purgeInfiniteCache = function() { + this.infiniteRowModel ? this.infiniteRowModel.purgeCache() : console.warn("AG Grid: api.purgeInfiniteCache is only available when rowModelType='infinite'."); + }, M.prototype.purgeEnterpriseCache = function(f) { + console.warn("ag-grid: since version 18.x, api.purgeEnterpriseCache() should be replaced with api.purgeServerSideCache()"), this.purgeServerSideCache(f); + }, M.prototype.purgeServerSideCache = function(f) { + f === void 0 && (f = []), this.serverSideRowModel ? (console.warn("AG Grid: since v25.0, api.purgeServerSideCache is deprecated. Please use api.refreshServerSideStore({purge: true}) instead."), this.refreshServerSideStore({ + route: f, + purge: !0 + })) : console.warn("AG Grid: api.purgeServerSideCache is only available when rowModelType='serverSide'."); + }, M.prototype.refreshServerSideStore = function(f) { + this.serverSideRowModel ? this.serverSideRowModel.refreshStore(f) : console.warn("AG Grid: api.refreshServerSideStore is only available when rowModelType='serverSide'."); + }, M.prototype.getServerSideStoreState = function() { + return this.serverSideRowModel ? this.serverSideRowModel.getStoreState() : (console.warn("AG Grid: api.getServerSideStoreState is only available when rowModelType='serverSide'."), []); + }, M.prototype.getVirtualRowCount = function() { + return console.warn("AG Grid: getVirtualRowCount() is now called getInfiniteRowCount(), please call getInfiniteRowCount() instead"), this.getInfiniteRowCount(); + }, M.prototype.getInfiniteRowCount = function() { + if (this.infiniteRowModel) + return this.infiniteRowModel.getRowCount(); + console.warn("AG Grid: api.getVirtualRowCount is only available when rowModelType='virtual'."); + }, M.prototype.isMaxRowFound = function() { + return console.warn("AG Grid: api.isLastRowIndexKnown is deprecated, please use api.isLastRowIndexKnown()"), this.isLastRowIndexKnown(); + }, M.prototype.isLastRowIndexKnown = function() { + if (this.infiniteRowModel) + return this.infiniteRowModel.isLastRowIndexKnown(); + console.warn("AG Grid: api.isMaxRowFound is only available when rowModelType='virtual'."); + }, M.prototype.setVirtualRowCount = function(f, d) { + console.warn("AG Grid: setVirtualRowCount() is now called setInfiniteRowCount(), please call setInfiniteRowCount() instead"), this.setRowCount(f, d); + }, M.prototype.setInfiniteRowCount = function(f, d) { + console.warn("AG Grid: setInfiniteRowCount() is now called setRowCount(), please call setRowCount() instead"), this.setRowCount(f, d); + }, M.prototype.setRowCount = function(f, d) { + this.infiniteRowModel ? this.infiniteRowModel.setRowCount(f, d) : console.warn("AG Grid: api.setRowCount is only available for Infinite Row Model."); + }, M.prototype.getVirtualPageState = function() { + return console.warn("AG Grid: getVirtualPageState() is now called getCacheBlockState(), please call getCacheBlockState() instead"), this.getCacheBlockState(); + }, M.prototype.getInfinitePageState = function() { + return console.warn("AG Grid: getInfinitePageState() is now called getCacheBlockState(), please call getCacheBlockState() instead"), this.getCacheBlockState(); + }, M.prototype.getCacheBlockState = function() { + return this.rowNodeBlockLoader.getBlockState(); + }, M.prototype.checkGridSize = function() { + console.warn("in AG Grid v25.2.0, checkGridSize() was removed, as it was legacy and didn't do anything uesful."); + }, M.prototype.getFirstRenderedRow = function() { + return console.warn("in AG Grid v12, getFirstRenderedRow() was renamed to getFirstDisplayedRow()"), this.getFirstDisplayedRow(); + }, M.prototype.getFirstDisplayedRow = function() { + return this.rowRenderer.getFirstVirtualRenderedRow(); + }, M.prototype.getLastRenderedRow = function() { + return console.warn("in AG Grid v12, getLastRenderedRow() was renamed to getLastDisplayedRow()"), this.getLastDisplayedRow(); + }, M.prototype.getLastDisplayedRow = function() { + return this.rowRenderer.getLastVirtualRenderedRow(); + }, M.prototype.getDisplayedRowAtIndex = function(f) { + return this.rowModel.getRow(f); + }, M.prototype.getDisplayedRowCount = function() { + return this.rowModel.getRowCount(); + }, M.prototype.paginationIsLastPageFound = function() { + return this.paginationProxy.isLastPageFound(); + }, M.prototype.paginationGetPageSize = function() { + return this.paginationProxy.getPageSize(); + }, M.prototype.paginationSetPageSize = function(f) { + this.gridOptionsWrapper.setProperty("paginationPageSize", f); + }, M.prototype.paginationGetCurrentPage = function() { + return this.paginationProxy.getCurrentPage(); + }, M.prototype.paginationGetTotalPages = function() { + return this.paginationProxy.getTotalPages(); + }, M.prototype.paginationGetRowCount = function() { + return this.paginationProxy.getMasterRowCount(); + }, M.prototype.paginationGoToNextPage = function() { + this.paginationProxy.goToNextPage(); + }, M.prototype.paginationGoToPreviousPage = function() { + this.paginationProxy.goToPreviousPage(); + }, M.prototype.paginationGoToFirstPage = function() { + this.paginationProxy.goToFirstPage(); + }, M.prototype.paginationGoToLastPage = function() { + this.paginationProxy.goToLastPage(); + }, M.prototype.paginationGoToPage = function(f) { + this.paginationProxy.goToPage(f); + }, M.prototype.setRowClass = function(f) { + this.gridOptionsWrapper.setProperty(jn.PROP_ROW_CLASS, f); + }, jl([ + Ae("immutableService") + ], M.prototype, "immutableService", void 0), jl([ + Ae("csvCreator") + ], M.prototype, "csvCreator", void 0), jl([ + Ae("excelCreator") + ], M.prototype, "excelCreator", void 0), jl([ + pe("rowRenderer") + ], M.prototype, "rowRenderer", void 0), jl([ + pe("navigationService") + ], M.prototype, "navigationService", void 0), jl([ + pe("filterManager") + ], M.prototype, "filterManager", void 0), jl([ + pe("columnModel") + ], M.prototype, "columnModel", void 0), jl([ + pe("selectionService") + ], M.prototype, "selectionService", void 0), jl([ + pe("gridOptionsWrapper") + ], M.prototype, "gridOptionsWrapper", void 0), jl([ + pe("valueService") + ], M.prototype, "valueService", void 0), jl([ + pe("alignedGridsService") + ], M.prototype, "alignedGridsService", void 0), jl([ + pe("eventService") + ], M.prototype, "eventService", void 0), jl([ + pe("pinnedRowModel") + ], M.prototype, "pinnedRowModel", void 0), jl([ + pe("context") + ], M.prototype, "context", void 0), jl([ + pe("rowModel") + ], M.prototype, "rowModel", void 0), jl([ + pe("sortController") + ], M.prototype, "sortController", void 0), jl([ + pe("paginationProxy") + ], M.prototype, "paginationProxy", void 0), jl([ + pe("focusService") + ], M.prototype, "focusService", void 0), jl([ + pe("dragAndDropService") + ], M.prototype, "dragAndDropService", void 0), jl([ + Ae("rangeService") + ], M.prototype, "rangeService", void 0), jl([ + Ae("clipboardService") + ], M.prototype, "clipboardService", void 0), jl([ + Ae("aggFuncService") + ], M.prototype, "aggFuncService", void 0), jl([ + pe("menuFactory") + ], M.prototype, "menuFactory", void 0), jl([ + Ae("contextMenuFactory") + ], M.prototype, "contextMenuFactory", void 0), jl([ + pe("valueCache") + ], M.prototype, "valueCache", void 0), jl([ + pe("animationFrameService") + ], M.prototype, "animationFrameService", void 0), jl([ + Ae("statusBarService") + ], M.prototype, "statusBarService", void 0), jl([ + Ae("chartService") + ], M.prototype, "chartService", void 0), jl([ + Ae("undoRedoService") + ], M.prototype, "undoRedoService", void 0), jl([ + Ae("rowNodeBlockLoader") + ], M.prototype, "rowNodeBlockLoader", void 0), jl([ + Ae("ssrmTransactionManager") + ], M.prototype, "serverSideTransactionManager", void 0), jl([ + pe("ctrlsService") + ], M.prototype, "ctrlsService", void 0), jl([ + Ae("frameworkComponentWrapper") + ], M.prototype, "frameworkComponentWrapper", void 0), jl([ + ct + ], M.prototype, "init", null), jl([ + gt + ], M.prototype, "cleanDownReferencesToAvoidMemoryLeakInCaseApplicationIsKeepingReferenceToDestroyedGrid", null), M = jl([ + Ne("gridApi") + ], M), M; + }() + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var b9 = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), JH = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, cR = ( + /** @class */ + function(M) { + b9(f, M); + function f(d, g, S, O) { + var z = M.call(this) || this; + return z.columnOrGroup = d, z.eCell = g, z.ariaEl = z.eCell.querySelector("[role=columnheader]") || z.eCell, z.colsSpanning = O, z.beans = S, z; + } + return f.prototype.setColsSpanning = function(d) { + this.colsSpanning = d, this.onLeftChanged(); + }, f.prototype.getColumnOrGroup = function() { + return this.beans.gridOptionsWrapper.isEnableRtl() && this.colsSpanning ? m(this.colsSpanning) : this.columnOrGroup; + }, f.prototype.postConstruct = function() { + this.addManagedListener(this.columnOrGroup, H.EVENT_LEFT_CHANGED, this.onLeftChanged.bind(this)), this.setLeftFirstTime(), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_WIDTH_CHANGED, this.onLeftChanged.bind(this)), this.addManagedListener(this.beans.gridOptionsWrapper, jn.PROP_DOM_LAYOUT, this.onLeftChanged.bind(this)); + }, f.prototype.setLeftFirstTime = function() { + var d = this.beans.gridOptionsWrapper.isSuppressColumnMoveAnimation(), g = i(this.columnOrGroup.getOldLeft()), S = this.beans.columnAnimationService.isActive() && g && !d; + S ? this.animateInLeft() : this.onLeftChanged(); + }, f.prototype.animateInLeft = function() { + var d = this, g = this.getColumnOrGroup(), S = g.getLeft(), O = g.getOldLeft(), z = this.modifyLeftForPrintLayout(g, O), te = this.modifyLeftForPrintLayout(g, S); + this.setLeft(z), this.actualLeft = te, this.beans.columnAnimationService.executeNextVMTurn(function() { + d.actualLeft === te && d.setLeft(te); + }); + }, f.prototype.onLeftChanged = function() { + var d = this.getColumnOrGroup(), g = d.getLeft(); + this.actualLeft = this.modifyLeftForPrintLayout(d, g), this.setLeft(this.actualLeft); + }, f.prototype.modifyLeftForPrintLayout = function(d, g) { + var S = this.beans.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_PRINT; + if (!S || d.getPinned() === Ue.PINNED_LEFT) + return g; + var O = this.beans.columnModel.getDisplayedColumnsLeftWidth(); + if (d.getPinned() === Ue.PINNED_RIGHT) { + var z = this.beans.columnModel.getBodyContainerWidth(); + return O + z + g; + } + return O + g; + }, f.prototype.setLeft = function(d) { + i(d) && (this.eCell.style.left = d + "px"); + var g; + if (this.columnOrGroup instanceof H) + g = this.columnOrGroup; + else { + var S = this.columnOrGroup, O = S.getLeafColumns(); + if (!O.length) + return; + O.length > 1 && pf(this.ariaEl, O.length), g = O[0]; + } + var z = this.beans.columnModel.getAriaColumnIndex(g); + fd(this.ariaEl, z); + }, JH([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Qre = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), w9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, x9 = ( + /** @class */ + function(M) { + Qre(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.columns = d, S.element = g, S; + } + return f.prototype.postConstruct = function() { + this.gridOptionsWrapper.isColumnHoverHighlight() && this.addMouseHoverListeners(); + }, f.prototype.addMouseHoverListeners = function() { + this.addManagedListener(this.element, "mouseout", this.onMouseOut.bind(this)), this.addManagedListener(this.element, "mouseover", this.onMouseOver.bind(this)); + }, f.prototype.onMouseOut = function() { + this.columnHoverService.clearMouseOver(); + }, f.prototype.onMouseOver = function() { + this.columnHoverService.setMouseOver(this.columns); + }, w9([ + pe("columnHoverService") + ], f.prototype, "columnHoverService", void 0), w9([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var ene = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), UC = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ZH = ( + /** @class */ + function(M) { + ene(f, M); + function f(d, g) { + var S = M.call(this, d, g) || this; + return S.column = d, S; + } + return f.prototype.setComp = function(d, g, S, O) { + M.prototype.setGui.call(this, g), this.comp = d, this.eButtonShowMainFilter = S, this.eFloatingFilterBody = O; + var z = this.column.getColDef(), te = !!z.filter || !!z.filterFramework, Fe = !!z.floatingFilter; + this.active = te && Fe, this.setupWidth(), this.setupLeft(), this.setupHover(), this.setupFocus(), this.setupUserComp(), this.setupSyncWithFilter(), this.setupUi(), this.addManagedListener(this.eButtonShowMainFilter, "click", this.showParentFilter.bind(this)); + }, f.prototype.setupUi = function() { + if (this.comp.addOrRemoveButtonWrapperCssClass("ag-hidden", !this.active || this.suppressFilterButton), !!this.active) { + this.comp.addOrRemoveBodyCssClass("ag-floating-filter-full-body", this.suppressFilterButton), this.comp.addOrRemoveBodyCssClass("ag-floating-filter-body", !this.suppressFilterButton); + var d = Xl("filter", this.gridOptionsWrapper, this.column); + d && this.eButtonShowMainFilter.appendChild(d); + } + }, f.prototype.setupFocus = function() { + this.createManagedBean(new R1(this.eGui, { + shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this), + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this) + })); + }, f.prototype.onTabKeyDown = function(d) { + var g = this.gridOptionsWrapper.getDocument(), S = g.activeElement, O = S === this.eGui; + if (!O) { + var z = this.focusService.findNextFocusableElement(this.eGui, null, d.shiftKey); + if (z) { + this.beans.headerNavigationService.scrollToColumn(this.column), d.preventDefault(), z.focus(); + return; + } + var te = this.findNextColumnWithFloatingFilter(d.shiftKey); + te && this.focusService.focusHeaderPosition({ + headerPosition: { + headerRowIndex: this.getParentRowCtrl().getRowIndex(), + column: te + }, + event: d + }) && d.preventDefault(); + } + }, f.prototype.findNextColumnWithFloatingFilter = function(d) { + var g = this.beans.columnModel, S = this.column; + do + if (S = d ? g.getDisplayedColBefore(S) : g.getDisplayedColAfter(S), !S) + break; + while (!S.getColDef().filter || !S.getColDef().floatingFilter); + return S; + }, f.prototype.handleKeyDown = function(d) { + var g = this.gridOptionsWrapper.getDocument(), S = g.activeElement, O = S === this.eGui; + switch (d.key) { + case Hr.UP: + case Hr.DOWN: + O || d.preventDefault(); + case Hr.LEFT: + case Hr.RIGHT: + if (O) + return; + d.stopPropagation(); + case Hr.ENTER: + O && this.focusService.focusInto(this.eGui) && d.preventDefault(); + break; + case Hr.ESCAPE: + O || this.eGui.focus(); + } + }, f.prototype.onFocusIn = function(d) { + var g = this.eGui.contains(d.relatedTarget); + if (!g) { + var S = !!d.relatedTarget && !d.relatedTarget.classList.contains("ag-floating-filter"), O = !!d.relatedTarget && hi(d.relatedTarget, "ag-floating-filter"); + if (S && O && d.target === this.eGui) { + var z = this.lastFocusEvent, te = !!(z && z.key === Hr.TAB); + if (z && te) { + var Fe = z.shiftKey; + this.focusService.focusInto(this.eGui, Fe); + } + } + var ze = this.getRowIndex(); + this.beans.focusService.setFocusedHeader(ze, this.column); + } + }, f.prototype.setupHover = function() { + var d = this; + this.createManagedBean(new x9([this.column], this.eGui)); + var g = function() { + if (d.gridOptionsWrapper.isColumnHoverHighlight()) { + var S = d.columnHoverService.isHovered(d.column); + d.comp.addOrRemoveCssClass("ag-column-hover", S); + } + }; + this.addManagedListener(this.eventService, ui.EVENT_COLUMN_HOVER_CHANGED, g), g(); + }, f.prototype.setupLeft = function() { + var d = new cR(this.column, this.eGui, this.beans); + this.createManagedBean(d); + }, f.prototype.setupUserComp = function() { + var d = this; + if (this.active) { + var g = this.column.getColDef(), S = this.filterManager.createFilterParams(this.column, g), O = this.userComponentFactory.mergeParamsWithApplicationProvidedParams(g, r2, S), z = this.userComponentFactory.getDefaultFloatingFilterType(g); + z == null && (z = "agReadOnlyFloatingFilter"); + var te = { + column: this.column, + filterParams: O, + currentParentModel: function() { + return d.currentParentModel(); + }, + parentFilterInstance: function(ze) { + return d.parentFilterInstance(ze); + }, + showParentFilter: function() { + return d.showParentFilter(); + }, + suppressFilterButton: !1 + // This one might be overridden from the colDef + }; + this.suppressFilterButton = g.floatingFilterComponentParams ? !!g.floatingFilterComponentParams.suppressFilterButton : !1; + var Fe = this.userComponentFactory.getFloatingFilterCompDetails(g, te, z); + Fe && this.comp.setCompDetails(Fe); + } + }, f.prototype.currentParentModel = function() { + var d = this.getFilterComponent(!1); + return d ? d.resolveNow(null, function(g) { + return g && g.getModel(); + }) : null; + }, f.prototype.getFilterComponent = function(d) { + return d === void 0 && (d = !0), this.filterManager.getFilterComponent(this.column, "NO_UI", d); + }, f.prototype.parentFilterInstance = function(d) { + var g = this.getFilterComponent(); + g?.then(function(S) { + d(Qb(S)); + }); + }, f.prototype.showParentFilter = function() { + var d = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter; + this.menuFactory.showMenuAfterButtonClick(this.column, d, "floatingFilter", "filterMenuTab", ["filterMenuTab"]); + }, f.prototype.setupSyncWithFilter = function() { + var d = this; + if (this.active) { + var g = function(S) { + var O = d.comp.getFloatingFilterComp(); + if (O) { + var z = d.currentParentModel(); + O.then(function(te) { + te && te.onParentModelChanged(z, S); + }); + } + }; + this.addManagedListener(this.column, H.EVENT_FILTER_CHANGED, g), this.filterManager.isFilterActive(this.column) && g(null); + } + }, f.prototype.setupWidth = function() { + var d = this, g = function() { + var S = d.column.getActualWidth() + "px"; + d.comp.setWidth(S); + }; + this.addManagedListener(this.column, H.EVENT_WIDTH_CHANGED, g), g(); + }, UC([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), UC([ + pe("filterManager") + ], f.prototype, "filterManager", void 0), UC([ + pe("columnHoverService") + ], f.prototype, "columnHoverService", void 0), UC([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), UC([ + pe("menuFactory") + ], f.prototype, "menuFactory", void 0), UC([ + pe("beans") + ], f.prototype, "beans", void 0), f; + }(GC) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var tne = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), S9 = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, ine = ( + /** @class */ + function(M) { + tne(f, M); + function f(d, g, S, O, z) { + var te = M.call(this) || this; + return te.pinned = d, te.column = g, te.eResize = S, te.comp = O, te.ctrl = z, te; + } + return f.prototype.postConstruct = function() { + var d = this, g = this.column.getColDef(), S = [], O, z, te = function() { + if (al(d.eResize, O), !!O) { + var ht = d.horizontalResizeService.addResizeBar({ + eResizeBar: d.eResize, + onResizeStart: d.onResizeStart.bind(d), + onResizing: d.onResizing.bind(d, !1), + onResizeEnd: d.onResizing.bind(d, !0) + }); + if (S.push(ht), z) { + var Lt = d.gridOptionsWrapper.isSkipHeaderOnAutoSize(), ti = function() { + d.columnModel.autoSizeColumn(d.column, Lt, "uiColumnResized"); + }; + d.eResize.addEventListener("dblclick", ti); + var wi = new pg(d.eResize); + wi.addEventListener(pg.EVENT_DOUBLE_TAP, ti), d.addDestroyFunc(function() { + d.eResize.removeEventListener("dblclick", ti), wi.removeEventListener(pg.EVENT_DOUBLE_TAP, ti), wi.destroy(); + }); + } + } + }, Fe = function() { + S.forEach(function(ht) { + return ht(); + }), S.length = 0; + }, ze = function() { + var ht = d.column.isResizable(), Lt = !d.gridOptionsWrapper.isSuppressAutoSize() && !g.suppressAutoSize, ti = ht !== O || Lt !== z; + ti && (O = ht, z = Lt, Fe(), te()); + }; + ze(), this.addDestroyFunc(Fe), this.ctrl.addRefreshFunction(ze); + }, f.prototype.onResizing = function(d, g) { + var S = this.normaliseResizeAmount(g), O = [{ key: this.column, newWidth: this.resizeStartWidth + S }]; + this.columnModel.setColumnWidths(O, this.resizeWithShiftKey, d, "uiColumnDragged"), d && this.comp.addOrRemoveCssClass("ag-column-resizing", !1); + }, f.prototype.onResizeStart = function(d) { + this.resizeStartWidth = this.column.getActualWidth(), this.resizeWithShiftKey = d, this.comp.addOrRemoveCssClass("ag-column-resizing", !0); + }, f.prototype.normaliseResizeAmount = function(d) { + var g = d, S = this.pinned !== Ue.PINNED_LEFT, O = this.pinned === Ue.PINNED_RIGHT; + return this.gridOptionsWrapper.isEnableRtl() ? S && (g *= -1) : O && (g *= -1), g; + }, S9([ + pe("horizontalResizeService") + ], f.prototype, "horizontalResizeService", void 0), S9([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), S9([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var rne = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), hA = ( + /** @class */ + function(M) { + rne(f, M); + function f(d, g, S) { + g === void 0 && (g = "ag-checkbox"), S === void 0 && (S = "checkbox"); + var O = M.call(this, d, g, S) || this; + return O.labelAlignment = "right", O.selected = !1, O.readOnly = !1, O.passive = !1, O; + } + return f.prototype.addInputListeners = function() { + this.addManagedListener(this.eInput, "click", this.onCheckboxClick.bind(this)), this.addManagedListener(this.eLabel, "click", this.toggle.bind(this)); + }, f.prototype.getNextValue = function() { + return this.selected === void 0 ? !0 : !this.selected; + }, f.prototype.setPassive = function(d) { + this.passive = d; + }, f.prototype.isReadOnly = function() { + return this.readOnly; + }, f.prototype.setReadOnly = function(d) { + this.eWrapper.classList.toggle("ag-disabled", d), this.eInput.disabled = d, this.readOnly = d; + }, f.prototype.setDisabled = function(d) { + return this.eWrapper.classList.toggle("ag-disabled", d), M.prototype.setDisabled.call(this, d); + }, f.prototype.toggle = function() { + if (!this.eInput.disabled) { + var d = this.isSelected(), g = this.getNextValue(); + this.passive ? this.dispatchChange(g, d) : this.setValue(g); + } + }, f.prototype.getValue = function() { + return this.isSelected(); + }, f.prototype.setValue = function(d, g) { + return this.refreshSelectedClass(d), this.setSelected(d, g), this; + }, f.prototype.setName = function(d) { + var g = this.getInputElement(); + return g.name = d, this; + }, f.prototype.isSelected = function() { + return this.selected; + }, f.prototype.setSelected = function(d, g) { + this.isSelected() !== d && (this.previousValue = this.isSelected(), d = this.selected = typeof d == "boolean" ? d : void 0, this.eInput.checked = d, this.eInput.indeterminate = d === void 0, g || this.dispatchChange(this.selected, this.previousValue)); + }, f.prototype.dispatchChange = function(d, g, S) { + this.dispatchEvent({ type: f.EVENT_CHANGED, selected: d, previousValue: g, event: S }); + var O = this.getInputElement(), z = { + type: ui.EVENT_CHECKBOX_CHANGED, + id: O.id, + name: O.name, + selected: d, + previousValue: g + }; + this.eventService.dispatchEvent(z); + }, f.prototype.onCheckboxClick = function(d) { + if (!(this.passive || this.eInput.disabled)) { + var g = this.isSelected(), S = this.selected = d.target.checked; + this.refreshSelectedClass(S), this.dispatchChange(S, g, d); + } + }, f.prototype.refreshSelectedClass = function(d) { + this.eWrapper.classList.toggle("ag-checked", d === !0), this.eWrapper.classList.toggle("ag-indeterminate", d == null); + }, f; + }(Wv) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var QH = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), hR = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, nne = ( + /** @class */ + function(M) { + QH(f, M); + function f(d) { + var g = M.call(this) || this; + g.cbSelectAllVisible = !1, g.processingEventFromCheckbox = !1, g.column = d; + var S = d.getColDef(); + return g.filteredOnly = S ? !!S.headerCheckboxSelectionFilteredOnly : !1, g; + } + return f.prototype.onSpaceKeyPressed = function(d) { + var g = this.cbSelectAll, S = this.gridOptionsWrapper.getDocument(); + g.isDisplayed() && !g.getGui().contains(S.activeElement) && (d.preventDefault(), g.setValue(!g.getValue())); + }, f.prototype.getCheckboxGui = function() { + return this.cbSelectAll.getGui(); + }, f.prototype.setComp = function(d) { + this.headerCellCtrl = d, this.cbSelectAll = this.createManagedBean(new hA()), this.cbSelectAll.addCssClass("ag-header-select-all"), tr(this.cbSelectAll.getGui(), "presentation"), this.showOrHideSelectAll(), this.addManagedListener(this.eventService, ui.EVENT_NEW_COLUMNS_LOADED, this.showOrHideSelectAll.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, this.showOrHideSelectAll.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_SELECTION_CHANGED, this.onSelectionChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_MODEL_UPDATED, this.onModelChanged.bind(this)), this.addManagedListener(this.cbSelectAll, hA.EVENT_CHANGED, this.onCbSelectAll.bind(this)), this.cbSelectAll.getInputElement().setAttribute("tabindex", "-1"), this.refreshSelectAllLabel(); + }, f.prototype.showOrHideSelectAll = function() { + this.cbSelectAllVisible = this.isCheckboxSelection(), this.cbSelectAll.setDisplayed(this.cbSelectAllVisible), this.cbSelectAllVisible && (this.checkRightRowModelType(), this.updateStateOfCheckbox()), this.refreshSelectAllLabel(); + }, f.prototype.onModelChanged = function() { + this.cbSelectAllVisible && this.updateStateOfCheckbox(); + }, f.prototype.onSelectionChanged = function() { + this.cbSelectAllVisible && this.updateStateOfCheckbox(); + }, f.prototype.getNextCheckboxState = function(d) { + return d.selected === 0 && d.notSelected === 0 ? !1 : d.selected > 0 && d.notSelected > 0 ? null : d.selected > 0; + }, f.prototype.updateStateOfCheckbox = function() { + if (!this.processingEventFromCheckbox) { + this.processingEventFromCheckbox = !0; + var d = this.getSelectionCount(), g = this.getNextCheckboxState(d); + this.cbSelectAll.setValue(g), this.refreshSelectAllLabel(), this.processingEventFromCheckbox = !1; + } + }, f.prototype.refreshSelectAllLabel = function() { + if (!this.cbSelectAllVisible) + this.headerCellCtrl.setAriaDescriptionProperty("selectAll", null); + else { + var d = this.gridOptionsWrapper.getLocaleTextFunc(), g = this.cbSelectAll.getValue(), S = g ? d("ariaChecked", "checked") : d("ariaUnchecked", "unchecked"), O = d("ariaRowSelectAll", "Press Space to toggle all rows selection"); + this.headerCellCtrl.setAriaDescriptionProperty("selectAll", O + " (" + S + ")"); + } + this.headerCellCtrl.refreshAriaDescription(); + }, f.prototype.getSelectionCount = function() { + var d = this, g = 0, S = 0, O = function(z) { + d.gridOptionsWrapper.isGroupSelectsChildren() && z.group || (z.isSelected() ? g++ : z.selectable && S++); + }; + return this.filteredOnly ? this.gridApi.forEachNodeAfterFilter(O) : this.gridApi.forEachNode(O), { + notSelected: S, + selected: g + }; + }, f.prototype.checkRightRowModelType = function() { + var d = this.rowModel.getType(), g = d === Ue.ROW_MODEL_TYPE_CLIENT_SIDE; + g || console.warn("AG Grid: selectAllCheckbox is only available if using normal row model, you are using " + d); + }, f.prototype.onCbSelectAll = function() { + if (!this.processingEventFromCheckbox && this.cbSelectAllVisible) { + var d = this.cbSelectAll.getValue(); + d ? this.selectionService.selectAllRowNodes(this.filteredOnly) : this.selectionService.deselectAllRowNodes(this.filteredOnly); + } + }, f.prototype.isCheckboxSelection = function() { + var d = this.column.getColDef().headerCheckboxSelection; + if (typeof d == "function") { + var g = d, S = { + column: this.column, + colDef: this.column.getColDef(), + columnApi: this.columnApi, + api: this.gridApi, + context: this.gridOptionsWrapper.getContext() + }; + d = g(S); + } + return d ? this.gridOptionsWrapper.isRowModelServerSide() ? (console.warn("AG Grid: headerCheckboxSelection is not supported for Server Side Row Model"), !1) : this.gridOptionsWrapper.isRowModelInfinite() ? (console.warn("AG Grid: headerCheckboxSelection is not supported for Infinite Row Model"), !1) : this.gridOptionsWrapper.isRowModelViewport() ? (console.warn("AG Grid: headerCheckboxSelection is not supported for Viewport Row Model"), !1) : !0 : !1; + }, hR([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), hR([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), hR([ + pe("rowModel") + ], f.prototype, "rowModel", void 0), hR([ + pe("selectionService") + ], f.prototype, "selectionService", void 0), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var C_e = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), ew = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, U = ( + /** @class */ + function(M) { + C_e(f, M); + function f(d, g) { + var S = M.call(this, d, g) || this; + return S.refreshFunctions = [], S.userHeaderClasses = /* @__PURE__ */ new Set(), S.ariaDescriptionProperties = /* @__PURE__ */ new Map(), S.column = d, S; + } + return f.prototype.setComp = function(d, g, S) { + var O = this; + M.prototype.setGui.call(this, g), this.comp = d, this.colDefVersion = this.columnModel.getColDefVersion(), this.updateState(), this.setupWidth(), this.setupMovingCss(), this.setupMenuClass(), this.setupSortableClass(), this.addColumnHoverListener(), this.setupFilterCss(), this.setupColId(), this.setupClassesFromColDef(), this.setupTooltip(), this.addActiveHeaderMouseListeners(), this.setupSelectAll(), this.setupUserComp(), this.refreshAria(), this.createManagedBean(new ine(this.getPinned(), this.column, S, d, this)), this.createManagedBean(new x9([this.column], g)), this.createManagedBean(new cR(this.column, g, this.beans)), this.createManagedBean(new R1(g, { + shouldStopEventPropagation: function(z) { + return O.shouldStopEventPropagation(z); + }, + onTabKeyDown: function() { + return null; + }, + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this), + onFocusOut: this.onFocusOut.bind(this) + })), this.addManagedListener(this.eventService, ui.EVENT_NEW_COLUMNS_LOADED, this.onNewColumnsLoaded.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_VALUE_CHANGED, this.onColumnValueChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_ROW_GROUP_CHANGED, this.onColumnRowGroupChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_COLUMN_PIVOT_CHANGED, this.onColumnPivotChanged.bind(this)); + }, f.prototype.setupUserComp = function() { + var d = this.lookupUserCompDetails(); + this.setCompDetails(d); + }, f.prototype.setCompDetails = function(d) { + this.userCompDetails = d, this.comp.setUserCompDetails(d); + }, f.prototype.lookupUserCompDetails = function() { + var d = this.createParams(), g = this.column.getColDef(); + return this.userComponentFactory.getHeaderCompDetails(g, d); + }, f.prototype.createParams = function() { + var d = this, g = this.column.getColDef(), S = { + column: this.column, + displayName: this.displayName, + enableSorting: g.sortable, + enableMenu: this.menuEnabled, + showColumnMenu: function(O) { + d.gridApi.showColumnMenuAfterButtonClick(d.column, O); + }, + progressSort: function(O) { + d.sortController.progressSort(d.column, !!O, "uiColumnSorted"); + }, + setSort: function(O, z) { + d.sortController.setSortForColumn(d.column, O, !!z, "uiColumnSorted"); + }, + api: this.gridApi, + columnApi: this.columnApi, + context: this.gridOptionsWrapper.getContext(), + eGridHeader: this.getGui() + }; + return S; + }, f.prototype.setupSelectAll = function() { + this.selectAllFeature = this.createManagedBean(new nne(this.column)), this.selectAllFeature.setComp(this); + }, f.prototype.getSelectAllGui = function() { + return this.selectAllFeature.getCheckboxGui(); + }, f.prototype.handleKeyDown = function(d) { + d.key === Hr.SPACE && this.selectAllFeature.onSpaceKeyPressed(d), d.key === Hr.ENTER && this.onEnterKeyPressed(d); + }, f.prototype.onEnterKeyPressed = function(d) { + var g = this.comp.getUserCompInstance(); + if (g) { + if (d.ctrlKey || d.metaKey) + this.menuEnabled && g.showMenu && (d.preventDefault(), g.showMenu()); + else if (this.sortable) { + var S = d.shiftKey; + this.sortController.progressSort(this.column, S, "uiColumnSorted"); + } + } + }, f.prototype.isMenuEnabled = function() { + return this.menuEnabled; + }, f.prototype.onFocusIn = function(d) { + if (!this.getGui().contains(d.relatedTarget)) { + var g = this.getRowIndex(); + this.focusService.setFocusedHeader(g, this.column); + } + this.setActiveHeader(!0); + }, f.prototype.onFocusOut = function(d) { + this.getGui().contains(d.relatedTarget) || this.setActiveHeader(!1); + }, f.prototype.setupTooltip = function() { + var d = this, g = { + getColumn: function() { + return d.column; + }, + getColDef: function() { + return d.column.getColDef(); + }, + getGui: function() { + return d.eGui; + }, + getLocation: function() { + return "header"; + }, + getTooltipValue: function() { + var O = d.column.getColDef().headerTooltip; + return O; + } + }, S = this.createManagedBean(new Kb(g, this.beans)); + S.setComp(this.comp), this.refreshFunctions.push(function() { + return S.refreshToolTip(); + }); + }, f.prototype.setupClassesFromColDef = function() { + var d = this, g = function() { + var S = d.column.getColDef(), O = d.gridOptionsWrapper, z = g9.getHeaderClassesFromColDef(S, O, d.column, null), te = d.userHeaderClasses; + d.userHeaderClasses = new Set(z), z.forEach(function(Fe) { + te.has(Fe) ? te.delete(Fe) : d.comp.addOrRemoveCssClass(Fe, !0); + }), te.forEach(function(Fe) { + return d.comp.addOrRemoveCssClass(Fe, !1); + }); + }; + this.refreshFunctions.push(g), g(); + }, f.prototype.setDragSource = function(d) { + var g = this; + this.dragSourceElement = d, this.removeDragSource(), d && this.draggable && (this.moveDragSource = { + type: t.DragSourceType.HeaderCell, + eElement: d, + defaultIconName: fg.ICON_HIDE, + getDragItem: function() { + return g.createDragItem(); + }, + dragItemName: this.displayName, + onDragStarted: function() { + return g.column.setMoving(!0, "uiColumnMoved"); + }, + onDragStopped: function() { + return g.column.setMoving(!1, "uiColumnMoved"); + } + }, this.dragAndDropService.addDragSource(this.moveDragSource, !0)); + }, f.prototype.createDragItem = function() { + var d = {}; + return d[this.column.getId()] = this.column.isVisible(), { + columns: [this.column], + visibleState: d + }; + }, f.prototype.removeDragSource = function() { + this.moveDragSource && (this.dragAndDropService.removeDragSource(this.moveDragSource), this.moveDragSource = void 0); + }, f.prototype.onNewColumnsLoaded = function() { + var d = this.columnModel.getColDefVersion(); + d != this.colDefVersion && (this.colDefVersion = d, this.refresh()); + }, f.prototype.updateState = function() { + var d = this.column.getColDef(); + this.menuEnabled = this.menuFactory.isMenuEnabled(this.column) && !d.suppressMenu, this.sortable = d.sortable, this.displayName = this.calculateDisplayName(), this.draggable = this.workOutDraggable(); + }, f.prototype.addRefreshFunction = function(d) { + this.refreshFunctions.push(d); + }, f.prototype.refresh = function() { + this.updateState(), this.refreshHeaderComp(), this.refreshAria(), this.refreshFunctions.forEach(function(d) { + return d(); + }); + }, f.prototype.refreshHeaderComp = function() { + var d = this.lookupUserCompDetails(), g = this.comp.getUserCompInstance(), S = g != null && this.userCompDetails.componentClass == d.componentClass, O = S ? this.attemptHeaderCompRefresh(d.params) : !1; + O ? this.setDragSource(this.dragSourceElement) : this.setCompDetails(d); + }, f.prototype.attemptHeaderCompRefresh = function(d) { + var g = this.comp.getUserCompInstance(); + if (!g || !g.refresh) + return !1; + var S = g.refresh(d); + return S; + }, f.prototype.calculateDisplayName = function() { + return this.columnModel.getDisplayNameForColumn(this.column, "header", !0); + }, f.prototype.checkDisplayName = function() { + this.displayName !== this.calculateDisplayName() && this.refresh(); + }, f.prototype.workOutDraggable = function() { + var d = this.column.getColDef(), g = this.gridOptionsWrapper.isSuppressMovableColumns(), S = !g && !d.suppressMovable && !d.lockPosition; + return !!S || !!d.enableRowGroup || !!d.enablePivot; + }, f.prototype.onColumnRowGroupChanged = function() { + this.checkDisplayName(); + }, f.prototype.onColumnPivotChanged = function() { + this.checkDisplayName(); + }, f.prototype.onColumnValueChanged = function() { + this.checkDisplayName(); + }, f.prototype.setupWidth = function() { + var d = this, g = function() { + d.comp.setWidth(d.column.getActualWidth() + "px"); + }; + this.addManagedListener(this.column, H.EVENT_WIDTH_CHANGED, g), g(); + }, f.prototype.setupMovingCss = function() { + var d = this, g = function() { + d.comp.addOrRemoveCssClass("ag-header-cell-moving", d.column.isMoving()); + }; + this.addManagedListener(this.column, H.EVENT_MOVING_CHANGED, g), g(); + }, f.prototype.setupMenuClass = function() { + var d = this, g = function() { + d.comp.addOrRemoveCssClass("ag-column-menu-visible", d.column.isMenuVisible()); + }; + this.addManagedListener(this.column, H.EVENT_MENU_VISIBLE_CHANGED, g), g(); + }, f.prototype.setupSortableClass = function() { + var d = this, g = function() { + d.comp.addOrRemoveCssClass("ag-header-cell-sortable", !!d.sortable); + }; + g(), this.addRefreshFunction(g), this.addManagedListener(this.column, H.EVENT_SORT_CHANGED, this.refreshAriaSort.bind(this)); + }, f.prototype.refreshAriaSort = function() { + if (this.sortable) { + var d = this.gridOptionsWrapper.getLocaleTextFunc(); + this.comp.setAriaSort(Ir(this.column)), this.setAriaDescriptionProperty("sort", d("ariaSortableColumn", "Press ENTER to sort.")); + } else + this.comp.setAriaSort(), this.setAriaDescriptionProperty("sort", null); + }, f.prototype.refreshAriaMenu = function() { + if (this.menuEnabled) { + var d = this.gridOptionsWrapper.getLocaleTextFunc(); + this.setAriaDescriptionProperty("menu", d("ariaMenuColumn", "Press CTRL ENTER to open column menu.")); + } else + this.setAriaDescriptionProperty("menu", null); + }, f.prototype.setAriaDescriptionProperty = function(d, g) { + g != null ? this.ariaDescriptionProperties.set(d, g) : this.ariaDescriptionProperties.delete(d); + }, f.prototype.refreshAriaDescription = function() { + var d = Array.from(this.ariaDescriptionProperties.values()); + this.comp.setAriaDescription(d.length ? d.join(" ") : void 0); + }, f.prototype.refreshAria = function() { + this.refreshAriaSort(), this.refreshAriaMenu(), this.refreshAriaDescription(); + }, f.prototype.addColumnHoverListener = function() { + var d = this, g = function() { + if (d.gridOptionsWrapper.isColumnHoverHighlight()) { + var S = d.columnHoverService.isHovered(d.column); + d.comp.addOrRemoveCssClass("ag-column-hover", S); + } + }; + this.addManagedListener(this.eventService, ui.EVENT_COLUMN_HOVER_CHANGED, g), g(); + }, f.prototype.setupFilterCss = function() { + var d = this, g = function() { + d.comp.addOrRemoveCssClass("ag-header-cell-filtered", d.column.isFilterActive()); + }; + this.addManagedListener(this.column, H.EVENT_FILTER_ACTIVE_CHANGED, g), g(); + }, f.prototype.setupColId = function() { + this.comp.setColId(this.column.getColId()); + }, f.prototype.addActiveHeaderMouseListeners = function() { + var d = this, g = function(S) { + return d.setActiveHeader(S.type === "mouseenter"); + }; + this.addManagedListener(this.getGui(), "mouseenter", g), this.addManagedListener(this.getGui(), "mouseleave", g); + }, f.prototype.setActiveHeader = function(d) { + this.comp.addOrRemoveCssClass("ag-header-active", d); + }, ew([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), ew([ + pe("columnHoverService") + ], f.prototype, "columnHoverService", void 0), ew([ + pe("beans") + ], f.prototype, "beans", void 0), ew([ + pe("sortController") + ], f.prototype, "sortController", void 0), ew([ + pe("menuFactory") + ], f.prototype, "menuFactory", void 0), ew([ + pe("dragAndDropService") + ], f.prototype, "dragAndDropService", void 0), ew([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), ew([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), ew([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), ew([ + gt + ], f.prototype, "removeDragSource", null), f; + }(GC) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var R = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), u = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, w = ( + /** @class */ + function(M) { + R(f, M); + function f(d, g, S, O) { + var z = M.call(this) || this; + return z.eResize = g, z.comp = d, z.pinned = S, z.columnGroup = O, z; + } + return f.prototype.postConstruct = function() { + var d = this; + if (!this.columnGroup.isResizable()) { + this.comp.addOrRemoveResizableCssClass("ag-hidden", !0); + return; + } + var g = this.horizontalResizeService.addResizeBar({ + eResizeBar: this.eResize, + onResizeStart: this.onResizeStart.bind(this), + onResizing: this.onResizing.bind(this, !1), + onResizeEnd: this.onResizing.bind(this, !0) + }); + if (this.addDestroyFunc(g), !this.gridOptionsWrapper.isSuppressAutoSize()) { + var S = this.gridOptionsWrapper.isSkipHeaderOnAutoSize(); + this.eResize.addEventListener("dblclick", function() { + var O = [], z = d.columnGroup.getDisplayedLeafColumns(); + z.forEach(function(te) { + te.getColDef().suppressAutoSize || O.push(te.getColId()); + }), O.length > 0 && d.columnModel.autoSizeColumns({ + columns: O, + skipHeader: S, + stopAtGroup: d.columnGroup, + source: "uiColumnResized" + }), d.resizeLeafColumnsToFit(); + }); + } + }, f.prototype.onResizeStart = function(d) { + var g = this; + this.calculateInitialValues(); + var S = null; + if (d && (S = this.columnModel.getDisplayedGroupAfter(this.columnGroup)), S) { + var O = S.getDisplayedLeafColumns(); + this.resizeTakeFromCols = O.filter(function(z) { + return z.isResizable(); + }), this.resizeTakeFromStartWidth = 0, this.resizeTakeFromCols.forEach(function(z) { + return g.resizeTakeFromStartWidth += z.getActualWidth(); + }), this.resizeTakeFromRatios = [], this.resizeTakeFromCols.forEach(function(z) { + return g.resizeTakeFromRatios.push(z.getActualWidth() / g.resizeTakeFromStartWidth); + }); + } else + this.resizeTakeFromCols = null, this.resizeTakeFromStartWidth = null, this.resizeTakeFromRatios = null; + this.comp.addOrRemoveCssClass("ag-column-resizing", !0); + }, f.prototype.onResizing = function(d, g) { + var S = this.normaliseDragChange(g), O = this.resizeStartWidth + S; + this.resizeColumns(O, d); + }, f.prototype.resizeLeafColumnsToFit = function() { + var d = this.autoWidthCalculator.getPreferredWidthForColumnGroup(this.columnGroup); + this.calculateInitialValues(), d > this.resizeStartWidth && this.resizeColumns(d, !0); + }, f.prototype.resizeColumns = function(d, g) { + g === void 0 && (g = !0); + var S = []; + if (S.push({ + columns: this.resizeCols, + ratios: this.resizeRatios, + width: d + }), this.resizeTakeFromCols) { + var O = d - this.resizeStartWidth; + S.push({ + columns: this.resizeTakeFromCols, + ratios: this.resizeTakeFromRatios, + width: this.resizeTakeFromStartWidth - O + }); + } + this.columnModel.resizeColumnSets({ + resizeSets: S, + finished: g, + source: "uiColumnDragged" + }), g && this.comp.addOrRemoveCssClass("ag-column-resizing", !1); + }, f.prototype.calculateInitialValues = function() { + var d = this, g = this.columnGroup.getDisplayedLeafColumns(); + this.resizeCols = g.filter(function(S) { + return S.isResizable(); + }), this.resizeStartWidth = 0, this.resizeCols.forEach(function(S) { + return d.resizeStartWidth += S.getActualWidth(); + }), this.resizeRatios = [], this.resizeCols.forEach(function(S) { + return d.resizeRatios.push(S.getActualWidth() / d.resizeStartWidth); + }); + }, f.prototype.normaliseDragChange = function(d) { + var g = d; + return this.gridOptionsWrapper.isEnableRtl() ? this.pinned !== Ue.PINNED_LEFT && (g *= -1) : this.pinned === Ue.PINNED_RIGHT && (g *= -1), g; + }, u([ + pe("horizontalResizeService") + ], f.prototype, "horizontalResizeService", void 0), u([ + pe("autoWidthCalculator") + ], f.prototype, "autoWidthCalculator", void 0), u([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), u([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var $ = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), G = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, K = ( + /** @class */ + function(M) { + $(f, M); + function f(d, g) { + var S = M.call(this) || this; + return S.removeChildListenersFuncs = [], S.columnGroup = g, S.comp = d, S; + } + return f.prototype.postConstruct = function() { + this.addListenersToChildrenColumns(), this.addManagedListener(this.columnGroup, Zt.EVENT_DISPLAYED_CHILDREN_CHANGED, this.onDisplayedChildrenChanged.bind(this)), this.onWidthChanged(), this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this)); + }, f.prototype.addListenersToChildrenColumns = function() { + var d = this; + this.removeListenersOnChildrenColumns(); + var g = this.onWidthChanged.bind(this); + this.columnGroup.getLeafColumns().forEach(function(S) { + S.addEventListener(H.EVENT_WIDTH_CHANGED, g), S.addEventListener(H.EVENT_VISIBLE_CHANGED, g), d.removeChildListenersFuncs.push(function() { + S.removeEventListener(H.EVENT_WIDTH_CHANGED, g), S.removeEventListener(H.EVENT_VISIBLE_CHANGED, g); + }); + }); + }, f.prototype.removeListenersOnChildrenColumns = function() { + this.removeChildListenersFuncs.forEach(function(d) { + return d(); + }), this.removeChildListenersFuncs = []; + }, f.prototype.onDisplayedChildrenChanged = function() { + this.addListenersToChildrenColumns(), this.onWidthChanged(); + }, f.prototype.onWidthChanged = function() { + this.comp.setWidth(this.columnGroup.getActualWidth() + "px"); + }, G([ + ct + ], f.prototype, "postConstruct", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var ne = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), ue = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, we = ( + /** @class */ + function(M) { + ne(f, M); + function f(d, g) { + var S = M.call(this, d, g) || this; + return S.columnGroup = d, S; + } + return f.prototype.setComp = function(d, g, S) { + M.prototype.setGui.call(this, g), this.comp = d, this.displayName = this.columnModel.getDisplayNameForColumnGroup(this.columnGroup, "header"), this.addClasses(), this.addAttributes(), this.setupMovingCss(), this.setupExpandable(), this.setupTooltip(), this.setupUserComp(); + var O = this.getParentRowCtrl().getPinned(), z = this.columnGroup.getProvidedColumnGroup().getLeafColumns(); + this.createManagedBean(new x9(z, g)), this.createManagedBean(new cR(this.columnGroup, g, this.beans)), this.createManagedBean(new K(d, this.columnGroup)), this.groupResizeFeature = this.createManagedBean(new w(d, S, O, this.columnGroup)), this.createManagedBean(new R1(g, { + shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this), + onTabKeyDown: function() { + }, + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this) + })); + }, f.prototype.resizeLeafColumnsToFit = function() { + this.groupResizeFeature.onResizeStart(!1), this.groupResizeFeature.resizeLeafColumnsToFit(); + }, f.prototype.setupUserComp = function() { + var d = this, g = this.displayName, S = { + displayName: this.displayName, + columnGroup: this.columnGroup, + setExpanded: function(ze) { + d.columnModel.setColumnGroupOpened(d.columnGroup.getProvidedColumnGroup(), ze, "gridInitializing"); + }, + api: this.gridApi, + columnApi: this.columnApi, + context: this.gridOptionsWrapper.getContext() + }; + if (!g) { + for (var O = this.columnGroup, z = O.getLeafColumns(); O.getParent() && O.getParent().getLeafColumns().length === z.length; ) + O = O.getParent(); + var te = O.getColGroupDef(); + te && (g = te.headerName), g || (g = z ? this.columnModel.getDisplayNameForColumn(z[0], "header", !0) : ""); + } + var Fe = this.userComponentFactory.getHeaderGroupCompDetails(S); + this.comp.setUserCompDetails(Fe); + }, f.prototype.setupTooltip = function() { + var d = this, g = this.columnGroup.getColGroupDef(), S = { + getColumn: function() { + return d.columnGroup; + }, + getGui: function() { + return d.eGui; + }, + getLocation: function() { + return "headerGroup"; + }, + getTooltipValue: function() { + return g && g.headerTooltip; + } + }; + g && (S.getColDef = function() { + return g; + }); + var O = this.createManagedBean(new Kb(S, this.beans)); + O.setComp(this.comp); + }, f.prototype.setupExpandable = function() { + var d = this.columnGroup.getProvidedColumnGroup(); + this.refreshExpanded(), this.addManagedListener(d, Jt.EVENT_EXPANDABLE_CHANGED, this.refreshExpanded.bind(this)), this.addManagedListener(d, Jt.EVENT_EXPANDED_CHANGED, this.refreshExpanded.bind(this)); + }, f.prototype.refreshExpanded = function() { + var d = this.columnGroup; + this.expandable = d.isExpandable(); + var g = d.isExpanded(); + this.expandable ? this.comp.setAriaExpanded(g ? "true" : "false") : this.comp.setAriaExpanded(void 0); + }, f.prototype.addAttributes = function() { + this.comp.setColId(this.columnGroup.getUniqueId()); + }, f.prototype.addClasses = function() { + var d = this, g = this.columnGroup.getColGroupDef(), S = g9.getHeaderClassesFromColDef(g, this.gridOptionsWrapper, null, this.columnGroup); + S.push(this.columnGroup.isPadding() ? "ag-header-group-cell-no-group" : "ag-header-group-cell-with-group"), S.forEach(function(O) { + return d.comp.addOrRemoveCssClass(O, !0); + }); + }, f.prototype.setupMovingCss = function() { + var d = this, g = this.columnGroup.getProvidedColumnGroup(), S = g.getLeafColumns(), O = function() { + return d.comp.addOrRemoveCssClass("ag-header-cell-moving", d.columnGroup.isMoving()); + }; + S.forEach(function(z) { + d.addManagedListener(z, H.EVENT_MOVING_CHANGED, O); + }), O(); + }, f.prototype.onFocusIn = function(d) { + if (!this.eGui.contains(d.relatedTarget)) { + var g = this.getRowIndex(); + this.beans.focusService.setFocusedHeader(g, this.columnGroup); + } + }, f.prototype.handleKeyDown = function(d) { + var g = this.gridOptionsWrapper.getDocument(), S = g.activeElement, O = S === this.eGui; + if (!(!this.expandable || !O) && d.key === Hr.ENTER) { + var z = this.columnGroup, te = !z.isExpanded(); + this.columnModel.setColumnGroupOpened(z.getProvidedColumnGroup(), te, "uiColumnExpanded"); + } + }, f.prototype.setDragSource = function(d) { + var g = this; + if (!this.isSuppressMoving()) { + var S = this.columnGroup.getProvidedColumnGroup().getLeafColumns(), O = { + type: t.DragSourceType.HeaderCell, + eElement: d, + defaultIconName: fg.ICON_HIDE, + dragItemName: this.displayName, + // we add in the original group leaf columns, so we move both visible and non-visible items + getDragItem: this.getDragItemForGroup.bind(this), + onDragStarted: function() { + return S.forEach(function(z) { + return z.setMoving(!0, "uiColumnDragged"); + }); + }, + onDragStopped: function() { + return S.forEach(function(z) { + return z.setMoving(!1, "uiColumnDragged"); + }); + } + }; + this.dragAndDropService.addDragSource(O, !0), this.addDestroyFunc(function() { + return g.dragAndDropService.removeDragSource(O); + }); + } + }, f.prototype.getDragItemForGroup = function() { + var d = this.columnGroup.getProvidedColumnGroup().getLeafColumns(), g = {}; + d.forEach(function(O) { + return g[O.getId()] = O.isVisible(); + }); + var S = []; + return this.columnModel.getAllDisplayedColumns().forEach(function(O) { + d.indexOf(O) >= 0 && (S.push(O), q(d, O)); + }), d.forEach(function(O) { + return S.push(O); + }), { + columns: S, + visibleState: g + }; + }, f.prototype.isSuppressMoving = function() { + var d = !1; + this.columnGroup.getLeafColumns().forEach(function(S) { + (S.getColDef().suppressMovable || S.getColDef().lockPosition) && (d = !0); + }); + var g = d || this.gridOptionsWrapper.isSuppressMovableColumns(); + return g; + }, ue([ + pe("beans") + ], f.prototype, "beans", void 0), ue([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), ue([ + pe("dragAndDropService") + ], f.prototype, "dragAndDropService", void 0), ue([ + pe("userComponentFactory") + ], f.prototype, "userComponentFactory", void 0), ue([ + pe("gridApi") + ], f.prototype, "gridApi", void 0), ue([ + pe("columnApi") + ], f.prototype, "columnApi", void 0), f; + }(GC) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var De = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), $e = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Ke = 0, Ze = ( + /** @class */ + function(M) { + De(f, M); + function f(d, g, S) { + var O = M.call(this) || this; + return O.instanceId = Ke++, O.headerCellCtrls = {}, O.rowIndex = d, O.pinned = g, O.type = S, O; + } + return f.prototype.getInstanceId = function() { + return this.instanceId; + }, f.prototype.setComp = function(d) { + this.comp = d, this.onRowHeightChanged(), this.onVirtualColumnsChanged(), this.setWidth(), this.addEventListeners(), Mc() && this.comp.setTransform("translateZ(0)"), d.setAriaRowIndex(this.rowIndex + 1); + }, f.prototype.addEventListeners = function() { + this.addManagedListener(this.eventService, ui.EVENT_COLUMN_RESIZED, this.onColumnResized.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_DOM_LAYOUT, this.onDisplayedColumnsChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this)), this.addManagedListener(this.eventService, ui.EVENT_VIRTUAL_COLUMNS_CHANGED, this.onVirtualColumnsChanged.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_PIVOT_HEADER_HEIGHT, this.onRowHeightChanged.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_PIVOT_GROUP_HEADER_HEIGHT, this.onRowHeightChanged.bind(this)), this.addManagedListener(this.gridOptionsWrapper, jn.PROP_FLOATING_FILTERS_HEIGHT, this.onRowHeightChanged.bind(this)); + }, f.prototype.getHeaderCellCtrl = function(d) { + return y(this.headerCellCtrls).find(function(g) { + return g.getColumnGroupChild() === d; + }); + }, f.prototype.onDisplayedColumnsChanged = function() { + this.onVirtualColumnsChanged(), this.setWidth(); + }, f.prototype.getType = function() { + return this.type; + }, f.prototype.onColumnResized = function() { + this.setWidth(); + }, f.prototype.setWidth = function() { + var d = this.getWidthForRow(); + this.comp.setWidth(d + "px"); + }, f.prototype.getWidthForRow = function() { + var d = this.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_PRINT; + if (d) { + var g = this.pinned != null; + return g ? 0 : this.columnModel.getContainerWidth(Ue.PINNED_RIGHT) + this.columnModel.getContainerWidth(Ue.PINNED_LEFT) + this.columnModel.getContainerWidth(null); + } + return this.columnModel.getContainerWidth(this.pinned); + }, f.prototype.onRowHeightChanged = function() { + var d = this.columnModel.getHeaderRowCount(), g = [], S = 0, O, z; + this.columnModel.hasFloatingFilters() && (d++, S = 1), this.columnModel.isPivotMode() ? (O = this.gridOptionsWrapper.getPivotGroupHeaderHeight(), z = this.gridOptionsWrapper.getPivotHeaderHeight()) : (O = this.gridOptionsWrapper.getGroupHeaderHeight(), z = this.gridOptionsWrapper.getHeaderHeight()); + for (var te = 1 + S, Fe = d - te, ze = 0; ze < Fe; ze++) + g.push(O); + g.push(z); + for (var ze = 0; ze < S; ze++) + g.push(this.gridOptionsWrapper.getFloatingFiltersHeight()); + for (var ht = 0, ze = 0; ze < this.rowIndex; ze++) + ht += g[ze]; + this.comp.setTop(ht + "px"), this.comp.setHeight(g[this.rowIndex] + "px"); + }, f.prototype.getPinned = function() { + return this.pinned; + }, f.prototype.getRowIndex = function() { + return this.rowIndex; + }, f.prototype.onVirtualColumnsChanged = function() { + var d = this, g = this.headerCellCtrls; + this.headerCellCtrls = {}; + var S = this.getColumnsInViewport(); + S.forEach(function(te) { + if (!te.isEmptyGroup()) { + var Fe = te.getUniqueId(), ze = g[Fe]; + delete g[Fe]; + var ht = ze && ze.getColumnGroupChild() != te; + if (ht && (d.destroyBean(ze), ze = void 0), ze == null) + switch (d.type) { + case t.HeaderRowType.FLOATING_FILTER: + ze = d.createBean(new ZH(te, d)); + break; + case t.HeaderRowType.COLUMN_GROUP: + ze = d.createBean(new we(te, d)); + break; + default: + ze = d.createBean(new U(te, d)); + break; + } + d.headerCellCtrls[Fe] = ze; + } + }); + var O = function(te) { + var Fe = d.focusService.isHeaderWrapperFocused(te); + if (!Fe) + return !1; + var ze = d.columnModel.isDisplayed(te.getColumnGroupChild()); + return ze; + }; + I(g, function(te, Fe) { + var ze = O(Fe); + ze ? d.headerCellCtrls[te] = Fe : d.destroyBean(Fe); + }); + var z = re(this.headerCellCtrls); + this.comp.setHeaderCtrls(z); + }, f.prototype.destroyCtrls = function() { + var d = this; + I(this.headerCellCtrls, function(g, S) { + d.destroyBean(S); + }), this.headerCellCtrls = {}; + }, f.prototype.getColumnsInViewport = function() { + var d = this.gridOptionsWrapper.getDomLayout() === Ue.DOM_LAYOUT_PRINT; + return d ? this.getColumnsInViewportPrintLayout() : this.getColumnsInViewportNormalLayout(); + }, f.prototype.getColumnsInViewportPrintLayout = function() { + var d = this; + if (this.pinned != null) + return []; + var g = [], S = this.getActualDepth(); + return [Ue.PINNED_LEFT, null, Ue.PINNED_RIGHT].forEach(function(O) { + var z = d.columnModel.getVirtualHeaderGroupRow(O, S); + g = g.concat(z); + }), g; + }, f.prototype.getActualDepth = function() { + return this.type == t.HeaderRowType.FLOATING_FILTER ? this.rowIndex - 1 : this.rowIndex; + }, f.prototype.getColumnsInViewportNormalLayout = function() { + return this.columnModel.getVirtualHeaderGroupRow(this.pinned, this.getActualDepth()); + }, f.prototype.focusHeader = function(d, g) { + var S = re(this.headerCellCtrls), O = S.find(function(z) { + return z.getColumnGroupChild() == d; + }); + return O ? (O.focus(g), !0) : !1; + }, $e([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), $e([ + pe("focusService") + ], f.prototype, "focusService", void 0), $e([ + gt + ], f.prototype, "destroyCtrls", null), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var pt = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Vt = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Yt = function(M, f) { + var d = typeof Symbol == "function" && M[Symbol.iterator]; + if (!d) + return M; + var g = d.call(M), S, O = [], z; + try { + for (; (f === void 0 || f-- > 0) && !(S = g.next()).done; ) + O.push(S.value); + } catch (te) { + z = { error: te }; + } finally { + try { + S && !S.done && (d = g.return) && d.call(g); + } finally { + if (z) + throw z.error; + } + } + return O; + }, ci = function() { + for (var M = [], f = 0; f < arguments.length; f++) + M = M.concat(Yt(arguments[f])); + return M; + }, ai = ( + /** @class */ + function(M) { + pt(f, M); + function f(d) { + var g = M.call(this) || this; + return g.groupsRowCtrls = [], g.pinned = d, g; + } + return f.prototype.setComp = function(d, g) { + this.comp = d, this.setupCenterWidth(), this.setupPinnedWidth(), this.setupDragAndDrop(g), this.addManagedListener(this.eventService, ui.EVENT_GRID_COLUMNS_CHANGED, this.onGridColumnsChanged.bind(this)), this.ctrlsService.registerHeaderContainer(this, this.pinned), this.columnModel.isReady() && this.refresh(); + }, f.prototype.setupDragAndDrop = function(d) { + var g = new jL(this.pinned, d); + this.createManagedBean(g); + }, f.prototype.refresh = function(d) { + var g = this; + d === void 0 && (d = !1); + var S = new Hv(), O = this.focusService.getFocusHeaderToUseAfterRefresh(), z = function() { + var ht = g.columnModel.getHeaderRowCount() - 1; + g.groupsRowCtrls = g.destroyBeans(g.groupsRowCtrls); + for (var Lt = 0; Lt < ht; Lt++) { + var ti = g.createBean(new Ze(S.next(), g.pinned, t.HeaderRowType.COLUMN_GROUP)); + g.groupsRowCtrls.push(ti); + } + }, te = function() { + var ht = S.next(), Lt = g.columnsRowCtrl == null || !d || g.columnsRowCtrl.getRowIndex() !== ht; + Lt && (g.destroyBean(g.columnsRowCtrl), g.columnsRowCtrl = g.createBean(new Ze(ht, g.pinned, t.HeaderRowType.COLUMN))); + }, Fe = function() { + var ht = g.columnModel.hasFloatingFilters(), Lt = function() { + g.filtersRowCtrl = g.destroyBean(g.filtersRowCtrl); + }; + if (!ht) { + Lt(); + return; + } + var ti = S.next(); + if (g.filtersRowCtrl) { + var wi = g.filtersRowCtrl.getRowIndex() !== ti; + (!d || wi) && Lt(); + } + g.filtersRowCtrl || (g.filtersRowCtrl = g.createBean(new Ze(ti, g.pinned, t.HeaderRowType.FLOATING_FILTER))); + }; + z(), te(), Fe(); + var ze = this.getAllCtrls(); + this.comp.setCtrls(ze), this.restoreFocusOnHeader(O); + }, f.prototype.restoreFocusOnHeader = function(d) { + d == null || d.column.getPinned() != this.pinned || this.focusService.focusHeaderPosition({ headerPosition: d }); + }, f.prototype.getAllCtrls = function() { + var d = ci(this.groupsRowCtrls, [this.columnsRowCtrl]); + return this.filtersRowCtrl && d.push(this.filtersRowCtrl), d; + }, f.prototype.onGridColumnsChanged = function() { + this.refresh(!0); + }, f.prototype.setupCenterWidth = function() { + var d = this; + this.pinned == null && this.createManagedBean(new kH(function(g) { + return d.comp.setCenterWidth(g + "px"); + })); + }, f.prototype.setHorizontalScroll = function(d) { + this.comp.setContainerTransform("translateX(" + d + "px)"); + }, f.prototype.setupPinnedWidth = function() { + var d = this; + if (this.pinned != null) { + var g = this.pinned === Ue.PINNED_LEFT, S = this.pinned === Ue.PINNED_RIGHT, O = function() { + var z = g ? d.pinnedWidthService.getPinnedLeftWidth() : d.pinnedWidthService.getPinnedRightWidth(); + if (z != null) { + var te = z == 0, Fe = d.gridOptionsWrapper.isEnableRtl(), ze = d.gridOptionsWrapper.getScrollbarWidth(), ht = d.scrollVisibleService.isVerticalScrollShowing() && (Fe && g || !Fe && S), Lt = ht ? z + ze : z; + d.comp.setPinnedContainerWidth(Lt + "px"), d.comp.addOrRemoveCssClass("ag-hidden", te); + } + }; + this.addManagedListener(this.eventService, ui.EVENT_LEFT_PINNED_WIDTH_CHANGED, O), this.addManagedListener(this.eventService, ui.EVENT_RIGHT_PINNED_WIDTH_CHANGED, O), this.addManagedListener(this.eventService, ui.EVENT_SCROLL_VISIBILITY_CHANGED, O), this.addManagedListener(this.eventService, ui.EVENT_SCROLLBAR_WIDTH_CHANGED, O); + } + }, f.prototype.getHeaderCtrlForColumn = function(d) { + if (d instanceof H) + return this.columnsRowCtrl ? this.columnsRowCtrl.getHeaderCellCtrl(d) : void 0; + if (this.groupsRowCtrls.length !== 0) + for (var g = 0; g < this.groupsRowCtrls.length; g++) { + var S = this.groupsRowCtrls[g].getHeaderCellCtrl(d); + if (S) + return S; + } + }, f.prototype.getHtmlElementForColumnHeader = function(d) { + var g = this.getHeaderCtrlForColumn(d); + return g ? g.getGui() : null; + }, f.prototype.getRowType = function(d) { + var g = this.getAllCtrls(), S = g[d]; + return S ? S.getType() : void 0; + }, f.prototype.focusHeader = function(d, g, S) { + var O = this.getAllCtrls(), z = O[d]; + return z ? z.focusHeader(g, S) : !1; + }, f.prototype.getRowCount = function() { + return this.getAllCtrls().length; + }, Vt([ + pe("ctrlsService") + ], f.prototype, "ctrlsService", void 0), Vt([ + pe("scrollVisibleService") + ], f.prototype, "scrollVisibleService", void 0), Vt([ + pe("pinnedWidthService") + ], f.prototype, "pinnedWidthService", void 0), Vt([ + pe("columnModel") + ], f.prototype, "columnModel", void 0), Vt([ + pe("focusService") + ], f.prototype, "focusService", void 0), f; + }(ki) + ); + /** + * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue + * @version v27.3.0 + * @link https://www.ag-grid.com/ + * @license MIT + */ + var Gi = function() { + var M = function(f, d) { + return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(g, S) { + g.__proto__ = S; + } || function(g, S) { + for (var O in S) + S.hasOwnProperty(O) && (g[O] = S[O]); + }, M(f, d); + }; + return function(f, d) { + M(f, d); + function g() { + this.constructor = f; + } + f.prototype = d === null ? Object.create(d) : (g.prototype = d.prototype, new g()); + }; + }(), Ji = function(M, f, d, g) { + var S = arguments.length, O = S < 3 ? f : g === null ? g = Object.getOwnPropertyDescriptor(f, d) : g, z; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + O = Reflect.decorate(M, f, d, g); + else + for (var te = M.length - 1; te >= 0; te--) + (z = M[te]) && (O = (S < 3 ? z(O) : S > 3 ? z(f, d, O) : z(f, d)) || O); + return S > 3 && O && Object.defineProperty(f, d, O), O; + }, Ci = ( + /** @class */ + function(M) { + Gi(f, M); + function f(d) { + var g = M.call(this) || this; + return g.headerRowComps = {}, g.rowCompsList = [], g.pinned = d, g; + } + return f.prototype.init = function() { + var d = this; + this.selectAndSetTemplate(); + var g = { + addOrRemoveCssClass: function(O, z) { + return d.addOrRemoveCssClass(O, z); + }, + setCtrls: function(O) { + return d.setCtrls(O); + }, + // only gets called for center section + setCenterWidth: function(O) { + return d.eCenterContainer.style.width = O; + }, + setContainerTransform: function(O) { + return d.eCenterContainer.style.transform = O; + }, + // only gets called for pinned sections + setPinnedContainerWidth: function(O) { + var z = d.getGui(); + z.style.width = O, z.style.maxWidth = O, z.style.minWidth = O; + } + }, S = this.createManagedBean(new ai(this.pinned)); + S.setComp(g, this.getGui()); + }, f.prototype.selectAndSetTemplate = function() { + var d = this.pinned == Ue.PINNED_LEFT, g = this.pinned == Ue.PINNED_RIGHT, S = d ? f.PINNED_LEFT_TEMPLATE : g ? f.PINNED_RIGHT_TEMPLATE : f.CENTER_TEMPLATE; + this.setTemplate(S), this.eRowContainer = this.eCenterContainer ? this.eCenterContainer : this.getGui(); + }, f.prototype.destroyRowComps = function() { + this.setCtrls([]); + }, f.prototype.destroyRowComp = function(d) { + this.destroyBean(d), this.eRowContainer.removeChild(d.getGui()); + }, f.prototype.setCtrls = function(d) { + var g = this, S = this.headerRowComps; + this.headerRowComps = {}, this.rowCompsList = []; + var O, z = function(te) { + var Fe = te.getGui(), ze = Fe.parentElement != g.eRowContainer; + ze && g.eRowContainer.appendChild(Fe), O && $l(g.eRowContainer, Fe, O), O = Fe; + }; + d.forEach(function(te) { + var Fe = te.getInstanceId(), ze = S[Fe]; + delete S[Fe]; + var ht = ze || g.createBean(new XH(te)); + g.headerRowComps[Fe] = ht, g.rowCompsList.push(ht), z(ht); + }), re(S).forEach(function(te) { + return g.destroyRowComp(te); + }); + }, f.PINNED_LEFT_TEMPLATE = '